diff --git a/data/miniconda3/envs/catiagent/include/GL/internal/glcore.h b/data/miniconda3/envs/catiagent/include/GL/internal/glcore.h new file mode 100644 index 0000000000000000000000000000000000000000..edcb0148d2c20c92810092238724bb19b9ecd6f9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/GL/internal/glcore.h @@ -0,0 +1,181 @@ +#ifndef __gl_core_h_ +#define __gl_core_h_ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#if !defined(_WIN32_WCE) +#include +#endif + +#define GL_CORE_SGI 1 +#define GL_CORE_MESA 2 +#define GL_CORE_APPLE 4 +#define GL_CORE_WINDOWS 8 + +typedef struct __GLcontextRec __GLcontext; + +/* +** This file defines the interface between the GL core and the surrounding +** "operating system" that supports it (currently the GLX or WGL extensions). +** +** Members (data and function pointers) are documented as imported or +** exported according to how they are used by the core rendering functions. +** Imported members are initialized by the "operating system" and used by +** the core functions. Exported members are initialized by the core functions +** and used by the "operating system". +*/ + +/** + * Mode and limit information for a context. This information is + * kept around in the context so that values can be used during + * command execution, and for returning information about the + * context to the application. + * + * Instances of this structure are shared by the driver and the loader. To + * maintain binary compatibility, new fields \b must be added only to the + * end of the structure. + * + * \sa _gl_context_modes_create + */ +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +} __GLcontextModes; + +/* Several fields of __GLcontextModes can take these as values. Since + * GLX header files may not be available everywhere they need to be used, + * redefine them here. + */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLX_DONT_CARE 0xFFFFFFFF + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 + +#endif /* __gl_core_h_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICE.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICE.h new file mode 100644 index 0000000000000000000000000000000000000000..7560647ed836b4f37891144a82f6dd90c4806a40 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICE.h @@ -0,0 +1,101 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium + +******************************************************************************/ + +#ifndef _ICE_H_ +#define _ICE_H_ + +/* + * Protocol Version + */ + +#define IceProtoMajor 1 +#define IceProtoMinor 0 + + +/* + * Byte Order + */ + +#define IceLSBfirst 0 +#define IceMSBfirst 1 + + +/* + * ICE minor opcodes + */ + +#define ICE_Error 0 +#define ICE_ByteOrder 1 +#define ICE_ConnectionSetup 2 +#define ICE_AuthRequired 3 +#define ICE_AuthReply 4 +#define ICE_AuthNextPhase 5 +#define ICE_ConnectionReply 6 +#define ICE_ProtocolSetup 7 +#define ICE_ProtocolReply 8 +#define ICE_Ping 9 +#define ICE_PingReply 10 +#define ICE_WantToClose 11 +#define ICE_NoClose 12 + + +/* + * Error severity + */ + +#define IceCanContinue 0 +#define IceFatalToProtocol 1 +#define IceFatalToConnection 2 + + +/* + * ICE error classes that are common to all protocols + */ + +#define IceBadMinor 0x8000 +#define IceBadState 0x8001 +#define IceBadLength 0x8002 +#define IceBadValue 0x8003 + + +/* + * ICE error classes that are specific to the ICE protocol + */ + +#define IceBadMajor 0 +#define IceNoAuth 1 +#define IceNoVersion 2 +#define IceSetupFailed 3 +#define IceAuthRejected 4 +#define IceAuthFailed 5 +#define IceProtocolDuplicate 6 +#define IceMajorOpcodeDuplicate 7 +#define IceUnknownProtocol 8 + +#endif /* _ICE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICEconn.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEconn.h new file mode 100644 index 0000000000000000000000000000000000000000..01894273a9263f8f627dc974523d5526e8c2b09e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEconn.h @@ -0,0 +1,250 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium +******************************************************************************/ + +#ifndef _ICECONN_H_ +#define _ICECONN_H_ + +#include + +/* + * Data structures for ICE connection object + */ + +typedef struct _IceSavedReplyWait { + IceReplyWaitInfo *reply_wait; + Bool reply_ready; + struct _IceSavedReplyWait *next; +} _IceSavedReplyWait; + +typedef struct _IcePingWait { + IcePingReplyProc ping_reply_proc; + IcePointer client_data; + struct _IcePingWait *next; +} _IcePingWait; + +typedef struct { + char *vendor; + char *release; + int version_count; + IcePoVersionRec *version_recs; + int auth_count; + char **auth_names; + IcePoAuthProc *auth_procs; + IceIOErrorProc io_error_proc; +} _IcePoProtocol; + +typedef struct { + char *vendor; + char *release; + int version_count; + IcePaVersionRec *version_recs; + IceProtocolSetupProc protocol_setup_proc; + IceProtocolActivateProc protocol_activate_proc; + int auth_count; + char **auth_names; + IcePaAuthProc *auth_procs; + IceHostBasedAuthProc host_based_auth_proc; + IceIOErrorProc io_error_proc; +} _IcePaProtocol; + +typedef struct { + char *protocol_name; + _IcePoProtocol *orig_client; + _IcePaProtocol *accept_client; +} _IceProtocol; + +typedef struct { + Bool in_use; + int my_opcode; + _IceProtocol *protocol; + IcePointer client_data; + Bool accept_flag; + union { + IcePaProcessMsgProc accept_client; + IcePoProcessMsgProc orig_client; + } process_msg_proc; +} _IceProcessMsgInfo; + +typedef struct { + int his_version_index; + int my_version_index; + char *his_vendor; + char *his_release; + char my_auth_index; + IcePointer my_auth_state; + Bool must_authenticate; +} _IceConnectToMeInfo; + +typedef struct { + int his_opcode; + int my_opcode; + int his_version_index; + int my_version_index; + char *his_vendor; + char *his_release; + char my_auth_index; + IcePointer my_auth_state; + Bool must_authenticate; +} _IceProtoSetupToMeInfo; + +typedef struct { + Bool auth_active; + char my_auth_index; + IcePointer my_auth_state; +} _IceConnectToYouInfo; + +typedef struct { + int my_opcode; + int my_auth_count; + int *my_auth_indices; + Bool auth_active; + char my_auth_index; + IcePointer my_auth_state; +} _IceProtoSetupToYouInfo; + + +struct _IceConn { + + unsigned int io_ok : 1; /* did an IO error occur? */ + unsigned int swap : 1; /* do we need to swap on reads? */ + unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */ + unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */ + unsigned int want_to_close : 1; /* did we send a WantToClose? */ + unsigned int free_asap : 1; /* free as soon as possible */ + unsigned int unused1 : 2; /* future use */ + unsigned int unused2 : 8; /* future use */ + + IceConnectStatus connection_status; /* pending, accepted, rejected */ + + unsigned char my_ice_version_index; /* which version are we using? */ + + struct _XtransConnInfo *trans_conn; /* transport connection object */ + unsigned long send_sequence; /* Sequence # of last msg sent */ + unsigned long receive_sequence; /* Sequence # of last msg received */ + + char *connection_string; /* network connection string */ + char *vendor; /* other client's vendor */ + char *release; /* other client's release */ + + char *inbuf; /* Input buffer starting address */ + char *inbufptr; /* Input buffer index pointer */ + char *inbufmax; /* Input buffer maximum+1 address */ + + char *outbuf; /* Output buffer starting address */ + char *outbufptr; /* Output buffer index pointer */ + char *outbufmax; /* Output buffer maximum+1 address */ + + char *scratch; /* scratch buffer */ + unsigned long scratch_size; /* scratch size */ + + int dispatch_level; /* IceProcessMessages dispatch level */ + + IcePointer context; /* context associated with caller + of IceOpenConnection */ + + /* + * Before we read a message, the major opcode of the message must be + * mapped to our corresponding major opcode (the two clients can use + * different opcodes for the same protocol). In order to save space, + * we keep track of the minimum and maximum major opcodes used by the + * other client. To get the information on how to process this message, + * we do the following... + * + * processMsgInfo = iceConn->process_msg_info[ + * message->majorOpcode - iceConn->his_min_opcode] + * + * Note that the number of elements in the iceConn->process_msg_info + * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1). + * We check process_msg_info->in_use to see if the opcode is being used. + */ + + _IceProcessMsgInfo *process_msg_info; + char his_min_opcode; /* [1..255] */ + char his_max_opcode; /* [1..255] */ + + + /* + * Number of times this iceConn was returned in IceOpenConnection + * or IceAcceptConnection. + */ + + unsigned char open_ref_count; + + + /* + * Number of active protocols. + */ + + unsigned char proto_ref_count; + + + /* + * If this ICE connection was created with IceAcceptConnection, + * the listen_obj field is set to the listen object. Otherwise, + * the listen_obj field is NULL. + */ + + IceListenObj listen_obj; + + + + + /* + * We need to keep track of all the replies we're waiting for. + * Check the comments in process.c for how this works. + */ + + _IceSavedReplyWait *saved_reply_waits; + + + /* + * We keep track of all Pings sent from the client. When the Ping reply + * arrives, we remove it from the list. + */ + + _IcePingWait *ping_waits; + + + /* + * Some state for a client doing a Connection/Protocol Setup + */ + + _IceConnectToYouInfo *connect_to_you; + _IceProtoSetupToYouInfo *protosetup_to_you; + + + /* + * Some state for a client receiving a Connection/Protocol Setup + */ + + _IceConnectToMeInfo *connect_to_me; + _IceProtoSetupToMeInfo *protosetup_to_me; + +}; + +#endif /* _ICECONN_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICElib.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICElib.h new file mode 100644 index 0000000000000000000000000000000000000000..402cbc8bd61e8706068a1c6c3d9ebbc7cf64091b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICElib.h @@ -0,0 +1,431 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium +******************************************************************************/ + +#ifndef _ICELIB_H_ +#define _ICELIB_H_ + +#include +#include + +#define Bool int +#define Status int +#define True 1 +#define False 0 + +typedef void *IcePointer; + +typedef enum { + IcePoAuthHaveReply, + IcePoAuthRejected, + IcePoAuthFailed, + IcePoAuthDoneCleanup +} IcePoAuthStatus; + +typedef enum { + IcePaAuthContinue, + IcePaAuthAccepted, + IcePaAuthRejected, + IcePaAuthFailed +} IcePaAuthStatus; + +typedef enum { + IceConnectPending, + IceConnectAccepted, + IceConnectRejected, + IceConnectIOError +} IceConnectStatus; + +typedef enum { + IceProtocolSetupSuccess, + IceProtocolSetupFailure, + IceProtocolSetupIOError, + IceProtocolAlreadyActive +} IceProtocolSetupStatus; + +typedef enum { + IceAcceptSuccess, + IceAcceptFailure, + IceAcceptBadMalloc +} IceAcceptStatus; + +typedef enum { + IceClosedNow, + IceClosedASAP, + IceConnectionInUse, + IceStartedShutdownNegotiation +} IceCloseStatus; + +typedef enum { + IceProcessMessagesSuccess, + IceProcessMessagesIOError, + IceProcessMessagesConnectionClosed +} IceProcessMessagesStatus; + +typedef struct { + unsigned long sequence_of_request; + int major_opcode_of_request; + int minor_opcode_of_request; + IcePointer reply; +} IceReplyWaitInfo; + +typedef struct _IceConn *IceConn; +typedef struct _IceListenObj *IceListenObj; + +typedef void (*IceWatchProc) ( + IceConn /* iceConn */, + IcePointer /* clientData */, + Bool /* opening */, + IcePointer * /* watchData */ +); + +typedef void (*IcePoProcessMsgProc) ( + IceConn /* iceConn */, + IcePointer /* clientData */, + int /* opcode */, + unsigned long /* length */, + Bool /* swap */, + IceReplyWaitInfo * /* replyWait */, + Bool * /* replyReadyRet */ +); + +typedef void (*IcePaProcessMsgProc) ( + IceConn /* iceConn */, + IcePointer /* clientData */, + int /* opcode */, + unsigned long /* length */, + Bool /* swap */ +); + +typedef struct { + int major_version; + int minor_version; + IcePoProcessMsgProc process_msg_proc; +} IcePoVersionRec; + +typedef struct { + int major_version; + int minor_version; + IcePaProcessMsgProc process_msg_proc; +} IcePaVersionRec; + +typedef IcePoAuthStatus (*IcePoAuthProc) ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* cleanUp */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +typedef IcePaAuthStatus (*IcePaAuthProc) ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +typedef Bool (*IceHostBasedAuthProc) ( + char * /* hostName */ +); + +typedef Status (*IceProtocolSetupProc) ( + IceConn /* iceConn */, + int /* majorVersion */, + int /* minorVersion */, + char * /* vendor */, + char * /* release */, + IcePointer * /* clientDataRet */, + char ** /* failureReasonRet */ +); + +typedef void (*IceProtocolActivateProc) ( + IceConn /* iceConn */, + IcePointer /* clientData */ +); + +typedef void (*IceIOErrorProc) ( + IceConn /* iceConn */ +); + +typedef void (*IcePingReplyProc) ( + IceConn /* iceConn */, + IcePointer /* clientData */ +); + +typedef void (*IceErrorHandler) ( + IceConn /* iceConn */, + Bool /* swap */, + int /* offendingMinorOpcode */, + unsigned long /* offendingSequence */, + int /* errorClass */, + int /* severity */, + IcePointer /* values */ +); + +typedef void (*IceIOErrorHandler) ( + IceConn /* iceConn */ +); + + +/* + * Function prototypes + */ + +_XFUNCPROTOBEGIN + +extern int IceRegisterForProtocolSetup ( + const char * /* protocolName */, + const char * /* vendor */, + const char * /* release */, + int /* versionCount */, + IcePoVersionRec * /* versionRecs */, + int /* authCount */, + const char ** /* authNames */, + IcePoAuthProc * /* authProcs */, + IceIOErrorProc /* IOErrorProc */ +); + +extern int IceRegisterForProtocolReply ( + const char * /* protocolName */, + const char * /* vendor */, + const char * /* release */, + int /* versionCount */, + IcePaVersionRec * /* versionRecs */, + int /* authCount */, + const char ** /* authNames */, + IcePaAuthProc * /* authProcs */, + IceHostBasedAuthProc /* hostBasedAuthProc */, + IceProtocolSetupProc /* protocolSetupProc */, + IceProtocolActivateProc /* protocolActivateProc */, + IceIOErrorProc /* IOErrorProc */ +); + +extern IceConn IceOpenConnection ( + char * /* networkIdsList */, + IcePointer /* context */, + Bool /* mustAuthenticate */, + int /* majorOpcodeCheck */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern IcePointer IceGetConnectionContext ( + IceConn /* iceConn */ +); + +extern Status IceListenForConnections ( + int * /* countRet */, + IceListenObj ** /* listenObjsRet */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern Status IceListenForWellKnownConnections ( + char * /* port */, + int * /* countRet */, + IceListenObj ** /* listenObjsRet */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern int IceGetListenConnectionNumber ( + IceListenObj /* listenObj */ +); + +extern char *IceGetListenConnectionString ( + IceListenObj /* listenObj */ +); + +extern char *IceComposeNetworkIdList ( + int /* count */, + IceListenObj * /* listenObjs */ +); + +extern void IceFreeListenObjs ( + int /* count */, + IceListenObj * /* listenObjs */ +); + +extern void IceSetHostBasedAuthProc ( + IceListenObj /* listenObj */, + IceHostBasedAuthProc /* hostBasedAuthProc */ +); + +extern IceConn IceAcceptConnection ( + IceListenObj /* listenObj */, + IceAcceptStatus * /* statusRet */ +); + +extern void IceSetShutdownNegotiation ( + IceConn /* iceConn */, + Bool /* negotiate */ +); + +extern Bool IceCheckShutdownNegotiation ( + IceConn /* iceConn */ +); + +extern IceCloseStatus IceCloseConnection ( + IceConn /* iceConn */ +); + +extern Status IceAddConnectionWatch ( + IceWatchProc /* watchProc */, + IcePointer /* clientData */ +); + +extern void IceRemoveConnectionWatch ( + IceWatchProc /* watchProc */, + IcePointer /* clientData */ +); + +extern IceProtocolSetupStatus IceProtocolSetup ( + IceConn /* iceConn */, + int /* myOpcode */, + IcePointer /* clientData */, + Bool /* mustAuthenticate */, + int * /* majorVersionRet */, + int * /* minorVersionRet */, + char ** /* vendorRet */, + char ** /* releaseRet */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern Status IceProtocolShutdown ( + IceConn /* iceConn */, + int /* majorOpcode */ +); + +extern IceProcessMessagesStatus IceProcessMessages ( + IceConn /* iceConn */, + IceReplyWaitInfo * /* replyWait */, + Bool * /* replyReadyRet */ +); + +extern Status IcePing ( + IceConn /* iceConn */, + IcePingReplyProc /* pingReplyProc */, + IcePointer /* clientData */ +); + +extern char *IceAllocScratch ( + IceConn /* iceConn */, + unsigned long /* size */ +); + +extern int IceFlush ( + IceConn /* iceConn */ +); + +extern int IceGetOutBufSize ( + IceConn /* iceConn */ +); + +extern int IceGetInBufSize ( + IceConn /* iceConn */ +); + +extern IceConnectStatus IceConnectionStatus ( + IceConn /* iceConn */ +); + +extern char *IceVendor ( + IceConn /* iceConn */ +); + +extern char *IceRelease ( + IceConn /* iceConn */ +); + +extern int IceProtocolVersion ( + IceConn /* iceConn */ +); + +extern int IceProtocolRevision ( + IceConn /* iceConn */ +); + +extern int IceConnectionNumber ( + IceConn /* iceConn */ +); + +extern char *IceConnectionString ( + IceConn /* iceConn */ +); + +extern unsigned long IceLastSentSequenceNumber ( + IceConn /* iceConn */ +); + +extern unsigned long IceLastReceivedSequenceNumber ( + IceConn /* iceConn */ +); + +extern Bool IceSwapping ( + IceConn /* iceConn */ +); + +extern IceErrorHandler IceSetErrorHandler ( + IceErrorHandler /* handler */ +); + +extern IceIOErrorHandler IceSetIOErrorHandler ( + IceIOErrorHandler /* handler */ +); + +extern char *IceGetPeerName ( + IceConn /* iceConn */ +); + +/* + * Multithread Routines + */ + +extern Status IceInitThreads ( + void +); + +extern void IceAppLockConn ( + IceConn /* iceConn */ +); + +extern void IceAppUnlockConn ( + IceConn /* iceConn */ +); + +_XFUNCPROTOEND + +#endif /* _ICELIB_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICEmsg.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEmsg.h new file mode 100644 index 0000000000000000000000000000000000000000..13e15094aca670f4c01326c7cbcf5a8522e5b573 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEmsg.h @@ -0,0 +1,306 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium +******************************************************************************/ + +#ifndef _ICEMSG_H_ +#define _ICEMSG_H_ + +#include + +#include + +#include +#if !defined(__cplusplus) && !defined(static_assert) +#define static_assert(cond, msg) /* skip for non-C11 compilers */ +#endif + +_XFUNCPROTOBEGIN + +/* + * Function prototypes for internal ICElib functions + */ + +extern Status _IceRead ( + IceConn /* iceConn */, + unsigned long /* nbytes */, + char * /* ptr */ +); + +extern void _IceReadSkip ( + IceConn /* iceConn */, + unsigned long /* nbytes */ +); + +extern void _IceWrite ( + IceConn /* iceConn */, + unsigned long /* nbytes */, + char * /* ptr */ +); + + +extern void _IceErrorBadMinor ( + IceConn /* iceConn */, + int /* majorOpcode */, + int /* offendingMinor */, + int /* severity */ +); + +extern void _IceErrorBadState ( + IceConn /* iceConn */, + int /* majorOpcode */, + int /* offendingMinor */, + int /* severity */ +); + +extern void _IceErrorBadLength ( + IceConn /* iceConn */, + int /* majorOpcode */, + int /* offendingMinor */, + int /* severity */ +); + +extern void _IceErrorBadValue ( + IceConn /* iceConn */, + int /* majorOpcode */, + int /* offendingMinor */, + int /* offset */, + int /* length */, + IcePointer /* value */ +); + +extern IcePoAuthStatus _IcePoMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* cleanUp */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +extern IcePaAuthStatus _IcePaMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + + +/* + * Macro to check if IO operations are valid on an ICE connection. + */ + +#define IceValidIO(_iceConn) _iceConn->io_ok + + +/* + * Macros for writing messages. + */ + +#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \ +do { \ + static_assert(_headerSize <= 1024, \ + "Header size larger than ICE_OUTBUFSIZE"); \ + if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \ + IceFlush (_iceConn); \ + _pMsg = (_msgType *) _iceConn->outbufptr; \ + _pMsg->majorOpcode = _major; \ + _pMsg->minorOpcode = _minor; \ + _pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \ + _iceConn->outbufptr += _headerSize; \ + _iceConn->send_sequence++; \ +} while (0) + +#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \ +do { \ + static_assert(_headerSize <= 1024, \ + "Header size larger than ICE_OUTBUFSIZE"); \ + if ((_iceConn->outbufptr + \ + _headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \ + IceFlush (_iceConn); \ + _pMsg = (_msgType *) _iceConn->outbufptr; \ + _iceConn->outbufptr += _headerSize; \ + if ((_iceConn->outbufptr + ((_extra) << 3)) <= _iceConn->outbufmax) { \ + _pData = _iceConn->outbufptr; \ + _iceConn->outbufptr += ((_extra) << 3); \ + } \ + else \ + _pData = NULL; \ + _pMsg->majorOpcode = _major; \ + _pMsg->minorOpcode = _minor; \ + _pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \ + _iceConn->send_sequence++; \ +} while (0) + +#define IceSimpleMessage(_iceConn, _major, _minor) \ +{ \ + iceMsg *_pMsg; \ + IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \ +} + +#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \ +{ \ + iceErrorMsg *_pMsg; \ +\ + IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \ + SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \ + _pMsg->length += (_dataLength); \ + _pMsg->offendingMinorOpcode = (CARD8) _offendingMinorOpcode; \ + _pMsg->severity = (CARD8) _severity; \ + _pMsg->offendingSequenceNum = (CARD32) _offendingSequenceNum; \ + _pMsg->errorClass = (CARD16) _errorClass; \ +} + + +/* + * Write data into the ICE output buffer. + */ + +#define IceWriteData(_iceConn, _bytes, _data) \ +{ \ + if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \ + { \ + IceFlush (_iceConn); \ + _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \ + } \ + else \ + { \ + memcpy (_iceConn->outbufptr, _data, _bytes); \ + _iceConn->outbufptr += (_bytes); \ + } \ +} + +#define IceWriteData16(_iceConn, _bytes, _data) \ + IceWriteData (_iceConn, _bytes, (char *) _data) + +#define IceWriteData32(_iceConn, _bytes, _data) \ + IceWriteData (_iceConn, _bytes, (char *) _data) + + +/* + * The IceSendData macro bypasses copying the data to the + * ICE connection buffer and sends the data directly. If necessary, + * the ICE connection buffer is first flushed. + */ + +#define IceSendData(_iceConn, _bytes, _data) \ +{ \ + if (_iceConn->outbufptr > _iceConn->outbuf) \ + IceFlush (_iceConn); \ + _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \ +} + + +/* + * Write pad bytes. Used to force 32 or 64 bit alignment. + * A maximum of 7 pad bytes can be specified. + */ + +#define IceWritePad(_iceConn, _bytes) \ +{ \ + char _dummy[7] = { 0 }; \ + IceWriteData (_iceConn, (_bytes), _dummy); \ +} + + +/* + * Macros for reading messages. + */ + +#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\ +{ \ + unsigned long _bytes; \ + IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \ + _bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \ + if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \ + { \ + _IceRead (_iceConn, _bytes, _iceConn->inbufptr); \ + _pData = _iceConn->inbufptr; \ + _iceConn->inbufptr += _bytes; \ + } \ + else \ + { \ + _pData = malloc (_bytes); \ + if (_pData) \ + _IceRead (_iceConn, _bytes, _pData); \ + else \ + _IceReadSkip (_iceConn, _bytes); \ + } \ +} + +#define IceDisposeCompleteMessage(_iceConn, _pData) \ + if ((char *) _pData < _iceConn->inbuf || \ + (char *) _pData >= _iceConn->inbufmax) \ + free (_pData); + + +#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \ + _pMsg = (_msgType *) (_iceConn->inbuf); + +#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \ +{ \ + _IceRead (_iceConn, \ + (unsigned long) (_headerSize - SIZEOF (iceMsg)), \ + _iceConn->inbufptr); \ + _pMsg = (_msgType *) (_iceConn->inbuf); \ + _iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \ +} + +#define IceReadData(_iceConn, _bytes, _pData) \ + _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ + +#define IceReadData16(_iceConn, _swap, _bytes, _pData) \ +{ \ + _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ +} + +#define IceReadData32(_iceConn, _swap, _bytes, _pData) \ +{ \ + _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \ +} + + +/* + * Read pad bytes (for 32 or 64 bit alignment). + * A maximum of 7 pad bytes can be specified. + */ + +#define IceReadPad(_iceConn, _bytes) \ +{ \ + char _dummy[7]; \ + _IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \ +} + +_XFUNCPROTOEND + +#endif /* _ICEMSG_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICEproto.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEproto.h new file mode 100644 index 0000000000000000000000000000000000000000..5726631301a0de3fa194f1c83927cef24341de80 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEproto.h @@ -0,0 +1,175 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium +******************************************************************************/ + +#ifndef _ICEPROTO_H_ +#define _ICEPROTO_H_ + +#include + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 data[2]; + CARD32 length; +} iceMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD16 errorClass; + CARD32 length; + CARD8 offendingMinorOpcode; + CARD8 severity; + CARD16 unused; + CARD32 offendingSequenceNum; + /* n varying values */ + /* p p = pad (n, 8) */ +} iceErrorMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 byteOrder; + CARD8 unused; + CARD32 length; +} iceByteOrderMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 versionCount; + CARD8 authCount; + CARD32 length; + CARD8 mustAuthenticate; + CARD8 unused[7]; + /* i STRING vendor */ + /* j STRING release */ + /* k LIST of STRING authentication-protocol-names */ + /* m LIST of VERSION version-list */ + /* p p = pad (i+j+k+m, 8) */ +} iceConnectionSetupMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 authIndex; + CARD8 unused1; + CARD32 length; + CARD16 authDataLength; + CARD8 unused2[6]; + /* n varying data */ + /* p p = pad (n, 8) */ +} iceAuthRequiredMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused1[2]; + CARD32 length; + CARD16 authDataLength; + CARD8 unused2[6]; + /* n varying data */ + /* p p = pad (n, 8) */ +} iceAuthReplyMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused1[2]; + CARD32 length; + CARD16 authDataLength; + CARD8 unused2[6]; + /* n varying data */ + /* p p = pad (n, 8) */ +} iceAuthNextPhaseMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 versionIndex; + CARD8 unused; + CARD32 length; + /* i STRING vendor */ + /* j STRING release */ + /* p p = pad (i+j, 8) */ +} iceConnectionReplyMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 protocolOpcode; + CARD8 mustAuthenticate; + CARD32 length; + CARD8 versionCount; + CARD8 authCount; + CARD8 unused[6]; + /* i STRING protocol-name */ + /* j STRING vendor */ + /* k STRING release */ + /* m LIST of STRING authentication-protocol-names */ + /* n LIST of VERSION version-list */ + /* p p = pad (i+j+k+m+n, 8) */ +} iceProtocolSetupMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 versionIndex; + CARD8 protocolOpcode; + CARD32 length; + /* i STRING vendor */ + /* j STRING release */ + /* p p = pad (i+j, 8) */ +} iceProtocolReplyMsg; + +typedef iceMsg icePingMsg; +typedef iceMsg icePingReplyMsg; +typedef iceMsg iceWantToCloseMsg; +typedef iceMsg iceNoCloseMsg; + + +/* + * SIZEOF values. These better be multiples of 8. + */ + +#define sz_iceMsg 8 +#define sz_iceErrorMsg 16 +#define sz_iceByteOrderMsg 8 +#define sz_iceConnectionSetupMsg 16 +#define sz_iceAuthRequiredMsg 16 +#define sz_iceAuthReplyMsg 16 +#define sz_iceAuthNextPhaseMsg 16 +#define sz_iceConnectionReplyMsg 8 +#define sz_iceProtocolSetupMsg 16 +#define sz_iceProtocolReplyMsg 8 +#define sz_icePingMsg 8 +#define sz_icePingReplyMsg 8 +#define sz_iceWantToCloseMsg 8 +#define sz_iceNoCloseMsg 8 + +#endif /* _ICEPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/ICE/ICEutil.h b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEutil.h new file mode 100644 index 0000000000000000000000000000000000000000..92e8a435c5cca0f946fcaaa0ec32819013d9a3bd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/ICE/ICEutil.h @@ -0,0 +1,124 @@ +/****************************************************************************** + + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Author: Ralph Mor, X Consortium +******************************************************************************/ + +#ifndef _ICEUTIL_H_ +#define _ICEUTIL_H_ + +#include + +#include + +_XFUNCPROTOBEGIN + +/* + * Data structure for entry in ICE authority file + */ + +typedef struct { + char *protocol_name; + unsigned short protocol_data_length; + char *protocol_data; + char *network_id; + char *auth_name; + unsigned short auth_data_length; + char *auth_data; +} IceAuthFileEntry; + + +/* + * Authentication data maintained in memory. + */ + +typedef struct { + char *protocol_name; + char *network_id; + char *auth_name; + unsigned short auth_data_length; + char *auth_data; +} IceAuthDataEntry; + + +/* + * Return values from IceLockAuthFile + */ + +#define IceAuthLockSuccess 0 /* lock succeeded */ +#define IceAuthLockError 1 /* lock unexpectedly failed, check errno */ +#define IceAuthLockTimeout 2 /* lock failed, timeouts expired */ + + +/* + * Function Prototypes + */ + +extern char *IceAuthFileName ( + void +); + +extern int IceLockAuthFile ( + const char * /* file_name */, + int /* retries */, + int /* timeout */, + long /* dead */ +); + +extern void IceUnlockAuthFile ( + const char * /* file_name */ +); + +extern IceAuthFileEntry *IceReadAuthFileEntry ( + FILE * /* auth_file */ +); + +extern void IceFreeAuthFileEntry ( + IceAuthFileEntry * /* auth */ +); + +extern Status IceWriteAuthFileEntry ( + FILE * /* auth_file */, + IceAuthFileEntry * /* auth */ +); + +extern IceAuthFileEntry *IceGetAuthFileEntry ( + const char * /* protocol_name */, + const char * /* network_id */, + const char * /* auth_name */ +); + +extern char *IceGenerateMagicCookie ( + int /* len */ +); + +extern void IceSetPaAuthData ( + int /* numEntries */, + IceAuthDataEntry * /* entries */ +); + +_XFUNCPROTOEND + +#endif /* _ICEUTIL_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/SM/SM.h b/data/miniconda3/envs/catiagent/include/X11/SM/SM.h new file mode 100644 index 0000000000000000000000000000000000000000..1af5ae839435f66b4272086511517df57fa9e806 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/SM/SM.h @@ -0,0 +1,128 @@ +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Ralph Mor, X Consortium + */ + +#ifndef _SM_H_ +#define _SM_H_ + +/* + * Protocol Version + */ + +#define SmProtoMajor 1 +#define SmProtoMinor 0 + + +/* + * Interact Style + */ + +#define SmInteractStyleNone 0 +#define SmInteractStyleErrors 1 +#define SmInteractStyleAny 2 + + +/* + * Dialog Type + */ + +#define SmDialogError 0 +#define SmDialogNormal 1 + + +/* + * Save Type + */ + +#define SmSaveGlobal 0 +#define SmSaveLocal 1 +#define SmSaveBoth 2 + + +/* + * Restart Style Hints + */ + +#define SmRestartIfRunning 0 +#define SmRestartAnyway 1 +#define SmRestartImmediately 2 +#define SmRestartNever 3 + + +/* + * Property names + */ + +#define SmCloneCommand "CloneCommand" +#define SmCurrentDirectory "CurrentDirectory" +#define SmDiscardCommand "DiscardCommand" +#define SmEnvironment "Environment" +#define SmProcessID "ProcessID" +#define SmProgram "Program" +#define SmRestartCommand "RestartCommand" +#define SmResignCommand "ResignCommand" +#define SmRestartStyleHint "RestartStyleHint" +#define SmShutdownCommand "ShutdownCommand" +#define SmUserID "UserID" + + +/* + * Property types + */ + +#define SmCARD8 "CARD8" +#define SmARRAY8 "ARRAY8" +#define SmLISTofARRAY8 "LISTofARRAY8" + + +/* + * SM minor opcodes + */ + +#define SM_Error 0 +#define SM_RegisterClient 1 +#define SM_RegisterClientReply 2 +#define SM_SaveYourself 3 +#define SM_SaveYourselfRequest 4 +#define SM_InteractRequest 5 +#define SM_Interact 6 +#define SM_InteractDone 7 +#define SM_SaveYourselfDone 8 +#define SM_Die 9 +#define SM_ShutdownCancelled 10 +#define SM_CloseConnection 11 +#define SM_SetProperties 12 +#define SM_DeleteProperties 13 +#define SM_GetProperties 14 +#define SM_PropertiesReply 15 +#define SM_SaveYourselfPhase2Request 16 +#define SM_SaveYourselfPhase2 17 +#define SM_SaveComplete 18 + +#endif /* _SM_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/SM/SMlib.h b/data/miniconda3/envs/catiagent/include/X11/SM/SMlib.h new file mode 100644 index 0000000000000000000000000000000000000000..b88ddc0ff44d432118237a07db8958686894aad0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/SM/SMlib.h @@ -0,0 +1,543 @@ +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Ralph Mor, X Consortium + */ + +#ifndef _SMLIB_H_ +#define _SMLIB_H_ + +#include +#include + + +/* + * Generic SM pointer + */ + +typedef IcePointer SmPointer; + + +/* + * Connection objects. Defined in SMlibint.h + */ + +typedef struct _SmcConn *SmcConn; +typedef struct _SmsConn *SmsConn; + + +/* + * Session Management property + */ + +typedef struct { + int length; /* length (in bytes) of the value */ + SmPointer value; /* the value */ +} SmPropValue; + +typedef struct { + char *name; /* name of property */ + char *type; /* type of property */ + int num_vals; /* number of values in property */ + SmPropValue *vals; /* the values */ +} SmProp; + + + +/* + * SmcCloseConnection status return + */ + +typedef enum { + SmcClosedNow, + SmcClosedASAP, + SmcConnectionInUse +} SmcCloseStatus; + + + +/* + * Client callbacks + */ + +typedef void (*SmcSaveYourselfProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */, + int /* saveType */, + Bool /* shutdown */, + int /* interactStyle */, + Bool /* fast */ +); + +typedef void (*SmcSaveYourselfPhase2Proc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */ +); + +typedef void (*SmcInteractProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */ +); + +typedef void (*SmcDieProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */ +); + +typedef void (*SmcShutdownCancelledProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */ +); + +typedef void (*SmcSaveCompleteProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */ +); + +typedef void (*SmcPropReplyProc) ( + SmcConn /* smcConn */, + SmPointer /* clientData */, + int /* numProps */, + SmProp ** /* props */ +); + + +/* + * Callbacks set up at SmcOpenConnection time + */ + +typedef struct { + + struct { + SmcSaveYourselfProc callback; + SmPointer client_data; + } save_yourself; + + struct { + SmcDieProc callback; + SmPointer client_data; + } die; + + struct { + SmcSaveCompleteProc callback; + SmPointer client_data; + } save_complete; + + struct { + SmcShutdownCancelledProc callback; + SmPointer client_data; + } shutdown_cancelled; + +} SmcCallbacks; + +#define SmcSaveYourselfProcMask (1L << 0) +#define SmcDieProcMask (1L << 1) +#define SmcSaveCompleteProcMask (1L << 2) +#define SmcShutdownCancelledProcMask (1L << 3) + + + +/* + * Session manager callbacks + */ + +typedef Status (*SmsRegisterClientProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + char * /* previousId */ +); + +typedef void (*SmsInteractRequestProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + int /* dialogType */ +); + +typedef void (*SmsInteractDoneProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + Bool /* cancelShutdown */ +); + +typedef void (*SmsSaveYourselfRequestProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + int /* saveType */, + Bool /* shutdown */, + int /* interactStyle */, + Bool /* fast */, + Bool /* global */ +); + +typedef void (*SmsSaveYourselfPhase2RequestProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */ +); + +typedef void (*SmsSaveYourselfDoneProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + Bool /* success */ +); + +typedef void (*SmsCloseConnectionProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + int /* count */, + char ** /* reasonMsgs */ +); + +typedef void (*SmsSetPropertiesProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + int /* numProps */, + SmProp ** /* props */ +); + +typedef void (*SmsDeletePropertiesProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + int /* numProps */, + char ** /* propNames */ +); + +typedef void (*SmsGetPropertiesProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */ +); + + +/* + * Callbacks set up by a session manager when a new client connects. + */ + +typedef struct { + + struct { + SmsRegisterClientProc callback; + SmPointer manager_data; + } register_client; + + struct { + SmsInteractRequestProc callback; + SmPointer manager_data; + } interact_request; + + struct { + SmsInteractDoneProc callback; + SmPointer manager_data; + } interact_done; + + struct { + SmsSaveYourselfRequestProc callback; + SmPointer manager_data; + } save_yourself_request; + + struct { + SmsSaveYourselfPhase2RequestProc callback; + SmPointer manager_data; + } save_yourself_phase2_request; + + struct { + SmsSaveYourselfDoneProc callback; + SmPointer manager_data; + } save_yourself_done; + + struct { + SmsCloseConnectionProc callback; + SmPointer manager_data; + } close_connection; + + struct { + SmsSetPropertiesProc callback; + SmPointer manager_data; + } set_properties; + + struct { + SmsDeletePropertiesProc callback; + SmPointer manager_data; + } delete_properties; + + struct { + SmsGetPropertiesProc callback; + SmPointer manager_data; + } get_properties; + +} SmsCallbacks; + + +#define SmsRegisterClientProcMask (1L << 0) +#define SmsInteractRequestProcMask (1L << 1) +#define SmsInteractDoneProcMask (1L << 2) +#define SmsSaveYourselfRequestProcMask (1L << 3) +#define SmsSaveYourselfP2RequestProcMask (1L << 4) +#define SmsSaveYourselfDoneProcMask (1L << 5) +#define SmsCloseConnectionProcMask (1L << 6) +#define SmsSetPropertiesProcMask (1L << 7) +#define SmsDeletePropertiesProcMask (1L << 8) +#define SmsGetPropertiesProcMask (1L << 9) + + + +typedef Status (*SmsNewClientProc) ( + SmsConn /* smsConn */, + SmPointer /* managerData */, + unsigned long * /* maskRet */, + SmsCallbacks * /* callbacksRet */, + char ** /* failureReasonRet */ +); + + + +/* + * Error handlers + */ + +typedef void (*SmcErrorHandler) ( + SmcConn /* smcConn */, + Bool /* swap */, + int /* offendingMinorOpcode */, + unsigned long /* offendingSequence */, + int /* errorClass */, + int /* severity */, + SmPointer /* values */ +); + +typedef void (*SmsErrorHandler) ( + SmsConn /* smsConn */, + Bool /* swap */, + int /* offendingMinorOpcode */, + unsigned long /* offendingSequence */, + int /* errorClass */, + int /* severity */, + SmPointer /* values */ +); + + + +/* + * Function Prototypes + */ + +_XFUNCPROTOBEGIN + +extern SmcConn SmcOpenConnection ( + char * /* networkIdsList */, + SmPointer /* context */, + int /* xsmpMajorRev */, + int /* xsmpMinorRev */, + unsigned long /* mask */, + SmcCallbacks * /* callbacks */, + const char * /* previousId */, + char ** /* clientIdRet */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern SmcCloseStatus SmcCloseConnection ( + SmcConn /* smcConn */, + int /* count */, + char ** /* reasonMsgs */ +); + +extern void SmcModifyCallbacks ( + SmcConn /* smcConn */, + unsigned long /* mask */, + SmcCallbacks * /* callbacks */ +); + +extern void SmcSetProperties ( + SmcConn /* smcConn */, + int /* numProps */, + SmProp ** /* props */ +); + +extern void SmcDeleteProperties ( + SmcConn /* smcConn */, + int /* numProps */, + char ** /* propNames */ +); + +extern Status SmcGetProperties ( + SmcConn /* smcConn */, + SmcPropReplyProc /* propReplyProc */, + SmPointer /* clientData */ +); + +extern Status SmcInteractRequest ( + SmcConn /* smcConn */, + int /* dialogType */, + SmcInteractProc /* interactProc */, + SmPointer /* clientData */ +); + +extern void SmcInteractDone ( + SmcConn /* smcConn */, + Bool /* cancelShutdown */ +); + +extern void SmcRequestSaveYourself ( + SmcConn /* smcConn */, + int /* saveType */, + Bool /* shutdown */, + int /* interactStyle */, + Bool /* fast */, + Bool /* global */ +); + +extern Status SmcRequestSaveYourselfPhase2 ( + SmcConn /* smcConn */, + SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */, + SmPointer /* clientData */ +); + +extern void SmcSaveYourselfDone ( + SmcConn /* smcConn */, + Bool /* success */ +); + +extern int SmcProtocolVersion ( + SmcConn /* smcConn */ +); + +extern int SmcProtocolRevision ( + SmcConn /* smcConn */ +); + +extern char *SmcVendor ( + SmcConn /* smcConn */ +); + +extern char *SmcRelease ( + SmcConn /* smcConn */ +); + +extern char *SmcClientID ( + SmcConn /* smcConn */ +); + +extern IceConn SmcGetIceConnection ( + SmcConn /* smcConn */ +); + +extern Status SmsInitialize ( + const char * /* vendor */, + const char * /* release */, + SmsNewClientProc /* newClientProc */, + SmPointer /* managerData */, + IceHostBasedAuthProc /* hostBasedAuthProc */, + int /* errorLength */, + char * /* errorStringRet */ +); + +extern char *SmsClientHostName ( + SmsConn /* smsConn */ +); + +extern char *SmsGenerateClientID ( + SmsConn /* smsConn */ +); + +extern Status SmsRegisterClientReply ( + SmsConn /* smsConn */, + char * /* clientId */ +); + +extern void SmsSaveYourself ( + SmsConn /* smsConn */, + int /* saveType */, + Bool /* shutdown */, + int /* interactStyle */, + Bool /* fast */ +); + +extern void SmsSaveYourselfPhase2 ( + SmsConn /* smsConn */ +); + +extern void SmsInteract ( + SmsConn /* smsConn */ +); + +extern void SmsDie ( + SmsConn /* smsConn */ +); + +extern void SmsSaveComplete ( + SmsConn /* smsConn */ +); + +extern void SmsShutdownCancelled ( + SmsConn /* smsConn */ +); + +extern void SmsReturnProperties ( + SmsConn /* smsConn */, + int /* numProps */, + SmProp ** /* props */ +); + +extern void SmsCleanUp ( + SmsConn /* smsConn */ +); + +extern int SmsProtocolVersion ( + SmsConn /* smsConn */ +); + +extern int SmsProtocolRevision ( + SmsConn /* smsConn */ +); + +extern char *SmsClientID ( + SmsConn /* smsConn */ +); + +extern IceConn SmsGetIceConnection ( + SmsConn /* smsConn */ +); + +extern SmcErrorHandler SmcSetErrorHandler ( + SmcErrorHandler /* handler */ +); + +extern SmsErrorHandler SmsSetErrorHandler ( + SmsErrorHandler /* handler */ +); + +extern void SmFreeProperty ( + SmProp * /* prop */ +); + +extern void SmFreeReasons ( + int /* count */, + char ** /* reasonMsgs */ +); + +_XFUNCPROTOEND + +#endif /* _SMLIB_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/SM/SMproto.h b/data/miniconda3/envs/catiagent/include/X11/SM/SMproto.h new file mode 100644 index 0000000000000000000000000000000000000000..89d6624790b6820ea6851ad32d29de71498e1cad --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/SM/SMproto.h @@ -0,0 +1,206 @@ +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Ralph Mor, X Consortium + */ + +#ifndef _SMPROTO_H_ +#define _SMPROTO_H_ + +#include + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* n ARRAY8 previousId */ +} smRegisterClientMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* n ARRAY8 clientId */ +} smRegisterClientReplyMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused1[2]; + CARD32 length; + CARD8 saveType; + CARD8 shutdown; + CARD8 interactStyle; + CARD8 fast; + CARD8 unused2[4]; +} smSaveYourselfMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused1[2]; + CARD32 length; + CARD8 saveType; + CARD8 shutdown; + CARD8 interactStyle; + CARD8 fast; + CARD8 global; + CARD8 unused2[3]; +} smSaveYourselfRequestMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 dialogType; + CARD8 unused; + CARD32 length; +} smInteractRequestMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smInteractMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 cancelShutdown; + CARD8 unused; + CARD32 length; +} smInteractDoneMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 success; + CARD8 unused; + CARD32 length; +} smSaveYourselfDoneMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smDieMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smShutdownCancelledMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* b LISTofARRAY8 reasons */ +} smCloseConnectionMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* a LISTofPROPERTY properties */ +} smSetPropertiesMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* a LISTofARRAY8 property names */ +} smDeletePropertiesMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smGetPropertiesMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; + /* a LISTofPROPERTY properties */ +} smPropertiesReplyMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smSaveYourselfPhase2RequestMsg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smSaveYourselfPhase2Msg; + +typedef struct { + CARD8 majorOpcode; + CARD8 minorOpcode; + CARD8 unused[2]; + CARD32 length; +} smSaveCompleteMsg; + + +/* + * SIZEOF values. These better be multiples of 8. + */ + +#define sz_smRegisterClientMsg 8 +#define sz_smRegisterClientReplyMsg 8 +#define sz_smSaveYourselfMsg 16 +#define sz_smSaveYourselfRequestMsg 16 +#define sz_smInteractRequestMsg 8 +#define sz_smInteractMsg 8 +#define sz_smInteractDoneMsg 8 +#define sz_smSaveYourselfDoneMsg 8 +#define sz_smDieMsg 8 +#define sz_smShutdownCancelledMsg 8 +#define sz_smCloseConnectionMsg 8 +#define sz_smSetPropertiesMsg 8 +#define sz_smDeletePropertiesMsg 8 +#define sz_smGetPropertiesMsg 8 +#define sz_smPropertiesReplyMsg 8 +#define sz_smSaveYourselfPhase2RequestMsg 8 +#define sz_smSaveYourselfPhase2Msg 8 +#define sz_smSaveCompleteMsg 8 + +#endif /* _SMPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/dri/xf86dri.h b/data/miniconda3/envs/catiagent/include/X11/dri/xf86dri.h new file mode 100644 index 0000000000000000000000000000000000000000..00fb8babeef61f9dfcc87eddd052ce2acd4251b7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/dri/xf86dri.h @@ -0,0 +1,65 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. +All Rights Reserved. + +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, sub license, 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 (including the +next paragraph) 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + +**************************************************************************/ + +/** + * \file xf86dri.h + * Protocol numbers and function prototypes for DRI X protocol. + * + * \author Kevin E. Martin + * \author Jens Owen + * \author Rickard E. (Rik) Faith + */ + +#ifndef _XF86DRI_H_ +#define _XF86DRI_H_ + +#include + +#define X_XF86DRIQueryVersion 0 +#define X_XF86DRIQueryDirectRenderingCapable 1 +#define X_XF86DRIOpenConnection 2 +#define X_XF86DRICloseConnection 3 +#define X_XF86DRIGetClientDriverName 4 +#define X_XF86DRICreateContext 5 +#define X_XF86DRIDestroyContext 6 +#define X_XF86DRICreateDrawable 7 +#define X_XF86DRIDestroyDrawable 8 +#define X_XF86DRIGetDrawableInfo 9 +#define X_XF86DRIGetDeviceInfo 10 +#define X_XF86DRIAuthConnection 11 +#define X_XF86DRIOpenFullScreen 12 /* Deprecated */ +#define X_XF86DRICloseFullScreen 13 /* Deprecated */ + +#define XF86DRINumberEvents 0 + +#define XF86DRIClientNotLocal 0 +#define XF86DRIOperationNotSupported 1 +#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) + +#endif /* _XF86DRI_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/dri/xf86driproto.h b/data/miniconda3/envs/catiagent/include/X11/dri/xf86driproto.h new file mode 100644 index 0000000000000000000000000000000000000000..1202e9bfe2b22811299027bfa43fc6eaee2ed2f3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/dri/xf86driproto.h @@ -0,0 +1,342 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. +All Rights Reserved. + +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, sub license, 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 (including the +next paragraph) 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Jens Owen + * Rickard E. (Rik) Faith + * + */ + +#ifndef _XF86DRISTR_H_ +#define _XF86DRISTR_H_ + +#include "xf86dri.h" + +#define XF86DRINAME "XFree86-DRI" + +/* The DRI version number. This was originally set to be the same of the + * XFree86 version number. However, this version is really independent of + * the XFree86 version. + * + * Version History: + * 4.0.0: Original + * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 + * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 + */ +#define XF86DRI_MAJOR_VERSION 4 +#define XF86DRI_MINOR_VERSION 1 +#define XF86DRI_PATCH_VERSION 0 + +typedef struct _XF86DRIQueryVersion { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIQueryVersion */ + CARD16 length; +} xXF86DRIQueryVersionReq; +#define sz_xXF86DRIQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of DRI protocol */ + CARD16 minorVersion; /* minor version of DRI protocol */ + CARD32 patchVersion; /* patch version of DRI protocol */ + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DRIQueryVersionReply; +#define sz_xXF86DRIQueryVersionReply 32 + +typedef struct _XF86DRIQueryDirectRenderingCapable { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ + CARD16 length; + CARD32 screen; +} xXF86DRIQueryDirectRenderingCapableReq; +#define sz_xXF86DRIQueryDirectRenderingCapableReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + BOOL isCapable; + BOOL pad2; + BOOL pad3; + BOOL pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; + CARD32 pad8; + CARD32 pad9; +} xXF86DRIQueryDirectRenderingCapableReply; +#define sz_xXF86DRIQueryDirectRenderingCapableReply 32 + +typedef struct _XF86DRIOpenConnection { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIOpenConnection */ + CARD16 length; + CARD32 screen; +} xXF86DRIOpenConnectionReq; +#define sz_xXF86DRIOpenConnectionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 hSAREALow; + CARD32 hSAREAHigh; + CARD32 busIdStringLength; + CARD32 pad6; + CARD32 pad7; + CARD32 pad8; +} xXF86DRIOpenConnectionReply; +#define sz_xXF86DRIOpenConnectionReply 32 + +typedef struct _XF86DRIAuthConnection { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ + CARD16 length; + CARD32 screen; + CARD32 magic; +} xXF86DRIAuthConnectionReq; +#define sz_xXF86DRIAuthConnectionReq 12 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 authenticated; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DRIAuthConnectionReply; +#define zx_xXF86DRIAuthConnectionReply 32 + +typedef struct _XF86DRICloseConnection { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ + CARD16 length; + CARD32 screen; +} xXF86DRICloseConnectionReq; +#define sz_xXF86DRICloseConnectionReq 8 + +typedef struct _XF86DRIGetClientDriverName { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetClientDriverName */ + CARD16 length; + CARD32 screen; +} xXF86DRIGetClientDriverNameReq; +#define sz_xXF86DRIGetClientDriverNameReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 ddxDriverMajorVersion; + CARD32 ddxDriverMinorVersion; + CARD32 ddxDriverPatchVersion; + CARD32 clientDriverNameLength; + CARD32 pad5; + CARD32 pad6; +} xXF86DRIGetClientDriverNameReply; +#define sz_xXF86DRIGetClientDriverNameReply 32 + +typedef struct _XF86DRICreateContext { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateContext */ + CARD16 length; + CARD32 screen; + CARD32 visual; + CARD32 context; +} xXF86DRICreateContextReq; +#define sz_xXF86DRICreateContextReq 16 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 hHWContext; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DRICreateContextReply; +#define sz_xXF86DRICreateContextReply 32 + +typedef struct _XF86DRIDestroyContext { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroyContext */ + CARD16 length; + CARD32 screen; + CARD32 context; +} xXF86DRIDestroyContextReq; +#define sz_xXF86DRIDestroyContextReq 12 + +typedef struct _XF86DRICreateDrawable { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateDrawable */ + CARD16 length; + CARD32 screen; + CARD32 drawable; +} xXF86DRICreateDrawableReq; +#define sz_xXF86DRICreateDrawableReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 hHWDrawable; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DRICreateDrawableReply; +#define sz_xXF86DRICreateDrawableReply 32 + +typedef struct _XF86DRIDestroyDrawable { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroyDrawable */ + CARD16 length; + CARD32 screen; + CARD32 drawable; +} xXF86DRIDestroyDrawableReq; +#define sz_xXF86DRIDestroyDrawableReq 12 + +typedef struct _XF86DRIGetDrawableInfo { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetDrawableInfo */ + CARD16 length; + CARD32 screen; + CARD32 drawable; +} xXF86DRIGetDrawableInfoReq; +#define sz_xXF86DRIGetDrawableInfoReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 drawableTableIndex; + CARD32 drawableTableStamp; + INT16 drawableX; + INT16 drawableY; + INT16 drawableWidth; + INT16 drawableHeight; + CARD32 numClipRects; + INT16 backX; + INT16 backY; + CARD32 numBackClipRects; +} xXF86DRIGetDrawableInfoReply; + +#define sz_xXF86DRIGetDrawableInfoReply 36 + + +typedef struct _XF86DRIGetDeviceInfo { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIGetDeviceInfo */ + CARD16 length; + CARD32 screen; +} xXF86DRIGetDeviceInfoReq; +#define sz_xXF86DRIGetDeviceInfoReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 hFrameBufferLow; + CARD32 hFrameBufferHigh; + CARD32 framebufferOrigin; + CARD32 framebufferSize; + CARD32 framebufferStride; + CARD32 devPrivateSize; +} xXF86DRIGetDeviceInfoReply; +#define sz_xXF86DRIGetDeviceInfoReply 32 + +typedef struct _XF86DRIOpenFullScreen { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIOpenFullScreen */ + CARD16 length; + CARD32 screen; + CARD32 drawable; +} xXF86DRIOpenFullScreenReq; +#define sz_xXF86DRIOpenFullScreenReq 12 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 isFullScreen; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DRIOpenFullScreenReply; +#define sz_xXF86DRIOpenFullScreenReply 32 + +typedef struct _XF86DRICloseFullScreen { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseFullScreen */ + CARD16 length; + CARD32 screen; + CARD32 drawable; +} xXF86DRICloseFullScreenReq; +#define sz_xXF86DRICloseFullScreenReq 12 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xXF86DRICloseFullScreenReply; +#define sz_xXF86DRICloseFullScreenReply 32 + + +#endif /* _XF86DRISTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/dri/xf86dristr.h b/data/miniconda3/envs/catiagent/include/X11/dri/xf86dristr.h new file mode 100644 index 0000000000000000000000000000000000000000..048491eed62b7608a85156b1b20969ba3dafa122 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/dri/xf86dristr.h @@ -0,0 +1,3 @@ +#warning "xf86dristr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/EVI.h b/data/miniconda3/envs/catiagent/include/X11/extensions/EVI.h new file mode 100644 index 0000000000000000000000000000000000000000..7f3f733e624b7b222e6d724cf6d1b917a6717f3c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/EVI.h @@ -0,0 +1,36 @@ +/************************************************************ +Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. +********************************************************/ + +#ifndef _EVI_H_ +#define _EVI_H_ + +#define XEVI_TRANSPARENCY_NONE 0 +#define XEVI_TRANSPARENCY_PIXEL 1 +#define XEVI_TRANSPARENCY_MASK 2 + +#define EVINAME "Extended-Visual-Information" + +#define XEVI_MAJOR_VERSION 1 /* current version numbers */ +#define XEVI_MINOR_VERSION 0 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/EVIproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/EVIproto.h new file mode 100644 index 0000000000000000000000000000000000000000..2218ef28975e145f2545ca79bb7d488718b6ab05 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/EVIproto.h @@ -0,0 +1,96 @@ +/************************************************************ +Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. +********************************************************/ + +#ifndef _EVIPROTO_H_ +#define _EVIPROTO_H_ + +#include + +#define X_EVIQueryVersion 0 +#define X_EVIGetVisualInfo 1 + +#define VisualID CARD32 + +typedef CARD32 VisualID32; +#define sz_VisualID32 4 + +typedef struct _xExtendedVisualInfo { + VisualID core_visual_id; + INT8 screen; + INT8 level; + CARD8 transparency_type; + CARD8 pad0; + CARD32 transparency_value; + CARD8 min_hw_colormaps; + CARD8 max_hw_colormaps; + CARD16 num_colormap_conflicts; +} xExtendedVisualInfo; +#define sz_xExtendedVisualInfo 16 + +typedef struct _XEVIQueryVersion { + CARD8 reqType; /* always XEVIReqCode */ + CARD8 xeviReqType; /* always X_EVIQueryVersion */ + CARD16 length; +} xEVIQueryVersionReq; +#define sz_xEVIQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of EVI protocol */ + CARD16 minorVersion; /* minor version of EVI protocol */ + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xEVIQueryVersionReply; +#define sz_xEVIQueryVersionReply 32 + +typedef struct _XEVIGetVisualInfoReq { + CARD8 reqType; /* always XEVIReqCode */ + CARD8 xeviReqType; /* always X_EVIGetVisualInfo */ + CARD16 length; + CARD32 n_visual; +} xEVIGetVisualInfoReq; +#define sz_xEVIGetVisualInfoReq 8 + +typedef struct _XEVIGetVisualInfoReply { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 n_info; + CARD32 n_conflicts; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xEVIGetVisualInfoReply; +#define sz_xEVIGetVisualInfoReply 32 + +#undef VisualID + +#endif /* _EVIPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/MITMisc.h b/data/miniconda3/envs/catiagent/include/X11/extensions/MITMisc.h new file mode 100644 index 0000000000000000000000000000000000000000..4cfb334ee43b880c67fa03c48b729e4ddc85d8b2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/MITMisc.h @@ -0,0 +1,54 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */ + +#ifndef _XMITMISC_H_ +#define _XMITMISC_H_ + +#include +#include + +_XFUNCPROTOBEGIN + +Bool XMITMiscQueryExtension( + Display* /* dpy */, + int* /* event_basep */, + int* /* error_basep */ +); + +Status XMITMiscSetBugMode( + Display* /* dpy */, + Bool /* onOff */ +); + +Bool XMITMiscGetBugMode( + Display* /* dpy */ +); + +_XFUNCPROTOEND + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XEVI.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XEVI.h new file mode 100644 index 0000000000000000000000000000000000000000..9ca441200cdb8cce3f253b6182fc5c47e8deb20a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XEVI.h @@ -0,0 +1,61 @@ +/************************************************************ +Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. +********************************************************/ + +#ifndef _XEVI_H_ +#define _XEVI_H_ +#include +#include + +typedef struct { + VisualID core_visual_id; + int screen; + int level; + unsigned int transparency_type; + unsigned int transparency_value; + unsigned int min_hw_colormaps; + unsigned int max_hw_colormaps; + unsigned int num_colormap_conflicts; + VisualID* colormap_conflicts; +} ExtendedVisualInfo; + +_XFUNCPROTOBEGIN + +Bool XeviQueryExtension( + Display* /* dpy */ +); +Status XeviQueryVersion( + Display* /* dpy */, + int* /* majorVersion */, + int* /* minorVersion */ +); +Status XeviGetVisualInfo( + Display* /* dpy */, + VisualID* /* visual_query */, + int /* nVisual_query */, + ExtendedVisualInfo** /* extendedVisualInfo_return */, + int* /* nInfo_return */ +); + +_XFUNCPROTOEND + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XI.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XI.h new file mode 100644 index 0000000000000000000000000000000000000000..7b443997ca4d315b7e89e16453d3c37193af525c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XI.h @@ -0,0 +1,308 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/* Definitions used by the server, library and client */ + +#ifndef _XI_H_ +#define _XI_H_ + +#define sz_xGetExtensionVersionReq 8 +#define sz_xGetExtensionVersionReply 32 +#define sz_xListInputDevicesReq 4 +#define sz_xListInputDevicesReply 32 +#define sz_xOpenDeviceReq 8 +#define sz_xOpenDeviceReply 32 +#define sz_xCloseDeviceReq 8 +#define sz_xSetDeviceModeReq 8 +#define sz_xSetDeviceModeReply 32 +#define sz_xSelectExtensionEventReq 12 +#define sz_xGetSelectedExtensionEventsReq 8 +#define sz_xGetSelectedExtensionEventsReply 32 +#define sz_xChangeDeviceDontPropagateListReq 12 +#define sz_xGetDeviceDontPropagateListReq 8 +#define sz_xGetDeviceDontPropagateListReply 32 +#define sz_xGetDeviceMotionEventsReq 16 +#define sz_xGetDeviceMotionEventsReply 32 +#define sz_xChangeKeyboardDeviceReq 8 +#define sz_xChangeKeyboardDeviceReply 32 +#define sz_xChangePointerDeviceReq 8 +#define sz_xChangePointerDeviceReply 32 +#define sz_xGrabDeviceReq 20 +#define sz_xGrabDeviceReply 32 +#define sz_xUngrabDeviceReq 12 +#define sz_xGrabDeviceKeyReq 20 +#define sz_xGrabDeviceKeyReply 32 +#define sz_xUngrabDeviceKeyReq 16 +#define sz_xGrabDeviceButtonReq 20 +#define sz_xGrabDeviceButtonReply 32 +#define sz_xUngrabDeviceButtonReq 16 +#define sz_xAllowDeviceEventsReq 12 +#define sz_xGetDeviceFocusReq 8 +#define sz_xGetDeviceFocusReply 32 +#define sz_xSetDeviceFocusReq 16 +#define sz_xGetFeedbackControlReq 8 +#define sz_xGetFeedbackControlReply 32 +#define sz_xChangeFeedbackControlReq 12 +#define sz_xGetDeviceKeyMappingReq 8 +#define sz_xGetDeviceKeyMappingReply 32 +#define sz_xChangeDeviceKeyMappingReq 8 +#define sz_xGetDeviceModifierMappingReq 8 +#define sz_xSetDeviceModifierMappingReq 8 +#define sz_xSetDeviceModifierMappingReply 32 +#define sz_xGetDeviceButtonMappingReq 8 +#define sz_xGetDeviceButtonMappingReply 32 +#define sz_xSetDeviceButtonMappingReq 8 +#define sz_xSetDeviceButtonMappingReply 32 +#define sz_xQueryDeviceStateReq 8 +#define sz_xQueryDeviceStateReply 32 +#define sz_xSendExtensionEventReq 16 +#define sz_xDeviceBellReq 8 +#define sz_xSetDeviceValuatorsReq 8 +#define sz_xSetDeviceValuatorsReply 32 +#define sz_xGetDeviceControlReq 8 +#define sz_xGetDeviceControlReply 32 +#define sz_xChangeDeviceControlReq 8 +#define sz_xChangeDeviceControlReply 32 +#define sz_xListDevicePropertiesReq 8 +#define sz_xListDevicePropertiesReply 32 +#define sz_xChangeDevicePropertyReq 20 +#define sz_xDeleteDevicePropertyReq 12 +#define sz_xGetDevicePropertyReq 24 +#define sz_xGetDevicePropertyReply 32 + +#define INAME "XInputExtension" + +#define XI_KEYBOARD "KEYBOARD" +#define XI_MOUSE "MOUSE" +#define XI_TABLET "TABLET" +#define XI_TOUCHSCREEN "TOUCHSCREEN" +#define XI_TOUCHPAD "TOUCHPAD" +#define XI_BARCODE "BARCODE" +#define XI_BUTTONBOX "BUTTONBOX" +#define XI_KNOB_BOX "KNOB_BOX" +#define XI_ONE_KNOB "ONE_KNOB" +#define XI_NINE_KNOB "NINE_KNOB" +#define XI_TRACKBALL "TRACKBALL" +#define XI_QUADRATURE "QUADRATURE" +#define XI_ID_MODULE "ID_MODULE" +#define XI_SPACEBALL "SPACEBALL" +#define XI_DATAGLOVE "DATAGLOVE" +#define XI_EYETRACKER "EYETRACKER" +#define XI_CURSORKEYS "CURSORKEYS" +#define XI_FOOTMOUSE "FOOTMOUSE" +#define XI_JOYSTICK "JOYSTICK" + +/* Indices into the versions[] array (XExtInt.c). Used as a index to + * retrieve the minimum version of XI from _XiCheckExtInit */ +#define Dont_Check 0 +#define XInput_Initial_Release 1 +#define XInput_Add_XDeviceBell 2 +#define XInput_Add_XSetDeviceValuators 3 +#define XInput_Add_XChangeDeviceControl 4 +#define XInput_Add_DevicePresenceNotify 5 +#define XInput_Add_DeviceProperties 6 +/* DO NOT ADD TO HERE -> XI2 */ + +#define XI_Absent 0 +#define XI_Present 1 + +#define XI_Initial_Release_Major 1 +#define XI_Initial_Release_Minor 0 + +#define XI_Add_XDeviceBell_Major 1 +#define XI_Add_XDeviceBell_Minor 1 + +#define XI_Add_XSetDeviceValuators_Major 1 +#define XI_Add_XSetDeviceValuators_Minor 2 + +#define XI_Add_XChangeDeviceControl_Major 1 +#define XI_Add_XChangeDeviceControl_Minor 3 + +#define XI_Add_DevicePresenceNotify_Major 1 +#define XI_Add_DevicePresenceNotify_Minor 4 + +#define XI_Add_DeviceProperties_Major 1 +#define XI_Add_DeviceProperties_Minor 5 + +#define DEVICE_RESOLUTION 1 +#define DEVICE_ABS_CALIB 2 +#define DEVICE_CORE 3 +#define DEVICE_ENABLE 4 +#define DEVICE_ABS_AREA 5 + +#define NoSuchExtension 1 + +#define COUNT 0 +#define CREATE 1 + +#define NewPointer 0 +#define NewKeyboard 1 + +#define XPOINTER 0 +#define XKEYBOARD 1 + +#define UseXKeyboard 0xFF + +#define IsXPointer 0 +#define IsXKeyboard 1 +#define IsXExtensionDevice 2 +#define IsXExtensionKeyboard 3 +#define IsXExtensionPointer 4 + +#define AsyncThisDevice 0 +#define SyncThisDevice 1 +#define ReplayThisDevice 2 +#define AsyncOtherDevices 3 +#define AsyncAll 4 +#define SyncAll 5 + +#define FollowKeyboard 3 +#ifndef RevertToFollowKeyboard +#define RevertToFollowKeyboard 3 +#endif + +#define DvAccelNum (1L << 0) +#define DvAccelDenom (1L << 1) +#define DvThreshold (1L << 2) + +#define DvKeyClickPercent (1L<<0) +#define DvPercent (1L<<1) +#define DvPitch (1L<<2) +#define DvDuration (1L<<3) +#define DvLed (1L<<4) +#define DvLedMode (1L<<5) +#define DvKey (1L<<6) +#define DvAutoRepeatMode (1L<<7) + +#define DvString (1L << 0) + +#define DvInteger (1L << 0) + +#define DeviceMode (1L << 0) +#define Relative 0 +#define Absolute 1 + +#define ProximityState (1L << 1) +#define InProximity (0L << 1) +#define OutOfProximity (1L << 1) + +#define AddToList 0 +#define DeleteFromList 1 + +#define KeyClass 0 +#define ButtonClass 1 +#define ValuatorClass 2 +#define FeedbackClass 3 +#define ProximityClass 4 +#define FocusClass 5 +#define OtherClass 6 +#define AttachClass 7 + +#define KbdFeedbackClass 0 +#define PtrFeedbackClass 1 +#define StringFeedbackClass 2 +#define IntegerFeedbackClass 3 +#define LedFeedbackClass 4 +#define BellFeedbackClass 5 + +#define _devicePointerMotionHint 0 +#define _deviceButton1Motion 1 +#define _deviceButton2Motion 2 +#define _deviceButton3Motion 3 +#define _deviceButton4Motion 4 +#define _deviceButton5Motion 5 +#define _deviceButtonMotion 6 +#define _deviceButtonGrab 7 +#define _deviceOwnerGrabButton 8 +#define _noExtensionEvent 9 + +#define _devicePresence 0 + +#define _deviceEnter 0 +#define _deviceLeave 1 + +/* Device presence notify states */ +#define DeviceAdded 0 +#define DeviceRemoved 1 +#define DeviceEnabled 2 +#define DeviceDisabled 3 +#define DeviceUnrecoverable 4 +#define DeviceControlChanged 5 + +/* XI Errors */ +#define XI_BadDevice 0 +#define XI_BadEvent 1 +#define XI_BadMode 2 +#define XI_DeviceBusy 3 +#define XI_BadClass 4 + +/* + * Make XEventClass be a CARD32 for 64 bit servers. Don't affect client + * definition of XEventClass since that would be a library interface change. + * See the top of X.h for more _XSERVER64 magic. + * + * But, don't actually use the CARD32 type. We can't get it defined here + * without polluting the namespace. + */ +#ifdef _XSERVER64 +typedef unsigned int XEventClass; +#else +typedef unsigned long XEventClass; +#endif + +/******************************************************************* + * + * Extension version structure. + * + */ + +typedef struct { + int present; + short major_version; + short minor_version; +} XExtensionVersion; + +#endif /* _XI_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XI2.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XI2.h new file mode 100644 index 0000000000000000000000000000000000000000..cc47085df06b084bb2bc91d257d9cd3344817fb9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XI2.h @@ -0,0 +1,259 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 _XI2_H_ +#define _XI2_H_ + +#define XInput_2_0 7 +/* DO NOT ADD TO THIS LIST. These are libXi-specific defines. + See commit libXi-1.4.2-21-ge8531dd */ + +#define XI_2_Major 2 +#define XI_2_Minor 4 + +/* Property event flags */ +#define XIPropertyDeleted 0 +#define XIPropertyCreated 1 +#define XIPropertyModified 2 + +/* Property modes */ +#define XIPropModeReplace 0 +#define XIPropModePrepend 1 +#define XIPropModeAppend 2 + +/* Special property type used for XIGetProperty */ +#define XIAnyPropertyType 0L + +/* Enter/Leave and Focus In/Out modes */ +#define XINotifyNormal 0 +#define XINotifyGrab 1 +#define XINotifyUngrab 2 +#define XINotifyWhileGrabbed 3 +#define XINotifyPassiveGrab 4 +#define XINotifyPassiveUngrab 5 + +/* Enter/Leave and focus In/out detail */ +#define XINotifyAncestor 0 +#define XINotifyVirtual 1 +#define XINotifyInferior 2 +#define XINotifyNonlinear 3 +#define XINotifyNonlinearVirtual 4 +#define XINotifyPointer 5 +#define XINotifyPointerRoot 6 +#define XINotifyDetailNone 7 + +/* Grab modes */ +#define XIGrabModeSync 0 +#define XIGrabModeAsync 1 +#define XIGrabModeTouch 2 + +/* Grab reply status codes */ +#define XIGrabSuccess 0 +#define XIAlreadyGrabbed 1 +#define XIGrabInvalidTime 2 +#define XIGrabNotViewable 3 +#define XIGrabFrozen 4 + +/* Grab owner events values */ +#define XIOwnerEvents True +#define XINoOwnerEvents False + +/* Passive grab types */ +#define XIGrabtypeButton 0 +#define XIGrabtypeKeycode 1 +#define XIGrabtypeEnter 2 +#define XIGrabtypeFocusIn 3 +#define XIGrabtypeTouchBegin 4 +#define XIGrabtypeGesturePinchBegin 5 +#define XIGrabtypeGestureSwipeBegin 6 + +/* Passive grab modifier */ +#define XIAnyModifier (1U << 31) +#define XIAnyButton 0 +#define XIAnyKeycode 0 + +/* XIAllowEvents event-modes */ +#define XIAsyncDevice 0 +#define XISyncDevice 1 +#define XIReplayDevice 2 +#define XIAsyncPairedDevice 3 +#define XIAsyncPair 4 +#define XISyncPair 5 +#define XIAcceptTouch 6 +#define XIRejectTouch 7 + +/* DeviceChangedEvent change reasons */ +#define XISlaveSwitch 1 +#define XIDeviceChange 2 + +/* Hierarchy flags */ +#define XIMasterAdded (1 << 0) +#define XIMasterRemoved (1 << 1) +#define XISlaveAdded (1 << 2) +#define XISlaveRemoved (1 << 3) +#define XISlaveAttached (1 << 4) +#define XISlaveDetached (1 << 5) +#define XIDeviceEnabled (1 << 6) +#define XIDeviceDisabled (1 << 7) + +/* ChangeHierarchy constants */ +#define XIAddMaster 1 +#define XIRemoveMaster 2 +#define XIAttachSlave 3 +#define XIDetachSlave 4 + +#define XIAttachToMaster 1 +#define XIFloating 2 + +/* Valuator modes */ +#define XIModeRelative 0 +#define XIModeAbsolute 1 + +/* Device types */ +#define XIMasterPointer 1 +#define XIMasterKeyboard 2 +#define XISlavePointer 3 +#define XISlaveKeyboard 4 +#define XIFloatingSlave 5 + +/* Device classes: classes that are not identical to Xi 1.x classes must be + * numbered starting from 8. */ +#define XIKeyClass 0 +#define XIButtonClass 1 +#define XIValuatorClass 2 +#define XIScrollClass 3 +#define XITouchClass 8 +#define XIGestureClass 9 + +/* Scroll class types */ +#define XIScrollTypeVertical 1 +#define XIScrollTypeHorizontal 2 + +/* Scroll class flags */ +#define XIScrollFlagNoEmulation (1 << 0) +#define XIScrollFlagPreferred (1 << 1) + +/* Device event flags (common) */ +/* Device event flags (key events only) */ +#define XIKeyRepeat (1 << 16) +/* Device event flags (pointer events only) */ +#define XIPointerEmulated (1 << 16) +/* Device event flags (touch events only) */ +#define XITouchPendingEnd (1 << 16) +#define XITouchEmulatingPointer (1 << 17) + +/* Barrier event flags */ +#define XIBarrierPointerReleased (1 << 0) +#define XIBarrierDeviceIsGrabbed (1 << 1) + +/* Gesture pinch event flags */ +#define XIGesturePinchEventCancelled (1 << 0) + +/* Gesture swipe event flags */ +#define XIGestureSwipeEventCancelled (1 << 0) + +/* Touch modes */ +#define XIDirectTouch 1 +#define XIDependentTouch 2 + +/* XI2 event mask macros */ +#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7))) +#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7))) +#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7))) +#define XIMaskLen(event) (((event) >> 3) + 1) + +/* Fake device ID's for event selection */ +#define XIAllDevices 0 +#define XIAllMasterDevices 1 + +/* Event types */ +#define XI_DeviceChanged 1 +#define XI_KeyPress 2 +#define XI_KeyRelease 3 +#define XI_ButtonPress 4 +#define XI_ButtonRelease 5 +#define XI_Motion 6 +#define XI_Enter 7 +#define XI_Leave 8 +#define XI_FocusIn 9 +#define XI_FocusOut 10 +#define XI_HierarchyChanged 11 +#define XI_PropertyEvent 12 +#define XI_RawKeyPress 13 +#define XI_RawKeyRelease 14 +#define XI_RawButtonPress 15 +#define XI_RawButtonRelease 16 +#define XI_RawMotion 17 +#define XI_TouchBegin 18 /* XI 2.2 */ +#define XI_TouchUpdate 19 +#define XI_TouchEnd 20 +#define XI_TouchOwnership 21 +#define XI_RawTouchBegin 22 +#define XI_RawTouchUpdate 23 +#define XI_RawTouchEnd 24 +#define XI_BarrierHit 25 /* XI 2.3 */ +#define XI_BarrierLeave 26 +#define XI_GesturePinchBegin 27 /* XI 2.4 */ +#define XI_GesturePinchUpdate 28 +#define XI_GesturePinchEnd 29 +#define XI_GestureSwipeBegin 30 +#define XI_GestureSwipeUpdate 31 +#define XI_GestureSwipeEnd 32 +#define XI_LASTEVENT XI_GestureSwipeEnd +/* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value + * as XI_LASTEVENT if the server is supposed to handle masks etc. for this + * type of event. */ + +/* Event masks. + * Note: the protocol spec defines a mask to be of (1 << type). Clients are + * free to create masks by bitshifting instead of using these defines. + */ +#define XI_DeviceChangedMask (1 << XI_DeviceChanged) +#define XI_KeyPressMask (1 << XI_KeyPress) +#define XI_KeyReleaseMask (1 << XI_KeyRelease) +#define XI_ButtonPressMask (1 << XI_ButtonPress) +#define XI_ButtonReleaseMask (1 << XI_ButtonRelease) +#define XI_MotionMask (1 << XI_Motion) +#define XI_EnterMask (1 << XI_Enter) +#define XI_LeaveMask (1 << XI_Leave) +#define XI_FocusInMask (1 << XI_FocusIn) +#define XI_FocusOutMask (1 << XI_FocusOut) +#define XI_HierarchyChangedMask (1 << XI_HierarchyChanged) +#define XI_PropertyEventMask (1 << XI_PropertyEvent) +#define XI_RawKeyPressMask (1 << XI_RawKeyPress) +#define XI_RawKeyReleaseMask (1 << XI_RawKeyRelease) +#define XI_RawButtonPressMask (1 << XI_RawButtonPress) +#define XI_RawButtonReleaseMask (1 << XI_RawButtonRelease) +#define XI_RawMotionMask (1 << XI_RawMotion) +#define XI_TouchBeginMask (1 << XI_TouchBegin) +#define XI_TouchEndMask (1 << XI_TouchEnd) +#define XI_TouchOwnershipChangedMask (1 << XI_TouchOwnership) +#define XI_TouchUpdateMask (1 << XI_TouchUpdate) +#define XI_RawTouchBeginMask (1 << XI_RawTouchBegin) +#define XI_RawTouchEndMask (1 << XI_RawTouchEnd) +#define XI_RawTouchUpdateMask (1 << XI_RawTouchUpdate) +#define XI_BarrierHitMask (1 << XI_BarrierHit) +#define XI_BarrierLeaveMask (1 << XI_BarrierLeave) + +#endif /* _XI2_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XI2proto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XI2proto.h new file mode 100644 index 0000000000000000000000000000000000000000..aaeac7b382ef53635c936bd994597b894305370a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XI2proto.h @@ -0,0 +1,1169 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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. + * + */ + +/* Conventions for this file: + * Names: + * structs: always typedef'd, prefixed with xXI, CamelCase + * struct members: lower_case_with_underscores + * Exceptions: reqType, ReqType, repType, RepType, sequenceNumber are + * named as such for historical reasons. + * request opcodes: X_XIRequestName as CamelCase + * defines: defines used in client applications must go in XI2.h + * defines used only in protocol handling: XISOMENAME + * + * Data types: unless there is a historical name for a datatype (e.g. + * Window), use stdint types specifying the size of the datatype. + * historical data type names must be defined and undefined at the top and + * end of the file. + * + * General: + * spaces, not tabs. + * structs specific to a request or reply added before the request + * definition. structs used in more than one request, reply or event + * appended to the common structs section before the definition of the + * first request. + * members of structs vertically aligned on column 16 if datatypes permit. + * otherwise aligned on next available 8n column. + */ + +/** + * Protocol definitions for the XI2 protocol. + * This file should not be included by clients that merely use XI2, but do not + * need the wire protocol. Such clients should include XI2.h, or the matching + * header from the library. + * + */ +#ifndef _XI2PROTO_H_ +#define _XI2PROTO_H_ + +#include +#include +#include +#include + +/* make sure types have right sizes for protocol structures. */ +#define Window uint32_t +#define Time uint32_t +#define Atom uint32_t +#define Cursor uint32_t +#define Barrier uint32_t + +/** + * XI2 Request opcodes + */ +#define X_XIQueryPointer 40 +#define X_XIWarpPointer 41 +#define X_XIChangeCursor 42 +#define X_XIChangeHierarchy 43 +#define X_XISetClientPointer 44 +#define X_XIGetClientPointer 45 +#define X_XISelectEvents 46 +#define X_XIQueryVersion 47 +#define X_XIQueryDevice 48 +#define X_XISetFocus 49 +#define X_XIGetFocus 50 +#define X_XIGrabDevice 51 +#define X_XIUngrabDevice 52 +#define X_XIAllowEvents 53 +#define X_XIPassiveGrabDevice 54 +#define X_XIPassiveUngrabDevice 55 +#define X_XIListProperties 56 +#define X_XIChangeProperty 57 +#define X_XIDeleteProperty 58 +#define X_XIGetProperty 59 +#define X_XIGetSelectedEvents 60 +#define X_XIBarrierReleasePointer 61 + +/** Number of XI requests */ +#define XI2REQUESTS (X_XIBarrierReleasePointer - X_XIQueryPointer + 1) +/** Number of XI2 events */ +#define XI2EVENTS (XI_LASTEVENT + 1) + +/************************************************************************************* + * * + * COMMON STRUCTS * + * * + *************************************************************************************/ +/** Fixed point 16.16 */ +typedef int32_t FP1616; + +/** Fixed point 32.32 */ +typedef struct { + int32_t integral; + uint32_t frac; +} FP3232; + +/** + * Struct to describe a device. + * + * For a MasterPointer or a MasterKeyboard, 'attachment' specifies the + * paired master device. + * For a SlaveKeyboard or SlavePointer, 'attachment' specifies the master + * device this device is attached to. + * For a FloatingSlave, 'attachment' is undefined. + */ +typedef struct { + uint16_t deviceid; + uint16_t use; /**< ::XIMasterPointer, ::XIMasterKeyboard, + ::XISlavePointer, ::XISlaveKeyboard, + ::XIFloatingSlave */ + uint16_t attachment; /**< Current attachment or pairing.*/ + uint16_t num_classes; /**< Number of classes following this struct. */ + uint16_t name_len; /**< Length of name in bytes. */ + uint8_t enabled; /**< TRUE if device is enabled. */ + uint8_t pad; +} xXIDeviceInfo; + +/** + * Default template for a device class. + * A device class is equivalent to a device's capabilities. Multiple classes + * are supported per device. + */ +typedef struct { + uint16_t type; /**< One of *class */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint16_t pad; +} xXIAnyInfo; + +/** + * Denotes button capability on a device. + * Struct is followed by a button bit-mask (padded to four byte chunks) and + * then num_buttons * Atom that names the buttons in the device-native setup + * (i.e. ignoring button mappings). + */ +typedef struct { + uint16_t type; /**< Always ButtonClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint16_t num_buttons; /**< Number of buttons provided */ +} xXIButtonInfo; + +/** + * Denotes key capability on a device. + * Struct is followed by num_keys * CARD32 that lists the keycodes available + * on the device. + */ +typedef struct { + uint16_t type; /**< Always KeyClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint16_t num_keycodes; /**< Number of keys provided */ +} xXIKeyInfo; + +/** + * Denotes an valuator capability on a device. + * One XIValuatorInfo describes exactly one valuator (axis) on the device. + */ +typedef struct { + uint16_t type; /**< Always ValuatorClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint16_t number; /**< Valuator number */ + Atom label; /**< Axis label */ + FP3232 min; /**< Min value */ + FP3232 max; /**< Max value */ + FP3232 value; /**< Last published value */ + uint32_t resolution; /**< Resolutions in units/m */ + uint8_t mode; /**< ModeRelative or ModeAbsolute */ + uint8_t pad1; + uint16_t pad2; +} xXIValuatorInfo; + +/*** + * Denotes a scroll valuator on a device. + * One XIScrollInfo describes exactly one scroll valuator that must have a + * XIValuatorInfo struct. + */ +typedef struct { + uint16_t type; /**< Always ValuatorClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint16_t number; /**< Valuator number */ + uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */ + uint16_t pad0; + uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */ + FP3232 increment; /**< Increment for one unit of scrolling */ +} xXIScrollInfo; + +/** + * Denotes multitouch capability on a device. + */ +typedef struct { + uint16_t type; /**< Always TouchClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint8_t mode; /**< DirectTouch or DependentTouch */ + uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */ +} xXITouchInfo; + +/** + * Denotes touchpad gesture capability on a device. + */ +typedef struct { + uint16_t type; /**< Always GestureClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint8_t num_touches; /**< Maximum number of touches gesture supports (0==unlimited) */ + uint8_t pad0; +} xXIGestureInfo; + +/** + * Used to select for events on a given window. + * Struct is followed by (mask_len * CARD8), with each bit set representing + * the event mask for the given type. A mask bit represents an event type if + * (mask == (1 << type)). + */ +typedef struct { + uint16_t deviceid; /**< Device id to select for */ + uint16_t mask_len; /**< Length of mask in 4 byte units */ +} xXIEventMask; + +/** + * XKB modifier information. + * The effective modifier is a binary mask of base, latched, and locked + * modifiers. + */ +typedef struct +{ + uint32_t base_mods; /**< Logically pressed modifiers */ + uint32_t latched_mods; /**< Logically latched modifiers */ + uint32_t locked_mods; /**< Logically locked modifiers */ + uint32_t effective_mods; /**< Effective modifiers */ +} xXIModifierInfo; + +/** + * XKB group information. + * The effective group is the mathematical sum of base, latched, and locked + * group after group wrapping is taken into account. + */ +typedef struct +{ + uint8_t base_group; /**< Logically "pressed" group */ + uint8_t latched_group; /**< Logically latched group */ + uint8_t locked_group; /**< Logically locked group */ + uint8_t effective_group; /**< Effective group */ +} xXIGroupInfo; + + +/************************************************************************************* + * * + * REQUESTS * + * * + *************************************************************************************/ + +/** + * Query the server for the supported X Input extension version. + */ + +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIQueryVersion */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t major_version; + uint16_t minor_version; +} xXIQueryVersionReq; +#define sz_xXIQueryVersionReq 8 + +typedef struct { + uint8_t repType; /**< ::X_Reply */ + uint8_t RepType; /**< Always ::X_XIQueryVersion */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t major_version; + uint16_t minor_version; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIQueryVersionReply; +#define sz_xXIQueryVersionReply 32 + +/** + * Query the server for information about a specific device or all input + * devices. + */ +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIQueryDevice */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; + uint16_t pad; +} xXIQueryDeviceReq; +#define sz_xXIQueryDeviceReq 8 + +typedef struct { + uint8_t repType; /**< ::X_Reply */ + uint8_t RepType; /**< Always ::X_XIQueryDevice */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t num_devices; + uint16_t pad0; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIQueryDeviceReply; +#define sz_xXIQueryDeviceReply 32 + +/** + * Select for events on a given window. + */ +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XISelectEvents */ + uint16_t length; /**< Length in 4 byte units */ + Window win; + uint16_t num_masks; + uint16_t pad; +} xXISelectEventsReq; +#define sz_xXISelectEventsReq 12 + +/** + * Query for selected events on a given window. + */ +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIGetSelectedEvents */ + uint16_t length; /**< Length in 4 byte units */ + Window win; +} xXIGetSelectedEventsReq; +#define sz_xXIGetSelectedEventsReq 8 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIGetSelectedEvents */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t num_masks; /**< Number of xXIEventMask structs + trailing the reply */ + uint16_t pad0; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIGetSelectedEventsReply; +#define sz_xXIGetSelectedEventsReply 32 + +/** + * Query the given device's screen/window coordinates. + */ + +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIQueryPointer */ + uint16_t length; /**< Length in 4 byte units */ + Window win; + uint16_t deviceid; + uint16_t pad1; +} xXIQueryPointerReq; +#define sz_xXIQueryPointerReq 12 + + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIQueryPointer */ + uint16_t sequenceNumber; + uint32_t length; + Window root; + Window child; + FP1616 root_x; + FP1616 root_y; + FP1616 win_x; + FP1616 win_y; + uint8_t same_screen; + uint8_t pad0; + uint16_t buttons_len; + xXIModifierInfo mods; + xXIGroupInfo group; +} xXIQueryPointerReply; +#define sz_xXIQueryPointerReply 56 + +/** + * Warp the given device's pointer to the specified position. + */ + +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIWarpPointer */ + uint16_t length; /**< Length in 4 byte units */ + Window src_win; + Window dst_win; + FP1616 src_x; + FP1616 src_y; + uint16_t src_width; + uint16_t src_height; + FP1616 dst_x; + FP1616 dst_y; + uint16_t deviceid; + uint16_t pad1; +} xXIWarpPointerReq; +#define sz_xXIWarpPointerReq 36 + +/** + * Change the given device's sprite to the given cursor. + */ + +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIChangeCursor */ + uint16_t length; /**< Length in 4 byte units */ + Window win; + Cursor cursor; + uint16_t deviceid; + uint16_t pad1; +} xXIChangeCursorReq; +#define sz_xXIChangeCursorReq 16 + +/** + * Modify the device hierarchy. + */ + +typedef struct { + uint8_t reqType; /**< Input extension major code */ + uint8_t ReqType; /**< Always ::X_XIChangeHierarchy */ + uint16_t length; /**< Length in 4 byte units */ + uint8_t num_changes; + uint8_t pad0; + uint16_t pad1; +} xXIChangeHierarchyReq; +#define sz_xXIChangeHierarchyReq 8 + +/** + * Generic header for any hierarchy change. + */ +typedef struct { + uint16_t type; + uint16_t length; /**< Length in 4 byte units */ +} xXIAnyHierarchyChangeInfo; + +/** + * Create a new master device. + * Name of new master follows struct (4-byte padded) + */ +typedef struct { + uint16_t type; /**< Always ::XIAddMaster */ + uint16_t length; /**< 2 + (namelen + padding)/4 */ + uint16_t name_len; + uint8_t send_core; + uint8_t enable; +} xXIAddMasterInfo; + +/** + * Delete a master device. Will automatically delete the master device paired + * with the given master device. + */ +typedef struct { + uint16_t type; /**< Always ::XIRemoveMaster */ + uint16_t length; /**< 3 */ + uint16_t deviceid; + uint8_t return_mode; /**< ::XIAttachToMaster, ::XIFloating */ + uint8_t pad; + uint16_t return_pointer; /**< Pointer to attach slave ptr devices to */ + uint16_t return_keyboard; /**< keyboard to attach slave keybd devices to*/ +} xXIRemoveMasterInfo; + +/** + * Attach an SD to a new device. + * NewMaster has to be of same type (pointer->pointer, keyboard->keyboard); + */ +typedef struct { + uint16_t type; /**< Always ::XIAttachSlave */ + uint16_t length; /**< 2 */ + uint16_t deviceid; + uint16_t new_master; /**< id of new master device */ +} xXIAttachSlaveInfo; + +/** + * Detach an SD from its current master device. + */ +typedef struct { + uint16_t type; /**< Always ::XIDetachSlave */ + uint16_t length; /**< 2 */ + uint16_t deviceid; + uint16_t pad; +} xXIDetachSlaveInfo; + + +/** + * Set the window/client's ClientPointer. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XISetClientPointer */ + uint16_t length; /**< Length in 4 byte units */ + Window win; + uint16_t deviceid; + uint16_t pad1; +} xXISetClientPointerReq; +#define sz_xXISetClientPointerReq 12 + +/** + * Query the given window/client's ClientPointer setting. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_GetClientPointer */ + uint16_t length; /**< Length in 4 byte units */ + Window win; +} xXIGetClientPointerReq; +#define sz_xXIGetClientPointerReq 8 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_GetClientPointer */ + uint16_t sequenceNumber; + uint32_t length; + BOOL set; /**< client pointer is set? */ + uint8_t pad0; + uint16_t deviceid; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIGetClientPointerReply; +#define sz_xXIGetClientPointerReply 32 + +/** + * Set the input focus to the specified window. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XISetFocus */ + uint16_t length; /**< Length in 4 byte units */ + Window focus; + Time time; + uint16_t deviceid; + uint16_t pad0; +} xXISetFocusReq; +#define sz_xXISetFocusReq 16 + +/** + * Query the current input focus. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIGetDeviceFocus */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; + uint16_t pad0; +} xXIGetFocusReq; +#define sz_xXIGetFocusReq 8 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIGetFocus */ + uint16_t sequenceNumber; + uint32_t length; + Window focus; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIGetFocusReply; +#define sz_xXIGetFocusReply 32 + + +/** + * Grab the given device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIGrabDevice */ + uint16_t length; /**< Length in 4 byte units */ + Window grab_window; + Time time; + Cursor cursor; + uint16_t deviceid; + uint8_t grab_mode; + uint8_t paired_device_mode; + uint8_t owner_events; + uint8_t pad; + uint16_t mask_len; +} xXIGrabDeviceReq; +#define sz_xXIGrabDeviceReq 24 + +/** + * Return codes from a XIPassiveGrabDevice request. + */ +typedef struct { + uint32_t modifiers; /**< Modifier state */ + uint8_t status; /**< Grab status code */ + uint8_t pad0; + uint16_t pad1; +} xXIGrabModifierInfo; + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIGrabDevice */ + uint16_t sequenceNumber; + uint32_t length; + uint8_t status; + uint8_t pad0; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; + uint32_t pad6; +} xXIGrabDeviceReply; +#define sz_xXIGrabDeviceReply 32 + +/** + * Ungrab the specified device. + * + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIUngrabDevice */ + uint16_t length; /**< Length in 4 byte units */ + Time time; + uint16_t deviceid; + uint16_t pad; +} xXIUngrabDeviceReq; +#define sz_xXIUngrabDeviceReq 12 + + +/** + * Allow or replay events on the specified grabbed device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIAllowEvents */ + uint16_t length; /**< Length in 4 byte units */ + Time time; + uint16_t deviceid; + uint8_t mode; + uint8_t pad; +} xXIAllowEventsReq; +#define sz_xXIAllowEventsReq 12 + +/** + * Allow or replay events on the specified grabbed device. + * Since XI 2.2 + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIAllowEvents */ + uint16_t length; /**< Length in 4 byte units */ + Time time; + uint16_t deviceid; + uint8_t mode; + uint8_t pad; + uint32_t touchid; /**< Since XI 2.2 */ + Window grab_window; /**< Since XI 2.2 */ +} xXI2_2AllowEventsReq; +#define sz_xXI2_2AllowEventsReq 20 + + +/** + * Passively grab the device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIPassiveGrabDevice */ + uint16_t length; /**< Length in 4 byte units */ + Time time; + Window grab_window; + Cursor cursor; + uint32_t detail; + uint16_t deviceid; + uint16_t num_modifiers; + uint16_t mask_len; + uint8_t grab_type; + uint8_t grab_mode; + uint8_t paired_device_mode; + uint8_t owner_events; + uint16_t pad1; +} xXIPassiveGrabDeviceReq; +#define sz_xXIPassiveGrabDeviceReq 32 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIPassiveGrabDevice */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t num_modifiers; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; + uint32_t pad6; +} xXIPassiveGrabDeviceReply; +#define sz_xXIPassiveGrabDeviceReply 32 + +/** + * Delete a passive grab for the given device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIPassiveUngrabDevice */ + uint16_t length; /**< Length in 4 byte units */ + Window grab_window; + uint32_t detail; + uint16_t deviceid; + uint16_t num_modifiers; + uint8_t grab_type; + uint8_t pad0; + uint16_t pad1; +} xXIPassiveUngrabDeviceReq; +#define sz_xXIPassiveUngrabDeviceReq 20 + +/** + * List all device properties on the specified device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIListProperties */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; + uint16_t pad; +} xXIListPropertiesReq; +#define sz_xXIListPropertiesReq 8 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always ::X_XIListProperties */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t num_properties; + uint16_t pad0; + uint32_t pad1; + uint32_t pad2; + uint32_t pad3; + uint32_t pad4; + uint32_t pad5; +} xXIListPropertiesReply; +#define sz_xXIListPropertiesReply 32 + +/** + * Change a property on the specified device. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always ::X_XIChangeProperty */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; + uint8_t mode; + uint8_t format; + Atom property; + Atom type; + uint32_t num_items; +} xXIChangePropertyReq; +#define sz_xXIChangePropertyReq 20 + +/** + * Delete the specified property. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always X_XIDeleteProperty */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; + uint16_t pad0; + Atom property; +} xXIDeletePropertyReq; +#define sz_xXIDeletePropertyReq 12 + +/** + * Query the specified property's values. + */ +typedef struct { + uint8_t reqType; + uint8_t ReqType; /**< Always X_XIGetProperty */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t deviceid; +#if defined(__cplusplus) || defined(c_plusplus) + uint8_t c_delete; +#else + uint8_t delete; +#endif + uint8_t pad0; + Atom property; + Atom type; + uint32_t offset; + uint32_t len; +} xXIGetPropertyReq; +#define sz_xXIGetPropertyReq 24 + +typedef struct { + uint8_t repType; /**< Input extension major opcode */ + uint8_t RepType; /**< Always X_XIGetProperty */ + uint16_t sequenceNumber; + uint32_t length; + Atom type; + uint32_t bytes_after; + uint32_t num_items; + uint8_t format; + uint8_t pad0; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; +} xXIGetPropertyReply; +#define sz_xXIGetPropertyReply 32 + +typedef struct { + uint16_t deviceid; + uint16_t pad; + Barrier barrier; + uint32_t eventid; +} xXIBarrierReleasePointerInfo; + +typedef struct { + uint8_t reqType; /**< Input extension major opcode */ + uint8_t ReqType; /**< Always X_XIBarrierReleasePointer */ + uint16_t length; + uint32_t num_barriers; + /* array of xXIBarrierReleasePointerInfo */ +} xXIBarrierReleasePointerReq; +#define sz_xXIBarrierReleasePointerReq 8 + +/************************************************************************************* + * * + * EVENTS * + * * + *************************************************************************************/ + +/** + * Generic XI2 event header. All XI2 events use the same header. + */ +typedef struct +{ + uint8_t type; + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; + uint16_t evtype; + uint16_t deviceid; + Time time; +} xXIGenericDeviceEvent; + +/** + * Device hierarchy information. + */ +typedef struct +{ + uint16_t deviceid; + uint16_t attachment; /**< ID of master or paired device */ + uint8_t use; /**< ::XIMasterKeyboard, + ::XIMasterPointer, + ::XISlaveKeyboard, + ::XISlavePointer, + ::XIFloatingSlave */ + BOOL enabled; /**< TRUE if the device is enabled */ + uint16_t pad; + uint32_t flags; /**< ::XIMasterAdded, ::XIMasterRemoved, + ::XISlaveAttached, ::XISlaveDetached, + ::XISlaveAdded, ::XISlaveRemoved, + ::XIDeviceEnabled, ::XIDeviceDisabled */ +} xXIHierarchyInfo; + +/** + * The device hierarchy has been modified. This event includes the device + * hierarchy after the modification has been applied. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte units */ + uint16_t evtype; /**< ::XI_Hierarchy */ + uint16_t deviceid; + Time time; + uint32_t flags; /**< ::XIMasterAdded, ::XIMasterDeleted, + ::XISlaveAttached, ::XISlaveDetached, + ::XISlaveAdded, ::XISlaveRemoved, + ::XIDeviceEnabled, ::XIDeviceDisabled */ + uint16_t num_info; + uint16_t pad0; + uint32_t pad1; + uint32_t pad2; +} xXIHierarchyEvent; + +/** + * A device has changed capabilities. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte units */ + uint16_t evtype; /**< XI_DeviceChanged */ + uint16_t deviceid; /**< Device that has changed */ + Time time; + uint16_t num_classes; /**< Number of classes that have changed */ + uint16_t sourceid; /**< Source of the new classes */ + uint8_t reason; /**< ::XISlaveSwitch, ::XIDeviceChange */ + uint8_t pad0; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; +} xXIDeviceChangedEvent; + +/** + * The owner of a touch stream has passed on ownership to another client. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte units */ + uint16_t evtype; /**< XI_TouchOwnership */ + uint16_t deviceid; /**< Device that has changed */ + Time time; + uint32_t touchid; + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + uint16_t sourceid; + uint16_t pad0; + uint32_t flags; + uint32_t pad1; + uint32_t pad2; +} xXITouchOwnershipEvent; + +/** + * Default input event for pointer, keyboard or touch input. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; + uint16_t deviceid; + Time time; + uint32_t detail; /**< Keycode or button */ + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 root_y; + FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 event_y; + uint16_t buttons_len; /**< Len of button flags in 4 b units */ + uint16_t valuators_len; /**< Len of val. flags in 4 b units */ + uint16_t sourceid; /**< The source device */ + uint16_t pad0; + uint32_t flags; /**< ::XIKeyRepeat */ + xXIModifierInfo mods; + xXIGroupInfo group; +} xXIDeviceEvent; + + +/** + * Sent when an input event is generated. RawEvents include valuator + * information in both device-specific data (i.e. unaccelerated) and + * processed data (i.e. accelerated, if applicable). + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; /**< ::XI_RawEvent */ + uint16_t deviceid; + Time time; + uint32_t detail; + uint16_t sourceid; /**< The source device (XI 2.1) */ + uint16_t valuators_len; /**< Length of trailing valuator + mask in 4 byte units */ + uint32_t flags; /**< ::XIKeyRepeat */ + uint32_t pad2; +} xXIRawEvent; + +/** + * Note that the layout of root, event, child, root_x, root_y, event_x, + * event_y must be identical to the xXIDeviceEvent. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; /**< ::XI_Enter */ + uint16_t deviceid; + Time time; + uint16_t sourceid; + uint8_t mode; + uint8_t detail; + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; + FP1616 root_y; + FP1616 event_x; + FP1616 event_y; + BOOL same_screen; + BOOL focus; + uint16_t buttons_len; /**< Length of trailing button mask + in 4 byte units */ + xXIModifierInfo mods; + xXIGroupInfo group; +} xXIEnterEvent; + +typedef xXIEnterEvent xXILeaveEvent; +typedef xXIEnterEvent xXIFocusInEvent; +typedef xXIEnterEvent xXIFocusOutEvent; + +/** + * Sent when a device property is created, modified or deleted. Does not + * include property data, the client is required to query the data. + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte units */ + uint16_t evtype; /**< ::XI_PropertyEvent */ + uint16_t deviceid; + Time time; + Atom property; + uint8_t what; /**< ::XIPropertyDeleted, + ::XIPropertyCreated, + ::XIPropertyMotified */ + uint8_t pad0; + uint16_t pad1; + uint32_t pad2; + uint32_t pad3; +} xXIPropertyEvent; + +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte units */ + uint16_t evtype; /**< ::XI_BarrierHit or ::XI_BarrierLeave */ + uint16_t deviceid; + Time time; + uint32_t eventid; + Window root; + Window event; + Barrier barrier; +/* └──────── 32 byte boundary ────────┘ */ + uint32_t dtime; + uint32_t flags; /**< ::XIBarrierPointerReleased + ::XIBarrierDeviceIsGrabbed */ + uint16_t sourceid; + int16_t pad; + FP1616 root_x; + FP1616 root_y; + FP3232 dx; + FP3232 dy; +} xXIBarrierEvent; + +typedef xXIBarrierEvent xXIBarrierHitEvent; +typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent; +typedef xXIBarrierEvent xXIBarrierLeaveEvent; + +/** + * Event for touchpad gesture pinch input events + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; + uint16_t deviceid; + Time time; + uint32_t detail; /**< The number of touches in the gesture */ + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 root_y; + FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 event_y; + FP1616 delta_x; + FP1616 delta_y; + FP1616 delta_unaccel_x; + FP1616 delta_unaccel_y; + FP1616 scale; + FP1616 delta_angle; + uint16_t sourceid; /**< The source device */ + uint16_t pad0; + xXIModifierInfo mods; + xXIGroupInfo group; + uint32_t flags; /**< ::XIGesturePinchEventCancelled */ +} xXIGesturePinchEvent; + +/** + * Event for touchpad gesture swipe input events + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; + uint16_t deviceid; + Time time; + uint32_t detail; /**< The number of touches in the gesture */ + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 root_y; + FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 event_y; + FP1616 delta_x; + FP1616 delta_y; + FP1616 delta_unaccel_x; + FP1616 delta_unaccel_y; + uint16_t sourceid; /**< The source device */ + uint16_t pad0; + xXIModifierInfo mods; + xXIGroupInfo group; + uint32_t flags; /**< ::XIGestureSwipeEventCancelled */ +} xXIGestureSwipeEvent; + +#undef Window +#undef Time +#undef Atom +#undef Cursor +#undef Barrier + +#endif /* _XI2PROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XInput.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XInput.h new file mode 100644 index 0000000000000000000000000000000000000000..3fc9685bcd094c59b9bfd7c73ecf38efd2047811 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XInput.h @@ -0,0 +1,1277 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +/* Definitions used by the library and client */ + +#ifndef _XINPUT_H_ +#define _XINPUT_H_ + +#include +#include + +#define _deviceKeyPress 0 +#define _deviceKeyRelease 1 + +#define _deviceButtonPress 0 +#define _deviceButtonRelease 1 + +#define _deviceMotionNotify 0 + +#define _deviceFocusIn 0 +#define _deviceFocusOut 1 + +#define _proximityIn 0 +#define _proximityOut 1 + +#define _deviceStateNotify 0 +#define _deviceMappingNotify 1 +#define _changeDeviceNotify 2 +/* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify, + DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This + code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c */ +#define _propertyNotify 6 + +#define FindTypeAndClass(d,type,_class,classid,offset) \ + { int _i; XInputClassInfo *_ip; \ + type = 0; _class = 0; \ + for (_i=0, _ip= ((XDevice *) d)->classes; \ + _i< ((XDevice *) d)->num_classes; \ + _i++, _ip++) \ + if (_ip->input_class == classid) \ + {type = _ip->event_type_base + offset; \ + _class = ((XDevice *) d)->device_id << 8 | type;}} + +#define DeviceKeyPress(d,type,_class) \ + FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress) + +#define DeviceKeyRelease(d,type,_class) \ + FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease) + +#define DeviceButtonPress(d,type,_class) \ + FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress) + +#define DeviceButtonRelease(d,type,_class) \ + FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease) + +#define DeviceMotionNotify(d,type,_class) \ + FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify) + +#define DeviceFocusIn(d,type,_class) \ + FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn) + +#define DeviceFocusOut(d,type,_class) \ + FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut) + +#define ProximityIn(d,type,_class) \ + FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn) + +#define ProximityOut(d,type,_class) \ + FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut) + +#define DeviceStateNotify(d,type,_class) \ + FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify) + +#define DeviceMappingNotify(d,type,_class) \ + FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify) + +#define ChangeDeviceNotify(d,type,_class) \ + FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify) + +#define DevicePropertyNotify(d, type, _class) \ + FindTypeAndClass(d, type, _class, OtherClass, _propertyNotify) + +#define DevicePointerMotionHint(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;} + +#define DeviceButton1Motion(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;} + +#define DeviceButton2Motion(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;} + +#define DeviceButton3Motion(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;} + +#define DeviceButton4Motion(d,type, _class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;} + +#define DeviceButton5Motion(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;} + +#define DeviceButtonMotion(d,type, _class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;} + +#define DeviceOwnerGrabButton(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;} + +#define DeviceButtonPressGrab(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;} + +#define NoExtensionEvent(d,type,_class) \ + { _class = ((XDevice *) d)->device_id << 8 | _noExtensionEvent;} + + +/* We need the declaration for DevicePresence. */ +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + extern int _XiGetDevicePresenceNotifyEvent(Display *); + extern void _xibaddevice( Display *dpy, int *error); + extern void _xibadclass( Display *dpy, int *error); + extern void _xibadevent( Display *dpy, int *error); + extern void _xibadmode( Display *dpy, int *error); + extern void _xidevicebusy( Display *dpy, int *error); +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#define DevicePresence(dpy, type, _class) \ + { \ + type = _XiGetDevicePresenceNotifyEvent(dpy); \ + _class = (0x10000 | _devicePresence); \ + } + +/* Errors */ +#define BadDevice(dpy,error) _xibaddevice(dpy, &error) + +#define BadClass(dpy,error) _xibadclass(dpy, &error) + +#define BadEvent(dpy,error) _xibadevent(dpy, &error) + +#define BadMode(dpy,error) _xibadmode(dpy, &error) + +#define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error) + +typedef struct _XAnyClassinfo *XAnyClassPtr; + +/*************************************************************** + * + * DeviceKey events. These events are sent by input devices that + * support input class Keys. + * The location of the X pointer is reported in the coordinate + * fields of the x,y and x_root,y_root fields. + * + */ + +typedef struct + { + int type; /* of event */ + unsigned long serial; /* # of last request processed */ + Bool send_event; /* true if from SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + XID deviceid; + Window root; /* root window event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* x, y coordinates in event window */ + int x_root; /* coordinates relative to root */ + int y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + unsigned int keycode; /* detail */ + Bool same_screen; /* same screen flag */ + unsigned int device_state; /* device key or button mask */ + unsigned char axes_count; + unsigned char first_axis; + int axis_data[6]; + } XDeviceKeyEvent; + +typedef XDeviceKeyEvent XDeviceKeyPressedEvent; +typedef XDeviceKeyEvent XDeviceKeyReleasedEvent; + +/******************************************************************* + * + * DeviceButton events. These events are sent by extension devices + * that support input class Buttons. + * + */ + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + XID deviceid; + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* x, y coordinates in event window */ + int x_root; /* coordinates relative to root */ + int y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + unsigned int button; /* detail */ + Bool same_screen; /* same screen flag */ + unsigned int device_state; /* device key or button mask */ + unsigned char axes_count; + unsigned char first_axis; + int axis_data[6]; + } XDeviceButtonEvent; + +typedef XDeviceButtonEvent XDeviceButtonPressedEvent; +typedef XDeviceButtonEvent XDeviceButtonReleasedEvent; + +/******************************************************************* + * + * DeviceMotionNotify event. These events are sent by extension devices + * that support input class Valuators. + * + */ + +typedef struct + { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + XID deviceid; + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* x, y coordinates in event window */ + int x_root; /* coordinates relative to root */ + int y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + char is_hint; /* detail */ + Bool same_screen; /* same screen flag */ + unsigned int device_state; /* device key or button mask */ + unsigned char axes_count; + unsigned char first_axis; + int axis_data[6]; + } XDeviceMotionEvent; + +/******************************************************************* + * + * DeviceFocusChange events. These events are sent when the focus + * of an extension device that can be focused is changed. + * + */ + +typedef struct + { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + XID deviceid; + int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ + int detail; + /* + * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer, + * NotifyPointerRoot, NotifyDetailNone + */ + Time time; + } XDeviceFocusChangeEvent; + +typedef XDeviceFocusChangeEvent XDeviceFocusInEvent; +typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent; + +/******************************************************************* + * + * ProximityNotify events. These events are sent by those absolute + * positioning devices that are capable of generating proximity information. + * + */ + +typedef struct + { + int type; /* ProximityIn or ProximityOut */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + XID deviceid; + Window root; + Window subwindow; + Time time; + int x, y; + int x_root, y_root; + unsigned int state; + Bool same_screen; + unsigned int device_state; /* device key or button mask */ + unsigned char axes_count; + unsigned char first_axis; + int axis_data[6]; + } XProximityNotifyEvent; +typedef XProximityNotifyEvent XProximityInEvent; +typedef XProximityNotifyEvent XProximityOutEvent; + +/******************************************************************* + * + * DeviceStateNotify events are generated on EnterWindow and FocusIn + * for those clients who have selected DeviceState. + * + */ + +typedef struct + { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + } XInputClass; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + XID deviceid; + Time time; + int num_classes; + char data[64]; +} XDeviceStateNotifyEvent; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + unsigned char num_valuators; + unsigned char mode; + int valuators[6]; +} XValuatorStatus; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + short num_keys; + char keys[32]; +} XKeyStatus; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + short num_buttons; + char buttons[32]; +} XButtonStatus; + +/******************************************************************* + * + * DeviceMappingNotify event. This event is sent when the key mapping, + * modifier mapping, or button mapping of an extension device is changed. + * + */ + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + XID deviceid; + Time time; + int request; /* one of MappingModifier, MappingKeyboard, + MappingPointer */ + int first_keycode;/* first keycode */ + int count; /* defines range of change w. first_keycode*/ +} XDeviceMappingEvent; + +/******************************************************************* + * + * ChangeDeviceNotify event. This event is sent when an + * XChangeKeyboard or XChangePointer request is made. + * + */ + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + XID deviceid; + Time time; + int request; /* NewPointer or NewKeyboard */ +} XChangeDeviceNotifyEvent; + +/******************************************************************* + * + * DevicePresenceNotify event. This event is sent when the list of + * input devices changes, in which case devchange will be false, and + * no information about the change will be contained in the event; + * the client should use XListInputDevices() to learn what has changed. + * + * If devchange is true, an attribute that the server believes is + * important has changed on a device, and the client should use + * XGetDeviceControl to examine the device. If control is non-zero, + * then that control has changed meaningfully. + */ + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + Time time; + Bool devchange; + XID deviceid; + XID control; +} XDevicePresenceNotifyEvent; + +/* + * Notifies the client that a property on a device has changed value. The + * client is expected to query the server for updated value of the property. + */ +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + Time time; + XID deviceid; /* id of the device that changed */ + Atom atom; /* the property that changed */ + int state; /* PropertyNewValue or PropertyDeleted */ +} XDevicePropertyNotifyEvent; + + +/******************************************************************* + * + * Control structures for input devices that support input class + * Feedback. These are used by the XGetFeedbackControl and + * XChangeFeedbackControl functions. + * + */ + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; +} XFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int click; + int percent; + int pitch; + int duration; + int led_mask; + int global_auto_repeat; + char auto_repeats[32]; +} XKbdFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int accelNum; + int accelDenom; + int threshold; +} XPtrFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int resolution; + int minVal; + int maxVal; +} XIntegerFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int max_symbols; + int num_syms_supported; + KeySym *syms_supported; +} XStringFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int percent; + int pitch; + int duration; +} XBellFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int led_values; + int led_mask; +} XLedFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; +} XFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int accelNum; + int accelDenom; + int threshold; +} XPtrFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int click; + int percent; + int pitch; + int duration; + int led_mask; + int led_value; + int key; + int auto_repeat_mode; +} XKbdFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int num_keysyms; + KeySym *syms_to_display; +} XStringFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int int_to_display; +} XIntegerFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int percent; + int pitch; + int duration; +} XBellFeedbackControl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + XID id; + int led_mask; + int led_values; +} XLedFeedbackControl; + +/******************************************************************* + * + * Device control structures. + * + */ + +typedef struct { + XID control; + int length; +} XDeviceControl; + +typedef struct { + XID control; + int length; + int first_valuator; + int num_valuators; + int *resolutions; +} XDeviceResolutionControl; + +typedef struct { + XID control; + int length; + int num_valuators; + int *resolutions; + int *min_resolutions; + int *max_resolutions; +} XDeviceResolutionState; + +typedef struct { + XID control; + int length; + int min_x; + int max_x; + int min_y; + int max_y; + int flip_x; + int flip_y; + int rotation; + int button_threshold; +} XDeviceAbsCalibControl, XDeviceAbsCalibState; + +typedef struct { + XID control; + int length; + int offset_x; + int offset_y; + int width; + int height; + int screen; + XID following; +} XDeviceAbsAreaControl, XDeviceAbsAreaState; + +typedef struct { + XID control; + int length; + int status; +} XDeviceCoreControl; + +typedef struct { + XID control; + int length; + int status; + int iscore; +} XDeviceCoreState; + +typedef struct { + XID control; + int length; + int enable; +} XDeviceEnableControl, XDeviceEnableState; + +/******************************************************************* + * + * An array of XDeviceList structures is returned by the + * XListInputDevices function. Each entry contains information + * about one input device. Among that information is an array of + * pointers to structures that describe the characteristics of + * the input device. + * + */ + +typedef struct _XAnyClassinfo { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + } XAnyClassInfo; + +typedef struct _XDeviceInfo *XDeviceInfoPtr; + +typedef struct _XDeviceInfo + { + XID id; + Atom type; + char *name; + int num_classes; + int use; + XAnyClassPtr inputclassinfo; + } XDeviceInfo; + +typedef struct _XKeyInfo *XKeyInfoPtr; + +typedef struct _XKeyInfo + { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + unsigned short min_keycode; + unsigned short max_keycode; + unsigned short num_keys; + } XKeyInfo; + +typedef struct _XButtonInfo *XButtonInfoPtr; + +typedef struct _XButtonInfo { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + short num_buttons; + } XButtonInfo; + +typedef struct _XAxisInfo *XAxisInfoPtr; + +typedef struct _XAxisInfo { + int resolution; + int min_value; + int max_value; + } XAxisInfo; + +typedef struct _XValuatorInfo *XValuatorInfoPtr; + +typedef struct _XValuatorInfo + { +#if defined(__cplusplus) || defined(c_plusplus) + XID c_class; +#else + XID class; +#endif + int length; + unsigned char num_axes; + unsigned char mode; + unsigned long motion_buffer; + XAxisInfoPtr axes; + } XValuatorInfo; + +/******************************************************************* + * + * An XDevice structure is returned by the XOpenDevice function. + * It contains an array of pointers to XInputClassInfo structures. + * Each contains information about a class of input supported by the + * device, including a pointer to an array of data for each type of event + * the device reports. + * + */ + + +typedef struct { + unsigned char input_class; + unsigned char event_type_base; +} XInputClassInfo; + +typedef struct { + XID device_id; + int num_classes; + XInputClassInfo *classes; +} XDevice; + + +/******************************************************************* + * + * The following structure is used to return information for the + * XGetSelectedExtensionEvents function. + * + */ + +typedef struct { + XEventClass event_type; + XID device; +} XEventList; + +/******************************************************************* + * + * The following structure is used to return motion history data from + * an input device that supports the input class Valuators. + * This information is returned by the XGetDeviceMotionEvents function. + * + */ + +typedef struct { + Time time; + int *data; +} XDeviceTimeCoord; + + +/******************************************************************* + * + * Device state structure. + * This is returned by the XQueryDeviceState request. + * + */ + +typedef struct { + XID device_id; + int num_classes; + XInputClass *data; +} XDeviceState; + +/******************************************************************* + * + * Note that the mode field is a bitfield that reports the Proximity + * status of the device as well as the mode. The mode field should + * be OR'd with the mask DeviceMode and compared with the values + * Absolute and Relative to determine the mode, and should be OR'd + * with the mask ProximityState and compared with the values InProximity + * and OutOfProximity to determine the proximity state. + * + */ + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + unsigned char num_valuators; + unsigned char mode; + int *valuators; +} XValuatorState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + short num_keys; + char keys[32]; +} XKeyState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + unsigned char c_class; +#else + unsigned char class; +#endif + unsigned char length; + short num_buttons; + char buttons[32]; +} XButtonState; + + + +/******************************************************************* + * + * Function definitions. + * + */ + +_XFUNCPROTOBEGIN + +extern int XChangeKeyboardDevice( + Display* /* display */, + XDevice* /* device */ +); + +extern int XChangePointerDevice( + Display* /* display */, + XDevice* /* device */, + int /* xaxis */, + int /* yaxis */ +); + +extern int XGrabDevice( + Display* /* display */, + XDevice* /* device */, + Window /* grab_window */, + Bool /* ownerEvents */, + int /* event count */, + XEventClass* /* event_list */, + int /* this_device_mode */, + int /* other_devices_mode */, + Time /* time */ +); + +extern int XUngrabDevice( + Display* /* display */, + XDevice* /* device */, + Time /* time */ +); + +extern int XGrabDeviceKey( + Display* /* display */, + XDevice* /* device */, + unsigned int /* key */, + unsigned int /* modifiers */, + XDevice* /* modifier_device */, + Window /* grab_window */, + Bool /* owner_events */, + unsigned int /* event_count */, + XEventClass* /* event_list */, + int /* this_device_mode */, + int /* other_devices_mode */ +); + +extern int XUngrabDeviceKey( + Display* /* display */, + XDevice* /* device */, + unsigned int /* key */, + unsigned int /* modifiers */, + XDevice* /* modifier_dev */, + Window /* grab_window */ +); + +extern int XGrabDeviceButton( + Display* /* display */, + XDevice* /* device */, + unsigned int /* button */, + unsigned int /* modifiers */, + XDevice* /* modifier_device */, + Window /* grab_window */, + Bool /* owner_events */, + unsigned int /* event_count */, + XEventClass* /* event_list */, + int /* this_device_mode */, + int /* other_devices_mode */ +); + +extern int XUngrabDeviceButton( + Display* /* display */, + XDevice* /* device */, + unsigned int /* button */, + unsigned int /* modifiers */, + XDevice* /* modifier_dev */, + Window /* grab_window */ +); + +extern int XAllowDeviceEvents( + Display* /* display */, + XDevice* /* device */, + int /* event_mode */, + Time /* time */ +); + +extern int XGetDeviceFocus( + Display* /* display */, + XDevice* /* device */, + Window* /* focus */, + int* /* revert_to */, + Time* /* time */ +); + +extern int XSetDeviceFocus( + Display* /* display */, + XDevice* /* device */, + Window /* focus */, + int /* revert_to */, + Time /* time */ +); + +extern XFeedbackState *XGetFeedbackControl( + Display* /* display */, + XDevice* /* device */, + int* /* num_feedbacks */ +); + +extern void XFreeFeedbackList( + XFeedbackState* /* list */ +); + +extern int XChangeFeedbackControl( + Display* /* display */, + XDevice* /* device */, + unsigned long /* mask */, + XFeedbackControl* /* f */ +); + +extern int XDeviceBell( + Display* /* display */, + XDevice* /* device */, + XID /* feedbackclass */, + XID /* feedbackid */, + int /* percent */ +); + +extern KeySym *XGetDeviceKeyMapping( + Display* /* display */, + XDevice* /* device */, +#if NeedWidePrototypes + unsigned int /* first */, +#else + KeyCode /* first */, +#endif + int /* keycount */, + int* /* syms_per_code */ +); + +extern int XChangeDeviceKeyMapping( + Display* /* display */, + XDevice* /* device */, + int /* first */, + int /* syms_per_code */, + KeySym* /* keysyms */, + int /* count */ +); + +extern XModifierKeymap *XGetDeviceModifierMapping( + Display* /* display */, + XDevice* /* device */ +); + +extern int XSetDeviceModifierMapping( + Display* /* display */, + XDevice* /* device */, + XModifierKeymap* /* modmap */ +); + +extern int XSetDeviceButtonMapping( + Display* /* display */, + XDevice* /* device */, + unsigned char* /* map[] */, + int /* nmap */ +); + +extern int XGetDeviceButtonMapping( + Display* /* display */, + XDevice* /* device */, + unsigned char* /* map[] */, + unsigned int /* nmap */ +); + +extern XDeviceState *XQueryDeviceState( + Display* /* display */, + XDevice* /* device */ +); + +extern void XFreeDeviceState( + XDeviceState* /* list */ +); + +extern XExtensionVersion *XGetExtensionVersion( + Display* /* display */, + _Xconst char* /* name */ +); + +extern XDeviceInfo *XListInputDevices( + Display* /* display */, + int* /* ndevices */ +); + +extern void XFreeDeviceList( + XDeviceInfo* /* list */ +); + +extern XDevice *XOpenDevice( + Display* /* display */, + XID /* id */ +); + +extern int XCloseDevice( + Display* /* display */, + XDevice* /* device */ +); + +extern int XSetDeviceMode( + Display* /* display */, + XDevice* /* device */, + int /* mode */ +); + +extern int XSetDeviceValuators( + Display* /* display */, + XDevice* /* device */, + int* /* valuators */, + int /* first_valuator */, + int /* num_valuators */ +); + +extern XDeviceControl *XGetDeviceControl( + Display* /* display */, + XDevice* /* device */, + int /* control */ +); + +extern int XChangeDeviceControl( + Display* /* display */, + XDevice* /* device */, + int /* control */, + XDeviceControl* /* d */ +); + +extern int XSelectExtensionEvent( + Display* /* display */, + Window /* w */, + XEventClass* /* event_list */, + int /* count */ +); + +extern int XGetSelectedExtensionEvents( + Display* /* display */, + Window /* w */, + int* /* this_client_count */, + XEventClass** /* this_client_list */, + int* /* all_clients_count */, + XEventClass** /* all_clients_list */ +); + +extern int XChangeDeviceDontPropagateList( + Display* /* display */, + Window /* window */, + int /* count */, + XEventClass* /* events */, + int /* mode */ +); + +extern XEventClass *XGetDeviceDontPropagateList( + Display* /* display */, + Window /* window */, + int* /* count */ +); + +extern Status XSendExtensionEvent( + Display* /* display */, + XDevice* /* device */, + Window /* dest */, + Bool /* prop */, + int /* count */, + XEventClass* /* list */, + XEvent* /* event */ +); + +extern XDeviceTimeCoord *XGetDeviceMotionEvents( + Display* /* display */, + XDevice* /* device */, + Time /* start */, + Time /* stop */, + int* /* nEvents */, + int* /* mode */, + int* /* axis_count */ +); + +extern void XFreeDeviceMotionEvents( + XDeviceTimeCoord* /* events */ +); + +extern void XFreeDeviceControl( + XDeviceControl* /* control */ +); + +extern Atom* XListDeviceProperties( + Display* /* dpy */, + XDevice* /* dev */, + int* /* nprops_return */ +); + +extern void XChangeDeviceProperty( + Display* /* dpy */, + XDevice* /* dev */, + Atom /* property */, + Atom /* type */, + int /* format */, + int /* mode */, + _Xconst unsigned char * /*data */, + int /* nelements */ +); + +extern void +XDeleteDeviceProperty( + Display* /* dpy */, + XDevice* /* dev */, + Atom /* property */ +); + +extern Status +XGetDeviceProperty( + Display* /* dpy*/, + XDevice* /* dev*/, + Atom /* property*/, + long /* offset*/, + long /* length*/, + Bool /* delete*/, + Atom /* req_type*/, + Atom* /* actual_type*/, + int* /* actual_format*/, + unsigned long* /* nitems*/, + unsigned long* /* bytes_after*/, + unsigned char** /* prop*/ +); + +_XFUNCPROTOEND + +#endif /* _XINPUT_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XInput2.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XInput2.h new file mode 100644 index 0000000000000000000000000000000000000000..2722142b30290892f02b47130a41280812bfed9e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XInput2.h @@ -0,0 +1,761 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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. + * + */ + +/* Definitions used by the library and client */ + +#ifndef _XINPUT2_H_ +#define _XINPUT2_H_ + +#include +#include +#include +#include /* PointerBarrier */ + +/******************************************************************* + * + */ +typedef struct { + int type; + char* name; + Bool send_core; + Bool enable; +} XIAddMasterInfo; + +typedef struct { + int type; + int deviceid; + int return_mode; /* AttachToMaster, Floating */ + int return_pointer; + int return_keyboard; +} XIRemoveMasterInfo; + +typedef struct { + int type; + int deviceid; + int new_master; +} XIAttachSlaveInfo; + +typedef struct { + int type; + int deviceid; +} XIDetachSlaveInfo; + +typedef union { + int type; /* must be first element */ + XIAddMasterInfo add; + XIRemoveMasterInfo remove; + XIAttachSlaveInfo attach; + XIDetachSlaveInfo detach; +} XIAnyHierarchyChangeInfo; + +typedef struct +{ + int base; + int latched; + int locked; + int effective; +} XIModifierState; + +typedef XIModifierState XIGroupState; + +typedef struct { + int mask_len; + unsigned char *mask; +} XIButtonState; + +typedef struct { + int mask_len; + unsigned char *mask; + double *values; +} XIValuatorState; + + +typedef struct +{ + int deviceid; + int mask_len; + unsigned char* mask; +} XIEventMask; + +typedef struct +{ + int type; + int sourceid; +} XIAnyClassInfo; + +typedef struct +{ + int type; + int sourceid; + int num_buttons; + Atom *labels; + XIButtonState state; +} XIButtonClassInfo; + +typedef struct +{ + int type; + int sourceid; + int num_keycodes; + int *keycodes; +} XIKeyClassInfo; + +typedef struct +{ + int type; + int sourceid; + int number; + Atom label; + double min; + double max; + double value; + int resolution; + int mode; +} XIValuatorClassInfo; + +/* new in XI 2.1 */ +typedef struct +{ + int type; + int sourceid; + int number; + int scroll_type; + double increment; + int flags; +} XIScrollClassInfo; + +typedef struct +{ + int type; + int sourceid; + int mode; + int num_touches; +} XITouchClassInfo; + +/* new in XI 2.4 */ +typedef struct +{ + int type; + int sourceid; + int num_touches; +} XIGestureClassInfo; + +typedef struct +{ + int deviceid; + char *name; + int use; + int attachment; + Bool enabled; + int num_classes; + XIAnyClassInfo **classes; +} XIDeviceInfo; + +typedef struct +{ + int modifiers; + int status; +} XIGrabModifiers; + +typedef unsigned int BarrierEventID; + +typedef struct +{ + int deviceid; + PointerBarrier barrier; + BarrierEventID eventid; +} XIBarrierReleasePointerInfo; + +/** + * Generic XI2 event. All XI2 events have the same header. + */ +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; +} XIEvent; + + +typedef struct { + int deviceid; + int attachment; + int use; + Bool enabled; + int flags; +} XIHierarchyInfo; + +/* + * Notifies the client that the device hierarchy has been changed. The client + * is expected to re-query the server for the device hierarchy. + */ +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; /* XI_HierarchyChanged */ + Time time; + int flags; + int num_info; + XIHierarchyInfo *info; +} XIHierarchyEvent; + +/* + * Notifies the client that the classes have been changed. This happens when + * the slave device that sends through the master changes. + */ +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; /* XI_DeviceChanged */ + Time time; + int deviceid; /* id of the device that changed */ + int sourceid; /* Source for the new classes. */ + int reason; /* Reason for the change */ + int num_classes; + XIAnyClassInfo **classes; /* same as in XIDeviceInfo */ +} XIDeviceChangedEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + int detail; + Window root; + Window event; + Window child; + double root_x; + double root_y; + double event_x; + double event_y; + int flags; + XIButtonState buttons; + XIValuatorState valuators; + XIModifierState mods; + XIGroupState group; +} XIDeviceEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; /* XI_RawKeyPress, XI_RawKeyRelease, etc. */ + Time time; + int deviceid; + int sourceid; /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */ + int detail; + int flags; + XIValuatorState valuators; + double *raw_values; +} XIRawEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + int detail; + Window root; + Window event; + Window child; + double root_x; + double root_y; + double event_x; + double event_y; + int mode; + Bool focus; + Bool same_screen; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; +} XIEnterEvent; + +typedef XIEnterEvent XILeaveEvent; +typedef XIEnterEvent XIFocusInEvent; +typedef XIEnterEvent XIFocusOutEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; /* XI_PropertyEvent */ + Time time; + int deviceid; /* id of the device that changed */ + Atom property; + int what; +} XIPropertyEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + unsigned int touchid; + Window root; + Window event; + Window child; + int flags; +} XITouchOwnershipEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + Window event; + Window root; + double root_x; + double root_y; + double dx; + double dy; + int dtime; + int flags; + PointerBarrier barrier; + BarrierEventID eventid; +} XIBarrierEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + int detail; + Window root; + Window event; + Window child; + double root_x; + double root_y; + double event_x; + double event_y; + double delta_x; + double delta_y; + double delta_unaccel_x; + double delta_unaccel_y; + double scale; + double delta_angle; + int flags; + XIModifierState mods; + XIGroupState group; +} XIGesturePinchEvent; + +typedef struct { + int type; /* GenericEvent */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* XI extension offset */ + int evtype; + Time time; + int deviceid; + int sourceid; + int detail; + Window root; + Window event; + Window child; + double root_x; + double root_y; + double event_x; + double event_y; + double delta_x; + double delta_y; + double delta_unaccel_x; + double delta_unaccel_y; + int flags; + XIModifierState mods; + XIGroupState group; +} XIGestureSwipeEvent; + +_XFUNCPROTOBEGIN + +extern Bool XIQueryPointer( + Display* display, + int deviceid, + Window win, + Window* root, + Window* child, + double* root_x, + double* root_y, + double* win_x, + double* win_y, + XIButtonState *buttons, + XIModifierState *mods, + XIGroupState *group +); + +extern Bool XIWarpPointer( + Display* display, + int deviceid, + Window src_win, + Window dst_win, + double src_x, + double src_y, + unsigned int src_width, + unsigned int src_height, + double dst_x, + double dst_y +); + +extern Status XIDefineCursor( + Display* display, + int deviceid, + Window win, + Cursor cursor +); + +extern Status XIUndefineCursor( + Display* display, + int deviceid, + Window win +); + +extern Status XIChangeHierarchy( + Display* display, + XIAnyHierarchyChangeInfo* changes, + int num_changes +); + +extern Status XISetClientPointer( + Display* dpy, + Window win, + int deviceid +); + +extern Bool XIGetClientPointer( + Display* dpy, + Window win, + int* deviceid +); + +extern int XISelectEvents( + Display* dpy, + Window win, + XIEventMask *masks, + int num_masks +); + +extern XIEventMask *XIGetSelectedEvents( + Display* dpy, + Window win, + int *num_masks_return +); + +extern Status XIQueryVersion( + Display* dpy, + int* major_version_inout, + int* minor_version_inout +); + +extern XIDeviceInfo* XIQueryDevice( + Display* dpy, + int deviceid, + int* ndevices_return +); + +extern Status XISetFocus( + Display* dpy, + int deviceid, + Window focus, + Time time +); + +extern Status XIGetFocus( + Display* dpy, + int deviceid, + Window *focus_return); + +extern Status XIGrabDevice( + Display* dpy, + int deviceid, + Window grab_window, + Time time, + Cursor cursor, + int grab_mode, + int paired_device_mode, + Bool owner_events, + XIEventMask *mask +); + +extern Status XIUngrabDevice( + Display* dpy, + int deviceid, + Time time +); + +extern Status XIAllowEvents( + Display* display, + int deviceid, + int event_mode, + Time time +); + +extern Status XIAllowTouchEvents( + Display* display, + int deviceid, + unsigned int touchid, + Window grab_window, + int event_mode +); + +extern int XIGrabButton( + Display* display, + int deviceid, + int button, + Window grab_window, + Cursor cursor, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabKeycode( + Display* display, + int deviceid, + int keycode, + Window grab_window, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabEnter( + Display* display, + int deviceid, + Window grab_window, + Cursor cursor, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabFocusIn( + Display* display, + int deviceid, + Window grab_window, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabTouchBegin( + Display* display, + int deviceid, + Window grab_window, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabPinchGestureBegin( + Display* display, + int deviceid, + Window grab_window, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabSwipeGestureBegin( + Display* display, + int deviceid, + Window grab_window, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern Status XIUngrabButton( + Display* display, + int deviceid, + int button, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabKeycode( + Display* display, + int deviceid, + int keycode, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabEnter( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabFocusIn( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabTouchBegin( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabPinchGestureBegin( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabSwipeGestureBegin( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Atom *XIListProperties( + Display* display, + int deviceid, + int *num_props_return +); + +extern void XIChangeProperty( + Display* display, + int deviceid, + Atom property, + Atom type, + int format, + int mode, + unsigned char *data, + int num_items +); + +extern void +XIDeleteProperty( + Display* display, + int deviceid, + Atom property +); + +extern Status +XIGetProperty( + Display* display, + int deviceid, + Atom property, + long offset, + long length, + Bool delete_property, + Atom type, + Atom *type_return, + int *format_return, + unsigned long *num_items_return, + unsigned long *bytes_after_return, + unsigned char **data +); + +extern void +XIBarrierReleasePointers( + Display* display, + XIBarrierReleasePointerInfo *barriers, + int num_barriers +); + +extern void +XIBarrierReleasePointer( + Display* display, + int deviceid, + PointerBarrier barrier, + BarrierEventID eventid +); + +extern void XIFreeDeviceInfo(XIDeviceInfo *info); + +_XFUNCPROTOEND + +#endif /* XINPUT2_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XIproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XIproto.h new file mode 100644 index 0000000000000000000000000000000000000000..ac1f096f905395b666688e853a671589e54de190 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XIproto.h @@ -0,0 +1,1758 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef _XIPROTO_H +#define _XIPROTO_H + +#include +#include + +/* make sure types have right sizes for protocol structures. */ +#define Window CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define Mask CARD32 +#define Atom CARD32 +#define Cursor CARD32 + +/********************************************************* + * + * number of events, errors, and extension name. + * + */ + +#define MORE_EVENTS 0x80 +#define DEVICE_BITS 0x7F + +#define InputClassBits 0x3F /* bits in mode field for input classes */ +#define ModeBitsShift 6 /* amount to shift the remaining bits */ + +#define numInputClasses 7 + +#define IEVENTS 17 /* does NOT include generic events */ +#define IERRORS 5 +#define IREQUESTS 39 + +#define CLIENT_REQ 1 + +typedef struct _XExtEventInfo + { + Mask mask; + BYTE type; + BYTE word; + } XExtEventInfo; + +#ifndef _XITYPEDEF_POINTER +typedef void *Pointer; +#endif + +struct tmask + { + Mask mask; + void *dev; + }; + +/********************************************************* + * + * Event constants used by library. + * + */ + +#define XI_DeviceValuator 0 +#define XI_DeviceKeyPress 1 +#define XI_DeviceKeyRelease 2 +#define XI_DeviceButtonPress 3 +#define XI_DeviceButtonRelease 4 +#define XI_DeviceMotionNotify 5 +#define XI_DeviceFocusIn 6 +#define XI_DeviceFocusOut 7 +#define XI_ProximityIn 8 +#define XI_ProximityOut 9 +#define XI_DeviceStateNotify 10 +#define XI_DeviceMappingNotify 11 +#define XI_ChangeDeviceNotify 12 +#define XI_DeviceKeystateNotify 13 +#define XI_DeviceButtonstateNotify 14 +#define XI_DevicePresenceNotify 15 +#define XI_DevicePropertyNotify 16 + +/********************************************************* + * + * Protocol request constants + * + */ + +#define X_GetExtensionVersion 1 +#define X_ListInputDevices 2 +#define X_OpenDevice 3 +#define X_CloseDevice 4 +#define X_SetDeviceMode 5 +#define X_SelectExtensionEvent 6 +#define X_GetSelectedExtensionEvents 7 +#define X_ChangeDeviceDontPropagateList 8 +#define X_GetDeviceDontPropagateList 9 +#define X_GetDeviceMotionEvents 10 +#define X_ChangeKeyboardDevice 11 +#define X_ChangePointerDevice 12 +#define X_GrabDevice 13 +#define X_UngrabDevice 14 +#define X_GrabDeviceKey 15 +#define X_UngrabDeviceKey 16 +#define X_GrabDeviceButton 17 +#define X_UngrabDeviceButton 18 +#define X_AllowDeviceEvents 19 +#define X_GetDeviceFocus 20 +#define X_SetDeviceFocus 21 +#define X_GetFeedbackControl 22 +#define X_ChangeFeedbackControl 23 +#define X_GetDeviceKeyMapping 24 +#define X_ChangeDeviceKeyMapping 25 +#define X_GetDeviceModifierMapping 26 +#define X_SetDeviceModifierMapping 27 +#define X_GetDeviceButtonMapping 28 +#define X_SetDeviceButtonMapping 29 +#define X_QueryDeviceState 30 +#define X_SendExtensionEvent 31 +#define X_DeviceBell 32 +#define X_SetDeviceValuators 33 +#define X_GetDeviceControl 34 +#define X_ChangeDeviceControl 35 +/* XI 1.5 */ +#define X_ListDeviceProperties 36 +#define X_ChangeDeviceProperty 37 +#define X_DeleteDeviceProperty 38 +#define X_GetDeviceProperty 39 + +/********************************************************* + * + * Protocol request and reply structures. + * + * GetExtensionVersion. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetExtensionVersion */ + CARD16 length; + CARD16 nbytes; + CARD8 pad1, pad2; +} xGetExtensionVersionReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetExtensionVersion */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 major_version; + CARD16 minor_version; + BOOL present; + CARD8 pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; +} xGetExtensionVersionReply; + +/********************************************************* + * + * ListInputDevices. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_ListInputDevices */ + CARD16 length; +} xListInputDevicesReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_ListInputDevices */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 ndevices; + CARD8 pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xListInputDevicesReply; + +typedef struct _xDeviceInfo *xDeviceInfoPtr; + +typedef struct _xAnyClassinfo *xAnyClassPtr; + +typedef struct _xAnyClassinfo { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + } xAnyClassInfo; + +typedef struct _xDeviceInfo { + CARD32 type; + CARD8 id; + CARD8 num_classes; + CARD8 use; /* IsXPointer | IsXKeyboard | IsXExtension... */ + CARD8 attached; /* id of master dev (if IsXExtension..) */ + } xDeviceInfo; + +typedef struct _xKeyInfo *xKeyInfoPtr; + +typedef struct _xKeyInfo { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + KeyCode min_keycode; + KeyCode max_keycode; + CARD16 num_keys; + CARD8 pad1,pad2; + } xKeyInfo; + +typedef struct _xButtonInfo *xButtonInfoPtr; + +typedef struct _xButtonInfo { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + CARD16 num_buttons; + } xButtonInfo; + +typedef struct _xValuatorInfo *xValuatorInfoPtr; + +typedef struct _xValuatorInfo { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + CARD8 num_axes; + CARD8 mode; + CARD32 motion_buffer_size; + } xValuatorInfo; + +typedef struct _xAxisInfo *xAxisInfoPtr; + +typedef struct _xAxisInfo { + CARD32 resolution; + CARD32 min_value; + CARD32 max_value; + } xAxisInfo; + +/********************************************************* + * + * OpenDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_OpenDevice */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xOpenDeviceReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_OpenDevice */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 num_classes; + BYTE pad1, pad2, pad3; + CARD32 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + } xOpenDeviceReply; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 event_type_base; + } xInputClassInfo; + +/********************************************************* + * + * CloseDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_CloseDevice */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xCloseDeviceReq; + +/********************************************************* + * + * SetDeviceMode. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_SetDeviceMode */ + CARD16 length; + CARD8 deviceid; + CARD8 mode; + BYTE pad1, pad2; +} xSetDeviceModeReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_SetDeviceMode */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xSetDeviceModeReply; + +/********************************************************* + * + * SelectExtensionEvent. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_SelectExtensionEvent */ + CARD16 length; + Window window; + CARD16 count; + CARD16 pad00; +} xSelectExtensionEventReq; + +/********************************************************* + * + * GetSelectedExtensionEvent. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_GetSelectedExtensionEvents */ + CARD16 length; + Window window; +} xGetSelectedExtensionEventsReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* GetSelectedExtensionEvents */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 this_client_count; + CARD16 all_clients_count; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xGetSelectedExtensionEventsReply; + +/********************************************************* + * + * ChangeDeviceDontPropagateList. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */ + CARD16 length; + Window window; + CARD16 count; + CARD8 mode; + BYTE pad; +} xChangeDeviceDontPropagateListReq; + +/********************************************************* + * + * GetDeviceDontPropagateList. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_GetDeviceDontPropagateList */ + CARD16 length; + Window window; +} xGetDeviceDontPropagateListReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* GetDeviceDontPropagateList */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 count; + CARD16 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + } xGetDeviceDontPropagateListReply; + +/********************************************************* + * + * GetDeviceMotionEvents. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetDeviceMotionEvents*/ + CARD16 length; + Time start; + Time stop; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xGetDeviceMotionEventsReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceMotionEvents */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 nEvents; + CARD8 axes; + CARD8 mode; + BYTE pad1, pad2; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; +} xGetDeviceMotionEventsReply; + +/********************************************************* + * + * ChangeKeyboardDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_ChangeKeyboardDevice */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xChangeKeyboardDeviceReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_ChangeKeyboardDevice*/ + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + } xChangeKeyboardDeviceReply; + +/********************************************************* + * + * ChangePointerDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_ChangePointerDevice */ + CARD16 length; + CARD8 xaxis; + CARD8 yaxis; + CARD8 deviceid; + BYTE pad1; +} xChangePointerDeviceReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_ChangePointerDevice */ + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + } xChangePointerDeviceReply; + +/********************************************************* + * + * GrabDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GrabDevice */ + CARD16 length; + Window grabWindow; + Time time; + CARD16 event_count; + CARD8 this_device_mode; + CARD8 other_devices_mode; + BOOL ownerEvents; + CARD8 deviceid; + CARD16 pad01; +} xGrabDeviceReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GrabDevice */ + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + } xGrabDeviceReply; + +/********************************************************* + * + * UngrabDevice. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_UnGrabDevice */ + CARD16 length; + Time time; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xUngrabDeviceReq; + +/********************************************************* + * + * GrabDeviceKey. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GrabDeviceKey */ + CARD16 length; + Window grabWindow; + CARD16 event_count; + CARD16 modifiers; + CARD8 modifier_device; + CARD8 grabbed_device; + CARD8 key; + BYTE this_device_mode; + BYTE other_devices_mode; + BOOL ownerEvents; + BYTE pad1, pad2; +} xGrabDeviceKeyReq; + +/********************************************************* + * + * UngrabDeviceKey. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_UngrabDeviceKey */ + CARD16 length; + Window grabWindow; + CARD16 modifiers; + CARD8 modifier_device; + CARD8 key; + CARD8 grabbed_device; + BYTE pad1, pad2, pad3; +} xUngrabDeviceKeyReq; + +/********************************************************* + * + * GrabDeviceButton. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GrabDeviceButton */ + CARD16 length; + Window grabWindow; + CARD8 grabbed_device; + CARD8 modifier_device; + CARD16 event_count; + CARD16 modifiers; + BYTE this_device_mode; + BYTE other_devices_mode; + CARD8 button; + BOOL ownerEvents; + BYTE pad1, pad2; +} xGrabDeviceButtonReq; + +/********************************************************* + * + * UngrabDeviceButton. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_UngrabDeviceButton */ + CARD16 length; + Window grabWindow; + CARD16 modifiers; + CARD8 modifier_device; + CARD8 button; + CARD8 grabbed_device; + BYTE pad1, pad2, pad3; +} xUngrabDeviceButtonReq; + +/********************************************************* + * + * AllowDeviceEvents. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_AllowDeviceEvents */ + CARD16 length; + Time time; + CARD8 mode; + CARD8 deviceid; + BYTE pad1, pad2; +} xAllowDeviceEventsReq; + +/********************************************************* + * + * GetDeviceFocus. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetDeviceFocus */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xGetDeviceFocusReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceFocus */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 focus; + Time time; + CARD8 revertTo; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + } xGetDeviceFocusReply; + +/********************************************************* + * + * SetDeviceFocus. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_SetDeviceFocus */ + CARD16 length; + Window focus; + Time time; + CARD8 revertTo; + CARD8 device; + CARD16 pad01; +} xSetDeviceFocusReq; + +/********************************************************* + * + * GetFeedbackControl. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_GetFeedbackControl */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xGetFeedbackControlReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetFeedbackControl */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 num_feedbacks; + CARD16 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + CARD32 pad06; +} xGetFeedbackControlReply; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class */ +#else + CARD8 class; /* feedback class */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ +} xFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 id; + CARD16 length; + CARD16 pitch; + CARD16 duration; + CARD32 led_mask; + CARD32 led_values; + BOOL global_auto_repeat; + CARD8 click; + CARD8 percent; + BYTE pad; + BYTE auto_repeats[32]; +} xKbdFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 id; + CARD16 length; + CARD8 pad1,pad2; + CARD16 accelNum; + CARD16 accelDenom; + CARD16 threshold; +} xPtrFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; + CARD16 length; /* feedback length */ + CARD32 resolution; + INT32 min_value; + INT32 max_value; +} xIntegerFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; + CARD16 length; /* feedback length */ + CARD16 max_symbols; + CARD16 num_syms_supported; +} xStringFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; + CARD16 length; /* feedback length */ + CARD8 percent; + BYTE pad1, pad2, pad3; + CARD16 pitch; + CARD16 duration; +} xBellFeedbackState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; + CARD16 length; /* feedback length */ + CARD32 led_mask; + CARD32 led_values; +} xLedFeedbackState; + +/********************************************************* + * + * ChangeFeedbackControl. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_ChangeFeedbackControl */ + CARD16 length; + CARD32 mask; + CARD8 deviceid; + CARD8 feedbackid; + BYTE pad1, pad2; +} xChangeFeedbackControlReq; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ +} xFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback length */ + CARD16 length; /* feedback length */ + KeyCode key; + CARD8 auto_repeat_mode; + INT8 click; + INT8 percent; + INT16 pitch; + INT16 duration; + CARD32 led_mask; + CARD32 led_values; +} xKbdFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ + CARD8 pad1,pad2; + INT16 num; + INT16 denom; + INT16 thresh; +} xPtrFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ + INT32 int_to_display; +} xIntegerFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ + CARD8 pad1,pad2; + CARD16 num_keysyms; +} xStringFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ + INT8 percent; + BYTE pad1, pad2, pad3; + INT16 pitch; + INT16 duration; +} xBellFeedbackCtl; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; /* feedback class id */ +#else + CARD8 class; /* feedback class id */ +#endif + CARD8 id; /* feedback id */ + CARD16 length; /* feedback length */ + CARD32 led_mask; + CARD32 led_values; +} xLedFeedbackCtl; + +/********************************************************* + * + * GetDeviceKeyMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetDeviceKeyMapping */ + CARD16 length; + CARD8 deviceid; + KeyCode firstKeyCode; + CARD8 count; + BYTE pad1; +} xGetDeviceKeyMappingReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceKeyMapping */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 keySymsPerKeyCode; + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xGetDeviceKeyMappingReply; + +/********************************************************* + * + * ChangeDeviceKeyMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */ + CARD16 length; + CARD8 deviceid; + KeyCode firstKeyCode; + CARD8 keySymsPerKeyCode; + CARD8 keyCodes; +} xChangeDeviceKeyMappingReq; + +/********************************************************* + * + * GetDeviceModifierMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetDeviceModifierMapping */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xGetDeviceModifierMappingReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceModifierMapping */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 numKeyPerModifier; + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xGetDeviceModifierMappingReply; + +/********************************************************* + * + * SetDeviceModifierMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_SetDeviceModifierMapping */ + CARD16 length; + CARD8 deviceid; + CARD8 numKeyPerModifier; + CARD16 pad1; +} xSetDeviceModifierMappingReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_SetDeviceModifierMapping */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 success; + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xSetDeviceModifierMappingReply; + +/********************************************************* + * + * GetDeviceButtonMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_GetDeviceButtonMapping */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xGetDeviceButtonMappingReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceButtonMapping */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 nElts; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xGetDeviceButtonMappingReply; + +/********************************************************* + * + * SetDeviceButtonMapping. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* X_SetDeviceButtonMapping */ + CARD16 length; + CARD8 deviceid; + CARD8 map_length; + BYTE pad1, pad2; +} xSetDeviceButtonMappingReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_SetDeviceButtonMapping */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 status; + BYTE pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xSetDeviceButtonMappingReply; + +/********************************************************* + * + * QueryDeviceState. + * + */ + +typedef struct { + CARD8 reqType; + CARD8 ReqType; /* always X_QueryDeviceState */ + CARD16 length; + CARD8 deviceid; + BYTE pad1, pad2, pad3; +} xQueryDeviceStateReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_QueryDeviceState */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 num_classes; + BYTE pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xQueryDeviceStateReply; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + CARD8 num_keys; + BYTE pad1; + CARD8 keys[32]; +} xKeyState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + CARD8 num_buttons; + BYTE pad1; + CARD8 buttons[32]; +} xButtonState; + +typedef struct { +#if defined(__cplusplus) || defined(c_plusplus) + CARD8 c_class; +#else + CARD8 class; +#endif + CARD8 length; + CARD8 num_valuators; + CARD8 mode; +} xValuatorState; + +/********************************************************* + * + * SendExtensionEvent. + * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH! + * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED! + * + */ + +typedef struct { + CARD8 reqType; + CARD8 ReqType; /* always X_SendExtensionEvent */ + CARD16 length; + Window destination; + CARD8 deviceid; + BOOL propagate; + CARD16 count; + CARD8 num_events; + BYTE pad1,pad2,pad3; +} xSendExtensionEventReq; + +/********************************************************* + * + * DeviceBell. + * + */ + +typedef struct { + CARD8 reqType; + CARD8 ReqType; /* always X_DeviceBell */ + CARD16 length; + CARD8 deviceid; + CARD8 feedbackid; + CARD8 feedbackclass; + INT8 percent; +} xDeviceBellReq; + +/********************************************************* + * + * SetDeviceValuators. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_SetDeviceValuators */ + CARD16 length; + CARD8 deviceid; + CARD8 first_valuator; + CARD8 num_valuators; + BYTE pad1; +} xSetDeviceValuatorsReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_SetDeviceValuators */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xSetDeviceValuatorsReply; + +/********************************************************* + * + * GetDeviceControl. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GetDeviceControl */ + CARD16 length; + CARD16 control; + CARD8 deviceid; + BYTE pad2; +} xGetDeviceControlReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceControl */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xGetDeviceControlReply; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ +} xDeviceState; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ + CARD32 num_valuators; /* number of valuators */ +} xDeviceResolutionState; + +typedef struct { + CARD16 control; + CARD16 length; + INT32 min_x; + INT32 max_x; + INT32 min_y; + INT32 max_y; + CARD32 flip_x; + CARD32 flip_y; + CARD32 rotation; + CARD32 button_threshold; +} xDeviceAbsCalibState; + +typedef struct { + CARD16 control; + CARD16 length; + CARD32 offset_x; + CARD32 offset_y; + CARD32 width; + CARD32 height; + CARD32 screen; + CARD32 following; +} xDeviceAbsAreaState; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ + CARD8 status; + CARD8 iscore; + CARD16 pad1; +} xDeviceCoreState; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ + CARD8 enable; + CARD8 pad0; + CARD16 pad1; +} xDeviceEnableState; + +/********************************************************* + * + * ChangeDeviceControl. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_ChangeDeviceControl */ + CARD16 length; + CARD16 control; + CARD8 deviceid; + BYTE pad0; +} xChangeDeviceControlReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_ChangeDeviceControl */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 status; + BYTE pad1, pad2, pad3; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; +} xChangeDeviceControlReply; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ +} xDeviceCtl; + +typedef struct { + CARD16 control; /* control type */ + CARD16 length; /* control length */ + CARD8 first_valuator; /* first valuator to change */ + CARD8 num_valuators; /* number of valuators to change*/ + CARD8 pad1,pad2; +} xDeviceResolutionCtl; + +typedef struct { + CARD16 control; + CARD16 length; + INT32 min_x; + INT32 max_x; + INT32 min_y; + INT32 max_y; + CARD32 flip_x; + CARD32 flip_y; + CARD32 rotation; + CARD32 button_threshold; +} xDeviceAbsCalibCtl; + +typedef struct { + CARD16 control; + CARD16 length; + CARD32 offset_x; + CARD32 offset_y; + INT32 width; + INT32 height; + INT32 screen; + CARD32 following; +} xDeviceAbsAreaCtl; + +typedef struct { + CARD16 control; + CARD16 length; + CARD8 status; + CARD8 pad0; + CARD16 pad1; +} xDeviceCoreCtl; + +typedef struct { + CARD16 control; + CARD16 length; + CARD8 enable; + CARD8 pad0; + CARD16 pad1; +} xDeviceEnableCtl; + +/* XI 1.5 */ + +/********************************************************* + * + * ListDeviceProperties. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major opcode */ + CARD8 ReqType; /* always X_ListDeviceProperties */ + CARD16 length; + CARD8 deviceid; + CARD8 pad0; + CARD16 pad1; +} xListDevicePropertiesReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_ListDeviceProperties */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 nAtoms; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xListDevicePropertiesReply; + +/********************************************************* + * + * ChangeDeviceProperty. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major opcode */ + CARD8 ReqType; /* always X_ChangeDeviceProperty */ + CARD16 length; + Atom property; + Atom type; + CARD8 deviceid; + CARD8 format; + CARD8 mode; + CARD8 pad; + CARD32 nUnits; +} xChangeDevicePropertyReq; + +/********************************************************* + * + * DeleteDeviceProperty. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major opcode */ + CARD8 ReqType; /* always X_DeleteDeviceProperty */ + CARD16 length; + Atom property; + CARD8 deviceid; + CARD8 pad0; + CARD16 pad1; +} xDeleteDevicePropertyReq; + +/********************************************************* + * + * GetDeviceProperty. + * + */ + +typedef struct { + CARD8 reqType; /* input extension major opcode */ + CARD8 ReqType; /* always X_GetDeviceProperty */ + CARD16 length; + Atom property; + Atom type; + CARD32 longOffset; + CARD32 longLength; + CARD8 deviceid; +#if defined(__cplusplus) || defined(c_plusplus) + BOOL c_delete; +#else + BOOL delete; +#endif + CARD16 pad; +} xGetDevicePropertyReq; + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GetDeviceProperty */ + CARD16 sequenceNumber; + CARD32 length; + Atom propertyType; + CARD32 bytesAfter; + CARD32 nItems; + CARD8 format; + CARD8 deviceid; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; +} xGetDevicePropertyReply; + + +/********************************************************** + * + * Input extension events. + * + * DeviceValuator + * + */ + +typedef struct + { + BYTE type; + CARD8 deviceid; + CARD16 sequenceNumber; + KeyButMask device_state; + CARD8 num_valuators; + CARD8 first_valuator; + INT32 valuator0; + INT32 valuator1; + INT32 valuator2; + INT32 valuator3; + INT32 valuator4; + INT32 valuator5; + } deviceValuator; + +/********************************************************** + * + * DeviceKeyButtonPointer. + * + * Used for: DeviceKeyPress, DeviceKeyRelease, + * DeviceButtonPress, DeviceButtonRelease, + * ProximityIn, ProximityOut + * DeviceMotionNotify, + * + */ + +typedef struct + { + BYTE type; + BYTE detail; + CARD16 sequenceNumber; + Time time; + Window root; + Window event; + Window child; + INT16 root_x; + INT16 root_y; + INT16 event_x; + INT16 event_y; + KeyButMask state; + BOOL same_screen; + CARD8 deviceid; + } deviceKeyButtonPointer; + +/********************************************************** + * + * DeviceFocus. + * + */ + +typedef struct + { + BYTE type; + BYTE detail; + CARD16 sequenceNumber; + Time time; + Window window; + BYTE mode; + CARD8 deviceid; + BYTE pad1, pad2; + CARD32 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + } deviceFocus; + +/********************************************************** + * + * DeviceStateNotify. + * + * Note that the two high-order bits in the classes_reported + * field are the proximity state (InProximity or OutOfProximity), + * and the device mode (Absolute or Relative), respectively. + * + */ + +typedef struct + { + BYTE type; + BYTE deviceid; + CARD16 sequenceNumber; + Time time; + CARD8 num_keys; + CARD8 num_buttons; + CARD8 num_valuators; + CARD8 classes_reported; + CARD8 buttons[4]; + CARD8 keys[4]; + INT32 valuator0; + INT32 valuator1; + INT32 valuator2; + } deviceStateNotify; + +/********************************************************** + * + * DeviceKeyStateNotify. + * + */ + +typedef struct + { + BYTE type; + BYTE deviceid; + CARD16 sequenceNumber; + CARD8 keys[28]; + } deviceKeyStateNotify; + +/********************************************************** + * + * DeviceButtonStateNotify. + * + */ + +typedef struct + { + BYTE type; + BYTE deviceid; + CARD16 sequenceNumber; + CARD8 buttons[28]; + } deviceButtonStateNotify; + +/********************************************************** + * + * DeviceMappingNotify. + * Fields must be kept in sync with core mappingnotify event. + * + */ + +typedef struct + { + BYTE type; + BYTE deviceid; + CARD16 sequenceNumber; + CARD8 request; + KeyCode firstKeyCode; + CARD8 count; + BYTE pad1; + Time time; + CARD32 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + } deviceMappingNotify; + +/********************************************************** + * + * ChangeDeviceNotify. + * + */ + +typedef struct + { + BYTE type; + BYTE deviceid; + CARD16 sequenceNumber; + Time time; + CARD8 request; + BYTE pad1, pad2, pad3; + CARD32 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + } changeDeviceNotify; + +/********************************************************** + * + * devicePresenceNotify. + * + */ + +typedef struct + { + BYTE type; + BYTE pad00; + CARD16 sequenceNumber; + Time time; + BYTE devchange; /* Device{Added|Removed|Enabled|Disabled|ControlChanged} */ + BYTE deviceid; + CARD16 control; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + CARD32 pad06; + } devicePresenceNotify; + + +/********************************************************* + * DevicePropertyNotifyEvent + * + * Sent whenever a device's property changes. + * + */ + +typedef struct + { + BYTE type; + BYTE state; /* NewValue or Deleted */ + CARD16 sequenceNumber; + CARD32 time; + Atom atom; /* affected property */ + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD16 pad5; + CARD8 pad4; + CARD8 deviceid; /* id of device */ + } devicePropertyNotify; + +#undef Window +#undef Time +#undef KeyCode +#undef Mask +#undef Atom +#undef Cursor + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XKB.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XKB.h new file mode 100644 index 0000000000000000000000000000000000000000..5d3f87016f3a58b38702625fdced7205f084a169 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XKB.h @@ -0,0 +1,786 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKB_H_ +#define _XKB_H_ + + /* + * XKB request codes, used in: + * - xkbReqType field of all requests + * - requestMinor field of some events + */ +#define X_kbUseExtension 0 +#define X_kbSelectEvents 1 +#define X_kbBell 3 +#define X_kbGetState 4 +#define X_kbLatchLockState 5 +#define X_kbGetControls 6 +#define X_kbSetControls 7 +#define X_kbGetMap 8 +#define X_kbSetMap 9 +#define X_kbGetCompatMap 10 +#define X_kbSetCompatMap 11 +#define X_kbGetIndicatorState 12 +#define X_kbGetIndicatorMap 13 +#define X_kbSetIndicatorMap 14 +#define X_kbGetNamedIndicator 15 +#define X_kbSetNamedIndicator 16 +#define X_kbGetNames 17 +#define X_kbSetNames 18 +#define X_kbGetGeometry 19 +#define X_kbSetGeometry 20 +#define X_kbPerClientFlags 21 +#define X_kbListComponents 22 +#define X_kbGetKbdByName 23 +#define X_kbGetDeviceInfo 24 +#define X_kbSetDeviceInfo 25 +#define X_kbSetDebuggingFlags 101 + + /* + * In the X sense, XKB reports only one event. + * The type field of all XKB events is XkbEventCode + */ +#define XkbEventCode 0 +#define XkbNumberEvents (XkbEventCode+1) + + /* + * XKB has a minor event code so it can use one X event code for + * multiple purposes. + * - reported in the xkbType field of all XKB events. + * - XkbSelectEventDetails: Indicates the event for which event details + * are being changed + */ +#define XkbNewKeyboardNotify 0 +#define XkbMapNotify 1 +#define XkbStateNotify 2 +#define XkbControlsNotify 3 +#define XkbIndicatorStateNotify 4 +#define XkbIndicatorMapNotify 5 +#define XkbNamesNotify 6 +#define XkbCompatMapNotify 7 +#define XkbBellNotify 8 +#define XkbActionMessage 9 +#define XkbAccessXNotify 10 +#define XkbExtensionDeviceNotify 11 + + /* + * Event Mask: + * - XkbSelectEvents: Specifies event interest. + */ +#define XkbNewKeyboardNotifyMask (1L << 0) +#define XkbMapNotifyMask (1L << 1) +#define XkbStateNotifyMask (1L << 2) +#define XkbControlsNotifyMask (1L << 3) +#define XkbIndicatorStateNotifyMask (1L << 4) +#define XkbIndicatorMapNotifyMask (1L << 5) +#define XkbNamesNotifyMask (1L << 6) +#define XkbCompatMapNotifyMask (1L << 7) +#define XkbBellNotifyMask (1L << 8) +#define XkbActionMessageMask (1L << 9) +#define XkbAccessXNotifyMask (1L << 10) +#define XkbExtensionDeviceNotifyMask (1L << 11) +#define XkbAllEventsMask (0xFFF) + + /* + * NewKeyboardNotify event details: + */ +#define XkbNKN_KeycodesMask (1L << 0) +#define XkbNKN_GeometryMask (1L << 1) +#define XkbNKN_DeviceIDMask (1L << 2) +#define XkbAllNewKeyboardEventsMask (0x7) + + /* + * AccessXNotify event types: + * - The 'what' field of AccessXNotify events reports the + * reason that the event was generated. + */ +#define XkbAXN_SKPress 0 +#define XkbAXN_SKAccept 1 +#define XkbAXN_SKReject 2 +#define XkbAXN_SKRelease 3 +#define XkbAXN_BKAccept 4 +#define XkbAXN_BKReject 5 +#define XkbAXN_AXKWarning 6 + + /* + * AccessXNotify details: + * - Used as an event detail mask to limit the conditions under which + * AccessXNotify events are reported + */ +#define XkbAXN_SKPressMask (1L << 0) +#define XkbAXN_SKAcceptMask (1L << 1) +#define XkbAXN_SKRejectMask (1L << 2) +#define XkbAXN_SKReleaseMask (1L << 3) +#define XkbAXN_BKAcceptMask (1L << 4) +#define XkbAXN_BKRejectMask (1L << 5) +#define XkbAXN_AXKWarningMask (1L << 6) +#define XkbAllAccessXEventsMask (0x7f) + + /* + * Miscellaneous event details: + * - event detail masks for assorted events that don't really + * have any details. + */ +#define XkbAllStateEventsMask XkbAllStateComponentsMask +#define XkbAllMapEventsMask XkbAllMapComponentsMask +#define XkbAllControlEventsMask XkbAllControlsMask +#define XkbAllIndicatorEventsMask XkbAllIndicatorsMask +#define XkbAllNameEventsMask XkbAllNamesMask +#define XkbAllCompatMapEventsMask XkbAllCompatMask +#define XkbAllBellEventsMask (1L << 0) +#define XkbAllActionMessagesMask (1L << 0) + + /* + * XKB reports one error: BadKeyboard + * A further reason for the error is encoded into to most significant + * byte of the resourceID for the error: + * XkbErr_BadDevice - the device in question was not found + * XkbErr_BadClass - the device was found but it doesn't belong to + * the appropriate class. + * XkbErr_BadId - the device was found and belongs to the right + * class, but not feedback with a matching id was + * found. + * The low byte of the resourceID for this error contains the device + * id, class specifier or feedback id that failed. + */ +#define XkbKeyboard 0 +#define XkbNumberErrors 1 + +#define XkbErr_BadDevice 0xff +#define XkbErr_BadClass 0xfe +#define XkbErr_BadId 0xfd + + /* + * Keyboard Components Mask: + * - Specifies the components that follow a GetKeyboardByNameReply + */ +#define XkbClientMapMask (1L << 0) +#define XkbServerMapMask (1L << 1) +#define XkbCompatMapMask (1L << 2) +#define XkbIndicatorMapMask (1L << 3) +#define XkbNamesMask (1L << 4) +#define XkbGeometryMask (1L << 5) +#define XkbControlsMask (1L << 6) +#define XkbAllComponentsMask (0x7f) + + /* + * State detail mask: + * - The 'changed' field of StateNotify events reports which of + * the keyboard state components have changed. + * - Used as an event detail mask to limit the conditions under + * which StateNotify events are reported. + */ +#define XkbModifierStateMask (1L << 0) +#define XkbModifierBaseMask (1L << 1) +#define XkbModifierLatchMask (1L << 2) +#define XkbModifierLockMask (1L << 3) +#define XkbGroupStateMask (1L << 4) +#define XkbGroupBaseMask (1L << 5) +#define XkbGroupLatchMask (1L << 6) +#define XkbGroupLockMask (1L << 7) +#define XkbCompatStateMask (1L << 8) +#define XkbGrabModsMask (1L << 9) +#define XkbCompatGrabModsMask (1L << 10) +#define XkbLookupModsMask (1L << 11) +#define XkbCompatLookupModsMask (1L << 12) +#define XkbPointerButtonMask (1L << 13) +#define XkbAllStateComponentsMask (0x3fff) + + /* + * Controls detail masks: + * The controls specified in XkbAllControlsMask: + * - The 'changed' field of ControlsNotify events reports which of + * the keyboard controls have changed. + * - The 'changeControls' field of the SetControls request specifies + * the controls for which values are to be changed. + * - Used as an event detail mask to limit the conditions under + * which ControlsNotify events are reported. + * + * The controls specified in the XkbAllBooleanCtrlsMask: + * - The 'enabledControls' field of ControlsNotify events reports the + * current status of the boolean controls. + * - The 'enabledControlsChanges' field of ControlsNotify events reports + * any boolean controls that have been turned on or off. + * - The 'affectEnabledControls' and 'enabledControls' fields of the + * kbSetControls request change the set of enabled controls. + * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of + * an XkbControlsRec specify the controls to be changed if the keyboard + * times out and the values to which they should be changed. + * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags + * request specifies the specify the controls to be reset when the + * client exits and the values to which they should be reset. + * - The 'ctrls' field of an indicator map specifies the controls + * that drive the indicator. + * - Specifies the boolean controls affected by the SetControls and + * LockControls key actions. + */ +#define XkbRepeatKeysMask (1L << 0) +#define XkbSlowKeysMask (1L << 1) +#define XkbBounceKeysMask (1L << 2) +#define XkbStickyKeysMask (1L << 3) +#define XkbMouseKeysMask (1L << 4) +#define XkbMouseKeysAccelMask (1L << 5) +#define XkbAccessXKeysMask (1L << 6) +#define XkbAccessXTimeoutMask (1L << 7) +#define XkbAccessXFeedbackMask (1L << 8) +#define XkbAudibleBellMask (1L << 9) +#define XkbOverlay1Mask (1L << 10) +#define XkbOverlay2Mask (1L << 11) +#define XkbIgnoreGroupLockMask (1L << 12) +#define XkbGroupsWrapMask (1L << 27) +#define XkbInternalModsMask (1L << 28) +#define XkbIgnoreLockModsMask (1L << 29) +#define XkbPerKeyRepeatMask (1L << 30) +#define XkbControlsEnabledMask (1L << 31) + +#define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask) + +#define XkbAllBooleanCtrlsMask (0x00001FFF) +#define XkbAllControlsMask (0xF8001FFF) +#define XkbAllControlEventsMask XkbAllControlsMask + + /* + * AccessX Options Mask + * - The 'accessXOptions' field of an XkbControlsRec specifies the + * AccessX options that are currently in effect. + * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' + * fields of an XkbControlsRec specify the Access X options to be + * changed if the keyboard times out and the values to which they + * should be changed. + */ +#define XkbAX_SKPressFBMask (1L << 0) +#define XkbAX_SKAcceptFBMask (1L << 1) +#define XkbAX_FeatureFBMask (1L << 2) +#define XkbAX_SlowWarnFBMask (1L << 3) +#define XkbAX_IndicatorFBMask (1L << 4) +#define XkbAX_StickyKeysFBMask (1L << 5) +#define XkbAX_TwoKeysMask (1L << 6) +#define XkbAX_LatchToLockMask (1L << 7) +#define XkbAX_SKReleaseFBMask (1L << 8) +#define XkbAX_SKRejectFBMask (1L << 9) +#define XkbAX_BKRejectFBMask (1L << 10) +#define XkbAX_DumbBellFBMask (1L << 11) +#define XkbAX_FBOptionsMask (0xF3F) +#define XkbAX_SKOptionsMask (0x0C0) +#define XkbAX_AllOptionsMask (0xFFF) + + /* + * XkbUseCoreKbd is used to specify the core keyboard without having + * to look up its X input extension identifier. + * XkbUseCorePtr is used to specify the core pointer without having + * to look up its X input extension identifier. + * XkbDfltXIClass is used to specify "don't care" any place that the + * XKB protocol is looking for an X Input Extension + * device class. + * XkbDfltXIId is used to specify "don't care" any place that the + * XKB protocol is looking for an X Input Extension + * feedback identifier. + * XkbAllXIClasses is used to get information about all device indicators, + * whether they're part of the indicator feedback class + * or the keyboard feedback class. + * XkbAllXIIds is used to get information about all device indicator + * feedbacks without having to list them. + * XkbXINone is used to indicate that no class or id has been specified. + * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs + * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells + * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device + * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class + * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id + * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, + * including the default. + * XkbSingleXIId(i) True if 'i' specifies exactly one device + * identifier, including the default. + */ +#define XkbUseCoreKbd 0x0100 +#define XkbUseCorePtr 0x0200 +#define XkbDfltXIClass 0x0300 +#define XkbDfltXIId 0x0400 +#define XkbAllXIClasses 0x0500 +#define XkbAllXIIds 0x0600 +#define XkbXINone 0xff00 + +#define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ + ((c)==LedFeedbackClass)||\ + ((c)==XkbDfltXIClass)||\ + ((c)==XkbAllXIClasses)) +#define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ + ((c)==BellFeedbackClass)||\ + ((c)==XkbDfltXIClass)||\ + ((c)==XkbAllXIClasses)) +#define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) +#define XkbExplicitXIClass(c) (((c)&(~0xff))==0) +#define XkbExplicitXIId(c) (((c)&(~0xff))==0) +#define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) +#define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) + +#define XkbNoModifier 0xff +#define XkbNoShiftLevel 0xff +#define XkbNoShape 0xff +#define XkbNoIndicator 0xff + +#define XkbNoModifierMask 0 +#define XkbAllModifiersMask 0xff +#define XkbAllVirtualModsMask 0xffff + +#define XkbNumKbdGroups 4 +#define XkbMaxKbdGroup (XkbNumKbdGroups-1) + +#define XkbMaxMouseKeysBtn 4 + + /* + * Group Index and Mask: + * - Indices into the kt_index array of a key type. + * - Mask specifies types to be changed for XkbChangeTypesOfKey + */ +#define XkbGroup1Index 0 +#define XkbGroup2Index 1 +#define XkbGroup3Index 2 +#define XkbGroup4Index 3 +#define XkbAnyGroup 254 +#define XkbAllGroups 255 + +#define XkbGroup1Mask (1<<0) +#define XkbGroup2Mask (1<<1) +#define XkbGroup3Mask (1<<2) +#define XkbGroup4Mask (1<<3) +#define XkbAnyGroupMask (1<<7) +#define XkbAllGroupsMask (0xf) + + /* + * BuildCoreState: Given a keyboard group and a modifier state, + * construct the value to be reported an event. + * GroupForCoreState: Given the state reported in an event, + * determine the keyboard group. + * IsLegalGroup: Returns TRUE if 'g' is a valid group index. + */ +#define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) +#define XkbGroupForCoreState(s) (((s)>>13)&0x3) +#define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) +#define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) +#define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) + + + /* + * Key Behavior Qualifier: + * KB_Permanent indicates that the behavior describes an unalterable + * characteristic of the keyboard, not an XKB software-simulation of + * the listed behavior. + * Key Behavior Types: + * Specifies the behavior of the underlying key. + */ +#define XkbKB_Permanent 0x80 +#define XkbKB_OpMask 0x7f + +#define XkbKB_Default 0x00 +#define XkbKB_Lock 0x01 +#define XkbKB_RadioGroup 0x02 +#define XkbKB_Overlay1 0x03 +#define XkbKB_Overlay2 0x04 + +#define XkbKB_RGAllowNone 0x80 + + /* + * Various macros which describe the range of legal keycodes. + */ +#define XkbMinLegalKeyCode 8 +#define XkbMaxLegalKeyCode 255 +#define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) +#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) +/* Seems kinda silly to check that an unsigned char is <= 255... */ +#define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode) + + /* + * Assorted constants and limits. + */ +#define XkbNumModifiers 8 +#define XkbNumVirtualMods 16 +#define XkbNumIndicators 32 +#define XkbAllIndicatorsMask (0xffffffff) +#define XkbMaxRadioGroups 32 +#define XkbAllRadioGroupsMask (0xffffffff) +#define XkbMaxShiftLevel 63 +#define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) +#define XkbRGMaxMembers 12 +#define XkbActionMessageLength 6 +#define XkbKeyNameLength 4 +#define XkbMaxRedirectCount 8 + +#define XkbGeomPtsPerMM 10 +#define XkbGeomMaxColors 32 +#define XkbGeomMaxLabelColors 3 +#define XkbGeomMaxPriority 255 + + /* + * Key Type index and mask for the four standard key types. + */ +#define XkbOneLevelIndex 0 +#define XkbTwoLevelIndex 1 +#define XkbAlphabeticIndex 2 +#define XkbKeypadIndex 3 +#define XkbLastRequiredType XkbKeypadIndex +#define XkbNumRequiredTypes (XkbLastRequiredType+1) +#define XkbMaxKeyTypes 255 + +#define XkbOneLevelMask (1<<0) +#define XkbTwoLevelMask (1<<1) +#define XkbAlphabeticMask (1<<2) +#define XkbKeypadMask (1<<3) +#define XkbAllRequiredTypes (0xf) + +#define XkbShiftLevel(n) ((n)-1) +#define XkbShiftLevelMask(n) (1<<((n)-1)) + + /* + * Extension name and version information + */ +#define XkbName "XKEYBOARD" +#define XkbMajorVersion 1 +#define XkbMinorVersion 0 + + /* + * Explicit map components: + * - Used in the 'explicit' field of an XkbServerMap. Specifies + * the keyboard components that should _not_ be updated automatically + * in response to core protocol keyboard mapping requests. + */ +#define XkbExplicitKeyTypesMask (0x0f) +#define XkbExplicitKeyType1Mask (1<<0) +#define XkbExplicitKeyType2Mask (1<<1) +#define XkbExplicitKeyType3Mask (1<<2) +#define XkbExplicitKeyType4Mask (1<<3) +#define XkbExplicitInterpretMask (1<<4) +#define XkbExplicitAutoRepeatMask (1<<5) +#define XkbExplicitBehaviorMask (1<<6) +#define XkbExplicitVModMapMask (1<<7) +#define XkbAllExplicitMask (0xff) + + /* + * Map components masks: + * Those in AllMapComponentsMask: + * - Specifies the individual fields to be loaded or changed for the + * GetMap and SetMap requests. + * Those in ClientInfoMask: + * - Specifies the components to be allocated by XkbAllocClientMap. + * Those in ServerInfoMask: + * - Specifies the components to be allocated by XkbAllocServerMap. + */ +#define XkbKeyTypesMask (1<<0) +#define XkbKeySymsMask (1<<1) +#define XkbModifierMapMask (1<<2) +#define XkbExplicitComponentsMask (1<<3) +#define XkbKeyActionsMask (1<<4) +#define XkbKeyBehaviorsMask (1<<5) +#define XkbVirtualModsMask (1<<6) +#define XkbVirtualModMapMask (1<<7) + +#define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) +#define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) +#define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) + + /* + * Symbol interpretations flags: + * - Used in the flags field of a symbol interpretation + */ +#define XkbSI_AutoRepeat (1<<0) +#define XkbSI_LockingKey (1<<1) + + /* + * Symbol interpretations match specification: + * - Used in the match field of a symbol interpretation to specify + * the conditions under which an interpretation is used. + */ +#define XkbSI_LevelOneOnly (0x80) +#define XkbSI_OpMask (0x7f) +#define XkbSI_NoneOf (0) +#define XkbSI_AnyOfOrNone (1) +#define XkbSI_AnyOf (2) +#define XkbSI_AllOf (3) +#define XkbSI_Exactly (4) + + /* + * Indicator map flags: + * - Used in the flags field of an indicator map to indicate the + * conditions under which and indicator can be changed and the + * effects of changing the indicator. + */ +#define XkbIM_NoExplicit (1L << 7) +#define XkbIM_NoAutomatic (1L << 6) +#define XkbIM_LEDDrivesKB (1L << 5) + + /* + * Indicator map component specifications: + * - Used by the 'which_groups' and 'which_mods' fields of an indicator + * map to specify which keyboard components should be used to drive + * the indicator. + */ +#define XkbIM_UseBase (1L << 0) +#define XkbIM_UseLatched (1L << 1) +#define XkbIM_UseLocked (1L << 2) +#define XkbIM_UseEffective (1L << 3) +#define XkbIM_UseCompat (1L << 4) + +#define XkbIM_UseNone 0 +#define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\ + |XkbIM_UseEffective) +#define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat) + + /* + * Compatibility Map Components: + * - Specifies the components to be allocated in XkbAllocCompatMap. + */ +#define XkbSymInterpMask (1<<0) +#define XkbGroupCompatMask (1<<1) +#define XkbAllCompatMask (0x3) + + /* + * Names component mask: + * - Specifies the names to be loaded or changed for the GetNames and + * SetNames requests. + * - Specifies the names that have changed in a NamesNotify event. + * - Specifies the names components to be allocated by XkbAllocNames. + */ +#define XkbKeycodesNameMask (1<<0) +#define XkbGeometryNameMask (1<<1) +#define XkbSymbolsNameMask (1<<2) +#define XkbPhysSymbolsNameMask (1<<3) +#define XkbTypesNameMask (1<<4) +#define XkbCompatNameMask (1<<5) +#define XkbKeyTypeNamesMask (1<<6) +#define XkbKTLevelNamesMask (1<<7) +#define XkbIndicatorNamesMask (1<<8) +#define XkbKeyNamesMask (1<<9) +#define XkbKeyAliasesMask (1<<10) +#define XkbVirtualModNamesMask (1<<11) +#define XkbGroupNamesMask (1<<12) +#define XkbRGNamesMask (1<<13) +#define XkbComponentNamesMask (0x3f) +#define XkbAllNamesMask (0x3fff) + + /* + * GetByName components: + * - Specifies desired or necessary components to GetKbdByName request. + * - Reports the components that were found in a GetKbdByNameReply + */ +#define XkbGBN_TypesMask (1L << 0) +#define XkbGBN_CompatMapMask (1L << 1) +#define XkbGBN_ClientSymbolsMask (1L << 2) +#define XkbGBN_ServerSymbolsMask (1L << 3) +#define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) +#define XkbGBN_IndicatorMapMask (1L << 4) +#define XkbGBN_KeyNamesMask (1L << 5) +#define XkbGBN_GeometryMask (1L << 6) +#define XkbGBN_OtherNamesMask (1L << 7) +#define XkbGBN_AllComponentsMask (0xff) + + /* + * ListComponents flags + */ +#define XkbLC_Hidden (1L << 0) +#define XkbLC_Default (1L << 1) +#define XkbLC_Partial (1L << 2) + +#define XkbLC_AlphanumericKeys (1L << 8) +#define XkbLC_ModifierKeys (1L << 9) +#define XkbLC_KeypadKeys (1L << 10) +#define XkbLC_FunctionKeys (1L << 11) +#define XkbLC_AlternateGroup (1L << 12) + + /* + * X Input Extension Interactions + * - Specifies the possible interactions between XKB and the X input + * extension + * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) + * XKB information about an extension device. + * - Reports the list of supported optional features in the reply to + * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. + * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify + * events to indicate an attempt to use an unsupported feature. + */ +#define XkbXI_KeyboardsMask (1L << 0) +#define XkbXI_ButtonActionsMask (1L << 1) +#define XkbXI_IndicatorNamesMask (1L << 2) +#define XkbXI_IndicatorMapsMask (1L << 3) +#define XkbXI_IndicatorStateMask (1L << 4) +#define XkbXI_UnsupportedFeatureMask (1L << 15) +#define XkbXI_AllFeaturesMask (0x001f) +#define XkbXI_AllDeviceFeaturesMask (0x001e) + +#define XkbXI_IndicatorsMask (0x001c) +#define XkbAllExtensionDeviceEventsMask (0x801f) + + /* + * Per-Client Flags: + * - Specifies flags to be changed by the PerClientFlags request. + */ +#define XkbPCF_DetectableAutoRepeatMask (1L << 0) +#define XkbPCF_GrabsUseXKBStateMask (1L << 1) +#define XkbPCF_AutoResetControlsMask (1L << 2) +#define XkbPCF_LookupStateWhenGrabbed (1L << 3) +#define XkbPCF_SendEventUsesXKBState (1L << 4) +#define XkbPCF_AllFlagsMask (0x1F) + + /* + * Debugging flags and controls + */ +#define XkbDF_DisableLocks (1<<0) + +#endif /* _XKB_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XKBgeom.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBgeom.h new file mode 100644 index 0000000000000000000000000000000000000000..3e1db7b9bbda15f21fcf11f93a029b2ef2eab55a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBgeom.h @@ -0,0 +1,618 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBGEOM_H_ +#define _XKBGEOM_H_ + +#include + +typedef struct _XkbProperty { + char *name; + char *value; +} XkbPropertyRec,*XkbPropertyPtr; + +typedef struct _XkbColor { + unsigned int pixel; + char * spec; +} XkbColorRec,*XkbColorPtr; + +typedef struct _XkbPoint { + short x; + short y; +} XkbPointRec, *XkbPointPtr; + +typedef struct _XkbBounds { + short x1,y1; + short x2,y2; +} XkbBoundsRec, *XkbBoundsPtr; +#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) +#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) + +/* + * In the following structs, this pattern is used for dynamically sized arrays: + * foo is an array for which sz_foo entries are allocated & num_foo are used + */ + +typedef struct _XkbOutline { + unsigned short num_points; + unsigned short sz_points; + unsigned short corner_radius; + XkbPointPtr points; +} XkbOutlineRec, *XkbOutlinePtr; + +typedef struct _XkbShape { + Atom name; + unsigned short num_outlines; + unsigned short sz_outlines; + XkbOutlinePtr outlines; + XkbOutlinePtr approx; + XkbOutlinePtr primary; + XkbBoundsRec bounds; +} XkbShapeRec, *XkbShapePtr; +#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) + +typedef struct _XkbShapeDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; +} XkbShapeDoodadRec, *XkbShapeDoodadPtr; +#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbTextDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + short width; + short height; + unsigned short color_ndx; + char * text; + char * font; +} XkbTextDoodadRec, *XkbTextDoodadPtr; +#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbIndicatorDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short shape_ndx; + unsigned short on_color_ndx; + unsigned short off_color_ndx; +} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; +#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) +#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) +#define XkbSetIndicatorDoodadOnColor(g,d,c) \ + ((d)->on_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadOffColor(g,d,c) \ + ((d)->off_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadShape(g,d,s) \ + ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbLogoDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; + char * logo_name; +} XkbLogoDoodadRec, *XkbLogoDoodadPtr; +#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbAnyDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; +} XkbAnyDoodadRec, *XkbAnyDoodadPtr; + +typedef union _XkbDoodad { + XkbAnyDoodadRec any; + XkbShapeDoodadRec shape; + XkbTextDoodadRec text; + XkbIndicatorDoodadRec indicator; + XkbLogoDoodadRec logo; +} XkbDoodadRec, *XkbDoodadPtr; + +#define XkbUnknownDoodad 0 +#define XkbOutlineDoodad 1 +#define XkbSolidDoodad 2 +#define XkbTextDoodad 3 +#define XkbIndicatorDoodad 4 +#define XkbLogoDoodad 5 + +typedef struct _XkbKey { + XkbKeyNameRec name; + short gap; + unsigned char shape_ndx; + unsigned char color_ndx; +} XkbKeyRec, *XkbKeyPtr; +#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) +#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) +#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) +#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbRow { + short top; + short left; + unsigned short num_keys; + unsigned short sz_keys; + int vertical; + XkbKeyPtr keys; + XkbBoundsRec bounds; +} XkbRowRec, *XkbRowPtr; + +typedef struct _XkbSection { + Atom name; + unsigned char priority; + short top; + short left; + unsigned short width; + unsigned short height; + short angle; + unsigned short num_rows; + unsigned short num_doodads; + unsigned short num_overlays; + unsigned short sz_rows; + unsigned short sz_doodads; + unsigned short sz_overlays; + XkbRowPtr rows; + XkbDoodadPtr doodads; + XkbBoundsRec bounds; + struct _XkbOverlay *overlays; +} XkbSectionRec, *XkbSectionPtr; + +typedef struct _XkbOverlayKey { + XkbKeyNameRec over; + XkbKeyNameRec under; +} XkbOverlayKeyRec,*XkbOverlayKeyPtr; + +typedef struct _XkbOverlayRow { + unsigned short row_under; + unsigned short num_keys; + unsigned short sz_keys; + XkbOverlayKeyPtr keys; +} XkbOverlayRowRec,*XkbOverlayRowPtr; + +typedef struct _XkbOverlay { + Atom name; + XkbSectionPtr section_under; + unsigned short num_rows; + unsigned short sz_rows; + XkbOverlayRowPtr rows; + XkbBoundsPtr bounds; +} XkbOverlayRec,*XkbOverlayPtr; + +typedef struct _XkbGeometry { + Atom name; + unsigned short width_mm; + unsigned short height_mm; + char * label_font; + XkbColorPtr label_color; + XkbColorPtr base_color; + unsigned short sz_properties; + unsigned short sz_colors; + unsigned short sz_shapes; + unsigned short sz_sections; + unsigned short sz_doodads; + unsigned short sz_key_aliases; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; + XkbPropertyPtr properties; + XkbColorPtr colors; + XkbShapePtr shapes; + XkbSectionPtr sections; + XkbDoodadPtr doodads; + XkbKeyAliasPtr key_aliases; +} XkbGeometryRec; +#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) + +#define XkbGeomPropertiesMask (1<<0) +#define XkbGeomColorsMask (1<<1) +#define XkbGeomShapesMask (1<<2) +#define XkbGeomSectionsMask (1<<3) +#define XkbGeomDoodadsMask (1<<4) +#define XkbGeomKeyAliasesMask (1<<5) +#define XkbGeomAllMask (0x3f) + +typedef struct _XkbGeometrySizes { + unsigned int which; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; +} XkbGeometrySizesRec,*XkbGeometrySizesPtr; + +_XFUNCPROTOBEGIN + +extern XkbPropertyPtr +XkbAddGeomProperty( + XkbGeometryPtr /* geom */, + _Xconst char * /* name */, + _Xconst char * /* value */ +); + +extern XkbKeyAliasPtr +XkbAddGeomKeyAlias( + XkbGeometryPtr /* geom */, + _Xconst char * /* alias */, + _Xconst char * /* real */ +); + +extern XkbColorPtr +XkbAddGeomColor( + XkbGeometryPtr /* geom */, + _Xconst char * /* spec */, + unsigned int /* pixel */ +); + +extern XkbOutlinePtr +XkbAddGeomOutline( + XkbShapePtr /* shape */, + int /* sz_points */ +); + +extern XkbShapePtr +XkbAddGeomShape( + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_outlines */ +); + +extern XkbKeyPtr +XkbAddGeomKey( + XkbRowPtr /* row */ +); + +extern XkbRowPtr +XkbAddGeomRow( + XkbSectionPtr /* section */, + int /* sz_keys */ +); + +extern XkbSectionPtr +XkbAddGeomSection( + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_rows */, + int /* sz_doodads */, + int /* sz_overlays */ +); + +extern XkbOverlayPtr +XkbAddGeomOverlay( + XkbSectionPtr /* section */, + Atom /* name */, + int /* sz_rows */ +); + +extern XkbOverlayRowPtr +XkbAddGeomOverlayRow( + XkbOverlayPtr /* overlay */, + int /* row_under */, + int /* sz_keys */ +); + +extern XkbOverlayKeyPtr +XkbAddGeomOverlayKey( + XkbOverlayPtr /* overlay */, + XkbOverlayRowPtr /* row */, + _Xconst char * /* over */, + _Xconst char * /* under */ +); + +extern XkbDoodadPtr +XkbAddGeomDoodad( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + Atom /* name */ +); + + +extern void +XkbFreeGeomKeyAliases( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomColors( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomDoodads( + XkbDoodadPtr /* doodads */, + int /* nDoodads */, + Bool /* freeAll */ +); + + +extern void +XkbFreeGeomProperties( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlayKeys( + XkbOverlayRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlayRows( + XkbOverlayPtr /* overlay */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlays( + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomKeys( + XkbRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomRows( + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomSections( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + + +extern void +XkbFreeGeomPoints( + XkbOutlinePtr /* outline */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOutlines( + XkbShapePtr /* shape */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomShapes( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeometry( + XkbGeometryPtr /* geom */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status +XkbAllocGeomProps( + XkbGeometryPtr /* geom */, + int /* nProps */ +); + +extern Status +XkbAllocGeomKeyAliases( + XkbGeometryPtr /* geom */, + int /* nAliases */ +); + +extern Status +XkbAllocGeomColors( + XkbGeometryPtr /* geom */, + int /* nColors */ +); + +extern Status +XkbAllocGeomShapes( + XkbGeometryPtr /* geom */, + int /* nShapes */ +); + +extern Status +XkbAllocGeomSections( + XkbGeometryPtr /* geom */, + int /* nSections */ +); + +extern Status +XkbAllocGeomOverlays( + XkbSectionPtr /* section */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomOverlayRows( + XkbOverlayPtr /* overlay */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomOverlayKeys( + XkbOverlayRowPtr /* row */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomDoodads( + XkbGeometryPtr /* geom */, + int /* nDoodads */ +); + +extern Status +XkbAllocGeomSectionDoodads( + XkbSectionPtr /* section */, + int /* nDoodads */ +); + +extern Status +XkbAllocGeomOutlines( + XkbShapePtr /* shape */, + int /* nOL */ +); + +extern Status +XkbAllocGeomRows( + XkbSectionPtr /* section */, + int /* nRows */ +); + +extern Status +XkbAllocGeomPoints( + XkbOutlinePtr /* ol */, + int /* nPts */ +); + +extern Status +XkbAllocGeomKeys( + XkbRowPtr /* row */, + int /* nKeys */ +); + +extern Status +XkbAllocGeometry( + XkbDescPtr /* xkb */, + XkbGeometrySizesPtr /* sizes */ +); + +extern Status +XkbSetGeometry( + Display * /* dpy */, + unsigned /* deviceSpec */, + XkbGeometryPtr /* geom */ +); + +extern Bool +XkbComputeShapeTop( + XkbShapePtr /* shape */, + XkbBoundsPtr /* bounds */ +); + +extern Bool +XkbComputeShapeBounds( + XkbShapePtr /* shape */ +); + +extern Bool +XkbComputeRowBounds( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + XkbRowPtr /* row */ +); + +extern Bool +XkbComputeSectionBounds( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */ +); + +extern char * +XkbFindOverlayForKey( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* wanted */, + _Xconst char * /* under */ +); + +extern Status +XkbGetGeometry( + Display * /* dpy */, + XkbDescPtr /* xkb */ +); + +extern Status +XkbGetNamedGeometry( + Display * /* dpy */, + XkbDescPtr /* xkb */, + Atom /* name */ +); + +_XFUNCPROTOEND + +#endif /* _XKBSTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XKBproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBproto.h new file mode 100644 index 0000000000000000000000000000000000000000..6eaec952f59e62db10d25fb643acb2ffb9c014c1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBproto.h @@ -0,0 +1,1282 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBPROTO_H_ +#define _XKBPROTO_H_ + +#include +#include +#include + +#define Window CARD32 +#define Atom CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 + +#define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) + +typedef struct _xkbUseExtension { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBUseExtension */ + CARD16 length; + CARD16 wantedMajor; + CARD16 wantedMinor; +} xkbUseExtensionReq; +#define sz_xkbUseExtensionReq 8 + +typedef struct _xkbUseExtensionReply { + BYTE type; /* X_Reply */ + BOOL supported; + CARD16 sequenceNumber; + CARD32 length; + CARD16 serverMajor; + CARD16 serverMinor; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xkbUseExtensionReply; +#define sz_xkbUseExtensionReply 32 + +typedef struct _xkbSelectEvents { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBSelectEvents */ + CARD16 length; + CARD16 deviceSpec; + CARD16 affectWhich; + CARD16 clear; + CARD16 selectAll; + CARD16 affectMap; + CARD16 map; +} xkbSelectEventsReq; +#define sz_xkbSelectEventsReq 16 + +typedef struct _xkbBell { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBBell */ + CARD16 length; + CARD16 deviceSpec; + CARD16 bellClass; + CARD16 bellID; + INT8 percent; + BOOL forceSound; + BOOL eventOnly; + CARD8 pad1; + INT16 pitch; + INT16 duration; + CARD16 pad2; + Atom name; + Window window; +} xkbBellReq; +#define sz_xkbBellReq 28 + +typedef struct _xkbGetState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetState */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad; +} xkbGetStateReq; +#define sz_xkbGetStateReq 8 + +typedef struct _xkbGetStateReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD8 mods; + CARD8 baseMods; + CARD8 latchedMods; + CARD8 lockedMods; + CARD8 group; + CARD8 lockedGroup; + INT16 baseGroup; + INT16 latchedGroup; + CARD8 compatState; + CARD8 grabMods; + CARD8 compatGrabMods; + CARD8 lookupMods; + CARD8 compatLookupMods; + CARD8 pad1; + CARD16 ptrBtnState; + CARD16 pad2; + CARD32 pad3; +} xkbGetStateReply; +#define sz_xkbGetStateReply 32 + +typedef struct _xkbLatchLockState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBLatchLockState */ + CARD16 length; + CARD16 deviceSpec; + CARD8 affectModLocks; + CARD8 modLocks; + BOOL lockGroup; + CARD8 groupLock; + CARD8 affectModLatches; + CARD8 modLatches; + CARD8 pad; + BOOL latchGroup; + INT16 groupLatch; +} xkbLatchLockStateReq; +#define sz_xkbLatchLockStateReq 16 + +typedef struct _xkbGetControls { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetControls */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad; +} xkbGetControlsReq; +#define sz_xkbGetControlsReq 8 + +typedef struct _xkbGetControlsReply { + BYTE type; /* X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD8 mkDfltBtn; + CARD8 numGroups; + CARD8 groupsWrap; + CARD8 internalMods; + CARD8 ignoreLockMods; + CARD8 internalRealMods; + CARD8 ignoreLockRealMods; + CARD8 pad1; + CARD16 internalVMods; + CARD16 ignoreLockVMods; + CARD16 repeatDelay; + CARD16 repeatInterval; + CARD16 slowKeysDelay; + CARD16 debounceDelay; + CARD16 mkDelay; + CARD16 mkInterval; + CARD16 mkTimeToMax; + CARD16 mkMaxSpeed; + INT16 mkCurve; + CARD16 axOptions; + CARD16 axTimeout; + CARD16 axtOptsMask; + CARD16 axtOptsValues; + CARD16 pad2; + CARD32 axtCtrlsMask; + CARD32 axtCtrlsValues; + CARD32 enabledCtrls; + BYTE perKeyRepeat[XkbPerKeyBitArraySize]; +} xkbGetControlsReply; +#define sz_xkbGetControlsReply 92 + +typedef struct _xkbSetControls { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetControls */ + CARD16 length; + CARD16 deviceSpec; + CARD8 affectInternalMods; + CARD8 internalMods; + CARD8 affectIgnoreLockMods; + CARD8 ignoreLockMods; + CARD16 affectInternalVMods; + CARD16 internalVMods; + CARD16 affectIgnoreLockVMods; + CARD16 ignoreLockVMods; + CARD8 mkDfltBtn; + CARD8 groupsWrap; + CARD16 axOptions; + CARD16 pad1; + CARD32 affectEnabledCtrls; + CARD32 enabledCtrls; + CARD32 changeCtrls; + CARD16 repeatDelay; + CARD16 repeatInterval; + CARD16 slowKeysDelay; + CARD16 debounceDelay; + CARD16 mkDelay; + CARD16 mkInterval; + CARD16 mkTimeToMax; + CARD16 mkMaxSpeed; + INT16 mkCurve; + CARD16 axTimeout; + CARD32 axtCtrlsMask; + CARD32 axtCtrlsValues; + CARD16 axtOptsMask; + CARD16 axtOptsValues; + BYTE perKeyRepeat[XkbPerKeyBitArraySize]; +} xkbSetControlsReq; +#define sz_xkbSetControlsReq 100 + +typedef struct _xkbKTMapEntryWireDesc { + BOOL active; + CARD8 mask; + CARD8 level; + CARD8 realMods; + CARD16 virtualMods; + CARD16 pad; +} xkbKTMapEntryWireDesc; +#define sz_xkbKTMapEntryWireDesc 8 + +typedef struct _xkbKTSetMapEntryWireDesc { + CARD8 level; + CARD8 realMods; + CARD16 virtualMods; +} xkbKTSetMapEntryWireDesc; +#define sz_xkbKTSetMapEntryWireDesc 4 + +typedef struct _xkbModsWireDesc { + CARD8 mask; /* GetMap only */ + CARD8 realMods; + CARD16 virtualMods; +} xkbModsWireDesc; +#define sz_xkbModsWireDesc 4 + +typedef struct _xkbKeyTypeWireDesc { + CARD8 mask; + CARD8 realMods; + CARD16 virtualMods; + CARD8 numLevels; + CARD8 nMapEntries; + BOOL preserve; + CARD8 pad; +} xkbKeyTypeWireDesc; +#define sz_xkbKeyTypeWireDesc 8 + +typedef struct _xkbSymMapWireDesc { + CARD8 ktIndex[XkbNumKbdGroups]; + CARD8 groupInfo; + CARD8 width; + CARD16 nSyms; +} xkbSymMapWireDesc; +#define sz_xkbSymMapWireDesc 8 + +typedef struct _xkbVModMapWireDesc { + KeyCode key; + CARD8 pad; + CARD16 vmods; +} xkbVModMapWireDesc; +#define sz_xkbVModMapWireDesc 4 + +typedef struct _xkbBehaviorWireDesc { + CARD8 key; + CARD8 type; + CARD8 data; + CARD8 pad; +} xkbBehaviorWireDesc; +#define sz_xkbBehaviorWireDesc 4 + +typedef struct _xkbActionWireDesc { + CARD8 type; + CARD8 data[7]; +} xkbActionWireDesc; +#define sz_xkbActionWireDesc 8 + +typedef struct _xkbGetMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetMap */ + CARD16 length; + CARD16 deviceSpec; + CARD16 full; + CARD16 partial; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD16 virtualMods; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD16 pad1; +} xkbGetMapReq; +#define sz_xkbGetMapReq 28 + +typedef struct _xkbGetMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD16 pad1; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD16 present; + CARD8 firstType; + CARD8 nTypes; + CARD8 totalTypes; + KeyCode firstKeySym; + CARD16 totalSyms; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD16 totalActs; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD8 totalKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + CARD8 totalKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + CARD8 totalModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD8 totalVModMapKeys; + CARD8 pad2; + CARD16 virtualMods; +} xkbGetMapReply; +#define sz_xkbGetMapReply 40 + +#define XkbSetMapResizeTypes (1L<<0) +#define XkbSetMapRecomputeActions (1L<<1) +#define XkbSetMapAllFlags (0x3) + +typedef struct _xkbSetMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetMap */ + CARD16 length; + CARD16 deviceSpec; + CARD16 present; + CARD16 flags; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + CARD16 totalSyms; + KeyCode firstKeyAct; + CARD8 nKeyActs; + CARD16 totalActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + CARD8 totalKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + CARD8 totalKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + CARD8 totalModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD8 totalVModMapKeys; + CARD16 virtualMods; +} xkbSetMapReq; +#define sz_xkbSetMapReq 36 + +typedef struct _xkbSymInterpretWireDesc { + CARD32 sym; + CARD8 mods; + CARD8 match; + CARD8 virtualMod; + CARD8 flags; + xkbActionWireDesc act; +} xkbSymInterpretWireDesc; +#define sz_xkbSymInterpretWireDesc 16 + +typedef struct _xkbGetCompatMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetCompatMap */ + CARD16 length; + CARD16 deviceSpec; + CARD8 groups; + BOOL getAllSI; + CARD16 firstSI; + CARD16 nSI; +} xkbGetCompatMapReq; +#define sz_xkbGetCompatMapReq 12 + +typedef struct _xkbGetCompatMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD8 groups; + CARD8 pad1; + CARD16 firstSI; + CARD16 nSI; + CARD16 nTotalSI; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xkbGetCompatMapReply; +#define sz_xkbGetCompatMapReply 32 + +typedef struct _xkbSetCompatMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetCompatMap */ + CARD16 length; + CARD16 deviceSpec; + CARD8 pad1; + BOOL recomputeActions; + BOOL truncateSI; + CARD8 groups; + CARD16 firstSI; + CARD16 nSI; + CARD16 pad2; +} xkbSetCompatMapReq; +#define sz_xkbSetCompatMapReq 16 + +typedef struct _xkbGetIndicatorState { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetIndicatorState */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad1; +} xkbGetIndicatorStateReq; +#define sz_xkbGetIndicatorStateReq 8 + +typedef struct _xkbGetIndicatorStateReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD32 state; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xkbGetIndicatorStateReply; +#define sz_xkbGetIndicatorStateReply 32 + +typedef struct _xkbGetIndicatorMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad; + CARD32 which; +} xkbGetIndicatorMapReq; +#define sz_xkbGetIndicatorMapReq 12 + +typedef struct _xkbGetIndicatorMapReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD32 which; + CARD32 realIndicators; + CARD8 nIndicators; + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xkbGetIndicatorMapReply; +#define sz_xkbGetIndicatorMapReply 32 + +typedef struct _xkbIndicatorMapWireDesc { + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 mods; + CARD8 realMods; + CARD16 virtualMods; + CARD32 ctrls; +} xkbIndicatorMapWireDesc; +#define sz_xkbIndicatorMapWireDesc 12 + +typedef struct _xkbSetIndicatorMap { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad1; + CARD32 which; +} xkbSetIndicatorMapReq; +#define sz_xkbSetIndicatorMapReq 12 + +typedef struct _xkbGetNamedIndicator { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBGetNamedIndicator */ + CARD16 length; + CARD16 deviceSpec; + CARD16 ledClass; + CARD16 ledID; + CARD16 pad1; + Atom indicator; +} xkbGetNamedIndicatorReq; +#define sz_xkbGetNamedIndicatorReq 16 + +typedef struct _xkbGetNamedIndicatorReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber; + CARD32 length; + Atom indicator; + BOOL found; + BOOL on; + BOOL realIndicator; + CARD8 ndx; + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 mods; + CARD8 realMods; + CARD16 virtualMods; + CARD32 ctrls; + BOOL supported; + CARD8 pad1; + CARD16 pad2; +} xkbGetNamedIndicatorReply; +#define sz_xkbGetNamedIndicatorReply 32 + +typedef struct _xkbSetNamedIndicator { + CARD8 reqType; + CARD8 xkbReqType; /* X_KBSetNamedIndicator */ + CARD16 length; + CARD16 deviceSpec; + CARD16 ledClass; + CARD16 ledID; + CARD16 pad1; + Atom indicator; + BOOL setState; + BOOL on; + BOOL setMap; + BOOL createMap; + CARD8 pad2; + CARD8 flags; + CARD8 whichGroups; + CARD8 groups; + CARD8 whichMods; + CARD8 realMods; + CARD16 virtualMods; + CARD32 ctrls; +} xkbSetNamedIndicatorReq; +#define sz_xkbSetNamedIndicatorReq 32 + +typedef struct _xkbGetNames { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetNames */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad; + CARD32 which; +} xkbGetNamesReq; +#define sz_xkbGetNamesReq 12 + +typedef struct _xkbGetNamesReply { + BYTE type; + BYTE deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD32 which; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 nTypes; + CARD8 groupNames; + CARD16 virtualMods; + KeyCode firstKey; + CARD8 nKeys; + CARD32 indicators; + CARD8 nRadioGroups; + CARD8 nKeyAliases; + CARD16 nKTLevels; + CARD32 pad3; +} xkbGetNamesReply; +#define sz_xkbGetNamesReply 32 + +typedef struct _xkbSetNames { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetNames */ + CARD16 length; + CARD16 deviceSpec; + CARD16 virtualMods; + CARD32 which; + CARD8 firstType; + CARD8 nTypes; + CARD8 firstKTLevel; + CARD8 nKTLevels; + CARD32 indicators; + CARD8 groupNames; + CARD8 nRadioGroups; + KeyCode firstKey; + CARD8 nKeys; + CARD8 nKeyAliases; + CARD8 pad1; + CARD16 totalKTLevelNames; +} xkbSetNamesReq; +#define sz_xkbSetNamesReq 28 + +typedef struct _xkbPointWireDesc { + INT16 x; + INT16 y; +} xkbPointWireDesc; +#define sz_xkbPointWireDesc 4 + +typedef struct _xkbOutlineWireDesc { + CARD8 nPoints; + CARD8 cornerRadius; + CARD16 pad; +} xkbOutlineWireDesc; +#define sz_xkbOutlineWireDesc 4 + +typedef struct _xkbShapeWireDesc { + Atom name; + CARD8 nOutlines; + CARD8 primaryNdx; + CARD8 approxNdx; + CARD8 pad; +} xkbShapeWireDesc; +#define sz_xkbShapeWireDesc 8 + +typedef struct _xkbSectionWireDesc { + Atom name; + INT16 top; + INT16 left; + CARD16 width; + CARD16 height; + INT16 angle; + CARD8 priority; + CARD8 nRows; + CARD8 nDoodads; + CARD8 nOverlays; + CARD16 pad; +} xkbSectionWireDesc; +#define sz_xkbSectionWireDesc 20 + +typedef struct _xkbRowWireDesc { + INT16 top; + INT16 left; + CARD8 nKeys; + BOOL vertical; + CARD16 pad; +} xkbRowWireDesc; +#define sz_xkbRowWireDesc 8 + +typedef struct _xkbKeyWireDesc { + CARD8 name[XkbKeyNameLength] _X_NONSTRING; + INT16 gap; + CARD8 shapeNdx; + CARD8 colorNdx; +} xkbKeyWireDesc; +#define sz_xkbKeyWireDesc 8 + +typedef struct _xkbOverlayWireDesc { + Atom name; + CARD8 nRows; + CARD8 pad1; + CARD16 pad2; +} xkbOverlayWireDesc; +#define sz_xkbOverlayWireDesc 8 + +typedef struct _xkbOverlayRowWireDesc { + CARD8 rowUnder; + CARD8 nKeys; + CARD16 pad1; +} xkbOverlayRowWireDesc; +#define sz_xkbOverlayRowWireDesc 4 + +typedef struct _xkbOverlayKeyWireDesc { + CARD8 over[XkbKeyNameLength] _X_NONSTRING; + CARD8 under[XkbKeyNameLength] _X_NONSTRING; +} xkbOverlayKeyWireDesc; +#define sz_xkbOverlayKeyWireDesc 8 + +typedef struct _xkbShapeDoodadWireDesc { + Atom name; + CARD8 type; + CARD8 priority; + INT16 top; + INT16 left; + INT16 angle; + CARD8 colorNdx; + CARD8 shapeNdx; + CARD16 pad1; + CARD32 pad2; +} xkbShapeDoodadWireDesc; +#define sz_xkbShapeDoodadWireDesc 20 + +typedef struct _xkbTextDoodadWireDesc { + Atom name; + CARD8 type; + CARD8 priority; + INT16 top; + INT16 left; + INT16 angle; + CARD16 width; + CARD16 height; + CARD8 colorNdx; + CARD8 pad1; + CARD16 pad2; +} xkbTextDoodadWireDesc; +#define sz_xkbTextDoodadWireDesc 20 + +typedef struct _xkbIndicatorDoodadWireDesc { + Atom name; + CARD8 type; + CARD8 priority; + INT16 top; + INT16 left; + INT16 angle; + CARD8 shapeNdx; + CARD8 onColorNdx; + CARD8 offColorNdx; + CARD8 pad1; + CARD32 pad2; +} xkbIndicatorDoodadWireDesc; +#define sz_xkbIndicatorDoodadWireDesc 20 + +typedef struct _xkbLogoDoodadWireDesc { + Atom name; + CARD8 type; + CARD8 priority; + INT16 top; + INT16 left; + INT16 angle; + CARD8 colorNdx; + CARD8 shapeNdx; + CARD16 pad1; + CARD32 pad2; +} xkbLogoDoodadWireDesc; +#define sz_xkbLogoDoodadWireDesc 20 + +typedef struct _xkbAnyDoodadWireDesc { + Atom name; + CARD8 type; + CARD8 priority; + INT16 top; + INT16 left; + INT16 angle; + CARD32 pad2; + CARD32 pad3; +} xkbAnyDoodadWireDesc; +#define sz_xkbAnyDoodadWireDesc 20 + +typedef union _xkbDoodadWireDesc { + xkbAnyDoodadWireDesc any; + xkbShapeDoodadWireDesc shape; + xkbTextDoodadWireDesc text; + xkbIndicatorDoodadWireDesc indicator; + xkbLogoDoodadWireDesc logo; +} xkbDoodadWireDesc; +#define sz_xkbDoodadWireDesc 20 + +typedef struct _xkbGetGeometry { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetGeometry */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad; + Atom name; +} xkbGetGeometryReq; +#define sz_xkbGetGeometryReq 12 + +typedef struct _xkbGetGeometryReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + Atom name; + BOOL found; + CARD8 pad; + CARD16 widthMM; + CARD16 heightMM; + CARD16 nProperties; + CARD16 nColors; + CARD16 nShapes; + CARD16 nSections; + CARD16 nDoodads; + CARD16 nKeyAliases; + CARD8 baseColorNdx; + CARD8 labelColorNdx; +} xkbGetGeometryReply; +#define sz_xkbGetGeometryReply 32 + +typedef struct _xkbSetGeometry { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetGeometry */ + CARD16 length; + CARD16 deviceSpec; + CARD8 nShapes; + CARD8 nSections; + Atom name; + CARD16 widthMM; + CARD16 heightMM; + CARD16 nProperties; + CARD16 nColors; + CARD16 nDoodads; + CARD16 nKeyAliases; + CARD8 baseColorNdx; + CARD8 labelColorNdx; + CARD16 pad; +} xkbSetGeometryReq; +#define sz_xkbSetGeometryReq 28 + +typedef struct _xkbPerClientFlags { + CARD8 reqType; + CARD8 xkbReqType;/* always X_KBPerClientFlags */ + CARD16 length; + CARD16 deviceSpec; + CARD16 pad1; + CARD32 change; + CARD32 value; + CARD32 ctrlsToChange; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} xkbPerClientFlagsReq; +#define sz_xkbPerClientFlagsReq 28 + +typedef struct _xkbPerClientFlagsReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD32 supported; + CARD32 value; + CARD32 autoCtrls; + CARD32 autoCtrlValues; + CARD32 pad1; + CARD32 pad2; +} xkbPerClientFlagsReply; +#define sz_xkbPerClientFlagsReply 32 + +typedef struct _xkbListComponents { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBListComponents */ + CARD16 length; + CARD16 deviceSpec; + CARD16 maxNames; +} xkbListComponentsReq; +#define sz_xkbListComponentsReq 8 + +typedef struct _xkbListComponentsReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD16 nKeymaps; + CARD16 nKeycodes; + CARD16 nTypes; + CARD16 nCompatMaps; + CARD16 nSymbols; + CARD16 nGeometries; + CARD16 extra; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; +} xkbListComponentsReply; +#define sz_xkbListComponentsReply 32 + +typedef struct _xkbGetKbdByName { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetKbdByName */ + CARD16 length; + CARD16 deviceSpec; + CARD16 need; /* combination of XkbGBN_* */ + CARD16 want; /* combination of XkbGBN_* */ + BOOL load; + CARD8 pad; +} xkbGetKbdByNameReq; +#define sz_xkbGetKbdByNameReq 12 + +typedef struct _xkbGetKbdByNameReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + KeyCode minKeyCode; + KeyCode maxKeyCode; + BOOL loaded; + BOOL newKeyboard; + CARD16 found; /* combination of XkbGBN_* */ + CARD16 reported; /* combination of XkbAllComponents */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xkbGetKbdByNameReply; +#define sz_xkbGetKbdByNameReply 32 + +typedef struct _xkbDeviceLedsWireDesc { + CARD16 ledClass; + CARD16 ledID; + CARD32 namesPresent; + CARD32 mapsPresent; + CARD32 physIndicators; + CARD32 state; +} xkbDeviceLedsWireDesc; +#define sz_xkbDeviceLedsWireDesc 20 + +typedef struct _xkbGetDeviceInfo { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ + CARD16 length; + CARD16 deviceSpec; + CARD16 wanted; + BOOL allBtns; + CARD8 firstBtn; + CARD8 nBtns; + CARD8 pad; + CARD16 ledClass; + CARD16 ledID; +} xkbGetDeviceInfoReq; +#define sz_xkbGetDeviceInfoReq 16 + +typedef struct _xkbGetDeviceInfoReply { + CARD8 type; /* always X_Reply */ + CARD8 deviceID; + CARD16 sequenceNumber; + CARD32 length; + CARD16 present; + CARD16 supported; + CARD16 unsupported; + CARD16 nDeviceLedFBs; + CARD8 firstBtnWanted; + CARD8 nBtnsWanted; + CARD8 firstBtnRtrn; + CARD8 nBtnsRtrn; + CARD8 totalBtns; + BOOL hasOwnState; + CARD16 dfltKbdFB; + CARD16 dfltLedFB; + CARD16 pad; + Atom devType; +} xkbGetDeviceInfoReply; +#define sz_xkbGetDeviceInfoReply 32 + +typedef struct _xkbSetDeviceInfo { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ + CARD16 length; + CARD16 deviceSpec; + CARD8 firstBtn; + CARD8 nBtns; + CARD16 change; + CARD16 nDeviceLedFBs; +} xkbSetDeviceInfoReq; +#define sz_xkbSetDeviceInfoReq 12 + +typedef struct _xkbSetDebuggingFlags { + CARD8 reqType; + CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ + CARD16 length; + CARD16 msgLength; + CARD16 pad; + CARD32 affectFlags; + CARD32 flags; + CARD32 affectCtrls; + CARD32 ctrls; +} xkbSetDebuggingFlagsReq; +#define sz_xkbSetDebuggingFlagsReq 24 + +typedef struct _xkbSetDebuggingFlagsReply { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 currentFlags; + CARD32 currentCtrls; + CARD32 supportedFlags; + CARD32 supportedCtrls; + CARD32 pad1; + CARD32 pad2; +} xkbSetDebuggingFlagsReply; +#define sz_xkbSetDebuggingFlagsReply 32 + + /* + * X KEYBOARD EXTENSION EVENT STRUCTURES + */ + +typedef struct _xkbAnyEvent { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xkbAnyEvent; +#define sz_xkbAnyEvent 32 + +typedef struct _xkbNewKeyboardNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 oldDeviceID; + KeyCode minKeyCode; + KeyCode maxKeyCode; + KeyCode oldMinKeyCode; + KeyCode oldMaxKeyCode; + CARD8 requestMajor; + CARD8 requestMinor; + CARD16 changed; + CARD8 detail; + CARD8 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xkbNewKeyboardNotify; +#define sz_xkbNewKeyboardNotify 32 + +typedef struct _xkbMapNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 ptrBtnActions; + CARD16 changed; + KeyCode minKeyCode; + KeyCode maxKeyCode; + CARD8 firstType; + CARD8 nTypes; + KeyCode firstKeySym; + CARD8 nKeySyms; + KeyCode firstKeyAct; + CARD8 nKeyActs; + KeyCode firstKeyBehavior; + CARD8 nKeyBehaviors; + KeyCode firstKeyExplicit; + CARD8 nKeyExplicit; + KeyCode firstModMapKey; + CARD8 nModMapKeys; + KeyCode firstVModMapKey; + CARD8 nVModMapKeys; + CARD16 virtualMods; + CARD16 pad1; +} xkbMapNotify; +#define sz_xkbMapNotify 32 + +typedef struct _xkbStateNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 mods; + CARD8 baseMods; + CARD8 latchedMods; + CARD8 lockedMods; + CARD8 group; + INT16 baseGroup; + INT16 latchedGroup; + CARD8 lockedGroup; + CARD8 compatState; + CARD8 grabMods; + CARD8 compatGrabMods; + CARD8 lookupMods; + CARD8 compatLookupMods; + CARD16 ptrBtnState; + CARD16 changed; + KeyCode keycode; + CARD8 eventType; + CARD8 requestMajor; + CARD8 requestMinor; +} xkbStateNotify; +#define sz_xkbStateNotify 32 + +typedef struct _xkbControlsNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 numGroups; + CARD16 pad1; + CARD32 changedControls; + CARD32 enabledControls; + CARD32 enabledControlChanges; + KeyCode keycode; + CARD8 eventType; + CARD8 requestMajor; + CARD8 requestMinor; + CARD32 pad2; +} xkbControlsNotify; +#define sz_xkbControlsNotify 32 + +typedef struct _xkbIndicatorNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 pad1; + CARD16 pad2; + CARD32 state; + CARD32 changed; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xkbIndicatorNotify; +#define sz_xkbIndicatorNotify 32 + +typedef struct _xkbNamesNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 pad1; + CARD16 changed; + CARD8 firstType; + CARD8 nTypes; + CARD8 firstLevelName; + CARD8 nLevelNames; + CARD8 pad2; + CARD8 nRadioGroups; + CARD8 nAliases; + CARD8 changedGroupNames; + CARD16 changedVirtualMods; + CARD8 firstKey; + CARD8 nKeys; + CARD32 changedIndicators; + CARD32 pad3; +} xkbNamesNotify; +#define sz_xkbNamesNotify 32 + +typedef struct _xkbCompatMapNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 changedGroups; + CARD16 firstSI; + CARD16 nSI; + CARD16 nTotalSI; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xkbCompatMapNotify; +#define sz_xkbCompatMapNotify 32 + +typedef struct _xkbBellNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 bellClass; + CARD8 bellID; + CARD8 percent; + CARD16 pitch; + CARD16 duration; + Atom name; + Window window; + BOOL eventOnly; + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; +} xkbBellNotify; +#define sz_xkbBellNotify 32 + +typedef struct _xkbActionMessage { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + KeyCode keycode; + BOOL press; + BOOL keyEventFollows; + CARD8 mods; + CARD8 group; + CARD8 message[8]; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; +} xkbActionMessage; +#define sz_xkbActionMessage 32 + +typedef struct _xkbAccessXNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + KeyCode keycode; + CARD16 detail; + CARD16 slowKeysDelay; + CARD16 debounceDelay; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xkbAccessXNotify; +#define sz_xkbAccessXNotify 32 + +typedef struct _xkbExtensionDeviceNotify { + BYTE type; + BYTE xkbType; + CARD16 sequenceNumber; + Time time; + CARD8 deviceID; + CARD8 pad1; + CARD16 reason; + CARD16 ledClass; + CARD16 ledID; + CARD32 ledsDefined; + CARD32 ledState; + CARD8 firstBtn; + CARD8 nBtns; + CARD16 supported; + CARD16 unsupported; + CARD16 pad3; +} xkbExtensionDeviceNotify; +#define sz_xkbExtensionDeviceNotify 32 + +typedef struct _xkbEvent { + union { + xkbAnyEvent any; + xkbNewKeyboardNotify new_kbd; + xkbMapNotify map; + xkbStateNotify state; + xkbControlsNotify ctrls; + xkbIndicatorNotify indicators; + xkbNamesNotify names; + xkbCompatMapNotify compat; + xkbBellNotify bell; + xkbActionMessage message; + xkbAccessXNotify accessx; + xkbExtensionDeviceNotify device; + } u; +} xkbEvent; +#define sz_xkbEvent 32 + +#undef Window +#undef Atom +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _XKBPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XKBsrv.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBsrv.h new file mode 100644 index 0000000000000000000000000000000000000000..deb71976f3e7eb39462690cf3559cb82c064de9e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBsrv.h @@ -0,0 +1,1184 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#ifdef XKB_IN_SERVER +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbAddKeyType SrvXkbAddKeyType +#define XkbCopyKeyType SrvXkbCopyKeyType +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeControls SrvXkbFreeControls +#define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo +#define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo +#define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo +#define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges +#define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods +#define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods +#endif + +#include +#include +#include "inputstr.h" + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +typedef struct +{ + ProcessInputProc processInputProc; + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xkbDeviceInfoRec, *xkbDeviceInfoPtr; + +#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ + device->public.processInputProc = oldprocs->processInputProc; \ + device->public.realInputProc = oldprocs->realInputProc; \ + device->unwrapProc = oldprocs->unwrapProc; + +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) + +/***====================================================================***/ + + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern int XkbReqCode; +extern int XkbEventBase; +extern int XkbKeyboardErrorCode; +extern int XkbDisableLockActions; +extern char * XkbBaseDirectory; +extern char * XkbBinDirectory; +extern char * XkbInitialMap; +extern int _XkbClientMajor; +extern int _XkbClientMinor; +extern unsigned int XkbXIUnsupported; + +extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; +extern Bool noXkbExtension; +extern Bool XkbWantRulesProp; + +extern pointer XkbLastRepeatEvent; + +extern CARD32 xkbDebugFlags; +extern CARD32 xkbDebugCtrls; + +#define _XkbAlloc(s) xalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n)*(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbFree(p) Xfree(p) + +#define _XkbLibError(c,l,d) \ + { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern int DeviceKeyPress,DeviceKeyRelease; +extern int DeviceButtonPress,DeviceButtonRelease; + +#ifdef XINPUT +#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) +#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) +#else +#define _XkbIsPressEvent(t) ((t)==KeyPress) +#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) +#endif + +#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ + ((k)<=(c)->curKeySyms.maxKeyCode)) +#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ + (c)->curKeySyms.minKeyCode+1) + +#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#undef IsKeypadKey +#define IsKeypadKey(s) XkbKSIsKeypad(s) + +typedef int Status; +typedef pointer XPointer; +typedef struct _XDisplay Display; + +#ifndef True +#define True 1 +#define False 0 +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +_XFUNCPROTOBEGIN + +extern void XkbUseMsg( + void +); + +extern int XkbProcessArguments( + int /* argc */, + char ** /* argv */, + int /* i */ +); + +extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern DeviceIntPtr _XkbLookupAnyDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupKeyboard( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupBellDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupLedDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupButtonDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern Status XkbCopyKeyType( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern void XkbSetActionKeyMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +); + +extern Bool XkbCheckActionVMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern Bool XkbApplyVModChanges( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* changed */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyVModChangesToAllDevices( + DeviceIntPtr /* dev */, + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbEventCausePtr /* cause */ +); + +extern unsigned int XkbMaskForVMask( + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +); + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +); + +extern unsigned int XkbAdjustGroup( + int /* group */, + XkbControlsPtr /* ctrls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern void XkbUpdateKeyTypesFromCore( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +); + +extern void XkbUpdateDescActions( + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +); + +extern void XkbUpdateActions( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateCoreDescription( + DeviceIntPtr /* keybd */, + Bool /* resize */ +); + +extern void XkbApplyMappingChange( + DeviceIntPtr /* pXDev */, + CARD8 /* request */, + KeyCode /* firstKey */, + CARD8 /* num */, + ClientPtr /* client */ +); + +extern void XkbSetIndicators( + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +); + +extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +); + +extern void XkbApplyLedNameChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedMapChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedStateChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateLedAutoState( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* maps_to_check */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbFlushLedEvents( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateAllDeviceIndicators( + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern unsigned int XkbIndicatorsToUpdate( + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +); + +extern void XkbComputeDerivedState( + XkbSrvInfoPtr /* xkbi */ +); + +extern void XkbCheckSecondaryEffects( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbCheckIndicatorMaps( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +); + +extern unsigned int XkbStateChangedFlags( + XkbStatePtr /* old */, + XkbStatePtr /* new */ +); + +extern void XkbSendStateNotify( + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +); + +extern void XkbSendMapNotify( + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +); + +extern int XkbComputeControlsNotify( + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +); + +extern void XkbSendControlsNotify( + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +); + +extern void XkbSendCompatMapNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbSendIndicatorNotify( + DeviceIntPtr /* kbd */, + int /* xkbType */, + xkbIndicatorNotify * /* ev */ +); + +extern void XkbHandleBell( + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +); + +extern void XkbSendAccessXNotify( + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +); + +extern void XkbSendNamesNotify( + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +); + +extern void XkbSendCompatNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbSendActionMessage( + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +); + +extern void XkbSendExtensionDeviceNotify( + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +); + +extern void XkbSendNotification( + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern void XkbProcessKeyboardEvent( + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void XkbProcessOtherEvent( + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void XkbHandleActions( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + struct _xEvent * /* xE */, + int /* count */ +); + +extern Bool XkbEnableDisableControls( + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void AccessXInit( + DeviceIntPtr /* dev */ +); + +extern Bool AccessXFilterPressEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern Bool AccessXFilterReleaseEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void AccessXCancelRepeatKey( + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +); + +extern void AccessXComputeCurveFactor( + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +); + +extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledId */ +); + +extern XkbDeviceInfoPtr XkbAllocDeviceInfo( + unsigned int /* deviceSpec */, + unsigned int /* nButtons */, + unsigned int /* szLeds */ +); + +extern void XkbFreeDeviceInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* which */, + Bool /* freeDevI */ +); + +extern Status XkbResizeDeviceButtonActions( + XkbDeviceInfoPtr /* devi */, + unsigned int /* newTotal */ +); + +extern XkbInterestPtr XkbFindClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern XkbInterestPtr XkbAddClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +); + +extern int XkbRemoveClient( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern int XkbRemoveResourceClient( + DevicePtr /* inDev */, + XID /* id */ +); + +extern int XkbDDXInitDevice( + DeviceIntPtr /* dev */ +); + +extern int XkbDDXAccessXBeep( + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +); + +extern void XkbDDXKeyClick( + DeviceIntPtr /* dev */, + int /* keycode */, + int /* synthetic */ +); + +extern int XkbDDXUsesSoftRepeat( + DeviceIntPtr /* dev */ +); + +extern void XkbDDXKeybdCtrlProc( + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +); + +extern void XkbDDXChangeControls( + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +); + +extern void XkbDDXUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* newState */ +); + +extern void XkbDDXUpdateDeviceIndicators( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +); + +extern void XkbDDXFakePointerButton( + int /* event */, + int /* button */ +); + +extern void XkbDDXFakePointerMotion( + unsigned int /* flags */, + int /* x */, + int /* y */ +); + +extern void XkbDDXFakeDeviceButton( + DeviceIntPtr /* dev */, + Bool /* press */, + int /* button */ +); + +extern int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXSwitchScreen( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXPrivate( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern void XkbDisableComputedAutoRepeats( + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +); + +extern void XkbSetRepeatKeys( + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +); + +extern int XkbLatchModifiers( + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +); + +extern int XkbLatchGroup( + DeviceIntPtr /* pXDev */, + int /* group */ +); + +extern void XkbClearAllLatchesAndLocks( + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +); + +extern void XkbSetRulesDflts( + char * /* rulesFile */, + char * /* model */, + char * /* layout */, + char * /* variant */, + char * /* options */ +); + +extern void XkbInitDevice( + DeviceIntPtr /* pXDev */ +); + +extern Bool XkbInitKeyboardDeviceStruct( + DeviceIntPtr /* pXDev */, + XkbComponentNamesPtr /* pNames */, + KeySymsPtr /* pSyms */, + CARD8 /* pMods */[], + BellProcPtr /* bellProc */, + KbdCtrlProcPtr /* ctrlProc */ +); + +extern int SProcXkbDispatch( + ClientPtr /* client */ +); + +extern XkbGeometryPtr XkbLookupNamedGeometry( + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +); + +extern char * _XkbDupString( + char * /* str */ +); + +extern void XkbConvertCase( + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +extern int XkbFinishDeviceInit( + DeviceIntPtr /* pXDev */ +); + +extern void XkbFreeSrvLedInfo( + XkbSrvLedInfoPtr /* sli */ +); + +extern void XkbFreeInfo( + XkbSrvInfoPtr /* xkbi */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* nGroups */, + unsigned int /* groups */, + int * /* newTypesIn */, + XkbMapChangesPtr /* changes */ +); + +extern XkbKeyTypePtr XkbAddKeyType( + XkbDescPtr /* xkb */, + Atom /* name */, + int /* map_count */, + Bool /* want_preserve */, + int /* num_lvls */ +); + +extern Status XkbInitCanonicalKeyTypes( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* keypadVMod */ +); + +extern int XkbKeyTypesForCoreSymbols( + XkbDescPtr /* xkb */, + int /* map_width */, + KeySym * /* core_syms */, + unsigned int /* protected */, + int * /* types_inout */, + KeySym * /* xkb_syms_rtrn */ +); + +extern Bool XkbApplyCompatMapToKey( + XkbDescPtr /* xkb */, + KeyCode /* key */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbUpdateMapFromCore( + XkbDescPtr /* xkb */, + KeyCode /* first_key */, + int /* num_keys */, + int /* map_width */, + KeySym * /* core_keysyms */, + XkbChangesPtr /* changes */ +); + +extern void XkbFreeControls( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern void XkbFreeIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbUpdateActionVirtualMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern void XkbUpdateKeyTypeVirtualMods( + XkbDescPtr /* xkb */, + XkbKeyTypePtr /* type */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern void XkbSendNewKeyboardNotify( + DeviceIntPtr /* kbd */, + xkbNewKeyboardNotify * /* pNKN */ +); + +#ifdef XKBSRV_NEED_FILE_FUNCS + +#include +#include +#include + +#define _XkbListKeymaps 0 +#define _XkbListKeycodes 1 +#define _XkbListTypes 2 +#define _XkbListCompat 3 +#define _XkbListSymbols 4 +#define _XkbListGeometry 5 +#define _XkbListNumComponents 6 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +char * +XkbGetRulesDflts( + XkbRF_VarDefsPtr /* defs */ +); + +extern void XkbSetRulesUsed( + XkbRF_VarDefsPtr /* defs */ +); + + +extern Status XkbDDXList( + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +); + +extern unsigned int XkbDDXLoadKeymapByNames( + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbFileInfoPtr /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +); + +extern Bool XkbDDXNamesFromRules( + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +); + +extern FILE *XkbDDXOpenConfigFile( + char * /* mapName */, + char * /* fileNameRtrn */, + int /* fileNameRtrnLen */ +); + +extern Bool XkbDDXApplyConfig( + XPointer /* cfg_in */, + XkbSrvInfoPtr /* xkbi */ +); + +extern XPointer XkbDDXPreloadConfig( + char ** /* rulesFileRtrn */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */, + DeviceIntPtr /* dev */ +); + +extern int _XkbStrCaseCmp( + char * /* str1 */, + char * /* str2 */ +); + +#endif /* XKBSRV_NEED_FILE_FUNCS */ + + +_XFUNCPROTOEND + +#define XkbAtomGetString(d,s) NameForAtom(s) + +#endif /* _XKBSRV_H_ */ + + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XKBstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBstr.h new file mode 100644 index 0000000000000000000000000000000000000000..eaefae8220de72a391a05f41980fac34b9194547 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XKBstr.h @@ -0,0 +1,643 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSTR_H_ +#define _XKBSTR_H_ + +#include +#include + +#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) +#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) +#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) + +/* + * The Xkb structs are full of implicit padding to properly align members. + * We can't clean that up without breaking ABI, so tell clang not to bother + * complaining about it. + */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + + /* + * Common data structures and access macros + */ + +typedef struct _XkbStateRec { + unsigned char group; + unsigned char locked_group; + unsigned short base_group; + unsigned short latched_group; + unsigned char mods; + unsigned char base_mods; + unsigned char latched_mods; + unsigned char locked_mods; + unsigned char compat_state; + unsigned char grab_mods; + unsigned char compat_grab_mods; + unsigned char lookup_mods; + unsigned char compat_lookup_mods; + unsigned short ptr_buttons; +} XkbStateRec,*XkbStatePtr; +#define XkbModLocks(s) ((s)->locked_mods) +#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) +#define XkbGroupLock(s) ((s)->locked_group) +#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) +#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) +#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) + +typedef struct _XkbMods { + unsigned char mask; /* effective mods */ + unsigned char real_mods; + unsigned short vmods; +} XkbModsRec,*XkbModsPtr; + +typedef struct _XkbKTMapEntry { + Bool active; + unsigned char level; + XkbModsRec mods; +} XkbKTMapEntryRec,*XkbKTMapEntryPtr; + +typedef struct _XkbKeyType { + XkbModsRec mods; + unsigned char num_levels; + unsigned char map_count; + /* map is an array of map_count XkbKTMapEntryRec structs */ + XkbKTMapEntryPtr map; + /* preserve is an array of map_count XkbModsRec structs */ + XkbModsPtr preserve; + Atom name; + /* level_names is an array of num_levels Atoms */ + Atom * level_names; +} XkbKeyTypeRec, *XkbKeyTypePtr; + +#define XkbNumGroups(g) ((g)&0x0f) +#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) +#define XkbOutOfRangeGroupAction(g) ((g)&0xc0) +#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) +#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) +#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) + + /* + * Structures and access macros used primarily by the server + */ + +typedef struct _XkbBehavior { + unsigned char type; + unsigned char data; +} XkbBehavior; + +#define XkbAnyActionDataSize 7 +typedef struct _XkbAnyAction { + unsigned char type; + unsigned char data[XkbAnyActionDataSize]; +} XkbAnyAction; + +typedef struct _XkbModAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + unsigned char vmods1; + unsigned char vmods2; +} XkbModAction; +#define XkbModActionVMods(a) \ + ((short)(((a)->vmods1<<8)|((a)->vmods2))) +#define XkbSetModActionVMods(a,v) \ + (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) + +typedef struct _XkbGroupAction { + unsigned char type; + unsigned char flags; + char group_XXX; +} XkbGroupAction; +#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) +#define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) + +typedef struct _XkbISOAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + char group_XXX; + unsigned char affect; + unsigned char vmods1; + unsigned char vmods2; +} XkbISOAction; + +typedef struct _XkbPtrAction { + unsigned char type; + unsigned char flags; + unsigned char high_XXX; + unsigned char low_XXX; + unsigned char high_YYY; + unsigned char low_YYY; +} XkbPtrAction; +#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) +#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) +#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) +#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) + +typedef struct _XkbPtrBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; +} XkbPtrBtnAction; + +typedef struct _XkbPtrDfltAction { + unsigned char type; + unsigned char flags; + unsigned char affect; + char valueXXX; +} XkbPtrDfltAction; +#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) +#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) + +typedef struct _XkbSwitchScreenAction { + unsigned char type; + unsigned char flags; + char screenXXX; +} XkbSwitchScreenAction; +#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) +#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) + +typedef struct _XkbCtrlsAction { + unsigned char type; + unsigned char flags; + unsigned char ctrls3; + unsigned char ctrls2; + unsigned char ctrls1; + unsigned char ctrls0; +} XkbCtrlsAction; +#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ + ((a)->ctrls2=(((c)>>16)&0xff)),\ + ((a)->ctrls1=(((c)>>8)&0xff)),\ + ((a)->ctrls0=((c)&0xff))) +#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ + (((unsigned int)(a)->ctrls2)<<16)|\ + (((unsigned int)(a)->ctrls1)<<8)|\ + ((unsigned int)((a)->ctrls0))) + +typedef struct _XkbMessageAction { + unsigned char type; + unsigned char flags; + unsigned char message[6]; +} XkbMessageAction; + +typedef struct _XkbRedirectKeyAction { + unsigned char type; + unsigned char new_key; + unsigned char mods_mask; + unsigned char mods; + unsigned char vmods_mask0; + unsigned char vmods_mask1; + unsigned char vmods0; + unsigned char vmods1; +} XkbRedirectKeyAction; + +#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ + ((unsigned int)(a)->vmods0)) +#define XkbSARedirectSetVMods(a,m) (((a)->vmods1=(((m)>>8)&0xff)),\ + ((a)->vmods0=((m)&0xff))) +#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ + ((unsigned int)(a)->vmods_mask0)) +#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ + ((a)->vmods_mask0=((m)&0xff))) + +typedef struct _XkbDeviceBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; + unsigned char device; +} XkbDeviceBtnAction; + +typedef struct _XkbDeviceValuatorAction { + unsigned char type; + unsigned char device; + unsigned char v1_what; + unsigned char v1_ndx; + unsigned char v1_value; + unsigned char v2_what; + unsigned char v2_ndx; + unsigned char v2_value; +} XkbDeviceValuatorAction; + +typedef union _XkbAction { + XkbAnyAction any; + XkbModAction mods; + XkbGroupAction group; + XkbISOAction iso; + XkbPtrAction ptr; + XkbPtrBtnAction btn; + XkbPtrDfltAction dflt; + XkbSwitchScreenAction screen; + XkbCtrlsAction ctrls; + XkbMessageAction msg; + XkbRedirectKeyAction redirect; + XkbDeviceBtnAction devbtn; + XkbDeviceValuatorAction devval; + unsigned char type; +} XkbAction; + +typedef struct _XkbControls { + unsigned char mk_dflt_btn; + unsigned char num_groups; + unsigned char groups_wrap; + XkbModsRec internal; + XkbModsRec ignore_lock; + unsigned int enabled_ctrls; + unsigned short repeat_delay; + unsigned short repeat_interval; + unsigned short slow_keys_delay; + unsigned short debounce_delay; + unsigned short mk_delay; + unsigned short mk_interval; + unsigned short mk_time_to_max; + unsigned short mk_max_speed; + short mk_curve; + unsigned short ax_options; + unsigned short ax_timeout; + unsigned short axt_opts_mask; + unsigned short axt_opts_values; + unsigned int axt_ctrls_mask; + unsigned int axt_ctrls_values; + unsigned char per_key_repeat[XkbPerKeyBitArraySize]; +} XkbControlsRec, *XkbControlsPtr; + +#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) +#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) +#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) + +typedef struct _XkbServerMapRec { + /* acts is an array of XkbActions structs, with size_acts entries + allocated, and num_acts entries used. */ + unsigned short num_acts; + unsigned short size_acts; + XkbAction *acts; + + /* behaviors, key_acts, explicit, & vmodmap are all arrays with + (xkb->max_key_code + 1) entries allocated for each. */ + XkbBehavior *behaviors; + unsigned short *key_acts; +#if defined(__cplusplus) || defined(c_plusplus) + /* explicit is a C++ reserved word */ + unsigned char *c_explicit; +#else + unsigned char *explicit; +#endif + unsigned char vmods[XkbNumVirtualMods]; + unsigned short *vmodmap; +} XkbServerMapRec, *XkbServerMapPtr; + +#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) + + /* + * Structures and access macros used primarily by clients + */ + +typedef struct _XkbSymMapRec { + unsigned char kt_index[XkbNumKbdGroups]; + unsigned char group_info; + unsigned char width; + unsigned short offset; +} XkbSymMapRec, *XkbSymMapPtr; + +typedef struct _XkbClientMapRec { + /* types is an array of XkbKeyTypeRec structs, with size_types entries + allocated, and num_types entries used. */ + unsigned char size_types; + unsigned char num_types; + XkbKeyTypePtr types; + + /* syms is an array of size_syms KeySyms, in which num_syms are used */ + unsigned short size_syms; + unsigned short num_syms; + KeySym *syms; + /* key_sym_map is an array of (max_key_code + 1) XkbSymMapRec structs */ + XkbSymMapPtr key_sym_map; + + /* modmap is an array of (max_key_code + 1) unsigned chars */ + unsigned char *modmap; +} XkbClientMapRec, *XkbClientMapPtr; + +#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) +#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) +#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) +#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) +#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) +#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) +#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) +#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) +#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) + + /* + * Compatibility structures and access macros + */ + +typedef struct _XkbSymInterpretRec { + KeySym sym; + unsigned char flags; + unsigned char match; + unsigned char mods; + unsigned char virtual_mod; + XkbAnyAction act; +} XkbSymInterpretRec,*XkbSymInterpretPtr; + +typedef struct _XkbCompatMapRec { + /* sym_interpret is an array of XkbSymInterpretRec structs, + in which size_si are allocated & num_si are used. */ + XkbSymInterpretPtr sym_interpret; + XkbModsRec groups[XkbNumKbdGroups]; + unsigned short num_si; + unsigned short size_si; +} XkbCompatMapRec, *XkbCompatMapPtr; + +typedef struct _XkbIndicatorMapRec { + unsigned char flags; + unsigned char which_groups; + unsigned char groups; + unsigned char which_mods; + XkbModsRec mods; + unsigned int ctrls; +} XkbIndicatorMapRec, *XkbIndicatorMapPtr; + +#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ + (((i)->which_groups&&(i)->groups)||\ + ((i)->which_mods&&(i)->mods.mask)||\ + ((i)->ctrls))) +#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ + ((i)->which_mods)||((i)->ctrls)) + + +typedef struct _XkbIndicatorRec { + unsigned long phys_indicators; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbIndicatorRec,*XkbIndicatorPtr; + +typedef struct _XkbKeyNameRec { + char name[XkbKeyNameLength] _X_NONSTRING; +} XkbKeyNameRec,*XkbKeyNamePtr; + +typedef struct _XkbKeyAliasRec { + char real[XkbKeyNameLength] _X_NONSTRING; + char alias[XkbKeyNameLength] _X_NONSTRING; +} XkbKeyAliasRec,*XkbKeyAliasPtr; + + /* + * Names for everything + */ +typedef struct _XkbNamesRec { + Atom keycodes; + Atom geometry; + Atom symbols; + Atom types; + Atom compat; + Atom vmods[XkbNumVirtualMods]; + Atom indicators[XkbNumIndicators]; + Atom groups[XkbNumKbdGroups]; + /* keys is an array of (xkb->max_key_code + 1) XkbKeyNameRec entries */ + XkbKeyNamePtr keys; + /* key_aliases is an array of num_key_aliases XkbKeyAliasRec entries */ + XkbKeyAliasPtr key_aliases; + /* radio_groups is an array of num_rg Atoms */ + Atom *radio_groups; + Atom phys_symbols; + + /* num_keys seems to be unused in libX11 */ + unsigned char num_keys; + unsigned char num_key_aliases; + unsigned short num_rg; +} XkbNamesRec,*XkbNamesPtr; + +typedef struct _XkbGeometry *XkbGeometryPtr; + /* + * Tie it all together into one big keyboard description + */ +typedef struct _XkbDesc { + struct _XDisplay * dpy; + unsigned short flags; + unsigned short device_spec; + KeyCode min_key_code; + KeyCode max_key_code; + + XkbControlsPtr ctrls; + XkbServerMapPtr server; + XkbClientMapPtr map; + XkbIndicatorPtr indicators; + XkbNamesPtr names; + XkbCompatMapPtr compat; + XkbGeometryPtr geom; +} XkbDescRec, *XkbDescPtr; +#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) +#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) +#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) +#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) +#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) +#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) +#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) +#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) +#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) +#define XkbKeySymEntry(d,k,sl,g) \ + (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) +#define XkbKeyAction(d,k,n) \ + (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) +#define XkbKeyActionEntry(d,k,sl,g) \ + (XkbKeyHasActions(d,k)?\ + XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) + +#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) +#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) +#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) +#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ + ((k)<=(d)->max_key_code)) +#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) + + + /* + * The following structures can be used to track changes + * to a keyboard device + */ +typedef struct _XkbMapChanges { + unsigned short changed; + KeyCode min_key_code; + KeyCode max_key_code; + unsigned char first_type; + unsigned char num_types; + KeyCode first_key_sym; + unsigned char num_key_syms; + KeyCode first_key_act; + unsigned char num_key_acts; + KeyCode first_key_behavior; + unsigned char num_key_behaviors; + KeyCode first_key_explicit; + unsigned char num_key_explicit; + KeyCode first_modmap_key; + unsigned char num_modmap_keys; + KeyCode first_vmodmap_key; + unsigned char num_vmodmap_keys; + unsigned char pad; + unsigned short vmods; +} XkbMapChangesRec,*XkbMapChangesPtr; + +typedef struct _XkbControlsChanges { + unsigned int changed_ctrls; + unsigned int enabled_ctrls_changes; + Bool num_groups_changed; +} XkbControlsChangesRec,*XkbControlsChangesPtr; + +typedef struct _XkbIndicatorChanges { + unsigned int state_changes; + unsigned int map_changes; +} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; + +typedef struct _XkbNameChanges { + unsigned int changed; + unsigned char first_type; + unsigned char num_types; + unsigned char first_lvl; + unsigned char num_lvls; + unsigned char num_aliases; + unsigned char num_rg; + unsigned char first_key; + unsigned char num_keys; + unsigned short changed_vmods; + unsigned long changed_indicators; + unsigned char changed_groups; +} XkbNameChangesRec,*XkbNameChangesPtr; + +typedef struct _XkbCompatChanges { + unsigned char changed_groups; + unsigned short first_si; + unsigned short num_si; +} XkbCompatChangesRec,*XkbCompatChangesPtr; + +typedef struct _XkbChanges { + unsigned short device_spec; + unsigned short state_changes; + XkbMapChangesRec map; + XkbControlsChangesRec ctrls; + XkbIndicatorChangesRec indicators; + XkbNameChangesRec names; + XkbCompatChangesRec compat; +} XkbChangesRec, *XkbChangesPtr; + + /* + * These data structures are used to construct a keymap from + * a set of components or to list components in the server + * database. + */ +typedef struct _XkbComponentNames { + char * keymap; + char * keycodes; + char * types; + char * compat; + char * symbols; + char * geometry; +} XkbComponentNamesRec, *XkbComponentNamesPtr; + +typedef struct _XkbComponentName { + unsigned short flags; + char * name; +} XkbComponentNameRec,*XkbComponentNamePtr; + +typedef struct _XkbComponentList { + int num_keymaps; + int num_keycodes; + int num_types; + int num_compat; + int num_symbols; + int num_geometry; + XkbComponentNamePtr keymaps; + XkbComponentNamePtr keycodes; + XkbComponentNamePtr types; + XkbComponentNamePtr compat; + XkbComponentNamePtr symbols; + XkbComponentNamePtr geometry; +} XkbComponentListRec, *XkbComponentListPtr; + + /* + * The following data structures describe and track changes to a + * non-keyboard extension device + */ +typedef struct _XkbDeviceLedInfo { + unsigned short led_class; + unsigned short led_id; + unsigned int phys_indicators; + unsigned int maps_present; + unsigned int names_present; + unsigned int state; + Atom names[XkbNumIndicators]; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; + +typedef struct _XkbDeviceInfo { + char * name; + Atom type; + unsigned short device_spec; + Bool has_own_state; + unsigned short supported; + unsigned short unsupported; + + /* btn_acts is an array of num_btn XkbAction entries */ + unsigned short num_btns; + XkbAction * btn_acts; + + unsigned short sz_leds; + unsigned short num_leds; + unsigned short dflt_kbd_fb; + unsigned short dflt_led_fb; + /* leds is an array of XkbDeviceLedInfoRec in which + sz_leds entries are allocated and num_leds entries are used */ + XkbDeviceLedInfoPtr leds; +} XkbDeviceInfoRec,*XkbDeviceInfoPtr; + +#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) +#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) +#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) + +typedef struct _XkbDeviceLedChanges { + unsigned short led_class; + unsigned short led_id; + unsigned int defined; /* names or maps changed */ + struct _XkbDeviceLedChanges *next; +} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; + +typedef struct _XkbDeviceChanges { + unsigned int changed; + unsigned short first_btn; + unsigned short num_btns; + XkbDeviceLedChangesRec leds; +} XkbDeviceChangesRec,*XkbDeviceChangesPtr; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif /* _XKBSTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XLbx.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XLbx.h new file mode 100644 index 0000000000000000000000000000000000000000..1af4f9ce2cd6e4e9b8b95acfba3056fa0fd46cab --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XLbx.h @@ -0,0 +1,50 @@ +/* + * Copyright 1992 Network Computing Devices + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of NCD. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. NCD. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifndef _XLBX_H_ +#define _XLBX_H_ + +#include +#include +#include +#include + +_XFUNCPROTOBEGIN + +Bool XLbxQueryExtension( + Display* /* dpy */, + int* /* requestp */, + int* /* event_basep */, + int* /* error_basep */ +); + +Bool XLbxQueryVersion( + Display* /* dpy */, + int* /* majorVersion */, + int* /* minorVersion */ +); + +int XLbxGetEventBase(Display *dpy); + +_XFUNCPROTOEND + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XResproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XResproto.h new file mode 100644 index 0000000000000000000000000000000000000000..74cc87672438d0becdc73cf7e2d67517351bc333 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XResproto.h @@ -0,0 +1,227 @@ +/* + Copyright (c) 2002 XFree86 Inc +*/ + +#ifndef _XRESPROTO_H +#define _XRESPROTO_H + +#define XRES_MAJOR_VERSION 1 +#define XRES_MINOR_VERSION 2 + +#define XRES_NAME "X-Resource" + +/* v1.0 */ +#define X_XResQueryVersion 0 +#define X_XResQueryClients 1 +#define X_XResQueryClientResources 2 +#define X_XResQueryClientPixmapBytes 3 + +/* Version 1.1 has been accidentally released from the version */ +/* control and while it doesn't have differences to version 1.0, the */ +/* next version is labeled 1.2 in order to remove the risk of confusion. */ + +/* v1.2 */ +#define X_XResQueryClientIds 4 +#define X_XResQueryResourceBytes 5 + +typedef struct { + CARD32 resource_base; + CARD32 resource_mask; +} xXResClient; +#define sz_xXResClient 8 + +typedef struct { + CARD32 resource_type; + CARD32 count; +} xXResType; +#define sz_xXResType 8 + +/* XResQueryVersion */ + +typedef struct _XResQueryVersion { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; + CARD8 client_major; + CARD8 client_minor; + CARD16 unused; +} xXResQueryVersionReq; +#define sz_xXResQueryVersionReq 8 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 server_major; + CARD16 server_minor; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXResQueryVersionReply; +#define sz_xXResQueryVersionReply 32 + +/* XResQueryClients */ + +typedef struct _XResQueryClients { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; +} xXResQueryClientsReq; +#define sz_xXResQueryClientsReq 4 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_clients; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXResQueryClientsReply; +#define sz_xXResQueryClientsReply 32 + +/* XResQueryClientResources */ + +typedef struct _XResQueryClientResources { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; + CARD32 xid; +} xXResQueryClientResourcesReq; +#define sz_xXResQueryClientResourcesReq 8 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_types; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXResQueryClientResourcesReply; +#define sz_xXResQueryClientResourcesReply 32 + +/* XResQueryClientPixmapBytes */ + +typedef struct _XResQueryClientPixmapBytes { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; + CARD32 xid; +} xXResQueryClientPixmapBytesReq; +#define sz_xXResQueryClientPixmapBytesReq 8 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 bytes; + CARD32 bytes_overflow; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXResQueryClientPixmapBytesReply; +#define sz_xXResQueryClientPixmapBytesReply 32 + +/* v1.2 XResQueryClientIds */ + +#define X_XResClientXIDMask 0x01 +#define X_XResLocalClientPIDMask 0x02 + +typedef struct _XResClientIdSpec { + CARD32 client; + CARD32 mask; +} xXResClientIdSpec; +#define sz_xXResClientIdSpec 8 + +typedef struct _XResClientIdValue { + xXResClientIdSpec spec; + CARD32 length; + // followed by length CARD32s +} xXResClientIdValue; +#define sz_xResClientIdValue (sz_xXResClientIdSpec + 4) + +typedef struct _XResQueryClientIds { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; + CARD32 numSpecs; + // followed by numSpecs times XResClientIdSpec +} xXResQueryClientIdsReq; +#define sz_xXResQueryClientIdsReq 8 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numIds; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + // followed by numIds times XResClientIdValue +} xXResQueryClientIdsReply; +#define sz_xXResQueryClientIdsReply 32 + +/* v1.2 XResQueryResourceBytes */ + +typedef struct _XResResourceIdSpec { + CARD32 resource; + CARD32 type; +} xXResResourceIdSpec; +#define sz_xXResResourceIdSpec 8 + +typedef struct _XResQueryResourceBytes { + CARD8 reqType; + CARD8 XResReqType; + CARD16 length; + CARD32 client; + CARD32 numSpecs; + // followed by numSpecs times XResResourceIdSpec +} xXResQueryResourceBytesReq; +#define sz_xXResQueryResourceBytesReq 12 + +typedef struct _XResResourceSizeSpec { + xXResResourceIdSpec spec; + CARD32 bytes; + CARD32 refCount; + CARD32 useCount; +} xXResResourceSizeSpec; +#define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12) + +typedef struct _XResResourceSizeValue { + xXResResourceSizeSpec size; + CARD32 numCrossReferences; + // followed by numCrossReferences times XResResourceSizeSpec +} xXResResourceSizeValue; +#define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4) + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numSizes; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + // followed by numSizes times XResResourceSizeValue +} xXResQueryResourceBytesReply; +#define sz_xXResQueryResourceBytesReply 32 + +#endif /* _XRESPROTO_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XShm.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XShm.h new file mode 100644 index 0000000000000000000000000000000000000000..b64346a147cea376a843d215ac798cee40e50896 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XShm.h @@ -0,0 +1,135 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _XSHM_H_ +#define _XSHM_H_ + +#include +#include + +#ifndef _XSHM_SERVER_ +typedef unsigned long ShmSeg; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; /* drawable of request */ + int major_code; /* ShmReqCode */ + int minor_code; /* X_ShmPutImage */ + ShmSeg shmseg; /* the ShmSeg used in the request */ + unsigned long offset; /* the offset into ShmSeg used in the request */ +} XShmCompletionEvent; + +typedef struct { + ShmSeg shmseg; /* resource id */ + int shmid; /* kernel id */ + char *shmaddr; /* address in client */ + Bool readOnly; /* how the server should attach it */ +} XShmSegmentInfo; + +_XFUNCPROTOBEGIN + +Bool XShmQueryExtension( + Display* /* dpy */ +); + +int XShmGetEventBase( + Display* /* dpy */ +); + +Bool XShmQueryVersion( + Display* /* dpy */, + int* /* majorVersion */, + int* /* minorVersion */, + Bool* /* sharedPixmaps */ +); + +int XShmPixmapFormat( + Display* /* dpy */ +); + +Bool XShmAttach( + Display* /* dpy */, + XShmSegmentInfo* /* shminfo */ +); + +Bool XShmDetach( + Display* /* dpy */, + XShmSegmentInfo* /* shminfo */ +); + +Bool XShmPutImage( + Display* /* dpy */, + Drawable /* d */, + GC /* gc */, + XImage* /* image */, + int /* src_x */, + int /* src_y */, + int /* dst_x */, + int /* dst_y */, + unsigned int /* src_width */, + unsigned int /* src_height */, + Bool /* send_event */ +); + +Bool XShmGetImage( + Display* /* dpy */, + Drawable /* d */, + XImage* /* image */, + int /* x */, + int /* y */, + unsigned long /* plane_mask */ +); + +XImage *XShmCreateImage( + Display* /* dpy */, + Visual* /* visual */, + unsigned int /* depth */, + int /* format */, + char* /* data */, + XShmSegmentInfo* /* shminfo */, + unsigned int /* width */, + unsigned int /* height */ +); + +Pixmap XShmCreatePixmap( + Display* /* dpy */, + Drawable /* d */, + char* /* data */, + XShmSegmentInfo* /* shminfo */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* depth */ +); + +_XFUNCPROTOEND +#endif /* _XSHM_SERVER_ */ + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xag.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xag.h new file mode 100644 index 0000000000000000000000000000000000000000..9f69f7875a0083f582ef96232b068c801b5971bf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xag.h @@ -0,0 +1,90 @@ +/* +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _XAG_H_ +#define _XAG_H_ + +#include +#include + +#include + +_XFUNCPROTOBEGIN + +typedef XID XAppGroup; + +Bool XagQueryVersion( + Display* /* dpy */, + int* /* major_version */, + int* /* minor_version */ +); + +Status XagCreateEmbeddedApplicationGroup( + Display* /* dpy */, + VisualID /* root_visual */, + Colormap /* default_colormap */, + unsigned long /* black_pixel */, + unsigned long /* white_pixel */, + XAppGroup* /* app_group_return */ +); + +Status XagCreateNonembeddedApplicationGroup( + Display* /* dpy */, + XAppGroup* /* app_group_return */ +); + +Status XagDestroyApplicationGroup( + Display* /* dpy */, + XAppGroup /* app_group */ +); + +Status XagGetApplicationGroupAttributes( + Display* /* dpy */, + XAppGroup /* app_group */, + ... +); + +Status XagQueryApplicationGroup( + Display* /* dpy */, + XID /* resource_base */, + XAppGroup* /* app_group_ret */ +); + +Status XagCreateAssociation( + Display* /* dpy */, + Window* /* window_ret */, + void* /* system_window */ +); + +Status XagDestroyAssociation( + Display* /* dpy */, + Window /* window */ +); + +_XFUNCPROTOEND + +#endif /* _XAG_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xcup.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xcup.h new file mode 100644 index 0000000000000000000000000000000000000000..c8074cf3d877efd7fcdc078d0c7cbfbf4302af5c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xcup.h @@ -0,0 +1,58 @@ +/* + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XCUP_H_ +#define _XCUP_H_ + +#include +#include + +_XFUNCPROTOBEGIN + +Bool XcupQueryVersion( + Display* /* dpy */, + int* /* major_version */, + int* /* minor_version */ +); + +Status XcupGetReservedColormapEntries( + Display* /* dpy */, + int /* screen */, + XColor** /* colors_out */, + int* /* ncolors */ +); + +Status XcupStoreColors( + Display* /* dpy */, + Colormap /* colormap */, + XColor* /* colors */, + int /* ncolors */ +); + +_XFUNCPROTOEND + +#endif /* _XCUP_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xdbe.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xdbe.h new file mode 100644 index 0000000000000000000000000000000000000000..5c842a445a2bb797149272aeb728a0c01e2b631d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xdbe.h @@ -0,0 +1,138 @@ +/****************************************************************************** + * + * Copyright (c) 1994, 1995 Hewlett-Packard Company + * + * 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 HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Hewlett-Packard + * Company shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Hewlett-Packard Company. + * + * Header file for Xlib-related DBE + * + *****************************************************************************/ + +#ifndef XDBE_H +#define XDBE_H + +#include +#include + +typedef struct +{ + VisualID visual; /* one visual ID that supports double-buffering */ + int depth; /* depth of visual in bits */ + int perflevel; /* performance level of visual */ +} +XdbeVisualInfo; + +typedef struct +{ + int count; /* number of items in visual_depth */ + XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ +} +XdbeScreenVisualInfo; + + +typedef Drawable XdbeBackBuffer; + +typedef unsigned char XdbeSwapAction; + +typedef struct +{ + Window swap_window; /* window for which to swap buffers */ + XdbeSwapAction swap_action; /* swap action to use for swap_window */ +} +XdbeSwapInfo; + +typedef struct +{ + Window window; /* window that buffer belongs to */ +} +XdbeBackBufferAttributes; + +typedef struct +{ + int type; + Display *display; /* display the event was read from */ + XdbeBackBuffer buffer; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XdbeBadBuffer */ + unsigned char request_code; /* major opcode of failed request */ + unsigned char minor_code; /* minor opcode of failed request */ +} +XdbeBufferError; + +/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops + * (for non-C++ builds) in X11/Xfuncproto.h. + */ +_XFUNCPROTOBEGIN + +extern Status XdbeQueryExtension( + Display* /* dpy */, + int* /* major_version_return */, + int* /* minor_version_return */ +); + +extern XdbeBackBuffer XdbeAllocateBackBufferName( + Display* /* dpy */, + Window /* window */, + XdbeSwapAction /* swap_action */ +); + +extern Status XdbeDeallocateBackBufferName( + Display* /* dpy */, + XdbeBackBuffer /* buffer */ +); + +extern Status XdbeSwapBuffers( + Display* /* dpy */, + XdbeSwapInfo* /* swap_info */, + int /* num_windows */ +); + +extern Status XdbeBeginIdiom( + Display* /* dpy */ +); + +extern Status XdbeEndIdiom( + Display* /* dpy */ +); + +extern XdbeScreenVisualInfo *XdbeGetVisualInfo( + Display* /* dpy */, + Drawable* /* screen_specifiers */, + int* /* num_screens */ +); + +extern void XdbeFreeVisualInfo( + XdbeScreenVisualInfo* /* visual_info */ +); + +extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( + Display* /* dpy */, + XdbeBackBuffer /* buffer */ +); + +_XFUNCPROTOEND + +#endif /* XDBE_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xext.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xext.h new file mode 100644 index 0000000000000000000000000000000000000000..858592b78baedb2764d06b3a29268d9b15580e29 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xext.h @@ -0,0 +1,53 @@ +/* + * +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + */ + +#ifndef _XEXT_H_ +#define _XEXT_H_ + +#include + +_XFUNCPROTOBEGIN + +typedef int (*XextErrorHandler) ( + Display * /* dpy */, + _Xconst char* /* ext_name */, + _Xconst char* /* reason */ +); + +extern XextErrorHandler XSetExtensionErrorHandler( + XextErrorHandler /* handler */ +); + +extern int XMissingExtension( + Display* /* dpy */, + _Xconst char* /* ext_name */ +); + +_XFUNCPROTOEND + +#define X_EXTENSION_UNKNOWN "unknown" +#define X_EXTENSION_MISSING "missing" + +#endif /* _XEXT_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xfixes.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xfixes.h new file mode 100644 index 0000000000000000000000000000000000000000..41083c97579d16226dc86e9f8c9f1cd6c8bf2098 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xfixes.h @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. + * Copyright 2011, 2021 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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. + */ +/* + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XFIXES_H_ +#define _XFIXES_H_ + +#include + +#include +#include + +/* + * This revision number also appears in configure.ac, they have + * to be manually synchronized + */ +#define XFIXES_REVISION 1 +#define XFIXES_VERSION ((XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + (XFIXES_REVISION)) + +typedef struct { + int type; /* event base */ + unsigned long serial; + Bool send_event; + Display *display; + Window window; + int subtype; + Window owner; + Atom selection; + Time timestamp; + Time selection_timestamp; +} XFixesSelectionNotifyEvent; + +typedef struct { + int type; /* event base */ + unsigned long serial; + Bool send_event; + Display *display; + Window window; + int subtype; + unsigned long cursor_serial; + Time timestamp; + Atom cursor_name; +} XFixesCursorNotifyEvent; + +typedef struct { + short x, y; + unsigned short width, height; + unsigned short xhot, yhot; + unsigned long cursor_serial; + unsigned long *pixels; +#if XFIXES_MAJOR >= 2 + Atom atom; /* Version >= 2 only */ + const char *name; /* Version >= 2 only */ +#endif +} XFixesCursorImage; + +#if XFIXES_MAJOR >= 2 +/* Version 2 types */ + +typedef XID XserverRegion; + +typedef struct { + short x, y; + unsigned short width, height; + unsigned short xhot, yhot; + unsigned long cursor_serial; + unsigned long *pixels; + Atom atom; + const char *name; +} XFixesCursorImageAndName; + +#endif + +_XFUNCPROTOBEGIN + +Bool XFixesQueryExtension (Display *dpy, + int *event_base_return, + int *error_base_return); +Status XFixesQueryVersion (Display *dpy, + int *major_version_return, + int *minor_version_return); + +int XFixesVersion (void); + +void +XFixesChangeSaveSet (Display *dpy, + Window win, + int mode, + int target, + int map); + +void +XFixesSelectSelectionInput (Display *dpy, + Window win, + Atom selection, + unsigned long eventMask); + +void +XFixesSelectCursorInput (Display *dpy, + Window win, + unsigned long eventMask); + +XFixesCursorImage * +XFixesGetCursorImage (Display *dpy); + +#if XFIXES_MAJOR >= 2 +/* Version 2 functions */ + +XserverRegion +XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles); + +XserverRegion +XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap); + +XserverRegion +XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind); + +XserverRegion +XFixesCreateRegionFromGC (Display *dpy, GC gc); + +XserverRegion +XFixesCreateRegionFromPicture (Display *dpy, XID picture); + +void +XFixesDestroyRegion (Display *dpy, XserverRegion region); + +void +XFixesSetRegion (Display *dpy, XserverRegion region, + XRectangle *rectangles, int nrectangles); + +void +XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src); + +void +XFixesUnionRegion (Display *dpy, XserverRegion dst, + XserverRegion src1, XserverRegion src2); + +void +XFixesIntersectRegion (Display *dpy, XserverRegion dst, + XserverRegion src1, XserverRegion src2); + +void +XFixesSubtractRegion (Display *dpy, XserverRegion dst, + XserverRegion src1, XserverRegion src2); + +void +XFixesInvertRegion (Display *dpy, XserverRegion dst, + XRectangle *rect, XserverRegion src); + +void +XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy); + +void +XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src); + +XRectangle * +XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet); + +XRectangle * +XFixesFetchRegionAndBounds (Display *dpy, XserverRegion region, + int *nrectanglesRet, + XRectangle *bounds); + +void +XFixesSetGCClipRegion (Display *dpy, GC gc, + int clip_x_origin, int clip_y_origin, + XserverRegion region); + +void +XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind, + int x_off, int y_off, XserverRegion region); + +void +XFixesSetPictureClipRegion (Display *dpy, XID picture, + int clip_x_origin, int clip_y_origin, + XserverRegion region); + +void +XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name); + +const char * +XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom); + +void +XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination); + +void +XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name); + +#endif /* XFIXES_MAJOR >= 2 */ + +#if XFIXES_MAJOR >= 3 + +void +XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src, + unsigned left, unsigned right, + unsigned top, unsigned bottom); + +#endif /* XFIXES_MAJOR >= 3 */ + +#if XFIXES_MAJOR >= 4 +/* Version 4.0 externs */ + +void +XFixesHideCursor (Display *dpy, Window win); + +void +XFixesShowCursor (Display *dpy, Window win); + +#endif /* XFIXES_MAJOR >= 4 */ + +#if XFIXES_MAJOR >= 5 + +typedef XID PointerBarrier; + +PointerBarrier +XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1, + int x2, int y2, int directions, + int num_devices, int *devices); + +void +XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b); + +#endif /* XFIXES_MAJOR >= 5 */ + +#if XFIXES_MAJOR >= 6 + +void +XFixesSetClientDisconnectMode(Display *dpy, int disconnect_mode); + +int +XFixesGetClientDisconnectMode(Display *dpy); + +#endif /* XFIXES_MAJOR >= 6 */ + +_XFUNCPROTOEND + +#endif /* _XFIXES_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xge.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xge.h new file mode 100644 index 0000000000000000000000000000000000000000..84af716416f17c9596bbf4012005a6d4f71fa9fe --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xge.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2007-2008 Peter Hutterer + * + * 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 (including the next + * paragraph) 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. + * + * Authors: Peter Hutterer, University of South Australia, NICTA + * + */ + + +/* XGE Client interfaces */ + +#ifndef _XGE_H_ +#define _XGE_H_ + +#include +#include + +_XFUNCPROTOBEGIN + +/** + * Generic Event mask. + * To be used whenever a list of masks per extension has to be provided. + * + * But, don't actually use the CARD{8,16,32} types. We can't get them them + * defined here without polluting the namespace. + */ +typedef struct { + unsigned char extension; + unsigned char pad0; + unsigned short pad1; + unsigned int evmask; +} XGenericEventMask; + +Bool XGEQueryExtension(Display* dpy, int *event_basep, int *err_basep); +Bool XGEQueryVersion(Display* dpy, int *major, int* minor); + +_XFUNCPROTOEND + +#endif /* _XGE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xv.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xv.h new file mode 100644 index 0000000000000000000000000000000000000000..f662df6aeb7e4522e3a743680e40a7285440302a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xv.h @@ -0,0 +1,128 @@ +/*********************************************************** +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef XV_H +#define XV_H +/* +** File: +** +** Xv.h --- Xv shared library and server header file +** +** Author: +** +** David Carver (Digital Workstation Engineering/Project Athena) +** +** Revisions: +** +** 05.15.91 Carver +** - version 2.0 upgrade +** +** 01.24.91 Carver +** - version 1.4 upgrade +** +*/ + +#include + +#define XvName "XVideo" +#define XvVersion 2 +#define XvRevision 2 + +/* Symbols */ + +typedef XID XvPortID; +typedef XID XvEncodingID; + +#define XvNone 0 + +#define XvInput 0 +#define XvOutput 1 + +#define XvInputMask (1< +#include + +#define XvMCName "XVideo-MotionCompensation" +#define XvMCNumEvents 0 +#define XvMCNumErrors 3 +#define XvMCVersion 1 +#define XvMCRevision 1 + +#define XvMCBadContext 0 +#define XvMCBadSurface 1 +#define XvMCBadSubpicture 2 + +/* Chroma formats */ +#define XVMC_CHROMA_FORMAT_420 0x00000001 +#define XVMC_CHROMA_FORMAT_422 0x00000002 +#define XVMC_CHROMA_FORMAT_444 0x00000003 + +/* XvMCSurfaceInfo Flags */ +#define XVMC_OVERLAID_SURFACE 0x00000001 +#define XVMC_BACKEND_SUBPICTURE 0x00000002 +#define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004 +#define XVMC_INTRA_UNSIGNED 0x00000008 + +/* Motion Compensation types */ +#define XVMC_MOCOMP 0x00000000 +#define XVMC_IDCT 0x00010000 + +#define XVMC_MPEG_1 0x00000001 +#define XVMC_MPEG_2 0x00000002 +#define XVMC_H263 0x00000003 +#define XVMC_MPEG_4 0x00000004 + +#define XVMC_MB_TYPE_MOTION_FORWARD 0x02 +#define XVMC_MB_TYPE_MOTION_BACKWARD 0x04 +#define XVMC_MB_TYPE_PATTERN 0x08 +#define XVMC_MB_TYPE_INTRA 0x10 + +#define XVMC_PREDICTION_FIELD 0x01 +#define XVMC_PREDICTION_FRAME 0x02 +#define XVMC_PREDICTION_DUAL_PRIME 0x03 +#define XVMC_PREDICTION_16x8 0x02 +#define XVMC_PREDICTION_4MV 0x04 + +#define XVMC_SELECT_FIRST_FORWARD 0x01 +#define XVMC_SELECT_FIRST_BACKWARD 0x02 +#define XVMC_SELECT_SECOND_FORWARD 0x04 +#define XVMC_SELECT_SECOND_BACKWARD 0x08 + +#define XVMC_DCT_TYPE_FRAME 0x00 +#define XVMC_DCT_TYPE_FIELD 0x01 + +#define XVMC_TOP_FIELD 0x00000001 +#define XVMC_BOTTOM_FIELD 0x00000002 +#define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD) + +#define XVMC_SECOND_FIELD 0x00000004 + +#define XVMC_DIRECT 0x00000001 + +#define XVMC_RENDERING 0x00000001 +#define XVMC_DISPLAYING 0x00000002 + + +typedef struct { + int surface_type_id; + int chroma_format; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; +} XvMCSurfaceInfo; + +typedef struct { + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + XvPortID port; + int flags; + void * privData; /* private to the library */ +} XvMCContext; + +typedef struct { + XID surface_id; + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + void *privData; /* private to the library */ +} XvMCSurface; + +typedef struct { + XID subpicture_id; + XID context_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + void *privData; /* private to the library */ +} XvMCSubpicture; + +typedef struct { + unsigned int num_blocks; + XID context_id; + void *privData; + short *blocks; +} XvMCBlockArray; + +typedef struct { + unsigned short x; + unsigned short y; + unsigned char macroblock_type; + unsigned char motion_type; + unsigned char motion_vertical_field_select; + unsigned char dct_type; + short PMV[2][2][2]; + unsigned int index; + unsigned short coded_block_pattern; + unsigned short pad0; +} XvMCMacroBlock; + + +typedef struct { + unsigned int num_blocks; + XID context_id; + void *privData; + XvMCMacroBlock *macro_blocks; +} XvMCMacroBlockArray; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/XvMCproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/XvMCproto.h new file mode 100644 index 0000000000000000000000000000000000000000..d3b017114d5e61064d3a5af1cebb9cb3a21f9bd2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/XvMCproto.h @@ -0,0 +1,226 @@ +#ifndef _XVMCPROTO_H_ +#define _XVMCPROTO_H_ + +#define xvmc_QueryVersion 0 +#define xvmc_ListSurfaceTypes 1 +#define xvmc_CreateContext 2 +#define xvmc_DestroyContext 3 +#define xvmc_CreateSurface 4 +#define xvmc_DestroySurface 5 +#define xvmc_CreateSubpicture 6 +#define xvmc_DestroySubpicture 7 +#define xvmc_ListSubpictureTypes 8 +#define xvmc_GetDRInfo 9 +#define xvmc_LastRequest xvmc_GetDRInfo + +#define xvmcNumRequest (xvmc_LastRequest + 1) + + +typedef struct { + CARD32 surface_type_id; + CARD16 chroma_format; + CARD16 pad0; + CARD16 max_width; + CARD16 max_height; + CARD16 subpicture_max_width; + CARD16 subpicture_max_height; + CARD32 mc_type; + CARD32 flags; +} xvmcSurfaceInfo; +#define sz_xvmcSurfaceInfo 24 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; +} xvmcQueryVersionReq; +#define sz_xvmcQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 major; + CARD32 minor; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; +} xvmcQueryVersionReply; +#define sz_xvmcQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 port; +} xvmcListSurfaceTypesReq; +#define sz_xvmcListSurfaceTypesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num; + CARD32 padl3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; +} xvmcListSurfaceTypesReply; +#define sz_xvmcListSurfaceTypesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 context_id; + CARD32 port; + CARD32 surface_type_id; + CARD16 width; + CARD16 height; + CARD32 flags; +} xvmcCreateContextReq; +#define sz_xvmcCreateContextReq 24 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 width_actual; + CARD16 height_actual; + CARD32 flags_return; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; +} xvmcCreateContextReply; +#define sz_xvmcCreateContextReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 context_id; +} xvmcDestroyContextReq; +#define sz_xvmcDestroyContextReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 surface_id; + CARD32 context_id; +} xvmcCreateSurfaceReq; +#define sz_xvmcCreateSurfaceReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 padl2; + CARD32 padl3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; +} xvmcCreateSurfaceReply; +#define sz_xvmcCreateSurfaceReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 surface_id; +} xvmcDestroySurfaceReq; +#define sz_xvmcDestroySurfaceReq 8 + + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 subpicture_id; + CARD32 context_id; + CARD32 xvimage_id; + CARD16 width; + CARD16 height; +} xvmcCreateSubpictureReq; +#define sz_xvmcCreateSubpictureReq 20 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 width_actual; + CARD16 height_actual; + CARD16 num_palette_entries; + CARD16 entry_bytes; + CARD8 component_order[4]; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; +} xvmcCreateSubpictureReply; +#define sz_xvmcCreateSubpictureReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 subpicture_id; +} xvmcDestroySubpictureReq; +#define sz_xvmcDestroySubpictureReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 port; + CARD32 surface_type_id; +} xvmcListSubpictureTypesReq; +#define sz_xvmcListSubpictureTypesReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num; + CARD32 padl2; + CARD32 padl3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; +} xvmcListSubpictureTypesReply; +#define sz_xvmcListSubpictureTypesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length; + CARD32 port; + CARD32 shmKey; + CARD32 magic; +} xvmcGetDRInfoReq; +#define sz_xvmcGetDRInfoReq 16 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 major; + CARD32 minor; + CARD32 patchLevel; + CARD32 nameLen; + CARD32 busIDLen; + CARD32 isLocal; +} xvmcGetDRInfoReply; +#define sz_xvmcGetDRInfoReply 32 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/Xvproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/Xvproto.h new file mode 100644 index 0000000000000000000000000000000000000000..6e7ea08fed761d2ca948cf77e376651f910b60dd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/Xvproto.h @@ -0,0 +1,603 @@ +/*********************************************************** +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef XVPROTO_H +#define XVPROTO_H +/* +** File: +** +** Xvproto.h --- Xv protocol header file +** +** Author: +** +** David Carver (Digital Workstation Engineering/Project Athena) +** +** Revisions: +** +** 11.06.91 Carver +** - changed SetPortControl to SetPortAttribute +** - changed GetPortControl to GetPortAttribute +** - changed QueryBestSize +** +** 15.05.91 Carver +** - version 2.0 upgrade +** +** 24.01.91 Carver +** - version 1.4 upgrade +** +*/ + +#include + +/* Symbols: These are undefined at the end of this file to restore the + values they have in Xv.h */ + +#define XvPortID CARD32 +#define XvEncodingID CARD32 +#define ShmSeg CARD32 +#define VisualID CARD32 +#define Drawable CARD32 +#define GContext CARD32 +#define Time CARD32 +#define Atom CARD32 + +/* Structures */ + +typedef struct { + INT32 numerator; + INT32 denominator; +} xvRational; +#define sz_xvRational 8 + +typedef struct { + XvPortID base_id; + CARD16 name_size; + CARD16 num_ports; + CARD16 num_formats; + CARD8 type; + CARD8 pad; +} xvAdaptorInfo; +#define sz_xvAdaptorInfo 12 + +typedef struct { + XvEncodingID encoding; + CARD16 name_size; + CARD16 width, height; + CARD16 pad; + xvRational rate; +} xvEncodingInfo; +#define sz_xvEncodingInfo (12 + sz_xvRational) + +typedef struct { + VisualID visual; + CARD8 depth; + CARD8 pad1; + CARD16 pad2; +} xvFormat; +#define sz_xvFormat 8 + +typedef struct { + CARD32 flags; + INT32 min; + INT32 max; + CARD32 size; +} xvAttributeInfo; +#define sz_xvAttributeInfo 16 + +typedef struct { + CARD32 id; + CARD8 type; + CARD8 byte_order; + CARD16 pad1; + CARD8 guid[16]; + CARD8 bpp; + CARD8 num_planes; + CARD16 pad2; + CARD8 depth; + CARD8 pad3; + CARD16 pad4; + CARD32 red_mask; + CARD32 green_mask; + CARD32 blue_mask; + CARD8 format; + CARD8 pad5; + CARD16 pad6; + CARD32 y_sample_bits; + CARD32 u_sample_bits; + CARD32 v_sample_bits; + CARD32 horz_y_period; + CARD32 horz_u_period; + CARD32 horz_v_period; + CARD32 vert_y_period; + CARD32 vert_u_period; + CARD32 vert_v_period; + CARD8 comp_order[32]; + CARD8 scanline_order; + CARD8 pad7; + CARD16 pad8; + CARD32 pad9; + CARD32 pad10; +} xvImageFormatInfo; +#define sz_xvImageFormatInfo 128 + + +/* Requests */ + +#define xv_QueryExtension 0 +#define xv_QueryAdaptors 1 +#define xv_QueryEncodings 2 +#define xv_GrabPort 3 +#define xv_UngrabPort 4 +#define xv_PutVideo 5 +#define xv_PutStill 6 +#define xv_GetVideo 7 +#define xv_GetStill 8 +#define xv_StopVideo 9 +#define xv_SelectVideoNotify 10 +#define xv_SelectPortNotify 11 +#define xv_QueryBestSize 12 +#define xv_SetPortAttribute 13 +#define xv_GetPortAttribute 14 +#define xv_QueryPortAttributes 15 +#define xv_ListImageFormats 16 +#define xv_QueryImageAttributes 17 +#define xv_PutImage 18 +#define xv_ShmPutImage 19 +#define xv_LastRequest xv_ShmPutImage + +#define xvNumRequests (xv_LastRequest + 1) + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; +} xvQueryExtensionReq; +#define sz_xvQueryExtensionReq 4 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + CARD32 window; +} xvQueryAdaptorsReq; +#define sz_xvQueryAdaptorsReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + CARD32 port; +} xvQueryEncodingsReq; +#define sz_xvQueryEncodingsReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + INT16 vid_x; + INT16 vid_y; + CARD16 vid_w; + CARD16 vid_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; +} xvPutVideoReq; +#define sz_xvPutVideoReq 32 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + INT16 vid_x; + INT16 vid_y; + CARD16 vid_w; + CARD16 vid_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; +} xvPutStillReq; +#define sz_xvPutStillReq 32 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + INT16 vid_x; + INT16 vid_y; + CARD16 vid_w; + CARD16 vid_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; +} xvGetVideoReq; +#define sz_xvGetVideoReq 32 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + INT16 vid_x; + INT16 vid_y; + CARD16 vid_w; + CARD16 vid_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; +} xvGetStillReq; +#define sz_xvGetStillReq 32 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Time time; +} xvGrabPortReq; +#define sz_xvGrabPortReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Time time; +} xvUngrabPortReq; +#define sz_xvUngrabPortReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + Drawable drawable; + BOOL onoff; + CARD8 pad1; + CARD16 pad2; +} xvSelectVideoNotifyReq; +#define sz_xvSelectVideoNotifyReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + BOOL onoff; + CARD8 pad1; + CARD16 pad2; +} xvSelectPortNotifyReq; +#define sz_xvSelectPortNotifyReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; +} xvStopVideoReq; +#define sz_xvStopVideoReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Atom attribute; + INT32 value; +} xvSetPortAttributeReq; +#define sz_xvSetPortAttributeReq 16 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Atom attribute; +} xvGetPortAttributeReq; +#define sz_xvGetPortAttributeReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + CARD16 vid_w; + CARD16 vid_h; + CARD16 drw_w; + CARD16 drw_h; + CARD8 motion; + CARD8 pad1; + CARD16 pad2; +} xvQueryBestSizeReq; +#define sz_xvQueryBestSizeReq 20 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; +} xvQueryPortAttributesReq; +#define sz_xvQueryPortAttributesReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + CARD32 id; + INT16 src_x; + INT16 src_y; + CARD16 src_w; + CARD16 src_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; + CARD16 width; + CARD16 height; +} xvPutImageReq; +#define sz_xvPutImageReq 40 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; + Drawable drawable; + GContext gc; + ShmSeg shmseg; + CARD32 id; + CARD32 offset; + INT16 src_x; + INT16 src_y; + CARD16 src_w; + CARD16 src_h; + INT16 drw_x; + INT16 drw_y; + CARD16 drw_w; + CARD16 drw_h; + CARD16 width; + CARD16 height; + CARD8 send_event; + CARD8 pad1; + CARD16 pad2; +} xvShmPutImageReq; +#define sz_xvShmPutImageReq 52 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + XvPortID port; +} xvListImageFormatsReq; +#define sz_xvListImageFormatsReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xvReqType; + CARD16 length; + CARD32 port; + CARD32 id; + CARD16 width; + CARD16 height; +} xvQueryImageAttributesReq; +#define sz_xvQueryImageAttributesReq 16 + + +/* Replies */ + +typedef struct _QueryExtensionReply { + BYTE type; /* X_Reply */ + CARD8 padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 version; + CARD16 revision; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryExtensionReply; +#define sz_xvQueryExtensionReply 32 + +typedef struct _QueryAdaptorsReply { + BYTE type; /* X_Reply */ + CARD8 padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 num_adaptors; + CARD16 pads3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryAdaptorsReply; +#define sz_xvQueryAdaptorsReply 32 + +typedef struct _QueryEncodingsReply { + BYTE type; /* X_Reply */ + CARD8 padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 num_encodings; + CARD16 padl3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryEncodingsReply; +#define sz_xvQueryEncodingsReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE result; + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD32 padl3; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvGrabPortReply; +#define sz_xvGrabPortReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + INT32 value; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvGetPortAttributeReply; +#define sz_xvGetPortAttributeReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD16 actual_width; + CARD16 actual_height; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryBestSizeReply; +#define sz_xvQueryBestSizeReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD32 num_attributes; + CARD32 text_size; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryPortAttributesReply; +#define sz_xvQueryPortAttributesReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_formats; + CARD32 padl4; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvListImageFormatsReply; +#define sz_xvListImageFormatsReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_planes; + CARD32 data_size; + CARD16 width; + CARD16 height; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; +} xvQueryImageAttributesReply; +#define sz_xvQueryImageAttributesReply 32 + +/* DEFINE EVENT STRUCTURE */ + +typedef struct { + union { + struct { + BYTE type; + BYTE detail; + CARD16 sequenceNumber; + } u; + struct { + BYTE type; + BYTE reason; + CARD16 sequenceNumber; + Time time; + Drawable drawable; + XvPortID port; + CARD32 padl5; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; + } videoNotify; + struct { + BYTE type; + BYTE padb1; + CARD16 sequenceNumber; + Time time; + XvPortID port; + Atom attribute; + INT32 value; + CARD32 padl6; + CARD32 padl7; + CARD32 padl8; + } portNotify; + } u; +} xvEvent; + +#undef XvPortID +#undef XvEncodingID +#undef ShmSeg +#undef VisualID +#undef Drawable +#undef GContext +#undef Time +#undef Atom + +#endif /* XVPROTO_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/ag.h b/data/miniconda3/envs/catiagent/include/X11/extensions/ag.h new file mode 100644 index 0000000000000000000000000000000000000000..be5883a3e6635eb820306e91f296532299edb1e3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/ag.h @@ -0,0 +1,52 @@ +/* +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _AG_H_ +#define _AG_H_ + +#define XAGNAME "XC-APPGROUP" + +#define XAG_MAJOR_VERSION 1 /* current version numbers */ +#define XAG_MINOR_VERSION 0 + +#define XagWindowTypeX11 0 +#define XagWindowTypeMacintosh 1 +#define XagWindowTypeWin32 2 +#define XagWindowTypeWin16 3 + +#define XagBadAppGroup 0 +#define XagNumberErrors (XagBadAppGroup + 1) + +#define XagNsingleScreen 7 +#define XagNdefaultRoot 1 +#define XagNrootVisual 2 +#define XagNdefaultColormap 3 +#define XagNblackPixel 4 +#define XagNwhitePixel 5 +#define XagNappGroupLeader 6 + +#endif /* _AG_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/agproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/agproto.h new file mode 100644 index 0000000000000000000000000000000000000000..803099d740aef38f527b73bf60a02834f32893dd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/agproto.h @@ -0,0 +1,178 @@ +/* +Copyright 1996, 1998, 2001 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _AGPROTO_H_ /* { */ +#define _AGPROTO_H_ + +#include + +#define X_XagQueryVersion 0 +#define X_XagCreate 1 +#define X_XagDestroy 2 +#define X_XagGetAttr 3 +#define X_XagQuery 4 +#define X_XagCreateAssoc 5 +#define X_XagDestroyAssoc 6 + +#define XAppGroup CARD32 + +/* +* Redefine some basic types used by structures defined herein. This allows +* both the library and server to view communicated data as 32-bit entities, +* thus preventing problems on 64-bit architectures where libXext sees this +* data as 64 bits and the server sees it as 32 bits. +*/ + +#define Colormap CARD32 +#define VisualID CARD32 +#define Window CARD32 + +typedef struct _XagQueryVersion { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagQueryVersion */ + CARD16 length; + CARD16 client_major_version; + CARD16 client_minor_version; +} xXagQueryVersionReq; +#define sz_xXagQueryVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + CARD16 server_major_version; + CARD16 server_minor_version; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXagQueryVersionReply; +#define sz_xXagQueryVersionReply 32 + +/* Set AppGroup Attributes masks */ +#define XagSingleScreenMask 1 << 0 +#define XagDefaultRootMask 1 << XagNdefaultRoot +#define XagRootVisualMask 1 << XagNrootVisual +#define XagDefaultColormapMask 1 << XagNdefaultColormap +#define XagBlackPixelMask 1 << XagNblackPixel +#define XagWhitePixelMask 1 << XagNwhitePixel +#define XagAppGroupLeaderMask 1 << XagNappGroupLeader + +typedef struct _XagCreate { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagCreate */ + CARD16 length; + XAppGroup app_group; + CARD32 attrib_mask; /* LISTofVALUE follows */ +} xXagCreateReq; +#define sz_xXagCreateReq 12 + +typedef struct _XagDestroy { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagDestroy */ + CARD16 length; + XAppGroup app_group; +} xXagDestroyReq; +#define sz_xXagDestroyReq 8 + +typedef struct _XagGetAttr { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagGetAttr */ + CARD16 length; + XAppGroup app_group; +} xXagGetAttrReq; +#define sz_xXagGetAttrReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + Window default_root; + VisualID root_visual; + Colormap default_colormap; + CARD32 black_pixel; + CARD32 white_pixel; + BOOL single_screen; + BOOL app_group_leader; + CARD16 pad2; +} xXagGetAttrReply; +#define sz_xXagGetAttrReply 32 + +typedef struct _XagQuery { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagQuery */ + CARD16 length; + CARD32 resource; +} xXagQueryReq; +#define sz_xXagQueryReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + XAppGroup app_group; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXagQueryReply; +#define sz_xXagQueryReply 32 + +typedef struct _XagCreateAssoc { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagCreateAssoc */ + CARD16 length; + Window window; + CARD16 window_type; + CARD16 system_window_len; /* LISTofCARD8 follows */ +} xXagCreateAssocReq; +#define sz_xXagCreateAssocReq 12 + +typedef struct _XagDestroyAssoc { + CARD8 reqType; /* always XagReqCode */ + CARD8 xagReqType; /* always X_XagDestroyAssoc */ + CARD16 length; + Window window; +} xXagDestroyAssocReq; +#define sz_xXagDestroyAssocReq 8 + +#undef XAppGroup +/* + * Cancel the previous redefinition of the basic types, thus restoring their + * X.h definitions. + */ + +#undef Window +#undef Colormap +#undef VisualID + +#endif /* } _AGPROTO_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/applewmconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/applewmconst.h new file mode 100644 index 0000000000000000000000000000000000000000..4877c34715e98b260c0f2a264f2e3a71f283b624 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/applewmconst.h @@ -0,0 +1,84 @@ +/************************************************************************** + +Copyright (c) 2002 Apple Computer, Inc. +All Rights Reserved. + +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, sub license, 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 (including the +next paragraph) 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 _APPLEWMCONST_H_ +#define _APPLEWMCONST_H_ + +/* Events */ +#define AppleWMControllerNotify 0 +#define AppleWMActivationNotify 1 +#define AppleWMPasteboardNotify 2 +#define AppleWMNumberEvents 3 + +#define AppleWMControllerNotifyMask (1L << 0) +#define AppleWMActivationNotifyMask (1L << 1) +#define AppleWMPasteboardNotifyMask (1L << 2) + +/* "Kinds" of ControllerNotify events */ +#define AppleWMMinimizeWindow 0 +#define AppleWMZoomWindow 1 +#define AppleWMCloseWindow 2 +#define AppleWMBringAllToFront 3 +#define AppleWMHideWindow 4 +#define AppleWMHideAll 5 +#define AppleWMShowAll 6 +#define AppleWMWindowMenuItem 9 +#define AppleWMWindowMenuNotify 10 +#define AppleWMNextWindow 11 +#define AppleWMPreviousWindow 12 + +/* "Kinds" of ActivationNotify events */ +#define AppleWMIsActive 0 +#define AppleWMIsInactive 1 +#define AppleWMReloadPreferences 2 + +/* "Kinds" of PasteboardNotify events */ +#define AppleWMCopyToPasteboard 0 + +/* Errors */ +#define AppleWMClientNotLocal 0 +#define AppleWMOperationNotSupported 1 +#define AppleWMNumberErrors (AppleWMOperationNotSupported + 1) + +/* Window level ids */ +#define AppleWMWindowLevelNormal 0 +#define AppleWMWindowLevelFloating 1 +#define AppleWMWindowLevelTornOff 2 +#define AppleWMWindowLevelDock 3 +#define AppleWMWindowLevelDesktop 4 +#define AppleWMNumWindowLevels 5 + +/* Possible value for frame_rect argument to XAppleWMFrameGetRect() */ +/* Use xp_frame_rect_enum from */ + +/* Window frame classes */ +/* Use xp_frame_class_enum from */ + +/* Window frame attributes */ +/* Use xp_frame_attr_enum from */ + +#endif /* _APPLEWMCONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/applewmproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/applewmproto.h new file mode 100644 index 0000000000000000000000000000000000000000..91417361e233d94747ed07fc24e0bb971435f8e3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/applewmproto.h @@ -0,0 +1,293 @@ +/************************************************************************** + +Copyright (c) 2002 Apple Computer, Inc. +All Rights Reserved. + +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, sub license, 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 (including the +next paragraph) 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 NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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 _APPLEWMPROTO_H_ +#define _APPLEWMPROTO_H_ + +#include +#include +#include + +#define APPLEWMNAME "Apple-WM" + +#define APPLE_WM_MAJOR_VERSION 1 /* current version numbers */ +#define APPLE_WM_MINOR_VERSION 3 +#define APPLE_WM_PATCH_VERSION 0 + +#define X_AppleWMQueryVersion 0 +#define X_AppleWMFrameGetRect 1 +#define X_AppleWMFrameHitTest 2 +#define X_AppleWMFrameDraw 3 +#define X_AppleWMDisableUpdate 4 +#define X_AppleWMReenableUpdate 5 +#define X_AppleWMSelectInput 6 +#define X_AppleWMSetWindowMenuCheck 7 +#define X_AppleWMSetFrontProcess 8 +#define X_AppleWMSetWindowLevel 9 +#define X_AppleWMSetCanQuit 10 +#define X_AppleWMSetWindowMenu 11 +#define X_AppleWMSendPSN 12 +#define X_AppleWMAttachTransient 13 + +/* For the purpose of the structure definitions in this file, +we must redefine the following types in terms of Xmd.h's types, which may +include bit fields. All of these are #undef'd at the end of this file, +restoring the definitions in X.h. */ + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define VisualID CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 + +typedef struct _AppleWMQueryVersion { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMQueryVersion */ + CARD16 length; +} xAppleWMQueryVersionReq; +#define sz_xAppleWMQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of WM protocol */ + CARD16 minorVersion; /* minor version of WM protocol */ + CARD32 patchVersion; /* patch version of WM protocol */ + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xAppleWMQueryVersionReply; +#define sz_xAppleWMQueryVersionReply 32 + +typedef struct _AppleWMDisableUpdate { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMDisableUpdate */ + CARD16 length; + CARD32 screen; +} xAppleWMDisableUpdateReq; +#define sz_xAppleWMDisableUpdateReq 8 + +typedef struct _AppleWMReenableUpdate { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMReenableUpdate */ + CARD16 length; + CARD32 screen; +} xAppleWMReenableUpdateReq; +#define sz_xAppleWMReenableUpdateReq 8 + +typedef struct _AppleWMSelectInput { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSelectInput */ + CARD16 length; + CARD32 mask; +} xAppleWMSelectInputReq; +#define sz_xAppleWMSelectInputReq 8 + +typedef struct _AppleWMNotify { + BYTE type; /* always eventBase + event type */ + BYTE kind; + CARD16 sequenceNumber; + Time time; /* time of change */ + CARD16 pad1; + CARD32 arg; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xAppleWMNotifyEvent; +#define sz_xAppleWMNotifyEvent 32 + +typedef struct _AppleWMSetWindowMenu { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSetWindowMenu */ + CARD16 length; + CARD16 nitems; + CARD16 pad1; +} xAppleWMSetWindowMenuReq; +#define sz_xAppleWMSetWindowMenuReq 8 + +typedef struct _AppleWMSetWindowMenuCheck { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSetWindowMenuCheck */ + CARD16 length; + CARD32 index; +} xAppleWMSetWindowMenuCheckReq; +#define sz_xAppleWMSetWindowMenuCheckReq 8 + +typedef struct _AppleWMSetFrontProcess { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSetFrontProcess */ + CARD16 length; +} xAppleWMSetFrontProcessReq; +#define sz_xAppleWMSetFrontProcessReq 4 + +typedef struct _AppleWMSetWindowLevel { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSetWindowLevel */ + CARD16 length; + CARD32 window; + CARD32 level; +} xAppleWMSetWindowLevelReq; +#define sz_xAppleWMSetWindowLevelReq 12 + +typedef struct _AppleWMSendPSN { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSendPSN */ + CARD16 length; + CARD32 psn_hi; + CARD32 psn_lo; +} xAppleWMSendPSNReq; +#define sz_xAppleWMSendPSNReq 12 + +typedef struct _AppleWMAttachTransient { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMAttachTransient */ + CARD16 length; + CARD32 child; + CARD32 parent; +} xAppleWMAttachTransientReq; +#define sz_xAppleWMAttachTransientReq 12 + +typedef struct _AppleWMSetCanQuit { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMSetCanQuit */ + CARD16 length; + CARD32 state; +} xAppleWMSetCanQuitReq; +#define sz_xAppleWMSetCanQuitReq 8 + +typedef struct _AppleWMFrameGetRect { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMFrameGetRect */ + CARD16 length; + CARD16 frame_class; + CARD16 frame_rect; + CARD16 ix; + CARD16 iy; + CARD16 iw; + CARD16 ih; + CARD16 ox; + CARD16 oy; + CARD16 ow; + CARD16 oh; +} xAppleWMFrameGetRectReq; +#define sz_xAppleWMFrameGetRectReq 24 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 x; + CARD16 y; + CARD16 w; + CARD16 h; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xAppleWMFrameGetRectReply; +#define sz_xAppleWMFrameGetRectReply 32 + +typedef struct _AppleWMFrameHitTest { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMFrameHitTest */ + CARD16 length; + CARD16 frame_class; + CARD16 pad1; + CARD16 px; + CARD16 py; + CARD16 ix; + CARD16 iy; + CARD16 iw; + CARD16 ih; + CARD16 ox; + CARD16 oy; + CARD16 ow; + CARD16 oh; +} xAppleWMFrameHitTestReq; +#define sz_xAppleWMFrameHitTestReq 28 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 ret; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xAppleWMFrameHitTestReply; +#define sz_xAppleWMFrameHitTestReply 32 + +typedef struct _AppleWMFrameDraw { + CARD8 reqType; /* always WMReqCode */ + CARD8 wmReqType; /* always X_AppleWMFrameDraw */ + CARD16 length; + CARD32 screen; + CARD32 window; + CARD16 frame_class; + CARD16 frame_attr; + CARD16 ix; + CARD16 iy; + CARD16 iw; + CARD16 ih; + CARD16 ox; + CARD16 oy; + CARD16 ow; + CARD16 oh; + CARD32 title_length; +} xAppleWMFrameDrawReq; +#define sz_xAppleWMFrameDrawReq 36 + +/* restore these definitions back to the typedefs in X.h */ +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef VisualID +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _APPLEWMPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqsproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqsproto.h new file mode 100644 index 0000000000000000000000000000000000000000..df96a766fd145ebd1c546c78f4942ec5b87c7289 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqsproto.h @@ -0,0 +1,67 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _BIGREQSPROTO_H_ +#define _BIGREQSPROTO_H_ + +#define X_BigReqEnable 0 + +#define XBigReqNumberEvents 0 + +#define XBigReqNumberErrors 0 + +#define XBigReqExtensionName "BIG-REQUESTS" + +typedef struct { + CARD8 reqType; /* always XBigReqCode */ + CARD8 brReqType; /* always X_BigReqEnable */ + CARD16 length; +} xBigReqEnableReq; +#define sz_xBigReqEnableReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 max_request_size; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xBigReqEnableReply; +#define sz_xBigReqEnableReply 32 + + +typedef struct { + CARD8 reqType; + CARD8 data; + CARD16 zero; + CARD32 length; +} xBigReq; + +#endif /* _BIGREQSPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqstr.h new file mode 100644 index 0000000000000000000000000000000000000000..0a023dbf1c4044af188c6921cd883a9bedd579eb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/bigreqstr.h @@ -0,0 +1,3 @@ +#warning "bigreqstr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/composite.h b/data/miniconda3/envs/catiagent/include/X11/extensions/composite.h new file mode 100644 index 0000000000000000000000000000000000000000..e942700ee4cf7b9e71ff93e7bf1c8611c3fab035 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/composite.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. + * + * 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 (including the next + * paragraph) 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. + */ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _COMPOSITE_H_ +#define _COMPOSITE_H_ + +#include + +#define COMPOSITE_NAME "Composite" +#define COMPOSITE_MAJOR 0 +#define COMPOSITE_MINOR 4 + +#define CompositeRedirectAutomatic 0 +#define CompositeRedirectManual 1 + +#define X_CompositeQueryVersion 0 +#define X_CompositeRedirectWindow 1 +#define X_CompositeRedirectSubwindows 2 +#define X_CompositeUnredirectWindow 3 +#define X_CompositeUnredirectSubwindows 4 +#define X_CompositeCreateRegionFromBorderClip 5 +#define X_CompositeNameWindowPixmap 6 +#define X_CompositeGetOverlayWindow 7 +#define X_CompositeReleaseOverlayWindow 8 + +#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1) + +#define CompositeNumberEvents 0 + +#endif /* _COMPOSITE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/compositeproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/compositeproto.h new file mode 100644 index 0000000000000000000000000000000000000000..5a9ca6f3b60bcc1a2a7a92a494774f3771d0eac3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/compositeproto.h @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. + * + * 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 (including the next + * paragraph) 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. + */ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _COMPOSITEPROTO_H_ +#define _COMPOSITEPROTO_H_ + +#include +#include + +#define Window CARD32 +#define Region CARD32 +#define Pixmap CARD32 + +/* + * requests and replies + */ +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xCompositeQueryVersionReq; + +#define sz_xCompositeQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xCompositeQueryVersionReply; + +#define sz_xCompositeQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; + CARD8 update; + CARD8 pad1; + CARD16 pad2; +} xCompositeRedirectWindowReq; + +#define sz_xCompositeRedirectWindowReq 12 + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; + CARD8 update; + CARD8 pad1; + CARD16 pad2; +} xCompositeRedirectSubwindowsReq; + +#define sz_xCompositeRedirectSubwindowsReq 12 + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; + CARD8 update; + CARD8 pad1; + CARD16 pad2; +} xCompositeUnredirectWindowReq; + +#define sz_xCompositeUnredirectWindowReq 12 + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; + CARD8 update; + CARD8 pad1; + CARD16 pad2; +} xCompositeUnredirectSubwindowsReq; + +#define sz_xCompositeUnredirectSubwindowsReq 12 + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Region region; + Window window; +} xCompositeCreateRegionFromBorderClipReq; + +#define sz_xCompositeCreateRegionFromBorderClipReq 12 + +/* Version 0.2 additions */ + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; + Pixmap pixmap; +} xCompositeNameWindowPixmapReq; + +#define sz_xCompositeNameWindowPixmapReq 12 + +/* Version 0.3 additions */ + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; +} xCompositeGetOverlayWindowReq; + +#define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq) + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + Window overlayWin; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xCompositeGetOverlayWindowReply; + +#define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply) + +typedef struct { + CARD8 reqType; + CARD8 compositeReqType; + CARD16 length; + Window window; +} xCompositeReleaseOverlayWindowReq; + +#define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq) + +#undef Window +#undef Region +#undef Pixmap + +#endif /* _COMPOSITEPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/cup.h b/data/miniconda3/envs/catiagent/include/X11/extensions/cup.h new file mode 100644 index 0000000000000000000000000000000000000000..cbbc34bf8e9f7d1225b7bbb4fa11d163cf599725 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/cup.h @@ -0,0 +1,38 @@ +/* + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _CUP_H_ +#define _CUP_H_ + +#define XCUPNAME "TOG-CUP" + +#define XCUP_MAJOR_VERSION 1 /* current version numbers */ +#define XCUP_MINOR_VERSION 0 + +#define XcupNumberErrors 0 + +#endif /* _CUP_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/cupproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/cupproto.h new file mode 100644 index 0000000000000000000000000000000000000000..a0c3d16e8a3a2193c1cada7219ebfd73c1aa6ca4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/cupproto.h @@ -0,0 +1,105 @@ +/* + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XCUPPROTO_H_ /* { */ +#define _XCUPPROTO_H_ + +#include + +#define X_XcupQueryVersion 0 +#define X_XcupGetReservedColormapEntries 1 +#define X_XcupStoreColors 2 + +typedef struct _XcupQueryVersion { + CARD8 reqType; /* always XcupReqCode */ + CARD8 xcupReqType; /* always X_XcupQueryVersion */ + CARD16 length; + CARD16 client_major_version; + CARD16 client_minor_version; +} xXcupQueryVersionReq; +#define sz_xXcupQueryVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + CARD16 server_major_version; + CARD16 server_minor_version; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXcupQueryVersionReply; +#define sz_xXcupQueryVersionReply 32 + +typedef struct _XcupGetReservedColormapEntries { + CARD8 reqType; /* always XcupReqCode */ + CARD8 xcupReqType; /* always X_XcupGetReservedColormapEntries */ + CARD16 length; + CARD32 screen; +} xXcupGetReservedColormapEntriesReq; +#define sz_xXcupGetReservedColormapEntriesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xXcupGetReservedColormapEntriesReply; +#define sz_xXcupGetReservedColormapEntriesReply 32 + +typedef struct _XcupStoreColors { + CARD8 reqType; /* always XcupReqCode */ + CARD8 xcupReqType; /* always X_XcupStoreColors */ + CARD16 length; + CARD32 cmap; +} xXcupStoreColorsReq; +#define sz_xXcupStoreColorsReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequence_number; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xXcupStoreColorsReply; +#define sz_xXcupStoreColorsReply 32 + +#endif /* } _XCUPPROTO_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/damageproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/damageproto.h new file mode 100644 index 0000000000000000000000000000000000000000..bff6c180ef0498db5e409fb09e1fb82fcc5b77a8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/damageproto.h @@ -0,0 +1,158 @@ +/* + * Copyright © 2003 Keith Packard + * Copyright © 2007 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _DAMAGEPROTO_H_ +#define _DAMAGEPROTO_H_ + +#include +#include +#include + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define VisualID CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 +#define Picture CARD32 +#define Region CARD32 +#define Damage CARD32 + +/************** Version 0 ******************/ + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; +} xDamageReq; + +/* + * requests and replies + */ + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xDamageQueryVersionReq; + +#define sz_xDamageQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDamageQueryVersionReply; + +#define sz_xDamageQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; + Damage damage; + Drawable drawable; + CARD8 level; + CARD8 pad1; + CARD16 pad2; +} xDamageCreateReq; + +#define sz_xDamageCreateReq 16 + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; + Damage damage; +} xDamageDestroyReq; + +#define sz_xDamageDestroyReq 8 + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; + Damage damage; + Region repair; + Region parts; +} xDamageSubtractReq; + +#define sz_xDamageSubtractReq 16 + +typedef struct { + CARD8 reqType; + CARD8 damageReqType; + CARD16 length; + Drawable drawable; + Region region; +} xDamageAddReq; + +#define sz_xDamageAddReq 12 + +/* Events */ + +#define DamageNotifyMore 0x80 + +typedef struct { + CARD8 type; + CARD8 level; + CARD16 sequenceNumber; + Drawable drawable; + Damage damage; + Time timestamp; + xRectangle area; + xRectangle geometry; +} xDamageNotifyEvent; + +#undef Damage +#undef Region +#undef Picture +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef VisualID +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _DAMAGEPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/damagewire.h b/data/miniconda3/envs/catiagent/include/X11/extensions/damagewire.h new file mode 100644 index 0000000000000000000000000000000000000000..d90a0dd7c490dbe52693ebbffb1afa5c1abfaea3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/damagewire.h @@ -0,0 +1,56 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _DAMAGEWIRE_H_ +#define _DAMAGEWIRE_H_ + +#define DAMAGE_NAME "DAMAGE" +#define DAMAGE_MAJOR 1 +#define DAMAGE_MINOR 1 + +/************* Version 1 ****************/ + +/* Constants */ +#define XDamageReportRawRectangles 0 +#define XDamageReportDeltaRectangles 1 +#define XDamageReportBoundingBox 2 +#define XDamageReportNonEmpty 3 + +/* Requests */ +#define X_DamageQueryVersion 0 +#define X_DamageCreate 1 +#define X_DamageDestroy 2 +#define X_DamageSubtract 3 +#define X_DamageAdd 4 + +#define XDamageNumberRequests (X_DamageAdd + 1) + +/* Events */ +#define XDamageNotify 0 + +#define XDamageNumberEvents (XDamageNotify + 1) + +/* Errors */ +#define BadDamage 0 +#define XDamageNumberErrors (BadDamage + 1) + +#endif /* _DAMAGEWIRE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dbe.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dbe.h new file mode 100644 index 0000000000000000000000000000000000000000..7968552d3206caedb7ffd9b477ab97afae25f582 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dbe.h @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * Copyright (c) 1994, 1995 Hewlett-Packard Company + * + * 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 HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Hewlett-Packard + * Company shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Hewlett-Packard Company. + * + * Header file for Xlib-related DBE + * + *****************************************************************************/ + +#ifndef DBE_H +#define DBE_H + +/* Values for swap_action field of XdbeSwapInfo structure */ +#define XdbeUndefined 0 +#define XdbeBackground 1 +#define XdbeUntouched 2 +#define XdbeCopied 3 + +/* Errors */ +#define XdbeBadBuffer 0 + +#define DBE_PROTOCOL_NAME "DOUBLE-BUFFER" + +/* Current version numbers */ +#define DBE_MAJOR_VERSION 1 +#define DBE_MINOR_VERSION 0 + +/* Used when adding extension; also used in Xdbe macros */ +#define DbeNumberEvents 0 +#define DbeBadBuffer 0 +#define DbeNumberErrors (DbeBadBuffer + 1) + +#endif /* DBE_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dbeproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dbeproto.h new file mode 100644 index 0000000000000000000000000000000000000000..d6f7123885aad157f19ea6236481ad59c7a0c7c6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dbeproto.h @@ -0,0 +1,224 @@ +/****************************************************************************** + * + * Copyright (c) 1994, 1995 Hewlett-Packard Company + * + * 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 HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Hewlett-Packard + * Company shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Hewlett-Packard Company. + * + * Header file for Xlib-related DBE + * + *****************************************************************************/ + +#ifndef DBE_PROTO_H +#define DBE_PROTO_H + +#include + +/* Request values used in (S)ProcDbeDispatch() */ +#define X_DbeGetVersion 0 +#define X_DbeAllocateBackBufferName 1 +#define X_DbeDeallocateBackBufferName 2 +#define X_DbeSwapBuffers 3 +#define X_DbeBeginIdiom 4 +#define X_DbeEndIdiom 5 +#define X_DbeGetVisualInfo 6 +#define X_DbeGetBackBufferAttributes 7 + +typedef CARD8 xDbeSwapAction; +typedef CARD32 xDbeBackBuffer; + +/* TYPEDEFS */ + +/* Protocol data types */ + +typedef struct +{ + CARD32 window; /* window */ + xDbeSwapAction swapAction; /* swap action */ + CARD8 pad1; /* unused */ + CARD16 pad2; + +} xDbeSwapInfo; + +typedef struct +{ + CARD32 visualID; /* associated visual */ + CARD8 depth; /* depth of visual */ + CARD8 perfLevel; /* performance level hint */ + CARD16 pad1; + +} xDbeVisInfo; +#define sz_xDbeVisInfo 8 + +typedef struct +{ + CARD32 n; /* number of visual info items in list */ + +} xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */ + +typedef struct +{ + CARD32 window; /* window */ + +} xDbeBufferAttributes; + + +/* Requests and replies */ + +typedef struct +{ + CARD8 reqType; /* major-opcode: always codes->major_opcode */ + CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */ + CARD16 length; /* request length: (2) */ + CARD8 majorVersion; /* client-major-version */ + CARD8 minorVersion; /* client-minor-version */ + CARD16 unused; /* unused */ + +} xDbeGetVersionReq; +#define sz_xDbeGetVersionReq 8 + +typedef struct +{ + BYTE type; /* Reply: X_Reply (1) */ + CARD8 unused; /* unused */ + CARD16 sequenceNumber; /* sequence number */ + CARD32 length; /* reply length: (0) */ + CARD8 majorVersion; /* server-major-version */ + CARD8 minorVersion; /* server-minor-version */ + CARD16 pad1; /* unused */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + +} xDbeGetVersionReply; +#define sz_xDbeGetVersionReply 32 + +typedef struct +{ + CARD8 reqType; /* major-opcode: codes->major_opcode */ + CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */ + CARD16 length; /* request length: (4) */ + CARD32 window; /* window */ + xDbeBackBuffer buffer; /* back buffer name */ + xDbeSwapAction swapAction; /* swap action hint */ + CARD8 pad1; /* unused */ + CARD16 pad2; + +} xDbeAllocateBackBufferNameReq; +#define sz_xDbeAllocateBackBufferNameReq 16 + +typedef struct +{ + CARD8 reqType; /* major-opcode: codes->major_opcode */ + CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */ + CARD16 length; /* request length: (2) */ + xDbeBackBuffer buffer; /* back buffer name */ + +} xDbeDeallocateBackBufferNameReq; +#define sz_xDbeDeallocateBackBufferNameReq 8 + +typedef struct +{ + CARD8 reqType; /* major-opcode: always codes->major_opcode */ + CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */ + CARD16 length; /* request length: (2+2n) */ + CARD32 n; /* n, number of window/swap action pairs */ + +} xDbeSwapBuffersReq; /* followed by n window/swap action pairs */ +#define sz_xDbeSwapBuffersReq 8 + +typedef struct +{ + CARD8 reqType; /* major-opcode: always codes->major_opcode */ + CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */ + CARD16 length; /* request length: (1) */ + +} xDbeBeginIdiomReq; +#define sz_xDbeBeginIdiomReq 4 + +typedef struct +{ + CARD8 reqType; /* major-opcode: always codes->major_opcode */ + CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */ + CARD16 length; /* request length: (1) */ + +} xDbeEndIdiomReq; +#define sz_xDbeEndIdiomReq 4 + +typedef struct +{ + CARD8 reqType; /* always codes->major_opcode */ + CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */ + CARD16 length; /* request length: (2+n) */ + CARD32 n; /* n, number of drawables in list */ + +} xDbeGetVisualInfoReq; /* followed by n drawables */ +#define sz_xDbeGetVisualInfoReq 8 + +typedef struct +{ + BYTE type; /* Reply: X_Reply (1) */ + CARD8 unused; /* unused */ + CARD16 sequenceNumber; /* sequence number */ + CARD32 length; /* reply length */ + CARD32 m; /* m, number of visual infos in list */ + CARD32 pad1; /* unused */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + +} xDbeGetVisualInfoReply; /* followed by m visual infos */ +#define sz_xDbeGetVisualInfoReply 32 + +typedef struct +{ + CARD8 reqType; /* always codes->major_opcode */ + CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */ + CARD16 length; /* request length: (2) */ + xDbeBackBuffer buffer; /* back buffer name */ + +} xDbeGetBackBufferAttributesReq; +#define sz_xDbeGetBackBufferAttributesReq 8 + +typedef struct +{ + BYTE type; /* Reply: X_Reply (1) */ + CARD8 unused; /* unused */ + CARD16 sequenceNumber; /* sequence number */ + CARD32 length; /* reply length: (0) */ + CARD32 attributes; /* attributes */ + CARD32 pad1; /* unused */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + +} xDbeGetBackBufferAttributesReply; +#define sz_xDbeGetBackBufferAttributesReply 32 + +#endif /* DBE_PROTO_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dmx.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dmx.h new file mode 100644 index 0000000000000000000000000000000000000000..8cbd4d3672f0e527867063236857da5d587845b9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dmx.h @@ -0,0 +1,68 @@ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * 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 on 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 (including the + * next paragraph) 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file describes the interface to the client-side libdmx.a + * library. All DMX-aware client-side applications should include this + * file. */ + +#ifndef _DMX_H_ +#define _DMX_H_ + +/* These values must be larger than LastExtensionError. + The values in dmxext.h and dmxproto.h *MUST* match. */ +#define DmxBadXinerama 1001 +#define DmxBadValue 1002 +#define DmxBadReply 1003 + +#define DMXScreenWindowWidth (1L<<0) +#define DMXScreenWindowHeight (1L<<1) +#define DMXScreenWindowXoffset (1L<<2) +#define DMXScreenWindowYoffset (1L<<3) +#define DMXRootWindowWidth (1L<<4) +#define DMXRootWindowHeight (1L<<5) +#define DMXRootWindowXoffset (1L<<6) +#define DMXRootWindowYoffset (1L<<7) +#define DMXRootWindowXorigin (1L<<8) +#define DMXRootWindowYorigin (1L<<9) + +#define DMXDesktopWidth (1L<<0) +#define DMXDesktopHeight (1L<<1) +#define DMXDesktopShiftX (1L<<2) +#define DMXDesktopShiftY (1L<<3) + +#define DMXInputType (1L<<0) +#define DMXInputPhysicalScreen (1L<<1) +#define DMXInputSendsCore (1L<<2) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dmxproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dmxproto.h new file mode 100644 index 0000000000000000000000000000000000000000..c8bc862867848dd4d54d3ec5158f47c67ee3ddbb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dmxproto.h @@ -0,0 +1,445 @@ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * 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 on 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 (including the + * next paragraph) 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file describes the structures necessary to implement the wire + * protocol for the DMX protocol extension. It should be included only + * in files that implement the client-side (or server-side) part of the + * protocol (i.e., client-side applications should \b not include this + * file). */ + +#ifndef _DMXSTR_H_ +#define _DMXSTR_H_ + +#define DMX_EXTENSION_NAME "DMX" +#define DMX_EXTENSION_MAJOR 2 +#define DMX_EXTENSION_MINOR 2 +#define DMX_EXTENSION_PATCH 20040604 + +/* These values must be larger than LastExtensionError. + The values in dmxext.h and dmxproto.h *MUST* match. */ +#define DMX_BAD_XINERAMA 1001 +#define DMX_BAD_VALUE 1002 + +#define X_DMXQueryVersion 0 +#define X_DMXGetScreenCount 1 +#define X_DMXGetScreenInformationDEPRECATED 2 +#define X_DMXGetWindowAttributes 3 +#define X_DMXGetInputCount 4 +#define X_DMXGetInputAttributes 5 +#define X_DMXForceWindowCreationDEPRECATED 6 +#define X_DMXReconfigureScreenDEPRECATED 7 +#define X_DMXSync 8 +#define X_DMXForceWindowCreation 9 +#define X_DMXGetScreenAttributes 10 +#define X_DMXChangeScreensAttributes 11 +#define X_DMXAddScreen 12 +#define X_DMXRemoveScreen 13 +#define X_DMXGetDesktopAttributes 14 +#define X_DMXChangeDesktopAttributes 15 +#define X_DMXAddInput 16 +#define X_DMXRemoveInput 17 + +/** Wire-level description of DMXQueryVersion protocol request. */ +typedef struct { + CARD8 reqType; /* dmxcode */ + CARD8 dmxReqType; /* X_DMXQueryVersion */ + CARD16 length; +} xDMXQueryVersionReq; +#define sz_xDMXQueryVersionReq 4 + +/** Wire-level description of DMXQueryVersion protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 ununsed; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 patchVersion; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; +} xDMXQueryVersionReply; +#define sz_xDMXQueryVersionReply 32 + +/** Wire-level description of DMXSync protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXSync */ + CARD16 length; +} xDMXSyncReq; +#define sz_xDMXSyncReq 4 + +/** Wire-level description of DMXSync protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXSyncReply; +#define sz_xDMXSyncReply 32 + +/** Wire-level description of DMXForceWindowCreation protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXForceWindowCreation */ + CARD16 length; + CARD32 window; +} xDMXForceWindowCreationReq; +#define sz_xDMXForceWindowCreationReq 8 + +/** Wire-level description of DMXForceWindowCreation protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXForceWindowCreationReply; +#define sz_xDMXForceWindowCreationReply 32 + +/** Wire-level description of DMXGetScreenCount protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetScreenCount */ + CARD16 length; +} xDMXGetScreenCountReq; +#define sz_xDMXGetScreenCountReq 4 + +/** Wire-level description of DMXGetScreenCount protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 screenCount; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXGetScreenCountReply; +#define sz_xDMXGetScreenCountReply 32 + +/** Wire-level description of DMXGetScreenAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetScreenAttributes */ + CARD16 length; + CARD32 physicalScreen; +} xDMXGetScreenAttributesReq; +#define sz_xDMXGetScreenAttributesReq 8 + +/** Wire-level description of DMXGetScreenAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 displayNameLength; + CARD32 logicalScreen; + + CARD16 screenWindowWidth; + CARD16 screenWindowHeight; + INT16 screenWindowXoffset; + INT16 screenWindowYoffset; + + CARD16 rootWindowWidth; + CARD16 rootWindowHeight; + INT16 rootWindowXoffset; + INT16 rootWindowYoffset; + INT16 rootWindowXorigin; + INT16 rootWindowYorigin; +} xDMXGetScreenAttributesReply; +#define sz_xDMXGetScreenAttributesReply 36 + +/** Wire-level description of DMXChangeScreensAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXChangeScreensAttributes */ + CARD16 length; + CARD32 screenCount; + CARD32 maskCount; +} xDMXChangeScreensAttributesReq; +#define sz_xDMXChangeScreensAttributesReq 12 + +/** Wire-level description of DMXChangeScreensAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 errorScreen; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xDMXChangeScreensAttributesReply; +#define sz_xDMXChangeScreensAttributesReply 32 + +/** Wire-level description of DMXAddScreen protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXAddScreen */ + CARD16 length; + CARD32 displayNameLength; + CARD32 physicalScreen; + CARD32 valueMask; +} xDMXAddScreenReq; +#define sz_xDMXAddScreenReq 16 + +/** Wire-level description of DMXAddScreen protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 physicalScreen; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xDMXAddScreenReply; +#define sz_xDMXAddScreenReply 32 + +/** Wire-level description of DMXRemoveScreen protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXRemoveScreen */ + CARD16 length; + CARD32 physicalScreen; +} xDMXRemoveScreenReq; +#define sz_xDMXRemoveScreenReq 8 + +/** Wire-level description of DMXRemoveScreen protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXRemoveScreenReply; +#define sz_xDMXRemoveScreenReply 32 + +/** Wire-level description of DMXGetWindowAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetWindowAttributes */ + CARD16 length; + CARD32 window; +} xDMXGetWindowAttributesReq; +#define sz_xDMXGetWindowAttributesReq 8 + +/** Wire-level description of DMXGetWindowAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 screenCount; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXGetWindowAttributesReply; +#define sz_xDMXGetWindowAttributesReply 32 + +/** Wire-level description of DMXGetDesktopAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetDesktopAttributes */ + CARD16 length; +} xDMXGetDesktopAttributesReq; +#define sz_xDMXGetDesktopAttributesReq 4 + +/** Wire-level description of DMXGetDesktopAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + INT16 width; + INT16 height; + INT16 shiftX; + INT16 shiftY; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xDMXGetDesktopAttributesReply; +#define sz_xDMXGetDesktopAttributesReply 32 + +/** Wire-level description of DMXChangeDesktopAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXChangeDesktopAttributes */ + CARD16 length; + CARD32 valueMask; +} xDMXChangeDesktopAttributesReq; +#define sz_xDMXChangeDesktopAttributesReq 8 + +/** Wire-level description of DMXChangeDesktopAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXChangeDesktopAttributesReply; +#define sz_xDMXChangeDesktopAttributesReply 32 + +/** Wire-level description of DMXGetInputCount protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetInputCount */ + CARD16 length; +} xDMXGetInputCountReq; +#define sz_xDMXGetInputCountReq 4 + +/** Wire-level description of DMXGetInputCount protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 inputCount; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXGetInputCountReply; +#define sz_xDMXGetInputCountReply 32 + +/** Wire-level description of DMXGetInputAttributes protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXGetInputAttributes */ + CARD16 length; + CARD32 deviceId; +} xDMXGetInputAttributesReq; +#define sz_xDMXGetInputAttributesReq 8 + +/** Wire-level description of DMXGetInputAttributes protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 inputType; + CARD32 physicalScreen; + CARD32 physicalId; + CARD32 nameLength; + BOOL isCore; + BOOL sendsCore; + BOOL detached; + CARD8 pad0; + CARD32 pad1; +} xDMXGetInputAttributesReply; +#define sz_xDMXGetInputAttributesReply 32 + +/** Wire-level description of DMXAddInput protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXAddInput */ + CARD16 length; + CARD32 displayNameLength; + CARD32 valueMask; +} xDMXAddInputReq; +#define sz_xDMXAddInputReq 12 + +/** Wire-level description of DMXAddInput protocol reply. */ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 physicalId; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xDMXAddInputReply; +#define sz_xDMXAddInputReply 32 + +/** Wire-level description of DMXRemoveInput protocol request. */ +typedef struct { + CARD8 reqType; /* DMXCode */ + CARD8 dmxReqType; /* X_DMXRemoveInput */ + CARD16 length; + CARD32 physicalId; +} xDMXRemoveInputReq; +#define sz_xDMXRemoveInputReq 8 + +/** Wire-level description of DMXRemoveInput protocol reply. */ +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDMXRemoveInputReply; +#define sz_xDMXRemoveInputReply 32 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dpms.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dpms.h new file mode 100644 index 0000000000000000000000000000000000000000..f85e6a725281028db8501f754e5501739bb0ce37 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dpms.h @@ -0,0 +1,53 @@ +/***************************************************************** + +Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. + +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ + +#ifndef _X11_EXTENSIONS_DPMS_H +#define _X11_EXTENSIONS_DPMS_H 1 + +#include +#include +#include + +#ifndef DPMS_SERVER +_XFUNCPROTOBEGIN + +extern Bool DPMSQueryExtension(Display *, int *, int *); +extern Status DPMSGetVersion(Display *, int *, int *); +extern Bool DPMSCapable(Display *); +extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16); +extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *); +extern Status DPMSEnable(Display *); +extern Status DPMSDisable(Display *); +extern Status DPMSForceLevel(Display *, CARD16); +extern Status DPMSInfo(Display *, CARD16 *, BOOL *); + +_XFUNCPROTOEND +#endif + +#endif /* !_X11_EXTENSIONS_DPMS_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsconst.h new file mode 100644 index 0000000000000000000000000000000000000000..f46d2d9d6ea66e3ece0b6fe0c5c2194fb2f9d0f1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsconst.h @@ -0,0 +1,46 @@ +/***************************************************************** + +Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. + +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ + +#ifndef _DPMSCONST_H +#define _DPMSCONST_H 1 + +#define DPMSMajorVersion 1 +#define DPMSMinorVersion 2 + +#define DPMSExtensionName "DPMS" + +#define DPMSModeOn 0 +#define DPMSModeStandby 1 +#define DPMSModeSuspend 2 +#define DPMSModeOff 3 + +#define DPMSInfoNotifyMask (1L << 0) +#define DPMSInfoNotify 0 + +#endif /* !_DPMSCONST_H */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsproto.h new file mode 100644 index 0000000000000000000000000000000000000000..6b7e4191489716b47f398cfca5e64577282e8be4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dpmsproto.h @@ -0,0 +1,201 @@ +/***************************************************************** + +Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. + +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ + +#ifndef _DPMSPROTO_H_ +#define _DPMSPROTO_H_ + +#include + +#define X_DPMSGetVersion 0 +#define X_DPMSCapable 1 +#define X_DPMSGetTimeouts 2 +#define X_DPMSSetTimeouts 3 +#define X_DPMSEnable 4 +#define X_DPMSDisable 5 +#define X_DPMSForceLevel 6 +#define X_DPMSInfo 7 +#define X_DPMSSelectInput 8 + +#define DPMSNumberEvents 0 + +#define DPMSNumberErrors 0 + + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSGetVersion */ + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xDPMSGetVersionReq; +#define sz_xDPMSGetVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDPMSGetVersionReply; +#define sz_xDPMSGetVersionReply 32 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSCapable */ + CARD16 length; +} xDPMSCapableReq; +#define sz_xDPMSCapableReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + BOOL capable; + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xDPMSCapableReply; +#define sz_xDPMSCapableReply 32 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */ + CARD16 length; +} xDPMSGetTimeoutsReq; +#define sz_xDPMSGetTimeoutsReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 standby; + CARD16 suspend; + CARD16 off; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDPMSGetTimeoutsReply; +#define sz_xDPMSGetTimeoutsReply 32 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */ + CARD16 length; + CARD16 standby; + CARD16 suspend; + CARD16 off; + CARD16 pad0; +} xDPMSSetTimeoutsReq; +#define sz_xDPMSSetTimeoutsReq 12 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSEnable */ + CARD16 length; +} xDPMSEnableReq; +#define sz_xDPMSEnableReq 4 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSDisable */ + CARD16 length; +} xDPMSDisableReq; +#define sz_xDPMSDisableReq 4 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSForceLevel */ + CARD16 length; + CARD16 level; /* power level requested */ + CARD16 pad0; +} xDPMSForceLevelReq; +#define sz_xDPMSForceLevelReq 8 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSInfo */ + CARD16 length; +} xDPMSInfoReq; +#define sz_xDPMSInfoReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 power_level; + BOOL state; + CARD8 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xDPMSInfoReply; +#define sz_xDPMSInfoReply 32 + +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSSelectInput */ + CARD16 length B16; + CARD32 eventMask B32; +} xDPMSSelectInputReq; +#define sz_xDPMSSelectInputReq 8 + +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber B16; + CARD32 length; + CARD16 evtype B16; + CARD16 pad0 B16; + Time timestamp B32; + CARD16 power_level B16; + BOOL state; + CARD8 pad1; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xDPMSInfoNotifyEvent; +#define sz_xDPMSInfoNotifyEvent 32 + +#endif /* _DPMSPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dri2proto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dri2proto.h new file mode 100644 index 0000000000000000000000000000000000000000..c1775fddf09c58369d8fb0a74a4f540e48000259 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dri2proto.h @@ -0,0 +1,357 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifndef _DRI2_PROTO_H_ +#define _DRI2_PROTO_H_ + +#define DRI2_NAME "DRI2" +#define DRI2_MAJOR 1 +#define DRI2_MINOR 4 + +#define DRI2NumberErrors 0 +#define DRI2NumberEvents 2 +#define DRI2NumberRequests 14 + +#define X_DRI2QueryVersion 0 +#define X_DRI2Connect 1 +#define X_DRI2Authenticate 2 +#define X_DRI2CreateDrawable 3 +#define X_DRI2DestroyDrawable 4 +#define X_DRI2GetBuffers 5 +#define X_DRI2CopyRegion 6 +#define X_DRI2GetBuffersWithFormat 7 +#define X_DRI2SwapBuffers 8 +#define X_DRI2GetMSC 9 +#define X_DRI2WaitMSC 10 +#define X_DRI2WaitSBC 11 +#define X_DRI2SwapInterval 12 +#define X_DRI2GetParam 13 + +/* + * Events + */ +#define DRI2_BufferSwapComplete 0 +#define DRI2_InvalidateBuffers 1 + +typedef struct { + CARD32 attachment; + CARD32 name; + CARD32 pitch; + CARD32 cpp; + CARD32 flags; +} xDRI2Buffer; + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xDRI2QueryVersionReq; +#define sz_xDRI2QueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDRI2QueryVersionReply; +#define sz_xDRI2QueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 window; + CARD32 driverType; +} xDRI2ConnectReq; +#define sz_xDRI2ConnectReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 driverNameLength; + CARD32 deviceNameLength; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDRI2ConnectReply; +#define sz_xDRI2ConnectReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 window; + CARD32 magic; +} xDRI2AuthenticateReq; +#define sz_xDRI2AuthenticateReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 authenticated; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xDRI2AuthenticateReply; +#define sz_xDRI2AuthenticateReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; +} xDRI2CreateDrawableReq; +#define sz_xDRI2CreateDrawableReq 8 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; +} xDRI2DestroyDrawableReq; +#define sz_xDRI2DestroyDrawableReq 8 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 count; +} xDRI2GetBuffersReq; +#define sz_xDRI2GetBuffersReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 width; + CARD32 height; + CARD32 count; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDRI2GetBuffersReply; +#define sz_xDRI2GetBuffersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 region; + CARD32 dest; + CARD32 src; +} xDRI2CopyRegionReq; +#define sz_xDRI2CopyRegionReq 20 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xDRI2CopyRegionReply; +#define sz_xDRI2CopyRegionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 target_msc_hi; + CARD32 target_msc_lo; + CARD32 divisor_hi; + CARD32 divisor_lo; + CARD32 remainder_hi; + CARD32 remainder_lo; +} xDRI2SwapBuffersReq; +#define sz_xDRI2SwapBuffersReq 32 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 swap_hi; + CARD32 swap_lo; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDRI2SwapBuffersReply; +#define sz_xDRI2SwapBuffersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; +} xDRI2GetMSCReq; +#define sz_xDRI2GetMSCReq 8 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 target_msc_hi; + CARD32 target_msc_lo; + CARD32 divisor_hi; + CARD32 divisor_lo; + CARD32 remainder_hi; + CARD32 remainder_lo; +} xDRI2WaitMSCReq; +#define sz_xDRI2WaitMSCReq 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 target_sbc_hi; + CARD32 target_sbc_lo; +} xDRI2WaitSBCReq; +#define sz_xDRI2WaitSBCReq 16 + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 ust_hi; + CARD32 ust_lo; + CARD32 msc_hi; + CARD32 msc_lo; + CARD32 sbc_hi; + CARD32 sbc_lo; +} xDRI2MSCReply; +#define sz_xDRI2MSCReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 interval; +} xDRI2SwapIntervalReq; +#define sz_xDRI2SwapIntervalReq 12 + +typedef struct { + CARD8 type; + CARD8 pad; + CARD16 sequenceNumber; + CARD16 event_type; + CARD16 pad2; + CARD32 drawable; + CARD32 ust_hi; + CARD32 ust_lo; + CARD32 msc_hi; + CARD32 msc_lo; + CARD32 sbc_hi; + CARD32 sbc_lo; +} xDRI2BufferSwapComplete; +#define sz_xDRI2BufferSwapComplete 32 + +typedef struct { + CARD8 type; + CARD8 pad; + CARD16 sequenceNumber; + CARD16 event_type; + CARD16 pad2; + CARD32 drawable; + CARD32 ust_hi; + CARD32 ust_lo; + CARD32 msc_hi; + CARD32 msc_lo; + CARD32 sbc; +} xDRI2BufferSwapComplete2; +#define sz_xDRI2BufferSwapComplete2 32 + +typedef struct { + CARD8 type; + CARD8 pad; + CARD16 sequenceNumber; + CARD32 drawable; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xDRI2InvalidateBuffers; +#define sz_xDRI2InvalidateBuffers 32 + +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length; + CARD32 drawable; + CARD32 param; +} xDRI2GetParamReq; +#define sz_xDRI2GetParamReq 12 + +typedef struct { + BYTE type; /*X_Reply*/ + BOOL is_param_recognized; + CARD16 sequenceNumber; + CARD32 length; + CARD32 value_hi; + CARD32 value_lo; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xDRI2GetParamReply; +#define sz_xDRI2GetParamReply 32 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dri2tokens.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dri2tokens.h new file mode 100644 index 0000000000000000000000000000000000000000..bdca8665165a8b94039cce5155618571f931b7bc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dri2tokens.h @@ -0,0 +1,61 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifndef _DRI2_TOKENS_H_ +#define _DRI2_TOKENS_H_ + +#define DRI2BufferFrontLeft 0 +#define DRI2BufferBackLeft 1 +#define DRI2BufferFrontRight 2 +#define DRI2BufferBackRight 3 +#define DRI2BufferDepth 4 +#define DRI2BufferStencil 5 +#define DRI2BufferAccum 6 +#define DRI2BufferFakeFrontLeft 7 +#define DRI2BufferFakeFrontRight 8 +#define DRI2BufferDepthStencil 9 +#define DRI2BufferHiz 10 + +/* keep bits 16 and above for prime IDs */ +#define DRI2DriverPrimeMask 7 /* 0 - 7 - allows for 6 devices*/ +#define DRI2DriverPrimeShift 16 +#define DRI2DriverPrimeId(x) (((x) >> DRI2DriverPrimeShift) & (DRI2DriverPrimeMask)) + +#define DRI2DriverDRI 0 +#define DRI2DriverVDPAU 1 + +/* Event sub-types for the swap complete event */ +#define DRI2_EXCHANGE_COMPLETE 0x1 +#define DRI2_BLIT_COMPLETE 0x2 +#define DRI2_FLIP_COMPLETE 0x3 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/dri3proto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/dri3proto.h new file mode 100644 index 0000000000000000000000000000000000000000..a1fbed55c8151c85c3adb3c0fd2864395045dced --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/dri3proto.h @@ -0,0 +1,288 @@ +/* + * Copyright © 2013 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _DRI3_PROTO_H_ +#define _DRI3_PROTO_H_ + +#define DRI3_NAME "DRI3" +#define DRI3_MAJOR 1 +#define DRI3_MINOR 4 + +#define DRI3NumberErrors 0 +#define DRI3NumberEvents 0 + +#define X_DRI3QueryVersion 0 +#define X_DRI3Open 1 +#define X_DRI3PixmapFromBuffer 2 +#define X_DRI3BufferFromPixmap 3 +#define X_DRI3FenceFromFD 4 +#define X_DRI3FDFromFence 5 + +/* v1.2 */ +#define xDRI3GetSupportedModifiers 6 +#define xDRI3PixmapFromBuffers 7 +#define xDRI3BuffersFromPixmap 8 + +/* v1.3 */ +#define xDRI3SetDRMDeviceInUse 9 + +/* v1.4 */ +#define xDRI3ImportSyncobj 10 +#define xDRI3FreeSyncobj 11 + +#define DRI3NumberRequests 12 + +#define DRI3Syncobj CARD32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xDRI3QueryVersionReq; +#define sz_xDRI3QueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xDRI3QueryVersionReply; +#define sz_xDRI3QueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 drawable; + CARD32 provider; +} xDRI3OpenReq; +#define sz_xDRI3OpenReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xDRI3OpenReply; +#define sz_xDRI3OpenReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 pixmap; + CARD32 drawable; + CARD32 size; + CARD16 width; + CARD16 height; + CARD16 stride; + CARD8 depth; + CARD8 bpp; +} xDRI3PixmapFromBufferReq; + +#define sz_xDRI3PixmapFromBufferReq 24 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 pixmap; +} xDRI3BufferFromPixmapReq; +#define sz_xDRI3BufferFromPixmapReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; /* Number of file descriptors returned (1) */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 size; + CARD16 width; + CARD16 height; + CARD16 stride; + CARD8 depth; + CARD8 bpp; + CARD32 pad20; + CARD32 pad24; + CARD32 pad28; +} xDRI3BufferFromPixmapReply; +#define sz_xDRI3BufferFromPixmapReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 drawable; + CARD32 fence; + BOOL initially_triggered; + CARD8 pad13; + CARD16 pad14; +} xDRI3FenceFromFDReq; + +#define sz_xDRI3FenceFromFDReq 16 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 drawable; + CARD32 fence; +} xDRI3FDFromFenceReq; + +#define sz_xDRI3FDFromFenceReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; /* Number of file descriptors returned (1) */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad08; + CARD32 pad12; + CARD32 pad16; + CARD32 pad20; + CARD32 pad24; + CARD32 pad28; +} xDRI3FDFromFenceReply; + +#define sz_xDRI3FDFromFenceReply 32 + +/* v1.2 */ + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 window; + CARD8 depth; + CARD8 bpp; + CARD16 pad10; +} xDRI3GetSupportedModifiersReq; +#define sz_xDRI3GetSupportedModifiersReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numWindowModifiers; + CARD32 numScreenModifiers; + CARD32 pad16; + CARD32 pad20; + CARD32 pad24; + CARD32 pad28; +} xDRI3GetSupportedModifiersReply; +#define sz_xDRI3GetSupportedModifiersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 pixmap; + CARD32 window; + CARD8 num_buffers; /* Number of file descriptors passed */ + CARD8 pad13; + CARD16 pad14; + CARD16 width; + CARD16 height; + CARD32 stride0; + CARD32 offset0; + CARD32 stride1; + CARD32 offset1; + CARD32 stride2; + CARD32 offset2; + CARD32 stride3; + CARD32 offset3; + CARD8 depth; + CARD8 bpp; + CARD16 pad54; + CARD64 modifier; +} xDRI3PixmapFromBuffersReq; +#define sz_xDRI3PixmapFromBuffersReq 64 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 pixmap; +} xDRI3BuffersFromPixmapReq; +#define sz_xDRI3BuffersFromPixmapReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nfd; /* Number of file descriptors returned */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 width; + CARD16 height; + CARD32 pad12; + CARD64 modifier; + CARD8 depth; + CARD8 bpp; + CARD16 pad26; + CARD32 pad28; +} xDRI3BuffersFromPixmapReply; +#define sz_xDRI3BuffersFromPixmapReply 32 + +/* v1.3 */ + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + CARD32 window; + CARD32 drmMajor; + CARD32 drmMinor; +} xDRI3SetDRMDeviceInUseReq; +#define sz_xDRI3SetDRMDeviceInUseReq 16 + +/* v1.4 */ +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + DRI3Syncobj syncobj; + CARD32 drawable; +} xDRI3ImportSyncobjReq; +#define sz_xDRI3ImportSyncobjReq 12 + +typedef struct { + CARD8 reqType; + CARD8 dri3ReqType; + CARD16 length; + DRI3Syncobj syncobj; +} xDRI3FreeSyncobjReq; +#define sz_xDRI3FreeSyncobjReq 8 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/extutil.h b/data/miniconda3/envs/catiagent/include/X11/extensions/extutil.h new file mode 100644 index 0000000000000000000000000000000000000000..13b6808c87c7be1969c2eee6814d741bb134e277 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/extutil.h @@ -0,0 +1,192 @@ +/* + * +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Jim Fulton, MIT The Open Group + * + * Xlib Extension-Writing Utilities + * + * This package contains utilities for writing the client API for various + * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND + * ARE SUBJECT TO CHANGE! + */ + +#ifndef _EXTUTIL_H_ +#define _EXTUTIL_H_ + +#include + +/* + * We need to keep a list of open displays since the Xlib display list isn't + * public. We also have to per-display info in a separate block since it isn't + * stored directly in the Display structure. + */ +typedef struct _XExtDisplayInfo { + struct _XExtDisplayInfo *next; /* keep a linked list */ + Display *display; /* which display this is */ + XExtCodes *codes; /* the extension protocol codes */ + XPointer data; /* extra data for extension to use */ +} XExtDisplayInfo; + +typedef struct _XExtensionInfo { + XExtDisplayInfo *head; /* start of list */ + XExtDisplayInfo *cur; /* most recently used */ + int ndisplays; /* number of displays */ +} XExtensionInfo; + +typedef struct _XExtensionHooks { + int (*create_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*copy_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*flush_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*free_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*create_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*free_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*close_display)( + Display* /* display */, + XExtCodes* /* codes */ +); + Bool (*wire_to_event)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + Status (*event_to_wire)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + int (*error)( + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ +); + char *(*error_string)( + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ +); +} XExtensionHooks; + +extern XExtensionInfo *XextCreateExtension( + void +); +extern void XextDestroyExtension( + XExtensionInfo* /* info */ +); +extern XExtDisplayInfo *XextAddDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */, + _Xconst char* /* ext_name */, + XExtensionHooks* /* hooks */, + int /* nevents */, + XPointer /* data */ +); +extern int XextRemoveDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); +extern XExtDisplayInfo *XextFindDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); + +#define XextHasExtension(i) ((i) && ((i)->codes)) +#define XextCheckExtension(dpy,i,name,val) do { \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } \ +} while (0) +#define XextSimpleCheckExtension(dpy,i,name) do { \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } \ +} while (0) + + +/* + * helper macros to generate code that is common to all extensions; caller + * should prefix it with static if extension source is in one file; this + * could be a utility function, but have to stack 6 unused arguments for + * something that is called many, many times would be bad. + */ +#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ +XExtDisplayInfo *proc (Display *dpy) \ +{ \ + XExtDisplayInfo *dpyinfo; \ + if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ + if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ + dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ + return dpyinfo; \ +} + +#define XEXT_FIND_DISPLAY_PROTO(proc) \ + XExtDisplayInfo *proc(Display *dpy) + +#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ +int proc (Display *dpy, XExtCodes *codes) \ +{ \ + return XextRemoveDisplay (extinfo, dpy); \ +} + +#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ + int proc(Display *dpy, XExtCodes *codes) + +#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ +char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ +{ \ + code -= codes->first_error; \ + if (code >= 0 && code < nerr) { \ + char tmp[256]; \ + snprintf (tmp, sizeof(tmp), "%s.%d", extname, code); \ + XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ + return buf; \ + } \ + return (char *)0; \ +} + +#define XEXT_ERROR_STRING_PROTO(proc) \ + char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/ge.h b/data/miniconda3/envs/catiagent/include/X11/extensions/ge.h new file mode 100644 index 0000000000000000000000000000000000000000..aca1d8a241c5ec0951cfbdbc9734a4905d09c523 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/ge.h @@ -0,0 +1,60 @@ +/* + * Copyright © 2007-2008 Peter Hutterer + * + * 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 (including the next + * paragraph) 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. + * + * Authors: Peter Hutterer, University of South Australia, NICTA + * + */ + +#ifndef _GE_H_ +#define _GE_H_ + +#define GE_NAME "Generic Event Extension" +#define GE_MAJOR 1 +#define GE_MINOR 0 + +/********************************************************* + * + * Requests + * + */ + +#define X_GEQueryVersion 0 + +#define GENumberRequests (X_GEQueryVersion + 1) + +/********************************************************* + * + * Events + * + */ + +#define GENumberEvents 0 + +/********************************************************* + * + * Errors + * + */ + +#define GENumberErrors 0 + +#endif /* _GE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/geproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/geproto.h new file mode 100644 index 0000000000000000000000000000000000000000..7b34be21d1a9e62df4b00d5e1c6ae3045046a741 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/geproto.h @@ -0,0 +1,85 @@ +/* + * Copyright © 2007-2008 Peter Hutterer + * + * 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 (including the next + * paragraph) 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. + * + * Authors: Peter Hutterer, University of South Australia, NICTA + * + */ + +#ifndef _GEPROTO_H_ +#define _GEPROTO_H_ + +#include +#include +#include + + +/********************************************************* + * + * Protocol request constants + * + */ + +#define X_GEGetExtensionVersion 1 + +/********************************************************* + * + * XGE protocol requests/replies + * + */ + +/* generic request */ +typedef struct { + CARD8 reqType; + CARD8 ReqType; + CARD16 length; +} xGEReq; + + +/* QueryVersion */ +typedef struct { + CARD8 reqType; /* input extension major code */ + CARD8 ReqType; /* always X_GEQueryVersion */ + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xGEQueryVersionReq; + +#define sz_xGEQueryVersionReq 8 + +typedef struct { + CARD8 repType; /* X_Reply */ + CARD8 RepType; /* always X_GEQueryVersion */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad00; + CARD32 pad01; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; +} xGEQueryVersionReply; + +#define sz_xGEQueryVersionReply 32 + +#endif /* _GEPROTO_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/lbx.h b/data/miniconda3/envs/catiagent/include/X11/extensions/lbx.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd24ff1fa5127aec70687fd44f1a6b789cdea9d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/lbx.h @@ -0,0 +1,73 @@ +/* + * Copyright 1992 Network Computing Devices + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of NCD. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. NCD. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifndef _LBX_H_ +#define _LBX_H_ + +#define LBXNAME "LBX" + +#define LBX_MAJOR_VERSION 1 +#define LBX_MINOR_VERSION 0 + +#define LbxNumberReqs 44 +#define LbxEvent 0 +#define LbxQuickMotionDeltaEvent 1 +#define LbxNumberEvents 2 + +/* This is always the master client */ +#define LbxMasterClientIndex 0 + +/* LbxEvent lbxType sub-fields */ +#define LbxSwitchEvent 0 +#define LbxCloseEvent 1 +#define LbxDeltaEvent 2 +#define LbxInvalidateTagEvent 3 +#define LbxSendTagDataEvent 4 +#define LbxListenToOne 5 +#define LbxListenToAll 6 +#define LbxMotionDeltaEvent 7 +#define LbxReleaseCmapEvent 8 +#define LbxFreeCellsEvent 9 + +/* + * Lbx image compression methods + * + * No compression is always assigned the value of 0. + * + * The rest of the compression method opcodes are assigned dynamically + * at option negotiation time. + */ + +#define LbxImageCompressNone 0 + + +#define BadLbxClient 0 +#define LbxNumberErrors (BadLbxClient + 1) + +/* tagged data types */ +#define LbxTagTypeModmap 1 +#define LbxTagTypeKeymap 2 +#define LbxTagTypeProperty 3 +#define LbxTagTypeFont 4 +#define LbxTagTypeConnInfo 5 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/lbxproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/lbxproto.h new file mode 100644 index 0000000000000000000000000000000000000000..8e858aa7c903088ab1ff394cac4095d8462222e0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/lbxproto.h @@ -0,0 +1,975 @@ +/* + * Copyright 1992 Network Computing Devices + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of NCD. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. NCD. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifndef _LBXPROTO_H_ +#define _LBXPROTO_H_ + +#include +/* + * NOTE: any changes or additions to the opcodes needs to be reflected + * in the lbxCacheable array in Xserver/lbx/lbxmain.c + */ + +#define X_LbxQueryVersion 0 +#define X_LbxStartProxy 1 +#define X_LbxStopProxy 2 +#define X_LbxSwitch 3 +#define X_LbxNewClient 4 +#define X_LbxCloseClient 5 +#define X_LbxModifySequence 6 +#define X_LbxAllowMotion 7 +#define X_LbxIncrementPixel 8 +#define X_LbxDelta 9 +#define X_LbxGetModifierMapping 10 +#define X_LbxInvalidateTag 12 +#define X_LbxPolyPoint 13 +#define X_LbxPolyLine 14 +#define X_LbxPolySegment 15 +#define X_LbxPolyRectangle 16 +#define X_LbxPolyArc 17 +#define X_LbxFillPoly 18 +#define X_LbxPolyFillRectangle 19 +#define X_LbxPolyFillArc 20 +#define X_LbxGetKeyboardMapping 21 +#define X_LbxQueryFont 22 +#define X_LbxChangeProperty 23 +#define X_LbxGetProperty 24 +#define X_LbxTagData 25 + +#define X_LbxCopyArea 26 +#define X_LbxCopyPlane 27 +#define X_LbxPolyText8 28 +#define X_LbxPolyText16 29 +#define X_LbxImageText8 30 +#define X_LbxImageText16 31 + +#define X_LbxQueryExtension 32 +#define X_LbxPutImage 33 +#define X_LbxGetImage 34 + +#define X_LbxBeginLargeRequest 35 +#define X_LbxLargeRequestData 36 +#define X_LbxEndLargeRequest 37 + +#define X_LbxInternAtoms 38 +#define X_LbxGetWinAttrAndGeom 39 + +#define X_LbxGrabCmap 40 +#define X_LbxReleaseCmap 41 +#define X_LbxAllocColor 42 + +#define X_LbxSync 43 + +/* + * Redefine some basic types used by structures defined herein. This removes + * any possibility on 64-bit architectures of one entity viewing communicated + * data as 32-bit quantities and another entity viewing the same data as 64-bit + * quantities. + */ +#define XID CARD32 +#define Atom CARD32 +#define Colormap CARD32 +#define Drawable CARD32 +#define VisualID CARD32 +#define Window CARD32 + +typedef struct { + BOOL success; /* TRUE */ + BOOL changeType; + CARD16 majorVersion, + minorVersion; + CARD16 length; /* 1/4 additional bytes in setup info */ + CARD32 tag; +} xLbxConnSetupPrefix; + +typedef struct _LbxQueryVersion { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxQueryVersion */ + CARD16 length; +} xLbxQueryVersionReq; +#define sz_xLbxQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of LBX protocol */ + CARD16 minorVersion; /* minor version of LBX protocol */ + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxQueryVersionReply; +#define sz_xLbxQueryVersionReply 32 + +typedef struct _LbxStartProxy { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxStartProxy */ + CARD16 length; +} xLbxStartProxyReq; +#define sz_xLbxStartProxyReq 4 + +typedef struct _LbxStopProxy { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxStopProxy */ + CARD16 length; +} xLbxStopProxyReq; +#define sz_xLbxStopProxyReq 4 + +typedef struct _LbxSwitch { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxSwitch */ + CARD16 length; + CARD32 client; /* new client */ +} xLbxSwitchReq; +#define sz_xLbxSwitchReq 8 + +typedef struct _LbxNewClient { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxNewClient */ + CARD16 length; + CARD32 client; /* new client */ +} xLbxNewClientReq; +#define sz_xLbxNewClientReq 8 + +typedef struct _LbxCloseClient { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxCloseClient */ + CARD16 length; + CARD32 client; /* new client */ +} xLbxCloseClientReq; +#define sz_xLbxCloseClientReq 8 + +typedef struct _LbxModifySequence { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxModifySequence */ + CARD16 length; + CARD32 adjust; +} xLbxModifySequenceReq; +#define sz_xLbxModifySequenceReq 8 + +typedef struct _LbxAllowMotion { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxAllowMotion */ + CARD16 length; + CARD32 num; +} xLbxAllowMotionReq; +#define sz_xLbxAllowMotionReq 8 + +typedef struct { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGrabCmap */ + CARD16 length; + Colormap cmap; +} xLbxGrabCmapReq; +#define sz_xLbxGrabCmapReq 8 + +#define LBX_SMART_GRAB 0x80 +#define LBX_AUTO_RELEASE 0x40 +#define LBX_3CHANNELS 0x20 +#define LBX_2BYTE_PIXELS 0x10 +#define LBX_RGB_BITS_MASK 0x0f + +#define LBX_LIST_END 0 +#define LBX_PIXEL_PRIVATE 1 +#define LBX_PIXEL_SHARED 2 +#define LBX_PIXEL_RANGE_PRIVATE 3 +#define LBX_PIXEL_RANGE_SHARED 4 +#define LBX_NEXT_CHANNEL 5 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 flags; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xLbxGrabCmapReply; +#define sz_xLbxGrabCmapReply 32 +#define sz_xLbxGrabCmapReplyHdr 8 + + +typedef struct { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxReleaseCmap */ + CARD16 length; + Colormap cmap; +} xLbxReleaseCmapReq; +#define sz_xLbxReleaseCmapReq 8 + +typedef struct { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxAllocColor */ + CARD16 length; + Colormap cmap; + CARD32 pixel; + CARD16 red, green, blue; + CARD16 pad; +} xLbxAllocColorReq; +#define sz_xLbxAllocColorReq 20 + +typedef struct _LbxIncrementPixel { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxIncrementPixel */ + CARD16 length; + CARD32 cmap; + CARD32 pixel; +} xLbxIncrementPixelReq; +#define sz_xLbxIncrementPixelReq 12 + +typedef struct _LbxDelta { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxDelta */ + CARD16 length; + CARD8 diffs; /* number of diffs */ + CARD8 cindex; /* cache index */ + /* list of diffs follows */ +} xLbxDeltaReq; +#define sz_xLbxDeltaReq 6 + +typedef struct _LbxGetModifierMapping { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGetModifierMapping */ + CARD16 length; +} xLbxGetModifierMappingReq; +#define sz_xLbxGetModifierMappingReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 keyspermod; + CARD16 sequenceNumber; + CARD32 length; + CARD32 tag; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxGetModifierMappingReply; +#define sz_xLbxGetModifierMappingReply 32 + +typedef struct _LbxGetKeyboardMapping { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */ + CARD16 length; + KeyCode firstKeyCode; + CARD8 count; + CARD16 pad1; +} xLbxGetKeyboardMappingReq; +#define sz_xLbxGetKeyboardMappingReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 keysperkeycode; + CARD16 sequenceNumber; + CARD32 length; + CARD32 tag; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxGetKeyboardMappingReply; +#define sz_xLbxGetKeyboardMappingReply 32 + +typedef struct _LbxQueryFont { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxQueryFont */ + CARD16 length; + CARD32 fid; +} xLbxQueryFontReq; +#define sz_xLbxQueryFontReq 8 + +typedef struct _LbxInternAtoms { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxInternAtoms */ + CARD16 length; + CARD16 num; +} xLbxInternAtomsReq; +#define sz_xLbxInternAtomsReq 6 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD32 atomsStart; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxInternAtomsReply; +#define sz_xLbxInternAtomsReply 32 +#define sz_xLbxInternAtomsReplyHdr 8 + + +typedef struct _LbxGetWinAttrAndGeom { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */ + CARD16 length; + CARD32 id; /* window id */ +} xLbxGetWinAttrAndGeomReq; +#define sz_xLbxGetWinAttrAndGeomReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 backingStore; + CARD16 sequenceNumber; + CARD32 length; /* NOT 0; this is an extra-large reply */ + VisualID visualID; +#if defined(__cplusplus) || defined(c_plusplus) + CARD16 c_class; +#else + CARD16 class; +#endif + CARD8 bitGravity; + CARD8 winGravity; + CARD32 backingBitPlanes; + CARD32 backingPixel; + BOOL saveUnder; + BOOL mapInstalled; + CARD8 mapState; + BOOL override; + Colormap colormap; + CARD32 allEventMasks; + CARD32 yourEventMask; + CARD16 doNotPropagateMask; + CARD16 pad1; + Window root; + INT16 x, y; + CARD16 width, height; + CARD16 borderWidth; + CARD8 depth; + CARD8 pad2; +} xLbxGetWinAttrAndGeomReply; +#define sz_xLbxGetWinAttrAndGeomReply 60 + + +typedef struct { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxSync */ + CARD16 length; +} xLbxSyncReq; +#define sz_xLbxSyncReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xLbxSyncReply; +#define sz_xLbxSyncReply 32 + + +/* an LBX squished charinfo packs the data in a CARD32 as follows */ +#define LBX_WIDTH_SHIFT 26 +#define LBX_LEFT_SHIFT 20 +#define LBX_RIGHT_SHIFT 13 +#define LBX_ASCENT_SHIFT 7 +#define LBX_DESCENT_SHIFT 0 + +#define LBX_WIDTH_BITS 6 +#define LBX_LEFT_BITS 6 +#define LBX_RIGHT_BITS 7 +#define LBX_ASCENT_BITS 6 +#define LBX_DESCENT_BITS 7 + +#define LBX_WIDTH_MASK 0xfc000000 +#define LBX_LEFT_MASK 0x03f00000 +#define LBX_RIGHT_MASK 0x000fe000 +#define LBX_ASCENT_MASK 0x00001f80 +#define LBX_DESCENT_MASK 0x0000007f + +#define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1))) + +typedef struct { + CARD32 metrics; +} xLbxCharInfo; + +/* note that this is identical to xQueryFontReply except for missing + * first 2 words + */ +typedef struct { + xCharInfo minBounds; +/* XXX do we need to leave this gunk? */ +#ifndef WORD64 + CARD32 walign1; +#endif + xCharInfo maxBounds; +#ifndef WORD64 + CARD32 walign2; +#endif + CARD16 minCharOrByte2, maxCharOrByte2; + CARD16 defaultChar; + CARD16 nFontProps; /* followed by this many xFontProp structures */ + CARD8 drawDirection; + CARD8 minByte1, maxByte1; + BOOL allCharsExist; + INT16 fontAscent, fontDescent; + CARD32 nCharInfos; /* followed by this many xLbxCharInfo structures */ +} xLbxFontInfo; + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 compression; + CARD16 sequenceNumber; + CARD32 length; + CARD32 tag; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + /* X_QueryFont sticks much of the data in the base reply packet, + * but we hope that it won't be needed, (and it won't fit in 32 bytes + * with the tag anyways) + * + * if any additional data is needed, its sent in a xLbxFontInfo + */ +} xLbxQueryFontReply; +#define sz_xLbxQueryFontReply 32 + +typedef struct _LbxChangeProperty { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxChangeProperty */ + CARD16 length; + Window window; + Atom property; + Atom type; + CARD8 format; + CARD8 mode; + BYTE pad[2]; + CARD32 nUnits; +} xLbxChangePropertyReq; +#define sz_xLbxChangePropertyReq 24 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad; + CARD16 sequenceNumber; + CARD32 length; + CARD32 tag; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxChangePropertyReply; +#define sz_xLbxChangePropertyReply 32 + +typedef struct _LbxGetProperty { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGetProperty */ + CARD16 length; + Window window; + Atom property; + Atom type; + CARD8 delete; + BYTE pad[3]; + CARD32 longOffset; + CARD32 longLength; +} xLbxGetPropertyReq; +#define sz_xLbxGetPropertyReq 28 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 format; + CARD16 sequenceNumber; + CARD32 length; + Atom propertyType; + CARD32 bytesAfter; + CARD32 nItems; + CARD32 tag; + CARD32 pad1; + CARD32 pad2; +} xLbxGetPropertyReply; +#define sz_xLbxGetPropertyReply 32 + +typedef struct _LbxTagData { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxTagData */ + CARD16 length; + XID tag; + CARD32 real_length; + /* data */ +} xLbxTagDataReq; +#define sz_xLbxTagDataReq 12 + +typedef struct _LbxInvalidateTag { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxInvalidateTag */ + CARD16 length; + CARD32 tag; +} xLbxInvalidateTagReq; +#define sz_xLbxInvalidateTagReq 8 + +typedef struct _LbxPutImage { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxPutImage */ + CARD16 length; + CARD8 compressionMethod; + CARD8 cacheEnts; + CARD8 bitPacked; + /* rest is variable */ +} xLbxPutImageReq; +#define sz_xLbxPutImageReq 7 + +typedef struct { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxGetImage */ + CARD16 length; + Drawable drawable; + INT16 x, y; + CARD16 width, height; + CARD32 planeMask; + CARD8 format; + CARD8 pad1; + CARD16 pad2; +} xLbxGetImageReq; + +#define sz_xLbxGetImageReq 24 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 depth; + CARD16 sequenceNumber; + CARD32 lbxLength; + CARD32 xLength; + VisualID visual; + CARD8 compressionMethod; + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xLbxGetImageReply; + +#define sz_xLbxGetImageReply 32 + +/* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment, + LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */ + +#define GFX_CACHE_SIZE 15 + +#define GFXdCacheEnt(e) ((e) & 0xf) +#define GFXgCacheEnt(e) (((e) >> 4) & 0xf) +#define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4)) + +#define GFXCacheNone 0xf + +typedef struct _LbxPolyPoint { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD8 cacheEnts; + CARD8 padBytes; +} xLbxPolyPointReq; + +#define sz_xLbxPolyPointReq 6 + +typedef xLbxPolyPointReq xLbxPolyLineReq; +typedef xLbxPolyPointReq xLbxPolySegmentReq; +typedef xLbxPolyPointReq xLbxPolyRectangleReq; +typedef xLbxPolyPointReq xLbxPolyArcReq; +typedef xLbxPolyPointReq xLbxPolyFillRectangleReq; +typedef xLbxPolyPointReq xLbxPolyFillArcReq; + +#define sz_xLbxPolyLineReq sz_xLbxPolyPointReq +#define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq +#define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq +#define sz_xLbxPolyArcReq sz_xLbxPolyPointReq +#define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq +#define sz_xLbxPolyFillArc sz_xLbxPolyPointReq + +typedef struct _LbxFillPoly { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD8 cacheEnts; + BYTE shape; + CARD8 padBytes; +} xLbxFillPolyReq; +#define sz_xLbxFillPolyReq 7 + +typedef struct _LbxCopyArea { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD8 srcCache; /* source drawable */ + CARD8 cacheEnts; /* dest drawable and gc */ + /* followed by encoded src x, src y, dst x, dst y, width, height */ +} xLbxCopyAreaReq; + +#define sz_xLbxCopyAreaReq 6 + +typedef struct _LbxCopyPlane { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD32 bitPlane; + CARD8 srcCache; /* source drawable */ + CARD8 cacheEnts; /* dest drawable and gc */ + /* followed by encoded src x, src y, dst x, dst y, width, height */ +} xLbxCopyPlaneReq; + +#define sz_xLbxCopyPlaneReq 10 + +typedef struct _LbxPolyText { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD8 cacheEnts; + /* followed by encoded src x, src y coordinates and text elts */ +} xLbxPolyTextReq; + +#define sz_xLbxPolyTextReq 5 + +typedef xLbxPolyTextReq xLbxPolyText8Req; +typedef xLbxPolyTextReq xLbxPolyText16Req; + +#define sz_xLbxPolyTextReq 5 +#define sz_xLbxPolyText8Req 5 +#define sz_xLbxPolyText16Req 5 + +typedef struct _LbxImageText { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; + CARD16 length; + CARD8 cacheEnts; + CARD8 nChars; + /* followed by encoded src x, src y coordinates and string */ +} xLbxImageTextReq; + +typedef xLbxImageTextReq xLbxImageText8Req; +typedef xLbxImageTextReq xLbxImageText16Req; + +#define sz_xLbxImageTextReq 6 +#define sz_xLbxImageText8Req 6 +#define sz_xLbxImageText16Req 6 + +typedef struct { + CARD8 offset; + CARD8 diff; +} xLbxDiffItem; +#define sz_xLbxDiffItem 2 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 nOpts; + CARD16 sequenceNumber; + CARD32 length; + CARD32 optDataStart; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxStartReply; +#define sz_xLbxStartReply 32 +#define sz_xLbxStartReplyHdr 8 + +typedef struct _LbxQueryExtension { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxQueryExtension */ + CARD16 length; + CARD32 nbytes; +} xLbxQueryExtensionReq; +#define sz_xLbxQueryExtensionReq 8 + +typedef struct _LbxQueryExtensionReply { + BYTE type; /* X_Reply */ + CARD8 numReqs; + CARD16 sequenceNumber; + CARD32 length; + BOOL present; + CARD8 major_opcode; + CARD8 first_event; + CARD8 first_error; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + + /* reply & event generating requests */ +} xLbxQueryExtensionReply; +#define sz_xLbxQueryExtensionReply 32 + + +typedef struct _LbxBeginLargeRequest { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */ + CARD16 length; + CARD32 largeReqLength; +} xLbxBeginLargeRequestReq; +#define sz_BeginLargeRequestReq 8 + +typedef struct _LbxLargeRequestData { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxLargeRequestData */ + CARD16 length; + /* followed by LISTofCARD8 data */ +} xLbxLargeRequestDataReq; +#define sz_LargeRequestDataReq 4 + +typedef struct _LbxEndLargeRequest { + CARD8 reqType; /* always LbxReqCode */ + CARD8 lbxReqType; /* always X_LbxEndLargeRequest */ + CARD16 length; +} xLbxEndLargeRequestReq; +#define sz_EndLargeRequestReq 4 + + + +typedef struct _LbxSwitchEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxSwitchEvent */ + CARD16 pad; + CARD32 client; +} xLbxSwitchEvent; +#define sz_xLbxSwitchEvent 8 + +typedef struct _LbxCloseEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxCloseEvent */ + CARD16 sequenceNumber; + CARD32 client; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xLbxCloseEvent; +#define sz_xLbxCloseEvent 32 + +typedef struct _LbxInvalidateTagEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxInvalidateTagEvent */ + CARD16 sequenceNumber; + CARD32 tag; + CARD32 tagType; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xLbxInvalidateTagEvent; +#define sz_xLbxInvalidateTagEvent 32 + +typedef struct _LbxSendTagDataEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxSendTagDataEvent */ + CARD16 sequenceNumber; + CARD32 tag; + CARD32 tagType; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xLbxSendTagDataEvent; +#define sz_xLbxSendTagDataEvent 32 + +typedef struct _LbxListenToOneEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxListenToOneEvent */ + CARD16 sequenceNumber; + CARD32 client; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xLbxListenToOneEvent; +#define sz_xLbxListenToOneEvent 32 + +typedef struct _LbxListenToAllEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxListenToAllEvent */ + CARD16 sequenceNumber; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xLbxListenToAllEvent; +#define sz_xLbxListenToOneEvent 32 + +typedef struct _LbxReleaseCmapEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxReleaseCmapEvent */ + CARD16 sequenceNumber; + Colormap colormap; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xLbxReleaseCmapEvent; +#define sz_xLbxReleaseCmapEvent 32 + + +typedef struct _LbxFreeCellsEvent { + BYTE type; /* always eventBase + LbxEvent */ + BYTE lbxType; /* LbxFreeCellsEvent */ + CARD16 sequenceNumber; + Colormap colormap; + CARD32 pixelStart; + CARD32 pixelEnd; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xLbxFreeCellsEvent; +#define sz_xLbxFreeCellsEvent 32 + + +/* + * squished X event sizes. If these change, be sure to update lbxquish.c + * and unsquish.c appropriately + * + * lbxsz_* is the padded squished length + * lbxupsz_* is the unpadded squished length + */ + +#define lbxsz_KeyButtonEvent 32 +#define lbxupsz_KeyButtonEvent 31 + +#define lbxsz_EnterLeaveEvent 32 +#define lbxupsz_EnterLeaveEvent 32 + +#define lbxsz_FocusEvent 12 +#define lbxupsz_FocusEvent 9 + +#define lbxsz_KeymapEvent 32 +#define lbxupsz_KeymapEvent 32 + +#define lbxsz_ExposeEvent 20 +#define lbxupsz_ExposeEvent 18 + +#define lbxsz_GfxExposeEvent 24 +#define lbxupsz_GfxExposeEvent 21 + +#define lbxsz_NoExposeEvent 12 +#define lbxupsz_NoExposeEvent 11 + +#define lbxsz_VisibilityEvent 12 +#define lbxupsz_VisibilityEvent 9 + +#define lbxsz_CreateNotifyEvent 24 +#define lbxupsz_CreateNotifyEvent 23 + +#define lbxsz_DestroyNotifyEvent 12 +#define lbxupsz_DestroyNotifyEvent 12 + +#define lbxsz_UnmapNotifyEvent 16 +#define lbxupsz_UnmapNotifyEvent 13 + +#define lbxsz_MapNotifyEvent 16 +#define lbxupsz_MapNotifyEvent 13 + +#define lbxsz_MapRequestEvent 12 +#define lbxupsz_MapRequestEvent 12 + +#define lbxsz_ReparentEvent 24 +#define lbxupsz_ReparentEvent 21 + +#define lbxsz_ConfigureNotifyEvent 28 +#define lbxupsz_ConfigureNotifyEvent 27 + +#define lbxsz_ConfigureRequestEvent 28 +#define lbxupsz_ConfigureRequestEvent 28 + +#define lbxsz_GravityEvent 16 +#define lbxupsz_GravityEvent 16 + +#define lbxsz_ResizeRequestEvent 12 +#define lbxupsz_ResizeRequestEvent 12 + +#define lbxsz_CirculateEvent 20 +#define lbxupsz_CirculateEvent 17 + +#define lbxsz_PropertyEvent 20 +#define lbxupsz_PropertyEvent 17 + +#define lbxsz_SelectionClearEvent 16 +#define lbxupsz_SelectionClearEvent 16 + +#define lbxsz_SelectionRequestEvent 28 +#define lbxupsz_SelectionRequestEvent 28 + +#define lbxsz_SelectionNotifyEvent 24 +#define lbxupsz_SelectionNotifyEvent 24 + +#define lbxsz_ColormapEvent 16 +#define lbxupsz_ColormapEvent 14 + +#define lbxsz_MappingNotifyEvent 8 +#define lbxupsz_MappingNotifyEvent 7 + +#define lbxsz_ClientMessageEvent 32 +#define lbxupsz_ClientMessageEvent 32 + +#define lbxsz_UnknownEvent 32 + +#ifdef DEBUG + +#define DBG_SWITCH 0x00000001 +#define DBG_CLOSE 0x00000002 +#define DBG_IO 0x00000004 +#define DBG_READ_REQ 0x00000008 +#define DBG_LEN 0x00000010 +#define DBG_BLOCK 0x00000020 +#define DBG_CLIENT 0x00000040 +#define DBG_DELTA 0x00000080 +#endif +/* + * Cancel the previous redefinition of the basic types, thus restoring their + * X.h definitions. + */ + +#undef XID +#undef Atom +#undef Colormap +#undef Drawable +#undef VisualID +#undef Window + +#endif /* _LBXPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscconst.h new file mode 100644 index 0000000000000000000000000000000000000000..adc5f94200bc3c5f71de5b00e43a31478ffe144d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscconst.h @@ -0,0 +1,38 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */ + + +#ifndef _MITMISCCONST_H_ +#define _MITMISCCONST_H_ + +#define MITMiscNumberEvents 0 +#define MITMiscNumberErrors 0 + +#define MITMISCNAME "MIT-SUNDRY-NONSTANDARD" + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscproto.h new file mode 100644 index 0000000000000000000000000000000000000000..d42e4fce300d1c21e4af6e11c5efa5b5c6cd4e18 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/mitmiscproto.h @@ -0,0 +1,68 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */ + +#ifndef _MITMISCPROTO_H_ +#define _MITMISCPROTO_H_ + +#include + +#define X_MITSetBugMode 0 +#define X_MITGetBugMode 1 + +typedef struct _SetBugMode { + CARD8 reqType; /* always MITReqCode */ + CARD8 mitReqType; /* always X_MITSetBugMode */ + CARD16 length; + BOOL onOff; + BYTE pad0; + CARD16 pad1; +} xMITSetBugModeReq; +#define sz_xMITSetBugModeReq 8 + +typedef struct _GetBugMode { + CARD8 reqType; /* always MITReqCode */ + CARD8 mitReqType; /* always X_MITGetBugMode */ + CARD16 length; +} xMITGetBugModeReq; +#define sz_xMITGetBugModeReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL onOff; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xMITGetBugModeReply; +#define sz_xMITGetBugModeReply 32 + +#endif /* _MITMISCPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/multibuf.h b/data/miniconda3/envs/catiagent/include/X11/extensions/multibuf.h new file mode 100644 index 0000000000000000000000000000000000000000..908db1ecce76505fa6e795fa602fd5670facba0c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/multibuf.h @@ -0,0 +1,207 @@ +/* + * +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + */ + +#ifndef _MULTIBUF_H_ +#define _MULTIBUF_H_ + +#include + +#include + +#define MbufGetReq(name,req,info) GetReq (name, req); \ + req->reqType = info->codes->major_opcode; \ + req->mbufReqType = X_##name; + +/* + * Extra definitions that will only be needed in the client + */ +typedef XID Multibuffer; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + int send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Multibuffer buffer; /* buffer of event */ + int state; /* see Clobbered constants above */ +} XmbufClobberNotifyEvent; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + int send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Multibuffer buffer; /* buffer of event */ +} XmbufUpdateNotifyEvent; + + +/* + * per-window attributes that can be got + */ +typedef struct { + int displayed_index; /* which buffer is being displayed */ + int update_action; /* Undefined, Background, Untouched, Copied */ + int update_hint; /* Frequent, Intermittent, Static */ + int window_mode; /* Mono, Stereo */ + int nbuffers; /* Number of buffers */ + Multibuffer *buffers; /* Buffers */ +} XmbufWindowAttributes; + +/* + * per-window attributes that can be set + */ +typedef struct { + int update_hint; /* Frequent, Intermittent, Static */ +} XmbufSetWindowAttributes; + + +/* + * per-buffer attributes that can be got + */ +typedef struct { + Window window; /* which window this belongs to */ + unsigned long event_mask; /* events that have been selected */ + int buffer_index; /* which buffer is this */ + int side; /* Mono, Left, Right */ +} XmbufBufferAttributes; + +/* + * per-buffer attributes that can be set + */ +typedef struct { + unsigned long event_mask; /* events that have been selected */ +} XmbufSetBufferAttributes; + + +/* + * per-screen buffer info (there will be lists of them) + */ +typedef struct { + VisualID visualid; /* visual usable at this depth */ + int max_buffers; /* most buffers for this visual */ + int depth; /* depth of buffers to be created */ +} XmbufBufferInfo; + +_XFUNCPROTOBEGIN + +extern Bool XmbufQueryExtension( + Display* /* dpy */, + int* /* event_base_return */, + int* /* error_base_return */ +); + +extern Status XmbufGetVersion( + Display* /* dpy */, + int* /* major_version_return */, + int* /* minor_version_return */ +); + +extern int XmbufCreateBuffers( + Display* /* dpy */, + Window /* w */, + int /* count */, + int /* update_action */, + int /* update_hint */, + Multibuffer* /* buffers */ +); + +extern void XmbufDestroyBuffers( + Display* /* dpy */, + Window /* window */ +); + +extern void XmbufDisplayBuffers( + Display* /* dpy */, + int /* count */, + Multibuffer* /* buffers */, + int /* min_delay */, + int /* max_delay */ +); + +extern Status XmbufGetWindowAttributes( + Display* /* dpy */, + Window /* w */, + XmbufWindowAttributes* /* attr */ +); + +extern void XmbufChangeWindowAttributes( + Display* /* dpy */, + Window /* w */, + unsigned long /* valuemask */, + XmbufSetWindowAttributes* /* attr */ +); + +extern Status XmbufGetBufferAttributes( + Display* /* dpy */, + Multibuffer /* b */, + XmbufBufferAttributes* /* attr */ +); + +extern void XmbufChangeBufferAttributes( + Display* /* dpy */, + Multibuffer /* b */, + unsigned long /* valuemask */, + XmbufSetBufferAttributes* /* attr */ +); + +extern Status XmbufGetScreenInfo( + Display* /* dpy */, + Drawable /* d */, + int* /* nmono_return */, + XmbufBufferInfo** /* mono_info_return */, + int* /* nstereo_return */, + XmbufBufferInfo** /* stereo_info_return */ +); + +extern Window XmbufCreateStereoWindow( + Display* /* dpy */, + Window /* parent */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* border_width */, + int /* depth */, + unsigned int /* class */, + Visual* /* visual */, + unsigned long /* valuemask */, + XSetWindowAttributes* /* attr */, + Multibuffer* /* leftp */, + Multibuffer* /* rightp */ +); + +extern void XmbufClearBufferArea( + Display* /* dpy */, + Multibuffer /* buffer */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + Bool /* exposures */ +); + +_XFUNCPROTOEND + +#endif /* _MULTIBUF_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/multibufconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/multibufconst.h new file mode 100644 index 0000000000000000000000000000000000000000..2d1238c31fd8cde7633ded6690aec9c1c50c04a4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/multibufconst.h @@ -0,0 +1,83 @@ +/* +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + */ + +#ifndef _MULTIBUFCONST_H_ +#define _MULTIBUFCONST_H_ + +#define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering" + +#define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */ +#define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */ + +/* + * update_action field + */ +#define MultibufferUpdateActionUndefined 0 +#define MultibufferUpdateActionBackground 1 +#define MultibufferUpdateActionUntouched 2 +#define MultibufferUpdateActionCopied 3 + +/* + * update_hint field + */ +#define MultibufferUpdateHintFrequent 0 +#define MultibufferUpdateHintIntermittent 1 +#define MultibufferUpdateHintStatic 2 + +/* + * valuemask fields + */ +#define MultibufferWindowUpdateHint (1L << 0) +#define MultibufferBufferEventMask (1L << 0) + +/* + * mono vs. stereo and left vs. right + */ +#define MultibufferModeMono 0 +#define MultibufferModeStereo 1 +#define MultibufferSideMono 0 +#define MultibufferSideLeft 1 +#define MultibufferSideRight 2 + +/* + * clobber state + */ +#define MultibufferUnclobbered 0 +#define MultibufferPartiallyClobbered 1 +#define MultibufferFullyClobbered 2 + +/* + * event stuff + */ +#define MultibufferClobberNotifyMask 0x02000000 +#define MultibufferUpdateNotifyMask 0x04000000 + +#define MultibufferClobberNotify 0 +#define MultibufferUpdateNotify 1 +#define MultibufferNumberEvents (MultibufferUpdateNotify + 1) + +#define MultibufferBadBuffer 0 +#define MultibufferNumberErrors (MultibufferBadBuffer + 1) + +#endif /* _MULTIBUFCONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/multibufproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/multibufproto.h new file mode 100644 index 0000000000000000000000000000000000000000..19a640102ea163bc408ec0fc33c4b78bb71203b3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/multibufproto.h @@ -0,0 +1,295 @@ +/* +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + */ + +#ifndef _MULTIBUFPROTO_H_ +#define _MULTIBUFPROTO_H_ + +#include + +/* + * Protocol requests constants and alignment values + */ + +#define Window CARD32 +#define Drawable CARD32 +#define VisualID CARD32 +#define Multibuffer CARD32 + +#define X_MbufGetBufferVersion 0 +#define X_MbufCreateImageBuffers 1 +#define X_MbufDestroyImageBuffers 2 +#define X_MbufDisplayImageBuffers 3 +#define X_MbufSetMBufferAttributes 4 +#define X_MbufGetMBufferAttributes 5 +#define X_MbufSetBufferAttributes 6 +#define X_MbufGetBufferAttributes 7 +#define X_MbufGetBufferInfo 8 +#define X_MbufCreateStereoWindow 9 +#define X_MbufClearImageBufferArea 10 + + +typedef struct xMbufBufferInfo { + CARD32 visualID; /* associated visual */ + CARD16 maxBuffers; /* maximum supported buffers */ + CARD8 depth; /* depth of visual (redundant) */ + CARD8 unused; +} xMbufBufferInfo; +#define sz_xMbufBufferInfo 8 + +typedef struct { + BYTE type; + BYTE unused; + CARD16 sequenceNumber; + CARD32 buffer; /* affected buffer */ + BYTE state; /* current status */ + CARD8 unused1; + CARD16 unused2; + CARD32 unused3; + CARD32 unused4; + CARD32 unused5; + CARD32 unused6; + CARD32 unused7; +} xMbufClobberNotifyEvent; + +typedef struct { + BYTE type; + BYTE unused; + CARD16 sequenceNumber; + CARD32 buffer; /* affected buffer */ + CARD32 timeStamp; /* update time */ + CARD32 unused1; + CARD32 unused2; + CARD32 unused3; + CARD32 unused4; + CARD32 unused5; + CARD32 unused6; +} xMbufUpdateNotifyEvent; + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufGetBufferVersion */ + CARD16 length; +} xMbufGetBufferVersionReq; +#define sz_xMbufGetBufferVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD8 majorVersion; /* major version of Multi-Buffering protocol */ + CARD8 minorVersion; /* minor version of Multi-Buffering protocol */ + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xMbufGetBufferVersionReply; +#define sz_xMbufGetBufferVersionReply 32 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */ + CARD16 length; + CARD32 window; /* associated window */ + CARD8 updateAction; /* action at update */ + CARD8 updateHint; /* hint as to frequency of updates */ + CARD16 unused; +} xMbufCreateImageBuffersReq; /* followed by buffer ids */ +#define sz_xMbufCreateImageBuffersReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 numberBuffer; /* number successfully allocated */ + CARD16 unused1; + CARD32 unused2; + CARD32 unused3; + CARD32 unused4; + CARD32 unused5; + CARD32 unused6; +} xMbufCreateImageBuffersReply; +#define sz_xMbufCreateImageBuffersReply 32 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */ + CARD16 length; + CARD32 window; /* associated window */ +} xMbufDestroyImageBuffersReq; +#define sz_xMbufDestroyImageBuffersReq 8 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */ + CARD16 length; + CARD16 minDelay; /* minimum time between last update and now */ + CARD16 maxDelay; /* maximum time between last update and now */ +} xMbufDisplayImageBuffersReq; /* followed by list of buffers */ +#define sz_xMbufDisplayImageBuffersReq 8 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */ + CARD16 length; + CARD32 window; /* associated window */ + CARD32 valueMask; /* modified entries */ +} xMbufSetMBufferAttributesReq; /* followed by values */ +#define sz_xMbufSetMBufferAttributesReq 12 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */ + CARD16 length; + CARD32 window; /* associated window */ +} xMbufGetMBufferAttributesReq; +#define sz_xMbufGetMBufferAttributesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 displayedBuffer; /* currently visible buffer */ + CARD8 updateAction; + CARD8 updateHint; + CARD8 windowMode; + CARD8 unused0; + CARD16 unused1; + CARD32 unused2; + CARD32 unused3; + CARD32 unused4; + CARD32 unused5; +} xMbufGetMBufferAttributesReply; +#define sz_xMbufGetMBufferAttributesReply 32 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */ + CARD16 length; + CARD32 buffer; + CARD32 valueMask; +} xMbufSetBufferAttributesReq; /* followed by values */ +#define sz_xMbufSetBufferAttributesReq 12 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */ + CARD16 length; + CARD32 buffer; +} xMbufGetBufferAttributesReq; +#define sz_xMbufGetBufferAttributesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 window; + CARD32 eventMask; + CARD16 bufferIndex; + CARD8 side; + CARD8 unused0; + CARD32 unused1; + CARD32 unused2; + CARD32 unused3; +} xMbufGetBufferAttributesReply; +#define sz_xMbufGetBufferAttributesReply 32 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufGetBufferInfo */ + CARD16 length; + Drawable drawable; +} xMbufGetBufferInfoReq; +#define sz_xMbufGetBufferInfoReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 normalInfo; + CARD16 stereoInfo; + CARD32 unused1; + CARD32 unused2; + CARD32 unused3; + CARD32 unused4; + CARD32 unused5; +} xMbufGetBufferInfoReply; /* followed by buffer infos */ +#define sz_xMbufGetBufferInfoReply 32 + + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */ + CARD16 length; + CARD8 unused0; + CARD8 unused1; + CARD8 unused2; + CARD8 depth; + Window wid; + Window parent; + Multibuffer left; /* associated buffers */ + Multibuffer right; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD16 borderWidth; +#if defined(__cplusplus) || defined(c_plusplus) + CARD16 c_class; +#else + CARD16 class; +#endif + VisualID visual; + CARD32 mask; +} xMbufCreateStereoWindowReq; /* followed by value list */ +#define sz_xMbufCreateStereoWindowReq 44 + +typedef struct { + CARD8 reqType; /* always codes->major_opcode */ + CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */ + CARD16 length; + Multibuffer buffer; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD8 unused0; + CARD8 unused1; + CARD8 unused2; + BOOL exposures; +} xMbufClearImageBufferAreaReq; +#define sz_xMbufClearImageBufferAreaReq 20 + +#undef Window +#undef Drawable +#undef VisualID +#undef Multibuffer + +#endif /* _MULTIBUFPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/panoramiXproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/panoramiXproto.h new file mode 100644 index 0000000000000000000000000000000000000000..5de1cf05313647e9bb361427ddf970ac92f33e93 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/panoramiXproto.h @@ -0,0 +1,193 @@ +/***************************************************************** +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. +******************************************************************/ + +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _PANORAMIXPROTO_H_ +#define _PANORAMIXPROTO_H_ + +#define PANORAMIX_MAJOR_VERSION 1 /* current version number */ +#define PANORAMIX_MINOR_VERSION 1 + +#define PANORAMIX_PROTOCOL_NAME "XINERAMA" + +#define X_PanoramiXQueryVersion 0 +#define X_PanoramiXGetState 1 +#define X_PanoramiXGetScreenCount 2 +#define X_PanoramiXGetScreenSize 3 + +#define X_XineramaIsActive 4 +#define X_XineramaQueryScreens 5 + +typedef struct _PanoramiXQueryVersion { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ + CARD16 length; + CARD8 clientMajor; + CARD8 clientMinor; + CARD16 unused; +} xPanoramiXQueryVersionReq; + +#define sz_xPanoramiXQueryVersionReq 8 + +typedef struct { + CARD8 type; /* must be X_Reply */ + CARD8 pad1; /* unused */ + CARD16 sequenceNumber; /* last sequence number */ + CARD32 length; /* 0 */ + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad2; /* unused */ + CARD32 pad3; /* unused */ + CARD32 pad4; /* unused */ + CARD32 pad5; /* unused */ + CARD32 pad6; /* unused */ +} xPanoramiXQueryVersionReply; + +#define sz_xPanoramiXQueryVersionReply 32 + + +typedef struct _PanoramiXGetState { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ + CARD16 length; + CARD32 window; +} xPanoramiXGetStateReq; +#define sz_xPanoramiXGetStateReq 8 + +typedef struct { + BYTE type; + BYTE state; + CARD16 sequenceNumber; + CARD32 length; + CARD32 window; + CARD32 pad1; /* unused */ + CARD32 pad2; /* unused */ + CARD32 pad3; /* unused */ + CARD32 pad4; /* unused */ + CARD32 pad5; /* unused */ +} xPanoramiXGetStateReply; + +#define sz_panoramiXGetStateReply 32 + +typedef struct _PanoramiXGetScreenCount { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ + CARD16 length; + CARD32 window; +} xPanoramiXGetScreenCountReq; +#define sz_xPanoramiXGetScreenCountReq 8 + +typedef struct { + BYTE type; + BYTE ScreenCount; + CARD16 sequenceNumber; + CARD32 length; + CARD32 window; + CARD32 pad1; /* unused */ + CARD32 pad2; /* unused */ + CARD32 pad3; /* unused */ + CARD32 pad4; /* unused */ + CARD32 pad5; /* unused */ +} xPanoramiXGetScreenCountReply; +#define sz_panoramiXGetScreenCountReply 32 + +typedef struct _PanoramiXGetScreenSize { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ + CARD16 length; + CARD32 window; + CARD32 screen; +} xPanoramiXGetScreenSizeReq; +#define sz_xPanoramiXGetScreenSizeReq 12 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 width; + CARD32 height; + CARD32 window; + CARD32 screen; + CARD32 pad2; /* unused */ + CARD32 pad3; /* unused */ +} xPanoramiXGetScreenSizeReply; +#define sz_panoramiXGetScreenSizeReply 32 + +/************ Alternate protocol ******************/ + +typedef struct { + CARD8 reqType; + CARD8 panoramiXReqType; + CARD16 length; +} xXineramaIsActiveReq; +#define sz_xXineramaIsActiveReq 4 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 state; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXineramaIsActiveReply; +#define sz_XineramaIsActiveReply 32 + + +typedef struct { + CARD8 reqType; + CARD8 panoramiXReqType; + CARD16 length; +} xXineramaQueryScreensReq; +#define sz_xXineramaQueryScreensReq 4 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 number; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXineramaQueryScreensReply; +#define sz_XineramaQueryScreensReply 32 + +typedef struct { + INT16 x_org; + INT16 y_org; + CARD16 width; + CARD16 height; +} xXineramaScreenInfo; +#define sz_XineramaScreenInfo 8 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/presentproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/presentproto.h new file mode 100644 index 0000000000000000000000000000000000000000..ea8086312a03ca91e1775c3d7e2119ca84768924 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/presentproto.h @@ -0,0 +1,280 @@ +/* + * Copyright © 2013 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _PRESENT_PROTO_H_ +#define _PRESENT_PROTO_H_ + +#include +#include + +#define Window CARD32 +#define Pixmap CARD32 +#define Region CARD32 +#define XSyncFence CARD32 +#define EventID CARD32 + +typedef struct { + Window window; + CARD32 serial; +} xPresentNotify; +#define sz_xPresentNotify 8 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xPresentQueryVersionReq; +#define sz_xPresentQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xPresentQueryVersionReply; +#define sz_xPresentQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + Window window; + + Pixmap pixmap; + CARD32 serial; + + Region valid; + Region update; + + INT16 x_off; + INT16 y_off; + CARD32 target_crtc; + + XSyncFence wait_fence; + XSyncFence idle_fence; + + CARD32 options; + CARD32 pad1; + + CARD64 target_msc; + CARD64 divisor; + CARD64 remainder; + /* followed by a LISTofPRESENTNOTIFY */ +} xPresentPixmapReq; +#define sz_xPresentPixmapReq 72 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + Window window; + + CARD32 serial; + CARD32 pad0; + + CARD64 target_msc; + CARD64 divisor; + CARD64 remainder; +} xPresentNotifyMSCReq; +#define sz_xPresentNotifyMSCReq 40 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + CARD32 eid; + CARD32 window; + CARD32 eventMask; +} xPresentSelectInputReq; +#define sz_xPresentSelectInputReq 16 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + CARD32 target; +} xPresentQueryCapabilitiesReq; +#define sz_xPresentQueryCapabilitiesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 capabilities; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xPresentQueryCapabilitiesReply; +#define sz_xPresentQueryCapabilitiesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 presentReqType; + CARD16 length; + Window window; + + Pixmap pixmap; + CARD32 serial; + + Region valid; + Region update; + + INT16 x_off; + INT16 y_off; + CARD32 target_crtc; + + DRI3Syncobj acquire_syncobj; + DRI3Syncobj release_syncobj; + CARD64 acquire_point; + CARD64 release_point; + + CARD32 options; + CARD32 pad1; + + CARD64 target_msc; + CARD64 divisor; + CARD64 remainder; + /* followed by a LISTofPRESENTNOTIFY */ +} xPresentPixmapSyncedReq; +#define sz_xPresentPixmapSyncedReq 88 + +/* + * Events + * + * All Present events are X Generic Events + */ + +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber; + CARD32 length; + CARD16 evtype; + CARD16 pad2; + CARD32 eid; + CARD32 window; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + INT16 off_x; + INT16 off_y; + + CARD16 pixmap_width; + CARD16 pixmap_height; + CARD32 pixmap_flags; +} xPresentConfigureNotify; +#define sz_xPresentConfigureNotify 40 + +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber; + CARD32 length; + CARD16 evtype; + CARD8 kind; + CARD8 mode; + CARD32 eid; + Window window; + CARD32 serial; + CARD64 ust; + + CARD64 msc; +} xPresentCompleteNotify; +#define sz_xPresentCompleteNotify 40 + +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber; + CARD32 length; + CARD16 evtype; + CARD16 pad2; + CARD32 eid; + Window window; + CARD32 serial; + Pixmap pixmap; + CARD32 idle_fence; +} xPresentIdleNotify; +#define sz_xPresentIdleNotify 32 + +#if PRESENT_FUTURE_VERSION +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber; + CARD32 length; + CARD16 evtype; + CARD8 update_window; + CARD8 pad1; + CARD32 eid; + Window event_window; + Window window; + Pixmap pixmap; + CARD32 serial; + + /* 32-byte boundary */ + + Region valid_region; + Region update_region; + + xRectangle valid_rect; + + xRectangle update_rect; + + INT16 x_off; + INT16 y_off; + CARD32 target_crtc; + + XSyncFence wait_fence; + XSyncFence idle_fence; + + CARD32 options; + CARD32 pad2; + + CARD64 target_msc; + CARD64 divisor; + CARD64 remainder; + +} xPresentRedirectNotify; + +#define sz_xPresentRedirectNotify 104 +#endif + +#undef Window +#undef Pixmap +#undef Region +#undef XSyncFence +#undef EventID + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/presenttokens.h b/data/miniconda3/envs/catiagent/include/X11/extensions/presenttokens.h new file mode 100644 index 0000000000000000000000000000000000000000..8004625a655583f79abdeedd1019b851d7375cab --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/presenttokens.h @@ -0,0 +1,115 @@ +/* + * Copyright © 2013 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _PRESENT_TOKENS_H_ +#define _PRESENT_TOKENS_H_ + +#define PRESENT_NAME "Present" +#define PRESENT_MAJOR 1 +#define PRESENT_MINOR 4 + +#define PresentNumberErrors 0 +#define PresentNumberEvents 0 + +/* Requests */ +#define X_PresentQueryVersion 0 +#define X_PresentPixmap 1 +#define X_PresentNotifyMSC 2 +#define X_PresentSelectInput 3 +#define X_PresentQueryCapabilities 4 +#define X_PresentPixmapSynced 5 + +#define PresentNumberRequests 6 + +/* Present operation options */ +#define PresentOptionNone 0 +#define PresentOptionAsync (1 << 0) +#define PresentOptionCopy (1 << 1) +#define PresentOptionUST (1 << 2) +#define PresentOptionSuboptimal (1 << 3) +#define PresentOptionAsyncMayTear (1 << 4) + +#define PresentAllOptions (PresentOptionAsync | \ + PresentOptionCopy | \ + PresentOptionUST | \ + PresentOptionSuboptimal | \ + PresentOptionAsyncMayTear) + +#define PresentAllAsyncOptions (PresentOptionAsync | PresentOptionAsyncMayTear) + +/* Present capabilities */ + +#define PresentCapabilityNone 0 +#define PresentCapabilityAsync 1 +#define PresentCapabilityFence 2 +#define PresentCapabilityUST 4 +#define PresentCapabilityAsyncMayTear 8 +#define PresentCapabilitySyncobj 16 + +#define PresentAllCapabilities (PresentCapabilityAsync | \ + PresentCapabilityFence | \ + PresentCapabilityUST | \ + PresentCapabilityAsyncMayTear | \ + PresentCapabilitySyncobj) + +#define PresentAllAsyncCapabilities (PresentCapabilityAsync | PresentCapabilityAsyncMayTear) + +/* Events */ +#define PresentConfigureNotify 0 +#define PresentCompleteNotify 1 +#define PresentIdleNotify 2 +#if PRESENT_FUTURE_VERSION +#define PresentRedirectNotify 3 +#endif + +/* Event Masks */ +#define PresentConfigureNotifyMask 1 +#define PresentCompleteNotifyMask 2 +#define PresentIdleNotifyMask 4 +#if PRESENT_FUTURE_VERSION +#define PresentRedirectNotifyMask 8 +#endif + +#if PRESENT_FUTURE_VERSION +#define PRESENT_REDIRECT_NOTIFY_MASK PresentRedirectNotifyMask +#else +#define PRESENT_REDIRECT_NOTIFY_MASK 0 +#endif + +#define PresentAllEvents (PresentConfigureNotifyMask | \ + PresentCompleteNotifyMask | \ + PresentIdleNotifyMask | \ + PRESENT_REDIRECT_NOTIFY_MASK) + +/* Complete Kinds */ + +#define PresentCompleteKindPixmap 0 +#define PresentCompleteKindNotifyMSC 1 + +/* Complete Modes */ + +#define PresentCompleteModeCopy 0 +#define PresentCompleteModeFlip 1 +#define PresentCompleteModeSkip 2 +#define PresentCompleteModeSuboptimalCopy 3 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/randr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/randr.h new file mode 100644 index 0000000000000000000000000000000000000000..e7caab1725670b7b0152454d496fd300b1cd7820 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/randr.h @@ -0,0 +1,208 @@ +/* + * Copyright © 2000 Compaq Computer Corporation + * Copyright © 2002 Hewlett Packard Company + * Copyright © 2006 Intel Corporation + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. + * Keith Packard, Intel Corporation + */ + +#ifndef _RANDR_H_ +#define _RANDR_H_ + +typedef unsigned short Rotation; +typedef unsigned short SizeID; +typedef unsigned short SubpixelOrder; +typedef unsigned short Connection; +typedef unsigned short XRandrRotation; +typedef unsigned short XRandrSizeID; +typedef unsigned short XRandrSubpixelOrder; +typedef unsigned long XRandrModeFlags; + +#define RANDR_NAME "RANDR" +#define RANDR_MAJOR 1 +#define RANDR_MINOR 6 + +#define RRNumberErrors 5 +#define RRNumberEvents 2 +#define RRNumberRequests 47 + +#define X_RRQueryVersion 0 +/* we skip 1 to make old clients fail pretty immediately */ +#define X_RROldGetScreenInfo 1 +#define X_RR1_0SetScreenConfig 2 +/* V1.0 apps share the same set screen config request id */ +#define X_RRSetScreenConfig 2 +#define X_RROldScreenChangeSelectInput 3 +/* 3 used to be ScreenChangeSelectInput; deprecated */ +#define X_RRSelectInput 4 +#define X_RRGetScreenInfo 5 + +/* V1.2 additions */ +#define X_RRGetScreenSizeRange 6 +#define X_RRSetScreenSize 7 +#define X_RRGetScreenResources 8 +#define X_RRGetOutputInfo 9 +#define X_RRListOutputProperties 10 +#define X_RRQueryOutputProperty 11 +#define X_RRConfigureOutputProperty 12 +#define X_RRChangeOutputProperty 13 +#define X_RRDeleteOutputProperty 14 +#define X_RRGetOutputProperty 15 +#define X_RRCreateMode 16 +#define X_RRDestroyMode 17 +#define X_RRAddOutputMode 18 +#define X_RRDeleteOutputMode 19 +#define X_RRGetCrtcInfo 20 +#define X_RRSetCrtcConfig 21 +#define X_RRGetCrtcGammaSize 22 +#define X_RRGetCrtcGamma 23 +#define X_RRSetCrtcGamma 24 + +/* V1.3 additions */ +#define X_RRGetScreenResourcesCurrent 25 +#define X_RRSetCrtcTransform 26 +#define X_RRGetCrtcTransform 27 +#define X_RRGetPanning 28 +#define X_RRSetPanning 29 +#define X_RRSetOutputPrimary 30 +#define X_RRGetOutputPrimary 31 + +#define RRTransformUnit (1L << 0) +#define RRTransformScaleUp (1L << 1) +#define RRTransformScaleDown (1L << 2) +#define RRTransformProjective (1L << 3) + +/* v1.4 */ +#define X_RRGetProviders 32 +#define X_RRGetProviderInfo 33 +#define X_RRSetProviderOffloadSink 34 +#define X_RRSetProviderOutputSource 35 +#define X_RRListProviderProperties 36 +#define X_RRQueryProviderProperty 37 +#define X_RRConfigureProviderProperty 38 +#define X_RRChangeProviderProperty 39 +#define X_RRDeleteProviderProperty 40 +#define X_RRGetProviderProperty 41 + +/* v1.5 */ +#define X_RRGetMonitors 42 +#define X_RRSetMonitor 43 +#define X_RRDeleteMonitor 44 + +/* v1.6 */ +#define X_RRCreateLease 45 +#define X_RRFreeLease 46 + +/* Event selection bits */ +#define RRScreenChangeNotifyMask (1L << 0) +/* V1.2 additions */ +#define RRCrtcChangeNotifyMask (1L << 1) +#define RROutputChangeNotifyMask (1L << 2) +#define RROutputPropertyNotifyMask (1L << 3) +/* V1.4 additions */ +#define RRProviderChangeNotifyMask (1L << 4) +#define RRProviderPropertyNotifyMask (1L << 5) +#define RRResourceChangeNotifyMask (1L << 6) +/* V1.6 additions */ +#define RRLeaseNotifyMask (1L << 7) + +/* Event codes */ +#define RRScreenChangeNotify 0 +/* V1.2 additions */ +#define RRNotify 1 +/* RRNotify Subcodes */ +#define RRNotify_CrtcChange 0 +#define RRNotify_OutputChange 1 +#define RRNotify_OutputProperty 2 +#define RRNotify_ProviderChange 3 +#define RRNotify_ProviderProperty 4 +#define RRNotify_ResourceChange 5 +/* V1.6 additions */ +#define RRNotify_Lease 6 +/* used in the rotation field; rotation and reflection in 0.1 proto. */ +#define RR_Rotate_0 1 +#define RR_Rotate_90 2 +#define RR_Rotate_180 4 +#define RR_Rotate_270 8 + +/* new in 1.0 protocol, to allow reflection of screen */ + +#define RR_Reflect_X 16 +#define RR_Reflect_Y 32 + +#define RRSetConfigSuccess 0 +#define RRSetConfigInvalidConfigTime 1 +#define RRSetConfigInvalidTime 2 +#define RRSetConfigFailed 3 + +/* new in 1.2 protocol */ + +#define RR_HSyncPositive 0x00000001 +#define RR_HSyncNegative 0x00000002 +#define RR_VSyncPositive 0x00000004 +#define RR_VSyncNegative 0x00000008 +#define RR_Interlace 0x00000010 +#define RR_DoubleScan 0x00000020 +#define RR_CSync 0x00000040 +#define RR_CSyncPositive 0x00000080 +#define RR_CSyncNegative 0x00000100 +#define RR_HSkewPresent 0x00000200 +#define RR_BCast 0x00000400 +#define RR_PixelMultiplex 0x00000800 +#define RR_DoubleClock 0x00001000 +#define RR_ClockDivideBy2 0x00002000 + +#define RR_Connected 0 +#define RR_Disconnected 1 +#define RR_UnknownConnection 2 + +#define BadRROutput 0 +#define BadRRCrtc 1 +#define BadRRMode 2 +#define BadRRProvider 3 +#define BadRRLease 4 + +/* Conventional RandR output properties */ + +#define RR_PROPERTY_BACKLIGHT "Backlight" +#define RR_PROPERTY_RANDR_EDID "EDID" +#define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat" +#define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties" +#define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType" +#define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber" +#define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList" +#define RR_PROPERTY_CLONE_LIST "CloneList" +#define RR_PROPERTY_BORDER "Border" +#define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions" +#define RR_PROPERTY_GUID "GUID" +#define RR_PROPERTY_RANDR_TILE "TILE" +#define RR_PROPERTY_NON_DESKTOP "non-desktop" + +/* roles this device can carry out */ +#define RR_Capability_None 0 +#define RR_Capability_SourceOutput 1 +#define RR_Capability_SinkOutput 2 +#define RR_Capability_SourceOffload 4 +#define RR_Capability_SinkOffload 8 + +#endif /* _RANDR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/randrproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/randrproto.h new file mode 100644 index 0000000000000000000000000000000000000000..624c2544c99da9614c620dc93309122ebc2e9a30 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/randrproto.h @@ -0,0 +1,1152 @@ +/* + * Copyright © 2000 Compaq Computer Corporation + * Copyright © 2002 Hewlett-Packard Company + * Copyright © 2006 Intel Corporation + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * Author: Jim Gettys, Hewlett-Packard Company, Inc. + * Keith Packard, Intel Corporation + */ + +/* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */ +/* V1.0 removes depth switching from the protocol */ +#ifndef _XRANDRP_H_ +#define _XRANDRP_H_ + +#include +#include + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 +#define RROutput CARD32 +#define RRMode CARD32 +#define RRCrtc CARD32 +#define RRProvider CARD32 +#define RRModeFlags CARD32 +#define RRLease CARD32 + +#define Rotation CARD16 +#define SizeID CARD16 +#define SubpixelOrder CARD16 + +/* + * data structures + */ + +typedef struct { + CARD16 widthInPixels; + CARD16 heightInPixels; + CARD16 widthInMillimeters; + CARD16 heightInMillimeters; +} xScreenSizes; +#define sz_xScreenSizes 8 + +/* + * requests and replies + */ + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xRRQueryVersionReq; +#define sz_xRRQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRQueryVersionReply; +#define sz_xRRQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; +} xRRGetScreenInfoReq; +#define sz_xRRGetScreenInfoReq 8 + +/* + * the xRRScreenInfoReply structure is followed by: + * + * the size information + */ + + +typedef struct { + BYTE type; /* X_Reply */ + BYTE setOfRotations; + CARD16 sequenceNumber; + CARD32 length; + Window root; + Time timestamp; + Time configTimestamp; + CARD16 nSizes; + SizeID sizeID; + Rotation rotation; + CARD16 rate; + CARD16 nrateEnts; + CARD16 pad; +} xRRGetScreenInfoReply; +#define sz_xRRGetScreenInfoReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Drawable drawable; + Time timestamp; + Time configTimestamp; + SizeID sizeID; + Rotation rotation; +} xRR1_0SetScreenConfigReq; +#define sz_xRR1_0SetScreenConfigReq 20 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Drawable drawable; + Time timestamp; + Time configTimestamp; + SizeID sizeID; + Rotation rotation; + CARD16 rate; + CARD16 pad; +} xRRSetScreenConfigReq; +#define sz_xRRSetScreenConfigReq 24 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time newTimestamp; + Time newConfigTimestamp; + Window root; + CARD16 subpixelOrder; + CARD16 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRSetScreenConfigReply; +#define sz_xRRSetScreenConfigReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + CARD16 enable; + CARD16 pad2; +} xRRSelectInputReq; +#define sz_xRRSelectInputReq 12 + +/* + * Additions for version 1.2 + */ + +typedef struct _xRRModeInfo { + RRMode id; + CARD16 width; + CARD16 height; + CARD32 dotClock; + CARD16 hSyncStart; + CARD16 hSyncEnd; + CARD16 hTotal; + CARD16 hSkew; + CARD16 vSyncStart; + CARD16 vSyncEnd; + CARD16 vTotal; + CARD16 nameLength; + RRModeFlags modeFlags; +} xRRModeInfo; +#define sz_xRRModeInfo 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; +} xRRGetScreenSizeRangeReq; +#define sz_xRRGetScreenSizeRangeReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad; + CARD16 sequenceNumber; + CARD32 length; + CARD16 minWidth; + CARD16 minHeight; + CARD16 maxWidth; + CARD16 maxHeight; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xRRGetScreenSizeRangeReply; +#define sz_xRRGetScreenSizeRangeReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + CARD16 width; + CARD16 height; + CARD32 widthInMillimeters; + CARD32 heightInMillimeters; +} xRRSetScreenSizeReq; +#define sz_xRRSetScreenSizeReq 20 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; +} xRRGetScreenResourcesReq; +#define sz_xRRGetScreenResourcesReq 8 + +typedef struct { + BYTE type; + CARD8 pad; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + Time configTimestamp; + CARD16 nCrtcs; + CARD16 nOutputs; + CARD16 nModes; + CARD16 nbytesNames; + CARD32 pad1; + CARD32 pad2; +} xRRGetScreenResourcesReply; +#define sz_xRRGetScreenResourcesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Time configTimestamp; +} xRRGetOutputInfoReq; +#define sz_xRRGetOutputInfoReq 12 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + RRCrtc crtc; + CARD32 mmWidth; + CARD32 mmHeight; + CARD8 connection; + CARD8 subpixelOrder; + CARD16 nCrtcs; + CARD16 nModes; + CARD16 nPreferred; + CARD16 nClones; + CARD16 nameLength; +} xRRGetOutputInfoReply; +#define sz_xRRGetOutputInfoReply 36 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; +} xRRListOutputPropertiesReq; +#define sz_xRRListOutputPropertiesReq 8 + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 nAtoms; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRListOutputPropertiesReply; +#define sz_xRRListOutputPropertiesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Atom property; +} xRRQueryOutputPropertyReq; +#define sz_xRRQueryOutputPropertyReq 12 + +typedef struct { + BYTE type; + BYTE pad0; + CARD16 sequenceNumber; + CARD32 length; + BOOL pending; + BOOL range; + BOOL immutable; + BYTE pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRQueryOutputPropertyReply; +#define sz_xRRQueryOutputPropertyReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Atom property; + BOOL pending; + BOOL range; + CARD16 pad; +} xRRConfigureOutputPropertyReq; +#define sz_xRRConfigureOutputPropertyReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Atom property; + Atom type; + CARD8 format; + CARD8 mode; + CARD16 pad; + CARD32 nUnits; +} xRRChangeOutputPropertyReq; +#define sz_xRRChangeOutputPropertyReq 24 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Atom property; +} xRRDeleteOutputPropertyReq; +#define sz_xRRDeleteOutputPropertyReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + Atom property; + Atom type; + CARD32 longOffset; + CARD32 longLength; +#ifdef __cplusplus + BOOL _delete; +#else + BOOL delete; +#endif + BOOL pending; + CARD16 pad1; +} xRRGetOutputPropertyReq; +#define sz_xRRGetOutputPropertyReq 28 + +typedef struct { + BYTE type; + CARD8 format; + CARD16 sequenceNumber; + CARD32 length; + Atom propertyType; + CARD32 bytesAfter; + CARD32 nItems; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xRRGetOutputPropertyReply; +#define sz_xRRGetOutputPropertyReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + xRRModeInfo modeInfo; +} xRRCreateModeReq; +#define sz_xRRCreateModeReq 40 + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + RRMode mode; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRCreateModeReply; +#define sz_xRRCreateModeReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRMode mode; +} xRRDestroyModeReq; +#define sz_xRRDestroyModeReq 8 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + RRMode mode; +} xRRAddOutputModeReq; +#define sz_xRRAddOutputModeReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RROutput output; + RRMode mode; +} xRRDeleteOutputModeReq; +#define sz_xRRDeleteOutputModeReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; + Time configTimestamp; +} xRRGetCrtcInfoReq; +#define sz_xRRGetCrtcInfoReq 12 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + RRMode mode; + Rotation rotation; + Rotation rotations; + CARD16 nOutput; + CARD16 nPossibleOutput; +} xRRGetCrtcInfoReply; +#define sz_xRRGetCrtcInfoReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; + Time timestamp; + Time configTimestamp; + INT16 x; + INT16 y; + RRMode mode; + Rotation rotation; + CARD16 pad; +} xRRSetCrtcConfigReq; +#define sz_xRRSetCrtcConfigReq 28 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time newTimestamp; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRSetCrtcConfigReply; +#define sz_xRRSetCrtcConfigReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; +} xRRGetCrtcGammaSizeReq; +#define sz_xRRGetCrtcGammaSizeReq 8 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + CARD16 size; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRGetCrtcGammaSizeReply; +#define sz_xRRGetCrtcGammaSizeReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; +} xRRGetCrtcGammaReq; +#define sz_xRRGetCrtcGammaReq 8 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + CARD16 size; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRGetCrtcGammaReply; +#define sz_xRRGetCrtcGammaReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; + CARD16 size; + CARD16 pad1; +} xRRSetCrtcGammaReq; +#define sz_xRRSetCrtcGammaReq 12 + +/* + * Additions for V1.3 + */ + +typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq; + +#define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq + +typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply; +#define sz_xRRGetScreenResourcesCurrentReply sz_xRRGetScreenResourcesReply + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; + xRenderTransform transform; + CARD16 nbytesFilter; /* number of bytes in filter name */ + CARD16 pad; +} xRRSetCrtcTransformReq; + +#define sz_xRRSetCrtcTransformReq 48 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; +} xRRGetCrtcTransformReq; + +#define sz_xRRGetCrtcTransformReq 8 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + xRenderTransform pendingTransform; + BYTE hasTransforms; + CARD8 pad0; + CARD16 pad1; + xRenderTransform currentTransform; + CARD32 pad2; + CARD16 pendingNbytesFilter; /* number of bytes in filter name */ + CARD16 pendingNparamsFilter; /* number of filter params */ + CARD16 currentNbytesFilter; /* number of bytes in filter name */ + CARD16 currentNparamsFilter; /* number of filter params */ +} xRRGetCrtcTransformReply; + +#define sz_xRRGetCrtcTransformReply 96 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + RROutput output; +} xRRSetOutputPrimaryReq; +#define sz_xRRSetOutputPrimaryReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; +} xRRGetOutputPrimaryReq; +#define sz_xRRGetOutputPrimaryReq 8 + +typedef struct { + BYTE type; + CARD8 pad; + CARD16 sequenceNumber; + CARD32 length; + RROutput output; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRGetOutputPrimaryReply; +#define sz_xRRGetOutputPrimaryReply 32 + +/* + * Additions for V1.4 + */ + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; +} xRRGetProvidersReq; +#define sz_xRRGetProvidersReq 8 + +typedef struct { + BYTE type; + CARD8 pad; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + CARD16 nProviders; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRGetProvidersReply; +#define sz_xRRGetProvidersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Time configTimestamp; +} xRRGetProviderInfoReq; +#define sz_xRRGetProviderInfoReq 12 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + CARD32 capabilities; + CARD16 nCrtcs; + CARD16 nOutputs; + CARD16 nAssociatedProviders; + CARD16 nameLength; + CARD32 pad1; + CARD32 pad2; +} xRRGetProviderInfoReply; +#define sz_xRRGetProviderInfoReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + RRProvider source_provider; + Time configTimestamp; +} xRRSetProviderOutputSourceReq; +#define sz_xRRSetProviderOutputSourceReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + RRProvider sink_provider; + Time configTimestamp; +} xRRSetProviderOffloadSinkReq; +#define sz_xRRSetProviderOffloadSinkReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; +} xRRListProviderPropertiesReq; +#define sz_xRRListProviderPropertiesReq 8 + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 nAtoms; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRListProviderPropertiesReply; +#define sz_xRRListProviderPropertiesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Atom property; +} xRRQueryProviderPropertyReq; +#define sz_xRRQueryProviderPropertyReq 12 + +typedef struct { + BYTE type; + BYTE pad0; + CARD16 sequenceNumber; + CARD32 length; + BOOL pending; + BOOL range; + BOOL immutable; + BYTE pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRRQueryProviderPropertyReply; +#define sz_xRRQueryProviderPropertyReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Atom property; + BOOL pending; + BOOL range; + CARD16 pad; +} xRRConfigureProviderPropertyReq; +#define sz_xRRConfigureProviderPropertyReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Atom property; + Atom type; + CARD8 format; + CARD8 mode; + CARD16 pad; + CARD32 nUnits; +} xRRChangeProviderPropertyReq; +#define sz_xRRChangeProviderPropertyReq 24 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Atom property; +} xRRDeleteProviderPropertyReq; +#define sz_xRRDeleteProviderPropertyReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRProvider provider; + Atom property; + Atom type; + CARD32 longOffset; + CARD32 longLength; +#ifdef __cplusplus + BOOL _delete; +#else + BOOL delete; +#endif + BOOL pending; + CARD16 pad1; +} xRRGetProviderPropertyReq; +#define sz_xRRGetProviderPropertyReq 28 + +typedef struct { + BYTE type; + CARD8 format; + CARD16 sequenceNumber; + CARD32 length; + Atom propertyType; + CARD32 bytesAfter; + CARD32 nItems; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xRRGetProviderPropertyReply; +#define sz_xRRGetProviderPropertyReply 32 + +/* + * Additions for V1.6 + */ + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + RRLease lid; + CARD16 nCrtcs; + CARD16 nOutputs; +} xRRCreateLeaseReq; +#define sz_xRRCreateLeaseReq 16 + +typedef struct { + BYTE type; + CARD8 nfd; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xRRCreateLeaseReply; +#define sz_xRRCreateLeaseReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRLease lid; + BYTE terminate; + CARD8 pad1; + CARD16 pad2; +} xRRFreeLeaseReq; +#define sz_xRRFreeLeaseReq 12 + +/* + * event + */ +typedef struct { + CARD8 type; /* always evBase + ScreenChangeNotify */ + CARD8 rotation; /* new rotation */ + CARD16 sequenceNumber; + Time timestamp; /* time screen was changed */ + Time configTimestamp; /* time config data was changed */ + Window root; /* root window */ + Window window; /* window requesting notification */ + SizeID sizeID; /* new size ID */ + CARD16 subpixelOrder; /* subpixel order */ + CARD16 widthInPixels; /* new size */ + CARD16 heightInPixels; + CARD16 widthInMillimeters; + CARD16 heightInMillimeters; +} xRRScreenChangeNotifyEvent; +#define sz_xRRScreenChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_CrtcChange */ + CARD16 sequenceNumber; + Time timestamp; /* time crtc was changed */ + Window window; /* window requesting notification */ + RRCrtc crtc; /* affected CRTC */ + RRMode mode; /* current mode */ + CARD16 rotation; /* rotation and reflection */ + CARD16 pad1; /* unused */ + INT16 x; /* new location */ + INT16 y; + CARD16 width; /* new size */ + CARD16 height; +} xRRCrtcChangeNotifyEvent; +#define sz_xRRCrtcChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_OutputChange */ + CARD16 sequenceNumber; + Time timestamp; /* time output was changed */ + Time configTimestamp; /* time config was changed */ + Window window; /* window requesting notification */ + RROutput output; /* affected output */ + RRCrtc crtc; /* current crtc */ + RRMode mode; /* current mode */ + CARD16 rotation; /* rotation and reflection */ + CARD8 connection; /* connection status */ + CARD8 subpixelOrder; /* subpixel order */ +} xRROutputChangeNotifyEvent; +#define sz_xRROutputChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_OutputProperty */ + CARD16 sequenceNumber; + Window window; /* window requesting notification */ + RROutput output; /* affected output */ + Atom atom; /* property name */ + Time timestamp; /* time crtc was changed */ + CARD8 state; /* NewValue or Deleted */ + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; +} xRROutputPropertyNotifyEvent; +#define sz_xRROutputPropertyNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ProviderChange */ + CARD16 sequenceNumber; + Time timestamp; /* time provider was changed */ + Window window; /* window requesting notification */ + RRProvider provider; /* affected provider */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xRRProviderChangeNotifyEvent; +#define sz_xRRProviderChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ProviderProperty */ + CARD16 sequenceNumber; + Window window; /* window requesting notification */ + RRProvider provider; /* affected provider */ + Atom atom; /* property name */ + Time timestamp; /* time provider was changed */ + CARD8 state; /* NewValue or Deleted */ + CARD8 pad1; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; +} xRRProviderPropertyNotifyEvent; +#define sz_xRRProviderPropertyNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ResourceChange */ + CARD16 sequenceNumber; + Time timestamp; /* time resource was changed */ + Window window; /* window requesting notification */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRResourceChangeNotifyEvent; +#define sz_xRRResourceChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_Lease */ + CARD16 sequenceNumber; + Time timestamp; /* time resource was changed */ + Window window; /* window requesting notification */ + RRLease lease; + CARD8 created; /* created/deleted */ + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xRRLeaseNotifyEvent; +#define sz_xRRLeaseNotifyEvent 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; +} xRRGetPanningReq; +#define sz_xRRGetPanningReq 8 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + CARD16 left; + CARD16 top; + CARD16 width; + CARD16 height; + CARD16 track_left; + CARD16 track_top; + CARD16 track_width; + CARD16 track_height; + INT16 border_left; + INT16 border_top; + INT16 border_right; + INT16 border_bottom; +} xRRGetPanningReply; +#define sz_xRRGetPanningReply 36 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + RRCrtc crtc; + Time timestamp; + CARD16 left; + CARD16 top; + CARD16 width; + CARD16 height; + CARD16 track_left; + CARD16 track_top; + CARD16 track_width; + CARD16 track_height; + INT16 border_left; + INT16 border_top; + INT16 border_right; + INT16 border_bottom; +} xRRSetPanningReq; +#define sz_xRRSetPanningReq 36 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time newTimestamp; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRRSetPanningReply; +#define sz_xRRSetPanningReply 32 + +typedef struct { + Atom name; + BOOL primary; + BOOL automatic; + CARD16 noutput; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD32 widthInMillimeters; + CARD32 heightInMillimeters; +} xRRMonitorInfo; +#define sz_xRRMonitorInfo 24 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + BOOL get_active; + CARD8 pad; + CARD16 pad2; +} xRRGetMonitorsReq; +#define sz_xRRGetMonitorsReq 12 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber; + CARD32 length; + Time timestamp; + CARD32 nmonitors; + CARD32 noutputs; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xRRGetMonitorsReply; +#define sz_xRRGetMonitorsReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + xRRMonitorInfo monitor; +} xRRSetMonitorReq; +#define sz_xRRSetMonitorReq 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length; + Window window; + Atom name; +} xRRDeleteMonitorReq; +#define sz_xRRDeleteMonitorReq 12 + +#undef RRLease +#undef RRModeFlags +#undef RRCrtc +#undef RRMode +#undef RROutput +#undef RRMode +#undef RRCrtc +#undef RRProvider +#undef Drawable +#undef Window +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef Time +#undef KeyCode +#undef KeySym +#undef Rotation +#undef SizeID +#undef SubpixelOrder + +#endif /* _XRANDRP_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/recordconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/recordconst.h new file mode 100644 index 0000000000000000000000000000000000000000..ecdd81be5c6bebf3267af9909d4c880c2d9da0b1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/recordconst.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright 1995 Network Computing Devices + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * + * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + **************************************************************************/ + +#ifndef _RECORDCONST_H_ +#define _RECORDCONST_H_ + +#define RECORD_NAME "RECORD" +#define RECORD_MAJOR_VERSION 1 +#define RECORD_MINOR_VERSION 13 +#define RECORD_LOWEST_MAJOR_VERSION 1 +#define RECORD_LOWEST_MINOR_VERSION 12 + +#define XRecordBadContext 0 /* Not a valid RC */ + +#define RecordNumErrors (XRecordBadContext + 1) +#define RecordNumEvents 0L + +/* + * Constants for arguments of various requests + */ +#define XRecordFromServerTime 0x01 +#define XRecordFromClientTime 0x02 +#define XRecordFromClientSequence 0x04 + +#define XRecordCurrentClients 1 +#define XRecordFutureClients 2 +#define XRecordAllClients 3 + +#define XRecordFromServer 0 +#define XRecordFromClient 1 +#define XRecordClientStarted 2 +#define XRecordClientDied 3 +#define XRecordStartOfData 4 +#define XRecordEndOfData 5 + + +#endif /* _RECORD_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/recordproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/recordproto.h new file mode 100644 index 0000000000000000000000000000000000000000..d2016eb08cf0d0d1c4aa59be0ebb9b18c0abcfee --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/recordproto.h @@ -0,0 +1,306 @@ +/*************************************************************************** + * Copyright 1995 Network Computing Devices + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Network Computing Devices + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * + * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + **************************************************************************/ + +#ifndef _RECORDPROTO_H_ +#define _RECORDPROTO_H_ + +#include + +/* only difference between 1.12 and 1.13 is byte order of device events, + which the library doesn't deal with. */ + +/********************************************************* + * + * Protocol request constants + * + */ +#define X_RecordQueryVersion 0 /* First request from client */ +#define X_RecordCreateContext 1 /* Create client RC */ +#define X_RecordRegisterClients 2 /* Add to client RC */ +#define X_RecordUnregisterClients 3 /* Delete from client RC */ +#define X_RecordGetContext 4 /* Query client RC */ +#define X_RecordEnableContext 5 /* Enable interception and reporting */ +#define X_RecordDisableContext 6 /* Disable interception and reporting */ +#define X_RecordFreeContext 7 /* Free client RC */ + +#define sz_XRecordRange 32 +#define sz_XRecordClientInfo 12 +#define sz_XRecordState 16 +#define sz_XRecordDatum 32 + + +#define XRecordGlobaldef +#define XRecordGlobalref extern + +#define RecordMaxEvent (128L-1L) +#define RecordMinDeviceEvent (2L) +#define RecordMaxDeviceEvent (6L) +#define RecordMaxError (256L-1L) +#define RecordMaxCoreRequest (128L-1L) +#define RecordMaxExtRequest (256L-1L) +#define RecordMinExtRequest (129L-1L) + +#define RECORD_RC CARD32 +#define RECORD_XIDBASE CARD32 +#define RECORD_CLIENTSPEC CARD32 +#define RECORD_ELEMENT_HEADER CARD8 + +typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr; + +typedef struct +{ + CARD8 first; + CARD8 last; +} RECORD_RANGE8; + +typedef struct +{ + CARD16 first; + CARD16 last; +} RECORD_RANGE16; + +typedef struct +{ + RECORD_RANGE8 majorCode; + RECORD_RANGE16 minorCode; +} RECORD_EXTRANGE; + +typedef struct +{ + RECORD_RANGE8 coreRequests; + RECORD_RANGE8 coreReplies; + RECORD_EXTRANGE extRequests; + RECORD_EXTRANGE extReplies; + RECORD_RANGE8 deliveredEvents; + RECORD_RANGE8 deviceEvents; + RECORD_RANGE8 errors; + BOOL clientStarted; + BOOL clientDied; +} RECORDRANGE; +#define sz_RECORDRANGE 24 + +/* typedef RECORDRANGE xRecordRange, *xRecordRangePtr; +#define sz_xRecordRange 24 */ + +/* Cannot have structures within structures going over the wire */ +typedef struct +{ + CARD8 coreRequestsFirst; + CARD8 coreRequestsLast; + CARD8 coreRepliesFirst; + CARD8 coreRepliesLast; + CARD8 extRequestsMajorFirst; + CARD8 extRequestsMajorLast; + CARD16 extRequestsMinorFirst; + CARD16 extRequestsMinorLast; + CARD8 extRepliesMajorFirst; + CARD8 extRepliesMajorLast; + CARD16 extRepliesMinorFirst; + CARD16 extRepliesMinorLast; + CARD8 deliveredEventsFirst; + CARD8 deliveredEventsLast; + CARD8 deviceEventsFirst; + CARD8 deviceEventsLast; + CARD8 errorsFirst; + CARD8 errorsLast; + BOOL clientStarted; + BOOL clientDied; +} xRecordRange; +#define sz_xRecordRange 24 + +typedef struct +{ + RECORD_CLIENTSPEC clientResource; + CARD32 nRanges; +/* LISTofRECORDRANGE */ +} RECORD_CLIENT_INFO; + +typedef RECORD_CLIENT_INFO xRecordClientInfo; + +/* + * Initialize + */ +typedef struct { + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xRecordQueryVersionReq; +#define sz_xRecordQueryVersionReq 8 + +typedef struct +{ + CARD8 type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + } xRecordQueryVersionReply; +#define sz_xRecordQueryVersionReply 32 + +/* + * Create RC + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; + RECORD_ELEMENT_HEADER elementHeader; + CARD8 pad; + CARD16 pad0; + CARD32 nClients; + CARD32 nRanges; +/* LISTofRECORD_CLIENTSPEC */ +/* LISTofRECORDRANGE */ +} xRecordCreateContextReq; +#define sz_xRecordCreateContextReq 20 + +/* + * Add to RC + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; + RECORD_ELEMENT_HEADER elementHeader; + CARD8 pad; + CARD16 pad0; + CARD32 nClients; + CARD32 nRanges; +/* LISTofRECORD_CLIENTSPEC */ +/* LISTofRECORDRANGE */ +} xRecordRegisterClientsReq; +#define sz_xRecordRegisterClientsReq 20 + +/* + * Delete from RC + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; + CARD32 nClients; +/* LISTofRECORD_CLIENTSPEC */ +} xRecordUnregisterClientsReq; +#define sz_xRecordUnregisterClientsReq 12 + +/* + * Query RC + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; +} xRecordGetContextReq; +#define sz_xRecordGetContextReq 8 + +typedef struct +{ + CARD8 type; + BOOL enabled; + CARD16 sequenceNumber; + CARD32 length; + RECORD_ELEMENT_HEADER elementHeader; + CARD8 pad; + CARD16 pad0; + CARD32 nClients; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +/* LISTofCLIENT_INFO */ /* intercepted-clients */ +} xRecordGetContextReply; +#define sz_xRecordGetContextReply 32 + +/* + * Enable data interception + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; +} xRecordEnableContextReq; +#define sz_xRecordEnableContextReq 8 + +typedef struct +{ + CARD8 type; + CARD8 category; + CARD16 sequenceNumber; + CARD32 length; + RECORD_ELEMENT_HEADER elementHeader; + BOOL clientSwapped; + CARD16 pad1; + RECORD_XIDBASE idBase; + CARD32 serverTime; + CARD32 recordedSequenceNumber; + CARD32 pad3; + CARD32 pad4; + /* BYTE data; */ +} xRecordEnableContextReply; +#define sz_xRecordEnableContextReply 32 + +/* + * Disable data interception + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; +} xRecordDisableContextReq; +#define sz_xRecordDisableContextReq 8 + +/* + * Free RC + */ +typedef struct +{ + CARD8 reqType; + CARD8 recordReqType; + CARD16 length; + RECORD_RC context; +} xRecordFreeContextReq; +#define sz_xRecordFreeContextReq 8 + +#undef RECORD_RC +#undef RECORD_XIDBASE +#undef RECORD_ELEMENT_HEADER +#undef RECORD_CLIENTSPEC + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/recordstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/recordstr.h new file mode 100644 index 0000000000000000000000000000000000000000..7f269b77e3af4cfbdf7a13163a681e6c69a654e8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/recordstr.h @@ -0,0 +1,4 @@ +#warning "recordstr.h is obsolete and may be removed in the future." +#warning "include for the library interfaces." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/render.h b/data/miniconda3/envs/catiagent/include/X11/extensions/render.h new file mode 100644 index 0000000000000000000000000000000000000000..7ecde3f59e72d080ce9d59e97383f7a2dd1c0569 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/render.h @@ -0,0 +1,210 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#ifndef _RENDER_H_ +#define _RENDER_H_ + +#include + +typedef XID Glyph; +typedef XID GlyphSet; +typedef XID Picture; +typedef XID PictFormat; + +#define RENDER_NAME "RENDER" +#define RENDER_MAJOR 0 +#define RENDER_MINOR 11 + +#define X_RenderQueryVersion 0 +#define X_RenderQueryPictFormats 1 +#define X_RenderQueryPictIndexValues 2 /* 0.7 */ +#define X_RenderQueryDithers 3 +#define X_RenderCreatePicture 4 +#define X_RenderChangePicture 5 +#define X_RenderSetPictureClipRectangles 6 +#define X_RenderFreePicture 7 +#define X_RenderComposite 8 +#define X_RenderScale 9 +#define X_RenderTrapezoids 10 +#define X_RenderTriangles 11 +#define X_RenderTriStrip 12 +#define X_RenderTriFan 13 +#define X_RenderColorTrapezoids 14 +#define X_RenderColorTriangles 15 +/* #define X_RenderTransform 16 */ +#define X_RenderCreateGlyphSet 17 +#define X_RenderReferenceGlyphSet 18 +#define X_RenderFreeGlyphSet 19 +#define X_RenderAddGlyphs 20 +#define X_RenderAddGlyphsFromPicture 21 +#define X_RenderFreeGlyphs 22 +#define X_RenderCompositeGlyphs8 23 +#define X_RenderCompositeGlyphs16 24 +#define X_RenderCompositeGlyphs32 25 +#define X_RenderFillRectangles 26 +/* 0.5 */ +#define X_RenderCreateCursor 27 +/* 0.6 */ +#define X_RenderSetPictureTransform 28 +#define X_RenderQueryFilters 29 +#define X_RenderSetPictureFilter 30 +/* 0.8 */ +#define X_RenderCreateAnimCursor 31 +/* 0.9 */ +#define X_RenderAddTraps 32 +/* 0.10 */ +#define X_RenderCreateSolidFill 33 +#define X_RenderCreateLinearGradient 34 +#define X_RenderCreateRadialGradient 35 +#define X_RenderCreateConicalGradient 36 +#define RenderNumberRequests (X_RenderCreateConicalGradient+1) + +#define BadPictFormat 0 +#define BadPicture 1 +#define BadPictOp 2 +#define BadGlyphSet 3 +#define BadGlyph 4 +#define RenderNumberErrors (BadGlyph+1) + +#define PictTypeIndexed 0 +#define PictTypeDirect 1 + +#define PictOpMinimum 0 +#define PictOpClear 0 +#define PictOpSrc 1 +#define PictOpDst 2 +#define PictOpOver 3 +#define PictOpOverReverse 4 +#define PictOpIn 5 +#define PictOpInReverse 6 +#define PictOpOut 7 +#define PictOpOutReverse 8 +#define PictOpAtop 9 +#define PictOpAtopReverse 10 +#define PictOpXor 11 +#define PictOpAdd 12 +#define PictOpSaturate 13 +#define PictOpMaximum 13 + +/* + * Operators only available in version 0.2 + */ +#define PictOpDisjointMinimum 0x10 +#define PictOpDisjointClear 0x10 +#define PictOpDisjointSrc 0x11 +#define PictOpDisjointDst 0x12 +#define PictOpDisjointOver 0x13 +#define PictOpDisjointOverReverse 0x14 +#define PictOpDisjointIn 0x15 +#define PictOpDisjointInReverse 0x16 +#define PictOpDisjointOut 0x17 +#define PictOpDisjointOutReverse 0x18 +#define PictOpDisjointAtop 0x19 +#define PictOpDisjointAtopReverse 0x1a +#define PictOpDisjointXor 0x1b +#define PictOpDisjointMaximum 0x1b + +#define PictOpConjointMinimum 0x20 +#define PictOpConjointClear 0x20 +#define PictOpConjointSrc 0x21 +#define PictOpConjointDst 0x22 +#define PictOpConjointOver 0x23 +#define PictOpConjointOverReverse 0x24 +#define PictOpConjointIn 0x25 +#define PictOpConjointInReverse 0x26 +#define PictOpConjointOut 0x27 +#define PictOpConjointOutReverse 0x28 +#define PictOpConjointAtop 0x29 +#define PictOpConjointAtopReverse 0x2a +#define PictOpConjointXor 0x2b +#define PictOpConjointMaximum 0x2b + +/* + * Operators only available in version 0.11 + */ +#define PictOpBlendMinimum 0x30 +#define PictOpMultiply 0x30 +#define PictOpScreen 0x31 +#define PictOpOverlay 0x32 +#define PictOpDarken 0x33 +#define PictOpLighten 0x34 +#define PictOpColorDodge 0x35 +#define PictOpColorBurn 0x36 +#define PictOpHardLight 0x37 +#define PictOpSoftLight 0x38 +#define PictOpDifference 0x39 +#define PictOpExclusion 0x3a +#define PictOpHSLHue 0x3b +#define PictOpHSLSaturation 0x3c +#define PictOpHSLColor 0x3d +#define PictOpHSLLuminosity 0x3e +#define PictOpBlendMaximum 0x3e + +#define PolyEdgeSharp 0 +#define PolyEdgeSmooth 1 + +#define PolyModePrecise 0 +#define PolyModeImprecise 1 + +#define CPRepeat (1 << 0) +#define CPAlphaMap (1 << 1) +#define CPAlphaXOrigin (1 << 2) +#define CPAlphaYOrigin (1 << 3) +#define CPClipXOrigin (1 << 4) +#define CPClipYOrigin (1 << 5) +#define CPClipMask (1 << 6) +#define CPGraphicsExposure (1 << 7) +#define CPSubwindowMode (1 << 8) +#define CPPolyEdge (1 << 9) +#define CPPolyMode (1 << 10) +#define CPDither (1 << 11) +#define CPComponentAlpha (1 << 12) +#define CPLastBit 12 + +/* Filters included in 0.6 */ +#define FilterNearest "nearest" +#define FilterBilinear "bilinear" +/* Filters included in 0.10 */ +#define FilterConvolution "convolution" + +#define FilterFast "fast" +#define FilterGood "good" +#define FilterBest "best" + +#define FilterAliasNone -1 + +/* Subpixel orders included in 0.6 */ +#define SubPixelUnknown 0 +#define SubPixelHorizontalRGB 1 +#define SubPixelHorizontalBGR 2 +#define SubPixelVerticalRGB 3 +#define SubPixelVerticalBGR 4 +#define SubPixelNone 5 + +/* Extended repeat attributes included in 0.10 */ +#define RepeatNone 0 +#define RepeatNormal 1 +#define RepeatPad 2 +#define RepeatReflect 3 + +#endif /* _RENDER_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/renderproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/renderproto.h new file mode 100644 index 0000000000000000000000000000000000000000..2cd06af5d2f14e822e76cfda71e0ce94104ab029 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/renderproto.h @@ -0,0 +1,661 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#ifndef _XRENDERP_H_ +#define _XRENDERP_H_ + +#include +#include + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define VisualID CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 + +#define Picture CARD32 +#define PictFormat CARD32 +#define Fixed INT32 +#define Glyphset CARD32 + +/* + * data structures + */ + +typedef struct { + CARD16 red; + CARD16 redMask; + CARD16 green; + CARD16 greenMask; + CARD16 blue; + CARD16 blueMask; + CARD16 alpha; + CARD16 alphaMask; +} xDirectFormat; + +#define sz_xDirectFormat 16 + +typedef struct { + PictFormat id; + CARD8 type; + CARD8 depth; + CARD16 pad1; + xDirectFormat direct; + Colormap colormap; +} xPictFormInfo; + +#define sz_xPictFormInfo 28 + +typedef struct { + VisualID visual; + PictFormat format; +} xPictVisual; + +#define sz_xPictVisual 8 + +typedef struct { + CARD8 depth; + CARD8 pad1; + CARD16 nPictVisuals; + CARD32 pad2; +} xPictDepth; + +#define sz_xPictDepth 8 + +typedef struct { + CARD32 nDepth; + PictFormat fallback; +} xPictScreen; + +#define sz_xPictScreen 8 + +typedef struct { + CARD32 pixel; + CARD16 red; + CARD16 green; + CARD16 blue; + CARD16 alpha; +} xIndexValue; + +#define sz_xIndexValue 12 + +typedef struct { + CARD16 red; + CARD16 green; + CARD16 blue; + CARD16 alpha; +} xRenderColor; + +#define sz_xRenderColor 8 + +typedef struct { + Fixed x; + Fixed y; +} xPointFixed; + +#define sz_xPointFixed 8 + +typedef struct { + xPointFixed p1; + xPointFixed p2; +} xLineFixed; + +#define sz_xLineFixed 16 + +typedef struct { + xPointFixed p1, p2, p3; +} xTriangle; + +#define sz_xTriangle 24 + +typedef struct { + Fixed top; + Fixed bottom; + xLineFixed left; + xLineFixed right; +} xTrapezoid; + +#define sz_xTrapezoid 40 + +typedef struct { + CARD16 width; + CARD16 height; + INT16 x; + INT16 y; + INT16 xOff; + INT16 yOff; +} xGlyphInfo; + +#define sz_xGlyphInfo 12 + +typedef struct { + CARD8 len; + CARD8 pad1; + CARD16 pad2; + INT16 deltax; + INT16 deltay; +} xGlyphElt; + +#define sz_xGlyphElt 8 + +typedef struct { + Fixed l, r, y; +} xSpanFix; + +#define sz_xSpanFix 12 + +typedef struct { + xSpanFix top, bot; +} xTrap; + +#define sz_xTrap 24 + +/* + * requests and replies + */ +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xRenderQueryVersionReq; + +#define sz_xRenderQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRenderQueryVersionReply; + +#define sz_xRenderQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; +} xRenderQueryPictFormatsReq; + +#define sz_xRenderQueryPictFormatsReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numFormats; + CARD32 numScreens; + CARD32 numDepths; + CARD32 numVisuals; + CARD32 numSubpixel; /* Version 0.6 */ + CARD32 pad5; +} xRenderQueryPictFormatsReply; + +#define sz_xRenderQueryPictFormatsReply 32 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + PictFormat format; +} xRenderQueryPictIndexValuesReq; + +#define sz_xRenderQueryPictIndexValuesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numIndexValues; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xRenderQueryPictIndexValuesReply; + +#define sz_xRenderQueryPictIndexValuesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture pid; + Drawable drawable; + PictFormat format; + CARD32 mask; +} xRenderCreatePictureReq; + +#define sz_xRenderCreatePictureReq 20 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; + CARD32 mask; +} xRenderChangePictureReq; + +#define sz_xRenderChangePictureReq 12 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; + INT16 xOrigin; + INT16 yOrigin; +} xRenderSetPictureClipRectanglesReq; + +#define sz_xRenderSetPictureClipRectanglesReq 12 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; +} xRenderFreePictureReq; + +#define sz_xRenderFreePictureReq 8 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture mask; + Picture dst; + INT16 xSrc; + INT16 ySrc; + INT16 xMask; + INT16 yMask; + INT16 xDst; + INT16 yDst; + CARD16 width; + CARD16 height; +} xRenderCompositeReq; + +#define sz_xRenderCompositeReq 36 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture src; + Picture dst; + CARD32 colorScale; + CARD32 alphaScale; + INT16 xSrc; + INT16 ySrc; + INT16 xDst; + INT16 yDst; + CARD16 width; + CARD16 height; +} xRenderScaleReq; + +#define sz_xRenderScaleReq 32 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture dst; + PictFormat maskFormat; + INT16 xSrc; + INT16 ySrc; +} xRenderTrapezoidsReq; + +#define sz_xRenderTrapezoidsReq 24 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture dst; + PictFormat maskFormat; + INT16 xSrc; + INT16 ySrc; +} xRenderTrianglesReq; + +#define sz_xRenderTrianglesReq 24 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture dst; + PictFormat maskFormat; + INT16 xSrc; + INT16 ySrc; +} xRenderTriStripReq; + +#define sz_xRenderTriStripReq 24 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture dst; + PictFormat maskFormat; + INT16 xSrc; + INT16 ySrc; +} xRenderTriFanReq; + +#define sz_xRenderTriFanReq 24 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Glyphset gsid; + PictFormat format; +} xRenderCreateGlyphSetReq; + +#define sz_xRenderCreateGlyphSetReq 12 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Glyphset gsid; + Glyphset existing; +} xRenderReferenceGlyphSetReq; + +#define sz_xRenderReferenceGlyphSetReq 24 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Glyphset glyphset; +} xRenderFreeGlyphSetReq; + +#define sz_xRenderFreeGlyphSetReq 8 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Glyphset glyphset; + CARD32 nglyphs; +} xRenderAddGlyphsReq; + +#define sz_xRenderAddGlyphsReq 12 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Glyphset glyphset; +} xRenderFreeGlyphsReq; + +#define sz_xRenderFreeGlyphsReq 8 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture src; + Picture dst; + PictFormat maskFormat; + Glyphset glyphset; + INT16 xSrc; + INT16 ySrc; +} xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req, +xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req; + +#define sz_xRenderCompositeGlyphs8Req 28 +#define sz_xRenderCompositeGlyphs16Req 28 +#define sz_xRenderCompositeGlyphs32Req 28 + +/* 0.1 and higher */ + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + CARD8 op; + CARD8 pad1; + CARD16 pad2; + Picture dst; + xRenderColor color; +} xRenderFillRectanglesReq; + +#define sz_xRenderFillRectanglesReq 20 + +/* 0.5 and higher */ + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Cursor cid; + Picture src; + CARD16 x; + CARD16 y; +} xRenderCreateCursorReq; + +#define sz_xRenderCreateCursorReq 16 + +/* 0.6 and higher */ + +/* + * This can't use an array because 32-bit values may be in bitfields + */ +typedef struct { + Fixed matrix11; + Fixed matrix12; + Fixed matrix13; + Fixed matrix21; + Fixed matrix22; + Fixed matrix23; + Fixed matrix31; + Fixed matrix32; + Fixed matrix33; +} xRenderTransform; + +#define sz_xRenderTransform 36 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; + xRenderTransform transform; +} xRenderSetPictureTransformReq; + +#define sz_xRenderSetPictureTransformReq 44 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Drawable drawable; +} xRenderQueryFiltersReq; + +#define sz_xRenderQueryFiltersReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 numAliases; /* LISTofCARD16 */ + CARD32 numFilters; /* LISTofSTRING8 */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xRenderQueryFiltersReply; + +#define sz_xRenderQueryFiltersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; + CARD16 nbytes; /* number of bytes in name */ + CARD16 pad; +} xRenderSetPictureFilterReq; + +#define sz_xRenderSetPictureFilterReq 12 + +/* 0.8 and higher */ + +typedef struct { + Cursor cursor; + CARD32 delay; +} xAnimCursorElt; + +#define sz_xAnimCursorElt 8 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Cursor cid; +} xRenderCreateAnimCursorReq; + +#define sz_xRenderCreateAnimCursorReq 8 + +/* 0.9 and higher */ + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture picture; + INT16 xOff; + INT16 yOff; +} xRenderAddTrapsReq; + +#define sz_xRenderAddTrapsReq 12 + +/* 0.10 and higher */ + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture pid; + xRenderColor color; +} xRenderCreateSolidFillReq; + +#define sz_xRenderCreateSolidFillReq 16 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture pid; + xPointFixed p1; + xPointFixed p2; + CARD32 nStops; +} xRenderCreateLinearGradientReq; + +#define sz_xRenderCreateLinearGradientReq 28 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture pid; + xPointFixed inner; + xPointFixed outer; + Fixed inner_radius; + Fixed outer_radius; + CARD32 nStops; +} xRenderCreateRadialGradientReq; + +#define sz_xRenderCreateRadialGradientReq 36 + +typedef struct { + CARD8 reqType; + CARD8 renderReqType; + CARD16 length; + Picture pid; + xPointFixed center; + Fixed angle; /* in degrees */ + CARD32 nStops; +} xRenderCreateConicalGradientReq; + +#define sz_xRenderCreateConicalGradientReq 24 + +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef VisualID +#undef Time +#undef KeyCode +#undef KeySym + +#undef Picture +#undef PictFormat +#undef Fixed +#undef Glyphset + +#endif /* _XRENDERP_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/saver.h b/data/miniconda3/envs/catiagent/include/X11/extensions/saver.h new file mode 100644 index 0000000000000000000000000000000000000000..e8da62560163a837bf403595f778ed537e461531 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/saver.h @@ -0,0 +1,52 @@ +/* +Copyright (c) 1992 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 +CONNECTION 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 dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _SAVER_H_ +#define _SAVER_H_ + +#define ScreenSaverName "MIT-SCREEN-SAVER" +#define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID" + +#define ScreenSaverNotifyMask 0x00000001 +#define ScreenSaverCycleMask 0x00000002 + +#define ScreenSaverMajorVersion 1 +#define ScreenSaverMinorVersion 1 + +#define ScreenSaverOff 0 +#define ScreenSaverOn 1 +#define ScreenSaverCycle 2 +#define ScreenSaverDisabled 3 + +#define ScreenSaverBlanked 0 +#define ScreenSaverInternal 1 +#define ScreenSaverExternal 2 + +#define ScreenSaverNotify 0 +#define ScreenSaverNumberEvents 1 + +#endif /* _SAVER_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/saverproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/saverproto.h new file mode 100644 index 0000000000000000000000000000000000000000..0b8e34eed05da13396917c4205b80ce828977d8d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/saverproto.h @@ -0,0 +1,175 @@ +/* +Copyright (c) 1992 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 +CONNECTION 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 dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _SAVERPROTO_H_ +#define _SAVERPROTO_H_ + +#include + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define VisualID CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 + +#define X_ScreenSaverQueryVersion 0 + +typedef struct _ScreenSaverQueryVersion { + CARD8 reqType; /* always ScreenSaverReqCode */ + CARD8 saverReqType; /* always X_ScreenSaverQueryVersion */ + CARD16 length; + CARD8 clientMajor; + CARD8 clientMinor; + CARD16 unused; +} xScreenSaverQueryVersionReq; +#define sz_xScreenSaverQueryVersionReq 8 + +typedef struct { + CARD8 type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of protocol */ + CARD16 minorVersion; /* minor version of protocol */ + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xScreenSaverQueryVersionReply; +#define sz_xScreenSaverQueryVersionReply 32 + +#define X_ScreenSaverQueryInfo 1 + +typedef struct _ScreenSaverQueryInfo { + CARD8 reqType; /* always ScreenSaverReqCode */ + CARD8 saverReqType; /* always X_ScreenSaverQueryInfo */ + CARD16 length; + Drawable drawable; +} xScreenSaverQueryInfoReq; +#define sz_xScreenSaverQueryInfoReq 8 + +typedef struct { + CARD8 type; /* X_Reply */ + BYTE state; /* Off, On */ + CARD16 sequenceNumber; + CARD32 length; + Window window; + CARD32 tilOrSince; + CARD32 idle; + CARD32 eventMask; + BYTE kind; /* Blanked, Internal, External */ + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; +} xScreenSaverQueryInfoReply; +#define sz_xScreenSaverQueryInfoReply 32 + +#define X_ScreenSaverSelectInput 2 + +typedef struct _ScreenSaverSelectInput { + CARD8 reqType; /* always ScreenSaverReqCode */ + CARD8 saverReqType; /* always X_ScreenSaverSelectInput */ + CARD16 length; + Drawable drawable; + CARD32 eventMask; +} xScreenSaverSelectInputReq; +#define sz_xScreenSaverSelectInputReq 12 + +#define X_ScreenSaverSetAttributes 3 + +typedef struct _ScreenSaverSetAttributes { + CARD8 reqType; /* always ScreenSaverReqCode */ + CARD8 saverReqType; /* always X_ScreenSaverSetAttributes */ + CARD16 length; + Drawable drawable; + INT16 x, y; + CARD16 width, height, borderWidth; + BYTE c_class; + CARD8 depth; + VisualID visualID; + CARD32 mask; +} xScreenSaverSetAttributesReq; +#define sz_xScreenSaverSetAttributesReq 28 + +#define X_ScreenSaverUnsetAttributes 4 + +typedef struct _ScreenSaverUnsetAttributes { + CARD8 reqType; /* always ScreenSaverReqCode */ + CARD8 saverReqType; /* always X_ScreenSaverUnsetAttributes */ + CARD16 length; + Drawable drawable; +} xScreenSaverUnsetAttributesReq; +#define sz_xScreenSaverUnsetAttributesReq 8 + +#define X_ScreenSaverSuspend 5 + +typedef struct _ScreenSaverSuspend { + CARD8 reqType; + CARD8 saverReqType; + CARD16 length; + CARD32 suspend; /* a boolean, but using the wrong encoding */ +} xScreenSaverSuspendReq; +#define sz_xScreenSaverSuspendReq 8 + +typedef struct _ScreenSaverNotify { + CARD8 type; /* always eventBase + ScreenSaverNotify */ + BYTE state; /* off, on, cycle */ + CARD16 sequenceNumber; + Time timestamp; + Window root; + Window window; /* screen saver window */ + BYTE kind; /* blanked, internal, external */ + BYTE forced; + CARD16 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xScreenSaverNotifyEvent; +#define sz_xScreenSaverNotifyEvent 32 + +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef VisualID +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _SAVERPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/secur.h b/data/miniconda3/envs/catiagent/include/X11/extensions/secur.h new file mode 100644 index 0000000000000000000000000000000000000000..ca27b29e6fe672d913a001b8d6c64bad9aafc20e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/secur.h @@ -0,0 +1,61 @@ +/* +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _SECUR_H +#define _SECUR_H + +#define SECURITY_EXTENSION_NAME "SECURITY" +#define SECURITY_MAJOR_VERSION 1 +#define SECURITY_MINOR_VERSION 0 + +#define XSecurityNumberEvents 1 +#define XSecurityNumberErrors 2 +#define XSecurityBadAuthorization 0 +#define XSecurityBadAuthorizationProtocol 1 + +/* trust levels */ +#define XSecurityClientTrusted 0 +#define XSecurityClientUntrusted 1 + +/* authorization attribute masks */ +#define XSecurityTimeout (1<<0) +#define XSecurityTrustLevel (1<<1) +#define XSecurityGroup (1<<2) +#define XSecurityEventMask (1<<3) +#define XSecurityAllAuthorizationAttributes \ + (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask) + +/* event masks */ +#define XSecurityAuthorizationRevokedMask (1<<0) +#define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask + +/* event offsets */ +#define XSecurityAuthorizationRevoked 0 + +#define XSecurityAuthorizationName "XC-QUERY-SECURITY-1" +#define XSecurityAuthorizationNameLen 19 + +#endif /* _SECUR_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/security.h b/data/miniconda3/envs/catiagent/include/X11/extensions/security.h new file mode 100644 index 0000000000000000000000000000000000000000..f5541310b7fae20aab544b89941b2a0f844bd875 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/security.h @@ -0,0 +1,77 @@ +/* +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _SECURITY_H +#define _SECURITY_H + +#define _XAUTH_STRUCT_ONLY +#include + +#include + +_XFUNCPROTOBEGIN + +Status XSecurityQueryExtension ( + Display *dpy, + int *major_version_return, + int *minor_version_return); + +Xauth *XSecurityAllocXauth(void); + +void XSecurityFreeXauth(Xauth *auth); + +/* type for returned auth ids */ +typedef unsigned long XSecurityAuthorization; + +typedef struct { + unsigned int timeout; + unsigned int trust_level; + XID group; + long event_mask; +} XSecurityAuthorizationAttributes; + +Xauth *XSecurityGenerateAuthorization( + Display *dpy, + Xauth *auth_in, + unsigned long valuemask, + XSecurityAuthorizationAttributes *attributes, + XSecurityAuthorization *auth_id_return); + +Status XSecurityRevokeAuthorization( + Display *dpy, + XSecurityAuthorization auth_id); + +_XFUNCPROTOEND + +typedef struct { + int type; /* event base + XSecurityAuthorizationRevoked */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XSecurityAuthorization auth_id; /* revoked authorization id */ +} XSecurityAuthorizationRevokedEvent; + +#endif /* _SECURITY_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/securproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/securproto.h new file mode 100644 index 0000000000000000000000000000000000000000..d9e120c9068bc58e882bb801c09c20ab2f59153f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/securproto.h @@ -0,0 +1,110 @@ +/* +Copyright 1996, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. +*/ + +#ifndef _SECURPROTO_H +#define _SECURPROTO_H + +#include + +#define X_SecurityQueryVersion 0 +#define X_SecurityGenerateAuthorization 1 +#define X_SecurityRevokeAuthorization 2 + +typedef struct { + CARD8 reqType; + CARD8 securityReqType; + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xSecurityQueryVersionReq; +#define sz_xSecurityQueryVersionReq 8 + +typedef struct { + CARD8 type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + } xSecurityQueryVersionReply; +#define sz_xSecurityQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 securityReqType; + CARD16 length; + CARD16 nbytesAuthProto; + CARD16 nbytesAuthData; + CARD32 valueMask; + /* auth protocol name padded to 4 bytes */ + /* auth protocol data padded to 4 bytes */ + /* list of CARD32 values, if any */ +} xSecurityGenerateAuthorizationReq; +#define sz_xSecurityGenerateAuthorizationReq 12 + +typedef struct { + CARD8 type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 authId; + CARD16 dataLength; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + } xSecurityGenerateAuthorizationReply; +#define sz_xSecurityGenerateAuthorizationReply 32 + +typedef struct { + CARD8 reqType; + CARD8 securityReqType; + CARD16 length; + CARD32 authId; +} xSecurityRevokeAuthorizationReq; +#define sz_xSecurityRevokeAuthorizationReq 8 + +typedef struct _xSecurityAuthorizationRevokedEvent { + BYTE type; + BYTE detail; + CARD16 sequenceNumber; + CARD32 authId; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xSecurityAuthorizationRevokedEvent; +#define sz_xSecurityAuthorizationRevokedEvent 32 + +#endif /* _SECURPROTO_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shape.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shape.h new file mode 100644 index 0000000000000000000000000000000000000000..48b6943491445998defb6e4289fd2d56a9ebf168 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shape.h @@ -0,0 +1,152 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +#ifndef _SHAPE_H_ +#define _SHAPE_H_ + +#include +#include + +#ifndef _SHAPE_SERVER_ +#include + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window of event */ + int kind; /* ShapeBounding or ShapeClip */ + int x, y; /* extents of new region */ + unsigned width, height; + Time time; /* server timestamp when region changed */ + Bool shaped; /* true if the region exists */ +} XShapeEvent; + +_XFUNCPROTOBEGIN + +extern Bool XShapeQueryExtension ( + Display* /* display */, + int* /* event_base */, + int* /* error_base */ +); + +extern Status XShapeQueryVersion ( + Display* /* display */, + int* /* major_version */, + int* /* minor_version */ +); + +extern void XShapeCombineRegion ( + Display* /* display */, + Window /* dest */, + int /* dest_kind */, + int /* x_off */, + int /* y_off */, + Region /* region */, + int /* op */ +); + +extern void XShapeCombineRectangles ( + Display* /* display */, + Window /* dest */, + int /* dest_kind */, + int /* x_off */, + int /* y_off */, + XRectangle* /* rectangles */, + int /* n_rects */, + int /* op */, + int /* ordering */ +); + +extern void XShapeCombineMask ( + Display* /* display */, + Window /* dest */, + int /* dest_kind */, + int /* x_off */, + int /* y_off */, + Pixmap /* src */, + int /* op */ +); + +extern void XShapeCombineShape ( + Display* /* display */, + Window /* dest */, + int /* dest_kind */, + int /* x_off */, + int /* y_off */, + Window /* src */, + int /* src_kind */, + int /* op */ +); + +extern void XShapeOffsetShape ( + Display* /* display */, + Window /* dest */, + int /* dest_kind */, + int /* x_off */, + int /* y_off */ +); + +extern Status XShapeQueryExtents ( + Display* /* display */, + Window /* window */, + Bool* /* bounding_shaped */, + int* /* x_bounding */, + int* /* y_bounding */, + unsigned int* /* w_bounding */, + unsigned int* /* h_bounding */, + Bool* /* clip_shaped */, + int* /* x_clip */, + int* /* y_clip */, + unsigned int* /* w_clip */, + unsigned int* /* h_clip */ +); + +extern void XShapeSelectInput ( + Display* /* display */, + Window /* window */, + unsigned long /* mask */ +); + +extern unsigned long XShapeInputSelected ( + Display* /* display */, + Window /* window */ +); + +extern XRectangle *XShapeGetRectangles ( + Display* /* display */, + Window /* window */, + int /* kind */, + int* /* count */, + int* /* ordering */ +); + +_XFUNCPROTOEND + +#endif /* !_SHAPE_SERVER_ */ + +#endif /* _SHAPE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shapeconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shapeconst.h new file mode 100644 index 0000000000000000000000000000000000000000..9088956f1b90e79163ef997d731aa1d1d1b4a9b2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shapeconst.h @@ -0,0 +1,55 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +#ifndef _SHAPECONST_H_ +#define _SHAPECONST_H_ + +/* + * Protocol requests constants and alignment values + * These would really be in SHAPE's X.h and Xproto.h equivalents + */ + +#define SHAPENAME "SHAPE" + +#define SHAPE_MAJOR_VERSION 1 /* current version numbers */ +#define SHAPE_MINOR_VERSION 1 + +#define ShapeSet 0 +#define ShapeUnion 1 +#define ShapeIntersect 2 +#define ShapeSubtract 3 +#define ShapeInvert 4 + +#define ShapeBounding 0 +#define ShapeClip 1 +#define ShapeInput 2 + +#define ShapeNotifyMask (1L << 0) +#define ShapeNotify 0 + +#define ShapeNumberEvents (ShapeNotify + 1) + +#endif /* _SHAPECONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shapeproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shapeproto.h new file mode 100644 index 0000000000000000000000000000000000000000..e5c1838a875316b97647a6c7d8f54320fa9de82b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shapeproto.h @@ -0,0 +1,237 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +#ifndef _SHAPEPROTO_H_ +#define _SHAPEPROTO_H_ + +#include + +/* + * Protocol requests constants and alignment values + * These would really be in SHAPE's X.h and Xproto.h equivalents + */ + +#define Window CARD32 +#define Time CARD32 + +#define X_ShapeQueryVersion 0 +#define X_ShapeRectangles 1 +#define X_ShapeMask 2 +#define X_ShapeCombine 3 +#define X_ShapeOffset 4 +#define X_ShapeQueryExtents 5 +#define X_ShapeSelectInput 6 +#define X_ShapeInputSelected 7 +#define X_ShapeGetRectangles 8 + +typedef struct _ShapeQueryVersion { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeQueryVersion */ + CARD16 length; +} xShapeQueryVersionReq; +#define sz_xShapeQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of SHAPE protocol */ + CARD16 minorVersion; /* minor version of SHAPE protocol */ + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xShapeQueryVersionReply; +#define sz_xShapeQueryVersionReply 32 + +typedef struct _ShapeRectangles { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeRectangles */ + CARD16 length; + CARD8 op; /* Set, ... */ + CARD8 destKind; /* ShapeBounding or ShapeClip */ + CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ + CARD8 pad0; /* not used */ + Window dest; + INT16 xOff; + INT16 yOff; +} xShapeRectanglesReq; /* followed by xRects */ +#define sz_xShapeRectanglesReq 16 + +typedef struct _ShapeMask { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeMask */ + CARD16 length; + + CARD8 op; /* Set, ... */ + CARD8 destKind; /* ShapeBounding or ShapeClip */ + CARD16 junk; /* not used */ + + Window dest; + INT16 xOff; + INT16 yOff; + CARD32 src; /* 1 bit pixmap */ +} xShapeMaskReq; +#define sz_xShapeMaskReq 20 + +typedef struct _ShapeCombine { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeCombine */ + CARD16 length; + CARD8 op; /* Set, ... */ + CARD8 destKind; /* ShapeBounding or ShapeClip */ + CARD8 srcKind; /* ShapeBounding or ShapeClip */ + CARD8 junk; /* not used */ + Window dest; + INT16 xOff; + INT16 yOff; + Window src; +} xShapeCombineReq; +#define sz_xShapeCombineReq 20 + +typedef struct _ShapeOffset { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeOffset */ + CARD16 length; + CARD8 destKind; /* ShapeBounding or ShapeClip */ + CARD8 junk1; /* not used */ + CARD16 junk2; /* not used */ + Window dest; + INT16 xOff; + INT16 yOff; +} xShapeOffsetReq; +#define sz_xShapeOffsetReq 16 + +typedef struct _ShapeQueryExtents { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeQueryExtents */ + CARD16 length; + Window window; +} xShapeQueryExtentsReq; +#define sz_xShapeQueryExtentsReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD8 boundingShaped; /* window has bounding shape */ + CARD8 clipShaped; /* window has clip shape */ + CARD16 unused1; + INT16 xBoundingShape; /* extents of bounding shape */ + INT16 yBoundingShape; + CARD16 widthBoundingShape; + CARD16 heightBoundingShape; + INT16 xClipShape; /* extents of clip shape */ + INT16 yClipShape; + CARD16 widthClipShape; + CARD16 heightClipShape; + CARD32 pad1; +} xShapeQueryExtentsReply; +#define sz_xShapeQueryExtentsReply 32 + +typedef struct _ShapeSelectInput { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeSelectInput */ + CARD16 length; + Window window; + BYTE enable; /* xTrue -> send events */ + BYTE pad1; + CARD16 pad2; +} xShapeSelectInputReq; +#define sz_xShapeSelectInputReq 12 + +typedef struct _ShapeNotify { + BYTE type; /* always eventBase + ShapeNotify */ + BYTE kind; /* either ShapeBounding or ShapeClip */ + CARD16 sequenceNumber; + Window window; + INT16 x; + INT16 y; /* extents of new shape */ + CARD16 width; + CARD16 height; + Time time; /* time of change */ + BYTE shaped; /* set when a shape actual exists */ + BYTE pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; +} xShapeNotifyEvent; +#define sz_xShapeNotifyEvent 32 + +typedef struct _ShapeInputSelected { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeInputSelected */ + CARD16 length; + Window window; +} xShapeInputSelectedReq; +#define sz_xShapeInputSelectedReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 enabled; /* current status */ + CARD16 sequenceNumber; + CARD32 length; /* 0 */ + CARD32 pad1; /* unused */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xShapeInputSelectedReply; +#define sz_xShapeInputSelectedReply 32 + +typedef struct _ShapeGetRectangles { + CARD8 reqType; /* always ShapeReqCode */ + CARD8 shapeReqType; /* always X_ShapeGetRectangles */ + CARD16 length; + Window window; + CARD8 kind; /* ShapeBounding or ShapeClip */ + CARD8 junk1; + CARD16 junk2; +} xShapeGetRectanglesReq; +#define sz_xShapeGetRectanglesReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ + CARD16 sequenceNumber; + CARD32 length; /* not zero */ + CARD32 nrects; /* number of rectangles */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xShapeGetRectanglesReply; /* followed by xRectangles */ +#define sz_xShapeGetRectanglesReply 32 + +#undef Window +#undef Time + +#endif /* _SHAPEPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shapestr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shapestr.h new file mode 100644 index 0000000000000000000000000000000000000000..20fde1dbe690dfcd6c4151fc760fa7d2881d71e8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shapestr.h @@ -0,0 +1,8 @@ +#ifndef _SHAPESTR_H_ +#define _SHAPESTR_H_ + +#warning "shapestr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include + +#endif /* _SHAPESTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shm.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shm.h new file mode 100644 index 0000000000000000000000000000000000000000..be49f5e977a3f288ae392d2cf68897e3c6587583 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shm.h @@ -0,0 +1,44 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _SHM_H_ +#define _SHM_H_ + +#define SHMNAME "MIT-SHM" + +#define SHM_MAJOR_VERSION 1 /* current version numbers */ +#define SHM_MINOR_VERSION 2 + +#define ShmCompletion 0 +#define ShmNumberEvents (ShmCompletion + 1) + +#define BadShmSeg 0 +#define ShmNumberErrors (BadShmSeg + 1) + + +#endif /* _SHM_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shmproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shmproto.h new file mode 100644 index 0000000000000000000000000000000000000000..6e3260615d9bc295f706849a44921824ea30b37c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shmproto.h @@ -0,0 +1,229 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _SHMPROTO_H_ +#define _SHMPROTO_H_ + +#include + +#define ShmSeg CARD32 +#define Drawable CARD32 +#define VisualID CARD32 +#define GContext CARD32 +#define Pixmap CARD32 + +#define X_ShmQueryVersion 0 +#define X_ShmAttach 1 +#define X_ShmDetach 2 +#define X_ShmPutImage 3 +#define X_ShmGetImage 4 +#define X_ShmCreatePixmap 5 +#define X_ShmAttachFd 6 +#define X_ShmCreateSegment 7 + +typedef struct _ShmQueryVersion { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmQueryVersion */ + CARD16 length; +} xShmQueryVersionReq; +#define sz_xShmQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL sharedPixmaps; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of SHM protocol */ + CARD16 minorVersion; /* minor version of SHM protocol */ + CARD16 uid; + CARD16 gid; + CARD8 pixmapFormat; + CARD8 pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xShmQueryVersionReply; +#define sz_xShmQueryVersionReply 32 + +typedef struct _ShmAttach { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmAttach */ + CARD16 length; + ShmSeg shmseg; + CARD32 shmid; + BOOL readOnly; + BYTE pad0; + CARD16 pad1; +} xShmAttachReq; +#define sz_xShmAttachReq 16 + +typedef struct _ShmDetach { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmDetach */ + CARD16 length; + ShmSeg shmseg; +} xShmDetachReq; +#define sz_xShmDetachReq 8 + +typedef struct _ShmPutImage { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmPutImage */ + CARD16 length; + Drawable drawable; + GContext gc; + CARD16 totalWidth; + CARD16 totalHeight; + CARD16 srcX; + CARD16 srcY; + CARD16 srcWidth; + CARD16 srcHeight; + INT16 dstX; + INT16 dstY; + CARD8 depth; + CARD8 format; + CARD8 sendEvent; + CARD8 bpad; + ShmSeg shmseg; + CARD32 offset; +} xShmPutImageReq; +#define sz_xShmPutImageReq 40 + +typedef struct _ShmGetImage { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmGetImage */ + CARD16 length; + Drawable drawable; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD32 planeMask; + CARD8 format; + CARD8 pad0; + CARD8 pad1; + CARD8 pad2; + ShmSeg shmseg; + CARD32 offset; +} xShmGetImageReq; +#define sz_xShmGetImageReq 32 + +typedef struct _ShmGetImageReply { + BYTE type; /* X_Reply */ + CARD8 depth; + CARD16 sequenceNumber; + CARD32 length; + VisualID visual; + CARD32 size; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xShmGetImageReply; +#define sz_xShmGetImageReply 32 + +typedef struct _ShmCreatePixmap { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmCreatePixmap */ + CARD16 length; + Pixmap pid; + Drawable drawable; + CARD16 width; + CARD16 height; + CARD8 depth; + CARD8 pad0; + CARD8 pad1; + CARD8 pad2; + ShmSeg shmseg; + CARD32 offset; +} xShmCreatePixmapReq; +#define sz_xShmCreatePixmapReq 28 + +typedef struct _ShmCompletion { + BYTE type; /* always eventBase + ShmCompletion */ + BYTE bpad0; + CARD16 sequenceNumber; + Drawable drawable; + CARD16 minorEvent; + BYTE majorEvent; + BYTE bpad1; + ShmSeg shmseg; + CARD32 offset; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; +} xShmCompletionEvent; +#define sz_xShmCompletionEvent 32 + +/* Version 1.2 additions */ +typedef struct _ShmAttachFd { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmAttachFd */ + CARD16 length; + ShmSeg shmseg; + BOOL readOnly; + BYTE pad0; + CARD16 pad1; +} xShmAttachFdReq; +/* File descriptor is passed with this request */ +#define sz_xShmAttachFdReq 12 + +typedef struct _ShmCreateSegment { + CARD8 reqType; /* always ShmReqCode */ + CARD8 shmReqType; /* always X_ShmAttachFd */ + CARD16 length; + ShmSeg shmseg; + CARD32 size; + BOOL readOnly; + BYTE pad0; + CARD16 pad1; +} xShmCreateSegmentReq; +#define sz_xShmCreateSegmentReq 16 + +typedef struct { + CARD8 type; /* must be X_Reply */ + CARD8 nfd; /* must be 1 */ + CARD16 sequenceNumber; /* last sequence number */ + CARD32 length; /* 0 */ + CARD32 pad2; /* unused */ + CARD32 pad3; /* unused */ + CARD32 pad4; /* unused */ + CARD32 pad5; /* unused */ + CARD32 pad6; /* unused */ + CARD32 pad7; /* unused */ +} xShmCreateSegmentReply; +/* File descriptor is passed with this reply */ +#define sz_xShmCreateSegmentReply 32 + +#undef ShmSeg +#undef Drawable +#undef VisualID +#undef GContext +#undef Pixmap + +#endif /* _SHMPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/shmstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/shmstr.h new file mode 100644 index 0000000000000000000000000000000000000000..78f37596259cacee5ce59ab4704a194be3466a6c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/shmstr.h @@ -0,0 +1,63 @@ +/************************************************************ + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +********************************************************/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _SHMSTR_H_ +#define _SHMSTR_H_ + +#include + +#ifdef _XSHM_SERVER_ +#define XSHM_PUT_IMAGE_ARGS \ + DrawablePtr /* dst */, \ + GCPtr /* pGC */, \ + int /* depth */, \ + unsigned int /* format */, \ + int /* w */, \ + int /* h */, \ + int /* sx */, \ + int /* sy */, \ + int /* sw */, \ + int /* sh */, \ + int /* dx */, \ + int /* dy */, \ + char * /* data */ + +#define XSHM_CREATE_PIXMAP_ARGS \ + ScreenPtr /* pScreen */, \ + int /* width */, \ + int /* height */, \ + int /* depth */, \ + char * /* addr */ + +typedef struct _ShmFuncs { + PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS); + void (* PutImage)(XSHM_PUT_IMAGE_ARGS); +} ShmFuncs, *ShmFuncsPtr; +#endif + +#endif /* _SHMSTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/sync.h b/data/miniconda3/envs/catiagent/include/X11/extensions/sync.h new file mode 100644 index 0000000000000000000000000000000000000000..4471806d9b12046f1d67aac0a5682c32ed599df2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/sync.h @@ -0,0 +1,375 @@ +/* + +Copyright 1991, 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +#ifndef _SYNC_H_ +#define _SYNC_H_ + +#include +#include + +#ifdef _SYNC_SERVER +#include +#else + +_XFUNCPROTOBEGIN +/* get rid of macros so we can define corresponding functions */ +#undef XSyncIntToValue +#undef XSyncIntsToValue +#undef XSyncValueGreaterThan +#undef XSyncValueLessThan +#undef XSyncValueGreaterOrEqual +#undef XSyncValueLessOrEqual +#undef XSyncValueEqual +#undef XSyncValueIsNegative +#undef XSyncValueIsZero +#undef XSyncValueIsPositive +#undef XSyncValueLow32 +#undef XSyncValueHigh32 +#undef XSyncValueAdd +#undef XSyncValueSubtract +#undef XSyncMaxValue +#undef XSyncMinValue + +extern void XSyncIntToValue( + XSyncValue* /*pv*/, + int /*i*/ +); + +extern void XSyncIntsToValue( + XSyncValue* /*pv*/, + unsigned int /*l*/, + int /*h*/ +); + +extern Bool XSyncValueGreaterThan( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueLessThan( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueGreaterOrEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueLessOrEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueIsNegative( + XSyncValue /*v*/ +); + +extern Bool XSyncValueIsZero( + XSyncValue /*a*/ +); + +extern Bool XSyncValueIsPositive( + XSyncValue /*v*/ +); + +extern unsigned int XSyncValueLow32( + XSyncValue /*v*/ +); + +extern int XSyncValueHigh32( + XSyncValue /*v*/ +); + +extern void XSyncValueAdd( + XSyncValue* /*presult*/, + XSyncValue /*a*/, + XSyncValue /*b*/, + int* /*poverflow*/ +); + +extern void XSyncValueSubtract( + XSyncValue* /*presult*/, + XSyncValue /*a*/, + XSyncValue /*b*/, + int* /*poverflow*/ +); + +extern void XSyncMaxValue( + XSyncValue* /*pv*/ +); + +extern void XSyncMinValue( + XSyncValue* /*pv*/ +); + +_XFUNCPROTOEND + + +typedef struct _XSyncSystemCounter { + char *name; /* null-terminated name of system counter */ + XSyncCounter counter; /* counter id of this system counter */ + XSyncValue resolution; /* resolution of this system counter */ +} XSyncSystemCounter; + + +typedef struct { + XSyncCounter counter; /* counter to trigger on */ + XSyncValueType value_type; /* absolute/relative */ + XSyncValue wait_value; /* value to compare counter to */ + XSyncTestType test_type; /* pos/neg comparison/transition */ +} XSyncTrigger; + +typedef struct { + XSyncTrigger trigger; /* trigger for await */ + XSyncValue event_threshold; /* send event if past threshold */ +} XSyncWaitCondition; + + +typedef struct { + XSyncTrigger trigger; + XSyncValue delta; + Bool events; + XSyncAlarmState state; +} XSyncAlarmAttributes; + +/* + * Events + */ + +typedef struct { + int type; /* event base + XSyncCounterNotify */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XSyncCounter counter; /* counter involved in await */ + XSyncValue wait_value; /* value being waited for */ + XSyncValue counter_value; /* counter value when this event was sent */ + Time time; /* milliseconds */ + int count; /* how many more events to come */ + Bool destroyed; /* True if counter was destroyed */ +} XSyncCounterNotifyEvent; + +typedef struct { + int type; /* event base + XSyncAlarmNotify */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XSyncAlarm alarm; /* alarm that triggered */ + XSyncValue counter_value; /* value that triggered the alarm */ + XSyncValue alarm_value; /* test value of trigger in alarm */ + Time time; /* milliseconds */ + XSyncAlarmState state; /* new state of alarm */ +} XSyncAlarmNotifyEvent; + +/* + * Errors + */ + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XSyncAlarm alarm; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XSyncBadAlarm */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XSyncAlarmError; + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XSyncCounter counter; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XSyncBadCounter */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XSyncCounterError; + +/* + * Prototypes + */ + +_XFUNCPROTOBEGIN + +extern Status XSyncQueryExtension( + Display* /*dpy*/, + int* /*event_base_return*/, + int* /*error_base_return*/ +); + +extern Status XSyncInitialize( + Display* /*dpy*/, + int* /*major_version_return*/, + int* /*minor_version_return*/ +); + +extern XSyncSystemCounter *XSyncListSystemCounters( + Display* /*dpy*/, + int* /*n_counters_return*/ +); + +extern void XSyncFreeSystemCounterList( + XSyncSystemCounter* /*list*/ +); + +extern XSyncCounter XSyncCreateCounter( + Display* /*dpy*/, + XSyncValue /*initial_value*/ +); + +extern Status XSyncSetCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue /*value*/ +); + +extern Status XSyncChangeCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue /*value*/ +); + +extern Status XSyncDestroyCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/ +); + +extern Status XSyncQueryCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue* /*value_return*/ +); + +extern Status XSyncAwait( + Display* /*dpy*/, + XSyncWaitCondition* /*wait_list*/, + int /*n_conditions*/ +); + +extern XSyncAlarm XSyncCreateAlarm( + Display* /*dpy*/, + unsigned long /*values_mask*/, + XSyncAlarmAttributes* /*values*/ +); + +extern Status XSyncDestroyAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/ +); + +extern Status XSyncQueryAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/, + XSyncAlarmAttributes* /*values_return*/ +); + +extern Status XSyncChangeAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/, + unsigned long /*values_mask*/, + XSyncAlarmAttributes* /*values*/ +); + +extern Status XSyncSetPriority( + Display* /*dpy*/, + XID /*client_resource_id*/, + int /*priority*/ +); + +extern Status XSyncGetPriority( + Display* /*dpy*/, + XID /*client_resource_id*/, + int* /*return_priority*/ +); + +extern XSyncFence XSyncCreateFence( + Display* /*dpy*/, + Drawable /*d*/, + Bool /*initially_triggered*/ +); + +extern Bool XSyncTriggerFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncResetFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncDestroyFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncQueryFence( + Display* /*dpy*/, + XSyncFence /*fence*/, + Bool* /*triggered*/ +); + +extern Bool XSyncAwaitFence( + Display* /*dpy*/, + const XSyncFence* /*fence_list*/, + int /*n_fences*/ +); + +_XFUNCPROTOEND + +#endif /* _SYNC_SERVER */ + +#endif /* _SYNC_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/syncconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/syncconst.h new file mode 100644 index 0000000000000000000000000000000000000000..0479816e93fe64237cf931a5acc9938a52256473 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/syncconst.h @@ -0,0 +1,181 @@ +/* + +Copyright 1991, 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +#ifndef _SYNCCONST_H_ +#define _SYNCCONST_H_ + +#define SYNC_NAME "SYNC" + +#define SYNC_MAJOR_VERSION 3 +#define SYNC_MINOR_VERSION 1 + + +#define XSyncCounterNotify 0 +#define XSyncAlarmNotify 1 +#define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify) + +#define XSyncNumberEvents 2L + +#define XSyncBadCounter 0L +#define XSyncBadAlarm 1L +#define XSyncBadFence 2L +#define XSyncNumberErrors (XSyncBadFence + 1) + +/* + * Flags for Alarm Attributes + */ +#define XSyncCACounter (1L<<0) +#define XSyncCAValueType (1L<<1) +#define XSyncCAValue (1L<<2) +#define XSyncCATestType (1L<<3) +#define XSyncCADelta (1L<<4) +#define XSyncCAEvents (1L<<5) + +/* The _XSync macros below are for library internal use only. They exist + * so that if we have to make a fix, we can change it in this one place + * and have both the macro and function variants inherit the fix. + */ + +#define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i)) +#define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h)) +#define _XSyncValueGreaterThan(a, b)\ + ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo)) +#define _XSyncValueLessThan(a, b)\ + ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo)) +#define _XSyncValueGreaterOrEqual(a, b)\ + ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo)) +#define _XSyncValueLessOrEqual(a, b)\ + ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo)) +#define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi) +#define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0) +#define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0) +#define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1) +#define _XSyncValueLow32(v) ((v).lo) +#define _XSyncValueHigh32(v) ((v).hi) +#define _XSyncValueAdd(presult,a,b,poverflow) {\ + int t = (a).lo;\ + Bool signa = XSyncValueIsNegative(a);\ + Bool signb = XSyncValueIsNegative(b);\ + ((presult)->lo = (a).lo + (b).lo);\ + ((presult)->hi = (a).hi + (b).hi);\ + if (t>(presult)->lo) (presult)->hi++;\ + *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ + } +#define _XSyncValueSubtract(presult,a,b,poverflow) {\ + int t = (a).lo;\ + Bool signa = XSyncValueIsNegative(a);\ + Bool signb = XSyncValueIsNegative(b);\ + ((presult)->lo = (a).lo - (b).lo);\ + ((presult)->hi = (a).hi - (b).hi);\ + if (t<(presult)->lo) (presult)->hi--;\ + *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ + } +#define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff) +#define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0) + +/* + * These are the publicly usable macros. If you want the function version + * of one of these, just #undef the macro to uncover the function. + * (This is the same convention that the ANSI C library uses.) + */ + +#define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i) +#define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h) +#define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b) +#define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b) +#define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b) +#define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b) +#define XSyncValueEqual(a, b) _XSyncValueEqual(a, b) +#define XSyncValueIsNegative(v) _XSyncValueIsNegative(v) +#define XSyncValueIsZero(a) _XSyncValueIsZero(a) +#define XSyncValueIsPositive(v) _XSyncValueIsPositive(v) +#define XSyncValueLow32(v) _XSyncValueLow32(v) +#define XSyncValueHigh32(v) _XSyncValueHigh32(v) +#define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow) +#define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow) +#define XSyncMaxValue(pv) _XSyncMaxValue(pv) +#define XSyncMinValue(pv) _XSyncMinValue(pv) + +/* + * Constants for the value_type argument of various requests + */ +typedef enum { + XSyncAbsolute, + XSyncRelative +} XSyncValueType; + +/* + * Alarm Test types + */ +typedef enum { + XSyncPositiveTransition, + XSyncNegativeTransition, + XSyncPositiveComparison, + XSyncNegativeComparison +} XSyncTestType; + +/* + * Alarm state constants + */ +typedef enum { + XSyncAlarmActive, + XSyncAlarmInactive, + XSyncAlarmDestroyed +} XSyncAlarmState; + + +typedef XID XSyncCounter; +typedef XID XSyncAlarm; +typedef XID XSyncFence; +typedef struct _XSyncValue { + int hi; + unsigned int lo; +} XSyncValue; +#endif /* _SYNCCONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/syncproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/syncproto.h new file mode 100644 index 0000000000000000000000000000000000000000..0fa1db74afee1a1af721d65180936b73349fcf1b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/syncproto.h @@ -0,0 +1,474 @@ +/* + +Copyright 1991, 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +#ifndef _SYNCPROTO_H_ +#define _SYNCPROTO_H_ + +#include + +#define X_SyncInitialize 0 +#define X_SyncListSystemCounters 1 +#define X_SyncCreateCounter 2 +#define X_SyncSetCounter 3 +#define X_SyncChangeCounter 4 +#define X_SyncQueryCounter 5 +#define X_SyncDestroyCounter 6 +#define X_SyncAwait 7 +#define X_SyncCreateAlarm 8 +#define X_SyncChangeAlarm 9 +#define X_SyncQueryAlarm 10 +#define X_SyncDestroyAlarm 11 +#define X_SyncSetPriority 12 +#define X_SyncGetPriority 13 +#define X_SyncCreateFence 14 +#define X_SyncTriggerFence 15 +#define X_SyncResetFence 16 +#define X_SyncDestroyFence 17 +#define X_SyncQueryFence 18 +#define X_SyncAwaitFence 19 + +/* cover up types from sync.h to make sure they're the right size for + * protocol packaging. These will be undef'ed after all the protocol + * structures are defined. + */ +#define XSyncCounter CARD32 +#define XSyncAlarm CARD32 +#define XSyncFence CARD32 +#define Drawable CARD32 + +/* + * Initialize + */ +typedef struct _xSyncInitialize { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + CARD8 majorVersion; + CARD8 minorVersion; + CARD16 pad; +} xSyncInitializeReq; +#define sz_xSyncInitializeReq 8 + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + CARD8 majorVersion; + CARD8 minorVersion; + CARD16 pad; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xSyncInitializeReply; +#define sz_xSyncInitializeReply 32 + +/* + * ListSystemCounters + */ +typedef struct _xSyncListSystemCounters +{ + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; +} xSyncListSystemCountersReq; +#define sz_xSyncListSystemCountersReq 4 + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + INT32 nCounters; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xSyncListSystemCountersReply; +#define sz_xSyncListSystemCountersReply 32 + +typedef struct { + XSyncCounter counter; + INT32 resolution_hi; + CARD32 resolution_lo; + CARD16 name_length; +} xSyncSystemCounter; +#define sz_xSyncSystemCounter 14 + +/* + * Create Counter + */ +typedef struct _xSyncCreateCounterReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncCounter cid; + INT32 initial_value_hi; + CARD32 initial_value_lo; +} xSyncCreateCounterReq; +#define sz_xSyncCreateCounterReq 16 + +/* + * Change Counter + */ +typedef struct _xSyncChangeCounterReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncCounter cid; + INT32 value_hi; + CARD32 value_lo; +} xSyncChangeCounterReq; +#define sz_xSyncChangeCounterReq 16 + +/* + * Set Counter + */ +typedef struct _xSyncSetCounterReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncCounter cid; + INT32 value_hi; + CARD32 value_lo; +} xSyncSetCounterReq; +#define sz_xSyncSetCounterReq 16 + +/* + * Destroy Counter + */ +typedef struct _xSyncDestroyCounterReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncCounter counter; +} xSyncDestroyCounterReq; +#define sz_xSyncDestroyCounterReq 8 + +/* + * Query Counter + */ +typedef struct _xSyncQueryCounterReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncCounter counter; +} xSyncQueryCounterReq; +#define sz_xSyncQueryCounterReq 8 + + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + INT32 value_hi; + CARD32 value_lo; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xSyncQueryCounterReply; +#define sz_xSyncQueryCounterReply 32 + +/* + * Await + */ +typedef struct _xSyncAwaitReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; +} xSyncAwaitReq; +#define sz_xSyncAwaitReq 4 + +typedef struct _xSyncWaitCondition { + XSyncCounter counter; + CARD32 value_type; + INT32 wait_value_hi; + CARD32 wait_value_lo; + CARD32 test_type; + INT32 event_threshold_hi; + CARD32 event_threshold_lo; +} xSyncWaitCondition; +#define sz_xSyncWaitCondition 28 + +/* + * Create Alarm + */ +typedef struct _xSyncCreateAlarmReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncAlarm id; + CARD32 valueMask; +} xSyncCreateAlarmReq; +#define sz_xSyncCreateAlarmReq 12 + +/* + * Destroy Alarm + */ +typedef struct _xSyncDestroyAlarmReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncAlarm alarm; +} xSyncDestroyAlarmReq; +#define sz_xSyncDestroyAlarmReq 8 + +/* + * Query Alarm + */ +typedef struct _xSyncQueryAlarmReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncAlarm alarm; +} xSyncQueryAlarmReq; +#define sz_xSyncQueryAlarmReq 8 + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + XSyncCounter counter; + CARD32 value_type; + INT32 wait_value_hi; + CARD32 wait_value_lo; + CARD32 test_type; + INT32 delta_hi; + CARD32 delta_lo; + BOOL events; + BYTE state; + BYTE pad0; + BYTE pad1; +} xSyncQueryAlarmReply; +#define sz_xSyncQueryAlarmReply 40 + +/* + * Change Alarm + */ +typedef struct _xSyncChangeAlarmReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncAlarm alarm; + CARD32 valueMask; +} xSyncChangeAlarmReq; +#define sz_xSyncChangeAlarmReq 12 + +/* + * SetPriority + */ +typedef struct _xSyncSetPriority{ + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + CARD32 id; + INT32 priority; +} xSyncSetPriorityReq; +#define sz_xSyncSetPriorityReq 12 + +/* + * Get Priority + */ +typedef struct _xSyncGetPriority{ + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + CARD32 id; /*XXX XID? */ +} xSyncGetPriorityReq; +#define sz_xSyncGetPriorityReq 8 + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + INT32 priority; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xSyncGetPriorityReply; +#define sz_xSyncGetPriorityReply 32 + +/* + * Create Fence + */ +typedef struct _xSyncCreateFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + Drawable d; + XSyncFence fid; + BOOL initially_triggered; + CARD8 pad0; + CARD16 pad1; +} xSyncCreateFenceReq; +#define sz_xSyncCreateFenceReq 16 + +/* + * Put a fence object in the "triggered" state. + */ +typedef struct _xSyncTriggerFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncFence fid; +} xSyncTriggerFenceReq; +#define sz_xSyncTriggerFenceReq 8 + +/* + * Put a fence in the "untriggered" state. + */ +typedef struct _xSyncResetFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncFence fid; +} xSyncResetFenceReq; +#define sz_xSyncResetFenceReq 8 + +/* + * Destroy a fence object + */ +typedef struct _xSyncDestroyFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncFence fid; +} xSyncDestroyFenceReq; +#define sz_xSyncDestroyFenceReq 8 + +/* + * Query a fence object + */ +typedef struct _xSyncQueryFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; + XSyncFence fid; +} xSyncQueryFenceReq; +#define sz_xSyncQueryFenceReq 8 + +/* + * Wait for any of a list of fence sync objects + * to reach the "triggered" state. + */ +typedef struct _xSyncAwaitFenceReq { + CARD8 reqType; + CARD8 syncReqType; + CARD16 length; +} xSyncAwaitFenceReq; +#define sz_xSyncAwaitFenceReq 4 + +typedef struct { + BYTE type; + CARD8 unused; + CARD16 sequenceNumber; + CARD32 length; + BOOL triggered; + BYTE pad0; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xSyncQueryFenceReply; +#define sz_xSyncQueryFenceReply 32 + +/* + * Events + */ + +typedef struct _xSyncCounterNotifyEvent { + BYTE type; + BYTE kind; + CARD16 sequenceNumber; + XSyncCounter counter; + INT32 wait_value_hi; + CARD32 wait_value_lo; + INT32 counter_value_hi; + CARD32 counter_value_lo; + CARD32 time; + CARD16 count; + BOOL destroyed; + BYTE pad0; +} xSyncCounterNotifyEvent; + +typedef struct _xSyncAlarmNotifyEvent { + BYTE type; + BYTE kind; + CARD16 sequenceNumber; + XSyncAlarm alarm; + INT32 counter_value_hi; + CARD32 counter_value_lo; + INT32 alarm_value_hi; + CARD32 alarm_value_lo; + CARD32 time; + CARD8 state; + BYTE pad0; + BYTE pad1; + BYTE pad2; +} xSyncAlarmNotifyEvent; + +#undef XSyncCounter +#undef XSyncAlarm +#undef XSyncFence +#undef Drawable + + +#endif /* _SYNCPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/syncstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/syncstr.h new file mode 100644 index 0000000000000000000000000000000000000000..43cdcba4063b4219cf3ef954f3ef115b75b5d439 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/syncstr.h @@ -0,0 +1,182 @@ +/* + +Copyright 1991, 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +#ifndef _SYNCSTR_H_ +#define _SYNCSTR_H_ + +#include + +#ifdef _SYNC_SERVER + +#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ + +typedef struct _SyncCounter { + ClientPtr client; /* Owning client. 0 for system counters */ + XSyncCounter id; /* resource ID */ + CARD64 value; /* counter value */ + struct _SyncTriggerList *pTriglist; /* list of triggers */ + Bool beingDestroyed; /* in process of going away */ + struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ +} SyncCounter; + +/* + * The System Counter interface + */ + +typedef enum { + XSyncCounterNeverChanges, + XSyncCounterNeverIncreases, + XSyncCounterNeverDecreases, + XSyncCounterUnrestricted +} SyncCounterType; + +typedef struct _SysCounterInfo { + char *name; + CARD64 resolution; + CARD64 bracket_greater; + CARD64 bracket_less; + SyncCounterType counterType; /* how can this counter change */ + void (*QueryValue)( + pointer /*pCounter*/, + CARD64 * /*freshvalue*/ +); + void (*BracketValues)( + pointer /*pCounter*/, + CARD64 * /*lessthan*/, + CARD64 * /*greaterthan*/ +); +} SysCounterInfo; + + + +typedef struct _SyncTrigger { + SyncCounter *pCounter; + CARD64 wait_value; /* wait value */ + unsigned int value_type; /* Absolute or Relative */ + unsigned int test_type; /* transition or Comparison type */ + CARD64 test_value; /* trigger event threshold value */ + Bool (*CheckTrigger)( + struct _SyncTrigger * /*pTrigger*/, + CARD64 /*newval*/ + ); + void (*TriggerFired)( + struct _SyncTrigger * /*pTrigger*/ + ); + void (*CounterDestroyed)( + struct _SyncTrigger * /*pTrigger*/ + ); +} SyncTrigger; + +typedef struct _SyncTriggerList { + SyncTrigger *pTrigger; + struct _SyncTriggerList *next; +} SyncTriggerList; + +typedef struct _SyncAlarmClientList { + ClientPtr client; + XID delete_id; + struct _SyncAlarmClientList *next; +} SyncAlarmClientList; + +typedef struct _SyncAlarm { + SyncTrigger trigger; + ClientPtr client; + XSyncAlarm alarm_id; + CARD64 delta; + int events; + int state; + SyncAlarmClientList *pEventClients; +} SyncAlarm; + +typedef struct { + ClientPtr client; + CARD32 delete_id; + int num_waitconditions; +} SyncAwaitHeader; + +typedef struct { + SyncTrigger trigger; + CARD64 event_threshold; + SyncAwaitHeader *pHeader; +} SyncAwait; + +typedef union { + SyncAwaitHeader header; + SyncAwait await; +} SyncAwaitUnion; + + +extern pointer SyncCreateSystemCounter( + char * /* name */, + CARD64 /* initial_value */, + CARD64 /* resolution */, + SyncCounterType /* change characterization */, + void (* /*QueryValue*/ ) ( + pointer /* pCounter */, + CARD64 * /* pValue_return */), /* XXX prototype */ + void (* /*BracketValues*/) ( + pointer /* pCounter */, + CARD64 * /* pbracket_less */, + CARD64 * /* pbracket_greater */) +); + +extern void SyncChangeCounter( + SyncCounter * /* pCounter*/, + CARD64 /* new_value */ +); + +extern void SyncDestroySystemCounter( + pointer pCounter +); +extern void InitServertime(void); + +#endif /* _SYNC_SERVER */ + +#endif /* _SYNCSTR_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscproto.h new file mode 100644 index 0000000000000000000000000000000000000000..616cec37072ca9e579e0e96ecbcbdb0502b6258a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscproto.h @@ -0,0 +1,110 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XCMISCPROTO_H_ +#define _XCMISCPROTO_H_ + +#define X_XCMiscGetVersion 0 +#define X_XCMiscGetXIDRange 1 +#define X_XCMiscGetXIDList 2 + +#define XCMiscNumberEvents 0 + +#define XCMiscNumberErrors 0 + +#define XCMiscMajorVersion 1 +#define XCMiscMinorVersion 1 + +#define XCMiscExtensionName "XC-MISC" + +typedef struct { + CARD8 reqType; /* always XCMiscCode */ + CARD8 miscReqType; /* always X_XCMiscGetVersion */ + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xXCMiscGetVersionReq; +#define sz_xXCMiscGetVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXCMiscGetVersionReply; +#define sz_xXCMiscGetVersionReply 32 + +typedef struct { + CARD8 reqType; /* always XCMiscCode */ + CARD8 miscReqType; /* always X_XCMiscGetXIDRange */ + CARD16 length; +} xXCMiscGetXIDRangeReq; +#define sz_xXCMiscGetXIDRangeReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 start_id; + CARD32 count; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xXCMiscGetXIDRangeReply; +#define sz_xXCMiscGetXIDRangeReply 32 + +typedef struct { + CARD8 reqType; /* always XCMiscCode */ + CARD8 miscReqType; /* always X_XCMiscGetXIDList */ + CARD16 length; + CARD32 count; /* number of IDs requested */ +} xXCMiscGetXIDListReq; +#define sz_xXCMiscGetXIDListReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 count; /* number of IDs requested */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXCMiscGetXIDListReply; +#define sz_xXCMiscGetXIDListReply 32 + +#endif /* _XCMISCPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscstr.h new file mode 100644 index 0000000000000000000000000000000000000000..c2b643308cce88d36d2df62fefa831f67d0a4874 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xcmiscstr.h @@ -0,0 +1,3 @@ +#warning "xcmiscstr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfont.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfont.h new file mode 100644 index 0000000000000000000000000000000000000000..1bf47e92d1d8ba56c5772df032665abcfd03e6fb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfont.h @@ -0,0 +1,20 @@ +/* + * Declarations for the BIGFONT extension. + * + * Copyright (c) 1999-2000 Bruno Haible + * Copyright (c) 1999-2000 The XFree86 Project, Inc. + */ + +/* THIS IS NOT AN X CONSORTIUM STANDARD */ + +#ifndef _XF86BIGFONT_H_ +#define _XF86BIGFONT_H_ + +#define X_XF86BigfontQueryVersion 0 +#define X_XF86BigfontQueryFont 1 + +#define XF86BigfontNumberEvents 0 + +#define XF86BigfontNumberErrors 0 + +#endif /* _XF86BIGFONT_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfproto.h new file mode 100644 index 0000000000000000000000000000000000000000..a0710dd3ebf368809fc545d709e5aa0eb793e2ce --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfproto.h @@ -0,0 +1,92 @@ +/* + * Declarations of request structures for the BIGFONT extension. + * + * Copyright (c) 1999-2000 Bruno Haible + * Copyright (c) 1999-2000 The XFree86 Project, Inc. + */ + +/* THIS IS NOT AN X CONSORTIUM STANDARD */ + +#ifndef _XF86BIGFPROTO_H_ +#define _XF86BIGFPROTO_H_ + +#include + +#define XF86BIGFONTNAME "XFree86-Bigfont" + +#define XF86BIGFONT_MAJOR_VERSION 1 /* current version numbers */ +#define XF86BIGFONT_MINOR_VERSION 1 + +typedef struct _XF86BigfontQueryVersion { + CARD8 reqType; /* always XF86BigfontReqCode */ + CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryVersion */ + CARD16 length; +} xXF86BigfontQueryVersionReq; +#define sz_xXF86BigfontQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 capabilities; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of XFree86-Bigfont */ + CARD16 minorVersion; /* minor version of XFree86-Bigfont */ + CARD32 uid; + CARD32 gid; + CARD32 signature; + CARD32 pad1; + CARD32 pad2; +} xXF86BigfontQueryVersionReply; +#define sz_xXF86BigfontQueryVersionReply 32 + +/* Bit masks that can be set in the capabilities */ +#define XF86Bigfont_CAP_LocalShm 1 + +typedef struct _XF86BigfontQueryFont { + CARD8 reqType; /* always XF86BigfontReqCode */ + CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryFont */ + CARD16 length; + CARD32 id; + CARD32 flags; +} xXF86BigfontQueryFontReq; +#define sz_xXF86BigfontQueryFontReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + xCharInfo minBounds; +#ifndef WORD64 + CARD32 walign1; +#endif + xCharInfo maxBounds; +#ifndef WORD64 + CARD32 walign2; +#endif + CARD16 minCharOrByte2; + CARD16 maxCharOrByte2; + CARD16 defaultChar; + CARD16 nFontProps; + CARD8 drawDirection; + CARD8 minByte1; + CARD8 maxByte1; + BOOL allCharsExist; + INT16 fontAscent; + INT16 fontDescent; + CARD32 nCharInfos; + CARD32 nUniqCharInfos; + CARD32 shmid; + CARD32 shmsegoffset; + /* followed by nFontProps xFontProp structures */ + /* and if nCharInfos > 0 && shmid == -1, + followed by nUniqCharInfos xCharInfo structures + and then by nCharInfos CARD16 indices (each >= 0, < nUniqCharInfos) + and then, if nCharInfos is odd, one more CARD16 for padding. */ +} xXF86BigfontQueryFontReply; +#define sz_xXF86BigfontQueryFontReply 72 + +/* Bit masks that can be set in the flags */ +#define XF86Bigfont_FLAGS_Shm 1 + +#endif /* _XF86BIGFPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfstr.h new file mode 100644 index 0000000000000000000000000000000000000000..cf6735d499b0830c59eee706da7435f7be24f506 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86bigfstr.h @@ -0,0 +1,3 @@ +#warning "xf86bigfstr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga.h new file mode 100644 index 0000000000000000000000000000000000000000..7b5d635f923ee27110225186af31d9bf8094d9a9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga.h @@ -0,0 +1,13 @@ +#ifdef _XF86DGA_SERVER_ + +#warning "xf86dga.h is obsolete and may be removed in the future." +#warning "include instead." +#include + +#else + +#warning "xf86dga.h is obsolete and may be removed in the future." +#warning "include instead." +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1const.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1const.h new file mode 100644 index 0000000000000000000000000000000000000000..eca06f6af1c9c81f8b085ad2ac05efb95460dab5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1const.h @@ -0,0 +1,36 @@ +/* + +Copyright (c) 1995 Jon Tombs +Copyright (c) 1995 XFree86 Inc + +*/ + +/************************************************************************ + + THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE + +************************************************************************/ + +#ifndef _XF86DGA1CONST_H_ +#define _XF86DGA1CONST_H_ + +#define X_XF86DGAQueryVersion 0 +#define X_XF86DGAGetVideoLL 1 +#define X_XF86DGADirectVideo 2 +#define X_XF86DGAGetViewPortSize 3 +#define X_XF86DGASetViewPort 4 +#define X_XF86DGAGetVidPage 5 +#define X_XF86DGASetVidPage 6 +#define X_XF86DGAInstallColormap 7 +#define X_XF86DGAQueryDirectVideo 8 +#define X_XF86DGAViewPortChanged 9 + +#define XF86DGADirectPresent 0x0001 +#define XF86DGADirectGraphics 0x0002 +#define XF86DGADirectMouse 0x0004 +#define XF86DGADirectKeyb 0x0008 +#define XF86DGAHasColormap 0x0100 +#define XF86DGADirectColormap 0x0200 + + +#endif /* _XF86DGA1CONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1proto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1proto.h new file mode 100644 index 0000000000000000000000000000000000000000..61d95b3140d1f4ed83a1a9611be67989d72d87e9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1proto.h @@ -0,0 +1,195 @@ +/* + +Copyright (c) 1995 Jon Tombs +Copyright (c) 1995 XFree86 Inc. + +*/ + +#ifndef _XF86DGAPROTO1_H_ +#define _XF86DGAPROTO1_H_ + +#include + +typedef struct _XF86DGAQueryVersion { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_DGAQueryVersion */ + CARD16 length; +} xXF86DGAQueryVersionReq; +#define sz_xXF86DGAQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of DGA protocol */ + CARD16 minorVersion; /* minor version of DGA protocol */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86DGAQueryVersionReply; +#define sz_xXF86DGAQueryVersionReply 32 + +typedef struct _XF86DGAGetVideoLL { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */ + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86DGAGetVideoLLReq; +#define sz_xXF86DGAGetVideoLLReq 8 + +typedef struct _XF86DGAInstallColormap{ + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD16 screen; + CARD16 pad2; + CARD32 id; /* colormap. */ +} xXF86DGAInstallColormapReq; +#define sz_xXF86DGAInstallColormapReq 12 + + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 offset; + CARD32 width; + CARD32 bank_size; + CARD32 ram_size; + CARD32 pad4; + CARD32 pad5; +} xXF86DGAGetVideoLLReply; +#define sz_xXF86DGAGetVideoLLReply 32 + +typedef struct _XF86DGADirectVideo { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGADirectVideo */ + CARD16 length; + CARD16 screen; + CARD16 enable; +} xXF86DGADirectVideoReq; +#define sz_xXF86DGADirectVideoReq 8 + + +typedef struct _XF86DGAGetViewPortSize { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */ + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86DGAGetViewPortSizeReq; +#define sz_xXF86DGAGetViewPortSizeReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 width; + CARD32 height; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86DGAGetViewPortSizeReply; +#define sz_xXF86DGAGetViewPortSizeReply 32 + +typedef struct _XF86DGASetViewPort { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGASetViewPort */ + CARD16 length; + CARD16 screen; + CARD16 pad; + CARD32 x; + CARD32 y; +} xXF86DGASetViewPortReq; +#define sz_xXF86DGASetViewPortReq 16 + +typedef struct _XF86DGAGetVidPage { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */ + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86DGAGetVidPageReq; +#define sz_xXF86DGAGetVidPageReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 vpage; + CARD32 pad; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86DGAGetVidPageReply; +#define sz_xXF86DGAGetVidPageReply 32 + + +typedef struct _XF86DGASetVidPage { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_XF86DGASetVidPage */ + CARD16 length; + CARD16 screen; + CARD16 vpage; +} xXF86DGASetVidPageReq; +#define sz_xXF86DGASetVidPageReq 8 + + +typedef struct _XF86DGAQueryDirectVideo { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_DGAQueryVersion */ + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86DGAQueryDirectVideoReq; +#define sz_xXF86DGAQueryDirectVideoReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 flags; + CARD32 pad; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86DGAQueryDirectVideoReply; +#define sz_xXF86DGAQueryDirectVideoReply 32 + + +typedef struct _XF86DGAViewPortChanged { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_DGAQueryVersion */ + CARD16 length; + CARD16 screen; + CARD16 n; +} xXF86DGAViewPortChangedReq; +#define sz_xXF86DGAViewPortChangedReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 result; + CARD32 pad; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86DGAViewPortChangedReply; +#define sz_xXF86DGAViewPortChangedReply 32 + +#endif /* _XF86DGAPROTO1_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1str.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1str.h new file mode 100644 index 0000000000000000000000000000000000000000..d8e73e8cae514b3d12dfc2959187002fce33ce58 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dga1str.h @@ -0,0 +1,3 @@ +#warning "xf86dga1str.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaconst.h new file mode 100644 index 0000000000000000000000000000000000000000..b21e84fd834513427d3a08171199d599bcd00b6e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaconst.h @@ -0,0 +1,96 @@ +/* + Copyright (c) 1999 XFree86 Inc +*/ + +#ifndef _XF86DGACONST_H_ +#define _XF86DGACONST_H_ + +#include + +#define X_XDGAQueryVersion 0 + +/* 1 through 9 are in xf86dga1.h */ + +/* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */ + +#define X_XDGAQueryModes 12 +#define X_XDGASetMode 13 +#define X_XDGASetViewport 14 +#define X_XDGAInstallColormap 15 +#define X_XDGASelectInput 16 +#define X_XDGAFillRectangle 17 +#define X_XDGACopyArea 18 +#define X_XDGACopyTransparentArea 19 +#define X_XDGAGetViewportStatus 20 +#define X_XDGASync 21 +#define X_XDGAOpenFramebuffer 22 +#define X_XDGACloseFramebuffer 23 +#define X_XDGASetClientVersion 24 +#define X_XDGAChangePixmapMode 25 +#define X_XDGACreateColormap 26 + + +#define XDGAConcurrentAccess 0x00000001 +#define XDGASolidFillRect 0x00000002 +#define XDGABlitRect 0x00000004 +#define XDGABlitTransRect 0x00000008 +#define XDGAPixmap 0x00000010 + +#define XDGAInterlaced 0x00010000 +#define XDGADoublescan 0x00020000 + +#define XDGAFlipImmediate 0x00000001 +#define XDGAFlipRetrace 0x00000002 + +#define XDGANeedRoot 0x00000001 + +#define XF86DGANumberEvents 7 + +#define XDGAPixmapModeLarge 0 +#define XDGAPixmapModeSmall 1 + +#define XF86DGAClientNotLocal 0 +#define XF86DGANoDirectVideoMode 1 +#define XF86DGAScreenNotActive 2 +#define XF86DGADirectNotActivated 3 +#define XF86DGAOperationNotSupported 4 +#define XF86DGANumberErrors (XF86DGAOperationNotSupported + 1) + + +typedef struct { + int num; /* A unique identifier for the mode (num > 0) */ + char *name; /* name of mode given in the XF86Config */ + float verticalRefresh; + int flags; /* DGA_CONCURRENT_ACCESS, etc... */ + int imageWidth; /* linear accessible portion (pixels) */ + int imageHeight; + int pixmapWidth; /* Xlib accessible portion (pixels) */ + int pixmapHeight; /* both fields ignored if no concurrent access */ + int bytesPerScanline; + int byteOrder; /* MSBFirst, LSBFirst */ + int depth; + int bitsPerPixel; + unsigned long redMask; + unsigned long greenMask; + unsigned long blueMask; + short visualClass; + int viewportWidth; + int viewportHeight; + int xViewportStep; /* viewport position granularity */ + int yViewportStep; + int maxViewportX; /* max viewport origin */ + int maxViewportY; + int viewportFlags; /* types of page flipping possible */ + int reserved1; + int reserved2; +} XDGAMode; + + +typedef struct { + XDGAMode mode; + unsigned char *data; + Pixmap pixmap; +} XDGADevice; + + +#endif /* _XF86DGACONST_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaproto.h new file mode 100644 index 0000000000000000000000000000000000000000..2e8a712e86a907c40f693bb72f7c10aeb64aef75 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgaproto.h @@ -0,0 +1,344 @@ +/* + +Copyright (c) 1995 Jon Tombs +Copyright (c) 1995 XFree86 Inc. + +*/ + +#ifndef _XF86DGAPROTO_H_ +#define _XF86DGAPROTO_H_ + +#include +#include + +#define XF86DGANAME "XFree86-DGA" + +#define XDGA_MAJOR_VERSION 2 /* current version numbers */ +#define XDGA_MINOR_VERSION 0 + + +typedef struct _XDGAQueryVersion { + CARD8 reqType; /* always DGAReqCode */ + CARD8 dgaReqType; /* always X_DGAQueryVersion */ + CARD16 length; +} xXDGAQueryVersionReq; +#define sz_xXDGAQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of DGA protocol */ + CARD16 minorVersion; /* minor version of DGA protocol */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXDGAQueryVersionReply; +#define sz_xXDGAQueryVersionReply 32 + +typedef struct _XDGAQueryModes { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; +} xXDGAQueryModesReq; +#define sz_xXDGAQueryModesReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 number; /* number of modes available */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXDGAQueryModesReply; +#define sz_xXDGAQueryModesReply 32 + + +typedef struct _XDGASetMode { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD32 mode; /* mode number to init */ + CARD32 pid; /* Pixmap descriptor */ +} xXDGASetModeReq; +#define sz_xXDGASetModeReq 16 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 offset; /* offset into framebuffer map */ + CARD32 flags; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXDGASetModeReply; +#define sz_xXDGASetModeReply 32 + +typedef struct { + CARD8 byte_order; + CARD8 depth; + CARD16 num; + CARD16 bpp; + CARD16 name_size; + CARD32 vsync_num; + CARD32 vsync_den; + CARD32 flags; + CARD16 image_width; + CARD16 image_height; + CARD16 pixmap_width; + CARD16 pixmap_height; + CARD32 bytes_per_scanline; + CARD32 red_mask; + CARD32 green_mask; + CARD32 blue_mask; + CARD16 visual_class; + CARD16 pad1; + CARD16 viewport_width; + CARD16 viewport_height; + CARD16 viewport_xstep; + CARD16 viewport_ystep; + CARD16 viewport_xmax; + CARD16 viewport_ymax; + CARD32 viewport_flags; + CARD32 reserved1; + CARD32 reserved2; +} xXDGAModeInfo; +#define sz_xXDGAModeInfo 72 + +typedef struct _XDGAOpenFramebuffer { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; +} xXDGAOpenFramebufferReq; +#define sz_xXDGAOpenFramebufferReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; /* device name size if there is one */ + CARD32 mem1; /* physical memory */ + CARD32 mem2; /* spillover for _alpha_ */ + CARD32 size; /* size of map in bytes */ + CARD32 offset; /* optional offset into device */ + CARD32 extra; /* extra info associated with the map */ + CARD32 pad2; +} xXDGAOpenFramebufferReply; +#define sz_xXDGAOpenFramebufferReply 32 + + +typedef struct _XDGACloseFramebuffer { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; +} xXDGACloseFramebufferReq; +#define sz_xXDGACloseFramebufferReq 8 + + +typedef struct _XDGASetViewport { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD16 x; + CARD16 y; + CARD32 flags; +} xXDGASetViewportReq; +#define sz_xXDGASetViewportReq 16 + + +typedef struct _XDGAInstallColormap { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD32 cmap; +} xXDGAInstallColormapReq; +#define sz_xXDGAInstallColormapReq 12 + +typedef struct _XDGASelectInput { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD32 mask; +} xXDGASelectInputReq; +#define sz_xXDGASelectInputReq 12 + +typedef struct _XDGAFillRectangle { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD16 x; + CARD16 y; + CARD16 width; + CARD16 height; + CARD32 color; +} xXDGAFillRectangleReq; +#define sz_xXDGAFillRectangleReq 20 + + +typedef struct _XDGACopyArea { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD16 srcx; + CARD16 srcy; + CARD16 width; + CARD16 height; + CARD16 dstx; + CARD16 dsty; +} xXDGACopyAreaReq; +#define sz_xXDGACopyAreaReq 20 + +typedef struct _XDGACopyTransparentArea { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD16 srcx; + CARD16 srcy; + CARD16 width; + CARD16 height; + CARD16 dstx; + CARD16 dsty; + CARD32 key; +} xXDGACopyTransparentAreaReq; +#define sz_xXDGACopyTransparentAreaReq 24 + + +typedef struct _XDGAGetViewportStatus { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; +} xXDGAGetViewportStatusReq; +#define sz_xXDGAGetViewportStatusReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXDGAGetViewportStatusReply; +#define sz_xXDGAGetViewportStatusReply 32 + +typedef struct _XDGASync { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; +} xXDGASyncReq; +#define sz_xXDGASyncReq 8 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xXDGASyncReply; +#define sz_xXDGASyncReply 32 + +typedef struct _XDGASetClientVersion { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD16 major; + CARD16 minor; +} xXDGASetClientVersionReq; +#define sz_xXDGASetClientVersionReq 8 + + +typedef struct { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD16 x; + CARD16 y; + CARD32 flags; +} xXDGAChangePixmapModeReq; +#define sz_xXDGAChangePixmapModeReq 16 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 x; + CARD16 y; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} xXDGAChangePixmapModeReply; +#define sz_xXDGAChangePixmapModeReply 32 + +typedef struct _XDGACreateColormap { + CARD8 reqType; + CARD8 dgaReqType; + CARD16 length; + CARD32 screen; + CARD32 id; + CARD32 mode; + CARD8 alloc; + CARD8 pad1; + CARD16 pad2; +} xXDGACreateColormapReq; +#define sz_xXDGACreateColormapReq 20 + + +typedef struct { + union { + struct { + BYTE type; + BYTE detail; + CARD16 sequenceNumber; + } u; + struct { + CARD32 pad0; + CARD32 time; + INT16 dx; + INT16 dy; + INT16 screen; + CARD16 state; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + } event; + } u; +} dgaEvent; + + +#endif /* _XF86DGAPROTO_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgastr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgastr.h new file mode 100644 index 0000000000000000000000000000000000000000..f4809d1a591d4b50016f1fda6d0a6b464e3e3c3d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86dgastr.h @@ -0,0 +1,3 @@ +#warning "xf86dgastr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vm.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vm.h new file mode 100644 index 0000000000000000000000000000000000000000..a874ab50734033f82a52118a673bc163e1eb515e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vm.h @@ -0,0 +1,65 @@ +/* + +Copyright 1995 Kaleb S. KEITHLEY + +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 Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Kaleb S. KEITHLEY +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +from Kaleb S. KEITHLEY + +*/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _XF86VM_H_ +#define _XF86VM_H_ + +#include + + +#define CLKFLAG_PROGRAMABLE 1 + +#ifdef XF86VIDMODE_EVENTS +#define XF86VidModeNotify 0 +#define XF86VidModeNumberEvents (XF86VidModeNotify + 1) + +#define XF86VidModeNotifyMask 0x00000001 + +#define XF86VidModeNonEvent 0 +#define XF86VidModeModeChange 1 +#else +#define XF86VidModeNumberEvents 0 +#endif + +#define XF86VidModeBadClock 0 +#define XF86VidModeBadHTimings 1 +#define XF86VidModeBadVTimings 2 +#define XF86VidModeModeUnsuitable 3 +#define XF86VidModeExtensionDisabled 4 +#define XF86VidModeClientNotLocal 5 +#define XF86VidModeZoomLocked 6 +#define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1) + +#define XF86VM_READ_PERMISSION 1 +#define XF86VM_WRITE_PERMISSION 2 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmproto.h new file mode 100644 index 0000000000000000000000000000000000000000..73072842481d9587b11cb71b10afed91d6e1211a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmproto.h @@ -0,0 +1,583 @@ +/* + +Copyright 1995 Kaleb S. KEITHLEY + +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 Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Kaleb S. KEITHLEY +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +from Kaleb S. KEITHLEY + +*/ + +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _XF86VIDMODEPROTO_H_ +#define _XF86VIDMODEPROTO_H_ + +#include + +#define XF86VIDMODENAME "XFree86-VidModeExtension" + +#define XF86VIDMODE_MAJOR_VERSION 2 /* current version numbers */ +#define XF86VIDMODE_MINOR_VERSION 2 + +#define X_XF86VidModeQueryVersion 0 +#define X_XF86VidModeGetModeLine 1 +#define X_XF86VidModeModModeLine 2 +#define X_XF86VidModeSwitchMode 3 +#define X_XF86VidModeGetMonitor 4 +#define X_XF86VidModeLockModeSwitch 5 +#define X_XF86VidModeGetAllModeLines 6 +#define X_XF86VidModeAddModeLine 7 +#define X_XF86VidModeDeleteModeLine 8 +#define X_XF86VidModeValidateModeLine 9 +#define X_XF86VidModeSwitchToMode 10 +#define X_XF86VidModeGetViewPort 11 +#define X_XF86VidModeSetViewPort 12 +/* new for version 2.x of this extension */ +#define X_XF86VidModeGetDotClocks 13 +#define X_XF86VidModeSetClientVersion 14 +#define X_XF86VidModeSetGamma 15 +#define X_XF86VidModeGetGamma 16 +#define X_XF86VidModeGetGammaRamp 17 +#define X_XF86VidModeSetGammaRamp 18 +#define X_XF86VidModeGetGammaRampSize 19 +#define X_XF86VidModeGetPermissions 20 +/* + * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm. + * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune + * client. + * major version 2 == uses new protocol version in XFree86 4.0. + */ + +typedef struct _XF86VidModeQueryVersion { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */ + CARD16 length; +} xXF86VidModeQueryVersionReq; +#define sz_xXF86VidModeQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; /* major version of XF86VidMode */ + CARD16 minorVersion; /* minor version of XF86VidMode */ + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86VidModeQueryVersionReply; +#define sz_xXF86VidModeQueryVersionReply 32 + +typedef struct _XF86VidModeGetModeLine { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86VidModeGetModeLineReq, + xXF86VidModeGetAllModeLinesReq, + xXF86VidModeGetMonitorReq, + xXF86VidModeGetViewPortReq, + xXF86VidModeGetDotClocksReq, + xXF86VidModeGetPermissionsReq; +#define sz_xXF86VidModeGetModeLineReq 8 +#define sz_xXF86VidModeGetAllModeLinesReq 8 +#define sz_xXF86VidModeGetMonitorReq 8 +#define sz_xXF86VidModeGetViewPortReq 8 +#define sz_xXF86VidModeGetDotClocksReq 8 +#define sz_xXF86VidModeGetPermissionsReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 hskew; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD16 pad2; + CARD32 flags; + CARD32 reserved1; + CARD32 reserved2; + CARD32 reserved3; + CARD32 privsize; +} xXF86VidModeGetModeLineReply; +#define sz_xXF86VidModeGetModeLineReply 52 + +/* 0.x version */ +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD32 flags; + CARD32 privsize; +} xXF86OldVidModeGetModeLineReply; +#define sz_xXF86OldVidModeGetModeLineReply 36 + +typedef struct { + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD32 hskew; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD16 pad1; + CARD32 flags; + CARD32 reserved1; + CARD32 reserved2; + CARD32 reserved3; + CARD32 privsize; +} xXF86VidModeModeInfo; + +/* 0.x version */ +typedef struct { + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD32 flags; + CARD32 privsize; +} xXF86OldVidModeModeInfo; + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 modecount; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86VidModeGetAllModeLinesReply; +#define sz_xXF86VidModeGetAllModeLinesReply 32 + +typedef struct _XF86VidModeAddModeLine { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 hskew; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD16 pad1; + CARD32 flags; + CARD32 reserved1; + CARD32 reserved2; + CARD32 reserved3; + CARD32 privsize; + CARD32 after_dotclock; + CARD16 after_hdisplay; + CARD16 after_hsyncstart; + CARD16 after_hsyncend; + CARD16 after_htotal; + CARD16 after_hskew; + CARD16 after_vdisplay; + CARD16 after_vsyncstart; + CARD16 after_vsyncend; + CARD16 after_vtotal; + CARD16 pad2; + CARD32 after_flags; + CARD32 reserved4; + CARD32 reserved5; + CARD32 reserved6; +} xXF86VidModeAddModeLineReq; +#define sz_xXF86VidModeAddModeLineReq 92 + +/* 0.x version */ +typedef struct _XF86OldVidModeAddModeLine { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD32 flags; + CARD32 privsize; + CARD32 after_dotclock; + CARD16 after_hdisplay; + CARD16 after_hsyncstart; + CARD16 after_hsyncend; + CARD16 after_htotal; + CARD16 after_vdisplay; + CARD16 after_vsyncstart; + CARD16 after_vsyncend; + CARD16 after_vtotal; + CARD32 after_flags; +} xXF86OldVidModeAddModeLineReq; +#define sz_xXF86OldVidModeAddModeLineReq 60 + +typedef struct _XF86VidModeModModeLine { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */ + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 hskew; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD16 pad1; + CARD32 flags; + CARD32 reserved1; + CARD32 reserved2; + CARD32 reserved3; + CARD32 privsize; +} xXF86VidModeModModeLineReq; +#define sz_xXF86VidModeModModeLineReq 48 + +/* 0.x version */ +typedef struct _XF86OldVidModeModModeLine { + CARD8 reqType; /* always XF86OldVidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86OldVidModeModModeLine */ + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD32 flags; + CARD32 privsize; +} xXF86OldVidModeModModeLineReq; +#define sz_xXF86OldVidModeModModeLineReq 32 + +typedef struct _XF86VidModeValidateModeLine { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 hskew; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD16 pad1; + CARD32 flags; + CARD32 reserved1; + CARD32 reserved2; + CARD32 reserved3; + CARD32 privsize; +} xXF86VidModeDeleteModeLineReq, + xXF86VidModeValidateModeLineReq, + xXF86VidModeSwitchToModeReq; +#define sz_xXF86VidModeDeleteModeLineReq 52 +#define sz_xXF86VidModeValidateModeLineReq 52 +#define sz_xXF86VidModeSwitchToModeReq 52 + +/* 0.x version */ +typedef struct _XF86OldVidModeValidateModeLine { + CARD8 reqType; /* always XF86OldVidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD32 screen; /* could be CARD16 but need the pad */ + CARD32 dotclock; + CARD16 hdisplay; + CARD16 hsyncstart; + CARD16 hsyncend; + CARD16 htotal; + CARD16 vdisplay; + CARD16 vsyncstart; + CARD16 vsyncend; + CARD16 vtotal; + CARD32 flags; + CARD32 privsize; +} xXF86OldVidModeDeleteModeLineReq, + xXF86OldVidModeValidateModeLineReq, + xXF86OldVidModeSwitchToModeReq; +#define sz_xXF86OldVidModeDeleteModeLineReq 36 +#define sz_xXF86OldVidModeValidateModeLineReq 36 +#define sz_xXF86OldVidModeSwitchToModeReq 36 + +typedef struct _XF86VidModeSwitchMode { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */ + CARD16 length; + CARD16 screen; + CARD16 zoom; +} xXF86VidModeSwitchModeReq; +#define sz_xXF86VidModeSwitchModeReq 8 + +typedef struct _XF86VidModeLockModeSwitch { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */ + CARD16 length; + CARD16 screen; + CARD16 lock; +} xXF86VidModeLockModeSwitchReq; +#define sz_xXF86VidModeLockModeSwitchReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 status; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86VidModeValidateModeLineReply; +#define sz_xXF86VidModeValidateModeLineReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD8 vendorLength; + CARD8 modelLength; + CARD8 nhsync; + CARD8 nvsync; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86VidModeGetMonitorReply; +#define sz_xXF86VidModeGetMonitorReply 32 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 x; + CARD32 y; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86VidModeGetViewPortReply; +#define sz_xXF86VidModeGetViewPortReply 32 + +typedef struct _XF86VidModeSetViewPort { + CARD8 reqType; /* always VidModeReqCode */ + CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */ + CARD16 length; + CARD16 screen; + CARD16 pad; + CARD32 x; + CARD32 y; +} xXF86VidModeSetViewPortReq; +#define sz_xXF86VidModeSetViewPortReq 16 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 flags; + CARD32 clocks; + CARD32 maxclocks; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; +} xXF86VidModeGetDotClocksReply; +#define sz_xXF86VidModeGetDotClocksReply 32 + +typedef struct _XF86VidModeSetClientVersion { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 major; + CARD16 minor; +} xXF86VidModeSetClientVersionReq; +#define sz_xXF86VidModeSetClientVersionReq 8 + +typedef struct _XF86VidModeGetGamma { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 pad; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXF86VidModeGetGammaReq; +#define sz_xXF86VidModeGetGammaReq 32 + +typedef struct { + BYTE type; + BOOL pad; + CARD16 sequenceNumber; + CARD32 length; + CARD32 red; + CARD32 green; + CARD32 blue; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xXF86VidModeGetGammaReply; +#define sz_xXF86VidModeGetGammaReply 32 + +typedef struct _XF86VidModeSetGamma { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 pad; + CARD32 red; + CARD32 green; + CARD32 blue; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xXF86VidModeSetGammaReq; +#define sz_xXF86VidModeSetGammaReq 32 + + +typedef struct _XF86VidModeSetGammaRamp { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 size; +} xXF86VidModeSetGammaRampReq; +#define sz_xXF86VidModeSetGammaRampReq 8 + +typedef struct _XF86VidModeGetGammaRamp { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 size; +} xXF86VidModeGetGammaRampReq; +#define sz_xXF86VidModeGetGammaRampReq 8 + +typedef struct { + BYTE type; + BOOL pad; + CARD16 sequenceNumber; + CARD32 length; + CARD16 size; + CARD16 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86VidModeGetGammaRampReply; +#define sz_xXF86VidModeGetGammaRampReply 32 + +typedef struct _XF86VidModeGetGammaRampSize { + CARD8 reqType; /* always XF86VidModeReqCode */ + CARD8 xf86vidmodeReqType; + CARD16 length; + CARD16 screen; + CARD16 pad; +} xXF86VidModeGetGammaRampSizeReq; +#define sz_xXF86VidModeGetGammaRampSizeReq 8 + +typedef struct { + BYTE type; + BOOL pad; + CARD16 sequenceNumber; + CARD32 length; + CARD16 size; + CARD16 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86VidModeGetGammaRampSizeReply; +#define sz_xXF86VidModeGetGammaRampSizeReply 32 + +typedef struct { + BYTE type; + BOOL pad; + CARD16 sequenceNumber; + CARD32 length; + CARD32 permissions; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXF86VidModeGetPermissionsReply; +#define sz_xXF86VidModeGetPermissionsReply 32 + + +#endif /* _XF86VIDMODEPROTO_H_ */ + diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmstr.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmstr.h new file mode 100644 index 0000000000000000000000000000000000000000..f521335b3c4f40ed87d205b8db68ce552c157249 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xf86vmstr.h @@ -0,0 +1,3 @@ +#warning "xf86vmstr.h is obsolete and may be removed in the future." +#warning "include for the protocol defines." +#include diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xfixesproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xfixesproto.h new file mode 100644 index 0000000000000000000000000000000000000000..916535a53102939abf229d99e7e4f1cac91fa78e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xfixesproto.h @@ -0,0 +1,585 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. + * Copyright 2010 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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. + */ +/* + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XFIXESPROTO_H_ +#define _XFIXESPROTO_H_ + +#include +#include +#include + +#define Window CARD32 +#define Drawable CARD32 +#define Font CARD32 +#define Pixmap CARD32 +#define Cursor CARD32 +#define Colormap CARD32 +#define GContext CARD32 +#define Atom CARD32 +#define VisualID CARD32 +#define Time CARD32 +#define KeyCode CARD8 +#define KeySym CARD32 +#define Picture CARD32 + +/*************** Version 1 ******************/ + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; +} xXFixesReq; + +/* + * requests and replies + */ +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + CARD32 majorVersion; + CARD32 minorVersion; +} xXFixesQueryVersionReq; + +#define sz_xXFixesQueryVersionReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 majorVersion; + CARD32 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXFixesQueryVersionReply; + +#define sz_xXFixesQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + BYTE mode; /* SetModeInsert/SetModeDelete*/ + BYTE target; /* SaveSetNearest/SaveSetRoot*/ + BYTE map; /* SaveSetMap/SaveSetUnmap */ + BYTE pad1; + Window window; +} xXFixesChangeSaveSetReq; + +#define sz_xXFixesChangeSaveSetReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Window window; + Atom selection; + CARD32 eventMask; +} xXFixesSelectSelectionInputReq; + +#define sz_xXFixesSelectSelectionInputReq 16 + +typedef struct { + CARD8 type; + CARD8 subtype; + CARD16 sequenceNumber; + Window window; + Window owner; + Atom selection; + Time timestamp; + Time selectionTimestamp; + CARD32 pad2; + CARD32 pad3; +} xXFixesSelectionNotifyEvent; + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Window window; + CARD32 eventMask; +} xXFixesSelectCursorInputReq; + +#define sz_xXFixesSelectCursorInputReq 12 + +typedef struct { + CARD8 type; + CARD8 subtype; + CARD16 sequenceNumber; + Window window; + CARD32 cursorSerial; + Time timestamp; + Atom name; /* Version 2 */ + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; +} xXFixesCursorNotifyEvent; + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; +} xXFixesGetCursorImageReq; + +#define sz_xXFixesGetCursorImageReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD16 xhot; + CARD16 yhot; + CARD32 cursorSerial; + CARD32 pad2; + CARD32 pad3; +} xXFixesGetCursorImageReply; + +#define sz_xXFixesGetCursorImageReply 32 + +/*************** Version 2 ******************/ + +#define Region CARD32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + /* LISTofRECTANGLE */ +} xXFixesCreateRegionReq; + +#define sz_xXFixesCreateRegionReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + Pixmap bitmap; +} xXFixesCreateRegionFromBitmapReq; + +#define sz_xXFixesCreateRegionFromBitmapReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + Window window; + CARD8 kind; + CARD8 pad1; + CARD16 pad2; +} xXFixesCreateRegionFromWindowReq; + +#define sz_xXFixesCreateRegionFromWindowReq 16 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + GContext gc; +} xXFixesCreateRegionFromGCReq; + +#define sz_xXFixesCreateRegionFromGCReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + Picture picture; +} xXFixesCreateRegionFromPictureReq; + +#define sz_xXFixesCreateRegionFromPictureReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; +} xXFixesDestroyRegionReq; + +#define sz_xXFixesDestroyRegionReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + /* LISTofRECTANGLE */ +} xXFixesSetRegionReq; + +#define sz_xXFixesSetRegionReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region source; + Region destination; +} xXFixesCopyRegionReq; + +#define sz_xXFixesCopyRegionReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region source1; + Region source2; + Region destination; +} xXFixesCombineRegionReq, + xXFixesUnionRegionReq, + xXFixesIntersectRegionReq, + xXFixesSubtractRegionReq; + +#define sz_xXFixesCombineRegionReq 16 +#define sz_xXFixesUnionRegionReq sz_xXFixesCombineRegionReq +#define sz_xXFixesIntersectRegionReq sz_xXFixesCombineRegionReq +#define sz_xXFixesSubtractRegionReq sz_xXFixesCombineRegionReq + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region source; + INT16 x, y; + CARD16 width, height; + Region destination; +} xXFixesInvertRegionReq; + +#define sz_xXFixesInvertRegionReq 20 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; + INT16 dx, dy; +} xXFixesTranslateRegionReq; + +#define sz_xXFixesTranslateRegionReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region source; + Region destination; +} xXFixesRegionExtentsReq; + +#define sz_xXFixesRegionExtentsReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region region; +} xXFixesFetchRegionReq; + +#define sz_xXFixesFetchRegionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + INT16 x, y; + CARD16 width, height; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXFixesFetchRegionReply; + +#define sz_xXFixesFetchRegionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + GContext gc; + Region region; + INT16 xOrigin, yOrigin; +} xXFixesSetGCClipRegionReq; + +#define sz_xXFixesSetGCClipRegionReq 16 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Window dest; + BYTE destKind; + CARD8 pad1; + CARD16 pad2; + INT16 xOff, yOff; + Region region; +} xXFixesSetWindowShapeRegionReq; + +#define sz_xXFixesSetWindowShapeRegionReq 20 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Picture picture; + Region region; + INT16 xOrigin, yOrigin; +} xXFixesSetPictureClipRegionReq; + +#define sz_xXFixesSetPictureClipRegionReq 16 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Cursor cursor; + CARD16 nbytes; + CARD16 pad; +} xXFixesSetCursorNameReq; + +#define sz_xXFixesSetCursorNameReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Cursor cursor; +} xXFixesGetCursorNameReq; + +#define sz_xXFixesGetCursorNameReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + Atom atom; + CARD16 nbytes; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXFixesGetCursorNameReply; + +#define sz_xXFixesGetCursorNameReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; +} xXFixesGetCursorImageAndNameReq; + +#define sz_xXFixesGetCursorImageAndNameReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + INT16 x; + INT16 y; + CARD16 width; + CARD16 height; + CARD16 xhot; + CARD16 yhot; + CARD32 cursorSerial; + Atom cursorName; + CARD16 nbytes; + CARD16 pad; +} xXFixesGetCursorImageAndNameReply; + +#define sz_xXFixesGetCursorImageAndNameReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Cursor source; + Cursor destination; +} xXFixesChangeCursorReq; + +#define sz_xXFixesChangeCursorReq 12 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Cursor source; + CARD16 nbytes; + CARD16 pad; +} xXFixesChangeCursorByNameReq; + +#define sz_xXFixesChangeCursorByNameReq 12 + +/*************** Version 3 ******************/ + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Region source; + Region destination; + CARD16 left; + CARD16 right; + CARD16 top; + CARD16 bottom; +} xXFixesExpandRegionReq; + +#define sz_xXFixesExpandRegionReq 20 + +/*************** Version 4.0 ******************/ + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Window window; +} xXFixesHideCursorReq; + +#define sz_xXFixesHideCursorReq sizeof(xXFixesHideCursorReq) + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Window window; +} xXFixesShowCursorReq; + +#define sz_xXFixesShowCursorReq sizeof(xXFixesShowCursorReq) + +/*************** Version 5.0 ******************/ + +#define Barrier CARD32 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Barrier barrier; + Window window; + INT16 x1; + INT16 y1; + INT16 x2; + INT16 y2; + CARD32 directions; + CARD16 pad; + CARD16 num_devices; + /* array of CARD16 devices */ +} xXFixesCreatePointerBarrierReq; + +#define sz_xXFixesCreatePointerBarrierReq 28 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + Barrier barrier; +} xXFixesDestroyPointerBarrierReq; + +#define sz_xXFixesDestroyPointerBarrierReq 8 + +/*************** Version 6.0 ******************/ + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; + CARD32 disconnect_mode; +} xXFixesSetClientDisconnectModeReq; + +#define sz_xXFixesSetClientDisconnectModeReq 8 + +typedef struct { + CARD8 reqType; + CARD8 xfixesReqType; + CARD16 length; +} xXFixesGetClientDisconnectModeReq; + +#define sz_xXFixesGetClientDisconnectModeReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 disconnect_mode; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXFixesGetClientDisconnectModeReply; + +#define sz_xXFixesGetClientDisconnectModeReply 32 + +#undef Barrier +#undef Region +#undef Picture +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef Atom +#undef VisualID +#undef Time +#undef KeyCode +#undef KeySym + +#endif /* _XFIXESPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xfixeswire.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xfixeswire.h new file mode 100644 index 0000000000000000000000000000000000000000..83251cf2ecf3334289c83ac80f0a1d857ea83daa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xfixeswire.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. + * Copyright 2010 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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. + */ +/* + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + +#ifndef _XFIXESWIRE_H_ +#define _XFIXESWIRE_H_ + +#define XFIXES_NAME "XFIXES" +#define XFIXES_MAJOR 6 +#define XFIXES_MINOR 0 + +/*************** Version 1 ******************/ +#define X_XFixesQueryVersion 0 +#define X_XFixesChangeSaveSet 1 +#define X_XFixesSelectSelectionInput 2 +#define X_XFixesSelectCursorInput 3 +#define X_XFixesGetCursorImage 4 +/*************** Version 2 ******************/ +#define X_XFixesCreateRegion 5 +#define X_XFixesCreateRegionFromBitmap 6 +#define X_XFixesCreateRegionFromWindow 7 +#define X_XFixesCreateRegionFromGC 8 +#define X_XFixesCreateRegionFromPicture 9 +#define X_XFixesDestroyRegion 10 +#define X_XFixesSetRegion 11 +#define X_XFixesCopyRegion 12 +#define X_XFixesUnionRegion 13 +#define X_XFixesIntersectRegion 14 +#define X_XFixesSubtractRegion 15 +#define X_XFixesInvertRegion 16 +#define X_XFixesTranslateRegion 17 +#define X_XFixesRegionExtents 18 +#define X_XFixesFetchRegion 19 +#define X_XFixesSetGCClipRegion 20 +#define X_XFixesSetWindowShapeRegion 21 +#define X_XFixesSetPictureClipRegion 22 +#define X_XFixesSetCursorName 23 +#define X_XFixesGetCursorName 24 +#define X_XFixesGetCursorImageAndName 25 +#define X_XFixesChangeCursor 26 +#define X_XFixesChangeCursorByName 27 +/*************** Version 3 ******************/ +#define X_XFixesExpandRegion 28 +/*************** Version 4 ******************/ +#define X_XFixesHideCursor 29 +#define X_XFixesShowCursor 30 +/*************** Version 5 ******************/ +#define X_XFixesCreatePointerBarrier 31 +#define X_XFixesDestroyPointerBarrier 32 +/*************** Version 6 ******************/ +#define X_XFixesSetClientDisconnectMode 33 +#define X_XFixesGetClientDisconnectMode 34 + +#define XFixesNumberRequests (X_XFixesGetClientDisconnectMode+1) + +/* Selection events share one event number */ +#define XFixesSelectionNotify 0 + +/* Within the selection, the 'subtype' field distinguishes */ +#define XFixesSetSelectionOwnerNotify 0 +#define XFixesSelectionWindowDestroyNotify 1 +#define XFixesSelectionClientCloseNotify 2 + +#define XFixesSetSelectionOwnerNotifyMask (1L << 0) +#define XFixesSelectionWindowDestroyNotifyMask (1L << 1) +#define XFixesSelectionClientCloseNotifyMask (1L << 2) + +/* There's only one cursor event so far */ +#define XFixesCursorNotify 1 + +#define XFixesDisplayCursorNotify 0 + +#define XFixesDisplayCursorNotifyMask (1L << 0) + +#define XFixesNumberEvents (2) + +/* errors */ +#define BadRegion 0 +#define BadBarrier 1 +#define XFixesNumberErrors (BadBarrier+1) + +#define SaveSetNearest 0 +#define SaveSetRoot 1 + +#define SaveSetMap 0 +#define SaveSetUnmap 1 + +/*************** Version 2 ******************/ + +#define WindowRegionBounding 0 +#define WindowRegionClip 1 + +/*************** Version 5 ******************/ + +#define BarrierPositiveX (1L << 0) +#define BarrierPositiveY (1L << 1) +#define BarrierNegativeX (1L << 2) +#define BarrierNegativeY (1L << 3) + +/*************** Version 6 ******************/ + +/* The default server behaviour */ +#define XFixesClientDisconnectFlagDefault 0 +/* The server may disconnect this client to shut down */ +#define XFixesClientDisconnectFlagTerminate (1L << 0) + +/*************** Version 6.1 ******************/ + +/* The server must terminate if this client exits */ +#define XFixesClientDisconnectFlagForceTerminate (1L << 1) + +#endif /* _XFIXESWIRE_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xtestconst.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestconst.h new file mode 100644 index 0000000000000000000000000000000000000000..e74b9042ec2d25fb54e1458940e7d32536e5cc9f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestconst.h @@ -0,0 +1,41 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XTEST_CONST_H_ +#define _XTEST_CONST_H_ + +#define XTestNumberEvents 0 + +#define XTestNumberErrors 0 + +#define XTestCurrentCursor ((Cursor)1) + +#define XTestMajorVersion 2 +#define XTestMinorVersion 2 + +#define XTestExtensionName "XTEST" + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1.h new file mode 100644 index 0000000000000000000000000000000000000000..67d015bb0ba78689b665ec3e3bea79407fdc01f4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1.h @@ -0,0 +1,98 @@ +/* + * xtestext1.h + * + * X11 Input Synthesis Extension include file + */ + +/* + + +Copyright 1986, 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Hewlett-Packard not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +This software is not subject to any license of the American +Telephone and Telegraph Company or of the Regents of the +University of California. + +*/ + +#ifndef _XTESTEXT1_H +#define _XTESTEXT1_H +/* + * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h + */ + +#include +/* + * This is the definition for the input action host format event structure. + * This is the form that a client using this extension will see when + * it receives an input action event. + */ +typedef struct { + int type; /* always XTestInputActionType */ + Display *display; + Window window; + CARD8 actions[XTestACTIONS_SIZE]; +} XTestInputActionEvent; + +/* + * This is the definition for the xTestFakeAck host format event structure. + * This is the form that a client using this extension will see when + * it receives an XTestFakeAck event. + */ +typedef struct { + int type; /* always XTestFakeAckType */ + Display *display; + Window window; +} XTestFakeAckEvent; + +_XFUNCPROTOBEGIN + +int XTestFakeInput(register Display *dpy, char *action_list_addr, int action_list_size, int ack_flag); +int XTestGetInput(register Display *dpy, int action_handling); +int XTestQueryInputSize(register Display *dpy, unsigned long *size_return); +int XTestPressKey(Display *display, int device_id, unsigned long delay, unsigned int keycode, unsigned int key_action); +int XTestPressButton(Display * display, int device_id, unsigned long delay, unsigned int button_number, unsigned int button_action); +int XTestMovePointer(Display *display, int device_id, unsigned long delay[], int x[], int y[], unsigned int count); +int XTestFlush(Display *display); +int XTestStopInput(register Display *dpy); +int XTestReset(register Display *dpy); + +_XFUNCPROTOEND + +#endif /* _XTESTEXT1_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1const.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1const.h new file mode 100644 index 0000000000000000000000000000000000000000..656edc6ba15b68aa2fc92c4d20638d015483b05e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1const.h @@ -0,0 +1,160 @@ +/* + * xtestext1.h + * + * X11 Input Synthesis Extension include file + */ + +/* + + +Copyright 1986, 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Hewlett-Packard not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +This software is not subject to any license of the American +Telephone and Telegraph Company or of the Regents of the +University of California. + +*/ + +#ifndef _XTESTEXT1CONST_H +#define _XTESTEXT1CONST_H 1 + +#define XTestMAX_ACTION_LIST_SIZE 64 +#define XTestACTIONS_SIZE 28 + + +/* + * used in the XTestPressButton and XTestPressKey functions + */ +#define XTestPRESS 1 << 0 +#define XTestRELEASE 1 << 1 +#define XTestSTROKE 1 << 2 + +/* + * When doing a key or button stroke, the number of milliseconds + * to delay between the press and the release of a key or button + * in the XTestPressButton and XTestPressKey functions. + */ + +#define XTestSTROKE_DELAY_TIME 10 + +/* + * used in the XTestGetInput function + */ +#define XTestEXCLUSIVE 1 << 0 +#define XTestPACKED_ACTIONS 1 << 1 +#define XTestPACKED_MOTION 1 << 2 + +/* + * used in the XTestFakeInput function + */ +#define XTestFAKE_ACK_NOT_NEEDED 0 +#define XTestFAKE_ACK_REQUEST 1 + +/* + * used in the XTest extension initialization routine + */ +#define XTestEXTENSION_NAME "XTestExtension1" +#define XTestEVENT_COUNT 2 + +/* + * This is the definition for the format of the header byte + * in the input action structures. + */ +#define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */ +#define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */ +#define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */ +#define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */ +#define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */ + +#define XTestMAX_DEVICE_ID 0x0f +#define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4) +#define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4) + +/* + * These are the possible action types. + */ +#define XTestDELAY_ACTION 0 +#define XTestKEY_ACTION 1 +#define XTestMOTION_ACTION 2 +#define XTestJUMP_ACTION 3 + +/* + * These are the definitions for key/button motion input actions. + */ +#define XTestKEY_UP 0x04 +#define XTestKEY_DOWN 0x00 + +/* + * These are the definitions for pointer relative motion input + * actions. + * + * The sign bits for the x and y relative motions are contained + * in the header byte. The x and y relative motions are packed + * into one byte to make things fit in 32 bits. If the relative + * motion range is larger than +/-15, use the pointer jump action. + */ +#define XTestMOTION_MAX 15 +#define XTestMOTION_MIN -15 + +#define XTestX_NEGATIVE 0x04 +#define XTestY_NEGATIVE 0x08 + +#define XTestX_MOTION_MASK 0x0f +#define XTestY_MOTION_MASK 0xf0 + +#define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK) +#define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK) + +#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK) +#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4) +/* + * These are the definitions for a long delay input action. It is + * used when more than XTestSHORT_DELAY_TIME milliseconds of delay + * (approximately one minute) is needed. + * + * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. + * This guarantees that a header byte with a value of 0 is not + * a valid header, so it can be used as a flag to indicate that + * there are no more input actions in an XTestInputAction event. + */ + +#define XTestSHORT_DELAY_TIME 0xffff +#define XTestDELAY_DEVICE_ID 0x0f + +#endif /* _XTESTEXT1CONST_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1proto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1proto.h new file mode 100644 index 0000000000000000000000000000000000000000..d14ace12b4e605530197b138838433d8d7a48ef0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestext1proto.h @@ -0,0 +1,221 @@ +/* + * xtestext1.h + * + * X11 Input Synthesis Extension include file + */ + +/* +Copyright 1986, 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Hewlett-Packard not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +This software is not subject to any license of the American +Telephone and Telegraph Company or of the Regents of the +University of California. + +*/ + +#ifndef _XTESTEXT1PROTO_H +#define _XTESTEXT1PROTO_H 1 + +#include + +/* + * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h + */ + +/* + * XTest request type values + * + * used in the XTest extension protocol requests + */ +#define X_TestFakeInput 1 +#define X_TestGetInput 2 +#define X_TestStopInput 3 +#define X_TestReset 4 +#define X_TestQueryInputSize 5 + +/* + * This defines the maximum size of a list of input actions + * to be sent to the server. It should always be a multiple of + * 4 so that the entire xTestFakeInputReq structure size is a + * multiple of 4. + */ + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 XTestReqType; /* always X_TestFakeInput */ + CARD16 length; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */ + CARD32 ack; + CARD8 action_list[XTestMAX_ACTION_LIST_SIZE]; +} xTestFakeInputReq; +#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8) + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 XTestReqType; /* always X_TestGetInput */ + CARD16 length; /* 2 */ + CARD32 mode; +} xTestGetInputReq; +#define sz_xTestGetInputReq 8 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 XTestReqType; /* always X_TestStopInput */ + CARD16 length; /* 1 */ +} xTestStopInputReq; +#define sz_xTestStopInputReq 4 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 XTestReqType; /* always X_TestReset */ + CARD16 length; /* 1 */ +} xTestResetReq; +#define sz_xTestResetReq 4 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 XTestReqType; /* always X_TestQueryInputSize */ + CARD16 length; /* 1 */ +} xTestQueryInputSizeReq; +#define sz_xTestQueryInputSizeReq 4 + +/* + * This is the definition of the reply for the xTestQueryInputSize + * request. It should remain the same minimum size as other replies + * (32 bytes). + */ +typedef struct { + CARD8 type; /* always X_Reply */ + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; /* always 0 */ + CARD32 size_return; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xTestQueryInputSizeReply; + +/* + * This is the definition for the input action wire event structure. + * This event is sent to the client when the server has one or + * more user input actions to report to the client. It must + * remain the same size as all other wire events (32 bytes). + */ +typedef struct { + CARD8 type; /* always XTestInputActionType */ + CARD8 pad00; + CARD16 sequenceNumber; + CARD8 actions[XTestACTIONS_SIZE]; +} xTestInputActionEvent; + +/* + * This is the definition for the xTestFakeAck wire event structure. + * This event is sent to the client when the server has completely + * processed its input action buffer, and is ready for more. + * It must remain the same size as all other wire events (32 bytes). + */ +typedef struct { + CARD8 type; /* always XTestFakeAckType */ + CARD8 pad00; + CARD16 sequenceNumber; + CARD32 pad02; + CARD32 pad03; + CARD32 pad04; + CARD32 pad05; + CARD32 pad06; + CARD32 pad07; + CARD32 pad08; +} xTestFakeAckEvent; + +/* + * These are the definitions for key/button motion input actions. + */ +typedef struct { + CARD8 header; /* which device, key up/down */ + CARD8 keycode; /* which key/button to move */ + CARD16 delay_time; /* how long to delay (in ms) */ +} XTestKeyInfo; + +/* + * This is the definition for pointer jump input actions. + */ +typedef struct { + CARD8 header; /* which pointer */ + CARD8 pad1; /* unused padding byte */ + CARD16 jumpx; /* x coord to jump to */ + CARD16 jumpy; /* y coord to jump to */ + CARD16 delay_time; /* how long to delay (in ms) */ +} XTestJumpInfo; + +/* + * These are the definitions for pointer relative motion input + * actions. + * + * The sign bits for the x and y relative motions are contained + * in the header byte. The x and y relative motions are packed + * into one byte to make things fit in 32 bits. If the relative + * motion range is larger than +/-15, use the pointer jump action. + */ + +typedef struct { + CARD8 header; /* which pointer */ + CARD8 motion_data; /* x,y relative motion */ + CARD16 delay_time; /* how long to delay (in ms) */ +} XTestMotionInfo; + +/* + * These are the definitions for a long delay input action. It is + * used when more than XTestSHORT_DELAY_TIME milliseconds of delay + * (approximately one minute) is needed. + * + * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. + * This guarantees that a header byte with a value of 0 is not + * a valid header, so it can be used as a flag to indicate that + * there are no more input actions in an XTestInputAction event. + */ + +typedef struct { + CARD8 header; /* always XTestDELAY_DEVICE_ID */ + CARD8 pad1; /* unused padding byte */ + CARD16 pad2; /* unused padding word */ + CARD32 delay_time; /* how long to delay (in ms) */ +} XTestDelayInfo; + +#endif /* _XTESTEXT1PROTO_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xtestproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestproto.h new file mode 100644 index 0000000000000000000000000000000000000000..9595ac1ff8eb61e0faa93acc791571b90f4d7616 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xtestproto.h @@ -0,0 +1,124 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XTESTPROTO_H_ +#define _XTESTPROTO_H_ + +#include + +#define Window CARD32 +#define Time CARD32 +#define Cursor CARD32 + +#define X_XTestGetVersion 0 +#define X_XTestCompareCursor 1 +#define X_XTestFakeInput 2 +#define X_XTestGrabControl 3 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 xtReqType; /* always X_XTestGetVersion */ + CARD16 length; + CARD8 majorVersion; + CARD8 pad; + CARD16 minorVersion; +} xXTestGetVersionReq; +#define sz_xXTestGetVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 majorVersion; + CARD16 sequenceNumber; + CARD32 length; + CARD16 minorVersion; + CARD16 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXTestGetVersionReply; +#define sz_xXTestGetVersionReply 32 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 xtReqType; /* always X_XTestCompareCursor */ + CARD16 length; + Window window; + Cursor cursor; +} xXTestCompareCursorReq; +#define sz_xXTestCompareCursorReq 12 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL same; + CARD16 sequenceNumber; + CARD32 length; + CARD32 pad0; + CARD32 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; +} xXTestCompareCursorReply; +#define sz_xXTestCompareCursorReply 32 + +/* used only on the client side */ +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 xtReqType; /* always X_XTestFakeInput */ + CARD16 length; + BYTE type; + BYTE detail; + CARD16 pad0; + Time time; + Window root; + CARD32 pad1; + CARD32 pad2; + INT16 rootX, rootY; + CARD32 pad3; + CARD16 pad4; + CARD8 pad5; + CARD8 deviceid; +} xXTestFakeInputReq; +#define sz_xXTestFakeInputReq 36 + +typedef struct { + CARD8 reqType; /* always XTestReqCode */ + CARD8 xtReqType; /* always X_XTestGrabControl */ + CARD16 length; + BOOL impervious; + CARD8 pad0; + CARD8 pad1; + CARD8 pad2; +} xXTestGrabControlReq; +#define sz_xXTestGrabControlReq 8 + +#undef Window +#undef Time +#undef Cursor + +#endif /* _XTESTPROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/extensions/xwaylandproto.h b/data/miniconda3/envs/catiagent/include/X11/extensions/xwaylandproto.h new file mode 100644 index 0000000000000000000000000000000000000000..49f048d24c821dda62a038555d7bbbb39d856bcb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/extensions/xwaylandproto.h @@ -0,0 +1,63 @@ +/* + * Copyright © 2022 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _XWAYLAND_PROTO_H_ +#define _XWAYLAND_PROTO_H_ + +#include + +#define XWAYLAND_EXTENSION_NAME "XWAYLAND" +#define XWAYLAND_EXTENSION_MAJOR 1 +#define XWAYLAND_EXTENSION_MINOR 0 + +/* Request opcodes */ +#define X_XwlQueryVersion 0 + +#define XwlNumberRequests 1 +#define XwlNumberErrors 0 +#define XwlNumberEvents 0 + +typedef struct { + CARD8 reqType; + CARD8 xwlReqType; + CARD16 length; + CARD16 majorVersion; + CARD16 minorVersion; +} xXwlQueryVersionReq; +#define sz_xXwlQueryVersionReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 majorVersion; + CARD16 minorVersion; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} xXwlQueryVersionReply; +#define sz_xXwlQueryVersionReply 32 + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/FS.h b/data/miniconda3/envs/catiagent/include/X11/fonts/FS.h new file mode 100644 index 0000000000000000000000000000000000000000..fa4ff806a2f6543c0733c6f02137a564c05703a4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/FS.h @@ -0,0 +1,129 @@ +/* + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices or Digital + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Network Computing Devices and Digital make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES + * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +/* + +Portions Copyright 1987, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _FS_H_ +#define _FS_H_ + +#include +#include + +#define FS_PROTOCOL 2 +#define FS_PROTOCOL_MINOR 0 + +#ifndef X_PROTOCOL +/* protocol families */ +#define FamilyInternet 0 +#define FamilyDECnet 1 +#define FamilyChaos 2 +#define FamilyInternet6 6 + + +typedef unsigned int FSDrawDirection; +#endif + +#ifndef None +#define None 0L +#endif + +#define LeftToRightDrawDirection 0 +#define RightToLeftDrawDirection 1 + +/* font info flags */ +#define FontInfoAllCharsExist (1L << 0) +#define FontInfoInkInside (1L << 1) +#define FontInfoHorizontalOverlap (1L << 2) + +/* auth status flags */ +#define AuthSuccess 0 +#define AuthContinue 1 +#define AuthBusy 2 +#define AuthDenied 3 + +/* property types */ +#define PropTypeString 0 +#define PropTypeUnsigned 1 +#define PropTypeSigned 2 + +#ifndef LSBFirst +/* byte order */ +#define LSBFirst 0 +#define MSBFirst 1 +#endif + +/* event masks */ +#define CatalogueChangeNotifyMask (1L << 0) +#define FontChangeNotifyMask (1L << 1) + +/* errors */ +#define FSSuccess -1 +#define FSBadRequest 0 +#define FSBadFormat 1 +#define FSBadFont 2 +#define FSBadRange 3 +#define FSBadEventMask 4 +#define FSBadAccessContext 5 +#define FSBadIDChoice 6 +#define FSBadName 7 +#define FSBadResolution 8 +#define FSBadAlloc 9 +#define FSBadLength 10 +#define FSBadImplementation 11 + +#define FirstExtensionError 128 +#define LastExtensionError 255 + +/* events */ +#define KeepAlive 0 +#define CatalogueChangeNotify 1 +#define FontChangeNotify 2 +#define FSLASTEvent 3 + +#endif /* _FS_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/FSproto.h b/data/miniconda3/envs/catiagent/include/X11/fonts/FSproto.h new file mode 100644 index 0000000000000000000000000000000000000000..3cdb8348860036cda0f0541ce898166fc0e3c8b7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/FSproto.h @@ -0,0 +1,814 @@ +/* + +Copyright 1990, 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices, or Digital + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * + * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, + * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +#ifndef _FS_PROTO_H_ +#define _FS_PROTO_H_ + +#include + +#define sz_fsPropOffset 20 +#define sz_fsPropInfo 8 +#define sz_fsResolution 6 + +#define sz_fsChar2b 2 +#define sz_fsChar2b_version1 2 +#define sz_fsOffset32 8 +#define sz_fsRange 4 + +#define sz_fsXCharInfo 12 +#define sz_fsXFontInfoHeader 40 + +#define sz_fsConnClientPrefix 8 +#define sz_fsConnSetup 12 +#define sz_fsConnSetupExtra 8 +#define sz_fsConnSetupAccept 12 + +/* request sizes */ +#define sz_fsReq 4 +#define sz_fsListExtensionsReq 4 +#define sz_fsResourceReq 8 + +#define sz_fsNoopReq 4 +#define sz_fsListExtensionReq 4 +#define sz_fsQueryExtensionReq 4 +#define sz_fsListCataloguesReq 12 +#define sz_fsSetCataloguesReq 4 +#define sz_fsGetCataloguesReq 4 +#define sz_fsSetEventMaskReq 8 +#define sz_fsGetEventMaskReq 4 +#define sz_fsCreateACReq 8 +#define sz_fsFreeACReq 8 +#define sz_fsSetAuthorizationReq 8 +#define sz_fsSetResolutionReq 4 +#define sz_fsGetResolutionReq 4 +#define sz_fsListFontsReq 12 +#define sz_fsListFontsWithXInfoReq 12 +#define sz_fsOpenBitmapFontReq 16 +#define sz_fsQueryXInfoReq 8 +#define sz_fsQueryXExtents8Req 12 +#define sz_fsQueryXExtents16Req 12 +#define sz_fsQueryXBitmaps8Req 16 +#define sz_fsQueryXBitmaps16Req 16 +#define sz_fsCloseReq 8 + +/* reply sizes */ +#define sz_fsReply 8 +#define sz_fsGenericReply 8 + +#define sz_fsListExtensionsReply 8 +#define sz_fsQueryExtensionReply 20 +#define sz_fsListCataloguesReply 16 +#define sz_fsGetCataloguesReply 8 +#define sz_fsGetEventMaskReply 12 +#define sz_fsCreateACReply 12 +#define sz_fsGetResolutionReply 8 +#define sz_fsListFontsReply 16 +#define sz_fsListFontsWithXInfoReply (12 + sz_fsXFontInfoHeader) +#define sz_fsOpenBitmapFontReply 16 +#define sz_fsQueryXInfoReply (8 + sz_fsXFontInfoHeader) +#define sz_fsQueryXExtents8Reply 12 +#define sz_fsQueryXExtents16Reply 12 +#define sz_fsQueryXBitmaps8Reply 20 +#define sz_fsQueryXBitmaps16Reply 20 + +#define sz_fsError 16 +#define sz_fsEvent 12 +#define sz_fsKeepAliveEvent 12 + +#define fsTrue 1 +#define fsFalse 0 + +/* temp decls */ +#define Mask CARD32 +#define Font CARD32 +#define AccContext CARD32 + +typedef CARD32 fsTimestamp; + +#ifdef NOTDEF /* in fsmasks.h */ +typedef CARD32 fsBitmapFormat; +typedef CARD32 fsBitmapFormatMask; +#endif + +#define sz_fsBitmapFormat 4 + +typedef struct { + INT16 left, + right; + INT16 width; + INT16 ascent, + descent; + CARD16 attributes; +} fsXCharInfo; + +typedef struct { + CARD8 high; + CARD8 low; +} fsChar2b; + +typedef struct { + CARD8 low; + CARD8 high; +} fsChar2b_version1; + +typedef struct { + CARD8 min_char_high; + CARD8 min_char_low; + CARD8 max_char_high; + CARD8 max_char_low; +} fsRange; + +typedef struct { + CARD32 position; + CARD32 length; +} fsOffset32; + +typedef struct { + fsOffset32 name; + fsOffset32 value; + CARD8 type; + BYTE pad0; + CARD16 pad1; +} fsPropOffset; + +typedef struct { + CARD32 num_offsets; + CARD32 data_len; + /* offsets */ + /* data */ +} fsPropInfo; + +typedef struct { + CARD16 x_resolution; + CARD16 y_resolution; + CARD16 point_size; +} fsResolution; + + +typedef struct { + CARD32 flags; + CARD8 char_range_min_char_high; + CARD8 char_range_min_char_low; + CARD8 char_range_max_char_high; + CARD8 char_range_max_char_low; + + CARD8 draw_direction; + CARD8 pad; + CARD8 default_char_high; + CARD8 default_char_low; + INT16 min_bounds_left; + INT16 min_bounds_right; + + INT16 min_bounds_width; + INT16 min_bounds_ascent; + INT16 min_bounds_descent; + CARD16 min_bounds_attributes; + + INT16 max_bounds_left; + INT16 max_bounds_right; + INT16 max_bounds_width; + INT16 max_bounds_ascent; + + INT16 max_bounds_descent; + CARD16 max_bounds_attributes; + INT16 font_ascent; + INT16 font_descent; + /* propinfo */ +} fsXFontInfoHeader; + + +/* requests */ + +typedef struct { + BYTE byteOrder; + CARD8 num_auths; + CARD16 major_version; + CARD16 minor_version; + CARD16 auth_len; + /* auth data */ +} fsConnClientPrefix; + +typedef struct { + CARD16 status; + CARD16 major_version; + CARD16 minor_version; + CARD8 num_alternates; + CARD8 auth_index; + CARD16 alternate_len; + CARD16 auth_len; + /* alternates */ + /* auth data */ +} fsConnSetup; + +typedef struct { + CARD32 length; + CARD16 status; + CARD16 pad; + /* more auth data */ +} fsConnSetupExtra; + +typedef struct { + CARD32 length; + CARD16 max_request_len; + CARD16 vendor_len; + CARD32 release_number; + /* vendor string */ +} fsConnSetupAccept; + +typedef struct { + CARD8 reqType; + CARD8 data; + CARD16 length; +} fsReq; + +/* + * The fsFakeReq structure is never used in the protocol; it is prepended + * to incoming packets when setting up a connection so we can index + * through InitialVector. To avoid alignment problems, it is padded + * to the size of a word on the largest machine this code runs on. + * Hence no sz_fsFakeReq constant is necessary. + */ +typedef struct { + CARD8 reqType; + CARD8 data; + CARD16 length; + CARD32 pad; /* to fill out to multiple of 64 bits */ +} fsFakeReq; + +typedef struct { + CARD8 reqType; + BYTE pad; + CARD16 length; + Font id; +} fsResourceReq; + +typedef fsReq fsNoopReq; +typedef fsReq fsListExtensionsReq; + +typedef struct { + CARD8 reqType; + BYTE nbytes; + CARD16 length; + /* name */ +} fsQueryExtensionReq; + +typedef struct { + CARD8 reqType; + CARD8 data; + CARD16 length; + CARD32 maxNames; + CARD16 nbytes; + CARD16 pad2; + /* pattern */ +} fsListCataloguesReq; + +typedef struct { + CARD8 reqType; + BYTE num_catalogues; + CARD16 length; + /* catalogues */ +} fsSetCataloguesReq; + +typedef fsReq fsGetCataloguesReq; + +typedef struct { + CARD8 reqType; + CARD8 ext_opcode; + CARD16 length; + Mask event_mask; +} fsSetEventMaskReq; + +typedef struct { + CARD8 reqType; + CARD8 ext_opcode; + CARD16 length; +} fsGetEventMaskReq; + +typedef struct { + CARD8 reqType; + BYTE num_auths; + CARD16 length; + AccContext acid; + /* auth protocols */ +} fsCreateACReq; + +typedef fsResourceReq fsFreeACReq; +typedef fsResourceReq fsSetAuthorizationReq; + +typedef struct { + CARD8 reqType; + BYTE num_resolutions; + CARD16 length; + /* resolutions */ +} fsSetResolutionReq; + +typedef fsReq fsGetResolutionReq; + +typedef struct { + CARD8 reqType; + BYTE pad; + CARD16 length; + CARD32 maxNames; + CARD16 nbytes; + CARD16 pad2; + /* pattern */ +} fsListFontsReq; + +typedef fsListFontsReq fsListFontsWithXInfoReq; + +typedef struct { + CARD8 reqType; + BYTE pad; + CARD16 length; + Font fid; + fsBitmapFormatMask format_mask; + fsBitmapFormat format_hint; + /* pattern */ +} fsOpenBitmapFontReq; + +typedef fsResourceReq fsQueryXInfoReq; + +typedef struct { + CARD8 reqType; + BOOL range; + CARD16 length; + Font fid; + CARD32 num_ranges; + /* list of chars */ +} fsQueryXExtents8Req; + +typedef fsQueryXExtents8Req fsQueryXExtents16Req; + +typedef struct { + CARD8 reqType; + BOOL range; + CARD16 length; + Font fid; + fsBitmapFormat format; + CARD32 num_ranges; + /* list of chars */ +} fsQueryXBitmaps8Req; + +typedef fsQueryXBitmaps8Req fsQueryXBitmaps16Req; + +typedef fsResourceReq fsCloseReq; + + +/* replies */ +typedef struct { + BYTE type; + BYTE data1; + CARD16 sequenceNumber; + CARD32 length; +} fsGenericReply; + +typedef struct { + BYTE type; + CARD8 nExtensions; + CARD16 sequenceNumber; + CARD32 length; + /* extension names */ +} fsListExtensionsReply; + +typedef struct { + BYTE type; + CARD8 present; + CARD16 sequenceNumber; + CARD32 length; + CARD16 major_version; + CARD16 minor_version; + CARD8 major_opcode; + CARD8 first_event; + CARD8 num_events; + CARD8 first_error; + CARD8 num_errors; + CARD8 pad1; + CARD16 pad2; +} fsQueryExtensionReply; + +typedef struct { + BYTE type; + BYTE pad; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_replies; + CARD32 num_catalogues; + /* catalog names */ +} fsListCataloguesReply; + +typedef struct { + BYTE type; + CARD8 num_catalogues; + CARD16 sequenceNumber; + CARD32 length; + /* catalogue names */ +} fsGetCataloguesReply; + +typedef struct { + BYTE type; + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 event_mask; +} fsGetEventMaskReply; + +typedef struct { + BYTE type; + CARD8 auth_index; + CARD16 sequenceNumber; + CARD32 length; + CARD16 status; + CARD16 pad; + /* auth data */ +} fsCreateACReply; + +typedef struct { + CARD32 length; + CARD16 status; + CARD16 pad; + /* auth data */ +} fsCreateACExtraReply; + +typedef struct { + BYTE type; + CARD8 num_resolutions; + CARD16 sequenceNumber; + CARD32 length; + /* resolutions */ +} fsGetResolutionReply; + +typedef struct { + BYTE type; + BYTE pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 following; + CARD32 nFonts; + /* font names */ +} fsListFontsReply; + +/* + * this one is messy. the reply itself is variable length (unknown + * number of replies) and the contents of each is variable (unknown + * number of properties) + * + */ + +typedef struct { + BYTE type; + CARD8 nameLength; /* 0 is end-of-reply */ + CARD16 sequenceNumber; + CARD32 length; + CARD32 nReplies; + CARD32 font_header_flags; + CARD8 font_hdr_char_range_min_char_high; + CARD8 font_hdr_char_range_min_char_low; + CARD8 font_hdr_char_range_max_char_high; + CARD8 font_hdr_char_range_max_char_low; + CARD8 font_header_draw_direction; + CARD8 font_header_pad; + CARD8 font_header_default_char_high; + CARD8 font_header_default_char_low; + INT16 font_header_min_bounds_left; + INT16 font_header_min_bounds_right; + INT16 font_header_min_bounds_width; + INT16 font_header_min_bounds_ascent; + INT16 font_header_min_bounds_descent; + CARD16 font_header_min_bounds_attributes; + INT16 font_header_max_bounds_left; + INT16 font_header_max_bounds_right; + INT16 font_header_max_bounds_width; + INT16 font_header_max_bounds_ascent; + INT16 font_header_max_bounds_descent; + CARD16 font_header_max_bounds_attributes; + INT16 font_header_font_ascent; + INT16 font_header_font_descent; + /* propinfo */ + /* name */ +} fsListFontsWithXInfoReply; + +typedef struct { + BYTE type; + CARD8 otherid_valid; + CARD16 sequenceNumber; + CARD32 length; + CARD32 otherid; + BYTE cachable; + BYTE pad1; + CARD16 pad2; +} fsOpenBitmapFontReply; + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 font_header_flags; + CARD8 font_hdr_char_range_min_char_high; + CARD8 font_hdr_char_range_min_char_low; + CARD8 font_hdr_char_range_max_char_high; + CARD8 font_hdr_char_range_max_char_low; + CARD8 font_header_draw_direction; + CARD8 font_header_pad; + CARD8 font_header_default_char_high; + CARD8 font_header_default_char_low; + INT16 font_header_min_bounds_left; + INT16 font_header_min_bounds_right; + INT16 font_header_min_bounds_width; + INT16 font_header_min_bounds_ascent; + INT16 font_header_min_bounds_descent; + CARD16 font_header_min_bounds_attributes; + INT16 font_header_max_bounds_left; + INT16 font_header_max_bounds_right; + INT16 font_header_max_bounds_width; + INT16 font_header_max_bounds_ascent; + INT16 font_header_max_bounds_descent; + CARD16 font_header_max_bounds_attributes; + INT16 font_header_font_ascent; + INT16 font_header_font_descent; + /* propinfo */ +} fsQueryXInfoReply; + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 num_extents; + /* extents */ +} fsQueryXExtents8Reply; + +typedef fsQueryXExtents8Reply fsQueryXExtents16Reply; + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber; + CARD32 length; + CARD32 replies_hint; + CARD32 num_chars; + CARD32 nbytes; + /* offsets */ + /* glyphs */ +} fsQueryXBitmaps8Reply; + +typedef fsQueryXBitmaps8Reply fsQueryXBitmaps16Reply; + +typedef union { + fsGenericReply generic; + fsListExtensionsReply extensions; + fsGetResolutionReply getres; +} fsReply; + +/* errors */ +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; +} fsError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; +} fsRequestError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + fsBitmapFormat format; +} fsFormatError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + Font fontid; +} fsFontError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + fsRange range; +} fsRangeError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + Mask event_mask; +} fsEventMaskError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + AccContext acid; +} fsAccessContextError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + Font fontid; +} fsIDChoiceError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; +} fsNameError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + fsResolution resolution; +} fsResolutionError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; +} fsAllocError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; + CARD32 bad_length; +} fsLengthError; + +typedef struct { + BYTE type; + BYTE request; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + CARD8 major_opcode; + CARD8 minor_opcode; + CARD16 pad; +} fsImplementationError; + +/* events */ +typedef struct { + BYTE type; + BYTE event_code; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; +} fsKeepAliveEvent; + +typedef struct { + BYTE type; + BYTE event_code; + CARD16 sequenceNumber; + CARD32 length; + fsTimestamp timestamp; + BOOL added; + BOOL deleted; + CARD16 pad; +} fsCatalogueChangeNotifyEvent; + +typedef fsCatalogueChangeNotifyEvent fsFontChangeNotifyEvent; + +typedef fsCatalogueChangeNotifyEvent fsEvent; + +/* reply codes */ +#define FS_Reply 0 /* normal reply */ +#define FS_Error 1 /* error */ +#define FS_Event 2 + +/* request codes */ +#define FS_Noop 0 +#define FS_ListExtensions 1 +#define FS_QueryExtension 2 +#define FS_ListCatalogues 3 +#define FS_SetCatalogues 4 +#define FS_GetCatalogues 5 +#define FS_SetEventMask 6 +#define FS_GetEventMask 7 +#define FS_CreateAC 8 +#define FS_FreeAC 9 +#define FS_SetAuthorization 10 +#define FS_SetResolution 11 +#define FS_GetResolution 12 +#define FS_ListFonts 13 +#define FS_ListFontsWithXInfo 14 +#define FS_OpenBitmapFont 15 +#define FS_QueryXInfo 16 +#define FS_QueryXExtents8 17 +#define FS_QueryXExtents16 18 +#define FS_QueryXBitmaps8 19 +#define FS_QueryXBitmaps16 20 +#define FS_CloseFont 21 + +/* restore decls */ +#undef Mask +#undef Font +#undef AccContext + +#endif /* _FS_PROTO_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/font.h b/data/miniconda3/envs/catiagent/include/X11/fonts/font.h new file mode 100644 index 0000000000000000000000000000000000000000..b596ba253961a73075ccda9f6f7f34e771538119 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/font.h @@ -0,0 +1,168 @@ +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef FONT_H +#define FONT_H + +#include + +#ifndef BitmapFormatByteOrderMask +#include "fsmasks.h" +#endif + +/* data structures */ +#ifndef _XTYPEDEF_FONTPTR +typedef struct _Font *FontPtr; +#define _XTYPEDEF_FONTPTR +#endif + +typedef struct _FontInfo *FontInfoPtr; +typedef struct _FontProp *FontPropPtr; +typedef struct _ExtentInfo *ExtentInfoPtr; +typedef struct _FontPathElement *FontPathElementPtr; + +#ifndef _XTYPEDEF_CHARINFOPTR +typedef struct _CharInfo *CharInfoPtr; +#define _XTYPEDEF_CHARINFOPTR +#endif + +typedef struct _FontNames *FontNamesPtr; +typedef struct _FontResolution *FontResolutionPtr; + +#define NullCharInfo ((CharInfoPtr) 0) +#define NullFont ((FontPtr) 0) +#define NullFontInfo ((FontInfoPtr) 0) + + /* draw direction */ +#define LeftToRight 0 +#define RightToLeft 1 +#define BottomToTop 2 +#define TopToBottom 3 +typedef int DrawDirection; + +#define NO_SUCH_CHAR -1 + + +#define FontAliasType 0x1000 + +#define AllocError 80 +#define StillWorking 81 +#define FontNameAlias 82 +#define BadFontName 83 +#define Suspended 84 +#define Successful 85 +#define BadFontPath 86 +#define BadCharRange 87 +#define BadFontFormat 88 +#define FPEResetFailed 89 /* for when an FPE reset won't work */ + +/* OpenFont flags */ +#define FontLoadInfo 0x0001 +#define FontLoadProps 0x0002 +#define FontLoadMetrics 0x0004 +#define FontLoadBitmaps 0x0008 +#define FontLoadAll 0x000f +#define FontOpenSync 0x0010 +#define FontReopen 0x0020 + +/* Query flags */ +#define LoadAll 0x1 +#define FinishRamge 0x2 +#define EightBitFont 0x4 +#define SixteenBitFont 0x8 + +/* Glyph Caching Modes */ +#define CACHING_OFF 0 +#define CACHE_16_BIT_GLYPHS 1 +#define CACHE_ALL_GLYPHS 2 +#define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS +extern int glyphCachingMode; + +struct _Client; + +extern int StartListFontsWithInfo( + struct _Client * /*client*/, + int /*length*/, + unsigned char * /*pattern*/, + int /*max_names*/ +); + +extern FontNamesPtr MakeFontNamesRecord( + unsigned /* size */ +); + +extern void FreeFontNames( + FontNamesPtr /* pFN*/ +); + +extern int AddFontNamesName( + FontNamesPtr /* names */, + char * /* name */, + int /* length */ +); + +#if 0 /* unused */ +extern int FontToFSError(); +extern FontResolutionPtr GetClientResolution(); +#endif + +typedef struct _FontPatternCache *FontPatternCachePtr; + +extern FontPatternCachePtr MakeFontPatternCache ( + void +); + +extern void FreeFontPatternCache ( + FontPatternCachePtr /* cache */ +); + +extern void EmptyFontPatternCache ( + FontPatternCachePtr /* cache */ +); + +extern void CacheFontPattern ( + FontPatternCachePtr /* cache */, + const char * /* pattern */, + int /* patlen */, + FontPtr /* pFont */ +); +extern _X_EXPORT FontResolutionPtr GetClientResolutions( + int * /* num */ +); + +extern FontPtr FindCachedFontPattern ( + FontPatternCachePtr /* cache */, + const char * /* pattern */, + int /* patlen */ +); + +extern void RemoveCachedFontPattern ( + FontPatternCachePtr /* cache */, + FontPtr /* pFont */ +); + +typedef enum { + Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit +} FontEncoding; + +#endif /* FONT_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/fontproto.h b/data/miniconda3/envs/catiagent/include/X11/fonts/fontproto.h new file mode 100644 index 0000000000000000000000000000000000000000..23b8df6020d2691e9050182f61ed24f35d384abe --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/fontproto.h @@ -0,0 +1,94 @@ +/*********************************************************** + +Copyright (c) 1999 The XFree86 Project Inc. + +All Rights Reserved. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The XFree86 Project +Inc. shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from The XFree86 Project Inc.. + +*/ +#ifndef _FONTPROTO_H +#define _FONTPROTO_H + +#include + +/* Externally provided functions required by libXfont */ + +extern _X_EXPORT int RegisterFPEFunctions ( + NameCheckFunc name_func, + InitFpeFunc init_func, + FreeFpeFunc free_func, + ResetFpeFunc reset_func, + OpenFontFunc open_func, + CloseFontFunc close_func, + ListFontsFunc list_func, + StartLfwiFunc start_lfwi_func, + NextLfwiFunc next_lfwi_func, + WakeupFpeFunc wakeup_func, + ClientDiedFunc client_died, + LoadGlyphsFunc load_glyphs, + StartLaFunc start_list_alias_func, + NextLaFunc next_list_alias_func, + SetPathFunc set_path_func); + +extern _X_EXPORT int GetDefaultPointSize ( void ); + +extern _X_EXPORT int init_fs_handlers ( FontPathElementPtr fpe, + BlockHandlerProcPtr block_handler); +extern _X_EXPORT void remove_fs_handlers ( FontPathElementPtr fpe, + BlockHandlerProcPtr block_handler, + Bool all ); + +extern _X_EXPORT int client_auth_generation ( ClientPtr client ); + +#ifndef ___CLIENTSIGNAL_DEFINED___ +#define ___CLIENTSIGNAL_DEFINED___ +extern Bool ClientSignal ( ClientPtr client ); +#endif /* ___CLIENTSIGNAL_DEFINED___ */ + +extern _X_EXPORT void DeleteFontClientID ( Font id ); +extern _X_EXPORT Font GetNewFontClientID ( void ); +extern _X_EXPORT int StoreFontClientFont ( FontPtr pfont, Font id ); +extern _X_EXPORT void FontFileRegisterFpeFunctions ( void ); +extern _X_EXPORT void FontFileCheckRegisterFpeFunctions ( void ); + +extern Bool XpClientIsBitmapClient ( ClientPtr client ); +extern Bool XpClientIsPrintClient( ClientPtr client, FontPathElementPtr fpe ); +extern void PrinterFontRegisterFpeFunctions ( void ); + +extern void fs_register_fpe_functions ( void ); +extern void check_fs_register_fpe_functions ( void ); + +/* util/private.c */ +extern FontPtr CreateFontRec (void); +extern void DestroyFontRec (FontPtr font); +extern Bool _FontSetNewPrivate (FontPtr /* pFont */, + int /* n */, + void * /* ptr */); +extern int AllocateFontPrivateIndex (void); +extern void ResetFontPrivateIndex (void); + +/* Type1/t1funcs.c */ +extern void Type1RegisterFontFileFunctions(void); +extern void CIDRegisterFontFileFunctions(void); + +/* Speedo/spfuncs.c */ +extern void SpeedoRegisterFontFileFunctions(void); + +/* FreeType/ftfuncs.c */ +extern void FreeTypeRegisterFontFileFunctions(void); + +#endif diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/fontstruct.h b/data/miniconda3/envs/catiagent/include/X11/fonts/fontstruct.h new file mode 100644 index 0000000000000000000000000000000000000000..a327ef9dd50399ca10803eb83d17d352e570aa32 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/fontstruct.h @@ -0,0 +1,297 @@ +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef FONTSTR_H +#define FONTSTR_H + +#include +#include "font.h" +#include +#include + +/* + * This version of the server font data structure is only for describing + * the in memory data structure. The file structure is not necessarily a + * copy of this. That is up to the compiler and the OS layer font loading + * machinery. + */ + +#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */ + +typedef struct _FontProp { + long name; + long value; /* assumes ATOM is not larger than INT32 */ +} FontPropRec; + +typedef struct _FontResolution { + unsigned short x_resolution; + unsigned short y_resolution; + unsigned short point_size; +} FontResolutionRec; + +typedef struct _ExtentInfo { + DrawDirection drawDirection; + int fontAscent; + int fontDescent; + int overallAscent; + int overallDescent; + int overallWidth; + int overallLeft; + int overallRight; +} ExtentInfoRec; + +typedef struct _CharInfo { + xCharInfo metrics; /* info preformatted for Queries */ + char *bits; /* pointer to glyph image */ +} CharInfoRec; + +/* + * Font is created at font load time. It is specific to a single encoding. + * e.g. not all of the glyphs in a font may be part of a single encoding. + */ + +typedef struct _FontInfo { + unsigned short firstCol; + unsigned short lastCol; + unsigned short firstRow; + unsigned short lastRow; + unsigned short defaultCh; + unsigned int noOverlap:1; + unsigned int terminalFont:1; + unsigned int constantMetrics:1; + unsigned int constantWidth:1; + unsigned int inkInside:1; + unsigned int inkMetrics:1; + unsigned int allExist:1; + unsigned int drawDirection:2; + unsigned int cachable:1; + unsigned int anamorphic:1; + short maxOverlap; + short pad; + xCharInfo maxbounds; + xCharInfo minbounds; + xCharInfo ink_maxbounds; + xCharInfo ink_minbounds; + short fontAscent; + short fontDescent; + int nprops; + FontPropPtr props; + char *isStringProp; +} FontInfoRec; + +typedef struct _Font { + int refcnt; + FontInfoRec info; + char bit; + char byte; + char glyph; + char scan; + fsBitmapFormat format; + int (*get_glyphs) (FontPtr /* font */, + unsigned long /* count */, + unsigned char * /* chars */, + FontEncoding /* encoding */, + unsigned long * /* count */, + CharInfoPtr * /* glyphs */); + int (*get_metrics) (FontPtr /* font */, + unsigned long /* count */, + unsigned char * /* chars */, + FontEncoding /* encoding */, + unsigned long * /* count */, + xCharInfo ** /* glyphs */); + void (*unload_font) (FontPtr /* font */); + void (*unload_glyphs) (FontPtr /* font */); + FontPathElementPtr fpe; + void *svrPrivate; + void *fontPrivate; + void *fpePrivate; + int maxPrivate; + void **devPrivates; +} FontRec; + +#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (void *) 0 : \ + (pFont)->devPrivates[n]) + +#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \ + _FontSetNewPrivate (pFont, n, ptr) : \ + ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE)) + +typedef struct _FontNames { + int nnames; + int size; + int *length; + char **names; +} FontNamesRec; + + +/* External view of font paths */ +typedef struct _FontPathElement { + int name_length; +#if FONT_PATH_ELEMENT_NAME_CONST + const +#endif + char *name; + int type; + int refcount; + void *private; +} FontPathElementRec; + +typedef Bool (*NameCheckFunc) (const char *name); +typedef int (*InitFpeFunc) (FontPathElementPtr fpe); +typedef int (*FreeFpeFunc) (FontPathElementPtr fpe); +typedef int (*ResetFpeFunc) (FontPathElementPtr fpe); +typedef int (*OpenFontFunc) ( void *client, + FontPathElementPtr fpe, + Mask flags, + const char* name, + int namelen, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + XID id, + FontPtr* pFont, + char** aliasName, + FontPtr non_cachable_font); +typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont); +typedef int (*ListFontsFunc) (void *client, + FontPathElementPtr fpe, + const char* pat, + int len, + int max, + FontNamesPtr names); + +typedef int (*StartLfwiFunc) (void *client, + FontPathElementPtr fpe, + const char* pat, + int len, + int max, + void ** privatep); + +typedef int (*NextLfwiFunc) (void *client, + FontPathElementPtr fpe, + char** name, + int* namelen, + FontInfoPtr* info, + int* numFonts, + void *private); + +typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe, + unsigned long* LastSelectMask); + +typedef void (*ClientDiedFunc) (void *client, + FontPathElementPtr fpe); + +typedef int (*LoadGlyphsFunc) (void *client, + FontPtr pfont, + Bool range_flag, + unsigned int nchars, + int item_size, + unsigned char* data); + +typedef int (*StartLaFunc) (void *client, + FontPathElementPtr fpe, + const char* pat, + int len, + int max, + void ** privatep); + +typedef int (*NextLaFunc) (void *client, + FontPathElementPtr fpe, + char** namep, + int* namelenp, + char** resolvedp, + int* resolvedlenp, + void *private); + +typedef void (*SetPathFunc)(void); + +typedef struct _FPEFunctions { + NameCheckFunc name_check; + InitFpeFunc init_fpe; + ResetFpeFunc reset_fpe; + FreeFpeFunc free_fpe; + OpenFontFunc open_font; + CloseFontFunc close_font; + ListFontsFunc list_fonts; + StartLaFunc start_list_fonts_and_aliases; + NextLaFunc list_next_font_or_alias; + StartLfwiFunc start_list_fonts_with_info; + NextLfwiFunc list_next_font_with_info; + WakeupFpeFunc wakeup_fpe; + ClientDiedFunc client_died; + /* for load_glyphs, range_flag = 0 -> + nchars = # of characters in data + item_size = bytes/char + data = list of characters + range_flag = 1 -> + nchars = # of fsChar2b's in data + item_size is ignored + data = list of fsChar2b's */ + LoadGlyphsFunc load_glyphs; + SetPathFunc set_path_hook; +} FPEFunctionsRec, FPEFunctions; + +/* + * Various macros for computing values based on contents of + * the above structures + */ + +#define GLYPHWIDTHPIXELS(pci) \ + ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) + +#define GLYPHHEIGHTPIXELS(pci) \ + ((pci)->metrics.ascent + (pci)->metrics.descent) + +#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) + +#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7) + +#define BYTES_PER_ROW(bits, nbytes) \ + ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ + :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ + :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ + :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ + : 0) + +#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \ + BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad)) +/* + * Macros for computing different bounding boxes for fonts; from + * the font protocol + */ + +#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \ + (pi)->fontAscent : (pi)->ink_maxbounds.ascent) +#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \ + (pi)->fontDescent : (pi)->ink_maxbounds.descent) +#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi)) +#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \ + (pi)->ink_minbounds.leftSideBearing : 0) +#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \ + (pi)->ink_maxbounds.characterWidth ? \ + (pi)->ink_maxbounds.rightSideBearing : \ + (pi)->ink_maxbounds.characterWidth) +#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi)) + +#include "fontproto.h" + +#endif /* FONTSTR_H */ diff --git a/data/miniconda3/envs/catiagent/include/X11/fonts/fsmasks.h b/data/miniconda3/envs/catiagent/include/X11/fonts/fsmasks.h new file mode 100644 index 0000000000000000000000000000000000000000..861790235c4d3a3bb2ae5bd2eee0dbf28f29f881 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/X11/fonts/fsmasks.h @@ -0,0 +1,97 @@ +/* + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices or Digital + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Network Computing Devices and Digital make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES + * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +/* + +Portions Copyright 1987, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +/* + * masks & values used by the font lib and the font server + */ + +#ifndef _FSMASKS_H_ +#define _FSMASKS_H_ + +#include + +/* font format macros */ +#define BitmapFormatByteOrderMask (1L << 0) +#define BitmapFormatBitOrderMask (1L << 1) +#define BitmapFormatImageRectMask (3L << 2) +#define BitmapFormatScanlinePadMask (3L << 8) +#define BitmapFormatScanlineUnitMask (3L << 12) + +#define BitmapFormatByteOrderLSB (0) +#define BitmapFormatByteOrderMSB (1L << 0) +#define BitmapFormatBitOrderLSB (0) +#define BitmapFormatBitOrderMSB (1L << 1) + +#define BitmapFormatImageRectMin (0L << 2) +#define BitmapFormatImageRectMaxWidth (1L << 2) +#define BitmapFormatImageRectMax (2L << 2) + +#define BitmapFormatScanlinePad8 (0L << 8) +#define BitmapFormatScanlinePad16 (1L << 8) +#define BitmapFormatScanlinePad32 (2L << 8) +#define BitmapFormatScanlinePad64 (3L << 8) + +#define BitmapFormatScanlineUnit8 (0L << 12) +#define BitmapFormatScanlineUnit16 (1L << 12) +#define BitmapFormatScanlineUnit32 (2L << 12) +#define BitmapFormatScanlineUnit64 (3L << 12) + +#define BitmapFormatMaskByte (1L << 0) +#define BitmapFormatMaskBit (1L << 1) +#define BitmapFormatMaskImageRectangle (1L << 2) +#define BitmapFormatMaskScanLinePad (1L << 3) +#define BitmapFormatMaskScanLineUnit (1L << 4) + +typedef CARD32 fsBitmapFormat; +typedef CARD32 fsBitmapFormatMask; + +#endif /* _FSMASKS_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftconfig.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..f463bba0160365d297b5bb8533d7dec1c286ec4d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftconfig.h @@ -0,0 +1,53 @@ +/* ftconfig.h. Generated from ftconfig.h.in by configure. */ +/**************************************************************************** + * + * ftconfig.h.in + * + * UNIX-specific configuration file (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This header file contains a number of macro definitions that are used by + * the rest of the engine. Most of the macros here are automatically + * determined at compile time, and you should not need to change it to port + * FreeType, except to compile the library with a non-ANSI compiler. + * + * Note however that if some specific modifications are needed, we advise + * you to place a modified copy in your build directory. + * + * The build directory is usually `builds/`, and contains + * system-specific files that are always included first when building the + * library. + * + */ + +#ifndef FTCONFIG_H_ +#define FTCONFIG_H_ + +#include +#include FT_CONFIG_OPTIONS_H +#include FT_CONFIG_STANDARD_LIBRARY_H + +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 + +#include +#include +#include + +#endif /* FTCONFIG_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftheader.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftheader.h new file mode 100644 index 0000000000000000000000000000000000000000..16eab9048fce6234d1bea7a6134f3bc343ee5ffa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftheader.h @@ -0,0 +1,836 @@ +/**************************************************************************** + * + * ftheader.h + * + * Build macros of the FreeType 2 library. + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +#ifndef FTHEADER_H_ +#define FTHEADER_H_ + + + /*@***********************************************************************/ + /* */ + /* */ + /* FT_BEGIN_HEADER */ + /* */ + /* */ + /* This macro is used in association with @FT_END_HEADER in header */ + /* files to ensure that the declarations within are properly */ + /* encapsulated in an `extern "C" { .. }` block when included from a */ + /* C++ compiler. */ + /* */ +#ifndef FT_BEGIN_HEADER +# ifdef __cplusplus +# define FT_BEGIN_HEADER extern "C" { +# else +# define FT_BEGIN_HEADER /* nothing */ +# endif +#endif + + + /*@***********************************************************************/ + /* */ + /* */ + /* FT_END_HEADER */ + /* */ + /* */ + /* This macro is used in association with @FT_BEGIN_HEADER in header */ + /* files to ensure that the declarations within are properly */ + /* encapsulated in an `extern "C" { .. }` block when included from a */ + /* C++ compiler. */ + /* */ +#ifndef FT_END_HEADER +# ifdef __cplusplus +# define FT_END_HEADER } +# else +# define FT_END_HEADER /* nothing */ +# endif +#endif + + + /************************************************************************** + * + * Aliases for the FreeType 2 public and configuration files. + * + */ + + /************************************************************************** + * + * @section: + * header_file_macros + * + * @title: + * Header File Macros + * + * @abstract: + * Macro definitions used to `#include` specific header files. + * + * @description: + * In addition to the normal scheme of including header files like + * + * ``` + * #include + * #include + * #include + * ``` + * + * it is possible to used named macros instead. They can be used + * directly in `#include` statements as in + * + * ``` + * #include FT_FREETYPE_H + * #include FT_MULTIPLE_MASTERS_H + * #include FT_GLYPH_H + * ``` + * + * These macros were introduced to overcome the infamous 8.3~naming rule + * required by DOS (and `FT_MULTIPLE_MASTERS_H` is a lot more meaningful + * than `ftmm.h`). + * + */ + + + /* configuration files */ + + /************************************************************************** + * + * @macro: + * FT_CONFIG_CONFIG_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * FreeType~2 configuration data. + * + */ +#ifndef FT_CONFIG_CONFIG_H +#define FT_CONFIG_CONFIG_H +#endif + + + /************************************************************************** + * + * @macro: + * FT_CONFIG_STANDARD_LIBRARY_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * FreeType~2 interface to the standard C library functions. + * + */ +#ifndef FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H +#endif + + + /************************************************************************** + * + * @macro: + * FT_CONFIG_OPTIONS_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * FreeType~2 project-specific configuration options. + * + */ +#ifndef FT_CONFIG_OPTIONS_H +#define FT_CONFIG_OPTIONS_H +#endif + + + /************************************************************************** + * + * @macro: + * FT_CONFIG_MODULES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * list of FreeType~2 modules that are statically linked to new library + * instances in @FT_Init_FreeType. + * + */ +#ifndef FT_CONFIG_MODULES_H +#define FT_CONFIG_MODULES_H +#endif + + /* */ + + /* public headers */ + + /************************************************************************** + * + * @macro: + * FT_FREETYPE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * base FreeType~2 API. + * + */ +#define FT_FREETYPE_H + + + /************************************************************************** + * + * @macro: + * FT_ERRORS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * list of FreeType~2 error codes (and messages). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_ERRORS_H + + + /************************************************************************** + * + * @macro: + * FT_MODULE_ERRORS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * list of FreeType~2 module error offsets (and messages). + * + */ +#define FT_MODULE_ERRORS_H + + + /************************************************************************** + * + * @macro: + * FT_SYSTEM_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 interface to low-level operations (i.e., memory management + * and stream i/o). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_SYSTEM_H + + + /************************************************************************** + * + * @macro: + * FT_IMAGE_H + * + * @description: + * A macro used in `#include` statements to name the file containing type + * definitions related to glyph images (i.e., bitmaps, outlines, + * scan-converter parameters). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_IMAGE_H + + + /************************************************************************** + * + * @macro: + * FT_TYPES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * basic data types defined by FreeType~2. + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_TYPES_H + + + /************************************************************************** + * + * @macro: + * FT_LIST_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * list management API of FreeType~2. + * + * (Most applications will never need to include this file.) + * + */ +#define FT_LIST_H + + + /************************************************************************** + * + * @macro: + * FT_OUTLINE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * scalable outline management API of FreeType~2. + * + */ +#define FT_OUTLINE_H + + + /************************************************************************** + * + * @macro: + * FT_SIZES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * API which manages multiple @FT_Size objects per face. + * + */ +#define FT_SIZES_H + + + /************************************************************************** + * + * @macro: + * FT_MODULE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * module management API of FreeType~2. + * + */ +#define FT_MODULE_H + + + /************************************************************************** + * + * @macro: + * FT_RENDER_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * renderer module management API of FreeType~2. + * + */ +#define FT_RENDER_H + + + /************************************************************************** + * + * @macro: + * FT_DRIVER_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * structures and macros related to the driver modules. + * + */ +#define FT_DRIVER_H + + + /************************************************************************** + * + * @macro: + * FT_AUTOHINTER_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * structures and macros related to the auto-hinting module. + * + * Deprecated since version~2.9; use @FT_DRIVER_H instead. + * + */ +#define FT_AUTOHINTER_H FT_DRIVER_H + + + /************************************************************************** + * + * @macro: + * FT_CFF_DRIVER_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * structures and macros related to the CFF driver module. + * + * Deprecated since version~2.9; use @FT_DRIVER_H instead. + * + */ +#define FT_CFF_DRIVER_H FT_DRIVER_H + + + /************************************************************************** + * + * @macro: + * FT_TRUETYPE_DRIVER_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * structures and macros related to the TrueType driver module. + * + * Deprecated since version~2.9; use @FT_DRIVER_H instead. + * + */ +#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H + + + /************************************************************************** + * + * @macro: + * FT_PCF_DRIVER_H + * + * @description: + * A macro used in `#include` statements to name the file containing + * structures and macros related to the PCF driver module. + * + * Deprecated since version~2.9; use @FT_DRIVER_H instead. + * + */ +#define FT_PCF_DRIVER_H FT_DRIVER_H + + + /************************************************************************** + * + * @macro: + * FT_TYPE1_TABLES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * types and API specific to the Type~1 format. + * + */ +#define FT_TYPE1_TABLES_H + + + /************************************************************************** + * + * @macro: + * FT_TRUETYPE_IDS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * enumeration values which identify name strings, languages, encodings, + * etc. This file really contains a _large_ set of constant macro + * definitions, taken from the TrueType and OpenType specifications. + * + */ +#define FT_TRUETYPE_IDS_H + + + /************************************************************************** + * + * @macro: + * FT_TRUETYPE_TABLES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * types and API specific to the TrueType (as well as OpenType) format. + * + */ +#define FT_TRUETYPE_TABLES_H + + + /************************************************************************** + * + * @macro: + * FT_TRUETYPE_TAGS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of TrueType four-byte 'tags' which identify blocks in + * SFNT-based font formats (i.e., TrueType and OpenType). + * + */ +#define FT_TRUETYPE_TAGS_H + + + /************************************************************************** + * + * @macro: + * FT_BDF_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which accesses BDF-specific strings from a face. + * + */ +#define FT_BDF_H + + + /************************************************************************** + * + * @macro: + * FT_CID_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which access CID font information from a face. + * + */ +#define FT_CID_H + + + /************************************************************************** + * + * @macro: + * FT_GZIP_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which supports gzip-compressed files. + * + */ +#define FT_GZIP_H + + + /************************************************************************** + * + * @macro: + * FT_LZW_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which supports LZW-compressed files. + * + */ +#define FT_LZW_H + + + /************************************************************************** + * + * @macro: + * FT_BZIP2_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which supports bzip2-compressed files. + * + */ +#define FT_BZIP2_H + + + /************************************************************************** + * + * @macro: + * FT_WINFONTS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * definitions of an API which supports Windows FNT files. + * + */ +#define FT_WINFONTS_H + + + /************************************************************************** + * + * @macro: + * FT_GLYPH_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * API of the optional glyph management component. + * + */ +#define FT_GLYPH_H + + + /************************************************************************** + * + * @macro: + * FT_BITMAP_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * API of the optional bitmap conversion component. + * + */ +#define FT_BITMAP_H + + + /************************************************************************** + * + * @macro: + * FT_BBOX_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * API of the optional exact bounding box computation routines. + * + */ +#define FT_BBOX_H + + + /************************************************************************** + * + * @macro: + * FT_CACHE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * API of the optional FreeType~2 cache sub-system. + * + */ +#define FT_CACHE_H + + + /************************************************************************** + * + * @macro: + * FT_MAC_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * Macintosh-specific FreeType~2 API. The latter is used to access fonts + * embedded in resource forks. + * + * This header file must be explicitly included by client applications + * compiled on the Mac (note that the base API still works though). + * + */ +#define FT_MAC_H + + + /************************************************************************** + * + * @macro: + * FT_MULTIPLE_MASTERS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * optional multiple-masters management API of FreeType~2. + * + */ +#define FT_MULTIPLE_MASTERS_H + + + /************************************************************************** + * + * @macro: + * FT_SFNT_NAMES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * optional FreeType~2 API which accesses embedded 'name' strings in + * SFNT-based font formats (i.e., TrueType and OpenType). + * + */ +#define FT_SFNT_NAMES_H + + + /************************************************************************** + * + * @macro: + * FT_OPENTYPE_VALIDATE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * optional FreeType~2 API which validates OpenType tables ('BASE', + * 'GDEF', 'GPOS', 'GSUB', 'JSTF'). + * + */ +#define FT_OPENTYPE_VALIDATE_H + + + /************************************************************************** + * + * @macro: + * FT_GX_VALIDATE_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * optional FreeType~2 API which validates TrueTypeGX/AAT tables ('feat', + * 'mort', 'morx', 'bsln', 'just', 'kern', 'opbd', 'trak', 'prop'). + * + */ +#define FT_GX_VALIDATE_H + + + /************************************************************************** + * + * @macro: + * FT_PFR_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which accesses PFR-specific data. + * + */ +#define FT_PFR_H + + + /************************************************************************** + * + * @macro: + * FT_STROKER_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which provides functions to stroke outline paths. + */ +#define FT_STROKER_H + + + /************************************************************************** + * + * @macro: + * FT_SYNTHESIS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which performs artificial obliquing and emboldening. + */ +#define FT_SYNTHESIS_H + + + /************************************************************************** + * + * @macro: + * FT_FONT_FORMATS_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which provides functions specific to font formats. + */ +#define FT_FONT_FORMATS_H + + /* deprecated */ +#define FT_XFREE86_H FT_FONT_FORMATS_H + + + /************************************************************************** + * + * @macro: + * FT_TRIGONOMETRY_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which performs trigonometric computations (e.g., + * cosines and arc tangents). + */ +#define FT_TRIGONOMETRY_H + + + /************************************************************************** + * + * @macro: + * FT_LCD_FILTER_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which performs color filtering for subpixel rendering. + */ +#define FT_LCD_FILTER_H + + + /************************************************************************** + * + * @macro: + * FT_INCREMENTAL_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which performs incremental glyph loading. + */ +#define FT_INCREMENTAL_H + + + /************************************************************************** + * + * @macro: + * FT_GASP_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which returns entries from the TrueType GASP table. + */ +#define FT_GASP_H + + + /************************************************************************** + * + * @macro: + * FT_ADVANCES_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which returns individual and ranged glyph advances. + */ +#define FT_ADVANCES_H + + + /************************************************************************** + * + * @macro: + * FT_COLOR_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which handles the OpenType 'CPAL' table. + */ +#define FT_COLOR_H + + + /************************************************************************** + * + * @macro: + * FT_OTSVG_H + * + * @description: + * A macro used in `#include` statements to name the file containing the + * FreeType~2 API which handles the OpenType 'SVG~' glyphs. + */ +#define FT_OTSVG_H + + + /* */ + + /* These header files don't need to be included by the user. */ +#define FT_ERROR_DEFINITIONS_H +#define FT_PARAMETER_TAGS_H + + /* Deprecated macros. */ +#define FT_UNPATENTED_HINTING_H +#define FT_TRUETYPE_UNPATENTED_H + + /* `FT_CACHE_H` is the only header file needed for the cache subsystem. */ +#define FT_CACHE_IMAGE_H FT_CACHE_H +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H +#define FT_CACHE_CHARMAP_H FT_CACHE_H + + /* The internals of the cache sub-system are no longer exposed. We */ + /* default to `FT_CACHE_H` at the moment just in case, but we know */ + /* of no rogue client that uses them. */ + /* */ +#define FT_CACHE_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H +#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H +#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H +#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H +#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H + +/* TODO(david): Move this section below to a different header */ +#ifdef FT2_BUILD_LIBRARY +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* We disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings. */ + /* In particular, the warning complains about stuff like `while(0)' */ + /* which is very useful in macro definitions. There is no benefit */ + /* in having it enabled. */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ +#endif /* FT2_BUILD_LIBRARY */ + +#endif /* FTHEADER_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftmodule.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftmodule.h new file mode 100644 index 0000000000000000000000000000000000000000..b52779da07f92bdae4e705c93bc3f4fa7c3b22f4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftmodule.h @@ -0,0 +1,21 @@ +/* This is a generated file. */ +FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) +FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) +FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) +FT_USE_MODULE( FT_Module_Class, autofit_module_class ) +FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) +FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) +FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) +FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class ) +FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class ) +FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class ) +FT_USE_MODULE( FT_Module_Class, psaux_module_class ) +FT_USE_MODULE( FT_Module_Class, psnames_module_class ) +/* EOF */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftoption.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftoption.h new file mode 100644 index 0000000000000000000000000000000000000000..a2847a15acd4229aade8334d5a4c9ca04ca8d0b8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftoption.h @@ -0,0 +1,1061 @@ +/**************************************************************************** + * + * ftoption.h + * + * User-selectable configuration macros (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTOPTION_H_ +#define FTOPTION_H_ + + +#include + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * USER-SELECTABLE CONFIGURATION MACROS + * + * This file contains the default configuration macro definitions for a + * standard build of the FreeType library. There are three ways to use + * this file to build project-specific versions of the library: + * + * - You can modify this file by hand, but this is not recommended in + * cases where you would like to build several versions of the library + * from a single source directory. + * + * - You can put a copy of this file in your build directory, more + * precisely in `$BUILD/freetype/config/ftoption.h`, where `$BUILD` is + * the name of a directory that is included _before_ the FreeType include + * path during compilation. + * + * The default FreeType Makefiles use the build directory + * `builds/` by default, but you can easily change that for your + * own projects. + * + * - Copy the file to `$BUILD/ft2build.h` and modify it + * slightly to pre-define the macro `FT_CONFIG_OPTIONS_H` used to locate + * this file during the build. For example, + * + * ``` + * #define FT_CONFIG_OPTIONS_H + * #include + * ``` + * + * will use `$BUILD/myftoptions.h` instead of this file for macro + * definitions. + * + * Note also that you can similarly pre-define the macro + * `FT_CONFIG_MODULES_H` used to locate the file listing of the modules + * that are statically linked to the library at compile time. By + * default, this file is ``. + * + * We highly recommend using the third method whenever possible. + * + */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*#************************************************************************ + * + * If you enable this configuration option, FreeType recognizes an + * environment variable called `FREETYPE_PROPERTIES`, which can be used to + * control the various font drivers and modules. The controllable + * properties are listed in the section @properties. + * + * You have to undefine this configuration option on platforms that lack + * the concept of environment variables (and thus don't have the `getenv` + * function), for example Windows CE. + * + * `FREETYPE_PROPERTIES` has the following syntax form (broken here into + * multiple lines for better readability). + * + * ``` + * + * ':' + * '=' + * + * ':' + * '=' + * ... + * ``` + * + * Example: + * + * ``` + * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ + * cff:no-stem-darkening=1 + * ``` + * + */ +#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES + + + /************************************************************************** + * + * Uncomment the line below if you want to activate LCD rendering + * technology similar to ClearType in this build of the library. This + * technology triples the resolution in the direction color subpixels. To + * mitigate color fringes inherent to this technology, you also need to + * explicitly set up LCD filtering. + * + * When this macro is not defined, FreeType offers alternative LCD + * rendering technology that produces excellent output. + */ +/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + + + /************************************************************************** + * + * Many compilers provide a non-ANSI 64-bit data type that can be used by + * FreeType to speed up some computations. However, this will create some + * problems when compiling the library in strict ANSI mode. + * + * For this reason, the use of 64-bit integers is normally disabled when + * the `__STDC__` macro is defined. You can however disable this by + * defining the macro `FT_CONFIG_OPTION_FORCE_INT64` here. + * + * For most compilers, this will only create compilation warnings when + * building the library. + * + * ObNote: The compiler-specific 64-bit integers are detected in the + * file `ftconfig.h` either statically or through the `configure` + * script on supported platforms. + */ +#undef FT_CONFIG_OPTION_FORCE_INT64 + + + /************************************************************************** + * + * If this macro is defined, do not try to use an assembler version of + * performance-critical functions (e.g., @FT_MulFix). You should only do + * that to verify that the assembler function works properly, or to execute + * benchmark tests of the various implementations. + */ +/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ + + + /************************************************************************** + * + * If this macro is defined, try to use an inlined 64-bit or assembler + * version of the @FT_MulFix function, which is a 'hotspot' when loading + * and hinting glyphs, and which should be executed as fast as possible. + * + * If your compiler is not C99-compliant or CPU assembly is not supported, + * you can disable this option. + */ +#define FT_CONFIG_OPTION_INLINE_MULFIX + + + /************************************************************************** + * + * LZW-compressed file support. + * + * FreeType now handles font files that have been compressed with the + * `compress` program. This is mostly used to parse many of the PCF + * files that come with various X11 distributions. The implementation + * uses NetBSD's `zopen` to partially uncompress the file on the fly (see + * `src/lzw/ftgzip.c`). + * + * Define this macro if you want to enable this 'feature'. + */ +#define FT_CONFIG_OPTION_USE_LZW + + + /************************************************************************** + * + * Gzip-compressed file support. + * + * FreeType now handles font files that have been compressed with the + * `gzip` program. This is mostly used to parse many of the PCF files + * that come with XFree86. The implementation uses 'zlib' to partially + * uncompress the file on the fly (see `src/gzip/ftgzip.c`). + * + * Define this macro if you want to enable this 'feature'. See also the + * macro `FT_CONFIG_OPTION_SYSTEM_ZLIB` below. + */ +#define FT_CONFIG_OPTION_USE_ZLIB + + + /************************************************************************** + * + * ZLib library selection + * + * This macro is only used when `FT_CONFIG_OPTION_USE_ZLIB` is defined. + * It allows FreeType's 'ftgzip' component to link to the system's + * installation of the ZLib library. This is useful on systems like + * Unix or VMS where it generally is already available. + * + * If you let it undefined, the component will use its own copy of the + * zlib sources instead. These have been modified to be included + * directly within the component and **not** export external function + * names. This allows you to link any program with FreeType _and_ ZLib + * without linking conflicts. + * + * Do not `#undef` this macro here since the build system might define + * it for certain configurations only. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + * + * If you use the GNU make build system directly (that is, without the + * `configure` script) and you define this macro, you also have to pass + * `SYSTEM_ZLIB=yes` as an argument to make. + */ +#define FT_CONFIG_OPTION_SYSTEM_ZLIB + + + /************************************************************************** + * + * Bzip2-compressed file support. + * + * FreeType now handles font files that have been compressed with the + * `bzip2` program. This is mostly used to parse many of the PCF files + * that come with XFree86. The implementation uses `libbz2` to partially + * uncompress the file on the fly (see `src/bzip2/ftbzip2.c`). Contrary + * to gzip, bzip2 currently is not included and need to use the system + * available bzip2 implementation. + * + * Define this macro if you want to enable this 'feature'. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #undef FT_CONFIG_OPTION_USE_BZIP2 */ + + + /************************************************************************** + * + * Define to disable the use of file stream functions and types, `FILE`, + * `fopen`, etc. Enables the use of smaller system libraries on embedded + * systems that have multiple system libraries, some with or without file + * stream support, in the cases where file stream support is not necessary + * such as memory loading of font files. + */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + + /************************************************************************** + * + * PNG bitmap support. + * + * FreeType now handles loading color bitmap glyphs in the PNG format. + * This requires help from the external libpng library. Uncompressed + * color bitmaps do not need any external libraries and will be supported + * regardless of this configuration. + * + * Define this macro if you want to enable this 'feature'. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +#define FT_CONFIG_OPTION_USE_PNG + + + /************************************************************************** + * + * HarfBuzz support. + * + * FreeType uses the HarfBuzz library to improve auto-hinting of OpenType + * fonts. If available, many glyphs not directly addressable by a font's + * character map will be hinted also. + * + * Define this macro if you want to enable this 'feature'. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #undef FT_CONFIG_OPTION_USE_HARFBUZZ */ + + + /************************************************************************** + * + * HarfBuzz dynamic support. + * + * Define this macro if you want the HarfBuzz library to be loaded at + * runtime instead of being linked to FreeType. + * + * This option has no effect if `FT_CONFIG_OPTION_USE_HARFBUZZ` is not + * defined. + * + * When this option is enabled, FreeType will try to load the HarfBuzz + * library at runtime, using `dlopen` or `LoadLibrary`, depending on the + * platform. On Microsoft platforms, the library name looked up is + * `libharfbuzz-0.dll`. On Apple platforms, the library name looked up + * is `libharfbuzz.0.dylib`. On all other platforms, the library name + * looked up is `libharfbuzz.so.0`. This name can be overridden by + * defining the macro `FT_LIBHARFBUZZ` at FreeType compilation time. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #undef FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */ + + + /************************************************************************** + * + * Brotli support. + * + * FreeType uses the Brotli library to provide support for decompressing + * WOFF2 streams. + * + * Define this macro if you want to enable this 'feature'. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #undef FT_CONFIG_OPTION_USE_BROTLI */ + + + /************************************************************************** + * + * Glyph Postscript Names handling + * + * By default, FreeType 2 is compiled with the 'psnames' module. This + * module is in charge of converting a glyph name string into a Unicode + * value, or return a Macintosh standard glyph name for the use with the + * TrueType 'post' table. + * + * Undefine this macro if you do not want 'psnames' compiled in your + * build of FreeType. This has the following effects: + * + * - The TrueType driver will provide its own set of glyph names, if you + * build it to support postscript names in the TrueType 'post' table, + * but will not synthesize a missing Unicode charmap. + * + * - The Type~1 driver will not be able to synthesize a Unicode charmap + * out of the glyphs found in the fonts. + * + * You would normally undefine this configuration macro when building a + * version of FreeType that doesn't contain a Type~1 or CFF driver. + */ +#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /************************************************************************** + * + * Postscript Names to Unicode Values support + * + * By default, FreeType~2 is built with the 'psnames' module compiled in. + * Among other things, the module is used to convert a glyph name into a + * Unicode value. This is especially useful in order to synthesize on + * the fly a Unicode charmap from the CFF/Type~1 driver through a big + * table named the 'Adobe Glyph List' (AGL). + * + * Undefine this macro if you do not want the Adobe Glyph List compiled + * in your 'psnames' module. The Type~1 driver will not be able to + * synthesize a Unicode charmap out of the glyphs found in the fonts. + */ +#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST + + + /************************************************************************** + * + * Support for Mac fonts + * + * Define this macro if you want support for outline fonts in Mac format + * (mac dfont, mac resource, macbinary containing a mac resource) on + * non-Mac platforms. + * + * Note that the 'FOND' resource isn't checked. + */ +#define FT_CONFIG_OPTION_MAC_FONTS + + + /************************************************************************** + * + * Guessing methods to access embedded resource forks + * + * Enable extra Mac fonts support on non-Mac platforms (e.g., GNU/Linux). + * + * Resource forks which include fonts data are stored sometimes in + * locations which users or developers don't expected. In some cases, + * resource forks start with some offset from the head of a file. In + * other cases, the actual resource fork is stored in file different from + * what the user specifies. If this option is activated, FreeType tries + * to guess whether such offsets or different file names must be used. + * + * Note that normal, direct access of resource forks is controlled via + * the `FT_CONFIG_OPTION_MAC_FONTS` option. + */ +#ifdef FT_CONFIG_OPTION_MAC_FONTS +#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#endif + + + /************************************************************************** + * + * Allow the use of `FT_Incremental_Interface` to load typefaces that + * contain no glyph data, but supply it via a callback function. This is + * required by clients supporting document formats which supply font data + * incrementally as the document is parsed, such as the Ghostscript + * interpreter for the PostScript language. + */ +#define FT_CONFIG_OPTION_INCREMENTAL + + + /************************************************************************** + * + * The size in bytes of the render pool used by the scan-line converter to + * do all of its work. + */ +#define FT_RENDER_POOL_SIZE 16384L + + + /************************************************************************** + * + * FT_MAX_MODULES + * + * The maximum number of modules that can be registered in a single + * FreeType library object. 32~is the default. + */ +#define FT_MAX_MODULES 32 + + + /************************************************************************** + * + * Debug level + * + * FreeType can be compiled in debug or trace mode. In debug mode, + * errors are reported through the 'ftdebug' component. In trace mode, + * additional messages are sent to the standard output during execution. + * + * Define `FT_DEBUG_LEVEL_ERROR` to build the library in debug mode. + * Define `FT_DEBUG_LEVEL_TRACE` to build it in trace mode. + * + * Don't define any of these macros to compile in 'release' mode! + * + * Do not `#undef` these macros here since the build system might define + * them for certain configurations only. + */ +/* #define FT_DEBUG_LEVEL_ERROR */ +/* #define FT_DEBUG_LEVEL_TRACE */ + + + /************************************************************************** + * + * Logging + * + * Compiling FreeType in debug or trace mode makes FreeType write error + * and trace log messages to `stderr`. Enabling this macro + * automatically forces the `FT_DEBUG_LEVEL_ERROR` and + * `FT_DEBUG_LEVEL_TRACE` macros and allows FreeType to write error and + * trace log messages to a file instead of `stderr`. For writing logs + * to a file, FreeType uses an the external `dlg` library (the source + * code is in `src/dlg`). + * + * This option needs a C99 compiler. + */ +/* #define FT_DEBUG_LOGGING */ + + + /************************************************************************** + * + * Autofitter debugging + * + * If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to + * control the autofitter behaviour for debugging purposes with global + * boolean variables (consequently, you should **never** enable this + * while compiling in 'release' mode): + * + * ``` + * af_debug_disable_horz_hints_ + * af_debug_disable_vert_hints_ + * af_debug_disable_blue_hints_ + * ``` + * + * Additionally, the following functions provide dumps of various + * internal autofit structures to stdout (using `printf`): + * + * ``` + * af_glyph_hints_dump_points + * af_glyph_hints_dump_segments + * af_glyph_hints_dump_edges + * af_glyph_hints_get_num_segments + * af_glyph_hints_get_segment_offset + * ``` + * + * As an argument, they use another global variable: + * + * ``` + * af_debug_hints_ + * ``` + * + * Please have a look at the `ftgrid` demo program to see how those + * variables and macros should be used. + * + * Do not `#undef` these macros here since the build system might define + * them for certain configurations only. + */ +/* #define FT_DEBUG_AUTOFIT */ + + + /************************************************************************** + * + * Memory Debugging + * + * FreeType now comes with an integrated memory debugger that is capable + * of detecting simple errors like memory leaks or double deletes. To + * compile it within your build of the library, you should define + * `FT_DEBUG_MEMORY` here. + * + * Note that the memory debugger is only activated at runtime when when + * the _environment_ variable `FT2_DEBUG_MEMORY` is defined also! + * + * Do not `#undef` this macro here since the build system might define it + * for certain configurations only. + */ +/* #define FT_DEBUG_MEMORY */ + + + /************************************************************************** + * + * Module errors + * + * If this macro is set (which is _not_ the default), the higher byte of + * an error code gives the module in which the error has occurred, while + * the lower byte is the real error code. + * + * Setting this macro makes sense for debugging purposes only, since it + * would break source compatibility of certain programs that use + * FreeType~2. + * + * More details can be found in the files `ftmoderr.h` and `fterrors.h`. + */ +#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS + + + /************************************************************************** + * + * OpenType SVG Glyph Support + * + * Setting this macro enables support for OpenType SVG glyphs. By + * default, FreeType can only fetch SVG documents. However, it can also + * render them if external rendering hook functions are plugged in at + * runtime. + * + * More details on the hooks can be found in file `otsvg.h`. + */ +#define FT_CONFIG_OPTION_SVG + + + /************************************************************************** + * + * Error Strings + * + * If this macro is set, `FT_Error_String` will return meaningful + * descriptions. This is not enabled by default to reduce the overall + * size of FreeType. + * + * More details can be found in the file `fterrors.h`. + */ +/* #define FT_CONFIG_OPTION_ERROR_STRINGS */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_EMBEDDED_BITMAPS` if you want to support + * embedded bitmaps in all formats using the 'sfnt' module (namely + * TrueType~& OpenType). + */ +#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support colored + * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt' + * module (namely TrueType~& OpenType). + */ +#define TT_CONFIG_OPTION_COLOR_LAYERS + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to + * load and enumerate Postscript names of glyphs in a TrueType or OpenType + * file. + * + * Note that if you do not compile the 'psnames' module by undefining the + * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` macro, the 'sfnt' module will + * contain additional code to read the PostScript name table from a font. + * + * (By default, the module uses 'psnames' to extract glyph names.) + */ +#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_SFNT_NAMES` if your applications need to access + * the internal name table in a SFNT-based format like TrueType or + * OpenType. The name table contains various strings used to describe the + * font, like family name, copyright, version, etc. It does not contain + * any glyph name though. + * + * Accessing SFNT names is done through the functions declared in + * `ftsnames.h`. + */ +#define TT_CONFIG_OPTION_SFNT_NAMES + + + /************************************************************************** + * + * TrueType CMap support + * + * Here you can fine-tune which TrueType CMap table format shall be + * supported. + */ +#define TT_CONFIG_CMAP_FORMAT_0 +#define TT_CONFIG_CMAP_FORMAT_2 +#define TT_CONFIG_CMAP_FORMAT_4 +#define TT_CONFIG_CMAP_FORMAT_6 +#define TT_CONFIG_CMAP_FORMAT_8 +#define TT_CONFIG_CMAP_FORMAT_10 +#define TT_CONFIG_CMAP_FORMAT_12 +#define TT_CONFIG_CMAP_FORMAT_13 +#define TT_CONFIG_CMAP_FORMAT_14 + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` if you want to compile a + * bytecode interpreter in the TrueType driver. + * + * By undefining this, you will only compile the code necessary to load + * TrueType glyphs without hinting. + * + * Do not `#undef` this macro here, since the build system might define it + * for certain configurations only. + */ +#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_SUBPIXEL_HINTING` if you want to compile + * subpixel hinting support into the TrueType driver. This modifies the + * TrueType hinting mechanism when anything but `FT_RENDER_MODE_MONO` is + * requested. + * + * In particular, it modifies the bytecode interpreter to interpret (or + * not) instructions in a certain way so that all TrueType fonts look like + * they do in a Windows ClearType (DirectWrite) environment. See [1] for a + * technical overview on what this means. See `ttinterp.h` for more + * details on this option. + * + * The new default mode focuses on applying a minimal set of rules to all + * fonts indiscriminately so that modern and web fonts render well while + * legacy fonts render okay. The corresponding interpreter version is v40. + * The so-called Infinality mode (v38) is no longer available in FreeType. + * + * By undefining these, you get rendering behavior like on Windows without + * ClearType, i.e., Windows XP without ClearType enabled and Win9x + * (interpreter version v35). Or not, depending on how much hinting blood + * and testing tears the font designer put into a given font. If you + * define one or both subpixel hinting options, you can switch between + * between v35 and the ones you define (using `FT_Property_Set`). + * + * This option requires `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` to be + * defined. + * + * [1] + * https://learn.microsoft.com/typography/cleartype/truetypecleartype + */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED` to compile the + * TrueType glyph loader to use Apple's definition of how to handle + * component offsets in composite glyphs. + * + * Apple and MS disagree on the default behavior of component offsets in + * composites. Apple says that they should be scaled by the scaling + * factors in the transformation matrix (roughly, it's more complex) while + * MS says they should not. OpenType defines two bits in the composite + * flags array which can be used to disambiguate, but old fonts will not + * have them. + * + * https://learn.microsoft.com/typography/opentype/spec/glyf + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html + */ +#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_GX_VAR_SUPPORT` if you want to include support + * for Apple's distortable font technology ('fvar', 'gvar', 'cvar', and + * 'avar' tables). Tagged 'Font Variations', this is now part of OpenType + * also. This has many similarities to Type~1 Multiple Masters support. + */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_NO_BORING_EXPANSION` if you want to exclude + * support for 'boring' OpenType specification expansions. + * + * https://github.com/harfbuzz/boring-expansion-spec + * + * Right now, the following features are covered: + * + * - 'avar' version 2.0 + * + * Most likely, this is a temporary configuration option to be removed in + * the near future, since it is assumed that eventually those features are + * added to the OpenType standard. + */ +/* #define TT_CONFIG_OPTION_NO_BORING_EXPANSION */ + + + /************************************************************************** + * + * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an + * embedded 'BDF~' table within an SFNT-based `.otb` font file. This table + * is an extension used by X11 to preserve BDF properties after conversion + * to SFNT containers. See + * + * https://fontforge.org/docs/techref/non-standard.html#non-standard-bdf + * + * for more details. + */ +#define TT_CONFIG_OPTION_BDF + + + /************************************************************************** + * + * Option `TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES` controls the maximum + * number of bytecode instructions executed for a single run of the + * bytecode interpreter, needed to prevent infinite loops. You don't want + * to change this except for very special situations (e.g., making a + * library fuzzer spend less time to handle broken fonts). + * + * It is not expected that this value is ever modified by a configuring + * script; instead, it gets surrounded with `#ifndef ... #endif` so that + * the value can be set as a preprocessor option on the compiler's command + * line. + */ +#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES +#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L +#endif + + + /************************************************************************** + * + * Option `TT_CONFIG_OPTION_GPOS_KERNING` enables a basic GPOS kerning + * implementation (for TrueType and OpenType fonts only). With this + * defined, FreeType is able to get kerning pair data from the GPOS 'kern' + * feature as well as legacy 'kern' tables; without this defined, FreeType + * will only be able to use legacy 'kern' tables. + * + * Note that FreeType does not support more advanced GPOS layout features; + * even the 'kern' feature implemented here doesn't handle more + * sophisticated kerning variants. Use a higher-level library like + * HarfBuzz instead for that. + */ +/* #define TT_CONFIG_OPTION_GPOS_KERNING */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * `T1_MAX_DICT_DEPTH` is the maximum depth of nest dictionaries and arrays + * in the Type~1 stream (see `t1load.c`). A minimum of~4 is required. + */ +#define T1_MAX_DICT_DEPTH 5 + + + /************************************************************************** + * + * `T1_MAX_SUBRS_CALLS` details the maximum number of nested sub-routine + * calls during glyph loading. + */ +#define T1_MAX_SUBRS_CALLS 16 + + + /************************************************************************** + * + * `T1_MAX_CHARSTRING_OPERANDS` is the charstring stack's capacity. A + * minimum of~16 is required. + * + * The Chinese font 'MingTiEG-Medium' (covering the CNS 11643 character + * set) needs 256. + */ +#define T1_MAX_CHARSTRINGS_OPERANDS 256 + + + /************************************************************************** + * + * Define this configuration macro if you want to prevent the compilation + * of the 't1afm' module, which is in charge of reading Type~1 AFM files + * into an existing face. Note that if set, the Type~1 driver will be + * unable to produce kerning distances. + */ +#undef T1_CONFIG_OPTION_NO_AFM + + + /************************************************************************** + * + * Define this configuration macro if you want to prevent the compilation + * of the Multiple Masters font support in the Type~1 driver. + */ +#undef T1_CONFIG_OPTION_NO_MM_SUPPORT + + + /************************************************************************** + * + * `T1_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe Type~1 + * engine gets compiled into FreeType. If defined, it is possible to + * switch between the two engines using the `hinting-engine` property of + * the 'type1' driver module. + */ +/* #define T1_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** C F F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * Using `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}` it is + * possible to set up the default values of the four control points that + * define the stem darkening behaviour of the (new) CFF engine. For more + * details please read the documentation of the `darkening-parameters` + * property (file `ftdriver.h`), which allows the control at run-time. + * + * Do **not** undefine these macros! + */ +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500 +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400 + +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000 +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275 + +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667 +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275 + +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333 +#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0 + + + /************************************************************************** + * + * `CFF_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe CFF engine + * gets compiled into FreeType. If defined, it is possible to switch + * between the two engines using the `hinting-engine` property of the 'cff' + * driver module. + */ +/* #define CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** P C F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * There are many PCF fonts just called 'Fixed' which look completely + * different, and which have nothing to do with each other. When selecting + * 'Fixed' in KDE or Gnome one gets results that appear rather random, the + * style changes often if one changes the size and one cannot select some + * fonts at all. This option makes the 'pcf' module prepend the foundry + * name (plus a space) to the family name. + * + * We also check whether we have 'wide' characters; all put together, we + * get family names like 'Sony Fixed' or 'Misc Fixed Wide'. + * + * If this option is activated, it can be controlled with the + * `no-long-family-names` property of the 'pcf' driver module. + */ +/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * Compile 'autofit' module with CJK (Chinese, Japanese, Korean) script + * support. + */ +#define AF_CONFIG_OPTION_CJK + + + /************************************************************************** + * + * Compile 'autofit' module with fallback Indic script support, covering + * some scripts that the 'latin' submodule of the 'autofit' module doesn't + * (yet) handle. Currently, this needs option `AF_CONFIG_OPTION_CJK`. + */ +#ifdef AF_CONFIG_OPTION_CJK +#define AF_CONFIG_OPTION_INDIC +#endif + + + /************************************************************************** + * + * Use TrueType-like size metrics for 'light' auto-hinting. + * + * It is strongly recommended to avoid this option, which exists only to + * help some legacy applications retain its appearance and behaviour with + * respect to auto-hinted TrueType fonts. + * + * The very reason this option exists at all are GNU/Linux distributions + * like Fedora that did not un-patch the following change (which was + * present in FreeType between versions 2.4.6 and 2.7.1, inclusive). + * + * ``` + * 2011-07-16 Steven Chu + * + * [truetype] Fix metrics on size request for scalable fonts. + * ``` + * + * This problematic commit is now reverted (more or less). + */ +/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */ + + /* */ + + + /* + * This macro is obsolete. Support has been removed in FreeType version + * 2.5. + */ +/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ + + + /* + * The next two macros are defined if native TrueType hinting is + * requested by the definitions above. Don't change this. + */ +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL +#endif +#endif + + + /* + * The TT_SUPPORT_COLRV1 macro is defined to indicate to clients that this + * version of FreeType has support for 'COLR' v1 API. This definition is + * useful to FreeType clients that want to build in support for 'COLR' v1 + * depending on a tip-of-tree checkout before it is officially released in + * FreeType, and while the feature cannot yet be tested against using + * version macros. Don't change this macro. This may be removed once the + * feature is in a FreeType release version and version macros can be used + * to test for availability. + */ +#ifdef TT_CONFIG_OPTION_COLOR_LAYERS +#define TT_SUPPORT_COLRV1 +#endif + + + /* + * Check CFF darkening parameters. The checks are the same as in function + * `cff_property_set` in file `cffdrivr.c`. + */ +#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \ + \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \ + \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \ + \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \ + CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500 +#error "Invalid CFF darkening parameters!" +#endif + + +FT_END_HEADER + +#endif /* FTOPTION_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftstdlib.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftstdlib.h new file mode 100644 index 0000000000000000000000000000000000000000..f846b4456c116ceb94f87e21d18ed66cba33a397 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/ftstdlib.h @@ -0,0 +1,185 @@ +/**************************************************************************** + * + * ftstdlib.h + * + * ANSI-specific library and header configuration file (specification + * only). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to group all `#includes` to the ANSI~C library that + * FreeType normally requires. It also defines macros to rename the + * standard functions within the FreeType source code. + * + * Load a file which defines `FTSTDLIB_H_` before this one to override it. + * + */ + + +#ifndef FTSTDLIB_H_ +#define FTSTDLIB_H_ + + +#include + +#define ft_ptrdiff_t ptrdiff_t + + + /************************************************************************** + * + * integer limits + * + * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of + * `int` and `long` in bytes at compile-time. So far, this works for all + * platforms the library has been tested on. We also check `ULLONG_MAX` + * to see whether we can use 64-bit `long long` later on. + * + * Note that on the extremely rare platforms that do not provide integer + * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where + * `int` is 36~bits), we do not make any guarantee about the correct + * behaviour of FreeType~2 with all fonts. + * + * In these cases, `ftconfig.h` will refuse to compile anyway with a + * message like 'couldn't find 32-bit type' or something similar. + * + */ + + +#include + +#define FT_CHAR_BIT CHAR_BIT +#define FT_USHORT_MAX USHRT_MAX +#define FT_INT_MAX INT_MAX +#define FT_INT_MIN INT_MIN +#define FT_UINT_MAX UINT_MAX +#define FT_LONG_MIN LONG_MIN +#define FT_LONG_MAX LONG_MAX +#define FT_ULONG_MAX ULONG_MAX +#ifdef LLONG_MAX +#define FT_LLONG_MAX LLONG_MAX +#endif +#ifdef LLONG_MIN +#define FT_LLONG_MIN LLONG_MIN +#endif +#ifdef ULLONG_MAX +#define FT_ULLONG_MAX ULLONG_MAX +#endif + + + /************************************************************************** + * + * character and string processing + * + */ + + +#include + +#define ft_memchr memchr +#define ft_memcmp memcmp +#define ft_memcpy memcpy +#define ft_memmove memmove +#define ft_memset memset +#define ft_strcat strcat +#define ft_strcmp strcmp +#define ft_strcpy strcpy +#define ft_strlen strlen +#define ft_strncmp strncmp +#define ft_strncpy strncpy +#define ft_strrchr strrchr +#define ft_strstr strstr + + + /************************************************************************** + * + * file handling + * + */ + + +#include + +#define FT_FILE FILE +#define ft_fclose fclose +#define ft_fopen fopen +#define ft_fread fread +#define ft_fseek fseek +#define ft_ftell ftell +#define ft_snprintf snprintf + + + /************************************************************************** + * + * sorting + * + */ + + +#include + +#define ft_qsort qsort + + + /************************************************************************** + * + * memory allocation + * + */ + + +#define ft_scalloc calloc +#define ft_sfree free +#define ft_smalloc malloc +#define ft_srealloc realloc + + + /************************************************************************** + * + * miscellaneous + * + */ + + +#define ft_strtol strtol +#define ft_getenv getenv + + + /************************************************************************** + * + * execution control + * + */ + + +#include + +#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ + /* `jmp_buf` is defined as a macro */ + /* on certain platforms */ + +#define ft_longjmp longjmp +#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ + + + /* The following is only used for debugging purposes, i.e., if */ + /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */ + +#include + + +#endif /* FTSTDLIB_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/integer-types.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/integer-types.h new file mode 100644 index 0000000000000000000000000000000000000000..a0b892ece4bce05f6fc188a10ac60afd1ed5a084 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/integer-types.h @@ -0,0 +1,277 @@ +/**************************************************************************** + * + * config/integer-types.h + * + * FreeType integer types definitions. + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ +#ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_ +#define FREETYPE_CONFIG_INTEGER_TYPES_H_ + +FT_BEGIN_HEADER + + /* There are systems (like the Texas Instruments 'C54x) where a `char` */ + /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */ + /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */ + /* is probably unexpected. */ + /* */ + /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */ + /* `char` type. */ + +#ifndef FT_CHAR_BIT +#define FT_CHAR_BIT CHAR_BIT +#endif + +#ifndef FT_SIZEOF_INT + + /* The size of an `int` type. */ +#if FT_UINT_MAX == 0xFFFFUL +#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT ) +#elif FT_UINT_MAX == 0xFFFFFFFFUL +#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT ) +#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL +#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT ) +#else +#error "Unsupported size of `int' type!" +#endif + +#endif /* !defined(FT_SIZEOF_INT) */ + +#ifndef FT_SIZEOF_LONG + + /* The size of a `long` type. A five-byte `long` (as used e.g. on the */ + /* DM642) is recognized but avoided. */ +#if FT_ULONG_MAX == 0xFFFFFFFFUL +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL +#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT ) +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL +#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT ) +#else +#error "Unsupported size of `long' type!" +#endif + +#endif /* !defined(FT_SIZEOF_LONG) */ + +#ifndef FT_SIZEOF_LONG_LONG + + /* The size of a `long long` type if available */ +#if defined( FT_ULLONG_MAX ) && FT_ULLONG_MAX >= 0xFFFFFFFFFFFFFFFFULL +#define FT_SIZEOF_LONG_LONG ( 64 / FT_CHAR_BIT ) +#else +#define FT_SIZEOF_LONG_LONG 0 +#endif + +#endif /* !defined(FT_SIZEOF_LONG_LONG) */ + + + /************************************************************************** + * + * @section: + * basic_types + * + */ + + + /************************************************************************** + * + * @type: + * FT_Int16 + * + * @description: + * A typedef for a 16bit signed integer type. + */ + typedef signed short FT_Int16; + + + /************************************************************************** + * + * @type: + * FT_UInt16 + * + * @description: + * A typedef for a 16bit unsigned integer type. + */ + typedef unsigned short FT_UInt16; + + /* */ + + + /* this #if 0 ... #endif clause is for documentation purposes */ +#if 0 + + /************************************************************************** + * + * @type: + * FT_Int32 + * + * @description: + * A typedef for a 32bit signed integer type. The size depends on the + * configuration. + */ + typedef signed XXX FT_Int32; + + + /************************************************************************** + * + * @type: + * FT_UInt32 + * + * A typedef for a 32bit unsigned integer type. The size depends on the + * configuration. + */ + typedef unsigned XXX FT_UInt32; + + + /************************************************************************** + * + * @type: + * FT_Int64 + * + * A typedef for a 64bit signed integer type. The size depends on the + * configuration. Only defined if there is real 64bit support; + * otherwise, it gets emulated with a structure (if necessary). + */ + typedef signed XXX FT_Int64; + + + /************************************************************************** + * + * @type: + * FT_UInt64 + * + * A typedef for a 64bit unsigned integer type. The size depends on the + * configuration. Only defined if there is real 64bit support; + * otherwise, it gets emulated with a structure (if necessary). + */ + typedef unsigned XXX FT_UInt64; + + /* */ + +#endif + +#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT ) + + typedef signed int FT_Int32; + typedef unsigned int FT_UInt32; + +#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT ) + + typedef signed long FT_Int32; + typedef unsigned long FT_UInt32; + +#else +#error "no 32bit type found -- please check your configuration files" +#endif + + + /* look up an integer type that is at least 32~bits */ +#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT ) + + typedef int FT_Fast; + typedef unsigned int FT_UFast; + +#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT ) + + typedef long FT_Fast; + typedef unsigned long FT_UFast; + +#endif + + + /* determine whether we have a 64-bit integer type */ +#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT ) + +#define FT_INT64 long +#define FT_UINT64 unsigned long + +#elif FT_SIZEOF_LONG_LONG >= ( 64 / FT_CHAR_BIT ) + +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + + /************************************************************************** + * + * A 64-bit data type may create compilation problems if you compile in + * strict ANSI mode. To avoid them, we disable other 64-bit data types if + * `__STDC__` is defined. You can however ignore this rule by defining the + * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro. + */ +#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 ) + +#if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ + + /* this compiler provides the `__int64` type */ +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 + +#elif defined( __BORLANDC__ ) /* Borland C++ */ + + /* XXXX: We should probably check the value of `__BORLANDC__` in order */ + /* to test the compiler version. */ + + /* this compiler provides the `__int64` type */ +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 + +#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100 /* Watcom C++ */ + +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + +#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ + +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + +#elif defined( __GNUC__ ) + + /* GCC provides the `long long` type */ +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int + +#endif /* !__STDC__ */ + +#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ + +#ifdef FT_INT64 + + typedef FT_INT64 FT_Int64; + typedef FT_UINT64 FT_UInt64; + +# define FT_INT64_ZERO 0 + +#else /* !FT_INT64 */ + + /* we need to emulate 64-bit data types if none are available */ + + typedef struct FT_Int64_ + { + FT_UInt32 lo; + FT_UInt32 hi; + + } FT_Int64; + + typedef struct FT_UInt64_ + { + FT_UInt32 lo; + FT_UInt32 hi; + + } FT_UInt64; + +# define FT_INT64_ZERO { 0, 0 } + +#endif /* !FT_INT64 */ + +FT_END_HEADER + +#endif /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/mac-support.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/mac-support.h new file mode 100644 index 0000000000000000000000000000000000000000..bd350851d5600f2076b402e1831e38125a8dcdbd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/mac-support.h @@ -0,0 +1,51 @@ +/**************************************************************************** + * + * config/mac-support.h + * + * Mac/OS X support configuration header. + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ +#ifndef FREETYPE_CONFIG_MAC_SUPPORT_H_ +#define FREETYPE_CONFIG_MAC_SUPPORT_H_ + + /************************************************************************** + * + * Mac support + * + * This is the only necessary change, so it is defined here instead + * providing a new configuration file. + */ +#ifdef FT_MACINTOSH +#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) + /* No Carbon frameworks for 64bit 10.4.x. */ + /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */ + /* so guess the system version by maximum errno before inclusion. */ +#include +#ifdef ECANCELED /* defined since 10.2 */ +#include "AvailabilityMacros.h" +#endif +#if defined( __LP64__ ) && \ + ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) +#undef FT_MACINTOSH +#endif +#endif /* __APPLE__ ... */ + +#elif defined( __SC__ ) || defined( __MRC__ ) + /* Classic MacOS compilers */ +#include "ConditionalMacros.h" +#if TARGET_OS_MAC +#define FT_MACINTOSH 1 +#endif + +#endif /* Mac support */ + +#endif /* FREETYPE_CONFIG_MAC_SUPPORT_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/public-macros.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/public-macros.h new file mode 100644 index 0000000000000000000000000000000000000000..9f28b394737496c99df693af8901eafe2583fef4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/config/public-macros.h @@ -0,0 +1,138 @@ +/**************************************************************************** + * + * config/public-macros.h + * + * Define a set of compiler macros used in public FreeType headers. + * + * Copyright (C) 2020-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /* + * The definitions in this file are used by the public FreeType headers + * and thus should be considered part of the public API. + * + * Other compiler-specific macro definitions that are not exposed by the + * FreeType API should go into + * `include/freetype/internal/compiler-macros.h` instead. + */ +#ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_ +#define FREETYPE_CONFIG_PUBLIC_MACROS_H_ + + /* + * `FT_BEGIN_HEADER` and `FT_END_HEADER` might have already been defined + * by `freetype/config/ftheader.h`, but we don't want to include this + * header here, so redefine the macros here only when needed. Their + * definition is very stable, so keeping them in sync with the ones in the + * header should not be a maintenance issue. + */ +#ifndef FT_BEGIN_HEADER +#ifdef __cplusplus +#define FT_BEGIN_HEADER extern "C" { +#else +#define FT_BEGIN_HEADER /* empty */ +#endif +#endif /* FT_BEGIN_HEADER */ + +#ifndef FT_END_HEADER +#ifdef __cplusplus +#define FT_END_HEADER } +#else +#define FT_END_HEADER /* empty */ +#endif +#endif /* FT_END_HEADER */ + + +FT_BEGIN_HEADER + + /* + * Mark a function declaration as public. This ensures it will be + * properly exported to client code. Place this before a function + * declaration. + * + * NOTE: This macro should be considered an internal implementation + * detail, and not part of the FreeType API. It is only defined here + * because it is needed by `FT_EXPORT`. + */ + + /* Visual C, MinGW, Cygwin */ +#if defined( _WIN32 ) || defined( __CYGWIN__ ) + +#if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT ) +#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport ) +#elif defined( DLL_IMPORT ) +#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport ) +#endif + + /* gcc, clang */ +#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ ) +#define FT_PUBLIC_FUNCTION_ATTRIBUTE \ + __attribute__(( visibility( "default" ) )) + + /* Sun */ +#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550 +#define FT_PUBLIC_FUNCTION_ATTRIBUTE __global +#endif + + +#ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE +#define FT_PUBLIC_FUNCTION_ATTRIBUTE /* empty */ +#endif + + + /* + * Define a public FreeType API function. This ensures it is properly + * exported or imported at build time. The macro parameter is the + * function's return type as in: + * + * FT_EXPORT( FT_Bool ) + * FT_Object_Method( FT_Object obj, + * ... ); + * + * NOTE: This requires that all `FT_EXPORT` uses are inside + * `FT_BEGIN_HEADER ... FT_END_HEADER` blocks. This guarantees that the + * functions are exported with C linkage, even when the header is included + * by a C++ source file. + */ +#define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x + + + /* + * `FT_UNUSED` indicates that a given parameter is not used -- this is + * only used to get rid of unpleasant compiler warnings. + * + * Technically, this was not meant to be part of the public API, but some + * third-party code depends on it. + */ +#ifndef FT_UNUSED +#define FT_UNUSED( arg ) ( (arg) = (arg) ) +#endif + + + /* + * Support for casts in both C and C++. + */ +#ifdef __cplusplus +#define FT_STATIC_CAST( type, var ) static_cast(var) +#define FT_REINTERPRET_CAST( type, var ) reinterpret_cast(var) + +#define FT_STATIC_BYTE_CAST( type, var ) \ + static_cast( static_cast( var ) ) +#else +#define FT_STATIC_CAST( type, var ) (type)(var) +#define FT_REINTERPRET_CAST( type, var ) (type)(var) + +#define FT_STATIC_BYTE_CAST( type, var ) (type)(unsigned char)(var) +#endif + + +FT_END_HEADER + +#endif /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/freetype.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/freetype.h new file mode 100644 index 0000000000000000000000000000000000000000..e8a1b1e2f3ea9c39f6252497da36cfdd25a857d3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/freetype.h @@ -0,0 +1,5284 @@ +/**************************************************************************** + * + * freetype.h + * + * FreeType high-level API and common types (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FREETYPE_H_ +#define FREETYPE_H_ + + +#include +#include FT_CONFIG_CONFIG_H +#include +#include + + +FT_BEGIN_HEADER + + + + /************************************************************************** + * + * @section: + * preamble + * + * @title: + * Preamble + * + * @abstract: + * What FreeType is and isn't + * + * @description: + * FreeType is a library that provides access to glyphs in font files. It + * scales the glyph images and their metrics to a requested size, and it + * rasterizes the glyph images to produce pixel or subpixel alpha coverage + * bitmaps. + * + * Note that FreeType is _not_ a text layout engine. You have to use + * higher-level libraries like HarfBuzz, Pango, or ICU for that. + * + * Note also that FreeType does _not_ perform alpha blending or + * compositing the resulting bitmaps or pixmaps by itself. Use your + * favourite graphics library (for example, Cairo or Skia) to further + * process FreeType's output. + * + */ + + + /************************************************************************** + * + * @section: + * header_inclusion + * + * @title: + * FreeType's header inclusion scheme + * + * @abstract: + * How client applications should include FreeType header files. + * + * @description: + * To be as flexible as possible (and for historical reasons), you must + * load file `ft2build.h` first before other header files, for example + * + * ``` + * #include + * + * #include + * #include + * ``` + */ + + + /************************************************************************** + * + * @section: + * user_allocation + * + * @title: + * User allocation + * + * @abstract: + * How client applications should allocate FreeType data structures. + * + * @description: + * FreeType assumes that structures allocated by the user and passed as + * arguments are zeroed out except for the actual data. In other words, + * it is recommended to use `calloc` (or variants of it) instead of + * `malloc` for allocation. + * + */ + + + /************************************************************************** + * + * @section: + * font_testing_macros + * + * @title: + * Font Testing Macros + * + * @abstract: + * Macros to test various properties of fonts. + * + * @description: + * Macros to test the most important font properties. + * + * It is recommended to use these high-level macros instead of directly + * testing the corresponding flags, which are scattered over various + * structures. + * + * @order: + * FT_HAS_HORIZONTAL + * FT_HAS_VERTICAL + * FT_HAS_KERNING + * FT_HAS_FIXED_SIZES + * FT_HAS_GLYPH_NAMES + * FT_HAS_COLOR + * FT_HAS_MULTIPLE_MASTERS + * FT_HAS_SVG + * FT_HAS_SBIX + * FT_HAS_SBIX_OVERLAY + * + * FT_IS_SFNT + * FT_IS_SCALABLE + * FT_IS_FIXED_WIDTH + * FT_IS_CID_KEYED + * FT_IS_TRICKY + * FT_IS_NAMED_INSTANCE + * FT_IS_VARIATION + * + */ + + + /************************************************************************** + * + * @section: + * library_setup + * + * @title: + * Library Setup + * + * @abstract: + * Functions to start and end the usage of the FreeType library. + * + * @description: + * Functions to start and end the usage of the FreeType library. + * + * Note that @FT_Library_Version and @FREETYPE_XXX are of limited use + * because even a new release of FreeType with only documentation + * changes increases the version number. + * + * @order: + * FT_Library + * FT_Init_FreeType + * FT_Done_FreeType + * + * FT_Library_Version + * FREETYPE_XXX + * + */ + + + /************************************************************************** + * + * @section: + * face_creation + * + * @title: + * Face Creation + * + * @abstract: + * Functions to manage fonts. + * + * @description: + * The functions and structures collected in this section operate on + * fonts globally. + * + * @order: + * FT_Face + * FT_FaceRec + * FT_FACE_FLAG_XXX + * FT_STYLE_FLAG_XXX + * + * FT_New_Face + * FT_Done_Face + * FT_Reference_Face + * FT_New_Memory_Face + * FT_Face_Properties + * FT_Open_Face + * FT_Open_Args + * FT_OPEN_XXX + * FT_Parameter + * FT_Attach_File + * FT_Attach_Stream + * + */ + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + * @title: + * Sizing and Scaling + * + * @abstract: + * Functions to manage font sizes. + * + * @description: + * The functions and structures collected in this section are related to + * selecting and manipulating the size of a font globally. + * + * @order: + * FT_Size + * FT_SizeRec + * FT_Size_Metrics + * + * FT_Bitmap_Size + * + * FT_Set_Char_Size + * FT_Set_Pixel_Sizes + * FT_Request_Size + * FT_Select_Size + * FT_Size_Request_Type + * FT_Size_RequestRec + * FT_Size_Request + * + * FT_Set_Transform + * FT_Get_Transform + * + */ + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + * @title: + * Glyph Retrieval + * + * @abstract: + * Functions to manage glyphs. + * + * @description: + * The functions and structures collected in this section operate on + * single glyphs, of which @FT_Load_Glyph is most important. + * + * @order: + * FT_GlyphSlot + * FT_GlyphSlotRec + * FT_Glyph_Metrics + * + * FT_Load_Glyph + * FT_LOAD_XXX + * FT_LOAD_TARGET_MODE + * FT_LOAD_TARGET_XXX + * + * FT_Render_Glyph + * FT_Render_Mode + * FT_Get_Kerning + * FT_Kerning_Mode + * FT_Get_Track_Kerning + * + */ + + + /************************************************************************** + * + * @section: + * character_mapping + * + * @title: + * Character Mapping + * + * @abstract: + * Functions to manage character-to-glyph maps. + * + * @description: + * This section holds functions and structures that are related to + * mapping character input codes to glyph indices. + * + * Note that for many scripts the simplistic approach used by FreeType + * of mapping a single character to a single glyph is not valid or + * possible! In general, a higher-level library like HarfBuzz or ICU + * should be used for handling text strings. + * + * @order: + * FT_CharMap + * FT_CharMapRec + * FT_Encoding + * FT_ENC_TAG + * + * FT_Select_Charmap + * FT_Set_Charmap + * FT_Get_Charmap_Index + * + * FT_Get_Char_Index + * FT_Get_First_Char + * FT_Get_Next_Char + * FT_Load_Char + * + */ + + + /************************************************************************** + * + * @section: + * information_retrieval + * + * @title: + * Information Retrieval + * + * @abstract: + * Functions to retrieve font and glyph information. + * + * @description: + * Functions to retrieve font and glyph information. Only some very + * basic data is covered; see also the chapter on the format-specific + * API for more. + * + * + * @order: + * FT_Get_Name_Index + * FT_Get_Glyph_Name + * FT_Get_Postscript_Name + * FT_Get_FSType_Flags + * FT_FSTYPE_XXX + * FT_Get_SubGlyph_Info + * FT_SUBGLYPH_FLAG_XXX + * + */ + + + /************************************************************************** + * + * @section: + * other_api_data + * + * @title: + * Other API Data + * + * @abstract: + * Other structures, enumerations, and macros. + * + * @description: + * Other structures, enumerations, and macros. Deprecated functions are + * also listed here. + * + * @order: + * FT_Face_Internal + * FT_Size_Internal + * FT_Slot_Internal + * + * FT_SubGlyph + * + * FT_HAS_FAST_GLYPHS + * FT_Face_CheckTrueTypePatents + * FT_Face_SetUnpatentedHinting + * + */ + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* B A S I C T Y P E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @struct: + * FT_Glyph_Metrics + * + * @description: + * A structure to model the metrics of a single glyph. The values are + * expressed in 26.6 fractional pixel format; if the flag + * @FT_LOAD_NO_SCALE has been used while loading the glyph, values are + * expressed in font units instead. + * + * @fields: + * width :: + * The glyph's width. + * + * height :: + * The glyph's height. + * + * horiBearingX :: + * Left side bearing for horizontal layout. + * + * horiBearingY :: + * Top side bearing for horizontal layout. + * + * horiAdvance :: + * Advance width for horizontal layout. + * + * vertBearingX :: + * Left side bearing for vertical layout. + * + * vertBearingY :: + * Top side bearing for vertical layout. Larger positive values mean + * further below the vertical glyph origin. + * + * vertAdvance :: + * Advance height for vertical layout. Positive values mean the glyph + * has a positive advance downward. + * + * @note: + * If not disabled with @FT_LOAD_NO_HINTING, the values represent + * dimensions of the hinted glyph (in case hinting is applicable). + * + * Stroking a glyph with an outside border does not increase + * `horiAdvance` or `vertAdvance`; you have to manually adjust these + * values to account for the added width and height. + * + * FreeType doesn't use the 'VORG' table data for CFF fonts because it + * doesn't have an interface to quickly retrieve the glyph height. The + * y~coordinate of the vertical origin can be simply computed as + * `vertBearingY + height` after loading a glyph. + */ + typedef struct FT_Glyph_Metrics_ + { + FT_Pos width; + FT_Pos height; + + FT_Pos horiBearingX; + FT_Pos horiBearingY; + FT_Pos horiAdvance; + + FT_Pos vertBearingX; + FT_Pos vertBearingY; + FT_Pos vertAdvance; + + } FT_Glyph_Metrics; + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + + /************************************************************************** + * + * @struct: + * FT_Bitmap_Size + * + * @description: + * This structure models the metrics of a bitmap strike (i.e., a set of + * glyphs for a given point size and resolution) in a bitmap font. It is + * used for the `available_sizes` field of @FT_Face. + * + * @fields: + * height :: + * The vertical distance, in pixels, between two consecutive baselines. + * It is always positive. + * + * width :: + * The average width, in pixels, of all glyphs in the strike. + * + * size :: + * The nominal size of the strike in 26.6 fractional points. This + * field is not very useful. + * + * x_ppem :: + * The horizontal ppem (nominal width) in 26.6 fractional pixels. + * + * y_ppem :: + * The vertical ppem (nominal height) in 26.6 fractional pixels. + * + * @note: + * Windows FNT: + * The nominal size given in a FNT font is not reliable. If the driver + * finds it incorrect, it sets `size` to some calculated values, and + * `x_ppem` and `y_ppem` to the pixel width and height given in the + * font, respectively. + * + * TrueType embedded bitmaps: + * `size`, `width`, and `height` values are not contained in the bitmap + * strike itself. They are computed from the global font parameters. + */ + typedef struct FT_Bitmap_Size_ + { + FT_Short height; + FT_Short width; + + FT_Pos size; + + FT_Pos x_ppem; + FT_Pos y_ppem; + + } FT_Bitmap_Size; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* O B J E C T C L A S S E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + /************************************************************************** + * + * @section: + * library_setup + * + */ + + /************************************************************************** + * + * @type: + * FT_Library + * + * @description: + * A handle to a FreeType library instance. Each 'library' is completely + * independent from the others; it is the 'root' of a set of objects like + * fonts, faces, sizes, etc. + * + * It also embeds a memory manager (see @FT_Memory), as well as a + * scan-line converter object (see @FT_Raster). + * + * [Since 2.5.6] In multi-threaded applications it is easiest to use one + * `FT_Library` object per thread. In case this is too cumbersome, a + * single `FT_Library` object across threads is possible also, as long as + * a mutex lock is used around @FT_New_Face and @FT_Done_Face. + * + * @note: + * Library objects are normally created by @FT_Init_FreeType, and + * destroyed with @FT_Done_FreeType. If you need reference-counting + * (cf. @FT_Reference_Library), use @FT_New_Library and @FT_Done_Library. + */ + typedef struct FT_LibraryRec_ *FT_Library; + + + /************************************************************************** + * + * @section: + * module_management + * + */ + + /************************************************************************** + * + * @type: + * FT_Module + * + * @description: + * A handle to a given FreeType module object. A module can be a font + * driver, a renderer, or anything else that provides services to the + * former. + */ + typedef struct FT_ModuleRec_* FT_Module; + + + /************************************************************************** + * + * @type: + * FT_Driver + * + * @description: + * A handle to a given FreeType font driver object. A font driver is a + * module capable of creating faces from font files. + */ + typedef struct FT_DriverRec_* FT_Driver; + + + /************************************************************************** + * + * @type: + * FT_Renderer + * + * @description: + * A handle to a given FreeType renderer. A renderer is a module in + * charge of converting a glyph's outline image to a bitmap. It supports + * a single glyph image format, and one or more target surface depths. + */ + typedef struct FT_RendererRec_* FT_Renderer; + + + /************************************************************************** + * + * @section: + * face_creation + * + */ + + /************************************************************************** + * + * @type: + * FT_Face + * + * @description: + * A handle to a typographic face object. A face object models a given + * typeface, in a given style. + * + * @note: + * A face object also owns a single @FT_GlyphSlot object, as well as one + * or more @FT_Size objects. + * + * Use @FT_New_Face or @FT_Open_Face to create a new face object from a + * given filepath or a custom input stream. + * + * Use @FT_Done_Face to destroy it (along with its slot and sizes). + * + * An `FT_Face` object can only be safely used from one thread at a time. + * Similarly, creation and destruction of `FT_Face` with the same + * @FT_Library object can only be done from one thread at a time. On the + * other hand, functions like @FT_Load_Glyph and its siblings are + * thread-safe and do not need the lock to be held as long as the same + * `FT_Face` object is not used from multiple threads at the same time. + * + * @also: + * See @FT_FaceRec for the publicly accessible fields of a given face + * object. + */ + typedef struct FT_FaceRec_* FT_Face; + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + + /************************************************************************** + * + * @type: + * FT_Size + * + * @description: + * A handle to an object that models a face scaled to a given character + * size. + * + * @note: + * An @FT_Face has one _active_ `FT_Size` object that is used by + * functions like @FT_Load_Glyph to determine the scaling transformation + * that in turn is used to load and hint glyphs and metrics. + * + * A newly created `FT_Size` object contains only meaningless zero values. + * You must use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size + * or even @FT_Select_Size to change the content (i.e., the scaling + * values) of the active `FT_Size`. Otherwise, the scaling and hinting + * will not be performed. + * + * You can use @FT_New_Size to create additional size objects for a given + * @FT_Face, but they won't be used by other functions until you activate + * it through @FT_Activate_Size. Only one size can be activated at any + * given time per face. + * + * @also: + * See @FT_SizeRec for the publicly accessible fields of a given size + * object. + */ + typedef struct FT_SizeRec_* FT_Size; + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @type: + * FT_GlyphSlot + * + * @description: + * A handle to a given 'glyph slot'. A slot is a container that can hold + * any of the glyphs contained in its parent face. + * + * In other words, each time you call @FT_Load_Glyph or @FT_Load_Char, + * the slot's content is erased by the new glyph data, i.e., the glyph's + * metrics, its image (bitmap or outline), and other control information. + * + * @also: + * See @FT_GlyphSlotRec for the publicly accessible glyph fields. + */ + typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; + + + /************************************************************************** + * + * @section: + * character_mapping + * + */ + + /************************************************************************** + * + * @type: + * FT_CharMap + * + * @description: + * A handle to a character map (usually abbreviated to 'charmap'). A + * charmap is used to translate character codes in a given encoding into + * glyph indexes for its parent's face. Some font formats may provide + * several charmaps per font. + * + * Each face object owns zero or more charmaps, but only one of them can + * be 'active', providing the data used by @FT_Get_Char_Index or + * @FT_Load_Char. + * + * The list of available charmaps in a face is available through the + * `face->num_charmaps` and `face->charmaps` fields of @FT_FaceRec. + * + * The currently active charmap is available as `face->charmap`. You + * should call @FT_Set_Charmap to change it. + * + * @note: + * When a new face is created (either through @FT_New_Face or + * @FT_Open_Face), the library looks for a Unicode charmap within the + * list and automatically activates it. If there is no Unicode charmap, + * FreeType doesn't set an 'active' charmap. + * + * @also: + * See @FT_CharMapRec for the publicly accessible fields of a given + * character map. + */ + typedef struct FT_CharMapRec_* FT_CharMap; + + + /************************************************************************** + * + * @macro: + * FT_ENC_TAG + * + * @description: + * This macro converts four-letter tags into an unsigned long. It is + * used to define 'encoding' identifiers (see @FT_Encoding). + * + * @note: + * Since many 16-bit compilers don't like 32-bit enumerations, you should + * redefine this macro in case of problems to something like this: + * + * ``` + * #define FT_ENC_TAG( value, a, b, c, d ) value + * ``` + * + * to get a simple enumeration without assigning special numbers. + */ + +#ifndef FT_ENC_TAG + +#define FT_ENC_TAG( value, a, b, c, d ) \ + value = ( ( FT_STATIC_BYTE_CAST( FT_UInt32, a ) << 24 ) | \ + ( FT_STATIC_BYTE_CAST( FT_UInt32, b ) << 16 ) | \ + ( FT_STATIC_BYTE_CAST( FT_UInt32, c ) << 8 ) | \ + FT_STATIC_BYTE_CAST( FT_UInt32, d ) ) + +#endif /* FT_ENC_TAG */ + + + /************************************************************************** + * + * @enum: + * FT_Encoding + * + * @description: + * An enumeration to specify character sets supported by charmaps. Used + * in the @FT_Select_Charmap API function. + * + * @note: + * Despite the name, this enumeration lists specific character + * repertoires (i.e., charsets), and not text encoding methods (e.g., + * UTF-8, UTF-16, etc.). + * + * Other encodings might be defined in the future. + * + * @values: + * FT_ENCODING_NONE :: + * The encoding value~0 is reserved for all formats except BDF, PCF, + * and Windows FNT; see below for more information. + * + * FT_ENCODING_UNICODE :: + * The Unicode character set. This value covers all versions of the + * Unicode repertoire, including ASCII and Latin-1. Most fonts include + * a Unicode charmap, but not all of them. + * + * For example, if you want to access Unicode value U+1F028 (and the + * font contains it), use value 0x1F028 as the input value for + * @FT_Get_Char_Index. + * + * FT_ENCODING_MS_SYMBOL :: + * Microsoft Symbol encoding, used to encode mathematical symbols and + * wingdings. For more information, see + * 'https://learn.microsoft.com/typography/opentype/spec/recom#non-standard-symbol-fonts', + * 'http://www.kostis.net/charsets/symbol.htm', and + * 'http://www.kostis.net/charsets/wingding.htm'. + * + * This encoding uses character codes from the PUA (Private Unicode + * Area) in the range U+F020-U+F0FF. + * + * FT_ENCODING_SJIS :: + * Shift JIS encoding for Japanese. More info at + * 'https://en.wikipedia.org/wiki/Shift_JIS'. See note on multi-byte + * encodings below. + * + * FT_ENCODING_PRC :: + * Corresponds to encoding systems mainly for Simplified Chinese as + * used in People's Republic of China (PRC). The encoding layout is + * based on GB~2312 and its supersets GBK and GB~18030. + * + * FT_ENCODING_BIG5 :: + * Corresponds to an encoding system for Traditional Chinese as used in + * Taiwan and Hong Kong. + * + * FT_ENCODING_WANSUNG :: + * Corresponds to the Korean encoding system known as Extended Wansung + * (MS Windows code page 949). For more information see + * 'https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. + * + * FT_ENCODING_JOHAB :: + * The Korean standard character set (KS~C 5601-1992), which + * corresponds to MS Windows code page 1361. This character set + * includes all possible Hangul character combinations. + * + * FT_ENCODING_ADOBE_LATIN_1 :: + * Corresponds to a Latin-1 encoding as defined in a Type~1 PostScript + * font. It is limited to 256 character codes. + * + * FT_ENCODING_ADOBE_STANDARD :: + * Adobe Standard encoding, as found in Type~1, CFF, and OpenType/CFF + * fonts. It is limited to 256 character codes. + * + * FT_ENCODING_ADOBE_EXPERT :: + * Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF + * fonts. It is limited to 256 character codes. + * + * FT_ENCODING_ADOBE_CUSTOM :: + * Corresponds to a custom encoding, as found in Type~1, CFF, and + * OpenType/CFF fonts. It is limited to 256 character codes. + * + * FT_ENCODING_APPLE_ROMAN :: + * Apple roman encoding. Many TrueType and OpenType fonts contain a + * charmap for this 8-bit encoding, since older versions of Mac OS are + * able to use it. + * + * FT_ENCODING_OLD_LATIN_2 :: + * This value is deprecated and was neither used nor reported by + * FreeType. Don't use or test for it. + * + * FT_ENCODING_MS_SJIS :: + * Same as FT_ENCODING_SJIS. Deprecated. + * + * FT_ENCODING_MS_GB2312 :: + * Same as FT_ENCODING_PRC. Deprecated. + * + * FT_ENCODING_MS_BIG5 :: + * Same as FT_ENCODING_BIG5. Deprecated. + * + * FT_ENCODING_MS_WANSUNG :: + * Same as FT_ENCODING_WANSUNG. Deprecated. + * + * FT_ENCODING_MS_JOHAB :: + * Same as FT_ENCODING_JOHAB. Deprecated. + * + * @note: + * When loading a font, FreeType makes a Unicode charmap active if + * possible (either if the font provides such a charmap, or if FreeType + * can synthesize one from PostScript glyph name dictionaries; in either + * case, the charmap is tagged with `FT_ENCODING_UNICODE`). If such a + * charmap is synthesized, it is placed at the first position of the + * charmap array. + * + * All other encodings are considered legacy and tagged only if + * explicitly defined in the font file. Otherwise, `FT_ENCODING_NONE` is + * used. + * + * `FT_ENCODING_NONE` is set by the BDF and PCF drivers if the charmap is + * neither Unicode nor ISO-8859-1 (otherwise it is set to + * `FT_ENCODING_UNICODE`). Use @FT_Get_BDF_Charset_ID to find out which + * encoding is really present. If, for example, the `cs_registry` field + * is 'KOI8' and the `cs_encoding` field is 'R', the font is encoded in + * KOI8-R. + * + * `FT_ENCODING_NONE` is always set (with a single exception) by the + * winfonts driver. Use @FT_Get_WinFNT_Header and examine the `charset` + * field of the @FT_WinFNT_HeaderRec structure to find out which encoding + * is really present. For example, @FT_WinFNT_ID_CP1251 (204) means + * Windows code page 1251 (for Russian). + * + * `FT_ENCODING_NONE` is set if `platform_id` is @TT_PLATFORM_MACINTOSH + * and `encoding_id` is not `TT_MAC_ID_ROMAN` (otherwise it is set to + * `FT_ENCODING_APPLE_ROMAN`). + * + * If `platform_id` is @TT_PLATFORM_MACINTOSH, use the function + * @FT_Get_CMap_Language_ID to query the Mac language ID that may be + * needed to be able to distinguish Apple encoding variants. See + * + * https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt + * + * to get an idea how to do that. Basically, if the language ID is~0, + * don't use it, otherwise subtract 1 from the language ID. Then examine + * `encoding_id`. If, for example, `encoding_id` is `TT_MAC_ID_ROMAN` + * and the language ID (minus~1) is `TT_MAC_LANGID_GREEK`, it is the + * Greek encoding, not Roman. `TT_MAC_ID_ARABIC` with + * `TT_MAC_LANGID_FARSI` means the Farsi variant of the Arabic encoding. + */ + typedef enum FT_Encoding_ + { + FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), + + FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), + FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), + + FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), + FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ), + FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), + FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), + FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), + + /* for backward compatibility */ + FT_ENCODING_GB2312 = FT_ENCODING_PRC, + FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, + FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC, + FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, + FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, + FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, + + FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), + + FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), + + FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) + + } FT_Encoding; + + + /* these constants are deprecated; use the corresponding `FT_Encoding` */ + /* values instead */ +#define ft_encoding_none FT_ENCODING_NONE +#define ft_encoding_unicode FT_ENCODING_UNICODE +#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL +#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 +#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 +#define ft_encoding_sjis FT_ENCODING_SJIS +#define ft_encoding_gb2312 FT_ENCODING_PRC +#define ft_encoding_big5 FT_ENCODING_BIG5 +#define ft_encoding_wansung FT_ENCODING_WANSUNG +#define ft_encoding_johab FT_ENCODING_JOHAB + +#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD +#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT +#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM +#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN + + + /************************************************************************** + * + * @struct: + * FT_CharMapRec + * + * @description: + * The base charmap structure. + * + * @fields: + * face :: + * A handle to the parent face object. + * + * encoding :: + * An @FT_Encoding tag identifying the charmap. Use this with + * @FT_Select_Charmap. + * + * platform_id :: + * An ID number describing the platform for the following encoding ID. + * This comes directly from the TrueType specification and gets + * emulated for other formats. + * + * encoding_id :: + * A platform-specific encoding number. This also comes from the + * TrueType specification and gets emulated similarly. + */ + typedef struct FT_CharMapRec_ + { + FT_Face face; + FT_Encoding encoding; + FT_UShort platform_id; + FT_UShort encoding_id; + + } FT_CharMapRec; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* B A S E O B J E C T C L A S S E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @section: + * other_api_data + * + */ + + /************************************************************************** + * + * @type: + * FT_Face_Internal + * + * @description: + * An opaque handle to an `FT_Face_InternalRec` structure that models the + * private data of a given @FT_Face object. + * + * This structure might change between releases of FreeType~2 and is not + * generally available to client applications. + */ + typedef struct FT_Face_InternalRec_* FT_Face_Internal; + + + /************************************************************************** + * + * @section: + * face_creation + * + */ + + /************************************************************************** + * + * @struct: + * FT_FaceRec + * + * @description: + * FreeType root face class structure. A face object models a typeface + * in a font file. + * + * @fields: + * num_faces :: + * The number of faces in the font file. Some font formats can have + * multiple faces in a single font file. + * + * face_index :: + * This field holds two different values. Bits 0-15 are the index of + * the face in the font file (starting with value~0). They are set + * to~0 if there is only one face in the font file. + * + * [Since 2.6.1] Bits 16-30 are relevant to TrueType GX and OpenType + * Font Variations only, holding the named instance index for the + * current face index (starting with value~1; value~0 indicates font + * access without a named instance). For non-variation fonts, bits + * 16-30 are ignored. If we have the third named instance of face~4, + * say, `face_index` is set to 0x00030004. + * + * Bit 31 is always zero (that is, `face_index` is always a positive + * value). + * + * [Since 2.9] Changing the design coordinates with + * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does + * not influence the named instance index value (only + * @FT_Set_Named_Instance does that). + * + * face_flags :: + * A set of bit flags that give important information about the face; + * see @FT_FACE_FLAG_XXX for the details. + * + * style_flags :: + * The lower 16~bits contain a set of bit flags indicating the style of + * the face; see @FT_STYLE_FLAG_XXX for the details. + * + * [Since 2.6.1] Bits 16-30 hold the number of named instances + * available for the current face if we have a TrueType GX or OpenType + * Font Variation. Bit 31 is always zero (that is, `style_flags` is + * always a positive value). Note that a variation font has always at + * least one named instance, namely the default instance. + * + * num_glyphs :: + * The number of glyphs in the face. If the face is scalable and has + * sbits (see `num_fixed_sizes`), it is set to the number of outline + * glyphs. + * + * For CID-keyed fonts (not in an SFNT wrapper) this value gives the + * highest CID used in the font. + * + * family_name :: + * The face's family name. This is an ASCII string, usually in + * English, that describes the typeface's family (like 'Times New + * Roman', 'Bodoni', 'Garamond', etc). This is a least common + * denominator used to list fonts. Some formats (TrueType & OpenType) + * provide localized and Unicode versions of this string. Applications + * should use the format-specific interface to access them. Can be + * `NULL` (e.g., in fonts embedded in a PDF file). + * + * In case the font doesn't provide a specific family name entry, + * FreeType tries to synthesize one, deriving it from other name + * entries. + * + * style_name :: + * The face's style name. This is an ASCII string, usually in English, + * that describes the typeface's style (like 'Italic', 'Bold', + * 'Condensed', etc). Not all font formats provide a style name, so + * this field is optional, and can be set to `NULL`. As for + * `family_name`, some formats provide localized and Unicode versions + * of this string. Applications should use the format-specific + * interface to access them. + * + * num_fixed_sizes :: + * The number of bitmap strikes in the face. Even if the face is + * scalable, there might still be bitmap strikes, which are called + * 'sbits' in that case. + * + * available_sizes :: + * An array of @FT_Bitmap_Size for all bitmap strikes in the face. It + * is set to `NULL` if there is no bitmap strike. + * + * Note that FreeType tries to sanitize the strike data since they are + * sometimes sloppy or incorrect, but this can easily fail. + * + * num_charmaps :: + * The number of charmaps in the face. + * + * charmaps :: + * An array of the charmaps of the face. + * + * generic :: + * A field reserved for client uses. See the @FT_Generic type + * description. + * + * bbox :: + * The font bounding box. Coordinates are expressed in font units (see + * `units_per_EM`). The box is large enough to contain any glyph from + * the font. Thus, `bbox.yMax` can be seen as the 'maximum ascender', + * and `bbox.yMin` as the 'minimum descender'. Only relevant for + * scalable formats. + * + * Note that the bounding box might be off by (at least) one pixel for + * hinted fonts. See @FT_Size_Metrics for further discussion. + * + * Note that the bounding box does not vary in OpenType Font Variations + * and should only be used in relation to the default instance. + * + * units_per_EM :: + * The number of font units per EM square for this face. This is + * typically 2048 for TrueType fonts, and 1000 for Type~1 fonts. Only + * relevant for scalable formats. + * + * ascender :: + * The typographic ascender of the face, expressed in font units. For + * font formats not having this information, it is set to `bbox.yMax`. + * Only relevant for scalable formats. + * + * descender :: + * The typographic descender of the face, expressed in font units. For + * font formats not having this information, it is set to `bbox.yMin`. + * Note that this field is negative for values below the baseline. + * Only relevant for scalable formats. + * + * height :: + * This value is the vertical distance between two consecutive + * baselines, expressed in font units. It is always positive. Only + * relevant for scalable formats. + * + * If you want the global glyph height, use `ascender - descender`. + * + * max_advance_width :: + * The maximum advance width, in font units, for all glyphs in this + * face. This can be used to make word wrapping computations faster. + * Only relevant for scalable formats. + * + * max_advance_height :: + * The maximum advance height, in font units, for all glyphs in this + * face. This is only relevant for vertical layouts, and is set to + * `height` for fonts that do not provide vertical metrics. Only + * relevant for scalable formats. + * + * underline_position :: + * The position, in font units, of the underline line for this face. + * It is the center of the underlining stem. Only relevant for + * scalable formats. + * + * underline_thickness :: + * The thickness, in font units, of the underline for this face. Only + * relevant for scalable formats. + * + * glyph :: + * The face's associated glyph slot(s). + * + * size :: + * The current active size for this face. + * + * charmap :: + * The current active charmap for this face. + * + * @note: + * Fields may be changed after a call to @FT_Attach_File or + * @FT_Attach_Stream. + * + * For OpenType Font Variations, the values of the following fields can + * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if + * the font contains an 'MVAR' table: `ascender`, `descender`, `height`, + * `underline_position`, and `underline_thickness`. + * + * Especially for TrueType fonts see also the documentation for + * @FT_Size_Metrics. + */ + typedef struct FT_FaceRec_ + { + FT_Long num_faces; + FT_Long face_index; + + FT_Long face_flags; + FT_Long style_flags; + + FT_Long num_glyphs; + + FT_String* family_name; + FT_String* style_name; + + FT_Int num_fixed_sizes; + FT_Bitmap_Size* available_sizes; + + FT_Int num_charmaps; + FT_CharMap* charmaps; + + FT_Generic generic; + + /* The following member variables (down to `underline_thickness`) */ + /* are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ + /* for bitmap fonts. */ + FT_BBox bbox; + + FT_UShort units_per_EM; + FT_Short ascender; + FT_Short descender; + FT_Short height; + + FT_Short max_advance_width; + FT_Short max_advance_height; + + FT_Short underline_position; + FT_Short underline_thickness; + + FT_GlyphSlot glyph; + FT_Size size; + FT_CharMap charmap; + + /* private fields, internal to FreeType */ + + FT_Driver driver; + FT_Memory memory; + FT_Stream stream; + + FT_ListRec sizes_list; + + FT_Generic autohint; /* face-specific auto-hinter data */ + void* extensions; /* unused */ + + FT_Face_Internal internal; + + } FT_FaceRec; + + + /************************************************************************** + * + * @enum: + * FT_FACE_FLAG_XXX + * + * @description: + * A list of bit flags used in the `face_flags` field of the @FT_FaceRec + * structure. They inform client applications of properties of the + * corresponding face. + * + * @values: + * FT_FACE_FLAG_SCALABLE :: + * The face contains outline glyphs. Note that a face can contain + * bitmap strikes also, i.e., a face can have both this flag and + * @FT_FACE_FLAG_FIXED_SIZES set. + * + * FT_FACE_FLAG_FIXED_SIZES :: + * The face contains bitmap strikes. See also the `num_fixed_sizes` + * and `available_sizes` fields of @FT_FaceRec. + * + * FT_FACE_FLAG_FIXED_WIDTH :: + * The face contains fixed-width characters (like Courier, Lucida, + * MonoType, etc.). + * + * FT_FACE_FLAG_SFNT :: + * The face uses the SFNT storage scheme. For now, this means TrueType + * and OpenType. + * + * FT_FACE_FLAG_HORIZONTAL :: + * The face contains horizontal glyph metrics. This should be set for + * all common formats. + * + * FT_FACE_FLAG_VERTICAL :: + * The face contains vertical glyph metrics. This is only available in + * some formats, not all of them. + * + * FT_FACE_FLAG_KERNING :: + * The face contains kerning information. If set, the kerning distance + * can be retrieved using the function @FT_Get_Kerning. Otherwise the + * function always returns the vector (0,0). + * + * Note that for TrueType fonts only, FreeType supports both the 'kern' + * table and the basic, pair-wise kerning feature from the 'GPOS' table + * (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), though FreeType does + * not support the more advanced GPOS layout features; use a library + * like HarfBuzz for those instead. + * + * FT_FACE_FLAG_FAST_GLYPHS :: + * THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. + * + * FT_FACE_FLAG_MULTIPLE_MASTERS :: + * The face contains multiple masters and is capable of interpolating + * between them. Supported formats are Adobe MM, TrueType GX, and + * OpenType Font Variations. + * + * See section @multiple_masters for API details. + * + * FT_FACE_FLAG_GLYPH_NAMES :: + * The face contains glyph names, which can be retrieved using + * @FT_Get_Glyph_Name. Note that some TrueType fonts contain broken + * glyph name tables. Use the function @FT_Has_PS_Glyph_Names when + * needed. + * + * FT_FACE_FLAG_EXTERNAL_STREAM :: + * Used internally by FreeType to indicate that a face's stream was + * provided by the client application and should not be destroyed when + * @FT_Done_Face is called. Don't read or test this flag. + * + * FT_FACE_FLAG_HINTER :: + * The font driver has a hinting machine of its own. For example, with + * TrueType fonts, it makes sense to use data from the SFNT 'gasp' + * table only if the native TrueType hinting engine (with the bytecode + * interpreter) is available and active. + * + * FT_FACE_FLAG_CID_KEYED :: + * The face is CID-keyed. In that case, the face is not accessed by + * glyph indices but by CID values. For subsetted CID-keyed fonts this + * has the consequence that not all index values are a valid argument + * to @FT_Load_Glyph. Only the CID values for which corresponding + * glyphs in the subsetted font exist make `FT_Load_Glyph` return + * successfully; in all other cases you get an + * `FT_Err_Invalid_Argument` error. + * + * Note that CID-keyed fonts that are in an SFNT wrapper (that is, all + * OpenType/CFF fonts) don't have this flag set since the glyphs are + * accessed in the normal way (using contiguous indices); the + * 'CID-ness' isn't visible to the application. + * + * FT_FACE_FLAG_TRICKY :: + * The face is 'tricky', that is, it always needs the font format's + * native hinting engine to get a reasonable result. A typical example + * is the old Chinese font `mingli.ttf` (but not `mingliu.ttc`) that + * uses TrueType bytecode instructions to move and scale all of its + * subglyphs. + * + * It is not possible to auto-hint such fonts using + * @FT_LOAD_FORCE_AUTOHINT; it will also ignore @FT_LOAD_NO_HINTING. + * You have to set both @FT_LOAD_NO_HINTING and @FT_LOAD_NO_AUTOHINT to + * really disable hinting; however, you probably never want this except + * for demonstration purposes. + * + * Currently, there are about a dozen TrueType fonts in the list of + * tricky fonts; they are hard-coded in file `ttobjs.c`. + * + * FT_FACE_FLAG_COLOR :: + * [Since 2.5.1] The face has color glyph tables. See @FT_LOAD_COLOR + * for more information. + * + * FT_FACE_FLAG_VARIATION :: + * [Since 2.9] Set if the current face (or named instance) has been + * altered with @FT_Set_MM_Design_Coordinates, + * @FT_Set_Var_Design_Coordinates, @FT_Set_Var_Blend_Coordinates, or + * @FT_Set_MM_WeightVector to select a non-default instance. + * + * FT_FACE_FLAG_SVG :: + * [Since 2.12] The face has an 'SVG~' OpenType table. + * + * FT_FACE_FLAG_SBIX :: + * [Since 2.12] The face has an 'sbix' OpenType table *and* outlines. + * For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to + * retain backward compatibility. + * + * FT_FACE_FLAG_SBIX_OVERLAY :: + * [Since 2.12] The face has an 'sbix' OpenType table where outlines + * should be drawn on top of bitmap strikes. + * + */ +#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) +#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) +#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) +#define FT_FACE_FLAG_SFNT ( 1L << 3 ) +#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) +#define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) +#define FT_FACE_FLAG_KERNING ( 1L << 6 ) +#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) +#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) +#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) +#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) +#define FT_FACE_FLAG_HINTER ( 1L << 11 ) +#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) +#define FT_FACE_FLAG_TRICKY ( 1L << 13 ) +#define FT_FACE_FLAG_COLOR ( 1L << 14 ) +#define FT_FACE_FLAG_VARIATION ( 1L << 15 ) +#define FT_FACE_FLAG_SVG ( 1L << 16 ) +#define FT_FACE_FLAG_SBIX ( 1L << 17 ) +#define FT_FACE_FLAG_SBIX_OVERLAY ( 1L << 18 ) + + + /************************************************************************** + * + * @section: + * font_testing_macros + * + */ + + /************************************************************************** + * + * @macro: + * FT_HAS_HORIZONTAL + * + * @description: + * A macro that returns true whenever a face object contains horizontal + * metrics (this is true for all font formats though). + * + * @also: + * @FT_HAS_VERTICAL can be used to check for vertical metrics. + * + */ +#define FT_HAS_HORIZONTAL( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_VERTICAL + * + * @description: + * A macro that returns true whenever a face object contains real + * vertical metrics (and not only synthesized ones). + * + */ +#define FT_HAS_VERTICAL( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_KERNING + * + * @description: + * A macro that returns true whenever a face object contains kerning data + * that can be accessed with @FT_Get_Kerning. + * + */ +#define FT_HAS_KERNING( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_SCALABLE + * + * @description: + * A macro that returns true whenever a face object contains a scalable + * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and + * PFR font formats). + * + */ +#define FT_IS_SCALABLE( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_SFNT + * + * @description: + * A macro that returns true whenever a face object contains a font whose + * format is based on the SFNT storage scheme. This usually means: + * TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap + * fonts. + * + * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and + * @FT_TRUETYPE_TABLES_H are available. + * + */ +#define FT_IS_SFNT( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_FIXED_WIDTH + * + * @description: + * A macro that returns true whenever a face object contains a font face + * that contains fixed-width (or 'monospace', 'fixed-pitch', etc.) + * glyphs. + * + */ +#define FT_IS_FIXED_WIDTH( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_FIXED_SIZES + * + * @description: + * A macro that returns true whenever a face object contains some + * embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec + * structure. + * + */ +#define FT_HAS_FIXED_SIZES( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) ) + + + /************************************************************************** + * + * @section: + * other_api_data + * + */ + + /************************************************************************** + * + * @macro: + * FT_HAS_FAST_GLYPHS + * + * @description: + * Deprecated. + * + */ +#define FT_HAS_FAST_GLYPHS( face ) 0 + + + /************************************************************************** + * + * @section: + * font_testing_macros + * + */ + + /************************************************************************** + * + * @macro: + * FT_HAS_GLYPH_NAMES + * + * @description: + * A macro that returns true whenever a face object contains some glyph + * names that can be accessed through @FT_Get_Glyph_Name. + * + */ +#define FT_HAS_GLYPH_NAMES( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_MULTIPLE_MASTERS + * + * @description: + * A macro that returns true whenever a face object contains some + * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H + * are then available to choose the exact design you want. + * + */ +#define FT_HAS_MULTIPLE_MASTERS( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_NAMED_INSTANCE + * + * @description: + * A macro that returns true whenever a face object is a named instance + * of a TrueType GX or OpenType Font Variations. + * + * [Since 2.9] Changing the design coordinates with + * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does + * not influence the return value of this macro (only + * @FT_Set_Named_Instance does that). + * + * @since: + * 2.7 + * + */ +#define FT_IS_NAMED_INSTANCE( face ) \ + ( !!( (face)->face_index & 0x7FFF0000L ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_VARIATION + * + * @description: + * A macro that returns true whenever a face object has been altered by + * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, + * @FT_Set_Var_Blend_Coordinates, or @FT_Set_MM_WeightVector. + * + * @since: + * 2.9 + * + */ +#define FT_IS_VARIATION( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_CID_KEYED + * + * @description: + * A macro that returns true whenever a face object contains a CID-keyed + * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details. + * + * If this macro is true, all functions defined in @FT_CID_H are + * available. + * + */ +#define FT_IS_CID_KEYED( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) ) + + + /************************************************************************** + * + * @macro: + * FT_IS_TRICKY + * + * @description: + * A macro that returns true whenever a face represents a 'tricky' font. + * See the discussion of @FT_FACE_FLAG_TRICKY for more details. + * + */ +#define FT_IS_TRICKY( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_COLOR + * + * @description: + * A macro that returns true whenever a face object contains tables for + * color glyphs. + * + * @since: + * 2.5.1 + * + */ +#define FT_HAS_COLOR( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_SVG + * + * @description: + * A macro that returns true whenever a face object contains an 'SVG~' + * OpenType table. + * + * @since: + * 2.12 + */ +#define FT_HAS_SVG( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_SBIX + * + * @description: + * A macro that returns true whenever a face object contains an 'sbix' + * OpenType table *and* outline glyphs. + * + * Currently, FreeType only supports bitmap glyphs in PNG format for this + * table (i.e., JPEG and TIFF formats are unsupported, as are + * Apple-specific formats not part of the OpenType specification). + * + * @note: + * For backward compatibility, a font with an 'sbix' table is treated as + * a bitmap-only face. Using @FT_Open_Face with + * @FT_PARAM_TAG_IGNORE_SBIX, an application can switch off 'sbix' + * handling so that the face is treated as an ordinary outline font with + * scalable outlines. + * + * Here is some pseudo code that roughly illustrates how to implement + * 'sbix' handling according to the OpenType specification. + * + * ``` + * if ( FT_HAS_SBIX( face ) ) + * { + * // open font as a scalable one without sbix handling + * FT_Face face2; + * FT_Parameter param = { FT_PARAM_TAG_IGNORE_SBIX, NULL }; + * FT_Open_Args args = { FT_OPEN_PARAMS | ..., + * ..., + * 1, ¶m }; + * + * + * FT_Open_Face( library, &args, 0, &face2 ); + * + * available_size` as necessary into + * `preferred_sizes`[*]> + * + * for ( i = 0; i < face->num_fixed_sizes; i++ ) + * { + * size = preferred_sizes[i].size; + * + * error = FT_Set_Pixel_Sizes( face, size, size ); + * + * + * // check whether we have a glyph in a bitmap strike + * error = FT_Load_Glyph( face, + * glyph_index, + * FT_LOAD_SBITS_ONLY | + * FT_LOAD_BITMAP_METRICS_ONLY ); + * if ( error == FT_Err_Invalid_Argument ) + * continue; + * else if ( error ) + * + * else + * break; + * } + * + * if ( i != face->num_fixed_sizes ) + * + * + * if ( i == face->num_fixed_sizes || + * FT_HAS_SBIX_OVERLAY( face ) ) + * + * } + * ``` + * + * [*] Assuming a target value of 400dpi and available strike sizes 100, + * 200, 300, and 400dpi, a possible order might be [400, 200, 300, 100]: + * scaling 200dpi to 400dpi usually gives better results than scaling + * 300dpi to 400dpi; it is also much faster. However, scaling 100dpi to + * 400dpi can yield a too pixelated result, thus the preference might be + * 300dpi over 100dpi. + * + * @since: + * 2.12 + */ +#define FT_HAS_SBIX( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX ) ) + + + /************************************************************************** + * + * @macro: + * FT_HAS_SBIX_OVERLAY + * + * @description: + * A macro that returns true whenever a face object contains an 'sbix' + * OpenType table with bit~1 in its `flags` field set, instructing the + * application to overlay the bitmap strike with the corresponding + * outline glyph. See @FT_HAS_SBIX for pseudo code how to use it. + * + * @since: + * 2.12 + */ +#define FT_HAS_SBIX_OVERLAY( face ) \ + ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OVERLAY ) ) + + + /************************************************************************** + * + * @section: + * face_creation + * + */ + + /************************************************************************** + * + * @enum: + * FT_STYLE_FLAG_XXX + * + * @description: + * A list of bit flags to indicate the style of a given face. These are + * used in the `style_flags` field of @FT_FaceRec. + * + * @values: + * FT_STYLE_FLAG_ITALIC :: + * The face style is italic or oblique. + * + * FT_STYLE_FLAG_BOLD :: + * The face is bold. + * + * @note: + * The style information as provided by FreeType is very basic. More + * details are beyond the scope and should be done on a higher level (for + * example, by analyzing various fields of the 'OS/2' table in SFNT based + * fonts). + */ +#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) +#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) + + + /************************************************************************** + * + * @section: + * other_api_data + * + */ + + /************************************************************************** + * + * @type: + * FT_Size_Internal + * + * @description: + * An opaque handle to an `FT_Size_InternalRec` structure, used to model + * private data of a given @FT_Size object. + */ + typedef struct FT_Size_InternalRec_* FT_Size_Internal; + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + + /************************************************************************** + * + * @struct: + * FT_Size_Metrics + * + * @description: + * The size metrics structure gives the metrics of a size object. + * + * @fields: + * x_ppem :: + * The width of the scaled EM square in pixels, hence the term 'ppem' + * (pixels per EM). It is also referred to as 'nominal width'. + * + * y_ppem :: + * The height of the scaled EM square in pixels, hence the term 'ppem' + * (pixels per EM). It is also referred to as 'nominal height'. + * + * x_scale :: + * A 16.16 fractional scaling value to convert horizontal metrics from + * font units to 26.6 fractional pixels. Only relevant for scalable + * font formats. + * + * y_scale :: + * A 16.16 fractional scaling value to convert vertical metrics from + * font units to 26.6 fractional pixels. Only relevant for scalable + * font formats. + * + * ascender :: + * The ascender in 26.6 fractional pixels, rounded up to an integer + * value. See @FT_FaceRec for the details. + * + * descender :: + * The descender in 26.6 fractional pixels, rounded down to an integer + * value. See @FT_FaceRec for the details. + * + * height :: + * The height in 26.6 fractional pixels, rounded to an integer value. + * See @FT_FaceRec for the details. + * + * max_advance :: + * The maximum advance width in 26.6 fractional pixels, rounded to an + * integer value. See @FT_FaceRec for the details. + * + * @note: + * The scaling values, if relevant, are determined first during a size + * changing operation. The remaining fields are then set by the driver. + * For scalable formats, they are usually set to scaled values of the + * corresponding fields in @FT_FaceRec. Some values like ascender or + * descender are rounded for historical reasons; more precise values (for + * outline fonts) can be derived by scaling the corresponding @FT_FaceRec + * values manually, with code similar to the following. + * + * ``` + * scaled_ascender = FT_MulFix( face->ascender, + * size_metrics->y_scale ); + * ``` + * + * Note that due to glyph hinting and the selected rendering mode these + * values are usually not exact; consequently, they must be treated as + * unreliable with an error margin of at least one pixel! + * + * Indeed, the only way to get the exact metrics is to render _all_ + * glyphs. As this would be a definite performance hit, it is up to + * client applications to perform such computations. + * + * The `FT_Size_Metrics` structure is valid for bitmap fonts also. + * + * + * **TrueType fonts with native bytecode hinting** + * + * All applications that handle TrueType fonts with native hinting must + * be aware that TTFs expect different rounding of vertical font + * dimensions. The application has to cater for this, especially if it + * wants to rely on a TTF's vertical data (for example, to properly align + * box characters vertically). + * + * Only the application knows _in advance_ that it is going to use native + * hinting for TTFs! FreeType, on the other hand, selects the hinting + * mode not at the time of creating an @FT_Size object but much later, + * namely while calling @FT_Load_Glyph. + * + * Here is some pseudo code that illustrates a possible solution. + * + * ``` + * font_format = FT_Get_Font_Format( face ); + * + * if ( !strcmp( font_format, "TrueType" ) && + * do_native_bytecode_hinting ) + * { + * ascender = ROUND( FT_MulFix( face->ascender, + * size_metrics->y_scale ) ); + * descender = ROUND( FT_MulFix( face->descender, + * size_metrics->y_scale ) ); + * } + * else + * { + * ascender = size_metrics->ascender; + * descender = size_metrics->descender; + * } + * + * height = size_metrics->height; + * max_advance = size_metrics->max_advance; + * ``` + */ + typedef struct FT_Size_Metrics_ + { + FT_UShort x_ppem; /* horizontal pixels per EM */ + FT_UShort y_ppem; /* vertical pixels per EM */ + + FT_Fixed x_scale; /* scaling values used to convert font */ + FT_Fixed y_scale; /* units to 26.6 fractional pixels */ + + FT_Pos ascender; /* ascender in 26.6 frac. pixels */ + FT_Pos descender; /* descender in 26.6 frac. pixels */ + FT_Pos height; /* text height in 26.6 frac. pixels */ + FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ + + } FT_Size_Metrics; + + + /************************************************************************** + * + * @struct: + * FT_SizeRec + * + * @description: + * FreeType root size class structure. A size object models a face + * object at a given size. + * + * @fields: + * face :: + * Handle to the parent face object. + * + * generic :: + * A typeless pointer, unused by the FreeType library or any of its + * drivers. It can be used by client applications to link their own + * data to each size object. + * + * metrics :: + * Metrics for this size object. This field is read-only. + */ + typedef struct FT_SizeRec_ + { + FT_Face face; /* parent face object */ + FT_Generic generic; /* generic pointer for client uses */ + FT_Size_Metrics metrics; /* size metrics */ + FT_Size_Internal internal; + + } FT_SizeRec; + + + /************************************************************************** + * + * @section: + * other_api_data + * + */ + + /************************************************************************** + * + * @struct: + * FT_SubGlyph + * + * @description: + * The subglyph structure is an internal object used to describe + * subglyphs (for example, in the case of composites). + * + * @note: + * The subglyph implementation is not part of the high-level API, hence + * the forward structure declaration. + * + * You can however retrieve subglyph information with + * @FT_Get_SubGlyph_Info. + */ + typedef struct FT_SubGlyphRec_* FT_SubGlyph; + + + /************************************************************************** + * + * @type: + * FT_Slot_Internal + * + * @description: + * An opaque handle to an `FT_Slot_InternalRec` structure, used to model + * private data of a given @FT_GlyphSlot object. + */ + typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @struct: + * FT_GlyphSlotRec + * + * @description: + * FreeType root glyph slot class structure. A glyph slot is a container + * where individual glyphs can be loaded, be they in outline or bitmap + * format. + * + * @fields: + * library :: + * A handle to the FreeType library instance this slot belongs to. + * + * face :: + * A handle to the parent face object. + * + * next :: + * In some cases (like some font tools), several glyph slots per face + * object can be a good thing. As this is rare, the glyph slots are + * listed through a direct, single-linked list using its `next` field. + * + * glyph_index :: + * [Since 2.10] The glyph index passed as an argument to @FT_Load_Glyph + * while initializing the glyph slot. + * + * generic :: + * A typeless pointer unused by the FreeType library or any of its + * drivers. It can be used by client applications to link their own + * data to each glyph slot object. + * + * metrics :: + * The metrics of the last loaded glyph in the slot. The returned + * values depend on the last load flags (see the @FT_Load_Glyph API + * function) and can be expressed either in 26.6 fractional pixels or + * font units. + * + * Note that even when the glyph image is transformed, the metrics are + * not. + * + * linearHoriAdvance :: + * The advance width of the unhinted glyph. Its value is expressed in + * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when + * loading the glyph. This field can be important to perform correct + * WYSIWYG layout. Only relevant for scalable glyphs. + * + * linearVertAdvance :: + * The advance height of the unhinted glyph. Its value is expressed in + * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when + * loading the glyph. This field can be important to perform correct + * WYSIWYG layout. Only relevant for scalable glyphs. + * + * advance :: + * This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the + * transformed (hinted) advance width for the glyph, in 26.6 fractional + * pixel format. As specified with @FT_LOAD_VERTICAL_LAYOUT, it uses + * either the `horiAdvance` or the `vertAdvance` value of `metrics` + * field. + * + * format :: + * This field indicates the format of the image contained in the glyph + * slot. Typically @FT_GLYPH_FORMAT_BITMAP, @FT_GLYPH_FORMAT_OUTLINE, + * or @FT_GLYPH_FORMAT_COMPOSITE, but other values are possible. + * + * bitmap :: + * This field is used as a bitmap descriptor. Note that the address + * and content of the bitmap buffer can change between calls of + * @FT_Load_Glyph and a few other functions. + * + * bitmap_left :: + * The bitmap's left bearing expressed in integer pixels. + * + * bitmap_top :: + * The bitmap's top bearing expressed in integer pixels. This is the + * distance from the baseline to the top-most glyph scanline, upwards + * y~coordinates being **positive**. + * + * outline :: + * The outline descriptor for the current glyph image if its format is + * @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is loaded, `outline` can be + * transformed, distorted, emboldened, etc. However, it must not be + * freed. + * + * [Since 2.10.1] If @FT_LOAD_NO_SCALE is set, outline coordinates of + * OpenType Font Variations for a selected instance are internally + * handled as 26.6 fractional font units but returned as (rounded) + * integers, as expected. To get unrounded font units, don't use + * @FT_LOAD_NO_SCALE but load the glyph with @FT_LOAD_NO_HINTING and + * scale it, using the font's `units_per_EM` value as the ppem. + * + * num_subglyphs :: + * The number of subglyphs in a composite glyph. This field is only + * valid for the composite glyph format that should normally only be + * loaded with the @FT_LOAD_NO_RECURSE flag. + * + * subglyphs :: + * An array of subglyph descriptors for composite glyphs. There are + * `num_subglyphs` elements in there. Currently internal to FreeType. + * + * control_data :: + * Certain font drivers can also return the control data for a given + * glyph image (e.g. TrueType bytecode, Type~1 charstrings, etc.). + * This field is a pointer to such data; it is currently internal to + * FreeType. + * + * control_len :: + * This is the length in bytes of the control data. Currently internal + * to FreeType. + * + * other :: + * Reserved. + * + * lsb_delta :: + * The difference between hinted and unhinted left side bearing while + * auto-hinting is active. Zero otherwise. + * + * rsb_delta :: + * The difference between hinted and unhinted right side bearing while + * auto-hinting is active. Zero otherwise. + * + * @note: + * If @FT_Load_Glyph is called with default flags (see @FT_LOAD_DEFAULT) + * the glyph image is loaded in the glyph slot in its native format + * (e.g., an outline glyph for TrueType and Type~1 formats). [Since 2.9] + * The prospective bitmap metrics are calculated according to + * @FT_LOAD_TARGET_XXX and other flags even for the outline glyph, even + * if @FT_LOAD_RENDER is not set. + * + * This image can later be converted into a bitmap by calling + * @FT_Render_Glyph. This function searches the current renderer for the + * native image's format, then invokes it. + * + * The renderer is in charge of transforming the native image through the + * slot's face transformation fields, then converting it into a bitmap + * that is returned in `slot->bitmap`. + * + * Note that `slot->bitmap_left` and `slot->bitmap_top` are also used to + * specify the position of the bitmap relative to the current pen + * position (e.g., coordinates (0,0) on the baseline). Of course, + * `slot->format` is also changed to @FT_GLYPH_FORMAT_BITMAP. + * + * Here is a small pseudo code fragment that shows how to use `lsb_delta` + * and `rsb_delta` to do fractional positioning of glyphs: + * + * ``` + * FT_GlyphSlot slot = face->glyph; + * FT_Pos origin_x = 0; + * + * + * for all glyphs do + * + * + * FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); + * + * + * + * + * + * origin_x += slot->advance.x; + * origin_x += slot->lsb_delta - slot->rsb_delta; + * endfor + * ``` + * + * Here is another small pseudo code fragment that shows how to use + * `lsb_delta` and `rsb_delta` to improve integer positioning of glyphs: + * + * ``` + * FT_GlyphSlot slot = face->glyph; + * FT_Pos origin_x = 0; + * FT_Pos prev_rsb_delta = 0; + * + * + * for all glyphs do + * + * + * + * + * if ( prev_rsb_delta - slot->lsb_delta > 32 ) + * origin_x -= 64; + * else if ( prev_rsb_delta - slot->lsb_delta < -31 ) + * origin_x += 64; + * + * prev_rsb_delta = slot->rsb_delta; + * + * + * + * origin_x += slot->advance.x; + * endfor + * ``` + * + * If you use strong auto-hinting, you **must** apply these delta values! + * Otherwise you will experience far too large inter-glyph spacing at + * small rendering sizes in most cases. Note that it doesn't harm to use + * the above code for other hinting modes also, since the delta values + * are zero then. + */ + typedef struct FT_GlyphSlotRec_ + { + FT_Library library; + FT_Face face; + FT_GlyphSlot next; + FT_UInt glyph_index; /* new in 2.10; was reserved previously */ + FT_Generic generic; + + FT_Glyph_Metrics metrics; + FT_Fixed linearHoriAdvance; + FT_Fixed linearVertAdvance; + FT_Vector advance; + + FT_Glyph_Format format; + + FT_Bitmap bitmap; + FT_Int bitmap_left; + FT_Int bitmap_top; + + FT_Outline outline; + + FT_UInt num_subglyphs; + FT_SubGlyph subglyphs; + + void* control_data; + long control_len; + + FT_Pos lsb_delta; + FT_Pos rsb_delta; + + void* other; + + FT_Slot_Internal internal; + + } FT_GlyphSlotRec; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* F U N C T I O N S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @section: + * library_setup + * + */ + + /************************************************************************** + * + * @function: + * FT_Init_FreeType + * + * @description: + * Initialize a new FreeType library object. The set of modules that are + * registered by this function is determined at build time. + * + * @output: + * alibrary :: + * A handle to a new library object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * In case you want to provide your own memory allocating routines, use + * @FT_New_Library instead, followed by a call to @FT_Add_Default_Modules + * (or a series of calls to @FT_Add_Module) and + * @FT_Set_Default_Properties. + * + * See the documentation of @FT_Library and @FT_Face for multi-threading + * issues. + * + * If you need reference-counting (cf. @FT_Reference_Library), use + * @FT_New_Library and @FT_Done_Library. + * + * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is + * set, this function reads the `FREETYPE_PROPERTIES` environment + * variable to control driver properties. See section @properties for + * more. + */ + FT_EXPORT( FT_Error ) + FT_Init_FreeType( FT_Library *alibrary ); + + + /************************************************************************** + * + * @function: + * FT_Done_FreeType + * + * @description: + * Destroy a given FreeType library object and all of its children, + * including resources, drivers, faces, sizes, etc. + * + * @input: + * library :: + * A handle to the target library object. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Done_FreeType( FT_Library library ); + + + /************************************************************************** + * + * @section: + * face_creation + * + */ + + /************************************************************************** + * + * @enum: + * FT_OPEN_XXX + * + * @description: + * A list of bit field constants used within the `flags` field of the + * @FT_Open_Args structure. + * + * @values: + * FT_OPEN_MEMORY :: + * This is a memory-based stream. + * + * FT_OPEN_STREAM :: + * Copy the stream from the `stream` field. + * + * FT_OPEN_PATHNAME :: + * Create a new input stream from a C~path name. + * + * FT_OPEN_DRIVER :: + * Use the `driver` field. + * + * FT_OPEN_PARAMS :: + * Use the `num_params` and `params` fields. + * + * @note: + * The `FT_OPEN_MEMORY`, `FT_OPEN_STREAM`, and `FT_OPEN_PATHNAME` flags + * are mutually exclusive. + */ +#define FT_OPEN_MEMORY 0x1 +#define FT_OPEN_STREAM 0x2 +#define FT_OPEN_PATHNAME 0x4 +#define FT_OPEN_DRIVER 0x8 +#define FT_OPEN_PARAMS 0x10 + + + /* these constants are deprecated; use the corresponding `FT_OPEN_XXX` */ + /* values instead */ +#define ft_open_memory FT_OPEN_MEMORY +#define ft_open_stream FT_OPEN_STREAM +#define ft_open_pathname FT_OPEN_PATHNAME +#define ft_open_driver FT_OPEN_DRIVER +#define ft_open_params FT_OPEN_PARAMS + + + /************************************************************************** + * + * @struct: + * FT_Parameter + * + * @description: + * A simple structure to pass more or less generic parameters to + * @FT_Open_Face and @FT_Face_Properties. + * + * @fields: + * tag :: + * A four-byte identification tag. + * + * data :: + * A pointer to the parameter data. + * + * @note: + * The ID and function of parameters are driver-specific. See section + * @parameter_tags for more information. + */ + typedef struct FT_Parameter_ + { + FT_ULong tag; + FT_Pointer data; + + } FT_Parameter; + + + /************************************************************************** + * + * @struct: + * FT_Open_Args + * + * @description: + * A structure to indicate how to open a new font file or stream. A + * pointer to such a structure can be used as a parameter for the + * functions @FT_Open_Face and @FT_Attach_Stream. + * + * @fields: + * flags :: + * A set of bit flags indicating how to use the structure. + * + * memory_base :: + * The first byte of the file in memory. + * + * memory_size :: + * The size in bytes of the file in memory. + * + * pathname :: + * A pointer to an 8-bit file pathname, which must be a C~string (i.e., + * no null bytes except at the very end). The pointer is not owned by + * FreeType. + * + * stream :: + * A handle to a source stream object. + * + * driver :: + * This field is exclusively used by @FT_Open_Face; it simply specifies + * the font driver to use for opening the face. If set to `NULL`, + * FreeType tries to load the face with each one of the drivers in its + * list. + * + * num_params :: + * The number of extra parameters. + * + * params :: + * Extra parameters passed to the font driver when opening a new face. + * + * @note: + * The stream type is determined by the contents of `flags`: + * + * If the @FT_OPEN_MEMORY bit is set, assume that this is a memory file + * of `memory_size` bytes, located at `memory_address`. The data are not + * copied, and the client is responsible for releasing and destroying + * them _after_ the corresponding call to @FT_Done_Face. + * + * Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a custom + * input stream `stream` is used. + * + * Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this is a + * normal file and use `pathname` to open it. + * + * If none of the above bits are set or if multiple are set at the same + * time, the flags are invalid and @FT_Open_Face fails. + * + * If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to open + * the file with the driver whose handler is in `driver`. + * + * If the @FT_OPEN_PARAMS bit is set, the parameters given by + * `num_params` and `params` is used. They are ignored otherwise. + * + * Ideally, both the `pathname` and `params` fields should be tagged as + * 'const'; this is missing for API backward compatibility. In other + * words, applications should treat them as read-only. + */ + typedef struct FT_Open_Args_ + { + FT_UInt flags; + const FT_Byte* memory_base; + FT_Long memory_size; + FT_String* pathname; + FT_Stream stream; + FT_Module driver; + FT_Int num_params; + FT_Parameter* params; + + } FT_Open_Args; + + + /************************************************************************** + * + * @function: + * FT_New_Face + * + * @description: + * Call @FT_Open_Face to open a font by its pathname. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * pathname :: + * A path to the font file. + * + * face_index :: + * See @FT_Open_Face for a detailed description of this parameter. + * + * @output: + * aface :: + * A handle to a new face object. If `face_index` is greater than or + * equal to zero, it must be non-`NULL`. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The `pathname` string should be recognizable as such by a standard + * `fopen` call on your system; in particular, this means that `pathname` + * must not contain null bytes. If that is not sufficient to address all + * file name possibilities (for example, to handle wide character file + * names on Windows in UTF-16 encoding) you might use @FT_Open_Face to + * pass a memory array or a stream object instead. + * + * Use @FT_Done_Face to destroy the created @FT_Face object (along with + * its slot and sizes). + */ + FT_EXPORT( FT_Error ) + FT_New_Face( FT_Library library, + const char* filepathname, + FT_Long face_index, + FT_Face *aface ); + + + /************************************************************************** + * + * @function: + * FT_New_Memory_Face + * + * @description: + * Call @FT_Open_Face to open a font that has been loaded into memory. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * file_base :: + * A pointer to the beginning of the font data. + * + * file_size :: + * The size of the memory chunk used by the font data. + * + * face_index :: + * See @FT_Open_Face for a detailed description of this parameter. + * + * @output: + * aface :: + * A handle to a new face object. If `face_index` is greater than or + * equal to zero, it must be non-`NULL`. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You must not deallocate the memory before calling @FT_Done_Face. + */ + FT_EXPORT( FT_Error ) + FT_New_Memory_Face( FT_Library library, + const FT_Byte* file_base, + FT_Long file_size, + FT_Long face_index, + FT_Face *aface ); + + + /************************************************************************** + * + * @function: + * FT_Open_Face + * + * @description: + * Create a face object from a given resource described by @FT_Open_Args. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * args :: + * A pointer to an `FT_Open_Args` structure that must be filled by the + * caller. + * + * face_index :: + * This field holds two different values. Bits 0-15 are the index of + * the face in the font file (starting with value~0). Set it to~0 if + * there is only one face in the font file. + * + * [Since 2.6.1] Bits 16-30 are relevant to TrueType GX and OpenType + * Font Variations only, specifying the named instance index for the + * current face index (starting with value~1; value~0 makes FreeType + * ignore named instances). For non-variation fonts, bits 16-30 are + * ignored. Assuming that you want to access the third named instance + * in face~4, `face_index` should be set to 0x00030004. If you want + * to access face~4 without variation handling, simply set + * `face_index` to value~4. + * + * `FT_Open_Face` and its siblings can be used to quickly check whether + * the font format of a given font resource is supported by FreeType. + * In general, if the `face_index` argument is negative, the function's + * return value is~0 if the font format is recognized, or non-zero + * otherwise. The function allocates a more or less empty face handle + * in `*aface` (if `aface` isn't `NULL`); the only two useful fields in + * this special case are `face->num_faces` and `face->style_flags`. + * For any negative value of `face_index`, `face->num_faces` gives the + * number of faces within the font file. For the negative value + * '-(N+1)' (with 'N' a non-negative 16-bit value), bits 16-30 in + * `face->style_flags` give the number of named instances in face 'N' + * if we have a variation font (or zero otherwise). After examination, + * the returned @FT_Face structure should be deallocated with a call to + * @FT_Done_Face. + * + * @output: + * aface :: + * A handle to a new face object. If `face_index` is greater than or + * equal to zero, it must be non-`NULL`. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Unlike FreeType 1.x, this function automatically creates a glyph slot + * for the face object that can be accessed directly through + * `face->glyph`. + * + * Each new face object created with this function also owns a default + * @FT_Size object, accessible as `face->size`. + * + * One @FT_Library instance can have multiple face objects, that is, + * @FT_Open_Face and its siblings can be called multiple times using the + * same `library` argument. + * + * See the discussion of reference counters in the description of + * @FT_Reference_Face. + * + * If `FT_OPEN_STREAM` is set in `args->flags`, the stream in + * `args->stream` is automatically closed before this function returns + * any error (including `FT_Err_Invalid_Argument`). + * + * @example: + * To loop over all faces, use code similar to the following snippet + * (omitting the error handling). + * + * ``` + * ... + * FT_Face face; + * FT_Long i, num_faces; + * + * + * error = FT_Open_Face( library, args, -1, &face ); + * if ( error ) { ... } + * + * num_faces = face->num_faces; + * FT_Done_Face( face ); + * + * for ( i = 0; i < num_faces; i++ ) + * { + * ... + * error = FT_Open_Face( library, args, i, &face ); + * ... + * FT_Done_Face( face ); + * ... + * } + * ``` + * + * To loop over all valid values for `face_index`, use something similar + * to the following snippet, again without error handling. The code + * accesses all faces immediately (thus only a single call of + * `FT_Open_Face` within the do-loop), with and without named instances. + * + * ``` + * ... + * FT_Face face; + * + * FT_Long num_faces = 0; + * FT_Long num_instances = 0; + * + * FT_Long face_idx = 0; + * FT_Long instance_idx = 0; + * + * + * do + * { + * FT_Long id = ( instance_idx << 16 ) + face_idx; + * + * + * error = FT_Open_Face( library, args, id, &face ); + * if ( error ) { ... } + * + * num_faces = face->num_faces; + * num_instances = face->style_flags >> 16; + * + * ... + * + * FT_Done_Face( face ); + * + * if ( instance_idx < num_instances ) + * instance_idx++; + * else + * { + * face_idx++; + * instance_idx = 0; + * } + * + * } while ( face_idx < num_faces ) + * ``` + */ + FT_EXPORT( FT_Error ) + FT_Open_Face( FT_Library library, + const FT_Open_Args* args, + FT_Long face_index, + FT_Face *aface ); + + + /************************************************************************** + * + * @function: + * FT_Attach_File + * + * @description: + * Call @FT_Attach_Stream to attach a file. + * + * @inout: + * face :: + * The target face object. + * + * @input: + * filepathname :: + * The pathname. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Attach_File( FT_Face face, + const char* filepathname ); + + + /************************************************************************** + * + * @function: + * FT_Attach_Stream + * + * @description: + * 'Attach' data to a face object. Normally, this is used to read + * additional information for the face object. For example, you can + * attach an AFM file that comes with a Type~1 font to get the kerning + * values and other metrics. + * + * @inout: + * face :: + * The target face object. + * + * @input: + * parameters :: + * A pointer to @FT_Open_Args that must be filled by the caller. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The meaning of the 'attach' (i.e., what really happens when the new + * file is read) is not fixed by FreeType itself. It really depends on + * the font format (and thus the font driver). + * + * Client applications are expected to know what they are doing when + * invoking this function. Most drivers simply do not implement file or + * stream attachments. + */ + FT_EXPORT( FT_Error ) + FT_Attach_Stream( FT_Face face, + const FT_Open_Args* parameters ); + + + /************************************************************************** + * + * @function: + * FT_Reference_Face + * + * @description: + * A counter gets initialized to~1 at the time an @FT_Face structure is + * created. This function increments the counter. @FT_Done_Face then + * only destroys a face if the counter is~1, otherwise it simply + * decrements the counter. + * + * This function helps in managing life-cycles of structures that + * reference @FT_Face objects. + * + * @input: + * face :: + * A handle to a target face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @since: + * 2.4.2 + * + */ + FT_EXPORT( FT_Error ) + FT_Reference_Face( FT_Face face ); + + + /************************************************************************** + * + * @function: + * FT_Done_Face + * + * @description: + * Discard a given face object, as well as all of its child slots and + * sizes. + * + * @input: + * face :: + * A handle to a target face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * See the discussion of reference counters in the description of + * @FT_Reference_Face. + */ + FT_EXPORT( FT_Error ) + FT_Done_Face( FT_Face face ); + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + + /************************************************************************** + * + * @function: + * FT_Select_Size + * + * @description: + * Select a bitmap strike. To be more precise, this function sets the + * scaling factors of the active @FT_Size object in a face so that + * bitmaps from this particular strike are taken by @FT_Load_Glyph and + * friends. + * + * @inout: + * face :: + * A handle to a target face object. + * + * @input: + * strike_index :: + * The index of the bitmap strike in the `available_sizes` field of + * @FT_FaceRec structure. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * For bitmaps embedded in outline fonts it is common that only a subset + * of the available glyphs at a given ppem value is available. FreeType + * silently uses outlines if there is no bitmap for a given glyph index. + * + * For TrueType GX and OpenType Font Variations, a bitmap strike makes + * sense only if the default instance is active (that is, no glyph + * variation takes place); otherwise, FreeType simply ignores bitmap + * strikes. The same is true for all named instances that are different + * from the default instance. + * + * Don't use this function if you are using the FreeType cache API. + */ + FT_EXPORT( FT_Error ) + FT_Select_Size( FT_Face face, + FT_Int strike_index ); + + + /************************************************************************** + * + * @enum: + * FT_Size_Request_Type + * + * @description: + * An enumeration type that lists the supported size request types, i.e., + * what input size (in font units) maps to the requested output size (in + * pixels, as computed from the arguments of @FT_Size_Request). + * + * @values: + * FT_SIZE_REQUEST_TYPE_NOMINAL :: + * The nominal size. The `units_per_EM` field of @FT_FaceRec is used + * to determine both scaling values. + * + * This is the standard scaling found in most applications. In + * particular, use this size request type for TrueType fonts if they + * provide optical scaling or something similar. Note, however, that + * `units_per_EM` is a rather abstract value which bears no relation to + * the actual size of the glyphs in a font. + * + * FT_SIZE_REQUEST_TYPE_REAL_DIM :: + * The real dimension. The sum of the `ascender` and (minus of) the + * `descender` fields of @FT_FaceRec is used to determine both scaling + * values. + * + * FT_SIZE_REQUEST_TYPE_BBOX :: + * The font bounding box. The width and height of the `bbox` field of + * @FT_FaceRec are used to determine the horizontal and vertical + * scaling value, respectively. + * + * FT_SIZE_REQUEST_TYPE_CELL :: + * The `max_advance_width` field of @FT_FaceRec is used to determine + * the horizontal scaling value; the vertical scaling value is + * determined the same way as @FT_SIZE_REQUEST_TYPE_REAL_DIM does. + * Finally, both scaling values are set to the smaller one. This type + * is useful if you want to specify the font size for, say, a window of + * a given dimension and 80x24 cells. + * + * FT_SIZE_REQUEST_TYPE_SCALES :: + * Specify the scaling values directly. + * + * @note: + * The above descriptions only apply to scalable formats. For bitmap + * formats, the behaviour is up to the driver. + * + * See the note section of @FT_Size_Metrics if you wonder how size + * requesting relates to scaling values. + */ + typedef enum FT_Size_Request_Type_ + { + FT_SIZE_REQUEST_TYPE_NOMINAL, + FT_SIZE_REQUEST_TYPE_REAL_DIM, + FT_SIZE_REQUEST_TYPE_BBOX, + FT_SIZE_REQUEST_TYPE_CELL, + FT_SIZE_REQUEST_TYPE_SCALES, + + FT_SIZE_REQUEST_TYPE_MAX + + } FT_Size_Request_Type; + + + /************************************************************************** + * + * @struct: + * FT_Size_RequestRec + * + * @description: + * A structure to model a size request. + * + * @fields: + * type :: + * See @FT_Size_Request_Type. + * + * width :: + * The desired width, given as a 26.6 fractional point value (with 72pt + * = 1in). + * + * height :: + * The desired height, given as a 26.6 fractional point value (with + * 72pt = 1in). + * + * horiResolution :: + * The horizontal resolution (dpi, i.e., pixels per inch). If set to + * zero, `width` is treated as a 26.6 fractional **pixel** value, which + * gets internally rounded to an integer. + * + * vertResolution :: + * The vertical resolution (dpi, i.e., pixels per inch). If set to + * zero, `height` is treated as a 26.6 fractional **pixel** value, + * which gets internally rounded to an integer. + * + * @note: + * If `width` is zero, the horizontal scaling value is set equal to the + * vertical scaling value, and vice versa. + * + * If `type` is `FT_SIZE_REQUEST_TYPE_SCALES`, `width` and `height` are + * interpreted directly as 16.16 fractional scaling values, without any + * further modification, and both `horiResolution` and `vertResolution` + * are ignored. + */ + typedef struct FT_Size_RequestRec_ + { + FT_Size_Request_Type type; + FT_Long width; + FT_Long height; + FT_UInt horiResolution; + FT_UInt vertResolution; + + } FT_Size_RequestRec; + + + /************************************************************************** + * + * @struct: + * FT_Size_Request + * + * @description: + * A handle to a size request structure. + */ + typedef struct FT_Size_RequestRec_ *FT_Size_Request; + + + /************************************************************************** + * + * @function: + * FT_Request_Size + * + * @description: + * Resize the scale of the active @FT_Size object in a face. + * + * @inout: + * face :: + * A handle to a target face object. + * + * @input: + * req :: + * A pointer to a @FT_Size_RequestRec. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Although drivers may select the bitmap strike matching the request, + * you should not rely on this if you intend to select a particular + * bitmap strike. Use @FT_Select_Size instead in that case. + * + * The relation between the requested size and the resulting glyph size + * is dependent entirely on how the size is defined in the source face. + * The font designer chooses the final size of each glyph relative to + * this size. For more information refer to + * 'https://freetype.org/freetype2/docs/glyphs/glyphs-2.html'. + * + * Contrary to @FT_Set_Char_Size, this function doesn't have special code + * to normalize zero-valued widths, heights, or resolutions, which are + * treated as @FT_LOAD_NO_SCALE. + * + * Don't use this function if you are using the FreeType cache API. + */ + FT_EXPORT( FT_Error ) + FT_Request_Size( FT_Face face, + FT_Size_Request req ); + + + /************************************************************************** + * + * @function: + * FT_Set_Char_Size + * + * @description: + * Call @FT_Request_Size to request the nominal size (in points). + * + * @inout: + * face :: + * A handle to a target face object. + * + * @input: + * char_width :: + * The nominal width, in 26.6 fractional points. + * + * char_height :: + * The nominal height, in 26.6 fractional points. + * + * horz_resolution :: + * The horizontal resolution in dpi. + * + * vert_resolution :: + * The vertical resolution in dpi. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * While this function allows fractional points as input values, the + * resulting ppem value for the given resolution is always rounded to the + * nearest integer. + * + * If either the character width or height is zero, it is set equal to + * the other value. + * + * If either the horizontal or vertical resolution is zero, it is set + * equal to the other value. + * + * A character width or height smaller than 1pt is set to 1pt; if both + * resolution values are zero, they are set to 72dpi. + * + * Don't use this function if you are using the FreeType cache API. + */ + FT_EXPORT( FT_Error ) + FT_Set_Char_Size( FT_Face face, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); + + + /************************************************************************** + * + * @function: + * FT_Set_Pixel_Sizes + * + * @description: + * Call @FT_Request_Size to request the nominal size (in pixels). + * + * @inout: + * face :: + * A handle to the target face object. + * + * @input: + * pixel_width :: + * The nominal width, in pixels. + * + * pixel_height :: + * The nominal height, in pixels. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should not rely on the resulting glyphs matching or being + * constrained to this pixel size. Refer to @FT_Request_Size to + * understand how requested sizes relate to actual sizes. + * + * Don't use this function if you are using the FreeType cache API. + */ + FT_EXPORT( FT_Error ) + FT_Set_Pixel_Sizes( FT_Face face, + FT_UInt pixel_width, + FT_UInt pixel_height ); + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @function: + * FT_Load_Glyph + * + * @description: + * Load a glyph into the glyph slot of a face object. + * + * @inout: + * face :: + * A handle to the target face object where the glyph is loaded. + * + * @input: + * glyph_index :: + * The index of the glyph in the font file. For CID-keyed fonts + * (either in PS or in CFF format) this argument specifies the CID + * value. + * + * load_flags :: + * A flag indicating what to load for this glyph. The @FT_LOAD_XXX + * flags can be used to control the glyph loading process (e.g., + * whether the outline should be scaled, whether to load bitmaps or + * not, whether to hint the outline, etc). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * For proper scaling and hinting, the active @FT_Size object owned by + * the face has to be meaningfully initialized by calling + * @FT_Set_Char_Size before this function, for example. The loaded + * glyph may be transformed. See @FT_Set_Transform for the details. + * + * For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned + * for invalid CID values (that is, for CID values that don't have a + * corresponding glyph in the font). See the discussion of the + * @FT_FACE_FLAG_CID_KEYED flag for more details. + * + * If you receive `FT_Err_Glyph_Too_Big`, try getting the glyph outline + * at EM size, then scale it manually and fill it as a graphics + * operation. + */ + FT_EXPORT( FT_Error ) + FT_Load_Glyph( FT_Face face, + FT_UInt glyph_index, + FT_Int32 load_flags ); + + + /************************************************************************** + * + * @section: + * character_mapping + * + */ + + /************************************************************************** + * + * @function: + * FT_Load_Char + * + * @description: + * Load a glyph into the glyph slot of a face object, accessed by its + * character code. + * + * @inout: + * face :: + * A handle to a target face object where the glyph is loaded. + * + * @input: + * char_code :: + * The glyph's character code, according to the current charmap used in + * the face. + * + * load_flags :: + * A flag indicating what to load for this glyph. The @FT_LOAD_XXX + * constants can be used to control the glyph loading process (e.g., + * whether the outline should be scaled, whether to load bitmaps or + * not, whether to hint the outline, etc). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. + * + * Many fonts contain glyphs that can't be loaded by this function since + * its glyph indices are not listed in any of the font's charmaps. + * + * If no active cmap is set up (i.e., `face->charmap` is zero), the call + * to @FT_Get_Char_Index is omitted, and the function behaves identically + * to @FT_Load_Glyph. + */ + FT_EXPORT( FT_Error ) + FT_Load_Char( FT_Face face, + FT_ULong char_code, + FT_Int32 load_flags ); + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @enum: + * FT_LOAD_XXX + * + * @description: + * A list of bit field constants for @FT_Load_Glyph to indicate what kind + * of operations to perform during glyph loading. + * + * @values: + * FT_LOAD_DEFAULT :: + * Corresponding to~0, this value is used as the default glyph load + * operation. In this case, the following happens: + * + * 1. FreeType looks for a bitmap for the glyph corresponding to the + * face's current size. If one is found, the function returns. The + * bitmap data can be accessed from the glyph slot (see note below). + * + * 2. If no embedded bitmap is searched for or found, FreeType looks + * for a scalable outline. If one is found, it is loaded from the font + * file, scaled to device pixels, then 'hinted' to the pixel grid in + * order to optimize it. The outline data can be accessed from the + * glyph slot (see note below). + * + * Note that by default the glyph loader doesn't render outlines into + * bitmaps. The following flags are used to modify this default + * behaviour to more specific and useful cases. + * + * FT_LOAD_NO_SCALE :: + * Don't scale the loaded outline glyph but keep it in font units. + * This flag is also assumed if @FT_Size owned by the face was not + * properly initialized. + * + * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and + * unsets @FT_LOAD_RENDER. + * + * If the font is 'tricky' (see @FT_FACE_FLAG_TRICKY for more), using + * `FT_LOAD_NO_SCALE` usually yields meaningless outlines because the + * subglyphs must be scaled and positioned with hinting instructions. + * This can be solved by loading the font without `FT_LOAD_NO_SCALE` + * and setting the character size to `font->units_per_EM`. + * + * FT_LOAD_NO_HINTING :: + * Disable hinting. This generally generates 'blurrier' bitmap glyphs + * when the glyphs are rendered in any of the anti-aliased modes. See + * also the note below. + * + * This flag is implied by @FT_LOAD_NO_SCALE. + * + * FT_LOAD_RENDER :: + * Call @FT_Render_Glyph after the glyph is loaded. By default, the + * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be + * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. + * + * This flag is unset by @FT_LOAD_NO_SCALE. + * + * FT_LOAD_NO_BITMAP :: + * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this + * flag. + * + * @FT_LOAD_NO_SCALE always sets this flag. + * + * FT_LOAD_SBITS_ONLY :: + * [Since 2.12] This is the opposite of @FT_LOAD_NO_BITMAP, more or + * less: @FT_Load_Glyph returns `FT_Err_Invalid_Argument` if the face + * contains a bitmap strike for the given size (or the strike selected + * by @FT_Select_Size) but there is no glyph in the strike. + * + * Note that this load flag was part of FreeType since version 2.0.6 + * but previously tagged as internal. + * + * FT_LOAD_VERTICAL_LAYOUT :: + * Load the glyph for vertical text layout. In particular, the + * `advance` value in the @FT_GlyphSlotRec structure is set to the + * `vertAdvance` value of the `metrics` field. + * + * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use this + * flag currently. Reason is that in this case vertical metrics get + * synthesized, and those values are not always consistent across + * various font formats. + * + * FT_LOAD_FORCE_AUTOHINT :: + * Prefer the auto-hinter over the font's native hinter. See also the + * note below. + * + * FT_LOAD_PEDANTIC :: + * Make the font driver perform pedantic verifications during glyph + * loading and hinting. This is mostly used to detect broken glyphs in + * fonts. By default, FreeType tries to handle broken fonts also. + * + * In particular, errors from the TrueType bytecode engine are not + * passed to the application if this flag is not set; this might result + * in partially hinted or distorted glyphs in case a glyph's bytecode + * is buggy. + * + * FT_LOAD_NO_RECURSE :: + * Don't load composite glyphs recursively. Instead, the font driver + * fills the `num_subglyph` and `subglyphs` values of the glyph slot; + * it also sets `glyph->format` to @FT_GLYPH_FORMAT_COMPOSITE. The + * description of subglyphs can then be accessed with + * @FT_Get_SubGlyph_Info. + * + * Don't use this flag for retrieving metrics information since some + * font drivers only return rudimentary data. + * + * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. + * + * FT_LOAD_IGNORE_TRANSFORM :: + * Ignore the transform matrix set by @FT_Set_Transform. + * + * FT_LOAD_MONOCHROME :: + * This flag is used with @FT_LOAD_RENDER to indicate that you want to + * render an outline glyph to a 1-bit monochrome bitmap glyph, with + * 8~pixels packed into each byte of the bitmap data. + * + * Note that this has no effect on the hinting algorithm used. You + * should rather use @FT_LOAD_TARGET_MONO so that the + * monochrome-optimized hinting algorithm is used. + * + * FT_LOAD_LINEAR_DESIGN :: + * Keep `linearHoriAdvance` and `linearVertAdvance` fields of + * @FT_GlyphSlotRec in font units. See @FT_GlyphSlotRec for details. + * + * FT_LOAD_NO_AUTOHINT :: + * Disable the auto-hinter. See also the note below. + * + * FT_LOAD_COLOR :: + * Load colored glyphs. FreeType searches in the following order; + * there are slight differences depending on the font format. + * + * [Since 2.5] Load embedded color bitmap images (provided + * @FT_LOAD_NO_BITMAP is not set). The resulting color bitmaps, if + * available, have the @FT_PIXEL_MODE_BGRA format, with pre-multiplied + * color channels. If the flag is not set and color bitmaps are found, + * they are converted to 256-level gray bitmaps, using the + * @FT_PIXEL_MODE_GRAY format. + * + * [Since 2.12] If the glyph index maps to an entry in the face's + * 'SVG~' table, load the associated SVG document from this table and + * set the `format` field of @FT_GlyphSlotRec to @FT_GLYPH_FORMAT_SVG + * ([since 2.13.1] provided @FT_LOAD_NO_SVG is not set). Note that + * FreeType itself can't render SVG documents; however, the library + * provides hooks to seamlessly integrate an external renderer. See + * sections @ot_svg_driver and @svg_fonts for more. + * + * [Since 2.10, experimental] If the glyph index maps to an entry in + * the face's 'COLR' table with a 'CPAL' palette table (as defined in + * the OpenType specification), make @FT_Render_Glyph provide a default + * blending of the color glyph layers associated with the glyph index, + * using the same bitmap format as embedded color bitmap images. This + * is mainly for convenience and works only for glyphs in 'COLR' v0 + * tables. **There is no rendering support for 'COLR' v1** (with the + * exception of v1 tables that exclusively use v0 features)! You need + * a graphics library like Skia or Cairo to interpret the graphics + * commands stored in v1 tables. For full control of color layers use + * @FT_Get_Color_Glyph_Layer and FreeType's color functions like + * @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering + * so that the client application can handle blending by itself. + * + * FT_LOAD_NO_SVG :: + * [Since 2.13.1] Ignore SVG glyph data when loading. + * + * FT_LOAD_COMPUTE_METRICS :: + * [Since 2.6.1] Compute glyph metrics from the glyph data, without the + * use of bundled metrics tables (for example, the 'hdmx' table in + * TrueType fonts). This flag is mainly used by font validating or + * font editing applications, which need to ignore, verify, or edit + * those tables. + * + * Currently, this flag is only implemented for TrueType fonts. + * + * FT_LOAD_BITMAP_METRICS_ONLY :: + * [Since 2.7.1] Request loading of the metrics and bitmap image + * information of a (possibly embedded) bitmap glyph without allocating + * or copying the bitmap image data itself. No effect if the target + * glyph is not a bitmap image. + * + * This flag unsets @FT_LOAD_RENDER. + * + * FT_LOAD_CROP_BITMAP :: + * Ignored. Deprecated. + * + * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: + * Ignored. Deprecated. + * + * @note: + * By default, hinting is enabled and the font's native hinter (see + * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can + * disable hinting by setting @FT_LOAD_NO_HINTING or change the + * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set + * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be used + * at all. + * + * See the description of @FT_FACE_FLAG_TRICKY for a special exception + * (affecting only a handful of Asian fonts). + * + * Besides deciding which hinter to use, you can also decide which + * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. + * + * Note that the auto-hinter needs a valid Unicode cmap (either a native + * one or synthesized by FreeType) for producing correct results. If a + * font provides an incorrect mapping (for example, assigning the + * character code U+005A, LATIN CAPITAL LETTER~Z, to a glyph depicting a + * mathematical integral sign), the auto-hinter might produce useless + * results. + * + */ +#define FT_LOAD_DEFAULT 0x0 +#define FT_LOAD_NO_SCALE ( 1L << 0 ) +#define FT_LOAD_NO_HINTING ( 1L << 1 ) +#define FT_LOAD_RENDER ( 1L << 2 ) +#define FT_LOAD_NO_BITMAP ( 1L << 3 ) +#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) +#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) +#define FT_LOAD_CROP_BITMAP ( 1L << 6 ) +#define FT_LOAD_PEDANTIC ( 1L << 7 ) +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) +#define FT_LOAD_NO_RECURSE ( 1L << 10 ) +#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) +#define FT_LOAD_MONOCHROME ( 1L << 12 ) +#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) +#define FT_LOAD_SBITS_ONLY ( 1L << 14 ) +#define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) + /* Bits 16-19 are used by `FT_LOAD_TARGET_` */ +#define FT_LOAD_COLOR ( 1L << 20 ) +#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 ) +#define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 ) +#define FT_LOAD_NO_SVG ( 1L << 24 ) + + /* */ + + /* used internally only by certain font drivers */ +#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) +#define FT_LOAD_SVG_ONLY ( 1L << 23 ) + + + /************************************************************************** + * + * @enum: + * FT_LOAD_TARGET_XXX + * + * @description: + * A list of values to select a specific hinting algorithm for the + * hinter. You should OR one of these values to your `load_flags` when + * calling @FT_Load_Glyph. + * + * Note that a font's native hinters may ignore the hinting algorithm you + * have specified (e.g., the TrueType bytecode interpreter). You can set + * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. + * + * @values: + * FT_LOAD_TARGET_NORMAL :: + * The default hinting algorithm, optimized for standard gray-level + * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO instead. + * + * FT_LOAD_TARGET_LIGHT :: + * A lighter hinting algorithm for gray-level modes. Many generated + * glyphs are fuzzier but better resemble their original shape. This + * is achieved by snapping glyphs to the pixel grid only vertically + * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's + * ClearType font renderer. This preserves inter-glyph spacing in + * horizontal text. The snapping is done either by the native font + * driver, if the driver itself and the font support it, or by the + * auto-hinter. + * + * Advance widths are rounded to integer values; however, using the + * `lsb_delta` and `rsb_delta` fields of @FT_GlyphSlotRec, it is + * possible to get fractional advance widths for subpixel positioning + * (which is recommended to use). + * + * If configuration option `AF_CONFIG_OPTION_TT_SIZE_METRICS` is + * active, TrueType-like metrics are used to make this mode behave + * similarly as in unpatched FreeType versions between 2.4.6 and 2.7.1 + * (inclusive). + * + * FT_LOAD_TARGET_MONO :: + * Strong hinting algorithm that should only be used for monochrome + * output. The result is probably unpleasant if the glyph is rendered + * in non-monochrome modes. + * + * Note that for outline fonts only the TrueType font driver has proper + * monochrome hinting support, provided the TTFs contain hints for B/W + * rendering (which most fonts no longer provide). If these conditions + * are not met it is very likely that you get ugly results at smaller + * sizes. + * + * FT_LOAD_TARGET_LCD :: + * A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally + * decimated LCD displays. + * + * FT_LOAD_TARGET_LCD_V :: + * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically + * decimated LCD displays. + * + * @note: + * You should use only _one_ of the `FT_LOAD_TARGET_XXX` values in your + * `load_flags`. They can't be ORed. + * + * If @FT_LOAD_RENDER is also set, the glyph is rendered in the + * corresponding mode (i.e., the mode that matches the used algorithm + * best). An exception is `FT_LOAD_TARGET_MONO` since it implies + * @FT_LOAD_MONOCHROME. + * + * You can use a hinting algorithm that doesn't correspond to the same + * rendering mode. As an example, it is possible to use the 'light' + * hinting algorithm and have the results rendered in horizontal LCD + * pixel mode, with code like + * + * ``` + * FT_Load_Glyph( face, glyph_index, + * load_flags | FT_LOAD_TARGET_LIGHT ); + * + * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); + * ``` + * + * In general, you should stick with one rendering mode. For example, + * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO + * enforces a lot of recomputation for TrueType fonts, which is slow. + * Another reason is caching: Selecting a different mode usually causes + * changes in both the outlines and the rasterized bitmaps; it is thus + * necessary to empty the cache after a mode switch to avoid false hits. + * + */ +#define FT_LOAD_TARGET_( x ) ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 ) + +#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) +#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) +#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) +#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) +#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) + + + /************************************************************************** + * + * @macro: + * FT_LOAD_TARGET_MODE + * + * @description: + * Return the @FT_Render_Mode corresponding to a given + * @FT_LOAD_TARGET_XXX value. + * + */ +#define FT_LOAD_TARGET_MODE( x ) \ + FT_STATIC_CAST( FT_Render_Mode, ( (x) >> 16 ) & 15 ) + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + + /************************************************************************** + * + * @function: + * FT_Set_Transform + * + * @description: + * Set the transformation that is applied to glyph images when they are + * loaded into a glyph slot through @FT_Load_Glyph. + * + * @inout: + * face :: + * A handle to the source face object. + * + * @input: + * matrix :: + * A pointer to the transformation's 2x2 matrix. Use `NULL` for the + * identity matrix. + * delta :: + * A pointer to the translation vector. Use `NULL` for the null + * vector. + * + * @note: + * This function is provided as a convenience, but keep in mind that + * @FT_Matrix coefficients are only 16.16 fixed-point values, which can + * limit the accuracy of the results. Using floating-point computations + * to perform the transform directly in client code instead will always + * yield better numbers. + * + * The transformation is only applied to scalable image formats after the + * glyph has been loaded. It means that hinting is unaltered by the + * transformation and is performed on the character size given in the + * last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. + * + * Note that this also transforms the `face.glyph.advance` field, but + * **not** the values in `face.glyph.metrics`. + */ + FT_EXPORT( void ) + FT_Set_Transform( FT_Face face, + FT_Matrix* matrix, + FT_Vector* delta ); + + + /************************************************************************** + * + * @function: + * FT_Get_Transform + * + * @description: + * Return the transformation that is applied to glyph images when they + * are loaded into a glyph slot through @FT_Load_Glyph. See + * @FT_Set_Transform for more details. + * + * @input: + * face :: + * A handle to the source face object. + * + * @output: + * matrix :: + * A pointer to a transformation's 2x2 matrix. Set this to NULL if you + * are not interested in the value. + * + * delta :: + * A pointer to a translation vector. Set this to NULL if you are not + * interested in the value. + * + * @since: + * 2.11 + * + */ + FT_EXPORT( void ) + FT_Get_Transform( FT_Face face, + FT_Matrix* matrix, + FT_Vector* delta ); + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + + /************************************************************************** + * + * @enum: + * FT_Render_Mode + * + * @description: + * Render modes supported by FreeType~2. Each mode corresponds to a + * specific type of scanline conversion performed on the outline. + * + * For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode` field + * in the @FT_GlyphSlotRec structure gives the format of the returned + * bitmap. + * + * All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, + * indicating pixel coverage. Use linear alpha blending and gamma + * correction to correctly render non-monochrome glyph bitmaps onto a + * surface; see @FT_Render_Glyph. + * + * The @FT_RENDER_MODE_SDF is a special render mode that uses up to 256 + * distance values, indicating the signed distance from the grid position + * to the nearest outline. + * + * @values: + * FT_RENDER_MODE_NORMAL :: + * Default render mode; it corresponds to 8-bit anti-aliased bitmaps. + * + * FT_RENDER_MODE_LIGHT :: + * This is equivalent to @FT_RENDER_MODE_NORMAL. It is only defined as + * a separate value because render modes are also used indirectly to + * define hinting algorithm selectors. See @FT_LOAD_TARGET_XXX for + * details. + * + * FT_RENDER_MODE_MONO :: + * This mode corresponds to 1-bit bitmaps (with 2~levels of opacity). + * + * FT_RENDER_MODE_LCD :: + * This mode corresponds to horizontal RGB and BGR subpixel displays + * like LCD screens. It produces 8-bit bitmaps that are 3~times the + * width of the original glyph outline in pixels, and which use the + * @FT_PIXEL_MODE_LCD mode. + * + * FT_RENDER_MODE_LCD_V :: + * This mode corresponds to vertical RGB and BGR subpixel displays + * (like PDA screens, rotated LCD displays, etc.). It produces 8-bit + * bitmaps that are 3~times the height of the original glyph outline in + * pixels and use the @FT_PIXEL_MODE_LCD_V mode. + * + * FT_RENDER_MODE_SDF :: + * The positive (unsigned) 8-bit bitmap values can be converted to the + * single-channel signed distance field (SDF) by subtracting 128, with + * the positive and negative results corresponding to the inside and + * the outside of a glyph contour, respectively. The distance units are + * arbitrarily determined by an adjustable @spread property. + * + * @note: + * The selected render mode only affects scalable vector glyphs of a font. + * Embedded bitmaps often have a different pixel mode like + * @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform them + * into 8-bit pixmaps. + * + */ + typedef enum FT_Render_Mode_ + { + FT_RENDER_MODE_NORMAL = 0, + FT_RENDER_MODE_LIGHT, + FT_RENDER_MODE_MONO, + FT_RENDER_MODE_LCD, + FT_RENDER_MODE_LCD_V, + FT_RENDER_MODE_SDF, + + FT_RENDER_MODE_MAX + + } FT_Render_Mode; + + + /* these constants are deprecated; use the corresponding */ + /* `FT_Render_Mode` values instead */ +#define ft_render_mode_normal FT_RENDER_MODE_NORMAL +#define ft_render_mode_mono FT_RENDER_MODE_MONO + + + /************************************************************************** + * + * @function: + * FT_Render_Glyph + * + * @description: + * Convert a given glyph image to a bitmap. It does so by inspecting the + * glyph image format, finding the relevant renderer, and invoking it. + * + * @inout: + * slot :: + * A handle to the glyph slot containing the image to convert. + * + * @input: + * render_mode :: + * The render mode used to render the glyph image into a bitmap. See + * @FT_Render_Mode for a list of possible values. + * + * If @FT_RENDER_MODE_NORMAL is used, a previous call of @FT_Load_Glyph + * with flag @FT_LOAD_COLOR makes `FT_Render_Glyph` provide a default + * blending of colored glyph layers associated with the current glyph + * slot (provided the font contains such layers) instead of rendering + * the glyph slot's outline. This is an experimental feature; see + * @FT_LOAD_COLOR for more information. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * When FreeType outputs a bitmap of a glyph, it really outputs an alpha + * coverage map. If a pixel is completely covered by a filled-in + * outline, the bitmap contains 0xFF at that pixel, meaning that + * 0xFF/0xFF fraction of that pixel is covered, meaning the pixel is 100% + * black (or 0% bright). If a pixel is only 50% covered (value 0x80), + * the pixel is made 50% black (50% bright or a middle shade of grey). + * 0% covered means 0% black (100% bright or white). + * + * On high-DPI screens like on smartphones and tablets, the pixels are so + * small that their chance of being completely covered and therefore + * completely black are fairly good. On the low-DPI screens, however, + * the situation is different. The pixels are too large for most of the + * details of a glyph and shades of gray are the norm rather than the + * exception. + * + * This is relevant because all our screens have a second problem: they + * are not linear. 1~+~1 is not~2. Twice the value does not result in + * twice the brightness. When a pixel is only 50% covered, the coverage + * map says 50% black, and this translates to a pixel value of 128 when + * you use 8~bits per channel (0-255). However, this does not translate + * to 50% brightness for that pixel on our sRGB and gamma~2.2 screens. + * Due to their non-linearity, they dwell longer in the darks and only a + * pixel value of about 186 results in 50% brightness -- 128 ends up too + * dark on both bright and dark backgrounds. The net result is that dark + * text looks burnt-out, pixely and blotchy on bright background, bright + * text too frail on dark backgrounds, and colored text on colored + * background (for example, red on green) seems to have dark halos or + * 'dirt' around it. The situation is especially ugly for diagonal stems + * like in 'w' glyph shapes where the quality of FreeType's anti-aliasing + * depends on the correct display of grays. On high-DPI screens where + * smaller, fully black pixels reign supreme, this doesn't matter, but on + * our low-DPI screens with all the gray shades, it does. 0% and 100% + * brightness are the same things in linear and non-linear space, just + * all the shades in-between aren't. + * + * The blending function for placing text over a background is + * + * ``` + * dst = alpha * src + (1 - alpha) * dst , + * ``` + * + * which is known as the OVER operator. + * + * To correctly composite an anti-aliased pixel of a glyph onto a + * surface, + * + * 1. take the foreground and background colors (e.g., in sRGB space) + * and apply gamma to get them in a linear space, + * + * 2. use OVER to blend the two linear colors using the glyph pixel + * as the alpha value (remember, the glyph bitmap is an alpha coverage + * bitmap), and + * + * 3. apply inverse gamma to the blended pixel and write it back to + * the image. + * + * Internal testing at Adobe found that a target inverse gamma of~1.8 for + * step~3 gives good results across a wide range of displays with an sRGB + * gamma curve or a similar one. + * + * This process can cost performance. There is an approximation that + * does not need to know about the background color; see + * https://web.archive.org/web/20211019204945/https://bel.fi/alankila/lcd/ + * and + * https://web.archive.org/web/20210211002939/https://bel.fi/alankila/lcd/alpcor.html + * for details. + * + * **ATTENTION**: Linear blending is even more important when dealing + * with subpixel-rendered glyphs to prevent color-fringing! A + * subpixel-rendered glyph must first be filtered with a filter that + * gives equal weight to the three color primaries and does not exceed a + * sum of 0x100, see section @lcd_rendering. Then the only difference to + * gray linear blending is that subpixel-rendered linear blending is done + * 3~times per pixel: red foreground subpixel to red background subpixel + * and so on for green and blue. + */ + FT_EXPORT( FT_Error ) + FT_Render_Glyph( FT_GlyphSlot slot, + FT_Render_Mode render_mode ); + + + /************************************************************************** + * + * @enum: + * FT_Kerning_Mode + * + * @description: + * An enumeration to specify the format of kerning values returned by + * @FT_Get_Kerning. + * + * @values: + * FT_KERNING_DEFAULT :: + * Return grid-fitted kerning distances in 26.6 fractional pixels. + * + * FT_KERNING_UNFITTED :: + * Return un-grid-fitted kerning distances in 26.6 fractional pixels. + * + * FT_KERNING_UNSCALED :: + * Return the kerning vector in original font units. + * + * @note: + * `FT_KERNING_DEFAULT` returns full pixel values; it also makes FreeType + * heuristically scale down kerning distances at small ppem values so + * that they don't become too big. + * + * Both `FT_KERNING_DEFAULT` and `FT_KERNING_UNFITTED` use the current + * horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to + * convert font units to pixels. + */ + typedef enum FT_Kerning_Mode_ + { + FT_KERNING_DEFAULT = 0, + FT_KERNING_UNFITTED, + FT_KERNING_UNSCALED + + } FT_Kerning_Mode; + + + /* these constants are deprecated; use the corresponding */ + /* `FT_Kerning_Mode` values instead */ +#define ft_kerning_default FT_KERNING_DEFAULT +#define ft_kerning_unfitted FT_KERNING_UNFITTED +#define ft_kerning_unscaled FT_KERNING_UNSCALED + + + /************************************************************************** + * + * @function: + * FT_Get_Kerning + * + * @description: + * Return the kerning vector between two glyphs of the same face. + * + * @input: + * face :: + * A handle to a source face object. + * + * left_glyph :: + * The index of the left glyph in the kern pair. + * + * right_glyph :: + * The index of the right glyph in the kern pair. + * + * kern_mode :: + * See @FT_Kerning_Mode for more information. Determines the scale and + * dimension of the returned kerning vector. + * + * @output: + * akerning :: + * The kerning vector. This is either in font units, fractional pixels + * (26.6 format), or pixels for scalable formats, and in pixels for + * fixed-sizes formats. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Only horizontal layouts (left-to-right & right-to-left) are supported + * by this method. Other layouts, or more sophisticated kernings, are + * out of the scope of this API function -- they can be implemented + * through format-specific interfaces. + * + * Note that, for TrueType and OpenType fonts only, this can extract data + * from both the 'kern' table and the basic, pair-wise kerning feature + * from the GPOS table (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), + * though FreeType does not support the more advanced GPOS layout + * features; use a library like HarfBuzz for those instead. If a font + * has both a 'kern' table and kern features of a GPOS table, the 'kern' + * table will be used. + * + * Also note for right-to-left scripts, the functionality may differ for + * fonts with GPOS tables vs. 'kern' tables. For GPOS, right-to-left + * fonts typically use both a placement offset and an advance for pair + * positioning, which this API does not support, so it would output + * kerning values of zero; though if the right-to-left font used only + * advances in GPOS pair positioning, then this API could output kerning + * values for it, but it would use `left_glyph` to mean the first glyph + * for that case. Whereas 'kern' tables are always advance-only and + * always store the left glyph first. + * + * Use @FT_HAS_KERNING to find out whether a font has data that can be + * extracted with `FT_Get_Kerning`. + */ + FT_EXPORT( FT_Error ) + FT_Get_Kerning( FT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_UInt kern_mode, + FT_Vector *akerning ); + + + /************************************************************************** + * + * @function: + * FT_Get_Track_Kerning + * + * @description: + * Return the track kerning for a given face object at a given size. + * + * @input: + * face :: + * A handle to a source face object. + * + * point_size :: + * The point size in 16.16 fractional points. + * + * degree :: + * The degree of tightness. Increasingly negative values represent + * tighter track kerning, while increasingly positive values represent + * looser track kerning. Value zero means no track kerning. + * + * @output: + * akerning :: + * The kerning in 16.16 fractional points, to be uniformly applied + * between all glyphs. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Currently, only the Type~1 font driver supports track kerning, using + * data from AFM files (if attached with @FT_Attach_File or + * @FT_Attach_Stream). + * + * Only very few AFM files come with track kerning data; please refer to + * Adobe's AFM specification for more details. + */ + FT_EXPORT( FT_Error ) + FT_Get_Track_Kerning( FT_Face face, + FT_Fixed point_size, + FT_Int degree, + FT_Fixed* akerning ); + + + /************************************************************************** + * + * @section: + * character_mapping + * + */ + + /************************************************************************** + * + * @function: + * FT_Select_Charmap + * + * @description: + * Select a given charmap by its encoding tag (as listed in + * `freetype.h`). + * + * @inout: + * face :: + * A handle to the source face object. + * + * @input: + * encoding :: + * A handle to the selected encoding. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function returns an error if no charmap in the face corresponds + * to the encoding queried here. + * + * Because many fonts contain more than a single cmap for Unicode + * encoding, this function has some special code to select the one that + * covers Unicode best ('best' in the sense that a UCS-4 cmap is + * preferred to a UCS-2 cmap). It is thus preferable to @FT_Set_Charmap + * in this case. + */ + FT_EXPORT( FT_Error ) + FT_Select_Charmap( FT_Face face, + FT_Encoding encoding ); + + + /************************************************************************** + * + * @function: + * FT_Set_Charmap + * + * @description: + * Select a given charmap for character code to glyph index mapping. + * + * @inout: + * face :: + * A handle to the source face object. + * + * @input: + * charmap :: + * A handle to the selected charmap. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function returns an error if the charmap is not part of the face + * (i.e., if it is not listed in the `face->charmaps` table). + * + * It also fails if an OpenType type~14 charmap is selected (which + * doesn't map character codes to glyph indices at all). + */ + FT_EXPORT( FT_Error ) + FT_Set_Charmap( FT_Face face, + FT_CharMap charmap ); + + + /************************************************************************** + * + * @function: + * FT_Get_Charmap_Index + * + * @description: + * Retrieve index of a given charmap. + * + * @input: + * charmap :: + * A handle to a charmap. + * + * @return: + * The index into the array of character maps within the face to which + * `charmap` belongs. If an error occurs, -1 is returned. + * + */ + FT_EXPORT( FT_Int ) + FT_Get_Charmap_Index( FT_CharMap charmap ); + + + /************************************************************************** + * + * @function: + * FT_Get_Char_Index + * + * @description: + * Return the glyph index of a given character code. This function uses + * the currently selected charmap to do the mapping. + * + * @input: + * face :: + * A handle to the source face object. + * + * charcode :: + * The character code. + * + * @return: + * The glyph index. 0~means 'undefined character code'. + * + * @note: + * If you use FreeType to manipulate the contents of font files directly, + * be aware that the glyph index returned by this function doesn't always + * correspond to the internal indices used within the file. This is done + * to ensure that value~0 always corresponds to the 'missing glyph'. If + * the first glyph is not named '.notdef', then for Type~1 and Type~42 + * fonts, '.notdef' will be moved into the glyph ID~0 position, and + * whatever was there will be moved to the position '.notdef' had. For + * Type~1 fonts, if there is no '.notdef' glyph at all, then one will be + * created at index~0 and whatever was there will be moved to the last + * index -- Type~42 fonts are considered invalid under this condition. + */ + FT_EXPORT( FT_UInt ) + FT_Get_Char_Index( FT_Face face, + FT_ULong charcode ); + + + /************************************************************************** + * + * @function: + * FT_Get_First_Char + * + * @description: + * Return the first character code in the current charmap of a given + * face, together with its corresponding glyph index. + * + * @input: + * face :: + * A handle to the source face object. + * + * @output: + * agindex :: + * Glyph index of first character code. 0~if charmap is empty. + * + * @return: + * The charmap's first character code. + * + * @note: + * You should use this function together with @FT_Get_Next_Char to parse + * all character codes available in a given charmap. The code should + * look like this: + * + * ``` + * FT_ULong charcode; + * FT_UInt gindex; + * + * + * charcode = FT_Get_First_Char( face, &gindex ); + * while ( gindex != 0 ) + * { + * ... do something with (charcode,gindex) pair ... + * + * charcode = FT_Get_Next_Char( face, charcode, &gindex ); + * } + * ``` + * + * Be aware that character codes can have values up to 0xFFFFFFFF; this + * might happen for non-Unicode or malformed cmaps. However, even with + * regular Unicode encoding, so-called 'last resort fonts' (using SFNT + * cmap format 13, see function @FT_Get_CMap_Format) normally have + * entries for all Unicode characters up to 0x1FFFFF, which can cause *a + * lot* of iterations. + * + * Note that `*agindex` is set to~0 if the charmap is empty. The result + * itself can be~0 in two cases: if the charmap is empty or if the + * value~0 is the first valid character code. + */ + FT_EXPORT( FT_ULong ) + FT_Get_First_Char( FT_Face face, + FT_UInt *agindex ); + + + /************************************************************************** + * + * @function: + * FT_Get_Next_Char + * + * @description: + * Return the next character code in the current charmap of a given face + * following the value `char_code`, as well as the corresponding glyph + * index. + * + * @input: + * face :: + * A handle to the source face object. + * + * char_code :: + * The starting character code. + * + * @output: + * agindex :: + * Glyph index of next character code. 0~if charmap is empty. + * + * @return: + * The charmap's next character code. + * + * @note: + * You should use this function with @FT_Get_First_Char to walk over all + * character codes available in a given charmap. See the note for that + * function for a simple code example. + * + * Note that `*agindex` is set to~0 when there are no more codes in the + * charmap. + */ + FT_EXPORT( FT_ULong ) + FT_Get_Next_Char( FT_Face face, + FT_ULong char_code, + FT_UInt *agindex ); + + + /************************************************************************** + * + * @section: + * face_creation + * + */ + + /************************************************************************** + * + * @function: + * FT_Face_Properties + * + * @description: + * Set or override certain (library or module-wide) properties on a + * face-by-face basis. Useful for finer-grained control and avoiding + * locks on shared structures (threads can modify their own faces as they + * see fit). + * + * Contrary to @FT_Property_Set, this function uses @FT_Parameter so that + * you can pass multiple properties to the target face in one call. Note + * that only a subset of the available properties can be controlled. + * + * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the + * property `no-stem-darkening` provided by the 'autofit', 'cff', + * 'type1', and 't1cid' modules; see @no-stem-darkening). + * + * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID + * 'random' operator, corresponding to the `random-seed` property + * provided by the 'cff', 'type1', and 't1cid' modules; see + * @random-seed). + * + * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (no longer supported). + * + * Pass `NULL` as `data` in @FT_Parameter for a given tag to reset the + * option and use the library or module default again. + * + * @input: + * face :: + * A handle to the source face object. + * + * num_properties :: + * The number of properties that follow. + * + * properties :: + * A handle to an @FT_Parameter array with `num_properties` elements. + * + * @return: + * FreeType error code. 0~means success. + * + * @example: + * Here is an example that sets three properties. You must define + * `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` to make the LCD filter examples + * work. + * + * ``` + * FT_Parameter property1; + * FT_Bool darken_stems = 1; + * + * FT_Parameter property2; + * FT_Int32 random_seed = 314159265; + * + * FT_Parameter properties[2] = { property1, + * property2 }; + * + * + * property1.tag = FT_PARAM_TAG_STEM_DARKENING; + * property1.data = &darken_stems; + * + * property2.tag = FT_PARAM_TAG_RANDOM_SEED; + * property2.data = &random_seed; + * + * FT_Face_Properties( face, 3, properties ); + * ``` + * + * The next example resets a single property to its default value. + * + * ``` + * FT_Parameter property; + * + * + * property.tag = FT_PARAM_TAG_STEM_DARKENING; + * property.data = NULL; + * + * FT_Face_Properties( face, 1, &property ); + * ``` + * + * @since: + * 2.8 + * + */ + FT_EXPORT( FT_Error ) + FT_Face_Properties( FT_Face face, + FT_UInt num_properties, + FT_Parameter* properties ); + + + /************************************************************************** + * + * @section: + * information_retrieval + * + */ + + /************************************************************************** + * + * @function: + * FT_Get_Name_Index + * + * @description: + * Return the glyph index of a given glyph name. This only works + * for those faces where @FT_HAS_GLYPH_NAMES returns true. + * + * @input: + * face :: + * A handle to the source face object. + * + * glyph_name :: + * The glyph name. + * + * @return: + * The glyph index. 0~means 'undefined character code'. + * + * @note: + * Acceptable glyph names might come from the [Adobe Glyph + * List](https://github.com/adobe-type-tools/agl-aglfn). See + * @FT_Get_Glyph_Name for the inverse functionality. + * + * This function has limited capabilities if the config macro + * `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` is not defined in `ftoption.h`: + * It then works only for fonts that actually embed glyph names (which + * many recent OpenType fonts do not). + */ + FT_EXPORT( FT_UInt ) + FT_Get_Name_Index( FT_Face face, + const FT_String* glyph_name ); + + + /************************************************************************** + * + * @function: + * FT_Get_Glyph_Name + * + * @description: + * Retrieve the ASCII name of a given glyph in a face. This only works + * for those faces where @FT_HAS_GLYPH_NAMES returns true. + * + * @input: + * face :: + * A handle to a source face object. + * + * glyph_index :: + * The glyph index. + * + * buffer_max :: + * The maximum number of bytes available in the buffer. + * + * @output: + * buffer :: + * A pointer to a target buffer where the name is copied to. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * An error is returned if the face doesn't provide glyph names or if the + * glyph index is invalid. In all cases of failure, the first byte of + * `buffer` is set to~0 to indicate an empty name. + * + * The glyph name is truncated to fit within the buffer if it is too + * long. The returned string is always zero-terminated. + * + * Be aware that FreeType reorders glyph indices internally so that glyph + * index~0 always corresponds to the 'missing glyph' (called '.notdef'). + * + * This function has limited capabilities if the config macro + * `FT_CONFIG_OPTION_POSTSCRIPT_NAMES` is not defined in `ftoption.h`: + * It then works only for fonts that actually embed glyph names (which + * many recent OpenType fonts do not). + */ + FT_EXPORT( FT_Error ) + FT_Get_Glyph_Name( FT_Face face, + FT_UInt glyph_index, + FT_Pointer buffer, + FT_UInt buffer_max ); + + + /************************************************************************** + * + * @function: + * FT_Get_Postscript_Name + * + * @description: + * Retrieve the ASCII PostScript name of a given face, if available. + * This only works with PostScript, TrueType, and OpenType fonts. + * + * @input: + * face :: + * A handle to the source face object. + * + * @return: + * A pointer to the face's PostScript name. `NULL` if unavailable. + * + * @note: + * The returned pointer is owned by the face and is destroyed with it. + * + * For variation fonts, this string changes if you select a different + * instance, and you have to call `FT_Get_PostScript_Name` again to + * retrieve it. FreeType follows Adobe TechNote #5902, 'Generating + * PostScript Names for Fonts Using OpenType Font Variations'. + * + * https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html + * + * [Since 2.9] Special PostScript names for named instances are only + * returned if the named instance is set with @FT_Set_Named_Instance (and + * the font has corresponding entries in its 'fvar' table or is the + * default named instance). If @FT_IS_VARIATION returns true, the + * algorithmically derived PostScript name is provided, not looking up + * special entries for named instances. + */ + FT_EXPORT( const char* ) + FT_Get_Postscript_Name( FT_Face face ); + + + /************************************************************************** + * + * @enum: + * FT_SUBGLYPH_FLAG_XXX + * + * @description: + * A list of constants describing subglyphs. Please refer to the 'glyf' + * table description in the OpenType specification for the meaning of the + * various flags (which get synthesized for non-OpenType subglyphs). + * + * https://learn.microsoft.com/typography/opentype/spec/glyf#composite-glyph-description + * + * @values: + * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: + * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: + * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: + * FT_SUBGLYPH_FLAG_SCALE :: + * FT_SUBGLYPH_FLAG_XY_SCALE :: + * FT_SUBGLYPH_FLAG_2X2 :: + * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: + * + */ +#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 +#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 +#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 +#define FT_SUBGLYPH_FLAG_SCALE 8 +#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 +#define FT_SUBGLYPH_FLAG_2X2 0x80 +#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 + + + /************************************************************************** + * + * @function: + * FT_Get_SubGlyph_Info + * + * @description: + * Retrieve a description of a given subglyph. Only use it if + * `glyph->format` is @FT_GLYPH_FORMAT_COMPOSITE; an error is returned + * otherwise. + * + * @input: + * glyph :: + * The source glyph slot. + * + * sub_index :: + * The index of the subglyph. Must be less than + * `glyph->num_subglyphs`. + * + * @output: + * p_index :: + * The glyph index of the subglyph. + * + * p_flags :: + * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. + * + * p_arg1 :: + * The subglyph's first argument (if any). + * + * p_arg2 :: + * The subglyph's second argument (if any). + * + * p_transform :: + * The subglyph transformation (if any). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The values of `*p_arg1`, `*p_arg2`, and `*p_transform` must be + * interpreted depending on the flags returned in `*p_flags`. See the + * OpenType specification for details. + * + * https://learn.microsoft.com/typography/opentype/spec/glyf#composite-glyph-description + * + */ + FT_EXPORT( FT_Error ) + FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, + FT_UInt sub_index, + FT_Int *p_index, + FT_UInt *p_flags, + FT_Int *p_arg1, + FT_Int *p_arg2, + FT_Matrix *p_transform ); + + + /************************************************************************** + * + * @enum: + * FT_FSTYPE_XXX + * + * @description: + * A list of bit flags used in the `fsType` field of the OS/2 table in a + * TrueType or OpenType font and the `FSType` entry in a PostScript font. + * These bit flags are returned by @FT_Get_FSType_Flags; they inform + * client applications of embedding and subsetting restrictions + * associated with a font. + * + * See + * https://adobe-type-tools.github.io/font-tech-notes/pdfs/AcrobatDC_FontPolicies.pdf + * for more details. + * + * @values: + * FT_FSTYPE_INSTALLABLE_EMBEDDING :: + * Fonts with no fsType bit set may be embedded and permanently + * installed on the remote system by an application. + * + * FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: + * Fonts that have only this bit set must not be modified, embedded or + * exchanged in any manner without first obtaining permission of the + * font software copyright owner. + * + * FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: + * The font may be embedded and temporarily loaded on the remote + * system. Documents containing Preview & Print fonts must be opened + * 'read-only'; no edits can be applied to the document. + * + * FT_FSTYPE_EDITABLE_EMBEDDING :: + * The font may be embedded but must only be installed temporarily on + * other systems. In contrast to Preview & Print fonts, documents + * containing editable fonts may be opened for reading, editing is + * permitted, and changes may be saved. + * + * FT_FSTYPE_NO_SUBSETTING :: + * The font may not be subsetted prior to embedding. + * + * FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: + * Only bitmaps contained in the font may be embedded; no outline data + * may be embedded. If there are no bitmaps available in the font, + * then the font is unembeddable. + * + * @note: + * The flags are ORed together, thus more than a single value can be + * returned. + * + * While the `fsType` flags can indicate that a font may be embedded, a + * license with the font vendor may be separately required to use the + * font in this way. + */ +#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 +#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 +#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 +#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 +#define FT_FSTYPE_NO_SUBSETTING 0x0100 +#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 + + + /************************************************************************** + * + * @function: + * FT_Get_FSType_Flags + * + * @description: + * Return the `fsType` flags for a font. + * + * @input: + * face :: + * A handle to the source face object. + * + * @return: + * The `fsType` flags, see @FT_FSTYPE_XXX. + * + * @note: + * Use this function rather than directly reading the `fs_type` field in + * the @PS_FontInfoRec structure, which is only guaranteed to return the + * correct results for Type~1 fonts. + * + * @since: + * 2.3.8 + * + */ + FT_EXPORT( FT_UShort ) + FT_Get_FSType_Flags( FT_Face face ); + + + /************************************************************************** + * + * @section: + * glyph_variants + * + * @title: + * Unicode Variation Sequences + * + * @abstract: + * The FreeType~2 interface to Unicode Variation Sequences (UVS), using + * the SFNT cmap format~14. + * + * @description: + * Many characters, especially for CJK scripts, have variant forms. They + * are a sort of grey area somewhere between being totally irrelevant and + * semantically distinct; for this reason, the Unicode consortium decided + * to introduce Variation Sequences (VS), consisting of a Unicode base + * character and a variation selector instead of further extending the + * already huge number of characters. + * + * Unicode maintains two different sets, namely 'Standardized Variation + * Sequences' and registered 'Ideographic Variation Sequences' (IVS), + * collected in the 'Ideographic Variation Database' (IVD). + * + * https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt + * https://unicode.org/reports/tr37/ https://unicode.org/ivd/ + * + * To date (January 2017), the character with the most ideographic + * variations is U+9089, having 32 such IVS. + * + * Three Mongolian Variation Selectors have the values U+180B-U+180D; 256 + * generic Variation Selectors are encoded in the ranges U+FE00-U+FE0F + * and U+E0100-U+E01EF. IVS currently use Variation Selectors from the + * range U+E0100-U+E01EF only. + * + * A VS consists of the base character value followed by a single + * Variation Selector. For example, to get the first variation of + * U+9089, you have to write the character sequence `U+9089 U+E0100`. + * + * Adobe and MS decided to support both standardized and ideographic VS + * with a new cmap subtable (format~14). It is an odd subtable because + * it is not a mapping of input code points to glyphs, but contains lists + * of all variations supported by the font. + * + * A variation may be either 'default' or 'non-default' for a given font. + * A default variation is the one you will get for that code point if you + * look it up in the standard Unicode cmap. A non-default variation is a + * different glyph. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Face_GetCharVariantIndex + * + * @description: + * Return the glyph index of a given character code as modified by the + * variation selector. + * + * @input: + * face :: + * A handle to the source face object. + * + * charcode :: + * The character code point in Unicode. + * + * variantSelector :: + * The Unicode code point of the variation selector. + * + * @return: + * The glyph index. 0~means either 'undefined character code', or + * 'undefined selector code', or 'no variation selector cmap subtable', + * or 'current CharMap is not Unicode'. + * + * @note: + * If you use FreeType to manipulate the contents of font files directly, + * be aware that the glyph index returned by this function doesn't always + * correspond to the internal indices used within the file. This is done + * to ensure that value~0 always corresponds to the 'missing glyph'. + * + * This function is only meaningful if + * a) the font has a variation selector cmap sub table, and + * b) the current charmap has a Unicode encoding. + * + * @since: + * 2.3.6 + * + */ + FT_EXPORT( FT_UInt ) + FT_Face_GetCharVariantIndex( FT_Face face, + FT_ULong charcode, + FT_ULong variantSelector ); + + + /************************************************************************** + * + * @function: + * FT_Face_GetCharVariantIsDefault + * + * @description: + * Check whether this variation of this Unicode character is the one to + * be found in the charmap. + * + * @input: + * face :: + * A handle to the source face object. + * + * charcode :: + * The character codepoint in Unicode. + * + * variantSelector :: + * The Unicode codepoint of the variation selector. + * + * @return: + * 1~if found in the standard (Unicode) cmap, 0~if found in the variation + * selector cmap, or -1 if it is not a variation. + * + * @note: + * This function is only meaningful if the font has a variation selector + * cmap subtable. + * + * @since: + * 2.3.6 + * + */ + FT_EXPORT( FT_Int ) + FT_Face_GetCharVariantIsDefault( FT_Face face, + FT_ULong charcode, + FT_ULong variantSelector ); + + + /************************************************************************** + * + * @function: + * FT_Face_GetVariantSelectors + * + * @description: + * Return a zero-terminated list of Unicode variation selectors found in + * the font. + * + * @input: + * face :: + * A handle to the source face object. + * + * @return: + * A pointer to an array of selector code points, or `NULL` if there is + * no valid variation selector cmap subtable. + * + * @note: + * The last item in the array is~0; the array is owned by the @FT_Face + * object but can be overwritten or released on the next call to a + * FreeType function. + * + * @since: + * 2.3.6 + * + */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetVariantSelectors( FT_Face face ); + + + /************************************************************************** + * + * @function: + * FT_Face_GetVariantsOfChar + * + * @description: + * Return a zero-terminated list of Unicode variation selectors found for + * the specified character code. + * + * @input: + * face :: + * A handle to the source face object. + * + * charcode :: + * The character codepoint in Unicode. + * + * @return: + * A pointer to an array of variation selector code points that are + * active for the given character, or `NULL` if the corresponding list is + * empty. + * + * @note: + * The last item in the array is~0; the array is owned by the @FT_Face + * object but can be overwritten or released on the next call to a + * FreeType function. + * + * @since: + * 2.3.6 + * + */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetVariantsOfChar( FT_Face face, + FT_ULong charcode ); + + + /************************************************************************** + * + * @function: + * FT_Face_GetCharsOfVariant + * + * @description: + * Return a zero-terminated list of Unicode character codes found for the + * specified variation selector. + * + * @input: + * face :: + * A handle to the source face object. + * + * variantSelector :: + * The variation selector code point in Unicode. + * + * @return: + * A list of all the code points that are specified by this selector + * (both default and non-default codes are returned) or `NULL` if there + * is no valid cmap or the variation selector is invalid. + * + * @note: + * The last item in the array is~0; the array is owned by the @FT_Face + * object but can be overwritten or released on the next call to a + * FreeType function. + * + * @since: + * 2.3.6 + * + */ + FT_EXPORT( FT_UInt32* ) + FT_Face_GetCharsOfVariant( FT_Face face, + FT_ULong variantSelector ); + + + /************************************************************************** + * + * @section: + * computations + * + * @title: + * Computations + * + * @abstract: + * Crunching fixed numbers and vectors. + * + * @description: + * This section contains various functions used to perform computations + * on 16.16 fixed-point numbers or 2D vectors. FreeType does not use + * floating-point data types. + * + * **Attention**: Most arithmetic functions take `FT_Long` as arguments. + * For historical reasons, FreeType was designed under the assumption + * that `FT_Long` is a 32-bit integer; results can thus be undefined if + * the arguments don't fit into 32 bits. + * + * @order: + * FT_MulDiv + * FT_MulFix + * FT_DivFix + * FT_RoundFix + * FT_CeilFix + * FT_FloorFix + * FT_Vector_Transform + * FT_Matrix_Multiply + * FT_Matrix_Invert + * + */ + + + /************************************************************************** + * + * @function: + * FT_MulDiv + * + * @description: + * Compute `(a*b)/c` with maximum accuracy, using a 64-bit intermediate + * integer whenever necessary. + * + * This function isn't necessarily as fast as some processor-specific + * operations, but is at least completely portable. + * + * @input: + * a :: + * The first multiplier. + * + * b :: + * The second multiplier. + * + * c :: + * The divisor. + * + * @return: + * The result of `(a*b)/c`. This function never traps when trying to + * divide by zero; it simply returns 'MaxInt' or 'MinInt' depending on + * the signs of `a` and `b`. + */ + FT_EXPORT( FT_Long ) + FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ); + + + /************************************************************************** + * + * @function: + * FT_MulFix + * + * @description: + * Compute `(a*b)/0x10000` with maximum accuracy. Its main use is to + * multiply a given value by a 16.16 fixed-point factor. + * + * @input: + * a :: + * The first multiplier. + * + * b :: + * The second multiplier. Use a 16.16 factor here whenever possible + * (see note below). + * + * @return: + * The result of `(a*b)/0x10000`. + * + * @note: + * This function has been optimized for the case where the absolute value + * of `a` is less than 2048, and `b` is a 16.16 scaling factor. As this + * happens mainly when scaling from notional units to fractional pixels + * in FreeType, it resulted in noticeable speed improvements between + * versions 2.x and 1.x. + * + * As a conclusion, always try to place a 16.16 factor as the _second_ + * argument of this function; this can make a great difference. + */ + FT_EXPORT( FT_Long ) + FT_MulFix( FT_Long a, + FT_Long b ); + + + /************************************************************************** + * + * @function: + * FT_DivFix + * + * @description: + * Compute `(a*0x10000)/b` with maximum accuracy. Its main use is to + * divide a given value by a 16.16 fixed-point factor. + * + * @input: + * a :: + * The numerator. + * + * b :: + * The denominator. Use a 16.16 factor here. + * + * @return: + * The result of `(a*0x10000)/b`. + */ + FT_EXPORT( FT_Long ) + FT_DivFix( FT_Long a, + FT_Long b ); + + + /************************************************************************** + * + * @function: + * FT_RoundFix + * + * @description: + * Round a 16.16 fixed number. + * + * @input: + * a :: + * The number to be rounded. + * + * @return: + * `a` rounded to the nearest 16.16 fixed integer, halfway cases away + * from zero. + * + * @note: + * The function uses wrap-around arithmetic. + */ + FT_EXPORT( FT_Fixed ) + FT_RoundFix( FT_Fixed a ); + + + /************************************************************************** + * + * @function: + * FT_CeilFix + * + * @description: + * Compute the smallest following integer of a 16.16 fixed number. + * + * @input: + * a :: + * The number for which the ceiling function is to be computed. + * + * @return: + * `a` rounded towards plus infinity. + * + * @note: + * The function uses wrap-around arithmetic. + */ + FT_EXPORT( FT_Fixed ) + FT_CeilFix( FT_Fixed a ); + + + /************************************************************************** + * + * @function: + * FT_FloorFix + * + * @description: + * Compute the largest previous integer of a 16.16 fixed number. + * + * @input: + * a :: + * The number for which the floor function is to be computed. + * + * @return: + * `a` rounded towards minus infinity. + */ + FT_EXPORT( FT_Fixed ) + FT_FloorFix( FT_Fixed a ); + + + /************************************************************************** + * + * @function: + * FT_Vector_Transform + * + * @description: + * Transform a single vector through a 2x2 matrix. + * + * @inout: + * vector :: + * The target vector to transform. + * + * @input: + * matrix :: + * A pointer to the source 2x2 matrix. + * + * @note: + * The result is undefined if either `vector` or `matrix` is invalid. + */ + FT_EXPORT( void ) + FT_Vector_Transform( FT_Vector* vector, + const FT_Matrix* matrix ); + + + /************************************************************************** + * + * @section: + * library_setup + * + */ + + /************************************************************************** + * + * @enum: + * FREETYPE_XXX + * + * @description: + * These three macros identify the FreeType source code version. Use + * @FT_Library_Version to access them at runtime. + * + * @values: + * FREETYPE_MAJOR :: + * The major version number. + * FREETYPE_MINOR :: + * The minor version number. + * FREETYPE_PATCH :: + * The patch level. + * + * @note: + * The version number of FreeType if built as a dynamic link library with + * the 'libtool' package is _not_ controlled by these three macros. + * + */ +#define FREETYPE_MAJOR 2 +#define FREETYPE_MINOR 14 +#define FREETYPE_PATCH 2 + + + /************************************************************************** + * + * @function: + * FT_Library_Version + * + * @description: + * Return the version of the FreeType library being used. This is useful + * when dynamically linking to the library, since one cannot use the + * macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and @FREETYPE_PATCH. + * + * @input: + * library :: + * A source library handle. + * + * @output: + * amajor :: + * The major version number. + * + * aminor :: + * The minor version number. + * + * apatch :: + * The patch version number. + * + * @note: + * The reason why this function takes a `library` argument is because + * certain programs implement library initialization in a custom way that + * doesn't use @FT_Init_FreeType. + * + * In such cases, the library version might not be available before the + * library object has been created. + */ + FT_EXPORT( void ) + FT_Library_Version( FT_Library library, + FT_Int *amajor, + FT_Int *aminor, + FT_Int *apatch ); + + + /************************************************************************** + * + * @section: + * other_api_data + * + */ + + /************************************************************************** + * + * @function: + * FT_Face_CheckTrueTypePatents + * + * @description: + * Deprecated, does nothing. + * + * @input: + * face :: + * A face handle. + * + * @return: + * Always returns false. + * + * @note: + * Since May 2010, TrueType hinting is no longer patented. + * + * @since: + * 2.3.5 + * + */ + FT_EXPORT( FT_Bool ) + FT_Face_CheckTrueTypePatents( FT_Face face ); + + + /************************************************************************** + * + * @function: + * FT_Face_SetUnpatentedHinting + * + * @description: + * Deprecated, does nothing. + * + * @input: + * face :: + * A face handle. + * + * value :: + * New boolean setting. + * + * @return: + * Always returns false. + * + * @note: + * Since May 2010, TrueType hinting is no longer patented. + * + * @since: + * 2.3.5 + * + */ + FT_EXPORT( FT_Bool ) + FT_Face_SetUnpatentedHinting( FT_Face face, + FT_Bool value ); + + /* */ + + +FT_END_HEADER + +#endif /* FREETYPE_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftadvanc.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftadvanc.h new file mode 100644 index 0000000000000000000000000000000000000000..62a856ccbd71ec65cf1a09daa8c9efc9cc935228 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftadvanc.h @@ -0,0 +1,188 @@ +/**************************************************************************** + * + * ftadvanc.h + * + * Quick computation of advance widths (specification only). + * + * Copyright (C) 2008-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTADVANC_H_ +#define FTADVANC_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * quick_advance + * + * @title: + * Quick retrieval of advance values + * + * @abstract: + * Retrieve horizontal and vertical advance values without processing + * glyph outlines, if possible. + * + * @description: + * This section contains functions to quickly extract advance values + * without handling glyph outlines, if possible. + * + * @order: + * FT_Get_Advance + * FT_Get_Advances + * + */ + + + /************************************************************************** + * + * @enum: + * FT_ADVANCE_FLAG_FAST_ONLY + * + * @description: + * A bit-flag to be OR-ed with the `flags` parameter of the + * @FT_Get_Advance and @FT_Get_Advances functions. + * + * If set, it indicates that you want these functions to fail if the + * corresponding hinting mode or font driver doesn't allow for very quick + * advance computation. + * + * Typically, glyphs that are either unscaled, unhinted, bitmapped, or + * light-hinted can have their advance width computed very quickly. + * + * Normal and bytecode hinted modes that require loading, scaling, and + * hinting of the glyph outline, are extremely slow by comparison. + */ +#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L + + + /************************************************************************** + * + * @function: + * FT_Get_Advance + * + * @description: + * Retrieve the advance value of a given glyph outline in an @FT_Face. + * + * @input: + * face :: + * The source @FT_Face handle. + * + * gindex :: + * The glyph index. + * + * load_flags :: + * A set of bit flags similar to those used when calling + * @FT_Load_Glyph, used to determine what kind of advances you need. + * + * @output: + * padvance :: + * The advance value. If scaling is performed (based on the value of + * `load_flags`), the advance value is in 16.16 format. Otherwise, it + * is in font units. + * + * If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance + * corresponding to a vertical layout. Otherwise, it is the horizontal + * advance in a horizontal layout. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if + * the corresponding font backend doesn't have a quick way to retrieve + * the advances. + * + * A scaled advance is returned in 16.16 format but isn't transformed by + * the affine transformation specified by @FT_Set_Transform. + */ + FT_EXPORT( FT_Error ) + FT_Get_Advance( FT_Face face, + FT_UInt gindex, + FT_Int32 load_flags, + FT_Fixed *padvance ); + + + /************************************************************************** + * + * @function: + * FT_Get_Advances + * + * @description: + * Retrieve the advance values of several glyph outlines in an @FT_Face. + * + * @input: + * face :: + * The source @FT_Face handle. + * + * start :: + * The first glyph index. + * + * count :: + * The number of advance values you want to retrieve. + * + * load_flags :: + * A set of bit flags similar to those used when calling + * @FT_Load_Glyph. + * + * @output: + * padvance :: + * The advance values. This array, to be provided by the caller, must + * contain at least `count` elements. + * + * If scaling is performed (based on the value of `load_flags`), the + * advance values are in 16.16 format. Otherwise, they are in font + * units. + * + * If @FT_LOAD_VERTICAL_LAYOUT is set, these are the vertical advances + * corresponding to a vertical layout. Otherwise, they are the + * horizontal advances in a horizontal layout. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if + * the corresponding font backend doesn't have a quick way to retrieve + * the advances. + * + * Scaled advances are returned in 16.16 format but aren't transformed by + * the affine transformation specified by @FT_Set_Transform. + */ + FT_EXPORT( FT_Error ) + FT_Get_Advances( FT_Face face, + FT_UInt start, + FT_UInt count, + FT_Int32 load_flags, + FT_Fixed *padvances ); + + /* */ + + +FT_END_HEADER + +#endif /* FTADVANC_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbbox.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbbox.h new file mode 100644 index 0000000000000000000000000000000000000000..348b4b3a268dd8d156c43c17a957b86b8d4d8226 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbbox.h @@ -0,0 +1,101 @@ +/**************************************************************************** + * + * ftbbox.h + * + * FreeType exact bbox computation (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This component has a _single_ role: to compute exact outline bounding + * boxes. + * + * It is separated from the rest of the engine for various technical + * reasons. It may well be integrated in 'ftoutln' later. + * + */ + + +#ifndef FTBBOX_H_ +#define FTBBOX_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * outline_processing + * + */ + + + /************************************************************************** + * + * @function: + * FT_Outline_Get_BBox + * + * @description: + * Compute the exact bounding box of an outline. This is slower than + * computing the control box. However, it uses an advanced algorithm + * that returns _very_ quickly when the two boxes coincide. Otherwise, + * the outline Bezier arcs are traversed to extract their extrema. + * + * @input: + * outline :: + * A pointer to the source outline. + * + * @output: + * abbox :: + * The outline's exact bounding box. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If the font is tricky and the glyph has been loaded with + * @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get + * reasonable values for the BBox it is necessary to load the glyph at a + * large ppem value (so that the hinting instructions can properly shift + * and scale the subglyphs), then extracting the BBox, which can be + * eventually converted back to font units. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Get_BBox( FT_Outline* outline, + FT_BBox *abbox ); + + /* */ + + +FT_END_HEADER + +#endif /* FTBBOX_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbdf.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbdf.h new file mode 100644 index 0000000000000000000000000000000000000000..ab142249217cd86f8741f42a253623d31908ec93 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbdf.h @@ -0,0 +1,218 @@ +/**************************************************************************** + * + * ftbdf.h + * + * FreeType API for accessing BDF-specific strings (specification). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTBDF_H_ +#define FTBDF_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * bdf_fonts + * + * @title: + * BDF and PCF Files + * + * @abstract: + * BDF and PCF specific API. + * + * @description: + * This section contains the declaration of functions specific to BDF and + * PCF fonts. They also work for SFNT bitmap fonts that contain a 'BDF~' + * table like X11's `.otb` fonts. + * + */ + + + /************************************************************************** + * + * @enum: + * BDF_PropertyType + * + * @description: + * A list of BDF property types. + * + * @values: + * BDF_PROPERTY_TYPE_NONE :: + * Value~0 is used to indicate a missing property. + * + * BDF_PROPERTY_TYPE_ATOM :: + * Property is a string atom. + * + * BDF_PROPERTY_TYPE_INTEGER :: + * Property is a 32-bit signed integer. + * + * BDF_PROPERTY_TYPE_CARDINAL :: + * Property is a 32-bit unsigned integer. + */ + typedef enum BDF_PropertyType_ + { + BDF_PROPERTY_TYPE_NONE = 0, + BDF_PROPERTY_TYPE_ATOM = 1, + BDF_PROPERTY_TYPE_INTEGER = 2, + BDF_PROPERTY_TYPE_CARDINAL = 3 + + } BDF_PropertyType; + + + /************************************************************************** + * + * @type: + * BDF_Property + * + * @description: + * A handle to a @BDF_PropertyRec structure to model a given BDF/PCF + * property. + */ + typedef struct BDF_PropertyRec_* BDF_Property; + + + /************************************************************************** + * + * @struct: + * BDF_PropertyRec + * + * @description: + * This structure models a given BDF/PCF property. + * + * @fields: + * type :: + * The property type. + * + * u.atom :: + * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be + * `NULL`, indicating an empty string. + * + * u.integer :: + * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. + * + * u.cardinal :: + * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. + */ + typedef struct BDF_PropertyRec_ + { + BDF_PropertyType type; + union { + const char* atom; + FT_Int32 integer; + FT_UInt32 cardinal; + + } u; + + } BDF_PropertyRec; + + + /************************************************************************** + * + * @function: + * FT_Get_BDF_Charset_ID + * + * @description: + * Retrieve a BDF font character set identity, according to the BDF + * specification. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * acharset_encoding :: + * Charset encoding, as a C~string, owned by the face. + * + * acharset_registry :: + * Charset registry, as a C~string, owned by the face. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with BDF faces and SFNT fonts that have a + * 'BDF~' table, returning an error otherwise. For the latter, a bitmap + * strike size must be selected first. + */ + FT_EXPORT( FT_Error ) + FT_Get_BDF_Charset_ID( FT_Face face, + const char* *acharset_encoding, + const char* *acharset_registry ); + + + /************************************************************************** + * + * @function: + * FT_Get_BDF_Property + * + * @description: + * Retrieve a BDF property from a BDF or PCF font. + * + * @input: + * face :: + * A handle to the input face. + * + * name :: + * The property name. + * + * @output: + * aproperty :: + * The property. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function works with BDF _and_ PCF fonts. It returns an error + * otherwise. It also returns an error if the property is not in the + * font. + * + * A 'property' is a either key-value pair within the STARTPROPERTIES + * ... ENDPROPERTIES block of a BDF font or a key-value pair from the + * `info->props` array within a `FontRec` structure of a PCF font. + * + * Integer properties are always stored as 'signed' within PCF fonts; + * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value + * for BDF fonts only. + * + * In case of error, `aproperty->type` is always set to + * @BDF_PROPERTY_TYPE_NONE. + * + * This also works with SFNT fonts that have a 'BDF~' table, after a + * bitmap strike size has been selected. + */ + FT_EXPORT( FT_Error ) + FT_Get_BDF_Property( FT_Face face, + const char* prop_name, + BDF_PropertyRec *aproperty ); + + /* */ + +FT_END_HEADER + +#endif /* FTBDF_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbitmap.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbitmap.h new file mode 100644 index 0000000000000000000000000000000000000000..a22d43adf14b6b98ca6495783fb939d4c470b524 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbitmap.h @@ -0,0 +1,329 @@ +/**************************************************************************** + * + * ftbitmap.h + * + * FreeType utility functions for bitmaps (specification). + * + * Copyright (C) 2004-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTBITMAP_H_ +#define FTBITMAP_H_ + + +#include +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * bitmap_handling + * + * @title: + * Bitmap Handling + * + * @abstract: + * Handling FT_Bitmap objects. + * + * @description: + * This section contains functions for handling @FT_Bitmap objects, + * automatically adjusting the target's bitmap buffer size as needed. + * + * Note that none of the functions changes the bitmap's 'flow' (as + * indicated by the sign of the `pitch` field in @FT_Bitmap). + * + * To set the flow, assign an appropriate positive or negative value to + * the `pitch` field of the target @FT_Bitmap object after calling + * @FT_Bitmap_Init but before calling any of the other functions + * described here. + */ + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Init + * + * @description: + * Initialize a pointer to an @FT_Bitmap structure. + * + * @inout: + * abitmap :: + * A pointer to the bitmap structure. + * + * @note: + * A deprecated name for the same function is `FT_Bitmap_New`. + */ + FT_EXPORT( void ) + FT_Bitmap_Init( FT_Bitmap *abitmap ); + + + /* deprecated */ + FT_EXPORT( void ) + FT_Bitmap_New( FT_Bitmap *abitmap ); + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Copy + * + * @description: + * Copy a bitmap into another one. + * + * @input: + * library :: + * A handle to a library object. + * + * source :: + * A handle to the source bitmap. + * + * @output: + * target :: + * A handle to the target bitmap. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * `source->buffer` and `target->buffer` must neither be equal nor + * overlap. + */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Copy( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target ); + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Embolden + * + * @description: + * Embolden a bitmap. The new bitmap will be about `xStrength` pixels + * wider and `yStrength` pixels higher. The left and bottom borders are + * kept unchanged. + * + * @input: + * library :: + * A handle to a library object. + * + * xStrength :: + * How strong the glyph is emboldened horizontally. Expressed in 26.6 + * pixel format. + * + * yStrength :: + * How strong the glyph is emboldened vertically. Expressed in 26.6 + * pixel format. + * + * @inout: + * bitmap :: + * A handle to the target bitmap. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The current implementation restricts `xStrength` to be less than or + * equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. + * + * If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you + * should call @FT_GlyphSlot_Own_Bitmap on the slot first. + * + * Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are + * converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp). + */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Embolden( FT_Library library, + FT_Bitmap* bitmap, + FT_Pos xStrength, + FT_Pos yStrength ); + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Convert + * + * @description: + * Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to + * a bitmap object with depth 8bpp, making the number of used bytes per + * line (a.k.a. the 'pitch') a multiple of `alignment`. + * + * @input: + * library :: + * A handle to a library object. + * + * source :: + * The source bitmap. + * + * alignment :: + * The pitch of the bitmap is a multiple of this argument. Common + * values are 1, 2, or 4. + * + * @output: + * target :: + * The target bitmap. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * It is possible to call @FT_Bitmap_Convert multiple times without + * calling @FT_Bitmap_Done (the memory is simply reallocated). + * + * Use @FT_Bitmap_Done to finally remove the bitmap object. + * + * The `library` argument is taken to have access to FreeType's memory + * handling functions. + * + * `source->buffer` and `target->buffer` must neither be equal nor + * overlap. + */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Convert( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target, + FT_Int alignment ); + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Blend + * + * @description: + * Blend a bitmap onto another bitmap, using a given color. + * + * @input: + * library :: + * A handle to a library object. + * + * source :: + * The source bitmap, which can have any @FT_Pixel_Mode format. + * + * source_offset :: + * The offset vector to the upper left corner of the source bitmap in + * 26.6 pixel format. It should represent an integer offset; the + * function will set the lowest six bits to zero to enforce that. + * + * color :: + * The color used to draw `source` onto `target`. + * + * @inout: + * target :: + * A handle to an `FT_Bitmap` object. It should be either initialized + * as empty with a call to @FT_Bitmap_Init, or it should be of type + * @FT_PIXEL_MODE_BGRA. + * + * atarget_offset :: + * The offset vector to the upper left corner of the target bitmap in + * 26.6 pixel format. It should represent an integer offset; the + * function will set the lowest six bits to zero to enforce that. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function doesn't perform clipping. + * + * The bitmap in `target` gets allocated or reallocated as needed; the + * vector `atarget_offset` is updated accordingly. + * + * In case of allocation or reallocation, the bitmap's pitch is set to + * `4 * width`. Both `source` and `target` must have the same bitmap + * flow (as indicated by the sign of the `pitch` field). + * + * `source->buffer` and `target->buffer` must neither be equal nor + * overlap. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Blend( FT_Library library, + const FT_Bitmap* source, + const FT_Vector source_offset, + FT_Bitmap* target, + FT_Vector *atarget_offset, + FT_Color color ); + + + /************************************************************************** + * + * @function: + * FT_GlyphSlot_Own_Bitmap + * + * @description: + * Make sure that a glyph slot owns `slot->bitmap`. + * + * @input: + * slot :: + * The glyph slot. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function is to be used in combination with @FT_Bitmap_Embolden. + */ + FT_EXPORT( FT_Error ) + FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); + + + /************************************************************************** + * + * @function: + * FT_Bitmap_Done + * + * @description: + * Destroy a bitmap object initialized with @FT_Bitmap_Init. + * + * @input: + * library :: + * A handle to a library object. + * + * bitmap :: + * The bitmap object to be freed. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The `library` argument is taken to have access to FreeType's memory + * handling functions. + */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Done( FT_Library library, + FT_Bitmap *bitmap ); + + + /* */ + + +FT_END_HEADER + +#endif /* FTBITMAP_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbzip2.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbzip2.h new file mode 100644 index 0000000000000000000000000000000000000000..38b5245826ceabc206a8c07500a4bc7b5f699a6f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftbzip2.h @@ -0,0 +1,102 @@ +/**************************************************************************** + * + * ftbzip2.h + * + * Bzip2-compressed stream support. + * + * Copyright (C) 2010-2025 by + * Joel Klinghed. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTBZIP2_H_ +#define FTBZIP2_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * bzip2 + * + * @title: + * BZIP2 Streams + * + * @abstract: + * Using bzip2-compressed font files. + * + * @description: + * In certain builds of the library, bzip2 compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a bzip2 compressed + * stream from it and re-open the face with it. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream, + * which significantly undermines the performance. + * + * This section contains the declaration of Bzip2-specific functions. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Stream_OpenBzip2 + * + * @description: + * Open a new stream to parse bzip2-compressed font files. This is + * mainly used to support the compressed `*.pcf.bz2` fonts that come with + * XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close` on the new stream will + * **not** call `FT_Stream_Close` on the source stream. None of the + * stream objects will be released to the heap. + * + * This function may return `FT_Err_Unimplemented_Feature` if your build + * of FreeType was not compiled with bzip2 support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenBzip2( FT_Stream stream, + FT_Stream source ); + + /* */ + + +FT_END_HEADER + +#endif /* FTBZIP2_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcache.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcache.h new file mode 100644 index 0000000000000000000000000000000000000000..865b743a60b907e64860fcbb82b5db8975958ef1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcache.h @@ -0,0 +1,1087 @@ +/**************************************************************************** + * + * ftcache.h + * + * FreeType Cache subsystem (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTCACHE_H_ +#define FTCACHE_H_ + + +#include + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * cache_subsystem + * + * @title: + * Cache Sub-System + * + * @abstract: + * How to cache face, size, and glyph data with FreeType~2. + * + * @description: + * This section describes the FreeType~2 cache sub-system, which is used + * to limit the number of concurrently opened @FT_Face and @FT_Size + * objects, as well as caching information like character maps and glyph + * images while limiting their maximum memory usage. + * + * Note that all types and functions begin with the `FTC_` prefix rather + * than the usual `FT_` prefix in the rest of FreeType. + * + * The cache is highly portable and, thus, doesn't know anything about + * the fonts installed on your system, or how to access them. Therefore, + * it requires the following. + * + * * @FTC_FaceID, an arbitrary non-zero value that uniquely identifies + * available or installed font faces, has to be provided to the + * cache by the client. Note that the cache only stores and compares + * these values and doesn't try to interpret them in any way, but they + * have to be persistent on the client side. + * + * * @FTC_Face_Requester, a method to convert an @FTC_FaceID into a new + * @FT_Face object when necessary, has to be provided to the cache by + * the client. The @FT_Face object is completely managed by the cache, + * including its termination through @FT_Done_Face. To monitor + * termination of face objects, the finalizer callback in the `generic` + * field of the @FT_Face object can be used, which might also be used + * to store the @FTC_FaceID of the face. + * + * Clients are free to map face IDs to anything useful. The most simple + * usage is, for example, to associate them to a `{pathname,face_index}` + * pair that is then used by @FTC_Face_Requester to call @FT_New_Face. + * However, more complex schemes are also possible. + * + * Note that for the cache to work correctly, the face ID values must be + * **persistent**, which means that the contents they point to should not + * change at runtime, or that their value should not become invalid. + * If this is unavoidable (e.g., when a font is uninstalled at runtime), + * you should call @FTC_Manager_RemoveFaceID as soon as possible to let + * the cache get rid of any references to the old @FTC_FaceID it may keep + * internally. Failure to do so will lead to incorrect behaviour or even + * crashes in @FTC_Face_Requester. + * + * To use the cache, start with calling @FTC_Manager_New to create a new + * @FTC_Manager object, which models a single cache instance. You can + * then look up @FT_Face and @FT_Size objects with + * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively, and + * use them in any FreeType work stream. You can also cache other + * FreeType objects as follows. + * + * * If you want to use the charmap caching, call @FTC_CMapCache_New, + * then later use @FTC_CMapCache_Lookup to perform the equivalent of + * @FT_Get_Char_Index, only much faster. + * + * * If you want to use the @FT_Glyph caching, call @FTC_ImageCache_New, + * then later use @FTC_ImageCache_Lookup to retrieve the corresponding + * @FT_Glyph objects from the cache. + * + * * If you need lots of small bitmaps, it is much more memory-efficient + * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This + * returns @FTC_SBitRec structures, which are used to store small + * bitmaps directly. (A small bitmap is one whose metrics and + * dimensions all fit into 8-bit integers). + * + * @order: + * FTC_Manager + * FTC_FaceID + * FTC_Face_Requester + * + * FTC_Manager_New + * FTC_Manager_Reset + * FTC_Manager_Done + * FTC_Manager_LookupFace + * FTC_Manager_LookupSize + * FTC_Manager_RemoveFaceID + * + * FTC_Node + * FTC_Node_Unref + * + * FTC_ImageCache + * FTC_ImageCache_New + * FTC_ImageCache_Lookup + * + * FTC_SBit + * FTC_SBitCache + * FTC_SBitCache_New + * FTC_SBitCache_Lookup + * + * FTC_CMapCache + * FTC_CMapCache_New + * FTC_CMapCache_Lookup + * + *************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** BASIC TYPE DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @type: + * FTC_FaceID + * + * @description: + * An opaque pointer type that is used to identity face objects. The + * contents of such objects is application-dependent. + * + * These pointers are typically used to point to a user-defined structure + * containing a font file path, and face index. + * + * @note: + * Never use `NULL` as a valid @FTC_FaceID. + * + * Face IDs are passed by the client to the cache manager that calls, + * when needed, the @FTC_Face_Requester to translate them into new + * @FT_Face objects. + * + * If the content of a given face ID changes at runtime, or if the value + * becomes invalid (e.g., when uninstalling a font), you should + * immediately call @FTC_Manager_RemoveFaceID before any other cache + * function. + * + * Failure to do so will result in incorrect behaviour or even memory + * leaks and crashes. + */ + typedef FT_Pointer FTC_FaceID; + + + /************************************************************************** + * + * @functype: + * FTC_Face_Requester + * + * @description: + * A callback function provided by client applications. It is used by + * the cache manager to translate a given @FTC_FaceID into a new valid + * @FT_Face object, on demand. + * + * @input: + * face_id :: + * The face ID to resolve. + * + * library :: + * A handle to a FreeType library object. + * + * req_data :: + * Application-provided request data (see note below). + * + * @output: + * aface :: + * A new @FT_Face handle. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The third parameter `req_data` is the same as the one passed by the + * client when @FTC_Manager_New is called. + * + * The face requester should not perform funny things on the returned + * face object, like creating a new @FT_Size for it, or setting a + * transformation through @FT_Set_Transform! + */ + typedef FT_Error + (*FTC_Face_Requester)( FTC_FaceID face_id, + FT_Library library, + FT_Pointer req_data, + FT_Face* aface ); + + /* */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CACHE MANAGER OBJECT *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @type: + * FTC_Manager + * + * @description: + * This object corresponds to one instance of the cache-subsystem. It is + * used to cache one or more @FT_Face objects, along with corresponding + * @FT_Size objects. + * + * The manager intentionally limits the total number of opened @FT_Face + * and @FT_Size objects to control memory usage. See the `max_faces` and + * `max_sizes` parameters of @FTC_Manager_New. + * + * The manager is also used to cache 'nodes' of various types while + * limiting their total memory usage. + * + * All limitations are enforced by keeping lists of managed objects in + * most-recently-used order, and flushing old nodes to make room for new + * ones. + */ + typedef struct FTC_ManagerRec_* FTC_Manager; + + + /************************************************************************** + * + * @type: + * FTC_Node + * + * @description: + * An opaque handle to a cache node object. Each cache node is + * reference-counted. A node with a count of~0 might be flushed out of a + * full cache whenever a lookup request is performed. + * + * If you look up nodes, you have the ability to 'acquire' them, i.e., to + * increment their reference count. This will prevent the node from + * being flushed out of the cache until you explicitly 'release' it (see + * @FTC_Node_Unref). + * + * See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. + */ + typedef struct FTC_NodeRec_* FTC_Node; + + + /************************************************************************** + * + * @function: + * FTC_Manager_New + * + * @description: + * Create a new cache manager. + * + * @input: + * library :: + * The parent FreeType library handle to use. + * + * max_faces :: + * Maximum number of opened @FT_Face objects managed by this cache + * instance. Use~0 for defaults. + * + * max_sizes :: + * Maximum number of opened @FT_Size objects managed by this cache + * instance. Use~0 for defaults. + * + * max_bytes :: + * Maximum number of bytes to use for cached data nodes. Use~0 for + * defaults. Note that this value does not account for managed + * @FT_Face and @FT_Size objects. + * + * requester :: + * An application-provided callback used to translate face IDs into + * real @FT_Face objects. + * + * req_data :: + * A generic pointer that is passed to the requester each time it is + * called (see @FTC_Face_Requester). + * + * @output: + * amanager :: + * A handle to a new manager object. 0~in case of failure. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FTC_Manager_New( FT_Library library, + FT_UInt max_faces, + FT_UInt max_sizes, + FT_ULong max_bytes, + FTC_Face_Requester requester, + FT_Pointer req_data, + FTC_Manager *amanager ); + + + /************************************************************************** + * + * @function: + * FTC_Manager_Reset + * + * @description: + * Empty a given cache manager. This simply gets rid of all the + * currently cached @FT_Face and @FT_Size objects within the manager. + * + * @inout: + * manager :: + * A handle to the manager. + */ + FT_EXPORT( void ) + FTC_Manager_Reset( FTC_Manager manager ); + + + /************************************************************************** + * + * @function: + * FTC_Manager_Done + * + * @description: + * Destroy a given manager after emptying it. + * + * @input: + * manager :: + * A handle to the target cache manager object. + */ + FT_EXPORT( void ) + FTC_Manager_Done( FTC_Manager manager ); + + + /************************************************************************** + * + * @function: + * FTC_Manager_LookupFace + * + * @description: + * Retrieve the @FT_Face object that corresponds to a given face ID + * through a cache manager. + * + * @input: + * manager :: + * A handle to the cache manager. + * + * face_id :: + * The ID of the face object. + * + * @output: + * aface :: + * A handle to the face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The returned @FT_Face object is always owned by the manager. You + * should never try to discard it yourself. + * + * The @FT_Face object doesn't necessarily have a current size object + * (i.e., face->size can be~0). If you need a specific 'font size', use + * @FTC_Manager_LookupSize instead. + * + * Never change the face's transformation matrix (i.e., never call the + * @FT_Set_Transform function) on a returned face! If you need to + * transform glyphs, do it yourself after glyph loading. + * + * When you perform a lookup, out-of-memory errors are detected _within_ + * the lookup and force incremental flushes of the cache until enough + * memory is released for the lookup to succeed. + * + * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already + * been completely flushed, and still no memory was available for the + * operation. + */ + FT_EXPORT( FT_Error ) + FTC_Manager_LookupFace( FTC_Manager manager, + FTC_FaceID face_id, + FT_Face *aface ); + + + /************************************************************************** + * + * @struct: + * FTC_ScalerRec + * + * @description: + * A structure used to describe a given character size in either pixels + * or points to the cache manager. See @FTC_Manager_LookupSize. + * + * @fields: + * face_id :: + * The source face ID. + * + * width :: + * The character width. + * + * height :: + * The character height. + * + * pixel :: + * A Boolean. If 1, the `width` and `height` fields are interpreted as + * integer pixel character sizes. Otherwise, they are expressed as + * 1/64 of points. + * + * x_res :: + * Only used when `pixel` is value~0 to indicate the horizontal + * resolution in dpi. + * + * y_res :: + * Only used when `pixel` is value~0 to indicate the vertical + * resolution in dpi. + * + * @note: + * This type is mainly used to retrieve @FT_Size objects through the + * cache manager. + */ + typedef struct FTC_ScalerRec_ + { + FTC_FaceID face_id; + FT_UInt width; + FT_UInt height; + FT_Int pixel; + FT_UInt x_res; + FT_UInt y_res; + + } FTC_ScalerRec; + + + /************************************************************************** + * + * @struct: + * FTC_Scaler + * + * @description: + * A handle to an @FTC_ScalerRec structure. + */ + typedef struct FTC_ScalerRec_* FTC_Scaler; + + + /************************************************************************** + * + * @function: + * FTC_Manager_LookupSize + * + * @description: + * Retrieve the @FT_Size object that corresponds to a given + * @FTC_ScalerRec pointer through a cache manager. + * + * @input: + * manager :: + * A handle to the cache manager. + * + * scaler :: + * A scaler handle. + * + * @output: + * asize :: + * A handle to the size object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The returned @FT_Size object is always owned by the manager. You + * should never try to discard it by yourself. + * + * You can access the parent @FT_Face object simply as `size->face` if + * you need it. Note that this object is also owned by the manager. + * + * @note: + * When you perform a lookup, out-of-memory errors are detected _within_ + * the lookup and force incremental flushes of the cache until enough + * memory is released for the lookup to succeed. + * + * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already + * been completely flushed, and still no memory is available for the + * operation. + */ + FT_EXPORT( FT_Error ) + FTC_Manager_LookupSize( FTC_Manager manager, + FTC_Scaler scaler, + FT_Size *asize ); + + + /************************************************************************** + * + * @function: + * FTC_Node_Unref + * + * @description: + * Decrement a cache node's internal reference count. When the count + * reaches 0, it is not destroyed but becomes eligible for subsequent + * cache flushes. + * + * @input: + * node :: + * The cache node handle. + * + * manager :: + * The cache manager handle. + */ + FT_EXPORT( void ) + FTC_Node_Unref( FTC_Node node, + FTC_Manager manager ); + + + /************************************************************************** + * + * @function: + * FTC_Manager_RemoveFaceID + * + * @description: + * A special function used to indicate to the cache manager that a given + * @FTC_FaceID is no longer valid, either because its content changed, or + * because it was deallocated or uninstalled. + * + * @input: + * manager :: + * The cache manager handle. + * + * face_id :: + * The @FTC_FaceID to be removed. + * + * @note: + * This function flushes all nodes from the cache corresponding to this + * `face_id`, with the exception of nodes with a non-null reference + * count. + * + * Such nodes are however modified internally so as to never appear in + * later lookups with the same `face_id` value, and to be immediately + * destroyed when released by all their users. + * + */ + FT_EXPORT( void ) + FTC_Manager_RemoveFaceID( FTC_Manager manager, + FTC_FaceID face_id ); + + + /************************************************************************** + * + * @type: + * FTC_CMapCache + * + * @description: + * An opaque handle used to model a charmap cache. This cache is to hold + * character codes -> glyph indices mappings. + * + */ + typedef struct FTC_CMapCacheRec_* FTC_CMapCache; + + + /************************************************************************** + * + * @function: + * FTC_CMapCache_New + * + * @description: + * Create a new charmap cache. + * + * @input: + * manager :: + * A handle to the cache manager. + * + * @output: + * acache :: + * A new cache handle. `NULL` in case of error. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Like all other caches, this one will be destroyed with the cache + * manager. + * + */ + FT_EXPORT( FT_Error ) + FTC_CMapCache_New( FTC_Manager manager, + FTC_CMapCache *acache ); + + + /************************************************************************** + * + * @function: + * FTC_CMapCache_Lookup + * + * @description: + * Translate a character code into a glyph index, using the charmap + * cache. + * + * @input: + * cache :: + * A charmap cache handle. + * + * face_id :: + * The source face ID. + * + * cmap_index :: + * The index of the charmap in the source face. Any negative value + * means to use the cache @FT_Face's default charmap. + * + * char_code :: + * The character code (in the corresponding charmap). + * + * @return: + * Glyph index. 0~means 'no glyph'. + * + */ + FT_EXPORT( FT_UInt ) + FTC_CMapCache_Lookup( FTC_CMapCache cache, + FTC_FaceID face_id, + FT_Int cmap_index, + FT_UInt32 char_code ); + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** IMAGE CACHE OBJECT *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @struct: + * FTC_ImageTypeRec + * + * @description: + * A structure used to model the type of images in a glyph cache. + * + * @fields: + * face_id :: + * The face ID. + * + * width :: + * The width in pixels. + * + * height :: + * The height in pixels. + * + * flags :: + * The load flags, as in @FT_Load_Glyph. + * + */ + typedef struct FTC_ImageTypeRec_ + { + FTC_FaceID face_id; + FT_UInt width; + FT_UInt height; + FT_Int32 flags; + + } FTC_ImageTypeRec; + + + /************************************************************************** + * + * @type: + * FTC_ImageType + * + * @description: + * A handle to an @FTC_ImageTypeRec structure. + * + */ + typedef struct FTC_ImageTypeRec_* FTC_ImageType; + + + /* */ + + +#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \ + ( (d1)->face_id == (d2)->face_id && \ + (d1)->width == (d2)->width && \ + (d1)->flags == (d2)->flags ) + + + /************************************************************************** + * + * @type: + * FTC_ImageCache + * + * @description: + * A handle to a glyph image cache object. They are designed to hold + * many distinct glyph images while not exceeding a certain memory + * threshold. + */ + typedef struct FTC_ImageCacheRec_* FTC_ImageCache; + + + /************************************************************************** + * + * @function: + * FTC_ImageCache_New + * + * @description: + * Create a new glyph image cache. + * + * @input: + * manager :: + * The parent manager for the image cache. + * + * @output: + * acache :: + * A handle to the new glyph image cache object. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FTC_ImageCache_New( FTC_Manager manager, + FTC_ImageCache *acache ); + + + /************************************************************************** + * + * @function: + * FTC_ImageCache_Lookup + * + * @description: + * Retrieve a given glyph image from a glyph image cache. + * + * @input: + * cache :: + * A handle to the source glyph image cache. + * + * type :: + * A pointer to a glyph image type descriptor. + * + * gindex :: + * The glyph index to retrieve. + * + * @output: + * aglyph :: + * The corresponding @FT_Glyph object. 0~in case of failure. + * + * anode :: + * Used to return the address of the corresponding cache node after + * incrementing its reference count (see note below). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The returned glyph is owned and managed by the glyph image cache. + * Never try to transform or discard it manually! You can however create + * a copy with @FT_Glyph_Copy and modify the new one. + * + * If `anode` is _not_ `NULL`, it receives the address of the cache node + * containing the glyph image, after increasing its reference count. + * This ensures that the node (as well as the @FT_Glyph) will always be + * kept in the cache until you call @FTC_Node_Unref to 'release' it. + * + * If `anode` is `NULL`, the cache node is left unchanged, which means + * that the @FT_Glyph could be flushed out of the cache on the next call + * to one of the caching sub-system APIs. Don't assume that it is + * persistent! + */ + FT_EXPORT( FT_Error ) + FTC_ImageCache_Lookup( FTC_ImageCache cache, + FTC_ImageType type, + FT_UInt gindex, + FT_Glyph *aglyph, + FTC_Node *anode ); + + + /************************************************************************** + * + * @function: + * FTC_ImageCache_LookupScaler + * + * @description: + * A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec to + * specify the face ID and its size. + * + * @input: + * cache :: + * A handle to the source glyph image cache. + * + * scaler :: + * A pointer to a scaler descriptor. + * + * load_flags :: + * The corresponding load flags. + * + * gindex :: + * The glyph index to retrieve. + * + * @output: + * aglyph :: + * The corresponding @FT_Glyph object. 0~in case of failure. + * + * anode :: + * Used to return the address of the corresponding cache node after + * incrementing its reference count (see note below). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The returned glyph is owned and managed by the glyph image cache. + * Never try to transform or discard it manually! You can however create + * a copy with @FT_Glyph_Copy and modify the new one. + * + * If `anode` is _not_ `NULL`, it receives the address of the cache node + * containing the glyph image, after increasing its reference count. + * This ensures that the node (as well as the @FT_Glyph) will always be + * kept in the cache until you call @FTC_Node_Unref to 'release' it. + * + * If `anode` is `NULL`, the cache node is left unchanged, which means + * that the @FT_Glyph could be flushed out of the cache on the next call + * to one of the caching sub-system APIs. Don't assume that it is + * persistent! + * + * Calls to @FT_Set_Char_Size and friends have no effect on cached + * glyphs; you should always use the FreeType cache API instead. + */ + FT_EXPORT( FT_Error ) + FTC_ImageCache_LookupScaler( FTC_ImageCache cache, + FTC_Scaler scaler, + FT_ULong load_flags, + FT_UInt gindex, + FT_Glyph *aglyph, + FTC_Node *anode ); + + + /************************************************************************** + * + * @type: + * FTC_SBit + * + * @description: + * A handle to a small bitmap descriptor. See the @FTC_SBitRec structure + * for details. + */ + typedef struct FTC_SBitRec_* FTC_SBit; + + + /************************************************************************** + * + * @struct: + * FTC_SBitRec + * + * @description: + * A very compact structure used to describe a small glyph bitmap. + * + * @fields: + * width :: + * The bitmap width in pixels. + * + * height :: + * The bitmap height in pixels. + * + * left :: + * The horizontal distance from the pen position to the left bitmap + * border (a.k.a. 'left side bearing', or 'lsb'). + * + * top :: + * The vertical distance from the pen position (on the baseline) to the + * upper bitmap border (a.k.a. 'top side bearing'). The distance is + * positive for upwards y~coordinates. + * + * format :: + * The format of the glyph bitmap (monochrome or gray). + * + * max_grays :: + * Maximum gray level value (in the range 1 to~255). + * + * pitch :: + * The number of bytes per bitmap line. May be positive or negative. + * + * xadvance :: + * The horizontal advance width in pixels. + * + * yadvance :: + * The vertical advance height in pixels. + * + * buffer :: + * A pointer to the bitmap pixels. + */ + typedef struct FTC_SBitRec_ + { + FT_Byte width; + FT_Byte height; + FT_Char left; + FT_Char top; + + FT_Byte format; + FT_Byte max_grays; + FT_Short pitch; + FT_Char xadvance; + FT_Char yadvance; + + FT_Byte* buffer; + + } FTC_SBitRec; + + + /************************************************************************** + * + * @type: + * FTC_SBitCache + * + * @description: + * A handle to a small bitmap cache. These are special cache objects + * used to store small glyph bitmaps (and anti-aliased pixmaps) in a much + * more efficient way than the traditional glyph image cache implemented + * by @FTC_ImageCache. + */ + typedef struct FTC_SBitCacheRec_* FTC_SBitCache; + + + /************************************************************************** + * + * @function: + * FTC_SBitCache_New + * + * @description: + * Create a new cache to store small glyph bitmaps. + * + * @input: + * manager :: + * A handle to the source cache manager. + * + * @output: + * acache :: + * A handle to the new sbit cache. `NULL` in case of error. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FTC_SBitCache_New( FTC_Manager manager, + FTC_SBitCache *acache ); + + + /************************************************************************** + * + * @function: + * FTC_SBitCache_Lookup + * + * @description: + * Look up a given small glyph bitmap in a given sbit cache and 'lock' it + * to prevent its flushing from the cache until needed. + * + * @input: + * cache :: + * A handle to the source sbit cache. + * + * type :: + * A pointer to the glyph image type descriptor. + * + * gindex :: + * The glyph index. + * + * @output: + * sbit :: + * A handle to a small bitmap descriptor. + * + * anode :: + * Used to return the address of the corresponding cache node after + * incrementing its reference count (see note below). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The small bitmap descriptor and its bit buffer are owned by the cache + * and should never be freed by the application. They might as well + * disappear from memory on the next cache lookup, so don't treat them as + * persistent data. + * + * The descriptor's `buffer` field is set to~0 to indicate a missing + * glyph bitmap. + * + * If `anode` is _not_ `NULL`, it receives the address of the cache node + * containing the bitmap, after increasing its reference count. This + * ensures that the node (as well as the image) will always be kept in + * the cache until you call @FTC_Node_Unref to 'release' it. + * + * If `anode` is `NULL`, the cache node is left unchanged, which means + * that the bitmap could be flushed out of the cache on the next call to + * one of the caching sub-system APIs. Don't assume that it is + * persistent! + */ + FT_EXPORT( FT_Error ) + FTC_SBitCache_Lookup( FTC_SBitCache cache, + FTC_ImageType type, + FT_UInt gindex, + FTC_SBit *sbit, + FTC_Node *anode ); + + + /************************************************************************** + * + * @function: + * FTC_SBitCache_LookupScaler + * + * @description: + * A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec to + * specify the face ID and its size. + * + * @input: + * cache :: + * A handle to the source sbit cache. + * + * scaler :: + * A pointer to the scaler descriptor. + * + * load_flags :: + * The corresponding load flags. + * + * gindex :: + * The glyph index. + * + * @output: + * sbit :: + * A handle to a small bitmap descriptor. + * + * anode :: + * Used to return the address of the corresponding cache node after + * incrementing its reference count (see note below). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The small bitmap descriptor and its bit buffer are owned by the cache + * and should never be freed by the application. They might as well + * disappear from memory on the next cache lookup, so don't treat them as + * persistent data. + * + * The descriptor's `buffer` field is set to~0 to indicate a missing + * glyph bitmap. + * + * If `anode` is _not_ `NULL`, it receives the address of the cache node + * containing the bitmap, after increasing its reference count. This + * ensures that the node (as well as the image) will always be kept in + * the cache until you call @FTC_Node_Unref to 'release' it. + * + * If `anode` is `NULL`, the cache node is left unchanged, which means + * that the bitmap could be flushed out of the cache on the next call to + * one of the caching sub-system APIs. Don't assume that it is + * persistent! + */ + FT_EXPORT( FT_Error ) + FTC_SBitCache_LookupScaler( FTC_SBitCache cache, + FTC_Scaler scaler, + FT_ULong load_flags, + FT_UInt gindex, + FTC_SBit *sbit, + FTC_Node *anode ); + + /* */ + + +FT_END_HEADER + +#endif /* FTCACHE_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftchapters.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftchapters.h new file mode 100644 index 0000000000000000000000000000000000000000..7566fbd10f83de079bea84947b1f7d56fba720f0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftchapters.h @@ -0,0 +1,168 @@ +/**************************************************************************** + * + * This file defines the structure of the FreeType reference. + * It is used by the python script that generates the HTML files. + * + */ + + + /************************************************************************** + * + * @chapter: + * general_remarks + * + * @title: + * General Remarks + * + * @sections: + * preamble + * header_inclusion + * user_allocation + * + */ + + + /************************************************************************** + * + * @chapter: + * core_api + * + * @title: + * Core API + * + * @sections: + * basic_types + * library_setup + * face_creation + * font_testing_macros + * sizing_and_scaling + * glyph_retrieval + * character_mapping + * information_retrieval + * other_api_data + * + */ + + + /************************************************************************** + * + * @chapter: + * extended_api + * + * @title: + * Extended API + * + * @sections: + * glyph_variants + * color_management + * layer_management + * glyph_management + * mac_specific + * sizes_management + * header_file_macros + * + */ + + + /************************************************************************** + * + * @chapter: + * format_specific + * + * @title: + * Format-Specific API + * + * @sections: + * multiple_masters + * truetype_tables + * type1_tables + * sfnt_names + * bdf_fonts + * cid_fonts + * pfr_fonts + * winfnt_fonts + * svg_fonts + * font_formats + * gasp_table + * + */ + + + /************************************************************************** + * + * @chapter: + * module_specific + * + * @title: + * Controlling FreeType Modules + * + * @sections: + * auto_hinter + * cff_driver + * t1_cid_driver + * tt_driver + * pcf_driver + * ot_svg_driver + * properties + * parameter_tags + * lcd_rendering + * + */ + + + /************************************************************************** + * + * @chapter: + * cache_subsystem + * + * @title: + * Cache Sub-System + * + * @sections: + * cache_subsystem + * + */ + + + /************************************************************************** + * + * @chapter: + * support_api + * + * @title: + * Support API + * + * @sections: + * computations + * list_processing + * outline_processing + * quick_advance + * bitmap_handling + * raster + * glyph_stroker + * system_interface + * module_management + * gzip + * lzw + * bzip2 + * debugging_apis + * + */ + + + /************************************************************************** + * + * @chapter: + * error_codes + * + * @title: + * Error Codes + * + * @sections: + * error_enumerations + * error_code_values + * + */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcid.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcid.h new file mode 100644 index 0000000000000000000000000000000000000000..7cda8ff3f39a360851a8ff9b03ad5c04a2e6e19c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcid.h @@ -0,0 +1,167 @@ +/**************************************************************************** + * + * ftcid.h + * + * FreeType API for accessing CID font information (specification). + * + * Copyright (C) 2007-2025 by + * Dereg Clegg and Michael Toftdal. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTCID_H_ +#define FTCID_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * cid_fonts + * + * @title: + * CID Fonts + * + * @abstract: + * CID-keyed font-specific API. + * + * @description: + * This section contains the declaration of CID-keyed font-specific + * functions. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Get_CID_Registry_Ordering_Supplement + * + * @description: + * Retrieve the Registry/Ordering/Supplement triple (also known as the + * "R/O/S") from a CID-keyed font. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * registry :: + * The registry, as a C~string, owned by the face. + * + * ordering :: + * The ordering, as a C~string, owned by the face. + * + * supplement :: + * The supplement. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces, returning an error + * otherwise. + * + * @since: + * 2.3.6 + */ + FT_EXPORT( FT_Error ) + FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, + const char* *registry, + const char* *ordering, + FT_Int *supplement ); + + + /************************************************************************** + * + * @function: + * FT_Get_CID_Is_Internally_CID_Keyed + * + * @description: + * Retrieve the type of the input face, CID keyed or not. In contrast + * to the @FT_IS_CID_KEYED macro this function returns successfully also + * for CID-keyed fonts in an SFNT wrapper. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * is_cid :: + * The type of the face as an @FT_Bool. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces and OpenType fonts, returning + * an error otherwise. + * + * @since: + * 2.3.9 + */ + FT_EXPORT( FT_Error ) + FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, + FT_Bool *is_cid ); + + + /************************************************************************** + * + * @function: + * FT_Get_CID_From_Glyph_Index + * + * @description: + * Retrieve the CID of the input glyph index. + * + * @input: + * face :: + * A handle to the input face. + * + * glyph_index :: + * The input glyph index. + * + * @output: + * cid :: + * The CID as an @FT_UInt. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces and OpenType fonts, returning + * an error otherwise. + * + * @since: + * 2.3.9 + */ + FT_EXPORT( FT_Error ) + FT_Get_CID_From_Glyph_Index( FT_Face face, + FT_UInt glyph_index, + FT_UInt *cid ); + + /* */ + + +FT_END_HEADER + +#endif /* FTCID_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcolor.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcolor.h new file mode 100644 index 0000000000000000000000000000000000000000..129b1a23fb03abf932ba93b315150ba8ad6792ff --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftcolor.h @@ -0,0 +1,1676 @@ +/**************************************************************************** + * + * ftcolor.h + * + * FreeType's glyph color management (specification). + * + * Copyright (C) 2018-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTCOLOR_H_ +#define FTCOLOR_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * color_management + * + * @title: + * Glyph Color Management + * + * @abstract: + * Retrieving and manipulating OpenType's 'CPAL' table data. + * + * @description: + * The functions described here allow access and manipulation of color + * palette entries in OpenType's 'CPAL' tables. + */ + + + /************************************************************************** + * + * @struct: + * FT_Color + * + * @description: + * This structure models a BGRA color value of a 'CPAL' palette entry. + * + * The used color space is sRGB; the colors are not pre-multiplied, and + * alpha values must be explicitly set. + * + * @fields: + * blue :: + * Blue value. + * + * green :: + * Green value. + * + * red :: + * Red value. + * + * alpha :: + * Alpha value, giving the red, green, and blue color's opacity. + * + * @since: + * 2.10 + */ + typedef struct FT_Color_ + { + FT_Byte blue; + FT_Byte green; + FT_Byte red; + FT_Byte alpha; + + } FT_Color; + + + /************************************************************************** + * + * @enum: + * FT_PALETTE_XXX + * + * @description: + * A list of bit field constants used in the `palette_flags` array of the + * @FT_Palette_Data structure to indicate for which background a palette + * with a given index is usable. + * + * @values: + * FT_PALETTE_FOR_LIGHT_BACKGROUND :: + * The palette is appropriate to use when displaying the font on a + * light background such as white. + * + * FT_PALETTE_FOR_DARK_BACKGROUND :: + * The palette is appropriate to use when displaying the font on a dark + * background such as black. + * + * @since: + * 2.10 + */ +#define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01 +#define FT_PALETTE_FOR_DARK_BACKGROUND 0x02 + + + /************************************************************************** + * + * @struct: + * FT_Palette_Data + * + * @description: + * This structure holds the data of the 'CPAL' table. + * + * @fields: + * num_palettes :: + * The number of palettes. + * + * palette_name_ids :: + * An optional read-only array of palette name IDs with `num_palettes` + * elements, corresponding to entries like 'dark' or 'light' in the + * font's 'name' table. + * + * An empty name ID in the 'CPAL' table gets represented as value + * 0xFFFF. + * + * `NULL` if the font's 'CPAL' table doesn't contain appropriate data. + * + * palette_flags :: + * An optional read-only array of palette flags with `num_palettes` + * elements. Possible values are an ORed combination of + * @FT_PALETTE_FOR_LIGHT_BACKGROUND and + * @FT_PALETTE_FOR_DARK_BACKGROUND. + * + * `NULL` if the font's 'CPAL' table doesn't contain appropriate data. + * + * num_palette_entries :: + * The number of entries in a single palette. All palettes have the + * same size. + * + * palette_entry_name_ids :: + * An optional read-only array of palette entry name IDs with + * `num_palette_entries`. In each palette, entries with the same index + * have the same function. For example, index~0 might correspond to + * string 'outline' in the font's 'name' table to indicate that this + * palette entry is used for outlines, index~1 might correspond to + * 'fill' to indicate the filling color palette entry, etc. + * + * An empty entry name ID in the 'CPAL' table gets represented as value + * 0xFFFF. + * + * `NULL` if the font's 'CPAL' table doesn't contain appropriate data. + * + * @note: + * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to + * name strings. + * + * Use function @FT_Palette_Select to get the colors associated with a + * palette entry. + * + * @since: + * 2.10 + */ + typedef struct FT_Palette_Data_ { + FT_UShort num_palettes; + const FT_UShort* palette_name_ids; + const FT_UShort* palette_flags; + + FT_UShort num_palette_entries; + const FT_UShort* palette_entry_name_ids; + + } FT_Palette_Data; + + + /************************************************************************** + * + * @function: + * FT_Palette_Data_Get + * + * @description: + * Retrieve the face's color palette data. + * + * @input: + * face :: + * The source face handle. + * + * @output: + * apalette :: + * A pointer to an @FT_Palette_Data structure. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * All arrays in the returned @FT_Palette_Data structure are read-only. + * + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Palette_Data_Get( FT_Face face, + FT_Palette_Data *apalette ); + + + /************************************************************************** + * + * @function: + * FT_Palette_Select + * + * @description: + * This function has two purposes. + * + * (1) It activates a palette for rendering color glyphs, and + * + * (2) it retrieves all (unmodified) color entries of this palette. This + * function returns a read-write array, which means that a calling + * application can modify the palette entries on demand. + * + * A corollary of (2) is that calling the function, then modifying some + * values, then calling the function again with the same arguments resets + * all color entries to the original 'CPAL' values; all user modifications + * are lost. + * + * @input: + * face :: + * The source face handle. + * + * palette_index :: + * The palette index. + * + * @output: + * apalette :: + * An array of color entries for a palette with index `palette_index`, + * having `num_palette_entries` elements (as found in the + * `FT_Palette_Data` structure). If `apalette` is set to `NULL`, no + * array gets returned (and no color entries can be modified). + * + * In case the font doesn't support color palettes, `NULL` is returned. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The array pointed to by `apalette_entries` is owned and managed by + * FreeType. + * + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Palette_Select( FT_Face face, + FT_UShort palette_index, + FT_Color* *apalette ); + + + /************************************************************************** + * + * @function: + * FT_Palette_Set_Foreground_Color + * + * @description: + * 'COLR' uses palette index 0xFFFF to indicate a 'text foreground + * color'. This function sets this value. + * + * @input: + * face :: + * The source face handle. + * + * foreground_color :: + * An `FT_Color` structure to define the text foreground color. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If this function isn't called, the text foreground color is set to + * white opaque (BGRA value 0xFFFFFFFF) if + * @FT_PALETTE_FOR_DARK_BACKGROUND is present for the current palette, + * and black opaque (BGRA value 0x000000FF) otherwise, including the case + * that no palette types are available in the 'CPAL' table. + * + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Palette_Set_Foreground_Color( FT_Face face, + FT_Color foreground_color ); + + + /************************************************************************** + * + * @section: + * layer_management + * + * @title: + * Glyph Layer Management + * + * @abstract: + * Retrieving and manipulating OpenType's 'COLR' table data. + * + * @description: + * The functions described here allow access of colored glyph layer data + * in OpenType's 'COLR' tables. + * + * Note that FreeType does *not* provide rendering in general of glyphs + * that use a 'COLR' table! While FreeType has very limited rendering + * support for 'COLR' v0 tables (without a possibility to change the + * color palette) via @FT_Render_Glyph, there is no such convenience + * code for 'COLR' v1 tables -- while it appears that v1 is simply an + * 'improved' version of v0, this is not the case: it is a completely + * different color font format, and you need a dedicated graphics + * library like Skia or Cairo to handle a v1 table's drawing commands. + */ + + + /************************************************************************** + * + * @struct: + * FT_LayerIterator + * + * @description: + * This iterator object is needed for @FT_Get_Color_Glyph_Layer. + * + * @fields: + * num_layers :: + * The number of glyph layers for the requested glyph index. Will be + * set by @FT_Get_Color_Glyph_Layer. + * + * layer :: + * The current layer. Will be set by @FT_Get_Color_Glyph_Layer. + * + * p :: + * An opaque pointer into 'COLR' table data. The caller must set this + * to `NULL` before the first call of @FT_Get_Color_Glyph_Layer. + */ + typedef struct FT_LayerIterator_ + { + FT_UInt num_layers; + FT_UInt layer; + FT_Byte* p; + + } FT_LayerIterator; + + + /************************************************************************** + * + * @function: + * FT_Get_Color_Glyph_Layer + * + * @description: + * This is an interface to the 'COLR' table in OpenType fonts to + * iteratively retrieve the colored glyph layers associated with the + * current glyph slot. + * + * https://learn.microsoft.com/typography/opentype/spec/colr + * + * The glyph layer data for a given glyph index, if present, provides an + * alternative, multi-color glyph representation: Instead of rendering + * the outline or bitmap with the given glyph index, glyphs with the + * indices and colors returned by this function are rendered layer by + * layer. + * + * The returned elements are ordered in the z~direction from bottom to + * top; the 'n'th element should be rendered with the associated palette + * color and blended on top of the already rendered layers (elements 0, + * 1, ..., n-1). + * + * @input: + * face :: + * A handle to the parent face object. + * + * base_glyph :: + * The glyph index the colored glyph layers are associated with. + * + * @inout: + * iterator :: + * An @FT_LayerIterator object. For the first call you should set + * `iterator->p` to `NULL`. For all following calls, simply use the + * same object again. + * + * @output: + * aglyph_index :: + * The glyph index of the current layer. + * + * acolor_index :: + * The color index into the font face's color palette of the current + * layer. The value 0xFFFF is special; it doesn't reference a palette + * entry but indicates that the text foreground color should be used + * instead (to be set up by the application outside of FreeType). + * + * The color palette can be retrieved with @FT_Palette_Select. + * + * @return: + * Value~1 if everything is OK. If there are no more layers (or if there + * are no layers at all), value~0 gets returned. In case of an error, + * value~0 is returned also. + * + * @note: + * This function is necessary if you want to handle glyph layers by + * yourself. In particular, functions that operate with @FT_GlyphRec + * objects (like @FT_Get_Glyph or @FT_Glyph_To_Bitmap) don't have access + * to this information. + * + * Note that @FT_Render_Glyph is able to handle colored glyph layers + * automatically if the @FT_LOAD_COLOR flag is passed to a previous call + * to @FT_Load_Glyph. [This is an experimental feature.] + * + * @example: + * ``` + * FT_Color* palette; + * FT_LayerIterator iterator; + * + * FT_Bool have_layers; + * FT_UInt layer_glyph_index; + * FT_UInt layer_color_index; + * + * + * error = FT_Palette_Select( face, palette_index, &palette ); + * if ( error ) + * palette = NULL; + * + * iterator.p = NULL; + * have_layers = FT_Get_Color_Glyph_Layer( face, + * glyph_index, + * &layer_glyph_index, + * &layer_color_index, + * &iterator ); + * + * if ( palette && have_layers ) + * { + * do + * { + * FT_Color layer_color; + * + * + * if ( layer_color_index == 0xFFFF ) + * layer_color = text_foreground_color; + * else + * layer_color = palette[layer_color_index]; + * + * // Load and render glyph `layer_glyph_index', then + * // blend resulting pixmap (using color `layer_color') + * // with previously created pixmaps. + * + * } while ( FT_Get_Color_Glyph_Layer( face, + * glyph_index, + * &layer_glyph_index, + * &layer_color_index, + * &iterator ) ); + * } + * ``` + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Color_Glyph_Layer( FT_Face face, + FT_UInt base_glyph, + FT_UInt *aglyph_index, + FT_UInt *acolor_index, + FT_LayerIterator* iterator ); + + + /************************************************************************** + * + * @enum: + * FT_PaintFormat + * + * @description: + * Enumeration describing the different paint format types of the v1 + * extensions to the 'COLR' table, see + * 'https://github.com/googlefonts/colr-gradients-spec'. + * + * The enumeration values loosely correspond with the format numbers of + * the specification: FreeType always returns a fully specified 'Paint' + * structure for the 'Transform', 'Translate', 'Scale', 'Rotate', and + * 'Skew' table types even though the specification has different formats + * depending on whether or not a center is specified, whether the scale + * is uniform in x and y~direction or not, etc. Also, only non-variable + * format identifiers are listed in this enumeration; as soon as support + * for variable 'COLR' v1 fonts is implemented, interpolation is + * performed dependent on axis coordinates, which are configured on the + * @FT_Face through @FT_Set_Var_Design_Coordinates. This implies that + * always static, readily interpolated values are returned in the 'Paint' + * structures. + * + * @since: + * 2.13 + */ + typedef enum FT_PaintFormat_ + { + FT_COLR_PAINTFORMAT_COLR_LAYERS = 1, + FT_COLR_PAINTFORMAT_SOLID = 2, + FT_COLR_PAINTFORMAT_LINEAR_GRADIENT = 4, + FT_COLR_PAINTFORMAT_RADIAL_GRADIENT = 6, + FT_COLR_PAINTFORMAT_SWEEP_GRADIENT = 8, + FT_COLR_PAINTFORMAT_GLYPH = 10, + FT_COLR_PAINTFORMAT_COLR_GLYPH = 11, + FT_COLR_PAINTFORMAT_TRANSFORM = 12, + FT_COLR_PAINTFORMAT_TRANSLATE = 14, + FT_COLR_PAINTFORMAT_SCALE = 16, + FT_COLR_PAINTFORMAT_ROTATE = 24, + FT_COLR_PAINTFORMAT_SKEW = 28, + FT_COLR_PAINTFORMAT_COMPOSITE = 32, + FT_COLR_PAINT_FORMAT_MAX = 33, + FT_COLR_PAINTFORMAT_UNSUPPORTED = 255 + + } FT_PaintFormat; + + + /************************************************************************** + * + * @struct: + * FT_ColorStopIterator + * + * @description: + * This iterator object is needed for @FT_Get_Colorline_Stops. It keeps + * state while iterating over the stops of an @FT_ColorLine, representing + * the `ColorLine` struct of the v1 extensions to 'COLR', see + * 'https://github.com/googlefonts/colr-gradients-spec'. Do not manually + * modify fields of this iterator. + * + * @fields: + * num_color_stops :: + * The number of color stops for the requested glyph index. Set by + * @FT_Get_Paint. + * + * current_color_stop :: + * The current color stop. Set by @FT_Get_Colorline_Stops. + * + * p :: + * An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint. + * Updated by @FT_Get_Colorline_Stops. + * + * read_variable :: + * A boolean keeping track of whether variable color lines are to be + * read. Set by @FT_Get_Paint. + * + * @since: + * 2.13 + */ + typedef struct FT_ColorStopIterator_ + { + FT_UInt num_color_stops; + FT_UInt current_color_stop; + + FT_Byte* p; + + FT_Bool read_variable; + + } FT_ColorStopIterator; + + + /************************************************************************** + * + * @struct: + * FT_ColorIndex + * + * @description: + * A structure representing a `ColorIndex` value of the 'COLR' v1 + * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'. + * + * @fields: + * palette_index :: + * The palette index into a 'CPAL' palette. + * + * alpha :: + * Alpha transparency value multiplied with the value from 'CPAL'. + * + * @since: + * 2.13 + */ + typedef struct FT_ColorIndex_ + { + FT_UInt16 palette_index; + FT_F2Dot14 alpha; + + } FT_ColorIndex; + + + /************************************************************************** + * + * @struct: + * FT_ColorStop + * + * @description: + * A structure representing a `ColorStop` value of the 'COLR' v1 + * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'. + * + * @fields: + * stop_offset :: + * The stop offset along the gradient, expressed as a 16.16 fixed-point + * coordinate. + * + * color :: + * The color information for this stop, see @FT_ColorIndex. + * + * @since: + * 2.13 + */ + typedef struct FT_ColorStop_ + { + FT_Fixed stop_offset; + FT_ColorIndex color; + + } FT_ColorStop; + + + /************************************************************************** + * + * @enum: + * FT_PaintExtend + * + * @description: + * An enumeration representing the 'Extend' mode of the 'COLR' v1 + * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'. + * It describes how the gradient fill continues at the other boundaries. + * + * @since: + * 2.13 + */ + typedef enum FT_PaintExtend_ + { + FT_COLR_PAINT_EXTEND_PAD = 0, + FT_COLR_PAINT_EXTEND_REPEAT = 1, + FT_COLR_PAINT_EXTEND_REFLECT = 2 + + } FT_PaintExtend; + + + /************************************************************************** + * + * @struct: + * FT_ColorLine + * + * @description: + * A structure representing a `ColorLine` value of the 'COLR' v1 + * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'. + * It describes a list of color stops along the defined gradient. + * + * @fields: + * extend :: + * The extend mode at the outer boundaries, see @FT_PaintExtend. + * + * color_stop_iterator :: + * The @FT_ColorStopIterator used to enumerate and retrieve the + * actual @FT_ColorStop's. + * + * @since: + * 2.13 + */ + typedef struct FT_ColorLine_ + { + FT_PaintExtend extend; + FT_ColorStopIterator color_stop_iterator; + + } FT_ColorLine; + + + /************************************************************************** + * + * @struct: + * FT_Affine23 + * + * @description: + * A structure used to store a 2x3 matrix. Coefficients are in + * 16.16 fixed-point format. The computation performed is + * + * ``` + * x' = x*xx + y*xy + dx + * y' = x*yx + y*yy + dy + * ``` + * + * @fields: + * xx :: + * Matrix coefficient. + * + * xy :: + * Matrix coefficient. + * + * dx :: + * x translation. + * + * yx :: + * Matrix coefficient. + * + * yy :: + * Matrix coefficient. + * + * dy :: + * y translation. + * + * @since: + * 2.13 + */ + typedef struct FT_Affine_23_ + { + FT_Fixed xx, xy, dx; + FT_Fixed yx, yy, dy; + + } FT_Affine23; + + + /************************************************************************** + * + * @enum: + * FT_Composite_Mode + * + * @description: + * An enumeration listing the 'COLR' v1 composite modes used in + * @FT_PaintComposite. For more details on each paint mode, see + * 'https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators'. + * + * @since: + * 2.13 + */ + typedef enum FT_Composite_Mode_ + { + FT_COLR_COMPOSITE_CLEAR = 0, + FT_COLR_COMPOSITE_SRC = 1, + FT_COLR_COMPOSITE_DEST = 2, + FT_COLR_COMPOSITE_SRC_OVER = 3, + FT_COLR_COMPOSITE_DEST_OVER = 4, + FT_COLR_COMPOSITE_SRC_IN = 5, + FT_COLR_COMPOSITE_DEST_IN = 6, + FT_COLR_COMPOSITE_SRC_OUT = 7, + FT_COLR_COMPOSITE_DEST_OUT = 8, + FT_COLR_COMPOSITE_SRC_ATOP = 9, + FT_COLR_COMPOSITE_DEST_ATOP = 10, + FT_COLR_COMPOSITE_XOR = 11, + FT_COLR_COMPOSITE_PLUS = 12, + FT_COLR_COMPOSITE_SCREEN = 13, + FT_COLR_COMPOSITE_OVERLAY = 14, + FT_COLR_COMPOSITE_DARKEN = 15, + FT_COLR_COMPOSITE_LIGHTEN = 16, + FT_COLR_COMPOSITE_COLOR_DODGE = 17, + FT_COLR_COMPOSITE_COLOR_BURN = 18, + FT_COLR_COMPOSITE_HARD_LIGHT = 19, + FT_COLR_COMPOSITE_SOFT_LIGHT = 20, + FT_COLR_COMPOSITE_DIFFERENCE = 21, + FT_COLR_COMPOSITE_EXCLUSION = 22, + FT_COLR_COMPOSITE_MULTIPLY = 23, + FT_COLR_COMPOSITE_HSL_HUE = 24, + FT_COLR_COMPOSITE_HSL_SATURATION = 25, + FT_COLR_COMPOSITE_HSL_COLOR = 26, + FT_COLR_COMPOSITE_HSL_LUMINOSITY = 27, + FT_COLR_COMPOSITE_MAX = 28 + + } FT_Composite_Mode; + + + /************************************************************************** + * + * @struct: + * FT_OpaquePaint + * + * @description: + * A structure representing an offset to a `Paint` value stored in any + * of the paint tables of a 'COLR' v1 font. Compare Offset<24> there. + * When 'COLR' v1 paint tables represented by FreeType objects such as + * @FT_PaintColrLayers, @FT_PaintComposite, or @FT_PaintTransform + * reference downstream nested paint tables, we do not immediately + * retrieve them but encapsulate their location in this type. Use + * @FT_Get_Paint to retrieve the actual @FT_COLR_Paint object that + * describes the details of the respective paint table. + * + * @fields: + * p :: + * An internal offset to a Paint table, needs to be set to NULL before + * passing this struct as an argument to @FT_Get_Paint. + * + * insert_root_transform :: + * An internal boolean to track whether an initial root transform is + * to be provided. Do not set this value. + * + * @since: + * 2.13 + */ + typedef struct FT_Opaque_Paint_ + { + FT_Byte* p; + FT_Bool insert_root_transform; + } FT_OpaquePaint; + + + /************************************************************************** + * + * @struct: + * FT_PaintColrLayers + * + * @description: + * A structure representing a `PaintColrLayers` table of a 'COLR' v1 + * font. This table describes a set of layers that are to be composited + * with composite mode `FT_COLR_COMPOSITE_SRC_OVER`. The return value + * of this function is an @FT_LayerIterator initialized so that it can + * be used with @FT_Get_Paint_Layers to retrieve the @FT_OpaquePaint + * objects as references to each layer. + * + * @fields: + * layer_iterator :: + * The layer iterator that describes the layers of this paint. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintColrLayers_ + { + FT_LayerIterator layer_iterator; + + } FT_PaintColrLayers; + + + /************************************************************************** + * + * @struct: + * FT_PaintSolid + * + * @description: + * A structure representing a `PaintSolid` value of the 'COLR' v1 + * extensions, see 'https://github.com/googlefonts/colr-gradients-spec'. + * Using a `PaintSolid` value means that the glyph layer filled with + * this paint is solid-colored and does not contain a gradient. + * + * @fields: + * color :: + * The color information for this solid paint, see @FT_ColorIndex. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintSolid_ + { + FT_ColorIndex color; + + } FT_PaintSolid; + + + /************************************************************************** + * + * @struct: + * FT_PaintLinearGradient + * + * @description: + * A structure representing a `PaintLinearGradient` value of the 'COLR' + * v1 extensions, see + * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph + * layer filled with this paint is drawn filled with a linear gradient. + * + * @fields: + * colorline :: + * The @FT_ColorLine information for this paint, i.e., the list of + * color stops along the gradient. + * + * p0 :: + * The starting point of the gradient definition in font units + * represented as a 16.16 fixed-point `FT_Vector`. + * + * p1 :: + * The end point of the gradient definition in font units + * represented as a 16.16 fixed-point `FT_Vector`. + * + * p2 :: + * Optional point~p2 to rotate the gradient in font units + * represented as a 16.16 fixed-point `FT_Vector`. + * Otherwise equal to~p0. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintLinearGradient_ + { + FT_ColorLine colorline; + + /* TODO: Potentially expose those as x0, y0 etc. */ + FT_Vector p0; + FT_Vector p1; + FT_Vector p2; + + } FT_PaintLinearGradient; + + + /************************************************************************** + * + * @struct: + * FT_PaintRadialGradient + * + * @description: + * A structure representing a `PaintRadialGradient` value of the 'COLR' + * v1 extensions, see + * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph + * layer filled with this paint is drawn filled with a radial gradient. + * + * @fields: + * colorline :: + * The @FT_ColorLine information for this paint, i.e., the list of + * color stops along the gradient. + * + * c0 :: + * The center of the starting point of the radial gradient in font + * units represented as a 16.16 fixed-point `FT_Vector`. + * + * r0 :: + * The radius of the starting circle of the radial gradient in font + * units represented as a 16.16 fixed-point value. + * + * c1 :: + * The center of the end point of the radial gradient in font units + * represented as a 16.16 fixed-point `FT_Vector`. + * + * r1 :: + * The radius of the end circle of the radial gradient in font + * units represented as a 16.16 fixed-point value. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintRadialGradient_ + { + FT_ColorLine colorline; + + FT_Vector c0; + FT_Pos r0; + FT_Vector c1; + FT_Pos r1; + + } FT_PaintRadialGradient; + + + /************************************************************************** + * + * @struct: + * FT_PaintSweepGradient + * + * @description: + * A structure representing a `PaintSweepGradient` value of the 'COLR' + * v1 extensions, see + * 'https://github.com/googlefonts/colr-gradients-spec'. The glyph + * layer filled with this paint is drawn filled with a sweep gradient + * from `start_angle` to `end_angle`. + * + * @fields: + * colorline :: + * The @FT_ColorLine information for this paint, i.e., the list of + * color stops along the gradient. + * + * center :: + * The center of the sweep gradient in font units represented as a + * vector of 16.16 fixed-point values. + * + * start_angle :: + * The start angle of the sweep gradient in 16.16 fixed-point + * format specifying degrees divided by 180.0 (as in the + * spec). Multiply by 180.0f to receive degrees value. Values are + * given counter-clockwise, starting from the (positive) y~axis. + * + * end_angle :: + * The end angle of the sweep gradient in 16.16 fixed-point + * format specifying degrees divided by 180.0 (as in the + * spec). Multiply by 180.0f to receive degrees value. Values are + * given counter-clockwise, starting from the (positive) y~axis. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintSweepGradient_ + { + FT_ColorLine colorline; + + FT_Vector center; + FT_Fixed start_angle; + FT_Fixed end_angle; + + } FT_PaintSweepGradient; + + + /************************************************************************** + * + * @struct: + * FT_PaintGlyph + * + * @description: + * A structure representing a 'COLR' v1 `PaintGlyph` paint table. + * + * @fields: + * paint :: + * An opaque paint object pointing to a `Paint` table that serves as + * the fill for the glyph ID. + * + * glyphID :: + * The glyph ID from the 'glyf' table, which serves as the contour + * information that is filled with paint. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintGlyph_ + { + FT_OpaquePaint paint; + FT_UInt glyphID; + + } FT_PaintGlyph; + + + /************************************************************************** + * + * @struct: + * FT_PaintColrGlyph + * + * @description: + * A structure representing a 'COLR' v1 `PaintColorGlyph` paint table. + * + * @fields: + * glyphID :: + * The glyph ID from the `BaseGlyphV1List` table that is drawn for + * this paint. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintColrGlyph_ + { + FT_UInt glyphID; + + } FT_PaintColrGlyph; + + + /************************************************************************** + * + * @struct: + * FT_PaintTransform + * + * @description: + * A structure representing a 'COLR' v1 `PaintTransform` paint table. + * + * @fields: + * paint :: + * An opaque paint that is subject to being transformed. + * + * affine :: + * A 2x3 transformation matrix in @FT_Affine23 format containing + * 16.16 fixed-point values. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintTransform_ + { + FT_OpaquePaint paint; + FT_Affine23 affine; + + } FT_PaintTransform; + + + /************************************************************************** + * + * @struct: + * FT_PaintTranslate + * + * @description: + * A structure representing a 'COLR' v1 `PaintTranslate` paint table. + * Used for translating downstream paints by a given x and y~delta. + * + * @fields: + * paint :: + * An @FT_OpaquePaint object referencing the paint that is to be + * rotated. + * + * dx :: + * Translation in x~direction in font units represented as a + * 16.16 fixed-point value. + * + * dy :: + * Translation in y~direction in font units represented as a + * 16.16 fixed-point value. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintTranslate_ + { + FT_OpaquePaint paint; + + FT_Fixed dx; + FT_Fixed dy; + + } FT_PaintTranslate; + + + /************************************************************************** + * + * @struct: + * FT_PaintScale + * + * @description: + * A structure representing all of the 'COLR' v1 'PaintScale*' paint + * tables. Used for scaling downstream paints by a given x and y~scale, + * with a given center. This structure is used for all 'PaintScale*' + * types that are part of specification; fields of this structure are + * filled accordingly. If there is a center, the center values are set, + * otherwise they are set to the zero coordinate. If the source font + * file has 'PaintScaleUniform*' set, the scale values are set + * accordingly to the same value. + * + * @fields: + * paint :: + * An @FT_OpaquePaint object referencing the paint that is to be + * scaled. + * + * scale_x :: + * Scale factor in x~direction represented as a + * 16.16 fixed-point value. + * + * scale_y :: + * Scale factor in y~direction represented as a + * 16.16 fixed-point value. + * + * center_x :: + * x~coordinate of center point to scale from represented as a + * 16.16 fixed-point value. + * + * center_y :: + * y~coordinate of center point to scale from represented as a + * 16.16 fixed-point value. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintScale_ + { + FT_OpaquePaint paint; + + FT_Fixed scale_x; + FT_Fixed scale_y; + + FT_Fixed center_x; + FT_Fixed center_y; + + } FT_PaintScale; + + + /************************************************************************** + * + * @struct: + * FT_PaintRotate + * + * @description: + * A structure representing a 'COLR' v1 `PaintRotate` paint table. Used + * for rotating downstream paints with a given center and angle. + * + * @fields: + * paint :: + * An @FT_OpaquePaint object referencing the paint that is to be + * rotated. + * + * angle :: + * The rotation angle that is to be applied in degrees divided by + * 180.0 (as in the spec) represented as a 16.16 fixed-point + * value. Multiply by 180.0f to receive degrees value. + * + * center_x :: + * The x~coordinate of the pivot point of the rotation in font + * units represented as a 16.16 fixed-point value. + * + * center_y :: + * The y~coordinate of the pivot point of the rotation in font + * units represented as a 16.16 fixed-point value. + * + * @since: + * 2.13 + */ + + typedef struct FT_PaintRotate_ + { + FT_OpaquePaint paint; + + FT_Fixed angle; + + FT_Fixed center_x; + FT_Fixed center_y; + + } FT_PaintRotate; + + + /************************************************************************** + * + * @struct: + * FT_PaintSkew + * + * @description: + * A structure representing a 'COLR' v1 `PaintSkew` paint table. Used + * for skewing or shearing downstream paints by a given center and + * angle. + * + * @fields: + * paint :: + * An @FT_OpaquePaint object referencing the paint that is to be + * skewed. + * + * x_skew_angle :: + * The skewing angle in x~direction in degrees divided by 180.0 + * (as in the spec) represented as a 16.16 fixed-point + * value. Multiply by 180.0f to receive degrees. + * + * y_skew_angle :: + * The skewing angle in y~direction in degrees divided by 180.0 + * (as in the spec) represented as a 16.16 fixed-point + * value. Multiply by 180.0f to receive degrees. + * + * center_x :: + * The x~coordinate of the pivot point of the skew in font units + * represented as a 16.16 fixed-point value. + * + * center_y :: + * The y~coordinate of the pivot point of the skew in font units + * represented as a 16.16 fixed-point value. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintSkew_ + { + FT_OpaquePaint paint; + + FT_Fixed x_skew_angle; + FT_Fixed y_skew_angle; + + FT_Fixed center_x; + FT_Fixed center_y; + + } FT_PaintSkew; + + + /************************************************************************** + * + * @struct: + * FT_PaintComposite + * + * @description: + * A structure representing a 'COLR' v1 `PaintComposite` paint table. + * Used for compositing two paints in a 'COLR' v1 directed acyclic graph. + * + * @fields: + * source_paint :: + * An @FT_OpaquePaint object referencing the source that is to be + * composited. + * + * composite_mode :: + * An @FT_Composite_Mode enum value determining the composition + * operation. + * + * backdrop_paint :: + * An @FT_OpaquePaint object referencing the backdrop paint that + * `source_paint` is composited onto. + * + * @since: + * 2.13 + */ + typedef struct FT_PaintComposite_ + { + FT_OpaquePaint source_paint; + FT_Composite_Mode composite_mode; + FT_OpaquePaint backdrop_paint; + + } FT_PaintComposite; + + + /************************************************************************** + * + * @union: + * FT_COLR_Paint + * + * @description: + * A union object representing format and details of a paint table of a + * 'COLR' v1 font, see + * 'https://github.com/googlefonts/colr-gradients-spec'. Use + * @FT_Get_Paint to retrieve a @FT_COLR_Paint for an @FT_OpaquePaint + * object. + * + * @fields: + * format :: + * The gradient format for this Paint structure. + * + * u :: + * Union of all paint table types: + * + * * @FT_PaintColrLayers + * * @FT_PaintGlyph + * * @FT_PaintSolid + * * @FT_PaintLinearGradient + * * @FT_PaintRadialGradient + * * @FT_PaintSweepGradient + * * @FT_PaintTransform + * * @FT_PaintTranslate + * * @FT_PaintRotate + * * @FT_PaintSkew + * * @FT_PaintComposite + * * @FT_PaintColrGlyph + * + * @since: + * 2.13 + */ + typedef struct FT_COLR_Paint_ + { + FT_PaintFormat format; + + union + { + FT_PaintColrLayers colr_layers; + FT_PaintGlyph glyph; + FT_PaintSolid solid; + FT_PaintLinearGradient linear_gradient; + FT_PaintRadialGradient radial_gradient; + FT_PaintSweepGradient sweep_gradient; + FT_PaintTransform transform; + FT_PaintTranslate translate; + FT_PaintScale scale; + FT_PaintRotate rotate; + FT_PaintSkew skew; + FT_PaintComposite composite; + FT_PaintColrGlyph colr_glyph; + + } u; + + } FT_COLR_Paint; + + + /************************************************************************** + * + * @enum: + * FT_Color_Root_Transform + * + * @description: + * An enumeration to specify whether @FT_Get_Color_Glyph_Paint is to + * return a root transform to configure the client's graphics context + * matrix. + * + * @values: + * FT_COLOR_INCLUDE_ROOT_TRANSFORM :: + * Do include the root transform as the initial @FT_COLR_Paint object. + * + * FT_COLOR_NO_ROOT_TRANSFORM :: + * Do not output an initial root transform. + * + * @since: + * 2.13 + */ + typedef enum FT_Color_Root_Transform_ + { + FT_COLOR_INCLUDE_ROOT_TRANSFORM, + FT_COLOR_NO_ROOT_TRANSFORM, + + FT_COLOR_ROOT_TRANSFORM_MAX + + } FT_Color_Root_Transform; + + + /************************************************************************** + * + * @struct: + * FT_ClipBox + * + * @description: + * A structure representing a 'COLR' v1 'ClipBox' table. 'COLR' v1 + * glyphs may optionally define a clip box for aiding allocation or + * defining a maximum drawable region. Use @FT_Get_Color_Glyph_ClipBox + * to retrieve it. + * + * @fields: + * bottom_left :: + * The bottom left corner of the clip box as an @FT_Vector with + * fixed-point coordinates in 26.6 format. + * + * top_left :: + * The top left corner of the clip box as an @FT_Vector with + * fixed-point coordinates in 26.6 format. + * + * top_right :: + * The top right corner of the clip box as an @FT_Vector with + * fixed-point coordinates in 26.6 format. + * + * bottom_right :: + * The bottom right corner of the clip box as an @FT_Vector with + * fixed-point coordinates in 26.6 format. + * + * @since: + * 2.13 + */ + typedef struct FT_ClipBox_ + { + FT_Vector bottom_left; + FT_Vector top_left; + FT_Vector top_right; + FT_Vector bottom_right; + + } FT_ClipBox; + + + /************************************************************************** + * + * @function: + * FT_Get_Color_Glyph_Paint + * + * @description: + * This is the starting point and interface to color gradient + * information in a 'COLR' v1 table in OpenType fonts to recursively + * retrieve the paint tables for the directed acyclic graph of a colored + * glyph, given a glyph ID. + * + * https://github.com/googlefonts/colr-gradients-spec + * + * In a 'COLR' v1 font, each color glyph defines a directed acyclic + * graph of nested paint tables, such as `PaintGlyph`, `PaintSolid`, + * `PaintLinearGradient`, `PaintRadialGradient`, and so on. Using this + * function and specifying a glyph ID, one retrieves the root paint + * table for this glyph ID. + * + * This function allows control whether an initial root transform is + * returned to configure scaling, transform, and translation correctly + * on the client's graphics context. The initial root transform is + * computed and returned according to the values configured for @FT_Size + * and @FT_Set_Transform on the @FT_Face object, see below for details + * of the `root_transform` parameter. This has implications for a + * client 'COLR' v1 implementation: When this function returns an + * initially computed root transform, at the time of executing the + * @FT_PaintGlyph operation, the contours should be retrieved using + * @FT_Load_Glyph at unscaled, untransformed size. This is because the + * root transform applied to the graphics context will take care of + * correct scaling. + * + * Alternatively, to allow hinting of contours, at the time of executing + * @FT_Load_Glyph, the current graphics context transformation matrix + * can be decomposed into a scaling matrix and a remainder, and + * @FT_Load_Glyph can be used to retrieve the contours at scaled size. + * Care must then be taken to blit or clip to the graphics context with + * taking this remainder transformation into account. + * + * @input: + * face :: + * A handle to the parent face object. + * + * base_glyph :: + * The glyph index for which to retrieve the root paint table. + * + * root_transform :: + * Specifies whether an initially computed root is returned by the + * @FT_PaintTransform operation to account for the activated size + * (see @FT_Activate_Size) and the configured transform and translate + * (see @FT_Set_Transform). + * + * This root transform is returned before nodes of the glyph graph of + * the font are returned. Subsequent @FT_COLR_Paint structures + * contain unscaled and untransformed values. The inserted root + * transform enables the client application to apply an initial + * transform to its graphics context. When executing subsequent + * FT_COLR_Paint operations, values from @FT_COLR_Paint operations + * will ultimately be correctly scaled because of the root transform + * applied to the graphics context. Use + * @FT_COLOR_INCLUDE_ROOT_TRANSFORM to include the root transform, use + * @FT_COLOR_NO_ROOT_TRANSFORM to not include it. The latter may be + * useful when traversing the 'COLR' v1 glyph graph and reaching a + * @FT_PaintColrGlyph. When recursing into @FT_PaintColrGlyph and + * painting that inline, no additional root transform is needed as it + * has already been applied to the graphics context at the beginning + * of drawing this glyph. + * + * @output: + * paint :: + * The @FT_OpaquePaint object that references the actual paint table. + * + * The respective actual @FT_COLR_Paint object is retrieved via + * @FT_Get_Paint. + * + * @return: + * Value~1 if everything is OK. If no color glyph is found, or the root + * paint could not be retrieved, value~0 gets returned. In case of an + * error, value~0 is returned also. + * + * @since: + * 2.13 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Color_Glyph_Paint( FT_Face face, + FT_UInt base_glyph, + FT_Color_Root_Transform root_transform, + FT_OpaquePaint* paint ); + + + /************************************************************************** + * + * @function: + * FT_Get_Color_Glyph_ClipBox + * + * @description: + * Search for a 'COLR' v1 clip box for the specified `base_glyph` and + * fill the `clip_box` parameter with the 'COLR' v1 'ClipBox' information + * if one is found. + * + * @input: + * face :: + * A handle to the parent face object. + * + * base_glyph :: + * The glyph index for which to retrieve the clip box. + * + * @output: + * clip_box :: + * The clip box for the requested `base_glyph` if one is found. The + * clip box is computed taking scale and transformations configured on + * the @FT_Face into account. @FT_ClipBox contains @FT_Vector values + * in 26.6 format. + * + * @return: + * Value~1 if a clip box is found. If no clip box is found or an error + * occurred, value~0 is returned. + * + * @note: + * To retrieve the clip box in font units, reset scale to units-per-em + * and remove transforms configured using @FT_Set_Transform. + * + * @since: + * 2.13 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Color_Glyph_ClipBox( FT_Face face, + FT_UInt base_glyph, + FT_ClipBox* clip_box ); + + + /************************************************************************** + * + * @function: + * FT_Get_Paint_Layers + * + * @description: + * Access the layers of a `PaintColrLayers` table. + * + * If the root paint of a color glyph, or a nested paint of a 'COLR' + * glyph is a `PaintColrLayers` table, this function retrieves the + * layers of the `PaintColrLayers` table. + * + * The @FT_PaintColrLayers object contains an @FT_LayerIterator, which + * is used here to iterate over the layers. Each layer is returned as + * an @FT_OpaquePaint object, which then can be used with @FT_Get_Paint + * to retrieve the actual paint object. + * + * @input: + * face :: + * A handle to the parent face object. + * + * @inout: + * iterator :: + * The @FT_LayerIterator from an @FT_PaintColrLayers object, for which + * the layers are to be retrieved. The internal state of the iterator + * is incremented after one call to this function for retrieving one + * layer. + * + * @output: + * paint :: + * The @FT_OpaquePaint object that references the actual paint table. + * The respective actual @FT_COLR_Paint object is retrieved via + * @FT_Get_Paint. + * + * @return: + * Value~1 if everything is OK. Value~0 gets returned when the paint + * object can not be retrieved or any other error occurs. + * + * @since: + * 2.13 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Paint_Layers( FT_Face face, + FT_LayerIterator* iterator, + FT_OpaquePaint* paint ); + + + /************************************************************************** + * + * @function: + * FT_Get_Colorline_Stops + * + * @description: + * This is an interface to color gradient information in a 'COLR' v1 + * table in OpenType fonts to iteratively retrieve the gradient and + * solid fill information for colored glyph layers for a specified glyph + * ID. + * + * https://github.com/googlefonts/colr-gradients-spec + * + * @input: + * face :: + * A handle to the parent face object. + * + * @inout: + * iterator :: + * The retrieved @FT_ColorStopIterator, configured on an @FT_ColorLine, + * which in turn got retrieved via paint information in + * @FT_PaintLinearGradient or @FT_PaintRadialGradient. + * + * @output: + * color_stop :: + * Color index and alpha value for the retrieved color stop. + * + * @return: + * Value~1 if everything is OK. If there are no more color stops, + * value~0 gets returned. In case of an error, value~0 is returned + * also. + * + * @since: + * 2.13 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Colorline_Stops( FT_Face face, + FT_ColorStop* color_stop, + FT_ColorStopIterator* iterator ); + + + /************************************************************************** + * + * @function: + * FT_Get_Paint + * + * @description: + * Access the details of a paint using an @FT_OpaquePaint opaque paint + * object, which internally stores the offset to the respective `Paint` + * object in the 'COLR' table. + * + * @input: + * face :: + * A handle to the parent face object. + * + * opaque_paint :: + * The opaque paint object for which the underlying @FT_COLR_Paint + * data is to be retrieved. + * + * @output: + * paint :: + * The specific @FT_COLR_Paint object containing information coming + * from one of the font's `Paint*` tables. + * + * @return: + * Value~1 if everything is OK. Value~0 if no details can be found for + * this paint or any other error occurred. + * + * @since: + * 2.13 + */ + FT_EXPORT( FT_Bool ) + FT_Get_Paint( FT_Face face, + FT_OpaquePaint opaque_paint, + FT_COLR_Paint* paint ); + + /* */ + + +FT_END_HEADER + +#endif /* FTCOLOR_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftdriver.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftdriver.h new file mode 100644 index 0000000000000000000000000000000000000000..b65a06ab69b0849d6937b2ca3f96b7c4d673c1ee --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftdriver.h @@ -0,0 +1,1320 @@ +/**************************************************************************** + * + * ftdriver.h + * + * FreeType API for controlling driver modules (specification only). + * + * Copyright (C) 2017-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTDRIVER_H_ +#define FTDRIVER_H_ + +#include +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * Note that the auto-hinter's module name is 'autofitter' for historical + * reasons. + * + * Available properties are @increase-x-height, @no-stem-darkening + * (experimental), @darkening-parameters (experimental), + * @glyph-to-script-map (experimental), @fallback-script (experimental), + * and @default-script (experimental), as documented in the @properties + * section. + * + */ + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, it + * is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. + * + * The CFF driver's module name is 'cff'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * + * **Hinting and anti-aliasing principles of the new engine** + * + * The rasterizer is positioning horizontal features (e.g., ascender + * height & x-height, or crossbars) on the pixel grid and minimizing the + * amount of anti-aliasing applied to them, while placing vertical + * features (vertical stems) on the pixel grid without hinting, thus + * representing the stem position and weight accurately. Sometimes the + * vertical stems may be only partially black. In this context, + * 'anti-aliasing' means that stems are not positioned exactly on pixel + * borders, causing a fuzzy appearance. + * + * There are two principles behind this approach. + * + * 1) No hinting in the horizontal direction: Unlike 'superhinted' + * TrueType, which changes glyph widths to accommodate regular + * inter-glyph spacing, Adobe's approach is 'faithful to the design' in + * representing both the glyph width and the inter-glyph spacing designed + * for the font. This makes the screen display as close as it can be to + * the result one would get with infinite resolution, while preserving + * what is considered the key characteristics of each glyph. Note that + * the distances between unhinted and grid-fitted positions at small + * sizes are comparable to kerning values and thus would be noticeable + * (and distracting) while reading if hinting were applied. + * + * One of the reasons to not hint horizontally is anti-aliasing for LCD + * screens: The pixel geometry of modern displays supplies three vertical + * subpixels as the eye moves horizontally across each visible pixel. On + * devices where we can be certain this characteristic is present a + * rasterizer can take advantage of the subpixels to add increments of + * weight. In Western writing systems this turns out to be the more + * critical direction anyway; the weights and spacing of vertical stems + * (see above) are central to Armenian, Cyrillic, Greek, and Latin type + * designs. Even when the rasterizer uses greyscale anti-aliasing instead + * of color (a necessary compromise when one doesn't know the screen + * characteristics), the unhinted vertical features preserve the design's + * weight and spacing much better than aliased type would. + * + * 2) Alignment in the vertical direction: Weights and spacing along the + * y~axis are less critical; what is much more important is the visual + * alignment of related features (like cap-height and x-height). The + * sense of alignment for these is enhanced by the sharpness of grid-fit + * edges, while the cruder vertical resolution (full pixels instead of + * 1/3 pixels) is less of a problem. + * + * On the technical side, horizontal alignment zones for ascender, + * x-height, and other important height values (traditionally called + * 'blue zones') as defined in the font are positioned independently, + * each being rounded to the nearest pixel edge, taking care of overshoot + * suppression at small sizes, stem darkening, and scaling. + * + * Hstems (that is, hint values defined in the font to help align + * horizontal features) that fall within a blue zone are said to be + * 'captured' and are aligned to that zone. Uncaptured stems are moved + * in one of four ways, top edge up or down, bottom edge up or down. + * Unless there are conflicting hstems, the smallest movement is taken to + * minimize distortion. + * + */ + + + /************************************************************************** + * + * @section: + * pcf_driver + * + * @title: + * The PCF driver + * + * @abstract: + * Controlling the PCF driver module. + * + * @description: + * While FreeType's PCF driver doesn't expose API functions by itself, it + * is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. Right now, there is a single property + * @no-long-family-names available if FreeType is compiled with + * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + * + * The PCF driver's module name is 'pcf'. + * + */ + + + /************************************************************************** + * + * @section: + * t1_cid_driver + * + * @title: + * The Type 1 and CID drivers + * + * @abstract: + * Controlling the Type~1 and CID driver modules. + * + * @description: + * It is possible to control the behaviour of FreeType's Type~1 and + * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get. + * + * Behind the scenes, both drivers use the Adobe CFF engine for hinting; + * however, the used properties must be specified separately. + * + * The Type~1 driver's module name is 'type1'; the CID driver's module + * name is 't1cid'. + * + * Available properties are @hinting-engine, @no-stem-darkening, + * @darkening-parameters, and @random-seed, as documented in the + * @properties section. + * + * Please see the @cff_driver section for more details on the new hinting + * engine. + * + */ + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. + * + * The TrueType driver's module name is 'truetype'; a single property + * @interpreter-version is available, as documented in the @properties + * section. + * + * To help understand the differences between interpreter versions, we + * introduce a list of definitions, kindly provided by Greg Hitchcock. + * + * _Bi-Level Rendering_ + * + * Monochromatic rendering, exclusively used in the early days of + * TrueType by both Apple and Microsoft. Microsoft's GDI interface + * supported hinting of the right-side bearing point, such that the + * advance width could be non-linear. Most often this was done to + * achieve some level of glyph symmetry. To enable reasonable + * performance (e.g., not having to run hinting on all glyphs just to get + * the widths) there was a bit in the head table indicating if the side + * bearing was hinted, and additional tables, 'hdmx' and 'LTSH', to cache + * hinting widths across multiple sizes and device aspect ratios. + * + * _Font Smoothing_ + * + * Microsoft's GDI implementation of anti-aliasing. Not traditional + * anti-aliasing as the outlines were hinted before the sampling. The + * widths matched the bi-level rendering. + * + * _ClearType Rendering_ + * + * Technique that uses physical subpixels to improve rendering on LCD + * (and other) displays. Because of the higher resolution, many methods + * of improving symmetry in glyphs through hinting the right-side bearing + * were no longer necessary. This lead to what GDI calls 'natural + * widths' ClearType, see + * http://rastertragedy.com/RTRCh4.htm#Sec21. Since hinting + * has extra resolution, most non-linearity went away, but it is still + * possible for hints to change the advance widths in this mode. + * + * _ClearType Compatible Widths_ + * + * One of the earliest challenges with ClearType was allowing the + * implementation in GDI to be selected without requiring all UI and + * documents to reflow. To address this, a compatible method of + * rendering ClearType was added where the font hints are executed once + * to determine the width in bi-level rendering, and then re-run in + * ClearType, with the difference in widths being absorbed in the font + * hints for ClearType (mostly in the white space of hints); see + * http://rastertragedy.com/RTRCh4.htm#Sec20. Somewhat by + * definition, compatible width ClearType allows for non-linear widths, + * but only when the bi-level version has non-linear widths. + * + * _ClearType Subpixel Positioning_ + * + * One of the nice benefits of ClearType is the ability to more crisply + * display fractional widths; unfortunately, the GDI model of integer + * bitmaps did not support this. However, the WPF and Direct Write + * frameworks do support fractional widths. DWrite calls this 'natural + * mode', not to be confused with GDI's 'natural widths'. Subpixel + * positioning, in the current implementation of Direct Write, + * unfortunately does not support hinted advance widths, see + * http://rastertragedy.com/RTRCh4.htm#Sec22. Note that the + * TrueType interpreter fully allows the advance width to be adjusted in + * this mode, just the DWrite client will ignore those changes. + * + * _ClearType Backward Compatibility_ + * + * This is a set of exceptions made in the TrueType interpreter to + * minimize hinting techniques that were problematic with the extra + * resolution of ClearType; see + * http://rastertragedy.com/RTRCh4.htm#Sec1 and + * https://learn.microsoft.com/typography/cleartype/truetypecleartype. + * This technique is not to be confused with ClearType compatible widths. + * ClearType backward compatibility has no direct impact on changing + * advance widths, but there might be an indirect impact on disabling + * some deltas. This could be worked around in backward compatibility + * mode. + * + * _Native ClearType Mode_ + * + * (Not to be confused with 'natural widths'.) This mode removes all the + * exceptions in the TrueType interpreter when running with ClearType. + * Any issues on widths would still apply, though. + * + */ + + + /************************************************************************** + * + * @section: + * ot_svg_driver + * + * @title: + * The SVG driver + * + * @abstract: + * Controlling the external rendering of OT-SVG glyphs. + * + * @description: + * By default, FreeType can only load the 'SVG~' table of OpenType fonts + * if configuration macro `FT_CONFIG_OPTION_SVG` is defined. To make it + * render SVG glyphs, an external SVG rendering library is needed. All + * details on the interface between FreeType and the external library + * via function hooks can be found in section @svg_fonts. + * + * The OT-SVG driver's module name is 'ot-svg'; it supports a single + * property called @svg-hooks, documented below in the @properties + * section. + * + */ + + + /************************************************************************** + * + * @section: + * properties + * + * @title: + * Driver properties + * + * @abstract: + * Controlling driver modules. + * + * @description: + * Driver modules can be controlled by setting and unsetting properties, + * using the functions @FT_Property_Set and @FT_Property_Get. This + * section documents the available properties, together with auxiliary + * macros and structures. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to select + * the hinting engine for CFF, Type~1, and CID fonts. + * + * @values: + * FT_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + * @since: + * 2.9 + * + */ +#define FT_HINTING_FREETYPE 0 +#define FT_HINTING_ADOBE 1 + + /* these constants (introduced in 2.4.12) are deprecated */ +#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE +#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) engine, + * an application can select between 'freetype' and 'adobe' if compiled + * with `CFF_CONFIG_OPTION_OLD_ENGINE`. If this configuration macro + * isn't defined, 'hinting-engine' does nothing. + * + * The same holds for the Type~1 and CID modules if compiled with + * `T1_CONFIG_OPTION_OLD_ENGINE`. + * + * For the 'cff' module, the default engine is 'adobe'. For both the + * 'type1' and 't1cid' modules, the default engine is 'adobe', too. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable (using values 'adobe' or 'freetype'). + * + * @example: + * The following example code demonstrates how to select Adobe's hinting + * engine for the 'cff' module (omitting the error handling). + * + * ``` + * FT_Library library; + * FT_UInt hinting_engine = FT_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * ``` + * + * @since: + * 2.4.12 (for 'cff' module) + * + * 2.9 (for 'type1' and 't1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * All glyphs that pass through the auto-hinter will be emboldened unless + * this property is set to TRUE. The same is true for the CFF, Type~1, + * and CID font modules if the 'Adobe' engine is selected (which is the + * default). + * + * Stem darkening emboldens glyphs at smaller sizes to make them more + * readable on common low-DPI screens when using linear alpha blending + * and gamma correction, see @FT_Render_Glyph. When not using linear + * alpha blending and gamma correction, glyphs will appear heavy and + * fuzzy! + * + * Gamma correction essentially lightens fonts since shades of grey are + * shifted to higher pixel values (=~higher brightness) to match the + * original intention to the reality of our screens. The side-effect is + * that glyphs 'thin out'. Mac OS~X and Adobe's proprietary font + * rendering library implement a counter-measure: stem darkening at + * smaller sizes where shades of gray dominate. By emboldening a glyph + * slightly in relation to its pixel size, individual pixels get higher + * coverage of filled-in outlines and are therefore 'blacker'. This + * counteracts the 'thinning out' of glyphs, making text remain readable + * at smaller sizes. + * + * For the auto-hinter, stem-darkening is experimental currently and thus + * switched off by default (that is, `no-stem-darkening` is set to TRUE + * by default). Total consistency with the CFF driver is not achieved + * right now because the emboldening method differs and glyphs must be + * scaled down on the Y-axis to keep outline points inside their + * precomputed blue zones. The smaller the size (especially 9ppem and + * down), the higher the loss of emboldening versus the CFF driver. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable (using values 1 and 0 for 'on' and 'off', respectively). It + * can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_STEM_DARKENING. + * + * @example: + * ``` + * FT_Library library; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * ``` + * + * @since: + * 2.4.12 (for 'cff' module) + * + * 2.6.2 (for 'autofitter' module) + * + * 2.9 (for 'type1' and 't1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * darkening-parameters + * + * @description: + * By default, the Adobe hinting engine, as used by the CFF, Type~1, and + * CID font drivers, darkens stems as follows (if the `no-stem-darkening` + * property isn't set): + * + * ``` + * stem width <= 0.5px: darkening amount = 0.4px + * stem width = 1px: darkening amount = 0.275px + * stem width = 1.667px: darkening amount = 0.275px + * stem width >= 2.333px: darkening amount = 0px + * ``` + * + * and piecewise linear in-between. At configuration time, these four + * control points can be set with the macro + * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS`; the CFF, Type~1, and CID + * drivers share these values. At runtime, the control points can be + * changed using the `darkening-parameters` property (see the example + * below that demonstrates this for the Type~1 driver). + * + * The x~values give the stem width, and the y~values the darkening + * amount. The unit is 1000th of pixels. All coordinate values must be + * positive; the x~values must be monotonically increasing; the y~values + * must be monotonically decreasing and smaller than or equal to 500 + * (corresponding to half a pixel); the slope of each linear piece must + * be shallower than -1 (e.g., -.4). + * + * The auto-hinter provides this property, too, as an experimental + * feature. See @no-stem-darkening for more. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable, using eight comma-separated integers without spaces. Here + * the above example, using `\` to break the line for readability. + * + * ``` + * FREETYPE_PROPERTIES=\ + * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0 + * ``` + * + * @example: + * ``` + * FT_Library library; + * FT_Int darken_params[8] = { 500, 300, // x1, y1 + * 1000, 200, // x2, y2 + * 1500, 100, // x3, y3 + * 2000, 0 }; // x4, y4 + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "type1", + * "darkening-parameters", darken_params ); + * ``` + * + * @since: + * 2.5.1 (for 'cff' module) + * + * 2.6.2 (for 'autofitter' module) + * + * 2.9 (for 'type1' and 't1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * random-seed + * + * @description: + * By default, the seed value for the CFF 'random' operator and the + * similar '0 28 callothersubr pop' command for the Type~1 and CID + * drivers is set to a random value. However, mainly for debugging + * purposes, it is often necessary to use a known value as a seed so that + * the pseudo-random number sequences generated by 'random' are + * repeatable. + * + * The `random-seed` property does that. Its argument is a signed 32bit + * integer; if the value is zero or negative, the seed given by the + * `intitialRandomSeed` private DICT operator in a CFF file gets used (or + * a default value if there is no such operator). If the value is + * positive, use it instead of `initialRandomSeed`, which is consequently + * ignored. + * + * @note: + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable. It can also be set per face using @FT_Face_Properties with + * @FT_PARAM_TAG_RANDOM_SEED. + * + * @since: + * 2.8 (for 'cff' module) + * + * 2.9 (for 'type1' and 't1cid' modules) + * + */ + + + /************************************************************************** + * + * @property: + * no-long-family-names + * + * @description: + * If `PCF_CONFIG_OPTION_LONG_FAMILY_NAMES` is active while compiling + * FreeType, the PCF driver constructs long family names. + * + * There are many PCF fonts just called 'Fixed' which look completely + * different, and which have nothing to do with each other. When + * selecting 'Fixed' in KDE or Gnome one gets results that appear rather + * random, the style changes often if one changes the size and one cannot + * select some fonts at all. The improve this situation, the PCF module + * prepends the foundry name (plus a space) to the family name. It also + * checks whether there are 'wide' characters; all put together, family + * names like 'Sony Fixed' or 'Misc Fixed Wide' are constructed. + * + * If `no-long-family-names` is set, this feature gets switched off. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable (using values 1 and 0 for 'on' and 'off', respectively). + * + * @example: + * ``` + * FT_Library library; + * FT_Bool no_long_family_names = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "pcf", + * "no-long-family-names", + * &no_long_family_names ); + * ``` + * + * @since: + * 2.8 + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version number + * as returned by the 'GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 is the same Version~40. The original 'Infinality' code is + * no longer available. + * + * TT_INTERPRETER_VERSION_40 :: + * Version~40 corresponds to MS rasterizer v.2.1; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as can + * be found, for example, in Microsoft's Edge Browser on Windows~10). + * It is used in FreeType to select the 'minimal' subpixel hinting + * code, a stripped-down and higher performance version of the + * 'Infinality' code. + * + * @note: + * This property controls the behaviour of the bytecode interpreter and + * thus how outlines get hinted. It does **not** control how glyph get + * rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with the configuration option + * `TT_CONFIG_OPTION_SUBPIXEL_HINTING`, selecting version~38 or~40 causes + * an `FT_Err_Unimplemented_Feature` error. + * + * Depending on the graphics framework, Microsoft uses different bytecode + * and rendering engines. As a consequence, the version numbers returned + * by a call to the 'GETINFO' bytecode instruction are more convoluted + * than desired. + * + * Here are two tables that try to shed some light on the possible values + * for the MS rasterizer engine, together with the additional features + * introduced by it. + * + * ``` + * GETINFO framework version feature + * ------------------------------------------------------------------- + * 3 GDI (Win 3.1), v1.0 16-bit, first version + * TrueImage + * 33 GDI (Win NT 3.1), v1.5 32-bit + * HP Laserjet + * 34 GDI (Win 95) v1.6 font smoothing, + * new SCANTYPE opcode + * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET + * bits in composite glyphs + * 36 MGDI (Win CE 2) v1.6+ classic ClearType + * 37 GDI (XP and later), v1.8 ClearType + * GDI+ old (before Vista) + * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType, + * WPF Y-direction ClearType, + * additional error checking + * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags + * in GETINFO opcode, + * bug fixes + * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag + * DWrite (Win 8) in GETINFO opcode, + * Gray ClearType + * ``` + * + * The 'version' field gives a rough orientation only, since some + * applications provided certain features much earlier (as an example, + * Microsoft Reader used subpixel and Y-direction ClearType already in + * Windows 2000). Similarly, updates to a given framework might include + * improved hinting support. + * + * ``` + * version sampling rendering comment + * x y x y + * -------------------------------------------------------------- + * v1.0 normal normal B/W B/W bi-level + * v1.6 high high gray gray grayscale + * v1.8 high normal color-filter B/W (GDI) ClearType + * v1.9 high high color-filter gray Color ClearType + * v2.1 high normal gray B/W Gray ClearType + * v2.1 high high gray gray Gray ClearType + * ``` + * + * Color and Gray ClearType are the two available variants of + * 'Y-direction ClearType', meaning grayscale rasterization along the + * Y-direction; the name used in the TrueType specification for this + * feature is 'symmetric smoothing'. 'Classic ClearType' is the original + * algorithm used before introducing a modified version in Win~XP. + * Another name for v1.6's grayscale rendering is 'font smoothing', and + * 'Color ClearType' is sometimes also called 'DWrite ClearType'. To + * differentiate between today's Color ClearType and the earlier + * ClearType variant with B/W rendering along the vertical axis, the + * latter is sometimes called 'GDI ClearType'. + * + * 'Normal' and 'high' sampling describe the (virtual) resolution to + * access the rasterized outline after the hinting process. 'Normal' + * means 1 sample per grid line (i.e., B/W). In the current Microsoft + * implementation, 'high' means an extra virtual resolution of 16x16 (or + * 16x1) grid lines per pixel for bytecode instructions like 'MIRP'. + * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid + * lines for color filtering if Color ClearType is activated. + * + * Note that 'Gray ClearType' is essentially the same as v1.6's grayscale + * rendering. However, the GETINFO instruction handles it differently: + * v1.6 returns bit~12 (hinting for grayscale), while v2.1 returns + * bits~13 (hinting for ClearType), 18 (symmetrical smoothing), and~19 + * (Gray ClearType). Also, this mode respects bits 2 and~3 for the + * version~1 gasp table exclusively (like Color ClearType), while v1.6 + * only respects the values of version~0 (bits 0 and~1). + * + * Keep in mind that the features of the above interpreter versions might + * not map exactly to FreeType features or behavior because it is a + * fundamentally different library with different internals. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 +#define TT_INTERPRETER_VERSION_40 40 + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, three versions are available, two representing the bytecode + * interpreter with subpixel hinting support (old 'Infinality' code and + * new stripped-down and higher performance 'minimal' code) and one + * without, respectively. The default is subpixel support if + * `TT_CONFIG_OPTION_SUBPIXEL_HINTING` is defined, and no subpixel + * support otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions behave + * differently compared to B/W or grayscale rendering (except if 'native + * ClearType' is selected by the font). Microsoft's main idea is to + * render at a much increased horizontal resolution, then sampling down + * the created output to subpixel precision. However, many older fonts + * are not suited to this and must be specially taken care of by applying + * (hardcoded) tweaks in Microsoft's interpreter. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * 'https://learn.microsoft.com/typography/cleartype/truetypecleartype'. + * Note that FreeType currently doesn't really 'subpixel hint' (6x1, 6x2, + * or 6x5 supersampling) like discussed in the paper. Depending on the + * chosen interpreter, it simply ignores instructions on vertical stems + * to arrive at very similar results. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * This property can be set via the `FREETYPE_PROPERTIES` environment + * variable (using values '35', '38', or '40'). + * + * @example: + * The following example code demonstrates how to deactivate subpixel + * hinting (omitting the error handling). + * + * ``` + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * ``` + * + * @since: + * 2.5 + */ + + + /************************************************************************** + * + * @property: + * spread + * + * @description: + * This property of the 'sdf' and 'bsdf' renderers defines how the signed + * distance field (SDF) is represented in the output bitmap. The output + * values are calculated as follows, '128 * ( SDF / spread + 1 )', with + * the result clamped to the 8-bit range [0..255]. Therefore, 'spread' + * is also the maximum euclidean distance from the edge after which the + * values are clamped. The spread is specified in pixels with the + * default value of 8. For accurate SDF texture mapping (interpolation), + * the spread should be large enough to accommodate the target grid unit. + * + * @example: + * The following example code demonstrates how to set the SDF spread + * (omitting the error handling). + * + * ``` + * FT_Library library; + * FT_Int spread = 2; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "sdf", "spread", &spread ); + * ``` + * + * @note: + * FreeType has two rasterizers for generating SDF, namely: + * + * 1. `sdf` for generating SDF directly from glyph's outline, and + * + * 2. `bsdf` for generating SDF from rasterized bitmaps. + * + * Depending on the glyph type (i.e., outline or bitmap), one of the two + * rasterizers is chosen at runtime and used for generating SDFs. To + * force the use of `bsdf` you should render the glyph with any of the + * FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and + * then re-render with `FT_RENDER_MODE_SDF`. + * + * There are some issues with stability and possible failures of the SDF + * renderers (specifically `sdf`). + * + * 1. The `sdf` rasterizer is sensitive to really small features (e.g., + * sharp turns that are less than 1~pixel) and imperfections in the + * glyph's outline, causing artifacts in the final output. + * + * 2. The `sdf` rasterizer has limited support for handling intersecting + * contours and *cannot* handle self-intersecting contours whatsoever. + * Self-intersection happens when a single connected contour + * intersects itself at some point; having these in your font + * definitely poses a problem to the rasterizer and cause artifacts, + * too. + * + * 3. Generating SDF for really small glyphs may result in undesirable + * output; the pixel grid (which stores distance information) becomes + * too coarse. + * + * 4. Since the output buffer is normalized, precision at smaller spreads + * is greater than precision at larger spread values because the + * output range of [0..255] gets mapped to a smaller SDF range. A + * spread of~2 should be sufficient in most cases. + * + * Points (1) and (2) can be avoided by using the `bsdf` rasterizer, + * which is more stable than the `sdf` rasterizer in general. + * + * @since: + * 2.11 + */ + + + /************************************************************************** + * + * @property: + * svg-hooks + * + * @description: + * Set up the interface between FreeType and an extern SVG rendering + * library like 'librsvg'. All details on the function hooks can be + * found in section @svg_fonts. + * + * @example: + * The following example code expects that the four hook functions + * `svg_*` are defined elsewhere. Error handling is omitted, too. + * + * ``` + * FT_Library library; + * SVG_RendererHooks hooks = { + * (SVG_Lib_Init_Func)svg_init, + * (SVG_Lib_Free_Func)svg_free, + * (SVG_Lib_Render_Func)svg_render, + * (SVG_Lib_Preset_Slot_Func)svg_preset_slot }; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "ot-svg", + * "svg-hooks", &hooks ); + * ``` + * + * @since: + * 2.12 + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * **Experimental only** + * + * The auto-hinter provides various script modules to hint glyphs. + * Examples of supported scripts are Latin or CJK. Before a glyph is + * auto-hinted, the Unicode character map of the font gets examined, and + * the script is then determined based on Unicode character ranges, see + * below. + * + * OpenType fonts, however, often provide much more glyphs than character + * codes (small caps, superscripts, ligatures, swashes, etc.), to be + * controlled by so-called 'features'. Handling OpenType features can be + * quite complicated and thus needs a separate library on top of + * FreeType. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an array + * with `num_glyphs` elements, as found in the font's @FT_Face structure. + * The `glyph-to-script-map` property returns a pointer to this array, + * which can be modified as needed. Note that the modification should + * happen before the first glyph gets processed by the auto-hinter so + * that the global analysis of the font shapes actually uses the modified + * mapping. + * + * @example: + * The following example code demonstrates how to access it (omitting the + * error handling). + * + * ``` + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * ``` + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * **Experimental only** + * + * A list of constants used for the @glyph-to-script-map property to + * specify the script submodule the auto-hinter should use for hinting a + * particular glyph. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, 'latin' is a very + * broad term, including Cyrillic and Greek also since characters from + * those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * ``` + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * ``` + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * ``` + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * ``` + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * ``` + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+A800 - U+A82F // Syloti Nagri + * U+ABC0 - U+ABFF // Meetei Mayek + * U+11800 - U+118DF // Sharada + * ``` + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + * @since: + * 2.4.11 + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * **Experimental only** + * + * The data exchange structure for the @glyph-to-script-map property. + * + * @since: + * 2.4.11 + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_UShort* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * **Experimental only** + * + * If no auto-hinter script module can be assigned to a glyph, a fallback + * script gets assigned to it (see also the @glyph-to-script-map + * property). By default, this is @FT_AUTOHINTER_SCRIPT_CJK. Using the + * `fallback-script` property, this fallback value can be changed. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the fallback + * script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback script will affect this face. + * + * @example: + * ``` + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * ``` + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @property: + * default-script + * + * @description: + * **Experimental only** + * + * If FreeType gets compiled with `FT_CONFIG_OPTION_USE_HARFBUZZ` to make + * the HarfBuzz library access OpenType features for getting better glyph + * coverages, this property sets the (auto-fitter) script to be used for + * the default (OpenType) script data of a font's GSUB table. Features + * for the default script are intended for all scripts not explicitly + * handled in GSUB; an example is a 'dlig' feature, containing the + * combination of the characters 'T', 'E', and 'L' to form a 'TEL' + * ligature. + * + * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the + * `default-script` property, this default value can be changed. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map that eventually uses the default + * script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the default script will affect this face. + * + * @example: + * ``` + * FT_Library library; + * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "default-script", &default_script ); + * ``` + * + * @since: + * 2.5.3 + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height`, round + * up the font's x~height much more often than normally. If the value is + * set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + * @example: + * ``` + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * ``` + * + * @since: + * 2.4.11 + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /************************************************************************** + * + * @property: + * warping + * + * @description: + * **Obsolete** + * + * This property was always experimental and probably never worked + * correctly. It was entirely removed from the FreeType~2 sources. This + * entry is only here for historical reference. + * + * Warping only worked in 'normal' auto-hinting mode replacing it. The + * idea of the code was to slightly scale and shift a glyph along the + * non-hinted dimension (which is usually the horizontal axis) so that as + * much of its segments were aligned (more or less) to the grid. To find + * out a glyph's optimal scaling and shifting value, various parameter + * combinations were tried and scored. + * + * @since: + * 2.6 + * + */ + + + /* */ + + +FT_END_HEADER + + +#endif /* FTDRIVER_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrdef.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrdef.h new file mode 100644 index 0000000000000000000000000000000000000000..3e591bede8d8ec54c89ceffd1e8e0d728ce531c2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrdef.h @@ -0,0 +1,283 @@ +/**************************************************************************** + * + * fterrdef.h + * + * FreeType error codes (specification). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * @section: + * error_code_values + * + * @title: + * Error Code Values + * + * @abstract: + * All possible error codes returned by FreeType functions. + * + * @description: + * The list below is taken verbatim from the file `fterrdef.h` (loaded + * automatically by including `FT_FREETYPE_H`). The first argument of the + * `FT_ERROR_DEF_` macro is the error label; by default, the prefix + * `FT_Err_` gets added so that you get error names like + * `FT_Err_Cannot_Open_Resource`. The second argument is the error code, + * and the last argument an error string, which is not used by FreeType. + * + * Within your application you should **only** use error names and + * **never** its numeric values! The latter might (and actually do) + * change in forthcoming FreeType versions. + * + * Macro `FT_NOERRORDEF_` defines `FT_Err_Ok`, which is always zero. See + * the 'Error Enumerations' subsection how to automatically generate a + * list of error strings. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_Err_XXX + * + */ + + /* generic errors */ + + FT_NOERRORDEF_( Ok, 0x00, + "no error" ) + + FT_ERRORDEF_( Cannot_Open_Resource, 0x01, + "cannot open resource" ) + FT_ERRORDEF_( Unknown_File_Format, 0x02, + "unknown file format" ) + FT_ERRORDEF_( Invalid_File_Format, 0x03, + "broken file" ) + FT_ERRORDEF_( Invalid_Version, 0x04, + "invalid FreeType version" ) + FT_ERRORDEF_( Lower_Module_Version, 0x05, + "module version is too low" ) + FT_ERRORDEF_( Invalid_Argument, 0x06, + "invalid argument" ) + FT_ERRORDEF_( Unimplemented_Feature, 0x07, + "unimplemented feature" ) + FT_ERRORDEF_( Invalid_Table, 0x08, + "broken table" ) + FT_ERRORDEF_( Invalid_Offset, 0x09, + "broken offset within table" ) + FT_ERRORDEF_( Array_Too_Large, 0x0A, + "array allocation size too large" ) + FT_ERRORDEF_( Missing_Module, 0x0B, + "missing module" ) + FT_ERRORDEF_( Missing_Property, 0x0C, + "missing property" ) + + /* glyph/character errors */ + + FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, + "invalid glyph index" ) + FT_ERRORDEF_( Invalid_Character_Code, 0x11, + "invalid character code" ) + FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, + "unsupported glyph image format" ) + FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, + "cannot render this glyph format" ) + FT_ERRORDEF_( Invalid_Outline, 0x14, + "invalid outline" ) + FT_ERRORDEF_( Invalid_Composite, 0x15, + "invalid composite glyph" ) + FT_ERRORDEF_( Too_Many_Hints, 0x16, + "too many hints" ) + FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, + "invalid pixel size" ) + FT_ERRORDEF_( Invalid_SVG_Document, 0x18, + "invalid SVG document" ) + + /* handle errors */ + + FT_ERRORDEF_( Invalid_Handle, 0x20, + "invalid object handle" ) + FT_ERRORDEF_( Invalid_Library_Handle, 0x21, + "invalid library handle" ) + FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, + "invalid module handle" ) + FT_ERRORDEF_( Invalid_Face_Handle, 0x23, + "invalid face handle" ) + FT_ERRORDEF_( Invalid_Size_Handle, 0x24, + "invalid size handle" ) + FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, + "invalid glyph slot handle" ) + FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, + "invalid charmap handle" ) + FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, + "invalid cache manager handle" ) + FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, + "invalid stream handle" ) + + /* driver errors */ + + FT_ERRORDEF_( Too_Many_Drivers, 0x30, + "too many modules" ) + FT_ERRORDEF_( Too_Many_Extensions, 0x31, + "too many extensions" ) + + /* memory errors */ + + FT_ERRORDEF_( Out_Of_Memory, 0x40, + "out of memory" ) + FT_ERRORDEF_( Unlisted_Object, 0x41, + "unlisted object" ) + + /* stream errors */ + + FT_ERRORDEF_( Cannot_Open_Stream, 0x51, + "cannot open stream" ) + FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, + "invalid stream seek" ) + FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, + "invalid stream skip" ) + FT_ERRORDEF_( Invalid_Stream_Read, 0x54, + "invalid stream read" ) + FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, + "invalid stream operation" ) + FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, + "invalid frame operation" ) + FT_ERRORDEF_( Nested_Frame_Access, 0x57, + "nested frame access" ) + FT_ERRORDEF_( Invalid_Frame_Read, 0x58, + "invalid frame read" ) + + /* raster errors */ + + FT_ERRORDEF_( Raster_Uninitialized, 0x60, + "raster uninitialized" ) + FT_ERRORDEF_( Raster_Corrupted, 0x61, + "raster corrupted" ) + FT_ERRORDEF_( Raster_Overflow, 0x62, + "raster overflow" ) + FT_ERRORDEF_( Raster_Negative_Height, 0x63, + "negative height while rastering" ) + + /* cache errors */ + + FT_ERRORDEF_( Too_Many_Caches, 0x70, + "too many registered caches" ) + + /* TrueType and SFNT errors */ + + FT_ERRORDEF_( Invalid_Opcode, 0x80, + "invalid opcode" ) + FT_ERRORDEF_( Too_Few_Arguments, 0x81, + "too few arguments" ) + FT_ERRORDEF_( Stack_Overflow, 0x82, + "stack overflow" ) + FT_ERRORDEF_( Code_Overflow, 0x83, + "code overflow" ) + FT_ERRORDEF_( Bad_Argument, 0x84, + "bad argument" ) + FT_ERRORDEF_( Divide_By_Zero, 0x85, + "division by zero" ) + FT_ERRORDEF_( Invalid_Reference, 0x86, + "invalid reference" ) + FT_ERRORDEF_( Debug_OpCode, 0x87, + "found debug opcode" ) + FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, + "found ENDF opcode in execution stream" ) + FT_ERRORDEF_( Nested_DEFS, 0x89, + "nested DEFS" ) + FT_ERRORDEF_( Invalid_CodeRange, 0x8A, + "invalid code range" ) + FT_ERRORDEF_( Execution_Too_Long, 0x8B, + "execution context too long" ) + FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, + "too many function definitions" ) + FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, + "too many instruction definitions" ) + FT_ERRORDEF_( Table_Missing, 0x8E, + "SFNT font table missing" ) + FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, + "horizontal header (hhea) table missing" ) + FT_ERRORDEF_( Locations_Missing, 0x90, + "locations (loca) table missing" ) + FT_ERRORDEF_( Name_Table_Missing, 0x91, + "name table missing" ) + FT_ERRORDEF_( CMap_Table_Missing, 0x92, + "character map (cmap) table missing" ) + FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, + "horizontal metrics (hmtx) table missing" ) + FT_ERRORDEF_( Post_Table_Missing, 0x94, + "PostScript (post) table missing" ) + FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, + "invalid horizontal metrics" ) + FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, + "invalid character map (cmap) format" ) + FT_ERRORDEF_( Invalid_PPem, 0x97, + "invalid ppem value" ) + FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, + "invalid vertical metrics" ) + FT_ERRORDEF_( Could_Not_Find_Context, 0x99, + "could not find context" ) + FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, + "invalid PostScript (post) table format" ) + FT_ERRORDEF_( Invalid_Post_Table, 0x9B, + "invalid PostScript (post) table" ) + FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C, + "found FDEF or IDEF opcode in glyf bytecode" ) + FT_ERRORDEF_( Missing_Bitmap, 0x9D, + "missing bitmap in strike" ) + FT_ERRORDEF_( Missing_SVG_Hooks, 0x9E, + "SVG hooks have not been set" ) + + /* CFF, CID, and Type 1 errors */ + + FT_ERRORDEF_( Syntax_Error, 0xA0, + "opcode syntax error" ) + FT_ERRORDEF_( Stack_Underflow, 0xA1, + "argument stack underflow" ) + FT_ERRORDEF_( Ignore, 0xA2, + "ignore" ) + FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, + "no Unicode glyph name found" ) + FT_ERRORDEF_( Glyph_Too_Big, 0xA4, + "glyph too big for hinting" ) + + /* BDF errors */ + + FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, + "`STARTFONT' field missing" ) + FT_ERRORDEF_( Missing_Font_Field, 0xB1, + "`FONT' field missing" ) + FT_ERRORDEF_( Missing_Size_Field, 0xB2, + "`SIZE' field missing" ) + FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, + "`FONTBOUNDINGBOX' field missing" ) + FT_ERRORDEF_( Missing_Chars_Field, 0xB4, + "`CHARS' field missing" ) + FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, + "`STARTCHAR' field missing" ) + FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, + "`ENCODING' field missing" ) + FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, + "`BBX' field missing" ) + FT_ERRORDEF_( Bbx_Too_Big, 0xB8, + "`BBX' too big" ) + FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, + "Font header corrupted or missing fields" ) + FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, + "Font glyphs corrupted or missing fields" ) + + /* */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrors.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrors.h new file mode 100644 index 0000000000000000000000000000000000000000..eca494f90c086e49308bbcdb56efcdb68685760b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fterrors.h @@ -0,0 +1,296 @@ +/**************************************************************************** + * + * fterrors.h + * + * FreeType error code handling (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * @section: + * error_enumerations + * + * @title: + * Error Enumerations + * + * @abstract: + * How to handle errors and error strings. + * + * @description: + * The header file `fterrors.h` (which is automatically included by + * `freetype.h`) defines the handling of FreeType's enumeration + * constants. It can also be used to generate error message strings + * with a small macro trick explained below. + * + * **Error Formats** + * + * The configuration macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` can be + * defined in `ftoption.h` in order to make the higher byte indicate the + * module where the error has happened (this is not compatible with + * standard builds of FreeType~2, however). See the file `ftmoderr.h` + * for more details. + * + * **Error Message Strings** + * + * Error definitions are set up with special macros that allow client + * applications to build a table of error message strings. The strings + * are not included in a normal build of FreeType~2 to save space (most + * client applications do not use them). + * + * To do so, you have to define the following macros before including + * this file. + * + * ``` + * FT_ERROR_START_LIST + * ``` + * + * This macro is called before anything else to define the start of the + * error list. It is followed by several `FT_ERROR_DEF` calls. + * + * ``` + * FT_ERROR_DEF( e, v, s ) + * ``` + * + * This macro is called to define one single error. 'e' is the error + * code identifier (e.g., `Invalid_Argument`), 'v' is the error's + * numerical value, and 's' is the corresponding error string. + * + * ``` + * FT_ERROR_END_LIST + * ``` + * + * This macro ends the list. + * + * Additionally, you have to undefine `FTERRORS_H_` before #including + * this file. + * + * Here is a simple example. + * + * ``` + * #undef FTERRORS_H_ + * #define FT_ERRORDEF( e, v, s ) { e, s }, + * #define FT_ERROR_START_LIST { + * #define FT_ERROR_END_LIST { 0, NULL } }; + * + * const struct + * { + * int err_code; + * const char* err_msg; + * } ft_errors[] = + * + * #include + * ``` + * + * An alternative to using an array is a switch statement. + * + * ``` + * #undef FTERRORS_H_ + * #define FT_ERROR_START_LIST switch ( error_code ) { + * #define FT_ERRORDEF( e, v, s ) case v: return s; + * #define FT_ERROR_END_LIST } + * ``` + * + * If you use `FT_CONFIG_OPTION_USE_MODULE_ERRORS`, `error_code` should + * be replaced with `FT_ERROR_BASE(error_code)` in the last example. + */ + + /* */ + + /* In previous FreeType versions we used `__FTERRORS_H__`. However, */ + /* using two successive underscores in a non-system symbol name */ + /* violates the C (and C++) standard, so it was changed to the */ + /* current form. In spite of this, we have to make */ + /* */ + /* ``` */ + /* #undefine __FTERRORS_H__ */ + /* ``` */ + /* */ + /* work for backward compatibility. */ + /* */ +#if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) ) +#define FTERRORS_H_ +#define __FTERRORS_H__ + + + /* include module base error codes */ +#include + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SETUP MACROS *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + + + /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ + /* By default, we use `FT_Err_`. */ + /* */ +#ifndef FT_ERR_PREFIX +#define FT_ERR_PREFIX FT_Err_ +#endif + + + /* FT_ERR_BASE is used as the base for module-specific errors. */ + /* */ +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS + +#ifndef FT_ERR_BASE +#define FT_ERR_BASE FT_Mod_Err_Base +#endif + +#else + +#undef FT_ERR_BASE +#define FT_ERR_BASE 0 + +#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ + + + /* If FT_ERRORDEF is not defined, we need to define a simple */ + /* enumeration type. */ + /* */ +#ifndef FT_ERRORDEF + +#define FT_INCLUDE_ERR_PROTOS + +#define FT_ERRORDEF( e, v, s ) e = v, +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C + extern "C" { +#endif + +#endif /* !FT_ERRORDEF */ + + + /* this macro is used to define an error */ +#define FT_ERRORDEF_( e, v, s ) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) + + /* this is only used for _Err_Ok, which must be 0! */ +#define FT_NOERRORDEF_( e, v, s ) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) + + +#ifdef FT_ERROR_START_LIST + FT_ERROR_START_LIST +#endif + + + /* now include the error codes */ +#include + + +#ifdef FT_ERROR_END_LIST + FT_ERROR_END_LIST +#endif + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SIMPLE CLEANUP *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + +#ifdef FT_NEED_EXTERN_C + } +#endif + +#undef FT_ERROR_START_LIST +#undef FT_ERROR_END_LIST + +#undef FT_ERRORDEF +#undef FT_ERRORDEF_ +#undef FT_NOERRORDEF_ + +#undef FT_NEED_EXTERN_C +#undef FT_ERR_BASE + + /* FT_ERR_PREFIX is needed internally */ +#ifndef FT2_BUILD_LIBRARY +#undef FT_ERR_PREFIX +#endif + + /* FT_INCLUDE_ERR_PROTOS: Control whether function prototypes should be */ + /* included with */ + /* */ + /* #include */ + /* */ + /* This is only true where `FT_ERRORDEF` is */ + /* undefined. */ + /* */ + /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */ + /* `fterrors.h`. */ +#ifdef FT_INCLUDE_ERR_PROTOS +#undef FT_INCLUDE_ERR_PROTOS + +#ifndef FT_ERR_PROTOS_DEFINED +#define FT_ERR_PROTOS_DEFINED + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @function: + * FT_Error_String + * + * @description: + * Retrieve the description of a valid FreeType error code. + * + * @input: + * error_code :: + * A valid FreeType error code. + * + * @return: + * A C~string or `NULL`, if any error occurred. + * + * @note: + * FreeType has to be compiled with `FT_CONFIG_OPTION_ERROR_STRINGS` or + * `FT_DEBUG_LEVEL_ERROR` to get meaningful descriptions. + * 'error_string' will be `NULL` otherwise. + * + * Module identification will be ignored: + * + * ```c + * strcmp( FT_Error_String( FT_Err_Unknown_File_Format ), + * FT_Error_String( BDF_Err_Unknown_File_Format ) ) == 0; + * ``` + */ + FT_EXPORT( const char* ) + FT_Error_String( FT_Error error_code ); + + /* */ + +FT_END_HEADER + + +#endif /* FT_ERR_PROTOS_DEFINED */ + +#endif /* FT_INCLUDE_ERR_PROTOS */ + +#endif /* !(FTERRORS_H_ && __FTERRORS_H__) */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftfntfmt.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftfntfmt.h new file mode 100644 index 0000000000000000000000000000000000000000..5df82447d0ee20978ca774843c380e75c4baeae1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftfntfmt.h @@ -0,0 +1,93 @@ +/**************************************************************************** + * + * ftfntfmt.h + * + * Support functions for font formats. + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTFNTFMT_H_ +#define FTFNTFMT_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * font_formats + * + * @title: + * Font Formats + * + * @abstract: + * Getting the font format. + * + * @description: + * The single function in this section can be used to get the font format. + * Note that this information is not needed normally; however, there are + * special cases (like in PDF devices) where it is important to + * differentiate, in spite of FreeType's uniform API. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Get_Font_Format + * + * @description: + * Return a string describing the format of a given face. Possible values + * are 'TrueType', 'Type~1', 'BDF', 'PCF', 'Type~42', 'CID~Type~1', 'CFF', + * 'PFR', and 'Windows~FNT'. + * + * The return value is suitable to be used as an X11 FONT_PROPERTY. + * + * @input: + * face :: + * Input face handle. + * + * @return: + * Font format string. `NULL` in case of error. + * + * @note: + * A deprecated name for the same function is `FT_Get_X11_Font_Format`. + */ + FT_EXPORT( const char* ) + FT_Get_Font_Format( FT_Face face ); + + + /* deprecated */ + FT_EXPORT( const char* ) + FT_Get_X11_Font_Format( FT_Face face ); + + + /* */ + + +FT_END_HEADER + +#endif /* FTFNTFMT_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgasp.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgasp.h new file mode 100644 index 0000000000000000000000000000000000000000..77e5a7e7bfd30b23dbdb239b16f1a457dbe11436 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgasp.h @@ -0,0 +1,143 @@ +/**************************************************************************** + * + * ftgasp.h + * + * Access of TrueType's 'gasp' table (specification). + * + * Copyright (C) 2007-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTGASP_H_ +#define FTGASP_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * gasp_table + * + * @title: + * Gasp Table + * + * @abstract: + * Retrieving TrueType 'gasp' table entries. + * + * @description: + * The function @FT_Get_Gasp can be used to query a TrueType or OpenType + * font for specific entries in its 'gasp' table, if any. This is mainly + * useful when implementing native TrueType hinting with the bytecode + * interpreter to duplicate the Windows text rendering results. + */ + + /************************************************************************** + * + * @enum: + * FT_GASP_XXX + * + * @description: + * A list of values and/or bit-flags returned by the @FT_Get_Gasp + * function. + * + * @values: + * FT_GASP_NO_TABLE :: + * This special value means that there is no GASP table in this face. + * It is up to the client to decide what to do. + * + * FT_GASP_DO_GRIDFIT :: + * Grid-fitting and hinting should be performed at the specified ppem. + * This **really** means TrueType bytecode interpretation. If this bit + * is not set, no hinting gets applied. + * + * FT_GASP_DO_GRAY :: + * Anti-aliased rendering should be performed at the specified ppem. + * If not set, do monochrome rendering. + * + * FT_GASP_SYMMETRIC_SMOOTHING :: + * If set, smoothing along multiple axes must be used with ClearType. + * + * FT_GASP_SYMMETRIC_GRIDFIT :: + * Grid-fitting must be used with ClearType's symmetric smoothing. + * + * @note: + * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be + * used for standard font rasterization only. Independently of that, + * `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to + * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and + * `FT_GASP_DO_GRAY` are consequently ignored). + * + * 'ClearType' is Microsoft's implementation of LCD rendering, partly + * protected by patents. + * + * @since: + * 2.3.0 + */ +#define FT_GASP_NO_TABLE -1 +#define FT_GASP_DO_GRIDFIT 0x01 +#define FT_GASP_DO_GRAY 0x02 +#define FT_GASP_SYMMETRIC_GRIDFIT 0x04 +#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 + + + /************************************************************************** + * + * @function: + * FT_Get_Gasp + * + * @description: + * For a TrueType or OpenType font file, return the rasterizer behaviour + * flags from the font's 'gasp' table corresponding to a given character + * pixel size. + * + * @input: + * face :: + * The source face handle. + * + * ppem :: + * The vertical character pixel size. + * + * @return: + * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no + * 'gasp' table in the face. + * + * @note: + * If you want to use the MM functionality of OpenType variation fonts + * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this + * function **after** setting an instance since the return values can + * change. + * + * @since: + * 2.3.0 + */ + FT_EXPORT( FT_Int ) + FT_Get_Gasp( FT_Face face, + FT_UInt ppem ); + + /* */ + + +FT_END_HEADER + +#endif /* FTGASP_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftglyph.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftglyph.h new file mode 100644 index 0000000000000000000000000000000000000000..3691781cf523437cf58cd8b774ae5f2709d39a52 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftglyph.h @@ -0,0 +1,750 @@ +/**************************************************************************** + * + * ftglyph.h + * + * FreeType convenience functions to handle glyphs (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file contains the definition of several convenience functions that + * can be used by client applications to easily retrieve glyph bitmaps and + * outlines from a given face. + * + * These functions should be optional if you are writing a font server or + * text layout engine on top of FreeType. However, they are pretty handy + * for many other simple uses of the library. + * + */ + + +#ifndef FTGLYPH_H_ +#define FTGLYPH_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * glyph_management + * + * @title: + * Glyph Management + * + * @abstract: + * Generic interface to manage individual glyph data. + * + * @description: + * This section contains definitions used to manage glyph data through + * generic @FT_Glyph objects. Each of them can contain a bitmap, + * a vector outline, or even images in other formats. These objects are + * detached from @FT_Face, contrary to @FT_GlyphSlot. + * + */ + + + /* forward declaration to a private type */ + typedef struct FT_Glyph_Class_ FT_Glyph_Class; + + + /************************************************************************** + * + * @type: + * FT_Glyph + * + * @description: + * Handle to an object used to model generic glyph images. It is a + * pointer to the @FT_GlyphRec structure and can contain a glyph bitmap + * or pointer. + * + * @note: + * Glyph objects are not owned by the library. You must thus release + * them manually (through @FT_Done_Glyph) _before_ calling + * @FT_Done_FreeType. + */ + typedef struct FT_GlyphRec_* FT_Glyph; + + + /************************************************************************** + * + * @struct: + * FT_GlyphRec + * + * @description: + * The root glyph structure contains a given glyph image plus its advance + * width in 16.16 fixed-point format. + * + * @fields: + * library :: + * A handle to the FreeType library object. + * + * clazz :: + * A pointer to the glyph's class. Private. + * + * format :: + * The format of the glyph's image. + * + * advance :: + * A 16.16 vector that gives the glyph's advance width. + */ + typedef struct FT_GlyphRec_ + { + FT_Library library; + const FT_Glyph_Class* clazz; + FT_Glyph_Format format; + FT_Vector advance; + + } FT_GlyphRec; + + + /************************************************************************** + * + * @type: + * FT_BitmapGlyph + * + * @description: + * A handle to an object used to model a bitmap glyph image. This is a + * 'sub-class' of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. + */ + typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph; + + + /************************************************************************** + * + * @struct: + * FT_BitmapGlyphRec + * + * @description: + * A structure used for bitmap glyph images. This really is a + * 'sub-class' of @FT_GlyphRec. + * + * @fields: + * root :: + * The root fields of @FT_Glyph. + * + * left :: + * The left-side bearing, i.e., the horizontal distance from the + * current pen position to the left border of the glyph bitmap. + * + * top :: + * The top-side bearing, i.e., the vertical distance from the current + * pen position to the top border of the glyph bitmap. This distance + * is positive for upwards~y! + * + * bitmap :: + * A descriptor for the bitmap. + * + * @note: + * You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have + * `glyph->format == FT_GLYPH_FORMAT_BITMAP`. This lets you access the + * bitmap's contents easily. + * + * The corresponding pixel buffer is always owned by @FT_BitmapGlyph and + * is thus created and destroyed with it. + */ + typedef struct FT_BitmapGlyphRec_ + { + FT_GlyphRec root; + FT_Int left; + FT_Int top; + FT_Bitmap bitmap; + + } FT_BitmapGlyphRec; + + + /************************************************************************** + * + * @type: + * FT_OutlineGlyph + * + * @description: + * A handle to an object used to model an outline glyph image. This is a + * 'sub-class' of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. + */ + typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph; + + + /************************************************************************** + * + * @struct: + * FT_OutlineGlyphRec + * + * @description: + * A structure used for outline (vectorial) glyph images. This really is + * a 'sub-class' of @FT_GlyphRec. + * + * @fields: + * root :: + * The root @FT_Glyph fields. + * + * outline :: + * A descriptor for the outline. + * + * @note: + * You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have + * `glyph->format == FT_GLYPH_FORMAT_OUTLINE`. This lets you access the + * outline's content easily. + * + * As the outline is extracted from a glyph slot, its coordinates are + * expressed normally in 26.6 pixels, unless the flag @FT_LOAD_NO_SCALE + * was used in @FT_Load_Glyph or @FT_Load_Char. + * + * The outline's tables are always owned by the object and are destroyed + * with it. + */ + typedef struct FT_OutlineGlyphRec_ + { + FT_GlyphRec root; + FT_Outline outline; + + } FT_OutlineGlyphRec; + + + /************************************************************************** + * + * @type: + * FT_SvgGlyph + * + * @description: + * A handle to an object used to model an SVG glyph. This is a + * 'sub-class' of @FT_Glyph, and a pointer to @FT_SvgGlyphRec. + * + * @since: + * 2.12 + */ + typedef struct FT_SvgGlyphRec_* FT_SvgGlyph; + + + /************************************************************************** + * + * @struct: + * FT_SvgGlyphRec + * + * @description: + * A structure used for OT-SVG glyphs. This is a 'sub-class' of + * @FT_GlyphRec. + * + * @fields: + * root :: + * The root @FT_GlyphRec fields. + * + * svg_document :: + * A pointer to the SVG document. + * + * svg_document_length :: + * The length of `svg_document`. + * + * glyph_index :: + * The index of the glyph to be rendered. + * + * metrics :: + * A metrics object storing the size information. + * + * units_per_EM :: + * The size of the EM square. + * + * start_glyph_id :: + * The first glyph ID in the glyph range covered by this document. + * + * end_glyph_id :: + * The last glyph ID in the glyph range covered by this document. + * + * transform :: + * A 2x2 transformation matrix to apply to the glyph while rendering + * it. + * + * delta :: + * Translation to apply to the glyph while rendering. + * + * @note: + * The Glyph Management API requires @FT_Glyph or its 'sub-class' to have + * all the information needed to completely define the glyph's rendering. + * Outline-based glyphs can directly apply transformations to the outline + * but this is not possible for an SVG document that hasn't been parsed. + * Therefore, the transformation is stored along with the document. In + * the absence of a 'ViewBox' or 'Width'/'Height' attribute, the size of + * the ViewPort should be assumed to be 'units_per_EM'. + */ + typedef struct FT_SvgGlyphRec_ + { + FT_GlyphRec root; + + FT_Byte* svg_document; + FT_ULong svg_document_length; + + FT_UInt glyph_index; + + FT_Size_Metrics metrics; + FT_UShort units_per_EM; + + FT_UShort start_glyph_id; + FT_UShort end_glyph_id; + + FT_Matrix transform; + FT_Vector delta; + + } FT_SvgGlyphRec; + + + /************************************************************************** + * + * @function: + * FT_New_Glyph + * + * @description: + * A function used to create a new empty glyph image. Note that the + * created @FT_Glyph object must be released with @FT_Done_Glyph. + * + * @input: + * library :: + * A handle to the FreeType library object. + * + * format :: + * The format of the glyph's image. + * + * @output: + * aglyph :: + * A handle to the glyph object. + * + * @return: + * FreeType error code. 0~means success. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_New_Glyph( FT_Library library, + FT_Glyph_Format format, + FT_Glyph *aglyph ); + + + /************************************************************************** + * + * @function: + * FT_Get_Glyph + * + * @description: + * A function used to extract a glyph image from a slot. Note that the + * created @FT_Glyph object must be released with @FT_Done_Glyph. + * + * @input: + * slot :: + * A handle to the source glyph slot. + * + * @output: + * aglyph :: + * A handle to the glyph object. `NULL` in case of error. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Because `*aglyph->advance.x` and `*aglyph->advance.y` are 16.16 + * fixed-point numbers, `slot->advance.x` and `slot->advance.y` (which + * are in 26.6 fixed-point format) must be in the range ]-32768;32768[. + */ + FT_EXPORT( FT_Error ) + FT_Get_Glyph( FT_GlyphSlot slot, + FT_Glyph *aglyph ); + + + /************************************************************************** + * + * @function: + * FT_Glyph_Copy + * + * @description: + * A function used to copy a glyph image. Note that the created + * @FT_Glyph object must be released with @FT_Done_Glyph. + * + * @input: + * source :: + * A handle to the source glyph object. + * + * @output: + * target :: + * A handle to the target glyph object. `NULL` in case of error. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_Copy( FT_Glyph source, + FT_Glyph *target ); + + + /************************************************************************** + * + * @function: + * FT_Glyph_Transform + * + * @description: + * Transform a glyph image if its format is scalable. + * + * @inout: + * glyph :: + * A handle to the target glyph object. + * + * @input: + * matrix :: + * A pointer to a 2x2 matrix to apply. + * + * delta :: + * A pointer to a 2d vector to apply. Coordinates are expressed in + * 1/64 of a pixel. + * + * @return: + * FreeType error code (if not 0, the glyph format is not scalable). + * + * @note: + * The 2x2 transformation matrix is also applied to the glyph's advance + * vector. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_Transform( FT_Glyph glyph, + const FT_Matrix* matrix, + const FT_Vector* delta ); + + + /************************************************************************** + * + * @enum: + * FT_Glyph_BBox_Mode + * + * @description: + * The mode how the values of @FT_Glyph_Get_CBox are returned. + * + * @values: + * FT_GLYPH_BBOX_UNSCALED :: + * Return unscaled font units. + * + * FT_GLYPH_BBOX_SUBPIXELS :: + * Return unfitted 26.6 coordinates. + * + * FT_GLYPH_BBOX_GRIDFIT :: + * Return grid-fitted 26.6 coordinates. + * + * FT_GLYPH_BBOX_TRUNCATE :: + * Return coordinates in integer pixels. + * + * FT_GLYPH_BBOX_PIXELS :: + * Return grid-fitted pixel coordinates. + */ + typedef enum FT_Glyph_BBox_Mode_ + { + FT_GLYPH_BBOX_UNSCALED = 0, + FT_GLYPH_BBOX_SUBPIXELS = 0, + FT_GLYPH_BBOX_GRIDFIT = 1, + FT_GLYPH_BBOX_TRUNCATE = 2, + FT_GLYPH_BBOX_PIXELS = 3 + + } FT_Glyph_BBox_Mode; + + + /* these constants are deprecated; use the corresponding */ + /* `FT_Glyph_BBox_Mode` values instead */ +#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED +#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS +#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT +#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE +#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS + + + /************************************************************************** + * + * @function: + * FT_Glyph_Get_CBox + * + * @description: + * Return a glyph's 'control box'. The control box encloses all the + * outline's points, including Bezier control points. Though it + * coincides with the exact bounding box for most glyphs, it can be + * slightly larger in some situations (like when rotating an outline that + * contains Bezier outside arcs). + * + * Computing the control box is very fast, while getting the bounding box + * can take much more time as it needs to walk over all segments and arcs + * in the outline. To get the latter, you can use the 'ftbbox' + * component, which is dedicated to this single task. + * + * @input: + * glyph :: + * A handle to the source glyph object. + * + * mode :: + * The mode that indicates how to interpret the returned bounding box + * values. + * + * @output: + * acbox :: + * The glyph coordinate bounding box. Coordinates are expressed in + * 1/64 of pixels if it is grid-fitted. + * + * @note: + * Coordinates are relative to the glyph origin, using the y~upwards + * convention. + * + * If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode` must + * be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font units in 26.6 + * pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS is another name for + * this constant. + * + * If the font is tricky and the glyph has been loaded with + * @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get + * reasonable values for the CBox it is necessary to load the glyph at a + * large ppem value (so that the hinting instructions can properly shift + * and scale the subglyphs), then extracting the CBox, which can be + * eventually converted back to font units. + * + * Note that the maximum coordinates are exclusive, which means that one + * can compute the width and height of the glyph image (be it in integer + * or 26.6 pixels) as: + * + * ``` + * width = bbox.xMax - bbox.xMin; + * height = bbox.yMax - bbox.yMin; + * ``` + * + * Note also that for 26.6 coordinates, if `bbox_mode` is set to + * @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, + * which corresponds to: + * + * ``` + * bbox.xMin = FLOOR(bbox.xMin); + * bbox.yMin = FLOOR(bbox.yMin); + * bbox.xMax = CEILING(bbox.xMax); + * bbox.yMax = CEILING(bbox.yMax); + * ``` + * + * To get the bbox in pixel coordinates, set `bbox_mode` to + * @FT_GLYPH_BBOX_TRUNCATE. + * + * To get the bbox in grid-fitted pixel coordinates, set `bbox_mode` to + * @FT_GLYPH_BBOX_PIXELS. + */ + FT_EXPORT( void ) + FT_Glyph_Get_CBox( FT_Glyph glyph, + FT_UInt bbox_mode, + FT_BBox *acbox ); + + + /************************************************************************** + * + * @function: + * FT_Glyph_To_Bitmap + * + * @description: + * Convert a given glyph object to a bitmap glyph object. + * + * @inout: + * the_glyph :: + * A pointer to a handle to the target glyph. + * + * @input: + * render_mode :: + * An enumeration that describes how the data is rendered. + * + * origin :: + * A pointer to a vector used to translate the glyph image before + * rendering. Can be~0 (if no translation). The origin is expressed + * in 26.6 pixels. + * + * destroy :: + * A boolean that indicates that the original glyph image should be + * destroyed by this function. It is never destroyed in case of error. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function does nothing if the glyph format isn't scalable. + * + * The glyph image is translated with the `origin` vector before + * rendering. + * + * The first parameter is a pointer to an @FT_Glyph handle that will be + * _replaced_ by this function (with newly allocated data). Typically, + * you would do something like the following (omitting error handling). + * + * ``` + * FT_Glyph glyph; + * FT_BitmapGlyph glyph_bitmap; + * + * + * // load glyph + * error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT ); + * + * // extract glyph image + * error = FT_Get_Glyph( face->glyph, &glyph ); + * + * // convert to a bitmap (default render mode + destroying old) + * if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) + * { + * error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, + * 0, 1 ); + * if ( error ) // `glyph' unchanged + * ... + * } + * + * // access bitmap content by typecasting + * glyph_bitmap = (FT_BitmapGlyph)glyph; + * + * // do funny stuff with it, like blitting/drawing + * ... + * + * // discard glyph image (bitmap or not) + * FT_Done_Glyph( glyph ); + * ``` + * + * Here is another example, again without error handling. + * + * ``` + * FT_Glyph glyphs[MAX_GLYPHS] + * + * + * ... + * + * for ( idx = 0; i < MAX_GLYPHS; i++ ) + * error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || + * FT_Get_Glyph ( face->glyph, &glyphs[idx] ); + * + * ... + * + * for ( idx = 0; i < MAX_GLYPHS; i++ ) + * { + * FT_Glyph bitmap = glyphs[idx]; + * + * + * ... + * + * // after this call, `bitmap' no longer points into + * // the `glyphs' array (and the old value isn't destroyed) + * FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); + * + * ... + * + * FT_Done_Glyph( bitmap ); + * } + * + * ... + * + * for ( idx = 0; i < MAX_GLYPHS; i++ ) + * FT_Done_Glyph( glyphs[idx] ); + * ``` + */ + FT_EXPORT( FT_Error ) + FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, + FT_Render_Mode render_mode, + const FT_Vector* origin, + FT_Bool destroy ); + + + /************************************************************************** + * + * @function: + * FT_Done_Glyph + * + * @description: + * Destroy a given glyph. + * + * @input: + * glyph :: + * A handle to the target glyph object. Can be `NULL`. + */ + FT_EXPORT( void ) + FT_Done_Glyph( FT_Glyph glyph ); + + /* */ + + + /* other helpful functions */ + + /************************************************************************** + * + * @section: + * computations + * + */ + + + /************************************************************************** + * + * @function: + * FT_Matrix_Multiply + * + * @description: + * Perform the matrix operation `b = a*b`. + * + * @input: + * a :: + * A pointer to matrix `a`. + * + * @inout: + * b :: + * A pointer to matrix `b`. + * + * @note: + * The result is undefined if either `a` or `b` is zero. + * + * Since the function uses wrap-around arithmetic, results become + * meaningless if the arguments are very large. + */ + FT_EXPORT( void ) + FT_Matrix_Multiply( const FT_Matrix* a, + FT_Matrix* b ); + + + /************************************************************************** + * + * @function: + * FT_Matrix_Invert + * + * @description: + * Invert a 2x2 matrix. Return an error if it can't be inverted. + * + * @inout: + * matrix :: + * A pointer to the target matrix. Remains untouched in case of error. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Matrix_Invert( FT_Matrix* matrix ); + + /* */ + + +FT_END_HEADER + +#endif /* FTGLYPH_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgxval.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgxval.h new file mode 100644 index 0000000000000000000000000000000000000000..843e0bc917c5c48f221197468bcbbb7d2a36796a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgxval.h @@ -0,0 +1,354 @@ +/**************************************************************************** + * + * ftgxval.h + * + * FreeType API for validating TrueTypeGX/AAT tables (specification). + * + * Copyright (C) 2004-2025 by + * Masatake YAMATO, Redhat K.K, + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + +/**************************************************************************** + * + * gxvalid is derived from both gxlayout module and otvalid module. + * Development of gxlayout is supported by the Information-technology + * Promotion Agency(IPA), Japan. + * + */ + + +#ifndef FTGXVAL_H_ +#define FTGXVAL_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * gx_validation + * + * @title: + * TrueTypeGX/AAT Validation + * + * @abstract: + * An API to validate TrueTypeGX/AAT tables. + * + * @description: + * This section contains the declaration of functions to validate some + * TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, trak, + * prop, lcar). + * + * @order: + * FT_TrueTypeGX_Validate + * FT_TrueTypeGX_Free + * + * FT_ClassicKern_Validate + * FT_ClassicKern_Free + * + * FT_VALIDATE_GX_LENGTH + * FT_VALIDATE_GXXXX + * FT_VALIDATE_CKERNXXX + * + */ + + /************************************************************************** + * + * + * Warning: Use `FT_VALIDATE_XXX` to validate a table. + * Following definitions are for gxvalid developers. + * + * + */ + +#define FT_VALIDATE_feat_INDEX 0 +#define FT_VALIDATE_mort_INDEX 1 +#define FT_VALIDATE_morx_INDEX 2 +#define FT_VALIDATE_bsln_INDEX 3 +#define FT_VALIDATE_just_INDEX 4 +#define FT_VALIDATE_kern_INDEX 5 +#define FT_VALIDATE_opbd_INDEX 6 +#define FT_VALIDATE_trak_INDEX 7 +#define FT_VALIDATE_prop_INDEX 8 +#define FT_VALIDATE_lcar_INDEX 9 +#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX + + + /************************************************************************** + * + * @macro: + * FT_VALIDATE_GX_LENGTH + * + * @description: + * The number of tables checked in this module. Use it as a parameter + * for the `table-length` argument of function @FT_TrueTypeGX_Validate. + */ +#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 ) + + /* */ + + /* Up to 0x1000 is used by otvalid. + Ox2xxx is reserved for feature OT extension. */ +#define FT_VALIDATE_GX_START 0x4000 +#define FT_VALIDATE_GX_BITFIELD( tag ) \ + ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) + + + /************************************************************************** + * + * @enum: + * FT_VALIDATE_GXXXX + * + * @description: + * A list of bit-field constants used with @FT_TrueTypeGX_Validate to + * indicate which TrueTypeGX/AAT Type tables should be validated. + * + * @values: + * FT_VALIDATE_feat :: + * Validate 'feat' table. + * + * FT_VALIDATE_mort :: + * Validate 'mort' table. + * + * FT_VALIDATE_morx :: + * Validate 'morx' table. + * + * FT_VALIDATE_bsln :: + * Validate 'bsln' table. + * + * FT_VALIDATE_just :: + * Validate 'just' table. + * + * FT_VALIDATE_kern :: + * Validate 'kern' table. + * + * FT_VALIDATE_opbd :: + * Validate 'opbd' table. + * + * FT_VALIDATE_trak :: + * Validate 'trak' table. + * + * FT_VALIDATE_prop :: + * Validate 'prop' table. + * + * FT_VALIDATE_lcar :: + * Validate 'lcar' table. + * + * FT_VALIDATE_GX :: + * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern, + * opbd, trak, prop and lcar). + * + */ + +#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat ) +#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort ) +#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx ) +#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln ) +#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just ) +#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern ) +#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd ) +#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak ) +#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop ) +#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar ) + +#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ + FT_VALIDATE_mort | \ + FT_VALIDATE_morx | \ + FT_VALIDATE_bsln | \ + FT_VALIDATE_just | \ + FT_VALIDATE_kern | \ + FT_VALIDATE_opbd | \ + FT_VALIDATE_trak | \ + FT_VALIDATE_prop | \ + FT_VALIDATE_lcar ) + + + /************************************************************************** + * + * @function: + * FT_TrueTypeGX_Validate + * + * @description: + * Validate various TrueTypeGX tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library that + * actually does the text layout can access those tables without error + * checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field that specifies the tables to be validated. See + * @FT_VALIDATE_GXXXX for possible values. + * + * table_length :: + * The size of the `tables` array. Normally, @FT_VALIDATE_GX_LENGTH + * should be passed. + * + * @output: + * tables :: + * The array where all validated sfnt tables are stored. The array + * itself must be allocated by a client. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with TrueTypeGX fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the buffers pointed to by + * each `tables` element, by calling @FT_TrueTypeGX_Free. A `NULL` value + * indicates that the table either doesn't exist in the font, the + * application hasn't asked for validation, or the validator doesn't have + * the ability to validate the sfnt table. + */ + FT_EXPORT( FT_Error ) + FT_TrueTypeGX_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes tables[FT_VALIDATE_GX_LENGTH], + FT_UInt table_length ); + + + /************************************************************************** + * + * @function: + * FT_TrueTypeGX_Free + * + * @description: + * Free the buffer allocated by TrueTypeGX validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer allocated by @FT_TrueTypeGX_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_TrueTypeGX_Validate only. + */ + FT_EXPORT( void ) + FT_TrueTypeGX_Free( FT_Face face, + FT_Bytes table ); + + + /************************************************************************** + * + * @enum: + * FT_VALIDATE_CKERNXXX + * + * @description: + * A list of bit-field constants used with @FT_ClassicKern_Validate to + * indicate the classic kern dialect or dialects. If the selected type + * doesn't fit, @FT_ClassicKern_Validate regards the table as invalid. + * + * @values: + * FT_VALIDATE_MS :: + * Handle the 'kern' table as a classic Microsoft kern table. + * + * FT_VALIDATE_APPLE :: + * Handle the 'kern' table as a classic Apple kern table. + * + * FT_VALIDATE_CKERN :: + * Handle the 'kern' as either classic Apple or Microsoft kern table. + */ +#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) +#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) + +#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) + + + /************************************************************************** + * + * @function: + * FT_ClassicKern_Validate + * + * @description: + * Validate classic (16-bit format) kern table to assure that the + * offsets and indices are valid. The idea is that a higher-level + * library that actually does the text layout can access those tables + * without error checking (which can be quite time consuming). + * + * The 'kern' table validator in @FT_TrueTypeGX_Validate deals with both + * the new 32-bit format and the classic 16-bit format, while + * FT_ClassicKern_Validate only supports the classic 16-bit format. + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field that specifies the dialect to be validated. See + * @FT_VALIDATE_CKERNXXX for possible values. + * + * @output: + * ckern_table :: + * A pointer to the kern table. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * After use, the application should deallocate the buffers pointed to by + * `ckern_table`, by calling @FT_ClassicKern_Free. A `NULL` value + * indicates that the table doesn't exist in the font. + */ + FT_EXPORT( FT_Error ) + FT_ClassicKern_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes *ckern_table ); + + + /************************************************************************** + * + * @function: + * FT_ClassicKern_Free + * + * @description: + * Free the buffer allocated by classic Kern validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer that is allocated by + * @FT_ClassicKern_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_ClassicKern_Validate only. + */ + FT_EXPORT( void ) + FT_ClassicKern_Free( FT_Face face, + FT_Bytes table ); + + /* */ + + +FT_END_HEADER + +#endif /* FTGXVAL_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgzip.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgzip.h new file mode 100644 index 0000000000000000000000000000000000000000..e26c334c11a10849e3340f005feeab190eded104 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftgzip.h @@ -0,0 +1,151 @@ +/**************************************************************************** + * + * ftgzip.h + * + * Gzip-compressed stream support. + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTGZIP_H_ +#define FTGZIP_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * gzip + * + * @title: + * GZIP Streams + * + * @abstract: + * Using gzip-compressed font files. + * + * @description: + * In certain builds of the library, gzip compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a gzipped stream from it + * and re-open the face with it. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream, + * which significantly undermines the performance. + * + * This section contains the declaration of Gzip-specific functions. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Stream_OpenGzip + * + * @description: + * Open a new stream to parse gzip-compressed font files. This is mainly + * used to support the compressed `*.pcf.gz` fonts that come with + * XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close` on the new stream will + * **not** call `FT_Stream_Close` on the source stream. None of the + * stream objects will be released to the heap. + * + * This function may return `FT_Err_Unimplemented_Feature` if your build + * of FreeType was not compiled with zlib support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenGzip( FT_Stream stream, + FT_Stream source ); + + + /************************************************************************** + * + * @function: + * FT_Gzip_Uncompress + * + * @description: + * Decompress a zipped input buffer into an output buffer. This function + * is modeled after zlib's `uncompress` function. + * + * @input: + * memory :: + * A FreeType memory handle. + * + * input :: + * The input buffer. + * + * input_len :: + * The length of the input buffer. + * + * @output: + * output :: + * The output buffer. + * + * @inout: + * output_len :: + * Before calling the function, this is the total size of the output + * buffer, which must be large enough to hold the entire uncompressed + * data (so the size of the uncompressed data must be known in + * advance). After calling the function, `output_len` is the size of + * the used data in `output`. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function may return `FT_Err_Unimplemented_Feature` if your build + * of FreeType was not compiled with zlib support. + * + * @since: + * 2.5.1 + */ + FT_EXPORT( FT_Error ) + FT_Gzip_Uncompress( FT_Memory memory, + FT_Byte* output, + FT_ULong* output_len, + const FT_Byte* input, + FT_ULong input_len ); + + /* */ + + +FT_END_HEADER + +#endif /* FTGZIP_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftimage.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftimage.h new file mode 100644 index 0000000000000000000000000000000000000000..a4dc724f3499e6c4bcefe82e90e1ca79d376fc8b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftimage.h @@ -0,0 +1,1293 @@ +/**************************************************************************** + * + * ftimage.h + * + * FreeType glyph image formats and default raster interface + * (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + /************************************************************************** + * + * Note: A 'raster' is simply a scan-line converter, used to render + * `FT_Outline`s into `FT_Bitmap`s. + * + * Note: This file can be used for `STANDALONE_` compilation of raster + * (B/W) and smooth (anti-aliased) renderers. Therefore, it must + * rely on standard variable types only instead of aliases in + * `fttypes.h`. + * + */ + + +#ifndef FTIMAGE_H_ +#define FTIMAGE_H_ + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * basic_types + * + */ + + + /************************************************************************** + * + * @type: + * FT_Pos + * + * @description: + * The type FT_Pos is used to store vectorial coordinates. Depending on + * the context, these can represent distances in integer font units, or + * 16.16, or 26.6 fixed-point pixel coordinates. + */ + typedef signed long FT_Pos; + + + /************************************************************************** + * + * @struct: + * FT_Vector + * + * @description: + * A simple structure used to store a 2D vector; coordinates are of the + * FT_Pos type. + * + * @fields: + * x :: + * The horizontal coordinate. + * y :: + * The vertical coordinate. + */ + typedef struct FT_Vector_ + { + FT_Pos x; + FT_Pos y; + + } FT_Vector; + + + /************************************************************************** + * + * @struct: + * FT_BBox + * + * @description: + * A structure used to hold an outline's bounding box, i.e., the + * coordinates of its extrema in the horizontal and vertical directions. + * + * @fields: + * xMin :: + * The horizontal minimum (left-most). + * + * yMin :: + * The vertical minimum (bottom-most). + * + * xMax :: + * The horizontal maximum (right-most). + * + * yMax :: + * The vertical maximum (top-most). + * + * @note: + * The bounding box is specified with the coordinates of the lower left + * and the upper right corner. In PostScript, those values are often + * called (llx,lly) and (urx,ury), respectively. + * + * If `yMin` is negative, this value gives the glyph's descender. + * Otherwise, the glyph doesn't descend below the baseline. Similarly, + * if `ymax` is positive, this value gives the glyph's ascender. + * + * `xMin` gives the horizontal distance from the glyph's origin to the + * left edge of the glyph's bounding box. If `xMin` is negative, the + * glyph extends to the left of the origin. + */ + typedef struct FT_BBox_ + { + FT_Pos xMin, yMin; + FT_Pos xMax, yMax; + + } FT_BBox; + + + /************************************************************************** + * + * @enum: + * FT_Pixel_Mode + * + * @description: + * An enumeration type used to describe the format of pixels in a given + * bitmap. Note that additional formats may be added in the future. + * + * @values: + * FT_PIXEL_MODE_NONE :: + * Value~0 is reserved. + * + * FT_PIXEL_MODE_MONO :: + * A monochrome bitmap, using 1~bit per pixel. Note that pixels are + * stored in most-significant order (MSB), which means that the + * left-most pixel in a byte has value 128. + * + * FT_PIXEL_MODE_GRAY :: + * An 8-bit bitmap, generally used to represent anti-aliased glyph + * images. Each pixel is stored in one byte. Note that the number of + * 'gray' levels is stored in the `num_grays` field of the @FT_Bitmap + * structure (it generally is 256). + * + * FT_PIXEL_MODE_GRAY2 :: + * A 2-bit per pixel bitmap, used to represent embedded anti-aliased + * bitmaps in font files according to the OpenType specification. We + * haven't found a single font using this format, however. + * + * FT_PIXEL_MODE_GRAY4 :: + * A 4-bit per pixel bitmap, representing embedded anti-aliased bitmaps + * in font files according to the OpenType specification. We haven't + * found a single font using this format, however. + * + * FT_PIXEL_MODE_LCD :: + * An 8-bit bitmap, representing RGB or BGR decimated glyph images used + * for display on LCD displays; the bitmap is three times wider than + * the original glyph image. See also @FT_RENDER_MODE_LCD. + * + * FT_PIXEL_MODE_LCD_V :: + * An 8-bit bitmap, representing RGB or BGR decimated glyph images used + * for display on rotated LCD displays; the bitmap is three times + * taller than the original glyph image. See also + * @FT_RENDER_MODE_LCD_V. + * + * FT_PIXEL_MODE_BGRA :: + * [Since 2.5] An image with four 8-bit channels per pixel, + * representing a color image (such as emoticons) with alpha channel. + * For each pixel, the format is BGRA, which means, the blue channel + * comes first in memory. The color channels are pre-multiplied and in + * the sRGB colorspace. For example, full red at half-translucent + * opacity will be represented as '00,00,80,80', not '00,00,FF,80'. + * See also @FT_LOAD_COLOR. + */ + typedef enum FT_Pixel_Mode_ + { + FT_PIXEL_MODE_NONE = 0, + FT_PIXEL_MODE_MONO, + FT_PIXEL_MODE_GRAY, + FT_PIXEL_MODE_GRAY2, + FT_PIXEL_MODE_GRAY4, + FT_PIXEL_MODE_LCD, + FT_PIXEL_MODE_LCD_V, + FT_PIXEL_MODE_BGRA, + + FT_PIXEL_MODE_MAX /* do not remove */ + + } FT_Pixel_Mode; + + + /* these constants are deprecated; use the corresponding `FT_Pixel_Mode` */ + /* values instead. */ +#define ft_pixel_mode_none FT_PIXEL_MODE_NONE +#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO +#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY +#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 +#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 + + /* */ + + /* For debugging, the @FT_Pixel_Mode enumeration must stay in sync */ + /* with the `pixel_modes` array in file `ftobjs.c`. */ + + + /************************************************************************** + * + * @struct: + * FT_Bitmap + * + * @description: + * A structure used to describe a bitmap or pixmap to the raster. Note + * that we now manage pixmaps of various depths through the `pixel_mode` + * field. + * + * @fields: + * rows :: + * The number of bitmap rows. + * + * width :: + * The number of pixels in bitmap row. + * + * pitch :: + * The pitch's absolute value is the number of bytes taken by one + * bitmap row, including padding. However, the pitch is positive when + * the bitmap has a 'down' flow, and negative when it has an 'up' flow. + * In all cases, the pitch is an offset to add to a bitmap pointer in + * order to go down one row. + * + * Note that 'padding' means the alignment of a bitmap to a byte + * border, and FreeType functions normally align to the smallest + * possible integer value. + * + * For the B/W rasterizer, `pitch` is always an even number. + * + * To change the pitch of a bitmap (say, to make it a multiple of 4), + * use @FT_Bitmap_Convert. Alternatively, you might use callback + * functions to directly render to the application's surface; see the + * file `example2.cpp` in the tutorial for a demonstration. + * + * buffer :: + * A typeless pointer to the bitmap buffer. This value should be + * aligned on 32-bit boundaries in most cases. + * + * num_grays :: + * This field is only used with @FT_PIXEL_MODE_GRAY; it gives the + * number of gray levels used in the bitmap. + * + * pixel_mode :: + * The pixel mode, i.e., how pixel bits are stored. See @FT_Pixel_Mode + * for possible values. + * + * palette_mode :: + * This field is intended for paletted pixel modes; it indicates how + * the palette is stored. Not used currently. + * + * palette :: + * A typeless pointer to the bitmap palette; this field is intended for + * paletted pixel modes. Not used currently. + * + * @note: + * `width` and `rows` refer to the *physical* size of the bitmap, not the + * *logical* one. For example, if @FT_Pixel_Mode is set to + * `FT_PIXEL_MODE_LCD`, the logical width is a just a third of the + * physical one. + * + * An empty bitmap with a NULL `buffer` is valid, with `rows` and/or + * `pitch` also set to 0. Such bitmaps might be produced while rendering + * empty or degenerate outlines. + */ + typedef struct FT_Bitmap_ + { + unsigned int rows; + unsigned int width; + int pitch; + unsigned char* buffer; + unsigned short num_grays; + unsigned char pixel_mode; + unsigned char palette_mode; + void* palette; + + } FT_Bitmap; + + + /************************************************************************** + * + * @section: + * outline_processing + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Outline + * + * @description: + * This structure is used to describe an outline to the scan-line + * converter. + * + * @fields: + * n_contours :: + * The number of contours in the outline. + * + * n_points :: + * The number of points in the outline. + * + * points :: + * A pointer to an array of `n_points` @FT_Vector elements, giving the + * outline's point coordinates. + * + * tags :: + * A pointer to an array of `n_points` chars, giving each outline + * point's type. + * + * If bit~0 is unset, the point is 'off' the curve, i.e., a Bezier + * control point, while it is 'on' if set. + * + * Bit~1 is meaningful for 'off' points only. If set, it indicates a + * third-order Bezier arc control point; and a second-order control + * point if unset. + * + * If bit~2 is set, bits 5-7 contain the drop-out mode (as defined in + * the OpenType specification; the value is the same as the argument to + * the 'SCANTYPE' instruction). + * + * Bits 3 and~4 are reserved for internal purposes. + * + * contours :: + * An array of `n_contours` shorts, giving the end point of each + * contour within the outline. For example, the first contour is + * defined by the points '0' to `contours[0]`, the second one is + * defined by the points `contours[0]+1` to `contours[1]`, etc. + * + * flags :: + * A set of bit flags used to characterize the outline and give hints + * to the scan-converter and hinter on how to convert/grid-fit it. See + * @FT_OUTLINE_XXX. + * + * @note: + * The B/W rasterizer only checks bit~2 in the `tags` array for the first + * point of each contour. The drop-out mode as given with + * @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and + * @FT_OUTLINE_INCLUDE_STUBS in `flags` is then overridden. + */ + typedef struct FT_Outline_ + { + unsigned short n_contours; /* number of contours in glyph */ + unsigned short n_points; /* number of points in the glyph */ + + FT_Vector* points; /* the outline's points */ + unsigned char* tags; /* the points flags */ + unsigned short* contours; /* the contour end points */ + + int flags; /* outline masks */ + + } FT_Outline; + + /* */ + + /* Following limits must be consistent with */ + /* FT_Outline.{n_contours,n_points} */ +#define FT_OUTLINE_CONTOURS_MAX USHRT_MAX +#define FT_OUTLINE_POINTS_MAX USHRT_MAX + + + /************************************************************************** + * + * @enum: + * FT_OUTLINE_XXX + * + * @description: + * A list of bit-field constants used for the flags in an outline's + * `flags` field. + * + * @values: + * FT_OUTLINE_NONE :: + * Value~0 is reserved. + * + * FT_OUTLINE_OWNER :: + * If set, this flag indicates that the outline's field arrays (i.e., + * `points`, `flags`, and `contours`) are 'owned' by the outline + * object, and should thus be freed when it is destroyed. + * + * FT_OUTLINE_EVEN_ODD_FILL :: + * By default, outlines are filled using the non-zero winding rule. If + * set to 1, the outline will be filled using the even-odd fill rule + * (only works with the smooth rasterizer). + * + * FT_OUTLINE_REVERSE_FILL :: + * By default, outside contours of an outline are oriented in + * clock-wise direction, as defined in the TrueType specification. + * This flag is set if the outline uses the opposite direction + * (typically for Type~1 fonts). This flag is ignored by the scan + * converter. + * + * FT_OUTLINE_IGNORE_DROPOUTS :: + * By default, the scan converter will try to detect drop-outs in an + * outline and correct the glyph bitmap to ensure consistent shape + * continuity. If set, this flag hints the scan-line converter to + * ignore such cases. See below for more information. + * + * FT_OUTLINE_SMART_DROPOUTS :: + * Select smart dropout control. If unset, use simple dropout control. + * Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more + * information. + * + * FT_OUTLINE_INCLUDE_STUBS :: + * If set, turn pixels on for 'stubs', otherwise exclude them. Ignored + * if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more + * information. + * + * FT_OUTLINE_OVERLAP :: + * [Since 2.10.3] This flag indicates that this outline contains + * overlapping contours and the anti-aliased renderer should perform + * oversampling to mitigate possible artifacts. This flag should _not_ + * be set for well designed glyphs without overlaps because it quadruples + * the rendering time. + * + * FT_OUTLINE_HIGH_PRECISION :: + * This flag indicates that the scan-line converter should try to + * convert this outline to bitmaps with the highest possible quality. + * It is typically set for small character sizes. Note that this is + * only a hint that might be completely ignored by a given + * scan-converter. + * + * FT_OUTLINE_SINGLE_PASS :: + * This flag is set to force a given scan-converter to only use a + * single pass over the outline to render a bitmap glyph image. + * Normally, it is set for very large character sizes. It is only a + * hint that might be completely ignored by a given scan-converter. + * + * @note: + * The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and + * @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth rasterizer. + * + * There exists a second mechanism to pass the drop-out mode to the B/W + * rasterizer; see the `tags` field in @FT_Outline. + * + * Please refer to the description of the 'SCANTYPE' instruction in the + * [OpenType specification](https://learn.microsoft.com/typography/opentype/spec/tt_instructions#scantype) + * how simple drop-outs, smart drop-outs, and stubs are defined. + */ +#define FT_OUTLINE_NONE 0x0 +#define FT_OUTLINE_OWNER 0x1 +#define FT_OUTLINE_EVEN_ODD_FILL 0x2 +#define FT_OUTLINE_REVERSE_FILL 0x4 +#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 +#define FT_OUTLINE_SMART_DROPOUTS 0x10 +#define FT_OUTLINE_INCLUDE_STUBS 0x20 +#define FT_OUTLINE_OVERLAP 0x40 + +#define FT_OUTLINE_HIGH_PRECISION 0x100 +#define FT_OUTLINE_SINGLE_PASS 0x200 + + + /* these constants are deprecated; use the corresponding */ + /* `FT_OUTLINE_XXX` values instead */ +#define ft_outline_none FT_OUTLINE_NONE +#define ft_outline_owner FT_OUTLINE_OWNER +#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL +#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL +#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS +#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION +#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS + + /* */ + +#define FT_CURVE_TAG( flag ) ( flag & 0x03 ) + + /* see the `tags` field in `FT_Outline` for a description of the values */ +#define FT_CURVE_TAG_ON 0x01 +#define FT_CURVE_TAG_CONIC 0x00 +#define FT_CURVE_TAG_CUBIC 0x02 + +#define FT_CURVE_TAG_HAS_SCANMODE 0x04 + +#define FT_CURVE_TAG_TOUCH_X 0x08 /* reserved for TrueType hinter */ +#define FT_CURVE_TAG_TOUCH_Y 0x10 /* reserved for TrueType hinter */ + +#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ + FT_CURVE_TAG_TOUCH_Y ) + /* values 0x20, 0x40, and 0x80 are reserved */ + + + /* these constants are deprecated; use the corresponding */ + /* `FT_CURVE_TAG_XXX` values instead */ +#define FT_Curve_Tag_On FT_CURVE_TAG_ON +#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC +#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC +#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X +#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y + + + /************************************************************************** + * + * @functype: + * FT_Outline_MoveToFunc + * + * @description: + * A function pointer type used to describe the signature of a 'move to' + * function during outline walking/decomposition. + * + * A 'move to' is emitted to start a new contour in an outline. + * + * @input: + * to :: + * A pointer to the target point of the 'move to'. + * + * user :: + * A typeless pointer, which is passed from the caller of the + * decomposition function. + * + * @return: + * Error code. 0~means success. + */ + typedef int + (*FT_Outline_MoveToFunc)( const FT_Vector* to, + void* user ); + +#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc + + + /************************************************************************** + * + * @functype: + * FT_Outline_LineToFunc + * + * @description: + * A function pointer type used to describe the signature of a 'line to' + * function during outline walking/decomposition. + * + * A 'line to' is emitted to indicate a segment in the outline. + * + * @input: + * to :: + * A pointer to the target point of the 'line to'. + * + * user :: + * A typeless pointer, which is passed from the caller of the + * decomposition function. + * + * @return: + * Error code. 0~means success. + */ + typedef int + (*FT_Outline_LineToFunc)( const FT_Vector* to, + void* user ); + +#define FT_Outline_LineTo_Func FT_Outline_LineToFunc + + + /************************************************************************** + * + * @functype: + * FT_Outline_ConicToFunc + * + * @description: + * A function pointer type used to describe the signature of a 'conic to' + * function during outline walking or decomposition. + * + * A 'conic to' is emitted to indicate a second-order Bezier arc in the + * outline. + * + * @input: + * control :: + * An intermediate control point between the last position and the new + * target in `to`. + * + * to :: + * A pointer to the target end point of the conic arc. + * + * user :: + * A typeless pointer, which is passed from the caller of the + * decomposition function. + * + * @return: + * Error code. 0~means success. + */ + typedef int + (*FT_Outline_ConicToFunc)( const FT_Vector* control, + const FT_Vector* to, + void* user ); + +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc + + + /************************************************************************** + * + * @functype: + * FT_Outline_CubicToFunc + * + * @description: + * A function pointer type used to describe the signature of a 'cubic to' + * function during outline walking or decomposition. + * + * A 'cubic to' is emitted to indicate a third-order Bezier arc. + * + * @input: + * control1 :: + * A pointer to the first Bezier control point. + * + * control2 :: + * A pointer to the second Bezier control point. + * + * to :: + * A pointer to the target end point. + * + * user :: + * A typeless pointer, which is passed from the caller of the + * decomposition function. + * + * @return: + * Error code. 0~means success. + */ + typedef int + (*FT_Outline_CubicToFunc)( const FT_Vector* control1, + const FT_Vector* control2, + const FT_Vector* to, + void* user ); + +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc + + + /************************************************************************** + * + * @struct: + * FT_Outline_Funcs + * + * @description: + * A structure to hold various function pointers used during outline + * decomposition in order to emit segments, conic, and cubic Beziers. + * + * @fields: + * move_to :: + * The 'move to' emitter. + * + * line_to :: + * The segment emitter. + * + * conic_to :: + * The second-order Bezier arc emitter. + * + * cubic_to :: + * The third-order Bezier arc emitter. + * + * shift :: + * The shift that is applied to coordinates before they are sent to the + * emitter. + * + * delta :: + * The delta that is applied to coordinates before they are sent to the + * emitter, but after the shift. + * + * @note: + * The point coordinates sent to the emitters are the transformed version + * of the original coordinates (this is important for high accuracy + * during scan-conversion). The transformation is simple: + * + * ``` + * x' = (x << shift) - delta + * y' = (y << shift) - delta + * ``` + * + * Set the values of `shift` and `delta` to~0 to get the original point + * coordinates. + */ + typedef struct FT_Outline_Funcs_ + { + FT_Outline_MoveToFunc move_to; + FT_Outline_LineToFunc line_to; + FT_Outline_ConicToFunc conic_to; + FT_Outline_CubicToFunc cubic_to; + + int shift; + FT_Pos delta; + + } FT_Outline_Funcs; + + + /************************************************************************** + * + * @section: + * basic_types + * + */ + + + /************************************************************************** + * + * @macro: + * FT_IMAGE_TAG + * + * @description: + * This macro converts four-letter tags to an unsigned long type. + * + * @note: + * Since many 16-bit compilers don't like 32-bit enumerations, you should + * redefine this macro in case of problems to something like this: + * + * ``` + * #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value + * ``` + * + * to get a simple enumeration without assigning special numbers. + */ +#ifndef FT_IMAGE_TAG + +#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ + value = ( ( FT_STATIC_BYTE_CAST( unsigned long, _x1 ) << 24 ) | \ + ( FT_STATIC_BYTE_CAST( unsigned long, _x2 ) << 16 ) | \ + ( FT_STATIC_BYTE_CAST( unsigned long, _x3 ) << 8 ) | \ + FT_STATIC_BYTE_CAST( unsigned long, _x4 ) ) + +#endif /* FT_IMAGE_TAG */ + + + /************************************************************************** + * + * @enum: + * FT_Glyph_Format + * + * @description: + * An enumeration type used to describe the format of a given glyph + * image. Note that this version of FreeType only supports two image + * formats, even though future font drivers will be able to register + * their own format. + * + * @values: + * FT_GLYPH_FORMAT_NONE :: + * The value~0 is reserved. + * + * FT_GLYPH_FORMAT_COMPOSITE :: + * The glyph image is a composite of several other images. This format + * is _only_ used with @FT_LOAD_NO_RECURSE, and is used to report + * compound glyphs (like accented characters). + * + * FT_GLYPH_FORMAT_BITMAP :: + * The glyph image is a bitmap, and can be described as an @FT_Bitmap. + * You generally need to access the `bitmap` field of the + * @FT_GlyphSlotRec structure to read it. + * + * FT_GLYPH_FORMAT_OUTLINE :: + * The glyph image is a vectorial outline made of line segments and + * Bezier arcs; it can be described as an @FT_Outline; you generally + * want to access the `outline` field of the @FT_GlyphSlotRec structure + * to read it. + * + * FT_GLYPH_FORMAT_PLOTTER :: + * The glyph image is a vectorial path with no inside and outside + * contours. Some Type~1 fonts, like those in the Hershey family, + * contain glyphs in this format. These are described as @FT_Outline, + * but FreeType isn't currently capable of rendering them correctly. + * + * FT_GLYPH_FORMAT_SVG :: + * [Since 2.12] The glyph is represented by an SVG document in the + * 'SVG~' table. + */ + typedef enum FT_Glyph_Format_ + { + FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), + + FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_SVG, 'S', 'V', 'G', ' ' ) + + } FT_Glyph_Format; + + + /* these constants are deprecated; use the corresponding */ + /* `FT_Glyph_Format` values instead. */ +#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE +#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE +#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP +#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE +#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** R A S T E R D E F I N I T I O N S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + + /************************************************************************** + * + * @section: + * raster + * + * @title: + * Scanline Converter + * + * @abstract: + * How vectorial outlines are converted into bitmaps and pixmaps. + * + * @description: + * A raster or a rasterizer is a scan converter in charge of producing a + * pixel coverage bitmap that can be used as an alpha channel when + * compositing a glyph with a background. FreeType comes with two + * rasterizers: bilevel `raster1` and anti-aliased `smooth` are two + * separate modules. They are usually called from the high-level + * @FT_Load_Glyph or @FT_Render_Glyph functions and produce the entire + * coverage bitmap at once, while staying largely invisible to users. + * + * Instead of working with complete coverage bitmaps, it is also possible + * to intercept consecutive pixel runs on the same scanline with the same + * coverage, called _spans_, and process them individually. Only the + * `smooth` rasterizer permits this when calling @FT_Outline_Render with + * @FT_Raster_Params as described below. + * + * Working with either complete bitmaps or spans it is important to think + * of them as colorless coverage objects suitable as alpha channels to + * blend arbitrary colors with a background. For best results, it is + * recommended to use gamma correction, too. + * + * This section also describes the public API needed to set up alternative + * @FT_Renderer modules. + * + * @order: + * FT_Span + * FT_SpanFunc + * FT_Raster_Params + * FT_RASTER_FLAG_XXX + * + * FT_Raster + * FT_Raster_NewFunc + * FT_Raster_DoneFunc + * FT_Raster_ResetFunc + * FT_Raster_SetModeFunc + * FT_Raster_RenderFunc + * FT_Raster_Funcs + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Span + * + * @description: + * A structure to model a single span of consecutive pixels when + * rendering an anti-aliased bitmap. + * + * @fields: + * x :: + * The span's horizontal start position. + * + * len :: + * The span's length in pixels. + * + * coverage :: + * The span color/coverage, ranging from 0 (background) to 255 + * (foreground). + * + * @note: + * This structure is used by the span drawing callback type named + * @FT_SpanFunc that takes the y~coordinate of the span as a parameter. + * + * The anti-aliased rasterizer produces coverage values from 0 to 255, + * that is, from completely transparent to completely opaque. + */ + typedef struct FT_Span_ + { + unsigned short x; + unsigned short len; + unsigned char coverage; + + } FT_Span; + + + /************************************************************************** + * + * @functype: + * FT_SpanFunc + * + * @description: + * A function used as a call-back by the anti-aliased renderer in order + * to let client applications draw themselves the pixel spans on each + * scan line. + * + * @input: + * y :: + * The scanline's upward y~coordinate. + * + * count :: + * The number of spans to draw on this scanline. + * + * spans :: + * A table of `count` spans to draw on the scanline. + * + * user :: + * User-supplied data that is passed to the callback. + * + * @note: + * This callback allows client applications to directly render the spans + * of the anti-aliased bitmap to any kind of surfaces. + * + * This can be used to write anti-aliased outlines directly to a given + * background bitmap using alpha compositing. It can also be used for + * oversampling and averaging. + */ + typedef void + (*FT_SpanFunc)( int y, + int count, + const FT_Span* spans, + void* user ); + +#define FT_Raster_Span_Func FT_SpanFunc + + + /************************************************************************** + * + * @functype: + * FT_Raster_BitTest_Func + * + * @description: + * Deprecated, unimplemented. + */ + typedef int + (*FT_Raster_BitTest_Func)( int y, + int x, + void* user ); + + + /************************************************************************** + * + * @functype: + * FT_Raster_BitSet_Func + * + * @description: + * Deprecated, unimplemented. + */ + typedef void + (*FT_Raster_BitSet_Func)( int y, + int x, + void* user ); + + + /************************************************************************** + * + * @enum: + * FT_RASTER_FLAG_XXX + * + * @description: + * A list of bit flag constants as used in the `flags` field of a + * @FT_Raster_Params structure. + * + * @values: + * FT_RASTER_FLAG_DEFAULT :: + * This value is 0. + * + * FT_RASTER_FLAG_AA :: + * This flag is set to indicate that an anti-aliased glyph image should + * be generated. Otherwise, it will be monochrome (1-bit). + * + * FT_RASTER_FLAG_DIRECT :: + * This flag is set to indicate direct rendering. In this mode, client + * applications must provide their own span callback. This lets them + * directly draw or compose over an existing bitmap. If this bit is + * _not_ set, the target pixmap's buffer _must_ be zeroed before + * rendering and the output will be clipped to its size. + * + * Direct rendering is only possible with anti-aliased glyphs. + * + * FT_RASTER_FLAG_CLIP :: + * This flag is only used in direct rendering mode. If set, the output + * will be clipped to a box specified in the `clip_box` field of the + * @FT_Raster_Params structure. Otherwise, the `clip_box` is + * effectively set to the bounding box and all spans are generated. + * + * FT_RASTER_FLAG_SDF :: + * This flag is set to indicate that a signed distance field glyph + * image should be generated. This is only used while rendering with + * the @FT_RENDER_MODE_SDF render mode. + */ +#define FT_RASTER_FLAG_DEFAULT 0x0 +#define FT_RASTER_FLAG_AA 0x1 +#define FT_RASTER_FLAG_DIRECT 0x2 +#define FT_RASTER_FLAG_CLIP 0x4 +#define FT_RASTER_FLAG_SDF 0x8 + + /* these constants are deprecated; use the corresponding */ + /* `FT_RASTER_FLAG_XXX` values instead */ +#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT +#define ft_raster_flag_aa FT_RASTER_FLAG_AA +#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT +#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP + + + /************************************************************************** + * + * @struct: + * FT_Raster_Params + * + * @description: + * A structure to hold the parameters used by a raster's render function, + * passed as an argument to @FT_Outline_Render. + * + * @fields: + * target :: + * The target bitmap. + * + * source :: + * A pointer to the source glyph image (e.g., an @FT_Outline). + * + * flags :: + * The rendering flags. + * + * gray_spans :: + * The gray span drawing callback. + * + * black_spans :: + * Unused. + * + * bit_test :: + * Unused. + * + * bit_set :: + * Unused. + * + * user :: + * User-supplied data that is passed to each drawing callback. + * + * clip_box :: + * An optional span clipping box expressed in _integer_ pixels + * (not in 26.6 fixed-point units). + * + * @note: + * The @FT_RASTER_FLAG_AA bit flag must be set in the `flags` to + * generate an anti-aliased glyph bitmap, otherwise a monochrome bitmap + * is generated. The `target` should have appropriate pixel mode and its + * dimensions define the clipping region. + * + * If both @FT_RASTER_FLAG_AA and @FT_RASTER_FLAG_DIRECT bit flags + * are set in `flags`, the raster calls an @FT_SpanFunc callback + * `gray_spans` with `user` data as an argument ignoring `target`. This + * allows direct composition over a pre-existing user surface to perform + * the span drawing and composition. To optionally clip the spans, set + * the @FT_RASTER_FLAG_CLIP flag and `clip_box`. The monochrome raster + * does not support the direct mode. + * + * The gray-level rasterizer always uses 256 gray levels. If you want + * fewer gray levels, you have to use @FT_RASTER_FLAG_DIRECT and reduce + * the levels in the callback function. + */ + typedef struct FT_Raster_Params_ + { + const FT_Bitmap* target; + const void* source; + int flags; + FT_SpanFunc gray_spans; + FT_SpanFunc black_spans; /* unused */ + FT_Raster_BitTest_Func bit_test; /* unused */ + FT_Raster_BitSet_Func bit_set; /* unused */ + void* user; + FT_BBox clip_box; + + } FT_Raster_Params; + + + /************************************************************************** + * + * @type: + * FT_Raster + * + * @description: + * An opaque handle (pointer) to a raster object. Each object can be + * used independently to convert an outline into a bitmap or pixmap. + * + * @note: + * In FreeType 2, all rasters are now encapsulated within specific + * @FT_Renderer modules and only used in their context. + * + */ + typedef struct FT_RasterRec_* FT_Raster; + + + /************************************************************************** + * + * @functype: + * FT_Raster_NewFunc + * + * @description: + * A function used to create a new raster object. + * + * @input: + * memory :: + * A handle to the memory allocator. + * + * @output: + * raster :: + * A handle to the new raster object. + * + * @return: + * Error code. 0~means success. + * + * @note: + * The `memory` parameter is a typeless pointer in order to avoid + * un-wanted dependencies on the rest of the FreeType code. In practice, + * it is an @FT_Memory object, i.e., a handle to the standard FreeType + * memory allocator. However, this field can be completely ignored by a + * given raster implementation. + */ + typedef int + (*FT_Raster_NewFunc)( void* memory, + FT_Raster* raster ); + +#define FT_Raster_New_Func FT_Raster_NewFunc + + + /************************************************************************** + * + * @functype: + * FT_Raster_DoneFunc + * + * @description: + * A function used to destroy a given raster object. + * + * @input: + * raster :: + * A handle to the raster object. + */ + typedef void + (*FT_Raster_DoneFunc)( FT_Raster raster ); + +#define FT_Raster_Done_Func FT_Raster_DoneFunc + + + /************************************************************************** + * + * @functype: + * FT_Raster_ResetFunc + * + * @description: + * FreeType used to provide an area of memory called the 'render pool' + * available to all registered rasterizers. This was not thread safe, + * however, and now FreeType never allocates this pool. + * + * This function is called after a new raster object is created. + * + * @input: + * raster :: + * A handle to the new raster object. + * + * pool_base :: + * Previously, the address in memory of the render pool. Set this to + * `NULL`. + * + * pool_size :: + * Previously, the size in bytes of the render pool. Set this to 0. + * + * @note: + * Rasterizers should rely on dynamic or stack allocation if they want to + * (a handle to the memory allocator is passed to the rasterizer + * constructor). + */ + typedef void + (*FT_Raster_ResetFunc)( FT_Raster raster, + unsigned char* pool_base, + unsigned long pool_size ); + +#define FT_Raster_Reset_Func FT_Raster_ResetFunc + + + /************************************************************************** + * + * @functype: + * FT_Raster_SetModeFunc + * + * @description: + * This function is a generic facility to change modes or attributes in a + * given raster. This can be used for debugging purposes, or simply to + * allow implementation-specific 'features' in a given raster module. + * + * @input: + * raster :: + * A handle to the new raster object. + * + * mode :: + * A 4-byte tag used to name the mode or property. + * + * args :: + * A pointer to the new mode/property to use. + */ + typedef int + (*FT_Raster_SetModeFunc)( FT_Raster raster, + unsigned long mode, + void* args ); + +#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc + + + /************************************************************************** + * + * @functype: + * FT_Raster_RenderFunc + * + * @description: + * Invoke a given raster to scan-convert a given glyph image into a + * target bitmap. + * + * @input: + * raster :: + * A handle to the raster object. + * + * params :: + * A pointer to an @FT_Raster_Params structure used to store the + * rendering parameters. + * + * @return: + * Error code. 0~means success. + * + * @note: + * The exact format of the source image depends on the raster's glyph + * format defined in its @FT_Raster_Funcs structure. It can be an + * @FT_Outline or anything else in order to support a large array of + * glyph formats. + * + * Note also that the render function can fail and return a + * `FT_Err_Unimplemented_Feature` error code if the raster used does not + * support direct composition. + */ + typedef int + (*FT_Raster_RenderFunc)( FT_Raster raster, + const FT_Raster_Params* params ); + +#define FT_Raster_Render_Func FT_Raster_RenderFunc + + + /************************************************************************** + * + * @struct: + * FT_Raster_Funcs + * + * @description: + * A structure used to describe a given raster class to the library. + * + * @fields: + * glyph_format :: + * The supported glyph format for this raster. + * + * raster_new :: + * The raster constructor. + * + * raster_reset :: + * Used to reset the render pool within the raster. + * + * raster_render :: + * A function to render a glyph into a given bitmap. + * + * raster_done :: + * The raster destructor. + */ + typedef struct FT_Raster_Funcs_ + { + FT_Glyph_Format glyph_format; + + FT_Raster_NewFunc raster_new; + FT_Raster_ResetFunc raster_reset; + FT_Raster_SetModeFunc raster_set_mode; + FT_Raster_RenderFunc raster_render; + FT_Raster_DoneFunc raster_done; + + } FT_Raster_Funcs; + + /* */ + + +FT_END_HEADER + +#endif /* FTIMAGE_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftincrem.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftincrem.h new file mode 100644 index 0000000000000000000000000000000000000000..2233044754e6c709665b21f0f0529e1aaac64100 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftincrem.h @@ -0,0 +1,348 @@ +/**************************************************************************** + * + * ftincrem.h + * + * FreeType incremental loading (specification). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTINCREM_H_ +#define FTINCREM_H_ + +#include +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * incremental + * + * @title: + * Incremental Loading + * + * @abstract: + * Custom Glyph Loading. + * + * @description: + * This section contains various functions used to perform so-called + * 'incremental' glyph loading. This is a mode where all glyphs loaded + * from a given @FT_Face are provided by the client application. + * + * Apart from that, all other tables are loaded normally from the font + * file. This mode is useful when FreeType is used within another + * engine, e.g., a PostScript Imaging Processor. + * + * To enable this mode, you must use @FT_Open_Face, passing an + * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an + * @FT_Incremental_Interface value. See the comments for + * @FT_Incremental_InterfaceRec for an example. + * + */ + + + /************************************************************************** + * + * @type: + * FT_Incremental + * + * @description: + * An opaque type describing a user-provided object used to implement + * 'incremental' glyph loading within FreeType. This is used to support + * embedded fonts in certain environments (e.g., PostScript + * interpreters), where the glyph data isn't in the font file, or must be + * overridden by different values. + * + * @note: + * It is up to client applications to create and implement + * @FT_Incremental objects, as long as they provide implementations for + * the methods @FT_Incremental_GetGlyphDataFunc, + * @FT_Incremental_FreeGlyphDataFunc and + * @FT_Incremental_GetGlyphMetricsFunc. + * + * See the description of @FT_Incremental_InterfaceRec to understand how + * to use incremental objects with FreeType. + * + */ + typedef struct FT_IncrementalRec_* FT_Incremental; + + + /************************************************************************** + * + * @struct: + * FT_Incremental_MetricsRec + * + * @description: + * A small structure used to contain the basic glyph metrics returned by + * the @FT_Incremental_GetGlyphMetricsFunc method. + * + * @fields: + * bearing_x :: + * Left bearing, in font units. + * + * bearing_y :: + * Top bearing, in font units. + * + * advance :: + * Horizontal component of glyph advance, in font units. + * + * advance_v :: + * Vertical component of glyph advance, in font units. + * + * @note: + * These correspond to horizontal or vertical metrics depending on the + * value of the `vertical` argument to the function + * @FT_Incremental_GetGlyphMetricsFunc. + * + */ + typedef struct FT_Incremental_MetricsRec_ + { + FT_Long bearing_x; + FT_Long bearing_y; + FT_Long advance; + FT_Long advance_v; /* since 2.3.12 */ + + } FT_Incremental_MetricsRec; + + + /************************************************************************** + * + * @struct: + * FT_Incremental_Metrics + * + * @description: + * A handle to an @FT_Incremental_MetricsRec structure. + * + */ + typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics; + + + /************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphDataFunc + * + * @description: + * A function called by FreeType to access a given glyph's data bytes + * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is + * enabled. + * + * Note that the format of the glyph's data bytes depends on the font + * file format. For TrueType, it must correspond to the raw bytes within + * the 'glyf' table. For PostScript formats, it must correspond to the + * **unencrypted** charstring bytes, without any `lenIV` header. It is + * undefined for any other format. + * + * @input: + * incremental :: + * Handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * @output: + * adata :: + * A structure describing the returned glyph data bytes (which will be + * accessed as a read-only byte block). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If this function returns successfully the method + * @FT_Incremental_FreeGlyphDataFunc will be called later to release the + * data bytes. + * + * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for + * compound glyphs. + * + */ + typedef FT_Error + (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, + FT_UInt glyph_index, + FT_Data* adata ); + + + /************************************************************************** + * + * @type: + * FT_Incremental_FreeGlyphDataFunc + * + * @description: + * A function used to release the glyph data bytes returned by a + * successful call to @FT_Incremental_GetGlyphDataFunc. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * data :: + * A structure describing the glyph data bytes (which will be accessed + * as a read-only byte block). + * + */ + typedef void + (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, + FT_Data* data ); + + + /************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphMetricsFunc + * + * @description: + * A function used to retrieve the basic metrics of a given glyph index + * before accessing its data. This allows for handling font types such + * as PCL~XL Format~1, Class~2 downloaded TrueType fonts, where the glyph + * metrics (`hmtx` and `vmtx` tables) are permitted to be omitted from + * the font, and the relevant metrics included in the header of the glyph + * outline data. Importantly, this is not intended to allow custom glyph + * metrics (for example, Postscript Metrics dictionaries), because that + * conflicts with the requirements of outline hinting. Such custom + * metrics must be handled separately, by the calling application. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * vertical :: + * If true, return vertical metrics. + * + * ametrics :: + * This parameter is used for both input and output. The original + * glyph metrics, if any, in font units. If metrics are not available + * all the values must be set to zero. + * + * @output: + * ametrics :: + * The glyph metrics in font units. + * + */ + typedef FT_Error + (*FT_Incremental_GetGlyphMetricsFunc) + ( FT_Incremental incremental, + FT_UInt glyph_index, + FT_Bool vertical, + FT_Incremental_MetricsRec *ametrics ); + + + /************************************************************************** + * + * @struct: + * FT_Incremental_FuncsRec + * + * @description: + * A table of functions for accessing fonts that load data incrementally. + * Used in @FT_Incremental_InterfaceRec. + * + * @fields: + * get_glyph_data :: + * The function to get glyph data. Must not be null. + * + * free_glyph_data :: + * The function to release glyph data. Must not be null. + * + * get_glyph_metrics :: + * The function to get glyph metrics. May be null if the font does not + * require it. + * + */ + typedef struct FT_Incremental_FuncsRec_ + { + FT_Incremental_GetGlyphDataFunc get_glyph_data; + FT_Incremental_FreeGlyphDataFunc free_glyph_data; + FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; + + } FT_Incremental_FuncsRec; + + + /************************************************************************** + * + * @struct: + * FT_Incremental_InterfaceRec + * + * @description: + * A structure to be used with @FT_Open_Face to indicate that the user + * wants to support incremental glyph loading. You should use it with + * @FT_PARAM_TAG_INCREMENTAL as in the following example: + * + * ``` + * FT_Incremental_InterfaceRec inc_int; + * FT_Parameter parameter; + * FT_Open_Args open_args; + * + * + * // set up incremental descriptor + * inc_int.funcs = my_funcs; + * inc_int.object = my_object; + * + * // set up optional parameter + * parameter.tag = FT_PARAM_TAG_INCREMENTAL; + * parameter.data = &inc_int; + * + * // set up FT_Open_Args structure + * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; + * open_args.pathname = my_font_pathname; + * open_args.num_params = 1; + * open_args.params = ¶meter; // we use one optional argument + * + * // open the font + * error = FT_Open_Face( library, &open_args, index, &face ); + * ... + * ``` + * + */ + typedef struct FT_Incremental_InterfaceRec_ + { + const FT_Incremental_FuncsRec* funcs; + FT_Incremental object; + + } FT_Incremental_InterfaceRec; + + + /************************************************************************** + * + * @type: + * FT_Incremental_Interface + * + * @description: + * A pointer to an @FT_Incremental_InterfaceRec structure. + * + */ + typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; + + + /* */ + + +FT_END_HEADER + +#endif /* FTINCREM_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlcdfil.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlcdfil.h new file mode 100644 index 0000000000000000000000000000000000000000..37bb5e1b8fb14a0222b1c16ddaf0cb2937caa95f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlcdfil.h @@ -0,0 +1,317 @@ +/**************************************************************************** + * + * ftlcdfil.h + * + * FreeType API for color filtering of subpixel bitmap glyphs + * (specification). + * + * Copyright (C) 2006-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTLCDFIL_H_ +#define FTLCDFIL_H_ + +#include +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * lcd_rendering + * + * @title: + * Subpixel Rendering + * + * @abstract: + * API to control subpixel rendering. + * + * @description: + * FreeType provides two alternative subpixel rendering technologies. + * Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your + * `ftoption.h` file, this enables ClearType-style rendering. + * Otherwise, Harmony LCD rendering is enabled. These technologies are + * controlled differently and API described below, although always + * available, performs its function when appropriate method is enabled + * and does nothing otherwise. + * + * ClearType-style LCD rendering exploits the color-striped structure of + * LCD pixels, increasing the available resolution in the direction of + * the stripe (usually horizontal RGB) by a factor of~3. Using the + * subpixel coverages unfiltered can create severe color fringes + * especially when rendering thin features. Indeed, to produce + * black-on-white text, the nearby color subpixels must be dimmed + * evenly. Therefore, an equalizing 5-tap FIR filter should be applied + * to subpixel coverages regardless of pixel boundaries and should have + * these properties: + * + * 1. It should be symmetrical, like {~a, b, c, b, a~}, to avoid + * any shifts in appearance. + * + * 2. It should be color-balanced, meaning a~+ b~=~c, to reduce color + * fringes by distributing the computed coverage for one subpixel to + * all subpixels equally. + * + * 3. It should be normalized, meaning 2a~+ 2b~+ c~=~1.0 to maintain + * overall brightness. + * + * Boxy 3-tap filter {0, 1/3, 1/3, 1/3, 0} is sharper but is less + * forgiving of non-ideal gamma curves of a screen (and viewing angles), + * beveled filters are fuzzier but more tolerant. + * + * Use the @FT_Library_SetLcdFilter or @FT_Library_SetLcdFilterWeights + * API to specify a low-pass filter, which is then applied to + * subpixel-rendered bitmaps generated through @FT_Render_Glyph. + * + * Harmony LCD rendering is suitable to panels with any regular subpixel + * structure, not just monitors with 3 color striped subpixels, as long + * as the color subpixels have fixed positions relative to the pixel + * center. In this case, each color channel can be rendered separately + * after shifting the outline opposite to the subpixel shift so that the + * coverage maps are aligned. This method is immune to color fringes + * because the shifts do not change integral coverage. + * + * The subpixel geometry must be specified by xy-coordinates for each + * subpixel. By convention they may come in the RGB order: {{-1/3, 0}, + * {0, 0}, {1/3, 0}} for standard RGB striped panel or {{-1/6, 1/4}, + * {-1/6, -1/4}, {1/3, 0}} for a certain PenTile panel. + * + * Use the @FT_Library_SetLcdGeometry API to specify subpixel positions. + * If one follows the RGB order convention, the same order applies to the + * resulting @FT_PIXEL_MODE_LCD and @FT_PIXEL_MODE_LCD_V bitmaps. Note, + * however, that the coordinate frame for the latter must be rotated + * clockwise. Harmony with default LCD geometry is equivalent to + * ClearType with light filter. + * + * As a result of ClearType filtering or Harmony shifts, the resulting + * dimensions of LCD bitmaps can be slightly wider or taller than the + * dimensions the original outline with regard to the pixel grid. + * For example, for @FT_RENDER_MODE_LCD, the filter adds 2~subpixels to + * the left, and 2~subpixels to the right. The bitmap offset values are + * adjusted accordingly, so clients shouldn't need to modify their layout + * and glyph positioning code when enabling the filter. + * + * The ClearType and Harmony rendering is applicable to glyph bitmaps + * rendered through @FT_Render_Glyph, @FT_Load_Glyph, @FT_Load_Char, and + * @FT_Glyph_To_Bitmap, when @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V + * is specified. This API does not control @FT_Outline_Render and + * @FT_Outline_Get_Bitmap. + * + * The described algorithms can completely remove color artefacts when + * combined with gamma-corrected alpha blending in linear space. Each of + * the 3~alpha values (subpixels) must by independently used to blend one + * color channel. That is, red alpha blends the red channel of the text + * color with the red channel of the background pixel. + */ + + + /************************************************************************** + * + * @enum: + * FT_LcdFilter + * + * @description: + * A list of values to identify various types of LCD filters. + * + * @values: + * FT_LCD_FILTER_NONE :: + * Do not perform filtering. When used with subpixel rendering, this + * results in sometimes severe color fringes. + * + * FT_LCD_FILTER_DEFAULT :: + * This is a beveled, normalized, and color-balanced five-tap filter + * with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256 units. + * + * FT_LCD_FILTER_LIGHT :: + * this is a boxy, normalized, and color-balanced three-tap filter with + * weights of [0x00 0x55 0x56 0x55 0x00] in 1/256 units. + * + * FT_LCD_FILTER_LEGACY :: + * FT_LCD_FILTER_LEGACY1 :: + * The legacy libXft color filter is no longer supported and ignored. + * + * @since: + * 2.3.0 + */ + typedef enum FT_LcdFilter_ + { + FT_LCD_FILTER_NONE = 0, + FT_LCD_FILTER_DEFAULT = 1, + FT_LCD_FILTER_LIGHT = 2, + FT_LCD_FILTER_LEGACY1 = 3, + FT_LCD_FILTER_LEGACY = 16, + + FT_LCD_FILTER_MAX /* do not remove */ + + } FT_LcdFilter; + + + /************************************************************************** + * + * @function: + * FT_Library_SetLcdFilter + * + * @description: + * This function is used to change filter applied to LCD decimated + * bitmaps, like the ones used when calling @FT_Render_Glyph with + * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. + * + * @input: + * library :: + * A handle to the target library instance. + * + * filter :: + * The filter type. + * + * You can use @FT_LCD_FILTER_NONE here to disable this feature, or + * @FT_LCD_FILTER_DEFAULT to use a default filter that should work well + * on most LCD screens. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Since 2.10.3 the LCD filtering is enabled with @FT_LCD_FILTER_DEFAULT. + * It is no longer necessary to call this function explicitly except + * to choose a different filter or disable filtering altogether with + * @FT_LCD_FILTER_NONE. + * + * This function does nothing but returns `FT_Err_Unimplemented_Feature` + * if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is + * not defined in your build of the library. + * + * @since: + * 2.3.0 + */ + FT_EXPORT( FT_Error ) + FT_Library_SetLcdFilter( FT_Library library, + FT_LcdFilter filter ); + + + /************************************************************************** + * + * @function: + * FT_Library_SetLcdFilterWeights + * + * @description: + * This function can be used to enable LCD filter with custom weights, + * instead of using presets in @FT_Library_SetLcdFilter. + * + * @input: + * library :: + * A handle to the target library instance. + * + * weights :: + * A pointer to an array; the function copies the first five bytes and + * uses them to specify the filter weights in 1/256 units. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function does nothing but returns `FT_Err_Unimplemented_Feature` + * if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is + * not defined in your build of the library. + * + * LCD filter weights can also be set per face using @FT_Face_Properties + * with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS. + * + * @since: + * 2.4.0 + */ + FT_EXPORT( FT_Error ) + FT_Library_SetLcdFilterWeights( FT_Library library, + unsigned char *weights ); + + + /************************************************************************** + * + * @type: + * FT_LcdFiveTapFilter + * + * @description: + * A typedef for passing the five LCD filter weights to + * @FT_Face_Properties within an @FT_Parameter structure. + * + * @since: + * 2.8 + * + */ +#define FT_LCD_FILTER_FIVE_TAPS 5 + + typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]; + + + /************************************************************************** + * + * @function: + * FT_Library_SetLcdGeometry + * + * @description: + * This function can be used to modify default positions of color + * subpixels, which controls Harmony LCD rendering. + * + * @input: + * library :: + * A handle to the target library instance. + * + * sub :: + * A pointer to an array of 3 vectors in 26.6 fractional pixel format; + * the function modifies the default values, see the note below. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Subpixel geometry examples: + * + * - {{-21, 0}, {0, 0}, {21, 0}} is the default, corresponding to 3 color + * stripes shifted by a third of a pixel. This could be an RGB panel. + * + * - {{21, 0}, {0, 0}, {-21, 0}} looks the same as the default but can + * specify a BGR panel instead, while keeping the bitmap in the same + * RGB888 format. + * + * - {{0, 21}, {0, 0}, {0, -21}} is the vertical RGB, but the bitmap + * stays RGB888 as a result. + * + * - {{-11, 16}, {-11, -16}, {22, 0}} is a certain PenTile arrangement. + * + * This function does nothing and returns `FT_Err_Unimplemented_Feature` + * in the context of ClearType-style subpixel rendering when + * `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is defined in your build of the + * library. + * + * @since: + * 2.10.0 + */ + FT_EXPORT( FT_Error ) + FT_Library_SetLcdGeometry( FT_Library library, + FT_Vector sub[3] ); + + /* */ + + +FT_END_HEADER + +#endif /* FTLCDFIL_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlist.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlist.h new file mode 100644 index 0000000000000000000000000000000000000000..14958b0ff371c626cb25d6bbe0a86459637b3f19 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlist.h @@ -0,0 +1,296 @@ +/**************************************************************************** + * + * ftlist.h + * + * Generic list support for FreeType (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file implements functions relative to list processing. Its data + * structures are defined in `freetype.h`. + * + */ + + +#ifndef FTLIST_H_ +#define FTLIST_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * list_processing + * + * @title: + * List Processing + * + * @abstract: + * Simple management of lists. + * + * @description: + * This section contains various definitions related to list processing + * using doubly-linked nodes. + * + * @order: + * FT_List + * FT_ListNode + * FT_ListRec + * FT_ListNodeRec + * + * FT_List_Add + * FT_List_Insert + * FT_List_Find + * FT_List_Remove + * FT_List_Up + * FT_List_Iterate + * FT_List_Iterator + * FT_List_Finalize + * FT_List_Destructor + * + */ + + + /************************************************************************** + * + * @function: + * FT_List_Find + * + * @description: + * Find the list node for a given listed object. + * + * @input: + * list :: + * A pointer to the parent list. + * data :: + * The address of the listed object. + * + * @return: + * List node. `NULL` if it wasn't found. + */ + FT_EXPORT( FT_ListNode ) + FT_List_Find( FT_List list, + void* data ); + + + /************************************************************************** + * + * @function: + * FT_List_Add + * + * @description: + * Append an element to the end of a list. + * + * @inout: + * list :: + * A pointer to the parent list. + * node :: + * The node to append. + */ + FT_EXPORT( void ) + FT_List_Add( FT_List list, + FT_ListNode node ); + + + /************************************************************************** + * + * @function: + * FT_List_Insert + * + * @description: + * Insert an element at the head of a list. + * + * @inout: + * list :: + * A pointer to parent list. + * node :: + * The node to insert. + */ + FT_EXPORT( void ) + FT_List_Insert( FT_List list, + FT_ListNode node ); + + + /************************************************************************** + * + * @function: + * FT_List_Remove + * + * @description: + * Remove a node from a list. This function doesn't check whether the + * node is in the list! + * + * @input: + * node :: + * The node to remove. + * + * @inout: + * list :: + * A pointer to the parent list. + */ + FT_EXPORT( void ) + FT_List_Remove( FT_List list, + FT_ListNode node ); + + + /************************************************************************** + * + * @function: + * FT_List_Up + * + * @description: + * Move a node to the head/top of a list. Used to maintain LRU lists. + * + * @inout: + * list :: + * A pointer to the parent list. + * node :: + * The node to move. + */ + FT_EXPORT( void ) + FT_List_Up( FT_List list, + FT_ListNode node ); + + + /************************************************************************** + * + * @functype: + * FT_List_Iterator + * + * @description: + * An FT_List iterator function that is called during a list parse by + * @FT_List_Iterate. + * + * @input: + * node :: + * The current iteration list node. + * + * user :: + * A typeless pointer passed to @FT_List_Iterate. Can be used to point + * to the iteration's state. + */ + typedef FT_Error + (*FT_List_Iterator)( FT_ListNode node, + void* user ); + + + /************************************************************************** + * + * @function: + * FT_List_Iterate + * + * @description: + * Parse a list and calls a given iterator function on each element. + * Note that parsing is stopped as soon as one of the iterator calls + * returns a non-zero value. + * + * @input: + * list :: + * A handle to the list. + * iterator :: + * An iterator function, called on each node of the list. + * user :: + * A user-supplied field that is passed as the second argument to the + * iterator. + * + * @return: + * The result (a FreeType error code) of the last iterator call. + */ + FT_EXPORT( FT_Error ) + FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ); + + + /************************************************************************** + * + * @functype: + * FT_List_Destructor + * + * @description: + * An @FT_List iterator function that is called during a list + * finalization by @FT_List_Finalize to destroy all elements in a given + * list. + * + * @input: + * system :: + * The current system object. + * + * data :: + * The current object to destroy. + * + * user :: + * A typeless pointer passed to @FT_List_Iterate. It can be used to + * point to the iteration's state. + */ + typedef void + (*FT_List_Destructor)( FT_Memory memory, + void* data, + void* user ); + + + /************************************************************************** + * + * @function: + * FT_List_Finalize + * + * @description: + * Destroy all elements in the list as well as the list itself. + * + * @input: + * list :: + * A handle to the list. + * + * destroy :: + * A list destructor that will be applied to each element of the list. + * Set this to `NULL` if not needed. + * + * memory :: + * The current memory object that handles deallocation. + * + * user :: + * A user-supplied field that is passed as the last argument to the + * destructor. + * + * @note: + * This function expects that all nodes added by @FT_List_Add or + * @FT_List_Insert have been dynamically allocated. + */ + FT_EXPORT( void ) + FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ); + + /* */ + + +FT_END_HEADER + +#endif /* FTLIST_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlogging.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlogging.h new file mode 100644 index 0000000000000000000000000000000000000000..d155171136c2da6df96ebab0c405a8521b86d779 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlogging.h @@ -0,0 +1,184 @@ +/**************************************************************************** + * + * ftlogging.h + * + * Additional debugging APIs. + * + * Copyright (C) 2020-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTLOGGING_H_ +#define FTLOGGING_H_ + + +#include +#include FT_CONFIG_CONFIG_H + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * debugging_apis + * + * @title: + * External Debugging APIs + * + * @abstract: + * Public APIs to control the `FT_DEBUG_LOGGING` macro. + * + * @description: + * This section contains the declarations of public functions that + * enables fine control of what the `FT_DEBUG_LOGGING` macro outputs. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Trace_Set_Level + * + * @description: + * Change the levels of tracing components of FreeType at run time. + * + * @input: + * tracing_level :: + * New tracing value. + * + * @example: + * The following call makes FreeType trace everything but the 'memory' + * component. + * + * ``` + * FT_Trace_Set_Level( "any:7 memory:0" ); + * ``` + * + * @note: + * This function does nothing if compilation option `FT_DEBUG_LOGGING` + * isn't set. + * + * @since: + * 2.11 + * + */ + FT_EXPORT( void ) + FT_Trace_Set_Level( const char* tracing_level ); + + + /************************************************************************** + * + * @function: + * FT_Trace_Set_Default_Level + * + * @description: + * Reset tracing value of FreeType's components to the default value + * (i.e., to the value of the `FT2_DEBUG` environment value or to NULL + * if `FT2_DEBUG` is not set). + * + * @note: + * This function does nothing if compilation option `FT_DEBUG_LOGGING` + * isn't set. + * + * @since: + * 2.11 + * + */ + FT_EXPORT( void ) + FT_Trace_Set_Default_Level( void ); + + + /************************************************************************** + * + * @functype: + * FT_Custom_Log_Handler + * + * @description: + * A function typedef that is used to handle the logging of tracing and + * debug messages on a file system. + * + * @input: + * ft_component :: + * The name of `FT_COMPONENT` from which the current debug or error + * message is produced. + * + * fmt :: + * Actual debug or tracing message. + * + * args:: + * Arguments of debug or tracing messages. + * + * @since: + * 2.11 + * + */ + typedef void + (*FT_Custom_Log_Handler)( const char* ft_component, + const char* fmt, + va_list args ); + + + /************************************************************************** + * + * @function: + * FT_Set_Log_Handler + * + * @description: + * A function to set a custom log handler. + * + * @input: + * handler :: + * New logging function. + * + * @note: + * This function does nothing if compilation option `FT_DEBUG_LOGGING` + * isn't set. + * + * @since: + * 2.11 + * + */ + FT_EXPORT( void ) + FT_Set_Log_Handler( FT_Custom_Log_Handler handler ); + + + /************************************************************************** + * + * @function: + * FT_Set_Default_Log_Handler + * + * @description: + * A function to undo the effect of @FT_Set_Log_Handler, resetting the + * log handler to FreeType's built-in version. + * + * @note: + * This function does nothing if compilation option `FT_DEBUG_LOGGING` + * isn't set. + * + * @since: + * 2.11 + * + */ + FT_EXPORT( void ) + FT_Set_Default_Log_Handler( void ); + + /* */ + + +FT_END_HEADER + +#endif /* FTLOGGING_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlzw.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlzw.h new file mode 100644 index 0000000000000000000000000000000000000000..de14bcc67417748e769e07c79e82d05a6204854a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftlzw.h @@ -0,0 +1,100 @@ +/**************************************************************************** + * + * ftlzw.h + * + * LZW-compressed stream support. + * + * Copyright (C) 2004-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTLZW_H_ +#define FTLZW_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * lzw + * + * @title: + * LZW Streams + * + * @abstract: + * Using LZW-compressed font files. + * + * @description: + * In certain builds of the library, LZW compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a LZW stream from it and + * re-open the face with it. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream, + * which significantly undermines the performance. + * + * This section contains the declaration of LZW-specific functions. + * + */ + + /************************************************************************** + * + * @function: + * FT_Stream_OpenLZW + * + * @description: + * Open a new stream to parse LZW-compressed font files. This is mainly + * used to support the compressed `*.pcf.Z` fonts that come with XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close` on the new stream will + * **not** call `FT_Stream_Close` on the source stream. None of the + * stream objects will be released to the heap. + * + * This function may return `FT_Err_Unimplemented_Feature` if your build + * of FreeType was not compiled with LZW support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenLZW( FT_Stream stream, + FT_Stream source ); + + /* */ + + +FT_END_HEADER + +#endif /* FTLZW_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmac.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmac.h new file mode 100644 index 0000000000000000000000000000000000000000..c5ac49101a47ef4c36570fffb825d18046f0ce67 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmac.h @@ -0,0 +1,289 @@ +/**************************************************************************** + * + * ftmac.h + * + * Additional Mac-specific API. + * + * Copyright (C) 1996-2025 by + * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +/**************************************************************************** + * + * NOTE: Include this file after `FT_FREETYPE_H` and after any + * Mac-specific headers (because this header uses Mac types such as + * 'Handle', 'FSSpec', 'FSRef', etc.) + * + */ + + +#ifndef FTMAC_H_ +#define FTMAC_H_ + + + + +FT_BEGIN_HEADER + + + /* gcc-3.1 and later can warn about functions tagged as deprecated */ +#ifndef FT_DEPRECATED_ATTRIBUTE +#if defined( __GNUC__ ) && \ + ( ( __GNUC__ >= 4 ) || \ + ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) ) +#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated )) +#else +#define FT_DEPRECATED_ATTRIBUTE +#endif +#endif + + + /************************************************************************** + * + * @section: + * mac_specific + * + * @title: + * Mac Specific Interface + * + * @abstract: + * Only available on the Macintosh. + * + * @description: + * The following definitions are only available if FreeType is compiled + * on a Macintosh. + * + */ + + + /************************************************************************** + * + * @function: + * FT_New_Face_From_FOND + * + * @description: + * Create a new face object from a FOND resource. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * fond :: + * A FOND resource. + * + * face_index :: + * Only supported for the -1 'sanity check' special case. + * + * @output: + * aface :: + * A handle to a new face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @example: + * This function can be used to create @FT_Face objects from fonts that + * are installed in the system as follows. + * + * ``` + * fond = GetResource( 'FOND', fontName ); + * error = FT_New_Face_From_FOND( library, fond, 0, &face ); + * ``` + */ + FT_EXPORT( FT_Error ) + FT_New_Face_From_FOND( FT_Library library, + Handle fond, + FT_Long face_index, + FT_Face *aface ) + FT_DEPRECATED_ATTRIBUTE; + + + /************************************************************************** + * + * @function: + * FT_GetFile_From_Mac_Name + * + * @description: + * Return an FSSpec for the disk file containing the named font. + * + * @input: + * fontName :: + * Mac OS name of the font (e.g., Times New Roman Bold). + * + * @output: + * pathSpec :: + * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec. + * + * face_index :: + * Index of the face. For passing to @FT_New_Face_From_FSSpec. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_GetFile_From_Mac_Name( const char* fontName, + FSSpec* pathSpec, + FT_Long* face_index ) + FT_DEPRECATED_ATTRIBUTE; + + + /************************************************************************** + * + * @function: + * FT_GetFile_From_Mac_ATS_Name + * + * @description: + * Return an FSSpec for the disk file containing the named font. + * + * @input: + * fontName :: + * Mac OS name of the font in ATS framework. + * + * @output: + * pathSpec :: + * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec. + * + * face_index :: + * Index of the face. For passing to @FT_New_Face_From_FSSpec. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_GetFile_From_Mac_ATS_Name( const char* fontName, + FSSpec* pathSpec, + FT_Long* face_index ) + FT_DEPRECATED_ATTRIBUTE; + + + /************************************************************************** + * + * @function: + * FT_GetFilePath_From_Mac_ATS_Name + * + * @description: + * Return a pathname of the disk file and face index for given font name + * that is handled by ATS framework. + * + * @input: + * fontName :: + * Mac OS name of the font in ATS framework. + * + * @output: + * path :: + * Buffer to store pathname of the file. For passing to @FT_New_Face. + * The client must allocate this buffer before calling this function. + * + * maxPathSize :: + * Lengths of the buffer `path` that client allocated. + * + * face_index :: + * Index of the face. For passing to @FT_New_Face. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_GetFilePath_From_Mac_ATS_Name( const char* fontName, + UInt8* path, + UInt32 maxPathSize, + FT_Long* face_index ) + FT_DEPRECATED_ATTRIBUTE; + + + /************************************************************************** + * + * @function: + * FT_New_Face_From_FSSpec + * + * @description: + * Create a new face object from a given resource and typeface index + * using an FSSpec to the font file. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * spec :: + * FSSpec to the font file. + * + * face_index :: + * The index of the face within the resource. The first face has + * index~0. + * @output: + * aface :: + * A handle to a new face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * @FT_New_Face_From_FSSpec is identical to @FT_New_Face except it + * accepts an FSSpec instead of a path. + */ + FT_EXPORT( FT_Error ) + FT_New_Face_From_FSSpec( FT_Library library, + const FSSpec *spec, + FT_Long face_index, + FT_Face *aface ) + FT_DEPRECATED_ATTRIBUTE; + + + /************************************************************************** + * + * @function: + * FT_New_Face_From_FSRef + * + * @description: + * Create a new face object from a given resource and typeface index + * using an FSRef to the font file. + * + * @inout: + * library :: + * A handle to the library resource. + * + * @input: + * spec :: + * FSRef to the font file. + * + * face_index :: + * The index of the face within the resource. The first face has + * index~0. + * @output: + * aface :: + * A handle to a new face object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * @FT_New_Face_From_FSRef is identical to @FT_New_Face except it accepts + * an FSRef instead of a path. + */ + FT_EXPORT( FT_Error ) + FT_New_Face_From_FSRef( FT_Library library, + const FSRef *ref, + FT_Long face_index, + FT_Face *aface ) + FT_DEPRECATED_ATTRIBUTE; + + /* */ + + +FT_END_HEADER + + +#endif /* FTMAC_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmm.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmm.h new file mode 100644 index 0000000000000000000000000000000000000000..ff0bbab59f955b1d4d353f57d2a0068b18bbc66c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmm.h @@ -0,0 +1,890 @@ +/**************************************************************************** + * + * ftmm.h + * + * FreeType variation font interface (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTMM_H_ +#define FTMM_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * multiple_masters + * + * @title: + * OpenType Font Variations, TrueType GX, and Adobe MM Fonts + * + * @abstract: + * How to manage variable fonts with multiple design axes. + * + * @description: + * The following types and functions manage OpenType Font Variations, + * Adobe Multiple Master (MM) fonts, and Apple TrueType GX fonts. These + * formats have in common that they allow the selection of specific + * design instances by setting design coordinates for one or more axes + * like font weight or width. + * + * For historical reasons there are two interfaces. The first, older one + * can be used with Adobe MM fonts only, and the second, newer one is a + * unified interface that handles all three font formats. However, some + * differences remain and are documented accordingly; in particular, + * Adobe MM fonts don't have named instances (see below). + * + * For Adobe MM fonts, macro @FT_IS_SFNT returns false. For TrueType GX + * and OpenType Font Variations, it returns true. + * + * We use mostly the terminology of the OpenType standard. Here are some + * important technical terms. + * + * * A 'named instance' is a tuple of design coordinates that has a + * string ID (i.e., an index into the font's 'name' table) associated + * with it. The font can tell the user that, for example, + * [Weight=700,Width=110] is 'Bold'. Another name for 'named instance' + * is 'named style'. + * + * Adobe MM fonts don't have named instances. + * + * * The 'default instance' of a variation font is that instance for + * which the nth axis coordinate is equal to the nth default axis + * coordinate (i.e., `axis[n].def` as specified in the @FT_MM_Var + * structure), with~n covering all axes. In TrueType GX and OpenType + * Font Variations, the default instance is explicitly given. In Adobe + * MM fonts, the `WeightVector` entry as found in the font file is + * taken as the default instance. + * + * For TrueType GX and OpenType Font Variations, FreeType synthesizes + * a named instance for the default instance if the font does not + * contain such an entry. + * + * * 'Design coordinates' are the axis values found in a variation font + * file. Their meaning is specified by the font designer and the + * values are rather arbitrary. + * + * For example, the 'weight' axis in design coordinates might vary + * between 100 (thin) and 900 (heavy) in font~A, while font~B + * contains values between 400 (normal) and 800 (extra bold). + * + * * 'Normalized coordinates' are design coordinates mapped to a standard + * range; they are also called 'blend coordinates'. + * + * For TrueType GX and OpenType Font Variations, the range is [-1;1], + * with the minimum mapped to value~-1, the default mapped to + * value~0, and the maximum mapped to value~1, and all other + * coordinates mapped to intervening points. Please look up the + * [OpenType + * specification](https://learn.microsoft.com/en-us/typography/opentype/spec/otvaroverview) + * on how this mapping works in detail. + * + * For Adobe MM fonts, this standard range is [0;1], with the minimum + * mapped to value~0 and the maximum mapped to value~1, and all other + * coordinates mapped to intervening points. Please look up [Adobe + * TechNote + * #5015](https://adobe-type-tools.github.io/font-tech-notes/pdfs/5015.Type1_Supp.pdf) + * on how this mapping works in detail. + * + * Assuming that the two fonts in the previous example are OpenType + * Font Variations, both font~A's [100;900] and font~B's [400;800] + * coordinate ranges get mapped to [-1;1]. + */ + + + /************************************************************************** + * + * @enum: + * T1_MAX_MM_XXX + * + * @description: + * Adobe MM font limits as defined in their specifications. + * + * @values: + * T1_MAX_MM_AXIS :: + * The maximum number of Adobe MM font axes. + * + * T1_MAX_MM_DESIGNS :: + * The maximum number of Adobe MM font designs. + * + * T1_MAX_MM_MAP_POINTS :: + * The maximum number of elements in a design map. + * + */ +#define T1_MAX_MM_AXIS 4 +#define T1_MAX_MM_DESIGNS 16 +#define T1_MAX_MM_MAP_POINTS 20 + + + /************************************************************************** + * + * @struct: + * FT_MM_Axis + * + * @description: + * A structure to model a given axis in design space for Adobe MM fonts. + * + * This structure can't be used with TrueType GX or OpenType Font + * Variations. + * + * @fields: + * name :: + * The axis's name. + * + * minimum :: + * The axis's minimum design coordinate. + * + * maximum :: + * The axis's maximum design coordinate. + */ + typedef struct FT_MM_Axis_ + { + FT_String* name; + FT_Long minimum; + FT_Long maximum; + + } FT_MM_Axis; + + + /************************************************************************** + * + * @struct: + * FT_Multi_Master + * + * @description: + * A structure to model the axes and space of an Adobe MM font. + * + * This structure can't be used with TrueType GX or OpenType Font + * Variations. + * + * @fields: + * num_axis :: + * Number of axes. Cannot exceed~4. + * + * num_designs :: + * Number of designs; should be normally `2^num_axis` even though the + * Type~1 specification strangely allows for intermediate designs to be + * present. This number cannot exceed~16. + * + * axis :: + * A table of axis descriptors. + */ + typedef struct FT_Multi_Master_ + { + FT_UInt num_axis; + FT_UInt num_designs; + FT_MM_Axis axis[T1_MAX_MM_AXIS]; + + } FT_Multi_Master; + + + /************************************************************************** + * + * @struct: + * FT_Var_Axis + * + * @description: + * A structure to model a given axis in design space for Adobe MM fonts, + * TrueType GX, and OpenType Font Variations. + * + * @fields: + * name :: + * The axis's name. Not always meaningful for TrueType GX or OpenType + * Font Variations. + * + * minimum :: + * The axis's minimum design coordinate. + * + * def :: + * The axis's default design coordinate. FreeType computes meaningful + * default values for Adobe MM fonts. + * + * maximum :: + * The axis's maximum design coordinate. + * + * tag :: + * The axis's tag (the equivalent to 'name' for TrueType GX and + * OpenType Font Variations). FreeType provides default values for + * Adobe MM fonts if possible. + * + * strid :: + * The axis name entry in the font's 'name' table. This is another + * (and often better) version of the 'name' field for TrueType GX or + * OpenType Font Variations. Not meaningful for Adobe MM fonts. + * + * @note: + * The fields `minimum`, `def`, and `maximum` are 16.16 fractional values + * for TrueType GX and OpenType Font Variations. For Adobe MM fonts, the + * values are whole numbers (i.e., the fractional part is zero). + */ + typedef struct FT_Var_Axis_ + { + FT_String* name; + + FT_Fixed minimum; + FT_Fixed def; + FT_Fixed maximum; + + FT_ULong tag; + FT_UInt strid; + + } FT_Var_Axis; + + + /************************************************************************** + * + * @struct: + * FT_Var_Named_Style + * + * @description: + * A structure to model a named instance in a TrueType GX or OpenType + * Font Variations. + * + * This structure can't be used for Adobe MM fonts. + * + * @fields: + * coords :: + * The design coordinates for this instance. This is an array with one + * entry for each axis. + * + * strid :: + * An index into the 'name' table identifying this instance. + * + * psid :: + * An index into the 'name' table identifying a PostScript name for + * this instance. Value 0xFFFF indicates a missing entry. + */ + typedef struct FT_Var_Named_Style_ + { + FT_Fixed* coords; + FT_UInt strid; + FT_UInt psid; /* since 2.7.1 */ + + } FT_Var_Named_Style; + + + /************************************************************************** + * + * @struct: + * FT_MM_Var + * + * @description: + * A structure to model the axes and space of Adobe MM fonts, TrueType + * GX, or OpenType Font Variations. + * + * Some fields are specific to one format and not to the others. + * + * @fields: + * num_axis :: + * The number of axes. The maximum value is~4 for Adobe MM fonts; no + * limit in TrueType GX or OpenType Font Variations. + * + * num_designs :: + * The number of designs; should be normally `2^num_axis` for Adobe MM + * fonts. Not meaningful for TrueType GX or OpenType Font Variations + * (where every glyph could have a different number of designs). + * + * num_namedstyles :: + * The number of named instances. For Adobe MM fonts, this value is + * always zero. + * + * axis :: + * An axis descriptor table. TrueType GX and OpenType Font Variations + * contain slightly more data than Adobe MM fonts. Memory management + * of this pointer is done internally by FreeType. + * + * namedstyle :: + * An array of named instances. Only meaningful for TrueType GX and + * OpenType Font Variations. Memory management of this pointer is done + * internally by FreeType. + */ + typedef struct FT_MM_Var_ + { + FT_UInt num_axis; + FT_UInt num_designs; + FT_UInt num_namedstyles; + FT_Var_Axis* axis; + FT_Var_Named_Style* namedstyle; + + } FT_MM_Var; + + + /************************************************************************** + * + * @function: + * FT_Get_Multi_Master + * + * @description: + * Retrieve a variation descriptor of a given Adobe MM font. + * + * This function can't be used with TrueType GX or OpenType Font + * Variations. + * + * @input: + * face :: + * A handle to the source face. + * + * @output: + * amaster :: + * The Adobe MM font's variation descriptor. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Get_Multi_Master( FT_Face face, + FT_Multi_Master *amaster ); + + + /************************************************************************** + * + * @function: + * FT_Get_MM_Var + * + * @description: + * Retrieve a variation descriptor for a given font. + * + * This function works with all supported variation formats. + * + * @input: + * face :: + * A handle to the source face. + * + * @output: + * amaster :: + * The variation descriptor. Allocates a data structure, which the + * user must deallocate with a call to @FT_Done_MM_Var after use. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Get_MM_Var( FT_Face face, + FT_MM_Var* *amaster ); + + + /************************************************************************** + * + * @function: + * FT_Done_MM_Var + * + * @description: + * Free the memory allocated by @FT_Get_MM_Var. + * + * @input: + * library :: + * A handle of the face's parent library object that was used in the + * call to @FT_Get_MM_Var to create `amaster`. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Done_MM_Var( FT_Library library, + FT_MM_Var *amaster ); + + + /************************************************************************** + * + * @function: + * FT_Set_MM_Design_Coordinates + * + * @description: + * For Adobe MM fonts, choose an interpolated font design through design + * coordinates. + * + * This function can't be used with TrueType GX or OpenType Font + * Variations. + * + * @inout: + * face :: + * A handle to the source face. + * + * @input: + * num_coords :: + * The number of available design coordinates. If it is larger than + * the number of axes, ignore the excess values. If it is smaller than + * the number of axes, use default values for the remaining axes. + * + * coords :: + * An array of design coordinates. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * [Since 2.8.1] To reset all axes to the default values, call the + * function with `num_coords` set to zero and `coords` set to `NULL`. + * + * [Since 2.9] If `num_coords` is larger than zero, this function sets + * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. + */ + FT_EXPORT( FT_Error ) + FT_Set_MM_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); + + + /************************************************************************** + * + * @function: + * FT_Set_Var_Design_Coordinates + * + * @description: + * Choose an interpolated font design through design coordinates. + * + * This function works with all supported variation formats. + * + * @inout: + * face :: + * A handle to the source face. + * + * @input: + * num_coords :: + * The number of available design coordinates. If it is larger than + * the number of axes, ignore the excess values. If it is smaller than + * the number of axes, use default values for the remaining axes. + * + * coords :: + * An array of design coordinates. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The design coordinates are 16.16 fractional values for TrueType GX and + * OpenType Font Variations. For Adobe MM fonts, the values are supposed + * to be whole numbers (i.e., the fractional part is zero). + * + * [Since 2.8.1] To reset all axes to the default values, call the + * function with `num_coords` set to zero and `coords` set to `NULL`. + * [Since 2.9] 'Default values' means the currently selected named + * instance (or the base font if no named instance is selected). + * + * [Since 2.9] If `num_coords` is larger than zero, this function sets + * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. + * + * [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit + * in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns + * true) if any of the provided coordinates is different from the face's + * default value for the corresponding axis, that is, the set up face is + * not at its default position. + */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Get_Var_Design_Coordinates + * + * @description: + * Get the design coordinates of the currently selected interpolated + * font. + * + * This function works with all supported variation formats. + * + * @input: + * face :: + * A handle to the source face. + * + * num_coords :: + * The number of design coordinates to retrieve. If it is larger than + * the number of axes, set the excess values to~0. + * + * @output: + * coords :: + * The design coordinates array, which must be allocated by the user. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The design coordinates are 16.16 fractional values for TrueType GX and + * OpenType Font Variations. For Adobe MM fonts, the values are whole + * numbers (i.e., the fractional part is zero). + * + * @since: + * 2.7.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Set_MM_Blend_Coordinates + * + * @description: + * Choose an interpolated font design through normalized coordinates. + * + * This function works with all supported variation formats. + * + * @inout: + * face :: + * A handle to the source face. + * + * @input: + * num_coords :: + * The number of available design coordinates. If it is larger than + * the number of axes, ignore the excess values. If it is smaller than + * the number of axes, use default values for the remaining axes. + * + * coords :: + * The normalized coordinates array. Each element is a 16.16 + * fractional value and must be between 0 and 1.0 for Adobe MM fonts, + * and between -1.0 and 1.0 for TrueType GX and OpenType Font + * Variations. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * [Since 2.8.1] To reset all axes to the default values, call the + * function with `num_coords` set to zero and `coords` set to `NULL`. + * [Since 2.9] 'Default values' means the currently selected named + * instance (or the base font if no named instance is selected). + * + * [Since 2.9] If `num_coords` is larger than zero, this function sets + * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field + * (i.e., @FT_IS_VARIATION returns true). If `num_coords` is zero, this + * bit flag gets unset. + * + * [Since 2.14] This function also sets the @FT_FACE_FLAG_VARIATION bit + * in @FT_Face's `face_flags` field (i.e., @FT_IS_VARIATION returns + * true) if any of the provided coordinates is different from the face's + * default value for the corresponding axis, that is, the set up face is + * not at its default position. + */ + FT_EXPORT( FT_Error ) + FT_Set_MM_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Get_MM_Blend_Coordinates + * + * @description: + * Get the normalized coordinates of the currently selected interpolated + * font. + * + * This function works with all supported variation formats. + * + * @input: + * face :: + * A handle to the source face. + * + * num_coords :: + * The number of normalized coordinates to retrieve. If it is larger + * than the number of axes, set the excess values to~0.5 for Adobe MM + * fonts, and to~0 for TrueType GX and OpenType Font Variations. + * + * @output: + * coords :: + * The normalized coordinates array (as 16.16 fractional values), which + * must be allocated by the user. + * + * @return: + * FreeType error code. 0~means success. + * + * @since: + * 2.7.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_MM_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Set_Var_Blend_Coordinates + * + * @description: + * This is another name of @FT_Set_MM_Blend_Coordinates. + */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Get_Var_Blend_Coordinates + * + * @description: + * This is another name of @FT_Get_MM_Blend_Coordinates. + * + * @since: + * 2.7.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /************************************************************************** + * + * @function: + * FT_Set_MM_WeightVector + * + * @description: + * For Adobe MM fonts, choose an interpolated font design by directly + * setting the weight vector. + * + * This function can't be used with TrueType GX or OpenType Font + * Variations. + * + * @inout: + * face :: + * A handle to the source face. + * + * @input: + * len :: + * The length of the weight vector array. If it is larger than the + * number of designs, the extra values are ignored. If it is less than + * the number of designs, the remaining values are set to zero. + * + * weightvector :: + * An array representing the weight vector. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Adobe MM fonts limit the number of designs, and thus the length of the + * weight vector, to 16~elements. + * + * If `len` is larger than zero, this function sets the + * @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field (i.e., + * @FT_IS_VARIATION returns true). If `len` is zero, this bit flag is + * unset and the weight vector array is reset to the default values. + * + * The Adobe documentation also states that the values in the + * `WeightVector` array must total 1.0 +/-~0.001. In practice this does + * not seem to be enforced, so is not enforced here, either. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Set_MM_WeightVector( FT_Face face, + FT_UInt len, + FT_Fixed* weightvector ); + + + /************************************************************************** + * + * @function: + * FT_Get_MM_WeightVector + * + * @description: + * For Adobe MM fonts, retrieve the current weight vector of the font. + * + * This function can't be used with TrueType GX or OpenType Font + * Variations. + * + * @inout: + * face :: + * A handle to the source face. + * + * len :: + * A pointer to the size of the array to be filled. If the size of the + * array is less than the number of designs, `FT_Err_Invalid_Argument` + * is returned, and `len` is set to the required size (the number of + * designs). If the size of the array is greater than the number of + * designs, the remaining entries are set to~0. On successful + * completion, `len` is set to the number of designs (i.e., the number + * of values written to the array). + * + * @output: + * weightvector :: + * An array to be filled; it must be allocated by the user. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Adobe MM fonts limit the number of designs, and thus the length of the + * weight vector, to~16 elements. + * + * @since: + * 2.10 + */ + FT_EXPORT( FT_Error ) + FT_Get_MM_WeightVector( FT_Face face, + FT_UInt* len, + FT_Fixed* weightvector ); + + + /************************************************************************** + * + * @enum: + * FT_VAR_AXIS_FLAG_XXX + * + * @description: + * A list of bit flags used in the return value of + * @FT_Get_Var_Axis_Flags. + * + * @values: + * FT_VAR_AXIS_FLAG_HIDDEN :: + * The variation axis should not be exposed to user interfaces. + * + * @since: + * 2.8.1 + */ +#define FT_VAR_AXIS_FLAG_HIDDEN 1 + + + /************************************************************************** + * + * @function: + * FT_Get_Var_Axis_Flags + * + * @description: + * Get the 'flags' field of an OpenType Variation Axis Record. + * + * Not meaningful for Adobe MM fonts (`*flags` is always zero). + * + * @input: + * master :: + * The variation descriptor. + * + * axis_index :: + * The index of the requested variation axis. + * + * @output: + * flags :: + * The 'flags' field. See @FT_VAR_AXIS_FLAG_XXX for possible values. + * + * @return: + * FreeType error code. 0~means success. + * + * @since: + * 2.8.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_Var_Axis_Flags( FT_MM_Var* master, + FT_UInt axis_index, + FT_UInt* flags ); + + + /************************************************************************** + * + * @function: + * FT_Set_Named_Instance + * + * @description: + * Set or change the current named instance. + * + * @input: + * face :: + * A handle to the source face. + * + * instance_index :: + * The index of the requested instance, starting with value~1. If set + * to value~0, FreeType switches to font access without a named + * instance. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The function uses the value of `instance_index` to set bits 16-30 of + * the face's `face_index` field. It also resets any variation applied + * to the font, and the @FT_FACE_FLAG_VARIATION bit of the face's + * `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION returns + * false). + * + * For Adobe MM fonts, this function resets the current face to the + * default instance. + * + * @since: + * 2.9 + */ + FT_EXPORT( FT_Error ) + FT_Set_Named_Instance( FT_Face face, + FT_UInt instance_index ); + + + /************************************************************************** + * + * @function: + * FT_Get_Default_Named_Instance + * + * @description: + * Retrieve the index of the default named instance, to be used with + * @FT_Set_Named_Instance. + * + * FreeType synthesizes a named instance for the default instance if the + * font does not contain such an entry. + * + * @input: + * face :: + * A handle to the source face. + * + * @output: + * instance_index :: + * The index of the default named instance. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * For Adobe MM fonts, this function always returns zero for + * `instance_index`. + * + * @since: + * 2.13.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_Default_Named_Instance( FT_Face face, + FT_UInt *instance_index ); + + /* */ + + +FT_END_HEADER + +#endif /* FTMM_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmodapi.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmodapi.h new file mode 100644 index 0000000000000000000000000000000000000000..2669e4a03b337a9b7498cfc199b1966944fc63df --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmodapi.h @@ -0,0 +1,807 @@ +/**************************************************************************** + * + * ftmodapi.h + * + * FreeType modules public interface (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTMODAPI_H_ +#define FTMODAPI_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * module_management + * + * @title: + * Module Management + * + * @abstract: + * How to add, upgrade, remove, and control modules from FreeType. + * + * @description: + * The definitions below are used to manage modules within FreeType. + * Internal and external modules can be added, upgraded, and removed at + * runtime. For example, an alternative renderer or proprietary font + * driver can be registered and prioritized. Additionally, some module + * properties can also be controlled. + * + * Here is a list of existing values of the `module_name` field in the + * @FT_Module_Class structure. + * + * ``` + * autofitter + * bdf + * cff + * gxvalid + * otvalid + * pcf + * pfr + * psaux + * pshinter + * psnames + * raster1 + * sfnt + * smooth + * truetype + * type1 + * type42 + * t1cid + * winfonts + * ``` + * + * Note that the FreeType Cache sub-system is not a FreeType module. + * + * @order: + * FT_Module + * FT_Module_Constructor + * FT_Module_Destructor + * FT_Module_Requester + * FT_Module_Class + * + * FT_Add_Module + * FT_Get_Module + * FT_Remove_Module + * FT_Add_Default_Modules + * + * FT_FACE_DRIVER_NAME + * FT_Property_Set + * FT_Property_Get + * FT_Set_Default_Properties + * + * FT_New_Library + * FT_Done_Library + * FT_Reference_Library + * + * FT_Renderer + * FT_Renderer_Class + * + * FT_Get_Renderer + * FT_Set_Renderer + * + * FT_Set_Debug_Hook + * + */ + + + /* module bit flags */ +#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ +#define FT_MODULE_RENDERER 2 /* this module is a renderer */ +#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ +#define FT_MODULE_STYLER 8 /* this module is a styler */ + +#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ + /* scalable fonts */ +#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ + /* support vector outlines */ +#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ + /* own hinter */ +#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */ + /* produces LIGHT hints */ + + + /* deprecated values */ +#define ft_module_font_driver FT_MODULE_FONT_DRIVER +#define ft_module_renderer FT_MODULE_RENDERER +#define ft_module_hinter FT_MODULE_HINTER +#define ft_module_styler FT_MODULE_STYLER + +#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE +#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES +#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER +#define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY + + + typedef FT_Pointer FT_Module_Interface; + + + /************************************************************************** + * + * @functype: + * FT_Module_Constructor + * + * @description: + * A function used to initialize (not create) a new module object. + * + * @input: + * module :: + * The module to initialize. + */ + typedef FT_Error + (*FT_Module_Constructor)( FT_Module module ); + + + /************************************************************************** + * + * @functype: + * FT_Module_Destructor + * + * @description: + * A function used to finalize (not destroy) a given module object. + * + * @input: + * module :: + * The module to finalize. + */ + typedef void + (*FT_Module_Destructor)( FT_Module module ); + + + /************************************************************************** + * + * @functype: + * FT_Module_Requester + * + * @description: + * A function used to query a given module for a specific interface. + * + * @input: + * module :: + * The module to be searched. + * + * name :: + * The name of the interface in the module. + */ + typedef FT_Module_Interface + (*FT_Module_Requester)( FT_Module module, + const char* name ); + + + /************************************************************************** + * + * @struct: + * FT_Module_Class + * + * @description: + * The module class descriptor. While being a public structure necessary + * for FreeType's module bookkeeping, most of the fields are essentially + * internal, not to be used directly by an application. + * + * @fields: + * module_flags :: + * Bit flags describing the module. + * + * module_size :: + * The size of one module object/instance in bytes. + * + * module_name :: + * The name of the module. + * + * module_version :: + * The version, as a 16.16 fixed number (major.minor). + * + * module_requires :: + * The version of FreeType this module requires, as a 16.16 fixed + * number (major.minor). Starts at version 2.0, i.e., 0x20000. + * + * module_interface :: + * A typeless pointer to a structure (which varies between different + * modules) that holds the module's interface functions. This is + * essentially what `get_interface` returns. + * + * module_init :: + * The initializing function. + * + * module_done :: + * The finalizing function. + * + * get_interface :: + * The interface requesting function. + */ + typedef struct FT_Module_Class_ + { + FT_ULong module_flags; + FT_Long module_size; + const FT_String* module_name; + FT_Fixed module_version; + FT_Fixed module_requires; + + const void* module_interface; + + FT_Module_Constructor module_init; + FT_Module_Destructor module_done; + FT_Module_Requester get_interface; + + } FT_Module_Class; + + + /************************************************************************** + * + * @function: + * FT_Add_Module + * + * @description: + * Add a new module to a given library instance. + * + * @inout: + * library :: + * A handle to the library object. + * + * @input: + * clazz :: + * A pointer to class descriptor for the module. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * An error will be returned if a module already exists by that name, or + * if the module requires a version of FreeType that is too great. + */ + FT_EXPORT( FT_Error ) + FT_Add_Module( FT_Library library, + const FT_Module_Class* clazz ); + + + /************************************************************************** + * + * @function: + * FT_Get_Module + * + * @description: + * Find a module by its name. + * + * @input: + * library :: + * A handle to the library object. + * + * module_name :: + * The module's name (as an ASCII string). + * + * @return: + * A module handle. 0~if none was found. + * + * @note: + * FreeType's internal modules aren't documented very well, and you + * should look up the source code for details. + */ + FT_EXPORT( FT_Module ) + FT_Get_Module( FT_Library library, + const char* module_name ); + + + /************************************************************************** + * + * @function: + * FT_Remove_Module + * + * @description: + * Remove a given module from a library instance. + * + * @inout: + * library :: + * A handle to a library object. + * + * @input: + * module :: + * A handle to a module object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The module object is destroyed by the function in case of success. + */ + FT_EXPORT( FT_Error ) + FT_Remove_Module( FT_Library library, + FT_Module module ); + + + /************************************************************************** + * + * @macro: + * FT_FACE_DRIVER_NAME + * + * @description: + * A macro that retrieves the name of a font driver from a face object. + * + * @note: + * The font driver name is a valid `module_name` for @FT_Property_Set + * and @FT_Property_Get. This is not the same as @FT_Get_Font_Format. + * + * @since: + * 2.11 + * + */ +#define FT_FACE_DRIVER_NAME( face ) \ + ( ( *FT_REINTERPRET_CAST( FT_Module_Class**, \ + ( face )->driver ) )->module_name ) + + + /************************************************************************** + * + * @function: + * FT_Property_Set + * + * @description: + * Set a property for a given module. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in section + * @properties. + * + * Note that only a few modules have properties. + * + * value :: + * A generic pointer to a variable or structure that gives the new + * value of the property. The exact definition of `value` is + * dependent on the property; see section @properties. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name` isn't a valid module name, or `property_name` + * doesn't specify a valid property, or if `value` doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example sets property 'bar' (a simple integer) in + * module 'foo' to value~1. + * + * ``` + * FT_UInt bar; + * + * + * bar = 1; + * FT_Property_Set( library, "foo", "bar", &bar ); + * ``` + * + * Note that the FreeType Cache sub-system doesn't recognize module + * property changes. To avoid glyph lookup confusion within the cache + * you should call @FTC_Manager_Reset to completely flush the cache if a + * module property gets changed after @FTC_Manager_New has been called. + * + * It is not possible to set properties of the FreeType Cache sub-system + * itself with FT_Property_Set; use @FTC_Property_Set instead. + * + * @since: + * 2.4.11 + * + */ + FT_EXPORT( FT_Error ) + FT_Property_Set( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ); + + + /************************************************************************** + * + * @function: + * FT_Property_Get + * + * @description: + * Get a module's property value. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in section + * @properties. + * + * @inout: + * value :: + * A generic pointer to a variable or structure that gives the value + * of the property. The exact definition of `value` is dependent on + * the property; see section @properties. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name` isn't a valid module name, or `property_name` + * doesn't specify a valid property, or if `value` doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example gets property 'baz' (a range) in module 'foo'. + * + * ``` + * typedef range_ + * { + * FT_Int32 min; + * FT_Int32 max; + * + * } range; + * + * range baz; + * + * + * FT_Property_Get( library, "foo", "baz", &baz ); + * ``` + * + * It is not possible to retrieve properties of the FreeType Cache + * sub-system with FT_Property_Get; use @FTC_Property_Get instead. + * + * @since: + * 2.4.11 + * + */ + FT_EXPORT( FT_Error ) + FT_Property_Get( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value ); + + + /************************************************************************** + * + * @function: + * FT_Set_Default_Properties + * + * @description: + * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is + * set, this function reads the `FREETYPE_PROPERTIES` environment + * variable to control driver properties. See section @properties for + * more. + * + * If the compilation option is not set, this function does nothing. + * + * `FREETYPE_PROPERTIES` has the following syntax form (broken here into + * multiple lines for better readability). + * + * ``` + * + * ':' + * '=' + * + * ':' + * '=' + * ... + * ``` + * + * Example: + * + * ``` + * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ + * cff:no-stem-darkening=0 + * ``` + * + * @inout: + * library :: + * A handle to a new library object. + * + * @since: + * 2.8 + */ + FT_EXPORT( void ) + FT_Set_Default_Properties( FT_Library library ); + + + /************************************************************************** + * + * @function: + * FT_Reference_Library + * + * @description: + * A counter gets initialized to~1 at the time an @FT_Library structure + * is created. This function increments the counter. @FT_Done_Library + * then only destroys a library if the counter is~1, otherwise it simply + * decrements the counter. + * + * This function helps in managing life-cycles of structures that + * reference @FT_Library objects. + * + * @input: + * library :: + * A handle to a target library object. + * + * @return: + * FreeType error code. 0~means success. + * + * @since: + * 2.4.2 + */ + FT_EXPORT( FT_Error ) + FT_Reference_Library( FT_Library library ); + + + /************************************************************************** + * + * @function: + * FT_New_Library + * + * @description: + * This function is used to create a new FreeType library instance from a + * given memory object. It is thus possible to use libraries with + * distinct memory allocators within the same program. Note, however, + * that the used @FT_Memory structure is expected to remain valid for the + * life of the @FT_Library object. + * + * Normally, you would call this function (followed by a call to + * @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, and a + * call to @FT_Set_Default_Properties) instead of @FT_Init_FreeType to + * initialize the FreeType library. + * + * Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a library + * instance. + * + * @input: + * memory :: + * A handle to the original memory object. + * + * @output: + * alibrary :: + * A pointer to handle of a new library object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * See the discussion of reference counters in the description of + * @FT_Reference_Library. + */ + FT_EXPORT( FT_Error ) + FT_New_Library( FT_Memory memory, + FT_Library *alibrary ); + + + /************************************************************************** + * + * @function: + * FT_Done_Library + * + * @description: + * Discard a given library object. This closes all drivers and discards + * all resource objects. + * + * @input: + * library :: + * A handle to the target library. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * See the discussion of reference counters in the description of + * @FT_Reference_Library. + */ + FT_EXPORT( FT_Error ) + FT_Done_Library( FT_Library library ); + + + /************************************************************************** + * + * @functype: + * FT_DebugHook_Func + * + * @description: + * A drop-in replacement (or rather a wrapper) for the bytecode or + * charstring interpreter's main loop function. + * + * Its job is essentially + * + * - to activate debug mode to enforce single-stepping, + * + * - to call the main loop function to interpret the next opcode, and + * + * - to show the changed context to the user. + * + * An example for such a main loop function is `TT_RunIns` (declared in + * FreeType's internal header file `src/truetype/ttinterp.h`). + * + * Have a look at the source code of the `ttdebug` FreeType demo program + * for an example of a drop-in replacement. + * + * @inout: + * arg :: + * A typeless pointer, to be cast to the main loop function's data + * structure (which depends on the font module). For TrueType fonts + * it is bytecode interpreter's execution context, `TT_ExecContext`, + * which is declared in FreeType's internal header file `tttypes.h`. + */ + typedef FT_Error + (*FT_DebugHook_Func)( void* arg ); + + + /************************************************************************** + * + * @enum: + * FT_DEBUG_HOOK_XXX + * + * @description: + * A list of named debug hook indices. + * + * @values: + * FT_DEBUG_HOOK_TRUETYPE:: + * This hook index identifies the TrueType bytecode debugger. + */ +#define FT_DEBUG_HOOK_TRUETYPE 0 + + + /************************************************************************** + * + * @function: + * FT_Set_Debug_Hook + * + * @description: + * Set a debug hook function for debugging the interpreter of a font + * format. + * + * While this is a public API function, an application needs access to + * FreeType's internal header files to do something useful. + * + * Have a look at the source code of the `ttdebug` FreeType demo program + * for an example of its usage. + * + * @inout: + * library :: + * A handle to the library object. + * + * @input: + * hook_index :: + * The index of the debug hook. You should use defined enumeration + * macros like @FT_DEBUG_HOOK_TRUETYPE. + * + * debug_hook :: + * The function used to debug the interpreter. + * + * @note: + * Currently, four debug hook slots are available, but only one (for the + * TrueType interpreter) is defined. + */ + FT_EXPORT( void ) + FT_Set_Debug_Hook( FT_Library library, + FT_UInt hook_index, + FT_DebugHook_Func debug_hook ); + + + /************************************************************************** + * + * @function: + * FT_Add_Default_Modules + * + * @description: + * Add the set of default drivers to a given library object. This is + * only useful when you create a library object with @FT_New_Library + * (usually to plug a custom memory manager). + * + * @inout: + * library :: + * A handle to a new library object. + */ + FT_EXPORT( void ) + FT_Add_Default_Modules( FT_Library library ); + + + + /************************************************************************** + * + * @section: + * truetype_engine + * + * @title: + * The TrueType Engine + * + * @abstract: + * TrueType bytecode support. + * + * @description: + * This section contains a function used to query the level of TrueType + * bytecode support compiled in this version of the library. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_TrueTypeEngineType + * + * @description: + * A list of values describing which kind of TrueType bytecode engine is + * implemented in a given FT_Library instance. It is used by the + * @FT_Get_TrueType_Engine_Type function. + * + * @values: + * FT_TRUETYPE_ENGINE_TYPE_NONE :: + * The library doesn't implement any kind of bytecode interpreter. + * + * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: + * Deprecated and removed. + * + * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: + * The library implements a bytecode interpreter that covers the full + * instruction set of the TrueType virtual machine (this was governed + * by patents until May 2010, hence the name). + * + * @since: + * 2.2 + * + */ + typedef enum FT_TrueTypeEngineType_ + { + FT_TRUETYPE_ENGINE_TYPE_NONE = 0, + FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, + FT_TRUETYPE_ENGINE_TYPE_PATENTED + + } FT_TrueTypeEngineType; + + + /************************************************************************** + * + * @function: + * FT_Get_TrueType_Engine_Type + * + * @description: + * Return an @FT_TrueTypeEngineType value to indicate which level of the + * TrueType virtual machine a given library instance supports. + * + * @input: + * library :: + * A library instance. + * + * @return: + * A value indicating which level is supported. + * + * @since: + * 2.2 + * + */ + FT_EXPORT( FT_TrueTypeEngineType ) + FT_Get_TrueType_Engine_Type( FT_Library library ); + + /* */ + + +FT_END_HEADER + +#endif /* FTMODAPI_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmoderr.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmoderr.h new file mode 100644 index 0000000000000000000000000000000000000000..8e2ef2f01f8726089781d380862020f85bce81b2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftmoderr.h @@ -0,0 +1,204 @@ +/**************************************************************************** + * + * ftmoderr.h + * + * FreeType module error offsets (specification). + * + * Copyright (C) 2001-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to define the FreeType module error codes. + * + * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is + * set, the lower byte of an error value identifies the error code as + * usual. In addition, the higher byte identifies the module. For + * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the + * error `TT_Err_Invalid_File_Format` has value 0x1303, the error + * `T1_Err_Invalid_File_Format` has value 0x1403, etc. + * + * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero, + * including the high byte. + * + * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an + * error value is set to zero. + * + * To hide the various `XXX_Err_` prefixes in the source code, FreeType + * provides some macros in `fttypes.h`. + * + * FT_ERR( err ) + * + * Add current error module prefix (as defined with the `FT_ERR_PREFIX` + * macro) to `err`. For example, in the BDF module the line + * + * ``` + * error = FT_ERR( Invalid_Outline ); + * ``` + * + * expands to + * + * ``` + * error = BDF_Err_Invalid_Outline; + * ``` + * + * For simplicity, you can always use `FT_Err_Ok` directly instead of + * `FT_ERR( Ok )`. + * + * FT_ERR_EQ( errcode, err ) + * FT_ERR_NEQ( errcode, err ) + * + * Compare error code `errcode` with the error `err` for equality and + * inequality, respectively. Example: + * + * ``` + * if ( FT_ERR_EQ( error, Invalid_Outline ) ) + * ... + * ``` + * + * Using this macro you don't have to think about error prefixes. Of + * course, if module errors are not active, the above example is the + * same as + * + * ``` + * if ( error == FT_Err_Invalid_Outline ) + * ... + * ``` + * + * FT_ERROR_BASE( errcode ) + * FT_ERROR_MODULE( errcode ) + * + * Get base error and module error code, respectively. + * + * It can also be used to create a module error message table easily with + * something like + * + * ``` + * #undef FTMODERR_H_ + * #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, + * #define FT_MODERR_START_LIST { + * #define FT_MODERR_END_LIST { 0, 0 } }; + * + * const struct + * { + * int mod_err_offset; + * const char* mod_err_msg + * } ft_mod_errors[] = + * + * #include + * ``` + * + */ + + +#ifndef FTMODERR_H_ +#define FTMODERR_H_ + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SETUP MACROS *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + +#ifndef FT_MODERRDEF + +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, +#else +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, +#endif + +#define FT_MODERR_START_LIST enum { +#define FT_MODERR_END_LIST FT_Mod_Err_Max }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C + extern "C" { +#endif + +#endif /* !FT_MODERRDEF */ + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** LIST MODULE ERROR BASES *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#ifdef FT_MODERR_START_LIST + FT_MODERR_START_LIST +#endif + + + FT_MODERRDEF( Base, 0x000, "base module" ) + FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) + FT_MODERRDEF( BDF, 0x200, "BDF module" ) + FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) + FT_MODERRDEF( Cache, 0x400, "cache module" ) + FT_MODERRDEF( CFF, 0x500, "CFF module" ) + FT_MODERRDEF( CID, 0x600, "CID module" ) + FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) + FT_MODERRDEF( LZW, 0x800, "LZW module" ) + FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) + FT_MODERRDEF( PCF, 0xA00, "PCF module" ) + FT_MODERRDEF( PFR, 0xB00, "PFR module" ) + FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) + FT_MODERRDEF( Raster, 0xF00, "raster module" ) + FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) + FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) + FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) + FT_MODERRDEF( Sdf, 0x1700, "Signed distance field raster module" ) + + +#ifdef FT_MODERR_END_LIST + FT_MODERR_END_LIST +#endif + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** CLEANUP *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#ifdef FT_NEED_EXTERN_C + } +#endif + +#undef FT_MODERR_START_LIST +#undef FT_MODERR_END_LIST +#undef FT_MODERRDEF +#undef FT_NEED_EXTERN_C + + +#endif /* FTMODERR_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftotval.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftotval.h new file mode 100644 index 0000000000000000000000000000000000000000..f1cd22acc0de317904d6bbcea65ba9fa2b2bef28 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftotval.h @@ -0,0 +1,206 @@ +/**************************************************************************** + * + * ftotval.h + * + * FreeType API for validating OpenType tables (specification). + * + * Copyright (C) 2004-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +/**************************************************************************** + * + * + * Warning: This module might be moved to a different library in the + * future to avoid a tight dependency between FreeType and the + * OpenType specification. + * + * + */ + + +#ifndef FTOTVAL_H_ +#define FTOTVAL_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * ot_validation + * + * @title: + * OpenType Validation + * + * @abstract: + * An API to validate OpenType tables. + * + * @description: + * This section contains the declaration of functions to validate some + * OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). + * + * @order: + * FT_OpenType_Validate + * FT_OpenType_Free + * + * FT_VALIDATE_OTXXX + * + */ + + + /************************************************************************** + * + * @enum: + * FT_VALIDATE_OTXXX + * + * @description: + * A list of bit-field constants used with @FT_OpenType_Validate to + * indicate which OpenType tables should be validated. + * + * @values: + * FT_VALIDATE_BASE :: + * Validate BASE table. + * + * FT_VALIDATE_GDEF :: + * Validate GDEF table. + * + * FT_VALIDATE_GPOS :: + * Validate GPOS table. + * + * FT_VALIDATE_GSUB :: + * Validate GSUB table. + * + * FT_VALIDATE_JSTF :: + * Validate JSTF table. + * + * FT_VALIDATE_MATH :: + * Validate MATH table. + * + * FT_VALIDATE_OT :: + * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). + * + */ +#define FT_VALIDATE_BASE 0x0100 +#define FT_VALIDATE_GDEF 0x0200 +#define FT_VALIDATE_GPOS 0x0400 +#define FT_VALIDATE_GSUB 0x0800 +#define FT_VALIDATE_JSTF 0x1000 +#define FT_VALIDATE_MATH 0x2000 + +#define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \ + FT_VALIDATE_GDEF | \ + FT_VALIDATE_GPOS | \ + FT_VALIDATE_GSUB | \ + FT_VALIDATE_JSTF | \ + FT_VALIDATE_MATH ) + + + /************************************************************************** + * + * @function: + * FT_OpenType_Validate + * + * @description: + * Validate various OpenType tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library that + * actually does the text layout can access those tables without error + * checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field that specifies the tables to be validated. See + * @FT_VALIDATE_OTXXX for possible values. + * + * @output: + * BASE_table :: + * A pointer to the BASE table. + * + * GDEF_table :: + * A pointer to the GDEF table. + * + * GPOS_table :: + * A pointer to the GPOS table. + * + * GSUB_table :: + * A pointer to the GSUB table. + * + * JSTF_table :: + * A pointer to the JSTF table. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with OpenType fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the five tables with + * @FT_OpenType_Free. A `NULL` value indicates that the table either + * doesn't exist in the font, or the application hasn't asked for + * validation. + */ + FT_EXPORT( FT_Error ) + FT_OpenType_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes *BASE_table, + FT_Bytes *GDEF_table, + FT_Bytes *GPOS_table, + FT_Bytes *GSUB_table, + FT_Bytes *JSTF_table ); + + + /************************************************************************** + * + * @function: + * FT_OpenType_Free + * + * @description: + * Free the buffer allocated by OpenType validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer that is allocated by + * @FT_OpenType_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_OpenType_Validate only. + */ + FT_EXPORT( void ) + FT_OpenType_Free( FT_Face face, + FT_Bytes table ); + + + /* */ + + +FT_END_HEADER + +#endif /* FTOTVAL_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftoutln.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftoutln.h new file mode 100644 index 0000000000000000000000000000000000000000..2545ca8486b6cea6ffbd958f327d24c9a87234fd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftoutln.h @@ -0,0 +1,588 @@ +/**************************************************************************** + * + * ftoutln.h + * + * Support for the FT_Outline type used to store glyph shapes of + * most scalable font formats (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTOUTLN_H_ +#define FTOUTLN_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * outline_processing + * + * @title: + * Outline Processing + * + * @abstract: + * Functions to create, transform, and render vectorial glyph images. + * + * @description: + * This section contains routines used to create and destroy scalable + * glyph images known as 'outlines'. These can also be measured, + * transformed, and converted into bitmaps and pixmaps. + * + * @order: + * FT_Outline + * FT_Outline_New + * FT_Outline_Done + * FT_Outline_Copy + * FT_Outline_Translate + * FT_Outline_Transform + * FT_Outline_Embolden + * FT_Outline_EmboldenXY + * FT_Outline_Reverse + * FT_Outline_Check + * + * FT_Outline_Get_CBox + * FT_Outline_Get_BBox + * + * FT_Outline_Get_Bitmap + * FT_Outline_Render + * FT_Outline_Decompose + * FT_Outline_Funcs + * FT_Outline_MoveToFunc + * FT_Outline_LineToFunc + * FT_Outline_ConicToFunc + * FT_Outline_CubicToFunc + * + * FT_Orientation + * FT_Outline_Get_Orientation + * + * FT_OUTLINE_XXX + * + */ + + + /************************************************************************** + * + * @function: + * FT_Outline_Decompose + * + * @description: + * Walk over an outline's structure to decompose it into individual + * segments and Bezier arcs. This function also emits 'move to' + * operations to indicate the start of new contours in the outline. + * + * @input: + * outline :: + * A pointer to the source target. + * + * func_interface :: + * A table of 'emitters', i.e., function pointers called during + * decomposition to indicate path operations. + * + * @inout: + * user :: + * A typeless pointer that is passed to each emitter during the + * decomposition. It can be used to store the state during the + * decomposition. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Degenerate contours, segments, and Bezier arcs may be reported. In + * most cases, it is best to filter these out before using the outline + * for stroking or other path modification purposes (which may cause + * degenerate segments to become non-degenerate and visible, like when + * stroke caps are used or the path is otherwise outset). Some glyph + * outlines may contain deliberate degenerate single points for mark + * attachement. + * + * Similarly, the function returns success for an empty outline also + * (doing nothing, that is, not calling any emitter); if necessary, you + * should filter this out, too. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Decompose( FT_Outline* outline, + const FT_Outline_Funcs* func_interface, + void* user ); + + + /************************************************************************** + * + * @function: + * FT_Outline_New + * + * @description: + * Create a new outline of a given size. + * + * @input: + * library :: + * A handle to the library object from where the outline is allocated. + * Note however that the new outline will **not** necessarily be + * **freed**, when destroying the library, by @FT_Done_FreeType. + * + * numPoints :: + * The maximum number of points within the outline. Must be smaller + * than or equal to 0xFFFF (65535). + * + * numContours :: + * The maximum number of contours within the outline. This value must + * be in the range 0 to `numPoints`. + * + * @output: + * anoutline :: + * A handle to the new outline. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The reason why this function takes a `library` parameter is simply to + * use the library's memory allocator. + */ + FT_EXPORT( FT_Error ) + FT_Outline_New( FT_Library library, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline *anoutline ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Done + * + * @description: + * Destroy an outline created with @FT_Outline_New. + * + * @input: + * library :: + * A handle of the library object used to allocate the outline. + * + * outline :: + * A pointer to the outline object to be discarded. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If the outline's 'owner' field is not set, only the outline descriptor + * will be released. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Done( FT_Library library, + FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Check + * + * @description: + * Check the contents of an outline descriptor. + * + * @input: + * outline :: + * A handle to a source outline. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * An empty outline, or an outline with a single point only is also + * valid. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Check( FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Get_CBox + * + * @description: + * Return an outline's 'control box'. The control box encloses all the + * outline's points, including Bezier control points. Though it + * coincides with the exact bounding box for most glyphs, it can be + * slightly larger in some situations (like when rotating an outline that + * contains Bezier outside arcs). + * + * Computing the control box is very fast, while getting the bounding box + * can take much more time as it needs to walk over all segments and arcs + * in the outline. To get the latter, you can use the 'ftbbox' + * component, which is dedicated to this single task. + * + * @input: + * outline :: + * A pointer to the source outline descriptor. + * + * @output: + * acbox :: + * The outline's control box. + * + * @note: + * See @FT_Glyph_Get_CBox for a discussion of tricky fonts. + */ + FT_EXPORT( void ) + FT_Outline_Get_CBox( const FT_Outline* outline, + FT_BBox *acbox ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Translate + * + * @description: + * Apply a simple translation to the points of an outline. + * + * @inout: + * outline :: + * A pointer to the target outline descriptor. + * + * @input: + * xOffset :: + * The horizontal offset. + * + * yOffset :: + * The vertical offset. + */ + FT_EXPORT( void ) + FT_Outline_Translate( const FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Copy + * + * @description: + * Copy an outline into another one. Both objects must have the same + * sizes (number of points & number of contours) when this function is + * called. + * + * @input: + * source :: + * A handle to the source outline. + * + * @output: + * target :: + * A handle to the target outline. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Copy( const FT_Outline* source, + FT_Outline *target ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Transform + * + * @description: + * Apply a simple 2x2 matrix to all of an outline's points. Useful for + * applying rotations, slanting, flipping, etc. + * + * @inout: + * outline :: + * A pointer to the target outline descriptor. + * + * @input: + * matrix :: + * A pointer to the transformation matrix. + * + * @note: + * You can use @FT_Outline_Translate if you need to translate the + * outline's points. + */ + FT_EXPORT( void ) + FT_Outline_Transform( const FT_Outline* outline, + const FT_Matrix* matrix ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Embolden + * + * @description: + * Embolden an outline. The new outline will be at most 4~times + * `strength` pixels wider and higher. You may think of the left and + * bottom borders as unchanged. + * + * Negative `strength` values to reduce the outline thickness are + * possible also. + * + * @inout: + * outline :: + * A handle to the target outline. + * + * @input: + * strength :: + * How strong the glyph is emboldened. Expressed in 26.6 pixel format. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The used algorithm to increase or decrease the thickness of the glyph + * doesn't change the number of points; this means that certain + * situations like acute angles or intersections are sometimes handled + * incorrectly. + * + * If you need 'better' metrics values you should call + * @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. + * + * To get meaningful results, font scaling values must be set with + * functions like @FT_Set_Char_Size before calling FT_Render_Glyph. + * + * @example: + * ``` + * FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); + * + * if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) + * FT_Outline_Embolden( &face->glyph->outline, strength ); + * ``` + * + */ + FT_EXPORT( FT_Error ) + FT_Outline_Embolden( FT_Outline* outline, + FT_Pos strength ); + + + /************************************************************************** + * + * @function: + * FT_Outline_EmboldenXY + * + * @description: + * Embolden an outline. The new outline will be `xstrength` pixels wider + * and `ystrength` pixels higher. Otherwise, it is similar to + * @FT_Outline_Embolden, which uses the same strength in both directions. + * + * @since: + * 2.4.10 + */ + FT_EXPORT( FT_Error ) + FT_Outline_EmboldenXY( FT_Outline* outline, + FT_Pos xstrength, + FT_Pos ystrength ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Reverse + * + * @description: + * Reverse the drawing direction of an outline. This is used to ensure + * consistent fill conventions for mirrored glyphs. + * + * @inout: + * outline :: + * A pointer to the target outline descriptor. + * + * @note: + * This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in the + * outline's `flags` field. + * + * It shouldn't be used by a normal client application, unless it knows + * what it is doing. + */ + FT_EXPORT( void ) + FT_Outline_Reverse( FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Get_Bitmap + * + * @description: + * Render an outline within a bitmap. The outline's image is simply + * OR-ed to the target bitmap. + * + * @input: + * library :: + * A handle to a FreeType library object. + * + * outline :: + * A pointer to the source outline descriptor. + * + * @inout: + * abitmap :: + * A pointer to the target bitmap descriptor. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function does **not create** the bitmap, it only renders an + * outline image within the one you pass to it! Consequently, the + * various fields in `abitmap` should be set accordingly. + * + * It will use the raster corresponding to the default glyph format. + * + * The value of the `num_grays` field in `abitmap` is ignored. If you + * select the gray-level rasterizer, and you want less than 256 gray + * levels, you have to use @FT_Outline_Render directly. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + const FT_Bitmap *abitmap ); + + + /************************************************************************** + * + * @function: + * FT_Outline_Render + * + * @description: + * Render an outline within a bitmap using the current scan-convert. + * + * @input: + * library :: + * A handle to a FreeType library object. + * + * outline :: + * A pointer to the source outline descriptor. + * + * @inout: + * params :: + * A pointer to an @FT_Raster_Params structure used to describe the + * rendering operation. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This advanced function uses @FT_Raster_Params as an argument. + * The field `params.source` will be set to `outline` before the scan + * converter is called, which means that the value you give to it is + * actually ignored. Either `params.target` must point to preallocated + * bitmap, or @FT_RASTER_FLAG_DIRECT must be set in `params.flags` + * allowing FreeType rasterizer to be used for direct composition, + * translucency, etc. See @FT_Raster_Params for more details. + */ + FT_EXPORT( FT_Error ) + FT_Outline_Render( FT_Library library, + FT_Outline* outline, + FT_Raster_Params* params ); + + + /************************************************************************** + * + * @enum: + * FT_Orientation + * + * @description: + * A list of values used to describe an outline's contour orientation. + * + * The TrueType and PostScript specifications use different conventions + * to determine whether outline contours should be filled or unfilled. + * + * @values: + * FT_ORIENTATION_TRUETYPE :: + * According to the TrueType specification, clockwise contours must be + * filled, and counter-clockwise ones must be unfilled. + * + * FT_ORIENTATION_POSTSCRIPT :: + * According to the PostScript specification, counter-clockwise + * contours must be filled, and clockwise ones must be unfilled. + * + * FT_ORIENTATION_FILL_RIGHT :: + * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to + * remember that in TrueType, everything that is to the right of the + * drawing direction of a contour must be filled. + * + * FT_ORIENTATION_FILL_LEFT :: + * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to + * remember that in PostScript, everything that is to the left of the + * drawing direction of a contour must be filled. + * + * FT_ORIENTATION_NONE :: + * The orientation cannot be determined. That is, different parts of + * the glyph have different orientation. + * + */ + typedef enum FT_Orientation_ + { + FT_ORIENTATION_TRUETYPE = 0, + FT_ORIENTATION_POSTSCRIPT = 1, + FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, + FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, + FT_ORIENTATION_NONE + + } FT_Orientation; + + + /************************************************************************** + * + * @function: + * FT_Outline_Get_Orientation + * + * @description: + * This function analyzes a glyph outline and tries to compute its fill + * orientation (see @FT_Orientation). This is done by integrating the + * total area covered by the outline. The positive integral corresponds + * to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT is + * returned. The negative integral corresponds to the counter-clockwise + * orientation and @FT_ORIENTATION_TRUETYPE is returned. + * + * Note that this will return @FT_ORIENTATION_TRUETYPE for empty + * outlines. + * + * @input: + * outline :: + * A handle to the source outline. + * + * @return: + * The orientation. + * + */ + FT_EXPORT( FT_Orientation ) + FT_Outline_Get_Orientation( FT_Outline* outline ); + + + /* */ + + +FT_END_HEADER + +#endif /* FTOUTLN_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftparams.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftparams.h new file mode 100644 index 0000000000000000000000000000000000000000..94dcd6399a6eec8e2354ad86b0d1fd8e9a7aef0e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftparams.h @@ -0,0 +1,215 @@ +/**************************************************************************** + * + * ftparams.h + * + * FreeType API for possible FT_Parameter tags (specification only). + * + * Copyright (C) 2017-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTPARAMS_H_ +#define FTPARAMS_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * parameter_tags + * + * @title: + * Parameter Tags + * + * @abstract: + * Macros for driver property and font loading parameter tags. + * + * @description: + * This section contains macros for the @FT_Parameter structure that are + * used with various functions to activate some special functionality or + * different behaviour of various components of FreeType. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * family names in the 'name' table (introduced in OpenType version 1.4). + * Use this for backward compatibility with legacy systems that have a + * four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic + * subfamily names in the 'name' table (introduced in OpenType version + * 1.4). Use this for backward compatibility with legacy systems that + * have a four-faces-per-family restriction. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ + FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + + + /* this constant is deprecated */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * An @FT_Parameter tag to be used with @FT_Open_Face to indicate + * incremental glyph loading. + * + */ +#define FT_PARAM_TAG_INCREMENTAL \ + FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_IGNORE_SBIX + * + * @description: + * A tag for @FT_Parameter to make @FT_Open_Face ignore an 'sbix' table + * while loading a font. Use this if @FT_FACE_FLAG_SBIX is set and you + * want to access the outline glyphs in the font. + * + */ +#define FT_PARAM_TAG_IGNORE_SBIX \ + FT_MAKE_TAG( 'i', 's', 'b', 'x' ) + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_LCD_FILTER_WEIGHTS + * + * @description: + * Overriding global LCD filter weights with custom values for a given + * face is no longer supported and ignored. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ + FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_RANDOM_SEED + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding 32bit signed integer argument overrides the font + * driver's random seed value with a face-specific one; see @random-seed. + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_RANDOM_SEED \ + FT_MAKE_TAG( 's', 'e', 'e', 'd' ) + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_STEM_DARKENING + * + * @description: + * An @FT_Parameter tag to be used with @FT_Face_Properties. The + * corresponding Boolean argument specifies whether to apply stem + * darkening, overriding the global default values or the values set up + * with @FT_Property_Set (see @no-stem-darkening). + * + * This is a passive setting that only takes effect if the font driver or + * autohinter honors it, which the CFF, Type~1, and CID drivers always + * do, but the autohinter only in 'light' hinting mode (as of version + * 2.9). + * + * @since: + * 2.8 + * + */ +#define FT_PARAM_TAG_STEM_DARKENING \ + FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) + + + /************************************************************************** + * + * @enum: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * Deprecated, no effect. + * + * Previously: A constant used as the tag of an @FT_Parameter structure + * to indicate that unpatented methods only should be used by the + * TrueType bytecode interpreter for a typeface opened by @FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING \ + FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + + + /* */ + + +FT_END_HEADER + + +#endif /* FTPARAMS_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftpfr.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftpfr.h new file mode 100644 index 0000000000000000000000000000000000000000..399b5ca3c26682e7390d6560623ead2f142c41e1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftpfr.h @@ -0,0 +1,179 @@ +/**************************************************************************** + * + * ftpfr.h + * + * FreeType API for accessing PFR-specific data (specification only). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTPFR_H_ +#define FTPFR_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * pfr_fonts + * + * @title: + * PFR Fonts + * + * @abstract: + * PFR/TrueDoc-specific API. + * + * @description: + * This section contains the declaration of PFR-specific functions. + * + */ + + + /************************************************************************** + * + * @function: + * FT_Get_PFR_Metrics + * + * @description: + * Return the outline and metrics resolutions of a given PFR face. + * + * @input: + * face :: + * Handle to the input face. It can be a non-PFR face. + * + * @output: + * aoutline_resolution :: + * Outline resolution. This is equivalent to `face->units_per_EM` for + * non-PFR fonts. Optional (parameter can be `NULL`). + * + * ametrics_resolution :: + * Metrics resolution. This is equivalent to `outline_resolution` for + * non-PFR fonts. Optional (parameter can be `NULL`). + * + * ametrics_x_scale :: + * A 16.16 fixed-point number used to scale distance expressed in + * metrics units to device subpixels. This is equivalent to + * `face->size->x_scale`, but for metrics only. Optional (parameter + * can be `NULL`). + * + * ametrics_y_scale :: + * Same as `ametrics_x_scale` but for the vertical direction. + * optional (parameter can be `NULL`). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If the input face is not a PFR, this function will return an error. + * However, in all cases, it will return valid values. + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Metrics( FT_Face face, + FT_UInt *aoutline_resolution, + FT_UInt *ametrics_resolution, + FT_Fixed *ametrics_x_scale, + FT_Fixed *ametrics_y_scale ); + + + /************************************************************************** + * + * @function: + * FT_Get_PFR_Kerning + * + * @description: + * Return the kerning pair corresponding to two glyphs in a PFR face. + * The distance is expressed in metrics units, unlike the result of + * @FT_Get_Kerning. + * + * @input: + * face :: + * A handle to the input face. + * + * left :: + * Index of the left glyph. + * + * right :: + * Index of the right glyph. + * + * @output: + * avector :: + * A kerning vector. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function always return distances in original PFR metrics units. + * This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED mode, + * which always returns distances converted to outline units. + * + * You can use the value of the `x_scale` and `y_scale` parameters + * returned by @FT_Get_PFR_Metrics to scale these to device subpixels. + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Kerning( FT_Face face, + FT_UInt left, + FT_UInt right, + FT_Vector *avector ); + + + /************************************************************************** + * + * @function: + * FT_Get_PFR_Advance + * + * @description: + * Return a given glyph advance, expressed in original metrics units, + * from a PFR font. + * + * @input: + * face :: + * A handle to the input face. + * + * gindex :: + * The glyph index. + * + * @output: + * aadvance :: + * The glyph advance in metrics units. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics + * to convert the advance to device subpixels (i.e., 1/64 of pixels). + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Advance( FT_Face face, + FT_UInt gindex, + FT_Pos *aadvance ); + + /* */ + + +FT_END_HEADER + +#endif /* FTPFR_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftrender.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftrender.h new file mode 100644 index 0000000000000000000000000000000000000000..cc3102073b1d7795c0092ed4b392038c84610d82 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftrender.h @@ -0,0 +1,244 @@ +/**************************************************************************** + * + * ftrender.h + * + * FreeType renderer modules public interface (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTRENDER_H_ +#define FTRENDER_H_ + + +#include +#include + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * module_management + * + */ + + + /* create a new glyph object */ + typedef FT_Error + (*FT_Glyph_InitFunc)( FT_Glyph glyph, + FT_GlyphSlot slot ); + + /* destroys a given glyph object */ + typedef void + (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); + + typedef void + (*FT_Glyph_TransformFunc)( FT_Glyph glyph, + const FT_Matrix* matrix, + const FT_Vector* delta ); + + typedef void + (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, + FT_BBox* abbox ); + + typedef FT_Error + (*FT_Glyph_CopyFunc)( FT_Glyph source, + FT_Glyph target ); + + typedef FT_Error + (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, + FT_GlyphSlot slot ); + +/* deprecated */ +#define FT_Glyph_Init_Func FT_Glyph_InitFunc +#define FT_Glyph_Done_Func FT_Glyph_DoneFunc +#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc +#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc +#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc +#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc + + + struct FT_Glyph_Class_ + { + FT_Long glyph_size; + FT_Glyph_Format glyph_format; + + FT_Glyph_InitFunc glyph_init; + FT_Glyph_DoneFunc glyph_done; + FT_Glyph_CopyFunc glyph_copy; + FT_Glyph_TransformFunc glyph_transform; + FT_Glyph_GetBBoxFunc glyph_bbox; + FT_Glyph_PrepareFunc glyph_prepare; + }; + + + typedef FT_Error + (*FT_Renderer_RenderFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ); + + typedef FT_Error + (*FT_Renderer_TransformFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + const FT_Matrix* matrix, + const FT_Vector* delta ); + + + typedef void + (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + FT_BBox* cbox ); + + + typedef FT_Error + (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, + FT_ULong mode_tag, + FT_Pointer mode_ptr ); + +/* deprecated identifiers */ +#define FTRenderer_render FT_Renderer_RenderFunc +#define FTRenderer_transform FT_Renderer_TransformFunc +#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc +#define FTRenderer_setMode FT_Renderer_SetModeFunc + + + /************************************************************************** + * + * @struct: + * FT_Renderer_Class + * + * @description: + * The renderer module class descriptor. + * + * @fields: + * root :: + * The root @FT_Module_Class fields. + * + * glyph_format :: + * The glyph image format this renderer handles. + * + * render_glyph :: + * A method used to render the image that is in a given glyph slot into + * a bitmap. + * + * transform_glyph :: + * A method used to transform the image that is in a given glyph slot. + * + * get_glyph_cbox :: + * A method used to access the glyph's cbox. + * + * set_mode :: + * A method used to pass additional parameters. + * + * raster_class :: + * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to + * its raster's class. + */ + typedef struct FT_Renderer_Class_ + { + FT_Module_Class root; + + FT_Glyph_Format glyph_format; + + FT_Renderer_RenderFunc render_glyph; + FT_Renderer_TransformFunc transform_glyph; + FT_Renderer_GetCBoxFunc get_glyph_cbox; + FT_Renderer_SetModeFunc set_mode; + + const FT_Raster_Funcs* raster_class; + + } FT_Renderer_Class; + + + /************************************************************************** + * + * @function: + * FT_Get_Renderer + * + * @description: + * Retrieve the current renderer for a given glyph format. + * + * @input: + * library :: + * A handle to the library object. + * + * format :: + * The glyph format. + * + * @return: + * A renderer handle. 0~if none found. + * + * @note: + * An error will be returned if a module already exists by that name, or + * if the module requires a version of FreeType that is too great. + * + * To add a new renderer, simply use @FT_Add_Module. To retrieve a + * renderer by its name, use @FT_Get_Module. + */ + FT_EXPORT( FT_Renderer ) + FT_Get_Renderer( FT_Library library, + FT_Glyph_Format format ); + + + /************************************************************************** + * + * @function: + * FT_Set_Renderer + * + * @description: + * Set the current renderer to use, and set additional mode. + * + * @inout: + * library :: + * A handle to the library object. + * + * @input: + * renderer :: + * A handle to the renderer object. + * + * num_params :: + * The number of additional parameters. + * + * parameters :: + * Additional parameters. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * In case of success, the renderer will be used to convert glyph images + * in the renderer's known format into bitmaps. + * + * This doesn't change the current renderer for other formats. + * + * Currently, no FreeType renderer module uses `parameters`; you should + * thus always pass `NULL` as the value. + */ + FT_EXPORT( FT_Error ) + FT_Set_Renderer( FT_Library library, + FT_Renderer renderer, + FT_UInt num_params, + FT_Parameter* parameters ); + + /* */ + + +FT_END_HEADER + +#endif /* FTRENDER_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsizes.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsizes.h new file mode 100644 index 0000000000000000000000000000000000000000..fdb89f24cccabcbca2e164aa908fdaf0614da34e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsizes.h @@ -0,0 +1,159 @@ +/**************************************************************************** + * + * ftsizes.h + * + * FreeType size objects management (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * Typical application would normally not need to use these functions. + * However, they have been placed in a public API for the rare cases where + * they are needed. + * + */ + + +#ifndef FTSIZES_H_ +#define FTSIZES_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * sizes_management + * + * @title: + * Size Management + * + * @abstract: + * Managing multiple sizes per face. + * + * @description: + * When creating a new face object (e.g., with @FT_New_Face), an @FT_Size + * object is automatically created and used to store all pixel-size + * dependent information, available in the `face->size` field. + * + * It is however possible to create more sizes for a given face, mostly + * in order to manage several character pixel sizes of the same font + * family and style. See @FT_New_Size and @FT_Done_Size. + * + * Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only modify the + * contents of the current 'active' size; you thus need to use + * @FT_Activate_Size to change it. + * + * 99% of applications won't need the functions provided here, especially + * if they use the caching sub-system, so be cautious when using these. + * + */ + + + /************************************************************************** + * + * @function: + * FT_New_Size + * + * @description: + * Create a new size object from a given face object. + * + * @input: + * face :: + * A handle to a parent face object. + * + * @output: + * asize :: + * A handle to a new size object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You need to call @FT_Activate_Size in order to select the new size for + * upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, + * @FT_Load_Glyph, @FT_Load_Char, etc. + */ + FT_EXPORT( FT_Error ) + FT_New_Size( FT_Face face, + FT_Size* size ); + + + /************************************************************************** + * + * @function: + * FT_Done_Size + * + * @description: + * Discard a given size object. Note that @FT_Done_Face automatically + * discards all size objects allocated with @FT_New_Size. + * + * @input: + * size :: + * A handle to a target size object. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Done_Size( FT_Size size ); + + + /************************************************************************** + * + * @function: + * FT_Activate_Size + * + * @description: + * Even though it is possible to create several size objects for a given + * face (see @FT_New_Size for details), functions like @FT_Load_Glyph or + * @FT_Load_Char only use the one that has been activated last to + * determine the 'current character pixel size'. + * + * This function can be used to 'activate' a previously created size + * object. + * + * @input: + * size :: + * A handle to a target size object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `face` is the size's parent face object, this function changes the + * value of `face->size` to the input size handle. + */ + FT_EXPORT( FT_Error ) + FT_Activate_Size( FT_Size size ); + + /* */ + + +FT_END_HEADER + +#endif /* FTSIZES_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsnames.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsnames.h new file mode 100644 index 0000000000000000000000000000000000000000..99728574db64e1226eaae6e73f5335048dabef64 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsnames.h @@ -0,0 +1,272 @@ +/**************************************************************************** + * + * ftsnames.h + * + * Simple interface to access SFNT 'name' tables (which are used + * to hold font names, copyright info, notices, etc.) (specification). + * + * This is _not_ used to retrieve glyph names! + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTSNAMES_H_ +#define FTSNAMES_H_ + + +#include +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * sfnt_names + * + * @title: + * SFNT Names + * + * @abstract: + * Access the names embedded in TrueType and OpenType files. + * + * @description: + * The TrueType and OpenType specifications allow the inclusion of a + * special names table ('name') in font files. This table contains + * textual (and internationalized) information regarding the font, like + * family name, copyright, version, etc. + * + * The definitions below are used to access them if available. + * + * Note that this has nothing to do with glyph names! + * + */ + + + /************************************************************************** + * + * @struct: + * FT_SfntName + * + * @description: + * A structure used to model an SFNT 'name' table entry. + * + * @fields: + * platform_id :: + * The platform ID for `string`. See @TT_PLATFORM_XXX for possible + * values. + * + * encoding_id :: + * The encoding ID for `string`. See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, + * @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX for possible + * values. + * + * language_id :: + * The language ID for `string`. See @TT_MAC_LANGID_XXX and + * @TT_MS_LANGID_XXX for possible values. + * + * Registered OpenType values for `language_id` are always smaller than + * 0x8000; values equal or larger than 0x8000 usually indicate a + * language tag string (introduced in OpenType version 1.6). Use + * function @FT_Get_Sfnt_LangTag with `language_id` as its argument to + * retrieve the associated language tag. + * + * name_id :: + * An identifier for `string`. See @TT_NAME_ID_XXX for possible + * values. + * + * string :: + * The 'name' string. Note that its format differs depending on the + * (platform,encoding) pair, being either a string of bytes (without a + * terminating `NULL` byte) or containing UTF-16BE entities. + * + * string_len :: + * The length of `string` in bytes. + * + * @note: + * Please refer to the TrueType or OpenType specification for more + * details. + */ + typedef struct FT_SfntName_ + { + FT_UShort platform_id; + FT_UShort encoding_id; + FT_UShort language_id; + FT_UShort name_id; + + FT_Byte* string; /* this string is *not* null-terminated! */ + FT_UInt string_len; /* in bytes */ + + } FT_SfntName; + + + /************************************************************************** + * + * @function: + * FT_Get_Sfnt_Name_Count + * + * @description: + * Retrieve the number of name strings in the SFNT 'name' table. + * + * @input: + * face :: + * A handle to the source face. + * + * @return: + * The number of strings in the 'name' table. + * + * @note: + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. + */ + FT_EXPORT( FT_UInt ) + FT_Get_Sfnt_Name_Count( FT_Face face ); + + + /************************************************************************** + * + * @function: + * FT_Get_Sfnt_Name + * + * @description: + * Retrieve a string of the SFNT 'name' table for a given index. + * + * @input: + * face :: + * A handle to the source face. + * + * idx :: + * The index of the 'name' string. + * + * @output: + * aname :: + * The indexed @FT_SfntName structure. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The `string` array returned in the `aname` structure is not + * null-terminated. Note that you don't have to deallocate `string` by + * yourself; FreeType takes care of it if you call @FT_Done_Face. + * + * Use @FT_Get_Sfnt_Name_Count to get the total number of available + * 'name' table entries, then do a loop until you get the right platform, + * encoding, and name ID. + * + * 'name' table format~1 entries can use language tags also, see + * @FT_Get_Sfnt_LangTag. + * + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. + */ + FT_EXPORT( FT_Error ) + FT_Get_Sfnt_Name( FT_Face face, + FT_UInt idx, + FT_SfntName *aname ); + + + /************************************************************************** + * + * @struct: + * FT_SfntLangTag + * + * @description: + * A structure to model a language tag entry from an SFNT 'name' table. + * + * @fields: + * string :: + * The language tag string, encoded in UTF-16BE (without trailing + * `NULL` bytes). + * + * string_len :: + * The length of `string` in **bytes**. + * + * @note: + * Please refer to the TrueType or OpenType specification for more + * details. + * + * @since: + * 2.8 + */ + typedef struct FT_SfntLangTag_ + { + FT_Byte* string; /* this string is *not* null-terminated! */ + FT_UInt string_len; /* in bytes */ + + } FT_SfntLangTag; + + + /************************************************************************** + * + * @function: + * FT_Get_Sfnt_LangTag + * + * @description: + * Retrieve the language tag associated with a language ID of an SFNT + * 'name' table entry. + * + * @input: + * face :: + * A handle to the source face. + * + * langID :: + * The language ID, as returned by @FT_Get_Sfnt_Name. This is always a + * value larger than 0x8000. + * + * @output: + * alangTag :: + * The language tag associated with the 'name' table entry's language + * ID. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The `string` array returned in the `alangTag` structure is not + * null-terminated. Note that you don't have to deallocate `string` by + * yourself; FreeType takes care of it if you call @FT_Done_Face. + * + * Only 'name' table format~1 supports language tags. For format~0 + * tables, this function always returns FT_Err_Invalid_Table. For + * invalid format~1 language ID values, FT_Err_Invalid_Argument is + * returned. + * + * This function always returns an error if the config macro + * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`. + * + * @since: + * 2.8 + */ + FT_EXPORT( FT_Error ) + FT_Get_Sfnt_LangTag( FT_Face face, + FT_UInt langID, + FT_SfntLangTag *alangTag ); + + + /* */ + + +FT_END_HEADER + +#endif /* FTSNAMES_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftstroke.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftstroke.h new file mode 100644 index 0000000000000000000000000000000000000000..2c4761c768d48c4dee6e94e265e19da1bf821000 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftstroke.h @@ -0,0 +1,773 @@ +/**************************************************************************** + * + * ftstroke.h + * + * FreeType path stroker (specification). + * + * Copyright (C) 2002-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTSTROKE_H_ +#define FTSTROKE_H_ + +#include +#include + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * glyph_stroker + * + * @title: + * Glyph Stroker + * + * @abstract: + * Generating bordered and stroked glyphs. + * + * @description: + * This component generates stroked outlines of a given vectorial glyph. + * It also allows you to retrieve the 'outside' and/or the 'inside' + * borders of the stroke. + * + * This can be useful to generate 'bordered' glyph, i.e., glyphs + * displayed with a colored (and anti-aliased) border around their + * shape. + * + * @order: + * FT_Stroker + * + * FT_Stroker_LineJoin + * FT_Stroker_LineCap + * FT_StrokerBorder + * + * FT_Outline_GetInsideBorder + * FT_Outline_GetOutsideBorder + * + * FT_Glyph_Stroke + * FT_Glyph_StrokeBorder + * + * FT_Stroker_New + * FT_Stroker_Set + * FT_Stroker_Rewind + * FT_Stroker_ParseOutline + * FT_Stroker_Done + * + * FT_Stroker_BeginSubPath + * FT_Stroker_EndSubPath + * + * FT_Stroker_LineTo + * FT_Stroker_ConicTo + * FT_Stroker_CubicTo + * + * FT_Stroker_GetBorderCounts + * FT_Stroker_ExportBorder + * FT_Stroker_GetCounts + * FT_Stroker_Export + * + */ + + + /************************************************************************** + * + * @type: + * FT_Stroker + * + * @description: + * Opaque handle to a path stroker object. + */ + typedef struct FT_StrokerRec_* FT_Stroker; + + + /************************************************************************** + * + * @enum: + * FT_Stroker_LineJoin + * + * @description: + * These values determine how two joining lines are rendered in a + * stroker. + * + * @values: + * FT_STROKER_LINEJOIN_ROUND :: + * Used to render rounded line joins. Circular arcs are used to join + * two lines smoothly. + * + * FT_STROKER_LINEJOIN_BEVEL :: + * Used to render beveled line joins. The outer corner of the joined + * lines is filled by enclosing the triangular region of the corner + * with a straight line between the outer corners of each stroke. + * + * FT_STROKER_LINEJOIN_MITER_FIXED :: + * Used to render mitered line joins, with fixed bevels if the miter + * limit is exceeded. The outer edges of the strokes for the two + * segments are extended until they meet at an angle. A bevel join + * (see above) is used if the segments meet at too sharp an angle and + * the outer edges meet beyond a distance corresponding to the meter + * limit. This prevents long spikes being created. + * `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line join as + * used in PostScript and PDF. + * + * FT_STROKER_LINEJOIN_MITER_VARIABLE :: + * FT_STROKER_LINEJOIN_MITER :: + * Used to render mitered line joins, with variable bevels if the miter + * limit is exceeded. The intersection of the strokes is clipped + * perpendicularly to the bisector, at a distance corresponding to + * the miter limit. This prevents long spikes being created. + * `FT_STROKER_LINEJOIN_MITER_VARIABLE` generates a mitered line join + * as used in XPS. `FT_STROKER_LINEJOIN_MITER` is an alias for + * `FT_STROKER_LINEJOIN_MITER_VARIABLE`, retained for backward + * compatibility. + */ + typedef enum FT_Stroker_LineJoin_ + { + FT_STROKER_LINEJOIN_ROUND = 0, + FT_STROKER_LINEJOIN_BEVEL = 1, + FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, + FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, + FT_STROKER_LINEJOIN_MITER_FIXED = 3 + + } FT_Stroker_LineJoin; + + + /************************************************************************** + * + * @enum: + * FT_Stroker_LineCap + * + * @description: + * These values determine how the end of opened sub-paths are rendered in + * a stroke. + * + * @values: + * FT_STROKER_LINECAP_BUTT :: + * The end of lines is rendered as a full stop on the last point + * itself. + * + * FT_STROKER_LINECAP_ROUND :: + * The end of lines is rendered as a half-circle around the last point. + * + * FT_STROKER_LINECAP_SQUARE :: + * The end of lines is rendered as a square around the last point. + */ + typedef enum FT_Stroker_LineCap_ + { + FT_STROKER_LINECAP_BUTT = 0, + FT_STROKER_LINECAP_ROUND, + FT_STROKER_LINECAP_SQUARE + + } FT_Stroker_LineCap; + + + /************************************************************************** + * + * @enum: + * FT_StrokerBorder + * + * @description: + * These values are used to select a given stroke border in + * @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder. + * + * @values: + * FT_STROKER_BORDER_LEFT :: + * Select the left border, relative to the drawing direction. + * + * FT_STROKER_BORDER_RIGHT :: + * Select the right border, relative to the drawing direction. + * + * @note: + * Applications are generally interested in the 'inside' and 'outside' + * borders. However, there is no direct mapping between these and the + * 'left' and 'right' ones, since this really depends on the glyph's + * drawing orientation, which varies between font formats. + * + * You can however use @FT_Outline_GetInsideBorder and + * @FT_Outline_GetOutsideBorder to get these. + */ + typedef enum FT_StrokerBorder_ + { + FT_STROKER_BORDER_LEFT = 0, + FT_STROKER_BORDER_RIGHT + + } FT_StrokerBorder; + + + /************************************************************************** + * + * @function: + * FT_Outline_GetInsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the 'inside' + * borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid + * outlines. + */ + FT_EXPORT( FT_StrokerBorder ) + FT_Outline_GetInsideBorder( FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Outline_GetOutsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the 'outside' + * borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid + * outlines. + */ + FT_EXPORT( FT_StrokerBorder ) + FT_Outline_GetOutsideBorder( FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_New + * + * @description: + * Create a new stroker object. + * + * @input: + * library :: + * FreeType library handle. + * + * @output: + * astroker :: + * A new stroker object handle. `NULL` in case of error. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_New( FT_Library library, + FT_Stroker *astroker ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_Set + * + * @description: + * Reset a stroker object's attributes. + * + * @input: + * stroker :: + * The target stroker handle. + * + * radius :: + * The border radius. + * + * line_cap :: + * The line cap style. + * + * line_join :: + * The line join style. + * + * miter_limit :: + * The maximum reciprocal sine of half-angle at the miter join, + * expressed as 16.16 fixed-point value. + * + * @note: + * The `radius` is expressed in the same units as the outline + * coordinates. + * + * The `miter_limit` multiplied by the `radius` gives the maximum size + * of a miter spike, at which it is clipped for + * @FT_STROKER_LINEJOIN_MITER_VARIABLE or replaced with a bevel join for + * @FT_STROKER_LINEJOIN_MITER_FIXED. + * + * This function calls @FT_Stroker_Rewind automatically. + */ + FT_EXPORT( void ) + FT_Stroker_Set( FT_Stroker stroker, + FT_Fixed radius, + FT_Stroker_LineCap line_cap, + FT_Stroker_LineJoin line_join, + FT_Fixed miter_limit ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_Rewind + * + * @description: + * Reset a stroker object without changing its attributes. You should + * call this function before beginning a new series of calls to + * @FT_Stroker_BeginSubPath or @FT_Stroker_EndSubPath. + * + * @input: + * stroker :: + * The target stroker handle. + */ + FT_EXPORT( void ) + FT_Stroker_Rewind( FT_Stroker stroker ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_ParseOutline + * + * @description: + * A convenience function used to parse a whole outline with the stroker. + * The resulting outline(s) can be retrieved later by functions like + * @FT_Stroker_GetCounts and @FT_Stroker_Export. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The source outline. + * + * opened :: + * A boolean. If~1, the outline is treated as an open path instead of + * a closed one. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `opened` is~0 (the default), the outline is treated as a closed + * path, and the stroker generates two distinct 'border' outlines. + * + * If `opened` is~1, the outline is processed as an open path, and the + * stroker generates a single 'stroke' outline. + * + * This function calls @FT_Stroker_Rewind automatically. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_ParseOutline( FT_Stroker stroker, + FT_Outline* outline, + FT_Bool opened ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_BeginSubPath + * + * @description: + * Start a new sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the start vector. + * + * open :: + * A boolean. If~1, the sub-path is treated as an open one. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function is useful when you need to stroke a path that is not + * stored as an @FT_Outline object. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_BeginSubPath( FT_Stroker stroker, + FT_Vector* to, + FT_Bool open ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_EndSubPath + * + * @description: + * Close the current sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function after @FT_Stroker_BeginSubPath. If the + * subpath was not 'opened', this function 'draws' a single line segment + * to the start position when needed. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_EndSubPath( FT_Stroker stroker ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_LineTo + * + * @description: + * 'Draw' a single line segment in the stroker's current sub-path, from + * the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_LineTo( FT_Stroker stroker, + FT_Vector* to ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_ConicTo + * + * @description: + * 'Draw' a single quadratic Bezier in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control :: + * A pointer to a Bezier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_ConicTo( FT_Stroker stroker, + FT_Vector* control, + FT_Vector* to ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_CubicTo + * + * @description: + * 'Draw' a single cubic Bezier in the stroker's current sub-path, from + * the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control1 :: + * A pointer to the first Bezier control point. + * + * control2 :: + * A pointer to second Bezier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_CubicTo( FT_Stroker stroker, + FT_Vector* control1, + FT_Vector* control2, + FT_Vector* to ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_GetBorderCounts + * + * @description: + * Call this function once you have finished parsing your paths with the + * stroker. It returns the number of points and contours necessary to + * export one of the 'border' or 'stroke' outlines generated by the + * stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * When an outline, or a sub-path, is 'closed', the stroker generates two + * independent 'border' outlines, named 'left' and 'right'. + * + * When the outline, or a sub-path, is 'opened', the stroker merges the + * 'border' outlines with caps. The 'left' border receives all points, + * while the 'right' border becomes empty. + * + * Use the function @FT_Stroker_GetCounts instead if you want to retrieve + * the counts associated to both borders. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_GetBorderCounts( FT_Stroker stroker, + FT_StrokerBorder border, + FT_UInt *anum_points, + FT_UInt *anum_contours ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_ExportBorder + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to export the + * corresponding border to your own @FT_Outline structure. + * + * Note that this function appends the border points and contours to your + * outline, but does not try to resize its arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * outline :: + * The target outline handle. + * + * @note: + * Always call this function after @FT_Stroker_GetBorderCounts to get + * sure that there is enough room in your @FT_Outline object to receive + * all new data. + * + * When an outline, or a sub-path, is 'closed', the stroker generates two + * independent 'border' outlines, named 'left' and 'right'. + * + * When the outline, or a sub-path, is 'opened', the stroker merges the + * 'border' outlines with caps. The 'left' border receives all points, + * while the 'right' border becomes empty. + * + * Use the function @FT_Stroker_Export instead if you want to retrieve + * all borders at once. + */ + FT_EXPORT( void ) + FT_Stroker_ExportBorder( FT_Stroker stroker, + FT_StrokerBorder border, + FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_GetCounts + * + * @description: + * Call this function once you have finished parsing your paths with the + * stroker. It returns the number of points and contours necessary to + * export all points/borders from the stroked outline/path. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0~means success. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_GetCounts( FT_Stroker stroker, + FT_UInt *anum_points, + FT_UInt *anum_contours ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_Export + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to export all + * borders to your own @FT_Outline structure. + * + * Note that this function appends the border points and contours to your + * outline, but does not try to resize its arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The target outline handle. + */ + FT_EXPORT( void ) + FT_Stroker_Export( FT_Stroker stroker, + FT_Outline* outline ); + + + /************************************************************************** + * + * @function: + * FT_Stroker_Done + * + * @description: + * Destroy a stroker object. + * + * @input: + * stroker :: + * A stroker handle. Can be `NULL`. + */ + FT_EXPORT( void ) + FT_Stroker_Done( FT_Stroker stroker ); + + + /************************************************************************** + * + * @function: + * FT_Glyph_Stroke + * + * @description: + * Stroke a given outline glyph object with a given stroker. + * + * @inout: + * pglyph :: + * Source glyph handle on input, new glyph handle on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * destroy :: + * A Boolean. If~1, the source glyph object is destroyed on success. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts to + * account for this added size. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_Stroke( FT_Glyph *pglyph, + FT_Stroker stroker, + FT_Bool destroy ); + + + /************************************************************************** + * + * @function: + * FT_Glyph_StrokeBorder + * + * @description: + * Stroke a given outline glyph object with a given stroker, but only + * return either its inside or outside border. + * + * @inout: + * pglyph :: + * Source glyph handle on input, new glyph handle on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * inside :: + * A Boolean. If~1, return the inside border, otherwise the outside + * border. + * + * destroy :: + * A Boolean. If~1, the source glyph object is destroyed on success. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts to + * account for this added size. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_StrokeBorder( FT_Glyph *pglyph, + FT_Stroker stroker, + FT_Bool inside, + FT_Bool destroy ); + + /* */ + +FT_END_HEADER + +#endif /* FTSTROKE_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsynth.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsynth.h new file mode 100644 index 0000000000000000000000000000000000000000..93499a4b4f1052be517fd40f3a0167afcad91b4c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsynth.h @@ -0,0 +1,104 @@ +/**************************************************************************** + * + * ftsynth.h + * + * FreeType synthesizing code for emboldening and slanting + * (specification). + * + * Copyright (C) 2000-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********* *********/ + /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ + /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ + /********* FREETYPE DEVELOPMENT TEAM *********/ + /********* *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /* Main reason for not lifting the functions in this module to a */ + /* 'standard' API is that the used parameters for emboldening and */ + /* slanting are not configurable. Consider the functions as a */ + /* code resource that should be copied into the application and */ + /* adapted to the particular needs. */ + + +#ifndef FTSYNTH_H_ +#define FTSYNTH_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /* Embolden a glyph by a 'reasonable' value (which is highly a matter of */ + /* taste). This function is actually a convenience function, providing */ + /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ + /* */ + /* For emboldened outlines the height, width, and advance metrics are */ + /* increased by the strength of the emboldening -- this even affects */ + /* mono-width fonts! */ + /* */ + /* You can also call @FT_Outline_Get_CBox to get precise values. */ + FT_EXPORT( void ) + FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); + + /* Precisely adjust the glyph weight either horizontally or vertically. */ + /* The `xdelta` and `ydelta` values are fractions of the face Em size */ + /* (in fixed-point format). Considering that a regular face would have */ + /* stem widths on the order of 0.1 Em, a delta of 0.05 (0x0CCC) should */ + /* be very noticeable. To increase or decrease the weight, use positive */ + /* or negative values, respectively. */ + FT_EXPORT( void ) + FT_GlyphSlot_AdjustWeight( FT_GlyphSlot slot, + FT_Fixed xdelta, + FT_Fixed ydelta ); + + + /* Slant an outline glyph to the right by about 12 degrees. */ + FT_EXPORT( void ) + FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); + + /* Slant an outline glyph by a given sine of an angle. You can apply */ + /* slant along either x- or y-axis by choosing a corresponding non-zero */ + /* argument. If both slants are non-zero, some affine transformation */ + /* will result. */ + FT_EXPORT( void ) + FT_GlyphSlot_Slant( FT_GlyphSlot slot, + FT_Fixed xslant, + FT_Fixed yslant ); + + /* */ + + +FT_END_HEADER + +#endif /* FTSYNTH_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsystem.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsystem.h new file mode 100644 index 0000000000000000000000000000000000000000..1de9f8e603dd8b408fb0d4b5415c4edcb9944425 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftsystem.h @@ -0,0 +1,350 @@ +/**************************************************************************** + * + * ftsystem.h + * + * FreeType low-level system interface definition (specification). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTSYSTEM_H_ +#define FTSYSTEM_H_ + + + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * system_interface + * + * @title: + * System Interface + * + * @abstract: + * How FreeType manages memory and i/o. + * + * @description: + * This section contains various definitions related to memory management + * and i/o access. You need to understand this information if you want to + * use a custom memory manager or you own i/o streams. + * + */ + + + /************************************************************************** + * + * M E M O R Y M A N A G E M E N T + * + */ + + + /************************************************************************** + * + * @type: + * FT_Memory + * + * @description: + * A handle to a given memory manager object, defined with an + * @FT_MemoryRec structure. + * + */ + typedef struct FT_MemoryRec_* FT_Memory; + + + /************************************************************************** + * + * @functype: + * FT_Alloc_Func + * + * @description: + * A function used to allocate `size` bytes from `memory`. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * size :: + * The size in bytes to allocate. + * + * @return: + * Address of new memory block. 0~in case of failure. + * + */ + typedef void* + (*FT_Alloc_Func)( FT_Memory memory, + long size ); + + + /************************************************************************** + * + * @functype: + * FT_Free_Func + * + * @description: + * A function used to release a given block of memory. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * block :: + * The address of the target memory block. + * + */ + typedef void + (*FT_Free_Func)( FT_Memory memory, + void* block ); + + + /************************************************************************** + * + * @functype: + * FT_Realloc_Func + * + * @description: + * A function used to re-allocate a given block of memory. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * cur_size :: + * The block's current size in bytes. + * + * new_size :: + * The block's requested new size. + * + * block :: + * The block's current address. + * + * @return: + * New block address. 0~in case of memory shortage. + * + * @note: + * In case of error, the old block must still be available. + * + */ + typedef void* + (*FT_Realloc_Func)( FT_Memory memory, + long cur_size, + long new_size, + void* block ); + + + /************************************************************************** + * + * @struct: + * FT_MemoryRec + * + * @description: + * A structure used to describe a given memory manager to FreeType~2. + * + * @fields: + * user :: + * A generic typeless pointer for user data. + * + * alloc :: + * A pointer type to an allocation function. + * + * free :: + * A pointer type to an memory freeing function. + * + * realloc :: + * A pointer type to a reallocation function. + * + */ + struct FT_MemoryRec_ + { + void* user; + FT_Alloc_Func alloc; + FT_Free_Func free; + FT_Realloc_Func realloc; + }; + + + /************************************************************************** + * + * I / O M A N A G E M E N T + * + */ + + + /************************************************************************** + * + * @type: + * FT_Stream + * + * @description: + * A handle to an input stream. + * + * @also: + * See @FT_StreamRec for the publicly accessible fields of a given stream + * object. + * + */ + typedef struct FT_StreamRec_* FT_Stream; + + + /************************************************************************** + * + * @struct: + * FT_StreamDesc + * + * @description: + * A union type used to store either a long or a pointer. This is used + * to store a file descriptor or a `FILE*` in an input stream. + * + */ + typedef union FT_StreamDesc_ + { + long value; + void* pointer; + + } FT_StreamDesc; + + + /************************************************************************** + * + * @functype: + * FT_Stream_IoFunc + * + * @description: + * A function used to seek and read data from a given input stream. + * + * @input: + * stream :: + * A handle to the source stream. + * + * offset :: + * The offset from the start of the stream to seek to. + * + * buffer :: + * The address of the read buffer. + * + * count :: + * The number of bytes to read from the stream. + * + * @return: + * If count >~0, return the number of bytes effectively read by the + * stream (after seeking to `offset`). If count ==~0, return the status + * of the seek operation (non-zero indicates an error). + * + */ + typedef unsigned long + (*FT_Stream_IoFunc)( FT_Stream stream, + unsigned long offset, + unsigned char* buffer, + unsigned long count ); + + + /************************************************************************** + * + * @functype: + * FT_Stream_CloseFunc + * + * @description: + * A function used to close a given input stream. + * + * @input: + * stream :: + * A handle to the target stream. + * + */ + typedef void + (*FT_Stream_CloseFunc)( FT_Stream stream ); + + + /************************************************************************** + * + * @struct: + * FT_StreamRec + * + * @description: + * A structure used to describe an input stream. + * + * @input: + * base :: + * For memory-based streams, this is the address of the first stream + * byte in memory. This field should always be set to `NULL` for + * disk-based streams. + * + * size :: + * The stream size in bytes. + * + * In case of compressed streams where the size is unknown before + * actually doing the decompression, the value is set to 0x7FFFFFFF. + * (Note that this size value can occur for normal streams also; it is + * thus just a hint.) + * + * pos :: + * The current position within the stream. + * + * descriptor :: + * This field is a union that can hold an integer or a pointer. It is + * used by stream implementations to store file descriptors or `FILE*` + * pointers. + * + * pathname :: + * This field is completely ignored by FreeType. However, it is often + * useful during debugging to use it to store the stream's filename + * (where available). + * + * read :: + * The stream's input function. + * + * close :: + * The stream's close function. + * + * memory :: + * The memory manager to use to preload frames. This is set internally + * by FreeType and shouldn't be touched by stream implementations. + * + * cursor :: + * This field is set and used internally by FreeType when parsing + * frames. In particular, the `FT_GET_XXX` macros use this instead of + * the `pos` field. + * + * limit :: + * This field is set and used internally by FreeType when parsing + * frames. + * + */ + typedef struct FT_StreamRec_ + { + unsigned char* base; + unsigned long size; + unsigned long pos; + + FT_StreamDesc descriptor; + FT_StreamDesc pathname; + FT_Stream_IoFunc read; + FT_Stream_CloseFunc close; + + FT_Memory memory; + unsigned char* cursor; + unsigned char* limit; + + } FT_StreamRec; + + /* */ + + +FT_END_HEADER + +#endif /* FTSYSTEM_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttrigon.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttrigon.h new file mode 100644 index 0000000000000000000000000000000000000000..ed7bd06a78fc5baca2fe0eb0415204b7690e563c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttrigon.h @@ -0,0 +1,350 @@ +/**************************************************************************** + * + * fttrigon.h + * + * FreeType trigonometric functions (specification). + * + * Copyright (C) 2001-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTTRIGON_H_ +#define FTTRIGON_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * computations + * + */ + + + /************************************************************************** + * + * @type: + * FT_Angle + * + * @description: + * This type is used to model angle values in FreeType. Note that the + * angle is a 16.16 fixed-point value expressed in degrees. + * + */ + typedef FT_Fixed FT_Angle; + + + /************************************************************************** + * + * @macro: + * FT_ANGLE_PI + * + * @description: + * The angle pi expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI ( 180L << 16 ) + + + /************************************************************************** + * + * @macro: + * FT_ANGLE_2PI + * + * @description: + * The angle 2*pi expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) + + + /************************************************************************** + * + * @macro: + * FT_ANGLE_PI2 + * + * @description: + * The angle pi/2 expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) + + + /************************************************************************** + * + * @macro: + * FT_ANGLE_PI4 + * + * @description: + * The angle pi/4 expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) + + + /************************************************************************** + * + * @function: + * FT_Sin + * + * @description: + * Return the sinus of a given angle in fixed-point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The sinus value. + * + * @note: + * If you need both the sinus and cosinus for a given angle, use the + * function @FT_Vector_Unit. + * + */ + FT_EXPORT( FT_Fixed ) + FT_Sin( FT_Angle angle ); + + + /************************************************************************** + * + * @function: + * FT_Cos + * + * @description: + * Return the cosinus of a given angle in fixed-point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The cosinus value. + * + * @note: + * If you need both the sinus and cosinus for a given angle, use the + * function @FT_Vector_Unit. + * + */ + FT_EXPORT( FT_Fixed ) + FT_Cos( FT_Angle angle ); + + + /************************************************************************** + * + * @function: + * FT_Tan + * + * @description: + * Return the tangent of a given angle in fixed-point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The tangent value. + * + */ + FT_EXPORT( FT_Fixed ) + FT_Tan( FT_Angle angle ); + + + /************************************************************************** + * + * @function: + * FT_Atan2 + * + * @description: + * Return the arc-tangent corresponding to a given vector (x,y) in the 2d + * plane. + * + * @input: + * x :: + * The horizontal vector coordinate. + * + * y :: + * The vertical vector coordinate. + * + * @return: + * The arc-tangent value (i.e. angle). + * + */ + FT_EXPORT( FT_Angle ) + FT_Atan2( FT_Fixed x, + FT_Fixed y ); + + + /************************************************************************** + * + * @function: + * FT_Angle_Diff + * + * @description: + * Return the difference between two angles. The result is always + * constrained to the ]-PI..PI] interval. + * + * @input: + * angle1 :: + * First angle. + * + * angle2 :: + * Second angle. + * + * @return: + * Constrained value of `angle2-angle1`. + * + */ + FT_EXPORT( FT_Angle ) + FT_Angle_Diff( FT_Angle angle1, + FT_Angle angle2 ); + + + /************************************************************************** + * + * @function: + * FT_Vector_Unit + * + * @description: + * Return the unit vector corresponding to a given angle. After the + * call, the value of `vec.x` will be `cos(angle)`, and the value of + * `vec.y` will be `sin(angle)`. + * + * This function is useful to retrieve both the sinus and cosinus of a + * given angle quickly. + * + * @output: + * vec :: + * The address of target vector. + * + * @input: + * angle :: + * The input angle. + * + */ + FT_EXPORT( void ) + FT_Vector_Unit( FT_Vector* vec, + FT_Angle angle ); + + + /************************************************************************** + * + * @function: + * FT_Vector_Rotate + * + * @description: + * Rotate a vector by a given angle. + * + * @inout: + * vec :: + * The address of target vector. + * + * @input: + * angle :: + * The input angle. + * + */ + FT_EXPORT( void ) + FT_Vector_Rotate( FT_Vector* vec, + FT_Angle angle ); + + + /************************************************************************** + * + * @function: + * FT_Vector_Length + * + * @description: + * Return the length of a given vector. + * + * @input: + * vec :: + * The address of target vector. + * + * @return: + * The vector length, expressed in the same units that the original + * vector coordinates. + * + */ + FT_EXPORT( FT_Fixed ) + FT_Vector_Length( FT_Vector* vec ); + + + /************************************************************************** + * + * @function: + * FT_Vector_Polarize + * + * @description: + * Compute both the length and angle of a given vector. + * + * @input: + * vec :: + * The address of source vector. + * + * @output: + * length :: + * The vector length. + * + * angle :: + * The vector angle. + * + */ + FT_EXPORT( void ) + FT_Vector_Polarize( FT_Vector* vec, + FT_Fixed *length, + FT_Angle *angle ); + + + /************************************************************************** + * + * @function: + * FT_Vector_From_Polar + * + * @description: + * Compute vector coordinates from a length and angle. + * + * @output: + * vec :: + * The address of source vector. + * + * @input: + * length :: + * The vector length. + * + * angle :: + * The vector angle. + * + */ + FT_EXPORT( void ) + FT_Vector_From_Polar( FT_Vector* vec, + FT_Fixed length, + FT_Angle angle ); + + /* */ + + +FT_END_HEADER + +#endif /* FTTRIGON_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttypes.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttypes.h new file mode 100644 index 0000000000000000000000000000000000000000..e207c5ebe09ae6a15ae33b569bb532a6a1588cfa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/fttypes.h @@ -0,0 +1,617 @@ +/**************************************************************************** + * + * fttypes.h + * + * FreeType simple types definitions (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTTYPES_H_ +#define FTTYPES_H_ + + +#include +#include FT_CONFIG_CONFIG_H +#include +#include + +#include + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * basic_types + * + * @title: + * Basic Data Types + * + * @abstract: + * The basic data types defined by the library. + * + * @description: + * This section contains the basic data types defined by FreeType~2, + * ranging from simple scalar types to bitmap descriptors. More + * font-specific structures are defined in a different section. Note + * that FreeType does not use floating-point data types. Fractional + * values are represented by fixed-point integers, with lower bits + * storing the fractional part. + * + * @order: + * FT_Byte + * FT_Bytes + * FT_Char + * FT_Int + * FT_UInt + * FT_Int16 + * FT_UInt16 + * FT_Int32 + * FT_UInt32 + * FT_Int64 + * FT_UInt64 + * FT_Short + * FT_UShort + * FT_Long + * FT_ULong + * FT_Bool + * FT_Offset + * FT_PtrDist + * FT_String + * FT_Tag + * FT_Error + * FT_Fixed + * FT_Pointer + * FT_Pos + * FT_Vector + * FT_BBox + * FT_Matrix + * FT_FWord + * FT_UFWord + * FT_F2Dot14 + * FT_UnitVector + * FT_F26Dot6 + * FT_Data + * + * FT_MAKE_TAG + * + * FT_Generic + * FT_Generic_Finalizer + * + * FT_Bitmap + * FT_Pixel_Mode + * FT_Palette_Mode + * FT_Glyph_Format + * FT_IMAGE_TAG + * + */ + + + /************************************************************************** + * + * @type: + * FT_Bool + * + * @description: + * A typedef of unsigned char, used for simple booleans. As usual, + * values 1 and~0 represent true and false, respectively. + */ + typedef unsigned char FT_Bool; + + + /************************************************************************** + * + * @type: + * FT_FWord + * + * @description: + * A signed 16-bit integer used to store a distance in original font + * units. + */ + typedef signed short FT_FWord; /* distance in FUnits */ + + + /************************************************************************** + * + * @type: + * FT_UFWord + * + * @description: + * An unsigned 16-bit integer used to store a distance in original font + * units. + */ + typedef unsigned short FT_UFWord; /* unsigned distance */ + + + /************************************************************************** + * + * @type: + * FT_Char + * + * @description: + * A simple typedef for the _signed_ char type. + */ + typedef signed char FT_Char; + + + /************************************************************************** + * + * @type: + * FT_Byte + * + * @description: + * A simple typedef for the _unsigned_ char type. + */ + typedef unsigned char FT_Byte; + + + /************************************************************************** + * + * @type: + * FT_Bytes + * + * @description: + * A typedef for constant memory areas. + */ + typedef const FT_Byte* FT_Bytes; + + + /************************************************************************** + * + * @type: + * FT_Tag + * + * @description: + * A typedef for 32-bit tags (as used in the SFNT format). + */ + typedef FT_UInt32 FT_Tag; + + + /************************************************************************** + * + * @type: + * FT_String + * + * @description: + * A simple typedef for the char type, usually used for strings. + */ + typedef char FT_String; + + + /************************************************************************** + * + * @type: + * FT_Short + * + * @description: + * A typedef for signed short. + */ + typedef signed short FT_Short; + + + /************************************************************************** + * + * @type: + * FT_UShort + * + * @description: + * A typedef for unsigned short. + */ + typedef unsigned short FT_UShort; + + + /************************************************************************** + * + * @type: + * FT_Int + * + * @description: + * A typedef for the int type. + */ + typedef signed int FT_Int; + + + /************************************************************************** + * + * @type: + * FT_UInt + * + * @description: + * A typedef for the unsigned int type. + */ + typedef unsigned int FT_UInt; + + + /************************************************************************** + * + * @type: + * FT_Long + * + * @description: + * A typedef for signed long. + */ + typedef signed long FT_Long; + + + /************************************************************************** + * + * @type: + * FT_ULong + * + * @description: + * A typedef for unsigned long. + */ + typedef unsigned long FT_ULong; + + + /************************************************************************** + * + * @type: + * FT_F2Dot14 + * + * @description: + * A signed 2.14 fixed-point type used for unit vectors. + */ + typedef signed short FT_F2Dot14; + + + /************************************************************************** + * + * @type: + * FT_F26Dot6 + * + * @description: + * A signed 26.6 fixed-point type used for vectorial pixel coordinates. + */ + typedef signed long FT_F26Dot6; + + + /************************************************************************** + * + * @type: + * FT_Fixed + * + * @description: + * This type is used to store 16.16 fixed-point values, like scaling + * values or matrix coefficients. + */ + typedef signed long FT_Fixed; + + + /************************************************************************** + * + * @type: + * FT_Error + * + * @description: + * The FreeType error code type. A value of~0 is always interpreted as a + * successful operation. + */ + typedef int FT_Error; + + + /************************************************************************** + * + * @type: + * FT_Pointer + * + * @description: + * A simple typedef for a typeless pointer. + */ + typedef void* FT_Pointer; + + + /************************************************************************** + * + * @type: + * FT_Offset + * + * @description: + * This is equivalent to the ANSI~C `size_t` type, i.e., the largest + * _unsigned_ integer type used to express a file size or position, or a + * memory block size. + */ + typedef size_t FT_Offset; + + + /************************************************************************** + * + * @type: + * FT_PtrDist + * + * @description: + * This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest + * _signed_ integer type used to express the distance between two + * pointers. + */ + typedef ft_ptrdiff_t FT_PtrDist; + + + /************************************************************************** + * + * @struct: + * FT_UnitVector + * + * @description: + * A simple structure used to store a 2D vector unit vector. Uses + * FT_F2Dot14 types. + * + * @fields: + * x :: + * Horizontal coordinate. + * + * y :: + * Vertical coordinate. + */ + typedef struct FT_UnitVector_ + { + FT_F2Dot14 x; + FT_F2Dot14 y; + + } FT_UnitVector; + + + /************************************************************************** + * + * @struct: + * FT_Matrix + * + * @description: + * A simple structure used to store a 2x2 matrix. Coefficients are in + * 16.16 fixed-point format. The computation performed is: + * + * ``` + * x' = x*xx + y*xy + * y' = x*yx + y*yy + * ``` + * + * @fields: + * xx :: + * Matrix coefficient. + * + * xy :: + * Matrix coefficient. + * + * yx :: + * Matrix coefficient. + * + * yy :: + * Matrix coefficient. + */ + typedef struct FT_Matrix_ + { + FT_Fixed xx, xy; + FT_Fixed yx, yy; + + } FT_Matrix; + + + /************************************************************************** + * + * @struct: + * FT_Data + * + * @description: + * Read-only binary data represented as a pointer and a length. + * + * @fields: + * pointer :: + * The data. + * + * length :: + * The length of the data in bytes. + */ + typedef struct FT_Data_ + { + const FT_Byte* pointer; + FT_UInt length; + + } FT_Data; + + + /************************************************************************** + * + * @functype: + * FT_Generic_Finalizer + * + * @description: + * Describe a function used to destroy the 'client' data of any FreeType + * object. See the description of the @FT_Generic type for details of + * usage. + * + * @input: + * The address of the FreeType object that is under finalization. Its + * client data is accessed through its `generic` field. + */ + typedef void (*FT_Generic_Finalizer)( void* object ); + + + /************************************************************************** + * + * @struct: + * FT_Generic + * + * @description: + * Client applications often need to associate their own data to a + * variety of FreeType core objects. For example, a text layout API + * might want to associate a glyph cache to a given size object. + * + * Some FreeType object contains a `generic` field, of type `FT_Generic`, + * which usage is left to client applications and font servers. + * + * It can be used to store a pointer to client-specific data, as well as + * the address of a 'finalizer' function, which will be called by + * FreeType when the object is destroyed (for example, the previous + * client example would put the address of the glyph cache destructor in + * the `finalizer` field). + * + * @fields: + * data :: + * A typeless pointer to any client-specified data. This field is + * completely ignored by the FreeType library. + * + * finalizer :: + * A pointer to a 'generic finalizer' function, which will be called + * when the object is destroyed. If this field is set to `NULL`, no + * code will be called. + */ + typedef struct FT_Generic_ + { + void* data; + FT_Generic_Finalizer finalizer; + + } FT_Generic; + + + /************************************************************************** + * + * @macro: + * FT_MAKE_TAG + * + * @description: + * This macro converts four-letter tags that are used to label TrueType + * tables into an `FT_Tag` type, to be used within FreeType. + * + * @note: + * The produced values **must** be 32-bit integers. Don't redefine this + * macro. + */ +#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ + ( ( FT_STATIC_BYTE_CAST( FT_Tag, _x1 ) << 24 ) | \ + ( FT_STATIC_BYTE_CAST( FT_Tag, _x2 ) << 16 ) | \ + ( FT_STATIC_BYTE_CAST( FT_Tag, _x3 ) << 8 ) | \ + FT_STATIC_BYTE_CAST( FT_Tag, _x4 ) ) + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* L I S T M A N A G E M E N T */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @section: + * list_processing + * + */ + + + /************************************************************************** + * + * @type: + * FT_ListNode + * + * @description: + * Many elements and objects in FreeType are listed through an @FT_List + * record (see @FT_ListRec). As its name suggests, an FT_ListNode is a + * handle to a single list element. + */ + typedef struct FT_ListNodeRec_* FT_ListNode; + + + /************************************************************************** + * + * @type: + * FT_List + * + * @description: + * A handle to a list record (see @FT_ListRec). + */ + typedef struct FT_ListRec_* FT_List; + + + /************************************************************************** + * + * @struct: + * FT_ListNodeRec + * + * @description: + * A structure used to hold a single list element. + * + * @fields: + * prev :: + * The previous element in the list. `NULL` if first. + * + * next :: + * The next element in the list. `NULL` if last. + * + * data :: + * A typeless pointer to the listed object. + */ + typedef struct FT_ListNodeRec_ + { + FT_ListNode prev; + FT_ListNode next; + void* data; + + } FT_ListNodeRec; + + + /************************************************************************** + * + * @struct: + * FT_ListRec + * + * @description: + * A structure used to hold a simple doubly-linked list. These are used + * in many parts of FreeType. + * + * @fields: + * head :: + * The head (first element) of doubly-linked list. + * + * tail :: + * The tail (last element) of doubly-linked list. + */ + typedef struct FT_ListRec_ + { + FT_ListNode head; + FT_ListNode tail; + + } FT_ListRec; + + /* */ + + +#define FT_IS_EMPTY( list ) ( (list).head == 0 ) +#define FT_BOOL( x ) FT_STATIC_CAST( FT_Bool, (x) != 0 ) + + /* concatenate C tokens */ +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) + + /* see `ftmoderr.h` for descriptions of the following macros */ + +#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) + +#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) +#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) + +#define FT_ERR_EQ( x, e ) \ + ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) +#define FT_ERR_NEQ( x, e ) \ + ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) + + +FT_END_HEADER + +#endif /* FTTYPES_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftwinfnt.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftwinfnt.h new file mode 100644 index 0000000000000000000000000000000000000000..78609d578a60ec0de6b21f3b776b926aa3950bd3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ftwinfnt.h @@ -0,0 +1,275 @@ +/**************************************************************************** + * + * ftwinfnt.h + * + * FreeType API for accessing Windows fnt-specific data. + * + * Copyright (C) 2003-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef FTWINFNT_H_ +#define FTWINFNT_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * winfnt_fonts + * + * @title: + * Window FNT Files + * + * @abstract: + * Windows FNT-specific API. + * + * @description: + * This section contains the declaration of Windows FNT-specific + * functions. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_WinFNT_ID_XXX + * + * @description: + * A list of valid values for the `charset` byte in @FT_WinFNT_HeaderRec. + * Exact mapping tables for the various 'cpXXXX' encodings (except for + * 'cp1361') can be found at 'ftp://ftp.unicode.org/Public/' in the + * `MAPPINGS/VENDORS/MICSFT/WINDOWS` subdirectory. 'cp1361' is roughly a + * superset of `MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT`. + * + * @values: + * FT_WinFNT_ID_DEFAULT :: + * This is used for font enumeration and font creation as a 'don't + * care' value. Valid font files don't contain this value. When + * querying for information about the character set of the font that is + * currently selected into a specified device context, this return + * value (of the related Windows API) simply denotes failure. + * + * FT_WinFNT_ID_SYMBOL :: + * There is no known mapping table available. + * + * FT_WinFNT_ID_MAC :: + * Mac Roman encoding. + * + * FT_WinFNT_ID_OEM :: + * From Michael Poettgen : + * + * The 'Windows Font Mapping' article says that `FT_WinFNT_ID_OEM` is + * used for the charset of vector fonts, like `modern.fon`, + * `roman.fon`, and `script.fon` on Windows. + * + * The 'CreateFont' documentation says: The `FT_WinFNT_ID_OEM` value + * specifies a character set that is operating-system dependent. + * + * The 'IFIMETRICS' documentation from the 'Windows Driver Development + * Kit' says: This font supports an OEM-specific character set. The + * OEM character set is system dependent. + * + * In general OEM, as opposed to ANSI (i.e., 'cp1252'), denotes the + * second default codepage that most international versions of Windows + * have. It is one of the OEM codepages from + * + * https://learn.microsoft.com/windows/win32/intl/code-page-identifiers , + * + * and is used for the 'DOS boxes', to support legacy applications. A + * German Windows version for example usually uses ANSI codepage 1252 + * and OEM codepage 850. + * + * FT_WinFNT_ID_CP874 :: + * A superset of Thai TIS 620 and ISO 8859-11. + * + * FT_WinFNT_ID_CP932 :: + * A superset of Japanese Shift-JIS (with minor deviations). + * + * FT_WinFNT_ID_CP936 :: + * A superset of simplified Chinese GB 2312-1980 (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP949 :: + * A superset of Korean Hangul KS~C 5601-1987 (with different ordering + * and minor deviations). + * + * FT_WinFNT_ID_CP950 :: + * A superset of traditional Chinese Big~5 ETen (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP1250 :: + * A superset of East European ISO 8859-2 (with slightly different + * ordering). + * + * FT_WinFNT_ID_CP1251 :: + * A superset of Russian ISO 8859-5 (with different ordering). + * + * FT_WinFNT_ID_CP1252 :: + * ANSI encoding. A superset of ISO 8859-1. + * + * FT_WinFNT_ID_CP1253 :: + * A superset of Greek ISO 8859-7 (with minor modifications). + * + * FT_WinFNT_ID_CP1254 :: + * A superset of Turkish ISO 8859-9. + * + * FT_WinFNT_ID_CP1255 :: + * A superset of Hebrew ISO 8859-8 (with some modifications). + * + * FT_WinFNT_ID_CP1256 :: + * A superset of Arabic ISO 8859-6 (with different ordering). + * + * FT_WinFNT_ID_CP1257 :: + * A superset of Baltic ISO 8859-13 (with some deviations). + * + * FT_WinFNT_ID_CP1258 :: + * For Vietnamese. This encoding doesn't cover all necessary + * characters. + * + * FT_WinFNT_ID_CP1361 :: + * Korean (Johab). + */ + +#define FT_WinFNT_ID_CP1252 0 +#define FT_WinFNT_ID_DEFAULT 1 +#define FT_WinFNT_ID_SYMBOL 2 +#define FT_WinFNT_ID_MAC 77 +#define FT_WinFNT_ID_CP932 128 +#define FT_WinFNT_ID_CP949 129 +#define FT_WinFNT_ID_CP1361 130 +#define FT_WinFNT_ID_CP936 134 +#define FT_WinFNT_ID_CP950 136 +#define FT_WinFNT_ID_CP1253 161 +#define FT_WinFNT_ID_CP1254 162 +#define FT_WinFNT_ID_CP1258 163 +#define FT_WinFNT_ID_CP1255 177 +#define FT_WinFNT_ID_CP1256 178 +#define FT_WinFNT_ID_CP1257 186 +#define FT_WinFNT_ID_CP1251 204 +#define FT_WinFNT_ID_CP874 222 +#define FT_WinFNT_ID_CP1250 238 +#define FT_WinFNT_ID_OEM 255 + + + /************************************************************************** + * + * @struct: + * FT_WinFNT_HeaderRec + * + * @description: + * Windows FNT Header info. + */ + typedef struct FT_WinFNT_HeaderRec_ + { + FT_UShort version; + FT_ULong file_size; + FT_Byte copyright[60]; + FT_UShort file_type; + FT_UShort nominal_point_size; + FT_UShort vertical_resolution; + FT_UShort horizontal_resolution; + FT_UShort ascent; + FT_UShort internal_leading; + FT_UShort external_leading; + FT_Byte italic; + FT_Byte underline; + FT_Byte strike_out; + FT_UShort weight; + FT_Byte charset; + FT_UShort pixel_width; + FT_UShort pixel_height; + FT_Byte pitch_and_family; + FT_UShort avg_width; + FT_UShort max_width; + FT_Byte first_char; + FT_Byte last_char; + FT_Byte default_char; + FT_Byte break_char; + FT_UShort bytes_per_row; + FT_ULong device_offset; + FT_ULong face_name_offset; + FT_ULong bits_pointer; + FT_ULong bits_offset; + FT_Byte reserved; + FT_ULong flags; + FT_UShort A_space; + FT_UShort B_space; + FT_UShort C_space; + FT_UShort color_table_offset; + FT_ULong reserved1[4]; + + } FT_WinFNT_HeaderRec; + + + /************************************************************************** + * + * @struct: + * FT_WinFNT_Header + * + * @description: + * A handle to an @FT_WinFNT_HeaderRec structure. + */ + typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header; + + + /************************************************************************** + * + * @function: + * FT_Get_WinFNT_Header + * + * @description: + * Retrieve a Windows FNT font info header. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * aheader :: + * The WinFNT header. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with Windows FNT faces, returning an error + * otherwise. + */ + FT_EXPORT( FT_Error ) + FT_Get_WinFNT_Header( FT_Face face, + FT_WinFNT_HeaderRec *aheader ); + + /* */ + + +FT_END_HEADER + +#endif /* FTWINFNT_H_ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/otsvg.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/otsvg.h new file mode 100644 index 0000000000000000000000000000000000000000..326bbcd01534bfa9195b9a60737bf8d8c13dce23 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/otsvg.h @@ -0,0 +1,336 @@ +/**************************************************************************** + * + * otsvg.h + * + * Interface for OT-SVG support related things (specification). + * + * Copyright (C) 2022-2025 by + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef OTSVG_H_ +#define OTSVG_H_ + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * svg_fonts + * + * @title: + * OpenType SVG Fonts + * + * @abstract: + * OT-SVG API between FreeType and an external SVG rendering library. + * + * @description: + * This section describes the four hooks necessary to render SVG + * 'documents' that are contained in an OpenType font's 'SVG~' table. + * + * For more information on the implementation, see our standard hooks + * based on 'librsvg' in the [FreeType Demo + * Programs](https://gitlab.freedesktop.org/freetype/freetype-demos) + * repository. + * + */ + + + /************************************************************************** + * + * @functype: + * SVG_Lib_Init_Func + * + * @description: + * A callback that is called when the first OT-SVG glyph is rendered in + * the lifetime of an @FT_Library object. In a typical implementation, + * one would want to allocate a structure and point the `data_pointer` + * to it and perform any library initializations that might be needed. + * + * @inout: + * data_pointer :: + * The SVG rendering module stores a pointer variable that can be used + * by clients to store any data that needs to be shared across + * different hooks. `data_pointer` is essentially a pointer to that + * pointer such that it can be written to as well as read from. + * + * @return: + * FreeType error code. 0 means success. + * + * @since: + * 2.12 + */ + typedef FT_Error + (*SVG_Lib_Init_Func)( FT_Pointer *data_pointer ); + + + /************************************************************************** + * + * @functype: + * SVG_Lib_Free_Func + * + * @description: + * A callback that is called when the `ot-svg` module is being freed. + * It is only called if the init hook was called earlier. This means + * that neither the init nor the free hook is called if no OT-SVG glyph + * is rendered. + * + * In a typical implementation, one would want to free any state + * structure that was allocated in the init hook and perform any + * library-related closure that might be needed. + * + * @inout: + * data_pointer :: + * The SVG rendering module stores a pointer variable that can be used + * by clients to store any data that needs to be shared across + * different hooks. `data_pointer` is essentially a pointer to that + * pointer such that it can be written to as well as read from. + * + * @since: + * 2.12 + */ + typedef void + (*SVG_Lib_Free_Func)( FT_Pointer *data_pointer ); + + + /************************************************************************** + * + * @functype: + * SVG_Lib_Render_Func + * + * @description: + * A callback that is called to render an OT-SVG glyph. This callback + * hook is called right after the preset hook @SVG_Lib_Preset_Slot_Func + * has been called with `cache` set to `TRUE`. The data necessary to + * render is available through the handle @FT_SVG_Document, which is set + * in the `other` field of @FT_GlyphSlotRec. + * + * The render hook is expected to render the SVG glyph to the bitmap + * buffer that is allocated already at `slot->bitmap.buffer`. It also + * sets the `num_grays` value as well as `slot->format`. + * + * @input: + * slot :: + * The slot to render. + * + * @inout: + * data_pointer :: + * The SVG rendering module stores a pointer variable that can be used + * by clients to store any data that needs to be shared across + * different hooks. `data_pointer` is essentially a pointer to that + * pointer such that it can be written to as well as read from. + * + * @return: + * FreeType error code. 0 means success. + * + * @since: + * 2.12 + */ + typedef FT_Error + (*SVG_Lib_Render_Func)( FT_GlyphSlot slot, + FT_Pointer *data_pointer ); + + + /************************************************************************** + * + * @functype: + * SVG_Lib_Preset_Slot_Func + * + * @description: + * A callback that is called to preset the glyph slot. It is called from + * two places. + * + * 1. When `FT_Load_Glyph` needs to preset the glyph slot. + * + * 2. Right before the `svg` module calls the render callback hook. + * + * When it is the former, the argument `cache` is set to `FALSE`. When + * it is the latter, the argument `cache` is set to `TRUE`. This + * distinction has been made because many calculations that are necessary + * for presetting a glyph slot are the same needed later for the render + * callback hook. Thus, if `cache` is `TRUE`, the hook can _cache_ those + * calculations in a memory block referenced by the state pointer. + * + * This hook is expected to preset the slot by setting parameters such as + * `bitmap_left`, `bitmap_top`, `width`, `rows`, `pitch`, and + * `pixel_mode`. It is also expected to set all the metrics for the slot + * including the vertical advance if it is not already set. Typically, + * fonts have horizontal advances but not vertical ones. If those are + * available, they had already been set, otherwise they have to be + * estimated and set manually. The hook must take into account the + * transformations that have been set, and translate the transformation + * matrices into the SVG coordinate system, as the original matrix is + * intended for the TTF/CFF coordinate system. + * + * @input: + * slot :: + * The glyph slot that has the SVG document loaded. + * + * cache :: + * See description. + * + * @inout: + * data_pointer :: + * The SVG rendering module stores a pointer variable that can be used + * by clients to store any data that needs to be shared across + * different hooks. `data_pointer` is essentially a pointer to that + * pointer such that it can be written to as well as read from. + * + * @return: + * FreeType error code. 0 means success. + * + * @since: + * 2.12 + */ + typedef FT_Error + (*SVG_Lib_Preset_Slot_Func)( FT_GlyphSlot slot, + FT_Bool cache, + FT_Pointer *state ); + + + /************************************************************************** + * + * @struct: + * SVG_RendererHooks + * + * @description: + * A structure that stores the four hooks needed to render OT-SVG glyphs + * properly. The structure is publicly used to set the hooks via the + * @svg-hooks driver property. + * + * The behavior of each hook is described in its documentation. One + * thing to note is that the preset hook and the render hook often need + * to do the same operations; therefore, it's better to cache the + * intermediate data in a state structure to avoid calculating it twice. + * For example, in the preset hook one can draw the glyph on a recorder + * surface and later create a bitmap surface from it in the render hook. + * + * All four hooks must be non-NULL. + * + * @fields: + * init_svg :: + * The initialization hook. + * + * free_svg :: + * The cleanup hook. + * + * render_hook :: + * The render hook. + * + * preset_slot :: + * The preset hook. + * + * @since: + * 2.12 + */ + typedef struct SVG_RendererHooks_ + { + SVG_Lib_Init_Func init_svg; + SVG_Lib_Free_Func free_svg; + SVG_Lib_Render_Func render_svg; + + SVG_Lib_Preset_Slot_Func preset_slot; + + } SVG_RendererHooks; + + + /************************************************************************** + * + * @struct: + * FT_SVG_DocumentRec + * + * @description: + * A structure that models one SVG document. + * + * @fields: + * svg_document :: + * A pointer to the SVG document. + * + * svg_document_length :: + * The length of `svg_document`. + * + * metrics :: + * A metrics object storing the size information. + * + * units_per_EM :: + * The size of the EM square. + * + * start_glyph_id :: + * The first glyph ID in the glyph range covered by this document. + * + * end_glyph_id :: + * The last glyph ID in the glyph range covered by this document. + * + * transform :: + * A 2x2 transformation matrix to apply to the glyph while rendering + * it. + * + * delta :: + * The translation to apply to the glyph while rendering. + * + * @note: + * When an @FT_GlyphSlot object `slot` is passed down to a renderer, the + * renderer can only access the `metrics` and `units_per_EM` fields via + * `slot->face`. However, when @FT_Glyph_To_Bitmap sets up a dummy + * object, it has no way to set a `face` object. Thus, metrics + * information and `units_per_EM` (which is necessary for OT-SVG) has to + * be stored separately. + * + * @since: + * 2.12 + */ + typedef struct FT_SVG_DocumentRec_ + { + FT_Byte* svg_document; + FT_ULong svg_document_length; + + FT_Size_Metrics metrics; + FT_UShort units_per_EM; + + FT_UShort start_glyph_id; + FT_UShort end_glyph_id; + + FT_Matrix transform; + FT_Vector delta; + + } FT_SVG_DocumentRec; + + + /************************************************************************** + * + * @type: + * FT_SVG_Document + * + * @description: + * A handle to an @FT_SVG_DocumentRec object. + * + * @since: + * 2.12 + */ + typedef struct FT_SVG_DocumentRec_* FT_SVG_Document; + + +FT_END_HEADER + +#endif /* OTSVG_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/t1tables.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/t1tables.h new file mode 100644 index 0000000000000000000000000000000000000000..fe769f607faa1836f5438a9429792ee6dcb35d19 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/t1tables.h @@ -0,0 +1,735 @@ +/**************************************************************************** + * + * t1tables.h + * + * Basic Type 1/Type 2 tables definitions and interface (specification + * only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef T1TABLES_H_ +#define T1TABLES_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * type1_tables + * + * @title: + * Type 1 Tables + * + * @abstract: + * Type~1-specific font tables. + * + * @description: + * This section contains the definition of Type~1-specific tables, + * including structures related to other PostScript font formats. + * + * @order: + * PS_FontInfoRec + * PS_FontInfo + * PS_PrivateRec + * PS_Private + * + * CID_FaceDictRec + * CID_FaceDict + * CID_FaceInfoRec + * CID_FaceInfo + * + * FT_Has_PS_Glyph_Names + * FT_Get_PS_Font_Info + * FT_Get_PS_Font_Private + * FT_Get_PS_Font_Value + * + * T1_Blend_Flags + * T1_EncodingType + * PS_Dict_Keys + * + */ + + + /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ + /* structures in order to support Multiple Master fonts. */ + + + /************************************************************************** + * + * @struct: + * PS_FontInfoRec + * + * @description: + * A structure used to model a Type~1 or Type~2 FontInfo dictionary. + * Note that for Multiple Master fonts, each instance has its own + * FontInfo dictionary. + */ + typedef struct PS_FontInfoRec_ + { + FT_String* version; + FT_String* notice; + FT_String* full_name; + FT_String* family_name; + FT_String* weight; + FT_Fixed italic_angle; + FT_Bool is_fixed_pitch; + FT_Short underline_position; + FT_UShort underline_thickness; + + } PS_FontInfoRec; + + + /************************************************************************** + * + * @struct: + * PS_FontInfo + * + * @description: + * A handle to a @PS_FontInfoRec structure. + */ + typedef struct PS_FontInfoRec_* PS_FontInfo; + + + /************************************************************************** + * + * @struct: + * T1_FontInfo + * + * @description: + * This type is equivalent to @PS_FontInfoRec. It is deprecated but kept + * to maintain source compatibility between various versions of FreeType. + */ + typedef PS_FontInfoRec T1_FontInfo; + + + /************************************************************************** + * + * @struct: + * PS_PrivateRec + * + * @description: + * A structure used to model a Type~1 or Type~2 private dictionary. Note + * that for Multiple Master fonts, each instance has its own Private + * dictionary. + */ + typedef struct PS_PrivateRec_ + { + FT_Int unique_id; + FT_Int lenIV; + + FT_Byte num_blue_values; + FT_Byte num_other_blues; + FT_Byte num_family_blues; + FT_Byte num_family_other_blues; + + FT_Short blue_values[14]; + FT_Short other_blues[10]; + + FT_Short family_blues [14]; + FT_Short family_other_blues[10]; + + FT_Fixed blue_scale; + FT_Int blue_shift; + FT_Int blue_fuzz; + + FT_UShort standard_width[1]; + FT_UShort standard_height[1]; + + FT_Byte num_snap_widths; + FT_Byte num_snap_heights; + FT_Bool force_bold; + FT_Bool round_stem_up; + + FT_Short snap_widths [13]; /* including std width */ + FT_Short snap_heights[13]; /* including std height */ + + FT_Fixed expansion_factor; + + FT_Long language_group; + FT_Long password; + + FT_Short min_feature[2]; + + } PS_PrivateRec; + + + /************************************************************************** + * + * @struct: + * PS_Private + * + * @description: + * A handle to a @PS_PrivateRec structure. + */ + typedef struct PS_PrivateRec_* PS_Private; + + + /************************************************************************** + * + * @struct: + * T1_Private + * + * @description: + * This type is equivalent to @PS_PrivateRec. It is deprecated but kept + * to maintain source compatibility between various versions of FreeType. + */ + typedef PS_PrivateRec T1_Private; + + + /************************************************************************** + * + * @enum: + * T1_Blend_Flags + * + * @description: + * A set of flags used to indicate which fields are present in a given + * blend dictionary (font info or private). Used to support Multiple + * Masters fonts. + * + * @values: + * T1_BLEND_UNDERLINE_POSITION :: + * T1_BLEND_UNDERLINE_THICKNESS :: + * T1_BLEND_ITALIC_ANGLE :: + * T1_BLEND_BLUE_VALUES :: + * T1_BLEND_OTHER_BLUES :: + * T1_BLEND_STANDARD_WIDTH :: + * T1_BLEND_STANDARD_HEIGHT :: + * T1_BLEND_STEM_SNAP_WIDTHS :: + * T1_BLEND_STEM_SNAP_HEIGHTS :: + * T1_BLEND_BLUE_SCALE :: + * T1_BLEND_BLUE_SHIFT :: + * T1_BLEND_FAMILY_BLUES :: + * T1_BLEND_FAMILY_OTHER_BLUES :: + * T1_BLEND_FORCE_BOLD :: + */ + typedef enum T1_Blend_Flags_ + { + /* required fields in a FontInfo blend dictionary */ + T1_BLEND_UNDERLINE_POSITION = 0, + T1_BLEND_UNDERLINE_THICKNESS, + T1_BLEND_ITALIC_ANGLE, + + /* required fields in a Private blend dictionary */ + T1_BLEND_BLUE_VALUES, + T1_BLEND_OTHER_BLUES, + T1_BLEND_STANDARD_WIDTH, + T1_BLEND_STANDARD_HEIGHT, + T1_BLEND_STEM_SNAP_WIDTHS, + T1_BLEND_STEM_SNAP_HEIGHTS, + T1_BLEND_BLUE_SCALE, + T1_BLEND_BLUE_SHIFT, + T1_BLEND_FAMILY_BLUES, + T1_BLEND_FAMILY_OTHER_BLUES, + T1_BLEND_FORCE_BOLD, + + T1_BLEND_MAX /* do not remove */ + + } T1_Blend_Flags; + + + /* these constants are deprecated; use the corresponding */ + /* `T1_Blend_Flags` values instead */ +#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION +#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS +#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE +#define t1_blend_blue_values T1_BLEND_BLUE_VALUES +#define t1_blend_other_blues T1_BLEND_OTHER_BLUES +#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH +#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT +#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS +#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS +#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE +#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT +#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES +#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES +#define t1_blend_force_bold T1_BLEND_FORCE_BOLD +#define t1_blend_max T1_BLEND_MAX + + /* */ + + + /************************************************************************** + * + * @struct: + * CID_FaceDictRec + * + * @description: + * A structure used to represent data in a CID top-level dictionary. In + * most cases, they are part of the font's '/FDArray' array. Within a + * CID font file, such (internal) subfont dictionaries are enclosed by + * '%ADOBeginFontDict' and '%ADOEndFontDict' comments. + * + * Note that `CID_FaceDictRec` misses a field for the '/FontName' + * keyword, specifying the subfont's name (the top-level font name is + * given by the '/CIDFontName' keyword). This is an oversight, but it + * doesn't limit the 'cid' font module's functionality because FreeType + * neither needs this entry nor gives access to CID subfonts. + */ + typedef struct CID_FaceDictRec_ + { + PS_PrivateRec private_dict; + + FT_UInt len_buildchar; + FT_Fixed forcebold_threshold; + FT_Pos stroke_width; + FT_Fixed expansion_factor; /* this is a duplicate of */ + /* `private_dict->expansion_factor' */ + FT_Byte paint_type; + FT_Byte font_type; + FT_Matrix font_matrix; + FT_Vector font_offset; + + FT_UInt num_subrs; + FT_ULong subrmap_offset; + FT_UInt sd_bytes; + + } CID_FaceDictRec; + + + /************************************************************************** + * + * @struct: + * CID_FaceDict + * + * @description: + * A handle to a @CID_FaceDictRec structure. + */ + typedef struct CID_FaceDictRec_* CID_FaceDict; + + + /************************************************************************** + * + * @struct: + * CID_FontDict + * + * @description: + * This type is equivalent to @CID_FaceDictRec. It is deprecated but + * kept to maintain source compatibility between various versions of + * FreeType. + */ + typedef CID_FaceDictRec CID_FontDict; + + + /************************************************************************** + * + * @struct: + * CID_FaceInfoRec + * + * @description: + * A structure used to represent CID Face information. + */ + typedef struct CID_FaceInfoRec_ + { + FT_String* cid_font_name; + FT_Fixed cid_version; + FT_Int cid_font_type; + + FT_String* registry; + FT_String* ordering; + FT_Int supplement; + + PS_FontInfoRec font_info; + FT_BBox font_bbox; + FT_ULong uid_base; + + FT_Int num_xuid; + FT_ULong xuid[16]; + + FT_ULong cidmap_offset; + FT_UInt fd_bytes; + FT_UInt gd_bytes; + FT_ULong cid_count; + + FT_UInt num_dicts; + CID_FaceDict font_dicts; + + FT_ULong data_offset; + + } CID_FaceInfoRec; + + + /************************************************************************** + * + * @struct: + * CID_FaceInfo + * + * @description: + * A handle to a @CID_FaceInfoRec structure. + */ + typedef struct CID_FaceInfoRec_* CID_FaceInfo; + + + /************************************************************************** + * + * @struct: + * CID_Info + * + * @description: + * This type is equivalent to @CID_FaceInfoRec. It is deprecated but kept + * to maintain source compatibility between various versions of FreeType. + */ + typedef CID_FaceInfoRec CID_Info; + + + /************************************************************************** + * + * @function: + * FT_Has_PS_Glyph_Names + * + * @description: + * Return true if a given face provides reliable PostScript glyph names. + * This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that + * certain fonts (mostly TrueType) contain incorrect glyph name tables. + * + * When this function returns true, the caller is sure that the glyph + * names returned by @FT_Get_Glyph_Name are reliable. + * + * @input: + * face :: + * face handle + * + * @return: + * Boolean. True if glyph names are reliable. + * + */ + FT_EXPORT( FT_Int ) + FT_Has_PS_Glyph_Names( FT_Face face ); + + + /************************************************************************** + * + * @function: + * FT_Get_PS_Font_Info + * + * @description: + * Retrieve the @PS_FontInfoRec structure corresponding to a given + * PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * @output: + * afont_info :: + * A pointer to a @PS_FontInfoRec object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * String pointers within the @PS_FontInfoRec structure are owned by the + * face and don't need to be freed by the caller. Missing entries in the + * font's FontInfo dictionary are represented by `NULL` pointers. + * + * The following font formats support this feature: 'Type~1', 'Type~42', + * 'CFF', 'CID~Type~1'. For other font formats this function returns the + * `FT_Err_Invalid_Argument` error code. + * + * @example: + * ``` + * PS_FontInfoRec font_info; + * + * + * error = FT_Get_PS_Font_Info( face, &font_info ); + * ... + * ``` + * + */ + FT_EXPORT( FT_Error ) + FT_Get_PS_Font_Info( FT_Face face, + PS_FontInfo afont_info ); + + + /************************************************************************** + * + * @function: + * FT_Get_PS_Font_Private + * + * @description: + * Retrieve the @PS_PrivateRec structure corresponding to a given + * PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * @output: + * afont_private :: + * A pointer to a @PS_PrivateRec object. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The string pointers within the @PS_PrivateRec structure are owned by + * the face and don't need to be freed by the caller. + * + * Only the 'Type~1' font format supports this feature. For other font + * formats this function returns the `FT_Err_Invalid_Argument` error + * code. + * + * @example: + * ``` + * PS_PrivateRec font_private; + * + * + * error = FT_Get_PS_Font_Private( face, &font_private ); + * ... + * ``` + * + */ + FT_EXPORT( FT_Error ) + FT_Get_PS_Font_Private( FT_Face face, + PS_Private afont_private ); + + + /************************************************************************** + * + * @enum: + * T1_EncodingType + * + * @description: + * An enumeration describing the 'Encoding' entry in a Type 1 dictionary. + * + * @values: + * T1_ENCODING_TYPE_NONE :: + * T1_ENCODING_TYPE_ARRAY :: + * T1_ENCODING_TYPE_STANDARD :: + * T1_ENCODING_TYPE_ISOLATIN1 :: + * T1_ENCODING_TYPE_EXPERT :: + * + * @since: + * 2.4.8 + */ + typedef enum T1_EncodingType_ + { + T1_ENCODING_TYPE_NONE = 0, + T1_ENCODING_TYPE_ARRAY, + T1_ENCODING_TYPE_STANDARD, + T1_ENCODING_TYPE_ISOLATIN1, + T1_ENCODING_TYPE_EXPERT + + } T1_EncodingType; + + + /************************************************************************** + * + * @enum: + * PS_Dict_Keys + * + * @description: + * An enumeration used in calls to @FT_Get_PS_Font_Value to identify the + * Type~1 dictionary entry to retrieve. + * + * @values: + * PS_DICT_FONT_TYPE :: + * PS_DICT_FONT_MATRIX :: + * PS_DICT_FONT_BBOX :: + * PS_DICT_PAINT_TYPE :: + * PS_DICT_FONT_NAME :: + * PS_DICT_UNIQUE_ID :: + * PS_DICT_NUM_CHAR_STRINGS :: + * PS_DICT_CHAR_STRING_KEY :: + * PS_DICT_CHAR_STRING :: + * PS_DICT_ENCODING_TYPE :: + * PS_DICT_ENCODING_ENTRY :: + * PS_DICT_NUM_SUBRS :: + * PS_DICT_SUBR :: + * PS_DICT_STD_HW :: + * PS_DICT_STD_VW :: + * PS_DICT_NUM_BLUE_VALUES :: + * PS_DICT_BLUE_VALUE :: + * PS_DICT_BLUE_FUZZ :: + * PS_DICT_NUM_OTHER_BLUES :: + * PS_DICT_OTHER_BLUE :: + * PS_DICT_NUM_FAMILY_BLUES :: + * PS_DICT_FAMILY_BLUE :: + * PS_DICT_NUM_FAMILY_OTHER_BLUES :: + * PS_DICT_FAMILY_OTHER_BLUE :: + * PS_DICT_BLUE_SCALE :: + * PS_DICT_BLUE_SHIFT :: + * PS_DICT_NUM_STEM_SNAP_H :: + * PS_DICT_STEM_SNAP_H :: + * PS_DICT_NUM_STEM_SNAP_V :: + * PS_DICT_STEM_SNAP_V :: + * PS_DICT_FORCE_BOLD :: + * PS_DICT_RND_STEM_UP :: + * PS_DICT_MIN_FEATURE :: + * PS_DICT_LEN_IV :: + * PS_DICT_PASSWORD :: + * PS_DICT_LANGUAGE_GROUP :: + * PS_DICT_VERSION :: + * PS_DICT_NOTICE :: + * PS_DICT_FULL_NAME :: + * PS_DICT_FAMILY_NAME :: + * PS_DICT_WEIGHT :: + * PS_DICT_IS_FIXED_PITCH :: + * PS_DICT_UNDERLINE_POSITION :: + * PS_DICT_UNDERLINE_THICKNESS :: + * PS_DICT_FS_TYPE :: + * PS_DICT_ITALIC_ANGLE :: + * + * @since: + * 2.4.8 + */ + typedef enum PS_Dict_Keys_ + { + /* conventionally in the font dictionary */ + PS_DICT_FONT_TYPE, /* FT_Byte */ + PS_DICT_FONT_MATRIX, /* FT_Fixed */ + PS_DICT_FONT_BBOX, /* FT_Fixed */ + PS_DICT_PAINT_TYPE, /* FT_Byte */ + PS_DICT_FONT_NAME, /* FT_String* */ + PS_DICT_UNIQUE_ID, /* FT_Int */ + PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */ + PS_DICT_CHAR_STRING_KEY, /* FT_String* */ + PS_DICT_CHAR_STRING, /* FT_String* */ + PS_DICT_ENCODING_TYPE, /* T1_EncodingType */ + PS_DICT_ENCODING_ENTRY, /* FT_String* */ + + /* conventionally in the font Private dictionary */ + PS_DICT_NUM_SUBRS, /* FT_Int */ + PS_DICT_SUBR, /* FT_String* */ + PS_DICT_STD_HW, /* FT_UShort */ + PS_DICT_STD_VW, /* FT_UShort */ + PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */ + PS_DICT_BLUE_VALUE, /* FT_Short */ + PS_DICT_BLUE_FUZZ, /* FT_Int */ + PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */ + PS_DICT_OTHER_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */ + PS_DICT_BLUE_SCALE, /* FT_Fixed */ + PS_DICT_BLUE_SHIFT, /* FT_Int */ + PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */ + PS_DICT_STEM_SNAP_H, /* FT_Short */ + PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */ + PS_DICT_STEM_SNAP_V, /* FT_Short */ + PS_DICT_FORCE_BOLD, /* FT_Bool */ + PS_DICT_RND_STEM_UP, /* FT_Bool */ + PS_DICT_MIN_FEATURE, /* FT_Short */ + PS_DICT_LEN_IV, /* FT_Int */ + PS_DICT_PASSWORD, /* FT_Long */ + PS_DICT_LANGUAGE_GROUP, /* FT_Long */ + + /* conventionally in the font FontInfo dictionary */ + PS_DICT_VERSION, /* FT_String* */ + PS_DICT_NOTICE, /* FT_String* */ + PS_DICT_FULL_NAME, /* FT_String* */ + PS_DICT_FAMILY_NAME, /* FT_String* */ + PS_DICT_WEIGHT, /* FT_String* */ + PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ + PS_DICT_UNDERLINE_POSITION, /* FT_Short */ + PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ + PS_DICT_FS_TYPE, /* FT_UShort */ + PS_DICT_ITALIC_ANGLE, /* FT_Fixed */ + + PS_DICT_MAX = PS_DICT_ITALIC_ANGLE + + } PS_Dict_Keys; + + + /************************************************************************** + * + * @function: + * FT_Get_PS_Font_Value + * + * @description: + * Retrieve the value for the supplied key from a PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * key :: + * An enumeration value representing the dictionary key to retrieve. + * + * idx :: + * For array values, this specifies the index to be returned. + * + * value :: + * A pointer to memory into which to write the value. + * + * valen_len :: + * The size, in bytes, of the memory supplied for the value. + * + * @output: + * value :: + * The value matching the above key, if it exists. + * + * @return: + * The amount of memory (in bytes) required to hold the requested value + * (if it exists, -1 otherwise). + * + * @note: + * The values returned are not pointers into the internal structures of + * the face, but are 'fresh' copies, so that the memory containing them + * belongs to the calling application. This also enforces the + * 'read-only' nature of these values, i.e., this function cannot be + * used to manipulate the face. + * + * `value` is a void pointer because the values returned can be of + * various types. + * + * If either `value` is `NULL` or `value_len` is too small, just the + * required memory size for the requested entry is returned. + * + * The `idx` parameter is used, not only to retrieve elements of, for + * example, the FontMatrix or FontBBox, but also to retrieve name keys + * from the CharStrings dictionary, and the charstrings themselves. It + * is ignored for atomic values. + * + * `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000. To + * get the value as in the font stream, you need to divide by 65536000.0 + * (to remove the FT_Fixed scale, and the x1000 scale). + * + * IMPORTANT: Only key/value pairs read by the FreeType interpreter can + * be retrieved. So, for example, PostScript procedures such as NP, ND, + * and RD are not available. Arbitrary keys are, obviously, not be + * available either. + * + * If the font's format is not PostScript-based, this function returns + * the `FT_Err_Invalid_Argument` error code. + * + * @since: + * 2.4.8 + * + */ + FT_EXPORT( FT_Long ) + FT_Get_PS_Font_Value( FT_Face face, + PS_Dict_Keys key, + FT_UInt idx, + void *value, + FT_Long value_len ); + + /* */ + +FT_END_HEADER + +#endif /* T1TABLES_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/ttnameid.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ttnameid.h new file mode 100644 index 0000000000000000000000000000000000000000..3ef61091cc9683678e4596b941e5365ff0fdffef --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/ttnameid.h @@ -0,0 +1,1235 @@ +/**************************************************************************** + * + * ttnameid.h + * + * TrueType name ID definitions (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef TTNAMEID_H_ +#define TTNAMEID_H_ + + + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * truetype_tables + */ + + + /************************************************************************** + * + * Possible values for the 'platform' identifier code in the name records + * of an SFNT 'name' table. + * + */ + + + /************************************************************************** + * + * @enum: + * TT_PLATFORM_XXX + * + * @description: + * A list of valid values for the `platform_id` identifier code in + * @FT_CharMapRec and @FT_SfntName structures. + * + * @values: + * TT_PLATFORM_APPLE_UNICODE :: + * Used by Apple to indicate a Unicode character map and/or name entry. + * See @TT_APPLE_ID_XXX for corresponding `encoding_id` values. Note + * that name entries in this format are coded as big-endian UCS-2 + * character codes _only_. + * + * TT_PLATFORM_MACINTOSH :: + * Used by Apple to indicate a MacOS-specific charmap and/or name + * entry. See @TT_MAC_ID_XXX for corresponding `encoding_id` values. + * Note that most TrueType fonts contain an Apple roman charmap to be + * usable on MacOS systems (even if they contain a Microsoft charmap as + * well). + * + * TT_PLATFORM_ISO :: + * This value was used to specify ISO/IEC 10646 charmaps. It is + * however now deprecated. See @TT_ISO_ID_XXX for a list of + * corresponding `encoding_id` values. + * + * TT_PLATFORM_MICROSOFT :: + * Used by Microsoft to indicate Windows-specific charmaps. See + * @TT_MS_ID_XXX for a list of corresponding `encoding_id` values. + * Note that most fonts contain a Unicode charmap using + * (`TT_PLATFORM_MICROSOFT`, @TT_MS_ID_UNICODE_CS). + * + * TT_PLATFORM_CUSTOM :: + * Used to indicate application-specific charmaps. + * + * TT_PLATFORM_ADOBE :: + * This value isn't part of any font format specification, but is used + * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec + * structure. See @TT_ADOBE_ID_XXX. + */ + +#define TT_PLATFORM_APPLE_UNICODE 0 +#define TT_PLATFORM_MACINTOSH 1 +#define TT_PLATFORM_ISO 2 /* deprecated */ +#define TT_PLATFORM_MICROSOFT 3 +#define TT_PLATFORM_CUSTOM 4 +#define TT_PLATFORM_ADOBE 7 /* artificial */ + + + /************************************************************************** + * + * @enum: + * TT_APPLE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id` for + * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries. + * + * @values: + * TT_APPLE_ID_DEFAULT :: + * Unicode version 1.0. + * + * TT_APPLE_ID_UNICODE_1_1 :: + * Unicode 1.1; specifies Hangul characters starting at U+34xx. + * + * TT_APPLE_ID_ISO_10646 :: + * Deprecated (identical to preceding). + * + * TT_APPLE_ID_UNICODE_2_0 :: + * Unicode 2.0 and beyond (UTF-16 BMP only). + * + * TT_APPLE_ID_UNICODE_32 :: + * Unicode 3.1 and beyond, using UTF-32. + * + * TT_APPLE_ID_VARIANT_SELECTOR :: + * From Adobe, not Apple. Not a normal cmap. Specifies variations on + * a real cmap. + * + * TT_APPLE_ID_FULL_UNICODE :: + * Used for fallback fonts that provide complete Unicode coverage with + * a type~13 cmap. + */ + +#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */ +#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */ +#define TT_APPLE_ID_ISO_10646 2 /* deprecated */ +#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */ +#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */ +#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */ +#define TT_APPLE_ID_FULL_UNICODE 6 /* used with type 13 cmaps */ + + + /************************************************************************** + * + * @enum: + * TT_MAC_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id` for + * @TT_PLATFORM_MACINTOSH charmaps and name entries. + */ + +#define TT_MAC_ID_ROMAN 0 +#define TT_MAC_ID_JAPANESE 1 +#define TT_MAC_ID_TRADITIONAL_CHINESE 2 +#define TT_MAC_ID_KOREAN 3 +#define TT_MAC_ID_ARABIC 4 +#define TT_MAC_ID_HEBREW 5 +#define TT_MAC_ID_GREEK 6 +#define TT_MAC_ID_RUSSIAN 7 +#define TT_MAC_ID_RSYMBOL 8 +#define TT_MAC_ID_DEVANAGARI 9 +#define TT_MAC_ID_GURMUKHI 10 +#define TT_MAC_ID_GUJARATI 11 +#define TT_MAC_ID_ORIYA 12 +#define TT_MAC_ID_BENGALI 13 +#define TT_MAC_ID_TAMIL 14 +#define TT_MAC_ID_TELUGU 15 +#define TT_MAC_ID_KANNADA 16 +#define TT_MAC_ID_MALAYALAM 17 +#define TT_MAC_ID_SINHALESE 18 +#define TT_MAC_ID_BURMESE 19 +#define TT_MAC_ID_KHMER 20 +#define TT_MAC_ID_THAI 21 +#define TT_MAC_ID_LAOTIAN 22 +#define TT_MAC_ID_GEORGIAN 23 +#define TT_MAC_ID_ARMENIAN 24 +#define TT_MAC_ID_MALDIVIAN 25 +#define TT_MAC_ID_SIMPLIFIED_CHINESE 25 +#define TT_MAC_ID_TIBETAN 26 +#define TT_MAC_ID_MONGOLIAN 27 +#define TT_MAC_ID_GEEZ 28 +#define TT_MAC_ID_SLAVIC 29 +#define TT_MAC_ID_VIETNAMESE 30 +#define TT_MAC_ID_SINDHI 31 +#define TT_MAC_ID_UNINTERP 32 + + + /************************************************************************** + * + * @enum: + * TT_ISO_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id` for @TT_PLATFORM_ISO + * charmaps and name entries. + * + * Their use is now deprecated. + * + * @values: + * TT_ISO_ID_7BIT_ASCII :: + * ASCII. + * TT_ISO_ID_10646 :: + * ISO/10646. + * TT_ISO_ID_8859_1 :: + * Also known as Latin-1. + */ + +#define TT_ISO_ID_7BIT_ASCII 0 +#define TT_ISO_ID_10646 1 +#define TT_ISO_ID_8859_1 2 + + + /************************************************************************** + * + * @enum: + * TT_MS_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id` for + * @TT_PLATFORM_MICROSOFT charmaps and name entries. + * + * @values: + * TT_MS_ID_SYMBOL_CS :: + * Microsoft symbol encoding. See @FT_ENCODING_MS_SYMBOL. + * + * TT_MS_ID_UNICODE_CS :: + * Microsoft WGL4 charmap, matching Unicode. See @FT_ENCODING_UNICODE. + * + * TT_MS_ID_SJIS :: + * Shift JIS Japanese encoding. See @FT_ENCODING_SJIS. + * + * TT_MS_ID_PRC :: + * Chinese encodings as used in the People's Republic of China (PRC). + * This means the encodings GB~2312 and its supersets GBK and GB~18030. + * See @FT_ENCODING_PRC. + * + * TT_MS_ID_BIG_5 :: + * Traditional Chinese as used in Taiwan and Hong Kong. See + * @FT_ENCODING_BIG5. + * + * TT_MS_ID_WANSUNG :: + * Korean Extended Wansung encoding. See @FT_ENCODING_WANSUNG. + * + * TT_MS_ID_JOHAB :: + * Korean Johab encoding. See @FT_ENCODING_JOHAB. + * + * TT_MS_ID_UCS_4 :: + * UCS-4 or UTF-32 charmaps. This has been added to the OpenType + * specification version 1.4 (mid-2001). + */ + +#define TT_MS_ID_SYMBOL_CS 0 +#define TT_MS_ID_UNICODE_CS 1 +#define TT_MS_ID_SJIS 2 +#define TT_MS_ID_PRC 3 +#define TT_MS_ID_BIG_5 4 +#define TT_MS_ID_WANSUNG 5 +#define TT_MS_ID_JOHAB 6 +#define TT_MS_ID_UCS_4 10 + + /* this value is deprecated */ +#define TT_MS_ID_GB2312 TT_MS_ID_PRC + + + /************************************************************************** + * + * @enum: + * TT_ADOBE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id` for @TT_PLATFORM_ADOBE + * charmaps. This is a FreeType-specific extension! + * + * @values: + * TT_ADOBE_ID_STANDARD :: + * Adobe standard encoding. + * TT_ADOBE_ID_EXPERT :: + * Adobe expert encoding. + * TT_ADOBE_ID_CUSTOM :: + * Adobe custom encoding. + * TT_ADOBE_ID_LATIN_1 :: + * Adobe Latin~1 encoding. + */ + +#define TT_ADOBE_ID_STANDARD 0 +#define TT_ADOBE_ID_EXPERT 1 +#define TT_ADOBE_ID_CUSTOM 2 +#define TT_ADOBE_ID_LATIN_1 3 + + + /************************************************************************** + * + * @enum: + * TT_MAC_LANGID_XXX + * + * @description: + * Possible values of the language identifier field in the name records + * of the SFNT 'name' table if the 'platform' identifier code is + * @TT_PLATFORM_MACINTOSH. These values are also used as return values + * for function @FT_Get_CMap_Language_ID. + * + * The canonical source for Apple's IDs is + * + * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html + */ + +#define TT_MAC_LANGID_ENGLISH 0 +#define TT_MAC_LANGID_FRENCH 1 +#define TT_MAC_LANGID_GERMAN 2 +#define TT_MAC_LANGID_ITALIAN 3 +#define TT_MAC_LANGID_DUTCH 4 +#define TT_MAC_LANGID_SWEDISH 5 +#define TT_MAC_LANGID_SPANISH 6 +#define TT_MAC_LANGID_DANISH 7 +#define TT_MAC_LANGID_PORTUGUESE 8 +#define TT_MAC_LANGID_NORWEGIAN 9 +#define TT_MAC_LANGID_HEBREW 10 +#define TT_MAC_LANGID_JAPANESE 11 +#define TT_MAC_LANGID_ARABIC 12 +#define TT_MAC_LANGID_FINNISH 13 +#define TT_MAC_LANGID_GREEK 14 +#define TT_MAC_LANGID_ICELANDIC 15 +#define TT_MAC_LANGID_MALTESE 16 +#define TT_MAC_LANGID_TURKISH 17 +#define TT_MAC_LANGID_CROATIAN 18 +#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19 +#define TT_MAC_LANGID_URDU 20 +#define TT_MAC_LANGID_HINDI 21 +#define TT_MAC_LANGID_THAI 22 +#define TT_MAC_LANGID_KOREAN 23 +#define TT_MAC_LANGID_LITHUANIAN 24 +#define TT_MAC_LANGID_POLISH 25 +#define TT_MAC_LANGID_HUNGARIAN 26 +#define TT_MAC_LANGID_ESTONIAN 27 +#define TT_MAC_LANGID_LETTISH 28 +#define TT_MAC_LANGID_SAAMISK 29 +#define TT_MAC_LANGID_FAEROESE 30 +#define TT_MAC_LANGID_FARSI 31 +#define TT_MAC_LANGID_RUSSIAN 32 +#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33 +#define TT_MAC_LANGID_FLEMISH 34 +#define TT_MAC_LANGID_IRISH 35 +#define TT_MAC_LANGID_ALBANIAN 36 +#define TT_MAC_LANGID_ROMANIAN 37 +#define TT_MAC_LANGID_CZECH 38 +#define TT_MAC_LANGID_SLOVAK 39 +#define TT_MAC_LANGID_SLOVENIAN 40 +#define TT_MAC_LANGID_YIDDISH 41 +#define TT_MAC_LANGID_SERBIAN 42 +#define TT_MAC_LANGID_MACEDONIAN 43 +#define TT_MAC_LANGID_BULGARIAN 44 +#define TT_MAC_LANGID_UKRAINIAN 45 +#define TT_MAC_LANGID_BYELORUSSIAN 46 +#define TT_MAC_LANGID_UZBEK 47 +#define TT_MAC_LANGID_KAZAKH 48 +#define TT_MAC_LANGID_AZERBAIJANI 49 +#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49 +#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50 +#define TT_MAC_LANGID_ARMENIAN 51 +#define TT_MAC_LANGID_GEORGIAN 52 +#define TT_MAC_LANGID_MOLDAVIAN 53 +#define TT_MAC_LANGID_KIRGHIZ 54 +#define TT_MAC_LANGID_TAJIKI 55 +#define TT_MAC_LANGID_TURKMEN 56 +#define TT_MAC_LANGID_MONGOLIAN 57 +#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57 +#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58 +#define TT_MAC_LANGID_PASHTO 59 +#define TT_MAC_LANGID_KURDISH 60 +#define TT_MAC_LANGID_KASHMIRI 61 +#define TT_MAC_LANGID_SINDHI 62 +#define TT_MAC_LANGID_TIBETAN 63 +#define TT_MAC_LANGID_NEPALI 64 +#define TT_MAC_LANGID_SANSKRIT 65 +#define TT_MAC_LANGID_MARATHI 66 +#define TT_MAC_LANGID_BENGALI 67 +#define TT_MAC_LANGID_ASSAMESE 68 +#define TT_MAC_LANGID_GUJARATI 69 +#define TT_MAC_LANGID_PUNJABI 70 +#define TT_MAC_LANGID_ORIYA 71 +#define TT_MAC_LANGID_MALAYALAM 72 +#define TT_MAC_LANGID_KANNADA 73 +#define TT_MAC_LANGID_TAMIL 74 +#define TT_MAC_LANGID_TELUGU 75 +#define TT_MAC_LANGID_SINHALESE 76 +#define TT_MAC_LANGID_BURMESE 77 +#define TT_MAC_LANGID_KHMER 78 +#define TT_MAC_LANGID_LAO 79 +#define TT_MAC_LANGID_VIETNAMESE 80 +#define TT_MAC_LANGID_INDONESIAN 81 +#define TT_MAC_LANGID_TAGALOG 82 +#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83 +#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84 +#define TT_MAC_LANGID_AMHARIC 85 +#define TT_MAC_LANGID_TIGRINYA 86 +#define TT_MAC_LANGID_GALLA 87 +#define TT_MAC_LANGID_SOMALI 88 +#define TT_MAC_LANGID_SWAHILI 89 +#define TT_MAC_LANGID_RUANDA 90 +#define TT_MAC_LANGID_RUNDI 91 +#define TT_MAC_LANGID_CHEWA 92 +#define TT_MAC_LANGID_MALAGASY 93 +#define TT_MAC_LANGID_ESPERANTO 94 +#define TT_MAC_LANGID_WELSH 128 +#define TT_MAC_LANGID_BASQUE 129 +#define TT_MAC_LANGID_CATALAN 130 +#define TT_MAC_LANGID_LATIN 131 +#define TT_MAC_LANGID_QUECHUA 132 +#define TT_MAC_LANGID_GUARANI 133 +#define TT_MAC_LANGID_AYMARA 134 +#define TT_MAC_LANGID_TATAR 135 +#define TT_MAC_LANGID_UIGHUR 136 +#define TT_MAC_LANGID_DZONGKHA 137 +#define TT_MAC_LANGID_JAVANESE 138 +#define TT_MAC_LANGID_SUNDANESE 139 + + /* The following codes are new as of 2000-03-10 */ +#define TT_MAC_LANGID_GALICIAN 140 +#define TT_MAC_LANGID_AFRIKAANS 141 +#define TT_MAC_LANGID_BRETON 142 +#define TT_MAC_LANGID_INUKTITUT 143 +#define TT_MAC_LANGID_SCOTTISH_GAELIC 144 +#define TT_MAC_LANGID_MANX_GAELIC 145 +#define TT_MAC_LANGID_IRISH_GAELIC 146 +#define TT_MAC_LANGID_TONGAN 147 +#define TT_MAC_LANGID_GREEK_POLYTONIC 148 +#define TT_MAC_LANGID_GREELANDIC 149 +#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150 + + + /************************************************************************** + * + * @enum: + * TT_MS_LANGID_XXX + * + * @description: + * Possible values of the language identifier field in the name records + * of the SFNT 'name' table if the 'platform' identifier code is + * @TT_PLATFORM_MICROSOFT. These values are also used as return values + * for function @FT_Get_CMap_Language_ID. + * + * The canonical source for Microsoft's IDs is + * + * https://learn.microsoft.com/windows/win32/intl/language-identifier-constants-and-strings , + * + * however, we only provide macros for language identifiers present in + * the OpenType specification: Microsoft has abandoned the concept of + * LCIDs (language code identifiers), and format~1 of the 'name' table + * provides a better mechanism for languages not covered here. + * + * More legacy values not listed in the reference can be found in the + * @FT_TRUETYPE_IDS_H header file. + */ + +#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 +#define TT_MS_LANGID_ARABIC_IRAQ 0x0801 +#define TT_MS_LANGID_ARABIC_EGYPT 0x0C01 +#define TT_MS_LANGID_ARABIC_LIBYA 0x1001 +#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401 +#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801 +#define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01 +#define TT_MS_LANGID_ARABIC_OMAN 0x2001 +#define TT_MS_LANGID_ARABIC_YEMEN 0x2401 +#define TT_MS_LANGID_ARABIC_SYRIA 0x2801 +#define TT_MS_LANGID_ARABIC_JORDAN 0x2C01 +#define TT_MS_LANGID_ARABIC_LEBANON 0x3001 +#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401 +#define TT_MS_LANGID_ARABIC_UAE 0x3801 +#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01 +#define TT_MS_LANGID_ARABIC_QATAR 0x4001 +#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 +#define TT_MS_LANGID_CATALAN_CATALAN 0x0403 +#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 +#define TT_MS_LANGID_CHINESE_PRC 0x0804 +#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04 +#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 +#define TT_MS_LANGID_CHINESE_MACAO 0x1404 +#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 +#define TT_MS_LANGID_DANISH_DENMARK 0x0406 +#define TT_MS_LANGID_GERMAN_GERMANY 0x0407 +#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807 +#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07 +#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 +#define TT_MS_LANGID_GERMAN_LIECHTENSTEIN 0x1407 +#define TT_MS_LANGID_GREEK_GREECE 0x0408 +#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 +#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 +#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09 +#define TT_MS_LANGID_ENGLISH_CANADA 0x1009 +#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409 +#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809 +#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09 +#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009 +#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409 +#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809 +#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09 +#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 +#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 +#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 +#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 +#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 +#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A +#define TT_MS_LANGID_SPANISH_MEXICO 0x080A +#define TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT 0x0C0A +#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A +#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A +#define TT_MS_LANGID_SPANISH_PANAMA 0x180A +#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A +#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A +#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A +#define TT_MS_LANGID_SPANISH_PERU 0x280A +#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A +#define TT_MS_LANGID_SPANISH_ECUADOR 0x300A +#define TT_MS_LANGID_SPANISH_CHILE 0x340A +#define TT_MS_LANGID_SPANISH_URUGUAY 0x380A +#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A +#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A +#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A +#define TT_MS_LANGID_SPANISH_HONDURAS 0x480A +#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A +#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A +#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A +#define TT_MS_LANGID_FINNISH_FINLAND 0x040B +#define TT_MS_LANGID_FRENCH_FRANCE 0x040C +#define TT_MS_LANGID_FRENCH_BELGIUM 0x080C +#define TT_MS_LANGID_FRENCH_CANADA 0x0C0C +#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C +#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C +#define TT_MS_LANGID_FRENCH_MONACO 0x180C +#define TT_MS_LANGID_HEBREW_ISRAEL 0x040D +#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E +#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F +#define TT_MS_LANGID_ITALIAN_ITALY 0x0410 +#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810 +#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411 +#define TT_MS_LANGID_KOREAN_KOREA 0x0412 +#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413 +#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814 +#define TT_MS_LANGID_POLISH_POLAND 0x0415 +#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416 +#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816 +#define TT_MS_LANGID_ROMANSH_SWITZERLAND 0x0417 +#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418 +#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419 +#define TT_MS_LANGID_CROATIAN_CROATIA 0x041A +#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A +#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A +#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x1C1A +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC 0x201A +#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B +#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C +#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D +#define TT_MS_LANGID_SWEDISH_FINLAND 0x081D +#define TT_MS_LANGID_THAI_THAILAND 0x041E +#define TT_MS_LANGID_TURKISH_TURKEY 0x041F +#define TT_MS_LANGID_URDU_PAKISTAN 0x0420 +#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 +#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 +#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 +#define TT_MS_LANGID_SLOVENIAN_SLOVENIA 0x0424 +#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425 +#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 +#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 +#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 +#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A +#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B +#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C +#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C +#define TT_MS_LANGID_BASQUE_BASQUE 0x042D +#define TT_MS_LANGID_UPPER_SORBIAN_GERMANY 0x042E +#define TT_MS_LANGID_LOWER_SORBIAN_GERMANY 0x082E +#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F +#define TT_MS_LANGID_SETSWANA_SOUTH_AFRICA 0x0432 +#define TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA 0x0434 +#define TT_MS_LANGID_ISIZULU_SOUTH_AFRICA 0x0435 +#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436 +#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437 +#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 +#define TT_MS_LANGID_HINDI_INDIA 0x0439 +#define TT_MS_LANGID_MALTESE_MALTA 0x043A +#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B +#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B +#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B +#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B +#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B +#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B +#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B +#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B +#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B +#define TT_MS_LANGID_IRISH_IRELAND 0x083C +#define TT_MS_LANGID_MALAY_MALAYSIA 0x043E +#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E +#define TT_MS_LANGID_KAZAKH_KAZAKHSTAN 0x043F +#define TT_MS_LANGID_KYRGYZ_KYRGYZSTAN /* Cyrillic */ 0x0440 +#define TT_MS_LANGID_KISWAHILI_KENYA 0x0441 +#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 +#define TT_MS_LANGID_TATAR_RUSSIA 0x0444 +#define TT_MS_LANGID_BENGALI_INDIA 0x0445 +#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 +#define TT_MS_LANGID_PUNJABI_INDIA 0x0446 +#define TT_MS_LANGID_GUJARATI_INDIA 0x0447 +#define TT_MS_LANGID_ODIA_INDIA 0x0448 +#define TT_MS_LANGID_TAMIL_INDIA 0x0449 +#define TT_MS_LANGID_TELUGU_INDIA 0x044A +#define TT_MS_LANGID_KANNADA_INDIA 0x044B +#define TT_MS_LANGID_MALAYALAM_INDIA 0x044C +#define TT_MS_LANGID_ASSAMESE_INDIA 0x044D +#define TT_MS_LANGID_MARATHI_INDIA 0x044E +#define TT_MS_LANGID_SANSKRIT_INDIA 0x044F +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 +#define TT_MS_LANGID_MONGOLIAN_PRC 0x0850 +#define TT_MS_LANGID_TIBETAN_PRC 0x0451 +#define TT_MS_LANGID_WELSH_UNITED_KINGDOM 0x0452 +#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 +#define TT_MS_LANGID_LAO_LAOS 0x0454 +#define TT_MS_LANGID_GALICIAN_GALICIAN 0x0456 +#define TT_MS_LANGID_KONKANI_INDIA 0x0457 +#define TT_MS_LANGID_SYRIAC_SYRIA 0x045A +#define TT_MS_LANGID_SINHALA_SRI_LANKA 0x045B +#define TT_MS_LANGID_INUKTITUT_CANADA 0x045D +#define TT_MS_LANGID_INUKTITUT_CANADA_LATIN 0x085D +#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E +#define TT_MS_LANGID_TAMAZIGHT_ALGERIA 0x085F +#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 +#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 +#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 +#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 +#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 +#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 +#define TT_MS_LANGID_YORUBA_NIGERIA 0x046A +#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B +#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B +#define TT_MS_LANGID_QUECHUA_PERU 0x0C6B +#define TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA 0x046C +#define TT_MS_LANGID_BASHKIR_RUSSIA 0x046D +#define TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG 0x046E +#define TT_MS_LANGID_GREENLANDIC_GREENLAND 0x046F +#define TT_MS_LANGID_IGBO_NIGERIA 0x0470 +#define TT_MS_LANGID_YI_PRC 0x0478 +#define TT_MS_LANGID_MAPUDUNGUN_CHILE 0x047A +#define TT_MS_LANGID_MOHAWK_MOHAWK 0x047C +#define TT_MS_LANGID_BRETON_FRANCE 0x047E +#define TT_MS_LANGID_UIGHUR_PRC 0x0480 +#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 +#define TT_MS_LANGID_OCCITAN_FRANCE 0x0482 +#define TT_MS_LANGID_CORSICAN_FRANCE 0x0483 +#define TT_MS_LANGID_ALSATIAN_FRANCE 0x0484 +#define TT_MS_LANGID_YAKUT_RUSSIA 0x0485 +#define TT_MS_LANGID_KICHE_GUATEMALA 0x0486 +#define TT_MS_LANGID_KINYARWANDA_RWANDA 0x0487 +#define TT_MS_LANGID_WOLOF_SENEGAL 0x0488 +#define TT_MS_LANGID_DARI_AFGHANISTAN 0x048C + + /* */ + + + /* legacy macro definitions not present in OpenType 1.8.1 */ +#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 +#define TT_MS_LANGID_CATALAN_SPAIN \ + TT_MS_LANGID_CATALAN_CATALAN +#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 +#define TT_MS_LANGID_CHINESE_MACAU \ + TT_MS_LANGID_CHINESE_MACAO +#define TT_MS_LANGID_GERMAN_LIECHTENSTEI \ + TT_MS_LANGID_GERMAN_LIECHTENSTEIN +#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 +#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 +#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09 +#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT \ + TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT +#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU +#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C +#define TT_MS_LANGID_FRENCH_REUNION 0x200C +#define TT_MS_LANGID_FRENCH_CONGO 0x240C + /* which was formerly: */ +#define TT_MS_LANGID_FRENCH_ZAIRE \ + TT_MS_LANGID_FRENCH_CONGO +#define TT_MS_LANGID_FRENCH_SENEGAL 0x280C +#define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C +#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C +#define TT_MS_LANGID_FRENCH_MALI 0x340C +#define TT_MS_LANGID_FRENCH_MOROCCO 0x380C +#define TT_MS_LANGID_FRENCH_HAITI 0x3C0C +#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU +#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA \ + TT_MS_LANGID_KOREAN_KOREA +#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812 +#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND \ + TT_MS_LANGID_ROMANSH_SWITZERLAND +#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818 +#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819 +#define TT_MS_LANGID_URDU_INDIA 0x0820 +#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 +#define TT_MS_LANGID_SLOVENE_SLOVENIA \ + TT_MS_LANGID_SLOVENIAN_SLOVENIA +#define TT_MS_LANGID_FARSI_IRAN 0x0429 +#define TT_MS_LANGID_BASQUE_SPAIN \ + TT_MS_LANGID_BASQUE_BASQUE +#define TT_MS_LANGID_SORBIAN_GERMANY \ + TT_MS_LANGID_UPPER_SORBIAN_GERMANY +#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430 +#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431 +#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA \ + TT_MS_LANGID_SETSWANA_SOUTH_AFRICA +#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433 +#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA \ + TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA +#define TT_MS_LANGID_ZULU_SOUTH_AFRICA \ + TT_MS_LANGID_ISIZULU_SOUTH_AFRICA +#define TT_MS_LANGID_SAAMI_LAPONIA 0x043B + /* the next two values are incorrectly inverted */ +#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C +#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C +#define TT_MS_LANGID_YIDDISH_GERMANY 0x043D +#define TT_MS_LANGID_KAZAK_KAZAKSTAN \ + TT_MS_LANGID_KAZAKH_KAZAKHSTAN +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ + TT_MS_LANGID_KYRGYZ_KYRGYZSTAN +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN \ + TT_MS_LANGID_KYRGYZ_KYRGYZSTAN +#define TT_MS_LANGID_SWAHILI_KENYA \ + TT_MS_LANGID_KISWAHILI_KENYA +#define TT_MS_LANGID_TATAR_TATARSTAN \ + TT_MS_LANGID_TATAR_RUSSIA +#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 +#define TT_MS_LANGID_ORIYA_INDIA \ + TT_MS_LANGID_ODIA_INDIA +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN \ + TT_MS_LANGID_MONGOLIAN_PRC +#define TT_MS_LANGID_TIBETAN_CHINA \ + TT_MS_LANGID_TIBETAN_PRC +#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 +#define TT_MS_LANGID_TIBETAN_BHUTAN \ + TT_MS_LANGID_DZONGHKA_BHUTAN +#define TT_MS_LANGID_WELSH_WALES \ + TT_MS_LANGID_WELSH_UNITED_KINGDOM +#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 +#define TT_MS_LANGID_GALICIAN_SPAIN \ + TT_MS_LANGID_GALICIAN_GALICIAN +#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 +#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 +#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 +#define TT_MS_LANGID_SINHALESE_SRI_LANKA \ + TT_MS_LANGID_SINHALA_SRI_LANKA +#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN \ + TT_MS_LANGID_TAMAZIGHT_ALGERIA +#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 +#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 +#define TT_MS_LANGID_KASHMIRI_INDIA \ + TT_MS_LANGID_KASHMIRI_SASIA +#define TT_MS_LANGID_NEPALI_INDIA 0x0861 +#define TT_MS_LANGID_DIVEHI_MALDIVES \ + TT_MS_LANGID_DHIVEHI_MALDIVES +#define TT_MS_LANGID_EDO_NIGERIA 0x0466 +#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 +#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 +#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA \ + TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA +#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ + TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA +#define TT_MS_LANGID_KANURI_NIGERIA 0x0471 +#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 +#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 +#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 +#define TT_MS_LANGID_TIGRIGNA_ERYTREA \ + TT_MS_LANGID_TIGRIGNA_ERYTHREA +#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 +#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 +#define TT_MS_LANGID_LATIN 0x0476 +#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477 +#define TT_MS_LANGID_YI_CHINA \ + TT_MS_LANGID_YI_PRC +#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 +#define TT_MS_LANGID_UIGHUR_CHINA \ + TT_MS_LANGID_UIGHUR_PRC + + + /************************************************************************** + * + * @enum: + * TT_NAME_ID_XXX + * + * @description: + * Possible values of the 'name' identifier field in the name records of + * an SFNT 'name' table. These values are platform independent. + */ + +#define TT_NAME_ID_COPYRIGHT 0 +#define TT_NAME_ID_FONT_FAMILY 1 +#define TT_NAME_ID_FONT_SUBFAMILY 2 +#define TT_NAME_ID_UNIQUE_ID 3 +#define TT_NAME_ID_FULL_NAME 4 +#define TT_NAME_ID_VERSION_STRING 5 +#define TT_NAME_ID_PS_NAME 6 +#define TT_NAME_ID_TRADEMARK 7 + + /* the following values are from the OpenType spec */ +#define TT_NAME_ID_MANUFACTURER 8 +#define TT_NAME_ID_DESIGNER 9 +#define TT_NAME_ID_DESCRIPTION 10 +#define TT_NAME_ID_VENDOR_URL 11 +#define TT_NAME_ID_DESIGNER_URL 12 +#define TT_NAME_ID_LICENSE 13 +#define TT_NAME_ID_LICENSE_URL 14 + /* number 15 is reserved */ +#define TT_NAME_ID_TYPOGRAPHIC_FAMILY 16 +#define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY 17 +#define TT_NAME_ID_MAC_FULL_NAME 18 + + /* The following code is new as of 2000-01-21 */ +#define TT_NAME_ID_SAMPLE_TEXT 19 + + /* This is new in OpenType 1.3 */ +#define TT_NAME_ID_CID_FINDFONT_NAME 20 + + /* This is new in OpenType 1.5 */ +#define TT_NAME_ID_WWS_FAMILY 21 +#define TT_NAME_ID_WWS_SUBFAMILY 22 + + /* This is new in OpenType 1.7 */ +#define TT_NAME_ID_LIGHT_BACKGROUND 23 +#define TT_NAME_ID_DARK_BACKGROUND 24 + + /* This is new in OpenType 1.8 */ +#define TT_NAME_ID_VARIATIONS_PREFIX 25 + + /* these two values are deprecated */ +#define TT_NAME_ID_PREFERRED_FAMILY TT_NAME_ID_TYPOGRAPHIC_FAMILY +#define TT_NAME_ID_PREFERRED_SUBFAMILY TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY + + + /************************************************************************** + * + * @enum: + * TT_UCR_XXX + * + * @description: + * Possible bit mask values for the `ulUnicodeRangeX` fields in an SFNT + * 'OS/2' table. + */ + + /* ulUnicodeRange1 */ + /* --------------- */ + + /* Bit 0 Basic Latin */ +#define TT_UCR_BASIC_LATIN (1UL << 0) /* U+0020-U+007E */ + /* Bit 1 C1 Controls and Latin-1 Supplement */ +#define TT_UCR_LATIN1_SUPPLEMENT (1UL << 1) /* U+0080-U+00FF */ + /* Bit 2 Latin Extended-A */ +#define TT_UCR_LATIN_EXTENDED_A (1UL << 2) /* U+0100-U+017F */ + /* Bit 3 Latin Extended-B */ +#define TT_UCR_LATIN_EXTENDED_B (1UL << 3) /* U+0180-U+024F */ + /* Bit 4 IPA Extensions */ + /* Phonetic Extensions */ + /* Phonetic Extensions Supplement */ +#define TT_UCR_IPA_EXTENSIONS (1UL << 4) /* U+0250-U+02AF */ + /* U+1D00-U+1D7F */ + /* U+1D80-U+1DBF */ + /* Bit 5 Spacing Modifier Letters */ + /* Modifier Tone Letters */ +#define TT_UCR_SPACING_MODIFIER (1UL << 5) /* U+02B0-U+02FF */ + /* U+A700-U+A71F */ + /* Bit 6 Combining Diacritical Marks */ + /* Combining Diacritical Marks Supplement */ +#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1UL << 6) /* U+0300-U+036F */ + /* U+1DC0-U+1DFF */ + /* Bit 7 Greek and Coptic */ +#define TT_UCR_GREEK (1UL << 7) /* U+0370-U+03FF */ + /* Bit 8 Coptic */ +#define TT_UCR_COPTIC (1UL << 8) /* U+2C80-U+2CFF */ + /* Bit 9 Cyrillic */ + /* Cyrillic Supplement */ + /* Cyrillic Extended-A */ + /* Cyrillic Extended-B */ +#define TT_UCR_CYRILLIC (1UL << 9) /* U+0400-U+04FF */ + /* U+0500-U+052F */ + /* U+2DE0-U+2DFF */ + /* U+A640-U+A69F */ + /* Bit 10 Armenian */ +#define TT_UCR_ARMENIAN (1UL << 10) /* U+0530-U+058F */ + /* Bit 11 Hebrew */ +#define TT_UCR_HEBREW (1UL << 11) /* U+0590-U+05FF */ + /* Bit 12 Vai */ +#define TT_UCR_VAI (1UL << 12) /* U+A500-U+A63F */ + /* Bit 13 Arabic */ + /* Arabic Supplement */ +#define TT_UCR_ARABIC (1UL << 13) /* U+0600-U+06FF */ + /* U+0750-U+077F */ + /* Bit 14 NKo */ +#define TT_UCR_NKO (1UL << 14) /* U+07C0-U+07FF */ + /* Bit 15 Devanagari */ +#define TT_UCR_DEVANAGARI (1UL << 15) /* U+0900-U+097F */ + /* Bit 16 Bangla (Bengali) */ +#define TT_UCR_BENGALI (1UL << 16) /* U+0980-U+09FF */ + /* Bit 17 Gurmukhi */ +#define TT_UCR_GURMUKHI (1UL << 17) /* U+0A00-U+0A7F */ + /* Bit 18 Gujarati */ +#define TT_UCR_GUJARATI (1UL << 18) /* U+0A80-U+0AFF */ + /* Bit 19 Oriya (Odia) */ +#define TT_UCR_ORIYA (1UL << 19) /* U+0B00-U+0B7F */ + /* Bit 20 Tamil */ +#define TT_UCR_TAMIL (1UL << 20) /* U+0B80-U+0BFF */ + /* Bit 21 Telugu */ +#define TT_UCR_TELUGU (1UL << 21) /* U+0C00-U+0C7F */ + /* Bit 22 Kannada */ +#define TT_UCR_KANNADA (1UL << 22) /* U+0C80-U+0CFF */ + /* Bit 23 Malayalam */ +#define TT_UCR_MALAYALAM (1UL << 23) /* U+0D00-U+0D7F */ + /* Bit 24 Thai */ +#define TT_UCR_THAI (1UL << 24) /* U+0E00-U+0E7F */ + /* Bit 25 Lao */ +#define TT_UCR_LAO (1UL << 25) /* U+0E80-U+0EFF */ + /* Bit 26 Georgian */ + /* Georgian Supplement */ +#define TT_UCR_GEORGIAN (1UL << 26) /* U+10A0-U+10FF */ + /* U+2D00-U+2D2F */ + /* Bit 27 Balinese */ +#define TT_UCR_BALINESE (1UL << 27) /* U+1B00-U+1B7F */ + /* Bit 28 Hangul Jamo */ +#define TT_UCR_HANGUL_JAMO (1UL << 28) /* U+1100-U+11FF */ + /* Bit 29 Latin Extended Additional */ + /* Latin Extended-C */ + /* Latin Extended-D */ +#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1UL << 29) /* U+1E00-U+1EFF */ + /* U+2C60-U+2C7F */ + /* U+A720-U+A7FF */ + /* Bit 30 Greek Extended */ +#define TT_UCR_GREEK_EXTENDED (1UL << 30) /* U+1F00-U+1FFF */ + /* Bit 31 General Punctuation */ + /* Supplemental Punctuation */ +#define TT_UCR_GENERAL_PUNCTUATION (1UL << 31) /* U+2000-U+206F */ + /* U+2E00-U+2E7F */ + + /* ulUnicodeRange2 */ + /* --------------- */ + + /* Bit 32 Superscripts And Subscripts */ +#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1UL << 0) /* U+2070-U+209F */ + /* Bit 33 Currency Symbols */ +#define TT_UCR_CURRENCY_SYMBOLS (1UL << 1) /* U+20A0-U+20CF */ + /* Bit 34 Combining Diacritical Marks For Symbols */ +#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ + (1UL << 2) /* U+20D0-U+20FF */ + /* Bit 35 Letterlike Symbols */ +#define TT_UCR_LETTERLIKE_SYMBOLS (1UL << 3) /* U+2100-U+214F */ + /* Bit 36 Number Forms */ +#define TT_UCR_NUMBER_FORMS (1UL << 4) /* U+2150-U+218F */ + /* Bit 37 Arrows */ + /* Supplemental Arrows-A */ + /* Supplemental Arrows-B */ + /* Miscellaneous Symbols and Arrows */ +#define TT_UCR_ARROWS (1UL << 5) /* U+2190-U+21FF */ + /* U+27F0-U+27FF */ + /* U+2900-U+297F */ + /* U+2B00-U+2BFF */ + /* Bit 38 Mathematical Operators */ + /* Supplemental Mathematical Operators */ + /* Miscellaneous Mathematical Symbols-A */ + /* Miscellaneous Mathematical Symbols-B */ +#define TT_UCR_MATHEMATICAL_OPERATORS (1UL << 6) /* U+2200-U+22FF */ + /* U+2A00-U+2AFF */ + /* U+27C0-U+27EF */ + /* U+2980-U+29FF */ + /* Bit 39 Miscellaneous Technical */ +#define TT_UCR_MISCELLANEOUS_TECHNICAL (1UL << 7) /* U+2300-U+23FF */ + /* Bit 40 Control Pictures */ +#define TT_UCR_CONTROL_PICTURES (1UL << 8) /* U+2400-U+243F */ + /* Bit 41 Optical Character Recognition */ +#define TT_UCR_OCR (1UL << 9) /* U+2440-U+245F */ + /* Bit 42 Enclosed Alphanumerics */ +#define TT_UCR_ENCLOSED_ALPHANUMERICS (1UL << 10) /* U+2460-U+24FF */ + /* Bit 43 Box Drawing */ +#define TT_UCR_BOX_DRAWING (1UL << 11) /* U+2500-U+257F */ + /* Bit 44 Block Elements */ +#define TT_UCR_BLOCK_ELEMENTS (1UL << 12) /* U+2580-U+259F */ + /* Bit 45 Geometric Shapes */ +#define TT_UCR_GEOMETRIC_SHAPES (1UL << 13) /* U+25A0-U+25FF */ + /* Bit 46 Miscellaneous Symbols */ +#define TT_UCR_MISCELLANEOUS_SYMBOLS (1UL << 14) /* U+2600-U+26FF */ + /* Bit 47 Dingbats */ +#define TT_UCR_DINGBATS (1UL << 15) /* U+2700-U+27BF */ + /* Bit 48 CJK Symbols and Punctuation */ +#define TT_UCR_CJK_SYMBOLS (1UL << 16) /* U+3000-U+303F */ + /* Bit 49 Hiragana */ +#define TT_UCR_HIRAGANA (1UL << 17) /* U+3040-U+309F */ + /* Bit 50 Katakana */ + /* Katakana Phonetic Extensions */ +#define TT_UCR_KATAKANA (1UL << 18) /* U+30A0-U+30FF */ + /* U+31F0-U+31FF */ + /* Bit 51 Bopomofo */ + /* Bopomofo Extended */ +#define TT_UCR_BOPOMOFO (1UL << 19) /* U+3100-U+312F */ + /* U+31A0-U+31BF */ + /* Bit 52 Hangul Compatibility Jamo */ +#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1UL << 20) /* U+3130-U+318F */ + /* Bit 53 Phags-Pa */ +#define TT_UCR_PHAGSPA (1UL << 21) /* U+A840-U+A87F */ +#define TT_UCR_KANBUN TT_UCR_PHAGSPA /* deprecated */ +#define TT_UCR_CJK_MISC TT_UCR_PHAGSPA /* deprecated */ + /* Bit 54 Enclosed CJK Letters and Months */ +#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1UL << 22) /* U+3200-U+32FF */ + /* Bit 55 CJK Compatibility */ +#define TT_UCR_CJK_COMPATIBILITY (1UL << 23) /* U+3300-U+33FF */ + /* Bit 56 Hangul Syllables */ +#define TT_UCR_HANGUL (1UL << 24) /* U+AC00-U+D7A3 */ + /* Bit 57 High Surrogates */ + /* High Private Use Surrogates */ + /* Low Surrogates */ + + /* According to OpenType specs v.1.3+, */ + /* setting bit 57 implies that there is */ + /* at least one codepoint beyond the */ + /* Basic Multilingual Plane that is */ + /* supported by this font. So it really */ + /* means >= U+10000. */ +#define TT_UCR_SURROGATES (1UL << 25) /* U+D800-U+DB7F */ + /* U+DB80-U+DBFF */ + /* U+DC00-U+DFFF */ +#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES + /* Bit 58 Phoenician */ +#define TT_UCR_PHOENICIAN (1UL << 26) /*U+10900-U+1091F*/ + /* Bit 59 CJK Unified Ideographs */ + /* CJK Radicals Supplement */ + /* Kangxi Radicals */ + /* Ideographic Description Characters */ + /* CJK Unified Ideographs Extension A */ + /* CJK Unified Ideographs Extension B */ + /* Kanbun */ +#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1UL << 27) /* U+4E00-U+9FFF */ + /* U+2E80-U+2EFF */ + /* U+2F00-U+2FDF */ + /* U+2FF0-U+2FFF */ + /* U+3400-U+4DB5 */ + /*U+20000-U+2A6DF*/ + /* U+3190-U+319F */ + /* Bit 60 Private Use */ +#define TT_UCR_PRIVATE_USE (1UL << 28) /* U+E000-U+F8FF */ + /* Bit 61 CJK Strokes */ + /* CJK Compatibility Ideographs */ + /* CJK Compatibility Ideographs Supplement */ +#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1UL << 29) /* U+31C0-U+31EF */ + /* U+F900-U+FAFF */ + /*U+2F800-U+2FA1F*/ + /* Bit 62 Alphabetic Presentation Forms */ +#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1UL << 30) /* U+FB00-U+FB4F */ + /* Bit 63 Arabic Presentation Forms-A */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1UL << 31) /* U+FB50-U+FDFF */ + + /* ulUnicodeRange3 */ + /* --------------- */ + + /* Bit 64 Combining Half Marks */ +#define TT_UCR_COMBINING_HALF_MARKS (1UL << 0) /* U+FE20-U+FE2F */ + /* Bit 65 Vertical forms */ + /* CJK Compatibility Forms */ +#define TT_UCR_CJK_COMPATIBILITY_FORMS (1UL << 1) /* U+FE10-U+FE1F */ + /* U+FE30-U+FE4F */ + /* Bit 66 Small Form Variants */ +#define TT_UCR_SMALL_FORM_VARIANTS (1UL << 2) /* U+FE50-U+FE6F */ + /* Bit 67 Arabic Presentation Forms-B */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1UL << 3) /* U+FE70-U+FEFF */ + /* Bit 68 Halfwidth and Fullwidth Forms */ +#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1UL << 4) /* U+FF00-U+FFEF */ + /* Bit 69 Specials */ +#define TT_UCR_SPECIALS (1UL << 5) /* U+FFF0-U+FFFF */ + /* Bit 70 Tibetan */ +#define TT_UCR_TIBETAN (1UL << 6) /* U+0F00-U+0FFF */ + /* Bit 71 Syriac */ +#define TT_UCR_SYRIAC (1UL << 7) /* U+0700-U+074F */ + /* Bit 72 Thaana */ +#define TT_UCR_THAANA (1UL << 8) /* U+0780-U+07BF */ + /* Bit 73 Sinhala */ +#define TT_UCR_SINHALA (1UL << 9) /* U+0D80-U+0DFF */ + /* Bit 74 Myanmar */ +#define TT_UCR_MYANMAR (1UL << 10) /* U+1000-U+109F */ + /* Bit 75 Ethiopic */ + /* Ethiopic Supplement */ + /* Ethiopic Extended */ +#define TT_UCR_ETHIOPIC (1UL << 11) /* U+1200-U+137F */ + /* U+1380-U+139F */ + /* U+2D80-U+2DDF */ + /* Bit 76 Cherokee */ +#define TT_UCR_CHEROKEE (1UL << 12) /* U+13A0-U+13FF */ + /* Bit 77 Unified Canadian Aboriginal Syllabics */ +#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1UL << 13) /* U+1400-U+167F */ + /* Bit 78 Ogham */ +#define TT_UCR_OGHAM (1UL << 14) /* U+1680-U+169F */ + /* Bit 79 Runic */ +#define TT_UCR_RUNIC (1UL << 15) /* U+16A0-U+16FF */ + /* Bit 80 Khmer */ + /* Khmer Symbols */ +#define TT_UCR_KHMER (1UL << 16) /* U+1780-U+17FF */ + /* U+19E0-U+19FF */ + /* Bit 81 Mongolian */ +#define TT_UCR_MONGOLIAN (1UL << 17) /* U+1800-U+18AF */ + /* Bit 82 Braille Patterns */ +#define TT_UCR_BRAILLE (1UL << 18) /* U+2800-U+28FF */ + /* Bit 83 Yi Syllables */ + /* Yi Radicals */ +#define TT_UCR_YI (1UL << 19) /* U+A000-U+A48F */ + /* U+A490-U+A4CF */ + /* Bit 84 Tagalog */ + /* Hanunoo */ + /* Buhid */ + /* Tagbanwa */ +#define TT_UCR_PHILIPPINE (1UL << 20) /* U+1700-U+171F */ + /* U+1720-U+173F */ + /* U+1740-U+175F */ + /* U+1760-U+177F */ + /* Bit 85 Old Italic */ +#define TT_UCR_OLD_ITALIC (1UL << 21) /*U+10300-U+1032F*/ + /* Bit 86 Gothic */ +#define TT_UCR_GOTHIC (1UL << 22) /*U+10330-U+1034F*/ + /* Bit 87 Deseret */ +#define TT_UCR_DESERET (1UL << 23) /*U+10400-U+1044F*/ + /* Bit 88 Byzantine Musical Symbols */ + /* Musical Symbols */ + /* Ancient Greek Musical Notation */ +#define TT_UCR_MUSICAL_SYMBOLS (1UL << 24) /*U+1D000-U+1D0FF*/ + /*U+1D100-U+1D1FF*/ + /*U+1D200-U+1D24F*/ + /* Bit 89 Mathematical Alphanumeric Symbols */ +#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1UL << 25) /*U+1D400-U+1D7FF*/ + /* Bit 90 Private Use (plane 15) */ + /* Private Use (plane 16) */ +#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1UL << 26) /*U+F0000-U+FFFFD*/ + /*U+100000-U+10FFFD*/ + /* Bit 91 Variation Selectors */ + /* Variation Selectors Supplement */ +#define TT_UCR_VARIATION_SELECTORS (1UL << 27) /* U+FE00-U+FE0F */ + /*U+E0100-U+E01EF*/ + /* Bit 92 Tags */ +#define TT_UCR_TAGS (1UL << 28) /*U+E0000-U+E007F*/ + /* Bit 93 Limbu */ +#define TT_UCR_LIMBU (1UL << 29) /* U+1900-U+194F */ + /* Bit 94 Tai Le */ +#define TT_UCR_TAI_LE (1UL << 30) /* U+1950-U+197F */ + /* Bit 95 New Tai Lue */ +#define TT_UCR_NEW_TAI_LUE (1UL << 31) /* U+1980-U+19DF */ + + /* ulUnicodeRange4 */ + /* --------------- */ + + /* Bit 96 Buginese */ +#define TT_UCR_BUGINESE (1UL << 0) /* U+1A00-U+1A1F */ + /* Bit 97 Glagolitic */ +#define TT_UCR_GLAGOLITIC (1UL << 1) /* U+2C00-U+2C5F */ + /* Bit 98 Tifinagh */ +#define TT_UCR_TIFINAGH (1UL << 2) /* U+2D30-U+2D7F */ + /* Bit 99 Yijing Hexagram Symbols */ +#define TT_UCR_YIJING (1UL << 3) /* U+4DC0-U+4DFF */ + /* Bit 100 Syloti Nagri */ +#define TT_UCR_SYLOTI_NAGRI (1UL << 4) /* U+A800-U+A82F */ + /* Bit 101 Linear B Syllabary */ + /* Linear B Ideograms */ + /* Aegean Numbers */ +#define TT_UCR_LINEAR_B (1UL << 5) /*U+10000-U+1007F*/ + /*U+10080-U+100FF*/ + /*U+10100-U+1013F*/ + /* Bit 102 Ancient Greek Numbers */ +#define TT_UCR_ANCIENT_GREEK_NUMBERS (1UL << 6) /*U+10140-U+1018F*/ + /* Bit 103 Ugaritic */ +#define TT_UCR_UGARITIC (1UL << 7) /*U+10380-U+1039F*/ + /* Bit 104 Old Persian */ +#define TT_UCR_OLD_PERSIAN (1UL << 8) /*U+103A0-U+103DF*/ + /* Bit 105 Shavian */ +#define TT_UCR_SHAVIAN (1UL << 9) /*U+10450-U+1047F*/ + /* Bit 106 Osmanya */ +#define TT_UCR_OSMANYA (1UL << 10) /*U+10480-U+104AF*/ + /* Bit 107 Cypriot Syllabary */ +#define TT_UCR_CYPRIOT_SYLLABARY (1UL << 11) /*U+10800-U+1083F*/ + /* Bit 108 Kharoshthi */ +#define TT_UCR_KHAROSHTHI (1UL << 12) /*U+10A00-U+10A5F*/ + /* Bit 109 Tai Xuan Jing Symbols */ +#define TT_UCR_TAI_XUAN_JING (1UL << 13) /*U+1D300-U+1D35F*/ + /* Bit 110 Cuneiform */ + /* Cuneiform Numbers and Punctuation */ +#define TT_UCR_CUNEIFORM (1UL << 14) /*U+12000-U+123FF*/ + /*U+12400-U+1247F*/ + /* Bit 111 Counting Rod Numerals */ +#define TT_UCR_COUNTING_ROD_NUMERALS (1UL << 15) /*U+1D360-U+1D37F*/ + /* Bit 112 Sundanese */ +#define TT_UCR_SUNDANESE (1UL << 16) /* U+1B80-U+1BBF */ + /* Bit 113 Lepcha */ +#define TT_UCR_LEPCHA (1UL << 17) /* U+1C00-U+1C4F */ + /* Bit 114 Ol Chiki */ +#define TT_UCR_OL_CHIKI (1UL << 18) /* U+1C50-U+1C7F */ + /* Bit 115 Saurashtra */ +#define TT_UCR_SAURASHTRA (1UL << 19) /* U+A880-U+A8DF */ + /* Bit 116 Kayah Li */ +#define TT_UCR_KAYAH_LI (1UL << 20) /* U+A900-U+A92F */ + /* Bit 117 Rejang */ +#define TT_UCR_REJANG (1UL << 21) /* U+A930-U+A95F */ + /* Bit 118 Cham */ +#define TT_UCR_CHAM (1UL << 22) /* U+AA00-U+AA5F */ + /* Bit 119 Ancient Symbols */ +#define TT_UCR_ANCIENT_SYMBOLS (1UL << 23) /*U+10190-U+101CF*/ + /* Bit 120 Phaistos Disc */ +#define TT_UCR_PHAISTOS_DISC (1UL << 24) /*U+101D0-U+101FF*/ + /* Bit 121 Carian */ + /* Lycian */ + /* Lydian */ +#define TT_UCR_OLD_ANATOLIAN (1UL << 25) /*U+102A0-U+102DF*/ + /*U+10280-U+1029F*/ + /*U+10920-U+1093F*/ + /* Bit 122 Domino Tiles */ + /* Mahjong Tiles */ +#define TT_UCR_GAME_TILES (1UL << 26) /*U+1F030-U+1F09F*/ + /*U+1F000-U+1F02F*/ + /* Bit 123-127 Reserved for process-internal usage */ + + /* */ + + /* for backward compatibility with older FreeType versions */ +#define TT_UCR_ARABIC_PRESENTATION_A \ + TT_UCR_ARABIC_PRESENTATION_FORMS_A +#define TT_UCR_ARABIC_PRESENTATION_B \ + TT_UCR_ARABIC_PRESENTATION_FORMS_B + +#define TT_UCR_COMBINING_DIACRITICS \ + TT_UCR_COMBINING_DIACRITICAL_MARKS +#define TT_UCR_COMBINING_DIACRITICS_SYMB \ + TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB + + +FT_END_HEADER + +#endif /* TTNAMEID_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttables.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttables.h new file mode 100644 index 0000000000000000000000000000000000000000..aa4336435d930a2211c05bffaaf4b820da62cefd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttables.h @@ -0,0 +1,859 @@ +/**************************************************************************** + * + * tttables.h + * + * Basic SFNT/TrueType tables definitions and interface + * (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef TTTABLES_H_ +#define TTTABLES_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /************************************************************************** + * + * @section: + * truetype_tables + * + * @title: + * TrueType Tables + * + * @abstract: + * TrueType-specific table types and functions. + * + * @description: + * This section contains definitions of some basic tables specific to + * TrueType and OpenType as well as some routines used to access and + * process them. + * + * @order: + * TT_Header + * TT_HoriHeader + * TT_VertHeader + * TT_OS2 + * TT_Postscript + * TT_PCLT + * TT_MaxProfile + * + * FT_Sfnt_Tag + * FT_Get_Sfnt_Table + * FT_Load_Sfnt_Table + * FT_Sfnt_Table_Info + * + * FT_Get_CMap_Language_ID + * FT_Get_CMap_Format + * + * FT_PARAM_TAG_UNPATENTED_HINTING + * + */ + + + /************************************************************************** + * + * @struct: + * TT_Header + * + * @description: + * A structure to model a TrueType font header table. All fields follow + * the OpenType specification. The 64-bit timestamps are stored in + * two-element arrays `Created` and `Modified`, first the upper then + * the lower 32~bits. + */ + typedef struct TT_Header_ + { + FT_Fixed Table_Version; + FT_Fixed Font_Revision; + + FT_Long CheckSum_Adjust; + FT_Long Magic_Number; + + FT_UShort Flags; + FT_UShort Units_Per_EM; + + FT_ULong Created [2]; + FT_ULong Modified[2]; + + FT_Short xMin; + FT_Short yMin; + FT_Short xMax; + FT_Short yMax; + + FT_UShort Mac_Style; + FT_UShort Lowest_Rec_PPEM; + + FT_Short Font_Direction; + FT_Short Index_To_Loc_Format; + FT_Short Glyph_Data_Format; + + } TT_Header; + + + /************************************************************************** + * + * @struct: + * TT_HoriHeader + * + * @description: + * A structure to model a TrueType horizontal header, the 'hhea' table, + * as well as the corresponding horizontal metrics table, 'hmtx'. + * + * @fields: + * Version :: + * The table version. + * + * Ascender :: + * The font's ascender, i.e., the distance from the baseline to the + * top-most of all glyph points found in the font. + * + * This value is invalid in many fonts, as it is usually set by the + * font designer, and often reflects only a portion of the glyphs found + * in the font (maybe ASCII). + * + * You should use the `sTypoAscender` field of the 'OS/2' table instead + * if you want the correct one. + * + * Descender :: + * The font's descender, i.e., the distance from the baseline to the + * bottom-most of all glyph points found in the font. It is negative. + * + * This value is invalid in many fonts, as it is usually set by the + * font designer, and often reflects only a portion of the glyphs found + * in the font (maybe ASCII). + * + * You should use the `sTypoDescender` field of the 'OS/2' table + * instead if you want the correct one. + * + * Line_Gap :: + * The font's line gap, i.e., the distance to add to the ascender and + * descender to get the BTB, i.e., the baseline-to-baseline distance + * for the font. + * + * advance_Width_Max :: + * This field is the maximum of all advance widths found in the font. + * It can be used to compute the maximum width of an arbitrary string + * of text. + * + * min_Left_Side_Bearing :: + * The minimum left side bearing of all glyphs within the font. + * + * min_Right_Side_Bearing :: + * The minimum right side bearing of all glyphs within the font. + * + * xMax_Extent :: + * The maximum horizontal extent (i.e., the 'width' of a glyph's + * bounding box) for all glyphs in the font. + * + * caret_Slope_Rise :: + * The rise coefficient of the cursor's slope of the cursor + * (slope=rise/run). + * + * caret_Slope_Run :: + * The run coefficient of the cursor's slope. + * + * caret_Offset :: + * The cursor's offset for slanted fonts. + * + * Reserved :: + * 8~reserved bytes. + * + * metric_Data_Format :: + * Always~0. + * + * number_Of_HMetrics :: + * Number of HMetrics entries in the 'hmtx' table -- this value can be + * smaller than the total number of glyphs in the font. + * + * long_metrics :: + * A pointer into the 'hmtx' table. + * + * short_metrics :: + * A pointer into the 'hmtx' table. + * + * @note: + * For OpenType Font Variations, the values of the following fields can + * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if + * the font contains an 'MVAR' table: `caret_Slope_Rise`, + * `caret_Slope_Run`, and `caret_Offset`. + */ + typedef struct TT_HoriHeader_ + { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Width_Max; /* advance width maximum */ + + FT_Short min_Left_Side_Bearing; /* minimum left-sb */ + FT_Short min_Right_Side_Bearing; /* minimum right-sb */ + FT_Short xMax_Extent; /* xmax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_HMetrics; + + /* The following fields are not defined by the OpenType specification */ + /* but they are used to connect the metrics header to the relevant */ + /* 'hmtx' table. */ + + void* long_metrics; + void* short_metrics; + + } TT_HoriHeader; + + + /************************************************************************** + * + * @struct: + * TT_VertHeader + * + * @description: + * A structure used to model a TrueType vertical header, the 'vhea' + * table, as well as the corresponding vertical metrics table, 'vmtx'. + * + * @fields: + * Version :: + * The table version. + * + * Ascender :: + * The font's ascender, i.e., the distance from the baseline to the + * top-most of all glyph points found in the font. + * + * This value is invalid in many fonts, as it is usually set by the + * font designer, and often reflects only a portion of the glyphs found + * in the font (maybe ASCII). + * + * You should use the `sTypoAscender` field of the 'OS/2' table instead + * if you want the correct one. + * + * Descender :: + * The font's descender, i.e., the distance from the baseline to the + * bottom-most of all glyph points found in the font. It is negative. + * + * This value is invalid in many fonts, as it is usually set by the + * font designer, and often reflects only a portion of the glyphs found + * in the font (maybe ASCII). + * + * You should use the `sTypoDescender` field of the 'OS/2' table + * instead if you want the correct one. + * + * Line_Gap :: + * The font's line gap, i.e., the distance to add to the ascender and + * descender to get the BTB, i.e., the baseline-to-baseline distance + * for the font. + * + * advance_Height_Max :: + * This field is the maximum of all advance heights found in the font. + * It can be used to compute the maximum height of an arbitrary string + * of text. + * + * min_Top_Side_Bearing :: + * The minimum top side bearing of all glyphs within the font. + * + * min_Bottom_Side_Bearing :: + * The minimum bottom side bearing of all glyphs within the font. + * + * yMax_Extent :: + * The maximum vertical extent (i.e., the 'height' of a glyph's + * bounding box) for all glyphs in the font. + * + * caret_Slope_Rise :: + * The rise coefficient of the cursor's slope of the cursor + * (slope=rise/run). + * + * caret_Slope_Run :: + * The run coefficient of the cursor's slope. + * + * caret_Offset :: + * The cursor's offset for slanted fonts. + * + * Reserved :: + * 8~reserved bytes. + * + * metric_Data_Format :: + * Always~0. + * + * number_Of_VMetrics :: + * Number of VMetrics entries in the 'vmtx' table -- this value can be + * smaller than the total number of glyphs in the font. + * + * long_metrics :: + * A pointer into the 'vmtx' table. + * + * short_metrics :: + * A pointer into the 'vmtx' table. + * + * @note: + * For OpenType Font Variations, the values of the following fields can + * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if + * the font contains an 'MVAR' table: `Ascender`, `Descender`, + * `Line_Gap`, `caret_Slope_Rise`, `caret_Slope_Run`, and `caret_Offset`. + */ + typedef struct TT_VertHeader_ + { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Height_Max; /* advance height maximum */ + + FT_Short min_Top_Side_Bearing; /* minimum top-sb */ + FT_Short min_Bottom_Side_Bearing; /* minimum bottom-sb */ + FT_Short yMax_Extent; /* ymax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_VMetrics; + + /* The following fields are not defined by the OpenType specification */ + /* but they are used to connect the metrics header to the relevant */ + /* 'vmtx' table. */ + + void* long_metrics; + void* short_metrics; + + } TT_VertHeader; + + + /************************************************************************** + * + * @struct: + * TT_OS2 + * + * @description: + * A structure to model a TrueType 'OS/2' table. All fields comply to + * the OpenType specification. + * + * Note that we now support old Mac fonts that do not include an 'OS/2' + * table. In this case, the `version` field is always set to 0xFFFF. + * + * @note: + * For OpenType Font Variations, the values of the following fields can + * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if + * the font contains an 'MVAR' table: `sCapHeight`, `sTypoAscender`, + * `sTypoDescender`, `sTypoLineGap`, `sxHeight`, `usWinAscent`, + * `usWinDescent`, `yStrikeoutPosition`, `yStrikeoutSize`, + * `ySubscriptXOffset`, `ySubScriptXSize`, `ySubscriptYOffset`, + * `ySubscriptYSize`, `ySuperscriptXOffset`, `ySuperscriptXSize`, + * `ySuperscriptYOffset`, and `ySuperscriptYSize`. + * + * Possible values for bits in the `ulUnicodeRangeX` fields are given by + * the @TT_UCR_XXX macros. + */ + + typedef struct TT_OS2_ + { + FT_UShort version; /* 0x0001 - more or 0xFFFF */ + FT_Short xAvgCharWidth; + FT_UShort usWeightClass; + FT_UShort usWidthClass; + FT_UShort fsType; + FT_Short ySubscriptXSize; + FT_Short ySubscriptYSize; + FT_Short ySubscriptXOffset; + FT_Short ySubscriptYOffset; + FT_Short ySuperscriptXSize; + FT_Short ySuperscriptYSize; + FT_Short ySuperscriptXOffset; + FT_Short ySuperscriptYOffset; + FT_Short yStrikeoutSize; + FT_Short yStrikeoutPosition; + FT_Short sFamilyClass; + + FT_Byte panose[10]; + + FT_ULong ulUnicodeRange1; /* Bits 0-31 */ + FT_ULong ulUnicodeRange2; /* Bits 32-63 */ + FT_ULong ulUnicodeRange3; /* Bits 64-95 */ + FT_ULong ulUnicodeRange4; /* Bits 96-127 */ + + FT_Char achVendID[4]; + + FT_UShort fsSelection; + FT_UShort usFirstCharIndex; + FT_UShort usLastCharIndex; + FT_Short sTypoAscender; + FT_Short sTypoDescender; + FT_Short sTypoLineGap; + FT_UShort usWinAscent; + FT_UShort usWinDescent; + + /* only version 1 and higher: */ + + FT_ULong ulCodePageRange1; /* Bits 0-31 */ + FT_ULong ulCodePageRange2; /* Bits 32-63 */ + + /* only version 2 and higher: */ + + FT_Short sxHeight; + FT_Short sCapHeight; + FT_UShort usDefaultChar; + FT_UShort usBreakChar; + FT_UShort usMaxContext; + + /* only version 5 and higher: */ + + FT_UShort usLowerOpticalPointSize; /* in twips (1/20 points) */ + FT_UShort usUpperOpticalPointSize; /* in twips (1/20 points) */ + + } TT_OS2; + + + /************************************************************************** + * + * @struct: + * TT_Postscript + * + * @description: + * A structure to model a TrueType 'post' table. All fields comply to + * the OpenType specification. This structure does not reference a + * font's PostScript glyph names; use @FT_Get_Glyph_Name to retrieve + * them. + * + * @note: + * For OpenType Font Variations, the values of the following fields can + * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if + * the font contains an 'MVAR' table: `underlinePosition` and + * `underlineThickness`. + */ + typedef struct TT_Postscript_ + { + FT_Fixed FormatType; + FT_Fixed italicAngle; + FT_Short underlinePosition; + FT_Short underlineThickness; + FT_ULong isFixedPitch; + FT_ULong minMemType42; + FT_ULong maxMemType42; + FT_ULong minMemType1; + FT_ULong maxMemType1; + + /* Glyph names follow in the 'post' table, but we don't */ + /* load them by default. */ + + } TT_Postscript; + + + /************************************************************************** + * + * @struct: + * TT_PCLT + * + * @description: + * A structure to model a TrueType 'PCLT' table. All fields comply to + * the OpenType specification. + */ + typedef struct TT_PCLT_ + { + FT_Fixed Version; + FT_ULong FontNumber; + FT_UShort Pitch; + FT_UShort xHeight; + FT_UShort Style; + FT_UShort TypeFamily; + FT_UShort CapHeight; + FT_UShort SymbolSet; + FT_Char TypeFace[16]; + FT_Char CharacterComplement[8]; + FT_Char FileName[6]; + FT_Char StrokeWeight; + FT_Char WidthType; + FT_Byte SerifStyle; + FT_Byte Reserved; + + } TT_PCLT; + + + /************************************************************************** + * + * @struct: + * TT_MaxProfile + * + * @description: + * The maximum profile ('maxp') table contains many max values, which can + * be used to pre-allocate arrays for speeding up glyph loading and + * hinting. + * + * @fields: + * version :: + * The version number. + * + * numGlyphs :: + * The number of glyphs in this TrueType font. + * + * maxPoints :: + * The maximum number of points in a non-composite TrueType glyph. See + * also `maxCompositePoints`. + * + * maxContours :: + * The maximum number of contours in a non-composite TrueType glyph. + * See also `maxCompositeContours`. + * + * maxCompositePoints :: + * The maximum number of points in a composite TrueType glyph. See + * also `maxPoints`. + * + * maxCompositeContours :: + * The maximum number of contours in a composite TrueType glyph. See + * also `maxContours`. + * + * maxZones :: + * The maximum number of zones used for glyph hinting. + * + * maxTwilightPoints :: + * The maximum number of points in the twilight zone used for glyph + * hinting. + * + * maxStorage :: + * The maximum number of elements in the storage area used for glyph + * hinting. + * + * maxFunctionDefs :: + * The maximum number of function definitions in the TrueType bytecode + * for this font. + * + * maxInstructionDefs :: + * The maximum number of instruction definitions in the TrueType + * bytecode for this font. + * + * maxStackElements :: + * The maximum number of stack elements used during bytecode + * interpretation. + * + * maxSizeOfInstructions :: + * The maximum number of TrueType opcodes used for glyph hinting. + * + * maxComponentElements :: + * The maximum number of simple (i.e., non-composite) glyphs in a + * composite glyph. + * + * maxComponentDepth :: + * The maximum nesting depth of composite glyphs. + * + * @note: + * This structure is only used during font loading. + */ + typedef struct TT_MaxProfile_ + { + FT_Fixed version; + FT_UShort numGlyphs; + FT_UShort maxPoints; + FT_UShort maxContours; + FT_UShort maxCompositePoints; + FT_UShort maxCompositeContours; + FT_UShort maxZones; + FT_UShort maxTwilightPoints; + FT_UShort maxStorage; + FT_UShort maxFunctionDefs; + FT_UShort maxInstructionDefs; + FT_UShort maxStackElements; + FT_UShort maxSizeOfInstructions; + FT_UShort maxComponentElements; + FT_UShort maxComponentDepth; + + } TT_MaxProfile; + + + /************************************************************************** + * + * @enum: + * FT_Sfnt_Tag + * + * @description: + * An enumeration to specify indices of SFNT tables loaded and parsed by + * FreeType during initialization of an SFNT font. Used in the + * @FT_Get_Sfnt_Table API function. + * + * @values: + * FT_SFNT_HEAD :: + * To access the font's @TT_Header structure. + * + * FT_SFNT_MAXP :: + * To access the font's @TT_MaxProfile structure. + * + * FT_SFNT_OS2 :: + * To access the font's @TT_OS2 structure. + * + * FT_SFNT_HHEA :: + * To access the font's @TT_HoriHeader structure. + * + * FT_SFNT_VHEA :: + * To access the font's @TT_VertHeader structure. + * + * FT_SFNT_POST :: + * To access the font's @TT_Postscript structure. + * + * FT_SFNT_PCLT :: + * To access the font's @TT_PCLT structure. + */ + typedef enum FT_Sfnt_Tag_ + { + FT_SFNT_HEAD, + FT_SFNT_MAXP, + FT_SFNT_OS2, + FT_SFNT_HHEA, + FT_SFNT_VHEA, + FT_SFNT_POST, + FT_SFNT_PCLT, + + FT_SFNT_MAX + + } FT_Sfnt_Tag; + + /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag` */ + /* values instead */ +#define ft_sfnt_head FT_SFNT_HEAD +#define ft_sfnt_maxp FT_SFNT_MAXP +#define ft_sfnt_os2 FT_SFNT_OS2 +#define ft_sfnt_hhea FT_SFNT_HHEA +#define ft_sfnt_vhea FT_SFNT_VHEA +#define ft_sfnt_post FT_SFNT_POST +#define ft_sfnt_pclt FT_SFNT_PCLT + + + /************************************************************************** + * + * @function: + * FT_Get_Sfnt_Table + * + * @description: + * Return a pointer to a given SFNT table stored within a face. + * + * @input: + * face :: + * A handle to the source. + * + * tag :: + * The index of the SFNT table. + * + * @return: + * A type-less pointer to the table. This will be `NULL` in case of + * error, or if the corresponding table was not found **OR** loaded from + * the file. + * + * Use a typecast according to `tag` to access the structure elements. + * + * @note: + * The table is owned by the face object and disappears with it. + * + * This function is only useful to access SFNT tables that are loaded by + * the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for a + * list. + * + * @example: + * Here is an example demonstrating access to the 'vhea' table. + * + * ``` + * TT_VertHeader* vert_header; + * + * + * vert_header = + * (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); + * ``` + */ + FT_EXPORT( void* ) + FT_Get_Sfnt_Table( FT_Face face, + FT_Sfnt_Tag tag ); + + + /************************************************************************** + * + * @function: + * FT_Load_Sfnt_Table + * + * @description: + * Load any SFNT font table into client memory. + * + * @input: + * face :: + * A handle to the source face. + * + * tag :: + * The four-byte tag of the table to load. Use value~0 if you want to + * access the whole font file. Otherwise, you can use one of the + * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new + * one with @FT_MAKE_TAG. + * + * [Since 2.14] Use value~1 if you want to access the table directory + * of the (currently selected) font. + * + * offset :: + * The starting offset in the table (or file if tag~==~0). + * + * @output: + * buffer :: + * The target buffer address. The client must ensure that the memory + * array is big enough to hold the data. + * + * @inout: + * length :: + * If the `length` parameter is `NULL`, try to load the whole table. + * Return an error code if it fails. + * + * Else, if `*length` is~0, exit immediately while returning the + * table's (or file) full size in it. + * + * Else the number of bytes to read from the table or file, from the + * starting offset. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If you need to determine the table's length you should first call this + * function with `*length` set to~0, as in the following example: + * + * ``` + * FT_ULong length = 0; + * + * + * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); + * if ( error ) { ... table does not exist ... } + * + * buffer = malloc( length ); + * if ( buffer == NULL ) { ... not enough memory ... } + * + * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); + * if ( error ) { ... could not load table ... } + * ``` + * + * Note that structures like @TT_Header or @TT_OS2 can't be used with + * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that + * those structures depend on the processor architecture, with varying + * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). + * + */ + FT_EXPORT( FT_Error ) + FT_Load_Sfnt_Table( FT_Face face, + FT_ULong tag, + FT_Long offset, + FT_Byte* buffer, + FT_ULong* length ); + + + /************************************************************************** + * + * @function: + * FT_Sfnt_Table_Info + * + * @description: + * Return information on an SFNT table. + * + * @input: + * face :: + * A handle to the source face. + * + * table_index :: + * The index of an SFNT table. The function returns + * FT_Err_Table_Missing for an invalid value. + * + * @inout: + * tag :: + * The name tag of the SFNT table. If the value is `NULL`, + * `table_index` is ignored, and `length` returns the number of SFNT + * tables in the font. + * + * @output: + * length :: + * The length of the SFNT table (or the number of SFNT tables, + * depending on `tag`). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * While parsing fonts, FreeType handles SFNT tables with length zero as + * missing. + * + */ + FT_EXPORT( FT_Error ) + FT_Sfnt_Table_Info( FT_Face face, + FT_UInt table_index, + FT_ULong *tag, + FT_ULong *length ); + + + /************************************************************************** + * + * @function: + * FT_Get_CMap_Language_ID + * + * @description: + * Return cmap language ID as specified in the OpenType standard. + * Definitions of language ID values are in file @FT_TRUETYPE_IDS_H. + * + * @input: + * charmap :: + * The target charmap. + * + * @return: + * The language ID of `charmap`. If `charmap` doesn't belong to an SFNT + * face, just return~0 as the default value. + * + * For a format~14 cmap (to access Unicode IVS), the return value is + * 0xFFFFFFFF. + */ + FT_EXPORT( FT_ULong ) + FT_Get_CMap_Language_ID( FT_CharMap charmap ); + + + /************************************************************************** + * + * @function: + * FT_Get_CMap_Format + * + * @description: + * Return the format of an SFNT 'cmap' table. + * + * @input: + * charmap :: + * The target charmap. + * + * @return: + * The format of `charmap`. If `charmap` doesn't belong to an SFNT face + * (including the synthetic Unicode charmap sometimes created by + * FreeType), return -1. + */ + FT_EXPORT( FT_Long ) + FT_Get_CMap_Format( FT_CharMap charmap ); + + /* */ + + +FT_END_HEADER + +#endif /* TTTABLES_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttags.h b/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttags.h new file mode 100644 index 0000000000000000000000000000000000000000..56bb0a3ee5e8547ad55db589437d260725ab0b5f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/freetype2/freetype/tttags.h @@ -0,0 +1,124 @@ +/**************************************************************************** + * + * tttags.h + * + * Tags for TrueType and OpenType tables (specification only). + * + * Copyright (C) 1996-2025 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#ifndef TTAGS_H_ +#define TTAGS_H_ + + +#include + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) +#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) +#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) +#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) +#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) +#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) +#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) +#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) +#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) +#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) +#define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' ) +#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) +#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) +#define TTAG_COLR FT_MAKE_TAG( 'C', 'O', 'L', 'R' ) +#define TTAG_CPAL FT_MAKE_TAG( 'C', 'P', 'A', 'L' ) +#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) +#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) +#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) +#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) +#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) +#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) +#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) +#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) +#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) +#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) +#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) +#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) +#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) +#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) +#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) +#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) +#define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' ) +#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) +#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) +#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) +#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) +#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) +#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) +#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) +#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) +#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) +#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) +#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) +#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) +#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) +#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) +#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) +#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) +#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) +#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) +#define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' ) +#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) +#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) +#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) +#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) +#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) +#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) +#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) +#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) +#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) +#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) +#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) +#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) +#define TTAG_SVG FT_MAKE_TAG( 'S', 'V', 'G', ' ' ) +#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) +#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) +#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) +#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) +#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) +#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) +#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) +#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) +#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) +#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) +#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +#define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' ) + +/* used by "Keyboard.dfont" on legacy Mac OS X */ +#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) + +/* used by "LastResort.dfont" on legacy Mac OS X */ +#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) + + +FT_END_HEADER + +#endif /* TTAGS_H_ */ + + +/* END */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLparser.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLparser.h new file mode 100644 index 0000000000000000000000000000000000000000..7be3d2b8a434ec7032faef1502a028865239bf23 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLparser.h @@ -0,0 +1,336 @@ +/* + * Summary: interface for an HTML 4.0 non-verifying parser + * Description: this module implements an HTML 4.0 non-verifying parser + * with API compatible with the XML parser ones. It should + * be able to parse "real world" HTML, even if severely + * broken from a specification point of view. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __HTML_PARSER_H__ +#define __HTML_PARSER_H__ +#include +#include + +#ifdef LIBXML_HTML_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Most of the back-end structures from XML and HTML are shared. + */ +typedef xmlParserCtxt htmlParserCtxt; +typedef xmlParserCtxtPtr htmlParserCtxtPtr; +typedef xmlParserNodeInfo htmlParserNodeInfo; +typedef xmlSAXHandler htmlSAXHandler; +typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; +typedef xmlParserInput htmlParserInput; +typedef xmlParserInputPtr htmlParserInputPtr; +typedef xmlDocPtr htmlDocPtr; +typedef xmlNodePtr htmlNodePtr; + +/* + * Internal description of an HTML element, representing HTML 4.01 + * and XHTML 1.0 (which share the same structure). + */ +typedef struct _htmlElemDesc htmlElemDesc; +typedef htmlElemDesc *htmlElemDescPtr; +struct _htmlElemDesc { + const char *name; /* The tag name */ + char startTag; /* Whether the start tag can be implied */ + char endTag; /* Whether the end tag can be implied */ + char saveEndTag; /* Whether the end tag should be saved */ + char empty; /* Is this an empty element ? */ + char depr; /* Is this a deprecated element ? */ + char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ + char isinline; /* is this a block 0 or inline 1 element */ + const char *desc; /* the description */ + +/* NRK Jan.2003 + * New fields encapsulating HTML structure + * + * Bugs: + * This is a very limited representation. It fails to tell us when + * an element *requires* subelements (we only have whether they're + * allowed or not), and it doesn't tell us where CDATA and PCDATA + * are allowed. Some element relationships are not fully represented: + * these are flagged with the word MODIFIER + */ + const char** subelts; /* allowed sub-elements of this element */ + const char* defaultsubelt; /* subelement for suggested auto-repair + if necessary or NULL */ + const char** attrs_opt; /* Optional Attributes */ + const char** attrs_depr; /* Additional deprecated attributes */ + const char** attrs_req; /* Required attributes */ +}; + +/* + * Internal description of an HTML entity. + */ +typedef struct _htmlEntityDesc htmlEntityDesc; +typedef htmlEntityDesc *htmlEntityDescPtr; +struct _htmlEntityDesc { + unsigned int value; /* the UNICODE value for the character */ + const char *name; /* The entity name */ + const char *desc; /* the description */ +}; + +#ifdef LIBXML_SAX1_ENABLED + +XML_DEPRECATED +XMLPUBVAR const xmlSAXHandlerV1 htmlDefaultSAXHandler; + +#ifdef LIBXML_THREAD_ENABLED +XML_DEPRECATED +XMLPUBFUN const xmlSAXHandlerV1 *__htmlDefaultSAXHandler(void); +#endif + +#endif /* LIBXML_SAX1_ENABLED */ + +/* + * There is only few public functions. + */ +XML_DEPRECATED +XMLPUBFUN void + htmlInitAutoClose (void); +XMLPUBFUN const htmlElemDesc * + htmlTagLookup (const xmlChar *tag); +XMLPUBFUN const htmlEntityDesc * + htmlEntityLookup(const xmlChar *name); +XMLPUBFUN const htmlEntityDesc * + htmlEntityValueLookup(unsigned int value); + +XMLPUBFUN int + htmlIsAutoClosed(htmlDocPtr doc, + htmlNodePtr elem); +XMLPUBFUN int + htmlAutoCloseTag(htmlDocPtr doc, + const xmlChar *name, + htmlNodePtr elem); +XML_DEPRECATED +XMLPUBFUN const htmlEntityDesc * + htmlParseEntityRef(htmlParserCtxtPtr ctxt, + const xmlChar **str); +XML_DEPRECATED +XMLPUBFUN int + htmlParseCharRef(htmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + htmlParseElement(htmlParserCtxtPtr ctxt); + +XMLPUBFUN htmlParserCtxtPtr + htmlNewParserCtxt(void); +XMLPUBFUN htmlParserCtxtPtr + htmlNewSAXParserCtxt(const htmlSAXHandler *sax, + void *userData); + +XMLPUBFUN htmlParserCtxtPtr + htmlCreateMemoryParserCtxt(const char *buffer, + int size); + +XMLPUBFUN int + htmlParseDocument(htmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN htmlDocPtr + htmlSAXParseDoc (const xmlChar *cur, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr + htmlParseDoc (const xmlChar *cur, + const char *encoding); +XMLPUBFUN htmlParserCtxtPtr + htmlCreateFileParserCtxt(const char *filename, + const char *encoding); +XML_DEPRECATED +XMLPUBFUN htmlDocPtr + htmlSAXParseFile(const char *filename, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr + htmlParseFile (const char *filename, + const char *encoding); +XMLPUBFUN int + UTF8ToHtml (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +XMLPUBFUN int + htmlEncodeEntities(unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen, int quoteChar); +XMLPUBFUN int + htmlIsScriptAttribute(const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN int + htmlHandleOmittedElem(int val); + +#ifdef LIBXML_PUSH_ENABLED +/** + * Interfaces for the Push mode. + */ +XMLPUBFUN htmlParserCtxtPtr + htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename, + xmlCharEncoding enc); +XMLPUBFUN int + htmlParseChunk (htmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +XMLPUBFUN void + htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ + HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ + HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ + HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + HTML_PARSE_NONET = 1<<11,/* Forbid network access */ + HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ + HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ + HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ +} htmlParserOption; + +XMLPUBFUN void + htmlCtxtReset (htmlParserCtxtPtr ctxt); +XMLPUBFUN int + htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN htmlDocPtr + htmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlReadFile (const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlCtxtParseDocument (htmlParserCtxtPtr ctxt, + xmlParserInputPtr input); +XMLPUBFUN htmlDocPtr + htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr + htmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +/* NRK/Jan2003: further knowledge of HTML structure + */ +typedef enum { + HTML_NA = 0 , /* something we don't check at all */ + HTML_INVALID = 0x1 , + HTML_DEPRECATED = 0x2 , + HTML_VALID = 0x4 , + HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ +} htmlStatus ; + +/* Using htmlElemDesc rather than name here, to emphasise the fact + that otherwise there's a lookup overhead +*/ +XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; +XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; +XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; +XMLPUBFUN htmlStatus htmlNodeStatus(htmlNodePtr, int) ; +/** + * htmlDefaultSubelement: + * @elt: HTML element + * + * Returns the default subelement for this element + */ +#define htmlDefaultSubelement(elt) elt->defaultsubelt +/** + * htmlElementAllowedHereDesc: + * @parent: HTML parent element + * @elt: HTML element + * + * Checks whether an HTML element description may be a + * direct child of the specified element. + * + * Returns 1 if allowed; 0 otherwise. + */ +#define htmlElementAllowedHereDesc(parent,elt) \ + htmlElementAllowedHere((parent), (elt)->name) +/** + * htmlRequiredAttrs: + * @elt: HTML element + * + * Returns the attributes required for the specified element. + */ +#define htmlRequiredAttrs(elt) (elt)->attrs_req + + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTML_ENABLED */ +#endif /* __HTML_PARSER_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLtree.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLtree.h new file mode 100644 index 0000000000000000000000000000000000000000..8e1ba90e9157b3bb7ad47b13f9ceae99cc748a13 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/HTMLtree.h @@ -0,0 +1,147 @@ +/* + * Summary: specific APIs to process HTML tree, especially serialization + * Description: this module implements a few function needed to process + * tree in an HTML specific way. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __HTML_TREE_H__ +#define __HTML_TREE_H__ + +#include +#include +#include +#include + +#ifdef LIBXML_HTML_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * HTML_TEXT_NODE: + * + * Macro. A text node in a HTML document is really implemented + * the same way as a text node in an XML document. + */ +#define HTML_TEXT_NODE XML_TEXT_NODE +/** + * HTML_ENTITY_REF_NODE: + * + * Macro. An entity reference in a HTML document is really implemented + * the same way as an entity reference in an XML document. + */ +#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE +/** + * HTML_COMMENT_NODE: + * + * Macro. A comment in a HTML document is really implemented + * the same way as a comment in an XML document. + */ +#define HTML_COMMENT_NODE XML_COMMENT_NODE +/** + * HTML_PRESERVE_NODE: + * + * Macro. A preserved node in a HTML document is really implemented + * the same way as a CDATA section in an XML document. + */ +#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +/** + * HTML_PI_NODE: + * + * Macro. A processing instruction in a HTML document is really implemented + * the same way as a processing instruction in an XML document. + */ +#define HTML_PI_NODE XML_PI_NODE + +XMLPUBFUN htmlDocPtr + htmlNewDoc (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN htmlDocPtr + htmlNewDocNoDtD (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN const xmlChar * + htmlGetMetaEncoding (htmlDocPtr doc); +XMLPUBFUN int + htmlSetMetaEncoding (htmlDocPtr doc, + const xmlChar *encoding); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + htmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN void + htmlDocDumpMemoryFormat (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); +XMLPUBFUN int + htmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN int + htmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int + htmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN void + htmlNodeDumpFile (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN int + htmlNodeDumpFileFormat (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +XMLPUBFUN int + htmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int + htmlSaveFileFormat (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN void + htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +XMLPUBFUN void + htmlDocContentDumpOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN void + htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); +XMLPUBFUN void + htmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ + +XMLPUBFUN int + htmlIsBooleanAttr (const xmlChar *name); + + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTML_ENABLED */ + +#endif /* __HTML_TREE_H__ */ + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX.h new file mode 100644 index 0000000000000000000000000000000000000000..eea1057bfcc533cd2309a4de73767f004c97380f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX.h @@ -0,0 +1,202 @@ +/* + * Summary: Old SAX version 1 handler, deprecated + * Description: DEPRECATED set of SAX version 1 interfaces used to + * build the DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SAX_H__ +#define __XML_SAX_H__ + +#include +#include + +#ifdef LIBXML_LEGACY_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif +XML_DEPRECATED +XMLPUBFUN const xmlChar * + getPublicId (void *ctx); +XML_DEPRECATED +XMLPUBFUN const xmlChar * + getSystemId (void *ctx); +XML_DEPRECATED +XMLPUBFUN void + setDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XML_DEPRECATED +XMLPUBFUN int + getLineNumber (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + getColumnNumber (void *ctx); + +XML_DEPRECATED +XMLPUBFUN int + isStandalone (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + hasInternalSubset (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + hasExternalSubset (void *ctx); + +XML_DEPRECATED +XMLPUBFUN void + internalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XML_DEPRECATED +XMLPUBFUN void + externalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XML_DEPRECATED +XMLPUBFUN xmlEntityPtr + getEntity (void *ctx, + const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN xmlEntityPtr + getParameterEntity (void *ctx, + const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN xmlParserInputPtr + resolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XML_DEPRECATED +XMLPUBFUN void + entityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XML_DEPRECATED +XMLPUBFUN void + attributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XML_DEPRECATED +XMLPUBFUN void + elementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XML_DEPRECATED +XMLPUBFUN void + notationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XML_DEPRECATED +XMLPUBFUN void + unparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XML_DEPRECATED +XMLPUBFUN void + startDocument (void *ctx); +XML_DEPRECATED +XMLPUBFUN void + endDocument (void *ctx); +XML_DEPRECATED +XMLPUBFUN void + attribute (void *ctx, + const xmlChar *fullname, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN void + startElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XML_DEPRECATED +XMLPUBFUN void + endElement (void *ctx, + const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN void + reference (void *ctx, + const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN void + characters (void *ctx, + const xmlChar *ch, + int len); +XML_DEPRECATED +XMLPUBFUN void + ignorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XML_DEPRECATED +XMLPUBFUN void + processingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XML_DEPRECATED +XMLPUBFUN void + globalNamespace (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XML_DEPRECATED +XMLPUBFUN void + setNamespace (void *ctx, + const xmlChar *name); +XML_DEPRECATED +XMLPUBFUN xmlNsPtr + getNamespace (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + checkNamespace (void *ctx, + xmlChar *nameSpace); +XML_DEPRECATED +XMLPUBFUN void + namespaceDecl (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XML_DEPRECATED +XMLPUBFUN void + comment (void *ctx, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN void + cdataBlock (void *ctx, + const xmlChar *value, + int len); + +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN void + initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XML_DEPRECATED +XMLPUBFUN void + inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); +#endif +#endif /* LIBXML_SAX1_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_LEGACY_ENABLED */ + +#endif /* __XML_SAX_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX2.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX2.h new file mode 100644 index 0000000000000000000000000000000000000000..4c4ecce8e598b2bb2011f9daf6367bcc8f028b88 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/SAX2.h @@ -0,0 +1,171 @@ +/* + * Summary: SAX2 parser interface used to build the DOM tree + * Description: those are the default SAX2 interfaces used by + * the library when building DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SAX2_H__ +#define __XML_SAX2_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN const xmlChar * + xmlSAX2GetPublicId (void *ctx); +XMLPUBFUN const xmlChar * + xmlSAX2GetSystemId (void *ctx); +XMLPUBFUN void + xmlSAX2SetDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XMLPUBFUN int + xmlSAX2GetLineNumber (void *ctx); +XMLPUBFUN int + xmlSAX2GetColumnNumber (void *ctx); + +XMLPUBFUN int + xmlSAX2IsStandalone (void *ctx); +XMLPUBFUN int + xmlSAX2HasInternalSubset (void *ctx); +XMLPUBFUN int + xmlSAX2HasExternalSubset (void *ctx); + +XMLPUBFUN void + xmlSAX2InternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN void + xmlSAX2ExternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlEntityPtr + xmlSAX2GetEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr + xmlSAX2GetParameterEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlParserInputPtr + xmlSAX2ResolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XMLPUBFUN void + xmlSAX2EntityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XMLPUBFUN void + xmlSAX2AttributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN void + xmlSAX2ElementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XMLPUBFUN void + xmlSAX2NotationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XMLPUBFUN void + xmlSAX2UnparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XMLPUBFUN void + xmlSAX2StartDocument (void *ctx); +XMLPUBFUN void + xmlSAX2EndDocument (void *ctx); +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +XMLPUBFUN void + xmlSAX2StartElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XMLPUBFUN void + xmlSAX2EndElement (void *ctx, + const xmlChar *name); +#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */ +XMLPUBFUN void + xmlSAX2StartElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); +XMLPUBFUN void + xmlSAX2EndElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); +XMLPUBFUN void + xmlSAX2Reference (void *ctx, + const xmlChar *name); +XMLPUBFUN void + xmlSAX2Characters (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void + xmlSAX2IgnorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void + xmlSAX2ProcessingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XMLPUBFUN void + xmlSAX2Comment (void *ctx, + const xmlChar *value); +XMLPUBFUN void + xmlSAX2CDataBlock (void *ctx, + const xmlChar *value, + int len); + +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN int + xmlSAXDefaultVersion (int version); +#endif /* LIBXML_SAX1_ENABLED */ + +XMLPUBFUN int + xmlSAXVersion (xmlSAXHandler *hdlr, + int version); +XMLPUBFUN void + xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN void + xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); +XML_DEPRECATED +XMLPUBFUN void + htmlDefaultSAXHandlerInit (void); +#endif +XML_DEPRECATED +XMLPUBFUN void + xmlDefaultSAXHandlerInit (void); +#ifdef __cplusplus +} +#endif +#endif /* __XML_SAX2_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/c14n.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/c14n.h new file mode 100644 index 0000000000000000000000000000000000000000..8ccd1cef632e920751aefa6a8b112e2be660bc2d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/c14n.h @@ -0,0 +1,115 @@ +/* + * Summary: Provide Canonical XML and Exclusive XML Canonicalization + * Description: the c14n modules provides a + * + * "Canonical XML" implementation + * http://www.w3.org/TR/xml-c14n + * + * and an + * + * "Exclusive XML Canonicalization" implementation + * http://www.w3.org/TR/xml-exc-c14n + + * Copy: See Copyright for the status of this software. + * + * Author: Aleksey Sanin + */ +#ifndef __XML_C14N_H__ +#define __XML_C14N_H__ + +#include + +#ifdef LIBXML_C14N_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * XML Canonicalization + * http://www.w3.org/TR/xml-c14n + * + * Exclusive XML Canonicalization + * http://www.w3.org/TR/xml-exc-c14n + * + * Canonical form of an XML document could be created if and only if + * a) default attributes (if any) are added to all nodes + * b) all character and parsed entity references are resolved + * In order to achieve this in libxml2 the document MUST be loaded with + * following options: XML_PARSE_DTDATTR | XML_PARSE_NOENT + */ + +/* + * xmlC14NMode: + * + * Predefined values for C14N modes + * + */ +typedef enum { + XML_C14N_1_0 = 0, /* Original C14N 1.0 spec */ + XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ + XML_C14N_1_1 = 2 /* C14N 1.1 spec */ +} xmlC14NMode; + +XMLPUBFUN int + xmlC14NDocSaveTo (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +XMLPUBFUN int + xmlC14NDocDumpMemory (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlChar **doc_txt_ptr); + +XMLPUBFUN int + xmlC14NDocSave (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + const char* filename, + int compression); + + +/** + * This is the core C14N function + */ +/** + * xmlC14NIsVisibleCallback: + * @user_data: user data + * @node: the current node + * @parent: the parent node + * + * Signature for a C14N callback on visible nodes + * + * Returns 1 if the node should be included + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, + xmlNodePtr node, + xmlNodePtr parent); + +XMLPUBFUN int + xmlC14NExecute (xmlDocPtr doc, + xmlC14NIsVisibleCallback is_visible_callback, + void* user_data, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBXML_C14N_ENABLED */ +#endif /* __XML_C14N_H__ */ + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/catalog.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/catalog.h new file mode 100644 index 0000000000000000000000000000000000000000..02fa7ab2a03a95563cf4ccdf7b644c95af1b15c2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/catalog.h @@ -0,0 +1,182 @@ +/** + * Summary: interfaces to the Catalog handling system + * Description: the catalog module implements the support for + * XML Catalogs and SGML catalogs + * + * SGML Open Technical Resolution TR9401:1997. + * http://www.jclark.com/sp/catalog.htm + * + * XML Catalogs Working Draft 06 August 2001 + * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_CATALOG_H__ +#define __XML_CATALOG_H__ + +#include + +#include +#include +#include + +#ifdef LIBXML_CATALOG_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_CATALOGS_NAMESPACE: + * + * The namespace for the XML Catalogs elements. + */ +#define XML_CATALOGS_NAMESPACE \ + (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" +/** + * XML_CATALOG_PI: + * + * The specific XML Catalog Processing Instruction name. + */ +#define XML_CATALOG_PI \ + (const xmlChar *) "oasis-xml-catalog" + +/* + * The API is voluntarily limited to general cataloging. + */ +typedef enum { + XML_CATA_PREFER_NONE = 0, + XML_CATA_PREFER_PUBLIC = 1, + XML_CATA_PREFER_SYSTEM +} xmlCatalogPrefer; + +typedef enum { + XML_CATA_ALLOW_NONE = 0, + XML_CATA_ALLOW_GLOBAL = 1, + XML_CATA_ALLOW_DOCUMENT = 2, + XML_CATA_ALLOW_ALL = 3 +} xmlCatalogAllow; + +typedef struct _xmlCatalog xmlCatalog; +typedef xmlCatalog *xmlCatalogPtr; + +/* + * Operations on a given catalog. + */ +XMLPUBFUN xmlCatalogPtr + xmlNewCatalog (int sgml); +XMLPUBFUN xmlCatalogPtr + xmlLoadACatalog (const char *filename); +XMLPUBFUN xmlCatalogPtr + xmlLoadSGMLSuperCatalog (const char *filename); +XMLPUBFUN int + xmlConvertSGMLCatalog (xmlCatalogPtr catal); +XMLPUBFUN int + xmlACatalogAdd (xmlCatalogPtr catal, + const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +XMLPUBFUN int + xmlACatalogRemove (xmlCatalogPtr catal, + const xmlChar *value); +XMLPUBFUN xmlChar * + xmlACatalogResolve (xmlCatalogPtr catal, + const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * + xmlACatalogResolveSystem(xmlCatalogPtr catal, + const xmlChar *sysID); +XMLPUBFUN xmlChar * + xmlACatalogResolvePublic(xmlCatalogPtr catal, + const xmlChar *pubID); +XMLPUBFUN xmlChar * + xmlACatalogResolveURI (xmlCatalogPtr catal, + const xmlChar *URI); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlACatalogDump (xmlCatalogPtr catal, + FILE *out); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN void + xmlFreeCatalog (xmlCatalogPtr catal); +XMLPUBFUN int + xmlCatalogIsEmpty (xmlCatalogPtr catal); + +/* + * Global operations. + */ +XMLPUBFUN void + xmlInitializeCatalog (void); +XMLPUBFUN int + xmlLoadCatalog (const char *filename); +XMLPUBFUN void + xmlLoadCatalogs (const char *paths); +XMLPUBFUN void + xmlCatalogCleanup (void); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlCatalogDump (FILE *out); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN xmlChar * + xmlCatalogResolve (const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * + xmlCatalogResolveSystem (const xmlChar *sysID); +XMLPUBFUN xmlChar * + xmlCatalogResolvePublic (const xmlChar *pubID); +XMLPUBFUN xmlChar * + xmlCatalogResolveURI (const xmlChar *URI); +XMLPUBFUN int + xmlCatalogAdd (const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +XMLPUBFUN int + xmlCatalogRemove (const xmlChar *value); +XMLPUBFUN xmlDocPtr + xmlParseCatalogFile (const char *filename); +XMLPUBFUN int + xmlCatalogConvert (void); + +/* + * Strictly minimal interfaces for per-document catalogs used + * by the parser. + */ +XMLPUBFUN void + xmlCatalogFreeLocal (void *catalogs); +XMLPUBFUN void * + xmlCatalogAddLocal (void *catalogs, + const xmlChar *URL); +XMLPUBFUN xmlChar * + xmlCatalogLocalResolve (void *catalogs, + const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * + xmlCatalogLocalResolveURI(void *catalogs, + const xmlChar *URI); +/* + * Preference settings. + */ +XMLPUBFUN int + xmlCatalogSetDebug (int level); +XMLPUBFUN xmlCatalogPrefer + xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); +XMLPUBFUN void + xmlCatalogSetDefaults (xmlCatalogAllow allow); +XMLPUBFUN xmlCatalogAllow + xmlCatalogGetDefaults (void); + + +/* DEPRECATED interfaces */ +XMLPUBFUN const xmlChar * + xmlCatalogGetSystem (const xmlChar *sysID); +XMLPUBFUN const xmlChar * + xmlCatalogGetPublic (const xmlChar *pubID); + +#ifdef __cplusplus +} +#endif +#endif /* LIBXML_CATALOG_ENABLED */ +#endif /* __XML_CATALOG_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/chvalid.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/chvalid.h new file mode 100644 index 0000000000000000000000000000000000000000..8225c95ee865f9639f46bd22db54932f257df52c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/chvalid.h @@ -0,0 +1,230 @@ +/* + * Summary: Unicode character range checking + * Description: this module exports interfaces for the character + * range validation APIs + * + * This file is automatically generated from the cvs source + * definition files using the genChRanges.py Python script + * + * Generation date: Mon Mar 27 11:09:48 2006 + * Sources: chvalid.def + * Author: William Brack + */ + +#ifndef __XML_CHVALID_H__ +#define __XML_CHVALID_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define our typedefs and structures + * + */ +typedef struct _xmlChSRange xmlChSRange; +typedef xmlChSRange *xmlChSRangePtr; +struct _xmlChSRange { + unsigned short low; + unsigned short high; +}; + +typedef struct _xmlChLRange xmlChLRange; +typedef xmlChLRange *xmlChLRangePtr; +struct _xmlChLRange { + unsigned int low; + unsigned int high; +}; + +typedef struct _xmlChRangeGroup xmlChRangeGroup; +typedef xmlChRangeGroup *xmlChRangeGroupPtr; +struct _xmlChRangeGroup { + int nbShortRange; + int nbLongRange; + const xmlChSRange *shortRange; /* points to an array of ranges */ + const xmlChLRange *longRange; +}; + +/** + * Range checking routine + */ +XMLPUBFUN int + xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); + + +/** + * xmlIsBaseChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ + ((0x61 <= (c)) && ((c) <= 0x7a)) || \ + ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ + ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ + (0xf8 <= (c))) + +/** + * xmlIsBaseCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ + xmlIsBaseChar_ch((c)) : \ + xmlCharInRange((c), &xmlIsBaseCharGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; + +/** + * xmlIsBlank_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBlank_ch(c) (((c) == 0x20) || \ + ((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd)) + +/** + * xmlIsBlankQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBlankQ(c) (((c) < 0x100) ? \ + xmlIsBlank_ch((c)) : 0) + + +/** + * xmlIsChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd) || \ + (0x20 <= (c))) + +/** + * xmlIsCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCharQ(c) (((c) < 0x100) ? \ + xmlIsChar_ch((c)) :\ + (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ + ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ + ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) + +XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; + +/** + * xmlIsCombiningQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ + 0 : \ + xmlCharInRange((c), &xmlIsCombiningGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; + +/** + * xmlIsDigit_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) + +/** + * xmlIsDigitQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigitQ(c) (((c) < 0x100) ? \ + xmlIsDigit_ch((c)) : \ + xmlCharInRange((c), &xmlIsDigitGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; + +/** + * xmlIsExtender_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtender_ch(c) (((c) == 0xb7)) + +/** + * xmlIsExtenderQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ + xmlIsExtender_ch((c)) : \ + xmlCharInRange((c), &xmlIsExtenderGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; + +/** + * xmlIsIdeographicQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ + 0 :\ + (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ + ((c) == 0x3007) || \ + ((0x3021 <= (c)) && ((c) <= 0x3029)))) + +XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; +XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; + +/** + * xmlIsPubidChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) + +/** + * xmlIsPubidCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ + xmlIsPubidChar_ch((c)) : 0) + +XMLPUBFUN int + xmlIsBaseChar(unsigned int ch); +XMLPUBFUN int + xmlIsBlank(unsigned int ch); +XMLPUBFUN int + xmlIsChar(unsigned int ch); +XMLPUBFUN int + xmlIsCombining(unsigned int ch); +XMLPUBFUN int + xmlIsDigit(unsigned int ch); +XMLPUBFUN int + xmlIsExtender(unsigned int ch); +XMLPUBFUN int + xmlIsIdeographic(unsigned int ch); +XMLPUBFUN int + xmlIsPubidChar(unsigned int ch); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_CHVALID_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/debugXML.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/debugXML.h new file mode 100644 index 0000000000000000000000000000000000000000..1332dd73d9c774625c00560e9962cffc995f6059 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/debugXML.h @@ -0,0 +1,217 @@ +/* + * Summary: Tree debugging APIs + * Description: Interfaces to a set of routines used for debugging the tree + * produced by the XML parser. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __DEBUG_XML__ +#define __DEBUG_XML__ +#include +#include +#include + +#ifdef LIBXML_DEBUG_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The standard Dump routines. + */ +XMLPUBFUN void + xmlDebugDumpString (FILE *output, + const xmlChar *str); +XMLPUBFUN void + xmlDebugDumpAttr (FILE *output, + xmlAttrPtr attr, + int depth); +XMLPUBFUN void + xmlDebugDumpAttrList (FILE *output, + xmlAttrPtr attr, + int depth); +XMLPUBFUN void + xmlDebugDumpOneNode (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void + xmlDebugDumpNode (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void + xmlDebugDumpNodeList (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void + xmlDebugDumpDocumentHead(FILE *output, + xmlDocPtr doc); +XMLPUBFUN void + xmlDebugDumpDocument (FILE *output, + xmlDocPtr doc); +XMLPUBFUN void + xmlDebugDumpDTD (FILE *output, + xmlDtdPtr dtd); +XMLPUBFUN void + xmlDebugDumpEntities (FILE *output, + xmlDocPtr doc); + +/**************************************************************** + * * + * Checking routines * + * * + ****************************************************************/ + +XMLPUBFUN int + xmlDebugCheckDocument (FILE * output, + xmlDocPtr doc); + +/**************************************************************** + * * + * XML shell helpers * + * * + ****************************************************************/ + +XMLPUBFUN void + xmlLsOneNode (FILE *output, xmlNodePtr node); +XMLPUBFUN int + xmlLsCountNode (xmlNodePtr node); + +XMLPUBFUN const char * + xmlBoolToText (int boolval); + +/**************************************************************** + * * + * The XML shell related structures and functions * + * * + ****************************************************************/ + +#ifdef LIBXML_XPATH_ENABLED +/** + * xmlShellReadlineFunc: + * @prompt: a string prompt + * + * This is a generic signature for the XML shell input function. + * + * Returns a string which will be freed by the Shell. + */ +typedef char * (* xmlShellReadlineFunc)(char *prompt); + +/** + * xmlShellCtxt: + * + * A debugging shell context. + * TODO: add the defined function tables. + */ +typedef struct _xmlShellCtxt xmlShellCtxt; +typedef xmlShellCtxt *xmlShellCtxtPtr; +struct _xmlShellCtxt { + char *filename; + xmlDocPtr doc; + xmlNodePtr node; + xmlXPathContextPtr pctxt; + int loaded; + FILE *output; + xmlShellReadlineFunc input; +}; + +/** + * xmlShellCmd: + * @ctxt: a shell context + * @arg: a string argument + * @node: a first node + * @node2: a second node + * + * This is a generic signature for the XML shell functions. + * + * Returns an int, negative returns indicating errors. + */ +typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); + +XMLPUBFUN void + xmlShellPrintXPathError (int errorType, + const char *arg); +XMLPUBFUN void + xmlShellPrintXPathResult(xmlXPathObjectPtr list); +XMLPUBFUN int + xmlShellList (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellBase (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellDir (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellLoad (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlShellPrintNode (xmlNodePtr node); +XMLPUBFUN int + xmlShellCat (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellWrite (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellSave (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +#endif /* LIBXML_OUTPUT_ENABLED */ +#ifdef LIBXML_VALID_ENABLED +XMLPUBFUN int + xmlShellValidate (xmlShellCtxtPtr ctxt, + char *dtd, + xmlNodePtr node, + xmlNodePtr node2); +#endif /* LIBXML_VALID_ENABLED */ +XMLPUBFUN int + xmlShellDu (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr tree, + xmlNodePtr node2); +XMLPUBFUN int + xmlShellPwd (xmlShellCtxtPtr ctxt, + char *buffer, + xmlNodePtr node, + xmlNodePtr node2); + +/* + * The Shell interface. + */ +XMLPUBFUN void + xmlShell (xmlDocPtr doc, + const char *filename, + xmlShellReadlineFunc input, + FILE *output); + +#endif /* LIBXML_XPATH_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_DEBUG_ENABLED */ +#endif /* __DEBUG_XML__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/dict.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/dict.h new file mode 100644 index 0000000000000000000000000000000000000000..22aa3d9db8b56b252b28c3ef17b814f6c6df44c0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/dict.h @@ -0,0 +1,82 @@ +/* + * Summary: string dictionary + * Description: dictionary of reusable strings, just used to avoid allocation + * and freeing operations. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_DICT_H__ +#define __XML_DICT_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The dictionary. + */ +typedef struct _xmlDict xmlDict; +typedef xmlDict *xmlDictPtr; + +/* + * Initializer + */ +XML_DEPRECATED +XMLPUBFUN int xmlInitializeDict(void); + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlDictPtr + xmlDictCreate (void); +XMLPUBFUN size_t + xmlDictSetLimit (xmlDictPtr dict, + size_t limit); +XMLPUBFUN size_t + xmlDictGetUsage (xmlDictPtr dict); +XMLPUBFUN xmlDictPtr + xmlDictCreateSub(xmlDictPtr sub); +XMLPUBFUN int + xmlDictReference(xmlDictPtr dict); +XMLPUBFUN void + xmlDictFree (xmlDictPtr dict); + +/* + * Lookup of entry in the dictionary. + */ +XMLPUBFUN const xmlChar * + xmlDictLookup (xmlDictPtr dict, + const xmlChar *name, + int len); +XMLPUBFUN const xmlChar * + xmlDictExists (xmlDictPtr dict, + const xmlChar *name, + int len); +XMLPUBFUN const xmlChar * + xmlDictQLookup (xmlDictPtr dict, + const xmlChar *prefix, + const xmlChar *name); +XMLPUBFUN int + xmlDictOwns (xmlDictPtr dict, + const xmlChar *str); +XMLPUBFUN int + xmlDictSize (xmlDictPtr dict); + +/* + * Cleanup function + */ +XML_DEPRECATED +XMLPUBFUN void + xmlDictCleanup (void); + +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_DICT_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/encoding.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..599a03e12cd5c47d181500371ebe1e6579d4e02d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/encoding.h @@ -0,0 +1,244 @@ +/* + * Summary: interface for the encoding conversion functions + * Description: interface for the encoding conversion functions needed for + * XML basic encoding and iconv() support. + * + * Related specs are + * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies + * [ISO-10646] UTF-8 and UTF-16 in Annexes + * [ISO-8859-1] ISO Latin-1 characters codes. + * [UNICODE] The Unicode Consortium, "The Unicode Standard -- + * Worldwide Character Encoding -- Version 1.0", Addison- + * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is + * described in Unicode Technical Report #4. + * [US-ASCII] Coded Character Set--7-bit American Standard Code for + * Information Interchange, ANSI X3.4-1986. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_CHAR_ENCODING_H__ +#define __XML_CHAR_ENCODING_H__ + +#include + +#ifdef LIBXML_ICONV_ENABLED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_ENC_ERR_SUCCESS = 0, + XML_ENC_ERR_SPACE = -1, + XML_ENC_ERR_INPUT = -2, + XML_ENC_ERR_PARTIAL = -3, + XML_ENC_ERR_INTERNAL = -4, + XML_ENC_ERR_MEMORY = -5 +} xmlCharEncError; + +/* + * xmlCharEncoding: + * + * Predefined values for some standard encodings. + * Libxml does not do beforehand translation on UTF8 and ISOLatinX. + * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. + * + * Anything else would have to be translated to UTF8 before being + * given to the parser itself. The BOM for UTF16 and the encoding + * declaration are looked at and a converter is looked for at that + * point. If not found the parser stops here as asked by the XML REC. A + * converter can be registered by the user using xmlRegisterCharEncodingHandler + * but the current form doesn't allow stateful transcoding (a serious + * problem agreed !). If iconv has been found it will be used + * automatically and allow stateful transcoding, the simplest is then + * to be sure to enable iconv and to provide iconv libs for the encoding + * support needed. + * + * Note that the generic "UTF-16" is not a predefined value. Instead, only + * the specific UTF-16LE and UTF-16BE are present. + */ +typedef enum { + XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ + XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ + XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ + XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ + XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ + XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ + XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ + XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ + XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ + XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ + XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ + XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ + XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ + XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ + XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ + XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ + XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ + XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ + XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ + XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ + XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ + XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ +} xmlCharEncoding; + +/** + * xmlCharEncodingInputFunc: + * @out: a pointer to an array of bytes to store the UTF-8 result + * @outlen: the length of @out + * @in: a pointer to an array of chars in the original encoding + * @inlen: the length of @in + * + * Take a block of chars in the original encoding and try to convert + * it to an UTF-8 block of chars out. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of @inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of @outlen after return is the number of octets consumed. + */ +typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/** + * xmlCharEncodingOutputFunc: + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of UTF-8 chars + * @inlen: the length of @in + * + * Take a block of UTF-8 chars in and try to convert it to another + * encoding. + * Note: a first call designed to produce heading info is called with + * in = NULL. If stateful this should also initialize the encoder state. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of @inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of @outlen after return is the number of octets produced. + */ +typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/* + * Block defining the handlers for non UTF-8 encodings. + * If iconv is supported, there are two extra fields. + */ +typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; +typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; +struct _xmlCharEncodingHandler { + char *name; + xmlCharEncodingInputFunc input; + xmlCharEncodingOutputFunc output; +#ifdef LIBXML_ICONV_ENABLED + iconv_t iconv_in; + iconv_t iconv_out; +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + struct _uconv_t *uconv_in; + struct _uconv_t *uconv_out; +#endif /* LIBXML_ICU_ENABLED */ +}; + +/* + * Interfaces for encoding handlers. + */ +XML_DEPRECATED +XMLPUBFUN void + xmlInitCharEncodingHandlers (void); +XML_DEPRECATED +XMLPUBFUN void + xmlCleanupCharEncodingHandlers (void); +XMLPUBFUN void + xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); +XMLPUBFUN int + xmlLookupCharEncodingHandler (xmlCharEncoding enc, + xmlCharEncodingHandlerPtr *out); +XMLPUBFUN int + xmlOpenCharEncodingHandler (const char *name, + int output, + xmlCharEncodingHandlerPtr *out); +XMLPUBFUN xmlCharEncodingHandlerPtr + xmlGetCharEncodingHandler (xmlCharEncoding enc); +XMLPUBFUN xmlCharEncodingHandlerPtr + xmlFindCharEncodingHandler (const char *name); +XMLPUBFUN xmlCharEncodingHandlerPtr + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); + +/* + * Interfaces for encoding names and aliases. + */ +XMLPUBFUN int + xmlAddEncodingAlias (const char *name, + const char *alias); +XMLPUBFUN int + xmlDelEncodingAlias (const char *alias); +XMLPUBFUN const char * + xmlGetEncodingAlias (const char *alias); +XMLPUBFUN void + xmlCleanupEncodingAliases (void); +XMLPUBFUN xmlCharEncoding + xmlParseCharEncoding (const char *name); +XMLPUBFUN const char * + xmlGetCharEncodingName (xmlCharEncoding enc); + +/* + * Interfaces directly used by the parsers. + */ +XMLPUBFUN xmlCharEncoding + xmlDetectCharEncoding (const unsigned char *in, + int len); + +/** DOC_DISABLE */ +struct _xmlBuffer; +/** DOC_ENABLE */ +XMLPUBFUN int + xmlCharEncOutFunc (xmlCharEncodingHandler *handler, + struct _xmlBuffer *out, + struct _xmlBuffer *in); + +XMLPUBFUN int + xmlCharEncInFunc (xmlCharEncodingHandler *handler, + struct _xmlBuffer *out, + struct _xmlBuffer *in); +XML_DEPRECATED +XMLPUBFUN int + xmlCharEncFirstLine (xmlCharEncodingHandler *handler, + struct _xmlBuffer *out, + struct _xmlBuffer *in); +XMLPUBFUN int + xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); + +/* + * Export a few useful functions + */ +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN int + UTF8Toisolat1 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN int + isolat1ToUTF8 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/entities.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/entities.h new file mode 100644 index 0000000000000000000000000000000000000000..a0cfca8133f660b2b93d069003c0f69ca36c34fc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/entities.h @@ -0,0 +1,166 @@ +/* + * Summary: interface for the XML entities handling + * Description: this module provides some of the entity API needed + * for the parser and applications. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_ENTITIES_H__ +#define __XML_ENTITIES_H__ + +/** DOC_DISABLE */ +#include +#define XML_TREE_INTERNALS +#include +#undef XML_TREE_INTERNALS +/** DOC_ENABLE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The different valid entity types. + */ +typedef enum { + XML_INTERNAL_GENERAL_ENTITY = 1, + XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, + XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, + XML_INTERNAL_PARAMETER_ENTITY = 4, + XML_EXTERNAL_PARAMETER_ENTITY = 5, + XML_INTERNAL_PREDEFINED_ENTITY = 6 +} xmlEntityType; + +/* + * An unit of storage for an entity, contains the string, the value + * and the linkind data needed for the linking in the hash table. + */ + +struct _xmlEntity { + void *_private; /* application data */ + xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ + const xmlChar *name; /* Entity name */ + struct _xmlNode *children; /* First child link */ + struct _xmlNode *last; /* Last child link */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + xmlChar *orig; /* content without ref substitution */ + xmlChar *content; /* content or ndata if unparsed */ + int length; /* the content length */ + xmlEntityType etype; /* The entity type */ + const xmlChar *ExternalID; /* External identifier for PUBLIC */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ + + struct _xmlEntity *nexte; /* unused */ + const xmlChar *URI; /* the full URI as computed */ + int owner; /* unused */ + int flags; /* various flags */ + unsigned long expandedSize; /* expanded size */ +}; + +/* + * All entities are stored in an hash table. + * There is 2 separate hash tables for global and parameter entities. + */ + +typedef struct _xmlHashTable xmlEntitiesTable; +typedef xmlEntitiesTable *xmlEntitiesTablePtr; + +/* + * External functions: + */ + +#ifdef LIBXML_LEGACY_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlInitializePredefinedEntities (void); +#endif /* LIBXML_LEGACY_ENABLED */ + +XMLPUBFUN xmlEntityPtr + xmlNewEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN void + xmlFreeEntity (xmlEntityPtr entity); +XMLPUBFUN int + xmlAddEntity (xmlDocPtr doc, + int extSubset, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content, + xmlEntityPtr *out); +XMLPUBFUN xmlEntityPtr + xmlAddDocEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr + xmlAddDtdEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr + xmlGetPredefinedEntity (const xmlChar *name); +XMLPUBFUN xmlEntityPtr + xmlGetDocEntity (const xmlDoc *doc, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr + xmlGetDtdEntity (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr + xmlGetParameterEntity (xmlDocPtr doc, + const xmlChar *name); +#ifdef LIBXML_LEGACY_ENABLED +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlEncodeEntities (xmlDocPtr doc, + const xmlChar *input); +#endif /* LIBXML_LEGACY_ENABLED */ +XMLPUBFUN xmlChar * + xmlEncodeEntitiesReentrant(xmlDocPtr doc, + const xmlChar *input); +XMLPUBFUN xmlChar * + xmlEncodeSpecialChars (const xmlDoc *doc, + const xmlChar *input); +XMLPUBFUN xmlEntitiesTablePtr + xmlCreateEntitiesTable (void); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlEntitiesTablePtr + xmlCopyEntitiesTable (xmlEntitiesTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void + xmlFreeEntitiesTable (xmlEntitiesTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlDumpEntitiesTable (xmlBufferPtr buf, + xmlEntitiesTablePtr table); +XMLPUBFUN void + xmlDumpEntityDecl (xmlBufferPtr buf, + xmlEntityPtr ent); +#endif /* LIBXML_OUTPUT_ENABLED */ +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN void + xmlCleanupPredefinedEntities(void); +#endif /* LIBXML_LEGACY_ENABLED */ + + +#ifdef __cplusplus +} +#endif + +# endif /* __XML_ENTITIES_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/globals.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/globals.h new file mode 100644 index 0000000000000000000000000000000000000000..92f41312f549efa176e48dd719c1652cfc21ef34 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/globals.h @@ -0,0 +1,41 @@ +/* + * Summary: interface for all global variables of the library + * Description: Deprecated, don't use + * + * Copy: See Copyright for the status of this software. + */ + +#ifndef __XML_GLOBALS_H +#define __XML_GLOBALS_H + +#include + +/* + * This file was required to access global variables until version v2.12.0. + * + * These includes are for backward compatibility. + */ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlGlobalState xmlGlobalState; +typedef xmlGlobalState *xmlGlobalStatePtr; + +XML_DEPRECATED XMLPUBFUN void +xmlInitializeGlobalState(xmlGlobalStatePtr gs); +XML_DEPRECATED XMLPUBFUN +xmlGlobalStatePtr xmlGetGlobalState(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_GLOBALS_H */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/hash.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/hash.h new file mode 100644 index 0000000000000000000000000000000000000000..135b69669b38b65abc7ef51476ad532f2923042e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/hash.h @@ -0,0 +1,251 @@ +/* + * Summary: Chained hash tables + * Description: This module implements the hash table support used in + * various places in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Bjorn Reese + */ + +#ifndef __XML_HASH_H__ +#define __XML_HASH_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The hash table. + */ +typedef struct _xmlHashTable xmlHashTable; +typedef xmlHashTable *xmlHashTablePtr; + +/* + * Recent version of gcc produce a warning when a function pointer is assigned + * to an object pointer, or vice versa. The following macro is a dirty hack + * to allow suppression of the warning. If your architecture has function + * pointers which are a different size than a void pointer, there may be some + * serious trouble within the library. + */ +/** + * XML_CAST_FPTR: + * @fptr: pointer to a function + * + * Macro to do a casting from an object pointer to a + * function pointer without encountering a warning from + * gcc + * + * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) + * This macro violated ISO C aliasing rules (gcc4 on s390 broke) + * so it is disabled now + */ + +#define XML_CAST_FPTR(fptr) fptr + +/* + * function types: + */ +/** + * xmlHashDeallocator: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to free data from a hash. + */ +typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name); +/** + * xmlHashCopier: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to copy data from a hash. + * + * Returns a copy of the data or NULL in case of error. + */ +typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name); +/** + * xmlHashScanner: + * @payload: the data in the hash + * @data: extra scanner data + * @name: the name associated + * + * Callback when scanning data in a hash with the simple scanner. + */ +typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name); +/** + * xmlHashScannerFull: + * @payload: the data in the hash + * @data: extra scanner data + * @name: the name associated + * @name2: the second name associated + * @name3: the third name associated + * + * Callback when scanning data in a hash with the full scanner. + */ +typedef void (*xmlHashScannerFull)(void *payload, void *data, + const xmlChar *name, const xmlChar *name2, + const xmlChar *name3); + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlHashTablePtr + xmlHashCreate (int size); +XMLPUBFUN xmlHashTablePtr + xmlHashCreateDict (int size, + xmlDictPtr dict); +XMLPUBFUN void + xmlHashFree (xmlHashTablePtr hash, + xmlHashDeallocator dealloc); +XMLPUBFUN void + xmlHashDefaultDeallocator(void *entry, + const xmlChar *name); + +/* + * Add a new entry to the hash table. + */ +XMLPUBFUN int + xmlHashAdd (xmlHashTablePtr hash, + const xmlChar *name, + void *userdata); +XMLPUBFUN int + xmlHashAddEntry (xmlHashTablePtr hash, + const xmlChar *name, + void *userdata); +XMLPUBFUN int + xmlHashUpdateEntry (xmlHashTablePtr hash, + const xmlChar *name, + void *userdata, + xmlHashDeallocator dealloc); +XMLPUBFUN int + xmlHashAdd2 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + void *userdata); +XMLPUBFUN int + xmlHashAddEntry2 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + void *userdata); +XMLPUBFUN int + xmlHashUpdateEntry2 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + void *userdata, + xmlHashDeallocator dealloc); +XMLPUBFUN int + xmlHashAdd3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata); +XMLPUBFUN int + xmlHashAddEntry3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata); +XMLPUBFUN int + xmlHashUpdateEntry3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata, + xmlHashDeallocator dealloc); + +/* + * Remove an entry from the hash table. + */ +XMLPUBFUN int + xmlHashRemoveEntry (xmlHashTablePtr hash, + const xmlChar *name, + xmlHashDeallocator dealloc); +XMLPUBFUN int + xmlHashRemoveEntry2 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + xmlHashDeallocator dealloc); +XMLPUBFUN int + xmlHashRemoveEntry3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashDeallocator dealloc); + +/* + * Retrieve the payload. + */ +XMLPUBFUN void * + xmlHashLookup (xmlHashTablePtr hash, + const xmlChar *name); +XMLPUBFUN void * + xmlHashLookup2 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2); +XMLPUBFUN void * + xmlHashLookup3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3); +XMLPUBFUN void * + xmlHashQLookup (xmlHashTablePtr hash, + const xmlChar *prefix, + const xmlChar *name); +XMLPUBFUN void * + xmlHashQLookup2 (xmlHashTablePtr hash, + const xmlChar *prefix, + const xmlChar *name, + const xmlChar *prefix2, + const xmlChar *name2); +XMLPUBFUN void * + xmlHashQLookup3 (xmlHashTablePtr hash, + const xmlChar *prefix, + const xmlChar *name, + const xmlChar *prefix2, + const xmlChar *name2, + const xmlChar *prefix3, + const xmlChar *name3); + +/* + * Helpers. + */ +XMLPUBFUN xmlHashTablePtr + xmlHashCopySafe (xmlHashTablePtr hash, + xmlHashCopier copy, + xmlHashDeallocator dealloc); +XMLPUBFUN xmlHashTablePtr + xmlHashCopy (xmlHashTablePtr hash, + xmlHashCopier copy); +XMLPUBFUN int + xmlHashSize (xmlHashTablePtr hash); +XMLPUBFUN void + xmlHashScan (xmlHashTablePtr hash, + xmlHashScanner scan, + void *data); +XMLPUBFUN void + xmlHashScan3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScanner scan, + void *data); +XMLPUBFUN void + xmlHashScanFull (xmlHashTablePtr hash, + xmlHashScannerFull scan, + void *data); +XMLPUBFUN void + xmlHashScanFull3 (xmlHashTablePtr hash, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScannerFull scan, + void *data); +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_HASH_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/list.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/list.h new file mode 100644 index 0000000000000000000000000000000000000000..1fa76aff0847fd3de18c942f5037bf6f12bbbb56 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/list.h @@ -0,0 +1,137 @@ +/* + * Summary: lists interfaces + * Description: this module implement the list support used in + * various place in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Gary Pennington + */ + +#ifndef __XML_LINK_INCLUDE__ +#define __XML_LINK_INCLUDE__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlLink xmlLink; +typedef xmlLink *xmlLinkPtr; + +typedef struct _xmlList xmlList; +typedef xmlList *xmlListPtr; + +/** + * xmlListDeallocator: + * @lk: the data to deallocate + * + * Callback function used to free data from a list. + */ +typedef void (*xmlListDeallocator) (xmlLinkPtr lk); +/** + * xmlListDataCompare: + * @data0: the first data + * @data1: the second data + * + * Callback function used to compare 2 data. + * + * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. + */ +typedef int (*xmlListDataCompare) (const void *data0, const void *data1); +/** + * xmlListWalker: + * @data: the data found in the list + * @user: extra user provided data to the walker + * + * Callback function used when walking a list with xmlListWalk(). + * + * Returns 0 to stop walking the list, 1 otherwise. + */ +typedef int (*xmlListWalker) (const void *data, void *user); + +/* Creation/Deletion */ +XMLPUBFUN xmlListPtr + xmlListCreate (xmlListDeallocator deallocator, + xmlListDataCompare compare); +XMLPUBFUN void + xmlListDelete (xmlListPtr l); + +/* Basic Operators */ +XMLPUBFUN void * + xmlListSearch (xmlListPtr l, + void *data); +XMLPUBFUN void * + xmlListReverseSearch (xmlListPtr l, + void *data); +XMLPUBFUN int + xmlListInsert (xmlListPtr l, + void *data) ; +XMLPUBFUN int + xmlListAppend (xmlListPtr l, + void *data) ; +XMLPUBFUN int + xmlListRemoveFirst (xmlListPtr l, + void *data); +XMLPUBFUN int + xmlListRemoveLast (xmlListPtr l, + void *data); +XMLPUBFUN int + xmlListRemoveAll (xmlListPtr l, + void *data); +XMLPUBFUN void + xmlListClear (xmlListPtr l); +XMLPUBFUN int + xmlListEmpty (xmlListPtr l); +XMLPUBFUN xmlLinkPtr + xmlListFront (xmlListPtr l); +XMLPUBFUN xmlLinkPtr + xmlListEnd (xmlListPtr l); +XMLPUBFUN int + xmlListSize (xmlListPtr l); + +XMLPUBFUN void + xmlListPopFront (xmlListPtr l); +XMLPUBFUN void + xmlListPopBack (xmlListPtr l); +XMLPUBFUN int + xmlListPushFront (xmlListPtr l, + void *data); +XMLPUBFUN int + xmlListPushBack (xmlListPtr l, + void *data); + +/* Advanced Operators */ +XMLPUBFUN void + xmlListReverse (xmlListPtr l); +XMLPUBFUN void + xmlListSort (xmlListPtr l); +XMLPUBFUN void + xmlListWalk (xmlListPtr l, + xmlListWalker walker, + void *user); +XMLPUBFUN void + xmlListReverseWalk (xmlListPtr l, + xmlListWalker walker, + void *user); +XMLPUBFUN void + xmlListMerge (xmlListPtr l1, + xmlListPtr l2); +XMLPUBFUN xmlListPtr + xmlListDup (xmlListPtr old); +XMLPUBFUN int + xmlListCopy (xmlListPtr cur, + xmlListPtr old); +/* Link operators */ +XMLPUBFUN void * + xmlLinkGetData (xmlLinkPtr lk); + +/* xmlListUnique() */ +/* xmlListSwap */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_LINK_INCLUDE__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanoftp.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanoftp.h new file mode 100644 index 0000000000000000000000000000000000000000..ed3ac4f1fd2d68901d0066a5eae3dd904a8634ea --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanoftp.h @@ -0,0 +1,186 @@ +/* + * Summary: minimal FTP implementation + * Description: minimal FTP implementation allowing to fetch resources + * like external subset. This module is DEPRECATED, do not + * use any of its functions. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __NANO_FTP_H__ +#define __NANO_FTP_H__ + +#include + +#if defined(LIBXML_FTP_ENABLED) + +/* Needed for portability to Windows 64 bits */ +#if defined(_WIN32) +#include +#else +/** + * SOCKET: + * + * macro used to provide portability of code to windows sockets + */ +#define SOCKET int +/** + * INVALID_SOCKET: + * + * macro used to provide portability of code to windows sockets + * the value to be used when the socket is not valid + */ +#undef INVALID_SOCKET +#define INVALID_SOCKET (-1) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * ftpListCallback: + * @userData: user provided data for the callback + * @filename: the file name (including "->" when links are shown) + * @attrib: the attribute string + * @owner: the owner string + * @group: the group string + * @size: the file size + * @links: the link count + * @year: the year + * @month: the month + * @day: the day + * @hour: the hour + * @minute: the minute + * + * A callback for the xmlNanoFTPList command. + * Note that only one of year and day:minute are specified. + */ +typedef void (*ftpListCallback) (void *userData, + const char *filename, const char *attrib, + const char *owner, const char *group, + unsigned long size, int links, int year, + const char *month, int day, int hour, + int minute); +/** + * ftpDataCallback: + * @userData: the user provided context + * @data: the data received + * @len: its size in bytes + * + * A callback for the xmlNanoFTPGet command. + */ +typedef void (*ftpDataCallback) (void *userData, + const char *data, + int len); + +/* + * Init + */ +XML_DEPRECATED +XMLPUBFUN void + xmlNanoFTPInit (void); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoFTPCleanup (void); + +/* + * Creating/freeing contexts. + */ +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoFTPNewCtxt (const char *URL); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoFTPFreeCtxt (void * ctx); +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoFTPConnectTo (const char *server, + int port); +/* + * Opening/closing session connections. + */ +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoFTPOpen (const char *URL); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPConnect (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPClose (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPQuit (void *ctx); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoFTPScanProxy (const char *URL); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoFTPProxy (const char *host, + int port, + const char *user, + const char *passwd, + int type); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPUpdateURL (void *ctx, + const char *URL); + +/* + * Rather internal commands. + */ +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPGetResponse (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPCheckResponse (void *ctx); + +/* + * CD/DIR/GET handlers. + */ +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPCwd (void *ctx, + const char *directory); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPDele (void *ctx, + const char *file); + +XML_DEPRECATED +XMLPUBFUN SOCKET + xmlNanoFTPGetConnection (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPCloseConnection(void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPList (void *ctx, + ftpListCallback callback, + void *userData, + const char *filename); +XML_DEPRECATED +XMLPUBFUN SOCKET + xmlNanoFTPGetSocket (void *ctx, + const char *filename); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPGet (void *ctx, + ftpDataCallback callback, + void *userData, + const char *filename); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoFTPRead (void *ctx, + void *dest, + int len); + +#ifdef __cplusplus +} +#endif +#endif /* defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */ +#endif /* __NANO_FTP_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanohttp.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanohttp.h new file mode 100644 index 0000000000000000000000000000000000000000..c70d1c26bb880ccdfcee16d2c79f69d1d3472518 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/nanohttp.h @@ -0,0 +1,98 @@ +/* + * Summary: minimal HTTP implementation + * Description: minimal HTTP implementation allowing to fetch resources + * like external subset. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __NANO_HTTP_H__ +#define __NANO_HTTP_H__ + +#include + +#ifdef LIBXML_HTTP_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif +XML_DEPRECATED +XMLPUBFUN void + xmlNanoHTTPInit (void); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoHTTPCleanup (void); +XML_DEPRECATED +XMLPUBFUN void + xmlNanoHTTPScanProxy (const char *URL); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoHTTPFetch (const char *URL, + const char *filename, + char **contentType); +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoHTTPMethod (const char *URL, + const char *method, + const char *input, + char **contentType, + const char *headers, + int ilen); +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoHTTPMethodRedir (const char *URL, + const char *method, + const char *input, + char **contentType, + char **redir, + const char *headers, + int ilen); +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoHTTPOpen (const char *URL, + char **contentType); +XML_DEPRECATED +XMLPUBFUN void * + xmlNanoHTTPOpenRedir (const char *URL, + char **contentType, + char **redir); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoHTTPReturnCode (void *ctx); +XML_DEPRECATED +XMLPUBFUN const char * + xmlNanoHTTPAuthHeader (void *ctx); +XML_DEPRECATED +XMLPUBFUN const char * + xmlNanoHTTPRedir (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoHTTPContentLength( void * ctx ); +XML_DEPRECATED +XMLPUBFUN const char * + xmlNanoHTTPEncoding (void *ctx); +XML_DEPRECATED +XMLPUBFUN const char * + xmlNanoHTTPMimeType (void *ctx); +XML_DEPRECATED +XMLPUBFUN int + xmlNanoHTTPRead (void *ctx, + void *dest, + int len); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN int + xmlNanoHTTPSave (void *ctxt, + const char *filename); +#endif /* LIBXML_OUTPUT_ENABLED */ +XML_DEPRECATED +XMLPUBFUN void + xmlNanoHTTPClose (void *ctx); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTTP_ENABLED */ +#endif /* __NANO_HTTP_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/parser.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/parser.h new file mode 100644 index 0000000000000000000000000000000000000000..78d29cada2a41d1e7d8d3d58de4d8a9c8d395093 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/parser.h @@ -0,0 +1,1390 @@ +/* + * Summary: the core parser module + * Description: Interfaces, constants and types related to the XML parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PARSER_H__ +#define __XML_PARSER_H__ + +/** DOC_DISABLE */ +#include +#define XML_TREE_INTERNALS +#include +#undef XML_TREE_INTERNALS +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* for compatibility */ +#include +#include +/** DOC_ENABLE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_DEFAULT_VERSION: + * + * The default version of XML used: 1.0 + */ +#define XML_DEFAULT_VERSION "1.0" + +/** + * xmlParserInput: + * + * An xmlParserInput is an input flow for the XML processor. + * Each entity parsed is associated an xmlParserInput (except the + * few predefined ones). This is the case both for internal entities + * - in which case the flow is already completely in memory - or + * external entities - in which case we use the buf structure for + * progressive reading and I18N conversions to the internal UTF-8 format. + */ + +/** + * xmlParserInputDeallocate: + * @str: the string to deallocate + * + * Callback for freeing some parser input allocations. + */ +typedef void (* xmlParserInputDeallocate)(xmlChar *str); + +struct _xmlParserInput { + /* Input buffer */ + xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ + + const char *filename; /* The file analyzed, if any */ + const char *directory; /* unused */ + const xmlChar *base; /* Base of the array to parse */ + const xmlChar *cur; /* Current char being parsed */ + const xmlChar *end; /* end of the array to parse */ + int length; /* unused */ + int line; /* Current line */ + int col; /* Current column */ + unsigned long consumed; /* How many xmlChars already consumed */ + xmlParserInputDeallocate free; /* function to deallocate the base */ + const xmlChar *encoding; /* unused */ + const xmlChar *version; /* the version string for entity */ + int flags; /* Flags */ + int id; /* an unique identifier for the entity */ + unsigned long parentConsumed; /* unused */ + xmlEntityPtr entity; /* entity, if any */ +}; + +/** + * xmlParserNodeInfo: + * + * The parser can be asked to collect Node information, i.e. at what + * place in the file they were detected. + * NOTE: This is off by default and not very well tested. + */ +typedef struct _xmlParserNodeInfo xmlParserNodeInfo; +typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; + +struct _xmlParserNodeInfo { + const struct _xmlNode* node; + /* Position & line # that text that created the node begins & ends on */ + unsigned long begin_pos; + unsigned long begin_line; + unsigned long end_pos; + unsigned long end_line; +}; + +typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; +typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; +struct _xmlParserNodeInfoSeq { + unsigned long maximum; + unsigned long length; + xmlParserNodeInfo* buffer; +}; + +/** + * xmlParserInputState: + * + * The parser is now working also as a state based parser. + * The recursive one use the state info for entities processing. + */ +typedef enum { + XML_PARSER_EOF = -1, /* nothing is to be parsed */ + XML_PARSER_START = 0, /* nothing has been parsed */ + XML_PARSER_MISC, /* Misc* before int subset */ + XML_PARSER_PI, /* Within a processing instruction */ + XML_PARSER_DTD, /* within some DTD content */ + XML_PARSER_PROLOG, /* Misc* after internal subset */ + XML_PARSER_COMMENT, /* within a comment */ + XML_PARSER_START_TAG, /* within a start tag */ + XML_PARSER_CONTENT, /* within the content */ + XML_PARSER_CDATA_SECTION, /* within a CDATA section */ + XML_PARSER_END_TAG, /* within a closing tag */ + XML_PARSER_ENTITY_DECL, /* within an entity declaration */ + XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ + XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ + XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_IGNORE, /* within an IGNORED section */ + XML_PARSER_PUBLIC_LITERAL, /* within a PUBLIC value */ + XML_PARSER_XML_DECL /* before XML decl (but after BOM) */ +} xmlParserInputState; + +/** DOC_DISABLE */ +/* + * Internal bits in the 'loadsubset' context member + */ +#define XML_DETECT_IDS 2 +#define XML_COMPLETE_ATTRS 4 +#define XML_SKIP_IDS 8 +/** DOC_ENABLE */ + +/** + * xmlParserMode: + * + * A parser can operate in various modes + */ +typedef enum { + XML_PARSE_UNKNOWN = 0, + XML_PARSE_DOM = 1, + XML_PARSE_SAX = 2, + XML_PARSE_PUSH_DOM = 3, + XML_PARSE_PUSH_SAX = 4, + XML_PARSE_READER = 5 +} xmlParserMode; + +typedef struct _xmlStartTag xmlStartTag; +typedef struct _xmlParserNsData xmlParserNsData; +typedef struct _xmlAttrHashBucket xmlAttrHashBucket; + +/** + * xmlParserCtxt: + * + * The parser context. + * NOTE This doesn't completely define the parser state, the (current ?) + * design of the parser uses recursive function calls since this allow + * and easy mapping from the production rules of the specification + * to the actual code. The drawback is that the actual function call + * also reflect the parser state. However most of the parsing routines + * takes as the only argument the parser context pointer, so migrating + * to a state based parser for progressive parsing shouldn't be too hard. + */ +struct _xmlParserCtxt { + struct _xmlSAXHandler *sax; /* The SAX handler */ + void *userData; /* For SAX interface only, used by DOM build */ + xmlDocPtr myDoc; /* the document being built */ + int wellFormed; /* is the document well formed */ + int replaceEntities; /* shall we replace entities ? */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* the declared encoding, if any */ + int standalone; /* standalone document */ + int html; /* an HTML(1) document + * 3 is HTML after + * 10 is HTML after + */ + + /* Input stream stack */ + xmlParserInputPtr input; /* Current input stream */ + int inputNr; /* Number of current input streams */ + int inputMax; /* Max number of input streams */ + xmlParserInputPtr *inputTab; /* stack of inputs */ + + /* Node analysis stack only used for DOM building */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr *nodeTab; /* array of nodes */ + + int record_info; /* Whether node info should be kept */ + xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ + + int errNo; /* error code */ + + int hasExternalSubset; /* reference and external subset */ + int hasPErefs; /* the internal subset has PE refs */ + int external; /* unused */ + + int valid; /* is the document valid */ + int validate; /* shall we try to validate ? */ + xmlValidCtxt vctxt; /* The validity context */ + + xmlParserInputState instate; /* push parser state */ + int token; /* unused */ + + char *directory; /* unused */ + + /* Node name stack */ + const xmlChar *name; /* Current parsed Node */ + int nameNr; /* Depth of the parsing stack */ + int nameMax; /* Max depth of the parsing stack */ + const xmlChar * *nameTab; /* array of nodes */ + + long nbChars; /* unused */ + long checkIndex; /* used by progressive parsing lookup */ + int keepBlanks; /* ugly but ... */ + int disableSAX; /* SAX callbacks are disabled */ + int inSubset; /* Parsing is in int 1/ext 2 subset */ + const xmlChar * intSubName; /* name of subset */ + xmlChar * extSubURI; /* URI of external subset */ + xmlChar * extSubSystem; /* SYSTEM ID of external subset */ + + /* xml:space values */ + int * space; /* Should the parser preserve spaces */ + int spaceNr; /* Depth of the parsing stack */ + int spaceMax; /* Max depth of the parsing stack */ + int * spaceTab; /* array of space infos */ + + int depth; /* to prevent entity substitution loops */ + xmlParserInputPtr entity; /* unused */ + int charset; /* unused */ + int nodelen; /* Those two fields are there to */ + int nodemem; /* Speed up large node parsing */ + int pedantic; /* signal pedantic warnings */ + void *_private; /* For user data, libxml won't touch it */ + + int loadsubset; /* should the external subset be loaded */ + int linenumbers; /* set line number in element content */ + void *catalogs; /* document's own catalog */ + int recovery; /* run in recovery mode */ + int progressive; /* unused */ + xmlDictPtr dict; /* dictionary for the parser */ + const xmlChar * *atts; /* array for the attributes callbacks */ + int maxatts; /* the size of the array */ + int docdict; /* unused */ + + /* + * pre-interned strings + */ + const xmlChar *str_xml; + const xmlChar *str_xmlns; + const xmlChar *str_xml_ns; + + /* + * Everything below is used only by the new SAX mode + */ + int sax2; /* operating in the new SAX mode */ + int nsNr; /* the number of inherited namespaces */ + int nsMax; /* the size of the arrays */ + const xmlChar * *nsTab; /* the array of prefix/namespace name */ + unsigned *attallocs; /* which attribute were allocated */ + xmlStartTag *pushTab; /* array of data for push */ + xmlHashTablePtr attsDefault; /* defaulted attributes if any */ + xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ + int nsWellFormed; /* is the document XML Namespace okay */ + int options; /* Extra options */ + + /* + * Those fields are needed only for streaming parsing so far + */ + int dictNames; /* Use dictionary names for the tree */ + int freeElemsNr; /* number of freed element nodes */ + xmlNodePtr freeElems; /* List of freed element nodes */ + int freeAttrsNr; /* number of freed attributes nodes */ + xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ + + /* + * the complete error information for the last error. + */ + xmlError lastError; + xmlParserMode parseMode; /* the parser mode */ + unsigned long nbentities; /* unused */ + unsigned long sizeentities; /* size of external entities */ + + /* for use by HTML non-recursive parser */ + xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ + int nodeInfoNr; /* Depth of the parsing stack */ + int nodeInfoMax; /* Max depth of the parsing stack */ + xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ + + int input_id; /* we need to label inputs */ + unsigned long sizeentcopy; /* volume of entity copy */ + + int endCheckState; /* quote state for push parser */ + unsigned short nbErrors; /* number of errors */ + unsigned short nbWarnings; /* number of warnings */ + unsigned maxAmpl; /* maximum amplification factor */ + + xmlParserNsData *nsdb; /* namespace database */ + unsigned attrHashMax; /* allocated size */ + xmlAttrHashBucket *attrHash; /* atttribute hash table */ + + xmlStructuredErrorFunc errorHandler; + void *errorCtxt; +}; + +/** + * xmlSAXLocator: + * + * A SAX Locator. + */ +struct _xmlSAXLocator { + const xmlChar *(*getPublicId)(void *ctx); + const xmlChar *(*getSystemId)(void *ctx); + int (*getLineNumber)(void *ctx); + int (*getColumnNumber)(void *ctx); +}; + +/** + * xmlSAXHandler: + * + * A SAX handler is bunch of callbacks called by the parser when processing + * of the input generate data or structure information. + */ + +/** + * resolveEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * Callback: + * The entity loader, to control the loading of external entities, + * the application can either: + * - override this resolveEntity() callback in the SAX block + * - or better use the xmlSetExternalEntityLoader() function to + * set up it's own entity resolution routine + * + * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. + */ +typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * internalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on internal subset declaration. + */ +typedef void (*internalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * externalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +typedef void (*externalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * getEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * getParameterEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * entityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the entity name + * @type: the entity type + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @content: the entity value (without processing). + * + * An entity definition has been parsed. + */ +typedef void (*entityDeclSAXFunc) (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +/** + * notationDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the notation + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * What to do when a notation declaration has been parsed. + */ +typedef void (*notationDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * attributeDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @elem: the name of the element + * @fullname: the attribute name + * @type: the attribute type + * @def: the type of default value + * @defaultValue: the attribute default value + * @tree: the tree of enumerated value set + * + * An attribute definition has been parsed. + */ +typedef void (*attributeDeclSAXFunc)(void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +/** + * elementDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the element name + * @type: the element type + * @content: the element value tree + * + * An element definition has been parsed. + */ +typedef void (*elementDeclSAXFunc)(void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +/** + * unparsedEntityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the entity + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @notationName: the name of the notation + * + * What to do when an unparsed entity declaration is parsed. + */ +typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); +/** + * setDocumentLocatorSAXFunc: + * @ctx: the user data (XML parser context) + * @loc: A SAX Locator + * + * Receive the document locator at startup, actually xmlDefaultSAXLocator. + * Everything is available on the context, so this is useless in our case. + */ +typedef void (*setDocumentLocatorSAXFunc) (void *ctx, + xmlSAXLocatorPtr loc); +/** + * startDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document start being processed. + */ +typedef void (*startDocumentSAXFunc) (void *ctx); +/** + * endDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document end has been detected. + */ +typedef void (*endDocumentSAXFunc) (void *ctx); +/** + * startElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name, including namespace prefix + * @atts: An array of name/value attributes pairs, NULL terminated + * + * Called when an opening tag has been processed. + */ +typedef void (*startElementSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar **atts); +/** + * endElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name + * + * Called when the end of an element has been detected. + */ +typedef void (*endElementSAXFunc) (void *ctx, + const xmlChar *name); +/** + * attributeSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The attribute name, including namespace prefix + * @value: The attribute value + * + * Handle an attribute that has been read by the parser. + * The default handling is to convert the attribute into an + * DOM subtree and past it in a new xmlAttr element added to + * the element. + */ +typedef void (*attributeSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *value); +/** + * referenceSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Called when an entity reference is detected. + */ +typedef void (*referenceSAXFunc) (void *ctx, + const xmlChar *name); +/** + * charactersSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some chars from the parser. + */ +typedef void (*charactersSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * ignorableWhitespaceSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * processingInstructionSAXFunc: + * @ctx: the user data (XML parser context) + * @target: the target name + * @data: the PI data's + * + * A processing instruction has been parsed. + */ +typedef void (*processingInstructionSAXFunc) (void *ctx, + const xmlChar *target, + const xmlChar *data); +/** + * commentSAXFunc: + * @ctx: the user data (XML parser context) + * @value: the comment content + * + * A comment has been parsed. + */ +typedef void (*commentSAXFunc) (void *ctx, + const xmlChar *value); +/** + * cdataBlockSAXFunc: + * @ctx: the user data (XML parser context) + * @value: The pcdata content + * @len: the block length + * + * Called when a pcdata block has been parsed. + */ +typedef void (*cdataBlockSAXFunc) ( + void *ctx, + const xmlChar *value, + int len); +/** + * warningSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format a warning messages, callback. + */ +typedef void (*warningSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * errorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format an error messages, callback. + */ +typedef void (*errorSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * fatalErrorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format fatal error messages, callback. + * Note: so far fatalError() SAX callbacks are not used, error() + * get all the callbacks for errors. + */ +typedef void (*fatalErrorSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * isStandaloneSAXFunc: + * @ctx: the user data (XML parser context) + * + * Is this document tagged standalone? + * + * Returns 1 if true + */ +typedef int (*isStandaloneSAXFunc) (void *ctx); +/** + * hasInternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an internal subset. + * + * Returns 1 if true + */ +typedef int (*hasInternalSubsetSAXFunc) (void *ctx); + +/** + * hasExternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an external subset? + * + * Returns 1 if true + */ +typedef int (*hasExternalSubsetSAXFunc) (void *ctx); + +/************************************************************************ + * * + * The SAX version 2 API extensions * + * * + ************************************************************************/ +/** + * XML_SAX2_MAGIC: + * + * Special constant found in SAX2 blocks initialized fields + */ +#define XML_SAX2_MAGIC 0xDEEDBEAF + +/** + * startElementNsSAX2Func: + * @ctx: the user data (XML parser context) + * @localname: the local name of the element + * @prefix: the element namespace prefix if available + * @URI: the element namespace name if available + * @nb_namespaces: number of namespace definitions on that node + * @namespaces: pointer to the array of prefix/URI pairs namespace definitions + * @nb_attributes: the number of attributes on that node + * @nb_defaulted: the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @attributes: pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace information for the element, as well as + * the new namespace declarations on the element. + */ + +typedef void (*startElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); + +/** + * endElementNsSAX2Func: + * @ctx: the user data (XML parser context) + * @localname: the local name of the element + * @prefix: the element namespace prefix if available + * @URI: the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace information for the element. + */ + +typedef void (*endElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); + + +struct _xmlSAXHandler { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + /* + * `startElement` and `endElement` are only used by the legacy SAX1 + * interface and should not be used in new software. If you really + * have to enable SAX1, the preferred way is set the `initialized` + * member to 1 instead of XML_SAX2_MAGIC. + * + * For backward compatibility, it's also possible to set the + * `startElementNs` and `endElementNs` handlers to NULL. + * + * You can also set the XML_PARSE_SAX1 parser option, but versions + * older than 2.12.0 will probably crash if this option is provided + * together with custom SAX callbacks. + */ + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + /* + * `initialized` should always be set to XML_SAX2_MAGIC to enable the + * modern SAX2 interface. + */ + unsigned int initialized; + /* + * The following members are only used by the SAX2 interface. + */ + void *_private; + startElementNsSAX2Func startElementNs; + endElementNsSAX2Func endElementNs; + xmlStructuredErrorFunc serror; +}; + +/* + * SAX Version 1 + */ +typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; +typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; +struct _xmlSAXHandlerV1 { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + unsigned int initialized; +}; + + +/** + * xmlExternalEntityLoader: + * @URL: The System ID of the resource requested + * @ID: The Public ID of the resource requested + * @context: the XML parser context + * + * External entity loaders types. + * + * Returns the entity input parser. + */ +typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, + const char *ID, + xmlParserCtxtPtr context); + +/* + * Variables + */ + +XMLPUBVAR const char *const xmlParserVersion; +XML_DEPRECATED +XMLPUBVAR const int oldXMLWDcompatibility; +XML_DEPRECATED +XMLPUBVAR const int xmlParserDebugEntities; +XML_DEPRECATED +XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator; +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler; +#endif + +#ifdef LIBXML_THREAD_ENABLED +/* backward compatibility */ +XMLPUBFUN const char *const *__xmlParserVersion(void); +XML_DEPRECATED +XMLPUBFUN const int *__oldXMLWDcompatibility(void); +XML_DEPRECATED +XMLPUBFUN const int *__xmlParserDebugEntities(void); +XML_DEPRECATED +XMLPUBFUN const xmlSAXLocator *__xmlDefaultSAXLocator(void); +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN const xmlSAXHandlerV1 *__xmlDefaultSAXHandler(void); +#endif +#endif + +/** DOC_DISABLE */ +#define XML_GLOBALS_PARSER_CORE \ + XML_OP(xmlDoValidityCheckingDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlGetWarningsDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlLineNumbersDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlLoadExtDtdDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlPedanticParserDefaultValue, int, XML_DEPRECATED) \ + XML_OP(xmlSubstituteEntitiesDefaultValue, int, XML_DEPRECATED) + +#ifdef LIBXML_OUTPUT_ENABLED + #define XML_GLOBALS_PARSER_OUTPUT \ + XML_OP(xmlIndentTreeOutput, int, XML_NO_ATTR) \ + XML_OP(xmlTreeIndentString, const char *, XML_NO_ATTR) \ + XML_OP(xmlSaveNoEmptyTags, int, XML_NO_ATTR) +#else + #define XML_GLOBALS_PARSER_OUTPUT +#endif + +#define XML_GLOBALS_PARSER \ + XML_GLOBALS_PARSER_CORE \ + XML_GLOBALS_PARSER_OUTPUT + +#define XML_OP XML_DECLARE_GLOBAL +XML_GLOBALS_PARSER +#undef XML_OP + +#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlDoValidityCheckingDefaultValue \ + XML_GLOBAL_MACRO(xmlDoValidityCheckingDefaultValue) + #define xmlGetWarningsDefaultValue \ + XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue) + #define xmlKeepBlanksDefaultValue XML_GLOBAL_MACRO(xmlKeepBlanksDefaultValue) + #define xmlLineNumbersDefaultValue \ + XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue) + #define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue) + #define xmlPedanticParserDefaultValue \ + XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue) + #define xmlSubstituteEntitiesDefaultValue \ + XML_GLOBAL_MACRO(xmlSubstituteEntitiesDefaultValue) + #ifdef LIBXML_OUTPUT_ENABLED + #define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput) + #define xmlTreeIndentString XML_GLOBAL_MACRO(xmlTreeIndentString) + #define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags) + #endif +#endif +/** DOC_ENABLE */ + +/* + * Init/Cleanup + */ +XMLPUBFUN void + xmlInitParser (void); +XMLPUBFUN void + xmlCleanupParser (void); +XML_DEPRECATED +XMLPUBFUN void + xmlInitGlobals (void); +XML_DEPRECATED +XMLPUBFUN void + xmlCleanupGlobals (void); + +/* + * Input functions + */ +XML_DEPRECATED +XMLPUBFUN int + xmlParserInputRead (xmlParserInputPtr in, + int len); +XML_DEPRECATED +XMLPUBFUN int + xmlParserInputGrow (xmlParserInputPtr in, + int len); + +/* + * Basic parsing Interfaces + */ +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN xmlDocPtr + xmlParseDoc (const xmlChar *cur); +XMLPUBFUN xmlDocPtr + xmlParseFile (const char *filename); +XMLPUBFUN xmlDocPtr + xmlParseMemory (const char *buffer, + int size); +#endif /* LIBXML_SAX1_ENABLED */ +XML_DEPRECATED XMLPUBFUN int + xmlSubstituteEntitiesDefault(int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefSubstituteEntitiesDefaultValue(int v); +XMLPUBFUN int + xmlKeepBlanksDefault (int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefKeepBlanksDefaultValue(int v); +XMLPUBFUN void + xmlStopParser (xmlParserCtxtPtr ctxt); +XML_DEPRECATED XMLPUBFUN int + xmlPedanticParserDefault(int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefPedanticParserDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlLineNumbersDefault (int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefLineNumbersDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefDoValidityCheckingDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefGetWarningsDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefLoadExtDtdDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefParserDebugEntities(int v); + +#ifdef LIBXML_SAX1_ENABLED +/* + * Recovery mode + */ +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlRecoverDoc (const xmlChar *cur); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlRecoverMemory (const char *buffer, + int size); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlRecoverFile (const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ + +/* + * Less common routines and SAX interfaces + */ +XMLPUBFUN int + xmlParseDocument (xmlParserCtxtPtr ctxt); +XMLPUBFUN int + xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN int + xmlSAXUserParseFile (xmlSAXHandlerPtr sax, + void *user_data, + const char *filename); +XML_DEPRECATED +XMLPUBFUN int + xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, + void *user_data, + const char *buffer, + int size); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseDoc (xmlSAXHandlerPtr sax, + const xmlChar *cur, + int recovery); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseMemory (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery, + void *data); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseFile (xmlSAXHandlerPtr sax, + const char *filename, + int recovery); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, + const char *filename, + int recovery, + void *data); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlSAXParseEntity (xmlSAXHandlerPtr sax, + const char *filename); +XML_DEPRECATED +XMLPUBFUN xmlDocPtr + xmlParseEntity (const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ + +#ifdef LIBXML_VALID_ENABLED +XML_DEPRECATED +XMLPUBFUN xmlDtdPtr + xmlSAXParseDTD (xmlSAXHandlerPtr sax, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr + xmlParseDTD (const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr + xmlIOParseDTD (xmlSAXHandlerPtr sax, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); +#endif /* LIBXML_VALID_ENABLE */ +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int + xmlParseBalancedChunkMemory(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN xmlParserErrors + xmlParseInNodeContext (xmlNodePtr node, + const char *data, + int datalen, + int options, + xmlNodePtr *lst); +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int + xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst, + int recover); +XML_DEPRECATED +XMLPUBFUN int + xmlParseExternalEntity (xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN int + xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); + +/* + * Parser contexts handling. + */ +XMLPUBFUN xmlParserCtxtPtr + xmlNewParserCtxt (void); +XMLPUBFUN xmlParserCtxtPtr + xmlNewSAXParserCtxt (const xmlSAXHandler *sax, + void *userData); +XMLPUBFUN int + xmlInitParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void + xmlClearParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void + xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, + const xmlChar* buffer, + const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN xmlParserCtxtPtr + xmlCreateDocParserCtxt (const xmlChar *cur); + +#ifdef LIBXML_LEGACY_ENABLED +/* + * Reading/setting optional parsing features. + */ +XML_DEPRECATED +XMLPUBFUN int + xmlGetFeaturesList (int *len, + const char **result); +XML_DEPRECATED +XMLPUBFUN int + xmlGetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *result); +XML_DEPRECATED +XMLPUBFUN int + xmlSetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *value); +#endif /* LIBXML_LEGACY_ENABLED */ + +#ifdef LIBXML_PUSH_ENABLED +/* + * Interfaces for the Push mode. + */ +XMLPUBFUN xmlParserCtxtPtr + xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename); +XMLPUBFUN int + xmlParseChunk (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +/* + * Special I/O mode. + */ + +XMLPUBFUN xmlParserCtxtPtr + xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, + void *user_data, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); + +XMLPUBFUN xmlParserInputPtr + xmlNewIOInputStream (xmlParserCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); + +/* + * Node infos. + */ +XMLPUBFUN const xmlParserNodeInfo* + xmlParserFindNodeInfo (xmlParserCtxtPtr ctxt, + xmlNodePtr node); +XMLPUBFUN void + xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN void + xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN unsigned long + xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeqPtr seq, + xmlNodePtr node); +XMLPUBFUN void + xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, + xmlParserNodeInfoPtr info); + +/* + * External entities handling actually implemented in xmlIO. + */ + +XMLPUBFUN void + xmlSetExternalEntityLoader(xmlExternalEntityLoader f); +XMLPUBFUN xmlExternalEntityLoader + xmlGetExternalEntityLoader(void); +XMLPUBFUN xmlParserInputPtr + xmlLoadExternalEntity (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +/* + * Index lookup, actually implemented in the encoding module + */ +XMLPUBFUN long + xmlByteConsumed (xmlParserCtxtPtr ctxt); + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + XML_PARSE_RECOVER = 1<<0, /* recover on errors */ + XML_PARSE_NOENT = 1<<1, /* substitute entities */ + XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ + XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ + XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ + XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ + XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ + XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */ + XML_PARSE_NONET = 1<<11,/* Forbid network access */ + XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ + XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ + XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ + XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ + XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of + the tree allowed afterwards (will possibly + crash if you try to modify the tree) */ + XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ + XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ + XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ + XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ + XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ + XML_PARSE_BIG_LINES = 1<<22,/* Store big lines numbers in text PSVI field */ + XML_PARSE_NO_XXE = 1<<23 /* disable loading of external content */ +} xmlParserOption; + +XMLPUBFUN void + xmlCtxtReset (xmlParserCtxtPtr ctxt); +XMLPUBFUN int + xmlCtxtResetPush (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + const char *filename, + const char *encoding); +XMLPUBFUN int + xmlCtxtSetOptions (xmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN int + xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN void + xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt, + xmlStructuredErrorFunc handler, + void *data); +XMLPUBFUN void + xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt, + unsigned maxAmpl); +XMLPUBFUN xmlDocPtr + xmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlReadFile (const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlCtxtParseDocument (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input); +XMLPUBFUN xmlDocPtr + xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr + xmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +/* + * Library wide options + */ +/** + * xmlFeature: + * + * Used to examine the existence of features that can be enabled + * or disabled at compile-time. + * They used to be called XML_FEATURE_xxx but this clashed with Expat + */ +typedef enum { + XML_WITH_THREAD = 1, + XML_WITH_TREE = 2, + XML_WITH_OUTPUT = 3, + XML_WITH_PUSH = 4, + XML_WITH_READER = 5, + XML_WITH_PATTERN = 6, + XML_WITH_WRITER = 7, + XML_WITH_SAX1 = 8, + XML_WITH_FTP = 9, + XML_WITH_HTTP = 10, + XML_WITH_VALID = 11, + XML_WITH_HTML = 12, + XML_WITH_LEGACY = 13, + XML_WITH_C14N = 14, + XML_WITH_CATALOG = 15, + XML_WITH_XPATH = 16, + XML_WITH_XPTR = 17, + XML_WITH_XINCLUDE = 18, + XML_WITH_ICONV = 19, + XML_WITH_ISO8859X = 20, + XML_WITH_UNICODE = 21, + XML_WITH_REGEXP = 22, + XML_WITH_AUTOMATA = 23, + XML_WITH_EXPR = 24, + XML_WITH_SCHEMAS = 25, + XML_WITH_SCHEMATRON = 26, + XML_WITH_MODULES = 27, + XML_WITH_DEBUG = 28, + XML_WITH_DEBUG_MEM = 29, + XML_WITH_DEBUG_RUN = 30, /* unused */ + XML_WITH_ZLIB = 31, + XML_WITH_ICU = 32, + XML_WITH_LZMA = 33, + XML_WITH_NONE = 99999 /* just to be sure of allocation size */ +} xmlFeature; + +XMLPUBFUN int + xmlHasFeature (xmlFeature feature); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/parserInternals.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/parserInternals.h new file mode 100644 index 0000000000000000000000000000000000000000..c4d4363b53aa04269ac55c186c1d447494fded68 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/parserInternals.h @@ -0,0 +1,671 @@ +/* + * Summary: internals routines and limits exported by the parser. + * Description: this module exports a number of internal parsing routines + * they are not really all intended for applications but + * can prove useful doing low level processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PARSER_INTERNALS_H__ +#define __XML_PARSER_INTERNALS_H__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlParserMaxDepth: + * + * DEPRECATED: has no effect + * + * arbitrary depth limit for the XML documents that we allow to + * process. This is not a limitation of the parser but a safety + * boundary feature, use XML_PARSE_HUGE option to override it. + */ +XML_DEPRECATED +XMLPUBVAR const unsigned int xmlParserMaxDepth; + +/** + * XML_MAX_TEXT_LENGTH: + * + * Maximum size allowed for a single text node when building a tree. + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 + */ +#define XML_MAX_TEXT_LENGTH 10000000 + +/** + * XML_MAX_HUGE_LENGTH: + * + * Maximum size allowed when XML_PARSE_HUGE is set. + */ +#define XML_MAX_HUGE_LENGTH 1000000000 + +/** + * XML_MAX_NAME_LENGTH: + * + * Maximum size allowed for a markup identifier. + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Note that with the use of parsing dictionaries overriding the limit + * may result in more runtime memory usage in face of "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_NAME_LENGTH 50000 + +/** + * XML_MAX_DICTIONARY_LIMIT: + * + * Maximum size allowed by the parser for a dictionary by default + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 + */ +#define XML_MAX_DICTIONARY_LIMIT 10000000 + +/** + * XML_MAX_LOOKUP_LIMIT: + * + * Maximum size allowed by the parser for ahead lookup + * This is an upper boundary enforced by the parser to avoid bad + * behaviour on "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_LOOKUP_LIMIT 10000000 + +/** + * XML_MAX_NAMELEN: + * + * Identifiers can be longer, but this will be more costly + * at runtime. + */ +#define XML_MAX_NAMELEN 100 + +/** + * INPUT_CHUNK: + * + * The parser tries to always have that amount of input ready. + * One of the point is providing context when reporting errors. + */ +#define INPUT_CHUNK 250 + +/************************************************************************ + * * + * UNICODE version of the macros. * + * * + ************************************************************************/ +/** + * IS_BYTE_CHAR: + * @c: an byte value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20...] + * any byte character in the accepted range + */ +#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) + +/** + * IS_CHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] + * | [#x10000-#x10FFFF] + * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. + */ +#define IS_CHAR(c) xmlIsCharQ(c) + +/** + * IS_CHAR_CH: + * @c: an xmlChar (usually an unsigned char) + * + * Behaves like IS_CHAR on single-byte value + */ +#define IS_CHAR_CH(c) xmlIsChar_ch(c) + +/** + * IS_BLANK: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [3] S ::= (#x20 | #x9 | #xD | #xA)+ + */ +#define IS_BLANK(c) xmlIsBlankQ(c) + +/** + * IS_BLANK_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Behaviour same as IS_BLANK + */ +#define IS_BLANK_CH(c) xmlIsBlank_ch(c) + +/** + * IS_BASECHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [85] BaseChar ::= ... long list see REC ... + */ +#define IS_BASECHAR(c) xmlIsBaseCharQ(c) + +/** + * IS_DIGIT: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [88] Digit ::= ... long list see REC ... + */ +#define IS_DIGIT(c) xmlIsDigitQ(c) + +/** + * IS_DIGIT_CH: + * @c: an xmlChar value (usually an unsigned char) + * + * Behaves like IS_DIGIT but with a single byte argument + */ +#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) + +/** + * IS_COMBINING: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [87] CombiningChar ::= ... long list see REC ... + */ +#define IS_COMBINING(c) xmlIsCombiningQ(c) + +/** + * IS_COMBINING_CH: + * @c: an xmlChar (usually an unsigned char) + * + * Always false (all combining chars > 0xff) + */ +#define IS_COMBINING_CH(c) 0 + +/** + * IS_EXTENDER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | + * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | + * [#x309D-#x309E] | [#x30FC-#x30FE] + */ +#define IS_EXTENDER(c) xmlIsExtenderQ(c) + +/** + * IS_EXTENDER_CH: + * @c: an xmlChar value (usually an unsigned char) + * + * Behaves like IS_EXTENDER but with a single-byte argument + */ +#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) + +/** + * IS_IDEOGRAPHIC: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] + */ +#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) + +/** + * IS_LETTER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [84] Letter ::= BaseChar | Ideographic + */ +#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) + +/** + * IS_LETTER_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Macro behaves like IS_LETTER, but only check base chars + * + */ +#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) + +/** + * IS_ASCII_LETTER: + * @c: an xmlChar value + * + * Macro to check [a-zA-Z] + * + */ +#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ + ((0x61 <= (c)) && ((c) <= 0x7a))) + +/** + * IS_ASCII_DIGIT: + * @c: an xmlChar value + * + * Macro to check [0-9] + * + */ +#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) + +/** + * IS_PUBIDCHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + */ +#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) + +/** + * IS_PUBIDCHAR_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Same as IS_PUBIDCHAR but for single-byte value + */ +#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) + +/** + * Global variables used for predefined strings. + */ +XMLPUBVAR const xmlChar xmlStringText[]; +XMLPUBVAR const xmlChar xmlStringTextNoenc[]; +XMLPUBVAR const xmlChar xmlStringComment[]; + +/* + * Function to finish the work of the macros where needed. + */ +XMLPUBFUN int xmlIsLetter (int c); + +/** + * Parser context. + */ +XMLPUBFUN xmlParserCtxtPtr + xmlCreateFileParserCtxt (const char *filename); +XMLPUBFUN xmlParserCtxtPtr + xmlCreateURLParserCtxt (const char *filename, + int options); +XMLPUBFUN xmlParserCtxtPtr + xmlCreateMemoryParserCtxt(const char *buffer, + int size); +XMLPUBFUN xmlParserCtxtPtr + xmlCreateEntityParserCtxt(const xmlChar *URL, + const xmlChar *ID, + const xmlChar *base); +XMLPUBFUN void + xmlCtxtErrMemory (xmlParserCtxtPtr ctxt); +XMLPUBFUN int + xmlSwitchEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncoding enc); +XMLPUBFUN int + xmlSwitchEncodingName (xmlParserCtxtPtr ctxt, + const char *encoding); +XMLPUBFUN int + xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncodingHandlerPtr handler); +XML_DEPRECATED +XMLPUBFUN int + xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input, + xmlCharEncodingHandlerPtr handler); + +/** + * Input Streams. + */ +XMLPUBFUN xmlParserInputPtr + xmlNewStringInputStream (xmlParserCtxtPtr ctxt, + const xmlChar *buffer); +XML_DEPRECATED +XMLPUBFUN xmlParserInputPtr + xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); +XMLPUBFUN int + xmlPushInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input); +XMLPUBFUN xmlChar + xmlPopInput (xmlParserCtxtPtr ctxt); +XMLPUBFUN void + xmlFreeInputStream (xmlParserInputPtr input); +XMLPUBFUN xmlParserInputPtr + xmlNewInputFromFile (xmlParserCtxtPtr ctxt, + const char *filename); +XMLPUBFUN xmlParserInputPtr + xmlNewInputStream (xmlParserCtxtPtr ctxt); + +/** + * Namespaces. + */ +XMLPUBFUN xmlChar * + xmlSplitQName (xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlChar **prefix); + +/** + * Generic production rules. + */ +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlParseName (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseNmtoken (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseEntityValue (xmlParserCtxtPtr ctxt, + xmlChar **orig); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseAttValue (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseCharData (xmlParserCtxtPtr ctxt, + int cdata); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseExternalID (xmlParserCtxtPtr ctxt, + xmlChar **publicID, + int strict); +XML_DEPRECATED +XMLPUBFUN void + xmlParseComment (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlParsePITarget (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParsePI (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseNotationDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseEntityDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int + xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, + xmlChar **value); +XML_DEPRECATED +XMLPUBFUN xmlEnumerationPtr + xmlParseNotationType (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlEnumerationPtr + xmlParseEnumerationType (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int + xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XML_DEPRECATED +XMLPUBFUN int + xmlParseAttributeType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XML_DEPRECATED +XMLPUBFUN void + xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlElementContentPtr + xmlParseElementMixedContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XML_DEPRECATED +XMLPUBFUN xmlElementContentPtr + xmlParseElementChildrenContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XML_DEPRECATED +XMLPUBFUN int + xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlElementContentPtr *result); +XML_DEPRECATED +XMLPUBFUN int + xmlParseElementDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int + xmlParseCharRef (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlEntityPtr + xmlParseEntityRef (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseReference (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParsePEReference (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlParseAttribute (xmlParserCtxtPtr ctxt, + xmlChar **value); +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlParseStartTag (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseEndTag (xmlParserCtxtPtr ctxt); +#endif /* LIBXML_SAX1_ENABLED */ +XML_DEPRECATED +XMLPUBFUN void + xmlParseCDSect (xmlParserCtxtPtr ctxt); +XMLPUBFUN void + xmlParseContent (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseElement (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseVersionNum (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseVersionInfo (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseEncName (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN const xmlChar * + xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int + xmlParseSDDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseXMLDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseTextDecl (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseMisc (xmlParserCtxtPtr ctxt); +XMLPUBFUN void + xmlParseExternalSubset (xmlParserCtxtPtr ctxt, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * XML_SUBSTITUTE_NONE: + * + * If no entities need to be substituted. + */ +#define XML_SUBSTITUTE_NONE 0 +/** + * XML_SUBSTITUTE_REF: + * + * Whether general entities need to be substituted. + */ +#define XML_SUBSTITUTE_REF 1 +/** + * XML_SUBSTITUTE_PEREF: + * + * Whether parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_PEREF 2 +/** + * XML_SUBSTITUTE_BOTH: + * + * Both general and parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_BOTH 3 + +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); + +/* + * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. + */ +XML_DEPRECATED +XMLPUBFUN int nodePush (xmlParserCtxtPtr ctxt, + xmlNodePtr value); +XML_DEPRECATED +XMLPUBFUN xmlNodePtr nodePop (xmlParserCtxtPtr ctxt); +XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt, + xmlParserInputPtr value); +XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN const xmlChar * namePop (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int namePush (xmlParserCtxtPtr ctxt, + const xmlChar *value); + +/* + * other commodities shared between parser.c and parserInternals. + */ +XML_DEPRECATED +XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + int *len); +XML_DEPRECATED +XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang); + +/* + * Really core function shared with HTML parser. + */ +XML_DEPRECATED +XMLPUBFUN int xmlCurrentChar (xmlParserCtxtPtr ctxt, + int *len); +XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out, + int val); +XMLPUBFUN int xmlCopyChar (int len, + xmlChar *out, + int val); +XML_DEPRECATED +XMLPUBFUN void xmlNextChar (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void xmlParserInputShrink (xmlParserInputPtr in); + +/* + * Specific function to keep track of entities references + * and used by the XSLT debugger. + */ +#ifdef LIBXML_LEGACY_ENABLED +/** + * xmlEntityReferenceFunc: + * @ent: the entity + * @firstNode: the fist node in the chunk + * @lastNode: the last nod in the chunk + * + * Callback function used when one needs to be able to track back the + * provenance of a chunk of nodes inherited from an entity replacement. + */ +typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, + xmlNodePtr firstNode, + xmlNodePtr lastNode); + +XML_DEPRECATED +XMLPUBFUN void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); + +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlParseQuotedString (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void + xmlParseNamespace (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlScanName (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN void xmlParserHandleReference(xmlParserCtxtPtr ctxt); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, + xmlChar **prefix); +/** + * Entities + */ +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlDecodeEntities (xmlParserCtxtPtr ctxt, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XML_DEPRECATED +XMLPUBFUN void + xmlHandleEntity (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); + +#endif /* LIBXML_LEGACY_ENABLED */ + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/pattern.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/pattern.h new file mode 100644 index 0000000000000000000000000000000000000000..947f0900a23e0a7fb424d73fb31ddd9abaaf1656 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/pattern.h @@ -0,0 +1,106 @@ +/* + * Summary: pattern expression handling + * Description: allows to compile and test pattern expressions for nodes + * either in a tree or based on a parser state. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PATTERN_H__ +#define __XML_PATTERN_H__ + +#include +#include +#include + +#ifdef LIBXML_PATTERN_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlPattern: + * + * A compiled (XPath based) pattern to select nodes + */ +typedef struct _xmlPattern xmlPattern; +typedef xmlPattern *xmlPatternPtr; + +/** + * xmlPatternFlags: + * + * This is the set of options affecting the behaviour of pattern + * matching with this module + * + */ +typedef enum { + XML_PATTERN_DEFAULT = 0, /* simple pattern match */ + XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ + XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ + XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ +} xmlPatternFlags; + +XMLPUBFUN void + xmlFreePattern (xmlPatternPtr comp); + +XMLPUBFUN void + xmlFreePatternList (xmlPatternPtr comp); + +XMLPUBFUN xmlPatternPtr + xmlPatterncompile (const xmlChar *pattern, + xmlDict *dict, + int flags, + const xmlChar **namespaces); +XMLPUBFUN int + xmlPatternCompileSafe (const xmlChar *pattern, + xmlDict *dict, + int flags, + const xmlChar **namespaces, + xmlPatternPtr *patternOut); +XMLPUBFUN int + xmlPatternMatch (xmlPatternPtr comp, + xmlNodePtr node); + +/* streaming interfaces */ +typedef struct _xmlStreamCtxt xmlStreamCtxt; +typedef xmlStreamCtxt *xmlStreamCtxtPtr; + +XMLPUBFUN int + xmlPatternStreamable (xmlPatternPtr comp); +XMLPUBFUN int + xmlPatternMaxDepth (xmlPatternPtr comp); +XMLPUBFUN int + xmlPatternMinDepth (xmlPatternPtr comp); +XMLPUBFUN int + xmlPatternFromRoot (xmlPatternPtr comp); +XMLPUBFUN xmlStreamCtxtPtr + xmlPatternGetStreamCtxt (xmlPatternPtr comp); +XMLPUBFUN void + xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); +XMLPUBFUN int + xmlStreamPushNode (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns, + int nodeType); +XMLPUBFUN int + xmlStreamPush (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int + xmlStreamPushAttr (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int + xmlStreamPop (xmlStreamCtxtPtr stream); +XMLPUBFUN int + xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_PATTERN_ENABLED */ + +#endif /* __XML_PATTERN_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/relaxng.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/relaxng.h new file mode 100644 index 0000000000000000000000000000000000000000..079b7f125d0d2d31b740faecd146bbd85705868e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/relaxng.h @@ -0,0 +1,219 @@ +/* + * Summary: implementation of the Relax-NG validation + * Description: implementation of the Relax-NG validation + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_RELAX_NG__ +#define __XML_RELAX_NG__ + +#include +#include +#include +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlRelaxNG xmlRelaxNG; +typedef xmlRelaxNG *xmlRelaxNGPtr; + + +/** + * xmlRelaxNGValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Relax-NG validation + */ +typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlRelaxNGValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Relax-NG validation + */ +typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * A schemas validation context + */ +typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; +typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; + +typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; +typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; + +/* + * xmlRelaxNGValidErr: + * + * List of possible Relax NG validation errors + */ +typedef enum { + XML_RELAXNG_OK = 0, + XML_RELAXNG_ERR_MEMORY, + XML_RELAXNG_ERR_TYPE, + XML_RELAXNG_ERR_TYPEVAL, + XML_RELAXNG_ERR_DUPID, + XML_RELAXNG_ERR_TYPECMP, + XML_RELAXNG_ERR_NOSTATE, + XML_RELAXNG_ERR_NODEFINE, + XML_RELAXNG_ERR_LISTEXTRA, + XML_RELAXNG_ERR_LISTEMPTY, + XML_RELAXNG_ERR_INTERNODATA, + XML_RELAXNG_ERR_INTERSEQ, + XML_RELAXNG_ERR_INTEREXTRA, + XML_RELAXNG_ERR_ELEMNAME, + XML_RELAXNG_ERR_ATTRNAME, + XML_RELAXNG_ERR_ELEMNONS, + XML_RELAXNG_ERR_ATTRNONS, + XML_RELAXNG_ERR_ELEMWRONGNS, + XML_RELAXNG_ERR_ATTRWRONGNS, + XML_RELAXNG_ERR_ELEMEXTRANS, + XML_RELAXNG_ERR_ATTREXTRANS, + XML_RELAXNG_ERR_ELEMNOTEMPTY, + XML_RELAXNG_ERR_NOELEM, + XML_RELAXNG_ERR_NOTELEM, + XML_RELAXNG_ERR_ATTRVALID, + XML_RELAXNG_ERR_CONTENTVALID, + XML_RELAXNG_ERR_EXTRACONTENT, + XML_RELAXNG_ERR_INVALIDATTR, + XML_RELAXNG_ERR_DATAELEM, + XML_RELAXNG_ERR_VALELEM, + XML_RELAXNG_ERR_LISTELEM, + XML_RELAXNG_ERR_DATATYPE, + XML_RELAXNG_ERR_VALUE, + XML_RELAXNG_ERR_LIST, + XML_RELAXNG_ERR_NOGRAMMAR, + XML_RELAXNG_ERR_EXTRADATA, + XML_RELAXNG_ERR_LACKDATA, + XML_RELAXNG_ERR_INTERNAL, + XML_RELAXNG_ERR_ELEMWRONG, + XML_RELAXNG_ERR_TEXTWRONG +} xmlRelaxNGValidErr; + +/* + * xmlRelaxNGParserFlags: + * + * List of possible Relax NG Parser flags + */ +typedef enum { + XML_RELAXNGP_NONE = 0, + XML_RELAXNGP_FREE_DOC = 1, + XML_RELAXNGP_CRNG = 2 +} xmlRelaxNGParserFlag; + +XMLPUBFUN int + xmlRelaxNGInitTypes (void); +XML_DEPRECATED +XMLPUBFUN void + xmlRelaxNGCleanupTypes (void); + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlRelaxNGParserCtxtPtr + xmlRelaxNGNewParserCtxt (const char *URL); +XMLPUBFUN xmlRelaxNGParserCtxtPtr + xmlRelaxNGNewMemParserCtxt (const char *buffer, + int size); +XMLPUBFUN xmlRelaxNGParserCtxtPtr + xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); + +XMLPUBFUN int + xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, + int flag); + +XMLPUBFUN void + xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); +XMLPUBFUN void + xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc err, + xmlRelaxNGValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int + xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc *err, + xmlRelaxNGValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN void + xmlRelaxNGSetParserStructuredErrors( + xmlRelaxNGParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN xmlRelaxNGPtr + xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); +XMLPUBFUN void + xmlRelaxNGFree (xmlRelaxNGPtr schema); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlRelaxNGDump (FILE *output, + xmlRelaxNGPtr schema); +XMLPUBFUN void + xmlRelaxNGDumpTree (FILE * output, + xmlRelaxNGPtr schema); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * Interfaces for validating + */ +XMLPUBFUN void + xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc err, + xmlRelaxNGValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int + xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc *err, + xmlRelaxNGValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN void + xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx); +XMLPUBFUN xmlRelaxNGValidCtxtPtr + xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); +XMLPUBFUN void + xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); +XMLPUBFUN int + xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc); +/* + * Interfaces for progressive validation when possible + */ +XMLPUBFUN int + xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int + xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, + const xmlChar *data, + int len); +XMLPUBFUN int + xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int + xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ + +#endif /* __XML_RELAX_NG__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/schemasInternals.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/schemasInternals.h new file mode 100644 index 0000000000000000000000000000000000000000..e9d3b3c7abb1e5b6fa1b1f25fb9bc2ee5e46d56f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/schemasInternals.h @@ -0,0 +1,959 @@ +/* + * Summary: internal interfaces for XML Schemas + * Description: internal interfaces for the XML Schemas handling + * and schema validity checking + * The Schemas development is a Work In Progress. + * Some of those interfaces are not guaranteed to be API or ABI stable ! + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_INTERNALS_H__ +#define __XML_SCHEMA_INTERNALS_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMAS_UNKNOWN = 0, + XML_SCHEMAS_STRING = 1, + XML_SCHEMAS_NORMSTRING = 2, + XML_SCHEMAS_DECIMAL = 3, + XML_SCHEMAS_TIME = 4, + XML_SCHEMAS_GDAY = 5, + XML_SCHEMAS_GMONTH = 6, + XML_SCHEMAS_GMONTHDAY = 7, + XML_SCHEMAS_GYEAR = 8, + XML_SCHEMAS_GYEARMONTH = 9, + XML_SCHEMAS_DATE = 10, + XML_SCHEMAS_DATETIME = 11, + XML_SCHEMAS_DURATION = 12, + XML_SCHEMAS_FLOAT = 13, + XML_SCHEMAS_DOUBLE = 14, + XML_SCHEMAS_BOOLEAN = 15, + XML_SCHEMAS_TOKEN = 16, + XML_SCHEMAS_LANGUAGE = 17, + XML_SCHEMAS_NMTOKEN = 18, + XML_SCHEMAS_NMTOKENS = 19, + XML_SCHEMAS_NAME = 20, + XML_SCHEMAS_QNAME = 21, + XML_SCHEMAS_NCNAME = 22, + XML_SCHEMAS_ID = 23, + XML_SCHEMAS_IDREF = 24, + XML_SCHEMAS_IDREFS = 25, + XML_SCHEMAS_ENTITY = 26, + XML_SCHEMAS_ENTITIES = 27, + XML_SCHEMAS_NOTATION = 28, + XML_SCHEMAS_ANYURI = 29, + XML_SCHEMAS_INTEGER = 30, + XML_SCHEMAS_NPINTEGER = 31, + XML_SCHEMAS_NINTEGER = 32, + XML_SCHEMAS_NNINTEGER = 33, + XML_SCHEMAS_PINTEGER = 34, + XML_SCHEMAS_INT = 35, + XML_SCHEMAS_UINT = 36, + XML_SCHEMAS_LONG = 37, + XML_SCHEMAS_ULONG = 38, + XML_SCHEMAS_SHORT = 39, + XML_SCHEMAS_USHORT = 40, + XML_SCHEMAS_BYTE = 41, + XML_SCHEMAS_UBYTE = 42, + XML_SCHEMAS_HEXBINARY = 43, + XML_SCHEMAS_BASE64BINARY = 44, + XML_SCHEMAS_ANYTYPE = 45, + XML_SCHEMAS_ANYSIMPLETYPE = 46 +} xmlSchemaValType; + +/* + * XML Schemas defines multiple type of types. + */ +typedef enum { + XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ + XML_SCHEMA_TYPE_ANY, + XML_SCHEMA_TYPE_FACET, + XML_SCHEMA_TYPE_SIMPLE, + XML_SCHEMA_TYPE_COMPLEX, + XML_SCHEMA_TYPE_SEQUENCE = 6, + XML_SCHEMA_TYPE_CHOICE, + XML_SCHEMA_TYPE_ALL, + XML_SCHEMA_TYPE_SIMPLE_CONTENT, + XML_SCHEMA_TYPE_COMPLEX_CONTENT, + XML_SCHEMA_TYPE_UR, + XML_SCHEMA_TYPE_RESTRICTION, + XML_SCHEMA_TYPE_EXTENSION, + XML_SCHEMA_TYPE_ELEMENT, + XML_SCHEMA_TYPE_ATTRIBUTE, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, + XML_SCHEMA_TYPE_GROUP, + XML_SCHEMA_TYPE_NOTATION, + XML_SCHEMA_TYPE_LIST, + XML_SCHEMA_TYPE_UNION, + XML_SCHEMA_TYPE_ANY_ATTRIBUTE, + XML_SCHEMA_TYPE_IDC_UNIQUE, + XML_SCHEMA_TYPE_IDC_KEY, + XML_SCHEMA_TYPE_IDC_KEYREF, + XML_SCHEMA_TYPE_PARTICLE = 25, + XML_SCHEMA_TYPE_ATTRIBUTE_USE, + XML_SCHEMA_FACET_MININCLUSIVE = 1000, + XML_SCHEMA_FACET_MINEXCLUSIVE, + XML_SCHEMA_FACET_MAXINCLUSIVE, + XML_SCHEMA_FACET_MAXEXCLUSIVE, + XML_SCHEMA_FACET_TOTALDIGITS, + XML_SCHEMA_FACET_FRACTIONDIGITS, + XML_SCHEMA_FACET_PATTERN, + XML_SCHEMA_FACET_ENUMERATION, + XML_SCHEMA_FACET_WHITESPACE, + XML_SCHEMA_FACET_LENGTH, + XML_SCHEMA_FACET_MAXLENGTH, + XML_SCHEMA_FACET_MINLENGTH, + XML_SCHEMA_EXTRA_QNAMEREF = 2000, + XML_SCHEMA_EXTRA_ATTR_USE_PROHIB +} xmlSchemaTypeType; + +typedef enum { + XML_SCHEMA_CONTENT_UNKNOWN = 0, + XML_SCHEMA_CONTENT_EMPTY = 1, + XML_SCHEMA_CONTENT_ELEMENTS, + XML_SCHEMA_CONTENT_MIXED, + XML_SCHEMA_CONTENT_SIMPLE, + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ + XML_SCHEMA_CONTENT_BASIC, + XML_SCHEMA_CONTENT_ANY +} xmlSchemaContentType; + +typedef struct _xmlSchemaVal xmlSchemaVal; +typedef xmlSchemaVal *xmlSchemaValPtr; + +typedef struct _xmlSchemaType xmlSchemaType; +typedef xmlSchemaType *xmlSchemaTypePtr; + +typedef struct _xmlSchemaFacet xmlSchemaFacet; +typedef xmlSchemaFacet *xmlSchemaFacetPtr; + +/** + * Annotation + */ +typedef struct _xmlSchemaAnnot xmlSchemaAnnot; +typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; +struct _xmlSchemaAnnot { + struct _xmlSchemaAnnot *next; + xmlNodePtr content; /* the annotation */ +}; + +/** + * XML_SCHEMAS_ANYATTR_SKIP: + * + * Skip unknown attribute from validation + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_SKIP 1 +/** + * XML_SCHEMAS_ANYATTR_LAX: + * + * Ignore validation non definition on attributes + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_LAX 2 +/** + * XML_SCHEMAS_ANYATTR_STRICT: + * + * Apply strict validation rules on attributes + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_STRICT 3 +/** + * XML_SCHEMAS_ANY_SKIP: + * + * Skip unknown attribute from validation + */ +#define XML_SCHEMAS_ANY_SKIP 1 +/** + * XML_SCHEMAS_ANY_LAX: + * + * Used by wildcards. + * Validate if type found, don't worry if not found + */ +#define XML_SCHEMAS_ANY_LAX 2 +/** + * XML_SCHEMAS_ANY_STRICT: + * + * Used by wildcards. + * Apply strict validation rules + */ +#define XML_SCHEMAS_ANY_STRICT 3 +/** + * XML_SCHEMAS_ATTR_USE_PROHIBITED: + * + * Used by wildcards. + * The attribute is prohibited. + */ +#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 +/** + * XML_SCHEMAS_ATTR_USE_REQUIRED: + * + * The attribute is required. + */ +#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 +/** + * XML_SCHEMAS_ATTR_USE_OPTIONAL: + * + * The attribute is optional. + */ +#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 +/** + * XML_SCHEMAS_ATTR_GLOBAL: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 +/** + * XML_SCHEMAS_ATTR_NSDEFAULT: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 +/** + * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: + * + * this is set when the "type" and "ref" references + * have been resolved. + */ +#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 +/** + * XML_SCHEMAS_ATTR_FIXED: + * + * the attribute has a fixed value + */ +#define XML_SCHEMAS_ATTR_FIXED 1 << 9 + +/** + * xmlSchemaAttribute: + * An attribute definition. + */ + +typedef struct _xmlSchemaAttribute xmlSchemaAttribute; +typedef xmlSchemaAttribute *xmlSchemaAttributePtr; +struct _xmlSchemaAttribute { + xmlSchemaTypeType type; + struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ + const xmlChar *name; /* the name of the declaration */ + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + const xmlChar *typeName; /* the local name of the type definition */ + const xmlChar *typeNs; /* the ns URI of the type definition */ + xmlSchemaAnnotPtr annot; + + xmlSchemaTypePtr base; /* Deprecated; not used */ + int occurs; /* Deprecated; not used */ + const xmlChar *defValue; /* The initial value of the value constraint */ + xmlSchemaTypePtr subtypes; /* the type definition */ + xmlNodePtr node; + const xmlChar *targetNamespace; + int flags; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value constraint */ + xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ +}; + +/** + * xmlSchemaAttributeLink: + * Used to build a list of attribute uses on complexType definitions. + * WARNING: Deprecated; not used. + */ +typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; +typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; +struct _xmlSchemaAttributeLink { + struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ + struct _xmlSchemaAttribute *attr;/* the linked attribute */ +}; + +/** + * XML_SCHEMAS_WILDCARD_COMPLETE: + * + * If the wildcard is complete. + */ +#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 + +/** + * xmlSchemaCharValueLink: + * Used to build a list of namespaces on wildcards. + */ +typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; +typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; +struct _xmlSchemaWildcardNs { + struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ + const xmlChar *value;/* the value */ +}; + +/** + * xmlSchemaWildcard. + * A wildcard. + */ +typedef struct _xmlSchemaWildcard xmlSchemaWildcard; +typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; +struct _xmlSchemaWildcard { + xmlSchemaTypeType type; /* The kind of type */ + const xmlChar *id; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + int processContents; + int any; /* Indicates if the ns constraint is of ##any */ + xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ + xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ + int flags; +}; + +/** + * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: + * + * The attribute wildcard has been built. + */ +#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 +/** + * XML_SCHEMAS_ATTRGROUP_GLOBAL: + * + * The attribute group has been defined. + */ +#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ATTRGROUP_MARKED: + * + * Marks the attr group as marked; used for circular checks. + */ +#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 + +/** + * XML_SCHEMAS_ATTRGROUP_REDEFINED: + * + * The attr group was redefined. + */ +#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 +/** + * XML_SCHEMAS_ATTRGROUP_HAS_REFS: + * + * Whether this attr. group contains attr. group references. + */ +#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 + +/** + * An attribute group definition. + * + * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures + * must be kept similar + */ +typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; +typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; +struct _xmlSchemaAttributeGroup { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ + xmlNodePtr node; + int flags; + xmlSchemaWildcardPtr attributeWildcard; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ + const xmlChar *targetNamespace; + void *attrUses; +}; + +/** + * xmlSchemaTypeLink: + * Used to build a list of types (e.g. member types of + * simpleType with variety "union"). + */ +typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; +typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; +struct _xmlSchemaTypeLink { + struct _xmlSchemaTypeLink *next;/* the next type link ... */ + xmlSchemaTypePtr type;/* the linked type */ +}; + +/** + * xmlSchemaFacetLink: + * Used to build a list of facets. + */ +typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; +typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; +struct _xmlSchemaFacetLink { + struct _xmlSchemaFacetLink *next;/* the next facet link ... */ + xmlSchemaFacetPtr facet;/* the linked facet */ +}; + +/** + * XML_SCHEMAS_TYPE_MIXED: + * + * the element content type is mixed + */ +#define XML_SCHEMAS_TYPE_MIXED 1 << 0 +/** + * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: + * + * the simple or complex type has a derivation method of "extension". + */ +#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 +/** + * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: + * + * the simple or complex type has a derivation method of "restriction". + */ +#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 +/** + * XML_SCHEMAS_TYPE_GLOBAL: + * + * the type is global + */ +#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 +/** + * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: + * + * the complexType owns an attribute wildcard, i.e. + * it can be freed by the complexType + */ +#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ +/** + * XML_SCHEMAS_TYPE_VARIETY_ABSENT: + * + * the simpleType has a variety of "absent". + * TODO: Actually not necessary :-/, since if + * none of the variety flags occur then it's + * automatically absent. + */ +#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 +/** + * XML_SCHEMAS_TYPE_VARIETY_LIST: + * + * the simpleType has a variety of "list". + */ +#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 +/** + * XML_SCHEMAS_TYPE_VARIETY_UNION: + * + * the simpleType has a variety of "union". + */ +#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 +/** + * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: + * + * the simpleType has a variety of "union". + */ +#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 +/** + * XML_SCHEMAS_TYPE_FINAL_EXTENSION: + * + * the complexType has a final of "extension". + */ +#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 +/** + * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: + * + * the simpleType/complexType has a final of "restriction". + */ +#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 +/** + * XML_SCHEMAS_TYPE_FINAL_LIST: + * + * the simpleType has a final of "list". + */ +#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 +/** + * XML_SCHEMAS_TYPE_FINAL_UNION: + * + * the simpleType has a final of "union". + */ +#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 +/** + * XML_SCHEMAS_TYPE_FINAL_DEFAULT: + * + * the simpleType has a final of "default". + */ +#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 +/** + * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: + * + * Marks the item as a builtin primitive. + */ +#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 +/** + * XML_SCHEMAS_TYPE_MARKED: + * + * Marks the item as marked; used for circular checks. + */ +#define XML_SCHEMAS_TYPE_MARKED 1 << 16 +/** + * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: + * + * the complexType did not specify 'block' so use the default of the + * item. + */ +#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 +/** + * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: + * + * the complexType has a 'block' of "extension". + */ +#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 +/** + * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: + * + * the complexType has a 'block' of "restriction". + */ +#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 +/** + * XML_SCHEMAS_TYPE_ABSTRACT: + * + * the simple/complexType is abstract. + */ +#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 +/** + * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: + * + * indicates if the facets need a computed value + */ +#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 +/** + * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: + * + * indicates that the type was typefixed + */ +#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 +/** + * XML_SCHEMAS_TYPE_INTERNAL_INVALID: + * + * indicates that the type is invalid + */ +#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: + * + * a whitespace-facet value of "preserve" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: + * + * a whitespace-facet value of "replace" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: + * + * a whitespace-facet value of "collapse" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 +/** + * XML_SCHEMAS_TYPE_HAS_FACETS: + * + * has facets + */ +#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 +/** + * XML_SCHEMAS_TYPE_NORMVALUENEEDED: + * + * indicates if the facets (pattern) need a normalized value + */ +#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 + +/** + * XML_SCHEMAS_TYPE_FIXUP_1: + * + * First stage of fixup was done. + */ +#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 + +/** + * XML_SCHEMAS_TYPE_REDEFINED: + * + * The type was redefined. + */ +#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 +/** + * XML_SCHEMAS_TYPE_REDEFINING: + * + * The type redefines an other type. + */ +/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ + +/** + * _xmlSchemaType: + * + * Schemas type definition. + */ +struct _xmlSchemaType { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* the next type if in a sequence ... */ + const xmlChar *name; + const xmlChar *id ; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + + int flags; + xmlSchemaContentType contentType; + const xmlChar *base; /* Base type's local name */ + const xmlChar *baseNs; /* Base type's target namespace */ + xmlSchemaTypePtr baseType; /* The base type component */ + xmlSchemaFacetPtr facets; /* Local facets */ + struct _xmlSchemaType *redef; /* Deprecated; not used */ + int recurse; /* Obsolete */ + xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ + xmlSchemaWildcardPtr attributeWildcard; + int builtInType; /* Type of built-in types. */ + xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ + xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. + Could we use @subtypes for this? */ + xmlRegexpPtr contModel; /* Holds the automaton of the content model */ + const xmlChar *targetNamespace; + void *attrUses; +}; + +/* + * xmlSchemaElement: + * An element definition. + * + * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of + * structures must be kept similar + */ +/** + * XML_SCHEMAS_ELEM_NILLABLE: + * + * the element is nillable + */ +#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 +/** + * XML_SCHEMAS_ELEM_GLOBAL: + * + * the element is global + */ +#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ELEM_DEFAULT: + * + * the element has a default value + */ +#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 +/** + * XML_SCHEMAS_ELEM_FIXED: + * + * the element has a fixed value + */ +#define XML_SCHEMAS_ELEM_FIXED 1 << 3 +/** + * XML_SCHEMAS_ELEM_ABSTRACT: + * + * the element is abstract + */ +#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 +/** + * XML_SCHEMAS_ELEM_TOPLEVEL: + * + * the element is top level + * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead + */ +#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 +/** + * XML_SCHEMAS_ELEM_REF: + * + * the element is a reference to a type + */ +#define XML_SCHEMAS_ELEM_REF 1 << 6 +/** + * XML_SCHEMAS_ELEM_NSDEFAULT: + * + * allow elements in no namespace + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 +/** + * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: + * + * this is set when "type", "ref", "substitutionGroup" + * references have been resolved. + */ +#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 + /** + * XML_SCHEMAS_ELEM_CIRCULAR: + * + * a helper flag for the search of circular references. + */ +#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 +/** + * XML_SCHEMAS_ELEM_BLOCK_ABSENT: + * + * the "block" attribute is absent + */ +#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 +/** + * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: + * + * disallowed substitutions are absent + */ +#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 +/** + * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: + * + * disallowed substitutions: "restriction" + */ +#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 +/** + * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: + * + * disallowed substitutions: "substitution" + */ +#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 +/** + * XML_SCHEMAS_ELEM_FINAL_ABSENT: + * + * substitution group exclusions are absent + */ +#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 +/** + * XML_SCHEMAS_ELEM_FINAL_EXTENSION: + * + * substitution group exclusions: "extension" + */ +#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 +/** + * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: + * + * substitution group exclusions: "restriction" + */ +#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 +/** + * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: + * + * the declaration is a substitution group head + */ +#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 +/** + * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: + * + * this is set when the elem decl has been checked against + * all constraints + */ +#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 + +typedef struct _xmlSchemaElement xmlSchemaElement; +typedef xmlSchemaElement *xmlSchemaElementPtr; +struct _xmlSchemaElement { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* Not used? */ + const xmlChar *name; + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; /* the type definition */ + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + + int flags; + const xmlChar *targetNamespace; + const xmlChar *namedType; + const xmlChar *namedTypeNs; + const xmlChar *substGroup; + const xmlChar *substGroupNs; + const xmlChar *scope; + const xmlChar *value; /* The original value of the value constraint. */ + struct _xmlSchemaElement *refDecl; /* This will now be used for the + substitution group affiliation */ + xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ + xmlSchemaContentType contentType; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value constraint. */ + void *idcs; /* The identity-constraint defs */ +}; + +/* + * XML_SCHEMAS_FACET_UNKNOWN: + * + * unknown facet handling + */ +#define XML_SCHEMAS_FACET_UNKNOWN 0 +/* + * XML_SCHEMAS_FACET_PRESERVE: + * + * preserve the type of the facet + */ +#define XML_SCHEMAS_FACET_PRESERVE 1 +/* + * XML_SCHEMAS_FACET_REPLACE: + * + * replace the type of the facet + */ +#define XML_SCHEMAS_FACET_REPLACE 2 +/* + * XML_SCHEMAS_FACET_COLLAPSE: + * + * collapse the types of the facet + */ +#define XML_SCHEMAS_FACET_COLLAPSE 3 +/** + * A facet definition. + */ +struct _xmlSchemaFacet { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ + const xmlChar *value; /* The original value */ + const xmlChar *id; /* Obsolete */ + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ + int whitespace; + xmlSchemaValPtr val; /* The compiled value */ + xmlRegexpPtr regexp; /* The regex for patterns */ +}; + +/** + * A notation definition. + */ +typedef struct _xmlSchemaNotation xmlSchemaNotation; +typedef xmlSchemaNotation *xmlSchemaNotationPtr; +struct _xmlSchemaNotation { + xmlSchemaTypeType type; /* The kind of type */ + const xmlChar *name; + xmlSchemaAnnotPtr annot; + const xmlChar *identifier; + const xmlChar *targetNamespace; +}; + +/* +* TODO: Actually all those flags used for the schema should sit +* on the schema parser context, since they are used only +* during parsing an XML schema document, and not available +* on the component level as per spec. +*/ +/** + * XML_SCHEMAS_QUALIF_ELEM: + * + * Reflects elementFormDefault == qualified in + * an XML schema document. + */ +#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 +/** + * XML_SCHEMAS_QUALIF_ATTR: + * + * Reflects attributeFormDefault == qualified in + * an XML schema document. + */ +#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 +/** + * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: + * + * the schema has "extension" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 +/** + * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: + * + * the schema has "restriction" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 +/** + * XML_SCHEMAS_FINAL_DEFAULT_LIST: + * + * the schema has "list" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 +/** + * XML_SCHEMAS_FINAL_DEFAULT_UNION: + * + * the schema has "union" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: + * + * the schema has "extension" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: + * + * the schema has "restriction" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: + * + * the schema has "substitution" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 +/** + * XML_SCHEMAS_INCLUDING_CONVERT_NS: + * + * the schema is currently including an other schema with + * no target namespace. + */ +#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 +/** + * _xmlSchema: + * + * A Schemas definition + */ +struct _xmlSchema { + const xmlChar *name; /* schema name */ + const xmlChar *targetNamespace; /* the target namespace */ + const xmlChar *version; + const xmlChar *id; /* Obsolete */ + xmlDocPtr doc; + xmlSchemaAnnotPtr annot; + int flags; + + xmlHashTablePtr typeDecl; + xmlHashTablePtr attrDecl; + xmlHashTablePtr attrgrpDecl; + xmlHashTablePtr elemDecl; + xmlHashTablePtr notaDecl; + + xmlHashTablePtr schemasImports; + + void *_private; /* unused by the library for users or bindings */ + xmlHashTablePtr groupDecl; + xmlDictPtr dict; + void *includes; /* the includes, this is opaque for now */ + int preserve; /* whether to free the document */ + int counter; /* used to give anonymous components unique names */ + xmlHashTablePtr idcDef; /* All identity-constraint defs. */ + void *volatiles; /* Obsolete */ +}; + +XMLPUBFUN void xmlSchemaFreeType (xmlSchemaTypePtr type); +XMLPUBFUN void xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_INTERNALS_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/schematron.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/schematron.h new file mode 100644 index 0000000000000000000000000000000000000000..8dd8d25c451c3ee2fb988cc32f6d7f24492eb589 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/schematron.h @@ -0,0 +1,143 @@ +/* + * Summary: XML Schematron implementation + * Description: interface to the XML Schematron validity checking. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMATRON_H__ +#define __XML_SCHEMATRON_H__ + +#include + +#ifdef LIBXML_SCHEMATRON_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ + XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ + XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ + XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ + XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ + XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ + XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ +} xmlSchematronValidOptions; + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchematron xmlSchematron; +typedef xmlSchematron *xmlSchematronPtr; + +/** + * xmlSchematronValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Schematron validation + */ +typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); + +/** + * xmlSchematronValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Schematron validation + */ +typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); + +/** + * A schemas validation context + */ +typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; +typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; + +typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; +typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlSchematronParserCtxtPtr + xmlSchematronNewParserCtxt (const char *URL); +XMLPUBFUN xmlSchematronParserCtxtPtr + xmlSchematronNewMemParserCtxt(const char *buffer, + int size); +XMLPUBFUN xmlSchematronParserCtxtPtr + xmlSchematronNewDocParserCtxt(xmlDocPtr doc); +XMLPUBFUN void + xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); +/***** +XMLPUBFUN void + xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, + xmlSchematronValidityErrorFunc err, + xmlSchematronValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int + xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, + xmlSchematronValidityErrorFunc * err, + xmlSchematronValidityWarningFunc * warn, + void **ctx); +XMLPUBFUN int + xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); + *****/ +XMLPUBFUN xmlSchematronPtr + xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); +XMLPUBFUN void + xmlSchematronFree (xmlSchematronPtr schema); +/* + * Interfaces for validating + */ +XMLPUBFUN void + xmlSchematronSetValidStructuredErrors( + xmlSchematronValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +/****** +XMLPUBFUN void + xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, + xmlSchematronValidityErrorFunc err, + xmlSchematronValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int + xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, + xmlSchematronValidityErrorFunc *err, + xmlSchematronValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN int + xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, + int options); +XMLPUBFUN int + xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); +XMLPUBFUN int + xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, + xmlNodePtr elem); + *******/ + +XMLPUBFUN xmlSchematronValidCtxtPtr + xmlSchematronNewValidCtxt (xmlSchematronPtr schema, + int options); +XMLPUBFUN void + xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); +XMLPUBFUN int + xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, + xmlDocPtr instance); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMATRON_ENABLED */ +#endif /* __XML_SCHEMATRON_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/threads.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/threads.h new file mode 100644 index 0000000000000000000000000000000000000000..8f4b6e174fbac6e724e5a8da4ed65a8a297c0373 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/threads.h @@ -0,0 +1,87 @@ +/** + * Summary: interfaces for thread handling + * Description: set of generic threading related routines + * should work with pthreads, Windows native or TLS threads + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_THREADS_H__ +#define __XML_THREADS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlMutex are a simple mutual exception locks. + */ +typedef struct _xmlMutex xmlMutex; +typedef xmlMutex *xmlMutexPtr; + +/* + * xmlRMutex are reentrant mutual exception locks. + */ +typedef struct _xmlRMutex xmlRMutex; +typedef xmlRMutex *xmlRMutexPtr; + +XMLPUBFUN int + xmlCheckThreadLocalStorage(void); + +XMLPUBFUN xmlMutexPtr + xmlNewMutex (void); +XMLPUBFUN void + xmlMutexLock (xmlMutexPtr tok); +XMLPUBFUN void + xmlMutexUnlock (xmlMutexPtr tok); +XMLPUBFUN void + xmlFreeMutex (xmlMutexPtr tok); + +XMLPUBFUN xmlRMutexPtr + xmlNewRMutex (void); +XMLPUBFUN void + xmlRMutexLock (xmlRMutexPtr tok); +XMLPUBFUN void + xmlRMutexUnlock (xmlRMutexPtr tok); +XMLPUBFUN void + xmlFreeRMutex (xmlRMutexPtr tok); + +/* + * Library wide APIs. + */ +XML_DEPRECATED +XMLPUBFUN void + xmlInitThreads (void); +XMLPUBFUN void + xmlLockLibrary (void); +XMLPUBFUN void + xmlUnlockLibrary(void); +XML_DEPRECATED +XMLPUBFUN int + xmlGetThreadId (void); +XML_DEPRECATED +XMLPUBFUN int + xmlIsMainThread (void); +XML_DEPRECATED +XMLPUBFUN void + xmlCleanupThreads(void); + +/** DOC_DISABLE */ +#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \ + defined(LIBXML_STATIC_FOR_DLL) +int +xmlDllMain(void *hinstDLL, unsigned long fdwReason, + void *lpvReserved); +#endif +/** DOC_ENABLE */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __XML_THREADS_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/tree.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/tree.h new file mode 100644 index 0000000000000000000000000000000000000000..4070375b9cc8f4a44d8079eeced8ccba93ee816b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/tree.h @@ -0,0 +1,1382 @@ +/* + * Summary: interfaces for tree manipulation + * Description: this module describes the structures found in an tree resulting + * from an XML or HTML parsing, as well as the API provided for + * various processing on that tree + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef XML_TREE_INTERNALS + +/* + * Emulate circular dependency for backward compatibility + */ +#include + +#else /* XML_TREE_INTERNALS */ + +#ifndef __XML_TREE_H__ +#define __XML_TREE_H__ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Some of the basic types pointer to structures: + */ +/* xmlIO.h */ +typedef struct _xmlParserInputBuffer xmlParserInputBuffer; +typedef xmlParserInputBuffer *xmlParserInputBufferPtr; + +typedef struct _xmlOutputBuffer xmlOutputBuffer; +typedef xmlOutputBuffer *xmlOutputBufferPtr; + +/* parser.h */ +typedef struct _xmlParserInput xmlParserInput; +typedef xmlParserInput *xmlParserInputPtr; + +typedef struct _xmlParserCtxt xmlParserCtxt; +typedef xmlParserCtxt *xmlParserCtxtPtr; + +typedef struct _xmlSAXLocator xmlSAXLocator; +typedef xmlSAXLocator *xmlSAXLocatorPtr; + +typedef struct _xmlSAXHandler xmlSAXHandler; +typedef xmlSAXHandler *xmlSAXHandlerPtr; + +/* entities.h */ +typedef struct _xmlEntity xmlEntity; +typedef xmlEntity *xmlEntityPtr; + +/** + * BASE_BUFFER_SIZE: + * + * default buffer size 4000. + */ +#define BASE_BUFFER_SIZE 4096 + +/** + * LIBXML_NAMESPACE_DICT: + * + * Defines experimental behaviour: + * 1) xmlNs gets an additional field @context (a xmlDoc) + * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. + */ +/* #define LIBXML_NAMESPACE_DICT */ + +/** + * xmlBufferAllocationScheme: + * + * A buffer allocation scheme can be defined to either match exactly the + * need or double it's allocated size each time it is found too small. + */ + +typedef enum { + XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ + XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ + XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer, deprecated */ + XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ + XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ + XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ +} xmlBufferAllocationScheme; + +/** + * xmlBuffer: + * + * A buffer structure, this old construct is limited to 2GB and + * is being deprecated, use API with xmlBuf instead + */ +typedef struct _xmlBuffer xmlBuffer; +typedef xmlBuffer *xmlBufferPtr; +struct _xmlBuffer { + xmlChar *content; /* The buffer content UTF8 */ + unsigned int use; /* The buffer size used */ + unsigned int size; /* The buffer size */ + xmlBufferAllocationScheme alloc; /* The realloc method */ + xmlChar *contentIO; /* in IO mode we may have a different base */ +}; + +/** + * xmlBuf: + * + * A buffer structure, new one, the actual structure internals are not public + */ + +typedef struct _xmlBuf xmlBuf; + +/** + * xmlBufPtr: + * + * A pointer to a buffer structure, the actual structure internals are not + * public + */ + +typedef xmlBuf *xmlBufPtr; + +/* + * A few public routines for xmlBuf. As those are expected to be used + * mostly internally the bulk of the routines are internal in buf.h + */ +XMLPUBFUN xmlChar* xmlBufContent (const xmlBuf* buf); +XMLPUBFUN xmlChar* xmlBufEnd (xmlBufPtr buf); +XMLPUBFUN size_t xmlBufUse (const xmlBufPtr buf); +XMLPUBFUN size_t xmlBufShrink (xmlBufPtr buf, size_t len); + +/* + * LIBXML2_NEW_BUFFER: + * + * Macro used to express that the API use the new buffers for + * xmlParserInputBuffer and xmlOutputBuffer. The change was + * introduced in 2.9.0. + */ +#define LIBXML2_NEW_BUFFER + +/** + * XML_XML_NAMESPACE: + * + * This is the namespace for the special xml: prefix predefined in the + * XML Namespace specification. + */ +#define XML_XML_NAMESPACE \ + (const xmlChar *) "http://www.w3.org/XML/1998/namespace" + +/** + * XML_XML_ID: + * + * This is the name for the special xml:id attribute + */ +#define XML_XML_ID (const xmlChar *) "xml:id" + +/* + * The different element types carried by an XML tree. + * + * NOTE: This is synchronized with DOM Level1 values + * See http://www.w3.org/TR/REC-DOM-Level-1/ + * + * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should + * be deprecated to use an XML_DTD_NODE. + */ +typedef enum { + XML_ELEMENT_NODE= 1, + XML_ATTRIBUTE_NODE= 2, + XML_TEXT_NODE= 3, + XML_CDATA_SECTION_NODE= 4, + XML_ENTITY_REF_NODE= 5, + XML_ENTITY_NODE= 6, /* unused */ + XML_PI_NODE= 7, + XML_COMMENT_NODE= 8, + XML_DOCUMENT_NODE= 9, + XML_DOCUMENT_TYPE_NODE= 10, /* unused */ + XML_DOCUMENT_FRAG_NODE= 11, + XML_NOTATION_NODE= 12, /* unused */ + XML_HTML_DOCUMENT_NODE= 13, + XML_DTD_NODE= 14, + XML_ELEMENT_DECL= 15, + XML_ATTRIBUTE_DECL= 16, + XML_ENTITY_DECL= 17, + XML_NAMESPACE_DECL= 18, + XML_XINCLUDE_START= 19, + XML_XINCLUDE_END= 20 + /* XML_DOCB_DOCUMENT_NODE= 21 */ /* removed */ +} xmlElementType; + +/** DOC_DISABLE */ +/* For backward compatibility */ +#define XML_DOCB_DOCUMENT_NODE 21 +/** DOC_ENABLE */ + +/** + * xmlNotation: + * + * A DTD Notation definition. + */ + +typedef struct _xmlNotation xmlNotation; +typedef xmlNotation *xmlNotationPtr; +struct _xmlNotation { + const xmlChar *name; /* Notation name */ + const xmlChar *PublicID; /* Public identifier, if any */ + const xmlChar *SystemID; /* System identifier, if any */ +}; + +/** + * xmlAttributeType: + * + * A DTD Attribute type definition. + */ + +typedef enum { + XML_ATTRIBUTE_CDATA = 1, + XML_ATTRIBUTE_ID, + XML_ATTRIBUTE_IDREF , + XML_ATTRIBUTE_IDREFS, + XML_ATTRIBUTE_ENTITY, + XML_ATTRIBUTE_ENTITIES, + XML_ATTRIBUTE_NMTOKEN, + XML_ATTRIBUTE_NMTOKENS, + XML_ATTRIBUTE_ENUMERATION, + XML_ATTRIBUTE_NOTATION +} xmlAttributeType; + +/** + * xmlAttributeDefault: + * + * A DTD Attribute default definition. + */ + +typedef enum { + XML_ATTRIBUTE_NONE = 1, + XML_ATTRIBUTE_REQUIRED, + XML_ATTRIBUTE_IMPLIED, + XML_ATTRIBUTE_FIXED +} xmlAttributeDefault; + +/** + * xmlEnumeration: + * + * List structure used when there is an enumeration in DTDs. + */ + +typedef struct _xmlEnumeration xmlEnumeration; +typedef xmlEnumeration *xmlEnumerationPtr; +struct _xmlEnumeration { + struct _xmlEnumeration *next; /* next one */ + const xmlChar *name; /* Enumeration name */ +}; + +/** + * xmlAttribute: + * + * An Attribute declaration in a DTD. + */ + +typedef struct _xmlAttribute xmlAttribute; +typedef xmlAttribute *xmlAttributePtr; +struct _xmlAttribute { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ + const xmlChar *name; /* Attribute name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + struct _xmlAttribute *nexth; /* next in hash table */ + xmlAttributeType atype; /* The attribute type */ + xmlAttributeDefault def; /* the default */ + const xmlChar *defaultValue; /* or the default value */ + xmlEnumerationPtr tree; /* or the enumeration tree if any */ + const xmlChar *prefix; /* the namespace prefix if any */ + const xmlChar *elem; /* Element holding the attribute */ +}; + +/** + * xmlElementContentType: + * + * Possible definitions of element content types. + */ +typedef enum { + XML_ELEMENT_CONTENT_PCDATA = 1, + XML_ELEMENT_CONTENT_ELEMENT, + XML_ELEMENT_CONTENT_SEQ, + XML_ELEMENT_CONTENT_OR +} xmlElementContentType; + +/** + * xmlElementContentOccur: + * + * Possible definitions of element content occurrences. + */ +typedef enum { + XML_ELEMENT_CONTENT_ONCE = 1, + XML_ELEMENT_CONTENT_OPT, + XML_ELEMENT_CONTENT_MULT, + XML_ELEMENT_CONTENT_PLUS +} xmlElementContentOccur; + +/** + * xmlElementContent: + * + * An XML Element content as stored after parsing an element definition + * in a DTD. + */ + +typedef struct _xmlElementContent xmlElementContent; +typedef xmlElementContent *xmlElementContentPtr; +struct _xmlElementContent { + xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ + xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ + const xmlChar *name; /* Element name */ + struct _xmlElementContent *c1; /* first child */ + struct _xmlElementContent *c2; /* second child */ + struct _xmlElementContent *parent; /* parent */ + const xmlChar *prefix; /* Namespace prefix */ +}; + +/** + * xmlElementTypeVal: + * + * The different possibilities for an element content type. + */ + +typedef enum { + XML_ELEMENT_TYPE_UNDEFINED = 0, + XML_ELEMENT_TYPE_EMPTY = 1, + XML_ELEMENT_TYPE_ANY, + XML_ELEMENT_TYPE_MIXED, + XML_ELEMENT_TYPE_ELEMENT +} xmlElementTypeVal; + +/** + * xmlElement: + * + * An XML Element declaration from a DTD. + */ + +typedef struct _xmlElement xmlElement; +typedef xmlElement *xmlElementPtr; +struct _xmlElement { + void *_private; /* application data */ + xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ + const xmlChar *name; /* Element name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + xmlElementTypeVal etype; /* The type */ + xmlElementContentPtr content; /* the allowed element content */ + xmlAttributePtr attributes; /* List of the declared attributes */ + const xmlChar *prefix; /* the namespace prefix if any */ +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr contModel; /* the validating regexp */ +#else + void *contModel; +#endif +}; + + +/** + * XML_LOCAL_NAMESPACE: + * + * A namespace declaration node. + */ +#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL +typedef xmlElementType xmlNsType; + +/** + * xmlNs: + * + * An XML namespace. + * Note that prefix == NULL is valid, it defines the default namespace + * within the subtree (until overridden). + * + * xmlNsType is unified with xmlElementType. + */ + +typedef struct _xmlNs xmlNs; +typedef xmlNs *xmlNsPtr; +struct _xmlNs { + struct _xmlNs *next; /* next Ns link for this node */ + xmlNsType type; /* global or local */ + const xmlChar *href; /* URL for the namespace */ + const xmlChar *prefix; /* prefix for the namespace */ + void *_private; /* application data */ + struct _xmlDoc *context; /* normally an xmlDoc */ +}; + +/** + * xmlDtd: + * + * An XML DTD, as defined by parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + /* End of common part */ + void *notations; /* Hash table for notations if any */ + void *elements; /* Hash table for elements if any */ + void *attributes; /* Hash table for attributes if any */ + void *entities; /* Hash table for entities if any */ + const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ + void *pentities; /* Hash table for param entities if any */ +}; + +/** + * xmlAttr: + * + * An attribute on an XML node. + */ +typedef struct _xmlAttr xmlAttr; +typedef xmlAttr *xmlAttrPtr; +struct _xmlAttr { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ + const xmlChar *name; /* the name of the property */ + struct _xmlNode *children; /* the value of the property */ + struct _xmlNode *last; /* NULL */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlAttr *next; /* next sibling link */ + struct _xmlAttr *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlAttributeType atype; /* the attribute type if validating */ + void *psvi; /* for type/PSVI information */ + struct _xmlID *id; /* the ID struct */ +}; + +/** + * xmlID: + * + * An XML ID instance. + */ + +typedef struct _xmlID xmlID; +typedef xmlID *xmlIDPtr; +struct _xmlID { + struct _xmlID *next; /* next ID */ + const xmlChar *value; /* The ID name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ + struct _xmlDoc *doc; /* The document holding the ID */ +}; + +/** + * xmlRef: + * + * An XML IDREF instance. + */ + +typedef struct _xmlRef xmlRef; +typedef xmlRef *xmlRefPtr; +struct _xmlRef { + struct _xmlRef *next; /* next Ref */ + const xmlChar *value; /* The Ref name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ +}; + +/** + * xmlNode: + * + * A node in an XML tree. + */ +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; +struct _xmlNode { + void *_private; /* application data */ + xmlElementType type; /* type number, must be second ! */ + const xmlChar *name; /* the name of the node, or the entity */ + struct _xmlNode *children; /* parent->childs link */ + struct _xmlNode *last; /* last child link */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + /* End of common part */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlChar *content; /* the content */ + struct _xmlAttr *properties;/* properties list */ + xmlNs *nsDef; /* namespace definitions on this node */ + void *psvi; /* for type/PSVI information */ + unsigned short line; /* line number */ + unsigned short extra; /* extra data for XPath/XSLT */ +}; + +/** + * XML_GET_CONTENT: + * + * Macro to extract the content pointer of a node. + */ +#define XML_GET_CONTENT(n) \ + ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) + +/** + * XML_GET_LINE: + * + * Macro to extract the line number of an element node. + */ +#define XML_GET_LINE(n) \ + (xmlGetLineNo(n)) + +/** + * xmlDocProperty + * + * Set of properties of the document as found by the parser + * Some of them are linked to similarly named xmlParserOption + */ +typedef enum { + XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ + XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ + XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ + XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ + XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ + XML_DOC_USERBUILT = 1<<5, /* Document was built using the API + and not by parsing an instance */ + XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ + XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ +} xmlDocProperties; + +/** + * xmlDoc: + * + * An XML document. + */ +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc *xmlDocPtr; +struct _xmlDoc { + void *_private; /* application data */ + xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ + char *name; /* name/filename/URI of the document */ + struct _xmlNode *children; /* the document tree */ + struct _xmlNode *last; /* last child link */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* autoreference to itself */ + + /* End of common part */ + int compression;/* level of zlib compression */ + int standalone; /* standalone document (no external refs) + 1 if standalone="yes" + 0 if standalone="no" + -1 if there is no XML declaration + -2 if there is an XML declaration, but no + standalone attribute was specified */ + struct _xmlDtd *intSubset; /* the document internal subset */ + struct _xmlDtd *extSubset; /* the document external subset */ + struct _xmlNs *oldNs; /* Global namespace, the old way */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* actual encoding, if any */ + void *ids; /* Hash table for ID attributes if any */ + void *refs; /* Hash table for IDREFs attributes if any */ + const xmlChar *URL; /* The URI for that document */ + int charset; /* unused */ + struct _xmlDict *dict; /* dict used to allocate names or NULL */ + void *psvi; /* for type/PSVI information */ + int parseFlags; /* set of xmlParserOption used to parse the + document */ + int properties; /* set of xmlDocProperties for this document + set at the end of parsing */ +}; + + +typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; +typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; + +/** + * xmlDOMWrapAcquireNsFunction: + * @ctxt: a DOM wrapper context + * @node: the context node (element or attribute) + * @nsName: the requested namespace name + * @nsPrefix: the requested namespace prefix + * + * A function called to acquire namespaces (xmlNs) from the wrapper. + * + * Returns an xmlNsPtr or NULL in case of an error. + */ +typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, + xmlNodePtr node, + const xmlChar *nsName, + const xmlChar *nsPrefix); + +/** + * xmlDOMWrapCtxt: + * + * Context for DOM wrapper-operations. + */ +struct _xmlDOMWrapCtxt { + void * _private; + /* + * The type of this context, just in case we need specialized + * contexts in the future. + */ + int type; + /* + * Internal namespace map used for various operations. + */ + void * namespaceMap; + /* + * Use this one to acquire an xmlNsPtr intended for node->ns. + * (Note that this is not intended for elem->nsDef). + */ + xmlDOMWrapAcquireNsFunction getNsForNodeFunc; +}; + +/** + * xmlRegisterNodeFunc: + * @node: the current node + * + * Signature for the registration callback of a created node + */ +typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); + +/** + * xmlDeregisterNodeFunc: + * @node: the current node + * + * Signature for the deregistration callback of a discarded node + */ +typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); + +/** + * xmlChildrenNode: + * + * Macro for compatibility naming layer with libxml1. Maps + * to "children." + */ +#ifndef xmlChildrenNode +#define xmlChildrenNode children +#endif + +/** + * xmlRootNode: + * + * Macro for compatibility naming layer with libxml1. Maps + * to "children". + */ +#ifndef xmlRootNode +#define xmlRootNode children +#endif + +/* + * Variables. + */ + +/** DOC_DISABLE */ +#define XML_GLOBALS_TREE \ + XML_OP(xmlBufferAllocScheme, xmlBufferAllocationScheme, XML_DEPRECATED) \ + XML_OP(xmlDefaultBufferSize, int, XML_DEPRECATED) \ + XML_OP(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc, XML_DEPRECATED) \ + XML_OP(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc, \ + XML_DEPRECATED) + +#define XML_OP XML_DECLARE_GLOBAL +XML_GLOBALS_TREE +#undef XML_OP + +#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme) + #define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize) + #define xmlRegisterNodeDefaultValue \ + XML_GLOBAL_MACRO(xmlRegisterNodeDefaultValue) + #define xmlDeregisterNodeDefaultValue \ + XML_GLOBAL_MACRO(xmlDeregisterNodeDefaultValue) +#endif +/** DOC_ENABLE */ + +/* + * Some helper functions + */ +XMLPUBFUN int + xmlValidateNCName (const xmlChar *value, + int space); + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int + xmlValidateQName (const xmlChar *value, + int space); +XMLPUBFUN int + xmlValidateName (const xmlChar *value, + int space); +XMLPUBFUN int + xmlValidateNMToken (const xmlChar *value, + int space); +#endif + +XMLPUBFUN xmlChar * + xmlBuildQName (const xmlChar *ncname, + const xmlChar *prefix, + xmlChar *memory, + int len); +XMLPUBFUN xmlChar * + xmlSplitQName2 (const xmlChar *name, + xmlChar **prefix); +XMLPUBFUN const xmlChar * + xmlSplitQName3 (const xmlChar *name, + int *len); + +/* + * Handling Buffers, the old ones see @xmlBuf for the new ones. + */ + +XMLPUBFUN void + xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); +XMLPUBFUN xmlBufferAllocationScheme + xmlGetBufferAllocationScheme(void); + +XMLPUBFUN xmlBufferPtr + xmlBufferCreate (void); +XMLPUBFUN xmlBufferPtr + xmlBufferCreateSize (size_t size); +XMLPUBFUN xmlBufferPtr + xmlBufferCreateStatic (void *mem, + size_t size); +XMLPUBFUN int + xmlBufferResize (xmlBufferPtr buf, + unsigned int size); +XMLPUBFUN void + xmlBufferFree (xmlBufferPtr buf); +XMLPUBFUN int + xmlBufferDump (FILE *file, + xmlBufferPtr buf); +XMLPUBFUN int + xmlBufferAdd (xmlBufferPtr buf, + const xmlChar *str, + int len); +XMLPUBFUN int + xmlBufferAddHead (xmlBufferPtr buf, + const xmlChar *str, + int len); +XMLPUBFUN int + xmlBufferCat (xmlBufferPtr buf, + const xmlChar *str); +XMLPUBFUN int + xmlBufferCCat (xmlBufferPtr buf, + const char *str); +XMLPUBFUN int + xmlBufferShrink (xmlBufferPtr buf, + unsigned int len); +XMLPUBFUN int + xmlBufferGrow (xmlBufferPtr buf, + unsigned int len); +XMLPUBFUN void + xmlBufferEmpty (xmlBufferPtr buf); +XMLPUBFUN const xmlChar* + xmlBufferContent (const xmlBuffer *buf); +XMLPUBFUN xmlChar* + xmlBufferDetach (xmlBufferPtr buf); +XMLPUBFUN void + xmlBufferSetAllocationScheme(xmlBufferPtr buf, + xmlBufferAllocationScheme scheme); +XMLPUBFUN int + xmlBufferLength (const xmlBuffer *buf); + +/* + * Creating/freeing new structures. + */ +XMLPUBFUN xmlDtdPtr + xmlCreateIntSubset (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr + xmlNewDtd (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr + xmlGetIntSubset (const xmlDoc *doc); +XMLPUBFUN void + xmlFreeDtd (xmlDtdPtr cur); +#ifdef LIBXML_LEGACY_ENABLED +XML_DEPRECATED +XMLPUBFUN xmlNsPtr + xmlNewGlobalNs (xmlDocPtr doc, + const xmlChar *href, + const xmlChar *prefix); +#endif /* LIBXML_LEGACY_ENABLED */ +XMLPUBFUN xmlNsPtr + xmlNewNs (xmlNodePtr node, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void + xmlFreeNs (xmlNsPtr cur); +XMLPUBFUN void + xmlFreeNsList (xmlNsPtr cur); +XMLPUBFUN xmlDocPtr + xmlNewDoc (const xmlChar *version); +XMLPUBFUN void + xmlFreeDoc (xmlDocPtr cur); +XMLPUBFUN xmlAttrPtr + xmlNewDocProp (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *value); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlAttrPtr + xmlNewProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +#endif +XMLPUBFUN xmlAttrPtr + xmlNewNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr + xmlNewNsPropEatName (xmlNodePtr node, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *value); +XMLPUBFUN void + xmlFreePropList (xmlAttrPtr cur); +XMLPUBFUN void + xmlFreeProp (xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr + xmlCopyProp (xmlNodePtr target, + xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr + xmlCopyPropList (xmlNodePtr target, + xmlAttrPtr cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlDtdPtr + xmlCopyDtd (xmlDtdPtr dtd); +#endif /* LIBXML_TREE_ENABLED */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlDocPtr + xmlCopyDoc (xmlDocPtr doc, + int recursive); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ +/* + * Creating new nodes. + */ +XMLPUBFUN xmlNodePtr + xmlNewDocNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewDocNodeEatName (xmlDocPtr doc, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewNode (xmlNsPtr ns, + const xmlChar *name); +XMLPUBFUN xmlNodePtr + xmlNewNodeEatName (xmlNsPtr ns, + xmlChar *name); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlNodePtr + xmlNewChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +#endif +XMLPUBFUN xmlNodePtr + xmlNewDocText (const xmlDoc *doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewText (const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewDocPI (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewPI (const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewDocTextLen (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr + xmlNewTextLen (const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr + xmlNewDocComment (xmlDocPtr doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewComment (const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewCDataBlock (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr + xmlNewCharRef (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr + xmlNewReference (const xmlDoc *doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr + xmlCopyNode (xmlNodePtr node, + int recursive); +XMLPUBFUN xmlNodePtr + xmlDocCopyNode (xmlNodePtr node, + xmlDocPtr doc, + int recursive); +XMLPUBFUN xmlNodePtr + xmlDocCopyNodeList (xmlDocPtr doc, + xmlNodePtr node); +XMLPUBFUN xmlNodePtr + xmlCopyNodeList (xmlNodePtr node); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNodePtr + xmlNewTextChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewDocRawNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr + xmlNewDocFragment (xmlDocPtr doc); +#endif /* LIBXML_TREE_ENABLED */ + +/* + * Navigating. + */ +XMLPUBFUN long + xmlGetLineNo (const xmlNode *node); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) +XMLPUBFUN xmlChar * + xmlGetNodePath (const xmlNode *node); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ +XMLPUBFUN xmlNodePtr + xmlDocGetRootElement (const xmlDoc *doc); +XMLPUBFUN xmlNodePtr + xmlGetLastChild (const xmlNode *parent); +XMLPUBFUN int + xmlNodeIsText (const xmlNode *node); +XMLPUBFUN int + xmlIsBlankNode (const xmlNode *node); + +/* + * Changing the structure. + */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +XMLPUBFUN xmlNodePtr + xmlDocSetRootElement (xmlDocPtr doc, + xmlNodePtr root); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void + xmlNodeSetName (xmlNodePtr cur, + const xmlChar *name); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN xmlNodePtr + xmlAddChild (xmlNodePtr parent, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr + xmlAddChildList (xmlNodePtr parent, + xmlNodePtr cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +XMLPUBFUN xmlNodePtr + xmlReplaceNode (xmlNodePtr old, + xmlNodePtr cur); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +XMLPUBFUN xmlNodePtr + xmlAddPrevSibling (xmlNodePtr cur, + xmlNodePtr elem); +#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ +XMLPUBFUN xmlNodePtr + xmlAddSibling (xmlNodePtr cur, + xmlNodePtr elem); +XMLPUBFUN xmlNodePtr + xmlAddNextSibling (xmlNodePtr cur, + xmlNodePtr elem); +XMLPUBFUN void + xmlUnlinkNode (xmlNodePtr cur); +XMLPUBFUN xmlNodePtr + xmlTextMerge (xmlNodePtr first, + xmlNodePtr second); +XMLPUBFUN int + xmlTextConcat (xmlNodePtr node, + const xmlChar *content, + int len); +XMLPUBFUN void + xmlFreeNodeList (xmlNodePtr cur); +XMLPUBFUN void + xmlFreeNode (xmlNodePtr cur); +XMLPUBFUN int + xmlSetTreeDoc (xmlNodePtr tree, + xmlDocPtr doc); +XMLPUBFUN int + xmlSetListDoc (xmlNodePtr list, + xmlDocPtr doc); +/* + * Namespaces. + */ +XMLPUBFUN xmlNsPtr + xmlSearchNs (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *nameSpace); +XMLPUBFUN xmlNsPtr + xmlSearchNsByHref (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *href); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int + xmlGetNsListSafe (const xmlDoc *doc, + const xmlNode *node, + xmlNsPtr **out); +XMLPUBFUN xmlNsPtr * + xmlGetNsList (const xmlDoc *doc, + const xmlNode *node); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ + +XMLPUBFUN void + xmlSetNs (xmlNodePtr node, + xmlNsPtr ns); +XMLPUBFUN xmlNsPtr + xmlCopyNamespace (xmlNsPtr cur); +XMLPUBFUN xmlNsPtr + xmlCopyNamespaceList (xmlNsPtr cur); + +/* + * Changing the content. + */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) +XMLPUBFUN xmlAttrPtr + xmlSetProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr + xmlSetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ +XMLPUBFUN int + xmlNodeGetAttrValue (const xmlNode *node, + const xmlChar *name, + const xmlChar *nsUri, + xmlChar **out); +XMLPUBFUN xmlChar * + xmlGetNoNsProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlChar * + xmlGetProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr + xmlHasProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr + xmlHasNsProp (const xmlNode *node, + const xmlChar *name, + const xmlChar *nameSpace); +XMLPUBFUN xmlChar * + xmlGetNsProp (const xmlNode *node, + const xmlChar *name, + const xmlChar *nameSpace); +XMLPUBFUN xmlNodePtr + xmlStringGetNodeList (const xmlDoc *doc, + const xmlChar *value); +XMLPUBFUN xmlNodePtr + xmlStringLenGetNodeList (const xmlDoc *doc, + const xmlChar *value, + int len); +XMLPUBFUN xmlChar * + xmlNodeListGetString (xmlDocPtr doc, + const xmlNode *list, + int inLine); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlChar * + xmlNodeListGetRawString (const xmlDoc *doc, + const xmlNode *list, + int inLine); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN int + xmlNodeSetContent (xmlNodePtr cur, + const xmlChar *content); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN int + xmlNodeSetContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN int + xmlNodeAddContent (xmlNodePtr cur, + const xmlChar *content); +XMLPUBFUN int + xmlNodeAddContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +XMLPUBFUN xmlChar * + xmlNodeGetContent (const xmlNode *cur); + +XMLPUBFUN int + xmlNodeBufGetContent (xmlBufferPtr buffer, + const xmlNode *cur); +XMLPUBFUN int + xmlBufGetNodeContent (xmlBufPtr buf, + const xmlNode *cur); + +XMLPUBFUN xmlChar * + xmlNodeGetLang (const xmlNode *cur); +XMLPUBFUN int + xmlNodeGetSpacePreserve (const xmlNode *cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN int + xmlNodeSetLang (xmlNodePtr cur, + const xmlChar *lang); +XMLPUBFUN int + xmlNodeSetSpacePreserve (xmlNodePtr cur, + int val); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN int + xmlNodeGetBaseSafe (const xmlDoc *doc, + const xmlNode *cur, + xmlChar **baseOut); +XMLPUBFUN xmlChar * + xmlNodeGetBase (const xmlDoc *doc, + const xmlNode *cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +XMLPUBFUN int + xmlNodeSetBase (xmlNodePtr cur, + const xmlChar *uri); +#endif + +/* + * Removing content. + */ +XMLPUBFUN int + xmlRemoveProp (xmlAttrPtr cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int + xmlUnsetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name); +XMLPUBFUN int + xmlUnsetProp (xmlNodePtr node, + const xmlChar *name); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ + +/* + * Internal, don't use. + */ +XMLPUBFUN void + xmlBufferWriteCHAR (xmlBufferPtr buf, + const xmlChar *string); +XMLPUBFUN void + xmlBufferWriteChar (xmlBufferPtr buf, + const char *string); +XMLPUBFUN void + xmlBufferWriteQuotedString(xmlBufferPtr buf, + const xmlChar *string); + +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, + xmlDocPtr doc, + xmlAttrPtr attr, + const xmlChar *string); +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef LIBXML_TREE_ENABLED +/* + * Namespace handling. + */ +XMLPUBFUN int + xmlReconciliateNs (xmlDocPtr doc, + xmlNodePtr tree); +#endif + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Saving. + */ +XMLPUBFUN void + xmlDocDumpFormatMemory (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); +XMLPUBFUN void + xmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN void + xmlDocDumpMemoryEnc (xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding); +XMLPUBFUN void + xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding, + int format); +XMLPUBFUN int + xmlDocFormatDump (FILE *f, + xmlDocPtr cur, + int format); +XMLPUBFUN int + xmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN void + xmlElemDump (FILE *f, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN int + xmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int + xmlSaveFormatFile (const char *filename, + xmlDocPtr cur, + int format); +XMLPUBFUN size_t + xmlBufNodeDump (xmlBufPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); +XMLPUBFUN int + xmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); + +XMLPUBFUN int + xmlSaveFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int + xmlSaveFormatFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); +XMLPUBFUN void + xmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format, + const char *encoding); + +XMLPUBFUN int + xmlSaveFormatFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN int + xmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * XHTML + */ +XMLPUBFUN int + xmlIsXHTML (const xmlChar *systemID, + const xmlChar *publicID); + +/* + * Compression. + */ +XMLPUBFUN int + xmlGetDocCompressMode (const xmlDoc *doc); +XMLPUBFUN void + xmlSetDocCompressMode (xmlDocPtr doc, + int mode); +XML_DEPRECATED +XMLPUBFUN int + xmlGetCompressMode (void); +XML_DEPRECATED +XMLPUBFUN void + xmlSetCompressMode (int mode); + +/* +* DOM-wrapper helper functions. +*/ +XMLPUBFUN xmlDOMWrapCtxtPtr + xmlDOMWrapNewCtxt (void); +XMLPUBFUN void + xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); +XMLPUBFUN int + xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, + xmlNodePtr elem, + int options); +XMLPUBFUN int + xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr sourceDoc, + xmlNodePtr node, + xmlDocPtr destDoc, + xmlNodePtr destParent, + int options); +XMLPUBFUN int + xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr node, + int options); +XMLPUBFUN int + xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr sourceDoc, + xmlNodePtr node, + xmlNodePtr *clonedNode, + xmlDocPtr destDoc, + xmlNodePtr destParent, + int deep, + int options); + +#ifdef LIBXML_TREE_ENABLED +/* + * 5 interfaces from DOM ElementTraversal, but different in entities + * traversal. + */ +XMLPUBFUN unsigned long + xmlChildElementCount (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr + xmlNextElementSibling (xmlNodePtr node); +XMLPUBFUN xmlNodePtr + xmlFirstElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr + xmlLastElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr + xmlPreviousElementSibling (xmlNodePtr node); +#endif + +XML_DEPRECATED +XMLPUBFUN xmlRegisterNodeFunc + xmlRegisterNodeDefault (xmlRegisterNodeFunc func); +XML_DEPRECATED +XMLPUBFUN xmlDeregisterNodeFunc + xmlDeregisterNodeDefault (xmlDeregisterNodeFunc func); +XML_DEPRECATED +XMLPUBFUN xmlRegisterNodeFunc + xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); +XML_DEPRECATED +XMLPUBFUN xmlDeregisterNodeFunc + xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); + +XML_DEPRECATED XMLPUBFUN xmlBufferAllocationScheme + xmlThrDefBufferAllocScheme (xmlBufferAllocationScheme v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefDefaultBufferSize (int v); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_TREE_H__ */ + +#endif /* XML_TREE_INTERNALS */ + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/uri.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/uri.h new file mode 100644 index 0000000000000000000000000000000000000000..19980b711c56ef9c4b56c1f9f58e1c599d874008 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/uri.h @@ -0,0 +1,106 @@ +/** + * Summary: library of generic URI related routines + * Description: library of generic URI related routines + * Implements RFC 2396 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_URI_H__ +#define __XML_URI_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlURI: + * + * A parsed URI reference. This is a struct containing the various fields + * as described in RFC 2396 but separated for further processing. + * + * Note: query is a deprecated field which is incorrectly unescaped. + * query_raw takes precedence over query if the former is set. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 + */ +typedef struct _xmlURI xmlURI; +typedef xmlURI *xmlURIPtr; +struct _xmlURI { + char *scheme; /* the URI scheme */ + char *opaque; /* opaque part */ + char *authority; /* the authority part */ + char *server; /* the server part */ + char *user; /* the user part */ + int port; /* the port number */ + char *path; /* the path string */ + char *query; /* the query string (deprecated - use with caution) */ + char *fragment; /* the fragment identifier */ + int cleanup; /* parsing potentially unclean URI */ + char *query_raw; /* the query string (as it appears in the URI) */ +}; + +/* + * This function is in tree.h: + * xmlChar * xmlNodeGetBase (xmlDocPtr doc, + * xmlNodePtr cur); + */ +XMLPUBFUN xmlURIPtr + xmlCreateURI (void); +XMLPUBFUN int + xmlBuildURISafe (const xmlChar *URI, + const xmlChar *base, + xmlChar **out); +XMLPUBFUN xmlChar * + xmlBuildURI (const xmlChar *URI, + const xmlChar *base); +XMLPUBFUN int + xmlBuildRelativeURISafe (const xmlChar *URI, + const xmlChar *base, + xmlChar **out); +XMLPUBFUN xmlChar * + xmlBuildRelativeURI (const xmlChar *URI, + const xmlChar *base); +XMLPUBFUN xmlURIPtr + xmlParseURI (const char *str); +XMLPUBFUN int + xmlParseURISafe (const char *str, + xmlURIPtr *uri); +XMLPUBFUN xmlURIPtr + xmlParseURIRaw (const char *str, + int raw); +XMLPUBFUN int + xmlParseURIReference (xmlURIPtr uri, + const char *str); +XMLPUBFUN xmlChar * + xmlSaveUri (xmlURIPtr uri); +XMLPUBFUN void + xmlPrintURI (FILE *stream, + xmlURIPtr uri); +XMLPUBFUN xmlChar * + xmlURIEscapeStr (const xmlChar *str, + const xmlChar *list); +XMLPUBFUN char * + xmlURIUnescapeString (const char *str, + int len, + char *target); +XMLPUBFUN int + xmlNormalizeURIPath (char *path); +XMLPUBFUN xmlChar * + xmlURIEscape (const xmlChar *str); +XMLPUBFUN void + xmlFreeURI (xmlURIPtr uri); +XMLPUBFUN xmlChar* + xmlCanonicPath (const xmlChar *path); +XMLPUBFUN xmlChar* + xmlPathToURI (const xmlChar *path); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_URI_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/valid.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/valid.h new file mode 100644 index 0000000000000000000000000000000000000000..e1698d7a34025fe05b86d76ff1bd0ea873108523 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/valid.h @@ -0,0 +1,477 @@ +/* + * Summary: The DTD validation + * Description: API for the DTD handling and the validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_VALID_H__ +#define __XML_VALID_H__ + +/** DOC_DISABLE */ +#include +#include +#define XML_TREE_INTERNALS +#include +#undef XML_TREE_INTERNALS +#include +#include +#include +/** DOC_ENABLE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Validation state added for non-determinist content model. + */ +typedef struct _xmlValidState xmlValidState; +typedef xmlValidState *xmlValidStatePtr; + +/** + * xmlValidityErrorFunc: + * @ctx: usually an xmlValidCtxtPtr to a validity error context, + * but comes from ctxt->userData (which normally contains such + * a pointer); ctxt->userData can be changed by the user. + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity error is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlValidityWarningFunc: + * @ctx: usually an xmlValidCtxtPtr to a validity error context, + * but comes from ctxt->userData (which normally contains such + * a pointer); ctxt->userData can be changed by the user. + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity warning is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityWarningFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/* + * xmlValidCtxt: + * An xmlValidCtxt is used for error reporting when validating. + */ +typedef struct _xmlValidCtxt xmlValidCtxt; +typedef xmlValidCtxt *xmlValidCtxtPtr; +struct _xmlValidCtxt { + void *userData; /* user specific data block */ + xmlValidityErrorFunc error; /* the callback in case of errors */ + xmlValidityWarningFunc warning; /* the callback in case of warning */ + + /* Node analysis stack used when validating within entities */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr *nodeTab; /* array of nodes */ + + unsigned int flags; /* internal flags */ + xmlDocPtr doc; /* the document */ + int valid; /* temporary validity check result */ + + /* state state used for non-determinist content validation */ + xmlValidState *vstate; /* current state */ + int vstateNr; /* Depth of the validation stack */ + int vstateMax; /* Max depth of the validation stack */ + xmlValidState *vstateTab; /* array of validation states */ + +#ifdef LIBXML_REGEXP_ENABLED + xmlAutomataPtr am; /* the automata */ + xmlAutomataStatePtr state; /* used to build the automata */ +#else + void *am; + void *state; +#endif +}; + +/* + * ALL notation declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlNotationTable; +typedef xmlNotationTable *xmlNotationTablePtr; + +/* + * ALL element declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlElementTable; +typedef xmlElementTable *xmlElementTablePtr; + +/* + * ALL attribute declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlAttributeTable; +typedef xmlAttributeTable *xmlAttributeTablePtr; + +/* + * ALL IDs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlIDTable; +typedef xmlIDTable *xmlIDTablePtr; + +/* + * ALL Refs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlRefTable; +typedef xmlRefTable *xmlRefTablePtr; + +/* Notation */ +XMLPUBFUN xmlNotationPtr + xmlAddNotationDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *PublicID, + const xmlChar *SystemID); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNotationTablePtr + xmlCopyNotationTable (xmlNotationTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void + xmlFreeNotationTable (xmlNotationTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlDumpNotationDecl (xmlBufferPtr buf, + xmlNotationPtr nota); +/* XML_DEPRECATED, still used in lxml */ +XMLPUBFUN void + xmlDumpNotationTable (xmlBufferPtr buf, + xmlNotationTablePtr table); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Element Content */ +/* the non Doc version are being deprecated */ +XMLPUBFUN xmlElementContentPtr + xmlNewElementContent (const xmlChar *name, + xmlElementContentType type); +XMLPUBFUN xmlElementContentPtr + xmlCopyElementContent (xmlElementContentPtr content); +XMLPUBFUN void + xmlFreeElementContent (xmlElementContentPtr cur); +/* the new versions with doc argument */ +XMLPUBFUN xmlElementContentPtr + xmlNewDocElementContent (xmlDocPtr doc, + const xmlChar *name, + xmlElementContentType type); +XMLPUBFUN xmlElementContentPtr + xmlCopyDocElementContent(xmlDocPtr doc, + xmlElementContentPtr content); +XMLPUBFUN void + xmlFreeDocElementContent(xmlDocPtr doc, + xmlElementContentPtr cur); +XMLPUBFUN void + xmlSnprintfElementContent(char *buf, + int size, + xmlElementContentPtr content, + int englob); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlSprintfElementContent(char *buf, + xmlElementContentPtr content, + int englob); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Element */ +XMLPUBFUN xmlElementPtr + xmlAddElementDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + xmlElementTypeVal type, + xmlElementContentPtr content); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlElementTablePtr + xmlCopyElementTable (xmlElementTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void + xmlFreeElementTable (xmlElementTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlDumpElementTable (xmlBufferPtr buf, + xmlElementTablePtr table); +XML_DEPRECATED +XMLPUBFUN void + xmlDumpElementDecl (xmlBufferPtr buf, + xmlElementPtr elem); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Enumeration */ +XMLPUBFUN xmlEnumerationPtr + xmlCreateEnumeration (const xmlChar *name); +XMLPUBFUN void + xmlFreeEnumeration (xmlEnumerationPtr cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlEnumerationPtr + xmlCopyEnumeration (xmlEnumerationPtr cur); +#endif /* LIBXML_TREE_ENABLED */ + +/* Attribute */ +XMLPUBFUN xmlAttributePtr + xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *ns, + xmlAttributeType type, + xmlAttributeDefault def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlAttributeTablePtr + xmlCopyAttributeTable (xmlAttributeTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void + xmlFreeAttributeTable (xmlAttributeTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN void + xmlDumpAttributeTable (xmlBufferPtr buf, + xmlAttributeTablePtr table); +XML_DEPRECATED +XMLPUBFUN void + xmlDumpAttributeDecl (xmlBufferPtr buf, + xmlAttributePtr attr); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* IDs */ +XMLPUBFUN int + xmlAddIDSafe (xmlAttrPtr attr, + const xmlChar *value); +XMLPUBFUN xmlIDPtr + xmlAddID (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XMLPUBFUN void + xmlFreeIDTable (xmlIDTablePtr table); +XMLPUBFUN xmlAttrPtr + xmlGetID (xmlDocPtr doc, + const xmlChar *ID); +XMLPUBFUN int + xmlIsID (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XMLPUBFUN int + xmlRemoveID (xmlDocPtr doc, + xmlAttrPtr attr); + +/* IDREFs */ +XML_DEPRECATED +XMLPUBFUN xmlRefPtr + xmlAddRef (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XML_DEPRECATED +XMLPUBFUN void + xmlFreeRefTable (xmlRefTablePtr table); +XML_DEPRECATED +XMLPUBFUN int + xmlIsRef (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XML_DEPRECATED +XMLPUBFUN int + xmlRemoveRef (xmlDocPtr doc, + xmlAttrPtr attr); +XML_DEPRECATED +XMLPUBFUN xmlListPtr + xmlGetRefs (xmlDocPtr doc, + const xmlChar *ID); + +/** + * The public function calls related to validity checking. + */ +#ifdef LIBXML_VALID_ENABLED +/* Allocate/Release Validation Contexts */ +XMLPUBFUN xmlValidCtxtPtr + xmlNewValidCtxt(void); +XMLPUBFUN void + xmlFreeValidCtxt(xmlValidCtxtPtr); + +XML_DEPRECATED +XMLPUBFUN int + xmlValidateRoot (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateElementDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlElementPtr elem); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlValidNormalizeAttributeValue(xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlAttributePtr attr); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateAttributeValue(xmlAttributeType type, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNotationPtr nota); +XMLPUBFUN int + xmlValidateDtd (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlDtdPtr dtd); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int + xmlValidateDocument (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int + xmlValidateElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateOneElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *prefix, + xmlNsPtr ns, + const xmlChar *value); +XML_DEPRECATED +XMLPUBFUN int + xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +#endif /* LIBXML_VALID_ENABLED */ + +#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XML_DEPRECATED +XMLPUBFUN int + xmlValidateNotationUse (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *notationName); +#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ + +XMLPUBFUN int + xmlIsMixedElement (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr + xmlGetDtdAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr + xmlGetDtdQAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlNotationPtr + xmlGetDtdNotationDesc (xmlDtdPtr dtd, + const xmlChar *name); +XMLPUBFUN xmlElementPtr + xmlGetDtdQElementDesc (xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlElementPtr + xmlGetDtdElementDesc (xmlDtdPtr dtd, + const xmlChar *name); + +#ifdef LIBXML_VALID_ENABLED + +XMLPUBFUN int + xmlValidGetPotentialChildren(xmlElementContent *ctree, + const xmlChar **names, + int *len, + int max); + +XMLPUBFUN int + xmlValidGetValidElements(xmlNode *prev, + xmlNode *next, + const xmlChar **names, + int max); +XMLPUBFUN int + xmlValidateNameValue (const xmlChar *value); +XMLPUBFUN int + xmlValidateNamesValue (const xmlChar *value); +XMLPUBFUN int + xmlValidateNmtokenValue (const xmlChar *value); +XMLPUBFUN int + xmlValidateNmtokensValue(const xmlChar *value); + +#ifdef LIBXML_REGEXP_ENABLED +/* + * Validation based on the regexp support + */ +XML_DEPRECATED +XMLPUBFUN int + xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, + xmlElementPtr elem); + +XML_DEPRECATED +XMLPUBFUN int + xmlValidatePushElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +XML_DEPRECATED +XMLPUBFUN int + xmlValidatePushCData (xmlValidCtxtPtr ctxt, + const xmlChar *data, + int len); +XML_DEPRECATED +XMLPUBFUN int + xmlValidatePopElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +#endif /* LIBXML_REGEXP_ENABLED */ +#endif /* LIBXML_VALID_ENABLED */ +#ifdef __cplusplus +} +#endif +#endif /* __XML_VALID_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xinclude.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xinclude.h new file mode 100644 index 0000000000000000000000000000000000000000..71fa4c20dc2507242b50415f854c0362f913734c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xinclude.h @@ -0,0 +1,136 @@ +/* + * Summary: implementation of XInclude + * Description: API to handle XInclude processing, + * implements the + * World Wide Web Consortium Last Call Working Draft 10 November 2003 + * http://www.w3.org/TR/2003/WD-xinclude-20031110 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XINCLUDE_H__ +#define __XML_XINCLUDE_H__ + +#include +#include +#include + +#ifdef LIBXML_XINCLUDE_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XINCLUDE_NS: + * + * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude + */ +#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" +/** + * XINCLUDE_OLD_NS: + * + * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude + */ +#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" +/** + * XINCLUDE_NODE: + * + * Macro defining "include" + */ +#define XINCLUDE_NODE (const xmlChar *) "include" +/** + * XINCLUDE_FALLBACK: + * + * Macro defining "fallback" + */ +#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" +/** + * XINCLUDE_HREF: + * + * Macro defining "href" + */ +#define XINCLUDE_HREF (const xmlChar *) "href" +/** + * XINCLUDE_PARSE: + * + * Macro defining "parse" + */ +#define XINCLUDE_PARSE (const xmlChar *) "parse" +/** + * XINCLUDE_PARSE_XML: + * + * Macro defining "xml" + */ +#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" +/** + * XINCLUDE_PARSE_TEXT: + * + * Macro defining "text" + */ +#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" +/** + * XINCLUDE_PARSE_ENCODING: + * + * Macro defining "encoding" + */ +#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" +/** + * XINCLUDE_PARSE_XPOINTER: + * + * Macro defining "xpointer" + */ +#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" + +typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; +typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; + +/* + * standalone processing + */ +XMLPUBFUN int + xmlXIncludeProcess (xmlDocPtr doc); +XMLPUBFUN int + xmlXIncludeProcessFlags (xmlDocPtr doc, + int flags); +XMLPUBFUN int + xmlXIncludeProcessFlagsData(xmlDocPtr doc, + int flags, + void *data); +XMLPUBFUN int + xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, + int flags, + void *data); +XMLPUBFUN int + xmlXIncludeProcessTree (xmlNodePtr tree); +XMLPUBFUN int + xmlXIncludeProcessTreeFlags(xmlNodePtr tree, + int flags); +/* + * contextual processing + */ +XMLPUBFUN xmlXIncludeCtxtPtr + xmlXIncludeNewContext (xmlDocPtr doc); +XMLPUBFUN int + xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, + int flags); +XMLPUBFUN void + xmlXIncludeSetErrorHandler(xmlXIncludeCtxtPtr ctxt, + xmlStructuredErrorFunc handler, + void *data); +XMLPUBFUN int + xmlXIncludeGetLastError (xmlXIncludeCtxtPtr ctxt); +XMLPUBFUN void + xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); +XMLPUBFUN int + xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, + xmlNodePtr tree); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XINCLUDE_ENABLED */ + +#endif /* __XML_XINCLUDE_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xlink.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xlink.h new file mode 100644 index 0000000000000000000000000000000000000000..106573666ae462f2b4c1dafe86b39b1afb84530e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xlink.h @@ -0,0 +1,189 @@ +/* + * Summary: unfinished XLink detection module + * Description: unfinished XLink detection module + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XLINK_H__ +#define __XML_XLINK_H__ + +#include +#include + +#ifdef LIBXML_XPTR_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Various defines for the various Link properties. + * + * NOTE: the link detection layer will try to resolve QName expansion + * of namespaces. If "foo" is the prefix for "http://foo.com/" + * then the link detection layer will expand role="foo:myrole" + * to "http://foo.com/:myrole". + * NOTE: the link detection layer will expand URI-References found on + * href attributes by using the base mechanism if found. + */ +typedef xmlChar *xlinkHRef; +typedef xmlChar *xlinkRole; +typedef xmlChar *xlinkTitle; + +typedef enum { + XLINK_TYPE_NONE = 0, + XLINK_TYPE_SIMPLE, + XLINK_TYPE_EXTENDED, + XLINK_TYPE_EXTENDED_SET +} xlinkType; + +typedef enum { + XLINK_SHOW_NONE = 0, + XLINK_SHOW_NEW, + XLINK_SHOW_EMBED, + XLINK_SHOW_REPLACE +} xlinkShow; + +typedef enum { + XLINK_ACTUATE_NONE = 0, + XLINK_ACTUATE_AUTO, + XLINK_ACTUATE_ONREQUEST +} xlinkActuate; + +/** + * xlinkNodeDetectFunc: + * @ctx: user data pointer + * @node: the node to check + * + * This is the prototype for the link detection routine. + * It calls the default link detection callbacks upon link detection. + */ +typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); + +/* + * The link detection module interact with the upper layers using + * a set of callback registered at parsing time. + */ + +/** + * xlinkSimpleLinkFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @href: the target of the link + * @role: the role string + * @title: the link title + * + * This is the prototype for a simple link detection callback. + */ +typedef void +(*xlinkSimpleLinkFunk) (void *ctx, + xmlNodePtr node, + const xlinkHRef href, + const xlinkRole role, + const xlinkTitle title); + +/** + * xlinkExtendedLinkFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @nbLocators: the number of locators detected on the link + * @hrefs: pointer to the array of locator hrefs + * @roles: pointer to the array of locator roles + * @nbArcs: the number of arcs detected on the link + * @from: pointer to the array of source roles found on the arcs + * @to: pointer to the array of target roles found on the arcs + * @show: array of values for the show attributes found on the arcs + * @actuate: array of values for the actuate attributes found on the arcs + * @nbTitles: the number of titles detected on the link + * @title: array of titles detected on the link + * @langs: array of xml:lang values for the titles + * + * This is the prototype for a extended link detection callback. + */ +typedef void +(*xlinkExtendedLinkFunk)(void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbArcs, + const xlinkRole *from, + const xlinkRole *to, + xlinkShow *show, + xlinkActuate *actuate, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * xlinkExtendedLinkSetFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @nbLocators: the number of locators detected on the link + * @hrefs: pointer to the array of locator hrefs + * @roles: pointer to the array of locator roles + * @nbTitles: the number of titles detected on the link + * @title: array of titles detected on the link + * @langs: array of xml:lang values for the titles + * + * This is the prototype for a extended link set detection callback. + */ +typedef void +(*xlinkExtendedLinkSetFunk) (void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * This is the structure containing a set of Links detection callbacks. + * + * There is no default xlink callbacks, if one want to get link + * recognition activated, those call backs must be provided before parsing. + */ +typedef struct _xlinkHandler xlinkHandler; +typedef xlinkHandler *xlinkHandlerPtr; +struct _xlinkHandler { + xlinkSimpleLinkFunk simple; + xlinkExtendedLinkFunk extended; + xlinkExtendedLinkSetFunk set; +}; + +/* + * The default detection routine, can be overridden, they call the default + * detection callbacks. + */ + +XMLPUBFUN xlinkNodeDetectFunc + xlinkGetDefaultDetect (void); +XMLPUBFUN void + xlinkSetDefaultDetect (xlinkNodeDetectFunc func); + +/* + * Routines to set/get the default handlers. + */ +XMLPUBFUN xlinkHandlerPtr + xlinkGetDefaultHandler (void); +XMLPUBFUN void + xlinkSetDefaultHandler (xlinkHandlerPtr handler); + +/* + * Link detection module itself. + */ +XMLPUBFUN xlinkType + xlinkIsLink (xmlDocPtr doc, + xmlNodePtr node); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPTR_ENABLED */ + +#endif /* __XML_XLINK_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlIO.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlIO.h new file mode 100644 index 0000000000000000000000000000000000000000..e950773af872ec7c0f55d36ec5905123c1eb6074 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlIO.h @@ -0,0 +1,438 @@ +/* + * Summary: interface for the I/O interfaces used by the parser + * Description: interface for the I/O interfaces used by the parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_IO_H__ +#define __XML_IO_H__ + +/** DOC_DISABLE */ +#include +#include +#include +#define XML_TREE_INTERNALS +#include +#undef XML_TREE_INTERNALS +/** DOC_ENABLE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Those are the functions and datatypes for the parser input + * I/O structures. + */ + +/** + * xmlInputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to detect if the current handler + * can provide input functionality for this resource. + * + * Returns 1 if yes and 0 if another Input module should be used + */ +typedef int (*xmlInputMatchCallback) (char const *filename); +/** + * xmlInputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to open the resource + * + * Returns an Input context or NULL in case or error + */ +typedef void * (*xmlInputOpenCallback) (char const *filename); +/** + * xmlInputReadCallback: + * @context: an Input context + * @buffer: the buffer to store data read + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Input API to read the resource + * + * Returns the number of bytes read or -1 in case of error + */ +typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len); +/** + * xmlInputCloseCallback: + * @context: an Input context + * + * Callback used in the I/O Input API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlInputCloseCallback) (void * context); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Those are the functions and datatypes for the library output + * I/O structures. + */ + +/** + * xmlOutputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to detect if the current handler + * can provide output functionality for this resource. + * + * Returns 1 if yes and 0 if another Output module should be used + */ +typedef int (*xmlOutputMatchCallback) (char const *filename); +/** + * xmlOutputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to open the resource + * + * Returns an Output context or NULL in case or error + */ +typedef void * (*xmlOutputOpenCallback) (char const *filename); +/** + * xmlOutputWriteCallback: + * @context: an Output context + * @buffer: the buffer of data to write + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Output API to write to the resource + * + * Returns the number of bytes written or -1 in case of error + */ +typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer, + int len); +/** + * xmlOutputCloseCallback: + * @context: an Output context + * + * Callback used in the I/O Output API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlOutputCloseCallback) (void * context); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/** + * xmlParserInputBufferCreateFilenameFunc: + * @URI: the URI to read from + * @enc: the requested source encoding + * + * Signature for the function doing the lookup for a suitable input method + * corresponding to an URI. + * + * Returns the new xmlParserInputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlParserInputBufferPtr +(*xmlParserInputBufferCreateFilenameFunc)(const char *URI, xmlCharEncoding enc); + +/** + * xmlOutputBufferCreateFilenameFunc: + * @URI: the URI to write to + * @enc: the requested target encoding + * + * Signature for the function doing the lookup for a suitable output method + * corresponding to an URI. + * + * Returns the new xmlOutputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlOutputBufferPtr +(*xmlOutputBufferCreateFilenameFunc)(const char *URI, + xmlCharEncodingHandlerPtr encoder, int compression); + +struct _xmlParserInputBuffer { + void* context; + xmlInputReadCallback readcallback; + xmlInputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ + xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ + int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ + int error; + unsigned long rawconsumed;/* amount consumed from raw */ +}; + + +#ifdef LIBXML_OUTPUT_ENABLED +struct _xmlOutputBuffer { + void* context; + xmlOutputWriteCallback writecallback; + xmlOutputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBufPtr conv; /* if encoder != NULL buffer for output */ + int written; /* total number of byte written */ + int error; +}; +#endif /* LIBXML_OUTPUT_ENABLED */ + +/** DOC_DISABLE */ +#define XML_GLOBALS_IO \ + XML_OP(xmlParserInputBufferCreateFilenameValue, \ + xmlParserInputBufferCreateFilenameFunc, XML_DEPRECATED) \ + XML_OP(xmlOutputBufferCreateFilenameValue, \ + xmlOutputBufferCreateFilenameFunc, XML_DEPRECATED) + +#define XML_OP XML_DECLARE_GLOBAL +XML_GLOBALS_IO +#undef XML_OP + +#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlParserInputBufferCreateFilenameValue \ + XML_GLOBAL_MACRO(xmlParserInputBufferCreateFilenameValue) + #define xmlOutputBufferCreateFilenameValue \ + XML_GLOBAL_MACRO(xmlOutputBufferCreateFilenameValue) +#endif +/** DOC_ENABLE */ + +/* + * Interfaces for input + */ +XMLPUBFUN void + xmlCleanupInputCallbacks (void); + +XMLPUBFUN int + xmlPopInputCallbacks (void); + +XMLPUBFUN void + xmlRegisterDefaultInputCallbacks (void); +XMLPUBFUN xmlParserInputBufferPtr + xmlAllocParserInputBuffer (xmlCharEncoding enc); + +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateFilename (const char *URI, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateFile (FILE *file, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateFd (int fd, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateMem (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateStatic (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr + xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); +XMLPUBFUN int + xmlParserInputBufferRead (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int + xmlParserInputBufferGrow (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int + xmlParserInputBufferPush (xmlParserInputBufferPtr in, + int len, + const char *buf); +XMLPUBFUN void + xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); +XMLPUBFUN char * + xmlParserGetDirectory (const char *filename); + +XMLPUBFUN int + xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); + +XMLPUBFUN xmlParserInputBufferPtr + __xmlParserInputBufferCreateFilename(const char *URI, + xmlCharEncoding enc); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Interfaces for output + */ +XMLPUBFUN void + xmlCleanupOutputCallbacks (void); +XMLPUBFUN int + xmlPopOutputCallbacks (void); +XMLPUBFUN void + xmlRegisterDefaultOutputCallbacks(void); +XMLPUBFUN xmlOutputBufferPtr + xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr + xmlOutputBufferCreateFilename (const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + +XMLPUBFUN xmlOutputBufferPtr + xmlOutputBufferCreateFile (FILE *file, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr + xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr + xmlOutputBufferCreateFd (int fd, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr + xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + xmlCharEncodingHandlerPtr encoder); + +/* Couple of APIs to get the output without digging into the buffers */ +XMLPUBFUN const xmlChar * + xmlOutputBufferGetContent (xmlOutputBufferPtr out); +XMLPUBFUN size_t + xmlOutputBufferGetSize (xmlOutputBufferPtr out); + +XMLPUBFUN int + xmlOutputBufferWrite (xmlOutputBufferPtr out, + int len, + const char *buf); +XMLPUBFUN int + xmlOutputBufferWriteString (xmlOutputBufferPtr out, + const char *str); +XMLPUBFUN int + xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, + const xmlChar *str, + xmlCharEncodingOutputFunc escaping); + +XMLPUBFUN int + xmlOutputBufferFlush (xmlOutputBufferPtr out); +XMLPUBFUN int + xmlOutputBufferClose (xmlOutputBufferPtr out); + +XMLPUBFUN int + xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, + xmlOutputOpenCallback openFunc, + xmlOutputWriteCallback writeFunc, + xmlOutputCloseCallback closeFunc); + +XMLPUBFUN xmlOutputBufferPtr + __xmlOutputBufferCreateFilename(const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + +#ifdef LIBXML_HTTP_ENABLED +/* This function only exists if HTTP support built into the library */ +XML_DEPRECATED +XMLPUBFUN void + xmlRegisterHTTPPostCallbacks (void ); +#endif /* LIBXML_HTTP_ENABLED */ + +#endif /* LIBXML_OUTPUT_ENABLED */ + +XML_DEPRECATED +XMLPUBFUN xmlParserInputPtr + xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr ret); + +/* + * A predefined entity loader disabling network accesses + */ +XMLPUBFUN xmlParserInputPtr + xmlNoNetExternalEntityLoader (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +XML_DEPRECATED +XMLPUBFUN xmlChar * + xmlNormalizeWindowsPath (const xmlChar *path); + +XML_DEPRECATED +XMLPUBFUN int + xmlCheckFilename (const char *path); +/** + * Default 'file://' protocol callbacks + */ +XML_DEPRECATED +XMLPUBFUN int + xmlFileMatch (const char *filename); +XML_DEPRECATED +XMLPUBFUN void * + xmlFileOpen (const char *filename); +XML_DEPRECATED +XMLPUBFUN int + xmlFileRead (void * context, + char * buffer, + int len); +XML_DEPRECATED +XMLPUBFUN int + xmlFileClose (void * context); + +/** + * Default 'http://' protocol callbacks + */ +#ifdef LIBXML_HTTP_ENABLED +XML_DEPRECATED +XMLPUBFUN int + xmlIOHTTPMatch (const char *filename); +XML_DEPRECATED +XMLPUBFUN void * + xmlIOHTTPOpen (const char *filename); +#ifdef LIBXML_OUTPUT_ENABLED +XML_DEPRECATED +XMLPUBFUN void * + xmlIOHTTPOpenW (const char * post_uri, + int compression ); +#endif /* LIBXML_OUTPUT_ENABLED */ +XML_DEPRECATED +XMLPUBFUN int + xmlIOHTTPRead (void * context, + char * buffer, + int len); +XML_DEPRECATED +XMLPUBFUN int + xmlIOHTTPClose (void * context); +#endif /* LIBXML_HTTP_ENABLED */ + +/** + * Default 'ftp://' protocol callbacks + */ +#if defined(LIBXML_FTP_ENABLED) +XML_DEPRECATED +XMLPUBFUN int + xmlIOFTPMatch (const char *filename); +XML_DEPRECATED +XMLPUBFUN void * + xmlIOFTPOpen (const char *filename); +XML_DEPRECATED +XMLPUBFUN int + xmlIOFTPRead (void * context, + char * buffer, + int len); +XML_DEPRECATED +XMLPUBFUN int + xmlIOFTPClose (void * context); +#endif /* defined(LIBXML_FTP_ENABLED) */ + +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc + xmlParserInputBufferCreateFilenameDefault( + xmlParserInputBufferCreateFilenameFunc func); +XMLPUBFUN xmlOutputBufferCreateFilenameFunc + xmlOutputBufferCreateFilenameDefault( + xmlOutputBufferCreateFilenameFunc func); +XML_DEPRECATED +XMLPUBFUN xmlOutputBufferCreateFilenameFunc + xmlThrDefOutputBufferCreateFilenameDefault( + xmlOutputBufferCreateFilenameFunc func); +XML_DEPRECATED +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc + xmlThrDefParserInputBufferCreateFilenameDefault( + xmlParserInputBufferCreateFilenameFunc func); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_IO_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlautomata.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlautomata.h new file mode 100644 index 0000000000000000000000000000000000000000..ea38eb37f09fe43a34d0d3f6fedbb8313d9b839f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlautomata.h @@ -0,0 +1,146 @@ +/* + * Summary: API to build regexp automata + * Description: the API to build regexp automata + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_AUTOMATA_H__ +#define __XML_AUTOMATA_H__ + +#include + +#ifdef LIBXML_REGEXP_ENABLED +#ifdef LIBXML_AUTOMATA_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlAutomataPtr: + * + * A libxml automata description, It can be compiled into a regexp + */ +typedef struct _xmlAutomata xmlAutomata; +typedef xmlAutomata *xmlAutomataPtr; + +/** + * xmlAutomataStatePtr: + * + * A state int the automata description, + */ +typedef struct _xmlAutomataState xmlAutomataState; +typedef xmlAutomataState *xmlAutomataStatePtr; + +/* + * Building API + */ +XMLPUBFUN xmlAutomataPtr + xmlNewAutomata (void); +XMLPUBFUN void + xmlFreeAutomata (xmlAutomataPtr am); + +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataGetInitState (xmlAutomataPtr am); +XMLPUBFUN int + xmlAutomataSetFinalState (xmlAutomataPtr am, + xmlAutomataStatePtr state); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewState (xmlAutomataPtr am); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewTransition (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewTransition2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewNegTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + void *data); + +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewCountTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewCountTrans2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewOnceTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewAllTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int lax); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewEpsilon (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewCountedTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +XMLPUBFUN xmlAutomataStatePtr + xmlAutomataNewCounterTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +XMLPUBFUN int + xmlAutomataNewCounter (xmlAutomataPtr am, + int min, + int max); + +XMLPUBFUN struct _xmlRegexp * + xmlAutomataCompile (xmlAutomataPtr am); +XMLPUBFUN int + xmlAutomataIsDeterminist (xmlAutomataPtr am); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_AUTOMATA_ENABLED */ +#endif /* LIBXML_REGEXP_ENABLED */ + +#endif /* __XML_AUTOMATA_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlerror.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlerror.h new file mode 100644 index 0000000000000000000000000000000000000000..36381bec51e6ba9f27985c8e90a6c1598ead78ee --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlerror.h @@ -0,0 +1,962 @@ +/* + * Summary: error handling + * Description: the API used to report errors + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_ERROR_H__ +#define __XML_ERROR_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlErrorLevel: + * + * Indicates the level of an error + */ +typedef enum { + XML_ERR_NONE = 0, + XML_ERR_WARNING = 1, /* A simple warning */ + XML_ERR_ERROR = 2, /* A recoverable error */ + XML_ERR_FATAL = 3 /* A fatal error */ +} xmlErrorLevel; + +/** + * xmlErrorDomain: + * + * Indicates where an error may have come from + */ +typedef enum { + XML_FROM_NONE = 0, + XML_FROM_PARSER, /* The XML parser */ + XML_FROM_TREE, /* The tree module */ + XML_FROM_NAMESPACE, /* The XML Namespace module */ + XML_FROM_DTD, /* The XML DTD validation with parser context*/ + XML_FROM_HTML, /* The HTML parser */ + XML_FROM_MEMORY, /* The memory allocator */ + XML_FROM_OUTPUT, /* The serialization code */ + XML_FROM_IO, /* The Input/Output stack */ + XML_FROM_FTP, /* The FTP module */ + XML_FROM_HTTP, /* The HTTP module */ + XML_FROM_XINCLUDE, /* The XInclude processing */ + XML_FROM_XPATH, /* The XPath module */ + XML_FROM_XPOINTER, /* The XPointer module */ + XML_FROM_REGEXP, /* The regular expressions module */ + XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ + XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ + XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ + XML_FROM_RELAXNGP, /* The Relax-NG parser module */ + XML_FROM_RELAXNGV, /* The Relax-NG validator module */ + XML_FROM_CATALOG, /* The Catalog module */ + XML_FROM_C14N, /* The Canonicalization module */ + XML_FROM_XSLT, /* The XSLT engine from libxslt */ + XML_FROM_VALID, /* The XML DTD validation with valid context */ + XML_FROM_CHECK, /* The error checking module */ + XML_FROM_WRITER, /* The xmlwriter module */ + XML_FROM_MODULE, /* The dynamically loaded module module*/ + XML_FROM_I18N, /* The module handling character conversion */ + XML_FROM_SCHEMATRONV,/* The Schematron validator module */ + XML_FROM_BUFFER, /* The buffers module */ + XML_FROM_URI /* The URI module */ +} xmlErrorDomain; + +/** + * xmlError: + * + * An XML Error instance. + */ + +typedef struct _xmlError xmlError; +typedef xmlError *xmlErrorPtr; +struct _xmlError { + int domain; /* What part of the library raised this error */ + int code; /* The error code, e.g. an xmlParserError */ + char *message;/* human-readable informative error message */ + xmlErrorLevel level;/* how consequent is the error */ + char *file; /* the filename */ + int line; /* the line number if available */ + char *str1; /* extra string information */ + char *str2; /* extra string information */ + char *str3; /* extra string information */ + int int1; /* extra number information */ + int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */ + void *ctxt; /* the parser context if available */ + void *node; /* the node in the tree */ +}; + +/** + * xmlParserError: + * + * This is an error that the XML (or HTML) parser can generate + */ +typedef enum { + XML_ERR_OK = 0, + XML_ERR_INTERNAL_ERROR, /* 1 */ + XML_ERR_NO_MEMORY, /* 2 */ + XML_ERR_DOCUMENT_START, /* 3 */ + XML_ERR_DOCUMENT_EMPTY, /* 4 */ + XML_ERR_DOCUMENT_END, /* 5 */ + XML_ERR_INVALID_HEX_CHARREF, /* 6 */ + XML_ERR_INVALID_DEC_CHARREF, /* 7 */ + XML_ERR_INVALID_CHARREF, /* 8 */ + XML_ERR_INVALID_CHAR, /* 9 */ + XML_ERR_CHARREF_AT_EOF, /* 10 */ + XML_ERR_CHARREF_IN_PROLOG, /* 11 */ + XML_ERR_CHARREF_IN_EPILOG, /* 12 */ + XML_ERR_CHARREF_IN_DTD, /* 13 */ + XML_ERR_ENTITYREF_AT_EOF, /* 14 */ + XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ + XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ + XML_ERR_ENTITYREF_IN_DTD, /* 17 */ + XML_ERR_PEREF_AT_EOF, /* 18 */ + XML_ERR_PEREF_IN_PROLOG, /* 19 */ + XML_ERR_PEREF_IN_EPILOG, /* 20 */ + XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ + XML_ERR_ENTITYREF_NO_NAME, /* 22 */ + XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ + XML_ERR_PEREF_NO_NAME, /* 24 */ + XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ + XML_ERR_UNDECLARED_ENTITY, /* 26 */ + XML_WAR_UNDECLARED_ENTITY, /* 27 */ + XML_ERR_UNPARSED_ENTITY, /* 28 */ + XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ + XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ + XML_ERR_UNKNOWN_ENCODING, /* 31 */ + XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ + XML_ERR_STRING_NOT_STARTED, /* 33 */ + XML_ERR_STRING_NOT_CLOSED, /* 34 */ + XML_ERR_NS_DECL_ERROR, /* 35 */ + XML_ERR_ENTITY_NOT_STARTED, /* 36 */ + XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ + XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ + XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ + XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ + XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ + XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ + XML_ERR_LITERAL_NOT_STARTED, /* 43 */ + XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ + XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ + XML_ERR_PI_NOT_STARTED, /* 46 */ + XML_ERR_PI_NOT_FINISHED, /* 47 */ + XML_ERR_NOTATION_NOT_STARTED, /* 48 */ + XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ + XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ + XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ + XML_ERR_MIXED_NOT_STARTED, /* 52 */ + XML_ERR_MIXED_NOT_FINISHED, /* 53 */ + XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ + XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ + XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ + XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ + XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ + XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ + XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ + XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ + XML_ERR_MISPLACED_CDATA_END, /* 62 */ + XML_ERR_CDATA_NOT_FINISHED, /* 63 */ + XML_ERR_RESERVED_XML_NAME, /* 64 */ + XML_ERR_SPACE_REQUIRED, /* 65 */ + XML_ERR_SEPARATOR_REQUIRED, /* 66 */ + XML_ERR_NMTOKEN_REQUIRED, /* 67 */ + XML_ERR_NAME_REQUIRED, /* 68 */ + XML_ERR_PCDATA_REQUIRED, /* 69 */ + XML_ERR_URI_REQUIRED, /* 70 */ + XML_ERR_PUBID_REQUIRED, /* 71 */ + XML_ERR_LT_REQUIRED, /* 72 */ + XML_ERR_GT_REQUIRED, /* 73 */ + XML_ERR_LTSLASH_REQUIRED, /* 74 */ + XML_ERR_EQUAL_REQUIRED, /* 75 */ + XML_ERR_TAG_NAME_MISMATCH, /* 76 */ + XML_ERR_TAG_NOT_FINISHED, /* 77 */ + XML_ERR_STANDALONE_VALUE, /* 78 */ + XML_ERR_ENCODING_NAME, /* 79 */ + XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ + XML_ERR_INVALID_ENCODING, /* 81 */ + XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ + XML_ERR_CONDSEC_INVALID, /* 83 */ + XML_ERR_VALUE_REQUIRED, /* 84 */ + XML_ERR_NOT_WELL_BALANCED, /* 85 */ + XML_ERR_EXTRA_CONTENT, /* 86 */ + XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ + XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ + XML_ERR_ENTITY_LOOP, /* 89 */ + XML_ERR_ENTITY_BOUNDARY, /* 90 */ + XML_ERR_INVALID_URI, /* 91 */ + XML_ERR_URI_FRAGMENT, /* 92 */ + XML_WAR_CATALOG_PI, /* 93 */ + XML_ERR_NO_DTD, /* 94 */ + XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ + XML_ERR_VERSION_MISSING, /* 96 */ + XML_WAR_UNKNOWN_VERSION, /* 97 */ + XML_WAR_LANG_VALUE, /* 98 */ + XML_WAR_NS_URI, /* 99 */ + XML_WAR_NS_URI_RELATIVE, /* 100 */ + XML_ERR_MISSING_ENCODING, /* 101 */ + XML_WAR_SPACE_VALUE, /* 102 */ + XML_ERR_NOT_STANDALONE, /* 103 */ + XML_ERR_ENTITY_PROCESSING, /* 104 */ + XML_ERR_NOTATION_PROCESSING, /* 105 */ + XML_WAR_NS_COLUMN, /* 106 */ + XML_WAR_ENTITY_REDEFINED, /* 107 */ + XML_ERR_UNKNOWN_VERSION, /* 108 */ + XML_ERR_VERSION_MISMATCH, /* 109 */ + XML_ERR_NAME_TOO_LONG, /* 110 */ + XML_ERR_USER_STOP, /* 111 */ + XML_ERR_COMMENT_ABRUPTLY_ENDED, /* 112 */ + XML_WAR_ENCODING_MISMATCH, /* 113 */ + XML_ERR_RESOURCE_LIMIT, /* 114 */ + XML_ERR_ARGUMENT, /* 115 */ + XML_ERR_SYSTEM, /* 116 */ + XML_ERR_REDECL_PREDEF_ENTITY, /* 117 */ + XML_ERR_INT_SUBSET_NOT_FINISHED, /* 118 */ + XML_NS_ERR_XML_NAMESPACE = 200, + XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ + XML_NS_ERR_QNAME, /* 202 */ + XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ + XML_NS_ERR_EMPTY, /* 204 */ + XML_NS_ERR_COLON, /* 205 */ + XML_DTD_ATTRIBUTE_DEFAULT = 500, + XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ + XML_DTD_ATTRIBUTE_VALUE, /* 502 */ + XML_DTD_CONTENT_ERROR, /* 503 */ + XML_DTD_CONTENT_MODEL, /* 504 */ + XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ + XML_DTD_DIFFERENT_PREFIX, /* 506 */ + XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ + XML_DTD_ELEM_NAMESPACE, /* 508 */ + XML_DTD_ELEM_REDEFINED, /* 509 */ + XML_DTD_EMPTY_NOTATION, /* 510 */ + XML_DTD_ENTITY_TYPE, /* 511 */ + XML_DTD_ID_FIXED, /* 512 */ + XML_DTD_ID_REDEFINED, /* 513 */ + XML_DTD_ID_SUBSET, /* 514 */ + XML_DTD_INVALID_CHILD, /* 515 */ + XML_DTD_INVALID_DEFAULT, /* 516 */ + XML_DTD_LOAD_ERROR, /* 517 */ + XML_DTD_MISSING_ATTRIBUTE, /* 518 */ + XML_DTD_MIXED_CORRUPT, /* 519 */ + XML_DTD_MULTIPLE_ID, /* 520 */ + XML_DTD_NO_DOC, /* 521 */ + XML_DTD_NO_DTD, /* 522 */ + XML_DTD_NO_ELEM_NAME, /* 523 */ + XML_DTD_NO_PREFIX, /* 524 */ + XML_DTD_NO_ROOT, /* 525 */ + XML_DTD_NOTATION_REDEFINED, /* 526 */ + XML_DTD_NOTATION_VALUE, /* 527 */ + XML_DTD_NOT_EMPTY, /* 528 */ + XML_DTD_NOT_PCDATA, /* 529 */ + XML_DTD_NOT_STANDALONE, /* 530 */ + XML_DTD_ROOT_NAME, /* 531 */ + XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ + XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ + XML_DTD_UNKNOWN_ELEM, /* 534 */ + XML_DTD_UNKNOWN_ENTITY, /* 535 */ + XML_DTD_UNKNOWN_ID, /* 536 */ + XML_DTD_UNKNOWN_NOTATION, /* 537 */ + XML_DTD_STANDALONE_DEFAULTED, /* 538 */ + XML_DTD_XMLID_VALUE, /* 539 */ + XML_DTD_XMLID_TYPE, /* 540 */ + XML_DTD_DUP_TOKEN, /* 541 */ + XML_HTML_STRUCURE_ERROR = 800, + XML_HTML_UNKNOWN_TAG, /* 801 */ + XML_HTML_INCORRECTLY_OPENED_COMMENT, /* 802 */ + XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, + XML_RNGP_ATTR_CONFLICT, /* 1001 */ + XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ + XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ + XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ + XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ + XML_RNGP_CHOICE_CONTENT, /* 1006 */ + XML_RNGP_CHOICE_EMPTY, /* 1007 */ + XML_RNGP_CREATE_FAILURE, /* 1008 */ + XML_RNGP_DATA_CONTENT, /* 1009 */ + XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ + XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ + XML_RNGP_DEFINE_EMPTY, /* 1012 */ + XML_RNGP_DEFINE_MISSING, /* 1013 */ + XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ + XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ + XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ + XML_RNGP_ELEMENT_EMPTY, /* 1017 */ + XML_RNGP_ELEMENT_CONTENT, /* 1018 */ + XML_RNGP_ELEMENT_NAME, /* 1019 */ + XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ + XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ + XML_RNGP_EMPTY, /* 1022 */ + XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ + XML_RNGP_EMPTY_CONTENT, /* 1024 */ + XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ + XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ + XML_RNGP_EXCEPT_EMPTY, /* 1027 */ + XML_RNGP_EXCEPT_MISSING, /* 1028 */ + XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ + XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ + XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ + XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ + XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ + XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ + XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ + XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ + XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ + XML_RNGP_GRAMMAR_MISSING, /* 1038 */ + XML_RNGP_GRAMMAR_NO_START, /* 1039 */ + XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ + XML_RNGP_HREF_ERROR, /* 1041 */ + XML_RNGP_INCLUDE_EMPTY, /* 1042 */ + XML_RNGP_INCLUDE_FAILURE, /* 1043 */ + XML_RNGP_INCLUDE_RECURSE, /* 1044 */ + XML_RNGP_INTERLEAVE_ADD, /* 1045 */ + XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ + XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ + XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ + XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ + XML_RNGP_INVALID_URI, /* 1050 */ + XML_RNGP_INVALID_VALUE, /* 1051 */ + XML_RNGP_MISSING_HREF, /* 1052 */ + XML_RNGP_NAME_MISSING, /* 1053 */ + XML_RNGP_NEED_COMBINE, /* 1054 */ + XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ + XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ + XML_RNGP_NSNAME_NO_NS, /* 1057 */ + XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ + XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ + XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ + XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ + XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ + XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ + XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ + XML_RNGP_PARSE_ERROR, /* 1065 */ + XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ + XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ + XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ + XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ + XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ + XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ + XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ + XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ + XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ + XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ + XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ + XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ + XML_RNGP_PAT_LIST_ATTR, /* 1078 */ + XML_RNGP_PAT_LIST_ELEM, /* 1079 */ + XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ + XML_RNGP_PAT_LIST_LIST, /* 1081 */ + XML_RNGP_PAT_LIST_REF, /* 1082 */ + XML_RNGP_PAT_LIST_TEXT, /* 1083 */ + XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ + XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ + XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ + XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ + XML_RNGP_PAT_START_ATTR, /* 1088 */ + XML_RNGP_PAT_START_DATA, /* 1089 */ + XML_RNGP_PAT_START_EMPTY, /* 1090 */ + XML_RNGP_PAT_START_GROUP, /* 1091 */ + XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ + XML_RNGP_PAT_START_LIST, /* 1093 */ + XML_RNGP_PAT_START_ONEMORE, /* 1094 */ + XML_RNGP_PAT_START_TEXT, /* 1095 */ + XML_RNGP_PAT_START_VALUE, /* 1096 */ + XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ + XML_RNGP_REF_CREATE_FAILED, /* 1098 */ + XML_RNGP_REF_CYCLE, /* 1099 */ + XML_RNGP_REF_NAME_INVALID, /* 1100 */ + XML_RNGP_REF_NO_DEF, /* 1101 */ + XML_RNGP_REF_NO_NAME, /* 1102 */ + XML_RNGP_REF_NOT_EMPTY, /* 1103 */ + XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ + XML_RNGP_START_CONTENT, /* 1105 */ + XML_RNGP_START_EMPTY, /* 1106 */ + XML_RNGP_START_MISSING, /* 1107 */ + XML_RNGP_TEXT_EXPECTED, /* 1108 */ + XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ + XML_RNGP_TYPE_MISSING, /* 1110 */ + XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ + XML_RNGP_TYPE_VALUE, /* 1112 */ + XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ + XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ + XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ + XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ + XML_RNGP_URI_FRAGMENT, /* 1117 */ + XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ + XML_RNGP_VALUE_EMPTY, /* 1119 */ + XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ + XML_RNGP_XMLNS_NAME, /* 1121 */ + XML_RNGP_XML_NS, /* 1122 */ + XML_XPATH_EXPRESSION_OK = 1200, + XML_XPATH_NUMBER_ERROR, /* 1201 */ + XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ + XML_XPATH_START_LITERAL_ERROR, /* 1203 */ + XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ + XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ + XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ + XML_XPATH_EXPR_ERROR, /* 1207 */ + XML_XPATH_UNCLOSED_ERROR, /* 1208 */ + XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ + XML_XPATH_INVALID_OPERAND, /* 1210 */ + XML_XPATH_INVALID_TYPE, /* 1211 */ + XML_XPATH_INVALID_ARITY, /* 1212 */ + XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ + XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ + XML_XPATH_MEMORY_ERROR, /* 1215 */ + XML_XPTR_SYNTAX_ERROR, /* 1216 */ + XML_XPTR_RESOURCE_ERROR, /* 1217 */ + XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ + XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ + XML_XPATH_ENCODING_ERROR, /* 1220 */ + XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ + XML_TREE_INVALID_HEX = 1300, + XML_TREE_INVALID_DEC, /* 1301 */ + XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ + XML_TREE_NOT_UTF8, /* 1303 */ + XML_SAVE_NOT_UTF8 = 1400, + XML_SAVE_CHAR_INVALID, /* 1401 */ + XML_SAVE_NO_DOCTYPE, /* 1402 */ + XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ + XML_REGEXP_COMPILE_ERROR = 1450, + XML_IO_UNKNOWN = 1500, + XML_IO_EACCES, /* 1501 */ + XML_IO_EAGAIN, /* 1502 */ + XML_IO_EBADF, /* 1503 */ + XML_IO_EBADMSG, /* 1504 */ + XML_IO_EBUSY, /* 1505 */ + XML_IO_ECANCELED, /* 1506 */ + XML_IO_ECHILD, /* 1507 */ + XML_IO_EDEADLK, /* 1508 */ + XML_IO_EDOM, /* 1509 */ + XML_IO_EEXIST, /* 1510 */ + XML_IO_EFAULT, /* 1511 */ + XML_IO_EFBIG, /* 1512 */ + XML_IO_EINPROGRESS, /* 1513 */ + XML_IO_EINTR, /* 1514 */ + XML_IO_EINVAL, /* 1515 */ + XML_IO_EIO, /* 1516 */ + XML_IO_EISDIR, /* 1517 */ + XML_IO_EMFILE, /* 1518 */ + XML_IO_EMLINK, /* 1519 */ + XML_IO_EMSGSIZE, /* 1520 */ + XML_IO_ENAMETOOLONG, /* 1521 */ + XML_IO_ENFILE, /* 1522 */ + XML_IO_ENODEV, /* 1523 */ + XML_IO_ENOENT, /* 1524 */ + XML_IO_ENOEXEC, /* 1525 */ + XML_IO_ENOLCK, /* 1526 */ + XML_IO_ENOMEM, /* 1527 */ + XML_IO_ENOSPC, /* 1528 */ + XML_IO_ENOSYS, /* 1529 */ + XML_IO_ENOTDIR, /* 1530 */ + XML_IO_ENOTEMPTY, /* 1531 */ + XML_IO_ENOTSUP, /* 1532 */ + XML_IO_ENOTTY, /* 1533 */ + XML_IO_ENXIO, /* 1534 */ + XML_IO_EPERM, /* 1535 */ + XML_IO_EPIPE, /* 1536 */ + XML_IO_ERANGE, /* 1537 */ + XML_IO_EROFS, /* 1538 */ + XML_IO_ESPIPE, /* 1539 */ + XML_IO_ESRCH, /* 1540 */ + XML_IO_ETIMEDOUT, /* 1541 */ + XML_IO_EXDEV, /* 1542 */ + XML_IO_NETWORK_ATTEMPT, /* 1543 */ + XML_IO_ENCODER, /* 1544 */ + XML_IO_FLUSH, /* 1545 */ + XML_IO_WRITE, /* 1546 */ + XML_IO_NO_INPUT, /* 1547 */ + XML_IO_BUFFER_FULL, /* 1548 */ + XML_IO_LOAD_ERROR, /* 1549 */ + XML_IO_ENOTSOCK, /* 1550 */ + XML_IO_EISCONN, /* 1551 */ + XML_IO_ECONNREFUSED, /* 1552 */ + XML_IO_ENETUNREACH, /* 1553 */ + XML_IO_EADDRINUSE, /* 1554 */ + XML_IO_EALREADY, /* 1555 */ + XML_IO_EAFNOSUPPORT, /* 1556 */ + XML_IO_UNSUPPORTED_PROTOCOL, /* 1557 */ + XML_XINCLUDE_RECURSION=1600, + XML_XINCLUDE_PARSE_VALUE, /* 1601 */ + XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ + XML_XINCLUDE_NO_HREF, /* 1603 */ + XML_XINCLUDE_NO_FALLBACK, /* 1604 */ + XML_XINCLUDE_HREF_URI, /* 1605 */ + XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ + XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ + XML_XINCLUDE_INVALID_CHAR, /* 1608 */ + XML_XINCLUDE_BUILD_FAILED, /* 1609 */ + XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ + XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ + XML_XINCLUDE_XPTR_FAILED, /* 1612 */ + XML_XINCLUDE_XPTR_RESULT, /* 1613 */ + XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ + XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ + XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ + XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ + XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ + XML_CATALOG_MISSING_ATTR = 1650, + XML_CATALOG_ENTRY_BROKEN, /* 1651 */ + XML_CATALOG_PREFER_VALUE, /* 1652 */ + XML_CATALOG_NOT_CATALOG, /* 1653 */ + XML_CATALOG_RECURSION, /* 1654 */ + XML_SCHEMAP_PREFIX_UNDEFINED = 1700, + XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ + XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ + XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ + XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ + XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ + XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ + XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ + XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ + XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ + XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ + XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ + XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ + XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ + XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ + XML_SCHEMAP_INVALID_ENUM, /* 1715 */ + XML_SCHEMAP_INVALID_FACET, /* 1716 */ + XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ + XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ + XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ + XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ + XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ + XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ + XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ + XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ + XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ + XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ + XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ + XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ + XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ + XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ + XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ + XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ + XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ + XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ + XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ + XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ + XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ + XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ + XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ + XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ + XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ + XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ + XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ + XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ + XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ + XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ + XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ + XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ + XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ + XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ + XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ + XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ + XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ + XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ + XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ + XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ + XML_SCHEMAP_FAILED_LOAD, /* 1757 */ + XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ + XML_SCHEMAP_NOROOT, /* 1759 */ + XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ + XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ + XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ + XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ + XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ + XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ + XML_SCHEMAP_FAILED_PARSE, /* 1766 */ + XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ + XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ + XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ + XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ + XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ + XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ + XML_SCHEMAP_RECURSIVE, /* 1775 */ + XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ + XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ + XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ + XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ + XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ + XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ + XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ + XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ + XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ + XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ + XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ + XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ + XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ + XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ + XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ + XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ + XML_SCHEMAV_NOROOT = 1801, + XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ + XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ + XML_SCHEMAV_MISSING, /* 1804 */ + XML_SCHEMAV_WRONGELEM, /* 1805 */ + XML_SCHEMAV_NOTYPE, /* 1806 */ + XML_SCHEMAV_NOROLLBACK, /* 1807 */ + XML_SCHEMAV_ISABSTRACT, /* 1808 */ + XML_SCHEMAV_NOTEMPTY, /* 1809 */ + XML_SCHEMAV_ELEMCONT, /* 1810 */ + XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ + XML_SCHEMAV_NOTNILLABLE, /* 1812 */ + XML_SCHEMAV_EXTRACONTENT, /* 1813 */ + XML_SCHEMAV_INVALIDATTR, /* 1814 */ + XML_SCHEMAV_INVALIDELEM, /* 1815 */ + XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ + XML_SCHEMAV_CONSTRUCT, /* 1817 */ + XML_SCHEMAV_INTERNAL, /* 1818 */ + XML_SCHEMAV_NOTSIMPLE, /* 1819 */ + XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ + XML_SCHEMAV_ATTRINVALID, /* 1821 */ + XML_SCHEMAV_VALUE, /* 1822 */ + XML_SCHEMAV_FACET, /* 1823 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ + XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ + XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ + XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ + XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ + XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ + XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ + XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ + XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ + XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ + XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ + XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ + XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ + XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ + XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ + XML_SCHEMAV_CVC_ELT_1, /* 1845 */ + XML_SCHEMAV_CVC_ELT_2, /* 1846 */ + XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ + XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ + XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ + XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ + XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ + XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ + XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ + XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ + XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ + XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ + XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ + XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ + XML_SCHEMAV_CVC_ELT_6, /* 1859 */ + XML_SCHEMAV_CVC_ELT_7, /* 1860 */ + XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ + XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ + XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ + XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ + XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ + XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ + XML_SCHEMAV_CVC_AU, /* 1874 */ + XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ + XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ + XML_SCHEMAV_CVC_IDC, /* 1877 */ + XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ + XML_SCHEMAV_MISC, /* 1879 */ + XML_XPTR_UNKNOWN_SCHEME = 1900, + XML_XPTR_CHILDSEQ_START, /* 1901 */ + XML_XPTR_EVAL_FAILED, /* 1902 */ + XML_XPTR_EXTRA_OBJECTS, /* 1903 */ + XML_C14N_CREATE_CTXT = 1950, + XML_C14N_REQUIRES_UTF8, /* 1951 */ + XML_C14N_CREATE_STACK, /* 1952 */ + XML_C14N_INVALID_NODE, /* 1953 */ + XML_C14N_UNKNOW_NODE, /* 1954 */ + XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ + XML_FTP_PASV_ANSWER = 2000, + XML_FTP_EPSV_ANSWER, /* 2001 */ + XML_FTP_ACCNT, /* 2002 */ + XML_FTP_URL_SYNTAX, /* 2003 */ + XML_HTTP_URL_SYNTAX = 2020, + XML_HTTP_USE_IP, /* 2021 */ + XML_HTTP_UNKNOWN_HOST, /* 2022 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, + XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ + XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ + XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ + XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ + XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ + XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ + XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ + XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ + XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ + XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ + XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ + XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ + XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ + XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ + XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ + XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ + XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ + XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ + XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ + XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ + XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ + XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ + XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ + XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ + XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ + XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ + XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ + XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ + XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ + XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ + XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ + XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ + XML_SCHEMAP_NO_XMLNS, /* 3056 */ + XML_SCHEMAP_NO_XSI, /* 3057 */ + XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ + XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ + XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ + XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ + XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ + XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ + XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ + XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ + XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ + XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ + XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ + XML_SCHEMAP_SRC_CT_1, /* 3076 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ + XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ + XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ + XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ + XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ + XML_SCHEMAP_SRC_IMPORT, /* 3082 */ + XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ + XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ + XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ + XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ + XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ + XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ + XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ + XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ + XML_SCHEMATRONV_REPORT, + XML_MODULE_OPEN = 4900, /* 4900 */ + XML_MODULE_CLOSE, /* 4901 */ + XML_CHECK_FOUND_ELEMENT = 5000, + XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ + XML_CHECK_FOUND_TEXT, /* 5002 */ + XML_CHECK_FOUND_CDATA, /* 5003 */ + XML_CHECK_FOUND_ENTITYREF, /* 5004 */ + XML_CHECK_FOUND_ENTITY, /* 5005 */ + XML_CHECK_FOUND_PI, /* 5006 */ + XML_CHECK_FOUND_COMMENT, /* 5007 */ + XML_CHECK_FOUND_DOCTYPE, /* 5008 */ + XML_CHECK_FOUND_FRAGMENT, /* 5009 */ + XML_CHECK_FOUND_NOTATION, /* 5010 */ + XML_CHECK_UNKNOWN_NODE, /* 5011 */ + XML_CHECK_ENTITY_TYPE, /* 5012 */ + XML_CHECK_NO_PARENT, /* 5013 */ + XML_CHECK_NO_DOC, /* 5014 */ + XML_CHECK_NO_NAME, /* 5015 */ + XML_CHECK_NO_ELEM, /* 5016 */ + XML_CHECK_WRONG_DOC, /* 5017 */ + XML_CHECK_NO_PREV, /* 5018 */ + XML_CHECK_WRONG_PREV, /* 5019 */ + XML_CHECK_NO_NEXT, /* 5020 */ + XML_CHECK_WRONG_NEXT, /* 5021 */ + XML_CHECK_NOT_DTD, /* 5022 */ + XML_CHECK_NOT_ATTR, /* 5023 */ + XML_CHECK_NOT_ATTR_DECL, /* 5024 */ + XML_CHECK_NOT_ELEM_DECL, /* 5025 */ + XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ + XML_CHECK_NOT_NS_DECL, /* 5027 */ + XML_CHECK_NO_HREF, /* 5028 */ + XML_CHECK_WRONG_PARENT,/* 5029 */ + XML_CHECK_NS_SCOPE, /* 5030 */ + XML_CHECK_NS_ANCESTOR, /* 5031 */ + XML_CHECK_NOT_UTF8, /* 5032 */ + XML_CHECK_NO_DICT, /* 5033 */ + XML_CHECK_NOT_NCNAME, /* 5034 */ + XML_CHECK_OUTSIDE_DICT, /* 5035 */ + XML_CHECK_WRONG_NAME, /* 5036 */ + XML_CHECK_NAME_NOT_NULL, /* 5037 */ + XML_I18N_NO_NAME = 6000, + XML_I18N_NO_HANDLER, /* 6001 */ + XML_I18N_EXCESS_HANDLER, /* 6002 */ + XML_I18N_CONV_FAILED, /* 6003 */ + XML_I18N_NO_OUTPUT, /* 6004 */ + XML_BUF_OVERFLOW = 7000 +} xmlParserErrors; + +/** + * xmlGenericErrorFunc: + * @ctx: a parsing context + * @msg: the message + * @...: the extra arguments of the varargs to format the message + * + * Signature of the function to use when there is an error and + * no parsing or validity context available . + */ +typedef void (*xmlGenericErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +/** + * xmlStructuredErrorFunc: + * @userData: user provided data for the error callback + * @error: the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +typedef void (*xmlStructuredErrorFunc) (void *userData, const xmlError *error); + +/** DOC_DISABLE */ +#define XML_GLOBALS_ERROR \ + XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \ + XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_NO_ATTR) \ + XML_OP(xmlGenericErrorContext, void *, XML_NO_ATTR) \ + XML_OP(xmlStructuredError, xmlStructuredErrorFunc, XML_NO_ATTR) \ + XML_OP(xmlStructuredErrorContext, void *, XML_NO_ATTR) + +#define XML_OP XML_DECLARE_GLOBAL +XML_GLOBALS_ERROR +#undef XML_OP + +#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlLastError XML_GLOBAL_MACRO(xmlLastError) + #define xmlGenericError XML_GLOBAL_MACRO(xmlGenericError) + #define xmlGenericErrorContext XML_GLOBAL_MACRO(xmlGenericErrorContext) + #define xmlStructuredError XML_GLOBAL_MACRO(xmlStructuredError) + #define xmlStructuredErrorContext XML_GLOBAL_MACRO(xmlStructuredErrorContext) +#endif +/** DOC_ENABLE */ + +/* + * Use the following function to reset the two global variables + * xmlGenericError and xmlGenericErrorContext. + */ +XMLPUBFUN void + xmlSetGenericErrorFunc (void *ctx, + xmlGenericErrorFunc handler); +XML_DEPRECATED +XMLPUBFUN void + xmlThrDefSetGenericErrorFunc(void *ctx, + xmlGenericErrorFunc handler); +XML_DEPRECATED +XMLPUBFUN void + initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); + +XMLPUBFUN void + xmlSetStructuredErrorFunc (void *ctx, + xmlStructuredErrorFunc handler); +XML_DEPRECATED +XMLPUBFUN void + xmlThrDefSetStructuredErrorFunc(void *ctx, + xmlStructuredErrorFunc handler); +/* + * Default message routines used by SAX and Valid context for error + * and warning reporting. + */ +XMLPUBFUN void + xmlParserError (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void + xmlParserWarning (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void + xmlParserValidityError (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void + xmlParserValidityWarning (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +/** DOC_DISABLE */ +struct _xmlParserInput; +/** DOC_ENABLE */ +XMLPUBFUN void + xmlParserPrintFileInfo (struct _xmlParserInput *input); +XMLPUBFUN void + xmlParserPrintFileContext (struct _xmlParserInput *input); +XMLPUBFUN void +xmlFormatError (const xmlError *err, + xmlGenericErrorFunc channel, + void *data); + +/* + * Extended error information routines + */ +XMLPUBFUN const xmlError * + xmlGetLastError (void); +XMLPUBFUN void + xmlResetLastError (void); +XMLPUBFUN const xmlError * + xmlCtxtGetLastError (void *ctx); +XMLPUBFUN void + xmlCtxtResetLastError (void *ctx); +XMLPUBFUN void + xmlResetError (xmlErrorPtr err); +XMLPUBFUN int + xmlCopyError (const xmlError *from, + xmlErrorPtr to); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_ERROR_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlexports.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlexports.h new file mode 100644 index 0000000000000000000000000000000000000000..3c1d83f497ca5d206e450f142d82027150e18570 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlexports.h @@ -0,0 +1,146 @@ +/* + * Summary: macros for marking symbols as exportable/importable. + * Description: macros for marking symbols as exportable/importable. + * + * Copy: See Copyright for the status of this software. + */ + +#ifndef __XML_EXPORTS_H__ +#define __XML_EXPORTS_H__ + +/** DOC_DISABLE */ + +/* + * Symbol visibility + */ + +#if defined(_WIN32) || defined(__CYGWIN__) + #ifdef LIBXML_STATIC + #define XMLPUBLIC + #elif defined(IN_LIBXML) + #define XMLPUBLIC __declspec(dllexport) + #else + #define XMLPUBLIC __declspec(dllimport) + #endif +#else /* not Windows */ + #define XMLPUBLIC +#endif /* platform switch */ + +#define XMLPUBFUN XMLPUBLIC + +#define XMLPUBVAR XMLPUBLIC extern + +/* Compatibility */ +#define XMLCALL +#define XMLCDECL +#ifndef LIBXML_DLL_IMPORT + #define LIBXML_DLL_IMPORT XMLPUBVAR +#endif + +/* + * Attributes + */ + +#ifndef ATTRIBUTE_UNUSED + #if __GNUC__ * 100 + __GNUC_MINOR__ >= 207 || defined(__clang__) + #define ATTRIBUTE_UNUSED __attribute__((unused)) + #else + #define ATTRIBUTE_UNUSED + #endif +#endif + +#if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403) + #define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) +#else + #define LIBXML_ATTR_ALLOC_SIZE(x) +#endif + +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 303 + #define LIBXML_ATTR_FORMAT(fmt,args) \ + __attribute__((__format__(__printf__,fmt,args))) +#else + #define LIBXML_ATTR_FORMAT(fmt,args) +#endif + +#ifndef XML_DEPRECATED + #if defined(IN_LIBXML) + #define XML_DEPRECATED + #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301 + #define XML_DEPRECATED __attribute__((deprecated)) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + /* Available since Visual Studio 2005 */ + #define XML_DEPRECATED __declspec(deprecated) + #else + #define XML_DEPRECATED + #endif +#endif + +/* + * Warnings pragmas, should be moved from public headers + */ + +#if defined(__LCC__) + + #define XML_IGNORE_FPTR_CAST_WARNINGS + #define XML_POP_WARNINGS \ + _Pragma("diag_default 1215") + +#elif defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) + + #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800) + #define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") + #else + #define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") + #endif + #define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + + #define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push)) + #define XML_POP_WARNINGS __pragma(warning(pop)) + +#else + + #define XML_IGNORE_FPTR_CAST_WARNINGS + #define XML_POP_WARNINGS + +#endif + +/* + * Accessors for globals + */ + +#define XML_NO_ATTR + +#ifdef LIBXML_THREAD_ENABLED + #define XML_DECLARE_GLOBAL(name, type, attrs) \ + attrs XMLPUBFUN type *__##name(void); + #define XML_GLOBAL_MACRO(name) (*__##name()) +#else + #define XML_DECLARE_GLOBAL(name, type, attrs) \ + attrs XMLPUBVAR type name; +#endif + +/* + * Originally declared in xmlversion.h which is generated + */ + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN void xmlCheckVersion(int version); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_EXPORTS_H__ */ + + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmemory.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmemory.h new file mode 100644 index 0000000000000000000000000000000000000000..1de3e9fce4e949ea3663376aed2afa052341f268 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmemory.h @@ -0,0 +1,188 @@ +/* + * Summary: interface for the memory allocator + * Description: provides interfaces for the memory allocator, + * including debugging capabilities. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __DEBUG_MEMORY_ALLOC__ +#define __DEBUG_MEMORY_ALLOC__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The XML memory wrapper support 4 basic overloadable functions. + */ +/** + * xmlFreeFunc: + * @mem: an already allocated block of memory + * + * Signature for a free() implementation. + */ +typedef void (*xmlFreeFunc)(void *mem); +/** + * xmlMallocFunc: + * @size: the size requested in bytes + * + * Signature for a malloc() implementation. + * + * Returns a pointer to the newly allocated block or NULL in case of error. + */ +typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) *xmlMallocFunc)(size_t size); + +/** + * xmlReallocFunc: + * @mem: an already allocated block of memory + * @size: the new size requested in bytes + * + * Signature for a realloc() implementation. + * + * Returns a pointer to the newly reallocated block or NULL in case of error. + */ +typedef void *(*xmlReallocFunc)(void *mem, size_t size); + +/** + * xmlStrdupFunc: + * @str: a zero terminated string + * + * Signature for an strdup() implementation. + * + * Returns the copy of the string or NULL in case of error. + */ +typedef char *(*xmlStrdupFunc)(const char *str); + +/* + * In general the memory allocation entry points are not kept + * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED + * - xmlMalloc + * - xmlMallocAtomic + * - xmlRealloc + * - xmlMemStrdup + * - xmlFree + */ +/** DOC_DISABLE */ +#ifdef LIBXML_THREAD_ALLOC_ENABLED + #define XML_GLOBALS_ALLOC \ + XML_OP(xmlMalloc, xmlMallocFunc, XML_NO_ATTR) \ + XML_OP(xmlMallocAtomic, xmlMallocFunc, XML_NO_ATTR) \ + XML_OP(xmlRealloc, xmlReallocFunc, XML_NO_ATTR) \ + XML_OP(xmlFree, xmlFreeFunc, XML_NO_ATTR) \ + XML_OP(xmlMemStrdup, xmlStrdupFunc, XML_NO_ATTR) + #define XML_OP XML_DECLARE_GLOBAL + XML_GLOBALS_ALLOC + #undef XML_OP + #if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlMalloc XML_GLOBAL_MACRO(xmlMalloc) + #define xmlMallocAtomic XML_GLOBAL_MACRO(xmlMallocAtomic) + #define xmlRealloc XML_GLOBAL_MACRO(xmlRealloc) + #define xmlFree XML_GLOBAL_MACRO(xmlFree) + #define xmlMemStrdup XML_GLOBAL_MACRO(xmlMemStrdup) + #endif +#else + #define XML_GLOBALS_ALLOC +/** DOC_ENABLE */ + XMLPUBVAR xmlMallocFunc xmlMalloc; + XMLPUBVAR xmlMallocFunc xmlMallocAtomic; + XMLPUBVAR xmlReallocFunc xmlRealloc; + XMLPUBVAR xmlFreeFunc xmlFree; + XMLPUBVAR xmlStrdupFunc xmlMemStrdup; +#endif + +/* + * The way to overload the existing functions. + * The xmlGc function have an extra entry for atomic block + * allocations useful for garbage collected memory allocators + */ +XMLPUBFUN int + xmlMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); +XMLPUBFUN int + xmlMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); +XMLPUBFUN int + xmlGcMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlMallocFunc mallocAtomicFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); +XMLPUBFUN int + xmlGcMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlMallocFunc *mallocAtomicFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); + +/* + * Initialization of the memory layer. + */ +XML_DEPRECATED +XMLPUBFUN int + xmlInitMemory (void); + +/* + * Cleanup of the memory layer. + */ +XML_DEPRECATED +XMLPUBFUN void + xmlCleanupMemory (void); +/* + * These are specific to the XML debug memory wrapper. + */ +XMLPUBFUN size_t + xmlMemSize (void *ptr); +XMLPUBFUN int + xmlMemUsed (void); +XMLPUBFUN int + xmlMemBlocks (void); +XML_DEPRECATED +XMLPUBFUN void + xmlMemDisplay (FILE *fp); +XML_DEPRECATED +XMLPUBFUN void + xmlMemDisplayLast(FILE *fp, long nbBytes); +XML_DEPRECATED +XMLPUBFUN void + xmlMemShow (FILE *fp, int nr); +XML_DEPRECATED +XMLPUBFUN void + xmlMemoryDump (void); +XMLPUBFUN void * + xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN void * + xmlMemRealloc (void *ptr,size_t size); +XMLPUBFUN void + xmlMemFree (void *ptr); +XMLPUBFUN char * + xmlMemoryStrdup (const char *str); +XML_DEPRECATED +XMLPUBFUN void * + xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XML_DEPRECATED +XMLPUBFUN void * + xmlReallocLoc (void *ptr, size_t size, const char *file, int line); +XML_DEPRECATED +XMLPUBFUN void * + xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XML_DEPRECATED +XMLPUBFUN char * + xmlMemStrdupLoc (const char *str, const char *file, int line); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __DEBUG_MEMORY_ALLOC__ */ + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmodule.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmodule.h new file mode 100644 index 0000000000000000000000000000000000000000..279986c1a9fe9c4025aa3f98cf5235018e5a22de --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlmodule.h @@ -0,0 +1,57 @@ +/* + * Summary: dynamic module loading + * Description: basic API for dynamic module loading, used by + * libexslt added in 2.6.17 + * + * Copy: See Copyright for the status of this software. + * + * Author: Joel W. Reed + */ + +#ifndef __XML_MODULE_H__ +#define __XML_MODULE_H__ + +#include + +#ifdef LIBXML_MODULES_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlModulePtr: + * + * A handle to a dynamically loaded module + */ +typedef struct _xmlModule xmlModule; +typedef xmlModule *xmlModulePtr; + +/** + * xmlModuleOption: + * + * enumeration of options that can be passed down to xmlModuleOpen() + */ +typedef enum { + XML_MODULE_LAZY = 1, /* lazy binding */ + XML_MODULE_LOCAL= 2 /* local binding */ +} xmlModuleOption; + +XMLPUBFUN xmlModulePtr xmlModuleOpen (const char *filename, + int options); + +XMLPUBFUN int xmlModuleSymbol (xmlModulePtr module, + const char* name, + void **result); + +XMLPUBFUN int xmlModuleClose (xmlModulePtr module); + +XMLPUBFUN int xmlModuleFree (xmlModulePtr module); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_MODULES_ENABLED */ + +#endif /*__XML_MODULE_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlreader.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlreader.h new file mode 100644 index 0000000000000000000000000000000000000000..5d4fc5d5a179fc7c128e44cf9aa9bf4b406ef8a8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlreader.h @@ -0,0 +1,436 @@ +/* + * Summary: the XMLReader implementation + * Description: API of the XML streaming API based on C# interfaces. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XMLREADER_H__ +#define __XML_XMLREADER_H__ + +#include +#include +#include +#include +#ifdef LIBXML_SCHEMAS_ENABLED +#include +#include +#endif +/* for compatibility */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, + XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, + XML_PARSER_SEVERITY_WARNING = 3, + XML_PARSER_SEVERITY_ERROR = 4 +} xmlParserSeverities; + +#ifdef LIBXML_READER_ENABLED + +/** + * xmlTextReaderMode: + * + * Internal state values for the reader. + */ +typedef enum { + XML_TEXTREADER_MODE_INITIAL = 0, + XML_TEXTREADER_MODE_INTERACTIVE = 1, + XML_TEXTREADER_MODE_ERROR = 2, + XML_TEXTREADER_MODE_EOF =3, + XML_TEXTREADER_MODE_CLOSED = 4, + XML_TEXTREADER_MODE_READING = 5 +} xmlTextReaderMode; + +/** + * xmlParserProperties: + * + * Some common options to use with xmlTextReaderSetParserProp, but it + * is better to use xmlParserOption and the xmlReaderNewxxx and + * xmlReaderForxxx APIs now. + */ +typedef enum { + XML_PARSER_LOADDTD = 1, + XML_PARSER_DEFAULTATTRS = 2, + XML_PARSER_VALIDATE = 3, + XML_PARSER_SUBST_ENTITIES = 4 +} xmlParserProperties; + +/** + * xmlReaderTypes: + * + * Predefined constants for the different types of nodes. + */ +typedef enum { + XML_READER_TYPE_NONE = 0, + XML_READER_TYPE_ELEMENT = 1, + XML_READER_TYPE_ATTRIBUTE = 2, + XML_READER_TYPE_TEXT = 3, + XML_READER_TYPE_CDATA = 4, + XML_READER_TYPE_ENTITY_REFERENCE = 5, + XML_READER_TYPE_ENTITY = 6, + XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, + XML_READER_TYPE_COMMENT = 8, + XML_READER_TYPE_DOCUMENT = 9, + XML_READER_TYPE_DOCUMENT_TYPE = 10, + XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, + XML_READER_TYPE_NOTATION = 12, + XML_READER_TYPE_WHITESPACE = 13, + XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, + XML_READER_TYPE_END_ELEMENT = 15, + XML_READER_TYPE_END_ENTITY = 16, + XML_READER_TYPE_XML_DECLARATION = 17 +} xmlReaderTypes; + +/** + * xmlTextReader: + * + * Structure for an xmlReader context. + */ +typedef struct _xmlTextReader xmlTextReader; + +/** + * xmlTextReaderPtr: + * + * Pointer to an xmlReader context. + */ +typedef xmlTextReader *xmlTextReaderPtr; + +/* + * Constructors & Destructor + */ +XMLPUBFUN xmlTextReaderPtr + xmlNewTextReader (xmlParserInputBufferPtr input, + const char *URI); +XMLPUBFUN xmlTextReaderPtr + xmlNewTextReaderFilename(const char *URI); + +XMLPUBFUN void + xmlFreeTextReader (xmlTextReaderPtr reader); + +XMLPUBFUN int + xmlTextReaderSetup(xmlTextReaderPtr reader, + xmlParserInputBufferPtr input, const char *URL, + const char *encoding, int options); +XMLPUBFUN void + xmlTextReaderSetMaxAmplification(xmlTextReaderPtr reader, + unsigned maxAmpl); +XMLPUBFUN const xmlError * + xmlTextReaderGetLastError(xmlTextReaderPtr reader); + +/* + * Iterators + */ +XMLPUBFUN int + xmlTextReaderRead (xmlTextReaderPtr reader); + +#ifdef LIBXML_WRITER_ENABLED +XMLPUBFUN xmlChar * + xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); + +XMLPUBFUN xmlChar * + xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); +#endif + +XMLPUBFUN xmlChar * + xmlTextReaderReadString (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); + +/* + * Attributes of the node + */ +XMLPUBFUN int + xmlTextReaderAttributeCount(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderDepth (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderHasAttributes(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderHasValue(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderIsDefault (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderNodeType (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderQuoteChar (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderReadState (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); + +XMLPUBFUN const xmlChar * + xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstLocalName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstPrefix (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstString (xmlTextReaderPtr reader, + const xmlChar *str); +XMLPUBFUN const xmlChar * + xmlTextReaderConstValue (xmlTextReaderPtr reader); + +/* + * use the Const version of the routine for + * better performance and simpler code + */ +XMLPUBFUN xmlChar * + xmlTextReaderBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderLocalName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderPrefix (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderValue (xmlTextReaderPtr reader); + +/* + * Methods of the XmlTextReader + */ +XMLPUBFUN int + xmlTextReaderClose (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, + int no); +XMLPUBFUN xmlChar * + xmlTextReaderGetAttribute (xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN xmlChar * + xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN xmlParserInputBufferPtr + xmlTextReaderGetRemainder (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * + xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, + const xmlChar *prefix); +XMLPUBFUN int + xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, + int no); +XMLPUBFUN int + xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN int + xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN int + xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderMoveToElement (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderNormalization (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * + xmlTextReaderConstEncoding (xmlTextReaderPtr reader); + +/* + * Extensions + */ +XMLPUBFUN int + xmlTextReaderSetParserProp (xmlTextReaderPtr reader, + int prop, + int value); +XMLPUBFUN int + xmlTextReaderGetParserProp (xmlTextReaderPtr reader, + int prop); +XMLPUBFUN xmlNodePtr + xmlTextReaderCurrentNode (xmlTextReaderPtr reader); + +XMLPUBFUN int + xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); + +XMLPUBFUN int + xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); + +XMLPUBFUN xmlNodePtr + xmlTextReaderPreserve (xmlTextReaderPtr reader); +#ifdef LIBXML_PATTERN_ENABLED +XMLPUBFUN int + xmlTextReaderPreservePattern(xmlTextReaderPtr reader, + const xmlChar *pattern, + const xmlChar **namespaces); +#endif /* LIBXML_PATTERN_ENABLED */ +XMLPUBFUN xmlDocPtr + xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); +XMLPUBFUN xmlNodePtr + xmlTextReaderExpand (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderNext (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderNextSibling (xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderIsValid (xmlTextReaderPtr reader); +#ifdef LIBXML_SCHEMAS_ENABLED +XMLPUBFUN int + xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, + const char *rng); +XMLPUBFUN int + xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, + xmlRelaxNGValidCtxtPtr ctxt, + int options); + +XMLPUBFUN int + xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, + xmlRelaxNGPtr schema); +XMLPUBFUN int + xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, + const char *xsd); +XMLPUBFUN int + xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, + xmlSchemaValidCtxtPtr ctxt, + int options); +XMLPUBFUN int + xmlTextReaderSetSchema (xmlTextReaderPtr reader, + xmlSchemaPtr schema); +#endif +XMLPUBFUN const xmlChar * + xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); +XMLPUBFUN int + xmlTextReaderStandalone (xmlTextReaderPtr reader); + + +/* + * Index lookup + */ +XMLPUBFUN long + xmlTextReaderByteConsumed (xmlTextReaderPtr reader); + +/* + * New more complete APIs for simpler creation and reuse of readers + */ +XMLPUBFUN xmlTextReaderPtr + xmlReaderWalker (xmlDocPtr doc); +XMLPUBFUN xmlTextReaderPtr + xmlReaderForDoc (const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr + xmlReaderForFile (const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr + xmlReaderForMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr + xmlReaderForFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr + xmlReaderForIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +XMLPUBFUN int + xmlReaderNewWalker (xmlTextReaderPtr reader, + xmlDocPtr doc); +XMLPUBFUN int + xmlReaderNewDoc (xmlTextReaderPtr reader, + const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int + xmlReaderNewFile (xmlTextReaderPtr reader, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN int + xmlReaderNewMemory (xmlTextReaderPtr reader, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int + xmlReaderNewFd (xmlTextReaderPtr reader, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int + xmlReaderNewIO (xmlTextReaderPtr reader, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +/* + * Error handling extensions + */ +typedef void * xmlTextReaderLocatorPtr; + +/** + * xmlTextReaderErrorFunc: + * @arg: the user argument + * @msg: the message + * @severity: the severity of the error + * @locator: a locator indicating where the error occurred + * + * Signature of an error callback from a reader parser + */ +typedef void (*xmlTextReaderErrorFunc)(void *arg, + const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator); +XMLPUBFUN int + xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); +XMLPUBFUN xmlChar * + xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); +XMLPUBFUN void + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, + void *arg); +XMLPUBFUN void + xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, + void *arg); +XMLPUBFUN void + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, + void **arg); + +#endif /* LIBXML_READER_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XMLREADER_H__ */ + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlregexp.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlregexp.h new file mode 100644 index 0000000000000000000000000000000000000000..2d66437a55b547fc809941ee0a9bafec722a432d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlregexp.h @@ -0,0 +1,215 @@ +/* + * Summary: regular expressions handling + * Description: basic API for libxml regular expressions handling used + * for XML Schemas and validation. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_REGEXP_H__ +#define __XML_REGEXP_H__ + +#include +#include +#include + +#ifdef LIBXML_REGEXP_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlRegexpPtr: + * + * A libxml regular expression, they can actually be far more complex + * thank the POSIX regex expressions. + */ +typedef struct _xmlRegexp xmlRegexp; +typedef xmlRegexp *xmlRegexpPtr; + +/** + * xmlRegExecCtxtPtr: + * + * A libxml progressive regular expression evaluation context + */ +typedef struct _xmlRegExecCtxt xmlRegExecCtxt; +typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; + +/* + * The POSIX like API + */ +XMLPUBFUN xmlRegexpPtr + xmlRegexpCompile (const xmlChar *regexp); +XMLPUBFUN void xmlRegFreeRegexp(xmlRegexpPtr regexp); +XMLPUBFUN int + xmlRegexpExec (xmlRegexpPtr comp, + const xmlChar *value); +XMLPUBFUN void + xmlRegexpPrint (FILE *output, + xmlRegexpPtr regexp); +XMLPUBFUN int + xmlRegexpIsDeterminist(xmlRegexpPtr comp); + +/** + * xmlRegExecCallbacks: + * @exec: the regular expression context + * @token: the current token string + * @transdata: transition data + * @inputdata: input data + * + * Callback function when doing a transition in the automata + */ +typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, + const xmlChar *token, + void *transdata, + void *inputdata); + +/* + * The progressive API + */ +XMLPUBFUN xmlRegExecCtxtPtr + xmlRegNewExecCtxt (xmlRegexpPtr comp, + xmlRegExecCallbacks callback, + void *data); +XMLPUBFUN void + xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); +XMLPUBFUN int + xmlRegExecPushString(xmlRegExecCtxtPtr exec, + const xmlChar *value, + void *data); +XMLPUBFUN int + xmlRegExecPushString2(xmlRegExecCtxtPtr exec, + const xmlChar *value, + const xmlChar *value2, + void *data); + +XMLPUBFUN int + xmlRegExecNextValues(xmlRegExecCtxtPtr exec, + int *nbval, + int *nbneg, + xmlChar **values, + int *terminal); +XMLPUBFUN int + xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, + const xmlChar **string, + int *nbval, + int *nbneg, + xmlChar **values, + int *terminal); +#ifdef LIBXML_EXPR_ENABLED +/* + * Formal regular expression handling + * Its goal is to do some formal work on content models + */ + +/* expressions are used within a context */ +typedef struct _xmlExpCtxt xmlExpCtxt; +typedef xmlExpCtxt *xmlExpCtxtPtr; + +XMLPUBFUN void + xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); +XMLPUBFUN xmlExpCtxtPtr + xmlExpNewCtxt (int maxNodes, + xmlDictPtr dict); + +XMLPUBFUN int + xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); +XMLPUBFUN int + xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); + +/* Expressions are trees but the tree is opaque */ +typedef struct _xmlExpNode xmlExpNode; +typedef xmlExpNode *xmlExpNodePtr; + +typedef enum { + XML_EXP_EMPTY = 0, + XML_EXP_FORBID = 1, + XML_EXP_ATOM = 2, + XML_EXP_SEQ = 3, + XML_EXP_OR = 4, + XML_EXP_COUNT = 5 +} xmlExpNodeType; + +/* + * 2 core expressions shared by all for the empty language set + * and for the set with just the empty token + */ +XMLPUBVAR xmlExpNodePtr forbiddenExp; +XMLPUBVAR xmlExpNodePtr emptyExp; + +/* + * Expressions are reference counted internally + */ +XMLPUBFUN void + xmlExpFree (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr); +XMLPUBFUN void + xmlExpRef (xmlExpNodePtr expr); + +/* + * constructors can be either manual or from a string + */ +XMLPUBFUN xmlExpNodePtr + xmlExpParse (xmlExpCtxtPtr ctxt, + const char *expr); +XMLPUBFUN xmlExpNodePtr + xmlExpNewAtom (xmlExpCtxtPtr ctxt, + const xmlChar *name, + int len); +XMLPUBFUN xmlExpNodePtr + xmlExpNewOr (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr + xmlExpNewSeq (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr + xmlExpNewRange (xmlExpCtxtPtr ctxt, + xmlExpNodePtr subset, + int min, + int max); +/* + * The really interesting APIs + */ +XMLPUBFUN int + xmlExpIsNillable(xmlExpNodePtr expr); +XMLPUBFUN int + xmlExpMaxToken (xmlExpNodePtr expr); +XMLPUBFUN int + xmlExpGetLanguage(xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar**langList, + int len); +XMLPUBFUN int + xmlExpGetStart (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar**tokList, + int len); +XMLPUBFUN xmlExpNodePtr + xmlExpStringDerive(xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar *str, + int len); +XMLPUBFUN xmlExpNodePtr + xmlExpExpDerive (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + xmlExpNodePtr sub); +XMLPUBFUN int + xmlExpSubsume (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + xmlExpNodePtr sub); +XMLPUBFUN void + xmlExpDump (xmlBufferPtr buf, + xmlExpNodePtr expr); +#endif /* LIBXML_EXPR_ENABLED */ +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_REGEXP_ENABLED */ + +#endif /*__XML_REGEXP_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlsave.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlsave.h new file mode 100644 index 0000000000000000000000000000000000000000..e266e467c24b282a17818a013035cfe473fe50d8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlsave.h @@ -0,0 +1,102 @@ +/* + * Summary: the XML document serializer + * Description: API to save document or subtree of document + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XMLSAVE_H__ +#define __XML_XMLSAVE_H__ + +#include +#include +#include +#include + +#ifdef LIBXML_OUTPUT_ENABLED +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlSaveOption: + * + * This is the set of XML save options that can be passed down + * to the xmlSaveToFd() and similar calls. + */ +typedef enum { + XML_SAVE_FORMAT = 1<<0, /* format save output */ + XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ + XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ + XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ + XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ + XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ + XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ +} xmlSaveOption; + + +typedef struct _xmlSaveCtxt xmlSaveCtxt; +typedef xmlSaveCtxt *xmlSaveCtxtPtr; + +XMLPUBFUN xmlSaveCtxtPtr + xmlSaveToFd (int fd, + const char *encoding, + int options); +XMLPUBFUN xmlSaveCtxtPtr + xmlSaveToFilename (const char *filename, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr + xmlSaveToBuffer (xmlBufferPtr buffer, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr + xmlSaveToIO (xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + const char *encoding, + int options); + +XMLPUBFUN long + xmlSaveDoc (xmlSaveCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN long + xmlSaveTree (xmlSaveCtxtPtr ctxt, + xmlNodePtr node); + +XMLPUBFUN int + xmlSaveFlush (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int + xmlSaveClose (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int + xmlSaveFinish (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int + xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); +XMLPUBFUN int + xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); + +XML_DEPRECATED +XMLPUBFUN int + xmlThrDefIndentTreeOutput(int v); +XML_DEPRECATED +XMLPUBFUN const char * + xmlThrDefTreeIndentString(const char * v); +XML_DEPRECATED +XMLPUBFUN int + xmlThrDefSaveNoEmptyTags(int v); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_OUTPUT_ENABLED */ +#endif /* __XML_XMLSAVE_H__ */ + + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemas.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemas.h new file mode 100644 index 0000000000000000000000000000000000000000..c2af3d7098b924f0ed7bc0ab37299ae3e06d204b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemas.h @@ -0,0 +1,249 @@ +/* + * Summary: incomplete XML Schemas structure implementation + * Description: interface to the XML Schemas handling and schema validity + * checking, it is incomplete right now. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_H__ +#define __XML_SCHEMA_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This error codes are obsolete; not used any more. + */ +typedef enum { + XML_SCHEMAS_ERR_OK = 0, + XML_SCHEMAS_ERR_NOROOT = 1, + XML_SCHEMAS_ERR_UNDECLAREDELEM, + XML_SCHEMAS_ERR_NOTTOPLEVEL, + XML_SCHEMAS_ERR_MISSING, + XML_SCHEMAS_ERR_WRONGELEM, + XML_SCHEMAS_ERR_NOTYPE, + XML_SCHEMAS_ERR_NOROLLBACK, + XML_SCHEMAS_ERR_ISABSTRACT, + XML_SCHEMAS_ERR_NOTEMPTY, + XML_SCHEMAS_ERR_ELEMCONT, + XML_SCHEMAS_ERR_HAVEDEFAULT, + XML_SCHEMAS_ERR_NOTNILLABLE, + XML_SCHEMAS_ERR_EXTRACONTENT, + XML_SCHEMAS_ERR_INVALIDATTR, + XML_SCHEMAS_ERR_INVALIDELEM, + XML_SCHEMAS_ERR_NOTDETERMINIST, + XML_SCHEMAS_ERR_CONSTRUCT, + XML_SCHEMAS_ERR_INTERNAL, + XML_SCHEMAS_ERR_NOTSIMPLE, + XML_SCHEMAS_ERR_ATTRUNKNOWN, + XML_SCHEMAS_ERR_ATTRINVALID, + XML_SCHEMAS_ERR_VALUE, + XML_SCHEMAS_ERR_FACET, + XML_SCHEMAS_ERR_, + XML_SCHEMAS_ERR_XXX +} xmlSchemaValidError; + +/* +* ATTENTION: Change xmlSchemaSetValidOptions's check +* for invalid values, if adding to the validation +* options below. +*/ +/** + * xmlSchemaValidOption: + * + * This is the set of XML Schema validation options. + */ +typedef enum { + XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 + /* Default/fixed: create an attribute node + * or an element's text node on the instance. + */ +} xmlSchemaValidOption; + +/* + XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, + * assemble schemata using + * xsi:schemaLocation and + * xsi:noNamespaceSchemaLocation +*/ + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchema xmlSchema; +typedef xmlSchema *xmlSchemaPtr; + +/** + * xmlSchemaValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from an XSD validation + */ +typedef void (*xmlSchemaValidityErrorFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlSchemaValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from an XSD validation + */ +typedef void (*xmlSchemaValidityWarningFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * A schemas validation context + */ +typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; +typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; + +typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; +typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; + +/** + * xmlSchemaValidityLocatorFunc: + * @ctx: user provided context + * @file: returned file information + * @line: returned line information + * + * A schemas validation locator, a callback called by the validator. + * This is used when file or node information are not available + * to find out what file and line number are affected + * + * Returns: 0 in case of success and -1 in case of error + */ + +typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx, + const char **file, unsigned long *line); + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlSchemaParserCtxtPtr + xmlSchemaNewParserCtxt (const char *URL); +XMLPUBFUN xmlSchemaParserCtxtPtr + xmlSchemaNewMemParserCtxt (const char *buffer, + int size); +XMLPUBFUN xmlSchemaParserCtxtPtr + xmlSchemaNewDocParserCtxt (xmlDocPtr doc); +XMLPUBFUN void + xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void + xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN void + xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN int + xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc * err, + xmlSchemaValidityWarningFunc * warn, + void **ctx); +XMLPUBFUN int + xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); + +XMLPUBFUN xmlSchemaPtr + xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void + xmlSchemaFree (xmlSchemaPtr schema); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void + xmlSchemaDump (FILE *output, + xmlSchemaPtr schema); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * Interfaces for validating + */ +XMLPUBFUN void + xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN void + xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN int + xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc *err, + xmlSchemaValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN int + xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, + int options); +XMLPUBFUN void + xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, + const char *filename); +XMLPUBFUN int + xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); + +XMLPUBFUN xmlSchemaValidCtxtPtr + xmlSchemaNewValidCtxt (xmlSchemaPtr schema); +XMLPUBFUN void + xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +XMLPUBFUN int + xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, + xmlDocPtr instance); +XMLPUBFUN int + xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, + xmlNodePtr elem); +XMLPUBFUN int + xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc, + xmlSAXHandlerPtr sax, + void *user_data); +XMLPUBFUN int + xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, + const char * filename, + int options); + +XMLPUBFUN xmlParserCtxtPtr + xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); + +/* + * Interface to insert Schemas SAX validation in a SAX stream + */ +typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; +typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; + +XMLPUBFUN xmlSchemaSAXPlugPtr + xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, + xmlSAXHandlerPtr *sax, + void **user_data); +XMLPUBFUN int + xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); + + +XMLPUBFUN void + xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, + xmlSchemaValidityLocatorFunc f, + void *ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemastypes.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemastypes.h new file mode 100644 index 0000000000000000000000000000000000000000..e2cde35707c5d14f4bdab4d0a6750719d52edda6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlschemastypes.h @@ -0,0 +1,152 @@ +/* + * Summary: implementation of XML Schema Datatypes + * Description: module providing the XML Schema Datatypes implementation + * both definition and validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_TYPES_H__ +#define __XML_SCHEMA_TYPES_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMA_WHITESPACE_UNKNOWN = 0, + XML_SCHEMA_WHITESPACE_PRESERVE = 1, + XML_SCHEMA_WHITESPACE_REPLACE = 2, + XML_SCHEMA_WHITESPACE_COLLAPSE = 3 +} xmlSchemaWhitespaceValueType; + +XMLPUBFUN int + xmlSchemaInitTypes (void); +XML_DEPRECATED +XMLPUBFUN void + xmlSchemaCleanupTypes (void); +XMLPUBFUN xmlSchemaTypePtr + xmlSchemaGetPredefinedType (const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int + xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val); +XMLPUBFUN int + xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val, + xmlNodePtr node); +XMLPUBFUN int + xmlSchemaValidateFacet (xmlSchemaTypePtr base, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val); +XMLPUBFUN int + xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, + xmlSchemaWhitespaceValueType fws, + xmlSchemaValType valType, + const xmlChar *value, + xmlSchemaValPtr val, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN void + xmlSchemaFreeValue (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaFacetPtr + xmlSchemaNewFacet (void); +XMLPUBFUN int + xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, + xmlSchemaTypePtr typeDecl, + xmlSchemaParserCtxtPtr ctxt, + const xmlChar *name); +XMLPUBFUN void + xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); +XMLPUBFUN int + xmlSchemaCompareValues (xmlSchemaValPtr x, + xmlSchemaValPtr y); +XMLPUBFUN xmlSchemaTypePtr + xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); +XMLPUBFUN int + xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, + const xmlChar *value, + unsigned long actualLen, + unsigned long *expectedLen); +XMLPUBFUN xmlSchemaTypePtr + xmlSchemaGetBuiltInType (xmlSchemaValType type); +XMLPUBFUN int + xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, + int facetType); +XMLPUBFUN xmlChar * + xmlSchemaCollapseString (const xmlChar *value); +XMLPUBFUN xmlChar * + xmlSchemaWhiteSpaceReplace (const xmlChar *value); +XMLPUBFUN unsigned long + xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); +XMLPUBFUN int + xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val, + unsigned long *length); +XMLPUBFUN int + xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, + xmlSchemaValType valType, + const xmlChar *value, + xmlSchemaValPtr val, + unsigned long *length, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN int + xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val, + xmlNodePtr node); +XMLPUBFUN int + xmlSchemaGetCanonValue (xmlSchemaValPtr val, + const xmlChar **retValue); +XMLPUBFUN int + xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, + const xmlChar **retValue, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN int + xmlSchemaValueAppend (xmlSchemaValPtr prev, + xmlSchemaValPtr cur); +XMLPUBFUN xmlSchemaValPtr + xmlSchemaValueGetNext (xmlSchemaValPtr cur); +XMLPUBFUN const xmlChar * + xmlSchemaValueGetAsString (xmlSchemaValPtr val); +XMLPUBFUN int + xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaValPtr + xmlSchemaNewStringValue (xmlSchemaValType type, + const xmlChar *value); +XMLPUBFUN xmlSchemaValPtr + xmlSchemaNewNOTATIONValue (const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN xmlSchemaValPtr + xmlSchemaNewQNameValue (const xmlChar *namespaceName, + const xmlChar *localName); +XMLPUBFUN int + xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, + xmlSchemaWhitespaceValueType xws, + xmlSchemaValPtr y, + xmlSchemaWhitespaceValueType yws); +XMLPUBFUN xmlSchemaValPtr + xmlSchemaCopyValue (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaValType + xmlSchemaGetValType (xmlSchemaValPtr val); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlstring.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlstring.h new file mode 100644 index 0000000000000000000000000000000000000000..db11a0b0e50482acf67efd6b9c7ca03879648d45 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlstring.h @@ -0,0 +1,140 @@ +/* + * Summary: set of routines to process strings + * Description: type and interfaces needed for the internal string handling + * of the library, especially UTF8 processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_STRING_H__ +#define __XML_STRING_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlChar: + * + * This is a basic byte in an UTF-8 encoded string. + * It's unsigned allowing to pinpoint case where char * are assigned + * to xmlChar * (possibly making serialization back impossible). + */ +typedef unsigned char xmlChar; + +/** + * BAD_CAST: + * + * Macro to cast a string to an xmlChar * when one know its safe. + */ +#define BAD_CAST (xmlChar *) + +/* + * xmlChar handling + */ +XMLPUBFUN xmlChar * + xmlStrdup (const xmlChar *cur); +XMLPUBFUN xmlChar * + xmlStrndup (const xmlChar *cur, + int len); +XMLPUBFUN xmlChar * + xmlCharStrndup (const char *cur, + int len); +XMLPUBFUN xmlChar * + xmlCharStrdup (const char *cur); +XMLPUBFUN xmlChar * + xmlStrsub (const xmlChar *str, + int start, + int len); +XMLPUBFUN const xmlChar * + xmlStrchr (const xmlChar *str, + xmlChar val); +XMLPUBFUN const xmlChar * + xmlStrstr (const xmlChar *str, + const xmlChar *val); +XMLPUBFUN const xmlChar * + xmlStrcasestr (const xmlChar *str, + const xmlChar *val); +XMLPUBFUN int + xmlStrcmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int + xmlStrncmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int + xmlStrcasecmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int + xmlStrncasecmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int + xmlStrEqual (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int + xmlStrQEqual (const xmlChar *pref, + const xmlChar *name, + const xmlChar *str); +XMLPUBFUN int + xmlStrlen (const xmlChar *str); +XMLPUBFUN xmlChar * + xmlStrcat (xmlChar *cur, + const xmlChar *add); +XMLPUBFUN xmlChar * + xmlStrncat (xmlChar *cur, + const xmlChar *add, + int len); +XMLPUBFUN xmlChar * + xmlStrncatNew (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int + xmlStrPrintf (xmlChar *buf, + int len, + const char *msg, + ...) LIBXML_ATTR_FORMAT(3,4); +XMLPUBFUN int + xmlStrVPrintf (xmlChar *buf, + int len, + const char *msg, + va_list ap) LIBXML_ATTR_FORMAT(3,0); + +XMLPUBFUN int + xmlGetUTF8Char (const unsigned char *utf, + int *len); +XMLPUBFUN int + xmlCheckUTF8 (const unsigned char *utf); +XMLPUBFUN int + xmlUTF8Strsize (const xmlChar *utf, + int len); +XMLPUBFUN xmlChar * + xmlUTF8Strndup (const xmlChar *utf, + int len); +XMLPUBFUN const xmlChar * + xmlUTF8Strpos (const xmlChar *utf, + int pos); +XMLPUBFUN int + xmlUTF8Strloc (const xmlChar *utf, + const xmlChar *utfchar); +XMLPUBFUN xmlChar * + xmlUTF8Strsub (const xmlChar *utf, + int start, + int len); +XMLPUBFUN int + xmlUTF8Strlen (const xmlChar *utf); +XMLPUBFUN int + xmlUTF8Size (const xmlChar *utf); +XMLPUBFUN int + xmlUTF8Charcmp (const xmlChar *utf1, + const xmlChar *utf2); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_STRING_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlunicode.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlunicode.h new file mode 100644 index 0000000000000000000000000000000000000000..b6d795b267d50c22553caed286ec2aea1803a336 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlunicode.h @@ -0,0 +1,366 @@ +/* + * Summary: Unicode character APIs + * Description: API for the Unicode character APIs + * + * This file is automatically generated from the + * UCS description files of the Unicode Character Database + * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html + * using the genUnicode.py Python script. + * + * Generation date: Tue Apr 30 17:30:38 2024 + * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt + * Author: Daniel Veillard + */ + +#ifndef __XML_UNICODE_H__ +#define __XML_UNICODE_H__ + +#include + +#ifdef LIBXML_UNICODE_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsAegeanNumbers (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsAlphabeticPresentationForms (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsArabic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsArabicPresentationFormsA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsArabicPresentationFormsB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsArmenian (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsArrows (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBasicLatin (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBengali (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBlockElements (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBopomofo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBopomofoExtended (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBoxDrawing (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBraillePatterns (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsBuhid (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsByzantineMusicalSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKCompatibility (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKCompatibilityForms (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographs (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKRadicalsSupplement (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKSymbolsandPunctuation (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographs (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCherokee (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarks (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCombiningHalfMarks (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCombiningMarksforSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsControlPictures (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCurrencySymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCypriotSyllabary (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCyrillic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCyrillicSupplement (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsDeseret (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsDevanagari (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsDingbats (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsEnclosedAlphanumerics (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsEnclosedCJKLettersandMonths (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsEthiopic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGeneralPunctuation (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGeometricShapes (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGeorgian (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGothic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGreek (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGreekExtended (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGreekandCoptic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGujarati (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsGurmukhi (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHalfwidthandFullwidthForms (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHangulCompatibilityJamo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHangulJamo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHangulSyllables (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHanunoo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHebrew (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHighPrivateUseSurrogates (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHighSurrogates (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsHiragana (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsIPAExtensions (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsIdeographicDescriptionCharacters (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKanbun (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKangxiRadicals (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKannada (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKatakana (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKatakanaPhoneticExtensions (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKhmer (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsKhmerSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLao (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLatin1Supplement (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLatinExtendedA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLatinExtendedB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLatinExtendedAdditional (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLetterlikeSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLimbu (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLinearBIdeograms (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLinearBSyllabary (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsLowSurrogates (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMalayalam (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMathematicalAlphanumericSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMathematicalOperators (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMiscellaneousSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMiscellaneousSymbolsandArrows (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMiscellaneousTechnical (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMongolian (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMusicalSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsMyanmar (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsNumberForms (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsOgham (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsOldItalic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsOpticalCharacterRecognition (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsOriya (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsOsmanya (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsPhoneticExtensions (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsPrivateUse (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsPrivateUseArea (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsRunic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsShavian (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSinhala (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSmallFormVariants (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSpacingModifierLetters (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSpecials (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSuperscriptsandSubscripts (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSupplementalArrowsA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSupplementalArrowsB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSupplementalMathematicalOperators (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaA (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaB (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsSyriac (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTagalog (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTagbanwa (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTags (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTaiLe (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTaiXuanJingSymbols (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTamil (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTelugu (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsThaana (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsThai (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsTibetan (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsUgaritic (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsVariationSelectors (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsVariationSelectorsSupplement (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsYiRadicals (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsYiSyllables (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsYijingHexagramSymbols (int code); + +XMLPUBFUN int xmlUCSIsBlock (int code, const char *block); + +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatC (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatCc (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatCf (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatCo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatCs (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatL (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatLl (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatLm (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatLo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatLt (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatLu (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatM (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatMc (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatMe (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatMn (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatN (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatNd (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatNl (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatNo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatP (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPc (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPd (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPe (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPf (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPi (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatPs (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatS (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatSc (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatSk (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatSm (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatSo (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatZ (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatZl (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatZp (int code); +XML_DEPRECATED +XMLPUBFUN int xmlUCSIsCatZs (int code); + +XMLPUBFUN int xmlUCSIsCat (int code, const char *cat); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_UNICODE_ENABLED */ + +#endif /* __XML_UNICODE_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlversion.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlversion.h new file mode 100644 index 0000000000000000000000000000000000000000..3821b5f11b7f3aede7fbe97c9a75f63480989043 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlversion.h @@ -0,0 +1,347 @@ +/* + * Summary: compile-time version information + * Description: compile-time version information for the XML library + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_VERSION_H__ +#define __XML_VERSION_H__ + +/** + * LIBXML_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBXML_DOTTED_VERSION "2.13.9" + +/** + * LIBXML_VERSION: + * + * the version number: 1.2.3 value is 10203 + */ +#define LIBXML_VERSION 21309 + +/** + * LIBXML_VERSION_STRING: + * + * the version number string, 1.2.3 value is "10203" + */ +#define LIBXML_VERSION_STRING "21309" + +/** + * LIBXML_VERSION_EXTRA: + * + * extra version information, used to show a git commit description + */ +#define LIBXML_VERSION_EXTRA "" + +/** + * LIBXML_TEST_VERSION: + * + * Macro to check that the libxml version in use is compatible with + * the version the software has been compiled against + */ +#define LIBXML_TEST_VERSION xmlCheckVersion(21309); + +/** + * LIBXML_THREAD_ENABLED: + * + * Whether the thread support is configured in + */ +#if 1 +#define LIBXML_THREAD_ENABLED +#endif + +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if 0 +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + +/** + * LIBXML_TREE_ENABLED: + * + * Whether the DOM like tree manipulation API support is configured in + */ +#if 1 +#define LIBXML_TREE_ENABLED +#endif + +/** + * LIBXML_OUTPUT_ENABLED: + * + * Whether the serialization/saving support is configured in + */ +#if 1 +#define LIBXML_OUTPUT_ENABLED +#endif + +/** + * LIBXML_PUSH_ENABLED: + * + * Whether the push parsing interfaces are configured in + */ +#if 1 +#define LIBXML_PUSH_ENABLED +#endif + +/** + * LIBXML_READER_ENABLED: + * + * Whether the xmlReader parsing interface is configured in + */ +#if 1 +#define LIBXML_READER_ENABLED +#endif + +/** + * LIBXML_PATTERN_ENABLED: + * + * Whether the xmlPattern node selection interface is configured in + */ +#if 1 +#define LIBXML_PATTERN_ENABLED +#endif + +/** + * LIBXML_WRITER_ENABLED: + * + * Whether the xmlWriter saving interface is configured in + */ +#if 1 +#define LIBXML_WRITER_ENABLED +#endif + +/** + * LIBXML_SAX1_ENABLED: + * + * Whether the older SAX1 interface is configured in + */ +#if 1 +#define LIBXML_SAX1_ENABLED +#endif + +/** + * LIBXML_FTP_ENABLED: + * + * Whether the FTP support is configured in + */ +#if 1 +#define LIBXML_FTP_ENABLED +#endif + +/** + * LIBXML_HTTP_ENABLED: + * + * Whether the HTTP support is configured in + */ +#if 1 +#define LIBXML_HTTP_ENABLED +#endif + +/** + * LIBXML_VALID_ENABLED: + * + * Whether the DTD validation support is configured in + */ +#if 1 +#define LIBXML_VALID_ENABLED +#endif + +/** + * LIBXML_HTML_ENABLED: + * + * Whether the HTML support is configured in + */ +#if 1 +#define LIBXML_HTML_ENABLED +#endif + +/** + * LIBXML_LEGACY_ENABLED: + * + * Whether the deprecated APIs are compiled in for compatibility + */ +#if 1 +#define LIBXML_LEGACY_ENABLED +#endif + +/** + * LIBXML_C14N_ENABLED: + * + * Whether the Canonicalization support is configured in + */ +#if 1 +#define LIBXML_C14N_ENABLED +#endif + +/** + * LIBXML_CATALOG_ENABLED: + * + * Whether the Catalog support is configured in + */ +#if 1 +#define LIBXML_CATALOG_ENABLED +#endif + +/** + * LIBXML_XPATH_ENABLED: + * + * Whether XPath is configured in + */ +#if 1 +#define LIBXML_XPATH_ENABLED +#endif + +/** + * LIBXML_XPTR_ENABLED: + * + * Whether XPointer is configured in + */ +#if 1 +#define LIBXML_XPTR_ENABLED +#endif + +/** + * LIBXML_XPTR_LOCS_ENABLED: + * + * Whether support for XPointer locations is configured in + */ +#if 0 +#define LIBXML_XPTR_LOCS_ENABLED +#endif + +/** + * LIBXML_XINCLUDE_ENABLED: + * + * Whether XInclude is configured in + */ +#if 1 +#define LIBXML_XINCLUDE_ENABLED +#endif + +/** + * LIBXML_ICONV_ENABLED: + * + * Whether iconv support is available + */ +#if 1 +#define LIBXML_ICONV_ENABLED +#endif + +/** + * LIBXML_ICU_ENABLED: + * + * Whether icu support is available + */ +#if 1 +#define LIBXML_ICU_ENABLED +#endif + +/** + * LIBXML_ISO8859X_ENABLED: + * + * Whether ISO-8859-* support is made available in case iconv is not + */ +#if 1 +#define LIBXML_ISO8859X_ENABLED +#endif + +/** + * LIBXML_DEBUG_ENABLED: + * + * Whether Debugging module is configured in + */ +#if 1 +#define LIBXML_DEBUG_ENABLED +#endif + +/** + * LIBXML_UNICODE_ENABLED: + * + * Whether the Unicode related interfaces are compiled in + */ +#if 1 +#define LIBXML_UNICODE_ENABLED +#endif + +/** + * LIBXML_REGEXP_ENABLED: + * + * Whether the regular expressions interfaces are compiled in + */ +#if 1 +#define LIBXML_REGEXP_ENABLED +#endif + +/** + * LIBXML_AUTOMATA_ENABLED: + * + * Whether the automata interfaces are compiled in + */ +#if 1 +#define LIBXML_AUTOMATA_ENABLED +#endif + +/** + * LIBXML_SCHEMAS_ENABLED: + * + * Whether the Schemas validation interfaces are compiled in + */ +#if 1 +#define LIBXML_SCHEMAS_ENABLED +#endif + +/** + * LIBXML_SCHEMATRON_ENABLED: + * + * Whether the Schematron validation interfaces are compiled in + */ +#if 1 +#define LIBXML_SCHEMATRON_ENABLED +#endif + +/** + * LIBXML_MODULES_ENABLED: + * + * Whether the module interfaces are compiled in + */ +#if 1 +#define LIBXML_MODULES_ENABLED +/** + * LIBXML_MODULE_EXTENSION: + * + * the string suffix used by dynamic modules (usually shared libraries) + */ +#define LIBXML_MODULE_EXTENSION ".so" +#endif + +/** + * LIBXML_ZLIB_ENABLED: + * + * Whether the Zlib support is compiled in + */ +#if 1 +#define LIBXML_ZLIB_ENABLED +#endif + +/** + * LIBXML_LZMA_ENABLED: + * + * Whether the Lzma support is compiled in + */ +#if 1 +#define LIBXML_LZMA_ENABLED +#endif + +#include + +#endif + + diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlwriter.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlwriter.h new file mode 100644 index 0000000000000000000000000000000000000000..55f88bc71f0c55d0d162a398bc5300dc87290f1b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xmlwriter.h @@ -0,0 +1,489 @@ +/* + * Summary: text writing API for XML + * Description: text writing API for XML + * + * Copy: See Copyright for the status of this software. + * + * Author: Alfred Mickautsch + */ + +#ifndef __XML_XMLWRITER_H__ +#define __XML_XMLWRITER_H__ + +#include + +#ifdef LIBXML_WRITER_ENABLED + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct _xmlTextWriter xmlTextWriter; + typedef xmlTextWriter *xmlTextWriterPtr; + +/* + * Constructors & Destructor + */ + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriter(xmlOutputBufferPtr out); + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriterFilename(const char *uri, int compression); + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); + XMLPUBFUN xmlTextWriterPtr + xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, + int compression); + XMLPUBFUN void xmlFreeTextWriter(xmlTextWriterPtr writer); + +/* + * Functions + */ + + +/* + * Document + */ + XMLPUBFUN int + xmlTextWriterStartDocument(xmlTextWriterPtr writer, + const char *version, + const char *encoding, + const char *standalone); + XMLPUBFUN int xmlTextWriterEndDocument(xmlTextWriterPtr + writer); + +/* + * Comments + */ + XMLPUBFUN int xmlTextWriterStartComment(xmlTextWriterPtr + writer); + XMLPUBFUN int xmlTextWriterEndComment(xmlTextWriterPtr writer); + XMLPUBFUN int + xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int + xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int xmlTextWriterWriteComment(xmlTextWriterPtr + writer, + const xmlChar * + content); + +/* + * Elements + */ + XMLPUBFUN int + xmlTextWriterStartElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int xmlTextWriterStartElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI); + XMLPUBFUN int xmlTextWriterEndElement(xmlTextWriterPtr writer); + XMLPUBFUN int xmlTextWriterFullEndElement(xmlTextWriterPtr + writer); + +/* + * Elements conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int + xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int xmlTextWriterWriteElement(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int + xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int + xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int xmlTextWriterWriteElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * Text + */ + XMLPUBFUN int + xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int + xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int + xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, + const xmlChar * content, int len); + XMLPUBFUN int + xmlTextWriterWriteRaw(xmlTextWriterPtr writer, + const xmlChar * content); + XMLPUBFUN int xmlTextWriterWriteFormatString(xmlTextWriterPtr + writer, + const char + *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int xmlTextWriterWriteVFormatString(xmlTextWriterPtr + writer, + const char + *format, + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int xmlTextWriterWriteString(xmlTextWriterPtr writer, + const xmlChar * + content); + XMLPUBFUN int xmlTextWriterWriteBase64(xmlTextWriterPtr writer, + const char *data, + int start, int len); + XMLPUBFUN int xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, + const char *data, + int start, int len); + +/* + * Attributes + */ + XMLPUBFUN int + xmlTextWriterStartAttribute(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int xmlTextWriterStartAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI); + XMLPUBFUN int xmlTextWriterEndAttribute(xmlTextWriterPtr + writer); + +/* + * Attributes conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int + xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int xmlTextWriterWriteAttribute(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int + xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int + xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int xmlTextWriterWriteAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * PI's + */ + XMLPUBFUN int + xmlTextWriterStartPI(xmlTextWriterPtr writer, + const xmlChar * target); + XMLPUBFUN int xmlTextWriterEndPI(xmlTextWriterPtr writer); + +/* + * PI conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int + xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int + xmlTextWriterWritePI(xmlTextWriterPtr writer, + const xmlChar * target, + const xmlChar * content); + +/** + * xmlTextWriterWriteProcessingInstruction: + * + * This macro maps to xmlTextWriterWritePI + */ +#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI + +/* + * CDATA + */ + XMLPUBFUN int xmlTextWriterStartCDATA(xmlTextWriterPtr writer); + XMLPUBFUN int xmlTextWriterEndCDATA(xmlTextWriterPtr writer); + +/* + * CDATA conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int + xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int + xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, + const xmlChar * content); + +/* + * DTD + */ + XMLPUBFUN int + xmlTextWriterStartDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + XMLPUBFUN int xmlTextWriterEndDTD(xmlTextWriterPtr writer); + +/* + * DTD conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int + xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int + xmlTextWriterWriteDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * subset); + +/** + * xmlTextWriterWriteDocType: + * + * this macro maps to xmlTextWriterWriteDTD + */ +#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD + +/* + * DTD element definition + */ + XMLPUBFUN int + xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int xmlTextWriterEndDTDElement(xmlTextWriterPtr + writer); + +/* + * DTD element definition conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int + xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int xmlTextWriterWriteDTDElement(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD attribute list definition + */ + XMLPUBFUN int + xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int xmlTextWriterEndDTDAttlist(xmlTextWriterPtr + writer); + +/* + * DTD attribute list definition conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int + xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD entity definition + */ + XMLPUBFUN int + xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, + int pe, const xmlChar * name); + XMLPUBFUN int xmlTextWriterEndDTDEntity(xmlTextWriterPtr + writer); + +/* + * DTD entity definition conveniency functions + */ + XMLPUBFUN int + xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(4,5); + XMLPUBFUN int + xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(4,0); + XMLPUBFUN int + xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * content); + XMLPUBFUN int + xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * ndataid); + XMLPUBFUN int + xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr + writer, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * + ndataid); + XMLPUBFUN int xmlTextWriterWriteDTDEntity(xmlTextWriterPtr + writer, int pe, + const xmlChar * name, + const xmlChar * + pubid, + const xmlChar * + sysid, + const xmlChar * + ndataid, + const xmlChar * + content); + +/* + * DTD notation definition + */ + XMLPUBFUN int + xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + +/* + * Indentation + */ + XMLPUBFUN int + xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); + XMLPUBFUN int + xmlTextWriterSetIndentString(xmlTextWriterPtr writer, + const xmlChar * str); + + XMLPUBFUN int + xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); + + +/* + * misc + */ + XMLPUBFUN int xmlTextWriterFlush(xmlTextWriterPtr writer); + XMLPUBFUN int xmlTextWriterClose(xmlTextWriterPtr writer); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_WRITER_ENABLED */ + +#endif /* __XML_XMLWRITER_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpath.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpath.h new file mode 100644 index 0000000000000000000000000000000000000000..b89e105c08f8d0b815302aec689059306903f96f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpath.h @@ -0,0 +1,579 @@ +/* + * Summary: XML Path Language implementation + * Description: API for the XML Path Language implementation + * + * XML Path Language implementation + * XPath is a language for addressing parts of an XML document, + * designed to be used by both XSLT and XPointer + * http://www.w3.org/TR/xpath + * + * Implements + * W3C Recommendation 16 November 1999 + * http://www.w3.org/TR/1999/REC-xpath-19991116 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPATH_H__ +#define __XML_XPATH_H__ + +#include + +#ifdef LIBXML_XPATH_ENABLED + +#include +#include +#include +#endif /* LIBXML_XPATH_ENABLED */ + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef __cplusplus +extern "C" { +#endif +#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ + +#ifdef LIBXML_XPATH_ENABLED + +typedef struct _xmlXPathContext xmlXPathContext; +typedef xmlXPathContext *xmlXPathContextPtr; +typedef struct _xmlXPathParserContext xmlXPathParserContext; +typedef xmlXPathParserContext *xmlXPathParserContextPtr; + +/** + * The set of XPath error codes. + */ + +typedef enum { + XPATH_EXPRESSION_OK = 0, + XPATH_NUMBER_ERROR, + XPATH_UNFINISHED_LITERAL_ERROR, + XPATH_START_LITERAL_ERROR, + XPATH_VARIABLE_REF_ERROR, + XPATH_UNDEF_VARIABLE_ERROR, + XPATH_INVALID_PREDICATE_ERROR, + XPATH_EXPR_ERROR, + XPATH_UNCLOSED_ERROR, + XPATH_UNKNOWN_FUNC_ERROR, + XPATH_INVALID_OPERAND, + XPATH_INVALID_TYPE, + XPATH_INVALID_ARITY, + XPATH_INVALID_CTXT_SIZE, + XPATH_INVALID_CTXT_POSITION, + XPATH_MEMORY_ERROR, + XPTR_SYNTAX_ERROR, + XPTR_RESOURCE_ERROR, + XPTR_SUB_RESOURCE_ERROR, + XPATH_UNDEF_PREFIX_ERROR, + XPATH_ENCODING_ERROR, + XPATH_INVALID_CHAR_ERROR, + XPATH_INVALID_CTXT, + XPATH_STACK_ERROR, + XPATH_FORBID_VARIABLE_ERROR, + XPATH_OP_LIMIT_EXCEEDED, + XPATH_RECURSION_LIMIT_EXCEEDED +} xmlXPathError; + +/* + * A node-set (an unordered collection of nodes without duplicates). + */ +typedef struct _xmlNodeSet xmlNodeSet; +typedef xmlNodeSet *xmlNodeSetPtr; +struct _xmlNodeSet { + int nodeNr; /* number of nodes in the set */ + int nodeMax; /* size of the array as allocated */ + xmlNodePtr *nodeTab; /* array of nodes in no particular order */ + /* @@ with_ns to check whether namespace nodes should be looked at @@ */ +}; + +/* + * An expression is evaluated to yield an object, which + * has one of the following four basic types: + * - node-set + * - boolean + * - number + * - string + * + * @@ XPointer will add more types ! + */ + +typedef enum { + XPATH_UNDEFINED = 0, + XPATH_NODESET = 1, + XPATH_BOOLEAN = 2, + XPATH_NUMBER = 3, + XPATH_STRING = 4, +#ifdef LIBXML_XPTR_LOCS_ENABLED + XPATH_POINT = 5, + XPATH_RANGE = 6, + XPATH_LOCATIONSET = 7, +#endif + XPATH_USERS = 8, + XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ +} xmlXPathObjectType; + +#ifndef LIBXML_XPTR_LOCS_ENABLED +/** DOC_DISABLE */ +#define XPATH_POINT 5 +#define XPATH_RANGE 6 +#define XPATH_LOCATIONSET 7 +/** DOC_ENABLE */ +#endif + +typedef struct _xmlXPathObject xmlXPathObject; +typedef xmlXPathObject *xmlXPathObjectPtr; +struct _xmlXPathObject { + xmlXPathObjectType type; + xmlNodeSetPtr nodesetval; + int boolval; + double floatval; + xmlChar *stringval; + void *user; + int index; + void *user2; + int index2; +}; + +/** + * xmlXPathConvertFunc: + * @obj: an XPath object + * @type: the number of the target type + * + * A conversion function is associated to a type and used to cast + * the new type to primitive values. + * + * Returns -1 in case of error, 0 otherwise + */ +typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); + +/* + * Extra type: a name and a conversion function. + */ + +typedef struct _xmlXPathType xmlXPathType; +typedef xmlXPathType *xmlXPathTypePtr; +struct _xmlXPathType { + const xmlChar *name; /* the type name */ + xmlXPathConvertFunc func; /* the conversion function */ +}; + +/* + * Extra variable: a name and a value. + */ + +typedef struct _xmlXPathVariable xmlXPathVariable; +typedef xmlXPathVariable *xmlXPathVariablePtr; +struct _xmlXPathVariable { + const xmlChar *name; /* the variable name */ + xmlXPathObjectPtr value; /* the value */ +}; + +/** + * xmlXPathEvalFunc: + * @ctxt: an XPath parser context + * @nargs: the number of arguments passed to the function + * + * An XPath evaluation function, the parameters are on the XPath context stack. + */ + +typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, + int nargs); + +/* + * Extra function: a name and a evaluation function. + */ + +typedef struct _xmlXPathFunct xmlXPathFunct; +typedef xmlXPathFunct *xmlXPathFuncPtr; +struct _xmlXPathFunct { + const xmlChar *name; /* the function name */ + xmlXPathEvalFunc func; /* the evaluation function */ +}; + +/** + * xmlXPathAxisFunc: + * @ctxt: the XPath interpreter context + * @cur: the previous node being explored on that axis + * + * An axis traversal function. To traverse an axis, the engine calls + * the first time with cur == NULL and repeat until the function returns + * NULL indicating the end of the axis traversal. + * + * Returns the next node in that axis or NULL if at the end of the axis. + */ + +typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr cur); + +/* + * Extra axis: a name and an axis function. + */ + +typedef struct _xmlXPathAxis xmlXPathAxis; +typedef xmlXPathAxis *xmlXPathAxisPtr; +struct _xmlXPathAxis { + const xmlChar *name; /* the axis name */ + xmlXPathAxisFunc func; /* the search function */ +}; + +/** + * xmlXPathFunction: + * @ctxt: the XPath interprestation context + * @nargs: the number of arguments + * + * An XPath function. + * The arguments (if any) are popped out from the context stack + * and the result is pushed on the stack. + */ + +typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); + +/* + * Function and Variable Lookup. + */ + +/** + * xmlXPathVariableLookupFunc: + * @ctxt: an XPath context + * @name: name of the variable + * @ns_uri: the namespace name hosting this variable + * + * Prototype for callbacks used to plug variable lookup in the XPath + * engine. + * + * Returns the XPath object value or NULL if not found. + */ +typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +/** + * xmlXPathFuncLookupFunc: + * @ctxt: an XPath context + * @name: name of the function + * @ns_uri: the namespace name hosting this function + * + * Prototype for callbacks used to plug function lookup in the XPath + * engine. + * + * Returns the XPath function or NULL if not found. + */ +typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +/** + * xmlXPathFlags: + * Flags for XPath engine compilation and runtime + */ +/** + * XML_XPATH_CHECKNS: + * + * check namespaces at compilation + */ +#define XML_XPATH_CHECKNS (1<<0) +/** + * XML_XPATH_NOVAR: + * + * forbid variables in expression + */ +#define XML_XPATH_NOVAR (1<<1) + +/** + * xmlXPathContext: + * + * Expression evaluation occurs with respect to a context. + * he context consists of: + * - a node (the context node) + * - a node list (the context node list) + * - a set of variable bindings + * - a function library + * - the set of namespace declarations in scope for the expression + * Following the switch to hash tables, this need to be trimmed up at + * the next binary incompatible release. + * The node may be modified when the context is passed to libxml2 + * for an XPath evaluation so you may need to initialize it again + * before the next call. + */ + +struct _xmlXPathContext { + xmlDocPtr doc; /* The current document */ + xmlNodePtr node; /* The current node */ + + int nb_variables_unused; /* unused (hash table) */ + int max_variables_unused; /* unused (hash table) */ + xmlHashTablePtr varHash; /* Hash table of defined variables */ + + int nb_types; /* number of defined types */ + int max_types; /* max number of types */ + xmlXPathTypePtr types; /* Array of defined types */ + + int nb_funcs_unused; /* unused (hash table) */ + int max_funcs_unused; /* unused (hash table) */ + xmlHashTablePtr funcHash; /* Hash table of defined funcs */ + + int nb_axis; /* number of defined axis */ + int max_axis; /* max number of axis */ + xmlXPathAxisPtr axis; /* Array of defined axis */ + + /* the namespace nodes of the context node */ + xmlNsPtr *namespaces; /* Array of namespaces */ + int nsNr; /* number of namespace in scope */ + void *user; /* function to free */ + + /* extra variables */ + int contextSize; /* the context size */ + int proximityPosition; /* the proximity position */ + + /* extra stuff for XPointer */ + int xptr; /* is this an XPointer context? */ + xmlNodePtr here; /* for here() */ + xmlNodePtr origin; /* for origin() */ + + /* the set of namespace declarations in scope for the expression */ + xmlHashTablePtr nsHash; /* The namespaces hash table */ + xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ + void *varLookupData; /* variable lookup data */ + + /* Possibility to link in an extra item */ + void *extra; /* needed for XSLT */ + + /* The function name and URI when calling a function */ + const xmlChar *function; + const xmlChar *functionURI; + + /* function lookup function and data */ + xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ + void *funcLookupData; /* function lookup data */ + + /* temporary namespace lists kept for walking the namespace axis */ + xmlNsPtr *tmpNsList; /* Array of namespaces */ + int tmpNsNr; /* number of namespaces in scope */ + + /* error reporting mechanism */ + void *userData; /* user specific data block */ + xmlStructuredErrorFunc error; /* the callback in case of errors */ + xmlError lastError; /* the last error */ + xmlNodePtr debugNode; /* the source node XSLT */ + + /* dictionary */ + xmlDictPtr dict; /* dictionary if any */ + + int flags; /* flags to control compilation */ + + /* Cache for reusal of XPath objects */ + void *cache; + + /* Resource limits */ + unsigned long opLimit; + unsigned long opCount; + int depth; +}; + +/* + * The structure of a compiled expression form is not public. + */ + +typedef struct _xmlXPathCompExpr xmlXPathCompExpr; +typedef xmlXPathCompExpr *xmlXPathCompExprPtr; + +/** + * xmlXPathParserContext: + * + * An XPath parser context. It contains pure parsing information, + * an xmlXPathContext, and the stack of objects. + */ +struct _xmlXPathParserContext { + const xmlChar *cur; /* the current char being parsed */ + const xmlChar *base; /* the full expression */ + + int error; /* error code */ + + xmlXPathContextPtr context; /* the evaluation context */ + xmlXPathObjectPtr value; /* the current value */ + int valueNr; /* number of values stacked */ + int valueMax; /* max number of values stacked */ + xmlXPathObjectPtr *valueTab; /* stack of values */ + + xmlXPathCompExprPtr comp; /* the precompiled expression */ + int xptr; /* it this an XPointer expression */ + xmlNodePtr ancestor; /* used for walking preceding axis */ + + int valueFrame; /* always zero for compatibility */ +}; + +/************************************************************************ + * * + * Public API * + * * + ************************************************************************/ + +/** + * Objects and Nodesets handling + */ + +XMLPUBVAR double xmlXPathNAN; +XMLPUBVAR double xmlXPathPINF; +XMLPUBVAR double xmlXPathNINF; + +/* These macros may later turn into functions */ +/** + * xmlXPathNodeSetGetLength: + * @ns: a node-set + * + * Implement a functionality similar to the DOM NodeList.length. + * + * Returns the number of nodes in the node-set. + */ +#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) +/** + * xmlXPathNodeSetItem: + * @ns: a node-set + * @index: index of a node in the set + * + * Implements a functionality similar to the DOM NodeList.item(). + * + * Returns the xmlNodePtr at the given @index in @ns or NULL if + * @index is out of range (0 to length-1) + */ +#define xmlXPathNodeSetItem(ns, index) \ + ((((ns) != NULL) && \ + ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ + (ns)->nodeTab[(index)] \ + : NULL) +/** + * xmlXPathNodeSetIsEmpty: + * @ns: a node-set + * + * Checks whether @ns is empty or not. + * + * Returns %TRUE if @ns is an empty node-set. + */ +#define xmlXPathNodeSetIsEmpty(ns) \ + (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) + + +XMLPUBFUN void + xmlXPathFreeObject (xmlXPathObjectPtr obj); +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeSetCreate (xmlNodePtr val); +XMLPUBFUN void + xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); +XMLPUBFUN void + xmlXPathFreeNodeSet (xmlNodeSetPtr obj); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathObjectCopy (xmlXPathObjectPtr val); +XMLPUBFUN int + xmlXPathCmpNodes (xmlNodePtr node1, + xmlNodePtr node2); +/** + * Conversion functions to basic types. + */ +XMLPUBFUN int + xmlXPathCastNumberToBoolean (double val); +XMLPUBFUN int + xmlXPathCastStringToBoolean (const xmlChar * val); +XMLPUBFUN int + xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); +XMLPUBFUN int + xmlXPathCastToBoolean (xmlXPathObjectPtr val); + +XMLPUBFUN double + xmlXPathCastBooleanToNumber (int val); +XMLPUBFUN double + xmlXPathCastStringToNumber (const xmlChar * val); +XMLPUBFUN double + xmlXPathCastNodeToNumber (xmlNodePtr node); +XMLPUBFUN double + xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); +XMLPUBFUN double + xmlXPathCastToNumber (xmlXPathObjectPtr val); + +XMLPUBFUN xmlChar * + xmlXPathCastBooleanToString (int val); +XMLPUBFUN xmlChar * + xmlXPathCastNumberToString (double val); +XMLPUBFUN xmlChar * + xmlXPathCastNodeToString (xmlNodePtr node); +XMLPUBFUN xmlChar * + xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); +XMLPUBFUN xmlChar * + xmlXPathCastToString (xmlXPathObjectPtr val); + +XMLPUBFUN xmlXPathObjectPtr + xmlXPathConvertBoolean (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathConvertNumber (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathConvertString (xmlXPathObjectPtr val); + +/** + * Context handling. + */ +XMLPUBFUN xmlXPathContextPtr + xmlXPathNewContext (xmlDocPtr doc); +XMLPUBFUN void + xmlXPathFreeContext (xmlXPathContextPtr ctxt); +XMLPUBFUN void + xmlXPathSetErrorHandler(xmlXPathContextPtr ctxt, + xmlStructuredErrorFunc handler, + void *context); +XMLPUBFUN int + xmlXPathContextSetCache(xmlXPathContextPtr ctxt, + int active, + int value, + int options); +/** + * Evaluation functions. + */ +XMLPUBFUN long + xmlXPathOrderDocElems (xmlDocPtr doc); +XMLPUBFUN int + xmlXPathSetContextNode (xmlNodePtr node, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNodeEval (xmlNodePtr node, + const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathEval (const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathEvalExpression (const xmlChar *str, + xmlXPathContextPtr ctxt); +XMLPUBFUN int + xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, + xmlXPathObjectPtr res); +/** + * Separate compilation/evaluation entry points. + */ +XMLPUBFUN xmlXPathCompExprPtr + xmlXPathCompile (const xmlChar *str); +XMLPUBFUN xmlXPathCompExprPtr + xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, + const xmlChar *str); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathCompiledEval (xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctx); +XMLPUBFUN int + xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctxt); +XMLPUBFUN void + xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); +#endif /* LIBXML_XPATH_ENABLED */ +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XML_DEPRECATED +XMLPUBFUN void + xmlXPathInit (void); +XMLPUBFUN int + xmlXPathIsNaN (double val); +XMLPUBFUN int + xmlXPathIsInf (double val); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ +#endif /* ! __XML_XPATH_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpathInternals.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpathInternals.h new file mode 100644 index 0000000000000000000000000000000000000000..d1c90dff2aac24ba418503d433e7609661233060 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpathInternals.h @@ -0,0 +1,633 @@ +/* + * Summary: internal interfaces for XML Path Language implementation + * Description: internal interfaces for XML Path Language implementation + * used to build new modules on top of XPath like XPointer and + * XSLT + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPATH_INTERNALS_H__ +#define __XML_XPATH_INTERNALS_H__ + +#include +#include +#include + +#ifdef LIBXML_XPATH_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ + * * + * Helpers * + * * + ************************************************************************/ + +/* + * Many of these macros may later turn into functions. They + * shouldn't be used in #ifdef's preprocessor instructions. + */ +/** + * xmlXPathSetError: + * @ctxt: an XPath parser context + * @err: an xmlXPathError code + * + * Raises an error. + */ +#define xmlXPathSetError(ctxt, err) \ + { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ + if ((ctxt) != NULL) (ctxt)->error = (err); } + +/** + * xmlXPathSetArityError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_ARITY error. + */ +#define xmlXPathSetArityError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) + +/** + * xmlXPathSetTypeError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_TYPE error. + */ +#define xmlXPathSetTypeError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) + +/** + * xmlXPathGetError: + * @ctxt: an XPath parser context + * + * Get the error code of an XPath context. + * + * Returns the context error. + */ +#define xmlXPathGetError(ctxt) ((ctxt)->error) + +/** + * xmlXPathCheckError: + * @ctxt: an XPath parser context + * + * Check if an XPath error was raised. + * + * Returns true if an error has been raised, false otherwise. + */ +#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) + +/** + * xmlXPathGetDocument: + * @ctxt: an XPath parser context + * + * Get the document of an XPath context. + * + * Returns the context document. + */ +#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) + +/** + * xmlXPathGetContextNode: + * @ctxt: an XPath parser context + * + * Get the context node of an XPath context. + * + * Returns the context node. + */ +#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) + +XMLPUBFUN int + xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); +XMLPUBFUN double + xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * + xmlXPathPopString (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr + xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void * + xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); + +/** + * xmlXPathReturnBoolean: + * @ctxt: an XPath parser context + * @val: a boolean + * + * Pushes the boolean @val on the context stack. + */ +#define xmlXPathReturnBoolean(ctxt, val) \ + valuePush((ctxt), xmlXPathNewBoolean(val)) + +/** + * xmlXPathReturnTrue: + * @ctxt: an XPath parser context + * + * Pushes true on the context stack. + */ +#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) + +/** + * xmlXPathReturnFalse: + * @ctxt: an XPath parser context + * + * Pushes false on the context stack. + */ +#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) + +/** + * xmlXPathReturnNumber: + * @ctxt: an XPath parser context + * @val: a double + * + * Pushes the double @val on the context stack. + */ +#define xmlXPathReturnNumber(ctxt, val) \ + valuePush((ctxt), xmlXPathNewFloat(val)) + +/** + * xmlXPathReturnString: + * @ctxt: an XPath parser context + * @str: a string + * + * Pushes the string @str on the context stack. + */ +#define xmlXPathReturnString(ctxt, str) \ + valuePush((ctxt), xmlXPathWrapString(str)) + +/** + * xmlXPathReturnEmptyString: + * @ctxt: an XPath parser context + * + * Pushes an empty string on the stack. + */ +#define xmlXPathReturnEmptyString(ctxt) \ + valuePush((ctxt), xmlXPathNewCString("")) + +/** + * xmlXPathReturnNodeSet: + * @ctxt: an XPath parser context + * @ns: a node-set + * + * Pushes the node-set @ns on the context stack. + */ +#define xmlXPathReturnNodeSet(ctxt, ns) \ + valuePush((ctxt), xmlXPathWrapNodeSet(ns)) + +/** + * xmlXPathReturnEmptyNodeSet: + * @ctxt: an XPath parser context + * + * Pushes an empty node-set on the context stack. + */ +#define xmlXPathReturnEmptyNodeSet(ctxt) \ + valuePush((ctxt), xmlXPathNewNodeSet(NULL)) + +/** + * xmlXPathReturnExternal: + * @ctxt: an XPath parser context + * @val: user data + * + * Pushes user data on the context stack. + */ +#define xmlXPathReturnExternal(ctxt, val) \ + valuePush((ctxt), xmlXPathWrapExternal(val)) + +/** + * xmlXPathStackIsNodeSet: + * @ctxt: an XPath parser context + * + * Check if the current value on the XPath stack is a node set or + * an XSLT value tree. + * + * Returns true if the current object on the stack is a node-set. + */ +#define xmlXPathStackIsNodeSet(ctxt) \ + (((ctxt)->value != NULL) \ + && (((ctxt)->value->type == XPATH_NODESET) \ + || ((ctxt)->value->type == XPATH_XSLT_TREE))) + +/** + * xmlXPathStackIsExternal: + * @ctxt: an XPath parser context + * + * Checks if the current value on the XPath stack is an external + * object. + * + * Returns true if the current object on the stack is an external + * object. + */ +#define xmlXPathStackIsExternal(ctxt) \ + ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) + +/** + * xmlXPathEmptyNodeSet: + * @ns: a node-set + * + * Empties a node-set. + */ +#define xmlXPathEmptyNodeSet(ns) \ + { while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; } + +/** + * CHECK_ERROR: + * + * Macro to return from the function if an XPath error was detected. + */ +#define CHECK_ERROR \ + if (ctxt->error != XPATH_EXPRESSION_OK) return + +/** + * CHECK_ERROR0: + * + * Macro to return 0 from the function if an XPath error was detected. + */ +#define CHECK_ERROR0 \ + if (ctxt->error != XPATH_EXPRESSION_OK) return(0) + +/** + * XP_ERROR: + * @X: the error code + * + * Macro to raise an XPath error and return. + */ +#define XP_ERROR(X) \ + { xmlXPathErr(ctxt, X); return; } + +/** + * XP_ERROR0: + * @X: the error code + * + * Macro to raise an XPath error and return 0. + */ +#define XP_ERROR0(X) \ + { xmlXPathErr(ctxt, X); return(0); } + +/** + * CHECK_TYPE: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. + */ +#define CHECK_TYPE(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR(XPATH_INVALID_TYPE) + +/** + * CHECK_TYPE0: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. Return(0) in case of failure + */ +#define CHECK_TYPE0(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR0(XPATH_INVALID_TYPE) + +/** + * CHECK_ARITY: + * @x: the number of expected args + * + * Macro to check that the number of args passed to an XPath function matches. + */ +#define CHECK_ARITY(x) \ + if (ctxt == NULL) return; \ + if (nargs != (x)) \ + XP_ERROR(XPATH_INVALID_ARITY); \ + if (ctxt->valueNr < (x)) \ + XP_ERROR(XPATH_STACK_ERROR); + +/** + * CAST_TO_STRING: + * + * Macro to try to cast the value on the top of the XPath stack to a string. + */ +#define CAST_TO_STRING \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ + xmlXPathStringFunction(ctxt, 1); + +/** + * CAST_TO_NUMBER: + * + * Macro to try to cast the value on the top of the XPath stack to a number. + */ +#define CAST_TO_NUMBER \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ + xmlXPathNumberFunction(ctxt, 1); + +/** + * CAST_TO_BOOLEAN: + * + * Macro to try to cast the value on the top of the XPath stack to a boolean. + */ +#define CAST_TO_BOOLEAN \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ + xmlXPathBooleanFunction(ctxt, 1); + +/* + * Variable Lookup forwarding. + */ + +XMLPUBFUN void + xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, + xmlXPathVariableLookupFunc f, + void *data); + +/* + * Function Lookup forwarding. + */ + +XMLPUBFUN void + xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, + xmlXPathFuncLookupFunc f, + void *funcCtxt); + +/* + * Error reporting. + */ +XMLPUBFUN void + xmlXPatherror (xmlXPathParserContextPtr ctxt, + const char *file, + int line, + int no); + +XMLPUBFUN void + xmlXPathErr (xmlXPathParserContextPtr ctxt, + int error); + +#ifdef LIBXML_DEBUG_ENABLED +XMLPUBFUN void + xmlXPathDebugDumpObject (FILE *output, + xmlXPathObjectPtr cur, + int depth); +XMLPUBFUN void + xmlXPathDebugDumpCompExpr(FILE *output, + xmlXPathCompExprPtr comp, + int depth); +#endif +/** + * NodeSet handling. + */ +XMLPUBFUN int + xmlXPathNodeSetContains (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN xmlNodeSetPtr + xmlXPathDifference (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr + xmlXPathIntersection (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr + xmlXPathDistinctSorted (xmlNodeSetPtr nodes); +XMLPUBFUN xmlNodeSetPtr + xmlXPathDistinct (xmlNodeSetPtr nodes); + +XMLPUBFUN int + xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr + xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeLeading (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr + xmlXPathLeading (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr + xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeTrailing (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr + xmlXPathTrailing (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + + +/** + * Extending a context. + */ + +XMLPUBFUN int + xmlXPathRegisterNs (xmlXPathContextPtr ctxt, + const xmlChar *prefix, + const xmlChar *ns_uri); +XMLPUBFUN const xmlChar * + xmlXPathNsLookup (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +XMLPUBFUN void + xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); + +XMLPUBFUN int + xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathFunction f); +XMLPUBFUN int + xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathFunction f); +XMLPUBFUN int + xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathObjectPtr value); +XMLPUBFUN int + xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathObjectPtr value); +XMLPUBFUN xmlXPathFunction + xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathFunction + xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void + xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathVariableLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void + xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); + +/** + * Utilities to extend XPath. + */ +XMLPUBFUN xmlXPathParserContextPtr + xmlXPathNewParserContext (const xmlChar *str, + xmlXPathContextPtr ctxt); +XMLPUBFUN void + xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); + +/* TODO: remap to xmlXPathValuePop and Push. */ +XMLPUBFUN xmlXPathObjectPtr + valuePop (xmlXPathParserContextPtr ctxt); +XMLPUBFUN int + valuePush (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr value); + +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewString (const xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewCString (const char *val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathWrapString (xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathWrapCString (char * val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewFloat (double val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewBoolean (int val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewNodeSet (xmlNodePtr val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewValueTree (xmlNodePtr val); +XMLPUBFUN int + xmlXPathNodeSetAdd (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN int + xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN int + xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, + xmlNodePtr node, + xmlNsPtr ns); +XMLPUBFUN void + xmlXPathNodeSetSort (xmlNodeSetPtr set); + +XMLPUBFUN void + xmlXPathRoot (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void + xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * + xmlXPathParseName (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * + xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); + +/* + * Existing functions. + */ +XMLPUBFUN double + xmlXPathStringEvalNumber (const xmlChar *str); +XMLPUBFUN int + xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr res); +XMLPUBFUN void + xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr + xmlXPathNodeSetMerge (xmlNodeSetPtr val1, + xmlNodeSetPtr val2); +XMLPUBFUN void + xmlXPathNodeSetDel (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN void + xmlXPathNodeSetRemove (xmlNodeSetPtr cur, + int val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathNewNodeSetList (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathWrapNodeSet (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr + xmlXPathWrapExternal (void *val); + +XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); +XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void xmlXPathModValues(xmlXPathParserContextPtr ctxt); + +XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name); + +/* + * Some of the axis navigation routines. + */ +XMLPUBFUN xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +/* + * The official core of XPath functions. + */ +XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); + +/** + * Really internal functions + */ +XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNsPtr ns); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPATH_ENABLED */ +#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpointer.h b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..a5260008fc09875d409c59d8c6099f97110ebd6f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/libxml2/libxml/xpointer.h @@ -0,0 +1,138 @@ +/* + * Summary: API to handle XML Pointers + * Description: API to handle XML Pointers + * Base implementation was made accordingly to + * W3C Candidate Recommendation 7 June 2000 + * http://www.w3.org/TR/2000/CR-xptr-20000607 + * + * Added support for the element() scheme described in: + * W3C Proposed Recommendation 13 November 2002 + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPTR_H__ +#define __XML_XPTR_H__ + +#include + +#ifdef LIBXML_XPTR_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(LIBXML_XPTR_LOCS_ENABLED) +/* + * A Location Set + */ +typedef struct _xmlLocationSet xmlLocationSet; +typedef xmlLocationSet *xmlLocationSetPtr; +struct _xmlLocationSet { + int locNr; /* number of locations in the set */ + int locMax; /* size of the array as allocated */ + xmlXPathObjectPtr *locTab;/* array of locations */ +}; + +/* + * Handling of location sets. + */ + +XML_DEPRECATED +XMLPUBFUN xmlLocationSetPtr + xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); +XML_DEPRECATED +XMLPUBFUN xmlLocationSetPtr + xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, + xmlLocationSetPtr val2); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRange (xmlNodePtr start, + int startindex, + xmlNodePtr end, + int endindex); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRangePoints (xmlXPathObjectPtr start, + xmlXPathObjectPtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRangeNodePoint (xmlNodePtr start, + xmlXPathObjectPtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, + xmlNodePtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRangeNodes (xmlNodePtr start, + xmlNodePtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewLocationSetNodes (xmlNodePtr start, + xmlNodePtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewRangeNodeObject (xmlNodePtr start, + xmlXPathObjectPtr end); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrNewCollapsedRange (xmlNodePtr start); +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XML_DEPRECATED +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrWrapLocationSet (xmlLocationSetPtr val); +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrLocationSetDel (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, + int val); +#endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */ + +/* + * Functions. + */ +XMLPUBFUN xmlXPathContextPtr + xmlXPtrNewContext (xmlDocPtr doc, + xmlNodePtr here, + xmlNodePtr origin); +XMLPUBFUN xmlXPathObjectPtr + xmlXPtrEval (const xmlChar *str, + xmlXPathContextPtr ctx); + +#if defined(LIBXML_XPTR_LOCS_ENABLED) +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XML_DEPRECATED +XMLPUBFUN xmlNodePtr + xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); +XML_DEPRECATED +XMLPUBFUN void + xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); +#endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */ +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPTR_ENABLED */ +#endif /* __XML_XPTR_H__ */ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/AIS_EllipseRadiusDimension.hxx b/data/miniconda3/envs/catiagent/include/opencascade/AIS_EllipseRadiusDimension.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5d20c5f2d311487649b69462acb4a51ecad7976e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/AIS_EllipseRadiusDimension.hxx @@ -0,0 +1,22 @@ +// Copyright (c) 2020 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _AIS_EllipseRadiusDimension_HeaderFile +#define _AIS_EllipseRadiusDimension_HeaderFile + +#include + +Standard_DEPRECATED("Alias to moved class") +typedef PrsDim_EllipseRadiusDimension AIS_EllipseRadiusDimension; + +#endif // _AIS_EllipseRadiusDimension_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/AppDef_LinearCriteria.hxx b/data/miniconda3/envs/catiagent/include/opencascade/AppDef_LinearCriteria.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5cdbea5ee693c25edf905e9480d72c2b73fc2cd1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/AppDef_LinearCriteria.hxx @@ -0,0 +1,125 @@ +// Created on: 1997-09-11 +// Created by: Philippe MANGIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _AppDef_LinearCriteria_HeaderFile +#define _AppDef_LinearCriteria_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include +class FEmTool_ElementaryCriterion; +class FEmTool_Curve; +class math_Matrix; + +class AppDef_LinearCriteria; +DEFINE_STANDARD_HANDLE(AppDef_LinearCriteria, AppDef_SmoothCriterion) + +//! defined an Linear Criteria to used in variational +//! Smoothing of points. +class AppDef_LinearCriteria : public AppDef_SmoothCriterion +{ + +public: + Standard_EXPORT AppDef_LinearCriteria(const AppDef_MultiLine& SSP, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint); + + Standard_EXPORT void SetParameters(const Handle(TColStd_HArray1OfReal)& Parameters) + Standard_OVERRIDE; + + Standard_EXPORT void SetCurve(const Handle(FEmTool_Curve)& C) Standard_OVERRIDE; + + Standard_EXPORT void GetCurve(Handle(FEmTool_Curve)& C) const Standard_OVERRIDE; + + Standard_EXPORT void SetEstimation(const Standard_Real E1, + const Standard_Real E2, + const Standard_Real E3) Standard_OVERRIDE; + + Standard_EXPORT Standard_Real& EstLength() Standard_OVERRIDE; + + Standard_EXPORT void GetEstimation(Standard_Real& E1, + Standard_Real& E2, + Standard_Real& E3) const Standard_OVERRIDE; + + Standard_EXPORT Handle(FEmTool_HAssemblyTable) AssemblyTable() const Standard_OVERRIDE; + + Standard_EXPORT Handle(TColStd_HArray2OfInteger) DependenceTable() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer QualityValues(const Standard_Real J1min, + const Standard_Real J2min, + const Standard_Real J3min, + Standard_Real& J1, + Standard_Real& J2, + Standard_Real& J3) Standard_OVERRIDE; + + Standard_EXPORT void ErrorValues(Standard_Real& MaxError, + Standard_Real& QuadraticError, + Standard_Real& AverageError) Standard_OVERRIDE; + + Standard_EXPORT void Hessian(const Standard_Integer Element, + const Standard_Integer Dimension1, + const Standard_Integer Dimension2, + math_Matrix& H) Standard_OVERRIDE; + + Standard_EXPORT void Gradient(const Standard_Integer Element, + const Standard_Integer Dimension, + math_Vector& G) Standard_OVERRIDE; + + //! Convert the assembly Vector in an Curve; + Standard_EXPORT void InputVector(const math_Vector& X, + const Handle(FEmTool_HAssemblyTable)& AssTable) + Standard_OVERRIDE; + + Standard_EXPORT void SetWeight(const Standard_Real QuadraticWeight, + const Standard_Real QualityWeight, + const Standard_Real percentJ1, + const Standard_Real percentJ2, + const Standard_Real percentJ3) Standard_OVERRIDE; + + Standard_EXPORT void GetWeight(Standard_Real& QuadraticWeight, + Standard_Real& QualityWeight) const Standard_OVERRIDE; + + Standard_EXPORT void SetWeight(const TColStd_Array1OfReal& Weight) Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(AppDef_LinearCriteria, AppDef_SmoothCriterion) + +protected: +private: + Standard_EXPORT void BuildCache(const Standard_Integer E); + + AppDef_MultiLine mySSP; + Handle(TColStd_HArray1OfReal) myParameters; + Handle(TColStd_HArray1OfReal) myCache; + Handle(FEmTool_ElementaryCriterion) myCriteria[3]; + Standard_Real myEstimation[3]; + Standard_Real myQuadraticWeight; + Standard_Real myQualityWeight; + Standard_Real myPercent[3]; + TColStd_Array1OfReal myPntWeight; + Handle(FEmTool_Curve) myCurve; + Standard_Real myLength; + Standard_Integer myE; + Standard_Integer IF; + Standard_Integer IL; +}; + +#endif // _AppDef_LinearCriteria_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx b/data/miniconda3/envs/catiagent/include/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9d930326027b8352e67125156e57ac142ec97ee2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/AppDef_ParLeastSquareOfTheGradient.hxx @@ -0,0 +1,283 @@ +// Created on: 1991-12-02 +// Created by: Laurent PAINNOT +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _AppDef_ParLeastSquareOfTheGradient_HeaderFile +#define _AppDef_ParLeastSquareOfTheGradient_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class StdFail_NotDone; +class Standard_OutOfRange; +class Standard_DimensionError; +class Standard_NoSuchObject; +class AppDef_MultiLine; +class AppDef_MyLineTool; +class AppParCurves_MultiCurve; +class AppParCurves_MultiBSpCurve; +class math_Matrix; + +class AppDef_ParLeastSquareOfTheGradient +{ +public: + DEFINE_STANDARD_ALLOC + + //! given a MultiLine, this algorithm computes the least + //! square resolution using the Householder-QR method. + //! If the first and/or the last point is a constraint + //! point, the value of the tangency or curvature is + //! computed in the resolution. + //! NbPol is the number of control points wanted + //! for the approximating curves. + //! The system to solve is the following: + //! A X = B. + //! Where A is the Bernstein matrix computed with the + //! parameters, B the points coordinates and X the poles + //! solutions. + //! The matrix A is the same for each coordinate x, y and z + //! and is also the same for each MultiLine point because + //! they are approximated in parallel(so with the same + //! parameter, only the vector B changes). + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const Standard_Integer NbPol); + + //! Initializes the fields of the object. + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const Standard_Integer NbPol); + + //! given a MultiLine, this algorithm computes the least + //! square resolution using the Householder-QR method. + //! If the first and/or the last point is a constraint + //! point, the value of the tangency or curvature is + //! computed in the resolution. + //! Deg is the degree wanted for the approximating curves. + //! The system to solve is the following: + //! A X = B. + //! Where A is the BSpline functions matrix computed with + //! , B the points coordinates and X the poles + //! solutions. + //! The matrix A is the same for each coordinate x, y and z + //! and is also the same for each MultiLine point because + //! they are approximated in parallel(so with the same + //! parameter, only the vector B changes). + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const TColStd_Array1OfReal& Knots, + const TColStd_Array1OfInteger& Mults, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const math_Vector& Parameters, + const Standard_Integer NbPol); + + //! Initializes the fields of the object. + Standard_EXPORT AppDef_ParLeastSquareOfTheGradient(const AppDef_MultiLine& SSP, + const TColStd_Array1OfReal& Knots, + const TColStd_Array1OfInteger& Mults, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint, + const AppParCurves_Constraint FirstCons, + const AppParCurves_Constraint LastCons, + const Standard_Integer NbPol); + + //! Is used after having initialized the fields. + //! The case "CurvaturePoint" is not treated in this method. + Standard_EXPORT void Perform(const math_Vector& Parameters); + + //! Is used after having initialized the fields. + Standard_EXPORT void Perform(const math_Vector& Parameters, + const Standard_Real l1, + const Standard_Real l2); + + //! Is used after having initialized the fields. + //! is the tangent vector at the first point. + //! is the tangent vector at the last point. + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const Standard_Real l1, + const Standard_Real l2); + + //! Is used after having initialized the fields. + //! is the tangent vector at the first point. + //! is the tangent vector at the last point. + //! is the tangent vector at the first point. + //! is the tangent vector at the last point. + Standard_EXPORT void Perform(const math_Vector& Parameters, + const math_Vector& V1t, + const math_Vector& V2t, + const math_Vector& V1c, + const math_Vector& V2c, + const Standard_Real l1, + const Standard_Real l2); + + //! returns True if all has been correctly done. + Standard_EXPORT Standard_Boolean IsDone() const; + + //! returns the result of the approximation, i.e. all the + //! Curves. + //! An exception is raised if NotDone. + Standard_EXPORT AppParCurves_MultiCurve BezierValue(); + + //! returns the result of the approximation, i.e. all the + //! Curves. + //! An exception is raised if NotDone. + Standard_EXPORT const AppParCurves_MultiBSpCurve& BSplineValue(); + + //! returns the function matrix used to approximate the + //! set. + Standard_EXPORT const math_Matrix& FunctionMatrix() const; + + //! returns the derivative function matrix used + //! to approximate the set. + Standard_EXPORT const math_Matrix& DerivativeFunctionMatrix() const; + + //! returns the maximum errors between the MultiLine + //! and the approximation curves. F is the sum of the square + //! distances. Grad is the derivative vector of the + //! function F. + Standard_EXPORT void ErrorGradient(math_Vector& Grad, + Standard_Real& F, + Standard_Real& MaxE3d, + Standard_Real& MaxE2d); + + //! returns the distances between the points of the + //! multiline and the approximation curves. + Standard_EXPORT const math_Matrix& Distance(); + + //! returns the maximum errors between the MultiLine + //! and the approximation curves. F is the sum of the square + //! distances. + Standard_EXPORT void Error(Standard_Real& F, Standard_Real& MaxE3d, Standard_Real& MaxE2d); + + //! returns the value (P2 - P1)/ V1 if the first point + //! was a tangency point. + Standard_EXPORT Standard_Real FirstLambda() const; + + //! returns the value (PN - PN-1)/ VN if the last point + //! was a tangency point. + Standard_EXPORT Standard_Real LastLambda() const; + + //! returns the matrix of points value. + Standard_EXPORT const math_Matrix& Points() const; + + //! returns the matrix of resulting control points value. + Standard_EXPORT const math_Matrix& Poles() const; + + //! Returns the indexes of the first non null values of + //! A and DA. + //! The values are non null from Index(ieme point) +1 + //! to Index(ieme point) + degree +1. + Standard_EXPORT const math_IntegerVector& KIndex() const; + +protected: + //! is used by the constructors above. + Standard_EXPORT void Init(const AppDef_MultiLine& SSP, + const Standard_Integer FirstPoint, + const Standard_Integer LastPoint); + + //! returns the number of second member columns. + //! Is used internally to initialize the fields. + Standard_EXPORT Standard_Integer NbBColumns(const AppDef_MultiLine& SSP) const; + + //! returns the first point being fitted. + Standard_EXPORT Standard_Integer TheFirstPoint(const AppParCurves_Constraint FirstCons, + const Standard_Integer FirstPoint) const; + + //! returns the last point being fitted. + Standard_EXPORT Standard_Integer TheLastPoint(const AppParCurves_Constraint LastCons, + const Standard_Integer LastPoint) const; + + //! Affects the fields in the case of a constraint point. + Standard_EXPORT void Affect(const AppDef_MultiLine& SSP, + const Standard_Integer Index, + AppParCurves_Constraint& Cons, + math_Vector& Vt, + math_Vector& Vc); + + Standard_EXPORT void ComputeFunction(const math_Vector& Parameters); + + Standard_EXPORT void SearchIndex(math_IntegerVector& Index); + + //! computes internal matrixes for the resolution + Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Vector& TheB); + + //! computes internal matrixes for the resolution + Standard_EXPORT void MakeTAA(math_Vector& TheA); + + //! computes internal matrixes for the resolution + Standard_EXPORT void MakeTAA(math_Vector& TheA, math_Matrix& TheB); + +private: + AppParCurves_Constraint FirstConstraint; + AppParCurves_Constraint LastConstraint; + AppParCurves_MultiBSpCurve SCU; + Handle(TColStd_HArray1OfReal) myknots; + Handle(TColStd_HArray1OfInteger) mymults; + math_Matrix mypoles; + math_Matrix A; + math_Matrix DA; + math_Matrix B2; + math_Matrix mypoints; + math_Vector Vflatknots; + math_Vector Vec1t; + math_Vector Vec1c; + math_Vector Vec2t; + math_Vector Vec2c; + math_Matrix theError; + math_IntegerVector myindex; + Standard_Real lambda1; + Standard_Real lambda2; + Standard_Integer FirstP; + Standard_Integer LastP; + Standard_Integer Nlignes; + Standard_Integer Ninc; + Standard_Integer NA; + Standard_Integer myfirstp; + Standard_Integer mylastp; + Standard_Integer resinit; + Standard_Integer resfin; + Standard_Integer nbP2d; + Standard_Integer nbP; + Standard_Integer nbpoles; + Standard_Integer deg; + Standard_Boolean done; + Standard_Boolean iscalculated; + Standard_Boolean isready; +}; + +#endif // _AppDef_ParLeastSquareOfTheGradient_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..cac25aec2b4aaf900dbe3f3563c2828dbef83b9b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/AppParCurves_HArray1OfMultiBSpCurve.hxx @@ -0,0 +1,26 @@ +// Created on: 1991-04-11 +// Created by: Laurent PAINNOT +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef AppParCurves_HArray1OfMultiBSpCurve_HeaderFile +#define AppParCurves_HArray1OfMultiBSpCurve_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(AppParCurves_HArray1OfMultiBSpCurve, AppParCurves_Array1OfMultiBSpCurve) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectLineDefinitionError.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectLineDefinitionError.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a9a2dfa1984a5b14b5a4468afc612ada72609cad --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectLineDefinitionError.hxx @@ -0,0 +1,36 @@ +// Created by: NW,JPB,CAL +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_AspectLineDefinitionError_HeaderFile +#define _Aspect_AspectLineDefinitionError_HeaderFile + +#include +#include +#include + +class Aspect_AspectLineDefinitionError; +DEFINE_STANDARD_HANDLE(Aspect_AspectLineDefinitionError, Standard_OutOfRange) + +#if !defined No_Exception && !defined No_Aspect_AspectLineDefinitionError + #define Aspect_AspectLineDefinitionError_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw Aspect_AspectLineDefinitionError(MESSAGE); +#else + #define Aspect_AspectLineDefinitionError_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(Aspect_AspectLineDefinitionError, Standard_OutOfRange) + +#endif // _Aspect_AspectLineDefinitionError_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectMarkerDefinitionError.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectMarkerDefinitionError.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bc6d391bed38eea8229634489be7ea0ab7d86cab --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_AspectMarkerDefinitionError.hxx @@ -0,0 +1,36 @@ +// Created by: NW,JPB,CAL +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_AspectMarkerDefinitionError_HeaderFile +#define _Aspect_AspectMarkerDefinitionError_HeaderFile + +#include +#include +#include + +class Aspect_AspectMarkerDefinitionError; +DEFINE_STANDARD_HANDLE(Aspect_AspectMarkerDefinitionError, Standard_OutOfRange) + +#if !defined No_Exception && !defined No_Aspect_AspectMarkerDefinitionError + #define Aspect_AspectMarkerDefinitionError_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw Aspect_AspectMarkerDefinitionError(MESSAGE); +#else + #define Aspect_AspectMarkerDefinitionError_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(Aspect_AspectMarkerDefinitionError, Standard_OutOfRange) + +#endif // _Aspect_AspectMarkerDefinitionError_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Aspect_GradientBackground.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_GradientBackground.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2e2251f9069a82d9acd167854ad28fef83fb3cc3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_GradientBackground.hxx @@ -0,0 +1,59 @@ +// Created on: 2010-05-21 +// Created by: PAUL SUPRYATKIN +// Copyright (c) 2010-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_GradientBackground_HeaderFile +#define _Aspect_GradientBackground_HeaderFile + +#include +#include + +//! This class allows the definition of a window gradient background. +class Aspect_GradientBackground : public Aspect_Background +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates a window gradient background. + //! Default color is Quantity_NOC_BLACK. + //! Default fill method is Aspect_GradientFillMethod_None. + Standard_EXPORT Aspect_GradientBackground(); + + //! Creates a window gradient background with two colours. + Standard_EXPORT Aspect_GradientBackground( + const Quantity_Color& theColor1, + const Quantity_Color& theColor2, + const Aspect_GradientFillMethod theMethod = Aspect_GradientFillMethod_Horizontal); + + //! Modifies the colours of the window gradient background. + Standard_EXPORT void SetColors( + const Quantity_Color& theColor1, + const Quantity_Color& theColor2, + const Aspect_GradientFillMethod theMethod = Aspect_GradientFillMethod_Horizontal); + + //! Returns colours of the window gradient background. + Standard_EXPORT void Colors(Quantity_Color& theColor1, Quantity_Color& theColor2) const; + + //! Returns the current gradient background fill mode. + Standard_EXPORT Aspect_GradientFillMethod BgGradientFillMethod() const; + + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + +private: + Quantity_Color MyColor2; + Aspect_GradientFillMethod MyGradientMethod; +}; + +#endif // _Aspect_GradientBackground_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Aspect_SkydomeBackground.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_SkydomeBackground.hxx new file mode 100644 index 0000000000000000000000000000000000000000..43b6fb5e7834954d97bdb0fdd1cdafe776caf32e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_SkydomeBackground.hxx @@ -0,0 +1,103 @@ +// Created on: 2021-10-14 +// Created by: Artem CHESNOKOV +// Copyright (c) 2021 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_SkydomeBackground_Header +#define _Aspect_SkydomeBackground_Header + +#include +#include +#include +#include +#include + +//! This class allows the definition of a window skydome background. +class Aspect_SkydomeBackground +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates a window skydome background. + //! By default skydome is initialized with sun at its zenith (0.0, 1.0, 0.0), + //! average clody (0.2), zero time parameter, zero fogginess, 512x512 texture size. + Standard_EXPORT Aspect_SkydomeBackground(); + + //! Creates a window skydome background with given parameters. + //! @param[in] theSunDirection direction to the sun (moon). Sun direction with negative Y + //! component + //! represents moon with (-X, -Y, -Z) direction. + //! @param[in] theCloudiness cloud intensity, 0.0 means no clouds at all and 1.0 - high clody. + //! @param[in] theTime time parameter of simulation. Might be tweaked to slightly change + //! appearance. + //! @param[in] theFogginess fog intensity, 0.0 means no fog and 1.0 - high fogginess + //! @param[in] theSize size of cubemap side in pixels. + Standard_EXPORT Aspect_SkydomeBackground(const gp_Dir& theSunDirection, + Standard_ShortReal theCloudiness, + Standard_ShortReal theTime, + Standard_ShortReal theFogginess, + Standard_Integer theSize); + + //! Destructor. + Standard_EXPORT ~Aspect_SkydomeBackground(); + + //! Get sun direction. By default this value is (0, 1, 0) + //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction. + const gp_Dir& SunDirection() const { return mySunDirection; } + + //! Get cloud intensity. By default this value is 0.2 + //! 0.0 means no clouds at all and 1.0 - high clody. + Standard_ShortReal Cloudiness() const { return myCloudiness; } + + //! Get time of cloud simulation. By default this value is 0.0 + //! This value might be tweaked to slightly change appearance of clouds. + Standard_ShortReal TimeParameter() const { return myTime; } + + //! Get fog intensity. By default this value is 0.0 + //! 0.0 means no fog and 1.0 - high fogginess + Standard_ShortReal Fogginess() const { return myFogginess; } + + //! Get size of cubemap. By default this value is 512 + Standard_Integer Size() const { return mySize; } + + //! Set sun direction. By default this value is (0, 1, 0) + //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction. + void SetSunDirection(const gp_Dir& theSunDirection) { mySunDirection = theSunDirection; } + + //! Set cloud intensity. By default this value is 0.2 + //! 0.0 means no clouds at all and 1.0 - high clody. + Standard_EXPORT void SetCloudiness(Standard_ShortReal theCloudiness); + + //! Set time of cloud simulation. By default this value is 0.0 + //! This value might be tweaked to slightly change appearance of clouds. + void SetTimeParameter(Standard_ShortReal theTime) { myTime = theTime; } + + //! Set fog intensity. By default this value is 0.0 + //! 0.0 means no fog and 1.0 - high fogginess + Standard_EXPORT void SetFogginess(Standard_ShortReal theFogginess); + + //! Set size of cubemap. By default this value is 512 + Standard_EXPORT void SetSize(Standard_Integer theSize); + + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + +private: + gp_Dir mySunDirection; //!< Sun (moon) light direction. + Standard_ShortReal myCloudiness; //!< Cloud intensity. + Standard_ShortReal myTime; //!< Simulation time parameter. + Standard_ShortReal myFogginess; //!< Fog intensity + Standard_Integer mySize; //!< Size of cubemap in pixels +}; + +#endif // _Aspect_SkydomeBackground_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Aspect_VKey.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_VKey.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2e2dde653149ead73443d27bab7ff37ebe07ffba --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Aspect_VKey.hxx @@ -0,0 +1,221 @@ +// Copyright (c) 2016-2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Aspect_VKey_HeaderFile +#define _Aspect_VKey_HeaderFile + +#include + +//! Define virtual key as integer number to allow extensions. +typedef unsigned int Aspect_VKey; + +//! Enumeration defining virtual keys irrelevant to current keyboard layout for simplified hot-keys +//! management logic. +enum Aspect_VKeyBasic +{ + Aspect_VKey_UNKNOWN = 0, + + // main latin alphabet keys + Aspect_VKey_A = 1, + Aspect_VKey_B, + Aspect_VKey_C, + Aspect_VKey_D, + Aspect_VKey_E, + Aspect_VKey_F, + Aspect_VKey_G, + Aspect_VKey_H, + Aspect_VKey_I, + Aspect_VKey_J, + Aspect_VKey_K, + Aspect_VKey_L, + Aspect_VKey_M, + Aspect_VKey_N, + Aspect_VKey_O, + Aspect_VKey_P, + Aspect_VKey_Q, + Aspect_VKey_R, + Aspect_VKey_S, + Aspect_VKey_T, + Aspect_VKey_U, + Aspect_VKey_V, + Aspect_VKey_W, + Aspect_VKey_X, + Aspect_VKey_Y, + Aspect_VKey_Z, + + Aspect_VKey_0, + Aspect_VKey_1, + Aspect_VKey_2, + Aspect_VKey_3, + Aspect_VKey_4, + Aspect_VKey_5, + Aspect_VKey_6, + Aspect_VKey_7, + Aspect_VKey_8, + Aspect_VKey_9, + + Aspect_VKey_F1, + Aspect_VKey_F2, + Aspect_VKey_F3, + Aspect_VKey_F4, + Aspect_VKey_F5, + Aspect_VKey_F6, + Aspect_VKey_F7, + Aspect_VKey_F8, + Aspect_VKey_F9, + Aspect_VKey_F10, + Aspect_VKey_F11, + Aspect_VKey_F12, + + // standard keys + Aspect_VKey_Up, + Aspect_VKey_Down, + Aspect_VKey_Left, + Aspect_VKey_Right, + Aspect_VKey_Plus, //!< '+' + Aspect_VKey_Minus, //!< '-' + Aspect_VKey_Equal, //!< '=+' + Aspect_VKey_PageUp, + Aspect_VKey_PageDown, + Aspect_VKey_Home, + Aspect_VKey_End, + Aspect_VKey_Escape, + Aspect_VKey_Back, + Aspect_VKey_Enter, + Aspect_VKey_Backspace, + Aspect_VKey_Space, + Aspect_VKey_Delete, + Aspect_VKey_Tilde, + Aspect_VKey_Tab, + Aspect_VKey_Comma, //!< ',' + Aspect_VKey_Period, //!< '.' + Aspect_VKey_Semicolon, //!< ';:' + Aspect_VKey_Slash, //!< '/?' + Aspect_VKey_BracketLeft, //!< '[{' + Aspect_VKey_Backslash, //!< '\|' + Aspect_VKey_BracketRight, //!< ']}' + Aspect_VKey_Apostrophe, //!< ''"' + Aspect_VKey_Numlock, //!< Num Lock key + Aspect_VKey_Scroll, //!< Scroll Lock key + + // numpad keys + Aspect_VKey_Numpad0, + Aspect_VKey_Numpad1, + Aspect_VKey_Numpad2, + Aspect_VKey_Numpad3, + Aspect_VKey_Numpad4, + Aspect_VKey_Numpad5, + Aspect_VKey_Numpad6, + Aspect_VKey_Numpad7, + Aspect_VKey_Numpad8, + Aspect_VKey_Numpad9, + Aspect_VKey_NumpadMultiply, //!< numpad '*' + Aspect_VKey_NumpadAdd, //!< numpad '+' + Aspect_VKey_NumpadSubtract, //!< numpad '-' + Aspect_VKey_NumpadDivide, //!< numpad '/' + + // Multimedia keys + Aspect_VKey_MediaNextTrack, + Aspect_VKey_MediaPreviousTrack, + Aspect_VKey_MediaStop, + Aspect_VKey_MediaPlayPause, + Aspect_VKey_VolumeMute, + Aspect_VKey_VolumeDown, + Aspect_VKey_VolumeUp, + Aspect_VKey_BrowserBack, + Aspect_VKey_BrowserForward, + Aspect_VKey_BrowserRefresh, + Aspect_VKey_BrowserStop, + Aspect_VKey_BrowserSearch, + Aspect_VKey_BrowserFavorites, + Aspect_VKey_BrowserHome, + + // 3d view keys + Aspect_VKey_ViewTop, + Aspect_VKey_ViewBottom, + Aspect_VKey_ViewLeft, + Aspect_VKey_ViewRight, + Aspect_VKey_ViewFront, + Aspect_VKey_ViewBack, + Aspect_VKey_ViewAxoLeftProj, + Aspect_VKey_ViewAxoRightProj, + Aspect_VKey_ViewFitAll, + Aspect_VKey_ViewRoll90CW, + Aspect_VKey_ViewRoll90CCW, + Aspect_VKey_ViewSwitchRotate, + + // modifier keys, @sa Aspect_VKey_ModifiersLower and Aspect_VKey_ModifiersUpper below + Aspect_VKey_Shift, + Aspect_VKey_Control, + Aspect_VKey_Alt, + Aspect_VKey_Menu, + Aspect_VKey_Meta, + + // virtual navigation keys, @sa Aspect_VKey_NavigationKeysLower and + // Aspect_VKey_NavigationKeysUpper below + Aspect_VKey_NavInteract, //!< interact + Aspect_VKey_NavForward, //!< go forward + Aspect_VKey_NavBackward, //!< go backward + Aspect_VKey_NavSlideLeft, //!< sidewalk, left + Aspect_VKey_NavSlideRight, //!< sidewalk, right + Aspect_VKey_NavSlideUp, //!< lift up + Aspect_VKey_NavSlideDown, //!< fall down + Aspect_VKey_NavRollCCW, //!< bank left (roll counter-clockwise) + Aspect_VKey_NavRollCW, //!< bank right (roll clockwise) + Aspect_VKey_NavLookLeft, //!< look left (yaw counter-clockwise) + Aspect_VKey_NavLookRight, //!< look right (yaw clockwise) + Aspect_VKey_NavLookUp, //!< look up (pitch clockwise) + Aspect_VKey_NavLookDown, //!< look down (pitch counter-clockwise) + Aspect_VKey_NavCrouch, //!< crouch walking + Aspect_VKey_NavJump, //!< jump + Aspect_VKey_NavThrustForward, //!< increase continuous velocity in forward direction + Aspect_VKey_NavThrustBackward, //!< increase continuous velocity in reversed direction + Aspect_VKey_NavThrustStop, //!< reset continuous velocity + Aspect_VKey_NavSpeedIncrease, //!< increase navigation speed + Aspect_VKey_NavSpeedDecrease, //!< decrease navigation speed +}; + +//! Auxiliary ranges. +enum +{ + Aspect_VKey_Lower = 0, + Aspect_VKey_ModifiersLower = Aspect_VKey_Shift, + Aspect_VKey_ModifiersUpper = Aspect_VKey_Meta, + Aspect_VKey_NavigationKeysLower = Aspect_VKey_NavInteract, + Aspect_VKey_NavigationKeysUpper = Aspect_VKey_NavSpeedDecrease, + Aspect_VKey_Upper = Aspect_VKey_NavSpeedDecrease, + Aspect_VKey_NB = Aspect_VKey_Upper - Aspect_VKey_Lower + 1, + Aspect_VKey_MAX = 255 +}; + +//! Return modifier flags for specified modifier key. +inline Aspect_VKeyFlags Aspect_VKey2Modifier(Aspect_VKey theKey) +{ + switch (theKey) + { + case Aspect_VKey_Shift: + return Aspect_VKeyFlags_SHIFT; + case Aspect_VKey_Control: + return Aspect_VKeyFlags_CTRL; + case Aspect_VKey_Alt: + return Aspect_VKeyFlags_ALT; + case Aspect_VKey_Menu: + return Aspect_VKeyFlags_MENU; + case Aspect_VKey_Meta: + return Aspect_VKeyFlags_META; + default: + return 0; + } +} + +#endif // _Aspect_VKey_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_PBOP.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_PBOP.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1a48891bbdba5ae82dbf6ed1c029151282404bf0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_PBOP.hxx @@ -0,0 +1,21 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BOPAlgo_PBOP_HeaderFile +#define _BOPAlgo_PBOP_HeaderFile + +class BOPAlgo_BOP; +typedef BOPAlgo_BOP* BOPAlgo_PBOP; + +#endif // _BOPAlgo_PBOP_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireEdgeSet.lxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireEdgeSet.lxx new file mode 100644 index 0000000000000000000000000000000000000000..a93507e9b20fc554d9bf8b3d4d27db21eec9ae30 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireEdgeSet.lxx @@ -0,0 +1,103 @@ +// Created by: Peter KURNEV +// Copyright (c) 2010-2014 OPEN CASCADE SAS +// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, +// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function : +// purpose : +//======================================================================= +inline BOPAlgo_WireEdgeSet::BOPAlgo_WireEdgeSet() {} + +//======================================================================= +// function : +// purpose : +//======================================================================= +inline BOPAlgo_WireEdgeSet::BOPAlgo_WireEdgeSet( + const Handle(NCollection_BaseAllocator)& theAllocator) + : myStartShapes(theAllocator), + myShapes(theAllocator) +{ +} + +//======================================================================= +// function : ~ +// purpose : +//======================================================================= +inline BOPAlgo_WireEdgeSet::~BOPAlgo_WireEdgeSet() {} + +//======================================================================= +// function : Clear +// purpose : +//======================================================================= +inline void BOPAlgo_WireEdgeSet::Clear() +{ + myStartShapes.Clear(); + myShapes.Clear(); +} + +//======================================================================= +// function : SetFace +// purpose : +//======================================================================= +inline void BOPAlgo_WireEdgeSet::SetFace(const TopoDS_Face& aF) +{ + myFace = aF; +} + +//======================================================================= +// function : Face +// purpose : +//======================================================================= +inline const TopoDS_Face& BOPAlgo_WireEdgeSet::Face() const +{ + return myFace; +} + +//======================================================================= +// function : AddStartElement +// purpose : +//======================================================================= +inline void BOPAlgo_WireEdgeSet::AddStartElement(const TopoDS_Shape& aE) +{ + myStartShapes.Append(aE); +} + +//======================================================================= +// function : StartElements +// purpose : +//======================================================================= +inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::StartElements() const +{ + return myStartShapes; +} + +//======================================================================= +// function : AddShape +// purpose : +//======================================================================= +inline void BOPAlgo_WireEdgeSet::AddShape(const TopoDS_Shape& aW) +{ + myShapes.Append(aW); +} + +//======================================================================= +// function : Shapes +// purpose : +//======================================================================= +inline const TopTools_ListOfShape& BOPAlgo_WireEdgeSet::Shapes() const +{ + return myShapes; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireSplitter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireSplitter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3d02b5e369efae4a49004680fdc731f27038c369 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPAlgo_WireSplitter.hxx @@ -0,0 +1,78 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BOPAlgo_WireSplitter_HeaderFile +#define _BOPAlgo_WireSplitter_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +class TopoDS_Wire; +class TopoDS_Face; + +//! The class is to build loops from the given set of edges. +//! +//! It returns the following Error statuses +//! - *BOPAlgo_AlertNullInputShapes* - in case there no input edges to build the loops. +//! +class BOPAlgo_WireSplitter : public BOPAlgo_Algo +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BOPAlgo_WireSplitter(); + Standard_EXPORT virtual ~BOPAlgo_WireSplitter(); + + Standard_EXPORT BOPAlgo_WireSplitter(const Handle(NCollection_BaseAllocator)& theAllocator); + + Standard_EXPORT void SetWES(const BOPAlgo_WireEdgeSet& theWES); + + Standard_EXPORT BOPAlgo_WireEdgeSet& WES(); + + //! Sets the context for the algorithm + Standard_EXPORT void SetContext(const Handle(IntTools_Context)& theContext); + + //! Returns the context + Standard_EXPORT const Handle(IntTools_Context)& Context(); + + Standard_EXPORT virtual void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + + static void MakeWire(TopTools_ListOfShape& theLE, TopoDS_Wire& theW); + + Standard_EXPORT static void SplitBlock(const TopoDS_Face& theF, + BOPTools_ConnexityBlock& theCB, + const Handle(IntTools_Context)& theContext); + +protected: + Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + + Standard_EXPORT void MakeWires(const Message_ProgressRange& theRange); + + BOPAlgo_PWireEdgeSet myWES; + BOPTools_ListOfConnexityBlock myLCB; + Handle(IntTools_Context) myContext; +}; + +#include + +#endif // _BOPAlgo_WireSplitter_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Pave.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Pave.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9e853ae5e5eec5f89da7b120ffbaefebe69b7834 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Pave.hxx @@ -0,0 +1,96 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BOPDS_Pave_HeaderFile +#define _BOPDS_Pave_HeaderFile + +#include +#include +#include + +#include +#include + +//! The class BOPDS_Pave is to store +//! information about vertex on an edge +class BOPDS_Pave +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + BOPDS_Pave(); + + //! Modifier + //! Sets the index of vertex + void SetIndex(const Standard_Integer theIndex); + + //! Selector + //! Returns the index of vertex + Standard_Integer Index() const; + + //! Modifier + //! Sets the parameter of vertex + void SetParameter(const Standard_Real theParameter); + + //! Selector + //! Returns the parameter of vertex + Standard_Real Parameter() const; + + //! Selector + //! Returns the index of vertex + //! Returns the parameter of vertex + void Contents(Standard_Integer& theIndex, Standard_Real& theParameter) const; + + //! Query + //! Returns true if thr parameter od this is less + //! than the parameter of + Standard_Boolean IsLess(const BOPDS_Pave& theOther) const; + + Standard_Boolean operator<(const BOPDS_Pave& theOther) const { return IsLess(theOther); } + + //! Query + //! Returns true if thr parameter od this is equal + //! to the parameter of + Standard_Boolean IsEqual(const BOPDS_Pave& theOther) const; + + Standard_Boolean operator==(const BOPDS_Pave& theOther) const { return IsEqual(theOther); } + + Standard_EXPORT void Dump() const; + +protected: + Standard_Integer myIndex; + Standard_Real myParameter; + +private: +}; + +namespace std +{ +template <> +struct hash +{ + size_t operator()(const BOPDS_Pave& thePave) const noexcept + { + size_t aCombination[2]; + aCombination[0] = opencascade::hash(thePave.Index()); + aCombination[1] = opencascade::hash(thePave.Parameter()); + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; +} // namespace std + +#include + +#endif // _BOPDS_Pave_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Point.lxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Point.lxx new file mode 100644 index 0000000000000000000000000000000000000000..a9d67e8e4b767a5dde87c38a8889efcc5008e29b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Point.lxx @@ -0,0 +1,103 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function : +// purpose : +//======================================================================= +inline BOPDS_Point::BOPDS_Point() +{ + myPnt.SetCoord(99., 99., 99.); + myPnt2D1.SetCoord(99., 99.); + myPnt2D2 = myPnt2D1; + myIndex = -1; +} + +//======================================================================= +// function : ~ +// purpose : +//======================================================================= +inline BOPDS_Point::~BOPDS_Point() {} + +//======================================================================= +// function : SetIndex +// purpose : +//======================================================================= +inline void BOPDS_Point::SetIndex(const Standard_Integer theIndex) +{ + myIndex = theIndex; +} + +//======================================================================= +// function : Index +// purpose : +//======================================================================= +inline Standard_Integer BOPDS_Point::Index() const +{ + return myIndex; +} + +//======================================================================= +// function : SetPnt +// purpose : +//======================================================================= +inline void BOPDS_Point::SetPnt(const gp_Pnt& thePnt) +{ + myPnt = thePnt; +} + +//======================================================================= +// function : Pnt +// purpose : +//======================================================================= +inline const gp_Pnt& BOPDS_Point::Pnt() const +{ + return myPnt; +} + +//======================================================================= +// function : SetPnt2D1 +// purpose : +//======================================================================= +inline void BOPDS_Point::SetPnt2D1(const gp_Pnt2d& thePnt) +{ + myPnt2D1 = thePnt; +} + +//======================================================================= +// function : Pnt2D1 +// purpose : +//======================================================================= +inline const gp_Pnt2d& BOPDS_Point::Pnt2D1() const +{ + return myPnt2D1; +} + +//======================================================================= +// function : SetPnt2D2 +// purpose : +//======================================================================= +inline void BOPDS_Point::SetPnt2D2(const gp_Pnt2d& thePnt) +{ + myPnt2D2 = thePnt; +} + +//======================================================================= +// function : Pnt2D2 +// purpose : +//======================================================================= +inline const gp_Pnt2d& BOPDS_Point::Pnt2D2() const +{ + return myPnt2D2; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Tools.lxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Tools.lxx new file mode 100644 index 0000000000000000000000000000000000000000..9af72a7f5083a43fc8b33240aa248ba080b7d7f8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_Tools.lxx @@ -0,0 +1,132 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function: HasBRep +// purpose: +//======================================================================= +inline Standard_Boolean BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) +{ + return (aTi == TopAbs_VERTEX || aTi == TopAbs_EDGE || aTi == TopAbs_FACE); +} + +//======================================================================= +// function: IsInterfering +// purpose: +//======================================================================= +inline Standard_Boolean BOPDS_Tools::IsInterfering(const TopAbs_ShapeEnum aTi) +{ + return (BOPDS_Tools::HasBRep(aTi) || aTi == TopAbs_SOLID); +} + +//======================================================================= +// function : TypeToInteger +// purpose : +//======================================================================= +inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + Standard_Integer iRet, iT1, iT2, iX; + // + iRet = -1; + iT1 = BOPDS_Tools::TypeToInteger(aType1); + iT2 = BOPDS_Tools::TypeToInteger(aType2); + // + iX = iT2 * 10 + iT1; + switch (iX) + { + case 77: + iRet = 0; // VV + break; + case 76: + case 67: + iRet = 1; // VE + break; + case 66: + iRet = 2; // EE + break; + case 74: + case 47: + iRet = 3; // VF + break; + case 64: + case 46: + iRet = 4; // EF + break; + case 44: + iRet = 5; // FF + break; + case 72: + case 27: + iRet = 6; // VZ + break; + case 62: + case 26: + iRet = 7; // EZ + break; + case 42: + case 24: + iRet = 8; // FZ + break; + case 22: + iRet = 9; // ZZ + break; + default: + break; + } + return iRet; +} + +//======================================================================= +// function : TypeToInteger +// purpose : +//======================================================================= +inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1) +{ + Standard_Integer iRet = 9; + // + switch (aType1) + { + case TopAbs_COMPOUND: + iRet = 0; + break; + case TopAbs_COMPSOLID: + iRet = 1; + break; + case TopAbs_SOLID: + iRet = 2; + break; + case TopAbs_SHELL: + iRet = 3; + break; + case TopAbs_FACE: + iRet = 4; + break; + case TopAbs_WIRE: + iRet = 5; + break; + case TopAbs_EDGE: + iRet = 6; + break; + case TopAbs_VERTEX: + iRet = 7; + break; + case TopAbs_SHAPE: + iRet = 8; + break; + default: + break; + } + return iRet; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_VectorOfInterfVZ.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_VectorOfInterfVZ.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c554d9847768ddbca52a051d14f1c73ce98307ff --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BOPDS_VectorOfInterfVZ.hxx @@ -0,0 +1,24 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BOPDS_VectorOfInterfVZ_HeaderFile +#define BOPDS_VectorOfInterfVZ_HeaderFile + +#include +#include + +typedef NCollection_Vector BOPDS_VectorOfInterfVZ; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepAlgoAPI_Fuse.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepAlgoAPI_Fuse.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d87e78b89ac1080bfb90bc2c09b5c24a3f4a2354 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepAlgoAPI_Fuse.hxx @@ -0,0 +1,66 @@ +// Created on: 1993-10-14 +// Created by: Remi LEQUETTE +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepAlgoAPI_Fuse_HeaderFile +#define _BRepAlgoAPI_Fuse_HeaderFile + +#include +#include + +#include +class BOPAlgo_PaveFiller; +class TopoDS_Shape; + +//! The class provides Boolean fusion operation +//! between arguments and tools (Boolean Union). +class BRepAlgoAPI_Fuse : public BRepAlgoAPI_BooleanOperation +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + Standard_EXPORT BRepAlgoAPI_Fuse(); + Standard_EXPORT virtual ~BRepAlgoAPI_Fuse(); + + //! Empty constructor + //! - PaveFiller object that is carried out + Standard_EXPORT BRepAlgoAPI_Fuse(const BOPAlgo_PaveFiller& PF); + + //! Constructor with two shapes + //! -argument + //! -tool + //! - the type of the operation + //! Obsolete + Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + const Message_ProgressRange& theRange = Message_ProgressRange()); + + //! Constructor with two shapes + //! -argument + //! -tool + //! - the type of the operation + //! - PaveFiller object that is carried out + //! Obsolete + Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + const BOPAlgo_PaveFiller& aDSF, + const Message_ProgressRange& theRange = Message_ProgressRange()); + +protected: +private: +}; + +#endif // _BRepAlgoAPI_Fuse_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx new file mode 100644 index 0000000000000000000000000000000000000000..595f7a8ddc3cf390011c9933a8edf83febbeadd5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepApprox_TheMultiLineToolOfApprox.hxx @@ -0,0 +1,143 @@ +// Created on: 1995-06-06 +// Created by: Jean Yves LEBEY +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepApprox_TheMultiLineToolOfApprox_HeaderFile +#define _BRepApprox_TheMultiLineToolOfApprox_HeaderFile + +#include +#include +#include + +#include +#include +class BRepApprox_TheMultiLineOfApprox; +class ApproxInt_SvSurfaces; + +class BRepApprox_TheMultiLineToolOfApprox +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns the number of multipoints of the TheMultiLine. + static Standard_Integer FirstPoint(const BRepApprox_TheMultiLineOfApprox& ML); + + //! Returns the number of multipoints of the TheMultiLine. + static Standard_Integer LastPoint(const BRepApprox_TheMultiLineOfApprox& ML); + + //! Returns the number of 2d points of a TheMultiLine. + static Standard_Integer NbP2d(const BRepApprox_TheMultiLineOfApprox& ML); + + //! Returns the number of 3d points of a TheMultiLine. + static Standard_Integer NbP3d(const BRepApprox_TheMultiLineOfApprox& ML); + + //! returns the 3d points of the multipoint + //! when only 3d points exist. + static void Value(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfPnt& tabPt); + + //! returns the 2d points of the multipoint + //! when only 2d points exist. + static void Value(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfPnt2d& tabPt2d); + + //! returns the 3d and 2d points of the multipoint + //! . + static void Value(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfPnt& tabPt, + TColgp_Array1OfPnt2d& tabPt2d); + + //! returns the 3d points of the multipoint + //! when only 3d points exist. + static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec& tabV); + + //! returns the 2d tangency points of the multipoint + //! only when 2d points exist. + static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec2d& tabV2d); + + //! returns the 3d and 2d points of the multipoint + //! . + static Standard_Boolean Tangency(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec& tabV, + TColgp_Array1OfVec2d& tabV2d); + + //! returns the 3d curvature of the multipoint + //! when only 3d points exist. + static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec& tabV); + + //! returns the 2d curvature points of the multipoint + //! only when 2d points exist. + static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec2d& tabV2d); + + //! returns the 3d and 2d curvature of the multipoint + //! . + static Standard_Boolean Curvature(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer MPointIndex, + TColgp_Array1OfVec& tabV, + TColgp_Array1OfVec2d& tabV2d); + + //! Is called if WhatStatus returned "PointsAdded". + static BRepApprox_TheMultiLineOfApprox MakeMLBetween(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer I1, + const Standard_Integer I2, + const Standard_Integer NbPMin); + + //! Is called when the Bezier curve contains a loop + static Standard_Boolean MakeMLOneMorePoint(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer I1, + const Standard_Integer I2, + const Standard_Integer indbad, + BRepApprox_TheMultiLineOfApprox& OtherLine); + + static Approx_Status WhatStatus(const BRepApprox_TheMultiLineOfApprox& ML, + const Standard_Integer I1, + const Standard_Integer I2); + + //! Dump of the current multi-line. + static void Dump(const BRepApprox_TheMultiLineOfApprox& ML); + +protected: +private: +}; + +#define TheMultiLine BRepApprox_TheMultiLineOfApprox +#define TheMultiLine_hxx +#define TheMultiMPoint ApproxInt_SvSurfaces +#define TheMultiMPoint_hxx +#define ApproxInt_MultiLineTool BRepApprox_TheMultiLineToolOfApprox +#define ApproxInt_MultiLineTool_hxx + +#include + +#undef TheMultiLine +#undef TheMultiLine_hxx +#undef TheMultiMPoint +#undef TheMultiMPoint_hxx +#undef ApproxInt_MultiLineTool +#undef ApproxInt_MultiLineTool_hxx + +#endif // _BRepApprox_TheMultiLineToolOfApprox_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppFuncRstRst.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppFuncRstRst.hxx new file mode 100644 index 0000000000000000000000000000000000000000..135e2622a027157e512b8c95acecf2c1af549737 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppFuncRstRst.hxx @@ -0,0 +1,56 @@ +// Created on: 1998-05-12 +// Created by: Philippe NOUAILLE +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBlend_AppFuncRstRst_HeaderFile +#define _BRepBlend_AppFuncRstRst_HeaderFile + +#include +#include + +#include +#include +class BRepBlend_Line; +class Blend_RstRstFunction; +class Blend_AppFunction; +class Blend_Point; + +class BRepBlend_AppFuncRstRst; +DEFINE_STANDARD_HANDLE(BRepBlend_AppFuncRstRst, BRepBlend_AppFuncRoot) + +//! Function to approximate by AppSurface for Edge/Face (Curve/Curve contact). +class BRepBlend_AppFuncRstRst : public BRepBlend_AppFuncRoot +{ + +public: + Standard_EXPORT BRepBlend_AppFuncRstRst(Handle(BRepBlend_Line)& Line, + Blend_RstRstFunction& Func, + const Standard_Real Tol3d, + const Standard_Real Tol2d); + + Standard_EXPORT void Point(const Blend_AppFunction& Func, + const Standard_Real Param, + const math_Vector& Sol, + Blend_Point& Pnt) const Standard_OVERRIDE; + + Standard_EXPORT void Vec(math_Vector& Sol, const Blend_Point& Pnt) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(BRepBlend_AppFuncRstRst, BRepBlend_AppFuncRoot) + +protected: +private: +}; + +#endif // _BRepBlend_AppFuncRstRst_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppSurface.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppSurface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..620797578e393cc862d5ca8444d7fef7db3c40a4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_AppSurface.hxx @@ -0,0 +1,130 @@ +// Created on: 1996-11-25 +// Created by: Philippe MANGIN +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBlend_AppSurface_HeaderFile +#define _BRepBlend_AppSurface_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class Approx_SweepFunction; + +//! Used to Approximate the blending surfaces. +class BRepBlend_AppSurface : public AppBlend_Approx +{ +public: + DEFINE_STANDARD_ALLOC + + //! Approximation of the new Surface (and + //! eventually the 2d Curves on the support + //! surfaces). + //! Normally the 2d curve are + //! approximated with an tolerance given by the + //! resolution on support surfaces, but if this + //! tolerance is too large Tol2d is used. + Standard_EXPORT BRepBlend_AppSurface(const Handle(Approx_SweepFunction)& Funct, + const Standard_Real First, + const Standard_Real Last, + const Standard_Real Tol3d, + const Standard_Real Tol2d, + const Standard_Real TolAngular, + const GeomAbs_Shape Continuity = GeomAbs_C0, + const Standard_Integer Degmax = 11, + const Standard_Integer Segmax = 50); + + Standard_Boolean IsDone() const; + + Standard_EXPORT void SurfShape(Standard_Integer& UDegree, + Standard_Integer& VDegree, + Standard_Integer& NbUPoles, + Standard_Integer& NbVPoles, + Standard_Integer& NbUKnots, + Standard_Integer& NbVKnots) const; + + Standard_EXPORT void Surface(TColgp_Array2OfPnt& TPoles, + TColStd_Array2OfReal& TWeights, + TColStd_Array1OfReal& TUKnots, + TColStd_Array1OfReal& TVKnots, + TColStd_Array1OfInteger& TUMults, + TColStd_Array1OfInteger& TVMults) const; + + Standard_Integer UDegree() const; + + Standard_Integer VDegree() const; + + const TColgp_Array2OfPnt& SurfPoles() const; + + const TColStd_Array2OfReal& SurfWeights() const; + + const TColStd_Array1OfReal& SurfUKnots() const; + + const TColStd_Array1OfReal& SurfVKnots() const; + + const TColStd_Array1OfInteger& SurfUMults() const; + + const TColStd_Array1OfInteger& SurfVMults() const; + + //! returns the maximum error in the surface approximation. + Standard_EXPORT Standard_Real MaxErrorOnSurf() const; + + Standard_Integer NbCurves2d() const; + + Standard_EXPORT void Curves2dShape(Standard_Integer& Degree, + Standard_Integer& NbPoles, + Standard_Integer& NbKnots) const; + + Standard_EXPORT void Curve2d(const Standard_Integer Index, + TColgp_Array1OfPnt2d& TPoles, + TColStd_Array1OfReal& TKnots, + TColStd_Array1OfInteger& TMults) const; + + Standard_Integer Curves2dDegree() const; + + const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const; + + const TColStd_Array1OfReal& Curves2dKnots() const; + + const TColStd_Array1OfInteger& Curves2dMults() const; + + Standard_EXPORT void TolReached(Standard_Real& Tol3d, Standard_Real& Tol2d) const; + + //! returns the maximum error in the 2d curve approximation. + Standard_EXPORT Standard_Real Max2dError(const Standard_Integer Index) const; + + Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const; + + //! display information on approximation. + Standard_EXPORT void Dump(Standard_OStream& o) const; + +protected: +private: + Approx_SweepApproximation approx; +}; + +#include + +#endif // _BRepBlend_AppSurface_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_ChamfInv.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_ChamfInv.hxx new file mode 100644 index 0000000000000000000000000000000000000000..81440cdfe405409b127248507d5392bd4552346b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_ChamfInv.hxx @@ -0,0 +1,24 @@ +// Created on: 1993-12-06 +// Created by: Jacques GOUSSARD +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBlend_ChamfInv_HeaderFile +#define _BRepBlend_ChamfInv_HeaderFile + +#include + +typedef BlendFunc_ChamfInv BRepBlend_ChamfInv; + +#endif // _BRepBlend_ChamfInv_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_HCurve2dTool.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_HCurve2dTool.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e9c6ca75cbce994e619779c74bbc3d3de5c508c6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_HCurve2dTool.hxx @@ -0,0 +1,140 @@ +// Created on: 1995-07-17 +// Created by: Laurent BUCHARD +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBlend_HCurve2dTool_HeaderFile +#define _BRepBlend_HCurve2dTool_HeaderFile + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class BRepBlend_HCurve2dTool +{ +public: + DEFINE_STANDARD_ALLOC + + static Standard_Real FirstParameter(const Handle(Adaptor2d_Curve2d)& C); + + static Standard_Real LastParameter(const Handle(Adaptor2d_Curve2d)& C); + + static GeomAbs_Shape Continuity(const Handle(Adaptor2d_Curve2d)& C); + + //! Returns the number of intervals for continuity + //! . May be one if Continuity(myclass) >= + static Standard_Integer NbIntervals(const Handle(Adaptor2d_Curve2d)& C, const GeomAbs_Shape S); + + //! Stores in the parameters bounding the intervals + //! of continuity . + //! + //! The array must provide enough room to accommodate + //! for the parameters. i.e. T.Length() > NbIntervals() + static void Intervals(const Handle(Adaptor2d_Curve2d)& C, + TColStd_Array1OfReal& T, + const GeomAbs_Shape S); + + static Standard_Boolean IsClosed(const Handle(Adaptor2d_Curve2d)& C); + + static Standard_Boolean IsPeriodic(const Handle(Adaptor2d_Curve2d)& C); + + static Standard_Real Period(const Handle(Adaptor2d_Curve2d)& C); + + //! Computes the point of parameter U on the curve. + static gp_Pnt2d Value(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U); + + //! Computes the point of parameter U on the curve. + static void D0(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P); + + //! Computes the point of parameter U on the curve with its + //! first derivative. + //! Raised if the continuity of the current interval + //! is not C1. + static void D1(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V); + + //! Returns the point P of parameter U, the first and second + //! derivatives V1 and V2. + //! Raised if the continuity of the current interval + //! is not C2. + static void D2(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2); + + //! Returns the point P of parameter U, the first, the second + //! and the third derivative. + //! Raised if the continuity of the current interval + //! is not C3. + static void D3(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3); + + //! The returned vector gives the value of the derivative for the + //! order of derivation N. + //! Raised if the continuity of the current interval + //! is not CN. + //! Raised if N < 1. + static gp_Vec2d DN(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + const Standard_Integer N); + + //! Returns the parametric resolution corresponding + //! to the real space resolution . + static Standard_Real Resolution(const Handle(Adaptor2d_Curve2d)& C, const Standard_Real R3d); + + //! Returns the type of the curve in the current + //! interval : Line, Circle, Ellipse, Hyperbola, + //! Parabola, BezierCurve, BSplineCurve, OtherCurve. + static GeomAbs_CurveType GetType(const Handle(Adaptor2d_Curve2d)& C); + + static gp_Lin2d Line(const Handle(Adaptor2d_Curve2d)& C); + + static gp_Circ2d Circle(const Handle(Adaptor2d_Curve2d)& C); + + static gp_Elips2d Ellipse(const Handle(Adaptor2d_Curve2d)& C); + + static gp_Hypr2d Hyperbola(const Handle(Adaptor2d_Curve2d)& C); + + static gp_Parab2d Parabola(const Handle(Adaptor2d_Curve2d)& C); + + static Handle(Geom2d_BezierCurve) Bezier(const Handle(Adaptor2d_Curve2d)& C); + + static Handle(Geom2d_BSplineCurve) BSpline(const Handle(Adaptor2d_Curve2d)& C); + + Standard_EXPORT static Standard_Integer NbSamples(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U0, + const Standard_Real U1); + +protected: +private: +}; + +#include + +#endif // _BRepBlend_HCurve2dTool_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_SurfCurvConstRadInv.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_SurfCurvConstRadInv.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e94dccf1af1debc2e4861707332043ce5f3f8c20 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBlend_SurfCurvConstRadInv.hxx @@ -0,0 +1,97 @@ +// Created on: 1997-02-21 +// Created by: Laurent BOURESCHE +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBlend_SurfCurvConstRadInv_HeaderFile +#define _BRepBlend_SurfCurvConstRadInv_HeaderFile + +#include +#include +#include + +class math_Matrix; + +//! Function of reframing between a restriction surface of the +//! surface and a curve. +//! Class used to compute a solution of the +//! surfRstConstRad problem on a done restriction of the +//! surface. +//! The vector used in Value, Values and Derivatives +//! methods has to be the vector of the parametric +//! coordinates wguide, wcurv, wrst where wguide is the +//! parameter on the guide line, wcurv is the parameter on +//! the curve, wrst is the parameter on the restriction on +//! the surface. +class BRepBlend_SurfCurvConstRadInv : public Blend_SurfCurvFuncInv +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BRepBlend_SurfCurvConstRadInv(const Handle(Adaptor3d_Surface)& S, + const Handle(Adaptor3d_Curve)& C, + const Handle(Adaptor3d_Curve)& Cg); + + Standard_EXPORT void Set(const Standard_Real R, const Standard_Integer Choix); + + //! returns 3. + Standard_EXPORT Standard_Integer NbEquations() const; + + //! computes the values of the Functions for the + //! variable . + //! Returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F); + + //! returns the values of the derivatives for the + //! variable . + //! Returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, math_Matrix& D); + + //! returns the values of the functions and the derivatives + //! for the variable . + //! Returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Values(const math_Vector& X, math_Vector& F, math_Matrix& D); + + //! Set the restriction on which a solution has to be found. + Standard_EXPORT void Set(const Handle(Adaptor2d_Curve2d)& Rst); + + //! Returns in the vector Tolerance the parametric tolerance + //! for each of the 3 variables; + //! Tol is the tolerance used in 3d space. + Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const; + + //! Returns in the vector InfBound the lowest values allowed + //! for each of the 3 variables. + //! Returns in the vector SupBound the greatest values allowed + //! for each of the 3 variables. + Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const; + + //! Returns Standard_True if Sol is a zero of the function. + //! Tol is the tolerance used in 3d space. + Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, const Standard_Real Tol); + +protected: +private: + Handle(Adaptor3d_Surface) surf; + Handle(Adaptor3d_Curve) curv; + Handle(Adaptor3d_Curve) guide; + Handle(Adaptor2d_Curve2d) rst; + Standard_Real ray; + Standard_Integer choix; +}; + +#endif // _BRepBlend_SurfCurvConstRadInv_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepBuilderAPI_ModifyShape.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepBuilderAPI_ModifyShape.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4f95bd99ad796283d255e6f3a9b4625265137a93 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepBuilderAPI_ModifyShape.hxx @@ -0,0 +1,102 @@ +// Created on: 1994-12-02 +// Created by: Jacques GOUSSARD +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepBuilderAPI_ModifyShape_HeaderFile +#define _BRepBuilderAPI_ModifyShape_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +class BRepTools_Modification; + +//! Implements the methods of MakeShape for the +//! constant topology modifications. The methods are +//! implemented when the modification uses a Modifier +//! from BRepTools. Some of them have to be redefined +//! if the modification is implemented with another +//! tool (see Transform from BRepBuilderAPI for example). +//! The BRepBuilderAPI package provides the following +//! frameworks to perform modifications of this sort: +//! - BRepBuilderAPI_Copy to produce the copy of a shape, +//! - BRepBuilderAPI_Transform and +//! BRepBuilderAPI_GTransform to apply a geometric +//! transformation to a shape, +//! - BRepBuilderAPI_NurbsConvert to convert the +//! whole geometry of a shape into NURBS geometry, +//! - BRepOffsetAPI_DraftAngle to build a tapered shape. +class BRepBuilderAPI_ModifyShape : public BRepBuilderAPI_MakeShape +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns the list of shapes modified from the shape + //! . + Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) + Standard_OVERRIDE; + + //! Returns the modified shape corresponding to . + //! S can correspond to the entire initial shape or to its subshape. + //! Exceptions + //! Standard_NoSuchObject if S is not the initial shape or + //! a subshape of the initial shape to which the + //! transformation has been applied. Raises NoSuchObject from Standard + //! if S is not the initial shape or a sub-shape + //! of the initial shape. + Standard_EXPORT virtual TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const; + +protected: + //! Empty constructor. + Standard_EXPORT BRepBuilderAPI_ModifyShape(); + + //! Initializes the modifier with the Shape , and + //! set the field to . + Standard_EXPORT BRepBuilderAPI_ModifyShape(const TopoDS_Shape& S); + + //! Set the field with . + Standard_EXPORT BRepBuilderAPI_ModifyShape(const Handle(BRepTools_Modification)& M); + + //! Initializes the modifier with the Shape , and + //! set the field to , and set the + //! field with , the performs the + //! modification. + Standard_EXPORT BRepBuilderAPI_ModifyShape(const TopoDS_Shape& S, + const Handle(BRepTools_Modification)& M); + + //! Performs the previously given modification on the + //! shape . + Standard_EXPORT void DoModif(const TopoDS_Shape& S); + + //! Performs the modification on a previously + //! given shape. + Standard_EXPORT void DoModif(const Handle(BRepTools_Modification)& M); + + //! Performs the modification on the shape . + Standard_EXPORT void DoModif(const TopoDS_Shape& S, const Handle(BRepTools_Modification)& M); + + BRepTools_Modifier myModifier; + TopoDS_Shape myInitialShape; + Handle(BRepTools_Modification) myModification; + +private: + Standard_EXPORT void DoModif(); +}; + +#endif // _BRepBuilderAPI_ModifyShape_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepClass_FClass2dOfFClassifier.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepClass_FClass2dOfFClassifier.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3a0a7d6ef3cd6d65cdd664a2fc231acd8b057f11 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepClass_FClass2dOfFClassifier.hxx @@ -0,0 +1,103 @@ +// Created on: 1992-11-18 +// Created by: Remi LEQUETTE +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepClass_FClass2dOfFClassifier_HeaderFile +#define _BRepClass_FClass2dOfFClassifier_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +class Standard_DomainError; +class BRepClass_Edge; +class BRepClass_Intersector; +class gp_Lin2d; + +class BRepClass_FClass2dOfFClassifier +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates an undefined classifier. + Standard_EXPORT BRepClass_FClass2dOfFClassifier(); + + //! Starts a classification process. The point to + //! classify is the origin of the line .

is + //! the original length of the segment on used to + //! compute intersections. is the tolerance + //! attached to the line segment in intersections. + Standard_EXPORT void Reset(const gp_Lin2d& L, const Standard_Real P, const Standard_Real Tol); + + //! Updates the classification process with the edge + //! from the boundary. + Standard_EXPORT void Compare(const BRepClass_Edge& E, const TopAbs_Orientation Or); + + //! Returns the current value of the parameter. + Standard_Real Parameter() const; + + //! Returns the intersecting algorithm. + BRepClass_Intersector& Intersector(); + + //! Returns 0 if the last compared edge had no + //! relevant intersection. Else returns the index of + //! this intersection in the last intersection + //! algorithm. + Standard_Integer ClosestIntersection() const; + + //! Returns the current state of the point. + TopAbs_State State() const; + + //! Returns the Standard_True if the closest intersection point + //! represents head or end of the edge. Returns Standard_False + //! otherwise. + Standard_Boolean IsHeadOrEnd() const; + +protected: +private: + Standard_Boolean myIsSet; + Standard_Boolean myFirstCompare; + Standard_Boolean myFirstTrans; + gp_Lin2d myLin; + Standard_Real myParam; + Standard_Real myTolerance; + TopTrans_CurveTransition myTrans; + BRepClass_Intersector myIntersector; + Standard_Integer myClosest; + TopAbs_State myState; + Standard_Boolean myIsHeadOrEnd; +}; + +#define TheEdge BRepClass_Edge +#define TheEdge_hxx +#define TheIntersector BRepClass_Intersector +#define TheIntersector_hxx +#define TopClass_Classifier2d BRepClass_FClass2dOfFClassifier +#define TopClass_Classifier2d_hxx + +#include + +#undef TheEdge +#undef TheEdge_hxx +#undef TheIntersector +#undef TheIntersector_hxx +#undef TopClass_Classifier2d +#undef TopClass_Classifier2d_hxx + +#endif // _BRepClass_FClass2dOfFClassifier_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepExtrema_SolutionElem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepExtrema_SolutionElem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c923b9dfb688f57d132e05136ee85b0f28f86ec5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepExtrema_SolutionElem.hxx @@ -0,0 +1,144 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepExtrema_SolutionElem_HeaderFile +#define _BRepExtrema_SolutionElem_HeaderFile + +#include +#include +#include +#include +#include + +//! This class is used to store information relative to the minimum distance between two shapes. +class BRepExtrema_SolutionElem +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + BRepExtrema_SolutionElem() + : myDist(0.0), + myPoint(0.0, 0.0, 0.0), + mySupType(BRepExtrema_IsVertex), + myPar1(0.0), + myPar2(0.0) + { + } + + //! This constructor is used when the solution of a distance is a Vertex. + //! The different initialized fields are: + //! @param theDist the distance + //! @param thePoint the solution point + //! @param theSolType the type of solution + //! @param theVertex and the Vertex + BRepExtrema_SolutionElem(const Standard_Real theDist, + const gp_Pnt& thePoint, + const BRepExtrema_SupportType theSolType, + const TopoDS_Vertex& theVertex) + : myDist(theDist), + myPoint(thePoint), + mySupType(theSolType), + myVertex(theVertex), + myPar1(0.0), + myPar2(0.0) + { + } + + //! This constructor is used when the solution of distance is on an Edge. + //! The different initialized fields are: + //! @param theDist the distance + //! @param thePoint the solution point + //! @param theSolType the type of solution + //! @param theEdge the Edge + //! @param theParam the parameter to locate the solution + BRepExtrema_SolutionElem(const Standard_Real theDist, + const gp_Pnt& thePoint, + const BRepExtrema_SupportType theSolType, + const TopoDS_Edge& theEdge, + const Standard_Real theParam) + : myDist(theDist), + myPoint(thePoint), + mySupType(theSolType), + myEdge(theEdge), + myPar1(theParam), + myPar2(0.0) + { + } + + //! This constructor is used when the solution of distance is in a Face. + //! The different initialized fields are: + //! @param theDist the distance + //! @param thePoint the solution point + //! @param theSolType the type of solution + //! @param theFace the Face + //! @param theU U parameter to locate the solution + //! @param theV V parameter to locate the solution + BRepExtrema_SolutionElem(const Standard_Real theDist, + const gp_Pnt& thePoint, + const BRepExtrema_SupportType theSolType, + const TopoDS_Face& theFace, + const Standard_Real theU, + const Standard_Real theV) + : myDist(theDist), + myPoint(thePoint), + mySupType(theSolType), + myFace(theFace), + myPar1(theU), + myPar2(theV) + { + } + + //! Returns the value of the minimum distance. + Standard_Real Dist() const { return myDist; } + + //! Returns the solution point. + const gp_Pnt& Point() const { return myPoint; } + + //! Returns the Support type: + //! IsVertex => The solution is a vertex. + //! IsOnEdge => The solution belongs to an Edge. + //! IsInFace => The solution is inside a Face. + BRepExtrema_SupportType SupportKind() const { return mySupType; } + + //! Returns the vertex if the solution is a Vertex. + const TopoDS_Vertex& Vertex() const { return myVertex; } + + //! Returns the vertex if the solution is an Edge. + const TopoDS_Edge& Edge() const { return myEdge; } + + //! Returns the vertex if the solution is an Face. + const TopoDS_Face& Face() const { return myFace; } + + //! Returns the parameter value if the solution is on Edge. + void EdgeParameter(Standard_Real& theParam) const { theParam = myPar1; } + + //! Returns the parameters U and V if the solution is in a Face. + void FaceParameter(Standard_Real& theU, Standard_Real& theV) const + { + theU = myPar1; + theV = myPar2; + } + +private: + Standard_Real myDist; + gp_Pnt myPoint; + BRepExtrema_SupportType mySupType; + TopoDS_Vertex myVertex; + TopoDS_Edge myEdge; + TopoDS_Face myFace; + Standard_Real myPar1; + Standard_Real myPar2; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeCylindricalHole.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeCylindricalHole.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3093e6a51625bfe075314f26dad0f49c26e18be1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeCylindricalHole.hxx @@ -0,0 +1,118 @@ +// Created on: 1995-06-13 +// Created by: Jacques GOUSSARD +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepFeat_MakeCylindricalHole_HeaderFile +#define _BRepFeat_MakeCylindricalHole_HeaderFile + +#include +#include + +#include +#include +#include +#include + +// resolve name collisions with X11 headers +#ifdef Status + #undef Status +#endif + +//! Provides a tool to make cylindrical holes on a shape. +class BRepFeat_MakeCylindricalHole : public BRepFeat_Builder +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor. + BRepFeat_MakeCylindricalHole(); + + //! Sets the axis of the hole(s). + void Init(const gp_Ax1& Axis); + + //! Sets the shape and axis on which hole(s) will be + //! performed. + void Init(const TopoDS_Shape& S, const gp_Ax1& Axis); + + //! Performs every hole of radius . This + //! command has the same effect as a cut operation + //! with an infinite cylinder defined by the given + //! axis and . + Standard_EXPORT void Perform(const Standard_Real Radius); + + //! Performs every hole of radius located + //! between PFrom and PTo on the given axis. If + //! is set to Standard_False no control + //! are done on the resulting shape after the + //! operation is performed. + Standard_EXPORT void Perform(const Standard_Real Radius, + const Standard_Real PFrom, + const Standard_Real PTo, + const Standard_Boolean WithControl = Standard_True); + + //! Performs the first hole of radius , in the + //! direction of the defined axis. First hole signify + //! first encountered after the origin of the axis. If + //! is set to Standard_False no control + //! are done on the resulting shape after the + //! operation is performed. + Standard_EXPORT void PerformThruNext(const Standard_Real Radius, + const Standard_Boolean WithControl = Standard_True); + + //! Performs every hole of radius located + //! after the origin of the given axis. If + //! is set to Standard_False no control + //! are done on the resulting shape after the + //! operation is performed. + Standard_EXPORT void PerformUntilEnd(const Standard_Real Radius, + const Standard_Boolean WithControl = Standard_True); + + //! Performs a blind hole of radius and + //! length . The length is measured from the + //! origin of the given axis. If is set + //! to Standard_False no control are done after the + //! operation is performed. + Standard_EXPORT void PerformBlind(const Standard_Real Radius, + const Standard_Real Length, + const Standard_Boolean WithControl = Standard_True); + + //! Returns the status after a hole is performed. + BRepFeat_Status Status() const; + + //! Builds the resulting shape (redefined from + //! MakeShape). Invalidates the given parts of tools + //! if any, and performs the result of the local + //! operation. + Standard_EXPORT void Build(); + +protected: + //! Unhide the base class member to avoid Clang warnings + using BRepFeat_Builder::Perform; + +private: + Standard_EXPORT BRepFeat_Status Validate(); + + gp_Ax1 myAxis; + Standard_Boolean myAxDef; + BRepFeat_Status myStatus; + Standard_Boolean myIsBlind; + Standard_Boolean myValidate; + TopoDS_Face myTopFace; + TopoDS_Face myBotFace; +}; + +#include + +#endif // _BRepFeat_MakeCylindricalHole_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeLinearForm.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeLinearForm.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f979a861a3da2cdf1db8e56b40002db54e7bb31f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepFeat_MakeLinearForm.hxx @@ -0,0 +1,134 @@ +// Created on: 1997-04-14 +// Created by: Olga PILLOT +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepFeat_MakeLinearForm_HeaderFile +#define _BRepFeat_MakeLinearForm_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +class Geom_Curve; +class Geom_Plane; +class TopoDS_Shape; +class TopoDS_Wire; +class TopoDS_Edge; +class TopoDS_Face; +class gp_Pnt; + +//! Builds a rib or a groove along a developable, planar surface. +//! The semantics of mechanical features is built around +//! giving thickness to a contour. This thickness can either +//! be symmetrical - on one side of the contour - or +//! dissymmetrical - on both sides. As in the semantics of +//! form features, the thickness is defined by construction of +//! shapes in specific contexts. +//! The development contexts differ, however, in case of +//! mechanical features. Here they include extrusion: +//! - to a limiting face of the basis shape +//! - to or from a limiting plane +//! - to a height. +class BRepFeat_MakeLinearForm : public BRepFeat_RibSlot +{ +public: + DEFINE_STANDARD_ALLOC + + //! initializes the linear form class + BRepFeat_MakeLinearForm(); + + //! contour W, a shape Sbase and a + //! plane P are initialized to serve as the basic + //! elements in the construction of the rib or groove. + //! Direction and Direction1 give The vectors for + //! defining the direction(s) in which thickness will be built up. + //! Fuse offers a choice between: + //! - removing matter with a Boolean cut using the + //! setting 0 in case of the groove + //! - adding matter with Boolean fusion using the + //! setting 1 in case of the rib. + BRepFeat_MakeLinearForm(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const Handle(Geom_Plane)& P, + const gp_Vec& Direction, + const gp_Vec& Direction1, + const Standard_Integer Fuse, + const Standard_Boolean Modify); + + //! Initializes this construction algorithm. + //! A contour W, a shape Sbase and a plane P are + //! initialized to serve as the basic elements in the + //! construction of the rib or groove. The vectors for + //! defining the direction(s) in which thickness will be built + //! up are given by Direction and Direction1. + //! Fuse offers a choice between: + //! - removing matter with a Boolean cut using the setting + //! 0 in case of the groove + //! - adding matter with Boolean fusion using the setting 1 + //! in case of the rib. + Standard_EXPORT void Init(const TopoDS_Shape& Sbase, + const TopoDS_Wire& W, + const Handle(Geom_Plane)& P, + const gp_Vec& Direction, + const gp_Vec& Direction1, + const Standard_Integer Fuse, + const Standard_Boolean Modify); + + //! Indicates that the edge will slide on the face + //! . + //! Raises ConstructionError if the face does not belong to the + //! basis shape, or the edge to the prismed shape. + Standard_EXPORT void Add(const TopoDS_Edge& E, const TopoDS_Face& OnFace); + + //! Performs a prism from the wire to the plane along the + //! basis shape Sbase. Reconstructs the feature topologically. + Standard_EXPORT void Perform(); + + //! Limits construction of the linear form feature by using + //! one of the following three semantics: + //! - from a limiting plane + //! - to a limiting plane + //! - from one limiting plane to another. + //! The setting is provided by a flag, flag, which can be set + //! to from and/or until. The third semantic possibility above + //! is selected by showing both from and until at the same time. + Standard_EXPORT void TransformShapeFU(const Standard_Integer flag); + + Standard_EXPORT Standard_Boolean Propagate(TopTools_ListOfShape& L, + const TopoDS_Face& F, + const gp_Pnt& FPoint, + const gp_Pnt& LPoint, + Standard_Boolean& falseside); + +protected: +private: + Handle(Geom_Curve) myCrv; + gp_Vec myDir; + gp_Vec myDir1; + Handle(Geom_Plane) myPln; + Standard_Real myBnd; + TopTools_DataMapOfShapeListOfShape mySlface; + TopTools_ListOfShape myListOfEdges; + Standard_Real myTol; +}; + +#include + +#endif // _BRepFeat_MakeLinearForm_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepFilletAPI_MakeFillet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepFilletAPI_MakeFillet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..20239473f43045705ab775ef5652788b3b3bbd6d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepFilletAPI_MakeFillet.hxx @@ -0,0 +1,403 @@ +// Created on: 1994-06-17 +// Created by: Modeling +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepFilletAPI_MakeFillet_HeaderFile +#define _BRepFilletAPI_MakeFillet_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class TopoDS_Shape; +class TopoDS_Edge; +class Law_Function; +class TopoDS_Vertex; +class TopOpeBRepBuild_HBuilder; +class Geom_Surface; + +//! Describes functions to build fillets on the broken edges of a shell or solid. +//! A MakeFillet object provides a framework for: +//! - initializing the construction algorithm with a given shape, +//! - acquiring the data characterizing the fillets, +//! - building the fillets and constructing the resulting shape, and +//! - consulting the result. +class BRepFilletAPI_MakeFillet : public BRepFilletAPI_LocalOperation +{ +public: + DEFINE_STANDARD_ALLOC + + //! Initializes the computation of the fillets. + //! sets the type of fillet surface. The + //! default value is ChFi3d_Rational (classical nurbs + //! representation of circles). ChFi3d_QuasiAngular + //! corresponds to a nurbs representation of circles + //! which parameterisation matches the circle one. + //! ChFi3d_Polynomial corresponds to a polynomial + //! representation of circles. + Standard_EXPORT BRepFilletAPI_MakeFillet(const TopoDS_Shape& S, + const ChFi3d_FilletShape FShape = ChFi3d_Rational); + + Standard_EXPORT void SetParams(const Standard_Real Tang, + const Standard_Real Tesp, + const Standard_Real T2d, + const Standard_Real TApp3d, + const Standard_Real TolApp2d, + const Standard_Real Fleche); + + //! Changes the parameters of continiuity + //! InternalContinuity to produce fillet'surfaces with + //! an continuity Ci (i=0,1 or 2). + //! By defaultInternalContinuity = GeomAbs_C1. + //! AngularTolerance is the G1 tolerance between fillet + //! and support'faces. + Standard_EXPORT void SetContinuity(const GeomAbs_Shape InternalContinuity, + const Standard_Real AngularTolerance); + + //! Adds a fillet contour in the builder (builds a + //! contour of tangent edges). + //! The Radius must be set after. + Standard_EXPORT void Add(const TopoDS_Edge& E) Standard_OVERRIDE; + + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, + //! - sets the radius. + Standard_EXPORT void Add(const Standard_Real Radius, const TopoDS_Edge& E); + + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, + //! - sets a linear radius evolution law between + //! the first and last vertex of the spine. + Standard_EXPORT void Add(const Standard_Real R1, const Standard_Real R2, const TopoDS_Edge& E); + + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, + //! - sest the radius evolution law. + Standard_EXPORT void Add(const Handle(Law_Function)& L, const TopoDS_Edge& E); + + //! Adds a fillet description in the builder + //! - builds a contour of tangent edges, + //! - sets the radius evolution law interpolating the values + //! given in the array UandR : + //! + //! p2d.X() = relative parameter on the spine [0,1] + //! p2d.Y() = value of the radius. + Standard_EXPORT void Add(const TColgp_Array1OfPnt2d& UandR, const TopoDS_Edge& E); + + //! Sets the parameters of the fillet + //! along the contour of index IC generated using the Add function + //! in the internal data structure of + //! this algorithm, where Radius is the radius of the fillet. + Standard_EXPORT void SetRadius(const Standard_Real Radius, + const Standard_Integer IC, + const Standard_Integer IinC); + + //! Sets the parameters of the fillet + //! along the contour of index IC generated using the Add function + //! in the internal data structure of this algorithm, where the radius of the + //! fillet evolves according to a linear evolution law defined + //! from R1 to R2, between the first and last vertices of the contour of index IC. + Standard_EXPORT void SetRadius(const Standard_Real R1, + const Standard_Real R2, + const Standard_Integer IC, + const Standard_Integer IinC); + + //! Sets the parameters of the fillet + //! along the contour of index IC generated using the Add function + //! in the internal data structure of this algorithm, where the radius of the + //! fillet evolves according to the evolution law L, between the + //! first and last vertices of the contour of index IC. + Standard_EXPORT void SetRadius(const Handle(Law_Function)& L, + const Standard_Integer IC, + const Standard_Integer IinC); + + //! Sets the parameters of the fillet + //! along the contour of index IC generated using the Add function + //! in the internal data structure of this algorithm, + //! where the radius of the fillet evolves according to the evolution law + //! which interpolates the set of parameter and radius pairs given + //! in the array UandR as follows: + //! - the X coordinate of a point in UandR defines a + //! relative parameter on the contour (i.e. a parameter between 0 and 1), + //! - the Y coordinate of a point in UandR gives the + //! corresponding value of the radius, and the radius evolves + //! between the first and last vertices of the contour of index IC. + Standard_EXPORT void SetRadius(const TColgp_Array1OfPnt2d& UandR, + const Standard_Integer IC, + const Standard_Integer IinC); + + //! Erases the radius information on the contour of index + //! IC in the internal data structure of this algorithm. + //! Use the SetRadius function to reset this data. + //! Warning + //! Nothing is done if IC is outside the bounds of the table of contours. + Standard_EXPORT void ResetContour(const Standard_Integer IC) Standard_OVERRIDE; + + //! Returns true if the radius of the fillet along the contour of index IC + //! in the internal data structure of this algorithm is constant, + //! Warning + //! False is returned if IC is outside the bounds of the table + //! of contours or if E does not belong to the contour of index IC. + Standard_EXPORT Standard_Boolean IsConstant(const Standard_Integer IC); + + //! Returns the radius of the fillet along the contour of index IC in the + //! internal data structure of this algorithm + //! Warning + //! - Use this function only if the radius is constant. + //! - -1. is returned if IC is outside the bounds of the + //! table of contours or if E does not belong to the contour of index IC. + Standard_EXPORT Standard_Real Radius(const Standard_Integer IC); + + //! Returns true if the radius of the fillet along the edge E of the + //! contour of index IC in the internal data structure of + //! this algorithm is constant. + //! Warning + //! False is returned if IC is outside the bounds of the table + //! of contours or if E does not belong to the contour of index IC. + Standard_EXPORT Standard_Boolean IsConstant(const Standard_Integer IC, const TopoDS_Edge& E); + + //! Returns the radius of the fillet along the edge E of the contour of index + //! IC in the internal data structure of this algorithm. + //! Warning + //! - Use this function only if the radius is constant. + //! - -1 is returned if IC is outside the bounds of the + //! table of contours or if E does not belong to the contour of index IC. + Standard_EXPORT Standard_Real Radius(const Standard_Integer IC, const TopoDS_Edge& E); + + //! Assigns Radius as the radius of the fillet on the edge E + Standard_EXPORT void SetRadius(const Standard_Real Radius, + const Standard_Integer IC, + const TopoDS_Edge& E); + + Standard_EXPORT void SetRadius(const Standard_Real Radius, + const Standard_Integer IC, + const TopoDS_Vertex& V); + + Standard_EXPORT Standard_Boolean GetBounds(const Standard_Integer IC, + const TopoDS_Edge& E, + Standard_Real& F, + Standard_Real& L); + + Standard_EXPORT Handle(Law_Function) GetLaw(const Standard_Integer IC, const TopoDS_Edge& E); + + Standard_EXPORT void SetLaw(const Standard_Integer IC, + const TopoDS_Edge& E, + const Handle(Law_Function)& L); + + //! Assigns FShape as the type of fillet shape built by this algorithm. + Standard_EXPORT void SetFilletShape(const ChFi3d_FilletShape FShape); + + //! Returns the type of fillet shape built by this algorithm. + Standard_EXPORT ChFi3d_FilletShape GetFilletShape() const; + + //! Returns the number of contours generated using the + //! Add function in the internal data structure of this algorithm. + Standard_EXPORT Standard_Integer NbContours() const Standard_OVERRIDE; + + //! Returns the index of the contour in the internal data + //! structure of this algorithm which contains the edge E of the shape. + //! This function returns 0 if the edge E does not belong to any contour. + //! Warning + //! This index can change if a contour is removed from the + //! internal data structure of this algorithm using the function Remove. + Standard_EXPORT Standard_Integer Contour(const TopoDS_Edge& E) const Standard_OVERRIDE; + + //! Returns the number of edges in the contour of index I in + //! the internal data structure of this algorithm. + //! Warning + //! Returns 0 if I is outside the bounds of the table of contours. + Standard_EXPORT Standard_Integer NbEdges(const Standard_Integer I) const Standard_OVERRIDE; + + //! Returns the edge of index J in the contour of index I in + //! the internal data structure of this algorithm. + //! Warning + //! Returns a null shape if: + //! - I is outside the bounds of the table of contours, or + //! - J is outside the bounds of the table of edges of the index I contour. + Standard_EXPORT const TopoDS_Edge& Edge(const Standard_Integer I, + const Standard_Integer J) const Standard_OVERRIDE; + + //! Removes the contour in the internal data structure of + //! this algorithm which contains the edge E of the shape. + //! Warning + //! Nothing is done if the edge E does not belong to the + //! contour in the internal data structure of this algorithm. + Standard_EXPORT void Remove(const TopoDS_Edge& E) Standard_OVERRIDE; + + //! Returns the length of the contour of index IC in the + //! internal data structure of this algorithm. + //! Warning + //! Returns -1. if IC is outside the bounds of the table of contours. + Standard_EXPORT Standard_Real Length(const Standard_Integer IC) const Standard_OVERRIDE; + + //! Returns the first vertex of the contour of index IC + //! in the internal data structure of this algorithm. + //! Warning + //! Returns a null shape if IC is outside the bounds of the table of contours. + Standard_EXPORT TopoDS_Vertex FirstVertex(const Standard_Integer IC) const Standard_OVERRIDE; + + //! Returns the last vertex of the contour of index IC + //! in the internal data structure of this algorithm. + //! Warning + //! Returns a null shape if IC is outside the bounds of the table of contours. + Standard_EXPORT TopoDS_Vertex LastVertex(const Standard_Integer IC) const Standard_OVERRIDE; + + //! Returns the curvilinear abscissa of the vertex V on the + //! contour of index IC in the internal data structure of this algorithm. + //! Warning + //! Returns -1. if: + //! - IC is outside the bounds of the table of contours, or + //! - V is not on the contour of index IC. + Standard_EXPORT Standard_Real Abscissa(const Standard_Integer IC, + const TopoDS_Vertex& V) const Standard_OVERRIDE; + + //! Returns the relative curvilinear abscissa (i.e. between 0 + //! and 1) of the vertex V on the contour of index IC in the + //! internal data structure of this algorithm. + //! Warning + //! Returns -1. if: + //! - IC is outside the bounds of the table of contours, or + //! - V is not on the contour of index IC. + Standard_EXPORT Standard_Real RelativeAbscissa(const Standard_Integer IC, + const TopoDS_Vertex& V) const Standard_OVERRIDE; + + //! Returns true if the contour of index IC in the internal + //! data structure of this algorithm is closed and tangential + //! at the point of closure. + //! Warning + //! Returns false if IC is outside the bounds of the table of contours. + Standard_EXPORT Standard_Boolean + ClosedAndTangent(const Standard_Integer IC) const Standard_OVERRIDE; + + //! Returns true if the contour of index IC in the internal + //! data structure of this algorithm is closed. + //! Warning + //! Returns false if IC is outside the bounds of the table of contours. + Standard_EXPORT Standard_Boolean Closed(const Standard_Integer IC) const Standard_OVERRIDE; + + //! Builds the fillets on all the contours in the internal data + //! structure of this algorithm and constructs the resulting shape. + //! Use the function IsDone to verify that the filleted shape + //! is built. Use the function Shape to retrieve the filleted shape. + //! Warning + //! The construction of fillets implements highly complex + //! construction algorithms. Consequently, there may be + //! instances where the algorithm fails, for example if the + //! data defining the radius of the fillet is not compatible + //! with the geometry of the initial shape. There is no initial + //! analysis of errors and they only become evident at the + //! construction stage. + //! Additionally, in the current software release, the + //! following cases are not handled: + //! - the end point of the contour is the point of + //! intersection of 4 or more edges of the shape, or + //! - the intersection of the fillet with a face which limits + //! the contour is not fully contained in this face. + Standard_EXPORT virtual void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + + //! Reinitializes this algorithm, thus canceling the effects of the Build function. + //! This function allows modifications to be made to the + //! contours and fillet parameters in order to rebuild the shape. + Standard_EXPORT void Reset() Standard_OVERRIDE; + + //! Returns the internal topology building algorithm. + Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder) Builder() const; + + //! Returns the list of shapes generated from the + //! shape . + Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& EorV) + Standard_OVERRIDE; + + //! Returns the list of shapes modified from the shape + //! . + Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& F) + Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& F) Standard_OVERRIDE; + + //! returns the number of surfaces + //! after the shape creation. + Standard_EXPORT Standard_Integer NbSurfaces() const; + + //! Return the faces created for surface . + Standard_EXPORT const TopTools_ListOfShape& NewFaces(const Standard_Integer I); + + Standard_EXPORT void Simulate(const Standard_Integer IC) Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbSurf(const Standard_Integer IC) const Standard_OVERRIDE; + + Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect(const Standard_Integer IC, + const Standard_Integer IS) const Standard_OVERRIDE; + + //! Returns the number of contours where the computation + //! of the fillet failed + Standard_EXPORT Standard_Integer NbFaultyContours() const; + + //! for each I in [1.. NbFaultyContours] returns the index IC of + //! the contour where the computation of the fillet failed. + //! the method NbEdges(IC) gives the number of edges in the contour IC + //! the method Edge(IC,ie) gives the edge number ie of the contour IC + Standard_EXPORT Standard_Integer FaultyContour(const Standard_Integer I) const; + + //! returns the number of surfaces which have been + //! computed on the contour IC + Standard_EXPORT Standard_Integer NbComputedSurfaces(const Standard_Integer IC) const; + + //! returns the surface number IS concerning the contour IC + Standard_EXPORT Handle(Geom_Surface) ComputedSurface(const Standard_Integer IC, + const Standard_Integer IS) const; + + //! returns the number of vertices where the computation failed + Standard_EXPORT Standard_Integer NbFaultyVertices() const; + + //! returns the vertex where the computation failed + Standard_EXPORT TopoDS_Vertex FaultyVertex(const Standard_Integer IV) const; + + //! returns true if a part of the result has been computed + //! if the filling in a corner failed a shape with a hole is returned + Standard_EXPORT Standard_Boolean HasResult() const; + + //! if (HasResult()) returns the partial result + Standard_EXPORT TopoDS_Shape BadShape() const; + + //! returns the status concerning the contour IC in case of error + //! ChFiDS_Ok : the computation is Ok + //! ChFiDS_StartsolFailure : the computation can't start, perhaps the + //! the radius is too big + //! ChFiDS_TwistedSurface : the computation failed because of a twisted + //! surface + //! ChFiDS_WalkingFailure : there is a problem in the walking + //! ChFiDS_Error: other error different from above + Standard_EXPORT ChFiDS_ErrorStatus StripeStatus(const Standard_Integer IC) const; + +protected: +private: + ChFi3d_FilBuilder myBuilder; + TopTools_MapOfShape myMap; +}; + +#endif // _BRepFilletAPI_MakeFillet_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_MakeWire.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_MakeWire.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1442e9f30dad2d2e91c61c2c21dc8a89b23a24ca --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_MakeWire.hxx @@ -0,0 +1,190 @@ +// Created on: 1993-07-08 +// Created by: Remi LEQUETTE +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepLib_MakeWire_HeaderFile +#define _BRepLib_MakeWire_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TopoDS_Wire; + +//! Provides methods to build wires. +//! +//! A wire may be built : +//! +//! * From a single edge. +//! +//! * From a wire and an edge. +//! +//! - A new wire is created with the edges of the +//! wire + the edge. +//! +//! - If the edge is not connected to the wire the +//! flag NotDone is set and the method Wire will +//! raise an error. +//! +//! - The connection may be : +//! +//! . Through an existing vertex. The edge is shared. +//! +//! . Through a geometric coincidence of vertices. +//! The edge is copied and the vertices from the +//! edge are replaced by the vertices from the +//! wire. +//! +//! . The new edge and the connection vertices are +//! kept by the algorithm. +//! +//! * From 2, 3, 4 edges. +//! +//! - A wire is created from the first edge, the +//! following edges are added. +//! +//! * From many edges. +//! +//! - The following syntax may be used : +//! +//! BRepLib_MakeWire MW; +//! +//! // for all the edges ... +//! MW.Add(anEdge); +//! +//! TopoDS_Wire W = MW; + +class BRepLib_MakeWire : public BRepLib_MakeShape +{ +public: + DEFINE_STANDARD_ALLOC + + //! NotDone MakeWire. + Standard_EXPORT BRepLib_MakeWire(); + + //! Make a Wire from an edge. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Edge& E); + + //! Make a Wire from two edges. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Edge& E1, const TopoDS_Edge& E2); + + //! Make a Wire from three edges. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Edge& E1, + const TopoDS_Edge& E2, + const TopoDS_Edge& E3); + + //! Make a Wire from four edges. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Edge& E1, + const TopoDS_Edge& E2, + const TopoDS_Edge& E3, + const TopoDS_Edge& E4); + + //! Make a Wire from a Wire. Useful for adding later. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Wire& W); + + //! Add an edge to a wire. + Standard_EXPORT BRepLib_MakeWire(const TopoDS_Wire& W, const TopoDS_Edge& E); + + //! Add the edge to the current wire. + Standard_EXPORT void Add(const TopoDS_Edge& E); + + //! Add the edges of to the current wire. + Standard_EXPORT void Add(const TopoDS_Wire& W); + + //! Add the edges of to the current wire. + //! The edges are not to be consecutive. But they are + //! to be all connected geometrically or topologically. + Standard_EXPORT void Add(const TopTools_ListOfShape& L); + + Standard_EXPORT BRepLib_WireError Error() const; + + //! Returns the new wire. + Standard_EXPORT const TopoDS_Wire& Wire(); + Standard_EXPORT operator TopoDS_Wire(); + + //! Returns the last edge added to the wire. + Standard_EXPORT const TopoDS_Edge& Edge() const; + + //! Returns the last connecting vertex. + Standard_EXPORT const TopoDS_Vertex& Vertex() const; + +private: + class BRepLib_BndBoxVertexSelector + : public NCollection_UBTree::Selector + { + public: + BRepLib_BndBoxVertexSelector(const TopTools_IndexedMapOfShape& theMapOfShape) + : BRepLib_BndBoxVertexSelector::Selector(), + myMapOfShape(theMapOfShape), + myTolP(0.0), + myVInd(0) + { + } + + Standard_Boolean Reject(const Bnd_Box& theBox) const { return theBox.IsOut(myVBox); } + + Standard_Boolean Accept(const Standard_Integer& theObj); + + void SetCurrentVertex(const gp_Pnt& theP, Standard_Real theTol, Standard_Integer theVInd); + + const NCollection_List& GetResultInds() const { return myResultInd; } + + void ClearResInds() { myResultInd.Clear(); } + + private: + BRepLib_BndBoxVertexSelector(const BRepLib_BndBoxVertexSelector&); + BRepLib_BndBoxVertexSelector& operator=(const BRepLib_BndBoxVertexSelector&); + + const TopTools_IndexedMapOfShape& myMapOfShape; // vertices + gp_Pnt myP; + Standard_Real myTolP; + Standard_Integer myVInd; + Bnd_Box myVBox; + NCollection_List myResultInd; + }; + + void CollectCoincidentVertices(const TopTools_ListOfShape& theL, + NCollection_List>& theGrVL); + + void CreateNewVertices(const NCollection_List>& theGrVL, + TopTools_DataMapOfShapeShape& theO2NV); + + void CreateNewListOfEdges(const TopTools_ListOfShape& theL, + const TopTools_DataMapOfShapeShape& theO2NV, + TopTools_ListOfShape& theNewEList); + + void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity); + +protected: +private: + BRepLib_WireError myError; + TopoDS_Edge myEdge; + TopoDS_Vertex myVertex; + TopTools_IndexedMapOfShape myVertices; + TopoDS_Vertex FirstVertex; + TopoDS_Vertex VF; + TopoDS_Vertex VL; +}; + +#endif // _BRepLib_MakeWire_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_ValidateEdge.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_ValidateEdge.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a1dae8f4488499af5003891d9d7a788bd7470823 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepLib_ValidateEdge.hxx @@ -0,0 +1,103 @@ +// Copyright (c) 2021 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepLib_ValidateEdge_HeaderFile +#define _BRepLib_ValidateEdge_HeaderFile + +#include +#include + +class Adaptor3d_Curve; +class Adaptor3d_CurveOnSurface; + +//! Computes the max distance between 3D-curve and curve on surface. +//! This class uses 2 methods: approximate using finite +//! number of points (default) and exact +class BRepLib_ValidateEdge +{ +public: + //! Initialization constructor + Standard_EXPORT BRepLib_ValidateEdge(const Handle(Adaptor3d_Curve) theReferenceCurve, + const Handle(Adaptor3d_CurveOnSurface) theOtherCurve, + Standard_Boolean theSameParameter); + + //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact + //! is false, faster, but possible not correct result) or exact calculating by using + //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly). + //! Exact method is used only when edge is SameParameter. + //! Default method is calculating in finite number of points + void SetExactMethod(Standard_Boolean theIsExact) { myIsExactMethod = theIsExact; } + + //! Returns true if exact method selected + Standard_Boolean IsExactMethod() { return myIsExactMethod; } + + //! Sets parallel flag + void SetParallel(Standard_Boolean theIsMultiThread) { myIsMultiThread = theIsMultiThread; } + + //! Returns true if parallel flag is set + Standard_Boolean IsParallel() { return myIsMultiThread; } + + //! Set control points number (if you need a value other than 22) + void SetControlPointsNumber(Standard_Integer theControlPointsNumber) + { + myControlPointsNumber = theControlPointsNumber; + } + + //! Sets limit to compute a distance in the Process() function. If the distance greater than + //! theToleranceForChecking the Process() function stopped. Use this in case checking of + //! tolerance for best performcnce. Has no effect in case using exact method. + void SetExitIfToleranceExceeded(Standard_Real theToleranceForChecking); + + //! Computes the max distance for the 3d curve + //! and curve on surface . If the SetExitIfToleranceExceeded() + //! function was called before contains first + //! greater than SetExitIfToleranceExceeded() parameter value. In case + //! using exact method always computes real max distance. + Standard_EXPORT void Process(); + + //! Returns true if the distance has been found for all points + Standard_Boolean IsDone() const { return myIsDone; } + + //! Returns true if computed distance is less than + Standard_EXPORT Standard_Boolean CheckTolerance(Standard_Real theToleranceToCheck); + + //! Returns max distance + Standard_EXPORT Standard_Real GetMaxDistance(); + + //! Increase if max distance is greater than + Standard_EXPORT void UpdateTolerance(Standard_Real& theToleranceToUpdate); + +private: + //! Adds some margin for distance checking + Standard_Real correctTolerance(Standard_Real theTolerance); + + //! Calculating in finite number of points + void processApprox(); + + //! Calculating by using BRepLib_CheckCurveOnSurface class + void processExact(); + +private: + Handle(Adaptor3d_Curve) myReferenceCurve; + Handle(Adaptor3d_CurveOnSurface) myOtherCurve; + Standard_Boolean mySameParameter; + Standard_Integer myControlPointsNumber; + Standard_Real myToleranceForChecking; + Standard_Real myCalculatedDistance; + Standard_Boolean myExitIfToleranceExceeded; + Standard_Boolean myIsDone; + Standard_Boolean myIsExactMethod; + Standard_Boolean myIsMultiThread; +}; + +#endif // _BRepLib_ValidateEdge_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5ca4926f6c2ede0c23a995aa7587e788b6b536fc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape_HeaderFile +#define BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepMeshData_Wire.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepMeshData_Wire.hxx new file mode 100644 index 0000000000000000000000000000000000000000..eb18cb648b0ad7365a6e10d48716c4c2fb69dfaf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepMeshData_Wire.hxx @@ -0,0 +1,60 @@ +// Created on: 2016-04-07 +// Copyright (c) 2016 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepMeshData_Wire_HeaderFile +#define _BRepMeshData_Wire_HeaderFile + +#include +#include + +//! Default implementation of wire data model entity. +class BRepMeshData_Wire : public IMeshData_Wire +{ +public: + DEFINE_INC_ALLOC + + //! Constructor. + Standard_EXPORT BRepMeshData_Wire(const TopoDS_Wire& theWire, + const Standard_Integer theEdgeNb, + const Handle(NCollection_IncAllocator)& theAllocator); + + //! Destructor. + Standard_EXPORT virtual ~BRepMeshData_Wire(); + + //! Gets number of children. + Standard_EXPORT virtual Standard_Integer EdgesNb() const Standard_OVERRIDE; + + //! Adds new discrete edge with specified orientation to wire chain. + //! @return index of added edge in wire chain. + Standard_EXPORT virtual Standard_Integer AddEdge(const IMeshData::IEdgePtr& theDEdge, + const TopAbs_Orientation theOrientation) + Standard_OVERRIDE; + + //! Gets edge with the given index. + Standard_EXPORT virtual const IMeshData::IEdgePtr& GetEdge(const Standard_Integer theIndex) const + Standard_OVERRIDE; + + //! Returns True if orientation of discrete edge with the given index is forward. + Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation( + const Standard_Integer theIndex) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(BRepMeshData_Wire, IMeshData_Wire) + +private: + IMeshData::VectorOfIEdgePtrs myDEdges; + IMeshData::VectorOfOrientation myDEdgesOri; +}; + +#endif \ No newline at end of file diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_DelabellaBaseMeshAlgo.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_DelabellaBaseMeshAlgo.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e126c0970012c3e27166bf72097fb4a2c7ce7104 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_DelabellaBaseMeshAlgo.hxx @@ -0,0 +1,39 @@ +// Created on: 2019-07-05 +// Copyright (c) 2019 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile +#define _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile + +#include + +//! Class provides base functionality to build face triangulation using Delabella project. +//! Performs generation of mesh using raw data from model. +class BRepMesh_DelabellaBaseMeshAlgo : public BRepMesh_CustomBaseMeshAlgo +{ +public: + //! Constructor. + Standard_EXPORT BRepMesh_DelabellaBaseMeshAlgo(); + + //! Destructor. + Standard_EXPORT virtual ~BRepMesh_DelabellaBaseMeshAlgo(); + + DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo) + +protected: + //! Builds base triangulation using Delabella project. + Standard_EXPORT virtual void buildBaseTriangulation() Standard_OVERRIDE; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_IncrementalMesh.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_IncrementalMesh.hxx new file mode 100644 index 0000000000000000000000000000000000000000..13a2bff7ee7a0bcff19a800b18bafbf534628d1e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_IncrementalMesh.hxx @@ -0,0 +1,137 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepMesh_IncrementalMesh_HeaderFile +#define _BRepMesh_IncrementalMesh_HeaderFile + +#include +#include +#include + +//! Builds the mesh of a shape with respect of their +//! correctly triangulated parts +class BRepMesh_IncrementalMesh : public BRepMesh_DiscretRoot +{ +public: //! @name mesher API + //! Default constructor + Standard_EXPORT BRepMesh_IncrementalMesh(); + + //! Destructor + Standard_EXPORT virtual ~BRepMesh_IncrementalMesh(); + + //! Constructor. + //! Automatically calls method Perform. + //! @param theShape shape to be meshed. + //! @param theLinDeflection linear deflection. + //! @param isRelative if TRUE deflection used for discretization of + //! each edge will be * . Deflection + //! used for the faces will be the maximum deflection of their edges. + //! @param theAngDeflection angular deflection. + //! @param isInParallel if TRUE shape will be meshed in parallel. + Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape, + const Standard_Real theLinDeflection, + const Standard_Boolean isRelative = Standard_False, + const Standard_Real theAngDeflection = 0.5, + const Standard_Boolean isInParallel = Standard_False); + + //! Constructor. + //! Automatically calls method Perform. + //! @param theShape shape to be meshed. + //! @param theParameters - parameters of meshing + Standard_EXPORT BRepMesh_IncrementalMesh( + const TopoDS_Shape& theShape, + const IMeshTools_Parameters& theParameters, + const Message_ProgressRange& theRange = Message_ProgressRange()); + + //! Performs meshing of the shape. + Standard_EXPORT virtual void Perform( + const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + + //! Performs meshing using custom context; + Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext, + const Message_ProgressRange& theRange = Message_ProgressRange()); + +public: //! @name accessing to parameters. + //! Returns meshing parameters + const IMeshTools_Parameters& Parameters() const { return myParameters; } + + //! Returns modifiable meshing parameters + IMeshTools_Parameters& ChangeParameters() { return myParameters; } + + //! Returns modified flag. + Standard_Boolean IsModified() const { return myModified; } + + //! Returns accumulated status flags faced during meshing. + Standard_Integer GetStatusFlags() const { return myStatus; } + +private: + //! Initializes specific parameters + void initParameters() + { + if (myParameters.Deflection < Precision::Confusion()) + { + throw Standard_NumericError( + "BRepMesh_IncrementalMesh::initParameters : invalid parameter value"); + } + if (myParameters.DeflectionInterior < Precision::Confusion()) + { + myParameters.DeflectionInterior = myParameters.Deflection; + } + + if (myParameters.MinSize < Precision::Confusion()) + { + myParameters.MinSize = Max(IMeshTools_Parameters::RelMinSize() + * Min(myParameters.Deflection, myParameters.DeflectionInterior), + Precision::Confusion()); + } + + if (myParameters.Angle < Precision::Angular()) + { + throw Standard_NumericError( + "BRepMesh_IncrementalMesh::initParameters : invalid parameter value"); + } + if (myParameters.AngleInterior < Precision::Angular()) + { + myParameters.AngleInterior = 2.0 * myParameters.Angle; + } + } + +public: //! @name plugin API + //! Plugin interface for the Mesh Factories. + //! Initializes meshing algorithm with the given parameters. + //! @param theShape shape to be meshed. + //! @param theLinDeflection linear deflection. + //! @param theAngDeflection angular deflection. + //! @param[out] theAlgo pointer to initialized algorithm. + Standard_EXPORT static Standard_Integer Discret(const TopoDS_Shape& theShape, + const Standard_Real theLinDeflection, + const Standard_Real theAngDeflection, + BRepMesh_DiscretRoot*& theAlgo); + + //! Returns multi-threading usage flag set by default in + //! Discret() static method (thus applied only to Mesh Factories). + Standard_EXPORT static Standard_Boolean IsParallelDefault(); + + //! Setup multi-threading usage flag set by default in + //! Discret() static method (thus applied only to Mesh Factories). + Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel); + + DEFINE_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot) + +protected: + IMeshTools_Parameters myParameters; + Standard_Boolean myModified; + Standard_Integer myStatus; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_VertexTool.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_VertexTool.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4c8a05805f293f975d6018b456ce062824d61240 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepMesh_VertexTool.hxx @@ -0,0 +1,159 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepMesh_VertexTool_HeaderFile +#define _BRepMesh_VertexTool_HeaderFile + +#include +#include +#include +#include +#include + +//! Describes data structure intended to keep mesh nodes +//! defined in UV space and implements functionality +//! providing their uniqueness regarding their position. +class BRepMesh_VertexTool : public Standard_Transient +{ +public: + //! Constructor. + //! @param theAllocator memory allocator to be used by internal collections. + Standard_EXPORT BRepMesh_VertexTool(const Handle(NCollection_IncAllocator)& theAllocator); + + //! Sets new size of cell for cellfilter equal in both directions. + void SetCellSize(const Standard_Real theSize) + { + myCellFilter.Reset(theSize, myAllocator); + mySelector.Clear(); + } + + //! Sets new size of cell for cellfilter. + //! @param theSizeX size for X dimension. + //! @param theSizeY size for Y dimension. + void SetCellSize(const Standard_Real theSizeX, const Standard_Real theSizeY) + { + Standard_Real aCellSizeC[2] = {theSizeX, theSizeY}; + NCollection_Array1 aCellSize(aCellSizeC[0], 1, 2); + myCellFilter.Reset(aCellSize, myAllocator); + mySelector.Clear(); + } + + //! Sets the tolerance to be used for identification of + //! coincident vertices equal for both dimensions. + void SetTolerance(const Standard_Real theTolerance) + { + mySelector.SetTolerance(theTolerance); + myTolerance[0] = theTolerance; + myTolerance[1] = theTolerance; + } + + //! Sets the tolerance to be used for identification of + //! coincident vertices. + //! @param theToleranceX tolerance for X dimension. + //! @param theToleranceY tolerance for Y dimension. + void SetTolerance(const Standard_Real theToleranceX, const Standard_Real theToleranceY) + { + mySelector.SetTolerance(theToleranceX, theToleranceY); + myTolerance[0] = theToleranceX; + myTolerance[1] = theToleranceY; + } + + //! Gets the tolerance to be used for identification of + //! coincident vertices. + //! @param theToleranceX tolerance for X dimension. + //! @param theToleranceY tolerance for Y dimension. + void GetTolerance(Standard_Real& theToleranceX, Standard_Real& theToleranceY) + { + theToleranceX = myTolerance[0]; + theToleranceY = myTolerance[1]; + } + + //! Adds vertex with empty data to the tool. + //! @param theVertex node to be added to the mesh. + //! @param isForceAdd adds the given node to structure without + //! checking on coincidence with other nodes. + //! @return index of the node in the structure. + Standard_EXPORT Standard_Integer Add(const BRepMesh_Vertex& theVertex, + const Standard_Boolean isForceAdd); + + //! Deletes vertex with the given index from the tool. + Standard_EXPORT void DeleteVertex(const Standard_Integer theIndex); + + //! Returns set of mesh vertices. + const Handle(IMeshData::VectorOfVertex)& Vertices() const { return mySelector.Vertices(); } + + //! Returns set of mesh vertices. + Handle(IMeshData::VectorOfVertex)& ChangeVertices() { return mySelector.ChangeVertices(); } + + //! Returns vertex by the given index. + const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex) + { + return mySelector.GetVertex(theIndex); + } + + //! Returns index of the given vertex. + Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex) + { + mySelector.SetPoint(theVertex.Coord()); + myCellFilter.Inspect(theVertex.Coord(), mySelector); + return mySelector.GetCoincidentPoint(); + } + + //! Returns a number of vertices. + Standard_Integer Extent() const { return mySelector.NbVertices(); } + + //! Returns True when the map contains no keys.
+ Standard_Boolean IsEmpty() const { return (Extent() == 0); } + + //! Substitutes vertex with the given by the given vertex with attributes. + //! @param theIndex index of vertex to be substituted. + //! @param theVertex replacement vertex. + Standard_EXPORT void Substitute(const Standard_Integer theIndex, + const BRepMesh_Vertex& theVertex); + + //! Remove last node from the structure. + void RemoveLast() { DeleteVertex(Extent()); } + + //! Returns the list with indexes of vertices that have movability attribute + //! equal to BRepMesh_Deleted and can be replaced with another node. + const IMeshData::ListOfInteger& GetListOfDelNodes() const + { + return mySelector.GetListOfDelPoints(); + } + + //! Prints statistics. + Standard_EXPORT void Statistics(Standard_OStream& theStream) const; + + DEFINE_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient) + +private: + //! Expands the given point according to specified tolerance. + //! @param thePoint point to be expanded. + //! @param[out] theMinPoint bottom left corner of area defined by expanded point. + //! @param[out] theMaxPoint top right corner of area defined by expanded point. + void expandPoint(const gp_XY& thePoint, gp_XY& theMinPoint, gp_XY& theMaxPoint) + { + theMinPoint.SetX(thePoint.X() - myTolerance[0]); + theMinPoint.SetY(thePoint.Y() - myTolerance[1]); + theMaxPoint.SetX(thePoint.X() + myTolerance[0]); + theMaxPoint.SetY(thePoint.Y() + myTolerance[1]); + } + +private: + Handle(NCollection_IncAllocator) myAllocator; + IMeshData::VertexCellFilter myCellFilter; + BRepMesh_VertexInspector mySelector; + Standard_Real myTolerance[2]; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_DraftAngle.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_DraftAngle.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a9181b245b33fc60f2ab5fdc6ab1a2a08955f5f6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_DraftAngle.hxx @@ -0,0 +1,208 @@ +// Created on: 1995-02-22 +// Created by: Jacques GOUSSARD +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepOffsetAPI_DraftAngle_HeaderFile +#define _BRepOffsetAPI_DraftAngle_HeaderFile + +#include +#include + +#include +#include +#include +#include + +class TopoDS_Shape; +class TopoDS_Face; +class gp_Dir; +class gp_Pln; + +// resolve name collisions with X11 headers +#ifdef Status + #undef Status +#endif + +//! Taper-adding transformations on a shape. +//! The resulting shape is constructed by defining one face +//! to be tapered after another one, as well as the +//! geometric properties of their tapered transformation. +//! Each tapered transformation is propagated along the +//! series of faces which are tangential to one another and +//! which contains the face to be tapered. +//! This algorithm is useful in the construction of molds or +//! dies. It facilitates the removal of the article being produced. +//! A DraftAngle object provides a framework for: +//! - initializing the construction algorithm with a given shape, +//! - acquiring the data characterizing the faces to be tapered, +//! - implementing the construction algorithm, and +//! - consulting the results. +//! Warning +//! - This algorithm treats planar, cylindrical and conical faces. +//! - Do not use shapes, which with a draft angle added to +//! a face would modify the topology. This would, for +//! example, involve creation of new vertices, edges or +//! faces, or suppression of existing vertices, edges or faces. +//! - Any face, which is continuous in tangency with the +//! face to be tapered, will also be tapered. These +//! connected faces must also respect the above criteria. +class BRepOffsetAPI_DraftAngle : public BRepBuilderAPI_ModifyShape +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs an empty algorithm to perform + //! taper-adding transformations on faces of a shape. + //! Use the Init function to define the shape to be tapered. + Standard_EXPORT BRepOffsetAPI_DraftAngle(); + + //! Initializes an algorithm to perform taper-adding + //! transformations on faces of the shape S. + //! S will be referred to as the initial shape of the algorithm. + Standard_EXPORT BRepOffsetAPI_DraftAngle(const TopoDS_Shape& S); + + //! Cancels the results of all taper-adding transformations + //! performed by this algorithm on the initial shape. These + //! results will have been defined by successive calls to the function Add. + Standard_EXPORT void Clear(); + + //! Initializes, or reinitializes this taper-adding algorithm with the shape S. + //! S will be referred to as the initial shape of this algorithm. + Standard_EXPORT void Init(const TopoDS_Shape& S); + + //! Adds the face F, the direction + //! Direction, the angle Angle, the plane NeutralPlane, and the flag + //! Flag to the framework created at construction time, and with this + //! data, defines the taper-adding transformation. + //! F is a face, which belongs to the initial shape of this algorithm or + //! to the shape loaded by the function Init. + //! Only planar, cylindrical or conical faces can be tapered: + //! - If the face F is planar, it is tapered by inclining it + //! through the angle Angle about the line of intersection between the + //! plane NeutralPlane and F. + //! Direction indicates the side of NeutralPlane from which matter is + //! removed if Angle is positive or added if Angle is negative. + //! - If F is cylindrical or conical, it is transformed in the + //! same way on a single face, resulting in a conical face if F + //! is cylindrical, and a conical or cylindrical face if it is already conical. + //! The taper-adding transformation is propagated from the face F along + //! the series of planar, cylindrical or conical faces containing F, + //! which are tangential to one another. + //! Use the function AddDone to check if this taper-adding transformation is successful. + //! Warning + //! Nothing is done if: + //! - the face F does not belong to the initial shape of this algorithm, or + //! - the face F is not planar, cylindrical or conical. + //! Exceptions + //! - Standard_NullObject if the initial shape is not + //! defined, i.e. if this algorithm has not been initialized + //! with the non-empty constructor or the Init function. + //! - Standard_ConstructionError if the previous call to + //! Add has failed. The function AddDone ought to have + //! been used to check for this, and the function Remove + //! to cancel the results of the unsuccessful taper-adding + //! transformation and to retrieve the previous shape. + Standard_EXPORT void Add(const TopoDS_Face& F, + const gp_Dir& Direction, + const Standard_Real Angle, + const gp_Pln& NeutralPlane, + const Standard_Boolean Flag = Standard_True); + + //! Returns true if the previous taper-adding + //! transformation performed by this algorithm in the last + //! call to Add, was successful. + //! If AddDone returns false: + //! - the function ProblematicShape returns the face + //! on which the error occurred, + //! - the function Remove has to be used to cancel the + //! results of the unsuccessful taper-adding + //! transformation and to retrieve the previous shape. + //! Exceptions + //! Standard_NullObject if the initial shape has not + //! been defined, i.e. if this algorithm has not been + //! initialized with the non-empty constructor or the .Init function. + Standard_EXPORT Standard_Boolean AddDone() const; + + //! Cancels the taper-adding transformation previously + //! performed by this algorithm on the face F and the + //! series of tangential faces which contain F, and retrieves + //! the shape before the last taper-adding transformation. + //! Warning + //! You will have to use this function if the previous call to + //! Add fails. Use the function AddDone to check it. + //! Exceptions + //! - Standard_NullObject if the initial shape has not + //! been defined, i.e. if this algorithm has not been + //! initialized with the non-empty constructor or the Init function. + //! - Standard_NoSuchObject if F has not been added + //! or has already been removed. + Standard_EXPORT void Remove(const TopoDS_Face& F); + + //! Returns the shape on which an error occurred after an + //! unsuccessful call to Add or when IsDone returns false. + //! Exceptions + //! Standard_NullObject if the initial shape has not been + //! defined, i.e. if this algorithm has not been initialized with + //! the non-empty constructor or the Init function. + Standard_EXPORT const TopoDS_Shape& ProblematicShape() const; + + //! Returns an error status when an error has occurred + //! (Face, Edge or Vertex recomputation problem). + //! Otherwise returns Draft_NoError. The method may be + //! called if AddDone returns Standard_False, or when + //! IsDone returns Standard_False. + Standard_EXPORT Draft_ErrorStatus Status() const; + + //! Returns all the faces which have been added + //! together with the face . + Standard_EXPORT const TopTools_ListOfShape& ConnectedFaces(const TopoDS_Face& F) const; + + //! Returns all the faces on which a modification has + //! been given. + Standard_EXPORT const TopTools_ListOfShape& ModifiedFaces() const; + + //! Builds the resulting shape (redefined from MakeShape). + Standard_EXPORT virtual void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + + Standard_EXPORT void CorrectWires(); + + //! Returns the list of shapes generated from the + //! shape . + Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) + Standard_OVERRIDE; + + //! Returns the list of shapes modified from the shape + //! . + Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) + Standard_OVERRIDE; + + //! Returns the modified shape corresponding to . + //! S can correspond to the entire initial shape or to its subshape. + //! Raises exceptions + //! Standard_NoSuchObject if S is not the initial shape or + //! a subshape of the initial shape to which the + //! transformation has been applied. + Standard_EXPORT virtual TopoDS_Shape ModifiedShape(const TopoDS_Shape& S) const Standard_OVERRIDE; + +protected: +private: + Standard_EXPORT void CorrectVertexTol(); + + TopTools_DataMapOfShapeShape myVtxToReplace; + BRepTools_ReShape mySubs; +}; + +#endif // _BRepOffsetAPI_DraftAngle_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_MakeOffset.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_MakeOffset.hxx new file mode 100644 index 0000000000000000000000000000000000000000..24758712311e5646355a38dd8165de8b3407c420 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffsetAPI_MakeOffset.hxx @@ -0,0 +1,111 @@ +// Created on: 1995-09-18 +// Created by: Bruno DUMORTIER +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepOffsetAPI_MakeOffset_HeaderFile +#define _BRepOffsetAPI_MakeOffset_HeaderFile + +#include +#include + +#include +#include +#include +#include +class TopoDS_Wire; +class TopoDS_Shape; + +//! Describes algorithms for offsetting wires from a set of +//! wires contained in a planar face. +//! A MakeOffset object provides a framework for: +//! - defining the construction of an offset, +//! - implementing the construction algorithm, and +//! - consulting the result. +class BRepOffsetAPI_MakeOffset : public BRepBuilderAPI_MakeShape +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs an algorithm for creating an empty offset + Standard_EXPORT BRepOffsetAPI_MakeOffset(); + + //! Constructs an algorithm for creating an algorithm + //! to build parallels to the spine Spine + Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine, + const GeomAbs_JoinType Join = GeomAbs_Arc, + const Standard_Boolean IsOpenResult = Standard_False); + + //! Initializes the algorithm to construct parallels to the spine Spine. + //! Join defines the type of parallel generated by the + //! salient vertices of the spine. + //! The default type is GeomAbs_Arc where the vertices generate + //! sections of a circle. + //! If join type is GeomAbs_Intersection, the edges that + //! intersect in a salient vertex generate the edges + //! prolonged until intersection. + Standard_EXPORT void Init(const TopoDS_Face& Spine, + const GeomAbs_JoinType Join = GeomAbs_Arc, + const Standard_Boolean IsOpenResult = Standard_False); + + Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine, + const GeomAbs_JoinType Join = GeomAbs_Arc, + const Standard_Boolean IsOpenResult = Standard_False); + + //! Initialize the evaluation of Offsetting. + Standard_EXPORT void Init(const GeomAbs_JoinType Join = GeomAbs_Arc, + const Standard_Boolean IsOpenResult = Standard_False); + + //! Set approximation flag + //! for conversion input contours into ones consisting of + //! 2D circular arcs and 2D linear segments only. + Standard_EXPORT void SetApprox(const Standard_Boolean ToApprox); + + //! Initializes the algorithm to construct parallels to the wire Spine. + Standard_EXPORT void AddWire(const TopoDS_Wire& Spine); + + //! Computes a parallel to the spine at distance Offset and + //! at an altitude Alt from the plane of the spine in relation + //! to the normal to the spine. + //! Exceptions: StdFail_NotDone if the offset is not built. + Standard_EXPORT void Perform(const Standard_Real Offset, const Standard_Real Alt = 0.0); + + //! Builds the resulting shape (redefined from MakeShape). + Standard_EXPORT virtual void Build( + const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + + //! returns a list of the created shapes + //! from the shape . + Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) + Standard_OVERRIDE; + + //! Converts each wire of the face into contour consisting only of + //! arcs and segments. New 3D curves are built too. + Standard_EXPORT static TopoDS_Face ConvertFace(const TopoDS_Face& theFace, + const Standard_Real theAngleTolerance); + +protected: +private: + Standard_Boolean myIsInitialized; + Standard_Boolean myLastIsLeft; + GeomAbs_JoinType myJoin; + Standard_Boolean myIsOpenResult; + Standard_Boolean myIsToApprox; + TopoDS_Face myFace; + TopTools_ListOfShape myWires; + BRepFill_ListOfOffsetWire myLeft; + BRepFill_ListOfOffsetWire myRight; +}; + +#endif // _BRepOffsetAPI_MakeOffset_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_DataMapOfShapeListOfInterval.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_DataMapOfShapeListOfInterval.hxx new file mode 100644 index 0000000000000000000000000000000000000000..87c95ee2a6ff1b9ba2bb6fb7c68acb617603bdec --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_DataMapOfShapeListOfInterval.hxx @@ -0,0 +1,30 @@ +// Created on: 1995-10-12 +// Created by: Bruno DUMORTIER +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BRepOffset_DataMapOfShapeListOfInterval_HeaderFile +#define BRepOffset_DataMapOfShapeListOfInterval_HeaderFile + +#include +#include +#include +#include + +typedef NCollection_DataMap + BRepOffset_DataMapOfShapeListOfInterval; +typedef NCollection_DataMap:: + Iterator BRepOffset_DataMapIteratorOfDataMapOfShapeListOfInterval; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_Offset.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_Offset.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e960b193eec62a852d03ee70640a0a8a770a1a9e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepOffset_Offset.hxx @@ -0,0 +1,159 @@ +// Created on: 1995-10-19 +// Created by: Bruno DUMORTIER +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepOffset_Offset_HeaderFile +#define _BRepOffset_Offset_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +class TopoDS_Edge; +class TopoDS_Vertex; + +// resolve name collisions with X11 headers +#ifdef Status + #undef Status +#endif + +//! This class compute elemenary offset surface. +//! Evaluate the offset generated : +//! 1 - from a face. +//! 2 - from an edge. +//! 3 - from a vertex. +class BRepOffset_Offset +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BRepOffset_Offset(); + + Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, + const Standard_Real Offset, + const Standard_Boolean OffsetOutside = Standard_True, + const GeomAbs_JoinType JoinType = GeomAbs_Arc); + + //! This method will be called when you want to share + //! the edges soon generated from an other face. + //! e.g. when two faces are tangents the common edge + //! will generate only one edge ( no pipe). + //! + //! The Map will be fill as follow: + //! + //! Created(E) = E' + //! with: E = an edge of + //! E' = the image of E in the offsetting of + //! another face sharing E with a + //! continuity at least G1 + Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, + const Standard_Real Offset, + const TopTools_DataMapOfShapeShape& Created, + const Standard_Boolean OffsetOutside = Standard_True, + const GeomAbs_JoinType JoinType = GeomAbs_Arc); + + Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const Standard_Real Offset, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const Standard_Real Offset, + const TopoDS_Edge& FirstEdge, + const TopoDS_Edge& LastEdge, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + //! Tol and Conti are only used if Polynomial is True + //! (Used to perform the approximation) + Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex, + const TopTools_ListOfShape& LEdge, + const Standard_Real Offset, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + Standard_EXPORT void Init(const TopoDS_Face& Face, + const Standard_Real Offset, + const Standard_Boolean OffsetOutside = Standard_True, + const GeomAbs_JoinType JoinType = GeomAbs_Arc); + + Standard_EXPORT void Init(const TopoDS_Face& Face, + const Standard_Real Offset, + const TopTools_DataMapOfShapeShape& Created, + const Standard_Boolean OffsetOutside = Standard_True, + const GeomAbs_JoinType JoinType = GeomAbs_Arc); + + Standard_EXPORT void Init(const TopoDS_Edge& Path, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const Standard_Real Offset, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + Standard_EXPORT void Init(const TopoDS_Edge& Path, + const TopoDS_Edge& Edge1, + const TopoDS_Edge& Edge2, + const Standard_Real Offset, + const TopoDS_Edge& FirstEdge, + const TopoDS_Edge& LastEdge, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + //! Tol and Conti are only used if Polynomial is True + //! (Used to perform the approximation) + Standard_EXPORT void Init(const TopoDS_Vertex& Vertex, + const TopTools_ListOfShape& LEdge, + const Standard_Real Offset, + const Standard_Boolean Polynomial = Standard_False, + const Standard_Real Tol = 1.0e-4, + const GeomAbs_Shape Conti = GeomAbs_C1); + + //! Only used in Rolling Ball. Pipe on Free Boundary + Standard_EXPORT void Init(const TopoDS_Edge& Edge, const Standard_Real Offset); + + const TopoDS_Shape& InitialShape() const; + + Standard_EXPORT const TopoDS_Face& Face() const; + + Standard_EXPORT TopoDS_Shape Generated(const TopoDS_Shape& Shape) const; + + Standard_EXPORT BRepOffset_Status Status() const; + +protected: +private: + TopoDS_Shape myShape; + BRepOffset_Status myStatus; + TopoDS_Face myFace; + TopTools_DataMapOfShapeShape myMap; +}; + +#include + +#endif // _BRepOffset_Offset_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BRepTools_Quilt.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BRepTools_Quilt.hxx new file mode 100644 index 0000000000000000000000000000000000000000..60f3d767f4a71606f3d8d55c58b88bea5ebefecd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BRepTools_Quilt.hxx @@ -0,0 +1,96 @@ +// Created on: 1994-12-22 +// Created by: Remi LEQUETTE +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BRepTools_Quilt_HeaderFile +#define _BRepTools_Quilt_HeaderFile + +#include +#include + +#include +class TopoDS_Edge; +class TopoDS_Vertex; +class TopoDS_Shape; + +//! A Tool to glue faces at common edges and reconstruct shells. +//! +//! The user designate pairs of common edges using the method Bind. +//! One edge is designated as the edge to use in place of the other one +//! (they are supposed to be geometrically confused, but this not checked). +//! They can be of opposite directions, this is specified by the orientations. +//! +//! The user can add shapes with the Add method, all the faces are registered and copies of faces +//! and edges are made to glue at the bound edges. +//! +//! The user can call the Shells methods to compute a compound of shells from the current set of +//! faces. +//! +//! If no binding is made this class can be used to make shell from faces already sharing their +//! edges. +class BRepTools_Quilt +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BRepTools_Quilt(); + + //! Binds to be the new edge instead of + //! . + //! + //! The faces of the added shape containing + //! will be copied to substitute by . + //! + //! The vertices of will be bound to the + //! vertices of with the same orientation. + //! + //! If and have different orientations + //! the curves are considered to be opposite and the + //! pcurves of will be copied and reversed in + //! the new faces. + //! + //! must belong to the next added shape, must belong + //! to a Shape added before. + Standard_EXPORT void Bind(const TopoDS_Edge& Eold, const TopoDS_Edge& Enew); + + //! Binds to be a new vertex instead of . + //! + //! The faces of the added shape containing + //! will be copied to substitute by . + Standard_EXPORT void Bind(const TopoDS_Vertex& Vold, const TopoDS_Vertex& Vnew); + + //! Add the faces of to the Quilt, the faces + //! containing bounded edges are copied. + Standard_EXPORT void Add(const TopoDS_Shape& S); + + //! Returns True if has been copied ( is a + //! vertex, an edge or a face) + Standard_EXPORT Standard_Boolean IsCopied(const TopoDS_Shape& S) const; + + //! Returns the shape substituted to in the Quilt. + Standard_EXPORT const TopoDS_Shape& Copy(const TopoDS_Shape& S) const; + + //! Returns a Compound of shells made from the current + //! set of faces. The shells will be flagged as closed + //! or not closed. + Standard_EXPORT TopoDS_Shape Shells() const; + +protected: +private: + TopTools_IndexedDataMapOfShapeShape myBounds; + Standard_Boolean hasCopy; +}; + +#endif // _BRepTools_Quilt_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BVH_BinnedBuilder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BVH_BinnedBuilder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..29721d883f1724f7d0d658d600d21b84a0937c66 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BVH_BinnedBuilder.hxx @@ -0,0 +1,341 @@ +// Created on: 2013-12-20 +// Created by: Denis BOGOLEPOV +// Copyright (c) 2013-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BVH_BinnedBuilder_HeaderFile +#define BVH_BinnedBuilder_HeaderFile + +#include + +#include + +#if defined(_WIN32) && defined(max) + #undef max +#endif + +#include + +//! Stores parameters of single bin (slice of AABB). +template +struct BVH_Bin +{ + //! Creates new node bin. + BVH_Bin() + : Count(0) + { + } + + Standard_Integer Count; //!< Number of primitives in the bin + BVH_Box Box; //!< AABB of primitives in the bin +}; + +//! Performs construction of BVH tree using binned SAH algorithm. Number +//! of bins controls BVH quality in cost of construction time (greater - +//! better). For optimal results, use 32 - 48 bins. However, reasonable +//! performance is provided even for 4 - 8 bins (it is only 10-20% lower +//! in comparison with optimal settings). Note that multiple threads can +//! be used only with thread safe BVH primitive sets. +template +class BVH_BinnedBuilder : public BVH_QueueBuilder +{ +public: + //! Type of the array of bins of BVH tree node. + typedef BVH_Bin BVH_BinVector[Bins]; + + //! Describes split plane candidate. + struct BVH_SplitPlane + { + BVH_Bin LftVoxel; + BVH_Bin RghVoxel; + }; + + //! Type of the array of split plane candidates. + typedef BVH_SplitPlane BVH_SplitPlanes[Bins + 1]; + +public: + //! Creates binned SAH BVH builder. + BVH_BinnedBuilder(const Standard_Integer theLeafNodeSize = BVH_Constants_LeafNodeSizeDefault, + const Standard_Integer theMaxTreeDepth = BVH_Constants_MaxTreeDepth, + const Standard_Boolean theDoMainSplits = Standard_False, + const Standard_Integer theNumOfThreads = 1) + : BVH_QueueBuilder(theLeafNodeSize, theMaxTreeDepth, theNumOfThreads), + myUseMainAxis(theDoMainSplits) + { + // + } + + //! Releases resources of binned SAH BVH builder. + virtual ~BVH_BinnedBuilder() {} + +protected: + //! Performs splitting of the given BVH node. + virtual typename BVH_QueueBuilder::BVH_ChildNodes buildNode( + BVH_Set* theSet, + BVH_Tree* theBVH, + const Standard_Integer theNode) const Standard_OVERRIDE; + + //! Arranges node primitives into bins. + virtual void getSubVolumes(BVH_Set* theSet, + BVH_Tree* theBVH, + const Standard_Integer theNode, + BVH_BinVector& theBins, + const Standard_Integer theAxis) const; + +private: + // clang-format off + Standard_Boolean myUseMainAxis; //!< Defines whether to search for the best split or use the widest axis + // clang-format on +}; + +// ======================================================================= +// function : getSubVolumes +// purpose : +// ======================================================================= +template +void BVH_BinnedBuilder::getSubVolumes(BVH_Set* theSet, + BVH_Tree* theBVH, + const Standard_Integer theNode, + BVH_BinVector& theBins, + const Standard_Integer theAxis) const +{ + const T aMin = BVH::VecComp::Get(theBVH->MinPoint(theNode), theAxis); + const T aMax = BVH::VecComp::Get(theBVH->MaxPoint(theNode), theAxis); + const T anInverseStep = static_cast(Bins) / (aMax - aMin); + for (Standard_Integer anIdx = theBVH->BegPrimitive(theNode); + anIdx <= theBVH->EndPrimitive(theNode); + ++anIdx) + { + typename BVH_Set::BVH_BoxNt aBox = theSet->Box(anIdx); + Standard_Integer aBinIndex = + BVH::IntFloor((theSet->Center(anIdx, theAxis) - aMin) * anInverseStep); + if (aBinIndex < 0) + { + aBinIndex = 0; + } + else if (aBinIndex >= Bins) + { + aBinIndex = Bins - 1; + } + + theBins[aBinIndex].Count++; + theBins[aBinIndex].Box.Combine(aBox); + } +} + +namespace BVH +{ +template +Standard_Integer SplitPrimitives(BVH_Set* theSet, + const BVH_Box& theBox, + const Standard_Integer theBeg, + const Standard_Integer theEnd, + const Standard_Integer theBin, + const Standard_Integer theAxis, + const Standard_Integer theBins) +{ + const T aMin = BVH::VecComp::Get(theBox.CornerMin(), theAxis); + const T aMax = BVH::VecComp::Get(theBox.CornerMax(), theAxis); + + const T anInverseStep = static_cast(theBins) / (aMax - aMin); + + Standard_Integer aLftIdx(theBeg); + Standard_Integer aRghIdx(theEnd); + + do + { + while (BVH::IntFloor((theSet->Center(aLftIdx, theAxis) - aMin) * anInverseStep) <= theBin + && aLftIdx < theEnd) + { + ++aLftIdx; + } + while (BVH::IntFloor((theSet->Center(aRghIdx, theAxis) - aMin) * anInverseStep) > theBin + && aRghIdx > theBeg) + { + --aRghIdx; + } + + if (aLftIdx <= aRghIdx) + { + if (aLftIdx != aRghIdx) + { + theSet->Swap(aLftIdx, aRghIdx); + } + + ++aLftIdx; + --aRghIdx; + } + } while (aLftIdx <= aRghIdx); + + return aLftIdx; +} + +template +struct BVH_AxisSelector +{ + typedef typename BVH::VectorType::Type BVH_VecNt; + + static Standard_Integer MainAxis(const BVH_VecNt& theSize) + { + if (theSize.y() > theSize.x()) + { + return theSize.y() > theSize.z() ? 1 : 2; + } + else + { + return theSize.z() > theSize.x() ? 2 : 0; + } + } +}; + +template +struct BVH_AxisSelector +{ + typedef typename BVH::VectorType::Type BVH_VecNt; + + static Standard_Integer MainAxis(const BVH_VecNt& theSize) + { + return theSize.x() > theSize.y() ? 0 : 1; + } +}; +} // namespace BVH + +// ======================================================================= +// function : buildNode +// purpose : +// ======================================================================= +template +typename BVH_QueueBuilder::BVH_ChildNodes BVH_BinnedBuilder::buildNode( + BVH_Set* theSet, + BVH_Tree* theBVH, + const Standard_Integer theNode) const +{ + const Standard_Integer aNodeBegPrimitive = theBVH->BegPrimitive(theNode); + const Standard_Integer aNodeEndPrimitive = theBVH->EndPrimitive(theNode); + if (aNodeEndPrimitive - aNodeBegPrimitive < BVH_Builder::myLeafNodeSize) + { + // clang-format off + return typename BVH_QueueBuilder::BVH_ChildNodes(); // node does not require partitioning + // clang-format on + } + + const BVH_Box anAABB(theBVH->MinPoint(theNode), theBVH->MaxPoint(theNode)); + const typename BVH_Box::BVH_VecNt aSize = anAABB.Size(); + + // Parameters for storing best split + Standard_Integer aMinSplitAxis = -1; + Standard_Integer aMinSplitIndex = 0; + Standard_Integer aMinSplitNumLft = 0; + Standard_Integer aMinSplitNumRgh = 0; + + BVH_Box aMinSplitBoxLft; + BVH_Box aMinSplitBoxRgh; + + Standard_Real aMinSplitCost = std::numeric_limits::max(); + const Standard_Integer aMainAxis = BVH::BVH_AxisSelector::MainAxis(aSize); + + // Find best split + for (Standard_Integer anAxis = myUseMainAxis ? aMainAxis : 0; + anAxis <= (myUseMainAxis ? aMainAxis : Min(N - 1, 2)); + ++anAxis) + { + if (BVH::VecComp::Get(aSize, anAxis) <= BVH::THE_NODE_MIN_SIZE) + { + continue; + } + + BVH_BinVector aBinVector; + getSubVolumes(theSet, theBVH, theNode, aBinVector, anAxis); + + BVH_SplitPlanes aSplitPlanes; + for (Standard_Integer aLftSplit = 1, aRghSplit = Bins - 1; aLftSplit < Bins; + ++aLftSplit, --aRghSplit) + { + aSplitPlanes[aLftSplit].LftVoxel.Count = + aSplitPlanes[aLftSplit - 1].LftVoxel.Count + aBinVector[aLftSplit - 1].Count; + aSplitPlanes[aRghSplit].RghVoxel.Count = + aSplitPlanes[aRghSplit + 1].RghVoxel.Count + aBinVector[aRghSplit + 0].Count; + + aSplitPlanes[aLftSplit].LftVoxel.Box = aSplitPlanes[aLftSplit - 1].LftVoxel.Box; + aSplitPlanes[aRghSplit].RghVoxel.Box = aSplitPlanes[aRghSplit + 1].RghVoxel.Box; + + aSplitPlanes[aLftSplit].LftVoxel.Box.Combine(aBinVector[aLftSplit - 1].Box); + aSplitPlanes[aRghSplit].RghVoxel.Box.Combine(aBinVector[aRghSplit + 0].Box); + } + + // Choose the best split (with minimum SAH cost) + for (Standard_Integer aSplit = 1; aSplit < Bins; ++aSplit) + { + // Simple SAH evaluation + Standard_Real aCost = + (static_cast(aSplitPlanes[aSplit].LftVoxel.Box.Area()) /* / S(N) */) + * aSplitPlanes[aSplit].LftVoxel.Count + + (static_cast(aSplitPlanes[aSplit].RghVoxel.Box.Area()) /* / S(N) */) + * aSplitPlanes[aSplit].RghVoxel.Count; + + if (aCost <= aMinSplitCost) + { + aMinSplitCost = aCost; + aMinSplitAxis = anAxis; + aMinSplitIndex = aSplit; + aMinSplitBoxLft = aSplitPlanes[aSplit].LftVoxel.Box; + aMinSplitBoxRgh = aSplitPlanes[aSplit].RghVoxel.Box; + aMinSplitNumLft = aSplitPlanes[aSplit].LftVoxel.Count; + aMinSplitNumRgh = aSplitPlanes[aSplit].RghVoxel.Count; + } + } + } + + theBVH->SetInner(theNode); + Standard_Integer aMiddle = -1; + if (aMinSplitNumLft == 0 || aMinSplitNumRgh == 0 + || aMinSplitAxis == -1) // case of objects with the same center + { + aMinSplitBoxLft.Clear(); + aMinSplitBoxRgh.Clear(); + + aMiddle = + std::max(aNodeBegPrimitive + 1, + static_cast((aNodeBegPrimitive + aNodeEndPrimitive) / 2.f)); + + aMinSplitNumLft = aMiddle - aNodeBegPrimitive; + for (Standard_Integer anIndex = aNodeBegPrimitive; anIndex < aMiddle; ++anIndex) + { + aMinSplitBoxLft.Combine(theSet->Box(anIndex)); + } + + aMinSplitNumRgh = aNodeEndPrimitive - aMiddle + 1; + for (Standard_Integer anIndex = aNodeEndPrimitive; anIndex >= aMiddle; --anIndex) + { + aMinSplitBoxRgh.Combine(theSet->Box(anIndex)); + } + } + else + { + aMiddle = BVH::SplitPrimitives(theSet, + anAABB, + aNodeBegPrimitive, + aNodeEndPrimitive, + aMinSplitIndex - 1, + aMinSplitAxis, + Bins); + } + + typedef typename BVH_QueueBuilder::BVH_PrimitiveRange Range; + return typename BVH_QueueBuilder::BVH_ChildNodes(aMinSplitBoxLft, + aMinSplitBoxRgh, + Range(aNodeBegPrimitive, aMiddle - 1), + Range(aMiddle, aNodeEndPrimitive)); +} + +#endif // _BVH_BinnedBuilder_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BVH_Builder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BVH_Builder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a3871cc14d47b95d3e03f511c7c92a253fd9269e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BVH_Builder.hxx @@ -0,0 +1,86 @@ +// Created on: 2013-12-20 +// Created by: Denis BOGOLEPOV +// Copyright (c) 2013-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BVH_Builder_HeaderFile +#define BVH_Builder_HeaderFile + +#include +#include + +//! A non-template class for using as base for BVH_Builder +//! (just to have a named base class). +class BVH_BuilderTransient : public Standard_Transient +{ + DEFINE_STANDARD_RTTIEXT(BVH_BuilderTransient, Standard_Transient) +public: + //! Returns the maximum depth of constructed BVH. + Standard_Integer MaxTreeDepth() const { return myMaxTreeDepth; } + + //! Returns the maximum number of sub-elements in the leaf. + Standard_Integer LeafNodeSize() const { return myLeafNodeSize; } + + //! Returns parallel flag. + inline Standard_Boolean IsParallel() const { return myIsParallel; } + + //! Set parallel flag controlling possibility of parallel execution. + inline void SetParallel(const Standard_Boolean isParallel) { myIsParallel = isParallel; } + +protected: + //! Creates new abstract BVH builder. + BVH_BuilderTransient(const Standard_Integer theLeafNodeSize, + const Standard_Integer theMaxTreeDepth) + : myMaxTreeDepth(theMaxTreeDepth), + myLeafNodeSize(theLeafNodeSize), + myIsParallel(Standard_False) + { + } + +protected: + Standard_Integer myMaxTreeDepth; //!< Maximum depth of constructed BVH + Standard_Integer myLeafNodeSize; //!< Maximum number of objects per leaf + Standard_Boolean myIsParallel; //!< Parallel execution flag. +}; + +//! Performs construction of BVH tree using bounding +//! boxes (AABBs) of abstract objects. +//! \tparam T Numeric data type +//! \tparam N Vector dimension +template +class BVH_Builder : public BVH_BuilderTransient +{ +public: + //! Builds BVH using specific algorithm. + virtual void Build(BVH_Set* theSet, + BVH_Tree* theBVH, + const BVH_Box& theBox) const = 0; + +protected: + //! Creates new abstract BVH builder. + BVH_Builder(const Standard_Integer theLeafNodeSize, const Standard_Integer theMaxTreeDepth) + : BVH_BuilderTransient(theLeafNodeSize, theMaxTreeDepth) + { + } + + //! Updates depth of constructed BVH tree. + void updateDepth(BVH_Tree* theBVH, const Standard_Integer theLevel) const + { + if (theLevel > theBVH->myDepth) + { + theBVH->myDepth = theLevel; + } + } +}; + +#endif // _BVH_Builder_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BVH_LinearBuilder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BVH_LinearBuilder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fa73be11972340a2225507cc572cd32a3c06ab89 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BVH_LinearBuilder.hxx @@ -0,0 +1,349 @@ +// Created on: 2014-09-11 +// Created by: Danila ULYANOV +// Copyright (c) 2013-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BVH_LinearBuilder_Header +#define _BVH_LinearBuilder_Header + +#include +#include + +//! Performs fast BVH construction using LBVH building approach. +//! Algorithm uses spatial Morton codes to reduce the BVH construction +//! problem to a sorting problem (radix sort -- O(N) complexity). This +//! Linear Bounding Volume Hierarchy (LBVH) builder produces BVH trees +//! of lower quality compared to SAH-based BVH builders but it is over +//! an order of magnitude faster (up to 3M triangles per second). +//! +//! For more details see: +//! C. Lauterbach, M. Garland, S. Sengupta, D. Luebke, and D. Manocha. +//! Fast BVH construction on GPUs. Eurographics, 2009. +template +class BVH_LinearBuilder : public BVH_Builder +{ +public: + typedef typename BVH::VectorType::Type BVH_VecNt; + +public: + //! Creates binned LBVH builder. + BVH_LinearBuilder(const Standard_Integer theLeafNodeSize = BVH_Constants_LeafNodeSizeDefault, + const Standard_Integer theMaxTreeDepth = BVH_Constants_MaxTreeDepth); + + //! Releases resources of LBVH builder. + virtual ~BVH_LinearBuilder(); + + //! Builds BVH. + virtual void Build(BVH_Set* theSet, + BVH_Tree* theBVH, + const BVH_Box& theBox) const Standard_OVERRIDE; + +protected: + typedef NCollection_Array1::iterator LinkIterator; + +protected: + //! Emits hierarchy from sorted Morton codes. + Standard_Integer emitHierachy(BVH_Tree* theBVH, + const NCollection_Array1& theEncodedLinks, + const Standard_Integer theBit, + const Standard_Integer theShift, + const Standard_Integer theStart, + const Standard_Integer theFinal) const; + + //! Returns index of the first element which does not compare less than the given one. + Standard_Integer lowerBound(const NCollection_Array1& theEncodedLinks, + Standard_Integer theStart, + Standard_Integer theFinal, + Standard_Integer theDigit) const; +}; + +// ======================================================================= +// function : BVH_LinearBuilder +// purpose : +// ======================================================================= +template +BVH_LinearBuilder::BVH_LinearBuilder(const Standard_Integer theLeafNodeSize, + const Standard_Integer theMaxTreeDepth) + : BVH_Builder(theLeafNodeSize, theMaxTreeDepth) +{ + // +} + +// ======================================================================= +// function : ~BVH_LinearBuilder +// purpose : +// ======================================================================= +template +BVH_LinearBuilder::~BVH_LinearBuilder() +{ + // +} + +// ======================================================================= +// function : lowerBound +// purpose : Returns index of first element greater than the given one +// ======================================================================= +template +Standard_Integer BVH_LinearBuilder::lowerBound( + const NCollection_Array1& theEncodedLinks, + Standard_Integer theStart, + Standard_Integer theFinal, + Standard_Integer theDigit) const +{ + Standard_Integer aNbPrims = theFinal - theStart; + unsigned int aBit = 1U << theDigit; + while (aNbPrims > 0) + { + const Standard_Integer aStep = aNbPrims / 2; + if (theEncodedLinks.Value(theStart + aStep).first & aBit) + { + aNbPrims = aStep; + } + else + { + theStart += aStep + 1; + aNbPrims -= aStep + 1; + } + } + + return theStart; +} + +// ======================================================================= +// function : emitHierachy +// purpose : Emits hierarchy from sorted Morton codes +// ======================================================================= +template +Standard_Integer BVH_LinearBuilder::emitHierachy( + BVH_Tree* theBVH, + const NCollection_Array1& theEncodedLinks, + const Standard_Integer theDigit, + const Standard_Integer theShift, + const Standard_Integer theStart, + const Standard_Integer theFinal) const +{ + if (theFinal - theStart > BVH_Builder::myLeafNodeSize) + { + const Standard_Integer aPosition = + theDigit < 0 ? (theStart + theFinal) / 2 + : lowerBound(theEncodedLinks, theStart, theFinal, theDigit); + if (aPosition == theStart || aPosition == theFinal) + { + return emitHierachy(theBVH, theEncodedLinks, theDigit - 1, theShift, theStart, theFinal); + } + + // Build inner node + const Standard_Integer aNode = theBVH->AddInnerNode(0, 0); + const Standard_Integer aRghNode = theShift + aPosition - theStart; + + const Standard_Integer aLftChild = + emitHierachy(theBVH, theEncodedLinks, theDigit - 1, theShift, theStart, aPosition); + const Standard_Integer aRghChild = + emitHierachy(theBVH, theEncodedLinks, theDigit - 1, aRghNode, aPosition, theFinal); + + theBVH->NodeInfoBuffer()[aNode].y() = aLftChild; + theBVH->NodeInfoBuffer()[aNode].z() = aRghChild; + return aNode; + } + else + { + // Build leaf node + return theBVH->AddLeafNode(theShift, theShift + theFinal - theStart - 1); + } +} + +namespace BVH +{ +//! Calculates bounding boxes (AABBs) for the given BVH tree. +template +Standard_Integer UpdateBounds(BVH_Set* theSet, + BVH_Tree* theTree, + const Standard_Integer theNode = 0) +{ + const BVH_Vec4i aData = theTree->NodeInfoBuffer()[theNode]; + if (aData.x() == 0) + { + const Standard_Integer aLftChild = theTree->NodeInfoBuffer()[theNode].y(); + const Standard_Integer aRghChild = theTree->NodeInfoBuffer()[theNode].z(); + + const Standard_Integer aLftDepth = UpdateBounds(theSet, theTree, aLftChild); + const Standard_Integer aRghDepth = UpdateBounds(theSet, theTree, aRghChild); + + typename BVH_Box::BVH_VecNt aLftMinPoint = theTree->MinPointBuffer()[aLftChild]; + typename BVH_Box::BVH_VecNt aLftMaxPoint = theTree->MaxPointBuffer()[aLftChild]; + typename BVH_Box::BVH_VecNt aRghMinPoint = theTree->MinPointBuffer()[aRghChild]; + typename BVH_Box::BVH_VecNt aRghMaxPoint = theTree->MaxPointBuffer()[aRghChild]; + + BVH::BoxMinMax::CwiseMin(aLftMinPoint, aRghMinPoint); + BVH::BoxMinMax::CwiseMax(aLftMaxPoint, aRghMaxPoint); + + theTree->MinPointBuffer()[theNode] = aLftMinPoint; + theTree->MaxPointBuffer()[theNode] = aLftMaxPoint; + return Max(aLftDepth, aRghDepth) + 1; + } + else + { + typename BVH_Box::BVH_VecNt& aMinPoint = theTree->MinPointBuffer()[theNode]; + typename BVH_Box::BVH_VecNt& aMaxPoint = theTree->MaxPointBuffer()[theNode]; + for (Standard_Integer aPrimIdx = aData.y(); aPrimIdx <= aData.z(); ++aPrimIdx) + { + const BVH_Box aBox = theSet->Box(aPrimIdx); + if (aPrimIdx == aData.y()) + { + aMinPoint = aBox.CornerMin(); + aMaxPoint = aBox.CornerMax(); + } + else + { + BVH::BoxMinMax::CwiseMin(aMinPoint, aBox.CornerMin()); + BVH::BoxMinMax::CwiseMax(aMaxPoint, aBox.CornerMax()); + } + } + } + return 0; +} + +template +struct BoundData +{ + BVH_Set* mySet; //!< Set of geometric objects + BVH_Tree* myBVH; //!< BVH tree built over the set + Standard_Integer myNode; //!< BVH node to update bounding box + Standard_Integer myLevel; //!< Level of the processed BVH node + Standard_Integer* myHeight; //!< Height of the processed BVH node +}; + +//! Task for parallel bounds updating. +template +class UpdateBoundTask +{ +public: + UpdateBoundTask(const Standard_Boolean isParallel) + : myIsParallel(isParallel) + { + } + + //! Executes the task. + void operator()(const BoundData& theData) const + { + if (theData.myBVH->IsOuter(theData.myNode) || theData.myLevel > 2) + { + *theData.myHeight = BVH::UpdateBounds(theData.mySet, theData.myBVH, theData.myNode); + } + else + { + Standard_Integer aLftHeight = 0; + Standard_Integer aRghHeight = 0; + + const Standard_Integer aLftChild = theData.myBVH->NodeInfoBuffer()[theData.myNode].y(); + const Standard_Integer aRghChild = theData.myBVH->NodeInfoBuffer()[theData.myNode].z(); + + std::vector> aList; + aList.reserve(2); + if (!theData.myBVH->IsOuter(aLftChild)) + { + BoundData aBoundData = {theData.mySet, + theData.myBVH, + aLftChild, + theData.myLevel + 1, + &aLftHeight}; + aList.push_back(aBoundData); + } + else + { + aLftHeight = BVH::UpdateBounds(theData.mySet, theData.myBVH, aLftChild); + } + + if (!theData.myBVH->IsOuter(aRghChild)) + { + BoundData aBoundData = {theData.mySet, + theData.myBVH, + aRghChild, + theData.myLevel + 1, + &aRghHeight}; + aList.push_back(aBoundData); + } + else + { + aRghHeight = BVH::UpdateBounds(theData.mySet, theData.myBVH, aRghChild); + } + + if (!aList.empty()) + { + OSD_Parallel::ForEach(aList.begin(), + aList.end(), + UpdateBoundTask(myIsParallel), + !myIsParallel); + } + + typename BVH_Box::BVH_VecNt aLftMinPoint = theData.myBVH->MinPointBuffer()[aLftChild]; + typename BVH_Box::BVH_VecNt aLftMaxPoint = theData.myBVH->MaxPointBuffer()[aLftChild]; + typename BVH_Box::BVH_VecNt aRghMinPoint = theData.myBVH->MinPointBuffer()[aRghChild]; + typename BVH_Box::BVH_VecNt aRghMaxPoint = theData.myBVH->MaxPointBuffer()[aRghChild]; + + BVH::BoxMinMax::CwiseMin(aLftMinPoint, aRghMinPoint); + BVH::BoxMinMax::CwiseMax(aLftMaxPoint, aRghMaxPoint); + + theData.myBVH->MinPointBuffer()[theData.myNode] = aLftMinPoint; + theData.myBVH->MaxPointBuffer()[theData.myNode] = aLftMaxPoint; + + *theData.myHeight = Max(aLftHeight, aRghHeight) + 1; + } + } + +private: + Standard_Boolean myIsParallel; +}; +} // namespace BVH + +// ======================================================================= +// function : Build +// purpose : +// ======================================================================= +template +void BVH_LinearBuilder::Build(BVH_Set* theSet, + BVH_Tree* theBVH, + const BVH_Box& theBox) const +{ + Standard_STATIC_ASSERT(N == 2 || N == 3 || N == 4); + const Standard_Integer aSetSize = theSet->Size(); + if (theBVH == NULL || aSetSize == 0) + { + return; + } + + theBVH->Clear(); + + // Step 0 -- Initialize parameter of virtual grid + BVH_RadixSorter aRadixSorter(theBox); + aRadixSorter.SetParallel(this->IsParallel()); + + // Step 1 - Perform radix sorting of primitive set + aRadixSorter.Perform(theSet); + + // Step 2 -- Emitting BVH hierarchy from sorted Morton codes + emitHierachy(theBVH, aRadixSorter.EncodedLinks(), 29, 0, 0, theSet->Size()); + + // Step 3 -- Compute bounding boxes of BVH nodes + theBVH->MinPointBuffer().resize(theBVH->NodeInfoBuffer().size()); + theBVH->MaxPointBuffer().resize(theBVH->NodeInfoBuffer().size()); + + Standard_Integer aHeight = 0; + BVH::BoundData aBoundData = {theSet, theBVH, 0, 0, &aHeight}; + BVH::UpdateBoundTask aBoundTask(this->IsParallel()); + aBoundTask(aBoundData); + + BVH_Builder::updateDepth(theBVH, aHeight); +} + +#endif // _BVH_LinearBuilder_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BVH_PairDistance.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BVH_PairDistance.hxx new file mode 100644 index 0000000000000000000000000000000000000000..cf81725a85869b7315de018e93843201bcd7b1aa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BVH_PairDistance.hxx @@ -0,0 +1,99 @@ +// Created by: Eugeny MALTCHIKOV +// Created on: 2019-04-17 +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BVH_PairDistance_Header +#define _BVH_PairDistance_Header + +#include +#include + +//! Abstract class for computation of the min distance between +//! elements of two BVH trees. +//! To use this class it is required to define only the method +//! *Accept* to compute the distance between elements of the trees. +//! +//! \tparam NumType Numeric data type +//! \tparam Dimension Vector dimension +//! \tparam BVHSetType Type of the set on which BVH is built +template +class BVH_PairDistance : public BVH_PairTraverse +{ +public: + typedef typename BVH_Tools::BVH_VecNt BVH_VecNt; + +public: //! @name Constructor + //! Constructor + BVH_PairDistance() + : BVH_PairTraverse(), + myDistance(std::numeric_limits::max()), + myIsDone(Standard_False) + { + } + +public: //! @name Compute the distance + //! Computes the distance between two BVH trees + NumType ComputeDistance() + { + myIsDone = this->Select() > 0; + return myDistance; + } + +public: //! @name Accessing the results + //! Returns IsDone flag + Standard_Boolean IsDone() const { return myIsDone; } + + //! Returns the computed distance + NumType Distance() const { return myDistance; } + +public: //! @name Definition of the rules for tree descend + //! Compares the two metrics and chooses the best one + virtual Standard_Boolean IsMetricBetter(const NumType& theLeft, + const NumType& theRight) const Standard_OVERRIDE + { + return theLeft < theRight; + } + + //! Computes the distance between boxes of the nodes + virtual Standard_Boolean RejectNode(const BVH_VecNt& theCornerMin1, + const BVH_VecNt& theCornerMax1, + const BVH_VecNt& theCornerMin2, + const BVH_VecNt& theCornerMax2, + NumType& theMetric) const Standard_OVERRIDE + { + theMetric = BVH_Tools::BoxBoxSquareDistance(theCornerMin1, + theCornerMax1, + theCornerMin2, + theCornerMax2); + return theMetric > myDistance; + } + + //! Rejects the branch by the metric + virtual Standard_Boolean RejectMetric(const NumType& theMetric) const Standard_OVERRIDE + { + return theMetric > myDistance; + } + + //! Returns the flag controlling the tree descend + virtual Standard_Boolean Stop() const Standard_OVERRIDE + { + return myDistance == static_cast(0); + } + +protected: //! @name Fields + NumType myDistance; //!< Square distance + Standard_Boolean myIsDone; //!< State of the algorithm +}; + +#endif // _BVH_Distance_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BinObjMgt_PReal.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BinObjMgt_PReal.hxx new file mode 100644 index 0000000000000000000000000000000000000000..61977e49dd53b1dff8e4a1a83a5ba37b80127f72 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BinObjMgt_PReal.hxx @@ -0,0 +1,23 @@ +// Created on: 2003-03-24 +// Created by: Michael SAZONOV +// Copyright (c) 2003-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef BinObjMgt_PReal_HeaderFile +#define BinObjMgt_PReal_HeaderFile + +#include + +typedef Standard_Real* BinObjMgt_PReal; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BinTools_SurfaceSet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BinTools_SurfaceSet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2194ae7163b5019361b55026e09c3219167638d6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BinTools_SurfaceSet.hxx @@ -0,0 +1,79 @@ +// Created on: 2004-05-20 +// Created by: Sergey ZARITCHNY +// Copyright (c) 2004-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BinTools_SurfaceSet_HeaderFile +#define _BinTools_SurfaceSet_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +class Geom_Surface; + +//! Stores a set of Surfaces from Geom in binary format. +class BinTools_SurfaceSet +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns an empty set of Surfaces. + Standard_EXPORT BinTools_SurfaceSet(); + + //! Clears the content of the set. + Standard_EXPORT void Clear(); + + //! Incorporate a new Surface in the set and returns + //! its index. + Standard_EXPORT Standard_Integer Add(const Handle(Geom_Surface)& S); + + //! Returns the Surface of index . + Standard_EXPORT Handle(Geom_Surface) Surface(const Standard_Integer I) const; + + //! Returns the index of . + Standard_EXPORT Standard_Integer Index(const Handle(Geom_Surface)& S) const; + + //! Writes the content of me on the stream in + //! binary format that can be read back by Read. + Standard_EXPORT void Write(Standard_OStream& OS, + const Message_ProgressRange& theRange = Message_ProgressRange()) const; + + //! Reads the content of me from the stream . me + //! is first cleared. + Standard_EXPORT void Read(Standard_IStream& IS, + const Message_ProgressRange& therange = Message_ProgressRange()); + + //! Dumps the surface on the stream in binary + //! format that can be read back. + Standard_EXPORT static void WriteSurface(const Handle(Geom_Surface)& S, BinTools_OStream& OS); + + //! Reads the surface from the stream. The surface is + //! assumed to have been written with the Write + //! method. + Standard_EXPORT static Standard_IStream& ReadSurface(Standard_IStream& IS, + Handle(Geom_Surface)& S); + +private: + TColStd_IndexedMapOfTransient myMap; +}; + +#endif // _BinTools_SurfaceSet_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/BlendFunc_ConstThroatInv.hxx b/data/miniconda3/envs/catiagent/include/opencascade/BlendFunc_ConstThroatInv.hxx new file mode 100644 index 0000000000000000000000000000000000000000..07b65780fb7ee80b2d682c87fadaf3a1e9f4727d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/BlendFunc_ConstThroatInv.hxx @@ -0,0 +1,80 @@ +// Created by: Julia GERASIMOVA +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _BlendFunc_ConstThroatInv_HeaderFile +#define _BlendFunc_ConstThroatInv_HeaderFile + +#include +#include +#include + +class math_Matrix; + +//! Class for a function used to compute a ConstThroat chamfer on a surface's boundary +class BlendFunc_ConstThroatInv : public BlendFunc_GenChamfInv +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BlendFunc_ConstThroatInv(const Handle(Adaptor3d_Surface)& S1, + const Handle(Adaptor3d_Surface)& S2, + const Handle(Adaptor3d_Curve)& C); + + Standard_EXPORT Standard_Boolean IsSolution(const math_Vector& Sol, + const Standard_Real Tol) Standard_OVERRIDE; + + //! computes the values of the Functions for the + //! variable . + //! Returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE; + + //! returns the values of the derivatives for the + //! variable . + //! Returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X, + math_Matrix& D) Standard_OVERRIDE; + + using Blend_FuncInv::Set; + + Standard_EXPORT virtual void Set(const Standard_Real theThroat, + const Standard_Real, + const Standard_Integer Choix) Standard_OVERRIDE; + +protected: + Standard_Real Throat; + + Standard_Real param; + Standard_Real sign1; + Standard_Real sign2; + + gp_Pnt ptgui; + gp_Vec nplan; + Standard_Real normtg; + Standard_Real theD; + gp_Vec d1gui; + gp_Vec d2gui; + + gp_Pnt pts1; + gp_Pnt pts2; + gp_Vec d1u1; + gp_Vec d1v1; + gp_Vec d1u2; + gp_Vec d1v2; + +private: +}; + +#endif // _BlendFunc_ConstThroatInv_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Blend_Function.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Blend_Function.hxx new file mode 100644 index 0000000000000000000000000000000000000000..75fe4953a8f9f39c8e0cfa71992c80801f120ecd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Blend_Function.hxx @@ -0,0 +1,125 @@ +// Created on: 1993-09-13 +// Created by: Jacques GOUSSARD +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Blend_Function_HeaderFile +#define _Blend_Function_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +class gp_Pnt; +class gp_Vec; +class gp_Vec2d; +class Blend_Point; + +//! Deferred class for a function used to compute a blending +//! surface between two surfaces, using a guide line. +//! The vector used in Value, Values and Derivatives methods +//! has to be the vector of the parametric coordinates U1,V1, +//! U2,V2, of the extremities of a section on the first and +//! second surface. +class Blend_Function : public Blend_AppFunction +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns 4. + Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; + + //! Returns the point on the first support. + Standard_EXPORT const gp_Pnt& Pnt1() const Standard_OVERRIDE; + + //! Returns the point on the seconde support. + Standard_EXPORT const gp_Pnt& Pnt2() const Standard_OVERRIDE; + + //! Returns the point on the first surface, at parameter + //! Sol(1),Sol(2) (Sol is the vector used in the call of + //! IsSolution. + Standard_EXPORT virtual const gp_Pnt& PointOnS1() const = 0; + + //! Returns the point on the second surface, at parameter + //! Sol(3),Sol(4) (Sol is the vector used in the call of + //! IsSolution. + Standard_EXPORT virtual const gp_Pnt& PointOnS2() const = 0; + + //! Returns True when it is not possible to compute + //! the tangent vectors at PointOnS1 and/or PointOnS2. + Standard_EXPORT virtual Standard_Boolean IsTangencyPoint() const = 0; + + //! Returns the tangent vector at PointOnS1, in 3d space. + Standard_EXPORT virtual const gp_Vec& TangentOnS1() const = 0; + + //! Returns the tangent vector at PointOnS1, in the + //! parametric space of the first surface. + Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnS1() const = 0; + + //! Returns the tangent vector at PointOnS2, in 3d space. + Standard_EXPORT virtual const gp_Vec& TangentOnS2() const = 0; + + //! Returns the tangent vector at PointOnS2, in the + //! parametric space of the second surface. + Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnS2() const = 0; + + //! Returns the tangent vector at the section, + //! at the beginning and the end of the section, and + //! returns the normal (of the surfaces) at + //! these points. + Standard_EXPORT virtual void Tangent(const Standard_Real U1, + const Standard_Real V1, + const Standard_Real U2, + const Standard_Real V2, + gp_Vec& TgFirst, + gp_Vec& TgLast, + gp_Vec& NormFirst, + gp_Vec& NormLast) const = 0; + + Standard_EXPORT virtual Standard_Boolean TwistOnS1() const; + + Standard_EXPORT virtual Standard_Boolean TwistOnS2() const; + + Standard_EXPORT virtual void Section(const Blend_Point& P, + TColgp_Array1OfPnt& Poles, + TColgp_Array1OfPnt2d& Poles2d, + TColStd_Array1OfReal& Weigths) Standard_OVERRIDE = 0; + + //! Used for the first and last section + //! The method returns Standard_True if the derivatives + //! are computed, otherwise it returns Standard_False + Standard_EXPORT virtual Standard_Boolean Section(const Blend_Point& P, + TColgp_Array1OfPnt& Poles, + TColgp_Array1OfVec& DPoles, + TColgp_Array1OfVec& D2Poles, + TColgp_Array1OfPnt2d& Poles2d, + TColgp_Array1OfVec2d& DPoles2d, + TColgp_Array1OfVec2d& D2Poles2d, + TColStd_Array1OfReal& Weigths, + TColStd_Array1OfReal& DWeigths, + TColStd_Array1OfReal& D2Weigths) + Standard_OVERRIDE; + +protected: +private: +}; + +#endif // _Blend_Function_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Bnd_B3f.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Bnd_B3f.hxx new file mode 100644 index 0000000000000000000000000000000000000000..31bb0309f072b9d432e519c6a1256cecfae1ede5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Bnd_B3f.hxx @@ -0,0 +1,153 @@ +// Created on: 1991-01-08 +// Created by: Didier Piffault +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Bnd_B3f_HeaderFile +#define _Bnd_B3f_HeaderFile + +#include +#include + +class gp_XYZ; +class gp_Pnt; +class gp_Trsf; +class gp_Ax1; +class gp_Ax3; + +class Bnd_B3f +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor. + Bnd_B3f(); + + //! Constructor. + Bnd_B3f(const gp_XYZ& theCenter, const gp_XYZ& theHSize); + + //! Returns True if the box is void (non-initialized). + Standard_Boolean IsVoid() const; + + //! Reset the box data. + void Clear(); + + //! Update the box by a point. + Standard_EXPORT void Add(const gp_XYZ& thePnt); + + //! Update the box by a point. + void Add(const gp_Pnt& thePnt); + + //! Update the box by another box. + void Add(const Bnd_B3f& theBox); + + //! Query the lower corner: (Center - HSize). You must make sure that + //! the box is NOT VOID (see IsVoid()), otherwise the method returns + //! irrelevant result. + gp_XYZ CornerMin() const; + + //! Query the upper corner: (Center + HSize). You must make sure that + //! the box is NOT VOID (see IsVoid()), otherwise the method returns + //! irrelevant result. + gp_XYZ CornerMax() const; + + //! Query the square diagonal. If the box is VOID (see method IsVoid()) + //! then a very big real value is returned. + Standard_Real SquareExtent() const; + + //! Extend the Box by the absolute value of theDiff. + void Enlarge(const Standard_Real theDiff); + + //! Limit the Box by the internals of theOtherBox. + //! Returns True if the limitation takes place, otherwise False + //! indicating that the boxes do not intersect. + Standard_EXPORT Standard_Boolean Limit(const Bnd_B3f& theOtherBox); + + //! Transform the bounding box with the given transformation. + //! The resulting box will be larger if theTrsf contains rotation. + Standard_NODISCARD Standard_EXPORT Bnd_B3f Transformed(const gp_Trsf& theTrsf) const; + + //! Check the given point for the inclusion in the Box. + //! Returns True if the point is outside. + Standard_Boolean IsOut(const gp_XYZ& thePnt) const; + + //! Check a sphere for the intersection with the current box. + //! Returns True if there is no intersection between boxes. If the + //! parameter 'IsSphereHollow' is True, then the intersection is not + //! reported for a box that is completely inside the sphere (otherwise + //! this method would report an intersection). + Standard_EXPORT Standard_Boolean + IsOut(const gp_XYZ& theCenter, + const Standard_Real theRadius, + const Standard_Boolean isSphereHollow = Standard_False) const; + + //! Check the given box for the intersection with the current box. + //! Returns True if there is no intersection between boxes. + Standard_Boolean IsOut(const Bnd_B3f& theOtherBox) const; + + //! Check the given box oriented by the given transformation + //! for the intersection with the current box. + //! Returns True if there is no intersection between boxes. + Standard_EXPORT Standard_Boolean IsOut(const Bnd_B3f& theOtherBox, const gp_Trsf& theTrsf) const; + + //! Check the given Line for the intersection with the current box. + //! Returns True if there is no intersection. + //! isRay==True means intersection check with the positive half-line + //! theOverthickness is the addition to the size of the current box + //! (may be negative). If positive, it can be treated as the thickness + //! of the line 'theLine' or the radius of the cylinder along 'theLine' + Standard_EXPORT Standard_Boolean IsOut(const gp_Ax1& theLine, + const Standard_Boolean isRay = Standard_False, + const Standard_Real theOverthickness = 0.0) const; + + //! Check the given Plane for the intersection with the current box. + //! Returns True if there is no intersection. + Standard_EXPORT Standard_Boolean IsOut(const gp_Ax3& thePlane) const; + + //! Check that the box 'this' is inside the given box 'theBox'. Returns + //! True if 'this' box is fully inside 'theBox'. + Standard_Boolean IsIn(const Bnd_B3f& theBox) const; + + //! Check that the box 'this' is inside the given box 'theBox' + //! transformed by 'theTrsf'. Returns True if 'this' box is fully + //! inside the transformed 'theBox'. + Standard_EXPORT Standard_Boolean IsIn(const Bnd_B3f& theBox, const gp_Trsf& theTrsf) const; + + //! Set the Center coordinates + void SetCenter(const gp_XYZ& theCenter); + + //! Set the HSize (half-diagonal) coordinates. + //! All components of theHSize must be non-negative. + void SetHSize(const gp_XYZ& theHSize); + +protected: + Standard_ShortReal myCenter[3]; + Standard_ShortReal myHSize[3]; + +private: +}; + +#define RealType Standard_ShortReal +#define RealType_hxx +#define Bnd_B3x Bnd_B3f +#define Bnd_B3x_hxx + +#include + +#undef RealType +#undef RealType_hxx +#undef Bnd_B3x +#undef Bnd_B3x_hxx + +#endif // _Bnd_B3f_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/CDF_MetaDataDriver.hxx b/data/miniconda3/envs/catiagent/include/opencascade/CDF_MetaDataDriver.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7ec6fbc25cd53e6b39cd9f25f8bee28ba8626dab --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/CDF_MetaDataDriver.hxx @@ -0,0 +1,134 @@ +// Created on: 1997-11-17 +// Created by: Jean-Louis Frenkel +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _CDF_MetaDataDriver_HeaderFile +#define _CDF_MetaDataDriver_HeaderFile + +#include + +class CDM_MetaData; +class TCollection_ExtendedString; +class CDM_Document; +class PCDM_ReferenceIterator; +class Message_Messenger; + +class CDF_MetaDataDriver; +DEFINE_STANDARD_HANDLE(CDF_MetaDataDriver, Standard_Transient) + +//! this class list the method that must be available for +//! a specific DBMS +class CDF_MetaDataDriver : public Standard_Transient +{ + +public: + //! returns true if the MetaDataDriver can manage different + //! versions of a Data. + //! By default, returns Standard_False. + Standard_EXPORT virtual Standard_Boolean HasVersionCapability(); + + //! Creates a "Depends On" relation between two Datas. + //! By default does nothing + Standard_EXPORT virtual void CreateDependsOn(const Handle(CDM_MetaData)& aFirstData, + const Handle(CDM_MetaData)& aSecondData); + + Standard_EXPORT virtual void CreateReference(const Handle(CDM_MetaData)& aFrom, + const Handle(CDM_MetaData)& aTo, + const Standard_Integer aReferenceIdentifier, + const Standard_Integer aToDocumentVersion); + + //! by default return Standard_True. + Standard_EXPORT virtual Standard_Boolean HasVersion(const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName); + + Standard_EXPORT virtual TCollection_ExtendedString BuildFileName( + const Handle(CDM_Document)& aDocument) = 0; + + //! this method is useful if the name of an object -- + //! depends on the metadatadriver. For example a Driver + //! -- based on the operating system can choose to add + //! the extension of file to create to the object. + Standard_EXPORT virtual TCollection_ExtendedString SetName( + const Handle(CDM_Document)& aDocument, + const TCollection_ExtendedString& aName); + + //! should indicate whether meta-data exist in the DBMS corresponding + //! to the Data. + //! aVersion may be NULL; + Standard_EXPORT virtual Standard_Boolean Find(const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName, + const TCollection_ExtendedString& aVersion) = 0; + + Standard_EXPORT virtual Standard_Boolean HasReadPermission( + const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName, + const TCollection_ExtendedString& aVersion) = 0; + + //! should return the MetaData stored in the DBMS with the meta-data + //! corresponding to the Data. If the MetaDataDriver has version management capabilities + //! the version has to be set in the returned MetaData. + //! aVersion may be NULL + //! MetaData is called by GetMetaData + //! If the version is set to NULL, MetaData should return + //! the last version of the metadata + Standard_EXPORT virtual Handle(CDM_MetaData) MetaData( + const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName, + const TCollection_ExtendedString& aVersion) = 0; + + //! by default returns aMetaDATA + //! should return the MetaData stored in the DBMS with the meta-data + //! corresponding to the path. If the MetaDataDriver has version management capabilities + //! the version has to be set in the returned MetaData. + //! MetaData is called by GetMetaData + //! If the version is not included in the path , MetaData should return + //! the last version of the metadata + //! is deferred; + Standard_EXPORT virtual Handle(CDM_MetaData) LastVersion(const Handle(CDM_MetaData)& aMetaData); + + //! should create meta-data corresponding to aData and maintaining a meta-link + //! between these meta-data and aFileName + //! CreateMetaData is called by CreateData + //! If the metadata-driver + //! has version capabilities, version must be set in the returned Data. + Standard_EXPORT virtual Handle(CDM_MetaData) CreateMetaData( + const Handle(CDM_Document)& aDocument, + const TCollection_ExtendedString& aFileName) = 0; + + Standard_EXPORT virtual Standard_Boolean FindFolder( + const TCollection_ExtendedString& aFolder) = 0; + + Standard_EXPORT virtual TCollection_ExtendedString DefaultFolder() = 0; + + Standard_EXPORT virtual Handle(PCDM_ReferenceIterator) ReferenceIterator( + const Handle(Message_Messenger)& theMessageDriver); + + //! calls Find with an empty version + Standard_EXPORT Standard_Boolean Find(const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName); + + //! calls MetaData with an empty version + Standard_EXPORT Handle(CDM_MetaData) MetaData(const TCollection_ExtendedString& aFolder, + const TCollection_ExtendedString& aName); + + DEFINE_STANDARD_RTTIEXT(CDF_MetaDataDriver, Standard_Transient) + +protected: + Standard_EXPORT CDF_MetaDataDriver(); + +private: +}; + +#endif // _CDF_MetaDataDriver_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ChFi3d_SearchSing.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ChFi3d_SearchSing.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ae55f75f1f5107d0895c8eeedb9350531d6acf3c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ChFi3d_SearchSing.hxx @@ -0,0 +1,64 @@ +// Created on: 1997-03-28 +// Created by: Philippe MANGIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ChFi3d_SearchSing_HeaderFile +#define _ChFi3d_SearchSing_HeaderFile + +#include +#include +#include + +#include +#include +#include +class Geom_Curve; + +//! Searches singularities on fillet. +//! F(t) = (C1(t) - C2(t)).(C1'(t) - C2'(t)); +class ChFi3d_SearchSing : public math_FunctionWithDerivative +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT ChFi3d_SearchSing(const Handle(Geom_Curve)& C1, const Handle(Geom_Curve)& C2); + + //! computes the value of the function for the + //! variable . + //! returns True if the computation was done successfully, + //! False otherwise. + Standard_EXPORT Standard_Boolean Value(const Standard_Real X, Standard_Real& F); + + //! computes the derivative of the function + //! for the variable . + //! Returns True if the calculation were successfully done, + //! False otherwise. + Standard_EXPORT Standard_Boolean Derivative(const Standard_Real X, Standard_Real& D); + + //! computes the value and the derivative of the + //! function for the variable . + //! Returns True if the calculation were successfully done, + //! False otherwise. + Standard_EXPORT Standard_Boolean Values(const Standard_Real X, + Standard_Real& F, + Standard_Real& D); + +protected: +private: + Handle(Geom_Curve) myC1; + Handle(Geom_Curve) myC2; +}; + +#endif // _ChFi3d_SearchSing_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ChFiDS_CommonPoint.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ChFiDS_CommonPoint.hxx new file mode 100644 index 0000000000000000000000000000000000000000..74ad438c574cc0d41fe444cca39c325c06af955c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ChFiDS_CommonPoint.hxx @@ -0,0 +1,153 @@ +// Created on: 1993-11-29 +// Created by: Isabelle GRIGNON +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ChFiDS_CommonPoint_HeaderFile +#define _ChFiDS_CommonPoint_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//! point start/end of fillet common to 2 adjacent filets +//! and to an edge on one of 2 faces participating +//! in the construction of the fillet +class ChFiDS_CommonPoint +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor. + Standard_EXPORT ChFiDS_CommonPoint(); + + //! default value for all fields + Standard_EXPORT void Reset(); + + //! Sets the values of a point which is a vertex on + //! the initial facet of restriction of one + //! of the surface. + void SetVertex(const TopoDS_Vertex& theVertex) + { + isvtx = Standard_True; + vtx = theVertex; + } + + //! Sets the values of a point which is on the arc + //! A, at parameter Param. + Standard_EXPORT void SetArc(const Standard_Real Tol, + const TopoDS_Edge& A, + const Standard_Real Param, + const TopAbs_Orientation TArc); + + //! Sets the value of the parameter on the spine + Standard_EXPORT void SetParameter(const Standard_Real Param); + + //! Set the 3d point for a commonpoint that is not + //! a vertex or on an arc. + void SetPoint(const gp_Pnt& thePoint) { point = thePoint; } + + //! Set the output 3d vector + void SetVector(const gp_Vec& theVector) + { + hasvector = Standard_True; + vector = theVector; + } + + //! This method set the fuzziness on the point. + void SetTolerance(const Standard_Real Tol) + { + if (Tol > tol) + { + tol = Tol; + } + } + + //! This method returns the fuzziness on the point. + Standard_Real Tolerance() const { return tol; } + + //! Returns TRUE if the point is a vertex on the initial + //! restriction facet of the surface. + Standard_Boolean IsVertex() const { return isvtx; } + + //! Returns the information about the point when it is + //! on the domain of the first patch, i-e when the function + //! IsVertex returns True. + //! Otherwise, an exception is raised. + const TopoDS_Vertex& Vertex() const + { + if (!isvtx) + { + throw Standard_DomainError(); + } + return vtx; + } + + //! Returns TRUE if the point is a on an edge of the initial + //! restriction facet of the surface. + Standard_Boolean IsOnArc() const { return isonarc; } + + //! Returns the arc of restriction containing the + //! vertex. + Standard_EXPORT const TopoDS_Edge& Arc() const; + + //! Returns the transition of the point on the arc + //! returned by Arc(). + Standard_EXPORT TopAbs_Orientation TransitionOnArc() const; + + //! Returns the parameter of the point on the + //! arc returned by the method Arc(). + Standard_EXPORT Standard_Real ParameterOnArc() const; + + //! Returns the parameter on the spine + Standard_EXPORT Standard_Real Parameter() const; + + //! Returns the 3d point + const gp_Pnt& Point() const { return point; } + + //! Returns TRUE if the output vector is stored. + Standard_Boolean HasVector() const { return hasvector; } + + //! Returns the output 3d vector + const gp_Vec& Vector() const + { + if (!hasvector) + { + throw Standard_DomainError("ChFiDS_CommonPoint::Vector"); + } + return vector; + } + +private: + TopoDS_Edge arc; + TopoDS_Vertex vtx; + gp_Pnt point; + gp_Vec vector; + Standard_Real tol; + Standard_Real prmarc; + Standard_Real prmtg; + TopAbs_Orientation traarc; + Standard_Boolean isonarc; + Standard_Boolean isvtx; + Standard_Boolean hasvector; +}; + +#endif // _ChFiDS_CommonPoint_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Contap_HCurve2dTool.lxx b/data/miniconda3/envs/catiagent/include/opencascade/Contap_HCurve2dTool.lxx new file mode 100644 index 0000000000000000000000000000000000000000..d1969176c72005ce963e435bd96b33a63d27d131 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Contap_HCurve2dTool.lxx @@ -0,0 +1,196 @@ +// Created on: 1992-10-22 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +//============================================================ +inline Standard_Real Contap_HCurve2dTool::FirstParameter(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->FirstParameter()); +} + +//============================================================ +inline Standard_Real Contap_HCurve2dTool::LastParameter(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->LastParameter()); +} + +//============================================================ +inline GeomAbs_Shape Contap_HCurve2dTool::Continuity(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Continuity()); +} + +//============================================================ +inline Standard_Integer Contap_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_Curve2d)& C, + const GeomAbs_Shape Sh) +{ + return (C->NbIntervals(Sh)); +} + +//============================================================ +inline void Contap_HCurve2dTool::Intervals(const Handle(Adaptor2d_Curve2d)& C, + TColStd_Array1OfReal& Tab, + const GeomAbs_Shape Sh) +{ + C->Intervals(Tab, Sh); +} + +//============================================================ +inline Standard_Boolean Contap_HCurve2dTool::IsClosed(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->IsClosed()); +} + +//============================================================ +inline Standard_Boolean Contap_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->IsPeriodic()); +} + +//============================================================ +inline Standard_Real Contap_HCurve2dTool::Period(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Period()); +} + +//============================================================ +inline gp_Pnt2d Contap_HCurve2dTool::Value(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U) +{ + return (C->Value(U)); +} + +//============================================================ +inline void Contap_HCurve2dTool::D0(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P) +{ + C->D0(U, P); +} + +//============================================================ +inline void Contap_HCurve2dTool::D1(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& T) +{ + C->D1(U, P, T); +} + +//============================================================ +inline void Contap_HCurve2dTool::D2(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& T, + gp_Vec2d& N) +{ + + C->D2(U, P, T, N); +} + +//============================================================ +inline void Contap_HCurve2dTool::D3(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) +{ + + C->D3(U, P, V1, V2, V3); +} + +//============================================================ +inline gp_Vec2d Contap_HCurve2dTool::DN(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + const Standard_Integer N) +{ + + return (C->DN(U, N)); +} + +//============================================================ +inline Standard_Real Contap_HCurve2dTool::Resolution(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real R3d) +{ + return (C->Resolution(R3d)); +} + +//============================================================ +inline GeomAbs_CurveType Contap_HCurve2dTool::GetType(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->GetType()); +} + +//============================================================ +inline gp_Lin2d Contap_HCurve2dTool::Line(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Line()); +} + +//============================================================ +inline gp_Circ2d Contap_HCurve2dTool::Circle(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Circle()); +} + +//============================================================ +inline gp_Elips2d Contap_HCurve2dTool::Ellipse(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Ellipse()); +} + +//============================================================ +inline gp_Parab2d Contap_HCurve2dTool::Parabola(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Parabola()); +} + +//============================================================ +inline gp_Hypr2d Contap_HCurve2dTool::Hyperbola(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Hyperbola()); +} + +//============================================================ +inline Handle(Geom2d_BezierCurve) Contap_HCurve2dTool::Bezier(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Bezier()); +} + +//============================================================ +inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dTool::BSpline(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->BSpline()); +} + +//============================================================ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Convert_CompBezierCurves2dToBSplineCurve2d.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Convert_CompBezierCurves2dToBSplineCurve2d.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ea725ac276db92d1751ccd90ca425f00d8bae39a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Convert_CompBezierCurves2dToBSplineCurve2d.hxx @@ -0,0 +1,180 @@ +// Created on: 1993-11-09 +// Created by: Modelistation +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Convert_CompBezierCurves2dToBSplineCurve2d_HeaderFile +#define _Convert_CompBezierCurves2dToBSplineCurve2d_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//! Converts a list of connecting Bezier Curves 2d to a +//! BSplineCurve 2d. +//! if possible, the continuity of the BSpline will be +//! increased to more than C0. +class Convert_CompBezierCurves2dToBSplineCurve2d +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs a framework for converting a sequence of + //! adjacent non-rational Bezier curves into a BSpline curve. + //! Knots will be created on the computed BSpline curve at + //! each junction point of two consecutive Bezier curves. The + //! degree of continuity of the BSpline curve will be increased at + //! the junction point of two consecutive Bezier curves if their + //! tangent vectors at this point are parallel. AngularTolerance + //! (given in radians, and defaulted to 1.0 e-4) will be used + //! to check the parallelism of the two tangent vectors. + //! Use the following functions: + //! - AddCurve to define in sequence the adjacent Bezier + //! curves to be converted, + //! - Perform to compute the data needed to build the BSpline curve, + //! - and the available consultation functions to access the + //! computed data. This data may be used to construct the BSpline curve. + Standard_EXPORT Convert_CompBezierCurves2dToBSplineCurve2d( + const Standard_Real AngularTolerance = 1.0e-4); + + //! Adds the Bezier curve defined by the table of poles Poles, to + //! the sequence (still contained in this framework) of adjacent + //! Bezier curves to be converted into a BSpline curve. + //! Only polynomial (i.e. non-rational) Bezier curves are + //! converted using this framework. + //! If this is not the first call to the function (i.e. if this framework + //! still contains data in its sequence of Bezier curves), the + //! degree of continuity of the BSpline curve will be increased at + //! the time of computation at the first point of the added Bezier + //! curve (i.e. the first point of the Poles table). This will be the + //! case if the tangent vector of the curve at this point is + //! parallel to the tangent vector at the end point of the + //! preceding Bezier curve in the sequence of Bezier curves still + //! contained in this framework. An angular tolerance given at + //! the time of construction of this framework, will be used to + //! check the parallelism of the two tangent vectors. This + //! checking procedure, and all the relative computations will be + //! performed by the function Perform. + //! When the sequence of adjacent Bezier curves is complete, + //! use the following functions: + //! - Perform to compute the data needed to build the BSpline curve, + //! - and the available consultation functions to access the + //! computed data. This data may be used to construct the BSpline curve. + //! Warning + //! The sequence of Bezier curves treated by this framework is + //! automatically initialized with the first Bezier curve when the + //! function is first called. During subsequent use of this function, + //! ensure that the first point of the added Bezier curve (i.e. the + //! first point of the Poles table) is coincident with the last point + //! of the sequence (i.e. the last point of the preceding Bezier + //! curve in the sequence) of Bezier curves still contained in + //! this framework. An error may occur at the time of + //! computation if this condition is not satisfied. Particular care + //! must be taken with respect to the above, as this condition is + //! not checked either when defining the sequence of Bezier + //! curves or at the time of computation. + Standard_EXPORT void AddCurve(const TColgp_Array1OfPnt2d& Poles); + + //! Computes all the data needed to build a BSpline curve + //! equivalent to the sequence of adjacent Bezier curves still + //! contained in this framework. + //! A knot is inserted on the computed BSpline curve at the + //! junction point of two consecutive Bezier curves. The + //! degree of continuity of the BSpline curve will be increased + //! at the junction point of two consecutive Bezier curves if + //! their tangent vectors at this point are parallel. An angular + //! tolerance given at the time of construction of this + //! framework is used to check the parallelism of the two + //! tangent vectors. + //! Use the available consultation functions to access the + //! computed data. This data may then be used to construct + //! the BSpline curve. + //! Warning + //! Ensure that the curves in the sequence of Bezier curves + //! contained in this framework are adjacent. An error may + //! occur at the time of computation if this condition is not + //! satisfied. Particular care must be taken with respect to the + //! above as this condition is not checked, either when + //! defining the Bezier curve sequence or at the time of computation. + Standard_EXPORT void Perform(); + + //! Returns the degree of the BSpline curve whose data is + //! computed in this framework. + //! Warning + //! Take particular care not to use this function before the + //! computation is performed (Perform function), as this + //! condition is not checked and an error may therefore occur. + Standard_EXPORT Standard_Integer Degree() const; + + //! Returns the number of poles of the BSpline curve whose + //! data is computed in this framework. + //! Warning + //! Take particular care not to use this function before the + //! computation is performed (Perform function), as this + //! condition is not checked and an error may therefore occur. + Standard_EXPORT Standard_Integer NbPoles() const; + + //! Loads the Poles table with the poles of the BSpline curve + //! whose data is computed in this framework. + //! Warning + //! - Do not use this function before the computation is + //! performed (Perform function). + //! - The length of the Poles array must be equal to the + //! number of poles of the BSpline curve whose data is + //! computed in this framework. + //! Particular care must be taken with respect to the above, as + //! these conditions are not checked, and an error may occur. + Standard_EXPORT void Poles(TColgp_Array1OfPnt2d& Poles) const; + + //! Returns the number of knots of the BSpline curve whose + //! data is computed in this framework. + //! Warning + //! Take particular care not to use this function before the + //! computation is performed (Perform function), as this + //! condition is not checked and an error may therefore occur. + Standard_EXPORT Standard_Integer NbKnots() const; + + //! Loads the Knots table with the knots + //! and the Mults table with the corresponding multiplicities + //! of the BSpline curve whose data is computed in this framework. + //! Warning + //! - Do not use this function before the computation is + //! performed (Perform function). + //! - The length of the Knots and Mults arrays must be equal + //! to the number of knots in the BSpline curve whose data is + //! computed in this framework. + //! Particular care must be taken with respect to the above as + //! these conditions are not checked, and an error may occur. + Standard_EXPORT void KnotsAndMults(TColStd_Array1OfReal& Knots, + TColStd_Array1OfInteger& Mults) const; + +protected: +private: + Convert_SequenceOfArray1OfPoles2d mySequence; + TColgp_SequenceOfPnt2d CurvePoles; + TColStd_SequenceOfReal CurveKnots; + TColStd_SequenceOfInteger KnotsMultiplicities; + Standard_Integer myDegree; + Standard_Real myAngular; + Standard_Boolean myDone; +}; + +#endif // _Convert_CompBezierCurves2dToBSplineCurve2d_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Convert_EllipseToBSplineCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Convert_EllipseToBSplineCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..67e54f05e792d54438f645c1d7901f48853c5cbc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Convert_EllipseToBSplineCurve.hxx @@ -0,0 +1,64 @@ +// Created on: 1991-10-10 +// Created by: Jean Claude VAUTHIER +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Convert_EllipseToBSplineCurve_HeaderFile +#define _Convert_EllipseToBSplineCurve_HeaderFile + +#include +#include +#include + +#include +#include +class gp_Elips2d; + +//! This algorithm converts a ellipse into a rational B-spline curve. +//! The ellipse is represented an Elips2d from package gp with +//! the parametrization : +//! P (U) = +//! Loc + (MajorRadius * Cos(U) * Xdir + MinorRadius * Sin(U) * Ydir) +//! where Loc is the center of the ellipse, Xdir and Ydir are the +//! normalized directions of the local cartesian coordinate system of +//! the ellipse. The parametrization range is U [0, 2PI]. +//! KeyWords : +//! Convert, Ellipse, BSplineCurve, 2D . +class Convert_EllipseToBSplineCurve : public Convert_ConicToBSplineCurve +{ +public: + DEFINE_STANDARD_ALLOC + + //! The equivalent B-spline curve has the same orientation + //! as the ellipse E. + Standard_EXPORT Convert_EllipseToBSplineCurve( + const gp_Elips2d& E, + const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2); + + //! The ellipse E is limited between the parametric values U1, U2. + //! The equivalent B-spline curve is oriented from U1 to U2 and has + //! the same orientation as E. + //! + //! Raised if U1 = U2 or U1 = U2 + 2.0 * Pi + Standard_EXPORT Convert_EllipseToBSplineCurve( + const gp_Elips2d& E, + const Standard_Real U1, + const Standard_Real U2, + const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2); + +protected: +private: +}; + +#endif // _Convert_EllipseToBSplineCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/DEOBJ_ConfigurationNode.hxx b/data/miniconda3/envs/catiagent/include/opencascade/DEOBJ_ConfigurationNode.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2a950a2700037c1a9aae5da335faf60c5597773c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/DEOBJ_ConfigurationNode.hxx @@ -0,0 +1,102 @@ +// Copyright (c) 2022 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _DEOBJ_ConfigurationNode_HeaderFile +#define _DEOBJ_ConfigurationNode_HeaderFile + +#include +#include + +//! The purpose of this class is to configure the transfer process for OBJ format +//! Stores the necessary settings for DEOBJ_Provider. +//! Configures and creates special provider to transfer OBJ files. +//! +//! Nodes grouped by Vendor name and Format type. +//! The Vendor name is "OCC" +//! The Format type is "OBJ" +//! The supported CAD extension is ".obj" +//! The import process is supported. +//! The export process is supported. +class DEOBJ_ConfigurationNode : public DE_ConfigurationNode +{ + DEFINE_STANDARD_RTTIEXT(DEOBJ_ConfigurationNode, DE_ConfigurationNode) +public: + //! Initializes all field by default + Standard_EXPORT DEOBJ_ConfigurationNode(); + + //! Copies values of all fields + //! @param[in] theNode object to copy + Standard_EXPORT DEOBJ_ConfigurationNode(const Handle(DEOBJ_ConfigurationNode)& theNode); + + //! Updates values according the resource + //! @param[in] theResource input resource to use + //! @return true if theResource loading has ended correctly + Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) + Standard_OVERRIDE; + + //! Writes configuration to the string + //! @return result resource string + Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE; + + //! Copies values of all fields + //! @return new object with the same field values + Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const Standard_OVERRIDE; + + //! Creates new provider for the own format + //! @return new created provider + Standard_EXPORT virtual Handle(DE_Provider) BuildProvider() Standard_OVERRIDE; + +public: + //! Checks the import supporting + //! @return true if import is supported + Standard_EXPORT virtual bool IsImportSupported() const Standard_OVERRIDE; + + //! Checks the export supporting + //! @return true if export is supported + Standard_EXPORT virtual bool IsExportSupported() const Standard_OVERRIDE; + + //! Gets CAD format name of associated provider + //! @return provider CAD format + Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE; + + //! Gets provider's vendor name of associated provider + //! @return provider's vendor name + Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE; + + //! Gets list of supported file extensions + //! @return list of extensions + Standard_EXPORT virtual TColStd_ListOfAsciiString GetExtensions() const Standard_OVERRIDE; + +public: + struct RWObj_InternalSection + { + // Common + // clang-format off + double FileLengthUnit = 1.; //!< File length units to convert from while reading the file, defined as scale factor for m (meters) + RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read + RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read + // Reading + bool ReadSinglePrecision = false; //!< Flag for reading vertex data with single or double floating point precision + bool ReadCreateShapes = false; //!< Flag for create a single triangulation + TCollection_AsciiString ReadRootPrefix; //!< Root folder for generating root labels names + bool ReadFillDoc = true; //!< Flag for fill document from shape sequence + bool ReadFillIncomplete = true; //!< Flag for fill the document with partially retrieved data even if reader has failed with error + // clang-format on + int ReadMemoryLimitMiB = -1; //!< Memory usage limit + // Writing + TCollection_AsciiString WriteComment; //!< Export special comment + TCollection_AsciiString WriteAuthor; //!< Author of exported file name + } InternalParameters; +}; + +#endif // _DEOBJ_ConfigurationNode_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/DEVRML_Provider.hxx b/data/miniconda3/envs/catiagent/include/opencascade/DEVRML_Provider.hxx new file mode 100644 index 0000000000000000000000000000000000000000..df250af8f1d041bfaef39856ccfab96b018edd8f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/DEVRML_Provider.hxx @@ -0,0 +1,141 @@ +// Copyright (c) 2022 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _DEVRML_Provider_HeaderFile +#define _DEVRML_Provider_HeaderFile + +#include + +//! The class to transfer VRML files. +//! Reads and Writes any VRML files into/from OCCT. +//! Each operation needs configuration node. +//! +//! Providers grouped by Vendor name and Format type. +//! The Vendor name is "OCC" +//! The Format type is "VRML" +//! The import process is supported. +//! The export process is supported. +class DEVRML_Provider : public DE_Provider +{ +public: + DEFINE_STANDARD_RTTIEXT(DEVRML_Provider, DE_Provider) + +public: + //! Default constructor + //! Configure translation process with global configuration + Standard_EXPORT DEVRML_Provider(); + + //! Configure translation process + //! @param[in] theNode object to copy + Standard_EXPORT DEVRML_Provider(const Handle(DE_ConfigurationNode)& theNode); + +public: + //! Reads a CAD file, according internal configuration + //! @param[in] thePath path to the import CAD file + //! @param[out] theDocument document to save result + //! @param[in] theWS current work session + //! @param[in] theProgress progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read( + const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Writes a CAD file, according internal configuration + //! @param[in] thePath path to the export CAD file + //! @param[out] theDocument document to export + //! @param[in] theWS current work session + //! @param[in] theProgress progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write( + const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Reads a CAD file, according internal configuration + //! @param[in] thePath path to the import CAD file + //! @param[out] theDocument document to save result + //! @param[in] theProgress progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read( + const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Writes a CAD file, according internal configuration + //! @param[in] thePath path to the export CAD file + //! @param[out] theDocument document to export + //! @param[in] theProgress progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write( + const TCollection_AsciiString& thePath, + const Handle(TDocStd_Document)& theDocument, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Reads a CAD file, according internal configuration + //! @param[in] thePath path to the import CAD file + //! @param[out] theShape shape to save result + //! @param[in] theWS current work session + //! @param[in] theProgress progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read( + const TCollection_AsciiString& thePath, + TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Writes a CAD file, according internal configuration + //! @param[in] thePath path to the export CAD file + //! @param[out] theShape shape to export + //! @param[in] theWS current work session + //! @param[in] theProgress progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write( + const TCollection_AsciiString& thePath, + const TopoDS_Shape& theShape, + Handle(XSControl_WorkSession)& theWS, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Reads a CAD file, according internal configuration + //! @param[in] thePath path to the import CAD file + //! @param[out] theShape shape to save result + //! @param[in] theProgress progress indicator + //! @return true if Read operation has ended correctly + Standard_EXPORT virtual bool Read( + const TCollection_AsciiString& thePath, + TopoDS_Shape& theShape, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + + //! Writes a CAD file, according internal configuration + //! @param[in] thePath path to the export CAD file + //! @param[out] theShape shape to export + //! @param[in] theProgress progress indicator + //! @return true if Write operation has ended correctly + Standard_EXPORT virtual bool Write( + const TCollection_AsciiString& thePath, + const TopoDS_Shape& theShape, + const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; + +public: + //! Gets CAD format name of associated provider + //! @return provider CAD format + Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE; + + //! Gets provider's vendor name of associated provider + //! @return provider's vendor name + Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE; +}; + +#endif // _DEVRML_Provider_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Draft_IndexedDataMapOfEdgeEdgeInfo.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Draft_IndexedDataMapOfEdgeEdgeInfo.hxx new file mode 100644 index 0000000000000000000000000000000000000000..885cb86aa81b6ef06f223c4567060fc1d3bae403 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Draft_IndexedDataMapOfEdgeEdgeInfo.hxx @@ -0,0 +1,28 @@ +// Created on: 1994-08-31 +// Created by: Jacques GOUSSARD +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Draft_IndexedDataMapOfEdgeEdgeInfo_HeaderFile +#define Draft_IndexedDataMapOfEdgeEdgeInfo_HeaderFile + +#include +#include +#include +#include + +typedef NCollection_IndexedDataMap + Draft_IndexedDataMapOfEdgeEdgeInfo; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Expr_Difference.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Expr_Difference.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9979e59e9d2fc880c6b5a3c769ec1c7a283db54b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Expr_Difference.hxx @@ -0,0 +1,82 @@ +// Created on: 1991-01-14 +// Created by: Arnaud BOUZY +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Expr_Difference_HeaderFile +#define _Expr_Difference_HeaderFile + +#include + +#include +#include +#include +#include +class Expr_GeneralExpression; +class Expr_NamedUnknown; +class TCollection_AsciiString; + +class Expr_Difference; +DEFINE_STANDARD_HANDLE(Expr_Difference, Expr_BinaryExpression) + +class Expr_Difference : public Expr_BinaryExpression +{ + +public: + //! Creates the difference - . + Standard_EXPORT Expr_Difference(const Handle(Expr_GeneralExpression)& exp1, + const Handle(Expr_GeneralExpression)& exp2); + + //! Returns a GeneralExpression after a simplification + //! of the arguments of . + Standard_EXPORT Handle(Expr_GeneralExpression) ShallowSimplified() const Standard_OVERRIDE; + + //! Returns a copy of having the same unknowns and functions. + Standard_EXPORT Handle(Expr_GeneralExpression) Copy() const Standard_OVERRIDE; + + //! Tests if and define the same expression. + //! This method does not include any simplification before + //! testing. + Standard_EXPORT Standard_Boolean + IsIdentical(const Handle(Expr_GeneralExpression)& Other) const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsLinear() const Standard_OVERRIDE; + + //! Returns the derivative on unknown of + Standard_EXPORT Handle(Expr_GeneralExpression) Derivative( + const Handle(Expr_NamedUnknown)& X) const Standard_OVERRIDE; + + //! Returns the -th derivative on unknown of . + //! Raises OutOfRange if <= 0 + Standard_EXPORT virtual Handle(Expr_GeneralExpression) NDerivative( + const Handle(Expr_NamedUnknown)& X, + const Standard_Integer N) const Standard_OVERRIDE; + + //! Returns the value of (as a Real) by + //! replacement of by . + //! Raises NotEvaluable if contains NamedUnknown not + //! in or NumericError if result cannot be computed. + Standard_EXPORT Standard_Real Evaluate(const Expr_Array1OfNamedUnknown& vars, + const TColStd_Array1OfReal& vals) const Standard_OVERRIDE; + + //! returns a string representing in a readable way. + Standard_EXPORT TCollection_AsciiString String() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Expr_Difference, Expr_BinaryExpression) + +protected: +private: +}; + +#endif // _Expr_Difference_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Expr_ExprFailure.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Expr_ExprFailure.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d63e5ff9731bd309092a4bb71f70084bea0ff271 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Expr_ExprFailure.hxx @@ -0,0 +1,38 @@ +// Created on: 1991-01-14 +// Created by: Arnaud BOUZY +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Expr_ExprFailure_HeaderFile +#define _Expr_ExprFailure_HeaderFile + +#include +#include +#include +#include + +class Expr_ExprFailure; +DEFINE_STANDARD_HANDLE(Expr_ExprFailure, Standard_Failure) + +#if !defined No_Exception && !defined No_Expr_ExprFailure + #define Expr_ExprFailure_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw Expr_ExprFailure(MESSAGE); +#else + #define Expr_ExprFailure_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(Expr_ExprFailure, Standard_Failure) + +#endif // _Expr_ExprFailure_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Expr_PolyExpression.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Expr_PolyExpression.hxx new file mode 100644 index 0000000000000000000000000000000000000000..68db8b0689e126a01a488b8c3553dc3a99f4a99c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Expr_PolyExpression.hxx @@ -0,0 +1,96 @@ +// Created on: 1991-01-10 +// Created by: Arnaud BOUZY +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Expr_PolyExpression_HeaderFile +#define _Expr_PolyExpression_HeaderFile + +#include +#include + +#include +#include +#include +class Expr_NamedUnknown; + +class Expr_PolyExpression; +DEFINE_STANDARD_HANDLE(Expr_PolyExpression, Expr_GeneralExpression) + +class Expr_PolyExpression : public Expr_GeneralExpression +{ + +public: + //! returns the number of operands contained in + Standard_EXPORT Standard_Integer NbOperands() const; + + //! Returns the -th operand used in . + //! An exception is raised if index is out of range + const Handle(Expr_GeneralExpression)& Operand(const Standard_Integer index) const; + + //! Sets the -th operand used in . + //! An exception is raised if is out of range + //! Raises InvalidOperand if contains . + Standard_EXPORT void SetOperand(const Handle(Expr_GeneralExpression)& exp, + const Standard_Integer index); + + //! returns the number of sub-expressions contained + //! in ( >= 2) + Standard_EXPORT Standard_Integer NbSubExpressions() const Standard_OVERRIDE; + + //! Returns the sub-expression denoted by in + //! Raises OutOfRange if > NbSubExpressions(me) + Standard_EXPORT const Handle(Expr_GeneralExpression)& SubExpression( + const Standard_Integer I) const Standard_OVERRIDE; + + //! Does contains NamedUnknown ? + Standard_EXPORT Standard_Boolean ContainsUnknowns() const Standard_OVERRIDE; + + //! Tests if is contained in . + Standard_EXPORT Standard_Boolean + Contains(const Handle(Expr_GeneralExpression)& exp) const Standard_OVERRIDE; + + //! Replaces all occurrences of with in + //! Raises InvalidOperand if contains . + Standard_EXPORT void Replace(const Handle(Expr_NamedUnknown)& var, + const Handle(Expr_GeneralExpression)& with) Standard_OVERRIDE; + + //! Returns a GeneralExpression after replacement of + //! NamedUnknowns by an associated expression and after + //! values computation. + Standard_EXPORT Handle(Expr_GeneralExpression) Simplified() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Expr_PolyExpression, Expr_GeneralExpression) + +protected: + //! initialize an empty list of operands. + Standard_EXPORT Expr_PolyExpression(); + + //! Adds an operand to the list of . + Standard_EXPORT void AddOperand(const Handle(Expr_GeneralExpression)& exp); + + //! Remove the operand denoted by from the list of + //! . + //! Raises exception if is out of range or if + //! removing operand intend to leave only one or no + //! operand. + Standard_EXPORT void RemoveOperand(const Standard_Integer index); + +private: + Expr_SequenceOfGeneralExpression myOperands; +}; + +#include + +#endif // _Expr_PolyExpression_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Expr_RelationIterator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Expr_RelationIterator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..256b837dc6092e4a13d272883ba0086357a0c8f7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Expr_RelationIterator.hxx @@ -0,0 +1,54 @@ +// Created on: 1991-01-14 +// Created by: Arnaud BOUZY +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Expr_RelationIterator_HeaderFile +#define _Expr_RelationIterator_HeaderFile + +#include +#include +#include + +#include +#include +#include +class Expr_GeneralRelation; +class Expr_SingleRelation; + +//! Iterates on every basic relation contained in +//! a GeneralRelation. +class Expr_RelationIterator +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Expr_RelationIterator(const Handle(Expr_GeneralRelation)& rel); + + //! Returns False if no other relation remains. + Standard_EXPORT Standard_Boolean More() const; + + Standard_EXPORT void Next(); + + //! Returns current basic relation. + //! Exception is raised if no more relation remains. + Standard_EXPORT Handle(Expr_SingleRelation) Value() const; + +protected: +private: + Expr_Array1OfSingleRelation myRelation; + Standard_Integer current; +}; + +#endif // _Expr_RelationIterator_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Expr_UnaryFunction.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Expr_UnaryFunction.hxx new file mode 100644 index 0000000000000000000000000000000000000000..94b2695f80fa555366196d32894a24c1948a3227 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Expr_UnaryFunction.hxx @@ -0,0 +1,84 @@ +// Created on: 1991-01-14 +// Created by: Arnaud BOUZY +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Expr_UnaryFunction_HeaderFile +#define _Expr_UnaryFunction_HeaderFile + +#include +#include + +#include +#include +#include +class Expr_GeneralFunction; +class Expr_GeneralExpression; +class Expr_NamedUnknown; +class TCollection_AsciiString; + +class Expr_UnaryFunction; +DEFINE_STANDARD_HANDLE(Expr_UnaryFunction, Expr_UnaryExpression) + +//! Defines the use of an unary function in an expression +//! with a given argument. +class Expr_UnaryFunction : public Expr_UnaryExpression +{ + +public: + //! Creates me as (). + //! Raises exception if is not unary. + Standard_EXPORT Expr_UnaryFunction(const Handle(Expr_GeneralFunction)& func, + const Handle(Expr_GeneralExpression)& exp); + + //! Returns the function defining . + Standard_EXPORT Handle(Expr_GeneralFunction) Function() const; + + //! Returns a GeneralExpression after a simplification + //! of the arguments of . + Standard_EXPORT Handle(Expr_GeneralExpression) ShallowSimplified() const Standard_OVERRIDE; + + //! Returns a copy of having the same unknowns and functions. + Standard_EXPORT Handle(Expr_GeneralExpression) Copy() const Standard_OVERRIDE; + + //! Tests if and define the same expression. + //! This method does not include any simplification before + //! testing. + Standard_EXPORT Standard_Boolean + IsIdentical(const Handle(Expr_GeneralExpression)& Other) const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsLinear() const Standard_OVERRIDE; + + //! returns the derivative on unknown of . + Standard_EXPORT Handle(Expr_GeneralExpression) Derivative( + const Handle(Expr_NamedUnknown)& X) const Standard_OVERRIDE; + + //! Returns the value of (as a Real) by + //! replacement of by . + //! Raises NotEvaluable if contains NamedUnknown not + //! in or NumericError if result cannot be computed. + Standard_EXPORT Standard_Real Evaluate(const Expr_Array1OfNamedUnknown& vars, + const TColStd_Array1OfReal& vals) const Standard_OVERRIDE; + + //! returns a string representing in a readable way. + Standard_EXPORT TCollection_AsciiString String() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Expr_UnaryFunction, Expr_UnaryExpression) + +protected: +private: + Handle(Expr_GeneralFunction) myFunction; +}; + +#endif // _Expr_UnaryFunction_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Express_SequenceOfEntity.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Express_SequenceOfEntity.hxx new file mode 100644 index 0000000000000000000000000000000000000000..621e6dd1a18537ebc6ea1ead79b3317e0760bea8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Express_SequenceOfEntity.hxx @@ -0,0 +1,22 @@ +// Copyright (c) 1999-2020 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Express_SequenceOfEntity_HeaderFile +#define Express_SequenceOfEntity_HeaderFile + +#include +#include + +typedef NCollection_Sequence Express_SequenceOfEntity; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Extrema_HArray1OfPOnCurv2d.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Extrema_HArray1OfPOnCurv2d.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a268f309da451a16d6d72d4fbfc00608500e51c0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Extrema_HArray1OfPOnCurv2d.hxx @@ -0,0 +1,26 @@ +// Created on: 1991-02-26 +// Created by: Isabelle GRIGNON +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Extrema_HArray1OfPOnCurv2d_HeaderFile +#define Extrema_HArray1OfPOnCurv2d_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(Extrema_HArray1OfPOnCurv2d, Extrema_Array1OfPOnCurv2d) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Extrema_PCLocFOfLocEPCOfLocateExtPC2d.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Extrema_PCLocFOfLocEPCOfLocateExtPC2d.hxx new file mode 100644 index 0000000000000000000000000000000000000000..68d122291f9dd3bd98151227a175a8054727cd70 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Extrema_PCLocFOfLocEPCOfLocateExtPC2d.hxx @@ -0,0 +1,108 @@ +// Created on: 1991-02-26 +// Created by: Isabelle GRIGNON +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Extrema_PCLocFOfLocEPCOfLocateExtPC2d_HeaderFile +#define _Extrema_PCLocFOfLocEPCOfLocateExtPC2d_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +class Standard_OutOfRange; +class Standard_TypeMismatch; +class Adaptor2d_Curve2d; +class Extrema_Curve2dTool; +class Extrema_POnCurv2d; +class gp_Pnt2d; +class gp_Vec2d; + +class Extrema_PCLocFOfLocEPCOfLocateExtPC2d : public math_FunctionWithDerivative +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Extrema_PCLocFOfLocEPCOfLocateExtPC2d(); + + Standard_EXPORT Extrema_PCLocFOfLocEPCOfLocateExtPC2d(const gp_Pnt2d& P, + const Adaptor2d_Curve2d& C); + + //! sets the field mycurve of the function. + Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& C); + + //! sets the field P of the function. + Standard_EXPORT void SetPoint(const gp_Pnt2d& P); + + //! Calculation of F(U). + Standard_EXPORT Standard_Boolean Value(const Standard_Real U, Standard_Real& F) Standard_OVERRIDE; + + //! Calculation of F'(U). + Standard_EXPORT Standard_Boolean Derivative(const Standard_Real U, + Standard_Real& DF) Standard_OVERRIDE; + + //! Calculation of F(U) and F'(U). + Standard_EXPORT Standard_Boolean Values(const Standard_Real U, + Standard_Real& F, + Standard_Real& DF) Standard_OVERRIDE; + + //! Save the found extremum. + Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE; + + //! Return the number of found extrema. + Standard_EXPORT Standard_Integer NbExt() const; + + //! Returns the Nth distance. + Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N) const; + + //! Shows if the Nth distance is a minimum. + Standard_EXPORT Standard_Boolean IsMin(const Standard_Integer N) const; + + //! Returns the Nth extremum. + Standard_EXPORT const Extrema_POnCurv2d& Point(const Standard_Integer N) const; + + //! Determines boundaries of subinterval for find of root. + Standard_EXPORT void SubIntervalInitialize(const Standard_Real theUfirst, + const Standard_Real theUlast); + + //! Computes a Tol value. If 1st derivative of curve + //! |D1| +#include + +#include +#include +#include +#include +#include +#include + +class FEmTool_LinearJerk; +DEFINE_STANDARD_HANDLE(FEmTool_LinearJerk, FEmTool_ElementaryCriterion) + +//! Criterion of LinearJerk To Hermit-Jacobi elements +class FEmTool_LinearJerk : public FEmTool_ElementaryCriterion +{ + +public: + Standard_EXPORT FEmTool_LinearJerk(const Standard_Integer WorkDegree, + const GeomAbs_Shape ConstraintOrder); + + Standard_EXPORT virtual Handle(TColStd_HArray2OfInteger) DependenceTable() const + Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Real Value() Standard_OVERRIDE; + + Standard_EXPORT virtual void Hessian(const Standard_Integer Dimension1, + const Standard_Integer Dimension2, + math_Matrix& H) Standard_OVERRIDE; + + Standard_EXPORT virtual void Gradient(const Standard_Integer Dimension, + math_Vector& G) Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(FEmTool_LinearJerk, FEmTool_ElementaryCriterion) + +protected: +private: + math_Matrix RefMatrix; + Standard_Integer myOrder; +}; + +#endif // _FEmTool_LinearJerk_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/FSD_BStream.hxx b/data/miniconda3/envs/catiagent/include/opencascade/FSD_BStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ad5d91b8bc52df494b34d99ac064adad61017ae3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/FSD_BStream.hxx @@ -0,0 +1,22 @@ +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _FSD_BStream_HeaderFile +#define _FSD_BStream_HeaderFile + +#include + +typedef FILE* FSD_BStream; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_DistributionOfTension.lxx b/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_DistributionOfTension.lxx new file mode 100644 index 0000000000000000000000000000000000000000..6273caee61a6118e2e399042cd04e95efac44295 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_DistributionOfTension.lxx @@ -0,0 +1,17 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +inline void FairCurve_DistributionOfTension::SetLengthSliding(const Standard_Real LengthSliding) +{ + MyLengthSliding = LengthSliding; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_EnergyOfMVC.lxx b/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_EnergyOfMVC.lxx new file mode 100644 index 0000000000000000000000000000000000000000..9c70ccd942ac6192b11cec738376d214f6897fb1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/FairCurve_EnergyOfMVC.lxx @@ -0,0 +1,25 @@ +// Created on: 1996-04-01 +// Created by: Philippe MANGIN +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +inline Standard_Real FairCurve_EnergyOfMVC::LengthSliding() const +{ + return MyLengthSliding; +} + +inline FairCurve_AnalysisCode FairCurve_EnergyOfMVC::Status() const +{ + return MyStatus; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_QuasiUniformAbscissa.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_QuasiUniformAbscissa.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1b594136e40f6b1c2ec75aa4f51a601878987324 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_QuasiUniformAbscissa.hxx @@ -0,0 +1,182 @@ +// Created on: 1996-08-22 +// Created by: Stagiaire Mary FABIEN +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GCPnts_QuasiUniformAbscissa_HeaderFile +#define _GCPnts_QuasiUniformAbscissa_HeaderFile + +#include +#include + +class Adaptor3d_Curve; +class Adaptor2d_Curve2d; + +//! This class provides an algorithm to compute a uniform abscissa +//! distribution of points on a curve, i.e. a sequence of equidistant points. +//! The distance between two consecutive points is measured along the curve. +//! +//! The distribution is defined by a number of points. +class GCPnts_QuasiUniformAbscissa +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs an empty algorithm. + //! To define the problem to be solved, use the function Initialize. + Standard_EXPORT GCPnts_QuasiUniformAbscissa(); + + //! Computes a uniform abscissa distribution of points + //! - on the curve where Abscissa is the curvilinear distance between + //! two consecutive points of the distribution. + Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor3d_Curve& theC, + const Standard_Integer theNbPoints); + + //! Computes a uniform abscissa distribution of points + //! on the part of curve limited by the two parameter values theU1 and theU2, + //! where Abscissa is the curvilinear distance between + //! two consecutive points of the distribution. + //! The first point of the distribution is either the origin of + //! curve or the point of parameter theU1. + //! The following points are computed such that the curvilinear + //! distance between two consecutive points is equal to Abscissa. + //! The last point of the distribution is either the end + //! point of curve or the point of parameter theU2. + //! However the curvilinear distance between this last + //! point and the point just preceding it in the distribution is, + //! of course, generally not equal to Abscissa. + //! Use the function IsDone() to verify that the computation was successful, + //! the function NbPoints() to obtain the number of points of the computed distribution, + //! and the function Parameter() to read the parameter of each point. + //! + //! Warning + //! The roles of theU1 and theU2 are inverted if theU1 > theU2. + //! Warning + //! theC is an adapted curve, that is, an object which is an interface between: + //! - the services provided by either a 2D curve from + //! the package Geom2d (in the case of an Adaptor2d_Curve2d curve) + //! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve), + //! - and those required on the curve by the computation algorithm. + //! @param[in] theC input 3D curve + //! @param[in] theNbPoints defines the number of desired points + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor3d_Curve& theC, + const Standard_Integer theNbPoints, + const Standard_Real theU1, + const Standard_Real theU2); + + //! Initialize the algorithms with 3D curve and target number of points. + //! @param[in] theC input 3D curve + //! @param[in] theNbPoints defines the number of desired points + Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, const Standard_Integer theNbPoints); + + //! Initialize the algorithms with 3D curve, target number of points and curve parameter range. + //! @param[in] theC input 3D curve + //! @param[in] theNbPoints defines the number of desired points + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, + const Standard_Integer theNbPoints, + const Standard_Real theU1, + const Standard_Real theU2); + + //! Computes a uniform abscissa distribution of points on the 2D curve. + //! @param[in] theC input 2D curve + //! @param[in] theNbPoints defines the number of desired points + Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor2d_Curve2d& theC, + const Standard_Integer theNbPoints); + + //! Computes a Uniform abscissa distribution of points on a part of the 2D curve. + //! @param[in] theC input 2D curve + //! @param[in] theNbPoints defines the number of desired points + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor2d_Curve2d& theC, + const Standard_Integer theNbPoints, + const Standard_Real theU1, + const Standard_Real theU2); + + //! Initialize the algorithms with 2D curve and target number of points. + //! @param[in] theC input 2D curve + //! @param[in] theNbPoints defines the number of desired points + Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, + const Standard_Integer theNbPoints); + + //! Initialize the algorithms with 2D curve, target number of points and curve parameter range. + //! @param[in] theC input 2D curve + //! @param[in] theNbPoints defines the number of desired points + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, + const Standard_Integer theNbPoints, + const Standard_Real theU1, + const Standard_Real theU2); + + //! Returns true if the computation was successful. + //! IsDone is a protection against: + //! - non-convergence of the algorithm + //! - querying the results before computation. + Standard_Boolean IsDone() const { return myDone; } + + //! Returns the number of points of the distribution + //! computed by this algorithm. + //! This value is either: + //! - the one imposed on the algorithm at the time of + //! construction (or initialization), or + //! - the one computed by the algorithm when the + //! curvilinear distance between two consecutive + //! points of the distribution is imposed on the + //! algorithm at the time of construction (or initialization). + //! Exceptions + //! StdFail_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_Integer NbPoints() const + { + StdFail_NotDone_Raise_if(!myDone, "GCPnts_QuasiUniformAbscissa::NbPoints()"); + return myNbPoints; + } + + //! Returns the parameter of the point of index Index in + //! the distribution computed by this algorithm. + //! Warning + //! Index must be greater than or equal to 1, and less + //! than or equal to the number of points of the + //! distribution. However, pay particular attention as this + //! condition is not checked by this function. + //! Exceptions + //! StdFail_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_Real Parameter(const Standard_Integer Index) const + { + StdFail_NotDone_Raise_if(!myDone, "GCPnts_QuasiUniformAbscissa::Parameter()"); + return myParams->Value(Index); + } + +private: + //! This function divides given curve on the several parts with equal length. + //! It returns array of parameters in the control points. + template + void initialize(const TheCurve& theC, + const Standard_Integer theNbPoints, + const Standard_Real theU1, + const Standard_Real theU2); + +private: + Standard_Boolean myDone; + Standard_Integer myNbPoints; + Handle(TColStd_HArray1OfReal) myParams; +}; + +#endif // _GCPnts_QuasiUniformAbscissa_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_UniformDeflection.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_UniformDeflection.hxx new file mode 100644 index 0000000000000000000000000000000000000000..518c10217b5c86b388cabefe351ce3db08b7a671 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GCPnts_UniformDeflection.hxx @@ -0,0 +1,221 @@ +// Created on: 1992-03-23 +// Created by: Herve LEGRAND +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GCPnts_UniformDeflection_HeaderFile +#define _GCPnts_UniformDeflection_HeaderFile + +#include +#include +#include + +class Adaptor3d_Curve; +class Adaptor2d_Curve2d; +class gp_Pnt; + +//! Provides an algorithm to compute a distribution of +//! points on a 'C2' continuous curve. +//! The algorithm respects a criterion of maximum deflection between +//! the curve and the polygon that results from the computed points. +//! Note: This algorithm is relatively time consuming. +//! A GCPnts_QuasiUniformDeflection algorithm is quicker; +//! it can also work with non-'C2' continuous curves, +//! but it generates more points in the distribution. +class GCPnts_UniformDeflection +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs an empty algorithm. + //! To define the problem to be solved, use the function Initialize. + Standard_EXPORT GCPnts_UniformDeflection(); + + //! Computes a uniform Deflection distribution of points on the curve. + //! @param[in] theC input 3D curve + //! @param[in] theDeflection target deflection + //! @param[in] theWithControl when TRUE, the algorithm controls the estimate deflection + Standard_EXPORT GCPnts_UniformDeflection(const Adaptor3d_Curve& theC, + const Standard_Real theDeflection, + const Standard_Boolean theWithControl = Standard_True); + + //! Computes a uniform Deflection distribution of points on the curve. + //! @param[in] theC input 2D curve + //! @param[in] theDeflection target deflection + //! @param[in] theWithControl when TRUE, the algorithm controls the estimate deflection + Standard_EXPORT GCPnts_UniformDeflection(const Adaptor2d_Curve2d& theC, + const Standard_Real theDeflection, + const Standard_Boolean theWithControl = Standard_True); + + //! Computes a Uniform Deflection distribution of points on a part of the curve. + //! @param[in] theC input 3D curve + //! @param[in] theDeflection target deflection + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + //! @param[in] theWithControl when TRUE, the algorithm controls the estimate deflection + Standard_EXPORT GCPnts_UniformDeflection(const Adaptor3d_Curve& theC, + const Standard_Real theDeflection, + const Standard_Real theU1, + const Standard_Real theU2, + const Standard_Boolean theWithControl = Standard_True); + + //! Computes a Uniform Deflection distribution of points on a part of the curve. + //! @param[in] theC input 2D curve + //! @param[in] theDeflection target deflection + //! @param[in] theU1 first parameter on curve + //! @param[in] theU2 last parameter on curve + //! @param[in] theWithControl when TRUE, the algorithm controls the estimate deflection + Standard_EXPORT GCPnts_UniformDeflection(const Adaptor2d_Curve2d& theC, + const Standard_Real theDeflection, + const Standard_Real theU1, + const Standard_Real theU2, + const Standard_Boolean theWithControl = Standard_True); + + //! Initialize the algorithms with 3D curve and deflection. + Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, + const Standard_Real theDeflection, + const Standard_Boolean theWithControl = Standard_True); + + //! Initialize the algorithms with 2D curve and deflection. + Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, + const Standard_Real theDeflection, + const Standard_Boolean theWithControl = Standard_True); + + //! Initialize the algorithms with 3D curve, deflection, parameter range. + Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, + const Standard_Real theDeflection, + const Standard_Real theU1, + const Standard_Real theU2, + const Standard_Boolean theWithControl = Standard_True); + + //! Initialize the algorithms with curve, deflection, parameter range. + //! This and the above methods initialize (or reinitialize) this algorithm and + //! compute a distribution of points: + //! - on the curve theC, or + //! - on the part of curve theC limited by the two parameter values theU1 and theU2, + //! where the maximum distance between theC and the + //! polygon that results from the points of the + //! distribution is not greater than theDeflection. + //! The first point of the distribution is either the origin + //! of curve theC or the point of parameter theU1. + //! The last point of the distribution is either the end point of + //! curve theC or the point of parameter theU2. + //! Intermediate points of the distribution are built using + //! interpolations of segments of the curve limited at the 2nd degree. + //! The construction ensures, in a first step, + //! that the chordal deviation for this + //! interpolation of the curve is less than or equal to theDeflection. + //! However, it does not ensure that the chordal deviation + //! for the curve itself is less than or equal to theDeflection. + //! To do this a check is necessary, + //! which may generate (second step) additional intermediate points. + //! This check is time consuming, and can be avoided by setting theWithControl to false. + //! Note that by default theWithControl is true and check is performed. + //! Use the function IsDone to verify that the computation was successful, + //! the function NbPoints() to obtain the number of points of the computed distribution, + //! and the function Parameter to read the parameter of each point. + //! + //! Warning + //! - theC is necessary, 'C2' continuous. + //! This property is not checked at construction time. + //! - The roles of theU1 and theU2 are inverted if theU1 > theU2. + //! + //! Warning + //! theC is an adapted curve, i.e. an object which is an interface between: + //! - the services provided by either a 2D curve from + //! the package Geom2d (in the case of an Adaptor2d_Curve2d curve) + //! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve), + //! - and those required on the curve by the computation algorithm. + Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, + const Standard_Real theDeflection, + const Standard_Real theU1, + const Standard_Real theU2, + const Standard_Boolean theWithControl = Standard_True); + + //! Returns true if the computation was successful. + //! IsDone is a protection against: + //! - non-convergence of the algorithm + //! - querying the results before computation. + Standard_Boolean IsDone() const { return myDone; } + + //! Returns the number of points of the distribution + //! computed by this algorithm. + //! Exceptions + //! StdFail_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_Integer NbPoints() const + { + StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformDeflection::NbPoints()"); + return myParams.Length(); + } + + //! Returns the parameter of the point of index Index in + //! the distribution computed by this algorithm. + //! Warning + //! Index must be greater than or equal to 1, and less + //! than or equal to the number of points of the + //! distribution. However, pay particular attention as this + //! condition is not checked by this function. + //! Exceptions + //! StdFail_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_Real Parameter(const Standard_Integer Index) const + { + StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformDeflection::Parameter()"); + return myParams(Index); + } + + //! Returns the point of index Index in the distribution + //! computed by this algorithm. + //! Warning + //! Index must be greater than or equal to 1, and less + //! than or equal to the number of points of the + //! distribution. However, pay particular attention as this + //! condition is not checked by this function. + //! Exceptions + //! StdFAil_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_EXPORT gp_Pnt Value(const Standard_Integer Index) const; + + //! Returns the deflection between the curve and the + //! polygon resulting from the points of the distribution + //! computed by this algorithm. + //! This value is the one given to the algorithm at the + //! time of construction (or initialization). + //! Exceptions + //! StdFail_NotDone if this algorithm has not been + //! initialized, or if the computation was not successful. + Standard_Real Deflection() const + { + StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformDeflection::Deflection()"); + return myDeflection; + } + +private: + //! Initialize the algorithm. + template + void initialize(const TheCurve& theC, + const Standard_Real theDeflection, + const Standard_Real theU1, + const Standard_Real theU2, + const Standard_Boolean theWithControl); + +private: + Standard_Boolean myDone; + Standard_Real myDeflection; + TColStd_SequenceOfReal myParams; + TColgp_SequenceOfPnt myPoints; +}; + +#endif // _GCPnts_UniformDeflection_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GC_MakeConicalSurface.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GC_MakeConicalSurface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..78a2b10a18d149555550f36219660468b01d7319 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GC_MakeConicalSurface.hxx @@ -0,0 +1,119 @@ +// Created on: 1992-09-28 +// Created by: Remi GILET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GC_MakeConicalSurface_HeaderFile +#define _GC_MakeConicalSurface_HeaderFile + +#include +#include +#include + +#include +#include + +class gp_Ax2; +class gp_Cone; +class gp_Pnt; + +//! This class implements the following algorithms used +//! to create a ConicalSurface from Geom. +//! * Create a ConicalSurface parallel to another and passing +//! through a point. +//! * Create a ConicalSurface parallel to another at a distance +//! . +//! * Create a ConicalSurface by 4 points. +//! * Create a ConicalSurface by its axis and 2 points. +//! * Create a ConicalSurface by 2 points and 2 radius. +//! The local coordinate system of the ConicalSurface is defined +//! with an axis placement (see class ElementarySurface). +//! +//! The "ZAxis" is the symmetry axis of the ConicalSurface, +//! it gives the direction of increasing parametric value V. +//! The apex of the surface is on the negative side of this axis. +//! +//! The parametrization range is : +//! U [0, 2*PI], V ]-infinite, + infinite[ +//! +//! The "XAxis" and the "YAxis" define the placement plane of the +//! surface (Z = 0, and parametric value V = 0) perpendicular to +//! the symmetry axis. The "XAxis" defines the origin of the +//! parameter U = 0. The trigonometric sense gives the positive +//! orientation for the parameter U. +//! +//! When you create a ConicalSurface the U and V directions of +//! parametrization are such that at each point of the surface the +//! normal is oriented towards the "outside region". +class GC_MakeConicalSurface : public GC_Root +{ +public: + DEFINE_STANDARD_ALLOC + + //! A2 defines the local coordinate system of the conical surface. + //! Ang is the conical surface semi-angle ]0, PI/2[. + //! Radius is the radius of the circle Viso in the placement plane + //! of the conical surface defined with "XAxis" and "YAxis". + //! The "ZDirection" of A2 defines the direction of the surface's + //! axis of symmetry. + //! If the location point of A2 is the apex of the surface + //! Radius = 0 . + //! At the creation the parametrization of the surface is defined + //! such that the normal Vector (N = D1U ^ D1V) is oriented towards + //! the "outside region" of the surface. + //! Status is "NegativeRadius" if Radius < 0.0 or "BadAngle" if + //! Ang < Resolution from gp or Ang >= PI/ - Resolution + Standard_EXPORT GC_MakeConicalSurface(const gp_Ax2& A2, + const Standard_Real Ang, + const Standard_Real Radius); + + //! Creates a ConicalSurface from a non persistent Cone from package gp. + Standard_EXPORT GC_MakeConicalSurface(const gp_Cone& C); + + //! Make a ConicalSurface from Geom passing through 3 + //! Pnt ,,. + //! Its axis is and the radius of its base is + //! the distance between and . + //! The distance between and is the radius of + //! the section passing through . + //! An error iss raised if ,,, are + //! colinear or if is perpendicular to or + //! is colinear to . + Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& P1, + const gp_Pnt& P2, + const gp_Pnt& P3, + const gp_Pnt& P4); + + //! Make a ConicalSurface with two points and two radius. + //! The axis of the solution is the line passing through + //! and . + //! is the radius of the section passing through + //! and the radius of the section passing through . + Standard_EXPORT GC_MakeConicalSurface(const gp_Pnt& P1, + const gp_Pnt& P2, + const Standard_Real R1, + const Standard_Real R2); + + //! Returns the constructed cone. + //! Exceptions + //! StdFail_NotDone if no cone is constructed. + Standard_EXPORT const Handle(Geom_ConicalSurface)& Value() const; + + operator const Handle(Geom_ConicalSurface) & () const { return Value(); } + +private: + Handle(Geom_ConicalSurface) TheCone; +}; + +#endif // _GC_MakeConicalSurface_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GProp_CelGProps.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GProp_CelGProps.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a2f0c760aa359e8561ba83d6c3d3f1b4d57d7ec1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GProp_CelGProps.hxx @@ -0,0 +1,61 @@ +// Created on: 1992-12-02 +// Created by: Isabelle GRIGNON +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GProp_CelGProps_HeaderFile +#define _GProp_CelGProps_HeaderFile + +#include +#include + +#include +class gp_Circ; +class gp_Pnt; +class gp_Lin; + +//! Computes the global properties of bounded curves +//! in 3D space. +//! It can be an elementary curve from package gp such as +//! Lin, Circ, Elips, Parab . +class GProp_CelGProps : public GProp_GProps +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GProp_CelGProps(); + + Standard_EXPORT GProp_CelGProps(const gp_Circ& C, const gp_Pnt& CLocation); + + Standard_EXPORT GProp_CelGProps(const gp_Circ& C, + const Standard_Real U1, + const Standard_Real U2, + const gp_Pnt& CLocation); + + Standard_EXPORT GProp_CelGProps(const gp_Lin& C, + const Standard_Real U1, + const Standard_Real U2, + const gp_Pnt& CLocation); + + Standard_EXPORT void SetLocation(const gp_Pnt& CLocation); + + Standard_EXPORT void Perform(const gp_Circ& C, const Standard_Real U1, const Standard_Real U2); + + Standard_EXPORT void Perform(const gp_Lin& C, const Standard_Real U1, const Standard_Real U2); + +protected: +private: +}; + +#endif // _GProp_CelGProps_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_Circ2d3TanIter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_Circ2d3TanIter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e6c851f23fd3fcaa78fc5d791f500a5f1a6ab9ce --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_Circ2d3TanIter.hxx @@ -0,0 +1,223 @@ +// Created on: 1991-03-29 +// Created by: Remi GILET +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Geom2dGcc_Circ2d3TanIter_HeaderFile +#define _Geom2dGcc_Circ2d3TanIter_HeaderFile + +#include +#include + +#include +#include +#include +class GccEnt_QualifiedCirc; +class Geom2dGcc_QCurve; +class GccEnt_QualifiedLin; + +//! This class implements the algorithms used to +//! create 2d circles tangent to 3 points/lines/circles/ +//! curves with one curve or more. +//! The arguments of all construction methods are : +//! - The three qualifiied elements for the +//! tangency constrains (QualifiedCirc, QualifiedLine, +//! Qualifiedcurv, Points). +//! - A parameter for each QualifiedCurv. +class Geom2dGcc_Circ2d3TanIter +{ +public: + DEFINE_STANDARD_ALLOC + + //! This method implements the algorithms used to + //! create 2d circles tangent to 2 circles and a curve. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedCirc& Qualified1, + const GccEnt_QualifiedCirc& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a circle and 2 curves. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedCirc& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a circle and a line and + //! a curve. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedCirc& Qualified1, + const GccEnt_QualifiedLin& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a circle and a point and + //! a curve. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedCirc& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const gp_Pnt2d& Point3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to 2 lines and a curve. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedLin& Qualified1, + const GccEnt_QualifiedLin& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a line and 2 curves. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedLin& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a line and a curve + //! and a point. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const GccEnt_QualifiedLin& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const gp_Pnt2d& Point3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to a curve and 2 points. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const Geom2dGcc_QCurve& Qualified1, + const gp_Pnt2d& Point1, + const gp_Pnt2d& Point2, + const Standard_Real Param1, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to 2 curves and a point. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const Geom2dGcc_QCurve& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const gp_Pnt2d& Point2, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Tolerance); + + //! This method implements the algorithms used to + //! create 2d circles tangent to 3 curves. + Standard_EXPORT Geom2dGcc_Circ2d3TanIter(const Geom2dGcc_QCurve& Qualified1, + const Geom2dGcc_QCurve& Qualified2, + const Geom2dGcc_QCurve& Qualified3, + const Standard_Real Param1, + const Standard_Real Param2, + const Standard_Real Param3, + const Standard_Real Tolerance); + + //! This method returns True if the construction + //! algorithm succeeded. + Standard_EXPORT Standard_Boolean IsDone() const; + + //! Returns the solution. + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT gp_Circ2d ThisSolution() const; + + Standard_EXPORT void WhichQualifier(GccEnt_Position& Qualif1, + GccEnt_Position& Qualif2, + GccEnt_Position& Qualif3) const; + + //! Returns information about the tangency point between + //! the result and the first argument. + //! ParSol is the intrinsic parameter of the point PntSol + //! on the solution curv. + //! ParArg is the intrinsic parameter of the point PntSol + //! on the argument curv. + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT void Tangency1(Standard_Real& ParSol, + Standard_Real& ParArg, + gp_Pnt2d& PntSol) const; + + //! Returns information about the tangency point between + //! the result and the second argument. + //! ParSol is the intrinsic parameter of the point PntSol + //! on the solution curv. + //! ParArg is the intrinsic parameter of the point PntSol + //! on the argument curv. + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT void Tangency2(Standard_Real& ParSol, + Standard_Real& ParArg, + gp_Pnt2d& PntSol) const; + + //! Returns information about the tangency point between + //! the result and the third argument. + //! ParSol is the intrinsic parameter of the point PntSol + //! on the solution curv. + //! ParArg is the intrinsic parameter of the point PntSol + //! on the argument curv. + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT void Tangency3(Standard_Real& ParSol, + Standard_Real& ParArg, + gp_Pnt2d& PntSol) const; + + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT Standard_Boolean IsTheSame1() const; + + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT Standard_Boolean IsTheSame2() const; + + //! It raises NotDone if the construction algorithm + //! didn't succeed. + Standard_EXPORT Standard_Boolean IsTheSame3() const; + +protected: +private: + Standard_Boolean WellDone; + gp_Circ2d cirsol; + GccEnt_Position qualifier1; + GccEnt_Position qualifier2; + GccEnt_Position qualifier3; + Standard_Boolean TheSame1; + Standard_Boolean TheSame2; + Standard_Boolean TheSame3; + gp_Pnt2d pnttg1sol; + gp_Pnt2d pnttg2sol; + gp_Pnt2d pnttg3sol; + Standard_Real par1sol; + Standard_Real par2sol; + Standard_Real par3sol; + Standard_Real pararg1; + Standard_Real pararg2; + Standard_Real pararg3; +}; + +#endif // _Geom2dGcc_Circ2d3TanIter_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_FunctionTanObl.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_FunctionTanObl.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c03f8a2e8315b5cd9c182b6b9ae236e0f60565ad --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Geom2dGcc_FunctionTanObl.hxx @@ -0,0 +1,60 @@ +// Created on: 1992-01-09 +// Created by: Remi GILET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Geom2dGcc_FunctionTanObl_HeaderFile +#define _Geom2dGcc_FunctionTanObl_HeaderFile + +#include +#include +#include + +#include +#include +#include + +//! This class describe a function of a single variable. +class Geom2dGcc_FunctionTanObl : public math_FunctionWithDerivative +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Geom2dGcc_FunctionTanObl(const Geom2dAdaptor_Curve& Curve, const gp_Dir2d& Dir); + + //! Computes the value of the function F for the variable X. + //! It returns True if the computation is successfully done, + //! False otherwise. + Standard_EXPORT Standard_Boolean Value(const Standard_Real X, Standard_Real& F); + + //! Computes the derivative of the function F for the variable X. + //! It returns True if the computation is successfully done, + //! False otherwise. + Standard_EXPORT Standard_Boolean Derivative(const Standard_Real X, Standard_Real& Deriv); + + //! Computes the value and the derivative of the function F + //! for the variable X. + //! It returns True if the computation is successfully done, + //! False otherwise. + Standard_EXPORT Standard_Boolean Values(const Standard_Real X, + Standard_Real& F, + Standard_Real& Deriv); + +protected: +private: + Geom2dAdaptor_Curve TheCurv; + gp_Dir2d TheDirection; +}; + +#endif // _Geom2dGcc_FunctionTanObl_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_BSplineCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_BSplineCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..944304ff3815934679a12716ee9748573f54ba1f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_BSplineCurve.hxx @@ -0,0 +1,886 @@ +// Created on: 1993-03-24 +// Created by: JCV +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Geom2d_BSplineCurve_HeaderFile +#define _Geom2d_BSplineCurve_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class gp_Pnt2d; +class gp_Vec2d; +class gp_Trsf2d; +class Geom2d_Geometry; + +class Geom2d_BSplineCurve; +DEFINE_STANDARD_HANDLE(Geom2d_BSplineCurve, Geom2d_BoundedCurve) + +//! Describes a BSpline curve. +//! A BSpline curve can be: +//! - uniform or non-uniform, +//! - rational or non-rational, +//! - periodic or non-periodic. +//! A BSpline curve is defined by: +//! - its degree; the degree for a +//! Geom2d_BSplineCurve is limited to a value (25) +//! which is defined and controlled by the system. This +//! value is returned by the function MaxDegree; +//! - its periodic or non-periodic nature; +//! - a table of poles (also called control points), with +//! their associated weights if the BSpline curve is +//! rational. The poles of the curve are "control points" +//! used to deform the curve. If the curve is +//! non-periodic, the first pole is the start point of the +//! curve, and the last pole is the end point of the +//! curve. The segment, which joins the first pole to the +//! second pole, is the tangent to the curve at its start +//! point, and the segment, which joins the last pole to +//! the second-from-last pole, is the tangent to the +//! curve at its end point. If the curve is periodic, these +//! geometric properties are not verified. It is more +//! difficult to give a geometric signification to the +//! weights but they are useful for providing exact +//! representations of the arcs of a circle or ellipse. +//! Moreover, if the weights of all the poles are equal, +//! the curve has a polynomial equation; it is +//! therefore a non-rational curve. +//! - a table of knots with their multiplicities. For a +//! Geom2d_BSplineCurve, the table of knots is an +//! increasing sequence of reals without repetition; the +//! multiplicities define the repetition of the knots. A +//! BSpline curve is a piecewise polynomial or rational +//! curve. The knots are the parameters of junction +//! points between two pieces. The multiplicity +//! Mult(i) of the knot Knot(i) of the BSpline +//! curve is related to the degree of continuity of the +//! curve at the knot Knot(i), which is equal to +//! Degree - Mult(i) where Degree is the +//! degree of the BSpline curve. +//! If the knots are regularly spaced (i.e. the difference +//! between two consecutive knots is a constant), three +//! specific and frequently used cases of knot distribution +//! can be identified: +//! - "uniform" if all multiplicities are equal to 1, +//! - "quasi-uniform" if all multiplicities are equal to 1, +//! except the first and the last knot which have a +//! multiplicity of Degree + 1, where Degree is +//! the degree of the BSpline curve, +//! - "Piecewise Bezier" if all multiplicities are equal to +//! Degree except the first and last knot which have +//! a multiplicity of Degree + 1, where Degree is +//! the degree of the BSpline curve. A curve of this +//! type is a concatenation of arcs of Bezier curves. +//! If the BSpline curve is not periodic: +//! - the bounds of the Poles and Weights tables are 1 +//! and NbPoles, where NbPoles is the number of +//! poles of the BSpline curve, +//! - the bounds of the Knots and Multiplicities tables are +//! 1 and NbKnots, where NbKnots is the number +//! of knots of the BSpline curve. +//! If the BSpline curve is periodic, and if there are k +//! periodic knots and p periodic poles, the period is: +//! period = Knot(k + 1) - Knot(1) +//! and the poles and knots tables can be considered as +//! infinite tables, such that: +//! - Knot(i+k) = Knot(i) + period +//! - Pole(i+p) = Pole(i) +//! Note: data structures of a periodic BSpline curve are +//! more complex than those of a non-periodic one. +//! Warnings : +//! In this class we consider that a weight value is zero if +//! Weight <= Resolution from package gp. +//! For two parametric values (or two knot values) U1, U2 we +//! consider that U1 = U2 if Abs (U2 - U1) <= Epsilon (U1). +//! For two weights values W1, W2 we consider that W1 = W2 if +//! Abs (W2 - W1) <= Epsilon (W1). The method Epsilon is +//! defined in the class Real from package Standard. +//! +//! References : +//! . A survey of curve and surface methods in CADG Wolfgang BOHM +//! CAGD 1 (1984) +//! . On de Boor-like algorithms and blossoming Wolfgang BOEHM +//! cagd 5 (1988) +//! . Blossoming and knot insertion algorithms for B-spline curves +//! Ronald N. GOLDMAN +//! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA +//! . Curves and Surfaces for Computer Aided Geometric Design, +//! a practical guide Gerald Farin +class Geom2d_BSplineCurve : public Geom2d_BoundedCurve +{ + +public: + //! Creates a non-rational B_spline curve on the + //! basis of degree . + //! The following conditions must be verified. + //! 0 < Degree <= MaxDegree. + //! + //! Knots.Length() == Mults.Length() >= 2 + //! + //! Knots(i) < Knots(i+1) (Knots are increasing) + //! + //! 1 <= Mults(i) <= Degree + //! + //! On a non periodic curve the first and last multiplicities + //! may be Degree+1 (this is even recommended if you want the + //! curve to start and finish on the first and last pole). + //! + //! On a periodic curve the first and the last multicities + //! must be the same. + //! + //! on non-periodic curves + //! + //! Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2 + //! + //! on periodic curves + //! + //! Poles.Length() == Sum(Mults(i)) except the first or last + Standard_EXPORT Geom2d_BSplineCurve(const TColgp_Array1OfPnt2d& Poles, + const TColStd_Array1OfReal& Knots, + const TColStd_Array1OfInteger& Multiplicities, + const Standard_Integer Degree, + const Standard_Boolean Periodic = Standard_False); + + //! Creates a rational B_spline curve on the basis + //! of degree . + //! The following conditions must be verified. + //! 0 < Degree <= MaxDegree. + //! + //! Knots.Length() == Mults.Length() >= 2 + //! + //! Knots(i) < Knots(i+1) (Knots are increasing) + //! + //! 1 <= Mults(i) <= Degree + //! + //! On a non periodic curve the first and last multiplicities + //! may be Degree+1 (this is even recommended if you want the + //! curve to start and finish on the first and last pole). + //! + //! On a periodic curve the first and the last multicities + //! must be the same. + //! + //! on non-periodic curves + //! + //! Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2 + //! + //! on periodic curves + //! + //! Poles.Length() == Sum(Mults(i)) except the first or last + Standard_EXPORT Geom2d_BSplineCurve(const TColgp_Array1OfPnt2d& Poles, + const TColStd_Array1OfReal& Weights, + const TColStd_Array1OfReal& Knots, + const TColStd_Array1OfInteger& Multiplicities, + const Standard_Integer Degree, + const Standard_Boolean Periodic = Standard_False); + + //! Increases the degree of this BSpline curve to + //! Degree. As a result, the poles, weights and + //! multiplicities tables are modified; the knots table is + //! not changed. Nothing is done if Degree is less than + //! or equal to the current degree. + //! Exceptions + //! Standard_ConstructionError if Degree is greater than + //! Geom2d_BSplineCurve::MaxDegree(). + Standard_EXPORT void IncreaseDegree(const Standard_Integer Degree); + + //! Increases the multiplicity of the knot to + //! . + //! + //! If is lower or equal to the current + //! multiplicity nothing is done. If is higher than + //! the degree the degree is used. + //! If is not in [FirstUKnotIndex, LastUKnotIndex] + Standard_EXPORT void IncreaseMultiplicity(const Standard_Integer Index, const Standard_Integer M); + + //! Increases the multiplicities of the knots in + //! [I1,I2] to . + //! + //! For each knot if is lower or equal to the + //! current multiplicity nothing is done. If is + //! higher than the degree the degree is used. + //! As a result, the poles and weights tables of this curve are modified. + //! Warning + //! It is forbidden to modify the multiplicity of the first or + //! last knot of a non-periodic curve. Be careful as + //! Geom2d does not protect against this. + //! Exceptions + //! Standard_OutOfRange if either Index, I1 or I2 is + //! outside the bounds of the knots table. + Standard_EXPORT void IncreaseMultiplicity(const Standard_Integer I1, + const Standard_Integer I2, + const Standard_Integer M); + + //! Increases by M the multiplicity of the knots of indexes + //! I1 to I2 in the knots table of this BSpline curve. For + //! each knot, the resulting multiplicity is limited to the + //! degree of this curve. If M is negative, nothing is done. + //! As a result, the poles and weights tables of this + //! BSpline curve are modified. + //! Warning + //! It is forbidden to modify the multiplicity of the first or + //! last knot of a non-periodic curve. Be careful as + //! Geom2d does not protect against this. + //! Exceptions + //! Standard_OutOfRange if I1 or I2 is outside the + //! bounds of the knots table. + Standard_EXPORT void IncrementMultiplicity(const Standard_Integer I1, + const Standard_Integer I2, + const Standard_Integer M); + + //! Inserts a knot value in the sequence of knots. If + //! is an existing knot the multiplicity is + //! increased by . + //! + //! If U is not on the parameter range nothing is + //! done. + //! + //! If the multiplicity is negative or null nothing is + //! done. The new multiplicity is limited to the + //! degree. + //! + //! The tolerance criterion for knots equality is + //! the max of Epsilon(U) and ParametricTolerance. + //! Warning + //! - If U is less than the first parameter or greater than + //! the last parameter of this BSpline curve, nothing is done. + //! - If M is negative or null, nothing is done. + //! - The multiplicity of a knot is limited to the degree of + //! this BSpline curve. + Standard_EXPORT void InsertKnot(const Standard_Real U, + const Standard_Integer M = 1, + const Standard_Real ParametricTolerance = 0.0); + + //! Inserts the values of the array Knots, with the + //! respective multiplicities given by the array Mults, into + //! the knots table of this BSpline curve. + //! If a value of the array Knots is an existing knot, its multiplicity is: + //! - increased by M, if Add is true, or + //! - increased to M, if Add is false (default value). + //! The tolerance criterion used for knot equality is the + //! larger of the values ParametricTolerance (defaulted + //! to 0.) and Standard_Real::Epsilon(U), + //! where U is the current knot value. + //! Warning + //! - For a value of the array Knots which is less than + //! the first parameter or greater than the last + //! parameter of this BSpline curve, nothing is done. + //! - For a value of the array Mults which is negative or + //! null, nothing is done. + //! - The multiplicity of a knot is limited to the degree of + //! this BSpline curve. + Standard_EXPORT void InsertKnots(const TColStd_Array1OfReal& Knots, + const TColStd_Array1OfInteger& Mults, + const Standard_Real ParametricTolerance = 0.0, + const Standard_Boolean Add = Standard_False); + + //! Reduces the multiplicity of the knot of index Index + //! to M. If M is equal to 0, the knot is removed. + //! With a modification of this type, the array of poles is also modified. + //! Two different algorithms are systematically used to + //! compute the new poles of the curve. If, for each + //! pole, the distance between the pole calculated + //! using the first algorithm and the same pole + //! calculated using the second algorithm, is less than + //! Tolerance, this ensures that the curve is not + //! modified by more than Tolerance. Under these + //! conditions, true is returned; otherwise, false is returned. + //! A low tolerance is used to prevent modification of + //! the curve. A high tolerance is used to "smooth" the curve. + //! Exceptions + //! Standard_OutOfRange if Index is outside the + //! bounds of the knots table. + Standard_EXPORT Standard_Boolean RemoveKnot(const Standard_Integer Index, + const Standard_Integer M, + const Standard_Real Tolerance); + + //! The new pole is inserted after the pole of range Index. + //! If the curve was non rational it can become rational. + //! + //! Raised if the B-spline is NonUniform or PiecewiseBezier or if + //! Weight <= 0.0 + //! Raised if Index is not in the range [1, Number of Poles] + Standard_EXPORT void InsertPoleAfter(const Standard_Integer Index, + const gp_Pnt2d& P, + const Standard_Real Weight = 1.0); + + //! The new pole is inserted before the pole of range Index. + //! If the curve was non rational it can become rational. + //! + //! Raised if the B-spline is NonUniform or PiecewiseBezier or if + //! Weight <= 0.0 + //! Raised if Index is not in the range [1, Number of Poles] + Standard_EXPORT void InsertPoleBefore(const Standard_Integer Index, + const gp_Pnt2d& P, + const Standard_Real Weight = 1.0); + + //! Removes the pole of range Index + //! If the curve was rational it can become non rational. + //! + //! Raised if the B-spline is NonUniform or PiecewiseBezier. + //! Raised if the number of poles of the B-spline curve is lower or + //! equal to 2 before removing. + //! Raised if Index is not in the range [1, Number of Poles] + Standard_EXPORT void RemovePole(const Standard_Integer Index); + + //! Reverses the orientation of this BSpline curve. As a result + //! - the knots and poles tables are modified; + //! - the start point of the initial curve becomes the end + //! point of the reversed curve; + //! - the end point of the initial curve becomes the start + //! point of the reversed curve. + Standard_EXPORT void Reverse() Standard_OVERRIDE; + + //! Computes the parameter on the reversed curve for + //! the point of parameter U on this BSpline curve. + //! The returned value is: UFirst + ULast - U, + //! where UFirst and ULast are the values of the + //! first and last parameters of this BSpline curve. + Standard_EXPORT Standard_Real ReversedParameter(const Standard_Real U) const Standard_OVERRIDE; + + //! Modifies this BSpline curve by segmenting it + //! between U1 and U2. Either of these values can be + //! outside the bounds of the curve, but U2 must be greater than U1. + //! All data structure tables of this BSpline curve are + //! modified, but the knots located between U1 and U2 + //! are retained. The degree of the curve is not modified. + //! + //! Parameter theTolerance defines the possible proximity of the segment + //! boundaries and B-spline knots to treat them as equal. + //! + //! Warnings : + //! Even if is not closed it can become closed after the + //! segmentation for example if U1 or U2 are out of the bounds + //! of the curve or if the curve makes loop. + //! After the segmentation the length of a curve can be null. + //! - The segmentation of a periodic curve over an + //! interval corresponding to its period generates a + //! non-periodic curve with equivalent geometry. + //! Exceptions + //! Standard_DomainError if U2 is less than U1. + //! raises if U2 < U1. + //! Standard_DomainError if U2 - U1 exceeds the period for periodic curves. + //! i.e. ((U2 - U1) - Period) > Precision::PConfusion(). + Standard_EXPORT void Segment(const Standard_Real U1, + const Standard_Real U2, + const Standard_Real theTolerance = Precision::PConfusion()); + + //! Modifies this BSpline curve by assigning the value K + //! to the knot of index Index in the knots table. This is a + //! relatively local modification because K must be such that: + //! Knots(Index - 1) < K < Knots(Index + 1) + //! Exceptions + //! Standard_ConstructionError if: + //! - K is not such that: + //! Knots(Index - 1) < K < Knots(Index + 1) + //! - M is greater than the degree of this BSpline curve + //! or lower than the previous multiplicity of knot of + //! index Index in the knots table. + //! Standard_OutOfRange if Index is outside the bounds of the knots table. + Standard_EXPORT void SetKnot(const Standard_Integer Index, const Standard_Real K); + + //! Modifies this BSpline curve by assigning the array + //! K to its knots table. The multiplicity of the knots is not modified. + //! Exceptions + //! Standard_ConstructionError if the values in the + //! array K are not in ascending order. + //! Standard_OutOfRange if the bounds of the array + //! K are not respectively 1 and the number of knots of this BSpline curve. + Standard_EXPORT void SetKnots(const TColStd_Array1OfReal& K); + + //! Modifies this BSpline curve by assigning the value K + //! to the knot of index Index in the knots table. This is a + //! relatively local modification because K must be such that: + //! Knots(Index - 1) < K < Knots(Index + 1) + //! The second syntax allows you also to increase the + //! multiplicity of the knot to M (but it is not possible to + //! decrease the multiplicity of the knot with this function). + //! Exceptions + //! Standard_ConstructionError if: + //! - K is not such that: + //! Knots(Index - 1) < K < Knots(Index + 1) + //! - M is greater than the degree of this BSpline curve + //! or lower than the previous multiplicity of knot of + //! index Index in the knots table. + //! Standard_OutOfRange if Index is outside the bounds of the knots table. + Standard_EXPORT void SetKnot(const Standard_Integer Index, + const Standard_Real K, + const Standard_Integer M); + + //! Computes the parameter normalized within the + //! "first" period of this BSpline curve, if it is periodic: + //! the returned value is in the range Param1 and + //! Param1 + Period, where: + //! - Param1 is the "first parameter", and + //! - Period the period of this BSpline curve. + //! Note: If this curve is not periodic, U is not modified. + Standard_EXPORT void PeriodicNormalization(Standard_Real& U) const; + + //! Changes this BSpline curve into a periodic curve. + //! To become periodic, the curve must first be closed. + //! Next, the knot sequence must be periodic. For this, + //! FirstUKnotIndex and LastUKnotIndex are used to + //! compute I1 and I2, the indexes in the knots array + //! of the knots corresponding to the first and last + //! parameters of this BSpline curve. + //! The period is therefore Knot(I2) - Knot(I1). + //! Consequently, the knots and poles tables are modified. + //! Exceptions + //! Standard_ConstructionError if this BSpline curve is not closed. + Standard_EXPORT void SetPeriodic(); + + //! Assigns the knot of index Index in the knots table as + //! the origin of this periodic BSpline curve. As a + //! consequence, the knots and poles tables are modified. + //! Exceptions + //! Standard_NoSuchObject if this curve is not periodic. + //! Standard_DomainError if Index is outside the + //! bounds of the knots table. + Standard_EXPORT void SetOrigin(const Standard_Integer Index); + + //! Changes this BSpline curve into a non-periodic + //! curve. If this curve is already non-periodic, it is not modified. + //! Note that the poles and knots tables are modified. + //! Warning + //! If this curve is periodic, as the multiplicity of the first + //! and last knots is not modified, and is not equal to + //! Degree + 1, where Degree is the degree of + //! this BSpline curve, the start and end points of the + //! curve are not its first and last poles. + Standard_EXPORT void SetNotPeriodic(); + + //! Modifies this BSpline curve by assigning P to the + //! pole of index Index in the poles table. + //! Exceptions + //! Standard_OutOfRange if Index is outside the + //! bounds of the poles table. + //! Standard_ConstructionError if Weight is negative or null. + Standard_EXPORT void SetPole(const Standard_Integer Index, const gp_Pnt2d& P); + + //! Modifies this BSpline curve by assigning P to the + //! pole of index Index in the poles table. + //! The second syntax also allows you to modify the + //! weight of the modified pole, which becomes Weight. + //! In this case, if this BSpline curve is non-rational, it + //! can become rational and vice versa. + //! Exceptions + //! Standard_OutOfRange if Index is outside the + //! bounds of the poles table. + //! Standard_ConstructionError if Weight is negative or null. + Standard_EXPORT void SetPole(const Standard_Integer Index, + const gp_Pnt2d& P, + const Standard_Real Weight); + + //! Assigns the weight Weight to the pole of index Index of the poles table. + //! If the curve was non rational it can become rational. + //! If the curve was rational it can become non rational. + //! Exceptions + //! Standard_OutOfRange if Index is outside the + //! bounds of the poles table. + //! Standard_ConstructionError if Weight is negative or null. + Standard_EXPORT void SetWeight(const Standard_Integer Index, const Standard_Real Weight); + + //! Moves the point of parameter U of this BSpline + //! curve to P. Index1 and Index2 are the indexes in the + //! table of poles of this BSpline curve of the first and + //! last poles designated to be moved. + //! FirstModifiedPole and LastModifiedPole are the + //! indexes of the first and last poles, which are + //! effectively modified. + //! In the event of incompatibility between Index1, + //! Index2 and the value U: + //! - no change is made to this BSpline curve, and + //! - the FirstModifiedPole and LastModifiedPole are returned null. + //! Exceptions + //! Standard_OutOfRange if: + //! - Index1 is greater than or equal to Index2, or + //! - Index1 or Index2 is less than 1 or greater than the + //! number of poles of this BSpline curve. + Standard_EXPORT void MovePoint(const Standard_Real U, + const gp_Pnt2d& P, + const Standard_Integer Index1, + const Standard_Integer Index2, + Standard_Integer& FirstModifiedPole, + Standard_Integer& LastModifiedPole); + + //! Move a point with parameter U to P. + //! and makes it tangent at U be Tangent. + //! StartingCondition = -1 means first can move + //! EndingCondition = -1 means last point can move + //! StartingCondition = 0 means the first point cannot move + //! EndingCondition = 0 means the last point cannot move + //! StartingCondition = 1 means the first point and tangent cannot move + //! EndingCondition = 1 means the last point and tangent cannot move + //! and so forth + //! ErrorStatus != 0 means that there are not enough degree of freedom + //! with the constrain to deform the curve accordingly + Standard_EXPORT void MovePointAndTangent(const Standard_Real U, + const gp_Pnt2d& P, + const gp_Vec2d& Tangent, + const Standard_Real Tolerance, + const Standard_Integer StartingCondition, + const Standard_Integer EndingCondition, + Standard_Integer& ErrorStatus); + + //! Returns true if the degree of continuity of this + //! BSpline curve is at least N. A BSpline curve is at least GeomAbs_C0. + //! Exceptions Standard_RangeError if N is negative. + Standard_EXPORT Standard_Boolean IsCN(const Standard_Integer N) const Standard_OVERRIDE; + + //! Check if curve has at least G1 continuity in interval [theTf, theTl] + //! Returns true if IsCN(1) + //! or + //! angle between "left" and "right" first derivatives at + //! knots with C0 continuity is less then theAngTol + //! only knots in interval [theTf, theTl] is checked + Standard_EXPORT Standard_Boolean IsG1(const Standard_Real theTf, + const Standard_Real theTl, + const Standard_Real theAngTol) const; + + //! Returns true if the distance between the first point and the + //! last point of the curve is lower or equal to Resolution + //! from package gp. + //! Warnings : + //! The first and the last point can be different from the first + //! pole and the last pole of the curve. + Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; + + //! Returns True if the curve is periodic. + Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + + //! Returns True if the weights are not identical. + //! The tolerance criterion is Epsilon of the class Real. + Standard_EXPORT Standard_Boolean IsRational() const; + + //! Returns the global continuity of the curve : + //! C0 : only geometric continuity, + //! C1 : continuity of the first derivative all along the Curve, + //! C2 : continuity of the second derivative all along the Curve, + //! C3 : continuity of the third derivative all along the Curve, + //! CN : the order of continuity is infinite. + //! For a B-spline curve of degree d if a knot Ui has a + //! multiplicity p the B-spline curve is only Cd-p continuous + //! at Ui. So the global continuity of the curve can't be greater + //! than Cd-p where p is the maximum multiplicity of the interior + //! Knots. In the interior of a knot span the curve is infinitely + //! continuously differentiable. + Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + + //! Returns the degree of this BSpline curve. + //! In this class the degree of the basis normalized B-spline + //! functions cannot be greater than "MaxDegree" + //! Computation of value and derivatives + Standard_EXPORT Standard_Integer Degree() const; + + Standard_EXPORT void D0(const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; + + //! Raised if the continuity of the curve is not C1. + Standard_EXPORT void D1(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE; + + //! Raised if the continuity of the curve is not C2. + Standard_EXPORT void D2(const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2) const Standard_OVERRIDE; + + //! For this BSpline curve, computes + //! - the point P of parameter U, or + //! - the point P and one or more of the following values: + //! - V1, the first derivative vector, + //! - V2, the second derivative vector, + //! - V3, the third derivative vector. + //! Warning + //! On a point where the continuity of the curve is not the + //! one requested, these functions impact the part + //! defined by the parameter with a value greater than U, + //! i.e. the part of the curve to the "right" of the singularity. + //! Raises UndefinedDerivative if the continuity of the curve is not C3. + Standard_EXPORT void D3(const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const Standard_OVERRIDE; + + //! For the point of parameter U of this BSpline curve, + //! computes the vector corresponding to the Nth derivative. + //! Warning + //! On a point where the continuity of the curve is not the + //! one requested, this function impacts the part defined + //! by the parameter with a value greater than U, i.e. the + //! part of the curve to the "right" of the singularity. + //! Raises UndefinedDerivative if the continuity of the curve is not CN. + //! RangeError if N < 1. + //! The following functions computes the point of parameter U + //! and the derivatives at this point on the B-spline curve + //! arc defined between the knot FromK1 and the knot ToK2. + //! U can be out of bounds [Knot (FromK1), Knot (ToK2)] but + //! for the computation we only use the definition of the curve + //! between these two knots. This method is useful to compute + //! local derivative, if the order of continuity of the whole + //! curve is not greater enough. Inside the parametric + //! domain Knot (FromK1), Knot (ToK2) the evaluations are + //! the same as if we consider the whole definition of the + //! curve. Of course the evaluations are different outside + //! this parametric domain. + Standard_EXPORT gp_Vec2d DN(const Standard_Real U, + const Standard_Integer N) const Standard_OVERRIDE; + + //! Raised if FromK1 = ToK2. + Standard_EXPORT gp_Pnt2d LocalValue(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2) const; + + //! Raised if FromK1 = ToK2. + Standard_EXPORT void LocalD0(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2, + gp_Pnt2d& P) const; + + //! Raised if the local continuity of the curve is not C1 + //! between the knot K1 and the knot K2. + //! Raised if FromK1 = ToK2. + Standard_EXPORT void LocalD1(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2, + gp_Pnt2d& P, + gp_Vec2d& V1) const; + + //! Raised if the local continuity of the curve is not C2 + //! between the knot K1 and the knot K2. + //! Raised if FromK1 = ToK2. + Standard_EXPORT void LocalD2(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2) const; + + //! Raised if the local continuity of the curve is not C3 + //! between the knot K1 and the knot K2. + //! Raised if FromK1 = ToK2. + Standard_EXPORT void LocalD3(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) const; + + //! Raised if the local continuity of the curve is not CN + //! between the knot K1 and the knot K2. + //! Raised if FromK1 = ToK2. + //! Raised if N < 1. + Standard_EXPORT gp_Vec2d LocalDN(const Standard_Real U, + const Standard_Integer FromK1, + const Standard_Integer ToK2, + const Standard_Integer N) const; + + //! Returns the last point of the curve. + //! Warnings : + //! The last point of the curve is different from the last + //! pole of the curve if the multiplicity of the last knot + //! is lower than Degree. + Standard_EXPORT gp_Pnt2d EndPoint() const Standard_OVERRIDE; + + //! For a B-spline curve the first parameter (which gives the start + //! point of the curve) is a knot value but if the multiplicity of + //! the first knot index is lower than Degree + 1 it is not the + //! first knot of the curve. This method computes the index of the + //! knot corresponding to the first parameter. + Standard_EXPORT Standard_Integer FirstUKnotIndex() const; + + //! Computes the parametric value of the start point of the curve. + //! It is a knot value. + Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; + + //! Returns the knot of range Index. When there is a knot + //! with a multiplicity greater than 1 the knot is not repeated. + //! The method Multiplicity can be used to get the multiplicity + //! of the Knot. + //! Raised if Index < 1 or Index > NbKnots + Standard_EXPORT Standard_Real Knot(const Standard_Integer Index) const; + + //! returns the knot values of the B-spline curve; + //! + //! Raised K.Lower() is less than number of first knot or + //! K.Upper() is more than number of last knot. + Standard_EXPORT void Knots(TColStd_Array1OfReal& K) const; + + //! returns the knot values of the B-spline curve; + Standard_EXPORT const TColStd_Array1OfReal& Knots() const; + + //! Returns the knots sequence. + //! In this sequence the knots with a multiplicity greater than 1 + //! are repeated. + //! Example : + //! K = {k1, k1, k1, k2, k3, k3, k4, k4, k4} + //! + //! Raised if K.Lower() is less than number of first knot + //! in knot sequence with repetitions or K.Upper() is more + //! than number of last knot in knot sequence with repetitions. + Standard_EXPORT void KnotSequence(TColStd_Array1OfReal& K) const; + + //! Returns the knots sequence. + //! In this sequence the knots with a multiplicity greater than 1 + //! are repeated. + //! Example : + //! K = {k1, k1, k1, k2, k3, k3, k4, k4, k4} + Standard_EXPORT const TColStd_Array1OfReal& KnotSequence() const; + + //! Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier. + //! If all the knots differ by a positive constant from the + //! preceding knot the BSpline Curve can be : + //! - Uniform if all the knots are of multiplicity 1, + //! - QuasiUniform if all the knots are of multiplicity 1 except for + //! the first and last knot which are of multiplicity Degree + 1, + //! - PiecewiseBezier if the first and last knots have multiplicity + //! Degree + 1 and if interior knots have multiplicity Degree + //! A piecewise Bezier with only two knots is a BezierCurve. + //! else the curve is non uniform. + //! The tolerance criterion is Epsilon from class Real. + Standard_EXPORT GeomAbs_BSplKnotDistribution KnotDistribution() const; + + //! For a BSpline curve the last parameter (which gives the + //! end point of the curve) is a knot value but if the + //! multiplicity of the last knot index is lower than + //! Degree + 1 it is not the last knot of the curve. This + //! method computes the index of the knot corresponding to + //! the last parameter. + Standard_EXPORT Standard_Integer LastUKnotIndex() const; + + //! Computes the parametric value of the end point of the curve. + //! It is a knot value. + Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; + + //! Locates the parametric value U in the sequence of knots. + //! If "WithKnotRepetition" is True we consider the knot's + //! representation with repetition of multiple knot value, + //! otherwise we consider the knot's representation with + //! no repetition of multiple knot values. + //! Knots (I1) <= U <= Knots (I2) + //! . if I1 = I2 U is a knot value (the tolerance criterion + //! ParametricTolerance is used). + //! . if I1 < 1 => U < Knots (1) - Abs(ParametricTolerance) + //! . if I2 > NbKnots => U > Knots (NbKnots) + Abs(ParametricTolerance) + Standard_EXPORT void LocateU(const Standard_Real U, + const Standard_Real ParametricTolerance, + Standard_Integer& I1, + Standard_Integer& I2, + const Standard_Boolean WithKnotRepetition = Standard_False) const; + + //! Returns the multiplicity of the knots of range Index. + //! Raised if Index < 1 or Index > NbKnots + Standard_EXPORT Standard_Integer Multiplicity(const Standard_Integer Index) const; + + //! Returns the multiplicity of the knots of the curve. + //! + //! Raised if the length of M is not equal to NbKnots. + Standard_EXPORT void Multiplicities(TColStd_Array1OfInteger& M) const; + + //! returns the multiplicity of the knots of the curve. + Standard_EXPORT const TColStd_Array1OfInteger& Multiplicities() const; + + //! Returns the number of knots. This method returns the number of + //! knot without repetition of multiple knots. + Standard_EXPORT Standard_Integer NbKnots() const; + + //! Returns the number of poles + Standard_EXPORT Standard_Integer NbPoles() const; + + //! Returns the pole of range Index. + //! Raised if Index < 1 or Index > NbPoles. + Standard_EXPORT const gp_Pnt2d& Pole(const Standard_Integer Index) const; + + //! Returns the poles of the B-spline curve; + //! + //! Raised if the length of P is not equal to the number of poles. + Standard_EXPORT void Poles(TColgp_Array1OfPnt2d& P) const; + + //! Returns the poles of the B-spline curve; + Standard_EXPORT const TColgp_Array1OfPnt2d& Poles() const; + + //! Returns the start point of the curve. + //! Warnings : + //! This point is different from the first pole of the curve if the + //! multiplicity of the first knot is lower than Degree. + Standard_EXPORT gp_Pnt2d StartPoint() const Standard_OVERRIDE; + + //! Returns the weight of the pole of range Index . + //! Raised if Index < 1 or Index > NbPoles. + Standard_EXPORT Standard_Real Weight(const Standard_Integer Index) const; + + //! Returns the weights of the B-spline curve; + //! + //! Raised if the length of W is not equal to NbPoles. + Standard_EXPORT void Weights(TColStd_Array1OfReal& W) const; + + //! Returns the weights of the B-spline curve; + Standard_EXPORT const TColStd_Array1OfReal* Weights() const; + + //! Applies the transformation T to this BSpline curve. + Standard_EXPORT void Transform(const gp_Trsf2d& T) Standard_OVERRIDE; + + //! Returns the value of the maximum degree of the normalized + //! B-spline basis functions in this package. + Standard_EXPORT static Standard_Integer MaxDegree(); + + //! Computes for this BSpline curve the parametric + //! tolerance UTolerance for a given tolerance + //! Tolerance3D (relative to dimensions in the plane). + //! If f(t) is the equation of this BSpline curve, + //! UTolerance ensures that: + //! | t1 - t0| < Utolerance ===> + //! |f(t1) - f(t0)| < ToleranceUV + Standard_EXPORT void Resolution(const Standard_Real ToleranceUV, Standard_Real& UTolerance); + + //! Creates a new object which is a copy of this BSpline curve. + Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Geom2d_BSplineCurve, Geom2d_BoundedCurve) + +protected: +private: + //! Recompute the flatknots, the knotsdistribution, the continuity. + Standard_EXPORT void UpdateKnots(); + + Standard_Boolean rational; + Standard_Boolean periodic; + GeomAbs_BSplKnotDistribution knotSet; + GeomAbs_Shape smooth; + Standard_Integer deg; + Handle(TColgp_HArray1OfPnt2d) poles; + Handle(TColStd_HArray1OfReal) weights; + Handle(TColStd_HArray1OfReal) flatknots; + Handle(TColStd_HArray1OfReal) knots; + Handle(TColStd_HArray1OfInteger) mults; + Standard_Real maxderivinv; + Standard_Boolean maxderivinvok; +}; + +#endif // _Geom2d_BSplineCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_Direction.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_Direction.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4faf370aeec9e3d1d6f8043174a8ae01631a5c1d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Geom2d_Direction.hxx @@ -0,0 +1,95 @@ +// Created on: 1993-03-24 +// Created by: JCV +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Geom2d_Direction_HeaderFile +#define _Geom2d_Direction_HeaderFile + +#include + +#include +#include +class gp_Dir2d; +class gp_Trsf2d; +class Geom2d_Geometry; + +class Geom2d_Direction; +DEFINE_STANDARD_HANDLE(Geom2d_Direction, Geom2d_Vector) + +//! The class Direction specifies a vector that is never null. +//! It is a unit vector. +class Geom2d_Direction : public Geom2d_Vector +{ + +public: + //! Creates a unit vector with it 2 cartesian coordinates. + //! + //! Raised if Sqrt( X*X + Y*Y) <= Resolution from gp. + Standard_EXPORT Geom2d_Direction(const Standard_Real X, const Standard_Real Y); + + //! Creates a persistent copy of . + Standard_EXPORT Geom2d_Direction(const gp_Dir2d& V); + + //! Assigns the coordinates X and Y to this unit vector, + //! then normalizes it. + //! Exceptions + //! Standard_ConstructionError if Sqrt(X*X + + //! Y*Y) is less than or equal to gp::Resolution(). + Standard_EXPORT void SetCoord(const Standard_Real X, const Standard_Real Y); + + //! Converts the gp_Dir2d unit vector V into this unit vector. + Standard_EXPORT void SetDir2d(const gp_Dir2d& V); + + //! Assigns a value to the X coordinate of this unit vector, then normalizes it. + //! Exceptions + //! Standard_ConstructionError if the value assigned + //! causes the magnitude of the vector to become less + //! than or equal to gp::Resolution(). + Standard_EXPORT void SetX(const Standard_Real X); + + //! Assigns a value to the Y coordinate of this unit vector, then normalizes it. + //! Exceptions + //! Standard_ConstructionError if the value assigned + //! causes the magnitude of the vector to become less + //! than or equal to gp::Resolution(). + Standard_EXPORT void SetY(const Standard_Real Y); + + //! Converts this unit vector into a gp_Dir2d unit vector. + Standard_EXPORT gp_Dir2d Dir2d() const; + + //! returns 1.0 + Standard_EXPORT Standard_Real Magnitude() const Standard_OVERRIDE; + + //! returns 1.0 + Standard_EXPORT Standard_Real SquareMagnitude() const Standard_OVERRIDE; + + //! Computes the cross product between and . + Standard_EXPORT Standard_Real Crossed(const Handle(Geom2d_Vector)& Other) const Standard_OVERRIDE; + + Standard_Real operator^(const Handle(Geom2d_Vector)& Other) const { return Crossed(Other); } + + //! Applies the transformation T to this unit vector, then normalizes it. + Standard_EXPORT void Transform(const gp_Trsf2d& T) Standard_OVERRIDE; + + //! Creates a new object which is a copy of this unit vector. + Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Geom2d_Direction, Geom2d_Vector) + +protected: +private: +}; + +#endif // _Geom2d_Direction_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomAdaptor_Surface.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomAdaptor_Surface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..97bc0fdcb0bb019d2d65fe81ff5019c966e4936e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomAdaptor_Surface.hxx @@ -0,0 +1,353 @@ +// Created on: 1993-05-14 +// Created by: Bruno DUMORTIER +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomAdaptor_Surface_HeaderFile +#define _GeomAdaptor_Surface_HeaderFile + +#include +#include +#include +#include +#include +#include +#include + +DEFINE_STANDARD_HANDLE(GeomAdaptor_Surface, Adaptor3d_Surface) + +//! An interface between the services provided by any +//! surface from the package Geom and those required +//! of the surface by algorithms which use it. +//! Creation of the loaded surface the surface is C1 by piece +//! +//! Polynomial coefficients of BSpline surfaces used for their evaluation are +//! cached for better performance. Therefore these evaluations are not +//! thread-safe and parallel evaluations need to be prevented. +class GeomAdaptor_Surface : public Adaptor3d_Surface +{ + DEFINE_STANDARD_RTTIEXT(GeomAdaptor_Surface, Adaptor3d_Surface) +public: + GeomAdaptor_Surface() + : myUFirst(0.), + myULast(0.), + myVFirst(0.), + myVLast(0.), + myTolU(0.), + myTolV(0.), + mySurfaceType(GeomAbs_OtherSurface) + { + } + + GeomAdaptor_Surface(const Handle(Geom_Surface)& theSurf) + : myTolU(0.), + myTolV(0.) + { + Load(theSurf); + } + + //! Standard_ConstructionError is raised if UFirst>ULast or VFirst>VLast + GeomAdaptor_Surface(const Handle(Geom_Surface)& theSurf, + const Standard_Real theUFirst, + const Standard_Real theULast, + const Standard_Real theVFirst, + const Standard_Real theVLast, + const Standard_Real theTolU = 0.0, + const Standard_Real theTolV = 0.0) + { + Load(theSurf, theUFirst, theULast, theVFirst, theVLast, theTolU, theTolV); + } + + //! Shallow copy of adaptor + Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE; + + void Load(const Handle(Geom_Surface)& theSurf) + { + if (theSurf.IsNull()) + { + throw Standard_NullObject("GeomAdaptor_Surface::Load"); + } + + Standard_Real aU1, aU2, aV1, aV2; + theSurf->Bounds(aU1, aU2, aV1, aV2); + load(theSurf, aU1, aU2, aV1, aV2); + } + + //! Standard_ConstructionError is raised if theUFirst>theULast or theVFirst>theVLast + void Load(const Handle(Geom_Surface)& theSurf, + const Standard_Real theUFirst, + const Standard_Real theULast, + const Standard_Real theVFirst, + const Standard_Real theVLast, + const Standard_Real theTolU = 0.0, + const Standard_Real theTolV = 0.0) + { + if (theSurf.IsNull()) + { + throw Standard_NullObject("GeomAdaptor_Surface::Load"); + } + if (theUFirst > theULast || theVFirst > theVLast) + { + throw Standard_ConstructionError("GeomAdaptor_Surface::Load"); + } + + load(theSurf, theUFirst, theULast, theVFirst, theVLast, theTolU, theTolV); + } + + const Handle(Geom_Surface)& Surface() const { return mySurface; } + + virtual Standard_Real FirstUParameter() const Standard_OVERRIDE { return myUFirst; } + + virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return myULast; } + + virtual Standard_Real FirstVParameter() const Standard_OVERRIDE { return myVFirst; } + + virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return myVLast; } + + Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE; + + Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE; + + //! Returns the number of U intervals for continuity + //! . May be one if UContinuity(me) >= + Standard_EXPORT Standard_Integer NbUIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Returns the number of V intervals for continuity + //! . May be one if VContinuity(me) >= + Standard_EXPORT Standard_Integer NbVIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Returns the intervals with the requested continuity + //! in the U direction. + Standard_EXPORT void UIntervals(TColStd_Array1OfReal& T, + const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Returns the intervals with the requested continuity + //! in the V direction. + Standard_EXPORT void VIntervals(TColStd_Array1OfReal& T, + const GeomAbs_Shape S) const Standard_OVERRIDE; + + //! Returns a surface trimmed in the U direction + //! equivalent of between + //! parameters and . is used to + //! test for 3d points confusion. + //! If >= + Standard_EXPORT Handle(Adaptor3d_Surface) UTrim(const Standard_Real First, + const Standard_Real Last, + const Standard_Real Tol) const Standard_OVERRIDE; + + //! Returns a surface trimmed in the V direction between + //! parameters and . is used to + //! test for 3d points confusion. + //! If >= + Standard_EXPORT Handle(Adaptor3d_Surface) VTrim(const Standard_Real First, + const Standard_Real Last, + const Standard_Real Tol) const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE; + + //! Computes the point of parameters U,V on the surface. + Standard_EXPORT gp_Pnt Value(const Standard_Real U, + const Standard_Real V) const Standard_OVERRIDE; + + //! Computes the point of parameters U,V on the surface. + Standard_EXPORT void D0(const Standard_Real U, + const Standard_Real V, + gp_Pnt& P) const Standard_OVERRIDE; + + //! Computes the point and the first derivatives on + //! the surface. + //! + //! Warning : On the specific case of BSplineSurface: + //! if the surface is cut in interval of continuity at least C1, + //! the derivatives are computed on the current interval. + //! else the derivatives are computed on the basis surface. + Standard_EXPORT void D1(const Standard_Real U, + const Standard_Real V, + gp_Pnt& P, + gp_Vec& D1U, + gp_Vec& D1V) const Standard_OVERRIDE; + + //! Computes the point, the first and second + //! derivatives on the surface. + //! + //! Warning : On the specific case of BSplineSurface: + //! if the surface is cut in interval of continuity at least C2, + //! the derivatives are computed on the current interval. + //! else the derivatives are computed on the basis surface. + Standard_EXPORT void D2(const Standard_Real U, + const Standard_Real V, + gp_Pnt& P, + gp_Vec& D1U, + gp_Vec& D1V, + gp_Vec& D2U, + gp_Vec& D2V, + gp_Vec& D2UV) const Standard_OVERRIDE; + + //! Computes the point, the first, second and third + //! derivatives on the surface. + //! + //! Warning : On the specific case of BSplineSurface: + //! if the surface is cut in interval of continuity at least C3, + //! the derivatives are computed on the current interval. + //! else the derivatives are computed on the basis surface. + Standard_EXPORT void D3(const Standard_Real U, + const Standard_Real V, + gp_Pnt& P, + gp_Vec& D1U, + gp_Vec& D1V, + gp_Vec& D2U, + gp_Vec& D2V, + gp_Vec& D2UV, + gp_Vec& D3U, + gp_Vec& D3V, + gp_Vec& D3UUV, + gp_Vec& D3UVV) const Standard_OVERRIDE; + + //! Computes the derivative of order Nu in the + //! direction U and Nv in the direction V at the point P(U, V). + //! + //! Warning : On the specific case of BSplineSurface: + //! if the surface is cut in interval of continuity CN, + //! the derivatives are computed on the current interval. + //! else the derivatives are computed on the basis surface. + //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. + Standard_EXPORT gp_Vec DN(const Standard_Real U, + const Standard_Real V, + const Standard_Integer Nu, + const Standard_Integer Nv) const Standard_OVERRIDE; + + //! Returns the parametric U resolution corresponding + //! to the real space resolution . + Standard_EXPORT Standard_Real UResolution(const Standard_Real R3d) const Standard_OVERRIDE; + + //! Returns the parametric V resolution corresponding + //! to the real space resolution . + Standard_EXPORT Standard_Real VResolution(const Standard_Real R3d) const Standard_OVERRIDE; + + //! Returns the type of the surface : Plane, Cylinder, + //! Cone, Sphere, Torus, BezierSurface, + //! BSplineSurface, SurfaceOfRevolution, + //! SurfaceOfExtrusion, OtherSurface + virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurfaceType; } + + Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE; + + Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE; + + Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE; + + Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE; + + Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer UDegree() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbUPoles() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbUKnots() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE; + + //! This will NOT make a copy of the + //! Bezier Surface : If you want to modify + //! the Surface please make a copy yourself + //! Also it will NOT trim the surface to + //! myU/VFirst/Last. + Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE; + + //! This will NOT make a copy of the + //! BSpline Surface : If you want to modify + //! the Surface please make a copy yourself + //! Also it will NOT trim the surface to + //! myU/VFirst/Last. + Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE; + + Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE; + + Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE; + + Standard_EXPORT Handle(Adaptor3d_Curve) BasisCurve() const Standard_OVERRIDE; + + Standard_EXPORT Handle(Adaptor3d_Surface) BasisSurface() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE; + +private: + Standard_EXPORT void Span(const Standard_Integer Side, + const Standard_Integer Ideb, + const Standard_Integer Ifin, + Standard_Integer& OutIdeb, + Standard_Integer& OutIfin, + const Standard_Integer FKIndx, + const Standard_Integer LKIndx) const; + + Standard_EXPORT Standard_Boolean IfUVBound(const Standard_Real U, + const Standard_Real V, + Standard_Integer& Ideb, + Standard_Integer& Ifin, + Standard_Integer& IVdeb, + Standard_Integer& IVfin, + const Standard_Integer USide, + const Standard_Integer VSide) const; + + Standard_EXPORT void load(const Handle(Geom_Surface)& S, + const Standard_Real UFirst, + const Standard_Real ULast, + const Standard_Real VFirst, + const Standard_Real VLast, + const Standard_Real TolU = 0.0, + const Standard_Real TolV = 0.0); + + //! Rebuilds B-spline cache + //! \param theU first parameter to identify the span for caching + //! \param theV second parameter to identify the span for caching + Standard_EXPORT void RebuildCache(const Standard_Real theU, const Standard_Real theV) const; + +protected: + Handle(Geom_Surface) mySurface; + Standard_Real myUFirst; + Standard_Real myULast; + Standard_Real myVFirst; + Standard_Real myVLast; + Standard_Real myTolU; + Standard_Real myTolV; + + Handle(Geom_BSplineSurface) myBSplineSurface; ///< B-spline representation to prevent downcasts + mutable Handle(BSplSLib_Cache) mySurfaceCache; ///< Cached data for B-spline or Bezier surface + + GeomAbs_SurfaceType mySurfaceType; + // clang-format off + Handle(GeomEvaluator_Surface) myNestedEvaluator; ///< Calculates values of nested complex surfaces (offset surface, surface of extrusion or revolution) + // clang-format on +}; + +#endif // _GeomAdaptor_Surface_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_BoundWithSurf.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_BoundWithSurf.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5a0866cb151b55f3cd8462504cc8e13dbc6d2c88 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_BoundWithSurf.hxx @@ -0,0 +1,111 @@ +// Created on: 1995-10-17 +// Created by: Laurent BOURESCHE +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomFill_BoundWithSurf_HeaderFile +#define _GeomFill_BoundWithSurf_HeaderFile + +#include + +#include +#include +#include +class Law_Function; +class gp_Pnt; +class gp_Vec; + +class GeomFill_BoundWithSurf; +DEFINE_STANDARD_HANDLE(GeomFill_BoundWithSurf, GeomFill_Boundary) + +//! Defines a 3d curve as a boundary for a +//! GeomFill_ConstrainedFilling algorithm. +//! This curve is attached to an existing surface. +//! Defines a constrained boundary for filling +//! the computations are done with a CurveOnSurf and a +//! normals field defined by the normalized normal to +//! the surface along the PCurve. +//! Contains fields to allow a reparametrization of curve +//! and normals field. +class GeomFill_BoundWithSurf : public GeomFill_Boundary +{ + +public: + //! Constructs a boundary object defined by the 3d curve CurveOnSurf. + //! The surface to be filled along this boundary will be in the + //! tolerance range defined by Tol3d. + //! What's more, at each point of CurveOnSurf, the angle + //! between the normal to the surface to be filled along this + //! boundary, and the normal to the surface on which + //! CurveOnSurf lies, must not be greater than TolAng. + //! This object is to be used as a boundary for a + //! GeomFill_ConstrainedFilling framework. + //! Warning + //! CurveOnSurf is an adapted curve, that is, an object + //! which is an interface between: + //! - the services provided by a curve lying on a surface from the package Geom + //! - and those required of the curve by the computation algorithm which uses it. + //! The adapted curve is created in the following way: + //! Handle(Geom_Surface) mySurface = ... ; + //! Handle(Geom2d_Curve) myParamCurve = ... ; + //! // where myParamCurve is a 2D curve in the parametric space of the surface mySurface + //! Handle(GeomAdaptor_Surface) + //! Surface = new + //! GeomAdaptor_Surface(mySurface); + //! Handle(Geom2dAdaptor_Curve) + //! ParamCurve = new + //! Geom2dAdaptor_Curve(myParamCurve); + //! CurveOnSurf = Adaptor3d_CurveOnSurface(ParamCurve,Surface); + //! The boundary is then constructed with the CurveOnSurf object: + //! Standard_Real Tol = ... ; + //! Standard_Real TolAng = ... ; + //! myBoundary = GeomFill_BoundWithSurf ( + //! CurveOnSurf, Tol, TolAng ); + Standard_EXPORT GeomFill_BoundWithSurf(const Adaptor3d_CurveOnSurface& CurveOnSurf, + const Standard_Real Tol3d, + const Standard_Real Tolang); + + Standard_EXPORT gp_Pnt Value(const Standard_Real U) const Standard_OVERRIDE; + + Standard_EXPORT void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean HasNormals() const Standard_OVERRIDE; + + Standard_EXPORT virtual gp_Vec Norm(const Standard_Real U) const Standard_OVERRIDE; + + Standard_EXPORT virtual void D1Norm(const Standard_Real U, + gp_Vec& N, + gp_Vec& DN) const Standard_OVERRIDE; + + Standard_EXPORT void Reparametrize(const Standard_Real First, + const Standard_Real Last, + const Standard_Boolean HasDF, + const Standard_Boolean HasDL, + const Standard_Real DF, + const Standard_Real DL, + const Standard_Boolean Rev) Standard_OVERRIDE; + + Standard_EXPORT void Bounds(Standard_Real& First, Standard_Real& Last) const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean IsDegenerated() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(GeomFill_BoundWithSurf, GeomFill_Boundary) + +protected: +private: + Adaptor3d_CurveOnSurface myConS; + Handle(Law_Function) myPar; +}; + +#endif // _GeomFill_BoundWithSurf_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_Filling.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_Filling.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f35a736a9a8d241091c66fdcd41ff6812a2348c1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_Filling.hxx @@ -0,0 +1,57 @@ +// Created on: 1993-09-28 +// Created by: Bruno DUMORTIER +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomFill_Filling_HeaderFile +#define _GeomFill_Filling_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//! Root class for Filling; +class GeomFill_Filling +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomFill_Filling(); + + Standard_EXPORT Standard_Integer NbUPoles() const; + + Standard_EXPORT Standard_Integer NbVPoles() const; + + Standard_EXPORT void Poles(TColgp_Array2OfPnt& Poles) const; + + Standard_EXPORT Standard_Boolean isRational() const; + + Standard_EXPORT void Weights(TColStd_Array2OfReal& Weights) const; + +protected: + Standard_Boolean IsRational; + Handle(TColgp_HArray2OfPnt) myPoles; + Handle(TColStd_HArray2OfReal) myWeights; + +private: +}; + +#endif // _GeomFill_Filling_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_SectionPlacement.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_SectionPlacement.hxx new file mode 100644 index 0000000000000000000000000000000000000000..249a8add6284dd92b8098776601bf9f8d1349ef1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomFill_SectionPlacement.hxx @@ -0,0 +1,102 @@ +// Created on: 1997-12-15 +// Created by: Philippe MANGIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomFill_SectionPlacement_HeaderFile +#define _GeomFill_SectionPlacement_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +class GeomFill_LocationLaw; +class Geom_Curve; +class Geom_Geometry; +class gp_Trsf; +class gp_Mat; +class gp_Vec; + +//! To place section in sweep Function +class GeomFill_SectionPlacement +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L, + const Handle(Geom_Geometry)& Section); + + //! To change the section Law + Standard_EXPORT void SetLocation(const Handle(GeomFill_LocationLaw)& L); + + Standard_EXPORT void Perform(const Standard_Real Tol); + + Standard_EXPORT void Perform(const Handle(Adaptor3d_Curve)& Path, const Standard_Real Tol); + + Standard_EXPORT void Perform(const Standard_Real ParamOnPath, const Standard_Real Tol); + + Standard_EXPORT Standard_Boolean IsDone() const; + + Standard_EXPORT Standard_Real ParameterOnPath() const; + + Standard_EXPORT Standard_Real ParameterOnSection() const; + + Standard_EXPORT Standard_Real Distance() const; + + Standard_EXPORT Standard_Real Angle() const; + + Standard_EXPORT gp_Trsf + Transformation(const Standard_Boolean WithTranslation, + const Standard_Boolean WithCorrection = Standard_False) const; + + //! Compute the Section, in the coordinate system given by + //! the Location Law. + //! If contact between + //!

and is forced. + Standard_EXPORT Handle(Geom_Curve) Section(const Standard_Boolean WithTranslation) const; + + //! Compute the Section, in the coordinate system given by + //! the Location Law. + //! To have the Normal to section equal to the Location + //! Law Normal. If contact between + //!
and is forced. + Standard_EXPORT Handle(Geom_Curve) ModifiedSection(const Standard_Boolean WithTranslation) const; + +protected: +private: + Standard_EXPORT void SectionAxis(const gp_Mat& M, gp_Vec& T, gp_Vec& N, gp_Vec& BN) const; + + Standard_EXPORT Standard_Boolean Choix(const Standard_Real Dist, const Standard_Real Angle) const; + + Standard_Boolean done; + Standard_Boolean isplan; + gp_Ax1 TheAxe; + Standard_Real Gabarit; + Handle(GeomFill_LocationLaw) myLaw; + GeomAdaptor_Curve myAdpSection; + Handle(Geom_Curve) mySection; + Standard_Real SecParam; + Standard_Real PathParam; + Standard_Real Dist; + Standard_Real AngleMax; + Extrema_ExtPC myExt; + Standard_Boolean myIsPoint; + gp_Pnt myPoint; +}; + +#endif // _GeomFill_SectionPlacement_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomInt_LineConstructor.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomInt_LineConstructor.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6a4092fb1393e8491197f8147ac50baf080065a3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomInt_LineConstructor.hxx @@ -0,0 +1,69 @@ +// Created on: 1995-02-07 +// Created by: Jacques GOUSSARD +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomInt_LineConstructor_HeaderFile +#define _GeomInt_LineConstructor_HeaderFile + +#include +#include + +class Adaptor3d_TopolTool; +class IntPatch_Line; + +//! Splits given Line. +class GeomInt_LineConstructor +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + GeomInt_LineConstructor(); + + //! Initializes me by two surfaces and corresponding + //! tools which represent boundaries of surfaces + void Load(const Handle(Adaptor3d_TopolTool)& D1, + const Handle(Adaptor3d_TopolTool)& D2, + const Handle(GeomAdaptor_Surface)& S1, + const Handle(GeomAdaptor_Surface)& S2); + + //! Splits line + Standard_EXPORT void Perform(const Handle(IntPatch_Line)& L); + + //! Returns True if splitting was successful + Standard_Boolean IsDone() const; + + //! Returns number of splits + Standard_Integer NbParts() const; + + //! Return first and last parameters + //! for given index of split + void Part(const Standard_Integer I, Standard_Real& WFirst, Standard_Real& WLast) const; + +protected: + Standard_EXPORT void TreatCircle(const Handle(IntPatch_Line)& aLine, const Standard_Real aTol); + +private: + Standard_Boolean done; + TColStd_SequenceOfReal seqp; + Handle(Adaptor3d_TopolTool) myDom1; + Handle(Adaptor3d_TopolTool) myDom2; + Handle(GeomAdaptor_Surface) myHS1; + Handle(GeomAdaptor_Surface) myHS2; +}; + +#include + +#endif // _GeomInt_LineConstructor_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomLProp_CurveTool.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomLProp_CurveTool.hxx new file mode 100644 index 0000000000000000000000000000000000000000..af224d96692f442c5df838fc0a3eb019f439feec --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomLProp_CurveTool.hxx @@ -0,0 +1,79 @@ +// Created on: 1992-03-26 +// Created by: Herve LEGRAND +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLProp_CurveTool_HeaderFile +#define _GeomLProp_CurveTool_HeaderFile + +#include +#include +#include + +#include +class Geom_Curve; +class gp_Pnt; +class gp_Vec; + +class GeomLProp_CurveTool +{ +public: + DEFINE_STANDARD_ALLOC + + //! Computes the point

of parameter on the curve . + Standard_EXPORT static void Value(const Handle(Geom_Curve)& C, const Standard_Real U, gp_Pnt& P); + + //! Computes the point

and first derivative of + //! parameter on the curve . + Standard_EXPORT static void D1(const Handle(Geom_Curve)& C, + const Standard_Real U, + gp_Pnt& P, + gp_Vec& V1); + + //! Computes the point

, the first derivative and second + //! derivative of parameter on the curve . + Standard_EXPORT static void D2(const Handle(Geom_Curve)& C, + const Standard_Real U, + gp_Pnt& P, + gp_Vec& V1, + gp_Vec& V2); + + //! Computes the point

, the first derivative , the + //! second derivative and third derivative of + //! parameter on the curve . + Standard_EXPORT static void D3(const Handle(Geom_Curve)& C, + const Standard_Real U, + gp_Pnt& P, + gp_Vec& V1, + gp_Vec& V2, + gp_Vec& V3); + + //! returns the order of continuity of the curve . + //! returns 1 : first derivative only is computable + //! returns 2 : first and second derivative only are computable. + //! returns 3 : first, second and third are computable. + Standard_EXPORT static Standard_Integer Continuity(const Handle(Geom_Curve)& C); + + //! returns the first parameter bound of the curve. + Standard_EXPORT static Standard_Real FirstParameter(const Handle(Geom_Curve)& C); + + //! returns the last parameter bound of the curve. + //! FirstParameter must be less than LastParamenter. + Standard_EXPORT static Standard_Real LastParameter(const Handle(Geom_Curve)& C); + +protected: +private: +}; + +#endif // _GeomLProp_CurveTool_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomLib_Interpolate.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomLib_Interpolate.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1448fa83e29b1faa457faebe218a2b5a751da111 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomLib_Interpolate.hxx @@ -0,0 +1,66 @@ +// Created on: 1996-08-30 +// Created by: Xavier BENVENISTE +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomLib_Interpolate_HeaderFile +#define _GeomLib_Interpolate_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +class Geom_BSplineCurve; + +//! this class is used to construct a BSpline curve by +//! interpolation of points at given parameters The +//! continuity of the curve is degree - 1 and the +//! method used when boundary condition are not given +//! is to use odd degrees and null the derivatives on +//! both sides from degree -1 down to (degree+1) / 2 +//! When even degree is given the returned curve is of +//! degree - 1 so that the degree of the curve is odd +class GeomLib_Interpolate +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomLib_Interpolate(const Standard_Integer Degree, + const Standard_Integer NumPoints, + const TColgp_Array1OfPnt& Points, + const TColStd_Array1OfReal& Parameters); + + //! returns if everything went OK + Standard_Boolean IsDone() const; + + //! returns the error type if any + GeomLib_InterpolationErrors Error() const; + + //! returns the interpolated curve of the requested degree + Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const; + +protected: +private: + Handle(Geom_BSplineCurve) myCurve; + Standard_Boolean myIsDone; + GeomLib_InterpolationErrors myError; +}; + +#include + +#endif // _GeomLib_Interpolate_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomPlate_PlateG1Criterion.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomPlate_PlateG1Criterion.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6ba66187d9f9f5b8069468d744ed6895b1832642 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomPlate_PlateG1Criterion.hxx @@ -0,0 +1,56 @@ +// Created on: 1997-03-05 +// Created by: Joelle CHAUVET +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomPlate_PlateG1Criterion_HeaderFile +#define _GeomPlate_PlateG1Criterion_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +class AdvApp2Var_Patch; +class AdvApp2Var_Context; + +//! this class contains a specific G1 criterion for GeomPlate_MakeApprox +class GeomPlate_PlateG1Criterion : public AdvApp2Var_Criterion +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomPlate_PlateG1Criterion( + const TColgp_SequenceOfXY& Data, + const TColgp_SequenceOfXYZ& G1Data, + const Standard_Real Maximum, + const AdvApp2Var_CriterionType Type = AdvApp2Var_Absolute, + const AdvApp2Var_CriterionRepartition Repart = AdvApp2Var_Regular); + + Standard_EXPORT virtual void Value(AdvApp2Var_Patch& P, + const AdvApp2Var_Context& C) const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean IsSatisfied(const AdvApp2Var_Patch& P) const + Standard_OVERRIDE; + +protected: +private: + TColgp_SequenceOfXY myData; + TColgp_SequenceOfXYZ myXYZ; +}; + +#endif // _GeomPlate_PlateG1Criterion_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnots.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnots.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5913e3ff13ac628c69cc9f2125909cd5df84e2d3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnots.hxx @@ -0,0 +1,49 @@ +// Created on: 1993-08-05 +// Created by: Martine LANGLOIS +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomToStep_MakeBSplineSurfaceWithKnots_HeaderFile +#define _GeomToStep_MakeBSplineSurfaceWithKnots_HeaderFile + +#include +#include +#include + +#include +class StepGeom_BSplineSurfaceWithKnots; +class Geom_BSplineSurface; + +//! This class implements the mapping between class +//! BSplineSurface from Geom and the class +//! BSplineSurfaceWithKnots from +//! StepGeom which describes a +//! bspline_Surface_with_knots from Prostep +class GeomToStep_MakeBSplineSurfaceWithKnots : public GeomToStep_Root +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnots( + const Handle(Geom_BSplineSurface)& Bsplin, + const StepData_Factors& theLocalFactors = StepData_Factors()); + + Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnots)& Value() const; + +protected: +private: + Handle(StepGeom_BSplineSurfaceWithKnots) theBSplineSurfaceWithKnots; +}; + +#endif // _GeomToStep_MakeBSplineSurfaceWithKnots_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..0a778d4628ded38d67904dfd71df5235081143b6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx @@ -0,0 +1,52 @@ +// Created on: 1993-06-22 +// Created by: Martine LANGLOIS +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface_HeaderFile +#define _GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface_HeaderFile + +#include +#include +#include + +#include + +class StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface; +class Geom_BSplineSurface; + +//! This class implements the mapping between class +//! BSplineSurface from Geom and the class +//! BSplineSurfaceWithKnotsAndRationalBSplineSurface from +//! StepGeom which describes a +//! rational_bspline_Surface_with_knots from Prostep +class GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface : public GeomToStep_Root +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface( + const Handle(Geom_BSplineSurface)& Bsplin, + const StepData_Factors& theLocalFactors = StepData_Factors()); + + Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)& Value() + const; + +protected: +private: + Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) + theBSplineSurfaceWithKnotsAndRationalBSplineSurface; +}; + +#endif // _GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeEllipse.hxx b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeEllipse.hxx new file mode 100644 index 0000000000000000000000000000000000000000..90ad455e16010b2d6ea34016e135d479e159b81f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/GeomToStep_MakeEllipse.hxx @@ -0,0 +1,59 @@ +// Created on: 1994-09-02 +// Created by: Frederic MAUPAS +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _GeomToStep_MakeEllipse_HeaderFile +#define _GeomToStep_MakeEllipse_HeaderFile + +#include +#include +#include + +#include + +class StepGeom_Ellipse; +class gp_Elips; +class Geom_Ellipse; +class Geom2d_Ellipse; + +//! This class implements the mapping between classes +//! Ellipse from Geom, and Circ from gp, and the class +//! Ellipse from StepGeom which describes a Ellipse from +//! Prostep. +class GeomToStep_MakeEllipse : public GeomToStep_Root +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT GeomToStep_MakeEllipse( + const gp_Elips& C, + const StepData_Factors& theLocalFactors = StepData_Factors()); + + Standard_EXPORT GeomToStep_MakeEllipse( + const Handle(Geom_Ellipse)& C, + const StepData_Factors& theLocalFactors = StepData_Factors()); + + Standard_EXPORT GeomToStep_MakeEllipse( + const Handle(Geom2d_Ellipse)& C, + const StepData_Factors& theLocalFactors = StepData_Factors()); + + Standard_EXPORT const Handle(StepGeom_Ellipse)& Value() const; + +protected: +private: + Handle(StepGeom_Ellipse) theEllipse; +}; + +#endif // _GeomToStep_MakeEllipse_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Geom_ElementarySurface.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Geom_ElementarySurface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c6e607452557f68a33ad57475e1d0d54b2163520 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Geom_ElementarySurface.hxx @@ -0,0 +1,132 @@ +// Created on: 1993-03-10 +// Created by: JCV +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Geom_ElementarySurface_HeaderFile +#define _Geom_ElementarySurface_HeaderFile + +#include +#include + +class Geom_ElementarySurface; +DEFINE_STANDARD_HANDLE(Geom_ElementarySurface, Geom_Surface) + +//! Describes the common behavior of surfaces which +//! have a simple parametric equation in a local +//! coordinate system. The Geom package provides +//! several implementations of concrete elementary surfaces: +//! - the plane, and +//! - four simple surfaces of revolution: the cylinder, the +//! cone, the sphere and the torus. +//! An elementary surface inherits the common behavior +//! of Geom_Surface surfaces. Furthermore, it is located +//! in 3D space by a coordinate system (a gp_Ax3 +//! object) which is also its local coordinate system. +//! Any elementary surface is oriented, i.e. the normal +//! vector is always defined, and gives the same +//! orientation to the surface, at any point on the surface. +//! In topology this property is referred to as the "outside +//! region of the surface". This orientation is related to +//! the two parametric directions of the surface. +//! Rotation of a surface around the "main Axis" of its +//! coordinate system, in the trigonometric sense given +//! by the "X Direction" and the "Y Direction" of the +//! coordinate system, defines the u parametric direction +//! of that elementary surface of revolution. This is the +//! default construction mode. +//! It is also possible, however, to change the orientation +//! of a surface by reversing one of the two parametric +//! directions: use the UReverse or VReverse functions +//! to change the orientation of the normal at any point on the surface. +//! Warning +//! The local coordinate system of an elementary surface +//! is not necessarily direct: +//! - if it is direct, the trigonometric sense defined by its +//! "main Direction" is the same as the trigonometric +//! sense defined by its two vectors "X Direction" and "Y Direction": +//! "main Direction" = "X Direction" ^ "Y Direction" +//! - if it is indirect, the two definitions of trigonometric +//! sense are opposite: +//! "main Direction" = - "X Direction" ^ "Y Direction" +class Geom_ElementarySurface : public Geom_Surface +{ +public: + //! Changes the main axis (ZAxis) of the elementary surface. + //! + //! Raised if the direction of A1 is parallel to the XAxis of the + //! coordinate system of the surface. + void SetAxis(const gp_Ax1& theA1) { pos.SetAxis(theA1); } + + //! Changes the location of the local coordinates system of the + //! surface. + void SetLocation(const gp_Pnt& theLoc) { pos.SetLocation(theLoc); } + + //! Changes the local coordinates system of the surface. + void SetPosition(const gp_Ax3& theAx3) { pos = theAx3; } + + //! Returns the main axis of the surface (ZAxis). + const gp_Ax1& Axis() const { return pos.Axis(); } + + //! Returns the location point of the local coordinate system of the + //! surface. + const gp_Pnt& Location() const { return pos.Location(); } + + //! Returns the local coordinates system of the surface. + const gp_Ax3& Position() const { return pos; } + + //! Reverses the U parametric direction of the surface. + Standard_EXPORT virtual void UReverse() Standard_OVERRIDE; + + //! Return the parameter on the Ureversed surface for + //! the point of parameter U on . + //! + //! me->UReversed()->Value(me->UReversedParameter(U),V) + //! is the same point as + //! me->Value(U,V) + Standard_EXPORT virtual Standard_Real UReversedParameter(const Standard_Real U) const + Standard_OVERRIDE = 0; + + //! Reverses the V parametric direction of the surface. + Standard_EXPORT virtual void VReverse() Standard_OVERRIDE; + + //! Return the parameter on the Vreversed surface for + //! the point of parameter V on . + //! + //! me->VReversed()->Value(U,me->VReversedParameter(V)) + //! is the same point as + //! me->Value(U,V) + Standard_EXPORT virtual Standard_Real VReversedParameter(const Standard_Real V) const + Standard_OVERRIDE = 0; + + //! Returns GeomAbs_CN, the global continuity of any elementary surface. + Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; + + //! Returns True. + Standard_EXPORT Standard_Boolean IsCNu(const Standard_Integer N) const Standard_OVERRIDE; + + //! Returns True. + Standard_EXPORT Standard_Boolean IsCNv(const Standard_Integer N) const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(Geom_ElementarySurface, Geom_Surface) + +protected: + gp_Ax3 pos; +}; + +#endif // _Geom_ElementarySurface_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Buffer.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Buffer.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9633a84e25c1f73c18a6686054183d52776facc7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Buffer.hxx @@ -0,0 +1,343 @@ +// Copyright (c) 2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_Buffer_HeaderFile +#define _Graphic3d_Buffer_HeaderFile + +#include +#include +#include +#include +#include + +//! Type of attribute in Vertex Buffer +enum Graphic3d_TypeOfAttribute +{ + Graphic3d_TOA_POS = 0, //!< vertex position + Graphic3d_TOA_NORM, //!< normal + Graphic3d_TOA_UV, //!< texture coordinates + Graphic3d_TOA_COLOR, //!< per-vertex color + Graphic3d_TOA_CUSTOM, //!< custom attributes +}; + +//! Type of the element in Vertex or Index Buffer +enum Graphic3d_TypeOfData +{ + Graphic3d_TOD_USHORT, //!< unsigned 16-bit integer + Graphic3d_TOD_UINT, //!< unsigned 32-bit integer + Graphic3d_TOD_VEC2, //!< 2-components float vector + Graphic3d_TOD_VEC3, //!< 3-components float vector + Graphic3d_TOD_VEC4, //!< 4-components float vector + Graphic3d_TOD_VEC4UB, //!< 4-components unsigned byte vector + Graphic3d_TOD_FLOAT, //!< float value +}; + +//! Vertex attribute definition. +struct Graphic3d_Attribute +{ + // clang-format off + Graphic3d_TypeOfAttribute Id; //!< attribute identifier in vertex shader, 0 is reserved for vertex position + // clang-format on + Graphic3d_TypeOfData DataType; //!< vec2,vec3,vec4,vec4ub + + Standard_Integer Stride() const { return Stride(DataType); } + + //! @return size of attribute of specified data type + static Standard_Integer Stride(const Graphic3d_TypeOfData theType) + { + switch (theType) + { + case Graphic3d_TOD_USHORT: + return sizeof(unsigned short); + case Graphic3d_TOD_UINT: + return sizeof(unsigned int); + case Graphic3d_TOD_VEC2: + return sizeof(Graphic3d_Vec2); + case Graphic3d_TOD_VEC3: + return sizeof(Graphic3d_Vec3); + case Graphic3d_TOD_VEC4: + return sizeof(Graphic3d_Vec4); + case Graphic3d_TOD_VEC4UB: + return sizeof(Graphic3d_Vec4ub); + case Graphic3d_TOD_FLOAT: + return sizeof(float); + } + return 0; + } +}; + +typedef NCollection_Array1 Graphic3d_Array1OfAttribute; + +//! Buffer of vertex attributes. +class Graphic3d_Buffer : public NCollection_Buffer +{ + DEFINE_STANDARD_RTTIEXT(Graphic3d_Buffer, NCollection_Buffer) +public: + //! Return default vertex data allocator. + Standard_EXPORT static const Handle(NCollection_BaseAllocator)& DefaultAllocator(); + +public: + //! Empty constructor. + Graphic3d_Buffer(const Handle(NCollection_BaseAllocator)& theAlloc) + : NCollection_Buffer(theAlloc), + Stride(0), + NbElements(0), + NbAttributes(0) + { + // + } + + //! Return number of initially allocated elements which can fit into this buffer, + //! while NbElements can be overwritten to smaller value. + Standard_Integer NbMaxElements() const + { + return Stride != 0 ? Standard_Integer(mySize / size_t(Stride)) : 0; + } + + //! @return array of attributes definitions + const Graphic3d_Attribute* AttributesArray() const + { + return (Graphic3d_Attribute*)(myData + mySize); + } + + //! @return attribute definition + const Graphic3d_Attribute& Attribute(const Standard_Integer theAttribIndex) const + { + return AttributesArray()[theAttribIndex]; + } + + //! @return attribute definition + Graphic3d_Attribute& ChangeAttribute(const Standard_Integer theAttribIndex) + { + return *((Graphic3d_Attribute*)(myData + mySize) + theAttribIndex); + } + + //! Find attribute index. + //! @param theAttrib attribute to find + //! @return attribute index or -1 if not found + Standard_Integer FindAttribute(Graphic3d_TypeOfAttribute theAttrib) const + { + for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) + { + const Graphic3d_Attribute& anAttrib = Attribute(anAttribIter); + if (anAttrib.Id == theAttrib) + { + return anAttribIter; + } + } + return -1; + } + + //! @name data accessors for interleaved array +public: + //! @return data offset to specified attribute + Standard_Integer AttributeOffset(const Standard_Integer theAttribIndex) const + { + Standard_Integer anOffset = 0; + for (Standard_Integer anAttribIter = 0; anAttribIter < theAttribIndex; ++anAttribIter) + { + anOffset += Graphic3d_Attribute::Stride(Attribute(anAttribIter).DataType); + } + return anOffset; + } + + //! @return data for specified attribute + const Standard_Byte* Data(const Standard_Integer theAttribIndex) const + { + return myData + AttributeOffset(theAttribIndex); + } + + //! @return data for specified attribute + Standard_Byte* ChangeData(const Standard_Integer theAttribIndex) + { + return myData + AttributeOffset(theAttribIndex); + } + + //! Access specified element. + inline const Standard_Byte* value(const Standard_Integer theElem) const + { + return myData + Stride * size_t(theElem); + } + + //! Access specified element. + inline Standard_Byte* changeValue(const Standard_Integer theElem) + { + return myData + Stride * size_t(theElem); + } + + //! Access element with specified position and type. + template + inline const Type_t& Value(const Standard_Integer theElem) const + { + return *reinterpret_cast(value(theElem)); + } + + //! Access element with specified position and type. + template + inline Type_t& ChangeValue(const Standard_Integer theElem) + { + return *reinterpret_cast(changeValue(theElem)); + } + + //! @name general accessors +public: + using NCollection_Buffer::ChangeData; + using NCollection_Buffer::Data; + + //! Return the attribute data with stride size specific to this attribute. + //! @param theAttrib attribute to find + //! @param theAttribIndex index of found attribute + //! @param theAttribStride stride in bytes between values of this attribute within returned data + //! pointer + Standard_Byte* ChangeAttributeData(Graphic3d_TypeOfAttribute theAttrib, + Standard_Integer& theAttribIndex, + Standard_Size& theAttribStride) + { + return (Standard_Byte*)AttributeData(theAttrib, theAttribIndex, theAttribStride); + } + + //! Return the attribute data with stride size specific to this attribute. + //! @param theAttrib attribute to find + //! @param theAttribIndex index of found attribute + //! @param theAttribStride stride in bytes between values of this attribute within returned data + //! pointer + const Standard_Byte* AttributeData(Graphic3d_TypeOfAttribute theAttrib, + Standard_Integer& theAttribIndex, + Standard_Size& theAttribStride) const + { + const Standard_Byte* aDataPtr = Data(); + if (IsInterleaved()) + { + for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) + { + const Graphic3d_Attribute& anAttrib = Attribute(anAttribIter); + const Standard_Size anAttribStride = Graphic3d_Attribute::Stride(anAttrib.DataType); + if (anAttrib.Id == theAttrib) + { + theAttribIndex = anAttribIter; + theAttribStride = Stride; + return aDataPtr; + } + + aDataPtr += anAttribStride; + } + } + else + { + const Standard_Integer aNbMaxVerts = NbMaxElements(); + for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) + { + const Graphic3d_Attribute& anAttrib = Attribute(anAttribIter); + const Standard_Size anAttribStride = Graphic3d_Attribute::Stride(anAttrib.DataType); + if (anAttrib.Id == theAttrib) + { + theAttribIndex = anAttribIter; + theAttribStride = anAttribStride; + return aDataPtr; + } + + aDataPtr += anAttribStride * aNbMaxVerts; + } + } + return NULL; + } + +public: + //! Release buffer. + void release() + { + Free(); + Stride = 0; + NbElements = 0; + NbAttributes = 0; + } + + //! Allocates new empty array + bool Init(const Standard_Integer theNbElems, + const Graphic3d_Attribute* theAttribs, + const Standard_Integer theNbAttribs) + { + release(); + Standard_Integer aStride = 0; + for (Standard_Integer anAttribIter = 0; anAttribIter < theNbAttribs; ++anAttribIter) + { + const Graphic3d_Attribute& anAttrib = theAttribs[anAttribIter]; + aStride += anAttrib.Stride(); + } + if (aStride == 0) + { + return false; + } + + Stride = aStride; + NbElements = theNbElems; + NbAttributes = theNbAttribs; + if (NbElements != 0) + { + const size_t aDataSize = size_t(Stride) * size_t(NbElements); + if (!Allocate(aDataSize + sizeof(Graphic3d_Attribute) * NbAttributes)) + { + release(); + return false; + } + + mySize = aDataSize; + for (Standard_Integer anAttribIter = 0; anAttribIter < theNbAttribs; ++anAttribIter) + { + ChangeAttribute(anAttribIter) = theAttribs[anAttribIter]; + } + } + return true; + } + + //! Allocates new empty array + bool Init(const Standard_Integer theNbElems, const Graphic3d_Array1OfAttribute& theAttribs) + { + return Init(theNbElems, &theAttribs.First(), theAttribs.Size()); + } + +public: + //! Flag indicating that attributes in the buffer are interleaved; TRUE by default. + //! Requires sub-classing for creating a non-interleaved buffer (advanced usage). + virtual Standard_Boolean IsInterleaved() const { return Standard_True; } + + //! Return TRUE if data can be invalidated; FALSE by default. + //! Requires sub-classing for creating a mutable buffer (advanced usage). + virtual Standard_Boolean IsMutable() const { return Standard_False; } + + //! Return invalidated range; EMPTY by default. + //! Requires sub-classing for creating a mutable buffer (advanced usage). + virtual Graphic3d_BufferRange InvalidatedRange() const { return Graphic3d_BufferRange(); } + + //! Reset invalidated range. + //! Requires sub-classing for creating a mutable buffer (advanced usage). + virtual void Validate() {} + + //! Invalidate entire buffer. + virtual void Invalidate() {} + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + +public: + // clang-format off + Standard_Integer Stride; //!< the distance to the attributes of the next vertex within interleaved array + Standard_Integer NbElements; //!< number of the elements (@sa NbMaxElements() specifying the number of initially allocated number of elements) + // clang-format on + Standard_Integer NbAttributes; //!< number of vertex attributes +}; + +DEFINE_STANDARD_HANDLE(Graphic3d_Buffer, NCollection_Buffer) + +#endif // _Graphic3d_Buffer_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_GraphicDriver.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_GraphicDriver.hxx new file mode 100644 index 0000000000000000000000000000000000000000..868ea751d555b19a0f1dadc93569eb80dd6e9b01 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_GraphicDriver.hxx @@ -0,0 +1,166 @@ +// Created on: 1997-01-28 +// Created by: CAL +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_GraphicDriver_HeaderFile +#define _Graphic3d_GraphicDriver_HeaderFile + +#include +#include +#include +#include +#include +#include + +class Aspect_DisplayConnection; +class Aspect_Window; +class Graphic3d_CView; +class Graphic3d_Layer; +class Graphic3d_StructureManager; +class TCollection_AsciiString; + +DEFINE_STANDARD_HANDLE(Graphic3d_GraphicDriver, Standard_Transient) + +//! This class allows the definition of a graphic driver +//! for 3d interface (currently only OpenGl driver is used). +class Graphic3d_GraphicDriver : public Standard_Transient +{ + DEFINE_STANDARD_RTTIEXT(Graphic3d_GraphicDriver, Standard_Transient) +public: + //! Request limit of graphic resource of specific type. + virtual Standard_Integer InquireLimit(const Graphic3d_TypeOfLimit theType) const = 0; + + //! Request maximum number of active light sources supported by driver and hardware. + Standard_Integer InquireLightLimit() const + { + return InquireLimit(Graphic3d_TypeOfLimit_MaxNbLights); + } + + //! Request maximum number of active clipping planes supported by driver and hardware. + Standard_Integer InquirePlaneLimit() const + { + return InquireLimit(Graphic3d_TypeOfLimit_MaxNbClipPlanes); + } + + //! Request maximum number of views supported by driver. + Standard_Integer InquireViewLimit() const + { + return InquireLimit(Graphic3d_TypeOfLimit_MaxNbViews); + } + +public: + //! Creates new empty graphic structure + virtual Handle(Graphic3d_CStructure) CreateStructure( + const Handle(Graphic3d_StructureManager)& theManager) = 0; + + //! Removes structure from graphic driver and releases its resources. + virtual void RemoveStructure(Handle(Graphic3d_CStructure)& theCStructure) = 0; + + //! Creates new view for this graphic driver. + virtual Handle(Graphic3d_CView) CreateView(const Handle(Graphic3d_StructureManager)& theMgr) = 0; + + //! Removes view from graphic driver and releases its resources. + virtual void RemoveView(const Handle(Graphic3d_CView)& theView) = 0; + + //! enables/disables usage of OpenGL vertex buffer arrays while drawing primitive arrays + virtual void EnableVBO(const Standard_Boolean status) = 0; + + //! Returns TRUE if vertical synchronization with display refresh rate (VSync) should be used; + //! TRUE by default. + virtual bool IsVerticalSync() const = 0; + + //! Set if vertical synchronization with display refresh rate (VSync) should be used. + virtual void SetVerticalSync(bool theToEnable) = 0; + + //! Returns information about GPU memory usage. + virtual Standard_Boolean MemoryInfo(Standard_Size& theFreeBytes, + TCollection_AsciiString& theInfo) const = 0; + + virtual Standard_ShortReal DefaultTextHeight() const = 0; + + //! Computes text width. + virtual void TextSize(const Handle(Graphic3d_CView)& theView, + const Standard_CString theText, + const Standard_ShortReal theHeight, + Standard_ShortReal& theWidth, + Standard_ShortReal& theAscent, + Standard_ShortReal& theDescent) const = 0; + + //! Adds a layer to all views. + //! To add a structure to desired layer on display it is necessary to set the layer ID for the + //! structure. + //! @param[in] theNewLayerId id of new layer, should be > 0 (negative values are reserved for + //! default layers). + //! @param[in] theSettings new layer settings + //! @param[in] theLayerAfter id of layer to append new layer before + Standard_EXPORT virtual void InsertLayerBefore(const Graphic3d_ZLayerId theNewLayerId, + const Graphic3d_ZLayerSettings& theSettings, + const Graphic3d_ZLayerId theLayerAfter) = 0; + + //! Adds a layer to all views. + //! @param[in] theNewLayerId id of new layer, should be > 0 (negative values are reserved for + //! default layers). + //! @param[in] theSettings new layer settings + //! @param[in] theLayerBefore id of layer to append new layer after + Standard_EXPORT virtual void InsertLayerAfter(const Graphic3d_ZLayerId theNewLayerId, + const Graphic3d_ZLayerSettings& theSettings, + const Graphic3d_ZLayerId theLayerBefore) = 0; + + //! Removes Z layer. All structures displayed at the moment in layer will be displayed in + //! default layer (the bottom-level z layer). By default, there are always default + //! bottom-level layer that can't be removed. The passed theLayerId should be not less than 0 + //! (reserved for default layers that can not be removed). + Standard_EXPORT virtual void RemoveZLayer(const Graphic3d_ZLayerId theLayerId) = 0; + + //! Returns list of Z layers defined for the graphical driver. + Standard_EXPORT virtual void ZLayers(TColStd_SequenceOfInteger& theLayerSeq) const; + + //! Sets the settings for a single Z layer. + Standard_EXPORT virtual void SetZLayerSettings(const Graphic3d_ZLayerId theLayerId, + const Graphic3d_ZLayerSettings& theSettings) = 0; + + //! Returns the settings of a single Z layer. + Standard_EXPORT virtual const Graphic3d_ZLayerSettings& ZLayerSettings( + const Graphic3d_ZLayerId theLayerId) const; + + //! Returns view associated with the window if it is exists and is activated. + //! Returns Standard_True if the view associated to the window exists. + virtual Standard_Boolean ViewExists(const Handle(Aspect_Window)& theWindow, + Handle(Graphic3d_CView)& theView) = 0; + + //! returns Handle to display connection + Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const; + + //! Returns a new identification number for a new structure. + Standard_EXPORT Standard_Integer NewIdentification(); + + //! Frees the identifier of a structure. + Standard_EXPORT void RemoveIdentification(const Standard_Integer theId); + + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + +protected: + //! Initializes the Driver + Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp); + +protected: + Handle(Aspect_DisplayConnection) myDisplayConnection; + Aspect_GenId myStructGenId; + NCollection_List myLayers; + NCollection_DataMap myLayerIds; +}; + +#endif // _Graphic3d_GraphicDriver_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_MapOfStructure.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_MapOfStructure.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b90cb1cb1cf07df5634f2d9c4c7145ce2a2aa62f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_MapOfStructure.hxx @@ -0,0 +1,24 @@ +// Created on: 2014-12-18 +// Created by: Kirill Gavrilov +// Copyright (c) 2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_MapOfStructure +#define _Graphic3d_MapOfStructure + +#include + +class Graphic3d_Structure; +typedef NCollection_Map Graphic3d_MapOfStructure; + +#endif // _Graphic3d_MapOfStructure diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_PBRMaterial.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_PBRMaterial.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9cd3d06b60c7a8aacf68638ef8cfe9eaa3babb91 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_PBRMaterial.hxx @@ -0,0 +1,198 @@ +// Author: Ilya Khramov +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_PBRMaterial_HeaderFile +#define _Graphic3d_PBRMaterial_HeaderFile + +#include +#include +#include +#include +#include + +//! Class implementing Metallic-Roughness physically based material definition +class Graphic3d_PBRMaterial +{ +public: + //! Creates new physically based material in Metallic-Roughness system. + //! 'metallic' parameter is 0 by default. + //! 'roughness' parameter is 1 by default. + //! 'color' parameter is (0, 0, 0) by default. + //! 'alpha' parameter is 1 by default. + //! 'IOR' parameter is 1.5 by default. + //! 'emission' parameter is (0, 0, 0) by default. + Standard_EXPORT Graphic3d_PBRMaterial(); + + //! Creates new physically based material in Metallic-Roughness system from Graphic3d_BSDF. + Standard_EXPORT Graphic3d_PBRMaterial(const Graphic3d_BSDF& theBSDF); + + //! Returns material's metallic coefficient in [0, 1] range. + //! 1 for metals and 0 for dielectrics. + //! It is preferable to be exactly 0 or 1. Average values are needed for textures mixing in + //! shader. + Standard_ShortReal Metallic() const { return myMetallic; } + + //! Modifies metallic coefficient of material in [0, 1] range. + Standard_EXPORT void SetMetallic(Standard_ShortReal theMetallic); + + //! Maps roughness from [0, 1] to [MinRoughness, 1] for calculations. + Standard_EXPORT static Standard_ShortReal Roughness(Standard_ShortReal theNormalizedRoughness); + + //! Returns real value of roughness in [MinRoughness, 1] range for calculations. + Standard_ShortReal Roughness() const { return Roughness(myRoughness); } + + //! Returns roughness mapping parameter in [0, 1] range. + //! Roughness is defined in [0, 1] for handful material settings + //! and is mapped to [MinRoughness, 1] for calculations. + Standard_ShortReal NormalizedRoughness() const { return myRoughness; } + + //! Modifies roughness coefficient of material in [0, 1] range. + Standard_EXPORT void SetRoughness(Standard_ShortReal theRoughness); + + //! Returns index of refraction in [1, 3] range. + Standard_ShortReal IOR() const { return myIOR; } + + //! Modifies index of refraction in [1, 3] range. + //! In practice affects only on non-metal materials reflection possibilities. + Standard_EXPORT void SetIOR(Standard_ShortReal theIOR); + + //! Returns albedo color with alpha component of material. + const Quantity_ColorRGBA& Color() const { return myColor; } + + //! Modifies albedo color with alpha component. + Standard_EXPORT void SetColor(const Quantity_ColorRGBA& theColor); + + //! Modifies only albedo color. + Standard_EXPORT void SetColor(const Quantity_Color& theColor); + + //! Returns alpha component in range [0, 1]. + Standard_ShortReal Alpha() const { return myColor.Alpha(); }; + + //! Modifies alpha component. + Standard_EXPORT void SetAlpha(Standard_ShortReal theAlpha); + + //! Returns light intensity emitted by material. + //! Values are greater or equal 0. + Graphic3d_Vec3 Emission() const { return myEmission; } + + //! Modifies light intensity emitted by material. + Standard_EXPORT void SetEmission(const Graphic3d_Vec3& theEmission); + + //! Generates material in Metallic-Roughness system from Graphic3d_BSDF. + Standard_EXPORT void SetBSDF(const Graphic3d_BSDF& theBSDF); + +public: + //! PBR materials comparison operator. + Standard_Boolean operator==(const Graphic3d_PBRMaterial& theOther) const + { + return (myMetallic == theOther.myMetallic) && (myRoughness == theOther.myRoughness) + && (myIOR == theOther.myIOR) && (myColor == theOther.myColor) + && (myEmission == theOther.myEmission); + } + +public: + //! Generates 2D look up table of scale and bias for fresnell zero coefficient. + //! It is needed for calculation reflectance part of environment lighting. + //! @param[out] theLUT table storage (must be Image_Format_RGF). + //! @param[in] theNbIntegralSamples number of importance samples in hemisphere integral + //! calculation for every table item. + Standard_EXPORT static void GenerateEnvLUT(const Handle(Image_PixMap)& theLUT, + unsigned int theNbIntegralSamples = 1024); + + //! Compute material roughness from common material (specular color + shininess). + //! @param[in] theSpecular specular color + //! @param[in] theShiness normalized shininess coefficient within [0..1] range + //! @return roughness within [0..1] range + Standard_EXPORT static Standard_ShortReal RoughnessFromSpecular(const Quantity_Color& theSpecular, + const Standard_Real theShiness); + + //! Compute material metallicity from common material (specular color). + //! @param[in] theSpecular specular color + //! @return metallicity within [0..1] range + static Standard_ShortReal MetallicFromSpecular(const Quantity_Color& theSpecular) + { + return ((Graphic3d_Vec3)theSpecular).maxComp(); + } + +public: + //! Roughness cannot be 0 in real calculations, so it returns minimal achievable level of + //! roughness in practice + static Standard_ShortReal MinRoughness() { return 0.01f; } + +public: + //! Shows how much times less samples can be used in certain roughness value specular IBL map + //! generation in compare with samples number for map with roughness of 1. Specular IBL maps with + //! less roughness values have higher resolution but require less samples for the same quality of + //! baking. So that reducing samples number is good strategy to improve performance of baking. The + //! samples number for specular IBL map with roughness of 1 (the maximum possible samples number) + //! is expected to be defined as baking parameter. Samples number for other roughness values can + //! be calculated by multiplication origin samples number by this factor. + //! @param theProbability value from 0 to 1 controlling strength of samples reducing. + //! Bigger values result in slower reduction to provide better quality but worse performance. + //! Value of 1 doesn't affect at all so that 1 will be returned (it can be used to disable + //! reduction strategy). + //! @param theRoughness roughness value of current generated specular IBL map (from 0 to 1). + //! @return factor to calculate number of samples for current specular IBL map baking. + //! Be aware! It has no obligation to return 1 in case of roughness of 1. + //! Be aware! It produces poor quality with small number of origin samples. In that case it is + //! recommended to be disabled. + Standard_EXPORT static Standard_ShortReal SpecIBLMapSamplesFactor( + Standard_ShortReal theProbability, + Standard_ShortReal theRoughness); + + //! Dumps the content of me into the stream + Standard_EXPORT void DumpJson(Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; + +private: + //! Calculates geometry factor of Cook-Torrance BRDF using Smith formula. + static Standard_ShortReal lutGenGeometryFactor(Standard_ShortReal theCosL, + Standard_ShortReal theCosV, + Standard_ShortReal theRoughness); + + //! Generates quasi-random point from Hammersley set. + //! @param theNumber number of point + //! @param theCount size of Hammersley set + static Graphic3d_Vec2 lutGenHammersley(unsigned int theNumber, unsigned int theCount); + + //! Generates only cosine theta of direction in spherical coordinates system + //! according to micro facet distribution function from Cook-Torrance BRDF. + static Standard_ShortReal lutGenImportanceSampleCosTheta( + Standard_ShortReal theHammerslayPointComponent, + Standard_ShortReal theRoughness); + + //! Generates direction using point from Hammersley set + //! according to micro facet distribution function from Cook-Torrance BRDF. + static Graphic3d_Vec3 lutGenImportanceSample(const Graphic3d_Vec2& theHammerslayPoint, + Standard_ShortReal theRoughness); + + //! Generates vector using cosine of angle between up vector (normal in hemisphere) + //! and desired vector. + //! x component for resulting vector will be zero. + static Graphic3d_Vec3 lutGenView(Standard_ShortReal theCosV); + + //! Returns reflected vector according axis. + //! @param theVector vector is needed to be reflected. + //! @param theAxis axis of reflection. + static Graphic3d_Vec3 lutGenReflect(const Graphic3d_Vec3& theVector, + const Graphic3d_Vec3& theAxis); + +private: + Quantity_ColorRGBA myColor; //!< albedo color with alpha component [0, 1] + Standard_ShortReal myMetallic; //!< metallic coefficient of material [0, 1] + Standard_ShortReal myRoughness; //!< roughness coefficient of material [0, 1] + Graphic3d_Vec3 myEmission; //!< light intensity emitted by material [>= 0] + Standard_ShortReal myIOR; //!< index of refraction [1, 3] +}; + +#endif // _Graphic3d_PBRMaterial_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Text.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Text.hxx new file mode 100644 index 0000000000000000000000000000000000000000..68521b9b8f910ff8998cb74e200759de6bd57a44 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Text.hxx @@ -0,0 +1,135 @@ +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_Text_HeaderFile +#define _Graphic3d_Text_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include + +//! This class allows the definition of a text object for display. +//! The text might be defined in one of ways, using: +//! - text value and position, +//! - text value, orientation and the state whether the text uses position as point of attach. +//! - text formatter. Formatter contains text, height and alignment parameter. +//! +//! This class also has parameters of the text height and H/V alignments. +//! Custom formatting is available using Font_TextFormatter. +class Graphic3d_Text : public Standard_Transient +{ + DEFINE_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient) + +public: + //! Creates default text parameters. + Standard_EXPORT Graphic3d_Text(const Standard_ShortReal theHeight); + + //! Destructor. + virtual ~Graphic3d_Text() {} + + //! Returns text value. + const NCollection_String& Text() const { return myText; } + + //! Sets text value. + void SetText(const NCollection_String& theText) { myText = theText; } + + //! Sets text value. + void SetText(const TCollection_AsciiString& theText) { myText = theText.ToCString(); } + + //! Sets text value. + void SetText(Standard_CString theText) { myText = theText; } + + //! @return text formatter; NULL by default, which means standard text formatter will be used. + const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; } + + //! Setup text default formatter for text within this context. + void SetTextFormatter(const Handle(Font_TextFormatter)& theFormatter) + { + myFormatter = theFormatter; + } + + //! The 3D point of attachment is projected. + //! If the orientation is defined, the text is written in the plane of projection. + const gp_Pnt& Position() const { return myOrientation.Location(); } + + //! Sets text point. + void SetPosition(const gp_Pnt& thePoint) { myOrientation.SetLocation(thePoint); } + + //! Returns text orientation in 3D space. + const gp_Ax2& Orientation() const { return myOrientation; } + + //! Returns true if the text is filled by a point + Standard_Boolean HasPlane() const { return myHasPlane; } + + //! Sets text orientation in 3D space. + Standard_EXPORT void SetOrientation(const gp_Ax2& theOrientation); + + //! Reset text orientation in 3D space. + Standard_EXPORT void ResetOrientation(); + + //! Returns true if the text has an anchor point + Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchor; } + + //! Returns true if the text has an anchor point + void SetOwnAnchorPoint(const Standard_Boolean theHasOwnAnchor) + { + myHasOwnAnchor = theHasOwnAnchor; + } + + //! Sets height of text. (Relative to the Normalized Projection Coordinates (NPC) Space). + Standard_ShortReal Height() const { return myHeight; } + + //! Returns height of text + void SetHeight(const Standard_ShortReal theHeight) { myHeight = theHeight; } + + //! Returns horizontal alignment of text. + Graphic3d_HorizontalTextAlignment HorizontalAlignment() const { return myHAlign; } + + //! Sets horizontal alignment of text. + void SetHorizontalAlignment(const Graphic3d_HorizontalTextAlignment theJustification) + { + myHAlign = theJustification; + } + + //! Returns vertical alignment of text. + Graphic3d_VerticalTextAlignment VerticalAlignment() const { return myVAlign; } + + //! Sets vertical alignment of text. + void SetVerticalAlignment(const Graphic3d_VerticalTextAlignment theJustification) + { + myVAlign = theJustification; + } + +protected: + Handle(Font_TextFormatter) myFormatter; //!< text formatter + + NCollection_String myText; //!< text value + gp_Ax2 myOrientation; //!< Text orientation in 3D space. + + Standard_ShortReal myHeight; //!< height of text + Graphic3d_HorizontalTextAlignment myHAlign; //!< horizontal alignment + Graphic3d_VerticalTextAlignment myVAlign; //!< vertical alignment + + Standard_Boolean myHasPlane; //!< Check if text have orientation in 3D space. + Standard_Boolean myHasOwnAnchor; //!< flag if text uses position as point of attach +}; + +DEFINE_STANDARD_HANDLE(Graphic3d_Text, Standard_Transient) + +#endif // _Graphic3d_Text_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2D.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2D.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7072e70da25aaeb8cd39fee83669b1cef3120fd9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2D.hxx @@ -0,0 +1,72 @@ +// Created on: 1997-07-28 +// Created by: Pierre CHALAMET +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_Texture2D_HeaderFile +#define _Graphic3d_Texture2D_HeaderFile + +#include +#include + +//! This abstract class for managing 2D textures +class Graphic3d_Texture2D : public Graphic3d_TextureMap +{ + DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2D, Graphic3d_TextureMap) +public: + //! Returns the number of predefined textures. + Standard_EXPORT static Standard_Integer NumberOfTextures(); + + //! Returns the name of the predefined texture of rank + Standard_EXPORT static TCollection_AsciiString TextureName(const Standard_Integer theRank); + +public: + //! Creates a texture from a file. + //! MipMaps levels will be automatically generated if needed. + Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName); + + //! Creates a texture from a predefined texture name set. + //! MipMaps levels will be automatically generated if needed. + Standard_EXPORT Graphic3d_Texture2D(const Graphic3d_NameOfTexture2D theNOT); + + //! Creates a texture from the pixmap. + //! MipMaps levels will be automatically generated if needed. + Standard_EXPORT Graphic3d_Texture2D(const Handle(Image_PixMap)& thePixMap); + + //! Returns the name of the predefined textures or NOT_2D_UNKNOWN + //! when the name is given as a filename. + Standard_EXPORT Graphic3d_NameOfTexture2D Name() const; + + //! Assign new image to the texture. + //! Note that this method does not invalidate already uploaded resources - consider calling + //! ::UpdateRevision() if needed. + Standard_EXPORT void SetImage(const Handle(Image_PixMap)& thePixMap); + +protected: + Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName, + const Graphic3d_TypeOfTexture theType); + + Standard_EXPORT Graphic3d_Texture2D(const Graphic3d_NameOfTexture2D theName, + const Graphic3d_TypeOfTexture theType); + + Standard_EXPORT Graphic3d_Texture2D(const Handle(Image_PixMap)& thePixMap, + const Graphic3d_TypeOfTexture theType); + +protected: + Graphic3d_NameOfTexture2D myName; +}; + +DEFINE_STANDARD_HANDLE(Graphic3d_Texture2D, Graphic3d_TextureMap) + +#endif // _Graphic3d_Texture2D_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2Dmanual.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2Dmanual.hxx new file mode 100644 index 0000000000000000000000000000000000000000..26825fb04bc1d9c5ab0293ed166cba664be766ec --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_Texture2Dmanual.hxx @@ -0,0 +1,26 @@ +// Created on: 1997-07-28 +// Created by: Pierre CHALAMET +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_Texture2Dmanual_HeaderFile +#define _Graphic3d_Texture2Dmanual_HeaderFile + +#include +#include + +Standard_DEPRECATED("Deprecated alias to Graphic3d_Texture2D") +typedef Graphic3d_Texture2D Graphic3d_Texture2Dmanual; + +#endif // _Graphic3d_Texture2Dmanual_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_TypeOfAnswer.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_TypeOfAnswer.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1f72e9a403533483941f65bfcfc8f11e606e81a4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Graphic3d_TypeOfAnswer.hxx @@ -0,0 +1,33 @@ +// Created on: 1991-10-07 +// Created by: NW,JPB,CAL +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Graphic3d_TypeOfAnswer_HeaderFile +#define _Graphic3d_TypeOfAnswer_HeaderFile + +//! The answer of the method AcceptDisplay +//! AcceptDisplay means is it possible to display the +//! specified structure in the specified view ? +//! TOA_YES yes +//! TOA_NO no +//! TOA_COMPUTE yes but we have to compute the representation +enum Graphic3d_TypeOfAnswer +{ + Graphic3d_TOA_YES, + Graphic3d_TOA_NO, + Graphic3d_TOA_COMPUTE +}; + +#endif // _Graphic3d_TypeOfAnswer_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b4c5d49c3d490d0db5cee41653d02f4e0bd7bbcc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter.hxx @@ -0,0 +1,79 @@ +// Created on: 1992-10-14 +// Created by: Christophe MARION +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter_HeaderFile +#define _HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter_HeaderFile + +#include +#include +#include + +#include +#include +#include +class HLRBRep_CurveTool; +class HLRBRep_TheProjPCurOfCInter; +class HLRBRep_TheIntPCurvePCurveOfCInter; +class HLRBRep_ThePolygon2dOfTheIntPCurvePCurveOfCInter; +class HLRBRep_TheDistBetweenPCurvesOfTheIntPCurvePCurveOfCInter; + +class HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter( + const Standard_Address& C1, + const Standard_Address& C2, + const Standard_Real Tol); + + Standard_EXPORT void Perform(const HLRBRep_ThePolygon2dOfTheIntPCurvePCurveOfCInter& Poly1, + const HLRBRep_ThePolygon2dOfTheIntPCurvePCurveOfCInter& Poly2, + Standard_Integer& NumSegOn1, + Standard_Integer& NumSegOn2, + Standard_Real& ParamOnSeg1, + Standard_Real& ParamOnSeg2); + + Standard_EXPORT void Perform(const Standard_Real Uo, + const Standard_Real Vo, + const Standard_Real UInf, + const Standard_Real VInf, + const Standard_Real USup, + const Standard_Real VSup); + + Standard_EXPORT Standard_Integer NbRoots() const; + + Standard_EXPORT void Roots(Standard_Real& U, Standard_Real& V); + + Standard_EXPORT Standard_Boolean AnErrorOccurred() const; + +protected: +private: + Standard_EXPORT void MathPerform(); + + Standard_Boolean done; + Standard_Integer nbroots; + Standard_Real myTol; + HLRBRep_TheDistBetweenPCurvesOfTheIntPCurvePCurveOfCInter FctDist; + math_Vector ToleranceVector; + math_Vector BInfVector; + math_Vector BSupVector; + math_Vector StartingPoint; + math_Vector Root; + Standard_Boolean anErrorOccurred; +}; + +#endif // _HLRBRep_ExactIntersectionPointOfTheIntPCurvePCurveOfCInter_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_FaceData.lxx b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_FaceData.lxx new file mode 100644 index 0000000000000000000000000000000000000000..c804c7ca89a4658b4d94c73fe1f299724468dc75 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_FaceData.lxx @@ -0,0 +1,385 @@ +// Created on: 1997-04-17 +// Created by: Christophe MARION +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function : Selected +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Selected() const +{ + return (myFlags & (Standard_Integer)FMaskSelected) != 0; +} + +//======================================================================= +// function : Selected +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Selected(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskSelected; + else + myFlags &= ~((Standard_Integer)FMaskSelected); +} + +//======================================================================= +// function : Back +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Back() const +{ + return (myFlags & (Standard_Integer)FMaskBack) != 0; +} + +//======================================================================= +// function : Back +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Back(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskBack; + else + myFlags &= ~((Standard_Integer)FMaskBack); +} + +//======================================================================= +// function : Side +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Side() const +{ + return (myFlags & (Standard_Integer)FMaskSide) != 0; +} + +//======================================================================= +// function : Side +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Side(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskSide; + else + myFlags &= ~((Standard_Integer)FMaskSide); +} + +//======================================================================= +// function : Closed +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Closed() const +{ + return (myFlags & (Standard_Integer)FMaskClosed) != 0; +} + +//======================================================================= +// function : Closed +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Closed(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskClosed; + else + myFlags &= ~((Standard_Integer)FMaskClosed); +} + +//======================================================================= +// function : Hiding +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Hiding() const +{ + return (myFlags & (Standard_Integer)FMaskHiding) != 0; +} + +//======================================================================= +// function : Hiding +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Hiding(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskHiding; + else + myFlags &= ~((Standard_Integer)FMaskHiding); +} + +//======================================================================= +// function : Simple +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Simple() const +{ + return (myFlags & (Standard_Integer)FMaskSimple) != 0; +} + +//======================================================================= +// function : Simple +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Simple(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskSimple; + else + myFlags &= ~((Standard_Integer)FMaskSimple); +} + +//======================================================================= +// function : Cut +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Cut() const +{ + return (myFlags & (Standard_Integer)FMaskCut) != 0; +} + +//======================================================================= +// function : Cut +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Cut(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskCut; + else + myFlags &= ~((Standard_Integer)FMaskCut); +} + +//======================================================================= +// function : WithOutL +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::WithOutL() const +{ + return (myFlags & (Standard_Integer)FMaskWithOutL) != 0; +} + +//======================================================================= +// function : WithOutL +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::WithOutL(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskWithOutL; + else + myFlags &= ~((Standard_Integer)FMaskWithOutL); +} + +//======================================================================= +// function : Plane +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Plane() const +{ + return (myFlags & (Standard_Integer)FMaskPlane) != 0; +} + +//======================================================================= +// function : Plane +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Plane(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskPlane; + else + myFlags &= ~((Standard_Integer)FMaskPlane); +} + +//======================================================================= +// function : Cylinder +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Cylinder() const +{ + return (myFlags & (Standard_Integer)FMaskCylinder) != 0; +} + +//======================================================================= +// function : Cylinder +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Cylinder(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskCylinder; + else + myFlags &= ~((Standard_Integer)FMaskCylinder); +} + +//======================================================================= +// function : Cone +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Cone() const +{ + return (myFlags & (Standard_Integer)FMaskCone) != 0; +} + +//======================================================================= +// function : Cone +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Cone(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskCone; + else + myFlags &= ~((Standard_Integer)FMaskCone); +} + +//======================================================================= +// function : Sphere +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Sphere() const +{ + return (myFlags & (Standard_Integer)FMaskSphere) != 0; +} + +//======================================================================= +// function : Sphere +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Sphere(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskSphere; + else + myFlags &= ~((Standard_Integer)FMaskSphere); +} + +//======================================================================= +// function : Torus +// purpose : +//======================================================================= + +inline Standard_Boolean HLRBRep_FaceData::Torus() const +{ + return (myFlags & (Standard_Integer)FMaskTorus) != 0; +} + +//======================================================================= +// function : Torus +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Torus(const Standard_Boolean B) +{ + if (B) + myFlags |= (Standard_Integer)FMaskTorus; + else + myFlags &= ~((Standard_Integer)FMaskTorus); +} + +//======================================================================= +// function : Size +// purpose : +//======================================================================= + +inline Standard_Real HLRBRep_FaceData::Size() const +{ + return mySize; +} + +//======================================================================= +// function : Size +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Size(const Standard_Real S) +{ + mySize = S; +} + +//======================================================================= +// function : Orientation +// purpose : +//======================================================================= + +inline TopAbs_Orientation HLRBRep_FaceData::Orientation() const +{ + return ((TopAbs_Orientation)(myFlags & (Standard_Integer)EMaskOrient)); +} + +//======================================================================= +// function : Orientation +// purpose : +//======================================================================= + +inline void HLRBRep_FaceData::Orientation(const TopAbs_Orientation O) +{ + myFlags &= ~(Standard_Integer)EMaskOrient; + myFlags |= ((Standard_Integer)O & (Standard_Integer)EMaskOrient); +} + +//======================================================================= +// function : Wires +// purpose : +//======================================================================= + +inline Handle(HLRAlgo_WiresBlock)& HLRBRep_FaceData::Wires() +{ + return myWires; +} + +//======================================================================= +// function : Geometry +// purpose : +//======================================================================= + +inline HLRBRep_Surface& HLRBRep_FaceData::Geometry() +{ + return myGeometry; +} + +//======================================================================= +// function : Tolerance +// purpose : +//======================================================================= + +inline Standard_ShortReal HLRBRep_FaceData::Tolerance() const +{ + return myTolerance; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ThePolyhedronOfInterCSurf.hxx b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ThePolyhedronOfInterCSurf.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f42ad1e28d6ceba0c42cb480fafe63aa4f4693b2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_ThePolyhedronOfInterCSurf.hxx @@ -0,0 +1,215 @@ +// Created on: 1992-10-14 +// Created by: Christophe MARION +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _HLRBRep_ThePolyhedronOfInterCSurf_HeaderFile +#define _HLRBRep_ThePolyhedronOfInterCSurf_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +class Standard_OutOfRange; +class HLRBRep_SurfaceTool; +class gp_Pnt; +class Bnd_Box; +class gp_XYZ; + +class HLRBRep_ThePolyhedronOfInterCSurf +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(const Standard_Address& Surface, + const Standard_Integer nbdU, + const Standard_Integer nbdV, + const Standard_Real U1, + const Standard_Real V1, + const Standard_Real U2, + const Standard_Real V2); + + Standard_EXPORT HLRBRep_ThePolyhedronOfInterCSurf(const Standard_Address& Surface, + const TColStd_Array1OfReal& Upars, + const TColStd_Array1OfReal& Vpars); + + Standard_EXPORT void Destroy(); + + ~HLRBRep_ThePolyhedronOfInterCSurf() { Destroy(); } + + Standard_EXPORT void DeflectionOverEstimation(const Standard_Real flec); + + Standard_EXPORT Standard_Real DeflectionOnTriangle(const Standard_Address& Surface, + const Standard_Integer Index) const; + + Standard_EXPORT void UMinSingularity(const Standard_Boolean Sing); + + Standard_EXPORT void UMaxSingularity(const Standard_Boolean Sing); + + Standard_EXPORT void VMinSingularity(const Standard_Boolean Sing); + + Standard_EXPORT void VMaxSingularity(const Standard_Boolean Sing); + + //! get the size of the discretization. + Standard_EXPORT void Size(Standard_Integer& nbdu, Standard_Integer& nbdv) const; + + //! Give the number of triangles in this double array of + Standard_EXPORT Standard_Integer NbTriangles() const; + + //! Give the 3 points of the triangle of address Index in + //! the double array of triangles. + Standard_EXPORT void Triangle(const Standard_Integer Index, + Standard_Integer& P1, + Standard_Integer& P2, + Standard_Integer& P3) const; + + //! Give the address Tricon of the triangle connexe to the + //! triangle of address Triang by the edge Pivot Pedge and + //! the third point of this connexe triangle. When we are + //! on a free edge TriCon==0 but the function return the + //! value of the triangle in the other side of Pivot on + //! the free edge. Used to turn around a vertex. + Standard_EXPORT Standard_Integer TriConnex(const Standard_Integer Triang, + const Standard_Integer Pivot, + const Standard_Integer Pedge, + Standard_Integer& TriCon, + Standard_Integer& OtherP) const; + + //! Give the number of point in the double array of + //! triangles ((nbdu+1)*(nbdv+1)). + Standard_EXPORT Standard_Integer NbPoints() const; + + //! Set the value of a field of the double array of + //! points. + Standard_EXPORT void Point(const gp_Pnt& thePnt, + const Standard_Integer lig, + const Standard_Integer col, + const Standard_Real U, + const Standard_Real V); + + //! Give the point of index i in the MaTriangle. + Standard_EXPORT const gp_Pnt& Point(const Standard_Integer Index, + Standard_Real& U, + Standard_Real& V) const; + + //! Give the point of index i in the MaTriangle. + Standard_EXPORT const gp_Pnt& Point(const Standard_Integer Index) const; + + //! Give the point of index i in the MaTriangle. + Standard_EXPORT void Point(const Standard_Integer Index, gp_Pnt& P) const; + + //! Give the bounding box of the MaTriangle. + Standard_EXPORT const Bnd_Box& Bounding() const; + + //! Compute the array of boxes. The box corresponding + //! to the triangle . + Standard_EXPORT void FillBounding(); + + //! Give the array of boxes. The box corresponding + //! to the triangle . + Standard_EXPORT const Handle(Bnd_HArray1OfBox)& ComponentsBounding() const; + + Standard_EXPORT Standard_Real DeflectionOverEstimation() const; + + Standard_EXPORT Standard_Boolean HasUMinSingularity() const; + + Standard_EXPORT Standard_Boolean HasUMaxSingularity() const; + + Standard_EXPORT Standard_Boolean HasVMinSingularity() const; + + Standard_EXPORT Standard_Boolean HasVMaxSingularity() const; + + //! Give the plane equation of the triangle of address Triang. + Standard_EXPORT void PlaneEquation(const Standard_Integer Triang, + gp_XYZ& NormalVector, + Standard_Real& PolarDistance) const; + + //! Give the plane equation of the triangle of address Triang. + Standard_EXPORT Standard_Boolean Contain(const Standard_Integer Triang, + const gp_Pnt& ThePnt) const; + + Standard_EXPORT void Parameters(const Standard_Integer Index, + Standard_Real& U, + Standard_Real& V) const; + + //! This method returns true if the edge based on points with + //! indices Index1 and Index2 represents a boundary edge. It is + //! necessary to take into account the boundary deflection for + //! this edge. + Standard_EXPORT Standard_Boolean IsOnBound(const Standard_Integer Index1, + const Standard_Integer Index2) const; + + //! This method returns a border deflection. + Standard_Real GetBorderDeflection() const; + + Standard_EXPORT void Dump() const; + +protected: + Standard_EXPORT void Init(const Standard_Address& Surface, + const Standard_Real U1, + const Standard_Real V1, + const Standard_Real U2, + const Standard_Real V2); + + Standard_EXPORT void Init(const Standard_Address& Surface, + const TColStd_Array1OfReal& Upars, + const TColStd_Array1OfReal& Vpars); + +private: + //! This method computes and returns a deflection of isoline + //! of given parameter on Surface. + Standard_EXPORT Standard_Real ComputeBorderDeflection(const Standard_Address& Surface, + const Standard_Real Parameter, + const Standard_Real PMin, + const Standard_Real PMax, + const Standard_Boolean isUIso) const; + +private: + Standard_Integer nbdeltaU; + Standard_Integer nbdeltaV; + Bnd_Box TheBnd; + Handle(Bnd_HArray1OfBox) TheComponentsBnd; + Standard_Real TheDeflection; + Standard_Address C_MyPnts; + Standard_Address C_MyU; + Standard_Address C_MyV; + Standard_Boolean UMinSingular; + Standard_Boolean UMaxSingular; + Standard_Boolean VMinSingular; + Standard_Boolean VMaxSingular; + Standard_Real TheBorderDeflection; + Standard_Address C_MyIsOnBounds; +}; + +#define ThePSurface Standard_Address +#define ThePSurface_hxx +#define ThePSurfaceTool HLRBRep_SurfaceTool +#define ThePSurfaceTool_hxx +#define IntCurveSurface_Polyhedron HLRBRep_ThePolyhedronOfInterCSurf +#define IntCurveSurface_Polyhedron_hxx + +#include + +#undef ThePSurface +#undef ThePSurface_hxx +#undef ThePSurfaceTool +#undef ThePSurfaceTool_hxx +#undef IntCurveSurface_Polyhedron +#undef IntCurveSurface_Polyhedron_hxx + +#endif // _HLRBRep_ThePolyhedronOfInterCSurf_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_VertexList.hxx b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_VertexList.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6619ab1dd6a6391c36f9c20da4af4caf98ffd78a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/HLRBRep_VertexList.hxx @@ -0,0 +1,77 @@ +// Created on: 1997-04-17 +// Created by: Christophe MARION +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _HLRBRep_VertexList_HeaderFile +#define _HLRBRep_VertexList_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +class HLRAlgo_Intersection; + +class HLRBRep_VertexList +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT HLRBRep_VertexList(const HLRBRep_EdgeInterferenceTool& T, + const HLRAlgo_ListIteratorOfInterferenceList& I); + + //! Returns True when the curve is periodic. + Standard_EXPORT Standard_Boolean IsPeriodic() const; + + //! Returns True when there are more vertices. + Standard_EXPORT Standard_Boolean More() const; + + //! Proceeds to the next vertex. + Standard_EXPORT void Next(); + + //! Returns the current vertex + Standard_EXPORT const HLRAlgo_Intersection& Current() const; + + //! Returns True if the current vertex is on the boundary of the edge. + Standard_EXPORT Standard_Boolean IsBoundary() const; + + //! Returns True if the current vertex is an + //! interference. + Standard_EXPORT Standard_Boolean IsInterference() const; + + //! Returns the orientation of the current vertex if + //! it is on the boundary of the edge. + Standard_EXPORT TopAbs_Orientation Orientation() const; + + //! Returns the transition of the current vertex if + //! it is an interference. + Standard_EXPORT TopAbs_Orientation Transition() const; + + //! Returns the transition of the current vertex + //! relative to the boundary if it is an interference. + Standard_EXPORT TopAbs_Orientation BoundaryTransition() const; + +protected: +private: + HLRAlgo_ListIteratorOfInterferenceList myIterator; + HLRBRep_EdgeInterferenceTool myTool; + Standard_Boolean fromEdge; + Standard_Boolean fromInterf; +}; + +#endif // _HLRBRep_VertexList_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/HLRTopoBRep_DataMapIteratorOfDataMapOfShapeFaceData.hxx b/data/miniconda3/envs/catiagent/include/opencascade/HLRTopoBRep_DataMapIteratorOfDataMapOfShapeFaceData.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3ba47bbed919efa94ab09e698d4baf72fb18bb46 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/HLRTopoBRep_DataMapIteratorOfDataMapOfShapeFaceData.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef HLRTopoBRep_DataMapIteratorOfDataMapOfShapeFaceData_HeaderFile +#define HLRTopoBRep_DataMapIteratorOfDataMapOfShapeFaceData_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Act.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Act.hxx new file mode 100644 index 0000000000000000000000000000000000000000..711a3a1152d72e43ec5323c1d7d28fe1caac8c53 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Act.hxx @@ -0,0 +1,95 @@ +// Created on: 1996-03-05 +// Created by: Christian CAILLET +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IFSelect_Act_HeaderFile +#define _IFSelect_Act_HeaderFile + +#include + +#include +#include +#include +#include +class IFSelect_SessionPilot; + +class IFSelect_Act; +DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator) + +//! Act gives a simple way to define and add functions to be ran +//! from a SessionPilot, as follows : +//! +//! Define a function as +//! static IFSelect_RetStatus myfunc +//! (const Standard_CString name, +//! const Handle(IFSelect_SessionPilot)& pilot) +//! { ... } +//! When ran, it receives the exact name (string) of the called +//! function, and the SessionPilot which brings other infos +//! +//! Add it by +//! IFSelect_Act::AddFunc (name,help,myfunc); +//! for a normal function, or +//! IFSelect_Act::AddFSet (name,help,myfunc); +//! for a function which is intended to create a control item +//! name and help are given as CString +//! +//! Then, it is available for run +class IFSelect_Act : public IFSelect_Activator +{ + +public: + //! Creates an Act with a name, help and a function + //! mode (Add or AddSet) is given when recording + Standard_EXPORT IFSelect_Act(const Standard_CString name, + const Standard_CString help, + const IFSelect_ActFunc func); + + //! Execution of Command Line. remark that is senseless + //! because each Act brings one and only one function + Standard_EXPORT IFSelect_ReturnStatus + Do(const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE; + + //! Short Help for commands : returns the help given to create + Standard_EXPORT Standard_CString Help(const Standard_Integer number) const Standard_OVERRIDE; + + //! Changes the default group name for the following Acts + //! group empty means to come back to default from Activator + //! Also a file name can be precised (to query by getsource) + Standard_EXPORT static void SetGroup(const Standard_CString group, + const Standard_CString file = ""); + + //! Adds a function with its name and help : creates an Act then + //! records it as normal function + Standard_EXPORT static void AddFunc(const Standard_CString name, + const Standard_CString help, + const IFSelect_ActFunc func); + + //! Adds a function with its name and help : creates an Act then + //! records it as function for XSET (i.e. to create control item) + Standard_EXPORT static void AddFSet(const Standard_CString name, + const Standard_CString help, + const IFSelect_ActFunc func); + + DEFINE_STANDARD_RTTIEXT(IFSelect_Act, IFSelect_Activator) + +protected: +private: + TCollection_AsciiString thename; + TCollection_AsciiString thehelp; + IFSelect_ActFunc thefunc; +}; + +#endif // _IFSelect_Act_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Activator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Activator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4ee42731361b1e088e6ae53953c301cdcba54083 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_Activator.hxx @@ -0,0 +1,129 @@ +// Created on: 1993-07-27 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IFSelect_Activator_HeaderFile +#define _IFSelect_Activator_HeaderFile + +#include + +#include +#include +#include +#include +class IFSelect_SessionPilot; + +class IFSelect_Activator; +DEFINE_STANDARD_HANDLE(IFSelect_Activator, Standard_Transient) + +//! Defines the general frame for working with a SessionPilot. +//! Each Activator treats a set of Commands. Commands are given as +//! alphanumeric strings. They can be of two main forms : +//! - classic, to list, evaluate, enrich the session (by itself) : +//! no specific remark, its complete execution must be described +//! - creation of a new item : instead of creatinf it plus adding +//! it to the session (which is a classic way), it is possible +//! to create it and make it recorded by the SessionPilot : +//! then, the Pilot will add it to the session; this way allows +//! the Pilot to manage itself named items +//! +//! In order to make easier the use of Activator, this class +//! provides a simple way to Select an Actor for a Command : +//! each sub-class of SectionActor defines the command titles it +//! recognizes, plus attaches a Number, unique for this sub-class, +//! to each distinct command title. +//! +//! Each time an action is required, the corresponding Number +//! can then be given to help the selection of the action to do. +//! +//! The result of an Execution must indicate if it is worth to be +//! recorded or not : see method Do +class IFSelect_Activator : public Standard_Transient +{ + +public: + //! Records, in a Dictionary available for all the Activators, + //! the command title an Activator can process, attached with + //! its number, proper for this Activator + //! allows to distinguish various execution modes + //! 0: default mode; 1 : for xset + Standard_EXPORT static void Adding(const Handle(IFSelect_Activator)& actor, + const Standard_Integer number, + const Standard_CString command, + const Standard_Integer mode); + + //! Allows a self-definition by an Activator of the Commands it + //! processes, call the class method Adding (mode 0) + Standard_EXPORT void Add(const Standard_Integer number, const Standard_CString command) const; + + //! Same as Add but specifies that this command is candidate for + //! xset (creation of items, xset : named items; mode 1) + Standard_EXPORT void AddSet(const Standard_Integer number, const Standard_CString command) const; + + //! Removes a Command, if it is recorded (else, does nothing) + Standard_EXPORT static void Remove(const Standard_CString command); + + //! Selects, for a Command given by its title, an actor with its + //! command number. Returns True if found, False else + Standard_EXPORT static Standard_Boolean Select(const Standard_CString command, + Standard_Integer& number, + Handle(IFSelect_Activator)& actor); + + //! Returns mode recorded for a command. -1 if not found + Standard_EXPORT static Standard_Integer Mode(const Standard_CString command); + + //! Returns, for a root of command title, the list of possible + //! commands. + //! : -1 (D) for all commands if is empty + //! -1 + command : about a Group , >= 0 see Adding + //! By default, it returns the whole list of known commands. + Standard_EXPORT static Handle(TColStd_HSequenceOfAsciiString) Commands( + const Standard_Integer mode = -1, + const Standard_CString command = ""); + + //! Tries to execute a Command Line. is the number of the + //! command for this Activator. It Must forecast to record the + //! result of the execution, for need of Undo-Redo + //! Must Returns : 0 for a void command (not to be recorded), + //! 1 if execution OK, -1 if command incorrect, -2 if error + //! on execution + Standard_EXPORT virtual IFSelect_ReturnStatus Do(const Standard_Integer number, + const Handle(IFSelect_SessionPilot)& pilot) = 0; + + //! Sends a short help message for a given command identified by + //! it number for this Activator (must take one line max) + Standard_EXPORT virtual Standard_CString Help(const Standard_Integer number) const = 0; + + Standard_EXPORT Standard_CString Group() const; + + Standard_EXPORT Standard_CString File() const; + + //! Group and SetGroup define a "Group of commands" which + //! correspond to an Activator. Default is "XSTEP" + //! Also a file may be attached + Standard_EXPORT void SetForGroup(const Standard_CString group, const Standard_CString file = ""); + + DEFINE_STANDARD_RTTIEXT(IFSelect_Activator, Standard_Transient) + +protected: + //! Sets the default values + Standard_EXPORT IFSelect_Activator(); + +private: + TCollection_AsciiString thegroup; + TCollection_AsciiString thefile; +}; + +#endif // _IFSelect_Activator_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectDeduct.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectDeduct.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7b801618c595b081fdda1540710311c245a1d8eb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectDeduct.hxx @@ -0,0 +1,88 @@ +// Created on: 1992-11-17 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IFSelect_SelectDeduct_HeaderFile +#define _IFSelect_SelectDeduct_HeaderFile + +#include +#include + +#include +class IFSelect_SelectPointed; +class Interface_EntityIterator; +class Interface_Graph; +class IFSelect_SelectionIterator; + +class IFSelect_SelectDeduct; +DEFINE_STANDARD_HANDLE(IFSelect_SelectDeduct, IFSelect_Selection) + +//! A SelectDeduct determines a list of Entities from an Input +//! Selection, by a computation : Output list is not obliged to be +//! a sub-list of Input list +//! (for more specific, see SelectExtract for filtered sub-lists, +//! and SelectExplore for recurcive exploration) +//! +//! A SelectDeduct may use an alternate input for one shot +//! This allows to use an already existing definition, by +//! overloading the input selection by an alternate list, +//! already defined, for one use : +//! If this alternate list is set, InputResult queries it instead +//! of calling the input selection, then clears it immediately +class IFSelect_SelectDeduct : public IFSelect_Selection +{ + +public: + //! Defines or Changes the Input Selection + Standard_EXPORT void SetInput(const Handle(IFSelect_Selection)& sel); + + //! Returns the Input Selection + Standard_EXPORT Handle(IFSelect_Selection) Input() const; + + //! Returns True if the Input Selection is defined, False else + Standard_EXPORT Standard_Boolean HasInput() const; + + //! Tells if an Alternate List has been set, i.e. : the Alternate + //! Definition is present and set + Standard_EXPORT Standard_Boolean HasAlternate() const; + + //! Returns the Alternate Definition + //! It is returned modifiable, hence an already defined + //! SelectPointed can be used + //! But if it was not yet defined, it is created the first time + //! + //! It is exploited by InputResult + Standard_EXPORT Handle(IFSelect_SelectPointed)& Alternate(); + + //! Returns the Result determined by Input Selection, as Unique + //! if Input Selection is not defined, returns an empty list. + //! + //! If Alternate is set, InputResult takes its definition instead + //! of calling the Input Selection, then clears it + Standard_EXPORT Interface_EntityIterator InputResult(const Interface_Graph& G) const; + + //! Puts in an Iterator the Selections from which "me" depends + //! This list contains one Selection : the InputSelection + Standard_EXPORT void FillIterator(IFSelect_SelectionIterator& iter) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IFSelect_SelectDeduct, IFSelect_Selection) + +protected: +private: + Handle(IFSelect_Selection) thesel; + Handle(IFSelect_SelectPointed) thealt; +}; + +#endif // _IFSelect_SelectDeduct_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectErrorEntities.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectErrorEntities.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d759e016de13d991f01de5b0b3504e771861c758 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IFSelect_SelectErrorEntities.hxx @@ -0,0 +1,60 @@ +// Created on: 1992-11-18 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IFSelect_SelectErrorEntities_HeaderFile +#define _IFSelect_SelectErrorEntities_HeaderFile + +#include +#include + +#include +#include +class Standard_Transient; +class Interface_InterfaceModel; +class TCollection_AsciiString; + +class IFSelect_SelectErrorEntities; +DEFINE_STANDARD_HANDLE(IFSelect_SelectErrorEntities, IFSelect_SelectExtract) + +//! A SelectErrorEntities sorts the Entities which are qualified +//! as "Error" (their Type has not been recognized) during reading +//! a File. This does not concern Entities which are syntactically +//! correct, but with incorrect data (for integrity constraints). +class IFSelect_SelectErrorEntities : public IFSelect_SelectExtract +{ + +public: + //! Creates a SelectErrorEntities + Standard_EXPORT IFSelect_SelectErrorEntities(); + + //! Returns True for an Entity which is qualified as "Error", i.e. + //! if explicitly knows (through its Number) as + //! Erroneous + Standard_EXPORT Standard_Boolean + Sort(const Standard_Integer rank, + const Handle(Standard_Transient)& ent, + const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; + + //! Returns a text defining the criterium : "Error Entities" + Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IFSelect_SelectErrorEntities, IFSelect_SelectExtract) + +protected: +private: +}; + +#endif // _IFSelect_SelectErrorEntities_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_FiniteElement.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_FiniteElement.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fbe5490e9dbe2b44b4bb1caeb42ed90b8fc2b2db --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_FiniteElement.hxx @@ -0,0 +1,72 @@ +// Created on: 1993-01-11 +// Created by: CKY / Contract Toubro-Larsen ( Arun MENON ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESAppli_FiniteElement_HeaderFile +#define _IGESAppli_FiniteElement_HeaderFile + +#include + +#include +#include +#include +class TCollection_HAsciiString; +class IGESAppli_Node; + +class IGESAppli_FiniteElement; +DEFINE_STANDARD_HANDLE(IGESAppli_FiniteElement, IGESData_IGESEntity) + +//! defines FiniteElement, Type <136> Form <0> +//! in package IGESAppli +//! Used to define a finite element with the help of an +//! element topology. +class IGESAppli_FiniteElement : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESAppli_FiniteElement(); + + //! This method is used to set the fields of the class + //! FiniteElement + //! - aType : Indicates the topology type + //! - allNodes : List of Nodes defining the element + //! - aName : Element type name + Standard_EXPORT void Init(const Standard_Integer aType, + const Handle(IGESAppli_HArray1OfNode)& allNodes, + const Handle(TCollection_HAsciiString)& aName); + + //! returns Topology type + Standard_EXPORT Standard_Integer Topology() const; + + //! returns the number of nodes defining the element + Standard_EXPORT Standard_Integer NbNodes() const; + + //! returns Node defining element entity + //! raises exception if Index <= 0 or Index > NbNodes() + Standard_EXPORT Handle(IGESAppli_Node) Node(const Standard_Integer Index) const; + + //! returns Element Type Name + Standard_EXPORT Handle(TCollection_HAsciiString) Name() const; + + DEFINE_STANDARD_RTTIEXT(IGESAppli_FiniteElement, IGESData_IGESEntity) + +protected: +private: + Standard_Integer theTopology; + Handle(IGESAppli_HArray1OfNode) theNodes; + Handle(TCollection_HAsciiString) theName; +}; + +#endif // _IGESAppli_FiniteElement_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_HArray1OfFlow.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_HArray1OfFlow.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7a9bda37606b179909b3ac68df2ce8b0ed02980f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_HArray1OfFlow.hxx @@ -0,0 +1,26 @@ +// Created on: 1993-01-11 +// Created by: CKY / Contract Toubro-Larsen (Anand NATRAJAN) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef IGESAppli_HArray1OfFlow_HeaderFile +#define IGESAppli_HArray1OfFlow_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(IGESAppli_HArray1OfFlow, IGESAppli_Array1OfFlow) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolFlow.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolFlow.hxx new file mode 100644 index 0000000000000000000000000000000000000000..73706d1cf51049f505d4766bfe4bea775d033f0b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolFlow.hxx @@ -0,0 +1,88 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESAppli_ToolFlow_HeaderFile +#define _IGESAppli_ToolFlow_HeaderFile + +#include +#include +#include + +#include +class IGESAppli_Flow; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a Flow. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESAppli_ToolFlow +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolFlow, ready to work + Standard_EXPORT IGESAppli_ToolFlow(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESAppli_Flow)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESAppli_Flow)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a Flow , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESAppli_Flow)& ent, + Interface_EntityIterator& iter) const; + + //! Sets automatic unambiguous Correction on a Flow + //! (NbContextFlags forced to 2) + Standard_EXPORT Standard_Boolean OwnCorrect(const Handle(IGESAppli_Flow)& ent) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESAppli_Flow)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESAppli_Flow)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESAppli_Flow)& entfrom, + const Handle(IGESAppli_Flow)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESAppli_Flow)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESAppli_ToolFlow_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolLevelFunction.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolLevelFunction.hxx new file mode 100644 index 0000000000000000000000000000000000000000..226b653c63ab3554379bde5cf5447f26d733008b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESAppli_ToolLevelFunction.hxx @@ -0,0 +1,88 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESAppli_ToolLevelFunction_HeaderFile +#define _IGESAppli_ToolLevelFunction_HeaderFile + +#include +#include +#include + +#include +class IGESAppli_LevelFunction; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a LevelFunction. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESAppli_ToolLevelFunction +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolLevelFunction, ready to work + Standard_EXPORT IGESAppli_ToolLevelFunction(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESAppli_LevelFunction)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESAppli_LevelFunction)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a LevelFunction , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESAppli_LevelFunction)& ent, + Interface_EntityIterator& iter) const; + + //! Sets automatic unambiguous Correction on a LevelFunction + //! (NbPropertyValues forced to 2) + Standard_EXPORT Standard_Boolean OwnCorrect(const Handle(IGESAppli_LevelFunction)& ent) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESAppli_LevelFunction)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESAppli_LevelFunction)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESAppli_LevelFunction)& entfrom, + const Handle(IGESAppli_LevelFunction)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESAppli_LevelFunction)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESAppli_ToolLevelFunction_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_GeneralModule.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_GeneralModule.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7651af7f359377c11950b1252b5c9cdeae6de656 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_GeneralModule.hxx @@ -0,0 +1,89 @@ +// Created on: 1993-05-10 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESBasic_GeneralModule_HeaderFile +#define _IGESBasic_GeneralModule_HeaderFile + +#include +#include + +#include +#include +class IGESData_IGESEntity; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Standard_Transient; +class Interface_CopyTool; + +class IGESBasic_GeneralModule; +DEFINE_STANDARD_HANDLE(IGESBasic_GeneralModule, IGESData_GeneralModule) + +//! Definition of General Services for IGESBasic (specific part) +//! This Services comprise : Shared & Implied Lists, Copy, Check +class IGESBasic_GeneralModule : public IGESData_GeneralModule +{ + +public: + //! Creates a GeneralModule from IGESBasic and puts it into GeneralLib + Standard_EXPORT IGESBasic_GeneralModule(); + + //! Lists the Entities shared by a given IGESEntity , from + //! its specific parameters : specific for each type + Standard_EXPORT void OwnSharedCase(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& ent, + Interface_EntityIterator& iter) const Standard_OVERRIDE; + + //! Returns a DirChecker, specific for each type of Entity + //! (identified by its Case Number) : this DirChecker defines + //! constraints which must be respected by the DirectoryPart + Standard_EXPORT IGESData_DirChecker + DirChecker(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& ent) const Standard_OVERRIDE; + + //! Performs Specific Semantic Check for each type of Entity + Standard_EXPORT void OwnCheckCase(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const Standard_OVERRIDE; + + //! Specific creation of a new void entity + Standard_EXPORT Standard_Boolean + NewVoid(const Standard_Integer CN, Handle(Standard_Transient)& entto) const Standard_OVERRIDE; + + //! Copies parameters which are specific of each Type of Entity + Standard_EXPORT void OwnCopyCase(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& entfrom, + const Handle(IGESData_IGESEntity)& entto, + Interface_CopyTool& TC) const Standard_OVERRIDE; + + //! Returns a category number which characterizes an entity + //! Structure for Groups, Figures & Co + //! Description for External Refs + //! Auxiliary for other + Standard_EXPORT virtual Standard_Integer CategoryNumber(const Standard_Integer CN, + const Handle(Standard_Transient)& ent, + const Interface_ShareTool& shares) const + Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESBasic_GeneralModule, IGESData_GeneralModule) + +protected: +private: +}; + +#endif // _IGESBasic_GeneralModule_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_Name.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_Name.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f9173dee113c3c4bd6017242a8626fb4103e96e6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_Name.hxx @@ -0,0 +1,58 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( Arun MENON ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESBasic_Name_HeaderFile +#define _IGESBasic_Name_HeaderFile + +#include + +#include +#include +class TCollection_HAsciiString; + +class IGESBasic_Name; +DEFINE_STANDARD_HANDLE(IGESBasic_Name, IGESData_NameEntity) + +//! defines Name, Type <406> Form <15> +//! in package IGESBasic +//! Used to specify a user defined name +class IGESBasic_Name : public IGESData_NameEntity +{ + +public: + Standard_EXPORT IGESBasic_Name(); + + //! This method is used to set the fields of the class Name + //! - nbPropVal : Number of property values, always = 1 + //! - aName : Stores the Name + Standard_EXPORT void Init(const Standard_Integer nbPropVal, + const Handle(TCollection_HAsciiString)& aName); + + //! returns the number of property values, which should be 1 + Standard_EXPORT Standard_Integer NbPropertyValues() const; + + //! returns the user defined Name + Standard_EXPORT Handle(TCollection_HAsciiString) Value() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESBasic_Name, IGESData_NameEntity) + +protected: +private: + Standard_Integer theNbPropertyValues; + Handle(TCollection_HAsciiString) theName; +}; + +#endif // _IGESBasic_Name_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_ReadWriteModule.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_ReadWriteModule.hxx new file mode 100644 index 0000000000000000000000000000000000000000..8e92f627d37fe749abe29190a3448105ba4af5cd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESBasic_ReadWriteModule.hxx @@ -0,0 +1,64 @@ +// Created on: 1993-09-06 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESBasic_ReadWriteModule_HeaderFile +#define _IGESBasic_ReadWriteModule_HeaderFile + +#include +#include + +#include +#include +class IGESData_IGESEntity; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; + +class IGESBasic_ReadWriteModule; +DEFINE_STANDARD_HANDLE(IGESBasic_ReadWriteModule, IGESData_ReadWriteModule) + +//! Defines basic File Access Module for IGESBasic (specific parts) +//! Specific actions concern : Read and Write Own Parameters of +//! an IGESEntity. +class IGESBasic_ReadWriteModule : public IGESData_ReadWriteModule +{ + +public: + //! Creates a ReadWriteModule & puts it into ReaderLib & WriterLib + Standard_EXPORT IGESBasic_ReadWriteModule(); + + //! Defines Case Numbers for Entities of IGESBasic + Standard_EXPORT Standard_Integer CaseIGES(const Standard_Integer typenum, + const Standard_Integer formnum) const Standard_OVERRIDE; + + //! Reads own parameters from file for an Entity of IGESBasic + Standard_EXPORT void ReadOwnParams(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const Standard_OVERRIDE; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Standard_Integer CN, + const Handle(IGESData_IGESEntity)& ent, + IGESData_IGESWriter& IW) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESBasic_ReadWriteModule, IGESData_ReadWriteModule) + +protected: +private: +}; + +#endif // _IGESBasic_ReadWriteModule_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESData_DirChecker.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_DirChecker.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5289fc8a8d499dc551feef985a240dacc665a911 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_DirChecker.hxx @@ -0,0 +1,176 @@ +// Created on: 1992-11-10 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESData_DirChecker_HeaderFile +#define _IGESData_DirChecker_HeaderFile + +#include +#include +#include + +#include +#include +class Interface_Check; +class IGESData_IGESEntity; + +//! This class centralizes general Checks upon an IGES Entity's +//! Directory Part. That is : such field Ignored or Required, +//! or Required with a given Value (for an Integer field) +//! More precise checks can be performed as necessary, by each +//! Entity (method OwnCheck). +//! +//! Each class of Entity defines its DirChecker (method DirChecker) +//! and the DirChecker is able to perform its Checks on an Entity +//! +//! A Required Value or presence of a field causes a Fail Message +//! if criterium is not satisfied +//! An Ignored field causes a Correction Message if the field is +//! not null/zero +class IGESData_DirChecker +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a DirChecker, with no criterium at all to be checked + Standard_EXPORT IGESData_DirChecker(); + + //! Returns a DirChecker, with no criterium except Required Type + Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype); + + //! Returns a DirChecker, with no criterium except Required values + //! for Type and Form numbers + Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, const Standard_Integer aform); + + //! Returns a DirChecker, with no criterium except Required values + //! for Type number (atype), and Required Range for Form number + //! (which must be between aform1 and aform2 included) + Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, + const Standard_Integer aform1, + const Standard_Integer aform2); + + //! Returns True if at least one criterium has already been set + //! Allows user to store a DirChecker (static variable) then ask + //! if it has been set before setting it + Standard_EXPORT Standard_Boolean IsSet() const; + + //! Sets a DirChecker with most current criteria, that is : + //! Structure Ignored ( worths call Structure(crit = DefVoid) ) + Standard_EXPORT void SetDefault(); + + //! Sets Structure criterium. + //! If crit is DefVoid, Ignored : should not be defined + //! If crit is DefReference, Required : must be defined + //! Other values are not taken in account + Standard_EXPORT void Structure(const IGESData_DefType crit); + + //! Sets LineFont criterium + //! If crit is DefVoid, Ignored : should not be defined + //! If crit is DefAny, Required : must be defined (value or ref) + //! If crit is DefValue, Required as a Value (error if Reference) + //! Other values are not taken in account + Standard_EXPORT void LineFont(const IGESData_DefType crit); + + //! Sets LineWeight criterium + //! If crit is DefVoid, Ignored : should not be defined + //! If crit is DefValue, Required + //! Other values are not taken in account + Standard_EXPORT void LineWeight(const IGESData_DefType crit); + + //! Sets Color criterium + //! If crit is DefVoid, Ignored : should not be defined + //! If crit is DefAny, Required : must be defined (value or ref) + //! Other values are not taken in account + Standard_EXPORT void Color(const IGESData_DefType crit); + + //! Sets Graphics data (LineFont, LineWeight, Color, Level, View) + //! to be ignored according value of Hierarchy status : + //! If hierarchy is not given, they are Ignored any way + //! (that is, they should not be defined) + //! If hierarchy is given, Graphics are Ignored if the Hierarchy + //! status has the value given in argument "hierarchy" + Standard_EXPORT void GraphicsIgnored(const Standard_Integer hierarchy = -1); + + //! Sets Blank Status to be ignored + //! (should not be defined, or its value should be 0) + Standard_EXPORT void BlankStatusIgnored(); + + //! Sets Blank Status to be required at a given value + Standard_EXPORT void BlankStatusRequired(const Standard_Integer val); + + //! Sets Subordinate Status to be ignored + //! (should not be defined, or its value should be 0) + Standard_EXPORT void SubordinateStatusIgnored(); + + //! Sets Subordinate Status to be required at a given value + Standard_EXPORT void SubordinateStatusRequired(const Standard_Integer val); + + //! Sets Blank Status to be ignored + //! (should not be defined, or its value should be 0) + Standard_EXPORT void UseFlagIgnored(); + + //! Sets Blank Status to be required at a given value + //! Give -1 to demand UseFlag not zero (but no precise value req.) + Standard_EXPORT void UseFlagRequired(const Standard_Integer val); + + //! Sets Hierarchy Status to be ignored + //! (should not be defined, or its value should be 0) + Standard_EXPORT void HierarchyStatusIgnored(); + + //! Sets Hierarchy Status to be required at a given value + Standard_EXPORT void HierarchyStatusRequired(const Standard_Integer val); + + //! Performs the Checks on an IGESEntity, according to the + //! recorded criteria + //! In addition, does minimal Checks, such as admitted range for + //! Status, or presence of Error status in some data (Color, ...) + Standard_EXPORT void Check(Handle(Interface_Check)& ach, + const Handle(IGESData_IGESEntity)& ent) const; + + //! Performs a Check only on Values of Type Number and Form Number + //! This allows to do a check on an Entity not yet completely + //! filled but of which Type and Form Number have been already set + Standard_EXPORT void CheckTypeAndForm(Handle(Interface_Check)& ach, + const Handle(IGESData_IGESEntity)& ent) const; + + //! Corrects the Directory Entry of an IGES Entity as far as it is + //! possible according recorded criteria without any ambiguity : + //! - if a numeric Status is required a given value, this value is + //! enforced + //! - if an item is required to be Void, or if it recorded as + //! Erroneous, it is cleared (set to Void) + //! - Type Number is enforced + //! - finally Form Number is enforced only if one and only Value + //! is admitted (no range, see Constructors of DirChecker) + Standard_EXPORT Standard_Boolean Correct(const Handle(IGESData_IGESEntity)& ent) const; + +protected: +private: + Standard_Boolean isitset; + Standard_Integer thetype; + Standard_Integer theform1; + Standard_Integer theform2; + IGESData_DefType thestructure; + IGESData_DefType thelinefont; + IGESData_DefType thelineweig; + IGESData_DefType thecolor; + Standard_Integer thegraphier; + Standard_Integer theblankst; + Standard_Integer thesubordst; + Standard_Integer theuseflag; + Standard_Integer thehierst; +}; + +#endif // _IGESData_DirChecker_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESData_FileProtocol.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_FileProtocol.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4646e0a1b888c524090ef86dca895a9fe289e7eb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_FileProtocol.hxx @@ -0,0 +1,58 @@ +// Created on: 1993-10-26 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESData_FileProtocol_HeaderFile +#define _IGESData_FileProtocol_HeaderFile + +#include +#include + +#include +#include +class Interface_Protocol; + +class IGESData_FileProtocol; +DEFINE_STANDARD_HANDLE(IGESData_FileProtocol, IGESData_Protocol) + +//! This class allows to define complex protocols, in order to +//! treat various sub-sets (or the complete set) of the IGES Norm, +//! such as Solid + Draw (which are normally independent), etc... +//! While it inherits Protocol from IGESData, it admits UndefinedEntity too +class IGESData_FileProtocol : public IGESData_Protocol +{ + +public: + //! Returns an empty FileProtocol + Standard_EXPORT IGESData_FileProtocol(); + + //! Adds a resource + Standard_EXPORT void Add(const Handle(IGESData_Protocol)& protocol); + + //! Gives the count of Resources : the count of Added Protocols + Standard_EXPORT virtual Standard_Integer NbResources() const Standard_OVERRIDE; + + //! Returns a Resource, given a rank (rank of call to Add) + Standard_EXPORT virtual Handle(Interface_Protocol) Resource(const Standard_Integer num) const + Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESData_FileProtocol, IGESData_Protocol) + +private: + Handle(IGESData_Protocol) theresource; + Handle(IGESData_FileProtocol) thenext; +}; + +#endif // _IGESData_FileProtocol_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESData_ReadStage.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_ReadStage.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bdd91eb486f9a95d7d9f70a70d0a7a1133d33ac2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESData_ReadStage.hxx @@ -0,0 +1,30 @@ +// Created on: 1992-04-06 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESData_ReadStage_HeaderFile +#define _IGESData_ReadStage_HeaderFile + +//! gives successive stages of reading an entity (see ParamReader) +enum IGESData_ReadStage +{ + IGESData_ReadDir, + IGESData_ReadOwn, + IGESData_ReadAssocs, + IGESData_ReadProps, + IGESData_ReadEnd +}; + +#endif // _IGESData_ReadStage_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_AttributeTable.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_AttributeTable.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fe661986247aba502d3ccab0b2f647c9cf378345 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_AttributeTable.hxx @@ -0,0 +1,117 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( Arun MENON ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDefs_AttributeTable_HeaderFile +#define _IGESDefs_AttributeTable_HeaderFile + +#include +#include + +#include +#include +#include +class IGESDefs_AttributeDef; +class Standard_Transient; +class TCollection_HAsciiString; + +class IGESDefs_AttributeTable; +DEFINE_STANDARD_HANDLE(IGESDefs_AttributeTable, IGESData_IGESEntity) + +//! defines IGES Attribute Table, Type <422> Form <0, 1> +//! in package IGESDefs +//! This class is used to represent an occurrence of +//! Attribute Table. This Class may be independent +//! or dependent or pointed at by other Entities. +class IGESDefs_AttributeTable : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESDefs_AttributeTable(); + + //! This method is used to set the fields of the class + //! AttributeTable + //! - attributes : Attribute instances, created as + //! (1,NbAttributes,1,NbRows) + //! - NbRows = 1 is a particular case (Form 0) + Standard_EXPORT void Init(const Handle(TColStd_HArray2OfTransient)& attributes); + + //! Sets a Definition as Structure information + //! (works by calling InitMisc) + Standard_EXPORT void SetDefinition(const Handle(IGESDefs_AttributeDef)& def); + + //! Return the Structure information in Directory Entry, + //! casted as an AttributeDef + Standard_EXPORT Handle(IGESDefs_AttributeDef) Definition() const; + + //! returns Number of Rows. Remark that it is always 1 if Form = 0 + //! It means that the list of Attributes (by their number, and for each + //! one its type and ValueCount) is repeated times + Standard_EXPORT Standard_Integer NbRows() const; + + //! returns Number of Attributes + Standard_EXPORT Standard_Integer NbAttributes() const; + + //! returns the Type of an Attribute, given its No. : it is read in the + //! Definition. + //! (1 : Integer, 2 : Real, 3 : String, 4 : Entity, 6 : Logical) + Standard_EXPORT Standard_Integer DataType(const Standard_Integer Atnum) const; + + //! returns the Count of Value for an Attribute, given its No. : + //! it is read in the Definition. + Standard_EXPORT Standard_Integer ValueCount(const Standard_Integer Atnum) const; + + Standard_EXPORT Handle(Standard_Transient) AttributeList(const Standard_Integer Attribnum, + const Standard_Integer Rownum) const; + + //! Returns Attribute Value as an Integer + //! Error if Indices out of Range, or no Value defined, or not an Integer + Standard_EXPORT Standard_Integer AttributeAsInteger(const Standard_Integer AtNum, + const Standard_Integer Rownum, + const Standard_Integer ValNum) const; + + //! Returns Attribute Value as a Real + //! Error if Indices out of Range, or no Value defined, or not a Real + Standard_EXPORT Standard_Real AttributeAsReal(const Standard_Integer AtNum, + const Standard_Integer Rownum, + const Standard_Integer ValNum) const; + + //! Returns Attribute Value as an Integer + Standard_EXPORT Handle(TCollection_HAsciiString) AttributeAsString( + const Standard_Integer AtNum, + const Standard_Integer Rownum, + const Standard_Integer ValNum) const; + + //! Returns Attribute Value as an Entity + //! Error if Indices out of Range, or no Value defined, or not an Entity + Standard_EXPORT Handle(IGESData_IGESEntity) AttributeAsEntity( + const Standard_Integer AtNum, + const Standard_Integer Rownum, + const Standard_Integer ValNum) const; + + //! Returns Attribute Value as a Boolean + //! Error if Indices out of Range, or no Value defined, or not a Logical + Standard_EXPORT Standard_Boolean AttributeAsLogical(const Standard_Integer AtNum, + const Standard_Integer Rownum, + const Standard_Integer ValNum) const; + + DEFINE_STANDARD_RTTIEXT(IGESDefs_AttributeTable, IGESData_IGESEntity) + +protected: +private: + Handle(TColStd_HArray2OfTransient) theAttributes; +}; + +#endif // _IGESDefs_AttributeTable_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_ToolGenericData.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_ToolGenericData.hxx new file mode 100644 index 0000000000000000000000000000000000000000..899ab2bc0bce6b980c0a36d8049a7c95e97e4ca9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDefs_ToolGenericData.hxx @@ -0,0 +1,84 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDefs_ToolGenericData_HeaderFile +#define _IGESDefs_ToolGenericData_HeaderFile + +#include +#include +#include + +#include +class IGESDefs_GenericData; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a GenericData. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESDefs_ToolGenericData +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolGenericData, ready to work + Standard_EXPORT IGESDefs_ToolGenericData(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESDefs_GenericData)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESDefs_GenericData)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a GenericData , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESDefs_GenericData)& ent, + Interface_EntityIterator& iter) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESDefs_GenericData)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESDefs_GenericData)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESDefs_GenericData)& entfrom, + const Handle(IGESDefs_GenericData)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESDefs_GenericData)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESDefs_ToolGenericData_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_DimensionedGeometry.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_DimensionedGeometry.hxx new file mode 100644 index 0000000000000000000000000000000000000000..525691764961913e17a3f2be5964838e4c1817f0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_DimensionedGeometry.hxx @@ -0,0 +1,66 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( Arun MENON ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDimen_DimensionedGeometry_HeaderFile +#define _IGESDimen_DimensionedGeometry_HeaderFile + +#include + +#include +#include +#include + +class IGESDimen_DimensionedGeometry; +DEFINE_STANDARD_HANDLE(IGESDimen_DimensionedGeometry, IGESData_IGESEntity) + +//! Defines IGES Dimensioned Geometry, Type <402> Form <13>, +//! in package IGESDimen +//! This entity has been replaced by the new form of Dimensioned +//! Geometry Associativity Entity (Type 402, Form 21) and should no +//! longer be used by preprocessors. +class IGESDimen_DimensionedGeometry : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESDimen_DimensionedGeometry(); + + Standard_EXPORT void Init(const Standard_Integer nbDims, + const Handle(IGESData_IGESEntity)& aDimension, + const Handle(IGESData_HArray1OfIGESEntity)& entities); + + //! returns the number of dimensions + Standard_EXPORT Standard_Integer NbDimensions() const; + + //! returns the number of associated geometry entities + Standard_EXPORT Standard_Integer NbGeometryEntities() const; + + //! returns the Dimension entity + Standard_EXPORT Handle(IGESData_IGESEntity) DimensionEntity() const; + + //! returns the num'th Geometry entity + //! raises exception if Index <= 0 or Index > NbGeometryEntities() + Standard_EXPORT Handle(IGESData_IGESEntity) GeometryEntity(const Standard_Integer Index) const; + + DEFINE_STANDARD_RTTIEXT(IGESDimen_DimensionedGeometry, IGESData_IGESEntity) + +protected: +private: + Standard_Integer theNbDimensions; + Handle(IGESData_IGESEntity) theDimension; + Handle(IGESData_HArray1OfIGESEntity) theGeometryEntities; +}; + +#endif // _IGESDimen_DimensionedGeometry_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_HArray1OfGeneralNote.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_HArray1OfGeneralNote.hxx new file mode 100644 index 0000000000000000000000000000000000000000..01dd21e45869fbc40e18598b316c809a8363c5ef --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_HArray1OfGeneralNote.hxx @@ -0,0 +1,25 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( Deepak PRABHU ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef IGESDimen_HArray1OfGeneralNote_HeaderFile +#define IGESDimen_HArray1OfGeneralNote_HeaderFile + +#include +#include + +DEFINE_HARRAY1(IGESDimen_HArray1OfGeneralNote, IGESDimen_Array1OfGeneralNote) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolGeneralNote.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolGeneralNote.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c5497bfbe7af55c8d83e95d70ceda064745dae0d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolGeneralNote.hxx @@ -0,0 +1,84 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDimen_ToolGeneralNote_HeaderFile +#define _IGESDimen_ToolGeneralNote_HeaderFile + +#include +#include +#include + +#include +class IGESDimen_GeneralNote; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a GeneralNote. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESDimen_ToolGeneralNote +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolGeneralNote, ready to work + Standard_EXPORT IGESDimen_ToolGeneralNote(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESDimen_GeneralNote)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESDimen_GeneralNote)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a GeneralNote , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESDimen_GeneralNote)& ent, + Interface_EntityIterator& iter) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESDimen_GeneralNote)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESDimen_GeneralNote)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESDimen_GeneralNote)& entfrom, + const Handle(IGESDimen_GeneralNote)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESDimen_GeneralNote)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESDimen_ToolGeneralNote_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolWitnessLine.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolWitnessLine.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c20d44b1a23d19772c4cf068a473dca73964bd70 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDimen_ToolWitnessLine.hxx @@ -0,0 +1,88 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDimen_ToolWitnessLine_HeaderFile +#define _IGESDimen_ToolWitnessLine_HeaderFile + +#include +#include +#include + +#include +class IGESDimen_WitnessLine; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a WitnessLine. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESDimen_ToolWitnessLine +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolWitnessLine, ready to work + Standard_EXPORT IGESDimen_ToolWitnessLine(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESDimen_WitnessLine)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESDimen_WitnessLine)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a WitnessLine , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESDimen_WitnessLine)& ent, + Interface_EntityIterator& iter) const; + + //! Sets automatic unambiguous Correction on a WitnessLine + //! (LineFont forced to Rank = 1, DataType forced to 1) + Standard_EXPORT Standard_Boolean OwnCorrect(const Handle(IGESDimen_WitnessLine)& ent) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESDimen_WitnessLine)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESDimen_WitnessLine)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESDimen_WitnessLine)& entfrom, + const Handle(IGESDimen_WitnessLine)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESDimen_WitnessLine)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESDimen_ToolWitnessLine_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_Planar.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_Planar.hxx new file mode 100644 index 0000000000000000000000000000000000000000..55c0fd0e4c833f0baeed84f8f8f58c0bd3990067 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_Planar.hxx @@ -0,0 +1,78 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( TCD ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDraw_Planar_HeaderFile +#define _IGESDraw_Planar_HeaderFile + +#include + +#include +#include +#include +class IGESGeom_TransformationMatrix; + +class IGESDraw_Planar; +DEFINE_STANDARD_HANDLE(IGESDraw_Planar, IGESData_IGESEntity) + +//! defines IGESPlanar, Type <402> Form <16> +//! in package IGESDraw +//! +//! Indicates that a collection of entities is coplanar.The +//! entities may be geometric, annotative, and/or structural. +class IGESDraw_Planar : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESDraw_Planar(); + + //! This method is used to set the fields of the class Planar + //! - nbMats : Number of Transformation matrices + //! - aTransformationMatrix : Pointer to the Transformation matrix + //! - allEntities : Pointers to the entities specified + Standard_EXPORT void Init(const Standard_Integer nbMats, + const Handle(IGESGeom_TransformationMatrix)& aTransformationMatrix, + const Handle(IGESData_HArray1OfIGESEntity)& allEntities); + + //! returns the number of Transformation matrices in + Standard_EXPORT Standard_Integer NbMatrices() const; + + //! returns the number of Entities in the plane pointed to by this + //! associativity + Standard_EXPORT Standard_Integer NbEntities() const; + + //! returns True if TransformationMatrix is Identity Matrix, + //! i.e:- No Matrix defined. + Standard_EXPORT Standard_Boolean IsIdentityMatrix() const; + + //! returns the Transformation matrix moving data from the XY plane + //! into space or zero + Standard_EXPORT Handle(IGESGeom_TransformationMatrix) TransformMatrix() const; + + //! returns the Entity on the specified plane, indicated by EntityIndex + //! raises an exception if EntityIndex <= 0 or + //! EntityIndex > NbEntities() + Standard_EXPORT Handle(IGESData_IGESEntity) Entity(const Standard_Integer EntityIndex) const; + + DEFINE_STANDARD_RTTIEXT(IGESDraw_Planar, IGESData_IGESEntity) + +protected: +private: + Standard_Integer theNbMatrices; + Handle(IGESGeom_TransformationMatrix) theTransformationMatrix; + Handle(IGESData_HArray1OfIGESEntity) theEntities; +}; + +#endif // _IGESDraw_Planar_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_SegmentedViewsVisible.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_SegmentedViewsVisible.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b26e78dc7352c69f6cab07ad98b6391a170359e0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_SegmentedViewsVisible.hxx @@ -0,0 +1,149 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( TCD ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDraw_SegmentedViewsVisible_HeaderFile +#define _IGESDraw_SegmentedViewsVisible_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +class IGESGraph_Color; +class IGESData_LineFontEntity; + +class IGESDraw_SegmentedViewsVisible; +DEFINE_STANDARD_HANDLE(IGESDraw_SegmentedViewsVisible, IGESData_ViewKindEntity) + +//! defines IGESSegmentedViewsVisible, Type <402> Form <19> +//! in package IGESDraw +//! +//! Permits the association of display parameters with the +//! segments of curves in a given view +class IGESDraw_SegmentedViewsVisible : public IGESData_ViewKindEntity +{ + +public: + Standard_EXPORT IGESDraw_SegmentedViewsVisible(); + + //! This method is used to set the fields of the class + //! SegmentedViewsVisible + //! - allViews : Pointers to View Entities + //! - allBreakpointParameters : Parameters of breakpoints + //! - allDisplayFlags : Display flags + //! - allColorValues : Color Values + //! - allColorDefinitions : Color Definitions + //! - allLineFontValues : LineFont values + //! - allLineFontDefinitions : LineFont Definitions + //! - allLineWeights : Line weights + //! raises exception if Lengths of allViews, allBreakpointParameters, + //! allDisplayFlags, allColorValues, allColorDefinitions, + //! allLineFontValues, allLineFontDefinitions and allLineWeights + //! are not same. + Standard_EXPORT void Init(const Handle(IGESDraw_HArray1OfViewKindEntity)& allViews, + const Handle(TColStd_HArray1OfReal)& allBreakpointParameters, + const Handle(TColStd_HArray1OfInteger)& allDisplayFlags, + const Handle(TColStd_HArray1OfInteger)& allColorValues, + const Handle(IGESGraph_HArray1OfColor)& allColorDefinitions, + const Handle(TColStd_HArray1OfInteger)& allLineFontValues, + const Handle(IGESBasic_HArray1OfLineFontEntity)& allLineFontDefinitions, + const Handle(TColStd_HArray1OfInteger)& allLineWeights); + + //! Returns False (for a complex view) + Standard_EXPORT Standard_Boolean IsSingle() const Standard_OVERRIDE; + + //! Returns the count of Views referenced by (inherited) + Standard_EXPORT Standard_Integer NbViews() const Standard_OVERRIDE; + + //! returns the number of view/segment blocks in + //! Similar to NbViews but has a more general significance + Standard_EXPORT Standard_Integer NbSegmentBlocks() const; + + //! returns the View entity indicated by ViewIndex + //! raises an exception if ViewIndex <= 0 or + //! ViewIndex > NbSegmentBlocks() + Standard_EXPORT Handle(IGESData_ViewKindEntity) ViewItem(const Standard_Integer ViewIndex) const + Standard_OVERRIDE; + + //! returns the parameter of the breakpoint indicated by + //! BreakpointIndex + //! raises an exception if BreakpointIndex <= 0 or + //! BreakpointIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Real BreakpointParameter(const Standard_Integer BreakpointIndex) const; + + //! returns the Display flag indicated by FlagIndex + //! raises an exception if FlagIndex <= 0 or + //! FlagIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Integer DisplayFlag(const Standard_Integer FlagIndex) const; + + //! returns True if the ColorIndex'th value of the + //! "theColorDefinitions" field of is a pointer + //! raises an exception if ColorIndex <= 0 or + //! ColorIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Boolean IsColorDefinition(const Standard_Integer ColorIndex) const; + + //! returns the Color value indicated by ColorIndex + //! raises an exception if ColorIndex <= 0 or + //! ColorIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Integer ColorValue(const Standard_Integer ColorIndex) const; + + //! returns the Color definition entity indicated by ColorIndex + //! raises an exception if ColorIndex <= 0 or + //! ColorIndex > NbSegmentBlocks(). + Standard_EXPORT Handle(IGESGraph_Color) ColorDefinition(const Standard_Integer ColorIndex) const; + + //! returns True if the FontIndex'th value of the + //! "theLineFontDefinitions" field of is a pointer + //! raises an exception if FontIndex <= 0 or + //! FontIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Boolean IsFontDefinition(const Standard_Integer FontIndex) const; + + //! returns the LineFont value indicated by FontIndex + //! raises an exception if FontIndex <= 0 or + //! FontIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Integer LineFontValue(const Standard_Integer FontIndex) const; + + //! returns the LineFont definition entity indicated by FontIndex + //! raises an exception if FontIndex <= 0 or + //! FontIndex > NbSegmentBlocks(). + Standard_EXPORT Handle(IGESData_LineFontEntity) LineFontDefinition( + const Standard_Integer FontIndex) const; + + //! returns the LineWeight value indicated by WeightIndex + //! raises an exception if WeightIndex <= 0 or + //! WeightIndex > NbSegmentBlocks(). + Standard_EXPORT Standard_Integer LineWeightItem(const Standard_Integer WeightIndex) const; + + DEFINE_STANDARD_RTTIEXT(IGESDraw_SegmentedViewsVisible, IGESData_ViewKindEntity) + +protected: +private: + Handle(IGESDraw_HArray1OfViewKindEntity) theViews; + Handle(TColStd_HArray1OfReal) theBreakpointParameters; + Handle(TColStd_HArray1OfInteger) theDisplayFlags; + Handle(TColStd_HArray1OfInteger) theColorValues; + Handle(IGESGraph_HArray1OfColor) theColorDefinitions; + Handle(TColStd_HArray1OfInteger) theLineFontValues; + Handle(IGESBasic_HArray1OfLineFontEntity) theLineFontDefinitions; + Handle(TColStd_HArray1OfInteger) theLineWeights; +}; + +#endif // _IGESDraw_SegmentedViewsVisible_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_ToolLabelDisplay.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_ToolLabelDisplay.hxx new file mode 100644 index 0000000000000000000000000000000000000000..344e3b632fc3ae21b1feb971543fe1025366f13b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESDraw_ToolLabelDisplay.hxx @@ -0,0 +1,84 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESDraw_ToolLabelDisplay_HeaderFile +#define _IGESDraw_ToolLabelDisplay_HeaderFile + +#include +#include +#include + +#include +class IGESDraw_LabelDisplay; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a LabelDisplay. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESDraw_ToolLabelDisplay +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolLabelDisplay, ready to work + Standard_EXPORT IGESDraw_ToolLabelDisplay(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESDraw_LabelDisplay)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESDraw_LabelDisplay)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a LabelDisplay , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESDraw_LabelDisplay)& ent, + Interface_EntityIterator& iter) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESDraw_LabelDisplay)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESDraw_LabelDisplay)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESDraw_LabelDisplay)& entfrom, + const Handle(IGESDraw_LabelDisplay)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESDraw_LabelDisplay)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESDraw_ToolLabelDisplay_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_CompositeCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_CompositeCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7ddbb0f7fc61bf6ad7717f10889be06bd82d69d0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_CompositeCurve.hxx @@ -0,0 +1,59 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen (Kiran) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESGeom_CompositeCurve_HeaderFile +#define _IGESGeom_CompositeCurve_HeaderFile + +#include + +#include +#include +#include + +class IGESGeom_CompositeCurve; +DEFINE_STANDARD_HANDLE(IGESGeom_CompositeCurve, IGESData_IGESEntity) + +//! defines IGESCompositeCurve, Type <102> Form <0> +//! in package IGESGeom +//! A composite curve is defined as an ordered list of entities +//! consisting of a point, connect point and parametrised curve +//! entities (excluding the CompositeCurve entity). +class IGESGeom_CompositeCurve : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESGeom_CompositeCurve(); + + //! This method is used to set the fields of the class + //! CompositeCurve + //! - allEntities : Constituent Entities of the composite curve + Standard_EXPORT void Init(const Handle(IGESData_HArray1OfIGESEntity)& allEntities); + + //! returns the number of curves contained in the CompositeCurve + Standard_EXPORT Standard_Integer NbCurves() const; + + //! returns Component of the CompositeCurve (a curve or a point) + //! raises exception if Index <= 0 or Index > NbCurves() + Standard_EXPORT Handle(IGESData_IGESEntity) Curve(const Standard_Integer Index) const; + + DEFINE_STANDARD_RTTIEXT(IGESGeom_CompositeCurve, IGESData_IGESEntity) + +protected: +private: + Handle(IGESData_HArray1OfIGESEntity) theEntities; +}; + +#endif // _IGESGeom_CompositeCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_ToolLine.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_ToolLine.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5239102031b3198fca2863574ab8484a4a1ce243 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESGeom_ToolLine.hxx @@ -0,0 +1,84 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESGeom_ToolLine_HeaderFile +#define _IGESGeom_ToolLine_HeaderFile + +#include +#include +#include + +#include +class IGESGeom_Line; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a Line. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESGeom_ToolLine +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolLine, ready to work + Standard_EXPORT IGESGeom_ToolLine(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESGeom_Line)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESGeom_Line)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a Line , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESGeom_Line)& ent, + Interface_EntityIterator& iter) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESGeom_Line)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESGeom_Line)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESGeom_Line)& entfrom, + const Handle(IGESGeom_Line)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESGeom_Line)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESGeom_ToolLine_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESGraph_LineFontDefPattern.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESGraph_LineFontDefPattern.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3a6003fc7455de09f74bb67ad96c70fc646cf680 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESGraph_LineFontDefPattern.hxx @@ -0,0 +1,82 @@ +// Created on: 1993-01-11 +// Created by: CKY / Contract Toubro-Larsen ( Niraj RANGWALA ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESGraph_LineFontDefPattern_HeaderFile +#define _IGESGraph_LineFontDefPattern_HeaderFile + +#include + +#include +#include +#include +#include +class TCollection_HAsciiString; + +class IGESGraph_LineFontDefPattern; +DEFINE_STANDARD_HANDLE(IGESGraph_LineFontDefPattern, IGESData_LineFontEntity) + +//! defines IGESLineFontDefPattern, Type <304> Form <2> +//! in package IGESGraph +//! +//! Line Font may be defined by repetition of a basic pattern +//! of visible-blank(or, on-off) segments superimposed on +//! a line or a curve. The line or curve is then displayed +//! according to the basic pattern. +class IGESGraph_LineFontDefPattern : public IGESData_LineFontEntity +{ + +public: + Standard_EXPORT IGESGraph_LineFontDefPattern(); + + //! This method is used to set the fields of the class + //! LineFontDefPattern + //! - allSegLength : Containing lengths of respective segments + //! - aPattern : HAsciiString indicating visible-blank segments + Standard_EXPORT void Init(const Handle(TColStd_HArray1OfReal)& allSegLength, + const Handle(TCollection_HAsciiString)& aPattern); + + //! returns the number of segments in the visible-blank pattern + Standard_EXPORT Standard_Integer NbSegments() const; + + //! returns the Length of Index'th segment of the basic pattern + //! raises exception if Index <= 0 or Index > NbSegments + Standard_EXPORT Standard_Real Length(const Standard_Integer Index) const; + + //! returns the string indicating which segments of the basic + //! pattern are visible and which are blanked. + //! e.g: + //! theNbSegments = 5 and if Bit Pattern = 10110, which means that + //! segments 2, 3 and 5 are visible, whereas segments 1 and 4 are + //! blank. The method returns "2H16" as the HAsciiString. + //! Note: The bits are right justified. (16h = 10110) + Standard_EXPORT Handle(TCollection_HAsciiString) DisplayPattern() const; + + //! The Display Pattern is decrypted to + //! return True if the Index'th basic pattern is Visible, + //! False otherwise. + //! If Index > NbSegments or Index <= 0 then return value is + //! False. + Standard_EXPORT Standard_Boolean IsVisible(const Standard_Integer Index) const; + + DEFINE_STANDARD_RTTIEXT(IGESGraph_LineFontDefPattern, IGESData_LineFontEntity) + +protected: +private: + Handle(TColStd_HArray1OfReal) theSegmentLengths; + Handle(TCollection_HAsciiString) theDisplayPattern; +}; + +#endif // _IGESGraph_LineFontDefPattern_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_AddGroup.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_AddGroup.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7b47adcfd8488e18c40c8f35a10d01cbfe7c4353 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_AddGroup.hxx @@ -0,0 +1,56 @@ +// Created on: 1995-03-02 +// Created by: Christian CAILLET +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSelect_AddGroup_HeaderFile +#define _IGESSelect_AddGroup_HeaderFile + +#include +#include + +#include +class IFSelect_ContextModif; +class IGESData_IGESModel; +class Interface_CopyTool; +class TCollection_AsciiString; + +class IGESSelect_AddGroup; +DEFINE_STANDARD_HANDLE(IGESSelect_AddGroup, IGESSelect_ModelModifier) + +//! Adds a Group to contain the entities designated by the +//! Selection. If no Selection is given, nothing is done +class IGESSelect_AddGroup : public IGESSelect_ModelModifier +{ + +public: + //! Creates an AddGroup + Standard_EXPORT IGESSelect_AddGroup(); + + //! Specific action : Adds a new group + Standard_EXPORT void Performing(IFSelect_ContextModif& ctx, + const Handle(IGESData_IGESModel)& target, + Interface_CopyTool& TC) const Standard_OVERRIDE; + + //! Returns a text which is + //! "Add Group" + Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESSelect_AddGroup, IGESSelect_ModelModifier) + +protected: +private: +}; + +#endif // _IGESSelect_AddGroup_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_ComputeStatus.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_ComputeStatus.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c07e5c31031ac40e508b7227e9a4c92118a7e4fa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_ComputeStatus.hxx @@ -0,0 +1,64 @@ +// Created on: 1994-06-01 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSelect_ComputeStatus_HeaderFile +#define _IGESSelect_ComputeStatus_HeaderFile + +#include +#include + +#include +class IFSelect_ContextModif; +class IGESData_IGESModel; +class Interface_CopyTool; +class TCollection_AsciiString; + +class IGESSelect_ComputeStatus; +DEFINE_STANDARD_HANDLE(IGESSelect_ComputeStatus, IGESSelect_ModelModifier) + +//! Computes Status of IGES Entities for a whole IGESModel. +//! This concerns SubordinateStatus and UseFlag, which must have +//! some definite values according the way they are referenced. +//! (see definitions of Logical use, Physical use, etc...) +//! +//! Works by calling a BasicEditor from IGESData. Works on the +//! whole produced (target) model, because computation is global. +class IGESSelect_ComputeStatus : public IGESSelect_ModelModifier +{ + +public: + //! Creates an ComputeStatus, which uses the system Date + Standard_EXPORT IGESSelect_ComputeStatus(); + + //! Specific action : it first evaluates the required values for + //! Subordinate Status and Use Flag (in Directory Part of each + //! IGES Entity). Then it corrects them, for the whole target. + //! Works with a Protocol. Implementation uses BasicEditor + Standard_EXPORT void Performing(IFSelect_ContextModif& ctx, + const Handle(IGESData_IGESModel)& target, + Interface_CopyTool& TC) const Standard_OVERRIDE; + + //! Returns a text which is + //! "Compute Subordinate Status and Use Flag" + Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESSelect_ComputeStatus, IGESSelect_ModelModifier) + +protected: +private: +}; + +#endif // _IGESSelect_ComputeStatus_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_RemoveCurves.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_RemoveCurves.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1b0877217a08ac1c51410bb4f3dff2ed4afab49e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_RemoveCurves.hxx @@ -0,0 +1,59 @@ +// Created on: 1999-02-24 +// Created by: Christian CAILLET +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSelect_RemoveCurves_HeaderFile +#define _IGESSelect_RemoveCurves_HeaderFile + +#include +#include + +#include +class IFSelect_ContextModif; +class IGESData_IGESModel; +class Interface_CopyTool; +class TCollection_AsciiString; + +class IGESSelect_RemoveCurves; +DEFINE_STANDARD_HANDLE(IGESSelect_RemoveCurves, IGESSelect_ModelModifier) + +//! Removes Curves UV or 3D (not both !) from Faces, those +//! designated by the Selection. No Selection means all the file +class IGESSelect_RemoveCurves : public IGESSelect_ModelModifier +{ + +public: + //! Creates a RemoveCurves from Faces (141/142/143/144) + //! UV True : Removes UV Curves (pcurves) + //! UV False : Removes 3D Curves + Standard_EXPORT IGESSelect_RemoveCurves(const Standard_Boolean UV); + + //! Specific action : Removes the Curves + Standard_EXPORT void Performing(IFSelect_ContextModif& ctx, + const Handle(IGESData_IGESModel)& target, + Interface_CopyTool& TC) const Standard_OVERRIDE; + + //! Returns a text which is + //! "Remove Curves UV on Face" or "Remove Curves 3D on Face" + Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESSelect_RemoveCurves, IGESSelect_ModelModifier) + +protected: +private: + Standard_Boolean theUV; +}; + +#endif // _IGESSelect_RemoveCurves_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_UpdateCreationDate.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_UpdateCreationDate.hxx new file mode 100644 index 0000000000000000000000000000000000000000..566d5cfc526a56ea2539965e638880e89ca31798 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSelect_UpdateCreationDate.hxx @@ -0,0 +1,60 @@ +// Created on: 1994-06-01 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSelect_UpdateCreationDate_HeaderFile +#define _IGESSelect_UpdateCreationDate_HeaderFile + +#include +#include + +#include +class IFSelect_ContextModif; +class IGESData_IGESModel; +class Interface_CopyTool; +class TCollection_AsciiString; + +class IGESSelect_UpdateCreationDate; +DEFINE_STANDARD_HANDLE(IGESSelect_UpdateCreationDate, IGESSelect_ModelModifier) + +//! Allows to Change the Creation Date indication in the Header +//! (Global Section) of IGES File. It is taken from the operating +//! system (time of application of the Modifier). +//! The Selection of the Modifier is not used : it simply acts as +//! a criterium to select IGES Files to touch up +class IGESSelect_UpdateCreationDate : public IGESSelect_ModelModifier +{ + +public: + //! Creates an UpdateCreationDate, which uses the system Date + Standard_EXPORT IGESSelect_UpdateCreationDate(); + + //! Specific action : only is used : the system Date + //! is set to Global Section Item n0 18. + Standard_EXPORT void Performing(IFSelect_ContextModif& ctx, + const Handle(IGESData_IGESModel)& target, + Interface_CopyTool& TC) const Standard_OVERRIDE; + + //! Returns a text which is + //! "Update IGES Header Creation Date" + Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(IGESSelect_UpdateCreationDate, IGESSelect_ModelModifier) + +protected: +private: +}; + +#endif // _IGESSelect_UpdateCreationDate_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_Block.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_Block.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d44951ae21dfa00149c367c33ba3f9a0dfdcd9fa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_Block.hxx @@ -0,0 +1,105 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( SIVA ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSolid_Block_HeaderFile +#define _IGESSolid_Block_HeaderFile + +#include +#include + +#include +#include +class gp_Pnt; +class gp_Dir; + +class IGESSolid_Block; +DEFINE_STANDARD_HANDLE(IGESSolid_Block, IGESData_IGESEntity) + +//! defines Block, Type <150> Form Number <0> +//! in package IGESSolid +//! The Block is a rectangular parallelopiped, defined with +//! one vertex at (X1, Y1, Z1) and three edges lying along +//! the local +X, +Y, +Z axes. +class IGESSolid_Block : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESSolid_Block(); + + //! This method is used to set the fields of the class Block + //! - aSize : Length in each local directions + //! - aCorner : Corner point coordinates. Default (0,0,0) + //! - aXAxis : Unit vector defining local X-axis + //! default (1,0,0) + //! - aZAxis : Unit vector defining local Z-axis + //! default (0,0,1) + Standard_EXPORT void Init(const gp_XYZ& aSize, + const gp_XYZ& aCorner, + const gp_XYZ& aXAxis, + const gp_XYZ& aZAxis); + + //! returns the size of the block + Standard_EXPORT gp_XYZ Size() const; + + //! returns the length of the Block along the local X-direction + Standard_EXPORT Standard_Real XLength() const; + + //! returns the length of the Block along the local Y-direction + Standard_EXPORT Standard_Real YLength() const; + + //! returns the length of the Block along the local Z-direction + Standard_EXPORT Standard_Real ZLength() const; + + //! returns the corner point coordinates of the Block + Standard_EXPORT gp_Pnt Corner() const; + + //! returns the corner point coordinates of the Block after applying + //! the TransformationMatrix + Standard_EXPORT gp_Pnt TransformedCorner() const; + + //! returns the direction defining the local X-axis + Standard_EXPORT gp_Dir XAxis() const; + + //! returns the direction defining the local X-axis after applying + //! TransformationMatrix + Standard_EXPORT gp_Dir TransformedXAxis() const; + + //! returns the direction defining the local Y-axis + //! it is the cross product of ZAxis and XAxis + Standard_EXPORT gp_Dir YAxis() const; + + //! returns the direction defining the local Y-axis after applying + //! TransformationMatrix + Standard_EXPORT gp_Dir TransformedYAxis() const; + + //! returns the direction defining the local X-axis + Standard_EXPORT gp_Dir ZAxis() const; + + //! returns the direction defining the local Z-axis after applying + //! TransformationMatrix + Standard_EXPORT gp_Dir TransformedZAxis() const; + + DEFINE_STANDARD_RTTIEXT(IGESSolid_Block, IGESData_IGESEntity) + +protected: +private: + gp_XYZ theSize; + gp_XYZ theCorner; + gp_XYZ theXAxis; + gp_XYZ theZAxis; +}; + +#endif // _IGESSolid_Block_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_HArray1OfLoop.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_HArray1OfLoop.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e3f6d219940a5f25e9a86d041f145a97281af64d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_HArray1OfLoop.hxx @@ -0,0 +1,25 @@ +// Created on: 1993-01-11 +// Created by: SIVA +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef IGESSolid_HArray1OfLoop_HeaderFile +#define IGESSolid_HArray1OfLoop_HeaderFile + +#include +#include + +DEFINE_HARRAY1(IGESSolid_HArray1OfLoop, IGESSolid_Array1OfLoop) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ManifoldSolid.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ManifoldSolid.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2d0d98253894535ab803a5fc76e1903ea53ac543 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ManifoldSolid.hxx @@ -0,0 +1,81 @@ +// Created on: 1993-01-09 +// Created by: CKY / Contract Toubro-Larsen ( SIVA ) +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSolid_ManifoldSolid_HeaderFile +#define _IGESSolid_ManifoldSolid_HeaderFile + +#include + +#include +#include +#include +#include +class IGESSolid_Shell; + +class IGESSolid_ManifoldSolid; +DEFINE_STANDARD_HANDLE(IGESSolid_ManifoldSolid, IGESData_IGESEntity) + +//! defines ManifoldSolid, Type <186> Form Number <0> +//! in package IGESSolid +//! A manifold solid is a bounded, closed, and finite volume +//! in three dimensional Euclidean space +class IGESSolid_ManifoldSolid : public IGESData_IGESEntity +{ + +public: + Standard_EXPORT IGESSolid_ManifoldSolid(); + + //! This method is used to set the fields of the class + //! ManifoldSolid + //! - aShell : pointer to the shell + //! - shellflag : orientation flag of shell + //! - voidShells : the void shells + //! - voidShellFlags : orientation of the void shells + //! raises exception if length of voidShells and voidShellFlags + //! do not match + Standard_EXPORT void Init(const Handle(IGESSolid_Shell)& aShell, + const Standard_Boolean shellflag, + const Handle(IGESSolid_HArray1OfShell)& voidShells, + const Handle(TColStd_HArray1OfInteger)& voidShellFlags); + + //! returns the Shell entity which is being referred + Standard_EXPORT Handle(IGESSolid_Shell) Shell() const; + + //! returns the orientation flag of the shell + Standard_EXPORT Standard_Boolean OrientationFlag() const; + + //! returns the number of void shells + Standard_EXPORT Standard_Integer NbVoidShells() const; + + //! returns Index'th void shell. + //! raises exception if Index <= 0 or Index > NbVoidShells() + Standard_EXPORT Handle(IGESSolid_Shell) VoidShell(const Standard_Integer Index) const; + + //! returns Index'th orientation flag. + //! raises exception if Index <= 0 or Index > NbVoidShells() + Standard_EXPORT Standard_Boolean VoidOrientationFlag(const Standard_Integer Index) const; + + DEFINE_STANDARD_RTTIEXT(IGESSolid_ManifoldSolid, IGESData_IGESEntity) + +protected: +private: + Handle(IGESSolid_Shell) theShell; + Standard_Boolean theOrientationFlag; + Handle(IGESSolid_HArray1OfShell) theVoidShells; + Handle(TColStd_HArray1OfInteger) theOrientFlags; +}; + +#endif // _IGESSolid_ManifoldSolid_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ToolShell.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ToolShell.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6213ef6d9caa2220f126ff96f204641e90060b4b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IGESSolid_ToolShell.hxx @@ -0,0 +1,84 @@ +// Created on: 1993-10-14 +// Created by: Christian CAILLET +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IGESSolid_ToolShell_HeaderFile +#define _IGESSolid_ToolShell_HeaderFile + +#include +#include +#include + +#include +class IGESSolid_Shell; +class IGESData_IGESReaderData; +class IGESData_ParamReader; +class IGESData_IGESWriter; +class Interface_EntityIterator; +class IGESData_DirChecker; +class Interface_ShareTool; +class Interface_Check; +class Interface_CopyTool; +class IGESData_IGESDumper; + +//! Tool to work on a Shell. Called by various Modules +//! (ReadWriteModule, GeneralModule, SpecificModule) +class IGESSolid_ToolShell +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a ToolShell, ready to work + Standard_EXPORT IGESSolid_ToolShell(); + + //! Reads own parameters from file. gives access to them, + //! detains parameter types and values + Standard_EXPORT void ReadOwnParams(const Handle(IGESSolid_Shell)& ent, + const Handle(IGESData_IGESReaderData)& IR, + IGESData_ParamReader& PR) const; + + //! Writes own parameters to IGESWriter + Standard_EXPORT void WriteOwnParams(const Handle(IGESSolid_Shell)& ent, + IGESData_IGESWriter& IW) const; + + //! Lists the Entities shared by a Shell , from + //! its specific (own) parameters + Standard_EXPORT void OwnShared(const Handle(IGESSolid_Shell)& ent, + Interface_EntityIterator& iter) const; + + //! Returns specific DirChecker + Standard_EXPORT IGESData_DirChecker DirChecker(const Handle(IGESSolid_Shell)& ent) const; + + //! Performs Specific Semantic Check + Standard_EXPORT void OwnCheck(const Handle(IGESSolid_Shell)& ent, + const Interface_ShareTool& shares, + Handle(Interface_Check)& ach) const; + + //! Copies Specific Parameters + Standard_EXPORT void OwnCopy(const Handle(IGESSolid_Shell)& entfrom, + const Handle(IGESSolid_Shell)& entto, + Interface_CopyTool& TC) const; + + //! Dump of Specific Parameters + Standard_EXPORT void OwnDump(const Handle(IGESSolid_Shell)& ent, + const IGESData_IGESDumper& dumper, + Standard_OStream& S, + const Standard_Integer own) const; + +protected: +private: +}; + +#endif // _IGESSolid_ToolShell_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IMeshData_StatusOwner.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IMeshData_StatusOwner.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b62d1c721f49f44a7a79bbc92ab6074dea4f5d4a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IMeshData_StatusOwner.hxx @@ -0,0 +1,57 @@ +// Created on: 2016-06-23 +// Copyright (c) 2016 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IMeshData_StatusOwner_HeaderFile +#define _IMeshData_StatusOwner_HeaderFile + +#include + +//! Extension interface class providing status functionality. +class IMeshData_StatusOwner +{ +public: + //! Destructor. + virtual ~IMeshData_StatusOwner() {} + + //! Returns true in case if status is strictly equal to the given value. + Standard_Boolean IsEqual(const IMeshData_Status theValue) const { return (myStatus == theValue); } + + //! Returns true in case if status is set. + Standard_Boolean IsSet(const IMeshData_Status theValue) const + { + return (myStatus & theValue) != 0; + } + + //! Adds status to status flags of a face. + void SetStatus(const IMeshData_Status theValue) { myStatus |= theValue; } + + //! Adds status to status flags of a face. + void UnsetStatus(const IMeshData_Status theValue) { myStatus &= ~theValue; } + + //! Returns complete status mask. + Standard_Integer GetStatusMask() const { return myStatus; } + +protected: + //! Constructor. Initializes default status. + IMeshData_StatusOwner() + : myStatus(IMeshData_NoError) + { + } + +private: + Standard_Integer myStatus; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_CurveTessellator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_CurveTessellator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bfc9a861975a2ddcb3eef5b215906494e3f777b5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_CurveTessellator.hxx @@ -0,0 +1,50 @@ +// Created on: 2016-04-19 +// Copyright (c) 2016 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IMeshTools_EdgeTessellator_HeaderFile +#define _IMeshTools_EdgeTessellator_HeaderFile + +#include +#include + +class gp_Pnt; + +//! Interface class providing API for edge tessellation tools. +class IMeshTools_CurveTessellator : public Standard_Transient +{ +public: + //! Destructor. + virtual ~IMeshTools_CurveTessellator() {} + + //! Returns number of tessellation points. + Standard_EXPORT virtual Standard_Integer PointsNb() const = 0; + + //! Returns parameters of solution with the given index. + //! @param theIndex index of tessellation point. + //! @param thePoint tessellation point. + //! @param theParameter parameters on PCurve corresponded to the solution. + //! @return True in case of valid result, false elewhere. + Standard_EXPORT virtual Standard_Boolean Value(const Standard_Integer theIndex, + gp_Pnt& thePoint, + Standard_Real& theParameter) const = 0; + + DEFINE_STANDARD_RTTIEXT(IMeshTools_CurveTessellator, Standard_Transient) + +protected: + //! Constructor. + IMeshTools_CurveTessellator() {} +}; + +#endif \ No newline at end of file diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_ShapeExplorer.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_ShapeExplorer.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ad694111c04aaf4fe273ac6e672722cf691758f2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IMeshTools_ShapeExplorer.hxx @@ -0,0 +1,40 @@ +// Created on: 2016-04-07 +// Copyright (c) 2016 OPEN CASCADE SAS +// Created by: Oleg AGASHIN +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IMeshTools_ShapeExplorer_HeaderFile +#define _IMeshTools_ShapeExplorer_HeaderFile + +#include +#include +#include +#include + +//! Explores TopoDS_Shape for parts to be meshed - faces and free edges. +class IMeshTools_ShapeExplorer : public IMeshData_Shape +{ +public: + //! Constructor. + Standard_EXPORT IMeshTools_ShapeExplorer(const TopoDS_Shape& theShape); + + //! Destructor. + Standard_EXPORT virtual ~IMeshTools_ShapeExplorer(); + + //! Starts exploring of a shape. + Standard_EXPORT virtual void Accept(const Handle(IMeshTools_ShapeVisitor)& theVisitor); + + DEFINE_STANDARD_RTTIEXT(IMeshTools_ShapeExplorer, IMeshData_Shape) +}; + +#endif \ No newline at end of file diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntAna2d_AnaIntersection.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IntAna2d_AnaIntersection.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fdc37d8b8635747851b0ed74c014610439c4a765 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntAna2d_AnaIntersection.hxx @@ -0,0 +1,137 @@ +// Created on: 1991-02-20 +// Created by: Jacques GOUSSARD +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IntAna2d_AnaIntersection_HeaderFile +#define _IntAna2d_AnaIntersection_HeaderFile + +#include +#include + +#include +#include +class gp_Lin2d; +class gp_Circ2d; +class IntAna2d_Conic; +class gp_Elips2d; +class gp_Parab2d; +class gp_Hypr2d; + +//! Implementation of the analytical intersection between: +//! - two Lin2d, +//! - two Circ2d, +//! - a Lin2d and a Circ2d, +//! - an element of gp (Lin2d, Circ2d, Elips2d, Parab2d, Hypr2d) +//! and another conic. +//! No tolerance is given for all the intersections: the tolerance +//! will be the "precision machine". +class IntAna2d_AnaIntersection +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor. IsDone returns False. + Standard_EXPORT IntAna2d_AnaIntersection(); + + //! Intersection between two lines. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L1, const gp_Lin2d& L2); + + //! Intersection between two circles. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Circ2d& C1, const gp_Circ2d& C2); + + //! Intersection between a line and a circle. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L, const gp_Circ2d& C); + + //! Intersection between a line and a conic. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L, const IntAna2d_Conic& C); + + //! Intersection between a circle and another conic. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Circ2d& C, const IntAna2d_Conic& Co); + + //! Intersection between an ellipse and another conic. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Elips2d& E, const IntAna2d_Conic& C); + + //! Intersection between a parabola and another conic. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Parab2d& P, const IntAna2d_Conic& C); + + //! Intersection between an hyperbola and another conic. + Standard_EXPORT IntAna2d_AnaIntersection(const gp_Hypr2d& H, const IntAna2d_Conic& C); + + //! Intersection between two lines. + Standard_EXPORT void Perform(const gp_Lin2d& L1, const gp_Lin2d& L2); + + //! Intersection between two circles. + Standard_EXPORT void Perform(const gp_Circ2d& C1, const gp_Circ2d& C2); + + //! Intersection between a line and a circle. + Standard_EXPORT void Perform(const gp_Lin2d& L, const gp_Circ2d& C); + + //! Intersection between a line and a conic. + Standard_EXPORT void Perform(const gp_Lin2d& L, const IntAna2d_Conic& C); + + //! Intersection between a circle and another conic. + Standard_EXPORT void Perform(const gp_Circ2d& C, const IntAna2d_Conic& Co); + + //! Intersection between an ellipse and another conic. + Standard_EXPORT void Perform(const gp_Elips2d& E, const IntAna2d_Conic& C); + + //! Intersection between a parabola and another conic. + Standard_EXPORT void Perform(const gp_Parab2d& P, const IntAna2d_Conic& C); + + //! Intersection between an hyperbola and another conic. + Standard_EXPORT void Perform(const gp_Hypr2d& H, const IntAna2d_Conic& C); + + //! Returns TRUE if the computation was successful. + Standard_Boolean IsDone() const; + + //! Returns TRUE when there is no intersection, i-e + //! - no intersection point + //! - the elements are not identical. + //! The element may be parallel in this case. + Standard_Boolean IsEmpty() const; + + //! For the intersection between an element of gp and a conic + //! known by an implicit equation, the result will be TRUE + //! if the element of gp verifies the implicit equation. + //! For the intersection between two Lin2d or two Circ2d, the + //! result will be TRUE if the elements are identical. + //! The function returns FALSE in all the other cases. + Standard_Boolean IdenticalElements() const; + + //! For the intersection between two Lin2d or two Circ2d, + //! the function returns TRUE if the elements are parallel. + //! The function returns FALSE in all the other cases. + Standard_Boolean ParallelElements() const; + + //! returns the number of IntPoint between the 2 curves. + Standard_Integer NbPoints() const; + + //! returns the intersection point of range N; + //! If (N<=0) or (N>NbPoints), an exception is raised. + const IntAna2d_IntPoint& Point(const Standard_Integer N) const; + +protected: +private: + Standard_Boolean done; + Standard_Boolean para; + Standard_Boolean iden; + Standard_Boolean empt; + Standard_Integer nbp; + IntAna2d_IntPoint lpnt[4]; +}; + +#include + +#endif // _IntAna2d_AnaIntersection_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntAna_Quadric.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IntAna_Quadric.hxx new file mode 100644 index 0000000000000000000000000000000000000000..da96919bf40adc45d48e1d4ff9877ee1b8de3298 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntAna_Quadric.hxx @@ -0,0 +1,112 @@ +// Created on: 1992-07-01 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _IntAna_Quadric_HeaderFile +#define _IntAna_Quadric_HeaderFile + +#include +#include + +class gp_Cone; +class gp_Cylinder; +class gp_Pln; +class gp_Sphere; + +//! This class provides a description of Quadrics by their +//! Coefficients in natural coordinate system. +class IntAna_Quadric +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty Constructor + Standard_EXPORT IntAna_Quadric(); + + //! Creates a Quadric from a Pln + Standard_EXPORT IntAna_Quadric(const gp_Pln& P); + + //! Creates a Quadric from a Sphere + Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph); + + //! Creates a Quadric from a Cylinder + Standard_EXPORT IntAna_Quadric(const gp_Cylinder& Cyl); + + //! Creates a Quadric from a Cone + Standard_EXPORT IntAna_Quadric(const gp_Cone& Cone); + + //! Initializes the quadric with a Pln + Standard_EXPORT void SetQuadric(const gp_Pln& P); + + //! Initialize the quadric with a Sphere + Standard_EXPORT void SetQuadric(const gp_Sphere& Sph); + + //! Initializes the quadric with a Cone + Standard_EXPORT void SetQuadric(const gp_Cone& Con); + + //! Initializes the quadric with a Cylinder + Standard_EXPORT void SetQuadric(const gp_Cylinder& Cyl); + + //! Returns the coefficients of the polynomial equation + //! which define the quadric: + //! xCXX x**2 + xCYY y**2 + xCZZ z**2 + //! + 2 ( xCXY x y + xCXZ x z + xCYZ y z ) + //! + 2 ( xCX x + xCY y + xCZ z ) + //! + xCCte + Standard_EXPORT void Coefficients(Standard_Real& xCXX, + Standard_Real& xCYY, + Standard_Real& xCZZ, + Standard_Real& xCXY, + Standard_Real& xCXZ, + Standard_Real& xCYZ, + Standard_Real& xCX, + Standard_Real& xCY, + Standard_Real& xCZ, + Standard_Real& xCCte) const; + + //! Returns the coefficients of the polynomial equation + //! ( written in the natural coordinates system ) + //! in the local coordinates system defined by Axis + Standard_EXPORT void NewCoefficients(Standard_Real& xCXX, + Standard_Real& xCYY, + Standard_Real& xCZZ, + Standard_Real& xCXY, + Standard_Real& xCXZ, + Standard_Real& xCYZ, + Standard_Real& xCX, + Standard_Real& xCY, + Standard_Real& xCZ, + Standard_Real& xCCte, + const gp_Ax3& Axis) const; + + //! Returns the list of special points (with singularities) + const NCollection_List& SpecialPoints() const { return mySpecialPoints; } + +protected: +private: + Standard_Real CXX; + Standard_Real CYY; + Standard_Real CZZ; + Standard_Real CXY; + Standard_Real CXZ; + Standard_Real CYZ; + Standard_Real CX; + Standard_Real CY; + Standard_Real CZ; + Standard_Real CCte; + NCollection_List mySpecialPoints; +}; + +#endif // _IntAna_Quadric_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntCurveSurface_IntersectionPoint.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntCurveSurface_IntersectionPoint.lxx new file mode 100644 index 0000000000000000000000000000000000000000..8d1c3b669b63299b1cec648bf492e4b3be93b200 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntCurveSurface_IntersectionPoint.lxx @@ -0,0 +1,42 @@ +// Created on: 1993-04-07 +// Created by: Laurent BUCHARD +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// -- + +inline const gp_Pnt& IntCurveSurface_IntersectionPoint::Pnt() const +{ + return (myP); +} + +inline Standard_Real IntCurveSurface_IntersectionPoint::U() const +{ + return (myUSurf); +} + +inline Standard_Real IntCurveSurface_IntersectionPoint::V() const +{ + return (myVSurf); +} + +inline Standard_Real IntCurveSurface_IntersectionPoint::W() const +{ + return (myUCurv); +} + +inline IntCurveSurface_TransitionOnCurve IntCurveSurface_IntersectionPoint::Transition() const +{ + return (myTrOnCurv); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_PConic.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_PConic.lxx new file mode 100644 index 0000000000000000000000000000000000000000..f2998dfb15d7ac602a95535e508e8c0b3dc3976d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_PConic.lxx @@ -0,0 +1,45 @@ +// Created on: 1992-03-31 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +inline Standard_Real IntCurve_PConic::EpsX(void) const +{ + return (TheEpsX); +} + +inline Standard_Real IntCurve_PConic::Param1(void) const +{ + return (prm1); +} + +inline Standard_Real IntCurve_PConic::Param2(void) const +{ + return (prm2); +} + +inline const gp_Ax22d& IntCurve_PConic::Axis2(void) const +{ + return (axe); +} + +inline GeomAbs_CurveType IntCurve_PConic::TypeCurve(void) const +{ + return (type); +} + +inline Standard_Integer IntCurve_PConic::Accuracy(void) const +{ + return (TheAccuracy); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_Polygon2dGen.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_Polygon2dGen.lxx new file mode 100644 index 0000000000000000000000000000000000000000..eeaa6ef63b2006e35c2bfe0a7e9ab334d52ead6b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntCurve_Polygon2dGen.lxx @@ -0,0 +1,93 @@ +// Created on: 1993-06-03 +// Created by: Laurent BUCHARD +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//====================================================================== +inline Standard_Real IntCurve_Polygon2dGen::DeflectionOverEstimation() const +{ + return (TheDeflection); +} //====================================================================== + +inline void IntCurve_Polygon2dGen::SetDeflectionOverEstimation(const Standard_Real x) +{ + TheDeflection = x; + myBox.Enlarge(TheDeflection); +} + +//====================================================================== +inline void IntCurve_Polygon2dGen::Closed(const Standard_Boolean flag) +{ + ClosedPolygon = flag; +} + +//====================================================================== +inline Standard_Integer IntCurve_Polygon2dGen::NbSegments(void) const +{ + return ((ClosedPolygon) ? NbPntIn : NbPntIn - 1); +} + +//====================================================================== +inline Standard_Real IntCurve_Polygon2dGen::InfParameter() const +{ + return (TheParams.Value(TheIndex(1))); +} + +//====================================================================== +inline Standard_Real IntCurve_Polygon2dGen::SupParameter() const +{ + return (TheParams.Value(TheIndex(NbPntIn))); +} + +//====================================================================== + +//====================================================================== +inline Standard_Integer IntCurve_Polygon2dGen::CalculRegion(const Standard_Real x, + const Standard_Real y, + const Standard_Real x1, + const Standard_Real x2, + const Standard_Real y1, + const Standard_Real y2) const +{ + Standard_Integer r; + if (x < x1) + { + r = 1; + } + else + { + if (x > x2) + { + r = 2; + } + else + { + r = 0; + } + } + if (y < y1) + { + r |= 4; + } + else + { + if (y > y2) + { + r |= 8; + } + } + return (r); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntImp_ZerImpFunc.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntImp_ZerImpFunc.lxx new file mode 100644 index 0000000000000000000000000000000000000000..cfac2cf51b5e57c7b9b7dc8e1b2df71c78e863d5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntImp_ZerImpFunc.lxx @@ -0,0 +1,69 @@ +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +inline void IntImp_ZerImpFunc::Set(const ThePSurface& PS) +{ + surf = (Standard_Address)(&PS); +} + +inline void IntImp_ZerImpFunc::SetImplicitSurface(const TheISurface& IS) +{ + func = (Standard_Address)(&IS); +} + +inline void IntImp_ZerImpFunc::Set(const Standard_Real Tol) +{ + tol = Tol; +} + +inline Standard_Real IntImp_ZerImpFunc::Root() const +{ + return valf; +} + +inline Standard_Real IntImp_ZerImpFunc::Tolerance() const +{ + return tol; +} + +inline const gp_Pnt& IntImp_ZerImpFunc::Point() const +{ + return pntsol; +} + +inline const gp_Vec& IntImp_ZerImpFunc::Direction3d() +{ + if (IsTangent()) + throw StdFail_UndefinedDerivative(); + return d3d; +} + +inline const gp_Dir2d& IntImp_ZerImpFunc::Direction2d() +{ + if (IsTangent()) + throw StdFail_UndefinedDerivative(); + return d2d; +} + +inline const ThePSurface& IntImp_ZerImpFunc::PSurface() const +{ + return (*((ThePSurface*)(surf))); +} + +inline const TheISurface& IntImp_ZerImpFunc::ISurface() const +{ + return (*((TheISurface*)(func))); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_HCurve2dTool.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_HCurve2dTool.lxx new file mode 100644 index 0000000000000000000000000000000000000000..7d25d74a51879774efefbd1a4bee576c937e1b02 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_HCurve2dTool.lxx @@ -0,0 +1,194 @@ +// Created on: 1992-10-22 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +//============================================================ +inline Standard_Real IntPatch_HCurve2dTool::FirstParameter(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->FirstParameter()); +} + +//============================================================ +inline Standard_Real IntPatch_HCurve2dTool::LastParameter(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->LastParameter()); +} + +//============================================================ +inline GeomAbs_Shape IntPatch_HCurve2dTool::Continuity(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Continuity()); +} + +//============================================================ +inline Standard_Integer IntPatch_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_Curve2d)& C, + const GeomAbs_Shape Sh) +{ + return (C->NbIntervals(Sh)); +} + +//============================================================ +inline void IntPatch_HCurve2dTool::Intervals(const Handle(Adaptor2d_Curve2d)& C, + TColStd_Array1OfReal& Tab, + const GeomAbs_Shape Sh) +{ + C->Intervals(Tab, Sh); +} + +//============================================================ +inline Standard_Boolean IntPatch_HCurve2dTool::IsClosed(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->IsClosed()); +} + +//============================================================ +inline Standard_Boolean IntPatch_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->IsPeriodic()); +} + +//============================================================ +inline Standard_Real IntPatch_HCurve2dTool::Period(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Period()); +} + +//============================================================ +inline gp_Pnt2d IntPatch_HCurve2dTool::Value(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U) +{ + return (C->Value(U)); +} + +//============================================================ +inline void IntPatch_HCurve2dTool::D0(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P) +{ + C->D0(U, P); +} + +//============================================================ +inline void IntPatch_HCurve2dTool::D1(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& T) +{ + C->D1(U, P, T); +} + +//============================================================ +inline void IntPatch_HCurve2dTool::D2(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& T, + gp_Vec2d& N) +{ + C->D2(U, P, T, N); +} + +//============================================================ +inline void IntPatch_HCurve2dTool::D3(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + gp_Pnt2d& P, + gp_Vec2d& V1, + gp_Vec2d& V2, + gp_Vec2d& V3) +{ + C->D3(U, P, V1, V2, V3); +} + +//============================================================ +inline gp_Vec2d IntPatch_HCurve2dTool::DN(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real U, + const Standard_Integer N) +{ + return (C->DN(U, N)); +} + +//============================================================ +inline Standard_Real IntPatch_HCurve2dTool::Resolution(const Handle(Adaptor2d_Curve2d)& C, + const Standard_Real R3d) +{ + return (C->Resolution(R3d)); +} + +//============================================================ +inline GeomAbs_CurveType IntPatch_HCurve2dTool::GetType(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->GetType()); +} + +//============================================================ +inline gp_Lin2d IntPatch_HCurve2dTool::Line(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Line()); +} + +//============================================================ +inline gp_Circ2d IntPatch_HCurve2dTool::Circle(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Circle()); +} + +//============================================================ +inline gp_Elips2d IntPatch_HCurve2dTool::Ellipse(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Ellipse()); +} + +//============================================================ +inline gp_Parab2d IntPatch_HCurve2dTool::Parabola(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Parabola()); +} + +//============================================================ +inline gp_Hypr2d IntPatch_HCurve2dTool::Hyperbola(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Hyperbola()); +} + +//============================================================ +inline Handle(Geom2d_BezierCurve) IntPatch_HCurve2dTool::Bezier(const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->Bezier()); +} + +//============================================================ +inline Handle(Geom2d_BSplineCurve) IntPatch_HCurve2dTool::BSpline( + const Handle(Adaptor2d_Curve2d)& C) +{ + return (C->BSpline()); +} + +//============================================================ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_Line.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_Line.lxx new file mode 100644 index 0000000000000000000000000000000000000000..22c38d37343072d951acb0aa085d6cc8c5806ce5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntPatch_Line.lxx @@ -0,0 +1,93 @@ +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +inline void IntPatch_Line::SetValue(const Standard_Boolean Uiso1, + const Standard_Boolean Viso1, + const Standard_Boolean Uiso2, + const Standard_Boolean Viso2) +{ + uS1 = Uiso1; + vS1 = Viso1; + uS2 = Uiso2; + vS2 = Viso2; +} + +inline IntPatch_IType IntPatch_Line::ArcType() const +{ + return typ; +} + +inline Standard_Boolean IntPatch_Line::IsTangent() const +{ + + return tg; +} + +inline IntSurf_TypeTrans IntPatch_Line::TransitionOnS1() const +{ + + return tS1; +} + +inline IntSurf_TypeTrans IntPatch_Line::TransitionOnS2() const +{ + + return tS2; +} + +inline IntSurf_Situation IntPatch_Line::SituationS1() const +{ + + if (tS1 != IntSurf_Touch) + { + throw Standard_DomainError(); + } + return sit1; +} + +inline IntSurf_Situation IntPatch_Line::SituationS2() const +{ + + if (tS2 != IntSurf_Touch) + { + throw Standard_DomainError(); + } + return sit2; +} + +inline Standard_Boolean IntPatch_Line::IsUIsoOnS1() const +{ + + return uS1; +} + +inline Standard_Boolean IntPatch_Line::IsVIsoOnS1() const +{ + + return vS1; +} + +inline Standard_Boolean IntPatch_Line::IsUIsoOnS2() const +{ + + return uS2; +} + +inline Standard_Boolean IntPatch_Line::IsVIsoOnS2() const +{ + + return vS2; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_IntersectionSegment.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_IntersectionSegment.lxx new file mode 100644 index 0000000000000000000000000000000000000000..ce20857847571777530c83dc959aa8468edc8f0b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_IntersectionSegment.lxx @@ -0,0 +1,125 @@ +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment( + const IntRes2d_IntersectionPoint& P1, + const IntRes2d_IntersectionPoint& P2, + const Standard_Boolean Oppos, + const Standard_Boolean ReverseFlag) + : + + oppos(Oppos), + first(Standard_True), + last(Standard_True), + ptfirst(P1), + ptlast(P2) +{ + if (ReverseFlag) + { + if (Oppos) + { + ptfirst = P2; + ptlast = P1; + } + } +} + +inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment( + const IntRes2d_IntersectionPoint& P, + const Standard_Boolean First, + const Standard_Boolean Oppos, + const Standard_Boolean ReverseFlag) + : + + oppos(Oppos), + ptfirst(), + ptlast() +{ + if (ReverseFlag && Oppos) + { + if (First) + { + first = Standard_False; + last = Standard_True; + ptlast = P; + } + else + { + first = Standard_True; + last = Standard_False; + ptfirst = P; + } + } + else + { + if (First) + { + first = Standard_True; + last = Standard_False; + ptfirst = P; + } + else + { + first = Standard_False; + last = Standard_True; + ptlast = P; + } + } +} + +inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment(const Standard_Boolean Oppos) + : oppos(Oppos), + first(Standard_False), + last(Standard_False), + ptfirst(), + ptlast() +{ +} + +inline Standard_Boolean IntRes2d_IntersectionSegment::IsOpposite() const +{ + return oppos; +} + +inline Standard_Boolean IntRes2d_IntersectionSegment::HasFirstPoint() const +{ + return first; +} + +inline Standard_Boolean IntRes2d_IntersectionSegment::HasLastPoint() const +{ + return last; +} + +inline const IntRes2d_IntersectionPoint& IntRes2d_IntersectionSegment::FirstPoint() const +{ + + if (!first) + { + throw Standard_DomainError(); + } + return ptfirst; +} + +inline const IntRes2d_IntersectionPoint& IntRes2d_IntersectionSegment::LastPoint() const +{ + + if (!last) + { + throw Standard_DomainError(); + } + return ptlast; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_SequenceOfIntersectionPoint.hxx b/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_SequenceOfIntersectionPoint.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4fd487346295c79d1523f511d4c2966142324bf7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntRes2d_SequenceOfIntersectionPoint.hxx @@ -0,0 +1,25 @@ +// Created on: 1992-04-03 +// Created by: Laurent BUCHARD +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef IntRes2d_SequenceOfIntersectionPoint_HeaderFile +#define IntRes2d_SequenceOfIntersectionPoint_HeaderFile + +#include +#include + +typedef NCollection_Sequence IntRes2d_SequenceOfIntersectionPoint; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/IntWalk_PWalking.lxx b/data/miniconda3/envs/catiagent/include/opencascade/IntWalk_PWalking.lxx new file mode 100644 index 0000000000000000000000000000000000000000..fb46c08dbc136572c06e43819cd662a1b610d687 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/IntWalk_PWalking.lxx @@ -0,0 +1,99 @@ +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +inline Standard_Boolean IntWalk_PWalking::IsDone() const +{ + return done; +} + +inline Standard_Integer IntWalk_PWalking::NbPoints() const +{ + if (!done) + throw StdFail_NotDone(); + return line->NbPoints(); +} + +inline const IntSurf_PntOn2S& IntWalk_PWalking::Value(const Standard_Integer Index) const +{ + if (!done) + throw StdFail_NotDone(); + return line->Value(Index); +} + +inline const Handle(IntSurf_LineOn2S)& IntWalk_PWalking::Line() const +{ + + if (!done) + throw StdFail_NotDone(); + return line; +} + +inline Standard_Boolean IntWalk_PWalking::TangentAtFirst() const +{ + if (!done) + throw StdFail_NotDone(); + return tgfirst; +} + +inline Standard_Boolean IntWalk_PWalking::TangentAtLast() const +{ + if (!done) + throw StdFail_NotDone(); + return tglast; +} + +inline Standard_Boolean IntWalk_PWalking::IsClosed() const +{ + if (!done) + throw StdFail_NotDone(); + return close; +} + +inline const gp_Dir& IntWalk_PWalking::TangentAtLine(Standard_Integer& theIndex) const +{ + if (!done) + throw StdFail_NotDone(); + theIndex = myTangentIdx; + return tgdir; +} + +#define REGLAGE 0 + +inline void IntWalk_PWalking::AddAPoint(const IntSurf_PntOn2S& POn2S) +{ +#if REGLAGE + Standard_Integer n = line->NbPoints() + 1; + if (n == 1) + { + std::cout << "Dump of WL" << std::endl; + } + + if (n) + { + Standard_Real u1, v1, u2, v2; + POn2S.Parameters(u1, v1, u2, v2); + printf("point p%d %+10.20f %+10.20f %+10.20f\n", + n, + POn2S.Value().X(), + POn2S.Value().Y(), + POn2S.Value().Z()); + fflush(stdout); + } +#endif + line->Add(POn2S); + myTangentIdx = Max(myTangentIdx, 1); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Interface_MSG.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Interface_MSG.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c206ded227b8db1c1ea367b4bb1e4a12f2d6dde4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Interface_MSG.hxx @@ -0,0 +1,250 @@ +// Created on: 1995-03-08 +// Created by: Christian CAILLET +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Interface_MSG_HeaderFile +#define _Interface_MSG_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include + +//! This class gives a set of functions to manage and use a list +//! of translated messages (messagery) +//! +//! Keys are strings, their corresponding (i.e. translated) items +//! are strings, managed by a dictionary (a global one). +//! +//! If the dictionary is not set, or if a key is not recorded, +//! the key is returned as item, and it is possible to : +//! - trace or not this fail, record or not it for further trace +//! +//! It is also possible to suspend the translation (keys are then +//! always returned as items) +//! +//! This class also provides a file format for loading : +//! It is made of couples of lines, the first one begins by '@' +//! the following is the key, the second one is the message +//! Lines which are empty or which begin by '@@' are skipped +class Interface_MSG +{ +public: + DEFINE_STANDARD_ALLOC + + //! A MSG is created to write a "functional code" in conjunction + //! with operator () attached to Value + //! Then, to have a translated message, write in C++ : + //! + //! Interface_MSG("...mykey...") which returns a CString + //! See also some help which follow + Standard_EXPORT Interface_MSG(const Standard_CString key); + + //! Translates a message which contains one integer variable + //! It is just a help which avoid the following : + //! char mess[100]; sprintf(mess,Interface_MSG("code"),ival); + //! then AddFail(mess); + //! replaced by AddFail (Interface_MSG("code",ival)); + //! + //! The basic message is intended to be in C-sprintf format, + //! with one %d form in it + Standard_EXPORT Interface_MSG(const Standard_CString key, const Standard_Integer i1); + + //! Translates a message which contains two integer variables + //! As for one integer, it is just a writing help + //! + //! The basic message is intended to be in C-sprintf format + //! with two %d forms in it + Standard_EXPORT Interface_MSG(const Standard_CString key, + const Standard_Integer i1, + const Standard_Integer i2); + + //! Translates a message which contains one real variable + //! if set, commands the variable to be rounded to an + //! interval (see below, method Intervals) + //! As for one integer, it is just a writing help + //! + //! The basic message is intended to be in C-sprintf format + //! with one %f form (or equivalent : %e etc) in it + Standard_EXPORT Interface_MSG(const Standard_CString key, + const Standard_Real r1, + const Standard_Integer intervals = -1); + + //! Translates a message which contains one string variable + //! As for one integer, it is just a writing help + //! + //! The basic message is intended to be in C-sprintf format + //! with one %s form in it + Standard_EXPORT Interface_MSG(const Standard_CString key, const Standard_CString str); + + //! Translates a message which contains one integer and one + //! string variables + //! As for one integer, it is just a writing help + //! Used for instance to say "Param n0. i.e. is not.." + //! + //! The basic message is intended to be in C-sprintf format + //! with one %d then one %s forms in it + Standard_EXPORT Interface_MSG(const Standard_CString key, + const Standard_Integer ival, + const Standard_CString str); + + //! Optimised destructor (applies for additional forms of Create) + Standard_EXPORT void Destroy(); + + ~Interface_MSG() { Destroy(); } + + //! Returns the translated message, in a functional form with + //! operator () + //! was C++ : return const + Standard_EXPORT Standard_CString Value() const; + operator Standard_CString() const; + + //! Reads a list of messages from a stream, returns read count + //! 0 means empty file, -1 means error + Standard_EXPORT static Standard_Integer Read(Standard_IStream& S); + + //! Reads a list of messages from a file defined by its name + Standard_EXPORT static Standard_Integer Read(const Standard_CString file); + + //! Writes the list of messages recorded to be translated, to a + //! stream. Writes all the list (Default) or only keys which begin + //! by . Returns the count of written messages + Standard_EXPORT static Standard_Integer Write(Standard_OStream& S, + const Standard_CString rootkey = ""); + + //! Returns True if a given message is surely a key + //! (according to the form adopted for keys) + //! (before activating messages, answer is false) + Standard_EXPORT static Standard_Boolean IsKey(const Standard_CString mess); + + //! Returns the item recorded for a key. + //! Returns the key itself if : + //! - it is not recorded (then, the trace system is activated) + //! - MSG has been required to be hung on + Standard_EXPORT static Standard_CString Translated(const Standard_CString key); + + //! Fills the dictionary with a couple (key-item) + //! If a key is already recorded, it is possible to : + //! - keep the last definition, and activate the trace system + Standard_EXPORT static void Record(const Standard_CString key, const Standard_CString item); + + //! Sets the trace system to work when activated, as follow : + //! - if is True, print immediately on standard output + //! - if is True, record it for further print + Standard_EXPORT static void SetTrace(const Standard_Boolean toprint, + const Standard_Boolean torecord); + + //! Sets the main modes for MSG : + //! - if is True, translation works normally + //! - if is False, translated item equate keys + //! - if is True, errors (from Record or Translate) + //! cause MSG to raise an exception + //! - if is False, MSG runs without exception, then + //! see also Trace Modes above + Standard_EXPORT static void SetMode(const Standard_Boolean running, + const Standard_Boolean raising); + + //! Prints the recorded errors (without title; can be empty, this + //! is the normally expected case) + Standard_EXPORT static void PrintTrace(Standard_OStream& S); + + //! Returns an "intervalled" value from a starting real : + //! i.e. a value which is rounded on an interval limit + //! Interval limits are defined to be in a coarsely "geometric" + //! progression (two successive intervals are inside a limit ratio) + //! + //! gives the count of desired intervals in a range <1-10> + //! False, returns the first lower interval (D) + //! True, returns the first upper interval + //! Values of Intervals according : + //! 0,1 : 1 10 100 ... + //! 2 : 1 3 10 30 100 ... + //! 3(D): 1 2 5 10 20 50 100 ... + //! 4 : 1 2 3 6 10 20 30 60 100 ... + //! 6 : 1 1.5 2 3 5 7 10 15 20 ... + //! 10 : 1 1.2 1.5 2 2.5 3 4 5 6 8 10 12 15 20 25 ... + Standard_EXPORT static Standard_Real Intervalled(const Standard_Real val, + const Standard_Integer order = 3, + const Standard_Boolean upper = Standard_False); + + //! Codes a date as a text, from its numeric value (-> seconds) : + //! YYYY-MM-DD:HH-MN-SS fixed format, completed by leading zeros + //! Another format can be provided, as follows : + //! C:%d ... C like format, preceded by C: + //! S:... format to call system (not yet implemented) + Standard_EXPORT static void TDate(const Standard_CString text, + const Standard_Integer yy, + const Standard_Integer mm, + const Standard_Integer dd, + const Standard_Integer hh, + const Standard_Integer mn, + const Standard_Integer ss, + const Standard_CString format = ""); + + //! Decodes a date to numeric integer values + //! Returns True if OK, False if text does not fit with required + //! format. Incomplete forms are allowed (for instance, for only + //! YYYY-MM-DD, hour is zero) + Standard_EXPORT static Standard_Boolean NDate(const Standard_CString text, + Standard_Integer& yy, + Standard_Integer& mm, + Standard_Integer& dd, + Standard_Integer& hh, + Standard_Integer& mn, + Standard_Integer& ss); + + //! Returns a value about comparison of two dates + //! 0 : equal. <0 text1 anterior. >0 text1 posterior + Standard_EXPORT static Standard_Integer CDate(const Standard_CString text1, + const Standard_CString text2); + + //! Returns a blank string, of length between 0 and , to fill + //! the printing of a numeric value , i.e. : + //! If val < 10 , max-1 blanks + //! If val between 10 and 99, max-2 blanks ... etc... + Standard_EXPORT static Standard_CString Blanks(const Standard_Integer val, + const Standard_Integer max); + + //! Returns a blank string, to complete a given string up to + //! characters : + //! If strlen(val) is 0, max blanks + //! If strlen(val) is 5, max-5 blanks etc... + Standard_EXPORT static Standard_CString Blanks(const Standard_CString val, + const Standard_Integer max); + + //! Returns a blank string of blanks (mini 0, maxi 76) + Standard_EXPORT static Standard_CString Blanks(const Standard_Integer count); + + //! Prints a String on an Output Stream, as follows : + //! Accompanied with blanks, to give up to charis at all, + //! justified according just : + //! -1 (D) : left 0 : center 1 : right + //! Maximum 76 characters + Standard_EXPORT static void Print(Standard_OStream& S, + const Standard_CString val, + const Standard_Integer max, + const Standard_Integer just = -1); + +protected: +private: + Standard_CString thekey; + Standard_PCharacter theval; +}; + +#endif // _Interface_MSG_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Interface_UndefinedContent.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Interface_UndefinedContent.hxx new file mode 100644 index 0000000000000000000000000000000000000000..55e66697e1bf7c0c459e22a3ca7592cf2047daaa --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Interface_UndefinedContent.hxx @@ -0,0 +1,144 @@ +// Created on: 1992-02-04 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Interface_UndefinedContent_HeaderFile +#define _Interface_UndefinedContent_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +class TCollection_HAsciiString; +class Interface_CopyTool; + +class Interface_UndefinedContent; +DEFINE_STANDARD_HANDLE(Interface_UndefinedContent, Standard_Transient) + +//! Defines resources for an "Undefined Entity" : such an Entity +//! is used to describe an Entity which complies with the Norm, +//! but of an Unknown Type : hence it is kept under a literal +//! form (avoiding to loose data). UndefinedContent offers a way +//! to store a list of Parameters, as literals or references to +//! other Entities +//! +//! Each Interface must provide one "UndefinedEntity", which must +//! have same basic description as all its types of entities : +//! the best way would be double inheritance : on the Entity Root +//! of the Norm and on an general "UndefinedEntity" +//! +//! While it is not possible to do so, the UndefinedEntity of each +//! Interface can define its own UndefinedEntity by INCLUDING +//! (in a field) this UndefinedContent +//! +//! Hence, for that UndefinedEntity, define a Constructor which +//! creates this UndefinedContent, plus access methods to it +//! (or to its data, calling methods defined here). +//! +//! Finally, the Protocols of each norm have to Create and +//! Recognize Unknown Entities of this norm +class Interface_UndefinedContent : public Standard_Transient +{ + +public: + //! Defines an empty UndefinedContent + Standard_EXPORT Interface_UndefinedContent(); + + //! Gives count of recorded parameters + Standard_EXPORT Standard_Integer NbParams() const; + + //! Gives count of Literal Parameters + Standard_EXPORT Standard_Integer NbLiterals() const; + + //! Returns data of a Parameter : its type, and the entity if it + //! designates en entity ("ent") or its literal value else ("str") + //! Returned value (Boolean) : True if it is an Entity, False else + Standard_EXPORT Standard_Boolean ParamData(const Standard_Integer num, + Interface_ParamType& ptype, + Handle(Standard_Transient)& ent, + Handle(TCollection_HAsciiString)& val) const; + + //! Returns the ParamType of a Param, given its rank + //! Error if num is not between 1 and NbParams + Standard_EXPORT Interface_ParamType ParamType(const Standard_Integer num) const; + + //! Returns True if a Parameter is recorded as an entity + //! Error if num is not between 1 and NbParams + Standard_EXPORT Standard_Boolean IsParamEntity(const Standard_Integer num) const; + + //! Returns Entity corresponding to a Param, given its rank + Standard_EXPORT Handle(Standard_Transient) ParamEntity(const Standard_Integer num) const; + + //! Returns literal value of a Parameter, given its rank + Standard_EXPORT Handle(TCollection_HAsciiString) ParamValue(const Standard_Integer num) const; + + //! Manages reservation for parameters (internal use) + //! (nb : total count of parameters, nblit : count of literals) + Standard_EXPORT void Reservate(const Standard_Integer nb, const Standard_Integer nblit); + + //! Adds a literal Parameter to the list + Standard_EXPORT void AddLiteral(const Interface_ParamType ptype, + const Handle(TCollection_HAsciiString)& val); + + //! Adds a Parameter which references an Entity + Standard_EXPORT void AddEntity(const Interface_ParamType ptype, + const Handle(Standard_Transient)& ent); + + //! Removes a Parameter given its rank + Standard_EXPORT void RemoveParam(const Standard_Integer num); + + //! Sets a new value for the Parameter , to a literal value + //! (if it referenced formerly an Entity, this Entity is removed) + Standard_EXPORT void SetLiteral(const Standard_Integer num, + const Interface_ParamType ptype, + const Handle(TCollection_HAsciiString)& val); + + //! Sets a new value for the Parameter , to reference an + //! Entity. To simply change the Entity, see the variant below + Standard_EXPORT void SetEntity(const Standard_Integer num, + const Interface_ParamType ptype, + const Handle(Standard_Transient)& ent); + + //! Changes the Entity referenced by the Parameter + //! (with same ParamType) + Standard_EXPORT void SetEntity(const Standard_Integer num, const Handle(Standard_Transient)& ent); + + //! Returns globally the list of param entities. Note that it can + //! be used as shared entity list for the UndefinedEntity + Standard_EXPORT Interface_EntityList EntityList() const; + + //! Copies contents of undefined entities; deigned to be called by + //! GetFromAnother method from Undefined entity of each Interface + //! (the basic operation is the same regardless the norm) + Standard_EXPORT void GetFromAnother(const Handle(Interface_UndefinedContent)& other, + Interface_CopyTool& TC); + + DEFINE_STANDARD_RTTIEXT(Interface_UndefinedContent, Standard_Transient) + +protected: +private: + Standard_Integer thenbparams; + Standard_Integer thenbstr; + Handle(TColStd_HArray1OfInteger) theparams; + Handle(Interface_HArray1OfHAsciiString) thevalues; + Interface_EntityList theentities; +}; + +#endif // _Interface_UndefinedContent_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Intrv_Position.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Intrv_Position.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e11bcc3740d2954f1c48bff1e8759a8d4fc4e70c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Intrv_Position.hxx @@ -0,0 +1,37 @@ +// Created on: 1991-12-13 +// Created by: Christophe MARION +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Intrv_Position_HeaderFile +#define _Intrv_Position_HeaderFile + +enum Intrv_Position +{ + Intrv_Before, + Intrv_JustBefore, + Intrv_OverlappingAtStart, + Intrv_JustEnclosingAtEnd, + Intrv_Enclosing, + Intrv_JustOverlappingAtStart, + Intrv_Similar, + Intrv_JustEnclosingAtStart, + Intrv_Inside, + Intrv_JustOverlappingAtEnd, + Intrv_OverlappingAtEnd, + Intrv_JustAfter, + Intrv_After +}; + +#endif // _Intrv_Position_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/LDOM_BasicElement.hxx b/data/miniconda3/envs/catiagent/include/opencascade/LDOM_BasicElement.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7cbf85eb951509cd5bc836243165b3882f97e7e2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/LDOM_BasicElement.hxx @@ -0,0 +1,123 @@ +// Created on: 2001-06-26 +// Created by: Alexander GRIGORIEV +// Copyright (c) 2001-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// AGV 140202: Repl.(const char *) for (LDOMBasicString) => myTagName + +#ifndef LDOM_BasicElement_HeaderFile +#define LDOM_BasicElement_HeaderFile + +#include +#include +#include + +class LDOM_NodeList; +class LDOM_BasicAttribute; + +// Class LDOM_BasicElement +// + +class LDOM_BasicElement : public LDOM_BasicNode +{ +public: + // ---------- PUBLIC METHODS ---------- + + LDOM_BasicElement() + : LDOM_BasicNode(LDOM_Node::UNKNOWN), + myTagName(NULL), + myAttributeMask(0), + myFirstChild(NULL) + { + } + + // Empty constructor + + static LDOM_BasicElement& Create(const char* aName, + const Standard_Integer aLength, + const Handle(LDOM_MemManager)& aDoc); + + // Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther); + // Copy constructor + + Standard_EXPORT LDOM_BasicElement& operator=(const LDOM_NullPtr* aNull); + // Nullify + + Standard_EXPORT ~LDOM_BasicElement(); + + // Destructor + + const char* GetTagName() const { return myTagName; } + + const LDOM_BasicNode* GetFirstChild() const { return myFirstChild; } + + Standard_EXPORT const LDOM_BasicNode* GetLastChild() const; + + Standard_EXPORT const LDOM_BasicAttribute& GetAttribute(const LDOMBasicString& aName, + const LDOM_BasicNode* aLastCh) const; + // Search for attribute name, using or setting myFirstAttribute + +protected: + // ---------- PROTECTED METHODS ---------- + + // LDOM_BasicElement (const LDOM_Element& anElement); + // Constructor + + Standard_EXPORT const LDOM_BasicNode* AddAttribute(const LDOMBasicString& anAttrName, + const LDOMBasicString& anAttrValue, + const Handle(LDOM_MemManager)& aDoc, + const LDOM_BasicNode* aLastCh); + // add or replace an attribute to the element + + Standard_EXPORT const LDOM_BasicNode* RemoveAttribute(const LDOMBasicString& aName, + const LDOM_BasicNode* aLastCh) const; + + Standard_EXPORT void RemoveChild(const LDOM_BasicNode* aChild) const; + // remove a child element + + Standard_EXPORT void AppendChild(const LDOM_BasicNode* aChild, + const LDOM_BasicNode*& aLastCh) const; + // append a child node to the end of the list + +private: + friend class LDOMParser; + friend class LDOM_XmlReader; + friend class LDOM_Document; + friend class LDOM_Element; + friend class LDOM_Node; + // ---------- PRIVATE METHODS ---------- + + const LDOM_BasicAttribute* GetFirstAttribute(const LDOM_BasicNode*& aLastCh, + const LDOM_BasicNode**& thePrN) const; + + void RemoveNodes(); + + void ReplaceElement(const LDOM_BasicElement& anOther, const Handle(LDOM_MemManager)& aDoc); + // remark: recursive + + void AddElementsByTagName(LDOM_NodeList& aList, const LDOMBasicString& aTagName) const; + // remark: recursive + + void AddAttributes(LDOM_NodeList& aList, const LDOM_BasicNode* aLastCh) const; + // add attributes to list + +private: + // ---------- PRIVATE FIELDS ---------- + + // LDOMBasicString myTagName; + const char* myTagName; + unsigned long myAttributeMask; + LDOM_BasicNode* myFirstChild; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/LocalAnalysis.hxx b/data/miniconda3/envs/catiagent/include/opencascade/LocalAnalysis.hxx new file mode 100644 index 0000000000000000000000000000000000000000..12f58c39aa395c50e3578eaa85df7a6361a4eaa1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/LocalAnalysis.hxx @@ -0,0 +1,47 @@ +// Created on: 1996-07-24 +// Created by: Herve LOUESSARD +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _LocalAnalysis_HeaderFile +#define _LocalAnalysis_HeaderFile + +#include +#include +#include +#include + +class LocalAnalysis_SurfaceContinuity; +class LocalAnalysis_CurveContinuity; + +//! This package gives tools to check the local continuity +//! between two points situated on two curves or two surfaces. +class LocalAnalysis +{ +public: + DEFINE_STANDARD_ALLOC + + //! This class compute s and gives tools to check the local + //! continuity between two points situated on 2 curves. + //! + //! This function gives information about a variable CurveContinuity + Standard_EXPORT static void Dump(const LocalAnalysis_SurfaceContinuity& surfconti, + Standard_OStream& o); + + //! This function gives information about a variable SurfaceContinuity + Standard_EXPORT static void Dump(const LocalAnalysis_CurveContinuity& curvconti, + Standard_OStream& o); +}; + +#endif // _LocalAnalysis_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/MAT_Graph.hxx b/data/miniconda3/envs/catiagent/include/opencascade/MAT_Graph.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fac9047951fa9df7473f62db1ed0ffa4595b15ff --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/MAT_Graph.hxx @@ -0,0 +1,132 @@ +// Created on: 1993-04-29 +// Created by: Yves FRICAUD +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _MAT_Graph_HeaderFile +#define _MAT_Graph_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +class MAT_ListOfBisector; +class MAT_Arc; +class MAT_BasicElt; +class MAT_Node; + +class MAT_Graph; +DEFINE_STANDARD_HANDLE(MAT_Graph, Standard_Transient) + +//! The Class Graph permits the exploration of the +//! Bisector Locus. +class MAT_Graph : public Standard_Transient +{ + +public: + //! Empty constructor. + Standard_EXPORT MAT_Graph(); + + //! Construct from the result of the method + //! of the class from . + //! + //! : if some bisector are infinites. + //! : Set of the bisectors. + //! : Number of Basic Elements. + //! : Number of Arcs = Number of Bisectors. + Standard_EXPORT void Perform(const Standard_Boolean SemiInfinite, + const Handle(MAT_ListOfBisector)& TheRoots, + const Standard_Integer NbBasicElts, + const Standard_Integer NbArcs); + + //! Return the Arc of index in . + Standard_EXPORT Handle(MAT_Arc) Arc(const Standard_Integer Index) const; + + //! Return the BasicElt of index in . + Standard_EXPORT Handle(MAT_BasicElt) BasicElt(const Standard_Integer Index) const; + + //! Return the Node of index in . + Standard_EXPORT Handle(MAT_Node) Node(const Standard_Integer Index) const; + + //! Return the number of arcs of . + Standard_EXPORT Standard_Integer NumberOfArcs() const; + + //! Return the number of nodes of . + Standard_EXPORT Standard_Integer NumberOfNodes() const; + + //! Return the number of basic elements of . + Standard_EXPORT Standard_Integer NumberOfBasicElts() const; + + //! Return the number of infinites nodes of . + Standard_EXPORT Standard_Integer NumberOfInfiniteNodes() const; + + //! Merge two BasicElts. The End of the BasicElt Elt1 + //! of IndexElt1 becomes The End of the BasicElt Elt2 + //! of IndexElt2. Elt2 is replaced in the arcs by + //! Elt1, Elt2 is eliminated. + //! + //! is True if the fusion of the BasicElts => + //! a fusion of two Arcs which separated the same elements. + //! In this case and are the + //! Geometric Index of this arcs. + //! + //! If the BasicElt corresponds to a close line , + //! the StartArc and the EndArc of Elt1 can separate the same + //! elements . + //! In this case there is a fusion of this arcs, + //! is true and and are the + //! Geometric Index of this arcs. + Standard_EXPORT void FusionOfBasicElts(const Standard_Integer IndexElt1, + const Standard_Integer IndexElt2, + Standard_Boolean& MergeArc1, + Standard_Integer& GeomIndexArc1, + Standard_Integer& GeomIndexArc2, + Standard_Boolean& MergeArc2, + Standard_Integer& GeomIndexArc3, + Standard_Integer& GeomIndexArc4); + + Standard_EXPORT void CompactArcs(); + + Standard_EXPORT void CompactNodes(); + + Standard_EXPORT void ChangeBasicElts(const MAT_DataMapOfIntegerBasicElt& NewMap); + + Standard_EXPORT Handle(MAT_BasicElt) ChangeBasicElt(const Standard_Integer Index); + + DEFINE_STANDARD_RTTIEXT(MAT_Graph, Standard_Transient) + +protected: +private: + //! Merge two Arcs. the second node of becomes + //! the first node of . Update of the first + //! node and the neighbours of . + //! is eliminated. + Standard_EXPORT void FusionOfArcs(const Handle(MAT_Arc)& Arc1, const Handle(MAT_Arc)& Arc2); + + Standard_EXPORT void UpDateNodes(Standard_Integer& Index); + + MAT_DataMapOfIntegerArc theArcs; + MAT_DataMapOfIntegerBasicElt theBasicElts; + MAT_DataMapOfIntegerNode theNodes; + Standard_Integer numberOfArcs; + Standard_Integer numberOfNodes; + Standard_Integer numberOfBasicElts; + Standard_Integer numberOfInfiniteNodes; +}; + +#endif // _MAT_Graph_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_DataMapOfIntegerMeshEntityOwner.hxx b/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_DataMapOfIntegerMeshEntityOwner.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9bc39b105d0254a2091e57a3556d015e52a43af1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_DataMapOfIntegerMeshEntityOwner.hxx @@ -0,0 +1,28 @@ +// Created on: 2003-10-10 +// Created by: Alexander SOLOVYOV +// Copyright (c) 2003-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef MeshVS_DataMapOfIntegerMeshEntityOwner_HeaderFile +#define MeshVS_DataMapOfIntegerMeshEntityOwner_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap + MeshVS_DataMapOfIntegerMeshEntityOwner; +typedef NCollection_DataMap::Iterator + MeshVS_DataMapIteratorOfDataMapOfIntegerMeshEntityOwner; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_SensitivePolyhedron.hxx b/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_SensitivePolyhedron.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1d467c88f92c0d2b87b153400facd2f3529e8ccc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/MeshVS_SensitivePolyhedron.hxx @@ -0,0 +1,66 @@ +// Created on: 2005-01-21 +// Created by: Alexander SOLOVYOV +// Copyright (c) 2005-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _MeshVS_SensitivePolyhedron_HeaderFile +#define _MeshVS_SensitivePolyhedron_HeaderFile + +#include + +#include +#include +#include +#include + +typedef NCollection_List MeshVS_PolyhedronVerts; +typedef NCollection_List::Iterator MeshVS_PolyhedronVertsIter; + +//! This class is used to detect selection of a polyhedron. The main +//! principle of detection algorithm is to search for overlap with +//! each polyhedron's face separately, treating them as planar convex +//! polygons. +class MeshVS_SensitivePolyhedron : public Select3D_SensitiveEntity +{ +public: + Standard_EXPORT MeshVS_SensitivePolyhedron( + const Handle(SelectMgr_EntityOwner)& theOwner, + const TColgp_Array1OfPnt& theNodes, + const Handle(MeshVS_HArray1OfSequenceOfInteger)& theTopo); + + Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager& theMgr, + SelectBasics_PickResult& thePickResult) + Standard_OVERRIDE; + + //! Returns the amount of nodes of polyhedron + Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE; + + Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; + + Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(MeshVS_SensitivePolyhedron, Select3D_SensitiveEntity) + +private: + MeshVS_PolyhedronVerts myTopology; + gp_XYZ myCenter; + Select3D_BndBox3d myBndBox; + Handle(TColgp_HArray1OfPnt) myNodes; + Handle(MeshVS_HArray1OfSequenceOfInteger) myTopo; +}; + +DEFINE_STANDARD_HANDLE(MeshVS_SensitivePolyhedron, Select3D_SensitiveEntity) + +#endif // _MeshVS_SensitivePolyhedron_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Message_ConsoleColor.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Message_ConsoleColor.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fb68e10cd833fa701207f9ffb3656cb923ac5be0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Message_ConsoleColor.hxx @@ -0,0 +1,31 @@ +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Message_ConsoleColor_HeaderFile +#define _Message_ConsoleColor_HeaderFile + +//! Color definition for console/terminal output (limited palette). +enum Message_ConsoleColor +{ + Message_ConsoleColor_Default, //!< default (white) color + Message_ConsoleColor_Black, //!< black color + Message_ConsoleColor_White, //!< white color + Message_ConsoleColor_Red, //!< red color + Message_ConsoleColor_Blue, //!< blue color + Message_ConsoleColor_Green, //!< green color + Message_ConsoleColor_Yellow, //!< yellow color + Message_ConsoleColor_Cyan, //!< cyan color + Message_ConsoleColor_Magenta, //!< magenta color +}; + +#endif // _Message_ConsoleColor_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/MoniTool_IndexedDataMapOfShapeTransient.hxx b/data/miniconda3/envs/catiagent/include/opencascade/MoniTool_IndexedDataMapOfShapeTransient.hxx new file mode 100644 index 0000000000000000000000000000000000000000..00b2d2c642ce7cbb93e86373852c30f807ba620b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/MoniTool_IndexedDataMapOfShapeTransient.hxx @@ -0,0 +1,29 @@ +// Created on: 1998-04-01 +// Created by: Christian CAILLET +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef MoniTool_IndexedDataMapOfShapeTransient_HeaderFile +#define MoniTool_IndexedDataMapOfShapeTransient_HeaderFile + +#include +#include +#include + +typedef NCollection_IndexedDataMap + MoniTool_IndexedDataMapOfShapeTransient; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Array2.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Array2.hxx new file mode 100644 index 0000000000000000000000000000000000000000..74c53ee13e0765d14a6c61cacda53c8a94e3189f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Array2.hxx @@ -0,0 +1,346 @@ +// Created on: 2002-04-15 +// Created by: Alexander Kartomin (akm) +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef NCollection_Array2_HeaderFile +#define NCollection_Array2_HeaderFile + +#include +#include +#include +#include +#include + +#include + +// *********************************************** Template for Array2 class +/** + * Purpose: The class Array2 represents bi-dimensional arrays + * of fixed size known at run time. + * The ranges of indices are user defined. + * + * Class allocates one 1D array storing full data (all Rows and Columns) + * and extra 1D array storing pointers to each Row. + * + * Warning: Programs clients of such class must be independent + * of the range of the first element. Then, a C++ for + * loop must be written like this + * + * for (i = A.LowerRow(); i <= A.UpperRow(); i++) + * for (j = A.LowerCol(); j <= A.UpperCol(); j++) + */ +template +class NCollection_Array2 : public NCollection_Array1 +{ +public: + //! Memory allocation + DEFINE_STANDARD_ALLOC; + DEFINE_NCOLLECTION_ALLOC; + +public: + typedef NCollection_Allocator allocator_type; + +public: + // Define various type aliases for convenience + using value_type = typename NCollection_Array1::value_type; + using size_type = typename NCollection_Array1::size_type; + using difference_type = typename NCollection_Array1::difference_type; + using pointer = typename NCollection_Array1::pointer; + using const_pointer = typename NCollection_Array1::const_pointer; + using reference = typename NCollection_Array1::reference; + using const_reference = typename NCollection_Array1::const_reference; + + using iterator = typename NCollection_Array1::iterator; + using const_iterator = typename NCollection_Array1::const_iterator; + + static int BeginPosition(Standard_Integer theRowLower, + Standard_Integer /*theRowUpper*/, + Standard_Integer theColLower, + Standard_Integer theColUpper) + { + // Calculate the offset for the beginning position + return theColLower + (theRowLower * (theColUpper - theColLower + 1)); + } + + static int LastPosition(Standard_Integer theRowLower, + Standard_Integer theRowUpper, + Standard_Integer theColLower, + Standard_Integer theColUpper) + { + return ((theRowUpper - theRowLower + 1) * (theColUpper - theColLower + 1)) + theColLower + + (theRowLower * (theColUpper - theColLower + 1)) - 1; + } + +public: + // ---------- PUBLIC METHODS ------------ + + //! Empty constructor; should be used with caution. + //! @sa methods Resize() and Move(). + NCollection_Array2() + : NCollection_Array1(), + myLowerRow(1), + mySizeRow(0), + myLowerCol(1), + mySizeCol(0) + { + } + + //! Constructor + NCollection_Array2(const Standard_Integer theRowLower, + const Standard_Integer theRowUpper, + const Standard_Integer theColLower, + const Standard_Integer theColUpper) + : NCollection_Array1( + BeginPosition(theRowLower, theRowUpper, theColLower, theColUpper), + LastPosition(theRowLower, theRowUpper, theColLower, theColUpper)), + myLowerRow(theRowLower), + mySizeRow(theRowUpper - theRowLower + 1), + myLowerCol(theColLower), + mySizeCol(theColUpper - theColLower + 1) + { + } + + //! Constructor + explicit NCollection_Array2(const allocator_type& theAlloc, + const Standard_Integer theRowLower, + const Standard_Integer theRowUpper, + const Standard_Integer theColLower, + const Standard_Integer theColUpper) + : NCollection_Array1( + theAlloc, + BeginPosition(theRowLower, theRowUpper, theColLower, theColUpper), + LastPosition(theRowLower, theRowUpper, theColLower, theColUpper)), + myLowerRow(theRowLower), + mySizeRow(theRowUpper - theRowLower + 1), + myLowerCol(theColLower), + mySizeCol(theColUpper - theColLower + 1) + { + } + + //! Copy constructor + NCollection_Array2(const NCollection_Array2& theOther) + : NCollection_Array1(theOther), + myLowerRow(theOther.LowerRow()), + mySizeRow(theOther.NbRows()), + myLowerCol(theOther.LowerCol()), + mySizeCol(theOther.NbColumns()) + { + } + + //! Move constructor + NCollection_Array2(NCollection_Array2&& theOther) noexcept + : NCollection_Array1(std::forward(theOther)), + myLowerRow(theOther.LowerRow()), + mySizeRow(theOther.NbRows()), + myLowerCol(theOther.LowerCol()), + mySizeCol(theOther.NbColumns()) + { + } + + //! C array-based constructor + explicit NCollection_Array2(const TheItemType& theBegin, + const Standard_Integer theRowLower, + const Standard_Integer theRowUpper, + const Standard_Integer theColLower, + const Standard_Integer theColUpper) + : NCollection_Array1( + theBegin, + BeginPosition(theRowLower, theRowUpper, theColLower, theColUpper), + LastPosition(theRowLower, theRowUpper, theColLower, theColUpper)), + myLowerRow(theRowLower), + mySizeRow(theRowUpper - theRowLower + 1), + myLowerCol(theColLower), + mySizeCol(theColUpper - theColLower + 1) + { + } + + //! Size (number of items) + Standard_Integer Size() const { return Length(); } + + //! Length (number of items) + Standard_Integer Length() const { return NbRows() * NbColumns(); } + + //! Returns number of rows + Standard_Integer NbRows() const { return static_cast(mySizeRow); } + + //! Returns number of columns + Standard_Integer NbColumns() const { return static_cast(mySizeCol); } + + //! Returns length of the row, i.e. number of columns + Standard_Integer RowLength() const { return NbColumns(); } + + //! Returns length of the column, i.e. number of rows + Standard_Integer ColLength() const { return NbRows(); } + + //! LowerRow + Standard_Integer LowerRow() const { return myLowerRow; } + + //! UpperRow + Standard_Integer UpperRow() const { return myLowerRow + static_cast(mySizeRow) - 1; } + + //! LowerCol + Standard_Integer LowerCol() const { return myLowerCol; } + + //! UpperCol + Standard_Integer UpperCol() const { return myLowerCol + static_cast(mySizeCol) - 1; } + + //! Assignment + NCollection_Array2& Assign(const NCollection_Array2& theOther) + { + if (&theOther == this) + { + return *this; + } + NCollection_Array1::Assign(theOther); + return *this; + } + + //! Move assignment. + //! This array will borrow all the data from theOther. + //! The moved object will be left uninitialized and should not be used anymore. + NCollection_Array2& Move(NCollection_Array2&& theOther) + { + if (&theOther == this) + { + return *this; + } + NCollection_Array1::Move(theOther); + myLowerRow = theOther.myLowerRow; + mySizeRow = theOther.mySizeRow; + myLowerCol = theOther.myLowerCol; + mySizeCol = theOther.mySizeCol; + return *this; + } + + //! Move assignment. + //! This array will borrow all the data from theOther. + //! The moved object will be left uninitialized and should not be used anymore. + NCollection_Array2& Move(NCollection_Array2& theOther) { return Move(std::move(theOther)); } + + //! Assignment operator + NCollection_Array2& operator=(const NCollection_Array2& theOther) { return Assign(theOther); } + + //! Move assignment operator; @sa Move() + NCollection_Array2& operator=(NCollection_Array2&& theOther) + { + return Move(std::forward(theOther)); + } + + //! Constant value access + const_reference Value(const Standard_Integer theRow, const Standard_Integer theCol) const + { + const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol); + return NCollection_Array1::at(aPos); + } + + //! operator() - alias to ChangeValue + const_reference operator()(const Standard_Integer theRow, const Standard_Integer theCol) const + { + const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol); + return NCollection_Array1::at(aPos); + } + + //! Variable value access + reference ChangeValue(const Standard_Integer theRow, const Standard_Integer theCol) + { + const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol); + return NCollection_Array1::at(aPos); + } + + //! operator() - alias to ChangeValue + reference operator()(const Standard_Integer theRow, const Standard_Integer theCol) + { + return ChangeValue(theRow, theCol); + } + + //! SetValue + void SetValue(const Standard_Integer theRow, + const Standard_Integer theCol, + const TheItemType& theItem) + { + const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol); + NCollection_Array1::at(aPos) = theItem; + } + + //! SetValue + void SetValue(const Standard_Integer theRow, const Standard_Integer theCol, TheItemType&& theItem) + { + const size_t aPos = (theRow - myLowerRow) * mySizeCol + (theCol - myLowerCol); + NCollection_Array1::at(aPos) = std::forward(theItem); + } + + //! Resizes the array to specified bounds. + //! No re-allocation will be done if length of array does not change, + //! but existing values will not be discarded if theToCopyData set to FALSE. + //! @param theRowLower new lower Row of array + //! @param theRowUpper new upper Row of array + //! @param theColLower new lower Column of array + //! @param theColUpper new upper Column of array + //! @param theToCopyData flag to copy existing data into new array + void Resize(Standard_Integer theRowLower, + Standard_Integer theRowUpper, + Standard_Integer theColLower, + Standard_Integer theColUpper, + Standard_Boolean theToCopyData) + { + Standard_RangeError_Raise_if(theRowUpper < theRowLower || theColUpper < theColLower, + "NCollection_Array2::Resize"); + myLowerRow = theRowLower; + myLowerCol = theColLower; + if (!theToCopyData) + { + NCollection_Array1::Resize( + BeginPosition(theRowLower, theRowUpper, theColLower, theColUpper), + LastPosition(theRowLower, theRowUpper, theColLower, theColUpper), + false); + mySizeRow = theRowUpper - theRowLower + 1; + mySizeCol = theColUpper - theColLower + 1; + return; + } + NCollection_Array1 aTmpMovedCopy(std::move(*this)); + TheItemType* anOldPointer = &aTmpMovedCopy.ChangeFirst(); + NCollection_Array1::Resize( + BeginPosition(theRowLower, theRowUpper, theColLower, theColUpper), + LastPosition(theRowLower, theRowUpper, theColLower, theColUpper), + false); + const size_t aNewNbRows = theRowUpper - theRowLower + 1; + const size_t aNewNbCols = theColUpper - theColLower + 1; + const size_t aNbRowsToCopy = std::min(mySizeRow, aNewNbRows); + const size_t aNbColsToCopy = std::min(mySizeCol, aNewNbCols); + mySizeRow = aNewNbRows; + mySizeCol = aNewNbCols; + size_t aOldInter = 0; + for (size_t aRowIter = 0; aRowIter < aNbRowsToCopy; ++aRowIter) + { + for (size_t aColIter = 0; aColIter < aNbColsToCopy; ++aColIter) + { + NCollection_Array1::at(aRowIter * aNewNbCols + aColIter) = + std::move(anOldPointer[aOldInter++]); + } + } + } + +protected: + // ---------- PROTECTED FIELDS ----------- + Standard_Integer myLowerRow; + size_t mySizeRow; + Standard_Integer myLowerCol; + size_t mySizeCol; + + // ----------- FRIEND CLASSES ------------ + friend iterator; + friend const_iterator; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_HArray2.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_HArray2.hxx new file mode 100644 index 0000000000000000000000000000000000000000..34d3a2c06f730244162195dcf94d4dbe031abc5e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_HArray2.hxx @@ -0,0 +1,26 @@ +// Created on: 2002-04-29 +// Created by: Alexander KARTOMIN (akm) +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef NCollection_HArray2_HeaderFile +#define NCollection_HArray2_HeaderFile + +#include +#include + +// Declaration of Array2 class managed by Handle + +#define NCOLLECTION_HARRAY2(HClassName, Type) DEFINE_HARRAY2(HClassName, NCollection_Array2) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_IndexedIterator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_IndexedIterator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..85561d10ad9bbfb9d939e1ae71264f0135ba2135 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_IndexedIterator.hxx @@ -0,0 +1,239 @@ +// Copyright (c) 2023 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef NCollection_IndexedIterator_HeaderFile +#define NCollection_IndexedIterator_HeaderFile + +#include +#include + +//! Helper class that allows to use NCollection iterators as STL iterators. +//! NCollection iterator can be extended to STL iterator of any category by +//! adding necessary methods: STL forward iterator requires IsEqual method, +//! STL bidirectional iterator requires Previous method, and STL random access +//! iterator requires Offset and Differ methods. See NCollection_Vector as +//! example of declaring custom STL iterators. +template +class NCollection_IndexedIterator +{ +public: + // Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually: + using iterator_category = Category; + using value_type = ItemType; + using difference_type = ptrdiff_t; + using pointer = typename std::conditional::type; + using reference = typename std::conditional::type; + + //! Default constructor + NCollection_IndexedIterator() + : myIndex(0), + myIndexedMap(nullptr) + { + } + + //! Constructor from NCollection_Indexed*Map + NCollection_IndexedIterator(const BaseIndexedMap& theMap) + : myIndex(0), + myIndexedMap((&const_cast(theMap))) + { + } + + //! Constructor from NCollection_Indexed*Map + NCollection_IndexedIterator(const size_t theIndex, const BaseIndexedMap& theMap) + : myIndex(theIndex), + myIndexedMap(&const_cast(theMap)) + { + } + + //! Cast from non-const variant to const one + NCollection_IndexedIterator( + const NCollection_IndexedIterator& theOther) + : myIndex(theOther.myIndex), + myIndexedMap(theOther.myIndexedMap) + { + } + + //! Assignment of non-const iterator to const one + NCollection_IndexedIterator& operator=( + const NCollection_IndexedIterator& theOther) + { + myIndex = theOther.myIndex; + myIndexedMap = theOther.myIndexedMap; + return *this; + } + +protected: //! @name methods related to forward STL iterator + // Note: Here we use SFINAE (Substitution failure is not an error) to choose + // an appropriate method based on template arguments (at instantiation time). + + template + typename std::enable_if::type Reference() const + { + return myIndexedMap->at(myIndex); + } + + template + typename std::enable_if::type Reference() const + { + return myIndexedMap->at(myIndex); + } + +public: //! @name methods related to forward STL iterator + //! Test for equality + bool operator==(const NCollection_IndexedIterator& theOther) const + { + return myIndexedMap == theOther.myIndexedMap && myIndex == theOther.myIndex; + } + + template + bool operator==( + const NCollection_IndexedIterator& + theOther) const + { + return myIndexedMap == theOther.myIndexedMap && myIndex == theOther.myIndex; + } + + template + bool operator!=( + const NCollection_IndexedIterator& + theOther) const + { + return myIndexedMap != theOther.myIndexedMap || myIndex != theOther.myIndex; + } + + //! Test for inequality + bool operator!=(const NCollection_IndexedIterator& theOther) const + { + return !(*this == theOther); + } + + //! Get reference to current item + typename NCollection_IndexedIterator::reference operator*() const + { + return Reference(); + } + + //! Dereferencing operator + typename NCollection_IndexedIterator::pointer operator->() const + { + return &Reference(); + } + + //! Prefix increment + NCollection_IndexedIterator& operator++() + { + myIndex++; + return *this; + } + + //! Postfix increment + NCollection_IndexedIterator operator++(int) + { + const NCollection_IndexedIterator theOld(*this); + ++(*this); + return theOld; + } + +public: //! @name methods related to bidirectional STL iterator + //! Prefix decrement + NCollection_IndexedIterator& operator--() + { + Standard_STATIC_ASSERT( + (opencascade::std::is_same::value + || opencascade::std::is_same::value)); + myIndex--; + return *this; + } + + //! Postfix decrement + NCollection_IndexedIterator operator--(int) + { + NCollection_IndexedIterator theOld(*this); + --(*this); + return theOld; + } + +public: //! @name methods related to random access STL iterator + //! Move forward + NCollection_IndexedIterator& operator+=( + typename NCollection_IndexedIterator::difference_type theOffset) + { + Standard_STATIC_ASSERT( + (opencascade::std::is_same::value)); + myIndex += theOffset; + return *this; + } + + //! Addition + NCollection_IndexedIterator operator+( + typename NCollection_IndexedIterator::difference_type theOffset) const + { + NCollection_IndexedIterator aTemp(*this); + return aTemp += theOffset; + } + + //! Move backward + NCollection_IndexedIterator& operator-=( + typename NCollection_IndexedIterator::difference_type theOffset) + { + return *this += -theOffset; + } + + //! Decrease + NCollection_IndexedIterator operator-( + typename NCollection_IndexedIterator::difference_type theOffset) const + { + NCollection_IndexedIterator aTemp(*this); + return aTemp += -theOffset; + } + + //! Difference + typename NCollection_IndexedIterator::difference_type operator-( + const NCollection_IndexedIterator& theOther) const + { + Standard_STATIC_ASSERT( + (opencascade::std::is_same::value)); + return myIndex - theOther.myIndex; + } + + //! Get item at offset from current + typename NCollection_IndexedIterator::reference operator[]( + typename NCollection_IndexedIterator::difference_type theOffset) const + { + return *(*this + theOffset); + } + + //! Comparison + bool operator<(const NCollection_IndexedIterator& theOther) const + { + return (*this - theOther) < 0; + } + + //! Comparison + bool operator>(const NCollection_IndexedIterator& theOther) const { return theOther < *this; } + + //! Comparison + bool operator<=(const NCollection_IndexedIterator& theOther) const { return !(theOther < *this); } + + //! Comparison + bool operator>=(const NCollection_IndexedIterator& theOther) const { return !(*this < theOther); } + + friend class NCollection_IndexedIterator; + +private: + //! NCollection iterator + size_t myIndex; + BaseIndexedMap* myIndexedMap; +}; + +#endif // NCollection_IndexedIterator_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat3.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat3.hxx new file mode 100644 index 0000000000000000000000000000000000000000..55a0e8ecde855183d6683f707366a6b4d12ac937 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat3.hxx @@ -0,0 +1,520 @@ +// Copyright (c) 2020 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _NCollection_Mat3_HeaderFile +#define _NCollection_Mat3_HeaderFile + +#include +#include + +//! 3x3 Matrix class. +//! Warning, empty constructor returns an identity matrix. +template +class NCollection_Mat3 +{ +public: + //! Return identity matrix. + static NCollection_Mat3 Identity() { return NCollection_Mat3(); } + + //! Return zero matrix. + static NCollection_Mat3 Zero() + { + NCollection_Mat3 aMat; + aMat.InitZero(); + return aMat; + } + +public: + //! Empty constructor for identity matrix. + NCollection_Mat3() { InitIdentity(); } + + //! Conversion constructor (explicitly converts some 3x3 matrix with other element type + //! to a new 3x3 matrix with the element type Element_t, + //! whose elements are static_cast'ed corresponding elements of theOtherMat3 matrix) + //! @tparam OtherElement_t the element type of the other 3x3 matrix theOtherVec3 + //! @param theOtherMat3 the 3x3 matrix that needs to be converted + template + explicit NCollection_Mat3(const NCollection_Mat3& theOtherMat3) + { + ConvertFrom(theOtherMat3); + } + + //! Get element at the specified row and column. + //! @param[in] theRow the row.to address. + //! @param[in] theCol the column to address. + //! @return the value of the addressed element. + Element_t GetValue(const size_t theRow, const size_t theCol) const + { + return myMat[theCol * 3 + theRow]; + } + + //! Access element at the specified row and column. + //! @param[in] theRow the row.to access. + //! @param[in] theCol the column to access. + //! @return reference on the matrix element. + Element_t& ChangeValue(const size_t theRow, const size_t theCol) + { + return myMat[theCol * 3 + theRow]; + } + + //! Set value for the element specified by row and columns. + //! @param[in] theRow the row to change. + //! @param[in] theCol the column to change. + //! @param[in] theValue the value to set.s + void SetValue(const size_t theRow, const size_t theCol, const Element_t theValue) + { + myMat[theCol * 3 + theRow] = theValue; + } + + //! Return value. + Element_t& operator()(const size_t theRow, const size_t theCol) + { + return ChangeValue(theRow, theCol); + } + + //! Return value. + Element_t operator()(const size_t theRow, const size_t theCol) const + { + return GetValue(theRow, theCol); + } + + //! Return the row. + NCollection_Vec3 GetRow(const size_t theRow) const + { + return NCollection_Vec3(GetValue(theRow, 0), + GetValue(theRow, 1), + GetValue(theRow, 2)); + } + + //! Change first 3 row values by the passed vector. + //! @param[in] theRow the row to change. + //! @param[in] theVec the vector of values. + void SetRow(const size_t theRow, const NCollection_Vec3& theVec) + { + SetValue(theRow, 0, theVec.x()); + SetValue(theRow, 1, theVec.y()); + SetValue(theRow, 2, theVec.z()); + } + + //! Return the column. + NCollection_Vec3 GetColumn(const size_t theCol) const + { + return NCollection_Vec3(GetValue(0, theCol), + GetValue(1, theCol), + GetValue(2, theCol)); + } + + //! Change first 3 column values by the passed vector. + //! @param[in] theCol the column to change. + //! @param[in] theVec the vector of values. + void SetColumn(const size_t theCol, const NCollection_Vec3& theVec) + { + SetValue(0, theCol, theVec.x()); + SetValue(1, theCol, theVec.y()); + SetValue(2, theCol, theVec.z()); + } + + //! Get vector of diagonal elements. + //! @return vector of diagonal elements. + NCollection_Vec3 GetDiagonal() const + { + return NCollection_Vec3(GetValue(0, 0), GetValue(1, 1), GetValue(2, 2)); + } + + //! Change first 3 elements of the diagonal matrix. + //! @param theVec the vector of values. + void SetDiagonal(const NCollection_Vec3& theVec) + { + SetValue(0, 0, theVec.x()); + SetValue(1, 1, theVec.y()); + SetValue(2, 2, theVec.z()); + } + + //! Initialize the zero matrix. + void InitZero() { std::memcpy(this, MyZeroArray, sizeof(NCollection_Mat3)); } + + //! Checks the matrix for zero (without tolerance). + bool IsZero() const { return std::memcmp(this, MyZeroArray, sizeof(NCollection_Mat3)) == 0; } + + //! Initialize the identity matrix. + void InitIdentity() { std::memcpy(this, MyIdentityArray, sizeof(NCollection_Mat3)); } + + //! Checks the matrix for identity (without tolerance). + bool IsIdentity() const + { + return std::memcmp(this, MyIdentityArray, sizeof(NCollection_Mat3)) == 0; + } + + //! Check this matrix for equality with another matrix (without tolerance!). + bool IsEqual(const NCollection_Mat3& theOther) const + { + return std::memcmp(this, &theOther, sizeof(NCollection_Mat3)) == 0; + } + + //! Comparison operator. + bool operator==(const NCollection_Mat3& theMat) const { return IsEqual(theMat); } + + //! Check this vector with another vector for non-equality (without tolerance!). + bool operator!=(const NCollection_Mat3& theOther) const { return !IsEqual(theOther); } + + //! Raw access to the data (for OpenGL exchange). + //! the data is returned in column-major order. + const Element_t* GetData() const { return myMat; } + + Element_t* ChangeData() { return myMat; } + + //! Multiply by the vector (M * V). + //! @param[in] theVec the vector to multiply. + NCollection_Vec3 operator*(const NCollection_Vec3& theVec) const + { + return NCollection_Vec3( + GetValue(0, 0) * theVec.x() + GetValue(0, 1) * theVec.y() + GetValue(0, 2) * theVec.z(), + GetValue(1, 0) * theVec.x() + GetValue(1, 1) * theVec.y() + GetValue(1, 2) * theVec.z(), + GetValue(2, 0) * theVec.x() + GetValue(2, 1) * theVec.y() + GetValue(2, 2) * theVec.z()); + } + + //! Compute matrix multiplication product: A * B. + //! @param[in] theMatA the matrix "A". + //! @param[in] theMatB the matrix "B". + static NCollection_Mat3 Multiply(const NCollection_Mat3& theMatA, const NCollection_Mat3& theMatB) + { + NCollection_Mat3 aMatRes; + + size_t aInputElem; + for (size_t aResElem = 0; aResElem < 9; ++aResElem) + { + aMatRes.myMat[aResElem] = (Element_t)0; + for (aInputElem = 0; aInputElem < 3; ++aInputElem) + { + aMatRes.myMat[aResElem] += + theMatA.GetValue(aResElem % 3, aInputElem) * theMatB.GetValue(aInputElem, aResElem / 3); + } + } + + return aMatRes; + } + + //! Compute matrix multiplication. + //! @param[in] theMat the matrix to multiply. + void Multiply(const NCollection_Mat3& theMat) { *this = Multiply(*this, theMat); } + + //! Multiply by the another matrix. + //! @param[in] theMat the other matrix. + NCollection_Mat3& operator*=(const NCollection_Mat3& theMat) + { + Multiply(theMat); + return *this; + } + + //! Compute matrix multiplication product. + //! @param[in] theMat the other matrix. + //! @return result of multiplication. + Standard_NODISCARD NCollection_Mat3 operator*(const NCollection_Mat3& theMat) const + { + return Multiplied(theMat); + } + + //! Compute matrix multiplication product. + //! @param[in] theMat the other matrix. + //! @return result of multiplication. + Standard_NODISCARD NCollection_Mat3 Multiplied(const NCollection_Mat3& theMat) const + { + NCollection_Mat3 aTempMat(*this); + aTempMat *= theMat; + return aTempMat; + } + + //! Compute per-component multiplication. + //! @param[in] theFactor the scale factor. + void Multiply(const Element_t theFactor) + { + for (size_t i = 0; i < 9; ++i) + { + myMat[i] *= theFactor; + } + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + NCollection_Mat3& operator*=(const Element_t theFactor) + { + Multiply(theFactor); + return *this; + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + //! @return the result of multiplication. + Standard_NODISCARD NCollection_Mat3 operator*(const Element_t theFactor) const + { + return Multiplied(theFactor); + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + //! @return the result of multiplication. + Standard_NODISCARD NCollection_Mat3 Multiplied(const Element_t theFactor) const + { + NCollection_Mat3 aTempMat(*this); + aTempMat *= theFactor; + return aTempMat; + } + + //! Compute per-component division. + //! @param[in] theFactor the scale factor. + void Divide(const Element_t theFactor) + { + for (size_t i = 0; i < 9; ++i) + { + myMat[i] /= theFactor; + } + } + + //! Per-component division. + //! @param[in] theScalar the scale factor. + NCollection_Mat3& operator/=(const Element_t theScalar) + { + Divide(theScalar); + return *this; + } + + //! Divides all the coefficients of the matrix by scalar. + Standard_NODISCARD NCollection_Mat3 Divided(const Element_t theScalar) const + { + NCollection_Mat3 aTempMat(*this); + aTempMat /= theScalar; + return aTempMat; + } + + //! Divides all the coefficients of the matrix by scalar. + Standard_NODISCARD NCollection_Mat3 operator/(const Element_t theScalar) const + { + return Divided(theScalar); + } + + //! Per-component addition of another matrix. + void Add(const NCollection_Mat3& theMat) + { + for (size_t i = 0; i < 9; ++i) + { + myMat[i] += theMat.myMat[i]; + } + } + + //! Per-component addition of another matrix. + NCollection_Mat3& operator+=(const NCollection_Mat3& theMat) + { + Add(theMat); + return *this; + } + + //! Per-component subtraction of another matrix. + void Subtract(const NCollection_Mat3& theMat) + { + for (size_t i = 0; i < 9; ++i) + { + myMat[i] -= theMat.myMat[i]; + } + } + + //! Per-component subtraction of another matrix. + NCollection_Mat3& operator-=(const NCollection_Mat3& theMat) + { + Subtract(theMat); + return *this; + } + + //! Per-component addition of another matrix. + Standard_NODISCARD NCollection_Mat3 Added(const NCollection_Mat3& theMat) const + { + NCollection_Mat3 aMat(*this); + aMat += theMat; + return aMat; + } + + //! Per-component addition of another matrix. + Standard_NODISCARD NCollection_Mat3 operator+(const NCollection_Mat3& theMat) const + { + return Added(theMat); + } + + //! Per-component subtraction of another matrix. + Standard_NODISCARD NCollection_Mat3 Subtracted(const NCollection_Mat3& theMat) const + { + NCollection_Mat3 aMat(*this); + aMat -= theMat; + return aMat; + } + + //! Per-component subtraction of another matrix. + Standard_NODISCARD NCollection_Mat3 operator-(const NCollection_Mat3& theMat) const + { + return Subtracted(theMat); + } + + //! Returns matrix with all components negated. + Standard_NODISCARD NCollection_Mat3 Negated() const + { + NCollection_Mat3 aMat; + for (size_t i = 0; i < 9; ++i) + { + aMat.myMat[i] = -myMat[i]; + } + return aMat; + } + + //! Returns matrix with all components negated. + Standard_NODISCARD NCollection_Mat3 operator-() const { return Negated(); } + + //! Transpose the matrix. + //! @return transposed copy of the matrix. + Standard_NODISCARD NCollection_Mat3 Transposed() const + { + NCollection_Mat3 aTempMat; + aTempMat.SetRow(0, GetColumn(0)); + aTempMat.SetRow(1, GetColumn(1)); + aTempMat.SetRow(2, GetColumn(2)); + return aTempMat; + } + + //! Transpose the matrix. + void Transpose() { *this = Transposed(); } + + //! Return determinant of the matrix. + Element_t Determinant() const + { + return (GetValue(0, 0) * GetValue(1, 1) * GetValue(2, 2) + + GetValue(0, 1) * GetValue(1, 2) * GetValue(2, 0) + + GetValue(0, 2) * GetValue(1, 0) * GetValue(2, 1)) + - (GetValue(0, 2) * GetValue(1, 1) * GetValue(2, 0) + + GetValue(0, 0) * GetValue(1, 2) * GetValue(2, 1) + + GetValue(0, 1) * GetValue(1, 0) * GetValue(2, 2)); + } + + //! Return adjoint (adjugate matrix, e.g. conjugate transpose). + Standard_NODISCARD NCollection_Mat3 Adjoint() const + { + NCollection_Mat3 aMat; + aMat.SetRow(0, NCollection_Vec3::Cross(GetRow(1), GetRow(2))); + aMat.SetRow(1, NCollection_Vec3::Cross(GetRow(2), GetRow(0))); + aMat.SetRow(2, NCollection_Vec3::Cross(GetRow(0), GetRow(1))); + return aMat; + } + + //! Compute inverted matrix. + //! @param[out] theInv the inverted matrix + //! @param[out] theDet determinant of matrix + //! @return true if reversion success + bool Inverted(NCollection_Mat3& theInv, Element_t& theDet) const + { + const NCollection_Mat3 aMat = Adjoint(); + theDet = aMat.GetRow(0).Dot(GetRow(0)); + if (theDet == Element_t(0)) + { + return false; + } + + theInv = aMat.Transposed() / theDet; + return true; + } + + //! Compute inverted matrix. + //! @param[out] theInv the inverted matrix + //! @return true if reversion success + bool Inverted(NCollection_Mat3& theInv) const + { + Element_t aDet; + return Inverted(theInv, aDet); + } + + //! Return inverted matrix. + NCollection_Mat3 Inverted() const + { + NCollection_Mat3 anInv; + if (!Inverted(anInv)) + { + throw Standard_ConstructionError( + "NCollection_Mat3::Inverted() - matrix has zero determinant"); + } + return anInv; + } + + //! Take values from NCollection_Mat3 with a different element type with type conversion. + template + void ConvertFrom(const NCollection_Mat3& theFrom) + { + for (int anIdx = 0; anIdx < 9; ++anIdx) + { + myMat[anIdx] = static_cast(theFrom.myMat[anIdx]); + } + } + + //! Maps plain C array to matrix type. + static NCollection_Mat3& Map(Element_t* theData) + { + return *reinterpret_cast*>(theData); + } + + //! Maps plain C array to matrix type. + static const NCollection_Mat3& Map(const Element_t* theData) + { + return *reinterpret_cast*>(theData); + } + + //! Dumps the content of me into the stream + void DumpJson(Standard_OStream& theOStream, Standard_Integer) const + { + OCCT_DUMP_FIELD_VALUES_NUMERICAL(theOStream, + "NCollection_Mat3", + 9, + GetValue(0, 0), + GetValue(0, 1), + GetValue(0, 2), + GetValue(1, 0), + GetValue(1, 1), + GetValue(1, 2), + GetValue(2, 0), + GetValue(2, 1), + GetValue(2, 2)) + } + +private: + Element_t myMat[9]; + +private: + static const Element_t MyZeroArray[9]; + static const Element_t MyIdentityArray[9]; + + // All instantiations are friend to each other + template + friend class NCollection_Mat3; +}; + +template +const Element_t NCollection_Mat3::MyZeroArray[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + +template +const Element_t NCollection_Mat3::MyIdentityArray[] = {1, 0, 0, 0, 1, 0, 0, 0, 1}; + +#if defined(_MSC_VER) && (_MSC_VER >= 1900) + #include + +static_assert(std::is_trivially_copyable>::value, + "NCollection_Mat3 is not is_trivially_copyable() structure!"); +static_assert(std::is_standard_layout>::value, + "NCollection_Mat3 is not is_standard_layout() structure!"); +static_assert(sizeof(NCollection_Mat3) == sizeof(float) * 9, + "NCollection_Mat3 is not packed/aligned!"); +#endif + +#endif // _NCollection_Mat3_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat4.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat4.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f49a76d67e563ed3535b406edc498b8605c0ce28 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_Mat4.hxx @@ -0,0 +1,693 @@ +// Created on: 2013-05-30 +// Created by: Anton POLETAEV +// Copyright (c) 2013-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _NCollection_Mat4_HeaderFile +#define _NCollection_Mat4_HeaderFile + +#include +#include + +//! Generic matrix of 4 x 4 elements. +//! To be used in conjunction with NCollection_Vec4 entities. +//! Originally introduced for 3D space projection and orientation operations. +//! Warning, empty constructor returns an identity matrix. +template +class NCollection_Mat4 +{ +public: + //! Get number of rows. + //! @return number of rows. + static size_t Rows() { return 4; } + + //! Get number of columns. + //! @return number of columns. + static size_t Cols() { return 4; } + + //! Return identity matrix. + static NCollection_Mat4 Identity() { return NCollection_Mat4(); } + + //! Return zero matrix. + static NCollection_Mat4 Zero() + { + NCollection_Mat4 aMat; + aMat.InitZero(); + return aMat; + } + +public: + //! Empty constructor. + //! Construct the identity matrix. + NCollection_Mat4() { InitIdentity(); } + + //! Conversion constructor (explicitly converts some 4 x 4 matrix with other element type + //! to a new 4 x 4 matrix with the element type Element_t, + //! whose elements are static_cast'ed corresponding elements of theOtherMat4 matrix) + //! @tparam OtherElement_t the element type of the other 4 x 4 matrix theOtherVec4 + //! @param theOtherMat4 the 4 x 4 matrix that needs to be converted + template + explicit NCollection_Mat4(const NCollection_Mat4& theOtherMat4) + { + ConvertFrom(theOtherMat4); + } + + //! Get element at the specified row and column. + //! @param[in] theRow the row to address. + //! @param[in] theCol the column to address. + //! @return the value of the addressed element. + Element_t GetValue(const size_t theRow, const size_t theCol) const + { + return myMat[theCol * 4 + theRow]; + } + + //! Access element at the specified row and column. + //! @param[in] theRow the row to access. + //! @param[in] theCol the column to access. + //! @return reference on the matrix element. + Element_t& ChangeValue(const size_t theRow, const size_t theCol) + { + return myMat[theCol * 4 + theRow]; + } + + //! Set value for the element specified by row and columns. + //! @param[in] theRow the row to change. + //! @param[in] theCol the column to change. + //! @param[in] theValue the value to set. + void SetValue(const size_t theRow, const size_t theCol, const Element_t theValue) + { + myMat[theCol * 4 + theRow] = theValue; + } + + //! Return value. + Element_t& operator()(const size_t theRow, const size_t theCol) + { + return ChangeValue(theRow, theCol); + } + + //! Return value. + Element_t operator()(const size_t theRow, const size_t theCol) const + { + return GetValue(theRow, theCol); + } + + //! Get vector of elements for the specified row. + //! @param[in] theRow the row to access. + //! @return vector of elements. + NCollection_Vec4 GetRow(const size_t theRow) const + { + return NCollection_Vec4(GetValue(theRow, 0), + GetValue(theRow, 1), + GetValue(theRow, 2), + GetValue(theRow, 3)); + } + + //! Change first 3 row values by the passed vector. + //! @param[in] theRow the row to change. + //! @param[in] theVec the vector of values. + void SetRow(const size_t theRow, const NCollection_Vec3& theVec) + { + SetValue(theRow, 0, theVec.x()); + SetValue(theRow, 1, theVec.y()); + SetValue(theRow, 2, theVec.z()); + } + + //! Set row values by the passed 4 element vector. + //! @param[in] theRow the row to change. + //! @param[in] theVec the vector of values. + void SetRow(const size_t theRow, const NCollection_Vec4& theVec) + { + SetValue(theRow, 0, theVec.x()); + SetValue(theRow, 1, theVec.y()); + SetValue(theRow, 2, theVec.z()); + SetValue(theRow, 3, theVec.w()); + } + + //! Get vector of elements for the specified column. + //! @param[in] theCol the column to access. + //! @return vector of elements. + NCollection_Vec4 GetColumn(const size_t theCol) const + { + return NCollection_Vec4(GetValue(0, theCol), + GetValue(1, theCol), + GetValue(2, theCol), + GetValue(3, theCol)); + } + + //! Change first 3 column values by the passed vector. + //! @param[in] theCol the column to change. + //! @param[in] theVec the vector of values. + void SetColumn(const size_t theCol, const NCollection_Vec3& theVec) + { + SetValue(0, theCol, theVec.x()); + SetValue(1, theCol, theVec.y()); + SetValue(2, theCol, theVec.z()); + } + + //! Set column values by the passed 4 element vector. + //! @param[in] theCol the column to change. + //! @param[in] theVec the vector of values. + void SetColumn(const size_t theCol, const NCollection_Vec4& theVec) + { + SetValue(0, theCol, theVec.x()); + SetValue(1, theCol, theVec.y()); + SetValue(2, theCol, theVec.z()); + SetValue(3, theCol, theVec.w()); + } + + //! Get vector of diagonal elements. + //! @return vector of diagonal elements. + NCollection_Vec4 GetDiagonal() const + { + return NCollection_Vec4(GetValue(0, 0), + GetValue(1, 1), + GetValue(2, 2), + GetValue(3, 3)); + } + + //! Change first 3 elements of the diagonal matrix. + //! @param theVec the vector of values. + void SetDiagonal(const NCollection_Vec3& theVec) + { + SetValue(0, 0, theVec.x()); + SetValue(1, 1, theVec.y()); + SetValue(2, 2, theVec.z()); + } + + //! Set diagonal elements of the matrix by the passed vector. + //! @param[in] theVec the vector of values. + void SetDiagonal(const NCollection_Vec4& theVec) + { + SetValue(0, 0, theVec.x()); + SetValue(1, 1, theVec.y()); + SetValue(2, 2, theVec.z()); + SetValue(3, 3, theVec.w()); + } + + //! Return 3x3 sub-matrix. + NCollection_Mat3 GetMat3() const + { + NCollection_Mat3 aMat; + aMat.SetColumn(0, GetColumn(0).xyz()); + aMat.SetColumn(1, GetColumn(1).xyz()); + aMat.SetColumn(2, GetColumn(2).xyz()); + return aMat; + } + + //! Initialize the zero matrix. + void InitZero() { std::memcpy(this, MyZeroArray, sizeof(NCollection_Mat4)); } + + //! Checks the matrix for zero (without tolerance). + bool IsZero() const { return std::memcmp(this, MyZeroArray, sizeof(NCollection_Mat4)) == 0; } + + //! Initialize the identity matrix. + void InitIdentity() { std::memcpy(this, MyIdentityArray, sizeof(NCollection_Mat4)); } + + //! Checks the matrix for identity (without tolerance). + bool IsIdentity() const + { + return std::memcmp(this, MyIdentityArray, sizeof(NCollection_Mat4)) == 0; + } + + //! Check this matrix for equality with another matrix (without tolerance!). + bool IsEqual(const NCollection_Mat4& theOther) const + { + return std::memcmp(this, &theOther, sizeof(NCollection_Mat4)) == 0; + } + + //! Check this matrix for equality with another matrix (without tolerance!). + bool operator==(const NCollection_Mat4& theOther) const { return IsEqual(theOther); } + + //! Check this matrix for non-equality with another matrix (without tolerance!). + bool operator!=(const NCollection_Mat4& theOther) const { return !IsEqual(theOther); } + + //! Raw access to the data (for OpenGL exchange); + //! the data is returned in column-major order. + const Element_t* GetData() const { return myMat; } + + Element_t* ChangeData() { return myMat; } + + //! Multiply by the vector (M * V). + //! @param[in] theVec the vector to multiply. + NCollection_Vec4 operator*(const NCollection_Vec4& theVec) const + { + return NCollection_Vec4( + GetValue(0, 0) * theVec.x() + GetValue(0, 1) * theVec.y() + GetValue(0, 2) * theVec.z() + + GetValue(0, 3) * theVec.w(), + GetValue(1, 0) * theVec.x() + GetValue(1, 1) * theVec.y() + GetValue(1, 2) * theVec.z() + + GetValue(1, 3) * theVec.w(), + GetValue(2, 0) * theVec.x() + GetValue(2, 1) * theVec.y() + GetValue(2, 2) * theVec.z() + + GetValue(2, 3) * theVec.w(), + GetValue(3, 0) * theVec.x() + GetValue(3, 1) * theVec.y() + GetValue(3, 2) * theVec.z() + + GetValue(3, 3) * theVec.w()); + } + + //! Compute matrix multiplication product: A * B. + //! @param[in] theMatA the matrix "A". + //! @param[in] theMatB the matrix "B". + static NCollection_Mat4 Multiply(const NCollection_Mat4& theMatA, const NCollection_Mat4& theMatB) + { + NCollection_Mat4 aMatRes; + + size_t aInputElem; + for (size_t aResElem = 0; aResElem < 16; ++aResElem) + { + aMatRes.myMat[aResElem] = (Element_t)0; + for (aInputElem = 0; aInputElem < 4; ++aInputElem) + { + aMatRes.myMat[aResElem] += + theMatA.GetValue(aResElem % 4, aInputElem) * theMatB.GetValue(aInputElem, aResElem / 4); + } + } + + return aMatRes; + } + + //! Compute matrix multiplication. + //! @param[in] theMat the matrix to multiply. + void Multiply(const NCollection_Mat4& theMat) { *this = Multiply(*this, theMat); } + + //! Multiply by the another matrix. + //! @param[in] theMat the other matrix. + NCollection_Mat4& operator*=(const NCollection_Mat4& theMat) + { + Multiply(theMat); + return *this; + } + + //! Compute matrix multiplication product. + //! @param[in] theMat the other matrix. + //! @return result of multiplication. + Standard_NODISCARD NCollection_Mat4 operator*(const NCollection_Mat4& theMat) const + { + return Multiplied(theMat); + } + + //! Compute matrix multiplication product. + //! @param[in] theMat the other matrix. + //! @return result of multiplication. + Standard_NODISCARD NCollection_Mat4 Multiplied(const NCollection_Mat4& theMat) const + { + NCollection_Mat4 aTempMat(*this); + aTempMat *= theMat; + return aTempMat; + } + + //! Compute per-component multiplication. + //! @param[in] theFactor the scale factor. + void Multiply(const Element_t theFactor) + { + for (size_t i = 0; i < 16; ++i) + { + myMat[i] *= theFactor; + } + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + NCollection_Mat4& operator*=(const Element_t theFactor) + { + Multiply(theFactor); + return *this; + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + //! @return the result of multiplication. + Standard_NODISCARD NCollection_Mat4 operator*(const Element_t theFactor) const + { + return Multiplied(theFactor); + } + + //! Compute per-element multiplication. + //! @param[in] theFactor the scale factor. + //! @return the result of multiplication. + Standard_NODISCARD NCollection_Mat4 Multiplied(const Element_t theFactor) const + { + NCollection_Mat4 aTempMat(*this); + aTempMat *= theFactor; + return aTempMat; + } + + //! Compute per-component division. + //! @param[in] theFactor the scale factor. + void Divide(const Element_t theFactor) + { + for (size_t i = 0; i < 16; ++i) + { + myMat[i] /= theFactor; + } + } + + //! Per-component division. + //! @param[in] theScalar the scale factor. + NCollection_Mat4& operator/=(const Element_t theScalar) + { + Divide(theScalar); + return *this; + } + + //! Divides all the coefficients of the matrix by scalar. + Standard_NODISCARD NCollection_Mat4 Divided(const Element_t theScalar) const + { + NCollection_Mat4 aTempMat(*this); + aTempMat /= theScalar; + return aTempMat; + } + + //! Divides all the coefficients of the matrix by scalar. + Standard_NODISCARD NCollection_Mat4 operator/(const Element_t theScalar) const + { + return Divided(theScalar); + } + + //! Per-component addition of another matrix. + void Add(const NCollection_Mat4& theMat) + { + for (size_t i = 0; i < 16; ++i) + { + myMat[i] += theMat.myMat[i]; + } + } + + //! Per-component addition of another matrix. + NCollection_Mat4& operator+=(const NCollection_Mat4& theMat) + { + Add(theMat); + return *this; + } + + //! Per-component subtraction of another matrix. + void Subtract(const NCollection_Mat4& theMat) + { + for (size_t i = 0; i < 16; ++i) + { + myMat[i] -= theMat.myMat[i]; + } + } + + //! Per-component subtraction of another matrix. + NCollection_Mat4& operator-=(const NCollection_Mat4& theMat) + { + Subtract(theMat); + return *this; + } + + //! Per-component addition of another matrix. + Standard_NODISCARD NCollection_Mat4 Added(const NCollection_Mat4& theMat) const + { + NCollection_Mat4 aMat(*this); + aMat += theMat; + return aMat; + } + + //! Per-component addition of another matrix. + Standard_NODISCARD NCollection_Mat4 operator+(const NCollection_Mat4& theMat) const + { + return Added(theMat); + } + + //! Per-component subtraction of another matrix. + Standard_NODISCARD NCollection_Mat4 Subtracted(const NCollection_Mat4& theMat) const + { + NCollection_Mat4 aMat(*this); + aMat -= theMat; + return aMat; + } + + //! Per-component subtraction of another matrix. + Standard_NODISCARD NCollection_Mat4 operator-(const NCollection_Mat4& theMat) const + { + return Subtracted(theMat); + } + + //! Returns matrix with all components negated. + Standard_NODISCARD NCollection_Mat4 Negated() const + { + NCollection_Mat4 aMat; + for (size_t i = 0; i < 16; ++i) + { + aMat.myMat[i] = -myMat[i]; + } + return aMat; + } + + //! Returns matrix with all components negated. + Standard_NODISCARD NCollection_Mat4 operator-() const { return Negated(); } + + //! Translate the matrix on the passed vector. + //! @param[in] theVec the translation vector. + void Translate(const NCollection_Vec3& theVec) + { + NCollection_Mat4 aTempMat; + aTempMat.SetColumn(3, theVec); + this->Multiply(aTempMat); + } + + //! Transpose the matrix. + //! @return transposed copy of the matrix. + Standard_NODISCARD NCollection_Mat4 Transposed() const + { + NCollection_Mat4 aTempMat; + aTempMat.SetRow(0, GetColumn(0)); + aTempMat.SetRow(1, GetColumn(1)); + aTempMat.SetRow(2, GetColumn(2)); + aTempMat.SetRow(3, GetColumn(3)); + return aTempMat; + } + + //! Transpose the matrix. + void Transpose() { *this = Transposed(); } + + //! Compute inverted matrix. + //! @param[out] theOutMx the inverted matrix + //! @param[out] theDet determinant of matrix + //! @return true if reversion success + bool Inverted(NCollection_Mat4& theOutMx, Element_t& theDet) const + { + Element_t* inv = theOutMx.myMat; + + // use short-cut for better readability + const Element_t* m = myMat; + + inv[0] = m[5] * (m[10] * m[15] - m[11] * m[14]) - m[9] * (m[6] * m[15] - m[7] * m[14]) + - m[13] * (m[7] * m[10] - m[6] * m[11]); + + inv[1] = m[1] * (m[11] * m[14] - m[10] * m[15]) - m[9] * (m[3] * m[14] - m[2] * m[15]) + - m[13] * (m[2] * m[11] - m[3] * m[10]); + + inv[2] = m[1] * (m[6] * m[15] - m[7] * m[14]) - m[5] * (m[2] * m[15] - m[3] * m[14]) + - m[13] * (m[3] * m[6] - m[2] * m[7]); + + inv[3] = m[1] * (m[7] * m[10] - m[6] * m[11]) - m[5] * (m[3] * m[10] - m[2] * m[11]) + - m[9] * (m[2] * m[7] - m[3] * m[6]); + + inv[4] = m[4] * (m[11] * m[14] - m[10] * m[15]) - m[8] * (m[7] * m[14] - m[6] * m[15]) + - m[12] * (m[6] * m[11] - m[7] * m[10]); + + inv[5] = m[0] * (m[10] * m[15] - m[11] * m[14]) - m[8] * (m[2] * m[15] - m[3] * m[14]) + - m[12] * (m[3] * m[10] - m[2] * m[11]); + + inv[6] = m[0] * (m[7] * m[14] - m[6] * m[15]) - m[4] * (m[3] * m[14] - m[2] * m[15]) + - m[12] * (m[2] * m[7] - m[3] * m[6]); + + inv[7] = m[0] * (m[6] * m[11] - m[7] * m[10]) - m[4] * (m[2] * m[11] - m[3] * m[10]) + - m[8] * (m[3] * m[6] - m[2] * m[7]); + + inv[8] = m[4] * (m[9] * m[15] - m[11] * m[13]) - m[8] * (m[5] * m[15] - m[7] * m[13]) + - m[12] * (m[7] * m[9] - m[5] * m[11]); + + inv[9] = m[0] * (m[11] * m[13] - m[9] * m[15]) - m[8] * (m[3] * m[13] - m[1] * m[15]) + - m[12] * (m[1] * m[11] - m[3] * m[9]); + + inv[10] = m[0] * (m[5] * m[15] - m[7] * m[13]) - m[4] * (m[1] * m[15] - m[3] * m[13]) + - m[12] * (m[3] * m[5] - m[1] * m[7]); + + inv[11] = m[0] * (m[7] * m[9] - m[5] * m[11]) - m[4] * (m[3] * m[9] - m[1] * m[11]) + - m[8] * (m[1] * m[7] - m[3] * m[5]); + + inv[12] = m[4] * (m[10] * m[13] - m[9] * m[14]) - m[8] * (m[6] * m[13] - m[5] * m[14]) + - m[12] * (m[5] * m[10] - m[6] * m[9]); + + inv[13] = m[0] * (m[9] * m[14] - m[10] * m[13]) - m[8] * (m[1] * m[14] - m[2] * m[13]) + - m[12] * (m[2] * m[9] - m[1] * m[10]); + + inv[14] = m[0] * (m[6] * m[13] - m[5] * m[14]) - m[4] * (m[2] * m[13] - m[1] * m[14]) + - m[12] * (m[1] * m[6] - m[2] * m[5]); + + inv[15] = m[0] * (m[5] * m[10] - m[6] * m[9]) - m[4] * (m[1] * m[10] - m[2] * m[9]) + - m[8] * (m[2] * m[5] - m[1] * m[6]); + + theDet = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12]; + if (theDet == 0) + { + return false; + } + + const Element_t aDiv = (Element_t)1. / theDet; + for (int i = 0; i < 16; ++i) + { + inv[i] *= aDiv; + } + return true; + } + + //! Compute inverted matrix. + //! @param[out] theOutMx the inverted matrix + //! @return true if reversion success + bool Inverted(NCollection_Mat4& theOutMx) const + { + Element_t aDet; + return Inverted(theOutMx, aDet); + } + + //! Return inverted matrix. + NCollection_Mat4 Inverted() const + { + NCollection_Mat4 anInv; + if (!Inverted(anInv)) + { + throw Standard_ConstructionError( + "NCollection_Mat4::Inverted() - matrix has zero determinant"); + } + return anInv; + } + + //! Return determinant of the 3x3 sub-matrix. + Element_t DeterminantMat3() const + { + return (GetValue(0, 0) * GetValue(1, 1) * GetValue(2, 2) + + GetValue(0, 1) * GetValue(1, 2) * GetValue(2, 0) + + GetValue(0, 2) * GetValue(1, 0) * GetValue(2, 1)) + - (GetValue(0, 2) * GetValue(1, 1) * GetValue(2, 0) + + GetValue(0, 0) * GetValue(1, 2) * GetValue(2, 1) + + GetValue(0, 1) * GetValue(1, 0) * GetValue(2, 2)); + } + + //! Return adjoint (adjugate matrix, e.g. conjugate transpose). + Standard_NODISCARD NCollection_Mat4 Adjoint() const + { + NCollection_Mat4 aMat; + aMat.SetRow(0, crossVec4(GetRow(1), GetRow(2), GetRow(3))); + aMat.SetRow(1, crossVec4(-GetRow(0), GetRow(2), GetRow(3))); + aMat.SetRow(2, crossVec4(GetRow(0), GetRow(1), GetRow(3))); + aMat.SetRow(3, crossVec4(-GetRow(0), GetRow(1), GetRow(2))); + return aMat; + } + + //! Take values from NCollection_Mat4 with a different element type with type conversion. + template + void ConvertFrom(const NCollection_Mat4& theFrom) + { + for (int anIdx = 0; anIdx < 16; ++anIdx) + { + myMat[anIdx] = static_cast(theFrom.myMat[anIdx]); + } + } + + //! Take values from NCollection_Mat4 with a different element type with type conversion. + template + void Convert(const NCollection_Mat4& theFrom) + { + ConvertFrom(theFrom); + } + + //! Maps plain C array to matrix type. + static NCollection_Mat4& Map(Element_t* theData) + { + return *reinterpret_cast*>(theData); + } + + //! Maps plain C array to matrix type. + static const NCollection_Mat4& Map(const Element_t* theData) + { + return *reinterpret_cast*>(theData); + } + + //! Dumps the content of me into the stream + void DumpJson(Standard_OStream& theOStream, Standard_Integer) const + { + OCCT_DUMP_FIELD_VALUES_NUMERICAL(theOStream, + "NCollection_Mat4", + 16, + GetValue(0, 0), + GetValue(0, 1), + GetValue(0, 2), + GetValue(0, 3), + GetValue(1, 0), + GetValue(1, 1), + GetValue(1, 2), + GetValue(1, 3), + GetValue(2, 0), + GetValue(2, 1), + GetValue(2, 2), + GetValue(2, 3), + GetValue(3, 0), + GetValue(3, 1), + GetValue(3, 2), + GetValue(3, 3)) + } + +private: + //! Cross-product has no direct meaning in 4D space - provided for local usage. + static NCollection_Vec4 crossVec4(const NCollection_Vec4& theA, + const NCollection_Vec4& theB, + const NCollection_Vec4& theC) + { + const Element_t aD1 = (theB.z() * theC.w()) - (theB.w() * theC.z()); + const Element_t aD2 = (theB.y() * theC.w()) - (theB.w() * theC.y()); + const Element_t aD3 = (theB.y() * theC.z()) - (theB.z() * theC.y()); + const Element_t aD4 = (theB.x() * theC.w()) - (theB.w() * theC.x()); + const Element_t aD5 = (theB.x() * theC.z()) - (theB.z() * theC.x()); + const Element_t aD6 = (theB.x() * theC.y()) - (theB.y() * theC.x()); + + NCollection_Vec4 aVec; + aVec.x() = -theA.y() * aD1 + theA.z() * aD2 - theA.w() * aD3; + aVec.y() = theA.x() * aD1 - theA.z() * aD4 + theA.w() * aD5; + aVec.z() = -theA.x() * aD2 + theA.y() * aD4 - theA.w() * aD6; + aVec.w() = theA.x() * aD3 - theA.y() * aD5 + theA.z() * aD6; + return aVec; + } + +private: + Element_t myMat[16]; + +private: + static const Element_t MyZeroArray[16]; + static const Element_t MyIdentityArray[16]; + + // All instantiations are friend to each other + template + friend class NCollection_Mat4; +}; + +template +const Element_t NCollection_Mat4::MyZeroArray[] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +template +const Element_t NCollection_Mat4::MyIdentityArray[] = + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; + +#if defined(_MSC_VER) && (_MSC_VER >= 1900) + #include + +static_assert(std::is_trivially_copyable>::value, + "NCollection_Mat4 is not is_trivially_copyable() structure!"); +static_assert(std::is_standard_layout>::value, + "NCollection_Mat4 is not is_standard_layout() structure!"); +static_assert(sizeof(NCollection_Mat4) == sizeof(float) * 16, + "NCollection_Mat4 is not packed/aligned!"); +#endif + +#endif // _NCollection_Mat4_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_SparseArray.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_SparseArray.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d946ab65f49fda40c62940b5a0a6d1deb35cd794 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_SparseArray.hxx @@ -0,0 +1,219 @@ +// Created on: 2006-11-23 +// Created by: Andrey BETENEV +// Copyright (c) 2006-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef NCollection_SparseArray_HeaderFile +#define NCollection_SparseArray_HeaderFile + +#include + +/** + * Dynamically resizable sparse array of objects + * + * This class is similar to NCollection_Vector: it works like virtually + * unlimited array of items accessible by index; however unlike simple + * Vector it distinguishes items that have been set from the ones that + * have not been set explicitly. + * + * This class can be also seen as equivalence of + * NCollection_DataMap + * with the only one practical difference: it can be much less + * memory-expensive if items are small (e.g. Integer or Handle). + * + * The index starts from 0, i.e. should be non-negative. Memory is allocated + * when item is set by SetValue(). + * + * Iterator returns only defined items; + * the item can be tested for being defined by IsSet(), + * and undefined by UnsetValue(). + * + * The attempt to access the item that has not been set will result + * in OutOfRange exception in Debug mode; in Release mode this will either + * return null-filled object or cause access violation. + */ + +template +class NCollection_SparseArray : public NCollection_SparseArrayBase +{ +public: + //! Constructor; accepts size of blocks + explicit NCollection_SparseArray(Standard_Size theIncrement) + : NCollection_SparseArrayBase(sizeof(TheItemType), theIncrement) + { + } + + //! Explicit assignment operator + NCollection_SparseArray& Assign(const NCollection_SparseArray& theOther) + { + this->assign(theOther); + return *this; + } + + //! Exchange the data of two arrays; + //! can be used primarily to move contents of theOther into the new array + //! in a fast way (without creation of duplicated data) + void Exchange(NCollection_SparseArray& theOther) { this->exchange(theOther); } + + //! Destructor + virtual ~NCollection_SparseArray() { Clear(); } + +public: + //!@name Array-like interface (in addition to inherited methods) + //!@{ + + //! Direct const access to the item + const TheItemType& Value(const Standard_Size theIndex) const + { + return *(const TheItemType*)this->getValue(theIndex); + } + + //! Const access to the item - operator() + const TheItemType& operator()(const Standard_Size theIndex) const { return Value(theIndex); } + + //! Modification access to the item + TheItemType& ChangeValue(const Standard_Size theIndex) + { + return *(TheItemType*)(this->getValue(theIndex)); + } + + //! Access to the item - operator() + TheItemType& operator()(const Standard_Size theIndex) { return ChangeValue(theIndex); } + + //! Set a value at specified index method + TheItemType& SetValue(const Standard_Size theIndex, const TheItemType& theValue) + { + return *(TheItemType*)this->setValue(theIndex, (Standard_Address)&theValue); + } + + //!@} + +public: + //!@name DataMap-like interface + //!@{ + + //! Returns number of items in the array + Standard_Size Extent() const { return Size(); } + + //! Returns True if array is empty + Standard_Boolean IsEmpty() const { return Size() == 0; } + + //! Direct const access to the item + const TheItemType& Find(const Standard_Size theIndex) const { return Value(theIndex); } + + //! Modification access to the item + TheItemType& ChangeFind(const Standard_Size theIndex) { return ChangeValue(theIndex); } + + //! Set a value as explicit method + TheItemType& Bind(const Standard_Size theIndex, const TheItemType& theValue) + { + return SetValue(theIndex, theValue); + } + + //! Returns True if the item is defined + Standard_Boolean IsBound(const Standard_Size theIndex) const { return this->HasValue(theIndex); } + + //! Remove the item from array + Standard_Boolean UnBind(const Standard_Size theIndex) { return this->UnsetValue(theIndex); } + + //!@} + +public: + // Iterator interface + + /** + * Implementation of type-specific const Iterator class + */ + class ConstIterator : public NCollection_SparseArrayBase::Iterator + { + public: + //! Empty constructor - for later Init + ConstIterator() {} + + //! Constructor with initialisation + ConstIterator(const NCollection_SparseArray& theVector) + : NCollection_SparseArrayBase::Iterator(&theVector) + { + } + + //! Initialisation + void Init(const NCollection_SparseArray& theVector) { this->init(&theVector); } + + //! Constant value access + const TheItemType& Value(void) const { return *(const TheItemType*)this->value(); } + + //! Constant value access operator + const TheItemType& operator()(void) const { return *(const TheItemType*)this->value(); } + + //! Access current index with 'a-la map' interface + Standard_Size Key(void) const { return Index(); } + }; + + /** + * Implementation of type-specific non-const Iterator class + */ + class Iterator : public ConstIterator + { + public: + //! Empty constructor - for later Init + Iterator() {} + + //! Constructor with initialisation + Iterator(NCollection_SparseArray& theVector) + : ConstIterator(theVector) + { + } + + //! Initialisation + void Init(const NCollection_SparseArray& theVector) { this->init(&theVector); } + + //! Value access + TheItemType& ChangeValue(void) { return *(TheItemType*)this->value(); } + + //! Value access operator + TheItemType& operator()(void) { return *(TheItemType*)this->value(); } + + //! Const access operator - the same as in parent class + const TheItemType& operator()(void) const { return *(const TheItemType*)this->value(); } + }; + +private: + // Implementation of virtual methods providing type-specific behaviour + + //! Create new item at the specified address with default constructor + // virtual void createItem (Standard_Address theAddress) + // { + // new (theAddress) TheItemType; + // } + + //! Create new item at the specified address with copy constructor + //! from existing item + virtual void createItem(Standard_Address theAddress, Standard_Address theOther) + { + new (theAddress) TheItemType(*(const TheItemType*)theOther); + } + + //! Call destructor to the item at given address + virtual void destroyItem(Standard_Address theAddress) + { + ((TheItemType*)theAddress)->TheItemType::~TheItemType(); + } + + //! Call assignment operator to the item + virtual void copyItem(Standard_Address theAddress, Standard_Address theOther) + { + (*(TheItemType*)theAddress) = *(const TheItemType*)theOther; + } +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UBTree.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UBTree.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bf98c4a8094ad9402ae50c6401eb67181eb79cac --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UBTree.hxx @@ -0,0 +1,560 @@ +// Created on: 2002-07-30 +// Created by: Michael SAZONOV +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef NCollection_UBTree_HeaderFile +#define NCollection_UBTree_HeaderFile + +#include +#include + +/** + * The algorithm of unbalanced binary tree of overlapped bounding boxes. + * + * Once the tree of boxes of geometric objects is constructed, the algorithm + * is capable of fast geometric selection of objects. The tree can be easily + * updated by adding to it a new object with bounding box. + * + * The time of adding to the tree of one object is O(log(N)), where N is the + * total number of objects, so the time of building a tree of N objects is + * O(N(log(N)). The search time of one object is O(log(N)). + * + * Defining various classes inheriting NCollection_UBTree::Selector we can + * perform various kinds of selection over the same b-tree object + * + * The object may be of any type allowing copying. Among the best suitable + * solutions there can be a pointer to an object, handled object or integer + * index of object inside some collection. The bounding object may have any + * dimension and geometry. The minimal interface of TheBndType (besides + * public empty and copy constructor and operator =) used in UBTree algorithm + * is as the following: + * @code + * class MyBndType + * { + * public: + * inline void Add (const MyBndType& other); + * // Updates me with other bounding + * + * inline Standard_Boolean IsOut (const MyBndType& other) const; + * // Classifies other bounding relatively me + * + * inline Standard_Real SquareExtent() const; + * // Computes the squared maximal linear extent of me. + * // (For box it is the squared diagonal of box) + * }; + * @endcode + * To select objects you need to define a class derived from UBTree::Selector + * that should redefine the necessary virtual methods to maintain the + * selection condition. The object of this class is also used to retrieve + * selected objects after search. + */ + +template +class NCollection_UBTree +{ +public: + //! Memory allocation + DEFINE_STANDARD_ALLOC + DEFINE_NCOLLECTION_ALLOC + +public: + // ---------- PUBLIC TYPES ---------- + + /** + * Class defining the minimal interface of selector. + */ + class Selector + { + public: + /** + * Constructor + */ + Selector() + : myStop(Standard_False) + { + } + + /** + * Rejection base on the bounding type. + * @return + * True if the bounding box does not conform to some selection conditions + */ + virtual Standard_Boolean Reject(const TheBndType&) const = 0; + + /** + * Confirm the object while making necessary tests on it. This method is + * called when the bounding box of the object conforms to the conditions + * (see Reject()). It is also supposed to keep record of accepted objects. + * @return + * True if the object is accepted + */ + virtual Standard_Boolean Accept(const TheObjType&) = 0; + + /** + * This condition is checked after each call to Accept(). + * @return + * True signals that the selection process is stopped + */ + Standard_Boolean Stop() const { return myStop; } + + /** + * Destructor + */ + virtual ~Selector() {} + + protected: + /** + * The method Accept() should set this flag if the selection process + * is to be stopped + */ + Standard_Boolean myStop; + }; + + /** + * Class describing the node of the tree. + * Initially the tree consists of one leaf. A node can grow to a branch + * holding two childs: + * - one correspondent to initial node + * - the new one with a new object and bounding box + */ + class TreeNode + { + public: + DEFINE_STANDARD_ALLOC + DEFINE_NCOLLECTION_ALLOC + + public: + TreeNode(const TheObjType& theObj, const TheBndType& theBnd) + : myBnd(theBnd), + myObject(theObj), + myChildren(0), + myParent(0) + { + } + + Standard_Boolean IsLeaf() const { return !myChildren; } + + Standard_Boolean IsRoot() const { return !myParent; } + + const TheBndType& Bnd() const { return myBnd; } + + TheBndType& ChangeBnd() { return myBnd; } + + const TheObjType& Object() const { return myObject; } + + const TreeNode& Child(const Standard_Integer i) const { return myChildren[i]; } + + TreeNode& ChangeChild(const Standard_Integer i) { return myChildren[i]; } + + const TreeNode& Parent() const { return *myParent; } + + TreeNode& ChangeParent() { return *myParent; } + + /** + * Forces *this node being gemmated such a way that it becomes + * a branch holding the previous content of *this node at the + * first child and theObj at the second child. + * @param theNewBnd + * new bounding box comprizing both child nodes. + * @param theObj + * added object. + * @param theBnd + * bounding box of theObj. + * @theAlloc + * allocator providing memory to the new child nodes, provided by the + * calling Tree instance. + */ + void Gemmate(const TheBndType& theNewBnd, + const TheObjType& theObj, + const TheBndType& theBnd, + const Handle(NCollection_BaseAllocator)& theAlloc) + { + // TreeNode *children = new TreeNode [2]; + TreeNode* children = (TreeNode*)theAlloc->Allocate(2 * sizeof(TreeNode)); + new (&children[0]) TreeNode; + new (&children[1]) TreeNode; + children[0] = *this; + children[1].myObject = theObj; + children[1].myBnd = theBnd; + children[0].myParent = children[1].myParent = this; + if (!IsLeaf()) + { + myChildren[0].myParent = children; + myChildren[1].myParent = children; + } + myChildren = children; + myBnd = theNewBnd; + myObject = TheObjType(); // nullify myObject + } + + /** + * Kills the i-th child, and *this accepts the content of another child + */ + void Kill(const Standard_Integer i, const Handle(NCollection_BaseAllocator)& theAlloc) + { + if (!IsLeaf()) + { + TreeNode* oldChildren = myChildren; + const Standard_Integer iopp = 1 - i; + myBnd = oldChildren[iopp].myBnd; + myObject = oldChildren[iopp].myObject; + myChildren = oldChildren[iopp].myChildren; + if (!IsLeaf()) + { + myChildren[0].myParent = this; + myChildren[1].myParent = this; + } + // oldChildren[0].myChildren = oldChildren[1].myChildren = 0L; + // delete [] oldChildren; + oldChildren[iopp].~TreeNode(); + delNode(&oldChildren[i], theAlloc); // remove the whole branch + theAlloc->Free(oldChildren); + } + } + + // ~TreeNode () { if (myChildren) delete [] myChildren; } + ~TreeNode() { myChildren = 0L; } + + /** + * Deleter of tree node. The whole hierarchy of its children also deleted. + * This method should be used instead of operator delete. + */ + static void delNode(TreeNode* theNode, const Handle(NCollection_BaseAllocator)& theAlloc) + { + if (theNode) + { + if (theNode->myChildren) + { + delNode(&theNode->myChildren[0], theAlloc); + delNode(&theNode->myChildren[1], theAlloc); + theAlloc->Free(theNode->myChildren); + } + theNode->~TreeNode(); + } + } + + private: + TreeNode() + : myChildren(0L), + myParent(0L) + { + } + + TheBndType myBnd; ///< bounding geometry + TheObjType myObject; ///< the object + TreeNode* myChildren; ///< 2 children forming a b-tree + TreeNode* myParent; ///< the pointer to a parent node + }; + + // ---------- PUBLIC METHODS ---------- + + /** + * Empty constructor. + */ + NCollection_UBTree() + : myRoot(0L), + myLastNode(0L), + myAlloc(NCollection_BaseAllocator::CommonBaseAllocator()) + { + } + + /** + * Constructor. + */ + explicit NCollection_UBTree(const Handle(NCollection_BaseAllocator)& theAllocator) + : myRoot(0L), + myLastNode(0L), + myAlloc(!theAllocator.IsNull() ? theAllocator + : NCollection_BaseAllocator::CommonBaseAllocator()) + { + } + + /** + * Update the tree with a new object and its bounding box. + * @param theObj + * added object + * @param theBnd + * bounding box of the object. + * @return + * always True + */ + virtual Standard_Boolean Add(const TheObjType& theObj, const TheBndType& theBnd); + + /** + * Searches in the tree all objects conforming to the given selector. + * return + * Number of objects accepted + */ + virtual Standard_Integer Select(Selector& theSelector) const + { + return (IsEmpty() ? 0 : Select(Root(), theSelector)); + } + + /** + * Clears the contents of the tree. + * @param aNewAlloc + * Optional: a new allocator that will be used when the tree is rebuilt + * anew. This makes sense if the memory allocator needs re-initialisation + * (like NCollection_IncAllocator). By default the previous allocator is + * kept. + */ + virtual void Clear(const Handle(NCollection_BaseAllocator)& aNewAlloc = 0L) + // { if (myRoot) delete myRoot; myRoot = 0L; } + { + if (myRoot) + { + TreeNode::delNode(myRoot, this->myAlloc); + this->myAlloc->Free(myRoot); + myRoot = 0L; + } + if (aNewAlloc.IsNull() == Standard_False) + myAlloc = aNewAlloc; + } + + Standard_Boolean IsEmpty() const { return !myRoot; } + + /** + * @return + * the root node of the tree + */ + const TreeNode& Root() const { return *myRoot; } + + /** + * Destructor. + */ + virtual ~NCollection_UBTree() { Clear(); } + + /** + * Recommended to be used only in sub-classes. + * @return + * Allocator object used in this instance of UBTree. + */ + const Handle(NCollection_BaseAllocator)& Allocator() const { return myAlloc; } + +protected: + // ---------- PROTECTED METHODS ---------- + + /** + * @return + * the last added node + */ + TreeNode& ChangeLastNode() { return *myLastNode; } + + /** + * Searches in the branch all objects conforming to the given selector. + * @return + * the number of objects accepted + */ + Standard_Integer Select(const TreeNode& theBranch, Selector& theSelector) const; + +private: + // ---------- PRIVATE METHODS ---------- + + /// Copy constructor (prohibited). + NCollection_UBTree(const NCollection_UBTree&); + + /// Assignment operator (prohibited). + NCollection_UBTree& operator=(const NCollection_UBTree&); + + // ---------- PRIVATE FIELDS ---------- + + TreeNode* myRoot; ///< root of the tree + TreeNode* myLastNode; ///< the last added node + Handle(NCollection_BaseAllocator) myAlloc; ///< Allocator for TreeNode +}; + +// ================== METHODS TEMPLATES ===================== +//======================================================================= +// function : Add +// purpose : Updates the tree with a new object and its bounding box +//======================================================================= + +template +Standard_Boolean NCollection_UBTree::Add(const TheObjType& theObj, + const TheBndType& theBnd) +{ + if (IsEmpty()) + { + // Accepting first object + myRoot = new (this->myAlloc) TreeNode(theObj, theBnd); + myLastNode = myRoot; + return Standard_True; + } + + TreeNode* pBranch = myRoot; + Standard_Boolean isOutOfBranch = pBranch->Bnd().IsOut(theBnd); + + for (;;) + { + // condition of stopping the search + if (isOutOfBranch || pBranch->IsLeaf()) + { + TheBndType aNewBnd = theBnd; + aNewBnd.Add(pBranch->Bnd()); + // put the new leaf aside on the level of pBranch + pBranch->Gemmate(aNewBnd, theObj, theBnd, this->myAlloc); + myLastNode = &pBranch->ChangeChild(1); + break; + } + + // Update the bounding box of the branch + pBranch->ChangeBnd().Add(theBnd); + + // Select the best child branch to accept the object: + // 1. First check if one branch is out and another one is not. + // 2. Else select the child having the least union with theBnd + Standard_Integer iBest = 0; + Standard_Boolean isOut[] = {pBranch->Child(0).Bnd().IsOut(theBnd), + pBranch->Child(1).Bnd().IsOut(theBnd)}; + if (isOut[0] != isOut[1]) + iBest = (isOut[0] ? 1 : 0); + else + { + TheBndType aUnion[] = {theBnd, theBnd}; + aUnion[0].Add(pBranch->Child(0).Bnd()); + aUnion[1].Add(pBranch->Child(1).Bnd()); + const Standard_Real d1 = aUnion[0].SquareExtent(); + const Standard_Real d2 = aUnion[1].SquareExtent(); + if (d1 > d2) + iBest = 1; + } + + // Continue with the selected branch + isOutOfBranch = isOut[iBest]; + pBranch = &pBranch->ChangeChild(iBest); + } + return Standard_True; +} + +//======================================================================= +// function : Select +// purpose : Recursively searches in the branch all objects conforming +// to the given selector. +// Returns the number of objects found. +//======================================================================= + +template +Standard_Integer NCollection_UBTree::Select(const TreeNode& theBranch, + Selector& theSelector) const +{ + // Try to reject the branch by bounding box + if (theSelector.Reject(theBranch.Bnd())) + return 0; + + Standard_Integer nSel = 0; + + if (theBranch.IsLeaf()) + { + // It is a leaf => try to accept the object + if (theSelector.Accept(theBranch.Object())) + nSel++; + } + else + { + // It is a branch => select from its children + nSel += Select(theBranch.Child(0), theSelector); + if (!theSelector.Stop()) + nSel += Select(theBranch.Child(1), theSelector); + } + + return nSel; +} + +// ====================================================================== +/** + * Declaration of handled version of NCollection_UBTree. + * In the macros below the arguments are: + * _HUBTREE - the desired name of handled class + * _OBJTYPE - the name of the object type + * _BNDTYPE - the name of the bounding box type + * _HPARENT - the name of parent class (usually Standard_Transient) + */ +#define DEFINE_HUBTREE(_HUBTREE, _OBJTYPE, _BNDTYPE, _HPARENT) \ + class _HUBTREE : public _HPARENT \ + { \ + public: \ + typedef NCollection_UBTree<_OBJTYPE, _BNDTYPE> UBTree; \ + \ + _HUBTREE() \ + : myTree(new UBTree) \ + { \ + } \ + /* Empty constructor */ \ + _HUBTREE(const Handle(NCollection_BaseAllocator)& theAlloc) \ + : myTree(new UBTree(theAlloc)) \ + { \ + } \ + /* Constructor */ \ + \ + /* Access to the methods of UBTree */ \ + \ + Standard_Boolean Add(const _OBJTYPE& theObj, const _BNDTYPE& theBnd) \ + { \ + return ChangeTree().Add(theObj, theBnd); \ + } \ + \ + Standard_Integer Select(UBTree::Selector& theSelector) const \ + { \ + return Tree().Select(theSelector); \ + } \ + \ + void Clear() \ + { \ + ChangeTree().Clear(); \ + } \ + \ + Standard_Boolean IsEmpty() const \ + { \ + return Tree().IsEmpty(); \ + } \ + \ + const UBTree::TreeNode& Root() const \ + { \ + return Tree().Root(); \ + } \ + \ + /* Access to the tree algorithm */ \ + \ + const UBTree& Tree() const \ + { \ + return *myTree; \ + } \ + UBTree& ChangeTree() \ + { \ + return *myTree; \ + } \ + \ + ~_HUBTREE() \ + { \ + delete myTree; \ + } \ + /* Destructor */ \ + \ + DEFINE_STANDARD_RTTI_INLINE(_HUBTREE, _HPARENT) \ + /* Type management */ \ + \ + private: \ + /* Copying and assignment are prohibited */ \ + _HUBTREE(UBTree*); \ + _HUBTREE(const _HUBTREE&); \ + void operator=(const _HUBTREE&); \ + \ + private: \ + UBTree* myTree; /* pointer to the tree algorithm */ \ + }; \ + DEFINE_STANDARD_HANDLE(_HUBTREE, _HPARENT) + +#define IMPLEMENT_HUBTREE(_HUBTREE, _HPARENT) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UtfIterator.lxx b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UtfIterator.lxx new file mode 100644 index 0000000000000000000000000000000000000000..c945bc06bf9a9518659c9fe7c35d5aac8476d1b9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NCollection_UtfIterator.lxx @@ -0,0 +1,342 @@ +// Created on: 2013-01-28 +// Created by: Kirill GAVRILOV +// Copyright (c) 2013-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// Portions of code are copyrighted by Unicode, Inc. +// +// Copyright (c) 2001-2004 Unicode, Inc. +// +// Disclaimer +// +// This source code is provided as is by Unicode, Inc. No claims are +// made as to fitness for any particular purpose. No warranties of any +// kind are expressed or implied. The recipient agrees to determine +// applicability of information provided. If this file has been +// purchased on magnetic or optical media from Unicode, Inc., the +// sole remedy for any claim will be exchange of defective media +// within 90 days of receipt. +// +// Limitations on Rights to Redistribute This Code +// +// Unicode, Inc. hereby grants the right to freely use the information +// supplied in this file in the creation of products supporting the +// Unicode Standard, and to make copies of this file in any form +// for internal or external distribution as long as this notice +// remains attached. + +//! The first character in a UTF-8 sequence indicates how many bytes +//! to read (among other things). +template +const unsigned char NCollection_UtfIterator::UTF8_BYTES_MINUS_ONE[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5}; + +//! Magic values subtracted from a buffer value during UTF-8 conversion. +//! This table contains as many values as there might be trailing bytes +//! in a UTF-8 sequence. +template +const Standard_Utf32Char NCollection_UtfIterator::offsetsFromUTF8[6] = + {0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL}; + +//! The first character in a UTF-8 sequence indicates how many bytes to read. +template +const unsigned char NCollection_UtfIterator::UTF8_FIRST_BYTE_MARK[7] = + {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; + +// ======================================================================= +// function : readUTF8 +// purpose : Get a UTF-8 character; leave the tracking pointer at the start of the next character. +// Not protected against invalid UTF-8. +// ======================================================================= +template +inline void NCollection_UtfIterator::readUTF8() +{ + // unsigned arithmetic used + Standard_Utf8UChar* aPos = (Standard_Utf8UChar*)myPosNext; + const unsigned char aBytesToRead = UTF8_BYTES_MINUS_ONE[*aPos]; + myCharUtf32 = 0; + switch (aBytesToRead) + { + case 5: + myCharUtf32 += *aPos++; + myCharUtf32 <<= 6; // remember, illegal UTF-8 + Standard_FALLTHROUGH + case 4: + myCharUtf32 += *aPos++; + myCharUtf32 <<= 6; // remember, illegal UTF-8 + Standard_FALLTHROUGH + case 3: + myCharUtf32 += *aPos++; + myCharUtf32 <<= 6; + Standard_FALLTHROUGH + case 2: + myCharUtf32 += *aPos++; + myCharUtf32 <<= 6; + Standard_FALLTHROUGH + case 1: + myCharUtf32 += *aPos++; + myCharUtf32 <<= 6; + Standard_FALLTHROUGH + case 0: + myCharUtf32 += *aPos++; + } + myCharUtf32 -= offsetsFromUTF8[aBytesToRead]; + myPosNext = (Type*)aPos; +} + +// magic numbers +template +const Standard_Utf32Char NCollection_UtfIterator::UTF8_BYTE_MASK = 0xBF; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF8_BYTE_MARK = 0x80; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_HIGH_START = 0xD800; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_HIGH_END = 0xDBFF; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_LOW_START = 0xDC00; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_LOW_END = 0xDFFF; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_HIGH_SHIFT = 10; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_LOW_BASE = 0x0010000UL; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF16_SURROGATE_LOW_MASK = 0x3FFUL; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF32_MAX_BMP = 0x0000FFFFUL; +template +const Standard_Utf32Char NCollection_UtfIterator::UTF32_MAX_LEGAL = 0x0010FFFFUL; + +// ======================================================================= +// function : readUTF16 +// purpose : +// ======================================================================= +template +inline void NCollection_UtfIterator::readUTF16() +{ + Standard_Utf32Char aChar = *myPosNext++; + // if we have the first half of the surrogate pair + if (aChar >= UTF16_SURROGATE_HIGH_START && aChar <= UTF16_SURROGATE_HIGH_END) + { + const Standard_Utf32Char aChar2 = *myPosNext; + // complete the surrogate pair + if (aChar2 >= UTF16_SURROGATE_LOW_START && aChar2 <= UTF16_SURROGATE_LOW_END) + { + aChar = ((aChar - UTF16_SURROGATE_HIGH_START) << UTF16_SURROGATE_HIGH_SHIFT) + + (aChar2 - UTF16_SURROGATE_LOW_START) + UTF16_SURROGATE_LOW_BASE; + ++myPosNext; + } + } + myCharUtf32 = aChar; +} + +// ======================================================================= +// function : AdvanceBytesUtf8 +// purpose : +// ======================================================================= +template +inline Standard_Integer NCollection_UtfIterator::AdvanceBytesUtf8() const +{ + if (myCharUtf32 >= UTF16_SURROGATE_HIGH_START && myCharUtf32 <= UTF16_SURROGATE_LOW_END) + { + // UTF-16 surrogate values are illegal in UTF-32 + return 0; + } + else if (myCharUtf32 < Standard_Utf32Char(0x80)) + { + return 1; + } + else if (myCharUtf32 < Standard_Utf32Char(0x800)) + { + return 2; + } + else if (myCharUtf32 < Standard_Utf32Char(0x10000)) + { + return 3; + } + else if (myCharUtf32 <= UTF32_MAX_LEGAL) + { + return 4; + } + else + { + // illegal + return 0; + } +} + +// ======================================================================= +// function : GetUtf8 +// purpose : +// ======================================================================= +template +inline Standard_Utf8Char* NCollection_UtfIterator::GetUtf8(Standard_Utf8Char* theBuffer) const +{ + // unsigned arithmetic used + return (Standard_Utf8Char*)GetUtf8((Standard_Utf8UChar*)theBuffer); +} + +// ======================================================================= +// function : GetUtf8 +// purpose : +// ======================================================================= +template +inline Standard_Utf8UChar* NCollection_UtfIterator::GetUtf8( + Standard_Utf8UChar* theBuffer) const +{ + Standard_Utf32Char aChar = myCharUtf32; + if (myCharUtf32 >= UTF16_SURROGATE_HIGH_START && myCharUtf32 <= UTF16_SURROGATE_LOW_END) + { + // UTF-16 surrogate values are illegal in UTF-32 + return theBuffer; + } + else if (myCharUtf32 < Standard_Utf32Char(0x80)) + { + *theBuffer++ = Standard_Utf8UChar(aChar | UTF8_FIRST_BYTE_MARK[1]); + return theBuffer; + } + else if (myCharUtf32 < Standard_Utf32Char(0x800)) + { + *++theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar(aChar | UTF8_FIRST_BYTE_MARK[2]); + return theBuffer + 2; + } + else if (myCharUtf32 < Standard_Utf32Char(0x10000)) + { + theBuffer += 3; + *--theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar(aChar | UTF8_FIRST_BYTE_MARK[3]); + return theBuffer + 3; + } + else if (myCharUtf32 <= UTF32_MAX_LEGAL) + { + theBuffer += 4; + *--theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar((aChar | UTF8_BYTE_MARK) & UTF8_BYTE_MASK); + aChar >>= 6; + *--theBuffer = Standard_Utf8UChar(aChar | UTF8_FIRST_BYTE_MARK[4]); + return theBuffer + 4; + } + else + { + // illegal + return theBuffer; + } +} + +// ======================================================================= +// function : AdvanceBytesUtf16 +// purpose : +// ======================================================================= +template +inline Standard_Integer NCollection_UtfIterator::AdvanceBytesUtf16() const +{ + return AdvanceCodeUnitsUtf16() * sizeof(Standard_Utf16Char); +} + +// ======================================================================= +// function : AdvanceCodeUnitsUtf16 +// purpose : +// ======================================================================= +template +inline Standard_Integer NCollection_UtfIterator::AdvanceCodeUnitsUtf16() const +{ + if (myCharUtf32 <= UTF32_MAX_BMP) // target is a character <= 0xFFFF + { + // UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values + if (myCharUtf32 >= UTF16_SURROGATE_HIGH_START && myCharUtf32 <= UTF16_SURROGATE_LOW_END) + { + return 0; + } + else + { + return 1; + } + } + else if (myCharUtf32 > UTF32_MAX_LEGAL) + { + // illegal + return 0; + } + else + { + // target is a character in range 0xFFFF - 0x10FFFF + // surrogate pair + return 2; + } +} + +// ======================================================================= +// function : GetUtf16 +// purpose : +// ======================================================================= +template +inline Standard_Utf16Char* NCollection_UtfIterator::GetUtf16( + Standard_Utf16Char* theBuffer) const +{ + if (myCharUtf32 <= UTF32_MAX_BMP) // target is a character <= 0xFFFF + { + // UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values + if (myCharUtf32 >= UTF16_SURROGATE_HIGH_START && myCharUtf32 <= UTF16_SURROGATE_LOW_END) + { + return theBuffer; + } + else + { + *theBuffer++ = Standard_Utf16Char(myCharUtf32); + return theBuffer; + } + } + else if (myCharUtf32 > UTF32_MAX_LEGAL) + { + // illegal + return theBuffer; + } + else + { + // surrogate pair + Standard_Utf32Char aChar = myCharUtf32 - UTF16_SURROGATE_LOW_BASE; + *theBuffer++ = + Standard_Utf16Char((aChar >> UTF16_SURROGATE_HIGH_SHIFT) + UTF16_SURROGATE_HIGH_START); + *theBuffer++ = + Standard_Utf16Char((aChar & UTF16_SURROGATE_LOW_MASK) + UTF16_SURROGATE_LOW_START); + return theBuffer; + } +} + +// ======================================================================= +// function : GetUtf32 +// purpose : +// ======================================================================= +template +inline Standard_Utf32Char* NCollection_UtfIterator::GetUtf32( + Standard_Utf32Char* theBuffer) const +{ + *theBuffer++ = myCharUtf32; + return theBuffer; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/NLPlate_NLPlate.hxx b/data/miniconda3/envs/catiagent/include/opencascade/NLPlate_NLPlate.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6ee2198b7c4b6883cfbb42ef98407220bd5e5814 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/NLPlate_NLPlate.hxx @@ -0,0 +1,87 @@ +// Created on: 1998-04-09 +// Created by: Andre LIEUTIER +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _NLPlate_NLPlate_HeaderFile +#define _NLPlate_NLPlate_HeaderFile + +#include +#include +#include + +#include +#include +#include +class Geom_Surface; +class NLPlate_HGPPConstraint; +class gp_XYZ; +class gp_XY; + +class NLPlate_NLPlate +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT NLPlate_NLPlate(const Handle(Geom_Surface)& InitialSurface); + + Standard_EXPORT void Load(const Handle(NLPlate_HGPPConstraint)& GConst); + + Standard_EXPORT void Solve(const Standard_Integer ord = 2, + const Standard_Integer InitialConsraintOrder = 1); + + Standard_EXPORT void Solve2(const Standard_Integer ord = 2, + const Standard_Integer InitialConsraintOrder = 1); + + Standard_EXPORT void IncrementalSolve(const Standard_Integer ord = 2, + const Standard_Integer InitialConsraintOrder = 1, + const Standard_Integer NbIncrements = 4, + const Standard_Boolean UVSliding = Standard_False); + + //! returns True if all has been correctly done. + Standard_EXPORT Standard_Boolean IsDone() const; + + Standard_EXPORT void destroy(); + + ~NLPlate_NLPlate() { destroy(); } + + //! reset the Plate in the initial state + //! ( same as after Create((Surface)) + Standard_EXPORT void Init(); + + Standard_EXPORT gp_XYZ Evaluate(const gp_XY& point2d) const; + + Standard_EXPORT gp_XYZ EvaluateDerivative(const gp_XY& point2d, + const Standard_Integer iu, + const Standard_Integer iv) const; + + Standard_EXPORT Standard_Integer Continuity() const; + + Standard_EXPORT void ConstraintsSliding(const Standard_Integer NbIterations = 3); + + Standard_EXPORT Standard_Integer MaxActiveConstraintOrder() const; + +protected: +private: + Standard_EXPORT Standard_Boolean Iterate(const Standard_Integer ConstraintOrder, + const Standard_Integer ResolutionOrder, + const Standard_Real IncrementalLoading = 1.0); + + Handle(Geom_Surface) myInitialSurface; + NLPlate_SequenceOfHGPPConstraint myHGPPConstraints; + NLPlate_StackOfPlate mySOP; + Standard_Boolean OK; +}; + +#endif // _NLPlate_NLPlate_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OSD.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OSD.hxx new file mode 100644 index 0000000000000000000000000000000000000000..dcd8781c12bbaa4f7b4d81f577d9fb4e333d52be --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OSD.hxx @@ -0,0 +1,147 @@ +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _OSD_HeaderFile +#define _OSD_HeaderFile + +#include +#include +#include + +//! Set of Operating System Dependent (OSD) tools. +class OSD +{ +public: + DEFINE_STANDARD_ALLOC + + //! Sets or removes signal and FPE (floating-point exception) handlers. + //! OCCT signal handlers translate signals raised by C subsystem to C++ + //! exceptions inheriting Standard_Failure. + //! + //! ### Windows-specific notes + //! + //! Compiled with MS VC++ sets 3 main handlers: + //! @li Signal handlers (via ::signal() functions) that translate system signals + //! (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting + //! Standard_Failure). They only be called if function ::raise() is called + //! with one of supported signal type set. + //! @li Exception handler OSD::WntHandler() (via ::SetUnhandledExceptionFilter()) + //! that will be used when user's code is compiled with /EHs option. + //! @li Structured exception (SE) translator (via _set_se_translator()) that + //! translates SE exceptions (aka asynchronous exceptions) into the + //! C++ exceptions inheriting Standard_Failure. This translator will be + //! used when user's code is compiled with /EHa option. + //! + //! This approach ensures that regardless of the option the user chooses to + //! compile his code with (/EHs or /EHa), signals (or SE exceptions) will be + //! translated into Open CASCADE C++ exceptions. + //! + //! MinGW should use SEH exception mode for signal handling to work. + //! + //! ### Linux-specific notes + //! + //! OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals + //! (SIGFPE, SIGSEGV, etc). + //! + //! ### Common notes + //! + //! If @a theFloatingSignal is TRUE then floating point exceptions will + //! generate SIGFPE in accordance with the mask + //! - Windows: _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW, + //! see _controlfp() system function. + //! - Linux: FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW, + //! see feenableexcept() system function. + //! + //! If @a theFloatingSignal is FALSE then floating point calculations will gracefully + //! complete regardless of occurred exceptions (e.g. division by zero). + //! Otherwise the (thread-specific) FPE flags are set to raise signal if one of + //! floating-point exceptions (division by zero, overflow, or invalid operation) occurs. + //! + //! The recommended approach is to call OSD::SetSignal() in the beginning of the + //! execution of the program, in function main() or its equivalent. + //! In multithreaded programs it is advisable to call OSD::SetSignal() or + //! OSD::SetThreadLocalSignal() with the same parameters in other threads where + //! OCCT is used, to ensure consistency of behavior. + //! + //! Note that in order to handle signals as C++ exceptions on Linux and under + //! MinGW on Windows it is necessary to compile both OCCT and application with + //! OCC_CONVERT_SIGNALS macro, and use macro OCC_CATCH_SIGNALS within each try{} + //! block that has to catch this kind of exceptions. + //! + //! Refer to documentation of Standard_ErrorHandler.hxx for details. + Standard_EXPORT static void SetSignal(OSD_SignalMode theSignalMode, + Standard_Boolean theFloatingSignal); + + //! Sets signal and FPE handlers. + //! Short-cut for OSD::SetSignal (OSD_SignalMode_Set, theFloatingSignal). + static void SetSignal(const Standard_Boolean theFloatingSignal = Standard_True) + { + SetSignal(OSD_SignalMode_Set, theFloatingSignal); + } + + //! Initializes thread-local signal handlers. + //! This includes _set_se_translator() on Windows platform, and SetFloatingSignal(). + //! The main purpose of this method is initializing handlers for newly created threads + //! without overriding global handlers (set by application or by OSD::SetSignal()). + Standard_EXPORT static void SetThreadLocalSignal(OSD_SignalMode theSignalMode, + Standard_Boolean theFloatingSignal); + + //! Enables / disables generation of C signal on floating point exceptions (FPE). + //! This call does NOT register a handler for signal raised in case of FPE - + //! SetSignal() should be called beforehand for complete setup. + //! Note that FPE setting is thread-local, new threads inherit it from parent. + Standard_EXPORT static void SetFloatingSignal(Standard_Boolean theFloatingSignal); + + //! Returns signal mode set by the last call to SetSignal(). + //! By default, returns OSD_SignalMode_AsIs. + Standard_EXPORT static OSD_SignalMode SignalMode(); + + //! Returns true if floating point exceptions will raise C signal + //! according to current (platform-dependent) settings in this thread. + Standard_EXPORT static Standard_Boolean ToCatchFloatingSignals(); + + //! Commands the process to sleep for a number of seconds. + Standard_EXPORT static void SecSleep(const Standard_Integer theSeconds); + + //! Commands the process to sleep for a number of milliseconds + Standard_EXPORT static void MilliSecSleep(const Standard_Integer theMilliseconds); + + //! Converts aReal into aCstring in exponential format with a period as decimal point, + //! no thousand separator and no grouping of digits. + //! The conversion is independent from the current locale + Standard_EXPORT static Standard_Boolean RealToCString(const Standard_Real aReal, + Standard_PCharacter& aString); + + //! Converts aCstring representing a real with a period as decimal point, + //! no thousand separator and no grouping of digits into aReal. + //! + //! The conversion is independent from the current locale. + Standard_EXPORT static Standard_Boolean CStringToReal(const Standard_CString aString, + Standard_Real& aReal); + + //! since Windows NT does not support 'SIGINT' signal like UNIX, + //! then this method checks whether Ctrl-Break keystroke was or + //! not. If yes then raises Exception_CTRL_BREAK. + Standard_EXPORT static void ControlBreak(); + + //! Returns a length of stack trace to be put into exception redirected from signal; + //! 0 by default meaning no stack trace. + //! @sa Standard_Failure::GetStackString() + Standard_EXPORT static Standard_Integer SignalStackTraceLength(); + + //! Sets a length of stack trace to be put into exception redirected from signal. + Standard_EXPORT static void SetSignalStackTraceLength(Standard_Integer theLength); +}; + +#endif // _OSD_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OSD_Directory.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OSD_Directory.hxx new file mode 100644 index 0000000000000000000000000000000000000000..02616edb4d5679c14ef6dbc89a619f2e8a97c8dd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OSD_Directory.hxx @@ -0,0 +1,47 @@ +// Created on: 1992-05-18 +// Created by: Stephan GARNAUD (ARM) +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _OSD_Directory_HeaderFile +#define _OSD_Directory_HeaderFile + +#include + +//! Management of directories (a set of directory oriented tools) +class OSD_Directory : public OSD_FileNode +{ +public: + //! Creates a temporary Directory in current directory. + //! This directory is automatically removed when object dies. + Standard_EXPORT static OSD_Directory BuildTemporary(); + +public: + //! Creates Directory object. + //! It is initialized to an empty name. + Standard_EXPORT OSD_Directory(); + + //! Creates Directory object initialized with theName. + Standard_EXPORT OSD_Directory(const OSD_Path& theName); + + //! Creates (physically) a directory. + //! When a directory of the same name already exists, no error is + //! returned, and only is applied to the existing directory. + //! + //! If Build is used and is instantiated without a name, + //! OSDError is raised. + Standard_EXPORT void Build(const OSD_Protection& Protect); +}; + +#endif // _OSD_Directory_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OSD_Exception_PRIV_INSTRUCTION.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OSD_Exception_PRIV_INSTRUCTION.hxx new file mode 100644 index 0000000000000000000000000000000000000000..8ec71be2cbb1cc7f00eca33672700acccac3fb4e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OSD_Exception_PRIV_INSTRUCTION.hxx @@ -0,0 +1,36 @@ +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _OSD_Exception_PRIV_INSTRUCTION_HeaderFile +#define _OSD_Exception_PRIV_INSTRUCTION_HeaderFile + +#include +#include +#include +#include + +class OSD_Exception_PRIV_INSTRUCTION; +DEFINE_STANDARD_HANDLE(OSD_Exception_PRIV_INSTRUCTION, OSD_Exception) + +#if !defined No_Exception && !defined No_OSD_Exception_PRIV_INSTRUCTION + #define OSD_Exception_PRIV_INSTRUCTION_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw OSD_Exception_PRIV_INSTRUCTION(MESSAGE); +#else + #define OSD_Exception_PRIV_INSTRUCTION_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(OSD_Exception_PRIV_INSTRUCTION, OSD_Exception) + +#endif // _OSD_Exception_PRIV_INSTRUCTION_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OSD_PThread.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OSD_PThread.hxx new file mode 100644 index 0000000000000000000000000000000000000000..39b767298aa2f1bf3138c1469321a425bbd05fc4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OSD_PThread.hxx @@ -0,0 +1,33 @@ +// Created on: 2006-03-10 +// Created by: data exchange team +// Copyright (c) 2006-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef OSD_PThread_HeaderFile +#define OSD_PThread_HeaderFile + +// Platform-dependent definition of the thread handle type + +#ifdef _WIN32 + + #include +typedef HANDLE OSD_PThread; + +#else + + #include +typedef pthread_t OSD_PThread; + +#endif + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OSD_PerfMeter.h b/data/miniconda3/envs/catiagent/include/opencascade/OSD_PerfMeter.h new file mode 100644 index 0000000000000000000000000000000000000000..263c29cb907ba817f57d610c2aa409d88bc3c704 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OSD_PerfMeter.h @@ -0,0 +1,182 @@ +/* + Copyright (c) 1999-2014 OPEN CASCADE SAS + + This file is part of Open CASCADE Technology software library. + + This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License version 2.1 as published + by the Free Software Foundation, with special exception defined in the file + OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT + distribution for complete text of the license and disclaimer of any warranty. + + Alternatively, this file may be used under the terms of Open CASCADE + commercial license or contractual agreement. +*/ + +#ifndef _OSD_PERFMETER_H +#define _OSD_PERFMETER_H + +/** + * Macros for convenient and fast usage of meters. + * Define PERF_ENABLE_METERS to make them available. + */ +#ifdef PERF_ENABLE_METERS + + /** + * @def PERF_START_METER(theMeterName) + * Forces meter MeterName to begin to count by remembering the current data of timer. + * Creates new meter if there is no such meter. + */ + #define PERF_START_METER(_m_name) \ + { \ + static int __iMeter = -1; \ + if (__iMeter >= 0) \ + perf_start_imeter(__iMeter); \ + else \ + __iMeter = perf_start_meter(_m_name); \ + } + + /** + * @def PERF_STOP_METER(theMeterName) + * Forces meter MeterName to stop and cumulate the time elapsed since the start. + */ + #define PERF_STOP_METER(_m_name) \ + { \ + static int __iMeter = -1; \ + if (__iMeter >= 0) \ + perf_stop_imeter(__iMeter); \ + else \ + __iMeter = perf_stop_meter(_m_name); \ + } + + /** + * @def PERF_TICK_METER(theMeterName) + * Increments the counter of meter MeterName without changing its state with respect to + * measurement of time. Creates new meter if there is no such meter. It is useful to count the + * number of enters to a part of code without wasting a time to measure CPU time. + */ + #define PERF_TICK_METER(_m_name) \ + { \ + static int __iMeter = -1; \ + if (__iMeter >= 0) \ + perf_tick_imeter(__iMeter); \ + else \ + __iMeter = perf_tick_meter(_m_name); \ + } + + /** + * @def PERF_CLOSE_METER(theMeterName) + * Prints out and resets the given meter. + */ + #define PERF_CLOSE_METER(_m_name) perf_close_meter(_m_name); + + /** + * @def PERF_PRINT_ALL + * Prints all existing meters which have been entered at least once and resets them. + */ + #define PERF_PRINT_ALL() \ + { \ + perf_print_all_meters(1); \ + } + +#else + #define PERF_TICK_METER(_m_name) + #define PERF_START_METER(_m_name) + #define PERF_STOP_METER(_m_name) + #define PERF_CLOSE_METER(_m_name) + #define PERF_PRINT_ALL() +#endif + +/** + * Creates new counter (if it is absent) identified by theMeterName and resets its cumulative value + * @return meter global identifier if OK, -1 if alloc problem + */ +Standard_EXPORTEXTERNC int perf_init_meter(const char* const theMeterName); + +/** + * Forces meter theMeterName to begin to count by remembering the current data of timer. + * Creates new meter if there is no such meter. + * @return meter global identifier if OK, -1 if no such meter and cannot create a new one + */ +Standard_EXPORTEXTERNC int perf_start_meter(const char* const theMeterName); + +/** + * Forces meter with number theMeterId to begin count by remembering the current data of timer. + * @return meter global identifier if OK, -1 if no such meter + */ +Standard_EXPORTEXTERNC int perf_start_imeter(const int theMeterId); + +/** + * Forces meter theMeterName to stop and cumulate the time elapsed since the start. + * @return meter global identifier if OK, -1 if no such meter or it is has not been started + */ +Standard_EXPORTEXTERNC int perf_stop_meter(const char* const theMeterName); + +/** + * Forces meter with number theMeterId to stop and cumulate the time elapsed since the start. + * @return meter global identifier if OK, -1 if no such meter or it is has not been started + */ +Standard_EXPORTEXTERNC int perf_stop_imeter(const int theMeterId); + +/** + * Increments the counter of meter theMeterName without changing its state with respect to + * measurement of time. Creates new meter if there is no such meter. + * @return meter global identifier if OK, -1 if no such meter and cannot create a new one + */ +Standard_EXPORTEXTERNC int perf_tick_meter(const char* const theMeterName); + +/** + * Increments the counter of meter theMeterId without changing its state with respect to measurement + * of time. + * @return meter global identifier if OK, -1 if no such meter + */ +Standard_EXPORTEXTERNC int perf_tick_imeter(const int theMeterId); + +/** + * Tells the time cumulated by meter theMeterName and the number of enters to this meter. + * @param theNbEnter [OUT] number of enters if the pointer != NULL + * @param theSeconds [OUT] seconds if the pointer != NULL + * @return meter global identifier if OK, -1 if no such meter + */ +Standard_EXPORTEXTERNC int perf_get_meter(const char* const theMeterName, + int* theNbEnter, + double* theSeconds); + +/** + * Prints on stdout the cumulated time and the number of enters for the specified meter. + */ +Standard_EXPORTEXTERNC void perf_close_meter(const char* const theMeterName); + +/** + * Prints on stdout the cumulated time and the number of enters for the specified meter. + */ +Standard_EXPORTEXTERNC void perf_close_imeter(const int theMeterId); + +/** + * Prints on stdout the cumulated time and the number of enters for each alive meter which have the + * number of enters > 0. Resets all meters if reset is non-null. + */ +Standard_EXPORTEXTERNC void perf_print_all_meters(int reset); + +/** + * Prints to supplied string buffer the cumulated time and the number of enters + * for each alive meter with the number of enters > 0. + * If buffer length is not sufficient, data of some meters may be lost. + * It is recommended to reserve 256 bytes per meter, 25600 bytes should fit all. + * Resets all meters. + */ +Standard_EXPORTEXTERNC void perf_sprint_all_meters(char* buffer, int length, int reset); + +/** + * Deletes all meters and frees memory. + */ +Standard_EXPORTEXTERNC void perf_destroy_all_meters(void); + +/** + * ATTENTION!!! + * This func calls perf_print_all_meters() and perf_destroy_all_meters() + * and is called automatically at the end of a program via system call atexit(). + */ +Standard_EXPORTEXTERNC void perf_print_and_destroy(void); + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore43.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore43.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6625ae63760e245747205da50e57576125234446 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore43.hxx @@ -0,0 +1,73 @@ +// Created on: 2014-03-17 +// Created by: Kirill GAVRILOV +// Copyright (c) 2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef OpenGl_GlCore43_HeaderFile +#define OpenGl_GlCore43_HeaderFile + +#include + +//! OpenGL 4.3 definition. +struct OpenGl_GlCore43 : public OpenGl_GlCore42 +{ +private: + typedef OpenGl_GlCore42 theBaseClass_t; + +public: //! @name OpenGL 4.3 additives to 4.2 + using theBaseClass_t::glBindVertexBuffer; + using theBaseClass_t::glClearBufferData; + using theBaseClass_t::glClearBufferSubData; + using theBaseClass_t::glCopyImageSubData; + using theBaseClass_t::glDebugMessageCallback; + using theBaseClass_t::glDebugMessageControl; + using theBaseClass_t::glDebugMessageInsert; + using theBaseClass_t::glDispatchCompute; + using theBaseClass_t::glDispatchComputeIndirect; + using theBaseClass_t::glFramebufferParameteri; + using theBaseClass_t::glGetDebugMessageLog; + using theBaseClass_t::glGetFramebufferParameteriv; + using theBaseClass_t::glGetInternalformati64v; + using theBaseClass_t::glGetObjectLabel; + using theBaseClass_t::glGetObjectPtrLabel; + using theBaseClass_t::glGetProgramInterfaceiv; + using theBaseClass_t::glGetProgramResourceIndex; + using theBaseClass_t::glGetProgramResourceiv; + using theBaseClass_t::glGetProgramResourceLocation; + using theBaseClass_t::glGetProgramResourceLocationIndex; + using theBaseClass_t::glGetProgramResourceName; + using theBaseClass_t::glInvalidateBufferData; + using theBaseClass_t::glInvalidateBufferSubData; + using theBaseClass_t::glInvalidateFramebuffer; + using theBaseClass_t::glInvalidateSubFramebuffer; + using theBaseClass_t::glInvalidateTexImage; + using theBaseClass_t::glInvalidateTexSubImage; + using theBaseClass_t::glMultiDrawArraysIndirect; + using theBaseClass_t::glMultiDrawElementsIndirect; + using theBaseClass_t::glObjectLabel; + using theBaseClass_t::glObjectPtrLabel; + using theBaseClass_t::glPopDebugGroup; + using theBaseClass_t::glPushDebugGroup; + using theBaseClass_t::glShaderStorageBlockBinding; + using theBaseClass_t::glTexBufferRange; + using theBaseClass_t::glTexStorage2DMultisample; + using theBaseClass_t::glTexStorage3DMultisample; + using theBaseClass_t::glTextureView; + using theBaseClass_t::glVertexAttribBinding; + using theBaseClass_t::glVertexAttribFormat; + using theBaseClass_t::glVertexAttribIFormat; + using theBaseClass_t::glVertexAttribLFormat; + using theBaseClass_t::glVertexBindingDivisor; +}; + +#endif // _OpenGl_GlCore43_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore44.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore44.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a4eacccbe5f31bd3386c9d3d6e45d41866d0d80b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_GlCore44.hxx @@ -0,0 +1,39 @@ +// Created on: 2014-03-17 +// Created by: Kirill GAVRILOV +// Copyright (c) 2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef OpenGl_GlCore44_HeaderFile +#define OpenGl_GlCore44_HeaderFile + +#include + +//! OpenGL 4.4 definition. +struct OpenGl_GlCore44 : public OpenGl_GlCore43 +{ +private: + typedef OpenGl_GlCore43 theBaseClass_t; + +public: //! @name OpenGL 4.4 additives to 4.3 + using theBaseClass_t::glBindBuffersBase; + using theBaseClass_t::glBindBuffersRange; + using theBaseClass_t::glBindImageTextures; + using theBaseClass_t::glBindSamplers; + using theBaseClass_t::glBindTextures; + using theBaseClass_t::glBindVertexBuffers; + using theBaseClass_t::glBufferStorage; + using theBaseClass_t::glClearTexImage; + using theBaseClass_t::glClearTexSubImage; +}; + +#endif // _OpenGl_GlCore44_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_Sampler.hxx b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_Sampler.hxx new file mode 100644 index 0000000000000000000000000000000000000000..79e242a0acd21c841242b9f9e865cfd51e87112f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/OpenGl_Sampler.hxx @@ -0,0 +1,151 @@ +// Created on: 2014-10-08 +// Created by: Denis BOGOLEPOV +// Copyright (c) 2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _OpenGl_Sampler_Header +#define _OpenGl_Sampler_Header + +#include +#include + +class OpenGl_Texture; + +//! Class implements OpenGL sampler object resource that +//! stores the sampling parameters for a texture access. +class OpenGl_Sampler : public OpenGl_Resource +{ + friend class OpenGl_Context; + friend class OpenGl_Texture; + friend class OpenGl_Text; + DEFINE_STANDARD_RTTIEXT(OpenGl_Sampler, OpenGl_Resource) +public: + //! Helpful constant defining invalid sampler identifier + static const unsigned int NO_SAMPLER = 0; + +public: + //! Creates new sampler object. + Standard_EXPORT OpenGl_Sampler(const Handle(Graphic3d_TextureParams)& theParams); + + //! Releases resources of sampler object. + Standard_EXPORT virtual ~OpenGl_Sampler(); + + //! Destroys object - will release GPU memory if any. + Standard_EXPORT virtual void Release(OpenGl_Context* theContext) Standard_OVERRIDE; + + //! Returns estimated GPU memory usage - not implemented. + virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; } + + //! Creates an uninitialized sampler object. + Standard_EXPORT Standard_Boolean Create(const Handle(OpenGl_Context)& theContext); + + //! Creates and initializes sampler object. + //! Existing object will be reused if possible, however if existing Sampler Object has Immutable + //! flag and texture parameters should be re-initialized, then Sampler Object will be recreated. + Standard_EXPORT Standard_Boolean Init(const Handle(OpenGl_Context)& theContext, + const OpenGl_Texture& theTexture); + + //! Returns true if current object was initialized. + Standard_Boolean IsValid() const { return isValidSampler(); } + + //! Binds sampler object to texture unit specified in parameters. + void Bind(const Handle(OpenGl_Context)& theCtx) { Bind(theCtx, myParams->TextureUnit()); } + + //! Unbinds sampler object from texture unit specified in parameters. + void Unbind(const Handle(OpenGl_Context)& theCtx) { Unbind(theCtx, myParams->TextureUnit()); } + + //! Binds sampler object to the given texture unit. + Standard_EXPORT void Bind(const Handle(OpenGl_Context)& theCtx, + const Graphic3d_TextureUnit theUnit); + + //! Unbinds sampler object from the given texture unit. + Standard_EXPORT void Unbind(const Handle(OpenGl_Context)& theCtx, + const Graphic3d_TextureUnit theUnit); + + //! Sets specific sampler parameter. + void SetParameter(const Handle(OpenGl_Context)& theCtx, + unsigned int theTarget, + unsigned int theParam, + Standard_Integer theValue) + { + setParameter(theCtx, this, theTarget, theParam, theValue); + } + + //! Returns OpenGL sampler ID. + unsigned int SamplerID() const { return mySamplerID; } + + //! Return immutable flag preventing further modifications of sampler parameters, FALSE by + //! default. Immutable flag might be set when Sampler Object is used within Bindless Texture. + bool IsImmutable() const { return myIsImmutable; } + + //! Setup immutable flag. It is not possible unsetting this flag without Sampler destruction. + void SetImmutable() { myIsImmutable = true; } + + //! Returns texture parameters. + const Handle(Graphic3d_TextureParams)& Parameters() { return myParams; } + + //! Sets texture parameters. + Standard_EXPORT void SetParameters(const Handle(Graphic3d_TextureParams)& theParams); + + //! Returns texture parameters initialization state. + bool ToUpdateParameters() const { return mySamplerRevision != myParams->SamplerRevision(); } + +protected: + //! Checks if sampler object is valid. + Standard_Boolean isValidSampler() const { return mySamplerID != NO_SAMPLER; } + + //! Sets specific sampler parameter. + Standard_EXPORT static void setParameter(const Handle(OpenGl_Context)& theContext, + OpenGl_Sampler* theSampler, + unsigned int theTarget, + unsigned int theParam, + Standard_Integer theValue); + + //! Apply sampler parameters. + //! @param[in] theCtx active OpenGL context + //! @param[in] theParams texture parameters to apply + //! @param[in] theSampler apply parameters to Texture object (NULL) + //! or to specified Sampler object (non-NULL, sampler is not required to be + //! bound) + //! @param[in] theTarget OpenGL texture target + //! @param[in] theMaxMipLevel maximum mipmap level defined within the texture + Standard_EXPORT static void applySamplerParams(const Handle(OpenGl_Context)& theCtx, + const Handle(Graphic3d_TextureParams)& theParams, + OpenGl_Sampler* theSampler, + const unsigned int theTarget, + const Standard_Integer theMaxMipLevel); + + //! Apply global texture state for deprecated OpenGL functionality. + Standard_EXPORT static void applyGlobalTextureParams( + const Handle(OpenGl_Context)& theCtx, + const OpenGl_Texture& theTexture, + const Handle(Graphic3d_TextureParams)& theParams); + + //! Reset global texture state for deprecated OpenGL functionality. + Standard_EXPORT static void resetGlobalTextureParams( + const Handle(OpenGl_Context)& theCtx, + const OpenGl_Texture& theTexture, + const Handle(Graphic3d_TextureParams)& theParams); + +protected: + Handle(Graphic3d_TextureParams) myParams; //!< texture parameters + // clang-format off + unsigned int mySamplerRevision; //!< modification counter of parameters related to sampler state + unsigned int mySamplerID; //!< OpenGL sampler object ID + bool myIsImmutable; //!< immutable flag preventing further modifications of sampler parameters, FALSE by default + // clang-format on +}; + +DEFINE_STANDARD_HANDLE(OpenGl_Sampler, OpenGl_Resource) + +#endif // _OpenGl_Sampler_Header diff --git a/data/miniconda3/envs/catiagent/include/opencascade/PCDM.hxx b/data/miniconda3/envs/catiagent/include/opencascade/PCDM.hxx new file mode 100644 index 0000000000000000000000000000000000000000..dce4a5cf715efd8622cd7820f5a443086d732d33 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/PCDM.hxx @@ -0,0 +1,39 @@ +// Created on: 1997-08-01 +// Created by: Jean-Louis Frenkel +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _PCDM_HeaderFile +#define _PCDM_HeaderFile + +#include +#include + +class TCollection_AsciiString; + +class PCDM +{ +public: + Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType( + const TCollection_AsciiString& aFileName, + Handle(Storage_BaseDriver)& aBaseDriver); + + Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType( + Standard_IStream& theIStream, + Handle(Storage_BaseDriver)& theBaseDriver); + + DEFINE_STANDARD_ALLOC +}; + +#endif // _PCDM_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/PCDM_Reader.hxx b/data/miniconda3/envs/catiagent/include/opencascade/PCDM_Reader.hxx new file mode 100644 index 0000000000000000000000000000000000000000..883dcaf4ef88476598dfb3741e1827ba6c7f1fc7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/PCDM_Reader.hxx @@ -0,0 +1,69 @@ +// Created on: 1997-12-18 +// Created by: Jean-Louis Frenkel +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _PCDM_Reader_HeaderFile +#define _PCDM_Reader_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include + +class CDM_Document; +class TCollection_ExtendedString; +class CDM_Application; +class PCDM_ReaderFilter; + +class PCDM_Reader; +DEFINE_STANDARD_HANDLE(PCDM_Reader, Standard_Transient) + +class PCDM_Reader : public Standard_Transient +{ + +public: + //! retrieves the content of the file into a new Document. + Standard_EXPORT virtual void Read( + const TCollection_ExtendedString& aFileName, + const Handle(CDM_Document)& aNewDocument, + const Handle(CDM_Application)& anApplication, + const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(), + const Message_ProgressRange& theProgress = Message_ProgressRange()) = 0; + + Standard_EXPORT virtual void Read( + Standard_IStream& theIStream, + const Handle(Storage_Data)& theStorageData, + const Handle(CDM_Document)& theDoc, + const Handle(CDM_Application)& theApplication, + const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(), + const Message_ProgressRange& theProgress = Message_ProgressRange()) = 0; + + PCDM_ReaderStatus GetStatus() const; + + DEFINE_STANDARD_RTTIEXT(PCDM_Reader, Standard_Transient) + +protected: + PCDM_ReaderStatus myReaderStatus; + +private: +}; + +#include + +#endif // _PCDM_Reader_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Plate_GtoCConstraint.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Plate_GtoCConstraint.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6e81d66a046e3ee8d5b0e2a2ae86229755dfdf2b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Plate_GtoCConstraint.hxx @@ -0,0 +1,94 @@ +// Created on: 1995-10-19 +// Created by: Andre LIEUTIER +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Plate_GtoCConstraint_HeaderFile +#define _Plate_GtoCConstraint_HeaderFile + +#include +#include + +#include +#include +#include +#include +class gp_XYZ; +class Plate_D2; +class Plate_D3; + +//! define a G1, G2 or G3 constraint on the Plate +class Plate_GtoCConstraint +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Plate_GtoCConstraint(const Plate_GtoCConstraint& ref); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T, + const gp_XYZ& nP); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T, + const Plate_D2& D2S, + const Plate_D2& D2T); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T, + const Plate_D2& D2S, + const Plate_D2& D2T, + const gp_XYZ& nP); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T, + const Plate_D2& D2S, + const Plate_D2& D2T, + const Plate_D3& D3S, + const Plate_D3& D3T); + + Standard_EXPORT Plate_GtoCConstraint(const gp_XY& point2d, + const Plate_D1& D1S, + const Plate_D1& D1T, + const Plate_D2& D2S, + const Plate_D2& D2T, + const Plate_D3& D3S, + const Plate_D3& D3T, + const gp_XYZ& nP); + + const Standard_Integer& nb_PPC() const; + + const Plate_PinpointConstraint& GetPPC(const Standard_Integer Index) const; + + const Plate_D1& D1SurfInit() const; + +protected: +private: + Plate_PinpointConstraint myPPC[9]; + Plate_D1 myD1SurfInit; + gp_XY pnt2d; + Standard_Integer nb_PPConstraints; +}; + +#include + +#endif // _Plate_GtoCConstraint_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Poly_Array1OfTriangle.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Poly_Array1OfTriangle.hxx new file mode 100644 index 0000000000000000000000000000000000000000..afb1562ac815df3153dca8ff37577368d1fcecf5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Poly_Array1OfTriangle.hxx @@ -0,0 +1,25 @@ +// Created on: 1995-03-06 +// Created by: Laurent PAINNOT +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Poly_Array1OfTriangle_HeaderFile +#define Poly_Array1OfTriangle_HeaderFile + +#include +#include + +typedef NCollection_Array1 Poly_Array1OfTriangle; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Poly_Triangle.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Poly_Triangle.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a0e3efe0ea34688be9f63945e9cbfcc558e8b062 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Poly_Triangle.hxx @@ -0,0 +1,101 @@ +// Created on: 1995-03-06 +// Created by: Laurent PAINNOT +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Poly_Triangle_HeaderFile +#define _Poly_Triangle_HeaderFile + +#include +#include +#include +#include +#include + +//! Describes a component triangle of a triangulation (Poly_Triangulation object). +//! A Triangle is defined by a triplet of nodes within [1, Poly_Triangulation::NbNodes()] range. +//! Each node is an index in the table of nodes specific to an existing +//! triangulation of a shape, and represents a point on the surface. +class Poly_Triangle +{ +public: + DEFINE_STANDARD_ALLOC + + //! Constructs a triangle and sets all indices to zero. + Poly_Triangle() { myNodes[0] = myNodes[1] = myNodes[2] = 0; } + + //! Constructs a triangle and sets its three indices, + //! where these node values are indices in the table of nodes specific to an existing + //! triangulation of a shape. + Poly_Triangle(const Standard_Integer theN1, + const Standard_Integer theN2, + const Standard_Integer theN3) + { + myNodes[0] = theN1; + myNodes[1] = theN2; + myNodes[2] = theN3; + } + + //! Sets the value of the three nodes of this triangle. + void Set(const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3) + { + myNodes[0] = theN1; + myNodes[1] = theN2; + myNodes[2] = theN3; + } + + //! Sets the value of node with specified index of this triangle. + //! Raises Standard_OutOfRange if index is not in 1,2,3 + void Set(const Standard_Integer theIndex, const Standard_Integer theNode) + { + Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, + "Poly_Triangle::Set(), invalid index"); + myNodes[theIndex - 1] = theNode; + } + + //! Returns the node indices of this triangle. + void Get(Standard_Integer& theN1, Standard_Integer& theN2, Standard_Integer& theN3) const + { + theN1 = myNodes[0]; + theN2 = myNodes[1]; + theN3 = myNodes[2]; + } + + //! Get the node of given Index. + //! Raises OutOfRange from Standard if Index is not in 1,2,3 + Standard_Integer Value(const Standard_Integer theIndex) const + { + Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, + "Poly_Triangle::Value(), invalid index"); + return myNodes[theIndex - 1]; + } + + Standard_Integer operator()(const Standard_Integer Index) const { return Value(Index); } + + //! Get the node of given Index. + //! Raises OutOfRange if Index is not in 1,2,3 + Standard_Integer& ChangeValue(const Standard_Integer theIndex) + { + Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, + "Poly_Triangle::ChangeValue(), invalid index"); + return myNodes[theIndex - 1]; + } + + Standard_Integer& operator()(const Standard_Integer Index) { return ChangeValue(Index); } + +protected: + Standard_Integer myNodes[3]; +}; + +#endif // _Poly_Triangle_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ProjLib_PrjResolve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ProjLib_PrjResolve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..56e6d7159d1c14736f4116c19ec77a55fc3ab614 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ProjLib_PrjResolve.hxx @@ -0,0 +1,64 @@ +// Created on: 1997-11-06 +// Created by: Roman BORISOV +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ProjLib_PrjResolve_HeaderFile +#define _ProjLib_PrjResolve_HeaderFile + +#include +#include + +#include + +class Adaptor3d_Curve; +class Adaptor3d_Surface; + +class ProjLib_PrjResolve +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT ProjLib_PrjResolve(const Adaptor3d_Curve& C, + const Adaptor3d_Surface& S, + const Standard_Integer Fix); + + //! Calculates the ort from C(t) to S with a close point. + //! The close point is defined by the parameter values U0 and V0. + //! The function F(u,v)=distance(S(u,v),C(t)) has an extremum when gradient(F)=0. + //! The algorithm searches a zero near the close point. + Standard_EXPORT void Perform(const Standard_Real t, + const Standard_Real U, + const Standard_Real V, + const gp_Pnt2d& Tol, + const gp_Pnt2d& Inf, + const gp_Pnt2d& Sup, + const Standard_Real FTol = -1, + const Standard_Boolean StrictInside = Standard_False); + + //! Returns True if the distance is found. + Standard_EXPORT Standard_Boolean IsDone() const; + + //! Returns the point of the extremum distance. + Standard_EXPORT gp_Pnt2d Solution() const; + +private: + const Adaptor3d_Curve* myCurve; + const Adaptor3d_Surface* mySurface; + Standard_Boolean myDone; + gp_Pnt2d mySolution; + Standard_Integer myFix; +}; + +#endif // _ProjLib_PrjResolve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Resource_DataMapOfAsciiStringExtendedString.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Resource_DataMapOfAsciiStringExtendedString.hxx new file mode 100644 index 0000000000000000000000000000000000000000..954c7e9eaf93031376e824ff8679878cd0321eb2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Resource_DataMapOfAsciiStringExtendedString.hxx @@ -0,0 +1,29 @@ +// Created on: 1995-04-20 +// Created by: Tony GEORGIADES +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Resource_DataMapOfAsciiStringExtendedString_HeaderFile +#define Resource_DataMapOfAsciiStringExtendedString_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap + Resource_DataMapOfAsciiStringExtendedString; +typedef NCollection_DataMap::Iterator + Resource_DataMapIteratorOfDataMapOfAsciiStringExtendedString; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_DataMapOfLabelExternFile.hxx b/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_DataMapOfLabelExternFile.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4fe98c0158a181e53f3742d58e42917c53a45555 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_DataMapOfLabelExternFile.hxx @@ -0,0 +1,28 @@ +// Created on: 2000-04-09 +// Created by: Sergey MOZOKHIN +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef STEPCAFControl_DataMapOfLabelExternFile_HeaderFile +#define STEPCAFControl_DataMapOfLabelExternFile_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap + STEPCAFControl_DataMapOfLabelExternFile; +typedef NCollection_DataMap::Iterator + STEPCAFControl_DataMapIteratorOfDataMapOfLabelExternFile; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_GDTProperty.hxx b/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_GDTProperty.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e7c63335e1723f75db601b2cc1975b2f324c30f8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/STEPCAFControl_GDTProperty.hxx @@ -0,0 +1,125 @@ +// Created on: 2015-09-10 +// Created by: Irina Krylova +// Copyright (c) 1999-2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _STEPCAFControl_GDTProperty_HeaderFile +#define _STEPCAFControl_GDTProperty_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//! This class provides tools for access (read) +//! the GDT properties. +class STEPCAFControl_GDTProperty +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT STEPCAFControl_GDTProperty(); + Standard_EXPORT static void GetDimModifiers( + const Handle(StepRepr_CompoundRepresentationItem)& theCRI, + XCAFDimTolObjects_DimensionModifiersSequence& theModifiers); + + Standard_EXPORT static void GetDimClassOfTolerance(const Handle(StepShape_LimitsAndFits)& theLAF, + Standard_Boolean& theHolle, + XCAFDimTolObjects_DimensionFormVariance& theFV, + XCAFDimTolObjects_DimensionGrade& theG); + + Standard_EXPORT static Standard_Boolean GetDimType( + const Handle(TCollection_HAsciiString)& theName, + XCAFDimTolObjects_DimensionType& theType); + + Standard_EXPORT static Standard_Boolean GetDatumTargetType( + const Handle(TCollection_HAsciiString)& theDescription, + XCAFDimTolObjects_DatumTargetType& theType); + + Standard_EXPORT static Standard_Boolean GetDimQualifierType( + const Handle(TCollection_HAsciiString)& theDescription, + XCAFDimTolObjects_DimensionQualifier& theType); + + Standard_EXPORT static Standard_Boolean GetTolValueType( + const Handle(TCollection_HAsciiString)& theDescription, + XCAFDimTolObjects_GeomToleranceTypeValue& theType); + + Standard_EXPORT static Handle(TCollection_HAsciiString) GetTolValueType( + const XCAFDimTolObjects_GeomToleranceTypeValue& theType); + + Standard_EXPORT static Handle(TCollection_HAsciiString) GetDimTypeName( + const XCAFDimTolObjects_DimensionType theType); + + Standard_EXPORT static Handle(TCollection_HAsciiString) GetDimQualifierName( + const XCAFDimTolObjects_DimensionQualifier theQualifier); + + Standard_EXPORT static Handle(TCollection_HAsciiString) GetDimModifierName( + const XCAFDimTolObjects_DimensionModif theModifier); + + Standard_EXPORT static Handle(StepShape_LimitsAndFits) GetLimitsAndFits( + Standard_Boolean theHole, + XCAFDimTolObjects_DimensionFormVariance theFormVariance, + XCAFDimTolObjects_DimensionGrade theGrade); + + Standard_EXPORT static Handle(TCollection_HAsciiString) GetDatumTargetName( + const XCAFDimTolObjects_DatumTargetType theDatumType); + + Standard_EXPORT static Standard_Boolean IsDimensionalLocation( + const XCAFDimTolObjects_DimensionType theType); + + Standard_EXPORT static Standard_Boolean IsDimensionalSize( + const XCAFDimTolObjects_DimensionType theType); + + Standard_EXPORT static StepDimTol_GeometricToleranceType GetGeomToleranceType( + const XCAFDimTolObjects_GeomToleranceType theType); + + Standard_EXPORT static XCAFDimTolObjects_GeomToleranceType GetGeomToleranceType( + const StepDimTol_GeometricToleranceType theType); + + Standard_EXPORT static Handle(StepDimTol_GeometricTolerance) GetGeomTolerance( + const XCAFDimTolObjects_GeomToleranceType theType); + + Standard_EXPORT static StepDimTol_GeometricToleranceModifier GetGeomToleranceModifier( + const XCAFDimTolObjects_GeomToleranceModif theModifier); + + Standard_EXPORT static Handle(StepDimTol_HArray1OfDatumReferenceModifier) GetDatumRefModifiers( + const XCAFDimTolObjects_DatumModifiersSequence& theModifiers, + const XCAFDimTolObjects_DatumModifWithValue& theModifWithVal, + const Standard_Real theValue, + const StepBasic_Unit& theUnit); + + Standard_EXPORT static Handle(StepVisual_TessellatedGeometricSet) GetTessellation( + const TopoDS_Shape& theShape); +}; + +#endif // _STEPCAFControl_GDTProperty_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Select3D_Pnt.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Select3D_Pnt.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3ea8a29298561e95b56fd1c272e6ec1587779add --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Select3D_Pnt.hxx @@ -0,0 +1,36 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Select3D_Pnt_HeaderFile +#define _Select3D_Pnt_HeaderFile + +#include + +struct Select3D_Pnt +{ + Standard_ShortReal x, y, z; + + operator gp_Pnt() const { return gp_Pnt(x, y, z); } + + operator gp_XYZ() const { return gp_XYZ(x, y, z); } + + gp_Pnt operator=(const gp_Pnt& thePnt) + { + x = RealToShortReal(thePnt.X()); + y = RealToShortReal(thePnt.Y()); + z = RealToShortReal(thePnt.Z()); + return *this; + } +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_AxisIntersector.hxx b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_AxisIntersector.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b2ae0e118ff6b810ae459afd1eb29a2b23586176 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_AxisIntersector.hxx @@ -0,0 +1,225 @@ +// Copyright (c) 2021 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _SelectMgr_AxisIntersector_HeaderFile +#define _SelectMgr_AxisIntersector_HeaderFile + +#include + +#include + +//! This class contains representation of selecting axis, created in case of point selection +//! and algorithms for overlap detection between this axis and sensitive entities. +class SelectMgr_AxisIntersector : public SelectMgr_BaseIntersector +{ +public: + //! Empty constructor + Standard_EXPORT SelectMgr_AxisIntersector(); + + //! Destructor + Standard_EXPORT virtual ~SelectMgr_AxisIntersector(); + + //! Initializes selecting axis according to the input one + Standard_EXPORT void Init(const gp_Ax1& theAxis); + + //! Builds axis according to internal parameters. + //! NOTE: it should be called after Init() method + Standard_EXPORT virtual void Build() Standard_OVERRIDE; + + //! Saves camera definition. + //! Do nothing for axis intersector (not applicable to this volume). + Standard_EXPORT virtual void SetCamera(const Handle(Graphic3d_Camera)& theCamera) + Standard_OVERRIDE; + + //! Returns FALSE (not applicable to this volume). + virtual Standard_Boolean IsScalable() const Standard_OVERRIDE { return false; } + + //! IMPORTANT: Scaling doesn't make sense for this intersector. + //! Returns a copy of the intersector transformed using the matrix given. + //! Builder is an optional argument that represents corresponding settings for re-constructing + //! transformed frustum from scratch. Can be null if reconstruction is not expected furthermore. + Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) ScaleAndTransform( + const Standard_Integer theScaleFactor, + const gp_GTrsf& theTrsf, + const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; + + //! Returns a copy of the intersector transformed using the builder configuration given. + //! Builder is an argument that represents corresponding settings for re-constructing transformed + //! frustum from scratch. In this class, builder is not used and theBuilder parameter is ignored. + Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder( + const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; + +public: + //! Intersection test between defined axis and given axis-aligned box + Standard_EXPORT virtual Standard_Boolean OverlapsBox(const SelectMgr_Vec3& theBoxMin, + const SelectMgr_Vec3& theBoxMax, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const + Standard_OVERRIDE; + + //! Returns true if selecting axis intersects axis-aligned bounding box + //! with minimum corner at point theMinPt and maximum at point theMaxPt + Standard_EXPORT virtual Standard_Boolean OverlapsBox(const SelectMgr_Vec3& theBoxMin, + const SelectMgr_Vec3& theBoxMax, + Standard_Boolean* theInside) const + Standard_OVERRIDE; + + //! Intersection test between defined axis and given point + Standard_EXPORT virtual Standard_Boolean OverlapsPoint( + const gp_Pnt& thePnt, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Intersection test between defined axis and given point + Standard_EXPORT virtual Standard_Boolean OverlapsPoint(const gp_Pnt& thePnt) const + Standard_OVERRIDE; + + //! Intersection test between defined axis and given ordered set of points, + //! representing line segments. The test may be considered of interior part or + //! boundary line defined by segments depending on given sensitivity type + Standard_EXPORT virtual Standard_Boolean OverlapsPolygon( + const TColgp_Array1OfPnt& theArrayOfPnts, + Select3D_TypeOfSensitivity theSensType, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Checks if selecting axis intersects line segment + Standard_EXPORT virtual Standard_Boolean OverlapsSegment( + const gp_Pnt& thePnt1, + const gp_Pnt& thePnt2, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Intersection test between defined axis and given triangle. The test may + //! be considered of interior part or boundary line defined by triangle vertices + //! depending on given sensitivity type + Standard_EXPORT virtual Standard_Boolean OverlapsTriangle( + const gp_Pnt& thePnt1, + const gp_Pnt& thePnt2, + const gp_Pnt& thePnt3, + Select3D_TypeOfSensitivity theSensType, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Intersection test between defined axis and given sphere with center theCenter + //! and radius theRadius + Standard_EXPORT virtual Standard_Boolean OverlapsSphere(const gp_Pnt& theCenter, + const Standard_Real theRadius, + Standard_Boolean* theInside = NULL) const + Standard_OVERRIDE; + + //! Intersection test between defined axis and given sphere with center theCenter + //! and radius theRadius + Standard_EXPORT virtual Standard_Boolean OverlapsSphere( + const gp_Pnt& theCenter, + const Standard_Real theRadius, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses + //! theBottomRad and theTopRad, height theHeight and transformation to apply theTrsf. + Standard_EXPORT virtual Standard_Boolean OverlapsCylinder( + const Standard_Real theBottomRad, + const Standard_Real theTopRad, + const Standard_Real theHeight, + const gp_Trsf& theTrsf, + const Standard_Boolean theIsHollow, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses + //! theBottomRad and theTopRad, height theHeight and transformation to apply theTrsf. + Standard_EXPORT virtual Standard_Boolean OverlapsCylinder( + const Standard_Real theBottomRad, + const Standard_Real theTopRad, + const Standard_Real theHeight, + const gp_Trsf& theTrsf, + const Standard_Boolean theIsHollow, + Standard_Boolean* theInside = NULL) const Standard_OVERRIDE; + + //! Returns true if selecting volume is overlapped by circle with radius theRadius, + //! boolean theIsFilled and transformation to apply theTrsf. + //! The position and orientation of the circle are specified + //! via theTrsf transformation for gp::XOY() with center in gp::Origin(). + Standard_EXPORT virtual Standard_Boolean OverlapsCircle( + const Standard_Real theRadius, + const gp_Trsf& theTrsf, + const Standard_Boolean theIsFilled, + const SelectMgr_ViewClipRange& theClipRange, + SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE; + + //! Returns true if selecting volume is overlapped by circle with radius theRadius, + //! boolean theIsFilled and transformation to apply theTrsf. + //! The position and orientation of the circle are specified + //! via theTrsf transformation for gp::XOY() with center in gp::Origin(). + Standard_EXPORT virtual Standard_Boolean OverlapsCircle(const Standard_Real theRadius, + const gp_Trsf& theTrsf, + const Standard_Boolean theIsFilled, + Standard_Boolean* theInside = NULL) const + Standard_OVERRIDE; + +public: + //! Measures distance between start axis point and given point theCOG. + Standard_EXPORT virtual Standard_Real DistToGeometryCenter(const gp_Pnt& theCOG) const + Standard_OVERRIDE; + + //! Calculates the point on a axis ray that was detected during the run of selection algo by given + //! depth + Standard_EXPORT virtual gp_Pnt DetectedPoint(const Standard_Real theDepth) const + Standard_OVERRIDE; + + //! Returns near point along axis. + Standard_EXPORT virtual const gp_Pnt& GetNearPnt() const Standard_OVERRIDE; + + //! Returns far point along axis (infinite). + Standard_EXPORT virtual const gp_Pnt& GetFarPnt() const Standard_OVERRIDE; + + //! Returns axis direction. + Standard_EXPORT virtual const gp_Dir& GetViewRayDirection() const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + +protected: + //! Returns true if selecting axis intersects axis-aligned bounding box + //! with minimum corner at point theBoxMin and maximum at point theBoxMax. + //! Also returns enter and leave time of axis-box intersection. + Standard_EXPORT Standard_Boolean hasIntersection(const SelectMgr_Vec3& theBoxMin, + const SelectMgr_Vec3& theBoxMax, + Standard_Real& theTimeEnter, + Standard_Real& theTimeLeave) const; + + //! Returns true if selecting axis intersects point. + //! Also returns time of axis-point intersection. + Standard_EXPORT Standard_Boolean hasIntersection(const gp_Pnt& thePnt, + Standard_Real& theDepth) const; + + //! Returns true if selecting axis intersects segment. + //! Also saves time of axis-segment intersection and intersection point as pick result. + Standard_EXPORT Standard_Boolean raySegmentDistance(const gp_Pnt& theSegPnt1, + const gp_Pnt& theSegPnt2, + SelectBasics_PickResult& thePickResult) const; + + //! Returns true if selecting axis intersects plane. + //! Also saves time of axis-plane intersection and intersection point as pick result. + Standard_EXPORT Standard_Boolean + rayPlaneIntersection(const gp_Vec& thePlane, + const gp_Pnt& thePntOnPlane, + SelectBasics_PickResult& thePickResult) const; + +private: + gp_Ax1 myAxis; +}; + +#endif // _SelectMgr_AxisIntersector_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_PickingStrategy.hxx b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_PickingStrategy.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2f0c155add4c8f6803e060bfa478062328eefed0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_PickingStrategy.hxx @@ -0,0 +1,27 @@ +// Copyright (c) 2017 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _SelectMgr_PickingStrategy_HeaderFile +#define _SelectMgr_PickingStrategy_HeaderFile + +//! Enumeration defines picking strategy - which entities detected by picking line will be accepted, +//! considering selection filters. +enum SelectMgr_PickingStrategy +{ + SelectMgr_PickingStrategy_FirstAcceptable, //!< the first detected entity passing selection filter + //!< is accepted (e.g. any) + SelectMgr_PickingStrategy_OnlyTopmost //!< only topmost detected entity passing selection filter + //!< is accepted +}; + +#endif // _SelectMgr_PickingStrategy_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_TypeOfUpdate.hxx b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_TypeOfUpdate.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1cfc46259de902a341ac7303808cdb1bb8eddbe4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/SelectMgr_TypeOfUpdate.hxx @@ -0,0 +1,31 @@ +// Created on: 1995-02-06 +// Created by: Mister rmi +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _SelectMgr_TypeOfUpdate_HeaderFile +#define _SelectMgr_TypeOfUpdate_HeaderFile + +//! Provides values for types of update, including +//! - full +//! - partial +//! - none. +enum SelectMgr_TypeOfUpdate +{ + SelectMgr_TOU_Full, + SelectMgr_TOU_Partial, + SelectMgr_TOU_None +}; + +#endif // _SelectMgr_TypeOfUpdate_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_HSequence.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_HSequence.hxx new file mode 100644 index 0000000000000000000000000000000000000000..dd517221e78a27836e89a81512e609a597beb94c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_HSequence.hxx @@ -0,0 +1,154 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapePersistent_HSequence_HeaderFile +#define _ShapePersistent_HSequence_HeaderFile + +#include + +#include +#include + +#include +#include +#include +#include + +class ShapePersistent_HSequence +{ + template + class node : public StdObjMgt_Persistent + { + public: + typedef typename SequenceClass::value_type ItemType; + + public: + //! Read persistent data from a file. + Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData); + + //! Write persistent data to a file. + Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const; + + //! Gets persistent objects + virtual void PChildren(SequenceOfPersistent& theChildren) const + { + theChildren.Append(this->myPreviuos); + theChildren.Append(this->myNext); + } + + //! Returns persistent type name + virtual Standard_CString PName() const + { + Standard_NotImplemented::Raise("ShapePersistent_HSequence::node::PName - not implemented"); + return ""; + } + + const Handle(node)& Previuos() const { return myPreviuos; } + + const Handle(node)& Next() const { return myNext; } + + const ItemType& Item() const { return myItem; } + + private: + Handle(node) myPreviuos; + Handle(node) myNext; + ItemType myItem; + }; + + template + class instance : public StdObjMgt_Persistent + { + public: + typedef node Node; + + public: + //! Empty constructor. + instance() + : mySize(0) + { + } + + //! Read persistent data from a file. + Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData); + + //! Write persistent data to a file. + Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const; + + //! Gets persistent objects + virtual void PChildren(SequenceOfPersistent& theChildren) const + { + theChildren.Append(this->myFirst); + theChildren.Append(this->myLast); + } + + //! Returns persistent type name + virtual Standard_CString PName() const + { + Standard_NotImplemented::Raise( + "ShapePersistent_HSequence::instance::PName - not implemented"); + return ""; + } + + //! Import transient object from the persistent data. + Standard_EXPORT Handle(SequenceClass) Import() const; + + private: + Handle(Node) myFirst; + Handle(Node) myLast; + Standard_Integer mySize; + }; + +public: + typedef instance XYZ; + typedef instance Pnt; + typedef instance Dir; + typedef instance Vec; +}; + +//======================================================================= +// XYZ +//======================================================================= +template <> +Standard_CString ShapePersistent_HSequence::instance::PName() const; + +template <> +Standard_CString ShapePersistent_HSequence::node::PName() const; + +//======================================================================= +// Pnt +//======================================================================= +template <> +Standard_CString ShapePersistent_HSequence::instance::PName() const; + +template <> +Standard_CString ShapePersistent_HSequence::node::PName() const; + +//======================================================================= +// Dir +//======================================================================= +template <> +Standard_CString ShapePersistent_HSequence::instance::PName() const; + +template <> +Standard_CString ShapePersistent_HSequence::node::PName() const; + +//======================================================================= +// Vec +//======================================================================= +template <> +Standard_CString ShapePersistent_HSequence::instance::PName() const; + +template <> +Standard_CString ShapePersistent_HSequence::node::PName() const; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_TopoDS.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_TopoDS.hxx new file mode 100644 index 0000000000000000000000000000000000000000..227c97085961b2124b9b9f0050b5b116565b8796 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapePersistent_TopoDS.hxx @@ -0,0 +1,166 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapePersistent_TopoDS_HeaderFile +#define _ShapePersistent_TopoDS_HeaderFile + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +class ShapePersistent_TopoDS : public StdPersistent_TopoDS +{ +public: + class HShape : public StdObjMgt_Persistent, public StdObject_Shape + { + public: + //! Read persistent data from a file. + Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData); + //! Write persistent data to a file + Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const; + //! Gets persistent child objects + Standard_EXPORT virtual void PChildren(SequenceOfPersistent& theChildren) const; + + //! Returns persistent type name + virtual Standard_CString PName() const { return "PTopoDS_HShape"; } + + private: + Handle(StdObjMgt_Persistent) myEntry; + }; + +protected: + class pTBase : public pTShape + { + public: + inline Handle(TopoDS_TShape) Import() const + { + Handle(TopoDS_TShape) aTShape = createTShape(); + + TopoDS_Shape aWrapperShape; + aWrapperShape.TShape(aTShape); + addShapes(aWrapperShape); + + setFlags(aTShape); + + return aTShape; + } + + private: + virtual Handle(TopoDS_TShape) createTShape() const = 0; + + virtual void addShapes(TopoDS_Shape& theParent) const = 0; + + void setFlags(const Handle(TopoDS_TShape)& theTShape) const; + + protected: + template + void addShapesT(TopoDS_Shape& theParent) const; + }; + +private: + template + class pTSimple : public pTBase + { + virtual Handle(TopoDS_TShape) createTShape() const; + + public: + inline Standard_CString PName() const; + }; + + template + class pTObject : public Persistent + { + virtual void addShapes(TopoDS_Shape& theParent) const + { + pTBase::addShapesT(theParent); + } + }; + + template + struct tObjectT : public Delayed, + pTObject> + { + typedef pTObject pTObjectT; + }; + +protected: + template + struct tObject : public tObjectT + { + }; + + template + struct tObject1 : public tObjectT + { + }; + +public: + typedef tObject> TWire; + typedef tObject> TShell; + typedef tObject> TSolid; + typedef tObject> TCompSolid; + typedef tObject> TCompound; + + typedef tObject1> TWire1; + typedef tObject1> TShell1; + typedef tObject1> TSolid1; + typedef tObject1> TCompSolid1; + typedef tObject1> TCompound1; + +public: + //! Create a persistent object for a shape + Standard_EXPORT static Handle(HShape) Translate(const TopoDS_Shape& theShape, + StdObjMgt_TransientPersistentMap& theMap, + ShapePersistent_TriangleMode theTriangleMode); +}; + +template <> +inline Standard_CString ShapePersistent_TopoDS::pTSimple::PName() const +{ + return "PTopoDS_TWire"; +} + +template <> +inline Standard_CString ShapePersistent_TopoDS::pTSimple::PName() const +{ + return "PTopoDS_TShell"; +} + +template <> +inline Standard_CString ShapePersistent_TopoDS::pTSimple::PName() const +{ + return "PTopoDS_TSolid"; +} + +template <> +inline Standard_CString ShapePersistent_TopoDS::pTSimple::PName() const +{ + return "PTopoDS_TCompSolid"; +} + +template <> +inline Standard_CString ShapePersistent_TopoDS::pTSimple::PName() const +{ + return "PTopoDS_TCompound"; +} + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9cc6ec6e086dfd5ad9b581ba2297a5ca34179e02 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess.hxx @@ -0,0 +1,123 @@ +// Created on: 2000-08-21 +// Created by: Andrey BETENEV +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapeProcess_HeaderFile +#define _ShapeProcess_HeaderFile + +#include +#include +#include +#include + +#include +#include + +class ShapeProcess_Operator; +class ShapeProcess_Context; + +//! Shape Processing module +//! allows to define and apply general Shape Processing as a +//! customizable sequence of Shape Healing operators. The +//! customization is implemented via user-editable resource +//! file which defines sequence of operators to be executed +//! and their parameters. +class ShapeProcess +{ +public: + DEFINE_STANDARD_ALLOC + + //! Describes all available operations. + //! C++11 enum class is not used to allow implicit conversion to underlying type. + enum Operation : uint8_t + { + First = 0, // First operation index. + DirectFaces = First, + SameParameter, + SetTolerance, + SplitAngle, + BSplineRestriction, + ElementaryToRevolution, + SweptToElementary, + SurfaceToBSpline, + ToBezier, + SplitContinuity, + SplitClosedFaces, + FixWireGaps, + FixFaceSize, + DropSmallSolids, + DropSmallEdges, + FixShape, + SplitClosedEdges, + SplitCommonVertex, + Last = SplitCommonVertex // Last operation index. + }; + + // Bitset of operations. It is used to specify which operations should be performed. + // For example, to perform DirectFaces and SameParameter operations, use: + // ShapeProcess::OperationsFlags flags; + // flags.set(ShapeProcess::Operation::DirectFaces); + // flags.set(ShapeProcess::Operation::SameParameter); + // ShapeProcess::Perform(context, flags); + using OperationsFlags = std::bitset; + +public: + //! Registers operator to make it visible for Performer + Standard_EXPORT static Standard_Boolean RegisterOperator(const Standard_CString name, + const Handle(ShapeProcess_Operator)& op); + + //! Finds operator by its name + Standard_EXPORT static Standard_Boolean FindOperator(const Standard_CString name, + Handle(ShapeProcess_Operator)& op); + + //! Performs a specified sequence of operators on Context + //! Resource file and other data should be already loaded + //! to Context (including description of sequence seq) + Standard_EXPORT static Standard_Boolean Perform( + const Handle(ShapeProcess_Context)& context, + const Standard_CString seq, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Performs a specified sequence of operators on @p theContext. + //! @param theContext Context to perform operations on. Contains the shape to process + //! and processing parameters. If processing parameters are not set, default values are + //! used. Parameters should be in a scope of operation, for example, instead of + //! "FromSTEP.FixShape.Tolerance3d" we should use just "FixShape.Tolerance3d". + //! @param theOperations Bitset of operations to perform. + //! @param theProgress Progress indicator. + //! @return true if at least one operation was performed, false otherwise. + Standard_EXPORT static Standard_Boolean Perform( + const Handle(ShapeProcess_Context)& theContext, + const OperationsFlags& theOperations, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Converts operation name to operation flag. + //! @param theName Operation name. + //! @return Operation flag and true if the operation name is valid, false otherwise. + Standard_EXPORT static std::pair ToOperationFlag(const char* theName); + +private: + //! Returns operators to be performed according to the specified flags. + //! @param theFlags Bitset of operations flags. + //! @return List of operators to perform: pairs of operator name and operator handle. + static std::vector> getOperators( + const OperationsFlags& theFlags); + + //! Converts operation flag to its name. + //! @param theOperation Operation flag. + //! @return Operation name. + static const char* toOperationName(const Operation theOperation); +}; + +#endif // _ShapeProcess_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess_OperLibrary.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess_OperLibrary.hxx new file mode 100644 index 0000000000000000000000000000000000000000..906ad41cdf9a48cf03831dcd7be7bf9ff287aa9a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapeProcess_OperLibrary.hxx @@ -0,0 +1,71 @@ +// Created on: 2000-08-31 +// Created by: Andrey BETENEV +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapeProcess_OperLibrary_HeaderFile +#define _ShapeProcess_OperLibrary_HeaderFile + +#include +#include +#include + +#include +class TopoDS_Shape; +class ShapeProcess_ShapeContext; +class BRepTools_Modification; +class ShapeExtend_MsgRegistrator; + +//! Provides a set of following operators +//! +//! DirectFaces +//! FixShape +//! SameParameter +//! SetTolerance +//! SplitAngle +//! BSplineRestriction +//! ElementaryToRevolution +//! SurfaceToBSpline +//! ToBezier +//! SplitContinuity +//! SplitClosedFaces +//! FixWireGaps +//! FixFaceSize +//! DropSmallEdges +//! FixShape +//! SplitClosedEdges +class ShapeProcess_OperLibrary +{ +public: + DEFINE_STANDARD_ALLOC + + //! Registers all the operators + Standard_EXPORT static void Init(); + + //! Applies BRepTools_Modification to a shape, + //! taking into account sharing of components of compounds. + //! if theMutableInput vat is set to true then input shape S + //! can be modified during the modification process. + Standard_EXPORT static TopoDS_Shape ApplyModifier( + const TopoDS_Shape& S, + const Handle(ShapeProcess_ShapeContext)& context, + const Handle(BRepTools_Modification)& M, + TopTools_DataMapOfShapeShape& map, + const Handle(ShapeExtend_MsgRegistrator)& msg = 0, + Standard_Boolean theMutableInput = Standard_False); + +protected: +private: +}; + +#endif // _ShapeProcess_OperLibrary_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_FixSmallCurves.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_FixSmallCurves.hxx new file mode 100644 index 0000000000000000000000000000000000000000..920332cf18413a3bad05797e7444aa84b6eeb82c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_FixSmallCurves.hxx @@ -0,0 +1,86 @@ +// Created on: 2000-06-07 +// Created by: Galina KULIKOVA +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapeUpgrade_FixSmallCurves_HeaderFile +#define _ShapeUpgrade_FixSmallCurves_HeaderFile + +#include + +#include +#include +#include +#include +#include +#include +class ShapeUpgrade_SplitCurve3d; +class ShapeUpgrade_SplitCurve2d; +class Geom_Curve; +class Geom2d_Curve; + +// resolve name collisions with X11 headers +#ifdef Status + #undef Status +#endif + +class ShapeUpgrade_FixSmallCurves; +DEFINE_STANDARD_HANDLE(ShapeUpgrade_FixSmallCurves, ShapeUpgrade_Tool) + +class ShapeUpgrade_FixSmallCurves : public ShapeUpgrade_Tool +{ + +public: + Standard_EXPORT ShapeUpgrade_FixSmallCurves(); + + Standard_EXPORT void Init(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace); + + Standard_EXPORT virtual Standard_Boolean Approx(Handle(Geom_Curve)& Curve3d, + Handle(Geom2d_Curve)& Curve2d, + Handle(Geom2d_Curve)& Curve2dR, + Standard_Real& First, + Standard_Real& Last); + + //! Sets the tool for splitting 3D curves. + Standard_EXPORT void SetSplitCurve3dTool( + const Handle(ShapeUpgrade_SplitCurve3d)& splitCurve3dTool); + + //! Sets the tool for splitting pcurves. + Standard_EXPORT void SetSplitCurve2dTool( + const Handle(ShapeUpgrade_SplitCurve2d)& splitCurve2dTool); + + //! Queries the status of last call to Perform + //! OK : + //! DONE1: + //! DONE2: + //! FAIL1: + Standard_EXPORT Standard_Boolean Status(const ShapeExtend_Status status) const; + + DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_FixSmallCurves, ShapeUpgrade_Tool) + +protected: + Standard_EXPORT virtual Handle(ShapeUpgrade_SplitCurve3d) GetSplitCurve3dTool() const; + + //! Returns the tool for splitting pcurves. + Standard_EXPORT virtual Handle(ShapeUpgrade_SplitCurve2d) GetSplitCurve2dTool() const; + + Standard_Integer myStatus; + Handle(ShapeUpgrade_SplitCurve3d) mySplitCurve3dTool; + Handle(ShapeUpgrade_SplitCurve2d) mySplitCurve2dTool; + TopoDS_Edge myEdge; + TopoDS_Face myFace; + +private: +}; + +#endif // _ShapeUpgrade_FixSmallCurves_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_ShapeConvertToBezier.lxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_ShapeConvertToBezier.lxx new file mode 100644 index 0000000000000000000000000000000000000000..b9b759b9d352a2c715599e7fed7c162eb027077d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_ShapeConvertToBezier.lxx @@ -0,0 +1,215 @@ +// Created on: 1999-06-22 +// Created by: data exchange team +// Copyright (c) 1999-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function : Set2dConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::Set2dConversion(const Standard_Boolean mode) +{ + my2dMode = mode; +} + +//======================================================================= +// function : Get2dConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::Get2dConversion() const +{ + return my2dMode; +} + +//======================================================================= +// function : Set3dConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::Set3dConversion(const Standard_Boolean mode) +{ + my3dMode = mode; +} + +//======================================================================= +// function : Get3dConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::Get3dConversion() const +{ + return my3dMode; +} + +//======================================================================= +// function : SetSurfaceConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::SetSurfaceConversion(const Standard_Boolean mode) +{ + mySurfaceMode = mode; +} + +//======================================================================= +// function : GetSurfaceConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::GetSurfaceConversion() const +{ + return mySurfaceMode; +} + +//======================================================================= +// function : Set3dLineConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::Set3dLineConversion(const Standard_Boolean mode) +{ + my3dLineMode = mode; +} + +//======================================================================= +// function : Get3dLineConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::Get3dLineConversion() const +{ + return my3dLineMode; +} + +//======================================================================= +// function : Set3dCircleConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::Set3dCircleConversion(const Standard_Boolean mode) +{ + my3dCircleMode = mode; +} + +//======================================================================= +// function : Get3dCircleConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::Get3dCircleConversion() const +{ + return my3dCircleMode; +} + +//======================================================================= +// function : Set3dConicConversion +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::Set3dConicConversion(const Standard_Boolean mode) +{ + my3dConicMode = mode; +} + +//======================================================================= +// function : Get3dConicConversion +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::Get3dConicConversion() const +{ + return my3dConicMode; +} + +//======================================================================= +// function : SetPlaneMode +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::SetPlaneMode(const Standard_Boolean mode) +{ + myPlaneMode = mode; +} + +//======================================================================= +// function : GetPlaneMode +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::GetPlaneMode() const +{ + return myPlaneMode; +} + +//======================================================================= +// function : SetRevolutionMode +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::SetRevolutionMode(const Standard_Boolean mode) +{ + myRevolutionMode = mode; +} + +//======================================================================= +// function : GetRevolutionMode +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::GetRevolutionMode() const +{ + return myRevolutionMode; +} + +//======================================================================= +// function : SetExtrusionMode +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::SetExtrusionMode(const Standard_Boolean mode) +{ + myExtrusionMode = mode; +} + +//======================================================================= +// function : GetExtrusionMode +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::GetExtrusionMode() const +{ + return myExtrusionMode; +} + +//======================================================================= +// function : SetBSplineMode +// purpose : +//======================================================================= + +inline void ShapeUpgrade_ShapeConvertToBezier::SetBSplineMode(const Standard_Boolean mode) +{ + myBSplineMode = mode; +} + +//======================================================================= +// function : GetBSplineMode +// purpose : +//======================================================================= + +inline Standard_Boolean ShapeUpgrade_ShapeConvertToBezier::GetBSplineMode() const +{ + return myBSplineMode; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_Tool.hxx b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_Tool.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fec3f53ad80ba8101c152773ddfb57fd64b77c50 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/ShapeUpgrade_Tool.hxx @@ -0,0 +1,82 @@ +// Created on: 1999-08-31 +// Created by: Pavel DURANDIN +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _ShapeUpgrade_Tool_HeaderFile +#define _ShapeUpgrade_Tool_HeaderFile + +#include +#include + +#include +class ShapeBuild_ReShape; + +class ShapeUpgrade_Tool; +DEFINE_STANDARD_HANDLE(ShapeUpgrade_Tool, Standard_Transient) + +//! Tool is a root class for splitting classes +//! Provides context for recording changes, basic +//! precision value and limit (minimal and maximal) +//! values for tolerances +class ShapeUpgrade_Tool : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT ShapeUpgrade_Tool(); + + //! Copy all fields from another Root object + Standard_EXPORT void Set(const Handle(ShapeUpgrade_Tool)& tool); + + //! Sets context + void SetContext(const Handle(ShapeBuild_ReShape)& context); + + //! Returns context + Handle(ShapeBuild_ReShape) Context() const; + + //! Sets basic precision value + void SetPrecision(const Standard_Real preci); + + //! Returns basic precision value + Standard_Real Precision() const; + + //! Sets minimal allowed tolerance + void SetMinTolerance(const Standard_Real mintol); + + //! Returns minimal allowed tolerance + Standard_Real MinTolerance() const; + + //! Sets maximal allowed tolerance + void SetMaxTolerance(const Standard_Real maxtol); + + //! Returns maximal allowed tolerance + Standard_Real MaxTolerance() const; + + //! Returns tolerance limited by [myMinTol,myMaxTol] + Standard_Real LimitTolerance(const Standard_Real toler) const; + + DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_Tool, Standard_Transient) + +protected: +private: + Handle(ShapeBuild_ReShape) myContext; + Standard_Real myPrecision; + Standard_Real myMinTol; + Standard_Real myMaxTol; +}; + +#include + +#endif // _ShapeUpgrade_Tool_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Standard_AbortiveTransaction.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Standard_AbortiveTransaction.hxx new file mode 100644 index 0000000000000000000000000000000000000000..10fe90911af86314b7dbf325030c5ff57ba13d92 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Standard_AbortiveTransaction.hxx @@ -0,0 +1,38 @@ +// Created on: 1991-09-05 +// Created by: J.P. TIRAUlt +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Standard_AbortiveTransaction_HeaderFile +#define _Standard_AbortiveTransaction_HeaderFile + +#include +#include +#include +#include + +class Standard_AbortiveTransaction; +DEFINE_STANDARD_HANDLE(Standard_AbortiveTransaction, Standard_Failure) + +#if !defined No_Exception && !defined No_Standard_AbortiveTransaction + #define Standard_AbortiveTransaction_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw Standard_AbortiveTransaction(MESSAGE); +#else + #define Standard_AbortiveTransaction_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(Standard_AbortiveTransaction, Standard_Failure) + +#endif // _Standard_AbortiveTransaction_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Standard_Underflow.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Standard_Underflow.hxx new file mode 100644 index 0000000000000000000000000000000000000000..641f9ecb5ab07fe7c1b22c633c0dd5dc0b9afc4d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Standard_Underflow.hxx @@ -0,0 +1,38 @@ +// Created on: 1991-09-05 +// Created by: J.P. TIRAUlt +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Standard_Underflow_HeaderFile +#define _Standard_Underflow_HeaderFile + +#include +#include +#include +#include + +class Standard_Underflow; +DEFINE_STANDARD_HANDLE(Standard_Underflow, Standard_NumericError) + +#if !defined No_Exception && !defined No_Standard_Underflow + #define Standard_Underflow_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw Standard_Underflow(MESSAGE); +#else + #define Standard_Underflow_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(Standard_Underflow, Standard_NumericError) + +#endif // _Standard_Underflow_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StdLPersistent_Variable.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StdLPersistent_Variable.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7fbf0f371ba4a272de3088ef6698be7760d72fa9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StdLPersistent_Variable.hxx @@ -0,0 +1,62 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StdLPersistent_Variable_HeaderFile +#define _StdLPersistent_Variable_HeaderFile + +#include +#include + +#include + +class StdLPersistent_Variable : public StdObjMgt_Attribute +{ +public: + //! Empty constructor. + StdLPersistent_Variable() + : myIsConstant(Standard_False) + { + } + + //! Read persistent data from a file. + inline void Read(StdObjMgt_ReadData& theReadData) { theReadData >> myIsConstant >> myUnit; } + + //! Write persistent data to a file. + inline void Write(StdObjMgt_WriteData& theWriteData) const + { + theWriteData << myIsConstant << myUnit; + } + + //! Gets persistent child objects + inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const + { + theChildren.Append(myUnit); + } + + //! Returns persistent type name + inline Standard_CString PName() const { return "PDataStd_Variable"; } + + //! Import transient attribute from the persistent data. + void Import(const Handle(TDataStd_Variable)& theAttribute) const + { + theAttribute->Constant(myIsConstant); + if (myUnit) + theAttribute->Unit(myUnit->Value()->String()); + } + +private: + Standard_Boolean myIsConstant; + Handle(StdLPersistent_HString::Ascii) myUnit; +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StdObject_gp_Vectors.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StdObject_gp_Vectors.hxx new file mode 100644 index 0000000000000000000000000000000000000000..90e1b9807f35c22bd2adcdedf924775c32492326 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StdObject_gp_Vectors.hxx @@ -0,0 +1,173 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StdObject_gp_Vectors_HeaderFile +#define _StdObject_gp_Vectors_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_XY& theXY) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + Standard_Real aX, aY; + theReadData >> aX >> aY; + theXY.SetCoord(aX, aY); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_XY& theXY) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + Standard_Real aX = theXY.X(), aY = theXY.Y(); + theWriteData << aX << aY; + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Pnt2d& thePnt) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XY aXY; + theReadData >> aXY; + thePnt.SetXY(aXY); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Pnt2d& thePnt) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << thePnt.XY(); + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Vec2d& theVec) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XY aXY; + theReadData >> aXY; + theVec.SetXY(aXY); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Vec2d& theVec) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << theVec.XY(); + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Dir2d& theDir) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XY aXY; + theReadData >> aXY; + theDir.SetXY(aXY); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Dir2d& theDir) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << theDir.XY(); + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_XYZ& theXYZ) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + Standard_Real aX, aY, aZ; + theReadData >> aX >> aY >> aZ; + theXYZ.SetCoord(aX, aY, aZ); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_XYZ& theXYZ) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + Standard_Real aX = theXYZ.X(), aY = theXYZ.Y(), aZ = theXYZ.Z(); + theWriteData << aX << aY << aZ; + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Pnt& thePnt) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XYZ aXYZ; + theReadData >> aXYZ; + thePnt.SetXYZ(aXYZ); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Pnt& thePnt) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << thePnt.XYZ(); + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Vec& theVec) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XYZ aXYZ; + theReadData >> aXYZ; + theVec.SetXYZ(aXYZ); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Vec& theVec) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << theVec.XYZ(); + return theWriteData; +} + +inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Dir& theDir) +{ + StdObjMgt_ReadData::ObjectSentry aSentry(theReadData); + + gp_XYZ aXYZ; + theReadData >> aXYZ; + theDir.SetXYZ(aXYZ); + return theReadData; +} + +inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Dir& theDir) +{ + StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData); + + theWriteData << theDir.XYZ(); + return theWriteData; +} + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StdSelect_ShapeTypeFilter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StdSelect_ShapeTypeFilter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5f12ae8fd767c6afb4cde971e974a5d51e51c53f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StdSelect_ShapeTypeFilter.hxx @@ -0,0 +1,48 @@ +// Created on: 1996-09-17 +// Created by: Odile Olivier +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StdSelect_ShapeTypeFilter_HeaderFile +#define _StdSelect_ShapeTypeFilter_HeaderFile + +#include +#include + +class SelectMgr_EntityOwner; + +DEFINE_STANDARD_HANDLE(StdSelect_ShapeTypeFilter, SelectMgr_Filter) + +//! A filter framework which allows you to define a filter for a specific shape type. +class StdSelect_ShapeTypeFilter : public SelectMgr_Filter +{ + DEFINE_STANDARD_RTTIEXT(StdSelect_ShapeTypeFilter, SelectMgr_Filter) +public: + //! Constructs a filter object defined by the shape type aType. + Standard_EXPORT StdSelect_ShapeTypeFilter(const TopAbs_ShapeEnum aType); + + //! Returns the type of shape selected by the filter. + TopAbs_ShapeEnum Type() const { return myType; } + + Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const + Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean ActsOn(const TopAbs_ShapeEnum aStandardMode) const + Standard_OVERRIDE; + +private: + TopAbs_ShapeEnum myType; +}; + +#endif // _StdSelect_ShapeTypeFilter_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP203_HArray1OfPersonOrganizationItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP203_HArray1OfPersonOrganizationItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7eee223ec68979b8599bdbea332431b6ce680c57 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP203_HArray1OfPersonOrganizationItem.hxx @@ -0,0 +1,25 @@ +// Created on: 1999-11-09 +// Created by: data exchange team +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepAP203_HArray1OfPersonOrganizationItem_HeaderFile +#define StepAP203_HArray1OfPersonOrganizationItem_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepAP203_HArray1OfPersonOrganizationItem, StepAP203_Array1OfPersonOrganizationItem) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_Array1OfAutoDesignGroupedItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_Array1OfAutoDesignGroupedItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..89a4ceb7286e7947c23a1c8ae9051f78021e7c69 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_Array1OfAutoDesignGroupedItem.hxx @@ -0,0 +1,25 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepAP214_Array1OfAutoDesignGroupedItem_HeaderFile +#define StepAP214_Array1OfAutoDesignGroupedItem_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepAP214_Array1OfAutoDesignGroupedItem; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignActualDateAndTimeAssignment.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignActualDateAndTimeAssignment.hxx new file mode 100644 index 0000000000000000000000000000000000000000..963ebf5521414cce88c758ca71e93fca8b9975e5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignActualDateAndTimeAssignment.hxx @@ -0,0 +1,60 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepAP214_AutoDesignActualDateAndTimeAssignment_HeaderFile +#define _StepAP214_AutoDesignActualDateAndTimeAssignment_HeaderFile + +#include + +#include +#include +#include +class StepBasic_DateAndTime; +class StepBasic_DateTimeRole; +class StepAP214_AutoDesignDateAndTimeItem; + +class StepAP214_AutoDesignActualDateAndTimeAssignment; +DEFINE_STANDARD_HANDLE(StepAP214_AutoDesignActualDateAndTimeAssignment, + StepBasic_DateAndTimeAssignment) + +class StepAP214_AutoDesignActualDateAndTimeAssignment : public StepBasic_DateAndTimeAssignment +{ + +public: + //! Returns a AutoDesignActualDateAndTimeAssignment + Standard_EXPORT StepAP214_AutoDesignActualDateAndTimeAssignment(); + + Standard_EXPORT void Init(const Handle(StepBasic_DateAndTime)& aAssignedDateAndTime, + const Handle(StepBasic_DateTimeRole)& aRole, + const Handle(StepAP214_HArray1OfAutoDesignDateAndTimeItem)& aItems); + + Standard_EXPORT void SetItems(const Handle(StepAP214_HArray1OfAutoDesignDateAndTimeItem)& aItems); + + Standard_EXPORT Handle(StepAP214_HArray1OfAutoDesignDateAndTimeItem) Items() const; + + Standard_EXPORT StepAP214_AutoDesignDateAndTimeItem ItemsValue(const Standard_Integer num) const; + + Standard_EXPORT Standard_Integer NbItems() const; + + DEFINE_STANDARD_RTTIEXT(StepAP214_AutoDesignActualDateAndTimeAssignment, + StepBasic_DateAndTimeAssignment) + +protected: +private: + Handle(StepAP214_HArray1OfAutoDesignDateAndTimeItem) items; +}; + +#endif // _StepAP214_AutoDesignActualDateAndTimeAssignment_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignGeneralOrgItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignGeneralOrgItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bb1ce5a2e1a1c5adba6afb1e51e1eb824113cadc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_AutoDesignGeneralOrgItem.hxx @@ -0,0 +1,86 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepAP214_AutoDesignGeneralOrgItem_HeaderFile +#define _StepAP214_AutoDesignGeneralOrgItem_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepBasic_Product; +class StepBasic_ProductDefinition; +class StepBasic_ProductDefinitionFormation; +class StepBasic_ProductDefinitionRelationship; +class StepBasic_ProductDefinitionWithAssociatedDocuments; +class StepRepr_Representation; +class StepRepr_ExternallyDefinedRepresentation; +class StepAP214_AutoDesignDocumentReference; + +class StepAP214_AutoDesignGeneralOrgItem : public StepData_SelectType +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a AutoDesignGeneralOrgItem SelectType + Standard_EXPORT StepAP214_AutoDesignGeneralOrgItem(); + + //! Recognizes a AutoDesignGeneralOrgItem Kind Entity that is : + //! 1 Product from StepBasic, + //! 2 ProductDefinition from StepBasic, + //! 3 ProductDefinitionFormation from StepBasic, + //! 4 ProductDefinitionRelationship from StepBasic, + //! 5 ProductDefinitionWithAssociatedDocuments from StepBasic, + //! 6 Representation from StepRepr + //! 7 ExternallyDefinedRepresentation from StepRepr, + //! 8 AutoDesignDocumentReference from StepAP214, + //! 0 else + Standard_EXPORT Standard_Integer CaseNum(const Handle(Standard_Transient)& ent) const; + + //! returns Value as a Product (Null if another type) + Standard_EXPORT Handle(StepBasic_Product) Product() const; + + //! returns Value as a ProductDefinition (Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinition) ProductDefinition() const; + + //! returns Value as a ProductDefinitionFormation (Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinitionFormation) ProductDefinitionFormation() const; + + //! returns Value as a ProductDefinitionRelationship (Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinitionRelationship) ProductDefinitionRelationship() + const; + + //! returns Value as a ProductDefinitionWithAssociatedDocuments (Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) + ProductDefinitionWithAssociatedDocuments() const; + + //! returns Value as a Representation (Null if another type) + Standard_EXPORT Handle(StepRepr_Representation) Representation() const; + + //! returns Value as a Representation (Null if another type) + Standard_EXPORT Handle(StepRepr_ExternallyDefinedRepresentation) ExternallyDefinedRepresentation() + const; + + Standard_EXPORT Handle(StepAP214_AutoDesignDocumentReference) AutoDesignDocumentReference() const; + +protected: +private: +}; + +#endif // _StepAP214_AutoDesignGeneralOrgItem_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_DateAndTimeItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_DateAndTimeItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a83e15375e62bd247fedca18908badc0d7141b27 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_DateAndTimeItem.hxx @@ -0,0 +1,75 @@ +// Created on: 1999-03-09 +// Created by: data exchange team +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepAP214_DateAndTimeItem_HeaderFile +#define _StepAP214_DateAndTimeItem_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepBasic_ApprovalPersonOrganization; +class StepAP214_AppliedPersonAndOrganizationAssignment; +class StepAP214_AppliedOrganizationAssignment; + +class StepAP214_DateAndTimeItem : public StepAP214_ApprovalItem +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a DateAndTimeItem SelectType + Standard_EXPORT StepAP214_DateAndTimeItem(); + + //! Recognizes a DateAndTimeItem Kind Entity that is : + //! 1 -> ApprovalPersonOrganization + //! 2 -> AppliedDateAndPersonAssignment + //! 3 -> AppliedOrganizationAssignment + //! 4 -> AssemblyComponentUsageSubstitute + //! 5 -> DocumentFile + //! 6 -> Effectivity + //! 7 -> MaterialDesignation + //! 8 -> MechanicalDesignGeometricPresentationRepresentation + //! 9 -> PresentationArea + //! 10 -> Product + //! 11 -> ProductDefinition + //! 12 -> ProductDefinitionFormation + //! 13 -> ProductDefinitionRelationship + //! 14 -> PropertyDefinition + //! 15 -> ShapeRepresentation + //! 16 -> SecurityClassification + //! 0 else + Standard_EXPORT virtual Standard_Integer CaseNum(const Handle(Standard_Transient)& ent) const + Standard_OVERRIDE; + + //! returns Value as a ApprovalPersonOrganization (Null if another type) + Standard_EXPORT Handle(StepBasic_ApprovalPersonOrganization) ApprovalPersonOrganization() const; + + //! returns Value as a AppliedDateAndPersonAssignment (Null if another type) + Standard_EXPORT Handle(StepAP214_AppliedPersonAndOrganizationAssignment) + AppliedPersonAndOrganizationAssignment() const; + + //! returns Value as a AppliedOrganizationAssignment (Null if another type) + Standard_EXPORT Handle(StepAP214_AppliedOrganizationAssignment) AppliedOrganizationAssignment() + const; + +protected: +private: +}; + +#endif // _StepAP214_DateAndTimeItem_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_HArray1OfExternalIdentificationItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_HArray1OfExternalIdentificationItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2c1fa3f90ec014b69b8c4176b51ea433a3c60c46 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepAP214_HArray1OfExternalIdentificationItem.hxx @@ -0,0 +1,26 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepAP214_HArray1OfExternalIdentificationItem_HeaderFile +#define StepAP214_HArray1OfExternalIdentificationItem_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepAP214_HArray1OfExternalIdentificationItem, + StepAP214_Array1OfExternalIdentificationItem) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ActionAssignment.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ActionAssignment.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e4a25df9bb1860ca2cb4b63d440f7ffd1065a41f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ActionAssignment.hxx @@ -0,0 +1,53 @@ +// Created on: 1999-11-26 +// Created by: Andrey BETENEV +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_ActionAssignment_HeaderFile +#define _StepBasic_ActionAssignment_HeaderFile + +#include +#include + +#include +class StepBasic_Action; + +class StepBasic_ActionAssignment; +DEFINE_STANDARD_HANDLE(StepBasic_ActionAssignment, Standard_Transient) + +//! Representation of STEP entity ActionAssignment +class StepBasic_ActionAssignment : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepBasic_ActionAssignment(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(StepBasic_Action)& aAssignedAction); + + //! Returns field AssignedAction + Standard_EXPORT Handle(StepBasic_Action) AssignedAction() const; + + //! Set field AssignedAction + Standard_EXPORT void SetAssignedAction(const Handle(StepBasic_Action)& AssignedAction); + + DEFINE_STANDARD_RTTIEXT(StepBasic_ActionAssignment, Standard_Transient) + +protected: +private: + Handle(StepBasic_Action) theAssignedAction; +}; + +#endif // _StepBasic_ActionAssignment_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ApprovalAssignment.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ApprovalAssignment.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e4cae56a8ec7a703b5812bc85d672bdc425099f8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ApprovalAssignment.hxx @@ -0,0 +1,46 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_ApprovalAssignment_HeaderFile +#define _StepBasic_ApprovalAssignment_HeaderFile + +#include +#include + +#include +class StepBasic_Approval; + +class StepBasic_ApprovalAssignment; +DEFINE_STANDARD_HANDLE(StepBasic_ApprovalAssignment, Standard_Transient) + +class StepBasic_ApprovalAssignment : public Standard_Transient +{ + +public: + Standard_EXPORT void Init(const Handle(StepBasic_Approval)& aAssignedApproval); + + Standard_EXPORT void SetAssignedApproval(const Handle(StepBasic_Approval)& aAssignedApproval); + + Standard_EXPORT Handle(StepBasic_Approval) AssignedApproval() const; + + DEFINE_STANDARD_RTTIEXT(StepBasic_ApprovalAssignment, Standard_Transient) + +protected: +private: + Handle(StepBasic_Approval) assignedApproval; +}; + +#endif // _StepBasic_ApprovalAssignment_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Array1OfDocument.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Array1OfDocument.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5f1d8b228ed966c4f3e529affc9b7b63cd490a8e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Array1OfDocument.hxx @@ -0,0 +1,25 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepBasic_Array1OfDocument_HeaderFile +#define StepBasic_Array1OfDocument_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepBasic_Array1OfDocument; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Certification.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Certification.hxx new file mode 100644 index 0000000000000000000000000000000000000000..665efdb66102a6b89de7741d082e33c87c8fce45 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_Certification.hxx @@ -0,0 +1,70 @@ +// Created on: 1999-11-26 +// Created by: Andrey BETENEV +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_Certification_HeaderFile +#define _StepBasic_Certification_HeaderFile + +#include +#include + +#include +class TCollection_HAsciiString; +class StepBasic_CertificationType; + +class StepBasic_Certification; +DEFINE_STANDARD_HANDLE(StepBasic_Certification, Standard_Transient) + +//! Representation of STEP entity Certification +class StepBasic_Certification : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepBasic_Certification(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName, + const Handle(TCollection_HAsciiString)& aPurpose, + const Handle(StepBasic_CertificationType)& aKind); + + //! Returns field Name + Standard_EXPORT Handle(TCollection_HAsciiString) Name() const; + + //! Set field Name + Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& Name); + + //! Returns field Purpose + Standard_EXPORT Handle(TCollection_HAsciiString) Purpose() const; + + //! Set field Purpose + Standard_EXPORT void SetPurpose(const Handle(TCollection_HAsciiString)& Purpose); + + //! Returns field Kind + Standard_EXPORT Handle(StepBasic_CertificationType) Kind() const; + + //! Set field Kind + Standard_EXPORT void SetKind(const Handle(StepBasic_CertificationType)& Kind); + + DEFINE_STANDARD_RTTIEXT(StepBasic_Certification, Standard_Transient) + +protected: +private: + Handle(TCollection_HAsciiString) theName; + Handle(TCollection_HAsciiString) thePurpose; + Handle(StepBasic_CertificationType) theKind; +}; + +#endif // _StepBasic_Certification_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_CertificationAssignment.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_CertificationAssignment.hxx new file mode 100644 index 0000000000000000000000000000000000000000..0bff99648cd743d1d888ebcd0c31d078ff1d6d12 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_CertificationAssignment.hxx @@ -0,0 +1,54 @@ +// Created on: 1999-11-26 +// Created by: Andrey BETENEV +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_CertificationAssignment_HeaderFile +#define _StepBasic_CertificationAssignment_HeaderFile + +#include +#include + +#include +class StepBasic_Certification; + +class StepBasic_CertificationAssignment; +DEFINE_STANDARD_HANDLE(StepBasic_CertificationAssignment, Standard_Transient) + +//! Representation of STEP entity CertificationAssignment +class StepBasic_CertificationAssignment : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepBasic_CertificationAssignment(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(StepBasic_Certification)& aAssignedCertification); + + //! Returns field AssignedCertification + Standard_EXPORT Handle(StepBasic_Certification) AssignedCertification() const; + + //! Set field AssignedCertification + Standard_EXPORT void SetAssignedCertification( + const Handle(StepBasic_Certification)& AssignedCertification); + + DEFINE_STANDARD_RTTIEXT(StepBasic_CertificationAssignment, Standard_Transient) + +protected: +private: + Handle(StepBasic_Certification) theAssignedCertification; +}; + +#endif // _StepBasic_CertificationAssignment_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_DateTimeRole.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_DateTimeRole.hxx new file mode 100644 index 0000000000000000000000000000000000000000..60bf79694b7a1177e770169bf1d32d16be79d2d4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_DateTimeRole.hxx @@ -0,0 +1,49 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_DateTimeRole_HeaderFile +#define _StepBasic_DateTimeRole_HeaderFile + +#include +#include + +#include +class TCollection_HAsciiString; + +class StepBasic_DateTimeRole; +DEFINE_STANDARD_HANDLE(StepBasic_DateTimeRole, Standard_Transient) + +class StepBasic_DateTimeRole : public Standard_Transient +{ + +public: + //! Returns a DateTimeRole + Standard_EXPORT StepBasic_DateTimeRole(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName); + + Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& aName); + + Standard_EXPORT Handle(TCollection_HAsciiString) Name() const; + + DEFINE_STANDARD_RTTIEXT(StepBasic_DateTimeRole, Standard_Transient) + +protected: +private: + Handle(TCollection_HAsciiString) name; +}; + +#endif // _StepBasic_DateTimeRole_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ExternalIdentificationAssignment.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ExternalIdentificationAssignment.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e6d783714e7bd4a10d27235a65281084fbc572cb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ExternalIdentificationAssignment.hxx @@ -0,0 +1,59 @@ +// Created on: 2000-05-10 +// Created by: Andrey BETENEV +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_ExternalIdentificationAssignment_HeaderFile +#define _StepBasic_ExternalIdentificationAssignment_HeaderFile + +#include +#include + +#include +class StepBasic_ExternalSource; +class TCollection_HAsciiString; +class StepBasic_IdentificationRole; + +class StepBasic_ExternalIdentificationAssignment; +DEFINE_STANDARD_HANDLE(StepBasic_ExternalIdentificationAssignment, + StepBasic_IdentificationAssignment) + +//! Representation of STEP entity ExternalIdentificationAssignment +class StepBasic_ExternalIdentificationAssignment : public StepBasic_IdentificationAssignment +{ + +public: + //! Empty constructor + Standard_EXPORT StepBasic_ExternalIdentificationAssignment(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init( + const Handle(TCollection_HAsciiString)& aIdentificationAssignment_AssignedId, + const Handle(StepBasic_IdentificationRole)& aIdentificationAssignment_Role, + const Handle(StepBasic_ExternalSource)& aSource); + + //! Returns field Source + Standard_EXPORT Handle(StepBasic_ExternalSource) Source() const; + + //! Set field Source + Standard_EXPORT void SetSource(const Handle(StepBasic_ExternalSource)& Source); + + DEFINE_STANDARD_RTTIEXT(StepBasic_ExternalIdentificationAssignment, + StepBasic_IdentificationAssignment) + +protected: +private: + Handle(StepBasic_ExternalSource) theSource; +}; + +#endif // _StepBasic_ExternalIdentificationAssignment_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_LengthMeasureWithUnit.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_LengthMeasureWithUnit.hxx new file mode 100644 index 0000000000000000000000000000000000000000..0bb429a5296f261720cddec45cf2fadee4263a3d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_LengthMeasureWithUnit.hxx @@ -0,0 +1,40 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_LengthMeasureWithUnit_HeaderFile +#define _StepBasic_LengthMeasureWithUnit_HeaderFile + +#include + +#include + +class StepBasic_LengthMeasureWithUnit; +DEFINE_STANDARD_HANDLE(StepBasic_LengthMeasureWithUnit, StepBasic_MeasureWithUnit) + +class StepBasic_LengthMeasureWithUnit : public StepBasic_MeasureWithUnit +{ + +public: + //! Returns a LengthMeasureWithUnit + Standard_EXPORT StepBasic_LengthMeasureWithUnit(); + + DEFINE_STANDARD_RTTIEXT(StepBasic_LengthMeasureWithUnit, StepBasic_MeasureWithUnit) + +protected: +private: +}; + +#endif // _StepBasic_LengthMeasureWithUnit_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_PhysicallyModeledProductDefinition.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_PhysicallyModeledProductDefinition.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9ea3d682d8c769e8b2fdedd517c26efe2a745482 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_PhysicallyModeledProductDefinition.hxx @@ -0,0 +1,40 @@ +// Created on: 1998-06-30 +// Created by: Christian CAILLET +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_PhysicallyModeledProductDefinition_HeaderFile +#define _StepBasic_PhysicallyModeledProductDefinition_HeaderFile + +#include +#include + +#include + +class StepBasic_PhysicallyModeledProductDefinition; +DEFINE_STANDARD_HANDLE(StepBasic_PhysicallyModeledProductDefinition, StepBasic_ProductDefinition) + +class StepBasic_PhysicallyModeledProductDefinition : public StepBasic_ProductDefinition +{ + +public: + Standard_EXPORT StepBasic_PhysicallyModeledProductDefinition(); + + DEFINE_STANDARD_RTTIEXT(StepBasic_PhysicallyModeledProductDefinition, StepBasic_ProductDefinition) + +protected: +private: +}; + +#endif // _StepBasic_PhysicallyModeledProductDefinition_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ProductOrFormationOrDefinition.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ProductOrFormationOrDefinition.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c102c0d28b301144684b0772f084658a1f1192b7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_ProductOrFormationOrDefinition.hxx @@ -0,0 +1,59 @@ +// Created on: 2003-01-28 +// Created by: data exchange team +// Copyright (c) 2003-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_ProductOrFormationOrDefinition_HeaderFile +#define _StepBasic_ProductOrFormationOrDefinition_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepBasic_Product; +class StepBasic_ProductDefinitionFormation; +class StepBasic_ProductDefinition; + +//! Representation of STEP SELECT type ProductOrFormationOrDefinition +class StepBasic_ProductOrFormationOrDefinition : public StepData_SelectType +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + Standard_EXPORT StepBasic_ProductOrFormationOrDefinition(); + + //! Recognizes a kind of ProductOrFormationOrDefinition select type + //! 1 -> Product from StepBasic + //! 2 -> ProductDefinitionFormation from StepBasic + //! 3 -> ProductDefinition from StepBasic + //! 0 else + Standard_EXPORT Standard_Integer CaseNum(const Handle(Standard_Transient)& ent) const; + + //! Returns Value as Product (or Null if another type) + Standard_EXPORT Handle(StepBasic_Product) Product() const; + + //! Returns Value as ProductDefinitionFormation (or Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinitionFormation) ProductDefinitionFormation() const; + + //! Returns Value as ProductDefinition (or Null if another type) + Standard_EXPORT Handle(StepBasic_ProductDefinition) ProductDefinition() const; + +protected: +private: +}; + +#endif // _StepBasic_ProductOrFormationOrDefinition_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_SiUnitAndSolidAngleUnit.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_SiUnitAndSolidAngleUnit.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b9bbd55a27bd88605a16839891f55db0a50a0af7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepBasic_SiUnitAndSolidAngleUnit.hxx @@ -0,0 +1,53 @@ +// Created on: 1994-06-17 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepBasic_SiUnitAndSolidAngleUnit_HeaderFile +#define _StepBasic_SiUnitAndSolidAngleUnit_HeaderFile + +#include +#include + +#include +#include +#include +class StepBasic_SolidAngleUnit; + +class StepBasic_SiUnitAndSolidAngleUnit; +DEFINE_STANDARD_HANDLE(StepBasic_SiUnitAndSolidAngleUnit, StepBasic_SiUnit) + +class StepBasic_SiUnitAndSolidAngleUnit : public StepBasic_SiUnit +{ + +public: + //! Returns a SiUnitAndSolidAngleUnit + Standard_EXPORT StepBasic_SiUnitAndSolidAngleUnit(); + + Standard_EXPORT void Init(const Standard_Boolean hasAprefix, + const StepBasic_SiPrefix aPrefix, + const StepBasic_SiUnitName aName); + + Standard_EXPORT void SetSolidAngleUnit(const Handle(StepBasic_SolidAngleUnit)& aSolidAngleUnit); + + Standard_EXPORT Handle(StepBasic_SolidAngleUnit) SolidAngleUnit() const; + + DEFINE_STANDARD_RTTIEXT(StepBasic_SiUnitAndSolidAngleUnit, StepBasic_SiUnit) + +protected: +private: + Handle(StepBasic_SolidAngleUnit) solidAngleUnit; +}; + +#endif // _StepBasic_SiUnitAndSolidAngleUnit_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepData_Array1OfField.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepData_Array1OfField.hxx new file mode 100644 index 0000000000000000000000000000000000000000..28aa487561240b3dc4d2933cf4b9a1b228066fd8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepData_Array1OfField.hxx @@ -0,0 +1,25 @@ +// Created on: 1992-02-11 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepData_Array1OfField_HeaderFile +#define StepData_Array1OfField_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepData_Array1OfField; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepData_WriterLib.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepData_WriterLib.hxx new file mode 100644 index 0000000000000000000000000000000000000000..0216ae9a54b62099fbe52e93d711d31fc6eda7ee --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepData_WriterLib.hxx @@ -0,0 +1,98 @@ +// Created on: 1992-02-11 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepData_WriterLib_HeaderFile +#define _StepData_WriterLib_HeaderFile + +#include +#include +#include + +#include +class StepData_NodeOfWriterLib; +class Standard_NoSuchObject; +class Standard_Transient; +class StepData_ReadWriteModule; +class StepData_Protocol; +class StepData_GlobalNodeOfWriterLib; + +class StepData_WriterLib +{ +public: + DEFINE_STANDARD_ALLOC + + //! Adds a couple (Module-Protocol) into the global definition set + //! for this class of Library. + Standard_EXPORT static void SetGlobal(const Handle(StepData_ReadWriteModule)& amodule, + const Handle(StepData_Protocol)& aprotocol); + + //! Creates a Library which complies with a Protocol, that is : + //! Same class (criterium IsInstance) + //! This creation gets the Modules from the global set, those + //! which are bound to the given Protocol and its Resources + Standard_EXPORT StepData_WriterLib(const Handle(StepData_Protocol)& aprotocol); + + //! Creates an empty Library : it will later by filled by method + //! AddProtocol + Standard_EXPORT StepData_WriterLib(); + + //! Adds a couple (Module-Protocol) to the Library, given the + //! class of a Protocol. Takes Resources into account. + //! (if is not of type TheProtocol, it is not added) + Standard_EXPORT void AddProtocol(const Handle(Standard_Transient)& aprotocol); + + //! Clears the list of Modules of a library (can be used to + //! redefine the order of Modules before action : Clear then + //! refill the Library by calls to AddProtocol) + Standard_EXPORT void Clear(); + + //! Sets a library to be defined with the complete Global list + //! (all the couples Protocol/Modules recorded in it) + Standard_EXPORT void SetComplete(); + + //! Selects a Module from the Library, given an Object. + //! Returns True if Select has succeeded, False else. + //! Also Returns (as arguments) the selected Module and the Case + //! Number determined by the associated Protocol. + //! If Select has failed, is Null Handle and CN is zero. + //! (Select can work on any criterium, such as Object DynamicType) + Standard_EXPORT Standard_Boolean Select(const Handle(Standard_Transient)& obj, + Handle(StepData_ReadWriteModule)& module, + Standard_Integer& CN) const; + + //! Starts Iteration on the Modules (sets it on the first one) + Standard_EXPORT void Start(); + + //! Returns True if there are more Modules to iterate on + Standard_EXPORT Standard_Boolean More() const; + + //! Iterates by getting the next Module in the list + //! If there is none, the exception will be raised by Value + Standard_EXPORT void Next(); + + //! Returns the current Module in the Iteration + Standard_EXPORT const Handle(StepData_ReadWriteModule)& Module() const; + + //! Returns the current Protocol in the Iteration + Standard_EXPORT const Handle(StepData_Protocol)& Protocol() const; + +protected: +private: + Handle(StepData_NodeOfWriterLib) thelist; + Handle(StepData_NodeOfWriterLib) thecurr; +}; + +#endif // _StepData_WriterLib_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_DatumReference.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_DatumReference.hxx new file mode 100644 index 0000000000000000000000000000000000000000..50a30db2a0ea3b1099cc5940840bde0c65579f62 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_DatumReference.hxx @@ -0,0 +1,61 @@ +// Created on: 2003-06-04 +// Created by: Galina KULIKOVA +// Copyright (c) 2003-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepDimTol_DatumReference_HeaderFile +#define _StepDimTol_DatumReference_HeaderFile + +#include +#include + +#include +#include +class StepDimTol_Datum; + +class StepDimTol_DatumReference; +DEFINE_STANDARD_HANDLE(StepDimTol_DatumReference, Standard_Transient) + +//! Representation of STEP entity DatumReference +class StepDimTol_DatumReference : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepDimTol_DatumReference(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Standard_Integer thePrecedence, + const Handle(StepDimTol_Datum)& theReferencedDatum); + + //! Returns field Precedence + Standard_EXPORT Standard_Integer Precedence() const; + + //! Set field Precedence + Standard_EXPORT void SetPrecedence(const Standard_Integer thePrecedence); + + //! Returns field ReferencedDatum + Standard_EXPORT Handle(StepDimTol_Datum) ReferencedDatum() const; + + //! Set field ReferencedDatum + Standard_EXPORT void SetReferencedDatum(const Handle(StepDimTol_Datum)& theReferencedDatum); + + DEFINE_STANDARD_RTTIEXT(StepDimTol_DatumReference, Standard_Transient) + +protected: +private: + Standard_Integer myPrecedence; + Handle(StepDimTol_Datum) myReferencedDatum; +}; + +#endif // _StepDimTol_DatumReference_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfDatumSystemOrReference.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfDatumSystemOrReference.hxx new file mode 100644 index 0000000000000000000000000000000000000000..50b23e88e0d9fa183ff475b56ad01af1bdd99944 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfDatumSystemOrReference.hxx @@ -0,0 +1,24 @@ +// Created on: 2015-07-21 +// Created by: Irina KRYLOVA +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepDimTol_HArray1OfDatumSystemOrReference_HeaderFile +#define _StepDimTol_HArray1OfDatumSystemOrReference_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepDimTol_HArray1OfDatumSystemOrReference, + StepDimTol_Array1OfDatumSystemOrReference) +#endif // _StepDimTol_HArray1OfDatumSystemOrReference_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfToleranceZoneTarget.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfToleranceZoneTarget.hxx new file mode 100644 index 0000000000000000000000000000000000000000..754cae54a6e52adec37d8e3a77239ce597a2aae5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepDimTol_HArray1OfToleranceZoneTarget.hxx @@ -0,0 +1,23 @@ +// Created on: 2015-07-13 +// Created by: Irina KRYLOVA +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepDimTol_HArray1OfToleranceZoneTarget_HeaderFile +#define _StepDimTol_HArray1OfToleranceZoneTarget_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepDimTol_HArray1OfToleranceZoneTarget, StepDimTol_Array1OfToleranceZoneTarget) +#endif // _StepDimTol_HArray1OfToleranceZoneTarget_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepElement_EnumeratedCurveElementPurpose.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepElement_EnumeratedCurveElementPurpose.hxx new file mode 100644 index 0000000000000000000000000000000000000000..843d937a5e144c13c4a11d8546ac1555108d9f00 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepElement_EnumeratedCurveElementPurpose.hxx @@ -0,0 +1,28 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepElement_EnumeratedCurveElementPurpose_HeaderFile +#define _StepElement_EnumeratedCurveElementPurpose_HeaderFile + +enum StepElement_EnumeratedCurveElementPurpose +{ + StepElement_Axial, + StepElement_YYBending, + StepElement_ZZBending, + StepElement_Torsion, + StepElement_XYShear, + StepElement_XZShear, + StepElement_Warping +}; + +#endif // _StepElement_EnumeratedCurveElementPurpose_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepElement_SequenceOfCurveElementSectionDefinition.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepElement_SequenceOfCurveElementSectionDefinition.hxx new file mode 100644 index 0000000000000000000000000000000000000000..623355e04087dc7324b96a2cc9f4dca43c6000c0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepElement_SequenceOfCurveElementSectionDefinition.hxx @@ -0,0 +1,23 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepElement_SequenceOfCurveElementSectionDefinition_HeaderFile +#define StepElement_SequenceOfCurveElementSectionDefinition_HeaderFile + +#include +#include + +typedef NCollection_Sequence + StepElement_SequenceOfCurveElementSectionDefinition; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Array1OfElementRepresentation.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Array1OfElementRepresentation.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1bdf39bb41b6f56a4f70edbd9cefd9807f6cdd8b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Array1OfElementRepresentation.hxx @@ -0,0 +1,23 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepFEA_Array1OfElementRepresentation_HeaderFile +#define StepFEA_Array1OfElementRepresentation_HeaderFile + +#include +#include + +typedef NCollection_Array1 + StepFEA_Array1OfElementRepresentation; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Curve3dElementProperty.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Curve3dElementProperty.hxx new file mode 100644 index 0000000000000000000000000000000000000000..092c6674e3460f01fe5bacb01e9879f156deae49 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_Curve3dElementProperty.hxx @@ -0,0 +1,90 @@ +// Created on: 2002-12-12 +// Created by: data exchange team +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepFEA_Curve3dElementProperty_HeaderFile +#define _StepFEA_Curve3dElementProperty_HeaderFile + +#include + +#include +#include +#include +#include +class TCollection_HAsciiString; + +class StepFEA_Curve3dElementProperty; +DEFINE_STANDARD_HANDLE(StepFEA_Curve3dElementProperty, Standard_Transient) + +//! Representation of STEP entity Curve3dElementProperty +class StepFEA_Curve3dElementProperty : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepFEA_Curve3dElementProperty(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init( + const Handle(TCollection_HAsciiString)& aPropertyId, + const Handle(TCollection_HAsciiString)& aDescription, + const Handle(StepFEA_HArray1OfCurveElementInterval)& aIntervalDefinitions, + const Handle(StepFEA_HArray1OfCurveElementEndOffset)& aEndOffsets, + const Handle(StepFEA_HArray1OfCurveElementEndRelease)& aEndReleases); + + //! Returns field PropertyId + Standard_EXPORT Handle(TCollection_HAsciiString) PropertyId() const; + + //! Set field PropertyId + Standard_EXPORT void SetPropertyId(const Handle(TCollection_HAsciiString)& PropertyId); + + //! Returns field Description + Standard_EXPORT Handle(TCollection_HAsciiString) Description() const; + + //! Set field Description + Standard_EXPORT void SetDescription(const Handle(TCollection_HAsciiString)& Description); + + //! Returns field IntervalDefinitions + Standard_EXPORT Handle(StepFEA_HArray1OfCurveElementInterval) IntervalDefinitions() const; + + //! Set field IntervalDefinitions + Standard_EXPORT void SetIntervalDefinitions( + const Handle(StepFEA_HArray1OfCurveElementInterval)& IntervalDefinitions); + + //! Returns field EndOffsets + Standard_EXPORT Handle(StepFEA_HArray1OfCurveElementEndOffset) EndOffsets() const; + + //! Set field EndOffsets + Standard_EXPORT void SetEndOffsets( + const Handle(StepFEA_HArray1OfCurveElementEndOffset)& EndOffsets); + + //! Returns field EndReleases + Standard_EXPORT Handle(StepFEA_HArray1OfCurveElementEndRelease) EndReleases() const; + + //! Set field EndReleases + Standard_EXPORT void SetEndReleases( + const Handle(StepFEA_HArray1OfCurveElementEndRelease)& EndReleases); + + DEFINE_STANDARD_RTTIEXT(StepFEA_Curve3dElementProperty, Standard_Transient) + +protected: +private: + Handle(TCollection_HAsciiString) thePropertyId; + Handle(TCollection_HAsciiString) theDescription; + Handle(StepFEA_HArray1OfCurveElementInterval) theIntervalDefinitions; + Handle(StepFEA_HArray1OfCurveElementEndOffset) theEndOffsets; + Handle(StepFEA_HArray1OfCurveElementEndRelease) theEndReleases; +}; + +#endif // _StepFEA_Curve3dElementProperty_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_FeaAreaDensity.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_FeaAreaDensity.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9b4c068538d19458019792f9815e1bf31ad0bee2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_FeaAreaDensity.hxx @@ -0,0 +1,54 @@ +// Created on: 2002-12-12 +// Created by: data exchange team +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepFEA_FeaAreaDensity_HeaderFile +#define _StepFEA_FeaAreaDensity_HeaderFile + +#include +#include + +#include +#include +class TCollection_HAsciiString; + +class StepFEA_FeaAreaDensity; +DEFINE_STANDARD_HANDLE(StepFEA_FeaAreaDensity, StepFEA_FeaMaterialPropertyRepresentationItem) + +//! Representation of STEP entity FeaAreaDensity +class StepFEA_FeaAreaDensity : public StepFEA_FeaMaterialPropertyRepresentationItem +{ + +public: + //! Empty constructor + Standard_EXPORT StepFEA_FeaAreaDensity(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aRepresentationItem_Name, + const Standard_Real aFeaConstant); + + //! Returns field FeaConstant + Standard_EXPORT Standard_Real FeaConstant() const; + + //! Set field FeaConstant + Standard_EXPORT void SetFeaConstant(const Standard_Real FeaConstant); + + DEFINE_STANDARD_RTTIEXT(StepFEA_FeaAreaDensity, StepFEA_FeaMaterialPropertyRepresentationItem) + +protected: +private: + Standard_Real theFeaConstant; +}; + +#endif // _StepFEA_FeaAreaDensity_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_SequenceOfNodeRepresentation.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_SequenceOfNodeRepresentation.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f4591cd355b6f90a656a83ddc4449a0391ab2421 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepFEA_SequenceOfNodeRepresentation.hxx @@ -0,0 +1,23 @@ +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepFEA_SequenceOfNodeRepresentation_HeaderFile +#define StepFEA_SequenceOfNodeRepresentation_HeaderFile + +#include +#include + +typedef NCollection_Sequence + StepFEA_SequenceOfNodeRepresentation; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_BSplineCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_BSplineCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..37f7bf03ec02791804c0e33a099975a46091adbf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_BSplineCurve.hxx @@ -0,0 +1,85 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepGeom_BSplineCurve_HeaderFile +#define _StepGeom_BSplineCurve_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +class TCollection_HAsciiString; +class StepGeom_CartesianPoint; + +class StepGeom_BSplineCurve; +DEFINE_STANDARD_HANDLE(StepGeom_BSplineCurve, StepGeom_BoundedCurve) + +class StepGeom_BSplineCurve : public StepGeom_BoundedCurve +{ + +public: + //! Returns a BSplineCurve + Standard_EXPORT StepGeom_BSplineCurve(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName, + const Standard_Integer aDegree, + const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList, + const StepGeom_BSplineCurveForm aCurveForm, + const StepData_Logical aClosedCurve, + const StepData_Logical aSelfIntersect); + + Standard_EXPORT void SetDegree(const Standard_Integer aDegree); + + Standard_EXPORT Standard_Integer Degree() const; + + Standard_EXPORT void SetControlPointsList( + const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList); + + Standard_EXPORT Handle(StepGeom_HArray1OfCartesianPoint) ControlPointsList() const; + + Standard_EXPORT Handle(StepGeom_CartesianPoint) ControlPointsListValue( + const Standard_Integer num) const; + + Standard_EXPORT Standard_Integer NbControlPointsList() const; + + Standard_EXPORT void SetCurveForm(const StepGeom_BSplineCurveForm aCurveForm); + + Standard_EXPORT StepGeom_BSplineCurveForm CurveForm() const; + + Standard_EXPORT void SetClosedCurve(const StepData_Logical aClosedCurve); + + Standard_EXPORT StepData_Logical ClosedCurve() const; + + Standard_EXPORT void SetSelfIntersect(const StepData_Logical aSelfIntersect); + + Standard_EXPORT StepData_Logical SelfIntersect() const; + + DEFINE_STANDARD_RTTIEXT(StepGeom_BSplineCurve, StepGeom_BoundedCurve) + +protected: +private: + Standard_Integer degree; + Handle(StepGeom_HArray1OfCartesianPoint) controlPointsList; + StepGeom_BSplineCurveForm curveForm; + StepData_Logical closedCurve; + StepData_Logical selfIntersect; +}; + +#endif // _StepGeom_BSplineCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_IntersectionCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_IntersectionCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..9f7aeafc952fcab045726292f6bf57cc5a2a1c8d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_IntersectionCurve.hxx @@ -0,0 +1,40 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepGeom_IntersectionCurve_HeaderFile +#define _StepGeom_IntersectionCurve_HeaderFile + +#include + +#include + +class StepGeom_IntersectionCurve; +DEFINE_STANDARD_HANDLE(StepGeom_IntersectionCurve, StepGeom_SurfaceCurve) + +class StepGeom_IntersectionCurve : public StepGeom_SurfaceCurve +{ + +public: + //! Returns a IntersectionCurve + Standard_EXPORT StepGeom_IntersectionCurve(); + + DEFINE_STANDARD_RTTIEXT(StepGeom_IntersectionCurve, StepGeom_SurfaceCurve) + +protected: +private: +}; + +#endif // _StepGeom_IntersectionCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_SurfaceBoundary.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_SurfaceBoundary.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1d8d400bec3a5da2f59054e0abfdc1720091bb26 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_SurfaceBoundary.hxx @@ -0,0 +1,55 @@ +// Created on: 1999-11-26 +// Created by: Andrey BETENEV +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepGeom_SurfaceBoundary_HeaderFile +#define _StepGeom_SurfaceBoundary_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepGeom_BoundaryCurve; +class StepGeom_DegeneratePcurve; + +//! Representation of STEP SELECT type SurfaceBoundary +class StepGeom_SurfaceBoundary : public StepData_SelectType +{ +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + Standard_EXPORT StepGeom_SurfaceBoundary(); + + //! Recognizes a kind of SurfaceBoundary select type + //! 1 -> BoundaryCurve from StepGeom + //! 2 -> DegeneratePcurve from StepGeom + //! 0 else + Standard_EXPORT Standard_Integer CaseNum(const Handle(Standard_Transient)& ent) const; + + //! Returns Value as BoundaryCurve (or Null if another type) + Standard_EXPORT Handle(StepGeom_BoundaryCurve) BoundaryCurve() const; + + //! Returns Value as DegeneratePcurve (or Null if another type) + Standard_EXPORT Handle(StepGeom_DegeneratePcurve) DegeneratePcurve() const; + +protected: +private: +}; + +#endif // _StepGeom_SurfaceBoundary_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_UniformCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_UniformCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..29b2f47447206ab93eade2058907f648795f22eb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepGeom_UniformCurve.hxx @@ -0,0 +1,41 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepGeom_UniformCurve_HeaderFile +#define _StepGeom_UniformCurve_HeaderFile + +#include +#include + +#include + +class StepGeom_UniformCurve; +DEFINE_STANDARD_HANDLE(StepGeom_UniformCurve, StepGeom_BSplineCurve) + +class StepGeom_UniformCurve : public StepGeom_BSplineCurve +{ + +public: + //! Returns a UniformCurve + Standard_EXPORT StepGeom_UniformCurve(); + + DEFINE_STANDARD_RTTIEXT(StepGeom_UniformCurve, StepGeom_BSplineCurve) + +protected: +private: +}; + +#endif // _StepGeom_UniformCurve_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_ActuatedDirection.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_ActuatedDirection.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2520606c9d64006ed32b6195d132bc22c11f110c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_ActuatedDirection.hxx @@ -0,0 +1,27 @@ +// Created on : Sat May 02 12:41:15 2020 +// Created by: Irina KRYLOVA +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepKinematics_ActuatedDirection_HeaderFile +#define _StepKinematics_ActuatedDirection_HeaderFile + +enum StepKinematics_ActuatedDirection +{ + StepKinematics_adBidirectional, + StepKinematics_adPositiveOnly, + StepKinematics_adNegativeOnly, + StepKinematics_adNotActuated +}; +#endif // _StepKinematics_ActuatedDirection_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_MechanismStateRepresentation.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_MechanismStateRepresentation.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ba647238180b684df5cdf2c53d377bbc7c554527 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_MechanismStateRepresentation.hxx @@ -0,0 +1,51 @@ +// Created on: 2020-06-18 +// Created by: PASUKHIN DMITRY +// Copyright (c) 2020 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepKinematics_MechanismStateRepresentation_HeaderFile +#define _StepKinematics_MechanismStateRepresentation_HeaderFile + +#include +#include + +#include + +class StepKinematics_MechanismRepresentation; + +class StepKinematics_MechanismStateRepresentation; +DEFINE_STANDARD_HANDLE(StepKinematics_MechanismStateRepresentation, StepRepr_Representation) + +class StepKinematics_MechanismStateRepresentation : public StepRepr_Representation +{ +public: + //! Returns a MechanismStateRepresentation + Standard_EXPORT StepKinematics_MechanismStateRepresentation(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName, + const Handle(StepRepr_HArray1OfRepresentationItem)& theItems, + const Handle(StepRepr_RepresentationContext)& theContextOfItems, + const Handle(StepKinematics_MechanismRepresentation)& theMechanism); + + Standard_EXPORT void SetMechanism( + const Handle(StepKinematics_MechanismRepresentation)& theMechanism); + + Standard_EXPORT Handle(StepKinematics_MechanismRepresentation) Mechanism() const; + +private: + Handle(StepKinematics_MechanismRepresentation) myRepresentedMechanism; + + DEFINE_STANDARD_RTTIEXT(StepKinematics_MechanismStateRepresentation, StepRepr_Representation) +}; + +#endif // _StepKinematics_MechanismStateRepresentation_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_OrientedJoint.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_OrientedJoint.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7e590272343df94907af16e44bd05856a0486dfe --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_OrientedJoint.hxx @@ -0,0 +1,36 @@ +// Created on : Sat May 02 12:41:15 2020 +// Created by: Irina KRYLOVA +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepKinematics_OrientedJoint_HeaderFile_ +#define _StepKinematics_OrientedJoint_HeaderFile_ + +#include +#include + +#include + +DEFINE_STANDARD_HANDLE(StepKinematics_OrientedJoint, StepShape_OrientedEdge) + +//! Representation of STEP entity OrientedJoint +class StepKinematics_OrientedJoint : public StepShape_OrientedEdge +{ +public: + //! default constructor + Standard_EXPORT StepKinematics_OrientedJoint(); + + DEFINE_STANDARD_RTTIEXT(StepKinematics_OrientedJoint, StepShape_OrientedEdge) +}; +#endif // _StepKinematics_OrientedJoint_HeaderFile_ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_RollingSurfacePairValue.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_RollingSurfacePairValue.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b13070f147e6678f635627164e7c20769d6db0bf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepKinematics_RollingSurfacePairValue.hxx @@ -0,0 +1,59 @@ +// Created on : Sat May 02 12:41:16 2020 +// Created by: Irina KRYLOVA +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepKinematics_RollingSurfacePairValue_HeaderFile_ +#define _StepKinematics_RollingSurfacePairValue_HeaderFile_ + +#include +#include + +#include +#include +#include + +DEFINE_STANDARD_HANDLE(StepKinematics_RollingSurfacePairValue, StepKinematics_PairValue) + +//! Representation of STEP entity RollingSurfacePairValue +class StepKinematics_RollingSurfacePairValue : public StepKinematics_PairValue +{ +public: + //! default constructor + Standard_EXPORT StepKinematics_RollingSurfacePairValue(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theRepresentationItem_Name, + const Handle(StepKinematics_KinematicPair)& thePairValue_AppliesToPair, + const Handle(StepGeom_PointOnSurface)& theActualPointOnSurface, + const Standard_Real theActualRotation); + + //! Returns field ActualPointOnSurface + Standard_EXPORT Handle(StepGeom_PointOnSurface) ActualPointOnSurface() const; + //! Sets field ActualPointOnSurface + Standard_EXPORT void SetActualPointOnSurface( + const Handle(StepGeom_PointOnSurface)& theActualPointOnSurface); + + //! Returns field ActualRotation + Standard_EXPORT Standard_Real ActualRotation() const; + //! Sets field ActualRotation + Standard_EXPORT void SetActualRotation(const Standard_Real theActualRotation); + + DEFINE_STANDARD_RTTIEXT(StepKinematics_RollingSurfacePairValue, StepKinematics_PairValue) + +private: + Handle(StepGeom_PointOnSurface) myActualPointOnSurface; + Standard_Real myActualRotation; +}; +#endif // _StepKinematics_RollingSurfacePairValue_HeaderFile_ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_DescriptiveRepresentationItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_DescriptiveRepresentationItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..03bb70beb80e064a2fb02842604596f9fd2170a7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_DescriptiveRepresentationItem.hxx @@ -0,0 +1,50 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepRepr_DescriptiveRepresentationItem_HeaderFile +#define _StepRepr_DescriptiveRepresentationItem_HeaderFile + +#include +#include + +#include +class TCollection_HAsciiString; + +class StepRepr_DescriptiveRepresentationItem; +DEFINE_STANDARD_HANDLE(StepRepr_DescriptiveRepresentationItem, StepRepr_RepresentationItem) + +class StepRepr_DescriptiveRepresentationItem : public StepRepr_RepresentationItem +{ + +public: + //! Returns a DescriptiveRepresentationItem + Standard_EXPORT StepRepr_DescriptiveRepresentationItem(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName, + const Handle(TCollection_HAsciiString)& aDescription); + + Standard_EXPORT void SetDescription(const Handle(TCollection_HAsciiString)& aDescription); + + Standard_EXPORT Handle(TCollection_HAsciiString) Description() const; + + DEFINE_STANDARD_RTTIEXT(StepRepr_DescriptiveRepresentationItem, StepRepr_RepresentationItem) + +protected: +private: + Handle(TCollection_HAsciiString) description; +}; + +#endif // _StepRepr_DescriptiveRepresentationItem_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_SequenceOfRepresentationItem.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_SequenceOfRepresentationItem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e711e0d5a61d86f1ca39cda0e105d2fd8248bfc4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepRepr_SequenceOfRepresentationItem.hxx @@ -0,0 +1,26 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepRepr_SequenceOfRepresentationItem_HeaderFile +#define StepRepr_SequenceOfRepresentationItem_HeaderFile + +#include +#include + +typedef NCollection_Sequence + StepRepr_SequenceOfRepresentationItem; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepSelect_StepType.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepSelect_StepType.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2d3793540a94e46358c90bb653fd9fcc11c33459 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepSelect_StepType.hxx @@ -0,0 +1,71 @@ +// Created on: 1994-12-22 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepSelect_StepType_HeaderFile +#define _StepSelect_StepType_HeaderFile + +#include +#include + +#include +#include +#include +class StepData_Protocol; +class Interface_Protocol; +class Standard_Transient; +class Interface_InterfaceModel; + +class StepSelect_StepType; +DEFINE_STANDARD_HANDLE(StepSelect_StepType, IFSelect_Signature) + +//! StepType is a Signature specific to Step definitions : it +//! considers the type as defined in STEP Schemas, the same which +//! is used in files. +//! For a Complex Type, if its definition is known, StepType +//! produces the list of basic types, separated by commas, the +//! whole between brackets : "(TYPE1,TYPE2..)". +//! If its precise definition is not known (simply it is known as +//! Complex, it can be recognised, but the list is produced at +//! Write time only), StepType produces : "(..COMPLEX TYPE..)" +class StepSelect_StepType : public IFSelect_Signature +{ + +public: + //! Creates a Signature for Step Type. Protocol is undefined here, + //! hence no Signature may yet be produced. The StepType signature + //! requires a Protocol before working + Standard_EXPORT StepSelect_StepType(); + + //! Sets the StepType signature to work with a Protocol : this + //! initialises the library + Standard_EXPORT void SetProtocol(const Handle(Interface_Protocol)& proto); + + //! Returns the Step Type defined from the Protocol (see above). + //! If is not recognised, produces "..NOT FROM SCHEMA .." + Standard_EXPORT Standard_CString + Value(const Handle(Standard_Transient)& ent, + const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(StepSelect_StepType, IFSelect_Signature) + +protected: + StepData_WriterLib thelib; + +private: + Handle(StepData_Protocol) theproto; +}; + +#endif // _StepSelect_StepType_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_AngleRelator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_AngleRelator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b79af0d5f840db3c865a76c640ae60f9b943d122 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_AngleRelator.hxx @@ -0,0 +1,27 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepShape_AngleRelator_HeaderFile +#define _StepShape_AngleRelator_HeaderFile + +enum StepShape_AngleRelator +{ + StepShape_Equal, + StepShape_Large, + StepShape_Small +}; + +#endif // _StepShape_AngleRelator_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_Block.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_Block.hxx new file mode 100644 index 0000000000000000000000000000000000000000..33208d1fd46e152e05d69ffa917ecb77d6497842 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_Block.hxx @@ -0,0 +1,69 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepShape_Block_HeaderFile +#define _StepShape_Block_HeaderFile + +#include +#include + +#include +class StepGeom_Axis2Placement3d; +class TCollection_HAsciiString; + +class StepShape_Block; +DEFINE_STANDARD_HANDLE(StepShape_Block, StepGeom_GeometricRepresentationItem) + +class StepShape_Block : public StepGeom_GeometricRepresentationItem +{ + +public: + //! Returns a Block + Standard_EXPORT StepShape_Block(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName, + const Handle(StepGeom_Axis2Placement3d)& aPosition, + const Standard_Real aX, + const Standard_Real aY, + const Standard_Real aZ); + + Standard_EXPORT void SetPosition(const Handle(StepGeom_Axis2Placement3d)& aPosition); + + Standard_EXPORT Handle(StepGeom_Axis2Placement3d) Position() const; + + Standard_EXPORT void SetX(const Standard_Real aX); + + Standard_EXPORT Standard_Real X() const; + + Standard_EXPORT void SetY(const Standard_Real aY); + + Standard_EXPORT Standard_Real Y() const; + + Standard_EXPORT void SetZ(const Standard_Real aZ); + + Standard_EXPORT Standard_Real Z() const; + + DEFINE_STANDARD_RTTIEXT(StepShape_Block, StepGeom_GeometricRepresentationItem) + +protected: +private: + Handle(StepGeom_Axis2Placement3d) position; + Standard_Real x; + Standard_Real y; + Standard_Real z; +}; + +#endif // _StepShape_Block_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_BoxedHalfSpace.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_BoxedHalfSpace.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3e05e6977779edcaf218e64c3692b9815e4e8b17 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_BoxedHalfSpace.hxx @@ -0,0 +1,54 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepShape_BoxedHalfSpace_HeaderFile +#define _StepShape_BoxedHalfSpace_HeaderFile + +#include +#include + +#include +class StepShape_BoxDomain; +class TCollection_HAsciiString; +class StepGeom_Surface; + +class StepShape_BoxedHalfSpace; +DEFINE_STANDARD_HANDLE(StepShape_BoxedHalfSpace, StepShape_HalfSpaceSolid) + +class StepShape_BoxedHalfSpace : public StepShape_HalfSpaceSolid +{ + +public: + //! Returns a BoxedHalfSpace + Standard_EXPORT StepShape_BoxedHalfSpace(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& aName, + const Handle(StepGeom_Surface)& aBaseSurface, + const Standard_Boolean aAgreementFlag, + const Handle(StepShape_BoxDomain)& aEnclosure); + + Standard_EXPORT void SetEnclosure(const Handle(StepShape_BoxDomain)& aEnclosure); + + Standard_EXPORT Handle(StepShape_BoxDomain) Enclosure() const; + + DEFINE_STANDARD_RTTIEXT(StepShape_BoxedHalfSpace, StepShape_HalfSpaceSolid) + +protected: +private: + Handle(StepShape_BoxDomain) enclosure; +}; + +#endif // _StepShape_BoxedHalfSpace_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_DimensionalSize.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_DimensionalSize.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f537fd5334c067560522472363afcc1f65226334 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_DimensionalSize.hxx @@ -0,0 +1,61 @@ +// Created on: 2000-04-18 +// Created by: Andrey BETENEV +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepShape_DimensionalSize_HeaderFile +#define _StepShape_DimensionalSize_HeaderFile + +#include +#include + +#include +class StepRepr_ShapeAspect; +class TCollection_HAsciiString; + +class StepShape_DimensionalSize; +DEFINE_STANDARD_HANDLE(StepShape_DimensionalSize, Standard_Transient) + +//! Representation of STEP entity DimensionalSize +class StepShape_DimensionalSize : public Standard_Transient +{ + +public: + //! Empty constructor + Standard_EXPORT StepShape_DimensionalSize(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Handle(StepRepr_ShapeAspect)& aAppliesTo, + const Handle(TCollection_HAsciiString)& aName); + + //! Returns field AppliesTo + Standard_EXPORT Handle(StepRepr_ShapeAspect) AppliesTo() const; + + //! Set field AppliesTo + Standard_EXPORT void SetAppliesTo(const Handle(StepRepr_ShapeAspect)& AppliesTo); + + //! Returns field Name + Standard_EXPORT Handle(TCollection_HAsciiString) Name() const; + + //! Set field Name + Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& Name); + + DEFINE_STANDARD_RTTIEXT(StepShape_DimensionalSize, Standard_Transient) + +protected: +private: + Handle(StepRepr_ShapeAspect) theAppliesTo; + Handle(TCollection_HAsciiString) theName; +}; + +#endif // _StepShape_DimensionalSize_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_FacetedBrep.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_FacetedBrep.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3e1ed70f3934303ca57260728c9c0e1ab0bd7498 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_FacetedBrep.hxx @@ -0,0 +1,41 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepShape_FacetedBrep_HeaderFile +#define _StepShape_FacetedBrep_HeaderFile + +#include +#include + +#include + +class StepShape_FacetedBrep; +DEFINE_STANDARD_HANDLE(StepShape_FacetedBrep, StepShape_ManifoldSolidBrep) + +class StepShape_FacetedBrep : public StepShape_ManifoldSolidBrep +{ + +public: + //! Returns a FacetedBrep + Standard_EXPORT StepShape_FacetedBrep(); + + DEFINE_STANDARD_RTTIEXT(StepShape_FacetedBrep, StepShape_ManifoldSolidBrep) + +protected: +private: +}; + +#endif // _StepShape_FacetedBrep_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepShape_HArray1OfConnectedEdgeSet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_HArray1OfConnectedEdgeSet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..c4ce121b14a3b0b56ebad4409af752412f1c3c1a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepShape_HArray1OfConnectedEdgeSet.hxx @@ -0,0 +1,25 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepShape_HArray1OfConnectedEdgeSet_HeaderFile +#define StepShape_HArray1OfConnectedEdgeSet_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepShape_HArray1OfConnectedEdgeSet, StepShape_Array1OfConnectedEdgeSet) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepToTopoDS_PointPair.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepToTopoDS_PointPair.hxx new file mode 100644 index 0000000000000000000000000000000000000000..690560c5c69d162617c71374fe7158d7dca57b8a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepToTopoDS_PointPair.hxx @@ -0,0 +1,71 @@ +// Created on: 1993-08-06 +// Created by: Martine LANGLOIS +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepToTopoDS_PointPair_HeaderFile +#define _StepToTopoDS_PointPair_HeaderFile + +#include +#include +#include + +class StepGeom_CartesianPoint; + +//! Stores a pair of Points from step +class StepToTopoDS_PointPair +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT StepToTopoDS_PointPair(const Handle(StepGeom_CartesianPoint)& P1, + const Handle(StepGeom_CartesianPoint)& P2); + + const Handle(StepGeom_CartesianPoint)& GetPoint1() const { return myP1; } + + const Handle(StepGeom_CartesianPoint)& GetPoint2() const { return myP2; } + + bool operator==(const StepToTopoDS_PointPair& thePointPair) const + { + return (((myP1 == thePointPair.myP1) && (myP2 == thePointPair.myP2)) + || ((myP1 == thePointPair.myP2) && (myP2 == thePointPair.myP1))); + } + +protected: +private: + Handle(StepGeom_CartesianPoint) myP1; + Handle(StepGeom_CartesianPoint) myP2; +}; + +namespace std +{ +template <> +struct hash +{ + size_t operator()(const StepToTopoDS_PointPair& thePointPair) const noexcept + { + // Combine two int values into a single hash value. + size_t aCombination[2]; + aCombination[0] = std::hash{}(thePointPair.GetPoint1()); + aCombination[1] = std::hash{}(thePointPair.GetPoint2()); + if (aCombination[0] > aCombination[1]) + { + std::swap(aCombination[0], aCombination[1]); + } + return opencascade::hashBytes(aCombination, sizeof(aCombination)); + } +}; +} // namespace std + +#endif // _StepToTopoDS_PointPair_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_BackgroundColour.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_BackgroundColour.hxx new file mode 100644 index 0000000000000000000000000000000000000000..6a6c25e7dbab507400e7dcea8c05ee2c34930b1e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_BackgroundColour.hxx @@ -0,0 +1,48 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_BackgroundColour_HeaderFile +#define _StepVisual_BackgroundColour_HeaderFile + +#include + +#include +#include + +class StepVisual_BackgroundColour; +DEFINE_STANDARD_HANDLE(StepVisual_BackgroundColour, StepVisual_Colour) + +class StepVisual_BackgroundColour : public StepVisual_Colour +{ + +public: + //! Returns a BackgroundColour + Standard_EXPORT StepVisual_BackgroundColour(); + + Standard_EXPORT void Init(const StepVisual_AreaOrView& aPresentation); + + Standard_EXPORT void SetPresentation(const StepVisual_AreaOrView& aPresentation); + + Standard_EXPORT StepVisual_AreaOrView Presentation() const; + + DEFINE_STANDARD_RTTIEXT(StepVisual_BackgroundColour, StepVisual_Colour) + +protected: +private: + StepVisual_AreaOrView presentation; +}; + +#endif // _StepVisual_BackgroundColour_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CameraModelD3MultiClipping.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CameraModelD3MultiClipping.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a8757890bea8201399ba144d30a3d15d42739d83 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CameraModelD3MultiClipping.hxx @@ -0,0 +1,58 @@ +// Created on: 2016-10-25 +// Created by: Irina KRYLOVA +// Copyright (c) 2016 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_CameraModelD3MultiClipping_HeaderFile +#define _StepVisual_CameraModelD3MultiClipping_HeaderFile + +#include +#include + +#include +class StepGeom_Axis2Placement3d; +class StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect; +class StepVisual_ViewVolume; +class TCollection_HAsciiString; + +DEFINE_STANDARD_HANDLE(StepVisual_CameraModelD3MultiClipping, StepVisual_CameraModelD3) + +class StepVisual_CameraModelD3MultiClipping : public StepVisual_CameraModelD3 +{ +public: + //! Returns a CameraModelD3MultiClipping + Standard_EXPORT StepVisual_CameraModelD3MultiClipping(); + + Standard_EXPORT void Init( + const Handle(TCollection_HAsciiString)& theName, + const Handle(StepGeom_Axis2Placement3d)& theViewReferenceSystem, + const Handle(StepVisual_ViewVolume)& thePerspectiveOfVolume, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& + theShapeClipping); + + void SetShapeClipping( + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping) + { + myShapeClipping = theShapeClipping; + } + + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) ShapeClipping() + { + return myShapeClipping; + } + DEFINE_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClipping, StepVisual_CameraModelD3) + +private: + Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) myShapeClipping; +}; +#endif // _StepVisual_CameraModelD3MultiClipping_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2543200df40fb6887192989b80b418468bb90891 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel.hxx @@ -0,0 +1,41 @@ +// Created on: 2016-08-25 +// Created by: Irina KRYLOVA +// Copyright (c) 2016 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel_HeaderFile +#define _StepVisual_StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel_HeaderFile + +#include +#include + +#include + +class StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel; +DEFINE_STANDARD_HANDLE(StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel, + StepVisual_DraughtingModel) + +//! Added for Dimensional Tolerances +//! Complex STEP entity Characterized_Object & Characterized_Representation & Draughting_Model & +//! Representation +class StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel + : public StepVisual_DraughtingModel +{ + +public: + Standard_EXPORT StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel(); + + DEFINE_STANDARD_RTTIEXT(StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel, + StepVisual_DraughtingModel) +}; +#endif // _StepVisual_CharacterizedObjAndRepresentationAndDraughtingModel_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_HArray1OfPresentationStyleSelect.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_HArray1OfPresentationStyleSelect.hxx new file mode 100644 index 0000000000000000000000000000000000000000..893a683157e4c39d52e3621e845996406b195b49 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_HArray1OfPresentationStyleSelect.hxx @@ -0,0 +1,26 @@ +// Created on: 1995-12-01 +// Created by: EXPRESS->CDL V0.2 Translator +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepVisual_HArray1OfPresentationStyleSelect_HeaderFile +#define StepVisual_HArray1OfPresentationStyleSelect_HeaderFile + +#include +#include + +DEFINE_HARRAY1(StepVisual_HArray1OfPresentationStyleSelect, + StepVisual_Array1OfPresentationStyleSelect) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_SurfaceStyleRenderingWithProperties.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_SurfaceStyleRenderingWithProperties.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5ca145b6456a8e02c10c8550f627b3f2f38a8693 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_SurfaceStyleRenderingWithProperties.hxx @@ -0,0 +1,56 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ +#define _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ + +#include +#include + +#include +#include +#include + +class StepVisual_SurfaceStyleRenderingWithProperties; +DEFINE_STANDARD_HANDLE(StepVisual_SurfaceStyleRenderingWithProperties, + StepVisual_SurfaceStyleRendering) + +//! Representation of STEP entity SurfaceStyleRenderingWithProperties +class StepVisual_SurfaceStyleRenderingWithProperties : public StepVisual_SurfaceStyleRendering +{ +public: + //! default constructor + Standard_EXPORT StepVisual_SurfaceStyleRenderingWithProperties(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init( + const StepVisual_ShadingSurfaceMethod theSurfaceStyleRendering_RenderingMethod, + const Handle(StepVisual_Colour)& theSurfaceStyleRendering_SurfaceColour, + const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties); + + //! Returns field Properties + Standard_EXPORT Handle(StepVisual_HArray1OfRenderingPropertiesSelect) Properties() const; + //! Sets field Properties + Standard_EXPORT void SetProperties( + const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties); + + DEFINE_STANDARD_RTTIEXT(StepVisual_SurfaceStyleRenderingWithProperties, + StepVisual_SurfaceStyleRendering) + +private: + Handle(StepVisual_HArray1OfRenderingPropertiesSelect) myProperties; +}; +#endif // _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedEdgeOrVertex.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedEdgeOrVertex.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3e1a3905968b6ea468b15cf8e8dbb3a584d28465 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedEdgeOrVertex.hxx @@ -0,0 +1,52 @@ +// Created on : Thu Mar 24 18:30:12 2022 +// Created by: snn +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2022 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_TessellatedEdgeOrVertex_HeaderFile +#define _StepVisual_TessellatedEdgeOrVertex_HeaderFile + +#include +#include +#include +#include +#include + +class Standard_Transient; +class StepVisual_TessellatedEdge; +class StepVisual_TessellatedVertex; + +//! Representation of STEP SELECT type TessellatedEdgeOrVertex +class StepVisual_TessellatedEdgeOrVertex : public StepData_SelectType +{ + +public: + DEFINE_STANDARD_ALLOC + + //! Empty constructor + Standard_EXPORT StepVisual_TessellatedEdgeOrVertex(); + + //! Recognizes a kind of TessellatedEdgeOrVertex select type + //! -- 1 -> TessellatedEdge + //! -- 2 -> TessellatedVertex + Standard_EXPORT Standard_Integer + CaseNum(const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; + + //! Returns Value as TessellatedEdge (or Null if another type) + Standard_EXPORT Handle(StepVisual_TessellatedEdge) TessellatedEdge() const; + + //! Returns Value as TessellatedVertex (or Null if another type) + Standard_EXPORT Handle(StepVisual_TessellatedVertex) TessellatedVertex() const; +}; +#endif // _StepVisual_TessellatedEdgeOrVertex_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedGeometricSet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedGeometricSet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a7dc4d427172418538336490909eebad4db17143 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedGeometricSet.hxx @@ -0,0 +1,50 @@ +// Created on: 2015-10-29 +// Created by: Galina Kulikova +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_TessellatedGeometricSet_HeaderFile +#define _StepVisual_TessellatedGeometricSet_HeaderFile +#include +#include +#include + +#include +#include +// #include +#include + +typedef NCollection_Array1 StepVisual_Array1OfTessellatedItem; + +DEFINE_STANDARD_HANDLE(StepVisual_TessellatedGeometricSet, StepVisual_TessellatedItem) + +class StepVisual_TessellatedGeometricSet : public StepVisual_TessellatedItem +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns a DraughtingCalloutElement select type + Standard_EXPORT StepVisual_TessellatedGeometricSet(); + + Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName, + const NCollection_Handle& theItems); + + Standard_EXPORT NCollection_Handle Items() const; + +private: + NCollection_Handle myItems; + +public: + DEFINE_STANDARD_RTTIEXT(StepVisual_TessellatedGeometricSet, StepVisual_TessellatedItem) +}; +#endif // StepVisual_TessellatedGeometricSet diff --git a/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedShapeRepresentation.hxx b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedShapeRepresentation.hxx new file mode 100644 index 0000000000000000000000000000000000000000..882a4d3a795522c28bc7a10d4383b754c8e3dbe1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/StepVisual_TessellatedShapeRepresentation.hxx @@ -0,0 +1,37 @@ +// Created on : Thu Mar 24 18:30:12 2022 +// Created by: snn +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2022 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_TessellatedShapeRepresentation_HeaderFile_ +#define _StepVisual_TessellatedShapeRepresentation_HeaderFile_ + +#include +#include +#include + +DEFINE_STANDARD_HANDLE(StepVisual_TessellatedShapeRepresentation, StepShape_ShapeRepresentation) + +//! Representation of STEP entity TessellatedShapeRepresentation +class StepVisual_TessellatedShapeRepresentation : public StepShape_ShapeRepresentation +{ + +public: + //! default constructor + Standard_EXPORT StepVisual_TessellatedShapeRepresentation(); + + DEFINE_STANDARD_RTTIEXT(StepVisual_TessellatedShapeRepresentation, StepShape_ShapeRepresentation) +}; + +#endif // _StepVisual_TessellatedShapeRepresentation_HeaderFile_ diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Storage_SolveMode.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Storage_SolveMode.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1e12ac7f724786ed639105844d3abdedd259ff9a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Storage_SolveMode.hxx @@ -0,0 +1,27 @@ +// Created on: 1996-04-30 +// Created by: cle +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Storage_SolveMode_HeaderFile +#define _Storage_SolveMode_HeaderFile + +enum Storage_SolveMode +{ + Storage_AddSolve, + Storage_WriteSolve, + Storage_ReadSolve +}; + +#endif // _Storage_SolveMode_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Sweep_NumShapeIterator.lxx b/data/miniconda3/envs/catiagent/include/opencascade/Sweep_NumShapeIterator.lxx new file mode 100644 index 0000000000000000000000000000000000000000..d2e579652e201a271d3fedd3c9b2918aad14a8a9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Sweep_NumShapeIterator.lxx @@ -0,0 +1,45 @@ +// Created on: 1993-06-04 +// Created by: Laurent BOURESCHE +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +//======================================================================= +// function : More +// purpose : +//======================================================================= + +inline Standard_Boolean Sweep_NumShapeIterator::More() const +{ + return myMore; +} + +//======================================================================= +// function : Value +// purpose : +//======================================================================= + +inline const Sweep_NumShape& Sweep_NumShapeIterator::Value() const +{ + return myCurrentNumShape; +} + +//======================================================================= +// function : Orientation +// purpose : +//======================================================================= + +inline TopAbs_Orientation Sweep_NumShapeIterator::Orientation() const +{ + return myCurrentOrientation; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray1OfListOfInteger.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray1OfListOfInteger.hxx new file mode 100644 index 0000000000000000000000000000000000000000..03eb396f8922124551d9e4138987ad27e86bc40e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray1OfListOfInteger.hxx @@ -0,0 +1,23 @@ +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TColStd_HArray1OfListOfInteger_HeaderFile +#define TColStd_HArray1OfListOfInteger_HeaderFile + +#include +#include + +DEFINE_HARRAY1(TColStd_HArray1OfListOfInteger, TColStd_Array1OfListOfInteger) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray2OfCharacter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray2OfCharacter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3d2985edce55d6a0afd4ddce9a6fc4f499ae6463 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TColStd_HArray2OfCharacter.hxx @@ -0,0 +1,24 @@ +// Copyright (c) 1998-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TColStd_HArray2OfCharacter_HeaderFile +#define TColStd_HArray2OfCharacter_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY2(TColStd_HArray2OfCharacter, TColStd_Array2OfCharacter) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TColgp_Array2OfVec.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_Array2OfVec.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ef766d79d8d6a773a874f90df576812c838d4e94 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_Array2OfVec.hxx @@ -0,0 +1,25 @@ +// Created on: 1993-03-10 +// Created by: Philippe DAUTRY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TColgp_Array2OfVec_HeaderFile +#define TColgp_Array2OfVec_HeaderFile + +#include +#include + +typedef NCollection_Array2 TColgp_Array2OfVec; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray1OfDir2d.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray1OfDir2d.hxx new file mode 100644 index 0000000000000000000000000000000000000000..665f0d1e6e72d02d6f0675bcf92e481e8b8be4ca --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray1OfDir2d.hxx @@ -0,0 +1,26 @@ +// Created on: 1993-03-10 +// Created by: Philippe DAUTRY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TColgp_HArray1OfDir2d_HeaderFile +#define TColgp_HArray1OfDir2d_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(TColgp_HArray1OfDir2d, TColgp_Array1OfDir2d) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray2OfXY.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray2OfXY.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5190e23d2a9a88484a2fa87d4fa83e9fb3a87558 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TColgp_HArray2OfXY.hxx @@ -0,0 +1,26 @@ +// Created on: 1993-03-10 +// Created by: Philippe DAUTRY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TColgp_HArray2OfXY_HeaderFile +#define TColgp_HArray2OfXY_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY2(TColgp_HArray2OfXY, TColgp_Array2OfXY) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDF_AttributeMap.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDF_AttributeMap.hxx new file mode 100644 index 0000000000000000000000000000000000000000..219465a5465172cb96c60dc62e30d0db3bf08550 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDF_AttributeMap.hxx @@ -0,0 +1,25 @@ +// Created by: DAUTRY Philippe +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TDF_AttributeMap_HeaderFile +#define TDF_AttributeMap_HeaderFile + +#include +#include + +typedef NCollection_Map TDF_AttributeMap; +typedef NCollection_Map::Iterator TDF_MapIteratorOfAttributeMap; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDF_Data.lxx b/data/miniconda3/envs/catiagent/include/opencascade/TDF_Data.lxx new file mode 100644 index 0000000000000000000000000000000000000000..c678f1c9b6fe502e6709996f43ad153aafe348f0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDF_Data.lxx @@ -0,0 +1,60 @@ +// Created by: DAUTRY Philippe +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// ------------- + +// Version: 0.0 +// Version Date Purpose +// 0.0 Feb 6 1997 Creation + +inline Standard_Integer TDF_Data::Transaction() const +{ + return myTransaction; +} + +inline const TDF_Label TDF_Data::Root() const +{ + return TDF_Label(myRoot); +} + +inline Standard_Integer TDF_Data::Time() const +{ + return myTime; +} + +inline Standard_Boolean TDF_Data::NotUndoMode() const +{ + return myNotUndoMode; +} + +inline Standard_OStream& operator<<(Standard_OStream& anOS, const Handle(TDF_Data)& aDF) +{ + return aDF->Dump(anOS); +} + +inline void TDF_Data::AllowModification(const Standard_Boolean theAllowModification) +{ + myAllowModification = theAllowModification; +} + +inline Standard_Boolean TDF_Data::IsModificationAllowed() const +{ + return myAllowModification; +} + +inline const Handle(NCollection_BaseAllocator)& TDF_Data::LabelNodeAllocator() const +{ + return myLabelNodeAllocator; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfAttributeList.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfAttributeList.hxx new file mode 100644 index 0000000000000000000000000000000000000000..994b1659b856db2009c857a39ffef53450befd10 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfAttributeList.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TDF_ListIteratorOfAttributeList_HeaderFile +#define TDF_ListIteratorOfAttributeList_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfDeltaList.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfDeltaList.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bce514e248bd72f939854cbcd7c67c8f35c77a92 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDF_ListIteratorOfDeltaList.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TDF_ListIteratorOfDeltaList_HeaderFile +#define TDF_ListIteratorOfDeltaList_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_Current.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_Current.hxx new file mode 100644 index 0000000000000000000000000000000000000000..66e261d68e2d6c6e93e9721c7b2a3da3af985ecd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_Current.hxx @@ -0,0 +1,82 @@ +// Created on: 1999-08-02 +// Created by: Denis PASCAL +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TDataStd_Current_HeaderFile +#define _TDataStd_Current_HeaderFile + +#include + +#include +#include +#include +#include +class Standard_GUID; +class TDF_RelocationTable; + +class TDataStd_Current; +DEFINE_STANDARD_HANDLE(TDataStd_Current, TDF_Attribute) + +//! this attribute, located at root label, manage an +//! access to a current label. +class TDataStd_Current : public TDF_Attribute +{ + +public: + //! class methods + //! ============= + Standard_EXPORT static const Standard_GUID& GetID(); + + //! Set as current of Framework. + Standard_EXPORT static void Set(const TDF_Label& L); + + //! returns current of Framework. raise if (!Has) + Standard_EXPORT static TDF_Label Get(const TDF_Label& acces); + + //! returns True if a current label is managed in + //! Framework. + //! class methods + //! ============= + Standard_EXPORT static Standard_Boolean Has(const TDF_Label& acces); + + Standard_EXPORT TDataStd_Current(); + + Standard_EXPORT void SetLabel(const TDF_Label& current); + + Standard_EXPORT TDF_Label GetLabel() const; + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + Standard_EXPORT void Restore(const Handle(TDF_Attribute)& With) Standard_OVERRIDE; + + Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT void Paste(const Handle(TDF_Attribute)& Into, + const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_OStream& Dump(Standard_OStream& anOS) const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(TDataStd_Current, TDF_Attribute) + +protected: +private: + TDF_Label myLabel; +}; + +#endif // _TDataStd_Current_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_IntegerList.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_IntegerList.hxx new file mode 100644 index 0000000000000000000000000000000000000000..4b453092606e7031ec3f52229520b3b29190b7df --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDataStd_IntegerList.hxx @@ -0,0 +1,121 @@ +// Created on: 2007-05-29 +// Created by: Vlad Romashko +// Copyright (c) 2007-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TDataStd_IntegerList_HeaderFile +#define _TDataStd_IntegerList_HeaderFile + +#include + +#include +#include +#include +#include +#include + +class TDF_Label; +class TDF_RelocationTable; + +class TDataStd_IntegerList; +DEFINE_STANDARD_HANDLE(TDataStd_IntegerList, TDF_Attribute) + +//! Contains a list of integers. +class TDataStd_IntegerList : public TDF_Attribute +{ + +public: + //! Static methods + //! ============== + //! Returns the ID of the list of integer attribute. + Standard_EXPORT static const Standard_GUID& GetID(); + + //! Finds or creates a list of integer values attribute. + Standard_EXPORT static Handle(TDataStd_IntegerList) Set(const TDF_Label& label); + + //! Finds or creates a list of integer values attribute with explicit user defined . + Standard_EXPORT static Handle(TDataStd_IntegerList) Set(const TDF_Label& label, + const Standard_GUID& theGuid); + + Standard_EXPORT TDataStd_IntegerList(); + + Standard_EXPORT Standard_Boolean IsEmpty() const; + + Standard_EXPORT Standard_Integer Extent() const; + + Standard_EXPORT void Prepend(const Standard_Integer value); + + Standard_EXPORT void Append(const Standard_Integer value); + + //! Sets the explicit GUID (user defined) for the attribute. + Standard_EXPORT void SetID(const Standard_GUID& theGuid) Standard_OVERRIDE; + + //! Sets default GUID for the attribute. + Standard_EXPORT void SetID() Standard_OVERRIDE; + + //! Inserts the before the first meet of . + Standard_EXPORT Standard_Boolean InsertBefore(const Standard_Integer value, + const Standard_Integer before_value); + + //! Inserts the before the position. + //! The indices start with 1 .. Extent(). + Standard_EXPORT Standard_Boolean InsertBeforeByIndex(const Standard_Integer index, + const Standard_Integer before_value); + + //! Inserts the after the first meet of . + Standard_EXPORT Standard_Boolean InsertAfter(const Standard_Integer value, + const Standard_Integer after_value); + + //! Inserts the after the position. + //! The indices start with 1 .. Extent(). + Standard_EXPORT Standard_Boolean InsertAfterByIndex(const Standard_Integer index, + const Standard_Integer after_value); + + //! Removes the first meet of the . + Standard_EXPORT Standard_Boolean Remove(const Standard_Integer value); + + //! Removes a value at position. + Standard_EXPORT Standard_Boolean RemoveByIndex(const Standard_Integer index); + + Standard_EXPORT void Clear(); + + Standard_EXPORT Standard_Integer First() const; + + Standard_EXPORT Standard_Integer Last() const; + + Standard_EXPORT const TColStd_ListOfInteger& List() const; + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + Standard_EXPORT void Restore(const Handle(TDF_Attribute)& With) Standard_OVERRIDE; + + Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT void Paste(const Handle(TDF_Attribute)& Into, + const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_OStream& Dump(Standard_OStream& anOS) const Standard_OVERRIDE; + + //! Dumps the content of me into the stream + Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, + Standard_Integer theDepth = -1) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(TDataStd_IntegerList, TDF_Attribute) + +protected: +private: + TColStd_ListOfInteger myList; + Standard_GUID myID; +}; + +#endif // _TDataStd_IntegerList_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_MultiTransactionManager.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_MultiTransactionManager.hxx new file mode 100644 index 0000000000000000000000000000000000000000..968c7ec9b1814e17b69dc4b00fa09f7c360acb66 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_MultiTransactionManager.hxx @@ -0,0 +1,155 @@ +// Created on: 2002-11-18 +// Created by: Vladimir ANIKIN +// Copyright (c) 2002-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TDocStd_MultiTransactionManager_HeaderFile +#define _TDocStd_MultiTransactionManager_HeaderFile + +#include + +#include +#include +#include +#include +#include +class TCollection_ExtendedString; +class TDocStd_Document; + +class TDocStd_MultiTransactionManager; +DEFINE_STANDARD_HANDLE(TDocStd_MultiTransactionManager, Standard_Transient) + +//! Class for synchronization of transactions within multiple documents. +//! Each transaction of this class involvess one transaction in each modified document. +//! +//! The documents to be synchronized should be added explicitly to +//! the manager; then its interface is used to ensure that all transactions +//! (Open/Commit, Undo/Redo) are performed synchronously in all managed documents. +//! +//! The current implementation does not support nested transactions +//! on multitransaction manager level. It only sets the flag enabling +//! or disabling nested transactions in all its documents, so that +//! a nested transaction can be opened for each particular document +//! with TDocStd_Document class interface. +//! +//! NOTE: When you invoke CommitTransaction of multi transaction +//! manager, all nested transaction of its documents will be closed (committed). +class TDocStd_MultiTransactionManager : public Standard_Transient +{ + +public: + //! Constructor + Standard_EXPORT TDocStd_MultiTransactionManager(); + + //! Sets undo limit for the manager and all documents. + Standard_EXPORT void SetUndoLimit(const Standard_Integer theLimit); + + //! Returns undo limit for the manager. + Standard_Integer GetUndoLimit() const; + + //! Undoes the current transaction of the manager. + //! It calls the Undo () method of the document being + //! on top of the manager list of undos (list.First()) + //! and moves the list item to the top of the list of manager + //! redos (list.Prepend(item)). + Standard_EXPORT void Undo(); + + //! Redoes the current transaction of the application. It calls + //! the Redo () method of the document being on top of the + //! manager list of redos (list.First()) and moves the list + //! item to the top of the list of manager undos (list.Prepend(item)). + Standard_EXPORT void Redo(); + + //! Returns available manager undos. + const TDocStd_SequenceOfApplicationDelta& GetAvailableUndos() const; + + //! Returns available manager redos. + const TDocStd_SequenceOfApplicationDelta& GetAvailableRedos() const; + + //! Opens transaction in each document and sets the flag that + //! transaction is opened. If there are already opened transactions in the documents, + //! these transactions will be aborted before opening new ones. + Standard_EXPORT void OpenCommand(); + + //! Unsets the flag of started manager transaction and aborts + //! transaction in each document. + Standard_EXPORT void AbortCommand(); + + //! Commits transaction in all documents and fills the transaction manager + //! with the documents that have been changed during the transaction. + //! Returns True if new data has been added to myUndos. + //! NOTE: All nested transactions in the documents will be committed. + Standard_EXPORT Standard_Boolean CommitCommand(); + + //! Makes the same steps as the previous function but defines the name for transaction. + //! Returns True if new data has been added to myUndos. + Standard_EXPORT Standard_Boolean CommitCommand(const TCollection_ExtendedString& theName); + + //! Returns true if a transaction is opened. + Standard_Boolean HasOpenCommand() const; + + //! Removes undo information from the list of undos of the manager and + //! all documents which have been modified during the transaction. + Standard_EXPORT void RemoveLastUndo(); + + //! Dumps transactions in undos and redos + Standard_EXPORT void DumpTransaction(Standard_OStream& theOS) const; + + //! Adds the document to the transaction manager and + //! checks if it has been already added + Standard_EXPORT void AddDocument(const Handle(TDocStd_Document)& theDoc); + + //! Removes the document from the transaction manager. + Standard_EXPORT void RemoveDocument(const Handle(TDocStd_Document)& theDoc); + + //! Returns the added documents to the transaction manager. + const TDocStd_SequenceOfDocument& Documents() const; + + //! Sets nested transaction mode if isAllowed == Standard_True + //! NOTE: field myIsNestedTransactionMode exists only for synchronization + //! between several documents and has no effect on transactions + //! of multitransaction manager. + Standard_EXPORT void SetNestedTransactionMode(const Standard_Boolean isAllowed = Standard_True); + + //! Returns Standard_True if NestedTransaction mode is set. + //! Methods for protection of changes outside transactions + Standard_Boolean IsNestedTransactionMode() const; + + //! If theTransactionOnly is True, denies all changes outside transactions. + Standard_EXPORT void SetModificationMode(const Standard_Boolean theTransactionOnly); + + //! Returns True if changes are allowed only inside transactions. + Standard_Boolean ModificationMode() const; + + //! Clears undos in the manager and in documents. + Standard_EXPORT void ClearUndos(); + + //! Clears redos in the manager and in documents. + Standard_EXPORT void ClearRedos(); + + DEFINE_STANDARD_RTTIEXT(TDocStd_MultiTransactionManager, Standard_Transient) + +protected: +private: + TDocStd_SequenceOfDocument myDocuments; + TDocStd_SequenceOfApplicationDelta myUndos; + TDocStd_SequenceOfApplicationDelta myRedos; + Standard_Integer myUndoLimit; + Standard_Boolean myOpenTransaction; + Standard_Boolean myIsNestedTransactionMode; + Standard_Boolean myOnlyTransactionModification; +}; + +#include + +#endif // _TDocStd_MultiTransactionManager_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_SequenceOfDocument.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_SequenceOfDocument.hxx new file mode 100644 index 0000000000000000000000000000000000000000..80d34633ef40af6c8fe4838bcb2bca14c06266eb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_SequenceOfDocument.hxx @@ -0,0 +1,25 @@ +// Created on: 1999-04-07 +// Created by: Denis PASCAL +// Copyright (c) 1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TDocStd_SequenceOfDocument_HeaderFile +#define TDocStd_SequenceOfDocument_HeaderFile + +#include +#include + +typedef NCollection_Sequence TDocStd_SequenceOfDocument; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_XLinkRoot.lxx b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_XLinkRoot.lxx new file mode 100644 index 0000000000000000000000000000000000000000..7daa7b67d8d285190db4a1e8ff847969b961d2ba --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TDocStd_XLinkRoot.lxx @@ -0,0 +1,30 @@ +// Created by: DAUTRY Philippe +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// ------------------ + +// Version: 0.0 +// Version Date Purpose +// 0.0 Sep 16 1997 Creation + +inline void TDocStd_XLinkRoot::First(const TDocStd_XLinkPtr& anXLinkPtr) +{ + myFirst = anXLinkPtr; +} + +inline TDocStd_XLinkPtr TDocStd_XLinkRoot::First() const +{ + return myFirst; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TNaming_DataMapOfShapeShapesSet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_DataMapOfShapeShapesSet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..03b95e37d6578f09b66dd5a6367e85b35cbcd66b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_DataMapOfShapeShapesSet.hxx @@ -0,0 +1,29 @@ +// Created on: 1997-03-17 +// Created by: Yves FRICAUD +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TNaming_DataMapOfShapeShapesSet_HeaderFile +#define TNaming_DataMapOfShapeShapesSet_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap + TNaming_DataMapOfShapeShapesSet; +typedef NCollection_DataMap::Iterator + TNaming_DataMapIteratorOfDataMapOfShapeShapesSet; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TNaming_Iterator.lxx b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_Iterator.lxx new file mode 100644 index 0000000000000000000000000000000000000000..a7d8092da637719873a1d90a0eb287de07142d15 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_Iterator.lxx @@ -0,0 +1,20 @@ +// Created on: 1996-12-19 +// Created by: Yves FRICAUD +// Copyright (c) 1996-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +inline Standard_Boolean TNaming_Iterator::More() const +{ + return (myNode != 0L); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TNaming_IteratorOnShapesSet.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_IteratorOnShapesSet.hxx new file mode 100644 index 0000000000000000000000000000000000000000..7bd510718c196590354280c222354e71e4dabf03 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_IteratorOnShapesSet.hxx @@ -0,0 +1,59 @@ +// Created on: 1997-05-06 +// Created by: Yves FRICAUD +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TNaming_IteratorOnShapesSet_HeaderFile +#define _TNaming_IteratorOnShapesSet_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class TNaming_ShapesSet; +class TopoDS_Shape; + +class TNaming_IteratorOnShapesSet +{ +public: + DEFINE_STANDARD_ALLOC + + TNaming_IteratorOnShapesSet(); + + TNaming_IteratorOnShapesSet(const TNaming_ShapesSet& S); + + //! Initialize the iteration + void Init(const TNaming_ShapesSet& S); + + //! Returns True if there is a current Item in + //! the iteration. + Standard_Boolean More() const; + + //! Move to the next Item + void Next(); + + const TopoDS_Shape& Value() const; + +protected: +private: + TopTools_MapIteratorOfMapOfShape myIt; +}; + +#include + +#endif // _TNaming_IteratorOnShapesSet_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TNaming_NamingTool.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_NamingTool.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5d049edc6d1b414ee5f25fe50db17dffa9dd176d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_NamingTool.hxx @@ -0,0 +1,52 @@ +// Created on: 2000-02-14 +// Created by: Denis PASCAL +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TNaming_NamingTool_HeaderFile +#define _TNaming_NamingTool_HeaderFile + +#include +#include +#include + +#include +#include +class TNaming_NamedShape; +class TDF_Label; +class TopoDS_Shape; + +class TNaming_NamingTool +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT static void CurrentShape(const TDF_LabelMap& Valid, + const TDF_LabelMap& Forbiden, + const Handle(TNaming_NamedShape)& NS, + TopTools_IndexedMapOfShape& MS); + + Standard_EXPORT static void CurrentShapeFromShape(const TDF_LabelMap& Valid, + const TDF_LabelMap& Forbiden, + const TDF_Label& Acces, + const TopoDS_Shape& S, + TopTools_IndexedMapOfShape& MS); + + Standard_EXPORT static void BuildDescendants(const Handle(TNaming_NamedShape)& NS, + TDF_LabelMap& Labels); + +protected: +private: +}; + +#endif // _TNaming_NamingTool_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TNaming_ShapesSet.lxx b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_ShapesSet.lxx new file mode 100644 index 0000000000000000000000000000000000000000..9b65ce3a2490ced28bef49de97d13e51bffe1a9c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TNaming_ShapesSet.lxx @@ -0,0 +1,104 @@ +// Created on: 1997-01-09 +// Created by: Yves FRICAUD +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//======================================================================= +// function : TNaming_ShapesSet +// purpose : +//======================================================================= + +inline TNaming_ShapesSet::TNaming_ShapesSet() {} + +//======================================================================= +// function : Clear +// purpose : +//======================================================================= + +inline void TNaming_ShapesSet::Clear() +{ + myMap.Clear(); +} + +//======================================================================= +// function : Add +// purpose : +//======================================================================= + +inline Standard_Boolean TNaming_ShapesSet::Add(const TopoDS_Shape& S) +{ + return myMap.Add(S); +} + +//======================================================================= +// function : Standard_Boolean +// purpose : +//======================================================================= + +inline Standard_Boolean TNaming_ShapesSet::Contains(const TopoDS_Shape& S) const +{ + return myMap.Contains(S); +} + +//======================================================================= +// function : Standard_Boolean +// purpose : +//======================================================================= + +inline Standard_Boolean TNaming_ShapesSet::Remove(const TopoDS_Shape& S) +{ + return myMap.Remove(S); +} + +//======================================================================= +// function : IsEmpty +// purpose : +//======================================================================= + +inline Standard_Boolean TNaming_ShapesSet::IsEmpty() const +{ + return myMap.IsEmpty(); +} + +//======================================================================= +// function : NbShapes +// purpose : +//======================================================================= + +inline Standard_Integer TNaming_ShapesSet::NbShapes() const +{ + return myMap.Extent(); +} + +//======================================================================= +// function : ChangeMap +// purpose : +//======================================================================= + +inline TopTools_MapOfShape& TNaming_ShapesSet::ChangeMap() +{ + return myMap; +} + +//======================================================================= +// function : Map +// purpose : +//======================================================================= + +inline const TopTools_MapOfShape& TNaming_ShapesSet::Map() const +{ + return myMap; +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TObj_ObjectIterator.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TObj_ObjectIterator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5e64d74089f96f83d658a5c3b0bbbc234c7ac071 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TObj_ObjectIterator.hxx @@ -0,0 +1,63 @@ +// Created on: 2004-11-23 +// Created by: Pavel TELKOV +// Copyright (c) 2004-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// The original implementation Copyright: (C) RINA S.p.A + +#ifndef TObj_ObjectIterator_HeaderFile +#define TObj_ObjectIterator_HeaderFile + +#include +#include + +class TObj_Object; + +/** + * This class provides an iterator by objects in a partition. + * (implements TObj_ObjectIterator interface) + */ + +class TObj_ObjectIterator : public Standard_Transient +{ +public: + /* + * Methods to iterate on a objects + */ + + //! Returns True if iteration is not finished and method Current() + //! will give the object. + //! Default implementation returns False + virtual Standard_EXPORT Standard_Boolean More() const; + + //! Iterates to the next object + //! Default implementation does nothing + virtual Standard_EXPORT void Next(); + + //! Returns current object (or null if iteration has finished) + //! Default implementation returns null handle + virtual Standard_EXPORT Handle(TObj_Object) Value() const; + +public: + //! CASCADE RTTI + DEFINE_STANDARD_RTTIEXT(TObj_ObjectIterator, Standard_Transient) +}; + +//! Define handle class for TObj_ObjectIterator +DEFINE_STANDARD_HANDLE(TObj_ObjectIterator, Standard_Transient) + +#endif + +#ifdef _MSC_VER +#pragma once +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TPrsStd_DataMapOfGUIDDriver.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TPrsStd_DataMapOfGUIDDriver.hxx new file mode 100644 index 0000000000000000000000000000000000000000..501489e3604980b22225af1a462981b943c75c71 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TPrsStd_DataMapOfGUIDDriver.hxx @@ -0,0 +1,28 @@ +// Created on: 1997-03-16 +// Created by: SMO +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TPrsStd_DataMapOfGUIDDriver_HeaderFile +#define TPrsStd_DataMapOfGUIDDriver_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap TPrsStd_DataMapOfGUIDDriver; +typedef NCollection_DataMap::Iterator + TPrsStd_DataMapIteratorOfDataMapOfGUIDDriver; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_FaceAreaBuilder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_FaceAreaBuilder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..29fbf9fdcc5d82f536070e2fab5aeb83b6566672 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_FaceAreaBuilder.hxx @@ -0,0 +1,59 @@ +// Created on: 1995-12-21 +// Created by: Jean Yves LEBEY +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepBuild_FaceAreaBuilder_HeaderFile +#define _TopOpeBRepBuild_FaceAreaBuilder_HeaderFile + +#include +#include +#include + +#include +#include +class TopOpeBRepBuild_LoopSet; +class TopOpeBRepBuild_LoopClassifier; + +//! The FaceAreaBuilder algorithm is used to construct Faces from a LoopSet, +//! where the Loop is the composite topological object of the boundary, +//! here wire or block of edges. +//! The LoopSet gives an iteration on Loops. +//! For each Loop it indicates if it is on the boundary (wire) or if it +//! results from an interference (block of edges). +//! The result of the FaceAreaBuilder is an iteration on areas. +//! An area is described by a set of Loops. +class TopOpeBRepBuild_FaceAreaBuilder : public TopOpeBRepBuild_Area2dBuilder +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRepBuild_FaceAreaBuilder(); + + //! Creates a FaceAreaBuilder to build faces on + //! the (wires,blocks of edge) of , using the classifier . + Standard_EXPORT TopOpeBRepBuild_FaceAreaBuilder( + TopOpeBRepBuild_LoopSet& LS, + TopOpeBRepBuild_LoopClassifier& LC, + const Standard_Boolean ForceClass = Standard_False); + + Standard_EXPORT void InitFaceAreaBuilder(TopOpeBRepBuild_LoopSet& LS, + TopOpeBRepBuild_LoopClassifier& LC, + const Standard_Boolean ForceClass = Standard_False); + +protected: +private: +}; + +#endif // _TopOpeBRepBuild_FaceAreaBuilder_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_ShellToSolid.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_ShellToSolid.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b7e2cdd5aae5f3b77f1edcd315179de32e5ddf42 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepBuild_ShellToSolid.hxx @@ -0,0 +1,46 @@ +// Created on: 1997-10-02 +// Created by: Xuan Trang PHAM PHU +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepBuild_ShellToSolid_HeaderFile +#define _TopOpeBRepBuild_ShellToSolid_HeaderFile + +#include +#include + +#include +class TopoDS_Shell; +class TopoDS_Solid; + +//! This class builds solids from a set of shells SSh and a solid F. +class TopOpeBRepBuild_ShellToSolid +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRepBuild_ShellToSolid(); + + Standard_EXPORT void Init(); + + Standard_EXPORT void AddShell(const TopoDS_Shell& Sh); + + Standard_EXPORT void MakeSolids(const TopoDS_Solid& So, TopTools_ListOfShape& LSo); + +protected: +private: + TopTools_ListOfShape myLSh; +}; + +#endif // _TopOpeBRepBuild_ShellToSolid_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapIteratorOfMapOfCurve.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapIteratorOfMapOfCurve.hxx new file mode 100644 index 0000000000000000000000000000000000000000..414efdc667df9f6c7dee5c79dca9932bc9a307c5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapIteratorOfMapOfCurve.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopOpeBRepDS_DataMapIteratorOfMapOfCurve_HeaderFile +#define TopOpeBRepDS_DataMapIteratorOfMapOfCurve_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapOfInterferenceListOfInterference.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapOfInterferenceListOfInterference.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ec10d2ee2c9c333ea37b920c1067dce8fb810815 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_DataMapOfInterferenceListOfInterference.hxx @@ -0,0 +1,29 @@ +// Created on: 1993-06-17 +// Created by: Jean Yves LEBEY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopOpeBRepDS_DataMapOfInterferenceListOfInterference_HeaderFile +#define TopOpeBRepDS_DataMapOfInterferenceListOfInterference_HeaderFile + +#include +#include + +typedef NCollection_DataMap + TopOpeBRepDS_DataMapOfInterferenceListOfInterference; +typedef NCollection_DataMap::Iterator + TopOpeBRepDS_DataMapIteratorOfDataMapOfInterferenceListOfInterference; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Filter.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Filter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..015c4b381a7e0960f3fa559950aaa89c892ba525 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Filter.hxx @@ -0,0 +1,60 @@ +// Created on: 1997-04-21 +// Created by: Prestataire Mary FABIEN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepDS_Filter_HeaderFile +#define _TopOpeBRepDS_Filter_HeaderFile + +#include +#include +#include + +#include +#include +#include +class TopOpeBRepDS_HDataStructure; + +class TopOpeBRepDS_Filter +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRepDS_Filter(const Handle(TopOpeBRepDS_HDataStructure)& HDS, + const TopOpeBRepTool_PShapeClassifier& pClassif = 0); + + Standard_EXPORT void ProcessInterferences(); + + Standard_EXPORT void ProcessFaceInterferences( + const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MEsp); + + Standard_EXPORT void ProcessFaceInterferences( + const Standard_Integer I, + const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MEsp); + + Standard_EXPORT void ProcessEdgeInterferences(); + + Standard_EXPORT void ProcessEdgeInterferences(const Standard_Integer I); + + Standard_EXPORT void ProcessCurveInterferences(); + + Standard_EXPORT void ProcessCurveInterferences(const Standard_Integer I); + +protected: +private: + Handle(TopOpeBRepDS_HDataStructure) myHDS; + TopOpeBRepTool_PShapeClassifier myPShapeClassif; +}; + +#endif // _TopOpeBRepDS_Filter_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Kind.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Kind.hxx new file mode 100644 index 0000000000000000000000000000000000000000..cdc72834102bb0a0c6c4b370013e349fade80e3d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_Kind.hxx @@ -0,0 +1,37 @@ +// Created on: 1993-06-17 +// Created by: Jean Yves LEBEY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepDS_Kind_HeaderFile +#define _TopOpeBRepDS_Kind_HeaderFile + +//! different types of objects in DataStructure +enum TopOpeBRepDS_Kind +{ + TopOpeBRepDS_POINT, + TopOpeBRepDS_CURVE, + TopOpeBRepDS_SURFACE, + TopOpeBRepDS_VERTEX, + TopOpeBRepDS_EDGE, + TopOpeBRepDS_WIRE, + TopOpeBRepDS_FACE, + TopOpeBRepDS_SHELL, + TopOpeBRepDS_SOLID, + TopOpeBRepDS_COMPSOLID, + TopOpeBRepDS_COMPOUND, + TopOpeBRepDS_UNKNOWN +}; + +#endif // _TopOpeBRepDS_Kind_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_ListOfShapeOn1State.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_ListOfShapeOn1State.hxx new file mode 100644 index 0000000000000000000000000000000000000000..64379fefeec66255ba9ec2688a8e93f5241036b9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_ListOfShapeOn1State.hxx @@ -0,0 +1,51 @@ +// Created on: 1995-06-12 +// Created by: Jean Yves LEBEY +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepDS_ListOfShapeOn1State_HeaderFile +#define _TopOpeBRepDS_ListOfShapeOn1State_HeaderFile + +#include +#include +#include + +#include +#include + +//! represent a list of shape +class TopOpeBRepDS_ListOfShapeOn1State +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRepDS_ListOfShapeOn1State(); + + Standard_EXPORT const TopTools_ListOfShape& ListOnState() const; + + Standard_EXPORT TopTools_ListOfShape& ChangeListOnState(); + + Standard_EXPORT Standard_Boolean IsSplit() const; + + Standard_EXPORT void Split(const Standard_Boolean B = Standard_True); + + Standard_EXPORT void Clear(); + +protected: +private: + TopTools_ListOfShape myList; + Standard_Integer mySplits; +}; + +#endif // _TopOpeBRepDS_ListOfShapeOn1State_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfIntegerShapeData.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfIntegerShapeData.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1298d876bad528f6c7e17edb83852a8a256d80d2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfIntegerShapeData.hxx @@ -0,0 +1,28 @@ +// Created on: 1993-06-17 +// Created by: Jean Yves LEBEY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopOpeBRepDS_MapOfIntegerShapeData_HeaderFile +#define TopOpeBRepDS_MapOfIntegerShapeData_HeaderFile + +#include +#include + +typedef NCollection_DataMap + TopOpeBRepDS_MapOfIntegerShapeData; +typedef NCollection_DataMap::Iterator + TopOpeBRepDS_DataMapIteratorOfMapOfIntegerShapeData; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfShapeData.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfShapeData.hxx new file mode 100644 index 0000000000000000000000000000000000000000..be1e837831df8a43c4af01b5e8c5219cb7ad6b02 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_MapOfShapeData.hxx @@ -0,0 +1,28 @@ +// Created on: 1993-06-17 +// Created by: Jean Yves LEBEY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopOpeBRepDS_MapOfShapeData_HeaderFile +#define TopOpeBRepDS_MapOfShapeData_HeaderFile + +#include +#include +#include +#include + +typedef NCollection_IndexedDataMap + TopOpeBRepDS_MapOfShapeData; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_PointData.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_PointData.hxx new file mode 100644 index 0000000000000000000000000000000000000000..1987e12b4e807d3fd6c226cf6235c36d326dbcd0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRepDS_PointData.hxx @@ -0,0 +1,53 @@ +// Created on: 1993-06-23 +// Created by: Jean Yves LEBEY +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRepDS_PointData_HeaderFile +#define _TopOpeBRepDS_PointData_HeaderFile + +#include +#include + +#include +#include +#include + +class TopOpeBRepDS_PointData : public TopOpeBRepDS_GeometryData +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRepDS_PointData(); + + Standard_EXPORT TopOpeBRepDS_PointData(const TopOpeBRepDS_Point& P); + + Standard_EXPORT TopOpeBRepDS_PointData(const TopOpeBRepDS_Point& P, + const Standard_Integer I1, + const Standard_Integer I2); + + Standard_EXPORT void SetShapes(const Standard_Integer I1, const Standard_Integer I2); + + Standard_EXPORT void GetShapes(Standard_Integer& I1, Standard_Integer& I2) const; + + friend class TopOpeBRepDS_DataStructure; + +protected: +private: + TopOpeBRepDS_Point myPoint; + Standard_Integer myS1; + Standard_Integer myS2; +}; + +#endif // _TopOpeBRepDS_PointData_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRep_FaceEdgeIntersector.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRep_FaceEdgeIntersector.hxx new file mode 100644 index 0000000000000000000000000000000000000000..01ce1cc401348538f21928c56774a2f07841183b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopOpeBRep_FaceEdgeIntersector.hxx @@ -0,0 +1,129 @@ +// Created on: 1994-10-13 +// Created by: Jean Yves LEBEY +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopOpeBRep_FaceEdgeIntersector_HeaderFile +#define _TopOpeBRep_FaceEdgeIntersector_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class gp_Pnt; +class gp_Pnt2d; +class TopOpeBRepDS_Transition; + +//! Describes the intersection of a face and an edge. +class TopOpeBRep_FaceEdgeIntersector +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT TopOpeBRep_FaceEdgeIntersector(); + + Standard_EXPORT void Perform(const TopoDS_Shape& F, const TopoDS_Shape& E); + + Standard_EXPORT Standard_Boolean IsEmpty(); + + //! returns intersected face or edge according to + //! value of = 1 or 2 + Standard_EXPORT const TopoDS_Shape& Shape(const Standard_Integer Index) const; + + //! Force the tolerance values used by the next Perform(S1,S2) call. + Standard_EXPORT void ForceTolerance(const Standard_Real tol); + + //! Return the tolerance value used in the last Perform() call + //! If ForceTolerance() has been called, return the given value. + //! If not, return value extracted from shapes. + Standard_EXPORT Standard_Real Tolerance() const; + + Standard_EXPORT Standard_Integer NbPoints() const; + + Standard_EXPORT void InitPoint(); + + Standard_EXPORT Standard_Boolean MorePoint() const; + + Standard_EXPORT void NextPoint(); + + //! return the 3D point of the current intersection point. + Standard_EXPORT gp_Pnt Value() const; + + //! parametre de Value() sur l'arete + Standard_EXPORT Standard_Real Parameter() const; + + //! parametre de Value() sur la face + Standard_EXPORT void UVPoint(gp_Pnt2d& P) const; + + //! IN ou ON / a la face. Les points OUT ne sont pas retournes. + Standard_EXPORT TopAbs_State State() const; + + //! Index = 1 transition par rapport a la face, en cheminant sur l'arete + Standard_EXPORT TopOpeBRepDS_Transition + Transition(const Standard_Integer Index, const TopAbs_Orientation FaceOrientation) const; + + Standard_EXPORT Standard_Boolean IsVertex(const TopoDS_Shape& S, + const gp_Pnt& P, + const Standard_Real Tol, + TopoDS_Vertex& V); + + Standard_EXPORT Standard_Boolean IsVertex(const Standard_Integer I, TopoDS_Vertex& V); + + //! trace only + Standard_EXPORT Standard_Integer Index() const; + +protected: +private: + Standard_EXPORT void ResetIntersection(); + + //! extract tolerance values from shapes ,, + //! in order to perform intersection between and + //! with tolerance values "fitting" the shape tolerances. + //! (called by Perform() by default, when ForceTolerances() has not + //! been called) + Standard_EXPORT void ShapeTolerances(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + + //! returns the max tolerance of sub-shapes of type + //! found in shape . If no such sub-shape found, return + //! Precision::Intersection() + //! (called by ShapeTolerances()) + Standard_EXPORT Standard_Real ToleranceMax(const TopoDS_Shape& S, const TopAbs_ShapeEnum T) const; + + TopoDS_Face myFace; + TopoDS_Edge myEdge; + Standard_Real myTol; + Standard_Boolean myForceTolerance; + GeomAdaptor_Curve myCurve; + Standard_Boolean myIntersectionDone; + IntCurveSurface_SequenceOfPnt mySequenceOfPnt; + TColStd_SequenceOfInteger mySequenceOfState; + Standard_Integer myPointIndex; + Standard_Integer myNbPoints; + TopExp_Explorer myVertexExplorer; + TopoDS_Shape myNullShape; + TopoDS_Vertex myNullVertex; +}; + +#endif // _TopOpeBRep_FaceEdgeIntersector_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f62e819df802cf9a5720d141202f00aec9b2b117 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx @@ -0,0 +1,19 @@ +// Copyright (c) 2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopTools_DataMapIteratorOfDataMapOfShapeInteger_HeaderFile +#define TopTools_DataMapIteratorOfDataMapOfShapeInteger_HeaderFile + +#include + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapOfShapeReal.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapOfShapeReal.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e802264156acd1f5406cb5b21209cae3ed2c442f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_DataMapOfShapeReal.hxx @@ -0,0 +1,29 @@ +// Created on: 1993-01-14 +// Created by: Remi LEQUETTE +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopTools_DataMapOfShapeReal_HeaderFile +#define TopTools_DataMapOfShapeReal_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap + TopTools_DataMapOfShapeReal; +typedef NCollection_DataMap::Iterator + TopTools_DataMapIteratorOfDataMapOfShapeReal; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopTools_IndexedMapOfShape.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_IndexedMapOfShape.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d0a8f8a8a16db7fab360447218c1c1b5aeb39e65 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopTools_IndexedMapOfShape.hxx @@ -0,0 +1,25 @@ +// Created on: 1993-01-14 +// Created by: Remi LEQUETTE +// Copyright (c) 1993-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopTools_IndexedMapOfShape_HeaderFile +#define TopTools_IndexedMapOfShape_HeaderFile + +#include +#include + +typedef NCollection_IndexedMap TopTools_IndexedMapOfShape; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopTrans_Array2OfOrientation.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopTrans_Array2OfOrientation.hxx new file mode 100644 index 0000000000000000000000000000000000000000..8414173d066ea4cfde8d5b707399b7f2009821a0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopTrans_Array2OfOrientation.hxx @@ -0,0 +1,25 @@ +// Created on: 1991-10-28 +// Created by: Remi LEQUETTE +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TopTrans_Array2OfOrientation_HeaderFile +#define TopTrans_Array2OfOrientation_HeaderFile + +#include +#include + +typedef NCollection_Array2 TopTrans_Array2OfOrientation; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TopoDS_Wire.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TopoDS_Wire.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ca4a9cb1170fe83710cdc214ba88b8a35ff5eea4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TopoDS_Wire.hxx @@ -0,0 +1,50 @@ +// Created on: 1990-12-17 +// Created by: Remi Lequette +// Copyright (c) 1990-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TopoDS_Wire_HeaderFile +#define _TopoDS_Wire_HeaderFile + +#include + +//! Describes a wire which +//! - references an underlying wire with the potential to +//! be given a location and an orientation +//! - has a location for the underlying wire, giving its +//! placement in the local coordinate system +//! - has an orientation for the underlying wire, in terms +//! of its geometry (as opposed to orientation in relation to other shapes). +class TopoDS_Wire : public TopoDS_Shape +{ +public: + DEFINE_STANDARD_ALLOC + + //! Undefined Wire. + TopoDS_Wire() {} +}; + +namespace std +{ +template <> +struct hash +{ + size_t operator()(const TopoDS_Wire& theShape) const + { + return std::hash{}(theShape); + } +}; +} // namespace std + +#endif // _TopoDS_Wire_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/TransferBRep.hxx b/data/miniconda3/envs/catiagent/include/opencascade/TransferBRep.hxx new file mode 100644 index 0000000000000000000000000000000000000000..5970e9b0b72393ce34f987bbc1a7d81f5e5d0c12 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/TransferBRep.hxx @@ -0,0 +1,188 @@ +// Created on: 1994-10-03 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _TransferBRep_HeaderFile +#define _TransferBRep_HeaderFile + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +class TopoDS_Shape; +class Transfer_Binder; +class Transfer_TransientProcess; +class Standard_Transient; +class Transfer_FinderProcess; +class TransferBRep_ShapeMapper; +class Message_Printer; +class Message_Msg; +class TransferBRep_TransferResultInfo; +class Interface_CheckIterator; +class Interface_InterfaceModel; + +//! This package gathers services to simply read files and convert +//! them to Shapes from CasCade. IE. it can be used in conjunction +//! with purely CasCade software +class TransferBRep +{ +public: + DEFINE_STANDARD_ALLOC + + //! Get the Shape recorded in a Binder + //! If the Binder brings a multiple result, search for the Shape + Standard_EXPORT static TopoDS_Shape ShapeResult(const Handle(Transfer_Binder)& binder); + + //! Get the Shape recorded in a TransientProcess as result of the + //! Transfer of an entity. I.E. in the binder bound to that Entity + //! If no result or result not a single Shape, returns a Null Shape + Standard_EXPORT static TopoDS_Shape ShapeResult(const Handle(Transfer_TransientProcess)& TP, + const Handle(Standard_Transient)& ent); + + //! Sets a Shape as a result for a starting entity + //! (reverse of ShapeResult) + //! It simply creates a ShapeBinder then binds it to the entity + Standard_EXPORT static void SetShapeResult(const Handle(Transfer_TransientProcess)& TP, + const Handle(Standard_Transient)& ent, + const TopoDS_Shape& result); + + //! Gets the Shapes recorded in a TransientProcess as result of a + //! Transfer, considers roots only or all results according + //! , returns them as a HSequence + Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes( + const Handle(Transfer_TransientProcess)& TP, + const Standard_Boolean rootsonly = Standard_True); + + //! Gets the Shapes recorded in a TransientProcess as result of a + //! Transfer, for a given list of starting entities, returns + //! the shapes as a HSequence + Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes( + const Handle(Transfer_TransientProcess)& TP, + const Handle(TColStd_HSequenceOfTransient)& list); + + //! Returns a Status regarding a Shape in a FinderProcess + //! - FORWARD means bound with SAME Orientation + //! - REVERSED means bound with REVERSE Orientation + //! - EXTERNAL means NOT BOUND + //! - INTERNAL is not used + Standard_EXPORT static TopAbs_Orientation ShapeState(const Handle(Transfer_FinderProcess)& FP, + const TopoDS_Shape& shape); + + //! Returns the result (as a Binder) attached to a given Shape + //! Null if none + Standard_EXPORT static Handle(Transfer_Binder) ResultFromShape( + const Handle(Transfer_FinderProcess)& FP, + const TopoDS_Shape& shape); + + //! Returns the result as pure Transient attached to a Shape + //! first one if multiple result + Standard_EXPORT static Handle(Standard_Transient) TransientFromShape( + const Handle(Transfer_FinderProcess)& FP, + const TopoDS_Shape& shape); + + //! Binds a Transient Result to a Shape in a FinderProcess + //! (as first result if multiple : does not add it to existing one) + Standard_EXPORT static void SetTransientFromShape(const Handle(Transfer_FinderProcess)& FP, + const TopoDS_Shape& shape, + const Handle(Standard_Transient)& result); + + //! Returns a ShapeMapper for a given Shape (location included) + //! Either is already mapped, then its Mapper is returned + //! Or it is not, then a new one is created then returned, BUT + //! it is not mapped here (use Bind or FindElseBind to do this) + Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper( + const Handle(Transfer_FinderProcess)& FP, + const TopoDS_Shape& shape); + + //! Fills sequence of TransferResultInfo for each type of entity + //! given in the EntityTypes (entity are given as objects). + //! Method IsKind applied to the entities in TP is used to + //! compare with entities in EntityTypes. + //! TopAbs_ShapeEnum). + Standard_EXPORT static void TransferResultInfo( + const Handle(Transfer_TransientProcess)& TP, + const Handle(TColStd_HSequenceOfTransient)& EntityTypes, + Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); + + //! Fills sequence of TransferResultInfo for each type of shape + //! given in the ShapeTypes (which are in fact considered as + //! TopAbs_ShapeEnum). + //! The Finders in the FP are considered as ShapeMappers. + Standard_EXPORT static void TransferResultInfo( + const Handle(Transfer_FinderProcess)& FP, + const Handle(TColStd_HSequenceOfInteger)& ShapeTypes, + Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); + + //! Prints the results of transfer to given priner with given header. + Standard_EXPORT static void PrintResultInfo( + const Handle(Message_Printer)& Printer, + const Message_Msg& Header, + const Handle(TransferBRep_TransferResultInfo)& ResultInfo, + const Standard_Boolean printEmpty = Standard_True); + + //! Performs a heavy check by calling the Analyser from BRepCheck + //! This tool computes a lot of information about integrity of a + //! Shape. This method uses it and converts its internal result + //! to a classic check-list. + //! allows to get more information : + //! 0 : BRepCheck only + //! 1(D) + Curves/Surfaces not C0 ; 2 + SameParameter on Edges + //! Warning : entities to which checks are bound are the Shapes themselves, + //! embedded in ShapeMapper + Standard_EXPORT static Interface_CheckIterator BRepCheck(const TopoDS_Shape& shape, + const Standard_Integer lev = 1); + + //! Takes a starting CheckIterator which brings checks bound with + //! starting objects (Shapes, Transient from an Imagine appli ...) + //! and converts it to a CheckIterator in which checks are bound + //! with results in an InterfaceModel + //! Mapping is recorded in the FinderProcess + //! Starting objects for which no individual result is recorded + //! remain in their state + Standard_EXPORT static Interface_CheckIterator ResultCheckList( + const Interface_CheckIterator& chl, + const Handle(Transfer_FinderProcess)& FP, + const Handle(Interface_InterfaceModel)& model); + + //! Returns the list of objects to which a non-empty Check is + //! bound in a check-list. Objects are transients, they can then + //! be either Imagine objects entities for an Interface Norm. + //! commands Shapes to be returned too + //! (as ShapeMapper), see also CheckedShapes + Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) Checked( + const Interface_CheckIterator& chl, + const Standard_Boolean alsoshapes = Standard_False); + + //! Returns the list of shapes to which a non-empty Check is bound + //! in a check-list + Standard_EXPORT static Handle(TopTools_HSequenceOfShape) CheckedShapes( + const Interface_CheckIterator& chl); + + //! Returns the check-list bound to a given object, generally none + //! (if OK) or one check. can be, either a true Transient + //! object or entity, or a ShapeMapper, in that case the Shape is + //! considered + Standard_EXPORT static Interface_CheckIterator CheckObject(const Interface_CheckIterator& chl, + const Handle(Standard_Transient)& obj); +}; + +#endif // _TransferBRep_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_FindHasher.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_FindHasher.hxx new file mode 100644 index 0000000000000000000000000000000000000000..dae6196adbab113e5c673c6f3dd8e90c5ae4e6ad --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_FindHasher.hxx @@ -0,0 +1,50 @@ +// Created on: 1994-11-04 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Transfer_FindHasher_HeaderFile +#define _Transfer_FindHasher_HeaderFile + +#include +#include +#include +#include + +//! FindHasher defines HashCode for Finder, which is : ask a +//! Finder its HashCode ! Because this is the Finder itself which +//! brings the HashCode for its Key +//! +//! This class complies to the template given in TCollection by +//! MapHasher itself +class Transfer_FindHasher +{ +public: + size_t operator()(const Handle(Transfer_Finder)& theFinder) const + { + return theFinder->GetHashCode(); + } + + //! Returns True if two keys are the same. + //! The test does not work on the Finders themselves but by + //! calling their methods Equates + bool operator()(const Handle(Transfer_Finder)& theK1, const Handle(Transfer_Finder)& theK2) const + { + if (theK1.IsNull()) + return false; + return theK1->Equates(theK2); + } +}; + +#endif // _Transfer_FindHasher_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_IteratorOfProcessForFinder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_IteratorOfProcessForFinder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2b8190d9b8b654726c8a1b31cc493cb0ef235318 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_IteratorOfProcessForFinder.hxx @@ -0,0 +1,75 @@ +// Created on: 1992-02-03 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Transfer_IteratorOfProcessForFinder_HeaderFile +#define _Transfer_IteratorOfProcessForFinder_HeaderFile + +#include +#include +#include + +#include +#include + +class Standard_NoSuchObject; +class Transfer_Finder; +class Transfer_FindHasher; +class Transfer_ProcessForFinder; +class Transfer_ActorOfProcessForFinder; +class Transfer_Binder; + +class Transfer_IteratorOfProcessForFinder : public Transfer_TransferIterator +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates an empty Iterator + //! if withstarts is True, each Binder to be iterated will + //! be associated to its corresponding Starting Object + Standard_EXPORT Transfer_IteratorOfProcessForFinder(const Standard_Boolean withstarts); + + //! Adds a Binder to the iteration list (construction) + //! with no corresponding Starting Object + //! (note that Result is brought by Binder) + Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder); + + //! Adds a Binder to the iteration list, associated with + //! its corresponding Starting Object "start" + //! Starting Object is ignored if not required at + //! Creation time + Standard_EXPORT void Add(const Handle(Transfer_Binder)& binder, + const Handle(Transfer_Finder)& start); + + //! After having added all items, keeps or rejects items + //! which are attached to starting data given by + //! = True (D) : keeps. = False : rejects + //! Does nothing if was False + Standard_EXPORT void Filter(const Handle(Transfer_HSequenceOfFinder)& list, + const Standard_Boolean keep = Standard_True); + + //! Returns True if Starting Object is available + //! (defined at Creation Time) + Standard_EXPORT Standard_Boolean HasStarting() const; + + //! Returns corresponding Starting Object + Standard_EXPORT const Handle(Transfer_Finder)& Starting() const; + +protected: +private: + Handle(Transfer_HSequenceOfFinder) thestarts; +}; + +#endif // _Transfer_IteratorOfProcessForFinder_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_ProcessForTransient.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_ProcessForTransient.hxx new file mode 100644 index 0000000000000000000000000000000000000000..bb2e1d1cf8880d701dbc41f5b11bf5fdb96c7327 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_ProcessForTransient.hxx @@ -0,0 +1,464 @@ +// Created on: 1992-02-03 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Transfer_ProcessForTransient_HeaderFile +#define _Transfer_ProcessForTransient_HeaderFile + +#include +#include +#include + +class Message_Messenger; +class Transfer_Binder; +class Transfer_ActorOfProcessForTransient; +class Interface_InterfaceError; +class Transfer_TransferFailure; +class Transfer_IteratorOfProcessForTransient; +class Message_Msg; +class Interface_Check; +class Interface_CheckIterator; + +class Transfer_ProcessForTransient; +DEFINE_STANDARD_HANDLE(Transfer_ProcessForTransient, Standard_Transient) + +//! Manages Transfer of Transient Objects. Produces also +//! ActorOfTransientProcess (deferred class), +//! IteratorOfTransientProcess (for Results), +//! TransferMapOfTransientProcess (internally used) +//! Normally uses as TransientProcess, which adds some specifics + +class Transfer_ProcessForTransient : public Standard_Transient +{ + +public: + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets default trace file as a printer and default trace level + //! (see Message_TraceFile). + Standard_EXPORT Transfer_ProcessForTransient(const Standard_Integer nb = 10000); + + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets a specified printer. + Standard_EXPORT Transfer_ProcessForTransient(const Handle(Message_Messenger)& printer, + const Standard_Integer nb = 10000); + + //! Resets a TransferProcess as ready for a completely new work. + //! Clears general data (roots) and the Map + Standard_EXPORT void Clear(); + + //! Rebuilds the Map and the roots to really remove Unbound items + //! Because Unbind keeps the entity in place, even if not bound + //! Hence, working by checking new items is meaningless if a + //! formerly unbound item is rebound + Standard_EXPORT void Clean(); + + //! Resizes the Map as required (if a new reliable value has been + //! determined). Acts only if is greater than actual NbMapped + Standard_EXPORT void Resize(const Standard_Integer nb); + + //! Defines an Actor, which is used for automatic Transfer + //! If already defined, the new Actor is cumulated + //! (see SetNext from Actor) + Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfProcessForTransient)& actor); + + //! Returns the defined Actor. Returns a Null Handle if + //! not set. + Standard_EXPORT Handle(Transfer_ActorOfProcessForTransient) Actor() const; + + //! Returns the Binder which is linked with a starting Object + //! It can either bring a Result (Transfer done) or none (for a + //! pre-binding). + //! If no Binder is linked with , returns a Null Handle + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) Find(const Handle(Standard_Transient)& start) const; + + //! Returns True if a Result (whatever its form) is Bound with + //! a starting Object. I.e., if a Binder with a Result set, + //! is linked with it + //! Considers a category number, by default 0 + Standard_EXPORT Standard_Boolean IsBound(const Handle(Standard_Transient)& start) const; + + //! Returns True if the result of the transfer of an object is + //! already used in other ones. If it is, Rebind cannot change it. + //! Considers a category number, by default 0 + Standard_EXPORT Standard_Boolean IsAlreadyUsed(const Handle(Standard_Transient)& start) const; + + //! Creates a Link a starting Object with a Binder. This Binder + //! can either bring a Result (effective Binding) or none (it can + //! be set later : pre-binding). + //! Considers a category number, by default 0 + Standard_EXPORT void Bind(const Handle(Standard_Transient)& start, + const Handle(Transfer_Binder)& binder); + + //! Changes the Binder linked with a starting Object for its + //! unitary transfer. This it can be useful when the exact form + //! of the result is known once the transfer is widely engaged. + //! This can be done only on first transfer. + //! Considers a category number, by default 0 + Standard_EXPORT void Rebind(const Handle(Standard_Transient)& start, + const Handle(Transfer_Binder)& binder); + + //! Removes the Binder linked with a starting object + //! If this Binder brings a non-empty Check, it is replaced by + //! a VoidBinder. Also removes from the list of Roots as required. + //! Returns True if done, False if was not bound + //! Considers a category number, by default 0 + Standard_EXPORT Standard_Boolean Unbind(const Handle(Standard_Transient)& start); + + //! Returns a Binder for a starting entity, as follows : + //! Tries to Find the already bound one + //! If none found, creates a VoidBinder and Binds it + Standard_EXPORT Handle(Transfer_Binder) FindElseBind(const Handle(Standard_Transient)& start); + + //! Sets Messenger used for outputting messages. + Standard_EXPORT void SetMessenger(const Handle(Message_Messenger)& messenger); + + //! Returns Messenger used for outputting messages. + //! The returned object is guaranteed to be non-null; + //! default is Message::Messenger(). + Standard_EXPORT Handle(Message_Messenger) Messenger() const; + + //! Sets trace level used for outputting messages: + //! = 0 : no trace at all + //! = 1 : handled exceptions and calls to AddError + //! = 2 : also calls to AddWarning + //! = 3 : also traces new Roots + //! (uses method ErrorTrace). + //! Default is 1 : Errors traced + Standard_EXPORT void SetTraceLevel(const Standard_Integer tracelev); + + //! Returns trace level used for outputting messages. + Standard_EXPORT Standard_Integer TraceLevel() const; + + //! New name for AddFail (Msg) + Standard_EXPORT void SendFail(const Handle(Standard_Transient)& start, const Message_Msg& amsg); + + //! New name for AddWarning (Msg) + Standard_EXPORT void SendWarning(const Handle(Standard_Transient)& start, + const Message_Msg& amsg); + + //! Adds an information message + //! Trace is filled if trace level is at least 3 + Standard_EXPORT void SendMsg(const Handle(Standard_Transient)& start, const Message_Msg& amsg); + + //! Adds an Error message to a starting entity (to the check of + //! its Binder of category 0, as a Fail) + Standard_EXPORT void AddFail(const Handle(Standard_Transient)& start, + const Standard_CString mess, + const Standard_CString orig = ""); + + //! (other name of AddFail, maintained for compatibility) + Standard_EXPORT void AddError(const Handle(Standard_Transient)& start, + const Standard_CString mess, + const Standard_CString orig = ""); + + //! Adds an Error Message to a starting entity from the definition + //! of a Msg (Original+Value) + Standard_EXPORT void AddFail(const Handle(Standard_Transient)& start, const Message_Msg& amsg); + + //! Adds a Warning message to a starting entity (to the check of + //! its Binder of category 0) + Standard_EXPORT void AddWarning(const Handle(Standard_Transient)& start, + const Standard_CString mess, + const Standard_CString orig = ""); + + //! Adds a Warning Message to a starting entity from the definition + //! of a Msg (Original+Value) + Standard_EXPORT void AddWarning(const Handle(Standard_Transient)& start, const Message_Msg& amsg); + + Standard_EXPORT void Mend(const Handle(Standard_Transient)& start, + const Standard_CString pref = ""); + + //! Returns the Check attached to a starting entity. If + //! is unknown, returns an empty Check + //! Adds a case name to a starting entity + //! Adds a case value to a starting entity + //! Returns the complete case list for an entity. Null Handle if empty + //! In the list of mapped items (between 1 and NbMapped), + //! searches for the first item which follows (not included) + //! and which has an attribute named + //! Attributes are brought by Binders + //! Hence, allows such an iteration + //! + //! for (num = TP->NextItemWithAttribute(name,0); + //! num > 0; + //! num = TP->NextItemWithAttribute(name,num) { + //! .. process mapped item + //! } + //! Returns the type of an Attribute attached to binders + //! If this name gives no Attribute, returns ParamVoid + //! If this name gives several different types, returns ParamMisc + //! Else, returns the effective type (ParamInteger, ParamReal, + //! ParamIdent, or ParamText) + //! Returns the list of recorded Attribute Names, as a Dictionary + //! of Integer : each value gives the count of items which bring + //! this attribute name + //! By default, considers all the attribute names + //! If is given, considers only the attribute names + //! which begin by + Standard_EXPORT Handle(Interface_Check) Check(const Handle(Standard_Transient)& start) const; + + //! Binds a starting object with a Transient Result. + //! Uses a SimpleBinderOfTransient to work. If there is already + //! one but with no Result set, sets its Result. + //! Considers a category number, by default 0 + Standard_EXPORT void BindTransient(const Handle(Standard_Transient)& start, + const Handle(Standard_Transient)& res); + + //! Returns the Result of the Transfer of an object as a + //! Transient Result. + //! Returns a Null Handle if there is no Transient Result + //! Considers a category number, by default 0 + //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient + Standard_EXPORT const Handle(Standard_Transient)& FindTransient( + const Handle(Standard_Transient)& start) const; + + //! Prepares an object to be bound with several results. + //! If no Binder is yet attached to , a MultipleBinder + //! is created, empty. If a Binder is already set, it must + //! accept Multiple Binding. + //! Considers a category number, by default 0 + Standard_EXPORT void BindMultiple(const Handle(Standard_Transient)& start); + + //! Adds an item to a list of results bound to a starting object. + //! Considers a category number, by default 0, for all results + Standard_EXPORT void AddMultiple(const Handle(Standard_Transient)& start, + const Handle(Standard_Transient)& res); + + //! Searches for a transient result attached to a starting object, + //! according to its type, by criterium IsKind(atype) + //! + //! In case of multiple result, explores the list and gives in + //! the first transient result IsKind(atype) + //! Returns True and fills if found + //! Else, returns False ( is not touched, not even nullified) + //! + //! This syntactic form avoids to do DownCast : if a result is + //! found with the good type, it is loaded in and can be + //! immediately used, well initialised + Standard_EXPORT Standard_Boolean FindTypedTransient(const Handle(Standard_Transient)& start, + const Handle(Standard_Type)& atype, + Handle(Standard_Transient)& val) const; + + //! Searches for a transient result recorded in a Binder, whatever + //! this Binder is recorded or not in + //! + //! This is strictly equivalent to the class method GetTypedResult + //! from class SimpleBinderOfTransient, but is just lighter to call + //! + //! Apart from this, works as FindTypedTransient + Standard_EXPORT Standard_Boolean GetTypedTransient(const Handle(Transfer_Binder)& binder, + const Handle(Standard_Type)& atype, + Handle(Standard_Transient)& val) const; + + //! Returns the maximum possible value for Map Index + //! (no result can be bound with a value greater than it) + Standard_EXPORT Standard_Integer NbMapped() const; + + //! Returns the Starting Object bound to an Index, + Standard_EXPORT const Handle(Standard_Transient)& Mapped(const Standard_Integer num) const; + + //! Returns the Index value bound to a Starting Object, 0 if none + Standard_EXPORT Standard_Integer MapIndex(const Handle(Standard_Transient)& start) const; + + //! Returns the Binder bound to an Index + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) MapItem(const Standard_Integer num) const; + + //! Declares (and its Result) as Root. This status will be + //! later exploited by RootResult, see below (Result can be + //! produced at any time) + Standard_EXPORT void SetRoot(const Handle(Standard_Transient)& start); + + //! Enable (if True) or Disables (if False) Root + //! Management. If it is set, Transfers are considered as stacked + //! (a first Transfer commands other Transfers, and so on) and + //! the Transfers commanded by an external caller are "Root". + //! Remark : SetRoot can be called whatever this status, on every + //! object. + //! Default is set to True. + Standard_EXPORT void SetRootManagement(const Standard_Boolean stat); + + //! Returns the count of recorded Roots + Standard_EXPORT Standard_Integer NbRoots() const; + + //! Returns a Root Entity given its number in the list (1-NbRoots) + Standard_EXPORT const Handle(Standard_Transient)& Root(const Standard_Integer num) const; + + //! Returns the Binder bound with a Root Entity given its number + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) RootItem(const Standard_Integer num) const; + + //! Returns the index in the list of roots for a starting item, + //! or 0 if it is not recorded as a root + Standard_EXPORT Standard_Integer RootIndex(const Handle(Standard_Transient)& start) const; + + //! Returns Nesting Level of Transfers (managed by methods + //! TranscriptWith & Co). Starts to zero. If no automatic Transfer + //! is used, it remains to zero. Zero means Root Level. + Standard_EXPORT Standard_Integer NestingLevel() const; + + //! Resets Nesting Level of Transfers to Zero (Root Level), + //! whatever its current value. + Standard_EXPORT void ResetNestingLevel(); + + //! Tells if has been recognized as good candidate for + //! Transfer. i.e. queries the Actor and its Nexts + Standard_EXPORT Standard_Boolean Recognize(const Handle(Standard_Transient)& start) const; + + //! Performs the Transfer of a Starting Object, by calling + //! the method TransferProduct (see below). + //! Mapping and Roots are managed : nothing is done if a Result is + //! already Bound, an exception is raised in case of error. + Standard_EXPORT Handle(Transfer_Binder) Transferring( + const Handle(Standard_Transient)& start, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Same as Transferring but does not return the Binder. + //! Simply returns True in case of success (for user call) + Standard_EXPORT Standard_Boolean + Transfer(const Handle(Standard_Transient)& start, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Allows controls if exceptions will be handled + //! Transfer Operations + //! False : they are not handled with try {} catch {} + //! True : they are + //! Default is False: no handling performed + Standard_EXPORT void SetErrorHandle(const Standard_Boolean err); + + //! Returns error handling flag + Standard_EXPORT Standard_Boolean ErrorHandle() const; + + //! Method called when trace is asked + //! Calls PrintTrace to display information relevant for starting + //! objects (which can be redefined) + //! is Nesting Level of Transfer (0 = root) + //! controls the way the trace is done : + //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root + Standard_EXPORT void StartTrace(const Handle(Transfer_Binder)& binder, + const Handle(Standard_Transient)& start, + const Standard_Integer level, + const Standard_Integer mode) const; + + //! Prints a short information on a starting object. By default + //! prints its Dynamic Type. Can be redefined + Standard_EXPORT virtual void PrintTrace(const Handle(Standard_Transient)& start, + Standard_OStream& S) const; + + //! Returns True if we are surely in a DeadLoop. Evaluation is not + //! exact, it is a "majorant" which must be computed fast. + //! This "majorant" is : greater than NbMapped. + Standard_EXPORT Standard_Boolean IsLooping(const Standard_Integer alevel) const; + + //! Returns, as an iterator, the log of root transfer, i.e. the + //! created objects and Binders bound to starting roots + //! If withstart is given True, Starting Objects are also returned + Standard_EXPORT Transfer_IteratorOfProcessForTransient + RootResult(const Standard_Boolean withstart = Standard_False) const; + + //! Returns, as an Iterator, the entire log of transfer (list of + //! created objects and Binders which can bring errors) + //! If withstart is given True, Starting Objects are also returned + Standard_EXPORT Transfer_IteratorOfProcessForTransient + CompleteResult(const Standard_Boolean withstart = Standard_False) const; + + //! Returns Binders which are neither "Done" nor "Initial", + //! that is Error,Loop or Run (abnormal states at end of Transfer) + //! Starting Objects are given in correspondence in the iterator + Standard_EXPORT Transfer_IteratorOfProcessForTransient AbnormalResult() const; + + //! Returns a CheckList as a list of Check : each one is for a + //! starting entity which have either check (warning or fail) + //! messages are attached, or are in abnormal state : that case + //! gives a specific message + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Interface_CheckIterator CheckList(const Standard_Boolean erronly) const; + + //! Returns, as an Iterator, the log of transfer for one object + //! = 0 : this object only + //! and if is a scope owner (else, is ignored) : + //! = 1 : object plus its immediate scoped ones + //! = 2 : object plus all its scoped ones + Standard_EXPORT Transfer_IteratorOfProcessForTransient + ResultOne(const Handle(Standard_Transient)& start, + const Standard_Integer level, + const Standard_Boolean withstart = Standard_False) const; + + //! Returns a CheckList for one starting object + //! interpreted as by ResultOne + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Interface_CheckIterator CheckListOne(const Handle(Standard_Transient)& start, + const Standard_Integer level, + const Standard_Boolean erronly) const; + + //! Returns True if no check message is attached to a starting + //! object. interpreted as by ResultOne + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Standard_Boolean IsCheckListEmpty(const Handle(Standard_Transient)& start, + const Standard_Integer level, + const Standard_Boolean erronly) const; + + //! Removes Results attached to (== Unbinds) a given object and, + //! according : + //! = 0 : only it + //! = 1 : it plus its immediately owned sub-results(scope) + //! = 2 : it plus all its owned sub-results(scope) + Standard_EXPORT void RemoveResult(const Handle(Standard_Transient)& start, + const Standard_Integer level, + const Standard_Boolean compute = Standard_True); + + //! Computes a number to be associated to a starting object in + //! a check or a check-list + //! By default, returns 0; can be redefined + Standard_EXPORT virtual Standard_Integer CheckNum(const Handle(Standard_Transient)& start) const; + + DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForTransient, Standard_Transient) + +protected: +private: + //! Same as Find but stores the last access to the map, for a + //! faster access on next calls (as Bind does too) + //! Considers a category number, by default 0 + //! C++ : return const & + Standard_EXPORT Handle(Transfer_Binder) FindAndMask(const Handle(Standard_Transient)& start); + + //! Internal action of Transfer, called by Transferring, with or + //! without ErrorHandle. It invokes the Actor to work (set by + //! SetActor), and tries its Nexts if no result is produced, + //! until a Non Null Binder is produced. + //! But keep in mind that a Null Binder can always be returned + //! if a Starting Entity has not been recognized at all. + Standard_EXPORT Handle(Transfer_Binder) TransferProduct( + const Handle(Standard_Transient)& start, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + Standard_Boolean theerrh; + Standard_Integer thetrace; + Handle(Message_Messenger) themessenger; + Standard_Integer thelevel; + Standard_Integer therootl; + Standard_Boolean therootm; + TColStd_IndexedMapOfInteger theroots; + Handle(Standard_Transient) thelastobj; + Handle(Transfer_Binder) thelastbnd; + Standard_Integer theindex; + Handle(Transfer_ActorOfProcessForTransient) theactor; + Transfer_TransferMapOfProcessForTransient themap; +}; + +#endif // _Transfer_ProcessForTransient_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_SequenceOfBinder.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_SequenceOfBinder.hxx new file mode 100644 index 0000000000000000000000000000000000000000..8a6044df0f09a5ab8bf46a00130dcbda42ae6aad --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_SequenceOfBinder.hxx @@ -0,0 +1,25 @@ +// Created on: 1992-02-03 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Transfer_SequenceOfBinder_HeaderFile +#define Transfer_SequenceOfBinder_HeaderFile + +#include +#include + +typedef NCollection_Sequence Transfer_SequenceOfBinder; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferDispatch.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferDispatch.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e33b59daac76c992058dbf7c82bfa87b628e1818 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferDispatch.hxx @@ -0,0 +1,78 @@ +// Created on: 1992-02-07 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Transfer_TransferDispatch_HeaderFile +#define _Transfer_TransferDispatch_HeaderFile + +#include +#include +#include + +#include +class Interface_InterfaceModel; +class Interface_GeneralLib; +class Interface_Protocol; +class Transfer_TransientProcess; +class Standard_Transient; + +//! A TransferDispatch is aimed to dispatch Entities between two +//! Interface Models, by default by copying them, as CopyTool, but +//! with more capabilities of adapting : Copy is redefined to +//! firstly pass the hand to a TransferProcess. If this gives no +//! result, standard Copy is called. +//! +//! This allow, for instance, to modify the copied Entity (such as +//! changing a Name for a VDA Entity), or to do a deeper work +//! (such as Substituting a kind of Entity to another one). +//! +//! For these reasons, TransferDispatch is basically a CopyTool, +//! but uses a more sophiscated control, which is TransferProcess, +//! and its method Copy is redefined +class Transfer_TransferDispatch : public Interface_CopyTool +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates a TransferDispatch from a Model. Works with a General + //! Service Library, given as an Argument + //! A TransferDispatch is created as a CopyTool in which the + //! Control is set to TransientProcess + Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, + const Interface_GeneralLib& lib); + + //! Same as above, but Library is defined through a Protocol + Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, + const Handle(Interface_Protocol)& protocol); + + //! Same as above, but works with the Active Protocol + Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel); + + //! Returns the content of Control Object, as a TransientProcess + Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; + + //! Copies an Entity by calling the method Transferring from the + //! TransferProcess. If this called produces a Null Binder, then + //! the standard, inherited Copy is called + Standard_EXPORT virtual Standard_Boolean Copy(const Handle(Standard_Transient)& entfrom, + Handle(Standard_Transient)& entto, + const Standard_Boolean mapped, + const Standard_Boolean errstat) Standard_OVERRIDE; + +protected: +private: +}; + +#endif // _Transfer_TransferDispatch_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferOutput.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferOutput.hxx new file mode 100644 index 0000000000000000000000000000000000000000..59aeabb04254e1c973463dddcff28b096dda9208 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Transfer_TransferOutput.hxx @@ -0,0 +1,123 @@ +// Created on: 1992-02-04 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Transfer_TransferOutput_HeaderFile +#define _Transfer_TransferOutput_HeaderFile + +#include +#include +#include +#include + +class Transfer_TransientProcess; +class Interface_InterfaceModel; +class Transfer_ActorOfTransientProcess; +class Standard_Transient; +class Interface_Protocol; +class Interface_Graph; +class Interface_EntityIterator; + +//! A TransferOutput is a Tool which manages the transfer of +//! entities created by an Interface, stored in an InterfaceModel, +//! into a set of Objects suitable for an Application +//! Objects to be transferred are given, by method Transfer +//! (which calls Transfer from TransientProcess) +//! A default action is available to get all roots of the Model +//! Result is given as a TransferIterator (see TransferProcess) +//! Also, it is possible to pilot directly the TransientProcess +class Transfer_TransferOutput +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates a TransferOutput ready to use, with a TransientProcess + Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_ActorOfTransientProcess)& actor, + const Handle(Interface_InterfaceModel)& amodel); + + //! Creates a TransferOutput from an already existing + //! TransientProcess, and a Model + //! Returns (by Reference, hence can be changed) the Mode for + //! Scope Management. False (D) means Scope is ignored. + //! True means that each individual Transfer (direct or through + //! TransferRoots) is regarded as one Scope + Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc, + const Handle(Interface_InterfaceModel)& amodel); + + //! Returns the Starting Model + Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; + + //! Returns the TransientProcess used to work + Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; + + //! Transfer checks that all taken Entities come from the same + //! Model, then calls Transfer from TransientProcess + Standard_EXPORT void Transfer(const Handle(Standard_Transient)& obj, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Runs transfer on the roots of the Interface Model + //! The Roots are computed with a ShareFlags created from a + //! Protocol given as Argument + Standard_EXPORT void TransferRoots( + const Handle(Interface_Protocol)& protocol, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Runs transfer on the roots defined by a Graph of dependences + //! (which detains also a Model and its Entities) + //! Roots are computed with a ShareFlags created from the Graph + Standard_EXPORT void TransferRoots( + const Interface_Graph& G, + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Runs transfer on the roots of the Interface Model + //! Remark : the Roots are computed with a ShareFlags created + //! from the Active Protocol + Standard_EXPORT void TransferRoots( + const Message_ProgressRange& theProgress = Message_ProgressRange()); + + //! Returns the list of Starting Entities with these criteria : + //! - False, gives the entities bound with ABNORMAL STATUS + //! (e.g. : Fail recorded, Exception raised during Transfer) + //! - True, gives Entities with or without a Result, but + //! with no Fail, no Exception (Warnings are not counted) + //! - False, considers all entities recorded (either for + //! Result, or for at least one Fail or Warning message) + //! - True (Default), considers only roots of Transfer + //! (the Entities recorded at highest level) + //! This method is based on AbnormalResult from TransferProcess + Standard_EXPORT Interface_EntityIterator + ListForStatus(const Standard_Boolean normal, + const Standard_Boolean roots = Standard_True) const; + + //! Fills a Model with the list determined by ListForStatus + //! This model starts from scratch (made by NewEmptyModel from the + //! current Model), then is filled by AddWithRefs + //! + //! Useful to get separately from a transfer, the entities which + //! have caused problem, in order to furtherly analyse them (with + //! normal = False), or the "good" entities, to obtain a data set + //! "which works well" (with normal = True) + Standard_EXPORT Handle(Interface_InterfaceModel) ModelForStatus( + const Handle(Interface_Protocol)& protocol, + const Standard_Boolean normal, + const Standard_Boolean roots = Standard_True) const; + +protected: +private: + Handle(Transfer_TransientProcess) theproc; + Handle(Interface_InterfaceModel) themodel; +}; + +#endif // _Transfer_TransferOutput_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/UnitsMethods.hxx b/data/miniconda3/envs/catiagent/include/opencascade/UnitsMethods.hxx new file mode 100644 index 0000000000000000000000000000000000000000..147b170cdcabdacc18ea305ea0a3c4bcb1969a4b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/UnitsMethods.hxx @@ -0,0 +1,71 @@ +// Copyright (c) 2021 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _UnitsMethods_HeaderFile +#define _UnitsMethods_HeaderFile + +#include +#include +#include +#include + +//! Class for using global units variables +class UnitsMethods +{ +public: + DEFINE_STANDARD_ALLOC + + //! Returns value of unit encoded by parameter theUnit + //! (integer value denoting unit, as described in IGES + //! standard) in millimeters by default + Standard_EXPORT static Standard_Real GetLengthFactorValue(const Standard_Integer theUnit); + + //! Returns value of current internal unit for CASCADE + //! in millemeters by default + Standard_EXPORT static Standard_Real GetCasCadeLengthUnit( + const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter); + + //! Sets value of current internal unit for CASCADE + Standard_EXPORT static void SetCasCadeLengthUnit( + const Standard_Real theUnitValue, + const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter); + + //! Sets value of current internal unit for CASCADE + //! by parameter theUnit (integer value denoting unit, + //! as described in IGES standard) + Standard_EXPORT static void SetCasCadeLengthUnit(const Standard_Integer theUnit); + + //! Returns the scale factor for switch from first given unit to second given unit + Standard_EXPORT static Standard_Real GetLengthUnitScale(const UnitsMethods_LengthUnit theFromUnit, + const UnitsMethods_LengthUnit theToUnit); + + //! Returns the enumeration corresponding to the given scale factor + Standard_EXPORT static UnitsMethods_LengthUnit GetLengthUnitByFactorValue( + const Standard_Real theFactorValue, + const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter); + + //! Returns string name for the given scale factor + Standard_EXPORT static Standard_CString DumpLengthUnit( + const Standard_Real theScaleFactor, + const UnitsMethods_LengthUnit theBaseUnit = UnitsMethods_LengthUnit_Millimeter); + + //! Returns string for the given value of LengthUnit + Standard_EXPORT static Standard_CString DumpLengthUnit(const UnitsMethods_LengthUnit theUnit); + + //! Make conversion of given string to value of LengthUnit + Standard_EXPORT static UnitsMethods_LengthUnit LengthUnitFromString( + Standard_CString theStr, + const Standard_Boolean theCaseSensitive); +}; + +#endif // _UnitsMethods_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Units_Operators.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Units_Operators.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f2eda11b6341f399974fdf91ae0e069e55fa6cd8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Units_Operators.hxx @@ -0,0 +1,51 @@ +// Created on: 2007-05-14 +// Created by: data exchange team +// Copyright (c) 2007-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef Units_Operators_HeaderFile +#define Units_Operators_HeaderFile + +#include +#include + +Standard_EXPORT Standard_Boolean operator==(const Handle(Units_Quantity)&, const Standard_CString); +Standard_EXPORT Standard_Boolean operator==(const Handle(Units_Token)&, const Standard_CString); +Standard_EXPORT Standard_Boolean operator==(const Handle(Units_Unit)&, const Standard_CString); + +Standard_EXPORT Handle(Units_Dimensions) operator*(const Handle(Units_Dimensions)&, + const Handle(Units_Dimensions)&); +Standard_EXPORT Handle(Units_Dimensions) operator/(const Handle(Units_Dimensions)&, + const Handle(Units_Dimensions)&); + +Standard_EXPORT Handle(Units_Dimensions) pow(const Handle(Units_Dimensions)&, const Standard_Real); +Standard_EXPORT Handle(Units_Token) pow(const Handle(Units_Token)&, const Handle(Units_Token)&); +Standard_EXPORT Handle(Units_Token) pow(const Handle(Units_Token)&, const Standard_Real); + +Standard_EXPORT Handle(Units_Token) operator+(const Handle(Units_Token)&, const Standard_Integer); +Standard_EXPORT Handle(Units_Token) operator+(const Handle(Units_Token)&, + const Handle(Units_Token)&); +Standard_EXPORT Handle(Units_Token) operator-(const Handle(Units_Token)&, + const Handle(Units_Token)&); +Standard_EXPORT Handle(Units_Token) operator*(const Handle(Units_Token)&, + const Handle(Units_Token)&); +Standard_EXPORT Handle(Units_Token) operator/(const Handle(Units_Token)&, + const Handle(Units_Token)&); + +Standard_EXPORT Standard_Boolean operator!=(const Handle(Units_Token)&, const Standard_CString); +Standard_EXPORT Standard_Boolean operator<=(const Handle(Units_Token)&, const Standard_CString); +Standard_EXPORT Standard_Boolean operator>(const Handle(Units_Token)&, const Standard_CString); +Standard_EXPORT Standard_Boolean operator>(const Handle(Units_Token)&, const Handle(Units_Token)&); +Standard_EXPORT Standard_Boolean operator>=(const Handle(Units_Token)&, const Handle(Units_Token)&); + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/V3d_PositionLight.hxx b/data/miniconda3/envs/catiagent/include/opencascade/V3d_PositionLight.hxx new file mode 100644 index 0000000000000000000000000000000000000000..320ab5ca15f6c35a5610b7ff9dcea401fdaa9ffd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/V3d_PositionLight.hxx @@ -0,0 +1,38 @@ +// Created on: 1997-11-21 +// Created by: ZOV +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _V3d_PositionLight_HeaderFile +#define _V3d_PositionLight_HeaderFile + +#include + +//! Base class for Positional, Spot and Directional Light classes. +class V3d_PositionLight : public Graphic3d_CLight +{ + DEFINE_STANDARD_RTTIEXT(V3d_PositionLight, Graphic3d_CLight) +protected: + //! Protected constructor. + Standard_EXPORT V3d_PositionLight(Graphic3d_TypeOfLightSource theType); + + //! @name hidden properties not applicable to positional light +protected: + using Graphic3d_CLight::Position; + using Graphic3d_CLight::SetPosition; +}; + +DEFINE_STANDARD_HANDLE(V3d_PositionLight, Graphic3d_CLight) + +#endif // _V3d_PositionLight_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/VrmlConverter_TypeOfLight.hxx b/data/miniconda3/envs/catiagent/include/opencascade/VrmlConverter_TypeOfLight.hxx new file mode 100644 index 0000000000000000000000000000000000000000..86c895b8f9befab3212782870a5616cd0c3afd2b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/VrmlConverter_TypeOfLight.hxx @@ -0,0 +1,28 @@ +// Created on: 1997-02-18 +// Created by: Alexander BRIVIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _VrmlConverter_TypeOfLight_HeaderFile +#define _VrmlConverter_TypeOfLight_HeaderFile + +enum VrmlConverter_TypeOfLight +{ + VrmlConverter_NoLight, + VrmlConverter_DirectionLight, + VrmlConverter_PointLight, + VrmlConverter_SpotLight +}; + +#endif // _VrmlConverter_TypeOfLight_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/VrmlData_Group.hxx b/data/miniconda3/envs/catiagent/include/opencascade/VrmlData_Group.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e32a0df5f0573aab58916c6e5c78a8bcbc973c8d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/VrmlData_Group.hxx @@ -0,0 +1,167 @@ +// Created on: 2006-05-29 +// Created by: Alexander GRIGORIEV +// Copyright (c) 2006-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef VrmlData_Group_HeaderFile +#define VrmlData_Group_HeaderFile + +#include +#include +#include +#include + +class TopoDS_Shape; + +/** + * Implementation of node "Group" + */ + +class VrmlData_Group : public VrmlData_Node +{ +public: + typedef VrmlData_ListOfNode::Iterator Iterator; + + // ---------- PUBLIC METHODS ---------- + + /** + * Empty constructor. + * @param isTransform + * True if the group of type Transform is defined + * @param theAlloc + * Allocator used for the list of children + */ + VrmlData_Group(const Standard_Boolean isTransform = Standard_False) + : myIsTransform(isTransform) + { + } + + /** + * Constructor. + * @param theName + * Name of the Group node + * @param isTransform + * True if the group of type Transform is defined + * @param theAlloc + * Allocator used for the list of children + */ + Standard_EXPORT VrmlData_Group(const VrmlData_Scene& theScene, + const char* theName, + const Standard_Boolean isTransform = Standard_False); + + /** + * Add one node to the Group. + */ + inline Handle(VrmlData_Node)& AddNode(const Handle(VrmlData_Node)& theNode) + { + return myNodes.Append(theNode); + } + + /** + * Remove one node from the Group. + * @return + * True if the node was located and removed, False if none removed. + */ + Standard_EXPORT Standard_Boolean RemoveNode(const Handle(VrmlData_Node)& theNode); + + /** + * Create iterator on nodes belonging to the Group. + */ + inline Iterator NodeIterator() const { return Iterator(myNodes); } + + /** + * Query the bounding box. + */ + inline const Bnd_B3f& Box() const { return myBox; } + + /** + * Set the bounding box. + */ + inline void SetBox(const Bnd_B3f& theBox) { myBox = theBox; } + + /** + * Set the transformation. Returns True if the group is Transform type, + * otherwise do nothing and return False. + */ + Standard_EXPORT Standard_Boolean SetTransform(const gp_Trsf& theTrsf); + + /** + * Query the transform value. + * For group without transformation this always returns Identity + */ + inline const gp_Trsf& GetTransform() const { return myTrsf; } + + /** + * Query if the node is Transform type. + */ + inline Standard_Boolean IsTransform() const { return myIsTransform; } + + /** + * Create a copy of this node. + * If the parameter is null, a new copied node is created. Otherwise new node + * is not created, but rather the given one is modified. + */ + Standard_EXPORT virtual Handle(VrmlData_Node) Clone(const Handle(VrmlData_Node)& theOther) const + Standard_OVERRIDE; + + /** + * Fill the Node internal data from the given input stream. + */ + Standard_EXPORT virtual VrmlData_ErrorStatus Read(VrmlData_InBuffer& theBuffer) Standard_OVERRIDE; + + /** + * Write the Node to output stream. + */ + Standard_EXPORT virtual VrmlData_ErrorStatus Write(const char* thePrefix) const Standard_OVERRIDE; + + /** + * Find a node by its name, inside this Group + * @param theName + * Name of the node to search for. + * @param theLocation + * Location of the found node with respect to this Group. + */ + Standard_EXPORT Handle(VrmlData_Node) FindNode(const char* theName, gp_Trsf& theLocation) const; + + /** + * Get the shape representing the group geometry. + */ + Standard_EXPORT void Shape(TopoDS_Shape& theShape, VrmlData_DataMapOfShapeAppearance* pMapApp); + +protected: + // ---------- PROTECTED METHODS ---------- + + /** + * Try to open a file by the given filename, using the search directories + * list myVrmlDir of the Scene. + */ + Standard_EXPORT VrmlData_ErrorStatus openFile(Standard_IStream& theStream, + const TCollection_AsciiString& theFilename); + +private: + // ---------- PRIVATE FIELDS ---------- + + Standard_Boolean myIsTransform; + VrmlData_ListOfNode myNodes; + Bnd_B3f myBox; + gp_Trsf myTrsf; + +public: + // Declaration of CASCADE RTTI + DEFINE_STANDARD_RTTIEXT(VrmlData_Group, VrmlData_Node) +}; + +// Definition of HANDLE object using Standard_DefineHandle.hxx +DEFINE_STANDARD_HANDLE(VrmlData_Group, VrmlData_Node) + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/Vrml_Info.hxx b/data/miniconda3/envs/catiagent/include/opencascade/Vrml_Info.hxx new file mode 100644 index 0000000000000000000000000000000000000000..40784ce9a8c717564f68788a6a4c6bacb974a9a7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/Vrml_Info.hxx @@ -0,0 +1,50 @@ +// Created on: 1997-02-10 +// Created by: Alexander BRIVIN +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Vrml_Info_HeaderFile +#define _Vrml_Info_HeaderFile + +#include +#include +#include + +#include +#include + +//! defines a Info node of VRML specifying properties of geometry +//! and its appearance. +//! It is used to store information in the scene graph, +//! Typically for application-specific purposes, copyright messages, +//! or other strings. +class Vrml_Info +{ +public: + DEFINE_STANDARD_ALLOC + + Standard_EXPORT Vrml_Info(const TCollection_AsciiString& aString = ""); + + Standard_EXPORT void SetString(const TCollection_AsciiString& aString); + + Standard_EXPORT TCollection_AsciiString String() const; + + Standard_EXPORT Standard_OStream& Print(Standard_OStream& anOStream) const; + +protected: +private: + TCollection_AsciiString myString; +}; + +#endif // _Vrml_Info_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/XCAFPrs_IndexedDataMapOfShapeStyle.hxx b/data/miniconda3/envs/catiagent/include/opencascade/XCAFPrs_IndexedDataMapOfShapeStyle.hxx new file mode 100644 index 0000000000000000000000000000000000000000..62716abd5efc653682b119958148dd9a6c94bf1e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/XCAFPrs_IndexedDataMapOfShapeStyle.hxx @@ -0,0 +1,28 @@ +// Created on: 2000-08-11 +// Created by: Andrey BETENEV +// Copyright (c) 2000-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef XCAFPrs_IndexedDataMapOfShapeStyle_HeaderFile +#define XCAFPrs_IndexedDataMapOfShapeStyle_HeaderFile + +#include +#include +#include + +typedef NCollection_IndexedDataMap + XCAFPrs_IndexedDataMapOfShapeStyle; +typedef NCollection_IndexedDataMap::Iterator + XCAFPrs_DataMapIteratorOfIndexedDataMapOfShapeStyle; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/XmlMDF_TypeADriverMap.hxx b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDF_TypeADriverMap.hxx new file mode 100644 index 0000000000000000000000000000000000000000..19ae8ee25eceb07b22d30063a860e75c0484f00e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDF_TypeADriverMap.hxx @@ -0,0 +1,27 @@ +// Created on: 2001-07-09 +// Created by: Julia DOROVSKIKH +// Copyright (c) 2001-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef XmlMDF_TypeADriverMap_HeaderFile +#define XmlMDF_TypeADriverMap_HeaderFile + +#include +#include +#include + +typedef NCollection_DataMap XmlMDF_TypeADriverMap; +typedef NCollection_DataMap::Iterator + XmlMDF_DataMapIteratorOfTypeADriverMap; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_GenericExtStringDriver.hxx b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_GenericExtStringDriver.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d4609de2cad759949ab815445f1727f89a04638d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_GenericExtStringDriver.hxx @@ -0,0 +1,56 @@ +// Copyright (c) 2020 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XmlMDataStd_GenericExtStringDriver_HeaderFile +#define _XmlMDataStd_GenericExtStringDriver_HeaderFile + +#include +#include + +#include +#include +#include +class Message_Messenger; +class TDF_Attribute; +class XmlObjMgt_Persistent; + +DEFINE_STANDARD_HANDLE(XmlMDataStd_GenericExtStringDriver, XmlMDF_ADriver) + +//! Attribute Driver. +class XmlMDataStd_GenericExtStringDriver : public XmlMDF_ADriver +{ + +public: + Standard_EXPORT XmlMDataStd_GenericExtStringDriver( + const Handle(Message_Messenger)& theMessageDriver); + + Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT virtual Handle(Standard_Type) SourceType() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean + Paste(const XmlObjMgt_Persistent& Source, + const Handle(TDF_Attribute)& Target, + XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE; + + Standard_EXPORT void Paste(const Handle(TDF_Attribute)& Source, + XmlObjMgt_Persistent& Target, + XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(XmlMDataStd_GenericExtStringDriver, XmlMDF_ADriver) + +protected: +private: +}; + +#endif // _XmlMDataStd_GenericExtStringDriver_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_RealDriver.hxx b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_RealDriver.hxx new file mode 100644 index 0000000000000000000000000000000000000000..626cd9d62ffd5d66698d60574791390fd0d35316 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/XmlMDataStd_RealDriver.hxx @@ -0,0 +1,56 @@ +// Created on: 2001-08-24 +// Created by: Alexander GRIGORIEV +// Copyright (c) 2001-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _XmlMDataStd_RealDriver_HeaderFile +#define _XmlMDataStd_RealDriver_HeaderFile + +#include +#include + +#include +#include +#include +class Message_Messenger; +class TDF_Attribute; +class XmlObjMgt_Persistent; + +class XmlMDataStd_RealDriver; +DEFINE_STANDARD_HANDLE(XmlMDataStd_RealDriver, XmlMDF_ADriver) + +//! Attribute Driver. +class XmlMDataStd_RealDriver : public XmlMDF_ADriver +{ + +public: + Standard_EXPORT XmlMDataStd_RealDriver(const Handle(Message_Messenger)& theMessageDriver); + + Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT Standard_Boolean + Paste(const XmlObjMgt_Persistent& Source, + const Handle(TDF_Attribute)& Target, + XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE; + + Standard_EXPORT void Paste(const Handle(TDF_Attribute)& Source, + XmlObjMgt_Persistent& Target, + XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(XmlMDataStd_RealDriver, XmlMDF_ADriver) + +protected: +private: +}; + +#endif // _XmlMDataStd_RealDriver_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/exptocas.tab.hxx b/data/miniconda3/envs/catiagent/include/opencascade/exptocas.tab.hxx new file mode 100644 index 0000000000000000000000000000000000000000..631706d84ede6d71ed9873de134043555b70e914 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/exptocas.tab.hxx @@ -0,0 +1,856 @@ +// A Bison parser, made by GNU Bison 3.7.4. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2015, 2018-2020 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 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 . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file ExpToCasExe/exptocas.tab.hxx + ** Define the exptocas::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, +// especially those whose name start with YY_ or yy_. They are +// private implementation details that can be changed or removed. + +#ifndef YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED +#define YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED +// "%code requires" blocks. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace exptocas +{ +class scanner; +}; +#ifdef _MSC_VER + // disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment + // operators + #pragma warning(disable : 4522) +#endif + +#include // std::abort +#include +#include +#include +#include + +#if defined __cplusplus + #define YY_CPLUSPLUS __cplusplus +#else + #define YY_CPLUSPLUS 199711L +#endif + +// Support move semantics when possible. +#if 201103L <= YY_CPLUSPLUS + #define YY_MOVE std::move + #define YY_MOVE_OR_COPY move + #define YY_MOVE_REF(Type) Type&& + #define YY_RVREF(Type) Type&& + #define YY_COPY(Type) Type +#else + #define YY_MOVE + #define YY_MOVE_OR_COPY copy + #define YY_MOVE_REF(Type) Type& + #define YY_RVREF(Type) const Type& + #define YY_COPY(Type) const Type& +#endif + +// Support noexcept when possible. +#if 201103L <= YY_CPLUSPLUS + #define YY_NOEXCEPT noexcept + #define YY_NOTHROW +#else + #define YY_NOEXCEPT + #define YY_NOTHROW throw() +#endif + +// Support constexpr when possible. +#if 201703 <= YY_CPLUSPLUS + #define YY_CONSTEXPR constexpr +#else + #define YY_CONSTEXPR +#endif + +#ifndef YY_ATTRIBUTE_PURE + #if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) + #define YY_ATTRIBUTE_PURE __attribute__((__pure__)) + #else + #define YY_ATTRIBUTE_PURE + #endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED + #if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) + #define YY_ATTRIBUTE_UNUSED __attribute__((__unused__)) + #else + #define YY_ATTRIBUTE_UNUSED + #endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if !defined lint || defined __GNUC__ + #define YYUSE(E) ((void)(E)) +#else + #define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && !defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ + /* Suppress an incorrect diagnostic about yylval being uninitialized. */ + #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") + #define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop") +#else + #define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + #define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE + #define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__ + #define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") + #define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN + #define YY_IGNORE_USELESS_CAST_BEGIN + #define YY_IGNORE_USELESS_CAST_END +#endif + +#ifndef YY_CAST + #ifdef __cplusplus + #define YY_CAST(Type, Val) static_cast(Val) + #define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast(Val) + #else + #define YY_CAST(Type, Val) ((Type)(Val)) + #define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val)) + #endif +#endif +#ifndef YY_NULLPTR + #if defined __cplusplus + #if 201103L <= __cplusplus + #define YY_NULLPTR nullptr + #else + #define YY_NULLPTR 0 + #endif + #else + #define YY_NULLPTR ((void*)0) + #endif +#endif + +/* Debug traces. */ +#ifndef YYDEBUG + #define YYDEBUG 0 +#endif + +namespace exptocas +{ + +/// A Bison parser. +class parser +{ +public: +#ifndef YYSTYPE + /// Symbol semantic values. + union semantic_type { + + int num; + char* str; + TColStd_HSequenceOfHAsciiString* tlist; + Express_HSequenceOfField* flist; + Express_HSequenceOfItem* ilist; + Express_Field* field; + Express_Item* item; + Express_Type* type; + Express_Schema* schema; + Express_Reference* ref; + }; +#else + typedef YYSTYPE semantic_type; +#endif + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error(const std::string& m) + : std::runtime_error(m) + { + } + + syntax_error(const syntax_error& s) + : std::runtime_error(s.what()) + { + } + + ~syntax_error() YY_NOEXCEPT YY_NOTHROW; + }; + + /// Token kinds. + struct token + { + enum token_kind_type + { + YYEMPTY = -2, + YYEOF = 0, // "end of file" + YYerror = 256, // error + YYUNDEF = 257, // "invalid token" + KSCHEM = 258, // KSCHEM + KENDS = 259, // KENDS + KTYP = 260, // KTYP + KENDT = 261, // KENDT + KENT = 262, // KENT + KENDE = 263, // KENDE + KREF = 264, // KREF + KFROM = 265, // KFROM + KSEL = 266, // KSEL + KENUM = 267, // KENUM + KLIST = 268, // KLIST + KARR = 269, // KARR + KBAG = 270, // KBAG + KSET = 271, // KSET + KOF = 272, // KOF + KNUM = 273, // KNUM + KINT = 274, // KINT + KDBL = 275, // KDBL + KSTR = 276, // KSTR + KLOG = 277, // KLOG + KBOOL = 278, // KBOOL + KOPT = 279, // KOPT + KUNIQ = 280, // KUNIQ + KSELF = 281, // KSELF + KABSTR = 282, // KABSTR + KSUBT = 283, // KSUBT + KSPRT = 284, // KSPRT + KANDOR = 285, // KANDOR + K1OF = 286, // K1OF + KAND = 287, // KAND + NUMBER = 288, // NUMBER + NAME = 289 // NAME + }; + + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type yytokentype; + }; + + /// Token kind, as returned by yylex. + typedef token::yytokentype token_kind_type; + + /// Backward compatibility alias (Bison 3.6). + typedef token_kind_type token_type; + + /// Symbol kinds. + struct symbol_kind + { + enum symbol_kind_type + { + YYNTOKENS = 46, ///< Number of tokens. + S_YYEMPTY = -2, + S_YYEOF = 0, // "end of file" + S_YYerror = 1, // error + S_YYUNDEF = 2, // "invalid token" + S_KSCHEM = 3, // KSCHEM + S_KENDS = 4, // KENDS + S_KTYP = 5, // KTYP + S_KENDT = 6, // KENDT + S_KENT = 7, // KENT + S_KENDE = 8, // KENDE + S_KREF = 9, // KREF + S_KFROM = 10, // KFROM + S_KSEL = 11, // KSEL + S_KENUM = 12, // KENUM + S_KLIST = 13, // KLIST + S_KARR = 14, // KARR + S_KBAG = 15, // KBAG + S_KSET = 16, // KSET + S_KOF = 17, // KOF + S_KNUM = 18, // KNUM + S_KINT = 19, // KINT + S_KDBL = 20, // KDBL + S_KSTR = 21, // KSTR + S_KLOG = 22, // KLOG + S_KBOOL = 23, // KBOOL + S_KOPT = 24, // KOPT + S_KUNIQ = 25, // KUNIQ + S_KSELF = 26, // KSELF + S_KABSTR = 27, // KABSTR + S_KSUBT = 28, // KSUBT + S_KSPRT = 29, // KSPRT + S_KANDOR = 30, // KANDOR + S_K1OF = 31, // K1OF + S_KAND = 32, // KAND + S_NUMBER = 33, // NUMBER + S_NAME = 34, // NAME + S_35_ = 35, // ',' + S_36_ = 36, // ';' + S_37_ = 37, // '=' + S_38_ = 38, // '(' + S_39_ = 39, // ')' + S_40_ = 40, // '[' + S_41_ = 41, // ':' + S_42_ = 42, // ']' + S_43_ = 43, // '?' + S_44_ = 44, // '\\' + S_45_ = 45, // '.' + S_YYACCEPT = 46, // $accept + S_SCHEMA = 47, // SCHEMA + S_ILIST = 48, // ILIST + S_ITEM = 49, // ITEM + S_ENUM = 50, // ENUM + S_SELECT = 51, // SELECT + S_ALIAS = 52, // ALIAS + S_ENTITY = 53, // ENTITY + S_REFERENCE = 54, // REFERENCE + S_TLIST = 55, // TLIST + S_TLIST1 = 56, // TLIST1 + S_TYPE = 57, // TYPE + S_TSTD = 58, // TSTD + S_TNAME = 59, // TNAME + S_TSET = 60, // TSET + S_INDEX = 61, // INDEX + S_OPTUNI = 62, // OPTUNI + S_SUBT = 63, // SUBT + S_SUPERT = 64, // SUPERT + S_SUPLST = 65, // SUPLST + S_FLIST = 66, // FLIST + S_FLIST1 = 67, // FLIST1 + S_FIELD = 68, // FIELD + S_REDEF = 69, // REDEF + S_SPECIF = 70, // SPECIF + S_OPTNL = 71, // OPTNL + S_UNIQIT = 72, // UNIQIT + S_UNIQLS = 73, // UNIQLS + S_UNIQUE = 74, // UNIQUE + S_SPCLST = 75 // SPCLST + }; + }; + + /// (Internal) symbol kind. + typedef symbol_kind::symbol_kind_type symbol_kind_type; + + /// The number of tokens. + static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol kind + /// via kind (). + /// + /// Provide access to semantic value. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol() + : value() + { + } + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + basic_symbol(basic_symbol&& that) + : Base(std::move(that)), + value(std::move(that.value)) + { + } +#endif + + /// Copy constructor. + basic_symbol(const basic_symbol& that); + /// Constructor for valueless symbols. + basic_symbol(typename Base::kind_type t); + + /// Constructor for symbols with semantic value. + basic_symbol(typename Base::kind_type t, YY_RVREF(semantic_type) v); + + /// Destroy the symbol. + ~basic_symbol() { clear(); } + + /// Destroy contents, and record that is empty. + void clear() { Base::clear(); } + +#if YYDEBUG || 0 + /// The user-facing name of this symbol. + const char* name() const YY_NOEXCEPT { return parser::symbol_name(this->kind()); } +#endif // #if YYDEBUG || 0 + + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get() const YY_NOEXCEPT; + + /// Whether empty. + bool empty() const YY_NOEXCEPT; + + /// Destructive move, \a s is emptied into this. + void move(basic_symbol& s); + + /// The semantic value. + semantic_type value; + + private: +#if YY_CPLUSPLUS < 201103L + /// Assignment operator. + basic_symbol& operator=(const basic_symbol& that); +#endif + }; + + /// Type access provider for token (enum) based symbols. + struct by_kind + { + /// Default constructor. + by_kind(); + +#if 201103L <= YY_CPLUSPLUS + /// Move constructor. + by_kind(by_kind&& that); +#endif + + /// Copy constructor. + by_kind(const by_kind& that); + + /// The symbol kind as needed by the constructor. + typedef token_kind_type kind_type; + + /// Constructor from (external) token numbers. + by_kind(kind_type t); + + /// Record that this symbol is empty. + void clear(); + + /// Steal the symbol kind from \a that. + void move(by_kind& that); + + /// The (internal) type number (corresponding to \a type). + /// \a empty when empty. + symbol_kind_type kind() const YY_NOEXCEPT; + + /// Backward compatibility (Bison 3.6). + symbol_kind_type type_get() const YY_NOEXCEPT; + + /// The symbol kind. + /// \a S_YYEMPTY when empty. + symbol_kind_type kind_; + }; + + /// Backward compatibility for a private implementation detail (Bison 3.6). + typedef by_kind by_type; + + /// "External" symbols: returned by the scanner. + struct symbol_type : basic_symbol + { + }; + + /// Build a parser object. + parser(exptocas::scanner* scanner_yyarg); + virtual ~parser(); + +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + parser(const parser&) = delete; + /// Non copyable. + parser& operator=(const parser&) = delete; +#endif + + /// Parse. An alias for parse (). + /// \returns 0 iff parsing succeeded. + int operator()(); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse(); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream() const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream(std::ostream&); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level() const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level(debug_level_type l); +#endif + + /// Report a syntax error. + /// \param msg a description of the syntax error. + virtual void error(const std::string& msg); + + /// Report a syntax error. + void error(const syntax_error& err); + +#if YYDEBUG || 0 + /// The user-facing name of the symbol whose (internal) number is + /// YYSYMBOL. No bounds checking. + static const char* symbol_name(symbol_kind_type yysymbol); +#endif // #if YYDEBUG || 0 + +private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + parser(const parser&); + /// Non copyable. + parser& operator=(const parser&); +#endif + + /// Stored state numbers (used for stacks). + typedef unsigned char state_type; + + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + static state_type yy_lr_goto_state_(state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_(int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_(int yyvalue); + + static const short yypact_ninf_; + static const signed char yytable_ninf_; + + /// Convert a scanner token kind \a t to a symbol kind. + /// In theory \a t should be a token_kind_type, but character literals + /// are valid, yet not members of the token_type enum. + static symbol_kind_type yytranslate_(int t); + +#if YYDEBUG || 0 + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif // #if YYDEBUG || 0 + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const short yypact_[]; + + // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + // Performed when YYTABLE does not specify something else to do. Zero + // means the default is an error. + static const signed char yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const short yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const short yydefgoto_[]; + + // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + // positive, shift that token. If negative, reduce the rule whose + // number is the opposite. If YYTABLE_NINF, syntax error. + static const unsigned char yytable_[]; + + static const short yycheck_[]; + + // YYSTOS[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. + static const signed char yystos_[]; + + // YYR1[YYN] -- Symbol number of symbol that rule YYN derives. + static const signed char yyr1_[]; + + // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. + static const signed char yyr2_[]; + +#if YYDEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const short yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_(int r) const; + /// Print the state stack on the debug stream. + virtual void yy_stack_print_() const; + + /// Debugging level. + int yydebug_; + /// Debug stream. + std::ostream* yycdebug_; + + /// \brief Display a symbol kind, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_(std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_(const char* yymsg, basic_symbol& yysym) const; + +private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state() YY_NOEXCEPT; + + /// The symbol kind as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state(kind_type s) YY_NOEXCEPT; + + /// Copy constructor. + by_state(const by_state& that) YY_NOEXCEPT; + + /// Record that this symbol is empty. + void clear() YY_NOEXCEPT; + + /// Steal the symbol kind from \a that. + void move(by_state& that); + + /// The symbol kind (corresponding to \a state). + /// \a symbol_kind::S_YYEMPTY when empty. + symbol_kind_type kind() const YY_NOEXCEPT; + + /// The state number used to denote an empty symbol. + /// We use the initial state, as it does not have a value. + enum + { + empty_state = 0 + }; + + /// The state. + /// \a empty when empty. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type(); + /// Move or copy construction. + stack_symbol_type(YY_RVREF(stack_symbol_type) that); + /// Steal the contents from \a sym to build this. + stack_symbol_type(state_type s, YY_MOVE_REF(symbol_type) sym); +#if YY_CPLUSPLUS < 201103L + /// Assignment, needed by push_back by some old implementations. + /// Moves the contents of that. + stack_symbol_type& operator=(stack_symbol_type& that); + + /// Assignment, needed by push_back by other implementations. + /// Needed by some other old implementations. + stack_symbol_type& operator=(const stack_symbol_type& that); +#endif + }; + + /// A stack with random access from its top. + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::iterator iterator; + typedef typename S::const_iterator const_iterator; + typedef typename S::size_type size_type; + typedef typename std::ptrdiff_t index_type; + + stack(size_type n = 200) + : seq_(n) + { + } + +#if 201103L <= YY_CPLUSPLUS + /// Non copyable. + stack(const stack&) = delete; + /// Non copyable. + stack& operator=(const stack&) = delete; +#endif + + /// Random access. + /// + /// Index 0 returns the topmost element. + const T& operator[](index_type i) const { return seq_[size_type(size() - 1 - i)]; } + + /// Random access. + /// + /// Index 0 returns the topmost element. + T& operator[](index_type i) { return seq_[size_type(size() - 1 - i)]; } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + void push(YY_MOVE_REF(T) t) + { + seq_.push_back(T()); + operator[](0).move(t); + } + + /// Pop elements from the stack. + void pop(std::ptrdiff_t n = 1) YY_NOEXCEPT + { + for (; 0 < n; --n) + seq_.pop_back(); + } + + /// Pop all elements from the stack. + void clear() YY_NOEXCEPT { seq_.clear(); } + + /// Number of elements on the stack. + index_type size() const YY_NOEXCEPT { return index_type(seq_.size()); } + + /// Iterator on top of the stack (going downwards). + const_iterator begin() const YY_NOEXCEPT { return seq_.begin(); } + + /// Bottom of the stack. + const_iterator end() const YY_NOEXCEPT { return seq_.end(); } + + /// Present a slice of the top of a stack. + class slice + { + public: + slice(const stack& stack, index_type range) + : stack_(stack), + range_(range) + { + } + + const T& operator[](index_type i) const { return stack_[range_ - i]; } + + private: + const stack& stack_; + index_type range_; + }; + + private: +#if YY_CPLUSPLUS < 201103L + /// Non copyable. + stack(const stack&); + /// Non copyable. + stack& operator=(const stack&); +#endif + /// The wrapped container. + S seq_; + }; + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param sym the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_(const char* m, YY_MOVE_REF(stack_symbol_type) sym); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a sym.value is stolen. + void yypush_(const char* m, state_type s, YY_MOVE_REF(symbol_type) sym); + + /// Pop \a n symbols from the stack. + void yypop_(int n = 1); + + /// Constants. + enum + { + yylast_ = 164, ///< Last index in yytable_. + yynnts_ = 30, ///< Number of nonterminal symbols. + yyfinal_ = 4 ///< Termination state number. + }; + + // User arguments. + exptocas::scanner* scanner; +}; + +} // namespace exptocas + +// "%code provides" blocks. + +#if !defined(yyFlexLexer) && !defined(FlexLexerOnce) + #define yyFlexLexer exptocasFlexLexer + #include "FlexLexer.h" +#endif +namespace exptocas +{ +// To feed data back to bison, the yylex method needs yylval and +// yylloc parameters. Since the exptocasFlexLexer class is defined in the +// system header the signature of its yylex() method +// can not be changed anymore. This makes it necessary to derive a +// scanner class that provides a method with the desired signature: +class scanner : public exptocasFlexLexer +{ +public: + explicit scanner(std::istream* in = 0, std::ostream* out = 0); + + int lex(exptocas::parser::semantic_type* yylval); +}; +}; // namespace exptocas + +#endif // !YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED diff --git a/data/miniconda3/envs/catiagent/include/opencascade/gp_Circ.hxx b/data/miniconda3/envs/catiagent/include/opencascade/gp_Circ.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3fff5499dccd5853a89d4c3c513fff0d6a48f45f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/gp_Circ.hxx @@ -0,0 +1,285 @@ +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _gp_Circ_HeaderFile +#define _gp_Circ_HeaderFile + +#include +#include +#include +#include +#include +#include + +//! Describes a circle in 3D space. +//! A circle is defined by its radius and positioned in space +//! with a coordinate system (a gp_Ax2 object) as follows: +//! - the origin of the coordinate system is the center of the circle, and +//! - the origin, "X Direction" and "Y Direction" of the +//! coordinate system define the plane of the circle. +//! This positioning coordinate system is the "local +//! coordinate system" of the circle. Its "main Direction" +//! gives the normal vector to the plane of the circle. The +//! "main Axis" of the coordinate system is referred to as +//! the "Axis" of the circle. +//! Note: when a gp_Circ circle is converted into a +//! Geom_Circle circle, some implicit properties of the +//! circle are used explicitly: +//! - the "main Direction" of the local coordinate system +//! gives an implicit orientation to the circle (and defines +//! its trigonometric sense), +//! - this orientation corresponds to the direction in +//! which parameter values increase, +//! - the starting point for parameterization is that of the +//! "X Axis" of the local coordinate system (i.e. the "X Axis" of the circle). +//! See Also +//! gce_MakeCirc which provides functions for more complex circle constructions +//! Geom_Circle which provides additional functions for +//! constructing circles and works, in particular, with the +//! parametric equations of circles +class gp_Circ +{ +public: + DEFINE_STANDARD_ALLOC + + //! Creates an indefinite circle. + gp_Circ() + : radius(RealLast()) + { + } + + //! A2 locates the circle and gives its orientation in 3D space. + //! Warnings : + //! It is not forbidden to create a circle with theRadius = 0.0 Raises ConstructionError if + //! theRadius < 0.0 + gp_Circ(const gp_Ax2& theA2, const Standard_Real theRadius) + : pos(theA2), + radius(theRadius) + { + Standard_ConstructionError_Raise_if(theRadius < 0.0, + "gp_Circ() - radius should be positive number"); + } + + //! Changes the main axis of the circle. It is the axis + //! perpendicular to the plane of the circle. + //! Raises ConstructionError if the direction of theA1 + //! is parallel to the "XAxis" of the circle. + void SetAxis(const gp_Ax1& theA1) { pos.SetAxis(theA1); } + + //! Changes the "Location" point (center) of the circle. + void SetLocation(const gp_Pnt& theP) { pos.SetLocation(theP); } + + //! Changes the position of the circle. + void SetPosition(const gp_Ax2& theA2) { pos = theA2; } + + //! Modifies the radius of this circle. + //! Warning. This class does not prevent the creation of a circle where theRadius is null. + //! Exceptions + //! Standard_ConstructionError if theRadius is negative. + void SetRadius(const Standard_Real theRadius) + { + Standard_ConstructionError_Raise_if(theRadius < 0.0, + "gp_Circ::SetRadius() - radius should be positive number"); + radius = theRadius; + } + + //! Computes the area of the circle. + Standard_Real Area() const { return M_PI * radius * radius; } + + //! Returns the main axis of the circle. + //! It is the axis perpendicular to the plane of the circle, + //! passing through the "Location" point (center) of the circle. + const gp_Ax1& Axis() const { return pos.Axis(); } + + //! Computes the circumference of the circle. + Standard_Real Length() const { return 2. * M_PI * radius; } + + //! Returns the center of the circle. It is the + //! "Location" point of the local coordinate system + //! of the circle + const gp_Pnt& Location() const { return pos.Location(); } + + //! Returns the position of the circle. + //! It is the local coordinate system of the circle. + const gp_Ax2& Position() const { return pos; } + + //! Returns the radius of this circle. + Standard_Real Radius() const { return radius; } + + //! Returns the "XAxis" of the circle. + //! This axis is perpendicular to the axis of the conic. + //! This axis and the "Yaxis" define the plane of the conic. + gp_Ax1 XAxis() const { return gp_Ax1(pos.Location(), pos.XDirection()); } + + //! Returns the "YAxis" of the circle. + //! This axis and the "Xaxis" define the plane of the conic. + //! The "YAxis" is perpendicular to the "Xaxis". + gp_Ax1 YAxis() const { return gp_Ax1(pos.Location(), pos.YDirection()); } + + //! Computes the minimum of distance between the point theP and + //! any point on the circumference of the circle. + Standard_Real Distance(const gp_Pnt& theP) const { return sqrt(SquareDistance(theP)); } + + //! Computes the square distance between and the point theP. + Standard_Real SquareDistance(const gp_Pnt& theP) const + { + gp_Vec aV(Location(), theP); + Standard_Real aX = aV.Dot(pos.XDirection()); + Standard_Real anY = aV.Dot(pos.YDirection()); + Standard_Real aZ = aV.Dot(pos.Direction()); + Standard_Real aT = sqrt(aX * aX + anY * anY) - radius; + return (aT * aT + aZ * aZ); + } + + //! Returns True if the point theP is on the circumference. + //! The distance between and must be lower or + //! equal to theLinearTolerance. + Standard_Boolean Contains(const gp_Pnt& theP, const Standard_Real theLinearTolerance) const + { + return Distance(theP) <= theLinearTolerance; + } + + Standard_EXPORT void Mirror(const gp_Pnt& theP); + + //! Performs the symmetrical transformation of a circle + //! with respect to the point theP which is the center of the + //! symmetry. + Standard_NODISCARD Standard_EXPORT gp_Circ Mirrored(const gp_Pnt& theP) const; + + Standard_EXPORT void Mirror(const gp_Ax1& theA1); + + //! Performs the symmetrical transformation of a circle with + //! respect to an axis placement which is the axis of the + //! symmetry. + Standard_NODISCARD Standard_EXPORT gp_Circ Mirrored(const gp_Ax1& theA1) const; + + Standard_EXPORT void Mirror(const gp_Ax2& theA2); + + //! Performs the symmetrical transformation of a circle with respect + //! to a plane. The axis placement theA2 locates the plane of the + //! of the symmetry : (Location, XDirection, YDirection). + Standard_NODISCARD Standard_EXPORT gp_Circ Mirrored(const gp_Ax2& theA2) const; + + void Rotate(const gp_Ax1& theA1, const Standard_Real theAng) { pos.Rotate(theA1, theAng); } + + //! Rotates a circle. theA1 is the axis of the rotation. + //! theAng is the angular value of the rotation in radians. + Standard_NODISCARD gp_Circ Rotated(const gp_Ax1& theA1, const Standard_Real theAng) const + { + gp_Circ aC = *this; + aC.pos.Rotate(theA1, theAng); + return aC; + } + + void Scale(const gp_Pnt& theP, const Standard_Real theS); + + //! Scales a circle. theS is the scaling value. + //! Warnings : + //! If theS is negative the radius stay positive but + //! the "XAxis" and the "YAxis" are reversed as for + //! an ellipse. + Standard_NODISCARD gp_Circ Scaled(const gp_Pnt& theP, const Standard_Real theS) const; + + void Transform(const gp_Trsf& theT); + + //! Transforms a circle with the transformation theT from class Trsf. + Standard_NODISCARD gp_Circ Transformed(const gp_Trsf& theT) const; + + void Translate(const gp_Vec& theV) { pos.Translate(theV); } + + //! Translates a circle in the direction of the vector theV. + //! The magnitude of the translation is the vector's magnitude. + Standard_NODISCARD gp_Circ Translated(const gp_Vec& theV) const + { + gp_Circ aC = *this; + aC.pos.Translate(theV); + return aC; + } + + void Translate(const gp_Pnt& theP1, const gp_Pnt& theP2) { pos.Translate(theP1, theP2); } + + //! Translates a circle from the point theP1 to the point theP2. + Standard_NODISCARD gp_Circ Translated(const gp_Pnt& theP1, const gp_Pnt& theP2) const + { + gp_Circ aC = *this; + aC.pos.Translate(theP1, theP2); + return aC; + } + +private: + gp_Ax2 pos; + Standard_Real radius; +}; + +// ======================================================================= +// function : Scale +// purpose : +// ======================================================================= +inline void gp_Circ::Scale(const gp_Pnt& theP, const Standard_Real theS) +{ + radius *= theS; + if (radius < 0) + { + radius = -radius; + } + pos.Scale(theP, theS); +} + +// ======================================================================= +// function : Scaled +// purpose : +// ======================================================================= +inline gp_Circ gp_Circ::Scaled(const gp_Pnt& theP, const Standard_Real theS) const +{ + gp_Circ aC = *this; + aC.radius *= theS; + if (aC.radius < 0) + { + aC.radius = -aC.radius; + } + aC.pos.Scale(theP, theS); + return aC; +} + +// ======================================================================= +// function : Transform +// purpose : +// ======================================================================= +inline void gp_Circ::Transform(const gp_Trsf& theT) +{ + radius *= theT.ScaleFactor(); + if (radius < 0) + { + radius = -radius; + } + pos.Transform(theT); +} + +// ======================================================================= +// function : Transformed +// purpose : +// ======================================================================= +inline gp_Circ gp_Circ::Transformed(const gp_Trsf& theT) const +{ + gp_Circ aC = *this; + aC.radius *= theT.ScaleFactor(); + if (aC.radius < 0) + { + aC.radius = -aC.radius; + } + aC.pos.Transform(theT); + return aC; +} + +#endif // _gp_Circ_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/math_GlobOptMin.hxx b/data/miniconda3/envs/catiagent/include/opencascade/math_GlobOptMin.hxx new file mode 100644 index 0000000000000000000000000000000000000000..fce2741644db4ccd04cbbbbc5de79cd6bca2e973 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/math_GlobOptMin.hxx @@ -0,0 +1,272 @@ +// Created on: 2014-01-20 +// Created by: Alexaner Malyshev +// Copyright (c) 2014-2015 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _math_GlobOptMin_HeaderFile +#define _math_GlobOptMin_HeaderFile + +#include +#include +#include +#include + +//! This class represents Evtushenko's algorithm of global optimization based on non-uniform mesh. +//! Article: Yu. Evtushenko. Numerical methods for finding global extreme (case of a non-uniform +//! mesh). U.S.S.R. Comput. Maths. Math. Phys., Vol. 11, N 6, pp. 38-54. +//! +//! This method performs search on non-uniform mesh. The search space is a box in R^n space. +//! The default behavior is to find all minimums in that box. Computation of maximums is not +//! supported. +//! +//! The search box can be split into smaller boxes by discontinuity criteria. +//! This functionality is covered by SetGlobalParams and SetLocalParams API. +//! +//! It is possible to set continuity of the local boxes. +//! Such option can forcibly change local extrema search. +//! In other words if theFunc can be casted to the function with Hessian but, continuity is set to 1 +//! Gradient based local optimization method will be used, not Hessian based method. +//! This functionality is covered by SetContinuity and GetContinuity API. +//! +//! It is possible to freeze Lipschitz const to avoid internal modifications on it. +//! This functionality is covered by SetLipConstState and GetLipConstState API. +//! +//! It is possible to perform single solution search. +//! This functionality is covered by first parameter in Perform method. +//! +//! It is possible to set / get minimal value of the functional. +//! It works well together with single solution search. +//! This functionality is covered by SetFunctionalMinimalValue and GetFunctionalMinimalValue API. +class math_GlobOptMin +{ +public: + //! Constructor. Perform method is not called from it. + //! @param theFunc - objective functional. + //! @param theLowerBorder - lower corner of the search box. + //! @param theUpperBorder - upper corner of the search box. + //! @param theC - Lipschitz constant. + //! @param theDiscretizationTol - parameter space discretization tolerance. + //! @param theSameTol - functional value space indifference tolerance. + Standard_EXPORT math_GlobOptMin(math_MultipleVarFunction* theFunc, + const math_Vector& theLowerBorder, + const math_Vector& theUpperBorder, + const Standard_Real theC = 9, + const Standard_Real theDiscretizationTol = 1.0e-2, + const Standard_Real theSameTol = 1.0e-7); + + //! @param theFunc - objective functional. + //! @param theLowerBorder - lower corner of the search box. + //! @param theUpperBorder - upper corner of the search box. + //! @param theC - Lipschitz constant. + //! @param theDiscretizationTol - parameter space discretization tolerance. + //! @param theSameTol - functional value space indifference tolerance. + Standard_EXPORT void SetGlobalParams(math_MultipleVarFunction* theFunc, + const math_Vector& theLowerBorder, + const math_Vector& theUpperBorder, + const Standard_Real theC = 9, + const Standard_Real theDiscretizationTol = 1.0e-2, + const Standard_Real theSameTol = 1.0e-7); + + //! Method to reduce bounding box. Perform will use this box. + //! @param theLocalA - lower corner of the local box. + //! @param theLocalB - upper corner of the local box. + Standard_EXPORT void SetLocalParams(const math_Vector& theLocalA, const math_Vector& theLocalB); + + //! Method to set tolerances. + //! @param theDiscretizationTol - parameter space discretization tolerance. + //! @param theSameTol - functional value space indifference tolerance. + Standard_EXPORT void SetTol(const Standard_Real theDiscretizationTol, + const Standard_Real theSameTol); + + //! Method to get tolerances. + //! @param theDiscretizationTol - parameter space discretization tolerance. + //! @param theSameTol - functional value space indifference tolerance. + Standard_EXPORT void GetTol(Standard_Real& theDiscretizationTol, Standard_Real& theSameTol); + + //! @param isFindSingleSolution - defines whether to find single solution or all solutions. + Standard_EXPORT void Perform(const Standard_Boolean isFindSingleSolution = Standard_False); + + //! Return solution theIndex, 1 <= theIndex <= NbExtrema. + Standard_EXPORT void Points(const Standard_Integer theIndex, math_Vector& theSol); + + //! Set / Get continuity of local borders splits (0 ~ C0, 1 ~ C1, 2 ~ C2). + inline void SetContinuity(const Standard_Integer theCont) { myCont = theCont; } + + inline Standard_Integer GetContinuity() const { return myCont; } + + //! Set / Get functional minimal value. + inline void SetFunctionalMinimalValue(const Standard_Real theMinimalValue) + { + myFunctionalMinimalValue = theMinimalValue; + } + + inline Standard_Real GetFunctionalMinimalValue() const { return myFunctionalMinimalValue; } + + //! Set / Get Lipchitz constant modification state. + //! True means that the constant is locked and unlocked otherwise. + inline void SetLipConstState(const Standard_Boolean theFlag) { myIsConstLocked = theFlag; } + + inline Standard_Boolean GetLipConstState() const { return myIsConstLocked; } + + //! Return computation state of the algorithm. + inline Standard_Boolean isDone() const { return myDone; } + + //! Get best functional value. + inline Standard_Real GetF() const { return myF; } + + //! Return count of global extremas. + inline Standard_Integer NbExtrema() const { return mySolCount; } + +private: + //! Class for duplicate fast search. For internal usage only. + class NCollection_CellFilter_Inspector + { + public: + //! Points and target type + typedef math_Vector Point; + typedef math_Vector Target; + + NCollection_CellFilter_Inspector(const Standard_Integer theDim, const Standard_Real theTol) + : myCurrent(1, theDim) + { + myTol = theTol * theTol; + myIsFind = Standard_False; + Dimension = theDim; + } + + //! Access to coordinate. + static Standard_Real Coord(int i, const Point& thePnt) { return thePnt(i + 1); } + + //! Auxiliary method to shift point by each coordinate on given value; + //! useful for preparing a points range for Inspect with tolerance. + void Shift(const Point& thePnt, + const NCollection_Array1& theTol, + Point& theLowPnt, + Point& theUppPnt) const + { + for (Standard_Integer anIdx = 1; anIdx <= Dimension; anIdx++) + { + theLowPnt(anIdx) = thePnt(anIdx) - theTol(anIdx - 1); + theUppPnt(anIdx) = thePnt(anIdx) + theTol(anIdx - 1); + } + } + + void ClearFind() { myIsFind = Standard_False; } + + Standard_Boolean isFind() { return myIsFind; } + + //! Set current point to search for coincidence + void SetCurrent(const math_Vector& theCurPnt) { myCurrent = theCurPnt; } + + //! Implementation of inspection method + NCollection_CellFilter_Action Inspect(const Target& theObject) + { + Standard_Real aSqDist = (myCurrent - theObject).Norm2(); + + if (aSqDist < myTol) + { + myIsFind = Standard_True; + } + + return CellFilter_Keep; + } + + private: + Standard_Real myTol; + math_Vector myCurrent; + Standard_Boolean myIsFind; + Standard_Integer Dimension; + }; + + // Compute cell size. + void initCellSize(); + + // Compute initial solution + void ComputeInitSol(); + + math_GlobOptMin& operator=(const math_GlobOptMin& theOther); + + Standard_Boolean computeLocalExtremum(const math_Vector& thePnt, + Standard_Real& theVal, + math_Vector& theOutPnt); + + void computeGlobalExtremum(Standard_Integer theIndex); + + //! Check possibility to stop computations. + //! Find single solution + in neighborhood of best possible solution. + Standard_Boolean CheckFunctionalStopCriteria(); + + //! Computes starting value / approximation: + //! myF - initial best value. + //! myY - initial best point. + //! myC - approximation of Lipschitz constant. + //! to improve convergence speed. + void computeInitialValues(); + + //! Check that myA <= thePnt <= myB + Standard_Boolean isInside(const math_Vector& thePnt); + + //! Check presence of thePnt in GlobOpt sequence. + Standard_Boolean isStored(const math_Vector& thePnt); + + //! Check and add candidate point into solutions. + //! @param thePnt Candidate point. + //! @param theValue Function value in the candidate point. + void checkAddCandidate(const math_Vector& thePnt, const Standard_Real theValue); + + // Input. + math_MultipleVarFunction* myFunc; + Standard_Integer myN; + math_Vector myA; // Left border on current C2 interval. + math_Vector myB; // Right border on current C2 interval. + math_Vector myGlobA; // Global left border. + math_Vector myGlobB; // Global right border. + Standard_Real myTol; // Discretization tolerance, default 1.0e-2. + Standard_Real mySameTol; // points with ||p1 - p2|| < mySameTol is equal, + // function values |val1 - val2| * 0.01 < mySameTol is equal, + // default value is 1.0e-7. + Standard_Real myC; // Lipchitz constant, default 9 + Standard_Real myInitC; // Lipchitz constant initial value. + Standard_Boolean myIsFindSingleSolution; // Default value is false. + Standard_Real myFunctionalMinimalValue; // Default value is -Precision::Infinite + Standard_Boolean myIsConstLocked; // Is constant locked for modifications. + + // Output. + Standard_Boolean myDone; + NCollection_Sequence myY; // Current solutions. + Standard_Integer mySolCount; // Count of solutions. + + // Algorithm data. + Standard_Real myZ; + Standard_Real myE1{}; // Border coefficient. + Standard_Real myE2{}; // Minimum step size. + Standard_Real myE3{}; // Local extrema starting parameter. + + math_Vector myX; // Current modified solution. + math_Vector myTmp; // Current modified solution. + math_Vector myV; // Steps array. + math_Vector myMaxV; // Max Steps array. + Standard_Real myLastStep{}; // Last step. + + NCollection_Array1 myCellSize; + Standard_Integer myMinCellFilterSol; + Standard_Boolean isFirstCellFilterInvoke{}; + NCollection_CellFilter myFilter; + + // Continuity of local borders. + Standard_Integer myCont; + + Standard_Real myF; // Current value of Global optimum. +}; + +#endif diff --git a/data/miniconda3/envs/catiagent/include/opencascade/math_Jacobi.lxx b/data/miniconda3/envs/catiagent/include/opencascade/math_Jacobi.lxx new file mode 100644 index 0000000000000000000000000000000000000000..a12fd5b39c35a103f341587c25dc7bdc53070f2e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/math_Jacobi.lxx @@ -0,0 +1,54 @@ +// Copyright (c) 1997-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +// math_Jacobi.lxx + +#include +#include +#include + +inline Standard_Boolean math_Jacobi::IsDone() const +{ + return Done; +} + +inline Standard_OStream& operator<<(Standard_OStream& o, const math_Jacobi& J) +{ + J.Dump(o); + return o; +} + +inline const math_Vector& math_Jacobi::Values() const +{ + StdFail_NotDone_Raise_if(!Done, " "); + return EigenValues; +} + +inline Standard_Real math_Jacobi::Value(const Standard_Integer Num) const +{ + StdFail_NotDone_Raise_if(!Done, " "); + return EigenValues(Num); +} + +inline const math_Matrix& math_Jacobi::Vectors() const +{ + StdFail_NotDone_Raise_if(!Done, " "); + return EigenVectors; +} + +inline void math_Jacobi::Vector(const Standard_Integer Num, math_Vector& V) const +{ + StdFail_NotDone_Raise_if(!Done, " "); + V = EigenVectors.Col(Num); +} diff --git a/data/miniconda3/envs/catiagent/include/opencascade/math_Matrix.hxx b/data/miniconda3/envs/catiagent/include/opencascade/math_Matrix.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e05b4e917e6e361b57907a2d15153dfc147bf17e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/math_Matrix.hxx @@ -0,0 +1,424 @@ +// Created on: 1991-05-07 +// Created by: Laurent PAINNOT +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _math_Matrix_HeaderFile +#define _math_Matrix_HeaderFile + +#include +#include +#include + +#include +#include + +// resolve name collisions with X11 headers +#ifdef Opposite + #undef Opposite +#endif + +template +class math_VectorBase; + +//! This class implements the real matrix abstract data type. +//! Matrixes can have an arbitrary range which must be defined +//! at the declaration and cannot be changed after this declaration +//! math_Matrix(-3,5,2,4); //a vector with range [-3..5, 2..4] +//! Matrix values may be initialized and +//! retrieved using indexes which must lie within the range +//! of definition of the matrix. +//! Matrix objects follow "value semantics", that is, they +//! cannot be shared and are copied through assignment +//! Matrices are copied through assignment: +//! @code +//! math_Matrix M2(1, 9, 1, 3); +//! ... +//! M2 = M1; +//! M1(1) = 2.0;//the matrix M2 will not be modified. +//! @endcode +//! The exception RangeError is raised when trying to access +//! outside the range of a matrix : +//! @code +//! M1(11, 1)=0.0// --> will raise RangeError. +//! @endcode +//! +//! The exception DimensionError is raised when the dimensions of +//! two matrices or vectors are not compatible. +//! @code +//! math_Matrix M3(1, 2, 1, 2); +//! M3 = M1; // will raise DimensionError +//! M1.Add(M3) // --> will raise DimensionError. +//! @endcode +//! A Matrix can be constructed with a pointer to "c array". +//! It allows to carry the bounds inside the matrix. +//! Example : +//! @code +//! Standard_Real tab1[10][20]; +//! Standard_Real tab2[200]; +//! +//! math_Matrix A (tab1[0][0], 1, 10, 1, 20); +//! math_Matrix B (tab2[0], 1, 10, 1, 20); +//! @endcode +class math_Matrix +{ +public: + DEFINE_STANDARD_ALLOC + + friend class math_VectorBase<>; + + //! Constructs a non-initialized matrix of range [LowerRow..UpperRow, + //! LowerCol..UpperCol] + //! For the constructed matrix: + //! - LowerRow and UpperRow are the indexes of the + //! lower and upper bounds of a row, and + //! - LowerCol and UpperCol are the indexes of the + //! lower and upper bounds of a column. + Standard_EXPORT math_Matrix(const Standard_Integer LowerRow, + const Standard_Integer UpperRow, + const Standard_Integer LowerCol, + const Standard_Integer UpperCol); + + //! constructs a non-initialized matrix of range [LowerRow..UpperRow, + //! LowerCol..UpperCol] + //! whose values are all initialized with the value InitialValue. + Standard_EXPORT math_Matrix(const Standard_Integer LowerRow, + const Standard_Integer UpperRow, + const Standard_Integer LowerCol, + const Standard_Integer UpperCol, + const Standard_Real InitialValue); + + //! constructs a matrix of range [LowerRow..UpperRow, + //! LowerCol..UpperCol] + //! Sharing data with a "C array" pointed by Tab. + Standard_EXPORT math_Matrix(const Standard_Address Tab, + const Standard_Integer LowerRow, + const Standard_Integer UpperRow, + const Standard_Integer LowerCol, + const Standard_Integer UpperCol); + + //! constructs a matrix for copy in initialization. + //! An exception is raised if the matrixes have not the same dimensions. + Standard_EXPORT math_Matrix(const math_Matrix& Other); + + //! Initialize all the elements of a matrix to InitialValue. + Standard_EXPORT void Init(const Standard_Real InitialValue); + + //! Returns the number of rows of this matrix. + //! Note that for a matrix A you always have the following relations: + //! - A.RowNumber() = A.UpperRow() - A.LowerRow() + 1 + //! - A.ColNumber() = A.UpperCol() - A.LowerCol() + 1 + //! - the length of a row of A is equal to the number of columns of A, + //! - the length of a column of A is equal to the number of + //! rows of A.returns the row range of a matrix. + Standard_Integer RowNumber() const; + + //! Returns the number of rows of this matrix. + //! Note that for a matrix A you always have the following relations: + //! - A.RowNumber() = A.UpperRow() - A.LowerRow() + 1 + //! - A.ColNumber() = A.UpperCol() - A.LowerCol() + 1 + //! - the length of a row of A is equal to the number of columns of A, + //! - the length of a column of A is equal to the number of + //! rows of A.returns the row range of a matrix. + Standard_Integer ColNumber() const; + + //! Returns the value of the Lower index of the row + //! range of a matrix. + Standard_Integer LowerRow() const; + + //! Returns the Upper index of the row range + //! of a matrix. + Standard_Integer UpperRow() const; + + //! Returns the value of the Lower index of the + //! column range of a matrix. + Standard_Integer LowerCol() const; + + //! Returns the value of the upper index of the + //! column range of a matrix. + Standard_Integer UpperCol() const; + + //! Computes the determinant of a matrix. + //! An exception is raised if the matrix is not a square matrix. + Standard_EXPORT Standard_Real Determinant() const; + + //! Transposes a given matrix. + //! An exception is raised if the matrix is not a square matrix. + Standard_EXPORT void Transpose(); + + //! Inverts a matrix using Gauss algorithm. + //! Exception NotSquare is raised if the matrix is not square. + //! Exception SingularMatrix is raised if the matrix is singular. + Standard_EXPORT void Invert(); + + //! Sets this matrix to the product of the matrix Left, and the matrix Right. + //! Example + //! math_Matrix A (1, 3, 1, 3); + //! math_Matrix B (1, 3, 1, 3); + //! // A = ... , B = ... + //! math_Matrix C (1, 3, 1, 3); + //! C.Multiply(A, B); + //! Exceptions + //! Standard_DimensionError if matrices are of incompatible dimensions, i.e. if: + //! - the number of columns of matrix Left, or the number of + //! rows of matrix TLeft is not equal to the number of rows + //! of matrix Right, or + //! - the number of rows of matrix Left, or the number of + //! columns of matrix TLeft is not equal to the number of + //! rows of this matrix, or + //! - the number of columns of matrix Right is not equal to + //! the number of columns of this matrix. + Standard_EXPORT void Multiply(const Standard_Real Right); + + void operator*=(const Standard_Real Right) { Multiply(Right); } + + //! multiplies all the elements of a matrix by the + //! value . + Standard_NODISCARD Standard_EXPORT math_Matrix Multiplied(const Standard_Real Right) const; + + Standard_NODISCARD math_Matrix operator*(const Standard_Real Right) const + { + return Multiplied(Right); + } + + //! Sets this matrix to the product of the + //! transposed matrix TLeft, and the matrix Right. + //! Example + //! math_Matrix A (1, 3, 1, 3); + //! math_Matrix B (1, 3, 1, 3); + //! // A = ... , B = ... + //! math_Matrix C (1, 3, 1, 3); + //! C.Multiply(A, B); + //! Exceptions + //! Standard_DimensionError if matrices are of incompatible dimensions, i.e. if: + //! - the number of columns of matrix Left, or the number of + //! rows of matrix TLeft is not equal to the number of rows + //! of matrix Right, or + //! - the number of rows of matrix Left, or the number of + //! columns of matrix TLeft is not equal to the number of + //! rows of this matrix, or + //! - the number of columns of matrix Right is not equal to + //! the number of columns of this matrix. + Standard_NODISCARD Standard_EXPORT math_Matrix TMultiplied(const Standard_Real Right) const; + friend math_Matrix operator*(const Standard_Real Left, const math_Matrix& Right); + + //! divides all the elements of a matrix by the value . + //! An exception is raised if = 0. + Standard_EXPORT void Divide(const Standard_Real Right); + + void operator/=(const Standard_Real Right) { Divide(Right); } + + //! divides all the elements of a matrix by the value . + //! An exception is raised if = 0. + Standard_NODISCARD Standard_EXPORT math_Matrix Divided(const Standard_Real Right) const; + + Standard_NODISCARD math_Matrix operator/(const Standard_Real Right) const + { + return Divided(Right); + } + + //! adds the matrix to a matrix. + //! An exception is raised if the dimensions are different. + //! Warning + //! In order to save time when copying matrices, it is + //! preferable to use operator += or the function Add + //! whenever possible. + Standard_EXPORT void Add(const math_Matrix& Right); + + void operator+=(const math_Matrix& Right) { Add(Right); } + + //! adds the matrix to a matrix. + //! An exception is raised if the dimensions are different. + Standard_NODISCARD Standard_EXPORT math_Matrix Added(const math_Matrix& Right) const; + + Standard_NODISCARD math_Matrix operator+(const math_Matrix& Right) const { return Added(Right); } + + //! sets a matrix to the addition of and . + //! An exception is raised if the dimensions are different. + Standard_EXPORT void Add(const math_Matrix& Left, const math_Matrix& Right); + + //! Subtracts the matrix from . + //! An exception is raised if the dimensions are different. + //! Warning + //! In order to avoid time-consuming copying of matrices, it + //! is preferable to use operator -= or the function + //! Subtract whenever possible. + Standard_EXPORT void Subtract(const math_Matrix& Right); + + void operator-=(const math_Matrix& Right) { Subtract(Right); } + + //! Returns the result of the subtraction of from . + //! An exception is raised if the dimensions are different. + Standard_NODISCARD Standard_EXPORT math_Matrix Subtracted(const math_Matrix& Right) const; + + Standard_NODISCARD math_Matrix operator-(const math_Matrix& Right) const + { + return Subtracted(Right); + } + + //! Sets the values of this matrix, + //! - from index I1 to index I2 on the row dimension, and + //! - from index J1 to index J2 on the column dimension, + //! to those of matrix M. + //! Exceptions + //! Standard_DimensionError if: + //! - I1 is less than the index of the lower row bound of this matrix, or + //! - I2 is greater than the index of the upper row bound of this matrix, or + //! - J1 is less than the index of the lower column bound of this matrix, or + //! - J2 is greater than the index of the upper column bound of this matrix, or + //! - I2 - I1 + 1 is not equal to the number of rows of matrix M, or + //! - J2 - J1 + 1 is not equal to the number of columns of matrix M. + Standard_EXPORT void Set(const Standard_Integer I1, + const Standard_Integer I2, + const Standard_Integer J1, + const Standard_Integer J2, + const math_Matrix& M); + + //! Sets the row of index Row of a matrix to the vector . + //! An exception is raised if the dimensions are different. + //! An exception is raises if is inferior to the lower + //! row of the matrix or is superior to the upper row. + Standard_EXPORT void SetRow(const Standard_Integer Row, const math_VectorBase<>& V); + + //! Sets the column of index Col of a matrix to the vector . + //! An exception is raised if the dimensions are different. + //! An exception is raises if is inferior to the lower + //! column of the matrix or is superior to the upper + //! column. + Standard_EXPORT void SetCol(const Standard_Integer Col, const math_VectorBase<>& V); + + //! Sets the diagonal of a matrix to the value . + //! An exception is raised if the matrix is not square. + Standard_EXPORT void SetDiag(const Standard_Real Value); + + //! Returns the row of index Row of a matrix. + Standard_EXPORT math_VectorBase<> Row(const Standard_Integer Row) const; + + //! Returns the column of index of a matrix. + Standard_EXPORT math_VectorBase<> Col(const Standard_Integer Col) const; + + //! Swaps the rows of index Row1 and Row2. + //! An exception is raised if or is out of range. + Standard_EXPORT void SwapRow(const Standard_Integer Row1, const Standard_Integer Row2); + + //! Swaps the columns of index and . + //! An exception is raised if or is out of range. + Standard_EXPORT void SwapCol(const Standard_Integer Col1, const Standard_Integer Col2); + + //! Teturns the transposed of a matrix. + //! An exception is raised if the matrix is not a square matrix. + Standard_NODISCARD Standard_EXPORT math_Matrix Transposed() const; + + //! Returns the inverse of a matrix. + //! Exception NotSquare is raised if the matrix is not square. + //! Exception SingularMatrix is raised if the matrix is singular. + Standard_EXPORT math_Matrix Inverse() const; + + //! Returns the product of the transpose of a matrix with + //! the matrix . + //! An exception is raised if the dimensions are different. + Standard_EXPORT math_Matrix TMultiply(const math_Matrix& Right) const; + + //! Computes a matrix as the product of 2 vectors. + //! An exception is raised if the dimensions are different. + //! = * . + Standard_EXPORT void Multiply(const math_VectorBase<>& Left, const math_VectorBase<>& Right); + + //! Computes a matrix as the product of 2 matrixes. + //! An exception is raised if the dimensions are different. + Standard_EXPORT void Multiply(const math_Matrix& Left, const math_Matrix& Right); + + //! Computes a matrix to the product of the transpose of + //! the matrix with the matrix . + //! An exception is raised if the dimensions are different. + Standard_EXPORT void TMultiply(const math_Matrix& TLeft, const math_Matrix& Right); + + //! Sets a matrix to the Subtraction of the matrix + //! from the matrix . + //! An exception is raised if the dimensions are different. + Standard_EXPORT void Subtract(const math_Matrix& Left, const math_Matrix& Right); + + //! Accesses (in read or write mode) the value of index + //! and of a matrix. + //! An exception is raised if and are not + //! in the correct range. + Standard_Real& Value(const Standard_Integer Row, const Standard_Integer Col) const; + + Standard_Real& operator()(const Standard_Integer Row, const Standard_Integer Col) const + { + return Value(Row, Col); + } + + //! Matrixes are copied through assignment. + //! An exception is raised if the dimensions are different. + Standard_EXPORT math_Matrix& Initialized(const math_Matrix& Other); + + math_Matrix& operator=(const math_Matrix& Other) { return Initialized(Other); } + + //! Returns the product of 2 matrices. + //! An exception is raised if the dimensions are different. + Standard_EXPORT void Multiply(const math_Matrix& Right); + + void operator*=(const math_Matrix& Right) { Multiply(Right); } + + //! Returns the product of 2 matrices. + //! An exception is raised if the dimensions are different. + Standard_NODISCARD Standard_EXPORT math_Matrix Multiplied(const math_Matrix& Right) const; + + Standard_NODISCARD math_Matrix operator*(const math_Matrix& Right) const + { + return Multiplied(Right); + } + + //! Returns the product of a matrix by a vector. + //! An exception is raised if the dimensions are different. + Standard_NODISCARD Standard_EXPORT math_VectorBase<> Multiplied( + const math_VectorBase<>& Right) const; + Standard_NODISCARD Standard_EXPORT math_VectorBase<> operator*( + const math_VectorBase<>& Right) const; + + //! Returns the opposite of a matrix. + //! An exception is raised if the dimensions are different. + Standard_EXPORT math_Matrix Opposite(); + + math_Matrix operator-() { return Opposite(); } + + //! Prints information on the current state of the object. + //! Is used to redefine the operator <<. + Standard_EXPORT void Dump(Standard_OStream& o) const; + +protected: + //! The new lower row of the matrix is set to + Standard_EXPORT void SetLowerRow(const Standard_Integer LowerRow); + + //! The new lower column of the matrix is set to the column + //! of range . + Standard_EXPORT void SetLowerCol(const Standard_Integer LowerCol); + + //! The new lower row of the matrix is set to + //! and the new lower column of the matrix is set to the column + //! of range . + void SetLower(const Standard_Integer LowerRow, const Standard_Integer LowerCol); + +private: + Standard_Integer LowerRowIndex; + Standard_Integer UpperRowIndex; + Standard_Integer LowerColIndex; + Standard_Integer UpperColIndex; + math_DoubleTab Array; +}; + +#include + +#endif // _math_Matrix_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/math_NewtonFunctionSetRoot.hxx b/data/miniconda3/envs/catiagent/include/opencascade/math_NewtonFunctionSetRoot.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f3eded0adc947b94914123475058d4a912f5c226 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/math_NewtonFunctionSetRoot.hxx @@ -0,0 +1,153 @@ +// Created on: 1991-05-14 +// Created by: Laurent PAINNOT +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _math_NewtonFunctionSetRoot_HeaderFile +#define _math_NewtonFunctionSetRoot_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +class math_FunctionSetWithDerivatives; + +//! This class computes the root of a set of N functions of N variables, +//! knowing an initial guess at the solution and using the +//! Newton Raphson algorithm. Knowledge of all the partial +//! derivatives (Jacobian) is required. +class math_NewtonFunctionSetRoot +{ +public: + DEFINE_STANDARD_ALLOC + + //! Initialize correctly all the fields of this class. + //! The range (1, F.NbVariables()) must be especially respected for + //! all vectors and matrix declarations. + Standard_EXPORT math_NewtonFunctionSetRoot(math_FunctionSetWithDerivatives& theFunction, + const math_Vector& theXTolerance, + const Standard_Real theFTolerance, + const Standard_Integer tehNbIterations = 100); + + //! This constructor should be used in a sub-class to initialize + //! correctly all the fields of this class. + //! The range (1, F.NbVariables()) must be especially respected for + //! all vectors and matrix declarations. + //! The method SetTolerance must be called before performing the algorithm. + Standard_EXPORT math_NewtonFunctionSetRoot(math_FunctionSetWithDerivatives& theFunction, + const Standard_Real theFTolerance, + const Standard_Integer theNbIterations = 100); + + //! Destructor + Standard_EXPORT virtual ~math_NewtonFunctionSetRoot(); + + //! Initializes the tolerance values for the unknowns. + Standard_EXPORT void SetTolerance(const math_Vector& XTol); + + //! The Newton method is done to improve the root of the function + //! from the initial guess point. The solution is found when: + //! abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i; + Standard_EXPORT void Perform(math_FunctionSetWithDerivatives& theFunction, + const math_Vector& theStartingPoint); + + //! The Newton method is done to improve the root of the function + //! from the initial guess point. Bounds may be given, to constrain the solution. + //! The solution is found when: + //! abs(Xj - Xj-1)(i) <= XTol(i) and abs(Fi) <= FTol for all i; + Standard_EXPORT void Perform(math_FunctionSetWithDerivatives& theFunction, + const math_Vector& theStartingPoint, + const math_Vector& theInfBound, + const math_Vector& theSupBound); + + //! This method is called at the end of each iteration to check if the + //! solution is found. + //! Vectors DeltaX, Fvalues and Jacobian Matrix are consistent with the + //! possible solution Vector Sol and can be inspected to decide whether + //! the solution is reached or not. + virtual Standard_Boolean IsSolutionReached(math_FunctionSetWithDerivatives& F); + + //! Returns true if the computations are successful, otherwise returns false. + Standard_Boolean IsDone() const; + + //! Returns the value of the root of function F. + //! Exceptions + //! StdFail_NotDone if the algorithm fails (and IsDone returns false). + const math_Vector& Root() const; + + //! outputs the root vector in Root. + //! Exception NotDone is raised if the root was not found. + //! Exception DimensionError is raised if the range of Root is + //! not equal to the range of the StartingPoint. + void Root(math_Vector& Root) const; + + //! Outputs the state number associated with the solution + //! vector root. + Standard_Integer StateNumber() const; + + //! Returns the matrix value of the derivative at the root. + //! Exception NotDone is raised if the root was not found. + const math_Matrix& Derivative() const; + + //! Outputs the matrix value of the derivative at the root in + //! Der. + //! Exception NotDone is raised if the root was not found. + //! Exception DimensionError is raised if the range of Der is + //! not equal to the range of the StartingPoint. + void Derivative(math_Matrix& Der) const; + + //! Returns the vector value of the error done on the + //! functions at the root. + //! Exception NotDone is raised if the root was not found. + const math_Vector& FunctionSetErrors() const; + + //! Outputs the vector value of the error done on the + //! functions at the root in Err. + //! Exception NotDone is raised if the root was not found. + //! Exception DimensionError is raised if the range of Err is + //! not equal to the range of the StartingPoint. + void FunctionSetErrors(math_Vector& Err) const; + + //! Returns the number of iterations really done + //! during the computation of the Root. + //! Exception NotDone is raised if the root was not found. + Standard_Integer NbIterations() const; + + //! Prints information on the current state of the object. + //! Is used to redefine the operator <<. + Standard_EXPORT void Dump(Standard_OStream& o) const; + +protected: + math_Vector TolX; + Standard_Real TolF; + math_IntegerVector Indx; + math_Vector Scratch; + math_Vector Sol; + math_Vector DeltaX; + math_Vector FValues; + math_Matrix Jacobian; + +private: + Standard_Boolean Done; + Standard_Integer State; + Standard_Integer Iter; + Standard_Integer Itermax; +}; + +#include + +#endif // _math_NewtonFunctionSetRoot_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/opencascade/math_NotSquare.hxx b/data/miniconda3/envs/catiagent/include/opencascade/math_NotSquare.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2c6688f080906dc767c2125608b8ae008498e620 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/opencascade/math_NotSquare.hxx @@ -0,0 +1,38 @@ +// Created on: 1991-01-21 +// Created by: Isabelle GRIGNON +// Copyright (c) 1991-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _math_NotSquare_HeaderFile +#define _math_NotSquare_HeaderFile + +#include +#include +#include +#include + +class math_NotSquare; +DEFINE_STANDARD_HANDLE(math_NotSquare, Standard_DimensionError) + +#if !defined No_Exception && !defined No_math_NotSquare + #define math_NotSquare_Raise_if(CONDITION, MESSAGE) \ + if (CONDITION) \ + throw math_NotSquare(MESSAGE); +#else + #define math_NotSquare_Raise_if(CONDITION, MESSAGE) +#endif + +DEFINE_STANDARD_EXCEPTION(math_NotSquare, Standard_DimensionError) + +#endif // _math_NotSquare_HeaderFile diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/abstract.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/abstract.h new file mode 100644 index 0000000000000000000000000000000000000000..d276669312ee2f864035bfbc091a402c21e067f4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/abstract.h @@ -0,0 +1,219 @@ +#ifndef Py_CPYTHON_ABSTRACTOBJECT_H +# error "this header file must not be included directly" +#endif + +/* === Object Protocol ================================================== */ + +#ifdef PY_SSIZE_T_CLEAN +# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT +#endif + +/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple) + format to a Python dictionary ("kwargs" dict). + + The type of kwnames keys is not checked. The final function getting + arguments is responsible to check if all keys are strings, for example using + PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments(). + + Duplicate keys are merged using the last value. If duplicate keys must raise + an exception, the caller is responsible to implement an explicit keys on + kwnames. */ +PyAPI_FUNC(PyObject *) _PyStack_AsDict( + PyObject *const *values, + PyObject *kwnames); + +/* Suggested size (number of positional arguments) for arrays of PyObject* + allocated on a C stack to avoid allocating memory on the heap memory. Such + array is used to pass positional arguments to call functions of the + PyObject_Vectorcall() family. + + The size is chosen to not abuse the C stack and so limit the risk of stack + overflow. The size is also chosen to allow using the small stack for most + function calls of the Python standard library. On 64-bit CPU, it allocates + 40 bytes on the stack. */ +#define _PY_FASTCALL_SMALL_STACK 5 + +PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult( + PyThreadState *tstate, + PyObject *callable, + PyObject *result, + const char *where); + +/* === Vectorcall protocol (PEP 590) ============================= */ + +/* Call callable using tp_call. Arguments are like PyObject_Vectorcall() + or PyObject_FastCallDict() (both forms are supported), + except that nargs is plainly the number of arguments without flags. */ +PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall( + PyThreadState *tstate, + PyObject *callable, + PyObject *const *args, Py_ssize_t nargs, + PyObject *keywords); + +#define PY_VECTORCALL_ARGUMENTS_OFFSET \ + (_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1)) + +static inline Py_ssize_t +PyVectorcall_NARGS(size_t n) +{ + return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET; +} + +PyAPI_FUNC(vectorcallfunc) PyVectorcall_Function(PyObject *callable); + +PyAPI_FUNC(PyObject *) PyObject_Vectorcall( + PyObject *callable, + PyObject *const *args, + size_t nargsf, + PyObject *kwnames); + +// Backwards compatibility aliases for API that was provisional in Python 3.8 +#define _PyObject_Vectorcall PyObject_Vectorcall +#define _PyObject_VectorcallMethod PyObject_VectorcallMethod +#define _PyObject_FastCallDict PyObject_VectorcallDict +#define _PyVectorcall_Function PyVectorcall_Function +#define _PyObject_CallOneArg PyObject_CallOneArg +#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs +#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg + +/* Same as PyObject_Vectorcall except that keyword arguments are passed as + dict, which may be NULL if there are no keyword arguments. */ +PyAPI_FUNC(PyObject *) PyObject_VectorcallDict( + PyObject *callable, + PyObject *const *args, + size_t nargsf, + PyObject *kwargs); + +/* Call "callable" (which must support vectorcall) with positional arguments + "tuple" and keyword arguments "dict". "dict" may also be NULL */ +PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict); + +// Same as PyObject_Vectorcall(), except without keyword arguments +PyAPI_FUNC(PyObject *) _PyObject_FastCall( + PyObject *func, + PyObject *const *args, + Py_ssize_t nargs); + +PyAPI_FUNC(PyObject *) PyObject_CallOneArg(PyObject *func, PyObject *arg); + +PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod( + PyObject *name, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + +static inline PyObject * +PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) +{ + size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; + return PyObject_VectorcallMethod(name, &self, nargsf, _Py_NULL); +} + +static inline PyObject * +PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg) +{ + PyObject *args[2] = {self, arg}; + size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; + assert(arg != NULL); + return PyObject_VectorcallMethod(name, args, nargsf, _Py_NULL); +} + +PyAPI_FUNC(PyObject *) _PyObject_CallMethod(PyObject *obj, + PyObject *name, + const char *format, ...); + +/* Like PyObject_CallMethod(), but expect a _Py_Identifier* + as the method name. */ +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, + _Py_Identifier *name, + const char *format, ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, + _Py_Identifier *name, + const char *format, + ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( + PyObject *obj, + _Py_Identifier *name, + ...); + +static inline PyObject * +_PyObject_VectorcallMethodId( + _Py_Identifier *name, PyObject *const *args, + size_t nargsf, PyObject *kwnames) +{ + PyObject *oname = _PyUnicode_FromId(name); /* borrowed */ + if (!oname) { + return _Py_NULL; + } + return PyObject_VectorcallMethod(oname, args, nargsf, kwnames); +} + +static inline PyObject * +_PyObject_CallMethodIdNoArgs(PyObject *self, _Py_Identifier *name) +{ + size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; + return _PyObject_VectorcallMethodId(name, &self, nargsf, _Py_NULL); +} + +static inline PyObject * +_PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg) +{ + PyObject *args[2] = {self, arg}; + size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; + assert(arg != NULL); + return _PyObject_VectorcallMethodId(name, args, nargsf, _Py_NULL); +} + +PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); + +/* Guess the size of object 'o' using len(o) or o.__length_hint__(). + If neither of those return a non-negative value, then return the default + value. If one of the calls fails, this function returns -1. */ +PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); + +/* === Sequence protocol ================================================ */ + +/* Assume tp_as_sequence and sq_item exist and that 'i' does not + need to be corrected for a negative index. */ +#define PySequence_ITEM(o, i)\ + ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) + +#define PY_ITERSEARCH_COUNT 1 +#define PY_ITERSEARCH_INDEX 2 +#define PY_ITERSEARCH_CONTAINS 3 + +/* Iterate over seq. + + Result depends on the operation: + + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. */ +PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, + PyObject *obj, int operation); + +/* === Mapping protocol ================================================= */ + +PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); + +PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); + +PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self); + +PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]); + +/* For internal use by buffer API functions */ +PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); +PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); + +/* Convert Python int to Py_ssize_t. Do nothing if the argument is None. */ +PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *); + +/* Same as PyNumber_Index but can return an instance of a subclass of int. */ +PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytearrayobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytearrayobject.h new file mode 100644 index 0000000000000000000000000000000000000000..5114169c280915329b9801f6461f4047091a58bb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytearrayobject.h @@ -0,0 +1,38 @@ +#ifndef Py_CPYTHON_BYTEARRAYOBJECT_H +# error "this header file must not be included directly" +#endif + +/* Object layout */ +typedef struct { + PyObject_VAR_HEAD + Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */ + char *ob_bytes; /* Physical backing buffer */ + char *ob_start; /* Logical start inside ob_bytes */ + Py_ssize_t ob_exports; /* How many buffer exports */ +} PyByteArrayObject; + +PyAPI_DATA(char) _PyByteArray_empty_string[]; + +/* Macros and static inline functions, trading safety for speed */ +#define _PyByteArray_CAST(op) \ + (assert(PyByteArray_Check(op)), _Py_CAST(PyByteArrayObject*, op)) + +static inline char* PyByteArray_AS_STRING(PyObject *op) +{ + PyByteArrayObject *self = _PyByteArray_CAST(op); + if (Py_SIZE(self)) { + return self->ob_start; + } + return _PyByteArray_empty_string; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyByteArray_AS_STRING(self) PyByteArray_AS_STRING(_PyObject_CAST(self)) +#endif + +static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) { + PyByteArrayObject *self = _PyByteArray_CAST(op); + return Py_SIZE(self); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self)) +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytesobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytesobject.h new file mode 100644 index 0000000000000000000000000000000000000000..0899bf62615ef6ced7b62dd4a137a6042b0bbe37 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/bytesobject.h @@ -0,0 +1,137 @@ +#ifndef Py_CPYTHON_BYTESOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct { + PyObject_VAR_HEAD + Py_DEPRECATED(3.11) Py_hash_t ob_shash; + char ob_sval[1]; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the byte string or -1 if not computed yet. + */ +} PyBytesObject; + +PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( + const char *format, + Py_ssize_t format_len, + PyObject *args, + int use_bytearray); +PyAPI_FUNC(PyObject*) _PyBytes_FromHex( + PyObject *string, + int use_bytearray); + +/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ +PyAPI_FUNC(PyObject*) _PyBytes_DecodeEscape2(const char *, Py_ssize_t, + const char *, + int *, const char **); +// Export for binary compatibility. +PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, + const char *, const char **); + +/* Macros and static inline functions, trading safety for speed */ +#define _PyBytes_CAST(op) \ + (assert(PyBytes_Check(op)), _Py_CAST(PyBytesObject*, op)) + +static inline char* PyBytes_AS_STRING(PyObject *op) +{ + return _PyBytes_CAST(op)->ob_sval; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyBytes_AS_STRING(op) PyBytes_AS_STRING(_PyObject_CAST(op)) +#endif + +static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) { + PyBytesObject *self = _PyBytes_CAST(op); + return Py_SIZE(self); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyBytes_GET_SIZE(self) PyBytes_GET_SIZE(_PyObject_CAST(self)) +#endif + +/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, + x must be an iterable object. */ +PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); + + +/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer". + A _PyBytesWriter variable must be declared at the end of variables in a + function to optimize the memory allocation on the stack. */ +typedef struct { + /* bytes, bytearray or NULL (when the small buffer is used) */ + PyObject *buffer; + + /* Number of allocated size. */ + Py_ssize_t allocated; + + /* Minimum number of allocated bytes, + incremented by _PyBytesWriter_Prepare() */ + Py_ssize_t min_size; + + /* If non-zero, use a bytearray instead of a bytes object for buffer. */ + int use_bytearray; + + /* If non-zero, overallocate the buffer (default: 0). + This flag must be zero if use_bytearray is non-zero. */ + int overallocate; + + /* Stack buffer */ + int use_small_buffer; + char small_buffer[512]; +} _PyBytesWriter; + +/* Initialize a bytes writer + + By default, the overallocation is disabled. Set the overallocate attribute + to control the allocation of the buffer. */ +PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer); + +/* Get the buffer content and reset the writer. + Return a bytes object, or a bytearray object if use_bytearray is non-zero. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer, + void *str); + +/* Deallocate memory of a writer (clear its internal buffer). */ +PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer); + +/* Allocate the buffer to write size bytes. + Return the pointer to the beginning of buffer data. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer, + Py_ssize_t size); + +/* Ensure that the buffer is large enough to write *size* bytes. + Add size to the writer minimum size (min_size attribute). + + str is the current pointer inside the buffer. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer, + void *str, + Py_ssize_t size); + +/* Resize the buffer to make it larger. + The new buffer may be larger than size bytes because of overallocation. + Return the updated current pointer inside the buffer. + Raise an exception and return NULL on error. + + Note: size must be greater than the number of allocated bytes in the writer. + + This function doesn't use the writer minimum size (min_size attribute). + + See also _PyBytesWriter_Prepare(). + */ +PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer, + void *str, + Py_ssize_t size); + +/* Write bytes. + Raise an exception and return NULL on error. */ +PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, + void *str, + const void *bytes, + Py_ssize_t size); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/cellobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/cellobject.h new file mode 100644 index 0000000000000000000000000000000000000000..e07f9d1de79423cf8f9a67580d434a486a8b7f96 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/cellobject.h @@ -0,0 +1,31 @@ +/* Cell object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_CELLOBJECT_H +#define Py_CELLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + /* Content of the cell or NULL when empty */ + PyObject *ob_ref; +} PyCellObject; + +PyAPI_DATA(PyTypeObject) PyCell_Type; + +#define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type) + +PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); +PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); +PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); + +#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) +#define PyCell_SET(op, v) _Py_RVALUE(((PyCellObject *)(op))->ob_ref = (v)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/ceval.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/ceval.h new file mode 100644 index 0000000000000000000000000000000000000000..9d4eeafb427eb28b376bc7116b4d56dfff16b9d9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/ceval.h @@ -0,0 +1,26 @@ +#ifndef Py_CPYTHON_CEVAL_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); +PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); +PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); +PyAPI_FUNC(int) _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); + +/* Helper to look up a builtin object */ +PyAPI_FUNC(PyObject *) _PyEval_GetBuiltin(PyObject *); +PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); +/* Look at the current frame's (if any) code's co_flags, and turn on + the corresponding compiler flags in cf->cf_flags. Return 1 if any + flag was set, else return 0. */ +PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); + +PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc); + +PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); +PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); + +PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); + +PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/classobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/classobject.h new file mode 100644 index 0000000000000000000000000000000000000000..80df8842eb4f784144983a6a213b80389a801456 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/classobject.h @@ -0,0 +1,57 @@ +/* Former class object interface -- now only bound methods are here */ + +/* Revealing some structures (not for general use) */ + +#ifndef Py_LIMITED_API +#ifndef Py_CLASSOBJECT_H +#define Py_CLASSOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + PyObject *im_func; /* The callable object implementing the method */ + PyObject *im_self; /* The instance it is bound to */ + PyObject *im_weakreflist; /* List of weak references */ + vectorcallfunc vectorcall; +} PyMethodObject; + +PyAPI_DATA(PyTypeObject) PyMethod_Type; + +#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type) + +PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyMethod_GET_FUNCTION(meth) \ + (((PyMethodObject *)meth) -> im_func) +#define PyMethod_GET_SELF(meth) \ + (((PyMethodObject *)meth) -> im_self) + +typedef struct { + PyObject_HEAD + PyObject *func; +} PyInstanceMethodObject; + +PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; + +#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type) + +PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); +PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyInstanceMethod_GET_FUNCTION(meth) \ + (((PyInstanceMethodObject *)meth) -> func) + +#ifdef __cplusplus +} +#endif +#endif // !Py_CLASSOBJECT_H +#endif // !Py_LIMITED_API diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/code.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/code.h new file mode 100644 index 0000000000000000000000000000000000000000..7006060cc760e5ca1468965cb1fc1252d5be9ae0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/code.h @@ -0,0 +1,236 @@ +/* Definitions for bytecode */ + +#ifndef Py_LIMITED_API +#ifndef Py_CODE_H +#define Py_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Each instruction in a code object is a fixed-width value, + * currently 2 bytes: 1-byte opcode + 1-byte oparg. The EXTENDED_ARG + * opcode allows for larger values but the current limit is 3 uses + * of EXTENDED_ARG (see Python/compile.c), for a maximum + * 32-bit value. This aligns with the note in Python/compile.c + * (compiler_addop_i_line) indicating that the max oparg value is + * 2**32 - 1, rather than INT_MAX. + */ + +typedef uint16_t _Py_CODEUNIT; + +#ifdef WORDS_BIGENDIAN +# define _Py_OPCODE(word) ((word) >> 8) +# define _Py_OPARG(word) ((word) & 255) +# define _Py_MAKECODEUNIT(opcode, oparg) (((opcode)<<8)|(oparg)) +#else +# define _Py_OPCODE(word) ((word) & 255) +# define _Py_OPARG(word) ((word) >> 8) +# define _Py_MAKECODEUNIT(opcode, oparg) ((opcode)|((oparg)<<8)) +#endif + +// Use "unsigned char" instead of "uint8_t" here to avoid illegal aliasing: +#define _Py_SET_OPCODE(word, opcode) (((unsigned char *)&(word))[0] = (opcode)) + +// To avoid repeating ourselves in deepfreeze.py, all PyCodeObject members are +// defined in this macro: +#define _PyCode_DEF(SIZE) { \ + PyObject_VAR_HEAD \ + \ + /* Note only the following fields are used in hash and/or comparisons \ + * \ + * - co_name \ + * - co_argcount \ + * - co_posonlyargcount \ + * - co_kwonlyargcount \ + * - co_nlocals \ + * - co_stacksize \ + * - co_flags \ + * - co_firstlineno \ + * - co_consts \ + * - co_names \ + * - co_localsplusnames \ + * This is done to preserve the name and line number for tracebacks \ + * and debuggers; otherwise, constant de-duplication would collapse \ + * identical functions/lambdas defined on different lines. \ + */ \ + \ + /* These fields are set with provided values on new code objects. */ \ + \ + /* The hottest fields (in the eval loop) are grouped here at the top. */ \ + PyObject *co_consts; /* list (constants used) */ \ + PyObject *co_names; /* list of strings (names used) */ \ + PyObject *co_exceptiontable; /* Byte string encoding exception handling \ + table */ \ + int co_flags; /* CO_..., see below */ \ + short co_warmup; /* Warmup counter for quickening */ \ + short _co_linearray_entry_size; /* Size of each entry in _co_linearray */ \ + \ + /* The rest are not so impactful on performance. */ \ + int co_argcount; /* #arguments, except *args */ \ + int co_posonlyargcount; /* #positional only arguments */ \ + int co_kwonlyargcount; /* #keyword only arguments */ \ + int co_stacksize; /* #entries needed for evaluation stack */ \ + int co_firstlineno; /* first source line number */ \ + \ + /* redundant values (derived from co_localsplusnames and \ + co_localspluskinds) */ \ + int co_nlocalsplus; /* number of local + cell + free variables \ + */ \ + int co_nlocals; /* number of local variables */ \ + int co_nplaincellvars; /* number of non-arg cell variables */ \ + int co_ncellvars; /* total number of cell variables */ \ + int co_nfreevars; /* number of free variables */ \ + \ + PyObject *co_localsplusnames; /* tuple mapping offsets to names */ \ + PyObject *co_localspluskinds; /* Bytes mapping to local kinds (one byte \ + per variable) */ \ + PyObject *co_filename; /* unicode (where it was loaded from) */ \ + PyObject *co_name; /* unicode (name, for reference) */ \ + PyObject *co_qualname; /* unicode (qualname, for reference) */ \ + PyObject *co_linetable; /* bytes object that holds location info */ \ + PyObject *co_weakreflist; /* to support weakrefs to code objects */ \ + PyObject *_co_code; /* cached co_code object/attribute */ \ + char *_co_linearray; /* array of line offsets */ \ + int _co_firsttraceable; /* index of first traceable instruction */ \ + /* Scratch space for extra data relating to the code object. \ + Type is a void* to keep the format private in codeobject.c to force \ + people to go through the proper APIs. */ \ + void *co_extra; \ + char co_code_adaptive[(SIZE)]; \ +} + +/* Bytecode object */ +struct PyCodeObject _PyCode_DEF(1); + +/* Masks for co_flags above */ +#define CO_OPTIMIZED 0x0001 +#define CO_NEWLOCALS 0x0002 +#define CO_VARARGS 0x0004 +#define CO_VARKEYWORDS 0x0008 +#define CO_NESTED 0x0010 +#define CO_GENERATOR 0x0020 + +/* The CO_COROUTINE flag is set for coroutine functions (defined with + ``async def`` keywords) */ +#define CO_COROUTINE 0x0080 +#define CO_ITERABLE_COROUTINE 0x0100 +#define CO_ASYNC_GENERATOR 0x0200 + +/* bpo-39562: These constant values are changed in Python 3.9 + to prevent collision with compiler flags. CO_FUTURE_ and PyCF_ + constants must be kept unique. PyCF_ constants can use bits from + 0x0100 to 0x10000. CO_FUTURE_ constants use bits starting at 0x20000. */ +#define CO_FUTURE_DIVISION 0x20000 +#define CO_FUTURE_ABSOLUTE_IMPORT 0x40000 /* do absolute imports by default */ +#define CO_FUTURE_WITH_STATEMENT 0x80000 +#define CO_FUTURE_PRINT_FUNCTION 0x100000 +#define CO_FUTURE_UNICODE_LITERALS 0x200000 + +#define CO_FUTURE_BARRY_AS_BDFL 0x400000 +#define CO_FUTURE_GENERATOR_STOP 0x800000 +#define CO_FUTURE_ANNOTATIONS 0x1000000 + +/* This should be defined if a future statement modifies the syntax. + For example, when a keyword is added. +*/ +#define PY_PARSER_REQUIRES_FUTURE_KEYWORD + +#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ + +PyAPI_DATA(PyTypeObject) PyCode_Type; + +#define PyCode_Check(op) Py_IS_TYPE(op, &PyCode_Type) +#define PyCode_GetNumFree(op) ((op)->co_nfreevars) +#define _PyCode_CODE(CO) ((_Py_CODEUNIT *)(CO)->co_code_adaptive) +#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT)) + +/* Public interface */ +PyAPI_FUNC(PyCodeObject *) PyCode_New( + int, int, int, int, int, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, int, PyObject *, + PyObject *); + +PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs( + int, int, int, int, int, int, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, int, PyObject *, + PyObject *); + /* same as struct above */ + +/* Creates a new empty code object with the specified source location. */ +PyAPI_FUNC(PyCodeObject *) +PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); + +/* Return the line number associated with the specified bytecode index + in this code object. If you just need the line number of a frame, + use PyFrame_GetLineNumber() instead. */ +PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); + +PyAPI_FUNC(int) PyCode_Addr2Location(PyCodeObject *, int, int *, int *, int *, int *); + +/* for internal use only */ +struct _opaque { + int computed_line; + const uint8_t *lo_next; + const uint8_t *limit; +}; + +typedef struct _line_offsets { + int ar_start; + int ar_end; + int ar_line; + struct _opaque opaque; +} PyCodeAddressRange; + +/* Update *bounds to describe the first and one-past-the-last instructions in the + same line as lasti. Return the number of that line. +*/ +PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds); + +/* Create a comparable key used to compare constants taking in account the + * object type. It is used to make sure types are not coerced (e.g., float and + * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms + * + * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items) + * depending on the type and the value. The type is the first item to not + * compare bytes and str which can raise a BytesWarning exception. */ +PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj); + +PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, + PyObject *names, PyObject *lnotab); + + +PyAPI_FUNC(int) _PyCode_GetExtra(PyObject *code, Py_ssize_t index, + void **extra); +PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index, + void *extra); + +/* Equivalent to getattr(code, 'co_code') in Python. + Returns a strong reference to a bytes object. */ +PyAPI_FUNC(PyObject *) PyCode_GetCode(PyCodeObject *code); +/* Equivalent to getattr(code, 'co_varnames') in Python. */ +PyAPI_FUNC(PyObject *) PyCode_GetVarnames(PyCodeObject *code); +/* Equivalent to getattr(code, 'co_cellvars') in Python. */ +PyAPI_FUNC(PyObject *) PyCode_GetCellvars(PyCodeObject *code); +/* Equivalent to getattr(code, 'co_freevars') in Python. */ +PyAPI_FUNC(PyObject *) PyCode_GetFreevars(PyCodeObject *code); + +typedef enum _PyCodeLocationInfoKind { + /* short forms are 0 to 9 */ + PY_CODE_LOCATION_INFO_SHORT0 = 0, + /* one lineforms are 10 to 12 */ + PY_CODE_LOCATION_INFO_ONE_LINE0 = 10, + PY_CODE_LOCATION_INFO_ONE_LINE1 = 11, + PY_CODE_LOCATION_INFO_ONE_LINE2 = 12, + + PY_CODE_LOCATION_INFO_NO_COLUMNS = 13, + PY_CODE_LOCATION_INFO_LONG = 14, + PY_CODE_LOCATION_INFO_NONE = 15 +} _PyCodeLocationInfoKind; + +#ifdef __cplusplus +} +#endif +#endif // !Py_CODE_H +#endif // !Py_LIMITED_API diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/compile.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/compile.h new file mode 100644 index 0000000000000000000000000000000000000000..518a3764992954f0a7d46274ea0a45d6e91a161e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/compile.h @@ -0,0 +1,54 @@ +#ifndef Py_CPYTHON_COMPILE_H +# error "this header file must not be included directly" +#endif + +/* Public interface */ +#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ + CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ + CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ + CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) +#define PyCF_MASK_OBSOLETE (CO_NESTED) + +/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique. + PyCF_ constants can use bits from 0x0100 to 0x10000. + CO_FUTURE_ constants use bits starting at 0x20000. */ +#define PyCF_SOURCE_IS_UTF8 0x0100 +#define PyCF_DONT_IMPLY_DEDENT 0x0200 +#define PyCF_ONLY_AST 0x0400 +#define PyCF_IGNORE_COOKIE 0x0800 +#define PyCF_TYPE_COMMENTS 0x1000 +#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000 +#define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000 +#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \ + PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \ + PyCF_ALLOW_INCOMPLETE_INPUT) + +typedef struct { + int cf_flags; /* bitmask of CO_xxx flags relevant to future */ + int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */ +} PyCompilerFlags; + +#define _PyCompilerFlags_INIT \ + (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION} + +/* Future feature support */ + +typedef struct { + int ff_features; /* flags set by future statements */ + int ff_lineno; /* line number of last future statement */ +} PyFutureFeatures; + +#define FUTURE_NESTED_SCOPES "nested_scopes" +#define FUTURE_GENERATORS "generators" +#define FUTURE_DIVISION "division" +#define FUTURE_ABSOLUTE_IMPORT "absolute_import" +#define FUTURE_WITH_STATEMENT "with_statement" +#define FUTURE_PRINT_FUNCTION "print_function" +#define FUTURE_UNICODE_LITERALS "unicode_literals" +#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" +#define FUTURE_GENERATOR_STOP "generator_stop" +#define FUTURE_ANNOTATIONS "annotations" + +#define PY_INVALID_STACK_EFFECT INT_MAX +PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); +PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/complexobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/complexobject.h new file mode 100644 index 0000000000000000000000000000000000000000..b7d7283ae8896503defd94ee9a4798b426ca0e3e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/complexobject.h @@ -0,0 +1,44 @@ +#ifndef Py_CPYTHON_COMPLEXOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct { + double real; + double imag; +} Py_complex; + +/* Operations on complex numbers from complexmodule.c */ + +PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); +PyAPI_FUNC(double) _Py_c_abs(Py_complex); + +/* Complex object interface */ + +/* +PyComplexObject represents a complex number with double-precision +real and imaginary parts. +*/ +typedef struct { + PyObject_HEAD + Py_complex cval; +} PyComplexObject; + +PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); + +PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); + +#ifdef Py_BUILD_CORE +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +extern int _PyComplex_FormatAdvancedWriter( + _PyUnicodeWriter *writer, + PyObject *obj, + PyObject *format_spec, + Py_ssize_t start, + Py_ssize_t end); +#endif // Py_BUILD_CORE diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/context.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/context.h new file mode 100644 index 0000000000000000000000000000000000000000..4db079f7633f48b2bb4d51339c795886b5734902 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/context.h @@ -0,0 +1,78 @@ +#ifndef Py_LIMITED_API +#ifndef Py_CONTEXT_H +#define Py_CONTEXT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyContext_Type; +typedef struct _pycontextobject PyContext; + +PyAPI_DATA(PyTypeObject) PyContextVar_Type; +typedef struct _pycontextvarobject PyContextVar; + +PyAPI_DATA(PyTypeObject) PyContextToken_Type; +typedef struct _pycontexttokenobject PyContextToken; + + +#define PyContext_CheckExact(o) Py_IS_TYPE(o, &PyContext_Type) +#define PyContextVar_CheckExact(o) Py_IS_TYPE(o, &PyContextVar_Type) +#define PyContextToken_CheckExact(o) Py_IS_TYPE(o, &PyContextToken_Type) + + +PyAPI_FUNC(PyObject *) PyContext_New(void); +PyAPI_FUNC(PyObject *) PyContext_Copy(PyObject *); +PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void); + +PyAPI_FUNC(int) PyContext_Enter(PyObject *); +PyAPI_FUNC(int) PyContext_Exit(PyObject *); + + +/* Create a new context variable. + + default_value can be NULL. +*/ +PyAPI_FUNC(PyObject *) PyContextVar_New( + const char *name, PyObject *default_value); + + +/* Get a value for the variable. + + Returns -1 if an error occurred during lookup. + + Returns 0 if value either was or was not found. + + If value was found, *value will point to it. + If not, it will point to: + + - default_value, if not NULL; + - the default value of "var", if not NULL; + - NULL. + + '*value' will be a new ref, if not NULL. +*/ +PyAPI_FUNC(int) PyContextVar_Get( + PyObject *var, PyObject *default_value, PyObject **value); + + +/* Set a new value for the variable. + Returns NULL if an error occurs. +*/ +PyAPI_FUNC(PyObject *) PyContextVar_Set(PyObject *var, PyObject *value); + + +/* Reset a variable to its previous value. + Returns 0 on success, -1 on error. +*/ +PyAPI_FUNC(int) PyContextVar_Reset(PyObject *var, PyObject *token); + + +/* This method is exposed only for CPython tests. Don not use it. */ +PyAPI_FUNC(PyObject *) _PyContext_NewHamtForTests(void); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CONTEXT_H */ +#endif /* !Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/descrobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/descrobject.h new file mode 100644 index 0000000000000000000000000000000000000000..e2ea1b9a2d305803e11f6fab6ceb06d607fc089c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/descrobject.h @@ -0,0 +1,64 @@ +#ifndef Py_CPYTHON_DESCROBJECT_H +# error "this header file must not be included directly" +#endif + +typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, + void *wrapped); + +typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, + void *wrapped, PyObject *kwds); + +struct wrapperbase { + const char *name; + int offset; + void *function; + wrapperfunc wrapper; + const char *doc; + int flags; + PyObject *name_strobj; +}; + +/* Flags for above struct */ +#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ + +/* Various kinds of descriptor objects */ + +typedef struct { + PyObject_HEAD + PyTypeObject *d_type; + PyObject *d_name; + PyObject *d_qualname; +} PyDescrObject; + +#define PyDescr_COMMON PyDescrObject d_common + +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) + +typedef struct { + PyDescr_COMMON; + PyMethodDef *d_method; + vectorcallfunc vectorcall; +} PyMethodDescrObject; + +typedef struct { + PyDescr_COMMON; + PyMemberDef *d_member; +} PyMemberDescrObject; + +typedef struct { + PyDescr_COMMON; + PyGetSetDef *d_getset; +} PyGetSetDescrObject; + +typedef struct { + PyDescr_COMMON; + struct wrapperbase *d_base; + void *d_wrapped; /* This can be any function pointer */ +} PyWrapperDescrObject; + +PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; + +PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, + struct wrapperbase *, void *); +PyAPI_FUNC(int) PyDescr_IsData(PyObject *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/dictobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/dictobject.h new file mode 100644 index 0000000000000000000000000000000000000000..033eaeb4c9751c0b57991f3fe036706266a8cddc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/dictobject.h @@ -0,0 +1,78 @@ +#ifndef Py_CPYTHON_DICTOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct _dictkeysobject PyDictKeysObject; +typedef struct _dictvalues PyDictValues; + +/* The ma_values pointer is NULL for a combined table + * or points to an array of PyObject* for a split table + */ +typedef struct { + PyObject_HEAD + + /* Number of items in the dictionary */ + Py_ssize_t ma_used; + + /* Dictionary version: globally unique, value change each time + the dictionary is modified */ + uint64_t ma_version_tag; + + PyDictKeysObject *ma_keys; + + /* If ma_values is NULL, the table is "combined": keys and values + are stored in ma_keys. + + If ma_values is not NULL, the table is split: + keys are stored in ma_keys and values are stored in ma_values */ + PyDictValues *ma_values; +} PyDictObject; + +PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key, + Py_hash_t hash); +PyAPI_FUNC(PyObject *) _PyDict_GetItemWithError(PyObject *dp, PyObject *key); +PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp, + _Py_Identifier *key); +PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyDict_SetDefault( + PyObject *mp, PyObject *key, PyObject *defaultobj); +PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key, + PyObject *item, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, + Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); +PyAPI_FUNC(int) _PyDict_Next( + PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash); + +/* Get the number of items of a dictionary. */ +#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used) +PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t); +PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, _Py_Identifier *); +PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); +PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); +PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); +PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *); +PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *); +#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) + +/* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0, + the first occurrence of a key wins, if override is 1, the last occurrence + of a key wins, if override is 2, a KeyError with conflicting key as + argument is raised. +*/ +PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override); +PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, _Py_Identifier *key, PyObject *item); + +PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, _Py_Identifier *key); +PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out); + +/* _PyDictView */ + +typedef struct { + PyObject_HEAD + PyDictObject *dv_dict; +} _PyDictViewObject; + +PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *); +PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileobject.h new file mode 100644 index 0000000000000000000000000000000000000000..b70ec318986d821580c9c76a6de0ec42fab25256 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileobject.h @@ -0,0 +1,19 @@ +#ifndef Py_CPYTHON_FILEOBJECT_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); +PyAPI_FUNC(char *) _Py_UniversalNewlineFgetsWithSize(char *, int, FILE*, PyObject *, size_t*); + +/* The std printer acts as a preliminary sys.stderr until the new io + infrastructure is in place. */ +PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); +PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; + +typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *); + +PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path); +PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path); +PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData); + +PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileutils.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileutils.h new file mode 100644 index 0000000000000000000000000000000000000000..b386ad107bde1ff9f522137167c10868766d2f30 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/fileutils.h @@ -0,0 +1,8 @@ +#ifndef Py_CPYTHON_FILEUTILS_H +# error "this header file must not be included directly" +#endif + +// Used by _testcapi which must not use the internal C API +PyAPI_FUNC(FILE*) _Py_fopen_obj( + PyObject *path, + const char *mode); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/floatobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/floatobject.h new file mode 100644 index 0000000000000000000000000000000000000000..7795d9f83f05cb88ede1a2db0903bb1df76ab5b7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/floatobject.h @@ -0,0 +1,21 @@ +#ifndef Py_CPYTHON_FLOATOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct { + PyObject_HEAD + double ob_fval; +} PyFloatObject; + +// Macro version of PyFloat_AsDouble() trading safety for speed. +// It doesn't check if op is a double object. +#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) + + +PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le); +PyAPI_FUNC(int) PyFloat_Pack4(double x, char *p, int le); +PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le); + +PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le); +PyAPI_FUNC(double) PyFloat_Unpack4(const char *p, int le); +PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/frameobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/frameobject.h new file mode 100644 index 0000000000000000000000000000000000000000..4e19535c656f2cbef34238143c61aa120d6c9c5e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/frameobject.h @@ -0,0 +1,29 @@ +/* Frame object interface */ + +#ifndef Py_CPYTHON_FRAMEOBJECT_H +# error "this header file must not be included directly" +#endif + +/* Standard object interface */ + +PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, + PyObject *, PyObject *); + +/* The rest of the interface is specific for frame objects */ + +/* Conversions between "fast locals" and locals in dictionary */ + +PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); + +/* -- Caveat emptor -- + * The concept of entry frames is an implementation detail of the CPython + * interpreter. This API is considered unstable and is provided for the + * convenience of debuggers, profilers and state-inspecting tools. Notice that + * this API can be changed in future minor versions if the underlying frame + * mechanism change or the concept of an 'entry frame' or its semantics becomes + * obsolete or outdated. */ + +PyAPI_FUNC(int) _PyFrame_IsEntryFrame(PyFrameObject *frame); + +PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f); +PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/funcobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/funcobject.h new file mode 100644 index 0000000000000000000000000000000000000000..99ac6008f8b611f83724f18097702e0661455aa5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/funcobject.h @@ -0,0 +1,113 @@ +/* Function object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_FUNCOBJECT_H +#define Py_FUNCOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +#define COMMON_FIELDS(PREFIX) \ + PyObject *PREFIX ## globals; \ + PyObject *PREFIX ## builtins; \ + PyObject *PREFIX ## name; \ + PyObject *PREFIX ## qualname; \ + PyObject *PREFIX ## code; /* A code object, the __code__ attribute */ \ + PyObject *PREFIX ## defaults; /* NULL or a tuple */ \ + PyObject *PREFIX ## kwdefaults; /* NULL or a dict */ \ + PyObject *PREFIX ## closure; /* NULL or a tuple of cell objects */ + +typedef struct { + COMMON_FIELDS(fc_) +} PyFrameConstructor; + +/* Function objects and code objects should not be confused with each other: + * + * Function objects are created by the execution of the 'def' statement. + * They reference a code object in their __code__ attribute, which is a + * purely syntactic object, i.e. nothing more than a compiled version of some + * source code lines. There is one code object per source code "fragment", + * but each code object can be referenced by zero or many function objects + * depending only on how many times the 'def' statement in the source was + * executed so far. + */ + +typedef struct { + PyObject_HEAD + COMMON_FIELDS(func_) + PyObject *func_doc; /* The __doc__ attribute, can be anything */ + PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ + PyObject *func_weakreflist; /* List of weak references */ + PyObject *func_module; /* The __module__ attribute, can be anything */ + PyObject *func_annotations; /* Annotations, a dict or NULL */ + vectorcallfunc vectorcall; + /* Version number for use by specializer. + * Can set to non-zero when we want to specialize. + * Will be set to zero if any of these change: + * defaults + * kwdefaults (only if the object changes, not the contents of the dict) + * code + * annotations */ + uint32_t func_version; + + /* Invariant: + * func_closure contains the bindings for func_code->co_freevars, so + * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) + * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). + */ +} PyFunctionObject; + +PyAPI_DATA(PyTypeObject) PyFunction_Type; + +#define PyFunction_Check(op) Py_IS_TYPE(op, &PyFunction_Type) + +PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); +PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); +PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); +PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); +PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) _PyFunction_Vectorcall( + PyObject *func, + PyObject *const *stack, + size_t nargsf, + PyObject *kwnames); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyFunction_GET_CODE(func) \ + (((PyFunctionObject *)func) -> func_code) +#define PyFunction_GET_GLOBALS(func) \ + (((PyFunctionObject *)func) -> func_globals) +#define PyFunction_GET_MODULE(func) \ + (((PyFunctionObject *)func) -> func_module) +#define PyFunction_GET_DEFAULTS(func) \ + (((PyFunctionObject *)func) -> func_defaults) +#define PyFunction_GET_KW_DEFAULTS(func) \ + (((PyFunctionObject *)func) -> func_kwdefaults) +#define PyFunction_GET_CLOSURE(func) \ + (((PyFunctionObject *)func) -> func_closure) +#define PyFunction_GET_ANNOTATIONS(func) \ + (((PyFunctionObject *)func) -> func_annotations) + +/* The classmethod and staticmethod types lives here, too */ +PyAPI_DATA(PyTypeObject) PyClassMethod_Type; +PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; + +PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); +PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FUNCOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/genobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/genobject.h new file mode 100644 index 0000000000000000000000000000000000000000..40eaa19d3fad94066d56de7287af9a347f9d1c37 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/genobject.h @@ -0,0 +1,88 @@ +/* Generator object interface */ + +#ifndef Py_LIMITED_API +#ifndef Py_GENOBJECT_H +#define Py_GENOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* --- Generators --------------------------------------------------------- */ + +/* _PyGenObject_HEAD defines the initial segment of generator + and coroutine objects. */ +#define _PyGenObject_HEAD(prefix) \ + PyObject_HEAD \ + /* The code object backing the generator */ \ + PyCodeObject *prefix##_code; \ + /* List of weak reference. */ \ + PyObject *prefix##_weakreflist; \ + /* Name of the generator. */ \ + PyObject *prefix##_name; \ + /* Qualified name of the generator. */ \ + PyObject *prefix##_qualname; \ + _PyErr_StackItem prefix##_exc_state; \ + PyObject *prefix##_origin_or_finalizer; \ + char prefix##_hooks_inited; \ + char prefix##_closed; \ + char prefix##_running_async; \ + /* The frame */ \ + int8_t prefix##_frame_state; \ + PyObject *prefix##_iframe[1]; + +typedef struct { + /* The gi_ prefix is intended to remind of generator-iterator. */ + _PyGenObject_HEAD(gi) +} PyGenObject; + +PyAPI_DATA(PyTypeObject) PyGen_Type; + +#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) +#define PyGen_CheckExact(op) Py_IS_TYPE(op, &PyGen_Type) + +PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *); +PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *, + PyObject *name, PyObject *qualname); +PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *); +PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); +PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); + + +/* --- PyCoroObject ------------------------------------------------------- */ + +typedef struct { + _PyGenObject_HEAD(cr) +} PyCoroObject; + +PyAPI_DATA(PyTypeObject) PyCoro_Type; +PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; + +#define PyCoro_CheckExact(op) Py_IS_TYPE(op, &PyCoro_Type) +PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *, + PyObject *name, PyObject *qualname); + + +/* --- Asynchronous Generators -------------------------------------------- */ + +typedef struct { + _PyGenObject_HEAD(ag) +} PyAsyncGenObject; + +PyAPI_DATA(PyTypeObject) PyAsyncGen_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type; +PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type; + +PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *, + PyObject *name, PyObject *qualname); + +#define PyAsyncGen_CheckExact(op) Py_IS_TYPE(op, &PyAsyncGen_Type) + + +#undef _PyGenObject_HEAD + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GENOBJECT_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/import.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/import.h new file mode 100644 index 0000000000000000000000000000000000000000..a69b4f34def342adbb3f23a3a727a350737bff54 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/import.h @@ -0,0 +1,45 @@ +#ifndef Py_CPYTHON_IMPORT_H +# error "this header file must not be included directly" +#endif + +PyMODINIT_FUNC PyInit__imp(void); + +PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); + +PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(_Py_Identifier *name); +PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); +PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); + +PyAPI_FUNC(void) _PyImport_AcquireLock(void); +PyAPI_FUNC(int) _PyImport_ReleaseLock(void); + +PyAPI_FUNC(int) _PyImport_FixupBuiltin( + PyObject *mod, + const char *name, /* UTF-8 encoded string */ + PyObject *modules + ); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, + PyObject *, PyObject *); + +struct _inittab { + const char *name; /* ASCII encoded string */ + PyObject* (*initfunc)(void); +}; +PyAPI_DATA(struct _inittab *) PyImport_Inittab; +PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); + +struct _frozen { + const char *name; /* ASCII encoded string */ + const unsigned char *code; + int size; + int is_package; + PyObject *(*get_code)(void); +}; + +/* Embedding apps may change this pointer to point to their favorite + collection of frozen modules: */ + +PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; + +PyAPI_DATA(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *); +PyAPI_DATA(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/initconfig.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/initconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..3b6d59389f26b9dcea2f1bbe9ad1116fae4b9588 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/initconfig.h @@ -0,0 +1,257 @@ +#ifndef Py_PYCORECONFIG_H +#define Py_PYCORECONFIG_H +#ifndef Py_LIMITED_API +#ifdef __cplusplus +extern "C" { +#endif + +/* --- PyStatus ----------------------------------------------- */ + +typedef struct { + enum { + _PyStatus_TYPE_OK=0, + _PyStatus_TYPE_ERROR=1, + _PyStatus_TYPE_EXIT=2 + } _type; + const char *func; + const char *err_msg; + int exitcode; +} PyStatus; + +PyAPI_FUNC(PyStatus) PyStatus_Ok(void); +PyAPI_FUNC(PyStatus) PyStatus_Error(const char *err_msg); +PyAPI_FUNC(PyStatus) PyStatus_NoMemory(void); +PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode); +PyAPI_FUNC(int) PyStatus_IsError(PyStatus err); +PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err); +PyAPI_FUNC(int) PyStatus_Exception(PyStatus err); + +/* --- PyWideStringList ------------------------------------------------ */ + +typedef struct { + /* If length is greater than zero, items must be non-NULL + and all items strings must be non-NULL */ + Py_ssize_t length; + wchar_t **items; +} PyWideStringList; + +PyAPI_FUNC(PyStatus) PyWideStringList_Append(PyWideStringList *list, + const wchar_t *item); +PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list, + Py_ssize_t index, + const wchar_t *item); + + +/* --- PyPreConfig ----------------------------------------------- */ + +typedef struct PyPreConfig { + int _config_init; /* _PyConfigInitEnum value */ + + /* Parse Py_PreInitializeFromBytesArgs() arguments? + See PyConfig.parse_argv */ + int parse_argv; + + /* If greater than 0, enable isolated mode: sys.path contains + neither the script's directory nor the user's site-packages directory. + + Set to 1 by the -I command line option. If set to -1 (default), inherit + Py_IsolatedFlag value. */ + int isolated; + + /* If greater than 0: use environment variables. + Set to 0 by -E command line option. If set to -1 (default), it is + set to !Py_IgnoreEnvironmentFlag. */ + int use_environment; + + /* Set the LC_CTYPE locale to the user preferred locale? If equals to 0, + set coerce_c_locale and coerce_c_locale_warn to 0. */ + int configure_locale; + + /* Coerce the LC_CTYPE locale if it's equal to "C"? (PEP 538) + + Set to 0 by PYTHONCOERCECLOCALE=0. Set to 1 by PYTHONCOERCECLOCALE=1. + Set to 2 if the user preferred LC_CTYPE locale is "C". + + If it is equal to 1, LC_CTYPE locale is read to decide if it should be + coerced or not (ex: PYTHONCOERCECLOCALE=1). Internally, it is set to 2 + if the LC_CTYPE locale must be coerced. + + Disable by default (set to 0). Set it to -1 to let Python decide if it + should be enabled or not. */ + int coerce_c_locale; + + /* Emit a warning if the LC_CTYPE locale is coerced? + + Set to 1 by PYTHONCOERCECLOCALE=warn. + + Disable by default (set to 0). Set it to -1 to let Python decide if it + should be enabled or not. */ + int coerce_c_locale_warn; + +#ifdef MS_WINDOWS + /* If greater than 1, use the "mbcs" encoding instead of the UTF-8 + encoding for the filesystem encoding. + + Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is + set to a non-empty string. If set to -1 (default), inherit + Py_LegacyWindowsFSEncodingFlag value. + + See PEP 529 for more details. */ + int legacy_windows_fs_encoding; +#endif + + /* Enable UTF-8 mode? (PEP 540) + + Disabled by default (equals to 0). + + Set to 1 by "-X utf8" and "-X utf8=1" command line options. + Set to 1 by PYTHONUTF8=1 environment variable. + + Set to 0 by "-X utf8=0" and PYTHONUTF8=0. + + If equals to -1, it is set to 1 if the LC_CTYPE locale is "C" or + "POSIX", otherwise it is set to 0. Inherit Py_UTF8Mode value value. */ + int utf8_mode; + + /* If non-zero, enable the Python Development Mode. + + Set to 1 by the -X dev command line option. Set by the PYTHONDEVMODE + environment variable. */ + int dev_mode; + + /* Memory allocator: PYTHONMALLOC env var. + See PyMemAllocatorName for valid values. */ + int allocator; +} PyPreConfig; + +PyAPI_FUNC(void) PyPreConfig_InitPythonConfig(PyPreConfig *config); +PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config); + + +/* --- PyConfig ---------------------------------------------- */ + +/* This structure is best documented in the Doc/c-api/init_config.rst file. */ +typedef struct PyConfig { + int _config_init; /* _PyConfigInitEnum value */ + + int isolated; + int use_environment; + int dev_mode; + int install_signal_handlers; + int use_hash_seed; + unsigned long hash_seed; + int faulthandler; + int tracemalloc; + int import_time; + int code_debug_ranges; + int show_ref_count; + int dump_refs; + wchar_t *dump_refs_file; + int malloc_stats; + wchar_t *filesystem_encoding; + wchar_t *filesystem_errors; + wchar_t *pycache_prefix; + int parse_argv; + PyWideStringList orig_argv; + PyWideStringList argv; + PyWideStringList xoptions; + PyWideStringList warnoptions; + int site_import; + int bytes_warning; + int warn_default_encoding; + int inspect; + int interactive; + int optimization_level; + int parser_debug; + int write_bytecode; + int verbose; + int quiet; + int user_site_directory; + int configure_c_stdio; + int buffered_stdio; + wchar_t *stdio_encoding; + wchar_t *stdio_errors; +#ifdef MS_WINDOWS + int legacy_windows_stdio; +#endif + wchar_t *check_hash_pycs_mode; + int use_frozen_modules; + int safe_path; + + /* --- Path configuration inputs ------------ */ + int pathconfig_warnings; + wchar_t *program_name; + wchar_t *pythonpath_env; + wchar_t *home; + wchar_t *platlibdir; + + /* --- Path configuration outputs ----------- */ + int module_search_paths_set; + PyWideStringList module_search_paths; + wchar_t *stdlib_dir; + wchar_t *executable; + wchar_t *base_executable; + wchar_t *prefix; + wchar_t *base_prefix; + wchar_t *exec_prefix; + wchar_t *base_exec_prefix; + + /* --- Parameter only used by Py_Main() ---------- */ + int skip_source_first_line; + wchar_t *run_command; + wchar_t *run_module; + wchar_t *run_filename; + + /* --- Private fields ---------------------------- */ + + // Install importlib? If equals to 0, importlib is not initialized at all. + // Needed by freeze_importlib. + int _install_importlib; + + // If equal to 0, stop Python initialization before the "main" phase. + int _init_main; + + // If non-zero, disallow threads, subprocesses, and fork. + // Default: 0. + int _isolated_interpreter; + + // If non-zero, we believe we're running from a source tree. + int _is_python_build; +} PyConfig; + +PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config); +PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config); +PyAPI_FUNC(void) PyConfig_Clear(PyConfig *); +PyAPI_FUNC(PyStatus) PyConfig_SetString( + PyConfig *config, + wchar_t **config_str, + const wchar_t *str); +PyAPI_FUNC(PyStatus) PyConfig_SetBytesString( + PyConfig *config, + wchar_t **config_str, + const char *str); +PyAPI_FUNC(PyStatus) PyConfig_Read(PyConfig *config); +PyAPI_FUNC(PyStatus) PyConfig_SetBytesArgv( + PyConfig *config, + Py_ssize_t argc, + char * const *argv); +PyAPI_FUNC(PyStatus) PyConfig_SetArgv(PyConfig *config, + Py_ssize_t argc, + wchar_t * const *argv); +PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config, + PyWideStringList *list, + Py_ssize_t length, wchar_t **items); + + +/* --- Helper functions --------------------------------------- */ + +/* Get the original command line arguments, before Python modified them. + + See also PyConfig.orig_argv. */ +PyAPI_FUNC(void) Py_GetArgcArgv(int *argc, wchar_t ***argv); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LIMITED_API */ +#endif /* !Py_PYCORECONFIG_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/listobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/listobject.h new file mode 100644 index 0000000000000000000000000000000000000000..1add8213e0c092fbd63514ef96cf75a26a21ea08 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/listobject.h @@ -0,0 +1,51 @@ +#ifndef Py_CPYTHON_LISTOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct { + PyObject_VAR_HEAD + /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ + PyObject **ob_item; + + /* ob_item contains space for 'allocated' elements. The number + * currently in use is ob_size. + * Invariants: + * 0 <= ob_size <= allocated + * len(list) == ob_size + * ob_item == NULL implies ob_size == allocated == 0 + * list.sort() temporarily sets allocated to -1 to detect mutations. + * + * Items must normally not be NULL, except during construction when + * the list is not yet visible outside the function that builds it. + */ + Py_ssize_t allocated; +} PyListObject; + +PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); +PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); + +/* Cast argument to PyListObject* type. */ +#define _PyList_CAST(op) \ + (assert(PyList_Check(op)), _Py_CAST(PyListObject*, (op))) + +// Macros and static inline functions, trading safety for speed + +static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) { + PyListObject *list = _PyList_CAST(op); + return Py_SIZE(list); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op)) +#endif + +#define PyList_GET_ITEM(op, index) (_PyList_CAST(op)->ob_item[index]) + +static inline void +PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) { + PyListObject *list = _PyList_CAST(op); + list->ob_item[index] = value; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +#define PyList_SET_ITEM(op, index, value) \ + PyList_SET_ITEM(_PyObject_CAST(op), index, _PyObject_CAST(value)) +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/longintrepr.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/longintrepr.h new file mode 100644 index 0000000000000000000000000000000000000000..6d52427508b5fe4fc5414673d273a4ecfd587dcf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/longintrepr.h @@ -0,0 +1,96 @@ +#ifndef Py_LIMITED_API +#ifndef Py_LONGINTREPR_H +#define Py_LONGINTREPR_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* This is published for the benefit of "friends" marshal.c and _decimal.c. */ + +/* Parameters of the integer representation. There are two different + sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit + integer type, and one set for 15-bit digits with each digit stored in an + unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at + configure time or in pyport.h, is used to decide which digit size to use. + + Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' + should be an unsigned integer type able to hold all integers up to + PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, + and that overflow is handled by taking the result modulo 2**N for some N > + PyLong_SHIFT. The majority of the code doesn't care about the precise + value of PyLong_SHIFT, but there are some notable exceptions: + + - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 + + - long_hash() requires that PyLong_SHIFT is *strictly* less than the number + of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) + conversion functions + + - the Python int <-> size_t/Py_ssize_t conversion functions expect that + PyLong_SHIFT is strictly less than the number of bits in a size_t + + - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 + + - NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single + digit; with the current values this forces PyLong_SHIFT >= 9 + + The values 15 and 30 should fit all of the above requirements, on any + platform. +*/ + +#if PYLONG_BITS_IN_DIGIT == 30 +typedef uint32_t digit; +typedef int32_t sdigit; /* signed variant of digit */ +typedef uint64_t twodigits; +typedef int64_t stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 30 +#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ +#elif PYLONG_BITS_IN_DIGIT == 15 +typedef unsigned short digit; +typedef short sdigit; /* signed variant of digit */ +typedef unsigned long twodigits; +typedef long stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 15 +#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ +#else +#error "PYLONG_BITS_IN_DIGIT should be 15 or 30" +#endif +#define PyLong_BASE ((digit)1 << PyLong_SHIFT) +#define PyLong_MASK ((digit)(PyLong_BASE - 1)) + +/* Long integer representation. + The absolute value of a number is equal to + SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) + Negative numbers are represented with ob_size < 0; + zero is represented by ob_size == 0. + In a normalized number, ob_digit[abs(ob_size)-1] (the most significant + digit) is never zero. Also, in all cases, for all valid i, + 0 <= ob_digit[i] <= MASK. + The allocation function takes care of allocating extra memory + so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. + We always allocate memory for at least one digit, so accessing ob_digit[0] + is always safe. However, in the case ob_size == 0, the contents of + ob_digit[0] may be undefined. + + CAUTION: Generic code manipulating subtypes of PyVarObject has to + aware that ints abuse ob_size's sign bit. +*/ + +struct _longobject { + PyObject_VAR_HEAD + digit ob_digit[1]; +}; + +PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); + +/* Return a copy of src. */ +PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LONGINTREPR_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/longobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/longobject.h new file mode 100644 index 0000000000000000000000000000000000000000..1a73799d658fe02d62afb7a62171601fbe644d7f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/longobject.h @@ -0,0 +1,95 @@ +#ifndef Py_CPYTHON_LONGOBJECT_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); + +PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *); + +/* _PyLong_Frexp returns a double x and an exponent e such that the + true value is approximately equal to x * 2**e. e is >= 0. x is + 0.0 if and only if the input is 0 (in which case, e and x are both + zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is + possible if the number of bits doesn't fit into a Py_ssize_t, sets + OverflowError and returns -1.0 for x, 0 for e. */ +PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); + +PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base); +PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int); + +/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. + v must not be NULL, and must be a normalized long. + There are no error cases. +*/ +PyAPI_FUNC(int) _PyLong_Sign(PyObject *v); + +/* _PyLong_NumBits. Return the number of bits needed to represent the + absolute value of a long. For example, this returns 1 for 1 and -1, 2 + for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. + v must not be NULL, and must be a normalized long. + (size_t)-1 is returned and OverflowError set if the true result doesn't + fit in a size_t. +*/ +PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v); + +/* _PyLong_DivmodNear. Given integers a and b, compute the nearest + integer q to the exact quotient a / b, rounding to the nearest even integer + in the case of a tie. Return (q, r), where r = a - q*b. The remainder r + will satisfy abs(r) <= abs(b)/2, with equality possible only if q is + even. +*/ +PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *); + +/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in + base 256, and return a Python int with the same numeric value. + If n is 0, the integer is 0. Else: + If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; + else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the + LSB. + If is_signed is 0/false, view the bytes as a non-negative integer. + If is_signed is 1/true, view the bytes as a 2's-complement integer, + non-negative if bit 0x80 of the MSB is clear, negative if set. + Error returns: + + Return NULL with the appropriate exception set if there's not + enough memory to create the Python int. +*/ +PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( + const unsigned char* bytes, size_t n, + int little_endian, int is_signed); + +/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long + v to a base-256 integer, stored in array bytes. Normally return 0, + return -1 on error. + If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at + bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and + the LSB at bytes[n-1]. + If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes + are filled and there's nothing special about bit 0x80 of the MSB. + If is_signed is 1/true, bytes is filled with the 2's-complement + representation of v's value. Bit 0x80 of the MSB is the sign bit. + Error returns (-1): + + is_signed is 0 and v < 0. TypeError is set in this case, and bytes + isn't altered. + + n isn't big enough to hold the full mathematical value of v. For + example, if is_signed is 0 and there are more digits in the v than + fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of + being large enough to hold a sign bit. OverflowError is set in this + case, but bytes holds the least-significant n bytes of the true value. +*/ +PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, + unsigned char* bytes, size_t n, + int little_endian, int is_signed); + +/* _PyLong_Format: Convert the long to a string object with given base, + appending a base prefix of 0[box] if base is 2, 8 or 16. */ +PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base); + +/* For use by the gcd function in mathmodule.c */ +PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) _PyLong_Rshift(PyObject *, size_t); +PyAPI_FUNC(PyObject *) _PyLong_Lshift(PyObject *, size_t); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/methodobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/methodobject.h new file mode 100644 index 0000000000000000000000000000000000000000..54a61cfd077be9aa29e233a7971a3393f9f3293a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/methodobject.h @@ -0,0 +1,74 @@ +#ifndef Py_CPYTHON_METHODOBJECT_H +# error "this header file must not be included directly" +#endif + +// PyCFunctionObject structure + +typedef struct { + PyObject_HEAD + PyMethodDef *m_ml; /* Description of the C function to call */ + PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ + PyObject *m_module; /* The __module__ attribute, can be anything */ + PyObject *m_weakreflist; /* List of weak references */ + vectorcallfunc vectorcall; +} PyCFunctionObject; + +#define _PyCFunctionObject_CAST(func) \ + (assert(PyCFunction_Check(func)), \ + _Py_CAST(PyCFunctionObject*, (func))) + + +// PyCMethodObject structure + +typedef struct { + PyCFunctionObject func; + PyTypeObject *mm_class; /* Class that defines this method */ +} PyCMethodObject; + +#define _PyCMethodObject_CAST(func) \ + (assert(PyCMethod_Check(func)), \ + _Py_CAST(PyCMethodObject*, (func))) + +PyAPI_DATA(PyTypeObject) PyCMethod_Type; + +#define PyCMethod_CheckExact(op) Py_IS_TYPE(op, &PyCMethod_Type) +#define PyCMethod_Check(op) PyObject_TypeCheck(op, &PyCMethod_Type) + + +/* Static inline functions for direct access to these values. + Type checks are *not* done, so use with care. */ +static inline PyCFunction PyCFunction_GET_FUNCTION(PyObject *func) { + return _PyCFunctionObject_CAST(func)->m_ml->ml_meth; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(_PyObject_CAST(func)) +#endif + +static inline PyObject* PyCFunction_GET_SELF(PyObject *func_obj) { + PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj); + if (func->m_ml->ml_flags & METH_STATIC) { + return _Py_NULL; + } + return func->m_self; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyCFunction_GET_SELF(func) PyCFunction_GET_SELF(_PyObject_CAST(func)) +#endif + +static inline int PyCFunction_GET_FLAGS(PyObject *func) { + return _PyCFunctionObject_CAST(func)->m_ml->ml_flags; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyCFunction_GET_FLAGS(func) PyCFunction_GET_FLAGS(_PyObject_CAST(func)) +#endif + +static inline PyTypeObject* PyCFunction_GET_CLASS(PyObject *func_obj) { + PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj); + if (func->m_ml->ml_flags & METH_METHOD) { + return _PyCMethodObject_CAST(func)->mm_class; + } + return _Py_NULL; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyCFunction_GET_CLASS(func) PyCFunction_GET_CLASS(_PyObject_CAST(func)) +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/modsupport.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/modsupport.h new file mode 100644 index 0000000000000000000000000000000000000000..205e174243987ed01b1aa81043eba11c41d551de --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/modsupport.h @@ -0,0 +1,108 @@ +#ifndef Py_CPYTHON_MODSUPPORT_H +# error "this header file must not be included directly" +#endif + +/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier + to mean Py_ssize_t */ +#ifdef PY_SSIZE_T_CLEAN +#define _Py_VaBuildStack _Py_VaBuildStack_SizeT +#else +PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); +PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); +#endif + +PyAPI_FUNC(int) _PyArg_UnpackStack( + PyObject *const *args, + Py_ssize_t nargs, + const char *name, + Py_ssize_t min, + Py_ssize_t max, + ...); + +PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs); +PyAPI_FUNC(int) _PyArg_NoKwnames(const char *funcname, PyObject *kwnames); +PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); +#define _PyArg_NoKeywords(funcname, kwargs) \ + ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs))) +#define _PyArg_NoKwnames(funcname, kwnames) \ + ((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames))) +#define _PyArg_NoPositional(funcname, args) \ + ((args) == NULL || _PyArg_NoPositional((funcname), (args))) + +PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *); +PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t, + Py_ssize_t, Py_ssize_t); +#define _PyArg_CheckPositional(funcname, nargs, min, max) \ + ((!ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \ + || _PyArg_CheckPositional((funcname), (nargs), (min), (max))) + +PyAPI_FUNC(PyObject **) _Py_VaBuildStack( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); + +typedef struct _PyArg_Parser { + const char *format; + const char * const *keywords; + const char *fname; + const char *custom_msg; + int pos; /* number of positional-only arguments */ + int min; /* minimal number of arguments */ + int max; /* maximal number of positional arguments */ + PyObject *kwtuple; /* tuple of keyword parameter names */ + struct _PyArg_Parser *next; +} _PyArg_Parser; + +#ifdef PY_SSIZE_T_CLEAN +#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT +#define _PyArg_ParseStack _PyArg_ParseStack_SizeT +#define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT +#define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT +#endif + +PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *, + struct _PyArg_Parser *, ...); +PyAPI_FUNC(int) _PyArg_ParseStack( + PyObject *const *args, + Py_ssize_t nargs, + const char *format, + ...); +PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords( + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwnames, + struct _PyArg_Parser *, + ...); +PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *, + struct _PyArg_Parser *, va_list); +PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords( + PyObject *const *args, Py_ssize_t nargs, + PyObject *kwargs, PyObject *kwnames, + struct _PyArg_Parser *parser, + int minpos, int maxpos, int minkw, + PyObject **buf); + +PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywordsWithVararg( + PyObject *const *args, Py_ssize_t nargs, + PyObject *kwargs, PyObject *kwnames, + struct _PyArg_Parser *parser, + int minpos, int maxpos, int minkw, + int vararg, PyObject **buf); + +#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \ + (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \ + (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \ + _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \ + (minpos), (maxpos), (minkw), (buf))) + +PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(PyModuleDef*, int apiver); +PyAPI_FUNC(int) _PyModule_Add(PyObject *, const char *, PyObject *); + +PyAPI_DATA(const char *) _Py_PackageContext; diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/object.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/object.h new file mode 100644 index 0000000000000000000000000000000000000000..b018dabf9d862ff501eae15a8d0e0e58fba4697a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/object.h @@ -0,0 +1,511 @@ +#ifndef Py_CPYTHON_OBJECT_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(void) _Py_NewReference(PyObject *op); + +#ifdef Py_TRACE_REFS +/* Py_TRACE_REFS is such major surgery that we call external routines. */ +PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); +#endif + +#ifdef Py_REF_DEBUG +PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); +#endif + + +/********************* String Literals ****************************************/ +/* This structure helps managing static strings. The basic usage goes like this: + Instead of doing + + r = PyObject_CallMethod(o, "foo", "args", ...); + + do + + _Py_IDENTIFIER(foo); + ... + r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); + + PyId_foo is a static variable, either on block level or file level. On first + usage, the string "foo" is interned, and the structures are linked. On interpreter + shutdown, all strings are released. + + Alternatively, _Py_static_string allows choosing the variable name. + _PyUnicode_FromId returns a borrowed reference to the interned string. + _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. +*/ +typedef struct _Py_Identifier { + const char* string; + // Index in PyInterpreterState.unicode.ids.array. It is process-wide + // unique and must be initialized to -1. + Py_ssize_t index; +} _Py_Identifier; + +#if defined(NEEDS_PY_IDENTIFIER) || !defined(Py_BUILD_CORE) +// For now we are keeping _Py_IDENTIFIER for continued use +// in non-builtin extensions (and naughty PyPI modules). + +#define _Py_static_string_init(value) { .string = value, .index = -1 } +#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value) +#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) + +#endif /* NEEDS_PY_IDENTIFIER */ + +typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); +typedef void (*releasebufferproc)(PyObject *, Py_buffer *); + +typedef PyObject *(*vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + + +typedef struct { + /* Number implementations must check *both* + arguments for proper type and implement the necessary conversions + in the slot functions themselves. */ + + binaryfunc nb_add; + binaryfunc nb_subtract; + binaryfunc nb_multiply; + binaryfunc nb_remainder; + binaryfunc nb_divmod; + ternaryfunc nb_power; + unaryfunc nb_negative; + unaryfunc nb_positive; + unaryfunc nb_absolute; + inquiry nb_bool; + unaryfunc nb_invert; + binaryfunc nb_lshift; + binaryfunc nb_rshift; + binaryfunc nb_and; + binaryfunc nb_xor; + binaryfunc nb_or; + unaryfunc nb_int; + void *nb_reserved; /* the slot formerly known as nb_long */ + unaryfunc nb_float; + + binaryfunc nb_inplace_add; + binaryfunc nb_inplace_subtract; + binaryfunc nb_inplace_multiply; + binaryfunc nb_inplace_remainder; + ternaryfunc nb_inplace_power; + binaryfunc nb_inplace_lshift; + binaryfunc nb_inplace_rshift; + binaryfunc nb_inplace_and; + binaryfunc nb_inplace_xor; + binaryfunc nb_inplace_or; + + binaryfunc nb_floor_divide; + binaryfunc nb_true_divide; + binaryfunc nb_inplace_floor_divide; + binaryfunc nb_inplace_true_divide; + + unaryfunc nb_index; + + binaryfunc nb_matrix_multiply; + binaryfunc nb_inplace_matrix_multiply; +} PyNumberMethods; + +typedef struct { + lenfunc sq_length; + binaryfunc sq_concat; + ssizeargfunc sq_repeat; + ssizeargfunc sq_item; + void *was_sq_slice; + ssizeobjargproc sq_ass_item; + void *was_sq_ass_slice; + objobjproc sq_contains; + + binaryfunc sq_inplace_concat; + ssizeargfunc sq_inplace_repeat; +} PySequenceMethods; + +typedef struct { + lenfunc mp_length; + binaryfunc mp_subscript; + objobjargproc mp_ass_subscript; +} PyMappingMethods; + +typedef PySendResult (*sendfunc)(PyObject *iter, PyObject *value, PyObject **result); + +typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + sendfunc am_send; +} PyAsyncMethods; + +typedef struct { + getbufferproc bf_getbuffer; + releasebufferproc bf_releasebuffer; +} PyBufferProcs; + +/* Allow printfunc in the tp_vectorcall_offset slot for + * backwards-compatibility */ +typedef Py_ssize_t printfunc; + +// If this structure is modified, Doc/includes/typestruct.h should be updated +// as well. +struct _typeobject { + PyObject_VAR_HEAD + const char *tp_name; /* For printing, in format "." */ + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ + + /* Methods to implement standard operations */ + + destructor tp_dealloc; + Py_ssize_t tp_vectorcall_offset; + getattrfunc tp_getattr; + setattrfunc tp_setattr; + PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2) + or tp_reserved (Python 3) */ + reprfunc tp_repr; + + /* Method suites for standard classes */ + + PyNumberMethods *tp_as_number; + PySequenceMethods *tp_as_sequence; + PyMappingMethods *tp_as_mapping; + + /* More standard operations (here for binary compatibility) */ + + hashfunc tp_hash; + ternaryfunc tp_call; + reprfunc tp_str; + getattrofunc tp_getattro; + setattrofunc tp_setattro; + + /* Functions to access object as input/output buffer */ + PyBufferProcs *tp_as_buffer; + + /* Flags to define presence of optional/expanded features */ + unsigned long tp_flags; + + const char *tp_doc; /* Documentation string */ + + /* Assigned meaning in release 2.0 */ + /* call function for all accessible objects */ + traverseproc tp_traverse; + + /* delete references to contained objects */ + inquiry tp_clear; + + /* Assigned meaning in release 2.1 */ + /* rich comparisons */ + richcmpfunc tp_richcompare; + + /* weak reference enabler */ + Py_ssize_t tp_weaklistoffset; + + /* Iterators */ + getiterfunc tp_iter; + iternextfunc tp_iternext; + + /* Attribute descriptor and subclassing stuff */ + PyMethodDef *tp_methods; + PyMemberDef *tp_members; + PyGetSetDef *tp_getset; + // Strong reference on a heap type, borrowed reference on a static type + PyTypeObject *tp_base; + PyObject *tp_dict; + descrgetfunc tp_descr_get; + descrsetfunc tp_descr_set; + Py_ssize_t tp_dictoffset; + initproc tp_init; + allocfunc tp_alloc; + newfunc tp_new; + freefunc tp_free; /* Low-level free-memory routine */ + inquiry tp_is_gc; /* For PyObject_IS_GC */ + PyObject *tp_bases; + PyObject *tp_mro; /* method resolution order */ + PyObject *tp_cache; + PyObject *tp_subclasses; + PyObject *tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + + destructor tp_finalize; + vectorcallfunc tp_vectorcall; +}; + +/* This struct is used by the specializer + * It should should be treated as an opaque blob + * by code other than the specializer and interpreter. */ +struct _specialization_cache { + PyObject *getitem; +}; + +/* The *real* layout of a type object when allocated on the heap */ +typedef struct _heaptypeobject { + /* Note: there's a dependency on the order of these members + in slotptr() in typeobject.c . */ + PyTypeObject ht_type; + PyAsyncMethods as_async; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, + so that the mapping wins when both + the mapping and the sequence define + a given operator (e.g. __getitem__). + see add_operators() in typeobject.c . */ + PyBufferProcs as_buffer; + PyObject *ht_name, *ht_slots, *ht_qualname; + struct _dictkeysobject *ht_cached_keys; + PyObject *ht_module; + char *_ht_tpname; // Storage for "tp_name"; see PyType_FromModuleAndSpec + struct _specialization_cache _spec_cache; // For use by the specializer. + /* here are optional user slots, followed by the members. */ +} PyHeapTypeObject; + +PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *); +PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); +PyAPI_FUNC(PyObject *) _PyObject_LookupSpecialId(PyObject *, _Py_Identifier *); +#ifndef Py_BUILD_CORE +// Backward compatibility for 3rd-party extensions +// that may be using the old name. +#define _PyObject_LookupSpecial _PyObject_LookupSpecialId +#endif +PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); +PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); +PyAPI_FUNC(PyObject *) PyType_GetModuleByDef(PyTypeObject *, PyModuleDef *); + +PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); +PyAPI_FUNC(void) _Py_BreakPoint(void); +PyAPI_FUNC(void) _PyObject_Dump(PyObject *); +PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *); + +PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, _Py_Identifier *); +PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, _Py_Identifier *, PyObject *); +/* Replacements of PyObject_GetAttr() and _PyObject_GetAttrId() which + don't raise AttributeError. + + Return 1 and set *result != NULL if an attribute is found. + Return 0 and set *result == NULL if an attribute is not found; + an AttributeError is silenced. + Return -1 and set *result == NULL if an error other than AttributeError + is raised. +*/ +PyAPI_FUNC(int) _PyObject_LookupAttr(PyObject *, PyObject *, PyObject **); +PyAPI_FUNC(int) _PyObject_LookupAttrId(PyObject *, _Py_Identifier *, PyObject **); + +PyAPI_FUNC(int) _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); +PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *); +PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *); + +/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes + dict as the last parameter. */ +PyAPI_FUNC(PyObject *) +_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *, int); +PyAPI_FUNC(int) +_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, + PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *); + +/* Safely decref `op` and set `op` to `op2`. + * + * As in case of Py_CLEAR "the obvious" code can be deadly: + * + * Py_DECREF(op); + * op = op2; + * + * The safe way is: + * + * Py_SETREF(op, op2); + * + * That arranges to set `op` to `op2` _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of + * Py_DECREF. + */ + +#define Py_SETREF(op, op2) \ + do { \ + PyObject *_py_tmp = _PyObject_CAST(op); \ + (op) = (op2); \ + Py_DECREF(_py_tmp); \ + } while (0) + +#define Py_XSETREF(op, op2) \ + do { \ + PyObject *_py_tmp = _PyObject_CAST(op); \ + (op) = (op2); \ + Py_XDECREF(_py_tmp); \ + } while (0) + + +PyAPI_DATA(PyTypeObject) _PyNone_Type; +PyAPI_DATA(PyTypeObject) _PyNotImplemented_Type; + +/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. + * Defined in object.c. + */ +PyAPI_DATA(int) _Py_SwappedOp[]; + +PyAPI_FUNC(void) +_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, + size_t sizeof_block); +PyAPI_FUNC(void) +_PyObject_DebugTypeStats(FILE *out); + +/* Define a pair of assertion macros: + _PyObject_ASSERT_FROM(), _PyObject_ASSERT_WITH_MSG() and _PyObject_ASSERT(). + + These work like the regular C assert(), in that they will abort the + process with a message on stderr if the given condition fails to hold, + but compile away to nothing if NDEBUG is defined. + + However, before aborting, Python will also try to call _PyObject_Dump() on + the given object. This may be of use when investigating bugs in which a + particular object is corrupt (e.g. buggy a tp_visit method in an extension + module breaking the garbage collector), to help locate the broken objects. + + The WITH_MSG variant allows you to supply an additional message that Python + will attempt to print to stderr, after the object dump. */ +#ifdef NDEBUG + /* No debugging: compile away the assertions: */ +# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ + ((void)0) +#else + /* With debugging: generate checks: */ +# define _PyObject_ASSERT_FROM(obj, expr, msg, filename, lineno, func) \ + ((expr) \ + ? (void)(0) \ + : _PyObject_AssertFailed((obj), Py_STRINGIFY(expr), \ + (msg), (filename), (lineno), (func))) +#endif + +#define _PyObject_ASSERT_WITH_MSG(obj, expr, msg) \ + _PyObject_ASSERT_FROM(obj, expr, msg, __FILE__, __LINE__, __func__) +#define _PyObject_ASSERT(obj, expr) \ + _PyObject_ASSERT_WITH_MSG(obj, expr, NULL) + +#define _PyObject_ASSERT_FAILED_MSG(obj, msg) \ + _PyObject_AssertFailed((obj), NULL, (msg), __FILE__, __LINE__, __func__) + +/* Declare and define _PyObject_AssertFailed() even when NDEBUG is defined, + to avoid causing compiler/linker errors when building extensions without + NDEBUG against a Python built with NDEBUG defined. + + msg, expr and function can be NULL. */ +PyAPI_FUNC(void) _Py_NO_RETURN _PyObject_AssertFailed( + PyObject *obj, + const char *expr, + const char *msg, + const char *file, + int line, + const char *function); + +/* Check if an object is consistent. For example, ensure that the reference + counter is greater than or equal to 1, and ensure that ob_type is not NULL. + + Call _PyObject_AssertFailed() if the object is inconsistent. + + If check_content is zero, only check header fields: reduce the overhead. + + The function always return 1. The return value is just here to be able to + write: + + assert(_PyObject_CheckConsistency(obj, 1)); */ +PyAPI_FUNC(int) _PyObject_CheckConsistency( + PyObject *op, + int check_content); + + +/* Trashcan mechanism, thanks to Christian Tismer. + +When deallocating a container object, it's possible to trigger an unbounded +chain of deallocations, as each Py_DECREF in turn drops the refcount on "the +next" object in the chain to 0. This can easily lead to stack overflows, +especially in threads (which typically have less stack space to work with). + +A container object can avoid this by bracketing the body of its tp_dealloc +function with a pair of macros: + +static void +mytype_dealloc(mytype *p) +{ + ... declarations go here ... + + PyObject_GC_UnTrack(p); // must untrack first + Py_TRASHCAN_BEGIN(p, mytype_dealloc) + ... The body of the deallocator goes here, including all calls ... + ... to Py_DECREF on contained objects. ... + Py_TRASHCAN_END // there should be no code after this +} + +CAUTION: Never return from the middle of the body! If the body needs to +"get out early", put a label immediately before the Py_TRASHCAN_END +call, and goto it. Else the call-depth counter (see below) will stay +above 0 forever, and the trashcan will never get emptied. + +How it works: The BEGIN macro increments a call-depth counter. So long +as this counter is small, the body of the deallocator is run directly without +further ado. But if the counter gets large, it instead adds p to a list of +objects to be deallocated later, skips the body of the deallocator, and +resumes execution after the END macro. The tp_dealloc routine then returns +without deallocating anything (and so unbounded call-stack depth is avoided). + +When the call stack finishes unwinding again, code generated by the END macro +notices this, and calls another routine to deallocate all the objects that +may have been added to the list of deferred deallocations. In effect, a +chain of N deallocations is broken into (N-1)/(_PyTrash_UNWIND_LEVEL-1) pieces, +with the call stack never exceeding a depth of _PyTrash_UNWIND_LEVEL. + +Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base +class, we need to ensure that the trashcan is only triggered on the tp_dealloc +of the actual class being deallocated. Otherwise we might end up with a +partially-deallocated object. To check this, the tp_dealloc function must be +passed as second argument to Py_TRASHCAN_BEGIN(). +*/ + +/* Python 3.9 private API, invoked by the macros below. */ +PyAPI_FUNC(int) _PyTrash_begin(PyThreadState *tstate, PyObject *op); +PyAPI_FUNC(void) _PyTrash_end(PyThreadState *tstate); +/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */ +PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc); + +#define Py_TRASHCAN_BEGIN_CONDITION(op, cond) \ + do { \ + PyThreadState *_tstate = NULL; \ + /* If "cond" is false, then _tstate remains NULL and the deallocator \ + * is run normally without involving the trashcan */ \ + if (cond) { \ + _tstate = PyThreadState_Get(); \ + if (_PyTrash_begin(_tstate, _PyObject_CAST(op))) { \ + break; \ + } \ + } + /* The body of the deallocator is here. */ +#define Py_TRASHCAN_END \ + if (_tstate) { \ + _PyTrash_end(_tstate); \ + } \ + } while (0); + +#define Py_TRASHCAN_BEGIN(op, dealloc) \ + Py_TRASHCAN_BEGIN_CONDITION(op, \ + _PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc)) + +/* The following two macros, Py_TRASHCAN_SAFE_BEGIN and + * Py_TRASHCAN_SAFE_END, are deprecated since version 3.11 and + * will be removed in the future. + * Use Py_TRASHCAN_BEGIN and Py_TRASHCAN_END instead. + */ +Py_DEPRECATED(3.11) typedef int UsingDeprecatedTrashcanMacro; +#define Py_TRASHCAN_SAFE_BEGIN(op) \ + do { \ + UsingDeprecatedTrashcanMacro cond=1; \ + Py_TRASHCAN_BEGIN_CONDITION(op, cond); +#define Py_TRASHCAN_SAFE_END(op) \ + Py_TRASHCAN_END; \ + } while(0); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/objimpl.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/objimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..d7c76eab5c7312e4126af6ef5e773dc7cdaaf887 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/objimpl.h @@ -0,0 +1,89 @@ +#ifndef Py_CPYTHON_OBJIMPL_H +# error "this header file must not be included directly" +#endif + +#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) + +/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a + vrbl-size object with nitems items, exclusive of gc overhead (if any). The + value is rounded up to the closest multiple of sizeof(void *), in order to + ensure that pointer fields at the end of the object are correctly aligned + for the platform (this is of special importance for subclasses of, e.g., + str or int, so that pointers can be stored after the embedded data). + + Note that there's no memory wastage in doing this, as malloc has to + return (at worst) pointer-aligned memory anyway. +*/ +#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 +# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" +#endif + +#define _PyObject_VAR_SIZE(typeobj, nitems) \ + _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \ + (nitems)*(typeobj)->tp_itemsize, \ + SIZEOF_VOID_P) + + +/* This example code implements an object constructor with a custom + allocator, where PyObject_New is inlined, and shows the important + distinction between two steps (at least): + 1) the actual allocation of the object storage; + 2) the initialization of the Python specific fields + in this storage with PyObject_{Init, InitVar}. + + PyObject * + YourObject_New(...) + { + PyObject *op; + + op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); + if (op == NULL) { + return PyErr_NoMemory(); + } + + PyObject_Init(op, &YourTypeStruct); + + op->ob_field = value; + ... + return op; + } + + Note that in C++, the use of the new operator usually implies that + the 1st step is performed automatically for you, so in a C++ class + constructor you would start directly with PyObject_Init/InitVar. */ + + +typedef struct { + /* user context passed as the first argument to the 2 functions */ + void *ctx; + + /* allocate an arena of size bytes */ + void* (*alloc) (void *ctx, size_t size); + + /* free an arena */ + void (*free) (void *ctx, void *ptr, size_t size); +} PyObjectArenaAllocator; + +/* Get the arena allocator. */ +PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator); + +/* Set the arena allocator. */ +PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator); + + +/* Test if an object implements the garbage collector protocol */ +PyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj); + + +/* Code built with Py_BUILD_CORE must include pycore_gc.h instead which + defines a different _PyGC_FINALIZED() macro. */ +#ifndef Py_BUILD_CORE + // Kept for backward compatibility with Python 3.8 +# define _PyGC_FINALIZED(o) PyObject_GC_IsFinalized(o) +#endif + + +// Test if a type supports weak references +PyAPI_FUNC(int) PyType_SUPPORTS_WEAKREFS(PyTypeObject *type); + +PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/odictobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/odictobject.h new file mode 100644 index 0000000000000000000000000000000000000000..e070413017d801c8c41d430cfb8431371987bf45 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/odictobject.h @@ -0,0 +1,43 @@ +#ifndef Py_ODICTOBJECT_H +#define Py_ODICTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* OrderedDict */ +/* This API is optional and mostly redundant. */ + +#ifndef Py_LIMITED_API + +typedef struct _odictobject PyODictObject; + +PyAPI_DATA(PyTypeObject) PyODict_Type; +PyAPI_DATA(PyTypeObject) PyODictIter_Type; +PyAPI_DATA(PyTypeObject) PyODictKeys_Type; +PyAPI_DATA(PyTypeObject) PyODictItems_Type; +PyAPI_DATA(PyTypeObject) PyODictValues_Type; + +#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) +#define PyODict_CheckExact(op) Py_IS_TYPE(op, &PyODict_Type) +#define PyODict_SIZE(op) PyDict_GET_SIZE((op)) + +PyAPI_FUNC(PyObject *) PyODict_New(void); +PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); +PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); + +/* wrappers around PyDict* functions */ +#define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key) +#define PyODict_GetItemWithError(od, key) \ + PyDict_GetItemWithError(_PyObject_CAST(od), key) +#define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key) +#define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od)) +#define PyODict_GetItemString(od, key) \ + PyDict_GetItemString(_PyObject_CAST(od), key) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ODICTOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/picklebufobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/picklebufobject.h new file mode 100644 index 0000000000000000000000000000000000000000..0df2561dceaea04a9942b2aae18762dfc2fe806d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/picklebufobject.h @@ -0,0 +1,31 @@ +/* PickleBuffer object. This is built-in for ease of use from third-party + * C extensions. + */ + +#ifndef Py_PICKLEBUFOBJECT_H +#define Py_PICKLEBUFOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_LIMITED_API + +PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type; + +#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type) + +/* Create a PickleBuffer redirecting to the given buffer-enabled object */ +PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *); +/* Get the PickleBuffer's underlying view to the original object + * (NULL if released) + */ +PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *); +/* Release the PickleBuffer. Returns 0 on success, -1 on error. */ +PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *); + +#endif /* !Py_LIMITED_API */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PICKLEBUFOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pthread_stubs.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pthread_stubs.h new file mode 100644 index 0000000000000000000000000000000000000000..d95ee03d8308ce47a63c8f424bd71b0316b7f889 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pthread_stubs.h @@ -0,0 +1,88 @@ +#ifndef Py_CPYTHON_PTRHEAD_STUBS_H +#define Py_CPYTHON_PTRHEAD_STUBS_H + +#if !defined(HAVE_PTHREAD_STUBS) +# error "this header file requires stubbed pthreads." +#endif + +#ifndef _POSIX_THREADS +# define _POSIX_THREADS 1 +#endif + +/* Minimal pthread stubs for CPython. + * + * The stubs implement the minimum pthread API for CPython. + * - pthread_create() fails. + * - pthread_exit() calls exit(0). + * - pthread_key_*() functions implement minimal TSS without destructor. + * - all other functions do nothing and return 0. + */ + +#ifdef __wasi__ +// WASI's bits/alltypes.h provides type definitions when __NEED_ is set. +// The header file can be included multiple times. +# define __NEED_pthread_cond_t 1 +# define __NEED_pthread_condattr_t 1 +# define __NEED_pthread_mutex_t 1 +# define __NEED_pthread_mutexattr_t 1 +# define __NEED_pthread_key_t 1 +# define __NEED_pthread_t 1 +# define __NEED_pthread_attr_t 1 +# include +#else +typedef struct { void *__x; } pthread_cond_t; +typedef struct { unsigned __attr; } pthread_condattr_t; +typedef struct { void *__x; } pthread_mutex_t; +typedef struct { unsigned __attr; } pthread_mutexattr_t; +typedef unsigned pthread_key_t; +typedef unsigned pthread_t; +typedef struct { unsigned __attr; } pthread_attr_t; +#endif + +// mutex +PyAPI_FUNC(int) pthread_mutex_init(pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr); +PyAPI_FUNC(int) pthread_mutex_destroy(pthread_mutex_t *mutex); +PyAPI_FUNC(int) pthread_mutex_trylock(pthread_mutex_t *mutex); +PyAPI_FUNC(int) pthread_mutex_lock(pthread_mutex_t *mutex); +PyAPI_FUNC(int) pthread_mutex_unlock(pthread_mutex_t *mutex); + +// condition +PyAPI_FUNC(int) pthread_cond_init(pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr); +PyAPI_FUNC(int) pthread_cond_destroy(pthread_cond_t *cond); +PyAPI_FUNC(int) pthread_cond_wait(pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex); +PyAPI_FUNC(int) pthread_cond_timedwait(pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime); +PyAPI_FUNC(int) pthread_cond_signal(pthread_cond_t *cond); +PyAPI_FUNC(int) pthread_condattr_init(pthread_condattr_t *attr); +PyAPI_FUNC(int) pthread_condattr_setclock( + pthread_condattr_t *attr, clockid_t clock_id); + +// pthread +PyAPI_FUNC(int) pthread_create(pthread_t *restrict thread, + const pthread_attr_t *restrict attr, + void *(*start_routine)(void *), + void *restrict arg); +PyAPI_FUNC(int) pthread_detach(pthread_t thread); +PyAPI_FUNC(pthread_t) pthread_self(void); +PyAPI_FUNC(int) pthread_exit(void *retval) __attribute__ ((__noreturn__)); +PyAPI_FUNC(int) pthread_attr_init(pthread_attr_t *attr); +PyAPI_FUNC(int) pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); +PyAPI_FUNC(int) pthread_attr_destroy(pthread_attr_t *attr); + + +// pthread_key +#ifndef PTHREAD_KEYS_MAX +# define PTHREAD_KEYS_MAX 128 +#endif + +PyAPI_FUNC(int) pthread_key_create(pthread_key_t *key, + void (*destr_function)(void *)); +PyAPI_FUNC(int) pthread_key_delete(pthread_key_t key); +PyAPI_FUNC(void *) pthread_getspecific(pthread_key_t key); +PyAPI_FUNC(int) pthread_setspecific(pthread_key_t key, const void *value); + +#endif // Py_CPYTHON_PTRHEAD_STUBS_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyctype.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyctype.h new file mode 100644 index 0000000000000000000000000000000000000000..729d93275e6c5365fb26fd521b1ff58de22b5fdb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyctype.h @@ -0,0 +1,39 @@ +#ifndef Py_LIMITED_API +#ifndef PYCTYPE_H +#define PYCTYPE_H +#ifdef __cplusplus +extern "C" { +#endif + +#define PY_CTF_LOWER 0x01 +#define PY_CTF_UPPER 0x02 +#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) +#define PY_CTF_DIGIT 0x04 +#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) +#define PY_CTF_SPACE 0x08 +#define PY_CTF_XDIGIT 0x10 + +PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; + +/* Unlike their C counterparts, the following macros are not meant to + * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument + * must be a signed/unsigned char. */ +#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) +#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) +#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) +#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) +#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) +#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) +#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) + +PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; +PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; + +#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) +#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) + +#ifdef __cplusplus +} +#endif +#endif /* !PYCTYPE_H */ +#endif /* !Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pydebug.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pydebug.h new file mode 100644 index 0000000000000000000000000000000000000000..cab799f0b38e0c42f2fb2896c02b05d866b2d50a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pydebug.h @@ -0,0 +1,38 @@ +#ifndef Py_LIMITED_API +#ifndef Py_PYDEBUG_H +#define Py_PYDEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(int) Py_DebugFlag; +PyAPI_DATA(int) Py_VerboseFlag; +PyAPI_DATA(int) Py_QuietFlag; +PyAPI_DATA(int) Py_InteractiveFlag; +PyAPI_DATA(int) Py_InspectFlag; +PyAPI_DATA(int) Py_OptimizeFlag; +PyAPI_DATA(int) Py_NoSiteFlag; +PyAPI_DATA(int) Py_BytesWarningFlag; +PyAPI_DATA(int) Py_FrozenFlag; +PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; +PyAPI_DATA(int) Py_DontWriteBytecodeFlag; +PyAPI_DATA(int) Py_NoUserSiteDirectory; +PyAPI_DATA(int) Py_UnbufferedStdioFlag; +PyAPI_DATA(int) Py_HashRandomizationFlag; +PyAPI_DATA(int) Py_IsolatedFlag; + +#ifdef MS_WINDOWS +PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag; +PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; +#endif + +/* this is a wrapper around getenv() that pays attention to + Py_IgnoreEnvironmentFlag. It should be used for getting variables like + PYTHONPATH and PYTHONHOME from the environment */ +PyAPI_DATA(char*) Py_GETENV(const char *name); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYDEBUG_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyerrors.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyerrors.h new file mode 100644 index 0000000000000000000000000000000000000000..47d80e3242302d4b55e7d0673c07ba09efd8d836 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyerrors.h @@ -0,0 +1,179 @@ +#ifndef Py_CPYTHON_ERRORS_H +# error "this header file must not be included directly" +#endif + +/* Error objects */ + +/* PyException_HEAD defines the initial segment of every exception class. */ +#define PyException_HEAD PyObject_HEAD PyObject *dict;\ + PyObject *args; PyObject *notes; PyObject *traceback;\ + PyObject *context; PyObject *cause;\ + char suppress_context; + +typedef struct { + PyException_HEAD +} PyBaseExceptionObject; + +typedef struct { + PyException_HEAD + PyObject *msg; + PyObject *excs; +} PyBaseExceptionGroupObject; + +typedef struct { + PyException_HEAD + PyObject *msg; + PyObject *filename; + PyObject *lineno; + PyObject *offset; + PyObject *end_lineno; + PyObject *end_offset; + PyObject *text; + PyObject *print_file_and_line; +} PySyntaxErrorObject; + +typedef struct { + PyException_HEAD + PyObject *msg; + PyObject *name; + PyObject *path; +} PyImportErrorObject; + +typedef struct { + PyException_HEAD + PyObject *encoding; + PyObject *object; + Py_ssize_t start; + Py_ssize_t end; + PyObject *reason; +} PyUnicodeErrorObject; + +typedef struct { + PyException_HEAD + PyObject *code; +} PySystemExitObject; + +typedef struct { + PyException_HEAD + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; + PyObject *filename2; +#ifdef MS_WINDOWS + PyObject *winerror; +#endif + Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ +} PyOSErrorObject; + +typedef struct { + PyException_HEAD + PyObject *value; +} PyStopIterationObject; + +typedef struct { + PyException_HEAD + PyObject *name; +} PyNameErrorObject; + +typedef struct { + PyException_HEAD + PyObject *obj; + PyObject *name; +} PyAttributeErrorObject; + +/* Compatibility typedefs */ +typedef PyOSErrorObject PyEnvironmentErrorObject; +#ifdef MS_WINDOWS +typedef PyOSErrorObject PyWindowsErrorObject; +#endif + +/* Error handling definitions */ + +PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *); +PyAPI_FUNC(_PyErr_StackItem*) _PyErr_GetTopmostException(PyThreadState *tstate); +PyAPI_FUNC(PyObject*) _PyErr_GetHandledException(PyThreadState *); +PyAPI_FUNC(void) _PyErr_SetHandledException(PyThreadState *, PyObject *); +PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **); + +/* Context manipulation (PEP 3134) */ + +PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); + +/* Like PyErr_Format(), but saves current exception as __context__ and + __cause__. + */ +PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause( + PyObject *exception, + const char *format, /* ASCII-encoded string */ + ... + ); + +/* In exceptions.c */ + +/* Helper that attempts to replace the current exception with one of the + * same type but with a prefix added to the exception text. The resulting + * exception description looks like: + * + * prefix (exc_type: original_exc_str) + * + * Only some exceptions can be safely replaced. If the function determines + * it isn't safe to perform the replacement, it will leave the original + * unmodified exception in place. + * + * Returns a borrowed reference to the new exception (if any), NULL if the + * existing exception was left in place. + */ +PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause( + const char *prefix_format, /* ASCII-encoded string */ + ... + ); + +/* In signalmodule.c */ + +int PySignal_SetWakeupFd(int fd); +PyAPI_FUNC(int) _PyErr_CheckSignals(void); + +/* Support for adding program text to SyntaxErrors */ + +PyAPI_FUNC(void) PyErr_SyntaxLocationObject( + PyObject *filename, + int lineno, + int col_offset); + +PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject( + PyObject *filename, + int lineno, + int col_offset, + int end_lineno, + int end_col_offset); + +PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( + PyObject *filename, + int lineno); + +PyAPI_FUNC(PyObject *) _PyErr_ProgramDecodedTextObject( + PyObject *filename, + int lineno, + const char* encoding); + +PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create( + PyObject *object, + Py_ssize_t start, + Py_ssize_t end, + const char *reason /* UTF-8 encoded string */ + ); + +PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg( + const char *err_msg, + PyObject *obj); + +PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc( + const char *func, + const char *message); + +PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat( + const char *func, + const char *format, + ...); + +#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message) diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyfpe.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyfpe.h new file mode 100644 index 0000000000000000000000000000000000000000..cc2def63aa5527f4ac192aa663a14353a88e1774 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyfpe.h @@ -0,0 +1,15 @@ +#ifndef Py_PYFPE_H +#define Py_PYFPE_H +/* Header excluded from the stable API */ +#ifndef Py_LIMITED_API + +/* These macros used to do something when Python was built with --with-fpectl, + * but support for that was dropped in 3.7. We continue to define them though, + * to avoid breaking API users. + */ + +#define PyFPE_START_PROTECT(err_string, leave_stmt) +#define PyFPE_END_PROTECT(v) + +#endif /* !defined(Py_LIMITED_API) */ +#endif /* !Py_PYFPE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyframe.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyframe.h new file mode 100644 index 0000000000000000000000000000000000000000..1dc634ccee9a27afd1bd038370f50c867f8fef81 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pyframe.h @@ -0,0 +1,17 @@ +#ifndef Py_CPYTHON_PYFRAME_H +# error "this header file must not be included directly" +#endif + +PyAPI_DATA(PyTypeObject) PyFrame_Type; + +#define PyFrame_Check(op) Py_IS_TYPE((op), &PyFrame_Type) + +PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame); +PyAPI_FUNC(PyObject *) PyFrame_GetLocals(PyFrameObject *frame); + +PyAPI_FUNC(PyObject *) PyFrame_GetGlobals(PyFrameObject *frame); +PyAPI_FUNC(PyObject *) PyFrame_GetBuiltins(PyFrameObject *frame); + +PyAPI_FUNC(PyObject *) PyFrame_GetGenerator(PyFrameObject *frame); +PyAPI_FUNC(int) PyFrame_GetLasti(PyFrameObject *frame); + diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pylifecycle.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pylifecycle.h new file mode 100644 index 0000000000000000000000000000000000000000..bb5b07ef5901c82c2df0e5c965166b6fe56609b1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pylifecycle.h @@ -0,0 +1,65 @@ +#ifndef Py_CPYTHON_PYLIFECYCLE_H +# error "this header file must not be included directly" +#endif + +/* Py_FrozenMain is kept out of the Limited API until documented and present + in all builds of Python */ +PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv); + +/* Only used by applications that embed the interpreter and need to + * override the standard encoding determination mechanism + */ +Py_DEPRECATED(3.11) PyAPI_FUNC(int) Py_SetStandardStreamEncoding( + const char *encoding, + const char *errors); + +/* PEP 432 Multi-phase initialization API (Private while provisional!) */ + +PyAPI_FUNC(PyStatus) Py_PreInitialize( + const PyPreConfig *src_config); +PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs( + const PyPreConfig *src_config, + Py_ssize_t argc, + char **argv); +PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs( + const PyPreConfig *src_config, + Py_ssize_t argc, + wchar_t **argv); + +PyAPI_FUNC(int) _Py_IsCoreInitialized(void); + + +/* Initialization and finalization */ + +PyAPI_FUNC(PyStatus) Py_InitializeFromConfig( + const PyConfig *config); +PyAPI_FUNC(PyStatus) _Py_InitializeMain(void); + +PyAPI_FUNC(int) Py_RunMain(void); + + +PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err); + +/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ +PyAPI_FUNC(void) _Py_RestoreSignals(void); + +PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); +PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename); + +Py_DEPRECATED(3.11) PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *); + +PyAPI_FUNC(const char *) _Py_gitidentifier(void); +PyAPI_FUNC(const char *) _Py_gitversion(void); + +PyAPI_FUNC(int) _Py_IsFinalizing(void); + +/* Random */ +PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size); +PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size); + +/* Legacy locale support */ +PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn); +PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn); +PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category); + +PyAPI_FUNC(PyThreadState *) _Py_NewInterpreter(int isolated_subinterpreter); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pymem.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pymem.h new file mode 100644 index 0000000000000000000000000000000000000000..d1054d76520b9aab0f9c312340cf7dd2d5bed9be --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pymem.h @@ -0,0 +1,98 @@ +#ifndef Py_CPYTHON_PYMEM_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size); +PyAPI_FUNC(void *) PyMem_RawCalloc(size_t nelem, size_t elsize); +PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size); +PyAPI_FUNC(void) PyMem_RawFree(void *ptr); + +/* Try to get the allocators name set by _PyMem_SetupAllocators(). */ +PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void); + +/* strdup() using PyMem_RawMalloc() */ +PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str); + +/* strdup() using PyMem_Malloc() */ +PyAPI_FUNC(char *) _PyMem_Strdup(const char *str); + +/* wcsdup() using PyMem_RawMalloc() */ +PyAPI_FUNC(wchar_t*) _PyMem_RawWcsdup(const wchar_t *str); + + +typedef enum { + /* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */ + PYMEM_DOMAIN_RAW, + + /* PyMem_Malloc(), PyMem_Realloc() and PyMem_Free() */ + PYMEM_DOMAIN_MEM, + + /* PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() */ + PYMEM_DOMAIN_OBJ +} PyMemAllocatorDomain; + +typedef enum { + PYMEM_ALLOCATOR_NOT_SET = 0, + PYMEM_ALLOCATOR_DEFAULT = 1, + PYMEM_ALLOCATOR_DEBUG = 2, + PYMEM_ALLOCATOR_MALLOC = 3, + PYMEM_ALLOCATOR_MALLOC_DEBUG = 4, +#ifdef WITH_PYMALLOC + PYMEM_ALLOCATOR_PYMALLOC = 5, + PYMEM_ALLOCATOR_PYMALLOC_DEBUG = 6, +#endif +} PyMemAllocatorName; + + +typedef struct { + /* user context passed as the first argument to the 4 functions */ + void *ctx; + + /* allocate a memory block */ + void* (*malloc) (void *ctx, size_t size); + + /* allocate a memory block initialized by zeros */ + void* (*calloc) (void *ctx, size_t nelem, size_t elsize); + + /* allocate or resize a memory block */ + void* (*realloc) (void *ctx, void *ptr, size_t new_size); + + /* release a memory block */ + void (*free) (void *ctx, void *ptr); +} PyMemAllocatorEx; + +/* Get the memory block allocator of the specified domain. */ +PyAPI_FUNC(void) PyMem_GetAllocator(PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator); + +/* Set the memory block allocator of the specified domain. + + The new allocator must return a distinct non-NULL pointer when requesting + zero bytes. + + For the PYMEM_DOMAIN_RAW domain, the allocator must be thread-safe: the GIL + is not held when the allocator is called. + + If the new allocator is not a hook (don't call the previous allocator), the + PyMem_SetupDebugHooks() function must be called to reinstall the debug hooks + on top on the new allocator. */ +PyAPI_FUNC(void) PyMem_SetAllocator(PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator); + +/* Setup hooks to detect bugs in the following Python memory allocator + functions: + + - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree() + - PyMem_Malloc(), PyMem_Realloc(), PyMem_Free() + - PyObject_Malloc(), PyObject_Realloc() and PyObject_Free() + + Newly allocated memory is filled with the byte 0xCB, freed memory is filled + with the byte 0xDB. Additional checks: + + - detect API violations, ex: PyObject_Free() called on a buffer allocated + by PyMem_Malloc() + - detect write before the start of the buffer (buffer underflow) + - detect write after the end of the buffer (buffer overflow) + + The function does nothing if Python is not compiled is debug mode. */ +PyAPI_FUNC(void) PyMem_SetupDebugHooks(void); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pystate.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pystate.h new file mode 100644 index 0000000000000000000000000000000000000000..2bd46067cbbe18717f01d2a9f5f87d631dc32f5d --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pystate.h @@ -0,0 +1,366 @@ +#ifndef Py_CPYTHON_PYSTATE_H +# error "this header file must not be included directly" +#endif + + +PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *); +PyAPI_FUNC(void) _PyInterpreterState_RequireIDRef(PyInterpreterState *, int); + +PyAPI_FUNC(PyObject *) _PyInterpreterState_GetMainModule(PyInterpreterState *); + +/* State unique per thread */ + +/* Py_tracefunc return -1 when raising an exception, or 0 for success. */ +typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *); + +/* The following values are used for 'what' for tracefunc functions + * + * To add a new kind of trace event, also update "trace_init" in + * Python/sysmodule.c to define the Python level event name + */ +#define PyTrace_CALL 0 +#define PyTrace_EXCEPTION 1 +#define PyTrace_LINE 2 +#define PyTrace_RETURN 3 +#define PyTrace_C_CALL 4 +#define PyTrace_C_EXCEPTION 5 +#define PyTrace_C_RETURN 6 +#define PyTrace_OPCODE 7 + + +typedef struct { + PyCodeObject *code; // The code object for the bounds. May be NULL. + PyCodeAddressRange bounds; // Only valid if code != NULL. +} PyTraceInfo; + +// Internal structure: you should not use it directly, but use public functions +// like PyThreadState_EnterTracing() and PyThreadState_LeaveTracing(). +typedef struct _PyCFrame { + /* This struct will be threaded through the C stack + * allowing fast access to per-thread state that needs + * to be accessed quickly by the interpreter, but can + * be modified outside of the interpreter. + * + * WARNING: This makes data on the C stack accessible from + * heap objects. Care must be taken to maintain stack + * discipline and make sure that instances of this struct cannot + * accessed outside of their lifetime. + */ + uint8_t use_tracing; // 0 or 255 (or'ed into opcode, hence 8-bit type) + /* Pointer to the currently executing frame (it can be NULL) */ + struct _PyInterpreterFrame *current_frame; + struct _PyCFrame *previous; +} _PyCFrame; + +typedef struct _err_stackitem { + /* This struct represents a single execution context where we might + * be currently handling an exception. It is a per-coroutine state + * (coroutine in the computer science sense, including the thread + * and generators). + * + * This is used as an entry on the exception stack, where each + * entry indicates if it is currently handling an exception. + * This ensures that the exception state is not impacted + * by "yields" from an except handler. The thread + * always has an entry (the bottom-most one). + */ + + /* The exception currently being handled in this context, if any. */ + PyObject *exc_value; + + struct _err_stackitem *previous_item; + +} _PyErr_StackItem; + +typedef struct _stack_chunk { + struct _stack_chunk *previous; + size_t size; + size_t top; + PyObject * data[1]; /* Variable sized */ +} _PyStackChunk; + +struct _ts { + /* See Python/ceval.c for comments explaining most fields */ + + PyThreadState *prev; + PyThreadState *next; + PyInterpreterState *interp; + + /* Has been initialized to a safe state. + + In order to be effective, this must be set to 0 during or right + after allocation. */ + int _initialized; + + /* Was this thread state statically allocated? */ + int _static; + + int recursion_remaining; + int recursion_limit; + int recursion_headroom; /* Allow 50 more calls to handle any errors. */ + + /* 'tracing' keeps track of the execution depth when tracing/profiling. + This is to prevent the actual trace/profile code from being recorded in + the trace/profile. */ + int tracing; + int tracing_what; /* The event currently being traced, if any. */ + + /* Pointer to current _PyCFrame in the C stack frame of the currently, + * or most recently, executing _PyEval_EvalFrameDefault. */ + _PyCFrame *cframe; + + Py_tracefunc c_profilefunc; + Py_tracefunc c_tracefunc; + PyObject *c_profileobj; + PyObject *c_traceobj; + + /* The exception currently being raised */ + PyObject *curexc_type; + PyObject *curexc_value; + PyObject *curexc_traceback; + + /* Pointer to the top of the exception stack for the exceptions + * we may be currently handling. (See _PyErr_StackItem above.) + * This is never NULL. */ + _PyErr_StackItem *exc_info; + + PyObject *dict; /* Stores per-thread state */ + + int gilstate_counter; + + PyObject *async_exc; /* Asynchronous exception to raise */ + unsigned long thread_id; /* Thread id where this tstate was created */ + + /* Native thread id where this tstate was created. This will be 0 except on + * those platforms that have the notion of native thread id, for which the + * macro PY_HAVE_THREAD_NATIVE_ID is then defined. + */ + unsigned long native_thread_id; + + int trash_delete_nesting; + PyObject *trash_delete_later; + + /* Called when a thread state is deleted normally, but not when it + * is destroyed after fork(). + * Pain: to prevent rare but fatal shutdown errors (issue 18808), + * Thread.join() must wait for the join'ed thread's tstate to be unlinked + * from the tstate chain. That happens at the end of a thread's life, + * in pystate.c. + * The obvious way doesn't quite work: create a lock which the tstate + * unlinking code releases, and have Thread.join() wait to acquire that + * lock. The problem is that we _are_ at the end of the thread's life: + * if the thread holds the last reference to the lock, decref'ing the + * lock will delete the lock, and that may trigger arbitrary Python code + * if there's a weakref, with a callback, to the lock. But by this time + * _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest + * of C code can be allowed to run (in particular it must not be possible to + * release the GIL). + * So instead of holding the lock directly, the tstate holds a weakref to + * the lock: that's the value of on_delete_data below. Decref'ing a + * weakref is harmless. + * on_delete points to _threadmodule.c's static release_sentinel() function. + * After the tstate is unlinked, release_sentinel is called with the + * weakref-to-lock (on_delete_data) argument, and release_sentinel releases + * the indirectly held lock. + */ + void (*on_delete)(void *); + void *on_delete_data; + + int coroutine_origin_tracking_depth; + + PyObject *async_gen_firstiter; + PyObject *async_gen_finalizer; + + PyObject *context; + uint64_t context_ver; + + /* Unique thread state id. */ + uint64_t id; + + PyTraceInfo trace_info; + + _PyStackChunk *datastack_chunk; + PyObject **datastack_top; + PyObject **datastack_limit; + /* XXX signal handlers should also be here */ + + /* The following fields are here to avoid allocation during init. + The data is exposed through PyThreadState pointer fields. + These fields should not be accessed directly outside of init. + This is indicated by an underscore prefix on the field names. + + All other PyInterpreterState pointer fields are populated when + needed and default to NULL. + */ + // Note some fields do not have a leading underscore for backward + // compatibility. See https://bugs.python.org/issue45953#msg412046. + + /* The thread's exception stack entry. (Always the last entry.) */ + _PyErr_StackItem exc_state; + + /* The bottom-most frame on the stack. */ + _PyCFrame root_cframe; +}; + + +/* other API */ + +// Alias for backward compatibility with Python 3.8 +#define _PyInterpreterState_Get PyInterpreterState_Get + +PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); + +/* Similar to PyThreadState_Get(), but don't issue a fatal error + * if it is NULL. */ +PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void); + +PyAPI_FUNC(PyObject *) _PyThreadState_GetDict(PyThreadState *tstate); + +// Disable tracing and profiling. +PyAPI_FUNC(void) PyThreadState_EnterTracing(PyThreadState *tstate); + +// Reset tracing and profiling: enable them if a trace function or a profile +// function is set, otherwise disable them. +PyAPI_FUNC(void) PyThreadState_LeaveTracing(PyThreadState *tstate); + +/* PyGILState */ + +/* Helper/diagnostic function - return 1 if the current thread + currently holds the GIL, 0 otherwise. + + The function returns 1 if _PyGILState_check_enabled is non-zero. */ +PyAPI_FUNC(int) PyGILState_Check(void); + +/* Get the single PyInterpreterState used by this process' GILState + implementation. + + This function doesn't check for error. Return NULL before _PyGILState_Init() + is called and after _PyGILState_Fini() is called. + + See also _PyInterpreterState_Get() and _PyInterpreterState_GET(). */ +PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); + +/* The implementation of sys._current_frames() Returns a dict mapping + thread id to that thread's current frame. +*/ +PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); + +/* The implementation of sys._current_exceptions() Returns a dict mapping + thread id to that thread's current exception. +*/ +PyAPI_FUNC(PyObject *) _PyThread_CurrentExceptions(void); + +/* Routines for advanced debuggers, requested by David Beazley. + Don't use unless you know what you are doing! */ +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); + +/* Frame evaluation API */ + +typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int); + +PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc( + PyInterpreterState *interp); +PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc( + PyInterpreterState *interp, + _PyFrameEvalFunction eval_frame); + +PyAPI_FUNC(const PyConfig*) _PyInterpreterState_GetConfig(PyInterpreterState *interp); + +/* Get a copy of the current interpreter configuration. + + Return 0 on success. Raise an exception and return -1 on error. + + The caller must initialize 'config', using PyConfig_InitPythonConfig() + for example. + + Python must be preinitialized to call this method. + The caller must hold the GIL. */ +PyAPI_FUNC(int) _PyInterpreterState_GetConfigCopy( + struct PyConfig *config); + +/* Set the configuration of the current interpreter. + + This function should be called during or just after the Python + initialization. + + Update the sys module with the new configuration. If the sys module was + modified directly after the Python initialization, these changes are lost. + + Some configuration like faulthandler or warnoptions can be updated in the + configuration, but don't reconfigure Python (don't enable/disable + faulthandler and don't reconfigure warnings filters). + + Return 0 on success. Raise an exception and return -1 on error. + + The configuration should come from _PyInterpreterState_GetConfigCopy(). */ +PyAPI_FUNC(int) _PyInterpreterState_SetConfig( + const struct PyConfig *config); + +// Get the configuration of the current interpreter. +// The caller must hold the GIL. +PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void); + + +/* cross-interpreter data */ + +// _PyCrossInterpreterData is similar to Py_buffer as an effectively +// opaque struct that holds data outside the object machinery. This +// is necessary to pass safely between interpreters in the same process. +typedef struct _xid _PyCrossInterpreterData; + +struct _xid { + // data is the cross-interpreter-safe derivation of a Python object + // (see _PyObject_GetCrossInterpreterData). It will be NULL if the + // new_object func (below) encodes the data. + void *data; + // obj is the Python object from which the data was derived. This + // is non-NULL only if the data remains bound to the object in some + // way, such that the object must be "released" (via a decref) when + // the data is released. In that case the code that sets the field, + // likely a registered "crossinterpdatafunc", is responsible for + // ensuring it owns the reference (i.e. incref). + PyObject *obj; + // interp is the ID of the owning interpreter of the original + // object. It corresponds to the active interpreter when + // _PyObject_GetCrossInterpreterData() was called. This should only + // be set by the cross-interpreter machinery. + // + // We use the ID rather than the PyInterpreterState to avoid issues + // with deleted interpreters. Note that IDs are never re-used, so + // each one will always correspond to a specific interpreter + // (whether still alive or not). + int64_t interp; + // new_object is a function that returns a new object in the current + // interpreter given the data. The resulting object (a new + // reference) will be equivalent to the original object. This field + // is required. + PyObject *(*new_object)(_PyCrossInterpreterData *); + // free is called when the data is released. If it is NULL then + // nothing will be done to free the data. For some types this is + // okay (e.g. bytes) and for those types this field should be set + // to NULL. However, for most the data was allocated just for + // cross-interpreter use, so it must be freed when + // _PyCrossInterpreterData_Release is called or the memory will + // leak. In that case, at the very least this field should be set + // to PyMem_RawFree (the default if not explicitly set to NULL). + // The call will happen with the original interpreter activated. + void (*free)(void *); +}; + +PyAPI_FUNC(int) _PyObject_GetCrossInterpreterData(PyObject *, _PyCrossInterpreterData *); +PyAPI_FUNC(PyObject *) _PyCrossInterpreterData_NewObject(_PyCrossInterpreterData *); +PyAPI_FUNC(void) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *); + +PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *); + +/* cross-interpreter data registry */ + +typedef int (*crossinterpdatafunc)(PyObject *, _PyCrossInterpreterData *); + +PyAPI_FUNC(int) _PyCrossInterpreterData_RegisterClass(PyTypeObject *, crossinterpdatafunc); +PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythonrun.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythonrun.h new file mode 100644 index 0000000000000000000000000000000000000000..2e72d0820d34f549f89ab0116e53c30cf8cc5635 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythonrun.h @@ -0,0 +1,121 @@ +#ifndef Py_CPYTHON_PYTHONRUN_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); +PyAPI_FUNC(int) _PyRun_SimpleFileObject( + FILE *fp, + PyObject *filename, + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_AnyFileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) _PyRun_AnyFileObject( + FILE *fp, + PyObject *filename, + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_SimpleFileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int closeit, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveOneFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveOneObject( + FILE *fp, + PyObject *filename, + PyCompilerFlags *flags); +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + PyCompilerFlags *flags); +PyAPI_FUNC(int) _PyRun_InteractiveLoopObject( + FILE *fp, + PyObject *filename, + PyCompilerFlags *flags); + + +PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, + PyObject *, PyCompilerFlags *); + +PyAPI_FUNC(PyObject *) PyRun_FileExFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + int start, + PyObject *globals, + PyObject *locals, + int closeit, + PyCompilerFlags *flags); + + +PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( + const char *str, + const char *filename, /* decoded from the filesystem encoding */ + int start, + PyCompilerFlags *flags, + int optimize); +PyAPI_FUNC(PyObject *) Py_CompileStringObject( + const char *str, + PyObject *filename, int start, + PyCompilerFlags *flags, + int optimize); + +#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) +#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) + + +PyAPI_FUNC(const char *) _Py_SourceAsString( + PyObject *cmd, + const char *funcname, + const char *what, + PyCompilerFlags *cf, + PyObject **cmd_copy); + + +/* A function flavor is also exported by libpython. It is required when + libpython is accessed directly rather than using header files which defines + macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to + export functions in pythonXX.dll. */ +PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); +PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleString(const char *s); +PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c); +PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p); +PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p); +PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l); +PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c); +PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags); + +/* Use macros for a bunch of old variants */ +#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) +#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) +#define PyRun_AnyFileEx(fp, name, closeit) \ + PyRun_AnyFileExFlags(fp, name, closeit, NULL) +#define PyRun_AnyFileFlags(fp, name, flags) \ + PyRun_AnyFileExFlags(fp, name, 0, flags) +#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) +#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) +#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) +#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) +#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) +#define PyRun_File(fp, p, s, g, l) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) +#define PyRun_FileEx(fp, p, s, g, l, c) \ + PyRun_FileExFlags(fp, p, s, g, l, c, NULL) +#define PyRun_FileFlags(fp, p, s, g, l, flags) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, flags) + + +/* Stuff with no proper home (yet) */ +PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); +PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; +PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythread.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythread.h new file mode 100644 index 0000000000000000000000000000000000000000..ce4ec8f65b15ea016a86c6e2452560e3b6ecb47b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pythread.h @@ -0,0 +1,42 @@ +#ifndef Py_CPYTHON_PYTHREAD_H +# error "this header file must not be included directly" +#endif + +#define PYTHREAD_INVALID_THREAD_ID ((unsigned long)-1) + +#ifdef HAVE_FORK +/* Private function to reinitialize a lock at fork in the child process. + Reset the lock to the unlocked state. + Return 0 on success, return -1 on error. */ +PyAPI_FUNC(int) _PyThread_at_fork_reinit(PyThread_type_lock *lock); +#endif /* HAVE_FORK */ + +#ifdef HAVE_PTHREAD_H + /* Darwin needs pthread.h to know type name the pthread_key_t. */ +# include +# define NATIVE_TSS_KEY_T pthread_key_t +#elif defined(NT_THREADS) + /* In Windows, native TSS key type is DWORD, + but hardcode the unsigned long to avoid errors for include directive. + */ +# define NATIVE_TSS_KEY_T unsigned long +#elif defined(HAVE_PTHREAD_STUBS) +# include "cpython/pthread_stubs.h" +# define NATIVE_TSS_KEY_T pthread_key_t +#else +# error "Require native threads. See https://bugs.python.org/issue31370" +#endif + +/* When Py_LIMITED_API is not defined, the type layout of Py_tss_t is + exposed to allow static allocation in the API clients. Even in this case, + you must handle TSS keys through API functions due to compatibility. +*/ +struct _Py_tss_t { + int _is_initialized; + NATIVE_TSS_KEY_T _key; +}; + +#undef NATIVE_TSS_KEY_T + +/* When static allocation, you must initialize with Py_tss_NEEDS_INIT. */ +#define Py_tss_NEEDS_INIT {0} diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/pytime.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pytime.h new file mode 100644 index 0000000000000000000000000000000000000000..23d4f16a8fd8472018590277ca920742afa9393c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/pytime.h @@ -0,0 +1,323 @@ +// The _PyTime_t API is written to use timestamp and timeout values stored in +// various formats and to read clocks. +// +// The _PyTime_t type is an integer to support directly common arithmetic +// operations like t1 + t2. +// +// The _PyTime_t API supports a resolution of 1 nanosecond. The _PyTime_t type +// is signed to support negative timestamps. The supported range is around +// [-292.3 years; +292.3 years]. Using the Unix epoch (January 1st, 1970), the +// supported date range is around [1677-09-21; 2262-04-11]. +// +// Formats: +// +// * seconds +// * seconds as a floating pointer number (C double) +// * milliseconds (10^-3 seconds) +// * microseconds (10^-6 seconds) +// * 100 nanoseconds (10^-7 seconds) +// * nanoseconds (10^-9 seconds) +// * timeval structure, 1 microsecond resolution (10^-6 seconds) +// * timespec structure, 1 nanosecond resolution (10^-9 seconds) +// +// Integer overflows are detected and raise OverflowError. Conversion to a +// resolution worse than 1 nanosecond is rounded correctly with the requested +// rounding mode. There are 4 rounding modes: floor (towards -inf), ceiling +// (towards +inf), half even and up (away from zero). +// +// Some functions clamp the result in the range [_PyTime_MIN; _PyTime_MAX], so +// the caller doesn't have to handle errors and doesn't need to hold the GIL. +// For example, _PyTime_Add(t1, t2) computes t1+t2 and clamp the result on +// overflow. +// +// Clocks: +// +// * System clock +// * Monotonic clock +// * Performance counter +// +// Operations like (t * k / q) with integers are implemented in a way to reduce +// the risk of integer overflow. Such operation is used to convert a clock +// value expressed in ticks with a frequency to _PyTime_t, like +// QueryPerformanceCounter() with QueryPerformanceFrequency(). + +#ifndef Py_LIMITED_API +#ifndef Py_PYTIME_H +#define Py_PYTIME_H + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to time related +functions and constants +**************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/* _PyTime_t: Python timestamp with subsecond precision. It can be used to + store a duration, and so indirectly a date (related to another date, like + UNIX epoch). */ +typedef int64_t _PyTime_t; +// _PyTime_MIN nanoseconds is around -292.3 years +#define _PyTime_MIN INT64_MIN +// _PyTime_MAX nanoseconds is around +292.3 years +#define _PyTime_MAX INT64_MAX +#define _SIZEOF_PYTIME_T 8 + +typedef enum { + /* Round towards minus infinity (-inf). + For example, used to read a clock. */ + _PyTime_ROUND_FLOOR=0, + /* Round towards infinity (+inf). + For example, used for timeout to wait "at least" N seconds. */ + _PyTime_ROUND_CEILING=1, + /* Round to nearest with ties going to nearest even integer. + For example, used to round from a Python float. */ + _PyTime_ROUND_HALF_EVEN=2, + /* Round away from zero + For example, used for timeout. _PyTime_ROUND_CEILING rounds + -1e-9 to 0 milliseconds which causes bpo-31786 issue. + _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps + the timeout sign as expected. select.poll(timeout) must block + for negative values." */ + _PyTime_ROUND_UP=3, + /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be + used for timeouts. */ + _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP +} _PyTime_round_t; + + +/* Convert a time_t to a PyLong. */ +PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( + time_t sec); + +/* Convert a PyLong to a time_t. */ +PyAPI_FUNC(time_t) _PyLong_AsTime_t( + PyObject *obj); + +/* Convert a number of seconds, int or float, to time_t. */ +PyAPI_FUNC(int) _PyTime_ObjectToTime_t( + PyObject *obj, + time_t *sec, + _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timeval structure. + usec is in the range [0; 999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimeval( + PyObject *obj, + time_t *sec, + long *usec, + _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timespec structure. + nsec is in the range [0; 999999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimespec( + PyObject *obj, + time_t *sec, + long *nsec, + _PyTime_round_t); + + +/* Create a timestamp from a number of seconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); + +/* Macro to create a timestamp from a number of seconds, no integer overflow. + Only use the macro for small values, prefer _PyTime_FromSeconds(). */ +#define _PYTIME_FROMSECONDS(seconds) \ + ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) + +/* Create a timestamp from a number of nanoseconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns); + +/* Create a timestamp from nanoseconds (Python int). */ +PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t, + PyObject *obj); + +/* Convert a number of seconds (Python float or int) to a timestamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t, + PyObject *obj, + _PyTime_round_t round); + +/* Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t, + PyObject *obj, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds as a C double. */ +PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); + +/* Convert timestamp to a number of milliseconds (10^-3 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, + _PyTime_round_t round); + +/* Convert timestamp to a number of microseconds (10^-6 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, + _PyTime_round_t round); + +/* Convert timestamp to a number of nanoseconds (10^-9 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsNanoseconds(_PyTime_t t); + +#ifdef MS_WINDOWS +// Convert timestamp to a number of 100 nanoseconds (10^-7 seconds). +PyAPI_FUNC(_PyTime_t) _PyTime_As100Nanoseconds(_PyTime_t t, + _PyTime_round_t round); +#endif + +/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int + object. */ +PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); + +#ifndef MS_WINDOWS +/* Create a timestamp from a timeval structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv); +#endif + +/* Convert a timestamp to a timeval structure (microsecond resolution). + tv_usec is always positive. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, + struct timeval *tv, + _PyTime_round_t round); + +/* Similar to _PyTime_AsTimeval() but don't raise an exception on overflow. + On overflow, clamp tv_sec to _PyTime_t min/max. */ +PyAPI_FUNC(void) _PyTime_AsTimeval_clamp(_PyTime_t t, + struct timeval *tv, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds (secs) and microseconds (us). + us is always positive. This function is similar to _PyTime_AsTimeval() + except that secs is always a time_t type, whereas the timeval structure + uses a C long for tv_sec on Windows. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( + _PyTime_t t, + time_t *secs, + int *us, + _PyTime_round_t round); + +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) +/* Create a timestamp from a timespec structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts); + +/* Convert a timestamp to a timespec structure (nanosecond resolution). + tv_nsec is always positive. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); + +/* Similar to _PyTime_AsTimespec() but don't raise an exception on overflow. + On overflow, clamp tv_sec to _PyTime_t min/max. */ +PyAPI_FUNC(void) _PyTime_AsTimespec_clamp(_PyTime_t t, struct timespec *ts); +#endif + + +// Compute t1 + t2. Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow. +PyAPI_FUNC(_PyTime_t) _PyTime_Add(_PyTime_t t1, _PyTime_t t2); + +/* Compute ticks * mul / div. + Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow. + The caller must ensure that ((div - 1) * mul) cannot overflow. */ +PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, + _PyTime_t mul, + _PyTime_t div); + +/* Structure used by time.get_clock_info() */ +typedef struct { + const char *implementation; + int monotonic; + int adjustable; + double resolution; +} _Py_clock_info_t; + +/* Get the current time from the system clock. + + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and clamp the clock to + [_PyTime_MIN; _PyTime_MAX]. + + Use _PyTime_GetSystemClockWithInfo() to check for failure. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); + +/* Get the current time from the system clock. + * On success, set *t and *info (if not NULL), and return 0. + * On error, raise an exception and return -1. + */ +PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and clamp the clock to + [_PyTime_MIN; _PyTime_MAX]. + + Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + + +/* Converts a timestamp to the Gregorian time, using the local time zone. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); + +/* Converts a timestamp to the Gregorian time, assuming UTC. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + If the internal clock fails, silently ignore the error and return 0. + On integer overflow, silently ignore the overflow and clamp the clock to + [_PyTime_MIN; _PyTime_MAX]. + + Use _PyTime_GetPerfCounterWithInfo() to check for failure. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + + +// Create a deadline. +// Pseudo code: _PyTime_GetMonotonicClock() + timeout. +PyAPI_FUNC(_PyTime_t) _PyDeadline_Init(_PyTime_t timeout); + +// Get remaining time from a deadline. +// Pseudo code: deadline - _PyTime_GetMonotonicClock(). +PyAPI_FUNC(_PyTime_t) _PyDeadline_Get(_PyTime_t deadline); + +#ifdef __cplusplus +} +#endif + +#endif /* Py_PYTIME_H */ +#endif /* Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/setobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/setobject.h new file mode 100644 index 0000000000000000000000000000000000000000..b4443a678b7e771052fb61e91a2faf90f04ae743 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/setobject.h @@ -0,0 +1,67 @@ +#ifndef Py_CPYTHON_SETOBJECT_H +# error "this header file must not be included directly" +#endif + +/* There are three kinds of entries in the table: + +1. Unused: key == NULL and hash == 0 +2. Dummy: key == dummy and hash == -1 +3. Active: key != NULL and key != dummy and hash != -1 + +The hash field of Unused slots is always zero. + +The hash field of Dummy slots are set to -1 +meaning that dummy entries can be detected by +either entry->key==dummy or by entry->hash==-1. +*/ + +#define PySet_MINSIZE 8 + +typedef struct { + PyObject *key; + Py_hash_t hash; /* Cached hash code of the key */ +} setentry; + +/* The SetObject data structure is shared by set and frozenset objects. + +Invariant for sets: + - hash is -1 + +Invariants for frozensets: + - data is immutable. + - hash is the hash of the frozenset or -1 if not computed yet. + +*/ + +typedef struct { + PyObject_HEAD + + Py_ssize_t fill; /* Number active and dummy entries*/ + Py_ssize_t used; /* Number active entries */ + + /* The table contains mask + 1 slots, and that's a power of 2. + * We store the mask instead of the size because the mask is more + * frequently needed. + */ + Py_ssize_t mask; + + /* The table points to a fixed-size smalltable for small tables + * or to additional malloc'ed memory for bigger tables. + * The table pointer is never NULL which saves us from repeated + * runtime null-tests. + */ + setentry *table; + Py_hash_t hash; /* Only used by frozenset objects */ + Py_ssize_t finger; /* Search finger for pop() */ + + setentry smalltable[PySet_MINSIZE]; + PyObject *weakreflist; /* List of weak references */ +} PySetObject; + +#define PySet_GET_SIZE(so) \ + (assert(PyAnySet_Check(so)), (((PySetObject *)(so))->used)) + +PyAPI_DATA(PyObject *) _PySet_Dummy; + +PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash); +PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/sysmodule.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/sysmodule.h new file mode 100644 index 0000000000000000000000000000000000000000..19d9dddc344a4f0ee4fb0d849b82f280e3000ca3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/sysmodule.h @@ -0,0 +1,16 @@ +#ifndef Py_CPYTHON_SYSMODULE_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(PyObject *) _PySys_GetAttr(PyThreadState *tstate, + PyObject *name); + +PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); + +typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *); + +PyAPI_FUNC(int) PySys_Audit( + const char *event, + const char *argFormat, + ...); +PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/traceback.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/traceback.h new file mode 100644 index 0000000000000000000000000000000000000000..a4e087b2b4ecedb6ad08545c9be6d0f08e50bfac --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/traceback.h @@ -0,0 +1,16 @@ +#ifndef Py_CPYTHON_TRACEBACK_H +# error "this header file must not be included directly" +#endif + +typedef struct _traceback PyTracebackObject; + +struct _traceback { + PyObject_HEAD + PyTracebackObject *tb_next; + PyFrameObject *tb_frame; + int tb_lasti; + int tb_lineno; +}; + +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int, int *, PyObject **); +PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/tupleobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/tupleobject.h new file mode 100644 index 0000000000000000000000000000000000000000..3d9c1aff588634e9b1ab1d215131cd65272cc96f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/tupleobject.h @@ -0,0 +1,43 @@ +#ifndef Py_CPYTHON_TUPLEOBJECT_H +# error "this header file must not be included directly" +#endif + +typedef struct { + PyObject_VAR_HEAD + /* ob_item contains space for 'ob_size' elements. + Items must normally not be NULL, except during construction when + the tuple is not yet visible outside the function that builds it. */ + PyObject *ob_item[1]; +} PyTupleObject; + +PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); + +/* Cast argument to PyTupleObject* type. */ +#define _PyTuple_CAST(op) \ + (assert(PyTuple_Check(op)), _Py_CAST(PyTupleObject*, (op))) + +// Macros and static inline functions, trading safety for speed + +static inline Py_ssize_t PyTuple_GET_SIZE(PyObject *op) { + PyTupleObject *tuple = _PyTuple_CAST(op); + return Py_SIZE(tuple); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyTuple_GET_SIZE(op) PyTuple_GET_SIZE(_PyObject_CAST(op)) +#endif + +#define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index]) + +/* Function *only* to be used to fill in brand new tuples */ +static inline void +PyTuple_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) { + PyTupleObject *tuple = _PyTuple_CAST(op); + tuple->ob_item[index] = value; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +#define PyTuple_SET_ITEM(op, index, value) \ + PyTuple_SET_ITEM(_PyObject_CAST(op), index, _PyObject_CAST(value)) +#endif + +PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/unicodeobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/unicodeobject.h new file mode 100644 index 0000000000000000000000000000000000000000..41debcbc06af69b7b173fa375182b6427a84f4db --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/unicodeobject.h @@ -0,0 +1,1166 @@ +#ifndef Py_CPYTHON_UNICODEOBJECT_H +# error "this header file must not be included directly" +#endif + +/* Py_UNICODE was the native Unicode storage format (code unit) used by + Python and represents a single Unicode element in the Unicode type. + With PEP 393, Py_UNICODE is deprecated and replaced with a + typedef to wchar_t. */ +#define PY_UNICODE_TYPE wchar_t +/* Py_DEPRECATED(3.3) */ typedef wchar_t Py_UNICODE; + +/* --- Internal Unicode Operations ---------------------------------------- */ + +#ifndef USE_UNICODE_WCHAR_CACHE +# define USE_UNICODE_WCHAR_CACHE 1 +#endif /* USE_UNICODE_WCHAR_CACHE */ + +/* Since splitting on whitespace is an important use case, and + whitespace in most situations is solely ASCII whitespace, we + optimize for the common case by using a quick look-up table + _Py_ascii_whitespace (see below) with an inlined check. + + */ +#define Py_UNICODE_ISSPACE(ch) \ + ((Py_UCS4)(ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) + +#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) +#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) +#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) +#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) + +#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) +#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) +#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) + +#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) +#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) +#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) +#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch) + +#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) +#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) +#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) + +#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) + +#define Py_UNICODE_ISALNUM(ch) \ + (Py_UNICODE_ISALPHA(ch) || \ + Py_UNICODE_ISDECIMAL(ch) || \ + Py_UNICODE_ISDIGIT(ch) || \ + Py_UNICODE_ISNUMERIC(ch)) + +/* macros to work with surrogates */ +#define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF) +#define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF) +#define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF) +/* Join two surrogate characters and return a single Py_UCS4 value. */ +#define Py_UNICODE_JOIN_SURROGATES(high, low) \ + (((((Py_UCS4)(high) & 0x03FF) << 10) | \ + ((Py_UCS4)(low) & 0x03FF)) + 0x10000) +/* high surrogate = top 10 bits added to D800 */ +#define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10)) +/* low surrogate = bottom 10 bits added to DC00 */ +#define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF)) + +/* --- Unicode Type ------------------------------------------------------- */ + +/* ASCII-only strings created through PyUnicode_New use the PyASCIIObject + structure. state.ascii and state.compact are set, and the data + immediately follow the structure. utf8_length and wstr_length can be found + in the length field; the utf8 pointer is equal to the data pointer. */ +typedef struct { + /* There are 4 forms of Unicode strings: + + - compact ascii: + + * structure = PyASCIIObject + * test: PyUnicode_IS_COMPACT_ASCII(op) + * kind = PyUnicode_1BYTE_KIND + * compact = 1 + * ascii = 1 + * ready = 1 + * (length is the length of the utf8 and wstr strings) + * (data starts just after the structure) + * (since ASCII is decoded from UTF-8, the utf8 string are the data) + + - compact: + + * structure = PyCompactUnicodeObject + * test: PyUnicode_IS_COMPACT(op) && !PyUnicode_IS_ASCII(op) + * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or + PyUnicode_4BYTE_KIND + * compact = 1 + * ready = 1 + * ascii = 0 + * utf8 is not shared with data + * utf8_length = 0 if utf8 is NULL + * wstr is shared with data and wstr_length=length + if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 + or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_t)=4 + * wstr_length = 0 if wstr is NULL + * (data starts just after the structure) + + - legacy string, not ready: + + * structure = PyUnicodeObject + * test: kind == PyUnicode_WCHAR_KIND + * length = 0 (use wstr_length) + * hash = -1 + * kind = PyUnicode_WCHAR_KIND + * compact = 0 + * ascii = 0 + * ready = 0 + * interned = SSTATE_NOT_INTERNED + * wstr is not NULL + * data.any is NULL + * utf8 is NULL + * utf8_length = 0 + + - legacy string, ready: + + * structure = PyUnicodeObject structure + * test: !PyUnicode_IS_COMPACT(op) && kind != PyUnicode_WCHAR_KIND + * kind = PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND or + PyUnicode_4BYTE_KIND + * compact = 0 + * ready = 1 + * data.any is not NULL + * utf8 is shared and utf8_length = length with data.any if ascii = 1 + * utf8_length = 0 if utf8 is NULL + * wstr is shared with data.any and wstr_length = length + if kind=PyUnicode_2BYTE_KIND and sizeof(wchar_t)=2 + or if kind=PyUnicode_4BYTE_KIND and sizeof(wchar_4)=4 + * wstr_length = 0 if wstr is NULL + + Compact strings use only one memory block (structure + characters), + whereas legacy strings use one block for the structure and one block + for characters. + + Legacy strings are created by PyUnicode_FromUnicode() and + PyUnicode_FromStringAndSize(NULL, size) functions. They become ready + when PyUnicode_READY() is called. + + See also _PyUnicode_CheckConsistency(). + */ + PyObject_HEAD + Py_ssize_t length; /* Number of code points in the string */ + Py_hash_t hash; /* Hash value; -1 if not set */ + struct { + /* + SSTATE_NOT_INTERNED (0) + SSTATE_INTERNED_MORTAL (1) + SSTATE_INTERNED_IMMORTAL (2) + + If interned != SSTATE_NOT_INTERNED, the two references from the + dictionary to this object are *not* counted in ob_refcnt. + */ + unsigned int interned:2; + /* Character size: + + - PyUnicode_WCHAR_KIND (0): + + * character type = wchar_t (16 or 32 bits, depending on the + platform) + + - PyUnicode_1BYTE_KIND (1): + + * character type = Py_UCS1 (8 bits, unsigned) + * all characters are in the range U+0000-U+00FF (latin1) + * if ascii is set, all characters are in the range U+0000-U+007F + (ASCII), otherwise at least one character is in the range + U+0080-U+00FF + + - PyUnicode_2BYTE_KIND (2): + + * character type = Py_UCS2 (16 bits, unsigned) + * all characters are in the range U+0000-U+FFFF (BMP) + * at least one character is in the range U+0100-U+FFFF + + - PyUnicode_4BYTE_KIND (4): + + * character type = Py_UCS4 (32 bits, unsigned) + * all characters are in the range U+0000-U+10FFFF + * at least one character is in the range U+10000-U+10FFFF + */ + unsigned int kind:3; + /* Compact is with respect to the allocation scheme. Compact unicode + objects only require one memory block while non-compact objects use + one block for the PyUnicodeObject struct and another for its data + buffer. */ + unsigned int compact:1; + /* The string only contains characters in the range U+0000-U+007F (ASCII) + and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is + set, use the PyASCIIObject structure. */ + unsigned int ascii:1; + /* The ready flag indicates whether the object layout is initialized + completely. This means that this is either a compact object, or + the data pointer is filled out. The bit is redundant, and helps + to minimize the test in PyUnicode_IS_READY(). */ + unsigned int ready:1; + /* Padding to ensure that PyUnicode_DATA() is always aligned to + 4 bytes (see issue #19537 on m68k). */ + unsigned int :24; + } state; + wchar_t *wstr; /* wchar_t representation (null-terminated) */ +} PyASCIIObject; + +/* Non-ASCII strings allocated through PyUnicode_New use the + PyCompactUnicodeObject structure. state.compact is set, and the data + immediately follow the structure. */ +typedef struct { + PyASCIIObject _base; + Py_ssize_t utf8_length; /* Number of bytes in utf8, excluding the + * terminating \0. */ + char *utf8; /* UTF-8 representation (null-terminated) */ + Py_ssize_t wstr_length; /* Number of code points in wstr, possible + * surrogates count as two code points. */ +} PyCompactUnicodeObject; + +/* Strings allocated through PyUnicode_FromUnicode(NULL, len) use the + PyUnicodeObject structure. The actual string data is initially in the wstr + block, and copied into the data block using _PyUnicode_Ready. */ +typedef struct { + PyCompactUnicodeObject _base; + union { + void *any; + Py_UCS1 *latin1; + Py_UCS2 *ucs2; + Py_UCS4 *ucs4; + } data; /* Canonical, smallest-form Unicode buffer */ +} PyUnicodeObject; + +PyAPI_FUNC(int) _PyUnicode_CheckConsistency( + PyObject *op, + int check_content); + + +#define _PyASCIIObject_CAST(op) \ + (assert(PyUnicode_Check(op)), \ + _Py_CAST(PyASCIIObject*, (op))) +#define _PyCompactUnicodeObject_CAST(op) \ + (assert(PyUnicode_Check(op)), \ + _Py_CAST(PyCompactUnicodeObject*, (op))) +#define _PyUnicodeObject_CAST(op) \ + (assert(PyUnicode_Check(op)), \ + _Py_CAST(PyUnicodeObject*, (op))) + + +/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */ + +/* Values for PyASCIIObject.state: */ + +/* Interning state. */ +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + +/* Use only if you know it's a string */ +static inline unsigned int PyUnicode_CHECK_INTERNED(PyObject *op) { + return _PyASCIIObject_CAST(op)->state.interned; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_CHECK_INTERNED(op) PyUnicode_CHECK_INTERNED(_PyObject_CAST(op)) +#endif + +/* Fast check to determine whether an object is ready. Equivalent to: + PyUnicode_IS_COMPACT(op) || _PyUnicodeObject_CAST(op)->data.any */ +static inline unsigned int PyUnicode_IS_READY(PyObject *op) { + return _PyASCIIObject_CAST(op)->state.ready; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_IS_READY(op) PyUnicode_IS_READY(_PyObject_CAST(op)) +#endif + +/* Return true if the string contains only ASCII characters, or 0 if not. The + string may be compact (PyUnicode_IS_COMPACT_ASCII) or not, but must be + ready. */ +static inline unsigned int PyUnicode_IS_ASCII(PyObject *op) { + assert(PyUnicode_IS_READY(op)); + return _PyASCIIObject_CAST(op)->state.ascii; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_IS_ASCII(op) PyUnicode_IS_ASCII(_PyObject_CAST(op)) +#endif + +/* Return true if the string is compact or 0 if not. + No type checks or Ready calls are performed. */ +static inline unsigned int PyUnicode_IS_COMPACT(PyObject *op) { + return _PyASCIIObject_CAST(op)->state.compact; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_IS_COMPACT(op) PyUnicode_IS_COMPACT(_PyObject_CAST(op)) +#endif + +/* Return true if the string is a compact ASCII string (use PyASCIIObject + structure), or 0 if not. No type checks or Ready calls are performed. */ +static inline int PyUnicode_IS_COMPACT_ASCII(PyObject *op) { + return (_PyASCIIObject_CAST(op)->state.ascii && PyUnicode_IS_COMPACT(op)); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_IS_COMPACT_ASCII(op) PyUnicode_IS_COMPACT_ASCII(_PyObject_CAST(op)) +#endif + +enum PyUnicode_Kind { +/* String contains only wstr byte characters. This is only possible + when the string was created with a legacy API and _PyUnicode_Ready() + has not been called yet. */ + PyUnicode_WCHAR_KIND = 0, +/* Return values of the PyUnicode_KIND() function: */ + PyUnicode_1BYTE_KIND = 1, + PyUnicode_2BYTE_KIND = 2, + PyUnicode_4BYTE_KIND = 4 +}; + +/* Return one of the PyUnicode_*_KIND values defined above. */ +#define PyUnicode_KIND(op) \ + (assert(PyUnicode_IS_READY(op)), \ + _PyASCIIObject_CAST(op)->state.kind) + +/* Return a void pointer to the raw unicode buffer. */ +static inline void* _PyUnicode_COMPACT_DATA(PyObject *op) { + if (PyUnicode_IS_ASCII(op)) { + return _Py_STATIC_CAST(void*, (_PyASCIIObject_CAST(op) + 1)); + } + return _Py_STATIC_CAST(void*, (_PyCompactUnicodeObject_CAST(op) + 1)); +} + +static inline void* _PyUnicode_NONCOMPACT_DATA(PyObject *op) { + void *data; + assert(!PyUnicode_IS_COMPACT(op)); + data = _PyUnicodeObject_CAST(op)->data.any; + assert(data != NULL); + return data; +} + +static inline void* PyUnicode_DATA(PyObject *op) { + if (PyUnicode_IS_COMPACT(op)) { + return _PyUnicode_COMPACT_DATA(op); + } + return _PyUnicode_NONCOMPACT_DATA(op); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_DATA(op) PyUnicode_DATA(_PyObject_CAST(op)) +#endif + +/* Return pointers to the canonical representation cast to unsigned char, + Py_UCS2, or Py_UCS4 for direct character access. + No checks are performed, use PyUnicode_KIND() before to ensure + these will work correctly. */ + +#define PyUnicode_1BYTE_DATA(op) _Py_STATIC_CAST(Py_UCS1*, PyUnicode_DATA(op)) +#define PyUnicode_2BYTE_DATA(op) _Py_STATIC_CAST(Py_UCS2*, PyUnicode_DATA(op)) +#define PyUnicode_4BYTE_DATA(op) _Py_STATIC_CAST(Py_UCS4*, PyUnicode_DATA(op)) + +/* Returns the length of the unicode string. The caller has to make sure that + the string has it's canonical representation set before calling + this function. Call PyUnicode_(FAST_)Ready to ensure that. */ +static inline Py_ssize_t PyUnicode_GET_LENGTH(PyObject *op) { + assert(PyUnicode_IS_READY(op)); + return _PyASCIIObject_CAST(op)->length; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_GET_LENGTH(op) PyUnicode_GET_LENGTH(_PyObject_CAST(op)) +#endif + +/* Write into the canonical representation, this function does not do any sanity + checks and is intended for usage in loops. The caller should cache the + kind and data pointers obtained from other function calls. + index is the index in the string (starts at 0) and value is the new + code point value which should be written to that location. */ +static inline void PyUnicode_WRITE(int kind, void *data, + Py_ssize_t index, Py_UCS4 value) +{ + if (kind == PyUnicode_1BYTE_KIND) { + assert(value <= 0xffU); + _Py_STATIC_CAST(Py_UCS1*, data)[index] = _Py_STATIC_CAST(Py_UCS1, value); + } + else if (kind == PyUnicode_2BYTE_KIND) { + assert(value <= 0xffffU); + _Py_STATIC_CAST(Py_UCS2*, data)[index] = _Py_STATIC_CAST(Py_UCS2, value); + } + else { + assert(kind == PyUnicode_4BYTE_KIND); + assert(value <= 0x10ffffU); + _Py_STATIC_CAST(Py_UCS4*, data)[index] = value; + } +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +#define PyUnicode_WRITE(kind, data, index, value) \ + PyUnicode_WRITE(_Py_STATIC_CAST(int, kind), _Py_CAST(void*, data), \ + (index), _Py_STATIC_CAST(Py_UCS4, value)) +#endif + +/* Read a code point from the string's canonical representation. No checks + or ready calls are performed. */ +static inline Py_UCS4 PyUnicode_READ(int kind, + const void *data, Py_ssize_t index) +{ + if (kind == PyUnicode_1BYTE_KIND) { + return _Py_STATIC_CAST(const Py_UCS1*, data)[index]; + } + if (kind == PyUnicode_2BYTE_KIND) { + return _Py_STATIC_CAST(const Py_UCS2*, data)[index]; + } + assert(kind == PyUnicode_4BYTE_KIND); + return _Py_STATIC_CAST(const Py_UCS4*, data)[index]; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +#define PyUnicode_READ(kind, data, index) \ + PyUnicode_READ(_Py_STATIC_CAST(int, kind), \ + _Py_STATIC_CAST(const void*, data), \ + (index)) +#endif + +/* PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it + calls PyUnicode_KIND() and might call it twice. For single reads, use + PyUnicode_READ_CHAR, for multiple consecutive reads callers should + cache kind and use PyUnicode_READ instead. */ +static inline Py_UCS4 PyUnicode_READ_CHAR(PyObject *unicode, Py_ssize_t index) +{ + int kind; + assert(PyUnicode_IS_READY(unicode)); + kind = PyUnicode_KIND(unicode); + if (kind == PyUnicode_1BYTE_KIND) { + return PyUnicode_1BYTE_DATA(unicode)[index]; + } + if (kind == PyUnicode_2BYTE_KIND) { + return PyUnicode_2BYTE_DATA(unicode)[index]; + } + assert(kind == PyUnicode_4BYTE_KIND); + return PyUnicode_4BYTE_DATA(unicode)[index]; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_READ_CHAR(unicode, index) \ + PyUnicode_READ_CHAR(_PyObject_CAST(unicode), (index)) +#endif + +/* Return a maximum character value which is suitable for creating another + string based on op. This is always an approximation but more efficient + than iterating over the string. */ +static inline Py_UCS4 PyUnicode_MAX_CHAR_VALUE(PyObject *op) +{ + int kind; + + assert(PyUnicode_IS_READY(op)); + if (PyUnicode_IS_ASCII(op)) { + return 0x7fU; + } + + kind = PyUnicode_KIND(op); + if (kind == PyUnicode_1BYTE_KIND) { + return 0xffU; + } + if (kind == PyUnicode_2BYTE_KIND) { + return 0xffffU; + } + assert(kind == PyUnicode_4BYTE_KIND); + return 0x10ffffU; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_MAX_CHAR_VALUE(op) \ + PyUnicode_MAX_CHAR_VALUE(_PyObject_CAST(op)) +#endif + +/* === Public API ========================================================= */ + +/* --- Plain Py_UNICODE --------------------------------------------------- */ + +/* With PEP 393, this is the recommended way to allocate a new unicode object. + This function will allocate the object and its buffer in a single memory + block. Objects created using this function are not resizable. */ +PyAPI_FUNC(PyObject*) PyUnicode_New( + Py_ssize_t size, /* Number of code points in the new string */ + Py_UCS4 maxchar /* maximum code point value in the string */ + ); + +/* Initializes the canonical string representation from the deprecated + wstr/Py_UNICODE representation. This function is used to convert Unicode + objects which were created using the old API to the new flexible format + introduced with PEP 393. + + Don't call this function directly, use the public PyUnicode_READY() function + instead. */ +PyAPI_FUNC(int) _PyUnicode_Ready( + PyObject *unicode /* Unicode object */ + ); + +/* PyUnicode_READY() does less work than _PyUnicode_Ready() in the best + case. If the canonical representation is not yet set, it will still call + _PyUnicode_Ready(). + Returns 0 on success and -1 on errors. */ +static inline int PyUnicode_READY(PyObject *op) +{ + if (PyUnicode_IS_READY(op)) { + return 0; + } + return _PyUnicode_Ready(op); +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_READY(op) PyUnicode_READY(_PyObject_CAST(op)) +#endif + +/* Get a copy of a Unicode string. */ +PyAPI_FUNC(PyObject*) _PyUnicode_Copy( + PyObject *unicode + ); + +/* Copy character from one unicode object into another, this function performs + character conversion when necessary and falls back to memcpy() if possible. + + Fail if to is too small (smaller than *how_many* or smaller than + len(from)-from_start), or if kind(from[from_start:from_start+how_many]) > + kind(to), or if *to* has more than 1 reference. + + Return the number of written character, or return -1 and raise an exception + on error. + + Pseudo-code: + + how_many = min(how_many, len(from) - from_start) + to[to_start:to_start+how_many] = from[from_start:from_start+how_many] + return how_many + + Note: The function doesn't write a terminating null character. + */ +PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters( + PyObject *to, + Py_ssize_t to_start, + PyObject *from, + Py_ssize_t from_start, + Py_ssize_t how_many + ); + +/* Unsafe version of PyUnicode_CopyCharacters(): don't check arguments and so + may crash if parameters are invalid (e.g. if the output string + is too short). */ +PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters( + PyObject *to, + Py_ssize_t to_start, + PyObject *from, + Py_ssize_t from_start, + Py_ssize_t how_many + ); + +/* Fill a string with a character: write fill_char into + unicode[start:start+length]. + + Fail if fill_char is bigger than the string maximum character, or if the + string has more than 1 reference. + + Return the number of written character, or return -1 and raise an exception + on error. */ +PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill( + PyObject *unicode, + Py_ssize_t start, + Py_ssize_t length, + Py_UCS4 fill_char + ); + +/* Unsafe version of PyUnicode_Fill(): don't check arguments and so may crash + if parameters are invalid (e.g. if length is longer than the string). */ +PyAPI_FUNC(void) _PyUnicode_FastFill( + PyObject *unicode, + Py_ssize_t start, + Py_ssize_t length, + Py_UCS4 fill_char + ); + +/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters. + Scan the string to find the maximum character. */ +PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData( + int kind, + const void *buffer, + Py_ssize_t size); + +/* Create a new string from a buffer of ASCII characters. + WARNING: Don't check if the string contains any non-ASCII character. */ +PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII( + const char *buffer, + Py_ssize_t size); + +/* Compute the maximum character of the substring unicode[start:end]. + Return 127 for an empty string. */ +PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar ( + PyObject *unicode, + Py_ssize_t start, + Py_ssize_t end); + +/* --- Legacy deprecated API ---------------------------------------------- */ + +/* Create a Unicode Object from the Py_UNICODE buffer u of the given + size. + + u may be NULL which causes the contents to be undefined. It is the + user's responsibility to fill in the needed data afterwards. Note + that modifying the Unicode object contents after construction is + only allowed if u was set to NULL. + + The buffer is copied into the new object. */ +Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( + const Py_UNICODE *u, /* Unicode buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Return a read-only pointer to the Unicode object's internal + Py_UNICODE buffer. + If the wchar_t/Py_UNICODE representation is not yet available, this + function will calculate it. */ +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( + PyObject *unicode /* Unicode object */ + ); + +/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string + contains null characters. */ +PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode( + PyObject *unicode /* Unicode object */ + ); + +/* Return a read-only pointer to the Unicode object's internal + Py_UNICODE buffer and save the length at size. + If the wchar_t/Py_UNICODE representation is not yet available, this + function will calculate it. */ + +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( + PyObject *unicode, /* Unicode object */ + Py_ssize_t *size /* location where to save the length */ + ); + + +/* Fast access macros */ + +Py_DEPRECATED(3.3) +static inline Py_ssize_t PyUnicode_WSTR_LENGTH(PyObject *op) +{ + if (PyUnicode_IS_COMPACT_ASCII(op)) { + return _PyASCIIObject_CAST(op)->length; + } + else { + return _PyCompactUnicodeObject_CAST(op)->wstr_length; + } +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_WSTR_LENGTH(op) PyUnicode_WSTR_LENGTH(_PyObject_CAST(op)) +#endif + +/* Returns the deprecated Py_UNICODE representation's size in code units + (this includes surrogate pairs as 2 units). + If the Py_UNICODE representation is not available, it will be computed + on request. Use PyUnicode_GET_LENGTH() for the length in code points. */ + +Py_DEPRECATED(3.3) +static inline Py_ssize_t PyUnicode_GET_SIZE(PyObject *op) +{ + _Py_COMP_DIAG_PUSH + _Py_COMP_DIAG_IGNORE_DEPR_DECLS + if (_PyASCIIObject_CAST(op)->wstr == _Py_NULL) { + (void)PyUnicode_AsUnicode(op); + assert(_PyASCIIObject_CAST(op)->wstr != _Py_NULL); + } + return PyUnicode_WSTR_LENGTH(op); + _Py_COMP_DIAG_POP +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op)) +#endif + +Py_DEPRECATED(3.3) +static inline Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *op) +{ + _Py_COMP_DIAG_PUSH + _Py_COMP_DIAG_IGNORE_DEPR_DECLS + return PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE; + _Py_COMP_DIAG_POP +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_GET_DATA_SIZE(op) PyUnicode_GET_DATA_SIZE(_PyObject_CAST(op)) +#endif + +/* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE + representation on demand. Using this macro is very inefficient now, + try to port your code to use the new PyUnicode_*BYTE_DATA() macros or + use PyUnicode_WRITE() and PyUnicode_READ(). */ + +Py_DEPRECATED(3.3) +static inline Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *op) +{ + wchar_t *wstr = _PyASCIIObject_CAST(op)->wstr; + if (wstr != _Py_NULL) { + return wstr; + } + + _Py_COMP_DIAG_PUSH + _Py_COMP_DIAG_IGNORE_DEPR_DECLS + return PyUnicode_AsUnicode(op); + _Py_COMP_DIAG_POP +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(_PyObject_CAST(op)) +#endif + +Py_DEPRECATED(3.3) +static inline const char* PyUnicode_AS_DATA(PyObject *op) +{ + _Py_COMP_DIAG_PUSH + _Py_COMP_DIAG_IGNORE_DEPR_DECLS + Py_UNICODE *data = PyUnicode_AS_UNICODE(op); + // In C++, casting directly PyUnicode* to const char* is not valid + return _Py_STATIC_CAST(const char*, _Py_STATIC_CAST(const void*, data)); + _Py_COMP_DIAG_POP +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyUnicode_AS_DATA(op) PyUnicode_AS_DATA(_PyObject_CAST(op)) +#endif + + +/* --- _PyUnicodeWriter API ----------------------------------------------- */ + +typedef struct { + PyObject *buffer; + void *data; + enum PyUnicode_Kind kind; + Py_UCS4 maxchar; + Py_ssize_t size; + Py_ssize_t pos; + + /* minimum number of allocated characters (default: 0) */ + Py_ssize_t min_length; + + /* minimum character (default: 127, ASCII) */ + Py_UCS4 min_char; + + /* If non-zero, overallocate the buffer (default: 0). */ + unsigned char overallocate; + + /* If readonly is 1, buffer is a shared string (cannot be modified) + and size is set to 0. */ + unsigned char readonly; +} _PyUnicodeWriter ; + +/* Initialize a Unicode writer. + * + * By default, the minimum buffer size is 0 character and overallocation is + * disabled. Set min_length, min_char and overallocate attributes to control + * the allocation of the buffer. */ +PyAPI_FUNC(void) +_PyUnicodeWriter_Init(_PyUnicodeWriter *writer); + +/* Prepare the buffer to write 'length' characters + with the specified maximum character. + + Return 0 on success, raise an exception and return -1 on error. */ +#define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \ + (((MAXCHAR) <= (WRITER)->maxchar \ + && (LENGTH) <= (WRITER)->size - (WRITER)->pos) \ + ? 0 \ + : (((LENGTH) == 0) \ + ? 0 \ + : _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR)))) + +/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro + instead. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer, + Py_ssize_t length, Py_UCS4 maxchar); + +/* Prepare the buffer to have at least the kind KIND. + For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will + support characters in range U+000-U+FFFF. + + Return 0 on success, raise an exception and return -1 on error. */ +#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \ + (assert((KIND) != PyUnicode_WCHAR_KIND), \ + (KIND) <= (WRITER)->kind \ + ? 0 \ + : _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND))) + +/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind() + macro instead. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer, + enum PyUnicode_Kind kind); + +/* Append a Unicode character. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer, + Py_UCS4 ch + ); + +/* Append a Unicode string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, + PyObject *str /* Unicode string */ + ); + +/* Append a substring of a Unicode string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer, + PyObject *str, /* Unicode string */ + Py_ssize_t start, + Py_ssize_t end + ); + +/* Append an ASCII-encoded byte string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer, + const char *str, /* ASCII-encoded byte string */ + Py_ssize_t len /* number of bytes, or -1 if unknown */ + ); + +/* Append a latin1-encoded byte string. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) +_PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer, + const char *str, /* latin1-encoded byte string */ + Py_ssize_t len /* length in bytes */ + ); + +/* Get the value of the writer as a Unicode string. Clear the + buffer of the writer. Raise an exception and return NULL + on error. */ +PyAPI_FUNC(PyObject *) +_PyUnicodeWriter_Finish(_PyUnicodeWriter *writer); + +/* Deallocate memory of a writer (clear its internal buffer). */ +PyAPI_FUNC(void) +_PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer); + + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter( + _PyUnicodeWriter *writer, + PyObject *obj, + PyObject *format_spec, + Py_ssize_t start, + Py_ssize_t end); + +/* --- Manage the default encoding ---------------------------------------- */ + +/* Returns a pointer to the default encoding (UTF-8) of the + Unicode object unicode. + + Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation + in the unicodeobject. + + _PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to + support the previous internal function with the same behaviour. + + Use of this API is DEPRECATED since no size information can be + extracted from the returned data. +*/ + +PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode); + +#define _PyUnicode_AsString PyUnicode_AsUTF8 + +/* --- UTF-7 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7( + PyObject *unicode, /* Unicode object */ + int base64SetO, /* Encode RFC2152 Set O characters in base64 */ + int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ + const char *errors /* error handling */ + ); + +/* --- UTF-8 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String( + PyObject *unicode, + const char *errors); + +/* --- UTF-32 Codecs ------------------------------------------------------ */ + +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32( + PyObject *object, /* Unicode object */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); + +/* --- UTF-16 Codecs ------------------------------------------------------ */ + +/* Returns a Python string object holding the UTF-16 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. +*/ +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16( + PyObject* unicode, /* Unicode object */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); + +/* --- Unicode-Escape Codecs ---------------------------------------------- */ + +/* Variant of PyUnicode_DecodeUnicodeEscape that supports partial decoding. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeStateful( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ +); +/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape + chars. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal2( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed, /* bytes consumed */ + int *first_invalid_escape_char, /* on return, if not -1, contain the first + invalid escaped char (<= 0xff) or invalid + octal escape (> 0xff) in string. */ + const char **first_invalid_escape_ptr); /* on return, if not NULL, may + point to the first invalid escaped + char in string. + May be NULL if errors is not NULL. */ +// Export for binary compatibility. +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed, /* bytes consumed */ + const char **first_invalid_escape /* on return, points to first + invalid escaped char in + string. */ +); + +/* --- Raw-Unicode-Escape Codecs ---------------------------------------------- */ + +/* Variant of PyUnicode_DecodeRawUnicodeEscape that supports partial decoding. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeRawUnicodeEscapeStateful( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ +); + +/* --- Latin-1 Codecs ----------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String( + PyObject* unicode, + const char* errors); + +/* --- ASCII Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString( + PyObject* unicode, + const char* errors); + +/* --- Character Map Codecs ----------------------------------------------- */ + +/* Translate an Unicode object by applying a character mapping table to + it and return the resulting Unicode object. + + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. +*/ +PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( + PyObject *unicode, /* Unicode object */ + PyObject *mapping, /* encoding mapping */ + const char *errors /* error handling */ + ); + +/* --- Decimal Encoder ---------------------------------------------------- */ + +/* Coverts a Unicode object holding a decimal value to an ASCII string + for using in int, float and complex parsers. + Transforms code points that have decimal digit property to the + corresponding ASCII digit code points. Transforms spaces to ASCII. + Transforms code points starting from the first non-ASCII code point that + is neither a decimal digit nor a space to the end into '?'. */ + +PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII( + PyObject *unicode /* Unicode object */ + ); + +/* --- Methods & Slots ---------------------------------------------------- */ + +PyAPI_FUNC(PyObject *) _PyUnicode_JoinArray( + PyObject *separator, + PyObject *const *items, + Py_ssize_t seqlen + ); + +/* Test whether a unicode is equal to ASCII identifier. Return 1 if true, + 0 otherwise. The right argument must be ASCII identifier. + Any error occurs inside will be cleared before return. */ +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIId( + PyObject *left, /* Left string */ + _Py_Identifier *right /* Right identifier */ + ); + +/* Test whether a unicode is equal to ASCII string. Return 1 if true, + 0 otherwise. The right argument must be ASCII-encoded string. + Any error occurs inside will be cleared before return. */ +PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString( + PyObject *left, + const char *right /* ASCII-encoded string */ + ); + +/* Externally visible for str.strip(unicode) */ +PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( + PyObject *self, + int striptype, + PyObject *sepobj + ); + +/* Using explicit passed-in values, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping( + _PyUnicodeWriter *writer, + Py_ssize_t n_buffer, + PyObject *digits, + Py_ssize_t d_pos, + Py_ssize_t n_digits, + Py_ssize_t min_width, + const char *grouping, + PyObject *thousands_sep, + Py_UCS4 *maxchar); + +/* === Characters Type APIs =============================================== */ + +/* Helper array used by Py_UNICODE_ISSPACE(). */ + +PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; + +/* These should not be used directly. Use the Py_UNICODE_IS* and + Py_UNICODE_TO* macros instead. + + These APIs are implemented in Objects/unicodectype.c. + +*/ + +PyAPI_FUNC(int) _PyUnicode_IsLowercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsUppercase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsTitlecase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsXidStart( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsXidContinue( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsWhitespace( + const Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsLinebreak( + const Py_UCS4 ch /* Unicode character */ + ); + +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase( + Py_UCS4 ch /* Unicode character */ + ); + +/* Py_DEPRECATED(3.3) */ PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase( + Py_UCS4 ch /* Unicode character */ + ); + +Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToLowerFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_ToTitleFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_ToUpperFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_ToFoldedFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsCased( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(double) _PyUnicode_ToNumeric( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDigit( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsNumeric( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsPrintable( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsAlpha( + Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int); + +/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ +PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); + +/* Fast equality check when the inputs are known to be exact unicode types + and where the hash values are equal (i.e. a very probable match) */ +PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *); + +/* Equality check. Returns -1 on failure. */ +PyAPI_FUNC(int) _PyUnicode_Equal(PyObject *, PyObject *); + +PyAPI_FUNC(int) _PyUnicode_WideCharString_Converter(PyObject *, void *); +PyAPI_FUNC(int) _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *); + +PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *); diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/warnings.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/warnings.h new file mode 100644 index 0000000000000000000000000000000000000000..2ef8e3ce9435f4053d096b403e0434e4fe874ccb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/warnings.h @@ -0,0 +1,20 @@ +#ifndef Py_CPYTHON_WARNINGS_H +# error "this header file must not be included directly" +#endif + +PyAPI_FUNC(int) PyErr_WarnExplicitObject( + PyObject *category, + PyObject *message, + PyObject *filename, + int lineno, + PyObject *module, + PyObject *registry); + +PyAPI_FUNC(int) PyErr_WarnExplicitFormat( + PyObject *category, + const char *filename, int lineno, + const char *module, PyObject *registry, + const char *format, ...); + +// DEPRECATED: Use PyErr_WarnEx() instead. +#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) diff --git a/data/miniconda3/envs/catiagent/include/python3.11/cpython/weakrefobject.h b/data/miniconda3/envs/catiagent/include/python3.11/cpython/weakrefobject.h new file mode 100644 index 0000000000000000000000000000000000000000..26b364f41d4d7e7e9e3824fb450770d338955a8c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/cpython/weakrefobject.h @@ -0,0 +1,58 @@ +#ifndef Py_CPYTHON_WEAKREFOBJECT_H +# error "this header file must not be included directly" +#endif + +/* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, + * and CallableProxyType. + */ +struct _PyWeakReference { + PyObject_HEAD + + /* The object to which this is a weak reference, or Py_None if none. + * Note that this is a stealth reference: wr_object's refcount is + * not incremented to reflect this pointer. + */ + PyObject *wr_object; + + /* A callable to invoke when wr_object dies, or NULL if none. */ + PyObject *wr_callback; + + /* A cache for wr_object's hash code. As usual for hashes, this is -1 + * if the hash code isn't known yet. + */ + Py_hash_t hash; + + /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- + * terminated list of weak references to it. These are the list pointers. + * If wr_object goes away, wr_object is set to Py_None, and these pointers + * have no meaning then. + */ + PyWeakReference *wr_prev; + PyWeakReference *wr_next; + vectorcallfunc vectorcall; +}; + +PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); + +PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); + +static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj) { + PyWeakReference *ref; + PyObject *obj; + assert(PyWeakref_Check(ref_obj)); + ref = _Py_CAST(PyWeakReference*, ref_obj); + obj = ref->wr_object; + // Explanation for the Py_REFCNT() check: when a weakref's target is part + // of a long chain of deallocations which triggers the trashcan mechanism, + // clearing the weakrefs can be delayed long after the target's refcount + // has dropped to zero. In the meantime, code accessing the weakref will + // be able to "see" the target object even though it is supposed to be + // unreachable. See issue gh-60806. + if (Py_REFCNT(obj) > 0) { + return obj; + } + return Py_None; +} +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +# define PyWeakref_GET_OBJECT(ref) PyWeakref_GET_OBJECT(_PyObject_CAST(ref)) +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_abstract.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_abstract.h new file mode 100644 index 0000000000000000000000000000000000000000..b1afb2dc7be65e6442da153b051689f5b7e96ad8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_abstract.h @@ -0,0 +1,25 @@ +#ifndef Py_INTERNAL_ABSTRACT_H +#define Py_INTERNAL_ABSTRACT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +// Fast inlined version of PyIndex_Check() +static inline int +_PyIndex_Check(PyObject *obj) +{ + PyNumberMethods *tp_as_number = Py_TYPE(obj)->tp_as_number; + return (tp_as_number != NULL && tp_as_number->nb_index != NULL); +} + +PyObject *_PyNumber_PowerNoMod(PyObject *lhs, PyObject *rhs); +PyObject *_PyNumber_InPlacePowerNoMod(PyObject *lhs, PyObject *rhs); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_ABSTRACT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_accu.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_accu.h new file mode 100644 index 0000000000000000000000000000000000000000..d346222e4dd0c9789f01ca1b97c96124bc01abae --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_accu.h @@ -0,0 +1,39 @@ +#ifndef Py_LIMITED_API +#ifndef Py_INTERNAL_ACCU_H +#define Py_INTERNAL_ACCU_H +#ifdef __cplusplus +extern "C" { +#endif + +/*** This is a private API for use by the interpreter and the stdlib. + *** Its definition may be changed or removed at any moment. + ***/ + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* + * A two-level accumulator of unicode objects that avoids both the overhead + * of keeping a huge number of small separate objects, and the quadratic + * behaviour of using a naive repeated concatenation scheme. + */ + +#undef small /* defined by some Windows headers */ + +typedef struct { + PyObject *large; /* A list of previously accumulated large strings */ + PyObject *small; /* Pending small strings */ +} _PyAccu; + +PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); +PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); +PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); +PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); +PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_ACCU_H */ +#endif /* !Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_asdl.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_asdl.h new file mode 100644 index 0000000000000000000000000000000000000000..5b01c7a66599e916f25fe5a7859d149db4a87fdc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_asdl.h @@ -0,0 +1,112 @@ +#ifndef Py_INTERNAL_ASDL_H +#define Py_INTERNAL_ASDL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_pyarena.h" // _PyArena_Malloc() + +typedef PyObject * identifier; +typedef PyObject * string; +typedef PyObject * object; +typedef PyObject * constant; + +/* It would be nice if the code generated by asdl_c.py was completely + independent of Python, but it is a goal the requires too much work + at this stage. So, for example, I'll represent identifiers as + interned Python strings. +*/ + +#define _ASDL_SEQ_HEAD \ + Py_ssize_t size; \ + void **elements; + +typedef struct { + _ASDL_SEQ_HEAD +} asdl_seq; + +typedef struct { + _ASDL_SEQ_HEAD + void *typed_elements[1]; +} asdl_generic_seq; + +typedef struct { + _ASDL_SEQ_HEAD + PyObject *typed_elements[1]; +} asdl_identifier_seq; + +typedef struct { + _ASDL_SEQ_HEAD + int typed_elements[1]; +} asdl_int_seq; + +asdl_generic_seq *_Py_asdl_generic_seq_new(Py_ssize_t size, PyArena *arena); +asdl_identifier_seq *_Py_asdl_identifier_seq_new(Py_ssize_t size, PyArena *arena); +asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena); + + +#define GENERATE_ASDL_SEQ_CONSTRUCTOR(NAME, TYPE) \ +asdl_ ## NAME ## _seq *_Py_asdl_ ## NAME ## _seq_new(Py_ssize_t size, PyArena *arena) \ +{ \ + asdl_ ## NAME ## _seq *seq = NULL; \ + size_t n; \ + /* check size is sane */ \ + if (size < 0 || \ + (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { \ + PyErr_NoMemory(); \ + return NULL; \ + } \ + n = (size ? (sizeof(TYPE *) * (size - 1)) : 0); \ + /* check if size can be added safely */ \ + if (n > SIZE_MAX - sizeof(asdl_ ## NAME ## _seq)) { \ + PyErr_NoMemory(); \ + return NULL; \ + } \ + n += sizeof(asdl_ ## NAME ## _seq); \ + seq = (asdl_ ## NAME ## _seq *)_PyArena_Malloc(arena, n); \ + if (!seq) { \ + PyErr_NoMemory(); \ + return NULL; \ + } \ + memset(seq, 0, n); \ + seq->size = size; \ + seq->elements = (void**)seq->typed_elements; \ + return seq; \ +} + +#define asdl_seq_GET_UNTYPED(S, I) _Py_RVALUE((S)->elements[(I)]) +#define asdl_seq_GET(S, I) _Py_RVALUE((S)->typed_elements[(I)]) +#define asdl_seq_LEN(S) _Py_RVALUE(((S) == NULL ? 0 : (S)->size)) + +#ifdef Py_DEBUG +# define asdl_seq_SET(S, I, V) \ + do { \ + Py_ssize_t _asdl_i = (I); \ + assert((S) != NULL); \ + assert(0 <= _asdl_i && _asdl_i < (S)->size); \ + (S)->typed_elements[_asdl_i] = (V); \ + } while (0) +#else +# define asdl_seq_SET(S, I, V) _Py_RVALUE((S)->typed_elements[I] = (V)) +#endif + +#ifdef Py_DEBUG +# define asdl_seq_SET_UNTYPED(S, I, V) \ + do { \ + Py_ssize_t _asdl_i = (I); \ + assert((S) != NULL); \ + assert(0 <= _asdl_i && _asdl_i < (S)->size); \ + (S)->elements[_asdl_i] = (V); \ + } while (0) +#else +# define asdl_seq_SET_UNTYPED(S, I, V) _Py_RVALUE((S)->elements[I] = (V)) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_ASDL_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast.h new file mode 100644 index 0000000000000000000000000000000000000000..36277efe9c5ca53bcf2e6dd82354b066af8aa012 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast.h @@ -0,0 +1,866 @@ +// File automatically generated by Parser/asdl_c.py. + +#ifndef Py_INTERNAL_AST_H +#define Py_INTERNAL_AST_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_asdl.h" + +typedef struct _mod *mod_ty; + +typedef struct _stmt *stmt_ty; + +typedef struct _expr *expr_ty; + +typedef enum _expr_context { Load=1, Store=2, Del=3 } expr_context_ty; + +typedef enum _boolop { And=1, Or=2 } boolop_ty; + +typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7, + LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12, + FloorDiv=13 } operator_ty; + +typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; + +typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, + In=9, NotIn=10 } cmpop_ty; + +typedef struct _comprehension *comprehension_ty; + +typedef struct _excepthandler *excepthandler_ty; + +typedef struct _arguments *arguments_ty; + +typedef struct _arg *arg_ty; + +typedef struct _keyword *keyword_ty; + +typedef struct _alias *alias_ty; + +typedef struct _withitem *withitem_ty; + +typedef struct _match_case *match_case_ty; + +typedef struct _pattern *pattern_ty; + +typedef struct _type_ignore *type_ignore_ty; + + +typedef struct { + _ASDL_SEQ_HEAD + mod_ty typed_elements[1]; +} asdl_mod_seq; + +asdl_mod_seq *_Py_asdl_mod_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + stmt_ty typed_elements[1]; +} asdl_stmt_seq; + +asdl_stmt_seq *_Py_asdl_stmt_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + expr_ty typed_elements[1]; +} asdl_expr_seq; + +asdl_expr_seq *_Py_asdl_expr_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + comprehension_ty typed_elements[1]; +} asdl_comprehension_seq; + +asdl_comprehension_seq *_Py_asdl_comprehension_seq_new(Py_ssize_t size, PyArena + *arena); + +typedef struct { + _ASDL_SEQ_HEAD + excepthandler_ty typed_elements[1]; +} asdl_excepthandler_seq; + +asdl_excepthandler_seq *_Py_asdl_excepthandler_seq_new(Py_ssize_t size, PyArena + *arena); + +typedef struct { + _ASDL_SEQ_HEAD + arguments_ty typed_elements[1]; +} asdl_arguments_seq; + +asdl_arguments_seq *_Py_asdl_arguments_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + arg_ty typed_elements[1]; +} asdl_arg_seq; + +asdl_arg_seq *_Py_asdl_arg_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + keyword_ty typed_elements[1]; +} asdl_keyword_seq; + +asdl_keyword_seq *_Py_asdl_keyword_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + alias_ty typed_elements[1]; +} asdl_alias_seq; + +asdl_alias_seq *_Py_asdl_alias_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + withitem_ty typed_elements[1]; +} asdl_withitem_seq; + +asdl_withitem_seq *_Py_asdl_withitem_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + match_case_ty typed_elements[1]; +} asdl_match_case_seq; + +asdl_match_case_seq *_Py_asdl_match_case_seq_new(Py_ssize_t size, PyArena + *arena); + +typedef struct { + _ASDL_SEQ_HEAD + pattern_ty typed_elements[1]; +} asdl_pattern_seq; + +asdl_pattern_seq *_Py_asdl_pattern_seq_new(Py_ssize_t size, PyArena *arena); + +typedef struct { + _ASDL_SEQ_HEAD + type_ignore_ty typed_elements[1]; +} asdl_type_ignore_seq; + +asdl_type_ignore_seq *_Py_asdl_type_ignore_seq_new(Py_ssize_t size, PyArena + *arena); + + +enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, + FunctionType_kind=4}; +struct _mod { + enum _mod_kind kind; + union { + struct { + asdl_stmt_seq *body; + asdl_type_ignore_seq *type_ignores; + } Module; + + struct { + asdl_stmt_seq *body; + } Interactive; + + struct { + expr_ty body; + } Expression; + + struct { + asdl_expr_seq *argtypes; + expr_ty returns; + } FunctionType; + + } v; +}; + +enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, + Return_kind=4, Delete_kind=5, Assign_kind=6, + AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, + AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, + AsyncWith_kind=14, Match_kind=15, Raise_kind=16, Try_kind=17, + TryStar_kind=18, Assert_kind=19, Import_kind=20, + ImportFrom_kind=21, Global_kind=22, Nonlocal_kind=23, + Expr_kind=24, Pass_kind=25, Break_kind=26, Continue_kind=27}; +struct _stmt { + enum _stmt_kind kind; + union { + struct { + identifier name; + arguments_ty args; + asdl_stmt_seq *body; + asdl_expr_seq *decorator_list; + expr_ty returns; + string type_comment; + } FunctionDef; + + struct { + identifier name; + arguments_ty args; + asdl_stmt_seq *body; + asdl_expr_seq *decorator_list; + expr_ty returns; + string type_comment; + } AsyncFunctionDef; + + struct { + identifier name; + asdl_expr_seq *bases; + asdl_keyword_seq *keywords; + asdl_stmt_seq *body; + asdl_expr_seq *decorator_list; + } ClassDef; + + struct { + expr_ty value; + } Return; + + struct { + asdl_expr_seq *targets; + } Delete; + + struct { + asdl_expr_seq *targets; + expr_ty value; + string type_comment; + } Assign; + + struct { + expr_ty target; + operator_ty op; + expr_ty value; + } AugAssign; + + struct { + expr_ty target; + expr_ty annotation; + expr_ty value; + int simple; + } AnnAssign; + + struct { + expr_ty target; + expr_ty iter; + asdl_stmt_seq *body; + asdl_stmt_seq *orelse; + string type_comment; + } For; + + struct { + expr_ty target; + expr_ty iter; + asdl_stmt_seq *body; + asdl_stmt_seq *orelse; + string type_comment; + } AsyncFor; + + struct { + expr_ty test; + asdl_stmt_seq *body; + asdl_stmt_seq *orelse; + } While; + + struct { + expr_ty test; + asdl_stmt_seq *body; + asdl_stmt_seq *orelse; + } If; + + struct { + asdl_withitem_seq *items; + asdl_stmt_seq *body; + string type_comment; + } With; + + struct { + asdl_withitem_seq *items; + asdl_stmt_seq *body; + string type_comment; + } AsyncWith; + + struct { + expr_ty subject; + asdl_match_case_seq *cases; + } Match; + + struct { + expr_ty exc; + expr_ty cause; + } Raise; + + struct { + asdl_stmt_seq *body; + asdl_excepthandler_seq *handlers; + asdl_stmt_seq *orelse; + asdl_stmt_seq *finalbody; + } Try; + + struct { + asdl_stmt_seq *body; + asdl_excepthandler_seq *handlers; + asdl_stmt_seq *orelse; + asdl_stmt_seq *finalbody; + } TryStar; + + struct { + expr_ty test; + expr_ty msg; + } Assert; + + struct { + asdl_alias_seq *names; + } Import; + + struct { + identifier module; + asdl_alias_seq *names; + int level; + } ImportFrom; + + struct { + asdl_identifier_seq *names; + } Global; + + struct { + asdl_identifier_seq *names; + } Nonlocal; + + struct { + expr_ty value; + } Expr; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +enum _expr_kind {BoolOp_kind=1, NamedExpr_kind=2, BinOp_kind=3, UnaryOp_kind=4, + Lambda_kind=5, IfExp_kind=6, Dict_kind=7, Set_kind=8, + ListComp_kind=9, SetComp_kind=10, DictComp_kind=11, + GeneratorExp_kind=12, Await_kind=13, Yield_kind=14, + YieldFrom_kind=15, Compare_kind=16, Call_kind=17, + FormattedValue_kind=18, JoinedStr_kind=19, Constant_kind=20, + Attribute_kind=21, Subscript_kind=22, Starred_kind=23, + Name_kind=24, List_kind=25, Tuple_kind=26, Slice_kind=27}; +struct _expr { + enum _expr_kind kind; + union { + struct { + boolop_ty op; + asdl_expr_seq *values; + } BoolOp; + + struct { + expr_ty target; + expr_ty value; + } NamedExpr; + + struct { + expr_ty left; + operator_ty op; + expr_ty right; + } BinOp; + + struct { + unaryop_ty op; + expr_ty operand; + } UnaryOp; + + struct { + arguments_ty args; + expr_ty body; + } Lambda; + + struct { + expr_ty test; + expr_ty body; + expr_ty orelse; + } IfExp; + + struct { + asdl_expr_seq *keys; + asdl_expr_seq *values; + } Dict; + + struct { + asdl_expr_seq *elts; + } Set; + + struct { + expr_ty elt; + asdl_comprehension_seq *generators; + } ListComp; + + struct { + expr_ty elt; + asdl_comprehension_seq *generators; + } SetComp; + + struct { + expr_ty key; + expr_ty value; + asdl_comprehension_seq *generators; + } DictComp; + + struct { + expr_ty elt; + asdl_comprehension_seq *generators; + } GeneratorExp; + + struct { + expr_ty value; + } Await; + + struct { + expr_ty value; + } Yield; + + struct { + expr_ty value; + } YieldFrom; + + struct { + expr_ty left; + asdl_int_seq *ops; + asdl_expr_seq *comparators; + } Compare; + + struct { + expr_ty func; + asdl_expr_seq *args; + asdl_keyword_seq *keywords; + } Call; + + struct { + expr_ty value; + int conversion; + expr_ty format_spec; + } FormattedValue; + + struct { + asdl_expr_seq *values; + } JoinedStr; + + struct { + constant value; + string kind; + } Constant; + + struct { + expr_ty value; + identifier attr; + expr_context_ty ctx; + } Attribute; + + struct { + expr_ty value; + expr_ty slice; + expr_context_ty ctx; + } Subscript; + + struct { + expr_ty value; + expr_context_ty ctx; + } Starred; + + struct { + identifier id; + expr_context_ty ctx; + } Name; + + struct { + asdl_expr_seq *elts; + expr_context_ty ctx; + } List; + + struct { + asdl_expr_seq *elts; + expr_context_ty ctx; + } Tuple; + + struct { + expr_ty lower; + expr_ty upper; + expr_ty step; + } Slice; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _comprehension { + expr_ty target; + expr_ty iter; + asdl_expr_seq *ifs; + int is_async; +}; + +enum _excepthandler_kind {ExceptHandler_kind=1}; +struct _excepthandler { + enum _excepthandler_kind kind; + union { + struct { + expr_ty type; + identifier name; + asdl_stmt_seq *body; + } ExceptHandler; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _arguments { + asdl_arg_seq *posonlyargs; + asdl_arg_seq *args; + arg_ty vararg; + asdl_arg_seq *kwonlyargs; + asdl_expr_seq *kw_defaults; + arg_ty kwarg; + asdl_expr_seq *defaults; +}; + +struct _arg { + identifier arg; + expr_ty annotation; + string type_comment; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _keyword { + identifier arg; + expr_ty value; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _alias { + identifier name; + identifier asname; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +struct _withitem { + expr_ty context_expr; + expr_ty optional_vars; +}; + +struct _match_case { + pattern_ty pattern; + expr_ty guard; + asdl_stmt_seq *body; +}; + +enum _pattern_kind {MatchValue_kind=1, MatchSingleton_kind=2, + MatchSequence_kind=3, MatchMapping_kind=4, + MatchClass_kind=5, MatchStar_kind=6, MatchAs_kind=7, + MatchOr_kind=8}; +struct _pattern { + enum _pattern_kind kind; + union { + struct { + expr_ty value; + } MatchValue; + + struct { + constant value; + } MatchSingleton; + + struct { + asdl_pattern_seq *patterns; + } MatchSequence; + + struct { + asdl_expr_seq *keys; + asdl_pattern_seq *patterns; + identifier rest; + } MatchMapping; + + struct { + expr_ty cls; + asdl_pattern_seq *patterns; + asdl_identifier_seq *kwd_attrs; + asdl_pattern_seq *kwd_patterns; + } MatchClass; + + struct { + identifier name; + } MatchStar; + + struct { + pattern_ty pattern; + identifier name; + } MatchAs; + + struct { + asdl_pattern_seq *patterns; + } MatchOr; + + } v; + int lineno; + int col_offset; + int end_lineno; + int end_col_offset; +}; + +enum _type_ignore_kind {TypeIgnore_kind=1}; +struct _type_ignore { + enum _type_ignore_kind kind; + union { + struct { + int lineno; + string tag; + } TypeIgnore; + + } v; +}; + + +// Note: these macros affect function definitions, not only call sites. +mod_ty _PyAST_Module(asdl_stmt_seq * body, asdl_type_ignore_seq * type_ignores, + PyArena *arena); +mod_ty _PyAST_Interactive(asdl_stmt_seq * body, PyArena *arena); +mod_ty _PyAST_Expression(expr_ty body, PyArena *arena); +mod_ty _PyAST_FunctionType(asdl_expr_seq * argtypes, expr_ty returns, PyArena + *arena); +stmt_ty _PyAST_FunctionDef(identifier name, arguments_ty args, asdl_stmt_seq * + body, asdl_expr_seq * decorator_list, expr_ty + returns, string type_comment, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +stmt_ty _PyAST_AsyncFunctionDef(identifier name, arguments_ty args, + asdl_stmt_seq * body, asdl_expr_seq * + decorator_list, expr_ty returns, string + type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_ClassDef(identifier name, asdl_expr_seq * bases, + asdl_keyword_seq * keywords, asdl_stmt_seq * body, + asdl_expr_seq * decorator_list, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +stmt_ty _PyAST_Return(expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Delete(asdl_expr_seq * targets, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Assign(asdl_expr_seq * targets, expr_ty value, string + type_comment, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +stmt_ty _PyAST_AugAssign(expr_ty target, operator_ty op, expr_ty value, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_AnnAssign(expr_ty target, expr_ty annotation, expr_ty value, int + simple, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +stmt_ty _PyAST_For(expr_ty target, expr_ty iter, asdl_stmt_seq * body, + asdl_stmt_seq * orelse, string type_comment, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +stmt_ty _PyAST_AsyncFor(expr_ty target, expr_ty iter, asdl_stmt_seq * body, + asdl_stmt_seq * orelse, string type_comment, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_While(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * + orelse, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_If(expr_ty test, asdl_stmt_seq * body, asdl_stmt_seq * orelse, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_With(asdl_withitem_seq * items, asdl_stmt_seq * body, string + type_comment, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +stmt_ty _PyAST_AsyncWith(asdl_withitem_seq * items, asdl_stmt_seq * body, + string type_comment, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, + int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_ImportFrom(identifier module, asdl_alias_seq * names, int level, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_Global(asdl_identifier_seq * names, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Nonlocal(asdl_identifier_seq * names, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +stmt_ty _PyAST_Expr(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +stmt_ty _PyAST_Pass(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_Break(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +stmt_ty _PyAST_Continue(int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_BoolOp(boolop_ty op, asdl_expr_seq * values, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_NamedExpr(expr_ty target, expr_ty value, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +expr_ty _PyAST_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, + int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +expr_ty _PyAST_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Lambda(arguments_ty args, expr_ty body, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, + int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +expr_ty _PyAST_Dict(asdl_expr_seq * keys, asdl_expr_seq * values, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Set(asdl_expr_seq * elts, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +expr_ty _PyAST_ListComp(expr_ty elt, asdl_comprehension_seq * generators, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_SetComp(expr_ty elt, asdl_comprehension_seq * generators, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_DictComp(expr_ty key, expr_ty value, asdl_comprehension_seq * + generators, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +expr_ty _PyAST_GeneratorExp(expr_ty elt, asdl_comprehension_seq * generators, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_Await(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +expr_ty _PyAST_Yield(expr_ty value, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +expr_ty _PyAST_YieldFrom(expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +expr_ty _PyAST_Compare(expr_ty left, asdl_int_seq * ops, asdl_expr_seq * + comparators, int lineno, int col_offset, int end_lineno, + int end_col_offset, PyArena *arena); +expr_ty _PyAST_Call(expr_ty func, asdl_expr_seq * args, asdl_keyword_seq * + keywords, int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_FormattedValue(expr_ty value, int conversion, expr_ty + format_spec, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +expr_ty _PyAST_JoinedStr(asdl_expr_seq * values, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena *arena); +expr_ty _PyAST_Constant(constant value, string kind, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_Subscript(expr_ty value, expr_ty slice, expr_context_ty ctx, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +expr_ty _PyAST_Starred(expr_ty value, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Name(identifier id, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_List(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Tuple(asdl_expr_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +expr_ty _PyAST_Slice(expr_ty lower, expr_ty upper, expr_ty step, int lineno, + int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +comprehension_ty _PyAST_comprehension(expr_ty target, expr_ty iter, + asdl_expr_seq * ifs, int is_async, + PyArena *arena); +excepthandler_ty _PyAST_ExceptHandler(expr_ty type, identifier name, + asdl_stmt_seq * body, int lineno, int + col_offset, int end_lineno, int + end_col_offset, PyArena *arena); +arguments_ty _PyAST_arguments(asdl_arg_seq * posonlyargs, asdl_arg_seq * args, + arg_ty vararg, asdl_arg_seq * kwonlyargs, + asdl_expr_seq * kw_defaults, arg_ty kwarg, + asdl_expr_seq * defaults, PyArena *arena); +arg_ty _PyAST_arg(identifier arg, expr_ty annotation, string type_comment, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +keyword_ty _PyAST_keyword(identifier arg, expr_ty value, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +alias_ty _PyAST_alias(identifier name, identifier asname, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena + *arena); +withitem_ty _PyAST_withitem(expr_ty context_expr, expr_ty optional_vars, + PyArena *arena); +match_case_ty _PyAST_match_case(pattern_ty pattern, expr_ty guard, + asdl_stmt_seq * body, PyArena *arena); +pattern_ty _PyAST_MatchValue(expr_ty value, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +pattern_ty _PyAST_MatchSingleton(constant value, int lineno, int col_offset, + int end_lineno, int end_col_offset, PyArena + *arena); +pattern_ty _PyAST_MatchSequence(asdl_pattern_seq * patterns, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +pattern_ty _PyAST_MatchMapping(asdl_expr_seq * keys, asdl_pattern_seq * + patterns, identifier rest, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +pattern_ty _PyAST_MatchClass(expr_ty cls, asdl_pattern_seq * patterns, + asdl_identifier_seq * kwd_attrs, asdl_pattern_seq + * kwd_patterns, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +pattern_ty _PyAST_MatchStar(identifier name, int lineno, int col_offset, int + end_lineno, int end_col_offset, PyArena *arena); +pattern_ty _PyAST_MatchAs(pattern_ty pattern, identifier name, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int + col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena); + + +PyObject* PyAST_mod2obj(mod_ty t); +mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); +int PyAST_Check(PyObject* obj); + +extern int _PyAST_Validate(mod_ty); + +/* _PyAST_ExprAsUnicode is defined in ast_unparse.c */ +extern PyObject* _PyAST_ExprAsUnicode(expr_ty); + +/* Return the borrowed reference to the first literal string in the + sequence of statements or NULL if it doesn't start from a literal string. + Doesn't set exception. */ +extern PyObject* _PyAST_GetDocString(asdl_stmt_seq *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_AST_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast_state.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast_state.h new file mode 100644 index 0000000000000000000000000000000000000000..d354822e1d1df1600d4340d781da97a0d5e1d474 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ast_state.h @@ -0,0 +1,258 @@ +// File automatically generated by Parser/asdl_c.py. + +#ifndef Py_INTERNAL_AST_STATE_H +#define Py_INTERNAL_AST_STATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +struct ast_state { + int initialized; + int unused_recursion_depth; + int unused_recursion_limit; + PyObject *AST_type; + PyObject *Add_singleton; + PyObject *Add_type; + PyObject *And_singleton; + PyObject *And_type; + PyObject *AnnAssign_type; + PyObject *Assert_type; + PyObject *Assign_type; + PyObject *AsyncFor_type; + PyObject *AsyncFunctionDef_type; + PyObject *AsyncWith_type; + PyObject *Attribute_type; + PyObject *AugAssign_type; + PyObject *Await_type; + PyObject *BinOp_type; + PyObject *BitAnd_singleton; + PyObject *BitAnd_type; + PyObject *BitOr_singleton; + PyObject *BitOr_type; + PyObject *BitXor_singleton; + PyObject *BitXor_type; + PyObject *BoolOp_type; + PyObject *Break_type; + PyObject *Call_type; + PyObject *ClassDef_type; + PyObject *Compare_type; + PyObject *Constant_type; + PyObject *Continue_type; + PyObject *Del_singleton; + PyObject *Del_type; + PyObject *Delete_type; + PyObject *DictComp_type; + PyObject *Dict_type; + PyObject *Div_singleton; + PyObject *Div_type; + PyObject *Eq_singleton; + PyObject *Eq_type; + PyObject *ExceptHandler_type; + PyObject *Expr_type; + PyObject *Expression_type; + PyObject *FloorDiv_singleton; + PyObject *FloorDiv_type; + PyObject *For_type; + PyObject *FormattedValue_type; + PyObject *FunctionDef_type; + PyObject *FunctionType_type; + PyObject *GeneratorExp_type; + PyObject *Global_type; + PyObject *GtE_singleton; + PyObject *GtE_type; + PyObject *Gt_singleton; + PyObject *Gt_type; + PyObject *IfExp_type; + PyObject *If_type; + PyObject *ImportFrom_type; + PyObject *Import_type; + PyObject *In_singleton; + PyObject *In_type; + PyObject *Interactive_type; + PyObject *Invert_singleton; + PyObject *Invert_type; + PyObject *IsNot_singleton; + PyObject *IsNot_type; + PyObject *Is_singleton; + PyObject *Is_type; + PyObject *JoinedStr_type; + PyObject *LShift_singleton; + PyObject *LShift_type; + PyObject *Lambda_type; + PyObject *ListComp_type; + PyObject *List_type; + PyObject *Load_singleton; + PyObject *Load_type; + PyObject *LtE_singleton; + PyObject *LtE_type; + PyObject *Lt_singleton; + PyObject *Lt_type; + PyObject *MatMult_singleton; + PyObject *MatMult_type; + PyObject *MatchAs_type; + PyObject *MatchClass_type; + PyObject *MatchMapping_type; + PyObject *MatchOr_type; + PyObject *MatchSequence_type; + PyObject *MatchSingleton_type; + PyObject *MatchStar_type; + PyObject *MatchValue_type; + PyObject *Match_type; + PyObject *Mod_singleton; + PyObject *Mod_type; + PyObject *Module_type; + PyObject *Mult_singleton; + PyObject *Mult_type; + PyObject *Name_type; + PyObject *NamedExpr_type; + PyObject *Nonlocal_type; + PyObject *NotEq_singleton; + PyObject *NotEq_type; + PyObject *NotIn_singleton; + PyObject *NotIn_type; + PyObject *Not_singleton; + PyObject *Not_type; + PyObject *Or_singleton; + PyObject *Or_type; + PyObject *Pass_type; + PyObject *Pow_singleton; + PyObject *Pow_type; + PyObject *RShift_singleton; + PyObject *RShift_type; + PyObject *Raise_type; + PyObject *Return_type; + PyObject *SetComp_type; + PyObject *Set_type; + PyObject *Slice_type; + PyObject *Starred_type; + PyObject *Store_singleton; + PyObject *Store_type; + PyObject *Sub_singleton; + PyObject *Sub_type; + PyObject *Subscript_type; + PyObject *TryStar_type; + PyObject *Try_type; + PyObject *Tuple_type; + PyObject *TypeIgnore_type; + PyObject *UAdd_singleton; + PyObject *UAdd_type; + PyObject *USub_singleton; + PyObject *USub_type; + PyObject *UnaryOp_type; + PyObject *While_type; + PyObject *With_type; + PyObject *YieldFrom_type; + PyObject *Yield_type; + PyObject *__dict__; + PyObject *__doc__; + PyObject *__match_args__; + PyObject *__module__; + PyObject *_attributes; + PyObject *_fields; + PyObject *alias_type; + PyObject *annotation; + PyObject *arg; + PyObject *arg_type; + PyObject *args; + PyObject *argtypes; + PyObject *arguments_type; + PyObject *asname; + PyObject *ast; + PyObject *attr; + PyObject *bases; + PyObject *body; + PyObject *boolop_type; + PyObject *cases; + PyObject *cause; + PyObject *cls; + PyObject *cmpop_type; + PyObject *col_offset; + PyObject *comparators; + PyObject *comprehension_type; + PyObject *context_expr; + PyObject *conversion; + PyObject *ctx; + PyObject *decorator_list; + PyObject *defaults; + PyObject *elt; + PyObject *elts; + PyObject *end_col_offset; + PyObject *end_lineno; + PyObject *exc; + PyObject *excepthandler_type; + PyObject *expr_context_type; + PyObject *expr_type; + PyObject *finalbody; + PyObject *format_spec; + PyObject *func; + PyObject *generators; + PyObject *guard; + PyObject *handlers; + PyObject *id; + PyObject *ifs; + PyObject *is_async; + PyObject *items; + PyObject *iter; + PyObject *key; + PyObject *keys; + PyObject *keyword_type; + PyObject *keywords; + PyObject *kind; + PyObject *kw_defaults; + PyObject *kwarg; + PyObject *kwd_attrs; + PyObject *kwd_patterns; + PyObject *kwonlyargs; + PyObject *left; + PyObject *level; + PyObject *lineno; + PyObject *lower; + PyObject *match_case_type; + PyObject *mod_type; + PyObject *module; + PyObject *msg; + PyObject *name; + PyObject *names; + PyObject *op; + PyObject *operand; + PyObject *operator_type; + PyObject *ops; + PyObject *optional_vars; + PyObject *orelse; + PyObject *pattern; + PyObject *pattern_type; + PyObject *patterns; + PyObject *posonlyargs; + PyObject *rest; + PyObject *returns; + PyObject *right; + PyObject *simple; + PyObject *slice; + PyObject *step; + PyObject *stmt_type; + PyObject *subject; + PyObject *tag; + PyObject *target; + PyObject *targets; + PyObject *test; + PyObject *type; + PyObject *type_comment; + PyObject *type_ignore_type; + PyObject *type_ignores; + PyObject *unaryop_type; + PyObject *upper; + PyObject *value; + PyObject *values; + PyObject *vararg; + PyObject *withitem_type; +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_AST_STATE_H */ + diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic.h new file mode 100644 index 0000000000000000000000000000000000000000..425d69f868b52b26ad34bbf724ad7671012404d0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic.h @@ -0,0 +1,557 @@ +#ifndef Py_ATOMIC_H +#define Py_ATOMIC_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "dynamic_annotations.h" /* _Py_ANNOTATE_MEMORY_ORDER */ +#include "pyconfig.h" + +#ifdef HAVE_STD_ATOMIC +# include +#endif + + +#if defined(_MSC_VER) +#include +#if defined(_M_IX86) || defined(_M_X64) +# include +#endif +#endif + +/* This is modeled after the atomics interface from C1x, according to + * the draft at + * http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf. + * Operations and types are named the same except with a _Py_ prefix + * and have the same semantics. + * + * Beware, the implementations here are deep magic. + */ + +#if defined(HAVE_STD_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = memory_order_relaxed, + _Py_memory_order_acquire = memory_order_acquire, + _Py_memory_order_release = memory_order_release, + _Py_memory_order_acq_rel = memory_order_acq_rel, + _Py_memory_order_seq_cst = memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + atomic_uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + atomic_int _value; +} _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + atomic_store_explicit(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + atomic_load_explicit(&((ATOMIC_VAL)->_value), ORDER) + +// Use builtin atomic operations in GCC >= 4.7 and clang +#elif defined(HAVE_BUILTIN_ATOMIC) + +typedef enum _Py_memory_order { + _Py_memory_order_relaxed = __ATOMIC_RELAXED, + _Py_memory_order_acquire = __ATOMIC_ACQUIRE, + _Py_memory_order_release = __ATOMIC_RELEASE, + _Py_memory_order_acq_rel = __ATOMIC_ACQ_REL, + _Py_memory_order_seq_cst = __ATOMIC_SEQ_CST +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; + +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \ + __atomic_signal_fence(ORDER) + +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \ + __atomic_thread_fence(ORDER) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + (assert((ORDER) == __ATOMIC_RELAXED \ + || (ORDER) == __ATOMIC_SEQ_CST \ + || (ORDER) == __ATOMIC_RELEASE), \ + __atomic_store_n(&((ATOMIC_VAL)->_value), NEW_VAL, ORDER)) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + (assert((ORDER) == __ATOMIC_RELAXED \ + || (ORDER) == __ATOMIC_SEQ_CST \ + || (ORDER) == __ATOMIC_ACQUIRE \ + || (ORDER) == __ATOMIC_CONSUME), \ + __atomic_load_n(&((ATOMIC_VAL)->_value), ORDER)) + +/* Only support GCC (for expression statements) and x86 (for simple + * atomic semantics) and MSVC x86/x64/ARM */ +#elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64)) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; + + +static __inline__ void +_Py_atomic_signal_fence(_Py_memory_order order) +{ + if (order != _Py_memory_order_relaxed) + __asm__ volatile("":::"memory"); +} + +static __inline__ void +_Py_atomic_thread_fence(_Py_memory_order order) +{ + if (order != _Py_memory_order_relaxed) + __asm__ volatile("mfence":::"memory"); +} + +/* Tell the race checker about this operation's effects. */ +static __inline__ void +_Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order) +{ + (void)address; /* shut up -Wunused-parameter */ + switch(order) { + case _Py_memory_order_release: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_BEFORE(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_acquire: + break; + } + switch(order) { + case _Py_memory_order_acquire: + case _Py_memory_order_acq_rel: + case _Py_memory_order_seq_cst: + _Py_ANNOTATE_HAPPENS_AFTER(address); + break; + case _Py_memory_order_relaxed: + case _Py_memory_order_release: + break; + } +} + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + __extension__ ({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) new_val = NEW_VAL;\ + volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \ + switch(order) { \ + case _Py_memory_order_release: \ + _Py_atomic_signal_fence(_Py_memory_order_release); \ + /* fallthrough */ \ + case _Py_memory_order_relaxed: \ + *volatile_data = new_val; \ + break; \ + \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + __asm__ volatile("xchg %0, %1" \ + : "+r"(new_val) \ + : "m"(atomic_val->_value) \ + : "memory"); \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_WRITES_END(); \ + }) + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + __extension__ ({ \ + __typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \ + __typeof__(atomic_val->_value) result; \ + volatile __typeof__(result) *volatile_data = &atomic_val->_value; \ + _Py_memory_order order = ORDER; \ + _Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \ + \ + /* Perform the operation. */ \ + _Py_ANNOTATE_IGNORE_READS_BEGIN(); \ + switch(order) { \ + case _Py_memory_order_release: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are not releases by default, so need a */ \ + /* thread fence. */ \ + _Py_atomic_thread_fence(_Py_memory_order_release); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + result = *volatile_data; \ + switch(order) { \ + case _Py_memory_order_acquire: \ + case _Py_memory_order_acq_rel: \ + case _Py_memory_order_seq_cst: \ + /* Loads on x86 are automatically acquire operations so */ \ + /* can get by with just a compiler fence. */ \ + _Py_atomic_signal_fence(_Py_memory_order_acquire); \ + break; \ + default: \ + /* No fence */ \ + break; \ + } \ + _Py_ANNOTATE_IGNORE_READS_END(); \ + result; \ + }) + +#elif defined(_MSC_VER) +/* _Interlocked* functions provide a full memory barrier and are therefore + enough for acq_rel and seq_cst. If the HLE variants aren't available + in hardware they will fall back to a full memory barrier as well. + + This might affect performance but likely only in some very specific and + hard to measure scenario. +*/ +#if defined(_M_IX86) || defined(_M_X64) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + volatile uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + volatile int _value; +} _Py_atomic_int; + + +#if defined(_M_X64) +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange64_HLEAcquire((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange64_HLERelease((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + default: \ + _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)(NEW_VAL)); \ + break; \ + } +#else +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); +#endif + +#define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange_HLEAcquire((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange_HLERelease((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + default: \ + _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)(NEW_VAL)); \ + break; \ + } + +#if defined(_M_X64) +/* This has to be an intptr_t for now. + gil_created() uses -1 as a sentinel value, if this returns + a uintptr_t it will do an unsigned compare and crash +*/ +inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { + __int64 old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_HLEAcquire((volatile __int64*)value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_HLERelease((volatile __int64*)value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange64((volatile __int64*)value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) + +#else +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) +#endif + +inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { + long old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange_HLEAcquire((volatile long*)value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange_HLERelease((volatile long*)value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange((volatile long*)value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + if (sizeof((ATOMIC_VAL)->_value) == 8) { \ + _Py_atomic_store_64bit((ATOMIC_VAL), NEW_VAL, ORDER) } else { \ + _Py_atomic_store_32bit((ATOMIC_VAL), NEW_VAL, ORDER) } + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ( \ + sizeof((ATOMIC_VAL)->_value) == 8 ? \ + _Py_atomic_load_64bit((ATOMIC_VAL), ORDER) : \ + _Py_atomic_load_32bit((ATOMIC_VAL), ORDER) \ + ) +#elif defined(_M_ARM) || defined(_M_ARM64) +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + volatile uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + volatile int _value; +} _Py_atomic_int; + + +#if defined(_M_ARM64) +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange64_acq((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange64_rel((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + default: \ + _InterlockedExchange64((__int64 volatile*)&((ATOMIC_VAL)->_value), (__int64)NEW_VAL); \ + break; \ + } +#else +#define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) ((void)0); +#endif + +#define _Py_atomic_store_32bit(ATOMIC_VAL, NEW_VAL, ORDER) \ + switch (ORDER) { \ + case _Py_memory_order_acquire: \ + _InterlockedExchange_acq((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + case _Py_memory_order_release: \ + _InterlockedExchange_rel((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + default: \ + _InterlockedExchange((volatile long*)&((ATOMIC_VAL)->_value), (int)NEW_VAL); \ + break; \ + } + +#if defined(_M_ARM64) +/* This has to be an intptr_t for now. + gil_created() uses -1 as a sentinel value, if this returns + a uintptr_t it will do an unsigned compare and crash +*/ +inline intptr_t _Py_atomic_load_64bit_impl(volatile uintptr_t* value, int order) { + uintptr_t old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_acq(value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange64_rel(value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange64(value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_64bit_impl((volatile uintptr_t*)&((ATOMIC_VAL)->_value), (ORDER)) + +#else +#define _Py_atomic_load_64bit(ATOMIC_VAL, ORDER) ((ATOMIC_VAL)->_value) +#endif + +inline int _Py_atomic_load_32bit_impl(volatile int* value, int order) { + int old; + switch (order) { + case _Py_memory_order_acquire: + { + do { + old = *value; + } while(_InterlockedCompareExchange_acq(value, old, old) != old); + break; + } + case _Py_memory_order_release: + { + do { + old = *value; + } while(_InterlockedCompareExchange_rel(value, old, old) != old); + break; + } + case _Py_memory_order_relaxed: + old = *value; + break; + default: + { + do { + old = *value; + } while(_InterlockedCompareExchange(value, old, old) != old); + break; + } + } + return old; +} + +#define _Py_atomic_load_32bit(ATOMIC_VAL, ORDER) \ + _Py_atomic_load_32bit_impl((volatile int*)&((ATOMIC_VAL)->_value), (ORDER)) + +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + if (sizeof((ATOMIC_VAL)->_value) == 8) { \ + _Py_atomic_store_64bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } else { \ + _Py_atomic_store_32bit((ATOMIC_VAL), (NEW_VAL), (ORDER)) } + +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ( \ + sizeof((ATOMIC_VAL)->_value) == 8 ? \ + _Py_atomic_load_64bit((ATOMIC_VAL), (ORDER)) : \ + _Py_atomic_load_32bit((ATOMIC_VAL), (ORDER)) \ + ) +#endif +#else /* !gcc x86 !_msc_ver */ +typedef enum _Py_memory_order { + _Py_memory_order_relaxed, + _Py_memory_order_acquire, + _Py_memory_order_release, + _Py_memory_order_acq_rel, + _Py_memory_order_seq_cst +} _Py_memory_order; + +typedef struct _Py_atomic_address { + uintptr_t _value; +} _Py_atomic_address; + +typedef struct _Py_atomic_int { + int _value; +} _Py_atomic_int; +/* Fall back to other compilers and processors by assuming that simple + volatile accesses are atomic. This is false, so people should port + this. */ +#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0) +#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ + ((ATOMIC_VAL)->_value = NEW_VAL) +#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ + ((ATOMIC_VAL)->_value) +#endif + +/* Standardized shortcuts. */ +#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_seq_cst) +#define _Py_atomic_load(ATOMIC_VAL) \ + _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_seq_cst) + +/* Python-local extensions */ + +#define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \ + _Py_atomic_store_explicit((ATOMIC_VAL), (NEW_VAL), _Py_memory_order_relaxed) +#define _Py_atomic_load_relaxed(ATOMIC_VAL) \ + _Py_atomic_load_explicit((ATOMIC_VAL), _Py_memory_order_relaxed) + +#ifdef __cplusplus +} +#endif +#endif /* Py_ATOMIC_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic_funcs.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic_funcs.h new file mode 100644 index 0000000000000000000000000000000000000000..a708789cea733bbc56cc3c3271a280a413a8ce4f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_atomic_funcs.h @@ -0,0 +1,94 @@ +/* Atomic functions: similar to pycore_atomic.h, but don't need + to declare variables as atomic. + + Py_ssize_t type: + + * value = _Py_atomic_size_get(&var) + * _Py_atomic_size_set(&var, value) + + Use sequentially-consistent ordering (__ATOMIC_SEQ_CST memory order): + enforce total ordering with all other atomic functions. +*/ +#ifndef Py_ATOMIC_FUNC_H +#define Py_ATOMIC_FUNC_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#if defined(_MSC_VER) +# include // _InterlockedExchange() +#endif + + +// Use builtin atomic operations in GCC >= 4.7 and clang +#ifdef HAVE_BUILTIN_ATOMIC + +static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var) +{ + return __atomic_load_n(var, __ATOMIC_SEQ_CST); +} + +static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value) +{ + __atomic_store_n(var, value, __ATOMIC_SEQ_CST); +} + +#elif defined(_MSC_VER) + +static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var) +{ +#if SIZEOF_VOID_P == 8 + Py_BUILD_ASSERT(sizeof(__int64) == sizeof(*var)); + volatile __int64 *volatile_var = (volatile __int64 *)var; + __int64 old; + do { + old = *volatile_var; + } while(_InterlockedCompareExchange64(volatile_var, old, old) != old); +#else + Py_BUILD_ASSERT(sizeof(long) == sizeof(*var)); + volatile long *volatile_var = (volatile long *)var; + long old; + do { + old = *volatile_var; + } while(_InterlockedCompareExchange(volatile_var, old, old) != old); +#endif + return old; +} + +static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value) +{ +#if SIZEOF_VOID_P == 8 + Py_BUILD_ASSERT(sizeof(__int64) == sizeof(*var)); + volatile __int64 *volatile_var = (volatile __int64 *)var; + _InterlockedExchange64(volatile_var, value); +#else + Py_BUILD_ASSERT(sizeof(long) == sizeof(*var)); + volatile long *volatile_var = (volatile long *)var; + _InterlockedExchange(volatile_var, value); +#endif +} + +#else +// Fallback implementation using volatile + +static inline Py_ssize_t _Py_atomic_size_get(Py_ssize_t *var) +{ + volatile Py_ssize_t *volatile_var = (volatile Py_ssize_t *)var; + return *volatile_var; +} + +static inline void _Py_atomic_size_set(Py_ssize_t *var, Py_ssize_t value) +{ + volatile Py_ssize_t *volatile_var = (volatile Py_ssize_t *)var; + *volatile_var = value; +} +#endif + +#ifdef __cplusplus +} +#endif +#endif /* Py_ATOMIC_FUNC_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bitutils.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bitutils.h new file mode 100644 index 0000000000000000000000000000000000000000..e6bf61ef425bd8121a2c4b423a0467989c776027 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bitutils.h @@ -0,0 +1,186 @@ +/* Bit and bytes utilities. + + Bytes swap functions, reverse order of bytes: + + - _Py_bswap16(uint16_t) + - _Py_bswap32(uint32_t) + - _Py_bswap64(uint64_t) +*/ + +#ifndef Py_INTERNAL_BITUTILS_H +#define Py_INTERNAL_BITUTILS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#if defined(__GNUC__) \ + && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) + /* __builtin_bswap16() is available since GCC 4.8, + __builtin_bswap32() is available since GCC 4.3, + __builtin_bswap64() is available since GCC 4.3. */ +# define _PY_HAVE_BUILTIN_BSWAP +#endif + +#ifdef _MSC_VER + /* Get _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64() */ +# include +#endif + +static inline uint16_t +_Py_bswap16(uint16_t word) +{ +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap16) + return __builtin_bswap16(word); +#elif defined(_MSC_VER) + Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned short)); + return _byteswap_ushort(word); +#else + // Portable implementation which doesn't rely on circular bit shift + return ( ((word & UINT16_C(0x00FF)) << 8) + | ((word & UINT16_C(0xFF00)) >> 8)); +#endif +} + +static inline uint32_t +_Py_bswap32(uint32_t word) +{ +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap32) + return __builtin_bswap32(word); +#elif defined(_MSC_VER) + Py_BUILD_ASSERT(sizeof(word) == sizeof(unsigned long)); + return _byteswap_ulong(word); +#else + // Portable implementation which doesn't rely on circular bit shift + return ( ((word & UINT32_C(0x000000FF)) << 24) + | ((word & UINT32_C(0x0000FF00)) << 8) + | ((word & UINT32_C(0x00FF0000)) >> 8) + | ((word & UINT32_C(0xFF000000)) >> 24)); +#endif +} + +static inline uint64_t +_Py_bswap64(uint64_t word) +{ +#if defined(_PY_HAVE_BUILTIN_BSWAP) || _Py__has_builtin(__builtin_bswap64) + return __builtin_bswap64(word); +#elif defined(_MSC_VER) + return _byteswap_uint64(word); +#else + // Portable implementation which doesn't rely on circular bit shift + return ( ((word & UINT64_C(0x00000000000000FF)) << 56) + | ((word & UINT64_C(0x000000000000FF00)) << 40) + | ((word & UINT64_C(0x0000000000FF0000)) << 24) + | ((word & UINT64_C(0x00000000FF000000)) << 8) + | ((word & UINT64_C(0x000000FF00000000)) >> 8) + | ((word & UINT64_C(0x0000FF0000000000)) >> 24) + | ((word & UINT64_C(0x00FF000000000000)) >> 40) + | ((word & UINT64_C(0xFF00000000000000)) >> 56)); +#endif +} + + +// Population count: count the number of 1's in 'x' +// (number of bits set to 1), also known as the hamming weight. +// +// Implementation note. CPUID is not used, to test if x86 POPCNT instruction +// can be used, to keep the implementation simple. For example, Visual Studio +// __popcnt() is not used this reason. The clang and GCC builtin function can +// use the x86 POPCNT instruction if the target architecture has SSE4a or +// newer. +static inline int +_Py_popcount32(uint32_t x) +{ +#if (defined(__clang__) || defined(__GNUC__)) + +#if SIZEOF_INT >= 4 + Py_BUILD_ASSERT(sizeof(x) <= sizeof(unsigned int)); + return __builtin_popcount(x); +#else + // The C standard guarantees that unsigned long will always be big enough + // to hold a uint32_t value without losing information. + Py_BUILD_ASSERT(sizeof(x) <= sizeof(unsigned long)); + return __builtin_popcountl(x); +#endif + +#else + // 32-bit SWAR (SIMD Within A Register) popcount + + // Binary: 0 1 0 1 ... + const uint32_t M1 = 0x55555555; + // Binary: 00 11 00 11. .. + const uint32_t M2 = 0x33333333; + // Binary: 0000 1111 0000 1111 ... + const uint32_t M4 = 0x0F0F0F0F; + + // Put count of each 2 bits into those 2 bits + x = x - ((x >> 1) & M1); + // Put count of each 4 bits into those 4 bits + x = (x & M2) + ((x >> 2) & M2); + // Put count of each 8 bits into those 8 bits + x = (x + (x >> 4)) & M4; + // Sum of the 4 byte counts. + // Take care when considering changes to the next line. Portability and + // correctness are delicate here, thanks to C's "integer promotions" (C99 + // §6.3.1.1p2). On machines where the `int` type has width greater than 32 + // bits, `x` will be promoted to an `int`, and following C's "usual + // arithmetic conversions" (C99 §6.3.1.8), the multiplication will be + // performed as a multiplication of two `unsigned int` operands. In this + // case it's critical that we cast back to `uint32_t` in order to keep only + // the least significant 32 bits. On machines where the `int` type has + // width no greater than 32, the multiplication is of two 32-bit unsigned + // integer types, and the (uint32_t) cast is a no-op. In both cases, we + // avoid the risk of undefined behaviour due to overflow of a + // multiplication of signed integer types. + return (uint32_t)(x * 0x01010101U) >> 24; +#endif +} + + +// Return the index of the most significant 1 bit in 'x'. This is the smallest +// integer k such that x < 2**k. Equivalent to floor(log2(x)) + 1 for x != 0. +static inline int +_Py_bit_length(unsigned long x) +{ +#if (defined(__clang__) || defined(__GNUC__)) + if (x != 0) { + // __builtin_clzl() is available since GCC 3.4. + // Undefined behavior for x == 0. + return (int)sizeof(unsigned long) * 8 - __builtin_clzl(x); + } + else { + return 0; + } +#elif defined(_MSC_VER) + // _BitScanReverse() is documented to search 32 bits. + Py_BUILD_ASSERT(sizeof(unsigned long) <= 4); + unsigned long msb; + if (_BitScanReverse(&msb, x)) { + return (int)msb + 1; + } + else { + return 0; + } +#else + const int BIT_LENGTH_TABLE[32] = { + 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 + }; + int msb = 0; + while (x >= 32) { + msb += 6; + x >>= 6; + } + msb += BIT_LENGTH_TABLE[x]; + return msb; +#endif +} + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_BITUTILS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_blocks_output_buffer.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_blocks_output_buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..28cf6fba4eeba2e68d7cde88b676589befae4c48 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_blocks_output_buffer.h @@ -0,0 +1,317 @@ +/* + _BlocksOutputBuffer is used to maintain an output buffer + that has unpredictable size. Suitable for compression/decompression + API (bz2/lzma/zlib) that has stream->next_out and stream->avail_out: + + stream->next_out: point to the next output position. + stream->avail_out: the number of available bytes left in the buffer. + + It maintains a list of bytes object, so there is no overhead of resizing + the buffer. + + Usage: + + 1, Initialize the struct instance like this: + _BlocksOutputBuffer buffer = {.list = NULL}; + Set .list to NULL for _BlocksOutputBuffer_OnError() + + 2, Initialize the buffer use one of these functions: + _BlocksOutputBuffer_InitAndGrow() + _BlocksOutputBuffer_InitWithSize() + + 3, If (avail_out == 0), grow the buffer: + _BlocksOutputBuffer_Grow() + + 4, Get the current outputted data size: + _BlocksOutputBuffer_GetDataSize() + + 5, Finish the buffer, and return a bytes object: + _BlocksOutputBuffer_Finish() + + 6, Clean up the buffer when an error occurred: + _BlocksOutputBuffer_OnError() +*/ + +#ifndef Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H +#define Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "Python.h" + +typedef struct { + // List of bytes objects + PyObject *list; + // Number of whole allocated size + Py_ssize_t allocated; + // Max length of the buffer, negative number means unlimited length. + Py_ssize_t max_length; +} _BlocksOutputBuffer; + +static const char unable_allocate_msg[] = "Unable to allocate output buffer."; + +/* In 32-bit build, the max block size should <= INT32_MAX. */ +#define OUTPUT_BUFFER_MAX_BLOCK_SIZE (256*1024*1024) + +/* Block size sequence */ +#define KB (1024) +#define MB (1024*1024) +static const Py_ssize_t BUFFER_BLOCK_SIZE[] = + { 32*KB, 64*KB, 256*KB, 1*MB, 4*MB, 8*MB, 16*MB, 16*MB, + 32*MB, 32*MB, 32*MB, 32*MB, 64*MB, 64*MB, 128*MB, 128*MB, + OUTPUT_BUFFER_MAX_BLOCK_SIZE }; +#undef KB +#undef MB + +/* According to the block sizes defined by BUFFER_BLOCK_SIZE, the whole + allocated size growth step is: + 1 32 KB +32 KB + 2 96 KB +64 KB + 3 352 KB +256 KB + 4 1.34 MB +1 MB + 5 5.34 MB +4 MB + 6 13.34 MB +8 MB + 7 29.34 MB +16 MB + 8 45.34 MB +16 MB + 9 77.34 MB +32 MB + 10 109.34 MB +32 MB + 11 141.34 MB +32 MB + 12 173.34 MB +32 MB + 13 237.34 MB +64 MB + 14 301.34 MB +64 MB + 15 429.34 MB +128 MB + 16 557.34 MB +128 MB + 17 813.34 MB +256 MB + 18 1069.34 MB +256 MB + 19 1325.34 MB +256 MB + 20 1581.34 MB +256 MB + 21 1837.34 MB +256 MB + 22 2093.34 MB +256 MB + ... +*/ + +/* Initialize the buffer, and grow the buffer. + + max_length: Max length of the buffer, -1 for unlimited length. + + On success, return allocated size (>=0) + On failure, return -1 +*/ +static inline Py_ssize_t +_BlocksOutputBuffer_InitAndGrow(_BlocksOutputBuffer *buffer, + const Py_ssize_t max_length, + void **next_out) +{ + PyObject *b; + Py_ssize_t block_size; + + // ensure .list was set to NULL + assert(buffer->list == NULL); + + // get block size + if (0 <= max_length && max_length < BUFFER_BLOCK_SIZE[0]) { + block_size = max_length; + } else { + block_size = BUFFER_BLOCK_SIZE[0]; + } + + // the first block + b = PyBytes_FromStringAndSize(NULL, block_size); + if (b == NULL) { + return -1; + } + + // create the list + buffer->list = PyList_New(1); + if (buffer->list == NULL) { + Py_DECREF(b); + return -1; + } + PyList_SET_ITEM(buffer->list, 0, b); + + // set variables + buffer->allocated = block_size; + buffer->max_length = max_length; + + *next_out = PyBytes_AS_STRING(b); + return block_size; +} + +/* Initialize the buffer, with an initial size. + + Check block size limit in the outer wrapper function. For example, some libs + accept UINT32_MAX as the maximum block size, then init_size should <= it. + + On success, return allocated size (>=0) + On failure, return -1 +*/ +static inline Py_ssize_t +_BlocksOutputBuffer_InitWithSize(_BlocksOutputBuffer *buffer, + const Py_ssize_t init_size, + void **next_out) +{ + PyObject *b; + + // ensure .list was set to NULL + assert(buffer->list == NULL); + + // the first block + b = PyBytes_FromStringAndSize(NULL, init_size); + if (b == NULL) { + PyErr_SetString(PyExc_MemoryError, unable_allocate_msg); + return -1; + } + + // create the list + buffer->list = PyList_New(1); + if (buffer->list == NULL) { + Py_DECREF(b); + return -1; + } + PyList_SET_ITEM(buffer->list, 0, b); + + // set variables + buffer->allocated = init_size; + buffer->max_length = -1; + + *next_out = PyBytes_AS_STRING(b); + return init_size; +} + +/* Grow the buffer. The avail_out must be 0, please check it before calling. + + On success, return allocated size (>=0) + On failure, return -1 +*/ +static inline Py_ssize_t +_BlocksOutputBuffer_Grow(_BlocksOutputBuffer *buffer, + void **next_out, + const Py_ssize_t avail_out) +{ + PyObject *b; + const Py_ssize_t list_len = Py_SIZE(buffer->list); + Py_ssize_t block_size; + + // ensure no gaps in the data + if (avail_out != 0) { + PyErr_SetString(PyExc_SystemError, + "avail_out is non-zero in _BlocksOutputBuffer_Grow()."); + return -1; + } + + // get block size + if (list_len < (Py_ssize_t) Py_ARRAY_LENGTH(BUFFER_BLOCK_SIZE)) { + block_size = BUFFER_BLOCK_SIZE[list_len]; + } else { + block_size = BUFFER_BLOCK_SIZE[Py_ARRAY_LENGTH(BUFFER_BLOCK_SIZE) - 1]; + } + + // check max_length + if (buffer->max_length >= 0) { + // if (rest == 0), should not grow the buffer. + Py_ssize_t rest = buffer->max_length - buffer->allocated; + assert(rest > 0); + + // block_size of the last block + if (block_size > rest) { + block_size = rest; + } + } + + // check buffer->allocated overflow + if (block_size > PY_SSIZE_T_MAX - buffer->allocated) { + PyErr_SetString(PyExc_MemoryError, unable_allocate_msg); + return -1; + } + + // create the block + b = PyBytes_FromStringAndSize(NULL, block_size); + if (b == NULL) { + PyErr_SetString(PyExc_MemoryError, unable_allocate_msg); + return -1; + } + if (PyList_Append(buffer->list, b) < 0) { + Py_DECREF(b); + return -1; + } + Py_DECREF(b); + + // set variables + buffer->allocated += block_size; + + *next_out = PyBytes_AS_STRING(b); + return block_size; +} + +/* Return the current outputted data size. */ +static inline Py_ssize_t +_BlocksOutputBuffer_GetDataSize(_BlocksOutputBuffer *buffer, + const Py_ssize_t avail_out) +{ + return buffer->allocated - avail_out; +} + +/* Finish the buffer. + + Return a bytes object on success + Return NULL on failure +*/ +static inline PyObject * +_BlocksOutputBuffer_Finish(_BlocksOutputBuffer *buffer, + const Py_ssize_t avail_out) +{ + PyObject *result, *block; + const Py_ssize_t list_len = Py_SIZE(buffer->list); + + // fast path for single block + if ((list_len == 1 && avail_out == 0) || + (list_len == 2 && Py_SIZE(PyList_GET_ITEM(buffer->list, 1)) == avail_out)) + { + block = PyList_GET_ITEM(buffer->list, 0); + Py_INCREF(block); + + Py_CLEAR(buffer->list); + return block; + } + + // final bytes object + result = PyBytes_FromStringAndSize(NULL, buffer->allocated - avail_out); + if (result == NULL) { + PyErr_SetString(PyExc_MemoryError, unable_allocate_msg); + return NULL; + } + + // memory copy + if (list_len > 0) { + char *posi = PyBytes_AS_STRING(result); + + // blocks except the last one + Py_ssize_t i = 0; + for (; i < list_len-1; i++) { + block = PyList_GET_ITEM(buffer->list, i); + memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block)); + posi += Py_SIZE(block); + } + // the last block + block = PyList_GET_ITEM(buffer->list, i); + memcpy(posi, PyBytes_AS_STRING(block), Py_SIZE(block) - avail_out); + } else { + assert(Py_SIZE(result) == 0); + } + + Py_CLEAR(buffer->list); + return result; +} + +/* Clean up the buffer when an error occurred. */ +static inline void +_BlocksOutputBuffer_OnError(_BlocksOutputBuffer *buffer) +{ + Py_CLEAR(buffer->list); +} + +#ifdef __cplusplus +} +#endif +#endif /* Py_INTERNAL_BLOCKS_OUTPUT_BUFFER_H */ \ No newline at end of file diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytes_methods.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytes_methods.h new file mode 100644 index 0000000000000000000000000000000000000000..11e8ab20e91367ced72b6c7660201f77a0230cd1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytes_methods.h @@ -0,0 +1,73 @@ +#ifndef Py_LIMITED_API +#ifndef Py_BYTES_CTYPE_H +#define Py_BYTES_CTYPE_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* + * The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray) + * methods of the given names, they operate on ASCII byte strings. + */ +extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isascii(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); + +/* These store their len sized answer in the given preallocated *result arg. */ +extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); +extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); +extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len); + +extern PyObject *_Py_bytes_find(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_index(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_rfind(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_rindex(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_count(const char *str, Py_ssize_t len, PyObject *args); +extern int _Py_bytes_contains(const char *str, Py_ssize_t len, PyObject *arg); +extern PyObject *_Py_bytes_startswith(const char *str, Py_ssize_t len, PyObject *args); +extern PyObject *_Py_bytes_endswith(const char *str, Py_ssize_t len, PyObject *args); + +/* The maketrans() static method. */ +extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); + +/* Shared __doc__ strings. */ +extern const char _Py_isspace__doc__[]; +extern const char _Py_isalpha__doc__[]; +extern const char _Py_isalnum__doc__[]; +extern const char _Py_isascii__doc__[]; +extern const char _Py_isdigit__doc__[]; +extern const char _Py_islower__doc__[]; +extern const char _Py_isupper__doc__[]; +extern const char _Py_istitle__doc__[]; +extern const char _Py_lower__doc__[]; +extern const char _Py_upper__doc__[]; +extern const char _Py_title__doc__[]; +extern const char _Py_capitalize__doc__[]; +extern const char _Py_swapcase__doc__[]; +extern const char _Py_count__doc__[]; +extern const char _Py_find__doc__[]; +extern const char _Py_index__doc__[]; +extern const char _Py_rfind__doc__[]; +extern const char _Py_rindex__doc__[]; +extern const char _Py_startswith__doc__[]; +extern const char _Py_endswith__doc__[]; +extern const char _Py_maketrans__doc__[]; +extern const char _Py_expandtabs__doc__[]; +extern const char _Py_ljust__doc__[]; +extern const char _Py_rjust__doc__[]; +extern const char _Py_center__doc__[]; +extern const char _Py_zfill__doc__[]; + +/* this is needed because some docs are shared from the .o, not static */ +#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) + +#endif /* !Py_BYTES_CTYPE_H */ +#endif /* !Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytesobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytesobject.h new file mode 100644 index 0000000000000000000000000000000000000000..9173a4f105f80084d3b8572d2277a7a44c1c3a5e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_bytesobject.h @@ -0,0 +1,52 @@ +#ifndef Py_INTERNAL_BYTESOBJECT_H +#define Py_INTERNAL_BYTESOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern PyStatus _PyBytes_InitTypes(PyInterpreterState *); + + +/* Substring Search. + + Returns the index of the first occurrence of + a substring ("needle") in a larger text ("haystack"). + If the needle is not found, return -1. + If the needle is found, add offset to the index. +*/ + +PyAPI_FUNC(Py_ssize_t) +_PyBytes_Find(const char *haystack, Py_ssize_t len_haystack, + const char *needle, Py_ssize_t len_needle, + Py_ssize_t offset); + +/* Same as above, but search right-to-left */ +PyAPI_FUNC(Py_ssize_t) +_PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack, + const char *needle, Py_ssize_t len_needle, + Py_ssize_t offset); + + +/** Helper function to implement the repeat and inplace repeat methods on a buffer + * + * len_dest is assumed to be an integer multiple of len_src. + * If src equals dest, then assume the operation is inplace. + * + * This method repeately doubles the number of bytes copied to reduce + * the number of invocations of memcpy. + */ +PyAPI_FUNC(void) +_PyBytes_Repeat(char* dest, Py_ssize_t len_dest, + const char* src, Py_ssize_t len_src); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_BYTESOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_call.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_call.h new file mode 100644 index 0000000000000000000000000000000000000000..3ccacfa0b8b0387a2aa83608e1f424741b3553cf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_call.h @@ -0,0 +1,121 @@ +#ifndef Py_INTERNAL_CALL_H +#define Py_INTERNAL_CALL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_pystate.h" // _PyThreadState_GET() + +PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( + PyThreadState *tstate, + PyObject *callable, + PyObject *obj, + PyObject *args, + PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyObject_FastCallDictTstate( + PyThreadState *tstate, + PyObject *callable, + PyObject *const *args, + size_t nargsf, + PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyObject_Call( + PyThreadState *tstate, + PyObject *callable, + PyObject *args, + PyObject *kwargs); + +extern PyObject * _PyObject_CallMethodFormat( + PyThreadState *tstate, PyObject *callable, const char *format, ...); + + +// Static inline variant of public PyVectorcall_Function(). +static inline vectorcallfunc +_PyVectorcall_FunctionInline(PyObject *callable) +{ + assert(callable != NULL); + + PyTypeObject *tp = Py_TYPE(callable); + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + + +/* Call the callable object 'callable' with the "vectorcall" calling + convention. + + args is a C array for positional arguments. + + nargsf is the number of positional arguments plus optionally the flag + PY_VECTORCALL_ARGUMENTS_OFFSET which means that the caller is allowed to + modify args[-1]. + + kwnames is a tuple of keyword names. The values of the keyword arguments + are stored in "args" after the positional arguments (note that the number + of keyword arguments does not change nargsf). kwnames can also be NULL if + there are no keyword arguments. + + keywords must only contain strings and all keys must be unique. + + Return the result on success. Raise an exception and return NULL on + error. */ +static inline PyObject * +_PyObject_VectorcallTstate(PyThreadState *tstate, PyObject *callable, + PyObject *const *args, size_t nargsf, + PyObject *kwnames) +{ + vectorcallfunc func; + PyObject *res; + + assert(kwnames == NULL || PyTuple_Check(kwnames)); + assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0); + + func = _PyVectorcall_FunctionInline(callable); + if (func == NULL) { + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwnames); + } + res = func(callable, args, nargsf, kwnames); + return _Py_CheckFunctionResult(tstate, callable, res, NULL); +} + + +static inline PyObject * +_PyObject_CallNoArgsTstate(PyThreadState *tstate, PyObject *func) { + return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL); +} + + +// Private static inline function variant of public PyObject_CallNoArgs() +static inline PyObject * +_PyObject_CallNoArgs(PyObject *func) { + PyThreadState *tstate = _PyThreadState_GET(); + return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL); +} + + +static inline PyObject * +_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func, PyObject *const *args, Py_ssize_t nargs) +{ + return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL); +} + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CALL_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ceval.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ceval.h new file mode 100644 index 0000000000000000000000000000000000000000..8d18d200aa4bf06c1209b2b8557ff11f98af3c79 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ceval.h @@ -0,0 +1,138 @@ +#ifndef Py_INTERNAL_CEVAL_H +#define Py_INTERNAL_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Forward declarations */ +struct pyruntimestate; +struct _ceval_runtime_state; + +/* WASI has limited call stack. Python's recursion limit depends on code + layout, optimization, and WASI runtime. Wasmtime can handle about 700-750 + recursions, sometimes less. 600 is a more conservative limit. */ +#ifndef Py_DEFAULT_RECURSION_LIMIT +# ifdef __wasi__ +# define Py_DEFAULT_RECURSION_LIMIT 600 +# else +# define Py_DEFAULT_RECURSION_LIMIT 1000 +# endif +#endif + +#include "pycore_interp.h" // PyInterpreterState.eval_frame +#include "pycore_pystate.h" // _PyThreadState_GET() + + +extern void _Py_FinishPendingCalls(PyThreadState *tstate); +extern void _PyEval_InitRuntimeState(struct _ceval_runtime_state *); +extern void _PyEval_InitState(struct _ceval_state *, PyThread_type_lock); +extern void _PyEval_FiniState(struct _ceval_state *ceval); +PyAPI_FUNC(void) _PyEval_SignalReceived(PyInterpreterState *interp); +PyAPI_FUNC(int) _PyEval_AddPendingCall( + PyInterpreterState *interp, + int (*func)(void *), + void *arg); +PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyInterpreterState *interp); +#ifdef HAVE_FORK +extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate); +#endif + +// Used by sys.call_tracing() +extern PyObject* _PyEval_CallTracing(PyObject *func, PyObject *args); + +// Used by sys.get_asyncgen_hooks() +extern PyObject* _PyEval_GetAsyncGenFirstiter(void); +extern PyObject* _PyEval_GetAsyncGenFinalizer(void); + +// Used by sys.set_asyncgen_hooks() +extern int _PyEval_SetAsyncGenFirstiter(PyObject *); +extern int _PyEval_SetAsyncGenFinalizer(PyObject *); + +// Used by sys.get_coroutine_origin_tracking_depth() +// and sys.set_coroutine_origin_tracking_depth() +extern int _PyEval_GetCoroutineOriginTrackingDepth(void); +extern int _PyEval_SetCoroutineOriginTrackingDepth(int depth); + +extern void _PyEval_Fini(void); + + +extern PyObject* _PyEval_GetBuiltins(PyThreadState *tstate); +extern PyObject* _PyEval_BuiltinsFromGlobals( + PyThreadState *tstate, + PyObject *globals); + + +static inline PyObject* +_PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag) +{ + if (tstate->interp->eval_frame == NULL) { + return _PyEval_EvalFrameDefault(tstate, frame, throwflag); + } + return tstate->interp->eval_frame(tstate, frame, throwflag); +} + +extern PyObject* +_PyEval_Vector(PyThreadState *tstate, + PyFunctionObject *func, PyObject *locals, + PyObject* const* args, size_t argcount, + PyObject *kwnames); + +extern int _PyEval_ThreadsInitialized(struct pyruntimestate *runtime); +extern PyStatus _PyEval_InitGIL(PyThreadState *tstate); +extern void _PyEval_FiniGIL(PyInterpreterState *interp); + +extern void _PyEval_ReleaseLock(PyThreadState *tstate); + +extern void _PyEval_DeactivateOpCache(void); + + +/* --- _Py_EnterRecursiveCall() ----------------------------------------- */ + +#ifdef USE_STACKCHECK +/* With USE_STACKCHECK macro defined, trigger stack checks in + _Py_CheckRecursiveCall() on every 64th call to _Py_EnterRecursiveCall. */ +static inline int _Py_MakeRecCheck(PyThreadState *tstate) { + return (tstate->recursion_remaining-- <= 0 + || (tstate->recursion_remaining & 63) == 0); +} +#else +static inline int _Py_MakeRecCheck(PyThreadState *tstate) { + return tstate->recursion_remaining-- <= 0; +} +#endif + +PyAPI_FUNC(int) _Py_CheckRecursiveCall( + PyThreadState *tstate, + const char *where); + +static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate, + const char *where) { + return (_Py_MakeRecCheck(tstate) && _Py_CheckRecursiveCall(tstate, where)); +} + +static inline int _Py_EnterRecursiveCall(const char *where) { + PyThreadState *tstate = _PyThreadState_GET(); + return _Py_EnterRecursiveCallTstate(tstate, where); +} + +static inline void _Py_LeaveRecursiveCallTstate(PyThreadState *tstate) { + tstate->recursion_remaining++; +} + +static inline void _Py_LeaveRecursiveCall(void) { + PyThreadState *tstate = _PyThreadState_GET(); + _Py_LeaveRecursiveCallTstate(tstate); +} + +extern struct _PyInterpreterFrame* _PyEval_GetFrame(void); + +extern PyObject* _Py_MakeCoro(PyFunctionObject *func); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CEVAL_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_code.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_code.h new file mode 100644 index 0000000000000000000000000000000000000000..3a24a65426985e67afd2a0affddb16e0a564af8a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_code.h @@ -0,0 +1,564 @@ +#ifndef Py_INTERNAL_CODE_H +#define Py_INTERNAL_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* PEP 659 + * Specialization and quickening structs and helper functions + */ + + +// Inline caches. If you change the number of cache entries for an instruction, +// you must *also* update the number of cache entries in Lib/opcode.py and bump +// the magic number in Lib/importlib/_bootstrap_external.py! + +#define CACHE_ENTRIES(cache) (sizeof(cache)/sizeof(_Py_CODEUNIT)) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT index; + _Py_CODEUNIT module_keys_version[2]; + _Py_CODEUNIT builtin_keys_version; +} _PyLoadGlobalCache; + +#define INLINE_CACHE_ENTRIES_LOAD_GLOBAL CACHE_ENTRIES(_PyLoadGlobalCache) + +typedef struct { + _Py_CODEUNIT counter; +} _PyBinaryOpCache; + +#define INLINE_CACHE_ENTRIES_BINARY_OP CACHE_ENTRIES(_PyBinaryOpCache) + +typedef struct { + _Py_CODEUNIT counter; +} _PyUnpackSequenceCache; + +#define INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE \ + CACHE_ENTRIES(_PyUnpackSequenceCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT mask; +} _PyCompareOpCache; + +#define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT type_version[2]; + _Py_CODEUNIT func_version; +} _PyBinarySubscrCache; + +#define INLINE_CACHE_ENTRIES_BINARY_SUBSCR CACHE_ENTRIES(_PyBinarySubscrCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT version[2]; + _Py_CODEUNIT index; +} _PyAttrCache; + +#define INLINE_CACHE_ENTRIES_LOAD_ATTR CACHE_ENTRIES(_PyAttrCache) + +#define INLINE_CACHE_ENTRIES_STORE_ATTR CACHE_ENTRIES(_PyAttrCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT type_version[2]; + _Py_CODEUNIT dict_offset; + _Py_CODEUNIT keys_version[2]; + _Py_CODEUNIT descr[4]; +} _PyLoadMethodCache; + +#define INLINE_CACHE_ENTRIES_LOAD_METHOD CACHE_ENTRIES(_PyLoadMethodCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT func_version[2]; + _Py_CODEUNIT min_args; +} _PyCallCache; + +#define INLINE_CACHE_ENTRIES_CALL CACHE_ENTRIES(_PyCallCache) + +typedef struct { + _Py_CODEUNIT counter; +} _PyPrecallCache; + +#define INLINE_CACHE_ENTRIES_PRECALL CACHE_ENTRIES(_PyPrecallCache) + +typedef struct { + _Py_CODEUNIT counter; +} _PyStoreSubscrCache; + +#define INLINE_CACHE_ENTRIES_STORE_SUBSCR CACHE_ENTRIES(_PyStoreSubscrCache) + +#define QUICKENING_WARMUP_DELAY 8 + +/* We want to compare to zero for efficiency, so we offset values accordingly */ +#define QUICKENING_INITIAL_WARMUP_VALUE (-QUICKENING_WARMUP_DELAY) + +void _PyCode_Quicken(PyCodeObject *code); + +static inline void +_PyCode_Warmup(PyCodeObject *code) +{ + if (code->co_warmup != 0) { + code->co_warmup++; + if (code->co_warmup == 0) { + _PyCode_Quicken(code); + } + } +} + +extern uint8_t _PyOpcode_Adaptive[256]; + +extern Py_ssize_t _Py_QuickenedCount; + +// Borrowed references to common callables: +struct callable_cache { + PyObject *isinstance; + PyObject *len; + PyObject *list_append; +}; + +/* "Locals plus" for a code object is the set of locals + cell vars + + * free vars. This relates to variable names as well as offsets into + * the "fast locals" storage array of execution frames. The compiler + * builds the list of names, their offsets, and the corresponding + * kind of local. + * + * Those kinds represent the source of the initial value and the + * variable's scope (as related to closures). A "local" is an + * argument or other variable defined in the current scope. A "free" + * variable is one that is defined in an outer scope and comes from + * the function's closure. A "cell" variable is a local that escapes + * into an inner function as part of a closure, and thus must be + * wrapped in a cell. Any "local" can also be a "cell", but the + * "free" kind is mutually exclusive with both. + */ + +// Note that these all fit within a byte, as do combinations. +// Later, we will use the smaller numbers to differentiate the different +// kinds of locals (e.g. pos-only arg, varkwargs, local-only). +#define CO_FAST_LOCAL 0x20 +#define CO_FAST_CELL 0x40 +#define CO_FAST_FREE 0x80 + +typedef unsigned char _PyLocals_Kind; + +static inline _PyLocals_Kind +_PyLocals_GetKind(PyObject *kinds, int i) +{ + assert(PyBytes_Check(kinds)); + assert(0 <= i && i < PyBytes_GET_SIZE(kinds)); + char *ptr = PyBytes_AS_STRING(kinds); + return (_PyLocals_Kind)(ptr[i]); +} + +static inline void +_PyLocals_SetKind(PyObject *kinds, int i, _PyLocals_Kind kind) +{ + assert(PyBytes_Check(kinds)); + assert(0 <= i && i < PyBytes_GET_SIZE(kinds)); + char *ptr = PyBytes_AS_STRING(kinds); + ptr[i] = (char) kind; +} + + +struct _PyCodeConstructor { + /* metadata */ + PyObject *filename; + PyObject *name; + PyObject *qualname; + int flags; + + /* the code */ + PyObject *code; + int firstlineno; + PyObject *linetable; + + /* used by the code */ + PyObject *consts; + PyObject *names; + + /* mapping frame offsets to information */ + PyObject *localsplusnames; // Tuple of strings + PyObject *localspluskinds; // Bytes object, one byte per variable + + /* args (within varnames) */ + int argcount; + int posonlyargcount; + // XXX Replace argcount with posorkwargcount (argcount - posonlyargcount). + int kwonlyargcount; + + /* needed to create the frame */ + int stacksize; + + /* used by the eval loop */ + PyObject *exceptiontable; +}; + +// Using an "arguments struct" like this is helpful for maintainability +// in a case such as this with many parameters. It does bear a risk: +// if the struct changes and callers are not updated properly then the +// compiler will not catch problems (like a missing argument). This can +// cause hard-to-debug problems. The risk is mitigated by the use of +// check_code() in codeobject.c. However, we may decide to switch +// back to a regular function signature. Regardless, this approach +// wouldn't be appropriate if this weren't a strictly internal API. +// (See the comments in https://github.com/python/cpython/pull/26258.) +PyAPI_FUNC(int) _PyCode_Validate(struct _PyCodeConstructor *); +PyAPI_FUNC(PyCodeObject *) _PyCode_New(struct _PyCodeConstructor *); + + +/* Private API */ + +/* Getters for internal PyCodeObject data. */ +extern PyObject* _PyCode_GetVarnames(PyCodeObject *); +extern PyObject* _PyCode_GetCellvars(PyCodeObject *); +extern PyObject* _PyCode_GetFreevars(PyCodeObject *); +extern PyObject* _PyCode_GetCode(PyCodeObject *); + +/** API for initializing the line number tables. */ +extern int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds); + +/** Out of process API for initializing the location table. */ +extern void _PyLineTable_InitAddressRange( + const char *linetable, + Py_ssize_t length, + int firstlineno, + PyCodeAddressRange *range); + +/** API for traversing the line number table. */ +extern int _PyLineTable_NextAddressRange(PyCodeAddressRange *range); +extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range); + +/* Specialization functions */ + +extern int _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, + PyObject *name); +extern int _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, + PyObject *name); +extern int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNIT *instr, PyObject *name); +extern int _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, + PyObject *name); +extern int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr); +extern int _Py_Specialize_StoreSubscr(PyObject *container, PyObject *sub, _Py_CODEUNIT *instr); +extern int _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, + int nargs, PyObject *kwnames); +extern int _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, + int nargs, PyObject *kwnames, int oparg); +extern void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, + int oparg, PyObject **locals); +extern void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, + _Py_CODEUNIT *instr, int oparg); +extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, + int oparg); + +/* Deallocator function for static codeobjects used in deepfreeze.py */ +extern void _PyStaticCode_Dealloc(PyCodeObject *co); +/* Function to intern strings of codeobjects */ +extern int _PyStaticCode_InternStrings(PyCodeObject *co); + +#ifdef Py_STATS + +#define SPECIALIZATION_FAILURE_KINDS 30 + +typedef struct _specialization_stats { + uint64_t success; + uint64_t failure; + uint64_t hit; + uint64_t deferred; + uint64_t miss; + uint64_t deopt; + uint64_t failure_kinds[SPECIALIZATION_FAILURE_KINDS]; +} SpecializationStats; + +typedef struct _opcode_stats { + SpecializationStats specialization; + uint64_t execution_count; + uint64_t pair_count[256]; +} OpcodeStats; + +typedef struct _call_stats { + uint64_t inlined_py_calls; + uint64_t pyeval_calls; + uint64_t frames_pushed; + uint64_t frame_objects_created; +} CallStats; + +typedef struct _object_stats { + uint64_t allocations; + uint64_t allocations512; + uint64_t allocations4k; + uint64_t allocations_big; + uint64_t frees; + uint64_t to_freelist; + uint64_t from_freelist; + uint64_t new_values; + uint64_t dict_materialized_on_request; + uint64_t dict_materialized_new_key; + uint64_t dict_materialized_too_big; + uint64_t dict_materialized_str_subclass; +} ObjectStats; + +typedef struct _stats { + OpcodeStats opcode_stats[256]; + CallStats call_stats; + ObjectStats object_stats; +} PyStats; + +extern PyStats _py_stats; + +#define STAT_INC(opname, name) _py_stats.opcode_stats[opname].specialization.name++ +#define STAT_DEC(opname, name) _py_stats.opcode_stats[opname].specialization.name-- +#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[opname].execution_count++ +#define CALL_STAT_INC(name) _py_stats.call_stats.name++ +#define OBJECT_STAT_INC(name) _py_stats.object_stats.name++ +#define OBJECT_STAT_INC_COND(name, cond) \ + do { if (cond) _py_stats.object_stats.name++; } while (0) + +extern void _Py_PrintSpecializationStats(int to_file); + +// Used by the _opcode extension which is built as a shared library +PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); + +#else +#define STAT_INC(opname, name) ((void)0) +#define STAT_DEC(opname, name) ((void)0) +#define OPCODE_EXE_INC(opname) ((void)0) +#define CALL_STAT_INC(name) ((void)0) +#define OBJECT_STAT_INC(name) ((void)0) +#define OBJECT_STAT_INC_COND(name, cond) ((void)0) +#endif // !Py_STATS + +// Cache values are only valid in memory, so use native endianness. +#ifdef WORDS_BIGENDIAN + +static inline void +write_u32(uint16_t *p, uint32_t val) +{ + p[0] = (uint16_t)(val >> 16); + p[1] = (uint16_t)(val >> 0); +} + +static inline void +write_u64(uint16_t *p, uint64_t val) +{ + p[0] = (uint16_t)(val >> 48); + p[1] = (uint16_t)(val >> 32); + p[2] = (uint16_t)(val >> 16); + p[3] = (uint16_t)(val >> 0); +} + +static inline uint32_t +read_u32(uint16_t *p) +{ + uint32_t val = 0; + val |= (uint32_t)p[0] << 16; + val |= (uint32_t)p[1] << 0; + return val; +} + +static inline uint64_t +read_u64(uint16_t *p) +{ + uint64_t val = 0; + val |= (uint64_t)p[0] << 48; + val |= (uint64_t)p[1] << 32; + val |= (uint64_t)p[2] << 16; + val |= (uint64_t)p[3] << 0; + return val; +} + +#else + +static inline void +write_u32(uint16_t *p, uint32_t val) +{ + p[0] = (uint16_t)(val >> 0); + p[1] = (uint16_t)(val >> 16); +} + +static inline void +write_u64(uint16_t *p, uint64_t val) +{ + p[0] = (uint16_t)(val >> 0); + p[1] = (uint16_t)(val >> 16); + p[2] = (uint16_t)(val >> 32); + p[3] = (uint16_t)(val >> 48); +} + +static inline uint32_t +read_u32(uint16_t *p) +{ + uint32_t val = 0; + val |= (uint32_t)p[0] << 0; + val |= (uint32_t)p[1] << 16; + return val; +} + +static inline uint64_t +read_u64(uint16_t *p) +{ + uint64_t val = 0; + val |= (uint64_t)p[0] << 0; + val |= (uint64_t)p[1] << 16; + val |= (uint64_t)p[2] << 32; + val |= (uint64_t)p[3] << 48; + return val; +} + +#endif + +static inline void +write_obj(uint16_t *p, PyObject *obj) +{ + uintptr_t val = (uintptr_t)obj; +#if SIZEOF_VOID_P == 8 + write_u64(p, val); +#elif SIZEOF_VOID_P == 4 + write_u32(p, val); +#else + #error "SIZEOF_VOID_P must be 4 or 8" +#endif +} + +static inline PyObject * +read_obj(uint16_t *p) +{ + uintptr_t val; +#if SIZEOF_VOID_P == 8 + val = read_u64(p); +#elif SIZEOF_VOID_P == 4 + val = read_u32(p); +#else + #error "SIZEOF_VOID_P must be 4 or 8" +#endif + return (PyObject *)val; +} + +/* See Objects/exception_handling_notes.txt for details. + */ +static inline unsigned char * +parse_varint(unsigned char *p, int *result) { + int val = p[0] & 63; + while (p[0] & 64) { + p++; + val = (val << 6) | (p[0] & 63); + } + *result = val; + return p+1; +} + +static inline int +write_varint(uint8_t *ptr, unsigned int val) +{ + int written = 1; + while (val >= 64) { + *ptr++ = 64 | (val & 63); + val >>= 6; + written++; + } + *ptr = val; + return written; +} + +static inline int +write_signed_varint(uint8_t *ptr, int val) +{ + if (val < 0) { + val = ((-val)<<1) | 1; + } + else { + val = val << 1; + } + return write_varint(ptr, val); +} + +static inline int +write_location_entry_start(uint8_t *ptr, int code, int length) +{ + assert((code & 15) == code); + *ptr = 128 | (code << 3) | (length - 1); + return 1; +} + + +/** Counters + * The first 16-bit value in each inline cache is a counter. + * When counting misses, the counter is treated as a simple unsigned value. + * + * When counting executions until the next specialization attempt, + * exponential backoff is used to reduce the number of specialization failures. + * The high 12 bits store the counter, the low 4 bits store the backoff exponent. + * On a specialization failure, the backoff exponent is incremented and the + * counter set to (2**backoff - 1). + * Backoff == 6 -> starting counter == 63, backoff == 10 -> starting counter == 1023. + */ + +/* With a 16-bit counter, we have 12 bits for the counter value, and 4 bits for the backoff */ +#define ADAPTIVE_BACKOFF_BITS 4 +/* The initial counter value is 31 == 2**ADAPTIVE_BACKOFF_START - 1 */ +#define ADAPTIVE_BACKOFF_START 5 + +#define MAX_BACKOFF_VALUE (16 - ADAPTIVE_BACKOFF_BITS) + + +static inline uint16_t +adaptive_counter_bits(int value, int backoff) { + return (value << ADAPTIVE_BACKOFF_BITS) | + (backoff & ((1< MAX_BACKOFF_VALUE) { + backoff = MAX_BACKOFF_VALUE; + } + unsigned int value = (1 << backoff) - 1; + return adaptive_counter_bits(value, backoff); +} + + +/* Line array cache for tracing */ + +extern int _PyCode_CreateLineArray(PyCodeObject *co); + +static inline int +_PyCode_InitLineArray(PyCodeObject *co) +{ + if (co->_co_linearray) { + return 0; + } + return _PyCode_CreateLineArray(co); +} + +static inline int +_PyCode_LineNumberFromArray(PyCodeObject *co, int index) +{ + assert(co->_co_linearray != NULL); + assert(index >= 0); + assert(index < Py_SIZE(co)); + if (co->_co_linearray_entry_size == 2) { + return ((int16_t *)co->_co_linearray)[index]; + } + else { + assert(co->_co_linearray_entry_size == 4); + return ((int32_t *)co->_co_linearray)[index]; + } +} + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CODE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_compile.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_compile.h new file mode 100644 index 0000000000000000000000000000000000000000..06a6082cddae6a3e01836988de9baa0463ed28ca --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_compile.h @@ -0,0 +1,44 @@ +#ifndef Py_INTERNAL_COMPILE_H +#define Py_INTERNAL_COMPILE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +struct _arena; // Type defined in pycore_pyarena.h +struct _mod; // Type defined in pycore_ast.h + +// Export the symbol for test_peg_generator (built as a library) +PyAPI_FUNC(PyCodeObject*) _PyAST_Compile( + struct _mod *mod, + PyObject *filename, + PyCompilerFlags *flags, + int optimize, + struct _arena *arena); +extern PyFutureFeatures* _PyFuture_FromAST( + struct _mod * mod, + PyObject *filename + ); + +extern PyObject* _Py_Mangle(PyObject *p, PyObject *name); + +typedef struct { + int optimize; + int ff_features; + + int recursion_depth; /* current recursion depth */ + int recursion_limit; /* recursion limit */ +} _PyASTOptimizeState; + +extern int _PyAST_Optimize( + struct _mod *, + struct _arena *arena, + _PyASTOptimizeState *state); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_COMPILE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_condvar.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_condvar.h new file mode 100644 index 0000000000000000000000000000000000000000..981c962bf7dfdfa31fd774550394efc5702d74dc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_condvar.h @@ -0,0 +1,97 @@ +#ifndef Py_INTERNAL_CONDVAR_H +#define Py_INTERNAL_CONDVAR_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#ifndef _POSIX_THREADS +/* This means pthreads are not implemented in libc headers, hence the macro + not present in unistd.h. But they still can be implemented as an external + library (e.g. gnu pth in pthread emulation) */ +# ifdef HAVE_PTHREAD_H +# include /* _POSIX_THREADS */ +# endif +#endif + +#ifdef _POSIX_THREADS +/* + * POSIX support + */ +#define Py_HAVE_CONDVAR + +#ifdef HAVE_PTHREAD_H +# include +#endif + +#define PyMUTEX_T pthread_mutex_t +#define PyCOND_T pthread_cond_t + +#elif defined(NT_THREADS) +/* + * Windows (XP, 2003 server and later, as well as (hopefully) CE) support + * + * Emulated condition variables ones that work with XP and later, plus + * example native support on VISTA and onwards. + */ +#define Py_HAVE_CONDVAR + +/* include windows if it hasn't been done before */ +#define WIN32_LEAN_AND_MEAN +#include + +/* options */ +/* non-emulated condition variables are provided for those that want + * to target Windows Vista. Modify this macro to enable them. + */ +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ +#endif + +/* fall back to emulation if not targeting Vista */ +#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif + +#if _PY_EMULATED_WIN_CV + +typedef CRITICAL_SECTION PyMUTEX_T; + +/* The ConditionVariable object. From XP onwards it is easily emulated + with a Semaphore. + Semaphores are available on Windows XP (2003 server) and later. + We use a Semaphore rather than an auto-reset event, because although + an auto-reset event might appear to solve the lost-wakeup bug (race + condition between releasing the outer lock and waiting) because it + maintains state even though a wait hasn't happened, there is still + a lost wakeup problem if more than one thread are interrupted in the + critical place. A semaphore solves that, because its state is + counted, not Boolean. + Because it is ok to signal a condition variable with no one + waiting, we need to keep track of the number of + waiting threads. Otherwise, the semaphore's state could rise + without bound. This also helps reduce the number of "spurious wakeups" + that would otherwise happen. + */ + +typedef struct _PyCOND_T +{ + HANDLE sem; + int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ +} PyCOND_T; + +#else /* !_PY_EMULATED_WIN_CV */ + +/* Use native Win7 primitives if build target is Win7 or higher */ + +/* SRWLOCK is faster and better than CriticalSection */ +typedef SRWLOCK PyMUTEX_T; + +typedef CONDITION_VARIABLE PyCOND_T; + +#endif /* _PY_EMULATED_WIN_CV */ + +#endif /* _POSIX_THREADS, NT_THREADS */ + +#endif /* Py_INTERNAL_CONDVAR_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_context.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_context.h new file mode 100644 index 0000000000000000000000000000000000000000..1bf4e8f3ee532e450a3b2a3919f894fa314620ed --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_context.h @@ -0,0 +1,67 @@ +#ifndef Py_INTERNAL_CONTEXT_H +#define Py_INTERNAL_CONTEXT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_hamt.h" /* PyHamtObject */ + + +extern PyTypeObject _PyContextTokenMissing_Type; + +/* runtime lifecycle */ + +PyStatus _PyContext_Init(PyInterpreterState *); +void _PyContext_Fini(PyInterpreterState *); + + +/* other API */ + +#ifndef WITH_FREELISTS +// without freelists +# define PyContext_MAXFREELIST 0 +#endif + +#ifndef PyContext_MAXFREELIST +# define PyContext_MAXFREELIST 255 +#endif + +struct _Py_context_state { +#if PyContext_MAXFREELIST > 0 + // List of free PyContext objects + PyContext *freelist; + int numfree; +#endif +}; + +struct _pycontextobject { + PyObject_HEAD + PyContext *ctx_prev; + PyHamtObject *ctx_vars; + PyObject *ctx_weakreflist; + int ctx_entered; +}; + + +struct _pycontextvarobject { + PyObject_HEAD + PyObject *var_name; + PyObject *var_default; + PyObject *var_cached; + uint64_t var_cached_tsid; + uint64_t var_cached_tsver; + Py_hash_t var_hash; +}; + + +struct _pycontexttokenobject { + PyObject_HEAD + PyContext *tok_ctx; + PyContextVar *tok_var; + PyObject *tok_oldval; + int tok_used; +}; + + +#endif /* !Py_INTERNAL_CONTEXT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dict.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dict.h new file mode 100644 index 0000000000000000000000000000000000000000..dc308fe5e2184a90a1c496a500635f1c07f3b66c --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dict.h @@ -0,0 +1,178 @@ + +#ifndef Py_INTERNAL_DICT_H +#define Py_INTERNAL_DICT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern void _PyDict_Fini(PyInterpreterState *interp); + + +/* other API */ + +#ifndef WITH_FREELISTS +// without freelists +# define PyDict_MAXFREELIST 0 +#endif + +#ifndef PyDict_MAXFREELIST +# define PyDict_MAXFREELIST 80 +#endif + +struct _Py_dict_state { +#if PyDict_MAXFREELIST > 0 + /* Dictionary reuse scheme to save calls to malloc and free */ + PyDictObject *free_list[PyDict_MAXFREELIST]; + int numfree; + PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST]; + int keys_numfree; +#endif +}; + +typedef struct { + /* Cached hash code of me_key. */ + Py_hash_t me_hash; + PyObject *me_key; + PyObject *me_value; /* This field is only meaningful for combined tables */ +} PyDictKeyEntry; + +typedef struct { + PyObject *me_key; /* The key must be Unicode and have hash. */ + PyObject *me_value; /* This field is only meaningful for combined tables */ +} PyDictUnicodeEntry; + +extern PyDictKeysObject *_PyDict_NewKeysForClass(void); +extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); + +/* Gets a version number unique to the current state of the keys of dict, if possible. + * Returns the version number, or zero if it was not possible to get a version number. */ +extern uint32_t _PyDictKeys_GetVersionForCurrentState(PyDictKeysObject *dictkeys); + +extern Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); + +/* _Py_dict_lookup() returns index of entry which can be used like DK_ENTRIES(dk)[index]. + * -1 when no entry found, -3 when compare raises error. + */ +extern Py_ssize_t _Py_dict_lookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr); + +extern Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **); +extern Py_ssize_t _PyDictKeys_StringLookup(PyDictKeysObject* dictkeys, PyObject *key); +extern PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *); + +/* Consumes references to key and value */ +extern int _PyDict_SetItem_Take2(PyDictObject *op, PyObject *key, PyObject *value); +extern int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value); + +extern PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *); + +#define DKIX_EMPTY (-1) +#define DKIX_DUMMY (-2) /* Used internally */ +#define DKIX_ERROR (-3) +#define DKIX_KEY_CHANGED (-4) /* Used internally */ + +typedef enum { + DICT_KEYS_GENERAL = 0, + DICT_KEYS_UNICODE = 1, + DICT_KEYS_SPLIT = 2 +} DictKeysKind; + +/* See dictobject.c for actual layout of DictKeysObject */ +struct _dictkeysobject { + Py_ssize_t dk_refcnt; + + /* Size of the hash table (dk_indices). It must be a power of 2. */ + uint8_t dk_log2_size; + + /* Size of the hash table (dk_indices) by bytes. */ + uint8_t dk_log2_index_bytes; + + /* Kind of keys */ + uint8_t dk_kind; + + /* Version number -- Reset to 0 by any modification to keys */ + uint32_t dk_version; + + /* Number of usable entries in dk_entries. */ + Py_ssize_t dk_usable; + + /* Number of used entries in dk_entries. */ + Py_ssize_t dk_nentries; + + /* Actual hash table of dk_size entries. It holds indices in dk_entries, + or DKIX_EMPTY(-1) or DKIX_DUMMY(-2). + + Indices must be: 0 <= indice < USABLE_FRACTION(dk_size). + + The size in bytes of an indice depends on dk_size: + + - 1 byte if dk_size <= 0xff (char*) + - 2 bytes if dk_size <= 0xffff (int16_t*) + - 4 bytes if dk_size <= 0xffffffff (int32_t*) + - 8 bytes otherwise (int64_t*) + + Dynamically sized, SIZEOF_VOID_P is minimum. */ + char dk_indices[]; /* char is required to avoid strict aliasing. */ + + /* "PyDictKeyEntry or PyDictUnicodeEntry dk_entries[USABLE_FRACTION(DK_SIZE(dk))];" array follows: + see the DK_ENTRIES() macro */ +}; + +/* This must be no more than 250, for the prefix size to fit in one byte. */ +#define SHARED_KEYS_MAX_SIZE 30 +#define NEXT_LOG2_SHARED_KEYS_MAX_SIZE 6 + +/* Layout of dict values: + * + * The PyObject *values are preceded by an array of bytes holding + * the insertion order and size. + * [-1] = prefix size. [-2] = used size. size[-2-n...] = insertion order. + */ +struct _dictvalues { + PyObject *values[1]; +}; + +#define DK_LOG_SIZE(dk) ((dk)->dk_log2_size) +#if SIZEOF_VOID_P > 4 +#define DK_SIZE(dk) (((int64_t)1)<dk_kind == DICT_KEYS_GENERAL), (PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[(size_t)1 << (dk)->dk_log2_index_bytes])) +#define DK_UNICODE_ENTRIES(dk) \ + (assert(dk->dk_kind != DICT_KEYS_GENERAL), (PyDictUnicodeEntry*)(&((int8_t*)((dk)->dk_indices))[(size_t)1 << (dk)->dk_log2_index_bytes])) +#define DK_IS_UNICODE(dk) ((dk)->dk_kind != DICT_KEYS_GENERAL) + +extern uint64_t _pydict_global_version; + +#define DICT_NEXT_VERSION() (++_pydict_global_version) + +extern PyObject *_PyObject_MakeDictFromInstanceAttributes(PyObject *obj, PyDictValues *values); +extern PyObject *_PyDict_FromItems( + PyObject *const *keys, Py_ssize_t keys_offset, + PyObject *const *values, Py_ssize_t values_offset, + Py_ssize_t length); + +static inline void +_PyDictValues_AddToInsertionOrder(PyDictValues *values, Py_ssize_t ix) +{ + assert(ix < SHARED_KEYS_MAX_SIZE); + uint8_t *size_ptr = ((uint8_t *)values)-2; + int size = *size_ptr; + assert(size+2 < ((uint8_t *)values)[-1]); + size++; + size_ptr[-size] = (uint8_t)ix; + *size_ptr = size; +} + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_DICT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dtoa.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dtoa.h new file mode 100644 index 0000000000000000000000000000000000000000..c77cf6e46cc3c369c8df96104fd1d860b970dff3 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_dtoa.h @@ -0,0 +1,28 @@ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR + + +#if _PY_SHORT_FLOAT_REPR == 1 + +/* These functions are used by modules compiled as C extension like math: + they must be exported. */ + +PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); +PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, + int *decpt, int *sign, char **rve); +PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); +PyAPI_FUNC(double) _Py_dg_stdnan(int sign); +PyAPI_FUNC(double) _Py_dg_infinity(int sign); + +#endif // _PY_SHORT_FLOAT_REPR == 1 + +#ifdef __cplusplus +} +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_emscripten_signal.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_emscripten_signal.h new file mode 100644 index 0000000000000000000000000000000000000000..8b3287d85da4b2e313b7bed953953f1eb0743ecb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_emscripten_signal.h @@ -0,0 +1,25 @@ +#ifndef Py_EMSCRIPTEN_SIGNAL_H +#define Py_EMSCRIPTEN_SIGNAL_H + +#if defined(__EMSCRIPTEN__) + +void +_Py_CheckEmscriptenSignals(void); + +void +_Py_CheckEmscriptenSignalsPeriodically(void); + +#define _Py_CHECK_EMSCRIPTEN_SIGNALS() _Py_CheckEmscriptenSignals() + +#define _Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY() _Py_CheckEmscriptenSignalsPeriodically() + +extern int Py_EMSCRIPTEN_SIGNAL_HANDLING; + +#else + +#define _Py_CHECK_EMSCRIPTEN_SIGNALS() +#define _Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY() + +#endif // defined(__EMSCRIPTEN__) + +#endif // ndef Py_EMSCRIPTEN_SIGNAL_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_exceptions.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_exceptions.h new file mode 100644 index 0000000000000000000000000000000000000000..4a9df709131998a1a74cb433626c391426a43efd --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_exceptions.h @@ -0,0 +1,37 @@ +#ifndef Py_INTERNAL_EXCEPTIONS_H +#define Py_INTERNAL_EXCEPTIONS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern PyStatus _PyExc_InitState(PyInterpreterState *); +extern PyStatus _PyExc_InitGlobalObjects(PyInterpreterState *); +extern int _PyExc_InitTypes(PyInterpreterState *); +extern void _PyExc_Fini(PyInterpreterState *); + + +/* other API */ + +struct _Py_exc_state { + // The dict mapping from errno codes to OSError subclasses + PyObject *errnomap; + PyBaseExceptionObject *memerrors_freelist; + int memerrors_numfree; + // The ExceptionGroup type + PyObject *PyExc_ExceptionGroup; +}; + +extern void _PyExc_ClearExceptionGroupType(PyInterpreterState *); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_EXCEPTIONS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_fileutils.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_fileutils.h new file mode 100644 index 0000000000000000000000000000000000000000..332cc30365b9e2f9086e724a62f4e78d4be98c62 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_fileutils.h @@ -0,0 +1,276 @@ +#ifndef Py_INTERNAL_FILEUTILS_H +#define Py_INTERNAL_FILEUTILS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "Py_BUILD_CORE must be defined to include this header" +#endif + +#include /* struct lconv */ + +typedef enum { + _Py_ERROR_UNKNOWN=0, + _Py_ERROR_STRICT, + _Py_ERROR_SURROGATEESCAPE, + _Py_ERROR_REPLACE, + _Py_ERROR_IGNORE, + _Py_ERROR_BACKSLASHREPLACE, + _Py_ERROR_SURROGATEPASS, + _Py_ERROR_XMLCHARREFREPLACE, + _Py_ERROR_OTHER +} _Py_error_handler; + +PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors); + +PyAPI_FUNC(int) _Py_DecodeLocaleEx( + const char *arg, + wchar_t **wstr, + size_t *wlen, + const char **reason, + int current_locale, + _Py_error_handler errors); + +PyAPI_FUNC(int) _Py_EncodeLocaleEx( + const wchar_t *text, + char **str, + size_t *error_pos, + const char **reason, + int current_locale, + _Py_error_handler errors); + +PyAPI_FUNC(char*) _Py_EncodeLocaleRaw( + const wchar_t *text, + size_t *error_pos); + +PyAPI_FUNC(PyObject *) _Py_device_encoding(int); + +#if defined(MS_WINDOWS) || defined(__APPLE__) + /* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611). + On macOS 10.13, read() and write() with more than INT_MAX bytes + fail with EINVAL (bpo-24658). */ +# define _PY_READ_MAX INT_MAX +# define _PY_WRITE_MAX INT_MAX +#else + /* write() should truncate the input to PY_SSIZE_T_MAX bytes, + but it's safer to do it ourself to have a portable behaviour */ +# define _PY_READ_MAX PY_SSIZE_T_MAX +# define _PY_WRITE_MAX PY_SSIZE_T_MAX +#endif + +#ifdef MS_WINDOWS +struct _Py_stat_struct { + unsigned long st_dev; + uint64_t st_ino; + unsigned short st_mode; + int st_nlink; + int st_uid; + int st_gid; + unsigned long st_rdev; + __int64 st_size; + time_t st_atime; + int st_atime_nsec; + time_t st_mtime; + int st_mtime_nsec; + time_t st_ctime; + int st_ctime_nsec; + unsigned long st_file_attributes; + unsigned long st_reparse_tag; +}; +#else +# define _Py_stat_struct stat +#endif + +PyAPI_FUNC(int) _Py_fstat( + int fd, + struct _Py_stat_struct *status); + +PyAPI_FUNC(int) _Py_fstat_noraise( + int fd, + struct _Py_stat_struct *status); + +PyAPI_FUNC(int) _Py_stat( + PyObject *path, + struct stat *status); + +PyAPI_FUNC(int) _Py_open( + const char *pathname, + int flags); + +PyAPI_FUNC(int) _Py_open_noraise( + const char *pathname, + int flags); + +PyAPI_FUNC(FILE *) _Py_wfopen( + const wchar_t *path, + const wchar_t *mode); + +PyAPI_FUNC(Py_ssize_t) _Py_read( + int fd, + void *buf, + size_t count); + +PyAPI_FUNC(Py_ssize_t) _Py_write( + int fd, + const void *buf, + size_t count); + +PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( + int fd, + const void *buf, + size_t count); + +#ifdef HAVE_READLINK +PyAPI_FUNC(int) _Py_wreadlink( + const wchar_t *path, + wchar_t *buf, + /* Number of characters of 'buf' buffer + including the trailing NUL character */ + size_t buflen); +#endif + +#ifdef HAVE_REALPATH +PyAPI_FUNC(wchar_t*) _Py_wrealpath( + const wchar_t *path, + wchar_t *resolved_path, + /* Number of characters of 'resolved_path' buffer + including the trailing NUL character */ + size_t resolved_path_len); +#endif + +PyAPI_FUNC(wchar_t*) _Py_wgetcwd( + wchar_t *buf, + /* Number of characters of 'buf' buffer + including the trailing NUL character */ + size_t buflen); + +PyAPI_FUNC(int) _Py_get_inheritable(int fd); + +PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, + int *atomic_flag_works); + +PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable, + int *atomic_flag_works); + +PyAPI_FUNC(int) _Py_dup(int fd); + +#ifndef MS_WINDOWS +PyAPI_FUNC(int) _Py_get_blocking(int fd); + +PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); +#else /* MS_WINDOWS */ +PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd); + +PyAPI_FUNC(void*) _Py_get_osfhandle(int fd); + +PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags); + +PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags); +#endif /* MS_WINDOWS */ + +// This is used after getting NULL back from Py_DecodeLocale(). +#define DECODE_LOCALE_ERR(NAME, LEN) \ + ((LEN) == (size_t)-2) \ + ? _PyStatus_ERR("cannot decode " NAME) \ + : _PyStatus_NO_MEMORY() + +PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors; + +PyAPI_FUNC(int) _Py_DecodeUTF8Ex( + const char *arg, + Py_ssize_t arglen, + wchar_t **wstr, + size_t *wlen, + const char **reason, + _Py_error_handler errors); + +PyAPI_FUNC(int) _Py_EncodeUTF8Ex( + const wchar_t *text, + char **str, + size_t *error_pos, + const char **reason, + int raw_malloc, + _Py_error_handler errors); + +PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape( + const char *arg, + Py_ssize_t arglen, + size_t *wlen); + +extern int +_Py_wstat(const wchar_t *, struct stat *); + +PyAPI_FUNC(int) _Py_GetForceASCII(void); + +/* Reset "force ASCII" mode (if it was initialized). + + This function should be called when Python changes the LC_CTYPE locale, + so the "force ASCII" mode can be detected again on the new locale + encoding. */ +PyAPI_FUNC(void) _Py_ResetForceASCII(void); + + +PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( + struct lconv *lc, + PyObject **decimal_point, + PyObject **thousands_sep); + +PyAPI_FUNC(void) _Py_closerange(int first, int last); + +PyAPI_FUNC(wchar_t*) _Py_GetLocaleEncoding(void); +PyAPI_FUNC(PyObject*) _Py_GetLocaleEncodingObject(void); + +#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION +extern int _Py_LocaleUsesNonUnicodeWchar(void); + +extern wchar_t* _Py_DecodeNonUnicodeWchar( + const wchar_t* native, + Py_ssize_t size); + +extern int _Py_EncodeNonUnicodeWchar_InPlace( + wchar_t* unicode, + Py_ssize_t size); +#endif + +extern int _Py_isabs(const wchar_t *path); +extern int _Py_abspath(const wchar_t *path, wchar_t **abspath_p); +#ifdef MS_WINDOWS +extern int _PyOS_getfullpathname(const wchar_t *path, wchar_t **abspath_p); +#endif +extern wchar_t * _Py_join_relfile(const wchar_t *dirname, + const wchar_t *relfile); +extern int _Py_add_relfile(wchar_t *dirname, + const wchar_t *relfile, + size_t bufsize); +extern size_t _Py_find_basename(const wchar_t *filename); +PyAPI_FUNC(wchar_t*) _Py_normpath(wchar_t *path, Py_ssize_t size); +extern wchar_t *_Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *length); + + +// Macros to protect CRT calls against instant termination when passed an +// invalid parameter (bpo-23524). IPH stands for Invalid Parameter Handler. +// Usage: +// +// _Py_BEGIN_SUPPRESS_IPH +// ... +// _Py_END_SUPPRESS_IPH +#if defined _MSC_VER && _MSC_VER >= 1900 + +# include // _set_thread_local_invalid_parameter_handler() + + extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; +# define _Py_BEGIN_SUPPRESS_IPH \ + { _invalid_parameter_handler _Py_old_handler = \ + _set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler); +# define _Py_END_SUPPRESS_IPH \ + _set_thread_local_invalid_parameter_handler(_Py_old_handler); } +#else +# define _Py_BEGIN_SUPPRESS_IPH +# define _Py_END_SUPPRESS_IPH +#endif /* _MSC_VER >= 1900 */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FILEUTILS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_floatobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_floatobject.h new file mode 100644 index 0000000000000000000000000000000000000000..8a655543329f33546cd7c8b30d4728c45e086c8b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_floatobject.h @@ -0,0 +1,59 @@ +#ifndef Py_INTERNAL_FLOATOBJECT_H +#define Py_INTERNAL_FLOATOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern void _PyFloat_InitState(PyInterpreterState *); +extern PyStatus _PyFloat_InitTypes(PyInterpreterState *); +extern void _PyFloat_Fini(PyInterpreterState *); +extern void _PyFloat_FiniType(PyInterpreterState *); + + +/* other API */ + +#ifndef WITH_FREELISTS +// without freelists +# define PyFloat_MAXFREELIST 0 +#endif + +#ifndef PyFloat_MAXFREELIST +# define PyFloat_MAXFREELIST 100 +#endif + +struct _Py_float_state { +#if PyFloat_MAXFREELIST > 0 + /* Special free list + free_list is a singly-linked list of available PyFloatObjects, + linked via abuse of their ob_type members. */ + int numfree; + PyFloatObject *free_list; +#endif +}; + +void _PyFloat_ExactDealloc(PyObject *op); + + +PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out); + + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter( + _PyUnicodeWriter *writer, + PyObject *obj, + PyObject *format_spec, + Py_ssize_t start, + Py_ssize_t end); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FLOATOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_format.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_format.h new file mode 100644 index 0000000000000000000000000000000000000000..1b8d57539ca505fbc56ecb2245785a8b37b85c9f --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_format.h @@ -0,0 +1,27 @@ +#ifndef Py_INTERNAL_FORMAT_H +#define Py_INTERNAL_FORMAT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Format codes + * F_LJUST '-' + * F_SIGN '+' + * F_BLANK ' ' + * F_ALT '#' + * F_ZERO '0' + */ +#define F_LJUST (1<<0) +#define F_SIGN (1<<1) +#define F_BLANK (1<<2) +#define F_ALT (1<<3) +#define F_ZERO (1<<4) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FORMAT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_frame.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_frame.h new file mode 100644 index 0000000000000000000000000000000000000000..4866ea21b9989ca7a03059f8fae83cdd874679d9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_frame.h @@ -0,0 +1,240 @@ +#ifndef Py_INTERNAL_FRAME_H +#define Py_INTERNAL_FRAME_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* See Objects/frame_layout.md for an explanation of the frame stack + * including explanation of the PyFrameObject and _PyInterpreterFrame + * structs. */ + + +struct _frame { + PyObject_HEAD + PyFrameObject *f_back; /* previous frame, or NULL */ + struct _PyInterpreterFrame *f_frame; /* points to the frame data */ + PyObject *f_trace; /* Trace function */ + int f_lineno; /* Current line number. Only valid if non-zero */ + char f_trace_lines; /* Emit per-line trace events? */ + char f_trace_opcodes; /* Emit per-opcode trace events? */ + char f_fast_as_locals; /* Have the fast locals of this frame been converted to a dict? */ + /* The frame data, if this frame object owns the frame */ + PyObject *_f_frame_data[1]; +}; + +extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code); + + +/* other API */ + +typedef enum _framestate { + FRAME_CREATED = -2, + FRAME_SUSPENDED = -1, + FRAME_EXECUTING = 0, + FRAME_COMPLETED = 1, + FRAME_CLEARED = 4 +} PyFrameState; + +enum _frameowner { + FRAME_OWNED_BY_THREAD = 0, + FRAME_OWNED_BY_GENERATOR = 1, + FRAME_OWNED_BY_FRAME_OBJECT = 2 +}; + +typedef struct _PyInterpreterFrame { + /* "Specials" section */ + PyFunctionObject *f_func; /* Strong reference */ + PyObject *f_globals; /* Borrowed reference */ + PyObject *f_builtins; /* Borrowed reference */ + PyObject *f_locals; /* Strong reference, may be NULL */ + PyCodeObject *f_code; /* Strong reference */ + PyFrameObject *frame_obj; /* Strong reference, may be NULL */ + /* Linkage section */ + struct _PyInterpreterFrame *previous; + // NOTE: This is not necessarily the last instruction started in the given + // frame. Rather, it is the code unit *prior to* the *next* instruction. For + // example, it may be an inline CACHE entry, an instruction we just jumped + // over, or (in the case of a newly-created frame) a totally invalid value: + _Py_CODEUNIT *prev_instr; + int stacktop; /* Offset of TOS from localsplus */ + bool is_entry; // Whether this is the "root" frame for the current _PyCFrame. + char owner; + /* Locals and stack */ + PyObject *localsplus[1]; +} _PyInterpreterFrame; + +#define _PyInterpreterFrame_LASTI(IF) \ + ((int)((IF)->prev_instr - _PyCode_CODE((IF)->f_code))) + +static inline PyObject **_PyFrame_Stackbase(_PyInterpreterFrame *f) { + return f->localsplus + f->f_code->co_nlocalsplus; +} + +static inline PyObject *_PyFrame_StackPeek(_PyInterpreterFrame *f) { + assert(f->stacktop > f->f_code->co_nlocalsplus); + assert(f->localsplus[f->stacktop-1] != NULL); + return f->localsplus[f->stacktop-1]; +} + +static inline PyObject *_PyFrame_StackPop(_PyInterpreterFrame *f) { + assert(f->stacktop > f->f_code->co_nlocalsplus); + f->stacktop--; + return f->localsplus[f->stacktop]; +} + +static inline void _PyFrame_StackPush(_PyInterpreterFrame *f, PyObject *value) { + f->localsplus[f->stacktop] = value; + f->stacktop++; +} + +#define FRAME_SPECIALS_SIZE ((sizeof(_PyInterpreterFrame)-1)/sizeof(PyObject *)) + +void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest); + +/* Consumes reference to func and locals. + Does not initialize frame->previous, which happens + when frame is linked into the frame stack. + */ +static inline void +_PyFrame_InitializeSpecials( + _PyInterpreterFrame *frame, PyFunctionObject *func, + PyObject *locals, int nlocalsplus) +{ + frame->f_func = func; + frame->f_code = (PyCodeObject *)Py_NewRef(func->func_code); + frame->f_builtins = func->func_builtins; + frame->f_globals = func->func_globals; + frame->f_locals = Py_XNewRef(locals); + frame->stacktop = nlocalsplus; + frame->frame_obj = NULL; + frame->prev_instr = _PyCode_CODE(frame->f_code) - 1; + frame->is_entry = false; + frame->owner = FRAME_OWNED_BY_THREAD; +} + +/* Gets the pointer to the locals array + * that precedes this frame. + */ +static inline PyObject** +_PyFrame_GetLocalsArray(_PyInterpreterFrame *frame) +{ + return frame->localsplus; +} + +static inline PyObject** +_PyFrame_GetStackPointer(_PyInterpreterFrame *frame) +{ + return frame->localsplus+frame->stacktop; +} + +static inline void +_PyFrame_SetStackPointer(_PyInterpreterFrame *frame, PyObject **stack_pointer) +{ + frame->stacktop = (int)(stack_pointer - frame->localsplus); +} + +/* Determine whether a frame is incomplete. + * A frame is incomplete if it is part way through + * creating cell objects or a generator or coroutine. + * + * Frames on the frame stack are incomplete until the + * first RESUME instruction. + * Frames owned by a generator are always complete. + */ +static inline bool +_PyFrame_IsIncomplete(_PyInterpreterFrame *frame) +{ + return frame->owner != FRAME_OWNED_BY_GENERATOR && + frame->prev_instr < _PyCode_CODE(frame->f_code) + frame->f_code->_co_firsttraceable; +} + +/* For use by _PyFrame_GetFrameObject + Do not call directly. */ +PyFrameObject * +_PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame); + +/* Gets the PyFrameObject for this frame, lazily + * creating it if necessary. + * Returns a borrowed referennce */ +static inline PyFrameObject * +_PyFrame_GetFrameObject(_PyInterpreterFrame *frame) +{ + + assert(!_PyFrame_IsIncomplete(frame)); + PyFrameObject *res = frame->frame_obj; + if (res != NULL) { + return res; + } + return _PyFrame_MakeAndSetFrameObject(frame); +} + +/* Clears all references in the frame. + * If take is non-zero, then the _PyInterpreterFrame frame + * may be transferred to the frame object it references + * instead of being cleared. Either way + * the caller no longer owns the references + * in the frame. + * take should be set to 1 for heap allocated + * frames like the ones in generators and coroutines. + */ +void +_PyFrame_Clear(_PyInterpreterFrame * frame); + +int +_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg); + +int +_PyFrame_FastToLocalsWithError(_PyInterpreterFrame *frame); + +void +_PyFrame_LocalsToFast(_PyInterpreterFrame *frame, int clear); + +extern _PyInterpreterFrame * +_PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size); + +static inline bool +_PyThreadState_HasStackSpace(PyThreadState *tstate, size_t size) +{ + assert( + (tstate->datastack_top == NULL && tstate->datastack_limit == NULL) + || + (tstate->datastack_top != NULL && tstate->datastack_limit != NULL) + ); + return tstate->datastack_top != NULL && + size < (size_t)(tstate->datastack_limit - tstate->datastack_top); +} + +static inline _PyInterpreterFrame * +_PyThreadState_BumpFramePointer(PyThreadState *tstate, size_t size) +{ + if (_PyThreadState_HasStackSpace(tstate, size)) { + _PyInterpreterFrame *res = (_PyInterpreterFrame *)tstate->datastack_top; + tstate->datastack_top += size; + return res; + } + return _PyThreadState_BumpFramePointerSlow(tstate, size); +} + +void _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame); + +/* Consume reference to func */ +_PyInterpreterFrame * +_PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func); + +int _PyInterpreterFrame_GetLine(_PyInterpreterFrame *frame); + +static inline +PyGenObject *_PyFrame_GetGenerator(_PyInterpreterFrame *frame) +{ + assert(frame->owner == FRAME_OWNED_BY_GENERATOR); + size_t offset_in_gen = offsetof(PyGenObject, gi_iframe); + return (PyGenObject *)(((char *)frame) - offset_in_gen); +} + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FRAME_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_function.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_function.h new file mode 100644 index 0000000000000000000000000000000000000000..1c87aa31ddb611e82faf8b2fd0e5708298c1e940 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_function.h @@ -0,0 +1,18 @@ +#ifndef Py_INTERNAL_FUNCTION_H +#define Py_INTERNAL_FUNCTION_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr); + +extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_FUNCTION_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gc.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gc.h new file mode 100644 index 0000000000000000000000000000000000000000..16c1893639f3542bff4285d81b737cae09c4a948 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gc.h @@ -0,0 +1,183 @@ +#ifndef Py_INTERNAL_GC_H +#define Py_INTERNAL_GC_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* GC information is stored BEFORE the object structure. */ +typedef struct { + // Pointer to next object in the list. + // 0 means the object is not tracked + uintptr_t _gc_next; + + // Pointer to previous object in the list. + // Lowest two bits are used for flags documented later. + uintptr_t _gc_prev; +} PyGC_Head; + +#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) +#define _PyGC_Head_UNUSED PyGC_Head + +/* True if the object is currently tracked by the GC. */ +#define _PyObject_GC_IS_TRACKED(o) (_Py_AS_GC(o)->_gc_next != 0) + +/* True if the object may be tracked by the GC in the future, or already is. + This can be useful to implement some optimizations. */ +#define _PyObject_GC_MAY_BE_TRACKED(obj) \ + (PyObject_IS_GC(obj) && \ + (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) + + +/* Bit flags for _gc_prev */ +/* Bit 0 is set when tp_finalize is called */ +#define _PyGC_PREV_MASK_FINALIZED (1) +/* Bit 1 is set when the object is in generation which is GCed currently. */ +#define _PyGC_PREV_MASK_COLLECTING (2) +/* The (N-2) most significant bits contain the real address. */ +#define _PyGC_PREV_SHIFT (2) +#define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT) + +// Lowest bit of _gc_next is used for flags only in GC. +// But it is always 0 for normal code. +#define _PyGCHead_NEXT(g) ((PyGC_Head*)(g)->_gc_next) +#define _PyGCHead_SET_NEXT(g, p) _Py_RVALUE((g)->_gc_next = (uintptr_t)(p)) + +// Lowest two bits of _gc_prev is used for _PyGC_PREV_MASK_* flags. +#define _PyGCHead_PREV(g) ((PyGC_Head*)((g)->_gc_prev & _PyGC_PREV_MASK)) +#define _PyGCHead_SET_PREV(g, p) do { \ + assert(((uintptr_t)p & ~_PyGC_PREV_MASK) == 0); \ + (g)->_gc_prev = ((g)->_gc_prev & ~_PyGC_PREV_MASK) \ + | ((uintptr_t)(p)); \ + } while (0) + +#define _PyGCHead_FINALIZED(g) \ + (((g)->_gc_prev & _PyGC_PREV_MASK_FINALIZED) != 0) +#define _PyGCHead_SET_FINALIZED(g) \ + _Py_RVALUE((g)->_gc_prev |= _PyGC_PREV_MASK_FINALIZED) + +#define _PyGC_FINALIZED(o) \ + _PyGCHead_FINALIZED(_Py_AS_GC(o)) +#define _PyGC_SET_FINALIZED(o) \ + _PyGCHead_SET_FINALIZED(_Py_AS_GC(o)) + + +/* GC runtime state */ + +/* If we change this, we need to change the default value in the + signature of gc.collect. */ +#define NUM_GENERATIONS 3 +/* + NOTE: about untracking of mutable objects. + + Certain types of container cannot participate in a reference cycle, and + so do not need to be tracked by the garbage collector. Untracking these + objects reduces the cost of garbage collections. However, determining + which objects may be untracked is not free, and the costs must be + weighed against the benefits for garbage collection. + + There are two possible strategies for when to untrack a container: + + i) When the container is created. + ii) When the container is examined by the garbage collector. + + Tuples containing only immutable objects (integers, strings etc, and + recursively, tuples of immutable objects) do not need to be tracked. + The interpreter creates a large number of tuples, many of which will + not survive until garbage collection. It is therefore not worthwhile + to untrack eligible tuples at creation time. + + Instead, all tuples except the empty tuple are tracked when created. + During garbage collection it is determined whether any surviving tuples + can be untracked. A tuple can be untracked if all of its contents are + already not tracked. Tuples are examined for untracking in all garbage + collection cycles. It may take more than one cycle to untrack a tuple. + + Dictionaries containing only immutable objects also do not need to be + tracked. Dictionaries are untracked when created. If a tracked item is + inserted into a dictionary (either as a key or value), the dictionary + becomes tracked. During a full garbage collection (all generations), + the collector will untrack any dictionaries whose contents are not + tracked. + + The module provides the python function is_tracked(obj), which returns + the CURRENT tracking status of the object. Subsequent garbage + collections may change the tracking status of the object. + + Untracking of certain containers was introduced in issue #4688, and + the algorithm was refined in response to issue #14775. +*/ + +struct gc_generation { + PyGC_Head head; + int threshold; /* collection threshold */ + int count; /* count of allocations or collections of younger + generations */ +}; + +/* Running stats per generation */ +struct gc_generation_stats { + /* total number of collections */ + Py_ssize_t collections; + /* total number of collected objects */ + Py_ssize_t collected; + /* total number of uncollectable objects (put into gc.garbage) */ + Py_ssize_t uncollectable; +}; + +struct _gc_runtime_state { + /* List of objects that still need to be cleaned up, singly linked + * via their gc headers' gc_prev pointers. */ + PyObject *trash_delete_later; + /* Current call-stack depth of tp_dealloc calls. */ + int trash_delete_nesting; + + /* Is automatic collection enabled? */ + int enabled; + int debug; + /* linked lists of container objects */ + struct gc_generation generations[NUM_GENERATIONS]; + PyGC_Head *generation0; + /* a permanent generation which won't be collected */ + struct gc_generation permanent_generation; + struct gc_generation_stats generation_stats[NUM_GENERATIONS]; + /* true if we are currently running the collector */ + int collecting; + /* list of uncollectable objects */ + PyObject *garbage; + /* a list of callbacks to be invoked when collection is performed */ + PyObject *callbacks; + /* This is the number of objects that survived the last full + collection. It approximates the number of long lived objects + tracked by the GC. + + (by "full collection", we mean a collection of the oldest + generation). */ + Py_ssize_t long_lived_total; + /* This is the number of objects that survived all "non-full" + collections, and are awaiting to undergo a full collection for + the first time. */ + Py_ssize_t long_lived_pending; +}; + + +extern void _PyGC_InitState(struct _gc_runtime_state *); + +extern Py_ssize_t _PyGC_CollectNoFail(PyThreadState *tstate); + + +// Functions to clear types free lists +extern void _PyTuple_ClearFreeList(PyInterpreterState *interp); +extern void _PyFloat_ClearFreeList(PyInterpreterState *interp); +extern void _PyList_ClearFreeList(PyInterpreterState *interp); +extern void _PyDict_ClearFreeList(PyInterpreterState *interp); +extern void _PyAsyncGen_ClearFreeLists(PyInterpreterState *interp); +extern void _PyContext_ClearFreeList(PyInterpreterState *interp); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GC_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_genobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_genobject.h new file mode 100644 index 0000000000000000000000000000000000000000..42db0d87d1f40a0abe4d965473fabf9354f332a0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_genobject.h @@ -0,0 +1,49 @@ +#ifndef Py_INTERNAL_GENOBJECT_H +#define Py_INTERNAL_GENOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern PyObject *_PyGen_yf(PyGenObject *); +extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o); +extern PyObject *_PyAsyncGenValueWrapperNew(PyObject *); + +/* runtime lifecycle */ + +extern void _PyAsyncGen_Fini(PyInterpreterState *); + + +/* other API */ + +#ifndef WITH_FREELISTS +// without freelists +# define _PyAsyncGen_MAXFREELIST 0 +#endif + +#ifndef _PyAsyncGen_MAXFREELIST +# define _PyAsyncGen_MAXFREELIST 80 +#endif + +struct _Py_async_gen_state { +#if _PyAsyncGen_MAXFREELIST > 0 + /* Freelists boost performance 6-10%; they also reduce memory + fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend + are short-living objects that are instantiated for every + __anext__() call. */ + struct _PyAsyncGenWrappedValue* value_freelist[_PyAsyncGen_MAXFREELIST]; + int value_numfree; + + struct PyAsyncGenASend* asend_freelist[_PyAsyncGen_MAXFREELIST]; + int asend_numfree; +#endif +}; + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GENOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_getopt.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_getopt.h new file mode 100644 index 0000000000000000000000000000000000000000..7f0dd13ae577f78491f19b7e8fa3ac8c5042bb11 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_getopt.h @@ -0,0 +1,22 @@ +#ifndef Py_INTERNAL_PYGETOPT_H +#define Py_INTERNAL_PYGETOPT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern int _PyOS_opterr; +extern Py_ssize_t _PyOS_optind; +extern const wchar_t *_PyOS_optarg; + +extern void _PyOS_ResetGetOpt(void); + +typedef struct { + const wchar_t *name; + int has_arg; + int val; +} _PyOS_LongOption; + +extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex); + +#endif /* !Py_INTERNAL_PYGETOPT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gil.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gil.h new file mode 100644 index 0000000000000000000000000000000000000000..8ebad37b686cd4c9cdfd4236b2bd9387497f489e --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_gil.h @@ -0,0 +1,50 @@ +#ifndef Py_INTERNAL_GIL_H +#define Py_INTERNAL_GIL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_atomic.h" /* _Py_atomic_address */ +#include "pycore_condvar.h" /* PyCOND_T */ + +#ifndef Py_HAVE_CONDVAR +# error You need either a POSIX-compatible or a Windows system! +#endif + +/* Enable if you want to force the switching of threads at least + every `interval`. */ +#undef FORCE_SWITCHING +#define FORCE_SWITCHING + +struct _gil_runtime_state { + /* microseconds (the Python API uses seconds, though) */ + unsigned long interval; + /* Last PyThreadState holding / having held the GIL. This helps us + know whether anyone else was scheduled after we dropped the GIL. */ + _Py_atomic_address last_holder; + /* Whether the GIL is already taken (-1 if uninitialized). This is + atomic because it can be read without any lock taken in ceval.c. */ + _Py_atomic_int locked; + /* Number of GIL switches since the beginning. */ + unsigned long switch_number; + /* This condition variable allows one or several threads to wait + until the GIL is released. In addition, the mutex also protects + the above variables. */ + PyCOND_T cond; + PyMUTEX_T mutex; +#ifdef FORCE_SWITCHING + /* This condition variable helps the GIL-releasing thread wait for + a GIL-awaiting thread to be scheduled and take the GIL. */ + PyCOND_T switch_cond; + PyMUTEX_T switch_mutex; +#endif +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GIL_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_objects.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_objects.h new file mode 100644 index 0000000000000000000000000000000000000000..98673d4efcedcc3c1227dd2a5b79569ebe3a3d36 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_objects.h @@ -0,0 +1,54 @@ +#ifndef Py_INTERNAL_GLOBAL_OBJECTS_H +#define Py_INTERNAL_GLOBAL_OBJECTS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_gc.h" // PyGC_Head +#include "pycore_global_strings.h" // struct _Py_global_strings + + +// These would be in pycore_long.h if it weren't for an include cycle. +#define _PY_NSMALLPOSINTS 257 +#define _PY_NSMALLNEGINTS 5 + + +// Only immutable objects should be considered runtime-global. +// All others must be per-interpreter. + +#define _Py_GLOBAL_OBJECT(NAME) \ + _PyRuntime.global_objects.NAME +#define _Py_SINGLETON(NAME) \ + _Py_GLOBAL_OBJECT(singletons.NAME) + +struct _Py_global_objects { + struct { + /* Small integers are preallocated in this array so that they + * can be shared. + * The integers that are preallocated are those in the range + * -_PY_NSMALLNEGINTS (inclusive) to _PY_NSMALLPOSINTS (exclusive). + */ + PyLongObject small_ints[_PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS]; + + PyBytesObject bytes_empty; + struct { + PyBytesObject ob; + char eos; + } bytes_characters[256]; + + struct _Py_global_strings strings; + + _PyGC_Head_UNUSED _tuple_empty_gc_not_used; + PyTupleObject tuple_empty; + } singletons; +}; + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GLOBAL_OBJECTS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_strings.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_strings.h new file mode 100644 index 0000000000000000000000000000000000000000..ca970627cb2e17080efb262472bc2e5ffdb45933 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_global_strings.h @@ -0,0 +1,395 @@ +#ifndef Py_INTERNAL_GLOBAL_STRINGS_H +#define Py_INTERNAL_GLOBAL_STRINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +// The data structure & init here are inspired by Tools/scripts/deepfreeze.py. + +// All field names generated by ASCII_STR() have a common prefix, +// to help avoid collisions with keywords, etc. + +#define STRUCT_FOR_ASCII_STR(LITERAL) \ + struct { \ + PyASCIIObject _ascii; \ + uint8_t _data[sizeof(LITERAL)]; \ + } +#define STRUCT_FOR_STR(NAME, LITERAL) \ + STRUCT_FOR_ASCII_STR(LITERAL) _ ## NAME; +#define STRUCT_FOR_ID(NAME) \ + STRUCT_FOR_ASCII_STR(#NAME) _ ## NAME; + +// XXX Order by frequency of use? + +/* The following is auto-generated by Tools/scripts/generate_global_objects.py. */ +struct _Py_global_strings { + struct { + STRUCT_FOR_STR(anon_dictcomp, "") + STRUCT_FOR_STR(anon_genexpr, "") + STRUCT_FOR_STR(anon_lambda, "") + STRUCT_FOR_STR(anon_listcomp, "") + STRUCT_FOR_STR(anon_module, "") + STRUCT_FOR_STR(anon_setcomp, "") + STRUCT_FOR_STR(anon_string, "") + STRUCT_FOR_STR(anon_unknown, "") + STRUCT_FOR_STR(close_br, "}") + STRUCT_FOR_STR(comma_sep, ", ") + STRUCT_FOR_STR(dbl_close_br, "}}") + STRUCT_FOR_STR(dbl_open_br, "{{") + STRUCT_FOR_STR(dbl_percent, "%%") + STRUCT_FOR_STR(dot, ".") + STRUCT_FOR_STR(dot_locals, ".") + STRUCT_FOR_STR(empty, "") + STRUCT_FOR_STR(list_err, "list index out of range") + STRUCT_FOR_STR(newline, "\n") + STRUCT_FOR_STR(open_br, "{") + STRUCT_FOR_STR(percent, "%") + STRUCT_FOR_STR(utf_8, "utf-8") + } literals; + + struct { + STRUCT_FOR_ID(False) + STRUCT_FOR_ID(Py_Repr) + STRUCT_FOR_ID(TextIOWrapper) + STRUCT_FOR_ID(True) + STRUCT_FOR_ID(WarningMessage) + STRUCT_FOR_ID(_) + STRUCT_FOR_ID(__IOBase_closed) + STRUCT_FOR_ID(__abc_tpflags__) + STRUCT_FOR_ID(__abs__) + STRUCT_FOR_ID(__abstractmethods__) + STRUCT_FOR_ID(__add__) + STRUCT_FOR_ID(__aenter__) + STRUCT_FOR_ID(__aexit__) + STRUCT_FOR_ID(__aiter__) + STRUCT_FOR_ID(__all__) + STRUCT_FOR_ID(__and__) + STRUCT_FOR_ID(__anext__) + STRUCT_FOR_ID(__annotations__) + STRUCT_FOR_ID(__args__) + STRUCT_FOR_ID(__await__) + STRUCT_FOR_ID(__bases__) + STRUCT_FOR_ID(__bool__) + STRUCT_FOR_ID(__build_class__) + STRUCT_FOR_ID(__builtins__) + STRUCT_FOR_ID(__bytes__) + STRUCT_FOR_ID(__call__) + STRUCT_FOR_ID(__cantrace__) + STRUCT_FOR_ID(__class__) + STRUCT_FOR_ID(__class_getitem__) + STRUCT_FOR_ID(__classcell__) + STRUCT_FOR_ID(__complex__) + STRUCT_FOR_ID(__contains__) + STRUCT_FOR_ID(__copy__) + STRUCT_FOR_ID(__del__) + STRUCT_FOR_ID(__delattr__) + STRUCT_FOR_ID(__delete__) + STRUCT_FOR_ID(__delitem__) + STRUCT_FOR_ID(__dict__) + STRUCT_FOR_ID(__dir__) + STRUCT_FOR_ID(__divmod__) + STRUCT_FOR_ID(__doc__) + STRUCT_FOR_ID(__enter__) + STRUCT_FOR_ID(__eq__) + STRUCT_FOR_ID(__exit__) + STRUCT_FOR_ID(__file__) + STRUCT_FOR_ID(__float__) + STRUCT_FOR_ID(__floordiv__) + STRUCT_FOR_ID(__format__) + STRUCT_FOR_ID(__fspath__) + STRUCT_FOR_ID(__ge__) + STRUCT_FOR_ID(__get__) + STRUCT_FOR_ID(__getattr__) + STRUCT_FOR_ID(__getattribute__) + STRUCT_FOR_ID(__getinitargs__) + STRUCT_FOR_ID(__getitem__) + STRUCT_FOR_ID(__getnewargs__) + STRUCT_FOR_ID(__getnewargs_ex__) + STRUCT_FOR_ID(__getstate__) + STRUCT_FOR_ID(__gt__) + STRUCT_FOR_ID(__hash__) + STRUCT_FOR_ID(__iadd__) + STRUCT_FOR_ID(__iand__) + STRUCT_FOR_ID(__ifloordiv__) + STRUCT_FOR_ID(__ilshift__) + STRUCT_FOR_ID(__imatmul__) + STRUCT_FOR_ID(__imod__) + STRUCT_FOR_ID(__import__) + STRUCT_FOR_ID(__imul__) + STRUCT_FOR_ID(__index__) + STRUCT_FOR_ID(__init__) + STRUCT_FOR_ID(__init_subclass__) + STRUCT_FOR_ID(__instancecheck__) + STRUCT_FOR_ID(__int__) + STRUCT_FOR_ID(__invert__) + STRUCT_FOR_ID(__ior__) + STRUCT_FOR_ID(__ipow__) + STRUCT_FOR_ID(__irshift__) + STRUCT_FOR_ID(__isabstractmethod__) + STRUCT_FOR_ID(__isub__) + STRUCT_FOR_ID(__iter__) + STRUCT_FOR_ID(__itruediv__) + STRUCT_FOR_ID(__ixor__) + STRUCT_FOR_ID(__le__) + STRUCT_FOR_ID(__len__) + STRUCT_FOR_ID(__length_hint__) + STRUCT_FOR_ID(__lltrace__) + STRUCT_FOR_ID(__loader__) + STRUCT_FOR_ID(__lshift__) + STRUCT_FOR_ID(__lt__) + STRUCT_FOR_ID(__main__) + STRUCT_FOR_ID(__matmul__) + STRUCT_FOR_ID(__missing__) + STRUCT_FOR_ID(__mod__) + STRUCT_FOR_ID(__module__) + STRUCT_FOR_ID(__mro_entries__) + STRUCT_FOR_ID(__mul__) + STRUCT_FOR_ID(__name__) + STRUCT_FOR_ID(__ne__) + STRUCT_FOR_ID(__neg__) + STRUCT_FOR_ID(__new__) + STRUCT_FOR_ID(__newobj__) + STRUCT_FOR_ID(__newobj_ex__) + STRUCT_FOR_ID(__next__) + STRUCT_FOR_ID(__notes__) + STRUCT_FOR_ID(__or__) + STRUCT_FOR_ID(__orig_class__) + STRUCT_FOR_ID(__origin__) + STRUCT_FOR_ID(__package__) + STRUCT_FOR_ID(__parameters__) + STRUCT_FOR_ID(__path__) + STRUCT_FOR_ID(__pos__) + STRUCT_FOR_ID(__pow__) + STRUCT_FOR_ID(__prepare__) + STRUCT_FOR_ID(__qualname__) + STRUCT_FOR_ID(__radd__) + STRUCT_FOR_ID(__rand__) + STRUCT_FOR_ID(__rdivmod__) + STRUCT_FOR_ID(__reduce__) + STRUCT_FOR_ID(__reduce_ex__) + STRUCT_FOR_ID(__repr__) + STRUCT_FOR_ID(__reversed__) + STRUCT_FOR_ID(__rfloordiv__) + STRUCT_FOR_ID(__rlshift__) + STRUCT_FOR_ID(__rmatmul__) + STRUCT_FOR_ID(__rmod__) + STRUCT_FOR_ID(__rmul__) + STRUCT_FOR_ID(__ror__) + STRUCT_FOR_ID(__round__) + STRUCT_FOR_ID(__rpow__) + STRUCT_FOR_ID(__rrshift__) + STRUCT_FOR_ID(__rshift__) + STRUCT_FOR_ID(__rsub__) + STRUCT_FOR_ID(__rtruediv__) + STRUCT_FOR_ID(__rxor__) + STRUCT_FOR_ID(__set__) + STRUCT_FOR_ID(__set_name__) + STRUCT_FOR_ID(__setattr__) + STRUCT_FOR_ID(__setitem__) + STRUCT_FOR_ID(__setstate__) + STRUCT_FOR_ID(__sizeof__) + STRUCT_FOR_ID(__slotnames__) + STRUCT_FOR_ID(__slots__) + STRUCT_FOR_ID(__spec__) + STRUCT_FOR_ID(__str__) + STRUCT_FOR_ID(__sub__) + STRUCT_FOR_ID(__subclasscheck__) + STRUCT_FOR_ID(__subclasshook__) + STRUCT_FOR_ID(__truediv__) + STRUCT_FOR_ID(__trunc__) + STRUCT_FOR_ID(__typing_is_unpacked_typevartuple__) + STRUCT_FOR_ID(__typing_prepare_subst__) + STRUCT_FOR_ID(__typing_subst__) + STRUCT_FOR_ID(__typing_unpacked_tuple_args__) + STRUCT_FOR_ID(__warningregistry__) + STRUCT_FOR_ID(__weakref__) + STRUCT_FOR_ID(__xor__) + STRUCT_FOR_ID(_abc_impl) + STRUCT_FOR_ID(_annotation) + STRUCT_FOR_ID(_blksize) + STRUCT_FOR_ID(_bootstrap) + STRUCT_FOR_ID(_dealloc_warn) + STRUCT_FOR_ID(_finalizing) + STRUCT_FOR_ID(_find_and_load) + STRUCT_FOR_ID(_fix_up_module) + STRUCT_FOR_ID(_get_sourcefile) + STRUCT_FOR_ID(_handle_fromlist) + STRUCT_FOR_ID(_initializing) + STRUCT_FOR_ID(_is_text_encoding) + STRUCT_FOR_ID(_lock_unlock_module) + STRUCT_FOR_ID(_showwarnmsg) + STRUCT_FOR_ID(_shutdown) + STRUCT_FOR_ID(_slotnames) + STRUCT_FOR_ID(_strptime_time) + STRUCT_FOR_ID(_uninitialized_submodules) + STRUCT_FOR_ID(_warn_unawaited_coroutine) + STRUCT_FOR_ID(_xoptions) + STRUCT_FOR_ID(add) + STRUCT_FOR_ID(append) + STRUCT_FOR_ID(big) + STRUCT_FOR_ID(buffer) + STRUCT_FOR_ID(builtins) + STRUCT_FOR_ID(c_call) + STRUCT_FOR_ID(c_exception) + STRUCT_FOR_ID(c_return) + STRUCT_FOR_ID(call) + STRUCT_FOR_ID(clear) + STRUCT_FOR_ID(close) + STRUCT_FOR_ID(closed) + STRUCT_FOR_ID(code) + STRUCT_FOR_ID(copy) + STRUCT_FOR_ID(copyreg) + STRUCT_FOR_ID(decode) + STRUCT_FOR_ID(default) + STRUCT_FOR_ID(defaultaction) + STRUCT_FOR_ID(dictcomp) + STRUCT_FOR_ID(difference_update) + STRUCT_FOR_ID(dispatch_table) + STRUCT_FOR_ID(displayhook) + STRUCT_FOR_ID(enable) + STRUCT_FOR_ID(encode) + STRUCT_FOR_ID(encoding) + STRUCT_FOR_ID(end_lineno) + STRUCT_FOR_ID(end_offset) + STRUCT_FOR_ID(errors) + STRUCT_FOR_ID(excepthook) + STRUCT_FOR_ID(exception) + STRUCT_FOR_ID(extend) + STRUCT_FOR_ID(filename) + STRUCT_FOR_ID(fileno) + STRUCT_FOR_ID(fillvalue) + STRUCT_FOR_ID(filters) + STRUCT_FOR_ID(find_class) + STRUCT_FOR_ID(flush) + STRUCT_FOR_ID(genexpr) + STRUCT_FOR_ID(get) + STRUCT_FOR_ID(get_source) + STRUCT_FOR_ID(getattr) + STRUCT_FOR_ID(getstate) + STRUCT_FOR_ID(ignore) + STRUCT_FOR_ID(importlib) + STRUCT_FOR_ID(inf) + STRUCT_FOR_ID(intersection) + STRUCT_FOR_ID(isatty) + STRUCT_FOR_ID(isinstance) + STRUCT_FOR_ID(items) + STRUCT_FOR_ID(iter) + STRUCT_FOR_ID(join) + STRUCT_FOR_ID(keys) + STRUCT_FOR_ID(lambda) + STRUCT_FOR_ID(last_traceback) + STRUCT_FOR_ID(last_type) + STRUCT_FOR_ID(last_value) + STRUCT_FOR_ID(latin1) + STRUCT_FOR_ID(len) + STRUCT_FOR_ID(line) + STRUCT_FOR_ID(lineno) + STRUCT_FOR_ID(listcomp) + STRUCT_FOR_ID(little) + STRUCT_FOR_ID(locale) + STRUCT_FOR_ID(match) + STRUCT_FOR_ID(metaclass) + STRUCT_FOR_ID(mode) + STRUCT_FOR_ID(modules) + STRUCT_FOR_ID(mro) + STRUCT_FOR_ID(msg) + STRUCT_FOR_ID(n_fields) + STRUCT_FOR_ID(n_sequence_fields) + STRUCT_FOR_ID(n_unnamed_fields) + STRUCT_FOR_ID(name) + STRUCT_FOR_ID(newlines) + STRUCT_FOR_ID(next) + STRUCT_FOR_ID(obj) + STRUCT_FOR_ID(offset) + STRUCT_FOR_ID(onceregistry) + STRUCT_FOR_ID(opcode) + STRUCT_FOR_ID(open) + STRUCT_FOR_ID(parent) + STRUCT_FOR_ID(partial) + STRUCT_FOR_ID(path) + STRUCT_FOR_ID(peek) + STRUCT_FOR_ID(persistent_id) + STRUCT_FOR_ID(persistent_load) + STRUCT_FOR_ID(print_file_and_line) + STRUCT_FOR_ID(ps1) + STRUCT_FOR_ID(ps2) + STRUCT_FOR_ID(raw) + STRUCT_FOR_ID(read) + STRUCT_FOR_ID(read1) + STRUCT_FOR_ID(readable) + STRUCT_FOR_ID(readall) + STRUCT_FOR_ID(readinto) + STRUCT_FOR_ID(readinto1) + STRUCT_FOR_ID(readline) + STRUCT_FOR_ID(reducer_override) + STRUCT_FOR_ID(reload) + STRUCT_FOR_ID(replace) + STRUCT_FOR_ID(reset) + STRUCT_FOR_ID(return) + STRUCT_FOR_ID(reversed) + STRUCT_FOR_ID(seek) + STRUCT_FOR_ID(seekable) + STRUCT_FOR_ID(send) + STRUCT_FOR_ID(setcomp) + STRUCT_FOR_ID(setstate) + STRUCT_FOR_ID(sort) + STRUCT_FOR_ID(stderr) + STRUCT_FOR_ID(stdin) + STRUCT_FOR_ID(stdout) + STRUCT_FOR_ID(strict) + STRUCT_FOR_ID(symmetric_difference_update) + STRUCT_FOR_ID(tell) + STRUCT_FOR_ID(text) + STRUCT_FOR_ID(threading) + STRUCT_FOR_ID(throw) + STRUCT_FOR_ID(top) + STRUCT_FOR_ID(truncate) + STRUCT_FOR_ID(unraisablehook) + STRUCT_FOR_ID(values) + STRUCT_FOR_ID(version) + STRUCT_FOR_ID(warnings) + STRUCT_FOR_ID(warnoptions) + STRUCT_FOR_ID(writable) + STRUCT_FOR_ID(write) + STRUCT_FOR_ID(zipimporter) + } identifiers; + struct { + PyASCIIObject _ascii; + uint8_t _data[2]; + } ascii[128]; + struct { + PyCompactUnicodeObject _latin1; + uint8_t _data[2]; + } latin1[128]; +}; +/* End auto-generated code */ + +#undef ID +#undef STR + + +#define _Py_ID(NAME) \ + (_Py_SINGLETON(strings.identifiers._ ## NAME._ascii.ob_base)) +#define _Py_STR(NAME) \ + (_Py_SINGLETON(strings.literals._ ## NAME._ascii.ob_base)) + +/* _Py_DECLARE_STR() should precede all uses of _Py_STR() in a function. + + This is true even if the same string has already been declared + elsewhere, even in the same file. Mismatched duplicates are detected + by Tools/scripts/generate-global-objects.py. + + Pairing _Py_DECLARE_STR() with every use of _Py_STR() makes sure the + string keeps working even if the declaration is removed somewhere + else. It also makes it clear what the actual string is at every + place it is being used. */ +#define _Py_DECLARE_STR(name, str) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GLOBAL_STRINGS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hamt.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hamt.h new file mode 100644 index 0000000000000000000000000000000000000000..4d64288bbab494687ca37a74690f80251f0b7c72 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hamt.h @@ -0,0 +1,131 @@ +#ifndef Py_INTERNAL_HAMT_H +#define Py_INTERNAL_HAMT_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* +HAMT tree is shaped by hashes of keys. Every group of 5 bits of a hash denotes +the exact position of the key in one level of the tree. Since we're using +32 bit hashes, we can have at most 7 such levels. Although if there are +two distinct keys with equal hashes, they will have to occupy the same +cell in the 7th level of the tree -- so we'd put them in a "collision" node. +Which brings the total possible tree depth to 8. Read more about the actual +layout of the HAMT tree in `hamt.c`. + +This constant is used to define a datastucture for storing iteration state. +*/ +#define _Py_HAMT_MAX_TREE_DEPTH 8 + + +extern PyTypeObject _PyHamt_Type; +extern PyTypeObject _PyHamt_ArrayNode_Type; +extern PyTypeObject _PyHamt_BitmapNode_Type; +extern PyTypeObject _PyHamt_CollisionNode_Type; +extern PyTypeObject _PyHamtKeys_Type; +extern PyTypeObject _PyHamtValues_Type; +extern PyTypeObject _PyHamtItems_Type; + +/* runtime lifecycle */ + +void _PyHamt_Fini(PyInterpreterState *); + + +/* other API */ + +#define PyHamt_Check(o) Py_IS_TYPE(o, &_PyHamt_Type) + + +/* Abstract tree node. */ +typedef struct { + PyObject_HEAD +} PyHamtNode; + + +/* An HAMT immutable mapping collection. */ +typedef struct { + PyObject_HEAD + PyHamtNode *h_root; + PyObject *h_weakreflist; + Py_ssize_t h_count; +} PyHamtObject; + + +/* A struct to hold the state of depth-first traverse of the tree. + + HAMT is an immutable collection. Iterators will hold a strong reference + to it, and every node in the HAMT has strong references to its children. + + So for iterators, we can implement zero allocations and zero reference + inc/dec depth-first iteration. + + - i_nodes: an array of seven pointers to tree nodes + - i_level: the current node in i_nodes + - i_pos: an array of positions within nodes in i_nodes. +*/ +typedef struct { + PyHamtNode *i_nodes[_Py_HAMT_MAX_TREE_DEPTH]; + Py_ssize_t i_pos[_Py_HAMT_MAX_TREE_DEPTH]; + int8_t i_level; +} PyHamtIteratorState; + + +/* Base iterator object. + + Contains the iteration state, a pointer to the HAMT tree, + and a pointer to the 'yield function'. The latter is a simple + function that returns a key/value tuple for the 'Items' iterator, + just a key for the 'Keys' iterator, and a value for the 'Values' + iterator. +*/ +typedef struct { + PyObject_HEAD + PyHamtObject *hi_obj; + PyHamtIteratorState hi_iter; + binaryfunc hi_yield; +} PyHamtIterator; + + +/* Create a new HAMT immutable mapping. */ +PyHamtObject * _PyHamt_New(void); + +/* Return a new collection based on "o", but with an additional + key/val pair. */ +PyHamtObject * _PyHamt_Assoc(PyHamtObject *o, PyObject *key, PyObject *val); + +/* Return a new collection based on "o", but without "key". */ +PyHamtObject * _PyHamt_Without(PyHamtObject *o, PyObject *key); + +/* Find "key" in the "o" collection. + + Return: + - -1: An error occurred. + - 0: "key" wasn't found in "o". + - 1: "key" is in "o"; "*val" is set to its value (a borrowed ref). +*/ +int _PyHamt_Find(PyHamtObject *o, PyObject *key, PyObject **val); + +/* Check if "v" is equal to "w". + + Return: + - 0: v != w + - 1: v == w + - -1: An error occurred. +*/ +int _PyHamt_Eq(PyHamtObject *v, PyHamtObject *w); + +/* Return the size of "o"; equivalent of "len(o)". */ +Py_ssize_t _PyHamt_Len(PyHamtObject *o); + +/* Return a Keys iterator over "o". */ +PyObject * _PyHamt_NewIterKeys(PyHamtObject *o); + +/* Return a Values iterator over "o". */ +PyObject * _PyHamt_NewIterValues(PyHamtObject *o); + +/* Return a Items iterator over "o". */ +PyObject * _PyHamt_NewIterItems(PyHamtObject *o); + +#endif /* !Py_INTERNAL_HAMT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hashtable.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hashtable.h new file mode 100644 index 0000000000000000000000000000000000000000..18757abc28c195883b6e3e1cd39e501a85e45381 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_hashtable.h @@ -0,0 +1,148 @@ +#ifndef Py_INTERNAL_HASHTABLE_H +#define Py_INTERNAL_HASHTABLE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Single linked list */ + +typedef struct _Py_slist_item_s { + struct _Py_slist_item_s *next; +} _Py_slist_item_t; + +typedef struct { + _Py_slist_item_t *head; +} _Py_slist_t; + +#define _Py_SLIST_ITEM_NEXT(ITEM) (((_Py_slist_item_t *)ITEM)->next) + +#define _Py_SLIST_HEAD(SLIST) (((_Py_slist_t *)SLIST)->head) + + +/* _Py_hashtable: table entry */ + +typedef struct { + /* used by _Py_hashtable_t.buckets to link entries */ + _Py_slist_item_t _Py_slist_item; + + Py_uhash_t key_hash; + void *key; + void *value; +} _Py_hashtable_entry_t; + + +/* _Py_hashtable: prototypes */ + +/* Forward declaration */ +struct _Py_hashtable_t; +typedef struct _Py_hashtable_t _Py_hashtable_t; + +typedef Py_uhash_t (*_Py_hashtable_hash_func) (const void *key); +typedef int (*_Py_hashtable_compare_func) (const void *key1, const void *key2); +typedef void (*_Py_hashtable_destroy_func) (void *key); +typedef _Py_hashtable_entry_t* (*_Py_hashtable_get_entry_func)(_Py_hashtable_t *ht, + const void *key); + +typedef struct { + // Allocate a memory block + void* (*malloc) (size_t size); + + // Release a memory block + void (*free) (void *ptr); +} _Py_hashtable_allocator_t; + + +/* _Py_hashtable: table */ +struct _Py_hashtable_t { + size_t nentries; // Total number of entries in the table + size_t nbuckets; + _Py_slist_t *buckets; + + _Py_hashtable_get_entry_func get_entry_func; + _Py_hashtable_hash_func hash_func; + _Py_hashtable_compare_func compare_func; + _Py_hashtable_destroy_func key_destroy_func; + _Py_hashtable_destroy_func value_destroy_func; + _Py_hashtable_allocator_t alloc; +}; + +/* Hash a pointer (void*) */ +PyAPI_FUNC(Py_uhash_t) _Py_hashtable_hash_ptr(const void *key); + +/* Comparison using memcmp() */ +PyAPI_FUNC(int) _Py_hashtable_compare_direct( + const void *key1, + const void *key2); + +PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new( + _Py_hashtable_hash_func hash_func, + _Py_hashtable_compare_func compare_func); + +PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new_full( + _Py_hashtable_hash_func hash_func, + _Py_hashtable_compare_func compare_func, + _Py_hashtable_destroy_func key_destroy_func, + _Py_hashtable_destroy_func value_destroy_func, + _Py_hashtable_allocator_t *allocator); + +PyAPI_FUNC(void) _Py_hashtable_destroy(_Py_hashtable_t *ht); + +PyAPI_FUNC(void) _Py_hashtable_clear(_Py_hashtable_t *ht); + +typedef int (*_Py_hashtable_foreach_func) (_Py_hashtable_t *ht, + const void *key, const void *value, + void *user_data); + +/* Call func() on each entry of the hashtable. + Iteration stops if func() result is non-zero, in this case it's the result + of the call. Otherwise, the function returns 0. */ +PyAPI_FUNC(int) _Py_hashtable_foreach( + _Py_hashtable_t *ht, + _Py_hashtable_foreach_func func, + void *user_data); + +PyAPI_FUNC(size_t) _Py_hashtable_size(const _Py_hashtable_t *ht); + +/* Add a new entry to the hash. The key must not be present in the hash table. + Return 0 on success, -1 on memory error. */ +PyAPI_FUNC(int) _Py_hashtable_set( + _Py_hashtable_t *ht, + const void *key, + void *value); + + +/* Get an entry. + Return NULL if the key does not exist. */ +static inline _Py_hashtable_entry_t * +_Py_hashtable_get_entry(_Py_hashtable_t *ht, const void *key) +{ + return ht->get_entry_func(ht, key); +} + + +/* Get value from an entry. + Return NULL if the entry is not found. + + Use _Py_hashtable_get_entry() to distinguish entry value equal to NULL + and entry not found. */ +PyAPI_FUNC(void*) _Py_hashtable_get(_Py_hashtable_t *ht, const void *key); + + +/* Remove a key and its associated value without calling key and value destroy + functions. + + Return the removed value if the key was found. + Return NULL if the key was not found. */ +PyAPI_FUNC(void*) _Py_hashtable_steal( + _Py_hashtable_t *ht, + const void *key); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_HASHTABLE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_import.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_import.h new file mode 100644 index 0000000000000000000000000000000000000000..aee1f66a3ea171866018d2b54323f036717409bb --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_import.h @@ -0,0 +1,27 @@ +#ifndef Py_LIMITED_API +#ifndef Py_INTERNAL_IMPORT_H +#define Py_INTERNAL_IMPORT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_FORK +extern PyStatus _PyImport_ReInitLock(void); +#endif +extern PyObject* _PyImport_BootstrapImp(PyThreadState *tstate); + +struct _module_alias { + const char *name; /* ASCII encoded string */ + const char *orig; /* ASCII encoded string */ +}; + +PyAPI_DATA(const struct _frozen *) _PyImport_FrozenBootstrap; +PyAPI_DATA(const struct _frozen *) _PyImport_FrozenStdlib; +PyAPI_DATA(const struct _frozen *) _PyImport_FrozenTest; +extern const struct _module_alias * _PyImport_FrozenAliases; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_IMPORT_H */ +#endif /* !Py_LIMITED_API */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_initconfig.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_initconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..d765600fecf4e8207903f084e19a16af1b6a3c91 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_initconfig.h @@ -0,0 +1,183 @@ +#ifndef Py_INTERNAL_CORECONFIG_H +#define Py_INTERNAL_CORECONFIG_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Forward declaration */ +struct pyruntimestate; + +/* --- PyStatus ----------------------------------------------- */ + +/* Almost all errors causing Python initialization to fail */ +#ifdef _MSC_VER + /* Visual Studio 2015 doesn't implement C99 __func__ in C */ +# define _PyStatus_GET_FUNC() __FUNCTION__ +#else +# define _PyStatus_GET_FUNC() __func__ +#endif + +#define _PyStatus_OK() \ + (PyStatus){._type = _PyStatus_TYPE_OK,} + /* other fields are set to 0 */ +#define _PyStatus_ERR(ERR_MSG) \ + (PyStatus){ \ + ._type = _PyStatus_TYPE_ERROR, \ + .func = _PyStatus_GET_FUNC(), \ + .err_msg = (ERR_MSG)} + /* other fields are set to 0 */ +#define _PyStatus_NO_MEMORY() _PyStatus_ERR("memory allocation failed") +#define _PyStatus_EXIT(EXITCODE) \ + (PyStatus){ \ + ._type = _PyStatus_TYPE_EXIT, \ + .exitcode = (EXITCODE)} +#define _PyStatus_IS_ERROR(err) \ + (err._type == _PyStatus_TYPE_ERROR) +#define _PyStatus_IS_EXIT(err) \ + (err._type == _PyStatus_TYPE_EXIT) +#define _PyStatus_EXCEPTION(err) \ + (err._type != _PyStatus_TYPE_OK) +#define _PyStatus_UPDATE_FUNC(err) \ + do { err.func = _PyStatus_GET_FUNC(); } while (0) + +PyObject* _PyErr_SetFromPyStatus(PyStatus status); + +/* --- PyWideStringList ------------------------------------------------ */ + +#define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL} + +#ifndef NDEBUG +PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list); +#endif +PyAPI_FUNC(void) _PyWideStringList_Clear(PyWideStringList *list); +PyAPI_FUNC(int) _PyWideStringList_Copy(PyWideStringList *list, + const PyWideStringList *list2); +PyAPI_FUNC(PyStatus) _PyWideStringList_Extend(PyWideStringList *list, + const PyWideStringList *list2); +PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list); + + +/* --- _PyArgv ---------------------------------------------------- */ + +typedef struct _PyArgv { + Py_ssize_t argc; + int use_bytes_argv; + char * const *bytes_argv; + wchar_t * const *wchar_argv; +} _PyArgv; + +PyAPI_FUNC(PyStatus) _PyArgv_AsWstrList(const _PyArgv *args, + PyWideStringList *list); + + +/* --- Helper functions ------------------------------------------- */ + +PyAPI_FUNC(int) _Py_str_to_int( + const char *str, + int *result); +PyAPI_FUNC(const wchar_t*) _Py_get_xoption( + const PyWideStringList *xoptions, + const wchar_t *name); +PyAPI_FUNC(const char*) _Py_GetEnv( + int use_environment, + const char *name); +PyAPI_FUNC(void) _Py_get_env_flag( + int use_environment, + int *flag, + const char *name); + +/* Py_GetArgcArgv() helper */ +PyAPI_FUNC(void) _Py_ClearArgcArgv(void); + + +/* --- _PyPreCmdline ------------------------------------------------- */ + +typedef struct { + PyWideStringList argv; + PyWideStringList xoptions; /* "-X value" option */ + int isolated; /* -I option */ + int use_environment; /* -E option */ + int dev_mode; /* -X dev and PYTHONDEVMODE */ + int warn_default_encoding; /* -X warn_default_encoding and PYTHONWARNDEFAULTENCODING */ +} _PyPreCmdline; + +#define _PyPreCmdline_INIT \ + (_PyPreCmdline){ \ + .use_environment = -1, \ + .isolated = -1, \ + .dev_mode = -1} +/* Note: _PyPreCmdline_INIT sets other fields to 0/NULL */ + +extern void _PyPreCmdline_Clear(_PyPreCmdline *cmdline); +extern PyStatus _PyPreCmdline_SetArgv(_PyPreCmdline *cmdline, + const _PyArgv *args); +extern PyStatus _PyPreCmdline_SetConfig( + const _PyPreCmdline *cmdline, + PyConfig *config); +extern PyStatus _PyPreCmdline_Read(_PyPreCmdline *cmdline, + const PyPreConfig *preconfig); + + +/* --- PyPreConfig ----------------------------------------------- */ + +PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig); +extern void _PyPreConfig_InitFromConfig( + PyPreConfig *preconfig, + const PyConfig *config); +extern PyStatus _PyPreConfig_InitFromPreConfig( + PyPreConfig *preconfig, + const PyPreConfig *config2); +extern PyObject* _PyPreConfig_AsDict(const PyPreConfig *preconfig); +extern void _PyPreConfig_GetConfig(PyPreConfig *preconfig, + const PyConfig *config); +extern PyStatus _PyPreConfig_Read(PyPreConfig *preconfig, + const _PyArgv *args); +extern PyStatus _PyPreConfig_Write(const PyPreConfig *preconfig); + + +/* --- PyConfig ---------------------------------------------- */ + +typedef enum { + /* Py_Initialize() API: backward compatibility with Python 3.6 and 3.7 */ + _PyConfig_INIT_COMPAT = 1, + _PyConfig_INIT_PYTHON = 2, + _PyConfig_INIT_ISOLATED = 3 +} _PyConfigInitEnum; + +PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config); +extern PyStatus _PyConfig_Copy( + PyConfig *config, + const PyConfig *config2); +extern PyStatus _PyConfig_InitPathConfig( + PyConfig *config, + int compute_path_config); +extern PyStatus _PyConfig_InitImportConfig(PyConfig *config); +extern PyStatus _PyConfig_Read(PyConfig *config, int compute_path_config); +extern PyStatus _PyConfig_Write(const PyConfig *config, + struct pyruntimestate *runtime); +extern PyStatus _PyConfig_SetPyArgv( + PyConfig *config, + const _PyArgv *args); + +PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config); +PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict); + +extern void _Py_DumpPathConfig(PyThreadState *tstate); + +PyAPI_FUNC(PyObject*) _Py_Get_Getpath_CodeObject(void); + +extern int _Py_global_config_int_max_str_digits; + + +/* --- Function used for testing ---------------------------------- */ + +PyAPI_FUNC(PyObject*) _Py_GetConfigsAsDict(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CORECONFIG_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interp.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interp.h new file mode 100644 index 0000000000000000000000000000000000000000..02d25d67c742954ce264296f101b32856e024e14 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interp.h @@ -0,0 +1,227 @@ +#ifndef Py_INTERNAL_INTERP_H +#define Py_INTERNAL_INTERP_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include + +#include "pycore_atomic.h" // _Py_atomic_address +#include "pycore_ast_state.h" // struct ast_state +#include "pycore_code.h" // struct callable_cache +#include "pycore_context.h" // struct _Py_context_state +#include "pycore_dict.h" // struct _Py_dict_state +#include "pycore_exceptions.h" // struct _Py_exc_state +#include "pycore_floatobject.h" // struct _Py_float_state +#include "pycore_genobject.h" // struct _Py_async_gen_state +#include "pycore_gil.h" // struct _gil_runtime_state +#include "pycore_gc.h" // struct _gc_runtime_state +#include "pycore_list.h" // struct _Py_list_state +#include "pycore_tuple.h" // struct _Py_tuple_state +#include "pycore_typeobject.h" // struct type_cache +#include "pycore_unicodeobject.h" // struct _Py_unicode_state +#include "pycore_warnings.h" // struct _warnings_runtime_state + +struct _pending_calls { + PyThread_type_lock lock; + /* Request for running pending calls. */ + _Py_atomic_int calls_to_do; + /* Request for looking at the `async_exc` field of the current + thread state. + Guarded by the GIL. */ + int async_exc; +#define NPENDINGCALLS 32 + struct { + int (*func)(void *); + void *arg; + } calls[NPENDINGCALLS]; + int first; + int last; +}; + +struct _ceval_state { + int recursion_limit; + /* This single variable consolidates all requests to break out of + the fast path in the eval loop. */ + _Py_atomic_int eval_breaker; + /* Request for dropping the GIL */ + _Py_atomic_int gil_drop_request; + struct _pending_calls pending; +}; + + +// atexit state +typedef struct { + PyObject *func; + PyObject *args; + PyObject *kwargs; +} atexit_callback; + +struct atexit_state { + atexit_callback **callbacks; + int ncallbacks; + int callback_len; +}; + + +/* interpreter state */ + +/* PyInterpreterState holds the global state for one of the runtime's + interpreters. Typically the initial (main) interpreter is the only one. + + The PyInterpreterState typedef is in Include/pystate.h. + */ +struct _is { + + PyInterpreterState *next; + + struct pythreads { + uint64_t next_unique_id; + /* The linked list of threads, newest first. */ + PyThreadState *head; + /* Used in Modules/_threadmodule.c. */ + long count; + /* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ + /* Used in Python/thread.c. */ + size_t stacksize; + } threads; + + /* Reference to the _PyRuntime global variable. This field exists + to not have to pass runtime in addition to tstate to a function. + Get runtime from tstate: tstate->interp->runtime. */ + struct pyruntimestate *runtime; + + int64_t id; + int64_t id_refcount; + int requires_idref; + PyThread_type_lock id_mutex; + + /* Has been initialized to a safe state. + + In order to be effective, this must be set to 0 during or right + after allocation. */ + int _initialized; + int finalizing; + + /* Was this interpreter statically allocated? */ + bool _static; + + struct _ceval_state ceval; + struct _gc_runtime_state gc; + + // sys.modules dictionary + PyObject *modules; + PyObject *modules_by_index; + // Dictionary of the sys module + PyObject *sysdict; + // Dictionary of the builtins module + PyObject *builtins; + // importlib module + PyObject *importlib; + // override for config->use_frozen_modules (for tests) + // (-1: "off", 1: "on", 0: no override) + int override_frozen_modules; + + PyObject *codec_search_path; + PyObject *codec_search_cache; + PyObject *codec_error_registry; + int codecs_initialized; + + PyConfig config; +#ifdef HAVE_DLOPEN + int dlopenflags; +#endif + + PyObject *dict; /* Stores per-interpreter state */ + + PyObject *builtins_copy; + PyObject *import_func; + // Initialized to _PyEval_EvalFrameDefault(). + _PyFrameEvalFunction eval_frame; + + Py_ssize_t co_extra_user_count; + freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; + +#ifdef HAVE_FORK + PyObject *before_forkers; + PyObject *after_forkers_parent; + PyObject *after_forkers_child; +#endif + + struct _warnings_runtime_state warnings; + struct atexit_state atexit; + + PyObject *audit_hooks; + + struct _Py_unicode_state unicode; + struct _Py_float_state float_state; + /* Using a cache is very effective since typically only a single slice is + created and then deleted again. */ + PySliceObject *slice_cache; + + struct _Py_tuple_state tuple; + struct _Py_list_state list; + struct _Py_dict_state dict_state; + struct _Py_async_gen_state async_gen; + struct _Py_context_state context; + struct _Py_exc_state exc_state; + + struct ast_state ast; + struct type_cache type_cache; + struct callable_cache callable_cache; + + int int_max_str_digits; + + /* The following fields are here to avoid allocation during init. + The data is exposed through PyInterpreterState pointer fields. + These fields should not be accessed directly outside of init. + + All other PyInterpreterState pointer fields are populated when + needed and default to NULL. + + For now there are some exceptions to that rule, which require + allocation during init. These will be addressed on a case-by-case + basis. Also see _PyRuntimeState regarding the various mutex fields. + */ + + /* the initial PyInterpreterState.threads.head */ + PyThreadState _initial_thread; +}; + + +/* other API */ + +extern void _PyInterpreterState_ClearModules(PyInterpreterState *interp); +extern void _PyInterpreterState_Clear(PyThreadState *tstate); + + +/* cross-interpreter data registry */ + +/* For now we use a global registry of shareable classes. An + alternative would be to add a tp_* slot for a class's + crossinterpdatafunc. It would be simpler and more efficient. */ + +struct _xidregitem; + +struct _xidregitem { + PyTypeObject *cls; + crossinterpdatafunc getdata; + struct _xidregitem *next; +}; + +PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_LookUpID(int64_t); + +PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *); +PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *); +PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_INTERP_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interpreteridobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interpreteridobject.h new file mode 100644 index 0000000000000000000000000000000000000000..804831e76deaeac213e122f6373bc1812d5af8ff --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_interpreteridobject.h @@ -0,0 +1,22 @@ +/* Interpreter ID Object */ + +#ifndef Py_INTERNAL_INTERPRETERIDOBJECT_H +#define Py_INTERNAL_INTERPRETERIDOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type; + +PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t); +PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *); +PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *); + +#ifdef __cplusplus +} +#endif +#endif // !Py_INTERNAL_INTERPRETERIDOBJECT_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_list.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_list.h new file mode 100644 index 0000000000000000000000000000000000000000..860dce1fd5d3938fcf6f146bb7705eb1e1835940 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_list.h @@ -0,0 +1,62 @@ +#ifndef Py_INTERNAL_LIST_H +#define Py_INTERNAL_LIST_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "listobject.h" // _PyList_CAST() + + +/* runtime lifecycle */ + +extern void _PyList_Fini(PyInterpreterState *); + + +/* other API */ + +#ifndef WITH_FREELISTS +// without freelists +# define PyList_MAXFREELIST 0 +#endif + +/* Empty list reuse scheme to save calls to malloc and free */ +#ifndef PyList_MAXFREELIST +# define PyList_MAXFREELIST 80 +#endif + +struct _Py_list_state { +#if PyList_MAXFREELIST > 0 + PyListObject *free_list[PyList_MAXFREELIST]; + int numfree; +#endif +}; + +#define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item) + +extern int +_PyList_AppendTakeRefListResize(PyListObject *self, PyObject *newitem); + +static inline int +_PyList_AppendTakeRef(PyListObject *self, PyObject *newitem) +{ + assert(self != NULL && newitem != NULL); + assert(PyList_Check(self)); + Py_ssize_t len = PyList_GET_SIZE(self); + Py_ssize_t allocated = self->allocated; + assert((size_t)len + 1 < PY_SSIZE_T_MAX); + if (allocated > len) { + PyList_SET_ITEM(self, len, newitem); + Py_SET_SIZE(self, len + 1); + return 0; + } + return _PyList_AppendTakeRefListResize(self, newitem); +} + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_LIST_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_long.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_long.h new file mode 100644 index 0000000000000000000000000000000000000000..0f466eb60feadb50f3e5ba8ddfdf6264fabf0216 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_long.h @@ -0,0 +1,114 @@ +#ifndef Py_INTERNAL_LONG_H +#define Py_INTERNAL_LONG_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_global_objects.h" // _PY_NSMALLNEGINTS +#include "pycore_runtime.h" // _PyRuntime + +/* + * Default int base conversion size limitation: Denial of Service prevention. + * + * Chosen such that this isn't wildly slow on modern hardware and so that + * everyone's existing deployed numpy test suite passes before + * https://github.com/numpy/numpy/issues/22098 is widely available. + * + * $ python -m timeit -s 's = "1"*4300' 'int(s)' + * 2000 loops, best of 5: 125 usec per loop + * $ python -m timeit -s 's = "1"*4300; v = int(s)' 'str(v)' + * 1000 loops, best of 5: 311 usec per loop + * (zen2 cloud VM) + * + * 4300 decimal digits fits a ~14284 bit number. + */ +#define _PY_LONG_DEFAULT_MAX_STR_DIGITS 4300 +/* + * Threshold for max digits check. For performance reasons int() and + * int.__str__() don't checks values that are smaller than this + * threshold. Acts as a guaranteed minimum size limit for bignums that + * applications can expect from CPython. + * + * % python -m timeit -s 's = "1"*640; v = int(s)' 'str(int(s))' + * 20000 loops, best of 5: 12 usec per loop + * + * "640 digits should be enough for anyone." - gps + * fits a ~2126 bit decimal number. + */ +#define _PY_LONG_MAX_STR_DIGITS_THRESHOLD 640 + +#if ((_PY_LONG_DEFAULT_MAX_STR_DIGITS != 0) && \ + (_PY_LONG_DEFAULT_MAX_STR_DIGITS < _PY_LONG_MAX_STR_DIGITS_THRESHOLD)) +# error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold." +#endif + + +/* runtime lifecycle */ + +extern PyStatus _PyLong_InitTypes(PyInterpreterState *); +extern void _PyLong_FiniTypes(PyInterpreterState *interp); + + +/* other API */ + +#define _PyLong_SMALL_INTS _Py_SINGLETON(small_ints) + +// _PyLong_GetZero() and _PyLong_GetOne() must always be available +// _PyLong_FromUnsignedChar must always be available +#if _PY_NSMALLPOSINTS < 257 +# error "_PY_NSMALLPOSINTS must be greater than or equal to 257" +#endif + +// Return a borrowed reference to the zero singleton. +// The function cannot return NULL. +static inline PyObject* _PyLong_GetZero(void) +{ return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS]; } + +// Return a borrowed reference to the one singleton. +// The function cannot return NULL. +static inline PyObject* _PyLong_GetOne(void) +{ return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+1]; } + +static inline PyObject* _PyLong_FromUnsignedChar(unsigned char i) +{ + return Py_NewRef((PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+i]); +} + +PyObject *_PyLong_Add(PyLongObject *left, PyLongObject *right); +PyObject *_PyLong_Multiply(PyLongObject *left, PyLongObject *right); +PyObject *_PyLong_Subtract(PyLongObject *left, PyLongObject *right); + +/* Used by Python/mystrtoul.c, _PyBytes_FromHex(), + _PyBytes_DecodeEscape(), etc. */ +PyAPI_DATA(unsigned char) _PyLong_DigitValue[256]; + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( + _PyUnicodeWriter *writer, + PyObject *obj, + PyObject *format_spec, + Py_ssize_t start, + Py_ssize_t end); + +PyAPI_FUNC(int) _PyLong_FormatWriter( + _PyUnicodeWriter *writer, + PyObject *obj, + int base, + int alternate); + +PyAPI_FUNC(char*) _PyLong_FormatBytesWriter( + _PyBytesWriter *writer, + char *str, + PyObject *obj, + int base, + int alternate); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_LONG_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_moduleobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_moduleobject.h new file mode 100644 index 0000000000000000000000000000000000000000..76361b8dff113a03da060772f178182e2d0fd274 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_moduleobject.h @@ -0,0 +1,42 @@ +#ifndef Py_INTERNAL_MODULEOBJECT_H +#define Py_INTERNAL_MODULEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +typedef struct { + PyObject_HEAD + PyObject *md_dict; + PyModuleDef *md_def; + void *md_state; + PyObject *md_weaklist; + // for logging purposes after md_dict is cleared + PyObject *md_name; +} PyModuleObject; + +static inline PyModuleDef* _PyModule_GetDef(PyObject *mod) { + assert(PyModule_Check(mod)); + return ((PyModuleObject *)mod)->md_def; +} + +static inline void* _PyModule_GetState(PyObject* mod) { + assert(PyModule_Check(mod)); + return ((PyModuleObject *)mod)->md_state; +} + +static inline PyObject* _PyModule_GetDict(PyObject *mod) { + assert(PyModule_Check(mod)); + PyObject *dict = ((PyModuleObject *)mod) -> md_dict; + // _PyModule_GetDict(mod) must not be used after calling module_clear(mod) + assert(dict != NULL); + return dict; +} + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_MODULEOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_namespace.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_namespace.h new file mode 100644 index 0000000000000000000000000000000000000000..cb76f040693d10b4fe8a7f19cbf195831f3044f5 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_namespace.h @@ -0,0 +1,20 @@ +// Simple namespace object interface + +#ifndef Py_INTERNAL_NAMESPACE_H +#define Py_INTERNAL_NAMESPACE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +PyAPI_DATA(PyTypeObject) _PyNamespace_Type; + +PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds); + +#ifdef __cplusplus +} +#endif +#endif // !Py_INTERNAL_NAMESPACE_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_object.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_object.h new file mode 100644 index 0000000000000000000000000000000000000000..f022f8246989d1509a00a343a841752fdcf320f0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_object.h @@ -0,0 +1,310 @@ +#ifndef Py_INTERNAL_OBJECT_H +#define Py_INTERNAL_OBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include +#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED() +#include "pycore_interp.h" // PyInterpreterState.gc +#include "pycore_pystate.h" // _PyInterpreterState_GET() +#include "pycore_runtime.h" // _PyRuntime + +#define _PyObject_IMMORTAL_INIT(type) \ + { \ + .ob_refcnt = 999999999, \ + .ob_type = type, \ + } +#define _PyVarObject_IMMORTAL_INIT(type, size) \ + { \ + .ob_base = _PyObject_IMMORTAL_INIT(type), \ + .ob_size = size, \ + } + +PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc( + const char *func, + const char *message); + +#define _Py_FatalRefcountError(message) _Py_FatalRefcountErrorFunc(__func__, message) + +static inline void +_Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct) +{ +#ifdef Py_REF_DEBUG + _Py_RefTotal--; +#endif + if (--op->ob_refcnt != 0) { + assert(op->ob_refcnt > 0); + } + else { +#ifdef Py_TRACE_REFS + _Py_ForgetReference(op); +#endif + destruct(op); + } +} + +static inline void +_Py_DECREF_NO_DEALLOC(PyObject *op) +{ +#ifdef Py_REF_DEBUG + _Py_RefTotal--; +#endif + op->ob_refcnt--; +#ifdef Py_DEBUG + if (op->ob_refcnt <= 0) { + _Py_FatalRefcountError("Expected a positive remaining refcount"); + } +#endif +} + +PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type); +PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content); + +/* Update the Python traceback of an object. This function must be called + when a memory block is reused from a free list. + + Internal function called by _Py_NewReference(). */ +extern int _PyTraceMalloc_NewReference(PyObject *op); + +// Fast inlined version of PyType_HasFeature() +static inline int +_PyType_HasFeature(PyTypeObject *type, unsigned long feature) { + return ((type->tp_flags & feature) != 0); +} + +extern void _PyType_InitCache(PyInterpreterState *interp); + + +/* Inline functions trading binary compatibility for speed: + _PyObject_Init() is the fast version of PyObject_Init(), and + _PyObject_InitVar() is the fast version of PyObject_InitVar(). + + These inline functions must not be called with op=NULL. */ +static inline void +_PyObject_Init(PyObject *op, PyTypeObject *typeobj) +{ + assert(op != NULL); + Py_SET_TYPE(op, typeobj); + if (_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE)) { + Py_INCREF(typeobj); + } + _Py_NewReference(op); +} + +static inline void +_PyObject_InitVar(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size) +{ + assert(op != NULL); + Py_SET_SIZE(op, size); + _PyObject_Init((PyObject *)op, typeobj); +} + + +/* Tell the GC to track this object. + * + * The object must not be tracked by the GC. + * + * NB: While the object is tracked by the collector, it must be safe to call the + * ob_traverse method. + * + * Internal note: interp->gc.generation0->_gc_prev doesn't have any bit flags + * because it's not object header. So we don't use _PyGCHead_PREV() and + * _PyGCHead_SET_PREV() for it to avoid unnecessary bitwise operations. + * + * See also the public PyObject_GC_Track() function. + */ +static inline void _PyObject_GC_TRACK( +// The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined +#ifndef NDEBUG + const char *filename, int lineno, +#endif + PyObject *op) +{ + _PyObject_ASSERT_FROM(op, !_PyObject_GC_IS_TRACKED(op), + "object already tracked by the garbage collector", + filename, lineno, __func__); + + PyGC_Head *gc = _Py_AS_GC(op); + _PyObject_ASSERT_FROM(op, + (gc->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0, + "object is in generation which is garbage collected", + filename, lineno, __func__); + + PyInterpreterState *interp = _PyInterpreterState_GET(); + PyGC_Head *generation0 = interp->gc.generation0; + PyGC_Head *last = (PyGC_Head*)(generation0->_gc_prev); + _PyGCHead_SET_NEXT(last, gc); + _PyGCHead_SET_PREV(gc, last); + _PyGCHead_SET_NEXT(gc, generation0); + generation0->_gc_prev = (uintptr_t)gc; +} + +/* Tell the GC to stop tracking this object. + * + * Internal note: This may be called while GC. So _PyGC_PREV_MASK_COLLECTING + * must be cleared. But _PyGC_PREV_MASK_FINALIZED bit is kept. + * + * The object must be tracked by the GC. + * + * See also the public PyObject_GC_UnTrack() which accept an object which is + * not tracked. + */ +static inline void _PyObject_GC_UNTRACK( +// The preprocessor removes _PyObject_ASSERT_FROM() calls if NDEBUG is defined +#ifndef NDEBUG + const char *filename, int lineno, +#endif + PyObject *op) +{ + _PyObject_ASSERT_FROM(op, _PyObject_GC_IS_TRACKED(op), + "object not tracked by the garbage collector", + filename, lineno, __func__); + + PyGC_Head *gc = _Py_AS_GC(op); + PyGC_Head *prev = _PyGCHead_PREV(gc); + PyGC_Head *next = _PyGCHead_NEXT(gc); + _PyGCHead_SET_NEXT(prev, next); + _PyGCHead_SET_PREV(next, prev); + gc->_gc_next = 0; + gc->_gc_prev &= _PyGC_PREV_MASK_FINALIZED; +} + +// Macros to accept any type for the parameter, and to automatically pass +// the filename and the filename (if NDEBUG is not defined) where the macro +// is called. +#ifdef NDEBUG +# define _PyObject_GC_TRACK(op) \ + _PyObject_GC_TRACK(_PyObject_CAST(op)) +# define _PyObject_GC_UNTRACK(op) \ + _PyObject_GC_UNTRACK(_PyObject_CAST(op)) +#else +# define _PyObject_GC_TRACK(op) \ + _PyObject_GC_TRACK(__FILE__, __LINE__, _PyObject_CAST(op)) +# define _PyObject_GC_UNTRACK(op) \ + _PyObject_GC_UNTRACK(__FILE__, __LINE__, _PyObject_CAST(op)) +#endif + +#ifdef Py_REF_DEBUG +extern void _PyDebug_PrintTotalRefs(void); +#endif + +#ifdef Py_TRACE_REFS +extern void _Py_AddToAllObjects(PyObject *op, int force); +extern void _Py_PrintReferences(FILE *); +extern void _Py_PrintReferenceAddresses(FILE *); +#endif + +static inline PyObject ** +_PyObject_GET_WEAKREFS_LISTPTR(PyObject *op) +{ + Py_ssize_t offset = Py_TYPE(op)->tp_weaklistoffset; + return (PyObject **)((char *)op + offset); +} + +// Fast inlined version of PyObject_IS_GC() +static inline int +_PyObject_IS_GC(PyObject *obj) +{ + return (PyType_IS_GC(Py_TYPE(obj)) + && (Py_TYPE(obj)->tp_is_gc == NULL + || Py_TYPE(obj)->tp_is_gc(obj))); +} + +// Fast inlined version of PyType_IS_GC() +#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) + +static inline size_t +_PyType_PreHeaderSize(PyTypeObject *tp) +{ + return _PyType_IS_GC(tp) * sizeof(PyGC_Head) + + _PyType_HasFeature(tp, Py_TPFLAGS_MANAGED_DICT) * 2 * sizeof(PyObject *); +} + +void _PyObject_GC_Link(PyObject *op); + +// Usage: assert(_Py_CheckSlotResult(obj, "__getitem__", result != NULL)); +extern int _Py_CheckSlotResult( + PyObject *obj, + const char *slot_name, + int success); + +// PyType_Ready() must be called if _PyType_IsReady() is false. +// See also the Py_TPFLAGS_READY flag. +#define _PyType_IsReady(type) ((type)->tp_dict != NULL) + +// Test if a type supports weak references +static inline int _PyType_SUPPORTS_WEAKREFS(PyTypeObject *type) { + return (type->tp_weaklistoffset > 0); +} + +extern PyObject* _PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems); + +extern int _PyObject_InitializeDict(PyObject *obj); +extern int _PyObject_StoreInstanceAttribute(PyObject *obj, PyDictValues *values, + PyObject *name, PyObject *value); +PyObject * _PyObject_GetInstanceAttribute(PyObject *obj, PyDictValues *values, + PyObject *name); + +static inline PyDictValues **_PyObject_ValuesPointer(PyObject *obj) +{ + assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT); + return ((PyDictValues **)obj)-4; +} + +static inline PyObject **_PyObject_ManagedDictPointer(PyObject *obj) +{ + assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT); + return ((PyObject **)obj)-3; +} + +#define MANAGED_DICT_OFFSET (((int)sizeof(PyObject *))*-3) + +extern PyObject ** _PyObject_DictPointer(PyObject *); +extern int _PyObject_VisitInstanceAttributes(PyObject *self, visitproc visit, void *arg); +extern void _PyObject_ClearInstanceAttributes(PyObject *self); +extern void _PyObject_FreeInstanceAttributes(PyObject *self); +extern int _PyObject_IsInstanceDictEmpty(PyObject *); +extern PyObject* _PyType_GetSubclasses(PyTypeObject *); + +// Access macro to the members which are floating "behind" the object +#define _PyHeapType_GET_MEMBERS(etype) \ + ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) + +PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, PyObject *); + +/* C function call trampolines to mitigate bad function pointer casts. + * + * Typical native ABIs ignore additional arguments or fill in missing + * values with 0/NULL in function pointer cast. Compilers do not show + * warnings when a function pointer is explicitly casted to an + * incompatible type. + * + * Bad fpcasts are an issue in WebAssembly. WASM's indirect_call has strict + * function signature checks. Argument count, types, and return type must + * match. + * + * Third party code unintentionally rely on problematic fpcasts. The call + * trampoline mitigates common occurences of bad fpcasts on Emscripten. + */ +#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE) +#define _PyCFunction_TrampolineCall(meth, self, args) \ + _PyCFunctionWithKeywords_TrampolineCall( \ + (*(PyCFunctionWithKeywords)(void(*)(void))meth), self, args, NULL) +extern PyObject* _PyCFunctionWithKeywords_TrampolineCall( + PyCFunctionWithKeywords meth, PyObject *, PyObject *, PyObject *); +#else +#define _PyCFunction_TrampolineCall(meth, self, args) \ + (meth)((self), (args)) +#define _PyCFunctionWithKeywords_TrampolineCall(meth, self, args, kw) \ + (meth)((self), (args), (kw)) +#endif // __EMSCRIPTEN__ && PY_CALL_TRAMPOLINE + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_OBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_opcode.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_opcode.h new file mode 100644 index 0000000000000000000000000000000000000000..eadcba1add0aefc79a204865105a11ab5a56799b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_opcode.h @@ -0,0 +1,581 @@ +// Auto-generated by Tools/scripts/generate_opcode_h.py from Lib/opcode.py + +#ifndef Py_INTERNAL_OPCODE_H +#define Py_INTERNAL_OPCODE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "opcode.h" + +extern const uint8_t _PyOpcode_Caches[256]; + +extern const uint8_t _PyOpcode_Deopt[256]; + +#ifdef NEED_OPCODE_TABLES +static const uint32_t _PyOpcode_RelativeJump[8] = { + 0U, + 0U, + 536870912U, + 135118848U, + 4163U, + 122880U, + 0U, + 0U, +}; +static const uint32_t _PyOpcode_Jump[8] = { + 0U, + 0U, + 536870912U, + 135118848U, + 4163U, + 122880U, + 0U, + 0U, +}; + +const uint8_t _PyOpcode_Caches[256] = { + [BINARY_SUBSCR] = 4, + [STORE_SUBSCR] = 1, + [UNPACK_SEQUENCE] = 1, + [STORE_ATTR] = 4, + [LOAD_ATTR] = 4, + [COMPARE_OP] = 2, + [LOAD_GLOBAL] = 5, + [BINARY_OP] = 1, + [LOAD_METHOD] = 10, + [PRECALL] = 1, + [CALL] = 4, +}; + +const uint8_t _PyOpcode_Deopt[256] = { + [ASYNC_GEN_WRAP] = ASYNC_GEN_WRAP, + [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH, + [BEFORE_WITH] = BEFORE_WITH, + [BINARY_OP] = BINARY_OP, + [BINARY_OP_ADAPTIVE] = BINARY_OP, + [BINARY_OP_ADD_FLOAT] = BINARY_OP, + [BINARY_OP_ADD_INT] = BINARY_OP, + [BINARY_OP_ADD_UNICODE] = BINARY_OP, + [BINARY_OP_INPLACE_ADD_UNICODE] = BINARY_OP, + [BINARY_OP_MULTIPLY_FLOAT] = BINARY_OP, + [BINARY_OP_MULTIPLY_INT] = BINARY_OP, + [BINARY_OP_SUBTRACT_FLOAT] = BINARY_OP, + [BINARY_OP_SUBTRACT_INT] = BINARY_OP, + [BINARY_SUBSCR] = BINARY_SUBSCR, + [BINARY_SUBSCR_ADAPTIVE] = BINARY_SUBSCR, + [BINARY_SUBSCR_DICT] = BINARY_SUBSCR, + [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR, + [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR, + [BINARY_SUBSCR_TUPLE_INT] = BINARY_SUBSCR, + [BUILD_CONST_KEY_MAP] = BUILD_CONST_KEY_MAP, + [BUILD_LIST] = BUILD_LIST, + [BUILD_MAP] = BUILD_MAP, + [BUILD_SET] = BUILD_SET, + [BUILD_SLICE] = BUILD_SLICE, + [BUILD_STRING] = BUILD_STRING, + [BUILD_TUPLE] = BUILD_TUPLE, + [CACHE] = CACHE, + [CALL] = CALL, + [CALL_ADAPTIVE] = CALL, + [CALL_FUNCTION_EX] = CALL_FUNCTION_EX, + [CALL_PY_EXACT_ARGS] = CALL, + [CALL_PY_WITH_DEFAULTS] = CALL, + [CHECK_EG_MATCH] = CHECK_EG_MATCH, + [CHECK_EXC_MATCH] = CHECK_EXC_MATCH, + [COMPARE_OP] = COMPARE_OP, + [COMPARE_OP_ADAPTIVE] = COMPARE_OP, + [COMPARE_OP_FLOAT_JUMP] = COMPARE_OP, + [COMPARE_OP_INT_JUMP] = COMPARE_OP, + [COMPARE_OP_STR_JUMP] = COMPARE_OP, + [CONTAINS_OP] = CONTAINS_OP, + [COPY] = COPY, + [COPY_FREE_VARS] = COPY_FREE_VARS, + [DELETE_ATTR] = DELETE_ATTR, + [DELETE_DEREF] = DELETE_DEREF, + [DELETE_FAST] = DELETE_FAST, + [DELETE_GLOBAL] = DELETE_GLOBAL, + [DELETE_NAME] = DELETE_NAME, + [DELETE_SUBSCR] = DELETE_SUBSCR, + [DICT_MERGE] = DICT_MERGE, + [DICT_UPDATE] = DICT_UPDATE, + [END_ASYNC_FOR] = END_ASYNC_FOR, + [EXTENDED_ARG] = EXTENDED_ARG, + [EXTENDED_ARG_QUICK] = EXTENDED_ARG, + [FORMAT_VALUE] = FORMAT_VALUE, + [FOR_ITER] = FOR_ITER, + [GET_AITER] = GET_AITER, + [GET_ANEXT] = GET_ANEXT, + [GET_AWAITABLE] = GET_AWAITABLE, + [GET_ITER] = GET_ITER, + [GET_LEN] = GET_LEN, + [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER, + [IMPORT_FROM] = IMPORT_FROM, + [IMPORT_NAME] = IMPORT_NAME, + [IMPORT_STAR] = IMPORT_STAR, + [IS_OP] = IS_OP, + [JUMP_BACKWARD] = JUMP_BACKWARD, + [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT, + [JUMP_BACKWARD_QUICK] = JUMP_BACKWARD, + [JUMP_FORWARD] = JUMP_FORWARD, + [JUMP_IF_FALSE_OR_POP] = JUMP_IF_FALSE_OR_POP, + [JUMP_IF_TRUE_OR_POP] = JUMP_IF_TRUE_OR_POP, + [KW_NAMES] = KW_NAMES, + [LIST_APPEND] = LIST_APPEND, + [LIST_EXTEND] = LIST_EXTEND, + [LIST_TO_TUPLE] = LIST_TO_TUPLE, + [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR, + [LOAD_ATTR] = LOAD_ATTR, + [LOAD_ATTR_ADAPTIVE] = LOAD_ATTR, + [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR, + [LOAD_ATTR_MODULE] = LOAD_ATTR, + [LOAD_ATTR_SLOT] = LOAD_ATTR, + [LOAD_ATTR_WITH_HINT] = LOAD_ATTR, + [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS, + [LOAD_CLASSDEREF] = LOAD_CLASSDEREF, + [LOAD_CLOSURE] = LOAD_CLOSURE, + [LOAD_CONST] = LOAD_CONST, + [LOAD_CONST__LOAD_FAST] = LOAD_CONST, + [LOAD_DEREF] = LOAD_DEREF, + [LOAD_FAST] = LOAD_FAST, + [LOAD_FAST__LOAD_CONST] = LOAD_FAST, + [LOAD_FAST__LOAD_FAST] = LOAD_FAST, + [LOAD_GLOBAL] = LOAD_GLOBAL, + [LOAD_GLOBAL_ADAPTIVE] = LOAD_GLOBAL, + [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL, + [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL, + [LOAD_METHOD] = LOAD_METHOD, + [LOAD_METHOD_ADAPTIVE] = LOAD_METHOD, + [LOAD_METHOD_CLASS] = LOAD_METHOD, + [LOAD_METHOD_MODULE] = LOAD_METHOD, + [LOAD_METHOD_NO_DICT] = LOAD_METHOD, + [LOAD_METHOD_WITH_DICT] = LOAD_METHOD, + [LOAD_METHOD_WITH_VALUES] = LOAD_METHOD, + [LOAD_NAME] = LOAD_NAME, + [MAKE_CELL] = MAKE_CELL, + [MAKE_FUNCTION] = MAKE_FUNCTION, + [MAP_ADD] = MAP_ADD, + [MATCH_CLASS] = MATCH_CLASS, + [MATCH_KEYS] = MATCH_KEYS, + [MATCH_MAPPING] = MATCH_MAPPING, + [MATCH_SEQUENCE] = MATCH_SEQUENCE, + [NOP] = NOP, + [POP_EXCEPT] = POP_EXCEPT, + [POP_JUMP_BACKWARD_IF_FALSE] = POP_JUMP_BACKWARD_IF_FALSE, + [POP_JUMP_BACKWARD_IF_NONE] = POP_JUMP_BACKWARD_IF_NONE, + [POP_JUMP_BACKWARD_IF_NOT_NONE] = POP_JUMP_BACKWARD_IF_NOT_NONE, + [POP_JUMP_BACKWARD_IF_TRUE] = POP_JUMP_BACKWARD_IF_TRUE, + [POP_JUMP_FORWARD_IF_FALSE] = POP_JUMP_FORWARD_IF_FALSE, + [POP_JUMP_FORWARD_IF_NONE] = POP_JUMP_FORWARD_IF_NONE, + [POP_JUMP_FORWARD_IF_NOT_NONE] = POP_JUMP_FORWARD_IF_NOT_NONE, + [POP_JUMP_FORWARD_IF_TRUE] = POP_JUMP_FORWARD_IF_TRUE, + [POP_TOP] = POP_TOP, + [PRECALL] = PRECALL, + [PRECALL_ADAPTIVE] = PRECALL, + [PRECALL_BOUND_METHOD] = PRECALL, + [PRECALL_BUILTIN_CLASS] = PRECALL, + [PRECALL_BUILTIN_FAST_WITH_KEYWORDS] = PRECALL, + [PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = PRECALL, + [PRECALL_NO_KW_BUILTIN_FAST] = PRECALL, + [PRECALL_NO_KW_BUILTIN_O] = PRECALL, + [PRECALL_NO_KW_ISINSTANCE] = PRECALL, + [PRECALL_NO_KW_LEN] = PRECALL, + [PRECALL_NO_KW_LIST_APPEND] = PRECALL, + [PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST] = PRECALL, + [PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = PRECALL, + [PRECALL_NO_KW_METHOD_DESCRIPTOR_O] = PRECALL, + [PRECALL_NO_KW_STR_1] = PRECALL, + [PRECALL_NO_KW_TUPLE_1] = PRECALL, + [PRECALL_NO_KW_TYPE_1] = PRECALL, + [PRECALL_PYFUNC] = PRECALL, + [PREP_RERAISE_STAR] = PREP_RERAISE_STAR, + [PRINT_EXPR] = PRINT_EXPR, + [PUSH_EXC_INFO] = PUSH_EXC_INFO, + [PUSH_NULL] = PUSH_NULL, + [RAISE_VARARGS] = RAISE_VARARGS, + [RERAISE] = RERAISE, + [RESUME] = RESUME, + [RESUME_QUICK] = RESUME, + [RETURN_GENERATOR] = RETURN_GENERATOR, + [RETURN_VALUE] = RETURN_VALUE, + [SEND] = SEND, + [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS, + [SET_ADD] = SET_ADD, + [SET_UPDATE] = SET_UPDATE, + [STORE_ATTR] = STORE_ATTR, + [STORE_ATTR_ADAPTIVE] = STORE_ATTR, + [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR, + [STORE_ATTR_SLOT] = STORE_ATTR, + [STORE_ATTR_WITH_HINT] = STORE_ATTR, + [STORE_DEREF] = STORE_DEREF, + [STORE_FAST] = STORE_FAST, + [STORE_FAST__LOAD_FAST] = STORE_FAST, + [STORE_FAST__STORE_FAST] = STORE_FAST, + [STORE_GLOBAL] = STORE_GLOBAL, + [STORE_NAME] = STORE_NAME, + [STORE_SUBSCR] = STORE_SUBSCR, + [STORE_SUBSCR_ADAPTIVE] = STORE_SUBSCR, + [STORE_SUBSCR_DICT] = STORE_SUBSCR, + [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR, + [SWAP] = SWAP, + [UNARY_INVERT] = UNARY_INVERT, + [UNARY_NEGATIVE] = UNARY_NEGATIVE, + [UNARY_NOT] = UNARY_NOT, + [UNARY_POSITIVE] = UNARY_POSITIVE, + [UNPACK_EX] = UNPACK_EX, + [UNPACK_SEQUENCE] = UNPACK_SEQUENCE, + [UNPACK_SEQUENCE_ADAPTIVE] = UNPACK_SEQUENCE, + [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE, + [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE, + [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE, + [WITH_EXCEPT_START] = WITH_EXCEPT_START, + [YIELD_VALUE] = YIELD_VALUE, +}; +#endif // NEED_OPCODE_TABLES + +#ifdef Py_DEBUG +static const char *const _PyOpcode_OpName[256] = { + [CACHE] = "CACHE", + [POP_TOP] = "POP_TOP", + [PUSH_NULL] = "PUSH_NULL", + [BINARY_OP_ADAPTIVE] = "BINARY_OP_ADAPTIVE", + [BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT", + [BINARY_OP_ADD_INT] = "BINARY_OP_ADD_INT", + [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", + [BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE", + [BINARY_OP_MULTIPLY_FLOAT] = "BINARY_OP_MULTIPLY_FLOAT", + [NOP] = "NOP", + [UNARY_POSITIVE] = "UNARY_POSITIVE", + [UNARY_NEGATIVE] = "UNARY_NEGATIVE", + [UNARY_NOT] = "UNARY_NOT", + [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", + [BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT", + [UNARY_INVERT] = "UNARY_INVERT", + [BINARY_OP_SUBTRACT_INT] = "BINARY_OP_SUBTRACT_INT", + [BINARY_SUBSCR_ADAPTIVE] = "BINARY_SUBSCR_ADAPTIVE", + [BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT", + [BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM", + [BINARY_SUBSCR_LIST_INT] = "BINARY_SUBSCR_LIST_INT", + [BINARY_SUBSCR_TUPLE_INT] = "BINARY_SUBSCR_TUPLE_INT", + [CALL_ADAPTIVE] = "CALL_ADAPTIVE", + [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS", + [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", + [BINARY_SUBSCR] = "BINARY_SUBSCR", + [COMPARE_OP_ADAPTIVE] = "COMPARE_OP_ADAPTIVE", + [COMPARE_OP_FLOAT_JUMP] = "COMPARE_OP_FLOAT_JUMP", + [COMPARE_OP_INT_JUMP] = "COMPARE_OP_INT_JUMP", + [COMPARE_OP_STR_JUMP] = "COMPARE_OP_STR_JUMP", + [GET_LEN] = "GET_LEN", + [MATCH_MAPPING] = "MATCH_MAPPING", + [MATCH_SEQUENCE] = "MATCH_SEQUENCE", + [MATCH_KEYS] = "MATCH_KEYS", + [EXTENDED_ARG_QUICK] = "EXTENDED_ARG_QUICK", + [PUSH_EXC_INFO] = "PUSH_EXC_INFO", + [CHECK_EXC_MATCH] = "CHECK_EXC_MATCH", + [CHECK_EG_MATCH] = "CHECK_EG_MATCH", + [JUMP_BACKWARD_QUICK] = "JUMP_BACKWARD_QUICK", + [LOAD_ATTR_ADAPTIVE] = "LOAD_ATTR_ADAPTIVE", + [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", + [LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE", + [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", + [LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT", + [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", + [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", + [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST", + [LOAD_GLOBAL_ADAPTIVE] = "LOAD_GLOBAL_ADAPTIVE", + [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", + [WITH_EXCEPT_START] = "WITH_EXCEPT_START", + [GET_AITER] = "GET_AITER", + [GET_ANEXT] = "GET_ANEXT", + [BEFORE_ASYNC_WITH] = "BEFORE_ASYNC_WITH", + [BEFORE_WITH] = "BEFORE_WITH", + [END_ASYNC_FOR] = "END_ASYNC_FOR", + [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE", + [LOAD_METHOD_ADAPTIVE] = "LOAD_METHOD_ADAPTIVE", + [LOAD_METHOD_CLASS] = "LOAD_METHOD_CLASS", + [LOAD_METHOD_MODULE] = "LOAD_METHOD_MODULE", + [LOAD_METHOD_NO_DICT] = "LOAD_METHOD_NO_DICT", + [STORE_SUBSCR] = "STORE_SUBSCR", + [DELETE_SUBSCR] = "DELETE_SUBSCR", + [LOAD_METHOD_WITH_DICT] = "LOAD_METHOD_WITH_DICT", + [LOAD_METHOD_WITH_VALUES] = "LOAD_METHOD_WITH_VALUES", + [PRECALL_ADAPTIVE] = "PRECALL_ADAPTIVE", + [PRECALL_BOUND_METHOD] = "PRECALL_BOUND_METHOD", + [PRECALL_BUILTIN_CLASS] = "PRECALL_BUILTIN_CLASS", + [PRECALL_BUILTIN_FAST_WITH_KEYWORDS] = "PRECALL_BUILTIN_FAST_WITH_KEYWORDS", + [GET_ITER] = "GET_ITER", + [GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER", + [PRINT_EXPR] = "PRINT_EXPR", + [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS", + [PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS", + [PRECALL_NO_KW_BUILTIN_FAST] = "PRECALL_NO_KW_BUILTIN_FAST", + [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR", + [RETURN_GENERATOR] = "RETURN_GENERATOR", + [PRECALL_NO_KW_BUILTIN_O] = "PRECALL_NO_KW_BUILTIN_O", + [PRECALL_NO_KW_ISINSTANCE] = "PRECALL_NO_KW_ISINSTANCE", + [PRECALL_NO_KW_LEN] = "PRECALL_NO_KW_LEN", + [PRECALL_NO_KW_LIST_APPEND] = "PRECALL_NO_KW_LIST_APPEND", + [PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST", + [PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS", + [LIST_TO_TUPLE] = "LIST_TO_TUPLE", + [RETURN_VALUE] = "RETURN_VALUE", + [IMPORT_STAR] = "IMPORT_STAR", + [SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS", + [YIELD_VALUE] = "YIELD_VALUE", + [ASYNC_GEN_WRAP] = "ASYNC_GEN_WRAP", + [PREP_RERAISE_STAR] = "PREP_RERAISE_STAR", + [POP_EXCEPT] = "POP_EXCEPT", + [STORE_NAME] = "STORE_NAME", + [DELETE_NAME] = "DELETE_NAME", + [UNPACK_SEQUENCE] = "UNPACK_SEQUENCE", + [FOR_ITER] = "FOR_ITER", + [UNPACK_EX] = "UNPACK_EX", + [STORE_ATTR] = "STORE_ATTR", + [DELETE_ATTR] = "DELETE_ATTR", + [STORE_GLOBAL] = "STORE_GLOBAL", + [DELETE_GLOBAL] = "DELETE_GLOBAL", + [SWAP] = "SWAP", + [LOAD_CONST] = "LOAD_CONST", + [LOAD_NAME] = "LOAD_NAME", + [BUILD_TUPLE] = "BUILD_TUPLE", + [BUILD_LIST] = "BUILD_LIST", + [BUILD_SET] = "BUILD_SET", + [BUILD_MAP] = "BUILD_MAP", + [LOAD_ATTR] = "LOAD_ATTR", + [COMPARE_OP] = "COMPARE_OP", + [IMPORT_NAME] = "IMPORT_NAME", + [IMPORT_FROM] = "IMPORT_FROM", + [JUMP_FORWARD] = "JUMP_FORWARD", + [JUMP_IF_FALSE_OR_POP] = "JUMP_IF_FALSE_OR_POP", + [JUMP_IF_TRUE_OR_POP] = "JUMP_IF_TRUE_OR_POP", + [PRECALL_NO_KW_METHOD_DESCRIPTOR_O] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_O", + [POP_JUMP_FORWARD_IF_FALSE] = "POP_JUMP_FORWARD_IF_FALSE", + [POP_JUMP_FORWARD_IF_TRUE] = "POP_JUMP_FORWARD_IF_TRUE", + [LOAD_GLOBAL] = "LOAD_GLOBAL", + [IS_OP] = "IS_OP", + [CONTAINS_OP] = "CONTAINS_OP", + [RERAISE] = "RERAISE", + [COPY] = "COPY", + [PRECALL_NO_KW_STR_1] = "PRECALL_NO_KW_STR_1", + [BINARY_OP] = "BINARY_OP", + [SEND] = "SEND", + [LOAD_FAST] = "LOAD_FAST", + [STORE_FAST] = "STORE_FAST", + [DELETE_FAST] = "DELETE_FAST", + [PRECALL_NO_KW_TUPLE_1] = "PRECALL_NO_KW_TUPLE_1", + [POP_JUMP_FORWARD_IF_NOT_NONE] = "POP_JUMP_FORWARD_IF_NOT_NONE", + [POP_JUMP_FORWARD_IF_NONE] = "POP_JUMP_FORWARD_IF_NONE", + [RAISE_VARARGS] = "RAISE_VARARGS", + [GET_AWAITABLE] = "GET_AWAITABLE", + [MAKE_FUNCTION] = "MAKE_FUNCTION", + [BUILD_SLICE] = "BUILD_SLICE", + [JUMP_BACKWARD_NO_INTERRUPT] = "JUMP_BACKWARD_NO_INTERRUPT", + [MAKE_CELL] = "MAKE_CELL", + [LOAD_CLOSURE] = "LOAD_CLOSURE", + [LOAD_DEREF] = "LOAD_DEREF", + [STORE_DEREF] = "STORE_DEREF", + [DELETE_DEREF] = "DELETE_DEREF", + [JUMP_BACKWARD] = "JUMP_BACKWARD", + [PRECALL_NO_KW_TYPE_1] = "PRECALL_NO_KW_TYPE_1", + [CALL_FUNCTION_EX] = "CALL_FUNCTION_EX", + [PRECALL_PYFUNC] = "PRECALL_PYFUNC", + [EXTENDED_ARG] = "EXTENDED_ARG", + [LIST_APPEND] = "LIST_APPEND", + [SET_ADD] = "SET_ADD", + [MAP_ADD] = "MAP_ADD", + [LOAD_CLASSDEREF] = "LOAD_CLASSDEREF", + [COPY_FREE_VARS] = "COPY_FREE_VARS", + [RESUME_QUICK] = "RESUME_QUICK", + [RESUME] = "RESUME", + [MATCH_CLASS] = "MATCH_CLASS", + [STORE_ATTR_ADAPTIVE] = "STORE_ATTR_ADAPTIVE", + [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", + [FORMAT_VALUE] = "FORMAT_VALUE", + [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", + [BUILD_STRING] = "BUILD_STRING", + [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", + [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", + [LOAD_METHOD] = "LOAD_METHOD", + [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST", + [LIST_EXTEND] = "LIST_EXTEND", + [SET_UPDATE] = "SET_UPDATE", + [DICT_MERGE] = "DICT_MERGE", + [DICT_UPDATE] = "DICT_UPDATE", + [PRECALL] = "PRECALL", + [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", + [STORE_SUBSCR_ADAPTIVE] = "STORE_SUBSCR_ADAPTIVE", + [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", + [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", + [CALL] = "CALL", + [KW_NAMES] = "KW_NAMES", + [POP_JUMP_BACKWARD_IF_NOT_NONE] = "POP_JUMP_BACKWARD_IF_NOT_NONE", + [POP_JUMP_BACKWARD_IF_NONE] = "POP_JUMP_BACKWARD_IF_NONE", + [POP_JUMP_BACKWARD_IF_FALSE] = "POP_JUMP_BACKWARD_IF_FALSE", + [POP_JUMP_BACKWARD_IF_TRUE] = "POP_JUMP_BACKWARD_IF_TRUE", + [UNPACK_SEQUENCE_ADAPTIVE] = "UNPACK_SEQUENCE_ADAPTIVE", + [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", + [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", + [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", + [181] = "<181>", + [182] = "<182>", + [183] = "<183>", + [184] = "<184>", + [185] = "<185>", + [186] = "<186>", + [187] = "<187>", + [188] = "<188>", + [189] = "<189>", + [190] = "<190>", + [191] = "<191>", + [192] = "<192>", + [193] = "<193>", + [194] = "<194>", + [195] = "<195>", + [196] = "<196>", + [197] = "<197>", + [198] = "<198>", + [199] = "<199>", + [200] = "<200>", + [201] = "<201>", + [202] = "<202>", + [203] = "<203>", + [204] = "<204>", + [205] = "<205>", + [206] = "<206>", + [207] = "<207>", + [208] = "<208>", + [209] = "<209>", + [210] = "<210>", + [211] = "<211>", + [212] = "<212>", + [213] = "<213>", + [214] = "<214>", + [215] = "<215>", + [216] = "<216>", + [217] = "<217>", + [218] = "<218>", + [219] = "<219>", + [220] = "<220>", + [221] = "<221>", + [222] = "<222>", + [223] = "<223>", + [224] = "<224>", + [225] = "<225>", + [226] = "<226>", + [227] = "<227>", + [228] = "<228>", + [229] = "<229>", + [230] = "<230>", + [231] = "<231>", + [232] = "<232>", + [233] = "<233>", + [234] = "<234>", + [235] = "<235>", + [236] = "<236>", + [237] = "<237>", + [238] = "<238>", + [239] = "<239>", + [240] = "<240>", + [241] = "<241>", + [242] = "<242>", + [243] = "<243>", + [244] = "<244>", + [245] = "<245>", + [246] = "<246>", + [247] = "<247>", + [248] = "<248>", + [249] = "<249>", + [250] = "<250>", + [251] = "<251>", + [252] = "<252>", + [253] = "<253>", + [254] = "<254>", + [DO_TRACING] = "DO_TRACING", +}; +#endif + +#define EXTRA_CASES \ + case 181: \ + case 182: \ + case 183: \ + case 184: \ + case 185: \ + case 186: \ + case 187: \ + case 188: \ + case 189: \ + case 190: \ + case 191: \ + case 192: \ + case 193: \ + case 194: \ + case 195: \ + case 196: \ + case 197: \ + case 198: \ + case 199: \ + case 200: \ + case 201: \ + case 202: \ + case 203: \ + case 204: \ + case 205: \ + case 206: \ + case 207: \ + case 208: \ + case 209: \ + case 210: \ + case 211: \ + case 212: \ + case 213: \ + case 214: \ + case 215: \ + case 216: \ + case 217: \ + case 218: \ + case 219: \ + case 220: \ + case 221: \ + case 222: \ + case 223: \ + case 224: \ + case 225: \ + case 226: \ + case 227: \ + case 228: \ + case 229: \ + case 230: \ + case 231: \ + case 232: \ + case 233: \ + case 234: \ + case 235: \ + case 236: \ + case 237: \ + case 238: \ + case 239: \ + case 240: \ + case 241: \ + case 242: \ + case 243: \ + case 244: \ + case 245: \ + case 246: \ + case 247: \ + case 248: \ + case 249: \ + case 250: \ + case 251: \ + case 252: \ + case 253: \ + case 254: \ + ; + +#ifdef __cplusplus +} +#endif +#endif // !Py_INTERNAL_OPCODE_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_parser.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_parser.h new file mode 100644 index 0000000000000000000000000000000000000000..e2de24e2ca973411fca1692ffe8abc30a0ff7615 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_parser.h @@ -0,0 +1,31 @@ +#ifndef Py_INTERNAL_PARSER_H +#define Py_INTERNAL_PARSER_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern struct _mod* _PyParser_ASTFromString( + const char *str, + PyObject* filename, + int mode, + PyCompilerFlags *flags, + PyArena *arena); +extern struct _mod* _PyParser_ASTFromFile( + FILE *fp, + PyObject *filename_ob, + const char *enc, + int mode, + const char *ps1, + const char *ps2, + PyCompilerFlags *flags, + int *errcode, + PyArena *arena); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PARSER_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pathconfig.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pathconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..b8deaa0c3eb067b14f2bb2bcca40f5fd960feb06 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pathconfig.h @@ -0,0 +1,24 @@ +#ifndef Py_INTERNAL_PATHCONFIG_H +#define Py_INTERNAL_PATHCONFIG_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +PyAPI_FUNC(void) _PyPathConfig_ClearGlobal(void); +extern PyStatus _PyPathConfig_ReadGlobal(PyConfig *config); +extern PyStatus _PyPathConfig_UpdateGlobal(const PyConfig *config); +extern const wchar_t * _PyPathConfig_GetGlobalModuleSearchPath(void); + +extern int _PyPathConfig_ComputeSysPath0( + const PyWideStringList *argv, + PyObject **path0); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PATHCONFIG_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyarena.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyarena.h new file mode 100644 index 0000000000000000000000000000000000000000..d78972a88ca238de67de2835762f9f5a851ab53a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyarena.h @@ -0,0 +1,64 @@ +/* An arena-like memory interface for the compiler. + */ + +#ifndef Py_INTERNAL_PYARENA_H +#define Py_INTERNAL_PYARENA_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +typedef struct _arena PyArena; + +/* _PyArena_New() and _PyArena_Free() create a new arena and free it, + respectively. Once an arena has been created, it can be used + to allocate memory via _PyArena_Malloc(). Pointers to PyObject can + also be registered with the arena via _PyArena_AddPyObject(), and the + arena will ensure that the PyObjects stay alive at least until + _PyArena_Free() is called. When an arena is freed, all the memory it + allocated is freed, the arena releases internal references to registered + PyObject*, and none of its pointers are valid. + XXX (tim) What does "none of its pointers are valid" mean? Does it + XXX mean that pointers previously obtained via _PyArena_Malloc() are + XXX no longer valid? (That's clearly true, but not sure that's what + XXX the text is trying to say.) + + _PyArena_New() returns an arena pointer. On error, it + returns a negative number and sets an exception. + XXX (tim): Not true. On error, _PyArena_New() actually returns NULL, + XXX and looks like it may or may not set an exception (e.g., if the + XXX internal PyList_New(0) returns NULL, _PyArena_New() passes that on + XXX and an exception is set; OTOH, if the internal + XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but + XXX an exception is not set in that case). +*/ +PyAPI_FUNC(PyArena*) _PyArena_New(void); +PyAPI_FUNC(void) _PyArena_Free(PyArena *); + +/* Mostly like malloc(), return the address of a block of memory spanning + * `size` bytes, or return NULL (without setting an exception) if enough + * new memory can't be obtained. Unlike malloc(0), _PyArena_Malloc() with + * size=0 does not guarantee to return a unique pointer (the pointer + * returned may equal one or more other pointers obtained from + * _PyArena_Malloc()). + * Note that pointers obtained via _PyArena_Malloc() must never be passed to + * the system free() or realloc(), or to any of Python's similar memory- + * management functions. _PyArena_Malloc()-obtained pointers remain valid + * until _PyArena_Free(ar) is called, at which point all pointers obtained + * from the arena `ar` become invalid simultaneously. + */ +PyAPI_FUNC(void*) _PyArena_Malloc(PyArena *, size_t size); + +/* This routine isn't a proper arena allocation routine. It takes + * a PyObject* and records it so that it can be DECREFed when the + * arena is freed. + */ +PyAPI_FUNC(int) _PyArena_AddPyObject(PyArena *, PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYARENA_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyerrors.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyerrors.h new file mode 100644 index 0000000000000000000000000000000000000000..66f37942ef916afed58499e7593fb0338e281fa2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyerrors.h @@ -0,0 +1,106 @@ +#ifndef Py_INTERNAL_PYERRORS_H +#define Py_INTERNAL_PYERRORS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern PyStatus _PyErr_InitTypes(PyInterpreterState *); +extern void _PyErr_FiniTypes(PyInterpreterState *); + + +/* other API */ + +static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) +{ + assert(tstate != NULL); + return tstate->curexc_type; +} + +static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state) +{ + Py_CLEAR(exc_state->exc_value); +} + +PyAPI_FUNC(PyObject*) _PyErr_StackItemToExcInfoTuple( + _PyErr_StackItem *err_info); + +PyAPI_FUNC(void) _PyErr_Fetch( + PyThreadState *tstate, + PyObject **type, + PyObject **value, + PyObject **traceback); + +PyAPI_FUNC(int) _PyErr_ExceptionMatches( + PyThreadState *tstate, + PyObject *exc); + +PyAPI_FUNC(void) _PyErr_Restore( + PyThreadState *tstate, + PyObject *type, + PyObject *value, + PyObject *traceback); + +PyAPI_FUNC(void) _PyErr_SetObject( + PyThreadState *tstate, + PyObject *type, + PyObject *value); + +PyAPI_FUNC(void) _PyErr_ChainStackItem( + _PyErr_StackItem *exc_info); + +PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate); + +PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception); + +PyAPI_FUNC(PyObject *) _PyErr_NoMemory(PyThreadState *tstate); + +PyAPI_FUNC(void) _PyErr_SetString( + PyThreadState *tstate, + PyObject *exception, + const char *string); + +PyAPI_FUNC(PyObject *) _PyErr_Format( + PyThreadState *tstate, + PyObject *exception, + const char *format, + ...); + +PyAPI_FUNC(void) _PyErr_NormalizeException( + PyThreadState *tstate, + PyObject **exc, + PyObject **val, + PyObject **tb); + +PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate( + PyThreadState *tstate, + PyObject *exception, + const char *format, + ...); + +PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup( + const char *msg, + PyObject *excs); + +PyAPI_FUNC(PyObject *) _PyExc_PrepReraiseStar( + PyObject *orig, + PyObject *excs); + +PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate); + +PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp); + +extern PyObject* _Py_Offer_Suggestions(PyObject* exception); +PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b, + Py_ssize_t max_cost); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYERRORS_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyhash.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyhash.h new file mode 100644 index 0000000000000000000000000000000000000000..a229f8d8b7f0a2ab0bf9120fcc301cc5c74594c8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pyhash.h @@ -0,0 +1,10 @@ +#ifndef Py_INTERNAL_HASH_H +#define Py_INTERNAL_HASH_H + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t); + +#endif diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pylifecycle.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pylifecycle.h new file mode 100644 index 0000000000000000000000000000000000000000..b4718b8ade2354aabad2ee075a4ccb9fe4cb47b2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pylifecycle.h @@ -0,0 +1,103 @@ +#ifndef Py_INTERNAL_LIFECYCLE_H +#define Py_INTERNAL_LIFECYCLE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_runtime.h" // _PyRuntimeState + +/* Forward declarations */ +struct _PyArgv; +struct pyruntimestate; + +/* True if the main interpreter thread exited due to an unhandled + * KeyboardInterrupt exception, suggesting the user pressed ^C. */ +PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt; + +extern int _Py_SetFileSystemEncoding( + const char *encoding, + const char *errors); +extern void _Py_ClearFileSystemEncoding(void); +extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate); +#ifdef MS_WINDOWS +extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void); +#endif + +PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void); + +PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc); + +/* Various one-time initializers */ + +extern PyStatus _PyFaulthandler_Init(int enable); +extern int _PyTraceMalloc_Init(int enable); +extern PyObject * _PyBuiltin_Init(PyInterpreterState *interp); +extern PyStatus _PySys_Create( + PyThreadState *tstate, + PyObject **sysmod_p); +extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); +extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); +extern int _PySys_UpdateConfig(PyThreadState *tstate); +extern void _PySys_Fini(PyInterpreterState *interp); +extern int _PyBuiltins_AddExceptions(PyObject * bltinmod); +extern PyStatus _Py_HashRandomization_Init(const PyConfig *); + +extern PyStatus _PyImportZip_Init(PyThreadState *tstate); +extern PyStatus _PyGC_Init(PyInterpreterState *interp); +extern PyStatus _PyAtExit_Init(PyInterpreterState *interp); +extern int _Py_Deepfreeze_Init(void); + +/* Various internal finalizers */ + +extern int _PySignal_Init(int install_signal_handlers); +extern void _PySignal_Fini(void); + +extern void _PyImport_Fini(void); +extern void _PyImport_Fini2(void); +extern void _PyGC_Fini(PyInterpreterState *interp); +extern void _Py_HashRandomization_Fini(void); +extern void _PyFaulthandler_Fini(void); +extern void _PyHash_Fini(void); +extern void _PyTraceMalloc_Fini(void); +extern void _PyWarnings_Fini(PyInterpreterState *interp); +extern void _PyAST_Fini(PyInterpreterState *interp); +extern void _PyAtExit_Fini(PyInterpreterState *interp); +extern void _PyThread_FiniType(PyInterpreterState *interp); +extern void _Py_Deepfreeze_Fini(void); +extern void _PyArg_Fini(void); + +extern PyStatus _PyGILState_Init(_PyRuntimeState *runtime); +extern PyStatus _PyGILState_SetTstate(PyThreadState *tstate); +extern void _PyGILState_Fini(PyInterpreterState *interp); + +PyAPI_FUNC(void) _PyGC_DumpShutdownStats(PyInterpreterState *interp); + +PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv( + const PyPreConfig *src_config, + const struct _PyArgv *args); +PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig( + const PyConfig *config, + const struct _PyArgv *args); + +PyAPI_FUNC(wchar_t *) _Py_GetStdlibDir(void); + +PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p); + +PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable); + +PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate); +PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception, + PyObject *value, PyObject *tb); + +PyAPI_FUNC(void) _PyThreadState_DeleteCurrent(PyThreadState *tstate); + +extern void _PyAtExit_Call(PyInterpreterState *interp); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_LIFECYCLE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymath.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymath.h new file mode 100644 index 0000000000000000000000000000000000000000..5c6aee2a23890b5bbc73afb281f06f2eb5a68191 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymath.h @@ -0,0 +1,224 @@ +#ifndef Py_INTERNAL_PYMATH_H +#define Py_INTERNAL_PYMATH_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* _Py_ADJUST_ERANGE1(x) + * _Py_ADJUST_ERANGE2(x, y) + * Set errno to 0 before calling a libm function, and invoke one of these + * macros after, passing the function result(s) (_Py_ADJUST_ERANGE2 is useful + * for functions returning complex results). This makes two kinds of + * adjustments to errno: (A) If it looks like the platform libm set + * errno=ERANGE due to underflow, clear errno. (B) If it looks like the + * platform libm overflowed but didn't set errno, force errno to ERANGE. In + * effect, we're trying to force a useful implementation of C89 errno + * behavior. + * Caution: + * This isn't reliable. C99 no longer requires libm to set errno under + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. + */ +static inline void _Py_ADJUST_ERANGE1(double x) +{ + if (errno == 0) { + if (x == Py_HUGE_VAL || x == -Py_HUGE_VAL) { + errno = ERANGE; + } + } + else if (errno == ERANGE && x == 0.0) { + errno = 0; + } +} + +static inline void _Py_ADJUST_ERANGE2(double x, double y) +{ + if (x == Py_HUGE_VAL || x == -Py_HUGE_VAL || + y == Py_HUGE_VAL || y == -Py_HUGE_VAL) + { + if (errno == 0) { + errno = ERANGE; + } + } + else if (errno == ERANGE) { + errno = 0; + } +} + +// Return whether integral type *type* is signed or not. +#define _Py_IntegralTypeSigned(type) \ + ((type)(-1) < 0) + +// Return the maximum value of integral type *type*. +#define _Py_IntegralTypeMax(type) \ + ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) + +// Return the minimum value of integral type *type*. +#define _Py_IntegralTypeMin(type) \ + ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) + +// Check whether *v* is in the range of integral type *type*. This is most +// useful if *v* is floating-point, since demoting a floating-point *v* to an +// integral type that cannot represent *v*'s integral part is undefined +// behavior. +#define _Py_InIntegralTypeRange(type, v) \ + (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) + + +//--- HAVE_PY_SET_53BIT_PRECISION macro ------------------------------------ +// +// The functions _Py_dg_strtod() and _Py_dg_dtoa() in Python/dtoa.c (which are +// required to support the short float repr introduced in Python 3.1) require +// that the floating-point unit that's being used for arithmetic operations on +// C doubles is set to use 53-bit precision. It also requires that the FPU +// rounding mode is round-half-to-even, but that's less often an issue. +// +// If your FPU isn't already set to 53-bit precision/round-half-to-even, and +// you want to make use of _Py_dg_strtod() and _Py_dg_dtoa(), then you should: +// +// #define HAVE_PY_SET_53BIT_PRECISION 1 +// +// and also give appropriate definitions for the following three macros: +// +// * _Py_SET_53BIT_PRECISION_HEADER: any variable declarations needed to +// use the two macros below. +// * _Py_SET_53BIT_PRECISION_START: store original FPU settings, and +// set FPU to 53-bit precision/round-half-to-even +// * _Py_SET_53BIT_PRECISION_END: restore original FPU settings +// +// The macros are designed to be used within a single C function: see +// Python/pystrtod.c for an example of their use. + + +// Get and set x87 control word for gcc/x86 +#ifdef HAVE_GCC_ASM_FOR_X87 +#define HAVE_PY_SET_53BIT_PRECISION 1 + +// Functions defined in Python/pymath.c +extern unsigned short _Py_get_387controlword(void); +extern void _Py_set_387controlword(unsigned short); + +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned short old_387controlword, new_387controlword +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + old_387controlword = _Py_get_387controlword(); \ + new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ + if (new_387controlword != old_387controlword) { \ + _Py_set_387controlword(new_387controlword); \ + } \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_387controlword != old_387controlword) { \ + _Py_set_387controlword(old_387controlword); \ + } \ + } while (0) +#endif + +// Get and set x87 control word for VisualStudio/x86. +// x87 is not supported in 64-bit or ARM. +#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_M_ARM) +#define HAVE_PY_SET_53BIT_PRECISION 1 + +#include // __control87_2() + +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned int old_387controlword, new_387controlword, out_387controlword + // We use the __control87_2 function to set only the x87 control word. + // The SSE control word is unaffected. +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __control87_2(0, 0, &old_387controlword, NULL); \ + new_387controlword = \ + (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ + if (new_387controlword != old_387controlword) { \ + __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ + &out_387controlword, NULL); \ + } \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_387controlword != old_387controlword) { \ + __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ + &out_387controlword, NULL); \ + } \ + } while (0) +#endif + + +// MC68881 +#ifdef HAVE_GCC_ASM_FOR_MC68881 +#define HAVE_PY_SET_53BIT_PRECISION 1 +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned int old_fpcr, new_fpcr +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \ + /* Set double precision / round to nearest. */ \ + new_fpcr = (old_fpcr & ~0xf0) | 0x80; \ + if (new_fpcr != old_fpcr) { \ + __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr));\ + } \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_fpcr != old_fpcr) { \ + __asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \ + } \ + } while (0) +#endif + +// Default definitions are empty +#ifndef _Py_SET_53BIT_PRECISION_HEADER +# define _Py_SET_53BIT_PRECISION_HEADER +# define _Py_SET_53BIT_PRECISION_START +# define _Py_SET_53BIT_PRECISION_END +#endif + + +//--- _PY_SHORT_FLOAT_REPR macro ------------------------------------------- + +// If we can't guarantee 53-bit precision, don't use the code +// in Python/dtoa.c, but fall back to standard code. This +// means that repr of a float will be long (17 significant digits). +// +// Realistically, there are two things that could go wrong: +// +// (1) doubles aren't IEEE 754 doubles, or +// (2) we're on x86 with the rounding precision set to 64-bits +// (extended precision), and we don't know how to change +// the rounding precision. +#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) +# define _PY_SHORT_FLOAT_REPR 0 +#endif + +// Double rounding is symptomatic of use of extended precision on x86. +// If we're seeing double rounding, and we don't have any mechanism available +// for changing the FPU rounding precision, then don't use Python/dtoa.c. +#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) +# define _PY_SHORT_FLOAT_REPR 0 +#endif + +#ifndef _PY_SHORT_FLOAT_REPR +# define _PY_SHORT_FLOAT_REPR 1 +#endif + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYMATH_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymem.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymem.h new file mode 100644 index 0000000000000000000000000000000000000000..b9eea9d4b30ad16463c22afb97bafe0e12fd29cc --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pymem.h @@ -0,0 +1,114 @@ +#ifndef Py_INTERNAL_PYMEM_H +#define Py_INTERNAL_PYMEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pymem.h" // PyMemAllocatorName + + +/* Set the memory allocator of the specified domain to the default. + Save the old allocator into *old_alloc if it's non-NULL. + Return on success, or return -1 if the domain is unknown. */ +PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( + PyMemAllocatorDomain domain, + PyMemAllocatorEx *old_alloc); + +/* Special bytes broadcast into debug memory blocks at appropriate times. + Strings of these are unlikely to be valid addresses, floats, ints or + 7-bit ASCII. + + - PYMEM_CLEANBYTE: clean (newly allocated) memory + - PYMEM_DEADBYTE dead (newly freed) memory + - PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block + + Byte patterns 0xCB, 0xDB and 0xFB have been replaced with 0xCD, 0xDD and + 0xFD to use the same values than Windows CRT debug malloc() and free(). + If modified, _PyMem_IsPtrFreed() should be updated as well. */ +#define PYMEM_CLEANBYTE 0xCD +#define PYMEM_DEADBYTE 0xDD +#define PYMEM_FORBIDDENBYTE 0xFD + +/* Heuristic checking if a pointer value is newly allocated + (uninitialized), newly freed or NULL (is equal to zero). + + The pointer is not dereferenced, only the pointer value is checked. + + The heuristic relies on the debug hooks on Python memory allocators which + fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory + with DEADBYTE (0xDD). Detect also "untouchable bytes" marked + with FORBIDDENBYTE (0xFD). */ +static inline int _PyMem_IsPtrFreed(const void *ptr) +{ + uintptr_t value = (uintptr_t)ptr; +#if SIZEOF_VOID_P == 8 + return (value == 0 + || value == (uintptr_t)0xCDCDCDCDCDCDCDCD + || value == (uintptr_t)0xDDDDDDDDDDDDDDDD + || value == (uintptr_t)0xFDFDFDFDFDFDFDFD); +#elif SIZEOF_VOID_P == 4 + return (value == 0 + || value == (uintptr_t)0xCDCDCDCD + || value == (uintptr_t)0xDDDDDDDD + || value == (uintptr_t)0xFDFDFDFD); +#else +# error "unknown pointer size" +#endif +} + +PyAPI_FUNC(int) _PyMem_GetAllocatorName( + const char *name, + PyMemAllocatorName *allocator); + +/* Configure the Python memory allocators. + Pass PYMEM_ALLOCATOR_DEFAULT to use default allocators. + PYMEM_ALLOCATOR_NOT_SET does nothing. */ +PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator); + +struct _PyTraceMalloc_Config { + /* Module initialized? + Variable protected by the GIL */ + enum { + TRACEMALLOC_NOT_INITIALIZED, + TRACEMALLOC_INITIALIZED, + TRACEMALLOC_FINALIZED + } initialized; + + /* Is tracemalloc tracing memory allocations? + Variable protected by the GIL */ + int tracing; + + /* limit of the number of frames in a traceback, 1 by default. + Variable protected by the GIL. */ + int max_nframe; +}; + +#define _PyTraceMalloc_Config_INIT \ + {.initialized = TRACEMALLOC_NOT_INITIALIZED, \ + .tracing = 0, \ + .max_nframe = 1} + +PyAPI_DATA(struct _PyTraceMalloc_Config) _Py_tracemalloc_config; + +/* Allocate memory directly from the O/S virtual memory system, + * where supported. Otherwise fallback on malloc */ +void *_PyObject_VirtualAlloc(size_t size); +void _PyObject_VirtualFree(void *, size_t size); + +/* This function returns the number of allocated memory blocks, regardless of size */ +PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); + +/* Macros */ +#ifdef WITH_PYMALLOC +// Export the symbol for the 3rd party guppy3 project +PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out); +#endif + +#ifdef __cplusplus +} +#endif +#endif // !Py_INTERNAL_PYMEM_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pystate.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pystate.h new file mode 100644 index 0000000000000000000000000000000000000000..7c5aba12d5295e0cf34b4aafbc9742d98b981149 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_pystate.h @@ -0,0 +1,173 @@ +#ifndef Py_INTERNAL_PYSTATE_H +#define Py_INTERNAL_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_runtime.h" /* PyRuntimeState */ + + +/* Check if the current thread is the main thread. + Use _Py_IsMainInterpreter() to check if it's the main interpreter. */ +static inline int +_Py_IsMainThread(void) +{ + unsigned long thread = PyThread_get_thread_ident(); + return (thread == _PyRuntime.main_thread); +} + + +static inline PyInterpreterState * +_PyInterpreterState_Main(void) +{ + return _PyRuntime.interpreters.main; +} + +static inline int +_Py_IsMainInterpreter(PyInterpreterState *interp) +{ + return (interp == _PyInterpreterState_Main()); +} + + +static inline const PyConfig * +_Py_GetMainConfig(void) +{ + PyInterpreterState *interp = _PyInterpreterState_Main(); + if (interp == NULL) { + return NULL; + } + return _PyInterpreterState_GetConfig(interp); +} + + +/* Only handle signals on the main thread of the main interpreter. */ +static inline int +_Py_ThreadCanHandleSignals(PyInterpreterState *interp) +{ + return (_Py_IsMainThread() && _Py_IsMainInterpreter(interp)); +} + + +/* Only execute pending calls on the main thread. */ +static inline int +_Py_ThreadCanHandlePendingCalls(void) +{ + return _Py_IsMainThread(); +} + + +#ifndef NDEBUG +extern int _PyThreadState_CheckConsistency(PyThreadState *tstate); +#endif + +int _PyThreadState_MustExit(PyThreadState *tstate); + +/* Variable and macro for in-line access to current thread + and interpreter state */ + +static inline PyThreadState* +_PyRuntimeState_GetThreadState(_PyRuntimeState *runtime) +{ + return (PyThreadState*)_Py_atomic_load_relaxed(&runtime->gilstate.tstate_current); +} + +/* Get the current Python thread state. + + Efficient macro reading directly the 'gilstate.tstate_current' atomic + variable. The macro is unsafe: it does not check for error and it can + return NULL. + + The caller must hold the GIL. + + See also PyThreadState_Get() and _PyThreadState_UncheckedGet(). */ +static inline PyThreadState* +_PyThreadState_GET(void) +{ + return _PyRuntimeState_GetThreadState(&_PyRuntime); +} + +PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalError_TstateNULL(const char *func); + +static inline void +_Py_EnsureFuncTstateNotNULL(const char *func, PyThreadState *tstate) +{ + if (tstate == NULL) { + _Py_FatalError_TstateNULL(func); + } +} + +// Call Py_FatalError() if tstate is NULL +#define _Py_EnsureTstateNotNULL(tstate) \ + _Py_EnsureFuncTstateNotNULL(__func__, tstate) + + +/* Get the current interpreter state. + + The macro is unsafe: it does not check for error and it can return NULL. + + The caller must hold the GIL. + + See also _PyInterpreterState_Get() + and _PyGILState_GetInterpreterStateUnsafe(). */ +static inline PyInterpreterState* _PyInterpreterState_GET(void) { + PyThreadState *tstate = _PyThreadState_GET(); +#ifdef Py_DEBUG + _Py_EnsureTstateNotNULL(tstate); +#endif + return tstate->interp; +} + + +// PyThreadState functions + +PyAPI_FUNC(void) _PyThreadState_SetCurrent(PyThreadState *tstate); +// We keep this around exclusively for stable ABI compatibility. +PyAPI_FUNC(void) _PyThreadState_Init( + PyThreadState *tstate); +PyAPI_FUNC(void) _PyThreadState_DeleteExcept( + _PyRuntimeState *runtime, + PyThreadState *tstate); + + +static inline void +_PyThreadState_UpdateTracingState(PyThreadState *tstate) +{ + bool use_tracing = + (tstate->tracing == 0) && + (tstate->c_tracefunc != NULL || tstate->c_profilefunc != NULL); + tstate->cframe->use_tracing = (use_tracing ? 255 : 0); +} + + +/* Other */ + +PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap( + struct _gilstate_runtime_state *gilstate, + PyThreadState *newts); + +PyAPI_FUNC(PyStatus) _PyInterpreterState_Enable(_PyRuntimeState *runtime); + +#ifdef HAVE_FORK +extern PyStatus _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime); +extern PyStatus _PyGILState_Reinit(_PyRuntimeState *runtime); +extern void _PySignal_AfterFork(void); +#endif + + +PyAPI_FUNC(int) _PyState_AddModule( + PyThreadState *tstate, + PyObject* module, + PyModuleDef* def); + + +PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYSTATE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime.h new file mode 100644 index 0000000000000000000000000000000000000000..ae63ae74afa5fe2b580b1abcbaae25f814e406a4 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime.h @@ -0,0 +1,181 @@ +#ifndef Py_INTERNAL_RUNTIME_H +#define Py_INTERNAL_RUNTIME_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_atomic.h" /* _Py_atomic_address */ +#include "pycore_gil.h" // struct _gil_runtime_state +#include "pycore_global_objects.h" // struct _Py_global_objects +#include "pycore_interp.h" // PyInterpreterState +#include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids + + +/* ceval state */ + +struct _ceval_runtime_state { + /* Request for checking signals. It is shared by all interpreters (see + bpo-40513). Any thread of any interpreter can receive a signal, but only + the main thread of the main interpreter can handle signals: see + _Py_ThreadCanHandleSignals(). */ + _Py_atomic_int signals_pending; + struct _gil_runtime_state gil; +}; + +/* GIL state */ + +struct _gilstate_runtime_state { + /* bpo-26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ + int check_enabled; + /* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ + _Py_atomic_address tstate_current; + /* The single PyInterpreterState used by this process' + GILState implementation + */ + /* TODO: Given interp_main, it may be possible to kill this ref */ + PyInterpreterState *autoInterpreterState; + Py_tss_t autoTSSkey; +}; + +/* Runtime audit hook state */ + +typedef struct _Py_AuditHookEntry { + struct _Py_AuditHookEntry *next; + Py_AuditHookFunction hookCFunction; + void *userData; +} _Py_AuditHookEntry; + +/* Full Python runtime state */ + +/* _PyRuntimeState holds the global state for the CPython runtime. + That data is exposed in the internal API as a static variable (_PyRuntime). + */ +typedef struct pyruntimestate { + /* Has been initialized to a safe state. + + In order to be effective, this must be set to 0 during or right + after allocation. */ + int _initialized; + + /* Is running Py_PreInitialize()? */ + int preinitializing; + + /* Is Python preinitialized? Set to 1 by Py_PreInitialize() */ + int preinitialized; + + /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */ + int core_initialized; + + /* Is Python fully initialized? Set to 1 by Py_Initialize() */ + int initialized; + + /* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize() + is called again. + + Use _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing() + to access it, don't access it directly. */ + _Py_atomic_address _finalizing; + + struct pyinterpreters { + PyThread_type_lock mutex; + /* The linked list of interpreters, newest first. */ + PyInterpreterState *head; + /* The runtime's initial interpreter, which has a special role + in the operation of the runtime. It is also often the only + interpreter. */ + PyInterpreterState *main; + /* _next_interp_id is an auto-numbered sequence of small + integers. It gets initialized in _PyInterpreterState_Init(), + which is called in Py_Initialize(), and used in + PyInterpreterState_New(). A negative interpreter ID + indicates an error occurred. The main interpreter will + always have an ID of 0. Overflow results in a RuntimeError. + If that becomes a problem later then we can adjust, e.g. by + using a Python int. */ + int64_t next_id; + } interpreters; + // XXX Remove this field once we have a tp_* slot. + struct _xidregistry { + PyThread_type_lock mutex; + struct _xidregitem *head; + } xidregistry; + + unsigned long main_thread; + +#define NEXITFUNCS 32 + void (*exitfuncs[NEXITFUNCS])(void); + int nexitfuncs; + + struct _ceval_runtime_state ceval; + struct _gilstate_runtime_state gilstate; + + PyPreConfig preconfig; + + // Audit values must be preserved when Py_Initialize()/Py_Finalize() + // is called multiple times. + Py_OpenCodeHookFunction open_code_hook; + void *open_code_userdata; + _Py_AuditHookEntry *audit_hook_head; + + struct _Py_unicode_runtime_ids unicode_ids; + + /* All the objects that are shared by the runtime's interpreters. */ + struct _Py_global_objects global_objects; + + /* The following fields are here to avoid allocation during init. + The data is exposed through _PyRuntimeState pointer fields. + These fields should not be accessed directly outside of init. + + All other _PyRuntimeState pointer fields are populated when + needed and default to NULL. + + For now there are some exceptions to that rule, which require + allocation during init. These will be addressed on a case-by-case + basis. Most notably, we don't pre-allocated the several mutex + (PyThread_type_lock) fields, because on Windows we only ever get + a pointer type. + */ + + /* PyInterpreterState.interpreters.main */ + PyInterpreterState _main_interpreter; +} _PyRuntimeState; + + +/* other API */ + +PyAPI_DATA(_PyRuntimeState) _PyRuntime; + +PyAPI_FUNC(PyStatus) _PyRuntimeState_Init(_PyRuntimeState *runtime); +PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *runtime); + +#ifdef HAVE_FORK +extern PyStatus _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime); +#endif + +/* Initialize _PyRuntimeState. + Return NULL on success, or return an error message on failure. */ +PyAPI_FUNC(PyStatus) _PyRuntime_Initialize(void); + +PyAPI_FUNC(void) _PyRuntime_Finalize(void); + + +static inline PyThreadState* +_PyRuntimeState_GetFinalizing(_PyRuntimeState *runtime) { + return (PyThreadState*)_Py_atomic_load_relaxed(&runtime->_finalizing); +} + +static inline void +_PyRuntimeState_SetFinalizing(_PyRuntimeState *runtime, PyThreadState *tstate) { + _Py_atomic_store_relaxed(&runtime->_finalizing, (uintptr_t)tstate); +} + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_RUNTIME_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime_init.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime_init.h new file mode 100644 index 0000000000000000000000000000000000000000..13eae1e4c88d8fe4f73938a5e96e275f8e5febea --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_runtime_init.h @@ -0,0 +1,1256 @@ +#ifndef Py_INTERNAL_RUNTIME_INIT_H +#define Py_INTERNAL_RUNTIME_INIT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_object.h" + + +/* The static initializers defined here should only be used + in the runtime init code (in pystate.c and pylifecycle.c). */ + + +#define _PyRuntimeState_INIT \ + { \ + .gilstate = { \ + .check_enabled = 1, \ + /* A TSS key must be initialized with Py_tss_NEEDS_INIT \ + in accordance with the specification. */ \ + .autoTSSkey = Py_tss_NEEDS_INIT, \ + }, \ + .interpreters = { \ + /* This prevents interpreters from getting created \ + until _PyInterpreterState_Enable() is called. */ \ + .next_id = -1, \ + }, \ + .global_objects = _Py_global_objects_INIT, \ + ._main_interpreter = _PyInterpreterState_INIT, \ + } + +#ifdef HAVE_DLOPEN +# include +# if HAVE_DECL_RTLD_NOW +# define _Py_DLOPEN_FLAGS RTLD_NOW +# else +# define _Py_DLOPEN_FLAGS RTLD_LAZY +# endif +# define DLOPENFLAGS_INIT .dlopenflags = _Py_DLOPEN_FLAGS, +#else +# define _Py_DLOPEN_FLAGS 0 +# define DLOPENFLAGS_INIT +#endif + +#define _PyInterpreterState_INIT \ + { \ + ._static = 1, \ + .id_refcount = -1, \ + DLOPENFLAGS_INIT \ + .ceval = { \ + .recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \ + }, \ + .gc = { \ + .enabled = 1, \ + .generations = { \ + /* .head is set in _PyGC_InitState(). */ \ + { .threshold = 700, }, \ + { .threshold = 10, }, \ + { .threshold = 10, }, \ + }, \ + }, \ + ._initial_thread = _PyThreadState_INIT, \ + } + +#define _PyThreadState_INIT \ + { \ + ._static = 1, \ + .recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \ + .context_ver = 1, \ + } + + +// global objects + +#define _PyLong_DIGIT_INIT(val) \ + { \ + _PyVarObject_IMMORTAL_INIT(&PyLong_Type, \ + ((val) == 0 ? 0 : ((val) > 0 ? 1 : -1))), \ + .ob_digit = { ((val) >= 0 ? (val) : -(val)) }, \ + } + +#define _PyBytes_SIMPLE_INIT(CH, LEN) \ + { \ + _PyVarObject_IMMORTAL_INIT(&PyBytes_Type, LEN), \ + .ob_shash = -1, \ + .ob_sval = { CH }, \ + } +#define _PyBytes_CHAR_INIT(CH) \ + { \ + _PyBytes_SIMPLE_INIT(CH, 1) \ + } + +#define _PyUnicode_ASCII_BASE_INIT(LITERAL, ASCII) \ + { \ + .ob_base = _PyObject_IMMORTAL_INIT(&PyUnicode_Type), \ + .length = sizeof(LITERAL) - 1, \ + .hash = -1, \ + .state = { \ + .kind = 1, \ + .compact = 1, \ + .ascii = ASCII, \ + .ready = 1, \ + }, \ + } +#define _PyASCIIObject_INIT(LITERAL) \ + { \ + ._ascii = _PyUnicode_ASCII_BASE_INIT(LITERAL, 1), \ + ._data = LITERAL \ + } +#define INIT_STR(NAME, LITERAL) \ + ._ ## NAME = _PyASCIIObject_INIT(LITERAL) +#define INIT_ID(NAME) \ + ._ ## NAME = _PyASCIIObject_INIT(#NAME) +#define _PyUnicode_LATIN1_INIT(LITERAL) \ + { \ + ._latin1 = { \ + ._base = _PyUnicode_ASCII_BASE_INIT(LITERAL, 0), \ + }, \ + ._data = LITERAL, \ + } + +/* The following is auto-generated by Tools/scripts/generate_global_objects.py. */ +#define _Py_global_objects_INIT { \ + .singletons = { \ + .small_ints = { \ + _PyLong_DIGIT_INIT(-5), \ + _PyLong_DIGIT_INIT(-4), \ + _PyLong_DIGIT_INIT(-3), \ + _PyLong_DIGIT_INIT(-2), \ + _PyLong_DIGIT_INIT(-1), \ + _PyLong_DIGIT_INIT(0), \ + _PyLong_DIGIT_INIT(1), \ + _PyLong_DIGIT_INIT(2), \ + _PyLong_DIGIT_INIT(3), \ + _PyLong_DIGIT_INIT(4), \ + _PyLong_DIGIT_INIT(5), \ + _PyLong_DIGIT_INIT(6), \ + _PyLong_DIGIT_INIT(7), \ + _PyLong_DIGIT_INIT(8), \ + _PyLong_DIGIT_INIT(9), \ + _PyLong_DIGIT_INIT(10), \ + _PyLong_DIGIT_INIT(11), \ + _PyLong_DIGIT_INIT(12), \ + _PyLong_DIGIT_INIT(13), \ + _PyLong_DIGIT_INIT(14), \ + _PyLong_DIGIT_INIT(15), \ + _PyLong_DIGIT_INIT(16), \ + _PyLong_DIGIT_INIT(17), \ + _PyLong_DIGIT_INIT(18), \ + _PyLong_DIGIT_INIT(19), \ + _PyLong_DIGIT_INIT(20), \ + _PyLong_DIGIT_INIT(21), \ + _PyLong_DIGIT_INIT(22), \ + _PyLong_DIGIT_INIT(23), \ + _PyLong_DIGIT_INIT(24), \ + _PyLong_DIGIT_INIT(25), \ + _PyLong_DIGIT_INIT(26), \ + _PyLong_DIGIT_INIT(27), \ + _PyLong_DIGIT_INIT(28), \ + _PyLong_DIGIT_INIT(29), \ + _PyLong_DIGIT_INIT(30), \ + _PyLong_DIGIT_INIT(31), \ + _PyLong_DIGIT_INIT(32), \ + _PyLong_DIGIT_INIT(33), \ + _PyLong_DIGIT_INIT(34), \ + _PyLong_DIGIT_INIT(35), \ + _PyLong_DIGIT_INIT(36), \ + _PyLong_DIGIT_INIT(37), \ + _PyLong_DIGIT_INIT(38), \ + _PyLong_DIGIT_INIT(39), \ + _PyLong_DIGIT_INIT(40), \ + _PyLong_DIGIT_INIT(41), \ + _PyLong_DIGIT_INIT(42), \ + _PyLong_DIGIT_INIT(43), \ + _PyLong_DIGIT_INIT(44), \ + _PyLong_DIGIT_INIT(45), \ + _PyLong_DIGIT_INIT(46), \ + _PyLong_DIGIT_INIT(47), \ + _PyLong_DIGIT_INIT(48), \ + _PyLong_DIGIT_INIT(49), \ + _PyLong_DIGIT_INIT(50), \ + _PyLong_DIGIT_INIT(51), \ + _PyLong_DIGIT_INIT(52), \ + _PyLong_DIGIT_INIT(53), \ + _PyLong_DIGIT_INIT(54), \ + _PyLong_DIGIT_INIT(55), \ + _PyLong_DIGIT_INIT(56), \ + _PyLong_DIGIT_INIT(57), \ + _PyLong_DIGIT_INIT(58), \ + _PyLong_DIGIT_INIT(59), \ + _PyLong_DIGIT_INIT(60), \ + _PyLong_DIGIT_INIT(61), \ + _PyLong_DIGIT_INIT(62), \ + _PyLong_DIGIT_INIT(63), \ + _PyLong_DIGIT_INIT(64), \ + _PyLong_DIGIT_INIT(65), \ + _PyLong_DIGIT_INIT(66), \ + _PyLong_DIGIT_INIT(67), \ + _PyLong_DIGIT_INIT(68), \ + _PyLong_DIGIT_INIT(69), \ + _PyLong_DIGIT_INIT(70), \ + _PyLong_DIGIT_INIT(71), \ + _PyLong_DIGIT_INIT(72), \ + _PyLong_DIGIT_INIT(73), \ + _PyLong_DIGIT_INIT(74), \ + _PyLong_DIGIT_INIT(75), \ + _PyLong_DIGIT_INIT(76), \ + _PyLong_DIGIT_INIT(77), \ + _PyLong_DIGIT_INIT(78), \ + _PyLong_DIGIT_INIT(79), \ + _PyLong_DIGIT_INIT(80), \ + _PyLong_DIGIT_INIT(81), \ + _PyLong_DIGIT_INIT(82), \ + _PyLong_DIGIT_INIT(83), \ + _PyLong_DIGIT_INIT(84), \ + _PyLong_DIGIT_INIT(85), \ + _PyLong_DIGIT_INIT(86), \ + _PyLong_DIGIT_INIT(87), \ + _PyLong_DIGIT_INIT(88), \ + _PyLong_DIGIT_INIT(89), \ + _PyLong_DIGIT_INIT(90), \ + _PyLong_DIGIT_INIT(91), \ + _PyLong_DIGIT_INIT(92), \ + _PyLong_DIGIT_INIT(93), \ + _PyLong_DIGIT_INIT(94), \ + _PyLong_DIGIT_INIT(95), \ + _PyLong_DIGIT_INIT(96), \ + _PyLong_DIGIT_INIT(97), \ + _PyLong_DIGIT_INIT(98), \ + _PyLong_DIGIT_INIT(99), \ + _PyLong_DIGIT_INIT(100), \ + _PyLong_DIGIT_INIT(101), \ + _PyLong_DIGIT_INIT(102), \ + _PyLong_DIGIT_INIT(103), \ + _PyLong_DIGIT_INIT(104), \ + _PyLong_DIGIT_INIT(105), \ + _PyLong_DIGIT_INIT(106), \ + _PyLong_DIGIT_INIT(107), \ + _PyLong_DIGIT_INIT(108), \ + _PyLong_DIGIT_INIT(109), \ + _PyLong_DIGIT_INIT(110), \ + _PyLong_DIGIT_INIT(111), \ + _PyLong_DIGIT_INIT(112), \ + _PyLong_DIGIT_INIT(113), \ + _PyLong_DIGIT_INIT(114), \ + _PyLong_DIGIT_INIT(115), \ + _PyLong_DIGIT_INIT(116), \ + _PyLong_DIGIT_INIT(117), \ + _PyLong_DIGIT_INIT(118), \ + _PyLong_DIGIT_INIT(119), \ + _PyLong_DIGIT_INIT(120), \ + _PyLong_DIGIT_INIT(121), \ + _PyLong_DIGIT_INIT(122), \ + _PyLong_DIGIT_INIT(123), \ + _PyLong_DIGIT_INIT(124), \ + _PyLong_DIGIT_INIT(125), \ + _PyLong_DIGIT_INIT(126), \ + _PyLong_DIGIT_INIT(127), \ + _PyLong_DIGIT_INIT(128), \ + _PyLong_DIGIT_INIT(129), \ + _PyLong_DIGIT_INIT(130), \ + _PyLong_DIGIT_INIT(131), \ + _PyLong_DIGIT_INIT(132), \ + _PyLong_DIGIT_INIT(133), \ + _PyLong_DIGIT_INIT(134), \ + _PyLong_DIGIT_INIT(135), \ + _PyLong_DIGIT_INIT(136), \ + _PyLong_DIGIT_INIT(137), \ + _PyLong_DIGIT_INIT(138), \ + _PyLong_DIGIT_INIT(139), \ + _PyLong_DIGIT_INIT(140), \ + _PyLong_DIGIT_INIT(141), \ + _PyLong_DIGIT_INIT(142), \ + _PyLong_DIGIT_INIT(143), \ + _PyLong_DIGIT_INIT(144), \ + _PyLong_DIGIT_INIT(145), \ + _PyLong_DIGIT_INIT(146), \ + _PyLong_DIGIT_INIT(147), \ + _PyLong_DIGIT_INIT(148), \ + _PyLong_DIGIT_INIT(149), \ + _PyLong_DIGIT_INIT(150), \ + _PyLong_DIGIT_INIT(151), \ + _PyLong_DIGIT_INIT(152), \ + _PyLong_DIGIT_INIT(153), \ + _PyLong_DIGIT_INIT(154), \ + _PyLong_DIGIT_INIT(155), \ + _PyLong_DIGIT_INIT(156), \ + _PyLong_DIGIT_INIT(157), \ + _PyLong_DIGIT_INIT(158), \ + _PyLong_DIGIT_INIT(159), \ + _PyLong_DIGIT_INIT(160), \ + _PyLong_DIGIT_INIT(161), \ + _PyLong_DIGIT_INIT(162), \ + _PyLong_DIGIT_INIT(163), \ + _PyLong_DIGIT_INIT(164), \ + _PyLong_DIGIT_INIT(165), \ + _PyLong_DIGIT_INIT(166), \ + _PyLong_DIGIT_INIT(167), \ + _PyLong_DIGIT_INIT(168), \ + _PyLong_DIGIT_INIT(169), \ + _PyLong_DIGIT_INIT(170), \ + _PyLong_DIGIT_INIT(171), \ + _PyLong_DIGIT_INIT(172), \ + _PyLong_DIGIT_INIT(173), \ + _PyLong_DIGIT_INIT(174), \ + _PyLong_DIGIT_INIT(175), \ + _PyLong_DIGIT_INIT(176), \ + _PyLong_DIGIT_INIT(177), \ + _PyLong_DIGIT_INIT(178), \ + _PyLong_DIGIT_INIT(179), \ + _PyLong_DIGIT_INIT(180), \ + _PyLong_DIGIT_INIT(181), \ + _PyLong_DIGIT_INIT(182), \ + _PyLong_DIGIT_INIT(183), \ + _PyLong_DIGIT_INIT(184), \ + _PyLong_DIGIT_INIT(185), \ + _PyLong_DIGIT_INIT(186), \ + _PyLong_DIGIT_INIT(187), \ + _PyLong_DIGIT_INIT(188), \ + _PyLong_DIGIT_INIT(189), \ + _PyLong_DIGIT_INIT(190), \ + _PyLong_DIGIT_INIT(191), \ + _PyLong_DIGIT_INIT(192), \ + _PyLong_DIGIT_INIT(193), \ + _PyLong_DIGIT_INIT(194), \ + _PyLong_DIGIT_INIT(195), \ + _PyLong_DIGIT_INIT(196), \ + _PyLong_DIGIT_INIT(197), \ + _PyLong_DIGIT_INIT(198), \ + _PyLong_DIGIT_INIT(199), \ + _PyLong_DIGIT_INIT(200), \ + _PyLong_DIGIT_INIT(201), \ + _PyLong_DIGIT_INIT(202), \ + _PyLong_DIGIT_INIT(203), \ + _PyLong_DIGIT_INIT(204), \ + _PyLong_DIGIT_INIT(205), \ + _PyLong_DIGIT_INIT(206), \ + _PyLong_DIGIT_INIT(207), \ + _PyLong_DIGIT_INIT(208), \ + _PyLong_DIGIT_INIT(209), \ + _PyLong_DIGIT_INIT(210), \ + _PyLong_DIGIT_INIT(211), \ + _PyLong_DIGIT_INIT(212), \ + _PyLong_DIGIT_INIT(213), \ + _PyLong_DIGIT_INIT(214), \ + _PyLong_DIGIT_INIT(215), \ + _PyLong_DIGIT_INIT(216), \ + _PyLong_DIGIT_INIT(217), \ + _PyLong_DIGIT_INIT(218), \ + _PyLong_DIGIT_INIT(219), \ + _PyLong_DIGIT_INIT(220), \ + _PyLong_DIGIT_INIT(221), \ + _PyLong_DIGIT_INIT(222), \ + _PyLong_DIGIT_INIT(223), \ + _PyLong_DIGIT_INIT(224), \ + _PyLong_DIGIT_INIT(225), \ + _PyLong_DIGIT_INIT(226), \ + _PyLong_DIGIT_INIT(227), \ + _PyLong_DIGIT_INIT(228), \ + _PyLong_DIGIT_INIT(229), \ + _PyLong_DIGIT_INIT(230), \ + _PyLong_DIGIT_INIT(231), \ + _PyLong_DIGIT_INIT(232), \ + _PyLong_DIGIT_INIT(233), \ + _PyLong_DIGIT_INIT(234), \ + _PyLong_DIGIT_INIT(235), \ + _PyLong_DIGIT_INIT(236), \ + _PyLong_DIGIT_INIT(237), \ + _PyLong_DIGIT_INIT(238), \ + _PyLong_DIGIT_INIT(239), \ + _PyLong_DIGIT_INIT(240), \ + _PyLong_DIGIT_INIT(241), \ + _PyLong_DIGIT_INIT(242), \ + _PyLong_DIGIT_INIT(243), \ + _PyLong_DIGIT_INIT(244), \ + _PyLong_DIGIT_INIT(245), \ + _PyLong_DIGIT_INIT(246), \ + _PyLong_DIGIT_INIT(247), \ + _PyLong_DIGIT_INIT(248), \ + _PyLong_DIGIT_INIT(249), \ + _PyLong_DIGIT_INIT(250), \ + _PyLong_DIGIT_INIT(251), \ + _PyLong_DIGIT_INIT(252), \ + _PyLong_DIGIT_INIT(253), \ + _PyLong_DIGIT_INIT(254), \ + _PyLong_DIGIT_INIT(255), \ + _PyLong_DIGIT_INIT(256), \ + }, \ + \ + .bytes_empty = _PyBytes_SIMPLE_INIT(0, 0), \ + .bytes_characters = { \ + _PyBytes_CHAR_INIT(0), \ + _PyBytes_CHAR_INIT(1), \ + _PyBytes_CHAR_INIT(2), \ + _PyBytes_CHAR_INIT(3), \ + _PyBytes_CHAR_INIT(4), \ + _PyBytes_CHAR_INIT(5), \ + _PyBytes_CHAR_INIT(6), \ + _PyBytes_CHAR_INIT(7), \ + _PyBytes_CHAR_INIT(8), \ + _PyBytes_CHAR_INIT(9), \ + _PyBytes_CHAR_INIT(10), \ + _PyBytes_CHAR_INIT(11), \ + _PyBytes_CHAR_INIT(12), \ + _PyBytes_CHAR_INIT(13), \ + _PyBytes_CHAR_INIT(14), \ + _PyBytes_CHAR_INIT(15), \ + _PyBytes_CHAR_INIT(16), \ + _PyBytes_CHAR_INIT(17), \ + _PyBytes_CHAR_INIT(18), \ + _PyBytes_CHAR_INIT(19), \ + _PyBytes_CHAR_INIT(20), \ + _PyBytes_CHAR_INIT(21), \ + _PyBytes_CHAR_INIT(22), \ + _PyBytes_CHAR_INIT(23), \ + _PyBytes_CHAR_INIT(24), \ + _PyBytes_CHAR_INIT(25), \ + _PyBytes_CHAR_INIT(26), \ + _PyBytes_CHAR_INIT(27), \ + _PyBytes_CHAR_INIT(28), \ + _PyBytes_CHAR_INIT(29), \ + _PyBytes_CHAR_INIT(30), \ + _PyBytes_CHAR_INIT(31), \ + _PyBytes_CHAR_INIT(32), \ + _PyBytes_CHAR_INIT(33), \ + _PyBytes_CHAR_INIT(34), \ + _PyBytes_CHAR_INIT(35), \ + _PyBytes_CHAR_INIT(36), \ + _PyBytes_CHAR_INIT(37), \ + _PyBytes_CHAR_INIT(38), \ + _PyBytes_CHAR_INIT(39), \ + _PyBytes_CHAR_INIT(40), \ + _PyBytes_CHAR_INIT(41), \ + _PyBytes_CHAR_INIT(42), \ + _PyBytes_CHAR_INIT(43), \ + _PyBytes_CHAR_INIT(44), \ + _PyBytes_CHAR_INIT(45), \ + _PyBytes_CHAR_INIT(46), \ + _PyBytes_CHAR_INIT(47), \ + _PyBytes_CHAR_INIT(48), \ + _PyBytes_CHAR_INIT(49), \ + _PyBytes_CHAR_INIT(50), \ + _PyBytes_CHAR_INIT(51), \ + _PyBytes_CHAR_INIT(52), \ + _PyBytes_CHAR_INIT(53), \ + _PyBytes_CHAR_INIT(54), \ + _PyBytes_CHAR_INIT(55), \ + _PyBytes_CHAR_INIT(56), \ + _PyBytes_CHAR_INIT(57), \ + _PyBytes_CHAR_INIT(58), \ + _PyBytes_CHAR_INIT(59), \ + _PyBytes_CHAR_INIT(60), \ + _PyBytes_CHAR_INIT(61), \ + _PyBytes_CHAR_INIT(62), \ + _PyBytes_CHAR_INIT(63), \ + _PyBytes_CHAR_INIT(64), \ + _PyBytes_CHAR_INIT(65), \ + _PyBytes_CHAR_INIT(66), \ + _PyBytes_CHAR_INIT(67), \ + _PyBytes_CHAR_INIT(68), \ + _PyBytes_CHAR_INIT(69), \ + _PyBytes_CHAR_INIT(70), \ + _PyBytes_CHAR_INIT(71), \ + _PyBytes_CHAR_INIT(72), \ + _PyBytes_CHAR_INIT(73), \ + _PyBytes_CHAR_INIT(74), \ + _PyBytes_CHAR_INIT(75), \ + _PyBytes_CHAR_INIT(76), \ + _PyBytes_CHAR_INIT(77), \ + _PyBytes_CHAR_INIT(78), \ + _PyBytes_CHAR_INIT(79), \ + _PyBytes_CHAR_INIT(80), \ + _PyBytes_CHAR_INIT(81), \ + _PyBytes_CHAR_INIT(82), \ + _PyBytes_CHAR_INIT(83), \ + _PyBytes_CHAR_INIT(84), \ + _PyBytes_CHAR_INIT(85), \ + _PyBytes_CHAR_INIT(86), \ + _PyBytes_CHAR_INIT(87), \ + _PyBytes_CHAR_INIT(88), \ + _PyBytes_CHAR_INIT(89), \ + _PyBytes_CHAR_INIT(90), \ + _PyBytes_CHAR_INIT(91), \ + _PyBytes_CHAR_INIT(92), \ + _PyBytes_CHAR_INIT(93), \ + _PyBytes_CHAR_INIT(94), \ + _PyBytes_CHAR_INIT(95), \ + _PyBytes_CHAR_INIT(96), \ + _PyBytes_CHAR_INIT(97), \ + _PyBytes_CHAR_INIT(98), \ + _PyBytes_CHAR_INIT(99), \ + _PyBytes_CHAR_INIT(100), \ + _PyBytes_CHAR_INIT(101), \ + _PyBytes_CHAR_INIT(102), \ + _PyBytes_CHAR_INIT(103), \ + _PyBytes_CHAR_INIT(104), \ + _PyBytes_CHAR_INIT(105), \ + _PyBytes_CHAR_INIT(106), \ + _PyBytes_CHAR_INIT(107), \ + _PyBytes_CHAR_INIT(108), \ + _PyBytes_CHAR_INIT(109), \ + _PyBytes_CHAR_INIT(110), \ + _PyBytes_CHAR_INIT(111), \ + _PyBytes_CHAR_INIT(112), \ + _PyBytes_CHAR_INIT(113), \ + _PyBytes_CHAR_INIT(114), \ + _PyBytes_CHAR_INIT(115), \ + _PyBytes_CHAR_INIT(116), \ + _PyBytes_CHAR_INIT(117), \ + _PyBytes_CHAR_INIT(118), \ + _PyBytes_CHAR_INIT(119), \ + _PyBytes_CHAR_INIT(120), \ + _PyBytes_CHAR_INIT(121), \ + _PyBytes_CHAR_INIT(122), \ + _PyBytes_CHAR_INIT(123), \ + _PyBytes_CHAR_INIT(124), \ + _PyBytes_CHAR_INIT(125), \ + _PyBytes_CHAR_INIT(126), \ + _PyBytes_CHAR_INIT(127), \ + _PyBytes_CHAR_INIT(128), \ + _PyBytes_CHAR_INIT(129), \ + _PyBytes_CHAR_INIT(130), \ + _PyBytes_CHAR_INIT(131), \ + _PyBytes_CHAR_INIT(132), \ + _PyBytes_CHAR_INIT(133), \ + _PyBytes_CHAR_INIT(134), \ + _PyBytes_CHAR_INIT(135), \ + _PyBytes_CHAR_INIT(136), \ + _PyBytes_CHAR_INIT(137), \ + _PyBytes_CHAR_INIT(138), \ + _PyBytes_CHAR_INIT(139), \ + _PyBytes_CHAR_INIT(140), \ + _PyBytes_CHAR_INIT(141), \ + _PyBytes_CHAR_INIT(142), \ + _PyBytes_CHAR_INIT(143), \ + _PyBytes_CHAR_INIT(144), \ + _PyBytes_CHAR_INIT(145), \ + _PyBytes_CHAR_INIT(146), \ + _PyBytes_CHAR_INIT(147), \ + _PyBytes_CHAR_INIT(148), \ + _PyBytes_CHAR_INIT(149), \ + _PyBytes_CHAR_INIT(150), \ + _PyBytes_CHAR_INIT(151), \ + _PyBytes_CHAR_INIT(152), \ + _PyBytes_CHAR_INIT(153), \ + _PyBytes_CHAR_INIT(154), \ + _PyBytes_CHAR_INIT(155), \ + _PyBytes_CHAR_INIT(156), \ + _PyBytes_CHAR_INIT(157), \ + _PyBytes_CHAR_INIT(158), \ + _PyBytes_CHAR_INIT(159), \ + _PyBytes_CHAR_INIT(160), \ + _PyBytes_CHAR_INIT(161), \ + _PyBytes_CHAR_INIT(162), \ + _PyBytes_CHAR_INIT(163), \ + _PyBytes_CHAR_INIT(164), \ + _PyBytes_CHAR_INIT(165), \ + _PyBytes_CHAR_INIT(166), \ + _PyBytes_CHAR_INIT(167), \ + _PyBytes_CHAR_INIT(168), \ + _PyBytes_CHAR_INIT(169), \ + _PyBytes_CHAR_INIT(170), \ + _PyBytes_CHAR_INIT(171), \ + _PyBytes_CHAR_INIT(172), \ + _PyBytes_CHAR_INIT(173), \ + _PyBytes_CHAR_INIT(174), \ + _PyBytes_CHAR_INIT(175), \ + _PyBytes_CHAR_INIT(176), \ + _PyBytes_CHAR_INIT(177), \ + _PyBytes_CHAR_INIT(178), \ + _PyBytes_CHAR_INIT(179), \ + _PyBytes_CHAR_INIT(180), \ + _PyBytes_CHAR_INIT(181), \ + _PyBytes_CHAR_INIT(182), \ + _PyBytes_CHAR_INIT(183), \ + _PyBytes_CHAR_INIT(184), \ + _PyBytes_CHAR_INIT(185), \ + _PyBytes_CHAR_INIT(186), \ + _PyBytes_CHAR_INIT(187), \ + _PyBytes_CHAR_INIT(188), \ + _PyBytes_CHAR_INIT(189), \ + _PyBytes_CHAR_INIT(190), \ + _PyBytes_CHAR_INIT(191), \ + _PyBytes_CHAR_INIT(192), \ + _PyBytes_CHAR_INIT(193), \ + _PyBytes_CHAR_INIT(194), \ + _PyBytes_CHAR_INIT(195), \ + _PyBytes_CHAR_INIT(196), \ + _PyBytes_CHAR_INIT(197), \ + _PyBytes_CHAR_INIT(198), \ + _PyBytes_CHAR_INIT(199), \ + _PyBytes_CHAR_INIT(200), \ + _PyBytes_CHAR_INIT(201), \ + _PyBytes_CHAR_INIT(202), \ + _PyBytes_CHAR_INIT(203), \ + _PyBytes_CHAR_INIT(204), \ + _PyBytes_CHAR_INIT(205), \ + _PyBytes_CHAR_INIT(206), \ + _PyBytes_CHAR_INIT(207), \ + _PyBytes_CHAR_INIT(208), \ + _PyBytes_CHAR_INIT(209), \ + _PyBytes_CHAR_INIT(210), \ + _PyBytes_CHAR_INIT(211), \ + _PyBytes_CHAR_INIT(212), \ + _PyBytes_CHAR_INIT(213), \ + _PyBytes_CHAR_INIT(214), \ + _PyBytes_CHAR_INIT(215), \ + _PyBytes_CHAR_INIT(216), \ + _PyBytes_CHAR_INIT(217), \ + _PyBytes_CHAR_INIT(218), \ + _PyBytes_CHAR_INIT(219), \ + _PyBytes_CHAR_INIT(220), \ + _PyBytes_CHAR_INIT(221), \ + _PyBytes_CHAR_INIT(222), \ + _PyBytes_CHAR_INIT(223), \ + _PyBytes_CHAR_INIT(224), \ + _PyBytes_CHAR_INIT(225), \ + _PyBytes_CHAR_INIT(226), \ + _PyBytes_CHAR_INIT(227), \ + _PyBytes_CHAR_INIT(228), \ + _PyBytes_CHAR_INIT(229), \ + _PyBytes_CHAR_INIT(230), \ + _PyBytes_CHAR_INIT(231), \ + _PyBytes_CHAR_INIT(232), \ + _PyBytes_CHAR_INIT(233), \ + _PyBytes_CHAR_INIT(234), \ + _PyBytes_CHAR_INIT(235), \ + _PyBytes_CHAR_INIT(236), \ + _PyBytes_CHAR_INIT(237), \ + _PyBytes_CHAR_INIT(238), \ + _PyBytes_CHAR_INIT(239), \ + _PyBytes_CHAR_INIT(240), \ + _PyBytes_CHAR_INIT(241), \ + _PyBytes_CHAR_INIT(242), \ + _PyBytes_CHAR_INIT(243), \ + _PyBytes_CHAR_INIT(244), \ + _PyBytes_CHAR_INIT(245), \ + _PyBytes_CHAR_INIT(246), \ + _PyBytes_CHAR_INIT(247), \ + _PyBytes_CHAR_INIT(248), \ + _PyBytes_CHAR_INIT(249), \ + _PyBytes_CHAR_INIT(250), \ + _PyBytes_CHAR_INIT(251), \ + _PyBytes_CHAR_INIT(252), \ + _PyBytes_CHAR_INIT(253), \ + _PyBytes_CHAR_INIT(254), \ + _PyBytes_CHAR_INIT(255), \ + }, \ + \ + .strings = { \ + .literals = { \ + INIT_STR(anon_dictcomp, ""), \ + INIT_STR(anon_genexpr, ""), \ + INIT_STR(anon_lambda, ""), \ + INIT_STR(anon_listcomp, ""), \ + INIT_STR(anon_module, ""), \ + INIT_STR(anon_setcomp, ""), \ + INIT_STR(anon_string, ""), \ + INIT_STR(anon_unknown, ""), \ + INIT_STR(close_br, "}"), \ + INIT_STR(comma_sep, ", "), \ + INIT_STR(dbl_close_br, "}}"), \ + INIT_STR(dbl_open_br, "{{"), \ + INIT_STR(dbl_percent, "%%"), \ + INIT_STR(dot, "."), \ + INIT_STR(dot_locals, "."), \ + INIT_STR(empty, ""), \ + INIT_STR(list_err, "list index out of range"), \ + INIT_STR(newline, "\n"), \ + INIT_STR(open_br, "{"), \ + INIT_STR(percent, "%"), \ + INIT_STR(utf_8, "utf-8"), \ + }, \ + .identifiers = { \ + INIT_ID(False), \ + INIT_ID(Py_Repr), \ + INIT_ID(TextIOWrapper), \ + INIT_ID(True), \ + INIT_ID(WarningMessage), \ + INIT_ID(_), \ + INIT_ID(__IOBase_closed), \ + INIT_ID(__abc_tpflags__), \ + INIT_ID(__abs__), \ + INIT_ID(__abstractmethods__), \ + INIT_ID(__add__), \ + INIT_ID(__aenter__), \ + INIT_ID(__aexit__), \ + INIT_ID(__aiter__), \ + INIT_ID(__all__), \ + INIT_ID(__and__), \ + INIT_ID(__anext__), \ + INIT_ID(__annotations__), \ + INIT_ID(__args__), \ + INIT_ID(__await__), \ + INIT_ID(__bases__), \ + INIT_ID(__bool__), \ + INIT_ID(__build_class__), \ + INIT_ID(__builtins__), \ + INIT_ID(__bytes__), \ + INIT_ID(__call__), \ + INIT_ID(__cantrace__), \ + INIT_ID(__class__), \ + INIT_ID(__class_getitem__), \ + INIT_ID(__classcell__), \ + INIT_ID(__complex__), \ + INIT_ID(__contains__), \ + INIT_ID(__copy__), \ + INIT_ID(__del__), \ + INIT_ID(__delattr__), \ + INIT_ID(__delete__), \ + INIT_ID(__delitem__), \ + INIT_ID(__dict__), \ + INIT_ID(__dir__), \ + INIT_ID(__divmod__), \ + INIT_ID(__doc__), \ + INIT_ID(__enter__), \ + INIT_ID(__eq__), \ + INIT_ID(__exit__), \ + INIT_ID(__file__), \ + INIT_ID(__float__), \ + INIT_ID(__floordiv__), \ + INIT_ID(__format__), \ + INIT_ID(__fspath__), \ + INIT_ID(__ge__), \ + INIT_ID(__get__), \ + INIT_ID(__getattr__), \ + INIT_ID(__getattribute__), \ + INIT_ID(__getinitargs__), \ + INIT_ID(__getitem__), \ + INIT_ID(__getnewargs__), \ + INIT_ID(__getnewargs_ex__), \ + INIT_ID(__getstate__), \ + INIT_ID(__gt__), \ + INIT_ID(__hash__), \ + INIT_ID(__iadd__), \ + INIT_ID(__iand__), \ + INIT_ID(__ifloordiv__), \ + INIT_ID(__ilshift__), \ + INIT_ID(__imatmul__), \ + INIT_ID(__imod__), \ + INIT_ID(__import__), \ + INIT_ID(__imul__), \ + INIT_ID(__index__), \ + INIT_ID(__init__), \ + INIT_ID(__init_subclass__), \ + INIT_ID(__instancecheck__), \ + INIT_ID(__int__), \ + INIT_ID(__invert__), \ + INIT_ID(__ior__), \ + INIT_ID(__ipow__), \ + INIT_ID(__irshift__), \ + INIT_ID(__isabstractmethod__), \ + INIT_ID(__isub__), \ + INIT_ID(__iter__), \ + INIT_ID(__itruediv__), \ + INIT_ID(__ixor__), \ + INIT_ID(__le__), \ + INIT_ID(__len__), \ + INIT_ID(__length_hint__), \ + INIT_ID(__lltrace__), \ + INIT_ID(__loader__), \ + INIT_ID(__lshift__), \ + INIT_ID(__lt__), \ + INIT_ID(__main__), \ + INIT_ID(__matmul__), \ + INIT_ID(__missing__), \ + INIT_ID(__mod__), \ + INIT_ID(__module__), \ + INIT_ID(__mro_entries__), \ + INIT_ID(__mul__), \ + INIT_ID(__name__), \ + INIT_ID(__ne__), \ + INIT_ID(__neg__), \ + INIT_ID(__new__), \ + INIT_ID(__newobj__), \ + INIT_ID(__newobj_ex__), \ + INIT_ID(__next__), \ + INIT_ID(__notes__), \ + INIT_ID(__or__), \ + INIT_ID(__orig_class__), \ + INIT_ID(__origin__), \ + INIT_ID(__package__), \ + INIT_ID(__parameters__), \ + INIT_ID(__path__), \ + INIT_ID(__pos__), \ + INIT_ID(__pow__), \ + INIT_ID(__prepare__), \ + INIT_ID(__qualname__), \ + INIT_ID(__radd__), \ + INIT_ID(__rand__), \ + INIT_ID(__rdivmod__), \ + INIT_ID(__reduce__), \ + INIT_ID(__reduce_ex__), \ + INIT_ID(__repr__), \ + INIT_ID(__reversed__), \ + INIT_ID(__rfloordiv__), \ + INIT_ID(__rlshift__), \ + INIT_ID(__rmatmul__), \ + INIT_ID(__rmod__), \ + INIT_ID(__rmul__), \ + INIT_ID(__ror__), \ + INIT_ID(__round__), \ + INIT_ID(__rpow__), \ + INIT_ID(__rrshift__), \ + INIT_ID(__rshift__), \ + INIT_ID(__rsub__), \ + INIT_ID(__rtruediv__), \ + INIT_ID(__rxor__), \ + INIT_ID(__set__), \ + INIT_ID(__set_name__), \ + INIT_ID(__setattr__), \ + INIT_ID(__setitem__), \ + INIT_ID(__setstate__), \ + INIT_ID(__sizeof__), \ + INIT_ID(__slotnames__), \ + INIT_ID(__slots__), \ + INIT_ID(__spec__), \ + INIT_ID(__str__), \ + INIT_ID(__sub__), \ + INIT_ID(__subclasscheck__), \ + INIT_ID(__subclasshook__), \ + INIT_ID(__truediv__), \ + INIT_ID(__trunc__), \ + INIT_ID(__typing_is_unpacked_typevartuple__), \ + INIT_ID(__typing_prepare_subst__), \ + INIT_ID(__typing_subst__), \ + INIT_ID(__typing_unpacked_tuple_args__), \ + INIT_ID(__warningregistry__), \ + INIT_ID(__weakref__), \ + INIT_ID(__xor__), \ + INIT_ID(_abc_impl), \ + INIT_ID(_annotation), \ + INIT_ID(_blksize), \ + INIT_ID(_bootstrap), \ + INIT_ID(_dealloc_warn), \ + INIT_ID(_finalizing), \ + INIT_ID(_find_and_load), \ + INIT_ID(_fix_up_module), \ + INIT_ID(_get_sourcefile), \ + INIT_ID(_handle_fromlist), \ + INIT_ID(_initializing), \ + INIT_ID(_is_text_encoding), \ + INIT_ID(_lock_unlock_module), \ + INIT_ID(_showwarnmsg), \ + INIT_ID(_shutdown), \ + INIT_ID(_slotnames), \ + INIT_ID(_strptime_time), \ + INIT_ID(_uninitialized_submodules), \ + INIT_ID(_warn_unawaited_coroutine), \ + INIT_ID(_xoptions), \ + INIT_ID(add), \ + INIT_ID(append), \ + INIT_ID(big), \ + INIT_ID(buffer), \ + INIT_ID(builtins), \ + INIT_ID(c_call), \ + INIT_ID(c_exception), \ + INIT_ID(c_return), \ + INIT_ID(call), \ + INIT_ID(clear), \ + INIT_ID(close), \ + INIT_ID(closed), \ + INIT_ID(code), \ + INIT_ID(copy), \ + INIT_ID(copyreg), \ + INIT_ID(decode), \ + INIT_ID(default), \ + INIT_ID(defaultaction), \ + INIT_ID(dictcomp), \ + INIT_ID(difference_update), \ + INIT_ID(dispatch_table), \ + INIT_ID(displayhook), \ + INIT_ID(enable), \ + INIT_ID(encode), \ + INIT_ID(encoding), \ + INIT_ID(end_lineno), \ + INIT_ID(end_offset), \ + INIT_ID(errors), \ + INIT_ID(excepthook), \ + INIT_ID(exception), \ + INIT_ID(extend), \ + INIT_ID(filename), \ + INIT_ID(fileno), \ + INIT_ID(fillvalue), \ + INIT_ID(filters), \ + INIT_ID(find_class), \ + INIT_ID(flush), \ + INIT_ID(genexpr), \ + INIT_ID(get), \ + INIT_ID(get_source), \ + INIT_ID(getattr), \ + INIT_ID(getstate), \ + INIT_ID(ignore), \ + INIT_ID(importlib), \ + INIT_ID(inf), \ + INIT_ID(intersection), \ + INIT_ID(isatty), \ + INIT_ID(isinstance), \ + INIT_ID(items), \ + INIT_ID(iter), \ + INIT_ID(join), \ + INIT_ID(keys), \ + INIT_ID(lambda), \ + INIT_ID(last_traceback), \ + INIT_ID(last_type), \ + INIT_ID(last_value), \ + INIT_ID(latin1), \ + INIT_ID(len), \ + INIT_ID(line), \ + INIT_ID(lineno), \ + INIT_ID(listcomp), \ + INIT_ID(little), \ + INIT_ID(locale), \ + INIT_ID(match), \ + INIT_ID(metaclass), \ + INIT_ID(mode), \ + INIT_ID(modules), \ + INIT_ID(mro), \ + INIT_ID(msg), \ + INIT_ID(n_fields), \ + INIT_ID(n_sequence_fields), \ + INIT_ID(n_unnamed_fields), \ + INIT_ID(name), \ + INIT_ID(newlines), \ + INIT_ID(next), \ + INIT_ID(obj), \ + INIT_ID(offset), \ + INIT_ID(onceregistry), \ + INIT_ID(opcode), \ + INIT_ID(open), \ + INIT_ID(parent), \ + INIT_ID(partial), \ + INIT_ID(path), \ + INIT_ID(peek), \ + INIT_ID(persistent_id), \ + INIT_ID(persistent_load), \ + INIT_ID(print_file_and_line), \ + INIT_ID(ps1), \ + INIT_ID(ps2), \ + INIT_ID(raw), \ + INIT_ID(read), \ + INIT_ID(read1), \ + INIT_ID(readable), \ + INIT_ID(readall), \ + INIT_ID(readinto), \ + INIT_ID(readinto1), \ + INIT_ID(readline), \ + INIT_ID(reducer_override), \ + INIT_ID(reload), \ + INIT_ID(replace), \ + INIT_ID(reset), \ + INIT_ID(return), \ + INIT_ID(reversed), \ + INIT_ID(seek), \ + INIT_ID(seekable), \ + INIT_ID(send), \ + INIT_ID(setcomp), \ + INIT_ID(setstate), \ + INIT_ID(sort), \ + INIT_ID(stderr), \ + INIT_ID(stdin), \ + INIT_ID(stdout), \ + INIT_ID(strict), \ + INIT_ID(symmetric_difference_update), \ + INIT_ID(tell), \ + INIT_ID(text), \ + INIT_ID(threading), \ + INIT_ID(throw), \ + INIT_ID(top), \ + INIT_ID(truncate), \ + INIT_ID(unraisablehook), \ + INIT_ID(values), \ + INIT_ID(version), \ + INIT_ID(warnings), \ + INIT_ID(warnoptions), \ + INIT_ID(writable), \ + INIT_ID(write), \ + INIT_ID(zipimporter), \ + }, \ + .ascii = { \ + _PyASCIIObject_INIT("\x00"), \ + _PyASCIIObject_INIT("\x01"), \ + _PyASCIIObject_INIT("\x02"), \ + _PyASCIIObject_INIT("\x03"), \ + _PyASCIIObject_INIT("\x04"), \ + _PyASCIIObject_INIT("\x05"), \ + _PyASCIIObject_INIT("\x06"), \ + _PyASCIIObject_INIT("\x07"), \ + _PyASCIIObject_INIT("\x08"), \ + _PyASCIIObject_INIT("\x09"), \ + _PyASCIIObject_INIT("\x0a"), \ + _PyASCIIObject_INIT("\x0b"), \ + _PyASCIIObject_INIT("\x0c"), \ + _PyASCIIObject_INIT("\x0d"), \ + _PyASCIIObject_INIT("\x0e"), \ + _PyASCIIObject_INIT("\x0f"), \ + _PyASCIIObject_INIT("\x10"), \ + _PyASCIIObject_INIT("\x11"), \ + _PyASCIIObject_INIT("\x12"), \ + _PyASCIIObject_INIT("\x13"), \ + _PyASCIIObject_INIT("\x14"), \ + _PyASCIIObject_INIT("\x15"), \ + _PyASCIIObject_INIT("\x16"), \ + _PyASCIIObject_INIT("\x17"), \ + _PyASCIIObject_INIT("\x18"), \ + _PyASCIIObject_INIT("\x19"), \ + _PyASCIIObject_INIT("\x1a"), \ + _PyASCIIObject_INIT("\x1b"), \ + _PyASCIIObject_INIT("\x1c"), \ + _PyASCIIObject_INIT("\x1d"), \ + _PyASCIIObject_INIT("\x1e"), \ + _PyASCIIObject_INIT("\x1f"), \ + _PyASCIIObject_INIT("\x20"), \ + _PyASCIIObject_INIT("\x21"), \ + _PyASCIIObject_INIT("\x22"), \ + _PyASCIIObject_INIT("\x23"), \ + _PyASCIIObject_INIT("\x24"), \ + _PyASCIIObject_INIT("\x25"), \ + _PyASCIIObject_INIT("\x26"), \ + _PyASCIIObject_INIT("\x27"), \ + _PyASCIIObject_INIT("\x28"), \ + _PyASCIIObject_INIT("\x29"), \ + _PyASCIIObject_INIT("\x2a"), \ + _PyASCIIObject_INIT("\x2b"), \ + _PyASCIIObject_INIT("\x2c"), \ + _PyASCIIObject_INIT("\x2d"), \ + _PyASCIIObject_INIT("\x2e"), \ + _PyASCIIObject_INIT("\x2f"), \ + _PyASCIIObject_INIT("\x30"), \ + _PyASCIIObject_INIT("\x31"), \ + _PyASCIIObject_INIT("\x32"), \ + _PyASCIIObject_INIT("\x33"), \ + _PyASCIIObject_INIT("\x34"), \ + _PyASCIIObject_INIT("\x35"), \ + _PyASCIIObject_INIT("\x36"), \ + _PyASCIIObject_INIT("\x37"), \ + _PyASCIIObject_INIT("\x38"), \ + _PyASCIIObject_INIT("\x39"), \ + _PyASCIIObject_INIT("\x3a"), \ + _PyASCIIObject_INIT("\x3b"), \ + _PyASCIIObject_INIT("\x3c"), \ + _PyASCIIObject_INIT("\x3d"), \ + _PyASCIIObject_INIT("\x3e"), \ + _PyASCIIObject_INIT("\x3f"), \ + _PyASCIIObject_INIT("\x40"), \ + _PyASCIIObject_INIT("\x41"), \ + _PyASCIIObject_INIT("\x42"), \ + _PyASCIIObject_INIT("\x43"), \ + _PyASCIIObject_INIT("\x44"), \ + _PyASCIIObject_INIT("\x45"), \ + _PyASCIIObject_INIT("\x46"), \ + _PyASCIIObject_INIT("\x47"), \ + _PyASCIIObject_INIT("\x48"), \ + _PyASCIIObject_INIT("\x49"), \ + _PyASCIIObject_INIT("\x4a"), \ + _PyASCIIObject_INIT("\x4b"), \ + _PyASCIIObject_INIT("\x4c"), \ + _PyASCIIObject_INIT("\x4d"), \ + _PyASCIIObject_INIT("\x4e"), \ + _PyASCIIObject_INIT("\x4f"), \ + _PyASCIIObject_INIT("\x50"), \ + _PyASCIIObject_INIT("\x51"), \ + _PyASCIIObject_INIT("\x52"), \ + _PyASCIIObject_INIT("\x53"), \ + _PyASCIIObject_INIT("\x54"), \ + _PyASCIIObject_INIT("\x55"), \ + _PyASCIIObject_INIT("\x56"), \ + _PyASCIIObject_INIT("\x57"), \ + _PyASCIIObject_INIT("\x58"), \ + _PyASCIIObject_INIT("\x59"), \ + _PyASCIIObject_INIT("\x5a"), \ + _PyASCIIObject_INIT("\x5b"), \ + _PyASCIIObject_INIT("\x5c"), \ + _PyASCIIObject_INIT("\x5d"), \ + _PyASCIIObject_INIT("\x5e"), \ + _PyASCIIObject_INIT("\x5f"), \ + _PyASCIIObject_INIT("\x60"), \ + _PyASCIIObject_INIT("\x61"), \ + _PyASCIIObject_INIT("\x62"), \ + _PyASCIIObject_INIT("\x63"), \ + _PyASCIIObject_INIT("\x64"), \ + _PyASCIIObject_INIT("\x65"), \ + _PyASCIIObject_INIT("\x66"), \ + _PyASCIIObject_INIT("\x67"), \ + _PyASCIIObject_INIT("\x68"), \ + _PyASCIIObject_INIT("\x69"), \ + _PyASCIIObject_INIT("\x6a"), \ + _PyASCIIObject_INIT("\x6b"), \ + _PyASCIIObject_INIT("\x6c"), \ + _PyASCIIObject_INIT("\x6d"), \ + _PyASCIIObject_INIT("\x6e"), \ + _PyASCIIObject_INIT("\x6f"), \ + _PyASCIIObject_INIT("\x70"), \ + _PyASCIIObject_INIT("\x71"), \ + _PyASCIIObject_INIT("\x72"), \ + _PyASCIIObject_INIT("\x73"), \ + _PyASCIIObject_INIT("\x74"), \ + _PyASCIIObject_INIT("\x75"), \ + _PyASCIIObject_INIT("\x76"), \ + _PyASCIIObject_INIT("\x77"), \ + _PyASCIIObject_INIT("\x78"), \ + _PyASCIIObject_INIT("\x79"), \ + _PyASCIIObject_INIT("\x7a"), \ + _PyASCIIObject_INIT("\x7b"), \ + _PyASCIIObject_INIT("\x7c"), \ + _PyASCIIObject_INIT("\x7d"), \ + _PyASCIIObject_INIT("\x7e"), \ + _PyASCIIObject_INIT("\x7f"), \ + }, \ + .latin1 = { \ + _PyUnicode_LATIN1_INIT("\x80"), \ + _PyUnicode_LATIN1_INIT("\x81"), \ + _PyUnicode_LATIN1_INIT("\x82"), \ + _PyUnicode_LATIN1_INIT("\x83"), \ + _PyUnicode_LATIN1_INIT("\x84"), \ + _PyUnicode_LATIN1_INIT("\x85"), \ + _PyUnicode_LATIN1_INIT("\x86"), \ + _PyUnicode_LATIN1_INIT("\x87"), \ + _PyUnicode_LATIN1_INIT("\x88"), \ + _PyUnicode_LATIN1_INIT("\x89"), \ + _PyUnicode_LATIN1_INIT("\x8a"), \ + _PyUnicode_LATIN1_INIT("\x8b"), \ + _PyUnicode_LATIN1_INIT("\x8c"), \ + _PyUnicode_LATIN1_INIT("\x8d"), \ + _PyUnicode_LATIN1_INIT("\x8e"), \ + _PyUnicode_LATIN1_INIT("\x8f"), \ + _PyUnicode_LATIN1_INIT("\x90"), \ + _PyUnicode_LATIN1_INIT("\x91"), \ + _PyUnicode_LATIN1_INIT("\x92"), \ + _PyUnicode_LATIN1_INIT("\x93"), \ + _PyUnicode_LATIN1_INIT("\x94"), \ + _PyUnicode_LATIN1_INIT("\x95"), \ + _PyUnicode_LATIN1_INIT("\x96"), \ + _PyUnicode_LATIN1_INIT("\x97"), \ + _PyUnicode_LATIN1_INIT("\x98"), \ + _PyUnicode_LATIN1_INIT("\x99"), \ + _PyUnicode_LATIN1_INIT("\x9a"), \ + _PyUnicode_LATIN1_INIT("\x9b"), \ + _PyUnicode_LATIN1_INIT("\x9c"), \ + _PyUnicode_LATIN1_INIT("\x9d"), \ + _PyUnicode_LATIN1_INIT("\x9e"), \ + _PyUnicode_LATIN1_INIT("\x9f"), \ + _PyUnicode_LATIN1_INIT("\xa0"), \ + _PyUnicode_LATIN1_INIT("\xa1"), \ + _PyUnicode_LATIN1_INIT("\xa2"), \ + _PyUnicode_LATIN1_INIT("\xa3"), \ + _PyUnicode_LATIN1_INIT("\xa4"), \ + _PyUnicode_LATIN1_INIT("\xa5"), \ + _PyUnicode_LATIN1_INIT("\xa6"), \ + _PyUnicode_LATIN1_INIT("\xa7"), \ + _PyUnicode_LATIN1_INIT("\xa8"), \ + _PyUnicode_LATIN1_INIT("\xa9"), \ + _PyUnicode_LATIN1_INIT("\xaa"), \ + _PyUnicode_LATIN1_INIT("\xab"), \ + _PyUnicode_LATIN1_INIT("\xac"), \ + _PyUnicode_LATIN1_INIT("\xad"), \ + _PyUnicode_LATIN1_INIT("\xae"), \ + _PyUnicode_LATIN1_INIT("\xaf"), \ + _PyUnicode_LATIN1_INIT("\xb0"), \ + _PyUnicode_LATIN1_INIT("\xb1"), \ + _PyUnicode_LATIN1_INIT("\xb2"), \ + _PyUnicode_LATIN1_INIT("\xb3"), \ + _PyUnicode_LATIN1_INIT("\xb4"), \ + _PyUnicode_LATIN1_INIT("\xb5"), \ + _PyUnicode_LATIN1_INIT("\xb6"), \ + _PyUnicode_LATIN1_INIT("\xb7"), \ + _PyUnicode_LATIN1_INIT("\xb8"), \ + _PyUnicode_LATIN1_INIT("\xb9"), \ + _PyUnicode_LATIN1_INIT("\xba"), \ + _PyUnicode_LATIN1_INIT("\xbb"), \ + _PyUnicode_LATIN1_INIT("\xbc"), \ + _PyUnicode_LATIN1_INIT("\xbd"), \ + _PyUnicode_LATIN1_INIT("\xbe"), \ + _PyUnicode_LATIN1_INIT("\xbf"), \ + _PyUnicode_LATIN1_INIT("\xc0"), \ + _PyUnicode_LATIN1_INIT("\xc1"), \ + _PyUnicode_LATIN1_INIT("\xc2"), \ + _PyUnicode_LATIN1_INIT("\xc3"), \ + _PyUnicode_LATIN1_INIT("\xc4"), \ + _PyUnicode_LATIN1_INIT("\xc5"), \ + _PyUnicode_LATIN1_INIT("\xc6"), \ + _PyUnicode_LATIN1_INIT("\xc7"), \ + _PyUnicode_LATIN1_INIT("\xc8"), \ + _PyUnicode_LATIN1_INIT("\xc9"), \ + _PyUnicode_LATIN1_INIT("\xca"), \ + _PyUnicode_LATIN1_INIT("\xcb"), \ + _PyUnicode_LATIN1_INIT("\xcc"), \ + _PyUnicode_LATIN1_INIT("\xcd"), \ + _PyUnicode_LATIN1_INIT("\xce"), \ + _PyUnicode_LATIN1_INIT("\xcf"), \ + _PyUnicode_LATIN1_INIT("\xd0"), \ + _PyUnicode_LATIN1_INIT("\xd1"), \ + _PyUnicode_LATIN1_INIT("\xd2"), \ + _PyUnicode_LATIN1_INIT("\xd3"), \ + _PyUnicode_LATIN1_INIT("\xd4"), \ + _PyUnicode_LATIN1_INIT("\xd5"), \ + _PyUnicode_LATIN1_INIT("\xd6"), \ + _PyUnicode_LATIN1_INIT("\xd7"), \ + _PyUnicode_LATIN1_INIT("\xd8"), \ + _PyUnicode_LATIN1_INIT("\xd9"), \ + _PyUnicode_LATIN1_INIT("\xda"), \ + _PyUnicode_LATIN1_INIT("\xdb"), \ + _PyUnicode_LATIN1_INIT("\xdc"), \ + _PyUnicode_LATIN1_INIT("\xdd"), \ + _PyUnicode_LATIN1_INIT("\xde"), \ + _PyUnicode_LATIN1_INIT("\xdf"), \ + _PyUnicode_LATIN1_INIT("\xe0"), \ + _PyUnicode_LATIN1_INIT("\xe1"), \ + _PyUnicode_LATIN1_INIT("\xe2"), \ + _PyUnicode_LATIN1_INIT("\xe3"), \ + _PyUnicode_LATIN1_INIT("\xe4"), \ + _PyUnicode_LATIN1_INIT("\xe5"), \ + _PyUnicode_LATIN1_INIT("\xe6"), \ + _PyUnicode_LATIN1_INIT("\xe7"), \ + _PyUnicode_LATIN1_INIT("\xe8"), \ + _PyUnicode_LATIN1_INIT("\xe9"), \ + _PyUnicode_LATIN1_INIT("\xea"), \ + _PyUnicode_LATIN1_INIT("\xeb"), \ + _PyUnicode_LATIN1_INIT("\xec"), \ + _PyUnicode_LATIN1_INIT("\xed"), \ + _PyUnicode_LATIN1_INIT("\xee"), \ + _PyUnicode_LATIN1_INIT("\xef"), \ + _PyUnicode_LATIN1_INIT("\xf0"), \ + _PyUnicode_LATIN1_INIT("\xf1"), \ + _PyUnicode_LATIN1_INIT("\xf2"), \ + _PyUnicode_LATIN1_INIT("\xf3"), \ + _PyUnicode_LATIN1_INIT("\xf4"), \ + _PyUnicode_LATIN1_INIT("\xf5"), \ + _PyUnicode_LATIN1_INIT("\xf6"), \ + _PyUnicode_LATIN1_INIT("\xf7"), \ + _PyUnicode_LATIN1_INIT("\xf8"), \ + _PyUnicode_LATIN1_INIT("\xf9"), \ + _PyUnicode_LATIN1_INIT("\xfa"), \ + _PyUnicode_LATIN1_INIT("\xfb"), \ + _PyUnicode_LATIN1_INIT("\xfc"), \ + _PyUnicode_LATIN1_INIT("\xfd"), \ + _PyUnicode_LATIN1_INIT("\xfe"), \ + _PyUnicode_LATIN1_INIT("\xff"), \ + }, \ + }, \ + \ + .tuple_empty = { \ + .ob_base = _PyVarObject_IMMORTAL_INIT(&PyTuple_Type, 0) \ + }, \ + }, \ +} +/* End auto-generated code */ + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_RUNTIME_INIT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_signal.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_signal.h new file mode 100644 index 0000000000000000000000000000000000000000..b921dd170e9f6fe726599557e7d0f4212aaa2f34 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_signal.h @@ -0,0 +1,35 @@ +// Define Py_NSIG constant for signal handling. + +#ifndef Py_INTERNAL_SIGNAL_H +#define Py_INTERNAL_SIGNAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include // NSIG + +#ifdef _SIG_MAXSIG + // gh-91145: On FreeBSD, defines NSIG as 32: it doesn't include + // realtime signals: [SIGRTMIN,SIGRTMAX]. Use _SIG_MAXSIG instead. For + // example on x86-64 FreeBSD 13, SIGRTMAX is 126 and _SIG_MAXSIG is 128. +# define Py_NSIG _SIG_MAXSIG +#elif defined(NSIG) +# define Py_NSIG NSIG +#elif defined(_NSIG) +# define Py_NSIG _NSIG // BSD/SysV +#elif defined(_SIGMAX) +# define Py_NSIG (_SIGMAX + 1) // QNX +#elif defined(SIGMAX) +# define Py_NSIG (SIGMAX + 1) // djgpp +#else +# define Py_NSIG 64 // Use a reasonable default value +#endif + +#ifdef __cplusplus +} +#endif +#endif // !Py_INTERNAL_SIGNAL_H diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sliceobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sliceobject.h new file mode 100644 index 0000000000000000000000000000000000000000..e81834c041e4155b4d5065f965ce9c351168b6f2 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sliceobject.h @@ -0,0 +1,20 @@ +#ifndef Py_INTERNAL_SLICEOBJECT_H +#define Py_INTERNAL_SLICEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern void _PySlice_Fini(PyInterpreterState *); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_SLICEOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_strhex.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_strhex.h new file mode 100644 index 0000000000000000000000000000000000000000..f427b4d695bd299b753be99cecc7f9ab280c91e0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_strhex.h @@ -0,0 +1,36 @@ +#ifndef Py_INTERNAL_STRHEX_H +#define Py_INTERNAL_STRHEX_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +// Returns a str() containing the hex representation of argbuf. +PyAPI_FUNC(PyObject*) _Py_strhex(const + char* argbuf, + const Py_ssize_t arglen); + +// Returns a bytes() containing the ASCII hex representation of argbuf. +PyAPI_FUNC(PyObject*) _Py_strhex_bytes( + const char* argbuf, + const Py_ssize_t arglen); + +// These variants include support for a separator between every N bytes: +PyAPI_FUNC(PyObject*) _Py_strhex_with_sep( + const char* argbuf, + const Py_ssize_t arglen, + PyObject* sep, + const int bytes_per_group); +PyAPI_FUNC(PyObject*) _Py_strhex_bytes_with_sep( + const char* argbuf, + const Py_ssize_t arglen, + PyObject* sep, + const int bytes_per_group); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_STRHEX_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_structseq.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_structseq.h new file mode 100644 index 0000000000000000000000000000000000000000..0199c790e24cecfcfbceac226e15c3b353c9b731 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_structseq.h @@ -0,0 +1,28 @@ +#ifndef Py_INTERNAL_STRUCTSEQ_H +#define Py_INTERNAL_STRUCTSEQ_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* other API */ + +PyAPI_FUNC(PyTypeObject *) _PyStructSequence_NewType( + PyStructSequence_Desc *desc, + unsigned long tp_flags); + +PyAPI_FUNC(int) _PyStructSequence_InitType( + PyTypeObject *type, + PyStructSequence_Desc *desc, + unsigned long tp_flags); + +extern void _PyStructSequence_FiniType(PyTypeObject *type); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_STRUCTSEQ_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_symtable.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_symtable.h new file mode 100644 index 0000000000000000000000000000000000000000..28935f4ed55012aa226783e495067605b102c3b1 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_symtable.h @@ -0,0 +1,134 @@ +#ifndef Py_INTERNAL_SYMTABLE_H +#define Py_INTERNAL_SYMTABLE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +struct _mod; // Type defined in pycore_ast.h + +typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock, AnnotationBlock } + _Py_block_ty; + +typedef enum _comprehension_type { + NoComprehension = 0, + ListComprehension = 1, + DictComprehension = 2, + SetComprehension = 3, + GeneratorExpression = 4 } _Py_comprehension_ty; + +struct _symtable_entry; + +struct symtable { + PyObject *st_filename; /* name of file being compiled, + decoded from the filesystem encoding */ + struct _symtable_entry *st_cur; /* current symbol table entry */ + struct _symtable_entry *st_top; /* symbol table entry for module */ + PyObject *st_blocks; /* dict: map AST node addresses + * to symbol table entries */ + PyObject *st_stack; /* list: stack of namespace info */ + PyObject *st_global; /* borrowed ref to st_top->ste_symbols */ + int st_nblocks; /* number of blocks used. kept for + consistency with the corresponding + compiler structure */ + PyObject *st_private; /* name of current class or NULL */ + PyFutureFeatures *st_future; /* module's future features that affect + the symbol table */ + int recursion_depth; /* current recursion depth */ + int recursion_limit; /* recursion limit */ +}; + +typedef struct _symtable_entry { + PyObject_HEAD + PyObject *ste_id; /* int: key in ste_table->st_blocks */ + PyObject *ste_symbols; /* dict: variable names to flags */ + PyObject *ste_name; /* string: name of current block */ + PyObject *ste_varnames; /* list of function parameters */ + PyObject *ste_children; /* list of child blocks */ + PyObject *ste_directives;/* locations of global and nonlocal statements */ + _Py_block_ty ste_type; /* module, class or function */ + int ste_nested; /* true if block is nested */ + unsigned ste_free : 1; /* true if block has free variables */ + unsigned ste_child_free : 1; /* true if a child block has free vars, + including free refs to globals */ + unsigned ste_generator : 1; /* true if namespace is a generator */ + unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ + _Py_comprehension_ty ste_comprehension; /* Kind of comprehension (if any) */ + unsigned ste_varargs : 1; /* true if block has varargs */ + unsigned ste_varkeywords : 1; /* true if block has varkeywords */ + unsigned ste_returns_value : 1; /* true if namespace uses return with + an argument */ + unsigned ste_needs_class_closure : 1; /* for class scopes, true if a + closure over __class__ + should be created */ + unsigned ste_comp_iter_target : 1; /* true if visiting comprehension target */ + int ste_comp_iter_expr; /* non-zero if visiting a comprehension range expression */ + int ste_lineno; /* first line of block */ + int ste_col_offset; /* offset of first line of block */ + int ste_end_lineno; /* end line of block */ + int ste_end_col_offset; /* end offset of first line of block */ + int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_opt_col_offset; /* offset of last exec or import * */ + struct symtable *ste_table; +} PySTEntryObject; + +extern PyTypeObject PySTEntry_Type; + +#define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type) + +extern long _PyST_GetSymbol(PySTEntryObject *, PyObject *); +extern int _PyST_GetScope(PySTEntryObject *, PyObject *); + +extern struct symtable* _PySymtable_Build( + struct _mod *mod, + PyObject *filename, + PyFutureFeatures *future); +PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); + +extern void _PySymtable_Free(struct symtable *); + +/* Flags for def-use information */ + +#define DEF_GLOBAL 1 /* global stmt */ +#define DEF_LOCAL 2 /* assignment in code block */ +#define DEF_PARAM 2<<1 /* formal parameter */ +#define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ +#define USE 2<<3 /* name is used */ +#define DEF_FREE 2<<4 /* name used but not defined in nested block */ +#define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ +#define DEF_IMPORT 2<<6 /* assignment occurred via import */ +#define DEF_ANNOT 2<<7 /* this name is annotated */ +#define DEF_COMP_ITER 2<<8 /* this name is a comprehension iteration variable */ + +#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) + +/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol + table. GLOBAL is returned from PyST_GetScope() for either of them. + It is stored in ste_symbols at bits 12-15. +*/ +#define SCOPE_OFFSET 11 +#define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL) + +#define LOCAL 1 +#define GLOBAL_EXPLICIT 2 +#define GLOBAL_IMPLICIT 3 +#define FREE 4 +#define CELL 5 + +#define GENERATOR 1 +#define GENERATOR_EXPRESSION 2 + +// Used by symtablemodule.c +extern struct symtable* _Py_SymtableStringObjectFlags( + const char *str, + PyObject *filename, + int start, + PyCompilerFlags *flags); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_SYMTABLE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sysmodule.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sysmodule.h new file mode 100644 index 0000000000000000000000000000000000000000..10d092cdc30a2c5a931de77b2ab44801672d4383 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_sysmodule.h @@ -0,0 +1,26 @@ +#ifndef Py_INTERNAL_SYSMODULE_H +#define Py_INTERNAL_SYSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +PyAPI_FUNC(int) _PySys_Audit( + PyThreadState *tstate, + const char *event, + const char *argFormat, + ...); + +/* We want minimal exposure of this function, so use extern rather than + PyAPI_FUNC() to not export the symbol. */ +extern void _PySys_ClearAuditHooks(PyThreadState *tstate); + +PyAPI_FUNC(int) _PySys_SetAttr(PyObject *, PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_SYSMODULE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_traceback.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_traceback.h new file mode 100644 index 0000000000000000000000000000000000000000..c393b2c136f2de1b600000046326aaa40b31e2a7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_traceback.h @@ -0,0 +1,101 @@ +#ifndef Py_INTERNAL_TRACEBACK_H +#define Py_INTERNAL_TRACEBACK_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* Write the Python traceback into the file 'fd'. For example: + + Traceback (most recent call first): + File "xxx", line xxx in + File "xxx", line xxx in + ... + File "xxx", line xxx in + + This function is written for debug purpose only, to dump the traceback in + the worst case: after a segmentation fault, at fatal error, etc. That's why, + it is very limited. Strings are truncated to 100 characters and encoded to + ASCII with backslashreplace. It doesn't write the source code, only the + function name, filename and line number of each frame. Write only the first + 100 frames: if the traceback is truncated, write the line " ...". + + This function is signal safe. */ + +PyAPI_FUNC(void) _Py_DumpTraceback( + int fd, + PyThreadState *tstate); + +/* Write the traceback of all threads into the file 'fd'. current_thread can be + NULL. + + Return NULL on success, or an error message on error. + + This function is written for debug purpose only. It calls + _Py_DumpTraceback() for each thread, and so has the same limitations. It + only write the traceback of the first 100 threads: write "..." if there are + more threads. + + If current_tstate is NULL, the function tries to get the Python thread state + of the current thread. It is not an error if the function is unable to get + the current Python thread state. + + If interp is NULL, the function tries to get the interpreter state from + the current Python thread state, or from + _PyGILState_GetInterpreterStateUnsafe() in last resort. + + It is better to pass NULL to interp and current_tstate, the function tries + different options to retrieve this information. + + This function is signal safe. */ + +PyAPI_FUNC(const char*) _Py_DumpTracebackThreads( + int fd, + PyInterpreterState *interp, + PyThreadState *current_tstate); + +/* Write a Unicode object into the file descriptor fd. Encode the string to + ASCII using the backslashreplace error handler. + + Do nothing if text is not a Unicode object. The function accepts Unicode + string which is not ready (PyUnicode_WCHAR_KIND). + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text); + +/* Format an integer as decimal into the file descriptor fd. + + This function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpDecimal( + int fd, + size_t value); + +/* Format an integer as hexadecimal with width digits into fd file descriptor. + The function is signal safe. */ +PyAPI_FUNC(void) _Py_DumpHexadecimal( + int fd, + uintptr_t value, + Py_ssize_t width); + +PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame( + PyObject *tb_next, + PyFrameObject *frame); + +#define EXCEPTION_TB_HEADER "Traceback (most recent call last):\n" +#define EXCEPTION_GROUP_TB_HEADER "Exception Group Traceback (most recent call last):\n" + +/* Write the traceback tb to file f. Prefix each line with + indent spaces followed by the margin (if it is not NULL). */ +PyAPI_FUNC(int) _PyTraceBack_Print_Indented( + PyObject *tb, int indent, const char* margin, + const char *header_margin, const char *header, PyObject *f); +PyAPI_FUNC(int) _Py_WriteIndentedMargin(int, const char*, PyObject *); +PyAPI_FUNC(int) _Py_WriteIndent(int, PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_TRACEBACK_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_tuple.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_tuple.h new file mode 100644 index 0000000000000000000000000000000000000000..1efe4fa2bdef943e407e127c8c202748f380bc82 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_tuple.h @@ -0,0 +1,73 @@ +#ifndef Py_INTERNAL_TUPLE_H +#define Py_INTERNAL_TUPLE_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "tupleobject.h" /* _PyTuple_CAST() */ + + +/* runtime lifecycle */ + +extern PyStatus _PyTuple_InitGlobalObjects(PyInterpreterState *); +extern PyStatus _PyTuple_InitTypes(PyInterpreterState *); +extern void _PyTuple_Fini(PyInterpreterState *); + + +/* other API */ + +// PyTuple_MAXSAVESIZE - largest tuple to save on free list +// PyTuple_MAXFREELIST - maximum number of tuples of each size to save + +#if defined(PyTuple_MAXSAVESIZE) && PyTuple_MAXSAVESIZE <= 0 + // A build indicated that tuple freelists should not be used. +# define PyTuple_NFREELISTS 0 +# undef PyTuple_MAXSAVESIZE +# undef PyTuple_MAXFREELIST + +#elif !defined(WITH_FREELISTS) +# define PyTuple_NFREELISTS 0 +# undef PyTuple_MAXSAVESIZE +# undef PyTuple_MAXFREELIST + +#else + // We are using a freelist for tuples. +# ifndef PyTuple_MAXSAVESIZE +# define PyTuple_MAXSAVESIZE 20 +# endif +# define PyTuple_NFREELISTS PyTuple_MAXSAVESIZE +# ifndef PyTuple_MAXFREELIST +# define PyTuple_MAXFREELIST 2000 +# endif +#endif + +struct _Py_tuple_state { +#if PyTuple_NFREELISTS > 0 + /* There is one freelist for each size from 1 to PyTuple_MAXSAVESIZE. + The empty tuple is handled separately. + + Each tuple stored in the array is the head of the linked list + (and the next available tuple) for that size. The actual tuple + object is used as the linked list node, with its first item + (ob_item[0]) pointing to the next node (i.e. the previous head). + Each linked list is initially NULL. */ + PyTupleObject *free_list[PyTuple_NFREELISTS]; + int numfree[PyTuple_NFREELISTS]; +#else + char _unused; // Empty structs are not allowed. +#endif +}; + +#define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item) + +extern PyObject *_PyTuple_FromArray(PyObject *const *, Py_ssize_t); +extern PyObject *_PyTuple_FromArraySteal(PyObject *const *, Py_ssize_t); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_TUPLE_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_typeobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_typeobject.h new file mode 100644 index 0000000000000000000000000000000000000000..c480a3a57b436c958f7db7c2a0b1cb2acfa7cda7 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_typeobject.h @@ -0,0 +1,50 @@ +#ifndef Py_INTERNAL_TYPEOBJECT_H +#define Py_INTERNAL_TYPEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + + +/* runtime lifecycle */ + +extern PyStatus _PyTypes_InitState(PyInterpreterState *); +extern PyStatus _PyTypes_InitTypes(PyInterpreterState *); +extern void _PyTypes_FiniTypes(PyInterpreterState *); +extern void _PyTypes_Fini(PyInterpreterState *); + + +/* other API */ + +// Type attribute lookup cache: speed up attribute and method lookups, +// see _PyType_Lookup(). +struct type_cache_entry { + unsigned int version; // initialized from type->tp_version_tag + PyObject *name; // reference to exactly a str or None + PyObject *value; // borrowed reference or NULL +}; + +#define MCACHE_SIZE_EXP 12 +#define MCACHE_STATS 0 + +struct type_cache { + struct type_cache_entry hashtable[1 << MCACHE_SIZE_EXP]; +#if MCACHE_STATS + size_t hits; + size_t misses; + size_t collisions; +#endif +}; + +extern PyStatus _PyTypes_InitSlotDefs(void); + +extern void _PyStaticType_Dealloc(PyTypeObject *type); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_TYPEOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ucnhash.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ucnhash.h new file mode 100644 index 0000000000000000000000000000000000000000..187dd68e7347ff3fc90371de01d367dc9b5f0338 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_ucnhash.h @@ -0,0 +1,34 @@ +/* Unicode name database interface */ +#ifndef Py_INTERNAL_UCNHASH_H +#define Py_INTERNAL_UCNHASH_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +/* revised ucnhash CAPI interface (exported through a "wrapper") */ + +#define PyUnicodeData_CAPSULE_NAME "unicodedata._ucnhash_CAPI" + +typedef struct { + + /* Get name for a given character code. + Returns non-zero if success, zero if not. + Does not set Python exceptions. */ + int (*getname)(Py_UCS4 code, char* buffer, int buflen, + int with_alias_and_seq); + + /* Get character code for a given name. + Same error handling as for getname(). */ + int (*getcode)(const char* name, int namelen, Py_UCS4* code, + int with_named_seq); + +} _PyUnicode_Name_CAPI; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_UCNHASH_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unicodeobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unicodeobject.h new file mode 100644 index 0000000000000000000000000000000000000000..4bee2419fbd98acd5f43d20f32435028da19823b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unicodeobject.h @@ -0,0 +1,62 @@ +#ifndef Py_INTERNAL_UNICODEOBJECT_H +#define Py_INTERNAL_UNICODEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +#include "pycore_fileutils.h" // _Py_error_handler + +void _PyUnicode_ExactDealloc(PyObject *op); + +/* runtime lifecycle */ + +extern void _PyUnicode_InitState(PyInterpreterState *); +extern PyStatus _PyUnicode_InitGlobalObjects(PyInterpreterState *); +extern PyStatus _PyUnicode_InitTypes(PyInterpreterState *); +extern void _PyUnicode_Fini(PyInterpreterState *); +extern void _PyUnicode_FiniTypes(PyInterpreterState *); +extern void _PyStaticUnicode_Dealloc(PyObject *); + +extern PyTypeObject _PyUnicodeASCIIIter_Type; + +/* other API */ + +struct _Py_unicode_runtime_ids { + PyThread_type_lock lock; + // next_index value must be preserved when Py_Initialize()/Py_Finalize() + // is called multiple times: see _PyUnicode_FromId() implementation. + Py_ssize_t next_index; +}; + +/* fs_codec.encoding is initialized to NULL. + Later, it is set to a non-NULL string by _PyUnicode_InitEncodings(). */ +struct _Py_unicode_fs_codec { + char *encoding; // Filesystem encoding (encoded to UTF-8) + int utf8; // encoding=="utf-8"? + char *errors; // Filesystem errors (encoded to UTF-8) + _Py_error_handler error_handler; +}; + +struct _Py_unicode_ids { + Py_ssize_t size; + PyObject **array; +}; + +struct _Py_unicode_state { + struct _Py_unicode_fs_codec fs_codec; + + // Unicode identifiers (_Py_Identifier): see _PyUnicode_FromId() + struct _Py_unicode_ids ids; +}; + +extern void _PyUnicode_ClearInterned(PyInterpreterState *interp); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_UNICODEOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unionobject.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unionobject.h new file mode 100644 index 0000000000000000000000000000000000000000..a9ed5651a410e87c6ded94de37af2d1af3d559f0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_unionobject.h @@ -0,0 +1,23 @@ +#ifndef Py_INTERNAL_UNIONOBJECT_H +#define Py_INTERNAL_UNIONOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +extern PyTypeObject _PyUnion_Type; +#define _PyUnion_Check(op) Py_IS_TYPE(op, &_PyUnion_Type) +extern PyObject *_Py_union_type_or(PyObject *, PyObject *); + +#define _PyGenericAlias_Check(op) PyObject_TypeCheck(op, &Py_GenericAliasType) +extern PyObject *_Py_subs_parameters(PyObject *, PyObject *, PyObject *, PyObject *); +extern PyObject *_Py_make_parameters(PyObject *); +extern PyObject *_Py_union_args(PyObject *self); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_UNIONOBJECT_H */ diff --git a/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_warnings.h b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_warnings.h new file mode 100644 index 0000000000000000000000000000000000000000..efb4f1cd7eac80ad20c2b15a33bb7f4dc8746725 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/python3.11/internal/pycore_warnings.h @@ -0,0 +1,29 @@ +#ifndef Py_INTERNAL_WARNINGS_H +#define Py_INTERNAL_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef Py_BUILD_CORE +# error "this header requires Py_BUILD_CORE define" +#endif + +struct _warnings_runtime_state { + /* Both 'filters' and 'onceregistry' can be set in warnings.py; + get_warnings_attr() will reset these variables accordingly. */ + PyObject *filters; /* List */ + PyObject *once_registry; /* Dict */ + PyObject *default_action; /* String */ + long filters_version; +}; + +extern int _PyWarnings_InitState(PyInterpreterState *interp); + +PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); + +extern void _PyErr_WarnUnawaitedCoroutine(PyObject *coro); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_WARNINGS_H */ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/error/en.h b/data/miniconda3/envs/catiagent/include/rapidjson/error/en.h new file mode 100644 index 0000000000000000000000000000000000000000..c87b04eb133ed55544ad7ac555a072393449a043 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/error/en.h @@ -0,0 +1,176 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ERROR_EN_H_ +#define RAPIDJSON_ERROR_EN_H_ + +#include "error.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(switch-enum) +RAPIDJSON_DIAG_OFF(covered-switch-default) +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +//! Maps error code of parsing into error message. +/*! + \ingroup RAPIDJSON_ERRORS + \param parseErrorCode Error code obtained in parsing. + \return the error message. + \note User can make a copy of this function for localization. + Using switch-case is safer for future modification of error codes. +*/ +inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) { + switch (parseErrorCode) { + case kParseErrorNone: return RAPIDJSON_ERROR_STRING("No error."); + + case kParseErrorDocumentEmpty: return RAPIDJSON_ERROR_STRING("The document is empty."); + case kParseErrorDocumentRootNotSingular: return RAPIDJSON_ERROR_STRING("The document root must not be followed by other values."); + + case kParseErrorValueInvalid: return RAPIDJSON_ERROR_STRING("Invalid value."); + + case kParseErrorObjectMissName: return RAPIDJSON_ERROR_STRING("Missing a name for object member."); + case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member."); + case kParseErrorObjectMissCommaOrCurlyBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member."); + + case kParseErrorArrayMissCommaOrSquareBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element."); + + case kParseErrorStringUnicodeEscapeInvalidHex: return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string."); + case kParseErrorStringUnicodeSurrogateInvalid: return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid."); + case kParseErrorStringEscapeInvalid: return RAPIDJSON_ERROR_STRING("Invalid escape character in string."); + case kParseErrorStringMissQuotationMark: return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string."); + case kParseErrorStringInvalidEncoding: return RAPIDJSON_ERROR_STRING("Invalid encoding in string."); + + case kParseErrorNumberTooBig: return RAPIDJSON_ERROR_STRING("Number too big to be stored in double."); + case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number."); + case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number."); + + case kParseErrorTermination: return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error."); + case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error."); + + default: return RAPIDJSON_ERROR_STRING("Unknown error."); + } +} + +//! Maps error code of validation into error message. +/*! + \ingroup RAPIDJSON_ERRORS + \param validateErrorCode Error code obtained from validator. + \return the error message. + \note User can make a copy of this function for localization. + Using switch-case is safer for future modification of error codes. +*/ +inline const RAPIDJSON_ERROR_CHARTYPE* GetValidateError_En(ValidateErrorCode validateErrorCode) { + switch (validateErrorCode) { + case kValidateErrors: return RAPIDJSON_ERROR_STRING("One or more validation errors have occurred"); + case kValidateErrorNone: return RAPIDJSON_ERROR_STRING("No error."); + + case kValidateErrorMultipleOf: return RAPIDJSON_ERROR_STRING("Number '%actual' is not a multiple of the 'multipleOf' value '%expected'."); + case kValidateErrorMaximum: return RAPIDJSON_ERROR_STRING("Number '%actual' is greater than the 'maximum' value '%expected'."); + case kValidateErrorExclusiveMaximum: return RAPIDJSON_ERROR_STRING("Number '%actual' is greater than or equal to the 'exclusiveMaximum' value '%expected'."); + case kValidateErrorMinimum: return RAPIDJSON_ERROR_STRING("Number '%actual' is less than the 'minimum' value '%expected'."); + case kValidateErrorExclusiveMinimum: return RAPIDJSON_ERROR_STRING("Number '%actual' is less than or equal to the 'exclusiveMinimum' value '%expected'."); + + case kValidateErrorMaxLength: return RAPIDJSON_ERROR_STRING("String '%actual' is longer than the 'maxLength' value '%expected'."); + case kValidateErrorMinLength: return RAPIDJSON_ERROR_STRING("String '%actual' is shorter than the 'minLength' value '%expected'."); + case kValidateErrorPattern: return RAPIDJSON_ERROR_STRING("String '%actual' does not match the 'pattern' regular expression."); + + case kValidateErrorMaxItems: return RAPIDJSON_ERROR_STRING("Array of length '%actual' is longer than the 'maxItems' value '%expected'."); + case kValidateErrorMinItems: return RAPIDJSON_ERROR_STRING("Array of length '%actual' is shorter than the 'minItems' value '%expected'."); + case kValidateErrorUniqueItems: return RAPIDJSON_ERROR_STRING("Array has duplicate items at indices '%duplicates' but 'uniqueItems' is true."); + case kValidateErrorAdditionalItems: return RAPIDJSON_ERROR_STRING("Array has an additional item at index '%disallowed' that is not allowed by the schema."); + + case kValidateErrorMaxProperties: return RAPIDJSON_ERROR_STRING("Object has '%actual' members which is more than 'maxProperties' value '%expected'."); + case kValidateErrorMinProperties: return RAPIDJSON_ERROR_STRING("Object has '%actual' members which is less than 'minProperties' value '%expected'."); + case kValidateErrorRequired: return RAPIDJSON_ERROR_STRING("Object is missing the following members required by the schema: '%missing'."); + case kValidateErrorAdditionalProperties: return RAPIDJSON_ERROR_STRING("Object has an additional member '%disallowed' that is not allowed by the schema."); + case kValidateErrorPatternProperties: return RAPIDJSON_ERROR_STRING("Object has 'patternProperties' that are not allowed by the schema."); + case kValidateErrorDependencies: return RAPIDJSON_ERROR_STRING("Object has missing property or schema dependencies, refer to following errors."); + + case kValidateErrorEnum: return RAPIDJSON_ERROR_STRING("Property has a value that is not one of its allowed enumerated values."); + case kValidateErrorType: return RAPIDJSON_ERROR_STRING("Property has a type '%actual' that is not in the following list: '%expected'."); + + case kValidateErrorOneOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'oneOf', refer to following errors."); + case kValidateErrorOneOfMatch: return RAPIDJSON_ERROR_STRING("Property matched more than one of the sub-schemas specified by 'oneOf', indices '%matches'."); + case kValidateErrorAllOf: return RAPIDJSON_ERROR_STRING("Property did not match all of the sub-schemas specified by 'allOf', refer to following errors."); + case kValidateErrorAnyOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'anyOf', refer to following errors."); + case kValidateErrorNot: return RAPIDJSON_ERROR_STRING("Property matched the sub-schema specified by 'not'."); + + case kValidateErrorReadOnly: return RAPIDJSON_ERROR_STRING("Property is read-only but has been provided when validation is for writing."); + case kValidateErrorWriteOnly: return RAPIDJSON_ERROR_STRING("Property is write-only but has been provided when validation is for reading."); + + default: return RAPIDJSON_ERROR_STRING("Unknown error."); + } +} + +//! Maps error code of schema document compilation into error message. +/*! + \ingroup RAPIDJSON_ERRORS + \param schemaErrorCode Error code obtained from compiling the schema document. + \return the error message. + \note User can make a copy of this function for localization. + Using switch-case is safer for future modification of error codes. +*/ + inline const RAPIDJSON_ERROR_CHARTYPE* GetSchemaError_En(SchemaErrorCode schemaErrorCode) { + switch (schemaErrorCode) { + case kSchemaErrorNone: return RAPIDJSON_ERROR_STRING("No error."); + + case kSchemaErrorStartUnknown: return RAPIDJSON_ERROR_STRING("Pointer '%value' to start of schema does not resolve to a location in the document."); + case kSchemaErrorRefPlainName: return RAPIDJSON_ERROR_STRING("$ref fragment '%value' must be a JSON pointer."); + case kSchemaErrorRefInvalid: return RAPIDJSON_ERROR_STRING("$ref must not be an empty string."); + case kSchemaErrorRefPointerInvalid: return RAPIDJSON_ERROR_STRING("$ref fragment '%value' is not a valid JSON pointer at offset '%offset'."); + case kSchemaErrorRefUnknown: return RAPIDJSON_ERROR_STRING("$ref '%value' does not resolve to a location in the target document."); + case kSchemaErrorRefCyclical: return RAPIDJSON_ERROR_STRING("$ref '%value' is cyclical."); + case kSchemaErrorRefNoRemoteProvider: return RAPIDJSON_ERROR_STRING("$ref is remote but there is no remote provider."); + case kSchemaErrorRefNoRemoteSchema: return RAPIDJSON_ERROR_STRING("$ref '%value' is remote but the remote provider did not return a schema."); + case kSchemaErrorRegexInvalid: return RAPIDJSON_ERROR_STRING("Invalid regular expression '%value' in 'pattern' or 'patternProperties'."); + case kSchemaErrorSpecUnknown: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not recognized."); + case kSchemaErrorSpecUnsupported: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not supported."); + case kSchemaErrorSpecIllegal: return RAPIDJSON_ERROR_STRING("Both JSON schema draft and OpenAPI version found in document."); + case kSchemaErrorReadOnlyAndWriteOnly: return RAPIDJSON_ERROR_STRING("Property must not be both 'readOnly' and 'writeOnly'."); + + default: return RAPIDJSON_ERROR_STRING("Unknown error."); + } + } + +//! Maps error code of pointer parse into error message. +/*! + \ingroup RAPIDJSON_ERRORS + \param pointerParseErrorCode Error code obtained from pointer parse. + \return the error message. + \note User can make a copy of this function for localization. + Using switch-case is safer for future modification of error codes. +*/ +inline const RAPIDJSON_ERROR_CHARTYPE* GetPointerParseError_En(PointerParseErrorCode pointerParseErrorCode) { + switch (pointerParseErrorCode) { + case kPointerParseErrorNone: return RAPIDJSON_ERROR_STRING("No error."); + + case kPointerParseErrorTokenMustBeginWithSolidus: return RAPIDJSON_ERROR_STRING("A token must begin with a '/'."); + case kPointerParseErrorInvalidEscape: return RAPIDJSON_ERROR_STRING("Invalid escape."); + case kPointerParseErrorInvalidPercentEncoding: return RAPIDJSON_ERROR_STRING("Invalid percent encoding in URI fragment."); + case kPointerParseErrorCharacterMustPercentEncode: return RAPIDJSON_ERROR_STRING("A character must be percent encoded in a URI fragment."); + + default: return RAPIDJSON_ERROR_STRING("Unknown error."); + } +} + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_ERROR_EN_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/error/error.h b/data/miniconda3/envs/catiagent/include/rapidjson/error/error.h new file mode 100644 index 0000000000000000000000000000000000000000..cae345db36d2c1161c0c33ad744f5ee1eee6c0ee --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/error/error.h @@ -0,0 +1,285 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ERROR_ERROR_H_ +#define RAPIDJSON_ERROR_ERROR_H_ + +#include "../rapidjson.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +/*! \file error.h */ + +/*! \defgroup RAPIDJSON_ERRORS RapidJSON error handling */ + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ERROR_CHARTYPE + +//! Character type of error messages. +/*! \ingroup RAPIDJSON_ERRORS + The default character type is \c char. + On Windows, user can define this macro as \c TCHAR for supporting both + unicode/non-unicode settings. +*/ +#ifndef RAPIDJSON_ERROR_CHARTYPE +#define RAPIDJSON_ERROR_CHARTYPE char +#endif + +/////////////////////////////////////////////////////////////////////////////// +// RAPIDJSON_ERROR_STRING + +//! Macro for converting string literal to \ref RAPIDJSON_ERROR_CHARTYPE[]. +/*! \ingroup RAPIDJSON_ERRORS + By default this conversion macro does nothing. + On Windows, user can define this macro as \c _T(x) for supporting both + unicode/non-unicode settings. +*/ +#ifndef RAPIDJSON_ERROR_STRING +#define RAPIDJSON_ERROR_STRING(x) x +#endif + +RAPIDJSON_NAMESPACE_BEGIN + +/////////////////////////////////////////////////////////////////////////////// +// ParseErrorCode + +//! Error code of parsing. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericReader::Parse, GenericReader::GetParseErrorCode +*/ +enum ParseErrorCode { + kParseErrorNone = 0, //!< No error. + + kParseErrorDocumentEmpty, //!< The document is empty. + kParseErrorDocumentRootNotSingular, //!< The document root must not follow by other values. + + kParseErrorValueInvalid, //!< Invalid value. + + kParseErrorObjectMissName, //!< Missing a name for object member. + kParseErrorObjectMissColon, //!< Missing a colon after a name of object member. + kParseErrorObjectMissCommaOrCurlyBracket, //!< Missing a comma or '}' after an object member. + + kParseErrorArrayMissCommaOrSquareBracket, //!< Missing a comma or ']' after an array element. + + kParseErrorStringUnicodeEscapeInvalidHex, //!< Incorrect hex digit after \\u escape in string. + kParseErrorStringUnicodeSurrogateInvalid, //!< The surrogate pair in string is invalid. + kParseErrorStringEscapeInvalid, //!< Invalid escape character in string. + kParseErrorStringMissQuotationMark, //!< Missing a closing quotation mark in string. + kParseErrorStringInvalidEncoding, //!< Invalid encoding in string. + + kParseErrorNumberTooBig, //!< Number too big to be stored in double. + kParseErrorNumberMissFraction, //!< Miss fraction part in number. + kParseErrorNumberMissExponent, //!< Miss exponent in number. + + kParseErrorTermination, //!< Parsing was terminated. + kParseErrorUnspecificSyntaxError //!< Unspecific syntax error. +}; + +//! Result of parsing (wraps ParseErrorCode) +/*! + \ingroup RAPIDJSON_ERRORS + \code + Document doc; + ParseResult ok = doc.Parse("[42]"); + if (!ok) { + fprintf(stderr, "JSON parse error: %s (%u)", + GetParseError_En(ok.Code()), ok.Offset()); + exit(EXIT_FAILURE); + } + \endcode + \see GenericReader::Parse, GenericDocument::Parse +*/ +struct ParseResult { + //!! Unspecified boolean type + typedef bool (ParseResult::*BooleanType)() const; +public: + //! Default constructor, no error. + ParseResult() : code_(kParseErrorNone), offset_(0) {} + //! Constructor to set an error. + ParseResult(ParseErrorCode code, size_t offset) : code_(code), offset_(offset) {} + + //! Get the error code. + ParseErrorCode Code() const { return code_; } + //! Get the error offset, if \ref IsError(), 0 otherwise. + size_t Offset() const { return offset_; } + + //! Explicit conversion to \c bool, returns \c true, iff !\ref IsError(). + operator BooleanType() const { return !IsError() ? &ParseResult::IsError : NULL; } + //! Whether the result is an error. + bool IsError() const { return code_ != kParseErrorNone; } + + bool operator==(const ParseResult& that) const { return code_ == that.code_; } + bool operator==(ParseErrorCode code) const { return code_ == code; } + friend bool operator==(ParseErrorCode code, const ParseResult & err) { return code == err.code_; } + + bool operator!=(const ParseResult& that) const { return !(*this == that); } + bool operator!=(ParseErrorCode code) const { return !(*this == code); } + friend bool operator!=(ParseErrorCode code, const ParseResult & err) { return err != code; } + + //! Reset error code. + void Clear() { Set(kParseErrorNone); } + //! Update error code and offset. + void Set(ParseErrorCode code, size_t offset = 0) { code_ = code; offset_ = offset; } + +private: + ParseErrorCode code_; + size_t offset_; +}; + +//! Function pointer type of GetParseError(). +/*! \ingroup RAPIDJSON_ERRORS + + This is the prototype for \c GetParseError_X(), where \c X is a locale. + User can dynamically change locale in runtime, e.g.: +\code + GetParseErrorFunc GetParseError = GetParseError_En; // or whatever + const RAPIDJSON_ERROR_CHARTYPE* s = GetParseError(document.GetParseErrorCode()); +\endcode +*/ +typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetParseErrorFunc)(ParseErrorCode); + +/////////////////////////////////////////////////////////////////////////////// +// ValidateErrorCode + +//! Error codes when validating. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericSchemaValidator +*/ +enum ValidateErrorCode { + kValidateErrors = -1, //!< Top level error code when kValidateContinueOnErrorsFlag set. + kValidateErrorNone = 0, //!< No error. + + kValidateErrorMultipleOf, //!< Number is not a multiple of the 'multipleOf' value. + kValidateErrorMaximum, //!< Number is greater than the 'maximum' value. + kValidateErrorExclusiveMaximum, //!< Number is greater than or equal to the 'maximum' value. + kValidateErrorMinimum, //!< Number is less than the 'minimum' value. + kValidateErrorExclusiveMinimum, //!< Number is less than or equal to the 'minimum' value. + + kValidateErrorMaxLength, //!< String is longer than the 'maxLength' value. + kValidateErrorMinLength, //!< String is longer than the 'maxLength' value. + kValidateErrorPattern, //!< String does not match the 'pattern' regular expression. + + kValidateErrorMaxItems, //!< Array is longer than the 'maxItems' value. + kValidateErrorMinItems, //!< Array is shorter than the 'minItems' value. + kValidateErrorUniqueItems, //!< Array has duplicate items but 'uniqueItems' is true. + kValidateErrorAdditionalItems, //!< Array has additional items that are not allowed by the schema. + + kValidateErrorMaxProperties, //!< Object has more members than 'maxProperties' value. + kValidateErrorMinProperties, //!< Object has less members than 'minProperties' value. + kValidateErrorRequired, //!< Object is missing one or more members required by the schema. + kValidateErrorAdditionalProperties, //!< Object has additional members that are not allowed by the schema. + kValidateErrorPatternProperties, //!< See other errors. + kValidateErrorDependencies, //!< Object has missing property or schema dependencies. + + kValidateErrorEnum, //!< Property has a value that is not one of its allowed enumerated values. + kValidateErrorType, //!< Property has a type that is not allowed by the schema. + + kValidateErrorOneOf, //!< Property did not match any of the sub-schemas specified by 'oneOf'. + kValidateErrorOneOfMatch, //!< Property matched more than one of the sub-schemas specified by 'oneOf'. + kValidateErrorAllOf, //!< Property did not match all of the sub-schemas specified by 'allOf'. + kValidateErrorAnyOf, //!< Property did not match any of the sub-schemas specified by 'anyOf'. + kValidateErrorNot, //!< Property matched the sub-schema specified by 'not'. + + kValidateErrorReadOnly, //!< Property is read-only but has been provided when validation is for writing + kValidateErrorWriteOnly //!< Property is write-only but has been provided when validation is for reading +}; + +//! Function pointer type of GetValidateError(). +/*! \ingroup RAPIDJSON_ERRORS + + This is the prototype for \c GetValidateError_X(), where \c X is a locale. + User can dynamically change locale in runtime, e.g.: +\code + GetValidateErrorFunc GetValidateError = GetValidateError_En; // or whatever + const RAPIDJSON_ERROR_CHARTYPE* s = GetValidateError(validator.GetInvalidSchemaCode()); +\endcode +*/ +typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetValidateErrorFunc)(ValidateErrorCode); + +/////////////////////////////////////////////////////////////////////////////// +// SchemaErrorCode + +//! Error codes when validating. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericSchemaValidator +*/ +enum SchemaErrorCode { + kSchemaErrorNone = 0, //!< No error. + + kSchemaErrorStartUnknown, //!< Pointer to start of schema does not resolve to a location in the document + kSchemaErrorRefPlainName, //!< $ref fragment must be a JSON pointer + kSchemaErrorRefInvalid, //!< $ref must not be an empty string + kSchemaErrorRefPointerInvalid, //!< $ref fragment is not a valid JSON pointer at offset + kSchemaErrorRefUnknown, //!< $ref does not resolve to a location in the target document + kSchemaErrorRefCyclical, //!< $ref is cyclical + kSchemaErrorRefNoRemoteProvider, //!< $ref is remote but there is no remote provider + kSchemaErrorRefNoRemoteSchema, //!< $ref is remote but the remote provider did not return a schema + kSchemaErrorRegexInvalid, //!< Invalid regular expression in 'pattern' or 'patternProperties' + kSchemaErrorSpecUnknown, //!< JSON schema draft or OpenAPI version is not recognized + kSchemaErrorSpecUnsupported, //!< JSON schema draft or OpenAPI version is not supported + kSchemaErrorSpecIllegal, //!< Both JSON schema draft and OpenAPI version found in document + kSchemaErrorReadOnlyAndWriteOnly //!< Property must not be both 'readOnly' and 'writeOnly' +}; + +//! Function pointer type of GetSchemaError(). +/*! \ingroup RAPIDJSON_ERRORS + + This is the prototype for \c GetSchemaError_X(), where \c X is a locale. + User can dynamically change locale in runtime, e.g.: +\code + GetSchemaErrorFunc GetSchemaError = GetSchemaError_En; // or whatever + const RAPIDJSON_ERROR_CHARTYPE* s = GetSchemaError(validator.GetInvalidSchemaCode()); +\endcode +*/ +typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetSchemaErrorFunc)(SchemaErrorCode); + +/////////////////////////////////////////////////////////////////////////////// +// PointerParseErrorCode + +//! Error code of JSON pointer parsing. +/*! \ingroup RAPIDJSON_ERRORS + \see GenericPointer::GenericPointer, GenericPointer::GetParseErrorCode +*/ +enum PointerParseErrorCode { + kPointerParseErrorNone = 0, //!< The parse is successful + + kPointerParseErrorTokenMustBeginWithSolidus, //!< A token must begin with a '/' + kPointerParseErrorInvalidEscape, //!< Invalid escape + kPointerParseErrorInvalidPercentEncoding, //!< Invalid percent encoding in URI fragment + kPointerParseErrorCharacterMustPercentEncode //!< A character must percent encoded in URI fragment +}; + +//! Function pointer type of GetPointerParseError(). +/*! \ingroup RAPIDJSON_ERRORS + + This is the prototype for \c GetPointerParseError_X(), where \c X is a locale. + User can dynamically change locale in runtime, e.g.: +\code + GetPointerParseErrorFunc GetPointerParseError = GetPointerParseError_En; // or whatever + const RAPIDJSON_ERROR_CHARTYPE* s = GetPointerParseError(pointer.GetParseErrorCode()); +\endcode +*/ +typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetPointerParseErrorFunc)(PointerParseErrorCode); + + +RAPIDJSON_NAMESPACE_END + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_ERROR_ERROR_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/biginteger.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/biginteger.h new file mode 100644 index 0000000000000000000000000000000000000000..4930043dc7c5f972cea77523fbc6cb6164416313 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/biginteger.h @@ -0,0 +1,297 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_BIGINTEGER_H_ +#define RAPIDJSON_BIGINTEGER_H_ + +#include "../rapidjson.h" + +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_M_AMD64) +#include // for _umul128 +#if !defined(_ARM64EC_) +#pragma intrinsic(_umul128) +#else +#pragma comment(lib,"softintrin") +#endif +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +class BigInteger { +public: + typedef uint64_t Type; + + BigInteger(const BigInteger& rhs) : count_(rhs.count_) { + std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type)); + } + + explicit BigInteger(uint64_t u) : count_(1) { + digits_[0] = u; + } + + template + BigInteger(const Ch* decimals, size_t length) : count_(1) { + RAPIDJSON_ASSERT(length > 0); + digits_[0] = 0; + size_t i = 0; + const size_t kMaxDigitPerIteration = 19; // 2^64 = 18446744073709551616 > 10^19 + while (length >= kMaxDigitPerIteration) { + AppendDecimal64(decimals + i, decimals + i + kMaxDigitPerIteration); + length -= kMaxDigitPerIteration; + i += kMaxDigitPerIteration; + } + + if (length > 0) + AppendDecimal64(decimals + i, decimals + i + length); + } + + BigInteger& operator=(const BigInteger &rhs) + { + if (this != &rhs) { + count_ = rhs.count_; + std::memcpy(digits_, rhs.digits_, count_ * sizeof(Type)); + } + return *this; + } + + BigInteger& operator=(uint64_t u) { + digits_[0] = u; + count_ = 1; + return *this; + } + + BigInteger& operator+=(uint64_t u) { + Type backup = digits_[0]; + digits_[0] += u; + for (size_t i = 0; i < count_ - 1; i++) { + if (digits_[i] >= backup) + return *this; // no carry + backup = digits_[i + 1]; + digits_[i + 1] += 1; + } + + // Last carry + if (digits_[count_ - 1] < backup) + PushBack(1); + + return *this; + } + + BigInteger& operator*=(uint64_t u) { + if (u == 0) return *this = 0; + if (u == 1) return *this; + if (*this == 1) return *this = u; + + uint64_t k = 0; + for (size_t i = 0; i < count_; i++) { + uint64_t hi; + digits_[i] = MulAdd64(digits_[i], u, k, &hi); + k = hi; + } + + if (k > 0) + PushBack(k); + + return *this; + } + + BigInteger& operator*=(uint32_t u) { + if (u == 0) return *this = 0; + if (u == 1) return *this; + if (*this == 1) return *this = u; + + uint64_t k = 0; + for (size_t i = 0; i < count_; i++) { + const uint64_t c = digits_[i] >> 32; + const uint64_t d = digits_[i] & 0xFFFFFFFF; + const uint64_t uc = u * c; + const uint64_t ud = u * d; + const uint64_t p0 = ud + k; + const uint64_t p1 = uc + (p0 >> 32); + digits_[i] = (p0 & 0xFFFFFFFF) | (p1 << 32); + k = p1 >> 32; + } + + if (k > 0) + PushBack(k); + + return *this; + } + + BigInteger& operator<<=(size_t shift) { + if (IsZero() || shift == 0) return *this; + + size_t offset = shift / kTypeBit; + size_t interShift = shift % kTypeBit; + RAPIDJSON_ASSERT(count_ + offset <= kCapacity); + + if (interShift == 0) { + std::memmove(digits_ + offset, digits_, count_ * sizeof(Type)); + count_ += offset; + } + else { + digits_[count_] = 0; + for (size_t i = count_; i > 0; i--) + digits_[i + offset] = (digits_[i] << interShift) | (digits_[i - 1] >> (kTypeBit - interShift)); + digits_[offset] = digits_[0] << interShift; + count_ += offset; + if (digits_[count_]) + count_++; + } + + std::memset(digits_, 0, offset * sizeof(Type)); + + return *this; + } + + bool operator==(const BigInteger& rhs) const { + return count_ == rhs.count_ && std::memcmp(digits_, rhs.digits_, count_ * sizeof(Type)) == 0; + } + + bool operator==(const Type rhs) const { + return count_ == 1 && digits_[0] == rhs; + } + + BigInteger& MultiplyPow5(unsigned exp) { + static const uint32_t kPow5[12] = { + 5, + 5 * 5, + 5 * 5 * 5, + 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5, + 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 + }; + if (exp == 0) return *this; + for (; exp >= 27; exp -= 27) *this *= RAPIDJSON_UINT64_C2(0X6765C793, 0XFA10079D); // 5^27 + for (; exp >= 13; exp -= 13) *this *= static_cast(1220703125u); // 5^13 + if (exp > 0) *this *= kPow5[exp - 1]; + return *this; + } + + // Compute absolute difference of this and rhs. + // Assume this != rhs + bool Difference(const BigInteger& rhs, BigInteger* out) const { + int cmp = Compare(rhs); + RAPIDJSON_ASSERT(cmp != 0); + const BigInteger *a, *b; // Makes a > b + bool ret; + if (cmp < 0) { a = &rhs; b = this; ret = true; } + else { a = this; b = &rhs; ret = false; } + + Type borrow = 0; + for (size_t i = 0; i < a->count_; i++) { + Type d = a->digits_[i] - borrow; + if (i < b->count_) + d -= b->digits_[i]; + borrow = (d > a->digits_[i]) ? 1 : 0; + out->digits_[i] = d; + if (d != 0) + out->count_ = i + 1; + } + + return ret; + } + + int Compare(const BigInteger& rhs) const { + if (count_ != rhs.count_) + return count_ < rhs.count_ ? -1 : 1; + + for (size_t i = count_; i-- > 0;) + if (digits_[i] != rhs.digits_[i]) + return digits_[i] < rhs.digits_[i] ? -1 : 1; + + return 0; + } + + size_t GetCount() const { return count_; } + Type GetDigit(size_t index) const { RAPIDJSON_ASSERT(index < count_); return digits_[index]; } + bool IsZero() const { return count_ == 1 && digits_[0] == 0; } + +private: + template + void AppendDecimal64(const Ch* begin, const Ch* end) { + uint64_t u = ParseUint64(begin, end); + if (IsZero()) + *this = u; + else { + unsigned exp = static_cast(end - begin); + (MultiplyPow5(exp) <<= exp) += u; // *this = *this * 10^exp + u + } + } + + void PushBack(Type digit) { + RAPIDJSON_ASSERT(count_ < kCapacity); + digits_[count_++] = digit; + } + + template + static uint64_t ParseUint64(const Ch* begin, const Ch* end) { + uint64_t r = 0; + for (const Ch* p = begin; p != end; ++p) { + RAPIDJSON_ASSERT(*p >= Ch('0') && *p <= Ch('9')); + r = r * 10u + static_cast(*p - Ch('0')); + } + return r; + } + + // Assume a * b + k < 2^128 + static uint64_t MulAdd64(uint64_t a, uint64_t b, uint64_t k, uint64_t* outHigh) { +#if defined(_MSC_VER) && defined(_M_AMD64) + uint64_t low = _umul128(a, b, outHigh) + k; + if (low < k) + (*outHigh)++; + return low; +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) + __extension__ typedef unsigned __int128 uint128; + uint128 p = static_cast(a) * static_cast(b); + p += k; + *outHigh = static_cast(p >> 64); + return static_cast(p); +#else + const uint64_t a0 = a & 0xFFFFFFFF, a1 = a >> 32, b0 = b & 0xFFFFFFFF, b1 = b >> 32; + uint64_t x0 = a0 * b0, x1 = a0 * b1, x2 = a1 * b0, x3 = a1 * b1; + x1 += (x0 >> 32); // can't give carry + x1 += x2; + if (x1 < x2) + x3 += (static_cast(1) << 32); + uint64_t lo = (x1 << 32) + (x0 & 0xFFFFFFFF); + uint64_t hi = x3 + (x1 >> 32); + + lo += k; + if (lo < k) + hi++; + *outHigh = hi; + return lo; +#endif + } + + static const size_t kBitCount = 3328; // 64bit * 54 > 10^1000 + static const size_t kCapacity = kBitCount / sizeof(Type); + static const size_t kTypeBit = sizeof(Type) * 8; + + Type digits_[kCapacity]; + size_t count_; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_BIGINTEGER_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/clzll.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/clzll.h new file mode 100644 index 0000000000000000000000000000000000000000..8fc5118aa47b8e6f3984dd64e0d32f78f5be5f04 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/clzll.h @@ -0,0 +1,71 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_CLZLL_H_ +#define RAPIDJSON_CLZLL_H_ + +#include "../rapidjson.h" + +#if defined(_MSC_VER) && !defined(UNDER_CE) +#include +#if defined(_WIN64) +#pragma intrinsic(_BitScanReverse64) +#else +#pragma intrinsic(_BitScanReverse) +#endif +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +inline uint32_t clzll(uint64_t x) { + // Passing 0 to __builtin_clzll is UB in GCC and results in an + // infinite loop in the software implementation. + RAPIDJSON_ASSERT(x != 0); + +#if defined(_MSC_VER) && !defined(UNDER_CE) + unsigned long r = 0; +#if defined(_WIN64) + _BitScanReverse64(&r, x); +#else + // Scan the high 32 bits. + if (_BitScanReverse(&r, static_cast(x >> 32))) + return 63 - (r + 32); + + // Scan the low 32 bits. + _BitScanReverse(&r, static_cast(x & 0xFFFFFFFF)); +#endif // _WIN64 + + return 63 - r; +#elif (defined(__GNUC__) && __GNUC__ >= 4) || RAPIDJSON_HAS_BUILTIN(__builtin_clzll) + // __builtin_clzll wrapper + return static_cast(__builtin_clzll(x)); +#else + // naive version + uint32_t r = 0; + while (!(x & (static_cast(1) << 63))) { + x <<= 1; + ++r; + } + + return r; +#endif // _MSC_VER +} + +#define RAPIDJSON_CLZLL RAPIDJSON_NAMESPACE::internal::clzll + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_CLZLL_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/diyfp.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/diyfp.h new file mode 100644 index 0000000000000000000000000000000000000000..1f60fb60ca04372e03cc8f22f984b568eb129207 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/diyfp.h @@ -0,0 +1,261 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +// This is a C++ header-only implementation of Grisu2 algorithm from the publication: +// Loitsch, Florian. "Printing floating-point numbers quickly and accurately with +// integers." ACM Sigplan Notices 45.6 (2010): 233-243. + +#ifndef RAPIDJSON_DIYFP_H_ +#define RAPIDJSON_DIYFP_H_ + +#include "../rapidjson.h" +#include "clzll.h" +#include + +#if defined(_MSC_VER) && defined(_M_AMD64) && !defined(__INTEL_COMPILER) +#include +#if !defined(_ARM64EC_) +#pragma intrinsic(_umul128) +#else +#pragma comment(lib,"softintrin") +#endif +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +#endif + +struct DiyFp { + DiyFp() : f(), e() {} + + DiyFp(uint64_t fp, int exp) : f(fp), e(exp) {} + + explicit DiyFp(double d) { + union { + double d; + uint64_t u64; + } u = { d }; + + int biased_e = static_cast((u.u64 & kDpExponentMask) >> kDpSignificandSize); + uint64_t significand = (u.u64 & kDpSignificandMask); + if (biased_e != 0) { + f = significand + kDpHiddenBit; + e = biased_e - kDpExponentBias; + } + else { + f = significand; + e = kDpMinExponent + 1; + } + } + + DiyFp operator-(const DiyFp& rhs) const { + return DiyFp(f - rhs.f, e); + } + + DiyFp operator*(const DiyFp& rhs) const { +#if defined(_MSC_VER) && defined(_M_AMD64) + uint64_t h; + uint64_t l = _umul128(f, rhs.f, &h); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) + __extension__ typedef unsigned __int128 uint128; + uint128 p = static_cast(f) * static_cast(rhs.f); + uint64_t h = static_cast(p >> 64); + uint64_t l = static_cast(p); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#else + const uint64_t M32 = 0xFFFFFFFF; + const uint64_t a = f >> 32; + const uint64_t b = f & M32; + const uint64_t c = rhs.f >> 32; + const uint64_t d = rhs.f & M32; + const uint64_t ac = a * c; + const uint64_t bc = b * c; + const uint64_t ad = a * d; + const uint64_t bd = b * d; + uint64_t tmp = (bd >> 32) + (ad & M32) + (bc & M32); + tmp += 1U << 31; /// mult_round + return DiyFp(ac + (ad >> 32) + (bc >> 32) + (tmp >> 32), e + rhs.e + 64); +#endif + } + + DiyFp Normalize() const { + int s = static_cast(clzll(f)); + return DiyFp(f << s, e - s); + } + + DiyFp NormalizeBoundary() const { + DiyFp res = *this; + while (!(res.f & (kDpHiddenBit << 1))) { + res.f <<= 1; + res.e--; + } + res.f <<= (kDiySignificandSize - kDpSignificandSize - 2); + res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 2); + return res; + } + + void NormalizedBoundaries(DiyFp* minus, DiyFp* plus) const { + DiyFp pl = DiyFp((f << 1) + 1, e - 1).NormalizeBoundary(); + DiyFp mi = (f == kDpHiddenBit) ? DiyFp((f << 2) - 1, e - 2) : DiyFp((f << 1) - 1, e - 1); + mi.f <<= mi.e - pl.e; + mi.e = pl.e; + *plus = pl; + *minus = mi; + } + + double ToDouble() const { + union { + double d; + uint64_t u64; + }u; + RAPIDJSON_ASSERT(f <= kDpHiddenBit + kDpSignificandMask); + if (e < kDpDenormalExponent) { + // Underflow. + return 0.0; + } + if (e >= kDpMaxExponent) { + // Overflow. + return std::numeric_limits::infinity(); + } + const uint64_t be = (e == kDpDenormalExponent && (f & kDpHiddenBit) == 0) ? 0 : + static_cast(e + kDpExponentBias); + u.u64 = (f & kDpSignificandMask) | (be << kDpSignificandSize); + return u.d; + } + + static const int kDiySignificandSize = 64; + static const int kDpSignificandSize = 52; + static const int kDpExponentBias = 0x3FF + kDpSignificandSize; + static const int kDpMaxExponent = 0x7FF - kDpExponentBias; + static const int kDpMinExponent = -kDpExponentBias; + static const int kDpDenormalExponent = -kDpExponentBias + 1; + static const uint64_t kDpExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000); + static const uint64_t kDpSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF); + static const uint64_t kDpHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000); + + uint64_t f; + int e; +}; + +inline DiyFp GetCachedPowerByIndex(size_t index) { + // 10^-348, 10^-340, ..., 10^340 + static const uint64_t kCachedPowers_F[] = { + RAPIDJSON_UINT64_C2(0xfa8fd5a0, 0x081c0288), RAPIDJSON_UINT64_C2(0xbaaee17f, 0xa23ebf76), + RAPIDJSON_UINT64_C2(0x8b16fb20, 0x3055ac76), RAPIDJSON_UINT64_C2(0xcf42894a, 0x5dce35ea), + RAPIDJSON_UINT64_C2(0x9a6bb0aa, 0x55653b2d), RAPIDJSON_UINT64_C2(0xe61acf03, 0x3d1a45df), + RAPIDJSON_UINT64_C2(0xab70fe17, 0xc79ac6ca), RAPIDJSON_UINT64_C2(0xff77b1fc, 0xbebcdc4f), + RAPIDJSON_UINT64_C2(0xbe5691ef, 0x416bd60c), RAPIDJSON_UINT64_C2(0x8dd01fad, 0x907ffc3c), + RAPIDJSON_UINT64_C2(0xd3515c28, 0x31559a83), RAPIDJSON_UINT64_C2(0x9d71ac8f, 0xada6c9b5), + RAPIDJSON_UINT64_C2(0xea9c2277, 0x23ee8bcb), RAPIDJSON_UINT64_C2(0xaecc4991, 0x4078536d), + RAPIDJSON_UINT64_C2(0x823c1279, 0x5db6ce57), RAPIDJSON_UINT64_C2(0xc2109436, 0x4dfb5637), + RAPIDJSON_UINT64_C2(0x9096ea6f, 0x3848984f), RAPIDJSON_UINT64_C2(0xd77485cb, 0x25823ac7), + RAPIDJSON_UINT64_C2(0xa086cfcd, 0x97bf97f4), RAPIDJSON_UINT64_C2(0xef340a98, 0x172aace5), + RAPIDJSON_UINT64_C2(0xb23867fb, 0x2a35b28e), RAPIDJSON_UINT64_C2(0x84c8d4df, 0xd2c63f3b), + RAPIDJSON_UINT64_C2(0xc5dd4427, 0x1ad3cdba), RAPIDJSON_UINT64_C2(0x936b9fce, 0xbb25c996), + RAPIDJSON_UINT64_C2(0xdbac6c24, 0x7d62a584), RAPIDJSON_UINT64_C2(0xa3ab6658, 0x0d5fdaf6), + RAPIDJSON_UINT64_C2(0xf3e2f893, 0xdec3f126), RAPIDJSON_UINT64_C2(0xb5b5ada8, 0xaaff80b8), + RAPIDJSON_UINT64_C2(0x87625f05, 0x6c7c4a8b), RAPIDJSON_UINT64_C2(0xc9bcff60, 0x34c13053), + RAPIDJSON_UINT64_C2(0x964e858c, 0x91ba2655), RAPIDJSON_UINT64_C2(0xdff97724, 0x70297ebd), + RAPIDJSON_UINT64_C2(0xa6dfbd9f, 0xb8e5b88f), RAPIDJSON_UINT64_C2(0xf8a95fcf, 0x88747d94), + RAPIDJSON_UINT64_C2(0xb9447093, 0x8fa89bcf), RAPIDJSON_UINT64_C2(0x8a08f0f8, 0xbf0f156b), + RAPIDJSON_UINT64_C2(0xcdb02555, 0x653131b6), RAPIDJSON_UINT64_C2(0x993fe2c6, 0xd07b7fac), + RAPIDJSON_UINT64_C2(0xe45c10c4, 0x2a2b3b06), RAPIDJSON_UINT64_C2(0xaa242499, 0x697392d3), + RAPIDJSON_UINT64_C2(0xfd87b5f2, 0x8300ca0e), RAPIDJSON_UINT64_C2(0xbce50864, 0x92111aeb), + RAPIDJSON_UINT64_C2(0x8cbccc09, 0x6f5088cc), RAPIDJSON_UINT64_C2(0xd1b71758, 0xe219652c), + RAPIDJSON_UINT64_C2(0x9c400000, 0x00000000), RAPIDJSON_UINT64_C2(0xe8d4a510, 0x00000000), + RAPIDJSON_UINT64_C2(0xad78ebc5, 0xac620000), RAPIDJSON_UINT64_C2(0x813f3978, 0xf8940984), + RAPIDJSON_UINT64_C2(0xc097ce7b, 0xc90715b3), RAPIDJSON_UINT64_C2(0x8f7e32ce, 0x7bea5c70), + RAPIDJSON_UINT64_C2(0xd5d238a4, 0xabe98068), RAPIDJSON_UINT64_C2(0x9f4f2726, 0x179a2245), + RAPIDJSON_UINT64_C2(0xed63a231, 0xd4c4fb27), RAPIDJSON_UINT64_C2(0xb0de6538, 0x8cc8ada8), + RAPIDJSON_UINT64_C2(0x83c7088e, 0x1aab65db), RAPIDJSON_UINT64_C2(0xc45d1df9, 0x42711d9a), + RAPIDJSON_UINT64_C2(0x924d692c, 0xa61be758), RAPIDJSON_UINT64_C2(0xda01ee64, 0x1a708dea), + RAPIDJSON_UINT64_C2(0xa26da399, 0x9aef774a), RAPIDJSON_UINT64_C2(0xf209787b, 0xb47d6b85), + RAPIDJSON_UINT64_C2(0xb454e4a1, 0x79dd1877), RAPIDJSON_UINT64_C2(0x865b8692, 0x5b9bc5c2), + RAPIDJSON_UINT64_C2(0xc83553c5, 0xc8965d3d), RAPIDJSON_UINT64_C2(0x952ab45c, 0xfa97a0b3), + RAPIDJSON_UINT64_C2(0xde469fbd, 0x99a05fe3), RAPIDJSON_UINT64_C2(0xa59bc234, 0xdb398c25), + RAPIDJSON_UINT64_C2(0xf6c69a72, 0xa3989f5c), RAPIDJSON_UINT64_C2(0xb7dcbf53, 0x54e9bece), + RAPIDJSON_UINT64_C2(0x88fcf317, 0xf22241e2), RAPIDJSON_UINT64_C2(0xcc20ce9b, 0xd35c78a5), + RAPIDJSON_UINT64_C2(0x98165af3, 0x7b2153df), RAPIDJSON_UINT64_C2(0xe2a0b5dc, 0x971f303a), + RAPIDJSON_UINT64_C2(0xa8d9d153, 0x5ce3b396), RAPIDJSON_UINT64_C2(0xfb9b7cd9, 0xa4a7443c), + RAPIDJSON_UINT64_C2(0xbb764c4c, 0xa7a44410), RAPIDJSON_UINT64_C2(0x8bab8eef, 0xb6409c1a), + RAPIDJSON_UINT64_C2(0xd01fef10, 0xa657842c), RAPIDJSON_UINT64_C2(0x9b10a4e5, 0xe9913129), + RAPIDJSON_UINT64_C2(0xe7109bfb, 0xa19c0c9d), RAPIDJSON_UINT64_C2(0xac2820d9, 0x623bf429), + RAPIDJSON_UINT64_C2(0x80444b5e, 0x7aa7cf85), RAPIDJSON_UINT64_C2(0xbf21e440, 0x03acdd2d), + RAPIDJSON_UINT64_C2(0x8e679c2f, 0x5e44ff8f), RAPIDJSON_UINT64_C2(0xd433179d, 0x9c8cb841), + RAPIDJSON_UINT64_C2(0x9e19db92, 0xb4e31ba9), RAPIDJSON_UINT64_C2(0xeb96bf6e, 0xbadf77d9), + RAPIDJSON_UINT64_C2(0xaf87023b, 0x9bf0ee6b) + }; + static const int16_t kCachedPowers_E[] = { + -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, + -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, + -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, + -422, -396, -369, -343, -316, -289, -263, -236, -210, -183, + -157, -130, -103, -77, -50, -24, 3, 30, 56, 83, + 109, 136, 162, 189, 216, 242, 269, 295, 322, 348, + 375, 402, 428, 455, 481, 508, 534, 561, 588, 614, + 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, + 907, 933, 960, 986, 1013, 1039, 1066 + }; + RAPIDJSON_ASSERT(index < 87); + return DiyFp(kCachedPowers_F[index], kCachedPowers_E[index]); +} + +inline DiyFp GetCachedPower(int e, int* K) { + + //int k = static_cast(ceil((-61 - e) * 0.30102999566398114)) + 374; + double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive + int k = static_cast(dk); + if (dk - k > 0.0) + k++; + + unsigned index = static_cast((k >> 3) + 1); + *K = -(-348 + static_cast(index << 3)); // decimal exponent no need lookup table + + return GetCachedPowerByIndex(index); +} + +inline DiyFp GetCachedPower10(int exp, int *outExp) { + RAPIDJSON_ASSERT(exp >= -348); + unsigned index = static_cast(exp + 348) / 8u; + *outExp = -348 + static_cast(index) * 8; + return GetCachedPowerByIndex(index); +} + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#ifdef __clang__ +RAPIDJSON_DIAG_POP +RAPIDJSON_DIAG_OFF(padded) +#endif + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_DIYFP_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/dtoa.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/dtoa.h new file mode 100644 index 0000000000000000000000000000000000000000..cd456721a71c03209a985502909dac5bf0cd08cf --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/dtoa.h @@ -0,0 +1,249 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +// This is a C++ header-only implementation of Grisu2 algorithm from the publication: +// Loitsch, Florian. "Printing floating-point numbers quickly and accurately with +// integers." ACM Sigplan Notices 45.6 (2010): 233-243. + +#ifndef RAPIDJSON_DTOA_ +#define RAPIDJSON_DTOA_ + +#include "itoa.h" // GetDigitsLut() +#include "diyfp.h" +#include "ieee754.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +RAPIDJSON_DIAG_OFF(array-bounds) // some gcc versions generate wrong warnings https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 +#endif + +inline void GrisuRound(char* buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) { + while (rest < wp_w && delta - rest >= ten_kappa && + (rest + ten_kappa < wp_w || /// closer + wp_w - rest > rest + ten_kappa - wp_w)) { + buffer[len - 1]--; + rest += ten_kappa; + } +} + +inline int CountDecimalDigit32(uint32_t n) { + // Simple pure C++ implementation was faster than __builtin_clz version in this situation. + if (n < 10) return 1; + if (n < 100) return 2; + if (n < 1000) return 3; + if (n < 10000) return 4; + if (n < 100000) return 5; + if (n < 1000000) return 6; + if (n < 10000000) return 7; + if (n < 100000000) return 8; + // Will not reach 10 digits in DigitGen() + //if (n < 1000000000) return 9; + //return 10; + return 9; +} + +inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) { + static const uint64_t kPow10[] = { 1ULL, 10ULL, 100ULL, 1000ULL, 10000ULL, 100000ULL, 1000000ULL, 10000000ULL, 100000000ULL, + 1000000000ULL, 10000000000ULL, 100000000000ULL, 1000000000000ULL, + 10000000000000ULL, 100000000000000ULL, 1000000000000000ULL, + 10000000000000000ULL, 100000000000000000ULL, 1000000000000000000ULL, + 10000000000000000000ULL }; + const DiyFp one(uint64_t(1) << -Mp.e, Mp.e); + const DiyFp wp_w = Mp - W; + uint32_t p1 = static_cast(Mp.f >> -one.e); + uint64_t p2 = Mp.f & (one.f - 1); + int kappa = CountDecimalDigit32(p1); // kappa in [0, 9] + *len = 0; + + while (kappa > 0) { + uint32_t d = 0; + switch (kappa) { + case 9: d = p1 / 100000000; p1 %= 100000000; break; + case 8: d = p1 / 10000000; p1 %= 10000000; break; + case 7: d = p1 / 1000000; p1 %= 1000000; break; + case 6: d = p1 / 100000; p1 %= 100000; break; + case 5: d = p1 / 10000; p1 %= 10000; break; + case 4: d = p1 / 1000; p1 %= 1000; break; + case 3: d = p1 / 100; p1 %= 100; break; + case 2: d = p1 / 10; p1 %= 10; break; + case 1: d = p1; p1 = 0; break; + default:; + } + if (d || *len) + buffer[(*len)++] = static_cast('0' + static_cast(d)); + kappa--; + uint64_t tmp = (static_cast(p1) << -one.e) + p2; + if (tmp <= delta) { + *K += kappa; + GrisuRound(buffer, *len, delta, tmp, kPow10[kappa] << -one.e, wp_w.f); + return; + } + } + + // kappa = 0 + for (;;) { + p2 *= 10; + delta *= 10; + char d = static_cast(p2 >> -one.e); + if (d || *len) + buffer[(*len)++] = static_cast('0' + d); + p2 &= one.f - 1; + kappa--; + if (p2 < delta) { + *K += kappa; + int index = -kappa; + GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 20 ? kPow10[index] : 0)); + return; + } + } +} + +inline void Grisu2(double value, char* buffer, int* length, int* K) { + const DiyFp v(value); + DiyFp w_m, w_p; + v.NormalizedBoundaries(&w_m, &w_p); + + const DiyFp c_mk = GetCachedPower(w_p.e, K); + const DiyFp W = v.Normalize() * c_mk; + DiyFp Wp = w_p * c_mk; + DiyFp Wm = w_m * c_mk; + Wm.f++; + Wp.f--; + DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K); +} + +inline char* WriteExponent(int K, char* buffer) { + if (K < 0) { + *buffer++ = '-'; + K = -K; + } + + if (K >= 100) { + *buffer++ = static_cast('0' + static_cast(K / 100)); + K %= 100; + const char* d = GetDigitsLut() + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else if (K >= 10) { + const char* d = GetDigitsLut() + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else + *buffer++ = static_cast('0' + static_cast(K)); + + return buffer; +} + +inline char* Prettify(char* buffer, int length, int k, int maxDecimalPlaces) { + const int kk = length + k; // 10^(kk-1) <= v < 10^kk + + if (0 <= k && kk <= 21) { + // 1234e7 -> 12340000000 + for (int i = length; i < kk; i++) + buffer[i] = '0'; + buffer[kk] = '.'; + buffer[kk + 1] = '0'; + return &buffer[kk + 2]; + } + else if (0 < kk && kk <= 21) { + // 1234e-2 -> 12.34 + std::memmove(&buffer[kk + 1], &buffer[kk], static_cast(length - kk)); + buffer[kk] = '.'; + if (0 > k + maxDecimalPlaces) { + // When maxDecimalPlaces = 2, 1.2345 -> 1.23, 1.102 -> 1.1 + // Remove extra trailing zeros (at least one) after truncation. + for (int i = kk + maxDecimalPlaces; i > kk + 1; i--) + if (buffer[i] != '0') + return &buffer[i + 1]; + return &buffer[kk + 2]; // Reserve one zero + } + else + return &buffer[length + 1]; + } + else if (-6 < kk && kk <= 0) { + // 1234e-6 -> 0.001234 + const int offset = 2 - kk; + std::memmove(&buffer[offset], &buffer[0], static_cast(length)); + buffer[0] = '0'; + buffer[1] = '.'; + for (int i = 2; i < offset; i++) + buffer[i] = '0'; + if (length - kk > maxDecimalPlaces) { + // When maxDecimalPlaces = 2, 0.123 -> 0.12, 0.102 -> 0.1 + // Remove extra trailing zeros (at least one) after truncation. + for (int i = maxDecimalPlaces + 1; i > 2; i--) + if (buffer[i] != '0') + return &buffer[i + 1]; + return &buffer[3]; // Reserve one zero + } + else + return &buffer[length + offset]; + } + else if (kk < -maxDecimalPlaces) { + // Truncate to zero + buffer[0] = '0'; + buffer[1] = '.'; + buffer[2] = '0'; + return &buffer[3]; + } + else if (length == 1) { + // 1e30 + buffer[1] = 'e'; + return WriteExponent(kk - 1, &buffer[2]); + } + else { + // 1234e30 -> 1.234e33 + std::memmove(&buffer[2], &buffer[1], static_cast(length - 1)); + buffer[1] = '.'; + buffer[length + 1] = 'e'; + return WriteExponent(kk - 1, &buffer[0 + length + 2]); + } +} + +inline char* dtoa(double value, char* buffer, int maxDecimalPlaces = 324) { + RAPIDJSON_ASSERT(maxDecimalPlaces >= 1); + Double d(value); + if (d.IsZero()) { + if (d.Sign()) + *buffer++ = '-'; // -0.0, Issue #289 + buffer[0] = '0'; + buffer[1] = '.'; + buffer[2] = '0'; + return &buffer[3]; + } + else { + if (value < 0) { + *buffer++ = '-'; + value = -value; + } + int length, K; + Grisu2(value, buffer, &length, &K); + return Prettify(buffer, length, K, maxDecimalPlaces); + } +} + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_DTOA_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/ieee754.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/ieee754.h new file mode 100644 index 0000000000000000000000000000000000000000..68c9e96649b8aa5323fb06480da7cfad84bb2485 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/ieee754.h @@ -0,0 +1,78 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_IEEE754_ +#define RAPIDJSON_IEEE754_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +class Double { +public: + Double() {} + Double(double d) : d_(d) {} + Double(uint64_t u) : u_(u) {} + + double Value() const { return d_; } + uint64_t Uint64Value() const { return u_; } + + double NextPositiveDouble() const { + RAPIDJSON_ASSERT(!Sign()); + return Double(u_ + 1).Value(); + } + + bool Sign() const { return (u_ & kSignMask) != 0; } + uint64_t Significand() const { return u_ & kSignificandMask; } + int Exponent() const { return static_cast(((u_ & kExponentMask) >> kSignificandSize) - kExponentBias); } + + bool IsNan() const { return (u_ & kExponentMask) == kExponentMask && Significand() != 0; } + bool IsInf() const { return (u_ & kExponentMask) == kExponentMask && Significand() == 0; } + bool IsNanOrInf() const { return (u_ & kExponentMask) == kExponentMask; } + bool IsNormal() const { return (u_ & kExponentMask) != 0 || Significand() == 0; } + bool IsZero() const { return (u_ & (kExponentMask | kSignificandMask)) == 0; } + + uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kHiddenBit : Significand(); } + int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; } + uint64_t ToBias() const { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask; } + + static int EffectiveSignificandSize(int order) { + if (order >= -1021) + return 53; + else if (order <= -1074) + return 0; + else + return order + 1074; + } + +private: + static const int kSignificandSize = 52; + static const int kExponentBias = 0x3FF; + static const int kDenormalExponent = 1 - kExponentBias; + static const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000); + static const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x00000000); + static const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xFFFFFFFF); + static const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x00000000); + + union { + double d_; + uint64_t u_; + }; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_IEEE754_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/itoa.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/itoa.h new file mode 100644 index 0000000000000000000000000000000000000000..9fe8c932ffa6d03ac8926574b842abb0a191eab8 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/itoa.h @@ -0,0 +1,308 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_ITOA_ +#define RAPIDJSON_ITOA_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +inline const char* GetDigitsLut() { + static const char cDigitsLut[200] = { + '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9', + '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9', + '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9', + '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9', + '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9', + '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9', + '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9', + '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9', + '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9', + '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9' + }; + return cDigitsLut; +} + +inline char* u32toa(uint32_t value, char* buffer) { + RAPIDJSON_ASSERT(buffer != 0); + + const char* cDigitsLut = GetDigitsLut(); + + if (value < 10000) { + const uint32_t d1 = (value / 100) << 1; + const uint32_t d2 = (value % 100) << 1; + + if (value >= 1000) + *buffer++ = cDigitsLut[d1]; + if (value >= 100) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 10) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + } + else if (value < 100000000) { + // value = bbbbcccc + const uint32_t b = value / 10000; + const uint32_t c = value % 10000; + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + if (value >= 10000000) + *buffer++ = cDigitsLut[d1]; + if (value >= 1000000) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 100000) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + else { + // value = aabbbbcccc in decimal + + const uint32_t a = value / 100000000; // 1 to 42 + value %= 100000000; + + if (a >= 10) { + const unsigned i = a << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else + *buffer++ = static_cast('0' + static_cast(a)); + + const uint32_t b = value / 10000; // 0 to 9999 + const uint32_t c = value % 10000; // 0 to 9999 + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + *buffer++ = cDigitsLut[d1]; + *buffer++ = cDigitsLut[d1 + 1]; + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + return buffer; +} + +inline char* i32toa(int32_t value, char* buffer) { + RAPIDJSON_ASSERT(buffer != 0); + uint32_t u = static_cast(value); + if (value < 0) { + *buffer++ = '-'; + u = ~u + 1; + } + + return u32toa(u, buffer); +} + +inline char* u64toa(uint64_t value, char* buffer) { + RAPIDJSON_ASSERT(buffer != 0); + const char* cDigitsLut = GetDigitsLut(); + const uint64_t kTen8 = 100000000; + const uint64_t kTen9 = kTen8 * 10; + const uint64_t kTen10 = kTen8 * 100; + const uint64_t kTen11 = kTen8 * 1000; + const uint64_t kTen12 = kTen8 * 10000; + const uint64_t kTen13 = kTen8 * 100000; + const uint64_t kTen14 = kTen8 * 1000000; + const uint64_t kTen15 = kTen8 * 10000000; + const uint64_t kTen16 = kTen8 * kTen8; + + if (value < kTen8) { + uint32_t v = static_cast(value); + if (v < 10000) { + const uint32_t d1 = (v / 100) << 1; + const uint32_t d2 = (v % 100) << 1; + + if (v >= 1000) + *buffer++ = cDigitsLut[d1]; + if (v >= 100) + *buffer++ = cDigitsLut[d1 + 1]; + if (v >= 10) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + } + else { + // value = bbbbcccc + const uint32_t b = v / 10000; + const uint32_t c = v % 10000; + + const uint32_t d1 = (b / 100) << 1; + const uint32_t d2 = (b % 100) << 1; + + const uint32_t d3 = (c / 100) << 1; + const uint32_t d4 = (c % 100) << 1; + + if (value >= 10000000) + *buffer++ = cDigitsLut[d1]; + if (value >= 1000000) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= 100000) + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + } + } + else if (value < kTen16) { + const uint32_t v0 = static_cast(value / kTen8); + const uint32_t v1 = static_cast(value % kTen8); + + const uint32_t b0 = v0 / 10000; + const uint32_t c0 = v0 % 10000; + + const uint32_t d1 = (b0 / 100) << 1; + const uint32_t d2 = (b0 % 100) << 1; + + const uint32_t d3 = (c0 / 100) << 1; + const uint32_t d4 = (c0 % 100) << 1; + + const uint32_t b1 = v1 / 10000; + const uint32_t c1 = v1 % 10000; + + const uint32_t d5 = (b1 / 100) << 1; + const uint32_t d6 = (b1 % 100) << 1; + + const uint32_t d7 = (c1 / 100) << 1; + const uint32_t d8 = (c1 % 100) << 1; + + if (value >= kTen15) + *buffer++ = cDigitsLut[d1]; + if (value >= kTen14) + *buffer++ = cDigitsLut[d1 + 1]; + if (value >= kTen13) + *buffer++ = cDigitsLut[d2]; + if (value >= kTen12) + *buffer++ = cDigitsLut[d2 + 1]; + if (value >= kTen11) + *buffer++ = cDigitsLut[d3]; + if (value >= kTen10) + *buffer++ = cDigitsLut[d3 + 1]; + if (value >= kTen9) + *buffer++ = cDigitsLut[d4]; + + *buffer++ = cDigitsLut[d4 + 1]; + *buffer++ = cDigitsLut[d5]; + *buffer++ = cDigitsLut[d5 + 1]; + *buffer++ = cDigitsLut[d6]; + *buffer++ = cDigitsLut[d6 + 1]; + *buffer++ = cDigitsLut[d7]; + *buffer++ = cDigitsLut[d7 + 1]; + *buffer++ = cDigitsLut[d8]; + *buffer++ = cDigitsLut[d8 + 1]; + } + else { + const uint32_t a = static_cast(value / kTen16); // 1 to 1844 + value %= kTen16; + + if (a < 10) + *buffer++ = static_cast('0' + static_cast(a)); + else if (a < 100) { + const uint32_t i = a << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else if (a < 1000) { + *buffer++ = static_cast('0' + static_cast(a / 100)); + + const uint32_t i = (a % 100) << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + } + else { + const uint32_t i = (a / 100) << 1; + const uint32_t j = (a % 100) << 1; + *buffer++ = cDigitsLut[i]; + *buffer++ = cDigitsLut[i + 1]; + *buffer++ = cDigitsLut[j]; + *buffer++ = cDigitsLut[j + 1]; + } + + const uint32_t v0 = static_cast(value / kTen8); + const uint32_t v1 = static_cast(value % kTen8); + + const uint32_t b0 = v0 / 10000; + const uint32_t c0 = v0 % 10000; + + const uint32_t d1 = (b0 / 100) << 1; + const uint32_t d2 = (b0 % 100) << 1; + + const uint32_t d3 = (c0 / 100) << 1; + const uint32_t d4 = (c0 % 100) << 1; + + const uint32_t b1 = v1 / 10000; + const uint32_t c1 = v1 % 10000; + + const uint32_t d5 = (b1 / 100) << 1; + const uint32_t d6 = (b1 % 100) << 1; + + const uint32_t d7 = (c1 / 100) << 1; + const uint32_t d8 = (c1 % 100) << 1; + + *buffer++ = cDigitsLut[d1]; + *buffer++ = cDigitsLut[d1 + 1]; + *buffer++ = cDigitsLut[d2]; + *buffer++ = cDigitsLut[d2 + 1]; + *buffer++ = cDigitsLut[d3]; + *buffer++ = cDigitsLut[d3 + 1]; + *buffer++ = cDigitsLut[d4]; + *buffer++ = cDigitsLut[d4 + 1]; + *buffer++ = cDigitsLut[d5]; + *buffer++ = cDigitsLut[d5 + 1]; + *buffer++ = cDigitsLut[d6]; + *buffer++ = cDigitsLut[d6 + 1]; + *buffer++ = cDigitsLut[d7]; + *buffer++ = cDigitsLut[d7 + 1]; + *buffer++ = cDigitsLut[d8]; + *buffer++ = cDigitsLut[d8 + 1]; + } + + return buffer; +} + +inline char* i64toa(int64_t value, char* buffer) { + RAPIDJSON_ASSERT(buffer != 0); + uint64_t u = static_cast(value); + if (value < 0) { + *buffer++ = '-'; + u = ~u + 1; + } + + return u64toa(u, buffer); +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_ITOA_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/meta.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/meta.h new file mode 100644 index 0000000000000000000000000000000000000000..27092dc0d69c43e5601632170a5812c9abb3b8c6 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/meta.h @@ -0,0 +1,186 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_META_H_ +#define RAPIDJSON_INTERNAL_META_H_ + +#include "../rapidjson.h" + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#if defined(_MSC_VER) && !defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(6334) +#endif + +#if RAPIDJSON_HAS_CXX11_TYPETRAITS +#include +#endif + +//@cond RAPIDJSON_INTERNAL +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +// Helper to wrap/convert arbitrary types to void, useful for arbitrary type matching +template struct Void { typedef void Type; }; + +/////////////////////////////////////////////////////////////////////////////// +// BoolType, TrueType, FalseType +// +template struct BoolType { + static const bool Value = Cond; + typedef BoolType Type; +}; +typedef BoolType TrueType; +typedef BoolType FalseType; + + +/////////////////////////////////////////////////////////////////////////////// +// SelectIf, BoolExpr, NotExpr, AndExpr, OrExpr +// + +template struct SelectIfImpl { template struct Apply { typedef T1 Type; }; }; +template <> struct SelectIfImpl { template struct Apply { typedef T2 Type; }; }; +template struct SelectIfCond : SelectIfImpl::template Apply {}; +template struct SelectIf : SelectIfCond {}; + +template struct AndExprCond : FalseType {}; +template <> struct AndExprCond : TrueType {}; +template struct OrExprCond : TrueType {}; +template <> struct OrExprCond : FalseType {}; + +template struct BoolExpr : SelectIf::Type {}; +template struct NotExpr : SelectIf::Type {}; +template struct AndExpr : AndExprCond::Type {}; +template struct OrExpr : OrExprCond::Type {}; + + +/////////////////////////////////////////////////////////////////////////////// +// AddConst, MaybeAddConst, RemoveConst +template struct AddConst { typedef const T Type; }; +template struct MaybeAddConst : SelectIfCond {}; +template struct RemoveConst { typedef T Type; }; +template struct RemoveConst { typedef T Type; }; + + +/////////////////////////////////////////////////////////////////////////////// +// IsSame, IsConst, IsMoreConst, IsPointer +// +template struct IsSame : FalseType {}; +template struct IsSame : TrueType {}; + +template struct IsConst : FalseType {}; +template struct IsConst : TrueType {}; + +template +struct IsMoreConst + : AndExpr::Type, typename RemoveConst::Type>, + BoolType::Value >= IsConst::Value> >::Type {}; + +template struct IsPointer : FalseType {}; +template struct IsPointer : TrueType {}; + +/////////////////////////////////////////////////////////////////////////////// +// IsBaseOf +// +#if RAPIDJSON_HAS_CXX11_TYPETRAITS + +template struct IsBaseOf + : BoolType< ::std::is_base_of::value> {}; + +#else // simplified version adopted from Boost + +template struct IsBaseOfImpl { + RAPIDJSON_STATIC_ASSERT(sizeof(B) != 0); + RAPIDJSON_STATIC_ASSERT(sizeof(D) != 0); + + typedef char (&Yes)[1]; + typedef char (&No) [2]; + + template + static Yes Check(const D*, T); + static No Check(const B*, int); + + struct Host { + operator const B*() const; + operator const D*(); + }; + + enum { Value = (sizeof(Check(Host(), 0)) == sizeof(Yes)) }; +}; + +template struct IsBaseOf + : OrExpr, BoolExpr > >::Type {}; + +#endif // RAPIDJSON_HAS_CXX11_TYPETRAITS + + +////////////////////////////////////////////////////////////////////////// +// EnableIf / DisableIf +// +template struct EnableIfCond { typedef T Type; }; +template struct EnableIfCond { /* empty */ }; + +template struct DisableIfCond { typedef T Type; }; +template struct DisableIfCond { /* empty */ }; + +template +struct EnableIf : EnableIfCond {}; + +template +struct DisableIf : DisableIfCond {}; + +// SFINAE helpers +struct SfinaeTag {}; +template struct RemoveSfinaeTag; +template struct RemoveSfinaeTag { typedef T Type; }; + +#define RAPIDJSON_REMOVEFPTR_(type) \ + typename ::RAPIDJSON_NAMESPACE::internal::RemoveSfinaeTag \ + < ::RAPIDJSON_NAMESPACE::internal::SfinaeTag&(*) type>::Type + +#define RAPIDJSON_ENABLEIF(cond) \ + typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ + ::Type * = NULL + +#define RAPIDJSON_DISABLEIF(cond) \ + typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ + ::Type * = NULL + +#define RAPIDJSON_ENABLEIF_RETURN(cond,returntype) \ + typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ + ::Type + +#define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \ + typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ + ::Type + +} // namespace internal +RAPIDJSON_NAMESPACE_END +//@endcond + +#if defined(_MSC_VER) && !defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_META_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/pow10.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/pow10.h new file mode 100644 index 0000000000000000000000000000000000000000..eae1a43ed1a06d980b9dc58f155c9c999f2ee58b --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/pow10.h @@ -0,0 +1,55 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_POW10_ +#define RAPIDJSON_POW10_ + +#include "../rapidjson.h" + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Computes integer powers of 10 in double (10.0^n). +/*! This function uses lookup table for fast and accurate results. + \param n non-negative exponent. Must <= 308. + \return 10.0^n +*/ +inline double Pow10(int n) { + static const double e[] = { // 1e-0...1e308: 309 * 8 bytes = 2472 bytes + 1e+0, + 1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, + 1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31, 1e+32, 1e+33, 1e+34, 1e+35, 1e+36, 1e+37, 1e+38, 1e+39, 1e+40, + 1e+41, 1e+42, 1e+43, 1e+44, 1e+45, 1e+46, 1e+47, 1e+48, 1e+49, 1e+50, 1e+51, 1e+52, 1e+53, 1e+54, 1e+55, 1e+56, 1e+57, 1e+58, 1e+59, 1e+60, + 1e+61, 1e+62, 1e+63, 1e+64, 1e+65, 1e+66, 1e+67, 1e+68, 1e+69, 1e+70, 1e+71, 1e+72, 1e+73, 1e+74, 1e+75, 1e+76, 1e+77, 1e+78, 1e+79, 1e+80, + 1e+81, 1e+82, 1e+83, 1e+84, 1e+85, 1e+86, 1e+87, 1e+88, 1e+89, 1e+90, 1e+91, 1e+92, 1e+93, 1e+94, 1e+95, 1e+96, 1e+97, 1e+98, 1e+99, 1e+100, + 1e+101,1e+102,1e+103,1e+104,1e+105,1e+106,1e+107,1e+108,1e+109,1e+110,1e+111,1e+112,1e+113,1e+114,1e+115,1e+116,1e+117,1e+118,1e+119,1e+120, + 1e+121,1e+122,1e+123,1e+124,1e+125,1e+126,1e+127,1e+128,1e+129,1e+130,1e+131,1e+132,1e+133,1e+134,1e+135,1e+136,1e+137,1e+138,1e+139,1e+140, + 1e+141,1e+142,1e+143,1e+144,1e+145,1e+146,1e+147,1e+148,1e+149,1e+150,1e+151,1e+152,1e+153,1e+154,1e+155,1e+156,1e+157,1e+158,1e+159,1e+160, + 1e+161,1e+162,1e+163,1e+164,1e+165,1e+166,1e+167,1e+168,1e+169,1e+170,1e+171,1e+172,1e+173,1e+174,1e+175,1e+176,1e+177,1e+178,1e+179,1e+180, + 1e+181,1e+182,1e+183,1e+184,1e+185,1e+186,1e+187,1e+188,1e+189,1e+190,1e+191,1e+192,1e+193,1e+194,1e+195,1e+196,1e+197,1e+198,1e+199,1e+200, + 1e+201,1e+202,1e+203,1e+204,1e+205,1e+206,1e+207,1e+208,1e+209,1e+210,1e+211,1e+212,1e+213,1e+214,1e+215,1e+216,1e+217,1e+218,1e+219,1e+220, + 1e+221,1e+222,1e+223,1e+224,1e+225,1e+226,1e+227,1e+228,1e+229,1e+230,1e+231,1e+232,1e+233,1e+234,1e+235,1e+236,1e+237,1e+238,1e+239,1e+240, + 1e+241,1e+242,1e+243,1e+244,1e+245,1e+246,1e+247,1e+248,1e+249,1e+250,1e+251,1e+252,1e+253,1e+254,1e+255,1e+256,1e+257,1e+258,1e+259,1e+260, + 1e+261,1e+262,1e+263,1e+264,1e+265,1e+266,1e+267,1e+268,1e+269,1e+270,1e+271,1e+272,1e+273,1e+274,1e+275,1e+276,1e+277,1e+278,1e+279,1e+280, + 1e+281,1e+282,1e+283,1e+284,1e+285,1e+286,1e+287,1e+288,1e+289,1e+290,1e+291,1e+292,1e+293,1e+294,1e+295,1e+296,1e+297,1e+298,1e+299,1e+300, + 1e+301,1e+302,1e+303,1e+304,1e+305,1e+306,1e+307,1e+308 + }; + RAPIDJSON_ASSERT(n >= 0 && n <= 308); + return e[n]; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_POW10_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/regex.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/regex.h new file mode 100644 index 0000000000000000000000000000000000000000..7740dcd527bad2cf8fe719db1f5fbf732e5aa228 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/regex.h @@ -0,0 +1,739 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_REGEX_H_ +#define RAPIDJSON_INTERNAL_REGEX_H_ + +#include "../allocators.h" +#include "../stream.h" +#include "stack.h" + +#ifdef __clang__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(padded) +RAPIDJSON_DIAG_OFF(switch-enum) +#elif defined(_MSC_VER) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + +#ifdef __GNUC__ +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(effc++) +#endif + +#ifndef RAPIDJSON_REGEX_VERBOSE +#define RAPIDJSON_REGEX_VERBOSE 0 +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +/////////////////////////////////////////////////////////////////////////////// +// DecodedStream + +template +class DecodedStream { +public: + DecodedStream(SourceStream& ss) : ss_(ss), codepoint_() { Decode(); } + unsigned Peek() { return codepoint_; } + unsigned Take() { + unsigned c = codepoint_; + if (c) // No further decoding when '\0' + Decode(); + return c; + } + +private: + void Decode() { + if (!Encoding::Decode(ss_, &codepoint_)) + codepoint_ = 0; + } + + SourceStream& ss_; + unsigned codepoint_; +}; + +/////////////////////////////////////////////////////////////////////////////// +// GenericRegex + +static const SizeType kRegexInvalidState = ~SizeType(0); //!< Represents an invalid index in GenericRegex::State::out, out1 +static const SizeType kRegexInvalidRange = ~SizeType(0); + +template +class GenericRegexSearch; + +//! Regular expression engine with subset of ECMAscript grammar. +/*! + Supported regular expression syntax: + - \c ab Concatenation + - \c a|b Alternation + - \c a? Zero or one + - \c a* Zero or more + - \c a+ One or more + - \c a{3} Exactly 3 times + - \c a{3,} At least 3 times + - \c a{3,5} 3 to 5 times + - \c (ab) Grouping + - \c ^a At the beginning + - \c a$ At the end + - \c . Any character + - \c [abc] Character classes + - \c [a-c] Character class range + - \c [a-z0-9_] Character class combination + - \c [^abc] Negated character classes + - \c [^a-c] Negated character class range + - \c [\b] Backspace (U+0008) + - \c \\| \\\\ ... Escape characters + - \c \\f Form feed (U+000C) + - \c \\n Line feed (U+000A) + - \c \\r Carriage return (U+000D) + - \c \\t Tab (U+0009) + - \c \\v Vertical tab (U+000B) + + \note This is a Thompson NFA engine, implemented with reference to + Cox, Russ. "Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby,...).", + https://swtch.com/~rsc/regexp/regexp1.html +*/ +template +class GenericRegex { +public: + typedef Encoding EncodingType; + typedef typename Encoding::Ch Ch; + template friend class GenericRegexSearch; + + GenericRegex(const Ch* source, Allocator* allocator = 0) : + ownAllocator_(allocator ? 0 : RAPIDJSON_NEW(Allocator)()), allocator_(allocator ? allocator : ownAllocator_), + states_(allocator_, 256), ranges_(allocator_, 256), root_(kRegexInvalidState), stateCount_(), rangeCount_(), + anchorBegin_(), anchorEnd_() + { + GenericStringStream ss(source); + DecodedStream, Encoding> ds(ss); + Parse(ds); + } + + ~GenericRegex() + { + RAPIDJSON_DELETE(ownAllocator_); + } + + bool IsValid() const { + return root_ != kRegexInvalidState; + } + +private: + enum Operator { + kZeroOrOne, + kZeroOrMore, + kOneOrMore, + kConcatenation, + kAlternation, + kLeftParenthesis + }; + + static const unsigned kAnyCharacterClass = 0xFFFFFFFF; //!< For '.' + static const unsigned kRangeCharacterClass = 0xFFFFFFFE; + static const unsigned kRangeNegationFlag = 0x80000000; + + struct Range { + unsigned start; // + unsigned end; + SizeType next; + }; + + struct State { + SizeType out; //!< Equals to kInvalid for matching state + SizeType out1; //!< Equals to non-kInvalid for split + SizeType rangeStart; + unsigned codepoint; + }; + + struct Frag { + Frag(SizeType s, SizeType o, SizeType m) : start(s), out(o), minIndex(m) {} + SizeType start; + SizeType out; //!< link-list of all output states + SizeType minIndex; + }; + + State& GetState(SizeType index) { + RAPIDJSON_ASSERT(index < stateCount_); + return states_.template Bottom()[index]; + } + + const State& GetState(SizeType index) const { + RAPIDJSON_ASSERT(index < stateCount_); + return states_.template Bottom()[index]; + } + + Range& GetRange(SizeType index) { + RAPIDJSON_ASSERT(index < rangeCount_); + return ranges_.template Bottom()[index]; + } + + const Range& GetRange(SizeType index) const { + RAPIDJSON_ASSERT(index < rangeCount_); + return ranges_.template Bottom()[index]; + } + + template + void Parse(DecodedStream& ds) { + Stack operandStack(allocator_, 256); // Frag + Stack operatorStack(allocator_, 256); // Operator + Stack atomCountStack(allocator_, 256); // unsigned (Atom per parenthesis) + + *atomCountStack.template Push() = 0; + + unsigned codepoint; + while (ds.Peek() != 0) { + switch (codepoint = ds.Take()) { + case '^': + anchorBegin_ = true; + break; + + case '$': + anchorEnd_ = true; + break; + + case '|': + while (!operatorStack.Empty() && *operatorStack.template Top() < kAlternation) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + *operatorStack.template Push() = kAlternation; + *atomCountStack.template Top() = 0; + break; + + case '(': + *operatorStack.template Push() = kLeftParenthesis; + *atomCountStack.template Push() = 0; + break; + + case ')': + while (!operatorStack.Empty() && *operatorStack.template Top() != kLeftParenthesis) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + if (operatorStack.Empty()) + return; + operatorStack.template Pop(1); + atomCountStack.template Pop(1); + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '?': + if (!Eval(operandStack, kZeroOrOne)) + return; + break; + + case '*': + if (!Eval(operandStack, kZeroOrMore)) + return; + break; + + case '+': + if (!Eval(operandStack, kOneOrMore)) + return; + break; + + case '{': + { + unsigned n, m; + if (!ParseUnsigned(ds, &n)) + return; + + if (ds.Peek() == ',') { + ds.Take(); + if (ds.Peek() == '}') + m = kInfinityQuantifier; + else if (!ParseUnsigned(ds, &m) || m < n) + return; + } + else + m = n; + + if (!EvalQuantifier(operandStack, n, m) || ds.Peek() != '}') + return; + ds.Take(); + } + break; + + case '.': + PushOperand(operandStack, kAnyCharacterClass); + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '[': + { + SizeType range; + if (!ParseRange(ds, &range)) + return; + SizeType s = NewState(kRegexInvalidState, kRegexInvalidState, kRangeCharacterClass); + GetState(s).rangeStart = range; + *operandStack.template Push() = Frag(s, s, s); + } + ImplicitConcatenation(atomCountStack, operatorStack); + break; + + case '\\': // Escape character + if (!CharacterEscape(ds, &codepoint)) + return; // Unsupported escape character + // fall through to default + RAPIDJSON_DELIBERATE_FALLTHROUGH; + + default: // Pattern character + PushOperand(operandStack, codepoint); + ImplicitConcatenation(atomCountStack, operatorStack); + } + } + + while (!operatorStack.Empty()) + if (!Eval(operandStack, *operatorStack.template Pop(1))) + return; + + // Link the operand to matching state. + if (operandStack.GetSize() == sizeof(Frag)) { + Frag* e = operandStack.template Pop(1); + Patch(e->out, NewState(kRegexInvalidState, kRegexInvalidState, 0)); + root_ = e->start; + +#if RAPIDJSON_REGEX_VERBOSE + printf("root: %d\n", root_); + for (SizeType i = 0; i < stateCount_ ; i++) { + State& s = GetState(i); + printf("[%2d] out: %2d out1: %2d c: '%c'\n", i, s.out, s.out1, (char)s.codepoint); + } + printf("\n"); +#endif + } + } + + SizeType NewState(SizeType out, SizeType out1, unsigned codepoint) { + State* s = states_.template Push(); + s->out = out; + s->out1 = out1; + s->codepoint = codepoint; + s->rangeStart = kRegexInvalidRange; + return stateCount_++; + } + + void PushOperand(Stack& operandStack, unsigned codepoint) { + SizeType s = NewState(kRegexInvalidState, kRegexInvalidState, codepoint); + *operandStack.template Push() = Frag(s, s, s); + } + + void ImplicitConcatenation(Stack& atomCountStack, Stack& operatorStack) { + if (*atomCountStack.template Top()) + *operatorStack.template Push() = kConcatenation; + (*atomCountStack.template Top())++; + } + + SizeType Append(SizeType l1, SizeType l2) { + SizeType old = l1; + while (GetState(l1).out != kRegexInvalidState) + l1 = GetState(l1).out; + GetState(l1).out = l2; + return old; + } + + void Patch(SizeType l, SizeType s) { + for (SizeType next; l != kRegexInvalidState; l = next) { + next = GetState(l).out; + GetState(l).out = s; + } + } + + bool Eval(Stack& operandStack, Operator op) { + switch (op) { + case kConcatenation: + RAPIDJSON_ASSERT(operandStack.GetSize() >= sizeof(Frag) * 2); + { + Frag e2 = *operandStack.template Pop(1); + Frag e1 = *operandStack.template Pop(1); + Patch(e1.out, e2.start); + *operandStack.template Push() = Frag(e1.start, e2.out, Min(e1.minIndex, e2.minIndex)); + } + return true; + + case kAlternation: + if (operandStack.GetSize() >= sizeof(Frag) * 2) { + Frag e2 = *operandStack.template Pop(1); + Frag e1 = *operandStack.template Pop(1); + SizeType s = NewState(e1.start, e2.start, 0); + *operandStack.template Push() = Frag(s, Append(e1.out, e2.out), Min(e1.minIndex, e2.minIndex)); + return true; + } + return false; + + case kZeroOrOne: + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + *operandStack.template Push() = Frag(s, Append(e.out, s), e.minIndex); + return true; + } + return false; + + case kZeroOrMore: + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + Patch(e.out, s); + *operandStack.template Push() = Frag(s, s, e.minIndex); + return true; + } + return false; + + case kOneOrMore: + if (operandStack.GetSize() >= sizeof(Frag)) { + Frag e = *operandStack.template Pop(1); + SizeType s = NewState(kRegexInvalidState, e.start, 0); + Patch(e.out, s); + *operandStack.template Push() = Frag(e.start, s, e.minIndex); + return true; + } + return false; + + default: + // syntax error (e.g. unclosed kLeftParenthesis) + return false; + } + } + + bool EvalQuantifier(Stack& operandStack, unsigned n, unsigned m) { + RAPIDJSON_ASSERT(n <= m); + RAPIDJSON_ASSERT(operandStack.GetSize() >= sizeof(Frag)); + + if (n == 0) { + if (m == 0) // a{0} not support + return false; + else if (m == kInfinityQuantifier) + Eval(operandStack, kZeroOrMore); // a{0,} -> a* + else { + Eval(operandStack, kZeroOrOne); // a{0,5} -> a? + for (unsigned i = 0; i < m - 1; i++) + CloneTopOperand(operandStack); // a{0,5} -> a? a? a? a? a? + for (unsigned i = 0; i < m - 1; i++) + Eval(operandStack, kConcatenation); // a{0,5} -> a?a?a?a?a? + } + return true; + } + + for (unsigned i = 0; i < n - 1; i++) // a{3} -> a a a + CloneTopOperand(operandStack); + + if (m == kInfinityQuantifier) + Eval(operandStack, kOneOrMore); // a{3,} -> a a a+ + else if (m > n) { + CloneTopOperand(operandStack); // a{3,5} -> a a a a + Eval(operandStack, kZeroOrOne); // a{3,5} -> a a a a? + for (unsigned i = n; i < m - 1; i++) + CloneTopOperand(operandStack); // a{3,5} -> a a a a? a? + for (unsigned i = n; i < m; i++) + Eval(operandStack, kConcatenation); // a{3,5} -> a a aa?a? + } + + for (unsigned i = 0; i < n - 1; i++) + Eval(operandStack, kConcatenation); // a{3} -> aaa, a{3,} -> aaa+, a{3.5} -> aaaa?a? + + return true; + } + + static SizeType Min(SizeType a, SizeType b) { return a < b ? a : b; } + + void CloneTopOperand(Stack& operandStack) { + const Frag src = *operandStack.template Top(); // Copy constructor to prevent invalidation + SizeType count = stateCount_ - src.minIndex; // Assumes top operand contains states in [src->minIndex, stateCount_) + State* s = states_.template Push(count); + memcpy(s, &GetState(src.minIndex), count * sizeof(State)); + for (SizeType j = 0; j < count; j++) { + if (s[j].out != kRegexInvalidState) + s[j].out += count; + if (s[j].out1 != kRegexInvalidState) + s[j].out1 += count; + } + *operandStack.template Push() = Frag(src.start + count, src.out + count, src.minIndex + count); + stateCount_ += count; + } + + template + bool ParseUnsigned(DecodedStream& ds, unsigned* u) { + unsigned r = 0; + if (ds.Peek() < '0' || ds.Peek() > '9') + return false; + while (ds.Peek() >= '0' && ds.Peek() <= '9') { + if (r >= 429496729 && ds.Peek() > '5') // 2^32 - 1 = 4294967295 + return false; // overflow + r = r * 10 + (ds.Take() - '0'); + } + *u = r; + return true; + } + + template + bool ParseRange(DecodedStream& ds, SizeType* range) { + bool isBegin = true; + bool negate = false; + int step = 0; + SizeType start = kRegexInvalidRange; + SizeType current = kRegexInvalidRange; + unsigned codepoint; + while ((codepoint = ds.Take()) != 0) { + if (isBegin) { + isBegin = false; + if (codepoint == '^') { + negate = true; + continue; + } + } + + switch (codepoint) { + case ']': + if (start == kRegexInvalidRange) + return false; // Error: nothing inside [] + if (step == 2) { // Add trailing '-' + SizeType r = NewRange('-'); + RAPIDJSON_ASSERT(current != kRegexInvalidRange); + GetRange(current).next = r; + } + if (negate) + GetRange(start).start |= kRangeNegationFlag; + *range = start; + return true; + + case '\\': + if (ds.Peek() == 'b') { + ds.Take(); + codepoint = 0x0008; // Escape backspace character + } + else if (!CharacterEscape(ds, &codepoint)) + return false; + // fall through to default + RAPIDJSON_DELIBERATE_FALLTHROUGH; + + default: + switch (step) { + case 1: + if (codepoint == '-') { + step++; + break; + } + // fall through to step 0 for other characters + RAPIDJSON_DELIBERATE_FALLTHROUGH; + + case 0: + { + SizeType r = NewRange(codepoint); + if (current != kRegexInvalidRange) + GetRange(current).next = r; + if (start == kRegexInvalidRange) + start = r; + current = r; + } + step = 1; + break; + + default: + RAPIDJSON_ASSERT(step == 2); + GetRange(current).end = codepoint; + step = 0; + } + } + } + return false; + } + + SizeType NewRange(unsigned codepoint) { + Range* r = ranges_.template Push(); + r->start = r->end = codepoint; + r->next = kRegexInvalidRange; + return rangeCount_++; + } + + template + bool CharacterEscape(DecodedStream& ds, unsigned* escapedCodepoint) { + unsigned codepoint; + switch (codepoint = ds.Take()) { + case '^': + case '$': + case '|': + case '(': + case ')': + case '?': + case '*': + case '+': + case '.': + case '[': + case ']': + case '{': + case '}': + case '\\': + *escapedCodepoint = codepoint; return true; + case 'f': *escapedCodepoint = 0x000C; return true; + case 'n': *escapedCodepoint = 0x000A; return true; + case 'r': *escapedCodepoint = 0x000D; return true; + case 't': *escapedCodepoint = 0x0009; return true; + case 'v': *escapedCodepoint = 0x000B; return true; + default: + return false; // Unsupported escape character + } + } + + Allocator* ownAllocator_; + Allocator* allocator_; + Stack states_; + Stack ranges_; + SizeType root_; + SizeType stateCount_; + SizeType rangeCount_; + + static const unsigned kInfinityQuantifier = ~0u; + + // For SearchWithAnchoring() + bool anchorBegin_; + bool anchorEnd_; +}; + +template +class GenericRegexSearch { +public: + typedef typename RegexType::EncodingType Encoding; + typedef typename Encoding::Ch Ch; + + GenericRegexSearch(const RegexType& regex, Allocator* allocator = 0) : + regex_(regex), allocator_(allocator), ownAllocator_(0), + state0_(allocator, 0), state1_(allocator, 0), stateSet_() + { + RAPIDJSON_ASSERT(regex_.IsValid()); + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)(); + stateSet_ = static_cast(allocator_->Malloc(GetStateSetSize())); + state0_.template Reserve(regex_.stateCount_); + state1_.template Reserve(regex_.stateCount_); + } + + ~GenericRegexSearch() { + Allocator::Free(stateSet_); + RAPIDJSON_DELETE(ownAllocator_); + } + + template + bool Match(InputStream& is) { + return SearchWithAnchoring(is, true, true); + } + + bool Match(const Ch* s) { + GenericStringStream is(s); + return Match(is); + } + + template + bool Search(InputStream& is) { + return SearchWithAnchoring(is, regex_.anchorBegin_, regex_.anchorEnd_); + } + + bool Search(const Ch* s) { + GenericStringStream is(s); + return Search(is); + } + +private: + typedef typename RegexType::State State; + typedef typename RegexType::Range Range; + + template + bool SearchWithAnchoring(InputStream& is, bool anchorBegin, bool anchorEnd) { + DecodedStream ds(is); + + state0_.Clear(); + Stack *current = &state0_, *next = &state1_; + const size_t stateSetSize = GetStateSetSize(); + std::memset(stateSet_, 0, stateSetSize); + + bool matched = AddState(*current, regex_.root_); + unsigned codepoint; + while (!current->Empty() && (codepoint = ds.Take()) != 0) { + std::memset(stateSet_, 0, stateSetSize); + next->Clear(); + matched = false; + for (const SizeType* s = current->template Bottom(); s != current->template End(); ++s) { + const State& sr = regex_.GetState(*s); + if (sr.codepoint == codepoint || + sr.codepoint == RegexType::kAnyCharacterClass || + (sr.codepoint == RegexType::kRangeCharacterClass && MatchRange(sr.rangeStart, codepoint))) + { + matched = AddState(*next, sr.out) || matched; + if (!anchorEnd && matched) + return true; + } + if (!anchorBegin) + AddState(*next, regex_.root_); + } + internal::Swap(current, next); + } + + return matched; + } + + size_t GetStateSetSize() const { + return (regex_.stateCount_ + 31) / 32 * 4; + } + + // Return whether the added states is a match state + bool AddState(Stack& l, SizeType index) { + RAPIDJSON_ASSERT(index != kRegexInvalidState); + + const State& s = regex_.GetState(index); + if (s.out1 != kRegexInvalidState) { // Split + bool matched = AddState(l, s.out); + return AddState(l, s.out1) || matched; + } + else if (!(stateSet_[index >> 5] & (1u << (index & 31)))) { + stateSet_[index >> 5] |= (1u << (index & 31)); + *l.template PushUnsafe() = index; + } + return s.out == kRegexInvalidState; // by using PushUnsafe() above, we can ensure s is not validated due to reallocation. + } + + bool MatchRange(SizeType rangeIndex, unsigned codepoint) const { + bool yes = (regex_.GetRange(rangeIndex).start & RegexType::kRangeNegationFlag) == 0; + while (rangeIndex != kRegexInvalidRange) { + const Range& r = regex_.GetRange(rangeIndex); + if (codepoint >= (r.start & ~RegexType::kRangeNegationFlag) && codepoint <= r.end) + return yes; + rangeIndex = r.next; + } + return !yes; + } + + const RegexType& regex_; + Allocator* allocator_; + Allocator* ownAllocator_; + Stack state0_; + Stack state1_; + uint32_t* stateSet_; +}; + +typedef GenericRegex > Regex; +typedef GenericRegexSearch RegexSearch; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#ifdef __GNUC__ +RAPIDJSON_DIAG_POP +#endif + +#if defined(__clang__) || defined(_MSC_VER) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_REGEX_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/stack.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/stack.h new file mode 100644 index 0000000000000000000000000000000000000000..73abd706e976926802d52564cb7f7e36b0070ba0 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/stack.h @@ -0,0 +1,232 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_STACK_H_ +#define RAPIDJSON_INTERNAL_STACK_H_ + +#include "../allocators.h" +#include "swap.h" +#include + +#if defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +/////////////////////////////////////////////////////////////////////////////// +// Stack + +//! A type-unsafe stack for storing different types of data. +/*! \tparam Allocator Allocator for allocating stack memory. +*/ +template +class Stack { +public: + // Optimization note: Do not allocate memory for stack_ in constructor. + // Do it lazily when first Push() -> Expand() -> Resize(). + Stack(Allocator* allocator, size_t stackCapacity) : allocator_(allocator), ownAllocator_(0), stack_(0), stackTop_(0), stackEnd_(0), initialCapacity_(stackCapacity) { + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + Stack(Stack&& rhs) + : allocator_(rhs.allocator_), + ownAllocator_(rhs.ownAllocator_), + stack_(rhs.stack_), + stackTop_(rhs.stackTop_), + stackEnd_(rhs.stackEnd_), + initialCapacity_(rhs.initialCapacity_) + { + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.stack_ = 0; + rhs.stackTop_ = 0; + rhs.stackEnd_ = 0; + rhs.initialCapacity_ = 0; + } +#endif + + ~Stack() { + Destroy(); + } + +#if RAPIDJSON_HAS_CXX11_RVALUE_REFS + Stack& operator=(Stack&& rhs) { + if (&rhs != this) + { + Destroy(); + + allocator_ = rhs.allocator_; + ownAllocator_ = rhs.ownAllocator_; + stack_ = rhs.stack_; + stackTop_ = rhs.stackTop_; + stackEnd_ = rhs.stackEnd_; + initialCapacity_ = rhs.initialCapacity_; + + rhs.allocator_ = 0; + rhs.ownAllocator_ = 0; + rhs.stack_ = 0; + rhs.stackTop_ = 0; + rhs.stackEnd_ = 0; + rhs.initialCapacity_ = 0; + } + return *this; + } +#endif + + void Swap(Stack& rhs) RAPIDJSON_NOEXCEPT { + internal::Swap(allocator_, rhs.allocator_); + internal::Swap(ownAllocator_, rhs.ownAllocator_); + internal::Swap(stack_, rhs.stack_); + internal::Swap(stackTop_, rhs.stackTop_); + internal::Swap(stackEnd_, rhs.stackEnd_); + internal::Swap(initialCapacity_, rhs.initialCapacity_); + } + + void Clear() { stackTop_ = stack_; } + + void ShrinkToFit() { + if (Empty()) { + // If the stack is empty, completely deallocate the memory. + Allocator::Free(stack_); // NOLINT (+clang-analyzer-unix.Malloc) + stack_ = 0; + stackTop_ = 0; + stackEnd_ = 0; + } + else + Resize(GetSize()); + } + + // Optimization note: try to minimize the size of this function for force inline. + // Expansion is run very infrequently, so it is moved to another (probably non-inline) function. + template + RAPIDJSON_FORCEINLINE void Reserve(size_t count = 1) { + // Expand the stack if needed + if (RAPIDJSON_UNLIKELY(static_cast(sizeof(T) * count) > (stackEnd_ - stackTop_))) + Expand(count); + } + + template + RAPIDJSON_FORCEINLINE T* Push(size_t count = 1) { + Reserve(count); + return PushUnsafe(count); + } + + template + RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) { + RAPIDJSON_ASSERT(stackTop_); + RAPIDJSON_ASSERT(static_cast(sizeof(T) * count) <= (stackEnd_ - stackTop_)); + T* ret = reinterpret_cast(stackTop_); + stackTop_ += sizeof(T) * count; + return ret; + } + + template + T* Pop(size_t count) { + RAPIDJSON_ASSERT(GetSize() >= count * sizeof(T)); + stackTop_ -= count * sizeof(T); + return reinterpret_cast(stackTop_); + } + + template + T* Top() { + RAPIDJSON_ASSERT(GetSize() >= sizeof(T)); + return reinterpret_cast(stackTop_ - sizeof(T)); + } + + template + const T* Top() const { + RAPIDJSON_ASSERT(GetSize() >= sizeof(T)); + return reinterpret_cast(stackTop_ - sizeof(T)); + } + + template + T* End() { return reinterpret_cast(stackTop_); } + + template + const T* End() const { return reinterpret_cast(stackTop_); } + + template + T* Bottom() { return reinterpret_cast(stack_); } + + template + const T* Bottom() const { return reinterpret_cast(stack_); } + + bool HasAllocator() const { + return allocator_ != 0; + } + + Allocator& GetAllocator() { + RAPIDJSON_ASSERT(allocator_); + return *allocator_; + } + + bool Empty() const { return stackTop_ == stack_; } + size_t GetSize() const { return static_cast(stackTop_ - stack_); } + size_t GetCapacity() const { return static_cast(stackEnd_ - stack_); } + +private: + template + void Expand(size_t count) { + // Only expand the capacity if the current stack exists. Otherwise just create a stack with initial capacity. + size_t newCapacity; + if (stack_ == 0) { + if (!allocator_) + ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)(); + newCapacity = initialCapacity_; + } else { + newCapacity = GetCapacity(); + newCapacity += (newCapacity + 1) / 2; + } + size_t newSize = GetSize() + sizeof(T) * count; + if (newCapacity < newSize) + newCapacity = newSize; + + Resize(newCapacity); + } + + void Resize(size_t newCapacity) { + const size_t size = GetSize(); // Backup the current size + stack_ = static_cast(allocator_->Realloc(stack_, GetCapacity(), newCapacity)); + stackTop_ = stack_ + size; + stackEnd_ = stack_ + newCapacity; + } + + void Destroy() { + Allocator::Free(stack_); + RAPIDJSON_DELETE(ownAllocator_); // Only delete if it is owned by the stack + } + + // Prohibit copy constructor & assignment operator. + Stack(const Stack&); + Stack& operator=(const Stack&); + + Allocator* allocator_; + Allocator* ownAllocator_; + char *stack_; + char *stackTop_; + char *stackEnd_; + size_t initialCapacity_; +}; + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#if defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_STACK_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/strfunc.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/strfunc.h new file mode 100644 index 0000000000000000000000000000000000000000..b698a8f43fa63b342f3f6254adf68dbac99b9461 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/strfunc.h @@ -0,0 +1,83 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_STRFUNC_H_ +#define RAPIDJSON_INTERNAL_STRFUNC_H_ + +#include "../stream.h" +#include + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Custom strlen() which works on different character types. +/*! \tparam Ch Character type (e.g. char, wchar_t, short) + \param s Null-terminated input string. + \return Number of characters in the string. + \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. +*/ +template +inline SizeType StrLen(const Ch* s) { + RAPIDJSON_ASSERT(s != 0); + const Ch* p = s; + while (*p) ++p; + return SizeType(p - s); +} + +template <> +inline SizeType StrLen(const char* s) { + return SizeType(std::strlen(s)); +} + +template <> +inline SizeType StrLen(const wchar_t* s) { + return SizeType(std::wcslen(s)); +} + +//! Custom strcmpn() which works on different character types. +/*! \tparam Ch Character type (e.g. char, wchar_t, short) + \param s1 Null-terminated input string. + \param s2 Null-terminated input string. + \return 0 if equal +*/ +template +inline int StrCmp(const Ch* s1, const Ch* s2) { + RAPIDJSON_ASSERT(s1 != 0); + RAPIDJSON_ASSERT(s2 != 0); + while(*s1 && (*s1 == *s2)) { s1++; s2++; } + return static_cast(*s1) < static_cast(*s2) ? -1 : static_cast(*s1) > static_cast(*s2); +} + +//! Returns number of code points in a encoded string. +template +bool CountStringCodePoint(const typename Encoding::Ch* s, SizeType length, SizeType* outCount) { + RAPIDJSON_ASSERT(s != 0); + RAPIDJSON_ASSERT(outCount != 0); + GenericStringStream is(s); + const typename Encoding::Ch* end = s + length; + SizeType count = 0; + while (is.src_ < end) { + unsigned codepoint; + if (!Encoding::Decode(is, &codepoint)) + return false; + count++; + } + *outCount = count; + return true; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_INTERNAL_STRFUNC_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/strtod.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/strtod.h new file mode 100644 index 0000000000000000000000000000000000000000..55f0e380bfaa351dc2b7a0f14fc2232540ec0fd9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/strtod.h @@ -0,0 +1,293 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_STRTOD_ +#define RAPIDJSON_STRTOD_ + +#include "ieee754.h" +#include "biginteger.h" +#include "diyfp.h" +#include "pow10.h" +#include +#include + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +inline double FastPath(double significand, int exp) { + if (exp < -308) + return 0.0; + else if (exp >= 0) + return significand * internal::Pow10(exp); + else + return significand / internal::Pow10(-exp); +} + +inline double StrtodNormalPrecision(double d, int p) { + if (p < -308) { + // Prevent expSum < -308, making Pow10(p) = 0 + d = FastPath(d, -308); + d = FastPath(d, p + 308); + } + else + d = FastPath(d, p); + return d; +} + +template +inline T Min3(T a, T b, T c) { + T m = a; + if (m > b) m = b; + if (m > c) m = c; + return m; +} + +inline int CheckWithinHalfULP(double b, const BigInteger& d, int dExp) { + const Double db(b); + const uint64_t bInt = db.IntegerSignificand(); + const int bExp = db.IntegerExponent(); + const int hExp = bExp - 1; + + int dS_Exp2 = 0, dS_Exp5 = 0, bS_Exp2 = 0, bS_Exp5 = 0, hS_Exp2 = 0, hS_Exp5 = 0; + + // Adjust for decimal exponent + if (dExp >= 0) { + dS_Exp2 += dExp; + dS_Exp5 += dExp; + } + else { + bS_Exp2 -= dExp; + bS_Exp5 -= dExp; + hS_Exp2 -= dExp; + hS_Exp5 -= dExp; + } + + // Adjust for binary exponent + if (bExp >= 0) + bS_Exp2 += bExp; + else { + dS_Exp2 -= bExp; + hS_Exp2 -= bExp; + } + + // Adjust for half ulp exponent + if (hExp >= 0) + hS_Exp2 += hExp; + else { + dS_Exp2 -= hExp; + bS_Exp2 -= hExp; + } + + // Remove common power of two factor from all three scaled values + int common_Exp2 = Min3(dS_Exp2, bS_Exp2, hS_Exp2); + dS_Exp2 -= common_Exp2; + bS_Exp2 -= common_Exp2; + hS_Exp2 -= common_Exp2; + + BigInteger dS = d; + dS.MultiplyPow5(static_cast(dS_Exp5)) <<= static_cast(dS_Exp2); + + BigInteger bS(bInt); + bS.MultiplyPow5(static_cast(bS_Exp5)) <<= static_cast(bS_Exp2); + + BigInteger hS(1); + hS.MultiplyPow5(static_cast(hS_Exp5)) <<= static_cast(hS_Exp2); + + BigInteger delta(0); + dS.Difference(bS, &delta); + + return delta.Compare(hS); +} + +inline bool StrtodFast(double d, int p, double* result) { + // Use fast path for string-to-double conversion if possible + // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion/ + if (p > 22 && p < 22 + 16) { + // Fast Path Cases In Disguise + d *= internal::Pow10(p - 22); + p = 22; + } + + if (p >= -22 && p <= 22 && d <= 9007199254740991.0) { // 2^53 - 1 + *result = FastPath(d, p); + return true; + } + else + return false; +} + +// Compute an approximation and see if it is within 1/2 ULP +template +inline bool StrtodDiyFp(const Ch* decimals, int dLen, int dExp, double* result) { + uint64_t significand = 0; + int i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999 + for (; i < dLen; i++) { + if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || + (significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > Ch('5'))) + break; + significand = significand * 10u + static_cast(decimals[i] - Ch('0')); + } + + if (i < dLen && decimals[i] >= Ch('5')) // Rounding + significand++; + + int remaining = dLen - i; + const int kUlpShift = 3; + const int kUlp = 1 << kUlpShift; + int64_t error = (remaining == 0) ? 0 : kUlp / 2; + + DiyFp v(significand, 0); + v = v.Normalize(); + error <<= -v.e; + + dExp += remaining; + + int actualExp; + DiyFp cachedPower = GetCachedPower10(dExp, &actualExp); + if (actualExp != dExp) { + static const DiyFp kPow10[] = { + DiyFp(RAPIDJSON_UINT64_C2(0xa0000000, 0x00000000), -60), // 10^1 + DiyFp(RAPIDJSON_UINT64_C2(0xc8000000, 0x00000000), -57), // 10^2 + DiyFp(RAPIDJSON_UINT64_C2(0xfa000000, 0x00000000), -54), // 10^3 + DiyFp(RAPIDJSON_UINT64_C2(0x9c400000, 0x00000000), -50), // 10^4 + DiyFp(RAPIDJSON_UINT64_C2(0xc3500000, 0x00000000), -47), // 10^5 + DiyFp(RAPIDJSON_UINT64_C2(0xf4240000, 0x00000000), -44), // 10^6 + DiyFp(RAPIDJSON_UINT64_C2(0x98968000, 0x00000000), -40) // 10^7 + }; + int adjustment = dExp - actualExp; + RAPIDJSON_ASSERT(adjustment >= 1 && adjustment < 8); + v = v * kPow10[adjustment - 1]; + if (dLen + adjustment > 19) // has more digits than decimal digits in 64-bit + error += kUlp / 2; + } + + v = v * cachedPower; + + error += kUlp + (error == 0 ? 0 : 1); + + const int oldExp = v.e; + v = v.Normalize(); + error <<= oldExp - v.e; + + const int effectiveSignificandSize = Double::EffectiveSignificandSize(64 + v.e); + int precisionSize = 64 - effectiveSignificandSize; + if (precisionSize + kUlpShift >= 64) { + int scaleExp = (precisionSize + kUlpShift) - 63; + v.f >>= scaleExp; + v.e += scaleExp; + error = (error >> scaleExp) + 1 + kUlp; + precisionSize -= scaleExp; + } + + DiyFp rounded(v.f >> precisionSize, v.e + precisionSize); + const uint64_t precisionBits = (v.f & ((uint64_t(1) << precisionSize) - 1)) * kUlp; + const uint64_t halfWay = (uint64_t(1) << (precisionSize - 1)) * kUlp; + if (precisionBits >= halfWay + static_cast(error)) { + rounded.f++; + if (rounded.f & (DiyFp::kDpHiddenBit << 1)) { // rounding overflows mantissa (issue #340) + rounded.f >>= 1; + rounded.e++; + } + } + + *result = rounded.ToDouble(); + + return halfWay - static_cast(error) >= precisionBits || precisionBits >= halfWay + static_cast(error); +} + +template +inline double StrtodBigInteger(double approx, const Ch* decimals, int dLen, int dExp) { + RAPIDJSON_ASSERT(dLen >= 0); + const BigInteger dInt(decimals, static_cast(dLen)); + Double a(approx); + int cmp = CheckWithinHalfULP(a.Value(), dInt, dExp); + if (cmp < 0) + return a.Value(); // within half ULP + else if (cmp == 0) { + // Round towards even + if (a.Significand() & 1) + return a.NextPositiveDouble(); + else + return a.Value(); + } + else // adjustment + return a.NextPositiveDouble(); +} + +template +inline double StrtodFullPrecision(double d, int p, const Ch* decimals, size_t length, size_t decimalPosition, int exp) { + RAPIDJSON_ASSERT(d >= 0.0); + RAPIDJSON_ASSERT(length >= 1); + + double result = 0.0; + if (StrtodFast(d, p, &result)) + return result; + + RAPIDJSON_ASSERT(length <= INT_MAX); + int dLen = static_cast(length); + + RAPIDJSON_ASSERT(length >= decimalPosition); + RAPIDJSON_ASSERT(length - decimalPosition <= INT_MAX); + int dExpAdjust = static_cast(length - decimalPosition); + + RAPIDJSON_ASSERT(exp >= INT_MIN + dExpAdjust); + int dExp = exp - dExpAdjust; + + // Make sure length+dExp does not overflow + RAPIDJSON_ASSERT(dExp <= INT_MAX - dLen); + + // Trim leading zeros + while (dLen > 0 && *decimals == '0') { + dLen--; + decimals++; + } + + // Trim trailing zeros + while (dLen > 0 && decimals[dLen - 1] == '0') { + dLen--; + dExp++; + } + + if (dLen == 0) { // Buffer only contains zeros. + return 0.0; + } + + // Trim right-most digits + const int kMaxDecimalDigit = 767 + 1; + if (dLen > kMaxDecimalDigit) { + dExp += dLen - kMaxDecimalDigit; + dLen = kMaxDecimalDigit; + } + + // If too small, underflow to zero. + // Any x <= 10^-324 is interpreted as zero. + if (dLen + dExp <= -324) + return 0.0; + + // If too large, overflow to infinity. + // Any x >= 10^309 is interpreted as +infinity. + if (dLen + dExp > 309) + return std::numeric_limits::infinity(); + + if (StrtodDiyFp(decimals, dLen, dExp, &result)) + return result; + + // Use approximation from StrtodDiyFp and make adjustment with BigInteger comparison + return StrtodBigInteger(result, decimals, dLen, dExp); +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#endif // RAPIDJSON_STRTOD_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/internal/swap.h b/data/miniconda3/envs/catiagent/include/rapidjson/internal/swap.h new file mode 100644 index 0000000000000000000000000000000000000000..2cf92f93a1d371ab8e6f2e2084cc107926cff61a --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/internal/swap.h @@ -0,0 +1,46 @@ +// Tencent is pleased to support the open source community by making RapidJSON available. +// +// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +// +// Licensed under the MIT License (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +#ifndef RAPIDJSON_INTERNAL_SWAP_H_ +#define RAPIDJSON_INTERNAL_SWAP_H_ + +#include "../rapidjson.h" + +#if defined(__clang__) +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(c++98-compat) +#endif + +RAPIDJSON_NAMESPACE_BEGIN +namespace internal { + +//! Custom swap() to avoid dependency on C++ header +/*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. + \note This has the same semantics as std::swap(). +*/ +template +inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT { + T tmp = a; + a = b; + b = tmp; +} + +} // namespace internal +RAPIDJSON_NAMESPACE_END + +#if defined(__clang__) +RAPIDJSON_DIAG_POP +#endif + +#endif // RAPIDJSON_INTERNAL_SWAP_H_ diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/inttypes.h b/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/inttypes.h new file mode 100644 index 0000000000000000000000000000000000000000..18111286bf55bc0c89e7f47afcb046bbb02e1781 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/inttypes.h @@ -0,0 +1,316 @@ +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2013 Alexander Chemeris +// +// 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 product 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 AUTHOR ``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 AUTHOR 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. +// +/////////////////////////////////////////////////////////////////////////////// + +// The above software in this distribution may have been modified by +// THL A29 Limited ("Tencent Modifications"). +// All Tencent Modifications are Copyright (C) 2015 THL A29 Limited. + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include "stdint.h" + +// miloyip: VC supports inttypes.h since VC2013 +#if _MSC_VER >= 1800 +#include +#else + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +#endif // __STDC_FORMAT_MACROS ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + +#endif // _MSC_VER >= 1800 + +#endif // _MSC_INTTYPES_H_ ] diff --git a/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/stdint.h b/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/stdint.h new file mode 100644 index 0000000000000000000000000000000000000000..3d4477b9a024a8f326afe362ce3926e04f4c8ec9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/rapidjson/msinttypes/stdint.h @@ -0,0 +1,300 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2013 Alexander Chemeris +// +// 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 product 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 AUTHOR ``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 AUTHOR 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. +// +/////////////////////////////////////////////////////////////////////////////// + +// The above software in this distribution may have been modified by +// THL A29 Limited ("Tencent Modifications"). +// All Tencent Modifications are Copyright (C) 2015 THL A29 Limited. + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +// miloyip: Originally Visual Studio 2010 uses its own stdint.h. However it generates warning with INT64_C(), so change to use this file for vs2010. +#if _MSC_VER >= 1600 // [ +#include + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +#undef INT8_C +#undef INT16_C +#undef INT32_C +#undef INT64_C +#undef UINT8_C +#undef UINT16_C +#undef UINT32_C +#undef UINT64_C + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +// These #ifndef's are needed to prevent collisions with . +// Check out Issue 9 for the details. +#ifndef INTMAX_C // [ +# define INTMAX_C INT64_C +#endif // INTMAX_C ] +#ifndef UINTMAX_C // [ +# define UINTMAX_C UINT64_C +#endif // UINTMAX_C ] + +#endif // __STDC_CONSTANT_MACROS ] + +#else // ] _MSC_VER >= 1700 [ + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we have to wrap include with 'extern "C++" {}' +// or compiler would give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#if defined(__cplusplus) && !defined(_M_ARM) +extern "C" { +#endif +# include +#if defined(__cplusplus) && !defined(_M_ARM) +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +// These #ifndef's are needed to prevent collisions with . +// Check out Issue 9 for the details. +#ifndef INTMAX_C // [ +# define INTMAX_C INT64_C +#endif // INTMAX_C ] +#ifndef UINTMAX_C // [ +# define UINTMAX_C UINT64_C +#endif // UINTMAX_C ] + +#endif // __STDC_CONSTANT_MACROS ] + +#endif // _MSC_VER >= 1600 ] + +#endif // _MSC_STDINT_H_ ] diff --git a/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv.h b/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv.h new file mode 100644 index 0000000000000000000000000000000000000000..f04bf1213b653f2bd7e57a256cc35a1a0215fdb9 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv.h @@ -0,0 +1,181 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Sharp RGB to YUV conversion. + +#ifndef WEBP_SHARPYUV_SHARPYUV_H_ +#define WEBP_SHARPYUV_SHARPYUV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef SHARPYUV_EXTERN +#ifdef WEBP_EXTERN +#define SHARPYUV_EXTERN WEBP_EXTERN +#else +// This explicitly marks library functions and allows for changing the +// signature for e.g., Windows DLL builds. +#if defined(_WIN32) && defined(WEBP_DLL) +#define SHARPYUV_EXTERN __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define SHARPYUV_EXTERN extern __attribute__((visibility("default"))) +#else +#define SHARPYUV_EXTERN extern +#endif /* defined(_WIN32) && defined(WEBP_DLL) */ +#endif /* WEBP_EXTERN */ +#endif /* SHARPYUV_EXTERN */ + +#ifndef SHARPYUV_INLINE +#ifdef WEBP_INLINE +#define SHARPYUV_INLINE WEBP_INLINE +#else +#ifndef _MSC_VER +#if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +#define SHARPYUV_INLINE inline +#else +#define SHARPYUV_INLINE +#endif +#else +#define SHARPYUV_INLINE __forceinline +#endif /* _MSC_VER */ +#endif /* WEBP_INLINE */ +#endif /* SHARPYUV_INLINE */ + +// SharpYUV API version following the convention from semver.org +#define SHARPYUV_VERSION_MAJOR 0 +#define SHARPYUV_VERSION_MINOR 4 +#define SHARPYUV_VERSION_PATCH 2 +// Version as a uint32_t. The major number is the high 8 bits. +// The minor number is the middle 8 bits. The patch number is the low 16 bits. +#define SHARPYUV_MAKE_VERSION(MAJOR, MINOR, PATCH) \ + (((MAJOR) << 24) | ((MINOR) << 16) | (PATCH)) +#define SHARPYUV_VERSION \ + SHARPYUV_MAKE_VERSION(SHARPYUV_VERSION_MAJOR, SHARPYUV_VERSION_MINOR, \ + SHARPYUV_VERSION_PATCH) + +// Returns the library's version number, packed in hexadecimal. See +// SHARPYUV_VERSION. +SHARPYUV_EXTERN int SharpYuvGetVersion(void); + +// RGB to YUV conversion matrix, in 16 bit fixed point. +// y_ = rgb_to_y[0] * r + rgb_to_y[1] * g + rgb_to_y[2] * b + rgb_to_y[3] +// u_ = rgb_to_u[0] * r + rgb_to_u[1] * g + rgb_to_u[2] * b + rgb_to_u[3] +// v_ = rgb_to_v[0] * r + rgb_to_v[1] * g + rgb_to_v[2] * b + rgb_to_v[3] +// Then the values are divided by 1<<16 and rounded. +// y = (y_ + (1 << 15)) >> 16 +// u = (u_ + (1 << 15)) >> 16 +// v = (v_ + (1 << 15)) >> 16 +// +// Typically, the offset values rgb_to_y[3], rgb_to_u[3] and rgb_to_v[3] depend +// on the input's bit depth, e.g., rgb_to_u[3] = 1 << (rgb_bit_depth - 1 + 16). +// See also sharpyuv_csp.h to get a predefined matrix or generate a matrix. +typedef struct { + int rgb_to_y[4]; + int rgb_to_u[4]; + int rgb_to_v[4]; +} SharpYuvConversionMatrix; + +typedef struct SharpYuvOptions SharpYuvOptions; + +// Enums for transfer functions, as defined in H.273, +// https://www.itu.int/rec/T-REC-H.273-202107-I/en +typedef enum SharpYuvTransferFunctionType { + // 0 is reserved + kSharpYuvTransferFunctionBt709 = 1, + // 2 is unspecified + // 3 is reserved + kSharpYuvTransferFunctionBt470M = 4, + kSharpYuvTransferFunctionBt470Bg = 5, + kSharpYuvTransferFunctionBt601 = 6, + kSharpYuvTransferFunctionSmpte240 = 7, + kSharpYuvTransferFunctionLinear = 8, + kSharpYuvTransferFunctionLog100 = 9, + kSharpYuvTransferFunctionLog100_Sqrt10 = 10, + kSharpYuvTransferFunctionIec61966 = 11, + kSharpYuvTransferFunctionBt1361 = 12, + kSharpYuvTransferFunctionSrgb = 13, + kSharpYuvTransferFunctionBt2020_10Bit = 14, + kSharpYuvTransferFunctionBt2020_12Bit = 15, + kSharpYuvTransferFunctionSmpte2084 = 16, // PQ + kSharpYuvTransferFunctionSmpte428 = 17, + kSharpYuvTransferFunctionHlg = 18, + kSharpYuvTransferFunctionNum +} SharpYuvTransferFunctionType; + +// Converts RGB to YUV420 using a downsampling algorithm that minimizes +// artefacts caused by chroma subsampling. +// This is slower than standard downsampling (averaging of 4 UV values). +// Assumes that the image will be upsampled using a bilinear filter. If nearest +// neighbor is used instead, the upsampled image might look worse than with +// standard downsampling. +// r_ptr, g_ptr, b_ptr: pointers to the source r, g and b channels. Should point +// to uint8_t buffers if rgb_bit_depth is 8, or uint16_t buffers otherwise. +// rgb_step: distance in bytes between two horizontally adjacent pixels on the +// r, g and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_stride: distance in bytes between two vertically adjacent pixels on the +// r, g, and b channels. If rgb_bit_depth is > 8, it should be a +// multiple of 2. +// rgb_bit_depth: number of bits for each r/g/b value. One of: 8, 10, 12, 16. +// Note: 16 bit input is truncated to 14 bits before conversion to yuv. +// yuv_bit_depth: number of bits for each y/u/v value. One of: 8, 10, 12. +// y_ptr, u_ptr, v_ptr: pointers to the destination y, u and v channels. Should +// point to uint8_t buffers if yuv_bit_depth is 8, or uint16_t buffers +// otherwise. +// y_stride, u_stride, v_stride: distance in bytes between two vertically +// adjacent pixels on the y, u and v channels. If yuv_bit_depth > 8, they +// should be multiples of 2. +// width, height: width and height of the image in pixels +// yuv_matrix: RGB to YUV conversion matrix. The matrix values typically +// depend on the input's rgb_bit_depth. +// This function calls SharpYuvConvertWithOptions with a default transfer +// function of kSharpYuvTransferFunctionSrgb. +SHARPYUV_EXTERN int SharpYuvConvert(const void* r_ptr, const void* g_ptr, + const void* b_ptr, int rgb_step, + int rgb_stride, int rgb_bit_depth, + void* y_ptr, int y_stride, void* u_ptr, + int u_stride, void* v_ptr, int v_stride, + int yuv_bit_depth, int width, int height, + const SharpYuvConversionMatrix* yuv_matrix); + +struct SharpYuvOptions { + // This matrix cannot be NULL and can be initialized by + // SharpYuvComputeConversionMatrix. + const SharpYuvConversionMatrix* yuv_matrix; + SharpYuvTransferFunctionType transfer_type; +}; + +// Internal, version-checked, entry point +SHARPYUV_EXTERN int SharpYuvOptionsInitInternal(const SharpYuvConversionMatrix*, + SharpYuvOptions*, int); + +// Should always be called, to initialize a fresh SharpYuvOptions +// structure before modification. SharpYuvOptionsInit() must have succeeded +// before using the 'options' object. +static SHARPYUV_INLINE int SharpYuvOptionsInit( + const SharpYuvConversionMatrix* yuv_matrix, SharpYuvOptions* options) { + return SharpYuvOptionsInitInternal(yuv_matrix, options, SHARPYUV_VERSION); +} + +SHARPYUV_EXTERN int SharpYuvConvertWithOptions( + const void* r_ptr, const void* g_ptr, const void* b_ptr, int rgb_step, + int rgb_stride, int rgb_bit_depth, void* y_ptr, int y_stride, void* u_ptr, + int u_stride, void* v_ptr, int v_stride, int yuv_bit_depth, int width, + int height, const SharpYuvOptions* options); + +// TODO(b/194336375): Add YUV444 to YUV420 conversion. Maybe also add 422 +// support (it's rarely used in practice, especially for images). + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_SHARPYUV_SHARPYUV_H_ diff --git a/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv_csp.h b/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv_csp.h new file mode 100644 index 0000000000000000000000000000000000000000..efc01053a02f22b3b3c48d112d351a3094547351 --- /dev/null +++ b/data/miniconda3/envs/catiagent/include/webp/sharpyuv/sharpyuv_csp.h @@ -0,0 +1,65 @@ +// Copyright 2022 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Colorspace utilities. + +#ifndef WEBP_SHARPYUV_SHARPYUV_CSP_H_ +#define WEBP_SHARPYUV_SHARPYUV_CSP_H_ + +#include "sharpyuv/sharpyuv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Range of YUV values. +typedef enum { + kSharpYuvRangeFull, // YUV values between [0;255] (for 8 bit) + kSharpYuvRangeLimited // Y in [16;235], YUV in [16;240] (for 8 bit) +} SharpYuvRange; + +// Constants that define a YUV color space. +typedef struct { + // Kr and Kb are defined such that: + // Y = Kr * r + Kg * g + Kb * b where Kg = 1 - Kr - Kb. + float kr; + float kb; + int bit_depth; // 8, 10 or 12 + SharpYuvRange range; +} SharpYuvColorSpace; + +// Fills in 'matrix' for the given YUVColorSpace. +SHARPYUV_EXTERN void SharpYuvComputeConversionMatrix( + const SharpYuvColorSpace* yuv_color_space, + SharpYuvConversionMatrix* matrix); + +// Enums for precomputed conversion matrices. +typedef enum { + // WebP's matrix, similar but not identical to kSharpYuvMatrixRec601Limited + kSharpYuvMatrixWebp = 0, + // Kr=0.2990f Kb=0.1140f bit_depth=8 range=kSharpYuvRangeLimited + kSharpYuvMatrixRec601Limited, + // Kr=0.2990f Kb=0.1140f bit_depth=8 range=kSharpYuvRangeFull + kSharpYuvMatrixRec601Full, + // Kr=0.2126f Kb=0.0722f bit_depth=8 range=kSharpYuvRangeLimited + kSharpYuvMatrixRec709Limited, + // Kr=0.2126f Kb=0.0722f bit_depth=8 range=kSharpYuvRangeFull + kSharpYuvMatrixRec709Full, + kSharpYuvMatrixNum +} SharpYuvMatrixType; + +// Returns a pointer to a matrix for one of the predefined colorspaces. +SHARPYUV_EXTERN const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix( + SharpYuvMatrixType matrix_type); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBP_SHARPYUV_SHARPYUV_CSP_H_ diff --git a/data/miniconda3/lib/ImageMagick-7.1.1/config-Q16HDRI/configure.xml b/data/miniconda3/lib/ImageMagick-7.1.1/config-Q16HDRI/configure.xml new file mode 100644 index 0000000000000000000000000000000000000000..6af5cb7d4e3a607d4919fea1ecc420aa8486cbe7 --- /dev/null +++ b/data/miniconda3/lib/ImageMagick-7.1.1/config-Q16HDRI/configure.xml @@ -0,0 +1,50 @@ + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/miniconda3/lib/cairo/libcairo-fdr.so b/data/miniconda3/lib/cairo/libcairo-fdr.so new file mode 100644 index 0000000000000000000000000000000000000000..1c769451405056727448d54d51554ddbcef2aacd Binary files /dev/null and b/data/miniconda3/lib/cairo/libcairo-fdr.so differ diff --git a/data/miniconda3/lib/cairo/libcairo-trace.so b/data/miniconda3/lib/cairo/libcairo-trace.so new file mode 100644 index 0000000000000000000000000000000000000000..367b1b1b240c455e68c142228a03c8a094e8f48e Binary files /dev/null and b/data/miniconda3/lib/cairo/libcairo-trace.so differ diff --git a/data/miniconda3/lib/dbus-1.0/include/dbus/dbus-arch-deps.h b/data/miniconda3/lib/dbus-1.0/include/dbus/dbus-arch-deps.h new file mode 100644 index 0000000000000000000000000000000000000000..74c6e6de606e62a90542eeab8731ac26714bc705 --- /dev/null +++ b/data/miniconda3/lib/dbus-1.0/include/dbus/dbus-arch-deps.h @@ -0,0 +1,65 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir + * + * Copyright (C) 2003 Red Hat, Inc. + * SPDX-License-Identifier: AFL-2.0 OR GPL-2.0-or-later + * + * Licensed under the Academic Free License version 2.0 + * + * 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 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 + * + */ +#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef DBUS_ARCH_DEPS_H +#define DBUS_ARCH_DEPS_H + +#include + +DBUS_BEGIN_DECLS + +/* D-Bus no longer supports platforms with no 64-bit integer type. */ +#define DBUS_HAVE_INT64 1 +_DBUS_GNUC_EXTENSION typedef long dbus_int64_t; +_DBUS_GNUC_EXTENSION typedef unsigned long dbus_uint64_t; +#define DBUS_INT64_MODIFIER "l" + +#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##L)) +#define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##UL)) + +typedef int dbus_int32_t; +typedef unsigned int dbus_uint32_t; + +typedef short dbus_int16_t; +typedef unsigned short dbus_uint16_t; + +#define DBUS_SIZEOF_VOID_P 8 + +/* This is not really arch-dependent, but it's not worth + * creating an additional generated header just for this + */ +#define DBUS_MAJOR_VERSION 1 +#define DBUS_MINOR_VERSION 16 +#define DBUS_MICRO_VERSION 2 + +#define DBUS_VERSION_STRING "1.16.2" + +#define DBUS_VERSION ((1 << 16) | (16 << 8) | (2)) + +DBUS_END_DECLS + +#endif /* DBUS_ARCH_DEPS_H */ diff --git a/data/miniconda3/lib/gettext/cldr-plurals b/data/miniconda3/lib/gettext/cldr-plurals new file mode 100644 index 0000000000000000000000000000000000000000..89d48a33e04fd9fe9ccc21875f8b242dc50a7c55 Binary files /dev/null and b/data/miniconda3/lib/gettext/cldr-plurals differ diff --git a/data/miniconda3/lib/gettext/hostname b/data/miniconda3/lib/gettext/hostname new file mode 100644 index 0000000000000000000000000000000000000000..3f6c7b482683fa58fe670bfeef317ac5dea77bb2 Binary files /dev/null and b/data/miniconda3/lib/gettext/hostname differ diff --git a/data/miniconda3/lib/gettext/project-id b/data/miniconda3/lib/gettext/project-id new file mode 100644 index 0000000000000000000000000000000000000000..e20bf11c45d63d3a8ce69caa1cad65baa404e9e6 --- /dev/null +++ b/data/miniconda3/lib/gettext/project-id @@ -0,0 +1,86 @@ +#!/bin/sh +# Prints a package's identification PACKAGE VERSION or PACKAGE. +# +# Copyright (C) 2001-2003, 2005, 2014 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 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 . + +want_version="$1" + +# NLS nuisances: Letter ranges are different in the Estonian locale. +LC_ALL=C + +while true; do + if test -f configure; then + package=`(grep '^PACKAGE_NAME=' configure; grep '^ *PACKAGE=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"` + case "$package" in + *[\"\$\`\{\}]*) + # Some packages (gcal) retrieve the package name dynamically. + package= + ;; + esac + if test -n "$package"; then + is_gnu=`LC_ALL=C grep "GNU $package" * 2>/dev/null | grep -v '^libtool:'` + if test -n "$is_gnu"; then + package="GNU $package" + fi + if test -n "$want_version"; then + version=`(grep '^PACKAGE_VERSION=' configure; grep '^ *VERSION=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"` + case "$version" in + *[\"\$\`\{\}]*) + # Some packages (gcal, gcc, clisp) retrieve the version dynamically. + version= + ;; + esac + if test -n "$version"; then + echo "$package $version" + else + echo "$package" + fi + else + echo "$package" + fi + exit 0 + fi + fi + dir=`basename "\`pwd\`"` + case "$dir" in + i18n) + # This directory name, used in GNU make, is not the top level directory. + ;; + *[A-Za-z]*[0-9]*) + package=`echo "$dir" | sed -e 's/^\([^0-9]*\)[0-9].*$/\1/' -e 's/[-_]$//'` + if test -n "$want_version"; then + version=`echo "$dir" | sed -e 's/^[^0-9]*\([0-9].*\)$/\1/'` + echo "$package $version" + else + echo "$package" + fi + exit 0 + ;; + esac + # Go to parent directory + last=`/bin/pwd` + cd .. + curr=`/bin/pwd` + if test "$last" = "$curr"; then + # Oops, didn't find the package name. + if test -n "$want_version"; then + echo "PACKAGE VERSION" + else + echo "PACKAGE" + fi + exit 0 + fi +done diff --git a/data/miniconda3/lib/gettext/urlget b/data/miniconda3/lib/gettext/urlget new file mode 100644 index 0000000000000000000000000000000000000000..5f804ac4f00957f356f5226aacc6f5a89d9b2d9d Binary files /dev/null and b/data/miniconda3/lib/gettext/urlget differ diff --git a/data/miniconda3/lib/gettext/user-email b/data/miniconda3/lib/gettext/user-email new file mode 100644 index 0000000000000000000000000000000000000000..9ff7e49ccc4fba22f98d15cbc83db4a3b781955a --- /dev/null +++ b/data/miniconda3/lib/gettext/user-email @@ -0,0 +1,435 @@ +#!/bin/sh +# Prints the user's email address, with confirmation from the user. +# +# Copyright (C) 2001-2003, 2005, 2013 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 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 . + +# Prerequisites for using ${exec_prefix}/lib and ${datarootdir}/locale. +prefix="/home/zangyihe/miniconda3" +exec_prefix="${prefix}" +datarootdir="${prefix}/share" +datadir="${datarootdir}" +# Set variables libdir, localedir. +libdir="${exec_prefix}/lib" +localedir="${datarootdir}/locale" + +# Support for relocatability. +if test "no" = yes; then + orig_installdir="$libdir"/gettext # see Makefile.am's install rule + # Determine curr_installdir without caring for symlinked callers. + curr_installdir=`echo "$0" | sed -e 's,/[^/]*$,,'` + curr_installdir=`cd "$curr_installdir" && pwd` + # Compute the original/current installation prefixes by stripping the + # trailing directories off the original/current installation directories. + while true; do + orig_last=`echo "$orig_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'` + curr_last=`echo "$curr_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'` + if test -z "$orig_last" || test -z "$curr_last"; then + break + fi + if test "$orig_last" != "$curr_last"; then + break + fi + orig_installdir=`echo "$orig_installdir" | sed -e 's,/[^/]*$,,'` + curr_installdir=`echo "$curr_installdir" | sed -e 's,/[^/]*$,,'` + done + # Now relocate the directory variables that we use. + libdir=`echo "$libdir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'` + localedir=`echo "$localedir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'` +fi + +# Internationalization. +. gettext.sh +TEXTDOMAIN=gettext-tools +export TEXTDOMAIN +TEXTDOMAINDIR="$localedir" +export TEXTDOMAINDIR + +# Redirect fileno 3 to interactive I/O. +exec 3>/dev/tty + +# Output a prompt. +if test $# != 0; then + echo "$1" 1>&3 +fi + +# Find the user name on the local machine. +user=`id -u -n 2>/dev/null` +if test -z "$user"; then + user="$USER" + if test -z "$user"; then + user="$LOGNAME" + if test -z "$user"; then + user=unknown + fi + fi +fi + +# Find the hostname. +# hostname on some systems (SVR3.2, old Linux) returns a bogus exit status, +# so uname gets run too, so we keep only the first line of output. +#host=`(hostname || uname -n) 2>/dev/null | sed 1q` +host=`"$libdir"/gettext/hostname --short 2>/dev/null | sed 1q` + +# Find the hostname. +hostfqdn=`"$libdir"/gettext/hostname --fqdn 2>/dev/null | sed 1q` + +# Find a list of email addresses from various mailer configuration files. +# All mailers use configuration files under $HOME. We handle them in a +# last-modified - first-priority order. +cd $HOME +files="" + +# ----------------------- BEGIN MAILER SPECIFIC CODE ----------------------- + +# Mozilla Thunderbird addresses +files="$files .thunderbird/*/prefs.js" + +# Mozilla addresses +files="$files .mozilla/*/prefs.js" + +# Netscape 4 addresses +files="$files .netscape/liprefs.js .netscape/preferences.js" + +# Netscape 3 addresses +files="$files .netscape/preferences" + +# Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses +# XEmacs mew addresses +files="$files .emacs .emacs.el" + +# KDE2 addresses +files="$files .kde2/share/config/emaildefaults" + +# KDE kmail addresses +files="$files .kde2/share/config/kmailrc" + +# GNOME evolution 2 addresses +files="$files .gconf/apps/evolution/mail/%gconf.xml" + +# GNOME evolution 1 addresses +files="$files evolution/config.xmldb" + +# GNOME balsa addresses +files="$files .gnome/balsa" + +# StarOffice and OpenOffice addresses +sed_dos2unix='s/\r$//' +sed_soffice51='s,StarOffice 5\.1=\(.*\)$,\1/sofficerc,p' +sed_soffice52='s,StarOffice 5\.2=\(.*\)$,\1/user/sofficerc,p' +sed_ooffice='s,^OpenOffice[^=]*=\(.*\)$,\1/user/config/registry/instance/org/openoffice/UserProfile.xml,p' +files="$files Office51/sofficerc Office52/user/sofficerc "`sed -n -e "$sed_dos2unix" -e "$sed_soffice51" -e "$sed_soffice52" -e "$sed_ooffice" .sversionrc 2>/dev/null | sed -e 's,^file://*,/,'` + +# mutt addresses +files="$files .muttrc" + +# pine addresses +files="$files .pinerc" + +# xfmail addresses +files="$files .xfmail/.xfmailrc" + +# tkrat addresses +files="$files .ratatosk/ratatoskrc" + +# ----------------------- END MAILER SPECIFIC CODE ----------------------- + +# Expand wildcards and remove nonexistent files from the list. +nfiles="" +for file in $files; do + if test -r "$file" && test ! -d "$file"; then + nfiles="$nfiles $file" + fi +done +files="$nfiles" + +addresses="" + +if test -n "$files"; then + + for file in `ls -t $files`; do + + case "$file" in + +# ----------------------- BEGIN MAILER SPECIFIC CODE ----------------------- + + # Mozilla and Mozilla Thunderbird addresses + .mozilla/*/prefs.js | .thunderbird/*/prefs.js) + addresses="$addresses "`grep -h '^user_pref("mail\.identity\..*\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\..*\.useremail", "\(.*\)");$/\1/'` + ;; + + # Netscape 4 addresses + .netscape/liprefs.js | .netscape/preferences.js) + addresses="$addresses "`grep -h '^user_pref("mail\.identity\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\.useremail", "\(.*\)");$/\1/'` + ;; + + # Netscape 3 addresses + .netscape/preferences) + addresses="$addresses "`grep -h '^EMAIL_ADDRESS:' $file 2>/dev/null | sed -e 's/^EMAIL_ADDRESS:[ ]*//'` + ;; + + .emacs | .emacs.el) + # Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses + addresses="$addresses "`grep -h '[ (]user-mail-address "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]user-mail-address "\([^"]*\)".*$/\1/'` + # XEmacs mew addresses + domains=`grep -h '[ (]mew-mail-domain "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]mew-mail-domain "\([^"]*\)".*$/\1/'` + if test -n "$domains"; then + for domain in $domains; do + addresses="$addresses ${user}@$domain" + done + fi + ;; + + # KDE2 addresses + .kde2/share/config/emaildefaults) + addresses="$addresses "`grep -h '^EmailAddress=' $file 2>/dev/null | sed -e 's/^EmailAddress=//'` + ;; + + # KDE kmail addresses + .kde2/share/config/kmailrc) + addresses="$addresses "`grep -h '^Email Address=' $file 2>/dev/null | sed -e 's/^Email Address=//'` + ;; + + # GNOME evolution 2 addresses + .gconf/apps/evolution/mail/%gconf.xml) + sedexpr0='s,^.*<addr-spec>\(.*\)</addr-spec>.*$,\1,p' + addresses="$addresses "`sed -n -e "$sedexpr0" < $file` + ;; + + # GNOME evolution 1 addresses + evolution/config.xmldb) + sedexpr0='s/^.*\(.*\).*$,\1,p' $file 2>/dev/null` + ;; + + # StarOffice addresses + # Not a typo. They really write "Adress" with a single d. + # German orthography... + */sofficerc) + addresses="$addresses "`grep -h '^User-Adress=' $file 2>/dev/null | sed -e 's/#[^#]*$//' -e 's/^.*#//'` + ;; + + # mutt addresses + .muttrc) + mutt_addresses=`grep -h '^set from="[^"]*"[ ]*$' $file 2>/dev/null | sed -e 's/^set from="\([^"]*\)"[ ]*$/\1/'` + if test -n "$mutt_addresses"; then + addresses="$addresses $mutt_addresses" + else + # mutt uses $EMAIL as fallback. + if test -n "$EMAIL"; then + addresses="$addresses $EMAIL" + fi + fi + ;; + + # pine addresses + .pinerc) + domains=`grep -h '^user-domain=' $file 2>/dev/null | sed -e 's/^user-domain=//'` + if test -n "$domains"; then + for domain in $domains; do + addresses="$addresses ${user}@$domain" + done + else + # The use-only-domain-name option is only used if the user-domain option is not present. + domains=`grep -h '^use-only-domain-name=' $file 2>/dev/null | sed -e 's/^use-only-domain-name=//'` + if test "Yes" = "$domains"; then + addresses="$addresses ${user}@"`echo "$hostfqdn" | sed -e 's/^[^.]*\.//'` + fi + fi + ;; + + # xfmail addresses + .xfmail/.xfmailrc) + addresses="$addresses "`grep -h '^from=.*<.*>' $file 2>/dev/null | sed -e 's/^.*<\([^<>]*\)>.*$/\1/'` + ;; + + # tkrat addresses + .ratatosk/ratatoskrc) + domains=`grep -h '^set option(masquerade_as) ' $file 2>/dev/null | sed -e 's/^set option(masquerade_as) //'` + if test -n "$domains"; then + for domain in $domains; do + addresses="$addresses ${user}@$domain" + done + else + # The domain option is used only if the masquerade_as option is not present. + domains=`grep -h '^set option(domain) ' $file 2>/dev/null | sed -e 's/^set option(domain) //'` + if test -n "$domains"; then + for domain in $domains; do + addresses="$addresses ${user}@${host}.$domain" + done + fi + fi + ;; + +# ----------------------- END MAILER SPECIFIC CODE ----------------------- + + esac + + done + +fi + +# Some Debian systems have a file /etc/mailname. +if test -r /etc/mailname; then + hostmailname=`cat /etc/mailname` + if test -n "$hostmailname"; then + addresses="$addresses ${user}@$hostmailname" + fi +fi + +# SuSE Linux >= 8.0 systems have a file /etc/sysconfig/mail. +if test -r /etc/sysconfig/mail; then + hostmailname=`. /etc/sysconfig/mail && echo "$FROM_HEADER"` + if test -n "$hostmailname"; then + addresses="$addresses ${user}@$hostmailname" + fi +fi + +# elm has no user-defined addresses. +# mailx has no user-defined addresses. +# mh has no user-defined addresses. +# They use the system default. +addresses="$addresses ${user}@$hostfqdn" + +# Normalize addresses: remove addresses without @, lowercase the part after @, +# and remove duplicates. +lowercase_sed='{ +h +s/^[^@]*@\(.*\)$/\1/ +y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ +x +s/^\([^@]*\)@.*/\1@/ +G +s/\n// +p +}' +naddresses="" +for addr in $addresses; do + case "$addr" in + "<"*">") addr=`echo "$addr" | sed -e 's/^$//'` ;; + esac + case "$addr" in + *@*) + addr=`echo "$addr" | sed -n -e "$lowercase_sed"` + case " $naddresses " in + *" $addr "*) ;; + *) naddresses="$naddresses $addr" ;; + esac + ;; + esac +done +addresses="$naddresses" + +# Now it's time to ask the user. +case "$addresses" in + " "*" "*) + # At least two addresses. + lines="" + i=0 + for addr in $addresses; do + i=`expr $i + 1` + lines="${lines}${i} ${addr} +" + done + while true; do + { gettext "Which is your email address?"; echo; } 1>&3 + echo "$lines" 1>&3 + { gettext "Please choose the number, or enter your email address."; echo; } 1>&3 + read answer < /dev/tty + case "$answer" in + *@*) ;; + [0-9]*) + i=0 + for addr in $addresses; do + i=`expr $i + 1` + if test "$i" = "$answer"; then + break 2 + fi + done + ;; + esac + case "$answer" in + "<"*">") answer=`echo "$answer" | sed -e 's/^$//'` ;; + esac + case "$answer" in + *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;; + *@*.*) ;; + *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;; + *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;; + esac + addr=`echo "$answer" | sed -n -e "$lowercase_sed"` + break + done + ;; + " "*) + # One address. + while true; do + { gettext "Is the following your email address?"; echo; } 1>&3 + echo " $addresses" 1>&3 + { gettext "Please confirm by pressing Return, or enter your email address."; echo; } 1>&3 + read answer < /dev/tty + if test -z "$answer"; then + addr=`echo "$addresses" | sed -e 's/^ //'` + break + fi + case "$answer" in + "<"*">") answer=`echo "$answer" | sed -e 's/^$//'` ;; + esac + case "$answer" in + *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;; + *@*.*) ;; + *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;; + *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;; + esac + addr=`echo "$answer" | sed -n -e "$lowercase_sed"` + break + done + ;; + "") + # No address. + { gettext "Couldn't find out about your email address."; echo; } 1>&3 + while true; do + { gettext "Please enter your email address."; echo; } 1>&3 + read answer < /dev/tty + case "$answer" in + "<"*">") answer=`echo "$answer" | sed -e 's/^$//'` ;; + esac + case "$answer" in + *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;; + *@*.*) ;; + *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;; + *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;; + esac + addr=`echo "$answer" | sed -n -e "$lowercase_sed"` + break + done + ;; + *) echo "internal error" 1>&3 ; exit 1 ;; +esac + +# Print to standard output. +echo "$addr" diff --git a/data/miniconda3/lib/girepository-1.0/Atk-1.0.typelib b/data/miniconda3/lib/girepository-1.0/Atk-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..7c086d053fe6b0438ae844a09591a5e6d48179eb Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/Atk-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GIRepository-3.0.typelib b/data/miniconda3/lib/girepository-1.0/GIRepository-3.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..0b2c7a9227417b8c240d95b875e6c239565d97ad Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GIRepository-3.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GLibUnix-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GLibUnix-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..5874520286c4ddd914cd387b9731c6f771cabd19 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GLibUnix-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GModule-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GModule-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..4fbb03526da707a984ec5916e5927756ef13dffd Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GModule-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GObject-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GObject-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..09075e701619e6c43000f1682c1a419d4f61fa2a Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GObject-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GdkPixbuf-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GdkPixbuf-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..4383c9cdc7a048d929028a1309667dff90722fd8 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GdkPixbuf-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GdkPixdata-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GdkPixdata-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..09fcb259df3b13b6d34502b4d45ccb167d23318b Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GdkPixdata-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GdkX11-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GdkX11-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..847d4db0c18b0737f5b3c038bcf1059eeacea560 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GdkX11-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/GioUnix-2.0.typelib b/data/miniconda3/lib/girepository-1.0/GioUnix-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..7799e92758dff209b1391cdadb2d5f64fc2d177a Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/GioUnix-2.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/Pango-1.0.typelib b/data/miniconda3/lib/girepository-1.0/Pango-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..25dd4a97e1ffb44bc0353dda05198f687a5c3c9c Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/Pango-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/PangoCairo-1.0.typelib b/data/miniconda3/lib/girepository-1.0/PangoCairo-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..a2c7fdbecc5dcfa4d502e5f00347ac21c307d602 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/PangoCairo-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/PangoFT2-1.0.typelib b/data/miniconda3/lib/girepository-1.0/PangoFT2-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..88ae2dfc21782109463456752aa94dff9c35b9c6 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/PangoFT2-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/PangoFc-1.0.typelib b/data/miniconda3/lib/girepository-1.0/PangoFc-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..242a293ab7c59891df15ea9fc92b7f804ce3d169 Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/PangoFc-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/PangoOT-1.0.typelib b/data/miniconda3/lib/girepository-1.0/PangoOT-1.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..cf354b5df9b1f7e629b324b976b40eb9a5733eaa Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/PangoOT-1.0.typelib differ diff --git a/data/miniconda3/lib/girepository-1.0/Rsvg-2.0.typelib b/data/miniconda3/lib/girepository-1.0/Rsvg-2.0.typelib new file mode 100644 index 0000000000000000000000000000000000000000..bc7a6e4028c42725acc0f6806ac452dc38d61fae Binary files /dev/null and b/data/miniconda3/lib/girepository-1.0/Rsvg-2.0.typelib differ diff --git a/data/miniconda3/lib/graphviz/config6 b/data/miniconda3/lib/graphviz/config6 new file mode 100644 index 0000000000000000000000000000000000000000..ccc771b2d53d1e13d17e0703af94fcf1f5405c33 --- /dev/null +++ b/data/miniconda3/lib/graphviz/config6 @@ -0,0 +1,298 @@ +# This file was generated by "dot -c" at time of install. + +# You may temporarily disable a plugin by removing or commenting out +# a line in this file, or you can modify its "quality" value to affect +# default plugin selection. + +# Manual edits to this file **will be lost** on upgrade. + +libgvplugin_core.so.6 core { + device { + dot:dot 1 + gv:dot 1 + canon:dot 1 + plain:dot 1 + plain-ext:dot 1 + xdot:xdot 1 + xdot1.2:xdot 1 + xdot1.4:xdot 1 + } + device { + fig:fig 1 + } + device { + ismap:map 1 + cmap:map 1 + imap:map 1 + cmapx:map 1 + imap_np:map 1 + cmapx_np:map 1 + } + device { + mp:mp -1 + } + device { + ps:ps 1 + ps2:ps 1 + eps:ps 1 + } + device { + svg:svg 1 + svgz:svg 1 + } + device { + json:json 1 + json0:json 1 + dot_json:json 1 + xdot_json:json 1 + } + device { + tk:tk 1 + } + device { + vml:vml 1 + vmlz:vml 1 + } + device { + pic:pic -1 + } + device { + pov:pov 1 + } + render { + dot 1 + xdot 1 + } + render { + fig 1 + } + render { + map 1 + } + render { + mp -1 + } + render { + ps 1 + } + render { + svg 1 + } + render { + json 1 + json0 1 + dot_json 1 + xdot_json 1 + } + render { + tk 1 + } + render { + vml 1 + } + render { + pic -1 + } + render { + pov 1 + } + loadimage { + png:svg 1 + gif:svg 1 + jpeg:svg 1 + jpe:svg 1 + jpg:svg 1 + png:fig 1 + gif:fig 1 + jpeg:fig 1 + jpe:fig 1 + jpg:fig 1 + png:vrml 1 + gif:vrml 1 + jpeg:vrml 1 + jpe:vrml 1 + jpg:vrml 1 + eps:ps 1 + ps:ps 1 + (lib):ps 1 + png:map 1 + gif:map 1 + jpeg:map 1 + jpe:map 1 + jpg:map 1 + ps:map 1 + eps:map 1 + svg:map 1 + png:dot 1 + gif:dot 1 + jpeg:dot 1 + jpe:dot 1 + jpg:dot 1 + ps:dot 1 + eps:dot 1 + svg:dot 1 + png:xdot 1 + gif:xdot 1 + jpeg:xdot 1 + jpe:xdot 1 + jpg:xdot 1 + ps:xdot 1 + eps:xdot 1 + svg:xdot 1 + svg:svg 1 + png:vml 1 + gif:vml 1 + jpeg:vml 1 + jpe:vml 1 + jpg:vml 1 + gif:tk 1 + } +} +libgvplugin_dot_layout.so.6 dot_layout { + layout { + dot 0 + } +} +libgvplugin_gd.so.6 gd { + render { + gd 1 + } + render { + vrml 1 + } + textlayout { + textlayout 2 + } + loadimage { + gd:gd 1 + gd2:gd 1 + gif:gd 1 + jpeg:gd 1 + jpe:gd 1 + jpg:gd 1 + png:gd 1 + xbm:gd 1 + gd:ps 1 +#FAILS gd:lasi 1 + gd2:ps 1 +#FAILS gd2:lasi 1 + gif:ps 1 +#FAILS gif:lasi 1 + jpeg:ps 1 + jpg:ps 1 + jpe:ps 1 +#FAILS jpeg:lasi 1 +#FAILS jpg:lasi 1 +#FAILS jpe:lasi 1 + png:ps 1 +#FAILS png:lasi 1 + xbm:ps 1 +#FAILS xbm:lasi 1 + gd:cairo 1 + gd2:cairo 1 + gif:cairo 1 + jpeg:cairo 1 + jpg:cairo 1 + jpe:cairo 1 + png:cairo -1 + xbm:cairo 1 + } + device { + gif:cairo 10 + wbmp:cairo 5 + jpe:cairo 5 + jpeg:cairo 5 + jpg:cairo 5 + png:cairo 5 + gd:cairo 5 + gd2:cairo 5 + } + device { + gif:gd 1 + wbmp:gd 1 + jpe:gd 1 + jpeg:gd 1 + jpg:gd 1 + png:gd 1 + gd:gd 1 + gd2:gd 1 + } + device { + vrml:vrml 1 + } +} +libgvplugin_gdk.so.6 gdk { + device { + bmp:cairo 6 + ico:cairo 6 + jpe:cairo 6 + jpeg:cairo 6 + jpg:cairo 6 + png:cairo 6 + tif:cairo 6 + tiff:cairo 6 + } + loadimage { + bmp:cairo 1 + jpe:cairo 2 + jpg:cairo 2 + jpeg:cairo 2 + png:cairo -1 + ico:cairo 1 + } +} +libgvplugin_neato_layout.so.6 neato_layout { + layout { + neato 0 + fdp 0 + sfdp 0 + twopi 0 + circo 0 + patchwork 0 + osage 0 + nop 0 + nop1 0 + nop2 0 + } +} +libgvplugin_pango.so.6 cairo { + render { + cairo 10 + } + textlayout { + textlayout 10 + } + loadimage { + png:cairo 1 +#FAILS png:lasi 2 + png:ps 2 + } + device { + png:cairo 10 + ps:cairo -10 + eps:cairo -10 + pdf:cairo 10 + svg:cairo -10 + } +} +libgvplugin_rsvg.so.6 rsvg { + loadimage { + svg:cairo 1 + } +} +libgvplugin_visio.so.6 visio { + device { + vdx:visio 1 + } + render { + visio 1 + } +} +libgvplugin_webp.so.6 webp { + device { + webp:cairo 1 + } + loadimage { + webp:cairo 1 + } +} diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gd.so b/data/miniconda3/lib/graphviz/libgvplugin_gd.so new file mode 100644 index 0000000000000000000000000000000000000000..3d383c6de1b086be1615f1cf9b5a9af82ddab8a4 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gd.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..3d383c6de1b086be1615f1cf9b5a9af82ddab8a4 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..3d383c6de1b086be1615f1cf9b5a9af82ddab8a4 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gd.so.6.0.0 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gdk.so b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so new file mode 100644 index 0000000000000000000000000000000000000000..f86b907c2336fdec267140649efb32438565beb1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..f86b907c2336fdec267140649efb32438565beb1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..f86b907c2336fdec267140649efb32438565beb1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_gdk.so.6.0.0 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_pango.so b/data/miniconda3/lib/graphviz/libgvplugin_pango.so new file mode 100644 index 0000000000000000000000000000000000000000..b7b4b53b69923d732a9c62d39437a340376815e1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_pango.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..b7b4b53b69923d732a9c62d39437a340376815e1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..b7b4b53b69923d732a9c62d39437a340376815e1 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_pango.so.6.0.0 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so new file mode 100644 index 0000000000000000000000000000000000000000..b79bdac9e5ea2b56a7bf36492e9729a09a93f3d9 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..b79bdac9e5ea2b56a7bf36492e9729a09a93f3d9 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..b79bdac9e5ea2b56a7bf36492e9729a09a93f3d9 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_rsvg.so.6.0.0 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_visio.so b/data/miniconda3/lib/graphviz/libgvplugin_visio.so new file mode 100644 index 0000000000000000000000000000000000000000..ac643807f5919d1ddc5876331e14d4ed4f63a3ef Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_visio.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..ac643807f5919d1ddc5876331e14d4ed4f63a3ef Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..ac643807f5919d1ddc5876331e14d4ed4f63a3ef Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_visio.so.6.0.0 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_webp.so b/data/miniconda3/lib/graphviz/libgvplugin_webp.so new file mode 100644 index 0000000000000000000000000000000000000000..e708cce523e56a200c9980fdd8ac94ddcebeb827 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_webp.so differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6 b/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..e708cce523e56a200c9980fdd8ac94ddcebeb827 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6 differ diff --git a/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6.0.0 b/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..e708cce523e56a200c9980fdd8ac94ddcebeb827 Binary files /dev/null and b/data/miniconda3/lib/graphviz/libgvplugin_webp.so.6.0.0 differ diff --git a/data/miniconda3/lib/icu/Makefile.inc b/data/miniconda3/lib/icu/Makefile.inc new file mode 100644 index 0000000000000000000000000000000000000000..873f7ab6ceda08d408fbcee1d15e8ef855c20248 --- /dev/null +++ b/data/miniconda3/lib/icu/Makefile.inc @@ -0,0 +1,292 @@ +# Copyright (C) 2016 and later: Unicode, Inc. and others. +# License & terms of use: http://www.unicode.org/copyright.html +## -*-makefile-*- +#****************************************************************************** +# Copyright (C) 1999-2014, International Business Machines +# Corporation and others. All Rights Reserved. +#****************************************************************************** +# This Makefile.inc is designed to be included into projects which make use +# of the ICU. + +# CONTENTS OF THIS FILE +# 1). Base configuration information and linkage +# 2). Variables giving access to ICU tools +# 3). Host information +# 4). Compiler flags and settings +# 5). Data Packaging directives +# 6). Include of platform make fragment (mh-* file) + +################################################################## +################################################################## +# +# *1* base configuration information and linkage +# +################################################################## +# The PREFIX is the base of where ICU is installed. +# Inside this directory you should find bin, lib, include/unicode, +# etc. If ICU is not installed in this directory, you must change the +# following line. There should exist $(prefix)/include/unicode/utypes.h +# for example. +prefix = /home/zangyihe/miniconda3 +exec_prefix = ${prefix} +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +bindir = ${exec_prefix}/bin +datarootdir = ${prefix}/share +datadir = ${datarootdir} +sbindir = ${exec_prefix}/sbin + +# about the ICU version +VERSION = 73.1 +UNICODE_VERSION = 15.0 + +# The prefix for ICU libraries, normally 'icu' +ICUPREFIX = icu +PACKAGE = icu +LIBICU = lib$(ICUPREFIX) + +# Static library prefix and file extension +STATIC_PREFIX = s +LIBSICU = lib$(STATIC_PREFIX)$(ICUPREFIX) +A = a + +# Suffix at the end of libraries. Usually empty. +ICULIBSUFFIX = +# ICULIBSUFFIX_VERSION is non-empty if it is to contain a library +# version. For example, if it is 21, it means libraries are named +# libicuuc21.so for example. + +# rpath links a library search path right into the binaries. +## mh-files MUST NOT override RPATHLDFLAGS unless they provide +## equivalent '#SH#' lines for icu-config fixup +ENABLE_RPATH = NO +ifeq ($(ENABLE_RPATH),YES) +RPATHLDFLAGS = $(LD_RPATH)$(LD_RPATH_PRE)$(libdir) +endif + +#SH## icu-config version of above 'if': +#SH#case "x$ENABLE_RPATH" in +#SH# x[yY]*) +#SH# ENABLE_RPATH=YES +#SH# RPATHLDFLAGS="${LD_RPATH}${LD_RPATH_PRE}${libdir}" +#SH# ;; +#SH# +#SH# x[nN]*) +#SH# ENABLE_RPATH=NO +#SH# RPATHLDFLAGS="" +#SH# ;; +#SH# +#SH# x) +#SH# ENABLE_RPATH=NO +#SH# RPATHLDFLAGS="" +#SH# ;; +#SH# +#SH# *) +#SH# echo $0: Unknown --enable-rpath value ${ENABLE_RPATH} 1>&2 +#SH# exit 3 +#SH# ;; +#SH#esac + +# Name flexibility for the library naming scheme. Any modifications should +# be made in the mh- file for the specific platform. +DATA_STUBNAME = data +COMMON_STUBNAME = uc +I18N_STUBNAME = i18n +LAYOUTEX_STUBNAME = lx +IO_STUBNAME = io +TOOLUTIL_STUBNAME = tu +CTESTFW_STUBNAME = test + + + +### To link your application with ICU: +# 1. use LDFLAGS, CFLAGS, etc from above +# 2. link with $(ICULIBS) +# 3. optionally, add one or more of: +# - $(ICULIBS_I18N) - i18n library, formatting, etc. +# - $(ICULIBS_ICUIO) - ICU stdio equivalent library + +ICULIBS_COMMON = -l$(ICUPREFIX)uc$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_DATA = -l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_I18N = -l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_TOOLUTIL = -l$(ICUPREFIX)tu$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_CTESTFW = -l$(ICUPREFIX)ctestfw$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_ICUIO = -l$(ICUPREFIX)io$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_OBSOLETE = -l$(ICUPREFIX)obsolete$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_LAYOUTEX = -l$(ICUPREFIX)lx$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION) +ICULIBS_BASE = -L$(libdir) + +# for icu-config to test with +ICULIBS_COMMON_LIB_NAME = ${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO} +ICULIBS_COMMON_LIB_NAME_A = ${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A} + +# ICULIBS is the set of libraries your application should link +# with usually. Many applications will want to add $(ICULIBS_I18N) as well. +ICULIBS = $(ICULIBS_BASE) $(ICULIBS_I18N) $(ICULIBS_COMMON) $(ICULIBS_DATA) + +# Proper echo newline handling is needed in icu-config +ECHO_N=-n +ECHO_C= +# Not currently being used but good to have for proper tab handling +ECHO_T= + +################################################################## +################################################################## +# +# *2* access to ICU tools +# +################################################################## +# Environment variable to set a runtime search path +# (Overridden when necessary in -mh files) +LDLIBRARYPATH_ENVVAR = LD_LIBRARY_PATH + +# Versioned target for a shared library +FINAL_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION) +MIDDLE_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION_MAJOR) + +# Access to important ICU tools. +# Use as follows: $(INVOKE) $(GENRB) arguments .. +INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(libdir):$$$(LDLIBRARYPATH_ENVVAR) $(LEAK_CHECKER) +GENCCODE = $(sbindir)/genccode +ICUPKG = $(sbindir)/icupkg +GENCMN = $(sbindir)/gencmn +GENRB = $(bindir)/genrb +PKGDATA = $(bindir)/pkgdata + +# moved here because of dependencies +pkgdatadir = $(datadir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION) +pkglibdir = $(libdir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION) + +################################################################## +################################################################## +# +# *3* Information about the host +# +################################################################## + +# Information about the host that 'configure' was run on. +host = x86_64-conda-linux-gnu +host_alias = x86_64-conda-linux-gnu +host_cpu = x86_64 +host_vendor = conda +host_os = linux-gnu +# Our platform canonical name (as determined by configure) +# this is a #define value (i.e. U_XXXX or XXXX) +platform = U_LINUX + +################################################################## +################################################################## +# +# *4* compiler flags and misc. options +# +################################################################## +AR = /croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ar +# initial tab keeps it out of the shell version. + ARFLAGS := $(ARFLAGS) +#SH#ARFLAGS=" ${ARFLAGS}" +CC = /croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cc +CPP = /croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cpp +CFLAGS = +CPPFLAGS = -I$(prefix)/include +CXXFLAGS = +CXX = /croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-c++ +DEFAULT_MODE = dll +DEFS = -DPACKAGE_NAME=\"ICU\" -DPACKAGE_TARNAME=\"International\ Components\ for\ Unicode\" -DPACKAGE_VERSION=\"73.1\" -DPACKAGE_STRING=\"ICU\ 73.1\" -DPACKAGE_BUGREPORT=\"http://icu-project.org/bugs\" -DPACKAGE_URL=\"http://icu-project.org\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DHAVE_LIBM=1 -DHAVE_ELF_H=1 -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_LIBPTHREAD=1 -DHAVE_INTTYPES_H=1 -DHAVE_DIRENT_H=1 -DHAVE_WCHAR_H=1 -DSIZEOF_WCHAR_T=4 +# use a consistent INSTALL +INSTALL = $(SHELL) $(pkgdatadir)/install-sh -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +LDFLAGS = $(RPATHLDFLAGS) +LIBS = -lpthread -ldl -lm +LIB_M = +LIB_VERSION = 73.1 +LIB_VERSION_MAJOR = 73 +MKINSTALLDIRS = $(SHELL) $(pkgdatadir)/mkinstalldirs +RANLIB = /croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ranlib +RMV = rm -rf +SHELL = /bin/sh +SHLIB.c= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared +SHLIB.cc= $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -shared +U_IS_BIG_ENDIAN = 0 +includedir = ${prefix}/include +infodir = ${datarootdir}/info +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +oldincludedir = /usr/include +program_transform_name = s,x,x, +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +INSTALL-L = ${INSTALL_DATA} + +# for derivative builds - don't bother with VERBOSE/NONVERBOSE SILENT_COMPILE +SILENT_COMPILE=$(1) #M# +ICU_MSG=@echo " $(1) " #M# + +################################################################## +################################################################## +# +# *5* packaging options and directories +# +################################################################## + + +# The basename of the ICU data file (i.e. icudt21b ) +ICUDATA_CHAR = l +ICUDATA_NAME = icudt73l + +# Defaults for pkgdata's mode and directories +# The default data dir changes depending on what packaging mode +# is being used +ifeq ($(strip $(PKGDATA_MODE)),) +#SH# if [ "x$PKGDATA_MODE" = "x" ]; +#SH# then +PKGDATA_MODE=dll +#SH# fi +endif + +#SH# case "$PKGDATA_MODE" in +ifeq ($(PKGDATA_MODE),common) +#SH# common) +ICUDATA_DIR = $(pkgdatadir) +ICUPKGDATA_DIR = $(ICUDATA_DIR) +#SH# ;; +else +ifeq ($(PKGDATA_MODE),dll) +#SH# dll) +ICUDATA_DIR = $(pkgdatadir) +ICUPKGDATA_DIR = $(libdir) +#SH# ;; +else +#SH# *) +ICUDATA_DIR = $(pkgdatadir) +ICUPKGDATA_DIR = $(ICUDATA_DIR) +#SH# ;; +endif +endif + +#SH# esac + +GENCCODE_ASSEMBLY = -a gcc + +################################################################## +################################################################## +# +# *6* Inclusion of platform make fragment (mh-* file) +# +################################################################## +# The mh- file ("make fragment") for the platform is included here. +# It may override the above settings. +# It is put last so that the mh-file can override anything. +# The selfcheck is just a sanity check that this makefile is +# parseable. The mh fragment is only included if this does not occur. + +ifeq (selfcheck,$(MAKECMDGOALS)) #M# +selfcheck: #M# + @echo passed #M# +else #M# +include $(pkgdatadir)/config/mh-linux +endif #M# + diff --git a/data/miniconda3/lib/icu/pkgdata.inc b/data/miniconda3/lib/icu/pkgdata.inc new file mode 100644 index 0000000000000000000000000000000000000000..40a64e3311f0d2b15c1db673ee56698afd79c14a --- /dev/null +++ b/data/miniconda3/lib/icu/pkgdata.inc @@ -0,0 +1,17 @@ +GENCCODE_ASSEMBLY_TYPE=-a gcc +SO=so +SOBJ=so +A=a +LIBPREFIX=lib +LIB_EXT_ORDER=.73.1 +COMPILE=/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/zangyihe/miniconda3/include -D_REENTRANT -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=1 -DU_HAVE_XLOCALE_H=1 -DU_HAVE_STRING_VIEW=1 -DU_ATTRIBUTE_DEPRECATED= -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/zangyihe/miniconda3/include -fdebug-prefix-map=/croot/icu_1692293016303/work=/usr/local/src/conda/icu-73.1 -fdebug-prefix-map=/home/zangyihe/miniconda3=/usr/local/src/conda-prefix -std=c11 -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -c +LIBFLAGS=-I/home/zangyihe/miniconda3/include -DPIC -fPIC +GENLIB=/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/zangyihe/miniconda3/include -fdebug-prefix-map=/croot/icu_1692293016303/work=/usr/local/src/conda/icu-73.1 -fdebug-prefix-map=/home/zangyihe/miniconda3=/usr/local/src/conda-prefix -std=c11 -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/zangyihe/miniconda3/lib -Wl,-rpath-link,/home/zangyihe/miniconda3/lib -L/home/zangyihe/miniconda3/lib -shared -Wl,-Bsymbolic +LDICUDTFLAGS=-nodefaultlibs -nostdlib +LD_SONAME=-Wl,-soname -Wl, +RPATH_FLAGS= +BIR_LDFLAGS=-Wl,-Bsymbolic +AR=/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ar +ARFLAGS=r +RANLIB=/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ranlib +INSTALL_CMD=/usr/bin/install -c diff --git a/data/miniconda3/lib/itcl4.3.0/itcl.tcl b/data/miniconda3/lib/itcl4.3.0/itcl.tcl new file mode 100644 index 0000000000000000000000000000000000000000..276abae7bd99d1eea782712006563d0b36671470 --- /dev/null +++ b/data/miniconda3/lib/itcl4.3.0/itcl.tcl @@ -0,0 +1,151 @@ +# +# itcl.tcl +# ---------------------------------------------------------------------- +# Invoked automatically upon startup to customize the interpreter +# for [incr Tcl]. +# ---------------------------------------------------------------------- +# AUTHOR: Michael J. McLennan +# Bell Labs Innovations for Lucent Technologies +# mmclennan@lucent.com +# http://www.tcltk.com/itcl +# ---------------------------------------------------------------------- +# Copyright (c) 1993-1998 Lucent Technologies, Inc. +# ====================================================================== +# See the file "license.terms" for information on usage and +# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +proc ::itcl::delete_helper { name args } { + ::itcl::delete object $name +} + +# ---------------------------------------------------------------------- +# USAGE: local ? ...? +# +# Creates a new object called in class , passing +# the remaining 's to the constructor. Unlike the usual +# [incr Tcl] objects, however, an object created by this procedure +# will be automatically deleted when the local call frame is destroyed. +# This command is useful for creating objects that should only remain +# alive until a procedure exits. +# ---------------------------------------------------------------------- +proc ::itcl::local {class name args} { + set ptr [uplevel [list $class $name] $args] + uplevel [list set itcl-local-$ptr $ptr] + set cmd [uplevel namespace which -command $ptr] + uplevel [list trace add variable itcl-local-$ptr unset \ + "::itcl::delete_helper $cmd"] + return $ptr +} + +# ---------------------------------------------------------------------- +# auto_mkindex +# ---------------------------------------------------------------------- +# Define Itcl commands that will be recognized by the auto_mkindex +# parser in Tcl... +# + +# +# USAGE: itcl::class name body +# Adds an entry for the given class declaration. +# +foreach __cmd {itcl::class class itcl::type type ictl::widget widget itcl::widgetadaptor widgetadaptor itcl::extendedclass extendedclass} { + auto_mkindex_parser::command $__cmd {name body} { + variable index + variable scriptFile + append index "set [list auto_index([fullname $name])]" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" + + variable parser + variable contextStack + set contextStack [linsert $contextStack 0 $name] + $parser eval $body + set contextStack [lrange $contextStack 1 end] + } +} + +# +# USAGE: itcl::body name arglist body +# Adds an entry for the given method/proc body. +# +foreach __cmd {itcl::body body} { + auto_mkindex_parser::command $__cmd {name arglist body} { + variable index + variable scriptFile + append index "set [list auto_index([fullname $name])]" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" + } +} + +# +# USAGE: itcl::configbody name arglist body +# Adds an entry for the given method/proc body. +# +foreach __cmd {itcl::configbody configbody} { + auto_mkindex_parser::command $__cmd {name body} { + variable index + variable scriptFile + append index "set [list auto_index([fullname $name])]" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" + } +} + +# +# USAGE: ensemble name ?body? +# Adds an entry to the auto index list for the given ensemble name. +# +foreach __cmd {itcl::ensemble ensemble} { + auto_mkindex_parser::command $__cmd {name {body ""}} { + variable index + variable scriptFile + append index "set [list auto_index([fullname $name])]" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" + } +} + +# +# USAGE: public arg ?arg arg...? +# protected arg ?arg arg...? +# private arg ?arg arg...? +# +# Evaluates the arguments as commands, so we can recognize proc +# declarations within classes. +# +foreach __cmd {public protected private} { + auto_mkindex_parser::command $__cmd {args} { + variable parser + $parser eval $args + } +} + +# SF bug #246 unset variable __cmd to avoid problems in user programs!! +unset __cmd + +# ---------------------------------------------------------------------- +# auto_import +# ---------------------------------------------------------------------- +# This procedure overrides the usual "auto_import" function in the +# Tcl library. It is invoked during "namespace import" to make see +# if the imported commands reside in an autoloaded library. If so, +# stubs are created to represent the commands. Executing a stub +# later on causes the real implementation to be autoloaded. +# +# Arguments - +# pattern The pattern of commands being imported (like "foo::*") +# a canonical namespace as returned by [namespace current] + +proc auto_import {pattern} { + global auto_index + + set ns [uplevel namespace current] + set patternList [auto_qualify $pattern $ns] + + auto_load_index + + foreach pattern $patternList { + foreach name [array names auto_index $pattern] { + if {"" == [info commands $name]} { + ::itcl::import::stub create $name + } + } + } +} diff --git a/data/miniconda3/lib/itcl4.3.0/itclConfig.sh b/data/miniconda3/lib/itcl4.3.0/itclConfig.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d4d958f6029ca3efcc6f6012ed58ef55630cd87 --- /dev/null +++ b/data/miniconda3/lib/itcl4.3.0/itclConfig.sh @@ -0,0 +1,67 @@ +# itclConfig.sh -- +# +# This shell script (for sh) is generated automatically by Itcl's +# configure script. It will create shell variables for most of +# the configuration options discovered by the configure script. +# This script is intended to be included by the configure scripts +# for Itcl extensions so that they don't have to figure this all +# out for themselves. This file does not duplicate information +# already provided by tclConfig.sh, so you may need to use that +# file in addition to this one. +# +# The information in this file is specific to a single platform. + +# Itcl's version number. +itcl_VERSION='4.3.0' +ITCL_VERSION='4.3.0' + +# The name of the Itcl library (may be either a .a file or a shared library): +itcl_LIB_FILE=libitcl4.3.0.so +ITCL_LIB_FILE=libitcl4.3.0.so + +# String to pass to linker to pick up the Itcl library from its +# build directory. +itcl_BUILD_LIB_SPEC='-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0 -litcl4.3.0' +ITCL_BUILD_LIB_SPEC='-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0 -litcl4.3.0' + +# String to pass to linker to pick up the Itcl library from its +# installed directory. +itcl_LIB_SPEC='-L/home/zangyihe/miniconda3/lib/itcl4.3.0 -litcl4.3.0' +ITCL_LIB_SPEC='-L/home/zangyihe/miniconda3/lib/itcl4.3.0 -litcl4.3.0' + +# The name of the Itcl stub library (a .a file): +itcl_STUB_LIB_FILE=libitclstub4.3.0.a +ITCL_STUB_LIB_FILE=libitclstub4.3.0.a + +# String to pass to linker to pick up the Itcl stub library from its +# build directory. +itcl_BUILD_STUB_LIB_SPEC='-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0 -litclstub4.3.0' +ITCL_BUILD_STUB_LIB_SPEC='-L/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0 -litclstub4.3.0' + +# String to pass to linker to pick up the Itcl stub library from its +# installed directory. +itcl_STUB_LIB_SPEC='-L/home/zangyihe/miniconda3/lib/itcl4.3.0 -litclstub4.3.0' +ITCL_STUB_LIB_SPEC='-L/home/zangyihe/miniconda3/lib/itcl4.3.0 -litclstub4.3.0' + +# String to pass to linker to pick up the Itcl stub library from its +# build directory. +itcl_BUILD_STUB_LIB_PATH='/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0/libitclstub4.3.0.a' +ITCL_BUILD_STUB_LIB_PATH='/croot/tk_1755243777296/work/tcl8.6.15/unix/pkgs/itcl4.3.0/libitclstub4.3.0.a' + +# String to pass to linker to pick up the Itcl stub library from its +# installed directory. +itcl_STUB_LIB_PATH='/home/zangyihe/miniconda3/lib/itcl4.3.0/libitclstub4.3.0.a' +ITCL_STUB_LIB_PATH='/home/zangyihe/miniconda3/lib/itcl4.3.0/libitclstub4.3.0.a' + +# Location of the top-level source directories from which [incr Tcl] +# was built. This is the directory that contains generic, unix, etc. +# If [incr Tcl] was compiled in a different place than the directory +# containing the source files, this points to the location of the sources, +# not the location where [incr Tcl] was compiled. +itcl_SRC_DIR='/croot/tk_1755243777296/work/tcl8.6.15/pkgs/itcl4.3.0' +ITCL_SRC_DIR='/croot/tk_1755243777296/work/tcl8.6.15/pkgs/itcl4.3.0' + +# String to pass to the compiler so that an extension can +# find installed Itcl headers. +itcl_INCLUDE_SPEC='' +ITCL_INCLUDE_SPEC='' diff --git a/data/miniconda3/lib/itcl4.3.0/itclHullCmds.tcl b/data/miniconda3/lib/itcl4.3.0/itclHullCmds.tcl new file mode 100644 index 0000000000000000000000000000000000000000..5ef32645c92cda278d2448d2aeff1aaba5918cd7 --- /dev/null +++ b/data/miniconda3/lib/itcl4.3.0/itclHullCmds.tcl @@ -0,0 +1,562 @@ +# +# itclHullCmds.tcl +# ---------------------------------------------------------------------- +# Invoked automatically upon startup to customize the interpreter +# for [incr Tcl] when one of setupcomponent or createhull is called. +# ---------------------------------------------------------------------- +# AUTHOR: Arnulf P. Wiedemann +# +# ---------------------------------------------------------------------- +# Copyright (c) 2008 Arnulf P. Wiedemann +# ====================================================================== +# See the file "license.terms" for information on usage and +# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +package require Tk 8.6 9 + +namespace eval ::itcl::internal::commands { + +# ======================= widgetDeleted =========================== + +proc widgetDeleted {oldName newName op} { + # The widget is beeing deleted, so we have to delete the object + # which had the widget as itcl_hull too! + # We have to get the real name from for example + # ::itcl::internal::widgets::hull1.lw + # we need only .lw here + +#puts stderr "widgetDeleted!$oldName!$newName!$op!" + set cmdName [namespace tail $oldName] + set flds [split $cmdName {.}] + set cmdName .[join [lrange $flds 1 end] {.}] +#puts stderr "DELWIDGET![namespace current]!$cmdName![::info command $cmdName]!" + rename $cmdName {} +} + +} + +namespace eval ::itcl::builtin { + +# ======================= createhull =========================== +# the hull widget is a tk widget which is the (mega) widget handled behind the itcl +# extendedclass/itcl widget. +# It is created be renaming the itcl class object to a temporary name _ +# creating the widget with the +# appropriate options and the installing that as the "hull" widget (the container) +# All the options in args and the options delegated to component itcl_hull are used +# Then a unique name (hull_widget_name) in the itcl namespace is created for widget: +# ::itcl::internal::widgets::hull +# and widget is renamed to that name +# Finally the _ is renamed to the original again +# Component itcl_hull is created if not existent +# itcl_hull is set to the hull_widget_name and the +# is returned to the caller +# ============================================================== + +proc createhull {widget_type path args} { + variable hullCount + upvar this this + upvar win win + + +#puts stderr "il-1![::info level -1]!$this!" +#puts stderr "createhull!$widget_type!$path!$args!$this![::info command $this]!" +#puts stderr "ns1![uplevel 1 namespace current]!" +#puts stderr "ns2![uplevel 2 namespace current]!" +#puts stderr "ns3![uplevel 3 namespace current]!" +#puts stderr "level-1![::info level -1]!" +#puts stderr "level-2![::info level -2]!" +# set my_this [namespace tail $this] + set my_this $this + set tmp $my_this +#puts stderr "II![::info command $this]![::info command $tmp]!" +#puts stderr "rename1!rename $my_this ${tmp}_!" + rename ::$my_this ${tmp}_ + set options [list] + foreach {option_name value} $args { + switch -glob -- $option_name { + -class { + lappend options $option_name [namespace tail $value] + } + -* { + lappend options $option_name $value + } + default { + return -code error "bad option name\"$option_name\" options must start with a \"-\"" + } + } + } + set my_win [namespace tail $path] + set cmd [list $widget_type $my_win] +#puts stderr "my_win!$my_win!cmd!$cmd!$path!" + if {[llength $options] > 0} { + lappend cmd {*}$options + } + set widget [uplevel 1 $cmd] +#puts stderr "widget!$widget!" + trace add command $widget delete ::itcl::internal::commands::widgetDeleted + set opts [uplevel 1 info delegated options] + foreach entry $opts { + foreach {optName compName} $entry break + if {$compName eq "itcl_hull"} { + set optInfos [uplevel 1 info delegated option $optName] + set realOptName [lindex $optInfos 4] + # strip off the "-" at the beginning + set myOptName [string range $realOptName 1 end] + set my_opt_val [option get $my_win $myOptName *] + if {$my_opt_val ne ""} { + $my_win configure -$myOptName $my_opt_val + } + } + } + set idx 1 + while {1} { + set widgetName ::itcl::internal::widgets::hull${idx}$my_win +#puts stderr "widgetName!$widgetName!" + if {[string length [::info command $widgetName]] == 0} { + break + } + incr idx + } +#puts stderr "rename2!rename $widget $widgetName!" + set dorename 0 + rename $widget $widgetName +#puts stderr "rename3!rename ${tmp}_ $tmp![::info command ${tmp}_]!my_this!$my_this!" + rename ${tmp}_ ::$tmp + set exists [uplevel 1 ::info exists itcl_hull] + if {!$exists} { + # that does not yet work, beacause of problems with resolving + ::itcl::addcomponent $my_this itcl_hull + } + upvar itcl_hull itcl_hull + ::itcl::setcomponent $my_this itcl_hull $widgetName +#puts stderr "IC![::info command $my_win]!" + set exists [uplevel 1 ::info exists itcl_interior] + if {!$exists} { + # that does not yet work, beacause of problems with resolving + ::itcl::addcomponent $this itcl_interior + } + upvar itcl_interior itcl_interior + set itcl_interior $my_win +#puts stderr "hull end!win!$win!itcl_hull!$itcl_hull!itcl_interior!$itcl_interior!" + return $my_win +} + +# ======================= addToItclOptions =========================== + +proc addToItclOptions {my_class my_win myOptions argsDict} { + upvar win win + upvar itcl_hull itcl_hull + + set opt_lst [list configure] + foreach opt [lsort $myOptions] { +#puts stderr "IOPT!$opt!$my_class!$my_win![::itcl::is class $my_class]!" + set isClass [::itcl::is class $my_class] + set found 0 + if {$isClass} { + if {[catch { + set resource [namespace eval $my_class info option $opt -resource] + set class [namespace eval $my_class info option $opt -class] + set default_val [uplevel 2 info option $opt -default] + set found 1 + } msg]} { +# puts stderr "MSG!$opt!$my_class!$msg!" + } + } else { + set tmp_win [uplevel #0 $my_class .___xx] + + set my_info [$tmp_win configure $opt] + set resource [lindex $my_info 1] + set class [lindex $my_info 2] + set default_val [lindex $my_info 3] + uplevel #0 destroy $tmp_win + set found 1 + } + if {$found} { + if {[catch { + set val [uplevel #0 ::option get $win $resource $class] + } msg]} { + set val "" + } + if {[::dict exists $argsDict $opt]} { + # we have an explicitly set option + set val [::dict get $argsDict $opt] + } else { + if {[string length $val] == 0} { + set val $default_val + } + } + set ::itcl::internal::variables::${my_win}::itcl_options($opt) $val + set ::itcl::internal::variables::${my_win}::__itcl_option_infos($opt) [list $resource $class $default_val] +#puts stderr "OPT1!$opt!$val!" +# uplevel 1 [list set itcl_options($opt) [list $val]] + if {[catch {uplevel 1 $win configure $opt [list $val]} msg]} { +#puts stderr "addToItclOptions ERR!$msg!$my_class!$win!configure!$opt!$val!" + } + } + } +} + +# ======================= setupcomponent =========================== + +proc setupcomponent {comp using widget_type path args} { + upvar this this + upvar win win + upvar itcl_hull itcl_hull + +#puts stderr "setupcomponent!$comp!$widget_type!$path!$args!$this!$win!$itcl_hull!" +#puts stderr "CONT![uplevel 1 info context]!" +#puts stderr "ns1![uplevel 1 namespace current]!" +#puts stderr "ns2![uplevel 2 namespace current]!" +#puts stderr "ns3![uplevel 3 namespace current]!" + set my_comp_object [lindex [uplevel 1 info context] 1] + if {[::info exists ::itcl::internal::component_objects($my_comp_object)]} { + set my_comp_object [set ::itcl::internal::component_objects($my_comp_object)] + } else { + set ::itcl::internal::component_objects($path) $my_comp_object + } + set options [list] + foreach {option_name value} $args { + switch -glob -- $option_name { + -* { + lappend options $option_name $value + } + default { + return -code error "bad option name\"$option_name\" options must start with a \"-\"" + } + } + } + if {[llength $args]} { + set argsDict [dict create {*}$args] + } else { + set argsDict [dict create] + } + set cmd [list $widget_type $path] + if {[llength $options] > 0} { + lappend cmd {*}$options + } +#puts stderr "cmd0![::info command $widget_type]!$path![::info command $path]!" +#puts stderr "cmd1!$cmd!" +# set my_comp [uplevel 3 $cmd] + set my_comp [uplevel #0 $cmd] +#puts stderr 111![::info command $path]! + ::itcl::setcomponent $this $comp $my_comp + set opts [uplevel 1 info delegated options] + foreach entry $opts { + foreach {optName compName} $entry break + if {$compName eq $my_comp} { + set optInfos [uplevel 1 info delegated option $optName] + set realOptName [lindex $optInfos 4] + # strip off the "-" at the beginning + set myOptName [string range $realOptName 1 end] + set my_opt_val [option get $my_win $myOptName *] + if {$my_opt_val ne ""} { + $my_comp configure -$myOptName $my_opt_val + } + } + } + set my_class $widget_type + set my_parent_class [uplevel 1 namespace current] + if {[catch { + set myOptions [namespace eval $my_class {info classoptions}] + } msg]} { + set myOptions [list] + } + foreach entry [$path configure] { + foreach {opt dummy1 dummy2 dummy3} $entry break + lappend myOptions $opt + } +#puts stderr "OPTS!$myOptions!" + addToItclOptions $widget_type $my_comp_object $myOptions $argsDict +#puts stderr END!$path![::info command $path]! +} + +proc itcl_initoptions {args} { +puts stderr "ITCL_INITOPT!$args!" +} + +# ======================= initoptions =========================== + +proc initoptions {args} { + upvar win win + upvar itcl_hull itcl_hull + upvar itcl_option_components itcl_option_components + +#puts stderr "INITOPT!!$win!" + if {[llength $args]} { + set argsDict [dict create {*}$args] + } else { + set argsDict [dict create] + } + set my_class [uplevel 1 namespace current] + set myOptions [namespace eval $my_class {info classoptions}] + if {[dict exists $::itcl::internal::dicts::classComponents $my_class]} { + set class_info_dict [dict get $::itcl::internal::dicts::classComponents $my_class] +# set myOptions [lsort -unique [namespace eval $my_class {info options}]] + foreach comp [uplevel 1 info components] { + if {[dict exists $class_info_dict $comp -keptoptions]} { + foreach my_opt [dict get $class_info_dict $comp -keptoptions] { + if {[lsearch $myOptions $my_opt] < 0} { +#puts stderr "KEOPT!$my_opt!" + lappend myOptions $my_opt + } + } + } + } + } else { + set class_info_dict [list] + } +#puts stderr "OPTS!$win!$my_class![join [lsort $myOptions]] \n]!" + set opt_lst [list configure] + set my_win $win + foreach opt [lsort $myOptions] { + set found 0 + if {[catch { + set resource [uplevel 1 info option $opt -resource] + set class [uplevel 1 info option $opt -class] + set default_val [uplevel 1 info option $opt -default] + set found 1 + } msg]} { +# puts stderr "MSG!$opt!$msg!" + } +#puts stderr "OPT!$opt!$found!" + if {$found} { + if {[catch { + set val [uplevel #0 ::option get $my_win $resource $class] + } msg]} { + set val "" + } + if {[::dict exists $argsDict $opt]} { + # we have an explicitly set option + set val [::dict get $argsDict $opt] + } else { + if {[string length $val] == 0} { + set val $default_val + } + } + set ::itcl::internal::variables::${win}::itcl_options($opt) $val + set ::itcl::internal::variables::${win}::__itcl_option_infos($opt) [list $resource $class $default_val] +#puts stderr "OPT1!$opt!$val!" +# uplevel 1 [list set itcl_options($opt) [list $val]] + if {[catch {uplevel 1 $my_win configure $opt [list $val]} msg]} { +puts stderr "initoptions ERR!$msg!$my_class!$my_win!configure!$opt!$val!" + } + } + foreach comp [dict keys $class_info_dict] { +#puts stderr "OPT1!$opt!$comp![dict get $class_info_dict $comp]!" + if {[dict exists $class_info_dict $comp -keptoptions]} { + if {[lsearch [dict get $class_info_dict $comp -keptoptions] $opt] >= 0} { + if {$found == 0} { + # we use the option value of the first component for setting + # the option, as the components are traversed in the dict + # depending on the ordering of the component creation!! + set my_info [uplevel 1 \[set $comp\] configure $opt] + set resource [lindex $my_info 1] + set class [lindex $my_info 2] + set default_val [lindex $my_info 3] + set found 2 + set val [uplevel #0 ::option get $my_win $resource $class] + if {[::dict exists $argsDict $opt]} { + # we have an explicitly set option + set val [::dict get $argsDict $opt] + } else { + if {[string length $val] == 0} { + set val $default_val + } + } +#puts stderr "OPT2!$opt!$val!" + set ::itcl::internal::variables::${win}::itcl_options($opt) $val + set ::itcl::internal::variables::${win}::__itcl_option_infos($opt) [list $resource $class $default_val] +# uplevel 1 [list set itcl_options($opt) [list $val]] + } + if {[catch {uplevel 1 \[set $comp\] configure $opt [list $val]} msg]} { +puts stderr "initoptions ERR2!$msg!$my_class!$comp!configure!$opt!$val!" + } + if {![uplevel 1 info exists itcl_option_components($opt)]} { + set itcl_option_components($opt) [list] + } + if {[lsearch [set itcl_option_components($opt)] $comp] < 0} { + if {![catch { + set optval [uplevel 1 [list set itcl_options($opt)]] + } msg3]} { + uplevel 1 \[set $comp\] configure $opt $optval + } + lappend itcl_option_components($opt) $comp + } + } + } + } + } +# uplevel 1 $opt_lst +} + +# ======================= setoptions =========================== + +proc setoptions {args} { + +#puts stderr "setOPT!!$args!" + if {[llength $args]} { + set argsDict [dict create {*}$args] + } else { + set argsDict [dict create] + } + set my_class [uplevel 1 namespace current] + set myOptions [namespace eval $my_class {info options}] +#puts stderr "OPTS!$win!$my_class![join [lsort $myOptions]] \n]!" + set opt_lst [list configure] + foreach opt [lsort $myOptions] { + set found 0 + if {[catch { + set resource [uplevel 1 info option $opt -resource] + set class [uplevel 1 info option $opt -class] + set default_val [uplevel 1 info option $opt -default] + set found 1 + } msg]} { +# puts stderr "MSG!$opt!$msg!" + } +#puts stderr "OPT!$opt!$found!" + if {$found} { + set val "" + if {[::dict exists $argsDict $opt]} { + # we have an explicitly set option + set val [::dict get $argsDict $opt] + } else { + if {[string length $val] == 0} { + set val $default_val + } + } + set myObj [uplevel 1 set this] +#puts stderr "myObj!$myObj!" + set ::itcl::internal::variables::${myObj}::itcl_options($opt) $val + set ::itcl::internal::variables::${myObj}::__itcl_option_infos($opt) [list $resource $class $default_val] +#puts stderr "OPT1!$opt!$val!" + uplevel 1 [list set itcl_options($opt) [list $val]] +# if {[catch {uplevel 1 $myObj configure $opt [list $val]} msg]} { +#puts stderr "initoptions ERR!$msg!$my_class!$my_win!configure!$opt!$val!" +# } + } + } +# uplevel 1 $opt_lst +} + +# ========================= keepcomponentoption ====================== +# Invoked by Tcl during evaluating constructor whenever +# the "keepcomponentoption" command is invoked to list the options +# to be kept when an ::itcl::extendedclass component has been setup +# for an object. +# +# It checks, for all arguments, if the opt is an option of that class +# and of that component. If that is the case it adds the component name +# to the list of components for that option. +# The variable is the object variable: itcl_option_components($opt) +# +# Handles the following syntax: +# +# keepcomponentoption ? ...? +# +# ====================================================================== + + +proc keepcomponentoption {args} { + upvar win win + upvar itcl_hull itcl_hull + + set usage "wrong # args, should be: keepcomponentoption componentName optionName ?optionName ...?" + +#puts stderr "KEEP!$args![uplevel 1 namespace current]!" + if {[llength $args] < 2} { + puts stderr $usage + return -code error + } + set my_hull [uplevel 1 set itcl_hull] + set my_class [uplevel 1 namespace current] + set comp [lindex $args 0] + set args [lrange $args 1 end] + set class_info_dict [dict get $::itcl::internal::dicts::classComponents $my_class] + if {![dict exists $class_info_dict $comp]} { + puts stderr "keepcomponentoption cannot find component \"$comp\"" + return -code error + } + set class_comp_dict [dict get $class_info_dict $comp] + if {![dict exists $class_comp_dict -keptoptions]} { + dict set class_comp_dict -keptoptions [list] + } + foreach opt $args { +#puts stderr "KEEP!$opt!" + if {[string range $opt 0 0] ne "-"} { + puts stderr "keepcomponentoption: option must begin with a \"-\"!" + return -code error + } + if {[lsearch [dict get $class_comp_dict -keptoptions] $opt] < 0} { + dict lappend class_comp_dict -keptoptions $opt + } + } + if {![info exists ::itcl::internal::component_objects([lindex [uplevel 1 info context] 1])]} { + set comp_object $::itcl::internal::component_objects([lindex [uplevel 1 info context] 1]) + } else { + set comp_object "unknown_comp_obj_$comp!" + } + dict set class_info_dict $comp $class_comp_dict + dict set ::itcl::internal::dicts::classComponents $my_class $class_info_dict +puts stderr "CLDI!$class_comp_dict!" + addToItclOptions $my_class $comp_object $args [list] +} + +proc ignorecomponentoption {args} { +puts stderr "IGNORE_COMPONENT_OPTION!$args!" +} + +proc renamecomponentoption {args} { +puts stderr "rename_COMPONENT_OPTION!$args!" +} + +proc addoptioncomponent {args} { +puts stderr "ADD_OPTION_COMPONENT!$args!" +} + +proc ignoreoptioncomponent {args} { +puts stderr "IGNORE_OPTION_COMPONENT!$args!" +} + +proc renameoptioncomponent {args} { +puts stderr "RENAME_OPTION_COMPONENT!$args!" +} + +proc getEclassOptions {args} { + upvar win win + +#puts stderr "getEclassOptions!$args!$win![uplevel 1 namespace current]!" +#parray ::itcl::internal::variables::${win}::itcl_options + set result [list] + foreach opt [array names ::itcl::internal::variables::${win}::itcl_options] { + if {[catch { + foreach {res cls def} [set ::itcl::internal::variables::${win}::__itcl_option_infos($opt)] break + lappend result [list $opt $res $cls $def [set ::itcl::internal::variables::${win}::itcl_options($opt)]] + } msg]} { + } + } + return $result +} + +proc eclassConfigure {args} { + upvar win win + +#puts stderr "+++ eclassConfigure!$args!" + if {[llength $args] > 1} { + foreach {opt val} $args break + if {[::info exists ::itcl::internal::variables::${win}::itcl_options($opt)]} { + set ::itcl::internal::variables::${win}::itcl_options($opt) $val + return + } + } else { + foreach {opt} $args break + if {[::info exists ::itcl::internal::variables::${win}::itcl_options($opt)]} { +#puts stderr "OP![set ::itcl::internal::variables::${win}::itcl_options($opt)]!" + foreach {res cls def} [set ::itcl::internal::variables::${win}::__itcl_option_infos($opt)] break + return [list $opt $res $cls $def [set ::itcl::internal::variables::${win}::itcl_options($opt)]] + } + } + return -code error +} + +} diff --git a/data/miniconda3/lib/itcl4.3.0/itclWidget.tcl b/data/miniconda3/lib/itcl4.3.0/itclWidget.tcl new file mode 100644 index 0000000000000000000000000000000000000000..daa5309c42c20c631c45797e739ebbe5511ec55a --- /dev/null +++ b/data/miniconda3/lib/itcl4.3.0/itclWidget.tcl @@ -0,0 +1,447 @@ +# +# itclWidget.tcl +# ---------------------------------------------------------------------- +# Invoked automatically upon startup to customize the interpreter +# for [incr Tcl] when one of ::itcl::widget or ::itcl::widgetadaptor is called. +# ---------------------------------------------------------------------- +# AUTHOR: Arnulf P. Wiedemann +# +# ---------------------------------------------------------------------- +# Copyright (c) 2008 Arnulf P. Wiedemann +# ====================================================================== +# See the file "license.terms" for information on usage and +# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +package require Tk 8.6 9 +# package require itclwidget [set ::itcl::version] + +namespace eval ::itcl { + +proc widget {name args} { + set result [uplevel 1 ::itcl::internal::commands::genericclass widget $name $args] + # we handle create by owerselfs !! allow classunknown to handle that + oo::objdefine $result unexport create + return $result +} + +proc widgetadaptor {name args} { + set result [uplevel 1 ::itcl::internal::commands::genericclass widgetadaptor $name $args] + # we handle create by owerselfs !! allow classunknown to handle that + oo::objdefine $result unexport create + return $result +} + +} ; # end ::itcl + + +namespace eval ::itcl::internal::commands { + +proc initWidgetOptions {varNsName widgetName className} { + set myDict [set ::itcl::internal::dicts::classOptions] + if {$myDict eq ""} { + return + } + if {![dict exists $myDict $className]} { + return + } + set myDict [dict get $myDict $className] + foreach option [dict keys $myDict] { + set infos [dict get $myDict $option] + set resource [dict get $infos -resource] + set class [dict get $infos -class] + set value [::option get $widgetName $resource $class] + if {$value eq ""} { + if {[dict exists $infos -default]} { + set defaultValue [dict get $infos -default] + uplevel 1 set ${varNsName}::itcl_options($option) $defaultValue + } + } else { + uplevel 1 set ${varNsName}::itcl_options($option) $value + } + } +} + +proc initWidgetDelegatedOptions {varNsName widgetName className args} { + set myDict [set ::itcl::internal::dicts::classDelegatedOptions] + if {$myDict eq ""} { + return + } + if {![dict exists $myDict $className]} { + return + } + set myDict [dict get $myDict $className] + foreach option [dict keys $myDict] { + set infos [dict get $myDict $option] + if {![dict exists $infos -resource]} { + # this is the case when delegating "*" + continue + } + if {![dict exists $infos -component]} { + # nothing to do + continue + } + # check if not in the command line options + # these have higher priority + set myOption $option + if {[dict exists $infos -as]} { + set myOption [dict get $infos -as] + } + set noOptionSet 0 + foreach {optName optVal} $args { + if {$optName eq $myOption} { + set noOptionSet 1 + break + } + } + if {$noOptionSet} { + continue + } + set resource [dict get $infos -resource] + set class [dict get $infos -class] + set component [dict get $infos -component] + set value [::option get $widgetName $resource $class] + if {$component ne ""} { + if {$value ne ""} { + set compVar [namespace eval ${varNsName}${className} "set $component"] + if {$compVar ne ""} { + uplevel 1 $compVar configure $myOption $value + } + } + } + } +} + +proc widgetinitobjectoptions {varNsName widgetName className} { +#puts stderr "initWidgetObjectOptions!$varNsName!$widgetName!$className!" +} + +proc deletehull {newName oldName what} { + if {$what eq "delete"} { + set name [namespace tail $newName] + regsub {hull[0-9]+} $name {} name + rename $name {} + } + if {$what eq "rename"} { + set name [namespace tail $newName] + regsub {hull[0-9]+} $name {} name + rename $name {} + } +} + +proc hullandoptionsinstall {objectName className widgetClass hulltype args} { + if {$hulltype eq ""} { + set hulltype frame + } + set idx 0 + set found 0 + foreach {optName optValue} $args { + if {$optName eq "-class"} { + set found 1 + set widgetClass $optValue + break + } + incr idx + } + if {$found} { + set args [lreplace $args $idx [expr {$idx + 1}]] + } + if {$widgetClass eq ""} { + set widgetClass $className + set widgetClass [string totitle $widgetClass] + } + set cmd "set win $objectName; ::itcl::builtin::installhull using $hulltype -class $widgetClass $args" + uplevel 2 $cmd +} + +} ; # end ::itcl::internal::commands + +namespace eval ::itcl::builtin { + +proc installhull {args} { + set cmdPath ::itcl::internal::commands + set className [uplevel 1 info class] + + set replace 0 + switch -- [llength $args] { + 0 { + return -code error\ + "wrong # args: should be \"[lindex [info level 0] 0]\ + name|using ?arg ...?\"" + } + 1 { + set widgetName [lindex $args 0] + set varNsName $::itcl::internal::varNsName($widgetName) + } + default { + upvar win win + set widgetName $win + + set varNsName $::itcl::internal::varNsName($widgetName) + set widgetType [lindex $args 1] + incr replace + if {[llength $args] > 3 && [lindex $args 2] eq "-class"} { + set classNam [lindex $args 3] + incr replace 2 + } else { + set classNam [string totitle $widgetType] + } + uplevel 1 [lreplace $args 0 $replace $widgetType $widgetName -class $classNam] + uplevel 1 [list ${cmdPath}::initWidgetOptions $varNsName $widgetName $className] + } + } + + # initialize the itcl_hull variable + set i 0 + set nam ::itcl::internal::widgets::hull + while {1} { + incr i + set hullNam ${nam}${i}$widgetName + if {[::info command $hullNam] eq ""} { + break + } + } + uplevel 1 [list ${cmdPath}::sethullwindowname $widgetName] + uplevel 1 [list ::rename $widgetName $hullNam] + uplevel 1 [list ::trace add command $hullNam {delete rename} ::itcl::internal::commands::deletehull] + catch {${cmdPath}::checksetitclhull [list] 0} + namespace eval ${varNsName}${className} "set itcl_hull $hullNam" + catch {${cmdPath}::checksetitclhull [list] 2} + uplevel 1 [lreplace $args 0 $replace ${cmdPath}::initWidgetDelegatedOptions $varNsName $widgetName $className] +} + +proc installcomponent {args} { + upvar win win + + set className [uplevel 1 info class] + set myType [${className}::info types [namespace tail $className]] + set isType 0 + if {$myType ne ""} { + set isType 1 + } + set numArgs [llength $args] + set usage "usage: installcomponent using ?-option value ...?" + if {$numArgs < 4} { + error $usage + } + foreach {componentName using widgetType widgetPath} $args break + set opts [lrange $args 4 end] + if {$using ne "using"} { + error $usage + } + if {!$isType} { + set hullExists [uplevel 1 ::info exists itcl_hull] + if {!$hullExists} { + error "cannot install \"$componentName\" before \"itcl_hull\" exists" + } + set hullVal [uplevel 1 set itcl_hull] + if {$hullVal eq ""} { + error "cannot install \"$componentName\" before \"itcl_hull\" exists" + } + } + # check for delegated option and ask the option database for the values + # first check for number of delegated options + set numOpts 0 + set starOption 0 + set myDict [set ::itcl::internal::dicts::classDelegatedOptions] + if {[dict exists $myDict $className]} { + set myDict [dict get $myDict $className] + foreach option [dict keys $myDict] { + if {$option eq "*"} { + set starOption 1 + } + incr numOpts + } + } + set myOptionDict [set ::itcl::internal::dicts::classOptions] + if {[dict exists $myOptionDict $className]} { + set myOptionDict [dict get $myOptionDict $className] + } + set cmd [list $widgetPath configure] + set cmd1 "set $componentName \[$widgetType $widgetPath\]" + uplevel 1 $cmd1 + if {$starOption} { + upvar $componentName compName + set cmd1 [list $compName configure] + set configInfos [uplevel 1 $cmd1] + foreach entry $configInfos { + if {[llength $entry] > 2} { + foreach {optName resource class defaultValue} $entry break + set val "" + catch { + set val [::option get $win $resource $class] + } + if {$val ne ""} { + set addOpt 1 + if {[dict exists $myDict $$optName]} { + set addOpt 0 + } else { + set starDict [dict get $myDict "*"] + if {[dict exists $starDict -except]} { + set exceptions [dict get $starDict -except] + if {[lsearch $exceptions $optName] >= 0} { + set addOpt 0 + } + + } + if {[dict exists $myOptionDict $optName]} { + set addOpt 0 + } + } + if {$addOpt} { + lappend cmd $optName $val + } + + } + + } + } + } else { + foreach optName [dict keys $myDict] { + set optInfos [dict get $myDict $optName] + set resource [dict get $optInfos -resource] + set class [namespace tail $className] + set class [string totitle $class] + set val "" + catch { + set val [::option get $win $resource $class] + } + if {$val ne ""} { + if {[dict exists $optInfos -as] } { + set optName [dict get $optInfos -as] + } + lappend cmd $optName $val + } + } + } + lappend cmd {*}$opts + uplevel 1 $cmd +} + +} ; # end ::itcl::builtin + +set ::itcl::internal::dicts::hullTypes [list \ + frame \ + toplevel \ + labelframe \ + ttk:frame \ + ttk:toplevel \ + ttk:labelframe \ + ] + +namespace eval ::itcl::builtin::Info { + +proc hulltypes {args} { + namespace upvar ::itcl::internal::dicts hullTypes hullTypes + + set numArgs [llength $args] + if {$numArgs > 1} { + error "wrong # args should be: info hulltypes ??" + } + set pattern "" + if {$numArgs > 0} { + set pattern [lindex $args 0] + } + if {$pattern ne ""} { + return [lsearch -all -inline -glob $hullTypes $pattern] + } + return $hullTypes + +} + +proc widgetclasses {args} { + set numArgs [llength $args] + if {$numArgs > 1} { + error "wrong # args should be: info widgetclasses ??" + } + set pattern "" + if {$numArgs > 0} { + set pattern [lindex $args 0] + } + set myDict [set ::itcl::internal::dicts::classes] + if {![dict exists $myDict widget]} { + return [list] + } + set myDict [dict get $myDict widget] + set result [list] + if {$pattern ne ""} { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + set value [dict get $myInfo -widget] + if {[string match $pattern $value]} { + lappend result $value + } + } + } else { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + lappend result [dict get $myInfo -widget] + } + } + return $result +} + +proc widgets {args} { + set numArgs [llength $args] + if {$numArgs > 1} { + error "wrong # args should be: info widgets ??" + } + set pattern "" + if {$numArgs > 0} { + set pattern [lindex $args 0] + } + set myDict [set ::itcl::internal::dicts::classes] + if {![dict exists $myDict widget]} { + return [list] + } + set myDict [dict get $myDict widget] + set result [list] + if {$pattern ne ""} { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + set value [dict get $myInfo -name] + if {[string match $pattern $value]} { + lappend result $value + } + } + } else { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + lappend result [dict get $myInfo -name] + } + } + return $result +} + +proc widgetadaptors {args} { + set numArgs [llength $args] + if {$numArgs > 1} { + error "wrong # args should be: info widgetadaptors ??" + } + set pattern "" + if {$numArgs > 0} { + set pattern [lindex $args 0] + } + set myDict [set ::itcl::internal::dicts::classes] + if {![dict exists $myDict widgetadaptor]} { + return [list] + } + set myDict [dict get $myDict widgetadaptor] + set result [list] + if {$pattern ne ""} { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + set value [dict get $myInfo -name] + if {[string match $pattern $value]} { + lappend result $value + } + } + } else { + foreach key [dict keys $myDict] { + set myInfo [dict get $myDict $key] + lappend result [dict get $myInfo -name] + } + } + return $result +} + +} ; # end ::itcl::builtin::Info diff --git a/data/miniconda3/lib/itcl4.3.0/libitclstub4.3.0.a b/data/miniconda3/lib/itcl4.3.0/libitclstub4.3.0.a new file mode 100644 index 0000000000000000000000000000000000000000..95bfb45c8ba74d1bfa6427f00b8f34b05a50b585 Binary files /dev/null and b/data/miniconda3/lib/itcl4.3.0/libitclstub4.3.0.a differ diff --git a/data/miniconda3/lib/itcl4.3.0/pkgIndex.tcl b/data/miniconda3/lib/itcl4.3.0/pkgIndex.tcl new file mode 100644 index 0000000000000000000000000000000000000000..7f16270d22215e97b4eab24dff2350b569bbe8b4 --- /dev/null +++ b/data/miniconda3/lib/itcl4.3.0/pkgIndex.tcl @@ -0,0 +1,14 @@ +# -*- tcl -*- +# Tcl package index file, version 1.1 +# + +if {![package vsatisfies [package provide Tcl] 8.6-]} {return} + +if {[package vsatisfies [package provide Tcl] 9.0-]} { + package ifneeded itcl 4.3.0 \ + [list load [file join $dir libtcl9itcl4.3.0.so] Itcl] +} else { + package ifneeded itcl 4.3.0 \ + [list load [file join $dir libitcl4.3.0.so] Itcl] +} +package ifneeded Itcl 4.3.0 [list package require -exact itcl 4.3.0] diff --git a/data/miniconda3/lib/openjpeg-2.5/OpenJPEGConfig.cmake b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..5e9fa32a6da5794ef7e0a3df4b08413e8207a88f --- /dev/null +++ b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGConfig.cmake @@ -0,0 +1,53 @@ +#----------------------------------------------------------------------------- +# +# OPENJPEGConfig.cmake - CMake configuration file for external projects. +# +# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake +# module to load OPENJPEG's settings for an external project. + +# The OPENJPEG version number. +set(OPENJPEG_MAJOR_VERSION "2") +set(OPENJPEG_MINOR_VERSION "5") +set(OPENJPEG_BUILD_VERSION "0") + +# The libraries. +set(OPENJPEG_LIBRARIES "openjp2") + +# The CMake macros dir. +set(OPENJPEG_CMAKE_DIR "lib/openjpeg-2.5") + +# The configuration options. +set(OPENJPEG_BUILD_SHARED_LIBS "ON") + +# The "use" file. +set(OPENJPEG_USE_FILE "") + +get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake) + # This is an install tree + include(${SELF_DIR}/OpenJPEGTargets.cmake) + + # We find a relative path from the PKG directory to header files. + set(PKG_DIR "/home/zangyihe/miniconda3/lib/openjpeg-2.5") + set(INC_DIR "/home/zangyihe/miniconda3/include/openjpeg-2.5") + file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}") + + get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" REALPATH) + +else() + if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake) + # This is a build tree + set( OPENJPEG_INCLUDE_DIRS ) + + include(${SELF_DIR}/OpenJPEGExports.cmake) + + else() + message(FATAL_ERROR "ooops") + endif() +endif() + +set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake) + +# Backward compatible part: +set(OPENJPEG_FOUND TRUE) + diff --git a/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets-noconfig.cmake b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets-noconfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..743cf80edabe051afb6e5a504ea026b9b1f9e650 --- /dev/null +++ b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets-noconfig.cmake @@ -0,0 +1,57 @@ +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "openjp2" for configuration "" +set_property(TARGET openjp2 APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(openjp2 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "m;-lpthread" + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/libopenjp2.so.2.5.0" + IMPORTED_SONAME_NOCONFIG "libopenjp2.so.7" + ) + +list(APPEND _cmake_import_check_targets openjp2 ) +list(APPEND _cmake_import_check_files_for_openjp2 "${_IMPORT_PREFIX}/lib/libopenjp2.so.2.5.0" ) + +# Import target "openjp2_static" for configuration "" +set_property(TARGET openjp2_static APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(openjp2_static PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_NOCONFIG "C" + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/libopenjp2.a" + ) + +list(APPEND _cmake_import_check_targets openjp2_static ) +list(APPEND _cmake_import_check_files_for_openjp2_static "${_IMPORT_PREFIX}/lib/libopenjp2.a" ) + +# Import target "opj_decompress" for configuration "" +set_property(TARGET opj_decompress APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(opj_decompress PROPERTIES + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/opj_decompress" + ) + +list(APPEND _cmake_import_check_targets opj_decompress ) +list(APPEND _cmake_import_check_files_for_opj_decompress "${_IMPORT_PREFIX}/bin/opj_decompress" ) + +# Import target "opj_compress" for configuration "" +set_property(TARGET opj_compress APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(opj_compress PROPERTIES + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/opj_compress" + ) + +list(APPEND _cmake_import_check_targets opj_compress ) +list(APPEND _cmake_import_check_files_for_opj_compress "${_IMPORT_PREFIX}/bin/opj_compress" ) + +# Import target "opj_dump" for configuration "" +set_property(TARGET opj_dump APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(opj_dump PROPERTIES + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/bin/opj_dump" + ) + +list(APPEND _cmake_import_check_targets opj_dump ) +list(APPEND _cmake_import_check_files_for_opj_dump "${_IMPORT_PREFIX}/bin/opj_dump" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets.cmake b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets.cmake new file mode 100644 index 0000000000000000000000000000000000000000..21111ae31a099f9df608274377a19f4170c182cc --- /dev/null +++ b/data/miniconda3/lib/openjpeg-2.5/OpenJPEGTargets.cmake @@ -0,0 +1,117 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8) + message(FATAL_ERROR "CMake >= 2.8.0 required") +endif() +if(CMAKE_VERSION VERSION_LESS "2.8.3") + message(FATAL_ERROR "CMake >= 2.8.3 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.8.3...3.23) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_cmake_targets_defined "") +set(_cmake_targets_not_defined "") +set(_cmake_expected_targets "") +foreach(_cmake_expected_target IN ITEMS openjp2 openjp2_static opj_decompress opj_compress opj_dump) + list(APPEND _cmake_expected_targets "${_cmake_expected_target}") + if(TARGET "${_cmake_expected_target}") + list(APPEND _cmake_targets_defined "${_cmake_expected_target}") + else() + list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") + endif() +endforeach() +unset(_cmake_expected_target) +if(_cmake_targets_defined STREQUAL _cmake_expected_targets) + unset(_cmake_targets_defined) + unset(_cmake_targets_not_defined) + unset(_cmake_expected_targets) + unset(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT _cmake_targets_defined STREQUAL "") + string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") + string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") +endif() +unset(_cmake_targets_defined) +unset(_cmake_targets_not_defined) +unset(_cmake_expected_targets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target openjp2 +add_library(openjp2 SHARED IMPORTED) + +set_target_properties(openjp2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/openjpeg-2.5" +) + +# Create imported target openjp2_static +add_library(openjp2_static STATIC IMPORTED) + +set_target_properties(openjp2_static PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/openjpeg-2.5" +) + +# Create imported target opj_decompress +add_executable(opj_decompress IMPORTED) + +# Create imported target opj_compress +add_executable(opj_compress IMPORTED) + +# Create imported target opj_dump +add_executable(opj_dump IMPORTED) + +# Load information for each installed configuration. +file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OpenJPEGTargets-*.cmake") +foreach(_cmake_config_file IN LISTS _cmake_config_files) + include("${_cmake_config_file}") +endforeach() +unset(_cmake_config_file) +unset(_cmake_config_files) + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(_cmake_target IN LISTS _cmake_import_check_targets) + foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}") + if(NOT EXISTS "${_cmake_file}") + message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file + \"${_cmake_file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_cmake_file) + unset("_cmake_import_check_files_for_${_cmake_target}") +endforeach() +unset(_cmake_target) +unset(_cmake_import_check_targets) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/data/miniconda3/lib/perl5/core_perl/AnyDBM_File.pm b/data/miniconda3/lib/perl5/core_perl/AnyDBM_File.pm new file mode 100644 index 0000000000000000000000000000000000000000..4153af2de2d8e4524b6f75d3cde65fb9cd0f588f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/AnyDBM_File.pm @@ -0,0 +1,96 @@ +package AnyDBM_File; +use warnings; +use strict; + +use 5.006_001; +our $VERSION = '1.01'; +our @ISA = qw(NDBM_File DB_File GDBM_File SDBM_File ODBM_File) unless @ISA; + +my $mod; +for $mod (@ISA) { + if (eval "require $mod") { + @ISA = ($mod); # if we leave @ISA alone, warnings abound + return 1; + } +} + +die "No DBM package was successfully found or installed"; + +__END__ + +=head1 NAME + +AnyDBM_File - provide framework for multiple DBMs + +NDBM_File, DB_File, GDBM_File, SDBM_File, ODBM_File - various DBM implementations + +=head1 SYNOPSIS + + use AnyDBM_File; + +=head1 DESCRIPTION + +This module is a "pure virtual base class"--it has nothing of its own. +It's just there to inherit from one of the various DBM packages. It +prefers ndbm for compatibility reasons with Perl 4, then Berkeley DB (See +L), GDBM, SDBM (which is always there--it comes with Perl), and +finally ODBM. This way old programs that used to use NDBM via dbmopen() +can still do so, but new ones can reorder @ISA: + + BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) } + use AnyDBM_File; + +Having multiple DBM implementations makes it trivial to copy database formats: + + use Fcntl; use NDBM_File; use DB_File; + tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR; + tie %oldhash, 'NDBM_File', $old_filename, 1, 0; + %newhash = %oldhash; + +=head2 DBM Comparisons + +Here's a partial table of features the different packages offer: + + odbm ndbm sdbm gdbm bsd-db + ---- ---- ---- ---- ------ + Linkage comes w/ perl yes yes yes yes yes + Src comes w/ perl no no yes no no + Comes w/ many unix os yes yes[0] no no no + Builds ok on !unix ? ? yes yes ? + Code Size ? ? small big big + Database Size ? ? small big? ok[1] + Speed ? ? slow ok fast + FTPable no no yes yes yes + Easy to build N/A N/A yes yes ok[2] + Size limits 1k 4k 1k[3] none none + Byte-order independent no no no no yes + Licensing restrictions ? ? no yes no + + +=over 4 + +=item [0] + +on mixed universe machines, may be in the bsd compat library, +which is often shunned. + +=item [1] + +Can be trimmed if you compile for one access method. + +=item [2] + +See L. +Requires symbolic links. + +=item [3] + +By default, but can be redefined. + +=back + +=head1 SEE ALSO + +dbm(3), ndbm(3), DB_File(3), L + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/App/Cpan.pm b/data/miniconda3/lib/perl5/core_perl/App/Cpan.pm new file mode 100644 index 0000000000000000000000000000000000000000..b563addf52732fa75e18282da4ef1ad389f3d495 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/App/Cpan.pm @@ -0,0 +1,1719 @@ +package App::Cpan; + +use strict; +use warnings; +use vars qw($VERSION); + +use if $] < 5.008 => 'IO::Scalar'; + +$VERSION = '1.675'; + +=head1 NAME + +App::Cpan - easily interact with CPAN from the command line + +=head1 SYNOPSIS + + # with arguments and no switches, installs specified modules + cpan module_name [ module_name ... ] + + # with switches, installs modules with extra behavior + cpan [-cfFimtTw] module_name [ module_name ... ] + + # use local::lib + cpan -I module_name [ module_name ... ] + + # one time mirror override for faster mirrors + cpan -p ... + + # with just the dot, install from the distribution in the + # current directory + cpan . + + # without arguments, starts CPAN.pm shell + cpan + + # without arguments, but some switches + cpan [-ahpruvACDLOPX] + +=head1 DESCRIPTION + +This script provides a command interface (not a shell) to CPAN. At the +moment it uses CPAN.pm to do the work, but it is not a one-shot command +runner for CPAN.pm. + +=head2 Options + +=over 4 + +=item -a + +Creates a CPAN.pm autobundle with CPAN::Shell->autobundle. + +=item -A module [ module ... ] + +Shows the primary maintainers for the specified modules. + +=item -c module + +Runs a `make clean` in the specified module's directories. + +=item -C module [ module ... ] + +Show the F files for the specified modules + +=item -D module [ module ... ] + +Show the module details. This prints one line for each out-of-date module +(meaning, modules locally installed but have newer versions on CPAN). +Each line has three columns: module name, local version, and CPAN +version. + +=item -f + +Force the specified action, when it normally would have failed. Use this +to install a module even if its tests fail. When you use this option, +-i is not optional for installing a module when you need to force it: + + % cpan -f -i Module::Foo + +=item -F + +Turn off CPAN.pm's attempts to lock anything. You should be careful with +this since you might end up with multiple scripts trying to muck in the +same directory. This isn't so much of a concern if you're loading a special +config with C<-j>, and that config sets up its own work directories. + +=item -g module [ module ... ] + +Downloads to the current directory the latest distribution of the module. + +=item -G module [ module ... ] + +UNIMPLEMENTED + +Download to the current directory the latest distribution of the +modules, unpack each distribution, and create a git repository for each +distribution. + +If you want this feature, check out Yanick Champoux's C +distribution. + +=item -h + +Print a help message and exit. When you specify C<-h>, it ignores all +of the other options and arguments. + +=item -i module [ module ... ] + +Install the specified modules. With no other switches, this switch +is implied. + +=item -I + +Load C (think like C<-I> for loading lib paths). Too bad +C<-l> was already taken. + +=item -j Config.pm + +Load the file that has the CPAN configuration data. This should have the +same format as the standard F file, which defines +C<$CPAN::Config> as an anonymous hash. + +If the file does not exist, C dies. + +=item -J + +Dump the configuration in the same format that CPAN.pm uses. This is useful +for checking the configuration as well as using the dump as a starting point +for a new, custom configuration. + +=item -l + +List all installed modules with their versions + +=item -L author [ author ... ] + +List the modules by the specified authors. + +=item -m + +Make the specified modules. + +=item -M mirror1,mirror2,... + +A comma-separated list of mirrors to use for just this run. The C<-P> +option can find them for you automatically. + +=item -n + +Do a dry run, but don't actually install anything. (unimplemented) + +=item -O + +Show the out-of-date modules. + +=item -p + +Ping the configured mirrors and print a report + +=item -P + +Find the best mirrors you could be using and use them for the current +session. + +=item -r + +Recompiles dynamically loaded modules with CPAN::Shell->recompile. + +=item -s + +Drop in the CPAN.pm shell. This command does this automatically if you don't +specify any arguments. + +=item -t module [ module ... ] + +Run a `make test` on the specified modules. + +=item -T + +Do not test modules. Simply install them. + +=item -u + +Upgrade all installed modules. Blindly doing this can really break things, +so keep a backup. + +=item -v + +Print the script version and CPAN.pm version then exit. + +=item -V + +Print detailed information about the cpan client. + +=item -w + +UNIMPLEMENTED + +Turn on cpan warnings. This checks various things, like directory permissions, +and tells you about problems you might have. + +=item -x module [ module ... ] + +Find close matches to the named modules that you think you might have +mistyped. This requires the optional installation of Text::Levenshtein or +Text::Levenshtein::Damerau. + +=item -X + +Dump all the namespaces to standard output. + +=back + +=head2 Examples + + # print a help message + cpan -h + + # print the version numbers + cpan -v + + # create an autobundle + cpan -a + + # recompile modules + cpan -r + + # upgrade all installed modules + cpan -u + + # install modules ( sole -i is optional ) + cpan -i Netscape::Booksmarks Business::ISBN + + # force install modules ( must use -i ) + cpan -fi CGI::Minimal URI + + # install modules but without testing them + cpan -Ti CGI::Minimal URI + +=head2 Environment variables + +There are several components in CPAN.pm that use environment variables. +The build tools, L and L use some, +while others matter to the levels above them. Some of these are specified +by the Perl Toolchain Gang: + +Lancaster Concensus: L + +Oslo Concensus: L + +=over 4 + +=item NONINTERACTIVE_TESTING + +Assume no one is paying attention and skips prompts for distributions +that do that correctly. C sets this to C<1> unless it already +has a value (even if that value is false). + +=item PERL_MM_USE_DEFAULT + +Use the default answer for a prompted questions. C sets this +to C<1> unless it already has a value (even if that value is false). + +=item CPAN_OPTS + +As with C, a string of additional C options to +add to those you specify on the command line. + +=item CPANSCRIPT_LOGLEVEL + +The log level to use, with either the embedded, minimal logger or +L if it is installed. Possible values are the same as +the C levels: C, C, C, C, +C, and C. The default is C. + +=item GIT_COMMAND + +The path to the C binary to use for the Git features. The default +is C. + +=back + +=head2 Methods + +=over 4 + +=cut + +use autouse Carp => qw(carp croak cluck); +use CPAN 1.80 (); # needs no test +use Config; +use autouse Cwd => qw(cwd); +use autouse 'Data::Dumper' => qw(Dumper); +use File::Spec::Functions qw(catfile file_name_is_absolute rel2abs); +use File::Basename; +use Getopt::Std; + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Internal constants +use constant TRUE => 1; +use constant FALSE => 0; + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# The return values +use constant HEY_IT_WORKED => 0; +use constant I_DONT_KNOW_WHAT_HAPPENED => 1; # 0b0000_0001 +use constant ITS_NOT_MY_FAULT => 2; +use constant THE_PROGRAMMERS_AN_IDIOT => 4; +use constant A_MODULE_FAILED_TO_INSTALL => 8; + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# set up the order of options that we layer over CPAN::Shell +BEGIN { # most of this should be in methods +use vars qw( @META_OPTIONS $Default %CPAN_METHODS @CPAN_OPTIONS @option_order + %Method_table %Method_table_index ); + +@META_OPTIONS = qw( h v V I g G M: C A D O l L a r p P j: J w x X ); + +$Default = 'default'; + +%CPAN_METHODS = ( # map switches to method names in CPAN::Shell + $Default => 'install', + 'c' => 'clean', + 'f' => 'force', + 'i' => 'install', + 'm' => 'make', + 't' => 'test', + 'u' => 'upgrade', + 'T' => 'notest', + 's' => 'shell', + ); +@CPAN_OPTIONS = grep { $_ ne $Default } sort keys %CPAN_METHODS; + +@option_order = ( @META_OPTIONS, @CPAN_OPTIONS ); + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# map switches to the subroutines in this script, along with other information. +# use this stuff instead of hard-coded indices and values +sub NO_ARGS () { 0 } +sub ARGS () { 1 } +sub GOOD_EXIT () { 0 } + +%Method_table = ( +# key => [ sub ref, takes args?, exit value, description ] + + # options that do their thing first, then exit + h => [ \&_print_help, NO_ARGS, GOOD_EXIT, 'Printing help' ], + v => [ \&_print_version, NO_ARGS, GOOD_EXIT, 'Printing version' ], + V => [ \&_print_details, NO_ARGS, GOOD_EXIT, 'Printing detailed version' ], + X => [ \&_list_all_namespaces, NO_ARGS, GOOD_EXIT, 'Listing all namespaces' ], + + # options that affect other options + j => [ \&_load_config, ARGS, GOOD_EXIT, 'Use specified config file' ], + J => [ \&_dump_config, NO_ARGS, GOOD_EXIT, 'Dump configuration to stdout' ], + F => [ \&_lock_lobotomy, NO_ARGS, GOOD_EXIT, 'Turn off CPAN.pm lock files' ], + I => [ \&_load_local_lib, NO_ARGS, GOOD_EXIT, 'Loading local::lib' ], + M => [ \&_use_these_mirrors, ARGS, GOOD_EXIT, 'Setting per session mirrors' ], + P => [ \&_find_good_mirrors, NO_ARGS, GOOD_EXIT, 'Finding good mirrors' ], + w => [ \&_turn_on_warnings, NO_ARGS, GOOD_EXIT, 'Turning on warnings' ], + + # options that do their one thing + g => [ \&_download, ARGS, GOOD_EXIT, 'Download the latest distro' ], + G => [ \&_gitify, ARGS, GOOD_EXIT, 'Down and gitify the latest distro' ], + + C => [ \&_show_Changes, ARGS, GOOD_EXIT, 'Showing Changes file' ], + A => [ \&_show_Author, ARGS, GOOD_EXIT, 'Showing Author' ], + D => [ \&_show_Details, ARGS, GOOD_EXIT, 'Showing Details' ], + O => [ \&_show_out_of_date, NO_ARGS, GOOD_EXIT, 'Showing Out of date' ], + l => [ \&_list_all_mods, NO_ARGS, GOOD_EXIT, 'Listing all modules' ], + + L => [ \&_show_author_mods, ARGS, GOOD_EXIT, 'Showing author mods' ], + a => [ \&_create_autobundle, NO_ARGS, GOOD_EXIT, 'Creating autobundle' ], + p => [ \&_ping_mirrors, NO_ARGS, GOOD_EXIT, 'Pinging mirrors' ], + + r => [ \&_recompile, NO_ARGS, GOOD_EXIT, 'Recompiling' ], + u => [ \&_upgrade, NO_ARGS, GOOD_EXIT, 'Running `make test`' ], + 's' => [ \&_shell, NO_ARGS, GOOD_EXIT, 'Running `make test`' ], + + 'x' => [ \&_guess_namespace, ARGS, GOOD_EXIT, 'Guessing namespaces' ], + c => [ \&_default, ARGS, GOOD_EXIT, 'Running `make clean`' ], + f => [ \&_default, ARGS, GOOD_EXIT, 'Installing with force' ], + i => [ \&_default, ARGS, GOOD_EXIT, 'Running `make install`' ], + 'm' => [ \&_default, ARGS, GOOD_EXIT, 'Running `make`' ], + t => [ \&_default, ARGS, GOOD_EXIT, 'Running `make test`' ], + T => [ \&_default, ARGS, GOOD_EXIT, 'Installing with notest' ], + ); + +%Method_table_index = ( + code => 0, + takes_args => 1, + exit_value => 2, + description => 3, + ); +} + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# finally, do some argument processing + +sub _stupid_interface_hack_for_non_rtfmers + { + no warnings 'uninitialized'; + shift @ARGV if( $ARGV[0] eq 'install' and @ARGV > 1 ) + } + +sub _process_options + { + my %options; + + push @ARGV, grep $_, split /\s+/, $ENV{CPAN_OPTS} || ''; + + # if no arguments, just drop into the shell + if( 0 == @ARGV ) { CPAN::shell(); exit 0 } + elsif (Getopt::Std::getopts( + join( '', @option_order ), \%options )) + { + \%options; + } + else { exit 1 } +} + +sub _process_setup_options + { + my( $class, $options ) = @_; + + if( $options->{j} ) + { + $Method_table{j}[ $Method_table_index{code} ]->( $options->{j} ); + delete $options->{j}; + } + elsif ( ! $options->{h} ) { # h "ignores all of the other options and arguments" + # this is what CPAN.pm would do otherwise + local $CPAN::Be_Silent = 1; + CPAN::HandleConfig->load( + # be_silent => 1, deprecated + write_file => 0, + ); + } + + $class->_turn_off_testing if $options->{T}; + + foreach my $o ( qw(F I w P M) ) + { + next unless exists $options->{$o}; + $Method_table{$o}[ $Method_table_index{code} ]->( $options->{$o} ); + delete $options->{$o}; + } + + if( $options->{o} ) + { + my @pairs = map { [ split /=/, $_, 2 ] } split /,/, $options->{o}; + foreach my $pair ( @pairs ) + { + my( $setting, $value ) = @$pair; + $CPAN::Config->{$setting} = $value; + # $logger->debug( "Setting [$setting] to [$value]" ); + } + delete $options->{o}; + } + + my $option_count = grep { $options->{$_} } @option_order; + no warnings 'uninitialized'; + + # don't count options that imply installation + foreach my $opt ( qw(f T) ) { # don't count force or notest + $option_count -= $options->{$opt}; + } + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # if there are no options, set -i (this line fixes RT ticket 16915) + $options->{i}++ unless $option_count; + } + +sub _setup_environment { +# should we override or set defaults? If this were a true interactive +# session, we'd be in the CPAN shell. + +# https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md + $ENV{NONINTERACTIVE_TESTING} = 1 unless defined $ENV{NONINTERACTIVE_TESTING}; + $ENV{PERL_MM_USE_DEFAULT} = 1 unless defined $ENV{PERL_MM_USE_DEFAULT}; + } + +=item run() + +Just do it. + +The C method returns 0 on success and a positive number on +failure. See the section on EXIT CODES for details on the values. + +=cut + +my $logger; + +sub run + { + my $class = shift; + + my $return_value = HEY_IT_WORKED; # assume that things will work + + $logger = $class->_init_logger; + $logger->debug( "Using logger from @{[ref $logger]}" ); + + $class->_hook_into_CPANpm_report; + $logger->debug( "Hooked into output" ); + + $class->_stupid_interface_hack_for_non_rtfmers; + $logger->debug( "Patched cargo culting" ); + + my $options = $class->_process_options; + $logger->debug( "Options are @{[Dumper($options)]}" ); + + $class->_process_setup_options( $options ); + + $class->_setup_environment( $options ); + + OPTION: foreach my $option ( @option_order ) + { + next unless $options->{$option}; + + my( $sub, $takes_args, $description ) = + map { $Method_table{$option}[ $Method_table_index{$_} ] } + qw( code takes_args description ); + + unless( ref $sub eq ref sub {} ) + { + $return_value = THE_PROGRAMMERS_AN_IDIOT; + last OPTION; + } + + $logger->info( "[$option] $description -- ignoring other arguments" ) + if( @ARGV && ! $takes_args ); + + $return_value = $sub->( \ @ARGV, $options ); + + last; + } + + return $return_value; + } + +my $LEVEL; +{ +package + Local::Null::Logger; # hide from PAUSE + +my @LOGLEVELS = qw(TRACE DEBUG INFO WARN ERROR FATAL); +$LEVEL = uc($ENV{CPANSCRIPT_LOGLEVEL} || 'INFO'); +my %LL = map { $LOGLEVELS[$_] => $_ } 0..$#LOGLEVELS; +unless (defined $LL{$LEVEL}){ + warn "Unsupported loglevel '$LEVEL', setting to INFO"; + $LEVEL = 'INFO'; +} +sub new { bless \ my $x, $_[0] } +sub AUTOLOAD { + my $autoload = our $AUTOLOAD; + $autoload =~ s/.*://; + return if $LL{uc $autoload} < $LL{$LEVEL}; + $CPAN::Frontend->mywarn(">($autoload): $_\n") + for split /[\r\n]+/, $_[1]; +} +sub DESTROY { 1 } +} + +# load a module without searching the default entry for the current +# directory +sub _safe_load_module { + my $name = shift; + + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + + eval "require $name; 1"; +} + +sub _init_logger + { + my $log4perl_loaded = _safe_load_module("Log::Log4perl"); + + unless( $log4perl_loaded ) + { + print STDOUT "Loading internal logger. Log::Log4perl recommended for better logging\n"; + $logger = Local::Null::Logger->new; + return $logger; + } + + Log::Log4perl::init( \ <<"HERE" ); +log4perl.rootLogger=$LEVEL, A1 +log4perl.appender.A1=Log::Log4perl::Appender::Screen +log4perl.appender.A1.layout=PatternLayout +log4perl.appender.A1.layout.ConversionPattern=%m%n +HERE + + $logger = Log::Log4perl->get_logger( 'App::Cpan' ); + } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +sub _default + { + my( $args, $options ) = @_; + + my $switch = ''; + + # choose the option that we're going to use + # we'll deal with 'f' (force) later, so skip it + foreach my $option ( @CPAN_OPTIONS ) + { + next if ( $option eq 'f' or $option eq 'T' ); + next unless $options->{$option}; + $switch = $option; + last; + } + + # 1. with no switches, but arguments, use the default switch (install) + # 2. with no switches and no args, start the shell + # 3. With a switch but no args, die! These switches need arguments. + if( not $switch and @$args ) { $switch = $Default; } + elsif( not $switch and not @$args ) { return CPAN::shell() } + elsif( $switch and not @$args ) + { die "Nothing to $CPAN_METHODS{$switch}!\n"; } + + # Get and check the method from CPAN::Shell + my $method = $CPAN_METHODS{$switch}; + die "CPAN.pm cannot $method!\n" unless CPAN::Shell->can( $method ); + + # call the CPAN::Shell method, with force or notest if specified + my $action = do { + if( $options->{f} ) { sub { CPAN::Shell->force( $method, @_ ) } } + elsif( $options->{T} ) { sub { CPAN::Shell->notest( $method, @_ ) } } + else { sub { CPAN::Shell->$method( @_ ) } } + }; + + # How do I handle exit codes for multiple arguments? + my @errors = (); + + $options->{x} or _disable_guessers(); + + foreach my $arg ( @$args ) + { + # check the argument and perhaps capture typos + my $module = _expand_module( $arg ) or do { + $logger->error( "Skipping $arg because I couldn't find a matching namespace." ); + next; + }; + + _clear_cpanpm_output(); + $action->( $arg ); + + my $error = _cpanpm_output_indicates_failure(); + push @errors, $error if $error; + } + + return do { + if( @errors ) { $errors[0] } + else { HEY_IT_WORKED } + }; + + } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + +=for comment + +CPAN.pm sends all the good stuff either to STDOUT, or to a temp +file if $CPAN::Be_Silent is set. I have to intercept that output +so I can find out what happened. + +=cut + +BEGIN { +my $scalar = ''; + +sub _hook_into_CPANpm_report + { + no warnings 'redefine'; + + *CPAN::Shell::myprint = sub { + my($self,$what) = @_; + $scalar .= $what if defined $what; + $self->print_ornamented($what, + $CPAN::Config->{colorize_print}||'bold blue on_white', + ); + }; + + *CPAN::Shell::mywarn = sub { + my($self,$what) = @_; + $scalar .= $what; + $self->print_ornamented($what, + $CPAN::Config->{colorize_warn}||'bold red on_white' + ); + }; + + } + +sub _clear_cpanpm_output { $scalar = '' } + +sub _get_cpanpm_output { $scalar } + +# These are lines I don't care about in CPAN.pm output. If I can +# filter out the informational noise, I have a better chance to +# catch the error signal +my @skip_lines = ( + qr/^\QWarning \(usually harmless\)/, + qr/\bwill not store persistent state\b/, + qr(//hint//), + qr/^\s+reports\s+/, + qr/^Try the command/, + qr/^\s+$/, + qr/^to find objects/, + qr/^\s*Database was generated on/, + qr/^Going to read/, + qr|^\s+i\s+/|, # the i /Foo::Whatever/ line when it doesn't know + ); + +sub _get_cpanpm_last_line + { + my $fh; + + if( $] < 5.008 ) { + $fh = IO::Scalar->new( \ $scalar ); + } + else { + eval q{ open $fh, '<', \\ $scalar; }; + } + + my @lines = <$fh>; + + # This is a bit ugly. Once we examine a line, we have to + # examine the line before it and go through all of the same + # regexes. I could do something fancy, but this works. + REGEXES: { + foreach my $regex ( @skip_lines ) + { + if( $lines[-1] =~ m/$regex/ ) + { + pop @lines; + redo REGEXES; # we have to go through all of them for every line! + } + } + } + + $logger->debug( "Last interesting line of CPAN.pm output is:\n\t$lines[-1]" ); + + $lines[-1]; + } +} + +BEGIN { +my $epic_fail_words = join '|', + qw( Error stop(?:ping)? problems force not unsupported + fail(?:ed)? Cannot\s+install ); + +sub _cpanpm_output_indicates_failure + { + my $last_line = _get_cpanpm_last_line(); + + my $result = $last_line =~ /\b(?:$epic_fail_words)\b/i; + return A_MODULE_FAILED_TO_INSTALL if $last_line =~ /\b(?:Cannot\s+install)\b/i; + + $result || (); + } +} + +sub _cpanpm_output_indicates_success + { + my $last_line = _get_cpanpm_last_line(); + + my $result = $last_line =~ /\b(?:\s+-- OK|PASS)\b/; + $result || (); + } + +sub _cpanpm_output_is_vague + { + return FALSE if + _cpanpm_output_indicates_failure() || + _cpanpm_output_indicates_success(); + + return TRUE; + } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +sub _turn_on_warnings { + carp "Warnings are implemented yet"; + return HEY_IT_WORKED; + } + +sub _turn_off_testing { + $logger->debug( 'Trusting test report history' ); + $CPAN::Config->{trust_test_report_history} = 1; + return HEY_IT_WORKED; + } + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +sub _print_help + { + $logger->info( "Use perldoc to read the documentation" ); + my $HAVE_PERLDOC = eval { require Pod::Perldoc; 1; }; + if ($HAVE_PERLDOC) { + system qq{"$^X" -e "require Pod::Perldoc; Pod::Perldoc->run()" $0}; + exit; + } else { + warn "Please install Pod::Perldoc, maybe try 'cpan -i Pod::Perldoc'\n"; + return HEY_IT_WORKED; + } + } + +sub _print_version # -v + { + $logger->info( + "$0 script version $VERSION, CPAN.pm version " . CPAN->VERSION ); + + return HEY_IT_WORKED; + } + +sub _print_details # -V + { + _print_version(); + + _check_install_dirs(); + + $logger->info( '-' x 50 . "\nChecking configured mirrors..." ); + foreach my $mirror ( @{ $CPAN::Config->{urllist} } ) { + _print_ping_report( $mirror ); + } + + $logger->info( '-' x 50 . "\nChecking for faster mirrors..." ); + + { + require CPAN::Mirrors; + + if ( $CPAN::Config->{connect_to_internet_ok} ) { + $CPAN::Frontend->myprint(qq{Trying to fetch a mirror list from the Internet\n}); + eval { CPAN::FTP->localize('MIRRORED.BY',File::Spec->catfile($CPAN::Config->{keep_source_where},'MIRRORED.BY'),3,1) } + or $CPAN::Frontend->mywarn(<<'HERE'); +We failed to get a copy of the mirror list from the Internet. +You will need to provide CPAN mirror URLs yourself. +HERE + $CPAN::Frontend->myprint("\n"); + } + + my $mirrors = CPAN::Mirrors->new( _mirror_file() ); + my @continents = $mirrors->find_best_continents; + + my @mirrors = $mirrors->get_mirrors_by_continents( $continents[0] ); + my @timings = $mirrors->get_mirrors_timings( \@mirrors ); + + foreach my $timing ( @timings ) { + $logger->info( sprintf "%s (%0.2f ms)", + $timing->hostname, $timing->rtt ); + } + } + + return HEY_IT_WORKED; + } + +sub _check_install_dirs + { + my $makepl_arg = $CPAN::Config->{makepl_arg}; + my $mbuildpl_arg = $CPAN::Config->{mbuildpl_arg}; + + my @custom_dirs; + # PERL_MM_OPT + push @custom_dirs, + $makepl_arg =~ m/INSTALL_BASE\s*=\s*(\S+)/g, + $mbuildpl_arg =~ m/--install_base\s*=\s*(\S+)/g; + + if( @custom_dirs ) { + foreach my $dir ( @custom_dirs ) { + _print_inc_dir_report( $dir ); + } + } + + # XXX: also need to check makepl_args, etc + + my @checks = ( + [ 'core', [ grep $_, @Config{qw(installprivlib installarchlib)} ] ], + [ 'vendor', [ grep $_, @Config{qw(installvendorlib installvendorarch)} ] ], + [ 'site', [ grep $_, @Config{qw(installsitelib installsitearch)} ] ], + [ 'PERL5LIB', _split_paths( $ENV{PERL5LIB} ) ], + [ 'PERLLIB', _split_paths( $ENV{PERLLIB} ) ], + ); + + $logger->info( '-' x 50 . "\nChecking install dirs..." ); + foreach my $tuple ( @checks ) { + my( $label ) = $tuple->[0]; + + $logger->info( "Checking $label" ); + $logger->info( "\tno directories for $label" ) unless @{ $tuple->[1] }; + foreach my $dir ( @{ $tuple->[1] } ) { + _print_inc_dir_report( $dir ); + } + } + + } + +sub _split_paths + { + [ map { _expand_filename( $_ ) } split /$Config{path_sep}/, $_[0] || '' ]; + } + + +=pod + +Stolen from File::Path::Expand + +=cut + +sub _expand_filename + { + my( $path ) = @_; + no warnings 'uninitialized'; + $logger->debug( "Expanding path $path\n" ); + $path =~ s{\A~([^/]+)?}{ + _home_of( $1 || $> ) || "~$1" + }e; + return $path; + } + +sub _home_of + { + require User::pwent; + my( $user ) = @_; + my $ent = User::pwent::getpw($user) or return; + return $ent->dir; + } + +sub _get_default_inc + { + require Config; + + [ @Config::Config{ _vars() }, '.' ]; + } + +sub _vars { + qw( + installarchlib + installprivlib + installsitearch + installsitelib + ); + } + +sub _ping_mirrors { + my $urls = $CPAN::Config->{urllist}; + require URI; + + foreach my $url ( @$urls ) { + my( $obj ) = URI->new( $url ); + next unless _is_pingable_scheme( $obj ); + my $host = $obj->host; + _print_ping_report( $obj ); + } + + } + +sub _is_pingable_scheme { + my( $uri ) = @_; + + $uri->scheme eq 'file' + } + +sub _mirror_file { + my $file = do { + my $file = 'MIRRORED.BY'; + my $local_path = File::Spec->catfile( + $CPAN::Config->{keep_source_where}, $file ); + + if( -e $local_path ) { $local_path } + else { + require CPAN::FTP; + CPAN::FTP->localize( $file, $local_path, 3, 1 ); + $local_path; + } + }; + } + +sub _find_good_mirrors { + require CPAN::Mirrors; + + my $mirrors = CPAN::Mirrors->new( _mirror_file() ); + + my @mirrors = $mirrors->best_mirrors( + how_many => 5, + verbose => 1, + ); + + foreach my $mirror ( @mirrors ) { + next unless eval { $mirror->can( 'http' ) }; + _print_ping_report( $mirror->http ); + } + + $CPAN::Config->{urllist} = [ + map { $_->http } @mirrors + ]; + } + +sub _print_inc_dir_report + { + my( $dir ) = shift; + + my $writeable = -w $dir ? '+' : '!!! (not writeable)'; + $logger->info( "\t$writeable $dir" ); + return -w $dir; + } + +sub _print_ping_report + { + my( $mirror ) = @_; + + my $rtt = eval { _get_ping_report( $mirror ) }; + my $result = $rtt ? sprintf "+ (%4d ms)", $rtt * 1000 : '!'; + + $logger->info( + sprintf "\t%s %s", $result, $mirror + ); + } + +sub _get_ping_report + { + require URI; + my( $mirror ) = @_; + my( $url ) = ref $mirror ? $mirror : URI->new( $mirror ); #XXX + require Net::Ping; + + my $ping = Net::Ping->new( 'tcp', 1 ); + + if( $url->scheme eq 'file' ) { + return -e $url->file; + } + + my( $port ) = $url->port; + + return unless $port; + + if ( $ping->can('port_number') ) { + $ping->port_number($port); + } + else { + $ping->{'port_num'} = $port; + } + + $ping->hires(1) if $ping->can( 'hires' ); + my( $alive, $rtt ) = eval{ $ping->ping( $url->host ) }; + $alive ? $rtt : undef; + } + +sub _load_local_lib # -I + { + $logger->debug( "Loading local::lib" ); + + my $rc = _safe_load_module("local::lib"); + unless( $rc ) { + $logger->logdie( "Could not load local::lib" ); + } + + local::lib->import; + + return HEY_IT_WORKED; + } + +sub _use_these_mirrors # -M + { + $logger->debug( "Setting per session mirrors" ); + unless( $_[0] ) { + $logger->logdie( "The -M switch requires a comma-separated list of mirrors" ); + } + + $CPAN::Config->{urllist} = [ split /,/, $_[0] ]; + + $logger->debug( "Mirrors are @{$CPAN::Config->{urllist}}" ); + + } + +sub _create_autobundle + { + $logger->info( + "Creating autobundle in $CPAN::Config->{cpan_home}/Bundle" ); + + CPAN::Shell->autobundle; + + return HEY_IT_WORKED; + } + +sub _recompile + { + $logger->info( "Recompiling dynamically-loaded extensions" ); + + CPAN::Shell->recompile; + + return HEY_IT_WORKED; + } + +sub _upgrade + { + $logger->info( "Upgrading all modules" ); + + CPAN::Shell->upgrade(); + + return HEY_IT_WORKED; + } + +sub _shell + { + $logger->info( "Dropping into shell" ); + + CPAN::shell(); + + return HEY_IT_WORKED; + } + +sub _load_config # -j + { + my $argument = shift; + + my $file = file_name_is_absolute( $argument ) ? $argument : rel2abs( $argument ); + croak( "cpan config file [$file] for -j does not exist!\n" ) unless -e $file; + + # should I clear out any existing config here? + $CPAN::Config = {}; + delete $INC{'CPAN/Config.pm'}; + + my $rc = eval "require '$file'"; + + # CPAN::HandleConfig::require_myconfig_or_config looks for this + $INC{'CPAN/MyConfig.pm'} = 'fake out!'; + + # CPAN::HandleConfig::load looks for this + $CPAN::Config_loaded = 'fake out'; + + croak( "Could not load [$file]: $@\n") unless $rc; + + return HEY_IT_WORKED; + } + +sub _dump_config # -J + { + my $args = shift; + require Data::Dumper; + + my $fh = $args->[0] || \*STDOUT; + + local $Data::Dumper::Sortkeys = 1; + my $dd = Data::Dumper->new( + [$CPAN::Config], + ['$CPAN::Config'] + ); + + print $fh $dd->Dump, "\n1;\n__END__\n"; + + return HEY_IT_WORKED; + } + +sub _lock_lobotomy # -F + { + no warnings 'redefine'; + + *CPAN::_flock = sub { 1 }; + *CPAN::checklock = sub { 1 }; + + return HEY_IT_WORKED; + } + +sub _download + { + my $args = shift; + + local $CPAN::DEBUG = 1; + + my %paths; + + foreach my $arg ( @$args ) { + $logger->info( "Checking $arg" ); + + my $module = _expand_module( $arg ) or next; + my $path = $module->cpan_file; + + $logger->debug( "Inst file would be $path\n" ); + + $paths{$module} = _get_file( _make_path( $path ) ); + + $logger->info( "Downloaded [$arg] to [$paths{$arg}]" ); + } + + return \%paths; + } + +sub _make_path { join "/", qw(authors id), $_[0] } + +sub _get_file + { + my $path = shift; + + my $loaded = _safe_load_module("LWP::Simple"); + croak "You need LWP::Simple to use features that fetch files from CPAN\n" + unless $loaded; + + my $file = substr $path, rindex( $path, '/' ) + 1; + my $store_path = catfile( cwd(), $file ); + $logger->debug( "Store path is $store_path" ); + + foreach my $site ( @{ $CPAN::Config->{urllist} } ) + { + my $fetch_path = join "/", $site, $path; + $logger->debug( "Trying $fetch_path" ); + my $status_code = LWP::Simple::getstore( $fetch_path, $store_path ); + last if( 200 <= $status_code and $status_code <= 300 ); + $logger->warn( "Could not get [$fetch_path]: Status code $status_code" ); + } + + return $store_path; + } + +sub _gitify + { + my $args = shift; + + my $loaded = _safe_load_module("Archive::Extract"); + croak "You need Archive::Extract to use features that gitify distributions\n" + unless $loaded; + + my $starting_dir = cwd(); + + foreach my $arg ( @$args ) + { + $logger->info( "Checking $arg" ); + my $store_paths = _download( [ $arg ] ); + $logger->debug( "gitify Store path is $store_paths->{$arg}" ); + my $dirname = dirname( $store_paths->{$arg} ); + + my $ae = Archive::Extract->new( archive => $store_paths->{$arg} ); + $ae->extract( to => $dirname ); + + chdir $ae->extract_path; + + my $git = $ENV{GIT_COMMAND} || '/usr/local/bin/git'; + croak "Could not find $git" unless -e $git; + croak "$git is not executable" unless -x $git; + + # can we do this in Pure Perl? + system( $git, 'init' ); + system( $git, qw( add . ) ); + system( $git, qw( commit -a -m ), 'initial import' ); + } + + chdir $starting_dir; + + return HEY_IT_WORKED; + } + +sub _show_Changes + { + my $args = shift; + + foreach my $arg ( @$args ) + { + $logger->info( "Checking $arg\n" ); + + my $module = _expand_module( $arg ) or next; + + my $out = _get_cpanpm_output(); + + next unless eval { $module->inst_file }; + #next if $module->uptodate; + + ( my $id = $module->id() ) =~ s/::/\-/; + + my $url = "http://search.cpan.org/~" . lc( $module->userid ) . "/" . + $id . "-" . $module->cpan_version() . "/"; + + #print "URL: $url\n"; + _get_changes_file($url); + } + + return HEY_IT_WORKED; + } + +sub _get_changes_file + { + croak "Reading Changes files requires LWP::Simple and URI\n" + unless _safe_load_module("LWP::Simple") && _safe_load_module("URI"); + + my $url = shift; + + my $content = LWP::Simple::get( $url ); + $logger->info( "Got $url ..." ) if defined $content; + #print $content; + + my( $change_link ) = $content =~ m|Changes|gi; + + my $changes_url = URI->new_abs( $change_link, $url ); + $logger->debug( "Change link is: $changes_url" ); + + my $changes = LWP::Simple::get( $changes_url ); + + print $changes; + + return HEY_IT_WORKED; + } + +sub _show_Author + { + my $args = shift; + + foreach my $arg ( @$args ) + { + my $module = _expand_module( $arg ) or next; + + unless( $module ) + { + $logger->info( "Didn't find a $arg module, so no author!" ); + next; + } + + my $author = CPAN::Shell->expand( "Author", $module->userid ); + + next unless $module->userid; + + printf "%-25s %-8s %-25s %s\n", + $arg, $module->userid, $author->email, $author->name; + } + + return HEY_IT_WORKED; + } + +sub _show_Details + { + my $args = shift; + + foreach my $arg ( @$args ) + { + my $module = _expand_module( $arg ) or next; + my $author = CPAN::Shell->expand( "Author", $module->userid ); + + next unless $module->userid; + + print "$arg\n", "-" x 73, "\n\t"; + print join "\n\t", + $module->description ? $module->description : "(no description)", + $module->cpan_file ? $module->cpan_file : "(no cpanfile)", + $module->inst_file ? $module->inst_file :"(no installation file)" , + 'Installed: ' . ($module->inst_version ? $module->inst_version : "not installed"), + 'CPAN: ' . $module->cpan_version . ' ' . + ($module->uptodate ? "" : "Not ") . "up to date", + $author->fullname . " (" . $module->userid . ")", + $author->email; + print "\n\n"; + + } + + return HEY_IT_WORKED; + } + +BEGIN { +my $modules; +sub _get_all_namespaces + { + return $modules if $modules; + $modules = [ map { $_->id } CPAN::Shell->expand( "Module", "/./" ) ]; + } +} + +sub _show_out_of_date + { + my $modules = _get_all_namespaces(); + + printf "%-40s %6s %6s\n", "Module Name", "Local", "CPAN"; + print "-" x 73, "\n"; + + foreach my $module ( @$modules ) + { + next unless $module = _expand_module($module); + next unless $module->inst_file; + next if $module->uptodate; + printf "%-40s %.4f %.4f\n", + $module->id, + $module->inst_version ? $module->inst_version : '', + $module->cpan_version; + } + + return HEY_IT_WORKED; + } + +sub _show_author_mods + { + my $args = shift; + + my %hash = map { lc $_, 1 } @$args; + + my $modules = _get_all_namespaces(); + + foreach my $module ( @$modules ) { + next unless exists $hash{ lc $module->userid }; + print $module->id, "\n"; + } + + return HEY_IT_WORKED; + } + +sub _list_all_mods # -l + { + require File::Find; + + my $args = shift; + + + my $fh = \*STDOUT; + + INC: foreach my $inc ( @INC ) + { + my( $wanted, $reporter ) = _generator(); + File::Find::find( { wanted => $wanted }, $inc ); + + my $count = 0; + FILE: foreach my $file ( @{ $reporter->() } ) + { + my $version = _parse_version_safely( $file ); + + my $module_name = _path_to_module( $inc, $file ); + next FILE unless defined $module_name; + + print $fh "$module_name\t$version\n"; + + #last if $count++ > 5; + } + } + + return HEY_IT_WORKED; + } + +sub _generator + { + my @files = (); + + sub { push @files, + File::Spec->canonpath( $File::Find::name ) + if m/\A\w+\.pm\z/ }, + sub { \@files }, + } + +sub _parse_version_safely # stolen from PAUSE's mldistwatch, but refactored + { + my( $file ) = @_; + + local $/ = "\n"; + local $_; # don't mess with the $_ in the map calling this + + return unless open FILE, "<$file"; + + my $in_pod = 0; + my $version; + while( ) + { + chomp; + $in_pod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $in_pod; + next if $in_pod || /^\s*#/; + + next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/; + my( $sigil, $var ) = ( $1, $2 ); + + $version = _eval_version( $_, $sigil, $var ); + last; + } + close FILE; + + return 'undef' unless defined $version; + + return $version; + } + +sub _eval_version + { + my( $line, $sigil, $var ) = @_; + + # split package line to hide from PAUSE + my $eval = qq{ + package + ExtUtils::MakeMaker::_version; + + local $sigil$var; + \$$var=undef; do { + $line + }; \$$var + }; + + my $version = do { + local $^W = 0; + no strict; + eval( $eval ); + }; + + return $version; + } + +sub _path_to_module + { + my( $inc, $path ) = @_; + return if length $path < length $inc; + + my $module_path = substr( $path, length $inc ); + $module_path =~ s/\.pm\z//; + + # XXX: this is cheating and doesn't handle everything right + my @dirs = grep { ! /\W/ } File::Spec->splitdir( $module_path ); + shift @dirs; + + my $module_name = join "::", @dirs; + + return $module_name; + } + + +sub _expand_module + { + my( $module ) = @_; + + my $expanded = CPAN::Shell->expandany( $module ); + return $expanded if $expanded; + $expanded = CPAN::Shell->expand( "Module", $module ); + unless( defined $expanded ) { + $logger->error( "Could not expand [$module]. Check the module name." ); + my $threshold = ( + grep { int } + sort { length $a <=> length $b } + length($module)/4, 4 + )[0]; + + my $guesses = _guess_at_module_name( $module, $threshold ); + if( defined $guesses and @$guesses ) { + $logger->info( "Perhaps you meant one of these:" ); + foreach my $guess ( @$guesses ) { + $logger->info( "\t$guess" ); + } + } + return; + } + + return $expanded; + } + +my $guessers = [ + [ qw( Text::Levenshtein::XS distance 7 1 ) ], + [ qw( Text::Levenshtein::Damerau::XS xs_edistance 7 1 ) ], + + [ qw( Text::Levenshtein distance 7 1 ) ], + [ qw( Text::Levenshtein::Damerau::PP pp_edistance 7 1 ) ], + + ]; + +sub _disable_guessers + { + $_->[-1] = 0 for @$guessers; + } + +# for -x +sub _guess_namespace + { + my $args = shift; + + foreach my $arg ( @$args ) + { + $logger->debug( "Checking $arg" ); + my $guesses = _guess_at_module_name( $arg ); + + foreach my $guess ( @$guesses ) { + print $guess, "\n"; + } + } + + return HEY_IT_WORKED; + } + +sub _list_all_namespaces { + my $modules = _get_all_namespaces(); + + foreach my $module ( @$modules ) { + print $module, "\n"; + } + } + +BEGIN { +my $distance; +my $_threshold; +my $can_guess; +my $shown_help = 0; +sub _guess_at_module_name + { + my( $target, $threshold ) = @_; + + unless( defined $distance ) { + foreach my $try ( @$guessers ) { + $can_guess = eval "require $try->[0]; 1" or next; + + $try->[-1] or next; # disabled + no strict 'refs'; + $distance = \&{ join "::", @$try[0,1] }; + $threshold ||= $try->[2]; + } + } + $_threshold ||= $threshold; + + unless( $distance ) { + unless( $shown_help ) { + my $modules = join ", ", map { $_->[0] } @$guessers; + substr $modules, rindex( $modules, ',' ), 1, ', and'; + + # Should this be colorized? + if( $can_guess ) { + $logger->info( "I can suggest names if you provide the -x option on invocation." ); + } + else { + $logger->info( "I can suggest names if you install one of $modules" ); + $logger->info( "and you provide the -x option on invocation." ); + } + $shown_help++; + } + return; + } + + my $modules = _get_all_namespaces(); + $logger->info( "Checking " . @$modules . " namespaces for close match suggestions" ); + + my %guesses; + foreach my $guess ( @$modules ) { + my $distance = $distance->( $target, $guess ); + next if $distance > $_threshold; + $guesses{$guess} = $distance; + } + + my @guesses = sort { $guesses{$a} <=> $guesses{$b} } keys %guesses; + return [ grep { defined } @guesses[0..9] ]; + } +} + +1; + +=back + +=head1 EXIT VALUES + +The script exits with zero if it thinks that everything worked, or a +positive number if it thinks that something failed. Note, however, that +in some cases it has to divine a failure by the output of things it does +not control. For now, the exit codes are vague: + + 1 An unknown error + + 2 The was an external problem + + 4 There was an internal problem with the script + + 8 A module failed to install + +=head1 TO DO + +* There is initial support for Log4perl if it is available, but I +haven't gone through everything to make the NullLogger work out +correctly if Log4perl is not installed. + +* When I capture CPAN.pm output, I need to check for errors and +report them to the user. + +* Warnings switch + +* Check then exit + +=head1 BUGS + +* none noted + +=head1 SEE ALSO + +L, L + +=head1 SOURCE AVAILABILITY + +This code is in Github in the CPAN.pm repository: + + https://github.com/andk/cpanpm + +The source used to be tracked separately in another GitHub repo, +but the canonical source is now in the above repo. + +=head1 CREDITS + +Japheth Cleaver added the bits to allow a forced install (C<-f>). + +Jim Brandt suggest and provided the initial implementation for the +up-to-date and Changes features. + +Adam Kennedy pointed out that C causes problems on Windows +where this script ends up with a .bat extension + +David Golden helps integrate this into the C repos. + +Jim Keenan fixed up various issues with _download + +=head1 AUTHOR + +brian d foy, C<< >> + +=head1 COPYRIGHT + +Copyright (c) 2001-2018, brian d foy, All Rights Reserved. + +You may redistribute this under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# indent-tabs-mode: t +# cperl-indent-level: 8 +# cperl-continued-statement-offset: 8 +# End: diff --git a/data/miniconda3/lib/perl5/core_perl/App/Prove.pm b/data/miniconda3/lib/perl5/core_perl/App/Prove.pm new file mode 100644 index 0000000000000000000000000000000000000000..9298726d24ff2fa5998a8ad3ca653db76886c520 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/App/Prove.pm @@ -0,0 +1,829 @@ +package App::Prove; + +use strict; +use warnings; + +use TAP::Harness::Env; +use Text::ParseWords qw(shellwords); +use File::Spec; +use Getopt::Long; +use App::Prove::State; +use Carp; + +use base 'TAP::Object'; + +=head1 NAME + +App::Prove - Implements the C command. + +=head1 VERSION + +Version 3.42 + +=cut + +our $VERSION = '3.42'; + +=head1 DESCRIPTION + +L provides a command, C, which runs a TAP based +test suite and prints a report. The C command is a minimal +wrapper around an instance of this module. + +=head1 SYNOPSIS + + use App::Prove; + + my $app = App::Prove->new; + $app->process_args(@ARGV); + $app->run; + +=cut + +use constant IS_WIN32 => ( $^O =~ /^(MS)?Win32$/ ); +use constant IS_VMS => $^O eq 'VMS'; +use constant IS_UNIXY => !( IS_VMS || IS_WIN32 ); + +use constant STATE_FILE => IS_UNIXY ? '.prove' : '_prove'; +use constant RC_FILE => IS_UNIXY ? '.proverc' : '_proverc'; + +use constant PLUGINS => 'App::Prove::Plugin'; + +my @ATTR; + +BEGIN { + @ATTR = qw( + archive argv blib show_count color directives exec failures comments + formatter harness includes modules plugins jobs lib merge parse quiet + really_quiet recurse backwards shuffle taint_fail taint_warn timer + verbose warnings_fail warnings_warn show_help show_man show_version + state_class test_args state dry extensions ignore_exit rules state_manager + normalize sources tapversion trap + statefile + ); + __PACKAGE__->mk_methods(@ATTR); +} + +=head1 METHODS + +=head2 Class Methods + +=head3 C + +Create a new C. Optionally a hash ref of attribute +initializers may be passed. + +=cut + +# new() implementation supplied by TAP::Object + +sub _initialize { + my $self = shift; + my $args = shift || {}; + + my @is_array = qw( + argv rc_opts includes modules state plugins rules sources + ); + + # setup defaults: + for my $key (@is_array) { + $self->{$key} = []; + } + + for my $attr (@ATTR) { + if ( exists $args->{$attr} ) { + + # TODO: Some validation here + $self->{$attr} = $args->{$attr}; + } + } + + $self->state_class('App::Prove::State'); + return $self; +} + +=head3 C + +Getter/setter for the name of the class used for maintaining state. This +class should either subclass from C or provide an identical +interface. + +=head3 C + +Getter/setter for the instance of the C. + +=cut + +=head3 C + + $prove->add_rc_file('myproj/.proverc'); + +Called before C to prepend the contents of an rc file to +the options. + +=cut + +sub add_rc_file { + my ( $self, $rc_file ) = @_; + + local *RC; + open RC, "<$rc_file" or croak "Can't read $rc_file ($!)"; + while ( defined( my $line = ) ) { + push @{ $self->{rc_opts} }, + grep { defined and not /^#/ } + $line =~ m{ ' ([^']*) ' | " ([^"]*) " | (\#.*) | (\S+) }xg; + } + close RC; +} + +=head3 C + + $prove->process_args(@args); + +Processes the command-line arguments. Attributes will be set +appropriately. Any filenames may be found in the C attribute. + +Dies on invalid arguments. + +=cut + +sub process_args { + my $self = shift; + + my @rc = RC_FILE; + unshift @rc, glob '~/' . RC_FILE if IS_UNIXY; + + # Preprocess meta-args. + my @args; + while ( defined( my $arg = shift ) ) { + if ( $arg eq '--norc' ) { + @rc = (); + } + elsif ( $arg eq '--rc' ) { + defined( my $rc = shift ) + or croak "Missing argument to --rc"; + push @rc, $rc; + } + elsif ( $arg =~ m{^--rc=(.+)$} ) { + push @rc, $1; + } + else { + push @args, $arg; + } + } + + # Everything after the arisdottle '::' gets passed as args to + # test programs. + if ( defined( my $stop_at = _first_pos( '::', @args ) ) ) { + my @test_args = splice @args, $stop_at; + shift @test_args; + $self->{test_args} = \@test_args; + } + + # Grab options from RC files + $self->add_rc_file($_) for grep -f, @rc; + unshift @args, @{ $self->{rc_opts} }; + + if ( my @bad = map {"-$_"} grep {/^-(man|help)$/} @args ) { + die "Long options should be written with two dashes: ", + join( ', ', @bad ), "\n"; + } + + # And finally... + + { + local @ARGV = @args; + Getopt::Long::Configure(qw(no_ignore_case bundling pass_through)); + + # Don't add coderefs to GetOptions + GetOptions( + 'v|verbose' => \$self->{verbose}, + 'f|failures' => \$self->{failures}, + 'o|comments' => \$self->{comments}, + 'l|lib' => \$self->{lib}, + 'b|blib' => \$self->{blib}, + 's|shuffle' => \$self->{shuffle}, + 'color!' => \$self->{color}, + 'colour!' => \$self->{color}, + 'count!' => \$self->{show_count}, + 'c' => \$self->{color}, + 'D|dry' => \$self->{dry}, + 'ext=s@' => sub { + my ( $opt, $val ) = @_; + + # Workaround for Getopt::Long 2.25 handling of + # multivalue options + push @{ $self->{extensions} ||= [] }, $val; + }, + 'harness=s' => \$self->{harness}, + 'ignore-exit' => \$self->{ignore_exit}, + 'source=s@' => $self->{sources}, + 'formatter=s' => \$self->{formatter}, + 'r|recurse' => \$self->{recurse}, + 'reverse' => \$self->{backwards}, + 'p|parse' => \$self->{parse}, + 'q|quiet' => \$self->{quiet}, + 'Q|QUIET' => \$self->{really_quiet}, + 'e|exec=s' => \$self->{exec}, + 'm|merge' => \$self->{merge}, + 'I=s@' => $self->{includes}, + 'M=s@' => $self->{modules}, + 'P=s@' => $self->{plugins}, + 'state=s@' => $self->{state}, + 'statefile=s' => \$self->{statefile}, + 'directives' => \$self->{directives}, + 'h|help|?' => \$self->{show_help}, + 'H|man' => \$self->{show_man}, + 'V|version' => \$self->{show_version}, + 'a|archive=s' => \$self->{archive}, + 'j|jobs=i' => \$self->{jobs}, + 'timer' => \$self->{timer}, + 'T' => \$self->{taint_fail}, + 't' => \$self->{taint_warn}, + 'W' => \$self->{warnings_fail}, + 'w' => \$self->{warnings_warn}, + 'normalize' => \$self->{normalize}, + 'rules=s@' => $self->{rules}, + 'tapversion=s' => \$self->{tapversion}, + 'trap' => \$self->{trap}, + ) or croak('Unable to continue'); + + # Stash the remainder of argv for later + $self->{argv} = [@ARGV]; + } + + return; +} + +sub _first_pos { + my $want = shift; + for ( 0 .. $#_ ) { + return $_ if $_[$_] eq $want; + } + return; +} + +sub _help { + my ( $self, $verbosity ) = @_; + + eval('use Pod::Usage 1.12 ()'); + if ( my $err = $@ ) { + die 'Please install Pod::Usage for the --help option ' + . '(or try `perldoc prove`.)' + . "\n ($@)"; + } + + Pod::Usage::pod2usage( { -verbose => $verbosity } ); + + return; +} + +sub _color_default { + my $self = shift; + + return -t STDOUT && !$ENV{HARNESS_NOTTY}; +} + +sub _get_args { + my $self = shift; + + my %args; + + $args{trap} = 1 if $self->trap; + + if ( defined $self->color ? $self->color : $self->_color_default ) { + $args{color} = 1; + } + if ( !defined $self->show_count ) { + $args{show_count} = 1; + } + else { + $args{show_count} = $self->show_count; + } + + if ( $self->archive ) { + $self->require_harness( archive => 'TAP::Harness::Archive' ); + $args{archive} = $self->archive; + } + + if ( my $jobs = $self->jobs ) { + $args{jobs} = $jobs; + } + + if ( my $harness_opt = $self->harness ) { + $self->require_harness( harness => $harness_opt ); + } + + if ( my $formatter = $self->formatter ) { + $args{formatter_class} = $formatter; + } + + for my $handler ( @{ $self->sources } ) { + my ( $name, $config ) = $self->_parse_source($handler); + $args{sources}->{$name} = $config; + } + + if ( $self->ignore_exit ) { + $args{ignore_exit} = 1; + } + + if ( $self->taint_fail && $self->taint_warn ) { + die '-t and -T are mutually exclusive'; + } + + if ( $self->warnings_fail && $self->warnings_warn ) { + die '-w and -W are mutually exclusive'; + } + + for my $a (qw( lib switches )) { + my $method = "_get_$a"; + my $val = $self->$method(); + $args{$a} = $val if defined $val; + } + + # Handle verbose, quiet, really_quiet flags + my %verb_map = ( verbose => 1, quiet => -1, really_quiet => -2, ); + + my @verb_adj = grep {$_} map { $self->$_() ? $verb_map{$_} : 0 } + keys %verb_map; + + die "Only one of verbose, quiet or really_quiet should be specified\n" + if @verb_adj > 1; + + $args{verbosity} = shift @verb_adj || 0; + + for my $a (qw( merge failures comments timer directives normalize )) { + $args{$a} = 1 if $self->$a(); + } + + $args{errors} = 1 if $self->parse; + + # defined but zero-length exec runs test files as binaries + $args{exec} = [ split( /\s+/, $self->exec ) ] + if ( defined( $self->exec ) ); + + $args{version} = $self->tapversion if defined( $self->tapversion ); + + if ( defined( my $test_args = $self->test_args ) ) { + $args{test_args} = $test_args; + } + + if ( @{ $self->rules } ) { + my @rules; + for ( @{ $self->rules } ) { + if (/^par=(.*)/) { + push @rules, $1; + } + elsif (/^seq=(.*)/) { + push @rules, { seq => $1 }; + } + } + $args{rules} = { par => [@rules] }; + } + $args{harness_class} = $self->{harness_class} if $self->{harness_class}; + + return \%args; +} + +sub _find_module { + my ( $self, $class, @search ) = @_; + + croak "Bad module name $class" + unless $class =~ /^ \w+ (?: :: \w+ ) *$/x; + + for my $pfx (@search) { + my $name = join( '::', $pfx, $class ); + eval "require $name"; + return $name unless $@; + } + + eval "require $class"; + return $class unless $@; + return; +} + +sub _load_extension { + my ( $self, $name, @search ) = @_; + + my @args = (); + if ( $name =~ /^(.*?)=(.*)/ ) { + $name = $1; + @args = split( /,/, $2 ); + } + + if ( my $class = $self->_find_module( $name, @search ) ) { + $class->import(@args); + if ( $class->can('load') ) { + $class->load( { app_prove => $self, args => [@args] } ); + } + } + else { + croak "Can't load module $name"; + } +} + +sub _load_extensions { + my ( $self, $ext, @search ) = @_; + $self->_load_extension( $_, @search ) for @$ext; +} + +sub _parse_source { + my ( $self, $handler ) = @_; + + # Load any options. + ( my $opt_name = lc $handler ) =~ s/::/-/g; + local @ARGV = @{ $self->{argv} }; + my %config; + Getopt::Long::GetOptions( + "$opt_name-option=s%" => sub { + my ( $name, $k, $v ) = @_; + if ( $v =~ /(? $v; + } + else { + $config{$k} = $v; + } + } + } + ); + $self->{argv} = \@ARGV; + return ( $handler, \%config ); +} + +=head3 C + +Perform whatever actions the command line args specified. The C +command line tool consists of the following code: + + use App::Prove; + + my $app = App::Prove->new; + $app->process_args(@ARGV); + exit( $app->run ? 0 : 1 ); # if you need the exit code + +=cut + +sub run { + my $self = shift; + + unless ( $self->state_manager ) { + $self->state_manager( + $self->state_class->new( { store => $self->statefile || STATE_FILE } ) ); + } + + if ( $self->show_help ) { + $self->_help(1); + } + elsif ( $self->show_man ) { + $self->_help(2); + } + elsif ( $self->show_version ) { + $self->print_version; + } + elsif ( $self->dry ) { + print "$_\n" for $self->_get_tests; + } + else { + + $self->_load_extensions( $self->modules ); + $self->_load_extensions( $self->plugins, PLUGINS ); + + local $ENV{TEST_VERBOSE} = 1 if $self->verbose; + + return $self->_runtests( $self->_get_args, $self->_get_tests ); + } + + return 1; +} + +sub _get_tests { + my $self = shift; + + my $state = $self->state_manager; + my $ext = $self->extensions; + $state->extensions($ext) if defined $ext; + if ( defined( my $state_switch = $self->state ) ) { + $state->apply_switch(@$state_switch); + } + + my @tests = $state->get_tests( $self->recurse, @{ $self->argv } ); + + $self->_shuffle(@tests) if $self->shuffle; + @tests = reverse @tests if $self->backwards; + + return @tests; +} + +sub _runtests { + my ( $self, $args, @tests ) = @_; + my $harness = TAP::Harness::Env->create($args); + + my $state = $self->state_manager; + + $harness->callback( + after_test => sub { + $state->observe_test(@_); + } + ); + + $harness->callback( + after_runtests => sub { + $state->commit(@_); + } + ); + + my $aggregator = $harness->runtests(@tests); + + return !$aggregator->has_errors; +} + +sub _get_switches { + my $self = shift; + my @switches; + + # notes that -T or -t must be at the front of the switches! + if ( $self->taint_fail ) { + push @switches, '-T'; + } + elsif ( $self->taint_warn ) { + push @switches, '-t'; + } + if ( $self->warnings_fail ) { + push @switches, '-W'; + } + elsif ( $self->warnings_warn ) { + push @switches, '-w'; + } + + return @switches ? \@switches : (); +} + +sub _get_lib { + my $self = shift; + my @libs; + if ( $self->lib ) { + push @libs, 'lib'; + } + if ( $self->blib ) { + push @libs, 'blib/lib', 'blib/arch'; + } + if ( @{ $self->includes } ) { + push @libs, @{ $self->includes }; + } + + #24926 + @libs = map { File::Spec->rel2abs($_) } @libs; + + # Huh? + return @libs ? \@libs : (); +} + +sub _shuffle { + my $self = shift; + + # Fisher-Yates shuffle + my $i = @_; + while ($i) { + my $j = rand $i--; + @_[ $i, $j ] = @_[ $j, $i ]; + } + return; +} + +=head3 C + +Load a harness replacement class. + + $prove->require_harness($for => $class_name); + +=cut + +sub require_harness { + my ( $self, $for, $class ) = @_; + + my ($class_name) = $class =~ /^(\w+(?:::\w+)*)/; + + # Emulate Perl's -MModule=arg1,arg2 behaviour + $class =~ s!^(\w+(?:::\w+)*)=(.*)$!$1 split(/,/,q{$2})!; + + eval("use $class;"); + die "$class_name is required to use the --$for feature: $@" if $@; + + $self->{harness_class} = $class_name; + + return; +} + +=head3 C + +Display the version numbers of the loaded L and the +current Perl. + +=cut + +sub print_version { + my $self = shift; + require TAP::Harness; + printf( + "TAP::Harness v%s and Perl v%vd\n", + $TAP::Harness::VERSION, $^V + ); + + return; +} + +1; + +# vim:ts=4:sw=4:et:sta + +__END__ + +=head2 Attributes + +After command line parsing the following attributes reflect the values +of the corresponding command line switches. They may be altered before +calling C. + +=over + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=item C + +=back + +=head1 PLUGINS + +C provides support for 3rd-party plugins. These are currently +loaded at run-time, I arguments have been parsed (so you can not +change the way arguments are processed, sorry), typically with the +C<< -PI >> switch, eg: + + prove -PMyPlugin + +This will search for a module named C, or failing +that, C. If the plugin can't be found, C will complain & exit. + +You can pass an argument to your plugin by appending an C<=> after the plugin +name, eg C<-PMyPlugin=foo>. You can pass multiple arguments using commas: + + prove -PMyPlugin=foo,bar,baz + +These are passed in to your plugin's C class method (if it has one), +along with a reference to the C object that is invoking your plugin: + + sub load { + my ($class, $p) = @_; + + my @args = @{ $p->{args} }; + # @args will contain ( 'foo', 'bar', 'baz' ) + $p->{app_prove}->do_something; + ... + } + +Note that the user's arguments are also passed to your plugin's C +function as a list, eg: + + sub import { + my ($class, @args) = @_; + # @args will contain ( 'foo', 'bar', 'baz' ) + ... + } + +This is for backwards compatibility, and may be deprecated in the future. + +=head2 Sample Plugin + +Here's a sample plugin, for your reference: + + package App::Prove::Plugin::Foo; + + # Sample plugin, try running with: + # prove -PFoo=bar -r -j3 + # prove -PFoo -Q + # prove -PFoo=bar,My::Formatter + + use strict; + use warnings; + + sub load { + my ($class, $p) = @_; + my @args = @{ $p->{args} }; + my $app = $p->{app_prove}; + + print "loading plugin: $class, args: ", join(', ', @args ), "\n"; + + # turn on verbosity + $app->verbose( 1 ); + + # set the formatter? + $app->formatter( $args[1] ) if @args > 1; + + # print some of App::Prove's state: + for my $attr (qw( jobs quiet really_quiet recurse verbose )) { + my $val = $app->$attr; + $val = 'undef' unless defined( $val ); + print "$attr: $val\n"; + } + + return 1; + } + + 1; + +=head1 SEE ALSO + +L, L + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Archive/Tar.pm b/data/miniconda3/lib/perl5/core_perl/Archive/Tar.pm new file mode 100644 index 0000000000000000000000000000000000000000..af6786ee51973ed65b9c57e9b244e7ab84658050 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Archive/Tar.pm @@ -0,0 +1,2437 @@ +### the gnu tar specification: +### http://www.gnu.org/software/tar/manual/tar.html +### +### and the pax format spec, which tar derives from: +### http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html + +package Archive::Tar; +require 5.005_03; + +use Cwd; +use IO::Zlib; +use IO::File; +use Carp qw(carp croak); +use File::Spec (); +use File::Spec::Unix (); +use File::Path (); + +use Archive::Tar::File; +use Archive::Tar::Constant; + +require Exporter; + +use strict; +use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD + $DO_NOT_USE_PREFIX $HAS_PERLIO $HAS_IO_STRING $SAME_PERMISSIONS + $INSECURE_EXTRACT_MODE $ZERO_PAD_NUMBERS @ISA @EXPORT $RESOLVE_SYMLINK + ]; + +@ISA = qw[Exporter]; +@EXPORT = qw[ COMPRESS_GZIP COMPRESS_BZIP COMPRESS_XZ ]; +$DEBUG = 0; +$WARN = 1; +$FOLLOW_SYMLINK = 0; +$VERSION = "2.36"; +$CHOWN = 1; +$CHMOD = 1; +$SAME_PERMISSIONS = $> == 0 ? 1 : 0; +$DO_NOT_USE_PREFIX = 0; +$INSECURE_EXTRACT_MODE = 0; +$ZERO_PAD_NUMBERS = 0; +$RESOLVE_SYMLINK = $ENV{'PERL5_AT_RESOLVE_SYMLINK'} || 'speed'; + +BEGIN { + use Config; + $HAS_PERLIO = $Config::Config{useperlio}; + + ### try and load IO::String anyway, so you can dynamically + ### switch between perlio and IO::String + $HAS_IO_STRING = eval { + require IO::String; + import IO::String; + 1; + } || 0; +} + +=head1 NAME + +Archive::Tar - module for manipulations of tar archives + +=head1 SYNOPSIS + + use Archive::Tar; + my $tar = Archive::Tar->new; + + $tar->read('origin.tgz'); + $tar->extract(); + + $tar->add_files('file/foo.pl', 'docs/README'); + $tar->add_data('file/baz.txt', 'This is the contents now'); + + $tar->rename('oldname', 'new/file/name'); + $tar->chown('/', 'root'); + $tar->chown('/', 'root:root'); + $tar->chmod('/tmp', '1777'); + + $tar->write('files.tar'); # plain tar + $tar->write('files.tgz', COMPRESS_GZIP); # gzip compressed + $tar->write('files.tbz', COMPRESS_BZIP); # bzip2 compressed + $tar->write('files.txz', COMPRESS_XZ); # xz compressed + +=head1 DESCRIPTION + +Archive::Tar provides an object oriented mechanism for handling tar +files. It provides class methods for quick and easy files handling +while also allowing for the creation of tar file objects for custom +manipulation. If you have the IO::Zlib module installed, +Archive::Tar will also support compressed or gzipped tar files. + +An object of class Archive::Tar represents a .tar(.gz) archive full +of files and things. + +=head1 Object Methods + +=head2 Archive::Tar->new( [$file, $compressed] ) + +Returns a new Tar object. If given any arguments, C calls the +C method automatically, passing on the arguments provided to +the C method. + +If C is invoked with arguments and the C method fails +for any reason, C returns undef. + +=cut + +my $tmpl = { + _data => [ ], + _file => 'Unknown', +}; + +### install get/set accessors for this object. +for my $key ( keys %$tmpl ) { + no strict 'refs'; + *{__PACKAGE__."::$key"} = sub { + my $self = shift; + $self->{$key} = $_[0] if @_; + return $self->{$key}; + } +} + +sub new { + my $class = shift; + $class = ref $class if ref $class; + + ### copying $tmpl here since a shallow copy makes it use the + ### same aref, causing for files to remain in memory always. + my $obj = bless { _data => [ ], _file => 'Unknown', _error => '' }, $class; + + if (@_) { + unless ( $obj->read( @_ ) ) { + $obj->_error(qq[No data could be read from file]); + return; + } + } + + return $obj; +} + +=head2 $tar->read ( $filename|$handle, [$compressed, {opt => 'val'}] ) + +Read the given tar file into memory. +The first argument can either be the name of a file or a reference to +an already open filehandle (or an IO::Zlib object if it's compressed) + +The C will I any previous content in C<$tar>! + +The second argument may be considered optional, but remains for +backwards compatibility. Archive::Tar now looks at the file +magic to determine what class should be used to open the file +and will transparently Do The Right Thing. + +Archive::Tar will warn if you try to pass a bzip2 / xz compressed file and the +IO::Uncompress::Bunzip2 / IO::Uncompress::UnXz are not available and simply return. + +Note that you can currently B pass a C compressed +filehandle, which is not opened with C, a C compressed +filehandle, which is not opened with C, a C compressed +filehandle, which is not opened with C, nor a string +containing the full archive information (either compressed or +uncompressed). These are worth while features, but not currently +implemented. See the C section. + +The third argument can be a hash reference with options. Note that +all options are case-sensitive. + +=over 4 + +=item limit + +Do not read more than C files. This is useful if you have +very big archives, and are only interested in the first few files. + +=item filter + +Can be set to a regular expression. Only files with names that match +the expression will be read. + +=item md5 + +Set to 1 and the md5sum of files will be returned (instead of file data) + my $iter = Archive::Tar->iter( $file, 1, {md5 => 1} ); + while( my $f = $iter->() ) { + print $f->data . "\t" . $f->full_path . $/; + } + +=item extract + +If set to true, immediately extract entries when reading them. This +gives you the same memory break as the C function. +Note however that entries will not be read into memory, but written +straight to disk. This means no C objects are +created for you to inspect. + +=back + +All files are stored internally as C objects. +Please consult the L documentation for details. + +Returns the number of files read in scalar context, and a list of +C objects in list context. + +=cut + +sub read { + my $self = shift; + my $file = shift; + my $gzip = shift || 0; + my $opts = shift || {}; + + unless( defined $file ) { + $self->_error( qq[No file to read from!] ); + return; + } else { + $self->_file( $file ); + } + + my $handle = $self->_get_handle($file, $gzip, READ_ONLY->( ZLIB ) ) + or return; + + my $data = $self->_read_tar( $handle, $opts ) or return; + + $self->_data( $data ); + + return wantarray ? @$data : scalar @$data; +} + +sub _get_handle { + my $self = shift; + my $file = shift; return unless defined $file; + my $compress = shift || 0; + my $mode = shift || READ_ONLY->( ZLIB ); # default to read only + + ### Check if file is a file handle or IO glob + if ( ref $file ) { + return $file if eval{ *$file{IO} }; + return $file if eval{ $file->isa(q{IO::Handle}) }; + $file = q{}.$file; + } + + ### get a FH opened to the right class, so we can use it transparently + ### throughout the program + my $fh; + { ### reading magic only makes sense if we're opening a file for + ### reading. otherwise, just use what the user requested. + my $magic = ''; + if( MODE_READ->($mode) ) { + open my $tmp, $file or do { + $self->_error( qq[Could not open '$file' for reading: $!] ); + return; + }; + + ### read the first 6 bytes of the file to figure out which class to + ### use to open the file. + sysread( $tmp, $magic, 6 ); + close $tmp; + } + + ### is it xz? + ### if you asked specifically for xz compression, or if we're in + ### read mode and the magic numbers add up, use xz + if( XZ and ( + ($compress eq COMPRESS_XZ) or + ( MODE_READ->($mode) and $magic =~ XZ_MAGIC_NUM ) + ) + ) { + if( MODE_READ->($mode) ) { + $fh = IO::Uncompress::UnXz->new( $file ) or do { + $self->_error( qq[Could not read '$file': ] . + $IO::Uncompress::UnXz::UnXzError + ); + return; + }; + } else { + $fh = IO::Compress::Xz->new( $file ) or do { + $self->_error( qq[Could not write to '$file': ] . + $IO::Compress::Xz::XzError + ); + return; + }; + } + + ### is it bzip? + ### if you asked specifically for bzip compression, or if we're in + ### read mode and the magic numbers add up, use bzip + } elsif( BZIP and ( + ($compress eq COMPRESS_BZIP) or + ( MODE_READ->($mode) and $magic =~ BZIP_MAGIC_NUM ) + ) + ) { + + ### different reader/writer modules, different error vars... sigh + if( MODE_READ->($mode) ) { + $fh = IO::Uncompress::Bunzip2->new( $file, MultiStream => 1 ) or do { + $self->_error( qq[Could not read '$file': ] . + $IO::Uncompress::Bunzip2::Bunzip2Error + ); + return; + }; + + } else { + $fh = IO::Compress::Bzip2->new( $file ) or do { + $self->_error( qq[Could not write to '$file': ] . + $IO::Compress::Bzip2::Bzip2Error + ); + return; + }; + } + + ### is it gzip? + ### if you asked for compression, if you wanted to read or the gzip + ### magic number is present (redundant with read) + } elsif( ZLIB and ( + $compress or MODE_READ->($mode) or $magic =~ GZIP_MAGIC_NUM + ) + ) { + $fh = IO::Zlib->new; + + unless( $fh->open( $file, $mode ) ) { + $self->_error(qq[Could not create filehandle for '$file': $!]); + return; + } + + ### is it plain tar? + } else { + $fh = IO::File->new; + + unless( $fh->open( $file, $mode ) ) { + $self->_error(qq[Could not create filehandle for '$file': $!]); + return; + } + + ### enable bin mode on tar archives + binmode $fh; + } + } + + return $fh; +} + + +sub _read_tar { + my $self = shift; + my $handle = shift or return; + my $opts = shift || {}; + + my $count = $opts->{limit} || 0; + my $filter = $opts->{filter}; + my $md5 = $opts->{md5} || 0; # cdrake + my $filter_cb = $opts->{filter_cb}; + my $extract = $opts->{extract} || 0; + + ### set a cap on the amount of files to extract ### + my $limit = 0; + $limit = 1 if $count > 0; + + my $tarfile = [ ]; + my $chunk; + my $read = 0; + my $real_name; # to set the name of a file when + # we're encountering @longlink + my $data; + + LOOP: + while( $handle->read( $chunk, HEAD ) ) { + ### IO::Zlib doesn't support this yet + my $offset; + if ( ref($handle) ne 'IO::Zlib' ) { + local $@; + $offset = eval { tell $handle } || 'unknown'; + $@ = ''; + } + else { + $offset = 'unknown'; + } + + unless( $read++ ) { + my $gzip = GZIP_MAGIC_NUM; + if( $chunk =~ /$gzip/ ) { + $self->_error( qq[Cannot read compressed format in tar-mode] ); + return; + } + + ### size is < HEAD, which means a corrupted file, as the minimum + ### length is _at least_ HEAD + if (length $chunk != HEAD) { + $self->_error( qq[Cannot read enough bytes from the tarfile] ); + return; + } + } + + ### if we can't read in all bytes... ### + last if length $chunk != HEAD; + + ### Apparently this should really be two blocks of 512 zeroes, + ### but GNU tar sometimes gets it wrong. See comment in the + ### source code (tar.c) to GNU cpio. + next if $chunk eq TAR_END; + + ### according to the posix spec, the last 12 bytes of the header are + ### null bytes, to pad it to a 512 byte block. That means if these + ### bytes are NOT null bytes, it's a corrupt header. See: + ### www.koders.com/c/fidCE473AD3D9F835D690259D60AD5654591D91D5BA.aspx + ### line 111 + { my $nulls = join '', "\0" x 12; + unless( $nulls eq substr( $chunk, 500, 12 ) ) { + $self->_error( qq[Invalid header block at offset $offset] ); + next LOOP; + } + } + + ### pass the realname, so we can set it 'proper' right away + ### some of the heuristics are done on the name, so important + ### to set it ASAP + my $entry; + { my %extra_args = (); + $extra_args{'name'} = $$real_name if defined $real_name; + + unless( $entry = Archive::Tar::File->new( chunk => $chunk, + %extra_args ) + ) { + $self->_error( qq[Couldn't read chunk at offset $offset] ); + next LOOP; + } + } + + ### ignore labels: + ### http://www.gnu.org/software/tar/manual/html_chapter/Media.html#SEC159 + next if $entry->is_label; + + if( length $entry->type and ($entry->is_file || $entry->is_longlink) ) { + + if ( $entry->is_file && !$entry->validate ) { + ### sometimes the chunk is rather fux0r3d and a whole 512 + ### bytes ends up in the ->name area. + ### clean it up, if need be + my $name = $entry->name; + $name = substr($name, 0, 100) if length $name > 100; + $name =~ s/\n/ /g; + + $self->_error( $name . qq[: checksum error] ); + next LOOP; + } + + my $block = BLOCK_SIZE->( $entry->size ); + + $data = $entry->get_content_by_ref; + + my $skip = 0; + my $ctx; # cdrake + ### skip this entry if we're filtering + + if($md5) { # cdrake + $ctx = Digest::MD5->new; # cdrake + $skip=5; # cdrake + + } elsif ($filter && $entry->name !~ $filter) { + $skip = 1; + + } elsif ($filter_cb && ! $filter_cb->($entry)) { + $skip = 2; + + ### skip this entry if it's a pax header. This is a special file added + ### by, among others, git-generated tarballs. It holds comments and is + ### not meant for extracting. See #38932: pax_global_header extracted + } elsif ( $entry->name eq PAX_HEADER or $entry->type =~ /^(x|g)$/ ) { + $skip = 3; + } + + if ($skip) { + # + # Since we're skipping, do not allocate memory for the + # whole file. Read it 64 BLOCKS at a time. Do not + # complete the skip yet because maybe what we read is a + # longlink and it won't get skipped after all + # + my $amt = $block; + my $fsz=$entry->size; # cdrake + while ($amt > 0) { + $$data = ''; + my $this = 64 * BLOCK; + $this = $amt if $this > $amt; + if( $handle->read( $$data, $this ) < $this ) { + $self->_error( qq[Read error on tarfile (missing data) ']. + $entry->full_path ."' at offset $offset" ); + next LOOP; + } + $amt -= $this; + $fsz -= $this; # cdrake + substr ($$data, $fsz) = "" if ($fsz<0); # remove external junk prior to md5 # cdrake + $ctx->add($$data) if($skip==5); # cdrake + } + $$data = $ctx->hexdigest if($skip==5 && !$entry->is_longlink && !$entry->is_unknown && !$entry->is_label ) ; # cdrake + } else { + + ### just read everything into memory + ### can't do lazy loading since IO::Zlib doesn't support 'seek' + ### this is because Compress::Zlib doesn't support it =/ + ### this reads in the whole data in one read() call. + if ( $handle->read( $$data, $block ) < $block ) { + $self->_error( qq[Read error on tarfile (missing data) ']. + $entry->full_path ."' at offset $offset" ); + next LOOP; + } + ### throw away trailing garbage ### + substr ($$data, $entry->size) = "" if defined $$data; + } + + ### part II of the @LongLink munging -- need to do /after/ + ### the checksum check. + if( $entry->is_longlink ) { + ### weird thing in tarfiles -- if the file is actually a + ### @LongLink, the data part seems to have a trailing ^@ + ### (unprintable) char. to display, pipe output through less. + ### but that doesn't *always* happen.. so check if the last + ### character is a control character, and if so remove it + ### at any rate, we better remove that character here, or tests + ### like 'eq' and hash lookups based on names will SO not work + ### remove it by calculating the proper size, and then + ### tossing out everything that's longer than that size. + + ### count number of nulls + my $nulls = $$data =~ tr/\0/\0/; + + ### cut data + size by that many bytes + $entry->size( $entry->size - $nulls ); + substr ($$data, $entry->size) = ""; + } + } + + ### clean up of the entries.. posix tar /apparently/ has some + ### weird 'feature' that allows for filenames > 255 characters + ### they'll put a header in with as name '././@LongLink' and the + ### contents will be the name of the /next/ file in the archive + ### pretty crappy and kludgy if you ask me + + ### set the name for the next entry if this is a @LongLink; + ### this is one ugly hack =/ but needed for direct extraction + if( $entry->is_longlink ) { + $real_name = $data; + next LOOP; + } elsif ( defined $real_name ) { + $entry->name( $$real_name ); + $entry->prefix(''); + undef $real_name; + } + + if ($filter && $entry->name !~ $filter) { + next LOOP; + + } elsif ($filter_cb && ! $filter_cb->($entry)) { + next LOOP; + + ### skip this entry if it's a pax header. This is a special file added + ### by, among others, git-generated tarballs. It holds comments and is + ### not meant for extracting. See #38932: pax_global_header extracted + } elsif ( $entry->name eq PAX_HEADER or $entry->type =~ /^(x|g)$/ ) { + next LOOP; + } + + if ( $extract && !$entry->is_longlink + && !$entry->is_unknown + && !$entry->is_label ) { + $self->_extract_file( $entry ) or return; + } + + ### Guard against tarfiles with garbage at the end + last LOOP if $entry->name eq ''; + + ### push only the name on the rv if we're extracting + ### -- for extract_archive + push @$tarfile, ($extract ? $entry->name : $entry); + + if( $limit ) { + $count-- unless $entry->is_longlink || $entry->is_dir; + last LOOP unless $count; + } + } continue { + undef $data; + } + + return $tarfile; +} + +=head2 $tar->contains_file( $filename ) + +Check if the archive contains a certain file. +It will return true if the file is in the archive, false otherwise. + +Note however, that this function does an exact match using C +on the full path. So it cannot compensate for case-insensitive file- +systems or compare 2 paths to see if they would point to the same +underlying file. + +=cut + +sub contains_file { + my $self = shift; + my $full = shift; + + return unless defined $full; + + ### don't warn if the entry isn't there.. that's what this function + ### is for after all. + local $WARN = 0; + return 1 if $self->_find_entry($full); + return; +} + +=head2 $tar->extract( [@filenames] ) + +Write files whose names are equivalent to any of the names in +C<@filenames> to disk, creating subdirectories as necessary. This +might not work too well under VMS. +Under MacPerl, the file's modification time will be converted to the +MacOS zero of time, and appropriate conversions will be done to the +path. However, the length of each element of the path is not +inspected to see whether it's longer than MacOS currently allows (32 +characters). + +If C is called without a list of file names, the entire +contents of the archive are extracted. + +Returns a list of filenames extracted. + +=cut + +sub extract { + my $self = shift; + my @args = @_; + my @files; + my $hashmap; + + # use the speed optimization for all extracted files + local($self->{cwd}) = cwd() unless $self->{cwd}; + + ### you requested the extraction of only certain files + if( @args ) { + for my $file ( @args ) { + + ### it's already an object? + if( UNIVERSAL::isa( $file, 'Archive::Tar::File' ) ) { + push @files, $file; + next; + + ### go find it then + } else { + + # create hash-map once to speed up lookup + $hashmap = $hashmap || { + map { $_->full_path, $_ } @{$self->_data} + }; + + if (exists $hashmap->{$file}) { + ### we found the file you're looking for + push @files, $hashmap->{$file}; + } else { + return $self->_error( + qq[Could not find '$file' in archive] ); + } + } + } + + ### just grab all the file items + } else { + @files = $self->get_files; + } + + ### nothing found? that's an error + unless( scalar @files ) { + $self->_error( qq[No files found for ] . $self->_file ); + return; + } + + ### now extract them + for my $entry ( @files ) { + unless( $self->_extract_file( $entry ) ) { + $self->_error(q[Could not extract ']. $entry->full_path .q['] ); + return; + } + } + + return @files; +} + +=head2 $tar->extract_file( $file, [$extract_path] ) + +Write an entry, whose name is equivalent to the file name provided to +disk. Optionally takes a second parameter, which is the full native +path (including filename) the entry will be written to. + +For example: + + $tar->extract_file( 'name/in/archive', 'name/i/want/to/give/it' ); + + $tar->extract_file( $at_file_object, 'name/i/want/to/give/it' ); + +Returns true on success, false on failure. + +=cut + +sub extract_file { + my $self = shift; + my $file = shift; return unless defined $file; + my $alt = shift; + + my $entry = $self->_find_entry( $file ) + or $self->_error( qq[Could not find an entry for '$file'] ), return; + + return $self->_extract_file( $entry, $alt ); +} + +sub _extract_file { + my $self = shift; + my $entry = shift or return; + my $alt = shift; + + ### you wanted an alternate extraction location ### + my $name = defined $alt ? $alt : $entry->full_path; + + ### splitpath takes a bool at the end to indicate + ### that it's splitting a dir + my ($vol,$dirs,$file); + if ( defined $alt ) { # It's a local-OS path + ($vol,$dirs,$file) = File::Spec->splitpath( $alt, + $entry->is_dir ); + } else { + ($vol,$dirs,$file) = File::Spec::Unix->splitpath( $name, + $entry->is_dir ); + } + + my $dir; + ### is $name an absolute path? ### + if( $vol || File::Spec->file_name_is_absolute( $dirs ) ) { + + ### absolute names are not allowed to be in tarballs under + ### strict mode, so only allow it if a user tells us to do it + if( not defined $alt and not $INSECURE_EXTRACT_MODE ) { + $self->_error( + q[Entry ']. $entry->full_path .q[' is an absolute path. ]. + q[Not extracting absolute paths under SECURE EXTRACT MODE] + ); + return; + } + + ### user asked us to, it's fine. + $dir = File::Spec->catpath( $vol, $dirs, "" ); + + ### it's a relative path ### + } else { + my $cwd = (ref $self and defined $self->{cwd}) + ? $self->{cwd} + : cwd(); + + my @dirs = defined $alt + ? File::Spec->splitdir( $dirs ) # It's a local-OS path + : File::Spec::Unix->splitdir( $dirs ); # it's UNIX-style, likely + # straight from the tarball + + if( not defined $alt and + not $INSECURE_EXTRACT_MODE + ) { + + ### paths that leave the current directory are not allowed under + ### strict mode, so only allow it if a user tells us to do this. + if( grep { $_ eq '..' } @dirs ) { + + $self->_error( + q[Entry ']. $entry->full_path .q[' is attempting to leave ]. + q[the current working directory. Not extracting under ]. + q[SECURE EXTRACT MODE] + ); + return; + } + + ### the archive may be asking us to extract into a symlink. This + ### is not sane and a possible security issue, as outlined here: + ### https://rt.cpan.org/Ticket/Display.html?id=30380 + ### https://bugzilla.redhat.com/show_bug.cgi?id=295021 + ### https://issues.rpath.com/browse/RPL-1716 + my $full_path = $cwd; + for my $d ( @dirs ) { + $full_path = File::Spec->catdir( $full_path, $d ); + + ### we've already checked this one, and it's safe. Move on. + next if ref $self and $self->{_link_cache}->{$full_path}; + + if( -l $full_path ) { + my $to = readlink $full_path; + my $diag = "symlinked directory ($full_path => $to)"; + + $self->_error( + q[Entry ']. $entry->full_path .q[' is attempting to ]. + qq[extract to a $diag. This is considered a security ]. + q[vulnerability and not allowed under SECURE EXTRACT ]. + q[MODE] + ); + return; + } + + ### XXX keep a cache if possible, so the stats become cheaper: + $self->{_link_cache}->{$full_path} = 1 if ref $self; + } + } + + ### '.' is the directory delimiter on VMS, which has to be escaped + ### or changed to '_' on vms. vmsify is used, because older versions + ### of vmspath do not handle this properly. + ### Must not add a '/' to an empty directory though. + map { length() ? VMS::Filespec::vmsify($_.'/') : $_ } @dirs if ON_VMS; + + my ($cwd_vol,$cwd_dir,$cwd_file) + = File::Spec->splitpath( $cwd ); + my @cwd = File::Spec->splitdir( $cwd_dir ); + push @cwd, $cwd_file if length $cwd_file; + + ### We need to pass '' as the last element to catpath. Craig Berry + ### explains why (msgid ): + ### The root problem is that splitpath on UNIX always returns the + ### final path element as a file even if it is a directory, and of + ### course there is no way it can know the difference without checking + ### against the filesystem, which it is documented as not doing. When + ### you turn around and call catpath, on VMS you have to know which bits + ### are directory bits and which bits are file bits. In this case we + ### know the result should be a directory. I had thought you could omit + ### the file argument to catpath in such a case, but apparently on UNIX + ### you can't. + $dir = File::Spec->catpath( + $cwd_vol, File::Spec->catdir( @cwd, @dirs ), '' + ); + + ### catdir() returns undef if the path is longer than 255 chars on + ### older VMS systems. + unless ( defined $dir ) { + $^W && $self->_error( qq[Could not compose a path for '$dirs'\n] ); + return; + } + + } + + if( -e $dir && !-d _ ) { + $^W && $self->_error( qq['$dir' exists, but it's not a directory!\n] ); + return; + } + + unless ( -d _ ) { + eval { File::Path::mkpath( $dir, 0, 0777 ) }; + if( $@ ) { + my $fp = $entry->full_path; + $self->_error(qq[Could not create directory '$dir' for '$fp': $@]); + return; + } + + ### XXX chown here? that might not be the same as in the archive + ### as we're only chown'ing to the owner of the file we're extracting + ### not to the owner of the directory itself, which may or may not + ### be another entry in the archive + ### Answer: no, gnu tar doesn't do it either, it'd be the wrong + ### way to go. + #if( $CHOWN && CAN_CHOWN ) { + # chown $entry->uid, $entry->gid, $dir or + # $self->_error( qq[Could not set uid/gid on '$dir'] ); + #} + } + + ### we're done if we just needed to create a dir ### + return 1 if $entry->is_dir; + + my $full = File::Spec->catfile( $dir, $file ); + + if( $entry->is_unknown ) { + $self->_error( qq[Unknown file type for file '$full'] ); + return; + } + + ### If a file system already contains a block device with the same name as + ### the being extracted regular file, we would write the file's content + ### to the block device. So remove the existing file (block device) now. + ### If an archive contains multiple same-named entries, the last one + ### should replace the previous ones. So remove the old file now. + ### If the old entry is a symlink to a file outside of the CWD, the new + ### entry would create a file there. This is CVE-2018-12015 + ### . + if (-l $full || -e _) { + if (!unlink $full) { + $self->_error( qq[Could not remove old file '$full': $!] ); + return; + } + } + if( length $entry->type && $entry->is_file ) { + my $fh = IO::File->new; + $fh->open( $full, '>' ) or ( + $self->_error( qq[Could not open file '$full': $!] ), + return + ); + + if( $entry->size ) { + binmode $fh; + syswrite $fh, $entry->data or ( + $self->_error( qq[Could not write data to '$full'] ), + return + ); + } + + close $fh or ( + $self->_error( qq[Could not close file '$full'] ), + return + ); + + } else { + $self->_make_special_file( $entry, $full ) or return; + } + + ### only update the timestamp if it's not a symlink; that will change the + ### timestamp of the original. This addresses bug #33669: Could not update + ### timestamp warning on symlinks + if( not -l $full ) { + utime time, $entry->mtime - TIME_OFFSET, $full or + $self->_error( qq[Could not update timestamp] ); + } + + if( $CHOWN && CAN_CHOWN->() and not -l $full ) { + chown $entry->uid, $entry->gid, $full or + $self->_error( qq[Could not set uid/gid on '$full'] ); + } + + ### only chmod if we're allowed to, but never chmod symlinks, since they'll + ### change the perms on the file they're linking too... + if( $CHMOD and not -l $full ) { + my $mode = $entry->mode; + unless ($SAME_PERMISSIONS) { + $mode &= ~(oct(7000) | umask); + } + chmod $mode, $full or + $self->_error( qq[Could not chown '$full' to ] . $entry->mode ); + } + + return 1; +} + +sub _make_special_file { + my $self = shift; + my $entry = shift or return; + my $file = shift; return unless defined $file; + + my $err; + + if( $entry->is_symlink ) { + my $fail; + if( ON_UNIX ) { + symlink( $entry->linkname, $file ) or $fail++; + + } else { + $self->_extract_special_file_as_plain_file( $entry, $file ) + or $fail++; + } + + $err = qq[Making symbolic link '$file' to '] . + $entry->linkname .q[' failed] if $fail; + + } elsif ( $entry->is_hardlink ) { + my $fail; + if( ON_UNIX ) { + link( $entry->linkname, $file ) or $fail++; + + } else { + $self->_extract_special_file_as_plain_file( $entry, $file ) + or $fail++; + } + + $err = qq[Making hard link from '] . $entry->linkname . + qq[' to '$file' failed] if $fail; + + } elsif ( $entry->is_fifo ) { + ON_UNIX && !system('mknod', $file, 'p') or + $err = qq[Making fifo ']. $entry->name .qq[' failed]; + + } elsif ( $entry->is_blockdev or $entry->is_chardev ) { + my $mode = $entry->is_blockdev ? 'b' : 'c'; + + ON_UNIX && !system('mknod', $file, $mode, + $entry->devmajor, $entry->devminor) or + $err = qq[Making block device ']. $entry->name .qq[' (maj=] . + $entry->devmajor . qq[ min=] . $entry->devminor . + qq[) failed.]; + + } elsif ( $entry->is_socket ) { + ### the original doesn't do anything special for sockets.... ### + 1; + } + + return $err ? $self->_error( $err ) : 1; +} + +### don't know how to make symlinks, let's just extract the file as +### a plain file +sub _extract_special_file_as_plain_file { + my $self = shift; + my $entry = shift or return; + my $file = shift; return unless defined $file; + + my $err; + TRY: { + my $orig = $self->_find_entry( $entry->linkname, $entry ); + + unless( $orig ) { + $err = qq[Could not find file '] . $entry->linkname . + qq[' in memory.]; + last TRY; + } + + ### clone the entry, make it appear as a normal file ### + my $clone = $orig->clone; + $clone->_downgrade_to_plainfile; + $self->_extract_file( $clone, $file ) or last TRY; + + return 1; + } + + return $self->_error($err); +} + +=head2 $tar->list_files( [\@properties] ) + +Returns a list of the names of all the files in the archive. + +If C is passed an array reference as its first argument +it returns a list of hash references containing the requested +properties of each file. The following list of properties is +supported: name, size, mtime (last modified date), mode, uid, gid, +linkname, uname, gname, devmajor, devminor, prefix. + +Passing an array reference containing only one element, 'name', is +special cased to return a list of names rather than a list of hash +references, making it equivalent to calling C without +arguments. + +=cut + +sub list_files { + my $self = shift; + my $aref = shift || [ ]; + + unless( $self->_data ) { + $self->read() or return; + } + + if( @$aref == 0 or ( @$aref == 1 and $aref->[0] eq 'name' ) ) { + return map { $_->full_path } @{$self->_data}; + } else { + + #my @rv; + #for my $obj ( @{$self->_data} ) { + # push @rv, { map { $_ => $obj->$_() } @$aref }; + #} + #return @rv; + + ### this does the same as the above.. just needs a +{ } + ### to make sure perl doesn't confuse it for a block + return map { my $o=$_; + +{ map { $_ => $o->$_() } @$aref } + } @{$self->_data}; + } +} + +sub _find_entry { + my $self = shift; + my $file = shift; + + unless( defined $file ) { + $self->_error( qq[No file specified] ); + return; + } + + ### it's an object already + return $file if UNIVERSAL::isa( $file, 'Archive::Tar::File' ); + +seach_entry: + if($self->_data){ + for my $entry ( @{$self->_data} ) { + my $path = $entry->full_path; + return $entry if $path eq $file; + } + } + + if($Archive::Tar::RESOLVE_SYMLINK!~/none/){ + if(my $link_entry = shift()){#fallback mode when symlinks are using relative notations ( ../a/./b/text.bin ) + $file = _symlinks_resolver( $link_entry->name, $file ); + goto seach_entry if $self->_data; + + #this will be slower than never, but won't failed! + + my $iterargs = $link_entry->{'_archive'}; + if($Archive::Tar::RESOLVE_SYMLINK=~/speed/ && @$iterargs==3){ + #faster but whole archive will be read in memory + #read whole archive and share data + my $archive = Archive::Tar->new; + $archive->read( @$iterargs ); + push @$iterargs, $archive; #take a trace for destruction + if($archive->_data){ + $self->_data( $archive->_data ); + goto seach_entry; + } + }#faster + + {#slower but lower memory usage + # $iterargs = [$filename, $compressed, $opts]; + my $next = Archive::Tar->iter( @$iterargs ); + while(my $e = $next->()){ + if($e->full_path eq $file){ + undef $next; + return $e; + } + } + }#slower + } + } + + $self->_error( qq[No such file in archive: '$file'] ); + return; +} + +=head2 $tar->get_files( [@filenames] ) + +Returns the C objects matching the filenames +provided. If no filename list was passed, all C +objects in the current Tar object are returned. + +Please refer to the C documentation on how to +handle these objects. + +=cut + +sub get_files { + my $self = shift; + + return @{ $self->_data } unless @_; + + my @list; + for my $file ( @_ ) { + push @list, grep { defined } $self->_find_entry( $file ); + } + + return @list; +} + +=head2 $tar->get_content( $file ) + +Return the content of the named file. + +=cut + +sub get_content { + my $self = shift; + my $entry = $self->_find_entry( shift ) or return; + + return $entry->data; +} + +=head2 $tar->replace_content( $file, $content ) + +Make the string $content be the content for the file named $file. + +=cut + +sub replace_content { + my $self = shift; + my $entry = $self->_find_entry( shift ) or return; + + return $entry->replace_content( shift ); +} + +=head2 $tar->rename( $file, $new_name ) + +Rename the file of the in-memory archive to $new_name. + +Note that you must specify a Unix path for $new_name, since per tar +standard, all files in the archive must be Unix paths. + +Returns true on success and false on failure. + +=cut + +sub rename { + my $self = shift; + my $file = shift; return unless defined $file; + my $new = shift; return unless defined $new; + + my $entry = $self->_find_entry( $file ) or return; + + return $entry->rename( $new ); +} + +=head2 $tar->chmod( $file, $mode ) + +Change mode of $file to $mode. + +Returns true on success and false on failure. + +=cut + +sub chmod { + my $self = shift; + my $file = shift; return unless defined $file; + my $mode = shift; return unless defined $mode && $mode =~ /^[0-7]{1,4}$/; + my @args = ("$mode"); + + my $entry = $self->_find_entry( $file ) or return; + my $x = $entry->chmod( @args ); + return $x; +} + +=head2 $tar->chown( $file, $uname [, $gname] ) + +Change owner $file to $uname and $gname. + +Returns true on success and false on failure. + +=cut + +sub chown { + my $self = shift; + my $file = shift; return unless defined $file; + my $uname = shift; return unless defined $uname; + my @args = ($uname); + push(@args, shift); + + my $entry = $self->_find_entry( $file ) or return; + my $x = $entry->chown( @args ); + return $x; +} + +=head2 $tar->remove (@filenamelist) + +Removes any entries with names matching any of the given filenames +from the in-memory archive. Returns a list of C +objects that remain. + +=cut + +sub remove { + my $self = shift; + my @list = @_; + + my %seen = map { $_->full_path => $_ } @{$self->_data}; + delete $seen{ $_ } for @list; + + $self->_data( [values %seen] ); + + return values %seen; +} + +=head2 $tar->clear + +C clears the current in-memory archive. This effectively gives +you a 'blank' object, ready to be filled again. Note that C +only has effect on the object, not the underlying tarfile. + +=cut + +sub clear { + my $self = shift or return; + + $self->_data( [] ); + $self->_file( '' ); + + return 1; +} + + +=head2 $tar->write ( [$file, $compressed, $prefix] ) + +Write the in-memory archive to disk. The first argument can either +be the name of a file or a reference to an already open filehandle (a +GLOB reference). + +The second argument is used to indicate compression. You can +compress using C, C or C. If you pass a digit, it's assumed +to be the C compression level (between 1 and 9), but the use of +constants is preferred: + + # write a gzip compressed file + $tar->write( 'out.tgz', COMPRESS_GZIP ); + + # write a bzip compressed file + $tar->write( 'out.tbz', COMPRESS_BZIP ); + + # write a xz compressed file + $tar->write( 'out.txz', COMPRESS_XZ ); + +Note that when you pass in a filehandle, the compression argument +is ignored, as all files are printed verbatim to your filehandle. +If you wish to enable compression with filehandles, use an +C, C or C filehandle instead. + +The third argument is an optional prefix. All files will be tucked +away in the directory you specify as prefix. So if you have files +'a' and 'b' in your archive, and you specify 'foo' as prefix, they +will be written to the archive as 'foo/a' and 'foo/b'. + +If no arguments are given, C returns the entire formatted +archive as a string, which could be useful if you'd like to stuff the +archive into a socket or a pipe to gzip or something. + + +=cut + +sub write { + my $self = shift; + my $file = shift; $file = '' unless defined $file; + my $gzip = shift || 0; + my $ext_prefix = shift; $ext_prefix = '' unless defined $ext_prefix; + my $dummy = ''; + + ### only need a handle if we have a file to print to ### + my $handle = length($file) + ? ( $self->_get_handle($file, $gzip, WRITE_ONLY->($gzip) ) + or return ) + : $HAS_PERLIO ? do { open my $h, '>', \$dummy; $h } + : $HAS_IO_STRING ? IO::String->new + : __PACKAGE__->no_string_support(); + + ### Addresses: #41798: Nonempty $\ when writing a TAR file produces a + ### corrupt TAR file. Must clear out $\ to make sure no garbage is + ### printed to the archive + local $\; + + for my $entry ( @{$self->_data} ) { + ### entries to be written to the tarfile ### + my @write_me; + + ### only now will we change the object to reflect the current state + ### of the name and prefix fields -- this needs to be limited to + ### write() only! + my $clone = $entry->clone; + + + ### so, if you don't want use to use the prefix, we'll stuff + ### everything in the name field instead + if( $DO_NOT_USE_PREFIX ) { + + ### you might have an extended prefix, if so, set it in the clone + ### XXX is ::Unix right? + $clone->name( length $ext_prefix + ? File::Spec::Unix->catdir( $ext_prefix, + $clone->full_path) + : $clone->full_path ); + $clone->prefix( '' ); + + ### otherwise, we'll have to set it properly -- prefix part in the + ### prefix and name part in the name field. + } else { + + ### split them here, not before! + my ($prefix,$name) = $clone->_prefix_and_file( $clone->full_path ); + + ### you might have an extended prefix, if so, set it in the clone + ### XXX is ::Unix right? + $prefix = File::Spec::Unix->catdir( $ext_prefix, $prefix ) + if length $ext_prefix; + + $clone->prefix( $prefix ); + $clone->name( $name ); + } + + ### names are too long, and will get truncated if we don't add a + ### '@LongLink' file... + my $make_longlink = ( length($clone->name) > NAME_LENGTH or + length($clone->prefix) > PREFIX_LENGTH + ) || 0; + + ### perhaps we need to make a longlink file? + if( $make_longlink ) { + my $longlink = Archive::Tar::File->new( + data => LONGLINK_NAME, + $clone->full_path, + { type => LONGLINK } + ); + + unless( $longlink ) { + $self->_error( qq[Could not create 'LongLink' entry for ] . + qq[oversize file '] . $clone->full_path ."'" ); + return; + }; + + push @write_me, $longlink; + } + + push @write_me, $clone; + + ### write the one, optionally 2 a::t::file objects to the handle + for my $clone (@write_me) { + + ### if the file is a symlink, there are 2 options: + ### either we leave the symlink intact, but then we don't write any + ### data OR we follow the symlink, which means we actually make a + ### copy. if we do the latter, we have to change the TYPE of the + ### clone to 'FILE' + my $link_ok = $clone->is_symlink && $Archive::Tar::FOLLOW_SYMLINK; + my $data_ok = !$clone->is_symlink && $clone->has_content; + + ### downgrade to a 'normal' file if it's a symlink we're going to + ### treat as a regular file + $clone->_downgrade_to_plainfile if $link_ok; + + ### get the header for this block + my $header = $self->_format_tar_entry( $clone ); + unless( $header ) { + $self->_error(q[Could not format header for: ] . + $clone->full_path ); + return; + } + + unless( print $handle $header ) { + $self->_error(q[Could not write header for: ] . + $clone->full_path); + return; + } + + if( $link_ok or $data_ok ) { + unless( print $handle $clone->data ) { + $self->_error(q[Could not write data for: ] . + $clone->full_path); + return; + } + + ### pad the end of the clone if required ### + print $handle TAR_PAD->( $clone->size ) if $clone->size % BLOCK + } + + } ### done writing these entries + } + + ### write the end markers ### + print $handle TAR_END x 2 or + return $self->_error( qq[Could not write tar end markers] ); + + ### did you want it written to a file, or returned as a string? ### + my $rv = length($file) ? 1 + : $HAS_PERLIO ? $dummy + : do { seek $handle, 0, 0; local $/; <$handle> }; + + ### make sure to close the handle if we created it + if ( $file ne $handle ) { + unless( close $handle ) { + $self->_error( qq[Could not write tar] ); + return; + } + } + + return $rv; +} + +sub _format_tar_entry { + my $self = shift; + my $entry = shift or return; + my $ext_prefix = shift; $ext_prefix = '' unless defined $ext_prefix; + my $no_prefix = shift || 0; + + my $file = $entry->name; + my $prefix = $entry->prefix; $prefix = '' unless defined $prefix; + + ### remove the prefix from the file name + ### not sure if this is still needed --kane + ### no it's not -- Archive::Tar::File->_new_from_file will take care of + ### this for us. Even worse, this would break if we tried to add a file + ### like x/x. + #if( length $prefix ) { + # $file =~ s/^$match//; + #} + + $prefix = File::Spec::Unix->catdir($ext_prefix, $prefix) + if length $ext_prefix; + + ### not sure why this is... ### + my $l = PREFIX_LENGTH; # is ambiguous otherwise... + substr ($prefix, 0, -$l) = "" if length $prefix >= PREFIX_LENGTH; + + my $f1 = "%06o"; my $f2 = $ZERO_PAD_NUMBERS ? "%011o" : "%11o"; + + ### this might be optimizable with a 'changed' flag in the file objects ### + my $tar = pack ( + PACK, + $file, + + (map { sprintf( $f1, $entry->$_() ) } qw[mode uid gid]), + (map { sprintf( $f2, $entry->$_() ) } qw[size mtime]), + + "", # checksum field - space padded a bit down + + (map { $entry->$_() } qw[type linkname magic]), + + $entry->version || TAR_VERSION, + + (map { $entry->$_() } qw[uname gname]), + (map { sprintf( $f1, $entry->$_() ) } qw[devmajor devminor]), + + ($no_prefix ? '' : $prefix) + ); + + ### add the checksum ### + my $checksum_fmt = $ZERO_PAD_NUMBERS ? "%06o\0" : "%06o\0"; + substr($tar,148,7) = sprintf("%6o\0", unpack("%16C*",$tar)); + + return $tar; +} + +=head2 $tar->add_files( @filenamelist ) + +Takes a list of filenames and adds them to the in-memory archive. + +The path to the file is automatically converted to a Unix like +equivalent for use in the archive, and, if on MacOS, the file's +modification time is converted from the MacOS epoch to the Unix epoch. +So tar archives created on MacOS with B can be read +both with I on Unix and applications like I or +I on MacOS. + +Be aware that the file's type/creator and resource fork will be lost, +which is usually what you want in cross-platform archives. + +Instead of a filename, you can also pass it an existing C +object from, for example, another archive. The object will be clone, and +effectively be a copy of the original, not an alias. + +Returns a list of C objects that were just added. + +=cut + +sub add_files { + my $self = shift; + my @files = @_ or return; + + my @rv; + for my $file ( @files ) { + + ### you passed an Archive::Tar::File object + ### clone it so we don't accidentally have a reference to + ### an object from another archive + if( UNIVERSAL::isa( $file,'Archive::Tar::File' ) ) { + push @rv, $file->clone; + next; + } + + eval { + if( utf8::is_utf8( $file )) { + utf8::encode( $file ); + } + }; + + unless( -e $file || -l $file ) { + $self->_error( qq[No such file: '$file'] ); + next; + } + + my $obj = Archive::Tar::File->new( file => $file ); + unless( $obj ) { + $self->_error( qq[Unable to add file: '$file'] ); + next; + } + + push @rv, $obj; + } + + push @{$self->{_data}}, @rv; + + return @rv; +} + +=head2 $tar->add_data ( $filename, $data, [$opthashref] ) + +Takes a filename, a scalar full of data and optionally a reference to +a hash with specific options. + +Will add a file to the in-memory archive, with name C<$filename> and +content C<$data>. Specific properties can be set using C<$opthashref>. +The following list of properties is supported: name, size, mtime +(last modified date), mode, uid, gid, linkname, uname, gname, +devmajor, devminor, prefix, type. (On MacOS, the file's path and +modification times are converted to Unix equivalents.) + +Valid values for the file type are the following constants defined by +Archive::Tar::Constant: + +=over 4 + +=item FILE + +Regular file. + +=item HARDLINK + +=item SYMLINK + +Hard and symbolic ("soft") links; linkname should specify target. + +=item CHARDEV + +=item BLOCKDEV + +Character and block devices. devmajor and devminor should specify the major +and minor device numbers. + +=item DIR + +Directory. + +=item FIFO + +FIFO (named pipe). + +=item SOCKET + +Socket. + +=back + +Returns the C object that was just added, or +C on failure. + +=cut + +sub add_data { + my $self = shift; + my ($file, $data, $opt) = @_; + + my $obj = Archive::Tar::File->new( data => $file, $data, $opt ); + unless( $obj ) { + $self->_error( qq[Unable to add file: '$file'] ); + return; + } + + push @{$self->{_data}}, $obj; + + return $obj; +} + +=head2 $tar->error( [$BOOL] ) + +Returns the current error string (usually, the last error reported). +If a true value was specified, it will give the C +equivalent of the error, in effect giving you a stacktrace. + +For backwards compatibility, this error is also available as +C<$Archive::Tar::error> although it is much recommended you use the +method call instead. + +=cut + +{ + $error = ''; + my $longmess; + + sub _error { + my $self = shift; + my $msg = $error = shift; + $longmess = Carp::longmess($error); + if (ref $self) { + $self->{_error} = $error; + $self->{_longmess} = $longmess; + } + + ### set Archive::Tar::WARN to 0 to disable printing + ### of errors + if( $WARN ) { + carp $DEBUG ? $longmess : $msg; + } + + return; + } + + sub error { + my $self = shift; + if (ref $self) { + return shift() ? $self->{_longmess} : $self->{_error}; + } else { + return shift() ? $longmess : $error; + } + } +} + +=head2 $tar->setcwd( $cwd ); + +C needs to know the current directory, and it will run +C I time it extracts a I entry from the +tarfile and saves it in the file system. (As of version 1.30, however, +C will use the speed optimization described below +automatically, so it's only relevant if you're using C). + +Since C doesn't change the current directory internally +while it is extracting the items in a tarball, all calls to C +can be avoided if we can guarantee that the current directory doesn't +get changed externally. + +To use this performance boost, set the current directory via + + use Cwd; + $tar->setcwd( cwd() ); + +once before calling a function like C and +C will use the current directory setting from then on +and won't call C internally. + +To switch back to the default behaviour, use + + $tar->setcwd( undef ); + +and C will call C internally again. + +If you're using C's C method, C will +be called for you. + +=cut + +sub setcwd { + my $self = shift; + my $cwd = shift; + + $self->{cwd} = $cwd; +} + +=head1 Class Methods + +=head2 Archive::Tar->create_archive($file, $compressed, @filelist) + +Creates a tar file from the list of files provided. The first +argument can either be the name of the tar file to create or a +reference to an open file handle (e.g. a GLOB reference). + +The second argument is used to indicate compression. You can +compress using C, C or C. If you pass a digit, it's assumed +to be the C compression level (between 1 and 9), but the use of +constants is preferred: + + # write a gzip compressed file + Archive::Tar->create_archive( 'out.tgz', COMPRESS_GZIP, @filelist ); + + # write a bzip compressed file + Archive::Tar->create_archive( 'out.tbz', COMPRESS_BZIP, @filelist ); + + # write a xz compressed file + Archive::Tar->create_archive( 'out.txz', COMPRESS_XZ, @filelist ); + +Note that when you pass in a filehandle, the compression argument +is ignored, as all files are printed verbatim to your filehandle. +If you wish to enable compression with filehandles, use an +C, C or C filehandle instead. + +The remaining arguments list the files to be included in the tar file. +These files must all exist. Any files which don't exist or can't be +read are silently ignored. + +If the archive creation fails for any reason, C will +return false. Please use the C method to find the cause of the +failure. + +Note that this method does not write C as it were; it +still reads all the files into memory before writing out the archive. +Consult the FAQ below if this is a problem. + +=cut + +sub create_archive { + my $class = shift; + + my $file = shift; return unless defined $file; + my $gzip = shift || 0; + my @files = @_; + + unless( @files ) { + return $class->_error( qq[Cowardly refusing to create empty archive!] ); + } + + my $tar = $class->new; + $tar->add_files( @files ); + return $tar->write( $file, $gzip ); +} + +=head2 Archive::Tar->iter( $filename, [ $compressed, {opt => $val} ] ) + +Returns an iterator function that reads the tar file without loading +it all in memory. Each time the function is called it will return the +next file in the tarball. The files are returned as +C objects. The iterator function returns the +empty list once it has exhausted the files contained. + +The second argument can be a hash reference with options, which are +identical to the arguments passed to C. + +Example usage: + + my $next = Archive::Tar->iter( "example.tar.gz", 1, {filter => qr/\.pm$/} ); + + while( my $f = $next->() ) { + print $f->name, "\n"; + + $f->extract or warn "Extraction failed"; + + # .... + } + +=cut + + +sub iter { + my $class = shift; + my $filename = shift; + return unless defined $filename; + my $compressed = shift || 0; + my $opts = shift || {}; + + ### get a handle to read from. + my $handle = $class->_get_handle( + $filename, + $compressed, + READ_ONLY->( ZLIB ) + ) or return; + + my @data; + my $CONSTRUCT_ARGS = [ $filename, $compressed, $opts ]; + return sub { + return shift(@data) if @data; # more than one file returned? + return unless $handle; # handle exhausted? + + ### read data, should only return file + my $tarfile = $class->_read_tar($handle, { %$opts, limit => 1 }); + @data = @$tarfile if ref $tarfile && ref $tarfile eq 'ARRAY'; + if($Archive::Tar::RESOLVE_SYMLINK!~/none/){ + foreach(@data){ + #may refine this heuristic for ON_UNIX? + if($_->linkname){ + #is there a better slot to store/share it ? + $_->{'_archive'} = $CONSTRUCT_ARGS; + } + } + } + + ### return one piece of data + return shift(@data) if @data; + + ### data is exhausted, free the filehandle + undef $handle; + if(@$CONSTRUCT_ARGS == 4){ + #free archive in memory + undef $CONSTRUCT_ARGS->[-1]; + } + return; + }; +} + +=head2 Archive::Tar->list_archive($file, $compressed, [\@properties]) + +Returns a list of the names of all the files in the archive. The +first argument can either be the name of the tar file to list or a +reference to an open file handle (e.g. a GLOB reference). + +If C is passed an array reference as its third +argument it returns a list of hash references containing the requested +properties of each file. The following list of properties is +supported: full_path, name, size, mtime (last modified date), mode, +uid, gid, linkname, uname, gname, devmajor, devminor, prefix, type. + +See C for details about supported properties. + +Passing an array reference containing only one element, 'name', is +special cased to return a list of names rather than a list of hash +references. + +=cut + +sub list_archive { + my $class = shift; + my $file = shift; return unless defined $file; + my $gzip = shift || 0; + + my $tar = $class->new($file, $gzip); + return unless $tar; + + return $tar->list_files( @_ ); +} + +=head2 Archive::Tar->extract_archive($file, $compressed) + +Extracts the contents of the tar file. The first argument can either +be the name of the tar file to create or a reference to an open file +handle (e.g. a GLOB reference). All relative paths in the tar file will +be created underneath the current working directory. + +C will return a list of files it extracted. +If the archive extraction fails for any reason, C +will return false. Please use the C method to find the cause +of the failure. + +=cut + +sub extract_archive { + my $class = shift; + my $file = shift; return unless defined $file; + my $gzip = shift || 0; + + my $tar = $class->new( ) or return; + + return $tar->read( $file, $gzip, { extract => 1 } ); +} + +=head2 $bool = Archive::Tar->has_io_string + +Returns true if we currently have C support loaded. + +Either C or C support is needed to support writing +stringified archives. Currently, C is the preferred method, if +available. + +See the C section to see how to change this preference. + +=cut + +sub has_io_string { return $HAS_IO_STRING; } + +=head2 $bool = Archive::Tar->has_perlio + +Returns true if we currently have C support loaded. + +This requires C or higher, compiled with C + +Either C or C support is needed to support writing +stringified archives. Currently, C is the preferred method, if +available. + +See the C section to see how to change this preference. + +=cut + +sub has_perlio { return $HAS_PERLIO; } + +=head2 $bool = Archive::Tar->has_zlib_support + +Returns true if C can extract C compressed archives + +=cut + +sub has_zlib_support { return ZLIB } + +=head2 $bool = Archive::Tar->has_bzip2_support + +Returns true if C can extract C compressed archives + +=cut + +sub has_bzip2_support { return BZIP } + +=head2 $bool = Archive::Tar->has_xz_support + +Returns true if C can extract C compressed archives + +=cut + +sub has_xz_support { return XZ } + +=head2 Archive::Tar->can_handle_compressed_files + +A simple checking routine, which will return true if C +is able to uncompress compressed archives on the fly with C, +C and C or false if not both are installed. + +You can use this as a shortcut to determine whether C +will do what you think before passing compressed archives to its +C method. + +=cut + +sub can_handle_compressed_files { return ZLIB && BZIP ? 1 : 0 } + +sub no_string_support { + croak("You have to install IO::String to support writing archives to strings"); +} + +sub _symlinks_resolver{ + my ($src, $trg) = @_; + my @src = split /[\/\\]/, $src; + my @trg = split /[\/\\]/, $trg; + pop @src; #strip out current object name + if(@trg and $trg[0] eq ''){ + shift @trg; + #restart path from scratch + @src = ( ); + } + foreach my $part ( @trg ){ + next if $part eq '.'; #ignore current + if($part eq '..'){ + #got to parent + pop @src; + } + else{ + #append it + push @src, $part; + } + } + my $path = join('/', @src); + warn "_symlinks_resolver('$src','$trg') = $path" if $DEBUG; + return $path; +} + +1; + +__END__ + +=head1 GLOBAL VARIABLES + +=head2 $Archive::Tar::FOLLOW_SYMLINK + +Set this variable to C<1> to make C effectively make a +copy of the file when extracting. Default is C<0>, which +means the symlink stays intact. Of course, you will have to pack the +file linked to as well. + +This option is checked when you write out the tarfile using C +or C. + +This works just like C's C<-h> option. + +=head2 $Archive::Tar::CHOWN + +By default, C will try to C your files if it is +able to. In some cases, this may not be desired. In that case, set +this variable to C<0> to disable C-ing, even if it were +possible. + +The default is C<1>. + +=head2 $Archive::Tar::CHMOD + +By default, C will try to C your files to +whatever mode was specified for the particular file in the archive. +In some cases, this may not be desired. In that case, set this +variable to C<0> to disable C-ing. + +The default is C<1>. + +=head2 $Archive::Tar::SAME_PERMISSIONS + +When, C<$Archive::Tar::CHMOD> is enabled, this setting controls whether +the permissions on files from the archive are used without modification +of if they are filtered by removing any setid bits and applying the +current umask. + +The default is C<1> for the root user and C<0> for normal users. + +=head2 $Archive::Tar::DO_NOT_USE_PREFIX + +By default, C will try to put paths that are over +100 characters in the C field of your tar header, as +defined per POSIX-standard. However, some (older) tar programs +do not implement this spec. To retain compatibility with these older +or non-POSIX compliant versions, you can set the C<$DO_NOT_USE_PREFIX> +variable to a true value, and C will use an alternate +way of dealing with paths over 100 characters by using the +C feature. + +Note that clients who do not support the C +feature will not be able to read these archives. Such clients include +tars on C, C and C. + +The default is C<0>. + +=head2 $Archive::Tar::DEBUG + +Set this variable to C<1> to always get the C output +of the warnings, instead of the regular C. This is the same +message you would get by doing: + + $tar->error(1); + +Defaults to C<0>. + +=head2 $Archive::Tar::WARN + +Set this variable to C<0> if you do not want any warnings printed. +Personally I recommend against doing this, but people asked for the +option. Also, be advised that this is of course not threadsafe. + +Defaults to C<1>. + +=head2 $Archive::Tar::error + +Holds the last reported error. Kept for historical reasons, but its +use is very much discouraged. Use the C method instead: + + warn $tar->error unless $tar->extract; + +Note that in older versions of this module, the C method +would return an effectively global value even when called an instance +method as above. This has since been fixed, and multiple instances of +C now have separate error strings. + +=head2 $Archive::Tar::INSECURE_EXTRACT_MODE + +This variable indicates whether C should allow +files to be extracted outside their current working directory. + +Allowing this could have security implications, as a malicious +tar archive could alter or replace any file the extracting user +has permissions to. Therefor, the default is to not allow +insecure extractions. + +If you trust the archive, or have other reasons to allow the +archive to write files outside your current working directory, +set this variable to C. + +Note that this is a backwards incompatible change from version +C<1.36> and before. + +=head2 $Archive::Tar::HAS_PERLIO + +This variable holds a boolean indicating if we currently have +C support loaded. This will be enabled for any perl +greater than C<5.8> compiled with C. + +If you feel strongly about disabling it, set this variable to +C. Note that you will then need C installed +to support writing stringified archives. + +Don't change this variable unless you B know what you're +doing. + +=head2 $Archive::Tar::HAS_IO_STRING + +This variable holds a boolean indicating if we currently have +C support loaded. This will be enabled for any perl +that has a loadable C module. + +If you feel strongly about disabling it, set this variable to +C. Note that you will then need C support from +your perl to be able to write stringified archives. + +Don't change this variable unless you B know what you're +doing. + +=head2 $Archive::Tar::ZERO_PAD_NUMBERS + +This variable holds a boolean indicating if we will create +zero padded numbers for C, C and C. +The default is C<0>, indicating that we will create space padded +numbers. Added for compatibility with C implementations. + +=head2 Tuning the way RESOLVE_SYMLINK will works + + You can tune the behaviour by setting the $Archive::Tar::RESOLVE_SYMLINK variable, + or $ENV{PERL5_AT_RESOLVE_SYMLINK} before loading the module Archive::Tar. + + Values can be one of the following: + + none + Disable this mechanism and failed as it was in previous version (<1.88) + + speed (default) + If you prefer speed + this will read again the whole archive using read() so all entries + will be available + + memory + If you prefer memory + + Limitation + + It won't work for terminal, pipe or sockets or every non seekable source. + +=cut + +=head1 FAQ + +=over 4 + +=item What's the minimum perl version required to run Archive::Tar? + +You will need perl version 5.005_03 or newer. + +=item Isn't Archive::Tar slow? + +Yes it is. It's pure perl, so it's a lot slower then your C +However, it's very portable. If speed is an issue, consider using +C instead. + +=item Isn't Archive::Tar heavier on memory than /bin/tar? + +Yes it is, see previous answer. Since C and therefore +C doesn't support C on their filehandles, there is little +choice but to read the archive into memory. +This is ok if you want to do in-memory manipulation of the archive. + +If you just want to extract, use the C class method +instead. It will optimize and write to disk immediately. + +Another option is to use the C class method to iterate over +the files in the tarball without reading them all in memory at once. + +=item Can you lazy-load data instead? + +In some cases, yes. You can use the C class method to iterate +over the files in the tarball without reading them all in memory at once. + +=item How much memory will an X kb tar file need? + +Probably more than X kb, since it will all be read into memory. If +this is a problem, and you don't need to do in memory manipulation +of the archive, consider using the C class method, or C +instead. + +=item What do you do with unsupported filetypes in an archive? + +C has a few filetypes that aren't supported on other platforms, +like C. If we encounter a C or C we'll just +try to make a copy of the original file, rather than throwing an error. + +This does require you to read the entire archive in to memory first, +since otherwise we wouldn't know what data to fill the copy with. +(This means that you cannot use the class methods, including C +on archives that have incompatible filetypes and still expect things +to work). + +For other filetypes, like C and C we'll warn that +the extraction of this particular item didn't work. + +=item I'm using WinZip, or some other non-POSIX client, and files are not being extracted properly! + +By default, C is in a completely POSIX-compatible +mode, which uses the POSIX-specification of C to store files. +For paths greater than 100 characters, this is done using the +C. Non-POSIX-compatible clients may not support +this part of the specification, and may only support the C functionality. To facilitate those clients, you can set the +C<$Archive::Tar::DO_NOT_USE_PREFIX> variable to C. See the +C section for details on this variable. + +Note that GNU tar earlier than version 1.14 does not cope well with +the C. If you use such a version, consider setting +the C<$Archive::Tar::DO_NOT_USE_PREFIX> variable to C. + +=item How do I extract only files that have property X from an archive? + +Sometimes, you might not wish to extract a complete archive, just +the files that are relevant to you, based on some criteria. + +You can do this by filtering a list of C objects +based on your criteria. For example, to extract only files that have +the string C in their title, you would use: + + $tar->extract( + grep { $_->full_path =~ /foo/ } $tar->get_files + ); + +This way, you can filter on any attribute of the files in the archive. +Consult the C documentation on how to use these +objects. + +=item How do I access .tar.Z files? + +The C module can optionally use C (via +the C module) to access tar files that have been compressed +with C. Unfortunately tar files compressed with the Unix C +utility cannot be read by C and so cannot be directly +accesses by C. + +If the C or C programs are available, you can use +one of these workarounds to read C<.tar.Z> files from C + +Firstly with C + + use Archive::Tar; + + open F, "uncompress -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +and this with C + + use Archive::Tar; + + open F, "gunzip -c $filename |"; + my $tar = Archive::Tar->new(*F); + ... + +Similarly, if the C program is available, you can use this to +write a C<.tar.Z> file + + use Archive::Tar; + use IO::File; + + my $fh = new IO::File "| compress -c >$filename"; + my $tar = Archive::Tar->new(); + ... + $tar->write($fh); + $fh->close ; + +=item How do I handle Unicode strings? + +C uses byte semantics for any files it reads from or writes +to disk. This is not a problem if you only deal with files and never +look at their content or work solely with byte strings. But if you use +Unicode strings with character semantics, some additional steps need +to be taken. + +For example, if you add a Unicode string like + + # Problem + $tar->add_data('file.txt', "Euro: \x{20AC}"); + +then there will be a problem later when the tarfile gets written out +to disk via C<< $tar->write() >>: + + Wide character in print at .../Archive/Tar.pm line 1014. + +The data was added as a Unicode string and when writing it out to disk, +the C<:utf8> line discipline wasn't set by C, so Perl +tried to convert the string to ISO-8859 and failed. The written file +now contains garbage. + +For this reason, Unicode strings need to be converted to UTF-8-encoded +bytestrings before they are handed off to C: + + use Encode; + my $data = "Accented character: \x{20AC}"; + $data = encode('utf8', $data); + + $tar->add_data('file.txt', $data); + +A opposite problem occurs if you extract a UTF8-encoded file from a +tarball. Using C on the C object +will return its content as a bytestring, not as a Unicode string. + +If you want it to be a Unicode string (because you want character +semantics with operations like regular expression matching), you need +to decode the UTF8-encoded content and have Perl convert it into +a Unicode string: + + use Encode; + my $data = $tar->get_content(); + + # Make it a Unicode string + $data = decode('utf8', $data); + +There is no easy way to provide this functionality in C, +because a tarball can contain many files, and each of which could be +encoded in a different way. + +=back + +=head1 CAVEATS + +The AIX tar does not fill all unused space in the tar archive with 0x00. +This sometimes leads to warning messages from C. + + Invalid header block at offset nnn + +A fix for that problem is scheduled to be released in the following levels +of AIX, all of which should be coming out in the 4th quarter of 2009: + + AIX 5.3 TL7 SP10 + AIX 5.3 TL8 SP8 + AIX 5.3 TL9 SP5 + AIX 5.3 TL10 SP2 + + AIX 6.1 TL0 SP11 + AIX 6.1 TL1 SP7 + AIX 6.1 TL2 SP6 + AIX 6.1 TL3 SP3 + +The IBM APAR number for this problem is IZ50240 (Reported component ID: +5765G0300 / AIX 5.3). It is possible to get an ifix for that problem. +If you need an ifix please contact your local IBM AIX support. + +=head1 TODO + +=over 4 + +=item Check if passed in handles are open for read/write + +Currently I don't know of any portable pure perl way to do this. +Suggestions welcome. + +=item Allow archives to be passed in as string + +Currently, we only allow opened filehandles or filenames, but +not strings. The internals would need some reworking to facilitate +stringified archives. + +=item Facilitate processing an opened filehandle of a compressed archive + +Currently, we only support this if the filehandle is an IO::Zlib object. +Environments, like apache, will present you with an opened filehandle +to an uploaded file, which might be a compressed archive. + +=back + +=head1 SEE ALSO + +=over 4 + +=item The GNU tar specification + +C + +=item The PAX format specification + +The specification which tar derives from; C< http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html> + +=item A comparison of GNU and POSIX tar standards; C + +=item GNU tar intends to switch to POSIX compatibility + +GNU Tar authors have expressed their intention to become completely +POSIX-compatible; C + +=item A Comparison between various tar implementations + +Lists known issues and incompatibilities; C + +=back + +=head1 AUTHOR + +This module by Jos Boumans Ekane@cpan.orgE. + +Please reports bugs to Ebug-archive-tar@rt.cpan.orgE. + +=head1 ACKNOWLEDGEMENTS + +Thanks to Sean Burke, Chris Nandor, Chip Salzenberg, Tim Heaney, Gisle Aas, +Rainer Tammer and especially Andrew Savige for their help and suggestions. + +=head1 COPYRIGHT + +This module is copyright (c) 2002 - 2009 Jos Boumans +Ekane@cpan.orgE. All rights reserved. + +This library is free software; you may redistribute and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Attribute/Handlers.pm b/data/miniconda3/lib/perl5/core_perl/Attribute/Handlers.pm new file mode 100644 index 0000000000000000000000000000000000000000..f028286fb85f44ec68efc6f67ed1dbc37d761344 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Attribute/Handlers.pm @@ -0,0 +1,941 @@ +package Attribute::Handlers; +use 5.006; +use Carp; +use warnings; +use strict; +our $AUTOLOAD; +our $VERSION = '1.01'; # remember to update version in POD! +# $DB::single=1; + +my %symcache; +sub findsym { + my ($pkg, $ref, $type) = @_; + return $symcache{$pkg,$ref} if $symcache{$pkg,$ref}; + $type ||= ref($ref); + no strict 'refs'; + my $symtab = \%{$pkg."::"}; + for ( keys %$symtab ) { for my $sym ( $$symtab{$_} ) { + if (ref $sym && $sym == $ref) { + return $symcache{$pkg,$ref} = \*{"$pkg:\:$_"}; + } + use strict; + next unless ref ( \$sym ) eq 'GLOB'; + return $symcache{$pkg,$ref} = \$sym + if *{$sym}{$type} && *{$sym}{$type} == $ref; + }} +} + +my %validtype = ( + VAR => [qw[SCALAR ARRAY HASH]], + ANY => [qw[SCALAR ARRAY HASH CODE]], + "" => [qw[SCALAR ARRAY HASH CODE]], + SCALAR => [qw[SCALAR]], + ARRAY => [qw[ARRAY]], + HASH => [qw[HASH]], + CODE => [qw[CODE]], +); +my %lastattr; +my @declarations; +my %raw; +my %phase; +my %sigil = (SCALAR=>'$', ARRAY=>'@', HASH=>'%'); +my $global_phase = 0; +my %global_phases = ( + BEGIN => 0, + CHECK => 1, + INIT => 2, + END => 3, +); +my @global_phases = qw(BEGIN CHECK INIT END); + +sub _usage_AH_ { + croak "Usage: use $_[0] autotie => {AttrName => TieClassName,...}"; +} + +my $qual_id = qr/^[_a-z]\w*(::[_a-z]\w*)*$/i; + +sub import { + my $class = shift @_; + return unless $class eq "Attribute::Handlers"; + while (@_) { + my $cmd = shift; + if ($cmd =~ /^autotie((?:ref)?)$/) { + my $tiedata = ($1 ? '$ref, ' : '') . '@$data'; + my $mapping = shift; + _usage_AH_ $class unless ref($mapping) eq 'HASH'; + while (my($attr, $tieclass) = each %$mapping) { + $tieclass =~ s/^([_a-z]\w*(::[_a-z]\w*)*)(.*)/$1/is; + my $args = $3||'()'; + _usage_AH_ $class unless $attr =~ $qual_id + && $tieclass =~ $qual_id + && eval "use base q\0$tieclass\0; 1"; + if ($tieclass->isa('Exporter')) { + local $Exporter::ExportLevel = 2; + $tieclass->import(eval $args); + } + $attr =~ s/__CALLER__/caller(1)/e; + $attr = caller()."::".$attr unless $attr =~ /::/; + eval qq{ + sub $attr : ATTR(VAR) { + my (\$ref, \$data) = \@_[2,4]; + my \$was_arrayref = ref \$data eq 'ARRAY'; + \$data = [ \$data ] unless \$was_arrayref; + my \$type = ref(\$ref)||"value (".(\$ref||"").")"; + (\$type eq 'SCALAR')? tie \$\$ref,'$tieclass',$tiedata + :(\$type eq 'ARRAY') ? tie \@\$ref,'$tieclass',$tiedata + :(\$type eq 'HASH') ? tie \%\$ref,'$tieclass',$tiedata + : die "Can't autotie a \$type\n" + } 1 + } or die "Internal error: $@"; + } + } + else { + croak "Can't understand $_"; + } + } +} + +# On older perls, code attribute handlers run before the sub gets placed +# in its package. Since the :ATTR handlers need to know the name of the +# sub they're applied to, the name lookup (via findsym) needs to be +# delayed: we do it immediately before we might need to find attribute +# handlers from their name. However, on newer perls (which fix some +# problems relating to attribute application), a sub gets placed in its +# package before its attributes are processed. In this case, the +# delayed name lookup might be too late, because the sub we're looking +# for might have already been replaced. So we need to detect which way +# round this perl does things, and time the name lookup accordingly. +BEGIN { + my $delayed; + sub Attribute::Handlers::_TEST_::MODIFY_CODE_ATTRIBUTES { + $delayed = \&Attribute::Handlers::_TEST_::t != $_[1]; + return (); + } + sub Attribute::Handlers::_TEST_::t :T { } + *_delayed_name_resolution = sub() { $delayed }; + undef &Attribute::Handlers::_TEST_::MODIFY_CODE_ATTRIBUTES; + undef &Attribute::Handlers::_TEST_::t; +} + +sub _resolve_lastattr { + return unless $lastattr{ref}; + my $sym = findsym @lastattr{'pkg','ref'} + or die "Internal error: $lastattr{pkg} symbol went missing"; + my $name = *{$sym}{NAME}; + warn "Declaration of $name attribute in package $lastattr{pkg} may clash with future reserved word\n" + if $^W and $name !~ /[A-Z]/; + foreach ( @{$validtype{$lastattr{type}}} ) { + no strict 'refs'; + *{"$lastattr{pkg}::_ATTR_${_}_${name}"} = $lastattr{ref}; + } + %lastattr = (); +} + +sub AUTOLOAD { + return if $AUTOLOAD =~ /::DESTROY$/; + my ($class) = $AUTOLOAD =~ m/(.*)::/g; + $AUTOLOAD =~ m/_ATTR_(.*?)_(.*)/ or + croak "Can't locate class method '$AUTOLOAD' via package '$class'"; + croak "Attribute handler '$2' doesn't handle $1 attributes"; +} + +my $builtin = $] ge '5.027000' + ? qr/lvalue|method|shared/ + : qr/lvalue|method|locked|shared|unique/; + +sub _gen_handler_AH_() { + return sub { + _resolve_lastattr if _delayed_name_resolution; + my ($pkg, $ref, @attrs) = @_; + my (undef, $filename, $linenum) = caller 2; + foreach (@attrs) { + my ($attr, $data) = /^([a-z_]\w*)(?:[(](.*)[)])?$/is or next; + if ($attr eq 'ATTR') { + no strict 'refs'; + $data ||= "ANY"; + $raw{$ref} = $data =~ s/\s*,?\s*RAWDATA\s*,?\s*//; + $phase{$ref}{BEGIN} = 1 + if $data =~ s/\s*,?\s*(BEGIN)\s*,?\s*//; + $phase{$ref}{INIT} = 1 + if $data =~ s/\s*,?\s*(INIT)\s*,?\s*//; + $phase{$ref}{END} = 1 + if $data =~ s/\s*,?\s*(END)\s*,?\s*//; + $phase{$ref}{CHECK} = 1 + if $data =~ s/\s*,?\s*(CHECK)\s*,?\s*// + || ! keys %{$phase{$ref}}; + # Added for cleanup to not pollute next call. + (%lastattr = ()), + croak "Can't have two ATTR specifiers on one subroutine" + if keys %lastattr; + croak "Bad attribute type: ATTR($data)" + unless $validtype{$data}; + %lastattr=(pkg=>$pkg,ref=>$ref,type=>$data); + _resolve_lastattr unless _delayed_name_resolution; + } + else { + my $type = ref $ref; + my $handler = $pkg->can("_ATTR_${type}_${attr}"); + next unless $handler; + my $decl = [$pkg, $ref, $attr, $data, + $raw{$handler}, $phase{$handler}, $filename, $linenum]; + foreach my $gphase (@global_phases) { + _apply_handler_AH_($decl,$gphase) + if $global_phases{$gphase} <= $global_phase; + } + if ($global_phase != 0) { + # if _gen_handler_AH_ is being called after + # CHECK it's for a lexical, so make sure + # it didn't want to run anything later + + local $Carp::CarpLevel = 2; + carp "Won't be able to apply END handler" + if $phase{$handler}{END}; + } + else { + push @declarations, $decl + } + } + $_ = undef; + } + return grep {defined && !/$builtin/} @attrs; + } +} + +{ + no strict 'refs'; + *{"Attribute::Handlers::UNIVERSAL::MODIFY_${_}_ATTRIBUTES"} = + _gen_handler_AH_ foreach @{$validtype{ANY}}; +} +push @UNIVERSAL::ISA, 'Attribute::Handlers::UNIVERSAL' + unless grep /^Attribute::Handlers::UNIVERSAL$/, @UNIVERSAL::ISA; + +sub _apply_handler_AH_ { + my ($declaration, $phase) = @_; + my ($pkg, $ref, $attr, $data, $raw, $handlerphase, $filename, $linenum) = @$declaration; + return unless $handlerphase->{$phase}; + # print STDERR "Handling $attr on $ref in $phase with [$data]\n"; + my $type = ref $ref; + my $handler = "_ATTR_${type}_${attr}"; + my $sym = findsym($pkg, $ref); + $sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL'; + no warnings; + if (!$raw && defined($data)) { + if ($data ne '') { + my $evaled = eval("package $pkg; no warnings; no strict; + local \$SIG{__WARN__}=sub{die}; [$data]"); + $data = $evaled unless $@; + } + else { $data = undef } + } + $pkg->$handler($sym, + (ref $sym eq 'GLOB' ? *{$sym}{ref $ref}||$ref : $ref), + $attr, + $data, + $phase, + $filename, + $linenum, + ); + return 1; +} + +{ + no warnings 'void'; + CHECK { + $global_phase++; + _resolve_lastattr if _delayed_name_resolution; + foreach my $decl (@declarations) { + _apply_handler_AH_($decl, 'CHECK'); + } + } + + INIT { + $global_phase++; + foreach my $decl (@declarations) { + _apply_handler_AH_($decl, 'INIT'); + } + } +} + +END { + $global_phase++; + foreach my $decl (@declarations) { + _apply_handler_AH_($decl, 'END'); + } +} + +1; +__END__ + +=head1 NAME + +Attribute::Handlers - Simpler definition of attribute handlers + +=head1 VERSION + +This document describes version 1.01 of Attribute::Handlers. + +=head1 SYNOPSIS + + package MyClass; + require 5.006; + use Attribute::Handlers; + no warnings 'redefine'; + + + sub Good : ATTR(SCALAR) { + my ($package, $symbol, $referent, $attr, $data) = @_; + + # Invoked for any scalar variable with a :Good attribute, + # provided the variable was declared in MyClass (or + # a derived class) or typed to MyClass. + + # Do whatever to $referent here (executed in CHECK phase). + ... + } + + sub Bad : ATTR(SCALAR) { + # Invoked for any scalar variable with a :Bad attribute, + # provided the variable was declared in MyClass (or + # a derived class) or typed to MyClass. + ... + } + + sub Good : ATTR(ARRAY) { + # Invoked for any array variable with a :Good attribute, + # provided the variable was declared in MyClass (or + # a derived class) or typed to MyClass. + ... + } + + sub Good : ATTR(HASH) { + # Invoked for any hash variable with a :Good attribute, + # provided the variable was declared in MyClass (or + # a derived class) or typed to MyClass. + ... + } + + sub Ugly : ATTR(CODE) { + # Invoked for any subroutine declared in MyClass (or a + # derived class) with an :Ugly attribute. + ... + } + + sub Omni : ATTR { + # Invoked for any scalar, array, hash, or subroutine + # with an :Omni attribute, provided the variable or + # subroutine was declared in MyClass (or a derived class) + # or the variable was typed to MyClass. + # Use ref($_[2]) to determine what kind of referent it was. + ... + } + + + use Attribute::Handlers autotie => { Cycle => Tie::Cycle }; + + my $next : Cycle(['A'..'Z']); + + +=head1 DESCRIPTION + +This module, when inherited by a package, allows that package's class to +define attribute handler subroutines for specific attributes. Variables +and subroutines subsequently defined in that package, or in packages +derived from that package may be given attributes with the same names as +the attribute handler subroutines, which will then be called in one of +the compilation phases (i.e. in a C, C, C, or C +block). (C blocks don't correspond to a global compilation +phase, so they can't be specified here.) + +To create a handler, define it as a subroutine with the same name as +the desired attribute, and declare the subroutine itself with the +attribute C<:ATTR>. For example: + + package LoudDecl; + use Attribute::Handlers; + + sub Loud :ATTR { + my ($package, $symbol, $referent, $attr, $data, $phase, + $filename, $linenum) = @_; + print STDERR + ref($referent), " ", + *{$symbol}{NAME}, " ", + "($referent) ", "was just declared ", + "and ascribed the ${attr} attribute ", + "with data ($data)\n", + "in phase $phase\n", + "in file $filename at line $linenum\n"; + } + +This creates a handler for the attribute C<:Loud> in the class LoudDecl. +Thereafter, any subroutine declared with a C<:Loud> attribute in the class +LoudDecl: + + package LoudDecl; + + sub foo: Loud {...} + +causes the above handler to be invoked, and passed: + +=over + +=item [0] + +the name of the package into which it was declared; + +=item [1] + +a reference to the symbol table entry (typeglob) containing the subroutine; + +=item [2] + +a reference to the subroutine; + +=item [3] + +the name of the attribute; + +=item [4] + +any data associated with that attribute; + +=item [5] + +the name of the phase in which the handler is being invoked; + +=item [6] + +the filename in which the handler is being invoked; + +=item [7] + +the line number in this file. + +=back + +Likewise, declaring any variables with the C<:Loud> attribute within the +package: + + package LoudDecl; + + my $foo :Loud; + my @foo :Loud; + my %foo :Loud; + +will cause the handler to be called with a similar argument list (except, +of course, that C<$_[2]> will be a reference to the variable). + +The package name argument will typically be the name of the class into +which the subroutine was declared, but it may also be the name of a derived +class (since handlers are inherited). + +If a lexical variable is given an attribute, there is no symbol table to +which it belongs, so the symbol table argument (C<$_[1]>) is set to the +string C<'LEXICAL'> in that case. Likewise, ascribing an attribute to +an anonymous subroutine results in a symbol table argument of C<'ANON'>. + +The data argument passes in the value (if any) associated with the +attribute. For example, if C<&foo> had been declared: + + sub foo :Loud("turn it up to 11, man!") {...} + +then a reference to an array containing the string +C<"turn it up to 11, man!"> would be passed as the last argument. + +Attribute::Handlers makes strenuous efforts to convert +the data argument (C<$_[4]>) to a usable form before passing it to +the handler (but see L<"Non-interpretive attribute handlers">). +If those efforts succeed, the interpreted data is passed in an array +reference; if they fail, the raw data is passed as a string. +For example, all of these: + + sub foo :Loud(till=>ears=>are=>bleeding) {...} + sub foo :Loud(qw/till ears are bleeding/) {...} + sub foo :Loud(qw/till, ears, are, bleeding/) {...} + sub foo :Loud(till,ears,are,bleeding) {...} + +causes it to pass C<['till','ears','are','bleeding']> as the handler's +data argument. While: + + sub foo :Loud(['till','ears','are','bleeding']) {...} + +causes it to pass C<[ ['till','ears','are','bleeding'] ]>; the array +reference specified in the data being passed inside the standard +array reference indicating successful interpretation. + +However, if the data can't be parsed as valid Perl, then +it is passed as an uninterpreted string. For example: + + sub foo :Loud(my,ears,are,bleeding) {...} + sub foo :Loud(qw/my ears are bleeding) {...} + +cause the strings C<'my,ears,are,bleeding'> and +C<'qw/my ears are bleeding'> respectively to be passed as the +data argument. + +If no value is associated with the attribute, C is passed. + +=head2 Typed lexicals + +Regardless of the package in which it is declared, if a lexical variable is +ascribed an attribute, the handler that is invoked is the one belonging to +the package to which it is typed. For example, the following declarations: + + package OtherClass; + + my LoudDecl $loudobj : Loud; + my LoudDecl @loudobjs : Loud; + my LoudDecl %loudobjex : Loud; + +causes the LoudDecl::Loud handler to be invoked (even if OtherClass also +defines a handler for C<:Loud> attributes). + + +=head2 Type-specific attribute handlers + +If an attribute handler is declared and the C<:ATTR> specifier is +given the name of a built-in type (C, C, C, or C), +the handler is only applied to declarations of that type. For example, +the following definition: + + package LoudDecl; + + sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" } + +creates an attribute handler that applies only to scalars: + + + package Painful; + use base LoudDecl; + + my $metal : RealLoud; # invokes &LoudDecl::RealLoud + my @metal : RealLoud; # error: unknown attribute + my %metal : RealLoud; # error: unknown attribute + sub metal : RealLoud {...} # error: unknown attribute + +You can, of course, declare separate handlers for these types as well +(but you'll need to specify C to do it quietly): + + package LoudDecl; + use Attribute::Handlers; + no warnings 'redefine'; + + sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" } + sub RealLoud :ATTR(ARRAY) { print "Urrrrrrrrrr!" } + sub RealLoud :ATTR(HASH) { print "Arrrrrgggghhhhhh!" } + sub RealLoud :ATTR(CODE) { croak "Real loud sub torpedoed" } + +You can also explicitly indicate that a single handler is meant to be +used for all types of referents like so: + + package LoudDecl; + use Attribute::Handlers; + + sub SeriousLoud :ATTR(ANY) { warn "Hearing loss imminent" } + +(I.e. C is a synonym for C<:ATTR>). + + +=head2 Non-interpretive attribute handlers + +Occasionally the strenuous efforts Attribute::Handlers makes to convert +the data argument (C<$_[4]>) to a usable form before passing it to +the handler get in the way. + +You can turn off that eagerness-to-help by declaring +an attribute handler with the keyword C. For example: + + sub Raw : ATTR(RAWDATA) {...} + sub Nekkid : ATTR(SCALAR,RAWDATA) {...} + sub Au::Naturale : ATTR(RAWDATA,ANY) {...} + +Then the handler makes absolutely no attempt to interpret the data it +receives and simply passes it as a string: + + my $power : Raw(1..100); # handlers receives "1..100" + +=head2 Phase-specific attribute handlers + +By default, attribute handlers are called at the end of the compilation +phase (in a C block). This seems to be optimal in most cases because +most things that can be defined are defined by that point but nothing has +been executed. + +However, it is possible to set up attribute handlers that are called at +other points in the program's compilation or execution, by explicitly +stating the phase (or phases) in which you wish the attribute handler to +be called. For example: + + sub Early :ATTR(SCALAR,BEGIN) {...} + sub Normal :ATTR(SCALAR,CHECK) {...} + sub Late :ATTR(SCALAR,INIT) {...} + sub Final :ATTR(SCALAR,END) {...} + sub Bookends :ATTR(SCALAR,BEGIN,END) {...} + +As the last example indicates, a handler may be set up to be (re)called in +two or more phases. The phase name is passed as the handler's final argument. + +Note that attribute handlers that are scheduled for the C phase +are handled as soon as the attribute is detected (i.e. before any +subsequently defined C blocks are executed). + + +=head2 Attributes as C interfaces + +Attributes make an excellent and intuitive interface through which to tie +variables. For example: + + use Attribute::Handlers; + use Tie::Cycle; + + sub UNIVERSAL::Cycle : ATTR(SCALAR) { + my ($package, $symbol, $referent, $attr, $data, $phase) = @_; + $data = [ $data ] unless ref $data eq 'ARRAY'; + tie $$referent, 'Tie::Cycle', $data; + } + + # and thereafter... + + package main; + + my $next : Cycle('A'..'Z'); # $next is now a tied variable + + while (<>) { + print $next; + } + +Note that, because the C attribute receives its arguments in the +C<$data> variable, if the attribute is given a list of arguments, C<$data> +will consist of a single array reference; otherwise, it will consist of the +single argument directly. Since Tie::Cycle requires its cycling values to +be passed as an array reference, this means that we need to wrap +non-array-reference arguments in an array constructor: + + $data = [ $data ] unless ref $data eq 'ARRAY'; + +Typically, however, things are the other way around: the tieable class expects +its arguments as a flattened list, so the attribute looks like: + + sub UNIVERSAL::Cycle : ATTR(SCALAR) { + my ($package, $symbol, $referent, $attr, $data, $phase) = @_; + my @data = ref $data eq 'ARRAY' ? @$data : $data; + tie $$referent, 'Tie::Whatever', @data; + } + + +This software pattern is so widely applicable that Attribute::Handlers +provides a way to automate it: specifying C<'autotie'> in the +C statement. So, the cycling example, +could also be written: + + use Attribute::Handlers autotie => { Cycle => 'Tie::Cycle' }; + + # and thereafter... + + package main; + + my $next : Cycle(['A'..'Z']); # $next is now a tied variable + + while (<>) { + print $next; + } + +Note that we now have to pass the cycling values as an array reference, +since the C mechanism passes C a list of arguments as a list +(as in the Tie::Whatever example), I as an array reference (as in +the original Tie::Cycle example at the start of this section). + +The argument after C<'autotie'> is a reference to a hash in which each key is +the name of an attribute to be created, and each value is the class to which +variables ascribed that attribute should be tied. + +Note that there is no longer any need to import the Tie::Cycle module -- +Attribute::Handlers takes care of that automagically. You can even pass +arguments to the module's C subroutine, by appending them to the +class name. For example: + + use Attribute::Handlers + autotie => { Dir => 'Tie::Dir qw(DIR_UNLINK)' }; + +If the attribute name is unqualified, the attribute is installed in the +current package. Otherwise it is installed in the qualifier's package: + + package Here; + + use Attribute::Handlers autotie => { + Other::Good => Tie::SecureHash, # tie attr installed in Other:: + Bad => Tie::Taxes, # tie attr installed in Here:: + UNIVERSAL::Ugly => Software::Patent # tie attr installed everywhere + }; + +Autoties are most commonly used in the module to which they actually tie, +and need to export their attributes to any module that calls them. To +facilitate this, Attribute::Handlers recognizes a special "pseudo-class" -- +C<__CALLER__>, which may be specified as the qualifier of an attribute: + + package Tie::Me::Kangaroo:Down::Sport; + + use Attribute::Handlers autotie => + { '__CALLER__::Roo' => __PACKAGE__ }; + +This causes Attribute::Handlers to define the C attribute in the package +that imports the Tie::Me::Kangaroo:Down::Sport module. + +Note that it is important to quote the __CALLER__::Roo identifier because +a bug in perl 5.8 will refuse to parse it and cause an unknown error. + +=head3 Passing the tied object to C + +Occasionally it is important to pass a reference to the object being tied +to the TIESCALAR, TIEHASH, etc. that ties it. + +The C mechanism supports this too. The following code: + + use Attribute::Handlers autotieref => { Selfish => Tie::Selfish }; + my $var : Selfish(@args); + +has the same effect as: + + tie my $var, 'Tie::Selfish', @args; + +But when C<"autotieref"> is used instead of C<"autotie">: + + use Attribute::Handlers autotieref => { Selfish => Tie::Selfish }; + my $var : Selfish(@args); + +the effect is to pass the C call an extra reference to the variable +being tied: + + tie my $var, 'Tie::Selfish', \$var, @args; + + + +=head1 EXAMPLES + +If the class shown in L were placed in the MyClass.pm +module, then the following code: + + package main; + use MyClass; + + my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous); + + package SomeOtherClass; + use base MyClass; + + sub tent { 'acle' } + + sub fn :Ugly(sister) :Omni('po',tent()) {...} + my @arr :Good :Omni(s/cie/nt/); + my %hsh :Good(q/bye/) :Omni(q/bus/); + + +would cause the following handlers to be invoked: + + # my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous); + + MyClass::Good:ATTR(SCALAR)( 'MyClass', # class + 'LEXICAL', # no typeglob + \$slr, # referent + 'Good', # attr name + undef # no attr data + 'CHECK', # compiler phase + ); + + MyClass::Bad:ATTR(SCALAR)( 'MyClass', # class + 'LEXICAL', # no typeglob + \$slr, # referent + 'Bad', # attr name + 0 # eval'd attr data + 'CHECK', # compiler phase + ); + + MyClass::Omni:ATTR(SCALAR)( 'MyClass', # class + 'LEXICAL', # no typeglob + \$slr, # referent + 'Omni', # attr name + '-vorous' # eval'd attr data + 'CHECK', # compiler phase + ); + + + # sub fn :Ugly(sister) :Omni('po',tent()) {...} + + MyClass::UGLY:ATTR(CODE)( 'SomeOtherClass', # class + \*SomeOtherClass::fn, # typeglob + \&SomeOtherClass::fn, # referent + 'Ugly', # attr name + 'sister' # eval'd attr data + 'CHECK', # compiler phase + ); + + MyClass::Omni:ATTR(CODE)( 'SomeOtherClass', # class + \*SomeOtherClass::fn, # typeglob + \&SomeOtherClass::fn, # referent + 'Omni', # attr name + ['po','acle'] # eval'd attr data + 'CHECK', # compiler phase + ); + + + # my @arr :Good :Omni(s/cie/nt/); + + MyClass::Good:ATTR(ARRAY)( 'SomeOtherClass', # class + 'LEXICAL', # no typeglob + \@arr, # referent + 'Good', # attr name + undef # no attr data + 'CHECK', # compiler phase + ); + + MyClass::Omni:ATTR(ARRAY)( 'SomeOtherClass', # class + 'LEXICAL', # no typeglob + \@arr, # referent + 'Omni', # attr name + "" # eval'd attr data + 'CHECK', # compiler phase + ); + + + # my %hsh :Good(q/bye) :Omni(q/bus/); + + MyClass::Good:ATTR(HASH)( 'SomeOtherClass', # class + 'LEXICAL', # no typeglob + \%hsh, # referent + 'Good', # attr name + 'q/bye' # raw attr data + 'CHECK', # compiler phase + ); + + MyClass::Omni:ATTR(HASH)( 'SomeOtherClass', # class + 'LEXICAL', # no typeglob + \%hsh, # referent + 'Omni', # attr name + 'bus' # eval'd attr data + 'CHECK', # compiler phase + ); + + +Installing handlers into UNIVERSAL, makes them...err..universal. +For example: + + package Descriptions; + use Attribute::Handlers; + + my %name; + sub name { return $name{$_[2]}||*{$_[1]}{NAME} } + + sub UNIVERSAL::Name :ATTR { + $name{$_[2]} = $_[4]; + } + + sub UNIVERSAL::Purpose :ATTR { + print STDERR "Purpose of ", &name, " is $_[4]\n"; + } + + sub UNIVERSAL::Unit :ATTR { + print STDERR &name, " measured in $_[4]\n"; + } + +Let's you write: + + use Descriptions; + + my $capacity : Name(capacity) + : Purpose(to store max storage capacity for files) + : Unit(Gb); + + + package Other; + + sub foo : Purpose(to foo all data before barring it) { } + + # etc. + +=head1 UTILITY FUNCTIONS + +This module offers a single utility function, C. + +=over 4 + +=item findsym + + my $symbol = Attribute::Handlers::findsym($package, $referent); + +The function looks in the symbol table of C<$package> for the typeglob for +C<$referent>, which is a reference to a variable or subroutine (SCALAR, ARRAY, +HASH, or CODE). If it finds the typeglob, it returns it. Otherwise, it returns +undef. Note that C memoizes the typeglobs it has previously +successfully found, so subsequent calls with the same arguments should be +much faster. + +=back + +=head1 DIAGNOSTICS + +=over + +=item C + +An attribute handler was specified with an C<:ATTR(I)>, but the +type of referent it was defined to handle wasn't one of the five permitted: +C, C, C, C, or C. + +=item C + +A handler for attributes of the specified name I defined, but not +for the specified type of declaration. Typically encountered when trying +to apply a C attribute handler to a subroutine, or a C +attribute handler to some other type of variable. + +=item C + +A handler for an attributes with an all-lowercase name was declared. An +attribute with an all-lowercase name might have a meaning to Perl +itself some day, even though most don't yet. Use a mixed-case attribute +name, instead. + +=item C + +You just can't, okay? +Instead, put all the specifications together with commas between them +in a single C)>. + +=item C + +You can only declare autoties for types C<"SCALAR">, C<"ARRAY">, and +C<"HASH">. They're the only things (apart from typeglobs -- which are +not declarable) that Perl can tie. + +=item C + +Something is rotten in the state of the program. An attributed +subroutine ceased to exist between the point it was declared and the point +at which its attribute handler(s) would have been called. + +=item C + +You have defined an END handler for an attribute that is being applied +to a lexical variable. Since the variable may not be available during END +this won't happen. + +=back + +=head1 AUTHOR + +Damian Conway (damian@conway.org). The maintainer of this module is now Rafael +Garcia-Suarez (rgarciasuarez@gmail.com). + +Maintainer of the CPAN release is Steffen Mueller (smueller@cpan.org). +Contact him with technical difficulties with respect to the packaging of the +CPAN module. + +=head1 BUGS + +There are undoubtedly serious bugs lurking somewhere in code this funky :-) +Bug reports and other feedback are most welcome. + +=head1 COPYRIGHT AND LICENSE + + Copyright (c) 2001-2014, Damian Conway. All Rights Reserved. + This module is free software. It may be used, redistributed + and/or modified under the same terms as Perl itself. diff --git a/data/miniconda3/lib/perl5/core_perl/AutoLoader.pm b/data/miniconda3/lib/perl5/core_perl/AutoLoader.pm new file mode 100644 index 0000000000000000000000000000000000000000..5546f9e995333cedc818b8dcc8757e64b86ded54 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/AutoLoader.pm @@ -0,0 +1,453 @@ +package AutoLoader; + +use strict; +use 5.006_001; + +our($VERSION, $AUTOLOAD); + +my $is_dosish; +my $is_epoc; +my $is_vms; +my $is_macos; + +BEGIN { + $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare'; + $is_epoc = $^O eq 'epoc'; + $is_vms = $^O eq 'VMS'; + $is_macos = $^O eq 'MacOS'; + $VERSION = '5.74'; +} + +AUTOLOAD { + my $sub = $AUTOLOAD; + autoload_sub($sub); + goto &$sub; +} + +sub autoload_sub { + my $sub = shift; + + my $filename = AutoLoader::find_filename( $sub ); + + my $save = $@; + local $!; # Do not munge the value. + eval { local $SIG{__DIE__}; require $filename }; + if ($@) { + if (substr($sub,-9) eq '::DESTROY') { + no strict 'refs'; + *$sub = sub {}; + $@ = undef; + } elsif ($@ =~ /^Can't locate/) { + # The load might just have failed because the filename was too + # long for some old SVR3 systems which treat long names as errors. + # If we can successfully truncate a long name then it's worth a go. + # There is a slight risk that we could pick up the wrong file here + # but autosplit should have warned about that when splitting. + if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){ + eval { local $SIG{__DIE__}; require $filename }; + } + } + if ($@){ + $@ =~ s/ at .*\n//; + my $error = $@; + require Carp; + Carp::croak($error); + } + } + $@ = $save; + + return 1; +} + +sub find_filename { + my $sub = shift; + my $filename; + # Braces used to preserve $1 et al. + { + # Try to find the autoloaded file from the package-qualified + # name of the sub. e.g., if the sub needed is + # Getopt::Long::GetOptions(), then $INC{Getopt/Long.pm} is + # something like '/usr/lib/perl5/Getopt/Long.pm', and the + # autoload file is '/usr/lib/perl5/auto/Getopt/Long/GetOptions.al'. + # + # However, if @INC is a relative path, this might not work. If, + # for example, @INC = ('lib'), then $INC{Getopt/Long.pm} is + # 'lib/Getopt/Long.pm', and we want to require + # 'auto/Getopt/Long/GetOptions.al' (without the leading 'lib'). + # In this case, we simple prepend the 'auto/' and let the + # C take care of the searching for us. + + my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/); + $pkg =~ s#::#/#g; + if (defined($filename = $INC{"$pkg.pm"})) { + if ($is_macos) { + $pkg =~ tr#/#:#; + $filename = undef + unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s; + } else { + $filename = undef + unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg/$func.al#s; + } + + # if the file exists, then make sure that it is a + # a fully anchored path (i.e either '/usr/lib/auto/foo/bar.al', + # or './lib/auto/foo/bar.al'. This avoids C searching + # (and failing) to find the 'lib/auto/foo/bar.al' because it + # looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib'). + + if (defined $filename and -r $filename) { + unless ($filename =~ m|^/|s) { + if ($is_dosish) { + unless ($filename =~ m{^([a-z]:)?[\\/]}is) { + if ($^O ne 'NetWare') { + $filename = "./$filename"; + } else { + $filename = "$filename"; + } + } + } + elsif ($is_epoc) { + unless ($filename =~ m{^([a-z?]:)?[\\/]}is) { + $filename = "./$filename"; + } + } + elsif ($is_vms) { + # XXX todo by VMSmiths + $filename = "./$filename"; + } + elsif (!$is_macos) { + $filename = "./$filename"; + } + } + } + else { + $filename = undef; + } + } + unless (defined $filename) { + # let C do the searching + $filename = "auto/$sub.al"; + $filename =~ s#::#/#g; + } + } + return $filename; +} + +sub import { + my $pkg = shift; + my $callpkg = caller; + + # + # Export symbols, but not by accident of inheritance. + # + + if ($pkg eq 'AutoLoader') { + if ( @_ and $_[0] =~ /^&?AUTOLOAD$/ ) { + no strict 'refs'; + *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD; + } + } + + # + # Try to find the autosplit index file. Eg., if the call package + # is POSIX, then $INC{POSIX.pm} is something like + # '/usr/local/lib/perl5/POSIX.pm', and the autosplit index file is in + # '/usr/local/lib/perl5/auto/POSIX/autosplit.ix', so we require that. + # + # However, if @INC is a relative path, this might not work. If, + # for example, @INC = ('lib'), then + # $INC{POSIX.pm} is 'lib/POSIX.pm', and we want to require + # 'auto/POSIX/autosplit.ix' (without the leading 'lib'). + # + + (my $calldir = $callpkg) =~ s#::#/#g; + my $path = $INC{$calldir . '.pm'}; + if (defined($path)) { + # Try absolute path name, but only eval it if the + # transformation from module path to autosplit.ix path + # succeeded! + my $replaced_okay; + if ($is_macos) { + (my $malldir = $calldir) =~ tr#/#:#; + $replaced_okay = ($path =~ s#^(.*)$malldir\.pm\z#$1auto:$malldir:autosplit.ix#s); + } else { + $replaced_okay = ($path =~ s#^(.*)$calldir\.pm\z#$1auto/$calldir/autosplit.ix#); + } + + eval { require $path; } if $replaced_okay; + # If that failed, try relative path with normal @INC searching. + if (!$replaced_okay or $@) { + $path ="auto/$calldir/autosplit.ix"; + eval { require $path; }; + } + if ($@) { + my $error = $@; + require Carp; + Carp::carp($error); + } + } +} + +sub unimport { + my $callpkg = caller; + + no strict 'refs'; + + for my $exported (qw( AUTOLOAD )) { + my $symname = $callpkg . '::' . $exported; + undef *{ $symname } if \&{ $symname } == \&{ $exported }; + *{ $symname } = \&{ $symname }; + } +} + +1; + +__END__ + +=head1 NAME + +AutoLoader - load subroutines only on demand + +=head1 SYNOPSIS + + package Foo; + use AutoLoader 'AUTOLOAD'; # import the default AUTOLOAD subroutine + + package Bar; + use AutoLoader; # don't import AUTOLOAD, define our own + sub AUTOLOAD { + ... + $AutoLoader::AUTOLOAD = "..."; + goto &AutoLoader::AUTOLOAD; + } + +=head1 DESCRIPTION + +The B module works with the B module and the +C<__END__> token to defer the loading of some subroutines until they are +used rather than loading them all at once. + +To use B, the author of a module has to place the +definitions of subroutines to be autoloaded after an C<__END__> token. +(See L.) The B module can then be run manually to +extract the definitions into individual files F. + +B implements an AUTOLOAD subroutine. When an undefined +subroutine in is called in a client module of B, +B's AUTOLOAD subroutine attempts to locate the subroutine in a +file with a name related to the location of the file from which the +client module was read. As an example, if F is located in +F, B will look for perl +subroutines B in F, where +the C<.al> file has the same name as the subroutine, sans package. If +such a file exists, AUTOLOAD will read and evaluate it, +thus (presumably) defining the needed subroutine. AUTOLOAD will then +C the newly defined subroutine. + +Once this process completes for a given function, it is defined, so +future calls to the subroutine will bypass the AUTOLOAD mechanism. + +=head2 Subroutine Stubs + +In order for object method lookup and/or prototype checking to operate +correctly even when methods have not yet been defined it is necessary to +"forward declare" each subroutine (as in C). See +L. Such forward declaration creates "subroutine +stubs", which are place holders with no code. + +The AutoSplit and B modules automate the creation of forward +declarations. The AutoSplit module creates an 'index' file containing +forward declarations of all the AutoSplit subroutines. When the +AutoLoader module is 'use'd it loads these declarations into its callers +package. + +Because of this mechanism it is important that B is always +Cd and not Cd. + +=head2 Using B's AUTOLOAD Subroutine + +In order to use B's AUTOLOAD subroutine you I +explicitly import it: + + use AutoLoader 'AUTOLOAD'; + +=head2 Overriding B's AUTOLOAD Subroutine + +Some modules, mainly extensions, provide their own AUTOLOAD subroutines. +They typically need to check for some special cases (such as constants) +and then fallback to B's AUTOLOAD for the rest. + +Such modules should I import B's AUTOLOAD subroutine. +Instead, they should define their own AUTOLOAD subroutines along these +lines: + + use AutoLoader; + use Carp; + + sub AUTOLOAD { + my $sub = $AUTOLOAD; + (my $constname = $sub) =~ s/.*:://; + my $val = constant($constname, @_ ? $_[0] : 0); + if ($! != 0) { + if ($! =~ /Invalid/ || $!{EINVAL}) { + $AutoLoader::AUTOLOAD = $sub; + goto &AutoLoader::AUTOLOAD; + } + else { + croak "Your vendor has not defined constant $constname"; + } + } + *$sub = sub { $val }; # same as: eval "sub $sub { $val }"; + goto &$sub; + } + +If any module's own AUTOLOAD subroutine has no need to fallback to the +AutoLoader's AUTOLOAD subroutine (because it doesn't have any AutoSplit +subroutines), then that module should not use B at all. + +=head2 Package Lexicals + +Package lexicals declared with C in the main block of a package +using B will not be visible to auto-loaded subroutines, due to +the fact that the given scope ends at the C<__END__> marker. A module +using such variables as package globals will not work properly under the +B. + +The C pragma (see L) may be used in such +situations as an alternative to explicitly qualifying all globals with +the package namespace. Variables pre-declared with this pragma will be +visible to any autoloaded routines (but will not be invisible outside +the package, unfortunately). + +=head2 Not Using AutoLoader + +You can stop using AutoLoader by simply + + no AutoLoader; + +=head2 B vs. B + +The B is similar in purpose to B: both delay the +loading of subroutines. + +B uses the C<__DATA__> marker rather than C<__END__>. +While this avoids the use of a hierarchy of disk files and the +associated open/close for each routine loaded, B suffers a +startup speed disadvantage in the one-time parsing of the lines after +C<__DATA__>, after which routines are cached. B can also +handle multiple packages in a file. + +B only reads code as it is requested, and in many cases +should be faster, but requires a mechanism like B be used to +create the individual files. L will invoke +B automatically if B is used in a module source +file. + +=head2 Forcing AutoLoader to Load a Function + +Sometimes, it can be necessary or useful to make sure that a certain +function is fully loaded by AutoLoader. This is the case, for example, +when you need to wrap a function to inject debugging code. It is also +helpful to force early loading of code before forking to make use of +copy-on-write as much as possible. + +Starting with AutoLoader 5.73, you can call the +C function with the fully-qualified name of +the function to load from its F<.al> file. The behaviour is exactly +the same as if you called the function, triggering the regular +C mechanism, but it does not actually execute the +autoloaded function. + +=head1 CAVEATS + +AutoLoaders prior to Perl 5.002 had a slightly different interface. Any +old modules which use B should be changed to the new calling +style. Typically this just means changing a require to a use, adding +the explicit C<'AUTOLOAD'> import if needed, and removing B +from C<@ISA>. + +On systems with restrictions on file name length, the file corresponding +to a subroutine may have a shorter name that the routine itself. This +can lead to conflicting file names. The I package warns of +these potential conflicts when used to split a module. + +AutoLoader may fail to find the autosplit files (or even find the wrong +ones) in cases where C<@INC> contains relative paths, B the program +does C. + +=head1 SEE ALSO + +L - an autoloader that doesn't use external files. + +=head1 AUTHOR + +C is maintained by the perl5-porters. Please direct +any questions to the canonical mailing list. Anything that +is applicable to the CPAN release can be sent to its maintainer, +though. + +Author and Maintainer: The Perl5-Porters + +Maintainer of the CPAN release: Steffen Mueller + +=head1 COPYRIGHT AND LICENSE + +This package has been part of the perl core since the first release +of perl5. It has been released separately to CPAN so older installations +can benefit from bug fixes. + +This package has the same copyright and license as the perl core: + + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2011, 2012, 2013 + by Larry Wall and others + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or + + b) the "Artistic License" which comes with this Kit. + + 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 either + the GNU General Public License or the Artistic License for more details. + + You should have received a copy of the Artistic License with this + Kit, in the file named "Artistic". If not, I'll be glad to provide one. + + You should also have received a copy of the GNU General Public License + along with this program in the file named "Copying". If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA or visit their web page on the internet at + http://www.gnu.org/copyleft/gpl.html. + + For those of you that choose to use the GNU General Public License, + my interpretation of the GNU General Public License is that no Perl + script falls under the terms of the GPL unless you explicitly put + said script under the terms of the GPL yourself. Furthermore, any + object code linked with perl does not automatically fall under the + terms of the GPL, provided such object code only adds definitions + of subroutines and variables, and does not otherwise impair the + resulting interpreter from executing any standard Perl script. I + consider linking in C subroutines in this manner to be the moral + equivalent of defining subroutines in the Perl language itself. You + may sell such an object file as proprietary provided that you provide + or offer to provide the Perl source, as specified by the GNU General + Public License. (This is merely an alternate way of specifying input + to the program.) You may also sell a binary produced by the dumping of + a running Perl script that belongs to you, provided that you provide or + offer to provide the Perl source as specified by the GPL. (The + fact that a Perl interpreter and your code are in the same binary file + is, in this case, a form of mere aggregation.) This is my interpretation + of the GPL. If you still have concerns or difficulties understanding + my intent, feel free to contact me. Of course, the Artistic License + spells all this out for your protection, so you may prefer to use that. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/AutoSplit.pm b/data/miniconda3/lib/perl5/core_perl/AutoSplit.pm new file mode 100644 index 0000000000000000000000000000000000000000..c093f2dd24ba841f3bf2cbfe401c56a0c60942f6 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/AutoSplit.pm @@ -0,0 +1,592 @@ +package AutoSplit; + +use Exporter (); +use Config qw(%Config); +use File::Basename (); +use File::Path qw(mkpath); +use File::Spec::Functions qw(curdir catfile catdir); +use strict; +our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Verbose, $Keep, $Maxlen, + $CheckForAutoloader, $CheckModTime); + +$VERSION = "1.06"; +@ISA = qw(Exporter); +@EXPORT = qw(&autosplit &autosplit_lib_modules); +@EXPORT_OK = qw($Verbose $Keep $Maxlen $CheckForAutoloader $CheckModTime); + +=head1 NAME + +AutoSplit - split a package for autoloading + +=head1 SYNOPSIS + + autosplit($file, $dir, $keep, $check, $modtime); + + autosplit_lib_modules(@modules); + +=head1 DESCRIPTION + +This function will split up your program into files that the AutoLoader +module can handle. It is used by both the standard perl libraries and by +the MakeMaker utility, to automatically configure libraries for autoloading. + +The C interface splits the specified file into a hierarchy +rooted at the directory C<$dir>. It creates directories as needed to reflect +class hierarchy, and creates the file F. This file acts as +both forward declaration of all package routines, and as timestamp for the +last update of the hierarchy. + +The remaining three arguments to C govern other options to +the autosplitter. + +=over 2 + +=item $keep + +If the third argument, I<$keep>, is false, then any +pre-existing C<*.al> files in the autoload directory are removed if +they are no longer part of the module (obsoleted functions). +$keep defaults to 0. + +=item $check + +The +fourth argument, I<$check>, instructs C to check the module +currently being split to ensure that it includes a C +specification for the AutoLoader module, and skips the module if +AutoLoader is not detected. +$check defaults to 1. + +=item $modtime + +Lastly, the I<$modtime> argument specifies +that C is to check the modification time of the module +against that of the C file, and only split the module if +it is newer. +$modtime defaults to 1. + +=back + +Typical use of AutoSplit in the perl MakeMaker utility is via the command-line +with: + + perl -e 'use AutoSplit; autosplit($ARGV[0], $ARGV[1], 0, 1, 1)' + +Defined as a Make macro, it is invoked with file and directory arguments; +C will split the specified file into the specified directory and +delete obsolete C<.al> files, after checking first that the module does use +the AutoLoader, and ensuring that the module is not already currently split +in its current form (the modtime test). + +The C form is used in the building of perl. It takes +as input a list of files (modules) that are assumed to reside in a directory +B relative to the current directory. Each file is sent to the +autosplitter one at a time, to be split into the directory B. + +In both usages of the autosplitter, only subroutines defined following the +perl I<__END__> token are split out into separate files. Some +routines may be placed prior to this marker to force their immediate loading +and parsing. + +=head2 Multiple packages + +As of version 1.01 of the AutoSplit module it is possible to have +multiple packages within a single file. Both of the following cases +are supported: + + package NAME; + __END__ + sub AAA { ... } + package NAME::option1; + sub BBB { ... } + package NAME::option2; + sub BBB { ... } + + package NAME; + __END__ + sub AAA { ... } + sub NAME::option1::BBB { ... } + sub NAME::option2::BBB { ... } + +=head1 DIAGNOSTICS + +C will inform the user if it is necessary to create the +top-level directory specified in the invocation. It is preferred that +the script or installation process that invokes C have +created the full directory path ahead of time. This warning may +indicate that the module is being split into an incorrect path. + +C will warn the user of all subroutines whose name causes +potential file naming conflicts on machines with drastically limited +(8 characters or less) file name length. Since the subroutine name is +used as the file name, these warnings can aid in portability to such +systems. + +Warnings are issued and the file skipped if C cannot locate +either the I<__END__> marker or a "package Name;"-style specification. + +C will also emit general diagnostics for inability to +create directories or files. + +=head1 AUTHOR + +C is maintained by the perl5-porters. Please direct +any questions to the canonical mailing list. Anything that +is applicable to the CPAN release can be sent to its maintainer, +though. + +Author and Maintainer: The Perl5-Porters + +Maintainer of the CPAN release: Steffen Mueller + +=head1 COPYRIGHT AND LICENSE + +This package has been part of the perl core since the first release +of perl5. It has been released separately to CPAN so older installations +can benefit from bug fixes. + +This package has the same copyright and license as the perl core: + + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + by Larry Wall and others + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or + + b) the "Artistic License" which comes with this Kit. + + 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 either + the GNU General Public License or the Artistic License for more details. + + You should have received a copy of the Artistic License with this + Kit, in the file named "Artistic". If not, I'll be glad to provide one. + + You should also have received a copy of the GNU General Public License + along with this program in the file named "Copying". If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307, USA or visit their web page on the internet at + http://www.gnu.org/copyleft/gpl.html. + + For those of you that choose to use the GNU General Public License, + my interpretation of the GNU General Public License is that no Perl + script falls under the terms of the GPL unless you explicitly put + said script under the terms of the GPL yourself. Furthermore, any + object code linked with perl does not automatically fall under the + terms of the GPL, provided such object code only adds definitions + of subroutines and variables, and does not otherwise impair the + resulting interpreter from executing any standard Perl script. I + consider linking in C subroutines in this manner to be the moral + equivalent of defining subroutines in the Perl language itself. You + may sell such an object file as proprietary provided that you provide + or offer to provide the Perl source, as specified by the GNU General + Public License. (This is merely an alternate way of specifying input + to the program.) You may also sell a binary produced by the dumping of + a running Perl script that belongs to you, provided that you provide or + offer to provide the Perl source as specified by the GPL. (The + fact that a Perl interpreter and your code are in the same binary file + is, in this case, a form of mere aggregation.) This is my interpretation + of the GPL. If you still have concerns or difficulties understanding + my intent, feel free to contact me. Of course, the Artistic License + spells all this out for your protection, so you may prefer to use that. + +=cut + +# for portability warn about names longer than $maxlen +$Maxlen = 8; # 8 for dos, 11 (14-".al") for SYSVR3 +$Verbose = 1; # 0=none, 1=minimal, 2=list .al files +$Keep = 0; +$CheckForAutoloader = 1; +$CheckModTime = 1; + +my $IndexFile = "autosplit.ix"; # file also serves as timestamp +my $maxflen = 255; +$maxflen = 14 if $Config{'d_flexfnam'} ne 'define'; +if (defined (&Dos::UseLFN)) { + $maxflen = Dos::UseLFN() ? 255 : 11; +} +my $Is_VMS = ($^O eq 'VMS'); + +# allow checking for valid ': attrlist' attachments. +# extra jugglery required to support both 5.8 and 5.9/5.10 features +# (support for 5.8 required for cross-compiling environments) + +my $attr_list = + $] >= 5.009005 ? + eval <<'__QR__' + qr{ + \s* : \s* + (?: + # one attribute + (?> # no backtrack + (?! \d) \w+ + (? \( (?: [^()]++ | (?&nested)++ )*+ \) ) ? + ) + (?: \s* : \s* | \s+ (?! :) ) + )* + }x +__QR__ + : + do { + # In pre-5.9.5 world we have to do dirty tricks. + # (we use 'our' rather than 'my' here, due to the rather complex and buggy + # behaviour of lexicals with qr// and (??{$lex}) ) + our $trick1; # yes, cannot our and assign at the same time. + $trick1 = qr{ \( (?: (?> [^()]+ ) | (??{ $trick1 }) )* \) }x; + our $trick2 = qr{ (?> (?! \d) \w+ (?:$trick1)? ) (?:\s*\:\s*|\s+(?!\:)) }x; + qr{ \s* : \s* (?: $trick2 )* }x; + }; + +sub autosplit{ + my($file, $autodir, $keep, $ckal, $ckmt) = @_; + # $file - the perl source file to be split (after __END__) + # $autodir - the ".../auto" dir below which to write split subs + # Handle optional flags: + $keep = $Keep unless defined $keep; + $ckal = $CheckForAutoloader unless defined $ckal; + $ckmt = $CheckModTime unless defined $ckmt; + autosplit_file($file, $autodir, $keep, $ckal, $ckmt); +} + +sub carp{ + require Carp; + goto &Carp::carp; +} + +# This function is used during perl building/installation +# ./miniperl -e 'use AutoSplit; autosplit_lib_modules(@ARGV)' ... + +sub autosplit_lib_modules { + my(@modules) = @_; # list of Module names + local $_; # Avoid clobber. + while (defined($_ = shift @modules)) { + while (m#([^:]+)::([^:].*)#) { # in case specified as ABC::XYZ + $_ = catfile($1, $2); + } + s|\\|/|g; # bug in ksh OS/2 + s#^lib/##s; # incase specified as lib/*.pm + my($lib) = catfile(curdir(), "lib"); + if ($Is_VMS) { # may need to convert VMS-style filespecs + $lib =~ s#^\[\]#.\/#; + } + s#^$lib\W+##s; # incase specified as ./lib/*.pm + if ($Is_VMS && /[:>\]]/) { # may need to convert VMS-style filespecs + my ($dir,$name) = (/(.*])(.*)/s); + $dir =~ s/.*lib[\.\]]//s; + $dir =~ s#[\.\]]#/#g; + $_ = $dir . $name; + } + autosplit_file(catfile($lib, $_), catfile($lib, "auto"), + $Keep, $CheckForAutoloader, $CheckModTime); + } + 0; +} + + +# private functions + +my $self_mod_time = (stat __FILE__)[9]; + +sub autosplit_file { + my($filename, $autodir, $keep, $check_for_autoloader, $check_mod_time) + = @_; + my(@outfiles); + local($_); + local($/) = "\n"; + + # where to write output files + $autodir ||= catfile(curdir(), "lib", "auto"); + if ($Is_VMS) { + ($autodir = VMS::Filespec::unixpath($autodir)) =~ s|/\z||; + $filename = VMS::Filespec::unixify($filename); # may have dirs + } + unless (-d $autodir){ + mkpath($autodir,0,0755); + # We should never need to create the auto dir + # here. installperl (or similar) should have done + # it. Expecting it to exist is a valuable sanity check against + # autosplitting into some random directory by mistake. + print "Warning: AutoSplit had to create top-level " . + "$autodir unexpectedly.\n"; + } + + # allow just a package name to be used + $filename .= ".pm" unless ($filename =~ m/\.pm\z/); + + open(my $in, "<$filename") or die "AutoSplit: Can't open $filename: $!\n"; + my($pm_mod_time) = (stat($filename))[9]; + my($autoloader_seen) = 0; + my($in_pod) = 0; + my($def_package,$last_package,$this_package,$fnr); + while (<$in>) { + # Skip pod text. + $fnr++; + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); + next if /^\s*#/; + + # record last package name seen + $def_package = $1 if (m/^\s*package\s+([\w:]+)\s*;/); + ++$autoloader_seen if m/^\s*(use|require)\s+AutoLoader\b/; + ++$autoloader_seen if m/\bISA\s*=.*\bAutoLoader\b/; + last if /^__END__/; + } + if ($check_for_autoloader && !$autoloader_seen){ + print "AutoSplit skipped $filename: no AutoLoader used\n" + if ($Verbose>=2); + return 0; + } + $_ or die "Can't find __END__ in $filename\n"; + + $def_package or die "Can't find 'package Name;' in $filename\n"; + + my($modpname) = _modpname($def_package); + + # this _has_ to match so we have a reasonable timestamp file + die "Package $def_package ($modpname.pm) does not ". + "match filename $filename" + unless ($filename =~ m/\Q$modpname.pm\E$/ or + ($^O eq 'dos') or ($^O eq 'MSWin32') or ($^O eq 'NetWare') or + $Is_VMS && $filename =~ m/$modpname.pm/i); + + my($al_idx_file) = catfile($autodir, $modpname, $IndexFile); + + if ($check_mod_time){ + my($al_ts_time) = (stat("$al_idx_file"))[9] || 1; + if ($al_ts_time >= $pm_mod_time and + $al_ts_time >= $self_mod_time){ + print "AutoSplit skipped ($al_idx_file newer than $filename)\n" + if ($Verbose >= 2); + return undef; # one undef, not a list + } + } + + my($modnamedir) = catdir($autodir, $modpname); + print "AutoSplitting $filename ($modnamedir)\n" + if $Verbose; + + unless (-d $modnamedir){ + mkpath($modnamedir,0,0777); + } + + # We must try to deal with some SVR3 systems with a limit of 14 + # characters for file names. Sadly we *cannot* simply truncate all + # file names to 14 characters on these systems because we *must* + # create filenames which exactly match the names used by AutoLoader.pm. + # This is a problem because some systems silently truncate the file + # names while others treat long file names as an error. + + my $Is83 = $maxflen==11; # plain, case INSENSITIVE dos filenames + + my(@subnames, $subname, %proto, %package); + my @cache = (); + my $caching = 1; + $last_package = ''; + my $out; + while (<$in>) { + $fnr++; + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); + # the following (tempting) old coding gives big troubles if a + # cut is forgotten at EOF: + # next if /^=\w/ .. /^=cut/; + if (/^package\s+([\w:]+)\s*;/) { + $this_package = $def_package = $1; + } + + if (/^sub\s+([\w:]+)(\s*(?:\(.*?\))?(?:$attr_list)?)/) { + print $out "# end of $last_package\::$subname\n1;\n" + if $last_package; + $subname = $1; + my $proto = $2 || ''; + if ($subname =~ s/(.*):://){ + $this_package = $1; + } else { + $this_package = $def_package; + } + my $fq_subname = "$this_package\::$subname"; + $package{$fq_subname} = $this_package; + $proto{$fq_subname} = $proto; + push(@subnames, $fq_subname); + my($lname, $sname) = ($subname, substr($subname,0,$maxflen-3)); + $modpname = _modpname($this_package); + my($modnamedir) = catdir($autodir, $modpname); + mkpath($modnamedir,0,0777); + my($lpath) = catfile($modnamedir, "$lname.al"); + my($spath) = catfile($modnamedir, "$sname.al"); + my $path; + + if (!$Is83 and open($out, ">$lpath")){ + $path=$lpath; + print " writing $lpath\n" if ($Verbose>=2); + } else { + open($out, ">$spath") or die "Can't create $spath: $!\n"; + $path=$spath; + print " writing $spath (with truncated name)\n" + if ($Verbose>=1); + } + push(@outfiles, $path); + my $lineno = $fnr - @cache; + print $out < lc($_) } @outfiles; + } else { + @outfiles{@outfiles} = @outfiles; + } + my(%outdirs,@outdirs); + for (@outfiles) { + $outdirs{File::Basename::dirname($_)}||=1; + } + for my $dir (keys %outdirs) { + opendir(my $outdir,$dir); + foreach (sort readdir($outdir)){ + next unless /\.al\z/; + my($file) = catfile($dir, $_); + $file = lc $file if $Is83 or $Is_VMS; + next if $outfiles{$file}; + print " deleting $file\n" if ($Verbose>=2); + my($deleted,$thistime); # catch all versions on VMS + do { $deleted += ($thistime = unlink $file) } while ($thistime); + carp ("Unable to delete $file: $!") unless $deleted; + } + closedir($outdir); + } + } + + open(my $ts,">$al_idx_file") or + carp ("AutoSplit: unable to create timestamp file ($al_idx_file): $!"); + print $ts "# Index created by AutoSplit for $filename\n"; + print $ts "# (file acts as timestamp)\n"; + $last_package = ''; + for my $fqs (@subnames) { + my($subname) = $fqs; + $subname =~ s/.*:://; + print $ts "package $package{$fqs};\n" + unless $last_package eq $package{$fqs}; + print $ts "sub $subname $proto{$fqs};\n"; + $last_package = $package{$fqs}; + } + print $ts "1;\n"; + close($ts); + + _check_unique($filename, $Maxlen, 1, @outfiles); + + @outfiles; +} + +sub _modpname ($) { + my($package) = @_; + my $modpname = $package; + if ($^O eq 'MSWin32') { + $modpname =~ s#::#\\#g; + } else { + my @modpnames = (); + while ($modpname =~ m#(.*?[^:])::([^:].*)#) { + push @modpnames, $1; + $modpname = $2; + } + $modpname = catfile(@modpnames, $modpname); + } + if ($Is_VMS) { + $modpname = VMS::Filespec::unixify($modpname); # may have dirs + } + $modpname; +} + +sub _check_unique { + my($filename, $maxlen, $warn, @outfiles) = @_; + my(%notuniq) = (); + my(%shorts) = (); + my(@toolong) = grep( + length(File::Basename::basename($_)) + > $maxlen, + @outfiles + ); + + foreach (@toolong){ + my($dir) = File::Basename::dirname($_); + my($file) = File::Basename::basename($_); + my($trunc) = substr($file,0,$maxlen); + $notuniq{$dir}{$trunc} = 1 if $shorts{$dir}{$trunc}; + $shorts{$dir}{$trunc} = $shorts{$dir}{$trunc} ? + "$shorts{$dir}{$trunc}, $file" : $file; + } + if (%notuniq && $warn){ + print "$filename: some names are not unique when " . + "truncated to $maxlen characters:\n"; + foreach my $dir (sort keys %notuniq){ + print " directory $dir:\n"; + foreach my $trunc (sort keys %{$notuniq{$dir}}) { + print " $shorts{$dir}{$trunc} truncate to $trunc\n"; + } + } + } +} + +1; +__END__ + +# test functions so AutoSplit.pm can be applied to itself: +sub test1 ($) { "test 1\n"; } +sub test2 ($$) { "test 2\n"; } +sub test3 ($$$) { "test 3\n"; } +sub testtesttesttest4_1 { "test 4\n"; } +sub testtesttesttest4_2 { "duplicate test 4\n"; } +sub Just::Another::test5 { "another test 5\n"; } +sub test6 { return join ":", __FILE__,__LINE__; } +package Yet::Another::AutoSplit; +sub testtesttesttest4_1 ($) { "another test 4\n"; } +sub testtesttesttest4_2 ($$) { "another duplicate test 4\n"; } +package Yet::More::Attributes; +sub test_a1 ($) : locked :locked { 1; } +sub test_a2 : locked { 1; } diff --git a/data/miniconda3/lib/perl5/core_perl/B/Deparse.pm b/data/miniconda3/lib/perl5/core_perl/B/Deparse.pm new file mode 100644 index 0000000000000000000000000000000000000000..7bf1cd51c366e2731f18a11c4bf85147b5682271 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/B/Deparse.pm @@ -0,0 +1,6990 @@ +# B::Deparse.pm +# Copyright (c) 1998-2000, 2002, 2003, 2004, 2005, 2006 Stephen McCamant. +# All rights reserved. +# This module is free software; you can redistribute and/or modify +# it under the same terms as Perl itself. + +# This is based on the module of the same name by Malcolm Beattie, +# but essentially none of his code remains. + +package B::Deparse; +use Carp; +use B qw(class main_root main_start main_cv svref_2object opnumber perlstring + OPf_WANT OPf_WANT_VOID OPf_WANT_SCALAR OPf_WANT_LIST + OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL OPf_MOD OPf_PARENS + OPpLVAL_INTRO OPpOUR_INTRO OPpENTERSUB_AMPER OPpSLICE OPpKVSLICE + OPpCONST_BARE + OPpTRANS_SQUASH OPpTRANS_DELETE OPpTRANS_COMPLEMENT OPpTARGET_MY + OPpEXISTS_SUB OPpSORT_NUMERIC OPpSORT_INTEGER OPpREPEAT_DOLIST + OPpSORT_REVERSE OPpMULTIDEREF_EXISTS OPpMULTIDEREF_DELETE + OPpSPLIT_ASSIGN OPpSPLIT_LEX + OPpPADHV_ISKEYS OPpRV2HV_ISKEYS + OPpCONCAT_NESTED + OPpMULTICONCAT_APPEND OPpMULTICONCAT_STRINGIFY OPpMULTICONCAT_FAKE + OPpTRUEBOOL OPpINDEX_BOOLNEG + SVf_IOK SVf_NOK SVf_ROK SVf_POK SVpad_OUR SVf_FAKE SVs_RMG SVs_SMG + SVs_PADTMP SVpad_TYPED + CVf_METHOD CVf_LVALUE + PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE + PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED PMf_EXTENDED_MORE + PADNAMEt_OUTER + MDEREF_reload + MDEREF_AV_pop_rv2av_aelem + MDEREF_AV_gvsv_vivify_rv2av_aelem + MDEREF_AV_padsv_vivify_rv2av_aelem + MDEREF_AV_vivify_rv2av_aelem + MDEREF_AV_padav_aelem + MDEREF_AV_gvav_aelem + MDEREF_HV_pop_rv2hv_helem + MDEREF_HV_gvsv_vivify_rv2hv_helem + MDEREF_HV_padsv_vivify_rv2hv_helem + MDEREF_HV_vivify_rv2hv_helem + MDEREF_HV_padhv_helem + MDEREF_HV_gvhv_helem + MDEREF_ACTION_MASK + MDEREF_INDEX_none + MDEREF_INDEX_const + MDEREF_INDEX_padsv + MDEREF_INDEX_gvsv + MDEREF_INDEX_MASK + MDEREF_FLAG_last + MDEREF_MASK + MDEREF_SHIFT + ); + +$VERSION = '1.54'; +use strict; +our $AUTOLOAD; +use warnings (); +require feature; + +use Config; + +BEGIN { + # List version-specific constants here. + # Easiest way to keep this code portable between version looks to + # be to fake up a dummy constant that will never actually be true. + foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED OPpCONST_NOVER + OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE + PMf_CHARSET PMf_KEEPCOPY PMf_NOCAPTURE CVf_ANONCONST + CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST + PMf_NONDESTRUCT OPpEVAL_BYTES + OPpLVREF_TYPE OPpLVREF_SV OPpLVREF_AV OPpLVREF_HV + OPpLVREF_CV OPpLVREF_ELEM SVpad_STATE)) { + eval { B->import($_) }; + no strict 'refs'; + *{$_} = sub () {0} unless *{$_}{CODE}; + } +} + +# Todo: +# (See also BUGS section at the end of this file) +# +# - finish tr/// changes +# - add option for even more parens (generalize \&foo change) +# - left/right context +# - copy comments (look at real text with $^P?) +# - avoid semis in one-statement blocks +# - associativity of &&=, ||=, ?: +# - ',' => '=>' (auto-unquote?) +# - break long lines ("\r" as discretionary break?) +# - configurable syntax highlighting: ANSI color, HTML, TeX, etc. +# - more style options: brace style, hex vs. octal, quotes, ... +# - print big ints as hex/octal instead of decimal (heuristic?) +# - handle 'my $x if 0'? +# - version using op_next instead of op_first/sibling? +# - avoid string copies (pass arrays, one big join?) +# - here-docs? + +# Current test.deparse failures +# comp/hints 6 - location of BEGIN blocks wrt. block openings +# run/switchI 1 - missing -I switches entirely +# perl -Ifoo -e 'print @INC' +# op/caller 2 - warning mask propagates backwards before warnings::register +# 'use warnings; BEGIN {${^WARNING_BITS} eq "U"x12;} use warnings::register' +# op/getpid 2 - can't assign to shared my() declaration (threads only) +# 'my $x : shared = 5' +# op/override 7 - parens on overridden require change v-string interpretation +# 'BEGIN{*CORE::GLOBAL::require=sub {}} require v5.6' +# c.f. 'BEGIN { *f = sub {0} }; f 2' +# op/pat 774 - losing Unicode-ness of Latin1-only strings +# 'use charnames ":short"; $x="\N{latin:a with acute}"' +# op/recurse 12 - missing parens on recursive call makes it look like method +# 'sub f { f($x) }' +# op/subst 90 - inconsistent handling of utf8 under "use utf8" +# op/taint 29 - "use re 'taint'" deparsed in the wrong place wrt. block open +# op/tiehandle compile - "use strict" deparsed in the wrong place +# uni/tr_ several +# ext/B/t/xref 11 - line numbers when we add newlines to one-line subs +# ext/Data/Dumper/t/dumper compile +# ext/DB_file/several +# ext/Encode/several +# ext/Ernno/Errno warnings +# ext/IO/lib/IO/t/io_sel 23 +# ext/PerlIO/t/encoding compile +# ext/POSIX/t/posix 6 +# ext/Socket/Socket 8 +# ext/Storable/t/croak compile +# lib/Attribute/Handlers/t/multi compile +# lib/bignum/ several +# lib/charnames 35 +# lib/constant 32 +# lib/English 40 +# lib/ExtUtils/t/bytes 4 +# lib/File/DosGlob compile +# lib/Filter/Simple/t/data 1 +# lib/Math/BigInt/t/constant 1 +# lib/Net/t/config Deparse-warning +# lib/overload compile +# lib/Switch/ several +# lib/Symbol 4 +# lib/Test/Simple several +# lib/Term/Complete +# lib/Tie/File/t/29_downcopy 5 +# lib/vars 22 + +# Object fields: +# +# in_coderef2text: +# True when deparsing via $deparse->coderef2text; false when deparsing the +# main program. +# +# avoid_local: +# (local($a), local($b)) and local($a, $b) have the same internal +# representation but the short form looks better. We notice we can +# use a large-scale local when checking the list, but need to prevent +# individual locals too. This hash holds the addresses of OPs that +# have already had their local-ness accounted for. The same thing +# is done with my(). +# +# curcv: +# CV for current sub (or main program) being deparsed +# +# curcvlex: +# Cached hash of lexical variables for curcv: keys are +# names prefixed with "m" or "o" (representing my/our), and +# each value is an array with two elements indicating the cop_seq +# of scopes in which a var of that name is valid and a third ele- +# ment referencing the pad name. +# +# curcop: +# COP for statement being deparsed +# +# curstash: +# name of the current package for deparsed code +# +# subs_todo: +# array of [cop_seq, CV, is_format?, name] for subs and formats we still +# want to deparse. The fourth element is a pad name thingy for lexical +# subs or a string for special blocks. For other subs, it is undef. For +# lexical subs, CV may be undef, indicating a stub declaration. +# +# protos_todo: +# as above, but [name, prototype] for subs that never got a GV +# +# subs_done, forms_done: +# keys are addresses of GVs for subs and formats we've already +# deparsed (or at least put into subs_todo) +# +# subs_declared +# keys are names of subs for which we've printed declarations. +# That means we can omit parentheses from the arguments. It also means we +# need to put CORE:: on core functions of the same name. +# +# in_subst_repl +# True when deparsing the replacement part of a substitution. +# +# in_refgen +# True when deparsing the argument to \. +# +# parens: -p +# linenums: -l +# unquote: -q +# cuddle: ' ' or '\n', depending on -sC +# indent_size: -si +# use_tabs: -sT +# ex_const: -sv + +# A little explanation of how precedence contexts and associativity +# work: +# +# deparse() calls each per-op subroutine with an argument $cx (short +# for context, but not the same as the cx* in the perl core), which is +# a number describing the op's parents in terms of precedence, whether +# they're inside an expression or at statement level, etc. (see +# chart below). When ops with children call deparse on them, they pass +# along their precedence. Fractional values are used to implement +# associativity ('($x + $y) + $z' => '$x + $y + $y') and related +# parentheses hacks. The major disadvantage of this scheme is that +# it doesn't know about right sides and left sides, so say if you +# assign a listop to a variable, it can't tell it's allowed to leave +# the parens off the listop. + +# Precedences: +# 26 [TODO] inside interpolation context ("") +# 25 left terms and list operators (leftward) +# 24 left -> +# 23 nonassoc ++ -- +# 22 right ** +# 21 right ! ~ \ and unary + and - +# 20 left =~ !~ +# 19 left * / % x +# 18 left + - . +# 17 left << >> +# 16 nonassoc named unary operators +# 15 nonassoc < > <= >= lt gt le ge +# 14 nonassoc == != <=> eq ne cmp +# 13 left & +# 12 left | ^ +# 11 left && +# 10 left || +# 9 nonassoc .. ... +# 8 right ?: +# 7 right = += -= *= etc. +# 6 left , => +# 5 nonassoc list operators (rightward) +# 4 right not +# 3 left and +# 2 left or xor +# 1 statement modifiers +# 0.5 statements, but still print scopes as do { ... } +# 0 statement level +# -1 format body + +# Nonprinting characters with special meaning: +# \cS - steal parens (see maybe_parens_unop) +# \n - newline and indent +# \t - increase indent +# \b - decrease indent ('outdent') +# \f - flush left (no indent) +# \cK - kill following semicolon, if any + +# Semicolon handling: +# - Individual statements are not deparsed with trailing semicolons. +# (If necessary, \cK is tacked on to the end.) +# - Whatever code joins statements together or emits them (lineseq, +# scopeop, deparse_root) is responsible for adding semicolons where +# necessary. +# - use statements are deparsed with trailing semicolons because they are +# immediately concatenated with the following statement. +# - indent() removes semicolons wherever it sees \cK. + + +BEGIN { for (qw[ const stringify rv2sv list glob pushmark null aelem + kvaslice kvhslice padsv argcheck + nextstate dbstate rv2av rv2hv helem custom ]) { + eval "sub OP_\U$_ () { " . opnumber($_) . "}" +}} + +# _pessimise_walk(): recursively walk the optree of a sub, +# possibly undoing optimisations along the way. + +sub DEBUG { 0 } + +sub _pessimise_walk { + my ($self, $startop) = @_; + + return unless $$startop; + my ($op, $prevop); + for ($op = $startop; $$op; $prevop = $op, $op = $op->sibling) { + my $ppname = $op->name; + + # pessimisations start here + + if ($ppname eq "padrange") { + # remove PADRANGE: + # the original optimisation either (1) changed this: + # pushmark -> (various pad and list and null ops) -> the_rest + # or (2), for the = @_ case, changed this: + # pushmark -> gv[_] -> rv2av -> (pad stuff) -> the_rest + # into this: + # padrange ----------------------------------------> the_rest + # so we just need to convert the padrange back into a + # pushmark, and in case (1), set its op_next to op_sibling, + # which is the head of the original chain of optimised-away + # pad ops, or for (2), set it to sibling->first, which is + # the original gv[_]. + + $B::overlay->{$$op} = { + type => OP_PUSHMARK, + name => 'pushmark', + private => ($op->private & OPpLVAL_INTRO), + }; + } + + # pessimisations end here + + if (class($op) eq 'PMOP') { + if (ref($op->pmreplroot) + && ${$op->pmreplroot} + && $op->pmreplroot->isa( 'B::OP' )) + { + $self-> _pessimise_walk($op->pmreplroot); + } + + # pessimise any /(?{...})/ code blocks + my ($re, $cv); + my $code_list = $op->code_list; + if ($$code_list) { + $self->_pessimise_walk($code_list); + } + elsif (${$re = $op->pmregexp} && ${$cv = $re->qr_anoncv}) { + $code_list = $cv->ROOT # leavesub + ->first # qr + ->code_list; # list + $self->_pessimise_walk($code_list); + } + } + + if ($op->flags & OPf_KIDS) { + $self-> _pessimise_walk($op->first); + } + + } +} + + +# _pessimise_walk_exe(): recursively walk the op_next chain of a sub, +# possibly undoing optimisations along the way. + +sub _pessimise_walk_exe { + my ($self, $startop, $visited) = @_; + + no warnings 'recursion'; + + return unless $$startop; + return if $visited->{$$startop}; + my ($op, $prevop); + for ($op = $startop; $$op; $prevop = $op, $op = $op->next) { + last if $visited->{$$op}; + $visited->{$$op} = 1; + my $ppname = $op->name; + if ($ppname =~ + /^((and|d?or)(assign)?|(map|grep)while|range|cond_expr|once)$/ + # entertry is also a logop, but its op_other invariably points + # into the same chain as the main execution path, so we skip it + ) { + $self->_pessimise_walk_exe($op->other, $visited); + } + elsif ($ppname eq "subst") { + $self->_pessimise_walk_exe($op->pmreplstart, $visited); + } + elsif ($ppname =~ /^(enter(loop|iter))$/) { + # redoop and nextop will already be covered by the main block + # of the loop + $self->_pessimise_walk_exe($op->lastop, $visited); + } + + # pessimisations start here + } +} + +# Go through an optree and "remove" some optimisations by using an +# overlay to selectively modify or un-null some ops. Deparsing in the +# absence of those optimisations is then easier. +# +# Note that older optimisations are not removed, as Deparse was already +# written to recognise them before the pessimise/overlay system was added. + +sub pessimise { + my ($self, $root, $start) = @_; + + no warnings 'recursion'; + # walk tree in root-to-branch order + $self->_pessimise_walk($root); + + my %visited; + # walk tree in execution order + $self->_pessimise_walk_exe($start, \%visited); +} + + +sub null { + my $op = shift; + return class($op) eq "NULL"; +} + + +# Add a CV to the list of subs that still need deparsing. + +sub todo { + my $self = shift; + my($cv, $is_form, $name) = @_; + my $cvfile = $cv->FILE//''; + return unless ($cvfile eq $0 || exists $self->{files}{$cvfile}); + my $seq; + if ($cv->OUTSIDE_SEQ) { + $seq = $cv->OUTSIDE_SEQ; + } elsif (!null($cv->START) and is_state($cv->START)) { + $seq = $cv->START->cop_seq; + } else { + $seq = 0; + } + my $stash = $cv->STASH; + if (class($stash) eq 'HV') { + $self->{packs}{$stash->NAME}++; + } + push @{$self->{'subs_todo'}}, [$seq, $cv, $is_form, $name]; +} + + +# Pop the next sub from the todo list and deparse it + +sub next_todo { + my $self = shift; + my $ent = shift @{$self->{'subs_todo'}}; + my ($seq, $cv, $is_form, $name) = @$ent; + + # any 'use strict; package foo' that should come before the sub + # declaration to sync with the first COP of the sub + my $pragmata = ''; + if ($cv and !null($cv->START) and is_state($cv->START)) { + $pragmata = $self->pragmata($cv->START); + } + + if (ref $name) { # lexical sub + # emit the sub. + my @text; + my $flags = $name->FLAGS; + push @text, + !$cv || $seq <= $name->COP_SEQ_RANGE_LOW + ? $self->keyword($flags & SVpad_OUR + ? "our" + : $flags & SVpad_STATE + ? "state" + : "my") . " " + : ""; + # XXX We would do $self->keyword("sub"), but ‘my CORE::sub’ + # doesn’t work and ‘my sub’ ignores a &sub in scope. I.e., + # we have a core bug here. + push @text, "sub " . substr $name->PVX, 1; + if ($cv) { + # my sub foo { } + push @text, " " . $self->deparse_sub($cv); + $text[-1] =~ s/ ;$/;/; + } + else { + # my sub foo; + push @text, ";\n"; + } + return $pragmata . join "", @text; + } + + my $gv = $cv->GV; + $name //= $self->gv_name($gv); + if ($is_form) { + return $pragmata . $self->keyword("format") . " $name =\n" + . $self->deparse_format($cv). "\n"; + } else { + my $use_dec; + if ($name eq "BEGIN") { + $use_dec = $self->begin_is_use($cv); + if (defined ($use_dec) and $self->{'expand'} < 5) { + return $pragmata if 0 == length($use_dec); + + # XXX bit of a hack: Test::More's use_ok() method + # builds a fake use statement which deparses as, e.g. + # use Net::Ping (@{$args[0];}); + # As well as being superfluous (the use_ok() is deparsed + # too) and ugly, it fails under use strict and otherwise + # makes use of a lexical var that's not in scope. + # So strip it out. + return $pragmata + if $use_dec =~ + m/ + \A + use \s \S+ \s \(\@\{ + ( + \s*\#line\ \d+\ \".*"\s* + )? + \$args\[0\];\}\); + \n + \Z + /x; + + $use_dec =~ s/^(use|no)\b/$self->keyword($1)/e; + } + } + my $l = ''; + if ($self->{'linenums'}) { + my $line = $gv->LINE; + my $file = $gv->FILE; + $l = "\n\f#line $line \"$file\"\n"; + } + my $p = ''; + my $stash; + if (class($cv->STASH) ne "SPECIAL") { + $stash = $cv->STASH->NAME; + if ($stash ne $self->{'curstash'}) { + $p = $self->keyword("package") . " $stash;\n"; + $name = "$self->{'curstash'}::$name" unless $name =~ /::/; + $self->{'curstash'} = $stash; + } + } + if ($use_dec) { + return "$pragmata$p$l$use_dec"; + } + if ( $name !~ /::/ and $self->lex_in_scope("&$name") + || $self->lex_in_scope("&$name", 1) ) + { + $name = "$self->{'curstash'}::$name"; + } elsif (defined $stash) { + $name =~ s/^\Q$stash\E::(?!\z|.*::)//; + } + my $ret = "$pragmata${p}${l}" . $self->keyword("sub") . " $name " + . $self->deparse_sub($cv); + $self->{'subs_declared'}{$name} = 1; + return $ret; + } +} + + +# Return a "use" declaration for this BEGIN block, if appropriate +sub begin_is_use { + my ($self, $cv) = @_; + my $root = $cv->ROOT; + local @$self{qw'curcv curcvlex'} = ($cv); + local $B::overlay = {}; + $self->pessimise($root, $cv->START); +#require B::Debug; +#B::walkoptree($cv->ROOT, "debug"); + my $lineseq = $root->first; + return if $lineseq->name ne "lineseq"; + + my $req_op = $lineseq->first->sibling; + return if $req_op->name ne "require"; + + # maybe it's C rather than C + return if ($req_op->first->name ne 'const'); + + my $module; + if ($req_op->first->private & OPpCONST_BARE) { + # Actually it should always be a bareword + $module = $self->const_sv($req_op->first)->PV; + $module =~ s[/][::]g; + $module =~ s/.pm$//; + } + else { + $module = $self->const($self->const_sv($req_op->first), 6); + } + + my $version; + my $version_op = $req_op->sibling; + return if class($version_op) eq "NULL"; + if ($version_op->name eq "lineseq") { + # We have a version parameter; skip nextstate & pushmark + my $constop = $version_op->first->next->next; + + return unless $self->const_sv($constop)->PV eq $module; + $constop = $constop->sibling; + $version = $self->const_sv($constop); + if (class($version) eq "IV") { + $version = $version->int_value; + } elsif (class($version) eq "NV") { + $version = $version->NV; + } elsif (class($version) ne "PVMG") { + # Includes PVIV and PVNV + $version = $version->PV; + } else { + # version specified as a v-string + $version = 'v'.join '.', map ord, split //, $version->PV; + } + $constop = $constop->sibling; + return if $constop->name ne "method_named"; + return if $self->meth_sv($constop)->PV ne "VERSION"; + } + + $lineseq = $version_op->sibling; + return if $lineseq->name ne "lineseq"; + my $entersub = $lineseq->first->sibling; + if ($entersub->name eq "stub") { + return "use $module $version ();\n" if defined $version; + return "use $module ();\n"; + } + return if $entersub->name ne "entersub"; + + # See if there are import arguments + my $args = ''; + + my $svop = $entersub->first->sibling; # Skip over pushmark + return unless $self->const_sv($svop)->PV eq $module; + + # Pull out the arguments + for ($svop=$svop->sibling; index($svop->name, "method_") != 0; + $svop = $svop->sibling) { + $args .= ", " if length($args); + $args .= $self->deparse($svop, 6); + } + + my $use = 'use'; + my $method_named = $svop; + return if $method_named->name ne "method_named"; + my $method_name = $self->meth_sv($method_named)->PV; + + if ($method_name eq "unimport") { + $use = 'no'; + } + + # Certain pragmas are dealt with using hint bits, + # so we ignore them here + if ($module eq 'strict' || $module eq 'integer' + || $module eq 'bytes' || $module eq 'warnings' + || $module eq 'feature') { + return ""; + } + + if (defined $version && length $args) { + return "$use $module $version ($args);\n"; + } elsif (defined $version) { + return "$use $module $version;\n"; + } elsif (length $args) { + return "$use $module ($args);\n"; + } else { + return "$use $module;\n"; + } +} + +sub stash_subs { + my ($self, $pack, $seen) = @_; + my (@ret, $stash); + if (!defined $pack) { + $pack = ''; + $stash = \%::; + } + else { + $pack =~ s/(::)?$/::/; + no strict 'refs'; + $stash = \%{"main::$pack"}; + } + return + if ($seen ||= {})->{ + $INC{"overload.pm"} ? overload::StrVal($stash) : $stash + }++; + my $stashobj = svref_2object($stash); + my %stash = $stashobj->ARRAY; + while (my ($key, $val) = each %stash) { + my $flags = $val->FLAGS; + if ($flags & SVf_ROK) { + # A reference. Dump this if it is a reference to a CV. If it + # is a constant acting as a proxy for a full subroutine, then + # we may or may not have to dump it. If some form of perl- + # space visible code must have created it, be it a use + # statement, or some direct symbol-table manipulation code that + # we will deparse, then we don’t want to dump it. If it is the + # result of a declaration like sub f () { 42 } then we *do* + # want to dump it. The only way to distinguish these seems + # to be the SVs_PADTMP flag on the constant, which is admit- + # tedly a hack. + my $class = class(my $referent = $val->RV); + if ($class eq "CV") { + $self->todo($referent, 0); + } elsif ( + $class !~ /^(AV|HV|CV|FM|IO|SPECIAL)\z/ + # A more robust way to write that would be this, but B does + # not provide the SVt_ constants: + # ($referent->FLAGS & B::SVTYPEMASK) < B::SVt_PVAV + and $referent->FLAGS & SVs_PADTMP + ) { + push @{$self->{'protos_todo'}}, [$pack . $key, $val]; + } + } elsif ($flags & (SVf_POK|SVf_IOK)) { + # Just a prototype. As an ugly but fairly effective way + # to find out if it belongs here is to see if the AUTOLOAD + # (if any) for the stash was defined in one of our files. + my $A = $stash{"AUTOLOAD"}; + if (defined ($A) && class($A) eq "GV" && defined($A->CV) + && class($A->CV) eq "CV") { + my $AF = $A->FILE; + next unless $AF eq $0 || exists $self->{'files'}{$AF}; + } + push @{$self->{'protos_todo'}}, + [$pack . $key, $flags & SVf_POK ? $val->PV: undef]; + } elsif (class($val) eq "GV") { + if (class(my $cv = $val->CV) ne "SPECIAL") { + next if $self->{'subs_done'}{$$val}++; + + # Ignore imposters (aliases etc) + my $name = $cv->NAME_HEK; + if(defined $name) { + # avoid using $cv->GV here because if the $val GV is + # an alias, CvGV() could upgrade the real stash entry + # from an RV to a GV + next unless $name eq $key; + next unless $$stashobj == ${$cv->STASH}; + } + else { + next if $$val != ${$cv->GV}; + } + + $self->todo($cv, 0); + } + if (class(my $cv = $val->FORM) ne "SPECIAL") { + next if $self->{'forms_done'}{$$val}++; + next if $$val != ${$cv->GV}; # Ignore imposters + $self->todo($cv, 1); + } + if (class($val->HV) ne "SPECIAL" && $key =~ /::$/) { + $self->stash_subs($pack . $key, $seen); + } + } + } +} + +sub print_protos { + my $self = shift; + my $ar; + my @ret; + foreach $ar (@{$self->{'protos_todo'}}) { + if (ref $ar->[1]) { + # Only print a constant if it occurs in the same package as a + # dumped sub. This is not perfect, but a heuristic that will + # hopefully work most of the time. Ideally we would use + # CvFILE, but a constant stub has no CvFILE. + my $pack = ($ar->[0] =~ /(.*)::/)[0]; + next if $pack and !$self->{packs}{$pack} + } + my $body = defined $ar->[1] + ? ref $ar->[1] + ? " () {\n " . $self->const($ar->[1]->RV,0) . ";\n}" + : " (". $ar->[1] . ");" + : ";"; + push @ret, "sub " . $ar->[0] . "$body\n"; + } + delete $self->{'protos_todo'}; + return @ret; +} + +sub style_opts { + my $self = shift; + my $opts = shift; + my $opt; + while (length($opt = substr($opts, 0, 1))) { + if ($opt eq "C") { + $self->{'cuddle'} = " "; + $opts = substr($opts, 1); + } elsif ($opt eq "i") { + $opts =~ s/^i(\d+)//; + $self->{'indent_size'} = $1; + } elsif ($opt eq "T") { + $self->{'use_tabs'} = 1; + $opts = substr($opts, 1); + } elsif ($opt eq "v") { + $opts =~ s/^v([^.]*)(.|$)//; + $self->{'ex_const'} = $1; + } + } +} + +sub new { + my $class = shift; + my $self = bless {}, $class; + $self->{'cuddle'} = "\n"; + $self->{'curcop'} = undef; + $self->{'curstash'} = "main"; + $self->{'ex_const'} = "'???'"; + $self->{'expand'} = 0; + $self->{'files'} = {}; + $self->{'packs'} = {}; + $self->{'indent_size'} = 4; + $self->{'linenums'} = 0; + $self->{'parens'} = 0; + $self->{'subs_todo'} = []; + $self->{'unquote'} = 0; + $self->{'use_dumper'} = 0; + $self->{'use_tabs'} = 0; + + $self->{'ambient_warnings'} = undef; # Assume no lexical warnings + $self->{'ambient_hints'} = 0; + $self->{'ambient_hinthash'} = undef; + $self->init(); + + while (my $arg = shift @_) { + if ($arg eq "-d") { + $self->{'use_dumper'} = 1; + require Data::Dumper; + } elsif ($arg =~ /^-f(.*)/) { + $self->{'files'}{$1} = 1; + } elsif ($arg eq "-l") { + $self->{'linenums'} = 1; + } elsif ($arg eq "-p") { + $self->{'parens'} = 1; + } elsif ($arg eq "-P") { + $self->{'noproto'} = 1; + } elsif ($arg eq "-q") { + $self->{'unquote'} = 1; + } elsif (substr($arg, 0, 2) eq "-s") { + $self->style_opts(substr $arg, 2); + } elsif ($arg =~ /^-x(\d)$/) { + $self->{'expand'} = $1; + } + } + return $self; +} + +{ + # Mask out the bits that L uses + my $WARN_MASK; + BEGIN { + $WARN_MASK = $warnings::Bits{all} | $warnings::DeadBits{all}; + } + sub WARN_MASK () { + return $WARN_MASK; + } +} + +# Initialise the contextual information, either from +# defaults provided with the ambient_pragmas method, +# or from perl's own defaults otherwise. +sub init { + my $self = shift; + + $self->{'warnings'} = defined ($self->{'ambient_warnings'}) + ? $self->{'ambient_warnings'} & WARN_MASK + : undef; + $self->{'hints'} = $self->{'ambient_hints'}; + $self->{'hinthash'} = $self->{'ambient_hinthash'}; + + # also a convenient place to clear out subs_declared + delete $self->{'subs_declared'}; +} + +sub compile { + my(@args) = @_; + return sub { + my $self = B::Deparse->new(@args); + # First deparse command-line args + if (defined $^I) { # deparse -i + print q(BEGIN { $^I = ).perlstring($^I).qq(; }\n); + } + if ($^W) { # deparse -w + print qq(BEGIN { \$^W = $^W; }\n); + } + if ($/ ne "\n" or defined $O::savebackslash) { # deparse -l and -0 + my $fs = perlstring($/) || 'undef'; + my $bs = perlstring($O::savebackslash) || 'undef'; + print qq(BEGIN { \$/ = $fs; \$\\ = $bs; }\n); + } + my @BEGINs = B::begin_av->isa("B::AV") ? B::begin_av->ARRAY : (); + my @UNITCHECKs = B::unitcheck_av->isa("B::AV") + ? B::unitcheck_av->ARRAY + : (); + my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : (); + my @INITs = B::init_av->isa("B::AV") ? B::init_av->ARRAY : (); + my @ENDs = B::end_av->isa("B::AV") ? B::end_av->ARRAY : (); + my @names = qw(BEGIN UNITCHECK CHECK INIT END); + my @blocks = \(@BEGINs, @UNITCHECKs, @CHECKs, @INITs, @ENDs); + while (@names) { + my ($name, $blocks) = (shift @names, shift @blocks); + for my $block (@$blocks) { + $self->todo($block, 0, $name); + } + } + $self->stash_subs(); + local($SIG{"__DIE__"}) = + sub { + if ($self->{'curcop'}) { + my $cop = $self->{'curcop'}; + my($line, $file) = ($cop->line, $cop->file); + print STDERR "While deparsing $file near line $line,\n"; + } + }; + $self->{'curcv'} = main_cv; + $self->{'curcvlex'} = undef; + print $self->print_protos; + @{$self->{'subs_todo'}} = + sort {$a->[0] <=> $b->[0]} @{$self->{'subs_todo'}}; + my $root = main_root; + local $B::overlay = {}; + unless (null $root) { + $self->pad_subs($self->{'curcv'}); + # Check for a stub-followed-by-ex-cop, resulting from a program + # consisting solely of sub declarations. For backward-compati- + # bility (and sane output) we don’t want to emit the stub. + # leave + # enter + # stub + # ex-nextstate (or ex-dbstate) + my $kid; + if ( $root->name eq 'leave' + and ($kid = $root->first)->name eq 'enter' + and !null($kid = $kid->sibling) and $kid->name eq 'stub' + and !null($kid = $kid->sibling) and $kid->name eq 'null' + and class($kid) eq 'COP' and null $kid->sibling ) + { + # ignore + } else { + $self->pessimise($root, main_start); + print $self->indent($self->deparse_root($root)), "\n"; + } + } + my @text; + while (scalar(@{$self->{'subs_todo'}})) { + push @text, $self->next_todo; + } + print $self->indent(join("", @text)), "\n" if @text; + + # Print __DATA__ section, if necessary + no strict 'refs'; + my $laststash = defined $self->{'curcop'} + ? $self->{'curcop'}->stash->NAME : $self->{'curstash'}; + if (defined *{$laststash."::DATA"}{IO}) { + print $self->keyword("package") . " $laststash;\n" + unless $laststash eq $self->{'curstash'}; + print $self->keyword("__DATA__") . "\n"; + print readline(*{$laststash."::DATA"}); + } + } +} + +sub coderef2text { + my $self = shift; + my $sub = shift; + croak "Usage: ->coderef2text(CODEREF)" unless UNIVERSAL::isa($sub, "CODE"); + + $self->init(); + local $self->{in_coderef2text} = 1; + return $self->indent($self->deparse_sub(svref_2object($sub))); +} + +my %strict_bits = do { + local $^H; + map +($_ => strict::bits($_)), qw/refs subs vars/ +}; + +sub ambient_pragmas { + my $self = shift; + my ($hint_bits, $warning_bits, $hinthash) = (0); + + while (@_ > 1) { + my $name = shift(); + my $val = shift(); + + if ($name eq 'strict') { + require strict; + + if ($val eq 'none') { + $hint_bits &= $strict_bits{$_} for qw/refs subs vars/; + next(); + } + + my @names; + if ($val eq "all") { + @names = qw/refs subs vars/; + } + elsif (ref $val) { + @names = @$val; + } + else { + @names = split' ', $val; + } + $hint_bits |= $strict_bits{$_} for @names; + } + + elsif ($name eq 'integer' + || $name eq 'bytes' + || $name eq 'utf8') { + require "$name.pm"; + if ($val) { + $hint_bits |= ${$::{"${name}::"}{"hint_bits"}}; + } + else { + $hint_bits &= ~${$::{"${name}::"}{"hint_bits"}}; + } + } + + elsif ($name eq 're') { + require re; + if ($val eq 'none') { + $hint_bits &= ~re::bits(qw/taint eval/); + next(); + } + + my @names; + if ($val eq 'all') { + @names = qw/taint eval/; + } + elsif (ref $val) { + @names = @$val; + } + else { + @names = split' ',$val; + } + $hint_bits |= re::bits(@names); + } + + elsif ($name eq 'warnings') { + if ($val eq 'none') { + $warning_bits = $warnings::NONE; + next(); + } + + my @names; + if (ref $val) { + @names = @$val; + } + else { + @names = split/\s+/, $val; + } + + $warning_bits = $warnings::NONE if !defined ($warning_bits); + $warning_bits |= warnings::bits(@names); + } + + elsif ($name eq 'warning_bits') { + $warning_bits = $val; + } + + elsif ($name eq 'hint_bits') { + $hint_bits = $val; + } + + elsif ($name eq '%^H') { + $hinthash = $val; + } + + else { + croak "Unknown pragma type: $name"; + } + } + if (@_) { + croak "The ambient_pragmas method expects an even number of args"; + } + + $self->{'ambient_warnings'} = $warning_bits; + $self->{'ambient_hints'} = $hint_bits; + $self->{'ambient_hinthash'} = $hinthash; +} + +# This method is the inner loop, so try to keep it simple +sub deparse { + my $self = shift; + my($op, $cx) = @_; + + Carp::confess("Null op in deparse") if !defined($op) + || class($op) eq "NULL"; + my $meth = "pp_" . $op->name; + return $self->$meth($op, $cx); +} + +sub indent { + my $self = shift; + my $txt = shift; + # \cK also swallows a preceding line break when followed by a + # semicolon. + $txt =~ s/\n\cK;//g; + my @lines = split(/\n/, $txt); + my $leader = ""; + my $level = 0; + my $line; + for $line (@lines) { + my $cmd = substr($line, 0, 1); + if ($cmd eq "\t" or $cmd eq "\b") { + $level += ($cmd eq "\t" ? 1 : -1) * $self->{'indent_size'}; + if ($self->{'use_tabs'}) { + $leader = "\t" x ($level / 8) . " " x ($level % 8); + } else { + $leader = " " x $level; + } + $line = substr($line, 1); + } + if (index($line, "\f") > 0) { + $line =~ s/\f/\n/; + } + if (substr($line, 0, 1) eq "\f") { + $line = substr($line, 1); # no indent + } else { + $line = $leader . $line; + } + $line =~ s/\cK;?//g; + } + return join("\n", @lines); +} + +sub pad_subs { + my ($self, $cv) = @_; + my $padlist = $cv->PADLIST; + my @names = $padlist->ARRAYelt(0)->ARRAY; + my @values = $padlist->ARRAYelt(1)->ARRAY; + my @todo; + PADENTRY: + for my $ix (0.. $#names) { for $_ ($names[$ix]) { + next if class($_) eq "SPECIAL"; + my $name = $_->PVX; + if (defined $name && $name =~ /^&./) { + my $low = $_->COP_SEQ_RANGE_LOW; + my $flags = $_->FLAGS; + my $outer = $flags & PADNAMEt_OUTER; + if ($flags & SVpad_OUR) { + push @todo, [$low, undef, 0, $_] + # [seq, no cv, not format, padname] + unless $outer; + next; + } + my $protocv = $flags & SVpad_STATE + ? $values[$ix] + : $_->PROTOCV; + if (class ($protocv) ne 'CV') { + my $flags = $flags; + my $cv = $cv; + my $name = $_; + while ($flags & PADNAMEt_OUTER && class ($protocv) ne 'CV') + { + $cv = $cv->OUTSIDE; + next PADENTRY if class($cv) eq 'SPECIAL'; # XXX freed? + my $padlist = $cv->PADLIST; + my $ix = $name->PARENT_PAD_INDEX; + $name = $padlist->NAMES->ARRAYelt($ix); + $flags = $name->FLAGS; + $protocv = $flags & SVpad_STATE + ? $padlist->ARRAYelt(1)->ARRAYelt($ix) + : $name->PROTOCV; + } + } + my $defined_in_this_sub = ${$protocv->OUTSIDE} == $$cv || do { + my $other = $protocv->PADLIST; + $$other && $other->outid == $padlist->id; + }; + if ($flags & PADNAMEt_OUTER) { + next unless $defined_in_this_sub; + push @todo, [$protocv->OUTSIDE_SEQ, $protocv, 0, $_]; + next; + } + my $outseq = $protocv->OUTSIDE_SEQ; + if ($outseq <= $low) { + # defined before its name is visible, so it’s gotta be + # declared and defined at once: my sub foo { ... } + push @todo, [$low, $protocv, 0, $_]; + } + else { + # declared and defined separately: my sub f; sub f { ... } + push @todo, [$low, undef, 0, $_]; + push @todo, [$outseq, $protocv, 0, $_] + if $defined_in_this_sub; + } + } + }} + @{$self->{'subs_todo'}} = + sort {$a->[0] <=> $b->[0]} @{$self->{'subs_todo'}}, @todo +} + + +# deparse_argops(): deparse, if possible, a sequence of argcheck + argelem +# ops into a subroutine signature. If successful, return the first op +# following the signature ops plus the signature string; else return the +# empty list. +# +# Normally a bunch of argelem ops will have been generated by the +# signature parsing, but it's possible that ops have been added manually +# or altered. In this case we return "()" and fall back to general +# deparsing of the individual sigelems as 'my $x = $_[N]' etc. +# +# We're only called if the top is an ex-argcheck, which is a placeholder +# indicating a signature subtree. +# +# Return a signature string, or an empty list if no deparseable as a +# signature + +sub deparse_argops { + my ($self, $topop, $cv) = @_; + + my @sig; + + + $topop = $topop->first; + return unless $$topop and $topop->name eq 'lineseq'; + + + # last op should be nextstate + my $last = $topop->last; + return unless $$last + and ( _op_is_or_was($last, OP_NEXTSTATE) + or _op_is_or_was($last, OP_DBSTATE)); + + # first OP_NEXTSTATE + + my $o = $topop->first; + return unless $$o; + return if $o->label; + + # OP_ARGCHECK + + $o = $o->sibling; + return unless $$o and $o->name eq 'argcheck'; + + my ($params, $opt_params, $slurpy) = $o->aux_list($cv); + my $mandatory = $params - $opt_params; + my $seen_slurpy = 0; + my $last_ix = -1; + + # keep looking for valid nextstate + argelem pairs, terminated + # by a final nextstate + + while (1) { + $o = $o->sibling; + return unless $$o; + + # skip trailing nextstate + last if $$o == $$last; + + # OP_NEXTSTATE + return unless $o->name =~ /^(next|db)state$/; + return if $o->label; + + # OP_ARGELEM + $o = $o->sibling; + last unless $$o; + + if ($o->name eq 'argelem') { + my $ix = $o->string($cv); + while (++$last_ix < $ix) { + push @sig, $last_ix < $mandatory ? '$' : '$='; + } + my $var = $self->padname($o->targ); + if ($var =~ /^[@%]/) { + return if $seen_slurpy; + $seen_slurpy = 1; + return if $ix != $params or !$slurpy + or substr($var,0,1) ne $slurpy; + } + else { + return if $ix >= $params; + } + if ($o->flags & OPf_KIDS) { + my $kid = $o->first; + return unless $$kid and $kid->name eq 'argdefelem'; + my $def = $self->deparse($kid->first, 7); + $def = "($def)" if $kid->first->flags & OPf_PARENS; + $var .= " = $def"; + } + push @sig, $var; + } + elsif ($o->name eq 'null' + and ($o->flags & OPf_KIDS) + and $o->first->name eq 'argdefelem') + { + # special case - a void context default expression: $ = expr + + my $defop = $o->first; + my $ix = $defop->targ; + while (++$last_ix < $ix) { + push @sig, $last_ix < $mandatory ? '$' : '$='; + } + return if $last_ix >= $params + or $last_ix < $mandatory; + my $def = $self->deparse($defop->first, 7); + $def = "($def)" if $defop->first->flags & OPf_PARENS; + push @sig, '$ = ' . $def; + } + else { + return; + } + + } + + while (++$last_ix < $params) { + push @sig, $last_ix < $mandatory ? '$' : '$='; + } + push @sig, $slurpy if $slurpy and !$seen_slurpy; + + return (join(', ', @sig)); +} + + +# Deparse a sub. Returns everything except the 'sub foo', +# e.g. ($$) : method { ...; } +# or : prototype($$) lvalue ($a, $b) { ...; }; + +sub deparse_sub { + my $self = shift; + my $cv = shift; + my @attrs; + my $proto; + my $sig; + +Carp::confess("NULL in deparse_sub") if !defined($cv) || $cv->isa("B::NULL"); +Carp::confess("SPECIAL in deparse_sub") if $cv->isa("B::SPECIAL"); + local $self->{'curcop'} = $self->{'curcop'}; + + my $has_sig = $self->{hinthash}{feature_signatures}; + if ($cv->FLAGS & SVf_POK) { + my $myproto = $cv->PV; + if ($has_sig) { + push @attrs, "prototype($myproto)"; + } + else { + $proto = $myproto; + } + } + if ($cv->CvFLAGS & (CVf_METHOD|CVf_LOCKED|CVf_LVALUE|CVf_ANONCONST)) { + push @attrs, "lvalue" if $cv->CvFLAGS & CVf_LVALUE; + push @attrs, "method" if $cv->CvFLAGS & CVf_METHOD; + push @attrs, "const" if $cv->CvFLAGS & CVf_ANONCONST; + } + + local($self->{'curcv'}) = $cv; + local($self->{'curcvlex'}); + local(@$self{qw'curstash warnings hints hinthash'}) + = @$self{qw'curstash warnings hints hinthash'}; + my $body; + my $root = $cv->ROOT; + local $B::overlay = {}; + if (not null $root) { + $self->pad_subs($cv); + $self->pessimise($root, $cv->START); + my $lineseq = $root->first; + + # stub sub may have single op rather than list of ops + my $is_list = ($lineseq->name eq "lineseq"); + my $firstop = $is_list ? $lineseq->first : $lineseq; + + # Try to deparse first subtree as a signature if possible. + # Top of signature subtree has an ex-argcheck as a placeholder + if ( $has_sig + and $$firstop + and $firstop->name eq 'null' + and $firstop->targ == OP_ARGCHECK + ) { + my ($mysig) = $self->deparse_argops($firstop, $cv); + if (defined $mysig) { + $sig = $mysig; + $firstop = $is_list ? $firstop->sibling : undef; + } + } + + if ($is_list && $firstop) { + my @ops; + for (my $o = $firstop; $$o; $o=$o->sibling) { + push @ops, $o; + } + $body = $self->lineseq(undef, 0, @ops).";"; + if (!$has_sig and $ops[-1]->name =~ /^(next|db)state$/) { + # this handles void context in + # use feature signatures; sub ($=1) {} + $body .= "\n()"; + } + my $scope_en = $self->find_scope_en($lineseq); + if (defined $scope_en) { + my $subs = join"", $self->seq_subs($scope_en); + $body .= ";\n$subs" if length($subs); + } + } + elsif ($firstop) { + $body = $self->deparse($root->first, 0); + } + else { + $body = ';'; # stub sub + } + + my $l = ''; + if ($self->{'linenums'}) { + # a glob's gp_line is set from the line containing a + # sub's closing '}' if the CV is the first use of the GV. + # So make sure the linenum is set correctly for '}' + my $gv = $cv->GV; + my $line = $gv->LINE; + my $file = $gv->FILE; + $l = "\f#line $line \"$file\"\n"; + } + $body = "{\n\t$body\n$l\b}"; + } + else { + my $sv = $cv->const_sv; + if ($$sv) { + # uh-oh. inlinable sub... format it differently + $body = "{ " . $self->const($sv, 0) . " }\n"; + } else { # XSUB? (or just a declaration) + $body = ';' + } + } + $proto = defined $proto ? "($proto) " : ""; + $sig = defined $sig ? "($sig) " : ""; + my $attrs = ''; + $attrs = ': ' . join('', map "$_ ", @attrs) if @attrs; + return "$proto$attrs$sig$body\n"; +} + +sub deparse_format { + my $self = shift; + my $form = shift; + my @text; + local($self->{'curcv'}) = $form; + local($self->{'curcvlex'}); + local($self->{'in_format'}) = 1; + local(@$self{qw'curstash warnings hints hinthash'}) + = @$self{qw'curstash warnings hints hinthash'}; + my $op = $form->ROOT; + local $B::overlay = {}; + $self->pessimise($op, $form->START); + my $kid; + return "\f." if $op->first->name eq 'stub' + || $op->first->name eq 'nextstate'; + $op = $op->first->first; # skip leavewrite, lineseq + while (not null $op) { + $op = $op->sibling; # skip nextstate + my @exprs; + $kid = $op->first->sibling; # skip pushmark + push @text, "\f".$self->const_sv($kid)->PV; + $kid = $kid->sibling; + for (; not null $kid; $kid = $kid->sibling) { + push @exprs, $self->deparse($kid, -1); + $exprs[-1] =~ s/;\z//; + } + push @text, "\f".join(", ", @exprs)."\n" if @exprs; + $op = $op->sibling; + } + return join("", @text) . "\f."; +} + +sub is_scope { + my $op = shift; + return $op->name eq "leave" || $op->name eq "scope" + || $op->name eq "lineseq" + || ($op->name eq "null" && class($op) eq "UNOP" + && (is_scope($op->first) || $op->first->name eq "enter")); +} + +sub is_state { + my $name = $_[0]->name; + return $name eq "nextstate" || $name eq "dbstate" || $name eq "setstate"; +} + +sub is_miniwhile { # check for one-line loop ('foo() while $y--') + my $op = shift; + return (!null($op) and null($op->sibling) + and $op->name eq "null" and class($op) eq "UNOP" + and (($op->first->name =~ /^(and|or)$/ + and $op->first->first->sibling->name eq "lineseq") + or ($op->first->name eq "lineseq" + and not null $op->first->first->sibling + and $op->first->first->sibling->name eq "unstack") + )); +} + +# Check if the op and its sibling are the initialization and the rest of a +# for (..;..;..) { ... } loop +sub is_for_loop { + my $op = shift; + # This OP might be almost anything, though it won't be a + # nextstate. (It's the initialization, so in the canonical case it + # will be an sassign.) The sibling is (old style) a lineseq whose + # first child is a nextstate and whose second is a leaveloop, or + # (new style) an unstack whose sibling is a leaveloop. + my $lseq = $op->sibling; + return 0 unless !is_state($op) and !null($lseq); + if ($lseq->name eq "lineseq") { + if ($lseq->first && !null($lseq->first) && is_state($lseq->first) + && (my $sib = $lseq->first->sibling)) { + return (!null($sib) && $sib->name eq "leaveloop"); + } + } elsif ($lseq->name eq "unstack" && ($lseq->flags & OPf_SPECIAL)) { + my $sib = $lseq->sibling; + return $sib && !null($sib) && $sib->name eq "leaveloop"; + } + return 0; +} + +sub is_scalar { + my $op = shift; + return ($op->name eq "rv2sv" or + $op->name eq "padsv" or + $op->name eq "gv" or # only in array/hash constructs + $op->flags & OPf_KIDS && !null($op->first) + && $op->first->name eq "gvsv"); +} + +sub maybe_parens { + my $self = shift; + my($text, $cx, $prec) = @_; + if ($prec < $cx # unary ops nest just fine + or $prec == $cx and $cx != 4 and $cx != 16 and $cx != 21 + or $self->{'parens'}) + { + $text = "($text)"; + # In a unop, let parent reuse our parens; see maybe_parens_unop + $text = "\cS" . $text if $cx == 16; + return $text; + } else { + return $text; + } +} + +# same as above, but get around the 'if it looks like a function' rule +sub maybe_parens_unop { + my $self = shift; + my($name, $kid, $cx) = @_; + if ($cx > 16 or $self->{'parens'}) { + $kid = $self->deparse($kid, 1); + if ($name eq "umask" && $kid =~ /^\d+$/) { + $kid = sprintf("%#o", $kid); + } + return $self->keyword($name) . "($kid)"; + } else { + $kid = $self->deparse($kid, 16); + if ($name eq "umask" && $kid =~ /^\d+$/) { + $kid = sprintf("%#o", $kid); + } + $name = $self->keyword($name); + if (substr($kid, 0, 1) eq "\cS") { + # use kid's parens + return $name . substr($kid, 1); + } elsif (substr($kid, 0, 1) eq "(") { + # avoid looks-like-a-function trap with extra parens + # ('+' can lead to ambiguities) + return "$name(" . $kid . ")"; + } else { + return "$name $kid"; + } + } +} + +sub maybe_parens_func { + my $self = shift; + my($func, $text, $cx, $prec) = @_; + if ($prec <= $cx or substr($text, 0, 1) eq "(" or $self->{'parens'}) { + return "$func($text)"; + } else { + return "$func $text"; + } +} + +sub find_our_type { + my ($self, $name) = @_; + $self->populate_curcvlex() if !defined $self->{'curcvlex'}; + my $seq = $self->{'curcop'} ? $self->{'curcop'}->cop_seq : 0; + for my $a (@{$self->{'curcvlex'}{"o$name"}}) { + my ($st, undef, $padname) = @$a; + if ($st >= $seq && $padname->FLAGS & SVpad_TYPED) { + return $padname->SvSTASH->NAME; + } + } + return ''; +} + +sub maybe_local { + my $self = shift; + my($op, $cx, $text) = @_; + my $name = $op->name; + my $our_intro = ($name =~ /^(?:(?:gv|rv2)[ash]v|split|refassign + |lv(?:av)?ref)$/x) + ? OPpOUR_INTRO + : 0; + my $lval_intro = $name eq 'split' ? 0 : OPpLVAL_INTRO; + # The @a in \(@a) isn't in ref context, but only when the + # parens are there. + my $need_parens = $self->{'in_refgen'} && $name =~ /[ah]v\z/ + && ($op->flags & (OPf_PARENS|OPf_REF)) == OPf_PARENS; + if ((my $priv = $op->private) & ($lval_intro|$our_intro)) { + my @our_local; + push @our_local, "local" if $priv & $lval_intro; + push @our_local, "our" if $priv & $our_intro; + my $our_local = join " ", map $self->keyword($_), @our_local; + if( $our_local[-1] eq 'our' ) { + if ( $text !~ /^\W(\w+::)*\w+\z/ + and !utf8::decode($text) || $text !~ /^\W(\w+::)*\w+\z/ + ) { + die "Unexpected our($text)\n"; + } + $text =~ s/(\w+::)+//; + + if (my $type = $self->find_our_type($text)) { + $our_local .= ' ' . $type; + } + } + return $need_parens ? "($text)" : $text + if $self->{'avoid_local'}{$$op}; + if ($need_parens) { + return "$our_local($text)"; + } elsif (want_scalar($op) || $our_local eq 'our') { + return "$our_local $text"; + } else { + return $self->maybe_parens_func("$our_local", $text, $cx, 16); + } + } else { + return $need_parens ? "($text)" : $text; + } +} + +sub maybe_targmy { + my $self = shift; + my($op, $cx, $func, @args) = @_; + if ($op->private & OPpTARGET_MY) { + my $var = $self->padname($op->targ); + my $val = $func->($self, $op, 7, @args); + return $self->maybe_parens("$var = $val", $cx, 7); + } else { + return $func->($self, $op, $cx, @args); + } +} + +sub padname_sv { + my $self = shift; + my $targ = shift; + return $self->{'curcv'}->PADLIST->ARRAYelt(0)->ARRAYelt($targ); +} + +sub maybe_my { + my $self = shift; + my($op, $cx, $text, $padname, $forbid_parens) = @_; + # The @a in \(@a) isn't in ref context, but only when the + # parens are there. + my $need_parens = !$forbid_parens && $self->{'in_refgen'} + && $op->name =~ /[ah]v\z/ + && ($op->flags & (OPf_PARENS|OPf_REF)) == OPf_PARENS; + # The @a in \my @a must not have parens. + if (!$need_parens && $self->{'in_refgen'}) { + $forbid_parens = 1; + } + if ($op->private & OPpLVAL_INTRO and not $self->{'avoid_local'}{$$op}) { + # Check $padname->FLAGS for statehood, rather than $op->private, + # because enteriter ops do not carry the flag. + my $my = + $self->keyword($padname->FLAGS & SVpad_STATE ? "state" : "my"); + if ($padname->FLAGS & SVpad_TYPED) { + $my .= ' ' . $padname->SvSTASH->NAME; + } + if ($need_parens) { + return "$my($text)"; + } elsif ($forbid_parens || want_scalar($op)) { + return "$my $text"; + } else { + return $self->maybe_parens_func($my, $text, $cx, 16); + } + } else { + return $need_parens ? "($text)" : $text; + } +} + +# The following OPs don't have functions: + +# pp_padany -- does not exist after parsing + +sub AUTOLOAD { + if ($AUTOLOAD =~ s/^.*::pp_//) { + warn "unexpected OP_". + ($_[1]->type == OP_CUSTOM ? "CUSTOM ($AUTOLOAD)" : uc $AUTOLOAD); + return "XXX"; + } else { + die "Undefined subroutine $AUTOLOAD called"; + } +} + +sub DESTROY {} # Do not AUTOLOAD + +# $root should be the op which represents the root of whatever +# we're sequencing here. If it's undefined, then we don't append +# any subroutine declarations to the deparsed ops, otherwise we +# append appropriate declarations. +sub lineseq { + my($self, $root, $cx, @ops) = @_; + my($expr, @exprs); + + my $out_cop = $self->{'curcop'}; + my $out_seq = defined($out_cop) ? $out_cop->cop_seq : undef; + my $limit_seq; + if (defined $root) { + $limit_seq = $out_seq; + my $nseq; + $nseq = $self->find_scope_st($root->sibling) if ${$root->sibling}; + $limit_seq = $nseq if !defined($limit_seq) + or defined($nseq) && $nseq < $limit_seq; + } + $limit_seq = $self->{'limit_seq'} + if defined($self->{'limit_seq'}) + && (!defined($limit_seq) || $self->{'limit_seq'} < $limit_seq); + local $self->{'limit_seq'} = $limit_seq; + + $self->walk_lineseq($root, \@ops, + sub { push @exprs, $_[0]} ); + + my $sep = $cx ? '; ' : ";\n"; + my $body = join($sep, grep {length} @exprs); + my $subs = ""; + if (defined $root && defined $limit_seq && !$self->{'in_format'}) { + $subs = join "\n", $self->seq_subs($limit_seq); + } + return join($sep, grep {length} $body, $subs); +} + +sub scopeop { + my($real_block, $self, $op, $cx) = @_; + my $kid; + my @kids; + + local(@$self{qw'curstash warnings hints hinthash'}) + = @$self{qw'curstash warnings hints hinthash'} if $real_block; + if ($real_block) { + $kid = $op->first->sibling; # skip enter + if (is_miniwhile($kid)) { + my $top = $kid->first; + my $name = $top->name; + if ($name eq "and") { + $name = $self->keyword("while"); + } elsif ($name eq "or") { + $name = $self->keyword("until"); + } else { # no conditional -> while 1 or until 0 + return $self->deparse($top->first, 1) . " " + . $self->keyword("while") . " 1"; + } + my $cond = $top->first; + my $body = $cond->sibling->first; # skip lineseq + $cond = $self->deparse($cond, 1); + $body = $self->deparse($body, 1); + return "$body $name $cond"; + } + } else { + $kid = $op->first; + } + for (; !null($kid); $kid = $kid->sibling) { + push @kids, $kid; + } + if ($cx > 0) { # inside an expression, (a do {} while for lineseq) + my $body = $self->lineseq($op, 0, @kids); + return is_lexical_subs(@kids) + ? $body + : ($self->lex_in_scope("&do") ? "CORE::do" : "do") + . " {\n\t$body\n\b}"; + } else { + my $lineseq = $self->lineseq($op, $cx, @kids); + return (length ($lineseq) ? "$lineseq;" : ""); + } +} + +sub pp_scope { scopeop(0, @_); } +sub pp_lineseq { scopeop(0, @_); } +sub pp_leave { scopeop(1, @_); } + +# This is a special case of scopeop and lineseq, for the case of the +# main_root. The difference is that we print the output statements as +# soon as we get them, for the sake of impatient users. +sub deparse_root { + my $self = shift; + my($op) = @_; + local(@$self{qw'curstash warnings hints hinthash'}) + = @$self{qw'curstash warnings hints hinthash'}; + my @kids; + return if null $op->first; # Can happen, e.g., for Bytecode without -k + for (my $kid = $op->first->sibling; !null($kid); $kid = $kid->sibling) { + push @kids, $kid; + } + $self->walk_lineseq($op, \@kids, + sub { return unless length $_[0]; + print $self->indent($_[0].';'); + print "\n" + unless $_[1] == $#kids; + }); +} + +sub walk_lineseq { + my ($self, $op, $kids, $callback) = @_; + my @kids = @$kids; + for (my $i = 0; $i < @kids; $i++) { + my $expr = ""; + if (is_state $kids[$i]) { + $expr = $self->deparse($kids[$i++], 0); + if ($i > $#kids) { + $callback->($expr, $i); + last; + } + } + if (is_for_loop($kids[$i])) { + $callback->($expr . $self->for_loop($kids[$i], 0), + $i += $kids[$i]->sibling->name eq "unstack" ? 2 : 1); + next; + } + my $expr2 = $self->deparse($kids[$i], (@kids != 1)/2); + $expr2 =~ s/^sub :(?!:)/+sub :/; # statement label otherwise + $expr .= $expr2; + $callback->($expr, $i); + } +} + +# The BEGIN {} is used here because otherwise this code isn't executed +# when you run B::Deparse on itself. +my %globalnames; +BEGIN { map($globalnames{$_}++, "SIG", "STDIN", "STDOUT", "STDERR", "INC", + "ENV", "ARGV", "ARGVOUT", "_"); } + +sub gv_name { + my $self = shift; + my $gv = shift; + my $raw = shift; +#Carp::confess() unless ref($gv) eq "B::GV"; + my $cv = $gv->FLAGS & SVf_ROK ? $gv->RV : 0; + my $stash = ($cv || $gv)->STASH->NAME; + my $name = $raw + ? $cv ? $cv->NAME_HEK || $cv->GV->NAME : $gv->NAME + : $cv + ? B::safename($cv->NAME_HEK || $cv->GV->NAME) + : $gv->SAFENAME; + if ($stash eq 'main' && $name =~ /^::/) { + $stash = '::'; + } + elsif (($stash eq 'main' + && ($globalnames{$name} || $name =~ /^[^A-Za-z_:]/)) + or ($stash eq $self->{'curstash'} && !$globalnames{$name} + && ($stash eq 'main' || $name !~ /::/)) + ) + { + $stash = ""; + } else { + $stash = $stash . "::"; + } + if (!$raw and $name =~ /^(\^..|{)/) { + $name = "{$name}"; # ${^WARNING_BITS}, etc and ${ + } + return $stash . $name; +} + +# Return the name to use for a stash variable. +# If a lexical with the same name is in scope, or +# if strictures are enabled, it may need to be +# fully-qualified. +sub stash_variable { + my ($self, $prefix, $name, $cx) = @_; + + return $prefix.$self->maybe_qualify($prefix, $name) if $name =~ /::/; + + unless ($prefix eq '$' || $prefix eq '@' || $prefix eq '&' || #' + $prefix eq '%' || $prefix eq '$#') { + return "$prefix$name"; + } + + if ($name =~ /^[^[:alpha:]_+-]$/) { + if (defined $cx && $cx == 26) { + if ($prefix eq '@') { + return "$prefix\{$name}"; + } + elsif ($name eq '#') { return '${#}' } # "${#}a" vs "$#a" + } + if ($prefix eq '$#') { + return "\$#{$name}"; + } + } + + return $prefix . $self->maybe_qualify($prefix, $name); +} + +my %unctrl = # portable to EBCDIC + ( + "\c@" => '@', # unused + "\cA" => 'A', + "\cB" => 'B', + "\cC" => 'C', + "\cD" => 'D', + "\cE" => 'E', + "\cF" => 'F', + "\cG" => 'G', + "\cH" => 'H', + "\cI" => 'I', + "\cJ" => 'J', + "\cK" => 'K', + "\cL" => 'L', + "\cM" => 'M', + "\cN" => 'N', + "\cO" => 'O', + "\cP" => 'P', + "\cQ" => 'Q', + "\cR" => 'R', + "\cS" => 'S', + "\cT" => 'T', + "\cU" => 'U', + "\cV" => 'V', + "\cW" => 'W', + "\cX" => 'X', + "\cY" => 'Y', + "\cZ" => 'Z', + "\c[" => '[', # unused + "\c\\" => '\\', # unused + "\c]" => ']', # unused + "\c_" => '_', # unused + ); + +# Return just the name, without the prefix. It may be returned as a quoted +# string. The second return value is a boolean indicating that. +sub stash_variable_name { + my($self, $prefix, $gv) = @_; + my $name = $self->gv_name($gv, 1); + $name = $self->maybe_qualify($prefix,$name); + if ($name =~ /^(?:\S|(?!\d)[\ca-\cz]?(?:\w|::)*|\d+)\z/) { + $name =~ s/^([\ca-\cz])/'^' . $unctrl{$1}/e; + $name =~ /^(\^..|{)/ and $name = "{$name}"; + return $name, 0; # not quoted + } + else { + single_delim("q", "'", $name, $self), 1; + } +} + +sub maybe_qualify { + my ($self,$prefix,$name) = @_; + my $v = ($prefix eq '$#' ? '@' : $prefix) . $name; + if ($prefix eq "") { + $name .= "::" if $name =~ /(?:\ACORE::[^:]*|::)\z/; + return $name; + } + return $name if $name =~ /::/; + return $self->{'curstash'}.'::'. $name + if + $name =~ /^(?!\d)\w/ # alphabetic + && $v !~ /^\$[ab]\z/ # not $a or $b + && $v =~ /\A[\$\@\%\&]/ # scalar, array, hash, or sub + && !$globalnames{$name} # not a global name + && $self->{hints} & $strict_bits{vars} # strict vars + && !$self->lex_in_scope($v,1) # no "our" + or $self->lex_in_scope($v); # conflicts with "my" variable + return $name; +} + +sub lex_in_scope { + my ($self, $name, $our) = @_; + substr $name, 0, 0, = $our ? 'o' : 'm'; # our/my + $self->populate_curcvlex() if !defined $self->{'curcvlex'}; + + return 0 if !defined($self->{'curcop'}); + my $seq = $self->{'curcop'}->cop_seq; + return 0 if !exists $self->{'curcvlex'}{$name}; + for my $a (@{$self->{'curcvlex'}{$name}}) { + my ($st, $en) = @$a; + return 1 if $seq > $st && $seq <= $en; + } + return 0; +} + +sub populate_curcvlex { + my $self = shift; + for (my $cv = $self->{'curcv'}; class($cv) eq "CV"; $cv = $cv->OUTSIDE) { + my $padlist = $cv->PADLIST; + # an undef CV still in lexical chain + next if class($padlist) eq "SPECIAL"; + my @padlist = $padlist->ARRAY; + my @ns = $padlist[0]->ARRAY; + + for (my $i=0; $i<@ns; ++$i) { + next if class($ns[$i]) eq "SPECIAL"; + if (class($ns[$i]) eq "PV") { + # Probably that pesky lexical @_ + next; + } + my $name = $ns[$i]->PVX; + next unless defined $name; + my ($seq_st, $seq_en) = + ($ns[$i]->FLAGS & SVf_FAKE) + ? (0, 999999) + : ($ns[$i]->COP_SEQ_RANGE_LOW, $ns[$i]->COP_SEQ_RANGE_HIGH); + + push @{$self->{'curcvlex'}{ + ($ns[$i]->FLAGS & SVpad_OUR ? 'o' : 'm') . $name + }}, [$seq_st, $seq_en, $ns[$i]]; + } + } +} + +sub find_scope_st { ((find_scope(@_))[0]); } +sub find_scope_en { ((find_scope(@_))[1]); } + +# Recurses down the tree, looking for pad variable introductions and COPs +sub find_scope { + my ($self, $op, $scope_st, $scope_en) = @_; + carp("Undefined op in find_scope") if !defined $op; + return ($scope_st, $scope_en) unless $op->flags & OPf_KIDS; + + my @queue = ($op); + while(my $op = shift @queue ) { + for (my $o=$op->first; $$o; $o=$o->sibling) { + if ($o->name =~ /^pad.v$/ && $o->private & OPpLVAL_INTRO) { + my $s = int($self->padname_sv($o->targ)->COP_SEQ_RANGE_LOW); + my $e = $self->padname_sv($o->targ)->COP_SEQ_RANGE_HIGH; + $scope_st = $s if !defined($scope_st) || $s < $scope_st; + $scope_en = $e if !defined($scope_en) || $e > $scope_en; + return ($scope_st, $scope_en); + } + elsif (is_state($o)) { + my $c = $o->cop_seq; + $scope_st = $c if !defined($scope_st) || $c < $scope_st; + $scope_en = $c if !defined($scope_en) || $c > $scope_en; + return ($scope_st, $scope_en); + } + elsif ($o->flags & OPf_KIDS) { + unshift (@queue, $o); + } + } + } + + return ($scope_st, $scope_en); +} + +# Returns a list of subs which should be inserted before the COP +sub cop_subs { + my ($self, $op, $out_seq) = @_; + my $seq = $op->cop_seq; + $seq = $out_seq if defined($out_seq) && $out_seq < $seq; + return $self->seq_subs($seq); +} + +sub seq_subs { + my ($self, $seq) = @_; + my @text; +#push @text, "# ($seq)\n"; + + return "" if !defined $seq; + my @pending; + while (scalar(@{$self->{'subs_todo'}}) + and $seq > $self->{'subs_todo'}[0][0]) { + my $cv = $self->{'subs_todo'}[0][1]; + # Skip the OUTSIDE check for lexical subs. We may be deparsing a + # cloned anon sub with lexical subs declared in it, in which case + # the OUTSIDE pointer points to the anon protosub. + my $lexical = ref $self->{'subs_todo'}[0][3]; + my $outside = !$lexical && $cv && $cv->OUTSIDE; + if (!$lexical and $cv + and ${$cv->OUTSIDE || \0} != ${$self->{'curcv'}}) + { + push @pending, shift @{$self->{'subs_todo'}}; + next; + } + push @text, $self->next_todo; + } + unshift @{$self->{'subs_todo'}}, @pending; + return @text; +} + +sub _features_from_bundle { + my ($hints, $hh) = @_; + foreach (@{$feature::feature_bundle{@feature::hint_bundles[$hints >> $feature::hint_shift]}}) { + $hh->{$feature::feature{$_}} = 1; + } + return $hh; +} + +# generate any pragmas, 'package foo' etc needed to synchronise +# with the given cop + +sub pragmata { + my $self = shift; + my($op) = @_; + + my @text; + + my $stash = $op->stashpv; + if ($stash ne $self->{'curstash'}) { + push @text, $self->keyword("package") . " $stash;\n"; + $self->{'curstash'} = $stash; + } + + my $warnings = $op->warnings; + my $warning_bits; + if ($warnings->isa("B::SPECIAL") && $$warnings == 4) { + $warning_bits = $warnings::Bits{"all"} & WARN_MASK; + } + elsif ($warnings->isa("B::SPECIAL") && $$warnings == 5) { + $warning_bits = $warnings::NONE; + } + elsif ($warnings->isa("B::SPECIAL")) { + $warning_bits = undef; + } + else { + $warning_bits = $warnings->PV & WARN_MASK; + } + + if (defined ($warning_bits) and + !defined($self->{warnings}) || $self->{'warnings'} ne $warning_bits) { + push @text, + $self->declare_warnings($self->{'warnings'}, $warning_bits); + $self->{'warnings'} = $warning_bits; + } + + my $hints = $op->hints; + my $old_hints = $self->{'hints'}; + if ($self->{'hints'} != $hints) { + push @text, $self->declare_hints($self->{'hints'}, $hints); + $self->{'hints'} = $hints; + } + + my $newhh; + $newhh = $op->hints_hash->HASH; + + { + # feature bundle hints + my $from = $old_hints & $feature::hint_mask; + my $to = $ hints & $feature::hint_mask; + if ($from != $to) { + if ($to == $feature::hint_mask) { + if ($self->{'hinthash'}) { + delete $self->{'hinthash'}{$_} + for grep /^feature_/, keys %{$self->{'hinthash'}}; + } + else { $self->{'hinthash'} = {} } + $self->{'hinthash'} + = _features_from_bundle($from, $self->{'hinthash'}); + } + else { + my $bundle = + $feature::hint_bundles[$to >> $feature::hint_shift]; + $bundle =~ s/(\d[13579])\z/$1+1/e; # 5.11 => 5.12 + push @text, + $self->keyword("no") . " feature ':all';\n", + $self->keyword("use") . " feature ':$bundle';\n"; + } + } + } + + { + push @text, $self->declare_hinthash( + $self->{'hinthash'}, $newhh, + $self->{indent_size}, $self->{hints}, + ); + $self->{'hinthash'} = $newhh; + } + + return join("", @text); +} + + +# Notice how subs and formats are inserted between statements here; +# also $[ assignments and pragmas. +sub pp_nextstate { + my $self = shift; + my($op, $cx) = @_; + $self->{'curcop'} = $op; + + my @text; + + my @subs = $self->cop_subs($op); + if (@subs) { + # Special marker to swallow up the semicolon + push @subs, "\cK"; + } + push @text, @subs; + + push @text, $self->pragmata($op); + + + # This should go after of any branches that add statements, to + # increase the chances that it refers to the same line it did in + # the original program. + if ($self->{'linenums'} && $cx != .5) { # $cx == .5 means in a format + push @text, "\f#line " . $op->line . + ' "' . $op->file, qq'"\n'; + } + + push @text, $op->label . ": " if $op->label; + + return join("", @text); +} + +sub declare_warnings { + my ($self, $from, $to) = @_; + $from //= ''; + my $all = (warnings::bits("all") & WARN_MASK); + unless ((($from & WARN_MASK) & ~$all) =~ /[^\0]/) { + # no FATAL bits need turning off + if ( ($to & WARN_MASK) eq $all) { + return $self->keyword("use") . " warnings;\n"; + } + elsif (($to & WARN_MASK) eq ("\0"x length($to) & WARN_MASK)) { + return $self->keyword("no") . " warnings;\n"; + } + } + + return "BEGIN {\${^WARNING_BITS} = \"" + . join("", map { sprintf("\\x%02x", ord $_) } split "", $to) + . "\"}\n\cK"; +} + +sub declare_hints { + my ($self, $from, $to) = @_; + my $use = $to & ~$from; + my $no = $from & ~$to; + my $decls = ""; + for my $pragma (hint_pragmas($use)) { + $decls .= $self->keyword("use") . " $pragma;\n"; + } + for my $pragma (hint_pragmas($no)) { + $decls .= $self->keyword("no") . " $pragma;\n"; + } + return $decls; +} + +# Internal implementation hints that the core sets automatically, so don't need +# (or want) to be passed back to the user +my %ignored_hints = ( + 'open<' => 1, + 'open>' => 1, + ':' => 1, + 'strict/refs' => 1, + 'strict/subs' => 1, + 'strict/vars' => 1, + 'feature/bits' => 1, +); + +my %rev_feature; + +sub declare_hinthash { + my ($self, $from, $to, $indent, $hints) = @_; + my $doing_features = + ($hints & $feature::hint_mask) == $feature::hint_mask; + my @decls; + my @features; + my @unfeatures; # bugs? + for my $key (sort keys %$to) { + next if $ignored_hints{$key}; + my $is_feature = $key =~ /^feature_/; + next if $is_feature and not $doing_features; + if (!exists $from->{$key} or $from->{$key} ne $to->{$key}) { + push(@features, $key), next if $is_feature; + push @decls, + qq(\$^H{) . single_delim("q", "'", $key, $self) . qq(} = ) + . ( + defined $to->{$key} + ? single_delim("q", "'", $to->{$key}, $self) + : 'undef' + ) + . qq(;); + } + } + for my $key (sort keys %$from) { + next if $ignored_hints{$key}; + my $is_feature = $key =~ /^feature_/; + next if $is_feature and not $doing_features; + if (!exists $to->{$key}) { + push(@unfeatures, $key), next if $is_feature; + push @decls, qq(delete \$^H{'$key'};); + } + } + my @ret; + if (@features || @unfeatures) { + if (!%rev_feature) { %rev_feature = reverse %feature::feature } + } + if (@features) { + push @ret, $self->keyword("use") . " feature " + . join(", ", map "'$rev_feature{$_}'", @features) . ";\n"; + } + if (@unfeatures) { + push @ret, $self->keyword("no") . " feature " + . join(", ", map "'$rev_feature{$_}'", @unfeatures) + . ";\n"; + } + @decls and + push @ret, + join("\n" . (" " x $indent), "BEGIN {", @decls) . "\n}\n\cK"; + return @ret; +} + +sub hint_pragmas { + my ($bits) = @_; + my (@pragmas, @strict); + push @pragmas, "integer" if $bits & 0x1; + for (sort keys %strict_bits) { + push @strict, "'$_'" if $bits & $strict_bits{$_}; + } + if (@strict == keys %strict_bits) { + push @pragmas, "strict"; + } + elsif (@strict) { + push @pragmas, "strict " . join ', ', @strict; + } + push @pragmas, "bytes" if $bits & 0x8; + return @pragmas; +} + +sub pp_dbstate { pp_nextstate(@_) } +sub pp_setstate { pp_nextstate(@_) } + +sub pp_unstack { return "" } # see also leaveloop + +my %feature_keywords = ( + # keyword => 'feature', + state => 'state', + say => 'say', + given => 'switch', + when => 'switch', + default => 'switch', + break => 'switch', + evalbytes=>'evalbytes', + __SUB__ => '__SUB__', + fc => 'fc', +); + +# keywords that are strong and also have a prototype +# +my %strong_proto_keywords = map { $_ => 1 } qw( + pos + prototype + scalar + study + undef +); + +sub feature_enabled { + my($self,$name) = @_; + my $hh; + my $hints = $self->{hints} & $feature::hint_mask; + if ($hints && $hints != $feature::hint_mask) { + $hh = _features_from_bundle($hints); + } + elsif ($hints) { $hh = $self->{'hinthash'} } + return $hh && $hh->{"feature_$feature_keywords{$name}"} +} + +sub keyword { + my $self = shift; + my $name = shift; + return $name if $name =~ /^CORE::/; # just in case + if (exists $feature_keywords{$name}) { + return "CORE::$name" if not $self->feature_enabled($name); + } + # This sub may be called for a program that has no nextstate ops. In + # that case we may have a lexical sub named no/use/sub in scope but + # $self->lex_in_scope will return false because it depends on the + # current nextstate op. So we need this alternate method if there is + # no current cop. + if (!$self->{'curcop'}) { + $self->populate_curcvlex() if !defined $self->{'curcvlex'}; + return "CORE::$name" if exists $self->{'curcvlex'}{"m&$name"} + || exists $self->{'curcvlex'}{"o&$name"}; + } elsif ($self->lex_in_scope("&$name") + || $self->lex_in_scope("&$name", 1)) { + return "CORE::$name"; + } + if ($strong_proto_keywords{$name} + || ($name !~ /^(?:chom?p|do|exec|glob|s(?:elect|ystem))\z/ + && !defined eval{prototype "CORE::$name"}) + ) { return $name } + if ( + exists $self->{subs_declared}{$name} + or + exists &{"$self->{curstash}::$name"} + ) { + return "CORE::$name" + } + return $name; +} + +sub baseop { + my $self = shift; + my($op, $cx, $name) = @_; + return $self->keyword($name); +} + +sub pp_stub { "()" } +sub pp_wantarray { baseop(@_, "wantarray") } +sub pp_fork { baseop(@_, "fork") } +sub pp_wait { maybe_targmy(@_, \&baseop, "wait") } +sub pp_getppid { maybe_targmy(@_, \&baseop, "getppid") } +sub pp_time { maybe_targmy(@_, \&baseop, "time") } +sub pp_tms { baseop(@_, "times") } +sub pp_ghostent { baseop(@_, "gethostent") } +sub pp_gnetent { baseop(@_, "getnetent") } +sub pp_gprotoent { baseop(@_, "getprotoent") } +sub pp_gservent { baseop(@_, "getservent") } +sub pp_ehostent { baseop(@_, "endhostent") } +sub pp_enetent { baseop(@_, "endnetent") } +sub pp_eprotoent { baseop(@_, "endprotoent") } +sub pp_eservent { baseop(@_, "endservent") } +sub pp_gpwent { baseop(@_, "getpwent") } +sub pp_spwent { baseop(@_, "setpwent") } +sub pp_epwent { baseop(@_, "endpwent") } +sub pp_ggrent { baseop(@_, "getgrent") } +sub pp_sgrent { baseop(@_, "setgrent") } +sub pp_egrent { baseop(@_, "endgrent") } +sub pp_getlogin { baseop(@_, "getlogin") } + +sub POSTFIX () { 1 } + +# I couldn't think of a good short name, but this is the category of +# symbolic unary operators with interesting precedence + +sub pfixop { + my $self = shift; + my($op, $cx, $name, $prec, $flags) = (@_, 0); + my $kid = $op->first; + $kid = $self->deparse($kid, $prec); + return $self->maybe_parens(($flags & POSTFIX) + ? "$kid$name" + # avoid confusion with filetests + : $name eq '-' + && $kid =~ /^[a-zA-Z](?!\w)/ + ? "$name($kid)" + : "$name$kid", + $cx, $prec); +} + +sub pp_preinc { pfixop(@_, "++", 23) } +sub pp_predec { pfixop(@_, "--", 23) } +sub pp_postinc { maybe_targmy(@_, \&pfixop, "++", 23, POSTFIX) } +sub pp_postdec { maybe_targmy(@_, \&pfixop, "--", 23, POSTFIX) } +sub pp_i_preinc { pfixop(@_, "++", 23) } +sub pp_i_predec { pfixop(@_, "--", 23) } +sub pp_i_postinc { maybe_targmy(@_, \&pfixop, "++", 23, POSTFIX) } +sub pp_i_postdec { maybe_targmy(@_, \&pfixop, "--", 23, POSTFIX) } +sub pp_complement { maybe_targmy(@_, \&pfixop, "~", 21) } +*pp_ncomplement = *pp_complement; +sub pp_scomplement { maybe_targmy(@_, \&pfixop, "~.", 21) } + +sub pp_negate { maybe_targmy(@_, \&real_negate) } +sub real_negate { + my $self = shift; + my($op, $cx) = @_; + if ($op->first->name =~ /^(i_)?negate$/) { + # avoid --$x + $self->pfixop($op, $cx, "-", 21.5); + } else { + $self->pfixop($op, $cx, "-", 21); + } +} +sub pp_i_negate { pp_negate(@_) } + +sub pp_not { + my $self = shift; + my($op, $cx) = @_; + if ($cx <= 4) { + $self->listop($op, $cx, "not", $op->first); + } else { + $self->pfixop($op, $cx, "!", 21); + } +} + +sub unop { + my $self = shift; + my($op, $cx, $name, $nollafr) = @_; + my $kid; + if ($op->flags & OPf_KIDS) { + $kid = $op->first; + if (not $name) { + # this deals with 'boolkeys' right now + return $self->deparse($kid,$cx); + } + my $builtinname = $name; + $builtinname =~ /^CORE::/ or $builtinname = "CORE::$name"; + if (defined prototype($builtinname) + && $builtinname ne 'CORE::readline' + && prototype($builtinname) =~ /^;?\*/ + && $kid->name eq "rv2gv") { + $kid = $kid->first; + } + + if ($nollafr) { + if (($kid = $self->deparse($kid, 16)) !~ s/^\cS//) { + # require foo() is a syntax error. + $kid =~ /^(?!\d)\w/ and $kid = "($kid)"; + } + return $self->maybe_parens( + $self->keyword($name) . " $kid", $cx, 16 + ); + } + return $self->maybe_parens_unop($name, $kid, $cx); + } else { + return $self->maybe_parens( + $self->keyword($name) . ($op->flags & OPf_SPECIAL ? "()" : ""), + $cx, 16, + ); + } +} + +sub pp_chop { maybe_targmy(@_, \&unop, "chop") } +sub pp_chomp { maybe_targmy(@_, \&unop, "chomp") } +sub pp_schop { maybe_targmy(@_, \&unop, "chop") } +sub pp_schomp { maybe_targmy(@_, \&unop, "chomp") } +sub pp_defined { unop(@_, "defined") } +sub pp_undef { unop(@_, "undef") } +sub pp_study { unop(@_, "study") } +sub pp_ref { unop(@_, "ref") } +sub pp_pos { maybe_local(@_, unop(@_, "pos")) } + +sub pp_sin { maybe_targmy(@_, \&unop, "sin") } +sub pp_cos { maybe_targmy(@_, \&unop, "cos") } +sub pp_rand { maybe_targmy(@_, \&unop, "rand") } +sub pp_srand { unop(@_, "srand") } +sub pp_exp { maybe_targmy(@_, \&unop, "exp") } +sub pp_log { maybe_targmy(@_, \&unop, "log") } +sub pp_sqrt { maybe_targmy(@_, \&unop, "sqrt") } +sub pp_int { maybe_targmy(@_, \&unop, "int") } +sub pp_hex { maybe_targmy(@_, \&unop, "hex") } +sub pp_oct { maybe_targmy(@_, \&unop, "oct") } +sub pp_abs { maybe_targmy(@_, \&unop, "abs") } + +sub pp_length { maybe_targmy(@_, \&unop, "length") } +sub pp_ord { maybe_targmy(@_, \&unop, "ord") } +sub pp_chr { maybe_targmy(@_, \&unop, "chr") } + +sub pp_each { unop(@_, "each") } +sub pp_values { unop(@_, "values") } +sub pp_keys { unop(@_, "keys") } +{ no strict 'refs'; *{"pp_r$_"} = *{"pp_$_"} for qw< keys each values >; } +sub pp_boolkeys { + # no name because its an optimisation op that has no keyword + unop(@_,""); +} +sub pp_aeach { unop(@_, "each") } +sub pp_avalues { unop(@_, "values") } +sub pp_akeys { unop(@_, "keys") } +sub pp_pop { unop(@_, "pop") } +sub pp_shift { unop(@_, "shift") } + +sub pp_caller { unop(@_, "caller") } +sub pp_reset { unop(@_, "reset") } +sub pp_exit { unop(@_, "exit") } +sub pp_prototype { unop(@_, "prototype") } + +sub pp_close { unop(@_, "close") } +sub pp_fileno { unop(@_, "fileno") } +sub pp_umask { unop(@_, "umask") } +sub pp_untie { unop(@_, "untie") } +sub pp_tied { unop(@_, "tied") } +sub pp_dbmclose { unop(@_, "dbmclose") } +sub pp_getc { unop(@_, "getc") } +sub pp_eof { unop(@_, "eof") } +sub pp_tell { unop(@_, "tell") } +sub pp_getsockname { unop(@_, "getsockname") } +sub pp_getpeername { unop(@_, "getpeername") } + +sub pp_chdir { + my ($self, $op, $cx) = @_; + if (($op->flags & (OPf_SPECIAL|OPf_KIDS)) == (OPf_SPECIAL|OPf_KIDS)) { + my $kw = $self->keyword("chdir"); + my $kid = $self->const_sv($op->first)->PV; + my $code = $kw + . ($cx >= 16 || $self->{'parens'} ? "($kid)" : " $kid"); + maybe_targmy(@_, sub { $_[3] }, $code); + } else { + maybe_targmy(@_, \&unop, "chdir") + } +} + +sub pp_chroot { maybe_targmy(@_, \&unop, "chroot") } +sub pp_readlink { unop(@_, "readlink") } +sub pp_rmdir { maybe_targmy(@_, \&unop, "rmdir") } +sub pp_readdir { unop(@_, "readdir") } +sub pp_telldir { unop(@_, "telldir") } +sub pp_rewinddir { unop(@_, "rewinddir") } +sub pp_closedir { unop(@_, "closedir") } +sub pp_getpgrp { maybe_targmy(@_, \&unop, "getpgrp") } +sub pp_localtime { unop(@_, "localtime") } +sub pp_gmtime { unop(@_, "gmtime") } +sub pp_alarm { unop(@_, "alarm") } +sub pp_sleep { maybe_targmy(@_, \&unop, "sleep") } + +sub pp_dofile { + my $code = unop(@_, "do", 1); # llafr does not apply + if ($code =~ s/^((?:CORE::)?do) \{/$1({/) { $code .= ')' } + $code; +} +sub pp_entereval { + unop( + @_, + $_[1]->private & OPpEVAL_BYTES ? 'evalbytes' : "eval" + ) +} + +sub pp_ghbyname { unop(@_, "gethostbyname") } +sub pp_gnbyname { unop(@_, "getnetbyname") } +sub pp_gpbyname { unop(@_, "getprotobyname") } +sub pp_shostent { unop(@_, "sethostent") } +sub pp_snetent { unop(@_, "setnetent") } +sub pp_sprotoent { unop(@_, "setprotoent") } +sub pp_sservent { unop(@_, "setservent") } +sub pp_gpwnam { unop(@_, "getpwnam") } +sub pp_gpwuid { unop(@_, "getpwuid") } +sub pp_ggrnam { unop(@_, "getgrnam") } +sub pp_ggrgid { unop(@_, "getgrgid") } + +sub pp_lock { unop(@_, "lock") } + +sub pp_continue { unop(@_, "continue"); } +sub pp_break { unop(@_, "break"); } + +sub givwhen { + my $self = shift; + my($op, $cx, $givwhen) = @_; + + my $enterop = $op->first; + my ($head, $block); + if ($enterop->flags & OPf_SPECIAL) { + $head = $self->keyword("default"); + $block = $self->deparse($enterop->first, 0); + } + else { + my $cond = $enterop->first; + my $cond_str = $self->deparse($cond, 1); + $head = "$givwhen ($cond_str)"; + $block = $self->deparse($cond->sibling, 0); + } + + return "$head {\n". + "\t$block\n". + "\b}\cK"; +} + +sub pp_leavegiven { givwhen(@_, $_[0]->keyword("given")); } +sub pp_leavewhen { givwhen(@_, $_[0]->keyword("when")); } + +sub pp_exists { + my $self = shift; + my($op, $cx) = @_; + my $arg; + my $name = $self->keyword("exists"); + if ($op->private & OPpEXISTS_SUB) { + # Checking for the existence of a subroutine + return $self->maybe_parens_func($name, + $self->pp_rv2cv($op->first, 16), $cx, 16); + } + if ($op->flags & OPf_SPECIAL) { + # Array element, not hash element + return $self->maybe_parens_func($name, + $self->pp_aelem($op->first, 16), $cx, 16); + } + return $self->maybe_parens_func($name, $self->pp_helem($op->first, 16), + $cx, 16); +} + +sub pp_delete { + my $self = shift; + my($op, $cx) = @_; + my $arg; + my $name = $self->keyword("delete"); + if ($op->private & (OPpSLICE|OPpKVSLICE)) { + if ($op->flags & OPf_SPECIAL) { + # Deleting from an array, not a hash + return $self->maybe_parens_func($name, + $self->pp_aslice($op->first, 16), + $cx, 16); + } + return $self->maybe_parens_func($name, + $self->pp_hslice($op->first, 16), + $cx, 16); + } else { + if ($op->flags & OPf_SPECIAL) { + # Deleting from an array, not a hash + return $self->maybe_parens_func($name, + $self->pp_aelem($op->first, 16), + $cx, 16); + } + return $self->maybe_parens_func($name, + $self->pp_helem($op->first, 16), + $cx, 16); + } +} + +sub pp_require { + my $self = shift; + my($op, $cx) = @_; + my $opname = $op->flags & OPf_SPECIAL ? 'CORE::require' : 'require'; + my $kid = $op->first; + if ($kid->name eq 'const') { + my $priv = $kid->private; + my $sv = $self->const_sv($kid); + my $arg; + if ($priv & OPpCONST_BARE) { + $arg = $sv->PV; + $arg =~ s[/][::]g; + $arg =~ s/\.pm//g; + } elsif ($priv & OPpCONST_NOVER) { + $opname = $self->keyword('no'); + $arg = $self->const($sv, 16); + } elsif ((my $tmp = $self->const($sv, 16)) =~ /^v/) { + $arg = $tmp; + } + if ($arg) { + return $self->maybe_parens("$opname $arg", $cx, 16); + } + } + $self->unop( + $op, $cx, + $opname, + 1, # llafr does not apply + ); +} + +sub pp_scalar { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + if (not null $kid->sibling) { + # XXX Was a here-doc + return $self->dquote($op); + } + $self->unop(@_, "scalar"); +} + + +sub padval { + my $self = shift; + my $targ = shift; + return $self->{'curcv'}->PADLIST->ARRAYelt(1)->ARRAYelt($targ); +} + +sub anon_hash_or_list { + my $self = shift; + my($op, $cx) = @_; + + my($pre, $post) = @{{"anonlist" => ["[","]"], + "anonhash" => ["{","}"]}->{$op->name}}; + my($expr, @exprs); + $op = $op->first->sibling; # skip pushmark + for (; !null($op); $op = $op->sibling) { + $expr = $self->deparse($op, 6); + push @exprs, $expr; + } + if ($pre eq "{" and $cx < 1) { + # Disambiguate that it's not a block + $pre = "+{"; + } + return $pre . join(", ", @exprs) . $post; +} + +sub pp_anonlist { + my $self = shift; + my ($op, $cx) = @_; + if ($op->flags & OPf_SPECIAL) { + return $self->anon_hash_or_list($op, $cx); + } + warn "Unexpected op pp_" . $op->name() . " without OPf_SPECIAL"; + return 'XXX'; +} + +*pp_anonhash = \&pp_anonlist; + +sub pp_refgen { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + if ($kid->name eq "null") { + my $anoncode = $kid = $kid->first; + if ($anoncode->name eq "anonconst") { + $anoncode = $anoncode->first->first->sibling; + } + if ($anoncode->name eq "anoncode" + or !null($anoncode = $kid->sibling) and + $anoncode->name eq "anoncode") { + return $self->e_anoncode({ code => $self->padval($anoncode->targ) }); + } elsif ($kid->name eq "pushmark") { + my $sib_name = $kid->sibling->name; + if ($sib_name eq 'entersub') { + my $text = $self->deparse($kid->sibling, 1); + # Always show parens for \(&func()), but only with -p otherwise + $text = "($text)" if $self->{'parens'} + or $kid->sibling->private & OPpENTERSUB_AMPER; + return "\\$text"; + } + } + } + local $self->{'in_refgen'} = 1; + $self->pfixop($op, $cx, "\\", 20); +} + +sub e_anoncode { + my ($self, $info) = @_; + my $text = $self->deparse_sub($info->{code}); + return $self->keyword("sub") . " $text"; +} + +sub pp_srefgen { pp_refgen(@_) } + +sub pp_readline { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + if (is_scalar($kid) + and $op->flags & OPf_SPECIAL + and $self->deparse($kid, 1) eq 'ARGV') + { + return '<<>>'; + } + return $self->unop($op, $cx, "readline"); +} + +sub pp_rcatline { + my $self = shift; + my($op) = @_; + return "<" . $self->gv_name($self->gv_or_padgv($op)) . ">"; +} + +# Unary operators that can occur as pseudo-listops inside double quotes +sub dq_unop { + my $self = shift; + my($op, $cx, $name, $prec, $flags) = (@_, 0, 0); + my $kid; + if ($op->flags & OPf_KIDS) { + $kid = $op->first; + # If there's more than one kid, the first is an ex-pushmark. + $kid = $kid->sibling if not null $kid->sibling; + return $self->maybe_parens_unop($name, $kid, $cx); + } else { + return $name . ($op->flags & OPf_SPECIAL ? "()" : ""); + } +} + +sub pp_ucfirst { dq_unop(@_, "ucfirst") } +sub pp_lcfirst { dq_unop(@_, "lcfirst") } +sub pp_uc { dq_unop(@_, "uc") } +sub pp_lc { dq_unop(@_, "lc") } +sub pp_quotemeta { maybe_targmy(@_, \&dq_unop, "quotemeta") } +sub pp_fc { dq_unop(@_, "fc") } + +sub loopex { + my $self = shift; + my ($op, $cx, $name) = @_; + if (class($op) eq "PVOP") { + $name .= " " . $op->pv; + } elsif (class($op) eq "OP") { + # no-op + } elsif (class($op) eq "UNOP") { + (my $kid = $self->deparse($op->first, 7)) =~ s/^\cS//; + # last foo() is a syntax error. + $kid =~ /^(?!\d)\w/ and $kid = "($kid)"; + $name .= " $kid"; + } + return $self->maybe_parens($name, $cx, 7); +} + +sub pp_last { loopex(@_, "last") } +sub pp_next { loopex(@_, "next") } +sub pp_redo { loopex(@_, "redo") } +sub pp_goto { loopex(@_, "goto") } +sub pp_dump { loopex(@_, "CORE::dump") } + +sub ftst { + my $self = shift; + my($op, $cx, $name) = @_; + if (class($op) eq "UNOP") { + # Genuine '-X' filetests are exempt from the LLAFR, but not + # l?stat() + if ($name =~ /^-/) { + (my $kid = $self->deparse($op->first, 16)) =~ s/^\cS//; + return $self->maybe_parens("$name $kid", $cx, 16); + } + return $self->maybe_parens_unop($name, $op->first, $cx); + } elsif (class($op) =~ /^(SV|PAD)OP$/) { + return $self->maybe_parens_func($name, $self->pp_gv($op, 1), $cx, 16); + } else { # I don't think baseop filetests ever survive ck_ftst, but... + return $name; + } +} + +sub pp_lstat { ftst(@_, "lstat") } +sub pp_stat { ftst(@_, "stat") } +sub pp_ftrread { ftst(@_, "-R") } +sub pp_ftrwrite { ftst(@_, "-W") } +sub pp_ftrexec { ftst(@_, "-X") } +sub pp_fteread { ftst(@_, "-r") } +sub pp_ftewrite { ftst(@_, "-w") } +sub pp_fteexec { ftst(@_, "-x") } +sub pp_ftis { ftst(@_, "-e") } +sub pp_fteowned { ftst(@_, "-O") } +sub pp_ftrowned { ftst(@_, "-o") } +sub pp_ftzero { ftst(@_, "-z") } +sub pp_ftsize { ftst(@_, "-s") } +sub pp_ftmtime { ftst(@_, "-M") } +sub pp_ftatime { ftst(@_, "-A") } +sub pp_ftctime { ftst(@_, "-C") } +sub pp_ftsock { ftst(@_, "-S") } +sub pp_ftchr { ftst(@_, "-c") } +sub pp_ftblk { ftst(@_, "-b") } +sub pp_ftfile { ftst(@_, "-f") } +sub pp_ftdir { ftst(@_, "-d") } +sub pp_ftpipe { ftst(@_, "-p") } +sub pp_ftlink { ftst(@_, "-l") } +sub pp_ftsuid { ftst(@_, "-u") } +sub pp_ftsgid { ftst(@_, "-g") } +sub pp_ftsvtx { ftst(@_, "-k") } +sub pp_fttty { ftst(@_, "-t") } +sub pp_fttext { ftst(@_, "-T") } +sub pp_ftbinary { ftst(@_, "-B") } + +sub SWAP_CHILDREN () { 1 } +sub ASSIGN () { 2 } # has OP= variant +sub LIST_CONTEXT () { 4 } # Assignment is in list context + +my(%left, %right); + +sub assoc_class { + my $op = shift; + my $name = $op->name; + if ($name eq "concat" and $op->first->name eq "concat") { + # avoid spurious '=' -- see comment in pp_concat + return "concat"; + } + if ($name eq "null" and class($op) eq "UNOP" + and $op->first->name =~ /^(and|x?or)$/ + and null $op->first->sibling) + { + # Like all conditional constructs, OP_ANDs and OP_ORs are topped + # with a null that's used as the common end point of the two + # flows of control. For precedence purposes, ignore it. + # (COND_EXPRs have these too, but we don't bother with + # their associativity). + return assoc_class($op->first); + } + return $name . ($op->flags & OPf_STACKED ? "=" : ""); +} + +# Left associative operators, like '+', for which +# $a + $b + $c is equivalent to ($a + $b) + $c + +BEGIN { + %left = ('multiply' => 19, 'i_multiply' => 19, + 'divide' => 19, 'i_divide' => 19, + 'modulo' => 19, 'i_modulo' => 19, + 'repeat' => 19, + 'add' => 18, 'i_add' => 18, + 'subtract' => 18, 'i_subtract' => 18, + 'concat' => 18, + 'left_shift' => 17, 'right_shift' => 17, + 'bit_and' => 13, 'nbit_and' => 13, 'sbit_and' => 13, + 'bit_or' => 12, 'bit_xor' => 12, + 'sbit_or' => 12, 'sbit_xor' => 12, + 'nbit_or' => 12, 'nbit_xor' => 12, + 'and' => 3, + 'or' => 2, 'xor' => 2, + ); +} + +sub deparse_binop_left { + my $self = shift; + my($op, $left, $prec) = @_; + if ($left{assoc_class($op)} && $left{assoc_class($left)} + and $left{assoc_class($op)} == $left{assoc_class($left)}) + { + return $self->deparse($left, $prec - .00001); + } else { + return $self->deparse($left, $prec); + } +} + +# Right associative operators, like '=', for which +# $a = $b = $c is equivalent to $a = ($b = $c) + +BEGIN { + %right = ('pow' => 22, + 'sassign=' => 7, 'aassign=' => 7, + 'multiply=' => 7, 'i_multiply=' => 7, + 'divide=' => 7, 'i_divide=' => 7, + 'modulo=' => 7, 'i_modulo=' => 7, + 'repeat=' => 7, 'refassign' => 7, 'refassign=' => 7, + 'add=' => 7, 'i_add=' => 7, + 'subtract=' => 7, 'i_subtract=' => 7, + 'concat=' => 7, + 'left_shift=' => 7, 'right_shift=' => 7, + 'bit_and=' => 7, 'sbit_and=' => 7, 'nbit_and=' => 7, + 'nbit_or=' => 7, 'nbit_xor=' => 7, + 'sbit_or=' => 7, 'sbit_xor=' => 7, + 'andassign' => 7, + 'orassign' => 7, + ); +} + +sub deparse_binop_right { + my $self = shift; + my($op, $right, $prec) = @_; + if ($right{assoc_class($op)} && $right{assoc_class($right)} + and $right{assoc_class($op)} == $right{assoc_class($right)}) + { + return $self->deparse($right, $prec - .00001); + } else { + return $self->deparse($right, $prec); + } +} + +sub binop { + my $self = shift; + my ($op, $cx, $opname, $prec, $flags) = (@_, 0); + my $left = $op->first; + my $right = $op->last; + my $eq = ""; + if ($op->flags & OPf_STACKED && $flags & ASSIGN) { + $eq = "="; + $prec = 7; + } + if ($flags & SWAP_CHILDREN) { + ($left, $right) = ($right, $left); + } + my $leftop = $left; + $left = $self->deparse_binop_left($op, $left, $prec); + $left = "($left)" if $flags & LIST_CONTEXT + and $left !~ /^(my|our|local|state|)\s*[\@%\(]/ + || do { + # Parenthesize if the left argument is a + # lone repeat op. + my $left = $leftop->first->sibling; + $left->name eq 'repeat' + && null($left->sibling); + }; + $right = $self->deparse_binop_right($op, $right, $prec); + return $self->maybe_parens("$left $opname$eq $right", $cx, $prec); +} + +sub pp_add { maybe_targmy(@_, \&binop, "+", 18, ASSIGN) } +sub pp_multiply { maybe_targmy(@_, \&binop, "*", 19, ASSIGN) } +sub pp_subtract { maybe_targmy(@_, \&binop, "-",18, ASSIGN) } +sub pp_divide { maybe_targmy(@_, \&binop, "/", 19, ASSIGN) } +sub pp_modulo { maybe_targmy(@_, \&binop, "%", 19, ASSIGN) } +sub pp_i_add { maybe_targmy(@_, \&binop, "+", 18, ASSIGN) } +sub pp_i_multiply { maybe_targmy(@_, \&binop, "*", 19, ASSIGN) } +sub pp_i_subtract { maybe_targmy(@_, \&binop, "-", 18, ASSIGN) } +sub pp_i_divide { maybe_targmy(@_, \&binop, "/", 19, ASSIGN) } +sub pp_i_modulo { maybe_targmy(@_, \&binop, "%", 19, ASSIGN) } +sub pp_pow { maybe_targmy(@_, \&binop, "**", 22, ASSIGN) } + +sub pp_left_shift { maybe_targmy(@_, \&binop, "<<", 17, ASSIGN) } +sub pp_right_shift { maybe_targmy(@_, \&binop, ">>", 17, ASSIGN) } +sub pp_bit_and { maybe_targmy(@_, \&binop, "&", 13, ASSIGN) } +sub pp_bit_or { maybe_targmy(@_, \&binop, "|", 12, ASSIGN) } +sub pp_bit_xor { maybe_targmy(@_, \&binop, "^", 12, ASSIGN) } +*pp_nbit_and = *pp_bit_and; +*pp_nbit_or = *pp_bit_or; +*pp_nbit_xor = *pp_bit_xor; +sub pp_sbit_and { maybe_targmy(@_, \&binop, "&.", 13, ASSIGN) } +sub pp_sbit_or { maybe_targmy(@_, \&binop, "|.", 12, ASSIGN) } +sub pp_sbit_xor { maybe_targmy(@_, \&binop, "^.", 12, ASSIGN) } + +sub pp_eq { binop(@_, "==", 14) } +sub pp_ne { binop(@_, "!=", 14) } +sub pp_lt { binop(@_, "<", 15) } +sub pp_gt { binop(@_, ">", 15) } +sub pp_ge { binop(@_, ">=", 15) } +sub pp_le { binop(@_, "<=", 15) } +sub pp_ncmp { binop(@_, "<=>", 14) } +sub pp_i_eq { binop(@_, "==", 14) } +sub pp_i_ne { binop(@_, "!=", 14) } +sub pp_i_lt { binop(@_, "<", 15) } +sub pp_i_gt { binop(@_, ">", 15) } +sub pp_i_ge { binop(@_, ">=", 15) } +sub pp_i_le { binop(@_, "<=", 15) } +sub pp_i_ncmp { maybe_targmy(@_, \&binop, "<=>", 14) } + +sub pp_seq { binop(@_, "eq", 14) } +sub pp_sne { binop(@_, "ne", 14) } +sub pp_slt { binop(@_, "lt", 15) } +sub pp_sgt { binop(@_, "gt", 15) } +sub pp_sge { binop(@_, "ge", 15) } +sub pp_sle { binop(@_, "le", 15) } +sub pp_scmp { maybe_targmy(@_, \&binop, "cmp", 14) } + +sub pp_isa { binop(@_, "isa", 15) } + +sub pp_sassign { binop(@_, "=", 7, SWAP_CHILDREN) } +sub pp_aassign { binop(@_, "=", 7, SWAP_CHILDREN | LIST_CONTEXT) } + +sub pp_smartmatch { + my ($self, $op, $cx) = @_; + if (($op->flags & OPf_SPECIAL) && $self->{expand} < 2) { + return $self->deparse($op->last, $cx); + } + else { + binop(@_, "~~", 14); + } +} + +# '.' is special because concats-of-concats are optimized to save copying +# by making all but the first concat stacked. The effect is as if the +# programmer had written '($a . $b) .= $c', except legal. +sub pp_concat { maybe_targmy(@_, \&real_concat) } +sub real_concat { + my $self = shift; + my($op, $cx) = @_; + my $left = $op->first; + my $right = $op->last; + my $eq = ""; + my $prec = 18; + if (($op->flags & OPf_STACKED) and !($op->private & OPpCONCAT_NESTED)) { + # '.=' rather than optimised '.' + $eq = "="; + $prec = 7; + } + $left = $self->deparse_binop_left($op, $left, $prec); + $right = $self->deparse_binop_right($op, $right, $prec); + return $self->maybe_parens("$left .$eq $right", $cx, $prec); +} + +sub pp_repeat { maybe_targmy(@_, \&repeat) } + +# 'x' is weird when the left arg is a list +sub repeat { + my $self = shift; + my($op, $cx) = @_; + my $left = $op->first; + my $right = $op->last; + my $eq = ""; + my $prec = 19; + if ($op->flags & OPf_STACKED) { + $eq = "="; + $prec = 7; + } + if (null($right)) { # list repeat; count is inside left-side ex-list + # in 5.21.5 and earlier + my $kid = $left->first->sibling; # skip pushmark + my @exprs; + for (; !null($kid->sibling); $kid = $kid->sibling) { + push @exprs, $self->deparse($kid, 6); + } + $right = $kid; + $left = "(" . join(", ", @exprs). ")"; + } else { + my $dolist = $op->private & OPpREPEAT_DOLIST; + $left = $self->deparse_binop_left($op, $left, $dolist ? 1 : $prec); + if ($dolist) { + $left = "($left)"; + } + } + $right = $self->deparse_binop_right($op, $right, $prec); + return $self->maybe_parens("$left x$eq $right", $cx, $prec); +} + +sub range { + my $self = shift; + my ($op, $cx, $type) = @_; + my $left = $op->first; + my $right = $left->sibling; + $left = $self->deparse($left, 9); + $right = $self->deparse($right, 9); + return $self->maybe_parens("$left $type $right", $cx, 9); +} + +sub pp_flop { + my $self = shift; + my($op, $cx) = @_; + my $flip = $op->first; + my $type = ($flip->flags & OPf_SPECIAL) ? "..." : ".."; + return $self->range($flip->first, $cx, $type); +} + +# one-line while/until is handled in pp_leave + +sub logop { + my $self = shift; + my ($op, $cx, $lowop, $lowprec, $highop, $highprec, $blockname) = @_; + my $left = $op->first; + my $right = $op->first->sibling; + $blockname &&= $self->keyword($blockname); + if ($cx < 1 and is_scope($right) and $blockname + and $self->{'expand'} < 7) + { # if ($a) {$b} + $left = $self->deparse($left, 1); + $right = $self->deparse($right, 0); + return "$blockname ($left) {\n\t$right\n\b}\cK"; + } elsif ($cx < 1 and $blockname and not $self->{'parens'} + and $self->{'expand'} < 7) { # $b if $a + $right = $self->deparse($right, 1); + $left = $self->deparse($left, 1); + return "$right $blockname $left"; + } elsif ($cx > $lowprec and $highop) { # $a && $b + $left = $self->deparse_binop_left($op, $left, $highprec); + $right = $self->deparse_binop_right($op, $right, $highprec); + return $self->maybe_parens("$left $highop $right", $cx, $highprec); + } else { # $a and $b + $left = $self->deparse_binop_left($op, $left, $lowprec); + $right = $self->deparse_binop_right($op, $right, $lowprec); + return $self->maybe_parens("$left $lowop $right", $cx, $lowprec); + } +} + +sub pp_and { logop(@_, "and", 3, "&&", 11, "if") } +sub pp_or { logop(@_, "or", 2, "||", 10, "unless") } +sub pp_dor { logop(@_, "//", 10) } + +# xor is syntactically a logop, but it's really a binop (contrary to +# old versions of opcode.pl). Syntax is what matters here. +sub pp_xor { logop(@_, "xor", 2, "", 0, "") } + +sub logassignop { + my $self = shift; + my ($op, $cx, $opname) = @_; + my $left = $op->first; + my $right = $op->first->sibling->first; # skip sassign + $left = $self->deparse($left, 7); + $right = $self->deparse($right, 7); + return $self->maybe_parens("$left $opname $right", $cx, 7); +} + +sub pp_andassign { logassignop(@_, "&&=") } +sub pp_orassign { logassignop(@_, "||=") } +sub pp_dorassign { logassignop(@_, "//=") } + +my %cmpchain_cmpops = ( + eq => ["==", 14], + i_eq => ["==", 14], + ne => ["!=", 14], + i_ne => ["!=", 14], + seq => ["eq", 14], + sne => ["ne", 14], + lt => ["<", 15], + i_lt => ["<", 15], + gt => [">", 15], + i_gt => [">", 15], + le => ["<=", 15], + i_le => ["<=", 15], + ge => [">=", 15], + i_ge => [">=", 15], + slt => ["lt", 15], + sgt => ["gt", 15], + sle => ["le", 15], + sge => ["ge", 15], +); +sub pp_cmpchain_and { + my($self, $op, $cx) = @_; + my($prec, $dep); + while(1) { + my($thiscmp, $rightcond); + if($op->name eq "cmpchain_and") { + $thiscmp = $op->first; + $rightcond = $thiscmp->sibling; + } else { + $thiscmp = $op; + } + my $thiscmptype = $cmpchain_cmpops{$thiscmp->name} // (return "XXX"); + if(defined $prec) { + $thiscmptype->[1] == $prec or return "XXX"; + $thiscmp->first->name eq "null" && + !($thiscmp->first->flags & OPf_KIDS) + or return "XXX"; + } else { + $prec = $thiscmptype->[1]; + $dep = $self->deparse($thiscmp->first, $prec); + } + $dep .= " ".$thiscmptype->[0]." "; + my $operand = $thiscmp->last; + if(defined $rightcond) { + $operand->name eq "cmpchain_dup" or return "XXX"; + $operand = $operand->first; + } + $dep .= $self->deparse($operand, $prec); + last unless defined $rightcond; + if($rightcond->name eq "null" && ($rightcond->flags & OPf_KIDS) && + $rightcond->first->name eq "cmpchain_and") { + $rightcond = $rightcond->first; + } + $op = $rightcond; + } + return $self->maybe_parens($dep, $cx, $prec); +} + +sub rv2gv_or_string { + my($self,$op) = @_; + if ($op->name eq "gv") { # could be open("open") or open("###") + my($name,$quoted) = + $self->stash_variable_name("", $self->gv_or_padgv($op)); + $quoted ? $name : "*$name"; + } + else { + $self->deparse($op, 6); + } +} + +sub listop { + my $self = shift; + my($op, $cx, $name, $kid, $nollafr) = @_; + my(@exprs); + my $parens = ($cx >= 5) || $self->{'parens'}; + $kid ||= $op->first->sibling; + # If there are no arguments, add final parentheses (or parenthesize the + # whole thing if the llafr does not apply) to account for cases like + # (return)+1 or setpgrp()+1. When the llafr does not apply, we use a + # precedence of 6 (< comma), as "return, 1" does not need parentheses. + if (null $kid) { + return $nollafr + ? $self->maybe_parens($self->keyword($name), $cx, 7) + : $self->keyword($name) . '()' x (7 < $cx); + } + my $first; + my $fullname = $self->keyword($name); + my $proto = prototype("CORE::$name"); + if ( + ( (defined $proto && $proto =~ /^;?\*/) + || $name eq 'select' # select(F) doesn't have a proto + ) + && $kid->name eq "rv2gv" + && !($kid->private & OPpLVAL_INTRO) + ) { + $first = $self->rv2gv_or_string($kid->first); + } + else { + $first = $self->deparse($kid, 6); + } + if ($name eq "chmod" && $first =~ /^\d+$/) { + $first = sprintf("%#o", $first); + } + $first = "+$first" + if not $parens and not $nollafr and substr($first, 0, 1) eq "("; + push @exprs, $first; + $kid = $kid->sibling; + if (defined $proto && $proto =~ /^\*\*/ && $kid->name eq "rv2gv" + && !($kid->private & OPpLVAL_INTRO)) { + push @exprs, $first = $self->rv2gv_or_string($kid->first); + $kid = $kid->sibling; + } + for (; !null($kid); $kid = $kid->sibling) { + push @exprs, $self->deparse($kid, 6); + } + if ($name eq "reverse" && ($op->private & OPpREVERSE_INPLACE)) { + return "$exprs[0] = $fullname" + . ($parens ? "($exprs[0])" : " $exprs[0]"); + } + + if ($parens && $nollafr) { + return "($fullname " . join(", ", @exprs) . ")"; + } elsif ($parens) { + return "$fullname(" . join(", ", @exprs) . ")"; + } else { + return "$fullname " . join(", ", @exprs); + } +} + +sub pp_bless { listop(@_, "bless") } +sub pp_atan2 { maybe_targmy(@_, \&listop, "atan2") } +sub pp_substr { + my ($self,$op,$cx) = @_; + if ($op->private & OPpSUBSTR_REPL_FIRST) { + return + listop($self, $op, 7, "substr", $op->first->sibling->sibling) + . " = " + . $self->deparse($op->first->sibling, 7); + } + maybe_local(@_, listop(@_, "substr")) +} + +sub pp_index { + # Also handles pp_rindex. + # + # The body of this function includes an unrolled maybe_targmy(), + # since the two parts of that sub's actions need to have have the + # '== -1' bit in between + + my($self, $op, $cx) = @_; + + my $lex = ($op->private & OPpTARGET_MY); + my $bool = ($op->private & OPpTRUEBOOL); + + my $val = $self->listop($op, ($bool ? 14 : $lex ? 7 : $cx), $op->name); + + # (index() == -1) has op_eq and op_const optimised away + if ($bool) { + $val .= ($op->private & OPpINDEX_BOOLNEG) ? " == -1" : " != -1"; + $val = "($val)" if ($op->flags & OPf_PARENS); + } + if ($lex) { + my $var = $self->padname($op->targ); + $val = $self->maybe_parens("$var = $val", $cx, 7); + } + $val; +} + +sub pp_rindex { pp_index(@_); } +sub pp_vec { maybe_targmy(@_, \&maybe_local, listop(@_, "vec")) } +sub pp_sprintf { maybe_targmy(@_, \&listop, "sprintf") } +sub pp_formline { listop(@_, "formline") } # see also deparse_format +sub pp_crypt { maybe_targmy(@_, \&listop, "crypt") } +sub pp_unpack { listop(@_, "unpack") } +sub pp_pack { listop(@_, "pack") } +sub pp_join { maybe_targmy(@_, \&listop, "join") } +sub pp_splice { listop(@_, "splice") } +sub pp_push { maybe_targmy(@_, \&listop, "push") } +sub pp_unshift { maybe_targmy(@_, \&listop, "unshift") } +sub pp_reverse { listop(@_, "reverse") } +sub pp_warn { listop(@_, "warn") } +sub pp_die { listop(@_, "die") } +sub pp_return { listop(@_, "return", undef, 1) } # llafr does not apply +sub pp_open { listop(@_, "open") } +sub pp_pipe_op { listop(@_, "pipe") } +sub pp_tie { listop(@_, "tie") } +sub pp_binmode { listop(@_, "binmode") } +sub pp_dbmopen { listop(@_, "dbmopen") } +sub pp_sselect { listop(@_, "select") } +sub pp_select { listop(@_, "select") } +sub pp_read { listop(@_, "read") } +sub pp_sysopen { listop(@_, "sysopen") } +sub pp_sysseek { listop(@_, "sysseek") } +sub pp_sysread { listop(@_, "sysread") } +sub pp_syswrite { listop(@_, "syswrite") } +sub pp_send { listop(@_, "send") } +sub pp_recv { listop(@_, "recv") } +sub pp_seek { listop(@_, "seek") } +sub pp_fcntl { listop(@_, "fcntl") } +sub pp_ioctl { listop(@_, "ioctl") } +sub pp_flock { maybe_targmy(@_, \&listop, "flock") } +sub pp_socket { listop(@_, "socket") } +sub pp_sockpair { listop(@_, "socketpair") } +sub pp_bind { listop(@_, "bind") } +sub pp_connect { listop(@_, "connect") } +sub pp_listen { listop(@_, "listen") } +sub pp_accept { listop(@_, "accept") } +sub pp_shutdown { listop(@_, "shutdown") } +sub pp_gsockopt { listop(@_, "getsockopt") } +sub pp_ssockopt { listop(@_, "setsockopt") } +sub pp_chown { maybe_targmy(@_, \&listop, "chown") } +sub pp_unlink { maybe_targmy(@_, \&listop, "unlink") } +sub pp_chmod { maybe_targmy(@_, \&listop, "chmod") } +sub pp_utime { maybe_targmy(@_, \&listop, "utime") } +sub pp_rename { maybe_targmy(@_, \&listop, "rename") } +sub pp_link { maybe_targmy(@_, \&listop, "link") } +sub pp_symlink { maybe_targmy(@_, \&listop, "symlink") } +sub pp_mkdir { maybe_targmy(@_, \&listop, "mkdir") } +sub pp_open_dir { listop(@_, "opendir") } +sub pp_seekdir { listop(@_, "seekdir") } +sub pp_waitpid { maybe_targmy(@_, \&listop, "waitpid") } +sub pp_system { maybe_targmy(@_, \&indirop, "system") } +sub pp_exec { maybe_targmy(@_, \&indirop, "exec") } +sub pp_kill { maybe_targmy(@_, \&listop, "kill") } +sub pp_setpgrp { maybe_targmy(@_, \&listop, "setpgrp") } +sub pp_getpriority { maybe_targmy(@_, \&listop, "getpriority") } +sub pp_setpriority { maybe_targmy(@_, \&listop, "setpriority") } +sub pp_shmget { listop(@_, "shmget") } +sub pp_shmctl { listop(@_, "shmctl") } +sub pp_shmread { listop(@_, "shmread") } +sub pp_shmwrite { listop(@_, "shmwrite") } +sub pp_msgget { listop(@_, "msgget") } +sub pp_msgctl { listop(@_, "msgctl") } +sub pp_msgsnd { listop(@_, "msgsnd") } +sub pp_msgrcv { listop(@_, "msgrcv") } +sub pp_semget { listop(@_, "semget") } +sub pp_semctl { listop(@_, "semctl") } +sub pp_semop { listop(@_, "semop") } +sub pp_ghbyaddr { listop(@_, "gethostbyaddr") } +sub pp_gnbyaddr { listop(@_, "getnetbyaddr") } +sub pp_gpbynumber { listop(@_, "getprotobynumber") } +sub pp_gsbyname { listop(@_, "getservbyname") } +sub pp_gsbyport { listop(@_, "getservbyport") } +sub pp_syscall { listop(@_, "syscall") } + +sub pp_glob { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first->sibling; # skip pushmark + my $keyword = + $op->flags & OPf_SPECIAL ? 'glob' : $self->keyword('glob'); + my $text = $self->deparse($kid, $cx); + return $cx >= 5 || $self->{'parens'} + ? "$keyword($text)" + : "$keyword $text"; +} + +# Truncate is special because OPf_SPECIAL makes a bareword first arg +# be a filehandle. This could probably be better fixed in the core +# by moving the GV lookup into ck_truc. + +sub pp_truncate { + my $self = shift; + my($op, $cx) = @_; + my(@exprs); + my $parens = ($cx >= 5) || $self->{'parens'}; + my $kid = $op->first->sibling; + my $fh; + if ($op->flags & OPf_SPECIAL) { + # $kid is an OP_CONST + $fh = $self->const_sv($kid)->PV; + } else { + $fh = $self->deparse($kid, 6); + $fh = "+$fh" if not $parens and substr($fh, 0, 1) eq "("; + } + my $len = $self->deparse($kid->sibling, 6); + my $name = $self->keyword('truncate'); + if ($parens) { + return "$name($fh, $len)"; + } else { + return "$name $fh, $len"; + } +} + +sub indirop { + my $self = shift; + my($op, $cx, $name) = @_; + my($expr, @exprs); + my $firstkid = my $kid = $op->first->sibling; + my $indir = ""; + if ($op->flags & OPf_STACKED) { + $indir = $kid; + $indir = $indir->first; # skip rv2gv + if (is_scope($indir)) { + $indir = "{" . $self->deparse($indir, 0) . "}"; + $indir = "{;}" if $indir eq "{}"; + } elsif ($indir->name eq "const" && $indir->private & OPpCONST_BARE) { + $indir = $self->const_sv($indir)->PV; + } else { + $indir = $self->deparse($indir, 24); + } + $indir = $indir . " "; + $kid = $kid->sibling; + } + if ($name eq "sort" && $op->private & (OPpSORT_NUMERIC | OPpSORT_INTEGER)) { + $indir = ($op->private & OPpSORT_DESCEND) ? '{$b <=> $a} ' + : '{$a <=> $b} '; + } + elsif ($name eq "sort" && $op->private & OPpSORT_DESCEND) { + $indir = '{$b cmp $a} '; + } + for (; !null($kid); $kid = $kid->sibling) { + $expr = $self->deparse($kid, !$indir && $kid == $firstkid && $name eq "sort" && $firstkid->name eq "entersub" ? 16 : 6); + push @exprs, $expr; + } + my $name2; + if ($name eq "sort" && $op->private & OPpSORT_REVERSE) { + $name2 = $self->keyword('reverse') . ' ' . $self->keyword('sort'); + } + else { $name2 = $self->keyword($name) } + if ($name eq "sort" && ($op->private & OPpSORT_INPLACE)) { + return "$exprs[0] = $name2 $indir $exprs[0]"; + } + + my $args = $indir . join(", ", @exprs); + if ($indir ne "" && $name eq "sort") { + # We don't want to say "sort(f 1, 2, 3)", since perl -w will + # give bareword warnings in that case. Therefore if context + # requires, we'll put parens around the outside "(sort f 1, 2, + # 3)". Unfortunately, we'll currently think the parens are + # necessary more often that they really are, because we don't + # distinguish which side of an assignment we're on. + if ($cx >= 5) { + return "($name2 $args)"; + } else { + return "$name2 $args"; + } + } elsif ( + !$indir && $name eq "sort" + && !null($op->first->sibling) + && $op->first->sibling->name eq 'entersub' + ) { + # We cannot say sort foo(bar), as foo will be interpreted as a + # comparison routine. We have to say sort(...) in that case. + return "$name2($args)"; + } else { + return length $args + ? $self->maybe_parens_func($name2, $args, $cx, 5) + : $name2 . '()' x (7 < $cx); + } + +} + +sub pp_prtf { indirop(@_, "printf") } +sub pp_print { indirop(@_, "print") } +sub pp_say { indirop(@_, "say") } +sub pp_sort { indirop(@_, "sort") } + +sub mapop { + my $self = shift; + my($op, $cx, $name) = @_; + my($expr, @exprs); + my $kid = $op->first; # this is the (map|grep)start + $kid = $kid->first->sibling; # skip a pushmark + my $code = $kid->first; # skip a null + if (is_scope $code) { + $code = "{" . $self->deparse($code, 0) . "} "; + } else { + $code = $self->deparse($code, 24); + $code .= ", " if !null($kid->sibling); + } + $kid = $kid->sibling; + for (; !null($kid); $kid = $kid->sibling) { + $expr = $self->deparse($kid, 6); + push @exprs, $expr if defined $expr; + } + return $self->maybe_parens_func($self->keyword($name), + $code . join(", ", @exprs), $cx, 5); +} + +sub pp_mapwhile { mapop(@_, "map") } +sub pp_grepwhile { mapop(@_, "grep") } +sub pp_mapstart { baseop(@_, "map") } +sub pp_grepstart { baseop(@_, "grep") } + +my %uses_intro; +BEGIN { + @uses_intro{ + eval { require B::Op_private } + ? @{$B::Op_private::ops_using{OPpLVAL_INTRO}} + : qw(gvsv rv2sv rv2hv rv2gv rv2av aelem helem aslice + hslice delete padsv padav padhv enteriter entersub padrange + pushmark cond_expr refassign list) + } = (); + delete @uses_intro{qw( lvref lvrefslice lvavref entersub )}; +} + + +# Look for a my/state attribute declaration in a list or ex-list. +# Returns undef if not found, 'my($x, @a) :Foo(bar)' etc otherwise. +# +# There are three basic tree structs that are expected: +# +# my $x :foo; +# <1> ex-list vK/LVINTRO ->c +# <0> ex-pushmark v ->3 +# <1> entersub[t2] vKRS*/TARG ->b +# .... +# <0> padsv[$x:64,65] vM/LVINTRO ->c +# +# my @a :foo; +# my %h :foo; +# +# <1> ex-list vK ->c +# <0> ex-pushmark v ->3 +# <0> padav[@a:64,65] vM/LVINTRO ->4 +# <1> entersub[t2] vKRS*/TARG ->c +# .... +# +# my ($x,@a,%h) :foo; +# +# <;> nextstate(main 64 -e:1) v:{ ->3 +# <@> list vKP ->w +# <0> pushmark vM/LVINTRO ->4 +# <0> padsv[$x:64,65] vM/LVINTRO ->5 +# <0> padav[@a:64,65] vM/LVINTRO ->6 +# <0> padhv[%h:64,65] vM/LVINTRO ->7 +# <1> entersub[t4] vKRS*/TARG ->f +# .... +# <1> entersub[t5] vKRS*/TARG ->n +# .... +# <1> entersub[t6] vKRS*/TARG ->v +# .... +# where the entersub in all cases looks like +# <1> entersub[t2] vKRS*/TARG ->c +# <0> pushmark s ->5 +# <$> const[PV "attributes"] sM ->6 +# <$> const[PV "main"] sM ->7 +# <1> srefgen sKM/1 ->9 +# <1> ex-list lKRM ->8 +# <0> padsv[@a:64,65] sRM ->8 +# <$> const[PV "foo"] sM ->a +# <.> method_named[PV "import"] ->b + +sub maybe_var_attr { + my ($self, $op, $cx) = @_; + + my $kid = $op->first->sibling; # skip pushmark + return if class($kid) eq 'NULL'; + + my $lop; + my $type; + + # Extract out all the pad ops and entersub ops into + # @padops and @entersubops. Return if anything else seen. + # Also determine what class (if any) all the pad vars belong to + my $class; + my $decl; # 'my' or 'state' + my (@padops, @entersubops); + for ($lop = $kid; !null($lop); $lop = $lop->sibling) { + my $lopname = $lop->name; + my $loppriv = $lop->private; + if ($lopname =~ /^pad[sah]v$/) { + return unless $loppriv & OPpLVAL_INTRO; + + my $padname = $self->padname_sv($lop->targ); + my $thisclass = ($padname->FLAGS & SVpad_TYPED) + ? $padname->SvSTASH->NAME : 'main'; + + # all pad vars must be in the same class + $class //= $thisclass; + return unless $thisclass eq $class; + + # all pad vars must be the same sort of declaration + # (all my, all state, etc) + my $this = ($loppriv & OPpPAD_STATE) ? 'state' : 'my'; + if (defined $decl) { + return unless $this eq $decl; + } + $decl = $this; + + push @padops, $lop; + } + elsif ($lopname eq 'entersub') { + push @entersubops, $lop; + } + else { + return; + } + } + + return unless @padops && @padops == @entersubops; + + # there should be a balance: each padop has a corresponding + # 'attributes'->import() method call, in the same order. + + my @varnames; + my $attr_text; + + for my $i (0..$#padops) { + my $padop = $padops[$i]; + my $esop = $entersubops[$i]; + + push @varnames, $self->padname($padop->targ); + + return unless ($esop->flags & OPf_KIDS); + + my $kid = $esop->first; + return unless $kid->type == OP_PUSHMARK; + + $kid = $kid->sibling; + return unless $$kid && $kid->type == OP_CONST; + return unless $self->const_sv($kid)->PV eq 'attributes'; + + $kid = $kid->sibling; + return unless $$kid && $kid->type == OP_CONST; # __PACKAGE__ + + $kid = $kid->sibling; + return unless $$kid + && $kid->name eq "srefgen" + && ($kid->flags & OPf_KIDS) + && ($kid->first->flags & OPf_KIDS) + && $kid->first->first->name =~ /^pad[sah]v$/ + && $kid->first->first->targ == $padop->targ; + + $kid = $kid->sibling; + my @attr; + while ($$kid) { + last if ($kid->type != OP_CONST); + push @attr, $self->const_sv($kid)->PV; + $kid = $kid->sibling; + } + return unless @attr; + my $thisattr = ":" . join(' ', @attr); + $attr_text //= $thisattr; + # all import calls must have the same list of attributes + return unless $attr_text eq $thisattr; + + return unless $kid->name eq 'method_named'; + return unless $self->meth_sv($kid)->PV eq 'import'; + + $kid = $kid->sibling; + return if $$kid; + } + + my $res = $decl; + $res .= " $class " if $class ne 'main'; + $res .= + (@varnames > 1) + ? "(" . join(', ', @varnames) . ')' + : " $varnames[0]"; + + return "$res $attr_text"; +} + + +sub pp_list { + my $self = shift; + my($op, $cx) = @_; + + { + # might be my ($s,@a,%h) :Foo(bar); + my $my_attr = maybe_var_attr($self, $op, $cx); + return $my_attr if defined $my_attr; + } + + my($expr, @exprs); + my $kid = $op->first->sibling; # skip pushmark + return '' if class($kid) eq 'NULL'; + my $lop; + my $local = "either"; # could be local(...), my(...), state(...) or our(...) + my $type; + for ($lop = $kid; !null($lop); $lop = $lop->sibling) { + my $lopname = $lop->name; + my $loppriv = $lop->private; + my $newtype; + if ($lopname =~ /^pad[ash]v$/ && $loppriv & OPpLVAL_INTRO) { + if ($loppriv & OPpPAD_STATE) { # state() + ($local = "", last) if $local !~ /^(?:either|state)$/; + $local = "state"; + } else { # my() + ($local = "", last) if $local !~ /^(?:either|my)$/; + $local = "my"; + } + my $padname = $self->padname_sv($lop->targ); + if ($padname->FLAGS & SVpad_TYPED) { + $newtype = $padname->SvSTASH->NAME; + } + } elsif ($lopname =~ /^(?:gv|rv2)([ash])v$/ + && $loppriv & OPpOUR_INTRO + or $lopname eq "null" && class($lop) eq 'UNOP' + && $lop->first->name eq "gvsv" + && $lop->first->private & OPpOUR_INTRO) { # our() + my $newlocal = "local " x !!($loppriv & OPpLVAL_INTRO) . "our"; + ($local = "", last) + if $local ne 'either' && $local ne $newlocal; + $local = $newlocal; + my $funny = !$1 || $1 eq 's' ? '$' : $1 eq 'a' ? '@' : '%'; + if (my $t = $self->find_our_type( + $funny . $self->gv_or_padgv($lop->first)->NAME + )) { + $newtype = $t; + } + } elsif ($lopname ne 'undef' + and !($loppriv & OPpLVAL_INTRO) + || !exists $uses_intro{$lopname eq 'null' + ? substr B::ppname($lop->targ), 3 + : $lopname}) + { + $local = ""; # or not + last; + } elsif ($lopname ne "undef") + { + # local() + ($local = "", last) if $local !~ /^(?:either|local)$/; + $local = "local"; + } + if (defined $type && defined $newtype && $newtype ne $type) { + $local = ''; + last; + } + $type = $newtype; + } + $local = "" if $local eq "either"; # no point if it's all undefs + $local &&= join ' ', map $self->keyword($_), split / /, $local; + $local .= " $type " if $local && length $type; + return $self->deparse($kid, $cx) if null $kid->sibling and not $local; + for (; !null($kid); $kid = $kid->sibling) { + if ($local) { + if (class($kid) eq "UNOP" and $kid->first->name eq "gvsv") { + $lop = $kid->first; + } else { + $lop = $kid; + } + $self->{'avoid_local'}{$$lop}++; + $expr = $self->deparse($kid, 6); + delete $self->{'avoid_local'}{$$lop}; + } else { + $expr = $self->deparse($kid, 6); + } + push @exprs, $expr; + } + if ($local) { + if (@exprs == 1 && ($local eq 'state' || $local eq 'CORE::state')) { + # 'state @a = ...' is legal, while 'state(@a) = ...' currently isn't + return "$local $exprs[0]"; + } + return "$local(" . join(", ", @exprs) . ")"; + } else { + return $self->maybe_parens( join(", ", @exprs), $cx, 6); + } +} + +sub is_ifelse_cont { + my $op = shift; + return ($op->name eq "null" and class($op) eq "UNOP" + and $op->first->name =~ /^(and|cond_expr)$/ + and is_scope($op->first->first->sibling)); +} + +sub pp_cond_expr { + my $self = shift; + my($op, $cx) = @_; + my $cond = $op->first; + my $true = $cond->sibling; + my $false = $true->sibling; + my $cuddle = $self->{'cuddle'}; + unless ($cx < 1 and (is_scope($true) and $true->name ne "null") and + (is_scope($false) || is_ifelse_cont($false)) + and $self->{'expand'} < 7) { + $cond = $self->deparse($cond, 8); + $true = $self->deparse($true, 6); + $false = $self->deparse($false, 8); + return $self->maybe_parens("$cond ? $true : $false", $cx, 8); + } + + $cond = $self->deparse($cond, 1); + $true = $self->deparse($true, 0); + my $head = $self->keyword("if") . " ($cond) {\n\t$true\n\b}"; + my @elsifs; + my $elsif; + while (!null($false) and is_ifelse_cont($false)) { + my $newop = $false->first; + my $newcond = $newop->first; + my $newtrue = $newcond->sibling; + $false = $newtrue->sibling; # last in chain is OP_AND => no else + if ($newcond->name eq "lineseq") + { + # lineseq to ensure correct line numbers in elsif() + # Bug #37302 fixed by change #33710. + $newcond = $newcond->first->sibling; + } + $newcond = $self->deparse($newcond, 1); + $newtrue = $self->deparse($newtrue, 0); + $elsif ||= $self->keyword("elsif"); + push @elsifs, "$elsif ($newcond) {\n\t$newtrue\n\b}"; + } + if (!null($false)) { + $false = $cuddle . $self->keyword("else") . " {\n\t" . + $self->deparse($false, 0) . "\n\b}\cK"; + } else { + $false = "\cK"; + } + return $head . join($cuddle, "", @elsifs) . $false; +} + +sub pp_once { + my ($self, $op, $cx) = @_; + my $cond = $op->first; + my $true = $cond->sibling; + + my $ret = $self->deparse($true, $cx); + $ret =~ s/^(\(?)\$/$1 . $self->keyword("state") . ' $'/e; + $ret; +} + +sub loop_common { + my $self = shift; + my($op, $cx, $init) = @_; + my $enter = $op->first; + my $kid = $enter->sibling; + local(@$self{qw'curstash warnings hints hinthash'}) + = @$self{qw'curstash warnings hints hinthash'}; + my $head = ""; + my $bare = 0; + my $body; + my $cond = undef; + my $name; + if ($kid->name eq "lineseq") { # bare or infinite loop + if ($kid->last->name eq "unstack") { # infinite + $head = "while (1) "; # Can't use for(;;) if there's a continue + $cond = ""; + } else { + $bare = 1; + } + $body = $kid; + } elsif ($enter->name eq "enteriter") { # foreach + my $ary = $enter->first->sibling; # first was pushmark + my $var = $ary->sibling; + if ($ary->name eq 'null' and $enter->private & OPpITER_REVERSED) { + # "reverse" was optimised away + $ary = listop($self, $ary->first->sibling, 1, 'reverse'); + } elsif ($enter->flags & OPf_STACKED + and not null $ary->first->sibling->sibling) + { + $ary = $self->deparse($ary->first->sibling, 9) . " .. " . + $self->deparse($ary->first->sibling->sibling, 9); + } else { + $ary = $self->deparse($ary, 1); + } + if (null $var) { + $var = $self->pp_padsv($enter, 1, 1); + } elsif ($var->name eq "rv2gv") { + $var = $self->pp_rv2sv($var, 1); + if ($enter->private & OPpOUR_INTRO) { + # our declarations don't have package names + $var =~ s/^(.).*::/$1/; + $var = "our $var"; + } + } elsif ($var->name eq "gv") { + $var = "\$" . $self->deparse($var, 1); + } else { + $var = $self->deparse($var, 1); + } + $body = $kid->first->first->sibling; # skip OP_AND and OP_ITER + if (!is_state $body->first and $body->first->name !~ /^(?:stub|leave|scope)$/) { + confess unless $var eq '$_'; + $body = $body->first; + return $self->deparse($body, 2) . " " + . $self->keyword("foreach") . " ($ary)"; + } + $head = "foreach $var ($ary) "; + } elsif ($kid->name eq "null") { # while/until + $kid = $kid->first; + $name = {"and" => "while", "or" => "until"}->{$kid->name}; + $cond = $kid->first; + $body = $kid->first->sibling; + } elsif ($kid->name eq "stub") { # bare and empty + return "{;}"; # {} could be a hashref + } + # If there isn't a continue block, then the next pointer for the loop + # will point to the unstack, which is kid's last child, except + # in a bare loop, when it will point to the leaveloop. When neither of + # these conditions hold, then the second-to-last child is the continue + # block (or the last in a bare loop). + my $cont_start = $enter->nextop; + my $cont; + my $precond; + my $postcond; + if ($$cont_start != $$op && ${$cont_start} != ${$body->last}) { + if ($bare) { + $cont = $body->last; + } else { + $cont = $body->first; + while (!null($cont->sibling->sibling)) { + $cont = $cont->sibling; + } + } + my $state = $body->first; + my $cuddle = $self->{'cuddle'}; + my @states; + for (; $$state != $$cont; $state = $state->sibling) { + push @states, $state; + } + $body = $self->lineseq(undef, 0, @states); + if (defined $cond and not is_scope $cont and $self->{'expand'} < 3) { + $precond = "for ($init; "; + $postcond = "; " . $self->deparse($cont, 1) .") "; + $cont = "\cK"; + } else { + $cont = $cuddle . "continue {\n\t" . + $self->deparse($cont, 0) . "\n\b}\cK"; + } + } else { + return "" if !defined $body; + if (length $init) { + $precond = "for ($init; "; + $postcond = ";) "; + } + $cont = "\cK"; + $body = $self->deparse($body, 0); + } + if ($precond) { # for(;;) + $cond &&= $name eq 'until' + ? listop($self, undef, 1, "not", $cond->first) + : $self->deparse($cond, 1); + $head = "$precond$cond$postcond"; + } + if ($name && !$head) { + ref $cond and $cond = $self->deparse($cond, 1); + $head = "$name ($cond) "; + } + $head =~ s/^(for(?:each)?|while|until)/$self->keyword($1)/e; + $body =~ s/;?$/;\n/; + + return $head . "{\n\t" . $body . "\b}" . $cont; +} + +sub pp_leaveloop { shift->loop_common(@_, "") } + +sub for_loop { + my $self = shift; + my($op, $cx) = @_; + my $init = $self->deparse($op, 1); + my $s = $op->sibling; + my $ll = $s->name eq "unstack" ? $s->sibling : $s->first->sibling; + return $self->loop_common($ll, $cx, $init); +} + +sub pp_leavetry { + my $self = shift; + return "eval {\n\t" . $self->pp_leave(@_) . "\n\b}"; +} + +sub _op_is_or_was { + my ($op, $expect_type) = @_; + my $type = $op->type; + return($type == $expect_type + || ($type == OP_NULL && $op->targ == $expect_type)); +} + +sub pp_null { + my($self, $op, $cx) = @_; + + # might be 'my $s :Foo(bar);' + if ($op->targ == OP_LIST) { + my $my_attr = maybe_var_attr($self, $op, $cx); + return $my_attr if defined $my_attr; + } + + if (class($op) eq "OP") { + # old value is lost + return $self->{'ex_const'} if $op->targ == OP_CONST; + } elsif (class ($op) eq "COP") { + return &pp_nextstate; + } elsif ($op->first->name eq 'pushmark' + or $op->first->name eq 'null' + && $op->first->targ == OP_PUSHMARK + && _op_is_or_was($op, OP_LIST)) { + return $self->pp_list($op, $cx); + } elsif ($op->first->name eq "enter") { + return $self->pp_leave($op, $cx); + } elsif ($op->first->name eq "leave") { + return $self->pp_leave($op->first, $cx); + } elsif ($op->first->name eq "scope") { + return $self->pp_scope($op->first, $cx); + } elsif ($op->targ == OP_STRINGIFY) { + return $self->dquote($op, $cx); + } elsif ($op->targ == OP_GLOB) { + return $self->pp_glob( + $op->first # entersub + ->first # ex-list + ->first # pushmark + ->sibling, # glob + $cx + ); + } elsif (!null($op->first->sibling) and + $op->first->sibling->name eq "readline" and + $op->first->sibling->flags & OPf_STACKED) { + return $self->maybe_parens($self->deparse($op->first, 7) . " = " + . $self->deparse($op->first->sibling, 7), + $cx, 7); + } elsif (!null($op->first->sibling) and + $op->first->sibling->name =~ /^transr?\z/ and + $op->first->sibling->flags & OPf_STACKED) { + return $self->maybe_parens($self->deparse($op->first, 20) . " =~ " + . $self->deparse($op->first->sibling, 20), + $cx, 20); + } elsif ($op->flags & OPf_SPECIAL && $cx < 1 && !$op->targ) { + return ($self->lex_in_scope("&do") ? "CORE::do" : "do") + . " {\n\t". $self->deparse($op->first, $cx) ."\n\b};"; + } elsif (!null($op->first->sibling) and + $op->first->sibling->name eq "null" and + class($op->first->sibling) eq "UNOP" and + $op->first->sibling->first->flags & OPf_STACKED and + $op->first->sibling->first->name eq "rcatline") { + return $self->maybe_parens($self->deparse($op->first, 18) . " .= " + . $self->deparse($op->first->sibling, 18), + $cx, 18); + } else { + return $self->deparse($op->first, $cx); + } +} + +sub padname { + my $self = shift; + my $targ = shift; + return $self->padname_sv($targ)->PVX; +} + +sub padany { + my $self = shift; + my $op = shift; + return substr($self->padname($op->targ), 1); # skip $/@/% +} + +sub pp_padsv { + my $self = shift; + my($op, $cx, $forbid_parens) = @_; + my $targ = $op->targ; + return $self->maybe_my($op, $cx, $self->padname($targ), + $self->padname_sv($targ), + $forbid_parens); +} + +sub pp_padav { pp_padsv(@_) } + +# prepend 'keys' where its been optimised away, with suitable handling +# of CORE:: and parens + +sub add_keys_keyword { + my ($self, $str, $cx) = @_; + $str = $self->maybe_parens($str, $cx, 16); + # 'keys %h' versus 'keys(%h)' + $str = " $str" unless $str =~ /^\(/; + return $self->keyword("keys") . $str; +} + +sub pp_padhv { + my ($self, $op, $cx) = @_; + my $str = pp_padsv(@_); + # with OPpPADHV_ISKEYS the keys op is optimised away, except + # in scalar context the old op is kept (but not executed) so its targ + # can be used. + if ( ($op->private & OPpPADHV_ISKEYS) + && !(($op->flags & OPf_WANT) == OPf_WANT_SCALAR)) + { + $str = $self->add_keys_keyword($str, $cx); + } + $str; +} + +sub gv_or_padgv { + my $self = shift; + my $op = shift; + if (class($op) eq "PADOP") { + return $self->padval($op->padix); + } else { # class($op) eq "SVOP" + return $op->gv; + } +} + +sub pp_gvsv { + my $self = shift; + my($op, $cx) = @_; + my $gv = $self->gv_or_padgv($op); + return $self->maybe_local($op, $cx, $self->stash_variable("\$", + $self->gv_name($gv), $cx)); +} + +sub pp_gv { + my $self = shift; + my($op, $cx) = @_; + my $gv = $self->gv_or_padgv($op); + return $self->maybe_qualify("", $self->gv_name($gv)); +} + +sub pp_aelemfast_lex { + my $self = shift; + my($op, $cx) = @_; + my $name = $self->padname($op->targ); + $name =~ s/^@/\$/; + my $i = $op->private; + $i -= 256 if $i > 127; + return $name . "[$i]"; +} + +sub pp_aelemfast { + my $self = shift; + my($op, $cx) = @_; + # optimised PADAV, pre 5.15 + return $self->pp_aelemfast_lex(@_) if ($op->flags & OPf_SPECIAL); + + my $gv = $self->gv_or_padgv($op); + my($name,$quoted) = $self->stash_variable_name('@',$gv); + $name = $quoted ? "$name->" : '$' . $name; + my $i = $op->private; + $i -= 256 if $i > 127; + return $name . "[$i]"; +} + +sub rv2x { + my $self = shift; + my($op, $cx, $type) = @_; + + if (class($op) eq 'NULL' || !$op->can("first")) { + carp("Unexpected op in pp_rv2x"); + return 'XXX'; + } + my $kid = $op->first; + if ($kid->name eq "gv") { + return $self->stash_variable($type, + $self->gv_name($self->gv_or_padgv($kid)), $cx); + } elsif (is_scalar $kid) { + my $str = $self->deparse($kid, 0); + if ($str =~ /^\$([^\w\d])\z/) { + # "$$+" isn't a legal way to write the scalar dereference + # of $+, since the lexer can't tell you aren't trying to + # do something like "$$ + 1" to get one more than your + # PID. Either "${$+}" or "$${+}" are workable + # disambiguations, but if the programmer did the former, + # they'd be in the "else" clause below rather than here. + # It's not clear if this should somehow be unified with + # the code in dq and re_dq that also adds lexer + # disambiguation braces. + $str = '$' . "{$1}"; #' + } + return $type . $str; + } else { + return $type . "{" . $self->deparse($kid, 0) . "}"; + } +} + +sub pp_rv2sv { maybe_local(@_, rv2x(@_, "\$")) } +sub pp_rv2gv { maybe_local(@_, rv2x(@_, "*")) } + +sub pp_rv2hv { + my ($self, $op, $cx) = @_; + my $str = rv2x(@_, "%"); + if ($op->private & OPpRV2HV_ISKEYS) { + $str = $self->add_keys_keyword($str, $cx); + } + return maybe_local(@_, $str); +} + +# skip rv2av +sub pp_av2arylen { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + if ($kid->name eq "padav") { + return $self->maybe_local($op, $cx, '$#' . $self->padany($kid)); + } else { + my $kkid; + if ( $kid->name eq "rv2av" + && ($kkid = $kid->first) + && $kkid->name !~ /^(scope|leave|gv)$/) + { + # handle (expr)->$#* postfix form + my $expr; + $expr = $self->deparse($kkid, 24); # 24 is '->' + $expr = "$expr->\$#*"; + # XXX maybe_local is probably wrong here: local($#-expression) + # doesn't "do" local (the is no INTRO flag set) + return $self->maybe_local($op, $cx, $expr); + } + else { + # handle $#{expr} form + # XXX see maybe_local comment above + return $self->maybe_local($op, $cx, $self->rv2x($kid, $cx, '$#')); + } + } +} + +# skip down to the old, ex-rv2cv +sub pp_rv2cv { + my ($self, $op, $cx) = @_; + if (!null($op->first) && $op->first->name eq 'null' && + $op->first->targ == OP_LIST) + { + return $self->rv2x($op->first->first->sibling, $cx, "&") + } + else { + return $self->rv2x($op, $cx, "") + } +} + +sub list_const { + my $self = shift; + my($cx, @list) = @_; + my @a = map $self->const($_, 6), @list; + if (@a == 0) { + return "()"; + } elsif (@a == 1) { + return $a[0]; + } elsif ( @a > 2 and !grep(!/^-?\d+$/, @a)) { + # collapse (-1,0,1,2) into (-1..2) + my ($s, $e) = @a[0,-1]; + my $i = $s; + return $self->maybe_parens("$s..$e", $cx, 9) + unless grep $i++ != $_, @a; + } + return $self->maybe_parens(join(", ", @a), $cx, 6); +} + +sub pp_rv2av { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + if ($kid->name eq "const") { # constant list + my $av = $self->const_sv($kid); + return $self->list_const($cx, $av->ARRAY); + } else { + return $self->maybe_local($op, $cx, $self->rv2x($op, $cx, "\@")); + } + } + +sub is_subscriptable { + my $op = shift; + if ($op->name =~ /^([ahg]elem|multideref$)/) { + return 1; + } elsif ($op->name eq "entersub") { + my $kid = $op->first; + return 0 unless null $kid->sibling; + $kid = $kid->first; + $kid = $kid->sibling until null $kid->sibling; + return 0 if is_scope($kid); + $kid = $kid->first; + return 0 if $kid->name eq "gv" || $kid->name eq "padcv"; + return 0 if is_scalar($kid); + return is_subscriptable($kid); + } else { + return 0; + } +} + +sub elem_or_slice_array_name +{ + my $self = shift; + my ($array, $left, $padname, $allow_arrow) = @_; + + if ($array->name eq $padname) { + return $self->padany($array); + } elsif (is_scope($array)) { # ${expr}[0] + return "{" . $self->deparse($array, 0) . "}"; + } elsif ($array->name eq "gv") { + ($array, my $quoted) = + $self->stash_variable_name( + $left eq '[' ? '@' : '%', $self->gv_or_padgv($array) + ); + if (!$allow_arrow && $quoted) { + # This cannot happen. + die "Invalid variable name $array for slice"; + } + return $quoted ? "$array->" : $array; + } elsif (!$allow_arrow || is_scalar $array) { # $x[0], $$x[0], ... + return $self->deparse($array, 24); + } else { + return undef; + } +} + +sub elem_or_slice_single_index +{ + my $self = shift; + my ($idx) = @_; + + $idx = $self->deparse($idx, 1); + + # Outer parens in an array index will confuse perl + # if we're interpolating in a regular expression, i.e. + # /$x$foo[(-1)]/ is *not* the same as /$x$foo[-1]/ + # + # If $self->{parens}, then an initial '(' will + # definitely be paired with a final ')'. If + # !$self->{parens}, the misleading parens won't + # have been added in the first place. + # + # [You might think that we could get "(...)...(...)" + # where the initial and final parens do not match + # each other. But we can't, because the above would + # only happen if there's an infix binop between the + # two pairs of parens, and *that* means that the whole + # expression would be parenthesized as well.] + # + $idx =~ s/^\((.*)\)$/$1/ if $self->{'parens'}; + + # Hash-element braces will autoquote a bareword inside themselves. + # We need to make sure that C<$hash{warn()}> doesn't come out as + # C<$hash{warn}>, which has a quite different meaning. Currently + # B::Deparse will always quote strings, even if the string was a + # bareword in the original (i.e. the OPpCONST_BARE flag is ignored + # for constant strings.) So we can cheat slightly here - if we see + # a bareword, we know that it is supposed to be a function call. + # + $idx =~ s/^([A-Za-z_]\w*)$/$1()/; + + return $idx; +} + +sub elem { + my $self = shift; + my ($op, $cx, $left, $right, $padname) = @_; + my($array, $idx) = ($op->first, $op->first->sibling); + + $idx = $self->elem_or_slice_single_index($idx); + + unless ($array->name eq $padname) { # Maybe this has been fixed + $array = $array->first; # skip rv2av (or ex-rv2av in _53+) + } + if (my $array_name=$self->elem_or_slice_array_name + ($array, $left, $padname, 1)) { + return ($array_name =~ /->\z/ + ? $array_name + : $array_name eq '#' ? '${#}' : "\$" . $array_name) + . $left . $idx . $right; + } else { + # $x[20][3]{hi} or expr->[20] + my $arrow = is_subscriptable($array) ? "" : "->"; + return $self->deparse($array, 24) . $arrow . $left . $idx . $right; + } + +} + +# a simplified version of elem_or_slice_array_name() +# for the use of pp_multideref + +sub multideref_var_name { + my $self = shift; + my ($gv, $is_hash) = @_; + + my ($name, $quoted) = + $self->stash_variable_name( $is_hash ? '%' : '@', $gv); + return $quoted ? "$name->" + : $name eq '#' + ? '${#}' # avoid ${#}[1] => $#[1] + : '$' . $name; +} + + +# deparse an OP_MULTICONCAT. If $in_dq is 1, we're within +# a double-quoted string, so for example. +# "abc\Qdef$x\Ebar" +# might get compiled as +# multiconcat("abc", metaquote(multiconcat("def", $x)), "bar") +# and the inner multiconcat should be deparsed as C rather than +# the normal C +# Ditto if $in_dq is 2, handle qr/...\Qdef$x\E.../. + +sub do_multiconcat { + my $self = shift; + my($op, $cx, $in_dq) = @_; + + my $kid; + my @kids; + my $assign; + my $append; + my $lhs = ""; + + for ($kid = $op->first; !null $kid; $kid = $kid->sibling) { + # skip the consts and/or padsv we've optimised away + push @kids, $kid + unless $kid->type == OP_NULL + && ( $kid->targ == OP_PADSV + || $kid->targ == OP_CONST + || $kid->targ == OP_PUSHMARK); + } + + $append = ($op->private & OPpMULTICONCAT_APPEND); + + if ($op->private & OPpTARGET_MY) { + # '$lex = ...' or '$lex .= ....' or 'my $lex = ' + $lhs = $self->padname($op->targ); + $lhs = "my $lhs" if ($op->private & OPpLVAL_INTRO); + $assign = 1; + } + elsif ($op->flags & OPf_STACKED) { + # 'expr = ...' or 'expr .= ....' + my $expr = $append ? shift(@kids) : pop(@kids); + $lhs = $self->deparse($expr, 7); + $assign = 1; + } + + if ($assign) { + $lhs .= $append ? ' .= ' : ' = '; + } + + my ($nargs, $const_str, @const_lens) = $op->aux_list($self->{curcv}); + + my @consts; + my $i = 0; + for (@const_lens) { + if ($_ == -1) { + push @consts, undef; + } + else { + push @consts, substr($const_str, $i, $_); + my @args; + $i += $_; + } + } + + my $rhs = ""; + + if ( $in_dq + || (($op->private & OPpMULTICONCAT_STRINGIFY) && !$self->{'unquote'})) + { + # "foo=$foo bar=$bar " + my $not_first; + while (@consts) { + if ($not_first) { + my $s = $self->dq(shift(@kids), 18); + # don't deparse "a${$}b" as "a$$b" + $s = '${$}' if $s eq '$$'; + $rhs = dq_disambiguate($rhs, $s); + } + $not_first = 1; + my $c = shift @consts; + if (defined $c) { + if ($in_dq == 2) { + # in pattern: don't convert newline to '\n' etc etc + my $s = re_uninterp(escape_re(re_unback($c))); + $rhs = re_dq_disambiguate($rhs, $s) + } + else { + my $s = uninterp(escape_str(unback($c))); + $rhs = dq_disambiguate($rhs, $s) + } + } + } + return $rhs if $in_dq; + $rhs = single_delim("qq", '"', $rhs, $self); + } + elsif ($op->private & OPpMULTICONCAT_FAKE) { + # sprintf("foo=%s bar=%s ", $foo, $bar) + + my @all; + @consts = map { $_ //= ''; s/%/%%/g; $_ } @consts; + my $fmt = join '%s', @consts; + push @all, $self->quoted_const_str($fmt); + + # the following is a stripped down copy of sub listop {} + my $parens = $assign || ($cx >= 5) || $self->{'parens'}; + my $fullname = $self->keyword('sprintf'); + push @all, map $self->deparse($_, 6), @kids; + + $rhs = $parens + ? "$fullname(" . join(", ", @all) . ")" + : "$fullname " . join(", ", @all); + } + else { + # "foo=" . $foo . " bar=" . $bar + my @all; + my $not_first; + while (@consts) { + push @all, $self->deparse(shift(@kids), 18) if $not_first; + $not_first = 1; + my $c = shift @consts; + if (defined $c) { + push @all, $self->quoted_const_str($c); + } + } + $rhs .= join ' . ', @all; + } + + my $text = $lhs . $rhs; + + $text = "($text)" if ($cx >= (($assign) ? 7 : 18+1)) + || $self->{'parens'}; + + return $text; +} + + +sub pp_multiconcat { + my $self = shift; + $self->do_multiconcat(@_, 0); +} + + +sub pp_multideref { + my $self = shift; + my($op, $cx) = @_; + my $text = ""; + + if ($op->private & OPpMULTIDEREF_EXISTS) { + $text = $self->keyword("exists"). " "; + } + elsif ($op->private & OPpMULTIDEREF_DELETE) { + $text = $self->keyword("delete"). " "; + } + elsif ($op->private & OPpLVAL_INTRO) { + $text = $self->keyword("local"). " "; + } + + if ($op->first && ($op->first->flags & OPf_KIDS)) { + # arbitrary initial expression, e.g. f(1,2,3)->[...] + my $expr = $self->deparse($op->first, 24); + # stop "exists (expr)->{...}" being interpreted as + #"(exists (expr))->{...}" + $expr = "+$expr" if $expr =~ /^\(/; + $text .= $expr; + } + + my @items = $op->aux_list($self->{curcv}); + my $actions = shift @items; + + my $is_hash; + my $derefs = 0; + + while (1) { + if (($actions & MDEREF_ACTION_MASK) == MDEREF_reload) { + $actions = shift @items; + next; + } + + $is_hash = ( + ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_pop_rv2hv_helem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_gvsv_vivify_rv2hv_helem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_padsv_vivify_rv2hv_helem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_vivify_rv2hv_helem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_padhv_helem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_gvhv_helem + ); + + if ( ($actions & MDEREF_ACTION_MASK) == MDEREF_AV_padav_aelem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_padhv_helem) + { + $derefs = 1; + $text .= '$' . substr($self->padname(shift @items), 1); + } + elsif ( ($actions & MDEREF_ACTION_MASK) == MDEREF_AV_gvav_aelem + || ($actions & MDEREF_ACTION_MASK) == MDEREF_HV_gvhv_helem) + { + $derefs = 1; + $text .= $self->multideref_var_name(shift @items, $is_hash); + } + else { + if ( ($actions & MDEREF_ACTION_MASK) == + MDEREF_AV_padsv_vivify_rv2av_aelem + || ($actions & MDEREF_ACTION_MASK) == + MDEREF_HV_padsv_vivify_rv2hv_helem) + { + $text .= $self->padname(shift @items); + } + elsif ( ($actions & MDEREF_ACTION_MASK) == + MDEREF_AV_gvsv_vivify_rv2av_aelem + || ($actions & MDEREF_ACTION_MASK) == + MDEREF_HV_gvsv_vivify_rv2hv_helem) + { + $text .= $self->multideref_var_name(shift @items, $is_hash); + } + elsif ( ($actions & MDEREF_ACTION_MASK) == + MDEREF_AV_pop_rv2av_aelem + || ($actions & MDEREF_ACTION_MASK) == + MDEREF_HV_pop_rv2hv_helem) + { + if ( ($op->flags & OPf_KIDS) + && ( _op_is_or_was($op->first, OP_RV2AV) + || _op_is_or_was($op->first, OP_RV2HV)) + && ($op->first->flags & OPf_KIDS) + && ( _op_is_or_was($op->first->first, OP_AELEM) + || _op_is_or_was($op->first->first, OP_HELEM)) + ) + { + $derefs++; + } + } + + $text .= '->' if !$derefs++; + } + + + if (($actions & MDEREF_INDEX_MASK) == MDEREF_INDEX_none) { + last; + } + + $text .= $is_hash ? '{' : '['; + + if (($actions & MDEREF_INDEX_MASK) == MDEREF_INDEX_const) { + my $key = shift @items; + if ($is_hash) { + $text .= $self->const($key, $cx); + } + else { + $text .= $key; + } + } + elsif (($actions & MDEREF_INDEX_MASK) == MDEREF_INDEX_padsv) { + $text .= $self->padname(shift @items); + } + elsif (($actions & MDEREF_INDEX_MASK) == MDEREF_INDEX_gvsv) { + $text .= '$' . ($self->stash_variable_name('$', shift @items))[0]; + } + + $text .= $is_hash ? '}' : ']'; + + if ($actions & MDEREF_FLAG_last) { + last; + } + $actions >>= MDEREF_SHIFT; + } + + return $text; +} + + +sub pp_aelem { maybe_local(@_, elem(@_, "[", "]", "padav")) } +sub pp_helem { maybe_local(@_, elem(@_, "{", "}", "padhv")) } + +sub pp_gelem { + my $self = shift; + my($op, $cx) = @_; + my($glob, $part) = ($op->first, $op->last); + $glob = $glob->first; # skip rv2gv + $glob = $glob->first if $glob->name eq "rv2gv"; # this one's a bug + my $scope = is_scope($glob); + $glob = $self->deparse($glob, 0); + $part = $self->deparse($part, 1); + $glob =~ s/::\z// unless $scope; + return "*" . ($scope ? "{$glob}" : $glob) . "{$part}"; +} + +sub slice { + my $self = shift; + my ($op, $cx, $left, $right, $regname, $padname) = @_; + my $last; + my(@elems, $kid, $array, $list); + if (class($op) eq "LISTOP") { + $last = $op->last; + } else { # ex-hslice inside delete() + for ($kid = $op->first; !null $kid->sibling; $kid = $kid->sibling) {} + $last = $kid; + } + $array = $last; + $array = $array->first + if $array->name eq $regname or $array->name eq "null"; + $array = $self->elem_or_slice_array_name($array,$left,$padname,0); + $kid = $op->first->sibling; # skip pushmark + if ($kid->name eq "list") { + $kid = $kid->first->sibling; # skip list, pushmark + for (; !null $kid; $kid = $kid->sibling) { + push @elems, $self->deparse($kid, 6); + } + $list = join(", ", @elems); + } else { + $list = $self->elem_or_slice_single_index($kid); + } + my $lead = ( _op_is_or_was($op, OP_KVHSLICE) + || _op_is_or_was($op, OP_KVASLICE)) + ? '%' : '@'; + return $lead . $array . $left . $list . $right; +} + +sub pp_aslice { maybe_local(@_, slice(@_, "[", "]", "rv2av", "padav")) } +sub pp_kvaslice { slice(@_, "[", "]", "rv2av", "padav") } +sub pp_hslice { maybe_local(@_, slice(@_, "{", "}", "rv2hv", "padhv")) } +sub pp_kvhslice { slice(@_, "{", "}", "rv2hv", "padhv") } + +sub pp_lslice { + my $self = shift; + my($op, $cx) = @_; + my $idx = $op->first; + my $list = $op->last; + my(@elems, $kid); + $list = $self->deparse($list, 1); + $idx = $self->deparse($idx, 1); + return "($list)" . "[$idx]"; +} + +sub want_scalar { + my $op = shift; + return ($op->flags & OPf_WANT) == OPf_WANT_SCALAR; +} + +sub want_list { + my $op = shift; + return ($op->flags & OPf_WANT) == OPf_WANT_LIST; +} + +sub _method { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first->sibling; # skip pushmark + my($meth, $obj, @exprs); + if ($kid->name eq "list" and want_list $kid) { + # When an indirect object isn't a bareword but the args are in + # parens, the parens aren't part of the method syntax (the LLAFR + # doesn't apply), but they make a list with OPf_PARENS set that + # doesn't get flattened by the append_elem that adds the method, + # making a (object, arg1, arg2, ...) list where the object + # usually is. This can be distinguished from + # '($obj, $arg1, $arg2)->meth()' (which is legal if $arg2 is an + # object) because in the later the list is in scalar context + # as the left side of -> always is, while in the former + # the list is in list context as method arguments always are. + # (Good thing there aren't method prototypes!) + $meth = $kid->sibling; + $kid = $kid->first->sibling; # skip pushmark + $obj = $kid; + $kid = $kid->sibling; + for (; not null $kid; $kid = $kid->sibling) { + push @exprs, $kid; + } + } else { + $obj = $kid; + $kid = $kid->sibling; + for (; !null ($kid->sibling) && $kid->name!~/^method(?:_named)?\z/; + $kid = $kid->sibling) { + push @exprs, $kid + } + $meth = $kid; + } + + if ($meth->name eq "method_named") { + $meth = $self->meth_sv($meth)->PV; + } elsif ($meth->name eq "method_super") { + $meth = "SUPER::".$self->meth_sv($meth)->PV; + } elsif ($meth->name eq "method_redir") { + $meth = $self->meth_rclass_sv($meth)->PV.'::'.$self->meth_sv($meth)->PV; + } elsif ($meth->name eq "method_redir_super") { + $meth = $self->meth_rclass_sv($meth)->PV.'::SUPER::'. + $self->meth_sv($meth)->PV; + } else { + $meth = $meth->first; + if ($meth->name eq "const") { + # As of 5.005_58, this case is probably obsoleted by the + # method_named case above + $meth = $self->const_sv($meth)->PV; # needs to be bare + } + } + + return { method => $meth, variable_method => ref($meth), + object => $obj, args => \@exprs }, + $cx; +} + +# compat function only +sub method { + my $self = shift; + my $info = $self->_method(@_); + return $self->e_method( $self->_method(@_) ); +} + +sub e_method { + my ($self, $info, $cx) = @_; + my $obj = $self->deparse($info->{object}, 24); + + my $meth = $info->{method}; + $meth = $self->deparse($meth, 1) if $info->{variable_method}; + my $args = join(", ", map { $self->deparse($_, 6) } @{$info->{args}} ); + if ($info->{object}->name eq 'scope' && want_list $info->{object}) { + # method { $object } + # This must be deparsed this way to preserve list context + # of $object. + my $need_paren = $cx >= 6; + return '(' x $need_paren + . $meth . substr($obj,2) # chop off the "do" + . " $args" + . ')' x $need_paren; + } + my $kid = $obj . "->" . $meth; + if (length $args) { + return $kid . "(" . $args . ")"; # parens mandatory + } else { + return $kid; + } +} + +# returns "&" if the prototype doesn't match the args, +# or ("", $args_after_prototype_demunging) if it does. +sub check_proto { + my $self = shift; + return "&" if $self->{'noproto'}; + my($proto, @args) = @_; + my($arg, $real); + my $doneok = 0; + my @reals; + # An unbackslashed @ or % gobbles up the rest of the args + 1 while $proto =~ s/(?deparse($_, 6), @args); + @args = (); + } else { + $arg = shift @args; + last unless $arg; + if ($chr eq "\$" || $chr eq "_") { + if (want_scalar $arg) { + push @reals, $self->deparse($arg, 6); + } else { + return "&"; + } + } elsif ($chr eq "&") { + if ($arg->name =~ /^(s?refgen|undef)$/) { + push @reals, $self->deparse($arg, 6); + } else { + return "&"; + } + } elsif ($chr eq "*") { + if ($arg->name =~ /^s?refgen$/ + and $arg->first->first->name eq "rv2gv") + { + $real = $arg->first->first; # skip refgen, null + if ($real->first->name eq "gv") { + push @reals, $self->deparse($real, 6); + } else { + push @reals, $self->deparse($real->first, 6); + } + } else { + return "&"; + } + } elsif (substr($chr, 0, 1) eq "\\") { + $chr =~ tr/\\[]//d; + if ($arg->name =~ /^s?refgen$/ and + !null($real = $arg->first) and + ($chr =~ /\$/ && is_scalar($real->first) + or ($chr =~ /@/ + && class($real->first->sibling) ne 'NULL' + && $real->first->sibling->name + =~ /^(rv2|pad)av$/) + or ($chr =~ /%/ + && class($real->first->sibling) ne 'NULL' + && $real->first->sibling->name + =~ /^(rv2|pad)hv$/) + #or ($chr =~ /&/ # This doesn't work + # && $real->first->name eq "rv2cv") + or ($chr =~ /\*/ + && $real->first->name eq "rv2gv"))) + { + push @reals, $self->deparse($real, 6); + } else { + return "&"; + } + } + } + } + return "&" if $proto and !$doneok; # too few args and no ';' + return "&" if @args; # too many args + return ("", join ", ", @reals); +} + +sub retscalar { + my $name = $_[0]->name; + # XXX There has to be a better way of doing this scalar-op check. + # Currently PL_opargs is not exposed. + if ($name eq 'null') { + $name = substr B::ppname($_[0]->targ), 3 + } + $name =~ /^(?:scalar|pushmark|wantarray|const|gvsv|gv|padsv|rv2gv + |rv2sv|av2arylen|anoncode|prototype|srefgen|ref|bless + |regcmaybe|regcreset|regcomp|qr|subst|substcont|trans + |transr|sassign|chop|schop|chomp|schomp|defined|undef + |study|pos|preinc|i_preinc|predec|i_predec|postinc + |i_postinc|postdec|i_postdec|pow|multiply|i_multiply + |divide|i_divide|modulo|i_modulo|add|i_add|subtract + |i_subtract|concat|multiconcat|stringify|left_shift|right_shift|lt + |i_lt|gt|i_gt|le|i_le|ge|i_ge|eq|i_eq|ne|i_ne|ncmp|i_ncmp + |slt|sgt|sle|sge|seq|sne|scmp|[sn]?bit_(?:and|x?or)|negate + |i_negate|not|[sn]?complement|smartmatch|atan2|sin|cos + |rand|srand|exp|log|sqrt|int|hex|oct|abs|length|substr + |vec|index|rindex|sprintf|formline|ord|chr|crypt|ucfirst + |lcfirst|uc|lc|quotemeta|aelemfast|aelem|exists|helem + |pack|join|anonlist|anonhash|push|pop|shift|unshift|xor + |andassign|orassign|dorassign|warn|die|reset|nextstate + |dbstate|unstack|last|next|redo|dump|goto|exit|open|close + |pipe_op|fileno|umask|binmode|tie|untie|tied|dbmopen + |dbmclose|select|getc|read|enterwrite|prtf|print|say + |sysopen|sysseek|sysread|syswrite|eof|tell|seek|truncate + |fcntl|ioctl|flock|send|recv|socket|sockpair|bind|connect + |listen|accept|shutdown|gsockopt|ssockopt|getsockname + |getpeername|ftrread|ftrwrite|ftrexec|fteread|ftewrite + |fteexec|ftis|ftsize|ftmtime|ftatime|ftctime|ftrowned + |fteowned|ftzero|ftsock|ftchr|ftblk|ftfile|ftdir|ftpipe + |ftsuid|ftsgid|ftsvtx|ftlink|fttty|fttext|ftbinary|chdir + |chown|chroot|unlink|chmod|utime|rename|link|symlink + |readlink|mkdir|rmdir|open_dir|telldir|seekdir|rewinddir + |closedir|fork|wait|waitpid|system|exec|kill|getppid + |getpgrp|setpgrp|getpriority|setpriority|time|alarm|sleep + |shmget|shmctl|shmread|shmwrite|msgget|msgctl|msgsnd + |msgrcv|semop|semget|semctl|hintseval|shostent|snetent + |sprotoent|sservent|ehostent|enetent|eprotoent|eservent + |spwent|epwent|sgrent|egrent|getlogin|syscall|lock|runcv + |fc)\z/x +} + +sub pp_entersub { + my $self = shift; + my($op, $cx) = @_; + return $self->e_method($self->_method($op, $cx)) + unless null $op->first->sibling; + my $prefix = ""; + my $amper = ""; + my($kid, @exprs); + if ($op->flags & OPf_SPECIAL && !($op->flags & OPf_MOD)) { + $prefix = "do "; + } elsif ($op->private & OPpENTERSUB_AMPER) { + $amper = "&"; + } + $kid = $op->first; + $kid = $kid->first->sibling; # skip ex-list, pushmark + for (; not null $kid->sibling; $kid = $kid->sibling) { + push @exprs, $kid; + } + my $simple = 0; + my $proto = undef; + my $lexical; + if (is_scope($kid)) { + $amper = "&"; + $kid = "{" . $self->deparse($kid, 0) . "}"; + } elsif ($kid->first->name eq "gv") { + my $gv = $self->gv_or_padgv($kid->first); + my $cv; + if (class($gv) eq 'GV' && class($cv = $gv->CV) ne "SPECIAL" + || $gv->FLAGS & SVf_ROK && class($cv = $gv->RV) eq 'CV') { + $proto = $cv->PV if $cv->FLAGS & SVf_POK; + } + $simple = 1; # only calls of named functions can be prototyped + $kid = $self->maybe_qualify("!", $self->gv_name($gv)); + my $fq; + # Fully qualify any sub name that conflicts with a lexical. + if ($self->lex_in_scope("&$kid") + || $self->lex_in_scope("&$kid", 1)) + { + $fq++; + } elsif (!$amper) { + if ($kid eq 'main::') { + $kid = '::'; + } + else { + if ($kid !~ /::/ && $kid ne 'x') { + # Fully qualify any sub name that is also a keyword. While + # we could check the import flag, we cannot guarantee that + # the code deparsed so far would set that flag, so we qual- + # ify the names regardless of importation. + if (exists $feature_keywords{$kid}) { + $fq++ if $self->feature_enabled($kid); + } elsif (do { local $@; local $SIG{__DIE__}; + eval { () = prototype "CORE::$kid"; 1 } }) { + $fq++ + } + } + if ($kid !~ /^(?:\w|::)(?:[\w\d]|::(?!\z))*\z/) { + $kid = single_delim("q", "'", $kid, $self) . '->'; + } + } + } + $fq and substr $kid, 0, 0, = $self->{'curstash'}.'::'; + } elsif (is_scalar ($kid->first) && $kid->first->name ne 'rv2cv') { + $amper = "&"; + $kid = $self->deparse($kid, 24); + } else { + $prefix = ""; + my $grandkid = $kid->first; + my $arrow = ($lexical = $grandkid->name eq "padcv") + || is_subscriptable($grandkid) + ? "" + : "->"; + $kid = $self->deparse($kid, 24) . $arrow; + if ($lexical) { + my $padlist = $self->{'curcv'}->PADLIST; + my $padoff = $grandkid->targ; + my $padname = $padlist->ARRAYelt(0)->ARRAYelt($padoff); + my $protocv = $padname->FLAGS & SVpad_STATE + ? $padlist->ARRAYelt(1)->ARRAYelt($padoff) + : $padname->PROTOCV; + if ($protocv->FLAGS & SVf_POK) { + $proto = $protocv->PV + } + $simple = 1; + } + } + + # Doesn't matter how many prototypes there are, if + # they haven't happened yet! + my $declared = $lexical || exists $self->{'subs_declared'}{$kid}; + if (not $declared and $self->{'in_coderef2text'}) { + no strict 'refs'; + no warnings 'uninitialized'; + $declared = + ( + defined &{ ${$self->{'curstash'}."::"}{$kid} } + && !exists + $self->{'subs_deparsed'}{$self->{'curstash'}."::".$kid} + && defined prototype $self->{'curstash'}."::".$kid + ); + } + if (!$declared && defined($proto)) { + # Avoid "too early to check prototype" warning + ($amper, $proto) = ('&'); + } + + my $args; + my $listargs = 1; + if ($declared and defined $proto and not $amper) { + ($amper, $args) = $self->check_proto($proto, @exprs); + $listargs = $amper; + } + if ($listargs) { + $args = join(", ", map( + ($_->flags & OPf_WANT) == OPf_WANT_SCALAR + && !retscalar($_) + ? $self->maybe_parens_unop('scalar', $_, 6) + : $self->deparse($_, 6), + @exprs + )); + } + if ($prefix or $amper) { + if ($kid eq '&') { $kid = "{$kid}" } # &{&} cannot be written as && + if ($op->flags & OPf_STACKED) { + return $prefix . $amper . $kid . "(" . $args . ")"; + } else { + return $prefix . $amper. $kid; + } + } else { + # It's a syntax error to call CORE::GLOBAL::foo with a prefix, + # so it must have been translated from a keyword call. Translate + # it back. + $kid =~ s/^CORE::GLOBAL:://; + + my $dproto = defined($proto) ? $proto : "undefined"; + my $scalar_proto = $dproto =~ /^;*(?:[\$*_+]|\\.|\\\[[^]]\])\z/; + if (!$declared) { + return "$kid(" . $args . ")"; + } elsif ($dproto =~ /^\s*\z/) { + return $kid; + } elsif ($scalar_proto and is_scalar($exprs[0])) { + # is_scalar is an excessively conservative test here: + # really, we should be comparing to the precedence of the + # top operator of $exprs[0] (ala unop()), but that would + # take some major code restructuring to do right. + return $self->maybe_parens_func($kid, $args, $cx, 16); + } elsif (not $scalar_proto and defined($proto) || $simple) { #' + return $self->maybe_parens_func($kid, $args, $cx, 5); + } else { + return "$kid(" . $args . ")"; + } + } +} + +sub pp_enterwrite { unop(@_, "write") } + +# escape things that cause interpolation in double quotes, +# but not character escapes +sub uninterp { + my($str) = @_; + $str =~ s/(^|\G|[^\\])((?:\\\\)*)([\$\@]|\\[uUlLQE])/$1$2\\$3/g; + return $str; +} + +{ +my $bal; +BEGIN { + use re "eval"; + # Matches any string which is balanced with respect to {braces} + $bal = qr( + (?: + [^\\{}] + | \\\\ + | \\[{}] + | \{(??{$bal})\} + )* + )x; +} + +# the same, but treat $|, $), $( and $ at the end of the string differently +# and leave comments unmangled for the sake of /x and (?x). +sub re_uninterp { + my($str) = @_; + + $str =~ s/ + ( ^|\G # $1 + | [^\\] + ) + + ( # $2 + (?:\\\\)* + ) + + ( # $3 + ( \(\?\??\{$bal\}\) # $4 (skip over (?{}) and (??{}) blocks) + | \#[^\n]* # (skip over comments) + ) + | [\$\@] + (?!\||\)|\(|$|\s) + | \\[uUlLQE] + ) + + /defined($4) && length($4) ? "$1$2$4" : "$1$2\\$3"/xeg; + + return $str; +} +} + +# character escapes, but not delimiters that might need to be escaped +sub escape_str { # ASCII, UTF8 + my($str) = @_; + $str =~ s/(.)/ord($1) > 255 ? sprintf("\\x{%x}", ord($1)) : $1/eg; + $str =~ s/\a/\\a/g; +# $str =~ s/\cH/\\b/g; # \b means something different in a regex; and \cH + # isn't a backspace in EBCDIC + $str =~ s/\t/\\t/g; + $str =~ s/\n/\\n/g; + $str =~ s/\e/\\e/g; + $str =~ s/\f/\\f/g; + $str =~ s/\r/\\r/g; + $str =~ s/([\cA-\cZ])/'\\c' . $unctrl{$1}/ge; + $str =~ s/([[:^print:]])/sprintf("\\%03o", ord($1))/age; + return $str; +} + +# For regexes. Leave whitespace unmangled in case of /x or (?x). +sub escape_re { + my($str) = @_; + $str =~ s/(.)/ord($1) > 255 ? sprintf("\\x{%x}", ord($1)) : $1/eg; + $str =~ s/([[:^print:]])/ + ($1 =~ y! \t\n!!) ? $1 : sprintf("\\%03o", ord($1))/age; + $str =~ s/\n/\n\f/g; + return $str; +} + +# Don't do this for regexen +sub unback { + my($str) = @_; + $str =~ s/\\/\\\\/g; + return $str; +} + +# Remove backslashes which precede literal control characters, +# to avoid creating ambiguity when we escape the latter. +# +# Don't remove a backslash from escaped whitespace: where the T represents +# a literal tab character, /T/x is not equivalent to /\T/x + +sub re_unback { + my($str) = @_; + + # the insane complexity here is due to the behaviour of "\c\" + $str =~ s/ + # these two lines ensure that the backslash we're about to + # remove isn't preceeded by something which makes it part + # of a \c + + (^ | [^\\] | \\c\\) # $1 + (?'], ['{','}']) { + ($open, $close) = @$ar; + $fail = 0; $cnt = 0; $last_bs = 0; + for $c (@str) { + if ($c eq $open) { + $fail = 1 if $last_bs; + $cnt++; + } elsif ($c eq $close) { + $fail = 1 if $last_bs; + $cnt--; + if ($cnt < 0) { + # qq()() isn't ")(" + $fail = 1; + last; + } + } + $last_bs = $c eq '\\'; + } + $fail = 1 if $cnt != 0; + return ($open, "$open$str$close") if not $fail; + } + return ("", $str); +} + +sub single_delim { + my($q, $default, $str, $self) = @_; + return "$default$str$default" if $default and index($str, $default) == -1; + my $coreq = $self->keyword($q); # maybe CORE::q + if ($q ne 'qr') { + (my $succeed, $str) = balanced_delim($str); + return "$coreq$str" if $succeed; + } + for my $delim ('/', '"', '#') { + return "$coreq$delim" . $str . $delim if index($str, $delim) == -1; + } + if ($default) { + $str =~ s/$default/\\$default/g; + return "$default$str$default"; + } else { + $str =~ s[/][\\/]g; + return "$coreq/$str/"; + } +} + +my $max_prec; +BEGIN { $max_prec = int(0.999 + 8*length(pack("F", 42))*log(2)/log(10)); } + +# Split a floating point number into an integer mantissa and a binary +# exponent. Assumes you've already made sure the number isn't zero or +# some weird infinity or NaN. +sub split_float { + my($f) = @_; + my $exponent = 0; + if ($f == int($f)) { + while ($f % 2 == 0) { + $f /= 2; + $exponent++; + } + } else { + while ($f != int($f)) { + $f *= 2; + $exponent--; + } + } + my $mantissa = sprintf("%.0f", $f); + return ($mantissa, $exponent); +} + + +# suitably single- or double-quote a literal constant string + +sub quoted_const_str { + my ($self, $str) =@_; + if ($str =~ /[[:^print:]]/a) { + return single_delim("qq", '"', + uninterp(escape_str unback $str), $self); + } else { + return single_delim("q", "'", unback($str), $self); + } +} + + +sub const { + my $self = shift; + my($sv, $cx) = @_; + if ($self->{'use_dumper'}) { + return $self->const_dumper($sv, $cx); + } + if (class($sv) eq "SPECIAL") { + # sv_undef, sv_yes, sv_no + return $$sv == 3 ? $self->maybe_parens("!1", $cx, 21) + : ('undef', '1')[$$sv-1]; + } + if (class($sv) eq "NULL") { + return 'undef'; + } + # convert a version object into the "v1.2.3" string in its V magic + if ($sv->FLAGS & SVs_RMG) { + for (my $mg = $sv->MAGIC; $mg; $mg = $mg->MOREMAGIC) { + return $mg->PTR if $mg->TYPE eq 'V'; + } + } + + if ($sv->FLAGS & SVf_IOK) { + my $str = $sv->int_value; + $str = $self->maybe_parens($str, $cx, 21) if $str < 0; + return $str; + } elsif ($sv->FLAGS & SVf_NOK) { + my $nv = $sv->NV; + if ($nv == 0) { + if (pack("F", $nv) eq pack("F", 0)) { + # positive zero + return "0"; + } else { + # negative zero + return $self->maybe_parens("-.0", $cx, 21); + } + } elsif (1/$nv == 0) { + if ($nv > 0) { + # positive infinity + return $self->maybe_parens("9**9**9", $cx, 22); + } else { + # negative infinity + return $self->maybe_parens("-9**9**9", $cx, 21); + } + } elsif ($nv != $nv) { + # NaN + if (pack("F", $nv) eq pack("F", sin(9**9**9))) { + # the normal kind + return "sin(9**9**9)"; + } elsif (pack("F", $nv) eq pack("F", -sin(9**9**9))) { + # the inverted kind + return $self->maybe_parens("-sin(9**9**9)", $cx, 21); + } else { + # some other kind + my $hex = unpack("h*", pack("F", $nv)); + return qq'unpack("F", pack("h*", "$hex"))'; + } + } + # first, try the default stringification + my $str = "$nv"; + if ($str != $nv) { + # failing that, try using more precision + $str = sprintf("%.${max_prec}g", $nv); +# if (pack("F", $str) ne pack("F", $nv)) { + if ($str != $nv) { + # not representable in decimal with whatever sprintf() + # and atof() Perl is using here. + my($mant, $exp) = split_float($nv); + return $self->maybe_parens("$mant * 2**$exp", $cx, 19); + } + } + $str = $self->maybe_parens($str, $cx, 21) if $nv < 0; + return $str; + } elsif ($sv->FLAGS & SVf_ROK && $sv->can("RV")) { + my $ref = $sv->RV; + my $class = class($ref); + if ($class eq "AV") { + return "[" . $self->list_const(2, $ref->ARRAY) . "]"; + } elsif ($class eq "HV") { + my %hash = $ref->ARRAY; + my @elts; + for my $k (sort keys %hash) { + push @elts, "$k => " . $self->const($hash{$k}, 6); + } + return "{" . join(", ", @elts) . "}"; + } elsif ($class eq "CV") { + no overloading; + if ($self->{curcv} && + $self->{curcv}->object_2svref == $ref->object_2svref) { + return $self->keyword("__SUB__"); + } + return "sub " . $self->deparse_sub($ref); + } + if ($class ne 'SPECIAL' and $ref->FLAGS & SVs_SMG) { + for (my $mg = $ref->MAGIC; $mg; $mg = $mg->MOREMAGIC) { + if ($mg->TYPE eq 'r') { + my $re = re_uninterp(escape_re(re_unback($mg->precomp))); + return single_delim("qr", "", $re, $self); + } + } + } + + my $const = $self->const($ref, 20); + if ($self->{in_subst_repl} && $const =~ /^[0-9]/) { + $const = "($const)"; + } + return $self->maybe_parens("\\$const", $cx, 20); + } elsif ($sv->FLAGS & SVf_POK) { + my $str = $sv->PV; + return $self->quoted_const_str($str); + } else { + return "undef"; + } +} + +sub const_dumper { + my $self = shift; + my($sv, $cx) = @_; + my $ref = $sv->object_2svref(); + my $dumper = Data::Dumper->new([$$ref], ['$v']); + $dumper->Purity(1)->Terse(1)->Deparse(1)->Indent(0)->Useqq(1)->Sortkeys(1); + my $str = $dumper->Dump(); + if ($str =~ /^\$v/) { + return '${my ' . $str . ' \$v}'; + } else { + return $str; + } +} + +sub const_sv { + my $self = shift; + my $op = shift; + my $sv = $op->sv; + # the constant could be in the pad (under useithreads) + $sv = $self->padval($op->targ) unless $$sv; + return $sv; +} + +sub meth_sv { + my $self = shift; + my $op = shift; + my $sv = $op->meth_sv; + # the constant could be in the pad (under useithreads) + $sv = $self->padval($op->targ) unless $$sv; + return $sv; +} + +sub meth_rclass_sv { + my $self = shift; + my $op = shift; + my $sv = $op->rclass; + # the constant could be in the pad (under useithreads) + $sv = $self->padval($sv) unless ref $sv; + return $sv; +} + +sub pp_const { + my $self = shift; + my($op, $cx) = @_; +# if ($op->private & OPpCONST_BARE) { # trouble with '=>' autoquoting +# return $self->const_sv($op)->PV; +# } + my $sv = $self->const_sv($op); + return $self->const($sv, $cx); +} + + +# Join two components of a double-quoted string, disambiguating +# "${foo}bar", "${foo}{bar}", "${foo}[1]", "$foo\::bar" + +sub dq_disambiguate { + my ($first, $last) = @_; + ($last =~ /^[A-Z\\\^\[\]_?]/ && + $first =~ s/([\$@])\^$/${1}{^}/) # "${^}W" etc + || ($last =~ /^[:'{\[\w_]/ && #' + $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/); + return $first . $last; +} + + +# Deparse a double-quoted optree. For example, "$a[0]\Q$b\Efo\"o" gets +# compiled to concat(concat($[0],quotemeta($b)),const("fo\"o")), and this +# sub deparses it back to $a[0]\Q$b\Efo"o +# (It does not add delimiters) + +sub dq { + my $self = shift; + my $op = shift; + my $type = $op->name; + if ($type eq "const") { + return uninterp(escape_str(unback($self->const_sv($op)->as_string))); + } elsif ($type eq "concat") { + return dq_disambiguate($self->dq($op->first), $self->dq($op->last)); + } elsif ($type eq "multiconcat") { + return $self->do_multiconcat($op, 26, 1); + } elsif ($type eq "uc") { + return '\U' . $self->dq($op->first->sibling) . '\E'; + } elsif ($type eq "lc") { + return '\L' . $self->dq($op->first->sibling) . '\E'; + } elsif ($type eq "ucfirst") { + return '\u' . $self->dq($op->first->sibling); + } elsif ($type eq "lcfirst") { + return '\l' . $self->dq($op->first->sibling); + } elsif ($type eq "quotemeta") { + return '\Q' . $self->dq($op->first->sibling) . '\E'; + } elsif ($type eq "fc") { + return '\F' . $self->dq($op->first->sibling) . '\E'; + } elsif ($type eq "join") { + return $self->deparse($op->last, 26); # was join($", @ary) + } else { + return $self->deparse($op, 26); + } +} + +sub pp_backtick { + my $self = shift; + my($op, $cx) = @_; + # skip pushmark if it exists (readpipe() vs ``) + my $child = $op->first->sibling->isa('B::NULL') + ? $op->first : $op->first->sibling; + if ($self->pure_string($child)) { + return single_delim("qx", '`', $self->dq($child, 1), $self); + } + unop($self, @_, "readpipe"); +} + +sub dquote { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first->sibling; # skip ex-stringify, pushmark + return $self->deparse($kid, $cx) if $self->{'unquote'}; + $self->maybe_targmy($kid, $cx, + sub {single_delim("qq", '"', $self->dq($_[1]), + $self)}); +} + +# OP_STRINGIFY is a listop, but it only ever has one arg +sub pp_stringify { + my ($self, $op, $cx) = @_; + my $kid = $op->first->sibling; + while ($kid->name eq 'null' && !null($kid->first)) { + $kid = $kid->first; + } + if ($kid->name =~ /^(?:const|padsv|rv2sv|av2arylen|gvsv|multideref + |aelemfast(?:_lex)?|[ah]elem|join|concat)\z/x) { + maybe_targmy(@_, \&dquote); + } + else { + # Actually an optimised join. + my $result = listop(@_,"join"); + $result =~ s/join([( ])/join$1$self->{'ex_const'}, /; + $result; + } +} + +# tr/// and s/// (and tr[][], tr[]//, tr###, etc) +# note that tr(from)/to/ is OK, but not tr/from/(to) +sub double_delim { + my($from, $to) = @_; + my($succeed, $delim); + if ($from !~ m[/] and $to !~ m[/]) { + return "/$from/$to/"; + } elsif (($succeed, $from) = balanced_delim($from) and $succeed) { + if (($succeed, $to) = balanced_delim($to) and $succeed) { + return "$from$to"; + } else { + for $delim ('/', '"', '#') { # note no "'" -- s''' is special + return "$from$delim$to$delim" if index($to, $delim) == -1; + } + $to =~ s[/][\\/]g; + return "$from/$to/"; + } + } else { + for $delim ('/', '"', '#') { # note no ' + return "$delim$from$delim$to$delim" + if index($to . $from, $delim) == -1; + } + $from =~ s[/][\\/]g; + $to =~ s[/][\\/]g; + return "/$from/$to/"; + } +} + +# Escape a characrter. +# Only used by tr///, so backslashes hyphens + +sub pchr { # ASCII + my($n) = @_; + if ($n == ord '\\') { + return '\\\\'; + } elsif ($n == ord "-") { + return "\\-"; + } elsif (utf8::native_to_unicode($n) >= utf8::native_to_unicode(ord(' ')) + and utf8::native_to_unicode($n) <= utf8::native_to_unicode(ord('~'))) + { + # I'm presuming a regex is not ok here, otherwise we could have used + # /[[:print:]]/a to get here + return chr($n); + } elsif ($n == ord "\a") { + return '\\a'; + } elsif ($n == ord "\b") { + return '\\b'; + } elsif ($n == ord "\t") { + return '\\t'; + } elsif ($n == ord "\n") { + return '\\n'; + } elsif ($n == ord "\e") { + return '\\e'; + } elsif ($n == ord "\f") { + return '\\f'; + } elsif ($n == ord "\r") { + return '\\r'; + } elsif ($n >= ord("\cA") and $n <= ord("\cZ")) { + return '\\c' . $unctrl{chr $n}; + } else { +# return '\x' . sprintf("%02x", $n); + return '\\' . sprintf("%03o", $n); + } +} + +# Convert a list of characters into a string suitable for tr/// search or +# replacement, with suitable escaping and collapsing of ranges + +sub collapse { + my(@chars) = @_; + my($str, $c, $tr) = (""); + for ($c = 0; $c < @chars; $c++) { + $tr = $chars[$c]; + $str .= pchr($tr); + if ($c <= $#chars - 2 and $chars[$c + 1] == $tr + 1 and + $chars[$c + 2] == $tr + 2) + { + for (; $c <= $#chars-1 and $chars[$c + 1] == $chars[$c] + 1; $c++) + {} + $str .= "-"; + $str .= pchr($chars[$c]); + } + } + return $str; +} + +sub tr_decode_byte { + my($table, $flags) = @_; + my $ssize_t = $Config{ptrsize} == 8 ? 'q' : 'l'; + my ($size, @table) = unpack("${ssize_t}s*", $table); + pop @table; # remove the wildcard final entry + + my($c, $tr, @from, @to, @delfrom, $delhyphen); + if ($table[ord "-"] != -1 and + $table[ord("-") - 1] == -1 || $table[ord("-") + 1] == -1) + { + $tr = $table[ord "-"]; + $table[ord "-"] = -1; + if ($tr >= 0) { + @from = ord("-"); + @to = $tr; + } else { # -2 ==> delete + $delhyphen = 1; + } + } + for ($c = 0; $c < @table; $c++) { + $tr = $table[$c]; + if ($tr >= 0) { + push @from, $c; push @to, $tr; + } elsif ($tr == -2) { + push @delfrom, $c; + } + } + @from = (@from, @delfrom); + + if ($flags & OPpTRANS_COMPLEMENT) { + unless ($flags & OPpTRANS_DELETE) { + @to = () if ("@from" eq "@to"); + } + + my @newfrom = (); + my %from; + @from{@from} = (1) x @from; + for ($c = 0; $c < 256; $c++) { + push @newfrom, $c unless $from{$c}; + } + @from = @newfrom; + } + unless ($flags & OPpTRANS_DELETE || !@to) { + pop @to while $#to and $to[$#to] == $to[$#to -1]; + } + my($from, $to); + $from = collapse(@from); + $to = collapse(@to); + $from .= "-" if $delhyphen; + return ($from, $to); +} + +sub tr_chr { + my $x = shift; + if ($x == ord "-") { + return "\\-"; + } elsif ($x == ord "\\") { + return "\\\\"; + } else { + return chr $x; + } +} + +sub tr_invmap { + my ($invlist_ref, $map_ref) = @_; + + my $infinity = ~0 >> 1; # IV_MAX + my $from = ""; + my $to = ""; + + for my $i (0.. @$invlist_ref - 1) { + my $this_from = $invlist_ref->[$i]; + my $map = $map_ref->[$i]; + my $upper = ($i < @$invlist_ref - 1) + ? $invlist_ref->[$i+1] + : $infinity; + my $range = $upper - $this_from - 1; + if (DEBUG) { + print STDERR "i=$i, from=$this_from, upper=$upper, range=$range\n"; + } + next if $map == ~0; + next if $map == ~0 - 1; + $from .= tr_chr($this_from); + $to .= tr_chr($map); + next if $range == 0; # Single code point + if ($range == 1) { # Adjacent code points + $from .= tr_chr($this_from + 1); + $to .= tr_chr($map + 1); + } + elsif ($upper != $infinity) { + $from .= "-" . tr_chr($this_from + $range); + $to .= "-" . tr_chr($map + $range); + } + else { + $from .= "-INFTY"; + $to .= "-INFTY"; + } + } + + return ($from, $to); +} + +sub tr_decode_utf8 { + my($tr_av, $flags) = @_; + printf STDERR "flags=0x%x\n", $flags if DEBUG; + my $invlist = $tr_av->ARRAYelt(0); + my @invlist = unpack("J*", $invlist->PV); + my @map = unpack("J*", $tr_av->ARRAYelt(1)->PV); + + if (DEBUG) { + for my $i (0 .. @invlist - 1) { + printf STDERR "[%d]\t%x\t", $i, $invlist[$i]; + my $map = $map[$i]; + if ($map == ~0) { + print STDERR "TR_UNMAPPED\n"; + } + elsif ($map == ~0 - 1) { + print STDERR "TR_SPECIAL\n"; + } + else { + printf STDERR "%x\n", $map; + } + } + } + + my ($from, $to) = tr_invmap(\@invlist, \@map); + + if ($flags & OPpTRANS_COMPLEMENT) { + shift @map; + pop @invlist; + my $throw_away; + ($from, $throw_away) = tr_invmap(\@invlist, \@map); + } + + if (DEBUG) { + print STDERR "Returning ", escape_str($from), "/", + escape_str($to), "\n"; + } + return (escape_str($from), escape_str($to)); +} + +sub pp_trans { + my $self = shift; + my($op, $cx, $morflags) = @_; + my($from, $to); + my $class = class($op); + my $priv_flags = $op->private; + if ($class eq "PVOP") { + ($from, $to) = tr_decode_byte($op->pv, $priv_flags); + } elsif ($class eq "PADOP") { + ($from, $to) + = tr_decode_utf8($self->padval($op->padix), $priv_flags); + } else { # class($op) eq "SVOP" + ($from, $to) = tr_decode_utf8($op->sv, $priv_flags); + } + my $flags = ""; + $flags .= "c" if $priv_flags & OPpTRANS_COMPLEMENT; + $flags .= "d" if $priv_flags & OPpTRANS_DELETE; + $to = "" if $from eq $to and $flags eq ""; + $flags .= "s" if $priv_flags & OPpTRANS_SQUASH; + $flags .= $morflags if defined $morflags; + my $ret = $self->keyword("tr") . double_delim($from, $to) . $flags; + if (my $targ = $op->targ) { + return $self->maybe_parens($self->padname($targ) . " =~ $ret", + $cx, 20); + } + return $ret; +} + +sub pp_transr { push @_, 'r'; goto &pp_trans } + +# Join two components of a double-quoted re, disambiguating +# "${foo}bar", "${foo}{bar}", "${foo}[1]". + +sub re_dq_disambiguate { + my ($first, $last) = @_; + ($last =~ /^[A-Z\\\^\[\]_?]/ && + $first =~ s/([\$@])\^$/${1}{^}/) # "${^}W" etc + || ($last =~ /^[{\[\w_]/ && + $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/); + return $first . $last; +} + +# Like dq(), but different +sub re_dq { + my $self = shift; + my ($op) = @_; + + my $type = $op->name; + if ($type eq "const") { + my $unbacked = re_unback($self->const_sv($op)->as_string); + return re_uninterp(escape_re($unbacked)); + } elsif ($type eq "concat") { + my $first = $self->re_dq($op->first); + my $last = $self->re_dq($op->last); + return re_dq_disambiguate($first, $last); + } elsif ($type eq "multiconcat") { + return $self->do_multiconcat($op, 26, 2); + } elsif ($type eq "uc") { + return '\U' . $self->re_dq($op->first->sibling) . '\E'; + } elsif ($type eq "lc") { + return '\L' . $self->re_dq($op->first->sibling) . '\E'; + } elsif ($type eq "ucfirst") { + return '\u' . $self->re_dq($op->first->sibling); + } elsif ($type eq "lcfirst") { + return '\l' . $self->re_dq($op->first->sibling); + } elsif ($type eq "quotemeta") { + return '\Q' . $self->re_dq($op->first->sibling) . '\E'; + } elsif ($type eq "fc") { + return '\F' . $self->re_dq($op->first->sibling) . '\E'; + } elsif ($type eq "join") { + return $self->deparse($op->last, 26); # was join($", @ary) + } else { + my $ret = $self->deparse($op, 26); + $ret =~ s/^\$([(|)])\z/\${$1}/ # $( $| $) need braces + or $ret =~ s/^\@([-+])\z/\@{$1}/; # @- @+ need braces + return $ret; + } +} + +sub pure_string { + my ($self, $op) = @_; + return 0 if null $op; + my $type = $op->name; + + if ($type eq 'const' || $type eq 'av2arylen') { + return 1; + } + elsif ($type =~ /^(?:[ul]c(first)?|fc)$/ || $type eq 'quotemeta') { + return $self->pure_string($op->first->sibling); + } + elsif ($type eq 'join') { + my $join_op = $op->first->sibling; # Skip pushmark + return 0 unless $join_op->name eq 'null' && $join_op->targ == OP_RV2SV; + + my $gvop = $join_op->first; + return 0 unless $gvop->name eq 'gvsv'; + return 0 unless '"' eq $self->gv_name($self->gv_or_padgv($gvop)); + + return 0 unless ${$join_op->sibling} eq ${$op->last}; + return 0 unless $op->last->name =~ /^(?:[ah]slice|(?:rv2|pad)av)$/; + } + elsif ($type eq 'concat') { + return $self->pure_string($op->first) + && $self->pure_string($op->last); + } + elsif ($type eq 'multiconcat') { + my ($kid, @kids); + for ($kid = $op->first; !null $kid; $kid = $kid->sibling) { + # skip the consts and/or padsv we've optimised away + push @kids, $kid + unless $kid->type == OP_NULL + && ( $kid->targ == OP_PADSV + || $kid->targ == OP_CONST + || $kid->targ == OP_PUSHMARK); + } + + if ($op->flags & OPf_STACKED) { + # remove expr from @kids where 'expr = ...' or 'expr .= ....' + if ($op->private & OPpMULTICONCAT_APPEND) { + shift(@kids); + } + else { + pop(@kids); + } + } + for (@kids) { + return 0 unless $self->pure_string($_); + } + return 1; + } + elsif (is_scalar($op) || $type =~ /^[ah]elem$/) { + return 1; + } + elsif ($type eq "null" and $op->can('first') and not null $op->first) { + my $first = $op->first; + + return 1 if $first->name eq "multideref"; + return 1 if $first->name eq "aelemfast_lex"; + + if ( $first->name eq "null" + and $first->can('first') + and not null $first->first + and $first->first->name eq "aelemfast" + ) + { + return 1; + } + } + + return 0; +} + +sub code_list { + my ($self,$op,$cv) = @_; + + # localise stuff relating to the current sub + $cv and + local($self->{'curcv'}) = $cv, + local($self->{'curcvlex'}), + local(@$self{qw'curstash warnings hints hinthash curcop'}) + = @$self{qw'curstash warnings hints hinthash curcop'}; + + my $re; + for ($op = $op->first->sibling; !null($op); $op = $op->sibling) { + if ($op->name eq 'null' and $op->flags & OPf_SPECIAL) { + my $scope = $op->first; + # 0 context (last arg to scopeop) means statement context, so + # the contents of the block will not be wrapped in do{...}. + my $block = scopeop($scope->first->name eq "enter", $self, + $scope, 0); + # next op is the source code of the block + $op = $op->sibling; + $re .= ($self->const_sv($op)->PV =~ m|^(\(\?\??\{)|)[0]; + my $multiline = $block =~ /\n/; + $re .= $multiline ? "\n\t" : ' '; + $re .= $block; + $re .= $multiline ? "\n\b})" : " })"; + } else { + $re = re_dq_disambiguate($re, $self->re_dq($op)); + } + } + $re; +} + +sub regcomp { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + $kid = $kid->first if $kid->name eq "regcmaybe"; + $kid = $kid->first if $kid->name eq "regcreset"; + my $kname = $kid->name; + if ($kname eq "null" and !null($kid->first) + and $kid->first->name eq 'pushmark') + { + my $str = ''; + $kid = $kid->first->sibling; + while (!null($kid)) { + my $first = $str; + my $last = $self->re_dq($kid); + $str = re_dq_disambiguate($first, $last); + $kid = $kid->sibling; + } + return $str, 1; + } + + return ($self->re_dq($kid), 1) + if $kname =~ /^(?:rv2|pad)av/ or $self->pure_string($kid); + return ($self->deparse($kid, $cx), 0); +} + +sub pp_regcomp { + my ($self, $op, $cx) = @_; + return (($self->regcomp($op, $cx, 0))[0]); +} + +sub re_flags { + my ($self, $op) = @_; + my $flags = ''; + my $pmflags = $op->pmflags; + if (!$pmflags) { + my $re = $op->pmregexp; + if ($$re) { + $pmflags = $re->compflags; + } + } + $flags .= "g" if $pmflags & PMf_GLOBAL; + $flags .= "i" if $pmflags & PMf_FOLD; + $flags .= "m" if $pmflags & PMf_MULTILINE; + $flags .= "o" if $pmflags & PMf_KEEP; + $flags .= "s" if $pmflags & PMf_SINGLELINE; + $flags .= "x" if $pmflags & PMf_EXTENDED; + $flags .= "x" if $pmflags & PMf_EXTENDED_MORE; + $flags .= "p" if $pmflags & PMf_KEEPCOPY; + $flags .= "n" if $pmflags & PMf_NOCAPTURE; + if (my $charset = $pmflags & PMf_CHARSET) { + # Hardcoding this is fragile, but B does not yet export the + # constants we need. + $flags .= qw(d l u a aa)[$charset >> 7] + } + # The /d flag is indicated by 0; only show it if necessary. + elsif ($self->{hinthash} and + $self->{hinthash}{reflags_charset} + || $self->{hinthash}{feature_unicode} + or $self->{hints} & $feature::hint_mask + && ($self->{hints} & $feature::hint_mask) + != $feature::hint_mask + && $self->{hints} & $feature::hint_uni8bit + ) { + $flags .= 'd'; + } + $flags; +} + +# osmic acid -- see osmium tetroxide + +my %matchwords; +map($matchwords{join "", sort split //, $_} = $_, 'cig', 'cog', 'cos', 'cogs', + 'cox', 'go', 'is', 'ism', 'iso', 'mig', 'mix', 'osmic', 'ox', 'sic', + 'sig', 'six', 'smog', 'so', 'soc', 'sog', 'xi', 'soup', 'soupmix'); + +# When deparsing a regular expression with code blocks, we have to look in +# various places to find the blocks. +# +# For qr/(?{...})/ without interpolation, the CV is under $qr->qr_anoncv +# and the code list (list of blocks and constants, maybe vars) is under +# $cv->ROOT->first->code_list: +# ./perl -Ilib -MB -e 'use O "Concise", B::svref_2object(sub {qr/(?{die})/})->ROOT->first->first->sibling->pmregexp->qr_anoncv->object_2svref' +# +# For qr/$a(?{...})/ with interpolation, the code list is more accessible, +# under $pmop->code_list, but the $cv is something you have to dig for in +# the regcomp op’s kids: +# ./perl -Ilib -mO=Concise -e 'qr/$a(?{die})/' +# +# For m// and split //, things are much simpler. There is no CV. The code +# list is under $pmop->code_list. + +sub matchop { + my $self = shift; + my($op, $cx, $name, $delim) = @_; + my $kid = $op->first; + my ($binop, $var, $re) = ("", "", ""); + if ($op->name ne 'split' && $op->flags & OPf_STACKED) { + $binop = 1; + $var = $self->deparse($kid, 20); + $kid = $kid->sibling; + } + # not $name; $name will be 'm' for both match and split + elsif ($op->name eq 'match' and my $targ = $op->targ) { + $binop = 1; + $var = $self->padname($targ); + } + my $quote = 1; + my $pmflags = $op->pmflags; + my $rhs_bound_to_defsv; + my ($cv, $bregexp); + my $have_kid = !null $kid; + # Check for code blocks first + if (not null my $code_list = $op->code_list) { + $re = $self->code_list($code_list, + $op->name eq 'qr' + ? $self->padval( + $kid->first # ex-list + ->first # pushmark + ->sibling # entersub + ->first # ex-list + ->first # pushmark + ->sibling # srefgen + ->first # ex-list + ->first # anoncode + ->targ + ) + : undef); + } elsif (${$bregexp = $op->pmregexp} && ${$cv = $bregexp->qr_anoncv}) { + my $patop = $cv->ROOT # leavesub + ->first # qr + ->code_list;# list + $re = $self->code_list($patop, $cv); + } elsif (!$have_kid) { + $re = re_uninterp(escape_re(re_unback($op->precomp))); + } elsif ($kid->name ne 'regcomp') { + if ($op->name eq 'split') { + # split has other kids, not just regcomp + $re = re_uninterp(escape_re(re_unback($op->precomp))); + } + else { + carp("found ".$kid->name." where regcomp expected"); + } + } else { + ($re, $quote) = $self->regcomp($kid, 21); + } + if ($have_kid and $kid->name eq 'regcomp') { + my $matchop = $kid->first; + if ($matchop->name eq 'regcreset') { + $matchop = $matchop->first; + } + if ($matchop->name =~ /^(?:match|transr?|subst)\z/ + && $matchop->flags & OPf_SPECIAL) { + $rhs_bound_to_defsv = 1; + } + } + my $flags = ""; + $flags .= "c" if $pmflags & PMf_CONTINUE; + $flags .= $self->re_flags($op); + $flags = join '', sort split //, $flags; + $flags = $matchwords{$flags} if $matchwords{$flags}; + if ($pmflags & PMf_ONCE) { # only one kind of delimiter works here + $re =~ s/\?/\\?/g; + $re = $self->keyword("m") . "?$re?"; # explicit 'm' is required + } elsif ($quote) { + $re = single_delim($name, $delim, $re, $self); + } + $re = $re . $flags if $quote; + if ($binop) { + return + $self->maybe_parens( + $rhs_bound_to_defsv + ? "$var =~ (\$_ =~ $re)" + : "$var =~ $re", + $cx, 20 + ); + } else { + return $re; + } +} + +sub pp_match { matchop(@_, "m", "/") } +sub pp_qr { matchop(@_, "qr", "") } + +sub pp_runcv { unop(@_, "__SUB__"); } + +sub pp_split { + my $self = shift; + my($op, $cx) = @_; + my($kid, @exprs, $ary, $expr); + my $stacked = $op->flags & OPf_STACKED; + + $kid = $op->first; + $kid = $kid->sibling if $kid->name eq 'regcomp'; + for (; !null($kid); $kid = $kid->sibling) { + push @exprs, $self->deparse($kid, 6); + } + + unshift @exprs, $self->matchop($op, $cx, "m", "/"); + + if ($op->private & OPpSPLIT_ASSIGN) { + # With C<@array = split(/pat/, str);>, + # array is stored in split's pmreplroot; either + # as an integer index into the pad (for a lexical array) + # or as GV for a package array (which will be a pad index + # on threaded builds) + # With my/our @array = split(/pat/, str), the array is instead + # accessed via an extra padav/rv2av op at the end of the + # split's kid ops. + + if ($stacked) { + $ary = pop @exprs; + } + else { + if ($op->private & OPpSPLIT_LEX) { + $ary = $self->padname($op->pmreplroot); + } + else { + # union with op_pmtargetoff, op_pmtargetgv + my $gv = $op->pmreplroot; + $gv = $self->padval($gv) if !ref($gv); + $ary = $self->maybe_local(@_, + $self->stash_variable('@', + $self->gv_name($gv), + $cx)) + } + if ($op->private & OPpLVAL_INTRO) { + $ary = $op->private & OPpSPLIT_LEX ? "my $ary" : "local $ary"; + } + } + } + + # handle special case of split(), and split(' ') that compiles to /\s+/ + $exprs[0] = q{' '} if ($op->reflags // 0) & RXf_SKIPWHITE(); + + $expr = "split(" . join(", ", @exprs) . ")"; + if ($ary) { + return $self->maybe_parens("$ary = $expr", $cx, 7); + } else { + return $expr; + } +} + +# oxime -- any of various compounds obtained chiefly by the action of +# hydroxylamine on aldehydes and ketones and characterized by the +# bivalent grouping C=NOH [Webster's Tenth] + +my %substwords; +map($substwords{join "", sort split //, $_} = $_, 'ego', 'egoism', 'em', + 'es', 'ex', 'exes', 'gee', 'go', 'goes', 'ie', 'ism', 'iso', 'me', + 'meese', 'meso', 'mig', 'mix', 'os', 'ox', 'oxime', 'see', 'seem', + 'seg', 'sex', 'sig', 'six', 'smog', 'sog', 'some', 'xi', 'rogue', + 'sir', 'rise', 'smore', 'more', 'seer', 'rome', 'gore', 'grim', 'grime', + 'or', 'rose', 'rosie'); + +sub pp_subst { + my $self = shift; + my($op, $cx) = @_; + my $kid = $op->first; + my($binop, $var, $re, $repl) = ("", "", "", ""); + if ($op->flags & OPf_STACKED) { + $binop = 1; + $var = $self->deparse($kid, 20); + $kid = $kid->sibling; + } + elsif (my $targ = $op->targ) { + $binop = 1; + $var = $self->padname($targ); + } + my $flags = ""; + my $pmflags = $op->pmflags; + if (null($op->pmreplroot)) { + $repl = $kid; + $kid = $kid->sibling; + } else { + $repl = $op->pmreplroot->first; # skip substcont + } + while ($repl->name eq "entereval") { + $repl = $repl->first; + $flags .= "e"; + } + { + local $self->{in_subst_repl} = 1; + if ($pmflags & PMf_EVAL) { + $repl = $self->deparse($repl->first, 0); + } else { + $repl = $self->dq($repl); + } + } + if (not null my $code_list = $op->code_list) { + $re = $self->code_list($code_list); + } elsif (null $kid) { + $re = re_uninterp(escape_re(re_unback($op->precomp))); + } else { + ($re) = $self->regcomp($kid, 1); + } + $flags .= "r" if $pmflags & PMf_NONDESTRUCT; + $flags .= "e" if $pmflags & PMf_EVAL; + $flags .= $self->re_flags($op); + $flags = join '', sort split //, $flags; + $flags = $substwords{$flags} if $substwords{$flags}; + my $core_s = $self->keyword("s"); # maybe CORE::s + if ($binop) { + return $self->maybe_parens("$var =~ $core_s" + . double_delim($re, $repl) . $flags, + $cx, 20); + } else { + return "$core_s". double_delim($re, $repl) . $flags; + } +} + +sub is_lexical_subs { + my (@ops) = shift; + for my $op (@ops) { + return 0 if $op->name !~ /\A(?:introcv|clonecv)\z/; + } + return 1; +} + +# Pretend these two ops do not exist. The perl parser adds them to the +# beginning of any block containing my-sub declarations, whereas we handle +# the subs in pad_subs and next_todo. +*pp_clonecv = *pp_introcv; +sub pp_introcv { + my $self = shift; + my($op, $cx) = @_; + # For now, deparsing doesn't worry about the distinction between introcv + # and clonecv, so pretend this op doesn't exist: + return ''; +} + +sub pp_padcv { + my $self = shift; + my($op, $cx) = @_; + return $self->padany($op); +} + +my %lvref_funnies = ( + OPpLVREF_SV, => '$', + OPpLVREF_AV, => '@', + OPpLVREF_HV, => '%', + OPpLVREF_CV, => '&', +); + +sub pp_refassign { + my ($self, $op, $cx) = @_; + my $left; + if ($op->private & OPpLVREF_ELEM) { + $left = $op->first->sibling; + $left = maybe_local(@_, elem($self, $left, undef, + $left->targ == OP_AELEM + ? qw([ ] padav) + : qw({ } padhv))); + } elsif ($op->flags & OPf_STACKED) { + $left = maybe_local(@_, + $lvref_funnies{$op->private & OPpLVREF_TYPE} + . $self->deparse($op->first->sibling)); + } else { + $left = &pp_padsv; + } + my $right = $self->deparse_binop_right($op, $op->first, 7); + return $self->maybe_parens("\\$left = $right", $cx, 7); +} + +sub pp_lvref { + my ($self, $op, $cx) = @_; + my $code; + if ($op->private & OPpLVREF_ELEM) { + $code = $op->first->name =~ /av\z/ ? &pp_aelem : &pp_helem; + } elsif ($op->flags & OPf_STACKED) { + $code = maybe_local(@_, + $lvref_funnies{$op->private & OPpLVREF_TYPE} + . $self->deparse($op->first)); + } else { + $code = &pp_padsv; + } + "\\$code"; +} + +sub pp_lvrefslice { + my ($self, $op, $cx) = @_; + '\\' . ($op->last->name =~ /av\z/ ? &pp_aslice : &pp_hslice); +} + +sub pp_lvavref { + my ($self, $op, $cx) = @_; + '\\(' . ($op->flags & OPf_STACKED + ? maybe_local(@_, rv2x(@_, "\@")) + : &pp_padsv) . ')' +} + + +sub pp_argcheck { + my $self = shift; + my($op, $cx) = @_; + my ($params, $opt_params, $slurpy) = $op->aux_list($self->{curcv}); + my $mandatory = $params - $opt_params; + my $check = ''; + + $check .= < 0; +die sprintf("Too few arguments for subroutine at %s line %d.\\n", (caller)[1, 2]) unless \@_ >= $mandatory; +EOF + + my $cond = ($params & 1) ? 'unless' : 'if'; + $check .= < $params && ((\@_ - $params) & 1); +EOF + + $check =~ s/;\n\z//; + return $check; +} + + +sub pp_argelem { + my $self = shift; + my($op, $cx) = @_; + my $var = $self->padname($op->targ); + my $ix = $op->string($self->{curcv}); + my $expr; + if ($op->flags & OPf_KIDS) { + $expr = $self->deparse($op->first, 7); + } + elsif ($var =~ /^[@%]/) { + $expr = $ix ? "\@_[$ix .. \$#_]" : '@_'; + } + else { + $expr = "\$_[$ix]"; + } + return "my $var = $expr"; +} + + +sub pp_argdefelem { + my $self = shift; + my($op, $cx) = @_; + my $ix = $op->targ; + my $expr = "\@_ >= " . ($ix+1) . " ? \$_[$ix] : "; + my $def = $self->deparse($op->first, 7); + $def = "($def)" if $op->first->flags & OPf_PARENS; + $expr .= $self->deparse($op->first, $cx); + return $expr; +} + + +1; +__END__ + +=head1 NAME + +B::Deparse - Perl compiler backend to produce perl code + +=head1 SYNOPSIS + +B B<-MO=Deparse>[B<,-d>][B<,-f>I][B<,-p>][B<,-q>][B<,-l>] + [B<,-s>I][B<,-x>I] I + +=head1 DESCRIPTION + +B::Deparse is a backend module for the Perl compiler that generates +perl source code, based on the internal compiled structure that perl +itself creates after parsing a program. The output of B::Deparse won't +be exactly the same as the original source, since perl doesn't keep +track of comments or whitespace, and there isn't a one-to-one +correspondence between perl's syntactical constructions and their +compiled form, but it will often be close. When you use the B<-p> +option, the output also includes parentheses even when they are not +required by precedence, which can make it easy to see if perl is +parsing your expressions the way you intended. + +While B::Deparse goes to some lengths to try to figure out what your +original program was doing, some parts of the language can still trip +it up; it still fails even on some parts of Perl's own test suite. If +you encounter a failure other than the most common ones described in +the BUGS section below, you can help contribute to B::Deparse's +ongoing development by submitting a bug report with a small +example. + +=head1 OPTIONS + +As with all compiler backend options, these must follow directly after +the '-MO=Deparse', separated by a comma but not any white space. + +=over 4 + +=item B<-d> + +Output data values (when they appear as constants) using Data::Dumper. +Without this option, B::Deparse will use some simple routines of its +own for the same purpose. Currently, Data::Dumper is better for some +kinds of data (such as complex structures with sharing and +self-reference) while the built-in routines are better for others +(such as odd floating-point values). + +=item B<-f>I + +Normally, B::Deparse deparses the main code of a program, and all the subs +defined in the same file. To include subs defined in +other files, pass the B<-f> option with the filename. +You can pass the B<-f> option several times, to +include more than one secondary file. (Most of the time you don't want to +use it at all.) You can also use this option to include subs which are +defined in the scope of a B<#line> directive with two parameters. + +=item B<-l> + +Add '#line' declarations to the output based on the line and file +locations of the original code. + +=item B<-p> + +Print extra parentheses. Without this option, B::Deparse includes +parentheses in its output only when they are needed, based on the +structure of your program. With B<-p>, it uses parentheses (almost) +whenever they would be legal. This can be useful if you are used to +LISP, or if you want to see how perl parses your input. If you say + + if ($var & 0x7f == 65) {print "Gimme an A!"} + print ($which ? $a : $b), "\n"; + $name = $ENV{USER} or "Bob"; + +C will print + + if (($var & 0)) { + print('Gimme an A!') + }; + (print(($which ? $a : $b)), '???'); + (($name = $ENV{'USER'}) or '???') + +which probably isn't what you intended (the C<'???'> is a sign that +perl optimized away a constant value). + +=item B<-P> + +Disable prototype checking. With this option, all function calls are +deparsed as if no prototype was defined for them. In other words, + + perl -MO=Deparse,-P -e 'sub foo (\@) { 1 } foo @x' + +will print + + sub foo (\@) { + 1; + } + &foo(\@x); + +making clear how the parameters are actually passed to C. + +=item B<-q> + +Expand double-quoted strings into the corresponding combinations of +concatenation, uc, ucfirst, lc, lcfirst, quotemeta, and join. For +instance, print + + print "Hello, $world, @ladies, \u$gentlemen\E, \u\L$me!"; + +as + + print 'Hello, ' . $world . ', ' . join($", @ladies) . ', ' + . ucfirst($gentlemen) . ', ' . ucfirst(lc $me . '!'); + +Note that the expanded form represents the way perl handles such +constructions internally -- this option actually turns off the reverse +translation that B::Deparse usually does. On the other hand, note that +C<$x = "$y"> is not the same as C<$x = $y>: the former makes the value +of $y into a string before doing the assignment. + +=item B<-s>I + +Tweak the style of B::Deparse's output. The letters should follow +directly after the 's', with no space or punctuation. The following +options are available: + +=over 4 + +=item B + +Cuddle C, C, and C blocks. For example, print + + if (...) { + ... + } else { + ... + } + +instead of + + if (...) { + ... + } + else { + ... + } + +The default is not to cuddle. + +=item BI + +Indent lines by multiples of I columns. The default is 4 columns. + +=item B + +Use tabs for each 8 columns of indent. The default is to use only spaces. +For instance, if the style options are B<-si4T>, a line that's indented +3 times will be preceded by one tab and four spaces; if the options were +B<-si8T>, the same line would be preceded by three tabs. + +=item BIB<.> + +Print I for the value of a constant that can't be determined +because it was optimized away (mnemonic: this happens when a constant +is used in Boid context). The end of the string is marked by a period. +The string should be a valid perl expression, generally a constant. +Note that unless it's a number, it probably needs to be quoted, and on +a command line quotes need to be protected from the shell. Some +conventional values include 0, 1, 42, '', 'foo', and +'Useless use of constant omitted' (which may need to be +B<-sv"'Useless use of constant omitted'."> +or something similar depending on your shell). The default is '???'. +If you're using B::Deparse on a module or other file that's require'd, +you shouldn't use a value that evaluates to false, since the customary +true constant at the end of a module will be in void context when the +file is compiled as a main program. + +=back + +=item B<-x>I + +Expand conventional syntax constructions into equivalent ones that expose +their internal operation. I should be a digit, with higher values +meaning more expansion. As with B<-q>, this actually involves turning off +special cases in B::Deparse's normal operations. + +If I is at least 3, C loops will be translated into equivalent +while loops with continue blocks; for instance + + for ($i = 0; $i < 10; ++$i) { + print $i; + } + +turns into + + $i = 0; + while ($i < 10) { + print $i; + } continue { + ++$i + } + +Note that in a few cases this translation can't be perfectly carried back +into the source code -- if the loop's initializer declares a my variable, +for instance, it won't have the correct scope outside of the loop. + +If I is at least 5, C declarations will be translated into +C blocks containing calls to C and C; for +instance, + + use strict 'refs'; + +turns into + + sub BEGIN { + require strict; + do { + 'strict'->import('refs') + }; + } + +If I is at least 7, C statements will be translated into +equivalent expressions using C<&&>, C and C; for instance + + print 'hi' if $nice; + if ($nice) { + print 'hi'; + } + if ($nice) { + print 'hi'; + } else { + print 'bye'; + } + +turns into + + $nice and print 'hi'; + $nice and do { print 'hi' }; + $nice ? do { print 'hi' } : do { print 'bye' }; + +Long sequences of elsifs will turn into nested ternary operators, which +B::Deparse doesn't know how to indent nicely. + +=back + +=head1 USING B::Deparse AS A MODULE + +=head2 Synopsis + + use B::Deparse; + $deparse = B::Deparse->new("-p", "-sC"); + $body = $deparse->coderef2text(\&func); + eval "sub func $body"; # the inverse operation + +=head2 Description + +B::Deparse can also be used on a sub-by-sub basis from other perl +programs. + +=head2 new + + $deparse = B::Deparse->new(OPTIONS) + +Create an object to store the state of a deparsing operation and any +options. The options are the same as those that can be given on the +command line (see L); options that are separated by commas +after B<-MO=Deparse> should be given as separate strings. + +=head2 ambient_pragmas + + $deparse->ambient_pragmas(strict => 'all', '$[' => $[); + +The compilation of a subroutine can be affected by a few compiler +directives, B. These are: + +=over 4 + +=item * + +use strict; + +=item * + +use warnings; + +=item * + +Assigning to the special variable $[ + +=item * + +use integer; + +=item * + +use bytes; + +=item * + +use utf8; + +=item * + +use re; + +=back + +Ordinarily, if you use B::Deparse on a subroutine which has +been compiled in the presence of one or more of these pragmas, +the output will include statements to turn on the appropriate +directives. So if you then compile the code returned by coderef2text, +it will behave the same way as the subroutine which you deparsed. + +However, you may know that you intend to use the results in a +particular context, where some pragmas are already in scope. In +this case, you use the B method to describe the +assumptions you wish to make. + +Not all of the options currently have any useful effect. See +L for more details. + +The parameters it accepts are: + +=over 4 + +=item strict + +Takes a string, possibly containing several values separated +by whitespace. The special values "all" and "none" mean what you'd +expect. + + $deparse->ambient_pragmas(strict => 'subs refs'); + +=item $[ + +Takes a number, the value of the array base $[. +Obsolete: cannot be non-zero. + +=item bytes + +=item utf8 + +=item integer + +If the value is true, then the appropriate pragma is assumed to +be in the ambient scope, otherwise not. + +=item re + +Takes a string, possibly containing a whitespace-separated list of +values. The values "all" and "none" are special. It's also permissible +to pass an array reference here. + + $deparser->ambient_pragmas(re => 'eval'); + + +=item warnings + +Takes a string, possibly containing a whitespace-separated list of +values. The values "all" and "none" are special, again. It's also +permissible to pass an array reference here. + + $deparser->ambient_pragmas(warnings => [qw[void io]]); + +If one of the values is the string "FATAL", then all the warnings +in that list will be considered fatal, just as with the B +pragma itself. Should you need to specify that some warnings are +fatal, and others are merely enabled, you can pass the B +parameter twice: + + $deparser->ambient_pragmas( + warnings => 'all', + warnings => [FATAL => qw/void io/], + ); + +See L for more information about lexical warnings. + +=item hint_bits + +=item warning_bits + +These two parameters are used to specify the ambient pragmas in +the format used by the special variables $^H and ${^WARNING_BITS}. + +They exist principally so that you can write code like: + + { my ($hint_bits, $warning_bits); + BEGIN {($hint_bits, $warning_bits) = ($^H, ${^WARNING_BITS})} + $deparser->ambient_pragmas ( + hint_bits => $hint_bits, + warning_bits => $warning_bits, + '$[' => 0 + $[ + ); } + +which specifies that the ambient pragmas are exactly those which +are in scope at the point of calling. + +=item %^H + +This parameter is used to specify the ambient pragmas which are +stored in the special hash %^H. + +=back + +=head2 coderef2text + + $body = $deparse->coderef2text(\&func) + $body = $deparse->coderef2text(sub ($$) { ... }) + +Return source code for the body of a subroutine (a block, optionally +preceded by a prototype in parens), given a reference to the +sub. Because a subroutine can have no names, or more than one name, +this method doesn't return a complete subroutine definition -- if you +want to eval the result, you should prepend "sub subname ", or "sub " +for an anonymous function constructor. Unless the sub was defined in +the main:: package, the code will include a package declaration. + +=head1 BUGS + +=over 4 + +=item * + +The only pragmas to +be completely supported are: C, +C, C, C +and C. + +Excepting those listed above, we're currently unable to guarantee that +B::Deparse will produce a pragma at the correct point in the program. +(Specifically, pragmas at the beginning of a block often appear right +before the start of the block instead.) +Since the effects of pragmas are often lexically scoped, this can mean +that the pragma holds sway over a different portion of the program +than in the input file. + +=item * + +In fact, the above is a specific instance of a more general problem: +we can't guarantee to produce BEGIN blocks or C declarations in +exactly the right place. So if you use a module which affects compilation +(such as by over-riding keywords, overloading constants or whatever) +then the output code might not work as intended. + +=item * + +Some constants don't print correctly either with or without B<-d>. +For instance, neither B::Deparse nor Data::Dumper know how to print +dual-valued scalars correctly, as in: + + use constant E2BIG => ($!=7); $y = E2BIG; print $y, 0+$y; + + use constant H => { "#" => 1 }; H->{"#"}; + +=item * + +An input file that uses source filtering probably won't be deparsed into +runnable code, because it will still include the B declaration +for the source filtering module, even though the code that is +produced is already ordinary Perl which shouldn't be filtered again. + +=item * + +Optimized-away statements are rendered as +'???'. This includes statements that +have a compile-time side-effect, such as the obscure + + my $x if 0; + +which is not, consequently, deparsed correctly. + + foreach my $i (@_) { 0 } + => + foreach my $i (@_) { '???' } + +=item * + +Lexical (my) variables declared in scopes external to a subroutine +appear in coderef2text output text as package variables. This is a tricky +problem, as perl has no native facility for referring to a lexical variable +defined within a different scope, although L is a good start. + +See also L, which combines B::Deparse and +L to serialize closures properly. + +=item * + +There are probably many more bugs on non-ASCII platforms (EBCDIC). + +=back + +=head1 AUTHOR + +Stephen McCamant , based on an earlier version +by Malcolm Beattie , with contributions from +Gisle Aas, James Duncan, Albert Dvornik, Robin Houston, Dave Mitchell, +Hugo van der Sanden, Gurusamy Sarathy, Nick Ing-Simmons, and Rafael +Garcia-Suarez. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/B/Op_private.pm b/data/miniconda3/lib/perl5/core_perl/B/Op_private.pm new file mode 100644 index 0000000000000000000000000000000000000000..f30a6922a2e8b5328e35706177ce6da4ddb3ec76 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/B/Op_private.pm @@ -0,0 +1,900 @@ +# -*- buffer-read-only: t -*- +# +# lib/B/Op_private.pm +# +# Copyright (C) 2014 by Larry Wall and others +# +# You may distribute under the terms of either the GNU General Public +# License or the Artistic License, as specified in the README file. +# +# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! +# This file is built by regen/opcode.pl from data in +# regen/op_private and pod embedded in regen/opcode.pl. +# Any changes made here will be lost! + +=head1 NAME + +B::Op_private - OP op_private flag definitions + +=head1 SYNOPSIS + + use B::Op_private; + + # flag details for bit 7 of OP_AELEM's op_private: + my $name = $B::Op_private::bits{aelem}{7}; # OPpLVAL_INTRO + my $value = $B::Op_private::defines{$name}; # 128 + my $label = $B::Op_private::labels{$name}; # LVINTRO + + # the bit field at bits 5..6 of OP_AELEM's op_private: + my $bf = $B::Op_private::bits{aelem}{6}; + my $mask = $bf->{bitmask}; # etc + +=head1 DESCRIPTION + +This module provides four global hashes: + + %B::Op_private::bits + %B::Op_private::defines + %B::Op_private::labels + %B::Op_private::ops_using + +which contain information about the per-op meanings of the bits in the +op_private field. + +=head2 C<%bits> + +This is indexed by op name and then bit number (0..7). For single bit flags, +it returns the name of the define (if any) for that bit: + + $B::Op_private::bits{aelem}{7} eq 'OPpLVAL_INTRO'; + +For bit fields, it returns a hash ref containing details about the field. +The same reference will be returned for all bit positions that make +up the bit field; so for example these both return the same hash ref: + + $bitfield = $B::Op_private::bits{aelem}{5}; + $bitfield = $B::Op_private::bits{aelem}{6}; + +The general format of this hash ref is + + { + # The bit range and mask; these are always present. + bitmin => 5, + bitmax => 6, + bitmask => 0x60, + + # (The remaining keys are optional) + + # The names of any defines that were requested: + mask_def => 'OPpFOO_MASK', + baseshift_def => 'OPpFOO_SHIFT', + bitcount_def => 'OPpFOO_BITS', + + # If present, Concise etc will display the value with a 'FOO=' + # prefix. If it equals '-', then Concise will treat the bit + # field as raw bits and not try to interpret it. + label => 'FOO', + + # If present, specifies the names of some defines and the + # display labels that are used to assign meaning to particu- + # lar integer values within the bit field; e.g. 3 is dis- + # played as 'C'. + enum => [ qw( + 1 OPpFOO_A A + 2 OPpFOO_B B + 3 OPpFOO_C C + )], + + }; + + +=head2 C<%defines> + +This gives the value of every C define, e.g. + + $B::Op_private::defines{OPpLVAL_INTRO} == 128; + +=head2 C<%labels> + +This gives the short display label for each define, as used by C +and C, e.g. + + $B::Op_private::labels{OPpLVAL_INTRO} eq 'LVINTRO'; + +If the label equals '-', then Concise will treat the bit as a raw bit and +not try to display it symbolically. + +=head2 C<%ops_using> + +For each define, this gives a reference to an array of op names that use +the flag. + + @ops_using_lvintro = @{ $B::Op_private::ops_using{OPp_LVAL_INTRO} }; + +=cut + +package B::Op_private; + +our %bits; + + +our $VERSION = "5.032001"; + +$bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv); +$bits{$_}{6} = 'OPpENTERSUB_DB' for qw(entersub rv2cv); +$bits{$_}{2} = 'OPpENTERSUB_HASTARG' for qw(entersub rv2cv); +$bits{$_}{6} = 'OPpFLIP_LINENUM' for qw(flip flop); +$bits{$_}{1} = 'OPpFT_ACCESS' for qw(fteexec fteread ftewrite ftrexec ftrread ftrwrite); +$bits{$_}{4} = 'OPpFT_AFTER_t' for qw(ftatime ftbinary ftblk ftchr ftctime ftdir fteexec fteowned fteread ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftrwrite ftsgid ftsize ftsock ftsuid ftsvtx fttext fttty ftzero); +$bits{$_}{2} = 'OPpFT_STACKED' for qw(ftatime ftbinary ftblk ftchr ftctime ftdir fteexec fteowned fteread ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftrwrite ftsgid ftsize ftsock ftsuid ftsvtx fttext fttty ftzero); +$bits{$_}{3} = 'OPpFT_STACKING' for qw(ftatime ftbinary ftblk ftchr ftctime ftdir fteexec fteowned fteread ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftrwrite ftsgid ftsize ftsock ftsuid ftsvtx fttext fttty ftzero); +$bits{$_}{1} = 'OPpHINT_STRICT_REFS' for qw(entersub multideref rv2av rv2cv rv2gv rv2hv rv2sv); +$bits{$_}{5} = 'OPpHUSH_VMSISH' for qw(dbstate nextstate); +$bits{$_}{6} = 'OPpINDEX_BOOLNEG' for qw(index rindex); +$bits{$_}{1} = 'OPpITER_REVERSED' for qw(enteriter iter); +$bits{$_}{7} = 'OPpLVALUE' for qw(leave leaveloop); +$bits{$_}{6} = 'OPpLVAL_DEFER' for qw(aelem helem multideref); +$bits{$_}{7} = 'OPpLVAL_INTRO' for qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list lvavref lvref lvrefslice multiconcat multideref padav padhv padrange padsv pushmark refassign rv2av rv2gv rv2hv rv2sv split); +$bits{$_}{2} = 'OPpLVREF_ELEM' for qw(lvref refassign); +$bits{$_}{3} = 'OPpLVREF_ITER' for qw(lvref refassign); +$bits{$_}{3} = 'OPpMAYBE_LVSUB' for qw(aassign aelem akeys aslice av2arylen avhvswitch helem hslice keys kvaslice kvhslice multideref padav padhv pos rv2av rv2gv rv2hv substr values vec); +$bits{$_}{4} = 'OPpMAYBE_TRUEBOOL' for qw(padhv ref rv2hv); +$bits{$_}{7} = 'OPpOFFBYONE' for qw(caller runcv wantarray); +$bits{$_}{5} = 'OPpOPEN_IN_CRLF' for qw(backtick open); +$bits{$_}{4} = 'OPpOPEN_IN_RAW' for qw(backtick open); +$bits{$_}{7} = 'OPpOPEN_OUT_CRLF' for qw(backtick open); +$bits{$_}{6} = 'OPpOPEN_OUT_RAW' for qw(backtick open); +$bits{$_}{6} = 'OPpOUR_INTRO' for qw(enteriter gvsv rv2av rv2hv rv2sv split); +$bits{$_}{6} = 'OPpPAD_STATE' for qw(lvavref lvref padav padhv padsv pushmark refassign); +$bits{$_}{7} = 'OPpPV_IS_UTF8' for qw(dump goto last next redo); +$bits{$_}{6} = 'OPpREFCOUNTED' for qw(leave leaveeval leavesub leavesublv leavewrite); +$bits{$_}{2} = 'OPpSLICEWARNING' for qw(aslice hslice padav padhv rv2av rv2hv); +$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_subtract index int kill left_shift length link log mkdir modulo multiconcat multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push rand rename right_shift rindex rmdir schomp scomplement setpgrp setpriority sin sleep sqrt srand stringify subtract symlink system time unlink unshift utime wait waitpid); +$bits{$_}{0} = 'OPpTRANS_CAN_FORCE_UTF8' for qw(trans transr); +$bits{$_}{5} = 'OPpTRANS_COMPLEMENT' for qw(trans transr); +$bits{$_}{7} = 'OPpTRANS_DELETE' for qw(trans transr); +$bits{$_}{6} = 'OPpTRANS_GROWS' for qw(trans transr); +$bits{$_}{2} = 'OPpTRANS_IDENTICAL' for qw(trans transr); +$bits{$_}{3} = 'OPpTRANS_SQUASH' for qw(trans transr); +$bits{$_}{1} = 'OPpTRANS_USE_SVOP' for qw(trans transr); +$bits{$_}{5} = 'OPpTRUEBOOL' for qw(grepwhile index length padav padhv pos ref rindex rv2av rv2hv subst); + +my @bf = ( + { + label => '-', + mask_def => 'OPpARG1_MASK', + bitmin => 0, + bitmax => 0, + bitmask => 1, + }, + { + label => '-', + mask_def => 'OPpARG2_MASK', + bitmin => 0, + bitmax => 1, + bitmask => 3, + }, + { + label => 'offset', + mask_def => 'OPpAVHVSWITCH_MASK', + bitmin => 0, + bitmax => 1, + bitmask => 3, + }, + { + label => '-', + mask_def => 'OPpARG3_MASK', + bitmin => 0, + bitmax => 2, + bitmask => 7, + }, + { + label => '-', + mask_def => 'OPpARG4_MASK', + bitmin => 0, + bitmax => 3, + bitmask => 15, + }, + { + label => 'range', + mask_def => 'OPpPADRANGE_COUNTMASK', + bitcount_def => 'OPpPADRANGE_COUNTSHIFT', + bitmin => 0, + bitmax => 6, + bitmask => 127, + }, + { + label => 'key', + bitmin => 0, + bitmax => 7, + bitmask => 255, + }, + { + mask_def => 'OPpARGELEM_MASK', + bitmin => 1, + bitmax => 2, + bitmask => 6, + enum => [ + 0, 'OPpARGELEM_SV', 'SV', + 1, 'OPpARGELEM_AV', 'AV', + 2, 'OPpARGELEM_HV', 'HV', + ], + }, + { + mask_def => 'OPpDEREF', + bitmin => 4, + bitmax => 5, + bitmask => 48, + enum => [ + 1, 'OPpDEREF_AV', 'DREFAV', + 2, 'OPpDEREF_HV', 'DREFHV', + 3, 'OPpDEREF_SV', 'DREFSV', + ], + }, + { + mask_def => 'OPpLVREF_TYPE', + bitmin => 4, + bitmax => 5, + bitmask => 48, + enum => [ + 0, 'OPpLVREF_SV', 'SV', + 1, 'OPpLVREF_AV', 'AV', + 2, 'OPpLVREF_HV', 'HV', + 3, 'OPpLVREF_CV', 'CV', + ], + }, +); + +@{$bits{aassign}}{6,5,4,2,1,0} = ('OPpASSIGN_COMMON_SCALAR', 'OPpASSIGN_COMMON_RC1', 'OPpASSIGN_COMMON_AGG', 'OPpASSIGN_TRUEBOOL', $bf[1], $bf[1]); +$bits{abs}{0} = $bf[0]; +@{$bits{accept}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{add}}{1,0} = ($bf[1], $bf[1]); +$bits{aeach}{0} = $bf[0]; +@{$bits{aelem}}{5,4,1,0} = ($bf[8], $bf[8], $bf[1], $bf[1]); +@{$bits{aelemfast}}{7,6,5,4,3,2,1,0} = ($bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6]); +@{$bits{aelemfast_lex}}{7,6,5,4,3,2,1,0} = ($bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6], $bf[6]); +$bits{akeys}{0} = $bf[0]; +$bits{alarm}{0} = $bf[0]; +$bits{and}{0} = $bf[0]; +$bits{andassign}{0} = $bf[0]; +$bits{anonconst}{0} = $bf[0]; +@{$bits{anonhash}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{anonlist}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{argcheck}{0} = $bf[0]; +$bits{argdefelem}{0} = $bf[0]; +@{$bits{argelem}}{2,1,0} = ($bf[7], $bf[7], $bf[0]); +@{$bits{atan2}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{av2arylen}{0} = $bf[0]; +$bits{avalues}{0} = $bf[0]; +@{$bits{avhvswitch}}{1,0} = ($bf[2], $bf[2]); +$bits{backtick}{0} = $bf[0]; +@{$bits{bind}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{binmode}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{bit_and}}{1,0} = ($bf[1], $bf[1]); +@{$bits{bit_or}}{1,0} = ($bf[1], $bf[1]); +@{$bits{bit_xor}}{1,0} = ($bf[1], $bf[1]); +@{$bits{bless}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{caller}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{chdir}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{chmod}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{chomp}{0} = $bf[0]; +$bits{chop}{0} = $bf[0]; +@{$bits{chown}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{chr}{0} = $bf[0]; +$bits{chroot}{0} = $bf[0]; +@{$bits{close}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{closedir}{0} = $bf[0]; +$bits{cmpchain_and}{0} = $bf[0]; +$bits{cmpchain_dup}{0} = $bf[0]; +$bits{complement}{0} = $bf[0]; +@{$bits{concat}}{6,1,0} = ('OPpCONCAT_NESTED', $bf[1], $bf[1]); +$bits{cond_expr}{0} = $bf[0]; +@{$bits{connect}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{const}}{6,4,3,2,1} = ('OPpCONST_BARE', 'OPpCONST_ENTERED', 'OPpCONST_STRICT', 'OPpCONST_SHORTCIRCUIT', 'OPpCONST_NOVER'); +@{$bits{coreargs}}{7,6,1,0} = ('OPpCOREARGS_PUSHMARK', 'OPpCOREARGS_SCALARMOD', 'OPpCOREARGS_DEREF2', 'OPpCOREARGS_DEREF1'); +$bits{cos}{0} = $bf[0]; +@{$bits{crypt}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{dbmclose}{0} = $bf[0]; +@{$bits{dbmopen}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{defined}{0} = $bf[0]; +@{$bits{delete}}{6,5,0} = ('OPpSLICE', 'OPpKVSLICE', $bf[0]); +@{$bits{die}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{divide}}{1,0} = ($bf[1], $bf[1]); +$bits{dofile}{0} = $bf[0]; +$bits{dor}{0} = $bf[0]; +$bits{dorassign}{0} = $bf[0]; +$bits{dump}{0} = $bf[0]; +$bits{each}{0} = $bf[0]; +@{$bits{entereval}}{5,4,3,2,1,0} = ('OPpEVAL_RE_REPARSING', 'OPpEVAL_COPHH', 'OPpEVAL_BYTES', 'OPpEVAL_UNICODE', 'OPpEVAL_HAS_HH', $bf[0]); +$bits{entergiven}{0} = $bf[0]; +$bits{enteriter}{3} = 'OPpITER_DEF'; +@{$bits{entersub}}{5,4,0} = ($bf[8], $bf[8], 'OPpENTERSUB_INARGS'); +$bits{entertry}{0} = $bf[0]; +$bits{enterwhen}{0} = $bf[0]; +@{$bits{enterwrite}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{eof}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{eq}}{1,0} = ($bf[1], $bf[1]); +@{$bits{exec}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{exists}}{6,0} = ('OPpEXISTS_SUB', $bf[0]); +@{$bits{exit}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{exp}{0} = $bf[0]; +$bits{fc}{0} = $bf[0]; +@{$bits{fcntl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{fileno}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{flip}{0} = $bf[0]; +@{$bits{flock}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{flop}{0} = $bf[0]; +@{$bits{formline}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{ftatime}{0} = $bf[0]; +$bits{ftbinary}{0} = $bf[0]; +$bits{ftblk}{0} = $bf[0]; +$bits{ftchr}{0} = $bf[0]; +$bits{ftctime}{0} = $bf[0]; +$bits{ftdir}{0} = $bf[0]; +$bits{fteexec}{0} = $bf[0]; +$bits{fteowned}{0} = $bf[0]; +$bits{fteread}{0} = $bf[0]; +$bits{ftewrite}{0} = $bf[0]; +$bits{ftfile}{0} = $bf[0]; +$bits{ftis}{0} = $bf[0]; +$bits{ftlink}{0} = $bf[0]; +$bits{ftmtime}{0} = $bf[0]; +$bits{ftpipe}{0} = $bf[0]; +$bits{ftrexec}{0} = $bf[0]; +$bits{ftrowned}{0} = $bf[0]; +$bits{ftrread}{0} = $bf[0]; +$bits{ftrwrite}{0} = $bf[0]; +$bits{ftsgid}{0} = $bf[0]; +$bits{ftsize}{0} = $bf[0]; +$bits{ftsock}{0} = $bf[0]; +$bits{ftsuid}{0} = $bf[0]; +$bits{ftsvtx}{0} = $bf[0]; +$bits{fttext}{0} = $bf[0]; +$bits{fttty}{0} = $bf[0]; +$bits{ftzero}{0} = $bf[0]; +@{$bits{ge}}{1,0} = ($bf[1], $bf[1]); +@{$bits{gelem}}{1,0} = ($bf[1], $bf[1]); +@{$bits{getc}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{getpeername}{0} = $bf[0]; +@{$bits{getpgrp}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{getpriority}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{getsockname}{0} = $bf[0]; +$bits{ggrgid}{0} = $bf[0]; +$bits{ggrnam}{0} = $bf[0]; +@{$bits{ghbyaddr}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{ghbyname}{0} = $bf[0]; +@{$bits{glob}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{gmtime}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{gnbyaddr}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{gnbyname}{0} = $bf[0]; +$bits{goto}{0} = $bf[0]; +$bits{gpbyname}{0} = $bf[0]; +@{$bits{gpbynumber}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{gpwnam}{0} = $bf[0]; +$bits{gpwuid}{0} = $bf[0]; +$bits{grepstart}{0} = $bf[0]; +$bits{grepwhile}{0} = $bf[0]; +@{$bits{gsbyname}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{gsbyport}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{gsockopt}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{gt}}{1,0} = ($bf[1], $bf[1]); +$bits{gv}{5} = 'OPpEARLY_CV'; +@{$bits{helem}}{5,4,1,0} = ($bf[8], $bf[8], $bf[1], $bf[1]); +$bits{hex}{0} = $bf[0]; +@{$bits{i_add}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_divide}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_eq}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_ge}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_gt}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_le}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_lt}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_modulo}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_multiply}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_ncmp}}{1,0} = ($bf[1], $bf[1]); +@{$bits{i_ne}}{1,0} = ($bf[1], $bf[1]); +$bits{i_negate}{0} = $bf[0]; +$bits{i_postdec}{0} = $bf[0]; +$bits{i_postinc}{0} = $bf[0]; +$bits{i_predec}{0} = $bf[0]; +$bits{i_preinc}{0} = $bf[0]; +@{$bits{i_subtract}}{1,0} = ($bf[1], $bf[1]); +@{$bits{index}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{int}{0} = $bf[0]; +@{$bits{ioctl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{isa}}{1,0} = ($bf[1], $bf[1]); +@{$bits{join}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{keys}{0} = $bf[0]; +@{$bits{kill}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{last}{0} = $bf[0]; +$bits{lc}{0} = $bf[0]; +$bits{lcfirst}{0} = $bf[0]; +@{$bits{le}}{1,0} = ($bf[1], $bf[1]); +$bits{leaveeval}{0} = $bf[0]; +$bits{leavegiven}{0} = $bf[0]; +@{$bits{leaveloop}}{1,0} = ($bf[1], $bf[1]); +$bits{leavesub}{0} = $bf[0]; +$bits{leavesublv}{0} = $bf[0]; +$bits{leavewhen}{0} = $bf[0]; +$bits{leavewrite}{0} = $bf[0]; +@{$bits{left_shift}}{1,0} = ($bf[1], $bf[1]); +$bits{length}{0} = $bf[0]; +@{$bits{link}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{list}{6} = 'OPpLIST_GUESSED'; +@{$bits{listen}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{localtime}{0} = $bf[0]; +$bits{lock}{0} = $bf[0]; +$bits{log}{0} = $bf[0]; +@{$bits{lslice}}{1,0} = ($bf[1], $bf[1]); +$bits{lstat}{0} = $bf[0]; +@{$bits{lt}}{1,0} = ($bf[1], $bf[1]); +$bits{lvavref}{0} = $bf[0]; +@{$bits{lvref}}{5,4,0} = ($bf[9], $bf[9], $bf[0]); +$bits{mapstart}{0} = $bf[0]; +$bits{mapwhile}{0} = $bf[0]; +$bits{method}{0} = $bf[0]; +$bits{method_named}{0} = $bf[0]; +$bits{method_redir}{0} = $bf[0]; +$bits{method_redir_super}{0} = $bf[0]; +$bits{method_super}{0} = $bf[0]; +@{$bits{mkdir}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{modulo}}{1,0} = ($bf[1], $bf[1]); +@{$bits{msgctl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{msgget}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{msgrcv}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{msgsnd}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{multiconcat}}{6,5,3,0} = ('OPpMULTICONCAT_APPEND', 'OPpMULTICONCAT_FAKE', 'OPpMULTICONCAT_STRINGIFY', $bf[0]); +@{$bits{multideref}}{5,4,0} = ('OPpMULTIDEREF_DELETE', 'OPpMULTIDEREF_EXISTS', $bf[0]); +@{$bits{multiply}}{1,0} = ($bf[1], $bf[1]); +@{$bits{nbit_and}}{1,0} = ($bf[1], $bf[1]); +@{$bits{nbit_or}}{1,0} = ($bf[1], $bf[1]); +@{$bits{nbit_xor}}{1,0} = ($bf[1], $bf[1]); +@{$bits{ncmp}}{1,0} = ($bf[1], $bf[1]); +$bits{ncomplement}{0} = $bf[0]; +@{$bits{ne}}{1,0} = ($bf[1], $bf[1]); +$bits{negate}{0} = $bf[0]; +$bits{next}{0} = $bf[0]; +$bits{not}{0} = $bf[0]; +$bits{oct}{0} = $bf[0]; +$bits{once}{0} = $bf[0]; +@{$bits{open}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{open_dir}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{or}{0} = $bf[0]; +$bits{orassign}{0} = $bf[0]; +$bits{ord}{0} = $bf[0]; +@{$bits{pack}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{padhv}{0} = 'OPpPADHV_ISKEYS'; +@{$bits{padrange}}{6,5,4,3,2,1,0} = ($bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5], $bf[5]); +@{$bits{padsv}}{5,4} = ($bf[8], $bf[8]); +@{$bits{pipe_op}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{pop}{0} = $bf[0]; +$bits{pos}{0} = $bf[0]; +$bits{postdec}{0} = $bf[0]; +$bits{postinc}{0} = $bf[0]; +@{$bits{pow}}{1,0} = ($bf[1], $bf[1]); +$bits{predec}{0} = $bf[0]; +$bits{preinc}{0} = $bf[0]; +$bits{prototype}{0} = $bf[0]; +@{$bits{push}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{quotemeta}{0} = $bf[0]; +@{$bits{rand}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{range}{0} = $bf[0]; +@{$bits{read}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{readdir}{0} = $bf[0]; +$bits{readline}{0} = $bf[0]; +$bits{readlink}{0} = $bf[0]; +@{$bits{recv}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{redo}{0} = $bf[0]; +$bits{ref}{0} = $bf[0]; +@{$bits{refassign}}{5,4,1,0} = ($bf[9], $bf[9], $bf[1], $bf[1]); +$bits{refgen}{0} = $bf[0]; +$bits{regcmaybe}{0} = $bf[0]; +$bits{regcomp}{0} = $bf[0]; +$bits{regcreset}{0} = $bf[0]; +@{$bits{rename}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{repeat}}{6,1,0} = ('OPpREPEAT_DOLIST', $bf[1], $bf[1]); +$bits{require}{0} = $bf[0]; +@{$bits{reset}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{reverse}}{3,0} = ('OPpREVERSE_INPLACE', $bf[0]); +$bits{rewinddir}{0} = $bf[0]; +@{$bits{right_shift}}{1,0} = ($bf[1], $bf[1]); +@{$bits{rindex}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{rmdir}{0} = $bf[0]; +$bits{rv2av}{0} = $bf[0]; +@{$bits{rv2cv}}{7,5,0} = ('OPpENTERSUB_NOPAREN', 'OPpMAY_RETURN_CONSTANT', $bf[0]); +@{$bits{rv2gv}}{6,5,4,2,0} = ('OPpALLOW_FAKE', $bf[8], $bf[8], 'OPpDONT_INIT_GV', $bf[0]); +$bits{rv2hv}{0} = 'OPpRV2HV_ISKEYS'; +@{$bits{rv2sv}}{5,4,0} = ($bf[8], $bf[8], $bf[0]); +@{$bits{sassign}}{7,6,1,0} = ('OPpASSIGN_CV_TO_GV', 'OPpASSIGN_BACKWARDS', $bf[1], $bf[1]); +@{$bits{sbit_and}}{1,0} = ($bf[1], $bf[1]); +@{$bits{sbit_or}}{1,0} = ($bf[1], $bf[1]); +@{$bits{sbit_xor}}{1,0} = ($bf[1], $bf[1]); +$bits{scalar}{0} = $bf[0]; +$bits{schomp}{0} = $bf[0]; +$bits{schop}{0} = $bf[0]; +@{$bits{scmp}}{1,0} = ($bf[1], $bf[1]); +$bits{scomplement}{0} = $bf[0]; +@{$bits{seek}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{seekdir}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{select}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{semctl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{semget}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{semop}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{send}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{seq}}{1,0} = ($bf[1], $bf[1]); +@{$bits{setpgrp}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{setpriority}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sge}}{1,0} = ($bf[1], $bf[1]); +@{$bits{sgt}}{1,0} = ($bf[1], $bf[1]); +$bits{shift}{0} = $bf[0]; +@{$bits{shmctl}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{shmget}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{shmread}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{shmwrite}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{shostent}{0} = $bf[0]; +@{$bits{shutdown}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{sin}{0} = $bf[0]; +@{$bits{sle}}{1,0} = ($bf[1], $bf[1]); +@{$bits{sleep}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{slt}}{1,0} = ($bf[1], $bf[1]); +@{$bits{smartmatch}}{1,0} = ($bf[1], $bf[1]); +@{$bits{sne}}{1,0} = ($bf[1], $bf[1]); +$bits{snetent}{0} = $bf[0]; +@{$bits{socket}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sockpair}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sort}}{7,6,4,3,2,1,0} = ('OPpSORT_UNSTABLE', 'OPpSORT_STABLE', 'OPpSORT_DESCEND', 'OPpSORT_INPLACE', 'OPpSORT_REVERSE', 'OPpSORT_INTEGER', 'OPpSORT_NUMERIC'); +@{$bits{splice}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{split}}{4,3,2} = ('OPpSPLIT_ASSIGN', 'OPpSPLIT_LEX', 'OPpSPLIT_IMPLIM'); +@{$bits{sprintf}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{sprotoent}{0} = $bf[0]; +$bits{sqrt}{0} = $bf[0]; +@{$bits{srand}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{srefgen}{0} = $bf[0]; +@{$bits{sselect}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{sservent}{0} = $bf[0]; +@{$bits{ssockopt}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{stat}{0} = $bf[0]; +@{$bits{stringify}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{study}{0} = $bf[0]; +$bits{substcont}{0} = $bf[0]; +@{$bits{substr}}{4,2,1,0} = ('OPpSUBSTR_REPL_FIRST', $bf[3], $bf[3], $bf[3]); +@{$bits{subtract}}{1,0} = ($bf[1], $bf[1]); +@{$bits{symlink}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{syscall}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sysopen}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sysread}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{sysseek}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{system}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{syswrite}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{tell}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{telldir}{0} = $bf[0]; +@{$bits{tie}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{tied}{0} = $bf[0]; +@{$bits{truncate}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{uc}{0} = $bf[0]; +$bits{ucfirst}{0} = $bf[0]; +@{$bits{umask}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{undef}{0} = $bf[0]; +@{$bits{unlink}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{unpack}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{unshift}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{untie}{0} = $bf[0]; +@{$bits{utime}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +$bits{values}{0} = $bf[0]; +@{$bits{vec}}{1,0} = ($bf[1], $bf[1]); +@{$bits{waitpid}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{warn}}{3,2,1,0} = ($bf[4], $bf[4], $bf[4], $bf[4]); +@{$bits{xor}}{1,0} = ($bf[1], $bf[1]); + + +our %defines = ( + OPpALLOW_FAKE => 64, + OPpARG1_MASK => 1, + OPpARG2_MASK => 3, + OPpARG3_MASK => 7, + OPpARG4_MASK => 15, + OPpARGELEM_AV => 2, + OPpARGELEM_HV => 4, + OPpARGELEM_MASK => 6, + OPpARGELEM_SV => 0, + OPpASSIGN_BACKWARDS => 64, + OPpASSIGN_COMMON_AGG => 16, + OPpASSIGN_COMMON_RC1 => 32, + OPpASSIGN_COMMON_SCALAR => 64, + OPpASSIGN_CV_TO_GV => 128, + OPpASSIGN_TRUEBOOL => 4, + OPpAVHVSWITCH_MASK => 3, + OPpCONCAT_NESTED => 64, + OPpCONST_BARE => 64, + OPpCONST_ENTERED => 16, + OPpCONST_NOVER => 2, + OPpCONST_SHORTCIRCUIT => 4, + OPpCONST_STRICT => 8, + OPpCOREARGS_DEREF1 => 1, + OPpCOREARGS_DEREF2 => 2, + OPpCOREARGS_PUSHMARK => 128, + OPpCOREARGS_SCALARMOD => 64, + OPpDEREF => 48, + OPpDEREF_AV => 16, + OPpDEREF_HV => 32, + OPpDEREF_SV => 48, + OPpDONT_INIT_GV => 4, + OPpEARLY_CV => 32, + OPpENTERSUB_AMPER => 8, + OPpENTERSUB_DB => 64, + OPpENTERSUB_HASTARG => 4, + OPpENTERSUB_INARGS => 1, + OPpENTERSUB_NOPAREN => 128, + OPpEVAL_BYTES => 8, + OPpEVAL_COPHH => 16, + OPpEVAL_HAS_HH => 2, + OPpEVAL_RE_REPARSING => 32, + OPpEVAL_UNICODE => 4, + OPpEXISTS_SUB => 64, + OPpFLIP_LINENUM => 64, + OPpFT_ACCESS => 2, + OPpFT_AFTER_t => 16, + OPpFT_STACKED => 4, + OPpFT_STACKING => 8, + OPpHINT_STRICT_REFS => 2, + OPpHUSH_VMSISH => 32, + OPpINDEX_BOOLNEG => 64, + OPpITER_DEF => 8, + OPpITER_REVERSED => 2, + OPpKVSLICE => 32, + OPpLIST_GUESSED => 64, + OPpLVALUE => 128, + OPpLVAL_DEFER => 64, + OPpLVAL_INTRO => 128, + OPpLVREF_AV => 16, + OPpLVREF_CV => 48, + OPpLVREF_ELEM => 4, + OPpLVREF_HV => 32, + OPpLVREF_ITER => 8, + OPpLVREF_SV => 0, + OPpLVREF_TYPE => 48, + OPpMAYBE_LVSUB => 8, + OPpMAYBE_TRUEBOOL => 16, + OPpMAY_RETURN_CONSTANT => 32, + OPpMULTICONCAT_APPEND => 64, + OPpMULTICONCAT_FAKE => 32, + OPpMULTICONCAT_STRINGIFY => 8, + OPpMULTIDEREF_DELETE => 32, + OPpMULTIDEREF_EXISTS => 16, + OPpOFFBYONE => 128, + OPpOPEN_IN_CRLF => 32, + OPpOPEN_IN_RAW => 16, + OPpOPEN_OUT_CRLF => 128, + OPpOPEN_OUT_RAW => 64, + OPpOUR_INTRO => 64, + OPpPADHV_ISKEYS => 1, + OPpPADRANGE_COUNTMASK => 127, + OPpPADRANGE_COUNTSHIFT => 7, + OPpPAD_STATE => 64, + OPpPV_IS_UTF8 => 128, + OPpREFCOUNTED => 64, + OPpREPEAT_DOLIST => 64, + OPpREVERSE_INPLACE => 8, + OPpRV2HV_ISKEYS => 1, + OPpSLICE => 64, + OPpSLICEWARNING => 4, + OPpSORT_DESCEND => 16, + OPpSORT_INPLACE => 8, + OPpSORT_INTEGER => 2, + OPpSORT_NUMERIC => 1, + OPpSORT_REVERSE => 4, + OPpSORT_STABLE => 64, + OPpSORT_UNSTABLE => 128, + OPpSPLIT_ASSIGN => 16, + OPpSPLIT_IMPLIM => 4, + OPpSPLIT_LEX => 8, + OPpSUBSTR_REPL_FIRST => 16, + OPpTARGET_MY => 16, + OPpTRANS_CAN_FORCE_UTF8 => 1, + OPpTRANS_COMPLEMENT => 32, + OPpTRANS_DELETE => 128, + OPpTRANS_GROWS => 64, + OPpTRANS_IDENTICAL => 4, + OPpTRANS_SQUASH => 8, + OPpTRANS_USE_SVOP => 2, + OPpTRUEBOOL => 32, +); + +our %labels = ( + OPpALLOW_FAKE => 'FAKE', + OPpARGELEM_AV => 'AV', + OPpARGELEM_HV => 'HV', + OPpARGELEM_SV => 'SV', + OPpASSIGN_BACKWARDS => 'BKWARD', + OPpASSIGN_COMMON_AGG => 'COM_AGG', + OPpASSIGN_COMMON_RC1 => 'COM_RC1', + OPpASSIGN_COMMON_SCALAR => 'COM_SCALAR', + OPpASSIGN_CV_TO_GV => 'CV2GV', + OPpASSIGN_TRUEBOOL => 'BOOL', + OPpCONCAT_NESTED => 'NESTED', + OPpCONST_BARE => 'BARE', + OPpCONST_ENTERED => 'ENTERED', + OPpCONST_NOVER => 'NOVER', + OPpCONST_SHORTCIRCUIT => 'SHORT', + OPpCONST_STRICT => 'STRICT', + OPpCOREARGS_DEREF1 => 'DEREF1', + OPpCOREARGS_DEREF2 => 'DEREF2', + OPpCOREARGS_PUSHMARK => 'MARK', + OPpCOREARGS_SCALARMOD => '$MOD', + OPpDEREF_AV => 'DREFAV', + OPpDEREF_HV => 'DREFHV', + OPpDEREF_SV => 'DREFSV', + OPpDONT_INIT_GV => 'NOINIT', + OPpEARLY_CV => 'EARLYCV', + OPpENTERSUB_AMPER => 'AMPER', + OPpENTERSUB_DB => 'DBG', + OPpENTERSUB_HASTARG => 'TARG', + OPpENTERSUB_INARGS => 'INARGS', + OPpENTERSUB_NOPAREN => 'NO()', + OPpEVAL_BYTES => 'BYTES', + OPpEVAL_COPHH => 'COPHH', + OPpEVAL_HAS_HH => 'HAS_HH', + OPpEVAL_RE_REPARSING => 'REPARSE', + OPpEVAL_UNICODE => 'UNI', + OPpEXISTS_SUB => 'SUB', + OPpFLIP_LINENUM => 'LINENUM', + OPpFT_ACCESS => 'FTACCESS', + OPpFT_AFTER_t => 'FTAFTERt', + OPpFT_STACKED => 'FTSTACKED', + OPpFT_STACKING => 'FTSTACKING', + OPpHINT_STRICT_REFS => 'STRICT', + OPpHUSH_VMSISH => 'HUSH', + OPpINDEX_BOOLNEG => 'NEG', + OPpITER_DEF => 'DEF', + OPpITER_REVERSED => 'REVERSED', + OPpKVSLICE => 'KVSLICE', + OPpLIST_GUESSED => 'GUESSED', + OPpLVALUE => 'LV', + OPpLVAL_DEFER => 'LVDEFER', + OPpLVAL_INTRO => 'LVINTRO', + OPpLVREF_AV => 'AV', + OPpLVREF_CV => 'CV', + OPpLVREF_ELEM => 'ELEM', + OPpLVREF_HV => 'HV', + OPpLVREF_ITER => 'ITER', + OPpLVREF_SV => 'SV', + OPpMAYBE_LVSUB => 'LVSUB', + OPpMAYBE_TRUEBOOL => 'BOOL?', + OPpMAY_RETURN_CONSTANT => 'CONST', + OPpMULTICONCAT_APPEND => 'APPEND', + OPpMULTICONCAT_FAKE => 'FAKE', + OPpMULTICONCAT_STRINGIFY => 'STRINGIFY', + OPpMULTIDEREF_DELETE => 'DELETE', + OPpMULTIDEREF_EXISTS => 'EXISTS', + OPpOFFBYONE => '+1', + OPpOPEN_IN_CRLF => 'INCR', + OPpOPEN_IN_RAW => 'INBIN', + OPpOPEN_OUT_CRLF => 'OUTCR', + OPpOPEN_OUT_RAW => 'OUTBIN', + OPpOUR_INTRO => 'OURINTR', + OPpPADHV_ISKEYS => 'KEYS', + OPpPAD_STATE => 'STATE', + OPpPV_IS_UTF8 => 'UTF', + OPpREFCOUNTED => 'REFC', + OPpREPEAT_DOLIST => 'DOLIST', + OPpREVERSE_INPLACE => 'INPLACE', + OPpRV2HV_ISKEYS => 'KEYS', + OPpSLICE => 'SLICE', + OPpSLICEWARNING => 'SLICEWARN', + OPpSORT_DESCEND => 'DESC', + OPpSORT_INPLACE => 'INPLACE', + OPpSORT_INTEGER => 'INT', + OPpSORT_NUMERIC => 'NUM', + OPpSORT_REVERSE => 'REV', + OPpSORT_STABLE => 'STABLE', + OPpSORT_UNSTABLE => 'UNSTABLE', + OPpSPLIT_ASSIGN => 'ASSIGN', + OPpSPLIT_IMPLIM => 'IMPLIM', + OPpSPLIT_LEX => 'LEX', + OPpSUBSTR_REPL_FIRST => 'REPL1ST', + OPpTARGET_MY => 'TARGMY', + OPpTRANS_CAN_FORCE_UTF8 => 'CAN_FORCE_UTF8', + OPpTRANS_COMPLEMENT => 'COMPL', + OPpTRANS_DELETE => 'DEL', + OPpTRANS_GROWS => 'GROWS', + OPpTRANS_IDENTICAL => 'IDENT', + OPpTRANS_SQUASH => 'SQUASH', + OPpTRANS_USE_SVOP => 'USE_SVOP', + OPpTRUEBOOL => 'BOOL', +); + + +our %ops_using = ( + OPpALLOW_FAKE => [qw(rv2gv)], + OPpASSIGN_BACKWARDS => [qw(sassign)], + OPpASSIGN_COMMON_AGG => [qw(aassign)], + OPpCONCAT_NESTED => [qw(concat)], + OPpCONST_BARE => [qw(const)], + OPpCOREARGS_DEREF1 => [qw(coreargs)], + OPpEARLY_CV => [qw(gv)], + OPpENTERSUB_AMPER => [qw(entersub rv2cv)], + OPpENTERSUB_INARGS => [qw(entersub)], + OPpENTERSUB_NOPAREN => [qw(rv2cv)], + OPpEVAL_BYTES => [qw(entereval)], + OPpEXISTS_SUB => [qw(exists)], + OPpFLIP_LINENUM => [qw(flip flop)], + OPpFT_ACCESS => [qw(fteexec fteread ftewrite ftrexec ftrread ftrwrite)], + OPpFT_AFTER_t => [qw(ftatime ftbinary ftblk ftchr ftctime ftdir fteexec fteowned fteread ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftrwrite ftsgid ftsize ftsock ftsuid ftsvtx fttext fttty ftzero)], + OPpHINT_STRICT_REFS => [qw(entersub multideref rv2av rv2cv rv2gv rv2hv rv2sv)], + OPpHUSH_VMSISH => [qw(dbstate nextstate)], + OPpINDEX_BOOLNEG => [qw(index rindex)], + OPpITER_DEF => [qw(enteriter)], + OPpITER_REVERSED => [qw(enteriter iter)], + OPpKVSLICE => [qw(delete)], + OPpLIST_GUESSED => [qw(list)], + OPpLVALUE => [qw(leave leaveloop)], + OPpLVAL_DEFER => [qw(aelem helem multideref)], + OPpLVAL_INTRO => [qw(aelem aslice cond_expr delete enteriter entersub gvsv helem hslice list lvavref lvref lvrefslice multiconcat multideref padav padhv padrange padsv pushmark refassign rv2av rv2gv rv2hv rv2sv split)], + OPpLVREF_ELEM => [qw(lvref refassign)], + OPpMAYBE_LVSUB => [qw(aassign aelem akeys aslice av2arylen avhvswitch helem hslice keys kvaslice kvhslice multideref padav padhv pos rv2av rv2gv rv2hv substr values vec)], + OPpMAYBE_TRUEBOOL => [qw(padhv ref rv2hv)], + OPpMULTICONCAT_APPEND => [qw(multiconcat)], + OPpMULTIDEREF_DELETE => [qw(multideref)], + OPpOFFBYONE => [qw(caller runcv wantarray)], + OPpOPEN_IN_CRLF => [qw(backtick open)], + OPpOUR_INTRO => [qw(enteriter gvsv rv2av rv2hv rv2sv split)], + OPpPADHV_ISKEYS => [qw(padhv)], + OPpPAD_STATE => [qw(lvavref lvref padav padhv padsv pushmark refassign)], + OPpPV_IS_UTF8 => [qw(dump goto last next redo)], + OPpREFCOUNTED => [qw(leave leaveeval leavesub leavesublv leavewrite)], + OPpREPEAT_DOLIST => [qw(repeat)], + OPpREVERSE_INPLACE => [qw(reverse)], + OPpRV2HV_ISKEYS => [qw(rv2hv)], + OPpSLICEWARNING => [qw(aslice hslice padav padhv rv2av rv2hv)], + OPpSORT_DESCEND => [qw(sort)], + OPpSPLIT_ASSIGN => [qw(split)], + OPpSUBSTR_REPL_FIRST => [qw(substr)], + OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_subtract index int kill left_shift length link log mkdir modulo multiconcat multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push rand rename right_shift rindex rmdir schomp scomplement setpgrp setpriority sin sleep sqrt srand stringify subtract symlink system time unlink unshift utime wait waitpid)], + OPpTRANS_CAN_FORCE_UTF8 => [qw(trans transr)], + OPpTRUEBOOL => [qw(grepwhile index length padav padhv pos ref rindex rv2av rv2hv subst)], +); + +$ops_using{OPpASSIGN_COMMON_RC1} = $ops_using{OPpASSIGN_COMMON_AGG}; +$ops_using{OPpASSIGN_COMMON_SCALAR} = $ops_using{OPpASSIGN_COMMON_AGG}; +$ops_using{OPpASSIGN_CV_TO_GV} = $ops_using{OPpASSIGN_BACKWARDS}; +$ops_using{OPpASSIGN_TRUEBOOL} = $ops_using{OPpASSIGN_COMMON_AGG}; +$ops_using{OPpCONST_ENTERED} = $ops_using{OPpCONST_BARE}; +$ops_using{OPpCONST_NOVER} = $ops_using{OPpCONST_BARE}; +$ops_using{OPpCONST_SHORTCIRCUIT} = $ops_using{OPpCONST_BARE}; +$ops_using{OPpCONST_STRICT} = $ops_using{OPpCONST_BARE}; +$ops_using{OPpCOREARGS_DEREF2} = $ops_using{OPpCOREARGS_DEREF1}; +$ops_using{OPpCOREARGS_PUSHMARK} = $ops_using{OPpCOREARGS_DEREF1}; +$ops_using{OPpCOREARGS_SCALARMOD} = $ops_using{OPpCOREARGS_DEREF1}; +$ops_using{OPpDONT_INIT_GV} = $ops_using{OPpALLOW_FAKE}; +$ops_using{OPpENTERSUB_DB} = $ops_using{OPpENTERSUB_AMPER}; +$ops_using{OPpENTERSUB_HASTARG} = $ops_using{OPpENTERSUB_AMPER}; +$ops_using{OPpEVAL_COPHH} = $ops_using{OPpEVAL_BYTES}; +$ops_using{OPpEVAL_HAS_HH} = $ops_using{OPpEVAL_BYTES}; +$ops_using{OPpEVAL_RE_REPARSING} = $ops_using{OPpEVAL_BYTES}; +$ops_using{OPpEVAL_UNICODE} = $ops_using{OPpEVAL_BYTES}; +$ops_using{OPpFT_STACKED} = $ops_using{OPpFT_AFTER_t}; +$ops_using{OPpFT_STACKING} = $ops_using{OPpFT_AFTER_t}; +$ops_using{OPpLVREF_ITER} = $ops_using{OPpLVREF_ELEM}; +$ops_using{OPpMAY_RETURN_CONSTANT} = $ops_using{OPpENTERSUB_NOPAREN}; +$ops_using{OPpMULTICONCAT_FAKE} = $ops_using{OPpMULTICONCAT_APPEND}; +$ops_using{OPpMULTICONCAT_STRINGIFY} = $ops_using{OPpMULTICONCAT_APPEND}; +$ops_using{OPpMULTIDEREF_EXISTS} = $ops_using{OPpMULTIDEREF_DELETE}; +$ops_using{OPpOPEN_IN_RAW} = $ops_using{OPpOPEN_IN_CRLF}; +$ops_using{OPpOPEN_OUT_CRLF} = $ops_using{OPpOPEN_IN_CRLF}; +$ops_using{OPpOPEN_OUT_RAW} = $ops_using{OPpOPEN_IN_CRLF}; +$ops_using{OPpSLICE} = $ops_using{OPpKVSLICE}; +$ops_using{OPpSORT_INPLACE} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSORT_INTEGER} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSORT_NUMERIC} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSORT_REVERSE} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSORT_STABLE} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSORT_UNSTABLE} = $ops_using{OPpSORT_DESCEND}; +$ops_using{OPpSPLIT_IMPLIM} = $ops_using{OPpSPLIT_ASSIGN}; +$ops_using{OPpSPLIT_LEX} = $ops_using{OPpSPLIT_ASSIGN}; +$ops_using{OPpTRANS_COMPLEMENT} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; +$ops_using{OPpTRANS_DELETE} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; +$ops_using{OPpTRANS_GROWS} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; +$ops_using{OPpTRANS_IDENTICAL} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; +$ops_using{OPpTRANS_SQUASH} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; +$ops_using{OPpTRANS_USE_SVOP} = $ops_using{OPpTRANS_CAN_FORCE_UTF8}; + +# ex: set ro: diff --git a/data/miniconda3/lib/perl5/core_perl/Benchmark.pm b/data/miniconda3/lib/perl5/core_perl/Benchmark.pm new file mode 100644 index 0000000000000000000000000000000000000000..3eeba798730e3d4c965883312853bab615b4b95f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Benchmark.pm @@ -0,0 +1,1123 @@ +package Benchmark; + +use strict; + + +=head1 NAME + +Benchmark - benchmark running times of Perl code + +=head1 SYNOPSIS + + use Benchmark qw(:all) ; + + timethis ($count, "code"); + + # Use Perl code in strings... + timethese($count, { + 'Name1' => '...code1...', + 'Name2' => '...code2...', + }); + + # ... or use subroutine references. + timethese($count, { + 'Name1' => sub { ...code1... }, + 'Name2' => sub { ...code2... }, + }); + + # cmpthese can be used both ways as well + cmpthese($count, { + 'Name1' => '...code1...', + 'Name2' => '...code2...', + }); + + cmpthese($count, { + 'Name1' => sub { ...code1... }, + 'Name2' => sub { ...code2... }, + }); + + # ...or in two stages + $results = timethese($count, + { + 'Name1' => sub { ...code1... }, + 'Name2' => sub { ...code2... }, + }, + 'none' + ); + cmpthese( $results ) ; + + $t = timeit($count, '...other code...') + print "$count loops of other code took:",timestr($t),"\n"; + + $t = countit($time, '...other code...') + $count = $t->iters ; + print "$count loops of other code took:",timestr($t),"\n"; + + # enable hires wallclock timing if possible + use Benchmark ':hireswallclock'; + +=head1 DESCRIPTION + +The Benchmark module encapsulates a number of routines to help you +figure out how long it takes to execute some code. + +timethis - run a chunk of code several times + +timethese - run several chunks of code several times + +cmpthese - print results of timethese as a comparison chart + +timeit - run a chunk of code and see how long it goes + +countit - see how many times a chunk of code runs in a given time + + +=head2 Methods + +=over 10 + +=item new + +Returns the current time. Example: + + use Benchmark; + $t0 = Benchmark->new; + # ... your code here ... + $t1 = Benchmark->new; + $td = timediff($t1, $t0); + print "the code took:",timestr($td),"\n"; + +=item debug + +Enables or disable debugging by setting the C<$Benchmark::Debug> flag: + + Benchmark->debug(1); + $t = timeit(10, ' 5 ** $Global '); + Benchmark->debug(0); + +=item iters + +Returns the number of iterations. + +=back + +=head2 Standard Exports + +The following routines will be exported into your namespace +if you use the Benchmark module: + +=over 10 + +=item timeit(COUNT, CODE) + +Arguments: COUNT is the number of times to run the loop, and CODE is +the code to run. CODE may be either a code reference or a string to +be eval'd; either way it will be run in the caller's package. + +Returns: a Benchmark object. + +=item timethis ( COUNT, CODE, [ TITLE, [ STYLE ]] ) + +Time COUNT iterations of CODE. CODE may be a string to eval or a +code reference; either way the CODE will run in the caller's package. +Results will be printed to STDOUT as TITLE followed by the times. +TITLE defaults to "timethis COUNT" if none is provided. STYLE +determines the format of the output, as described for timestr() below. + +The COUNT can be zero or negative: this means the I to run. A zero signifies the default of 3 seconds. For +example to run at least for 10 seconds: + + timethis(-10, $code) + +or to run two pieces of code tests for at least 3 seconds: + + timethese(0, { test1 => '...', test2 => '...'}) + +CPU seconds is, in UNIX terms, the user time plus the system time of +the process itself, as opposed to the real (wallclock) time and the +time spent by the child processes. Less than 0.1 seconds is not +accepted (-0.01 as the count, for example, will cause a fatal runtime +exception). + +Note that the CPU seconds is the B time: CPU scheduling and +other operating system factors may complicate the attempt so that a +little bit more time is spent. The benchmark output will, however, +also tell the number of C<$code> runs/second, which should be a more +interesting number than the actually spent seconds. + +Returns a Benchmark object. + +=item timethese ( COUNT, CODEHASHREF, [ STYLE ] ) + +The CODEHASHREF is a reference to a hash containing names as keys +and either a string to eval or a code reference for each value. +For each (KEY, VALUE) pair in the CODEHASHREF, this routine will +call + + timethis(COUNT, VALUE, KEY, STYLE) + +The routines are called in string comparison order of KEY. + +The COUNT can be zero or negative, see timethis(). + +Returns a hash reference of Benchmark objects, keyed by name. + +=item timediff ( T1, T2 ) + +Returns the difference between two Benchmark times as a Benchmark +object suitable for passing to timestr(). + +=item timestr ( TIMEDIFF, [ STYLE, [ FORMAT ] ] ) + +Returns a string that formats the times in the TIMEDIFF object in +the requested STYLE. TIMEDIFF is expected to be a Benchmark object +similar to that returned by timediff(). + +STYLE can be any of 'all', 'none', 'noc', 'nop' or 'auto'. 'all' shows +each of the 5 times available ('wallclock' time, user time, system time, +user time of children, and system time of children). 'noc' shows all +except the two children times. 'nop' shows only wallclock and the +two children times. 'auto' (the default) will act as 'all' unless +the children times are both zero, in which case it acts as 'noc'. +'none' prevents output. + +FORMAT is the L-style format specifier (without the +leading '%') to use to print the times. It defaults to '5.2f'. + +=back + +=head2 Optional Exports + +The following routines will be exported into your namespace +if you specifically ask that they be imported: + +=over 10 + +=item clearcache ( COUNT ) + +Clear the cached time for COUNT rounds of the null loop. + +=item clearallcache ( ) + +Clear all cached times. + +=item cmpthese ( COUNT, CODEHASHREF, [ STYLE ] ) + +=item cmpthese ( RESULTSHASHREF, [ STYLE ] ) + +Optionally calls timethese(), then outputs comparison chart. This: + + cmpthese( -1, { a => "++\$i", b => "\$i *= 2" } ) ; + +outputs a chart like: + + Rate b a + b 2831802/s -- -61% + a 7208959/s 155% -- + +This chart is sorted from slowest to fastest, and shows the percent speed +difference between each pair of tests. + +C can also be passed the data structure that timethese() returns: + + $results = timethese( -1, + { a => "++\$i", b => "\$i *= 2" } ) ; + cmpthese( $results ); + +in case you want to see both sets of results. +If the first argument is an unblessed hash reference, +that is RESULTSHASHREF; otherwise that is COUNT. + +Returns a reference to an ARRAY of rows, each row is an ARRAY of cells from the +above chart, including labels. This: + + my $rows = cmpthese( -1, + { a => '++$i', b => '$i *= 2' }, "none" ); + +returns a data structure like: + + [ + [ '', 'Rate', 'b', 'a' ], + [ 'b', '2885232/s', '--', '-59%' ], + [ 'a', '7099126/s', '146%', '--' ], + ] + +B: This result value differs from previous versions, which returned +the C result structure. If you want that, just use the two +statement C...C idiom shown above. + +Incidentally, note the variance in the result values between the two examples; +this is typical of benchmarking. If this were a real benchmark, you would +probably want to run a lot more iterations. + +=item countit(TIME, CODE) + +Arguments: TIME is the minimum length of time to run CODE for, and CODE is +the code to run. CODE may be either a code reference or a string to +be eval'd; either way it will be run in the caller's package. + +TIME is I negative. countit() will run the loop many times to +calculate the speed of CODE before running it for TIME. The actual +time run for will usually be greater than TIME due to system clock +resolution, so it's best to look at the number of iterations divided +by the times that you are concerned with, not just the iterations. + +Returns: a Benchmark object. + +=item disablecache ( ) + +Disable caching of timings for the null loop. This will force Benchmark +to recalculate these timings for each new piece of code timed. + +=item enablecache ( ) + +Enable caching of timings for the null loop. The time taken for COUNT +rounds of the null loop will be calculated only once for each +different COUNT used. + +=item timesum ( T1, T2 ) + +Returns the sum of two Benchmark times as a Benchmark object suitable +for passing to timestr(). + +=back + +=head2 :hireswallclock + +If the Time::HiRes module has been installed, you can specify the +special tag C<:hireswallclock> for Benchmark (if Time::HiRes is not +available, the tag will be silently ignored). This tag will cause the +wallclock time to be measured in microseconds, instead of integer +seconds. Note though that the speed computations are still conducted +in CPU time, not wallclock time. + +=head1 Benchmark Object + +Many of the functions in this module return a Benchmark object, +or in the case of C, a reference to a hash, the values of +which are Benchmark objects. This is useful if you want to store or +further process results from Benchmark functions. + +Internally the Benchmark object holds timing values, +described in L below. +The following methods can be used to access them: + +=over 4 + +=item cpu_p + +Total CPU (User + System) of the main (parent) process. + +=item cpu_c + +Total CPU (User + System) of any children processes. + +=item cpu_a + +Total CPU of parent and any children processes. + +=item real + +Real elapsed time "wallclock seconds". + +=item iters + +Number of iterations run. + +=back + +The following illustrates use of the Benchmark object: + + $result = timethis(100000, sub { ... }); + print "total CPU = ", $result->cpu_a, "\n"; + +=head1 NOTES + +The data is stored as a list of values from the time and times +functions: + + ($real, $user, $system, $children_user, $children_system, $iters) + +in seconds for the whole loop (not divided by the number of rounds). + +The timing is done using time(3) and times(3). + +Code is executed in the caller's package. + +The time of the null loop (a loop with the same +number of rounds but empty loop body) is subtracted +from the time of the real loop. + +The null loop times can be cached, the key being the +number of rounds. The caching can be controlled using +calls like these: + + clearcache($key); + clearallcache(); + + disablecache(); + enablecache(); + +Caching is off by default, as it can (usually slightly) decrease +accuracy and does not usually noticeably affect runtimes. + +=head1 EXAMPLES + +For example, + + use Benchmark qw( cmpthese ) ; + $x = 3; + cmpthese( -5, { + a => sub{$x*$x}, + b => sub{$x**2}, + } ); + +outputs something like this: + + Benchmark: running a, b, each for at least 5 CPU seconds... + Rate b a + b 1559428/s -- -62% + a 4152037/s 166% -- + + +while + + use Benchmark qw( timethese cmpthese ) ; + $x = 3; + $r = timethese( -5, { + a => sub{$x*$x}, + b => sub{$x**2}, + } ); + cmpthese $r; + +outputs something like this: + + Benchmark: running a, b, each for at least 5 CPU seconds... + a: 10 wallclock secs ( 5.14 usr + 0.13 sys = 5.27 CPU) @ 3835055.60/s (n=20210743) + b: 5 wallclock secs ( 5.41 usr + 0.00 sys = 5.41 CPU) @ 1574944.92/s (n=8520452) + Rate b a + b 1574945/s -- -59% + a 3835056/s 144% -- + + +=head1 INHERITANCE + +Benchmark inherits from no other class, except of course +from Exporter. + +=head1 CAVEATS + +Comparing eval'd strings with code references will give you +inaccurate results: a code reference will show a slightly slower +execution time than the equivalent eval'd string. + +The real time timing is done using time(2) and +the granularity is therefore only one second. + +Short tests may produce negative figures because perl +can appear to take longer to execute the empty loop +than a short test; try: + + timethis(100,'1'); + +The system time of the null loop might be slightly +more than the system time of the loop with the actual +code and therefore the difference might end up being E 0. + +=head1 SEE ALSO + +L - a Perl code profiler + +=head1 AUTHORS + +Jarkko Hietaniemi >, Tim Bunce > + +=head1 MODIFICATION HISTORY + +September 8th, 1994; by Tim Bunce. + +March 28th, 1997; by Hugo van der Sanden: added support for code +references and the already documented 'debug' method; revamped +documentation. + +April 04-07th, 1997: by Jarkko Hietaniemi, added the run-for-some-time +functionality. + +September, 1999; by Barrie Slaymaker: math fixes and accuracy and +efficiency tweaks. Added cmpthese(). A result is now returned from +timethese(). Exposed countit() (was runfor()). + +December, 2001; by Nicholas Clark: make timestr() recognise the style 'none' +and return an empty string. If cmpthese is calling timethese, make it pass the +style in. (so that 'none' will suppress output). Make sub new dump its +debugging output to STDERR, to be consistent with everything else. +All bugs found while writing a regression test. + +September, 2002; by Jarkko Hietaniemi: add ':hireswallclock' special tag. + +February, 2004; by Chia-liang Kao: make cmpthese and timestr use time +statistics for children instead of parent when the style is 'nop'. + +November, 2007; by Christophe Grosjean: make cmpthese and timestr compute +time consistently with style argument, default is 'all' not 'noc' any more. + +=cut + +# evaluate something in a clean lexical environment +sub _doeval { no strict; eval shift } + +# +# put any lexicals at file scope AFTER here +# + +use Carp; +use Exporter; + +our(@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION); + +@ISA=qw(Exporter); +@EXPORT=qw(timeit timethis timethese timediff timestr); +@EXPORT_OK=qw(timesum cmpthese countit + clearcache clearallcache disablecache enablecache); +%EXPORT_TAGS=( all => [ @EXPORT, @EXPORT_OK ] ) ; + +$VERSION = 1.23; + +# --- ':hireswallclock' special handling + +my $hirestime; + +sub mytime () { time } + +init(); + +sub BEGIN { + if (eval 'require Time::HiRes') { + import Time::HiRes qw(time); + $hirestime = \&Time::HiRes::time; + } +} + +sub import { + my $class = shift; + if (grep { $_ eq ":hireswallclock" } @_) { + @_ = grep { $_ ne ":hireswallclock" } @_; + local $^W=0; + *mytime = $hirestime if defined $hirestime; + } + Benchmark->export_to_level(1, $class, @_); +} + +our($Debug, $Min_Count, $Min_CPU, $Default_Format, $Default_Style, + %_Usage, %Cache, $Do_Cache); + +sub init { + $Debug = 0; + $Min_Count = 4; + $Min_CPU = 0.4; + $Default_Format = '5.2f'; + $Default_Style = 'auto'; + # The cache can cause a slight loss of sys time accuracy. If a + # user does many tests (>10) with *very* large counts (>10000) + # or works on a very slow machine the cache may be useful. + disablecache(); + clearallcache(); +} + +sub debug { $Debug = ($_[1] != 0); } + +sub usage { + my $calling_sub = (caller(1))[3]; + $calling_sub =~ s/^Benchmark:://; + return $_Usage{$calling_sub} || ''; +} + +# The cache needs two branches: 's' for strings and 'c' for code. The +# empty loop is different in these two cases. + +$_Usage{clearcache} = <<'USAGE'; +usage: clearcache($count); +USAGE + +sub clearcache { + die usage unless @_ == 1; + delete $Cache{"$_[0]c"}; delete $Cache{"$_[0]s"}; +} + +$_Usage{clearallcache} = <<'USAGE'; +usage: clearallcache(); +USAGE + +sub clearallcache { + die usage if @_; + %Cache = (); +} + +$_Usage{enablecache} = <<'USAGE'; +usage: enablecache(); +USAGE + +sub enablecache { + die usage if @_; + $Do_Cache = 1; +} + +$_Usage{disablecache} = <<'USAGE'; +usage: disablecache(); +USAGE + +sub disablecache { + die usage if @_; + $Do_Cache = 0; +} + + +# --- Functions to process the 'time' data type + +sub new { my @t = (mytime, times, @_ == 2 ? $_[1] : 0); + print STDERR "new=@t\n" if $Debug; + bless \@t; } + +sub cpu_p { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps ; } +sub cpu_c { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $cu+$cs ; } +sub cpu_a { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps+$cu+$cs ; } +sub real { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $r ; } +sub iters { $_[0]->[5] ; } + +# return the sum of various times: which ones depending on $style + +sub elapsed { + my ($self, $style) = @_; + $style = "" unless defined $style; + + return $self->cpu_c if $style eq 'nop'; + return $self->cpu_p if $style eq 'noc'; + return $self->cpu_a; +} + + +$_Usage{timediff} = <<'USAGE'; +usage: $result_diff = timediff($result1, $result2); +USAGE + +sub timediff { + my($a, $b) = @_; + + die usage unless ref $a and ref $b; + + my @r; + for (my $i=0; $i < @$a; ++$i) { + push(@r, $a->[$i] - $b->[$i]); + } + #die "Bad timediff(): ($r[1] + $r[2]) <= 0 (@$a[1,2]|@$b[1,2])\n" + # if ($r[1] + $r[2]) < 0; + bless \@r; +} + +$_Usage{timesum} = <<'USAGE'; +usage: $sum = timesum($result1, $result2); +USAGE + +sub timesum { + my($a, $b) = @_; + + die usage unless ref $a and ref $b; + + my @r; + for (my $i=0; $i < @$a; ++$i) { + push(@r, $a->[$i] + $b->[$i]); + } + bless \@r; +} + + +$_Usage{timestr} = <<'USAGE'; +usage: $formatted_result = timestr($result1); +USAGE + +sub timestr { + my($tr, $style, $f) = @_; + + die usage unless ref $tr; + + my @t = @$tr; + warn "bad time value (@t)" unless @t==6; + my($r, $pu, $ps, $cu, $cs, $n) = @t; + my($pt, $ct, $tt) = ($tr->cpu_p, $tr->cpu_c, $tr->cpu_a); + $f = $Default_Format unless defined $f; + # format a time in the required style, other formats may be added here + $style ||= $Default_Style; + return '' if $style eq 'none'; + $style = ($ct>0) ? 'all' : 'noc' if $style eq 'auto'; + my $s = "@t $style"; # default for unknown style + my $w = $hirestime ? "%2g" : "%2d"; + $s = sprintf("$w wallclock secs (%$f usr %$f sys + %$f cusr %$f csys = %$f CPU)", + $r,$pu,$ps,$cu,$cs,$tt) if $style eq 'all'; + $s = sprintf("$w wallclock secs (%$f usr + %$f sys = %$f CPU)", + $r,$pu,$ps,$pt) if $style eq 'noc'; + $s = sprintf("$w wallclock secs (%$f cusr + %$f csys = %$f CPU)", + $r,$cu,$cs,$ct) if $style eq 'nop'; + my $elapsed = $tr->elapsed($style); + $s .= sprintf(" @ %$f/s (n=$n)",$n/($elapsed)) if $n && $elapsed; + $s; +} + +sub timedebug { + my($msg, $t) = @_; + print STDERR "$msg",timestr($t),"\n" if $Debug; +} + +# --- Functions implementing low-level support for timing loops + +$_Usage{runloop} = <<'USAGE'; +usage: runloop($number, [$string | $coderef]) +USAGE + +sub runloop { + my($n, $c) = @_; + + $n+=0; # force numeric now, so garbage won't creep into the eval + croak "negative loopcount $n" if $n<0; + confess usage unless defined $c; + my($t0, $t1, $td); # before, after, difference + + # find package of caller so we can execute code there + my($curpack) = caller(0); + my($i, $pack)= 0; + while (($pack) = caller(++$i)) { + last if $pack ne $curpack; + } + + my ($subcode, $subref); + if (ref $c eq 'CODE') { + $subcode = "sub { for (1 .. $n) { local \$_; package $pack; &\$c; } }"; + $subref = eval $subcode; + } + else { + $subcode = "sub { for (1 .. $n) { local \$_; package $pack; $c;} }"; + $subref = _doeval($subcode); + } + croak "runloop unable to compile '$c': $@\ncode: $subcode\n" if $@; + print STDERR "runloop $n '$subcode'\n" if $Debug; + + # Wait for the user timer to tick. This makes the error range more like + # -0.01, +0. If we don't wait, then it's more like -0.01, +0.01. This + # may not seem important, but it significantly reduces the chances of + # getting a too low initial $n in the initial, 'find the minimum' loop + # in &countit. This, in turn, can reduce the number of calls to + # &runloop a lot, and thus reduce additive errors. + # + # Note that its possible for the act of reading the system clock to + # burn lots of system CPU while we burn very little user clock in the + # busy loop, which can cause the loop to run for a very long wall time. + # So gradually ramp up the duration of the loop. See RT #122003 + # + my $tbase = Benchmark->new(0)->[1]; + my $limit = 1; + while ( ( $t0 = Benchmark->new(0) )->[1] == $tbase ) { + for (my $i=0; $i < $limit; $i++) { my $x = $i / 1.5 } # burn user CPU + $limit *= 1.1; + } + $subref->(); + $t1 = Benchmark->new($n); + $td = &timediff($t1, $t0); + timedebug("runloop:",$td); + $td; +} + +$_Usage{timeit} = <<'USAGE'; +usage: $result = timeit($count, 'code' ); or + $result = timeit($count, sub { code } ); +USAGE + +sub timeit { + my($n, $code) = @_; + my($wn, $wc, $wd); + + die usage unless defined $code and + (!ref $code or ref $code eq 'CODE'); + + printf STDERR "timeit $n $code\n" if $Debug; + my $cache_key = $n . ( ref( $code ) ? 'c' : 's' ); + if ($Do_Cache && exists $Cache{$cache_key} ) { + $wn = $Cache{$cache_key}; + } else { + $wn = &runloop($n, ref( $code ) ? sub { } : '' ); + # Can't let our baseline have any iterations, or they get subtracted + # out of the result. + $wn->[5] = 0; + $Cache{$cache_key} = $wn; + } + + $wc = &runloop($n, $code); + + $wd = timediff($wc, $wn); + timedebug("timeit: ",$wc); + timedebug(" - ",$wn); + timedebug(" = ",$wd); + + $wd; +} + + +my $default_for = 3; +my $min_for = 0.1; + + +$_Usage{countit} = <<'USAGE'; +usage: $result = countit($time, 'code' ); or + $result = countit($time, sub { code } ); +USAGE + +sub countit { + my ( $tmax, $code ) = @_; + + die usage unless @_; + + if ( not defined $tmax or $tmax == 0 ) { + $tmax = $default_for; + } elsif ( $tmax < 0 ) { + $tmax = -$tmax; + } + + die "countit($tmax, ...): timelimit cannot be less than $min_for.\n" + if $tmax < $min_for; + + my ($n, $tc); + + # First find the minimum $n that gives a significant timing. + my $zeros=0; + for ($n = 1; ; $n *= 2 ) { + my $t0 = Benchmark->new(0); + my $td = timeit($n, $code); + my $t1 = Benchmark->new(0); + $tc = $td->[1] + $td->[2]; + if ( $tc <= 0 and $n > 1024 ) { + my $d = timediff($t1, $t0); + # note that $d is the total CPU time taken to call timeit(), + # while $tc is the difference in CPU secs between the empty run + # and the code run. If the code is trivial, its possible + # for $d to get large while $tc is still zero (or slightly + # negative). Bail out once timeit() starts taking more than a + # few seconds without noticeable difference. + if ($d->[1] + $d->[2] > 8 + || ++$zeros > 16) + { + die "Timing is consistently zero in estimation loop, cannot benchmark. N=$n\n"; + } + } else { + $zeros = 0; + } + last if $tc > 0.1; + } + + my $nmin = $n; + + # Get $n high enough that we can guess the final $n with some accuracy. + my $tpra = 0.1 * $tmax; # Target/time practice. + while ( $tc < $tpra ) { + # The 5% fudge is to keep us from iterating again all + # that often (this speeds overall responsiveness when $tmax is big + # and we guess a little low). This does not noticeably affect + # accuracy since we're not counting these times. + $n = int( $tpra * 1.05 * $n / $tc ); # Linear approximation. + my $td = timeit($n, $code); + my $new_tc = $td->[1] + $td->[2]; + # Make sure we are making progress. + $tc = $new_tc > 1.2 * $tc ? $new_tc : 1.2 * $tc; + } + + # Now, do the 'for real' timing(s), repeating until we exceed + # the max. + my $ntot = 0; + my $rtot = 0; + my $utot = 0.0; + my $stot = 0.0; + my $cutot = 0.0; + my $cstot = 0.0; + my $ttot = 0.0; + + # The 5% fudge is because $n is often a few % low even for routines + # with stable times and avoiding extra timeit()s is nice for + # accuracy's sake. + $n = int( $n * ( 1.05 * $tmax / $tc ) ); + $zeros=0; + while () { + my $td = timeit($n, $code); + $ntot += $n; + $rtot += $td->[0]; + $utot += $td->[1]; + $stot += $td->[2]; + $cutot += $td->[3]; + $cstot += $td->[4]; + $ttot = $utot + $stot; + last if $ttot >= $tmax; + if ( $ttot <= 0 ) { + ++$zeros > 16 + and die "Timing is consistently zero, cannot benchmark. N=$n\n"; + } else { + $zeros = 0; + } + $ttot = 0.01 if $ttot < 0.01; + my $r = $tmax / $ttot - 1; # Linear approximation. + $n = int( $r * $ntot ); + $n = $nmin if $n < $nmin; + } + + return bless [ $rtot, $utot, $stot, $cutot, $cstot, $ntot ]; +} + +# --- Functions implementing high-level time-then-print utilities + +sub n_to_for { + my $n = shift; + return $n == 0 ? $default_for : $n < 0 ? -$n : undef; +} + +$_Usage{timethis} = <<'USAGE'; +usage: $result = timethis($time, 'code' ); or + $result = timethis($time, sub { code } ); +USAGE + +sub timethis{ + my($n, $code, $title, $style) = @_; + my($t, $forn); + + die usage unless defined $code and + (!ref $code or ref $code eq 'CODE'); + + if ( $n > 0 ) { + croak "non-integer loopcount $n, stopped" if int($n)<$n; + $t = timeit($n, $code); + $title = "timethis $n" unless defined $title; + } else { + my $fort = n_to_for( $n ); + $t = countit( $fort, $code ); + $title = "timethis for $fort" unless defined $title; + $forn = $t->[-1]; + } + local $| = 1; + $style = "" unless defined $style; + printf("%10s: ", $title) unless $style eq 'none'; + print timestr($t, $style, $Default_Format),"\n" unless $style eq 'none'; + + $n = $forn if defined $forn; + + if ($t->elapsed($style) < 0) { + # due to clock granularity and variable CPU speed and load, + # on quick code with a small number of loops, it's possible for + # the empty loop to appear to take longer than the real loop + # (e.g. 1 tick versus 0 ticks). This leads to a negative elapsed + # time. In this case, floor it at zero, to stop bizarre results. + print " (warning: too few iterations for a reliable count)\n"; + $t->[$_] = 0 for 1..4; + } + + # A conservative warning to spot very silly tests. + # Don't assume that your benchmark is ok simply because + # you don't get this warning! + print " (warning: too few iterations for a reliable count)\n" + if $n < $Min_Count + || ($t->real < 1 && $n < 1000) + || $t->cpu_a < $Min_CPU; + $t; +} + + +$_Usage{timethese} = <<'USAGE'; +usage: timethese($count, { Name1 => 'code1', ... }); or + timethese($count, { Name1 => sub { code1 }, ... }); +USAGE + +sub timethese{ + my($n, $alt, $style) = @_; + die usage unless ref $alt eq 'HASH'; + + my @names = sort keys %$alt; + $style = "" unless defined $style; + print "Benchmark: " unless $style eq 'none'; + if ( $n > 0 ) { + croak "non-integer loopcount $n, stopped" if int($n)<$n; + print "timing $n iterations of" unless $style eq 'none'; + } else { + print "running" unless $style eq 'none'; + } + print " ", join(', ',@names) unless $style eq 'none'; + unless ( $n > 0 ) { + my $for = n_to_for( $n ); + print ", each" if $n > 1 && $style ne 'none'; + print " for at least $for CPU seconds" unless $style eq 'none'; + } + print "...\n" unless $style eq 'none'; + + # we could save the results in an array and produce a summary here + # sum, min, max, avg etc etc + my %results; + foreach my $name (@names) { + $results{$name} = timethis ($n, $alt -> {$name}, $name, $style); + } + + return \%results; +} + + +$_Usage{cmpthese} = <<'USAGE'; +usage: cmpthese($count, { Name1 => 'code1', ... }); or + cmpthese($count, { Name1 => sub { code1 }, ... }); or + cmpthese($result, $style); +USAGE + +sub cmpthese{ + my ($results, $style); + + # $count can be a blessed object. + if ( ref $_[0] eq 'HASH' ) { + ($results, $style) = @_; + } + else { + my($count, $code) = @_[0,1]; + $style = $_[2] if defined $_[2]; + + die usage unless ref $code eq 'HASH'; + + $results = timethese($count, $code, ($style || "none")); + } + + $style = "" unless defined $style; + + # Flatten in to an array of arrays with the name as the first field + my @vals = map{ [ $_, @{$results->{$_}} ] } keys %$results; + + for (@vals) { + # recreate the pre-flattened Benchmark object + my $tmp_bm = bless [ @{$_}[1..$#$_] ]; + my $elapsed = $tmp_bm->elapsed($style); + # The epsilon fudge here is to prevent div by 0. Since clock + # resolutions are much larger, it's below the noise floor. + my $rate = $_->[6]/(($elapsed)+0.000000000000001); + $_->[7] = $rate; + } + + # Sort by rate + @vals = sort { $a->[7] <=> $b->[7] } @vals; + + # If more than half of the rates are greater than one... + my $display_as_rate = @vals ? ($vals[$#vals>>1]->[7] > 1) : 0; + + my @rows; + my @col_widths; + + my @top_row = ( + '', + $display_as_rate ? 'Rate' : 's/iter', + map { $_->[0] } @vals + ); + + push @rows, \@top_row; + @col_widths = map { length( $_ ) } @top_row; + + # Build the data rows + # We leave the last column in even though it never has any data. Perhaps + # it should go away. Also, perhaps a style for a single column of + # percentages might be nice. + for my $row_val ( @vals ) { + my @row; + + # Column 0 = test name + push @row, $row_val->[0]; + $col_widths[0] = length( $row_val->[0] ) + if length( $row_val->[0] ) > $col_widths[0]; + + # Column 1 = performance + my $row_rate = $row_val->[7]; + + # We assume that we'll never get a 0 rate. + my $rate = $display_as_rate ? $row_rate : 1 / $row_rate; + + # Only give a few decimal places before switching to sci. notation, + # since the results aren't usually that accurate anyway. + my $format = + $rate >= 100 ? + "%0.0f" : + $rate >= 10 ? + "%0.1f" : + $rate >= 1 ? + "%0.2f" : + $rate >= 0.1 ? + "%0.3f" : + "%0.2e"; + + $format .= "/s" + if $display_as_rate; + + my $formatted_rate = sprintf( $format, $rate ); + push @row, $formatted_rate; + $col_widths[1] = length( $formatted_rate ) + if length( $formatted_rate ) > $col_widths[1]; + + # Columns 2..N = performance ratios + my $skip_rest = 0; + for ( my $col_num = 0 ; $col_num < @vals ; ++$col_num ) { + my $col_val = $vals[$col_num]; + my $out; + if ( $skip_rest ) { + $out = ''; + } + elsif ( $col_val->[0] eq $row_val->[0] ) { + $out = "--"; + # $skip_rest = 1; + } + else { + my $col_rate = $col_val->[7]; + $out = sprintf( "%.0f%%", 100*$row_rate/$col_rate - 100 ); + } + push @row, $out; + $col_widths[$col_num+2] = length( $out ) + if length( $out ) > $col_widths[$col_num+2]; + + # A little weirdness to set the first column width properly + $col_widths[$col_num+2] = length( $col_val->[0] ) + if length( $col_val->[0] ) > $col_widths[$col_num+2]; + } + push @rows, \@row; + } + + return \@rows if $style eq "none"; + + # Equalize column widths in the chart as much as possible without + # exceeding 80 characters. This does not use or affect cols 0 or 1. + my @sorted_width_refs = + sort { $$a <=> $$b } map { \$_ } @col_widths[2..$#col_widths]; + my $max_width = ${$sorted_width_refs[-1]}; + + my $total = @col_widths - 1 ; + for ( @col_widths ) { $total += $_ } + + STRETCHER: + while ( $total < 80 ) { + my $min_width = ${$sorted_width_refs[0]}; + last + if $min_width == $max_width; + for ( @sorted_width_refs ) { + last + if $$_ > $min_width; + ++$$_; + ++$total; + last STRETCHER + if $total >= 80; + } + } + + # Dump the output + my $format = join( ' ', map { "%${_}s" } @col_widths ) . "\n"; + substr( $format, 1, 0 ) = '-'; + for ( @rows ) { + printf $format, @$_; + } + + return \@rows ; +} + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CORE.pod b/data/miniconda3/lib/perl5/core_perl/CORE.pod new file mode 100644 index 0000000000000000000000000000000000000000..e40b2d0aa95938e3fd07dd4944f65c319df8e2ed --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CORE.pod @@ -0,0 +1,94 @@ +=head1 NAME + +CORE - Namespace for Perl's core routines + +=head1 SYNOPSIS + + BEGIN { + *CORE::GLOBAL::hex = sub { 1; }; + } + + print hex("0x50"),"\n"; # prints 1 + print CORE::hex("0x50"),"\n"; # prints 80 + CORE::say "yes"; # prints yes + + BEGIN { *shove = \&CORE::push; } + shove @array, 1,2,3; # pushes on to @array + +=head1 DESCRIPTION + +The C namespace gives access to the original built-in functions of +Perl. The C package is built into +Perl, and therefore you do not need to use or +require a hypothetical "CORE" module prior to accessing routines in this +namespace. + +A list of the built-in functions in Perl can be found in L. + +For all Perl keywords, a C prefix will force the built-in function +to be used, even if it has been overridden or would normally require the +L pragma. Despite appearances, this has nothing to do with the +CORE package, but is part of Perl's syntax. + +For many Perl functions, the CORE package contains real subroutines. This +feature is new in Perl 5.16. You can take references to these and make +aliases. However, some can only be called as barewords; i.e., you cannot +use ampersand syntax (C<&foo>) or call them through references. See the +C example above. These subroutines exist for all keywords except the following: + +C<__DATA__>, C<__END__>, C, C, C, C, C, +C, C, C, C, C, C, C, C, +C, C, C, C, C, C, C, C, C, +C, C, C, C, C, C, C, C, C, +C, C, C, C, C, C, C, C, C, +C, C, C, C, C, C, C, C, +C, C, C, C, C, C, C + +Calling with +ampersand syntax and through references does not work for the following +functions, as they have special syntax that cannot always be translated +into a simple list (e.g., C vs C): + +C, C, C, C, C, C, C, +C, C, C, C, C, C, C + +=head1 OVERRIDING CORE FUNCTIONS + +To override a Perl built-in routine with your own version, you need to +import it at compile-time. This can be conveniently achieved with the +C pragma. This will affect only the package in which you've imported +the said subroutine: + + use subs 'chdir'; + sub chdir { ... } + chdir $somewhere; + +To override a built-in globally (that is, in all namespaces), you need to +import your function into the C pseudo-namespace at compile +time: + + BEGIN { + *CORE::GLOBAL::hex = sub { + # ... your code here + }; + } + +The new routine will be called whenever a built-in function is called +without a qualifying package: + + print hex("0x50"),"\n"; # prints 1 + +In both cases, if you want access to the original, unaltered routine, use +the C prefix: + + print CORE::hex("0x50"),"\n"; # prints 80 + +=head1 AUTHOR + +This documentation provided by Tels 2007. + +=head1 SEE ALSO + +L, L. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN.pm b/data/miniconda3/lib/perl5/core_perl/CPAN.pm new file mode 100644 index 0000000000000000000000000000000000000000..2d87f47f8b94b8124d5f5572a9cd3cc02812dd7c --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN.pm @@ -0,0 +1,4090 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +use strict; +package CPAN; +$CPAN::VERSION = '2.27'; +$CPAN::VERSION =~ s/_//; + +# we need to run chdir all over and we would get at wrong libraries +# there +use File::Spec (); +BEGIN { + if (File::Spec->can("rel2abs")) { + for my $inc (@INC) { + $inc = File::Spec->rel2abs($inc) unless ref $inc; + } + } + $SIG{WINCH} = 'IGNORE' if exists $SIG{WINCH}; +} +use CPAN::Author; +use CPAN::HandleConfig; +use CPAN::Version; +use CPAN::Bundle; +use CPAN::CacheMgr; +use CPAN::Complete; +use CPAN::Debug; +use CPAN::Distribution; +use CPAN::Distrostatus; +use CPAN::FTP; +use CPAN::Index 1.93; # https://rt.cpan.org/Ticket/Display.html?id=43349 +use CPAN::InfoObj; +use CPAN::Module; +use CPAN::Prompt; +use CPAN::URL; +use CPAN::Queue; +use CPAN::Tarzip; +use CPAN::DeferredCode; +use CPAN::Shell; +use CPAN::LWP::UserAgent; +use CPAN::Exception::RecursiveDependency; +use CPAN::Exception::yaml_not_installed; +use CPAN::Exception::yaml_process_error; + +use Carp (); +use Config (); +use Cwd qw(chdir); +use DirHandle (); +use Exporter (); +use ExtUtils::MakeMaker qw(prompt); # for some unknown reason, + # 5.005_04 does not work without + # this +use File::Basename (); +use File::Copy (); +use File::Find; +use File::Path (); +use FileHandle (); +use Fcntl qw(:flock); +use Safe (); +use Sys::Hostname qw(hostname); +use Text::ParseWords (); +use Text::Wrap (); + +# protect against "called too early" +sub find_perl (); +sub anycwd (); +sub _uniq; + +no lib "."; + +require Mac::BuildTools if $^O eq 'MacOS'; +if ($ENV{PERL5_CPAN_IS_RUNNING} && $$ != $ENV{PERL5_CPAN_IS_RUNNING}) { + $ENV{PERL5_CPAN_IS_RUNNING_IN_RECURSION} ||= $ENV{PERL5_CPAN_IS_RUNNING}; + my @rec = _uniq split(/,/, $ENV{PERL5_CPAN_IS_RUNNING_IN_RECURSION}), $$; + $ENV{PERL5_CPAN_IS_RUNNING_IN_RECURSION} = join ",", @rec; + # warn "# Note: Recursive call of CPAN.pm detected\n"; + my $w = sprintf "# Note: CPAN.pm is running in process %d now", pop @rec; + my %sleep = ( + 5 => 30, + 6 => 60, + 7 => 120, + ); + my $sleep = @rec > 7 ? 300 : ($sleep{scalar @rec}||0); + my $verbose = @rec >= 4; + while (@rec) { + $w .= sprintf " which has been called by process %d", pop @rec; + } + if ($sleep) { + $w .= ".\n\n# Sleeping $sleep seconds to protect other processes\n"; + } + if ($verbose) { + warn $w; + } + local $| = 1; + my $have_been_sleeping = 0; + while ($sleep > 0) { + printf "\r#%5d", --$sleep; + sleep 1; + ++$have_been_sleeping; + } + print "\n" if $have_been_sleeping; +} +$ENV{PERL5_CPAN_IS_RUNNING}=$$; +$ENV{PERL5_CPANPLUS_IS_RUNNING}=$$; # https://rt.cpan.org/Ticket/Display.html?id=23735 + +END { $CPAN::End++; &cleanup; } + +$CPAN::Signal ||= 0; +$CPAN::Frontend ||= "CPAN::Shell"; +unless (@CPAN::Defaultsites) { + @CPAN::Defaultsites = map { + CPAN::URL->new(TEXT => $_, FROM => "DEF") + } + "http://www.perl.org/CPAN/", + "ftp://ftp.perl.org/pub/CPAN/"; +} +# $CPAN::iCwd (i for initial) +$CPAN::iCwd ||= CPAN::anycwd(); +$CPAN::Perl ||= CPAN::find_perl(); +$CPAN::Defaultdocs ||= "http://search.cpan.org/perldoc?"; +$CPAN::Defaultrecent ||= "http://search.cpan.org/uploads.rdf"; +$CPAN::Defaultrecent ||= "http://cpan.uwinnipeg.ca/htdocs/cpan.xml"; + +# our globals are getting a mess +use vars qw( + $AUTOLOAD + $Be_Silent + $CONFIG_DIRTY + $Defaultdocs + $Echo_readline + $Frontend + $GOTOSHELL + $HAS_USABLE + $Have_warned + $MAX_RECURSION + $META + $RUN_DEGRADED + $Signal + $SQLite + $Suppress_readline + $VERSION + $autoload_recursion + $term + @Defaultsites + @EXPORT + ); + +$MAX_RECURSION = 32; + +@CPAN::ISA = qw(CPAN::Debug Exporter); + +# note that these functions live in CPAN::Shell and get executed via +# AUTOLOAD when called directly +@EXPORT = qw( + autobundle + bundle + clean + cvs_import + expand + force + fforce + get + install + install_tested + is_tested + make + mkmyconfig + notest + perldoc + readme + recent + recompile + report + shell + smoke + test + upgrade + ); + +sub soft_chdir_with_alternatives ($); + +{ + $autoload_recursion ||= 0; + + #-> sub CPAN::AUTOLOAD ; + sub AUTOLOAD { ## no critic + $autoload_recursion++; + my($l) = $AUTOLOAD; + $l =~ s/.*:://; + if ($CPAN::Signal) { + warn "Refusing to autoload '$l' while signal pending"; + $autoload_recursion--; + return; + } + if ($autoload_recursion > 1) { + my $fullcommand = join " ", map { "'$_'" } $l, @_; + warn "Refusing to autoload $fullcommand in recursion\n"; + $autoload_recursion--; + return; + } + my(%export); + @export{@EXPORT} = ''; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + if (exists $export{$l}) { + CPAN::Shell->$l(@_); + } else { + die(qq{Unknown CPAN command "$AUTOLOAD". }. + qq{Type ? for help.\n}); + } + $autoload_recursion--; + } +} + +{ + my $x = *SAVEOUT; # avoid warning + open($x,">&STDOUT") or die "dup failed"; + my $redir = 0; + sub _redirect(@) { + #die if $redir; + local $_; + push(@_,undef); + while(defined($_=shift)) { + if (s/^\s*>//){ + my ($m) = s/^>// ? ">" : ""; + s/\s+//; + $_=shift unless length; + die "no dest" unless defined; + open(STDOUT,">$m$_") or die "open:$_:$!\n"; + $redir=1; + } elsif ( s/^\s*\|\s*// ) { + my $pipe="| $_"; + while(defined($_[0])){ + $pipe .= ' ' . shift; + } + open(STDOUT,$pipe) or die "open:$pipe:$!\n"; + $redir=1; + } else { + push(@_,$_); + } + } + return @_; + } + sub _unredirect { + return unless $redir; + $redir = 0; + ## redirect: unredirect and propagate errors. explicit close to wait for pipe. + close(STDOUT); + open(STDOUT,">&SAVEOUT"); + die "$@" if "$@"; + ## redirect: done + } +} + +sub _uniq { + my(@list) = @_; + my %seen; + return grep { !$seen{$_}++ } @list; +} + +#-> sub CPAN::shell ; +sub shell { + my($self) = @_; + $Suppress_readline = ! -t STDIN unless defined $Suppress_readline; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + + my $oprompt = shift || CPAN::Prompt->new; + my $prompt = $oprompt; + my $commandline = shift || ""; + $CPAN::CurrentCommandId ||= 1; + + local($^W) = 1; + unless ($Suppress_readline) { + require Term::ReadLine; + if (! $term + or + $term->ReadLine eq "Term::ReadLine::Stub" + ) { + $term = Term::ReadLine->new('CPAN Monitor'); + } + if ($term->ReadLine eq "Term::ReadLine::Gnu") { + my $attribs = $term->Attribs; + $attribs->{attempted_completion_function} = sub { + &CPAN::Complete::gnu_cpl; + } + } else { + $readline::rl_completion_function = + $readline::rl_completion_function = 'CPAN::Complete::cpl'; + } + if (my $histfile = $CPAN::Config->{'histfile'}) {{ + unless ($term->can("AddHistory")) { + $CPAN::Frontend->mywarn("Terminal does not support AddHistory.\n"); + unless ($CPAN::META->has_inst('Term::ReadLine::Perl')) { + $CPAN::Frontend->mywarn("\nTo fix that, maybe try> install Term::ReadLine::Perl\n\n"); + } + last; + } + $META->readhist($term,$histfile); + }} + for ($CPAN::Config->{term_ornaments}) { # alias + local $Term::ReadLine::termcap_nowarn = 1; + $term->ornaments($_) if defined; + } + # $term->OUT is autoflushed anyway + my $odef = select STDERR; + $| = 1; + select STDOUT; + $| = 1; + select $odef; + } + + $META->checklock(); + my @cwd = grep { defined $_ and length $_ } + CPAN::anycwd(), + File::Spec->can("tmpdir") ? File::Spec->tmpdir() : (), + File::Spec->rootdir(); + my $try_detect_readline; + $try_detect_readline = $term->ReadLine eq "Term::ReadLine::Stub" if $term; + unless ($CPAN::Config->{inhibit_startup_message}) { + my $rl_avail = $Suppress_readline ? "suppressed" : + ($term->ReadLine ne "Term::ReadLine::Stub") ? "enabled" : + "available (maybe install Bundle::CPAN or Bundle::CPANxxl?)"; + $CPAN::Frontend->myprint( + sprintf qq{ +cpan shell -- CPAN exploration and modules installation (v%s) +Enter 'h' for help. + +}, + $CPAN::VERSION, + ) + } + my($continuation) = ""; + my $last_term_ornaments; + SHELLCOMMAND: while () { + if ($Suppress_readline) { + if ($Echo_readline) { + $|=1; + } + print $prompt; + last SHELLCOMMAND unless defined ($_ = <> ); + if ($Echo_readline) { + # backdoor: I could not find a way to record sessions + print $_; + } + chomp; + } else { + last SHELLCOMMAND unless + defined ($_ = $term->readline($prompt, $commandline)); + } + $_ = "$continuation$_" if $continuation; + s/^\s+//; + next SHELLCOMMAND if /^$/; + s/^\s*\?\s*/help /; + if (/^(?:q(?:uit)?|bye|exit)\s*$/i) { + last SHELLCOMMAND; + } elsif (s/\\$//s) { + chomp; + $continuation = $_; + $prompt = " > "; + } elsif (/^\!/) { + s/^\!//; + my($eval) = $_; + package + CPAN::Eval; # hide from the indexer + use strict; + use vars qw($import_done); + CPAN->import(':DEFAULT') unless $import_done++; + CPAN->debug("eval[$eval]") if $CPAN::DEBUG; + eval($eval); + warn $@ if $@; + $continuation = ""; + $prompt = $oprompt; + } elsif (/./) { + my(@line); + eval { @line = Text::ParseWords::shellwords($_) }; + warn($@), next SHELLCOMMAND if $@; + warn("Text::Parsewords could not parse the line [$_]"), + next SHELLCOMMAND unless @line; + $CPAN::META->debug("line[".join("|",@line)."]") if $CPAN::DEBUG; + my $command = shift @line; + eval { + local (*STDOUT)=*STDOUT; + @line = _redirect(@line); + CPAN::Shell->$command(@line) + }; + my $command_error = $@; + _unredirect; + my $reported_error; + if ($command_error) { + my $err = $command_error; + if (ref $err and $err->isa('CPAN::Exception::blocked_urllist')) { + $CPAN::Frontend->mywarn("Client not fully configured, please proceed with configuring.$err"); + $reported_error = ref $err; + } else { + # I'd prefer never to arrive here and make all errors exception objects + if ($err =~ /\S/) { + require Carp; + require Dumpvalue; + my $dv = Dumpvalue->new(tick => '"'); + Carp::cluck(sprintf "Catching error: %s", $dv->stringify($err)); + } + } + } + if ($command =~ /^( + # classic commands + make + |test + |install + |clean + + # pragmas for classic commands + |ff?orce + |notest + + # compounds + |report + |smoke + |upgrade + )$/x) { + # only commands that tell us something about failed distros + # eval necessary for people without an urllist + eval {CPAN::Shell->failed($CPAN::CurrentCommandId,1);}; + if (my $err = $@) { + unless (ref $err and $reported_error eq ref $err) { + die $@; + } + } + } + soft_chdir_with_alternatives(\@cwd); + $CPAN::Frontend->myprint("\n"); + $continuation = ""; + $CPAN::CurrentCommandId++; + $prompt = $oprompt; + } + } continue { + $commandline = ""; # I do want to be able to pass a default to + # shell, but on the second command I see no + # use in that + $Signal=0; + CPAN::Queue->nullify_queue; + if ($try_detect_readline) { + if ($CPAN::META->has_inst("Term::ReadLine::Gnu") + || + $CPAN::META->has_inst("Term::ReadLine::Perl") + ) { + delete $INC{"Term/ReadLine.pm"}; + my $redef = 0; + local($SIG{__WARN__}) = CPAN::Shell::paintdots_onreload(\$redef); + require Term::ReadLine; + $CPAN::Frontend->myprint("\n$redef subroutines in ". + "Term::ReadLine redefined\n"); + $GOTOSHELL = 1; + } + } + if ($term and $term->can("ornaments")) { + for ($CPAN::Config->{term_ornaments}) { # alias + if (defined $_) { + if (not defined $last_term_ornaments + or $_ != $last_term_ornaments + ) { + local $Term::ReadLine::termcap_nowarn = 1; + $term->ornaments($_); + $last_term_ornaments = $_; + } + } else { + undef $last_term_ornaments; + } + } + } + for my $class (qw(Module Distribution)) { + # again unsafe meta access? + for my $dm (sort keys %{$CPAN::META->{readwrite}{"CPAN::$class"}}) { + next unless $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; + CPAN->debug("BUG: $class '$dm' was in command state, resetting"); + delete $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; + } + } + if ($GOTOSHELL) { + $GOTOSHELL = 0; # not too often + $META->savehist if $CPAN::term && $CPAN::term->can("GetHistory"); + @_ = ($oprompt,""); + goto &shell; + } + } + soft_chdir_with_alternatives(\@cwd); +} + +#-> CPAN::soft_chdir_with_alternatives ; +sub soft_chdir_with_alternatives ($) { + my($cwd) = @_; + unless (@$cwd) { + my $root = File::Spec->rootdir(); + $CPAN::Frontend->mywarn(qq{Warning: no good directory to chdir to! +Trying '$root' as temporary haven. +}); + push @$cwd, $root; + } + while () { + if (chdir "$cwd->[0]") { + return; + } else { + if (@$cwd>1) { + $CPAN::Frontend->mywarn(qq{Could not chdir to "$cwd->[0]": $! +Trying to chdir to "$cwd->[1]" instead. +}); + shift @$cwd; + } else { + $CPAN::Frontend->mydie(qq{Could not chdir to "$cwd->[0]": $!}); + } + } + } +} + +sub _flock { + my($fh,$mode) = @_; + if ( $Config::Config{d_flock} || $Config::Config{d_fcntl_can_lock} ) { + return flock $fh, $mode; + } elsif (!$Have_warned->{"d_flock"}++) { + $CPAN::Frontend->mywarn("Your OS does not seem to support locking; continuing and ignoring all locking issues\n"); + $CPAN::Frontend->mysleep(5); + return 1; + } else { + return 1; + } +} + +sub _yaml_module () { + my $yaml_module = $CPAN::Config->{yaml_module} || "YAML"; + if ( + $yaml_module ne "YAML" + && + !$CPAN::META->has_inst($yaml_module) + ) { + # $CPAN::Frontend->mywarn("'$yaml_module' not installed, falling back to 'YAML'\n"); + $yaml_module = "YAML"; + } + if ($yaml_module eq "YAML" + && + $CPAN::META->has_inst($yaml_module) + && + $YAML::VERSION < 0.60 + && + !$Have_warned->{"YAML"}++ + ) { + $CPAN::Frontend->mywarn("Warning: YAML version '$YAML::VERSION' is too low, please upgrade!\n". + "I'll continue but problems are *very* likely to happen.\n" + ); + $CPAN::Frontend->mysleep(5); + } + return $yaml_module; +} + +# CPAN::_yaml_loadfile +sub _yaml_loadfile { + my($self,$local_file) = @_; + return +[] unless -s $local_file; + my $yaml_module = _yaml_module; + if ($CPAN::META->has_inst($yaml_module)) { + # temporarily enable yaml code deserialisation + no strict 'refs'; + # 5.6.2 could not do the local() with the reference + # so we do it manually instead + my $old_loadcode = ${"$yaml_module\::LoadCode"}; + ${ "$yaml_module\::LoadCode" } = $CPAN::Config->{yaml_load_code} || 0; + + my ($code, @yaml); + if ($code = UNIVERSAL::can($yaml_module, "LoadFile")) { + eval { @yaml = $code->($local_file); }; + if ($@) { + # this shall not be done by the frontend + die CPAN::Exception::yaml_process_error->new($yaml_module,$local_file,"parse",$@); + } + } elsif ($code = UNIVERSAL::can($yaml_module, "Load")) { + local *FH; + unless (open FH, $local_file) { + $CPAN::Frontend->mywarn("Could not open '$local_file': $!"); + return +[]; + } + local $/; + my $ystream = ; + eval { @yaml = $code->($ystream); }; + if ($@) { + # this shall not be done by the frontend + die CPAN::Exception::yaml_process_error->new($yaml_module,$local_file,"parse",$@); + } + } + ${"$yaml_module\::LoadCode"} = $old_loadcode; + return \@yaml; + } else { + # this shall not be done by the frontend + die CPAN::Exception::yaml_not_installed->new($yaml_module, $local_file, "parse"); + } + return +[]; +} + +# CPAN::_yaml_dumpfile +sub _yaml_dumpfile { + my($self,$local_file,@what) = @_; + my $yaml_module = _yaml_module; + if ($CPAN::META->has_inst($yaml_module)) { + my $code; + if (UNIVERSAL::isa($local_file, "FileHandle")) { + $code = UNIVERSAL::can($yaml_module, "Dump"); + eval { print $local_file $code->(@what) }; + } elsif ($code = UNIVERSAL::can($yaml_module, "DumpFile")) { + eval { $code->($local_file,@what); }; + } elsif ($code = UNIVERSAL::can($yaml_module, "Dump")) { + local *FH; + open FH, ">$local_file" or die "Could not open '$local_file': $!"; + print FH $code->(@what); + } + if ($@) { + die CPAN::Exception::yaml_process_error->new($yaml_module,$local_file,"dump",$@); + } + } else { + if (UNIVERSAL::isa($local_file, "FileHandle")) { + # I think this case does not justify a warning at all + } else { + die CPAN::Exception::yaml_not_installed->new($yaml_module, $local_file, "dump"); + } + } +} + +sub _init_sqlite () { + unless ($CPAN::META->has_inst("CPAN::SQLite")) { + $CPAN::Frontend->mywarn(qq{CPAN::SQLite not installed, trying to work without\n}) + unless $Have_warned->{"CPAN::SQLite"}++; + return; + } + require CPAN::SQLite::META; # not needed since CVS version of 2006-12-17 + $CPAN::SQLite ||= CPAN::SQLite::META->new($CPAN::META); +} + +{ + my $negative_cache = {}; + sub _sqlite_running { + if ($negative_cache->{time} && time < $negative_cache->{time} + 60) { + # need to cache the result, otherwise too slow + return $negative_cache->{fact}; + } else { + $negative_cache = {}; # reset + } + my $ret = $CPAN::Config->{use_sqlite} && ($CPAN::SQLite || _init_sqlite()); + return $ret if $ret; # fast anyway + $negative_cache->{time} = time; + return $negative_cache->{fact} = $ret; + } +} + +$META ||= CPAN->new; # In case we re-eval ourselves we need the || + +# from here on only subs. +################################################################################ + +sub _perl_fingerprint { + my($self,$other_fingerprint) = @_; + my $dll = eval {OS2::DLLname()}; + my $mtime_dll = 0; + if (defined $dll) { + $mtime_dll = (-f $dll ? (stat(_))[9] : '-1'); + } + my $mtime_perl = (-f CPAN::find_perl ? (stat(_))[9] : '-1'); + my $this_fingerprint = { + '$^X' => CPAN::find_perl, + sitearchexp => $Config::Config{sitearchexp}, + 'mtime_$^X' => $mtime_perl, + 'mtime_dll' => $mtime_dll, + }; + if ($other_fingerprint) { + if (exists $other_fingerprint->{'stat($^X)'}) { # repair fp from rev. 1.88_57 + $other_fingerprint->{'mtime_$^X'} = $other_fingerprint->{'stat($^X)'}[9]; + } + # mandatory keys since 1.88_57 + for my $key (qw($^X sitearchexp mtime_dll mtime_$^X)) { + return unless $other_fingerprint->{$key} eq $this_fingerprint->{$key}; + } + return 1; + } else { + return $this_fingerprint; + } +} + +sub suggest_myconfig () { + SUGGEST_MYCONFIG: if(!$INC{'CPAN/MyConfig.pm'}) { + $CPAN::Frontend->myprint("You don't seem to have a user ". + "configuration (MyConfig.pm) yet.\n"); + my $new = CPAN::Shell::colorable_makemaker_prompt("Do you want to create a ". + "user configuration now? (Y/n)", + "yes"); + if($new =~ m{^y}i) { + CPAN::Shell->mkmyconfig(); + return &checklock; + } else { + $CPAN::Frontend->mydie("OK, giving up."); + } + } +} + +#-> sub CPAN::all_objects ; +sub all_objects { + my($mgr,$class) = @_; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + CPAN->debug("mgr[$mgr] class[$class]") if $CPAN::DEBUG; + CPAN::Index->reload; + values %{ $META->{readwrite}{$class} }; # unsafe meta access, ok +} + +# Called by shell, not in batch mode. In batch mode I see no risk in +# having many processes updating something as installations are +# continually checked at runtime. In shell mode I suspect it is +# unintentional to open more than one shell at a time + +#-> sub CPAN::checklock ; +sub checklock { + my($self) = @_; + my $lockfile = File::Spec->catfile($CPAN::Config->{cpan_home},".lock"); + if (-f $lockfile && -M _ > 0) { + my $fh = FileHandle->new($lockfile) or + $CPAN::Frontend->mydie("Could not open lockfile '$lockfile': $!"); + my $otherpid = <$fh>; + my $otherhost = <$fh>; + $fh->close; + if (defined $otherpid && length $otherpid) { + chomp $otherpid; + } + if (defined $otherhost && length $otherhost) { + chomp $otherhost; + } + my $thishost = hostname(); + my $ask_if_degraded_wanted = 0; + if (defined $otherhost && defined $thishost && + $otherhost ne '' && $thishost ne '' && + $otherhost ne $thishost) { + $CPAN::Frontend->mydie(sprintf("CPAN.pm panic: Lockfile '$lockfile'\n". + "reports other host $otherhost and other ". + "process $otherpid.\n". + "Cannot proceed.\n")); + } elsif ($RUN_DEGRADED) { + $CPAN::Frontend->mywarn("Running in downgraded mode (experimental)\n"); + } elsif (defined $otherpid && $otherpid) { + return if $$ == $otherpid; # should never happen + $CPAN::Frontend->mywarn( + qq{ +There seems to be running another CPAN process (pid $otherpid). Contacting... +}); + if (kill 0, $otherpid or $!{EPERM}) { + $CPAN::Frontend->mywarn(qq{Other job is running.\n}); + $ask_if_degraded_wanted = 1; + } elsif (-w $lockfile) { + my($ans) = + CPAN::Shell::colorable_makemaker_prompt + (qq{Other job not responding. Shall I overwrite }. + qq{the lockfile '$lockfile'? (Y/n)},"y"); + $CPAN::Frontend->myexit("Ok, bye\n") + unless $ans =~ /^y/i; + } else { + Carp::croak( + qq{Lockfile '$lockfile' not writable by you. }. + qq{Cannot proceed.\n}. + qq{ On UNIX try:\n}. + qq{ rm '$lockfile'\n}. + qq{ and then rerun us.\n} + ); + } + } elsif ($^O eq "MSWin32") { + $CPAN::Frontend->mywarn( + qq{ +There seems to be running another CPAN process according to '$lockfile'. +}); + $ask_if_degraded_wanted = 1; + } else { + $CPAN::Frontend->mydie(sprintf("CPAN.pm panic: Found invalid lockfile ". + "'$lockfile', please remove. Cannot proceed.\n")); + } + if ($ask_if_degraded_wanted) { + my($ans) = + CPAN::Shell::colorable_makemaker_prompt + (qq{Shall I try to run in downgraded }. + qq{mode? (Y/n)},"y"); + if ($ans =~ /^y/i) { + $CPAN::Frontend->mywarn("Running in downgraded mode (experimental). +Please report if something unexpected happens\n"); + $RUN_DEGRADED = 1; + for ($CPAN::Config) { + # XXX + # $_->{build_dir_reuse} = 0; # 2006-11-17 akoenig Why was that? + $_->{commandnumber_in_prompt} = 0; # visibility + $_->{histfile} = ""; # who should win otherwise? + $_->{cache_metadata} = 0; # better would be a lock? + $_->{use_sqlite} = 0; # better would be a write lock! + $_->{auto_commit} = 0; # we are violent, do not persist + $_->{test_report} = 0; # Oliver Paukstadt had sent wrong reports in degraded mode + } + } else { + my $msg = "You may want to kill the other job and delete the lockfile."; + if (defined $otherpid) { + $msg .= " Something like: + kill $otherpid + rm $lockfile +"; + } + $CPAN::Frontend->mydie("\n$msg"); + } + } + } + my $dotcpan = $CPAN::Config->{cpan_home}; + eval { File::Path::mkpath($dotcpan);}; + if ($@) { + # A special case at least for Jarkko. + my $firsterror = $@; + my $seconderror; + my $symlinkcpan; + if (-l $dotcpan) { + $symlinkcpan = readlink $dotcpan; + die "readlink $dotcpan failed: $!" unless defined $symlinkcpan; + eval { File::Path::mkpath($symlinkcpan); }; + if ($@) { + $seconderror = $@; + } else { + $CPAN::Frontend->mywarn(qq{ +Working directory $symlinkcpan created. +}); + } + } + unless (-d $dotcpan) { + my $mess = qq{ +Your configuration suggests "$dotcpan" as your +CPAN.pm working directory. I could not create this directory due +to this error: $firsterror\n}; + $mess .= qq{ +As "$dotcpan" is a symlink to "$symlinkcpan", +I tried to create that, but I failed with this error: $seconderror +} if $seconderror; + $mess .= qq{ +Please make sure the directory exists and is writable. +}; + $CPAN::Frontend->mywarn($mess); + return suggest_myconfig; + } + } # $@ after eval mkpath $dotcpan + if (0) { # to test what happens when a race condition occurs + for (reverse 1..10) { + print $_, "\n"; + sleep 1; + } + } + # locking + if (!$RUN_DEGRADED && !$self->{LOCKFH}) { + my $fh; + unless ($fh = FileHandle->new("+>>$lockfile")) { + $CPAN::Frontend->mywarn(qq{ + +Your configuration suggests that CPAN.pm should use a working +directory of + $CPAN::Config->{cpan_home} +Unfortunately we could not create the lock file + $lockfile +due to '$!'. + +Please make sure that the configuration variable + \$CPAN::Config->{cpan_home} +points to a directory where you can write a .lock file. You can set +this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your +\@INC path; +}); + return suggest_myconfig; + } + my $sleep = 1; + while (!CPAN::_flock($fh, LOCK_EX|LOCK_NB)) { + my $err = $! || "unknown error"; + if ($sleep>3) { + $CPAN::Frontend->mydie("Could not lock '$lockfile' with flock: $err; giving up\n"); + } + $CPAN::Frontend->mysleep($sleep+=0.1); + $CPAN::Frontend->mywarn("Could not lock '$lockfile' with flock: $err; retrying\n"); + } + + seek $fh, 0, 0; + truncate $fh, 0; + $fh->autoflush(1); + $fh->print($$, "\n"); + $fh->print(hostname(), "\n"); + $self->{LOCK} = $lockfile; + $self->{LOCKFH} = $fh; + } + $SIG{TERM} = sub { + my $sig = shift; + &cleanup; + $CPAN::Frontend->mydie("Got SIG$sig, leaving"); + }; + $SIG{INT} = sub { + # no blocks!!! + my $sig = shift; + &cleanup if $Signal; + die "Got yet another signal" if $Signal > 1; + $CPAN::Frontend->mydie("Got another SIG$sig") if $Signal; + $CPAN::Frontend->mywarn("Caught SIG$sig, trying to continue\n"); + $Signal++; + }; + +# From: Larry Wall +# Subject: Re: deprecating SIGDIE +# To: perl5-porters@perl.org +# Date: Thu, 30 Sep 1999 14:58:40 -0700 (PDT) +# +# The original intent of __DIE__ was only to allow you to substitute one +# kind of death for another on an application-wide basis without respect +# to whether you were in an eval or not. As a global backstop, it should +# not be used any more lightly (or any more heavily :-) than class +# UNIVERSAL. Any attempt to build a general exception model on it should +# be politely squashed. Any bug that causes every eval {} to have to be +# modified should be not so politely squashed. +# +# Those are my current opinions. It is also my opinion that polite +# arguments degenerate to personal arguments far too frequently, and that +# when they do, it's because both people wanted it to, or at least didn't +# sufficiently want it not to. +# +# Larry + + # global backstop to cleanup if we should really die + $SIG{__DIE__} = \&cleanup; + $self->debug("Signal handler set.") if $CPAN::DEBUG; +} + +#-> sub CPAN::DESTROY ; +sub DESTROY { + &cleanup; # need an eval? +} + +#-> sub CPAN::anycwd ; +sub anycwd () { + my $getcwd; + $getcwd = $CPAN::Config->{'getcwd'} || 'cwd'; + CPAN->$getcwd(); +} + +#-> sub CPAN::cwd ; +sub cwd {Cwd::cwd();} + +#-> sub CPAN::getcwd ; +sub getcwd {Cwd::getcwd();} + +#-> sub CPAN::fastcwd ; +sub fastcwd {Cwd::fastcwd();} + +#-> sub CPAN::getdcwd ; +sub getdcwd {Cwd::getdcwd();} + +#-> sub CPAN::backtickcwd ; +sub backtickcwd {my $cwd = `cwd`; chomp $cwd; $cwd} + +# Adapted from Probe::Perl +#-> sub CPAN::_perl_is_same +sub _perl_is_same { + my ($perl) = @_; + return MM->maybe_command($perl) + && `$perl -MConfig=myconfig -e print -e myconfig` eq Config->myconfig; +} + +# Adapted in part from Probe::Perl +#-> sub CPAN::find_perl ; +sub find_perl () { + if ( File::Spec->file_name_is_absolute($^X) ) { + return $^X; + } + else { + my $exe = $Config::Config{exe_ext}; + my @candidates = ( + File::Spec->catfile($CPAN::iCwd,$^X), + $Config::Config{'perlpath'}, + ); + for my $perl_name ($^X, 'perl', 'perl5', "perl$]") { + for my $path (File::Spec->path(), $Config::Config{'binexp'}) { + if ( defined($path) && length $path && -d $path ) { + my $perl = File::Spec->catfile($path,$perl_name); + push @candidates, $perl; + # try with extension if not provided already + if ($^O eq 'VMS') { + # VMS might have a file version at the end + push @candidates, $perl . $exe + unless $perl =~ m/$exe(;\d+)?$/i; + } elsif (defined $exe && length $exe) { + push @candidates, $perl . $exe + unless $perl =~ m/$exe$/i; + } + } + } + } + for my $perl ( @candidates ) { + if (MM->maybe_command($perl) && _perl_is_same($perl)) { + $^X = $perl; + return $perl; + } + } + } + return $^X; # default fall back +} + +#-> sub CPAN::exists ; +sub exists { + my($mgr,$class,$id) = @_; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + CPAN::Index->reload; + ### Carp::croak "exists called without class argument" unless $class; + $id ||= ""; + $id =~ s/:+/::/g if $class eq "CPAN::Module"; + my $exists; + if (CPAN::_sqlite_running) { + $exists = (exists $META->{readonly}{$class}{$id} or + $CPAN::SQLite->set($class, $id)); + } else { + $exists = exists $META->{readonly}{$class}{$id}; + } + $exists ||= exists $META->{readwrite}{$class}{$id}; # unsafe meta access, ok +} + +#-> sub CPAN::delete ; +sub delete { + my($mgr,$class,$id) = @_; + delete $META->{readonly}{$class}{$id}; # unsafe meta access, ok + delete $META->{readwrite}{$class}{$id}; # unsafe meta access, ok +} + +#-> sub CPAN::has_usable +# has_inst is sometimes too optimistic, we should replace it with this +# has_usable whenever a case is given +sub has_usable { + my($self,$mod,$message) = @_; + return 1 if $HAS_USABLE->{$mod}; + my $has_inst = $self->has_inst($mod,$message); + return unless $has_inst; + my $usable; + $usable = { + + # + # most of these subroutines warn on the frontend, then + # die if the installed version is unusable for some + # reason; has_usable() then returns false when it caught + # an exception, otherwise returns true and caches that; + # + 'CPAN::Meta' => [ + sub { + require CPAN::Meta; + unless (CPAN::Version->vge(CPAN::Meta->VERSION, 2.110350)) { + for ("Will not use CPAN::Meta, need version 2.110350\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + + 'CPAN::Meta::Requirements' => [ + sub { + if (defined $CPAN::Meta::Requirements::VERSION + && CPAN::Version->vlt($CPAN::Meta::Requirements::VERSION, "2.120920") + ) { + delete $INC{"CPAN/Meta/Requirements.pm"}; + } + require CPAN::Meta::Requirements; + unless (CPAN::Version->vge(CPAN::Meta::Requirements->VERSION, 2.120920)) { + for ("Will not use CPAN::Meta::Requirements, need version 2.120920\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + + 'CPAN::Reporter' => [ + sub { + if (defined $CPAN::Reporter::VERSION + && CPAN::Version->vlt($CPAN::Reporter::VERSION, "1.2011") + ) { + delete $INC{"CPAN/Reporter.pm"}; + } + require CPAN::Reporter; + unless (CPAN::Version->vge(CPAN::Reporter->VERSION, "1.2011")) { + for ("Will not use CPAN::Reporter, need version 1.2011\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + + LWP => [ # we frequently had "Can't locate object + # method "new" via package "LWP::UserAgent" at + # (eval 69) line 2006 + sub {require LWP}, + sub {require LWP::UserAgent}, + sub {require HTTP::Request}, + sub {require URI::URL; + unless (CPAN::Version->vge(URI::URL::->VERSION,0.08)) { + for ("Will not use URI::URL, need 0.08\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + 'Net::FTP' => [ + sub { + my $var = $CPAN::Config->{ftp_proxy} || $ENV{ftp_proxy}; + if ($var and $var =~ /^http:/i) { + # rt #110833 + for ("Net::FTP cannot handle http proxy") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + sub {require Net::FTP}, + sub {require Net::Config}, + ], + 'HTTP::Tiny' => [ + sub { + require HTTP::Tiny; + unless (CPAN::Version->vge(HTTP::Tiny->VERSION, 0.005)) { + for ("Will not use HTTP::Tiny, need version 0.005\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + 'File::HomeDir' => [ + sub {require File::HomeDir; + unless (CPAN::Version->vge(File::HomeDir::->VERSION, 0.52)) { + for ("Will not use File::HomeDir, need 0.52\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], + 'Archive::Tar' => [ + sub {require Archive::Tar; + my $demand = "1.50"; + unless (CPAN::Version->vge(Archive::Tar::->VERSION, $demand)) { + my $atv = Archive::Tar->VERSION; + for ("You have Archive::Tar $atv, but $demand or later is recommended. Please upgrade.\n") { + $CPAN::Frontend->mywarn($_); + # don't die, because we may need + # Archive::Tar to upgrade + } + + } + }, + ], + 'File::Temp' => [ + # XXX we should probably delete from + # %INC too so we can load after we + # installed a new enough version -- + # I'm not sure. + sub {require File::Temp; + unless (CPAN::Version->vge(File::Temp::->VERSION,0.16)) { + for ("Will not use File::Temp, need 0.16\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ] + }; + if ($usable->{$mod}) { + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + for my $c (0..$#{$usable->{$mod}}) { + my $code = $usable->{$mod}[$c]; + my $ret = eval { &$code() }; + $ret = "" unless defined $ret; + if ($@) { + # warn "DEBUG: c[$c]\$\@[$@]ret[$ret]"; + return; + } + } + } + return $HAS_USABLE->{$mod} = 1; +} + +sub frontend { + shift; + $CPAN::Frontend = shift if @_; + $CPAN::Frontend; +} + +sub use_inst { + my ($self, $module) = @_; + + unless ($self->has_inst($module)) { + $self->frontend->mydie("$module not installed, cannot continue"); + } +} + +#-> sub CPAN::has_inst +sub has_inst { + my($self,$mod,$message) = @_; + Carp::croak("CPAN->has_inst() called without an argument") + unless defined $mod; + my %dont = map { $_ => 1 } keys %{$CPAN::META->{dontload_hash}||{}}, + keys %{$CPAN::Config->{dontload_hash}||{}}, + @{$CPAN::Config->{dontload_list}||[]}; + if (defined $message && $message eq "no" # as far as I remember only used by Nox + || + $dont{$mod} + ) { + $CPAN::META->{dontload_hash}{$mod}||=1; # unsafe meta access, ok + return 0; + } + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + my $file = $mod; + my $obj; + $file =~ s|::|/|g; + $file .= ".pm"; + if ($INC{$file}) { + # checking %INC is wrong, because $INC{LWP} may be true + # although $INC{"URI/URL.pm"} may have failed. But as + # I really want to say "blah loaded OK", I have to somehow + # cache results. + ### warn "$file in %INC"; #debug + return 1; + } elsif (eval { require $file }) { + # eval is good: if we haven't yet read the database it's + # perfect and if we have installed the module in the meantime, + # it tries again. The second require is only a NOOP returning + # 1 if we had success, otherwise it's retrying + + my $mtime = (stat $INC{$file})[9]; + # privileged files loaded by has_inst; Note: we use $mtime + # as a proxy for a checksum. + $CPAN::Shell::reload->{$file} = $mtime; + my $v = eval "\$$mod\::VERSION"; + $v = $v ? " (v$v)" : ""; + CPAN::Shell->optprint("load_module","CPAN: $mod loaded ok$v\n"); + if ($mod eq "CPAN::WAIT") { + push @CPAN::Shell::ISA, 'CPAN::WAIT'; + } + return 1; + } elsif ($mod eq "Net::FTP") { + $CPAN::Frontend->mywarn(qq{ + Please, install Net::FTP as soon as possible. CPAN.pm installs it for you + if you just type + install Bundle::libnet + +}) unless $Have_warned->{"Net::FTP"}++; + $CPAN::Frontend->mysleep(3); + } elsif ($mod eq "Digest::SHA") { + if ($Have_warned->{"Digest::SHA"}++) { + $CPAN::Frontend->mywarn(qq{CPAN: checksum security checks disabled }. + qq{because Digest::SHA not installed.\n}); + } else { + $CPAN::Frontend->mywarn(qq{ + CPAN: checksum security checks disabled because Digest::SHA not installed. + Please consider installing the Digest::SHA module. + +}); + $CPAN::Frontend->mysleep(2); + } + } elsif ($mod eq "Module::Signature") { + # NOT prefs_lookup, we are not a distro + my $check_sigs = $CPAN::Config->{check_sigs}; + if (not $check_sigs) { + # they do not want us:-( + } elsif (not $Have_warned->{"Module::Signature"}++) { + # No point in complaining unless the user can + # reasonably install and use it. + if (eval { require Crypt::OpenPGP; 1 } || + ( + defined $CPAN::Config->{'gpg'} + && + $CPAN::Config->{'gpg'} =~ /\S/ + ) + ) { + $CPAN::Frontend->mywarn(qq{ + CPAN: Module::Signature security checks disabled because Module::Signature + not installed. Please consider installing the Module::Signature module. + You may also need to be able to connect over the Internet to the public + key servers like pool.sks-keyservers.net or pgp.mit.edu. + +}); + $CPAN::Frontend->mysleep(2); + } + } + } else { + delete $INC{$file}; # if it inc'd LWP but failed during, say, URI + } + return 0; +} + +#-> sub CPAN::instance ; +sub instance { + my($mgr,$class,$id) = @_; + CPAN::Index->reload; + $id ||= ""; + # unsafe meta access, ok? + return $META->{readwrite}{$class}{$id} if exists $META->{readwrite}{$class}{$id}; + $META->{readwrite}{$class}{$id} ||= $class->new(ID => $id); +} + +#-> sub CPAN::new ; +sub new { + bless {}, shift; +} + +#-> sub CPAN::_exit_messages ; +sub _exit_messages { + my ($self) = @_; + $self->{exit_messages} ||= []; +} + +#-> sub CPAN::cleanup ; +sub cleanup { + # warn "cleanup called with arg[@_] End[$CPAN::End] Signal[$Signal]"; + local $SIG{__DIE__} = ''; + my($message) = @_; + my $i = 0; + my $ineval = 0; + my($subroutine); + while ((undef,undef,undef,$subroutine) = caller(++$i)) { + $ineval = 1, last if + $subroutine eq '(eval)'; + } + return if $ineval && !$CPAN::End; + return unless defined $META->{LOCK}; + return unless -f $META->{LOCK}; + $META->savehist; + $META->{cachemgr} ||= CPAN::CacheMgr->new('atexit'); + close $META->{LOCKFH}; + unlink $META->{LOCK}; + # require Carp; + # Carp::cluck("DEBUGGING"); + if ( $CPAN::CONFIG_DIRTY ) { + $CPAN::Frontend->mywarn("Warning: Configuration not saved.\n"); + } + $CPAN::Frontend->myprint("Lockfile removed.\n"); + for my $msg ( @{ $META->_exit_messages } ) { + $CPAN::Frontend->myprint($msg); + } +} + +#-> sub CPAN::readhist +sub readhist { + my($self,$term,$histfile) = @_; + my $histsize = $CPAN::Config->{'histsize'} || 100; + $term->Attribs->{'MaxHistorySize'} = $histsize if (defined($term->Attribs->{'MaxHistorySize'})); + my($fh) = FileHandle->new; + open $fh, "<$histfile" or return; + local $/ = "\n"; + while (<$fh>) { + chomp; + $term->AddHistory($_); + } + close $fh; +} + +#-> sub CPAN::savehist +sub savehist { + my($self) = @_; + my($histfile,$histsize); + unless ($histfile = $CPAN::Config->{'histfile'}) { + $CPAN::Frontend->mywarn("No history written (no histfile specified).\n"); + return; + } + $histsize = $CPAN::Config->{'histsize'} || 100; + if ($CPAN::term) { + unless ($CPAN::term->can("GetHistory")) { + $CPAN::Frontend->mywarn("Terminal does not support GetHistory.\n"); + return; + } + } else { + return; + } + my @h = $CPAN::term->GetHistory; + splice @h, 0, @h-$histsize if @h>$histsize; + my($fh) = FileHandle->new; + open $fh, ">$histfile" or $CPAN::Frontend->mydie("Couldn't open >$histfile: $!"); + local $\ = local $, = "\n"; + print $fh @h; + close $fh; +} + +#-> sub CPAN::is_tested +sub is_tested { + my($self,$what,$when) = @_; + unless ($what) { + Carp::cluck("DEBUG: empty what"); + return; + } + $self->{is_tested}{$what} = $when; +} + +#-> sub CPAN::reset_tested +# forget all distributions tested -- resets what gets included in PERL5LIB +sub reset_tested { + my ($self) = @_; + $self->{is_tested} = {}; +} + +#-> sub CPAN::is_installed +# unsets the is_tested flag: as soon as the thing is installed, it is +# not needed in set_perl5lib anymore +sub is_installed { + my($self,$what) = @_; + delete $self->{is_tested}{$what}; +} + +sub _list_sorted_descending_is_tested { + my($self) = @_; + my $foul = 0; + my @sorted = sort + { ($self->{is_tested}{$b}||0) <=> ($self->{is_tested}{$a}||0) } + grep + { if ($foul){ 0 } elsif (-e) { 1 } else { $foul = $_; 0 } } + keys %{$self->{is_tested}}; + if ($foul) { + $CPAN::Frontend->mywarn("Lost build_dir detected ($foul), giving up all cached test results of currently running session.\n"); + for my $dbd (sort keys %{$self->{is_tested}}) { # distro-build-dir + SEARCH: for my $d (sort { $a->id cmp $b->id } $CPAN::META->all_objects("CPAN::Distribution")) { + if ($d->{build_dir} && $d->{build_dir} eq $dbd) { + $CPAN::Frontend->mywarn(sprintf "Flushing cache for %s\n", $d->pretty_id); + $d->fforce(""); + last SEARCH; + } + } + delete $self->{is_tested}{$dbd}; + } + return (); + } else { + return @sorted; + } +} + +#-> sub CPAN::set_perl5lib +# Notes on max environment variable length: +# - Win32 : XP or later, 8191; Win2000 or NT4, 2047 +{ +my $fh; +sub set_perl5lib { + my($self,$for) = @_; + unless ($for) { + (undef,undef,undef,$for) = caller(1); + $for =~ s/.*://; + } + $self->{is_tested} ||= {}; + return unless %{$self->{is_tested}}; + my $env = $ENV{PERL5LIB}; + $env = $ENV{PERLLIB} unless defined $env; + my @env; + push @env, split /\Q$Config::Config{path_sep}\E/, $env if defined $env and length $env; + #my @dirs = map {("$_/blib/arch", "$_/blib/lib")} keys %{$self->{is_tested}}; + #$CPAN::Frontend->myprint("Prepending @dirs to PERL5LIB.\n"); + + my @dirs = map {("$_/blib/arch", "$_/blib/lib")} $self->_list_sorted_descending_is_tested; + return if !@dirs; + + if (@dirs < 12) { + $CPAN::Frontend->optprint('perl5lib', "Prepending @dirs to PERL5LIB for '$for'\n"); + $ENV{PERL5LIB} = join $Config::Config{path_sep}, @dirs, @env; + } elsif (@dirs < 24 ) { + my @d = map {my $cp = $_; + $cp =~ s/^\Q$CPAN::Config->{build_dir}\E/%BUILDDIR%/; + $cp + } @dirs; + $CPAN::Frontend->optprint('perl5lib', "Prepending @d to PERL5LIB; ". + "%BUILDDIR%=$CPAN::Config->{build_dir} ". + "for '$for'\n" + ); + $ENV{PERL5LIB} = join $Config::Config{path_sep}, @dirs, @env; + } else { + my $cnt = keys %{$self->{is_tested}}; + my $newenv = join $Config::Config{path_sep}, @dirs, @env; + $CPAN::Frontend->optprint('perl5lib', sprintf ("Prepending blib/arch and blib/lib of ". + "%d build dirs to PERL5LIB, reaching size %d; ". + "for '%s'\n", $cnt, length($newenv), $for) + ); + $ENV{PERL5LIB} = $newenv; + } +}} + + +1; + + +__END__ + +=head1 NAME + +CPAN - query, download and build perl modules from CPAN sites + +=head1 SYNOPSIS + +Interactive mode: + + perl -MCPAN -e shell + +--or-- + + cpan + +Basic commands: + + # Modules: + + cpan> install Acme::Meta # in the shell + + CPAN::Shell->install("Acme::Meta"); # in perl + + # Distributions: + + cpan> install NWCLARK/Acme-Meta-0.02.tar.gz # in the shell + + CPAN::Shell-> + install("NWCLARK/Acme-Meta-0.02.tar.gz"); # in perl + + # module objects: + + $mo = CPAN::Shell->expandany($mod); + $mo = CPAN::Shell->expand("Module",$mod); # same thing + + # distribution objects: + + $do = CPAN::Shell->expand("Module",$mod)->distribution; + $do = CPAN::Shell->expandany($distro); # same thing + $do = CPAN::Shell->expand("Distribution", + $distro); # same thing + +=head1 DESCRIPTION + +The CPAN module automates or at least simplifies the make and install +of perl modules and extensions. It includes some primitive searching +capabilities and knows how to use LWP, HTTP::Tiny, Net::FTP and certain +external download clients to fetch distributions from the net. + +These are fetched from one or more mirrored CPAN (Comprehensive +Perl Archive Network) sites and unpacked in a dedicated directory. + +The CPAN module also supports named and versioned +I of modules. Bundles simplify handling of sets of +related modules. See Bundles below. + +The package contains a session manager and a cache manager. The +session manager keeps track of what has been fetched, built, and +installed in the current session. The cache manager keeps track of the +disk space occupied by the make processes and deletes excess space +using a simple FIFO mechanism. + +All methods provided are accessible in a programmer style and in an +interactive shell style. + +=head2 CPAN::shell([$prompt, $command]) Starting Interactive Mode + +Enter interactive mode by running + + perl -MCPAN -e shell + +or + + cpan + +which puts you into a readline interface. If C and +either of C or C are installed, +history and command completion are supported. + +Once at the command line, type C for one-page help +screen; the rest should be self-explanatory. + +The function call C takes two optional arguments: one the +prompt, the second the default initial command line (the latter +only works if a real ReadLine interface module is installed). + +The most common uses of the interactive modes are + +=over 2 + +=item Searching for authors, bundles, distribution files and modules + +There are corresponding one-letter commands C, C, C, and C +for each of the four categories and another, C for any of the +mentioned four. Each of the four entities is implemented as a class +with slightly differing methods for displaying an object. + +Arguments to these commands are either strings exactly matching +the identification string of an object, or regular expressions +matched case-insensitively against various attributes of the +objects. The parser only recognizes a regular expression when you +enclose it with slashes. + +The principle is that the number of objects found influences how an +item is displayed. If the search finds one item, the result is +displayed with the rather verbose method C, but if +more than one is found, each object is displayed with the terse method +C. + +Examples: + + cpan> m Acme::MetaSyntactic + Module id = Acme::MetaSyntactic + CPAN_USERID BOOK (Philippe Bruhat (BooK) <[...]>) + CPAN_VERSION 0.99 + CPAN_FILE B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz + UPLOAD_DATE 2006-11-06 + MANPAGE Acme::MetaSyntactic - Themed metasyntactic variables names + INST_FILE /usr/local/lib/perl/5.10.0/Acme/MetaSyntactic.pm + INST_VERSION 0.99 + cpan> a BOOK + Author id = BOOK + EMAIL [...] + FULLNAME Philippe Bruhat (BooK) + cpan> d BOOK/Acme-MetaSyntactic-0.99.tar.gz + Distribution id = B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz + CPAN_USERID BOOK (Philippe Bruhat (BooK) <[...]>) + CONTAINSMODS Acme::MetaSyntactic Acme::MetaSyntactic::Alias [...] + UPLOAD_DATE 2006-11-06 + cpan> m /lorem/ + Module = Acme::MetaSyntactic::loremipsum (BOOK/Acme-MetaSyntactic-0.99.tar.gz) + Module Text::Lorem (ADEOLA/Text-Lorem-0.3.tar.gz) + Module Text::Lorem::More (RKRIMEN/Text-Lorem-More-0.12.tar.gz) + Module Text::Lorem::More::Source (RKRIMEN/Text-Lorem-More-0.12.tar.gz) + cpan> i /berlin/ + Distribution BEATNIK/Filter-NumberLines-0.02.tar.gz + Module = DateTime::TimeZone::Europe::Berlin (DROLSKY/DateTime-TimeZone-0.7904.tar.gz) + Module Filter::NumberLines (BEATNIK/Filter-NumberLines-0.02.tar.gz) + Author [...] + +The examples illustrate several aspects: the first three queries +target modules, authors, or distros directly and yield exactly one +result. The last two use regular expressions and yield several +results. The last one targets all of bundles, modules, authors, and +distros simultaneously. When more than one result is available, they +are printed in one-line format. + +=item C, C, C, C, C modules or distributions + +These commands take any number of arguments and investigate what is +necessary to perform the action. Argument processing is as follows: + + known module name in format Foo/Bar.pm module + other embedded slash distribution + - with trailing slash dot directory + enclosing slashes regexp + known module name in format Foo::Bar module + +If the argument is a distribution file name (recognized by embedded +slashes), it is processed. If it is a module, CPAN determines the +distribution file in which this module is included and processes that, +following any dependencies named in the module's META.yml or +Makefile.PL (this behavior is controlled by the configuration +parameter C). If an argument is enclosed in +slashes it is treated as a regular expression: it is expanded and if +the result is a single object (distribution, bundle or module), this +object is processed. + +Example: + + install Dummy::Perl # installs the module + install AUXXX/Dummy-Perl-3.14.tar.gz # installs that distribution + install /Dummy-Perl-3.14/ # same if the regexp is unambiguous + +C downloads a distribution file and untars or unzips it, C +builds it, C runs the test suite, and C installs it. + +Any C or C is run unconditionally. An + + install + +is also run unconditionally. But for + + install + +CPAN checks whether an install is needed and prints +I if the distribution file containing +the module doesn't need updating. + +CPAN also keeps track of what it has done within the current session +and doesn't try to build a package a second time regardless of whether it +succeeded or not. It does not repeat a test run if the test +has been run successfully before. Same for install runs. + +The C pragma may precede another command (currently: C, +C, C, or C) to execute the command from scratch +and attempt to continue past certain errors. See the section below on +the C and the C pragma. + +The C pragma skips the test part in the build +process. + +Example: + + cpan> notest install Tk + +A C command results in a + + make clean + +being executed within the distribution file's working directory. + +=item C, C, C module or distribution + +C displays the README file of the associated distribution. +C gets and untars (if not yet done) the distribution file, +changes to the appropriate directory and opens a subshell process in +that directory. C displays the module's pod documentation +in html or plain text format. + +=item C author + +=item C globbing_expression + +The first form lists all distribution files in and below an author's +CPAN directory as stored in the CHECKSUMS files distributed on +CPAN. The listing recurses into subdirectories. + +The second form limits or expands the output with shell +globbing as in the following examples: + + ls JV/make* + ls GSAR/*make* + ls */*make* + +The last example is very slow and outputs extra progress indicators +that break the alignment of the result. + +Note that globbing only lists directories explicitly asked for, for +example FOO/* will not list FOO/bar/Acme-Sthg-n.nn.tar.gz. This may be +regarded as a bug that may be changed in some future version. + +=item C + +The C command reports all distributions that failed on one of +C, C or C for some reason in the currently +running shell session. + +=item Persistence between sessions + +If the C or the C module is installed a record of +the internal state of all modules is written to disk after each step. +The files contain a signature of the currently running perl version +for later perusal. + +If the configurations variable C is set to a true +value, then CPAN.pm reads the collected YAML files. If the stored +signature matches the currently running perl, the stored state is +loaded into memory such that persistence between sessions +is effectively established. + +=item The C and the C pragma + +To speed things up in complex installation scenarios, CPAN.pm keeps +track of what it has already done and refuses to do some things a +second time. A C, a C, and an C are not repeated. +A C is repeated only if the previous test was unsuccessful. The +diagnostic message when CPAN.pm refuses to do something a second time +is one of IC or +something similar. Another situation where CPAN refuses to act is an +C if the corresponding C was not successful. + +In all these cases, the user can override this stubborn behaviour by +prepending the command with the word force, for example: + + cpan> force get Foo + cpan> force make AUTHOR/Bar-3.14.tar.gz + cpan> force test Baz + cpan> force install Acme::Meta + +Each I command is executed with the corresponding part of its +memory erased. + +The C pragma is a variant that emulates a C which +erases the entire memory followed by the action specified, effectively +restarting the whole get/make/test/install procedure from scratch. + +=item Lockfile + +Interactive sessions maintain a lockfile, by default C<~/.cpan/.lock>. +Batch jobs can run without a lockfile and not disturb each other. + +The shell offers to run in I when another process is +holding the lockfile. This is an experimental feature that is not yet +tested very well. This second shell then does not write the history +file, does not use the metadata file, and has a different prompt. + +=item Signals + +CPAN.pm installs signal handlers for SIGINT and SIGTERM. While you are +in the cpan-shell, it is intended that you can press C<^C> anytime and +return to the cpan-shell prompt. A SIGTERM will cause the cpan-shell +to clean up and leave the shell loop. You can emulate the effect of a +SIGTERM by sending two consecutive SIGINTs, which usually means by +pressing C<^C> twice. + +CPAN.pm ignores SIGPIPE. If the user sets C, a +SIGALRM is used during the run of the C or C subprocess. A SIGALRM is also used during module version +parsing, and is controlled by C. + +=back + +=head2 CPAN::Shell + +The commands available in the shell interface are methods in +the package CPAN::Shell. If you enter the shell command, your +input is split by the Text::ParseWords::shellwords() routine, which +acts like most shells do. The first word is interpreted as the +method to be invoked, and the rest of the words are treated as the method's arguments. +Continuation lines are supported by ending a line with a +literal backslash. + +=head2 autobundle + +C writes a bundle file into the +C<$CPAN::Config-E{cpan_home}/Bundle> directory. The file contains +a list of all modules that are both available from CPAN and currently +installed within @INC. Duplicates of each distribution are suppressed. +The name of the bundle file is based on the current date and a +counter, e.g. F. This is installed +again by running C, or installing +C from the CPAN shell. + +Return value: path to the written file. + +=head2 hosts + +Note: this feature is still in alpha state and may change in future +versions of CPAN.pm + +This commands provides a statistical overview over recent download +activities. The data for this is collected in the YAML file +C in your C directory. If no YAML module is +configured or YAML not installed, no stats are provided. + +=over + +=item install_tested + +Install all distributions that have been tested successfully but have +not yet been installed. See also C. + +=item is_tested + +List all build directories of distributions that have been tested +successfully but have not yet been installed. See also +C. + +=back + +=head2 mkmyconfig + +mkmyconfig() writes your own CPAN::MyConfig file into your C<~/.cpan/> +directory so that you can save your own preferences instead of the +system-wide ones. + +=head2 r [Module|/Regexp/]... + +scans current perl installation for modules that have a newer version +available on CPAN and provides a list of them. If called without +argument, all potential upgrades are listed; if called with arguments +the list is filtered to the modules and regexps given as arguments. + +The listing looks something like this: + + Package namespace installed latest in CPAN file + CPAN 1.94_64 1.9600 ANDK/CPAN-1.9600.tar.gz + CPAN::Reporter 1.1801 1.1902 DAGOLDEN/CPAN-Reporter-1.1902.tar.gz + YAML 0.70 0.73 INGY/YAML-0.73.tar.gz + YAML::Syck 1.14 1.17 AVAR/YAML-Syck-1.17.tar.gz + YAML::Tiny 1.44 1.50 ADAMK/YAML-Tiny-1.50.tar.gz + CGI 3.43 3.55 MARKSTOS/CGI.pm-3.55.tar.gz + Module::Build::YAML 1.40 1.41 DAGOLDEN/Module-Build-0.3800.tar.gz + TAP::Parser::Result::YAML 3.22 3.23 ANDYA/Test-Harness-3.23.tar.gz + YAML::XS 0.34 0.35 INGY/YAML-LibYAML-0.35.tar.gz + +It suppresses duplicates in the column C such that +distributions with many upgradeable modules are listed only once. + +Note that the list is not sorted. + +=head2 recent ***EXPERIMENTAL COMMAND*** + +The C command downloads a list of recent uploads to CPAN and +displays them I. While the command is running, a $SIG{INT} +exits the loop after displaying the current item. + +B: This command requires XML::LibXML installed. + +B: This whole command currently is just a hack and will +probably change in future versions of CPAN.pm, but the general +approach will likely remain. + +B: See also L + +=head2 recompile + +recompile() is a special command that takes no argument and +runs the make/test/install cycle with brute force over all installed +dynamically loadable extensions (a.k.a. XS modules) with 'force' in +effect. The primary purpose of this command is to finish a network +installation. Imagine you have a common source tree for two different +architectures. You decide to do a completely independent fresh +installation. You start on one architecture with the help of a Bundle +file produced earlier. CPAN installs the whole Bundle for you, but +when you try to repeat the job on the second architecture, CPAN +responds with a C<"Foo up to date"> message for all modules. So you +invoke CPAN's recompile on the second architecture and you're done. + +Another popular use for C is to act as a rescue in case your +perl breaks binary compatibility. If one of the modules that CPAN uses +is in turn depending on binary compatibility (so you cannot run CPAN +commands), then you should try the CPAN::Nox module for recovery. + +=head2 report Bundle|Distribution|Module + +The C command temporarily turns on the C config +variable, then runs the C command with the given +arguments. The C pragma reruns the tests and repeats +every step that might have failed before. + +=head2 smoke ***EXPERIMENTAL COMMAND*** + +B<*** WARNING: this command downloads and executes software from CPAN to +your computer of completely unknown status. You should never do +this with your normal account and better have a dedicated well +separated and secured machine to do this. ***> + +The C command takes the list of recent uploads to CPAN as +provided by the C command and tests them all. While the +command is running $SIG{INT} is defined to mean that the current item +shall be skipped. + +B: This whole command currently is just a hack and will +probably change in future versions of CPAN.pm, but the general +approach will likely remain. + +B: See also L + +=head2 upgrade [Module|/Regexp/]... + +The C command first runs an C command with the given +arguments and then installs the newest versions of all modules that +were listed by that. + +=head2 The four C Classes: Author, Bundle, Module, Distribution + +Although it may be considered internal, the class hierarchy does matter +for both users and programmer. CPAN.pm deals with the four +classes mentioned above, and those classes all share a set of methods. Classical +single polymorphism is in effect. A metaclass object registers all +objects of all kinds and indexes them with a string. The strings +referencing objects have a separated namespace (well, not completely +separated): + + Namespace Class + + words containing a "/" (slash) Distribution + words starting with Bundle:: Bundle + everything else Module or Author + +Modules know their associated Distribution objects. They always refer +to the most recent official release. Developers may mark their releases +as unstable development versions (by inserting an underscore into the +module version number which will also be reflected in the distribution +name when you run 'make dist'), so the really hottest and newest +distribution is not always the default. If a module Foo circulates +on CPAN in both version 1.23 and 1.23_90, CPAN.pm offers a convenient +way to install version 1.23 by saying + + install Foo + +This would install the complete distribution file (say +BAR/Foo-1.23.tar.gz) with all accompanying material. But if you would +like to install version 1.23_90, you need to know where the +distribution file resides on CPAN relative to the authors/id/ +directory. If the author is BAR, this might be BAR/Foo-1.23_90.tar.gz; +so you would have to say + + install BAR/Foo-1.23_90.tar.gz + +The first example will be driven by an object of the class +CPAN::Module, the second by an object of class CPAN::Distribution. + +=head2 Integrating local directories + +Note: this feature is still in alpha state and may change in future +versions of CPAN.pm + +Distribution objects are normally distributions from the CPAN, but +there is a slightly degenerate case for Distribution objects, too, of +projects held on the local disk. These distribution objects have the +same name as the local directory and end with a dot. A dot by itself +is also allowed for the current directory at the time CPAN.pm was +used. All actions such as C, C, and C are applied +directly to that directory. This gives the command C an +interesting touch: while the normal mantra of installing a CPAN module +without CPAN.pm is one of + + perl Makefile.PL perl Build.PL + ( go and get prerequisites ) + make ./Build + make test ./Build test + make install ./Build install + +the command C does all of this at once. It figures out which +of the two mantras is appropriate, fetches and installs all +prerequisites, takes care of them recursively, and finally finishes the +installation of the module in the current directory, be it a CPAN +module or not. + +The typical usage case is for private modules or working copies of +projects from remote repositories on the local disk. + +=head2 Redirection + +The usual shell redirection symbols C< | > and C<< > >> are recognized +by the cpan shell B. So piping to +pager or redirecting output into a file works somewhat as in a normal +shell, with the stipulation that you must type extra spaces. + +=head2 Plugin support ***EXPERIMENTAL*** + +Plugins are objects that implement any of currently eight methods: + + pre_get + post_get + pre_make + post_make + pre_test + post_test + pre_install + post_install + +The C configuration parameter holds a list of strings of +the form + + Modulename=arg0,arg1,arg2,arg3,... + +eg: + + CPAN::Plugin::Flurb=dir,/opt/pkgs/flurb/raw,verbose,1 + +At run time, each listed plugin is instantiated as a singleton object +by running the equivalent of this pseudo code: + + my $plugin = ; + ; + my $p = $instance{$plugin} ||= Modulename->new($arg0,$arg1,...); + +The generated singletons are kept around from instantiation until the +end of the shell session. can be reconfigured at any +time at run time. While the cpan shell is running, it checks all +activated plugins at each of the 8 reference points listed above and +runs the respective method if it is implemented for that object. The +method is called with the active CPAN::Distribution object passed in +as an argument. + +=head1 CONFIGURATION + +When the CPAN module is used for the first time, a configuration +dialogue tries to determine a couple of site specific options. The +result of the dialog is stored in a hash reference C< $CPAN::Config > +in a file CPAN/Config.pm. + +Default values defined in the CPAN/Config.pm file can be +overridden in a user specific file: CPAN/MyConfig.pm. Such a file is +best placed in C<$HOME/.cpan/CPAN/MyConfig.pm>, because C<$HOME/.cpan> is +added to the search path of the CPAN module before the use() or +require() statements. The mkmyconfig command writes this file for you. + +The C command has various bells and whistles: + +=over + +=item completion support + +If you have a ReadLine module installed, you can hit TAB at any point +of the commandline and C will offer you completion for the +built-in subcommands and/or config variable names. + +=item displaying some help: o conf help + +Displays a short help + +=item displaying current values: o conf [KEY] + +Displays the current value(s) for this config variable. Without KEY, +displays all subcommands and config variables. + +Example: + + o conf shell + +If KEY starts and ends with a slash, the string in between is +treated as a regular expression and only keys matching this regexp +are displayed + +Example: + + o conf /color/ + +=item changing of scalar values: o conf KEY VALUE + +Sets the config variable KEY to VALUE. The empty string can be +specified as usual in shells, with C<''> or C<""> + +Example: + + o conf wget /usr/bin/wget + +=item changing of list values: o conf KEY SHIFT|UNSHIFT|PUSH|POP|SPLICE|LIST + +If a config variable name ends with C, it is a list. C removes the first element of the list, C +removes the last element of the list. C +prepends a list of values to the list, C +appends a list of valued to the list. + +Likewise, C passes the LIST to the corresponding +splice command. + +Finally, any other list of arguments is taken as a new list value for +the KEY variable discarding the previous value. + +Examples: + + o conf urllist unshift http://cpan.dev.local/CPAN + o conf urllist splice 3 1 + o conf urllist http://cpan1.local http://cpan2.local ftp://ftp.perl.org + +=item reverting to saved: o conf defaults + +Reverts all config variables to the state in the saved config file. + +=item saving the config: o conf commit + +Saves all config variables to the current config file (CPAN/Config.pm +or CPAN/MyConfig.pm that was loaded at start). + +=back + +The configuration dialog can be started any time later again by +issuing the command C< o conf init > in the CPAN shell. A subset of +the configuration dialog can be run by issuing C +where WORD is any valid config variable or a regular expression. + +=head2 Config Variables + +The following keys in the hash reference $CPAN::Config are +currently defined: + + allow_installing_module_downgrades + allow or disallow installing module downgrades + allow_installing_outdated_dists + allow or disallow installing modules that are + indexed in the cpan index pointing to a distro + with a higher distro-version number + applypatch path to external prg + auto_commit commit all changes to config variables to disk + build_cache size of cache for directories to build modules + build_dir locally accessible directory to build modules + build_dir_reuse boolean if distros in build_dir are persistent + build_requires_install_policy + to install or not to install when a module is + only needed for building. yes|no|ask/yes|ask/no + bzip2 path to external prg + cache_metadata use serializer to cache metadata + check_sigs if signatures should be verified + cleanup_after_install + remove build directory immediately after a + successful install and remember that for the + duration of the session + colorize_debug Term::ANSIColor attributes for debugging output + colorize_output boolean if Term::ANSIColor should colorize output + colorize_print Term::ANSIColor attributes for normal output + colorize_warn Term::ANSIColor attributes for warnings + commandnumber_in_prompt + boolean if you want to see current command number + commands_quote preferred character to use for quoting external + commands when running them. Defaults to double + quote on Windows, single tick everywhere else; + can be set to space to disable quoting + connect_to_internet_ok + whether to ask if opening a connection is ok before + urllist is specified + cpan_home local directory reserved for this package + curl path to external prg + dontload_hash DEPRECATED + dontload_list arrayref: modules in the list will not be + loaded by the CPAN::has_inst() routine + ftp path to external prg + ftp_passive if set, the environment variable FTP_PASSIVE is set + for downloads + ftp_proxy proxy host for ftp requests + ftpstats_period max number of days to keep download statistics + ftpstats_size max number of items to keep in the download statistics + getcwd see below + gpg path to external prg + gzip location of external program gzip + halt_on_failure stop processing after the first failure of queued + items or dependencies + histfile file to maintain history between sessions + histsize maximum number of lines to keep in histfile + http_proxy proxy host for http requests + inactivity_timeout breaks interactive Makefile.PLs or Build.PLs + after this many seconds inactivity. Set to 0 to + disable timeouts. + index_expire refetch index files after this many days + inhibit_startup_message + if true, suppress the startup message + keep_source_where directory in which to keep the source (if we do) + load_module_verbosity + report loading of optional modules used by CPAN.pm + lynx path to external prg + make location of external make program + make_arg arguments that should always be passed to 'make' + make_install_make_command + the make command for running 'make install', for + example 'sudo make' + make_install_arg same as make_arg for 'make install' + makepl_arg arguments passed to 'perl Makefile.PL' + mbuild_arg arguments passed to './Build' + mbuild_install_arg arguments passed to './Build install' + mbuild_install_build_command + command to use instead of './Build' when we are + in the install stage, for example 'sudo ./Build' + mbuildpl_arg arguments passed to 'perl Build.PL' + ncftp path to external prg + ncftpget path to external prg + no_proxy don't proxy to these hosts/domains (comma separated list) + pager location of external program more (or any pager) + password your password if you CPAN server wants one + patch path to external prg + patches_dir local directory containing patch files + perl5lib_verbosity verbosity level for PERL5LIB additions + plugin_list list of active hooks (see Plugin support above + and the CPAN::Plugin module) + prefer_external_tar + per default all untar operations are done with + Archive::Tar; by setting this variable to true + the external tar command is used if available + prefer_installer legal values are MB and EUMM: if a module comes + with both a Makefile.PL and a Build.PL, use the + former (EUMM) or the latter (MB); if the module + comes with only one of the two, that one will be + used no matter the setting + prerequisites_policy + what to do if you are missing module prerequisites + ('follow' automatically, 'ask' me, or 'ignore') + For 'follow', also sets PERL_AUTOINSTALL and + PERL_EXTUTILS_AUTOINSTALL for "--defaultdeps" if + not already set + prefs_dir local directory to store per-distro build options + proxy_user username for accessing an authenticating proxy + proxy_pass password for accessing an authenticating proxy + randomize_urllist add some randomness to the sequence of the urllist + recommends_policy whether recommended prerequisites should be included + scan_cache controls scanning of cache ('atstart', 'atexit' or 'never') + shell your favorite shell + show_unparsable_versions + boolean if r command tells which modules are versionless + show_upload_date boolean if commands should try to determine upload date + show_zero_versions boolean if r command tells for which modules $version==0 + suggests_policy whether suggested prerequisites should be included + tar location of external program tar + tar_verbosity verbosity level for the tar command + term_is_latin deprecated: if true Unicode is translated to ISO-8859-1 + (and nonsense for characters outside latin range) + term_ornaments boolean to turn ReadLine ornamenting on/off + test_report email test reports (if CPAN::Reporter is installed) + trust_test_report_history + skip testing when previously tested ok (according to + CPAN::Reporter history) + unzip location of external program unzip + urllist arrayref to nearby CPAN sites (or equivalent locations) + urllist_ping_external + use external ping command when autoselecting mirrors + urllist_ping_verbose + increase verbosity when autoselecting mirrors + use_prompt_default set PERL_MM_USE_DEFAULT for configure/make/test/install + use_sqlite use CPAN::SQLite for metadata storage (fast and lean) + username your username if you CPAN server wants one + version_timeout stops version parsing after this many seconds. + Default is 15 secs. Set to 0 to disable. + wait_list arrayref to a wait server to try (See CPAN::WAIT) + wget path to external prg + yaml_load_code enable YAML code deserialisation via CPAN::DeferredCode + yaml_module which module to use to read/write YAML files + +You can set and query each of these options interactively in the cpan +shell with the C or the C command as specified below. + +=over 2 + +=item Cscalar optionE> + +prints the current value of the I + +=item Cscalar optionE EvalueE> + +Sets the value of the I to I + +=item Clist optionE> + +prints the current value of the I in MakeMaker's +neatvalue format. + +=item Clist optionE [shift|pop]> + +shifts or pops the array in the I variable + +=item Clist optionE [unshift|push|splice] ElistE> + +works like the corresponding perl commands. + +=item interactive editing: o conf init [MATCH|LIST] + +Runs an interactive configuration dialog for matching variables. +Without argument runs the dialog over all supported config variables. +To specify a MATCH the argument must be enclosed by slashes. + +Examples: + + o conf init ftp_passive ftp_proxy + o conf init /color/ + +Note: this method of setting config variables often provides more +explanation about the functioning of a variable than the manpage. + +=back + +=head2 CPAN::anycwd($path): Note on config variable getcwd + +CPAN.pm changes the current working directory often and needs to +determine its own current working directory. By default it uses +Cwd::cwd, but if for some reason this doesn't work on your system, +configure alternatives according to the following table: + +=over 4 + +=item cwd + +Calls Cwd::cwd + +=item getcwd + +Calls Cwd::getcwd + +=item fastcwd + +Calls Cwd::fastcwd + +=item getdcwd + +Calls Cwd::getdcwd + +=item backtickcwd + +Calls the external command cwd. + +=back + +=head2 Note on the format of the urllist parameter + +urllist parameters are URLs according to RFC 1738. We do a little +guessing if your URL is not compliant, but if you have problems with +C URLs, please try the correct format. Either: + + file://localhost/whatever/ftp/pub/CPAN/ + +or + + file:///home/ftp/pub/CPAN/ + +=head2 The urllist parameter has CD-ROM support + +The C parameter of the configuration table contains a list of +URLs used for downloading. If the list contains any +C URLs, CPAN always tries there first. This +feature is disabled for index files. So the recommendation for the +owner of a CD-ROM with CPAN contents is: include your local, possibly +outdated CD-ROM as a C URL at the end of urllist, e.g. + + o conf urllist push file://localhost/CDROM/CPAN + +CPAN.pm will then fetch the index files from one of the CPAN sites +that come at the beginning of urllist. It will later check for each +module to see whether there is a local copy of the most recent version. + +Another peculiarity of urllist is that the site that we could +successfully fetch the last file from automatically gets a preference +token and is tried as the first site for the next request. So if you +add a new site at runtime it may happen that the previously preferred +site will be tried another time. This means that if you want to disallow +a site for the next transfer, it must be explicitly removed from +urllist. + +=head2 Maintaining the urllist parameter + +If you have YAML.pm (or some other YAML module configured in +C) installed, CPAN.pm collects a few statistical data +about recent downloads. You can view the statistics with the C +command or inspect them directly by looking into the C +file in your C directory. + +To get some interesting statistics, it is recommended that +C be set; this introduces some amount of +randomness into the URL selection. + +=head2 The C and C dependency declarations + +Since CPAN.pm version 1.88_51 modules declared as C by +a distribution are treated differently depending on the config +variable C. By setting +C to C, such a module is not +installed. It is only built and tested, and then kept in the list of +tested but uninstalled modules. As such, it is available during the +build of the dependent module by integrating the path to the +C and C directories in the environment variable +PERL5LIB. If C is set to C, then +both modules declared as C and those declared as +C are treated alike. By setting to C or +C, CPAN.pm asks the user and sets the default accordingly. + +=head2 Configuration of the allow_installing_* parameters + +The C parameters are evaluated during +the C phase. If set to C, they allow the testing and the installation of +the current distro and otherwise have no effect. If set to C, they +may abort the build (preventing testing and installing), depending on the contents of the +C directory. The C directory is the directory that holds +all the files that would usually be installed in the C phase. + +C compares the C directory with the CPAN index. +If it finds something there that belongs, according to the index, to a different +dist, it aborts the current build. + +C compares the C directory +with already installed modules, actually their version numbers, as +determined by ExtUtils::MakeMaker or equivalent. If a to-be-installed +module would downgrade an already installed module, the current build +is aborted. + +An interesting twist occurs when a distroprefs document demands the +installation of an outdated dist via goto while +C forbids it. Without additional +provisions, this would let the C +win and the distroprefs lose. So the proper arrangement in such a case +is to write a second distroprefs document for the distro that C +points to and overrule the C there. E.g.: + + --- + match: + distribution: "^MAUKE/Keyword-Simple-0.04.tar.gz" + goto: "MAUKE/Keyword-Simple-0.03.tar.gz" + --- + match: + distribution: "^MAUKE/Keyword-Simple-0.03.tar.gz" + cpanconfig: + allow_installing_outdated_dists: yes + +=head2 Configuration for individual distributions (I) + +(B This feature has been introduced in CPAN.pm 1.8854) + +Distributions on CPAN usually behave according to what we call the +CPAN mantra. Or since the advent of Module::Build we should talk about +two mantras: + + perl Makefile.PL perl Build.PL + make ./Build + make test ./Build test + make install ./Build install + +But some modules cannot be built with this mantra. They try to get +some extra data from the user via the environment, extra arguments, or +interactively--thus disturbing the installation of large bundles like +Phalanx100 or modules with many dependencies like Plagger. + +The distroprefs system of C addresses this problem by +allowing the user to specify extra informations and recipes in YAML +files to either + +=over + +=item + +pass additional arguments to one of the four commands, + +=item + +set environment variables + +=item + +instantiate an Expect object that reads from the console, waits for +some regular expressions and enters some answers + +=item + +temporarily override assorted C configuration variables + +=item + +specify dependencies the original maintainer forgot + +=item + +disable the installation of an object altogether + +=back + +See the YAML and Data::Dumper files that come with the C +distribution in the C directory for examples. + +=head2 Filenames + +The YAML files themselves must have the C<.yml> extension; all other +files are ignored (for two exceptions see I below). The containing directory can be specified in +C in the C config variable. Try C in the CPAN shell to set and activate the distroprefs +system. + +Every YAML file may contain arbitrary documents according to the YAML +specification, and every document is treated as an entity that +can specify the treatment of a single distribution. + +Filenames can be picked arbitrarily; C always reads +all files (in alphabetical order) and takes the key C (see +below in I) as a hashref containing match criteria +that determine if the current distribution matches the YAML document +or not. + +=head2 Fallback Data::Dumper and Storable + +If neither your configured C nor YAML.pm is installed, +CPAN.pm falls back to using Data::Dumper and Storable and looks for +files with the extensions C<.dd> or C<.st> in the C +directory. These files are expected to contain one or more hashrefs. +For Data::Dumper generated files, this is expected to be done with by +defining C<$VAR1>, C<$VAR2>, etc. The YAML shell would produce these +with the command + + ysh < somefile.yml > somefile.dd + +For Storable files the rule is that they must be constructed such that +C returns an array reference and the array +elements represent one distropref object each. The conversion from +YAML would look like so: + + perl -MYAML=LoadFile -MStorable=nstore -e ' + @y=LoadFile(shift); + nstore(\@y, shift)' somefile.yml somefile.st + +In bootstrapping situations it is usually sufficient to translate only +a few YAML files to Data::Dumper for crucial modules like +C, C and C. If you prefer Storable +over Data::Dumper, remember to pull out a Storable version that writes +an older format than all the other Storable versions that will need to +read them. + +=head2 Blueprint + +The following example contains all supported keywords and structures +with the exception of C which can be used instead of +C. + + --- + comment: "Demo" + match: + module: "Dancing::Queen" + distribution: "^CHACHACHA/Dancing-" + not_distribution: "\.zip$" + perl: "/usr/local/cariba-perl/bin/perl" + perlconfig: + archname: "freebsd" + not_cc: "gcc" + env: + DANCING_FLOOR: "Shubiduh" + disabled: 1 + cpanconfig: + make: gmake + pl: + args: + - "--somearg=specialcase" + + env: {} + + expect: + - "Which is your favorite fruit" + - "apple\n" + + make: + args: + - all + - extra-all + + env: {} + + expect: [] + + commandline: "echo SKIPPING make" + + test: + args: [] + + env: {} + + expect: [] + + install: + args: [] + + env: + WANT_TO_INSTALL: YES + + expect: + - "Do you really want to install" + - "y\n" + + patches: + - "ABCDE/Fedcba-3.14-ABCDE-01.patch" + + depends: + configure_requires: + LWP: 5.8 + build_requires: + Test::Exception: 0.25 + requires: + Spiffy: 0.30 + + +=head2 Language Specs + +Every YAML document represents a single hash reference. The valid keys +in this hash are as follows: + +=over + +=item comment [scalar] + +A comment + +=item cpanconfig [hash] + +Temporarily override assorted C configuration variables. + +Supported are: C, C, +C, C, C, +C. Please report as a bug when you need another one +supported. + +=item depends [hash] *** EXPERIMENTAL FEATURE *** + +All three types, namely C, C, and +C are supported in the way specified in the META.yml +specification. The current implementation I the specified +dependencies with those declared by the package maintainer. In a +future implementation this may be changed to override the original +declaration. + +=item disabled [boolean] + +Specifies that this distribution shall not be processed at all. + +=item features [array] *** EXPERIMENTAL FEATURE *** + +Experimental implementation to deal with optional_features from +META.yml. Still needs coordination with installer software and +currently works only for META.yml declaring C. Use +with caution. + +=item goto [string] + +The canonical name of a delegate distribution to install +instead. Useful when a new version, although it tests OK itself, +breaks something else or a developer release or a fork is already +uploaded that is better than the last released version. + +=item install [hash] + +Processing instructions for the C or C<./Build install> +phase of the CPAN mantra. See below under I. + +=item make [hash] + +Processing instructions for the C or C<./Build> phase of the +CPAN mantra. See below under I. + +=item match [hash] + +A hashref with one or more of the keys C, C, +C, C, and C that specify whether a document is +targeted at a specific CPAN distribution or installation. +Keys prefixed with C negates the corresponding match. + +The corresponding values are interpreted as regular expressions. The +C related one will be matched against the canonical +distribution name, e.g. "AUTHOR/Foo-Bar-3.14.tar.gz". + +The C related one will be matched against I modules +contained in the distribution until one module matches. + +The C related one will be matched against C<$^X> (but with the +absolute path). + +The value associated with C is itself a hashref that is +matched against corresponding values in the C<%Config::Config> hash +living in the C module. +Keys prefixed with C negates the corresponding match. + +The value associated with C is itself a hashref that is +matched against corresponding values in the C<%ENV> hash. +Keys prefixed with C negates the corresponding match. + +If more than one restriction of C, C, etc. is +specified, the results of the separately computed match values must +all match. If so, the hashref represented by the +YAML document is returned as the preference structure for the current +distribution. + +=item patches [array] + +An array of patches on CPAN or on the local disk to be applied in +order via an external patch program. If the value for the C<-p> +parameter is C<0> or C<1> is determined by reading the patch +beforehand. The path to each patch is either an absolute path on the +local filesystem or relative to a patch directory specified in the +C configuration variable or in the format of a canonical +distro name. For examples please consult the distroprefs/ directory in +the CPAN.pm distribution (these examples are not installed by +default). + +Note: if the C program is installed and C +knows about it B a patch is written by the C program, +then C lets C apply the patch. Both C +and C are available from CPAN in the C +distribution. + +=item pl [hash] + +Processing instructions for the C or C phase of the CPAN mantra. See below under I. + +=item test [hash] + +Processing instructions for the C or C<./Build test> phase +of the CPAN mantra. See below under I. + +=back + +=head2 Processing Instructions + +=over + +=item args [array] + +Arguments to be added to the command line + +=item commandline + +A full commandline to run via C. +During execution, the environment variable PERL is set +to $^X (but with an absolute path). If C is specified, +C is not used. + +=item eexpect [hash] + +Extended C. This is a hash reference with four allowed keys, +C, C, C, and C. + +You must install the C module to use C. CPAN.pm +does not install it for you. + +C may have the values C for the case where all +questions come in the order written down and C for the case +where the questions may come in any order. The default mode is +C. + +C denotes a timeout in seconds. Floating-point timeouts are +OK. With C, the timeout denotes the +timeout per question; with C it denotes the +timeout per byte received from the stream or questions. + +C is a reference to an array that contains alternating questions +and answers. Questions are regular expressions and answers are literal +strings. The Expect module watches the stream from the +execution of the external program (C, C, C, etc.). + +For C, the CPAN.pm injects the +corresponding answer as soon as the stream matches the regular expression. + +For C CPAN.pm answers a question as soon +as the timeout is reached for the next byte in the input stream. In +this mode you can use the C parameter to decide what will +happen with a question-answer pair after it has been used. In the +default case (reuse=0) it is removed from the array, avoiding being +used again accidentally. If you want to answer the +question C several times, then it must +be included in the array at least as often as you want this answer to +be given. Setting the parameter C to 1 makes this repetition +unnecessary. + +=item env [hash] + +Environment variables to be set during the command + +=item expect [array] + +You must install the C module to use C. CPAN.pm +does not install it for you. + +C<< expect: >> is a short notation for this C: + + eexpect: + mode: deterministic + timeout: 15 + talk: + +=back + +=head2 Schema verification with C + +If you have the C module installed (which is part of the +Bundle::CPANxxl), then all your distroprefs files are checked for +syntactic correctness. + +=head2 Example Distroprefs Files + +C comes with a collection of example YAML files. Note that these +are really just examples and should not be used without care because +they cannot fit everybody's purpose. After all, the authors of the +packages that ask questions had a need to ask, so you should watch +their questions and adjust the examples to your environment and your +needs. You have been warned:-) + +=head1 PROGRAMMER'S INTERFACE + +If you do not enter the shell, shell commands are +available both as methods (Cinstall(...)>) and as +functions in the calling package (C). Before calling low-level +commands, it makes sense to initialize components of CPAN you need, e.g.: + + CPAN::HandleConfig->load; + CPAN::Shell::setup_output; + CPAN::Index->reload; + +High-level commands do such initializations automatically. + +There's currently only one class that has a stable interface - +CPAN::Shell. All commands that are available in the CPAN shell are +methods of the class CPAN::Shell. The arguments on the commandline are +passed as arguments to the method. + +So if you take for example the shell command + + notest install A B C + +the actually executed command is + + CPAN::Shell->notest("install","A","B","C"); + +Each of the commands that produce listings of modules (C, +C, C) also return a list of the IDs of all modules +within the list. + +=over 2 + +=item expand($type,@things) + +The IDs of all objects available within a program are strings that can +be expanded to the corresponding real objects with the +Cexpand("Module",@things)> method. Expand returns a +list of CPAN::Module objects according to the C<@things> arguments +given. In scalar context, it returns only the first element of the +list. + +=item expandany(@things) + +Like expand, but returns objects of the appropriate type, i.e. +CPAN::Bundle objects for bundles, CPAN::Module objects for modules, and +CPAN::Distribution objects for distributions. Note: it does not expand +to CPAN::Author objects. + +=item Programming Examples + +This enables the programmer to do operations that combine +functionalities that are available in the shell. + + # install everything that is outdated on my disk: + perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)' + + # install my favorite programs if necessary: + for $mod (qw(Net::FTP Digest::SHA Data::Dumper)) { + CPAN::Shell->install($mod); + } + + # list all modules on my disk that have no VERSION number + for $mod (CPAN::Shell->expand("Module","/./")) { + next unless $mod->inst_file; + # MakeMaker convention for undefined $VERSION: + next unless $mod->inst_version eq "undef"; + print "No VERSION in ", $mod->id, "\n"; + } + + # find out which distribution on CPAN contains a module: + print CPAN::Shell->expand("Module","Apache::Constants")->cpan_file + +Or if you want to schedule a I job to watch CPAN, you could list +all modules that need updating. First a quick and dirty way: + + perl -e 'use CPAN; CPAN::Shell->r;' + +If you don't want any output should all modules be +up to date, parse the output of above command for the regular +expression C and decide to mail the output +only if it doesn't match. + +If you prefer to do it more in a programmerish style in one single +process, something like this may better suit you: + + # list all modules on my disk that have newer versions on CPAN + for $mod (CPAN::Shell->expand("Module","/./")) { + next unless $mod->inst_file; + next if $mod->uptodate; + printf "Module %s is installed as %s, could be updated to %s from CPAN\n", + $mod->id, $mod->inst_version, $mod->cpan_version; + } + +If that gives too much output every day, you may want to +watch only for three modules. You can write + + for $mod (CPAN::Shell->expand("Module","/Apache|LWP|CGI/")) { + +as the first line instead. Or you can combine some of the above +tricks: + + # watch only for a new mod_perl module + $mod = CPAN::Shell->expand("Module","mod_perl"); + exit if $mod->uptodate; + # new mod_perl arrived, let me know all update recommendations + CPAN::Shell->r; + +=back + +=head2 Methods in the other Classes + +=over 4 + +=item CPAN::Author::as_glimpse() + +Returns a one-line description of the author + +=item CPAN::Author::as_string() + +Returns a multi-line description of the author + +=item CPAN::Author::email() + +Returns the author's email address + +=item CPAN::Author::fullname() + +Returns the author's name + +=item CPAN::Author::name() + +An alias for fullname + +=item CPAN::Bundle::as_glimpse() + +Returns a one-line description of the bundle + +=item CPAN::Bundle::as_string() + +Returns a multi-line description of the bundle + +=item CPAN::Bundle::clean() + +Recursively runs the C method on all items contained in the bundle. + +=item CPAN::Bundle::contains() + +Returns a list of objects' IDs contained in a bundle. The associated +objects may be bundles, modules or distributions. + +=item CPAN::Bundle::force($method,@args) + +Forces CPAN to perform a task that it normally would have refused to +do. Force takes as arguments a method name to be called and any number +of additional arguments that should be passed to the called method. +The internals of the object get the needed changes so that CPAN.pm +does not refuse to take the action. The C is passed recursively +to all contained objects. See also the section above on the C +and the C pragma. + +=item CPAN::Bundle::get() + +Recursively runs the C method on all items contained in the bundle + +=item CPAN::Bundle::inst_file() + +Returns the highest installed version of the bundle in either @INC or +C<< $CPAN::Config->{cpan_home} >>. Note that this is different from +CPAN::Module::inst_file. + +=item CPAN::Bundle::inst_version() + +Like CPAN::Bundle::inst_file, but returns the $VERSION + +=item CPAN::Bundle::uptodate() + +Returns 1 if the bundle itself and all its members are up-to-date. + +=item CPAN::Bundle::install() + +Recursively runs the C method on all items contained in the bundle + +=item CPAN::Bundle::make() + +Recursively runs the C method on all items contained in the bundle + +=item CPAN::Bundle::readme() + +Recursively runs the C method on all items contained in the bundle + +=item CPAN::Bundle::test() + +Recursively runs the C method on all items contained in the bundle + +=item CPAN::Distribution::as_glimpse() + +Returns a one-line description of the distribution + +=item CPAN::Distribution::as_string() + +Returns a multi-line description of the distribution + +=item CPAN::Distribution::author + +Returns the CPAN::Author object of the maintainer who uploaded this +distribution + +=item CPAN::Distribution::pretty_id() + +Returns a string of the form "AUTHORID/TARBALL", where AUTHORID is the +author's PAUSE ID and TARBALL is the distribution filename. + +=item CPAN::Distribution::base_id() + +Returns the distribution filename without any archive suffix. E.g +"Foo-Bar-0.01" + +=item CPAN::Distribution::clean() + +Changes to the directory where the distribution has been unpacked and +runs C there. + +=item CPAN::Distribution::containsmods() + +Returns a list of IDs of modules contained in a distribution file. +Works only for distributions listed in the 02packages.details.txt.gz +file. This typically means that just most recent version of a +distribution is covered. + +=item CPAN::Distribution::cvs_import() + +Changes to the directory where the distribution has been unpacked and +runs something like + + cvs -d $cvs_root import -m $cvs_log $cvs_dir $userid v$version + +there. + +=item CPAN::Distribution::dir() + +Returns the directory into which this distribution has been unpacked. + +=item CPAN::Distribution::force($method,@args) + +Forces CPAN to perform a task that it normally would have refused to +do. Force takes as arguments a method name to be called and any number +of additional arguments that should be passed to the called method. +The internals of the object get the needed changes so that CPAN.pm +does not refuse to take the action. See also the section above on the +C and the C pragma. + +=item CPAN::Distribution::get() + +Downloads the distribution from CPAN and unpacks it. Does nothing if +the distribution has already been downloaded and unpacked within the +current session. + +=item CPAN::Distribution::install() + +Changes to the directory where the distribution has been unpacked and +runs the external command C there. If C has not +yet been run, it will be run first. A C is issued in +any case and if this fails, the install is cancelled. The +cancellation can be avoided by letting C run the C for +you. + +This install method only has the power to install the distribution if +there are no dependencies in the way. To install an object along with all +its dependencies, use CPAN::Shell->install. + +Note that install() gives no meaningful return value. See uptodate(). + +=item CPAN::Distribution::isa_perl() + +Returns 1 if this distribution file seems to be a perl distribution. +Normally this is derived from the file name only, but the index from +CPAN can contain a hint to achieve a return value of true for other +filenames too. + +=item CPAN::Distribution::look() + +Changes to the directory where the distribution has been unpacked and +opens a subshell there. Exiting the subshell returns. + +=item CPAN::Distribution::make() + +First runs the C method to make sure the distribution is +downloaded and unpacked. Changes to the directory where the +distribution has been unpacked and runs the external commands C or C and C there. + +=item CPAN::Distribution::perldoc() + +Downloads the pod documentation of the file associated with a +distribution (in HTML format) and runs it through the external +command I specified in C<< $CPAN::Config->{lynx} >>. If I +isn't available, it converts it to plain text with the external +command I and runs it through the pager specified +in C<< $CPAN::Config->{pager} >>. + +=item CPAN::Distribution::prefs() + +Returns the hash reference from the first matching YAML file that the +user has deposited in the C directory. The first +succeeding match wins. The files in the C are processed +alphabetically, and the canonical distro name (e.g. +AUTHOR/Foo-Bar-3.14.tar.gz) is matched against the regular expressions +stored in the $root->{match}{distribution} attribute value. +Additionally all module names contained in a distribution are matched +against the regular expressions in the $root->{match}{module} attribute +value. The two match values are ANDed together. Each of the two +attributes are optional. + +=item CPAN::Distribution::prereq_pm() + +Returns the hash reference that has been announced by a distribution +as the C and C elements. These can be +declared either by the C (if authoritative) or can be +deposited after the run of C in the file C<./_build/prereqs> +or after the run of C written as the C hash in +a comment in the produced C. I: this method only works +after an attempt has been made to C the distribution. Returns +undef otherwise. + +=item CPAN::Distribution::readme() + +Downloads the README file associated with a distribution and runs it +through the pager specified in C<< $CPAN::Config->{pager} >>. + +=item CPAN::Distribution::reports() + +Downloads report data for this distribution from www.cpantesters.org +and displays a subset of them. + +=item CPAN::Distribution::read_yaml() + +Returns the content of the META.yml of this distro as a hashref. Note: +works only after an attempt has been made to C the distribution. +Returns undef otherwise. Also returns undef if the content of META.yml +is not authoritative. (The rules about what exactly makes the content +authoritative are still in flux.) + +=item CPAN::Distribution::test() + +Changes to the directory where the distribution has been unpacked and +runs C there. + +=item CPAN::Distribution::uptodate() + +Returns 1 if all the modules contained in the distribution are +up-to-date. Relies on containsmods. + +=item CPAN::Index::force_reload() + +Forces a reload of all indices. + +=item CPAN::Index::reload() + +Reloads all indices if they have not been read for more than +C<< $CPAN::Config->{index_expire} >> days. + +=item CPAN::InfoObj::dump() + +CPAN::Author, CPAN::Bundle, CPAN::Module, and CPAN::Distribution +inherit this method. It prints the data structure associated with an +object. Useful for debugging. Note: the data structure is considered +internal and thus subject to change without notice. + +=item CPAN::Module::as_glimpse() + +Returns a one-line description of the module in four columns: The +first column contains the word C, the second column consists +of one character: an equals sign if this module is already installed +and up-to-date, a less-than sign if this module is installed but can be +upgraded, and a space if the module is not installed. The third column +is the name of the module and the fourth column gives maintainer or +distribution information. + +=item CPAN::Module::as_string() + +Returns a multi-line description of the module + +=item CPAN::Module::clean() + +Runs a clean on the distribution associated with this module. + +=item CPAN::Module::cpan_file() + +Returns the filename on CPAN that is associated with the module. + +=item CPAN::Module::cpan_version() + +Returns the latest version of this module available on CPAN. + +=item CPAN::Module::cvs_import() + +Runs a cvs_import on the distribution associated with this module. + +=item CPAN::Module::description() + +Returns a 44 character description of this module. Only available for +modules listed in The Module List (CPAN/modules/00modlist.long.html +or 00modlist.long.txt.gz) + +=item CPAN::Module::distribution() + +Returns the CPAN::Distribution object that contains the current +version of this module. + +=item CPAN::Module::dslip_status() + +Returns a hash reference. The keys of the hash are the letters C, +C, C, C, and

, for development status, support level, +language, interface and public licence respectively. The data for the +DSLIP status are collected by pause.perl.org when authors register +their namespaces. The values of the 5 hash elements are one-character +words whose meaning is described in the table below. There are also 5 +hash elements C, C, C, C, and that carry a more +verbose value of the 5 status variables. + +Where the 'DSLIP' characters have the following meanings: + + D - Development Stage (Note: *NO IMPLIED TIMESCALES*): + i - Idea, listed to gain consensus or as a placeholder + c - under construction but pre-alpha (not yet released) + a/b - Alpha/Beta testing + R - Released + M - Mature (no rigorous definition) + S - Standard, supplied with Perl 5 + + S - Support Level: + m - Mailing-list + d - Developer + u - Usenet newsgroup comp.lang.perl.modules + n - None known, try comp.lang.perl.modules + a - abandoned; volunteers welcome to take over maintenance + + L - Language Used: + p - Perl-only, no compiler needed, should be platform independent + c - C and perl, a C compiler will be needed + h - Hybrid, written in perl with optional C code, no compiler needed + + - C++ and perl, a C++ compiler will be needed + o - perl and another language other than C or C++ + + I - Interface Style + f - plain Functions, no references used + h - hybrid, object and function interfaces available + n - no interface at all (huh?) + r - some use of unblessed References or ties + O - Object oriented using blessed references and/or inheritance + + P - Public License + p - Standard-Perl: user may choose between GPL and Artistic + g - GPL: GNU General Public License + l - LGPL: "GNU Lesser General Public License" (previously known as + "GNU Library General Public License") + b - BSD: The BSD License + a - Artistic license alone + 2 - Artistic license 2.0 or later + o - open source: approved by www.opensource.org + d - allows distribution without restrictions + r - restricted distribution + n - no license at all + +=item CPAN::Module::force($method,@args) + +Forces CPAN to perform a task it would normally refuse to +do. Force takes as arguments a method name to be invoked and any number +of additional arguments to pass that method. +The internals of the object get the needed changes so that CPAN.pm +does not refuse to take the action. See also the section above on the +C and the C pragma. + +=item CPAN::Module::get() + +Runs a get on the distribution associated with this module. + +=item CPAN::Module::inst_file() + +Returns the filename of the module found in @INC. The first file found +is reported, just as perl itself stops searching @INC once it finds a +module. + +=item CPAN::Module::available_file() + +Returns the filename of the module found in PERL5LIB or @INC. The +first file found is reported. The advantage of this method over +C is that modules that have been tested but not yet +installed are included because PERL5LIB keeps track of tested modules. + +=item CPAN::Module::inst_version() + +Returns the version number of the installed module in readable format. + +=item CPAN::Module::available_version() + +Returns the version number of the available module in readable format. + +=item CPAN::Module::install() + +Runs an C on the distribution associated with this module. + +=item CPAN::Module::look() + +Changes to the directory where the distribution associated with this +module has been unpacked and opens a subshell there. Exiting the +subshell returns. + +=item CPAN::Module::make() + +Runs a C on the distribution associated with this module. + +=item CPAN::Module::manpage_headline() + +If module is installed, peeks into the module's manpage, reads the +headline, and returns it. Moreover, if the module has been downloaded +within this session, does the equivalent on the downloaded module even +if it hasn't been installed yet. + +=item CPAN::Module::perldoc() + +Runs a C on this module. + +=item CPAN::Module::readme() + +Runs a C on the distribution associated with this module. + +=item CPAN::Module::reports() + +Calls the reports() method on the associated distribution object. + +=item CPAN::Module::test() + +Runs a C on the distribution associated with this module. + +=item CPAN::Module::uptodate() + +Returns 1 if the module is installed and up-to-date. + +=item CPAN::Module::userid() + +Returns the author's ID of the module. + +=back + +=head2 Cache Manager + +Currently the cache manager only keeps track of the build directory +($CPAN::Config->{build_dir}). It is a simple FIFO mechanism that +deletes complete directories below C as soon as the size of +all directories there gets bigger than $CPAN::Config->{build_cache} +(in MB). The contents of this cache may be used for later +re-installations that you intend to do manually, but will never be +trusted by CPAN itself. This is due to the fact that the user might +use these directories for building modules on different architectures. + +There is another directory ($CPAN::Config->{keep_source_where}) where +the original distribution files are kept. This directory is not +covered by the cache manager and must be controlled by the user. If +you choose to have the same directory as build_dir and as +keep_source_where directory, then your sources will be deleted with +the same fifo mechanism. + +=head2 Bundles + +A bundle is just a perl module in the namespace Bundle:: that does not +define any functions or methods. It usually only contains documentation. + +It starts like a perl module with a package declaration and a $VERSION +variable. After that the pod section looks like any other pod with the +only difference being that I exists starting with +(verbatim): + + =head1 CONTENTS + +In this pod section each line obeys the format + + Module_Name [Version_String] [- optional text] + +The only required part is the first field, the name of a module +(e.g. Foo::Bar, i.e. I the name of the distribution file). The rest +of the line is optional. The comment part is delimited by a dash just +as in the man page header. + +The distribution of a bundle should follow the same convention as +other distributions. + +Bundles are treated specially in the CPAN package. If you say 'install +Bundle::Tkkit' (assuming such a bundle exists), CPAN will install all +the modules in the CONTENTS section of the pod. You can install your +own Bundles locally by placing a conformant Bundle file somewhere into +your @INC path. The autobundle() command which is available in the +shell interface does that for you by including all currently installed +modules in a snapshot bundle file. + +=head1 PREREQUISITES + +The CPAN program is trying to depend on as little as possible so the +user can use it in hostile environment. It works better the more goodies +the environment provides. For example if you try in the CPAN shell + + install Bundle::CPAN + +or + + install Bundle::CPANxxl + +you will find the shell more convenient than the bare shell before. + +If you have a local mirror of CPAN and can access all files with +"file:" URLs, then you only need a perl later than perl5.003 to run +this module. Otherwise Net::FTP is strongly recommended. LWP may be +required for non-UNIX systems, or if your nearest CPAN site is +associated with a URL that is not C. + +If you have neither Net::FTP nor LWP, there is a fallback mechanism +implemented for an external ftp command or for an external lynx +command. + +=head1 UTILITIES + +=head2 Finding packages and VERSION + +This module presumes that all packages on CPAN + +=over 2 + +=item * + +declare their $VERSION variable in an easy to parse manner. This +prerequisite can hardly be relaxed because it consumes far too much +memory to load all packages into the running program just to determine +the $VERSION variable. Currently all programs that are dealing with +version use something like this + + perl -MExtUtils::MakeMaker -le \ + 'print MM->parse_version(shift)' filename + +If you are author of a package and wonder if your $VERSION can be +parsed, please try the above method. + +=item * + +come as compressed or gzipped tarfiles or as zip files and contain a +C or C (well, we try to handle a bit more, but +with little enthusiasm). + +=back + +=head2 Debugging + +Debugging this module is more than a bit complex due to interference from +the software producing the indices on CPAN, the mirroring process on CPAN, +packaging, configuration, synchronicity, and even (gasp!) due to bugs +within the CPAN.pm module itself. + +For debugging the code of CPAN.pm itself in interactive mode, some +debugging aid can be turned on for most packages within +CPAN.pm with one of + +=over 2 + +=item o debug package... + +sets debug mode for packages. + +=item o debug -package... + +unsets debug mode for packages. + +=item o debug all + +turns debugging on for all packages. + +=item o debug number + +=back + +which sets the debugging packages directly. Note that C +turns debugging off. + +What seems a successful strategy is the combination of C and the debugging switches. Add a new debug statement while +running in the shell and then issue a C and see the new +debugging messages immediately without losing the current context. + +C without an argument lists the valid package names and the +current set of packages in debugging mode. C has built-in +completion support. + +For debugging of CPAN data there is the C command which takes +the same arguments as make/test/install and outputs each object's +Data::Dumper dump. If an argument looks like a perl variable and +contains one of C<$>, C<@> or C<%>, it is eval()ed and fed to +Data::Dumper directly. + +=head2 Floppy, Zip, Offline Mode + +CPAN.pm works nicely without network access, too. If you maintain machines +that are not networked at all, you should consider working with C +URLs. You'll have to collect your modules somewhere first. So +you might use CPAN.pm to put together all you need on a networked +machine. Then copy the $CPAN::Config->{keep_source_where} (but not +$CPAN::Config->{build_dir}) directory on a floppy. This floppy is kind +of a personal CPAN. CPAN.pm on the non-networked machines works nicely +with this floppy. See also below the paragraph about CD-ROM support. + +=head2 Basic Utilities for Programmers + +=over 2 + +=item has_inst($module) + +Returns true if the module is installed. Used to load all modules into +the running CPAN.pm that are considered optional. The config variable +C intercepts the C call such +that an optional module is not loaded despite being available. For +example, the following command will prevent C from being +loaded: + + cpan> o conf dontload_list push YAML + +See the source for details. + +=item use_inst($module) + +Similary to L tries to load optional library but also dies if +library is not available + +=item has_usable($module) + +Returns true if the module is installed and in a usable state. Only +useful for a handful of modules that are used internally. See the +source for details. + +=item instance($module) + +The constructor for all the singletons used to represent modules, +distributions, authors, and bundles. If the object already exists, this +method returns the object; otherwise, it calls the constructor. + +=item frontend() + +=item frontend($new_frontend) + +Getter/setter for frontend object. Method just allows to subclass CPAN.pm. + +=back + +=head1 SECURITY + +There's no strong security layer in CPAN.pm. CPAN.pm helps you to +install foreign, unmasked, unsigned code on your machine. We compare +to a checksum that comes from the net just as the distribution file +itself. But we try to make it easy to add security on demand: + +=head2 Cryptographically signed modules + +Since release 1.77, CPAN.pm has been able to verify cryptographically +signed module distributions using Module::Signature. The CPAN modules +can be signed by their authors, thus giving more security. The simple +unsigned MD5 checksums that were used before by CPAN protect mainly +against accidental file corruption. + +You will need to have Module::Signature installed, which in turn +requires that you have at least one of Crypt::OpenPGP module or the +command-line F tool installed. + +You will also need to be able to connect over the Internet to the public +key servers, like pgp.mit.edu, and their port 11731 (the HKP protocol). + +The configuration parameter check_sigs is there to turn signature +checking on or off. + +=head1 EXPORT + +Most functions in package CPAN are exported by default. The reason +for this is that the primary use is intended for the cpan shell or for +one-liners. + +=head1 ENVIRONMENT + +When the CPAN shell enters a subshell via the look command, it sets +the environment CPAN_SHELL_LEVEL to 1, or increments that variable if it is +already set. + +When CPAN runs, it sets the environment variable PERL5_CPAN_IS_RUNNING +to the ID of the running process. It also sets +PERL5_CPANPLUS_IS_RUNNING to prevent runaway processes which could +happen with older versions of Module::Install. + +When running C, the environment variable +C is set to the full path of the +C that is being executed. This prevents runaway processes +with newer versions of Module::Install. + +When the config variable ftp_passive is set, all downloads will be run +with the environment variable FTP_PASSIVE set to this value. This is +in general a good idea as it influences both Net::FTP and LWP based +connections. The same effect can be achieved by starting the cpan +shell with this environment variable set. For Net::FTP alone, one can +also always set passive mode by running libnetcfg. + +=head1 POPULATE AN INSTALLATION WITH LOTS OF MODULES + +Populating a freshly installed perl with one's favorite modules is pretty +easy if you maintain a private bundle definition file. To get a useful +blueprint of a bundle definition file, the command autobundle can be used +on the CPAN shell command line. This command writes a bundle definition +file for all modules installed for the current perl +interpreter. It's recommended to run this command once only, and from then +on maintain the file manually under a private name, say +Bundle/my_bundle.pm. With a clever bundle file you can then simply say + + cpan> install Bundle::my_bundle + +then answer a few questions and go out for coffee (possibly +even in a different city). + +Maintaining a bundle definition file means keeping track of two +things: dependencies and interactivity. CPAN.pm sometimes fails on +calculating dependencies because not all modules define all MakeMaker +attributes correctly, so a bundle definition file should specify +prerequisites as early as possible. On the other hand, it's +annoying that so many distributions need some interactive configuring. So +what you can try to accomplish in your private bundle file is to have the +packages that need to be configured early in the file and the gentle +ones later, so you can go out for coffee after a few minutes and leave CPAN.pm +to churn away unattended. + +=head1 WORKING WITH CPAN.pm BEHIND FIREWALLS + +Thanks to Graham Barr for contributing the following paragraphs about +the interaction between perl, and various firewall configurations. For +further information on firewalls, it is recommended to consult the +documentation that comes with the I program. If you are unable to +go through the firewall with a simple Perl setup, it is likely +that you can configure I so that it works through your firewall. + +=head2 Three basic types of firewalls + +Firewalls can be categorized into three basic types. + +=over 4 + +=item http firewall + +This is when the firewall machine runs a web server, and to access the +outside world, you must do so via that web server. If you set environment +variables like http_proxy or ftp_proxy to values beginning with http://, +or in your web browser you've proxy information set, then you know +you are running behind an http firewall. + +To access servers outside these types of firewalls with perl (even for +ftp), you need LWP or HTTP::Tiny. + +=item ftp firewall + +This where the firewall machine runs an ftp server. This kind of +firewall will only let you access ftp servers outside the firewall. +This is usually done by connecting to the firewall with ftp, then +entering a username like "user@outside.host.com". + +To access servers outside these type of firewalls with perl, you +need Net::FTP. + +=item One-way visibility + +One-way visibility means these firewalls try to make themselves +invisible to users inside the firewall. An FTP data connection is +normally created by sending your IP address to the remote server and then +listening for the return connection. But the remote server will not be able to +connect to you because of the firewall. For these types of firewall, +FTP connections need to be done in a passive mode. + +There are two that I can think off. + +=over 4 + +=item SOCKS + +If you are using a SOCKS firewall, you will need to compile perl and link +it with the SOCKS library. This is what is normally called a 'socksified' +perl. With this executable you will be able to connect to servers outside +the firewall as if it were not there. + +=item IP Masquerade + +This is when the firewall implemented in the kernel (via NAT, or networking +address translation), it allows you to hide a complete network behind one +IP address. With this firewall no special compiling is needed as you can +access hosts directly. + +For accessing ftp servers behind such firewalls you usually need to +set the environment variable C or the config variable +ftp_passive to a true value. + +=back + +=back + +=head2 Configuring lynx or ncftp for going through a firewall + +If you can go through your firewall with e.g. lynx, presumably with a +command such as + + /usr/local/bin/lynx -pscott:tiger + +then you would configure CPAN.pm with the command + + o conf lynx "/usr/local/bin/lynx -pscott:tiger" + +That's all. Similarly for ncftp or ftp, you would configure something +like + + o conf ncftp "/usr/bin/ncftp -f /home/scott/ncftplogin.cfg" + +Your mileage may vary... + +=head1 FAQ + +=over 4 + +=item 1) + +I installed a new version of module X but CPAN keeps saying, +I have the old version installed + +Probably you B have the old version installed. This can +happen if a module installs itself into a different directory in the +@INC path than it was previously installed. This is not really a +CPAN.pm problem, you would have the same problem when installing the +module manually. The easiest way to prevent this behaviour is to add +the argument C to the C call, and that is why +many people add this argument permanently by configuring + + o conf make_install_arg UNINST=1 + +=item 2) + +So why is UNINST=1 not the default? + +Because there are people who have their precise expectations about who +may install where in the @INC path and who uses which @INC array. In +fine tuned environments C can cause damage. + +=item 3) + +I want to clean up my mess, and install a new perl along with +all modules I have. How do I go about it? + +Run the autobundle command for your old perl and optionally rename the +resulting bundle file (e.g. Bundle/mybundle.pm), install the new perl +with the Configure option prefix, e.g. + + ./Configure -Dprefix=/usr/local/perl-5.6.78.9 + +Install the bundle file you produced in the first step with something like + + cpan> install Bundle::mybundle + +and you're done. + +=item 4) + +When I install bundles or multiple modules with one command +there is too much output to keep track of. + +You may want to configure something like + + o conf make_arg "| tee -ai /root/.cpan/logs/make.out" + o conf make_install_arg "| tee -ai /root/.cpan/logs/make_install.out" + +so that STDOUT is captured in a file for later inspection. + + +=item 5) + +I am not root, how can I install a module in a personal directory? + +As of CPAN 1.9463, if you do not have permission to write the default perl +library directories, CPAN's configuration process will ask you whether +you want to bootstrap , which makes keeping a personal +perl library directory easy. + +Another thing you should bear in mind is that the UNINST parameter can +be dangerous when you are installing into a private area because you +might accidentally remove modules that other people depend on that are +not using the private area. + +=item 6) + +How to get a package, unwrap it, and make a change before building it? + +Have a look at the C (!) command. + +=item 7) + +I installed a Bundle and had a couple of fails. When I +retried, everything resolved nicely. Can this be fixed to work +on first try? + +The reason for this is that CPAN does not know the dependencies of all +modules when it starts out. To decide about the additional items to +install, it just uses data found in the META.yml file or the generated +Makefile. An undetected missing piece breaks the process. But it may +well be that your Bundle installs some prerequisite later than some +depending item and thus your second try is able to resolve everything. +Please note, CPAN.pm does not know the dependency tree in advance and +cannot sort the queue of things to install in a topologically correct +order. It resolves perfectly well B all modules declare the +prerequisites correctly with the PREREQ_PM attribute to MakeMaker or +the C stanza of Module::Build. For bundles which fail and +you need to install often, it is recommended to sort the Bundle +definition file manually. + +=item 8) + +In our intranet, we have many modules for internal use. How +can I integrate these modules with CPAN.pm but without uploading +the modules to CPAN? + +Have a look at the CPAN::Site module. + +=item 9) + +When I run CPAN's shell, I get an error message about things in my +C (or C<~/.inputrc>) file. + +These are readline issues and can only be fixed by studying readline +configuration on your architecture and adjusting the referenced file +accordingly. Please make a backup of the C or C<~/.inputrc> +and edit them. Quite often harmless changes like uppercasing or +lowercasing some arguments solves the problem. + +=item 10) + +Some authors have strange characters in their names. + +Internally CPAN.pm uses the UTF-8 charset. If your terminal is +expecting ISO-8859-1 charset, a converter can be activated by setting +term_is_latin to a true value in your config file. One way of doing so +would be + + cpan> o conf term_is_latin 1 + +If other charset support is needed, please file a bug report against +CPAN.pm at rt.cpan.org and describe your needs. Maybe we can extend +the support or maybe UTF-8 terminals become widely available. + +Note: this config variable is deprecated and will be removed in a +future version of CPAN.pm. It will be replaced with the conventions +around the family of $LANG and $LC_* environment variables. + +=item 11) + +When an install fails for some reason and then I correct the error +condition and retry, CPAN.pm refuses to install the module, saying +C. + +Use the force pragma like so + + force install Foo::Bar + +Or you can use + + look Foo::Bar + +and then C directly in the subshell. + +=item 12) + +How do I install a "DEVELOPER RELEASE" of a module? + +By default, CPAN will install the latest non-developer release of a +module. If you want to install a dev release, you have to specify the +partial path starting with the author id to the tarball you wish to +install, like so: + + cpan> install KWILLIAMS/Module-Build-0.27_07.tar.gz + +Note that you can use the C command to get this path listed. + +=item 13) + +How do I install a module and all its dependencies from the commandline, +without being prompted for anything, despite my CPAN configuration +(or lack thereof)? + +CPAN uses ExtUtils::MakeMaker's prompt() function to ask its questions, so +if you set the PERL_MM_USE_DEFAULT environment variable, you shouldn't be +asked any questions at all (assuming the modules you are installing are +nice about obeying that variable as well): + + % PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install My::Module' + +=item 14) + +How do I create a Module::Build based Build.PL derived from an +ExtUtils::MakeMaker focused Makefile.PL? + +http://search.cpan.org/dist/Module-Build-Convert/ + +=item 15) + +I'm frequently irritated with the CPAN shell's inability to help me +select a good mirror. + +CPAN can now help you select a "good" mirror, based on which ones have the +lowest 'ping' round-trip times. From the shell, use the command 'o conf init +urllist' and allow CPAN to automatically select mirrors for you. + +Beyond that help, the urllist config parameter is yours. You can add and remove +sites at will. You should find out which sites have the best up-to-dateness, +bandwidth, reliability, etc. and are topologically close to you. Some people +prefer fast downloads, others up-to-dateness, others reliability. You decide +which to try in which order. + +Henk P. Penning maintains a site that collects data about CPAN sites: + + http://mirrors.cpan.org/ + +Also, feel free to play with experimental features. Run + + o conf init randomize_urllist ftpstats_period ftpstats_size + +and choose your favorite parameters. After a few downloads running the +C command will probably assist you in choosing the best mirror +sites. + +=item 16) + +Why do I get asked the same questions every time I start the shell? + +You can make your configuration changes permanent by calling the +command C. Alternatively set the C +variable to true by running C and answering +the following question with yes. + +=item 17) + +Older versions of CPAN.pm had the original root directory of all +tarballs in the build directory. Now there are always random +characters appended to these directory names. Why was this done? + +The random characters are provided by File::Temp and ensure that each +module's individual build directory is unique. This makes running +CPAN.pm in concurrent processes simultaneously safe. + +=item 18) + +Speaking of the build directory. Do I have to clean it up myself? + +You have the choice to set the config variable C to +C. Then you must clean it up yourself. The other possible +values, C and C clean up the build directory when you +start (or more precisely, after the first extraction into the build +directory) or exit the CPAN shell, respectively. If you never start up +the CPAN shell, you probably also have to clean up the build directory +yourself. + +=item 19) + +How can I switch to sudo instead of local::lib? + +The following 5 environment veriables need to be reset to the previous +values: PATH, PERL5LIB, PERL_LOCAL_LIB_ROOT, PERL_MB_OPT, PERL_MM_OPT; +and these two CPAN.pm config variables must be reconfigured: +make_install_make_command and mbuild_install_build_command. The five +env variables have probably been overwritten in your $HOME/.bashrc or +some equivalent. You either find them there and delete their traces +and logout/login or you override them temporarily, depending on your +exact desire. The two cpanpm config variables can be set with: + + o conf init /install_.*_command/ + +probably followed by + + o conf commit + +=back + +=head1 COMPATIBILITY + +=head2 OLD PERL VERSIONS + +CPAN.pm is regularly tested to run under 5.005 and assorted +newer versions. It is getting more and more difficult to get the +minimal prerequisites working on older perls. It is close to +impossible to get the whole Bundle::CPAN working there. If you're in +the position to have only these old versions, be advised that CPAN is +designed to work fine without the Bundle::CPAN installed. + +To get things going, note that GBARR/Scalar-List-Utils-1.18.tar.gz is +compatible with ancient perls and that File::Temp is listed as a +prerequisite but CPAN has reasonable workarounds if it is missing. + +=head2 CPANPLUS + +This module and its competitor, the CPANPLUS module, are both much +cooler than the other. CPAN.pm is older. CPANPLUS was designed to be +more modular, but it was never intended to be compatible with CPAN.pm. + +=head2 CPANMINUS + +In the year 2010 App::cpanminus was launched as a new approach to a +cpan shell with a considerably smaller footprint. Very cool stuff. + +=head1 SECURITY ADVICE + +This software enables you to upgrade software on your computer and so +is inherently dangerous because the newly installed software may +contain bugs and may alter the way your computer works or even make it +unusable. Please consider backing up your data before every upgrade. + +=head1 BUGS + +Please report bugs via L + +Before submitting a bug, please make sure that the traditional method +of building a Perl module package from a shell by following the +installation instructions of that package still works in your +environment. + +=head1 AUTHOR + +Andreas Koenig C<< >> + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See L + +=head1 TRANSLATIONS + +Kawai,Takanori provides a Japanese translation of a very old version +of this manpage at +L + +=head1 SEE ALSO + +Many people enter the CPAN shell by running the L utility +program which is installed in the same directory as perl itself. So if +you have this directory in your PATH variable (or some equivalent in +your operating system) then typing C in a console window will +work for you as well. Above that the utility provides several +commandline shortcuts. + +melezhik (Alexey) sent me a link where he published a chef recipe to +work with CPAN.pm: http://community.opscode.com/cookbooks/cpan. + + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Author.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Author.pm new file mode 100644 index 0000000000000000000000000000000000000000..572f3ab31d55b2641fe43ca28d4ae08a87211c17 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Author.pm @@ -0,0 +1,236 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Author; +use strict; + +use CPAN::InfoObj; +@CPAN::Author::ISA = qw(CPAN::InfoObj); +use vars qw( + $VERSION +); +$VERSION = "5.5002"; + +package CPAN::Author; +use strict; + +#-> sub CPAN::Author::force +sub force { + my $self = shift; + $self->{force}++; +} + +#-> sub CPAN::Author::force +sub unforce { + my $self = shift; + delete $self->{force}; +} + +#-> sub CPAN::Author::id +sub id { + my $self = shift; + my $id = $self->{ID}; + $CPAN::Frontend->mydie("Illegal author id[$id]") unless $id =~ /^[A-Z]/; + $id; +} + +#-> sub CPAN::Author::as_glimpse ; +sub as_glimpse { + my($self) = @_; + my(@m); + my $class = ref($self); + $class =~ s/^CPAN:://; + push @m, sprintf(qq{%-15s %s ("%s" <%s>)\n}, + $class, + $self->{ID}, + $self->fullname, + $self->email); + join "", @m; +} + +#-> sub CPAN::Author::fullname ; +sub fullname { + shift->ro->{FULLNAME}; +} +*name = \&fullname; + +#-> sub CPAN::Author::email ; +sub email { shift->ro->{EMAIL}; } + +#-> sub CPAN::Author::ls ; +sub ls { + my $self = shift; + my $glob = shift || ""; + my $silent = shift || 0; + my $id = $self->id; + + # adapted from CPAN::Distribution::verifyCHECKSUM ; + my(@csf); # chksumfile + @csf = $self->id =~ /(.)(.)(.*)/; + $csf[1] = join "", @csf[0,1]; + $csf[2] = join "", @csf[1,2]; # ("A","AN","ANDK") + my(@dl); + @dl = $self->dir_listing([$csf[0],"CHECKSUMS"], 0, 1); + unless (grep {$_->[2] eq $csf[1]} @dl) { + $CPAN::Frontend->myprint("Directory $csf[1]/ does not exist\n") unless $silent ; + return; + } + @dl = $self->dir_listing([@csf[0,1],"CHECKSUMS"], 0, 1); + unless (grep {$_->[2] eq $csf[2]} @dl) { + $CPAN::Frontend->myprint("Directory $id/ does not exist\n") unless $silent; + return; + } + @dl = $self->dir_listing([@csf,"CHECKSUMS"], 1, 1); + if ($glob) { + if ($CPAN::META->has_inst("Text::Glob")) { + $glob =~ s|/$|/*|; + my $rglob = Text::Glob::glob_to_regex($glob); + CPAN->debug("glob[$glob]rglob[$rglob]dl[@dl]") if $CPAN::DEBUG; + my @tmpdl = grep { $_->[2] =~ /$rglob/ } @dl; + if (1==@tmpdl && $tmpdl[0][0]==0) { + $rglob = Text::Glob::glob_to_regex("$glob/*"); + @dl = grep { $_->[2] =~ /$rglob/ } @dl; + } else { + @dl = @tmpdl; + } + CPAN->debug("rglob[$rglob]dl[@dl]") if $CPAN::DEBUG; + } else { + $CPAN::Frontend->mydie("Text::Glob not installed, cannot proceed"); + } + } + unless ($silent >= 2) { + $CPAN::Frontend->myprint + ( + join "", + map { + sprintf + ( + "%8d %10s %s/%s%s\n", + $_->[0], + $_->[1], + $id, + $_->[2], + 0==$_->[0]?"/":"", + ) + } sort { $a->[2] cmp $b->[2] } @dl + ); + } + @dl; +} + +# returns an array of arrays, the latter contain (size,mtime,filename) +#-> sub CPAN::Author::dir_listing ; +sub dir_listing { + my $self = shift; + my $chksumfile = shift; + my $recursive = shift; + my $may_ftp = shift; + + my $lc_want = + File::Spec->catfile($CPAN::Config->{keep_source_where}, + "authors", "id", @$chksumfile); + + my $fh; + + CPAN->debug("chksumfile[@$chksumfile]recursive[$recursive]may_ftp[$may_ftp]") if $CPAN::DEBUG; + # Purge and refetch old (pre-PGP) CHECKSUMS; they are a security + # hazard. (Without GPG installed they are not that much better, + # though.) + $fh = FileHandle->new; + if (open($fh, $lc_want)) { + my $line = <$fh>; close $fh; + unlink($lc_want) unless $line =~ /PGP/; + } + + local($") = "/"; + # connect "force" argument with "index_expire". + my $force = $self->{force}; + if (my @stat = stat $lc_want) { + $force ||= $stat[9] + $CPAN::Config->{index_expire}*86400 <= time; + } + my $lc_file; + if ($may_ftp) { + $lc_file = eval { + CPAN::FTP->localize + ( + "authors/id/@$chksumfile", + $lc_want, + $force, + ); + }; + unless ($lc_file) { + $CPAN::Frontend->myprint("Trying $lc_want.gz\n"); + $chksumfile->[-1] .= ".gz"; + $lc_file = eval { + CPAN::FTP->localize + ("authors/id/@$chksumfile", + "$lc_want.gz", + 1, + ); + }; + if ($lc_file) { + $lc_file =~ s{\.gz(?!\n)\Z}{}; #}; + eval{CPAN::Tarzip->new("$lc_file.gz")->gunzip($lc_file)}; + } else { + return; + } + } + } else { + $lc_file = $lc_want; + # we *could* second-guess and if the user has a file: URL, + # then we could look there. But on the other hand, if they do + # have a file: URL, why did they choose to set + # $CPAN::Config->{show_upload_date} to false? + } + + # adapted from CPAN::Distribution::CHECKSUM_check_file ; + $fh = FileHandle->new; + my($cksum); + if (open $fh, $lc_file) { + local($/); + my $eval = <$fh>; + $eval =~ s/\015?\012/\n/g; + close $fh; + my($compmt) = Safe->new(); + $cksum = $compmt->reval($eval); + if ($@) { + rename $lc_file, "$lc_file.bad"; + Carp::confess($@) if $@; + } + } elsif ($may_ftp) { + Carp::carp ("Could not open '$lc_file' for reading."); + } else { + # Maybe should warn: "You may want to set show_upload_date to a true value" + return; + } + my(@result,$f); + for $f (sort keys %$cksum) { + if (exists $cksum->{$f}{isdir}) { + if ($recursive) { + my(@dir) = @$chksumfile; + pop @dir; + push @dir, $f, "CHECKSUMS"; + push @result, [ 0, "-", $f ]; + push @result, map { + [$_->[0], $_->[1], "$f/$_->[2]"] + } $self->dir_listing(\@dir,1,$may_ftp); + } else { + push @result, [ 0, "-", $f ]; + } + } else { + push @result, [ + ($cksum->{$f}{"size"}||0), + $cksum->{$f}{"mtime"}||"---", + $f + ]; + } + } + @result; +} + +#-> sub CPAN::Author::reports +sub reports { + $CPAN::Frontend->mywarn("reports on authors not implemented. +Please file a bugreport if you need this.\n"); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Bundle.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Bundle.pm new file mode 100644 index 0000000000000000000000000000000000000000..99c95ac4d6e787fa3dc3f767fe6a6bf345c11f67 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Bundle.pm @@ -0,0 +1,306 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Bundle; +use strict; +use CPAN::Module; +@CPAN::Bundle::ISA = qw(CPAN::Module); + +use vars qw( + $VERSION +); +$VERSION = "5.5005"; + +sub look { + my $self = shift; + $CPAN::Frontend->myprint($self->as_string); +} + +#-> CPAN::Bundle::undelay +sub undelay { + my $self = shift; + delete $self->{later}; + for my $c ( $self->contains ) { + my $obj = CPAN::Shell->expandany($c) or next; + if ($obj->id eq $self->id){ + my $id = $obj->id; + $CPAN::Frontend->mywarn("$id seems to contain itself, skipping\n"); + next; + } + $obj->undelay; + } +} + +# mark as dirty/clean +#-> sub CPAN::Bundle::color_cmd_tmps ; +sub color_cmd_tmps { + my($self) = shift; + my($depth) = shift || 0; + my($color) = shift || 0; + my($ancestors) = shift || []; + # a module needs to recurse to its cpan_file, a distribution needs + # to recurse into its prereq_pms, a bundle needs to recurse into its modules + + return if exists $self->{incommandcolor} + && $color==1 + && $self->{incommandcolor}==$color; + if ($depth>=$CPAN::MAX_RECURSION) { + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } + } + # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; + + for my $c ( $self->contains ) { + my $obj = CPAN::Shell->expandany($c) or next; + CPAN->debug("c[$c]obj[$obj]") if $CPAN::DEBUG; + $obj->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]); + } + # never reached code? + #if ($color==0) { + #delete $self->{badtestcnt}; + #} + $self->{incommandcolor} = $color; +} + +#-> sub CPAN::Bundle::as_string ; +sub as_string { + my($self) = @_; + $self->contains; + # following line must be "=", not "||=" because we have a moving target + $self->{INST_VERSION} = $self->inst_version; + return $self->SUPER::as_string; +} + +#-> sub CPAN::Bundle::contains ; +sub contains { + my($self) = @_; + my($inst_file) = $self->inst_file || ""; + my($id) = $self->id; + $self->debug("inst_file[$inst_file]id[$id]") if $CPAN::DEBUG; + if ($inst_file && CPAN::Version->vlt($self->inst_version,$self->cpan_version)) { + undef $inst_file; + } + unless ($inst_file) { + # Try to get at it in the cpan directory + $self->debug("no inst_file") if $CPAN::DEBUG; + my $cpan_file; + $CPAN::Frontend->mydie("I don't know a bundle with ID '$id'\n") unless + $cpan_file = $self->cpan_file; + if ($cpan_file eq "N/A") { + $CPAN::Frontend->mywarn("Bundle '$id' not found on disk and not on CPAN. Maybe stale symlink? Maybe removed during session?\n"); + return; + } + my $dist = $CPAN::META->instance('CPAN::Distribution', + $self->cpan_file); + $self->debug("before get id[$dist->{ID}]") if $CPAN::DEBUG; + $dist->get; + $self->debug("after get id[$dist->{ID}]") if $CPAN::DEBUG; + my($todir) = $CPAN::Config->{'cpan_home'}; + my(@me,$from,$to,$me); + @me = split /::/, $self->id; + $me[-1] .= ".pm"; + $me = File::Spec->catfile(@me); + my $build_dir; + unless ($build_dir = $dist->{build_dir}) { + $CPAN::Frontend->mywarn("Warning: cannot determine bundle content without a build_dir.\n"); + return; + } + $from = $self->find_bundle_file($build_dir,join('/',@me)); + $to = File::Spec->catfile($todir,$me); + File::Path::mkpath(File::Basename::dirname($to)); + File::Copy::copy($from, $to) + or Carp::confess("Couldn't copy $from to $to: $!"); + $inst_file = $to; + } + my @result; + my $fh = FileHandle->new; + local $/ = "\n"; + open($fh,$inst_file) or die "Could not open '$inst_file': $!"; + my $in_cont = 0; + $self->debug("inst_file[$inst_file]") if $CPAN::DEBUG; + while (<$fh>) { + $in_cont = m/^=(?!head1\s+(?i-xsm:CONTENTS))/ ? 0 : + m/^=head1\s+(?i-xsm:CONTENTS)/ ? 1 : $in_cont; + next unless $in_cont; + next if /^=/; + s/\#.*//; + next if /^\s+$/; + chomp; + push @result, (split " ", $_, 2)[0]; + } + close $fh; + delete $self->{STATUS}; + $self->{CONTAINS} = \@result; + $self->debug("CONTAINS[@result]") if $CPAN::DEBUG; + unless (@result) { + $CPAN::Frontend->mywarn(qq{ +The bundle file "$inst_file" may be a broken +bundlefile. It seems not to contain any bundle definition. +Please check the file and if it is bogus, please delete it. +Sorry for the inconvenience. +}); + } + @result; +} + +#-> sub CPAN::Bundle::find_bundle_file +# $where is in local format, $what is in unix format +sub find_bundle_file { + my($self,$where,$what) = @_; + $self->debug("where[$where]what[$what]") if $CPAN::DEBUG; +### The following two lines let CPAN.pm become Bundle/CPAN.pm :-( +### my $bu = File::Spec->catfile($where,$what); +### return $bu if -f $bu; + my $manifest = File::Spec->catfile($where,"MANIFEST"); + unless (-f $manifest) { + require ExtUtils::Manifest; + my $cwd = CPAN::anycwd(); + $self->safe_chdir($where); + ExtUtils::Manifest::mkmanifest(); + $self->safe_chdir($cwd); + } + my $fh = FileHandle->new($manifest) + or Carp::croak("Couldn't open $manifest: $!"); + local($/) = "\n"; + my $bundle_filename = $what; + $bundle_filename =~ s|Bundle.*/||; + my $bundle_unixpath; + while (<$fh>) { + next if /^\s*\#/; + my($file) = /(\S+)/; + if ($file =~ m|\Q$what\E$|) { + $bundle_unixpath = $file; + # return File::Spec->catfile($where,$bundle_unixpath); # bad + last; + } + # retry if she managed to have no Bundle directory + $bundle_unixpath = $file if $file =~ m|\Q$bundle_filename\E$|; + } + return File::Spec->catfile($where, split /\//, $bundle_unixpath) + if $bundle_unixpath; + Carp::croak("Couldn't find a Bundle file in $where"); +} + +# needs to work quite differently from Module::inst_file because of +# cpan_home/Bundle/ directory and the possibility that we have +# shadowing effect. As it makes no sense to take the first in @INC for +# Bundles, we parse them all for $VERSION and take the newest. + +#-> sub CPAN::Bundle::inst_file ; +sub inst_file { + my($self) = @_; + my($inst_file); + my(@me); + @me = split /::/, $self->id; + $me[-1] .= ".pm"; + my($incdir,$bestv); + foreach $incdir ($CPAN::Config->{'cpan_home'},@INC) { + my $parsefile = File::Spec->catfile($incdir, @me); + CPAN->debug("parsefile[$parsefile]") if $CPAN::DEBUG; + next unless -f $parsefile; + my $have = eval { MM->parse_version($parsefile); }; + if ($@) { + $CPAN::Frontend->mywarn("Error while parsing version number in file '$parsefile'\n"); + } + if (!$bestv || CPAN::Version->vgt($have,$bestv)) { + $self->{INST_FILE} = $parsefile; + $self->{INST_VERSION} = $bestv = $have; + } + } + $self->{INST_FILE}; +} + +#-> sub CPAN::Bundle::inst_version ; +sub inst_version { + my($self) = @_; + $self->inst_file; # finds INST_VERSION as side effect + $self->{INST_VERSION}; +} + +#-> sub CPAN::Bundle::rematein ; +sub rematein { + my($self,$meth) = @_; + $self->debug("self[$self] meth[$meth]") if $CPAN::DEBUG; + my($id) = $self->id; + Carp::croak( "Can't $meth $id, don't have an associated bundle file. :-(\n" ) + unless $self->inst_file || $self->cpan_file; + my($s,%fail); + for $s ($self->contains) { + my($type) = $s =~ m|/| ? 'CPAN::Distribution' : + $s =~ m|^Bundle::| ? 'CPAN::Bundle' : 'CPAN::Module'; + if ($type eq 'CPAN::Distribution') { + $CPAN::Frontend->mywarn(qq{ +The Bundle }.$self->id.qq{ contains +explicitly a file '$s'. +Going to $meth that. +}); + $CPAN::Frontend->mysleep(5); + } + # possibly noisy action: + $self->debug("type[$type] s[$s]") if $CPAN::DEBUG; + my $obj = $CPAN::META->instance($type,$s); + $obj->{reqtype} = $self->{reqtype}; + $obj->{viabundle} ||= { id => $id, reqtype => $self->{reqtype}, optional => !$self->{mandatory}}; + # $obj->$meth(); + # XXX should optional be based on whether bundle was optional? -- xdg, 2012-04-01 + # A: Sure, what could demand otherwise? --andk, 2013-11-25 + CPAN::Queue->queue_item(qmod => $obj->id, reqtype => $self->{reqtype}, optional => !$self->{mandatory}); + } +} + +# If a bundle contains another that contains an xs_file we have here, +# we just don't bother I suppose +#-> sub CPAN::Bundle::xs_file +sub xs_file { + return 0; +} + +#-> sub CPAN::Bundle::force ; +sub fforce { shift->rematein('fforce',@_); } +#-> sub CPAN::Bundle::force ; +sub force { shift->rematein('force',@_); } +#-> sub CPAN::Bundle::notest ; +sub notest { shift->rematein('notest',@_); } +#-> sub CPAN::Bundle::get ; +sub get { shift->rematein('get',@_); } +#-> sub CPAN::Bundle::make ; +sub make { shift->rematein('make',@_); } +#-> sub CPAN::Bundle::test ; +sub test { + my $self = shift; + # $self->{badtestcnt} ||= 0; + $self->rematein('test',@_); +} +#-> sub CPAN::Bundle::install ; +sub install { + my $self = shift; + $self->rematein('install',@_); +} +#-> sub CPAN::Bundle::clean ; +sub clean { shift->rematein('clean',@_); } + +#-> sub CPAN::Bundle::uptodate ; +sub uptodate { + my($self) = @_; + return 0 unless $self->SUPER::uptodate; # we must have the current Bundle def + my $c; + foreach $c ($self->contains) { + my $obj = CPAN::Shell->expandany($c); + return 0 unless $obj->uptodate; + } + return 1; +} + +#-> sub CPAN::Bundle::readme ; +sub readme { + my($self) = @_; + my($file) = $self->cpan_file or $CPAN::Frontend->myprint(qq{ +No File found for bundle } . $self->id . qq{\n}), return; + $self->debug("self[$self] file[$file]") if $CPAN::DEBUG; + $CPAN::META->instance('CPAN::Distribution',$file)->readme; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/CacheMgr.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/CacheMgr.pm new file mode 100644 index 0000000000000000000000000000000000000000..144efd62b3bab7a26314645f4658374fcecb9ede --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/CacheMgr.pm @@ -0,0 +1,249 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::CacheMgr; +use strict; +use CPAN::InfoObj; +@CPAN::CacheMgr::ISA = qw(CPAN::InfoObj CPAN); +use Cwd qw(chdir); +use File::Find; + +use vars qw( + $VERSION +); +$VERSION = "5.5002"; + +package CPAN::CacheMgr; +use strict; + +#-> sub CPAN::CacheMgr::as_string ; +sub as_string { + eval { require Data::Dumper }; + if ($@) { + return shift->SUPER::as_string; + } else { + return Data::Dumper::Dumper(shift); + } +} + +#-> sub CPAN::CacheMgr::cachesize ; +sub cachesize { + shift->{DU}; +} + +#-> sub CPAN::CacheMgr::tidyup ; +sub tidyup { + my($self) = @_; + return unless $CPAN::META->{LOCK}; + return unless -d $self->{ID}; + my @toremove = grep { $self->{SIZE}{$_}==0 } @{$self->{FIFO}}; + for my $current (0..$#toremove) { + my $toremove = $toremove[$current]; + $CPAN::Frontend->myprint(sprintf( + "DEL(%d/%d): %s \n", + $current+1, + scalar @toremove, + $toremove, + ) + ); + return if $CPAN::Signal; + $self->_clean_cache($toremove); + return if $CPAN::Signal; + } + $self->{FIFO} = []; +} + +#-> sub CPAN::CacheMgr::dir ; +sub dir { + shift->{ID}; +} + +#-> sub CPAN::CacheMgr::entries ; +sub entries { + my($self,$dir) = @_; + return unless defined $dir; + $self->debug("reading dir[$dir]") if $CPAN::DEBUG; + $dir ||= $self->{ID}; + my($cwd) = CPAN::anycwd(); + chdir $dir or Carp::croak("Can't chdir to $dir: $!"); + my $dh = DirHandle->new(File::Spec->curdir) + or Carp::croak("Couldn't opendir $dir: $!"); + my(@entries); + for ($dh->read) { + next if $_ eq "." || $_ eq ".."; + if (-f $_) { + push @entries, File::Spec->catfile($dir,$_); + } elsif (-d _) { + push @entries, File::Spec->catdir($dir,$_); + } else { + $CPAN::Frontend->mywarn("Warning: weird direntry in $dir: $_\n"); + } + } + chdir $cwd or Carp::croak("Can't chdir to $cwd: $!"); + sort { -M $a <=> -M $b} @entries; +} + +#-> sub CPAN::CacheMgr::disk_usage ; +sub disk_usage { + my($self,$dir,$fast) = @_; + return if exists $self->{SIZE}{$dir}; + return if $CPAN::Signal; + my($Du) = 0; + if (-e $dir) { + if (-d $dir) { + unless (-x $dir) { + unless (chmod 0755, $dir) { + $CPAN::Frontend->mywarn("I have neither the -x permission nor the ". + "permission to change the permission; cannot ". + "estimate disk usage of '$dir'\n"); + $CPAN::Frontend->mysleep(5); + return; + } + } + } elsif (-f $dir) { + # nothing to say, no matter what the permissions + } + } else { + $CPAN::Frontend->mywarn("File or directory '$dir' has gone, ignoring\n"); + return; + } + if ($fast) { + $Du = 0; # placeholder + } else { + find( + sub { + $File::Find::prune++ if $CPAN::Signal; + return if -l $_; + if ($^O eq 'MacOS') { + require Mac::Files; + my $cat = Mac::Files::FSpGetCatInfo($_); + $Du += $cat->ioFlLgLen() + $cat->ioFlRLgLen() if $cat; + } else { + if (-d _) { + unless (-x _) { + unless (chmod 0755, $_) { + $CPAN::Frontend->mywarn("I have neither the -x permission nor ". + "the permission to change the permission; ". + "can only partially estimate disk usage ". + "of '$_'\n"); + $CPAN::Frontend->mysleep(5); + return; + } + } + } else { + $Du += (-s _); + } + } + }, + $dir + ); + } + return if $CPAN::Signal; + $self->{SIZE}{$dir} = $Du/1024/1024; + unshift @{$self->{FIFO}}, $dir; + $self->debug("measured $dir is $Du") if $CPAN::DEBUG; + $self->{DU} += $Du/1024/1024; + $self->{DU}; +} + +#-> sub CPAN::CacheMgr::_clean_cache ; +sub _clean_cache { + my($self,$dir) = @_; + return unless -e $dir; + unless (File::Spec->canonpath(File::Basename::dirname($dir)) + eq File::Spec->canonpath($CPAN::Config->{build_dir})) { + $CPAN::Frontend->mywarn("Directory '$dir' not below $CPAN::Config->{build_dir}, ". + "will not remove\n"); + $CPAN::Frontend->mysleep(5); + return; + } + $self->debug("have to rmtree $dir, will free $self->{SIZE}{$dir}") + if $CPAN::DEBUG; + File::Path::rmtree($dir); + my $id_deleted = 0; + if ($dir !~ /\.yml$/ && -f "$dir.yml") { + my $yaml_module = CPAN::_yaml_module(); + if ($CPAN::META->has_inst($yaml_module)) { + my($peek_yaml) = eval { CPAN->_yaml_loadfile("$dir.yml"); }; + if ($@) { + $CPAN::Frontend->mywarn("(parse error on '$dir.yml' removing anyway)"); + unlink "$dir.yml" or + $CPAN::Frontend->mywarn("(Could not unlink '$dir.yml': $!)"); + return; + } elsif (my $id = $peek_yaml->[0]{distribution}{ID}) { + $CPAN::META->delete("CPAN::Distribution", $id); + + # XXX we should restore the state NOW, otherwise this + # distro does not exist until we read an index. BUG ALERT(?) + + # $CPAN::Frontend->mywarn (" +++\n"); + $id_deleted++; + } + } + unlink "$dir.yml"; # may fail + unless ($id_deleted) { + CPAN->debug("no distro found associated with '$dir'"); + } + } + $self->{DU} -= $self->{SIZE}{$dir}; + delete $self->{SIZE}{$dir}; +} + +#-> sub CPAN::CacheMgr::new ; +sub new { + my($class,$phase) = @_; + $phase ||= "atstart"; + my $time = time; + my($debug,$t2); + $debug = ""; + my $self = { + ID => $CPAN::Config->{build_dir}, + MAX => $CPAN::Config->{'build_cache'}, + SCAN => $CPAN::Config->{'scan_cache'} || 'atstart', + DU => 0 + }; + $CPAN::Frontend->mydie("Unknown scan_cache argument: $self->{SCAN}") + unless $self->{SCAN} =~ /never|atstart|atexit/; + File::Path::mkpath($self->{ID}); + my $dh = DirHandle->new($self->{ID}); + bless $self, $class; + $self->scan_cache($phase); + $t2 = time; + $debug .= "timing of CacheMgr->new: ".($t2 - $time); + $time = $t2; + CPAN->debug($debug) if $CPAN::DEBUG; + $self; +} + +#-> sub CPAN::CacheMgr::scan_cache ; +sub scan_cache { + my ($self, $phase) = @_; + $phase = '' unless defined $phase; + return unless $phase eq $self->{SCAN}; + return unless $CPAN::META->{LOCK}; + $CPAN::Frontend->myprint( + sprintf("Scanning cache %s for sizes\n", + $self->{ID})); + my $e; + my @entries = $self->entries($self->{ID}); + my $i = 0; + my $painted = 0; + for $e (@entries) { + my $symbol = "."; + if ($self->{DU} > $self->{MAX}) { + $symbol = "-"; + $self->disk_usage($e,1); + } else { + $self->disk_usage($e); + } + $i++; + while (($painted/76) < ($i/@entries)) { + $CPAN::Frontend->myprint($symbol); + $painted++; + } + return if $CPAN::Signal; + } + $CPAN::Frontend->myprint("DONE\n"); + $self->tidyup; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Complete.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Complete.pm new file mode 100644 index 0000000000000000000000000000000000000000..588e6e6c2cff3c126e12e1f2546bcbff6d3c3392 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Complete.pm @@ -0,0 +1,175 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Complete; +use strict; +@CPAN::Complete::ISA = qw(CPAN::Debug); +# Q: where is the "How do I add a new command" HOWTO? +# A: git log -p -1 355c44e9caaec857e4b12f51afb96498833c3e36 where andk added the report command +@CPAN::Complete::COMMANDS = sort qw( + ? ! a b d h i m o q r u + autobundle + bye + clean + cvs_import + dump + exit + failed + force + fforce + hosts + install + install_tested + is_tested + look + ls + make + mkmyconfig + notest + perldoc + quit + readme + recent + recompile + reload + report + reports + scripts + smoke + test + upgrade +); + +use vars qw( + $VERSION +); +$VERSION = "5.5001"; + +package CPAN::Complete; +use strict; + +sub gnu_cpl { + my($text, $line, $start, $end) = @_; + my(@perlret) = cpl($text, $line, $start); + # find longest common match. Can anybody show me how to peruse + # T::R::Gnu to have this done automatically? Seems expensive. + return () unless @perlret; + my($newtext) = $text; + for (my $i = length($text)+1;;$i++) { + last unless length($perlret[0]) && length($perlret[0]) >= $i; + my $try = substr($perlret[0],0,$i); + my @tries = grep {substr($_,0,$i) eq $try} @perlret; + # warn "try[$try]tries[@tries]"; + if (@tries == @perlret) { + $newtext = $try; + } else { + last; + } + } + ($newtext,@perlret); +} + +#-> sub CPAN::Complete::cpl ; +sub cpl { + my($word,$line,$pos) = @_; + $word ||= ""; + $line ||= ""; + $pos ||= 0; + CPAN->debug("word [$word] line[$line] pos[$pos]") if $CPAN::DEBUG; + $line =~ s/^\s*//; + if ($line =~ s/^((?:notest|f?force)\s*)//) { + $pos -= length($1); + } + my @return; + if ($pos == 0 || $line =~ /^(?:h(?:elp)?|\?)\s/) { + @return = grep /^\Q$word\E/, @CPAN::Complete::COMMANDS; + } elsif ( $line !~ /^[\!abcdghimorutl]/ ) { + @return = (); + } elsif ($line =~ /^a\s/) { + @return = cplx('CPAN::Author',uc($word)); + } elsif ($line =~ /^ls\s/) { + my($author,$rest) = $word =~ m|([^/]+)/?(.*)|; + @return = $rest ? () : map {"$_/"} cplx('CPAN::Author',uc($author||"")); + if (0 && 1==@return) { # XXX too slow and even wrong when there is a * already + @return = grep /^\Q$word\E/, map {"$author/$_->[2]"} CPAN::Shell->expand("Author",$author)->ls("$rest*","2"); + } + } elsif ($line =~ /^b\s/) { + CPAN::Shell->local_bundles; + @return = cplx('CPAN::Bundle',$word); + } elsif ($line =~ /^d\s/) { + @return = cplx('CPAN::Distribution',$word); + } elsif ($line =~ m/^( + [mru]|make|clean|dump|get|test|install|readme|look|cvs_import|perldoc|recent + )\s/x ) { + if ($word =~ /^Bundle::/) { + CPAN::Shell->local_bundles; + } + @return = (cplx('CPAN::Module',$word),cplx('CPAN::Bundle',$word)); + } elsif ($line =~ /^i\s/) { + @return = cpl_any($word); + } elsif ($line =~ /^reload\s/) { + @return = cpl_reload($word,$line,$pos); + } elsif ($line =~ /^o\s/) { + @return = cpl_option($word,$line,$pos); + } elsif ($line =~ m/^\S+\s/ ) { + # fallback for future commands and what we have forgotten above + @return = (cplx('CPAN::Module',$word),cplx('CPAN::Bundle',$word)); + } else { + @return = (); + } + return @return; +} + +#-> sub CPAN::Complete::cplx ; +sub cplx { + my($class, $word) = @_; + if (CPAN::_sqlite_running()) { + $CPAN::SQLite->search($class, "^\Q$word\E"); + } + my $method = "id"; + $method = "pretty_id" if $class eq "CPAN::Distribution"; + sort grep /^\Q$word\E/, map { $_->$method() } $CPAN::META->all_objects($class); +} + +#-> sub CPAN::Complete::cpl_any ; +sub cpl_any { + my($word) = shift; + return ( + cplx('CPAN::Author',$word), + cplx('CPAN::Bundle',$word), + cplx('CPAN::Distribution',$word), + cplx('CPAN::Module',$word), + ); +} + +#-> sub CPAN::Complete::cpl_reload ; +sub cpl_reload { + my($word,$line,$pos) = @_; + $word ||= ""; + my(@words) = split " ", $line; + CPAN->debug("word[$word] line[$line] pos[$pos]") if $CPAN::DEBUG; + my(@ok) = qw(cpan index); + return @ok if @words == 1; + return grep /^\Q$word\E/, @ok if @words == 2 && $word; +} + +#-> sub CPAN::Complete::cpl_option ; +sub cpl_option { + my($word,$line,$pos) = @_; + $word ||= ""; + my(@words) = split " ", $line; + CPAN->debug("word[$word] line[$line] pos[$pos]") if $CPAN::DEBUG; + my(@ok) = qw(conf debug); + return @ok if @words == 1; + return grep /^\Q$word\E/, @ok if @words == 2 && length($word); + if (0) { + } elsif ($words[1] eq 'index') { + return (); + } elsif ($words[1] eq 'conf') { + return CPAN::HandleConfig::cpl(@_); + } elsif ($words[1] eq 'debug') { + return sort grep /^\Q$word\E/i, + sort keys %CPAN::DEBUG, 'all'; + } +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Debug.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Debug.pm new file mode 100644 index 0000000000000000000000000000000000000000..48e394bd4196ceef61ec89673c624f73f153d1ae --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Debug.pm @@ -0,0 +1,83 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +package CPAN::Debug; +use strict; +use vars qw($VERSION); + +$VERSION = "5.5001"; +# module is internal to CPAN.pm + +%CPAN::DEBUG = qw[ + CPAN 1 + Index 2 + InfoObj 4 + Author 8 + Distribution 16 + Bundle 32 + Module 64 + CacheMgr 128 + Complete 256 + FTP 512 + Shell 1024 + Eval 2048 + HandleConfig 4096 + Tarzip 8192 + Version 16384 + Queue 32768 + FirstTime 65536 +]; + +$CPAN::DEBUG ||= 0; + +#-> sub CPAN::Debug::debug ; +sub debug { + my($self,$arg) = @_; + + my @caller; + my $i = 0; + while () { + my(@c) = (caller($i))[0 .. ($i ? 3 : 2)]; + last unless defined $c[0]; + push @caller, \@c; + for (0,3) { + last if $_ > $#c; + $c[$_] =~ s/.*:://; + } + for (1) { + $c[$_] =~ s|.*/||; + } + last if ++$i>=3; + } + pop @caller; + if ($CPAN::DEBUG{$caller[0][0]} & $CPAN::DEBUG) { + if ($arg and ref $arg) { + eval { require Data::Dumper }; + if ($@) { + $CPAN::Frontend->myprint("Debug(\n" . $arg->as_string . ")\n"); + } else { + $CPAN::Frontend->myprint("Debug(\n" . Data::Dumper::Dumper($arg) . ")\n"); + } + } else { + my $outer = ""; + local $" = ","; + if (@caller>1) { + $outer = ",[@{$caller[1]}]"; + } + $CPAN::Frontend->myprint("Debug(@{$caller[0]}$outer): $arg\n"); + } + } +} + +1; + +__END__ + +=head1 NAME + +CPAN::Debug - internal debugging for CPAN.pm + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/DeferredCode.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/DeferredCode.pm new file mode 100644 index 0000000000000000000000000000000000000000..0db37a64853417f25e050bb227306fcf62546f88 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/DeferredCode.pm @@ -0,0 +1,16 @@ +package CPAN::DeferredCode; + +use strict; +use vars qw/$VERSION/; + +use overload fallback => 1, map { ($_ => 'run') } qw/ + bool "" 0+ +/; + +$VERSION = "5.50"; + +sub run { + $_[0]->(); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Distribution.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Distribution.pm new file mode 100644 index 0000000000000000000000000000000000000000..341210853958bc80494382e3480faa5993fc44d5 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Distribution.pm @@ -0,0 +1,4862 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Distribution; +use strict; +use Cwd qw(chdir); +use CPAN::Distroprefs; +use CPAN::InfoObj; +use File::Path (); +use POSIX ":sys_wait_h"; +@CPAN::Distribution::ISA = qw(CPAN::InfoObj); +use vars qw($VERSION); +$VERSION = "2.27"; + +my $run_allow_installing_within_test = 1; # boolean; either in test or in install, there is no third option + +# no prepare, because prepare is not a command on the shell command line +# TODO: clear instance cache on reload +my %instance; +for my $method (qw(get make test install)) { + no strict 'refs'; + for my $prefix (qw(pre post)) { + my $hookname = sprintf "%s_%s", $prefix, $method; + *$hookname = sub { + my($self) = @_; + for my $plugin (@{$CPAN::Config->{plugin_list}}) { + my($plugin_proper,$args) = split /=/, $plugin, 2; + $args = "" unless defined $args; + if ($CPAN::META->has_inst($plugin_proper)){ + my @args = split /,/, $args; + $instance{$plugin} ||= $plugin_proper->new(@args); + if ($instance{$plugin}->can($hookname)) { + $instance{$plugin}->$hookname($self); + } + } else { + $CPAN::Frontend->mydie("Plugin '$plugin_proper' not found for hook '$hookname'"); + } + } + }; + } +} + +# Accessors +sub cpan_comment { + my $self = shift; + my $ro = $self->ro or return; + $ro->{CPAN_COMMENT} +} + +#-> CPAN::Distribution::undelay +sub undelay { + my $self = shift; + for my $delayer ( + "configure_requires_later", + "configure_requires_later_for", + "later", + "later_for", + ) { + delete $self->{$delayer}; + } +} + +#-> CPAN::Distribution::is_dot_dist +sub is_dot_dist { + my($self) = @_; + return substr($self->id,-1,1) eq "."; +} + +# add the A/AN/ stuff +#-> CPAN::Distribution::normalize +sub normalize { + my($self,$s) = @_; + $s = $self->id unless defined $s; + if (substr($s,-1,1) eq ".") { + # using a global because we are sometimes called as static method + if (!$CPAN::META->{LOCK} + && !$CPAN::Have_warned->{"$s is unlocked"}++ + ) { + $CPAN::Frontend->mywarn("You are visiting the local directory + '$s' + without lock, take care that concurrent processes do not do likewise.\n"); + $CPAN::Frontend->mysleep(1); + } + if ($s eq ".") { + $s = "$CPAN::iCwd/."; + } elsif (File::Spec->file_name_is_absolute($s)) { + } elsif (File::Spec->can("rel2abs")) { + $s = File::Spec->rel2abs($s); + } else { + $CPAN::Frontend->mydie("Your File::Spec is too old, please upgrade File::Spec"); + } + CPAN->debug("s[$s]") if $CPAN::DEBUG; + unless ($CPAN::META->exists("CPAN::Distribution", $s)) { + for ($CPAN::META->instance("CPAN::Distribution", $s)) { + $_->{build_dir} = $s; + $_->{archived} = "local_directory"; + $_->{unwrapped} = CPAN::Distrostatus->new("YES -- local_directory"); + } + } + } elsif ( + $s =~ tr|/|| == 1 + or + $s !~ m|[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/| + ) { + return $s if $s =~ m:^N/A|^Contact Author: ; + $s =~ s|^(.)(.)([^/]*/)(.+)$|$1/$1$2/$1$2$3$4|; + CPAN->debug("s[$s]") if $CPAN::DEBUG; + } + $s; +} + +#-> sub CPAN::Distribution::author ; +sub author { + my($self) = @_; + my($authorid); + if (substr($self->id,-1,1) eq ".") { + $authorid = "LOCAL"; + } else { + ($authorid) = $self->pretty_id =~ /^([\w\-]+)/; + } + CPAN::Shell->expand("Author",$authorid); +} + +# tries to get the yaml from CPAN instead of the distro itself: +# EXPERIMENTAL, UNDOCUMENTED AND UNTESTED, for Tels +sub fast_yaml { + my($self) = @_; + my $meta = $self->pretty_id; + $meta =~ s/\.(tar.gz|tgz|zip|tar.bz2)/.meta/; + my(@ls) = CPAN::Shell->globls($meta); + my $norm = $self->normalize($meta); + + my($local_file); + my($local_wanted) = + File::Spec->catfile( + $CPAN::Config->{keep_source_where}, + "authors", + "id", + split(/\//,$norm) + ); + $self->debug("Doing localize") if $CPAN::DEBUG; + unless ($local_file = + CPAN::FTP->localize("authors/id/$norm", + $local_wanted)) { + $CPAN::Frontend->mydie("Giving up on downloading yaml file '$local_wanted'\n"); + } + my $yaml = CPAN->_yaml_loadfile($local_file)->[0]; +} + +#-> sub CPAN::Distribution::cpan_userid +sub cpan_userid { + my $self = shift; + if ($self->{ID} =~ m{[A-Z]/[A-Z\-]{2}/([A-Z\-]+)/}) { + return $1; + } + return $self->SUPER::cpan_userid; +} + +#-> sub CPAN::Distribution::pretty_id +sub pretty_id { + my $self = shift; + my $id = $self->id; + return $id unless $id =~ m|^./../|; + substr($id,5); +} + +#-> sub CPAN::Distribution::base_id +sub base_id { + my $self = shift; + my $id = $self->pretty_id(); + my $base_id = File::Basename::basename($id); + $base_id =~ s{\.(?:tar\.(bz2|gz|Z)|t(?:gz|bz)|zip)$}{}i; + return $base_id; +} + +#-> sub CPAN::Distribution::tested_ok_but_not_installed +sub tested_ok_but_not_installed { + my $self = shift; + return ( + $self->{make_test} + && $self->{build_dir} + && (UNIVERSAL::can($self->{make_test},"failed") ? + ! $self->{make_test}->failed : + $self->{make_test} =~ /^YES/ + ) + && ( + !$self->{install} + || + $self->{install}->failed + ) + ); +} + + +# mark as dirty/clean for the sake of recursion detection. $color=1 +# means "in use", $color=0 means "not in use anymore". $color=2 means +# we have determined prereqs now and thus insist on passing this +# through (at least) once again. + +#-> sub CPAN::Distribution::color_cmd_tmps ; +sub color_cmd_tmps { + my($self) = shift; + my($depth) = shift || 0; + my($color) = shift || 0; + my($ancestors) = shift || []; + # a distribution needs to recurse into its prereq_pms + $self->debug("color_cmd_tmps[$depth,$color,@$ancestors]") if $CPAN::DEBUG; + + return if exists $self->{incommandcolor} + && $color==1 + && $self->{incommandcolor}==$color; + $CPAN::MAX_RECURSION||=0; # silence 'once' warnings + if ($depth>=$CPAN::MAX_RECURSION) { + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } + } + # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; + my $prereq_pm = $self->prereq_pm; + if (defined $prereq_pm) { + # XXX also optional_req & optional_breq? -- xdg, 2012-04-01 + # A: no, optional deps may recurse -- ak, 2014-05-07 + PREREQ: for my $pre (sort( + keys %{$prereq_pm->{requires}||{}}, + keys %{$prereq_pm->{build_requires}||{}}, + )) { + next PREREQ if $pre eq "perl"; + my $premo; + unless ($premo = CPAN::Shell->expand("Module",$pre)) { + $CPAN::Frontend->mywarn("prerequisite module[$pre] not known\n"); + $CPAN::Frontend->mysleep(0.2); + next PREREQ; + } + $premo->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]); + } + } + if ($color==0) { + delete $self->{sponsored_mods}; + + # as we are at the end of a command, we'll give up this + # reminder of a broken test. Other commands may test this guy + # again. Maybe 'badtestcnt' should be renamed to + # 'make_test_failed_within_command'? + delete $self->{badtestcnt}; + } + $self->{incommandcolor} = $color; +} + +#-> sub CPAN::Distribution::as_string ; +sub as_string { + my $self = shift; + $self->containsmods; + $self->upload_date; + $self->SUPER::as_string(@_); +} + +#-> sub CPAN::Distribution::containsmods ; +sub containsmods { + my $self = shift; + return sort keys %{$self->{CONTAINSMODS}} if exists $self->{CONTAINSMODS}; + my $dist_id = $self->{ID}; + for my $mod ($CPAN::META->all_objects("CPAN::Module")) { + my $mod_file = $mod->cpan_file or next; + my $mod_id = $mod->{ID} or next; + # warn "mod_file[$mod_file] dist_id[$dist_id] mod_id[$mod_id]"; + # sleep 1; + if ($CPAN::Signal) { + delete $self->{CONTAINSMODS}; + return; + } + $self->{CONTAINSMODS}{$mod_id} = undef if $mod_file eq $dist_id; + } + sort keys %{$self->{CONTAINSMODS}||={}}; +} + +#-> sub CPAN::Distribution::upload_date ; +sub upload_date { + my $self = shift; + return $self->{UPLOAD_DATE} if exists $self->{UPLOAD_DATE}; + my(@local_wanted) = split(/\//,$self->id); + my $filename = pop @local_wanted; + push @local_wanted, "CHECKSUMS"; + my $author = CPAN::Shell->expand("Author",$self->cpan_userid); + return unless $author; + my @dl = $author->dir_listing(\@local_wanted,0,$CPAN::Config->{show_upload_date}); + return unless @dl; + my($dirent) = grep { $_->[2] eq $filename } @dl; + # warn sprintf "dirent[%s]id[%s]", $dirent, $self->id; + return unless $dirent->[1]; + return $self->{UPLOAD_DATE} = $dirent->[1]; +} + +#-> sub CPAN::Distribution::uptodate ; +sub uptodate { + my($self) = @_; + my $c; + foreach $c ($self->containsmods) { + my $obj = CPAN::Shell->expandany($c); + unless ($obj->uptodate) { + my $id = $self->pretty_id; + $self->debug("$id not uptodate due to $c") if $CPAN::DEBUG; + return 0; + } + } + return 1; +} + +#-> sub CPAN::Distribution::called_for ; +sub called_for { + my($self,$id) = @_; + $self->{CALLED_FOR} = $id if defined $id; + return $self->{CALLED_FOR}; +} + +#-> sub CPAN::Distribution::shortcut_get ; +# return values: undef means don't shortcut; 0 means shortcut as fail; +# and 1 means shortcut as success +sub shortcut_get { + my ($self) = @_; + + if (exists $self->{cleanup_after_install_done}) { + if ($self->{force_update}) { + delete $self->{cleanup_after_install_done}; + } else { + my $id = $self->{CALLED_FOR} || $self->pretty_id; + return $self->success( + "Has already been *installed and cleaned up in the staging area* within this session, will not work on it again; if you really want to start over, try something like `force get $id`" + ); + } + } + + if (my $why = $self->check_disabled) { + $self->{unwrapped} = CPAN::Distrostatus->new("NO $why"); + # XXX why is this goodbye() instead of just print/warn? + # Alternatively, should other print/warns here be goodbye()? + # -- xdg, 2012-04-05 + return $self->goodbye("[disabled] -- NA $why"); + } + + $self->debug("checking already unwrapped[$self->{ID}]") if $CPAN::DEBUG; + if (exists $self->{build_dir} && -d $self->{build_dir}) { + # this deserves print, not warn: + return $self->success("Has already been unwrapped into directory ". + "$self->{build_dir}" + ); + } + + # XXX I'm not sure this should be here because it's not really + # a test for whether get should continue or return; this is + # a side effect -- xdg, 2012-04-05 + $self->debug("checking missing build_dir[$self->{ID}]") if $CPAN::DEBUG; + if (exists $self->{build_dir} && ! -d $self->{build_dir}){ + # we have lost it. + $self->fforce(""); # no method to reset all phases but not set force (dodge) + return undef; # no shortcut + } + + # although we talk about 'force' we shall not test on + # force directly. New model of force tries to refrain from + # direct checking of force. + $self->debug("checking unwrapping error[$self->{ID}]") if $CPAN::DEBUG; + if ( exists $self->{unwrapped} and ( + UNIVERSAL::can($self->{unwrapped},"failed") ? + $self->{unwrapped}->failed : + $self->{unwrapped} =~ /^NO/ ) + ) { + return $self->goodbye("Unwrapping had some problem, won't try again without force"); + } + + return undef; # no shortcut +} + +#-> sub CPAN::Distribution::get ; +sub get { + my($self) = @_; + + $self->pre_get(); + + $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG; + if (my $goto = $self->prefs->{goto}) { + $self->post_get(); + return $self->goto($goto); + } + + if ( defined( my $sc = $self->shortcut_get) ) { + $self->post_get(); + return $sc; + } + + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + # local $ENV{PERL_USE_UNSAFE_INC} = exists $ENV{PERL_USE_UNSAFE_INC} ? $ENV{PERL_USE_UNSAFE_INC} : 1; # get + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + + my $sub_wd = CPAN::anycwd(); # for cleaning up as good as possible + + my($local_file); + # XXX I don't think this check needs to be here, as it + # is already checked in shortcut_get() -- xdg, 2012-04-05 + unless ($self->{build_dir} && -d $self->{build_dir}) { + $self->get_file_onto_local_disk; + if ($CPAN::Signal){ + $self->post_get(); + return; + } + $self->check_integrity; + if ($CPAN::Signal){ + $self->post_get(); + return; + } + (my $packagedir,$local_file) = $self->run_preps_on_packagedir; + # XXX why is this check here? -- xdg, 2012-04-08 + if (exists $self->{writemakefile} && ref $self->{writemakefile} + && $self->{writemakefile}->can("failed") && + $self->{writemakefile}->failed) { + # + $self->post_get(); + return; + } + $packagedir ||= $self->{build_dir}; + $self->{build_dir} = $packagedir; + } + + # XXX should this move up to after run_preps_on_packagedir? + # Otherwise, failing writemakefile can return without + # a $CPAN::Signal check -- xdg, 2012-04-05 + if ($CPAN::Signal) { + $self->safe_chdir($sub_wd); + $self->post_get(); + return; + } + unless ($self->patch){ + $self->post_get(); + return; + } + $self->store_persistent_state; + + $self->post_get(); + + return 1; # success +} + +#-> CPAN::Distribution::get_file_onto_local_disk +sub get_file_onto_local_disk { + my($self) = @_; + + return if $self->is_dot_dist; + my($local_file); + my($local_wanted) = + File::Spec->catfile( + $CPAN::Config->{keep_source_where}, + "authors", + "id", + split(/\//,$self->id) + ); + + $self->debug("Doing localize") if $CPAN::DEBUG; + unless ($local_file = + CPAN::FTP->localize("authors/id/$self->{ID}", + $local_wanted)) { + my $note = ""; + if ($CPAN::Index::DATE_OF_02) { + $note = "Note: Current database in memory was generated ". + "on $CPAN::Index::DATE_OF_02\n"; + } + $CPAN::Frontend->mydie("Giving up on '$local_wanted'\n$note"); + } + + $self->debug("local_wanted[$local_wanted]local_file[$local_file]") if $CPAN::DEBUG; + $self->{localfile} = $local_file; +} + + +#-> CPAN::Distribution::check_integrity +sub check_integrity { + my($self) = @_; + + return if $self->is_dot_dist; + if ($CPAN::META->has_inst("Digest::SHA")) { + $self->debug("Digest::SHA is installed, verifying"); + $self->verifyCHECKSUM; + } else { + $self->debug("Digest::SHA is NOT installed"); + } +} + +#-> CPAN::Distribution::run_preps_on_packagedir +sub run_preps_on_packagedir { + my($self) = @_; + return if $self->is_dot_dist; + + $CPAN::META->{cachemgr} ||= CPAN::CacheMgr->new(); # unsafe meta access, ok + my $builddir = $CPAN::META->{cachemgr}->dir; # unsafe meta access, ok + $self->safe_chdir($builddir); + $self->debug("Removing tmp-$$") if $CPAN::DEBUG; + File::Path::rmtree("tmp-$$"); + unless (mkdir "tmp-$$", 0755) { + $CPAN::Frontend->unrecoverable_error(<safe_chdir("tmp-$$"); + + # + # Unpack the goods + # + my $local_file = $self->{localfile}; + my $ct = eval{CPAN::Tarzip->new($local_file)}; + unless ($ct) { + $self->{unwrapped} = CPAN::Distrostatus->new("NO"); + delete $self->{build_dir}; + return; + } + if ($local_file =~ /(\.tar\.(bz2|gz|Z)|\.tgz)(?!\n)\Z/i) { + $self->{was_uncompressed}++ unless eval{$ct->gtest()}; + $self->untar_me($ct); + } elsif ( $local_file =~ /\.zip(?!\n)\Z/i ) { + $self->unzip_me($ct); + } else { + $self->{was_uncompressed}++ unless $ct->gtest(); + $local_file = $self->handle_singlefile($local_file); + } + + # we are still in the tmp directory! + # Let's check if the package has its own directory. + my $dh = DirHandle->new(File::Spec->curdir) + or Carp::croak("Couldn't opendir .: $!"); + my @readdir = grep $_ !~ /^\.\.?(?!\n)\Z/s, $dh->read; ### MAC?? + if (grep { $_ eq "pax_global_header" } @readdir) { + $CPAN::Frontend->mywarn("Your (un)tar seems to have extracted a file named 'pax_global_header' +from the tarball '$local_file'. +This is almost certainly an error. Please upgrade your tar. +I'll ignore this file for now. +See also http://rt.cpan.org/Ticket/Display.html?id=38932\n"); + $CPAN::Frontend->mysleep(5); + @readdir = grep { $_ ne "pax_global_header" } @readdir; + } + $dh->close; + my $tdir_base; + my $from_dir; + my @dirents; + if (@readdir == 1 && -d $readdir[0]) { + $tdir_base = $readdir[0]; + $from_dir = File::Spec->catdir(File::Spec->curdir,$readdir[0]); + my($mode) = (stat $from_dir)[2]; + chmod $mode | 00755, $from_dir; # JONATHAN/Math-Calculus-TaylorSeries-0.1.tar.gz has 0644 + my $dh2; + unless ($dh2 = DirHandle->new($from_dir)) { + my $why = sprintf + ( + "Couldn't opendir '%s', mode '%o': %s", + $from_dir, + $mode, + $!, + ); + $CPAN::Frontend->mywarn("$why\n"); + $self->{writemakefile} = CPAN::Distrostatus->new("NO -- $why"); + return; + } + @dirents = grep $_ !~ /^\.\.?(?!\n)\Z/s, $dh2->read; ### MAC?? + } else { + my $userid = $self->cpan_userid; + CPAN->debug("userid[$userid]"); + if (!$userid or $userid eq "N/A") { + $userid = "anon"; + } + $tdir_base = $userid; + $from_dir = File::Spec->curdir; + @dirents = @readdir; + } + my $packagedir; + my $eexist = ($CPAN::META->has_usable("Errno") && defined &Errno::EEXIST) + ? &Errno::EEXIST : undef; + for(my $suffix = 0; ; $suffix++) { + $packagedir = File::Spec->catdir($builddir, "$tdir_base-$suffix"); + my $parent = $builddir; + mkdir($packagedir, 0777) and last; + if((defined($eexist) && $! != $eexist) || $suffix == 999) { + $CPAN::Frontend->mydie("Cannot create directory $packagedir: $!\n"); + } + } + my $f; + for $f (@dirents) { # is already without "." and ".." + my $from = File::Spec->catfile($from_dir,$f); + my($mode) = (stat $from)[2]; + chmod $mode | 00755, $from if -d $from; # OTTO/Pod-Trial-LinkImg-0.005.tgz + my $to = File::Spec->catfile($packagedir,$f); + unless (File::Copy::move($from,$to)) { + my $err = $!; + $from = File::Spec->rel2abs($from); + $CPAN::Frontend->mydie( + "Couldn't move $from to $to: $err; #82295? ". + "CPAN::VERSION=$CPAN::VERSION; ". + "File::Copy::VERSION=$File::Copy::VERSION; ". + "$from " . (-e $from ? "exists; " : "does not exist; "). + "$to " . (-e $to ? "exists; " : "does not exist; "). + "cwd=" . CPAN::anycwd() . ";" + ); + } + } + $self->{build_dir} = $packagedir; + $self->safe_chdir($builddir); + File::Path::rmtree("tmp-$$"); + + $self->safe_chdir($packagedir); + $self->_signature_business(); + $self->safe_chdir($builddir); + + return($packagedir,$local_file); +} + +#-> sub CPAN::Distribution::pick_meta_file ; +sub pick_meta_file { + my($self, $filter) = @_; + $filter = '.' unless defined $filter; + + my $build_dir; + unless ($build_dir = $self->{build_dir}) { + # maybe permission on build_dir was missing + $CPAN::Frontend->mywarn("Warning: cannot determine META.yml without a build_dir.\n"); + return; + } + + my $has_cm = $CPAN::META->has_usable("CPAN::Meta"); + my $has_pcm = $CPAN::META->has_usable("Parse::CPAN::Meta"); + + my @choices; + push @choices, 'MYMETA.json' if $has_cm; + push @choices, 'MYMETA.yml' if $has_cm || $has_pcm; + push @choices, 'META.json' if $has_cm; + push @choices, 'META.yml' if $has_cm || $has_pcm; + + for my $file ( grep { /$filter/ } @choices ) { + my $path = File::Spec->catfile( $build_dir, $file ); + return $path if -f $path + } + + return; +} + +#-> sub CPAN::Distribution::parse_meta_yml ; +sub parse_meta_yml { + my($self, $yaml) = @_; + $self->debug(sprintf("parse_meta_yml[%s]",$yaml||'undef')) if $CPAN::DEBUG; + my $build_dir = $self->{build_dir} or die "PANIC: cannot parse yaml without a build_dir"; + $yaml ||= File::Spec->catfile($build_dir,"META.yml"); + $self->debug("meta[$yaml]") if $CPAN::DEBUG; + return unless -f $yaml; + my $early_yaml; + eval { + $CPAN::META->has_inst("Parse::CPAN::Meta") or die; + die "Parse::CPAN::Meta yaml too old" unless $Parse::CPAN::Meta::VERSION >= "1.40"; + # P::C::M returns last document in scalar context + $early_yaml = Parse::CPAN::Meta::LoadFile($yaml); + }; + unless ($early_yaml) { + eval { $early_yaml = CPAN->_yaml_loadfile($yaml)->[0]; }; + } + $self->debug(sprintf("yaml[%s]", $early_yaml || 'UNDEF')) if $CPAN::DEBUG; + $self->debug($early_yaml) if $CPAN::DEBUG && $early_yaml; + if (!ref $early_yaml or ref $early_yaml ne "HASH"){ + # fix rt.cpan.org #95271 + $CPAN::Frontend->mywarn("The content of '$yaml' is not a HASH reference. Cannot use it.\n"); + return {}; + } + return $early_yaml || undef; +} + +#-> sub CPAN::Distribution::satisfy_requires ; +# return values: 1 means requirements are satisfied; +# and 0 means not satisfied (and maybe queued) +sub satisfy_requires { + my ($self) = @_; + $self->debug("Entering satisfy_requires") if $CPAN::DEBUG; + if (my @prereq = $self->unsat_prereq("later")) { + if ($CPAN::DEBUG){ + require Data::Dumper; + my $prereq = Data::Dumper->new(\@prereq)->Terse(1)->Indent(0)->Dump; + $self->debug("unsatisfied[$prereq]"); + } + if ($prereq[0][0] eq "perl") { + my $need = "requires perl '$prereq[0][1]'"; + my $id = $self->pretty_id; + $CPAN::Frontend->mywarn("$id $need; you have only $]; giving up\n"); + $self->{make} = CPAN::Distrostatus->new("NO $need"); + $self->store_persistent_state; + die "[prereq] -- NOT OK\n"; + } else { + my $follow = eval { $self->follow_prereqs("later",@prereq); }; + if (0) { + } elsif ($follow) { + return; # we need deps + } elsif ($@ && ref $@ && $@->isa("CPAN::Exception::RecursiveDependency")) { + $CPAN::Frontend->mywarn($@); + die "[depend] -- NOT OK\n"; + } + } + } + return 1; +} + +#-> sub CPAN::Distribution::satisfy_configure_requires ; +# return values: 1 means configure_require is satisfied; +# and 0 means not satisfied (and maybe queued) +sub satisfy_configure_requires { + my($self) = @_; + $self->debug("Entering satisfy_configure_requires") if $CPAN::DEBUG; + my $enable_configure_requires = 1; + if (!$enable_configure_requires) { + return 1; + # if we return 1 here, everything is as before we introduced + # configure_requires that means, things with + # configure_requires simply fail, all others succeed + } + my @prereq = $self->unsat_prereq("configure_requires_later"); + $self->debug(sprintf "configure_requires[%s]", join(",",map {join "/",@$_} @prereq)) if $CPAN::DEBUG; + return 1 unless @prereq; + $self->debug(\@prereq) if $CPAN::DEBUG; + if ($self->{configure_requires_later}) { + for my $k (sort keys %{$self->{configure_requires_later_for}||{}}) { + if ($self->{configure_requires_later_for}{$k}>1) { + my $type = ""; + for my $p (@prereq) { + if ($p->[0] eq $k) { + $type = $p->[1]; + } + } + $type = " $type" if $type; + $CPAN::Frontend->mywarn("Warning: unmanageable(?) prerequisite $k$type"); + sleep 1; + } + } + } + if ($prereq[0][0] eq "perl") { + my $need = "requires perl '$prereq[0][1]'"; + my $id = $self->pretty_id; + $CPAN::Frontend->mywarn("$id $need; you have only $]; giving up\n"); + $self->{make} = CPAN::Distrostatus->new("NO $need"); + $self->store_persistent_state; + return $self->goodbye("[prereq] -- NOT OK"); + } else { + my $follow = eval { + $self->follow_prereqs("configure_requires_later", @prereq); + }; + if (0) { + } elsif ($follow) { + return; # we need deps + } elsif ($@ && ref $@ && $@->isa("CPAN::Exception::RecursiveDependency")) { + $CPAN::Frontend->mywarn($@); + return $self->goodbye("[depend] -- NOT OK"); + } + else { + return $self->goodbye("[configure_requires] -- NOT OK"); + } + } + die "never reached"; +} + +#-> sub CPAN::Distribution::choose_MM_or_MB ; +sub choose_MM_or_MB { + my($self) = @_; + $self->satisfy_configure_requires() or return; + my $local_file = $self->{localfile}; + my($mpl) = File::Spec->catfile($self->{build_dir},"Makefile.PL"); + my($mpl_exists) = -f $mpl; + unless ($mpl_exists) { + # NFS has been reported to have racing problems after the + # renaming of a directory in some environments. + # This trick helps. + $CPAN::Frontend->mysleep(1); + my $mpldh = DirHandle->new($self->{build_dir}) + or Carp::croak("Couldn't opendir $self->{build_dir}: $!"); + $mpl_exists = grep /^Makefile\.PL$/, $mpldh->read; + $mpldh->close; + } + my $prefer_installer = "eumm"; # eumm|mb + if (-f File::Spec->catfile($self->{build_dir},"Build.PL")) { + if ($mpl_exists) { # they *can* choose + if ($CPAN::META->has_inst("Module::Build")) { + $prefer_installer = CPAN::HandleConfig->prefs_lookup( + $self, q{prefer_installer} + ); + # M::B <= 0.35 left a DATA handle open that + # causes problems upgrading M::B on Windows + close *Module::Build::Version::DATA + if fileno *Module::Build::Version::DATA; + } + } else { + $prefer_installer = "mb"; + } + } + if (lc($prefer_installer) eq "rand") { + $prefer_installer = rand()<.5 ? "eumm" : "mb"; + } + if (lc($prefer_installer) eq "mb") { + $self->{modulebuild} = 1; + } elsif ($self->{archived} eq "patch") { + # not an edge case, nothing to install for sure + my $why = "A patch file cannot be installed"; + $CPAN::Frontend->mywarn("Refusing to handle this file: $why\n"); + $self->{writemakefile} = CPAN::Distrostatus->new("NO $why"); + } elsif (! $mpl_exists) { + $self->_edge_cases($mpl,$local_file); + } + if ($self->{build_dir} + && + $CPAN::Config->{build_dir_reuse} + ) { + $self->store_persistent_state; + } + return $self; +} + +# see also reanimate_build_dir +#-> CPAN::Distribution::store_persistent_state +sub store_persistent_state { + my($self) = @_; + my $dir = $self->{build_dir}; + unless (defined $dir && length $dir) { + my $id = $self->id; + $CPAN::Frontend->mywarnonce("build_dir of $id is not known, ". + "will not store persistent state\n"); + return; + } + # self-build-dir + my $sbd = Cwd::realpath( + File::Spec->catdir($dir, File::Spec->updir ()) + ); + # config-build-dir + my $cbd = Cwd::realpath( + # the catdir is a workaround for bug https://rt.cpan.org/Ticket/Display.html?id=101283 + File::Spec->catdir($CPAN::Config->{build_dir}, File::Spec->curdir()) + ); + unless ($sbd eq $cbd) { + $CPAN::Frontend->mywarnonce("Directory '$dir' not below $CPAN::Config->{build_dir}, ". + "will not store persistent state\n"); + return; + } + my $file = sprintf "%s.yml", $dir; + my $yaml_module = CPAN::_yaml_module(); + if ($CPAN::META->has_inst($yaml_module)) { + CPAN->_yaml_dumpfile( + $file, + { + time => time, + perl => CPAN::_perl_fingerprint(), + distribution => $self, + } + ); + } else { + $CPAN::Frontend->myprintonce("'$yaml_module' not installed, ". + "will not store persistent state\n"); + } +} + +#-> CPAN::Distribution::try_download +sub try_download { + my($self,$patch) = @_; + my $norm = $self->normalize($patch); + my($local_wanted) = + File::Spec->catfile( + $CPAN::Config->{keep_source_where}, + "authors", + "id", + split(/\//,$norm), + ); + $self->debug("Doing localize") if $CPAN::DEBUG; + return CPAN::FTP->localize("authors/id/$norm", + $local_wanted); +} + +{ + my $stdpatchargs = ""; + #-> CPAN::Distribution::patch + sub patch { + my($self) = @_; + $self->debug("checking patches id[$self->{ID}]") if $CPAN::DEBUG; + my $patches = $self->prefs->{patches}; + $patches ||= ""; + $self->debug("patches[$patches]") if $CPAN::DEBUG; + if ($patches) { + return unless @$patches; + $self->safe_chdir($self->{build_dir}); + CPAN->debug("patches[$patches]") if $CPAN::DEBUG; + my $patchbin = $CPAN::Config->{patch}; + unless ($patchbin && length $patchbin) { + $CPAN::Frontend->mydie("No external patch command configured\n\n". + "Please run 'o conf init /patch/'\n\n"); + } + unless (MM->maybe_command($patchbin)) { + $CPAN::Frontend->mydie("No external patch command available\n\n". + "Please run 'o conf init /patch/'\n\n"); + } + $patchbin = CPAN::HandleConfig->safe_quote($patchbin); + local $ENV{PATCH_GET} = 0; # formerly known as -g0 + unless ($stdpatchargs) { + my $system = "$patchbin --version |"; + local *FH; + open FH, $system or die "Could not fork '$system': $!"; + local $/ = "\n"; + my $pversion; + PARSEVERSION: while () { + if (/^patch\s+([\d\.]+)/) { + $pversion = $1; + last PARSEVERSION; + } + } + if ($pversion) { + $stdpatchargs = "-N --fuzz=3"; + } else { + $stdpatchargs = "-N"; + } + } + my $countedpatches = @$patches == 1 ? "1 patch" : (scalar @$patches . " patches"); + $CPAN::Frontend->myprint("Applying $countedpatches:\n"); + my $patches_dir = $CPAN::Config->{patches_dir}; + for my $patch (@$patches) { + if ($patches_dir && !File::Spec->file_name_is_absolute($patch)) { + my $f = File::Spec->catfile($patches_dir, $patch); + $patch = $f if -f $f; + } + unless (-f $patch) { + CPAN->debug("not on disk: patch[$patch]") if $CPAN::DEBUG; + if (my $trydl = $self->try_download($patch)) { + $patch = $trydl; + } else { + my $fail = "Could not find patch '$patch'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + } + $CPAN::Frontend->myprint(" $patch\n"); + my $readfh = CPAN::Tarzip->TIEHANDLE($patch); + + my $pcommand; + my($ppp,$pfiles) = $self->_patch_p_parameter($readfh); + if ($ppp eq "applypatch") { + $pcommand = "$CPAN::Config->{applypatch} -verbose"; + } else { + my $thispatchargs = join " ", $stdpatchargs, $ppp; + $pcommand = "$patchbin $thispatchargs"; + require Config; # usually loaded from CPAN.pm + if ($Config::Config{osname} eq "solaris") { + # native solaris patch cannot patch readonly files + for my $file (@{$pfiles||[]}) { + my @stat = stat $file or next; + chmod $stat[2] | 0600, $file; # may fail + } + } + } + + $readfh = CPAN::Tarzip->TIEHANDLE($patch); # open again + my $writefh = FileHandle->new; + $CPAN::Frontend->myprint(" $pcommand\n"); + unless (open $writefh, "|$pcommand") { + my $fail = "Could not fork '$pcommand'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + binmode($writefh); + while (my $x = $readfh->READLINE) { + print $writefh $x; + } + unless (close $writefh) { + my $fail = "Could not apply patch '$patch'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + } + $self->{patched}++; + } + return 1; + } +} + +# may return +# - "applypatch" +# - ("-p0"|"-p1", $files) +sub _patch_p_parameter { + my($self,$fh) = @_; + my $cnt_files = 0; + my $cnt_p0files = 0; + my @files; + local($_); + while ($_ = $fh->READLINE) { + if ( + $CPAN::Config->{applypatch} + && + /\#\#\#\# ApplyPatch data follows \#\#\#\#/ + ) { + return "applypatch" + } + next unless /^[\*\+]{3}\s(\S+)/; + my $file = $1; + push @files, $file; + $cnt_files++; + $cnt_p0files++ if -f $file; + CPAN->debug("file[$file]cnt_files[$cnt_files]cnt_p0files[$cnt_p0files]") + if $CPAN::DEBUG; + } + return "-p1" unless $cnt_files; + my $opt_p = $cnt_files==$cnt_p0files ? "-p0" : "-p1"; + return ($opt_p, \@files); +} + +#-> sub CPAN::Distribution::_edge_cases +# with "configure" or "Makefile" or single file scripts +sub _edge_cases { + my($self,$mpl,$local_file) = @_; + $self->debug(sprintf("makefilepl[%s]anycwd[%s]", + $mpl, + CPAN::anycwd(), + )) if $CPAN::DEBUG; + my $build_dir = $self->{build_dir}; + my($configure) = File::Spec->catfile($build_dir,"Configure"); + if (-f $configure) { + # do we have anything to do? + $self->{configure} = $configure; + } elsif (-f File::Spec->catfile($build_dir,"Makefile")) { + $CPAN::Frontend->mywarn(qq{ +Package comes with a Makefile and without a Makefile.PL. +We\'ll try to build it with that Makefile then. +}); + $self->{writemakefile} = CPAN::Distrostatus->new("YES"); + $CPAN::Frontend->mysleep(2); + } else { + my $cf = $self->called_for || "unknown"; + if ($cf =~ m|/|) { + $cf =~ s|.*/||; + $cf =~ s|\W.*||; + } + $cf =~ s|[/\\:]||g; # risk of filesystem damage + $cf = "unknown" unless length($cf); + if (my $crud = $self->_contains_crud($build_dir)) { + my $why = qq{Package contains $crud; not recognized as a perl package, giving up}; + $CPAN::Frontend->mywarn("$why\n"); + $self->{writemakefile} = CPAN::Distrostatus->new(qq{NO -- $why}); + return; + } + $CPAN::Frontend->mywarn(qq{Package seems to come without Makefile.PL. + (The test -f "$mpl" returned false.) + Writing one on our own (setting NAME to $cf)\a\n}); + $self->{had_no_makefile_pl}++; + $CPAN::Frontend->mysleep(3); + + # Writing our own Makefile.PL + + my $exefile_stanza = ""; + if ($self->{archived} eq "maybe_pl") { + $exefile_stanza = $self->_exefile_stanza($build_dir,$local_file); + } + + my $fh = FileHandle->new; + $fh->open(">$mpl") + or Carp::croak("Could not open >$mpl: $!"); + $fh->print( + qq{# This Makefile.PL has been autogenerated by the module CPAN.pm +# because there was no Makefile.PL supplied. +# Autogenerated on: }.scalar localtime().qq{ + +use ExtUtils::MakeMaker; +WriteMakefile( + NAME => q[$cf],$exefile_stanza + ); +}); + $fh->close; + } +} + +#-> CPAN;:Distribution::_contains_crud +sub _contains_crud { + my($self,$dir) = @_; + my(@dirs, $dh, @files); + opendir $dh, $dir or return; + my $dirent; + for $dirent (readdir $dh) { + next if $dirent =~ /^\.\.?$/; + my $path = File::Spec->catdir($dir,$dirent); + if (-d $path) { + push @dirs, $dirent; + } elsif (-f $path) { + push @files, $dirent; + } + } + if (@dirs && @files) { + return "both files[@files] and directories[@dirs]"; + } elsif (@files > 2) { + return "several files[@files] but no Makefile.PL or Build.PL"; + } + return; +} + +#-> CPAN;:Distribution::_exefile_stanza +sub _exefile_stanza { + my($self,$build_dir,$local_file) = @_; + + my $fh = FileHandle->new; + my $script_file = File::Spec->catfile($build_dir,$local_file); + $fh->open($script_file) + or Carp::croak("Could not open script '$script_file': $!"); + local $/ = "\n"; + # parse name and prereq + my($state) = "poddir"; + my($name, $prereq) = ("", ""); + while (<$fh>) { + if ($state eq "poddir" && /^=head\d\s+(\S+)/) { + if ($1 eq 'NAME') { + $state = "name"; + } elsif ($1 eq 'PREREQUISITES') { + $state = "prereq"; + } + } elsif ($state =~ m{^(name|prereq)$}) { + if (/^=/) { + $state = "poddir"; + } elsif (/^\s*$/) { + # nop + } elsif ($state eq "name") { + if ($name eq "") { + ($name) = /^(\S+)/; + $state = "poddir"; + } + } elsif ($state eq "prereq") { + $prereq .= $_; + } + } elsif (/^=cut\b/) { + last; + } + } + $fh->close; + + for ($name) { + s{.*<}{}; # strip X<...> + s{>.*}{}; + } + chomp $prereq; + $prereq = join " ", split /\s+/, $prereq; + my($PREREQ_PM) = join("\n", map { + s{.*<}{}; # strip X<...> + s{>.*}{}; + if (/[\s\'\"]/) { # prose? + } else { + s/[^\w:]$//; # period? + " "x28 . "'$_' => 0,"; + } + } split /\s*,\s*/, $prereq); + + if ($name) { + my $to_file = File::Spec->catfile($build_dir, $name); + rename $script_file, $to_file + or die "Can't rename $script_file to $to_file: $!"; + } + + return " + EXE_FILES => ['$name'], + PREREQ_PM => { +$PREREQ_PM + }, +"; +} + +#-> CPAN::Distribution::_signature_business +sub _signature_business { + my($self) = @_; + my $check_sigs = CPAN::HandleConfig->prefs_lookup($self, + q{check_sigs}); + if ($check_sigs) { + if ($CPAN::META->has_inst("Module::Signature")) { + if (-f "SIGNATURE") { + $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG; + my $rv = Module::Signature::verify(); + if ($rv != Module::Signature::SIGNATURE_OK() and + $rv != Module::Signature::SIGNATURE_MISSING()) { + $CPAN::Frontend->mywarn( + qq{\nSignature invalid for }. + qq{distribution file. }. + qq{Please investigate.\n\n} + ); + + my $wrap = + sprintf(qq{I'd recommend removing %s. Some error occurred }. + qq{while checking its signature, so it could }. + qq{be invalid. Maybe you have configured }. + qq{your 'urllist' with a bad URL. Please check this }. + qq{array with 'o conf urllist' and retry. Or }. + qq{examine the distribution in a subshell. Try + look %s +and run + cpansign -v +}, + $self->{localfile}, + $self->pretty_id, + ); + $self->{signature_verify} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(Text::Wrap::wrap("","",$wrap)); + $CPAN::Frontend->mysleep(5) if $CPAN::Frontend->can("mysleep"); + } else { + $self->{signature_verify} = CPAN::Distrostatus->new("YES"); + $self->debug("Module::Signature has verified") if $CPAN::DEBUG; + } + } else { + $CPAN::Frontend->mywarn(qq{Package came without SIGNATURE\n\n}); + } + } else { + $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG; + } + } +} + +#-> CPAN::Distribution::untar_me ; +sub untar_me { + my($self,$ct) = @_; + $self->{archived} = "tar"; + my $result = eval { $ct->untar() }; + if ($result) { + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); + } else { + # unfortunately we have no $@ here, Tarzip is using mydie which dies with "\n" + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- untar failed"); + } +} + +# CPAN::Distribution::unzip_me ; +sub unzip_me { + my($self,$ct) = @_; + $self->{archived} = "zip"; + if (eval { $ct->unzip() }) { + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); + } else { + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- unzip failed during unzip"); + } + return; +} + +sub handle_singlefile { + my($self,$local_file) = @_; + + if ( $local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/ ) { + $self->{archived} = "pm"; + } elsif ( $local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/ ) { + $self->{archived} = "patch"; + } else { + $self->{archived} = "maybe_pl"; + } + + my $to = File::Basename::basename($local_file); + if ($to =~ s/\.(gz|Z)(?!\n)\Z//) { + if (eval{CPAN::Tarzip->new($local_file)->gunzip($to)}) { + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); + } else { + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed"); + } + } else { + if (File::Copy::cp($local_file,".")) { + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); + } else { + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed"); + } + } + return $to; +} + +#-> sub CPAN::Distribution::new ; +sub new { + my($class,%att) = @_; + + # $CPAN::META->{cachemgr} ||= CPAN::CacheMgr->new(); + + my $this = { %att }; + return bless $this, $class; +} + +#-> sub CPAN::Distribution::look ; +sub look { + my($self) = @_; + + if ($^O eq 'MacOS') { + $self->Mac::BuildTools::look; + return; + } + + if ( $CPAN::Config->{'shell'} ) { + $CPAN::Frontend->myprint(qq{ +Trying to open a subshell in the build directory... +}); + } else { + $CPAN::Frontend->myprint(qq{ +Your configuration does not define a value for subshells. +Please define it with "o conf shell " +}); + return; + } + my $dist = $self->id; + my $dir; + unless ($dir = $self->dir) { + $self->get; + } + unless ($dir ||= $self->dir) { + $CPAN::Frontend->mywarn(qq{ +Could not determine which directory to use for looking at $dist. +}); + return; + } + my $pwd = CPAN::anycwd(); + $self->safe_chdir($dir); + $CPAN::Frontend->myprint(qq{Working directory is $dir\n}); + { + local $ENV{CPAN_SHELL_LEVEL} = $ENV{CPAN_SHELL_LEVEL}||0; + $ENV{CPAN_SHELL_LEVEL} += 1; + my $shell = CPAN::HandleConfig->safe_quote($CPAN::Config->{'shell'}); + + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + # local $ENV{PERL_USE_UNSAFE_INC} = exists $ENV{PERL_USE_UNSAFE_INC} ? $ENV{PERL_USE_UNSAFE_INC} : 1; # look + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + + unless (system($shell) == 0) { + my $code = $? >> 8; + $CPAN::Frontend->mywarn("Subprocess shell exit code $code\n"); + } + } + $self->safe_chdir($pwd); +} + +# CPAN::Distribution::cvs_import ; +sub cvs_import { + my($self) = @_; + $self->get; + my $dir = $self->dir; + + my $package = $self->called_for; + my $module = $CPAN::META->instance('CPAN::Module', $package); + my $version = $module->cpan_version; + + my $userid = $self->cpan_userid; + + my $cvs_dir = (split /\//, $dir)[-1]; + $cvs_dir =~ s/-\d+[^-]+(?!\n)\Z//; + my $cvs_root = + $CPAN::Config->{cvsroot} || $ENV{CVSROOT}; + my $cvs_site_perl = + $CPAN::Config->{cvs_site_perl} || $ENV{CVS_SITE_PERL}; + if ($cvs_site_perl) { + $cvs_dir = "$cvs_site_perl/$cvs_dir"; + } + my $cvs_log = qq{"imported $package $version sources"}; + $version =~ s/\./_/g; + # XXX cvs: undocumented and unclear how it was meant to work + my @cmd = ('cvs', '-d', $cvs_root, 'import', '-m', $cvs_log, + "$cvs_dir", $userid, "v$version"); + + my $pwd = CPAN::anycwd(); + chdir($dir) or $CPAN::Frontend->mydie(qq{Could not chdir to "$dir": $!}); + + $CPAN::Frontend->myprint(qq{Working directory is $dir\n}); + + $CPAN::Frontend->myprint(qq{@cmd\n}); + system(@cmd) == 0 or + # XXX cvs + $CPAN::Frontend->mydie("cvs import failed"); + chdir($pwd) or $CPAN::Frontend->mydie(qq{Could not chdir to "$pwd": $!}); +} + +#-> sub CPAN::Distribution::readme ; +sub readme { + my($self) = @_; + my($dist) = $self->id; + my($sans,$suffix) = $dist =~ /(.+)\.(tgz|tar[\._-]gz|tar\.Z|zip)$/; + $self->debug("sans[$sans] suffix[$suffix]\n") if $CPAN::DEBUG; + my($local_file); + my($local_wanted) = + File::Spec->catfile( + $CPAN::Config->{keep_source_where}, + "authors", + "id", + split(/\//,"$sans.readme"), + ); + my $readme = "authors/id/$sans.readme"; + $self->debug("Doing localize for '$readme'") if $CPAN::DEBUG; + $local_file = CPAN::FTP->localize($readme, + $local_wanted) + or $CPAN::Frontend->mydie(qq{No $sans.readme found}); + + if ($^O eq 'MacOS') { + Mac::BuildTools::launch_file($local_file); + return; + } + + my $fh_pager = FileHandle->new; + local($SIG{PIPE}) = "IGNORE"; + my $pager = $CPAN::Config->{'pager'} || "cat"; + $fh_pager->open("|$pager") + or die "Could not open pager $pager\: $!"; + my $fh_readme = FileHandle->new; + $fh_readme->open($local_file) + or $CPAN::Frontend->mydie(qq{Could not open "$local_file": $!}); + $CPAN::Frontend->myprint(qq{ +Displaying file + $local_file +with pager "$pager" +}); + $fh_pager->print(<$fh_readme>); + $fh_pager->close; +} + +#-> sub CPAN::Distribution::verifyCHECKSUM ; +sub verifyCHECKSUM { + my($self) = @_; + EXCUSE: { + my @e; + $self->{CHECKSUM_STATUS} ||= ""; + $self->{CHECKSUM_STATUS} eq "OK" and push @e, "Checksum was ok"; + $CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e; + } + my($lc_want,$lc_file,@local,$basename); + @local = split(/\//,$self->id); + pop @local; + push @local, "CHECKSUMS"; + $lc_want = + File::Spec->catfile($CPAN::Config->{keep_source_where}, + "authors", "id", @local); + local($") = "/"; + if (my $size = -s $lc_want) { + $self->debug("lc_want[$lc_want]size[$size]") if $CPAN::DEBUG; + if ($self->CHECKSUM_check_file($lc_want,1)) { + return $self->{CHECKSUM_STATUS} = "OK"; + } + } + $lc_file = CPAN::FTP->localize("authors/id/@local", + $lc_want,1); + unless ($lc_file) { + $CPAN::Frontend->myprint("Trying $lc_want.gz\n"); + $local[-1] .= ".gz"; + $lc_file = CPAN::FTP->localize("authors/id/@local", + "$lc_want.gz",1); + if ($lc_file) { + $lc_file =~ s/\.gz(?!\n)\Z//; + eval{CPAN::Tarzip->new("$lc_file.gz")->gunzip($lc_file)}; + } else { + return; + } + } + if ($self->CHECKSUM_check_file($lc_file)) { + return $self->{CHECKSUM_STATUS} = "OK"; + } +} + +#-> sub CPAN::Distribution::SIG_check_file ; +sub SIG_check_file { + my($self,$chk_file) = @_; + my $rv = eval { Module::Signature::_verify($chk_file) }; + + if ($rv == Module::Signature::SIGNATURE_OK()) { + $CPAN::Frontend->myprint("Signature for $chk_file ok\n"); + return $self->{SIG_STATUS} = "OK"; + } else { + $CPAN::Frontend->myprint(qq{\nSignature invalid for }. + qq{distribution file. }. + qq{Please investigate.\n\n}. + $self->as_string, + $CPAN::META->instance( + 'CPAN::Author', + $self->cpan_userid + )->as_string); + + my $wrap = qq{I\'d recommend removing $chk_file. Its signature +is invalid. Maybe you have configured your 'urllist' with +a bad URL. Please check this array with 'o conf urllist', and +retry.}; + + $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap)); + } +} + +#-> sub CPAN::Distribution::CHECKSUM_check_file ; + +# sloppy is 1 when we have an old checksums file that maybe is good +# enough + +sub CHECKSUM_check_file { + my($self,$chk_file,$sloppy) = @_; + my($cksum,$file,$basename); + + $sloppy ||= 0; + $self->debug("chk_file[$chk_file]sloppy[$sloppy]") if $CPAN::DEBUG; + my $check_sigs = CPAN::HandleConfig->prefs_lookup($self, + q{check_sigs}); + if ($check_sigs) { + if ($CPAN::META->has_inst("Module::Signature")) { + $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG; + $self->SIG_check_file($chk_file); + } else { + $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG; + } + } + + $file = $self->{localfile}; + $basename = File::Basename::basename($file); + my $fh = FileHandle->new; + if (open $fh, $chk_file) { + local($/); + my $eval = <$fh>; + $eval =~ s/\015?\012/\n/g; + close $fh; + my($compmt) = Safe->new(); + $cksum = $compmt->reval($eval); + if ($@) { + rename $chk_file, "$chk_file.bad"; + Carp::confess($@) if $@; + } + } else { + Carp::carp "Could not open $chk_file for reading"; + } + + if (! ref $cksum or ref $cksum ne "HASH") { + $CPAN::Frontend->mywarn(qq{ +Warning: checksum file '$chk_file' broken. + +When trying to read that file I expected to get a hash reference +for further processing, but got garbage instead. +}); + my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no"); + $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n"); + $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS file broken"; + return; + } elsif (exists $cksum->{$basename}{sha256}) { + $self->debug("Found checksum for $basename:" . + "$cksum->{$basename}{sha256}\n") if $CPAN::DEBUG; + + open($fh, $file); + binmode $fh; + my $eq = $self->eq_CHECKSUM($fh,$cksum->{$basename}{sha256}); + $fh->close; + $fh = CPAN::Tarzip->TIEHANDLE($file); + + unless ($eq) { + my $dg = Digest::SHA->new(256); + my($data,$ref); + $ref = \$data; + while ($fh->READ($ref, 4096) > 0) { + $dg->add($data); + } + my $hexdigest = $dg->hexdigest; + $eq += $hexdigest eq $cksum->{$basename}{'sha256-ungz'}; + } + + if ($eq) { + $CPAN::Frontend->myprint("Checksum for $file ok\n"); + return $self->{CHECKSUM_STATUS} = "OK"; + } else { + $CPAN::Frontend->myprint(qq{\nChecksum mismatch for }. + qq{distribution file. }. + qq{Please investigate.\n\n}. + $self->as_string, + $CPAN::META->instance( + 'CPAN::Author', + $self->cpan_userid + )->as_string); + + my $wrap = qq{I\'d recommend removing $file. Its +checksum is incorrect. Maybe you have configured your 'urllist' with +a bad URL. Please check this array with 'o conf urllist', and +retry.}; + + $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap)); + + # former versions just returned here but this seems a + # serious threat that deserves a die + + # $CPAN::Frontend->myprint("\n\n"); + # sleep 3; + # return; + } + # close $fh if fileno($fh); + } else { + return if $sloppy; + unless ($self->{CHECKSUM_STATUS}) { + $CPAN::Frontend->mywarn(qq{ +Warning: No checksum for $basename in $chk_file. + +The cause for this may be that the file is very new and the checksum +has not yet been calculated, but it may also be that something is +going awry right now. +}); + my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed?", "yes"); + $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n"); + } + $self->{CHECKSUM_STATUS} = "NIL -- distro not in CHECKSUMS file"; + return; + } +} + +#-> sub CPAN::Distribution::eq_CHECKSUM ; +sub eq_CHECKSUM { + my($self,$fh,$expect) = @_; + if ($CPAN::META->has_inst("Digest::SHA")) { + my $dg = Digest::SHA->new(256); + my($data); + while (read($fh, $data, 4096)) { + $dg->add($data); + } + my $hexdigest = $dg->hexdigest; + # warn "fh[$fh] hex[$hexdigest] aexp[$expectMD5]"; + return $hexdigest eq $expect; + } + return 1; +} + +#-> sub CPAN::Distribution::force ; + +# Both CPAN::Modules and CPAN::Distributions know if "force" is in +# effect by autoinspection, not by inspecting a global variable. One +# of the reason why this was chosen to work that way was the treatment +# of dependencies. They should not automatically inherit the force +# status. But this has the downside that ^C and die() will return to +# the prompt but will not be able to reset the force_update +# attributes. We try to correct for it currently in the read_metadata +# routine, and immediately before we check for a Signal. I hope this +# works out in one of v1.57_53ff + +# "Force get forgets previous error conditions" + +#-> sub CPAN::Distribution::fforce ; +sub fforce { + my($self, $method) = @_; + $self->force($method,1); +} + +#-> sub CPAN::Distribution::force ; +sub force { + my($self, $method,$fforce) = @_; + my %phase_map = ( + get => [ + "unwrapped", + "build_dir", + "archived", + "localfile", + "CHECKSUM_STATUS", + "signature_verify", + "prefs", + "prefs_file", + "prefs_file_doc", + "cleanup_after_install_done", + ], + make => [ + "writemakefile", + "make", + "modulebuild", + "prereq_pm", + "cleanup_after_install_done", + ], + test => [ + "badtestcnt", + "make_test", + "cleanup_after_install_done", + ], + install => [ + "install", + "cleanup_after_install_done", + ], + unknown => [ + "reqtype", + "yaml_content", + "cleanup_after_install_done", + ], + ); + my $methodmatch = 0; + my $ldebug = 0; + PHASE: for my $phase (qw(unknown get make test install)) { # order matters + $methodmatch = 1 if $fforce || ($method && $phase eq $method); + next unless $methodmatch; + ATTRIBUTE: for my $att (@{$phase_map{$phase}}) { + if ($phase eq "get") { + if (substr($self->id,-1,1) eq "." + && $att =~ /(unwrapped|build_dir|archived)/ ) { + # cannot be undone for local distros + next ATTRIBUTE; + } + if ($att eq "build_dir" + && $self->{build_dir} + && $CPAN::META->{is_tested} + ) { + delete $CPAN::META->{is_tested}{$self->{build_dir}}; + } + } elsif ($phase eq "test") { + if ($att eq "make_test" + && $self->{make_test} + && $self->{make_test}{COMMANDID} + && $self->{make_test}{COMMANDID} == $CPAN::CurrentCommandId + ) { + # endless loop too likely + next ATTRIBUTE; + } + } + delete $self->{$att}; + if ($ldebug || $CPAN::DEBUG) { + # local $CPAN::DEBUG = 16; # Distribution + CPAN->debug(sprintf "id[%s]phase[%s]att[%s]", $self->id, $phase, $att); + } + } + } + if ($method && $method =~ /make|test|install/) { + $self->{force_update} = 1; # name should probably have been force_install + } +} + +#-> sub CPAN::Distribution::notest ; +sub notest { + my($self, $method) = @_; + # $CPAN::Frontend->mywarn("XDEBUG: set notest for $self $method"); + $self->{"notest"}++; # name should probably have been force_install +} + +#-> sub CPAN::Distribution::unnotest ; +sub unnotest { + my($self) = @_; + # warn "XDEBUG: deleting notest"; + delete $self->{notest}; +} + +#-> sub CPAN::Distribution::unforce ; +sub unforce { + my($self) = @_; + delete $self->{force_update}; +} + +#-> sub CPAN::Distribution::isa_perl ; +sub isa_perl { + my($self) = @_; + my $file = File::Basename::basename($self->id); + if ($file =~ m{ ^ perl + ( + -(5\.\d+\.\d+) + | + (5)[._-](00[0-5](?:_[0-4][0-9])?) + ) + \.tar[._-](?:gz|bz2) + (?!\n)\Z + }xs) { + my $perl_version; + if ($2) { + $perl_version = $2; + } else { + $perl_version = "$3.$4"; + } + return $perl_version; + } elsif ($self->cpan_comment + && + $self->cpan_comment =~ /isa_perl\(.+?\)/) { + return $1; + } +} + + +#-> sub CPAN::Distribution::perl ; +sub perl { + my ($self) = @_; + if (! $self) { + use Carp qw(carp); + carp __PACKAGE__ . "::perl was called without parameters."; + } + return CPAN::HandleConfig->safe_quote($CPAN::Perl); +} + +#-> sub CPAN::Distribution::shortcut_prepare ; +# return values: undef means don't shortcut; 0 means shortcut as fail; +# and 1 means shortcut as success + +sub shortcut_prepare { + my ($self) = @_; + + $self->debug("checking archive type[$self->{ID}]") if $CPAN::DEBUG; + if (!$self->{archived} || $self->{archived} eq "NO") { + return $self->goodbye("Is neither a tar nor a zip archive."); + } + + $self->debug("checking unwrapping[$self->{ID}]") if $CPAN::DEBUG; + if (!$self->{unwrapped} + || ( + UNIVERSAL::can($self->{unwrapped},"failed") ? + $self->{unwrapped}->failed : + $self->{unwrapped} =~ /^NO/ + )) { + return $self->goodbye("Had problems unarchiving. Please build manually"); + } + + $self->debug("checking signature[$self->{ID}]") if $CPAN::DEBUG; + if ( ! $self->{force_update} + && exists $self->{signature_verify} + && ( + UNIVERSAL::can($self->{signature_verify},"failed") ? + $self->{signature_verify}->failed : + $self->{signature_verify} =~ /^NO/ + ) + ) { + return $self->goodbye("Did not pass the signature test."); + } + + $self->debug("checking writemakefile[$self->{ID}]") if $CPAN::DEBUG; + if ($self->{writemakefile}) { + if ( + UNIVERSAL::can($self->{writemakefile},"failed") ? + $self->{writemakefile}->failed : + $self->{writemakefile} =~ /^NO/ + ) { + # XXX maybe a retry would be in order? + my $err = UNIVERSAL::can($self->{writemakefile},"text") ? + $self->{writemakefile}->text : + $self->{writemakefile}; + $err =~ s/^NO\s*(--\s+)?//; + $err ||= "Had some problem writing Makefile"; + $err .= ", not re-running"; + return $self->goodbye($err); + } else { + return $self->success("Has already been prepared"); + } + } + + $self->debug("checking configure_requires_later[$self->{ID}]") if $CPAN::DEBUG; + if( my $later = $self->{configure_requires_later} ) { # see also undelay + return $self->goodbye($later); + } + + return undef; # no shortcut +} + +sub prepare { + my ($self) = @_; + + $self->get + or return; + + if ( defined( my $sc = $self->shortcut_prepare) ) { + return $sc; + } + + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + local $ENV{PERL_USE_UNSAFE_INC} = + exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC} + ? $ENV{PERL_USE_UNSAFE_INC} : 1; # prepare + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + + if ($CPAN::Signal) { + delete $self->{force_update}; + return; + } + + my $builddir = $self->dir or + $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n"); + + unless (chdir $builddir) { + $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!"); + return; + } + + if ($CPAN::Signal) { + delete $self->{force_update}; + return; + } + + $self->debug("Changed directory to $builddir") if $CPAN::DEBUG; + + local $ENV{PERL_AUTOINSTALL} = $ENV{PERL_AUTOINSTALL} || ''; + local $ENV{PERL_EXTUTILS_AUTOINSTALL} = $ENV{PERL_EXTUTILS_AUTOINSTALL} || ''; + $self->choose_MM_or_MB + or return; + + my $configurator = $self->{configure} ? "Configure" + : $self->{modulebuild} ? "Build.PL" + : "Makefile.PL"; + + $CPAN::Frontend->myprint("Configuring ".$self->id." with $configurator\n"); + + if ($CPAN::Config->{prerequisites_policy} eq "follow") { + $ENV{PERL_AUTOINSTALL} ||= "--defaultdeps"; + $ENV{PERL_EXTUTILS_AUTOINSTALL} ||= "--defaultdeps"; + } + + my $system; + my $pl_commandline; + if ($self->prefs->{pl}) { + $pl_commandline = $self->prefs->{pl}{commandline}; + } + local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X; + local $ENV{PERL5_CPAN_IS_EXECUTING} = $ENV{PERL5_CPAN_IS_EXECUTING} || ''; + local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default}; + local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default}; + if ($pl_commandline) { + $system = $pl_commandline; + $ENV{PERL} = $^X; + } elsif ($self->{'configure'}) { + $system = $self->{'configure'}; + } elsif ($self->{modulebuild}) { + my($perl) = $self->perl or die "Couldn\'t find executable perl\n"; + my $mbuildpl_arg = $self->_make_phase_arg("pl"); + $system = sprintf("%s Build.PL%s", + $perl, + $mbuildpl_arg ? " $mbuildpl_arg" : "", + ); + } else { + my($perl) = $self->perl or die "Couldn\'t find executable perl\n"; + my $switch = ""; +# This needs a handler that can be turned on or off: +# $switch = "-MExtUtils::MakeMaker ". +# "-Mops=:default,:filesys_read,:filesys_open,require,chdir" +# if $] > 5.00310; + my $makepl_arg = $self->_make_phase_arg("pl"); + $ENV{PERL5_CPAN_IS_EXECUTING} = File::Spec->catfile($self->{build_dir}, + "Makefile.PL"); + $system = sprintf("%s%s Makefile.PL%s", + $perl, + $switch ? " $switch" : "", + $makepl_arg ? " $makepl_arg" : "", + ); + } + my $pl_env; + if ($self->prefs->{pl}) { + $pl_env = $self->prefs->{pl}{env}; + } + local @ENV{keys %$pl_env} = values %$pl_env if $pl_env; + if (exists $self->{writemakefile}) { + } else { + local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" }; + my($ret,$pid,$output); + $@ = ""; + my $go_via_alarm; + if ($CPAN::Config->{inactivity_timeout}) { + require Config; + if ($Config::Config{d_alarm} + && + $Config::Config{d_alarm} eq "define" + ) { + $go_via_alarm++ + } else { + $CPAN::Frontend->mywarn("Warning: you have configured the config ". + "variable 'inactivity_timeout' to ". + "'$CPAN::Config->{inactivity_timeout}'. But ". + "on this machine the system call 'alarm' ". + "isn't available. This means that we cannot ". + "provide the feature of intercepting long ". + "waiting code and will turn this feature off.\n" + ); + $CPAN::Config->{inactivity_timeout} = 0; + } + } + if ($go_via_alarm) { + if ( $self->_should_report('pl') ) { + ($output, $ret) = CPAN::Reporter::record_command( + $system, + $CPAN::Config->{inactivity_timeout}, + ); + CPAN::Reporter::grade_PL( $self, $system, $output, $ret ); + } + else { + eval { + alarm $CPAN::Config->{inactivity_timeout}; + local $SIG{CHLD}; # = sub { wait }; + if (defined($pid = fork)) { + if ($pid) { #parent + # wait; + waitpid $pid, 0; + } else { #child + # note, this exec isn't necessary if + # inactivity_timeout is 0. On the Mac I'd + # suggest, we set it always to 0. + exec $system; + } + } else { + $CPAN::Frontend->myprint("Cannot fork: $!"); + return; + } + }; + alarm 0; + if ($@) { + kill 9, $pid; + waitpid $pid, 0; + my $err = "$@"; + $CPAN::Frontend->myprint($err); + $self->{writemakefile} = CPAN::Distrostatus->new("NO $err"); + $@ = ""; + $self->store_persistent_state; + return $self->goodbye("$system -- TIMED OUT"); + } + } + } else { + if (my $expect_model = $self->_prefs_with_expect("pl")) { + # XXX probably want to check _should_report here and warn + # about not being able to use CPAN::Reporter with expect + $ret = $self->_run_via_expect($system,'writemakefile',$expect_model); + if (! defined $ret + && $self->{writemakefile} + && $self->{writemakefile}->failed) { + # timeout + return; + } + } + elsif ( $self->_should_report('pl') ) { + ($output, $ret) = eval { CPAN::Reporter::record_command($system) }; + if (! defined $output or $@) { + my $err = $@ || "Unknown error"; + $CPAN::Frontend->mywarn("Error while running PL phase: $err\n"); + $self->{writemakefile} = CPAN::Distrostatus + ->new("NO '$system' returned status $ret and no output"); + return $self->goodbye("$system -- NOT OK"); + } + CPAN::Reporter::grade_PL( $self, $system, $output, $ret ); + } + else { + $ret = system($system); + } + if ($ret != 0) { + $self->{writemakefile} = CPAN::Distrostatus + ->new("NO '$system' returned status $ret"); + $CPAN::Frontend->mywarn("Warning: No success on command[$system]\n"); + $self->store_persistent_state; + return $self->goodbye("$system -- NOT OK"); + } + } + if (-f "Makefile" || -f "Build" || ($^O eq 'VMS' && (-f 'descrip.mms' || -f 'Build.com'))) { + $self->{writemakefile} = CPAN::Distrostatus->new("YES"); + delete $self->{make_clean}; # if cleaned before, enable next + $self->store_persistent_state; + return $self->success("$system -- OK"); + } else { + my $makefile = $self->{modulebuild} ? "Build" : "Makefile"; + my $why = "No '$makefile' created"; + $CPAN::Frontend->mywarn($why); + $self->{writemakefile} = CPAN::Distrostatus + ->new(qq{NO -- $why\n}); + $self->store_persistent_state; + return $self->goodbye("$system -- NOT OK"); + } + } + $self->store_persistent_state; + return 1; # success +} + +#-> sub CPAN::Distribution::shortcut_make ; +# return values: undef means don't shortcut; 0 means shortcut as fail; +# and 1 means shortcut as success +sub shortcut_make { + my ($self) = @_; + + $self->debug("checking make/build results[$self->{ID}]") if $CPAN::DEBUG; + if (defined $self->{make}) { + if (UNIVERSAL::can($self->{make},"failed") ? + $self->{make}->failed : + $self->{make} =~ /^NO/ + ) { + if ($self->{force_update}) { + # Trying an already failed 'make' (unless somebody else blocks) + return undef; # no shortcut + } else { + # introduced for turning recursion detection into a distrostatus + my $error = length $self->{make}>3 + ? substr($self->{make},3) : "Unknown error"; + $self->store_persistent_state; + return $self->goodbye("Could not make: $error\n"); + } + } else { + return $self->success("Has already been made") + } + } + return undef; # no shortcut +} + +#-> sub CPAN::Distribution::make ; +sub make { + my($self) = @_; + + $self->pre_make(); + + if (exists $self->{cleanup_after_install_done}) { + $self->post_make(); + return $self->get; + } + + $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG; + if (my $goto = $self->prefs->{goto}) { + $self->post_make(); + return $self->goto($goto); + } + # Emergency brake if they said install Pippi and get newest perl + + # XXX Would this make more sense in shortcut_prepare, since + # that doesn't make sense on a perl dist either? Broader + # question: what is the purpose of suggesting force install + # on a perl distribution? That seems unlikely to result in + # such a dependency being satisfied, even if the perl is + # successfully installed. This situation is tantamount to + # a prereq on a version of perl greater than the current one + # so I think we should just abort. -- xdg, 2012-04-06 + if ($self->isa_perl) { + if ( + $self->called_for ne $self->id && + ! $self->{force_update} + ) { + # if we die here, we break bundles + $CPAN::Frontend + ->mywarn(sprintf( + qq{The most recent version "%s" of the module "%s" +is part of the perl-%s distribution. To install that, you need to run + force install %s --or-- + install %s +}, + $CPAN::META->instance( + 'CPAN::Module', + $self->called_for + )->cpan_version, + $self->called_for, + $self->isa_perl, + $self->called_for, + $self->pretty_id, + )); + $self->{make} = CPAN::Distrostatus->new("NO isa perl"); + $CPAN::Frontend->mysleep(1); + $self->post_make(); + return; + } + } + + unless ($self->prepare){ + $self->post_make(); + return; + } + + if ( defined( my $sc = $self->shortcut_make) ) { + $self->post_make(); + return $sc; + } + + if ($CPAN::Signal) { + delete $self->{force_update}; + $self->post_make(); + return; + } + + my $builddir = $self->dir or + $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n"); + + unless (chdir $builddir) { + $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!"); + $self->post_make(); + return; + } + + my $make = $self->{modulebuild} ? "Build" : "make"; + $CPAN::Frontend->myprint(sprintf "Running %s for %s\n", $make, $self->id); + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + local $ENV{PERL_USE_UNSAFE_INC} = + exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC} + ? $ENV{PERL_USE_UNSAFE_INC} : 1; # make + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + + if ($CPAN::Signal) { + delete $self->{force_update}; + $self->post_make(); + return; + } + + if ($^O eq 'MacOS') { + Mac::BuildTools::make($self); + $self->post_make(); + return; + } + + my %env; + while (my($k,$v) = each %ENV) { + next if defined $v; + $env{$k} = ''; + } + local @ENV{keys %env} = values %env; + my $satisfied = eval { $self->satisfy_requires }; + if ($@) { + return $self->goodbye($@); + } + unless ($satisfied){ + $self->post_make(); + return; + } + if ($CPAN::Signal) { + delete $self->{force_update}; + $self->post_make(); + return; + } + + # need to chdir again, because $self->satisfy_requires might change the directory + unless (chdir $builddir) { + $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!"); + $self->post_make(); + return; + } + + my $system; + my $make_commandline; + if ($self->prefs->{make}) { + $make_commandline = $self->prefs->{make}{commandline}; + } + local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X; + local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default}; + local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default}; + if ($make_commandline) { + $system = $make_commandline; + $ENV{PERL} = CPAN::find_perl(); + } else { + if ($self->{modulebuild}) { + unless (-f "Build" || ($^O eq 'VMS' && -f 'Build.com')) { + my $cwd = CPAN::anycwd(); + $CPAN::Frontend->mywarn("Alert: no Build file available for 'make $self->{id}'". + " in cwd[$cwd]. Danger, Will Robinson!\n"); + $CPAN::Frontend->mysleep(5); + } + $system = join " ", $self->_build_command(), $CPAN::Config->{mbuild_arg}; + } else { + $system = join " ", $self->_make_command(), $CPAN::Config->{make_arg}; + } + $system =~ s/\s+$//; + my $make_arg = $self->_make_phase_arg("make"); + $system = sprintf("%s%s", + $system, + $make_arg ? " $make_arg" : "", + ); + } + my $make_env; + if ($self->prefs->{make}) { + $make_env = $self->prefs->{make}{env}; + } + local @ENV{keys %$make_env} = values %$make_env if $make_env; + my $expect_model = $self->_prefs_with_expect("make"); + my $want_expect = 0; + if ( $expect_model && @{$expect_model->{talk}} ) { + my $can_expect = $CPAN::META->has_inst("Expect"); + if ($can_expect) { + $want_expect = 1; + } else { + $CPAN::Frontend->mywarn("Expect not installed, falling back to ". + "system()\n"); + } + } + my ($system_ok, $system_err); + if ($want_expect) { + # XXX probably want to check _should_report here and + # warn about not being able to use CPAN::Reporter with expect + $system_ok = $self->_run_via_expect($system,'make',$expect_model) == 0; + } + elsif ( $self->_should_report('make') ) { + my ($output, $ret) = CPAN::Reporter::record_command($system); + CPAN::Reporter::grade_make( $self, $system, $output, $ret ); + $system_ok = ! $ret; + } + else { + my $rc = system($system); + $system_ok = $rc == 0; + $system_err = $! if $rc == -1; + } + $self->introduce_myself; + if ( $system_ok ) { + $CPAN::Frontend->myprint(" $system -- OK\n"); + $self->{make} = CPAN::Distrostatus->new("YES"); + } else { + $self->{writemakefile} ||= CPAN::Distrostatus->new("YES"); + $self->{make} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); + $CPAN::Frontend->mywarn(" $system_err\n") if defined $system_err; + } + $self->store_persistent_state; + + $self->post_make(); + + return !! $system_ok; +} + +# CPAN::Distribution::goodbye ; +sub goodbye { + my($self,$goodbye) = @_; + my $id = $self->pretty_id; + $CPAN::Frontend->mywarn(" $id\n $goodbye\n"); + return 0; # must be explicit false, not undef +} + +sub success { + my($self,$why) = @_; + my $id = $self->pretty_id; + $CPAN::Frontend->myprint(" $id\n $why\n"); + return 1; +} + +# CPAN::Distribution::_run_via_expect ; +sub _run_via_expect { + my($self,$system,$phase,$expect_model) = @_; + CPAN->debug("system[$system]expect_model[$expect_model]") if $CPAN::DEBUG; + if ($CPAN::META->has_inst("Expect")) { + my $expo = Expect->new; # expo Expect object; + $expo->spawn($system); + $expect_model->{mode} ||= "deterministic"; + if ($expect_model->{mode} eq "deterministic") { + return $self->_run_via_expect_deterministic($expo,$phase,$expect_model); + } elsif ($expect_model->{mode} eq "anyorder") { + return $self->_run_via_expect_anyorder($expo,$phase,$expect_model); + } else { + die "Panic: Illegal expect mode: $expect_model->{mode}"; + } + } else { + $CPAN::Frontend->mywarn("Expect not installed, falling back to system()\n"); + return system($system); + } +} + +sub _run_via_expect_anyorder { + my($self,$expo,$phase,$expect_model) = @_; + my $timeout = $expect_model->{timeout} || 5; + my $reuse = $expect_model->{reuse}; + my @expectacopy = @{$expect_model->{talk}}; # we trash it! + my $but = ""; + my $timeout_start = time; + EXPECT: while () { + my($eof,$ran_into_timeout); + # XXX not up to the full power of expect. one could certainly + # wrap all of the talk pairs into a single expect call and on + # success tweak it and step ahead to the next question. The + # current implementation unnecessarily limits itself to a + # single match. + my @match = $expo->expect(1, + [ eof => sub { + $eof++; + } ], + [ timeout => sub { + $ran_into_timeout++; + } ], + -re => eval"qr{.}", + ); + if ($match[2]) { + $but .= $match[2]; + } + $but .= $expo->clear_accum; + if ($eof) { + $expo->soft_close; + return $expo->exitstatus(); + } elsif ($ran_into_timeout) { + # warn "DEBUG: they are asking a question, but[$but]"; + for (my $i = 0; $i <= $#expectacopy; $i+=2) { + my($next,$send) = @expectacopy[$i,$i+1]; + my $regex = eval "qr{$next}"; + # warn "DEBUG: will compare with regex[$regex]."; + if ($but =~ /$regex/) { + # warn "DEBUG: will send send[$send]"; + $expo->send($send); + # never allow reusing an QA pair unless they told us + splice @expectacopy, $i, 2 unless $reuse; + $but =~ s/(?s:^.*?)$regex//; + $timeout_start = time; + next EXPECT; + } + } + my $have_waited = time - $timeout_start; + if ($have_waited < $timeout) { + # warn "DEBUG: have_waited[$have_waited]timeout[$timeout]"; + next EXPECT; + } + my $why = "could not answer a question during the dialog"; + $CPAN::Frontend->mywarn("Failing: $why\n"); + $self->{$phase} = + CPAN::Distrostatus->new("NO $why"); + return 0; + } + } +} + +sub _run_via_expect_deterministic { + my($self,$expo,$phase,$expect_model) = @_; + my $ran_into_timeout; + my $ran_into_eof; + my $timeout = $expect_model->{timeout} || 15; # currently unsettable + my $expecta = $expect_model->{talk}; + EXPECT: for (my $i = 0; $i <= $#$expecta; $i+=2) { + my($re,$send) = @$expecta[$i,$i+1]; + CPAN->debug("timeout[$timeout]re[$re]") if $CPAN::DEBUG; + my $regex = eval "qr{$re}"; + $expo->expect($timeout, + [ eof => sub { + my $but = $expo->clear_accum; + $CPAN::Frontend->mywarn("EOF (maybe harmless) +expected[$regex]\nbut[$but]\n\n"); + $ran_into_eof++; + } ], + [ timeout => sub { + my $but = $expo->clear_accum; + $CPAN::Frontend->mywarn("TIMEOUT +expected[$regex]\nbut[$but]\n\n"); + $ran_into_timeout++; + } ], + -re => $regex); + if ($ran_into_timeout) { + # note that the caller expects 0 for success + $self->{$phase} = + CPAN::Distrostatus->new("NO timeout during expect dialog"); + return 0; + } elsif ($ran_into_eof) { + last EXPECT; + } + $expo->send($send); + } + $expo->soft_close; + return $expo->exitstatus(); +} + +#-> CPAN::Distribution::_validate_distropref +sub _validate_distropref { + my($self,@args) = @_; + if ( + $CPAN::META->has_inst("CPAN::Kwalify") + && + $CPAN::META->has_inst("Kwalify") + ) { + eval {CPAN::Kwalify::_validate("distroprefs",@args);}; + if ($@) { + $CPAN::Frontend->mywarn($@); + } + } else { + CPAN->debug("not validating '@args'") if $CPAN::DEBUG; + } +} + +#-> CPAN::Distribution::_find_prefs +sub _find_prefs { + my($self) = @_; + my $distroid = $self->pretty_id; + #CPAN->debug("distroid[$distroid]") if $CPAN::DEBUG; + my $prefs_dir = $CPAN::Config->{prefs_dir}; + return if $prefs_dir =~ /^\s*$/; + eval { File::Path::mkpath($prefs_dir); }; + if ($@) { + $CPAN::Frontend->mydie("Cannot create directory $prefs_dir"); + } + # shortcut if there are no distroprefs files + { + my $dh = DirHandle->new($prefs_dir) or $CPAN::Frontend->mydie("Couldn't open '$prefs_dir': $!"); + my @files = map { /\.(yml|dd|st)\z/i } $dh->read; + return unless @files; + } + my $yaml_module = CPAN::_yaml_module(); + my $ext_map = {}; + my @extensions; + if ($CPAN::META->has_inst($yaml_module)) { + $ext_map->{yml} = 'CPAN'; + } else { + my @fallbacks; + if ($CPAN::META->has_inst("Data::Dumper")) { + push @fallbacks, $ext_map->{dd} = 'Data::Dumper'; + } + if ($CPAN::META->has_inst("Storable")) { + push @fallbacks, $ext_map->{st} = 'Storable'; + } + if (@fallbacks) { + local $" = " and "; + unless ($self->{have_complained_about_missing_yaml}++) { + $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, falling back ". + "to @fallbacks to read prefs '$prefs_dir'\n"); + } + } else { + unless ($self->{have_complained_about_missing_yaml}++) { + $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, cannot ". + "read prefs '$prefs_dir'\n"); + } + } + } + my $finder = CPAN::Distroprefs->find($prefs_dir, $ext_map); + DIRENT: while (my $result = $finder->next) { + if ($result->is_warning) { + $CPAN::Frontend->mywarn($result->as_string); + $CPAN::Frontend->mysleep(1); + next DIRENT; + } elsif ($result->is_fatal) { + $CPAN::Frontend->mydie($result->as_string); + } + + my @prefs = @{ $result->prefs }; + + ELEMENT: for my $y (0..$#prefs) { + my $pref = $prefs[$y]; + $self->_validate_distropref($pref->data, $result->abs, $y); + + # I don't know why we silently skip when there's no match, but + # complain if there's an empty match hashref, and there's no + # comment explaining why -- hdp, 2008-03-18 + unless ($pref->has_any_match) { + next ELEMENT; + } + + unless ($pref->has_valid_subkeys) { + $CPAN::Frontend->mydie(sprintf + "Nonconforming .%s file '%s': " . + "missing match/* subattribute. " . + "Please remove, cannot continue.", + $result->ext, $result->abs, + ); + } + + my $arg = { + env => \%ENV, + distribution => $distroid, + perl => \&CPAN::find_perl, + perlconfig => \%Config::Config, + module => sub { [ $self->containsmods ] }, + }; + + if ($pref->matches($arg)) { + return { + prefs => $pref->data, + prefs_file => $result->abs, + prefs_file_doc => $y, + }; + } + + } + } + return; +} + +# CPAN::Distribution::prefs +sub prefs { + my($self) = @_; + if (exists $self->{negative_prefs_cache} + && + $self->{negative_prefs_cache} != $CPAN::CurrentCommandId + ) { + delete $self->{negative_prefs_cache}; + delete $self->{prefs}; + } + if (exists $self->{prefs}) { + return $self->{prefs}; # XXX comment out during debugging + } + if ($CPAN::Config->{prefs_dir}) { + CPAN->debug("prefs_dir[$CPAN::Config->{prefs_dir}]") if $CPAN::DEBUG; + my $prefs = $self->_find_prefs(); + $prefs ||= ""; # avoid warning next line + CPAN->debug("prefs[$prefs]") if $CPAN::DEBUG; + if ($prefs) { + for my $x (qw(prefs prefs_file prefs_file_doc)) { + $self->{$x} = $prefs->{$x}; + } + my $bs = sprintf( + "%s[%s]", + File::Basename::basename($self->{prefs_file}), + $self->{prefs_file_doc}, + ); + my $filler1 = "_" x 22; + my $filler2 = int(66 - length($bs))/2; + $filler2 = 0 if $filler2 < 0; + $filler2 = " " x $filler2; + $CPAN::Frontend->myprint(" +$filler1 D i s t r o P r e f s $filler1 +$filler2 $bs $filler2 +"); + $CPAN::Frontend->mysleep(1); + return $self->{prefs}; + } + } + $self->{negative_prefs_cache} = $CPAN::CurrentCommandId; + return $self->{prefs} = +{}; +} + +# CPAN::Distribution::_make_phase_arg +sub _make_phase_arg { + my($self, $phase) = @_; + my $_make_phase_arg; + my $prefs = $self->prefs; + if ( + $prefs + && exists $prefs->{$phase} + && exists $prefs->{$phase}{args} + && $prefs->{$phase}{args} + ) { + $_make_phase_arg = join(" ", + map {CPAN::HandleConfig + ->safe_quote($_)} @{$prefs->{$phase}{args}}, + ); + } + +# cpan[2]> o conf make[TAB] +# make make_install_make_command +# make_arg makepl_arg +# make_install_arg +# cpan[2]> o conf mbuild[TAB] +# mbuild_arg mbuild_install_build_command +# mbuild_install_arg mbuildpl_arg + + my $mantra; # must switch make/mbuild here + if ($self->{modulebuild}) { + $mantra = "mbuild"; + } else { + $mantra = "make"; + } + my %map = ( + pl => "pl_arg", + make => "_arg", + test => "_test_arg", # does not really exist but maybe + # will some day and now protects + # us from unini warnings + install => "_install_arg", + ); + my $phase_underscore_meshup = $map{$phase}; + my $what = sprintf "%s%s", $mantra, $phase_underscore_meshup; + + $_make_phase_arg ||= $CPAN::Config->{$what}; + return $_make_phase_arg; +} + +# CPAN::Distribution::_make_command +sub _make_command { + my ($self) = @_; + if ($self) { + return + CPAN::HandleConfig + ->safe_quote( + CPAN::HandleConfig->prefs_lookup($self, + q{make}) + || $Config::Config{make} + || 'make' + ); + } else { + # Old style call, without object. Deprecated + Carp::confess("CPAN::_make_command() used as function. Don't Do That."); + return + safe_quote(undef, + CPAN::HandleConfig->prefs_lookup($self,q{make}) + || $CPAN::Config->{make} + || $Config::Config{make} + || 'make'); + } +} + +sub _make_install_make_command { + my ($self) = @_; + my $mimc = + CPAN::HandleConfig->prefs_lookup($self, q{make_install_make_command}); + return $self->_make_command() unless $mimc; + + # Quote the "make install" make command on Windows, where it is commonly + # found in, e.g., C:\Program Files\... and therefore needs quoting. We can't + # do this in general because the command maybe "sudo make..." (i.e. a + # program with arguments), but that is unlikely to be the case on Windows. + $mimc = CPAN::HandleConfig->safe_quote($mimc) if $^O eq 'MSWin32'; + + return $mimc; +} + +#-> sub CPAN::Distribution::is_locally_optional +sub is_locally_optional { + my($self, $prereq_pm, $prereq) = @_; + $prereq_pm ||= $self->{prereq_pm}; + my($nmo,$opt); + for my $rt (qw(requires build_requires)) { + if (exists $prereq_pm->{$rt}{$prereq}) { + # rt 121914 + $nmo ||= $CPAN::META->instance("CPAN::Module",$prereq); + my $av = $nmo->available_version; + return 0 if !$av || CPAN::Version->vlt($av,$prereq_pm->{$rt}{$prereq}); + } + if (exists $prereq_pm->{"opt_$rt"}{$prereq}) { + $opt = 1; + } + } + return $opt||0; +} + +#-> sub CPAN::Distribution::follow_prereqs ; +sub follow_prereqs { + my($self) = shift; + my($slot) = shift; + my(@prereq_tuples) = grep {$_->[0] ne "perl"} @_; + return unless @prereq_tuples; + my(@good_prereq_tuples); + for my $p (@prereq_tuples) { + # e.g. $p = ['Devel::PartialDump', 'r', 1] + # promote if possible + if ($p->[1] =~ /^(r|c)$/) { + push @good_prereq_tuples, $p; + } elsif ($p->[1] =~ /^(b)$/) { + my $reqtype = CPAN::Queue->reqtype_of($p->[0]); + if ($reqtype =~ /^(r|c)$/) { + push @good_prereq_tuples, [$p->[0], $reqtype, $p->[2]]; + } else { + push @good_prereq_tuples, $p; + } + } else { + die "Panic: in follow_prereqs: reqtype[$p->[1]] seen, should never happen"; + } + } + my $pretty_id = $self->pretty_id; + my %map = ( + b => "build_requires", + r => "requires", + c => "commandline", + ); + my($filler1,$filler2,$filler3,$filler4); + my $unsat = "Unsatisfied dependencies detected during"; + my $w = length($unsat) > length($pretty_id) ? length($unsat) : length($pretty_id); + { + my $r = int(($w - length($unsat))/2); + my $l = $w - length($unsat) - $r; + $filler1 = "-"x4 . " "x$l; + $filler2 = " "x$r . "-"x4 . "\n"; + } + { + my $r = int(($w - length($pretty_id))/2); + my $l = $w - length($pretty_id) - $r; + $filler3 = "-"x4 . " "x$l; + $filler4 = " "x$r . "-"x4 . "\n"; + } + $CPAN::Frontend-> + myprint("$filler1 $unsat $filler2". + "$filler3 $pretty_id $filler4". + join("", map {sprintf " %s \[%s%s]\n", $_->[0], $map{$_->[1]}, $self->is_locally_optional(undef,$_->[0]) ? ",optional" : ""} @good_prereq_tuples), + ); + my $follow = 0; + if ($CPAN::Config->{prerequisites_policy} eq "follow") { + $follow = 1; + } elsif ($CPAN::Config->{prerequisites_policy} eq "ask") { + my $answer = CPAN::Shell::colorable_makemaker_prompt( +"Shall I follow them and prepend them to the queue +of modules we are processing right now?", "yes"); + $follow = $answer =~ /^\s*y/i; + } else { + my @prereq = map { $_->[0] } @good_prereq_tuples; + local($") = ", "; + $CPAN::Frontend-> + myprint(" Ignoring dependencies on modules @prereq\n"); + } + if ($follow) { + my $id = $self->id; + my(@to_queue_mand,@to_queue_opt); + for my $gp (@good_prereq_tuples) { + my($prereq,$reqtype,$optional) = @$gp; + my $qthing = +{qmod=>$prereq,reqtype=>$reqtype,optional=>$optional}; + if ($optional && + $self->is_locally_optional(undef,$prereq) + ){ + # Since we do not depend on this one, we do not need + # this in a mandatory arrangement: + push @to_queue_opt, $qthing; + } else { + my $any = CPAN::Shell->expandany($prereq); + $self->{$slot . "_for"}{$any->id}++; + if ($any) { + unless ($optional) { + # No recursion check in an optional area of the tree + $any->color_cmd_tmps(0,2); + } + } else { + $CPAN::Frontend->mywarn("Warning (maybe a bug): Cannot expand prereq '$prereq'\n"); + $CPAN::Frontend->mysleep(2); + } + # order everything that is not locally_optional just + # like mandatory items: this keeps leaves before + # branches + unshift @to_queue_mand, $qthing; + } + } + if (@to_queue_mand) { + unshift @to_queue_mand, {qmod => $id, reqtype => $self->{reqtype}, optional=> !$self->{mandatory}}; + CPAN::Queue->jumpqueue(@to_queue_opt,@to_queue_mand); + $self->{$slot} = "Delayed until after prerequisites"; + return 1; # signal we need dependencies + } elsif (@to_queue_opt) { + CPAN::Queue->jumpqueue(@to_queue_opt); + } + } + return; +} + +sub _feature_depends { + my($self) = @_; + my $meta_yml = $self->parse_meta_yml(); + my $optf = $meta_yml->{optional_features} or return; + if (!ref $optf or ref $optf ne "HASH"){ + $CPAN::Frontend->mywarn("The content of optional_features is not a HASH reference. Cannot use it.\n"); + $optf = {}; + } + my $wantf = $self->prefs->{features} or return; + if (!ref $wantf or ref $wantf ne "ARRAY"){ + $CPAN::Frontend->mywarn("The content of 'features' is not an ARRAY reference. Cannot use it.\n"); + $wantf = []; + } + my $dep = +{}; + for my $wf (@$wantf) { + if (my $f = $optf->{$wf}) { + $CPAN::Frontend->myprint("Found the demanded feature '$wf' that ". + "is accompanied by this description:\n". + $f->{description}. + "\n\n" + ); + # configure_requires currently not in the spec, unlikely to be useful anyway + for my $reqtype (qw(configure_requires build_requires requires)) { + my $reqhash = $f->{$reqtype} or next; + while (my($k,$v) = each %$reqhash) { + $dep->{$reqtype}{$k} = $v; + } + } + } else { + $CPAN::Frontend->mywarn("The demanded feature '$wf' was not ". + "found in the META.yml file". + "\n\n" + ); + } + } + $dep; +} + +sub prereqs_for_slot { + my($self,$slot) = @_; + my($prereq_pm); + unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) { + my $whynot = "not available"; + if (defined $CPAN::Meta::Requirements::VERSION) { + $whynot = "version $CPAN::Meta::Requirements::VERSION not sufficient"; + } + $CPAN::Frontend->mywarn("CPAN::Meta::Requirements $whynot\n"); + my $before = ""; + if ($self->{CALLED_FOR}){ + if ($self->{CALLED_FOR} =~ + /^( + CPAN::Meta::Requirements + |CPAN::DistnameInfo + |version + |parent + |ExtUtils::MakeMaker + |Test::Harness + )$/x) { + $CPAN::Frontend->mywarn("Please install CPAN::Meta::Requirements ". + "as soon as possible; it is needed for a reliable operation of ". + "the cpan shell; setting requirements to nil for '$1' for now ". + "to prevent deadlock during bootstrapping\n"); + return; + } + $before = " before $self->{CALLED_FOR}"; + } + $CPAN::Frontend->mydie("Please install CPAN::Meta::Requirements manually$before"); + } + my $merged = CPAN::Meta::Requirements->new; + my $prefs_depends = $self->prefs->{depends}||{}; + my $feature_depends = $self->_feature_depends(); + if ($slot eq "configure_requires_later") { + for my $hash ( $self->configure_requires, + $prefs_depends->{configure_requires}, + $feature_depends->{configure_requires}, + ) { + $merged->add_requirements( + CPAN::Meta::Requirements->from_string_hash($hash) + ); + } + if (-f "Build.PL" + && ! -f File::Spec->catfile($self->{build_dir},"Makefile.PL") + && ! $merged->requirements_for_module("Module::Build") + && ! $CPAN::META->has_inst("Module::Build") + ) { + $CPAN::Frontend->mywarn( + " Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.\n". + " Adding it now as such.\n" + ); + $CPAN::Frontend->mysleep(5); + $merged->add_minimum( "Module::Build" => 0 ); + delete $self->{writemakefile}; + } + $prereq_pm = {}; # configure_requires defined as "b" + } elsif ($slot eq "later") { + my $prereq_pm_0 = $self->prereq_pm || {}; + for my $reqtype (qw(requires build_requires opt_requires opt_build_requires)) { + $prereq_pm->{$reqtype} = {%{$prereq_pm_0->{$reqtype}||{}}}; # copy to not pollute it + for my $dep ($prefs_depends,$feature_depends) { + for my $k (keys %{$dep->{$reqtype}||{}}) { + $prereq_pm->{$reqtype}{$k} = $dep->{$reqtype}{$k}; + } + } + } + # XXX what about optional_req|breq? -- xdg, 2012-04-01 + for my $hash ( + $prereq_pm->{requires}, + $prereq_pm->{build_requires}, + $prereq_pm->{opt_requires}, + $prereq_pm->{opt_build_requires}, + + ) { + $merged->add_requirements( + CPAN::Meta::Requirements->from_string_hash($hash) + ); + } + } else { + die "Panic: illegal slot '$slot'"; + } + return ($merged->as_string_hash, $prereq_pm); +} + +#-> sub CPAN::Distribution::unsat_prereq ; +# return ([Foo,"r"],[Bar,"b"]) for normal modules +# return ([perl=>5.008]) if we need a newer perl than we are running under +# (sorry for the inconsistency, it was an accident) +sub unsat_prereq { + my($self,$slot) = @_; + my($merged_hash,$prereq_pm) = $self->prereqs_for_slot($slot); + my(@need); + unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) { + $CPAN::Frontend->mywarn("CPAN::Meta::Requirements not available, please install as soon as possible, trying to continue with severly limited capabilities\n"); + return; + } + my $merged = CPAN::Meta::Requirements->from_string_hash($merged_hash); + my @merged = sort $merged->required_modules; + CPAN->debug("all merged_prereqs[@merged]") if $CPAN::DEBUG; + NEED: for my $need_module ( @merged ) { + my $need_version = $merged->requirements_for_module($need_module); + my($available_version,$inst_file,$available_file,$nmo); + if ($need_module eq "perl") { + $available_version = $]; + $available_file = CPAN::find_perl(); + } else { + if (CPAN::_sqlite_running()) { + CPAN::Index->reload; + $CPAN::SQLite->search("CPAN::Module",$need_module); + } + $nmo = $CPAN::META->instance("CPAN::Module",$need_module); + $inst_file = $nmo->inst_file || ''; + $available_file = $nmo->available_file || ''; + $available_version = $nmo->available_version; + if ($nmo->uptodate) { + my $accepts = eval { + $merged->accepts_module($need_module, $available_version); + }; + unless ($accepts) { + my $rq = $merged->requirements_for_module( $need_module ); + $CPAN::Frontend->mywarn( + "Warning: Version '$available_version' of ". + "'$need_module' is up to date but does not ". + "fulfill requirements ($rq). I will continue, ". + "but chances to succeed are low.\n"); + } + next NEED; + } + + # if they have not specified a version, we accept any + # installed one; in that case inst_file is always + # sufficient and available_file is sufficient on + # both build_requires and configure_requires + my $sufficient = $inst_file || + ( exists $prereq_pm->{requires}{$need_module} ? 0 : $available_file ); + if ( $sufficient + and ( # a few quick short circuits + not defined $need_version + or $need_version eq '0' # "==" would trigger warning when not numeric + or $need_version eq "undef" + )) { + unless ($nmo->inst_deprecated) { + next NEED; + } + } + } + + # We only want to install prereqs if either they're not installed + # or if the installed version is too old. We cannot omit this + # check, because if 'force' is in effect, nobody else will check. + # But we don't want to accept a deprecated module installed as part + # of the Perl core, so we continue if the available file is the installed + # one and is deprecated + + if ( $available_file ) { + my $fulfills_all_version_rqs = $self->_fulfills_all_version_rqs + ( + $need_module, + $available_file, + $available_version, + $need_version, + ); + if ( $inst_file + && $available_file eq $inst_file + && $nmo->inst_deprecated + ) { + # continue installing as a prereq. we really want that + # because the deprecated module may spit out warnings + # and third party did not know until today. Only one + # exception is OK, because CPANPLUS is special after + # all: + if ( $fulfills_all_version_rqs and + $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/ + ) { + # here we have an available version that is good + # enough although deprecated (preventing circular + # loop CPANPLUS => CPANPLUS::Dist::Build RT#83042) + next NEED; + } + } elsif ( + $self->{reqtype} # e.g. maybe we came via goto? + && $self->{reqtype} =~ /^(r|c)$/ + && ( exists $prereq_pm->{requires}{$need_module} + || exists $prereq_pm->{opt_requires}{$need_module} ) + && $nmo + && !$inst_file + ) { + # continue installing as a prereq; this may be a + # distro we already used when it was a build_requires + # so we did not install it. But suddenly somebody + # wants it as a requires + my $need_distro = $nmo->distribution; + if ($need_distro->{install} && $need_distro->{install}->failed && $need_distro->{install}->text =~ /is only/) { + my $id = $need_distro->pretty_id; + $CPAN::Frontend->myprint("Promoting $id from build_requires to requires due $need_module\n"); + delete $need_distro->{install}; # promote to another installation attempt + $need_distro->{reqtype} = "r"; + $need_distro->install; + next NEED; + } + } + else { + next NEED if $fulfills_all_version_rqs; + } + } + + if ($need_module eq "perl") { + return ["perl", $need_version]; + } + $self->{sponsored_mods}{$need_module} ||= 0; + CPAN->debug("need_module[$need_module]s/s/n[$self->{sponsored_mods}{$need_module}]") if $CPAN::DEBUG; + if (my $sponsoring = $self->{sponsored_mods}{$need_module}++) { + # We have already sponsored it and for some reason it's still + # not available. So we do ... what?? + + # if we push it again, we have a potential infinite loop + + # The following "next" was a very problematic construct. + # It helped a lot but broke some day and had to be + # replaced. + + # We must be able to deal with modules that come again and + # again as a prereq and have themselves prereqs and the + # queue becomes long but finally we would find the correct + # order. The RecursiveDependency check should trigger a + # die when it's becoming too weird. Unfortunately removing + # this next breaks many other things. + + # The bug that brought this up is described in Todo under + # "5.8.9 cannot install Compress::Zlib" + + # next; # this is the next that had to go away + + # The following "next NEED" are fine and the error message + # explains well what is going on. For example when the DBI + # fails and consequently DBD::SQLite fails and now we are + # processing CPAN::SQLite. Then we must have a "next" for + # DBD::SQLite. How can we get it and how can we identify + # all other cases we must identify? + + my $do = $nmo->distribution; + next NEED unless $do; # not on CPAN + if (CPAN::Version->vcmp($need_version, $nmo->ro->{CPAN_VERSION}) > 0){ + $CPAN::Frontend->mywarn("Warning: Prerequisite ". + "'$need_module => $need_version' ". + "for '$self->{ID}' seems ". + "not available according to the indices\n" + ); + next NEED; + } + NOSAYER: for my $nosayer ( + "unwrapped", + "writemakefile", + "signature_verify", + "make", + "make_test", + "install", + "make_clean", + ) { + if ($do->{$nosayer}) { + my $selfid = $self->pretty_id; + my $did = $do->pretty_id; + if (UNIVERSAL::can($do->{$nosayer},"failed") ? + $do->{$nosayer}->failed : + $do->{$nosayer} =~ /^NO/) { + if ($nosayer eq "make_test" + && + $do->{make_test}{COMMANDID} != $CPAN::CurrentCommandId + ) { + next NOSAYER; + } + ### XXX don't complain about missing optional deps -- xdg, 2012-04-01 + if ($self->is_locally_optional($prereq_pm, $need_module)) { + # don't complain about failing optional prereqs + } + else { + $CPAN::Frontend->mywarn("Warning: Prerequisite ". + "'$need_module => $need_version' ". + "for '$selfid' failed when ". + "processing '$did' with ". + "'$nosayer => $do->{$nosayer}'. Continuing, ". + "but chances to succeed are limited.\n" + ); + $CPAN::Frontend->mysleep($sponsoring/10); + } + next NEED; + } else { # the other guy succeeded + if ($nosayer =~ /^(install|make_test)$/) { + # we had this with + # DMAKI/DateTime-Calendar-Chinese-0.05.tar.gz + # in 2007-03 for 'make install' + # and 2008-04: #30464 (for 'make test') + # $CPAN::Frontend->mywarn("Warning: Prerequisite ". + # "'$need_module => $need_version' ". + # "for '$selfid' already built ". + # "but the result looks suspicious. ". + # "Skipping another build attempt, ". + # "to prevent looping endlessly.\n" + # ); + next NEED; + } + } + } + } + } + my $needed_as; + if (0) { + } elsif (exists $prereq_pm->{requires}{$need_module} + || exists $prereq_pm->{opt_requires}{$need_module} + ) { + $needed_as = "r"; + } elsif ($slot eq "configure_requires_later") { + # in ae872487d5 we said: C< we have not yet run the + # {Build,Makefile}.PL, we must presume "r" >; but the + # meta.yml standard says C< These dependencies are not + # required after the distribution is installed. >; so now + # we change it back to "b" and care for the proper + # promotion later. + $needed_as = "b"; + } else { + $needed_as = "b"; + } + # here need to flag as optional for recommends/suggests + # -- xdg, 2012-04-01 + $self->debug(sprintf "%s manadory?[%s]", + $self->pretty_id, + $self->{mandatory}) + if $CPAN::DEBUG; + my $optional = !$self->{mandatory} + || $self->is_locally_optional($prereq_pm, $need_module); + push @need, [$need_module,$needed_as,$optional]; + } + my @unfolded = map { "[".join(",",@$_)."]" } @need; + CPAN->debug("returning from unsat_prereq[@unfolded]") if $CPAN::DEBUG; + @need; +} + +sub _fulfills_all_version_rqs { + my($self,$need_module,$available_file,$available_version,$need_version) = @_; + my(@all_requirements) = split /\s*,\s*/, $need_version; + local($^W) = 0; + my $ok = 0; + RQ: for my $rq (@all_requirements) { + if ($rq =~ s|>=\s*||) { + } elsif ($rq =~ s|>\s*||) { + # 2005-12: one user + if (CPAN::Version->vgt($available_version,$rq)) { + $ok++; + } + next RQ; + } elsif ($rq =~ s|!=\s*||) { + # 2005-12: no user + if (CPAN::Version->vcmp($available_version,$rq)) { + $ok++; + next RQ; + } else { + $ok=0; + last RQ; + } + } elsif ($rq =~ m|<=?\s*|) { + # 2005-12: no user + $CPAN::Frontend->mywarn("Downgrading not supported (rq[$rq])\n"); + $ok++; + next RQ; + } elsif ($rq =~ s|==\s*||) { + # 2009-07: ELLIOTJS/Perl-Critic-1.099_002.tar.gz + if (CPAN::Version->vcmp($available_version,$rq)) { + $ok=0; + last RQ; + } else { + $ok++; + next RQ; + } + } + if (! CPAN::Version->vgt($rq, $available_version)) { + $ok++; + } + CPAN->debug(sprintf("need_module[%s]available_file[%s]". + "available_version[%s]rq[%s]ok[%d]", + $need_module, + $available_file, + $available_version, + CPAN::Version->readable($rq), + $ok, + )) if $CPAN::DEBUG; + } + my $ret = $ok == @all_requirements; + CPAN->debug(sprintf("need_module[%s]ok[%s]all_requirements[%d]",$need_module, $ok, scalar @all_requirements)) if $CPAN::DEBUG; + return $ret; +} + +#-> sub CPAN::Distribution::read_meta +# read any sort of meta files, return CPAN::Meta object if no errors +sub read_meta { + my($self) = @_; + my $meta_file = $self->pick_meta_file + or return; + + return unless $CPAN::META->has_usable("CPAN::Meta"); + my $meta = eval { CPAN::Meta->load_file($meta_file)} + or return; + + # Very old EU::MM could have wrong META + if ($meta_file eq 'META.yml' + && $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/ + ) { + my $eummv = do { local $^W = 0; $1+0; }; + return if $eummv < 6.2501; + } + + return $meta; +} + +#-> sub CPAN::Distribution::read_yaml ; +# XXX This should be DEPRECATED -- dagolden, 2011-02-05 +sub read_yaml { + my($self) = @_; + my $meta_file = $self->pick_meta_file('\.yml$'); + $self->debug("meta_file[$meta_file]") if $CPAN::DEBUG; + return unless $meta_file; + my $yaml; + eval { $yaml = $self->parse_meta_yml($meta_file) }; + if ($@ or ! $yaml) { + return undef; # if we die, then we cannot read YAML's own META.yml + } + # not "authoritative" + if (defined $yaml && (! ref $yaml || ref $yaml ne "HASH")) { + $CPAN::Frontend->mywarn("META.yml does not seem to be conforming, cannot use it.\n"); + $yaml = undef; + } + $self->debug(sprintf "yaml[%s]", $yaml || "UNDEF") + if $CPAN::DEBUG; + $self->debug($yaml) if $CPAN::DEBUG && $yaml; + # MYMETA.yml is static and authoritative by definition + if ( $meta_file =~ /MYMETA\.yml/ ) { + return $yaml; + } + # META.yml is authoritative only if dynamic_config is defined and false + if ( defined $yaml->{dynamic_config} && ! $yaml->{dynamic_config} ) { + return $yaml; + } + # otherwise, we can't use what we found + return undef; +} + +#-> sub CPAN::Distribution::configure_requires ; +sub configure_requires { + my($self) = @_; + return unless my $meta_file = $self->pick_meta_file('^META'); + if (my $meta_obj = $self->read_meta) { + my $prereqs = $meta_obj->effective_prereqs; + my $cr = $prereqs->requirements_for(qw/configure requires/); + return $cr ? $cr->as_string_hash : undef; + } + else { + my $yaml = eval { $self->parse_meta_yml($meta_file) }; + return $yaml->{configure_requires}; + } +} + +#-> sub CPAN::Distribution::prereq_pm ; +sub prereq_pm { + my($self) = @_; + return unless $self->{writemakefile} # no need to have succeeded + # but we must have run it + || $self->{modulebuild}; + unless ($self->{build_dir}) { + return; + } + # no Makefile/Build means configuration aborted, so don't look for prereqs + my $makefile = File::Spec->catfile($self->{build_dir}, $^O eq 'VMS' ? 'descrip.mms' : 'Makefile'); + my $buildfile = File::Spec->catfile($self->{build_dir}, $^O eq 'VMS' ? 'Build.com' : 'Build'); + return unless -f $makefile || -f $buildfile; + CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]", + $self->{writemakefile}||"", + $self->{modulebuild}||"", + ) if $CPAN::DEBUG; + my($req,$breq, $opt_req, $opt_breq); + my $meta_obj = $self->read_meta; + # META/MYMETA is only authoritative if dynamic_config is false + if ($meta_obj && ! $meta_obj->dynamic_config) { + my $prereqs = $meta_obj->effective_prereqs; + my $requires = $prereqs->requirements_for(qw/runtime requires/); + my $build_requires = $prereqs->requirements_for(qw/build requires/); + my $test_requires = $prereqs->requirements_for(qw/test requires/); + # XXX we don't yet distinguish build vs test, so merge them for now + $build_requires->add_requirements($test_requires); + $req = $requires->as_string_hash; + $breq = $build_requires->as_string_hash; + + # XXX assemble optional_req && optional_breq from recommends/suggests + # depending on corresponding policies -- xdg, 2012-04-01 + CPAN->use_inst("CPAN::Meta::Requirements"); + my $opt_runtime = CPAN::Meta::Requirements->new; + my $opt_build = CPAN::Meta::Requirements->new; + if ( $CPAN::Config->{recommends_policy} ) { + $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime recommends/)); + $opt_build->add_requirements( $prereqs->requirements_for(qw/build recommends/)); + $opt_build->add_requirements( $prereqs->requirements_for(qw/test recommends/)); + + } + if ( $CPAN::Config->{suggests_policy} ) { + $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime suggests/)); + $opt_build->add_requirements( $prereqs->requirements_for(qw/build suggests/)); + $opt_build->add_requirements( $prereqs->requirements_for(qw/test suggests/)); + } + $opt_req = $opt_runtime->as_string_hash; + $opt_breq = $opt_build->as_string_hash; + } + elsif (my $yaml = $self->read_yaml) { # often dynamic_config prevents a result here + $req = $yaml->{requires} || {}; + $breq = $yaml->{build_requires} || {}; + if ( $CPAN::Config->{recommends_policy} ) { + $opt_req = $yaml->{recommends} || {}; + } + undef $req unless ref $req eq "HASH" && %$req; + if ($req) { + if ($yaml->{generated_by} && + $yaml->{generated_by} =~ /ExtUtils::MakeMaker version ([\d\._]+)/) { + my $eummv = do { local $^W = 0; $1+0; }; + if ($eummv < 6.2501) { + # thanks to Slaven for digging that out: MM before + # that could be wrong because it could reflect a + # previous release + undef $req; + } + } + my $areq; + my $do_replace; + foreach my $k (sort keys %{$req||{}}) { + my $v = $req->{$k}; + next unless defined $v; + if ($v =~ /\d/) { + $areq->{$k} = $v; + } elsif ($k =~ /[A-Za-z]/ && + $v =~ /[A-Za-z]/ && + $CPAN::META->exists("CPAN::Module",$v) + ) { + $CPAN::Frontend->mywarn("Suspicious key-value pair in META.yml's ". + "requires hash: $k => $v; I'll take both ". + "key and value as a module name\n"); + $CPAN::Frontend->mysleep(1); + $areq->{$k} = 0; + $areq->{$v} = 0; + $do_replace++; + } + } + $req = $areq if $do_replace; + } + } + else { + $CPAN::Frontend->mywarnonce("Could not read metadata file. Falling back to other ". + "methods to determine prerequisites\n"); + } + + unless ($req || $breq) { + my $build_dir; + unless ( $build_dir = $self->{build_dir} ) { + return; + } + my $makefile = File::Spec->catfile($build_dir,"Makefile"); + my $fh; + if (-f $makefile + and + $fh = FileHandle->new("<$makefile\0")) { + CPAN->debug("Getting prereq from Makefile") if $CPAN::DEBUG; + local($/) = "\n"; + while (<$fh>) { + last if /MakeMaker post_initialize section/; + my($p) = m{^[\#] + \s+PREREQ_PM\s+=>\s+(.+) + }x; + next unless $p; + # warn "Found prereq expr[$p]"; + + # Regexp modified by A.Speer to remember actual version of file + # PREREQ_PM hash key wants, then add to + while ( $p =~ m/(?:\s)([\w\:]+)=>(q\[.*?\]|undef),?/g ) { + my($m,$n) = ($1,$2); + # When a prereq is mentioned twice: let the bigger + # win; usual culprit is that they declared + # build_requires separately from requires; see + # rt.cpan.org #47774 + my($prevn); + if ( defined $req->{$m} ) { + $prevn = $req->{$m}; + } + if ($n =~ /^q\[(.*?)\]$/) { + $n = $1; + } + if (!$prevn || CPAN::Version->vlt($prevn, $n)){ + $req->{$m} = $n; + } + } + last; + } + } + } + unless ($req || $breq) { + my $build_dir = $self->{build_dir} or die "Panic: no build_dir?"; + my $buildfile = File::Spec->catfile($build_dir,"Build"); + if (-f $buildfile) { + CPAN->debug("Found '$buildfile'") if $CPAN::DEBUG; + my $build_prereqs = File::Spec->catfile($build_dir,"_build","prereqs"); + if (-f $build_prereqs) { + CPAN->debug("Getting prerequisites from '$build_prereqs'") if $CPAN::DEBUG; + my $content = do { local *FH; + open FH, $build_prereqs + or $CPAN::Frontend->mydie("Could not open ". + "'$build_prereqs': $!"); + local $/; + ; + }; + my $bphash = eval $content; + if ($@) { + } else { + $req = $bphash->{requires} || +{}; + $breq = $bphash->{build_requires} || +{}; + } + } + } + } + # XXX needs to be adapted for optional_req & optional_breq -- xdg, 2012-04-01 + if ($req || $breq || $opt_req || $opt_breq ) { + return $self->{prereq_pm} = { + requires => $req, + build_requires => $breq, + opt_requires => $opt_req, + opt_build_requires => $opt_breq, + }; + } +} + +#-> sub CPAN::Distribution::shortcut_test ; +# return values: undef means don't shortcut; 0 means shortcut as fail; +# and 1 means shortcut as success +sub shortcut_test { + my ($self) = @_; + + $self->debug("checking badtestcnt[$self->{ID}]") if $CPAN::DEBUG; + $self->{badtestcnt} ||= 0; + if ($self->{badtestcnt} > 0) { + require Data::Dumper; + CPAN->debug(sprintf "NOREPEAT[%s]", Data::Dumper::Dumper($self)) if $CPAN::DEBUG; + return $self->goodbye("Won't repeat unsuccessful test during this command"); + } + + for my $slot ( qw/later configure_requires_later/ ) { + $self->debug("checking $slot slot[$self->{ID}]") if $CPAN::DEBUG; + return $self->success($self->{$slot}) + if $self->{$slot}; + } + + $self->debug("checking if tests passed[$self->{ID}]") if $CPAN::DEBUG; + if ( $self->{make_test} ) { + if ( + UNIVERSAL::can($self->{make_test},"failed") ? + $self->{make_test}->failed : + $self->{make_test} =~ /^NO/ + ) { + if ( + UNIVERSAL::can($self->{make_test},"commandid") + && + $self->{make_test}->commandid == $CPAN::CurrentCommandId + ) { + return $self->goodbye("Has already been tested within this command"); + } + } else { + # if global "is_tested" has been cleared, we need to mark this to + # be added to PERL5LIB if not already installed + if ($self->tested_ok_but_not_installed) { + $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME}); + } + return $self->success("Has already been tested successfully"); + } + } + + if ($self->{notest}) { + $self->{make_test} = CPAN::Distrostatus->new("YES"); + return $self->success("Skipping test because of notest pragma"); + } + + return undef; # no shortcut +} + +#-> sub CPAN::Distribution::_exe_files ; +sub _exe_files { + my($self) = @_; + return unless $self->{writemakefile} # no need to have succeeded + # but we must have run it + || $self->{modulebuild}; + unless ($self->{build_dir}) { + return; + } + CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]", + $self->{writemakefile}||"", + $self->{modulebuild}||"", + ) if $CPAN::DEBUG; + my $build_dir; + unless ( $build_dir = $self->{build_dir} ) { + return; + } + my $makefile = File::Spec->catfile($build_dir,"Makefile"); + my $fh; + my @exe_files; + if (-f $makefile + and + $fh = FileHandle->new("<$makefile\0")) { + CPAN->debug("Getting exefiles from Makefile") if $CPAN::DEBUG; + local($/) = "\n"; + while (<$fh>) { + last if /MakeMaker post_initialize section/; + my($p) = m{^[\#] + \s+EXE_FILES\s+=>\s+\[(.+)\] + }x; + next unless $p; + # warn "Found exefiles expr[$p]"; + my @p = split /,\s*/, $p; + for my $p2 (@p) { + if ($p2 =~ /^q\[(.+)\]/) { + push @exe_files, $1; + } + } + } + } + return \@exe_files if @exe_files; + my $buildparams = File::Spec->catfile($build_dir,"_build","build_params"); + if (-f $buildparams) { + CPAN->debug("Found '$buildparams'") if $CPAN::DEBUG; + my $x = do $buildparams; + for my $sf ($x->[2]{script_files}) { + if (my $reftype = ref $sf) { + if ($reftype eq "ARRAY") { + push @exe_files, @$sf; + } + elsif ($reftype eq "HASH") { + push @exe_files, keys %$sf; + } + else { + $CPAN::Frontend->mywarn("Invalid reftype $reftype for Build.PL 'script_files'\n"); + } + } + elsif (defined $sf) { + push @exe_files, $sf; + } + } + } + return \@exe_files; +} + +#-> sub CPAN::Distribution::test ; +sub test { + my($self) = @_; + + $self->pre_test(); + + if (exists $self->{cleanup_after_install_done}) { + $self->post_test(); + return $self->make; + } + + $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG; + if (my $goto = $self->prefs->{goto}) { + $self->post_test(); + return $self->goto($goto); + } + + unless ($self->make){ + $self->post_test(); + return; + } + + if ( defined( my $sc = $self->shortcut_test ) ) { + $self->post_test(); + return $sc; + } + + if ($CPAN::Signal) { + delete $self->{force_update}; + $self->post_test(); + return; + } + # warn "XDEBUG: checking for notest: $self->{notest} $self"; + my $make = $self->{modulebuild} ? "Build" : "make"; + + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + local $ENV{PERL_USE_UNSAFE_INC} = + exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC} + ? $ENV{PERL_USE_UNSAFE_INC} : 1; # test + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default}; + local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default}; + + if ($run_allow_installing_within_test) { + my($allow_installing, $why) = $self->_allow_installing; + if (! $allow_installing) { + $CPAN::Frontend->mywarn("Testing/Installation stopped: $why\n"); + $self->introduce_myself; + $self->{make_test} = CPAN::Distrostatus->new("NO -- testing/installation stopped due $why"); + $CPAN::Frontend->mywarn(" [testing] -- NOT OK\n"); + delete $self->{force_update}; + $self->post_test(); + return; + } + } + $CPAN::Frontend->myprint(sprintf "Running %s test for %s\n", $make, $self->pretty_id); + + my $builddir = $self->dir or + $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n"); + + unless (chdir $builddir) { + $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!"); + $self->post_test(); + return; + } + + $self->debug("Changed directory to $self->{build_dir}") + if $CPAN::DEBUG; + + if ($^O eq 'MacOS') { + Mac::BuildTools::make_test($self); + $self->post_test(); + return; + } + + if ($self->{modulebuild}) { + my $thm = CPAN::Shell->expand("Module","Test::Harness"); + my $v = $thm->inst_version; + if (CPAN::Version->vlt($v,2.62)) { + # XXX Eric Wilhelm reported this as a bug: klapperl: + # Test::Harness 3.0 self-tests, so that should be 'unless + # installing Test::Harness' + unless ($self->id eq $thm->distribution->id) { + $CPAN::Frontend->mywarn(qq{The version of your Test::Harness is only + '$v', you need at least '2.62'. Please upgrade your Test::Harness.\n}); + $self->{make_test} = CPAN::Distrostatus->new("NO Test::Harness too old"); + $self->post_test(); + return; + } + } + } + + if ( ! $self->{force_update} ) { + # bypass actual tests if "trust_test_report_history" and have a report + my $have_tested_fcn; + if ( $CPAN::Config->{trust_test_report_history} + && $CPAN::META->has_inst("CPAN::Reporter::History") + && ( $have_tested_fcn = CPAN::Reporter::History->can("have_tested" ))) { + if ( my @reports = $have_tested_fcn->( dist => $self->base_id ) ) { + # Do nothing if grade was DISCARD + if ( $reports[-1]->{grade} =~ /^(?:PASS|UNKNOWN)$/ ) { + $self->{make_test} = CPAN::Distrostatus->new("YES"); + # if global "is_tested" has been cleared, we need to mark this to + # be added to PERL5LIB if not already installed + if ($self->tested_ok_but_not_installed) { + $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME}); + } + $CPAN::Frontend->myprint("Found prior test report -- OK\n"); + $self->post_test(); + return; + } + elsif ( $reports[-1]->{grade} =~ /^(?:FAIL|NA)$/ ) { + $self->{make_test} = CPAN::Distrostatus->new("NO"); + $self->{badtestcnt}++; + $CPAN::Frontend->mywarn("Found prior test report -- NOT OK\n"); + $self->post_test(); + return; + } + } + } + } + + my $system; + my $prefs_test = $self->prefs->{test}; + if (my $commandline + = exists $prefs_test->{commandline} ? $prefs_test->{commandline} : "") { + $system = $commandline; + $ENV{PERL} = CPAN::find_perl(); + } elsif ($self->{modulebuild}) { + $system = sprintf "%s test", $self->_build_command(); + unless (-e "Build" || ($^O eq 'VMS' && -e "Build.com")) { + my $id = $self->pretty_id; + $CPAN::Frontend->mywarn("Alert: no 'Build' file found while trying to test '$id'"); + } + } else { + $system = join " ", $self->_make_command(), "test"; + } + my $make_test_arg = $self->_make_phase_arg("test"); + $system = sprintf("%s%s", + $system, + $make_test_arg ? " $make_test_arg" : "", + ); + my($tests_ok); + my $test_env; + if ($self->prefs->{test}) { + $test_env = $self->prefs->{test}{env}; + } + local @ENV{keys %$test_env} = values %$test_env if $test_env; + my $expect_model = $self->_prefs_with_expect("test"); + my $want_expect = 0; + if ( $expect_model && @{$expect_model->{talk}} ) { + my $can_expect = $CPAN::META->has_inst("Expect"); + if ($can_expect) { + $want_expect = 1; + } else { + $CPAN::Frontend->mywarn("Expect not installed, falling back to ". + "testing without\n"); + } + } + + FORK: { + my $pid = fork; + if (! defined $pid) { # contention + warn "Contention '$!', sleeping 2"; + sleep 2; + redo FORK; + } elsif ($pid) { # parent + if ($^O eq "MSWin32") { + wait; + } else { + SUPERVISE: while (waitpid($pid, WNOHANG) <= 0) { + if ($CPAN::Signal) { + kill 9, -$pid; + } + sleep 1; + } + } + $tests_ok = !$?; + } else { # child + POSIX::setsid() unless $^O eq "MSWin32"; + my $c_ok; + $|=1; + if ($want_expect) { + if ($self->_should_report('test')) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is currently ". + "not supported when distroprefs specify ". + "an interactive test\n"); + } + $c_ok = $self->_run_via_expect($system,'test',$expect_model) == 0; + } elsif ( $self->_should_report('test') ) { + $c_ok = CPAN::Reporter::test($self, $system); + } else { + $c_ok = system($system) == 0; + } + exit !$c_ok; + } + } # FORK + + $self->introduce_myself; + my $but = $self->_make_test_illuminate_prereqs(); + if ( $tests_ok ) { + if ($but) { + $CPAN::Frontend->mywarn("Tests succeeded but $but\n"); + $self->{make_test} = CPAN::Distrostatus->new("NO $but"); + $self->store_persistent_state; + $self->post_test(); + return $self->goodbye("[dependencies] -- NA"); + } + $CPAN::Frontend->myprint(" $system -- OK\n"); + $self->{make_test} = CPAN::Distrostatus->new("YES"); + $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME}); + # probably impossible to need the next line because badtestcnt + # has a lifespan of one command + delete $self->{badtestcnt}; + } else { + if ($but) { + $but .= "; additionally test harness failed"; + $CPAN::Frontend->mywarn("$but\n"); + $self->{make_test} = CPAN::Distrostatus->new("NO $but"); + } elsif ( $self->{force_update} ) { + $self->{make_test} = CPAN::Distrostatus->new( + "NO but failure ignored because 'force' in effect" + ); + } elsif ($CPAN::Signal) { + $self->{make_test} = CPAN::Distrostatus->new("NO -- Interrupted"); + } else { + $self->{make_test} = CPAN::Distrostatus->new("NO"); + } + $self->{badtestcnt}++; + $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); + CPAN::Shell->optprint + ("hint", + sprintf + ("//hint// to see the cpan-testers results for installing this module, try: + reports %s\n", + $self->pretty_id)); + } + $self->store_persistent_state; + + $self->post_test(); + + return $self->{force_update} ? 1 : !! $tests_ok; +} + +sub _make_test_illuminate_prereqs { + my($self) = @_; + my @prereq; + + # local $CPAN::DEBUG = 16; # Distribution + for my $m (sort keys %{$self->{sponsored_mods}}) { + next unless $self->{sponsored_mods}{$m} > 0; + my $m_obj = CPAN::Shell->expand("Module",$m) or next; + # XXX we need available_version which reflects + # $ENV{PERL5LIB} so that already tested but not yet + # installed modules are counted. + my $available_version = $m_obj->available_version; + my $available_file = $m_obj->available_file; + if ($available_version && + !CPAN::Version->vlt($available_version,$self->{prereq_pm}{$m}) + ) { + CPAN->debug("m[$m] good enough available_version[$available_version]") + if $CPAN::DEBUG; + } elsif ($available_file + && ( + !$self->{prereq_pm}{$m} + || + $self->{prereq_pm}{$m} == 0 + ) + ) { + # lex Class::Accessor::Chained::Fast which has no $VERSION + CPAN->debug("m[$m] have available_file[$available_file]") + if $CPAN::DEBUG; + } else { + push @prereq, $m + unless $self->is_locally_optional(undef, $m); + } + } + my $but; + if (@prereq) { + my $cnt = @prereq; + my $which = join ",", @prereq; + $but = $cnt == 1 ? "one dependency not OK ($which)" : + "$cnt dependencies missing ($which)"; + } + $but; +} + +sub _prefs_with_expect { + my($self,$where) = @_; + return unless my $prefs = $self->prefs; + return unless my $where_prefs = $prefs->{$where}; + if ($where_prefs->{expect}) { + return { + mode => "deterministic", + timeout => 15, + talk => $where_prefs->{expect}, + }; + } elsif ($where_prefs->{"eexpect"}) { + return $where_prefs->{"eexpect"}; + } + return; +} + +#-> sub CPAN::Distribution::clean ; +sub clean { + my($self) = @_; + my $make = $self->{modulebuild} ? "Build" : "make"; + $CPAN::Frontend->myprint(sprintf "Running %s clean for %s\n", $make, $self->pretty_id); + unless (exists $self->{archived}) { + $CPAN::Frontend->mywarn("Distribution seems to have never been unzipped". + "/untarred, nothing done\n"); + return 1; + } + unless (exists $self->{build_dir}) { + $CPAN::Frontend->mywarn("Distribution has no own directory, nothing to do.\n"); + return 1; + } + if (exists $self->{writemakefile} + and $self->{writemakefile}->failed + ) { + $CPAN::Frontend->mywarn("No Makefile, don't know how to 'make clean'\n"); + return 1; + } + EXCUSE: { + my @e; + exists $self->{make_clean} and $self->{make_clean} eq "YES" and + push @e, "make clean already called once"; + $CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e; + } + chdir "$self->{build_dir}" or + Carp::confess("Couldn't chdir to $self->{build_dir}: $!"); + $self->debug("Changed directory to $self->{build_dir}") if $CPAN::DEBUG; + + if ($^O eq 'MacOS') { + Mac::BuildTools::make_clean($self); + return; + } + + my $system; + if ($self->{modulebuild}) { + unless (-f "Build") { + my $cwd = CPAN::anycwd(); + $CPAN::Frontend->mywarn("Alert: no Build file available for 'clean $self->{id}". + " in cwd[$cwd]. Danger, Will Robinson!"); + $CPAN::Frontend->mysleep(5); + } + $system = sprintf "%s clean", $self->_build_command(); + } else { + $system = join " ", $self->_make_command(), "clean"; + } + my $system_ok = system($system) == 0; + $self->introduce_myself; + if ( $system_ok ) { + $CPAN::Frontend->myprint(" $system -- OK\n"); + + # $self->force; + + # Jost Krieger pointed out that this "force" was wrong because + # it has the effect that the next "install" on this distribution + # will untar everything again. Instead we should bring the + # object's state back to where it is after untarring. + + for my $k (qw( + force_update + install + writemakefile + make + make_test + )) { + delete $self->{$k}; + } + $self->{make_clean} = CPAN::Distrostatus->new("YES"); + + } else { + # Hmmm, what to do if make clean failed? + + $self->{make_clean} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(qq{ $system -- NOT OK\n}); + + # 2006-02-27: seems silly to me to force a make now + # $self->force("make"); # so that this directory won't be used again + + } + $self->store_persistent_state; +} + +#-> sub CPAN::Distribution::check_disabled ; +sub check_disabled { + my ($self) = @_; + $self->debug("checking disabled id[$self->{ID}]") if $CPAN::DEBUG; + if ($self->prefs->{disabled} && ! $self->{force_update}) { + return sprintf( + "Disabled via prefs file '%s' doc %d", + $self->{prefs_file}, + $self->{prefs_file_doc}, + ); + } + return; +} + +#-> sub CPAN::Distribution::goto ; +sub goto { + my($self,$goto) = @_; + $goto = $self->normalize($goto); + my $why = sprintf( + "Goto '$goto' via prefs file '%s' doc %d", + $self->{prefs_file}, + $self->{prefs_file_doc}, + ); + $self->{unwrapped} = CPAN::Distrostatus->new("NO $why"); + # 2007-07-16 akoenig : Better than NA would be if we could inherit + # the status of the $goto distro but given the exceptional nature + # of 'goto' I feel reluctant to implement it + my $goodbye_message = "[goto] -- NA $why"; + $self->goodbye($goodbye_message); + + # inject into the queue + + CPAN::Queue->delete($self->id); + CPAN::Queue->jumpqueue({qmod => $goto, reqtype => $self->{reqtype}}); + + # and run where we left off + + my($method) = (caller(1))[3]; + my $goto_do = CPAN->instance("CPAN::Distribution",$goto); + $goto_do->called_for($self->called_for) unless $goto_do->called_for; + $goto_do->{mandatory} ||= $self->{mandatory}; + $goto_do->{reqtype} ||= $self->{reqtype}; + $goto_do->{coming_from} = $self->pretty_id; + $goto_do->$method(); + CPAN::Queue->delete_first($goto); + # XXX delete_first returns undef; is that what this should return + # up the call stack, eg. return $sefl->goto($goto) -- xdg, 2012-04-04 +} + +#-> sub CPAN::Distribution::shortcut_install ; +# return values: undef means don't shortcut; 0 means shortcut as fail; +# and 1 means shortcut as success +sub shortcut_install { + my ($self) = @_; + + $self->debug("checking previous install results[$self->{ID}]") if $CPAN::DEBUG; + if (exists $self->{install}) { + my $text = UNIVERSAL::can($self->{install},"text") ? + $self->{install}->text : + $self->{install}; + if ($text =~ /^YES/) { + $CPAN::META->is_installed($self->{build_dir}); + return $self->success("Already done"); + } elsif ($text =~ /is only/) { + # e.g. 'is only build_requires': may be overruled later + return $self->goodbye($text); + } else { + # comment in Todo on 2006-02-11; maybe retry? + return $self->goodbye("Already tried without success"); + } + } + + for my $slot ( qw/later configure_requires_later/ ) { + return $self->success($self->{$slot}) + if $self->{$slot}; + } + + return undef; +} + +#-> sub CPAN::Distribution::is_being_sponsored ; + +# returns true if we find a distro object in the queue that has +# sponsored this one +sub is_being_sponsored { + my($self) = @_; + my $iterator = CPAN::Queue->iterator; + QITEM: while (my $q = $iterator->()) { + my $s = $q->as_string; + my $obj = CPAN::Shell->expandany($s) or next QITEM; + my $type = ref $obj; + if ( $type eq 'CPAN::Distribution' ){ + for my $module (sort keys %{$obj->{sponsored_mods} || {}}) { + return 1 if grep { $_ eq $module } $self->containsmods; + } + } + } + return 0; +} + +#-> sub CPAN::Distribution::install ; +sub install { + my($self) = @_; + + $self->pre_install(); + + if (exists $self->{cleanup_after_install_done}) { + return $self->test; + } + + $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG; + if (my $goto = $self->prefs->{goto}) { + $self->goto($goto); + $self->post_install(); + return; + } + + unless ($self->test) { + $self->post_install(); + return; + } + + if ( defined( my $sc = $self->shortcut_install ) ) { + $self->post_install(); + return $sc; + } + + if ($CPAN::Signal) { + delete $self->{force_update}; + $self->post_install(); + return; + } + + my $builddir = $self->dir or + $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n"); + + unless (chdir $builddir) { + $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!"); + $self->post_install(); + return; + } + + $self->debug("Changed directory to $self->{build_dir}") + if $CPAN::DEBUG; + + my $make = $self->{modulebuild} ? "Build" : "make"; + $CPAN::Frontend->myprint(sprintf "Running %s install for %s\n", $make, $self->pretty_id); + + if ($^O eq 'MacOS') { + Mac::BuildTools::make_install($self); + $self->post_install(); + return; + } + + my $system; + if (my $commandline = $self->prefs->{install}{commandline}) { + $system = $commandline; + $ENV{PERL} = CPAN::find_perl(); + } elsif ($self->{modulebuild}) { + my($mbuild_install_build_command) = + exists $CPAN::HandleConfig::keys{mbuild_install_build_command} && + $CPAN::Config->{mbuild_install_build_command} ? + $CPAN::Config->{mbuild_install_build_command} : + $self->_build_command(); + my $install_directive = $^O eq 'VMS' ? '"install"' : 'install'; + $system = sprintf("%s %s %s", + $mbuild_install_build_command, + $install_directive, + $CPAN::Config->{mbuild_install_arg}, + ); + } else { + my($make_install_make_command) = $self->_make_install_make_command(); + $system = sprintf("%s install %s", + $make_install_make_command, + $CPAN::Config->{make_install_arg}, + ); + } + + my($stderr) = $^O eq "MSWin32" || $^O eq 'VMS' ? "" : " 2>&1 "; + my $brip = CPAN::HandleConfig->prefs_lookup($self, + q{build_requires_install_policy}); + $brip ||="ask/yes"; + my $id = $self->id; + my $reqtype = $self->{reqtype} ||= "c"; # in doubt it was a command + my $want_install = "yes"; + if ($reqtype eq "b") { + if ($brip eq "no") { + $want_install = "no"; + } elsif ($brip =~ m|^ask/(.+)|) { + my $default = $1; + $default = "yes" unless $default =~ /^(y|n)/i; + $want_install = + CPAN::Shell::colorable_makemaker_prompt + ("$id is just needed temporarily during building or testing. ". + "Do you want to install it permanently?", + $default); + } + } + unless ($want_install =~ /^y/i) { + my $is_only = "is only 'build_requires'"; + $self->{install} = CPAN::Distrostatus->new("NO -- $is_only"); + delete $self->{force_update}; + $self->goodbye("Not installing because $is_only"); + $self->post_install(); + return; + } + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : ""; + local $ENV{PERL_USE_UNSAFE_INC} = + exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC} + ? $ENV{PERL_USE_UNSAFE_INC} : 1; # install + $CPAN::META->set_perl5lib; + local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default}; + local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default}; + + my $install_env; + if ($self->prefs->{install}) { + $install_env = $self->prefs->{install}{env}; + } + local @ENV{keys %$install_env} = values %$install_env if $install_env; + + if (! $run_allow_installing_within_test) { + my($allow_installing, $why) = $self->_allow_installing; + if (! $allow_installing) { + $CPAN::Frontend->mywarn("Installation stopped: $why\n"); + $self->introduce_myself; + $self->{install} = CPAN::Distrostatus->new("NO -- installation stopped due $why"); + $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); + delete $self->{force_update}; + $self->post_install(); + return; + } + } + my($pipe) = FileHandle->new("$system $stderr |"); + unless ($pipe) { + $CPAN::Frontend->mywarn("Can't execute $system: $!"); + $self->introduce_myself; + $self->{install} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); + delete $self->{force_update}; + $self->post_install(); + return; + } + my($makeout) = ""; + while (<$pipe>) { + print $_; # intentionally NOT use Frontend->myprint because it + # looks irritating when we markup in color what we + # just pass through from an external program + $makeout .= $_; + } + $pipe->close; + my $close_ok = $? == 0; + $self->introduce_myself; + if ( $close_ok ) { + $CPAN::Frontend->myprint(" $system -- OK\n"); + $CPAN::META->is_installed($self->{build_dir}); + $self->{install} = CPAN::Distrostatus->new("YES"); + if ($CPAN::Config->{'cleanup_after_install'} + && ! $self->is_dot_dist + && ! $self->is_being_sponsored) { + my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir ); + chdir $parent or $CPAN::Frontend->mydie("Couldn't chdir to $parent: $!\n"); + File::Path::rmtree($self->{build_dir}); + my $yml = "$self->{build_dir}.yml"; + if (-e $yml) { + unlink $yml or $CPAN::Frontend->mydie("Couldn't unlink $yml: $!\n"); + } + $self->{cleanup_after_install_done}=1; + } + } else { + $self->{install} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); + my $mimc = + CPAN::HandleConfig->prefs_lookup($self, + q{make_install_make_command}); + if ( + $makeout =~ /permission/s + && $> > 0 + && ( + ! $mimc + || $mimc eq (CPAN::HandleConfig->prefs_lookup($self, + q{make})) + ) + ) { + $CPAN::Frontend->myprint( + qq{----\n}. + qq{ You may have to su }. + qq{to root to install the package\n}. + qq{ (Or you may want to run something like\n}. + qq{ o conf make_install_make_command 'sudo make'\n}. + qq{ to raise your permissions.} + ); + } + } + delete $self->{force_update}; + unless ($CPAN::Config->{'cleanup_after_install'}) { + $self->store_persistent_state; + } + + $self->post_install(); + + return !! $close_ok; +} + +sub blib_pm_walk { + my @queue = grep { -e $_ } File::Spec->catdir("blib","lib"), File::Spec->catdir("blib","arch"); + return sub { + LOOP: { + if (@queue) { + my $file = shift @queue; + if (-d $file) { + my $dh; + opendir $dh, $file or next; + my @newfiles = map { + my @ret; + my $maybedir = File::Spec->catdir($file, $_); + if (-d $maybedir) { + unless (File::Spec->catdir("blib","arch","auto") eq $maybedir) { + # prune the blib/arch/auto directory, no pm files there + @ret = $maybedir; + } + } elsif (/\.pm$/) { + my $mustbefile = File::Spec->catfile($file, $_); + if (-f $mustbefile) { + @ret = $mustbefile; + } + } + @ret; + } grep { + $_ ne "." + && $_ ne ".." + } readdir $dh; + push @queue, @newfiles; + redo LOOP; + } else { + return $file; + } + } else { + return; + } + } + }; +} + +sub _allow_installing { + my($self) = @_; + my $id = my $pretty_id = $self->pretty_id; + if ($self->{CALLED_FOR}) { + $id .= " (called for $self->{CALLED_FOR})"; + } + my $allow_down = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_module_downgrades}); + $allow_down ||= "ask/yes"; + my $allow_outdd = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_outdated_dists}); + $allow_outdd ||= "ask/yes"; + return 1 if + $allow_down eq "yes" + && $allow_outdd eq "yes"; + if (($allow_outdd ne "yes") && ! $CPAN::META->has_inst('CPAN::DistnameInfo')) { + return 1 if grep { $_ eq 'CPAN::DistnameInfo'} $self->containsmods; + if ($allow_outdd ne "yes") { + $CPAN::Frontend->mywarn("The current configuration of allow_installing_outdated_dists is '$allow_outdd', but for this option we would need 'CPAN::DistnameInfo' installed. Please install 'CPAN::DistnameInfo' as soon as possible. As long as we are not equipped with 'CPAN::DistnameInfo' this option does not take effect\n"); + $allow_outdd = "yes"; + } + } + return 1 if + $allow_down eq "yes" + && $allow_outdd eq "yes"; + my($dist_version, $dist_dist); + if ($allow_outdd ne "yes"){ + my $dni = CPAN::DistnameInfo->new($pretty_id); + $dist_version = $dni->version; + $dist_dist = $dni->dist; + } + my $iterator = blib_pm_walk(); + my(@down,@outdd); + while (my $file = $iterator->()) { + my $version = CPAN::Module->parse_version($file); + my($volume, $directories, $pmfile) = File::Spec->splitpath( $file ); + my @dirs = File::Spec->splitdir( $directories ); + my(@blib_plus1) = splice @dirs, 0, 2; + my($pmpath) = File::Spec->catfile(grep { length($_) } @dirs, $pmfile); + unless ($allow_down eq "yes") { + if (my $inst_file = $self->_file_in_path($pmpath, \@INC)) { + my $inst_version = CPAN::Module->parse_version($inst_file); + my $cmp = CPAN::Version->vcmp($version, $inst_version); + if ($cmp) { + if ($cmp < 0) { + push @down, { pmpath => $pmpath, version => $version, inst_version => $inst_version }; + } + } + if (@down) { + my $why = "allow_installing_module_downgrades: $id contains downgrading module(s) (e.g. '$down[0]{pmpath}' would downgrade installed '$down[0]{inst_version}' to '$down[0]{version}')"; + if (my($default) = $allow_down =~ m|^ask/(.+)|) { + $default = "yes" unless $default =~ /^(y|n)/i; + my $answer = CPAN::Shell::colorable_makemaker_prompt + ("$why. Do you want to allow installing it?", + $default, "colorize_warn"); + $allow_down = $answer =~ /^\s*y/i ? "yes" : "no"; + } + if ($allow_down eq "no") { + return (0, $why); + } + } + } + } + unless ($allow_outdd eq "yes") { + my @pmpath = (@dirs, $pmfile); + $pmpath[-1] =~ s/\.pm$//; + my $mo = CPAN::Shell->expand("Module",join "::", grep { length($_) } @pmpath); + if ($mo) { + my $cpan_version = $mo->cpan_version; + my $is_lower = CPAN::Version->vlt($version, $cpan_version); + my $other_dist; + if (my $mo_dist = $mo->distribution) { + $other_dist = $mo_dist->pretty_id; + my $dni = CPAN::DistnameInfo->new($other_dist); + if ($dni->dist eq $dist_dist){ + if (CPAN::Version->vgt($dni->version, $dist_version)) { + push @outdd, { + pmpath => $pmpath, + cpan_path => $dni->pathname, + dist_version => $dni->version, + dist_dist => $dni->dist, + }; + } + } + } + } + if (@outdd && $allow_outdd ne "yes") { + my $why = "allow_installing_outdated_dists: $id contains module(s) that are indexed on the CPAN with a different distro: (e.g. '$outdd[0]{pmpath}' is indexed with '$outdd[0]{cpan_path}')"; + if ($outdd[0]{dist_dist} eq $dist_dist) { + $why .= ", and this has a higher distribution-version, i.e. version '$outdd[0]{dist_version}' is higher than '$dist_version')"; + } + if (my($default) = $allow_outdd =~ m|^ask/(.+)|) { + $default = "yes" unless $default =~ /^(y|n)/i; + my $answer = CPAN::Shell::colorable_makemaker_prompt + ("$why. Do you want to allow installing it?", + $default, "colorize_warn"); + $allow_outdd = $answer =~ /^\s*y/i ? "yes" : "no"; + } + if ($allow_outdd eq "no") { + return (0, $why); + } + } + } + } + return 1; +} + +sub _file_in_path { # similar to CPAN::Module::_file_in_path + my($self,$pmpath,$incpath) = @_; + my($dir,@packpath); + foreach $dir (@$incpath) { + my $pmfile = File::Spec->catfile($dir,$pmpath); + if (-f $pmfile) { + return $pmfile; + } + } + return; +} +sub introduce_myself { + my($self) = @_; + $CPAN::Frontend->myprint(sprintf(" %s\n",$self->pretty_id)); +} + +#-> sub CPAN::Distribution::dir ; +sub dir { + shift->{build_dir}; +} + +#-> sub CPAN::Distribution::perldoc ; +sub perldoc { + my($self) = @_; + + my($dist) = $self->id; + my $package = $self->called_for; + + if ($CPAN::META->has_inst("Pod::Perldocs")) { + my($perl) = $self->perl + or $CPAN::Frontend->mydie("Couldn't find executable perl\n"); + my @args = ($perl, q{-MPod::Perldocs}, q{-e}, + q{Pod::Perldocs->run()}, $package); + my($wstatus); + unless ( ($wstatus = system(@args)) == 0 ) { + my $estatus = $wstatus >> 8; + $CPAN::Frontend->myprint(qq{ + Function system("@args") + returned status $estatus (wstat $wstatus) + }); + } + } + else { + $self->_display_url( $CPAN::Defaultdocs . $package ); + } +} + +#-> sub CPAN::Distribution::_check_binary ; +sub _check_binary { + my ($dist,$shell,$binary) = @_; + my ($pid,$out); + + $CPAN::Frontend->myprint(qq{ + _check_binary($binary)\n}) + if $CPAN::DEBUG; + + if ($CPAN::META->has_inst("File::Which")) { + return File::Which::which($binary); + } else { + local *README; + $pid = open README, "which $binary|" + or $CPAN::Frontend->mywarn(qq{Could not fork 'which $binary': $!\n}); + return unless $pid; + while () { + $out .= $_; + } + close README + or $CPAN::Frontend->mywarn("Could not run 'which $binary': $!\n") + and return; + } + + $CPAN::Frontend->myprint(qq{ + $out \n}) + if $CPAN::DEBUG && $out; + + return $out; +} + +#-> sub CPAN::Distribution::_display_url ; +sub _display_url { + my($self,$url) = @_; + my($res,$saved_file,$pid,$out); + + $CPAN::Frontend->myprint(qq{ + _display_url($url)\n}) + if $CPAN::DEBUG; + + # should we define it in the config instead? + my $html_converter = "html2text.pl"; + + my $web_browser = $CPAN::Config->{'lynx'} || undef; + my $web_browser_out = $web_browser + ? CPAN::Distribution->_check_binary($self,$web_browser) + : undef; + + if ($web_browser_out) { + # web browser found, run the action + my $browser = CPAN::HandleConfig->safe_quote($CPAN::Config->{'lynx'}); + $CPAN::Frontend->myprint(qq{system[$browser $url]}) + if $CPAN::DEBUG; + $CPAN::Frontend->myprint(qq{ +Displaying URL + $url +with browser $browser +}); + $CPAN::Frontend->mysleep(1); + system("$browser $url"); + if ($saved_file) { 1 while unlink($saved_file) } + } else { + # web browser not found, let's try text only + my $html_converter_out = + CPAN::Distribution->_check_binary($self,$html_converter); + $html_converter_out = CPAN::HandleConfig->safe_quote($html_converter_out); + + if ($html_converter_out ) { + # html2text found, run it + $saved_file = CPAN::Distribution->_getsave_url( $self, $url ); + $CPAN::Frontend->mydie(qq{ERROR: problems while getting $url\n}) + unless defined($saved_file); + + local *README; + $pid = open README, "$html_converter $saved_file |" + or $CPAN::Frontend->mydie(qq{ +Could not fork '$html_converter $saved_file': $!}); + my($fh,$filename); + if ($CPAN::META->has_usable("File::Temp")) { + $fh = File::Temp->new( + dir => File::Spec->tmpdir, + template => 'cpan_htmlconvert_XXXX', + suffix => '.txt', + unlink => 0, + ); + $filename = $fh->filename; + } else { + $filename = "cpan_htmlconvert_$$.txt"; + $fh = FileHandle->new(); + open $fh, ">$filename" or die; + } + while () { + $fh->print($_); + } + close README or + $CPAN::Frontend->mydie(qq{Could not run '$html_converter $saved_file': $!}); + my $tmpin = $fh->filename; + $CPAN::Frontend->myprint(sprintf(qq{ +Run '%s %s' and +saved output to %s\n}, + $html_converter, + $saved_file, + $tmpin, + )) if $CPAN::DEBUG; + close $fh; + local *FH; + open FH, $tmpin + or $CPAN::Frontend->mydie(qq{Could not open "$tmpin": $!}); + my $fh_pager = FileHandle->new; + local($SIG{PIPE}) = "IGNORE"; + my $pager = $CPAN::Config->{'pager'} || "cat"; + $fh_pager->open("|$pager") + or $CPAN::Frontend->mydie(qq{ +Could not open pager '$pager': $!}); + $CPAN::Frontend->myprint(qq{ +Displaying URL + $url +with pager "$pager" +}); + $CPAN::Frontend->mysleep(1); + $fh_pager->print(); + $fh_pager->close; + } else { + # coldn't find the web browser or html converter + $CPAN::Frontend->myprint(qq{ +You need to install lynx or $html_converter to use this feature.}); + } + } +} + +#-> sub CPAN::Distribution::_getsave_url ; +sub _getsave_url { + my($dist, $shell, $url) = @_; + + $CPAN::Frontend->myprint(qq{ + _getsave_url($url)\n}) + if $CPAN::DEBUG; + + my($fh,$filename); + if ($CPAN::META->has_usable("File::Temp")) { + $fh = File::Temp->new( + dir => File::Spec->tmpdir, + template => "cpan_getsave_url_XXXX", + suffix => ".html", + unlink => 0, + ); + $filename = $fh->filename; + } else { + $fh = FileHandle->new; + $filename = "cpan_getsave_url_$$.html"; + } + my $tmpin = $filename; + if ($CPAN::META->has_usable('LWP')) { + $CPAN::Frontend->myprint("Fetching with LWP: + $url +"); + my $Ua; + CPAN::LWP::UserAgent->config; + eval { $Ua = CPAN::LWP::UserAgent->new; }; + if ($@) { + $CPAN::Frontend->mywarn("ERROR: CPAN::LWP::UserAgent->new dies with $@\n"); + return; + } else { + my($var); + $Ua->proxy('http', $var) + if $var = $CPAN::Config->{http_proxy} || $ENV{http_proxy}; + $Ua->no_proxy($var) + if $var = $CPAN::Config->{no_proxy} || $ENV{no_proxy}; + } + + my $req = HTTP::Request->new(GET => $url); + $req->header('Accept' => 'text/html'); + my $res = $Ua->request($req); + if ($res->is_success) { + $CPAN::Frontend->myprint(" + request successful.\n") + if $CPAN::DEBUG; + print $fh $res->content; + close $fh; + $CPAN::Frontend->myprint(qq{ + saved content to $tmpin \n}) + if $CPAN::DEBUG; + return $tmpin; + } else { + $CPAN::Frontend->myprint(sprintf( + "LWP failed with code[%s], message[%s]\n", + $res->code, + $res->message, + )); + return; + } + } else { + $CPAN::Frontend->mywarn(" LWP not available\n"); + return; + } +} + +#-> sub CPAN::Distribution::_build_command +sub _build_command { + my($self) = @_; + if ($^O eq "MSWin32") { # special code needed at least up to + # Module::Build 0.2611 and 0.2706; a fix + # in M:B has been promised 2006-01-30 + my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n"); + return "$perl ./Build"; + } + elsif ($^O eq 'VMS') { + return "$^X Build.com"; + } + return "./Build"; +} + +#-> sub CPAN::Distribution::_should_report +sub _should_report { + my($self, $phase) = @_; + die "_should_report() requires a 'phase' argument" + if ! defined $phase; + + return unless $CPAN::META->has_usable("CPAN::Reporter"); + + # configured + my $test_report = CPAN::HandleConfig->prefs_lookup($self, + q{test_report}); + return unless $test_report; + + # don't repeat if we cached a result + return $self->{should_report} + if exists $self->{should_report}; + + # don't report if we generated a Makefile.PL + if ( $self->{had_no_makefile_pl} ) { + $CPAN::Frontend->mywarn( + "Will not send CPAN Testers report with generated Makefile.PL.\n" + ); + return $self->{should_report} = 0; + } + + # available + if ( ! $CPAN::META->has_inst("CPAN::Reporter")) { + $CPAN::Frontend->mywarnonce( + "CPAN::Reporter not installed. No reports will be sent.\n" + ); + return $self->{should_report} = 0; + } + + # capable + my $crv = CPAN::Reporter->VERSION; + if ( CPAN::Version->vlt( $crv, 0.99 ) ) { + # don't cache $self->{should_report} -- need to check each phase + if ( $phase eq 'test' ) { + return 1; + } + else { + $CPAN::Frontend->mywarn( + "Reporting on the '$phase' phase requires CPAN::Reporter 0.99, but \n" . + "you only have version $crv\. Only 'test' phase reports will be sent.\n" + ); + return; + } + } + + # appropriate + if ($self->is_dot_dist) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ". + "for local directories\n"); + return $self->{should_report} = 0; + } + if ($self->prefs->{patches} + && + @{$self->prefs->{patches}} + && + $self->{patched} + ) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ". + "when the source has been patched\n"); + return $self->{should_report} = 0; + } + + # proceed and cache success + return $self->{should_report} = 1; +} + +#-> sub CPAN::Distribution::reports +sub reports { + my($self) = @_; + my $pathname = $self->id; + $CPAN::Frontend->myprint("Distribution: $pathname\n"); + + unless ($CPAN::META->has_inst("CPAN::DistnameInfo")) { + $CPAN::Frontend->mydie("CPAN::DistnameInfo not installed; cannot continue"); + } + unless ($CPAN::META->has_usable("LWP")) { + $CPAN::Frontend->mydie("LWP not installed; cannot continue"); + } + unless ($CPAN::META->has_usable("File::Temp")) { + $CPAN::Frontend->mydie("File::Temp not installed; cannot continue"); + } + + my $format; + if ($CPAN::META->has_inst("YAML::XS") || $CPAN::META->has_inst("YAML::Syck")){ + $format = 'yaml'; + } + elsif (!$format && $CPAN::META->has_inst("JSON::PP") ) { + $format = 'json'; + } + else { + $CPAN::Frontend->mydie("JSON::PP not installed, cannot continue"); + } + + my $d = CPAN::DistnameInfo->new($pathname); + + my $dist = $d->dist; # "CPAN-DistnameInfo" + my $version = $d->version; # "0.02" + my $maturity = $d->maturity; # "released" + my $filename = $d->filename; # "CPAN-DistnameInfo-0.02.tar.gz" + my $cpanid = $d->cpanid; # "GBARR" + my $distvname = $d->distvname; # "CPAN-DistnameInfo-0.02" + + my $url = sprintf "http://www.cpantesters.org/show/%s.%s", $dist, $format; + + CPAN::LWP::UserAgent->config; + my $Ua; + eval { $Ua = CPAN::LWP::UserAgent->new; }; + if ($@) { + $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n"); + } + $CPAN::Frontend->myprint("Fetching '$url'..."); + my $resp = $Ua->get($url); + unless ($resp->is_success) { + $CPAN::Frontend->mydie(sprintf "Could not download '%s': %s\n", $url, $resp->code); + } + $CPAN::Frontend->myprint("DONE\n\n"); + my $unserialized; + if ( $format eq 'yaml' ) { + my $yaml = $resp->content; + # what a long way round! + my $fh = File::Temp->new( + dir => File::Spec->tmpdir, + template => 'cpan_reports_XXXX', + suffix => '.yaml', + unlink => 0, + ); + my $tfilename = $fh->filename; + print $fh $yaml; + close $fh or $CPAN::Frontend->mydie("Could not close '$tfilename': $!"); + $unserialized = CPAN->_yaml_loadfile($tfilename)->[0]; + unlink $tfilename or $CPAN::Frontend->mydie("Could not unlink '$tfilename': $!"); + } else { + require JSON::PP; + $unserialized = JSON::PP->new->utf8->decode($resp->content); + } + my %other_versions; + my $this_version_seen; + for my $rep (@$unserialized) { + my $rversion = $rep->{version}; + if ($rversion eq $version) { + unless ($this_version_seen++) { + $CPAN::Frontend->myprint ("$rep->{version}:\n"); + } + my $arch = $rep->{archname} || $rep->{platform} || '????'; + my $grade = $rep->{action} || $rep->{status} || '????'; + my $ostext = $rep->{ostext} || ucfirst($rep->{osname}) || '????'; + $CPAN::Frontend->myprint + (sprintf("%1s%1s%-4s %s on %s %s (%s)\n", + $arch eq $Config::Config{archname}?"*":"", + $grade eq "PASS"?"+":$grade eq"FAIL"?"-":"", + $grade, + $rep->{perl}, + $ostext, + $rep->{osvers}, + $arch, + )); + } else { + $other_versions{$rep->{version}}++; + } + } + unless ($this_version_seen) { + $CPAN::Frontend->myprint("No reports found for version '$version' +Reports for other versions:\n"); + for my $v (sort keys %other_versions) { + $CPAN::Frontend->myprint(" $v\: $other_versions{$v}\n"); + } + } + $url = substr($url,0,-4) . 'html'; + $CPAN::Frontend->myprint("See $url for details\n"); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Distroprefs.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Distroprefs.pm new file mode 100644 index 0000000000000000000000000000000000000000..05b19faa47a058e124a23f6c54aa3334989ecb32 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Distroprefs.pm @@ -0,0 +1,481 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: + +use 5.006; +use strict; +package CPAN::Distroprefs; + +use vars qw($VERSION); +$VERSION = '6.0001'; + +package CPAN::Distroprefs::Result; + +use File::Spec; + +sub new { bless $_[1] || {} => $_[0] } + +sub abs { File::Spec->catfile($_[0]->dir, $_[0]->file) } + +sub __cloner { + my ($class, $name, $newclass) = @_; + $newclass = 'CPAN::Distroprefs::Result::' . $newclass; + no strict 'refs'; + *{$class . '::' . $name} = sub { + $newclass->new({ + %{ $_[0] }, + %{ $_[1] }, + }); + }; +} +BEGIN { __PACKAGE__->__cloner(as_warning => 'Warning') } +BEGIN { __PACKAGE__->__cloner(as_fatal => 'Fatal') } +BEGIN { __PACKAGE__->__cloner(as_success => 'Success') } + +sub __accessor { + my ($class, $key) = @_; + no strict 'refs'; + *{$class . '::' . $key} = sub { $_[0]->{$key} }; +} +BEGIN { __PACKAGE__->__accessor($_) for qw(type file ext dir) } + +sub is_warning { 0 } +sub is_fatal { 0 } +sub is_success { 0 } + +package CPAN::Distroprefs::Result::Error; +use vars qw(@ISA); +BEGIN { @ISA = 'CPAN::Distroprefs::Result' } ## no critic +BEGIN { __PACKAGE__->__accessor($_) for qw(msg) } + +sub as_string { + my ($self) = @_; + if ($self->msg) { + return sprintf $self->fmt_reason, $self->file, $self->msg; + } else { + return sprintf $self->fmt_unknown, $self->file; + } +} + +package CPAN::Distroprefs::Result::Warning; +use vars qw(@ISA); +BEGIN { @ISA = 'CPAN::Distroprefs::Result::Error' } ## no critic +sub is_warning { 1 } +sub fmt_reason { "Error reading distroprefs file %s, skipping: %s" } +sub fmt_unknown { "Unknown error reading distroprefs file %s, skipping." } + +package CPAN::Distroprefs::Result::Fatal; +use vars qw(@ISA); +BEGIN { @ISA = 'CPAN::Distroprefs::Result::Error' } ## no critic +sub is_fatal { 1 } +sub fmt_reason { "Error reading distroprefs file %s: %s" } +sub fmt_unknown { "Unknown error reading distroprefs file %s." } + +package CPAN::Distroprefs::Result::Success; +use vars qw(@ISA); +BEGIN { @ISA = 'CPAN::Distroprefs::Result' } ## no critic +BEGIN { __PACKAGE__->__accessor($_) for qw(prefs extension) } +sub is_success { 1 } + +package CPAN::Distroprefs::Iterator; + +sub new { bless $_[1] => $_[0] } + +sub next { $_[0]->() } + +package CPAN::Distroprefs; + +use Carp (); +use DirHandle; + +sub _load_method { + my ($self, $loader, $result) = @_; + return '_load_yaml' if $loader eq 'CPAN' or $loader =~ /^YAML(::|$)/; + return '_load_' . $result->ext; +} + +sub _load_yaml { + my ($self, $loader, $result) = @_; + my $data = eval { + $loader eq 'CPAN' + ? $loader->_yaml_loadfile($result->abs) + : [ $loader->can('LoadFile')->($result->abs) ] + }; + if (my $err = $@) { + die $result->as_warning({ + msg => $err, + }); + } elsif (!$data) { + die $result->as_warning; + } else { + return @$data; + } +} + +sub _load_dd { + my ($self, $loader, $result) = @_; + my @data; + { + package CPAN::Eval; + # this caused a die in CPAN.pm, and I am leaving it 'fatal', though I'm + # not sure why we wouldn't just skip the file as we do for all other + # errors. -- hdp + my $abs = $result->abs; + open FH, "<$abs" or die $result->as_fatal(msg => "$!"); + local $/; + my $eval = ; + close FH; + no strict; + eval $eval; + if (my $err = $@) { + die $result->as_warning({ msg => $err }); + } + my $i = 1; + while (${"VAR$i"}) { + push @data, ${"VAR$i"}; + $i++; + } + } + return @data; +} + +sub _load_st { + my ($self, $loader, $result) = @_; + # eval because Storable is never forward compatible + my @data = eval { @{scalar $loader->can('retrieve')->($result->abs) } }; + if (my $err = $@) { + die $result->as_warning({ msg => $err }); + } + return @data; +} + +sub _build_file_list { + if (@_ > 3) { + die "_build_file_list should be called with 3 arguments, was called with more. First argument is '$_[0]'."; + } + my ($dir, $dir1, $ext_re) = @_; + my @list; + my $dh; + unless (opendir($dh, $dir)) { + $CPAN::Frontend->mywarn("ignoring prefs directory '$dir': $!"); + return @list; + } + while (my $fn = readdir $dh) { + next if $fn eq '.' || $fn eq '..'; + if (-d "$dir/$fn") { + next if $fn =~ /^[._]/; # prune .svn, .git, .hg, _darcs and what the user wants to hide + push @list, _build_file_list("$dir/$fn", "$dir1$fn/", $ext_re); + } else { + if ($fn =~ $ext_re) { + push @list, "$dir1$fn"; + } + } + } + return @list; +} + +sub find { + my ($self, $dir, $ext_map) = @_; + + return CPAN::Distroprefs::Iterator->new(sub { return }) unless %$ext_map; + + my $possible_ext = join "|", map { quotemeta } keys %$ext_map; + my $ext_re = qr/\.($possible_ext)$/; + + my @files = _build_file_list($dir, '', $ext_re); + @files = sort @files if @files; + + # label the block so that we can use redo in the middle + return CPAN::Distroprefs::Iterator->new(sub { LOOP: { + + my $fn = shift @files; + return unless defined $fn; + my ($ext) = $fn =~ $ext_re; + + my $loader = $ext_map->{$ext}; + + my $result = CPAN::Distroprefs::Result->new({ + file => $fn, ext => $ext, dir => $dir + }); + # copied from CPAN.pm; is this ever actually possible? + redo unless -f $result->abs; + + my $load_method = $self->_load_method($loader, $result); + my @prefs = eval { $self->$load_method($loader, $result) }; + if (my $err = $@) { + if (ref($err) && eval { $err->isa('CPAN::Distroprefs::Result') }) { + return $err; + } + # rethrow any exceptions that we did not generate + die $err; + } elsif (!@prefs) { + # the loader should have handled this, but just in case: + return $result->as_warning; + } + return $result->as_success({ + prefs => [ + map { CPAN::Distroprefs::Pref->new({ data => $_ }) } @prefs + ], + }); + } }); +} + +package CPAN::Distroprefs::Pref; + +use Carp (); + +sub new { bless $_[1] => $_[0] } + +sub data { shift->{data} } + +sub has_any_match { $_[0]->data->{match} ? 1 : 0 } + +sub has_match { + my $match = $_[0]->data->{match} || return 0; + exists $match->{$_[1]} || exists $match->{"not_$_[1]"} +} + +sub has_valid_subkeys { + grep { exists $_[0]->data->{match}{$_} } + map { $_, "not_$_" } + $_[0]->match_attributes +} + +sub _pattern { + my $re = shift; + my $p = eval sprintf 'qr{%s}', $re; + if ($@) { + $@ =~ s/\n$//; + die "Error in Distroprefs pattern qr{$re}\n$@"; + } + return $p; +} + +sub _match_scalar { + my ($match, $data) = @_; + my $qr = _pattern($match); + return $data =~ /$qr/; +} + +sub _match_hash { + my ($match, $data) = @_; + for my $mkey (keys %$match) { + (my $dkey = $mkey) =~ s/^not_//; + my $val = defined $data->{$dkey} ? $data->{$dkey} : ''; + if (_match_scalar($match->{$mkey}, $val)) { + return 0 if $mkey =~ /^not_/; + } + else { + return 0 if $mkey !~ /^not_/; + } + } + return 1; +} + +sub _match { + my ($self, $key, $data, $matcher) = @_; + my $m = $self->data->{match}; + if (exists $m->{$key}) { + return 0 unless $matcher->($m->{$key}, $data); + } + if (exists $m->{"not_$key"}) { + return 0 if $matcher->($m->{"not_$key"}, $data); + } + return 1; +} + +sub _scalar_match { + my ($self, $key, $data) = @_; + return $self->_match($key, $data, \&_match_scalar); +} + +sub _hash_match { + my ($self, $key, $data) = @_; + return $self->_match($key, $data, \&_match_hash); +} + +# do not take the order of C because "module" is by far the +# slowest +sub match_attributes { qw(env distribution perl perlconfig module) } + +sub match_module { + my ($self, $modules) = @_; + return $self->_match("module", $modules, sub { + my($match, $data) = @_; + my $qr = _pattern($match); + for my $module (@$data) { + return 1 if $module =~ /$qr/; + } + return 0; + }); +} + +sub match_distribution { shift->_scalar_match(distribution => @_) } +sub match_perl { shift->_scalar_match(perl => @_) } + +sub match_perlconfig { shift->_hash_match(perlconfig => @_) } +sub match_env { shift->_hash_match(env => @_) } + +sub matches { + my ($self, $arg) = @_; + + my $default_match = 0; + for my $key (grep { $self->has_match($_) } $self->match_attributes) { + unless (exists $arg->{$key}) { + Carp::croak "Can't match pref: missing argument key $key"; + } + $default_match = 1; + my $val = $arg->{$key}; + # make it possible to avoid computing things until we have to + if (ref($val) eq 'CODE') { $val = $val->() } + my $meth = "match_$key"; + return 0 unless $self->$meth($val); + } + + return $default_match; +} + +1; + +__END__ + +=head1 NAME + +CPAN::Distroprefs -- read and match distroprefs + +=head1 SYNOPSIS + + use CPAN::Distroprefs; + + my %info = (... distribution/environment info ...); + + my $finder = CPAN::Distroprefs->find($prefs_dir, \%ext_map); + + while (my $result = $finder->next) { + + die $result->as_string if $result->is_fatal; + + warn($result->as_string), next if $result->is_warning; + + for my $pref (@{ $result->prefs }) { + if ($pref->matches(\%info)) { + return $pref; + } + } + } + + +=head1 DESCRIPTION + +This module encapsulates reading L and matching them against CPAN distributions. + +=head1 INTERFACE + + my $finder = CPAN::Distroprefs->find($dir, \%ext_map); + + while (my $result = $finder->next) { ... } + +Build an iterator which finds distroprefs files in the tree below the +given directory. Within the tree directories matching C are +pruned. + +C<%ext_map> is a hashref whose keys are file extensions and whose values are +modules used to load matching files: + + { + 'yml' => 'YAML::Syck', + 'dd' => 'Data::Dumper', + ... + } + +Each time C<< $finder->next >> is called, the iterator returns one of two +possible values: + +=over + +=item * a CPAN::Distroprefs::Result object + +=item * C, indicating that no prefs files remain to be found + +=back + +=head1 RESULTS + +L|/INTERFACE> returns CPAN::Distroprefs::Result objects to +indicate success or failure when reading a prefs file. + +=head2 Common + +All results share some common attributes: + +=head3 type + +C, C, or C + +=head3 file + +the file from which these prefs were read, or to which this error refers (relative filename) + +=head3 ext + +the file's extension, which determines how to load it + +=head3 dir + +the directory the file was read from + +=head3 abs + +the absolute path to the file + +=head2 Errors + +Error results (warning and fatal) contain: + +=head3 msg + +the error message (usually either C<$!> or a YAML error) + +=head2 Successes + +Success results contain: + +=head3 prefs + +an arrayref of CPAN::Distroprefs::Pref objects + +=head1 PREFS + +CPAN::Distroprefs::Pref objects represent individual distroprefs documents. +They are constructed automatically as part of C results from C. + +=head3 data + +the pref information as a hashref, suitable for e.g. passing to Kwalify + +=head3 match_attributes + +returns a list of the valid match attributes (see the Distroprefs section in L) + +currently: C + +=head3 has_any_match + +true if this pref has a 'match' attribute at all + +=head3 has_valid_subkeys + +true if this pref has a 'match' attribute and at least one valid match attribute + +=head3 matches + + if ($pref->matches(\%arg)) { ... } + +true if this pref matches the passed-in hashref, which must have a value for +each of the C (above) + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Distrostatus.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Distrostatus.pm new file mode 100644 index 0000000000000000000000000000000000000000..0cc6cc9a7932fefd195fadd8f7fe566befe9de2e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Distrostatus.pm @@ -0,0 +1,45 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Distrostatus; +use overload '""' => "as_string", + fallback => 1; +use vars qw($something_has_failed_at); +use vars qw( + $VERSION +); +$VERSION = "5.5"; + + +sub new { + my($class,$arg) = @_; + my $failed = substr($arg,0,2) eq "NO"; + if ($failed) { + $something_has_failed_at = $CPAN::CurrentCommandId; + } + bless { + TEXT => $arg, + FAILED => $failed, + COMMANDID => $CPAN::CurrentCommandId, + TIME => time, + }, $class; +} +sub something_has_just_failed () { + defined $something_has_failed_at && + $something_has_failed_at == $CPAN::CurrentCommandId; +} +sub commandid { shift->{COMMANDID} } +sub failed { shift->{FAILED} } +sub text { + my($self,$set) = @_; + if (defined $set) { + $self->{TEXT} = $set; + } + $self->{TEXT}; +} +sub as_string { + my($self) = @_; + $self->text; +} + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/FTP.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/FTP.pm new file mode 100644 index 0000000000000000000000000000000000000000..1688a118e4c562cf41122aab98a5be9cd00202bd --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/FTP.pm @@ -0,0 +1,1153 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::FTP; +use strict; + +use Errno (); +use Fcntl qw(:flock); +use File::Basename qw(dirname); +use File::Path qw(mkpath); +use CPAN::FTP::netrc; +use vars qw($connect_to_internet_ok $Ua $Thesite $ThesiteURL $Themethod); + +@CPAN::FTP::ISA = qw(CPAN::Debug); + +use vars qw( + $VERSION +); +$VERSION = "5.5012"; + +sub _plus_append_open { + my($fh, $file) = @_; + my $parent_dir = dirname $file; + mkpath $parent_dir; + my($cnt); + until (open $fh, "+>>$file") { + next if exists &Errno::EAGAIN && $! == &Errno::EAGAIN; # don't increment on EAGAIN + $CPAN::Frontend->mydie("Could not open '$file' after 10000 tries: $!") if ++$cnt > 100000; + sleep 0.0001; + mkpath $parent_dir; + } +} + +#-> sub CPAN::FTP::ftp_statistics +# if they want to rewrite, they need to pass in a filehandle +sub _ftp_statistics { + my($self,$fh) = @_; + my $ftpstats_size = $CPAN::Config->{ftpstats_size}; + return if defined $ftpstats_size && $ftpstats_size <= 0; + my $locktype = $fh ? LOCK_EX : LOCK_SH; + # XXX On Windows flock() implements mandatory locking, so we can + # XXX only use shared locking to still allow _yaml_load_file() to + # XXX read from the file using a different filehandle. + $locktype = LOCK_SH if $^O eq "MSWin32"; + + $fh ||= FileHandle->new; + my $file = File::Spec->catfile($CPAN::Config->{cpan_home},"FTPstats.yml"); + _plus_append_open($fh,$file); + my $sleep = 1; + my $waitstart; + while (!CPAN::_flock($fh, $locktype|LOCK_NB)) { + $waitstart ||= localtime(); + if ($sleep>3) { + my $now = localtime(); + $CPAN::Frontend->mywarn("$now: waiting for read lock on '$file' (since $waitstart)\n"); + } + sleep($sleep); # this sleep must not be overridden; + # Frontend->mysleep with AUTOMATED_TESTING has + # provoked complete lock contention on my NFS + if ($sleep <= 6) { + $sleep+=0.5; + } else { + # retry to get a fresh handle. If it is NFS and the handle is stale, we will never get an flock + _plus_append_open($fh, $file); + } + } + my $stats = eval { CPAN->_yaml_loadfile($file); }; + if ($@) { + if (ref $@) { + if (ref $@ eq "CPAN::Exception::yaml_not_installed") { + chomp $@; + $CPAN::Frontend->myprintonce("Warning (usually harmless): $@\n"); + return; + } elsif (ref $@ eq "CPAN::Exception::yaml_process_error") { + my $time = time; + my $to = "$file.$time"; + $CPAN::Frontend->mywarn("Error reading '$file': $@ + Trying to stash it away as '$to' to prevent further interruptions. + You may want to remove that file later.\n"); + # may fail because somebody else has moved it away in the meantime: + rename $file, $to or $CPAN::Frontend->mywarn("Could not rename '$file' to '$to': $!\n"); + return; + } + } else { + $CPAN::Frontend->mydie($@); + } + } + CPAN::_flock($fh, LOCK_UN); + return $stats->[0]; +} + +#-> sub CPAN::FTP::_mytime +sub _mytime () { + if (CPAN->has_inst("Time::HiRes")) { + return Time::HiRes::time(); + } else { + return time; + } +} + +#-> sub CPAN::FTP::_new_stats +sub _new_stats { + my($self,$file) = @_; + my $ret = { + file => $file, + attempts => [], + start => _mytime, + }; + $ret; +} + +#-> sub CPAN::FTP::_add_to_statistics +sub _add_to_statistics { + my($self,$stats) = @_; + my $yaml_module = CPAN::_yaml_module(); + $self->debug("yaml_module[$yaml_module]") if $CPAN::DEBUG; + if ($CPAN::META->has_inst($yaml_module)) { + $stats->{thesiteurl} = $ThesiteURL; + $stats->{end} = CPAN::FTP::_mytime(); + my $fh = FileHandle->new; + my $time = time; + my $sdebug = 0; + my @debug; + @debug = $time if $sdebug; + my $fullstats = $self->_ftp_statistics($fh); + close $fh if $fh && defined(fileno($fh)); + $fullstats->{history} ||= []; + push @debug, scalar @{$fullstats->{history}} if $sdebug; + push @debug, time if $sdebug; + push @{$fullstats->{history}}, $stats; + # YAML.pm 0.62 is unacceptably slow with 999; + # YAML::Syck 0.82 has no noticable performance problem with 999; + my $ftpstats_size = $CPAN::Config->{ftpstats_size}; + $ftpstats_size = 99 unless defined $ftpstats_size; + my $ftpstats_period = $CPAN::Config->{ftpstats_period} || 14; + while ( + @{$fullstats->{history} || []} + && + ( + @{$fullstats->{history}} > $ftpstats_size + || $time - $fullstats->{history}[0]{start} > 86400*$ftpstats_period + ) + ) { + shift @{$fullstats->{history}} + } + push @debug, scalar @{$fullstats->{history}} if $sdebug; + push @debug, time if $sdebug; + push @debug, scalar localtime($fullstats->{history}[0]{start}) if $sdebug; + # need no eval because if this fails, it is serious + my $sfile = File::Spec->catfile($CPAN::Config->{cpan_home},"FTPstats.yml"); + CPAN->_yaml_dumpfile("$sfile.$$",$fullstats); + if ( $sdebug ) { + local $CPAN::DEBUG = 512; # FTP + push @debug, time; + CPAN->debug(sprintf("DEBUG history: before_read[%d]before[%d]at[%d]". + "after[%d]at[%d]oldest[%s]dumped backat[%d]", + @debug, + )); + } + # Win32 cannot rename a file to an existing filename + unlink($sfile) if ($^O eq 'MSWin32' or $^O eq 'os2'); + _copy_stat($sfile, "$sfile.$$") if -e $sfile; + rename "$sfile.$$", $sfile + or $CPAN::Frontend->mywarn("Could not rename '$sfile.$$' to '$sfile': $!\nGiving up\n"); + } +} + +# Copy some stat information (owner, group, mode and) from one file to +# another. +# This is a utility function which might be moved to a utility repository. +#-> sub CPAN::FTP::_copy_stat +sub _copy_stat { + my($src, $dest) = @_; + my @stat = stat($src); + if (!@stat) { + $CPAN::Frontend->mywarn("Can't stat '$src': $!\n"); + return; + } + + eval { + chmod $stat[2], $dest + or $CPAN::Frontend->mywarn("Can't chmod '$dest' to " . sprintf("0%o", $stat[2]) . ": $!\n"); + }; + warn $@ if $@; + eval { + chown $stat[4], $stat[5], $dest + or do { + my $save_err = $!; # otherwise it's lost in the get... calls + $CPAN::Frontend->mywarn("Can't chown '$dest' to " . + (getpwuid($stat[4]))[0] . "/" . + (getgrgid($stat[5]))[0] . ": $save_err\n" + ); + }; + }; + warn $@ if $@; +} + +# if file is CHECKSUMS, suggest the place where we got the file to be +# checked from, maybe only for young files? +#-> sub CPAN::FTP::_recommend_url_for +sub _recommend_url_for { + my($self, $file, $urllist) = @_; + if ($file =~ s|/CHECKSUMS(.gz)?$||) { + my $fullstats = $self->_ftp_statistics(); + my $history = $fullstats->{history} || []; + while (my $last = pop @$history) { + last if $last->{end} - time > 3600; # only young results are interesting + next unless $last->{file}; # dirname of nothing dies! + next unless $file eq dirname($last->{file}); + return $last->{thesiteurl}; + } + } + if ($CPAN::Config->{randomize_urllist} + && + rand(1) < $CPAN::Config->{randomize_urllist} + ) { + $urllist->[int rand scalar @$urllist]; + } else { + return (); + } +} + +#-> sub CPAN::FTP::_get_urllist +sub _get_urllist { + my($self, $with_defaults) = @_; + $with_defaults ||= 0; + CPAN->debug("with_defaults[$with_defaults]") if $CPAN::DEBUG; + + $CPAN::Config->{urllist} ||= []; + unless (ref $CPAN::Config->{urllist} eq 'ARRAY') { + $CPAN::Frontend->mywarn("Malformed urllist; ignoring. Configuration file corrupt?\n"); + $CPAN::Config->{urllist} = []; + } + my @urllist = grep { defined $_ and length $_ } @{$CPAN::Config->{urllist}}; + push @urllist, @CPAN::Defaultsites if $with_defaults; + for my $u (@urllist) { + CPAN->debug("u[$u]") if $CPAN::DEBUG; + if (UNIVERSAL::can($u,"text")) { + $u->{TEXT} .= "/" unless substr($u->{TEXT},-1) eq "/"; + } else { + $u .= "/" unless substr($u,-1) eq "/"; + $u = CPAN::URL->new(TEXT => $u, FROM => "USER"); + } + } + \@urllist; +} + +#-> sub CPAN::FTP::ftp_get ; +sub ftp_get { + my($class,$host,$dir,$file,$target) = @_; + $class->debug( + qq[Going to fetch file [$file] from dir [$dir] + on host [$host] as local [$target]\n] + ) if $CPAN::DEBUG; + my $ftp = Net::FTP->new($host); + unless ($ftp) { + $CPAN::Frontend->mywarn(" Could not connect to host '$host' with Net::FTP\n"); + return; + } + return 0 unless defined $ftp; + $ftp->debug(1) if $CPAN::DEBUG{'FTP'} & $CPAN::DEBUG; + $class->debug(qq[Going to login("anonymous","$Config::Config{cf_email}")]); + unless ( $ftp->login("anonymous",$Config::Config{'cf_email'}) ) { + my $msg = $ftp->message; + $CPAN::Frontend->mywarn(" Couldn't login on $host: $msg\n"); + return; + } + unless ( $ftp->cwd($dir) ) { + my $msg = $ftp->message; + $CPAN::Frontend->mywarn(" Couldn't cwd $dir: $msg\n"); + return; + } + $ftp->binary; + $class->debug(qq[Going to ->get("$file","$target")\n]) if $CPAN::DEBUG; + unless ( $ftp->get($file,$target) ) { + my $msg = $ftp->message; + $CPAN::Frontend->mywarn(" Couldn't fetch $file from $host: $msg\n"); + return; + } + $ftp->quit; # it's ok if this fails + return 1; +} + +# If more accuracy is wanted/needed, Chris Leach sent me this patch... + + # > *** /install/perl/live/lib/CPAN.pm- Wed Sep 24 13:08:48 1997 + # > --- /tmp/cp Wed Sep 24 13:26:40 1997 + # > *************** + # > *** 1562,1567 **** + # > --- 1562,1580 ---- + # > return 1 if substr($url,0,4) eq "file"; + # > return 1 unless $url =~ m|://([^/]+)|; + # > my $host = $1; + # > + my $proxy = $CPAN::Config->{'http_proxy'} || $ENV{'http_proxy'}; + # > + if ($proxy) { + # > + $proxy =~ m|://([^/:]+)|; + # > + $proxy = $1; + # > + my $noproxy = $CPAN::Config->{'no_proxy'} || $ENV{'no_proxy'}; + # > + if ($noproxy) { + # > + if ($host !~ /$noproxy$/) { + # > + $host = $proxy; + # > + } + # > + } else { + # > + $host = $proxy; + # > + } + # > + } + # > require Net::Ping; + # > return 1 unless $Net::Ping::VERSION >= 2; + # > my $p; + + +#-> sub CPAN::FTP::localize ; +sub localize { + my($self,$file,$aslocal,$force,$with_defaults) = @_; + $force ||= 0; + Carp::croak( "Usage: ->localize(cpan_file,as_local_file[,\$force])" ) + unless defined $aslocal; + if ($CPAN::DEBUG){ + require Carp; + my $longmess = Carp::longmess(); + $self->debug("file[$file] aslocal[$aslocal] force[$force] carplongmess[$longmess]"); + } + if ($^O eq 'MacOS') { + # Comment by AK on 2000-09-03: Uniq short filenames would be + # available in CHECKSUMS file + my($name, $path) = File::Basename::fileparse($aslocal, ''); + if (length($name) > 31) { + $name =~ s/( + \.( + readme(\.(gz|Z))? | + (tar\.)?(gz|Z) | + tgz | + zip | + pm\.(gz|Z) + ) + )$//x; + my $suf = $1; + my $size = 31 - length($suf); + while (length($name) > $size) { + chop $name; + } + $name .= $suf; + $aslocal = File::Spec->catfile($path, $name); + } + } + + if (-f $aslocal && -r _ && !($force & 1)) { + my $size; + if ($size = -s $aslocal) { + $self->debug("aslocal[$aslocal]size[$size]") if $CPAN::DEBUG; + return $aslocal; + } else { + # empty file from a previous unsuccessful attempt to download it + unlink $aslocal or + $CPAN::Frontend->mydie("Found a zero-length '$aslocal' that I ". + "could not remove."); + } + } + my($maybe_restore) = 0; + if (-f $aslocal) { + rename $aslocal, "$aslocal.bak$$"; + $maybe_restore++; + } + + my($aslocal_dir) = dirname($aslocal); + # Inheritance is not easier to manage than a few if/else branches + if ($CPAN::META->has_usable('LWP::UserAgent')) { + unless ($Ua) { + CPAN::LWP::UserAgent->config; + eval {$Ua = CPAN::LWP::UserAgent->new;}; # Why is has_usable still not fit enough? + if ($@) { + $CPAN::Frontend->mywarn("CPAN::LWP::UserAgent->new dies with $@\n") + if $CPAN::DEBUG; + } else { + my($var); + $Ua->proxy('ftp', $var) + if $var = $CPAN::Config->{ftp_proxy} || $ENV{ftp_proxy}; + $Ua->proxy('http', $var) + if $var = $CPAN::Config->{http_proxy} || $ENV{http_proxy}; + $Ua->no_proxy($var) + if $var = $CPAN::Config->{no_proxy} || $ENV{no_proxy}; + } + } + } + for my $prx (qw(ftp_proxy http_proxy no_proxy)) { + $ENV{$prx} = $CPAN::Config->{$prx} if $CPAN::Config->{$prx}; + } + + # Try the list of urls for each single object. We keep a record + # where we did get a file from + my(@reordered,$last); + my $ccurllist = $self->_get_urllist($with_defaults); + $last = $#$ccurllist; + if ($force & 2) { # local cpans probably out of date, don't reorder + @reordered = (0..$last); + } else { + @reordered = + sort { + (substr($ccurllist->[$b],0,4) eq "file") + <=> + (substr($ccurllist->[$a],0,4) eq "file") + or + defined($ThesiteURL) + and + ($ccurllist->[$b] eq $ThesiteURL) + <=> + ($ccurllist->[$a] eq $ThesiteURL) + } 0..$last; + } + my(@levels); + $Themethod ||= ""; + $self->debug("Themethod[$Themethod]reordered[@reordered]") if $CPAN::DEBUG; + my @all_levels = ( + ["dleasy", "file"], + ["dleasy"], + ["dlhard"], + ["dlhardest"], + ["dleasy", "http","defaultsites"], + ["dlhard", "http","defaultsites"], + ["dleasy", "ftp", "defaultsites"], + ["dlhard", "ftp", "defaultsites"], + ["dlhardest","", "defaultsites"], + ); + if ($Themethod) { + @levels = grep {$_->[0] eq $Themethod} @all_levels; + push @levels, grep {$_->[0] ne $Themethod} @all_levels; + } else { + @levels = @all_levels; + } + @levels = qw/dleasy/ if $^O eq 'MacOS'; + my($levelno); + local $ENV{FTP_PASSIVE} = + exists $CPAN::Config->{ftp_passive} ? + $CPAN::Config->{ftp_passive} : 1; + my $ret; + my $stats = $self->_new_stats($file); + for ($CPAN::Config->{connect_to_internet_ok}) { + $connect_to_internet_ok = $_ if not defined $connect_to_internet_ok and defined $_; + } + LEVEL: for $levelno (0..$#levels) { + my $level_tuple = $levels[$levelno]; + my($level,$scheme,$sitetag) = @$level_tuple; + $self->mymkpath($aslocal_dir) unless $scheme && "file" eq $scheme; + my $defaultsites = $sitetag && $sitetag eq "defaultsites" && !@$ccurllist; + my @urllist; + if ($defaultsites) { + unless (defined $connect_to_internet_ok) { + $CPAN::Frontend->myprint(sprintf qq{ +I would like to connect to one of the following sites to get '%s': + +%s +}, + $file, + join("",map { " ".$_->text."\n" } @CPAN::Defaultsites), + ); + my $answer = CPAN::Shell::colorable_makemaker_prompt("Is it OK to try to connect to the Internet?", "yes"); + if ($answer =~ /^y/i) { + $connect_to_internet_ok = 1; + } else { + $connect_to_internet_ok = 0; + } + } + if ($connect_to_internet_ok) { + @urllist = @CPAN::Defaultsites; + } else { + my $sleep = 2; + # the tricky thing about dying here is that everybody + # believes that calls to exists() or all_objects() are + # safe. + require CPAN::Exception::blocked_urllist; + die CPAN::Exception::blocked_urllist->new; + } + } else { # ! $defaultsites + my @host_seq = $level =~ /dleasy/ ? + @reordered : 0..$last; # reordered has file and $Thesiteurl first + @urllist = map { $ccurllist->[$_] } @host_seq; + } + $self->debug("synth. urllist[@urllist]") if $CPAN::DEBUG; + my $aslocal_tempfile = $aslocal . ".tmp" . $$; + if (my $recommend = $self->_recommend_url_for($file,\@urllist)) { + @urllist = grep { $_ ne $recommend } @urllist; + unshift @urllist, $recommend; + } + $self->debug("synth. urllist[@urllist]") if $CPAN::DEBUG; + $ret = $self->hostdlxxx($level,$scheme,\@urllist,$file,$aslocal_tempfile,$stats); + if ($ret) { + CPAN->debug("ret[$ret]aslocal[$aslocal]") if $CPAN::DEBUG; + if ($ret eq $aslocal_tempfile) { + # if we got it exactly as we asked for, only then we + # want to rename + rename $aslocal_tempfile, $aslocal + or $CPAN::Frontend->mydie("Error while trying to rename ". + "'$ret' to '$aslocal': $!"); + $ret = $aslocal; + } + elsif (-f $ret && $scheme eq 'file' ) { + # it's a local file, so there's nothing left to do, we + # let them read from where it is + } + $Themethod = $level; + my $now = time; + # utime $now, $now, $aslocal; # too bad, if we do that, we + # might alter a local mirror + $self->debug("level[$level]") if $CPAN::DEBUG; + last LEVEL; + } else { + unlink $aslocal_tempfile; + last if $CPAN::Signal; # need to cleanup + } + } + if ($ret) { + $stats->{filesize} = -s $ret; + } + $self->debug("before _add_to_statistics") if $CPAN::DEBUG; + $self->_add_to_statistics($stats); + $self->debug("after _add_to_statistics") if $CPAN::DEBUG; + if ($ret) { + unlink "$aslocal.bak$$"; + return $ret; + } + unless ($CPAN::Signal) { + my(@mess); + local $" = " "; + if (@{$CPAN::Config->{urllist}}) { + push @mess, + qq{Please check, if the URLs I found in your configuration file \(}. + join(", ", @{$CPAN::Config->{urllist}}). + qq{\) are valid.}; + } else { + push @mess, qq{Your urllist is empty!}; + } + push @mess, qq{The urllist can be edited.}, + qq{E.g. with 'o conf urllist push ftp://myurl/'}; + $CPAN::Frontend->mywarn(Text::Wrap::wrap("","","@mess"). "\n\n"); + $CPAN::Frontend->mydie("Could not fetch $file\n"); + } + if ($maybe_restore) { + rename "$aslocal.bak$$", $aslocal; + $CPAN::Frontend->myprint("Trying to get away with old file:\n" . + $self->ls($aslocal) . "\n"); + return $aslocal; + } + return; +} + +sub mymkpath { + my($self, $aslocal_dir) = @_; + mkpath($aslocal_dir); + $CPAN::Frontend->mywarn(qq{Warning: You are not allowed to write into }. + qq{directory "$aslocal_dir". + I\'ll continue, but if you encounter problems, they may be due + to insufficient permissions.\n}) unless -w $aslocal_dir; +} + +sub hostdlxxx { + my $self = shift; + my $level = shift; + my $scheme = shift; + my $h = shift; + $h = [ grep /^\Q$scheme\E:/, @$h ] if $scheme; + my $method = "host$level"; + $self->$method($h, @_); +} + +sub _set_attempt { + my($self,$stats,$method,$url) = @_; + push @{$stats->{attempts}}, { + method => $method, + start => _mytime, + url => $url, + }; +} + +# package CPAN::FTP; +sub hostdleasy { #called from hostdlxxx + my($self,$host_seq,$file,$aslocal,$stats) = @_; + my($ro_url); + HOSTEASY: for $ro_url (@$host_seq) { + $self->_set_attempt($stats,"dleasy",$ro_url); + my $url = "$ro_url$file"; + $self->debug("localizing perlish[$url]") if $CPAN::DEBUG; + if ($url =~ /^file:/) { + my $l; + if ($CPAN::META->has_inst('URI::URL')) { + my $u = URI::URL->new($url); + $l = $u->file; + } else { # works only on Unix, is poorly constructed, but + # hopefully better than nothing. + # RFC 1738 says fileurl BNF is + # fileurl = "file://" [ host | "localhost" ] "/" fpath + # Thanks to "Mark D. Baushke" for + # the code + ($l = $url) =~ s|^file://[^/]*/|/|; # discard the host part + $l =~ s|^file:||; # assume they + # meant + # file://localhost + $l =~ s|^/||s + if ! -f $l && $l =~ m|^/\w:|; # e.g. /P: + } + $self->debug("local file[$l]") if $CPAN::DEBUG; + if ( -f $l && -r _) { + $ThesiteURL = $ro_url; + return $l; + } + # If request is for a compressed file and we can find the + # uncompressed file also, return the path of the uncompressed file + # otherwise, decompress it and return the resulting path + if ($l =~ /(.+)\.gz$/) { + my $ungz = $1; + if ( -f $ungz && -r _) { + $ThesiteURL = $ro_url; + return $ungz; + } + elsif (-f $l && -r _) { + eval { CPAN::Tarzip->new($l)->gunzip($aslocal) }; + if ( -f $aslocal && -s _) { + $ThesiteURL = $ro_url; + return $aslocal; + } + elsif (! -s $aslocal) { + unlink $aslocal; + } + elsif (-f $l) { + $CPAN::Frontend->mywarn("Error decompressing '$l': $@\n") + if $@; + return; + } + } + } + # Otherwise, return the local file path if it exists + elsif ( -f $l && -r _) { + $ThesiteURL = $ro_url; + return $l; + } + # If we can't find it, but there is a compressed version + # of it, then decompress it + elsif (-f "$l.gz") { + $self->debug("found compressed $l.gz") if $CPAN::DEBUG; + eval { CPAN::Tarzip->new("$l.gz")->gunzip($aslocal) }; + if ( -f $aslocal) { + $ThesiteURL = $ro_url; + return $aslocal; + } + else { + $CPAN::Frontend->mywarn("Error decompressing '$l': $@\n") + if $@; + return; + } + } + $CPAN::Frontend->mywarn("Could not find '$l'\n"); + } + $self->debug("it was not a file URL") if $CPAN::DEBUG; + if ($CPAN::META->has_usable('LWP')) { + $CPAN::Frontend->myprint("Fetching with LWP:\n$url\n"); + unless ($Ua) { + CPAN::LWP::UserAgent->config; + eval { $Ua = CPAN::LWP::UserAgent->new; }; + if ($@) { + $CPAN::Frontend->mywarn("CPAN::LWP::UserAgent->new dies with $@\n"); + } + } + my $res = $Ua->mirror($url, $aslocal); + if ($res->is_success) { + $ThesiteURL = $ro_url; + my $now = time; + utime $now, $now, $aslocal; # download time is more + # important than upload + # time + return $aslocal; + } elsif ($url !~ /\.gz(?!\n)\Z/) { + my $gzurl = "$url.gz"; + $CPAN::Frontend->myprint("Fetching with LWP:\n$gzurl\n"); + $res = $Ua->mirror($gzurl, "$aslocal.gz"); + if ($res->is_success) { + if (eval {CPAN::Tarzip->new("$aslocal.gz")->gunzip($aslocal)}) { + $ThesiteURL = $ro_url; + return $aslocal; + } + } + } else { + $CPAN::Frontend->myprint(sprintf( + "LWP failed with code[%s] message[%s]\n", + $res->code, + $res->message, + )); + # Alan Burlison informed me that in firewall environments + # Net::FTP can still succeed where LWP fails. So we do not + # skip Net::FTP anymore when LWP is available. + } + } elsif ($url =~ /^http:/i && $CPAN::META->has_usable('HTTP::Tiny')) { + require CPAN::HTTP::Client; + my $chc = CPAN::HTTP::Client->new( + proxy => $CPAN::Config->{http_proxy} || $ENV{http_proxy}, + no_proxy => $CPAN::Config->{no_proxy} || $ENV{no_proxy}, + ); + for my $try ( $url, ( $url !~ /\.gz(?!\n)\Z/ ? "$url.gz" : () ) ) { + $CPAN::Frontend->myprint("Fetching with HTTP::Tiny:\n$try\n"); + my $res = eval { $chc->mirror($try, $aslocal) }; + if ( $res && $res->{success} ) { + $ThesiteURL = $ro_url; + my $now = time; + utime $now, $now, $aslocal; # download time is more + # important than upload + # time + return $aslocal; + } + elsif ( $res && $res->{status} ne '599') { + $CPAN::Frontend->myprint(sprintf( + "HTTP::Tiny failed with code[%s] message[%s]\n", + $res->{status}, + $res->{reason}, + ) + ); + } + elsif ( $res && $res->{status} eq '599') { + $CPAN::Frontend->myprint(sprintf( + "HTTP::Tiny failed with an internal error: %s\n", + $res->{content}, + ) + ); + } + else { + my $err = $@ || 'Unknown error'; + $CPAN::Frontend->myprint(sprintf( + "Error downloading with HTTP::Tiny: %s\n", $err + ) + ); + } + } + } + return if $CPAN::Signal; + if ($url =~ m|^ftp://(.*?)/(.*)/(.*)|) { + # that's the nice and easy way thanks to Graham + $self->debug("recognized ftp") if $CPAN::DEBUG; + my($host,$dir,$getfile) = ($1,$2,$3); + if ($CPAN::META->has_usable('Net::FTP')) { + $dir =~ s|/+|/|g; + $CPAN::Frontend->myprint("Fetching with Net::FTP:\n$url\n"); + $self->debug("getfile[$getfile]dir[$dir]host[$host]" . + "aslocal[$aslocal]") if $CPAN::DEBUG; + if (CPAN::FTP->ftp_get($host,$dir,$getfile,$aslocal)) { + $ThesiteURL = $ro_url; + return $aslocal; + } + if ($aslocal !~ /\.gz(?!\n)\Z/) { + my $gz = "$aslocal.gz"; + $CPAN::Frontend->myprint("Fetching with Net::FTP\n$url.gz\n"); + if (CPAN::FTP->ftp_get($host, + $dir, + "$getfile.gz", + $gz) && + eval{CPAN::Tarzip->new($gz)->gunzip($aslocal)} + ) { + $ThesiteURL = $ro_url; + return $aslocal; + } + } + # next HOSTEASY; + } else { + CPAN->debug("Net::FTP does not count as usable atm") if $CPAN::DEBUG; + } + } + if ( + UNIVERSAL::can($ro_url,"text") + and + $ro_url->{FROM} eq "USER" + ) { + ##address #17973: default URLs should not try to override + ##user-defined URLs just because LWP is not available + my $ret = $self->hostdlhard([$ro_url],$file,$aslocal,$stats); + return $ret if $ret; + } + return if $CPAN::Signal; + } +} + +# package CPAN::FTP; +sub hostdlhard { + my($self,$host_seq,$file,$aslocal,$stats) = @_; + + # Came back if Net::FTP couldn't establish connection (or + # failed otherwise) Maybe they are behind a firewall, but they + # gave us a socksified (or other) ftp program... + + my($ro_url); + my($devnull) = $CPAN::Config->{devnull} || ""; + # < /dev/null "; + my($aslocal_dir) = dirname($aslocal); + mkpath($aslocal_dir); + my $some_dl_success = 0; + my $any_attempt = 0; + HOSTHARD: for $ro_url (@$host_seq) { + $self->_set_attempt($stats,"dlhard",$ro_url); + my $url = "$ro_url$file"; + my($proto,$host,$dir,$getfile); + + # Courtesy Mark Conty mark_conty@cargill.com change from + # if ($url =~ m|^ftp://(.*?)/(.*)/(.*)|) { + # to + if ($url =~ m|^([^:]+)://(.*?)/(.*)/(.*)|) { + # proto not yet used + ($proto,$host,$dir,$getfile) = ($1,$2,$3,$4); + } else { + next HOSTHARD; # who said, we could ftp anything except ftp? + } + next HOSTHARD if $proto eq "file"; # file URLs would have had + # success above. Likely a bogus URL + + # making at least one attempt against a host + $any_attempt++; + + $self->debug("localizing funkyftpwise[$url]") if $CPAN::DEBUG; + + # Try the most capable first and leave ncftp* for last as it only + # does FTP. + my $proxy_vars = $self->_proxy_vars($ro_url); + DLPRG: for my $f (qw(curl wget lynx ncftpget ncftp)) { + my $funkyftp = CPAN::HandleConfig->safe_quote($CPAN::Config->{$f}); + next DLPRG unless defined $funkyftp; + next DLPRG if $funkyftp =~ /^\s*$/; + + my($src_switch) = ""; + my($chdir) = ""; + my($stdout_redir) = " > \"$aslocal\""; + if ($f eq "lynx") { + $src_switch = " -source"; + } elsif ($f eq "ncftp") { + next DLPRG unless $url =~ m{\Aftp://}; + $src_switch = " -c"; + } elsif ($f eq "wget") { + $src_switch = " -O \"$aslocal\""; + $stdout_redir = ""; + } elsif ($f eq 'curl') { + $src_switch = ' -L -f -s -S --netrc-optional'; + if ($proxy_vars->{http_proxy}) { + $src_switch .= qq{ -U "$proxy_vars->{proxy_user}:$proxy_vars->{proxy_pass}" -x "$proxy_vars->{http_proxy}"}; + } + } elsif ($f eq "ncftpget") { + next DLPRG unless $url =~ m{\Aftp://}; + $chdir = "cd $aslocal_dir && "; + $stdout_redir = ""; + } + $CPAN::Frontend->myprint( + qq[ +Trying with + $funkyftp$src_switch +to get + $url +]); + my($system) = + "$chdir$funkyftp$src_switch \"$url\" $devnull$stdout_redir"; + $self->debug("system[$system]") if $CPAN::DEBUG; + my($wstatus) = system($system); + if ($f eq "lynx") { + # lynx returns 0 when it fails somewhere + if (-s $aslocal) { + my $content = do { local *FH; + open FH, $aslocal or die; + local $/; + }; + if ($content =~ /^<.*([45]|Error [45])/si) { + $CPAN::Frontend->mywarn(qq{ +No success, the file that lynx has downloaded looks like an error message: +$content +}); + $CPAN::Frontend->mysleep(1); + next DLPRG; + } + $some_dl_success++; + } else { + $CPAN::Frontend->myprint(qq{ +No success, the file that lynx has downloaded is an empty file. +}); + next DLPRG; + } + } + if ($wstatus == 0) { + if (-s $aslocal) { + # Looks good + $some_dl_success++; + } + $ThesiteURL = $ro_url; + return $aslocal; + } else { + my $estatus = $wstatus >> 8; + my $size = -f $aslocal ? + ", left\n$aslocal with size ".-s _ : + "\nWarning: expected file [$aslocal] doesn't exist"; + $CPAN::Frontend->myprint(qq{ + Function system("$system") + returned status $estatus (wstat $wstatus)$size + }); + } + return if $CPAN::Signal; + } # download/transfer programs (DLPRG) + } # host + return unless $any_attempt; + if ($some_dl_success) { + $CPAN::Frontend->mywarn("Warning: doesn't seem we had substantial success downloading '$aslocal'. Don't know how to proceed.\n"); + } else { + $CPAN::Frontend->mywarn("Warning: no success downloading '$aslocal'. Giving up on it.\n"); + } + return; +} + +#-> CPAN::FTP::_proxy_vars +sub _proxy_vars { + my($self,$url) = @_; + my $ret = +{}; + my $http_proxy = $CPAN::Config->{'http_proxy'} || $ENV{'http_proxy'}; + if ($http_proxy) { + my($host) = $url =~ m|://([^/:]+)|; + my $want_proxy = 1; + my $noproxy = $CPAN::Config->{'no_proxy'} || $ENV{'no_proxy'} || ""; + my @noproxy = split /\s*,\s*/, $noproxy; + if ($host) { + DOMAIN: for my $domain (@noproxy) { + if ($host =~ /\Q$domain\E$/) { # cf. LWP::UserAgent + $want_proxy = 0; + last DOMAIN; + } + } + } else { + $CPAN::Frontend->mywarn(" Could not determine host from http_proxy '$http_proxy'\n"); + } + if ($want_proxy) { + my($user, $pass) = + CPAN::HTTP::Credentials->get_proxy_credentials(); + $ret = { + proxy_user => $user, + proxy_pass => $pass, + http_proxy => $http_proxy + }; + } + } + return $ret; +} + +# package CPAN::FTP; +sub hostdlhardest { + my($self,$host_seq,$file,$aslocal,$stats) = @_; + + return unless @$host_seq; + my($ro_url); + my($aslocal_dir) = dirname($aslocal); + mkpath($aslocal_dir); + my $ftpbin = $CPAN::Config->{ftp}; + unless ($ftpbin && length $ftpbin && MM->maybe_command($ftpbin)) { + $CPAN::Frontend->myprint("No external ftp command available\n\n"); + return; + } + $CPAN::Frontend->mywarn(qq{ +As a last resort we now switch to the external ftp command '$ftpbin' +to get '$aslocal'. + +Doing so often leads to problems that are hard to diagnose. + +If you're the victim of such problems, please consider unsetting the +ftp config variable with + + o conf ftp "" + o conf commit + +}); + $CPAN::Frontend->mysleep(2); + HOSTHARDEST: for $ro_url (@$host_seq) { + $self->_set_attempt($stats,"dlhardest",$ro_url); + my $url = "$ro_url$file"; + $self->debug("localizing ftpwise[$url]") if $CPAN::DEBUG; + unless ($url =~ m|^ftp://(.*?)/(.*)/(.*)|) { + next; + } + my($host,$dir,$getfile) = ($1,$2,$3); + my $timestamp = 0; + my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, + $ctime,$blksize,$blocks) = stat($aslocal); + $timestamp = $mtime ||= 0; + my($netrc) = CPAN::FTP::netrc->new; + my($netrcfile) = $netrc->netrc; + my($verbose) = $CPAN::DEBUG{'FTP'} & $CPAN::DEBUG ? " -v" : ""; + my $targetfile = File::Basename::basename($aslocal); + my(@dialog); + push( + @dialog, + "lcd $aslocal_dir", + "cd /", + map("cd $_", split /\//, $dir), # RFC 1738 + "bin", + "passive", + "get $getfile $targetfile", + "quit" + ); + if (! $netrcfile) { + CPAN->debug("No ~/.netrc file found") if $CPAN::DEBUG; + } elsif ($netrc->hasdefault || $netrc->contains($host)) { + CPAN->debug(sprintf("hasdef[%d]cont($host)[%d]", + $netrc->hasdefault, + $netrc->contains($host))) if $CPAN::DEBUG; + if ($netrc->protected) { + my $dialog = join "", map { " $_\n" } @dialog; + my $netrc_explain; + if ($netrc->contains($host)) { + $netrc_explain = "Relying that your .netrc entry for '$host' ". + "manages the login"; + } else { + $netrc_explain = "Relying that your default .netrc entry ". + "manages the login"; + } + $CPAN::Frontend->myprint(qq{ + Trying with external ftp to get + '$url' + $netrc_explain + Sending the dialog +$dialog +} + ); + $self->talk_ftp("$ftpbin$verbose $host", + @dialog); + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($aslocal); + $mtime ||= 0; + if ($mtime > $timestamp) { + $CPAN::Frontend->myprint("GOT $aslocal\n"); + $ThesiteURL = $ro_url; + return $aslocal; + } else { + $CPAN::Frontend->myprint("Hmm... Still failed!\n"); + } + return if $CPAN::Signal; + } else { + $CPAN::Frontend->mywarn(qq{Your $netrcfile is not }. + qq{correctly protected.\n}); + } + } else { + $CPAN::Frontend->mywarn("Your ~/.netrc neither contains $host + nor does it have a default entry\n"); + } + + # OK, they don't have a valid ~/.netrc. Use 'ftp -n' + # then and login manually to host, using e-mail as + # password. + $CPAN::Frontend->myprint(qq{Issuing "$ftpbin$verbose -n"\n}); + unshift( + @dialog, + "open $host", + "user anonymous $Config::Config{'cf_email'}" + ); + my $dialog = join "", map { " $_\n" } @dialog; + $CPAN::Frontend->myprint(qq{ + Trying with external ftp to get + $url + Sending the dialog +$dialog +} + ); + $self->talk_ftp("$ftpbin$verbose -n", @dialog); + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($aslocal); + $mtime ||= 0; + if ($mtime > $timestamp) { + $CPAN::Frontend->myprint("GOT $aslocal\n"); + $ThesiteURL = $ro_url; + return $aslocal; + } else { + $CPAN::Frontend->myprint("Bad luck... Still failed!\n"); + } + return if $CPAN::Signal; + $CPAN::Frontend->mywarn("Can't access URL $url.\n\n"); + $CPAN::Frontend->mysleep(2); + } # host +} + +# package CPAN::FTP; +sub talk_ftp { + my($self,$command,@dialog) = @_; + my $fh = FileHandle->new; + $fh->open("|$command") or die "Couldn't open ftp: $!"; + foreach (@dialog) { $fh->print("$_\n") } + $fh->close; # Wait for process to complete + my $wstatus = $?; + my $estatus = $wstatus >> 8; + $CPAN::Frontend->myprint(qq{ +Subprocess "|$command" + returned status $estatus (wstat $wstatus) +}) if $wstatus; +} + +# find2perl needs modularization, too, all the following is stolen +# from there +# CPAN::FTP::ls +sub ls { + my($self,$name) = @_; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizemm, + $atime,$mtime,$ctime,$blksize,$blocks) = lstat($name); + + my($perms,%user,%group); + my $pname = $name; + + if ($blocks) { + $blocks = int(($blocks + 1) / 2); + } + else { + $blocks = int(($sizemm + 1023) / 1024); + } + + if (-f _) { $perms = '-'; } + elsif (-d _) { $perms = 'd'; } + elsif (-c _) { $perms = 'c'; $sizemm = &sizemm; } + elsif (-b _) { $perms = 'b'; $sizemm = &sizemm; } + elsif (-p _) { $perms = 'p'; } + elsif (-S _) { $perms = 's'; } + else { $perms = 'l'; $pname .= ' -> ' . readlink($_); } + + my(@rwx) = ('---','--x','-w-','-wx','r--','r-x','rw-','rwx'); + my(@moname) = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); + my $tmpmode = $mode; + my $tmp = $rwx[$tmpmode & 7]; + $tmpmode >>= 3; + $tmp = $rwx[$tmpmode & 7] . $tmp; + $tmpmode >>= 3; + $tmp = $rwx[$tmpmode & 7] . $tmp; + substr($tmp,2,1) =~ tr/-x/Ss/ if -u _; + substr($tmp,5,1) =~ tr/-x/Ss/ if -g _; + substr($tmp,8,1) =~ tr/-x/Tt/ if -k _; + $perms .= $tmp; + + my $user = $user{$uid} || $uid; # too lazy to implement lookup + my $group = $group{$gid} || $gid; + + my($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime); + my($timeyear); + my($moname) = $moname[$mon]; + if (-M _ > 365.25 / 2) { + $timeyear = $year + 1900; + } + else { + $timeyear = sprintf("%02d:%02d", $hour, $min); + } + + sprintf "%5lu %4ld %-10s %2d %-8s %-8s %8s %s %2d %5s %s\n", + $ino, + $blocks, + $perms, + $nlink, + $user, + $group, + $sizemm, + $moname, + $mday, + $timeyear, + $pname; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/FirstTime.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/FirstTime.pm new file mode 100644 index 0000000000000000000000000000000000000000..af4a6d775919ace8a5f51f92a4620516bca20b68 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/FirstTime.pm @@ -0,0 +1,2186 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::FirstTime; +use strict; + +use ExtUtils::MakeMaker (); +use FileHandle (); +use File::Basename (); +use File::Path (); +use File::Spec (); +use CPAN::Mirrors (); +use CPAN::Version (); +use vars qw($VERSION $auto_config); +$VERSION = "5.5314"; + +=head1 NAME + +CPAN::FirstTime - Utility for CPAN::Config file Initialization + +=head1 SYNOPSIS + +CPAN::FirstTime::init() + +=head1 DESCRIPTION + +The init routine asks a few questions and writes a CPAN/Config.pm or +CPAN/MyConfig.pm file (depending on what it is currently using). + +In the following all questions and explanations regarding config +variables are collected. + +=cut + +# down until the next =back the manpage must be parsed by the program +# because the text is used in the init dialogues. + +my @podpara = split /\n\n/, <<'=back'; + +=over 2 + +=item allow_installing_module_downgrades + +The CPAN shell can watch the C<blib/> directories that are built up +before running C<make test> to determine whether the current +distribution will end up with modules being overwritten with decreasing module version numbers. It +can then let the build of this distro fail when it discovers a +downgrade. + +Do you want to allow installing distros with decreasing module +versions compared to what you have installed (yes, no, ask/yes, +ask/no)? + +=item allow_installing_outdated_dists + +The CPAN shell can watch the C<blib/> directories that are built up +before running C<make test> to determine whether the current +distribution contains modules that are indexed with a distro with a +higher distro-version number than the current one. It can +then let the build of this distro fail when it would not represent the +most up-to-date version of the distro. + +Note: choosing anyhing but 'yes' for this option will need +Devel::DistnameInfo being installed for taking effect. + +Do you want to allow installing distros that are not indexed as the +highest distro-version for all contained modules (yes, no, ask/yes, +ask/no)? + +=item auto_commit + +Normally CPAN.pm keeps config variables in memory and changes need to +be saved in a separate 'o conf commit' command to make them permanent +between sessions. If you set the 'auto_commit' option to true, changes +to a config variable are always automatically committed to disk. + +Always commit changes to config variables to disk? + +=item build_cache + +CPAN.pm can limit the size of the disk area for keeping the build +directories with all the intermediate files. + +Cache size for build directory (in MB)? + +=item build_dir + +Directory where the build process takes place? + +=item build_dir_reuse + +Until version 1.88 CPAN.pm never trusted the contents of the build_dir +directory between sessions. Since 1.88_58 CPAN.pm has a YAML-based +mechanism that makes it possible to share the contents of the +build_dir/ directory between different sessions with the same version +of perl. People who prefer to test things several days before +installing will like this feature because it saves a lot of time. + +If you say yes to the following question, CPAN will try to store +enough information about the build process so that it can pick up in +future sessions at the same state of affairs as it left a previous +session. + +Store and re-use state information about distributions between +CPAN.pm sessions? + +=item build_requires_install_policy + +When a module declares another one as a 'build_requires' prerequisite +this means that the other module is only needed for building or +testing the module but need not be installed permanently. In this case +you may wish to install that other module nonetheless or just keep it +in the 'build_dir' directory to have it available only temporarily. +Installing saves time on future installations but makes the perl +installation bigger. + +You can choose if you want to always install (yes), never install (no) +or be always asked. In the latter case you can set the default answer +for the question to yes (ask/yes) or no (ask/no). + +Policy on installing 'build_requires' modules (yes, no, ask/yes, +ask/no)? + +=item cache_metadata + +To considerably speed up the initial CPAN shell startup, it is +possible to use Storable to create a cache of metadata. If Storable is +not available, the normal index mechanism will be used. + +Note: this mechanism is not used when use_sqlite is on and SQLLite is +running. + +Cache metadata (yes/no)? + +=item check_sigs + +CPAN packages can be digitally signed by authors and thus verified +with the security provided by strong cryptography. The exact mechanism +is defined in the Module::Signature module. While this is generally +considered a good thing, it is not always convenient to the end user +to install modules that are signed incorrectly or where the key of the +author is not available or where some prerequisite for +Module::Signature has a bug and so on. + +With the check_sigs parameter you can turn signature checking on and +off. The default is off for now because the whole tool chain for the +functionality is not yet considered mature by some. The author of +CPAN.pm would recommend setting it to true most of the time and +turning it off only if it turns out to be annoying. + +Note that if you do not have Module::Signature installed, no signature +checks will be performed at all. + +Always try to check and verify signatures if a SIGNATURE file is in +the package and Module::Signature is installed (yes/no)? + +=item cleanup_after_install + +Users who install modules and do not intend to look back, can free +occupied disk space quickly by letting CPAN.pm cleanup each build +directory immediately after a successful install. + +Remove build directory after a successful install? (yes/no)? + +=item colorize_output + +When you have Term::ANSIColor installed, you can turn on colorized +output to have some visual differences between normal CPAN.pm output, +warnings, debugging output, and the output of the modules being +installed. Set your favorite colors after some experimenting with the +Term::ANSIColor module. + +Please note that on Windows platforms colorized output also requires +the Win32::Console::ANSI module. + +Do you want to turn on colored output? + +=item colorize_print + +Color for normal output? + +=item colorize_warn + +Color for warnings? + +=item colorize_debug + +Color for debugging messages? + +=item commandnumber_in_prompt + +The prompt of the cpan shell can contain the current command number +for easier tracking of the session or be a plain string. + +Do you want the command number in the prompt (yes/no)? + +=item connect_to_internet_ok + +If you have never defined your own C<urllist> in your configuration +then C<CPAN.pm> will be hesitant to use the built in default sites for +downloading. It will ask you once per session if a connection to the +internet is OK and only if you say yes, it will try to connect. But to +avoid this question, you can choose your favorite download sites once +and get away with it. Or, if you have no favorite download sites +answer yes to the following question. + +If no urllist has been chosen yet, would you prefer CPAN.pm to connect +to the built-in default sites without asking? (yes/no)? + +=item ftp_passive + +Shall we always set the FTP_PASSIVE environment variable when dealing +with ftp download (yes/no)? + +=item ftpstats_period + +Statistics about downloads are truncated by size and period +simultaneously. + +How many days shall we keep statistics about downloads? + +=item ftpstats_size + +Statistics about downloads are truncated by size and period +simultaneously. Setting this to zero or negative disables download +statistics. + +How many items shall we keep in the statistics about downloads? + +=item getcwd + +CPAN.pm changes the current working directory often and needs to +determine its own current working directory. Per default it uses +Cwd::cwd but if this doesn't work on your system for some reason, +alternatives can be configured according to the following table: + + cwd Cwd::cwd + getcwd Cwd::getcwd + fastcwd Cwd::fastcwd + getdcwd Cwd::getdcwd + backtickcwd external command cwd + +Preferred method for determining the current working directory? + +=item halt_on_failure + +Normally, CPAN.pm continues processing the full list of targets and +dependencies, even if one of them fails. However, you can specify +that CPAN should halt after the first failure. (Note that optional +recommended or suggested modules that fail will not cause a halt.) + +Do you want to halt on failure (yes/no)? + +=item histfile + +If you have one of the readline packages (Term::ReadLine::Perl, +Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN +shell will have history support. The next two questions deal with the +filename of the history file and with its size. If you do not want to +set this variable, please hit SPACE ENTER to the following question. + +File to save your history? + +=item histsize + +Number of lines to save? + +=item inactivity_timeout + +Sometimes you may wish to leave the processes run by CPAN alone +without caring about them. Because the Makefile.PL or the Build.PL +sometimes contains question you're expected to answer, you can set a +timer that will kill a 'perl Makefile.PL' process after the specified +time in seconds. + +If you set this value to 0, these processes will wait forever. This is +the default and recommended setting. + +Timeout for inactivity during {Makefile,Build}.PL? + +=item index_expire + +The CPAN indexes are usually rebuilt once or twice per hour, but the +typical CPAN mirror mirrors only once or twice per day. Depending on +the quality of your mirror and your desire to be on the bleeding edge, +you may want to set the following value to more or less than one day +(which is the default). It determines after how many days CPAN.pm +downloads new indexes. + +Let the index expire after how many days? + +=item inhibit_startup_message + +When the CPAN shell is started it normally displays a greeting message +that contains the running version and the status of readline support. + +Do you want to turn this message off? + +=item keep_source_where + +Unless you are accessing the CPAN on your filesystem via a file: URL, +CPAN.pm needs to keep the source files it downloads somewhere. Please +supply a directory where the downloaded files are to be kept. + +Download target directory? + +=item load_module_verbosity + +When CPAN.pm loads a module it needs for some optional feature, it +usually reports about module name and version. Choose 'v' to get this +message, 'none' to suppress it. + +Verbosity level for loading modules (none or v)? + +=item makepl_arg + +Every Makefile.PL is run by perl in a separate process. Likewise we +run 'make' and 'make install' in separate processes. If you have +any parameters (e.g. PREFIX, UNINST or the like) you want to +pass to the calls, please specify them here. + +If you don't understand this question, just press ENTER. + +Typical frequently used settings: + + PREFIX=~/perl # non-root users (please see manual for more hints) + +Parameters for the 'perl Makefile.PL' command? + +=item make_arg + +Parameters for the 'make' command? Typical frequently used setting: + + -j3 # dual processor system (on GNU make) + +Your choice: + +=item make_install_arg + +Parameters for the 'make install' command? +Typical frequently used setting: + + UNINST=1 # to always uninstall potentially conflicting files + # (but do NOT use with local::lib or INSTALL_BASE) + +Your choice: + +=item make_install_make_command + +Do you want to use a different make command for 'make install'? +Cautious people will probably prefer: + + su root -c make + or + sudo make + or + /path1/to/sudo -u admin_account /path2/to/make + +or some such. Your choice: + +=item mbuildpl_arg + +A Build.PL is run by perl in a separate process. Likewise we run +'./Build' and './Build install' in separate processes. If you have any +parameters you want to pass to the calls, please specify them here. + +Typical frequently used settings: + + --install_base /home/xxx # different installation directory + +Parameters for the 'perl Build.PL' command? + +=item mbuild_arg + +Parameters for the './Build' command? Setting might be: + + --extra_linker_flags -L/usr/foo/lib # non-standard library location + +Your choice: + +=item mbuild_install_arg + +Parameters for the './Build install' command? Typical frequently used +setting: + + --uninst 1 # uninstall conflicting files + # (but do NOT use with local::lib or INSTALL_BASE) + +Your choice: + +=item mbuild_install_build_command + +Do you want to use a different command for './Build install'? Sudo +users will probably prefer: + + su root -c ./Build + or + sudo ./Build + or + /path1/to/sudo -u admin_account ./Build + +or some such. Your choice: + +=item pager + +What is your favorite pager program? + +=item prefer_installer + +When you have Module::Build installed and a module comes with both a +Makefile.PL and a Build.PL, which shall have precedence? + +The main two standard installer modules are the old and well +established ExtUtils::MakeMaker (for short: EUMM) which uses the +Makefile.PL. And the next generation installer Module::Build (MB) +which works with the Build.PL (and often comes with a Makefile.PL +too). If a module comes only with one of the two we will use that one +but if both are supplied then a decision must be made between EUMM and +MB. See also http://rt.cpan.org/Ticket/Display.html?id=29235 for a +discussion about the right default. + +Or, as a third option you can choose RAND which will make a random +decision (something regular CPAN testers will enjoy). + +In case you can choose between running a Makefile.PL or a Build.PL, +which installer would you prefer (EUMM or MB or RAND)? + +=item prefs_dir + +CPAN.pm can store customized build environments based on regular +expressions for distribution names. These are YAML files where the +default options for CPAN.pm and the environment can be overridden and +dialog sequences can be stored that can later be executed by an +Expect.pm object. The CPAN.pm distribution comes with some prefab YAML +files that cover sample distributions that can be used as blueprints +to store your own prefs. Please check out the distroprefs/ directory of +the CPAN.pm distribution to get a quick start into the prefs system. + +Directory where to store default options/environment/dialogs for +building modules that need some customization? + +=item prerequisites_policy + +The CPAN module can detect when a module which you are trying to build +depends on prerequisites. If this happens, it can build the +prerequisites for you automatically ('follow'), ask you for +confirmation ('ask'), or just ignore them ('ignore'). Choosing +'follow' also sets PERL_AUTOINSTALL and PERL_EXTUTILS_AUTOINSTALL for +"--defaultdeps" if not already set. + +Please set your policy to one of the three values. + +Policy on building prerequisites (follow, ask or ignore)? + +=item randomize_urllist + +CPAN.pm can introduce some randomness when using hosts for download +that are configured in the urllist parameter. Enter a numeric value +between 0 and 1 to indicate how often you want to let CPAN.pm try a +random host from the urllist. A value of one specifies to always use a +random host as the first try. A value of zero means no randomness at +all. Anything in between specifies how often, on average, a random +host should be tried first. + +Randomize parameter + +=item recommends_policy + +(Experimental feature!) Some CPAN modules recommend additional, optional dependencies. These should +generally be installed except in resource constrained environments. When this +policy is true, recommended modules will be included with required modules. + +Include recommended modules? + +=item scan_cache + +By default, each time the CPAN module is started, cache scanning is +performed to keep the cache size in sync ('atstart'). Alternatively, +scanning and cleanup can happen when CPAN exits ('atexit'). To prevent +any cache cleanup, answer 'never'. + +Perform cache scanning ('atstart', 'atexit' or 'never')? + +=item shell + +What is your favorite shell? + +=item show_unparsable_versions + +During the 'r' command CPAN.pm finds modules without version number. +When the command finishes, it prints a report about this. If you +want this report to be very verbose, say yes to the following +variable. + +Show all individual modules that have no $VERSION? + +=item show_upload_date + +The 'd' and the 'm' command normally only show you information they +have in their in-memory database and thus will never connect to the +internet. If you set the 'show_upload_date' variable to true, 'm' and +'d' will additionally show you the upload date of the module or +distribution. Per default this feature is off because it may require a +net connection to get at the upload date. + +Always try to show upload date with 'd' and 'm' command (yes/no)? + +=item show_zero_versions + +During the 'r' command CPAN.pm finds modules with a version number of +zero. When the command finishes, it prints a report about this. If you +want this report to be very verbose, say yes to the following +variable. + +Show all individual modules that have a $VERSION of zero? + +=item suggests_policy + +(Experimental feature!) Some CPAN modules suggest additional, optional dependencies. These 'suggest' +dependencies provide enhanced operation. When this policy is true, suggested +modules will be included with required modules. + +Include suggested modules? + +=item tar_verbosity + +When CPAN.pm uses the tar command, which switch for the verbosity +shall be used? Choose 'none' for quiet operation, 'v' for file +name listing, 'vv' for full listing. + +Tar command verbosity level (none or v or vv)? + +=item term_is_latin + +The next option deals with the charset (a.k.a. character set) your +terminal supports. In general, CPAN is English speaking territory, so +the charset does not matter much but some CPAN have names that are +outside the ASCII range. If your terminal supports UTF-8, you should +say no to the next question. If it expects ISO-8859-1 (also known as +LATIN1) then you should say yes. If it supports neither, your answer +does not matter because you will not be able to read the names of some +authors anyway. If you answer no, names will be output in UTF-8. + +Your terminal expects ISO-8859-1 (yes/no)? + +=item term_ornaments + +When using Term::ReadLine, you can turn ornaments on so that your +input stands out against the output from CPAN.pm. + +Do you want to turn ornaments on? + +=item test_report + +The goal of the CPAN Testers project (http://testers.cpan.org/) is to +test as many CPAN packages as possible on as many platforms as +possible. This provides valuable feedback to module authors and +potential users to identify bugs or platform compatibility issues and +improves the overall quality and value of CPAN. + +One way you can contribute is to send test results for each module +that you install. If you install the CPAN::Reporter module, you have +the option to automatically generate and deliver test reports to CPAN +Testers whenever you run tests on a CPAN package. + +See the CPAN::Reporter documentation for additional details and +configuration settings. If your firewall blocks outgoing traffic, +you may need to configure CPAN::Reporter before sending reports. + +Generate test reports if CPAN::Reporter is installed (yes/no)? + +=item perl5lib_verbosity + +When CPAN.pm extends @INC via PERL5LIB, it prints a list of +directories added (or a summary of how many directories are +added). Choose 'v' to get this message, 'none' to suppress it. + +Verbosity level for PERL5LIB changes (none or v)? + +=item prefer_external_tar + +Per default all untar operations are done with the perl module +Archive::Tar; by setting this variable to true the external tar +command is used if available; on Unix this is usually preferred +because they have a reliable and fast gnutar implementation. + +Use the external tar program instead of Archive::Tar? + +=item trust_test_report_history + +When a distribution has already been tested by CPAN::Reporter on +this machine, CPAN can skip the test phase and just rely on the +test report history instead. + +Note that this will not apply to distributions that failed tests +because of missing dependencies. Also, tests can be run +regardless of the history using "force". + +Do you want to rely on the test report history (yes/no)? + +=item urllist_ping_external + +When automatic selection of the nearest cpan mirrors is performed, +turn on the use of the external ping via Net::Ping::External. This is +recommended in the case the local network has a transparent proxy. + +Do you want to use the external ping command when autoselecting +mirrors? + +=item urllist_ping_verbose + +When automatic selection of the nearest cpan mirrors is performed, +this option can be used to turn on verbosity during the selection +process. + +Do you want to see verbosity turned on when autoselecting mirrors? + +=item use_prompt_default + +When this is true, CPAN will set PERL_MM_USE_DEFAULT to a true +value. This causes ExtUtils::MakeMaker (and compatible) prompts +to use default values instead of stopping to prompt you to answer +questions. It also sets NONINTERACTIVE_TESTING to a true value to +signal more generally that distributions should not try to +interact with you. + +Do you want to use prompt defaults (yes/no)? + +=item use_sqlite + +CPAN::SQLite is a layer between the index files that are downloaded +from the CPAN and CPAN.pm that speeds up metadata queries and reduces +memory consumption of CPAN.pm considerably. + +Use CPAN::SQLite if available? (yes/no)? + +=item version_timeout + +This timeout prevents CPAN from hanging when trying to parse a +pathologically coded $VERSION from a module. + +The default is 15 seconds. If you set this value to 0, no timeout +will occur, but this is not recommended. + +Timeout for parsing module versions? + +=item yaml_load_code + +Both YAML.pm and YAML::Syck are capable of deserialising code. As this +requires a string eval, which might be a security risk, you can use +this option to enable or disable the deserialisation of code via +CPAN::DeferredCode. (Note: This does not work under perl 5.6) + +Do you want to enable code deserialisation (yes/no)? + +=item yaml_module + +At the time of this writing (2009-03) there are three YAML +implementations working: YAML, YAML::Syck, and YAML::XS. The latter +two are faster but need a C compiler installed on your system. There +may be more alternative YAML conforming modules. When I tried two +other players, YAML::Tiny and YAML::Perl, they seemed not powerful +enough to work with CPAN.pm. This may have changed in the meantime. + +Which YAML implementation would you prefer? + +=back + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut + +use vars qw( %prompts ); + +{ + + my @prompts = ( + +auto_config => qq{ +CPAN.pm requires configuration, but most of it can be done automatically. +If you answer 'no' below, you will enter an interactive dialog for each +configuration option instead. + +Would you like to configure as much as possible automatically?}, + +auto_pick => qq{ +Would you like me to automatically choose some CPAN mirror +sites for you? (This means connecting to the Internet)}, + +config_intro => qq{ + +The following questions are intended to help you with the +configuration. The CPAN module needs a directory of its own to cache +important index files and maybe keep a temporary mirror of CPAN files. +This may be a site-wide or a personal directory. + +}, + +# cpan_home => qq{ }, + +cpan_home_where => qq{ + +First of all, I'd like to create this directory. Where? + +}, + +external_progs => qq{ + +The CPAN module will need a few external programs to work properly. +Please correct me, if I guess the wrong path for a program. Don't +panic if you do not have some of them, just press ENTER for those. To +disable the use of a program, you can type a space followed by ENTER. + +}, + +proxy_intro => qq{ + +If you're accessing the net via proxies, you can specify them in the +CPAN configuration or via environment variables. The variable in +the \$CPAN::Config takes precedence. + +}, + +proxy_user => qq{ + +If your proxy is an authenticating proxy, you can store your username +permanently. If you do not want that, just press ENTER. You will then +be asked for your username in every future session. + +}, + +proxy_pass => qq{ + +Your password for the authenticating proxy can also be stored +permanently on disk. If this violates your security policy, just press +ENTER. You will then be asked for the password in every future +session. + +}, + +urls_intro => qq{ +Now you need to choose your CPAN mirror sites. You can let me +pick mirrors for you, you can select them from a list or you +can enter them by hand. +}, + +urls_picker_intro => qq{First, pick a nearby continent and country by typing in the number(s) +in front of the item(s) you want to select. You can pick several of +each, separated by spaces. Then, you will be presented with a list of +URLs of CPAN mirrors in the countries you selected, along with +previously selected URLs. Select some of those URLs, or just keep the +old list. Finally, you will be prompted for any extra URLs -- file:, +ftp:, or http: -- that host a CPAN mirror. + +You should select more than one (just in case the first isn't available). + +}, + +password_warn => qq{ + +Warning: Term::ReadKey seems not to be available, your password will +be echoed to the terminal! + +}, + +install_help => qq{ +Warning: You do not have write permission for Perl library directories. + +To install modules, you need to configure a local Perl library directory or +escalate your privileges. CPAN can help you by bootstrapping the local::lib +module or by configuring itself to use 'sudo' (if available). You may also +resolve this problem manually if you need to customize your setup. + +What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') +}, + +local_lib_installed => qq{ +local::lib is installed. You must now add the following environment variables +to your shell configuration files (or registry, if you are on Windows) and +then restart your command line shell and CPAN before installing modules: + +}, + + ); + + die "Coding error in \@prompts declaration. Odd number of elements, above" + if (@prompts % 2); + + %prompts = @prompts; + + if (scalar(keys %prompts) != scalar(@prompts)/2) { + my %already; + for my $item (0..$#prompts) { + next if $item % 2; + die "$prompts[$item] is duplicated\n" if $already{$prompts[$item]}++; + } + } + + shift @podpara; + while (@podpara) { + warn "Alert: cannot parse my own manpage for init dialog" unless $podpara[0] =~ s/^=item\s+//; + my $name = shift @podpara; + my @para; + while (@podpara && $podpara[0] !~ /^=item/) { + push @para, shift @podpara; + } + $prompts{$name} = pop @para; + if (@para) { + $prompts{$name . "_intro"} = join "", map { "$_\n\n" } @para; + } + } + +} + +sub init { + my($configpm, %args) = @_; + use Config; + # extra args after 'o conf init' + my $matcher = $args{args} && @{$args{args}} ? $args{args}[0] : ''; + if ($matcher =~ /^\/(.*)\/$/) { + # case /regex/ => take the first, ignore the rest + $matcher = $1; + shift @{$args{args}}; + if (@{$args{args}}) { + local $" = " "; + $CPAN::Frontend->mywarn("Ignoring excessive arguments '@{$args{args}}'"); + $CPAN::Frontend->mysleep(2); + } + } elsif (0 == length $matcher) { + } elsif (0 && $matcher eq "~") { # extremely buggy, but a nice idea + my @unconfigured = sort grep { not exists $CPAN::Config->{$_} + or not defined $CPAN::Config->{$_} + or not length $CPAN::Config->{$_} + } keys %$CPAN::Config; + $matcher = "\\b(".join("|", @unconfigured).")\\b"; + $CPAN::Frontend->mywarn("matcher[$matcher]"); + } else { + # case WORD... => all arguments must be valid + for my $arg (@{$args{args}}) { + unless (exists $CPAN::HandleConfig::keys{$arg}) { + $CPAN::Frontend->mywarn("'$arg' is not a valid configuration variable\n"); + return; + } + } + $matcher = "\\b(".join("|",@{$args{args}}).")\\b"; + } + CPAN->debug("matcher[$matcher]") if $CPAN::DEBUG; + + unless ($CPAN::VERSION) { + require CPAN::Nox; + } + require CPAN::HandleConfig; + CPAN::HandleConfig::require_myconfig_or_config(); + $CPAN::Config ||= {}; + local($/) = "\n"; + local($\) = ""; + local($|) = 1; + + my($ans,$default); # why so half global? + + # + #= Files, directories + # + + local *_real_prompt; + if ( $args{autoconfig} ) { + $auto_config = 1; + } elsif ($matcher) { + $auto_config = 0; + } else { + my $_conf = prompt($prompts{auto_config}, "yes"); + $auto_config = ($_conf and $_conf =~ /^y/i) ? 1 : 0; + } + CPAN->debug("auto_config[$auto_config]") if $CPAN::DEBUG; + if ( $auto_config ) { + local $^W = 0; + # prototype should match that of &MakeMaker::prompt + my $current_second = time; + my $current_second_count = 0; + my $i_am_mad = 0; + # silent prompting -- just quietly use default + *_real_prompt = sub { return $_[1] }; + } + + # + # bootstrap local::lib or sudo + # + unless ( $matcher + || _can_write_to_libdirs() || _using_installbase() || _using_sudo() + ) { + local $auto_config = 0; # We *must* ask, even under autoconfig + local *_real_prompt; # We *must* show prompt + my_prompt_loop(install_help => 'local::lib', $matcher, + 'local::lib|sudo|manual'); + } + $CPAN::Config->{install_help} ||= ''; # Temporary to suppress warnings + + if (!$matcher or q{ + build_dir + build_dir_reuse + cpan_home + keep_source_where + prefs_dir + } =~ /$matcher/) { + $CPAN::Frontend->myprint($prompts{config_intro}) unless $auto_config; + + init_cpan_home($matcher); + + my_dflt_prompt("keep_source_where", + File::Spec->catdir($CPAN::Config->{cpan_home},"sources"), + $matcher, + ); + my_dflt_prompt("build_dir", + File::Spec->catdir($CPAN::Config->{cpan_home},"build"), + $matcher + ); + my_yn_prompt(build_dir_reuse => 0, $matcher); + my_dflt_prompt("prefs_dir", + File::Spec->catdir($CPAN::Config->{cpan_home},"prefs"), + $matcher + ); + } + + # + #= Config: auto_commit + # + + my_yn_prompt(auto_commit => 0, $matcher); + + # + #= Cache size, Index expire + # + my_dflt_prompt(build_cache => 100, $matcher); + + my_dflt_prompt(index_expire => 1, $matcher); + my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|atexit|never'); + my_yn_prompt(cleanup_after_install => 0, $matcher); + + # + #= cache_metadata + # + + my_yn_prompt(cache_metadata => 1, $matcher); + my_yn_prompt(use_sqlite => 0, $matcher); + + # + #= Do we follow PREREQ_PM? + # + + my_prompt_loop(prerequisites_policy => 'follow', $matcher, + 'follow|ask|ignore'); + my_prompt_loop(build_requires_install_policy => 'yes', $matcher, + 'yes|no|ask/yes|ask/no'); + my_yn_prompt(recommends_policy => 1, $matcher); + my_yn_prompt(suggests_policy => 0, $matcher); + + # + #= Module::Signature + # + my_yn_prompt(check_sigs => 0, $matcher); + + # + #= CPAN::Reporter + # + if (!$matcher or 'test_report' =~ /$matcher/) { + my_yn_prompt(test_report => 0, $matcher); + if ( + $matcher && + $CPAN::Config->{test_report} && + $CPAN::META->has_inst("CPAN::Reporter") && + CPAN::Reporter->can('configure') + ) { + my $_conf = prompt("Would you like me configure CPAN::Reporter now?", "yes"); + if ($_conf =~ /^y/i) { + $CPAN::Frontend->myprint("\nProceeding to configure CPAN::Reporter.\n"); + CPAN::Reporter::configure(); + $CPAN::Frontend->myprint("\nReturning to CPAN configuration.\n"); + } + } + } + + my_yn_prompt(trust_test_report_history => 0, $matcher); + + # + #= YAML vs. YAML::Syck + # + if (!$matcher or "yaml_module" =~ /$matcher/) { + my_dflt_prompt(yaml_module => "YAML", $matcher); + my $old_v = $CPAN::Config->{load_module_verbosity}; + $CPAN::Config->{load_module_verbosity} = q[none]; + if (!$auto_config && !$CPAN::META->has_inst($CPAN::Config->{yaml_module})) { + $CPAN::Frontend->mywarn + ("Warning (maybe harmless): '$CPAN::Config->{yaml_module}' not installed.\n"); + $CPAN::Frontend->mysleep(3); + } + $CPAN::Config->{load_module_verbosity} = $old_v; + } + + # + #= YAML code deserialisation + # + my_yn_prompt(yaml_load_code => 0, $matcher); + + # + #= External programs + # + my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'}; + $CPAN::Frontend->myprint($prompts{external_progs}) + if !$matcher && !$auto_config; + _init_external_progs($matcher, { + path => \@path, + progs => [ qw/make bzip2 gzip tar unzip gpg patch applypatch/ ], + shortcut => 0 + }); + _init_external_progs($matcher, { + path => \@path, + progs => [ qw/wget curl lynx ncftpget ncftp ftp/ ], + shortcut => 1 + }); + + { + my $path = $CPAN::Config->{'pager'} || + $ENV{PAGER} || find_exe("less",\@path) || + find_exe("more",\@path) || ($^O eq 'MacOS' ? $ENV{EDITOR} : 0 ) + || "more"; + my_dflt_prompt(pager => $path, $matcher); + } + + { + my $path = $CPAN::Config->{'shell'}; + if ($path && File::Spec->file_name_is_absolute($path)) { + $CPAN::Frontend->mywarn("Warning: configured $path does not exist\n") + unless -e $path; + $path = ""; + } + $path ||= $ENV{SHELL}; + $path ||= $ENV{COMSPEC} if $^O eq "MSWin32"; + if ($^O eq 'MacOS') { + $CPAN::Config->{'shell'} = 'not_here'; + } else { + $path ||= 'sh', $path =~ s,\\,/,g if $^O eq 'os2'; # Cosmetic only + my_dflt_prompt(shell => $path, $matcher); + } + } + + { + my $tar = $CPAN::Config->{tar}; + my $prefer_external_tar = $CPAN::Config->{prefer_external_tar}; # XXX not yet supported + unless (defined $prefer_external_tar) { + if ($^O =~ /(MSWin32|solaris)/) { + # both have a record of broken tars + $prefer_external_tar = 0; + } elsif ($tar) { + $prefer_external_tar = 1; + } else { + $prefer_external_tar = 0; + } + } + my_yn_prompt(prefer_external_tar => $prefer_external_tar, $matcher); + } + + # + # verbosity + # + + my_prompt_loop(tar_verbosity => 'none', $matcher, + 'none|v|vv'); + my_prompt_loop(load_module_verbosity => 'none', $matcher, + 'none|v'); + my_prompt_loop(perl5lib_verbosity => 'none', $matcher, + 'none|v'); + my_yn_prompt(inhibit_startup_message => 0, $matcher); + + # + #= Installer, arguments to make etc. + # + + my_prompt_loop(prefer_installer => 'MB', $matcher, 'MB|EUMM|RAND'); + + if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/) { + my_dflt_prompt(makepl_arg => "", $matcher); + my_dflt_prompt(make_arg => "", $matcher); + if ( $CPAN::Config->{makepl_arg} =~ /LIBS=|INC=/ ) { + $CPAN::Frontend->mywarn( + "Warning: Using LIBS or INC in makepl_arg will likely break distributions\n" . + "that specify their own LIBS or INC options in Makefile.PL.\n" + ); + } + + } + + require CPAN::HandleConfig; + if (exists $CPAN::HandleConfig::keys{make_install_make_command}) { + # as long as Windows needs $self->_build_command, we cannot + # support sudo on windows :-) + my $default = $CPAN::Config->{make} || ""; + if ( $default && $CPAN::Config->{install_help} eq 'sudo' ) { + if ( find_exe('sudo') ) { + $default = "sudo $default"; + delete $CPAN::Config->{make_install_make_command} + unless $CPAN::Config->{make_install_make_command} =~ /sudo/; + } + else { + $CPAN::Frontend->mywarnonce("Could not find 'sudo' in PATH\n"); + } + } + my_dflt_prompt(make_install_make_command => $default, $matcher); + } + + my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "", + $matcher); + + my_dflt_prompt(mbuildpl_arg => "", $matcher); + my_dflt_prompt(mbuild_arg => "", $matcher); + + if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command} + and $^O ne "MSWin32") { + # as long as Windows needs $self->_build_command, we cannot + # support sudo on windows :-) + my $default = $^O eq 'VMS' ? '@Build.com' : "./Build"; + if ( $CPAN::Config->{install_help} eq 'sudo' ) { + if ( find_exe('sudo') ) { + $default = "sudo $default"; + delete $CPAN::Config->{mbuild_install_build_command} + unless $CPAN::Config->{mbuild_install_build_command} =~ /sudo/; + } + else { + $CPAN::Frontend->mywarnonce("Could not find 'sudo' in PATH\n"); + } + } + my_dflt_prompt(mbuild_install_build_command => $default, $matcher); + } + + my_dflt_prompt(mbuild_install_arg => "", $matcher); + + for my $o (qw( + allow_installing_outdated_dists + allow_installing_module_downgrades + )) { + my_prompt_loop($o => 'ask/no', $matcher, + 'yes|no|ask/yes|ask/no'); + } + + # + #== use_prompt_default + # + my_yn_prompt(use_prompt_default => 0, $matcher); + + # + #= Alarm period + # + + my_dflt_prompt(inactivity_timeout => 0, $matcher); + my_dflt_prompt(version_timeout => 15, $matcher); + + # + #== halt_on_failure + # + my_yn_prompt(halt_on_failure => 0, $matcher); + + # + #= Proxies + # + + my @proxy_vars = qw/ftp_proxy http_proxy no_proxy/; + my @proxy_user_vars = qw/proxy_user proxy_pass/; + if (!$matcher or "@proxy_vars @proxy_user_vars" =~ /$matcher/) { + $CPAN::Frontend->myprint($prompts{proxy_intro}) unless $auto_config; + + for (@proxy_vars) { + $prompts{$_} = "Your $_?"; + my_dflt_prompt($_ => $ENV{$_}||"", $matcher); + } + + if ($CPAN::Config->{ftp_proxy} || + $CPAN::Config->{http_proxy}) { + + $default = $CPAN::Config->{proxy_user} || $CPAN::LWP::UserAgent::USER || ""; + + $CPAN::Frontend->myprint($prompts{proxy_user}) unless $auto_config; + + if ($CPAN::Config->{proxy_user} = prompt("Your proxy user id?",$default)) { + $CPAN::Frontend->myprint($prompts{proxy_pass}) unless $auto_config; + + if ($CPAN::META->has_inst("Term::ReadKey")) { + Term::ReadKey::ReadMode("noecho"); + } else { + $CPAN::Frontend->myprint($prompts{password_warn}) unless $auto_config; + } + $CPAN::Config->{proxy_pass} = prompt_no_strip("Your proxy password?"); + if ($CPAN::META->has_inst("Term::ReadKey")) { + Term::ReadKey::ReadMode("restore"); + } + $CPAN::Frontend->myprint("\n\n") unless $auto_config; + } + } + } + + # + #= how plugins work + # + + # XXX MISSING: my_array_prompt to be used with plugins. We did something like this near + # git log -p fd68f8f5e33f4cecea4fdb7abc5ee19c12f138f0..test-notest-test-dependency + # Need to do similar steps for plugin_list. As long as we do not support it here, people + # must use the cpan shell prompt to write something like + # o conf plugin_list push CPAN::Plugin::Specfile=dir,/tmp/foo-20141013,... + # o conf commit + + # + #= how FTP works + # + + my_yn_prompt(ftp_passive => 1, $matcher); + + # + #= how cwd works + # + + my_prompt_loop(getcwd => 'cwd', $matcher, + 'cwd|getcwd|fastcwd|getdcwd|backtickcwd'); + + # + #= the CPAN shell itself (prompt, color) + # + + my_yn_prompt(commandnumber_in_prompt => 1, $matcher); + my_yn_prompt(term_ornaments => 1, $matcher); + if ("colorize_output colorize_print colorize_warn colorize_debug" =~ $matcher) { + my_yn_prompt(colorize_output => 0, $matcher); + if ($CPAN::Config->{colorize_output}) { + if ($CPAN::META->has_inst("Term::ANSIColor")) { + my $T="gYw"; + $CPAN::Frontend->myprint( " on_ on_y ". + " on_ma on_\n") unless $auto_config; + $CPAN::Frontend->myprint( " on_black on_red green ellow ". + "on_blue genta on_cyan white\n") unless $auto_config; + + for my $FG ("", "bold", + map {$_,"bold $_"} "black","red","green", + "yellow","blue", + "magenta", + "cyan","white") { + $CPAN::Frontend->myprint(sprintf( "%12s ", $FG)) unless $auto_config; + for my $BG ("",map {"on_$_"} qw(black red green yellow + blue magenta cyan white)) { + $CPAN::Frontend->myprint( $FG||$BG ? + Term::ANSIColor::colored(" $T ","$FG $BG") : " $T ") unless $auto_config; + } + $CPAN::Frontend->myprint( "\n" ) unless $auto_config; + } + $CPAN::Frontend->myprint( "\n" ) unless $auto_config; + } + for my $tuple ( + ["colorize_print", "bold blue on_white"], + ["colorize_warn", "bold red on_white"], + ["colorize_debug", "black on_cyan"], + ) { + my_dflt_prompt($tuple->[0] => $tuple->[1], $matcher); + if ($CPAN::META->has_inst("Term::ANSIColor")) { + eval { Term::ANSIColor::color($CPAN::Config->{$tuple->[0]})}; + if ($@) { + $CPAN::Config->{$tuple->[0]} = $tuple->[1]; + $CPAN::Frontend->mywarn($@."setting to default '$tuple->[1]'\n"); + } + } + } + } + } + + # + #== term_is_latin + # + + my_yn_prompt(term_is_latin => 1, $matcher); + + # + #== save history in file 'histfile' + # + + if (!$matcher or 'histfile histsize' =~ /$matcher/) { + $CPAN::Frontend->myprint($prompts{histfile_intro}) unless $auto_config; + defined($default = $CPAN::Config->{histfile}) or + $default = File::Spec->catfile($CPAN::Config->{cpan_home},"histfile"); + my_dflt_prompt(histfile => $default, $matcher); + + if ($CPAN::Config->{histfile}) { + defined($default = $CPAN::Config->{histsize}) or $default = 100; + my_dflt_prompt(histsize => $default, $matcher); + } + } + + # + #== do an ls on the m or the d command + # + my_yn_prompt(show_upload_date => 0, $matcher); + + # + #== verbosity at the end of the r command + # + if (!$matcher + or 'show_unparsable_versions' =~ /$matcher/ + or 'show_zero_versions' =~ /$matcher/ + ) { + my_yn_prompt(show_unparsable_versions => 0, $matcher); + my_yn_prompt(show_zero_versions => 0, $matcher); + } + + # + #= MIRRORED.BY and conf_sites() + # + + # Let's assume they want to use the internet and make them turn it + # off if they really don't. + my_yn_prompt("connect_to_internet_ok" => 1, $matcher); + + # Allow matching but don't show during manual config + if ($matcher) { + if ("urllist_ping_external" =~ $matcher) { + my_yn_prompt(urllist_ping_external => 0, $matcher); + } + if ("urllist_ping_verbose" =~ $matcher) { + my_yn_prompt(urllist_ping_verbose => 0, $matcher); + } + if ("randomize_urllist" =~ $matcher) { + my_dflt_prompt(randomize_urllist => 0, $matcher); + } + if ("ftpstats_size" =~ $matcher) { + my_dflt_prompt(ftpstats_size => 99, $matcher); + } + if ("ftpstats_period" =~ $matcher) { + my_dflt_prompt(ftpstats_period => 14, $matcher); + } + } + + $CPAN::Config->{urllist} ||= []; + + if ($auto_config) { + if(@{ $CPAN::Config->{urllist} }) { + $CPAN::Frontend->myprint( + "Your 'urllist' is already configured. Type 'o conf init urllist' to change it.\n" + ); + } + else { + $CPAN::Config->{urllist} = [ 'http://www.cpan.org/' ]; + } + } + elsif (!$matcher || "urllist" =~ $matcher) { + _do_pick_mirrors(); + } + + if ($auto_config) { + $CPAN::Frontend->myprint( + "\nAutoconfiguration complete.\n" + ); + $auto_config = 0; # reset + } + + # bootstrap local::lib now if requested + if ( $CPAN::Config->{install_help} eq 'local::lib' ) { + if ( ! @{ $CPAN::Config->{urllist} } ) { + $CPAN::Frontend->myprint( + "Skipping local::lib bootstrap because 'urllist' is not configured.\n" + ); + } + else { + $CPAN::Frontend->myprint("\nAttempting to bootstrap local::lib...\n"); + $CPAN::Frontend->myprint("\nWriting $configpm for bootstrap...\n"); + delete $CPAN::Config->{install_help}; # temporary only + CPAN::HandleConfig->commit; + my($dist, $locallib); + $locallib = CPAN::Shell->expand('Module', 'local::lib'); + if ( $locallib and $dist = $locallib->distribution ) { + # this is a hack to force bootstrapping + $dist->{prefs}{pl}{commandline} = "$^X Makefile.PL --bootstrap"; + # Set @INC for this process so we find things as they bootstrap + require lib; + lib->import(_local_lib_inc_path()); + eval { $dist->install }; + } + if ( ! $dist || (my $err = $@) ) { + $err ||= 'Could not locate local::lib in the CPAN index'; + $CPAN::Frontend->mywarn("Error bootstrapping local::lib: $@\n"); + $CPAN::Frontend->myprint("From the CPAN Shell, you might try 'look local::lib' and \n" + . "run 'perl Makefile --bootstrap' and see if that is successful. Then\n" + . "restart your CPAN client\n" + ); + } + else { + _local_lib_config(); + } + } + } + + # install_help is temporary for configuration and not saved + delete $CPAN::Config->{install_help}; + + $CPAN::Frontend->myprint("\n"); + if ($matcher && !$CPAN::Config->{auto_commit}) { + $CPAN::Frontend->myprint("Please remember to call 'o conf commit' to ". + "make the config permanent!\n"); + } else { + CPAN::HandleConfig->commit; + } + + if (! $matcher) { + $CPAN::Frontend->myprint( + "\nYou can re-run configuration any time with 'o conf init' in the CPAN shell\n" + ); + } + +} + +sub _local_lib_config { + # Set environment stuff for this process + require local::lib; + + # Tell user about environment vars to set + $CPAN::Frontend->myprint($prompts{local_lib_installed}); + local $ENV{SHELL} = $CPAN::Config->{shell} || $ENV{SHELL}; + my $shellvars = local::lib->environment_vars_string_for(_local_lib_path()); + $CPAN::Frontend->myprint($shellvars); + + # Set %ENV after getting string above + my %env = local::lib->build_environment_vars_for(_local_lib_path(), 1); + while ( my ($k, $v) = each %env ) { + $ENV{$k} = $v; + } + + # Offer to mangle the shell config + my $munged_rc; + if ( my $rc = _find_shell_config() ) { + local $auto_config = 0; # We *must* ask, even under autoconfig + local *_real_prompt; # We *must* show prompt + my $_conf = prompt( + "\nWould you like me to append that to $rc now?", "yes" + ); + if ($_conf =~ /^y/i) { + open my $fh, ">>", $rc; + print {$fh} "\n$shellvars"; + close $fh; + $munged_rc++; + } + } + + # Warn at exit time + if ($munged_rc) { + push @{$CPAN::META->_exit_messages}, << "HERE"; + +*** Remember to restart your shell before running cpan again *** +HERE + } + else { + push @{$CPAN::META->_exit_messages}, << "HERE"; + +*** Remember to add these environment variables to your shell config + and restart your shell before running cpan again *** + +$shellvars +HERE + } +} + +{ + my %shell_rc_map = ( + map { $_ => ".${_}rc" } qw/ bash tcsh csh /, + map { $_ => ".profile" } qw/dash ash sh/, + zsh => ".zshenv", + ); + + sub _find_shell_config { + my $shell = File::Basename::basename($CPAN::Config->{shell}); + if ( my $rc = $shell_rc_map{$shell} ) { + my $path = File::Spec->catfile($ENV{HOME}, $rc); + return $path if -w $path; + } + } +} + + +sub _local_lib_inc_path { + return File::Spec->catdir(_local_lib_path(), qw/lib perl5/); +} + +sub _local_lib_path { + return File::Spec->catdir(_local_lib_home(), 'perl5'); +} + +# Adapted from resolve_home_path() in local::lib -- this is where +# local::lib thinks the user's home is +{ + my $local_lib_home; + sub _local_lib_home { + $local_lib_home ||= File::Spec->rel2abs( do { + if ($CPAN::META->has_usable("File::HomeDir") && File::HomeDir->VERSION >= 0.65) { + File::HomeDir->my_home; + } elsif (defined $ENV{HOME}) { + $ENV{HOME}; + } else { + (getpwuid $<)[7] || "~"; + } + }); + } +} + +sub _do_pick_mirrors { + local *_real_prompt; + *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt; + $CPAN::Frontend->myprint($prompts{urls_intro}); + # Only prompt for auto-pick if Net::Ping is new enough to do timings + my $_conf = 'n'; + if ( $CPAN::META->has_usable("Net::Ping") && CPAN::Version->vgt(Net::Ping->VERSION, '2.13')) { + $_conf = prompt($prompts{auto_pick}, "yes"); + } else { + prompt("Autoselection disabled due to Net::Ping missing or insufficient. Please press ENTER"); + } + my @old_list = @{ $CPAN::Config->{urllist} }; + if ( $_conf =~ /^y/i ) { + conf_sites( auto_pick => 1 ) or bring_your_own(); + } + else { + _print_urllist('Current') if @old_list; + my $msg = scalar @old_list + ? "\nWould you like to edit the urllist or pick new mirrors from a list?" + : "\nWould you like to pick from the CPAN mirror list?" ; + my $_conf = prompt($msg, "yes"); + if ( $_conf =~ /^y/i ) { + conf_sites(); + } + bring_your_own(); + } + _print_urllist('New'); +} + +sub _init_external_progs { + my($matcher,$args) = @_; + my $PATH = $args->{path}; + my @external_progs = @{ $args->{progs} }; + my $shortcut = $args->{shortcut}; + my $showed_make_warning; + + if (!$matcher or "@external_progs" =~ /$matcher/) { + my $old_warn = $^W; + local $^W if $^O eq 'MacOS'; + local $^W = $old_warn; + my $progname; + for $progname (@external_progs) { + next if $matcher && $progname !~ /$matcher/; + if ($^O eq 'MacOS') { + $CPAN::Config->{$progname} = 'not_here'; + next; + } + + my $progcall = $progname; + unless ($matcher) { + # we really don't need ncftp if we have ncftpget, but + # if they chose this dialog via matcher, they shall have it + next if $progname eq "ncftp" && $CPAN::Config->{ncftpget} gt " "; + } + my $path = $CPAN::Config->{$progname} + || $Config::Config{$progname} + || ""; + if (File::Spec->file_name_is_absolute($path)) { + # testing existence is not good enough, some have these exe + # extensions + + # warn "Warning: configured $path does not exist\n" unless -e $path; + # $path = ""; + } elsif ($path =~ /^\s+$/) { + # preserve disabled programs + } else { + $path = ''; + } + unless ($path) { + # e.g. make -> nmake + $progcall = $Config::Config{$progname} if $Config::Config{$progname}; + } + + $path ||= find_exe($progcall,$PATH); + unless ($path) { # not -e $path, because find_exe already checked that + local $"=";"; + $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@$PATH]\n") unless $auto_config; + _beg_for_make(), $showed_make_warning++ if $progname eq "make"; + } + $prompts{$progname} = "Where is your $progname program?"; + $path = my_dflt_prompt($progname,$path,$matcher,1); # 1 => no strip spaces + my $disabling = $path =~ m/^\s*$/; + + # don't let them disable or misconfigure make without warning + if ( $progname eq "make" && ( $disabling || ! _check_found($path) ) ) { + if ( $disabling && $showed_make_warning ) { + next; + } + else { + _beg_for_make() unless $showed_make_warning++; + undef $CPAN::Config->{$progname}; + $CPAN::Frontend->mywarn("Press SPACE and ENTER to disable make (NOT RECOMMENDED)\n"); + redo; + } + } + elsif ( $disabling ) { + next; + } + elsif ( _check_found( $CPAN::Config->{$progname} ) ) { + last if $shortcut && !$matcher; + } + else { + undef $CPAN::Config->{$progname}; + $CPAN::Frontend->mywarn("Press SPACE and ENTER to disable $progname\n"); + redo; + } + } + } +} + +sub _check_found { + my ($prog) = @_; + if ( ! -f $prog ) { + $CPAN::Frontend->mywarn("Warning: '$prog' does not exist\n") + unless $auto_config; + return; + } + elsif ( ! -x $prog ) { + $CPAN::Frontend->mywarn("Warning: '$prog' is not executable\n") + unless $auto_config; + return; + } + return 1; +} + +sub _beg_for_make { + $CPAN::Frontend->mywarn(<<"HERE"); + +ALERT: 'make' is an essential tool for building perl Modules. +Please make sure you have 'make' (or some equivalent) working. + +HERE + if ($^O eq "MSWin32") { + $CPAN::Frontend->mywarn(<<"HERE"); +Windows users may want to follow this procedure when back in the CPAN shell: + + look YVES/scripts/alien_nmake.pl + perl alien_nmake.pl + +This will install nmake on your system which can be used as a 'make' +substitute. You can then revisit this dialog with + + o conf init make + +HERE + } +} + +sub init_cpan_home { + my($matcher) = @_; + if (!$matcher or 'cpan_home' =~ /$matcher/) { + my $cpan_home = + $CPAN::Config->{cpan_home} || CPAN::HandleConfig::cpan_home(); + if (-d $cpan_home) { + $CPAN::Frontend->myprint( + "\nI see you already have a directory\n" . + "\n$cpan_home\n" . + "Shall we use it as the general CPAN build and cache directory?\n\n" + ) unless $auto_config; + } else { + # no cpan-home, must prompt and get one + $CPAN::Frontend->myprint($prompts{cpan_home_where}) unless $auto_config; + } + + my $default = $cpan_home; + my $loop = 0; + my($last_ans,$ans); + $CPAN::Frontend->myprint(" <cpan_home>\n") unless $auto_config; + PROMPT: while ($ans = prompt("CPAN build and cache directory?",$default)) { + if (File::Spec->file_name_is_absolute($ans)) { + my @cpan_home = split /[\/\\]/, $ans; + DIR: for my $dir (@cpan_home) { + if ($dir =~ /^~/ and (!$last_ans or $ans ne $last_ans)) { + $CPAN::Frontend + ->mywarn("Warning: a tilde in the path will be ". + "taken as a literal tilde. Please ". + "confirm again if you want to keep it\n"); + $last_ans = $default = $ans; + next PROMPT; + } + } + } else { + require Cwd; + my $cwd = Cwd::cwd(); + my $absans = File::Spec->catdir($cwd,$ans); + $CPAN::Frontend->mywarn("The path '$ans' is not an ". + "absolute path. Please specify ". + "an absolute path\n"); + $default = $absans; + next PROMPT; + } + eval { File::Path::mkpath($ans); }; # dies if it can't + if ($@) { + $CPAN::Frontend->mywarn("Couldn't create directory $ans.\n". + "Please retry.\n"); + next PROMPT; + } + if (-d $ans && -w _) { + last PROMPT; + } else { + $CPAN::Frontend->mywarn("Couldn't find directory $ans\n". + "or directory is not writable. Please retry.\n"); + if (++$loop > 5) { + $CPAN::Frontend->mydie("Giving up"); + } + } + } + $CPAN::Config->{cpan_home} = $ans; + } +} + +sub my_dflt_prompt { + my ($item, $dflt, $m, $no_strip) = @_; + my $default = $CPAN::Config->{$item} || $dflt; + + if (!$auto_config && (!$m || $item =~ /$m/)) { + if (my $intro = $prompts{$item . "_intro"}) { + $CPAN::Frontend->myprint($intro); + } + $CPAN::Frontend->myprint(" <$item>\n"); + $CPAN::Config->{$item} = + $no_strip ? prompt_no_strip($prompts{$item}, $default) + : prompt( $prompts{$item}, $default); + } else { + $CPAN::Config->{$item} = $default; + } + return $CPAN::Config->{$item}; +} + +sub my_yn_prompt { + my ($item, $dflt, $m) = @_; + my $default; + defined($default = $CPAN::Config->{$item}) or $default = $dflt; + + if (!$auto_config && (!$m || $item =~ /$m/)) { + if (my $intro = $prompts{$item . "_intro"}) { + $CPAN::Frontend->myprint($intro); + } + $CPAN::Frontend->myprint(" <$item>\n"); + my $ans = prompt($prompts{$item}, $default ? 'yes' : 'no'); + $CPAN::Config->{$item} = ($ans =~ /^[y1]/i ? 1 : 0); + } else { + $CPAN::Config->{$item} = $default; + } +} + +sub my_prompt_loop { + my ($item, $dflt, $m, $ok) = @_; + my $default = $CPAN::Config->{$item} || $dflt; + my $ans; + + if (!$auto_config && (!$m || $item =~ /$m/)) { + my $intro = $prompts{$item . "_intro"}; + $CPAN::Frontend->myprint($intro) if defined $intro; + $CPAN::Frontend->myprint(" <$item>\n"); + do { $ans = prompt($prompts{$item}, $default); + } until $ans =~ /$ok/; + $CPAN::Config->{$item} = $ans; + } else { + $CPAN::Config->{$item} = $default; + } +} + + +# Here's the logic about the MIRRORED.BY file. There are a number of scenarios: +# (1) We have a cached MIRRORED.BY file +# (1a) We're auto-picking +# - Refresh it automatically if it's old +# (1b) Otherwise, ask if using cached is ok. If old, default to no. +# - If cached is not ok, get it from the Internet. If it succeeds we use +# the new file. Otherwise, we use the old file. +# (2) We don't have a copy at all +# (2a) If we are allowed to connect, we try to get a new copy. If it succeeds, +# we use it, otherwise, we warn about failure +# (2b) If we aren't allowed to connect, + +sub conf_sites { + my %args = @_; + # auto pick implies using the internet + $CPAN::Config->{connect_to_internet_ok} = 1 if $args{auto_pick}; + + my $m = 'MIRRORED.BY'; + my $mby = File::Spec->catfile($CPAN::Config->{keep_source_where},$m); + File::Path::mkpath(File::Basename::dirname($mby)); + # Why are we using MIRRORED.BY from the current directory? + # Is this for testing? -- dagolden, 2009-11-05 + if (-f $mby && -f $m && -M $m < -M $mby) { + require File::Copy; + File::Copy::copy($m,$mby) or die "Could not update $mby: $!"; + } + local $^T = time; + # if we have a cached copy is not older than 60 days, we either + # use it or refresh it or fall back to it if the refresh failed. + if ($mby && -f $mby && -s _ > 0 ) { + my $very_old = (-M $mby > 60); + my $mtime = localtime((stat _)[9]); + # if auto_pick, refresh anything old automatically + if ( $args{auto_pick} ) { + if ( $very_old ) { + $CPAN::Frontend->myprint(qq{Trying to refresh your mirror list\n}); + eval { CPAN::FTP->localize($m,$mby,3,1) } + or $CPAN::Frontend->myprint(qq{Refresh failed. Using the old cached copy instead.\n}); + $CPAN::Frontend->myprint("\n"); + } + } + else { + my $prompt = qq{Found a cached mirror list as of $mtime + +If you'd like to just use the cached copy, answer 'yes', below. +If you'd like an updated copy of the mirror list, answer 'no' and +I'll get a fresh one from the Internet. + +Shall I use the cached mirror list?}; + my $ans = prompt($prompt, $very_old ? "no" : "yes"); + if ($ans =~ /^n/i) { + $CPAN::Frontend->myprint(qq{Trying to refresh your mirror list\n}); + # you asked for it from the Internet + $CPAN::Config->{connect_to_internet_ok} = 1; + eval { CPAN::FTP->localize($m,$mby,3,1) } + or $CPAN::Frontend->myprint(qq{Refresh failed. Using the old cached copy instead.\n}); + $CPAN::Frontend->myprint("\n"); + } + } + } + # else there is no cached copy and we must fetch or fail + else { + # If they haven't agree to connect to the internet, ask again + if ( ! $CPAN::Config->{connect_to_internet_ok} ) { + my $prompt = q{You are missing a copy of the CPAN mirror list. + +May I connect to the Internet to get it?}; + my $ans = prompt($prompt, "yes"); + if ($ans =~ /^y/i) { + $CPAN::Config->{connect_to_internet_ok} = 1; + } + } + + # Now get it from the Internet or complain + if ( $CPAN::Config->{connect_to_internet_ok} ) { + $CPAN::Frontend->myprint(qq{Trying to fetch a mirror list from the Internet\n}); + eval { CPAN::FTP->localize($m,$mby,3,1) } + or $CPAN::Frontend->mywarn(<<'HERE'); +We failed to get a copy of the mirror list from the Internet. +You will need to provide CPAN mirror URLs yourself. +HERE + $CPAN::Frontend->myprint("\n"); + } + else { + $CPAN::Frontend->mywarn(<<'HERE'); +You will need to provide CPAN mirror URLs yourself or set +'o conf connect_to_internet_ok 1' and try again. +HERE + } + } + + # if we finally have a good local MIRRORED.BY, get on with picking + if (-f $mby && -s _ > 0){ + $CPAN::Config->{urllist} = + $args{auto_pick} ? auto_mirrored_by($mby) : choose_mirrored_by($mby); + return 1; + } + + return; +} + +sub find_exe { + my($exe,$path) = @_; + $path ||= [split /$Config{'path_sep'}/, $ENV{'PATH'}]; + my($dir); + #warn "in find_exe exe[$exe] path[@$path]"; + for $dir (@$path) { + my $abs = File::Spec->catfile($dir,$exe); + if (($abs = MM->maybe_command($abs))) { + return $abs; + } + } +} + +sub picklist { + my($items,$prompt,$default,$require_nonempty,$empty_warning)=@_; + CPAN->debug("picklist('$items','$prompt','$default','$require_nonempty',". + "'$empty_warning')") if $CPAN::DEBUG; + $default ||= ''; + + my $pos = 0; + + my @nums; + SELECTION: while (1) { + + # display, at most, 15 items at a time + my $limit = $#{ $items } - $pos; + $limit = 15 if $limit > 15; + + # show the next $limit items, get the new position + $pos = display_some($items, $limit, $pos, $default); + $pos = 0 if $pos >= @$items; + + my $num = prompt($prompt,$default); + + @nums = split (' ', $num); + { + my %seen; + @nums = grep { !$seen{$_}++ } @nums; + } + my $i = scalar @$items; + unrangify(\@nums); + if (0 == @nums) { + # cannot allow nothing because nothing means paging! + # return; + } elsif (grep (/\D/ || $_ < 1 || $_ > $i, @nums)) { + $CPAN::Frontend->mywarn("invalid items entered, try again\n"); + if ("@nums" =~ /\D/) { + $CPAN::Frontend->mywarn("(we are expecting only numbers between 1 and $i)\n"); + } + next SELECTION; + } + if ($require_nonempty && !@nums) { + $CPAN::Frontend->mywarn("$empty_warning\n"); + } + + # a blank line continues... + unless (@nums){ + $CPAN::Frontend->mysleep(0.1); # prevent hot spinning process on the next bug + next SELECTION; + } + last; + } + for (@nums) { $_-- } + @{$items}[@nums]; +} + +sub unrangify ($) { + my($nums) = $_[0]; + my @nums2 = (); + while (@{$nums||[]}) { + my $n = shift @$nums; + if ($n =~ /^(\d+)-(\d+)$/) { + my @range = $1 .. $2; + # warn "range[@range]"; + push @nums2, @range; + } else { + push @nums2, $n; + } + } + push @$nums, @nums2; +} + +sub display_some { + my ($items, $limit, $pos, $default) = @_; + $pos ||= 0; + + my @displayable = @$items[$pos .. ($pos + $limit)]; + for my $item (@displayable) { + $CPAN::Frontend->myprint(sprintf "(%d) %s\n", ++$pos, $item); + } + my $hit_what = $default ? "SPACE ENTER" : "ENTER"; + $CPAN::Frontend->myprint(sprintf("%d more items, hit %s to show them\n", + (@$items - $pos), + $hit_what, + )) + if $pos < @$items; + return $pos; +} + +sub auto_mirrored_by { + my $local = shift or return; + local $|=1; + $CPAN::Frontend->myprint("Looking for CPAN mirrors near you (please be patient)\n"); + my $mirrors = CPAN::Mirrors->new($local); + + my $cnt = 0; + my $callback_was_active = 0; + my @best = $mirrors->best_mirrors( + how_many => 3, + callback => sub { + $callback_was_active++; + $CPAN::Frontend->myprint("."); + if ($cnt++>60) { $cnt=0; $CPAN::Frontend->myprint("\n"); } + }, + $CPAN::Config->{urllist_ping_external} ? (external_ping => 1) : (), + $CPAN::Config->{urllist_ping_verbose} ? (verbose => 1) : (), + ); + + my $urllist = [ + map { $_->http } + grep { $_ && ref $_ && $_->can('http') } + @best + ]; + push @$urllist, grep { /^file:/ } @{$CPAN::Config->{urllist}}; + $CPAN::Frontend->myprint(" done!\n\n") if $callback_was_active; + + return $urllist +} + +sub choose_mirrored_by { + my $local = shift or return; + my ($default); + my $mirrors = CPAN::Mirrors->new($local); + my @previous_urls = @{$CPAN::Config->{urllist}}; + + $CPAN::Frontend->myprint($prompts{urls_picker_intro}); + + my (@cont, $cont, %cont, @countries, @urls, %seen); + my $no_previous_warn = + "Sorry! since you don't have any existing picks, you must make a\n" . + "geographic selection."; + my $offer_cont = [sort $mirrors->continents]; + if (@previous_urls) { + push @$offer_cont, "(edit previous picks)"; + $default = @$offer_cont; + } else { + # cannot allow nothing because nothing means paging! + # push @$offer_cont, "(none of the above)"; + } + @cont = picklist($offer_cont, + "Select your continent (or several nearby continents)", + $default, + ! @previous_urls, + $no_previous_warn); + # cannot allow nothing because nothing means paging! + # return unless @cont; + + foreach $cont (@cont) { + my @c = sort $mirrors->countries($cont); + @cont{@c} = map ($cont, 0..$#c); + @c = map ("$_ ($cont)", @c) if @cont > 1; + push (@countries, @c); + } + if (@previous_urls && @countries) { + push @countries, "(edit previous picks)"; + $default = @countries; + } + + if (@countries) { + @countries = picklist (\@countries, + "Select your country (or several nearby countries)", + $default, + ! @previous_urls, + $no_previous_warn); + %seen = map (($_ => 1), @previous_urls); + # hmmm, should take list of defaults from CPAN::Config->{'urllist'}... + foreach my $country (@countries) { + next if $country =~ /edit previous picks/; + (my $bare_country = $country) =~ s/ \(.*\)//; + my @u; + for my $m ( $mirrors->mirrors($bare_country) ) { + push @u, $m->ftp if $m->ftp; + push @u, $m->http if $m->http; + } + @u = grep (! $seen{$_}, @u); + @u = map ("$_ ($bare_country)", @u) + if @countries > 1; + push (@urls, sort @u); + } + } + push (@urls, map ("$_ (previous pick)", @previous_urls)); + my $prompt = "Select as many URLs as you like (by number), +put them on one line, separated by blanks, hyphenated ranges allowed + e.g. '1 4 5' or '7 1-4 8'"; + if (@previous_urls) { + $default = join (' ', ((scalar @urls) - (scalar @previous_urls) + 1) .. + (scalar @urls)); + $prompt .= "\n(or just hit ENTER to keep your previous picks)"; + } + + @urls = picklist (\@urls, $prompt, $default); + foreach (@urls) { s/ \(.*\)//; } + return [ @urls ]; +} + +sub bring_your_own { + my $urllist = [ @{$CPAN::Config->{urllist}} ]; + my %seen = map (($_ => 1), @$urllist); + my($ans,@urls); + my $eacnt = 0; # empty answers + $CPAN::Frontend->myprint(<<'HERE'); +Now you can enter your own CPAN URLs by hand. A local CPAN mirror can be +listed using a 'file:' URL like 'file:///path/to/cpan/' + +HERE + do { + my $prompt = "Enter another URL or ENTER to quit:"; + unless (%seen) { + $prompt = qq{CPAN.pm needs at least one URL where it can fetch CPAN files from. + +Please enter your CPAN site:}; + } + $ans = prompt ($prompt, ""); + + if ($ans) { + $ans =~ s|/?\z|/|; # has to end with one slash + # XXX This manipulation is odd. Shouldn't we check that $ans is + # a directory before converting to file:///? And we need /// below, + # too, don't we? -- dagolden, 2009-11-05 + $ans = "file:$ans" unless $ans =~ /:/; # without a scheme is a file: + if ($ans =~ /^\w+:\/./) { + push @urls, $ans unless $seen{$ans}++; + } else { + $CPAN::Frontend-> + myprint(sprintf(qq{"%s" doesn\'t look like an URL at first sight. +I\'ll ignore it for now. +You can add it to your %s +later if you\'re sure it\'s right.\n}, + $ans, + $INC{'CPAN/MyConfig.pm'} + || $INC{'CPAN/Config.pm'} + || "configuration file", + )); + } + } else { + if (++$eacnt >= 5) { + $CPAN::Frontend-> + mywarn("Giving up.\n"); + $CPAN::Frontend->mysleep(5); + return; + } + } + } while $ans || !%seen; + + @$urllist = CPAN::_uniq(@$urllist, @urls); + $CPAN::Config->{urllist} = $urllist; +} + +sub _print_urllist { + my ($which) = @_; + $CPAN::Frontend->myprint("$which urllist\n"); + for ( @{$CPAN::Config->{urllist} || []} ) { + $CPAN::Frontend->myprint(" $_\n") + }; +} + +sub _can_write_to_libdirs { + return -w $Config{installprivlib} + && -w $Config{installarchlib} + && -w $Config{installsitelib} + && -w $Config{installsitearch} +} + +sub _using_installbase { + return 1 if $ENV{PERL_MM_OPT} && $ENV{PERL_MM_OPT} =~ /install_base/i; + return 1 if grep { ($CPAN::Config->{$_}||q{}) =~ /install_base/i } + qw(makepl_arg make_install_arg mbuildpl_arg mbuild_install_arg); + return; +} + +sub _using_sudo { + return 1 if grep { ($CPAN::Config->{$_}||q{}) =~ /sudo/ } + qw(make_install_make_command mbuild_install_build_command); + return; +} + +sub _strip_spaces { + $_[0] =~ s/^\s+//; # no leading spaces + $_[0] =~ s/\s+\z//; # no trailing spaces +} + +sub prompt ($;$) { + unless (defined &_real_prompt) { + *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt; + } + my $ans = _real_prompt(@_); + + _strip_spaces($ans); + $CPAN::Frontend->myprint("\n") unless $auto_config; + + return $ans; +} + + +sub prompt_no_strip ($;$) { + unless (defined &_real_prompt) { + *_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt; + } + return _real_prompt(@_); +} + + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/HandleConfig.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/HandleConfig.pm new file mode 100644 index 0000000000000000000000000000000000000000..e24a969c11f1f126eb8d0417d17c0e6c215d5209 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/HandleConfig.pm @@ -0,0 +1,806 @@ +package CPAN::HandleConfig; +use strict; +use vars qw(%can %keys $loading $VERSION); +use File::Path (); +use File::Spec (); +use File::Basename (); +use Carp (); + +=head1 NAME + +CPAN::HandleConfig - internal configuration handling for CPAN.pm + +=cut + +$VERSION = "5.5011"; # see also CPAN::Config::VERSION at end of file + +%can = ( + commit => "Commit changes to disk", + defaults => "Reload defaults from disk", + help => "Short help about 'o conf' usage", + init => "Interactive setting of all options", +); + +# Q: where is the "How do I add a new config option" HOWTO? +# A1: svn diff -r 757:758 # where dagolden added test_report [git e997b71de88f1019a1472fc13cb97b1b7f96610f] +# A2: svn diff -r 985:986 # where andk added yaml_module [git 312b6d9b12b1bdec0b6e282d853482145475021f] +# A3: 1. add new config option to %keys below +# 2. add a Pod description in CPAN::FirstTime; it should include a +# prompt line; see others for examples +# 3. add a "matcher" section in CPAN::FirstTime::init that includes +# a prompt function; see others for examples +# 4. add config option to documentation section in CPAN.pm + +%keys = map { $_ => undef } + ( + "allow_installing_module_downgrades", + "allow_installing_outdated_dists", + "applypatch", + "auto_commit", + "build_cache", + "build_dir", + "build_dir_reuse", + "build_requires_install_policy", + "bzip2", + "cache_metadata", + "check_sigs", + "cleanup_after_install", + "colorize_debug", + "colorize_output", + "colorize_print", + "colorize_warn", + "commandnumber_in_prompt", + "commands_quote", + "connect_to_internet_ok", + "cpan_home", + "curl", + "dontload_hash", # deprecated after 1.83_68 (rev. 581) + "dontload_list", + "ftp", + "ftp_passive", + "ftp_proxy", + "ftpstats_size", + "ftpstats_period", + "getcwd", + "gpg", + "gzip", + "halt_on_failure", + "histfile", + "histsize", + "http_proxy", + "inactivity_timeout", + "index_expire", + "inhibit_startup_message", + "keep_source_where", + "load_module_verbosity", + "lynx", + "make", + "make_arg", + "make_install_arg", + "make_install_make_command", + "makepl_arg", + "mbuild_arg", + "mbuild_install_arg", + "mbuild_install_build_command", + "mbuildpl_arg", + "ncftp", + "ncftpget", + "no_proxy", + "pager", + "password", + "patch", + "patches_dir", + "perl5lib_verbosity", + "plugin_list", + "prefer_external_tar", + "prefer_installer", + "prefs_dir", + "prerequisites_policy", + "proxy_pass", + "proxy_user", + "randomize_urllist", + "recommends_policy", + "scan_cache", + "shell", + "show_unparsable_versions", + "show_upload_date", + "show_zero_versions", + "suggests_policy", + "tar", + "tar_verbosity", + "term_is_latin", + "term_ornaments", + "test_report", + "trust_test_report_history", + "unzip", + "urllist", + "urllist_ping_verbose", + "urllist_ping_external", + "use_prompt_default", + "use_sqlite", + "username", + "version_timeout", + "wait_list", + "wget", + "yaml_load_code", + "yaml_module", + ); + +my %prefssupport = map { $_ => 1 } + ( + "allow_installing_module_downgrades", + "allow_installing_outdated_dists", + "build_requires_install_policy", + "check_sigs", + "make", + "make_install_make_command", + "prefer_installer", + "test_report", + ); + +# returns true on successful action +sub edit { + my($self,@args) = @_; + return unless @args; + CPAN->debug("self[$self]args[".join(" | ",@args)."]"); + my($o,$str,$func,$args,$key_exists); + $o = shift @args; + if($can{$o}) { + my $success = $self->$o(args => \@args); # o conf init => sub init => sub load + unless ($success) { + die "Panic: could not configure CPAN.pm for args [@args]. Giving up."; + } + } else { + CPAN->debug("o[$o]") if $CPAN::DEBUG; + unless (exists $keys{$o}) { + $CPAN::Frontend->mywarn("Warning: unknown configuration variable '$o'\n"); + } + my $changed; + + + # one day I used randomize_urllist for a boolean, so we must + # list them explicitly --ak + if (0) { + } elsif ($o =~ /^(wait_list|urllist|dontload_list|plugin_list)$/) { + + # + # ARRAYS + # + + $func = shift @args; + $func ||= ""; + CPAN->debug("func[$func]args[@args]") if $CPAN::DEBUG; + # Let's avoid eval, it's easier to comprehend without. + if ($func eq "push") { + push @{$CPAN::Config->{$o}}, @args; + $changed = 1; + } elsif ($func eq "pop") { + pop @{$CPAN::Config->{$o}}; + $changed = 1; + } elsif ($func eq "shift") { + shift @{$CPAN::Config->{$o}}; + $changed = 1; + } elsif ($func eq "unshift") { + unshift @{$CPAN::Config->{$o}}, @args; + $changed = 1; + } elsif ($func eq "splice") { + my $offset = shift @args || 0; + my $length = shift @args || 0; + splice @{$CPAN::Config->{$o}}, $offset, $length, @args; # may warn + $changed = 1; + } elsif ($func) { + $CPAN::Config->{$o} = [$func, @args]; + $changed = 1; + } else { + $self->prettyprint($o); + } + if ($changed) { + if ($o eq "urllist") { + # reset the cached values + undef $CPAN::FTP::Thesite; + undef $CPAN::FTP::Themethod; + $CPAN::Index::LAST_TIME = 0; + } elsif ($o eq "dontload_list") { + # empty it, it will be built up again + $CPAN::META->{dontload_hash} = {}; + } + } + } elsif ($o =~ /_hash$/) { + + # + # HASHES + # + + if (@args==1 && $args[0] eq "") { + @args = (); + } elsif (@args % 2) { + push @args, ""; + } + $CPAN::Config->{$o} = { @args }; + $changed = 1; + } else { + + # + # SCALARS + # + + if (defined $args[0]) { + $CPAN::CONFIG_DIRTY = 1; + $CPAN::Config->{$o} = $args[0]; + $changed = 1; + } + $self->prettyprint($o) + if exists $keys{$o} or defined $CPAN::Config->{$o}; + } + if ($changed) { + if ($CPAN::Config->{auto_commit}) { + $self->commit; + } else { + $CPAN::CONFIG_DIRTY = 1; + $CPAN::Frontend->myprint("Please use 'o conf commit' to ". + "make the config permanent!\n\n"); + } + } + } +} + +sub prettyprint { + my($self,$k) = @_; + my $v = $CPAN::Config->{$k}; + if (ref $v) { + my(@report); + if (ref $v eq "ARRAY") { + @report = map {"\t$_ \[$v->[$_]]\n"} 0..$#$v; + } else { + @report = map + { + sprintf "\t%-18s => %s\n", + "[$_]", + defined $v->{$_} ? "[$v->{$_}]" : "undef" + } sort keys %$v; + } + $CPAN::Frontend->myprint( + join( + "", + sprintf( + " %-18s\n", + $k + ), + @report + ) + ); + } elsif (defined $v) { + $CPAN::Frontend->myprint(sprintf " %-18s [%s]\n", $k, $v); + } else { + $CPAN::Frontend->myprint(sprintf " %-18s undef\n", $k); + } +} + +# generally, this should be called without arguments so that the currently +# loaded config file is where changes are committed. +sub commit { + my($self,@args) = @_; + CPAN->debug("args[@args]") if $CPAN::DEBUG; + if ($CPAN::RUN_DEGRADED) { + $CPAN::Frontend->mydie( + "'o conf commit' disabled in ". + "degraded mode. Maybe try\n". + " !undef \$CPAN::RUN_DEGRADED\n" + ); + } + my ($configpm, $must_reload); + + # XXX does anything do this? can it be simplified? -- dagolden, 2011-01-19 + if (@args) { + if ($args[0] eq "args") { + # we have not signed that contract + } else { + $configpm = $args[0]; + } + } + + # use provided name or the current config or create a new MyConfig + $configpm ||= require_myconfig_or_config() || make_new_config(); + + # commit to MyConfig if we can't write to Config + if ( ! -w $configpm && $configpm =~ m{CPAN/Config\.pm} ) { + my $myconfig = _new_config_name(); + $CPAN::Frontend->mywarn( + "Your $configpm file\n". + "is not writable. I will attempt to write your configuration to\n" . + "$myconfig instead.\n\n" + ); + $configpm = make_new_config(); + $must_reload++; # so it gets loaded as $INC{'CPAN/MyConfig.pm'} + } + + # XXX why not just "-w $configpm"? -- dagolden, 2011-01-19 + my($mode); + if (-f $configpm) { + $mode = (stat $configpm)[2]; + if ($mode && ! -w _) { + _die_cant_write_config($configpm); + } + } + + $self->_write_config_file($configpm); + require_myconfig_or_config() if $must_reload; + + #$mode = 0444 | ( $mode & 0111 ? 0111 : 0 ); + #chmod $mode, $configpm; +###why was that so? $self->defaults; + $CPAN::Frontend->myprint("commit: wrote '$configpm'\n"); + $CPAN::CONFIG_DIRTY = 0; + 1; +} + +sub _write_config_file { + my ($self, $configpm) = @_; + my $msg; + $msg = <<EOF if $configpm =~ m{CPAN/Config\.pm}; + +# This is CPAN.pm's systemwide configuration file. This file provides +# defaults for users, and the values can be changed in a per-user +# configuration file. + +EOF + $msg ||= "\n"; + my($fh) = FileHandle->new; + rename $configpm, "$configpm~" if -f $configpm; + open $fh, ">$configpm" or + $CPAN::Frontend->mydie("Couldn't open >$configpm: $!"); + $fh->print(qq[$msg\$CPAN::Config = \{\n]); + foreach (sort keys %$CPAN::Config) { + unless (exists $keys{$_}) { + # do not drop them: forward compatibility! + $CPAN::Frontend->mywarn("Unknown config variable '$_'\n"); + next; + } + $fh->print( + " '$_' => ", + $self->neatvalue($CPAN::Config->{$_}), + ",\n" + ); + } + $fh->print("};\n1;\n__END__\n"); + close $fh; + + return; +} + + +# stolen from MakeMaker; not taking the original because it is buggy; +# bugreport will have to say: keys of hashes remain unquoted and can +# produce syntax errors +sub neatvalue { + my($self, $v) = @_; + return "undef" unless defined $v; + my($t) = ref $v; + unless ($t) { + $v =~ s/\\/\\\\/g; + return "q[$v]"; + } + if ($t eq 'ARRAY') { + my(@m, @neat); + push @m, "["; + foreach my $elem (@$v) { + push @neat, "q[$elem]"; + } + push @m, join ", ", @neat; + push @m, "]"; + return join "", @m; + } + return "$v" unless $t eq 'HASH'; + my @m; + foreach my $key (sort keys %$v) { + my $val = $v->{$key}; + push(@m,"q[$key]=>".$self->neatvalue($val)) ; + } + return "{ ".join(', ',@m)." }"; +} + +sub defaults { + my($self) = @_; + if ($CPAN::RUN_DEGRADED) { + $CPAN::Frontend->mydie( + "'o conf defaults' disabled in ". + "degraded mode. Maybe try\n". + " !undef \$CPAN::RUN_DEGRADED\n" + ); + } + my $done; + for my $config (qw(CPAN/MyConfig.pm CPAN/Config.pm)) { + if ($INC{$config}) { + CPAN->debug("INC{'$config'}[$INC{$config}]") if $CPAN::DEBUG; + CPAN::Shell->_reload_this($config,{reloforce => 1}); + $CPAN::Frontend->myprint("'$INC{$config}' reread\n"); + last; + } + } + $CPAN::CONFIG_DIRTY = 0; + 1; +} + +=head2 C<< CLASS->safe_quote ITEM >> + +Quotes an item to become safe against spaces +in shell interpolation. An item is enclosed +in double quotes if: + + - the item contains spaces in the middle + - the item does not start with a quote + +This happens to avoid shell interpolation +problems when whitespace is present in +directory names. + +This method uses C<commands_quote> to determine +the correct quote. If C<commands_quote> is +a space, no quoting will take place. + + +if it starts and ends with the same quote character: leave it as it is + +if it contains no whitespace: leave it as it is + +if it contains whitespace, then + +if it contains quotes: better leave it as it is + +else: quote it with the correct quote type for the box we're on + +=cut + +{ + # Instead of patching the guess, set commands_quote + # to the right value + my ($quotes,$use_quote) + = $^O eq 'MSWin32' + ? ('"', '"') + : (q{"'}, "'") + ; + + sub safe_quote { + my ($self, $command) = @_; + # Set up quote/default quote + my $quote = $CPAN::Config->{commands_quote} || $quotes; + + if ($quote ne ' ' + and defined($command ) + and $command =~ /\s/ + and $command !~ /[$quote]/) { + return qq<$use_quote$command$use_quote> + } + return $command; + } +} + +sub init { + my($self,@args) = @_; + CPAN->debug("self[$self]args[".join(",",@args)."]"); + $self->load(do_init => 1, @args); + 1; +} + +# Loads CPAN::MyConfig or fall-back to CPAN::Config. Will not reload a file +# if already loaded. Returns the path to the file %INC or else the empty string +# +# Note -- if CPAN::Config were loaded and CPAN::MyConfig subsequently +# created, calling this again will leave *both* in %INC + +sub require_myconfig_or_config () { + if ( $INC{"CPAN/MyConfig.pm"} || _try_loading("CPAN::MyConfig", cpan_home())) { + return $INC{"CPAN/MyConfig.pm"}; + } + elsif ( $INC{"CPAN/Config.pm"} || _try_loading("CPAN::Config") ) { + return $INC{"CPAN/Config.pm"}; + } + else { + return q{}; + } +} + +# Load a module, but ignore "can't locate..." errors +# Optionally take a list of directories to add to @INC for the load +sub _try_loading { + my ($module, @dirs) = @_; + (my $file = $module) =~ s{::}{/}g; + $file .= ".pm"; + + local @INC = @INC; + for my $dir ( @dirs ) { + if ( -f File::Spec->catfile($dir, $file) ) { + unshift @INC, $dir; + last; + } + } + + eval { require $file }; + my $err_myconfig = $@; + if ($err_myconfig and $err_myconfig !~ m#locate \Q$file\E#) { + die "Error while requiring ${module}:\n$err_myconfig"; + } + return $INC{$file}; +} + +# prioritized list of possible places for finding "CPAN/MyConfig.pm" +sub cpan_home_dir_candidates { + my @dirs; + my $old_v = $CPAN::Config->{load_module_verbosity}; + $CPAN::Config->{load_module_verbosity} = q[none]; + if ($CPAN::META->has_usable('File::HomeDir')) { + if ($^O ne 'darwin') { + push @dirs, File::HomeDir->my_data; + # my_data is ~/Library/Application Support on darwin, + # which causes issues in the toolchain. + } + push @dirs, File::HomeDir->my_home; + } + # Windows might not have HOME, so check it first + push @dirs, $ENV{HOME} if $ENV{HOME}; + # Windows might have these instead + push( @dirs, File::Spec->catpath($ENV{HOMEDRIVE}, $ENV{HOMEPATH}, '') ) + if $ENV{HOMEDRIVE} && $ENV{HOMEPATH}; + push @dirs, $ENV{USERPROFILE} if $ENV{USERPROFILE}; + + $CPAN::Config->{load_module_verbosity} = $old_v; + my $dotcpan = $^O eq 'VMS' ? '_cpan' : '.cpan'; + @dirs = map { File::Spec->catdir($_, $dotcpan) } grep { defined } @dirs; + return wantarray ? @dirs : $dirs[0]; +} + +sub load { + my($self, %args) = @_; + $CPAN::Be_Silent+=0; # protect against 'used only once' + $CPAN::Be_Silent++ if $args{be_silent}; # do not use; planned to be removed in 2011 + my $do_init = delete $args{do_init} || 0; + my $make_myconfig = delete $args{make_myconfig}; + $loading = 0 unless defined $loading; + + my $configpm = require_myconfig_or_config; + my @miss = $self->missing_config_data; + CPAN->debug("do_init[$do_init]loading[$loading]miss[@miss]") if $CPAN::DEBUG; + return unless $do_init || @miss; + + # I'm not how we'd ever wind up in a recursive loop, but I'm leaving + # this here for safety's sake -- dagolden, 2011-01-19 + return if $loading; + local $loading = ($loading||0) + 1; + + # Warn if we have a config file, but things were found missing + if ($configpm && @miss && !$do_init) { + if ($make_myconfig || ( ! -w $configpm && $configpm =~ m{CPAN/Config\.pm})) { + $configpm = make_new_config(); + $CPAN::Frontend->myprint(<<END); +The system CPAN configuration file has provided some default values, +but you need to complete the configuration dialog for CPAN.pm. +Configuration will be written to + <<$configpm>> +END + } + else { + $CPAN::Frontend->myprint(<<END); +Sorry, we have to rerun the configuration dialog for CPAN.pm due to +some missing parameters. Configuration will be written to + <<$configpm>> + +END + } + } + + require CPAN::FirstTime; + return CPAN::FirstTime::init($configpm || make_new_config(), %args); +} + +# Creates a new, empty config file at the preferred location +# Any existing will be renamed with a ".bak" suffix if possible +# If the file cannot be created, an exception is thrown +sub make_new_config { + my $configpm = _new_config_name(); + my $configpmdir = File::Basename::dirname( $configpm ); + File::Path::mkpath($configpmdir) unless -d $configpmdir; + + if ( -w $configpmdir ) { + #_#_# following code dumped core on me with 5.003_11, a.k. + if( -f $configpm ) { + my $configpm_bak = "$configpm.bak"; + unlink $configpm_bak if -f $configpm_bak; + if( rename $configpm, $configpm_bak ) { + $CPAN::Frontend->mywarn(<<END); +Old configuration file $configpm + moved to $configpm_bak +END + } + } + my $fh = FileHandle->new; + if ($fh->open(">$configpm")) { + $fh->print("1;\n"); + return $configpm; + } + } + _die_cant_write_config($configpm); +} + +sub _die_cant_write_config { + my ($configpm) = @_; + $CPAN::Frontend->mydie(<<"END"); +WARNING: CPAN.pm is unable to write a configuration file. You +must be able to create and write to '$configpm'. + +Aborting configuration. +END + +} + +# From candidate directories, we would like (in descending preference order): +# * the one that contains a MyConfig file +# * one that exists (even without MyConfig) +# * the first one on the list +sub cpan_home { + my @dirs = cpan_home_dir_candidates(); + for my $d (@dirs) { + return $d if -f "$d/CPAN/MyConfig.pm"; + } + for my $d (@dirs) { + return $d if -d $d; + } + return $dirs[0]; +} + +sub _new_config_name { + return File::Spec->catfile(cpan_home(), 'CPAN', 'MyConfig.pm'); +} + +# returns mandatory but missing entries in the Config +sub missing_config_data { + my(@miss); + for ( + "auto_commit", + "build_cache", + "build_dir", + "cache_metadata", + "cpan_home", + "ftp_proxy", + #"gzip", + "http_proxy", + "index_expire", + #"inhibit_startup_message", + "keep_source_where", + #"make", + "make_arg", + "make_install_arg", + "makepl_arg", + "mbuild_arg", + "mbuild_install_arg", + ($^O eq "MSWin32" ? "" : "mbuild_install_build_command"), + "mbuildpl_arg", + "no_proxy", + #"pager", + "prerequisites_policy", + "scan_cache", + #"tar", + #"unzip", + "urllist", + ) { + next unless exists $keys{$_}; + push @miss, $_ unless defined $CPAN::Config->{$_}; + } + return @miss; +} + +sub help { + $CPAN::Frontend->myprint(q[ +Known options: + commit commit session changes to disk + defaults reload default config values from disk + help this help + init enter a dialog to set all or a set of parameters + +Edit key values as in the following (the "o" is a literal letter o): + o conf build_cache 15 + o conf build_dir "/foo/bar" + o conf urllist shift + o conf urllist unshift ftp://ftp.foo.bar/ + o conf inhibit_startup_message 1 + +]); + 1; #don't reprint CPAN::Config +} + +sub cpl { + my($word,$line,$pos) = @_; + $word ||= ""; + CPAN->debug("word[$word] line[$line] pos[$pos]") if $CPAN::DEBUG; + my(@words) = split " ", substr($line,0,$pos+1); + if ( + defined($words[2]) + and + $words[2] =~ /list$/ + and + ( + @words == 3 + || + @words == 4 && length($word) + ) + ) { + return grep /^\Q$word\E/, qw(splice shift unshift pop push); + } elsif (defined($words[2]) + and + $words[2] eq "init" + and + ( + @words == 3 + || + @words >= 4 && length($word) + )) { + return sort grep /^\Q$word\E/, keys %keys; + } elsif (@words >= 4) { + return (); + } + my %seen; + my(@o_conf) = sort grep { !$seen{$_}++ } + keys %can, + keys %$CPAN::Config, + keys %keys; + return grep /^\Q$word\E/, @o_conf; +} + +sub prefs_lookup { + my($self,$distro,$what) = @_; + + if ($prefssupport{$what}) { + return $CPAN::Config->{$what} unless + $distro + and $distro->prefs + and $distro->prefs->{cpanconfig} + and defined $distro->prefs->{cpanconfig}{$what}; + return $distro->prefs->{cpanconfig}{$what}; + } else { + $CPAN::Frontend->mywarn("Warning: $what not yet officially ". + "supported for distroprefs, doing a normal lookup\n"); + return $CPAN::Config->{$what}; + } +} + + +{ + package + CPAN::Config; ####::###### #hide from indexer + # note: J. Nick Koston wrote me that they are using + # CPAN::Config->commit although undocumented. I suggested + # CPAN::Shell->o("conf","commit") even when ugly it is at least + # documented + + # that's why I added the CPAN::Config class with autoload and + # deprecated warning + + use strict; + use vars qw($AUTOLOAD $VERSION); + $VERSION = "5.5011"; + + # formerly CPAN::HandleConfig was known as CPAN::Config + sub AUTOLOAD { ## no critic + my $class = shift; # e.g. in dh-make-perl: CPAN::Config + my($l) = $AUTOLOAD; + $CPAN::Frontend->mywarn("Dispatching deprecated method '$l' to CPAN::HandleConfig\n"); + $l =~ s/.*:://; + CPAN::HandleConfig->$l(@_); + } +} + +1; + +__END__ + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# End: +# vim: ts=4 sts=4 sw=4: diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Index.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Index.pm new file mode 100644 index 0000000000000000000000000000000000000000..59e75dcaeed9410c0d31fcf2adbad049abbe1f68 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Index.pm @@ -0,0 +1,626 @@ +package CPAN::Index; +use strict; +use vars qw($LAST_TIME $DATE_OF_02 $DATE_OF_03 $HAVE_REANIMATED $VERSION); +$VERSION = "2.12"; +@CPAN::Index::ISA = qw(CPAN::Debug); +$LAST_TIME ||= 0; +$DATE_OF_03 ||= 0; +# use constant PROTOCOL => "2.0"; # commented out to avoid warning on upgrade from 1.57 +sub PROTOCOL { 2.0 } + +#-> sub CPAN::Index::force_reload ; +sub force_reload { + my($class) = @_; + $CPAN::Index::LAST_TIME = 0; + $class->reload(1); +} + +my @indexbundle = + ( + { + reader => "rd_authindex", + dir => "authors", + remotefile => '01mailrc.txt.gz', + shortlocalfile => '01mailrc.gz', + }, + { + reader => "rd_modpacks", + dir => "modules", + remotefile => '02packages.details.txt.gz', + shortlocalfile => '02packag.gz', + }, + { + reader => "rd_modlist", + dir => "modules", + remotefile => '03modlist.data.gz', + shortlocalfile => '03mlist.gz', + }, + ); + +#-> sub CPAN::Index::reload ; +sub reload { + my($self,$force) = @_; + my $time = time; + + # XXX check if a newer one is available. (We currently read it + # from time to time) + for ($CPAN::Config->{index_expire}) { + $_ = 0.001 unless $_ && $_ > 0.001; + } + unless (1 || $CPAN::Have_warned->{readmetadatacache}++) { + # debug here when CPAN doesn't seem to read the Metadata + require Carp; + Carp::cluck("META-PROTOCOL[$CPAN::META->{PROTOCOL}]"); + } + unless ($CPAN::META->{PROTOCOL}) { + $self->read_metadata_cache; + $CPAN::META->{PROTOCOL} ||= "1.0"; + } + if ( $CPAN::META->{PROTOCOL} < PROTOCOL ) { + # warn "Setting last_time to 0"; + $LAST_TIME = 0; # No warning necessary + } + if ($LAST_TIME + $CPAN::Config->{index_expire}*86400 > $time + and ! $force) { + # called too often + # CPAN->debug("LAST_TIME[$LAST_TIME]index_expire[$CPAN::Config->{index_expire}]time[$time]"); + } elsif (0) { + # IFF we are developing, it helps to wipe out the memory + # between reloads, otherwise it is not what a user expects. + undef $CPAN::META; # Neue Gruendlichkeit since v1.52(r1.274) + $CPAN::META = CPAN->new; + } else { + my($debug,$t2); + local $LAST_TIME = $time; + local $CPAN::META->{PROTOCOL} = PROTOCOL; + + my $needshort = $^O eq "dos"; + + INX: for my $indexbundle (@indexbundle) { + my $reader = $indexbundle->{reader}; + my $localfile = $needshort ? $indexbundle->{shortlocalfile} : $indexbundle->{remotefile}; + my $localpath = File::Spec->catfile($indexbundle->{dir}, $localfile); + my $remote = join "/", $indexbundle->{dir}, $indexbundle->{remotefile}; + my $localized = $self->reload_x($remote, $localpath, $force); + $self->$reader($localized); # may die but we let the shell catch it + if ($CPAN::DEBUG){ + $t2 = time; + $debug = "timing reading 01[".($t2 - $time)."]"; + $time = $t2; + } + return if $CPAN::Signal; # this is sometimes lengthy + } + $self->write_metadata_cache; + if ($CPAN::DEBUG){ + $t2 = time; + $debug .= "03[".($t2 - $time)."]"; + $time = $t2; + } + CPAN->debug($debug) if $CPAN::DEBUG; + } + if ($CPAN::Config->{build_dir_reuse}) { + $self->reanimate_build_dir; + } + if (CPAN::_sqlite_running()) { + $CPAN::SQLite->reload(time => $time, force => $force) + if not $LAST_TIME; + } + $LAST_TIME = $time; + $CPAN::META->{PROTOCOL} = PROTOCOL; +} + +#-> sub CPAN::Index::reanimate_build_dir ; +sub reanimate_build_dir { + my($self) = @_; + unless ($CPAN::META->has_inst($CPAN::Config->{yaml_module}||"YAML")) { + return; + } + return if $HAVE_REANIMATED++; + my $d = $CPAN::Config->{build_dir}; + my $dh = DirHandle->new; + opendir $dh, $d or return; # does not exist + my $dirent; + my $i = 0; + my $painted = 0; + my $restored = 0; + my $start = CPAN::FTP::_mytime(); + my @candidates = map { $_->[0] } + sort { $b->[1] <=> $a->[1] } + map { [ $_, -M File::Spec->catfile($d,$_) ] } + grep {/(.+)\.yml$/ && -d File::Spec->catfile($d,$1)} readdir $dh; + if ( @candidates ) { + $CPAN::Frontend->myprint + (sprintf("Reading %d yaml file%s from %s/\n", + scalar @candidates, + @candidates==1 ? "" : "s", + $CPAN::Config->{build_dir} + )); + DISTRO: for $i (0..$#candidates) { + my $dirent = $candidates[$i]; + my $y = eval {CPAN->_yaml_loadfile(File::Spec->catfile($d,$dirent))}; + if ($@) { + warn "Error while parsing file '$dirent'; error: '$@'"; + next DISTRO; + } + my $c = $y->[0]; + if ($c && $c->{perl} && $c->{distribution} && CPAN->_perl_fingerprint($c->{perl})) { + my $key = $c->{distribution}{ID}; + for my $k (keys %{$c->{distribution}}) { + if ($c->{distribution}{$k} + && ref $c->{distribution}{$k} + && UNIVERSAL::isa($c->{distribution}{$k},"CPAN::Distrostatus")) { + $c->{distribution}{$k}{COMMANDID} = $i - @candidates; + } + } + + #we tried to restore only if element already + #exists; but then we do not work with metadata + #turned off. + my $do + = $CPAN::META->{readwrite}{'CPAN::Distribution'}{$key} + = $c->{distribution}; + for my $skipper (qw( + badtestcnt + configure_requires_later + configure_requires_later_for + force_update + later + later_for + notest + should_report + sponsored_mods + prefs + negative_prefs_cache + )) { + delete $do->{$skipper}; + } + if ($do->can("tested_ok_but_not_installed")) { + if ($do->tested_ok_but_not_installed) { + $CPAN::META->is_tested($do->{build_dir},$do->{make_test}{TIME}); + } else { + next DISTRO; + } + } + $restored++; + } + $i++; + while (($painted/76) < ($i/@candidates)) { + $CPAN::Frontend->myprint("."); + $painted++; + } + } + } + else { + $CPAN::Frontend->myprint("Build_dir empty, nothing to restore\n"); + } + my $took = CPAN::FTP::_mytime() - $start; + $CPAN::Frontend->myprint(sprintf( + "DONE\nRestored the state of %s (in %.4f secs)\n", + $restored || "none", + $took, + )); +} + + +#-> sub CPAN::Index::reload_x ; +sub reload_x { + my($cl,$wanted,$localname,$force) = @_; + $force |= 2; # means we're dealing with an index here + CPAN::HandleConfig->load; # we should guarantee loading wherever + # we rely on Config XXX + $localname ||= $wanted; + my $abs_wanted = File::Spec->catfile($CPAN::Config->{'keep_source_where'}, + $localname); + if ( + -f $abs_wanted && + -M $abs_wanted < $CPAN::Config->{'index_expire'} && + !($force & 1) + ) { + my $s = $CPAN::Config->{'index_expire'} == 1 ? "" : "s"; + $cl->debug(qq{$abs_wanted younger than $CPAN::Config->{'index_expire'} }. + qq{day$s. I\'ll use that.}); + return $abs_wanted; + } else { + $force |= 1; # means we're quite serious about it. + } + return CPAN::FTP->localize($wanted,$abs_wanted,$force); +} + +#-> sub CPAN::Index::rd_authindex ; +sub rd_authindex { + my($cl, $index_target) = @_; + return unless defined $index_target; + return if CPAN::_sqlite_running(); + my @lines; + $CPAN::Frontend->myprint("Reading '$index_target'\n"); + local(*FH); + tie *FH, 'CPAN::Tarzip', $index_target; + local($/) = "\n"; + local($_); + push @lines, split /\012/ while <FH>; + my $i = 0; + my $painted = 0; + foreach (@lines) { + my($userid,$fullname,$email) = + m/alias\s+(\S+)\s+\"([^\"\<]*)\s+\<(.*)\>\"/; + $fullname ||= $email; + if ($userid && $fullname && $email) { + my $userobj = $CPAN::META->instance('CPAN::Author',$userid); + $userobj->set('FULLNAME' => $fullname, 'EMAIL' => $email); + } else { + CPAN->debug(sprintf "line[%s]", $_) if $CPAN::DEBUG; + } + $i++; + while (($painted/76) < ($i/@lines)) { + $CPAN::Frontend->myprint("."); + $painted++; + } + return if $CPAN::Signal; + } + $CPAN::Frontend->myprint("DONE\n"); +} + +sub userid { + my($self,$dist) = @_; + $dist = $self->{'id'} unless defined $dist; + my($ret) = $dist =~ m|(?:\w/\w\w/)?([^/]+)/|; + $ret; +} + +#-> sub CPAN::Index::rd_modpacks ; +sub rd_modpacks { + my($self, $index_target) = @_; + return unless defined $index_target; + return if CPAN::_sqlite_running(); + $CPAN::Frontend->myprint("Reading '$index_target'\n"); + my $fh = CPAN::Tarzip->TIEHANDLE($index_target); + local $_; + CPAN->debug(sprintf "start[%d]", time) if $CPAN::DEBUG; + my $slurp = ""; + my $chunk; + while (my $bytes = $fh->READ(\$chunk,8192)) { + $slurp.=$chunk; + } + my @lines = split /\012/, $slurp; + CPAN->debug(sprintf "end[%d]", time) if $CPAN::DEBUG; + undef $fh; + # read header + my($line_count,$last_updated); + while (@lines) { + my $shift = shift(@lines); + last if $shift =~ /^\s*$/; + $shift =~ /^Line-Count:\s+(\d+)/ and $line_count = $1; + $shift =~ /^Last-Updated:\s+(.+)/ and $last_updated = $1; + } + CPAN->debug("line_count[$line_count]last_updated[$last_updated]") if $CPAN::DEBUG; + my $errors = 0; + if (not defined $line_count) { + + $CPAN::Frontend->mywarn(qq{Warning: Your $index_target does not contain a Line-Count header. +Please check the validity of the index file by comparing it to more +than one CPAN mirror. I'll continue but problems seem likely to +happen.\a +}); + $errors++; + $CPAN::Frontend->mysleep(5); + } elsif ($line_count != scalar @lines) { + + $CPAN::Frontend->mywarn(sprintf qq{Warning: Your %s +contains a Line-Count header of %d but I see %d lines there. Please +check the validity of the index file by comparing it to more than one +CPAN mirror. I'll continue but problems seem likely to happen.\a\n}, +$index_target, $line_count, scalar(@lines)); + + } + if (not defined $last_updated) { + + $CPAN::Frontend->mywarn(qq{Warning: Your $index_target does not contain a Last-Updated header. +Please check the validity of the index file by comparing it to more +than one CPAN mirror. I'll continue but problems seem likely to +happen.\a +}); + $errors++; + $CPAN::Frontend->mysleep(5); + } else { + + $CPAN::Frontend + ->myprint(sprintf qq{ Database was generated on %s\n}, + $last_updated); + $DATE_OF_02 = $last_updated; + + my $age = time; + if ($CPAN::META->has_inst('HTTP::Date')) { + require HTTP::Date; + $age -= HTTP::Date::str2time($last_updated); + } else { + $CPAN::Frontend->mywarn(" HTTP::Date not available\n"); + require Time::Local; + my(@d) = $last_updated =~ / (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) /; + $d[1] = index("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", $d[1])/4; + $age -= $d[1]>=0 ? Time::Local::timegm(@d[5,4,3,0,1,2]) : 0; + } + $age /= 3600*24; + if ($age > 30) { + + $CPAN::Frontend + ->mywarn(sprintf + qq{Warning: This index file is %d days old. + Please check the host you chose as your CPAN mirror for staleness. + I'll continue but problems seem likely to happen.\a\n}, + $age); + + } elsif ($age < -1) { + + $CPAN::Frontend + ->mywarn(sprintf + qq{Warning: Your system date is %d days behind this index file! + System time: %s + Timestamp index file: %s + Please fix your system time, problems with the make command expected.\n}, + -$age, + scalar gmtime, + $DATE_OF_02, + ); + + } + } + + + # A necessity since we have metadata_cache: delete what isn't + # there anymore + my $secondtime = $CPAN::META->exists("CPAN::Module","CPAN"); + CPAN->debug("secondtime[$secondtime]") if $CPAN::DEBUG; + my(%exists); + my $i = 0; + my $painted = 0; + LINE: foreach (@lines) { + # before 1.56 we split into 3 and discarded the rest. From + # 1.57 we assign remaining text to $comment thus allowing to + # influence isa_perl + my($mod,$version,$dist,$comment) = split " ", $_, 4; + unless ($mod && defined $version && $dist) { + require Dumpvalue; + my $dv = Dumpvalue->new(tick => '"'); + $CPAN::Frontend->mywarn(sprintf "Could not split line[%s]\n", $dv->stringify($_)); + if ($errors++ >= 5){ + $CPAN::Frontend->mydie("Giving up parsing your $index_target, too many errors"); + } + next LINE; + } + my($bundle,$id,$userid); + + if ($mod eq 'CPAN' && + ! ( + CPAN::Queue->exists('Bundle::CPAN') || + CPAN::Queue->exists('CPAN') + ) + ) { + local($^W)= 0; + if ($version > $CPAN::VERSION) { + $CPAN::Frontend->mywarn(qq{ + New CPAN.pm version (v$version) available. + [Currently running version is v$CPAN::VERSION] + You might want to try + install CPAN + reload cpan + to both upgrade CPAN.pm and run the new version without leaving + the current session. + +}); #}); + $CPAN::Frontend->mysleep(2); + $CPAN::Frontend->myprint(qq{\n}); + } + last if $CPAN::Signal; + } elsif ($mod =~ /^Bundle::(.*)/) { + $bundle = $1; + } + + if ($bundle) { + $id = $CPAN::META->instance('CPAN::Bundle',$mod); + # Let's make it a module too, because bundles have so much + # in common with modules. + + # Changed in 1.57_63: seems like memory bloat now without + # any value, so commented out + + # $CPAN::META->instance('CPAN::Module',$mod); + + } else { + + # instantiate a module object + $id = $CPAN::META->instance('CPAN::Module',$mod); + + } + + # Although CPAN prohibits same name with different version the + # indexer may have changed the version for the same distro + # since the last time ("Force Reindexing" feature) + if ($id->cpan_file ne $dist + || + $id->cpan_version ne $version + ) { + $userid = $id->userid || $self->userid($dist); + $id->set( + 'CPAN_USERID' => $userid, + 'CPAN_VERSION' => $version, + 'CPAN_FILE' => $dist, + ); + } + + # instantiate a distribution object + if ($CPAN::META->exists('CPAN::Distribution',$dist)) { + # we do not need CONTAINSMODS unless we do something with + # this dist, so we better produce it on demand. + + ## my $obj = $CPAN::META->instance( + ## 'CPAN::Distribution' => $dist + ## ); + ## $obj->{CONTAINSMODS}{$mod} = undef; # experimental + } else { + $CPAN::META->instance( + 'CPAN::Distribution' => $dist + )->set( + 'CPAN_USERID' => $userid, + 'CPAN_COMMENT' => $comment, + ); + } + if ($secondtime) { + for my $name ($mod,$dist) { + # $self->debug("exists name[$name]") if $CPAN::DEBUG; + $exists{$name} = undef; + } + } + $i++; + while (($painted/76) < ($i/@lines)) { + $CPAN::Frontend->myprint("."); + $painted++; + } + return if $CPAN::Signal; + } + $CPAN::Frontend->myprint("DONE\n"); + if ($secondtime) { + for my $class (qw(CPAN::Module CPAN::Bundle CPAN::Distribution)) { + for my $o ($CPAN::META->all_objects($class)) { + next if exists $exists{$o->{ID}}; + $CPAN::META->delete($class,$o->{ID}); + # CPAN->debug("deleting ID[$o->{ID}] in class[$class]") + # if $CPAN::DEBUG; + } + } + } +} + +#-> sub CPAN::Index::rd_modlist ; +sub rd_modlist { + my($cl,$index_target) = @_; + return unless defined $index_target; + return if CPAN::_sqlite_running(); + $CPAN::Frontend->myprint("Reading '$index_target'\n"); + my $fh = CPAN::Tarzip->TIEHANDLE($index_target); + local $_; + my $slurp = ""; + my $chunk; + while (my $bytes = $fh->READ(\$chunk,8192)) { + $slurp.=$chunk; + } + my @eval2 = split /\012/, $slurp; + + while (@eval2) { + my $shift = shift(@eval2); + if ($shift =~ /^Date:\s+(.*)/) { + if ($DATE_OF_03 eq $1) { + $CPAN::Frontend->myprint("Unchanged.\n"); + return; + } + ($DATE_OF_03) = $1; + } + last if $shift =~ /^\s*$/; + } + push @eval2, q{CPAN::Modulelist->data;}; + local($^W) = 0; + my($compmt) = Safe->new("CPAN::Safe1"); + my($eval2) = join("\n", @eval2); + CPAN->debug(sprintf "length of eval2[%d]", length $eval2) if $CPAN::DEBUG; + my $ret = $compmt->reval($eval2); + Carp::confess($@) if $@; + return if $CPAN::Signal; + my $i = 0; + my $until = keys(%$ret); + my $painted = 0; + CPAN->debug(sprintf "until[%d]", $until) if $CPAN::DEBUG; + for (sort keys %$ret) { + my $obj = $CPAN::META->instance("CPAN::Module",$_); + delete $ret->{$_}{modid}; # not needed here, maybe elsewhere + $obj->set(%{$ret->{$_}}); + $i++; + while (($painted/76) < ($i/$until)) { + $CPAN::Frontend->myprint("."); + $painted++; + } + return if $CPAN::Signal; + } + $CPAN::Frontend->myprint("DONE\n"); +} + +#-> sub CPAN::Index::write_metadata_cache ; +sub write_metadata_cache { + my($self) = @_; + return unless $CPAN::Config->{'cache_metadata'}; + return if CPAN::_sqlite_running(); + return unless $CPAN::META->has_usable("Storable"); + my $cache; + foreach my $k (qw(CPAN::Bundle CPAN::Author CPAN::Module + CPAN::Distribution)) { + $cache->{$k} = $CPAN::META->{readonly}{$k}; # unsafe meta access, ok + } + my $metadata_file = File::Spec->catfile($CPAN::Config->{cpan_home},"Metadata"); + $cache->{last_time} = $LAST_TIME; + $cache->{DATE_OF_02} = $DATE_OF_02; + $cache->{PROTOCOL} = PROTOCOL; + $CPAN::Frontend->myprint("Writing $metadata_file\n"); + eval { Storable::nstore($cache, $metadata_file) }; + $CPAN::Frontend->mywarn($@) if $@; # ?? missing "\n" after $@ in mywarn ?? +} + +#-> sub CPAN::Index::read_metadata_cache ; +sub read_metadata_cache { + my($self) = @_; + return unless $CPAN::Config->{'cache_metadata'}; + return if CPAN::_sqlite_running(); + return unless $CPAN::META->has_usable("Storable"); + my $metadata_file = File::Spec->catfile($CPAN::Config->{cpan_home},"Metadata"); + return unless -r $metadata_file and -f $metadata_file; + $CPAN::Frontend->myprint("Reading '$metadata_file'\n"); + my $cache; + eval { $cache = Storable::retrieve($metadata_file) }; + $CPAN::Frontend->mywarn($@) if $@; # ?? missing "\n" after $@ in mywarn ?? + if (!$cache || !UNIVERSAL::isa($cache, 'HASH')) { + $LAST_TIME = 0; + return; + } + if (exists $cache->{PROTOCOL}) { + if (PROTOCOL > $cache->{PROTOCOL}) { + $CPAN::Frontend->mywarn(sprintf("Ignoring Metadata cache written ". + "with protocol v%s, requiring v%s\n", + $cache->{PROTOCOL}, + PROTOCOL) + ); + return; + } + } else { + $CPAN::Frontend->mywarn("Ignoring Metadata cache written ". + "with protocol v1.0\n"); + return; + } + my $clcnt = 0; + my $idcnt = 0; + while(my($class,$v) = each %$cache) { + next unless $class =~ /^CPAN::/; + $CPAN::META->{readonly}{$class} = $v; # unsafe meta access, ok + while (my($id,$ro) = each %$v) { + $CPAN::META->{readwrite}{$class}{$id} ||= + $class->new(ID=>$id, RO=>$ro); + $idcnt++; + } + $clcnt++; + } + unless ($clcnt) { # sanity check + $CPAN::Frontend->myprint("Warning: Found no data in $metadata_file\n"); + return; + } + if ($idcnt < 1000) { + $CPAN::Frontend->myprint("Warning: Found only $idcnt objects ". + "in $metadata_file\n"); + return; + } + $CPAN::META->{PROTOCOL} ||= + $cache->{PROTOCOL}; # reading does not up or downgrade, but it + # does initialize to some protocol + $LAST_TIME = $cache->{last_time}; + $DATE_OF_02 = $cache->{DATE_OF_02}; + $CPAN::Frontend->myprint(" Database was generated on $DATE_OF_02\n") + if defined $DATE_OF_02; # An old cache may not contain DATE_OF_02 + return; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/InfoObj.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/InfoObj.pm new file mode 100644 index 0000000000000000000000000000000000000000..9198316c69ff1e6fba3c1a53a0e9413614a11989 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/InfoObj.pm @@ -0,0 +1,224 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::InfoObj; +use strict; + +use CPAN::Debug; +@CPAN::InfoObj::ISA = qw(CPAN::Debug); + +use Cwd qw(chdir); + +use vars qw( + $VERSION +); +$VERSION = "5.5"; + +sub ro { + my $self = shift; + exists $self->{RO} and return $self->{RO}; +} + +#-> sub CPAN::InfoObj::cpan_userid +sub cpan_userid { + my $self = shift; + my $ro = $self->ro; + if ($ro) { + return $ro->{CPAN_USERID} || "N/A"; + } else { + $self->debug("ID[$self->{ID}]"); + # N/A for bundles found locally + return "N/A"; + } +} + +sub id { shift->{ID}; } + +#-> sub CPAN::InfoObj::new ; +sub new { + my $this = bless {}, shift; + %$this = @_; + $this +} + +# The set method may only be used by code that reads index data or +# otherwise "objective" data from the outside world. All session +# related material may do anything else with instance variables but +# must not touch the hash under the RO attribute. The reason is that +# the RO hash gets written to Metadata file and is thus persistent. + +#-> sub CPAN::InfoObj::safe_chdir ; +sub safe_chdir { + my($self,$todir) = @_; + # we die if we cannot chdir and we are debuggable + Carp::confess("safe_chdir called without todir argument") + unless defined $todir and length $todir; + if (chdir $todir) { + $self->debug(sprintf "changed directory to %s", CPAN::anycwd()) + if $CPAN::DEBUG; + } else { + if (-e $todir) { + unless (-x $todir) { + unless (chmod 0755, $todir) { + my $cwd = CPAN::anycwd(); + $CPAN::Frontend->mywarn("I have neither the -x permission nor the ". + "permission to change the permission; cannot ". + "chdir to '$todir'\n"); + $CPAN::Frontend->mysleep(5); + $CPAN::Frontend->mydie(qq{Could not chdir from cwd[$cwd] }. + qq{to todir[$todir]: $!}); + } + } + } else { + $CPAN::Frontend->mydie("Directory '$todir' has gone. Cannot continue.\n"); + } + if (chdir $todir) { + $self->debug(sprintf "changed directory to %s", CPAN::anycwd()) + if $CPAN::DEBUG; + } else { + my $cwd = CPAN::anycwd(); + $CPAN::Frontend->mydie(qq{Could not chdir from cwd[$cwd] }. + qq{to todir[$todir] (a chmod has been issued): $!}); + } + } +} + +#-> sub CPAN::InfoObj::set ; +sub set { + my($self,%att) = @_; + my $class = ref $self; + + # This must be ||=, not ||, because only if we write an empty + # reference, only then the set method will write into the readonly + # area. But for Distributions that spring into existence, maybe + # because of a typo, we do not like it that they are written into + # the readonly area and made permanent (at least for a while) and + # that is why we do not "allow" other places to call ->set. + unless ($self->id) { + CPAN->debug("Bug? Empty ID, rejecting"); + return; + } + my $ro = $self->{RO} = + $CPAN::META->{readonly}{$class}{$self->id} ||= {}; + + while (my($k,$v) = each %att) { + $ro->{$k} = $v; + } +} + +#-> sub CPAN::InfoObj::as_glimpse ; +sub as_glimpse { + my($self) = @_; + my(@m); + my $class = ref($self); + $class =~ s/^CPAN:://; + my $id = $self->can("pretty_id") ? $self->pretty_id : $self->{ID}; + push @m, sprintf "%-15s %s\n", $class, $id; + join "", @m; +} + +#-> sub CPAN::InfoObj::as_string ; +sub as_string { + my($self) = @_; + my(@m); + my $class = ref($self); + $class =~ s/^CPAN:://; + push @m, $class, " id = $self->{ID}\n"; + my $ro; + unless ($ro = $self->ro) { + if (substr($self->{ID},-1,1) eq ".") { # directory + $ro = +{}; + } else { + $CPAN::Frontend->mywarn("Unknown object $self->{ID}\n"); + $CPAN::Frontend->mysleep(5); + return; + } + } + for (sort keys %$ro) { + # next if m/^(ID|RO)$/; + my $extra = ""; + if ($_ eq "CPAN_USERID") { + $extra .= " ("; + $extra .= $self->fullname; + my $email; # old perls! + if ($email = $CPAN::META->instance("CPAN::Author", + $self->cpan_userid + )->email) { + $extra .= " <$email>"; + } else { + $extra .= " <no email>"; + } + $extra .= ")"; + } elsif ($_ eq "FULLNAME") { # potential UTF-8 conversion + push @m, sprintf " %-12s %s\n", $_, $self->fullname; + next; + } + next unless defined $ro->{$_}; + push @m, sprintf " %-12s %s%s\n", $_, $ro->{$_}, $extra; + } + KEY: for (sort keys %$self) { + next if m/^(ID|RO)$/; + unless (defined $self->{$_}) { + delete $self->{$_}; + next KEY; + } + if (ref($self->{$_}) eq "ARRAY") { + push @m, sprintf " %-12s %s\n", $_, "@{$self->{$_}}"; + } elsif (ref($self->{$_}) eq "HASH") { + my $value; + if (/^CONTAINSMODS$/) { + $value = join(" ",sort keys %{$self->{$_}}); + } elsif (/^prereq_pm$/) { + my @value; + my $v = $self->{$_}; + for my $x (sort keys %$v) { + my @svalue; + for my $y (sort keys %{$v->{$x}}) { + push @svalue, "$y=>$v->{$x}{$y}"; + } + push @value, "$x\:" . join ",", @svalue if @svalue; + } + $value = join ";", @value; + } else { + $value = $self->{$_}; + } + push @m, sprintf( + " %-12s %s\n", + $_, + $value, + ); + } else { + push @m, sprintf " %-12s %s\n", $_, $self->{$_}; + } + } + join "", @m, "\n"; +} + +#-> sub CPAN::InfoObj::fullname ; +sub fullname { + my($self) = @_; + $CPAN::META->instance("CPAN::Author",$self->cpan_userid)->fullname; +} + +#-> sub CPAN::InfoObj::dump ; +sub dump { + my($self, $what) = @_; + unless ($CPAN::META->has_inst("Data::Dumper")) { + $CPAN::Frontend->mydie("dump command requires Data::Dumper installed"); + } + local $Data::Dumper::Sortkeys; + $Data::Dumper::Sortkeys = 1; + my $out = Data::Dumper::Dumper($what ? eval $what : $self); + if (length $out > 100000) { + my $fh_pager = FileHandle->new; + local($SIG{PIPE}) = "IGNORE"; + my $pager = $CPAN::Config->{'pager'} || "cat"; + $fh_pager->open("|$pager") + or die "Could not open pager $pager\: $!"; + $fh_pager->print($out); + close $fh_pager; + } else { + $CPAN::Frontend->myprint($out); + } +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Kwalify.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Kwalify.pm new file mode 100644 index 0000000000000000000000000000000000000000..3cade90b91a0907adad3f1c29cfd1d5eee1e85d3 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Kwalify.pm @@ -0,0 +1,136 @@ +=head1 NAME + +CPAN::Kwalify - Interface between CPAN.pm and Kwalify.pm + +=head1 SYNOPSIS + + use CPAN::Kwalify; + validate($schema_name, $data, $file, $doc); + +=head1 DESCRIPTION + +=over + +=item _validate($schema_name, $data, $file, $doc) + +$schema_name is the name of a supported schema. Currently only +C<distroprefs> is supported. $data is the data to be validated. $file +is the absolute path to the file the data are coming from. $doc is the +index of the document within $doc that is to be validated. The last +two arguments are only there for better error reporting. + +Relies on being called from within CPAN.pm. + +Dies if something fails. Does not return anything useful. + +=item yaml($schema_name) + +Returns the YAML text of that schema. Dies if something fails. + +=back + +=head1 AUTHOR + +Andreas Koenig C<< <andk@cpan.org> >> + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See L<http://www.perl.com/perl/misc/Artistic.html> + + + +=cut + + +use strict; + +package CPAN::Kwalify; +use vars qw($VERSION $VAR1); +$VERSION = "5.50"; + +use File::Spec (); + +my %vcache = (); + +my $schema_loaded = {}; + +sub _validate { + my($schema_name,$data,$abs,$y) = @_; + my $yaml_module = CPAN->_yaml_module; + if ( + $CPAN::META->has_inst($yaml_module) + && + $CPAN::META->has_inst("Kwalify") + ) { + my $load = UNIVERSAL::can($yaml_module,"Load"); + unless ($schema_loaded->{$schema_name}) { + eval { + my $schema_yaml = yaml($schema_name); + $schema_loaded->{$schema_name} = $load->($schema_yaml); + }; + if ($@) { + # we know that YAML.pm 0.62 cannot parse the schema, + # so we try a fallback + my $content = do { + my $path = __FILE__; + $path =~ s/\.pm$//; + $path = File::Spec->catfile($path, "$schema_name.dd"); + local *FH; + open FH, $path or die "Could not open '$path': $!"; + local $/; + <FH>; + }; + $VAR1 = undef; + eval $content; + if (my $err = $@) { + die "parsing of '$schema_name.dd' failed: $err"; + } + $schema_loaded->{$schema_name} = $VAR1; + } + } + } + if (my $schema = $schema_loaded->{$schema_name}) { + my $mtime = (stat $abs)[9]; + for my $k (keys %{$vcache{$abs}}) { + delete $vcache{$abs}{$k} unless $k eq $mtime; + } + return if $vcache{$abs}{$mtime}{$y}++; + eval { Kwalify::validate($schema, $data) }; + if (my $err = $@) { + my $info = {}; yaml($schema_name, info => $info); + die "validation of distropref '$abs'[$y] against schema '$info->{path}' failed: $err"; + } + } +} + +sub _clear_cache { + %vcache = (); +} + +sub yaml { + my($schema_name, %opt) = @_; + my $content = do { + my $path = __FILE__; + $path =~ s/\.pm$//; + $path = File::Spec->catfile($path, "$schema_name.yml"); + if ($opt{info}) { + $opt{info}{path} = $path; + } + local *FH; + open FH, $path or die "Could not open '$path': $!"; + local $/; + <FH>; + }; + return $content; +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# End: + diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Meta.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Meta.pm new file mode 100644 index 0000000000000000000000000000000000000000..4a8e65c0fc1f878df401b7bb308db54f06ae356c --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Meta.pm @@ -0,0 +1,1176 @@ +use 5.006; +use strict; +use warnings; +package CPAN::Meta; + +our $VERSION = '2.150010'; + +#pod =head1 SYNOPSIS +#pod +#pod use v5.10; +#pod use strict; +#pod use warnings; +#pod use CPAN::Meta; +#pod use Module::Load; +#pod +#pod my $meta = CPAN::Meta->load_file('META.json'); +#pod +#pod printf "testing requirements for %s version %s\n", +#pod $meta->name, +#pod $meta->version; +#pod +#pod my $prereqs = $meta->effective_prereqs; +#pod +#pod for my $phase ( qw/configure runtime build test/ ) { +#pod say "Requirements for $phase:"; +#pod my $reqs = $prereqs->requirements_for($phase, "requires"); +#pod for my $module ( sort $reqs->required_modules ) { +#pod my $status; +#pod if ( eval { load $module unless $module eq 'perl'; 1 } ) { +#pod my $version = $module eq 'perl' ? $] : $module->VERSION; +#pod $status = $reqs->accepts_module($module, $version) +#pod ? "$version ok" : "$version not ok"; +#pod } else { +#pod $status = "missing" +#pod }; +#pod say " $module ($status)"; +#pod } +#pod } +#pod +#pod =head1 DESCRIPTION +#pod +#pod Software distributions released to the CPAN include a F<META.json> or, for +#pod older distributions, F<META.yml>, which describes the distribution, its +#pod contents, and the requirements for building and installing the distribution. +#pod The data structure stored in the F<META.json> file is described in +#pod L<CPAN::Meta::Spec>. +#pod +#pod CPAN::Meta provides a simple class to represent this distribution metadata (or +#pod I<distmeta>), along with some helpful methods for interrogating that data. +#pod +#pod The documentation below is only for the methods of the CPAN::Meta object. For +#pod information on the meaning of individual fields, consult the spec. +#pod +#pod =cut + +use Carp qw(carp croak); +use CPAN::Meta::Feature; +use CPAN::Meta::Prereqs; +use CPAN::Meta::Converter; +use CPAN::Meta::Validator; +use Parse::CPAN::Meta 1.4414 (); + +BEGIN { *_dclone = \&CPAN::Meta::Converter::_dclone } + +#pod =head1 STRING DATA +#pod +#pod The following methods return a single value, which is the value for the +#pod corresponding entry in the distmeta structure. Values should be either undef +#pod or strings. +#pod +#pod =for :list +#pod * abstract +#pod * description +#pod * dynamic_config +#pod * generated_by +#pod * name +#pod * release_status +#pod * version +#pod +#pod =cut + +BEGIN { + my @STRING_READERS = qw( + abstract + description + dynamic_config + generated_by + name + release_status + version + ); + + no strict 'refs'; + for my $attr (@STRING_READERS) { + *$attr = sub { $_[0]{ $attr } }; + } +} + +#pod =head1 LIST DATA +#pod +#pod These methods return lists of string values, which might be represented in the +#pod distmeta structure as arrayrefs or scalars: +#pod +#pod =for :list +#pod * authors +#pod * keywords +#pod * licenses +#pod +#pod The C<authors> and C<licenses> methods may also be called as C<author> and +#pod C<license>, respectively, to match the field name in the distmeta structure. +#pod +#pod =cut + +BEGIN { + my @LIST_READERS = qw( + author + keywords + license + ); + + no strict 'refs'; + for my $attr (@LIST_READERS) { + *$attr = sub { + my $value = $_[0]{ $attr }; + croak "$attr must be called in list context" + unless wantarray; + return @{ _dclone($value) } if ref $value; + return $value; + }; + } +} + +sub authors { $_[0]->author } +sub licenses { $_[0]->license } + +#pod =head1 MAP DATA +#pod +#pod These readers return hashrefs of arbitrary unblessed data structures, each +#pod described more fully in the specification: +#pod +#pod =for :list +#pod * meta_spec +#pod * resources +#pod * provides +#pod * no_index +#pod * prereqs +#pod * optional_features +#pod +#pod =cut + +BEGIN { + my @MAP_READERS = qw( + meta-spec + resources + provides + no_index + + prereqs + optional_features + ); + + no strict 'refs'; + for my $attr (@MAP_READERS) { + (my $subname = $attr) =~ s/-/_/; + *$subname = sub { + my $value = $_[0]{ $attr }; + return _dclone($value) if $value; + return {}; + }; + } +} + +#pod =head1 CUSTOM DATA +#pod +#pod A list of custom keys are available from the C<custom_keys> method and +#pod particular keys may be retrieved with the C<custom> method. +#pod +#pod say $meta->custom($_) for $meta->custom_keys; +#pod +#pod If a custom key refers to a data structure, a deep clone is returned. +#pod +#pod =cut + +sub custom_keys { + return grep { /^x_/i } keys %{$_[0]}; +} + +sub custom { + my ($self, $attr) = @_; + my $value = $self->{$attr}; + return _dclone($value) if ref $value; + return $value; +} + +#pod =method new +#pod +#pod my $meta = CPAN::Meta->new($distmeta_struct, \%options); +#pod +#pod Returns a valid CPAN::Meta object or dies if the supplied metadata hash +#pod reference fails to validate. Older-format metadata will be up-converted to +#pod version 2 if they validate against the original stated specification. +#pod +#pod It takes an optional hashref of options. Valid options include: +#pod +#pod =over +#pod +#pod =item * +#pod +#pod lazy_validation -- if true, new will attempt to convert the given metadata +#pod to version 2 before attempting to validate it. This means than any +#pod fixable errors will be handled by CPAN::Meta::Converter before validation. +#pod (Note that this might result in invalid optional data being silently +#pod dropped.) The default is false. +#pod +#pod =back +#pod +#pod =cut + +sub _new { + my ($class, $struct, $options) = @_; + my $self; + + if ( $options->{lazy_validation} ) { + # try to convert to a valid structure; if succeeds, then return it + my $cmc = CPAN::Meta::Converter->new( $struct ); + $self = $cmc->convert( version => 2 ); # valid or dies + return bless $self, $class; + } + else { + # validate original struct + my $cmv = CPAN::Meta::Validator->new( $struct ); + unless ( $cmv->is_valid) { + die "Invalid metadata structure. Errors: " + . join(", ", $cmv->errors) . "\n"; + } + } + + # up-convert older spec versions + my $version = $struct->{'meta-spec'}{version} || '1.0'; + if ( $version == 2 ) { + $self = $struct; + } + else { + my $cmc = CPAN::Meta::Converter->new( $struct ); + $self = $cmc->convert( version => 2 ); + } + + return bless $self, $class; +} + +sub new { + my ($class, $struct, $options) = @_; + my $self = eval { $class->_new($struct, $options) }; + croak($@) if $@; + return $self; +} + +#pod =method create +#pod +#pod my $meta = CPAN::Meta->create($distmeta_struct, \%options); +#pod +#pod This is same as C<new()>, except that C<generated_by> and C<meta-spec> fields +#pod will be generated if not provided. This means the metadata structure is +#pod assumed to otherwise follow the latest L<CPAN::Meta::Spec>. +#pod +#pod =cut + +sub create { + my ($class, $struct, $options) = @_; + my $version = __PACKAGE__->VERSION || 2; + $struct->{generated_by} ||= __PACKAGE__ . " version $version" ; + $struct->{'meta-spec'}{version} ||= int($version); + my $self = eval { $class->_new($struct, $options) }; + croak ($@) if $@; + return $self; +} + +#pod =method load_file +#pod +#pod my $meta = CPAN::Meta->load_file($distmeta_file, \%options); +#pod +#pod Given a pathname to a file containing metadata, this deserializes the file +#pod according to its file suffix and constructs a new C<CPAN::Meta> object, just +#pod like C<new()>. It will die if the deserialized version fails to validate +#pod against its stated specification version. +#pod +#pod It takes the same options as C<new()> but C<lazy_validation> defaults to +#pod true. +#pod +#pod =cut + +sub load_file { + my ($class, $file, $options) = @_; + $options->{lazy_validation} = 1 unless exists $options->{lazy_validation}; + + croak "load_file() requires a valid, readable filename" + unless -r $file; + + my $self; + eval { + my $struct = Parse::CPAN::Meta->load_file( $file ); + $self = $class->_new($struct, $options); + }; + croak($@) if $@; + return $self; +} + +#pod =method load_yaml_string +#pod +#pod my $meta = CPAN::Meta->load_yaml_string($yaml, \%options); +#pod +#pod This method returns a new CPAN::Meta object using the first document in the +#pod given YAML string. In other respects it is identical to C<load_file()>. +#pod +#pod =cut + +sub load_yaml_string { + my ($class, $yaml, $options) = @_; + $options->{lazy_validation} = 1 unless exists $options->{lazy_validation}; + + my $self; + eval { + my ($struct) = Parse::CPAN::Meta->load_yaml_string( $yaml ); + $self = $class->_new($struct, $options); + }; + croak($@) if $@; + return $self; +} + +#pod =method load_json_string +#pod +#pod my $meta = CPAN::Meta->load_json_string($json, \%options); +#pod +#pod This method returns a new CPAN::Meta object using the structure represented by +#pod the given JSON string. In other respects it is identical to C<load_file()>. +#pod +#pod =cut + +sub load_json_string { + my ($class, $json, $options) = @_; + $options->{lazy_validation} = 1 unless exists $options->{lazy_validation}; + + my $self; + eval { + my $struct = Parse::CPAN::Meta->load_json_string( $json ); + $self = $class->_new($struct, $options); + }; + croak($@) if $@; + return $self; +} + +#pod =method load_string +#pod +#pod my $meta = CPAN::Meta->load_string($string, \%options); +#pod +#pod If you don't know if a string contains YAML or JSON, this method will use +#pod L<Parse::CPAN::Meta> to guess. In other respects it is identical to +#pod C<load_file()>. +#pod +#pod =cut + +sub load_string { + my ($class, $string, $options) = @_; + $options->{lazy_validation} = 1 unless exists $options->{lazy_validation}; + + my $self; + eval { + my $struct = Parse::CPAN::Meta->load_string( $string ); + $self = $class->_new($struct, $options); + }; + croak($@) if $@; + return $self; +} + +#pod =method save +#pod +#pod $meta->save($distmeta_file, \%options); +#pod +#pod Serializes the object as JSON and writes it to the given file. The only valid +#pod option is C<version>, which defaults to '2'. On Perl 5.8.1 or later, the file +#pod is saved with UTF-8 encoding. +#pod +#pod For C<version> 2 (or higher), the filename should end in '.json'. L<JSON::PP> +#pod is the default JSON backend. Using another JSON backend requires L<JSON> 2.5 or +#pod later and you must set the C<$ENV{PERL_JSON_BACKEND}> to a supported alternate +#pod backend like L<JSON::XS>. +#pod +#pod For C<version> less than 2, the filename should end in '.yml'. +#pod L<CPAN::Meta::Converter> is used to generate an older metadata structure, which +#pod is serialized to YAML. CPAN::Meta::YAML is the default YAML backend. You may +#pod set the C<$ENV{PERL_YAML_BACKEND}> to a supported alternative backend, though +#pod this is not recommended due to subtle incompatibilities between YAML parsers on +#pod CPAN. +#pod +#pod =cut + +sub save { + my ($self, $file, $options) = @_; + + my $version = $options->{version} || '2'; + my $layer = $] ge '5.008001' ? ':utf8' : ''; + + if ( $version ge '2' ) { + carp "'$file' should end in '.json'" + unless $file =~ m{\.json$}; + } + else { + carp "'$file' should end in '.yml'" + unless $file =~ m{\.yml$}; + } + + my $data = $self->as_string( $options ); + open my $fh, ">$layer", $file + or die "Error opening '$file' for writing: $!\n"; + + print {$fh} $data; + close $fh + or die "Error closing '$file': $!\n"; + + return 1; +} + +#pod =method meta_spec_version +#pod +#pod This method returns the version part of the C<meta_spec> entry in the distmeta +#pod structure. It is equivalent to: +#pod +#pod $meta->meta_spec->{version}; +#pod +#pod =cut + +sub meta_spec_version { + my ($self) = @_; + return $self->meta_spec->{version}; +} + +#pod =method effective_prereqs +#pod +#pod my $prereqs = $meta->effective_prereqs; +#pod +#pod my $prereqs = $meta->effective_prereqs( \@feature_identifiers ); +#pod +#pod This method returns a L<CPAN::Meta::Prereqs> object describing all the +#pod prereqs for the distribution. If an arrayref of feature identifiers is given, +#pod the prereqs for the identified features are merged together with the +#pod distribution's core prereqs before the CPAN::Meta::Prereqs object is returned. +#pod +#pod =cut + +sub effective_prereqs { + my ($self, $features) = @_; + $features ||= []; + + my $prereq = CPAN::Meta::Prereqs->new($self->prereqs); + + return $prereq unless @$features; + + my @other = map {; $self->feature($_)->prereqs } @$features; + + return $prereq->with_merged_prereqs(\@other); +} + +#pod =method should_index_file +#pod +#pod ... if $meta->should_index_file( $filename ); +#pod +#pod This method returns true if the given file should be indexed. It decides this +#pod by checking the C<file> and C<directory> keys in the C<no_index> property of +#pod the distmeta structure. Note that neither the version format nor +#pod C<release_status> are considered. +#pod +#pod C<$filename> should be given in unix format. +#pod +#pod =cut + +sub should_index_file { + my ($self, $filename) = @_; + + for my $no_index_file (@{ $self->no_index->{file} || [] }) { + return if $filename eq $no_index_file; + } + + for my $no_index_dir (@{ $self->no_index->{directory} }) { + $no_index_dir =~ s{$}{/} unless $no_index_dir =~ m{/\z}; + return if index($filename, $no_index_dir) == 0; + } + + return 1; +} + +#pod =method should_index_package +#pod +#pod ... if $meta->should_index_package( $package ); +#pod +#pod This method returns true if the given package should be indexed. It decides +#pod this by checking the C<package> and C<namespace> keys in the C<no_index> +#pod property of the distmeta structure. Note that neither the version format nor +#pod C<release_status> are considered. +#pod +#pod =cut + +sub should_index_package { + my ($self, $package) = @_; + + for my $no_index_pkg (@{ $self->no_index->{package} || [] }) { + return if $package eq $no_index_pkg; + } + + for my $no_index_ns (@{ $self->no_index->{namespace} }) { + return if index($package, "${no_index_ns}::") == 0; + } + + return 1; +} + +#pod =method features +#pod +#pod my @feature_objects = $meta->features; +#pod +#pod This method returns a list of L<CPAN::Meta::Feature> objects, one for each +#pod optional feature described by the distribution's metadata. +#pod +#pod =cut + +sub features { + my ($self) = @_; + + my $opt_f = $self->optional_features; + my @features = map {; CPAN::Meta::Feature->new($_ => $opt_f->{ $_ }) } + keys %$opt_f; + + return @features; +} + +#pod =method feature +#pod +#pod my $feature_object = $meta->feature( $identifier ); +#pod +#pod This method returns a L<CPAN::Meta::Feature> object for the optional feature +#pod with the given identifier. If no feature with that identifier exists, an +#pod exception will be raised. +#pod +#pod =cut + +sub feature { + my ($self, $ident) = @_; + + croak "no feature named $ident" + unless my $f = $self->optional_features->{ $ident }; + + return CPAN::Meta::Feature->new($ident, $f); +} + +#pod =method as_struct +#pod +#pod my $copy = $meta->as_struct( \%options ); +#pod +#pod This method returns a deep copy of the object's metadata as an unblessed hash +#pod reference. It takes an optional hashref of options. If the hashref contains +#pod a C<version> argument, the copied metadata will be converted to the version +#pod of the specification and returned. For example: +#pod +#pod my $old_spec = $meta->as_struct( {version => "1.4"} ); +#pod +#pod =cut + +sub as_struct { + my ($self, $options) = @_; + my $struct = _dclone($self); + if ( $options->{version} ) { + my $cmc = CPAN::Meta::Converter->new( $struct ); + $struct = $cmc->convert( version => $options->{version} ); + } + return $struct; +} + +#pod =method as_string +#pod +#pod my $string = $meta->as_string( \%options ); +#pod +#pod This method returns a serialized copy of the object's metadata as a character +#pod string. (The strings are B<not> UTF-8 encoded.) It takes an optional hashref +#pod of options. If the hashref contains a C<version> argument, the copied metadata +#pod will be converted to the version of the specification and returned. For +#pod example: +#pod +#pod my $string = $meta->as_string( {version => "1.4"} ); +#pod +#pod For C<version> greater than or equal to 2, the string will be serialized as +#pod JSON. For C<version> less than 2, the string will be serialized as YAML. In +#pod both cases, the same rules are followed as in the C<save()> method for choosing +#pod a serialization backend. +#pod +#pod The serialized structure will include a C<x_serialization_backend> entry giving +#pod the package and version used to serialize. Any existing key in the given +#pod C<$meta> object will be clobbered. +#pod +#pod =cut + +sub as_string { + my ($self, $options) = @_; + + my $version = $options->{version} || '2'; + + my $struct; + if ( $self->meta_spec_version ne $version ) { + my $cmc = CPAN::Meta::Converter->new( $self->as_struct ); + $struct = $cmc->convert( version => $version ); + } + else { + $struct = $self->as_struct; + } + + my ($data, $backend); + if ( $version ge '2' ) { + $backend = Parse::CPAN::Meta->json_backend(); + local $struct->{x_serialization_backend} = sprintf '%s version %s', + $backend, $backend->VERSION; + $data = $backend->new->pretty->canonical->encode($struct); + } + else { + $backend = Parse::CPAN::Meta->yaml_backend(); + local $struct->{x_serialization_backend} = sprintf '%s version %s', + $backend, $backend->VERSION; + $data = eval { no strict 'refs'; &{"$backend\::Dump"}($struct) }; + if ( $@ ) { + croak $backend->can('errstr') ? $backend->errstr : $@ + } + } + + return $data; +} + +# Used by JSON::PP, etc. for "convert_blessed" +sub TO_JSON { + return { %{ $_[0] } }; +} + +1; + +# ABSTRACT: the distribution metadata for a CPAN dist + +=pod + +=encoding UTF-8 + +=head1 NAME + +CPAN::Meta - the distribution metadata for a CPAN dist + +=head1 VERSION + +version 2.150010 + +=head1 SYNOPSIS + + use v5.10; + use strict; + use warnings; + use CPAN::Meta; + use Module::Load; + + my $meta = CPAN::Meta->load_file('META.json'); + + printf "testing requirements for %s version %s\n", + $meta->name, + $meta->version; + + my $prereqs = $meta->effective_prereqs; + + for my $phase ( qw/configure runtime build test/ ) { + say "Requirements for $phase:"; + my $reqs = $prereqs->requirements_for($phase, "requires"); + for my $module ( sort $reqs->required_modules ) { + my $status; + if ( eval { load $module unless $module eq 'perl'; 1 } ) { + my $version = $module eq 'perl' ? $] : $module->VERSION; + $status = $reqs->accepts_module($module, $version) + ? "$version ok" : "$version not ok"; + } else { + $status = "missing" + }; + say " $module ($status)"; + } + } + +=head1 DESCRIPTION + +Software distributions released to the CPAN include a F<META.json> or, for +older distributions, F<META.yml>, which describes the distribution, its +contents, and the requirements for building and installing the distribution. +The data structure stored in the F<META.json> file is described in +L<CPAN::Meta::Spec>. + +CPAN::Meta provides a simple class to represent this distribution metadata (or +I<distmeta>), along with some helpful methods for interrogating that data. + +The documentation below is only for the methods of the CPAN::Meta object. For +information on the meaning of individual fields, consult the spec. + +=head1 METHODS + +=head2 new + + my $meta = CPAN::Meta->new($distmeta_struct, \%options); + +Returns a valid CPAN::Meta object or dies if the supplied metadata hash +reference fails to validate. Older-format metadata will be up-converted to +version 2 if they validate against the original stated specification. + +It takes an optional hashref of options. Valid options include: + +=over + +=item * + +lazy_validation -- if true, new will attempt to convert the given metadata +to version 2 before attempting to validate it. This means than any +fixable errors will be handled by CPAN::Meta::Converter before validation. +(Note that this might result in invalid optional data being silently +dropped.) The default is false. + +=back + +=head2 create + + my $meta = CPAN::Meta->create($distmeta_struct, \%options); + +This is same as C<new()>, except that C<generated_by> and C<meta-spec> fields +will be generated if not provided. This means the metadata structure is +assumed to otherwise follow the latest L<CPAN::Meta::Spec>. + +=head2 load_file + + my $meta = CPAN::Meta->load_file($distmeta_file, \%options); + +Given a pathname to a file containing metadata, this deserializes the file +according to its file suffix and constructs a new C<CPAN::Meta> object, just +like C<new()>. It will die if the deserialized version fails to validate +against its stated specification version. + +It takes the same options as C<new()> but C<lazy_validation> defaults to +true. + +=head2 load_yaml_string + + my $meta = CPAN::Meta->load_yaml_string($yaml, \%options); + +This method returns a new CPAN::Meta object using the first document in the +given YAML string. In other respects it is identical to C<load_file()>. + +=head2 load_json_string + + my $meta = CPAN::Meta->load_json_string($json, \%options); + +This method returns a new CPAN::Meta object using the structure represented by +the given JSON string. In other respects it is identical to C<load_file()>. + +=head2 load_string + + my $meta = CPAN::Meta->load_string($string, \%options); + +If you don't know if a string contains YAML or JSON, this method will use +L<Parse::CPAN::Meta> to guess. In other respects it is identical to +C<load_file()>. + +=head2 save + + $meta->save($distmeta_file, \%options); + +Serializes the object as JSON and writes it to the given file. The only valid +option is C<version>, which defaults to '2'. On Perl 5.8.1 or later, the file +is saved with UTF-8 encoding. + +For C<version> 2 (or higher), the filename should end in '.json'. L<JSON::PP> +is the default JSON backend. Using another JSON backend requires L<JSON> 2.5 or +later and you must set the C<$ENV{PERL_JSON_BACKEND}> to a supported alternate +backend like L<JSON::XS>. + +For C<version> less than 2, the filename should end in '.yml'. +L<CPAN::Meta::Converter> is used to generate an older metadata structure, which +is serialized to YAML. CPAN::Meta::YAML is the default YAML backend. You may +set the C<$ENV{PERL_YAML_BACKEND}> to a supported alternative backend, though +this is not recommended due to subtle incompatibilities between YAML parsers on +CPAN. + +=head2 meta_spec_version + +This method returns the version part of the C<meta_spec> entry in the distmeta +structure. It is equivalent to: + + $meta->meta_spec->{version}; + +=head2 effective_prereqs + + my $prereqs = $meta->effective_prereqs; + + my $prereqs = $meta->effective_prereqs( \@feature_identifiers ); + +This method returns a L<CPAN::Meta::Prereqs> object describing all the +prereqs for the distribution. If an arrayref of feature identifiers is given, +the prereqs for the identified features are merged together with the +distribution's core prereqs before the CPAN::Meta::Prereqs object is returned. + +=head2 should_index_file + + ... if $meta->should_index_file( $filename ); + +This method returns true if the given file should be indexed. It decides this +by checking the C<file> and C<directory> keys in the C<no_index> property of +the distmeta structure. Note that neither the version format nor +C<release_status> are considered. + +C<$filename> should be given in unix format. + +=head2 should_index_package + + ... if $meta->should_index_package( $package ); + +This method returns true if the given package should be indexed. It decides +this by checking the C<package> and C<namespace> keys in the C<no_index> +property of the distmeta structure. Note that neither the version format nor +C<release_status> are considered. + +=head2 features + + my @feature_objects = $meta->features; + +This method returns a list of L<CPAN::Meta::Feature> objects, one for each +optional feature described by the distribution's metadata. + +=head2 feature + + my $feature_object = $meta->feature( $identifier ); + +This method returns a L<CPAN::Meta::Feature> object for the optional feature +with the given identifier. If no feature with that identifier exists, an +exception will be raised. + +=head2 as_struct + + my $copy = $meta->as_struct( \%options ); + +This method returns a deep copy of the object's metadata as an unblessed hash +reference. It takes an optional hashref of options. If the hashref contains +a C<version> argument, the copied metadata will be converted to the version +of the specification and returned. For example: + + my $old_spec = $meta->as_struct( {version => "1.4"} ); + +=head2 as_string + + my $string = $meta->as_string( \%options ); + +This method returns a serialized copy of the object's metadata as a character +string. (The strings are B<not> UTF-8 encoded.) It takes an optional hashref +of options. If the hashref contains a C<version> argument, the copied metadata +will be converted to the version of the specification and returned. For +example: + + my $string = $meta->as_string( {version => "1.4"} ); + +For C<version> greater than or equal to 2, the string will be serialized as +JSON. For C<version> less than 2, the string will be serialized as YAML. In +both cases, the same rules are followed as in the C<save()> method for choosing +a serialization backend. + +The serialized structure will include a C<x_serialization_backend> entry giving +the package and version used to serialize. Any existing key in the given +C<$meta> object will be clobbered. + +=head1 STRING DATA + +The following methods return a single value, which is the value for the +corresponding entry in the distmeta structure. Values should be either undef +or strings. + +=over 4 + +=item * + +abstract + +=item * + +description + +=item * + +dynamic_config + +=item * + +generated_by + +=item * + +name + +=item * + +release_status + +=item * + +version + +=back + +=head1 LIST DATA + +These methods return lists of string values, which might be represented in the +distmeta structure as arrayrefs or scalars: + +=over 4 + +=item * + +authors + +=item * + +keywords + +=item * + +licenses + +=back + +The C<authors> and C<licenses> methods may also be called as C<author> and +C<license>, respectively, to match the field name in the distmeta structure. + +=head1 MAP DATA + +These readers return hashrefs of arbitrary unblessed data structures, each +described more fully in the specification: + +=over 4 + +=item * + +meta_spec + +=item * + +resources + +=item * + +provides + +=item * + +no_index + +=item * + +prereqs + +=item * + +optional_features + +=back + +=head1 CUSTOM DATA + +A list of custom keys are available from the C<custom_keys> method and +particular keys may be retrieved with the C<custom> method. + + say $meta->custom($_) for $meta->custom_keys; + +If a custom key refers to a data structure, a deep clone is returned. + +=for Pod::Coverage TO_JSON abstract author authors custom custom_keys description dynamic_config +generated_by keywords license licenses meta_spec name no_index +optional_features prereqs provides release_status resources version + +=head1 BUGS + +Please report any bugs or feature using the CPAN Request Tracker. +Bugs can be submitted through the web interface at +L<http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta> + +When submitting a bug or request, please include a test-file or a patch to an +existing test-file that illustrates the bug or desired feature. + +=head1 SEE ALSO + +=over 4 + +=item * + +L<CPAN::Meta::Converter> + +=item * + +L<CPAN::Meta::Validator> + +=back + +=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan + +=head1 SUPPORT + +=head2 Bugs / Feature Requests + +Please report any bugs or feature requests through the issue tracker +at L<https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues>. +You will be notified automatically of any progress on your issue. + +=head2 Source Code + +This is open source software. The code repository is available for +public review and contribution under the terms of the license. + +L<https://github.com/Perl-Toolchain-Gang/CPAN-Meta> + + git clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta.git + +=head1 AUTHORS + +=over 4 + +=item * + +David Golden <dagolden@cpan.org> + +=item * + +Ricardo Signes <rjbs@cpan.org> + +=item * + +Adam Kennedy <adamk@cpan.org> + +=back + +=head1 CONTRIBUTORS + +=for stopwords Ansgar Burchardt Avar Arnfjord Bjarmason Benjamin Noggle Christopher J. Madsen Chuck Adams Cory G Watson Damyan Ivanov David Golden Eric Wilhelm Graham Knop Gregor Hermann Karen Etheridge Kenichi Ishigaki Kent Fredric Ken Williams Lars Dieckow Leon Timmermans majensen Mark Fowler Matt S Trout Michael G. Schwern Mohammad Anwar mohawk2 moznion Niko Tyni Olaf Alders Olivier Mengué Randy Sims Tomohiro Hosaka + +=over 4 + +=item * + +Ansgar Burchardt <ansgar@cpan.org> + +=item * + +Avar Arnfjord Bjarmason <avar@cpan.org> + +=item * + +Benjamin Noggle <agwind@users.noreply.github.com> + +=item * + +Christopher J. Madsen <cjm@cpan.org> + +=item * + +Chuck Adams <cja987@gmail.com> + +=item * + +Cory G Watson <gphat@cpan.org> + +=item * + +Damyan Ivanov <dam@cpan.org> + +=item * + +David Golden <xdg@xdg.me> + +=item * + +Eric Wilhelm <ewilhelm@cpan.org> + +=item * + +Graham Knop <haarg@haarg.org> + +=item * + +Gregor Hermann <gregoa@debian.org> + +=item * + +Karen Etheridge <ether@cpan.org> + +=item * + +Kenichi Ishigaki <ishigaki@cpan.org> + +=item * + +Kent Fredric <kentfredric@gmail.com> + +=item * + +Ken Williams <kwilliams@cpan.org> + +=item * + +Lars Dieckow <daxim@cpan.org> + +=item * + +Leon Timmermans <leont@cpan.org> + +=item * + +majensen <maj@fortinbras.us> + +=item * + +Mark Fowler <markf@cpan.org> + +=item * + +Matt S Trout <mst@shadowcat.co.uk> + +=item * + +Michael G. Schwern <mschwern@cpan.org> + +=item * + +Mohammad S Anwar <mohammad.anwar@yahoo.com> + +=item * + +mohawk2 <mohawk2@users.noreply.github.com> + +=item * + +moznion <moznion@gmail.com> + +=item * + +Niko Tyni <ntyni@debian.org> + +=item * + +Olaf Alders <olaf@wundersolutions.com> + +=item * + +Olivier Mengué <dolmen@cpan.org> + +=item * + +Randy Sims <randys@thepierianspring.org> + +=item * + +Tomohiro Hosaka <bokutin@bokut.in> + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + +__END__ + + +# vim: ts=2 sts=2 sw=2 et : diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Mirrors.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Mirrors.pm new file mode 100644 index 0000000000000000000000000000000000000000..721ead2a85d3a513f9afd2aa14f2cc4ccbec9251 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Mirrors.pm @@ -0,0 +1,638 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +=head1 NAME + +CPAN::Mirrors - Get CPAN mirror information and select a fast one + +=head1 SYNOPSIS + + use CPAN::Mirrors; + + my $mirrors = CPAN::Mirrors->new( $mirrored_by_file ); + + my $seen = {}; + + my $best_continent = $mirrors->find_best_continents( { seen => $seen } ); + my @mirrors = $mirrors->get_mirrors_by_continents( $best_continent ); + + my $callback = sub { + my( $m ) = @_; + printf "%s = %s\n", $m->hostname, $m->rtt + }; + $mirrors->get_mirrors_timings( \@mirrors, $seen, $callback, %args ); + + @mirrors = sort { $a->rtt <=> $b->rtt } @mirrors; + + print "Best mirrors are ", map( { $_->rtt } @mirrors[0..3] ), "\n"; + +=head1 DESCRIPTION + +=over + +=cut + +package CPAN::Mirrors; +use strict; +use vars qw($VERSION $urllist $silent); +$VERSION = "2.27"; + +use Carp; +use FileHandle; +use Fcntl ":flock"; +use Net::Ping (); +use CPAN::Version; + +=item new( LOCAL_FILE_NAME ) + +Create a new CPAN::Mirrors object from LOCAL_FILE_NAME. This file +should look like that in http://www.cpan.org/MIRRORED.BY . + +=cut + +sub new { + my ($class, $file) = @_; + croak "CPAN::Mirrors->new requires a filename" unless defined $file; + croak "The file [$file] was not found" unless -e $file; + + my $self = bless { + mirrors => [], + geography => {}, + }, $class; + + $self->parse_mirrored_by( $file ); + + return $self; +} + +sub parse_mirrored_by { + my ($self, $file) = @_; + my $handle = FileHandle->new; + $handle->open($file) + or croak "Couldn't open $file: $!"; + flock $handle, LOCK_SH; + $self->_parse($file,$handle); + flock $handle, LOCK_UN; + $handle->close; +} + +=item continents() + +Return a list of continents based on those defined in F<MIRRORED.BY>. + +=cut + +sub continents { + my ($self) = @_; + return sort keys %{$self->{geography} || {}}; +} + +=item countries( [CONTINENTS] ) + +Return a list of countries based on those defined in F<MIRRORED.BY>. +It only returns countries for the continents you specify (as defined +in C<continents>). If you don't specify any continents, it returns all +of the countries listed in F<MIRRORED.BY>. + +=cut + +sub countries { + my ($self, @continents) = @_; + @continents = $self->continents unless @continents; + my @countries; + for my $c (@continents) { + push @countries, sort keys %{ $self->{geography}{$c} || {} }; + } + return @countries; +} + +=item mirrors( [COUNTRIES] ) + +Return a list of mirrors based on those defined in F<MIRRORED.BY>. +It only returns mirrors for the countries you specify (as defined +in C<countries>). If you don't specify any countries, it returns all +of the mirrors listed in F<MIRRORED.BY>. + +=cut + +sub mirrors { + my ($self, @countries) = @_; + return @{$self->{mirrors}} unless @countries; + my %wanted = map { $_ => 1 } @countries; + my @found; + for my $m (@{$self->{mirrors}}) { + push @found, $m if exists $wanted{$m->country}; + } + return @found; +} + +=item get_mirrors_by_countries( [COUNTRIES] ) + +A more sensible synonym for mirrors. + +=cut + +sub get_mirrors_by_countries { &mirrors } + +=item get_mirrors_by_continents( [CONTINENTS] ) + +Return a list of mirrors for all of continents you specify. If you don't +specify any continents, it returns all of the mirrors. + +You can specify a single continent or an array reference of continents. + +=cut + +sub get_mirrors_by_continents { + my ($self, $continents ) = @_; + $continents = [ $continents ] unless ref $continents; + + eval { + $self->mirrors( $self->get_countries_by_continents( @$continents ) ); + }; + } + +=item get_countries_by_continents( [CONTINENTS] ) + +A more sensible synonym for countries. + +=cut + +sub get_countries_by_continents { &countries } + +=item default_mirror + +Returns the default mirror, http://www.cpan.org/ . This mirror uses +dynamic DNS to give a close mirror. + +=cut + +sub default_mirror { + CPAN::Mirrored::By->new({ http => 'http://www.cpan.org/'}); +} + +=item best_mirrors + +C<best_mirrors> checks for the best mirrors based on the list of +continents you pass, or, without that, all continents, as defined +by C<CPAN::Mirrored::By>. It pings each mirror, up to the value of +C<how_many>. In list context, it returns up to C<how_many> mirrors. +In scalar context, it returns the single best mirror. + +Arguments + + how_many - the number of mirrors to return. Default: 1 + callback - a callback for find_best_continents + verbose - true or false on all the whining and moaning. Default: false + continents - an array ref of the continents to check + external_ping - if true, use external ping via Net::Ping::External. Default: false + +If you don't specify the continents, C<best_mirrors> calls +C<find_best_continents> to get the list of continents to check. + +If you don't have L<Net::Ping> v2.13 or later, needed for timings, +this returns the default mirror. + +C<external_ping> should be set and then C<Net::Ping::External> needs +to be installed, if the local network has a transparent proxy. + +=cut + +sub best_mirrors { + my ($self, %args) = @_; + my $how_many = $args{how_many} || 1; + my $callback = $args{callback}; + my $verbose = defined $args{verbose} ? $args{verbose} : 0; + my $continents = $args{continents} || []; + $continents = [$continents] unless ref $continents; + $args{external_ping} = 0 unless defined $args{external_ping}; + my $external_ping = $args{external_ping}; + + # Old Net::Ping did not do timings at all + my $min_version = '2.13'; + unless( CPAN::Version->vgt(Net::Ping->VERSION, $min_version) ) { + carp sprintf "Net::Ping version is %s (< %s). Returning %s", + Net::Ping->VERSION, $min_version, $self->default_mirror; + return $self->default_mirror; + } + + my $seen = {}; + + if ( ! @$continents ) { + print "Searching for the best continent ...\n" if $verbose; + my @best_continents = $self->find_best_continents( + seen => $seen, + verbose => $verbose, + callback => $callback, + external_ping => $external_ping, + ); + + # Only add enough continents to find enough mirrors + my $count = 0; + for my $continent ( @best_continents ) { + push @$continents, $continent; + $count += $self->mirrors( $self->countries($continent) ); + last if $count >= $how_many; + } + } + + return $self->default_mirror unless @$continents; + print "Scanning " . join(", ", @$continents) . " ...\n" if $verbose; + + my $trial_mirrors = $self->get_n_random_mirrors_by_continents( 3 * $how_many, $continents->[0] ); + + my $timings = $self->get_mirrors_timings( + $trial_mirrors, + $seen, + $callback, + %args, + ); + return $self->default_mirror unless @$timings; + + $how_many = @$timings if $how_many > @$timings; + + return wantarray ? @{$timings}[0 .. $how_many-1] : $timings->[0]; +} + +=item get_n_random_mirrors_by_continents( N, [CONTINENTS] ) + +Returns up to N random mirrors for the specified continents. Specify the +continents as an array reference. + +=cut + +sub get_n_random_mirrors_by_continents { + my( $self, $n, $continents ) = @_; + $n ||= 3; + $continents = [ $continents ] unless ref $continents; + + if ( $n <= 0 ) { + return wantarray ? () : []; + } + + my @long_list = $self->get_mirrors_by_continents( $continents ); + + if ( $n eq '*' or $n > @long_list ) { + return wantarray ? @long_list : \@long_list; + } + + @long_list = map {$_->[0]} + sort {$a->[1] <=> $b->[1]} + map {[$_, rand]} @long_list; + + splice @long_list, $n; # truncate + + \@long_list; +} + +=item get_mirrors_timings( MIRROR_LIST, SEEN, CALLBACK, %ARGS ); + +Pings the listed mirrors and returns a list of mirrors sorted in +ascending ping times. + +C<MIRROR_LIST> is an anonymous array of C<CPAN::Mirrored::By> objects to +ping. + +The optional argument C<SEEN> is a hash reference used to track the +mirrors you've already pinged. + +The optional argument C<CALLBACK> is a subroutine reference to call +after each ping. It gets the C<CPAN::Mirrored::By> object after each +ping. + +=cut + +sub get_mirrors_timings { + my( $self, $mirror_list, $seen, $callback, %args ) = @_; + + $seen = {} unless defined $seen; + croak "The mirror list argument must be an array reference" + unless ref $mirror_list eq ref []; + croak "The seen argument must be a hash reference" + unless ref $seen eq ref {}; + croak "callback must be a subroutine" + if( defined $callback and ref $callback ne ref sub {} ); + + my $timings = []; + for my $m ( @$mirror_list ) { + $seen->{$m->hostname} = $m; + next unless eval{ $m->http }; + + if( $self->_try_a_ping( $seen, $m, ) ) { + my $ping = $m->ping(%args); + next unless defined $ping; + # printf "m %s ping %s\n", $m, $ping; + push @$timings, $m; + $callback->( $m ) if $callback; + } + else { + push @$timings, $seen->{$m->hostname} + if defined $seen->{$m->hostname}->rtt; + } + } + + my @best = sort { + if( defined $a->rtt and defined $b->rtt ) { + $a->rtt <=> $b->rtt + } + elsif( defined $a->rtt and ! defined $b->rtt ) { + return -1; + } + elsif( ! defined $a->rtt and defined $b->rtt ) { + return 1; + } + elsif( ! defined $a->rtt and ! defined $b->rtt ) { + return 0; + } + + } @$timings; + + return wantarray ? @best : \@best; +} + +=item find_best_continents( HASH_REF ); + +C<find_best_continents> goes through each continent and pings C<N> +random mirrors on that continent. It then orders the continents by +ascending median ping time. In list context, it returns the ordered list +of continent. In scalar context, it returns the same list as an +anonymous array. + +Arguments: + + n - the number of hosts to ping for each continent. Default: 3 + seen - a hashref of cached hostname ping times + verbose - true or false for noisy or quiet. Default: false + callback - a subroutine to run after each ping. + ping_cache_limit - how long, in seconds, to reuse previous ping times. + Default: 1 day + +The C<seen> hash has hostnames as keys and anonymous arrays as values. +The anonymous array is a triplet of a C<CPAN::Mirrored::By> object, a +ping time, and the epoch time for the measurement. + +The callback subroutine gets the C<CPAN::Mirrored::By> object, the ping +time, and measurement time (the same things in the C<seen> hashref) as +arguments. C<find_best_continents> doesn't care what the callback does +and ignores the return value. + +With a low value for C<N>, a single mirror might skew the results enough +to choose a worse continent. If you have that problem, try a larger +value. + +=cut + +sub find_best_continents { + my ($self, %args) = @_; + + $args{n} ||= 3; + $args{verbose} = 0 unless defined $args{verbose}; + $args{seen} = {} unless defined $args{seen}; + croak "The seen argument must be a hash reference" + unless ref $args{seen} eq ref {}; + $args{ping_cache_limit} = 24 * 60 * 60 + unless defined $args{ping_cache_limit}; + croak "callback must be a subroutine" + if( defined $args{callback} and ref $args{callback} ne ref sub {} ); + + my %medians; + CONT: for my $c ( $self->continents ) { + my @mirrors = $self->mirrors( $self->countries($c) ); + printf "Testing %s (%d mirrors)\n", $c, scalar @mirrors + if $args{verbose}; + + next CONT unless @mirrors; + my $n = (@mirrors < $args{n}) ? @mirrors : $args{n}; + + my @tests; + my $tries = 0; + RANDOM: while ( @mirrors && @tests < $n && $tries++ < 15 ) { + my $m = splice( @mirrors, int(rand(@mirrors)), 1 ); + if( $self->_try_a_ping( + $args{seen}, $m, $args{ping_cache_limit} + )) { + $self->get_mirrors_timings( + [ $m ], + $args{seen}, + $args{callback}, + %args, + ); + next RANDOM unless defined $args{seen}{$m->hostname}->rtt; + } + printf "(%s -> %0.2f ms)", + $m->hostname, + join ' ', 1000 * $args{seen}{$m->hostname}->rtt + if $args{verbose}; + + push @tests, $args{seen}{$m->hostname}->rtt; + } + + my $median = $self->_get_median_ping_time( \@tests, $args{verbose} ); + $medians{$c} = $median if defined $median; + } + + my @best_cont = sort { $medians{$a} <=> $medians{$b} } keys %medians; + + if ( $args{verbose} ) { + print "Median result by continent:\n"; + if ( @best_cont ) { + for my $c ( @best_cont ) { + printf( " %7.2f ms %s\n", $medians{$c}*1000, $c ); + } + } else { + print " **** No results found ****\n" + } + } + + return wantarray ? @best_cont : $best_cont[0]; +} + +# retry if +sub _try_a_ping { + my ($self, $seen, $mirror, $ping_cache_limit ) = @_; + + ( ! exists $seen->{$mirror->hostname} + or + ! defined $seen->{$mirror->hostname}->rtt + or + ! defined $ping_cache_limit + or + time - $seen->{$mirror->hostname}->ping_time + > $ping_cache_limit + ) +} + +sub _get_median_ping_time { + my ($self, $tests, $verbose ) = @_; + + my @sorted = sort { $a <=> $b } @$tests; + + my $median = do { + if ( @sorted == 0 ) { undef } + elsif ( @sorted == 1 ) { $sorted[0] } + elsif ( @sorted % 2 ) { $sorted[ int(@sorted / 2) ] } + else { + my $mid_high = int(@sorted/2); + ($sorted[$mid_high-1] + $sorted[$mid_high])/2; + } + }; + + if ($verbose){ + if ($median) { + printf " => median time: %.2f ms\n", $median * 1000 + } else { + printf " => **** no median time ****\n"; + } + } + + return $median; +} + +# Adapted from Parse::CPAN::MirroredBy by Adam Kennedy +sub _parse { + my ($self, $file, $handle) = @_; + my $output = $self->{mirrors}; + my $geo = $self->{geography}; + + local $/ = "\012"; + my $line = 0; + my $mirror = undef; + while ( 1 ) { + # Next line + my $string = <$handle>; + last if ! defined $string; + $line = $line + 1; + + # Remove the useless lines + chomp( $string ); + next if $string =~ /^\s*$/; + next if $string =~ /^\s*#/; + + # Hostname or property? + if ( $string =~ /^\s/ ) { + # Property + unless ( $string =~ /^\s+(\w+)\s+=\s+\"(.*)\"$/ ) { + croak("Invalid property on line $line"); + } + my ($prop, $value) = ($1,$2); + $mirror ||= {}; + if ( $prop eq 'dst_location' ) { + my (@location,$continent,$country); + @location = (split /\s*,\s*/, $value) + and ($continent, $country) = @location[-1,-2]; + $continent =~ s/\s\(.*//; + $continent =~ s/\W+$//; # if Jarkko doesn't know latitude/longitude + $geo->{$continent}{$country} = 1 if $continent && $country; + $mirror->{continent} = $continent || "unknown"; + $mirror->{country} = $country || "unknown"; + } + elsif ( $prop eq 'dst_http' ) { + $mirror->{http} = $value; + } + elsif ( $prop eq 'dst_ftp' ) { + $mirror->{ftp} = $value; + } + elsif ( $prop eq 'dst_rsync' ) { + $mirror->{rsync} = $value; + } + else { + $prop =~ s/^dst_//; + $mirror->{$prop} = $value; + } + } else { + # Hostname + unless ( $string =~ /^([\w\.-]+)\:\s*$/ ) { + croak("Invalid host name on line $line"); + } + my $current = $mirror; + $mirror = { hostname => "$1" }; + if ( $current ) { + push @$output, CPAN::Mirrored::By->new($current); + } + } + } + if ( $mirror ) { + push @$output, CPAN::Mirrored::By->new($mirror); + } + + return; +} + +#--------------------------------------------------------------------------# + +package CPAN::Mirrored::By; +use strict; +use Net::Ping (); + +sub new { + my($self,$arg) = @_; + $arg ||= {}; + bless $arg, $self; +} +sub hostname { shift->{hostname} } +sub continent { shift->{continent} } +sub country { shift->{country} } +sub http { shift->{http} || '' } +sub ftp { shift->{ftp} || '' } +sub rsync { shift->{rsync} || '' } +sub rtt { shift->{rtt} } +sub ping_time { shift->{ping_time} } + +sub url { + my $self = shift; + return $self->{http} || $self->{ftp}; +} + +sub ping { + my($self, %args) = @_; + + my $external_ping = $args{external_ping}; + if ($external_ping) { + eval { require Net::Ping::External } + or die "Net::Ping::External required to use external ping command"; + } + my $ping = Net::Ping->new( + $external_ping ? 'external' : $^O eq 'VMS' ? 'icmp' : 'tcp', + 1 + ); + my ($proto) = $self->url =~ m{^([^:]+)}; + my $port = $proto eq 'http' ? 80 : 21; + return unless $port; + + if ( $ping->can('port_number') ) { + $ping->port_number($port); + } + else { + $ping->{'port_num'} = $port; + } + + $ping->hires(1) if $ping->can('hires'); + my ($alive,$rtt) = eval { $ping->ping($self->hostname); }; + my $verbose = $args{verbose}; + if ($verbose && !$alive) { + printf "(host %s not alive)", $self->hostname; + } + + $self->{rtt} = $alive ? $rtt : undef; + $self->{ping_time} = time; + + $self->rtt; +} + + +1; + +=back + +=head1 AUTHOR + +Andreas Koenig C<< <andk@cpan.org> >>, David Golden C<< <dagolden@cpan.org> >>, +brian d foy C<< <bdfoy@cpan.org> >> + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See L<http://www.perl.com/perl/misc/Artistic.html> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Module.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Module.pm new file mode 100644 index 0000000000000000000000000000000000000000..62ca42caf003df8389c8749f289d5f181703d3a3 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Module.pm @@ -0,0 +1,702 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Module; +use strict; +@CPAN::Module::ISA = qw(CPAN::InfoObj); + +use vars qw( + $VERSION +); +$VERSION = "5.5003"; + +BEGIN { + # alarm() is not implemented in perl 5.6.x and earlier under Windows + *ALARM_IMPLEMENTED = sub () { $] >= 5.007 || $^O !~ /MSWin/ }; +} + +# Accessors +#-> sub CPAN::Module::userid +sub userid { + my $self = shift; + my $ro = $self->ro; + return unless $ro; + return $ro->{userid} || $ro->{CPAN_USERID}; +} +#-> sub CPAN::Module::description +sub description { + my $self = shift; + my $ro = $self->ro or return ""; + $ro->{description} +} + +#-> sub CPAN::Module::distribution +sub distribution { + my($self) = @_; + CPAN::Shell->expand("Distribution",$self->cpan_file); +} + +#-> sub CPAN::Module::_is_representative_module +sub _is_representative_module { + my($self) = @_; + return $self->{_is_representative_module} if defined $self->{_is_representative_module}; + my $pm = $self->cpan_file or return $self->{_is_representative_module} = 0; + $pm =~ s|.+/||; + $pm =~ s{\.(?:tar\.(bz2|gz|Z)|t(?:gz|bz)|zip)$}{}i; # see base_id + $pm =~ s|-\d+\.\d+.+$||; + $pm =~ s|-[\d\.]+$||; + $pm =~ s/-/::/g; + $self->{_is_representative_module} = $pm eq $self->{ID} ? 1 : 0; + # warn "DEBUG: $pm eq $self->{ID} => $self->{_is_representative_module}"; + $self->{_is_representative_module}; +} + +#-> sub CPAN::Module::undelay +sub undelay { + my $self = shift; + delete $self->{later}; + if ( my $dist = CPAN::Shell->expand("Distribution", $self->cpan_file) ) { + $dist->undelay; + } +} + +# mark as dirty/clean +#-> sub CPAN::Module::color_cmd_tmps ; +sub color_cmd_tmps { + my($self) = shift; + my($depth) = shift || 0; + my($color) = shift || 0; + my($ancestors) = shift || []; + # a module needs to recurse to its cpan_file + + return if exists $self->{incommandcolor} + && $color==1 + && $self->{incommandcolor}==$color; + return if $color==0 && !$self->{incommandcolor}; + if ($color>=1) { + if ( $self->uptodate ) { + $self->{incommandcolor} = $color; + return; + } elsif (my $have_version = $self->available_version) { + # maybe what we have is good enough + if (@$ancestors) { + my $who_asked_for_me = $ancestors->[-1]; + my $obj = CPAN::Shell->expandany($who_asked_for_me); + if (0) { + } elsif ($obj->isa("CPAN::Bundle")) { + # bundles cannot specify a minimum version + return; + } elsif ($obj->isa("CPAN::Distribution")) { + if (my $prereq_pm = $obj->prereq_pm) { + for my $k (keys %$prereq_pm) { + if (my $want_version = $prereq_pm->{$k}{$self->id}) { + if (CPAN::Version->vcmp($have_version,$want_version) >= 0) { + $self->{incommandcolor} = $color; + return; + } + } + } + } + } + } + } + } else { + $self->{incommandcolor} = $color; # set me before recursion, + # so we can break it + } + if ($depth>=$CPAN::MAX_RECURSION) { + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } + } + # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; + + if ( my $dist = CPAN::Shell->expand("Distribution", $self->cpan_file) ) { + $dist->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]); + } + # unreached code? + # if ($color==0) { + # delete $self->{badtestcnt}; + # } + $self->{incommandcolor} = $color; +} + +#-> sub CPAN::Module::as_glimpse ; +sub as_glimpse { + my($self) = @_; + my(@m); + my $class = ref($self); + $class =~ s/^CPAN:://; + my $color_on = ""; + my $color_off = ""; + if ( + $CPAN::Shell::COLOR_REGISTERED + && + $CPAN::META->has_inst("Term::ANSIColor") + && + $self->description + ) { + $color_on = Term::ANSIColor::color("green"); + $color_off = Term::ANSIColor::color("reset"); + } + my $uptodateness = " "; + unless ($class eq "Bundle") { + my $u = $self->uptodate; + $uptodateness = $u ? "=" : "<" if defined $u; + }; + my $id = do { + my $d = $self->distribution; + $d ? $d -> pretty_id : $self->cpan_userid; + }; + push @m, sprintf("%-7s %1s %s%-22s%s (%s)\n", + $class, + $uptodateness, + $color_on, + $self->id, + $color_off, + $id, + ); + join "", @m; +} + +#-> sub CPAN::Module::dslip_status +sub dslip_status { + my($self) = @_; + my($stat); + # development status + @{$stat->{D}}{qw,i c a b R M S,} = qw,idea + pre-alpha alpha beta released + mature standard,; + # support level + @{$stat->{S}}{qw,m d u n a,} = qw,mailing-list + developer comp.lang.perl.* + none abandoned,; + # language + @{$stat->{L}}{qw,p c + o h,} = qw,perl C C++ other hybrid,; + # interface + @{$stat->{I}}{qw,f r O p h n,} = qw,functions + references+ties + object-oriented pragma + hybrid none,; + # public licence + @{$stat->{P}}{qw,p g l b a 2 o d r n,} = qw,Standard-Perl + GPL LGPL + BSD Artistic Artistic_2 + open-source + distribution_allowed + restricted_distribution + no_licence,; + for my $x (qw(d s l i p)) { + $stat->{$x}{' '} = 'unknown'; + $stat->{$x}{'?'} = 'unknown'; + } + my $ro = $self->ro; + return +{} unless $ro && $ro->{statd}; + return { + D => $ro->{statd}, + S => $ro->{stats}, + L => $ro->{statl}, + I => $ro->{stati}, + P => $ro->{statp}, + DV => $stat->{D}{$ro->{statd}}, + SV => $stat->{S}{$ro->{stats}}, + LV => $stat->{L}{$ro->{statl}}, + IV => $stat->{I}{$ro->{stati}}, + PV => $stat->{P}{$ro->{statp}}, + }; +} + +#-> sub CPAN::Module::as_string ; +sub as_string { + my($self) = @_; + my(@m); + CPAN->debug("$self entering as_string") if $CPAN::DEBUG; + my $class = ref($self); + $class =~ s/^CPAN:://; + local($^W) = 0; + push @m, $class, " id = $self->{ID}\n"; + my $sprintf = " %-12s %s\n"; + push @m, sprintf($sprintf, 'DESCRIPTION', $self->description) + if $self->description; + my $sprintf2 = " %-12s %s (%s)\n"; + my($userid); + $userid = $self->userid; + if ( $userid ) { + my $author; + if ($author = CPAN::Shell->expand('Author',$userid)) { + my $email = ""; + my $m; # old perls + if ($m = $author->email) { + $email = " <$m>"; + } + push @m, sprintf( + $sprintf2, + 'CPAN_USERID', + $userid, + $author->fullname . $email + ); + } + } + push @m, sprintf($sprintf, 'CPAN_VERSION', $self->cpan_version) + if $self->cpan_version; + if (my $cpan_file = $self->cpan_file) { + push @m, sprintf($sprintf, 'CPAN_FILE', $cpan_file); + if (my $dist = CPAN::Shell->expand("Distribution",$cpan_file)) { + my $upload_date = $dist->upload_date; + if ($upload_date) { + push @m, sprintf($sprintf, 'UPLOAD_DATE', $upload_date); + } + } + } + my $sprintf3 = " %-12s %1s%1s%1s%1s%1s (%s,%s,%s,%s,%s)\n"; + my $dslip = $self->dslip_status; + push @m, sprintf( + $sprintf3, + 'DSLIP_STATUS', + @{$dslip}{qw(D S L I P DV SV LV IV PV)}, + ) if $dslip->{D}; + my $local_file = $self->inst_file; + unless ($self->{MANPAGE}) { + my $manpage; + if ($local_file) { + $manpage = $self->manpage_headline($local_file); + } else { + # If we have already untarred it, we should look there + my $dist = $CPAN::META->instance('CPAN::Distribution', + $self->cpan_file); + # warn "dist[$dist]"; + # mff=manifest file; mfh=manifest handle + my($mff,$mfh); + if ( + $dist->{build_dir} + and + (-f ($mff = File::Spec->catfile($dist->{build_dir}, "MANIFEST"))) + and + $mfh = FileHandle->new($mff) + ) { + CPAN->debug("mff[$mff]") if $CPAN::DEBUG; + my $lfre = $self->id; # local file RE + $lfre =~ s/::/./g; + $lfre .= "\\.pm\$"; + my($lfl); # local file file + local $/ = "\n"; + my(@mflines) = <$mfh>; + for (@mflines) { + s/^\s+//; + s/\s.*//s; + } + while (length($lfre)>5 and !$lfl) { + ($lfl) = grep /$lfre/, @mflines; + CPAN->debug("lfl[$lfl]lfre[$lfre]") if $CPAN::DEBUG; + $lfre =~ s/.+?\.//; + } + $lfl =~ s/\s.*//; # remove comments + $lfl =~ s/\s+//g; # chomp would maybe be too system-specific + my $lfl_abs = File::Spec->catfile($dist->{build_dir},$lfl); + # warn "lfl_abs[$lfl_abs]"; + if (-f $lfl_abs) { + $manpage = $self->manpage_headline($lfl_abs); + } + } + } + $self->{MANPAGE} = $manpage if $manpage; + } + my($item); + for $item (qw/MANPAGE/) { + push @m, sprintf($sprintf, $item, $self->{$item}) + if exists $self->{$item}; + } + for $item (qw/CONTAINS/) { + push @m, sprintf($sprintf, $item, join(" ",@{$self->{$item}})) + if exists $self->{$item} && @{$self->{$item}}; + } + push @m, sprintf($sprintf, 'INST_FILE', + $local_file || "(not installed)"); + push @m, sprintf($sprintf, 'INST_VERSION', + $self->inst_version) if $local_file; + if (%{$CPAN::META->{is_tested}||{}}) { # XXX needs to be methodified somehow + my $available_file = $self->available_file; + if ($available_file && $available_file ne $local_file) { + push @m, sprintf($sprintf, 'AVAILABLE_FILE', $available_file); + push @m, sprintf($sprintf, 'AVAILABLE_VERSION', $self->available_version); + } + } + join "", @m, "\n"; +} + +#-> sub CPAN::Module::manpage_headline +sub manpage_headline { + my($self,$local_file) = @_; + my(@local_file) = $local_file; + $local_file =~ s/\.pm(?!\n)\Z/.pod/; + push @local_file, $local_file; + my(@result,$locf); + for $locf (@local_file) { + next unless -f $locf; + my $fh = FileHandle->new($locf) + or $Carp::Frontend->mydie("Couldn't open $locf: $!"); + my $inpod = 0; + local $/ = "\n"; + while (<$fh>) { + $inpod = m/^=(?!head1\s+NAME\s*$)/ ? 0 : + m/^=head1\s+NAME\s*$/ ? 1 : $inpod; + next unless $inpod; + next if /^=/; + next if /^\s+$/; + chomp; + push @result, $_; + } + close $fh; + last if @result; + } + for (@result) { + s/^\s+//; + s/\s+$//; + } + join " ", @result; +} + +#-> sub CPAN::Module::cpan_file ; +# Note: also inherited by CPAN::Bundle +sub cpan_file { + my $self = shift; + # CPAN->debug(sprintf "id[%s]", $self->id) if $CPAN::DEBUG; + unless ($self->ro) { + CPAN::Index->reload; + } + my $ro = $self->ro; + if ($ro && defined $ro->{CPAN_FILE}) { + return $ro->{CPAN_FILE}; + } else { + my $userid = $self->userid; + if ( $userid ) { + if ($CPAN::META->exists("CPAN::Author",$userid)) { + my $author = $CPAN::META->instance("CPAN::Author", + $userid); + my $fullname = $author->fullname; + my $email = $author->email; + unless (defined $fullname && defined $email) { + return sprintf("Contact Author %s", + $userid, + ); + } + return "Contact Author $fullname <$email>"; + } else { + return "Contact Author $userid (Email address not available)"; + } + } else { + return "N/A"; + } + } +} + +#-> sub CPAN::Module::cpan_version ; +sub cpan_version { + my $self = shift; + + my $ro = $self->ro; + unless ($ro) { + # Can happen with modules that are not on CPAN + $ro = {}; + } + $ro->{CPAN_VERSION} = 'undef' + unless defined $ro->{CPAN_VERSION}; + $ro->{CPAN_VERSION}; +} + +#-> sub CPAN::Module::force ; +sub force { + my($self) = @_; + $self->{force_update} = 1; +} + +#-> sub CPAN::Module::fforce ; +sub fforce { + my($self) = @_; + $self->{force_update} = 2; +} + +#-> sub CPAN::Module::notest ; +sub notest { + my($self) = @_; + # $CPAN::Frontend->mywarn("XDEBUG: set notest for Module"); + $self->{notest}++; +} + +#-> sub CPAN::Module::rematein ; +sub rematein { + my($self,$meth) = @_; + $CPAN::Frontend->myprint(sprintf("Running %s for module '%s'\n", + $meth, + $self->id)); + my $cpan_file = $self->cpan_file; + if ($cpan_file eq "N/A" || $cpan_file =~ /^Contact Author/) { + $CPAN::Frontend->mywarn(sprintf qq{ + The module %s isn\'t available on CPAN. + + Either the module has not yet been uploaded to CPAN, or it is + temporary unavailable. Please contact the author to find out + more about the status. Try 'i %s'. +}, + $self->id, + $self->id, + ); + return; + } + my $pack = $CPAN::META->instance('CPAN::Distribution',$cpan_file); + $pack->called_for($self->id); + if (exists $self->{force_update}) { + if ($self->{force_update} == 2) { + $pack->fforce($meth); + } else { + $pack->force($meth); + } + } + $pack->notest($meth) if exists $self->{notest} && $self->{notest}; + + $pack->{reqtype} ||= ""; + CPAN->debug("dist-reqtype[$pack->{reqtype}]". + "self-reqtype[$self->{reqtype}]") if $CPAN::DEBUG; + if ($pack->{reqtype}) { + if ($pack->{reqtype} eq "b" && $self->{reqtype} =~ /^[rc]$/) { + $pack->{reqtype} = $self->{reqtype}; + if ( + exists $pack->{install} + && + ( + UNIVERSAL::can($pack->{install},"failed") ? + $pack->{install}->failed : + $pack->{install} =~ /^NO/ + ) + ) { + delete $pack->{install}; + $CPAN::Frontend->mywarn + ("Promoting $pack->{ID} from 'build_requires' to 'requires'"); + } + } + } else { + $pack->{reqtype} = $self->{reqtype}; + } + + my $success = eval { + $pack->$meth(); + }; + my $err = $@; + $pack->unforce if $pack->can("unforce") && exists $self->{force_update}; + $pack->unnotest if $pack->can("unnotest") && exists $self->{notest}; + delete $self->{force_update}; + delete $self->{notest}; + if ($err) { + die $err; + } + return $success; +} + +#-> sub CPAN::Module::perldoc ; +sub perldoc { shift->rematein('perldoc') } +#-> sub CPAN::Module::readme ; +sub readme { shift->rematein('readme') } +#-> sub CPAN::Module::look ; +sub look { shift->rematein('look') } +#-> sub CPAN::Module::cvs_import ; +sub cvs_import { shift->rematein('cvs_import') } +#-> sub CPAN::Module::get ; +sub get { shift->rematein('get',@_) } +#-> sub CPAN::Module::make ; +sub make { shift->rematein('make') } +#-> sub CPAN::Module::test ; +sub test { + my $self = shift; + # $self->{badtestcnt} ||= 0; + $self->rematein('test',@_); +} + +#-> sub CPAN::Module::deprecated_in_core ; +sub deprecated_in_core { + my ($self) = @_; + return unless $CPAN::META->has_inst('Module::CoreList') && Module::CoreList->can('is_deprecated'); + return Module::CoreList::is_deprecated($self->{ID}); +} + +#-> sub CPAN::Module::inst_deprecated; +# Indicates whether the *installed* version of the module is a deprecated *and* +# installed as part of the Perl core library path +sub inst_deprecated { + my ($self) = @_; + my $inst_file = $self->inst_file or return; + return $self->deprecated_in_core && $self->_in_priv_or_arch($inst_file); +} + +#-> sub CPAN::Module::uptodate ; +sub uptodate { + my ($self) = @_; + local ($_); + my $inst = $self->inst_version or return 0; + my $cpan = $self->cpan_version; + return 0 if CPAN::Version->vgt($cpan,$inst) || $self->inst_deprecated; + CPAN->debug + (join + ("", + "returning uptodate. ", + "cpan[$cpan]inst[$inst]", + )) if $CPAN::DEBUG; + return 1; +} + +# returns true if installed in privlib or archlib +sub _in_priv_or_arch { + my($self,$inst_file) = @_; + foreach my $pair ( + [qw(sitearchexp archlibexp)], + [qw(sitelibexp privlibexp)] + ) { + my ($site, $priv) = @Config::Config{@$pair}; + if ($^O eq 'VMS') { + for my $d ($site, $priv) { $d = VMS::Filespec::unixify($d) }; + } + s!/*$!!g foreach $site, $priv; + next if $site eq $priv; + + if ($priv eq substr($inst_file,0,length($priv))) { + return 1; + } + } + return 0; +} + +#-> sub CPAN::Module::install ; +sub install { + my($self) = @_; + my($doit) = 0; + if ($self->uptodate + && + not exists $self->{force_update} + ) { + $CPAN::Frontend->myprint(sprintf("%s is up to date (%s).\n", + $self->id, + $self->inst_version, + )); + } else { + $doit = 1; + } + my $ro = $self->ro; + if ($ro && $ro->{stats} && $ro->{stats} eq "a") { + $CPAN::Frontend->mywarn(qq{ +\n\n\n ***WARNING*** + The module $self->{ID} has no active maintainer (CPAN support level flag 'abandoned').\n\n\n +}); + $CPAN::Frontend->mysleep(5); + } + return $doit ? $self->rematein('install') : 1; +} +#-> sub CPAN::Module::clean ; +sub clean { shift->rematein('clean') } + +#-> sub CPAN::Module::inst_file ; +sub inst_file { + my($self) = @_; + $self->_file_in_path([@INC]); +} + +#-> sub CPAN::Module::available_file ; +sub available_file { + my($self) = @_; + my $sep = $Config::Config{path_sep}; + my $perllib = $ENV{PERL5LIB}; + $perllib = $ENV{PERLLIB} unless defined $perllib; + my @perllib = split(/$sep/,$perllib) if defined $perllib; + my @cpan_perl5inc; + if ($CPAN::Perl5lib_tempfile) { + my $yaml = CPAN->_yaml_loadfile($CPAN::Perl5lib_tempfile); + @cpan_perl5inc = @{$yaml->[0]{inc} || []}; + } + $self->_file_in_path([@cpan_perl5inc,@perllib,@INC]); +} + +#-> sub CPAN::Module::file_in_path ; +sub _file_in_path { + my($self,$path) = @_; + my($dir,@packpath); + @packpath = split /::/, $self->{ID}; + $packpath[-1] .= ".pm"; + if (@packpath == 1 && $packpath[0] eq "readline.pm") { + unshift @packpath, "Term", "ReadLine"; # historical reasons + } + foreach $dir (@$path) { + my $pmfile = File::Spec->catfile($dir,@packpath); + if (-f $pmfile) { + return $pmfile; + } + } + return; +} + +#-> sub CPAN::Module::xs_file ; +sub xs_file { + my($self) = @_; + my($dir,@packpath); + @packpath = split /::/, $self->{ID}; + push @packpath, $packpath[-1]; + $packpath[-1] .= "." . $Config::Config{'dlext'}; + foreach $dir (@INC) { + my $xsfile = File::Spec->catfile($dir,'auto',@packpath); + if (-f $xsfile) { + return $xsfile; + } + } + return; +} + +#-> sub CPAN::Module::inst_version ; +sub inst_version { + my($self) = @_; + my $parsefile = $self->inst_file or return; + my $have = $self->parse_version($parsefile); + $have; +} + +#-> sub CPAN::Module::inst_version ; +sub available_version { + my($self) = @_; + my $parsefile = $self->available_file or return; + my $have = $self->parse_version($parsefile); + $have; +} + +#-> sub CPAN::Module::parse_version ; +sub parse_version { + my($self,$parsefile) = @_; + if (ALARM_IMPLEMENTED) { + my $timeout = (exists($CPAN::Config{'version_timeout'})) + ? $CPAN::Config{'version_timeout'} + : 15; + alarm($timeout); + } + my $have = eval { + local $SIG{ALRM} = sub { die "alarm\n" }; + MM->parse_version($parsefile); + }; + if ($@) { + $CPAN::Frontend->mywarn("Error while parsing version number in file '$parsefile'\n"); + } + alarm(0) if ALARM_IMPLEMENTED; + my $leastsanity = eval { defined $have && length $have; }; + $have = "undef" unless $leastsanity; + $have =~ s/^ //; # since the %vd hack these two lines here are needed + $have =~ s/ $//; # trailing whitespace happens all the time + + $have = CPAN::Version->readable($have); + + $have =~ s/\s*//g; # stringify to float around floating point issues + $have; # no stringify needed, \s* above matches always +} + +#-> sub CPAN::Module::reports +sub reports { + my($self) = @_; + $self->distribution->reports; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Nox.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Nox.pm new file mode 100644 index 0000000000000000000000000000000000000000..f7ed4a38afb534618475328e3dc0680ed2f7a00a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Nox.pm @@ -0,0 +1,52 @@ +package CPAN::Nox; +use strict; +use vars qw($VERSION @EXPORT); + +BEGIN{ + $CPAN::Suppress_readline=1 unless defined $CPAN::term; +} + +use Exporter (); +@CPAN::ISA = ('Exporter'); +use CPAN; + +$VERSION = "5.5001"; +$CPAN::META->has_inst('Digest::MD5','no'); +$CPAN::META->has_inst('LWP','no'); +$CPAN::META->has_inst('Compress::Zlib','no'); +@EXPORT = @CPAN::EXPORT; + +*AUTOLOAD = \&CPAN::AUTOLOAD; + +1; + +__END__ + +=head1 NAME + +CPAN::Nox - Wrapper around CPAN.pm without using any XS module + +=head1 SYNOPSIS + +Interactive mode: + + perl -MCPAN::Nox -e shell; + +=head1 DESCRIPTION + +This package has the same functionality as CPAN.pm, but tries to +prevent the usage of compiled extensions during its own +execution. Its primary purpose is a rescue in case you upgraded perl +and broke binary compatibility somehow. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<CPAN> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Plugin.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Plugin.pm new file mode 100644 index 0000000000000000000000000000000000000000..458d87aa2ecfc84b70373b8277b394a276becf49 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Plugin.pm @@ -0,0 +1,145 @@ +package CPAN::Plugin; + +use strict; +use warnings; + +our $VERSION = '0.97'; + +require CPAN; + +###################################################################### + +sub new { # ; + my ($class, %params) = @_; + + my $self = +{ + (ref $class ? (%$class) : ()), + %params, + }; + + $self = bless $self, ref $class ? ref $class : $class; + + unless (ref $class) { + local $_; + no warnings 'once'; + $CPAN::META->use_inst ($_) for $self->plugin_requires; + } + + $self; +} + +###################################################################### +sub plugin_requires { # ; +} + +###################################################################### +sub distribution_object { # ; + my ($self) = @_; + $self->{distribution_object}; +} + +###################################################################### +sub distribution { # ; + my ($self) = @_; + + my $distribution = $self->distribution_object->id; + CPAN::Shell->expand("Distribution",$distribution) + or $self->frontend->mydie("Unknowns distribution '$distribution'\n"); +} + +###################################################################### +sub distribution_info { # ; + my ($self) = @_; + + CPAN::DistnameInfo->new ($self->distribution->id); +} + +###################################################################### +sub build_dir { # ; + my ($self) = @_; + + my $build_dir = $self->distribution->{build_dir} + or $self->frontend->mydie("Distribution has not been built yet, cannot proceed"); +} + +###################################################################### +sub is_xs { # + my ($self) = @_; + + my @xs = glob File::Spec->catfile ($self->build_dir, '*.xs'); # quick try + + unless (@xs) { + require ExtUtils::Manifest; + my $manifest_file = File::Spec->catfile ($self->build_dir, "MANIFEST"); + my $manifest = ExtUtils::Manifest::maniread($manifest_file); + @xs = grep /\.xs$/, keys %$manifest; + } + + scalar @xs; +} + +###################################################################### + +package CPAN::Plugin; + +1; + +__END__ + +=pod + +=head1 NAME + +CPAN::Plugin - Base class for CPAN shell extensions + +=head1 SYNOPSIS + + package CPAN::Plugin::Flurb; + use parent 'CPAN::Plugin'; + + sub post_test { + my ($self, $distribution_object) = @_; + $self = $self->new (distribution_object => $distribution_object); + ...; + } + +=head1 DESCRIPTION + +=head2 Alpha Status + +The plugin system in the CPAN shell was introduced in version 2.07 and +is still considered experimental. + +=head2 How Plugins work? + +See L<CPAN/"Plugin support">. + +=head1 METHODS + +=head2 plugin_requires + +returns list of packages given plugin requires for functionality. +This list is evaluated using C<< CPAN->use_inst >> method. + +=head2 distribution_object + +Get current distribution object. + +=head2 distribution + +=head2 distribution_info + +=head2 build_dir + +Simple delegatees for misc parameters derived from distribution + +=head2 is_xs + +Predicate to detect whether package contains XS. + +=head1 AUTHOR + +Branislav Zahradnik <barney@cpan.org> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Prompt.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Prompt.pm new file mode 100644 index 0000000000000000000000000000000000000000..7a4e2d81e132a2b77aa4474646e47e4098856a21 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Prompt.pm @@ -0,0 +1,29 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::Prompt; +use overload '""' => "as_string"; +use vars qw($prompt); +use vars qw( + $VERSION +); +$VERSION = "5.5"; + + +$prompt = "cpan> "; +$CPAN::CurrentCommandId ||= 0; +sub new { + bless {}, shift; +} +sub as_string { + my $word = "cpan"; + unless ($CPAN::META->{LOCK}) { + $word = "nolock_cpan"; + } + if ($CPAN::Config->{commandnumber_in_prompt}) { + sprintf "$word\[%d]> ", $CPAN::CurrentCommandId; + } else { + "$word> "; + } +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Queue.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Queue.pm new file mode 100644 index 0000000000000000000000000000000000000000..259e47e05f78fdfe9c24938c51689d4fafe3a434 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Queue.pm @@ -0,0 +1,234 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +use strict; +package CPAN::Queue::Item; + +# CPAN::Queue::Item::new ; +sub new { + my($class,@attr) = @_; + my $self = bless { @attr }, $class; + return $self; +} + +sub as_string { + my($self) = @_; + $self->{qmod}; +} + +# r => requires, b => build_requires, c => commandline +sub reqtype { + my($self) = @_; + $self->{reqtype}; +} + +sub optional { + my($self) = @_; + $self->{optional}; +} + +package CPAN::Queue; + +# One use of the queue is to determine if we should or shouldn't +# announce the availability of a new CPAN module + +# Now we try to use it for dependency tracking. For that to happen +# we need to draw a dependency tree and do the leaves first. This can +# easily be reached by running CPAN.pm recursively, but we don't want +# to waste memory and run into deep recursion. So what we can do is +# this: + +# CPAN::Queue is the package where the queue is maintained. Dependencies +# often have high priority and must be brought to the head of the queue, +# possibly by jumping the queue if they are already there. My first code +# attempt tried to be extremely correct. Whenever a module needed +# immediate treatment, I either unshifted it to the front of the queue, +# or, if it was already in the queue, I spliced and let it bypass the +# others. This became a too correct model that made it impossible to put +# an item more than once into the queue. Why would you need that? Well, +# you need temporary duplicates as the manager of the queue is a loop +# that +# +# (1) looks at the first item in the queue without shifting it off +# +# (2) cares for the item +# +# (3) removes the item from the queue, *even if its agenda failed and +# even if the item isn't the first in the queue anymore* (that way +# protecting against never ending queues) +# +# So if an item has prerequisites, the installation fails now, but we +# want to retry later. That's easy if we have it twice in the queue. +# +# I also expect insane dependency situations where an item gets more +# than two lives in the queue. Simplest example is triggered by 'install +# Foo Foo Foo'. People make this kind of mistakes and I don't want to +# get in the way. I wanted the queue manager to be a dumb servant, not +# one that knows everything. +# +# Who would I tell in this model that the user wants to be asked before +# processing? I can't attach that information to the module object, +# because not modules are installed but distributions. So I'd have to +# tell the distribution object that it should ask the user before +# processing. Where would the question be triggered then? Most probably +# in CPAN::Distribution::rematein. + +use vars qw{ @All $VERSION }; +$VERSION = "5.5003"; + +# CPAN::Queue::queue_item ; +sub queue_item { + my($class,@attr) = @_; + my $item = "$class\::Item"->new(@attr); + $class->qpush($item); + return 1; +} + +# CPAN::Queue::qpush ; +sub qpush { + my($class,$obj) = @_; + push @All, $obj; + CPAN->debug(sprintf("in new All[%s]", + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @All), + )) if $CPAN::DEBUG; +} + +# CPAN::Queue::first ; +sub first { + my $obj = $All[0]; + $obj; +} + +# CPAN::Queue::delete_first ; +sub delete_first { + my($class,$what) = @_; + my $i; + for my $i (0..$#All) { + if ( $All[$i]->{qmod} eq $what ) { + splice @All, $i, 1; + last; + } + } + CPAN->debug(sprintf("after delete_first mod[%s] All[%s]", + $what, + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @All) + )) if $CPAN::DEBUG; +} + +# CPAN::Queue::jumpqueue ; +sub jumpqueue { + my $class = shift; + my @what = @_; + CPAN->debug(sprintf("before jumpqueue All[%s] what[%s]", + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @All), + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @what), + )) if $CPAN::DEBUG; + unless (defined $what[0]{reqtype}) { + # apparently it was not the Shell that sent us this enquiry, + # treat it as commandline + $what[0]{reqtype} = "c"; + } + my $inherit_reqtype = $what[0]{reqtype} =~ /^(c|r)$/ ? "r" : "b"; + WHAT: for my $what_tuple (@what) { + my($qmod,$reqtype,$optional) = @$what_tuple{qw(qmod reqtype optional)}; + if ($reqtype eq "r" + && + $inherit_reqtype eq "b" + ) { + $reqtype = "b"; + } + my $jumped = 0; + for (my $i=0; $i<$#All;$i++) { #prevent deep recursion + if ($All[$i]{qmod} eq $qmod) { + $jumped++; + } + } + # high jumped values are normal for popular modules when + # dealing with large bundles: XML::Simple, + # namespace::autoclean, UNIVERSAL::require + CPAN->debug("qmod[$qmod]jumped[$jumped]") if $CPAN::DEBUG; + my $obj = "$class\::Item"->new( + qmod => $qmod, + reqtype => $reqtype, + optional => !! $optional, + ); + unshift @All, $obj; + } + CPAN->debug(sprintf("after jumpqueue All[%s]", + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @All) + )) if $CPAN::DEBUG; +} + +# CPAN::Queue::exists ; +sub exists { + my($self,$what) = @_; + my @all = map { $_->{qmod} } @All; + my $exists = grep { $_->{qmod} eq $what } @All; + # warn "in exists what[$what] all[@all] exists[$exists]"; + $exists; +} + +# CPAN::Queue::delete ; +sub delete { + my($self,$mod) = @_; + @All = grep { $_->{qmod} ne $mod } @All; + CPAN->debug(sprintf("after delete mod[%s] All[%s]", + $mod, + join("",map {sprintf " %s\[%s][%s]\n",$_->{qmod},$_->{reqtype},$_->{optional}} @All) + )) if $CPAN::DEBUG; +} + +# CPAN::Queue::nullify_queue ; +sub nullify_queue { + @All = (); +} + +# CPAN::Queue::size ; +sub size { + return scalar @All; +} + +sub reqtype_of { + my($self,$mod) = @_; + my $best = ""; + for my $item (grep { $_->{qmod} eq $mod } @All) { + my $c = $item->{reqtype}; + if ($c eq "c") { + $best = $c; + last; + } elsif ($c eq "r") { + $best = $c; + } elsif ($c eq "b") { + if ($best eq "") { + $best = $c; + } + } else { + die "Panic: in reqtype_of: reqtype[$c] seen, should never happen"; + } + } + return $best; +} + +sub iterator { + my $i = 0; + return sub { + until ($All[$i] || $i > $#All) { + $i++; + } + return if $i > $#All; + return $All[$i++] + }; +} + +1; + +__END__ + +=head1 NAME + +CPAN::Queue - internal queue support for CPAN.pm + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Shell.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Shell.pm new file mode 100644 index 0000000000000000000000000000000000000000..4140fb8af232202fdefe4017043c7b6d27c1855a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Shell.pm @@ -0,0 +1,2072 @@ +package CPAN::Shell; +use strict; + +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: + +use vars qw( + $ADVANCED_QUERY + $AUTOLOAD + $COLOR_REGISTERED + $Help + $autoload_recursion + $reload + @ISA + @relo + $VERSION + ); +@relo = ( + "CPAN.pm", + "CPAN/Author.pm", + "CPAN/CacheMgr.pm", + "CPAN/Complete.pm", + "CPAN/Debug.pm", + "CPAN/DeferredCode.pm", + "CPAN/Distribution.pm", + "CPAN/Distroprefs.pm", + "CPAN/Distrostatus.pm", + "CPAN/Exception/RecursiveDependency.pm", + "CPAN/Exception/yaml_not_installed.pm", + "CPAN/FirstTime.pm", + "CPAN/FTP.pm", + "CPAN/FTP/netrc.pm", + "CPAN/HandleConfig.pm", + "CPAN/Index.pm", + "CPAN/InfoObj.pm", + "CPAN/Kwalify.pm", + "CPAN/LWP/UserAgent.pm", + "CPAN/Module.pm", + "CPAN/Prompt.pm", + "CPAN/Queue.pm", + "CPAN/Reporter/Config.pm", + "CPAN/Reporter/History.pm", + "CPAN/Reporter/PrereqCheck.pm", + "CPAN/Reporter.pm", + "CPAN/Shell.pm", + "CPAN/SQLite.pm", + "CPAN/Tarzip.pm", + "CPAN/Version.pm", + ); +$VERSION = "5.5009"; +# record the initial timestamp for reload. +$reload = { map {$INC{$_} ? ($_,(stat $INC{$_})[9]) : ()} @relo }; +@CPAN::Shell::ISA = qw(CPAN::Debug); +use Cwd qw(chdir); +use Carp (); +$COLOR_REGISTERED ||= 0; +$Help = { + '?' => \"help", + '!' => "eval the rest of the line as perl", + a => "whois author", + autobundle => "write inventory into a bundle file", + b => "info about bundle", + bye => \"quit", + clean => "clean up a distribution's build directory", + # cvs_import + d => "info about a distribution", + # dump + exit => \"quit", + failed => "list all failed actions within current session", + fforce => "redo a command from scratch", + force => "redo a command", + get => "download a distribution", + h => \"help", + help => "overview over commands; 'help ...' explains specific commands", + hosts => "statistics about recently used hosts", + i => "info about authors/bundles/distributions/modules", + install => "install a distribution", + install_tested => "install all distributions tested OK", + is_tested => "list all distributions tested OK", + look => "open a subshell in a distribution's directory", + ls => "list distributions matching a fileglob", + m => "info about a module", + make => "make/build a distribution", + mkmyconfig => "write current config into a CPAN/MyConfig.pm file", + notest => "run a (usually install) command but leave out the test phase", + o => "'o conf ...' for config stuff; 'o debug ...' for debugging", + perldoc => "try to get a manpage for a module", + q => \"quit", + quit => "leave the cpan shell", + r => "review upgradable modules", + readme => "display the README of a distro with a pager", + recent => "show recent uploads to the CPAN", + # recompile + reload => "'reload cpan' or 'reload index'", + report => "test a distribution and send a test report to cpantesters", + reports => "info about reported tests from cpantesters", + # scripts + # smoke + test => "test a distribution", + u => "display uninstalled modules", + upgrade => "combine 'r' command with immediate installation", + }; +{ + $autoload_recursion ||= 0; + + #-> sub CPAN::Shell::AUTOLOAD ; + sub AUTOLOAD { ## no critic + $autoload_recursion++; + my($l) = $AUTOLOAD; + my $class = shift(@_); + # warn "autoload[$l] class[$class]"; + $l =~ s/.*:://; + if ($CPAN::Signal) { + warn "Refusing to autoload '$l' while signal pending"; + $autoload_recursion--; + return; + } + if ($autoload_recursion > 1) { + my $fullcommand = join " ", map { "'$_'" } $l, @_; + warn "Refusing to autoload $fullcommand in recursion\n"; + $autoload_recursion--; + return; + } + if ($l =~ /^w/) { + # XXX needs to be reconsidered + if ($CPAN::META->has_inst('CPAN::WAIT')) { + CPAN::WAIT->$l(@_); + } else { + $CPAN::Frontend->mywarn(qq{ +Commands starting with "w" require CPAN::WAIT to be installed. +Please consider installing CPAN::WAIT to use the fulltext index. +For this you just need to type + install CPAN::WAIT +}); + } + } else { + $CPAN::Frontend->mywarn(qq{Unknown shell command '$l'. }. + qq{Type ? for help. +}); + } + $autoload_recursion--; + } +} + + +#-> sub CPAN::Shell::h ; +sub h { + my($class,$about) = @_; + if (defined $about) { + my $help; + if (exists $Help->{$about}) { + if (ref $Help->{$about}) { # aliases + $about = ${$Help->{$about}}; + } + $help = $Help->{$about}; + } else { + $help = "No help available"; + } + $CPAN::Frontend->myprint("$about\: $help\n"); + } else { + my $filler = " " x (80 - 28 - length($CPAN::VERSION)); + $CPAN::Frontend->myprint(qq{ +Display Information $filler (ver $CPAN::VERSION) + command argument description + a,b,d,m WORD or /REGEXP/ about authors, bundles, distributions, modules + i WORD or /REGEXP/ about any of the above + ls AUTHOR or GLOB about files in the author's directory + (with WORD being a module, bundle or author name or a distribution + name of the form AUTHOR/DISTRIBUTION) + +Download, Test, Make, Install... + get download clean make clean + make make (implies get) look open subshell in dist directory + test make test (implies make) readme display these README files + install make install (implies test) perldoc display POD documentation + +Upgrade installed modules + r WORDs or /REGEXP/ or NONE report updates for some/matching/all + upgrade WORDs or /REGEXP/ or NONE upgrade some/matching/all modules + +Pragmas + force CMD try hard to do command fforce CMD try harder + notest CMD skip testing + +Other + h,? display this menu ! perl-code eval a perl command + o conf [opt] set and query options q quit the cpan shell + reload cpan load CPAN.pm again reload index load newer indices + autobundle Snapshot recent latest CPAN uploads}); +} +} + +*help = \&h; + +#-> sub CPAN::Shell::a ; +sub a { + my($self,@arg) = @_; + # authors are always UPPERCASE + for (@arg) { + $_ = uc $_ unless /=/; + } + $CPAN::Frontend->myprint($self->format_result('Author',@arg)); +} + +#-> sub CPAN::Shell::globls ; +sub globls { + my($self,$s,$pragmas) = @_; + # ls is really very different, but we had it once as an ordinary + # command in the Shell (up to rev. 321) and we could not handle + # force well then + my(@accept,@preexpand); + if ($s =~ /[\*\?\/]/) { + if ($CPAN::META->has_inst("Text::Glob")) { + if (my($au,$pathglob) = $s =~ m|(.*?)/(.*)|) { + my $rau = Text::Glob::glob_to_regex(uc $au); + CPAN::Shell->debug("au[$au]pathglob[$pathglob]rau[$rau]") + if $CPAN::DEBUG; + push @preexpand, map { $_->id . "/" . $pathglob } + CPAN::Shell->expand_by_method('CPAN::Author',['id'],"/$rau/"); + } else { + my $rau = Text::Glob::glob_to_regex(uc $s); + push @preexpand, map { $_->id } + CPAN::Shell->expand_by_method('CPAN::Author', + ['id'], + "/$rau/"); + } + } else { + $CPAN::Frontend->mydie("Text::Glob not installed, cannot proceed"); + } + } else { + push @preexpand, uc $s; + } + for (@preexpand) { + unless (/^[A-Z0-9\-]+(\/|$)/i) { + $CPAN::Frontend->mywarn("ls command rejects argument $_: not an author\n"); + next; + } + push @accept, $_; + } + my $silent = @accept>1; + my $last_alpha = ""; + my @results; + for my $a (@accept) { + my($author,$pathglob); + if ($a =~ m|(.*?)/(.*)|) { + my $a2 = $1; + $pathglob = $2; + $author = CPAN::Shell->expand_by_method('CPAN::Author', + ['id'], + $a2) + or $CPAN::Frontend->mydie("No author found for $a2\n"); + } else { + $author = CPAN::Shell->expand_by_method('CPAN::Author', + ['id'], + $a) + or $CPAN::Frontend->mydie("No author found for $a\n"); + } + if ($silent) { + my $alpha = substr $author->id, 0, 1; + my $ad; + if ($alpha eq $last_alpha) { + $ad = ""; + } else { + $ad = "[$alpha]"; + $last_alpha = $alpha; + } + $CPAN::Frontend->myprint($ad); + } + for my $pragma (@$pragmas) { + if ($author->can($pragma)) { + $author->$pragma(); + } + } + CPAN->debug("author[$author]pathglob[$pathglob]silent[$silent]") if $CPAN::DEBUG; + push @results, $author->ls($pathglob,$silent); # silent if + # more than one + # author + for my $pragma (@$pragmas) { + my $unpragma = "un$pragma"; + if ($author->can($unpragma)) { + $author->$unpragma(); + } + } + } + @results; +} + +#-> sub CPAN::Shell::local_bundles ; +sub local_bundles { + my($self,@which) = @_; + my($incdir,$bdir,$dh); + foreach $incdir ($CPAN::Config->{'cpan_home'},@INC) { + my @bbase = "Bundle"; + while (my $bbase = shift @bbase) { + $bdir = File::Spec->catdir($incdir,split /::/, $bbase); + CPAN->debug("bdir[$bdir]\@bbase[@bbase]") if $CPAN::DEBUG; + if ($dh = DirHandle->new($bdir)) { # may fail + my($entry); + for $entry ($dh->read) { + next if $entry =~ /^\./; + next unless $entry =~ /^\w+(\.pm)?(?!\n)\Z/; + if (-d File::Spec->catdir($bdir,$entry)) { + push @bbase, "$bbase\::$entry"; + } else { + next unless $entry =~ s/\.pm(?!\n)\Z//; + $CPAN::META->instance('CPAN::Bundle',"$bbase\::$entry"); + } + } + } + } + } +} + +#-> sub CPAN::Shell::b ; +sub b { + my($self,@which) = @_; + CPAN->debug("which[@which]") if $CPAN::DEBUG; + $self->local_bundles; + $CPAN::Frontend->myprint($self->format_result('Bundle',@which)); +} + +#-> sub CPAN::Shell::d ; +sub d { $CPAN::Frontend->myprint(shift->format_result('Distribution',@_));} + +#-> sub CPAN::Shell::m ; +sub m { # emacs confused here }; sub mimimimimi { # emacs in sync here + my $self = shift; + my @m = @_; + for (@m) { + if (m|(?:\w+/)*\w+\.pm$|) { # same regexp in expandany + s/.pm$//; + s|/|::|g; + } + } + $CPAN::Frontend->myprint($self->format_result('Module',@m)); +} + +#-> sub CPAN::Shell::i ; +sub i { + my($self) = shift; + my(@args) = @_; + @args = '/./' unless @args; + my(@result); + for my $type (qw/Bundle Distribution Module/) { + push @result, $self->expand($type,@args); + } + # Authors are always uppercase. + push @result, $self->expand("Author", map { uc $_ } @args); + + my $result = @result == 1 ? + $result[0]->as_string : + @result == 0 ? + "No objects found of any type for argument @args\n" : + join("", + (map {$_->as_glimpse} @result), + scalar @result, " items found\n", + ); + $CPAN::Frontend->myprint($result); +} + +#-> sub CPAN::Shell::o ; + +# CPAN::Shell::o and CPAN::HandleConfig::edit are closely related. 'o +# conf' calls through to CPAN::HandleConfig::edit. 'o conf' should +# probably have been called 'set' and 'o debug' maybe 'set debug' or +# 'debug'; 'o conf ARGS' calls ->edit in CPAN/HandleConfig.pm +sub o { + my($self,$o_type,@o_what) = @_; + $o_type ||= ""; + CPAN->debug("o_type[$o_type] o_what[".join(" | ",@o_what)."]\n"); + if ($o_type eq 'conf') { + my($cfilter); + ($cfilter) = $o_what[0] =~ m|^/(.*)/$| if @o_what; + if (!@o_what or $cfilter) { # print all things, "o conf" + $cfilter ||= ""; + my $qrfilter = eval 'qr/$cfilter/'; + if ($@) { + $CPAN::Frontend->mydie("Cannot parse commandline: $@"); + } + my($k,$v); + my $configpm = CPAN::HandleConfig->require_myconfig_or_config; + $CPAN::Frontend->myprint("\$CPAN::Config options from $configpm\:\n"); + for $k (sort keys %CPAN::HandleConfig::can) { + next unless $k =~ /$qrfilter/; + $v = $CPAN::HandleConfig::can{$k}; + $CPAN::Frontend->myprint(sprintf " %-18s [%s]\n", $k, $v); + } + $CPAN::Frontend->myprint("\n"); + for $k (sort keys %CPAN::HandleConfig::keys) { + next unless $k =~ /$qrfilter/; + CPAN::HandleConfig->prettyprint($k); + } + $CPAN::Frontend->myprint("\n"); + } else { + if (CPAN::HandleConfig->edit(@o_what)) { + } else { + $CPAN::Frontend->myprint(qq{Type 'o conf' to view all configuration }. + qq{items\n\n}); + } + } + } elsif ($o_type eq 'debug') { + my(%valid); + @o_what = () if defined $o_what[0] && $o_what[0] =~ /help/i; + if (@o_what) { + while (@o_what) { + my($what) = shift @o_what; + if ($what =~ s/^-// && exists $CPAN::DEBUG{$what}) { + $CPAN::DEBUG &= $CPAN::DEBUG ^ $CPAN::DEBUG{$what}; + next; + } + if ( exists $CPAN::DEBUG{$what} ) { + $CPAN::DEBUG |= $CPAN::DEBUG{$what}; + } elsif ($what =~ /^\d/) { + $CPAN::DEBUG = $what; + } elsif (lc $what eq 'all') { + my($max) = 0; + for (values %CPAN::DEBUG) { + $max += $_; + } + $CPAN::DEBUG = $max; + } else { + my($known) = 0; + for (keys %CPAN::DEBUG) { + next unless lc($_) eq lc($what); + $CPAN::DEBUG |= $CPAN::DEBUG{$_}; + $known = 1; + } + $CPAN::Frontend->myprint("unknown argument [$what]\n") + unless $known; + } + } + } else { + my $raw = "Valid options for debug are ". + join(", ",sort(keys %CPAN::DEBUG), 'all'). + qq{ or a number. Completion works on the options. }. + qq{Case is ignored.}; + require Text::Wrap; + $CPAN::Frontend->myprint(Text::Wrap::fill("","",$raw)); + $CPAN::Frontend->myprint("\n\n"); + } + if ($CPAN::DEBUG) { + $CPAN::Frontend->myprint("Options set for debugging ($CPAN::DEBUG):\n"); + my($k,$v); + for $k (sort {$CPAN::DEBUG{$a} <=> $CPAN::DEBUG{$b}} keys %CPAN::DEBUG) { + $v = $CPAN::DEBUG{$k}; + $CPAN::Frontend->myprint(sprintf " %-14s(%s)\n", $k, $v) + if $v & $CPAN::DEBUG; + } + } else { + $CPAN::Frontend->myprint("Debugging turned off completely.\n"); + } + } else { + $CPAN::Frontend->myprint(qq{ +Known options: + conf set or get configuration variables + debug set or get debugging options +}); + } +} + +# CPAN::Shell::paintdots_onreload +sub paintdots_onreload { + my($ref) = shift; + sub { + if ( $_[0] =~ /[Ss]ubroutine ([\w:]+) redefined/ ) { + my($subr) = $1; + ++$$ref; + local($|) = 1; + # $CPAN::Frontend->myprint(".($subr)"); + $CPAN::Frontend->myprint("."); + if ($subr =~ /\bshell\b/i) { + # warn "debug[$_[0]]"; + + # It would be nice if we could detect that a + # subroutine has actually changed, but for now we + # practically always set the GOTOSHELL global + + $CPAN::GOTOSHELL=1; + } + return; + } + warn @_; + }; +} + +#-> sub CPAN::Shell::hosts ; +sub hosts { + my($self) = @_; + my $fullstats = CPAN::FTP->_ftp_statistics(); + my $history = $fullstats->{history} || []; + my %S; # statistics + while (my $last = pop @$history) { + my $attempts = $last->{attempts} or next; + my $start; + if (@$attempts) { + $start = $attempts->[-1]{start}; + if ($#$attempts > 0) { + for my $i (0..$#$attempts-1) { + my $url = $attempts->[$i]{url} or next; + $S{no}{$url}++; + } + } + } else { + $start = $last->{start}; + } + next unless $last->{thesiteurl}; # C-C? bad filenames? + $S{start} = $start; + $S{end} ||= $last->{end}; + my $dltime = $last->{end} - $start; + my $dlsize = $last->{filesize} || 0; + my $url = ref $last->{thesiteurl} ? $last->{thesiteurl}->text : $last->{thesiteurl}; + my $s = $S{ok}{$url} ||= {}; + $s->{n}++; + $s->{dlsize} ||= 0; + $s->{dlsize} += $dlsize/1024; + $s->{dltime} ||= 0; + $s->{dltime} += $dltime; + } + my $res; + for my $url (sort keys %{$S{ok}}) { + next if $S{ok}{$url}{dltime} == 0; # div by zero + push @{$res->{ok}}, [@{$S{ok}{$url}}{qw(n dlsize dltime)}, + $S{ok}{$url}{dlsize}/$S{ok}{$url}{dltime}, + $url, + ]; + } + for my $url (sort keys %{$S{no}}) { + push @{$res->{no}}, [$S{no}{$url}, + $url, + ]; + } + my $R = ""; # report + if ($S{start} && $S{end}) { + $R .= sprintf "Log starts: %s\n", $S{start} ? scalar(localtime $S{start}) : "unknown"; + $R .= sprintf "Log ends : %s\n", $S{end} ? scalar(localtime $S{end}) : "unknown"; + } + if ($res->{ok} && @{$res->{ok}}) { + $R .= sprintf "\nSuccessful downloads: + N kB secs kB/s url\n"; + my $i = 20; + for (sort { $b->[3] <=> $a->[3] } @{$res->{ok}}) { + $R .= sprintf "%4d %8d %5d %9.1f %s\n", @$_; + last if --$i<=0; + } + } + if ($res->{no} && @{$res->{no}}) { + $R .= sprintf "\nUnsuccessful downloads:\n"; + my $i = 20; + for (sort { $b->[0] <=> $a->[0] } @{$res->{no}}) { + $R .= sprintf "%4d %s\n", @$_; + last if --$i<=0; + } + } + $CPAN::Frontend->myprint($R); +} + +# here is where 'reload cpan' is done +#-> sub CPAN::Shell::reload ; +sub reload { + my($self,$command,@arg) = @_; + $command ||= ""; + $self->debug("self[$self]command[$command]arg[@arg]") if $CPAN::DEBUG; + if ($command =~ /^cpan$/i) { + my $redef = 0; + chdir "$CPAN::iCwd" if $CPAN::iCwd; # may fail + my $failed; + MFILE: for my $f (@relo) { + next unless exists $INC{$f}; + my $p = $f; + $p =~ s/\.pm$//; + $p =~ s|/|::|g; + $CPAN::Frontend->myprint("($p"); + local($SIG{__WARN__}) = paintdots_onreload(\$redef); + $self->_reload_this($f) or $failed++; + my $v = eval "$p\::->VERSION"; + $CPAN::Frontend->myprint("v$v)"); + } + $CPAN::Frontend->myprint("\n$redef subroutines redefined\n"); + if ($failed) { + my $errors = $failed == 1 ? "error" : "errors"; + $CPAN::Frontend->mywarn("\n$failed $errors during reload. You better quit ". + "this session.\n"); + } + } elsif ($command =~ /^index$/i) { + CPAN::Index->force_reload; + } else { + $CPAN::Frontend->myprint(qq{cpan re-evals the CPAN modules +index re-reads the index files\n}); + } +} + +# reload means only load again what we have loaded before +#-> sub CPAN::Shell::_reload_this ; +sub _reload_this { + my($self,$f,$args) = @_; + CPAN->debug("f[$f]") if $CPAN::DEBUG; + return 1 unless $INC{$f}; # we never loaded this, so we do not + # reload but say OK + my $pwd = CPAN::anycwd(); + CPAN->debug("pwd[$pwd]") if $CPAN::DEBUG; + my($file); + for my $inc (@INC) { + $file = File::Spec->catfile($inc,split /\//, $f); + last if -f $file; + $file = ""; + } + CPAN->debug("file[$file]") if $CPAN::DEBUG; + my @inc = @INC; + unless ($file && -f $file) { + # this thingy is not in the INC path, maybe CPAN/MyConfig.pm? + $file = $INC{$f}; + unless (CPAN->has_inst("File::Basename")) { + @inc = File::Basename::dirname($file); + } else { + # do we ever need this? + @inc = substr($file,0,-length($f)-1); # bring in back to me! + } + } + CPAN->debug("file[$file]inc[@inc]") if $CPAN::DEBUG; + unless (-f $file) { + $CPAN::Frontend->mywarn("Found no file to reload for '$f'\n"); + return; + } + my $mtime = (stat $file)[9]; + $reload->{$f} ||= -1; + my $must_reload = $mtime != $reload->{$f}; + $args ||= {}; + $must_reload ||= $args->{reloforce}; # o conf defaults needs this + if ($must_reload) { + my $fh = FileHandle->new($file) or + $CPAN::Frontend->mydie("Could not open $file: $!"); + my $content; + { + local($/); + local $^W = 1; + $content = <$fh>; + } + CPAN->debug(sprintf("reload file[%s] content[%s...]",$file,substr($content,0,128))) + if $CPAN::DEBUG; + my $includefile; + if ($includefile = $INC{$f} and -e $includefile) { + $f = $includefile; + } + delete $INC{$f}; + local @INC = @inc; + eval "require '$f'"; + if ($@) { + warn $@; + return; + } + $reload->{$f} = $mtime; + } else { + $CPAN::Frontend->myprint("__unchanged__"); + } + return 1; +} + +#-> sub CPAN::Shell::mkmyconfig ; +sub mkmyconfig { + my($self) = @_; + if ( my $configpm = $INC{'CPAN/MyConfig.pm'} ) { + $CPAN::Frontend->myprint( + "CPAN::MyConfig already exists as $configpm.\n" . + "Running configuration again...\n" + ); + require CPAN::FirstTime; + CPAN::FirstTime::init($configpm); + } + else { + # force some missing values to be filled in with defaults + delete $CPAN::Config->{$_} + for qw/build_dir cpan_home keep_source_where histfile/; + CPAN::HandleConfig->load( make_myconfig => 1 ); + } +} + +#-> sub CPAN::Shell::_binary_extensions ; +sub _binary_extensions { + my($self) = shift @_; + my(@result,$module,%seen,%need,$headerdone); + for $module ($self->expand('Module','/./')) { + my $file = $module->cpan_file; + next if $file eq "N/A"; + next if $file =~ /^Contact Author/; + my $dist = $CPAN::META->instance('CPAN::Distribution',$file); + next if $dist->isa_perl; + next unless $module->xs_file; + local($|) = 1; + $CPAN::Frontend->myprint("."); + push @result, $module; + } +# print join " | ", @result; + $CPAN::Frontend->myprint("\n"); + return @result; +} + +#-> sub CPAN::Shell::recompile ; +sub recompile { + my($self) = shift @_; + my($module,@module,$cpan_file,%dist); + @module = $self->_binary_extensions(); + for $module (@module) { # we force now and compile later, so we + # don't do it twice + $cpan_file = $module->cpan_file; + my $pack = $CPAN::META->instance('CPAN::Distribution',$cpan_file); + $pack->force; + $dist{$cpan_file}++; + } + for $cpan_file (sort keys %dist) { + $CPAN::Frontend->myprint(" CPAN: Recompiling $cpan_file\n\n"); + my $pack = $CPAN::META->instance('CPAN::Distribution',$cpan_file); + $pack->install; + $CPAN::Signal = 0; # it's tempting to reset Signal, so we can + # stop a package from recompiling, + # e.g. IO-1.12 when we have perl5.003_10 + } +} + +#-> sub CPAN::Shell::scripts ; +sub scripts { + my($self, $arg) = @_; + $CPAN::Frontend->mywarn(">>>> experimental command, currently unsupported <<<<\n\n"); + + for my $req (qw( HTML::LinkExtor Sort::Versions List::Util )) { + unless ($CPAN::META->has_inst($req)) { + $CPAN::Frontend->mywarn(" $req not available\n"); + } + } + my $p = HTML::LinkExtor->new(); + my $indexfile = "/home/ftp/pub/PAUSE/scripts/new/index.html"; + unless (-f $indexfile) { + $CPAN::Frontend->mydie("found no indexfile[$indexfile]\n"); + } + $p->parse_file($indexfile); + my @hrefs; + my $qrarg; + if ($arg =~ s|^/(.+)/$|$1|) { + $qrarg = eval 'qr/$arg/'; # hide construct from 5.004 + } + for my $l ($p->links) { + my $tag = shift @$l; + next unless $tag eq "a"; + my %att = @$l; + my $href = $att{href}; + next unless $href =~ s|^\.\./authors/id/./../||; + if ($arg) { + if ($qrarg) { + if ($href =~ $qrarg) { + push @hrefs, $href; + } + } else { + if ($href =~ /\Q$arg\E/) { + push @hrefs, $href; + } + } + } else { + push @hrefs, $href; + } + } + # now filter for the latest version if there is more than one of a name + my %stems; + for (sort @hrefs) { + my $href = $_; + s/-v?\d.*//; + my $stem = $_; + $stems{$stem} ||= []; + push @{$stems{$stem}}, $href; + } + for (sort keys %stems) { + my $highest; + if (@{$stems{$_}} > 1) { + $highest = List::Util::reduce { + Sort::Versions::versioncmp($a,$b) > 0 ? $a : $b + } @{$stems{$_}}; + } else { + $highest = $stems{$_}[0]; + } + $CPAN::Frontend->myprint("$highest\n"); + } +} + +sub _guess_manpage { + my($self,$d,$contains,$dist) = @_; + $dist =~ s/-/::/g; + my $module; + if (exists $contains->{$dist}) { + $module = $dist; + } elsif (1 == keys %$contains) { + ($module) = keys %$contains; + } + my $manpage; + if ($module) { + my $m = $self->expand("Module",$module); + $m->as_string; # called for side-effects, shame + $manpage = $m->{MANPAGE}; + } else { + $manpage = "unknown"; + } + return $manpage; +} + +#-> sub CPAN::Shell::_specfile ; +sub _specfile { + die "CPAN::Shell::_specfile() has been moved to CPAN::Plugin::Specfile::post_test()"; +} + +#-> sub CPAN::Shell::report ; +sub report { + my($self,@args) = @_; + unless ($CPAN::META->has_inst("CPAN::Reporter")) { + $CPAN::Frontend->mydie("CPAN::Reporter not installed; cannot continue"); + } + local $CPAN::Config->{test_report} = 1; + $self->force("test",@args); # force is there so that the test be + # re-run (as documented) +} + +# compare with is_tested +#-> sub CPAN::Shell::install_tested +sub install_tested { + my($self,@some) = @_; + $CPAN::Frontend->mywarn("install_tested() must not be called with arguments.\n"), + return if @some; + CPAN::Index->reload; + + for my $b (reverse $CPAN::META->_list_sorted_descending_is_tested) { + my $yaml = "$b.yml"; + unless (-f $yaml) { + $CPAN::Frontend->mywarn("No YAML file for $b available, skipping\n"); + next; + } + my $yaml_content = CPAN->_yaml_loadfile($yaml); + my $id = $yaml_content->[0]{distribution}{ID}; + unless ($id) { + $CPAN::Frontend->mywarn("No ID found in '$yaml', skipping\n"); + next; + } + my $do = CPAN::Shell->expandany($id); + unless ($do) { + $CPAN::Frontend->mywarn("Could not expand ID '$id', skipping\n"); + next; + } + unless ($do->{build_dir}) { + $CPAN::Frontend->mywarn("Distro '$id' has no build_dir, skipping\n"); + next; + } + unless ($do->{build_dir} eq $b) { + $CPAN::Frontend->mywarn("Distro '$id' has build_dir '$do->{build_dir}' but expected '$b', skipping\n"); + next; + } + push @some, $do; + } + + $CPAN::Frontend->mywarn("No tested distributions found.\n"), + return unless @some; + + @some = grep { $_->{make_test} && ! $_->{make_test}->failed } @some; + $CPAN::Frontend->mywarn("No distributions tested with this build of perl found.\n"), + return unless @some; + + # @some = grep { not $_->uptodate } @some; + # $CPAN::Frontend->mywarn("No non-uptodate distributions tested with this build of perl found.\n"), + # return unless @some; + + CPAN->debug("some[@some]"); + for my $d (@some) { + my $id = $d->can("pretty_id") ? $d->pretty_id : $d->id; + $CPAN::Frontend->myprint("install_tested: Running for $id\n"); + $CPAN::Frontend->mysleep(1); + $self->install($d); + } +} + +#-> sub CPAN::Shell::upgrade ; +sub upgrade { + my($self,@args) = @_; + $self->install($self->r(@args)); +} + +#-> sub CPAN::Shell::_u_r_common ; +sub _u_r_common { + my($self) = shift @_; + my($what) = shift @_; + CPAN->debug("self[$self] what[$what] args[@_]") if $CPAN::DEBUG; + Carp::croak "Usage: \$obj->_u_r_common(a|r|u)" unless + $what && $what =~ /^[aru]$/; + my(@args) = @_; + @args = '/./' unless @args; + my(@result,$module,%seen,%need,$headerdone, + $version_undefs,$version_zeroes, + @version_undefs,@version_zeroes); + $version_undefs = $version_zeroes = 0; + my $sprintf = "%s%-25s%s %9s %9s %s\n"; + my @expand = $self->expand('Module',@args); + if ($CPAN::DEBUG) { # Looks like noise to me, was very useful for debugging + # for metadata cache + my $expand = scalar @expand; + $CPAN::Frontend->myprint(sprintf "%d matches in the database, time[%d]\n", $expand, time); + } + my @sexpand; + if ($] < 5.008) { + # hard to believe that the more complex sorting can lead to + # stack curruptions on older perl + @sexpand = sort {$a->id cmp $b->id} @expand; + } else { + @sexpand = map { + $_->[1] + } sort { + $b->[0] <=> $a->[0] + || + $a->[1]{ID} cmp $b->[1]{ID}, + } map { + [$_->_is_representative_module, + $_ + ] + } @expand; + } + if ($CPAN::DEBUG) { + $CPAN::Frontend->myprint(sprintf "sorted at time[%d]\n", time); + sleep 1; + } + MODULE: for $module (@sexpand) { + my $file = $module->cpan_file; + next MODULE unless defined $file; # ?? + $file =~ s!^./../!!; + my($latest) = $module->cpan_version; + my($inst_file) = $module->inst_file; + CPAN->debug("file[$file]latest[$latest]") if $CPAN::DEBUG; + my($have); + return if $CPAN::Signal; + my($next_MODULE); + eval { # version.pm involved! + if ($inst_file) { + if ($what eq "a") { + $have = $module->inst_version; + } elsif ($what eq "r") { + $have = $module->inst_version; + local($^W) = 0; + if ($have eq "undef") { + $version_undefs++; + push @version_undefs, $module->as_glimpse; + } elsif (CPAN::Version->vcmp($have,0)==0) { + $version_zeroes++; + push @version_zeroes, $module->as_glimpse; + } + ++$next_MODULE unless CPAN::Version->vgt($latest, $have); + # to be pedantic we should probably say: + # && !($have eq "undef" && $latest ne "undef" && $latest gt ""); + # to catch the case where CPAN has a version 0 and we have a version undef + } elsif ($what eq "u") { + ++$next_MODULE; + } + } else { + if ($what eq "a") { + ++$next_MODULE; + } elsif ($what eq "r") { + ++$next_MODULE; + } elsif ($what eq "u") { + $have = "-"; + } + } + }; + next MODULE if $next_MODULE; + if ($@) { + $CPAN::Frontend->mywarn + (sprintf("Error while comparing cpan/installed versions of '%s': +INST_FILE: %s +INST_VERSION: %s %s +CPAN_VERSION: %s %s +", + $module->id, + $inst_file || "", + (defined $have ? $have : "[UNDEFINED]"), + (ref $have ? ref $have : ""), + $latest, + (ref $latest ? ref $latest : ""), + )); + next MODULE; + } + return if $CPAN::Signal; # this is sometimes lengthy + $seen{$file} ||= 0; + if ($what eq "a") { + push @result, sprintf "%s %s\n", $module->id, $have; + } elsif ($what eq "r") { + push @result, $module->id; + next MODULE if $seen{$file}++; + } elsif ($what eq "u") { + push @result, $module->id; + next MODULE if $seen{$file}++; + next MODULE if $file =~ /^Contact/; + } + unless ($headerdone++) { + $CPAN::Frontend->myprint("\n"); + $CPAN::Frontend->myprint(sprintf( + $sprintf, + "", + "Package namespace", + "", + "installed", + "latest", + "in CPAN file" + )); + } + my $color_on = ""; + my $color_off = ""; + if ( + $COLOR_REGISTERED + && + $CPAN::META->has_inst("Term::ANSIColor") + && + $module->description + ) { + $color_on = Term::ANSIColor::color("green"); + $color_off = Term::ANSIColor::color("reset"); + } + $CPAN::Frontend->myprint(sprintf $sprintf, + $color_on, + $module->id, + $color_off, + $have, + $latest, + $file); + $need{$module->id}++; + } + unless (%need) { + if (!@expand || $what eq "u") { + $CPAN::Frontend->myprint("No modules found for @args\n"); + } elsif ($what eq "r") { + $CPAN::Frontend->myprint("All modules are up to date for @args\n"); + } + } + if ($what eq "r") { + if ($version_zeroes) { + my $s_has = $version_zeroes > 1 ? "s have" : " has"; + $CPAN::Frontend->myprint(qq{$version_zeroes installed module$s_has }. + qq{a version number of 0\n}); + if ($CPAN::Config->{show_zero_versions}) { + local $" = "\t"; + $CPAN::Frontend->myprint(qq{ they are\n\t@version_zeroes\n}); + $CPAN::Frontend->myprint(qq{(use 'o conf show_zero_versions 0' }. + qq{to hide them)\n}); + } else { + $CPAN::Frontend->myprint(qq{(use 'o conf show_zero_versions 1' }. + qq{to show them)\n}); + } + } + if ($version_undefs) { + my $s_has = $version_undefs > 1 ? "s have" : " has"; + $CPAN::Frontend->myprint(qq{$version_undefs installed module$s_has no }. + qq{parsable version number\n}); + if ($CPAN::Config->{show_unparsable_versions}) { + local $" = "\t"; + $CPAN::Frontend->myprint(qq{ they are\n\t@version_undefs\n}); + $CPAN::Frontend->myprint(qq{(use 'o conf show_unparsable_versions 0' }. + qq{to hide them)\n}); + } else { + $CPAN::Frontend->myprint(qq{(use 'o conf show_unparsable_versions 1' }. + qq{to show them)\n}); + } + } + } + @result; +} + +#-> sub CPAN::Shell::r ; +sub r { + shift->_u_r_common("r",@_); +} + +#-> sub CPAN::Shell::u ; +sub u { + shift->_u_r_common("u",@_); +} + +#-> sub CPAN::Shell::failed ; +sub failed { + my($self,$only_id,$silent) = @_; + my @failed = $self->find_failed($only_id); + my $scope; + if ($only_id) { + $scope = "this command"; + } elsif ($CPAN::Index::HAVE_REANIMATED) { + $scope = "this or a previous session"; + # it might be nice to have a section for previous session and + # a second for this + } else { + $scope = "this session"; + } + if (@failed) { + my $print; + my $debug = 0; + if ($debug) { + $print = join "", + map { sprintf "%5d %-45s: %s %s\n", @$_ } + sort { $a->[0] <=> $b->[0] } @failed; + } else { + $print = join "", + map { sprintf " %-45s: %s %s\n", @$_[1..3] } + sort { + $a->[0] <=> $b->[0] + || + $a->[4] <=> $b->[4] + } @failed; + } + $CPAN::Frontend->myprint("Failed during $scope:\n$print"); + } elsif (!$only_id || !$silent) { + $CPAN::Frontend->myprint("Nothing failed in $scope\n"); + } +} + +sub find_failed { + my($self,$only_id) = @_; + my @failed; + DIST: for my $d (sort { $a->id cmp $b->id } $CPAN::META->all_objects("CPAN::Distribution")) { + my $failed = ""; + NAY: for my $nosayer ( # order matters! + "unwrapped", + "writemakefile", + "signature_verify", + "make", + "make_test", + "install", + "make_clean", + ) { + next unless exists $d->{$nosayer}; + next unless defined $d->{$nosayer}; + next unless ( + UNIVERSAL::can($d->{$nosayer},"failed") ? + $d->{$nosayer}->failed : + $d->{$nosayer} =~ /^NO/ + ); + next NAY if $only_id && $only_id != ( + UNIVERSAL::can($d->{$nosayer},"commandid") + ? + $d->{$nosayer}->commandid + : + $CPAN::CurrentCommandId + ); + $failed = $nosayer; + last; + } + next DIST unless $failed; + my $id = $d->id; + $id =~ s|^./../||; + ### XXX need to flag optional modules as '(optional)' if they are + # from recommends/suggests -- i.e. *show* failure, but make it clear + # it was failure of optional module -- xdg, 2012-04-01 + $id = "(optional) $id" if ! $d->{mandatory}; + #$print .= sprintf( + # " %-45s: %s %s\n", + push @failed, + ( + UNIVERSAL::can($d->{$failed},"failed") ? + [ + $d->{$failed}->commandid, + $id, + $failed, + $d->{$failed}->text, + $d->{$failed}{TIME}||0, + !! $d->{mandatory}, + ] : + [ + 1, + $id, + $failed, + $d->{$failed}, + 0, + !! $d->{mandatory}, + ] + ); + } + return @failed; +} + +sub mandatory_dist_failed { + my ($self) = @_; + return grep { $_->[5] } $self->find_failed($CPAN::CurrentCommandID); +} + +# XXX intentionally undocumented because completely bogus, unportable, +# useless, etc. + +#-> sub CPAN::Shell::status ; +sub status { + my($self) = @_; + require Devel::Size; + my $ps = FileHandle->new; + open $ps, "/proc/$$/status"; + my $vm = 0; + while (<$ps>) { + next unless /VmSize:\s+(\d+)/; + $vm = $1; + last; + } + $CPAN::Frontend->mywarn(sprintf( + "%-27s %6d\n%-27s %6d\n", + "vm", + $vm, + "CPAN::META", + Devel::Size::total_size($CPAN::META)/1024, + )); + for my $k (sort keys %$CPAN::META) { + next unless substr($k,0,4) eq "read"; + warn sprintf " %-26s %6d\n", $k, Devel::Size::total_size($CPAN::META->{$k})/1024; + for my $k2 (sort keys %{$CPAN::META->{$k}}) { + warn sprintf " %-25s %6d (keys: %6d)\n", + $k2, + Devel::Size::total_size($CPAN::META->{$k}{$k2})/1024, + scalar keys %{$CPAN::META->{$k}{$k2}}; + } + } +} + +# compare with install_tested +#-> sub CPAN::Shell::is_tested +sub is_tested { + my($self) = @_; + CPAN::Index->reload; + for my $b (reverse $CPAN::META->_list_sorted_descending_is_tested) { + my $time; + if ($CPAN::META->{is_tested}{$b}) { + $time = scalar(localtime $CPAN::META->{is_tested}{$b}); + } else { + $time = scalar localtime; + $time =~ s/\S/?/g; + } + $CPAN::Frontend->myprint(sprintf "%s %s\n", $time, $b); + } +} + +#-> sub CPAN::Shell::autobundle ; +sub autobundle { + my($self) = shift; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + my(@bundle) = $self->_u_r_common("a",@_); + my($todir) = File::Spec->catdir($CPAN::Config->{'cpan_home'},"Bundle"); + File::Path::mkpath($todir); + unless (-d $todir) { + $CPAN::Frontend->myprint("Couldn't mkdir $todir for some reason\n"); + return; + } + my($y,$m,$d) = (localtime)[5,4,3]; + $y+=1900; + $m++; + my($c) = 0; + my($me) = sprintf "Snapshot_%04d_%02d_%02d_%02d", $y, $m, $d, $c; + my($to) = File::Spec->catfile($todir,"$me.pm"); + while (-f $to) { + $me = sprintf "Snapshot_%04d_%02d_%02d_%02d", $y, $m, $d, ++$c; + $to = File::Spec->catfile($todir,"$me.pm"); + } + my($fh) = FileHandle->new(">$to") or Carp::croak "Can't open >$to: $!"; + $fh->print( + "package Bundle::$me;\n\n", + "\$","VERSION = '0.01';\n\n", # hide from perl-reversion + "1;\n\n", + "__END__\n\n", + "=head1 NAME\n\n", + "Bundle::$me - Snapshot of installation on ", + $Config::Config{'myhostname'}, + " on ", + scalar(localtime), + "\n\n=head1 SYNOPSIS\n\n", + "perl -MCPAN -e 'install Bundle::$me'\n\n", + "=head1 CONTENTS\n\n", + join("\n", @bundle), + "\n\n=head1 CONFIGURATION\n\n", + Config->myconfig, + "\n\n=head1 AUTHOR\n\n", + "This Bundle has been generated automatically ", + "by the autobundle routine in CPAN.pm.\n", + ); + $fh->close; + $CPAN::Frontend->myprint("\nWrote bundle file + $to\n\n"); + return $to; +} + +#-> sub CPAN::Shell::expandany ; +sub expandany { + my($self,$s) = @_; + CPAN->debug("s[$s]") if $CPAN::DEBUG; + my $module_as_path = ""; + if ($s =~ m|(?:\w+/)*\w+\.pm$|) { # same regexp in sub m + $module_as_path = $s; + $module_as_path =~ s/.pm$//; + $module_as_path =~ s|/|::|g; + } + if ($module_as_path) { + if ($module_as_path =~ m|^Bundle::|) { + $self->local_bundles; + return $self->expand('Bundle',$module_as_path); + } else { + return $self->expand('Module',$module_as_path) + if $CPAN::META->exists('CPAN::Module',$module_as_path); + } + } elsif ($s =~ m|/| or substr($s,-1,1) eq ".") { # looks like a file or a directory + $s = CPAN::Distribution->normalize($s); + return $CPAN::META->instance('CPAN::Distribution',$s); + # Distributions spring into existence, not expand + } elsif ($s =~ m|^Bundle::|) { + $self->local_bundles; # scanning so late for bundles seems + # both attractive and crumpy: always + # current state but easy to forget + # somewhere + return $self->expand('Bundle',$s); + } else { + return $self->expand('Module',$s) + if $CPAN::META->exists('CPAN::Module',$s); + } + return; +} + +#-> sub CPAN::Shell::expand ; +sub expand { + my $self = shift; + my($type,@args) = @_; + CPAN->debug("type[$type]args[@args]") if $CPAN::DEBUG; + my $class = "CPAN::$type"; + my $methods = ['id']; + for my $meth (qw(name)) { + next unless $class->can($meth); + push @$methods, $meth; + } + $self->expand_by_method($class,$methods,@args); +} + +#-> sub CPAN::Shell::expand_by_method ; +sub expand_by_method { + my $self = shift; + my($class,$methods,@args) = @_; + my($arg,@m); + for $arg (@args) { + my($regex,$command); + if ($arg =~ m|^/(.*)/$|) { + $regex = $1; +# FIXME: there seem to be some ='s in the author data, which trigger +# a failure here. This needs to be contemplated. +# } elsif ($arg =~ m/=/) { +# $command = 1; + } + my $obj; + CPAN->debug(sprintf "class[%s]regex[%s]command[%s]", + $class, + defined $regex ? $regex : "UNDEFINED", + defined $command ? $command : "UNDEFINED", + ) if $CPAN::DEBUG; + if (defined $regex) { + if (CPAN::_sqlite_running()) { + CPAN::Index->reload; + $CPAN::SQLite->search($class, $regex); + } + for $obj ( + $CPAN::META->all_objects($class) + ) { + unless ($obj && UNIVERSAL::can($obj,"id") && $obj->id) { + # BUG, we got an empty object somewhere + require Data::Dumper; + CPAN->debug(sprintf( + "Bug in CPAN: Empty id on obj[%s][%s]", + $obj, + Data::Dumper::Dumper($obj) + )) if $CPAN::DEBUG; + next; + } + for my $method (@$methods) { + my $match = eval {$obj->$method() =~ /$regex/i}; + if ($@) { + my($err) = $@ =~ /^(.+) at .+? line \d+\.$/; + $err ||= $@; # if we were too restrictive above + $CPAN::Frontend->mydie("$err\n"); + } elsif ($match) { + push @m, $obj; + last; + } + } + } + } elsif ($command) { + die "equal sign in command disabled (immature interface), ". + "you can set + ! \$CPAN::Shell::ADVANCED_QUERY=1 +to enable it. But please note, this is HIGHLY EXPERIMENTAL code +that may go away anytime.\n" + unless $ADVANCED_QUERY; + my($method,$criterion) = $arg =~ /(.+?)=(.+)/; + my($matchcrit) = $criterion =~ m/^~(.+)/; + for my $self ( + sort + {$a->id cmp $b->id} + $CPAN::META->all_objects($class) + ) { + my $lhs = $self->$method() or next; # () for 5.00503 + if ($matchcrit) { + push @m, $self if $lhs =~ m/$matchcrit/; + } else { + push @m, $self if $lhs eq $criterion; + } + } + } else { + my($xarg) = $arg; + if ( $class eq 'CPAN::Bundle' ) { + $xarg =~ s/^(Bundle::)?(.*)/Bundle::$2/; + } elsif ($class eq "CPAN::Distribution") { + $xarg = CPAN::Distribution->normalize($arg); + } else { + $xarg =~ s/:+/::/g; + } + if ($CPAN::META->exists($class,$xarg)) { + $obj = $CPAN::META->instance($class,$xarg); + } elsif ($CPAN::META->exists($class,$arg)) { + $obj = $CPAN::META->instance($class,$arg); + } else { + next; + } + push @m, $obj; + } + } + @m = sort {$a->id cmp $b->id} @m; + if ( $CPAN::DEBUG ) { + my $wantarray = wantarray; + my $join_m = join ",", map {$_->id} @m; + # $self->debug("wantarray[$wantarray]join_m[$join_m]"); + my $count = scalar @m; + $self->debug("class[$class]wantarray[$wantarray]count m[$count]"); + } + return wantarray ? @m : $m[0]; +} + +#-> sub CPAN::Shell::format_result ; +sub format_result { + my($self) = shift; + my($type,@args) = @_; + @args = '/./' unless @args; + my(@result) = $self->expand($type,@args); + my $result = @result == 1 ? + $result[0]->as_string : + @result == 0 ? + "No objects of type $type found for argument @args\n" : + join("", + (map {$_->as_glimpse} @result), + scalar @result, " items found\n", + ); + $result; +} + +#-> sub CPAN::Shell::report_fh ; +{ + my $installation_report_fh; + my $previously_noticed = 0; + + sub report_fh { + return $installation_report_fh if $installation_report_fh; + if ($CPAN::META->has_usable("File::Temp")) { + $installation_report_fh + = File::Temp->new( + dir => File::Spec->tmpdir, + template => 'cpan_install_XXXX', + suffix => '.txt', + unlink => 0, + ); + } + unless ( $installation_report_fh ) { + warn("Couldn't open installation report file; " . + "no report file will be generated." + ) unless $previously_noticed++; + } + } +} + + +# The only reason for this method is currently to have a reliable +# debugging utility that reveals which output is going through which +# channel. No, I don't like the colors ;-) + +# to turn colordebugging on, write +# cpan> o conf colorize_output 1 + +#-> sub CPAN::Shell::colorize_output ; +{ + my $print_ornamented_have_warned = 0; + sub colorize_output { + my $colorize_output = $CPAN::Config->{colorize_output}; + if ($colorize_output && $^O eq 'MSWin32' && !$CPAN::META->has_inst("Win32::Console::ANSI")) { + unless ($print_ornamented_have_warned++) { + # no myprint/mywarn within myprint/mywarn! + warn "Colorize_output is set to true but Win32::Console::ANSI is not +installed. To activate colorized output, please install Win32::Console::ANSI.\n\n"; + } + $colorize_output = 0; + } + if ($colorize_output && !$CPAN::META->has_inst("Term::ANSIColor")) { + unless ($print_ornamented_have_warned++) { + # no myprint/mywarn within myprint/mywarn! + warn "Colorize_output is set to true but Term::ANSIColor is not +installed. To activate colorized output, please install Term::ANSIColor.\n\n"; + } + $colorize_output = 0; + } + return $colorize_output; + } +} + + +#-> sub CPAN::Shell::print_ornamented ; +sub print_ornamented { + my($self,$what,$ornament) = @_; + return unless defined $what; + + local $| = 1; # Flush immediately + if ( $CPAN::Be_Silent ) { + # WARNING: variable Be_Silent is poisoned and must be eliminated. + print {report_fh()} $what; + return; + } + my $swhat = "$what"; # stringify if it is an object + if ($CPAN::Config->{term_is_latin}) { + # note: deprecated, need to switch to $LANG and $LC_* + # courtesy jhi: + $swhat + =~ s{([\xC0-\xDF])([\x80-\xBF])}{chr(ord($1)<<6&0xC0|ord($2)&0x3F)}eg; #}; + } + if ($self->colorize_output) { + if ( $CPAN::DEBUG && $swhat =~ /^Debug\(/ ) { + # if you want to have this configurable, please file a bug report + $ornament = $CPAN::Config->{colorize_debug} || "black on_cyan"; + } + my $color_on = eval { Term::ANSIColor::color($ornament) } || ""; + if ($@) { + print "Term::ANSIColor rejects color[$ornament]: $@\n +Please choose a different color (Hint: try 'o conf init /color/')\n"; + } + # GGOLDBACH/Test-GreaterVersion-0.008 broke without this + # $trailer construct. We want the newline be the last thing if + # there is a newline at the end ensuring that the next line is + # empty for other players + my $trailer = ""; + $trailer = $1 if $swhat =~ s/([\r\n]+)\z//; + print $color_on, + $swhat, + Term::ANSIColor::color("reset"), + $trailer; + } else { + print $swhat; + } +} + +#-> sub CPAN::Shell::myprint ; + +# where is myprint/mywarn/Frontend/etc. documented? Where to use what? +# I think, we send everything to STDOUT and use print for normal/good +# news and warn for news that need more attention. Yes, this is our +# working contract for now. +sub myprint { + my($self,$what) = @_; + $self->print_ornamented($what, + $CPAN::Config->{colorize_print}||'bold blue on_white', + ); +} + +my %already_printed; +#-> sub CPAN::Shell::mywarnonce ; +sub myprintonce { + my($self,$what) = @_; + $self->myprint($what) unless $already_printed{$what}++; +} + +sub optprint { + my($self,$category,$what) = @_; + my $vname = $category . "_verbosity"; + CPAN::HandleConfig->load unless $CPAN::Config_loaded++; + if (!$CPAN::Config->{$vname} + || $CPAN::Config->{$vname} =~ /^v/ + ) { + $CPAN::Frontend->myprint($what); + } +} + +#-> sub CPAN::Shell::myexit ; +sub myexit { + my($self,$what) = @_; + $self->myprint($what); + exit; +} + +#-> sub CPAN::Shell::mywarn ; +sub mywarn { + my($self,$what) = @_; + $self->print_ornamented($what, $CPAN::Config->{colorize_warn}||'bold red on_white'); +} + +my %already_warned; +#-> sub CPAN::Shell::mywarnonce ; +sub mywarnonce { + my($self,$what) = @_; + $self->mywarn($what) unless $already_warned{$what}++; +} + +# only to be used for shell commands +#-> sub CPAN::Shell::mydie ; +sub mydie { + my($self,$what) = @_; + $self->mywarn($what); + + # If it is the shell, we want the following die to be silent, + # but if it is not the shell, we would need a 'die $what'. We need + # to take care that only shell commands use mydie. Is this + # possible? + + die "\n"; +} + +# sub CPAN::Shell::colorable_makemaker_prompt ; +sub colorable_makemaker_prompt { + my($foo,$bar,$ornament) = @_; + $ornament ||= "colorize_print"; + if (CPAN::Shell->colorize_output) { + my $ornament = $CPAN::Config->{$ornament}||'bold blue on_white'; + my $color_on = eval { Term::ANSIColor::color($ornament); } || ""; + print $color_on; + } + my $ans = ExtUtils::MakeMaker::prompt($foo,$bar); + if (CPAN::Shell->colorize_output) { + print Term::ANSIColor::color('reset'); + } + return $ans; +} + +# use this only for unrecoverable errors! +#-> sub CPAN::Shell::unrecoverable_error ; +sub unrecoverable_error { + my($self,$what) = @_; + my @lines = split /\n/, $what; + my $longest = 0; + for my $l (@lines) { + $longest = length $l if length $l > $longest; + } + $longest = 62 if $longest > 62; + for my $l (@lines) { + if ($l =~ /^\s*$/) { + $l = "\n"; + next; + } + $l = "==> $l"; + if (length $l < 66) { + $l = pack "A66 A*", $l, "<=="; + } + $l .= "\n"; + } + unshift @lines, "\n"; + $self->mydie(join "", @lines); +} + +#-> sub CPAN::Shell::mysleep ; +sub mysleep { + return if $ENV{AUTOMATED_TESTING} || ! -t STDOUT; + my($self, $sleep) = @_; + if (CPAN->has_inst("Time::HiRes")) { + Time::HiRes::sleep($sleep); + } else { + sleep($sleep < 1 ? 1 : int($sleep + 0.5)); + } +} + +#-> sub CPAN::Shell::setup_output ; +sub setup_output { + return if -t STDOUT; + my $odef = select STDERR; + $| = 1; + select STDOUT; + $| = 1; + select $odef; +} + +#-> sub CPAN::Shell::rematein ; +# RE-adme||MA-ke||TE-st||IN-stall : nearly everything runs through here +sub rematein { + my $self = shift; + # this variable was global and disturbed programmers, so localize: + local $CPAN::Distrostatus::something_has_failed_at; + my($meth,@some) = @_; + my @pragma; + while($meth =~ /^(ff?orce|notest)$/) { + push @pragma, $meth; + $meth = shift @some or + $CPAN::Frontend->mydie("Pragma $pragma[-1] used without method: ". + "cannot continue"); + } + setup_output(); + CPAN->debug("pragma[@pragma]meth[$meth]some[@some]") if $CPAN::DEBUG; + + # Here is the place to set "test_count" on all involved parties to + # 0. We then can pass this counter on to the involved + # distributions and those can refuse to test if test_count > X. In + # the first stab at it we could use a 1 for "X". + + # But when do I reset the distributions to start with 0 again? + # Jost suggested to have a random or cycling interaction ID that + # we pass through. But the ID is something that is just left lying + # around in addition to the counter, so I'd prefer to set the + # counter to 0 now, and repeat at the end of the loop. But what + # about dependencies? They appear later and are not reset, they + # enter the queue but not its copy. How do they get a sensible + # test_count? + + # With configure_requires, "get" is vulnerable in recursion. + + my $needs_recursion_protection = "get|make|test|install"; + + # construct the queue + my($s,@s,@qcopy); + STHING: foreach $s (@some) { + my $obj; + if (ref $s) { + CPAN->debug("s is an object[$s]") if $CPAN::DEBUG; + $obj = $s; + } elsif ($s =~ m|[\$\@\%]|) { # looks like a perl variable + } elsif ($s =~ m|^/|) { # looks like a regexp + if (substr($s,-1,1) eq ".") { + $obj = CPAN::Shell->expandany($s); + } else { + my @obj; + CLASS: for my $class (qw(Distribution Bundle Module)) { + if (@obj = $self->expand($class,$s)) { + last CLASS; + } + } + if (@obj) { + if (1==@obj) { + $obj = $obj[0]; + } else { + $CPAN::Frontend->mywarn("Sorry, $meth with a regular expression is ". + "only supported when unambiguous.\nRejecting argument '$s'\n"); + $CPAN::Frontend->mysleep(2); + next STHING; + } + } + } + } elsif ($meth eq "ls") { + $self->globls($s,\@pragma); + next STHING; + } else { + CPAN->debug("calling expandany [$s]") if $CPAN::DEBUG; + $obj = CPAN::Shell->expandany($s); + } + if (0) { + } elsif (ref $obj) { + if ($meth =~ /^($needs_recursion_protection)$/) { + # it would be silly to check for recursion for look or dump + # (we are in CPAN::Shell::rematein) + CPAN->debug("Testing against recursion") if $CPAN::DEBUG; + eval { $obj->color_cmd_tmps(0,1); }; + if ($@) { + if (ref $@ + and $@->isa("CPAN::Exception::RecursiveDependency")) { + $CPAN::Frontend->mywarn($@); + } else { + if (0) { + require Carp; + Carp::confess(sprintf "DEBUG: \$\@[%s]ref[%s]", $@, ref $@); + } + die; + } + } + } + CPAN::Queue->queue_item(qmod => $obj->id, reqtype => "c", optional => ''); + push @qcopy, $obj; + } elsif ($CPAN::META->exists('CPAN::Author',uc($s))) { + $obj = $CPAN::META->instance('CPAN::Author',uc($s)); + if ($meth =~ /^(dump|ls|reports)$/) { + $obj->$meth(); + } else { + $CPAN::Frontend->mywarn( + join "", + "Don't be silly, you can't $meth ", + $obj->fullname, + " ;-)\n" + ); + $CPAN::Frontend->mysleep(2); + } + } elsif ($s =~ m|[\$\@\%]| && $meth eq "dump") { + CPAN::InfoObj->dump($s); + } else { + $CPAN::Frontend + ->mywarn(qq{Warning: Cannot $meth $s, }. + qq{don't know what it is. +Try the command + + i /$s/ + +to find objects with matching identifiers. +}); + $CPAN::Frontend->mysleep(2); + } + } + + # queuerunner (please be warned: when I started to change the + # queue to hold objects instead of names, I made one or two + # mistakes and never found which. I reverted back instead) + QITEM: while (my $q = CPAN::Queue->first) { + my $obj; + my $s = $q->as_string; + my $reqtype = $q->reqtype || ""; + my $optional = $q->optional || ""; + $obj = CPAN::Shell->expandany($s); + unless ($obj) { + # don't know how this can happen, maybe we should panic, + # but maybe we get a solution from the first user who hits + # this unfortunate exception? + $CPAN::Frontend->mywarn("Warning: Could not expand string '$s' ". + "to an object. Skipping.\n"); + $CPAN::Frontend->mysleep(5); + CPAN::Queue->delete_first($s); + next QITEM; + } + $obj->{reqtype} ||= ""; + my $type = ref $obj; + if ( $type eq 'CPAN::Distribution' || $type eq 'CPAN::Bundle' ) { + $obj->{mandatory} ||= ! $optional; # once mandatory, always mandatory + } + elsif ( $type eq 'CPAN::Module' ) { + $obj->{mandatory} ||= ! $optional; # once mandatory, always mandatory + if (my $d = $obj->distribution) { + $d->{mandatory} ||= ! $optional; # once mandatory, always mandatory + } elsif ($optional) { + # the queue object does not know who was recommending/suggesting us:( + # So we only vaguely write "optional". + $CPAN::Frontend->mywarn("Warning: optional module '$s' ". + "not known. Skipping.\n"); + CPAN::Queue->delete_first($s); + next QITEM; + } + } + { + # force debugging because CPAN::SQLite somehow delivers us + # an empty object; + + # local $CPAN::DEBUG = 1024; # Shell; probably fixed now + + CPAN->debug("s[$s]obj-reqtype[$obj->{reqtype}]". + "q-reqtype[$reqtype]") if $CPAN::DEBUG; + } + if ($obj->{reqtype}) { + if ($obj->{reqtype} eq "b" && $reqtype =~ /^[rc]$/) { + $obj->{reqtype} = $reqtype; + if ( + exists $obj->{install} + && + ( + UNIVERSAL::can($obj->{install},"failed") ? + $obj->{install}->failed : + $obj->{install} =~ /^NO/ + ) + ) { + delete $obj->{install}; + $CPAN::Frontend->mywarn + ("Promoting $obj->{ID} from 'build_requires' to 'requires'"); + } + } + } else { + $obj->{reqtype} = $reqtype; + } + + for my $pragma (@pragma) { + if ($pragma + && + $obj->can($pragma)) { + $obj->$pragma($meth); + } + } + if (UNIVERSAL::can($obj, 'called_for')) { + $obj->called_for($s) unless $obj->called_for; + } + CPAN->debug(qq{pragma[@pragma]meth[$meth]}. + qq{ID[$obj->{ID}]}) if $CPAN::DEBUG; + + push @qcopy, $obj; + if ($meth =~ /^(report)$/) { # they came here with a pragma? + $self->$meth($obj); + } elsif (! UNIVERSAL::can($obj,$meth)) { + # Must never happen + my $serialized = ""; + if (0) { + } elsif ($CPAN::META->has_inst("YAML::Syck")) { + $serialized = YAML::Syck::Dump($obj); + } elsif ($CPAN::META->has_inst("YAML")) { + $serialized = YAML::Dump($obj); + } elsif ($CPAN::META->has_inst("Data::Dumper")) { + $serialized = Data::Dumper::Dumper($obj); + } else { + require overload; + $serialized = overload::StrVal($obj); + } + CPAN->debug("Going to panic. meth[$meth]s[$s]") if $CPAN::DEBUG; + $CPAN::Frontend->mydie("Panic: obj[$serialized] cannot meth[$meth]"); + } else { + my $upgraded_meth = $meth; + if ( $meth eq "make" and $obj->{reqtype} eq "b" ) { + # rt 86915 + $upgraded_meth = "test"; + } + if ($obj->$upgraded_meth()) { + CPAN::Queue->delete($s); + CPAN->debug("Succeeded and deleted from queue. pragma[@pragma]meth[$meth][s][$s]") if $CPAN::DEBUG; + } else { + CPAN->debug("Failed. pragma[@pragma]meth[$meth]s[$s]") if $CPAN::DEBUG; + } + } + + $obj->undelay; + for my $pragma (@pragma) { + my $unpragma = "un$pragma"; + if ($obj->can($unpragma)) { + $obj->$unpragma(); + } + } + # if any failures occurred and the current object is mandatory, we + # still don't know if *it* failed or if it was another (optional) + # module, so we have to check that explicitly (and expensively) + if ( $CPAN::Config->{halt_on_failure} + && $obj->{mandatory} + && CPAN::Distrostatus::something_has_just_failed() + && $self->mandatory_dist_failed() + ) { + $CPAN::Frontend->mywarn("Stopping: '$meth' failed for '$s'.\n"); + CPAN::Queue->nullify_queue; + last QITEM; + } + CPAN::Queue->delete_first($s); + } + if ($meth =~ /^($needs_recursion_protection)$/) { + for my $obj (@qcopy) { + $obj->color_cmd_tmps(0,0); + } + } +} + +#-> sub CPAN::Shell::recent ; +sub recent { + my($self) = @_; + if ($CPAN::META->has_inst("XML::LibXML")) { + my $url = $CPAN::Defaultrecent; + $CPAN::Frontend->myprint("Fetching '$url'\n"); + unless ($CPAN::META->has_usable("LWP")) { + $CPAN::Frontend->mydie("LWP not installed; cannot continue"); + } + CPAN::LWP::UserAgent->config; + my $Ua; + eval { $Ua = CPAN::LWP::UserAgent->new; }; + if ($@) { + $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n"); + } + my $resp = $Ua->get($url); + unless ($resp->is_success) { + $CPAN::Frontend->mydie(sprintf "Could not download '%s': %s\n", $url, $resp->code); + } + $CPAN::Frontend->myprint("DONE\n\n"); + my $xml = XML::LibXML->new->parse_string($resp->content); + if (0) { + my $s = $xml->serialize(2); + $s =~ s/\n\s*\n/\n/g; + $CPAN::Frontend->myprint($s); + return; + } + my @distros; + if ($url =~ /winnipeg/) { + my $pubdate = $xml->findvalue("/rss/channel/pubDate"); + $CPAN::Frontend->myprint(" pubDate: $pubdate\n\n"); + for my $eitem ($xml->findnodes("/rss/channel/item")) { + my $distro = $eitem->findvalue("enclosure/\@url"); + $distro =~ s|.*?/authors/id/./../||; + my $size = $eitem->findvalue("enclosure/\@length"); + my $desc = $eitem->findvalue("description"); + $desc =~ s/.+? - //; + $CPAN::Frontend->myprint("$distro [$size b]\n $desc\n"); + push @distros, $distro; + } + } elsif ($url =~ /search.*uploads.rdf/) { + # xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + # xmlns="http://purl.org/rss/1.0/" + # xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" + # xmlns:dc="http://purl.org/dc/elements/1.1/" + # xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" + # xmlns:admin="http://webns.net/mvcb/" + + + my $dc_date = $xml->findvalue("//*[local-name(.) = 'RDF']/*[local-name(.) = 'channel']/*[local-name(.) = 'date']"); + $CPAN::Frontend->myprint(" dc:date: $dc_date\n\n"); + my $finish_eitem = 0; + local $SIG{INT} = sub { $finish_eitem = 1 }; + EITEM: for my $eitem ($xml->findnodes("//*[local-name(.) = 'RDF']/*[local-name(.) = 'item']")) { + my $distro = $eitem->findvalue("\@rdf:about"); + $distro =~ s|.*~||; # remove up to the tilde before the name + $distro =~ s|/$||; # remove trailing slash + $distro =~ s|([^/]+)|\U$1\E|; # upcase the name + my $author = uc $1 or die "distro[$distro] without author, cannot continue"; + my $desc = $eitem->findvalue("*[local-name(.) = 'description']"); + my $i = 0; + SUBDIRTEST: while () { + last SUBDIRTEST if ++$i >= 6; # half a dozen must do! + if (my @ret = $self->globls("$distro*")) { + @ret = grep {$_->[2] !~ /meta/} @ret; + @ret = grep {length $_->[2]} @ret; + if (@ret) { + $distro = "$author/$ret[0][2]"; + last SUBDIRTEST; + } + } + $distro =~ s|/|/*/|; # allow it to reside in a subdirectory + } + + next EITEM if $distro =~ m|\*|; # did not find the thing + $CPAN::Frontend->myprint("____$desc\n"); + push @distros, $distro; + last EITEM if $finish_eitem; + } + } + return \@distros; + } else { + # deprecated old version + $CPAN::Frontend->mydie("no XML::LibXML installed, cannot continue\n"); + } +} + +#-> sub CPAN::Shell::smoke ; +sub smoke { + my($self) = @_; + my $distros = $self->recent; + DISTRO: for my $distro (@$distros) { + next if $distro =~ m|/Bundle-|; # XXX crude heuristic to skip bundles + $CPAN::Frontend->myprint(sprintf "Downloading and testing '$distro'\n"); + { + my $skip = 0; + local $SIG{INT} = sub { $skip = 1 }; + for (0..9) { + $CPAN::Frontend->myprint(sprintf "\r%2d (Hit ^C to skip)", 10-$_); + sleep 1; + if ($skip) { + $CPAN::Frontend->myprint(" skipped\n"); + next DISTRO; + } + } + } + $CPAN::Frontend->myprint("\r \n"); # leave the dirty line with a newline + $self->test($distro); + } +} + +{ + # set up the dispatching methods + no strict "refs"; + for my $command (qw( + clean + cvs_import + dump + force + fforce + get + install + look + ls + make + notest + perldoc + readme + reports + test + )) { + *$command = sub { shift->rematein($command, @_); }; + } +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Tarzip.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Tarzip.pm new file mode 100644 index 0000000000000000000000000000000000000000..6517cb8fd723a526a9c94d4eb9c0903de23036ca --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Tarzip.pm @@ -0,0 +1,479 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +package CPAN::Tarzip; +use strict; +use vars qw($VERSION @ISA $BUGHUNTING); +use CPAN::Debug; +use File::Basename qw(basename); +$VERSION = "5.5013"; +# module is internal to CPAN.pm + +@ISA = qw(CPAN::Debug); ## no critic +$BUGHUNTING ||= 0; # released code must have turned off + +# it's ok if file doesn't exist, it just matters if it is .gz or .bz2 +sub new { + my($class,$file) = @_; + $CPAN::Frontend->mydie("CPAN::Tarzip->new called without arg") unless defined $file; + my $me = { FILE => $file }; + if ($file =~ /\.(bz2|gz|zip|tbz|tgz)$/i) { + $me->{ISCOMPRESSED} = 1; + } else { + $me->{ISCOMPRESSED} = 0; + } + if (0) { + } elsif ($file =~ /\.(?:bz2|tbz)$/i) { + unless ($me->{UNGZIPPRG} = $CPAN::Config->{bzip2}) { + my $bzip2 = _my_which("bzip2"); + if ($bzip2) { + $me->{UNGZIPPRG} = $bzip2; + } else { + $CPAN::Frontend->mydie(qq{ +CPAN.pm needs the external program bzip2 in order to handle '$file'. +Please install it now and run 'o conf init bzip2' from the +CPAN shell prompt to register it as external program. +}); + } + } + } else { + $me->{UNGZIPPRG} = _my_which("gzip"); + } + $me->{TARPRG} = _my_which("tar") || _my_which("gtar"); + bless $me, $class; +} + +sub _zlib_ok () { + $CPAN::META->has_inst("Compress::Zlib") or return; + Compress::Zlib->can('gzopen'); +} + +sub _my_which { + my($what) = @_; + if ($CPAN::Config->{$what}) { + return $CPAN::Config->{$what}; + } + if ($CPAN::META->has_inst("File::Which")) { + return File::Which::which($what); + } + my @cand = MM->maybe_command($what); + return $cand[0] if @cand; + require File::Spec; + my $component; + PATH_COMPONENT: foreach $component (File::Spec->path()) { + next unless defined($component) && $component; + my($abs) = File::Spec->catfile($component,$what); + if (MM->maybe_command($abs)) { + return $abs; + } + } + return; +} + +sub gzip { + my($self,$read) = @_; + my $write = $self->{FILE}; + if (_zlib_ok) { + my($buffer,$fhw); + $fhw = FileHandle->new($read) + or $CPAN::Frontend->mydie("Could not open $read: $!"); + my $cwd = `pwd`; + my $gz = Compress::Zlib::gzopen($write, "wb") + or $CPAN::Frontend->mydie("Cannot gzopen $write: $! (pwd is $cwd)\n"); + binmode($fhw); + $gz->gzwrite($buffer) + while read($fhw,$buffer,4096) > 0 ; + $gz->gzclose() ; + $fhw->close; + return 1; + } else { + my $command = CPAN::HandleConfig->safe_quote($self->{UNGZIPPRG}); + system(qq{$command -c "$read" > "$write"})==0; + } +} + + +sub gunzip { + my($self,$write) = @_; + my $read = $self->{FILE}; + if (_zlib_ok) { + my($buffer,$fhw); + $fhw = FileHandle->new(">$write") + or $CPAN::Frontend->mydie("Could not open >$write: $!"); + my $gz = Compress::Zlib::gzopen($read, "rb") + or $CPAN::Frontend->mydie("Cannot gzopen $read: $!\n"); + binmode($fhw); + $fhw->print($buffer) + while $gz->gzread($buffer) > 0 ; + $CPAN::Frontend->mydie("Error reading from $read: $!\n") + if $gz->gzerror != Compress::Zlib::Z_STREAM_END(); + $gz->gzclose() ; + $fhw->close; + return 1; + } else { + my $command = CPAN::HandleConfig->safe_quote($self->{UNGZIPPRG}); + system(qq{$command -d -c "$read" > "$write"})==0; + } +} + + +sub gtest { + my($self) = @_; + return $self->{GTEST} if exists $self->{GTEST}; + defined $self->{FILE} or $CPAN::Frontend->mydie("gtest called but no FILE specified"); + my $read = $self->{FILE}; + my $success; + if ($read=~/\.(?:bz2|tbz)$/ && $CPAN::META->has_inst("Compress::Bzip2")) { + my($buffer,$len); + $len = 0; + my $gz = Compress::Bzip2::bzopen($read, "rb") + or $CPAN::Frontend->mydie(sprintf("Cannot bzopen %s: %s\n", + $read, + $Compress::Bzip2::bzerrno)); + while ($gz->bzread($buffer) > 0 ) { + $len += length($buffer); + $buffer = ""; + } + my $err = $gz->bzerror; + $success = ! $err || $err == Compress::Bzip2::BZ_STREAM_END(); + if ($len == -s $read) { + $success = 0; + CPAN->debug("hit an uncompressed file") if $CPAN::DEBUG; + } + $gz->gzclose(); + CPAN->debug("err[$err]success[$success]") if $CPAN::DEBUG; + } elsif ( $read=~/\.(?:gz|tgz)$/ && _zlib_ok ) { + # After I had reread the documentation in zlib.h, I discovered that + # uncompressed files do not lead to an gzerror (anymore?). + my($buffer,$len); + $len = 0; + my $gz = Compress::Zlib::gzopen($read, "rb") + or $CPAN::Frontend->mydie(sprintf("Cannot gzopen %s: %s\n", + $read, + $Compress::Zlib::gzerrno)); + while ($gz->gzread($buffer) > 0 ) { + $len += length($buffer); + $buffer = ""; + } + my $err = $gz->gzerror; + $success = ! $err || $err == Compress::Zlib::Z_STREAM_END(); + if ($len == -s $read) { + $success = 0; + CPAN->debug("hit an uncompressed file") if $CPAN::DEBUG; + } + $gz->gzclose(); + CPAN->debug("err[$err]success[$success]") if $CPAN::DEBUG; + } elsif (!$self->{ISCOMPRESSED}) { + $success = 0; + } else { + my $command = CPAN::HandleConfig->safe_quote($self->{UNGZIPPRG}); + $success = 0==system(qq{$command -qdt "$read"}); + } + return $self->{GTEST} = $success; +} + + +sub TIEHANDLE { + my($class,$file) = @_; + my $ret; + $class->debug("file[$file]"); + my $self = $class->new($file); + if (0) { + } elsif (!$self->gtest) { + my $fh = FileHandle->new($file) + or $CPAN::Frontend->mydie("Could not open file[$file]: $!"); + binmode $fh; + $self->{FH} = $fh; + $class->debug("via uncompressed FH"); + } elsif ($file =~ /\.(?:bz2|tbz)$/ && $CPAN::META->has_inst("Compress::Bzip2")) { + my $gz = Compress::Bzip2::bzopen($file,"rb") or + $CPAN::Frontend->mydie("Could not bzopen $file"); + $self->{GZ} = $gz; + $class->debug("via Compress::Bzip2"); + } elsif ($file =~/\.(?:gz|tgz)$/ && _zlib_ok) { + my $gz = Compress::Zlib::gzopen($file,"rb") or + $CPAN::Frontend->mydie("Could not gzopen $file"); + $self->{GZ} = $gz; + $class->debug("via Compress::Zlib"); + } else { + my $gzip = CPAN::HandleConfig->safe_quote($self->{UNGZIPPRG}); + my $pipe = "$gzip -d -c $file |"; + my $fh = FileHandle->new($pipe) or $CPAN::Frontend->mydie("Could not pipe[$pipe]: $!"); + binmode $fh; + $self->{FH} = $fh; + $class->debug("via external $gzip"); + } + $self; +} + + +sub READLINE { + my($self) = @_; + if (exists $self->{GZ}) { + my $gz = $self->{GZ}; + my($line,$bytesread); + $bytesread = $gz->gzreadline($line); + return undef if $bytesread <= 0; + return $line; + } else { + my $fh = $self->{FH}; + return scalar <$fh>; + } +} + + +sub READ { + my($self,$ref,$length,$offset) = @_; + $CPAN::Frontend->mydie("read with offset not implemented") if defined $offset; + if (exists $self->{GZ}) { + my $gz = $self->{GZ}; + my $byteread = $gz->gzread($$ref,$length);# 30eaf79e8b446ef52464b5422da328a8 + return $byteread; + } else { + my $fh = $self->{FH}; + return read($fh,$$ref,$length); + } +} + + +sub DESTROY { + my($self) = @_; + if (exists $self->{GZ}) { + my $gz = $self->{GZ}; + $gz->gzclose() if defined $gz; # hard to say if it is allowed + # to be undef ever. AK, 2000-09 + } else { + my $fh = $self->{FH}; + $fh->close if defined $fh; + } + undef $self; +} + +sub untar { + my($self) = @_; + my $file = $self->{FILE}; + my($prefer) = 0; + + my $exttar = $self->{TARPRG} || ""; + $exttar = "" if $exttar =~ /^\s+$/; # user refuses to use it + my $extgzip = $self->{UNGZIPPRG} || ""; + $extgzip = "" if $extgzip =~ /^\s+$/; # user refuses to use it + + if (0) { # makes changing order easier + } elsif ($BUGHUNTING) { + $prefer=2; + } elsif ($CPAN::Config->{prefer_external_tar}) { + $prefer = 1; + } elsif ( + $CPAN::META->has_usable("Archive::Tar") + && + _zlib_ok ) { + my $prefer_external_tar = $CPAN::Config->{prefer_external_tar}; + unless (defined $prefer_external_tar) { + if ($^O =~ /(MSWin32|solaris)/) { + $prefer_external_tar = 0; + } else { + $prefer_external_tar = 1; + } + } + $prefer = $prefer_external_tar ? 1 : 2; + } elsif ($exttar && $extgzip) { + # no modules and not bz2 + $prefer = 1; + # but solaris binary tar is a problem + if ($^O eq 'solaris' && qx($exttar --version 2>/dev/null) !~ /gnu/i) { + $CPAN::Frontend->mywarn(<< 'END_WARN'); + +WARNING: Many CPAN distributions were archived with GNU tar and some of +them may be incompatible with Solaris tar. We respectfully suggest you +configure CPAN to use a GNU tar instead ("o conf init tar") or install +a recent Archive::Tar instead; + +END_WARN + } + } else { + my $foundtar = $exttar ? "'$exttar'" : "nothing"; + my $foundzip = $extgzip ? "'$extgzip'" : $foundtar ? "nothing" : "also nothing"; + my $foundAT; + if ($CPAN::META->has_usable("Archive::Tar")) { + $foundAT = sprintf "'%s'", "Archive::Tar::"->VERSION; + } else { + $foundAT = "nothing"; + } + my $foundCZ; + if (_zlib_ok) { + $foundCZ = sprintf "'%s'", "Compress::Zlib::"->VERSION; + } elsif ($foundAT) { + $foundCZ = "nothing"; + } else { + $foundCZ = "also nothing"; + } + $CPAN::Frontend->mydie(qq{ + +CPAN.pm needs either the external programs tar and gzip -or- both +modules Archive::Tar and Compress::Zlib installed. + +For tar I found $foundtar, for gzip $foundzip. + +For Archive::Tar I found $foundAT, for Compress::Zlib $foundCZ; + +Can't continue cutting file '$file'. +}); + } + my $tar_verb = "v"; + if (defined $CPAN::Config->{tar_verbosity}) { + $tar_verb = $CPAN::Config->{tar_verbosity} eq "none" ? "" : + $CPAN::Config->{tar_verbosity}; + } + if ($prefer==1) { # 1 => external gzip+tar + my($system); + my $is_compressed = $self->gtest(); + my $tarcommand = CPAN::HandleConfig->safe_quote($exttar); + if ($is_compressed) { + my $command = CPAN::HandleConfig->safe_quote($extgzip); + $system = qq{$command -d -c }. + qq{< "$file" | $tarcommand x${tar_verb}f -}; + } else { + $system = qq{$tarcommand x${tar_verb}f "$file"}; + } + if (system($system) != 0) { + # people find the most curious tar binaries that cannot handle + # pipes + if ($is_compressed) { + (my $ungzf = $file) =~ s/\.gz(?!\n)\Z//; + $ungzf = basename $ungzf; + my $ct = CPAN::Tarzip->new($file); + if ($ct->gunzip($ungzf)) { + $CPAN::Frontend->myprint(qq{Uncompressed $file successfully\n}); + } else { + $CPAN::Frontend->mydie(qq{Couldn\'t uncompress $file\n}); + } + $file = $ungzf; + } + $system = qq{$tarcommand x${tar_verb}f "$file"}; + $CPAN::Frontend->myprint(qq{Using Tar:$system:\n}); + my $ret = system($system); + if ($ret==0) { + $CPAN::Frontend->myprint(qq{Untarred $file successfully\n}); + } else { + if ($? == -1) { + $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: '%s'\n}, + $file, $!); + } elsif ($? & 127) { + $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: child died with signal %d, %s coredump\n}, + $file, ($? & 127), ($? & 128) ? 'with' : 'without'); + } else { + $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: child exited with value %d\n}, + $file, $? >> 8); + } + } + return 1; + } else { + return 1; + } + } elsif ($prefer==2) { # 2 => modules + unless ($CPAN::META->has_usable("Archive::Tar")) { + $CPAN::Frontend->mydie("Archive::Tar not installed, please install it to continue"); + } + # Make sure AT does not use uid/gid/permissions in the archive + # This leaves it to the user's umask instead + local $Archive::Tar::CHMOD = 1; + local $Archive::Tar::SAME_PERMISSIONS = 0; + # Make sure AT leaves current user as owner + local $Archive::Tar::CHOWN = 0; + my $tar = Archive::Tar->new($file,1); + my $af; # archive file + my @af; + if ($BUGHUNTING) { + # RCS 1.337 had this code, it turned out unacceptable slow but + # it revealed a bug in Archive::Tar. Code is only here to hunt + # the bug again. It should never be enabled in published code. + # GDGraph3d-0.53 was an interesting case according to Larry + # Virden. + warn(">>>Bughunting code enabled<<< " x 20); + for $af ($tar->list_files) { + if ($af =~ m!^(/|\.\./)!) { + $CPAN::Frontend->mydie("ALERT: Archive contains ". + "illegal member [$af]"); + } + $CPAN::Frontend->myprint("$af\n"); + $tar->extract($af); # slow but effective for finding the bug + return if $CPAN::Signal; + } + } else { + for $af ($tar->list_files) { + if ($af =~ m!^(/|\.\./)!) { + $CPAN::Frontend->mydie("ALERT: Archive contains ". + "illegal member [$af]"); + } + if ($tar_verb eq "v" || $tar_verb eq "vv") { + $CPAN::Frontend->myprint("$af\n"); + } + push @af, $af; + return if $CPAN::Signal; + } + $tar->extract(@af) or + $CPAN::Frontend->mydie("Could not untar with Archive::Tar."); + } + + Mac::BuildTools::convert_files([$tar->list_files], 1) + if ($^O eq 'MacOS'); + + return 1; + } +} + +sub unzip { + my($self) = @_; + my $file = $self->{FILE}; + if ($CPAN::META->has_inst("Archive::Zip")) { + # blueprint of the code from Archive::Zip::Tree::extractTree(); + my $zip = Archive::Zip->new(); + my $status; + $status = $zip->read($file); + $CPAN::Frontend->mydie("Read of file[$file] failed\n") + if $status != Archive::Zip::AZ_OK(); + $CPAN::META->debug("Successfully read file[$file]") if $CPAN::DEBUG; + my @members = $zip->members(); + for my $member ( @members ) { + my $af = $member->fileName(); + if ($af =~ m!^(/|\.\./)!) { + $CPAN::Frontend->mydie("ALERT: Archive contains ". + "illegal member [$af]"); + } + $status = $member->extractToFileNamed( $af ); + $CPAN::META->debug("af[$af]status[$status]") if $CPAN::DEBUG; + $CPAN::Frontend->mydie("Extracting of file[$af] from zipfile[$file] failed\n") if + $status != Archive::Zip::AZ_OK(); + return if $CPAN::Signal; + } + return 1; + } elsif ( my $unzip = $CPAN::Config->{unzip} ) { + my @system = ($unzip, $file); + return system(@system) == 0; + } + else { + $CPAN::Frontend->mydie(<<"END"); + +Can't unzip '$file': + +You have not configured an 'unzip' program and do not have Archive::Zip +installed. Please either install Archive::Zip or else configure 'unzip' +by running the command 'o conf init unzip' from the CPAN shell prompt. + +END + } +} + +1; + +__END__ + +=head1 NAME + +CPAN::Tarzip - internal handling of tar archives for CPAN.pm + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/URL.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/URL.pm new file mode 100644 index 0000000000000000000000000000000000000000..52b42eec88ebc92ebed8ce7711d2bbfde02f46a3 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/URL.pm @@ -0,0 +1,31 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: +package CPAN::URL; +use overload '""' => "as_string", fallback => 1; +# accessors: TEXT(the url string), FROM(DEF=>defaultlist,USER=>urllist), +# planned are things like age or quality + +use vars qw( + $VERSION +); +$VERSION = "5.5"; + +sub new { + my($class,%args) = @_; + bless { + %args + }, $class; +} +sub as_string { + my($self) = @_; + $self->text; +} +sub text { + my($self,$set) = @_; + if (defined $set) { + $self->{TEXT} = $set; + } + $self->{TEXT}; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/CPAN/Version.pm b/data/miniconda3/lib/perl5/core_perl/CPAN/Version.pm new file mode 100644 index 0000000000000000000000000000000000000000..fa75221d9da357bdae2fec4f38521ea0ff1a8ec7 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/CPAN/Version.pm @@ -0,0 +1,177 @@ +package CPAN::Version; + +use strict; +use vars qw($VERSION); +$VERSION = "5.5003"; + +# CPAN::Version::vcmp courtesy Jost Krieger +sub vcmp { + my($self,$l,$r) = @_; + local($^W) = 0; + CPAN->debug("l[$l] r[$r]") if $CPAN::DEBUG; + + # treat undef as zero + $l = 0 if $l eq 'undef'; + $r = 0 if $r eq 'undef'; + + return 0 if $l eq $r; # short circuit for quicker success + + for ($l,$r) { + s/_//g; + } + CPAN->debug("l[$l] r[$r]") if $CPAN::DEBUG; + for ($l,$r) { + next unless tr/.// > 1 || /^v/; + s/^v?/v/; + 1 while s/\.0+(\d)/.$1/; # remove leading zeroes per group + } + CPAN->debug("l[$l] r[$r]") if $CPAN::DEBUG; + if ($l=~/^v/ <=> $r=~/^v/) { + for ($l,$r) { + next if /^v/; + $_ = $self->float2vv($_); + } + } + CPAN->debug("l[$l] r[$r]") if $CPAN::DEBUG; + my $lvstring = "v0"; + my $rvstring = "v0"; + if ($] >= 5.006 + && $l =~ /^v/ + && $r =~ /^v/) { + $lvstring = $self->vstring($l); + $rvstring = $self->vstring($r); + CPAN->debug(sprintf "lv[%vd] rv[%vd]", $lvstring, $rvstring) if $CPAN::DEBUG; + } + + return ( + ($l ne "undef") <=> ($r ne "undef") + || + $lvstring cmp $rvstring + || + $l <=> $r + || + $l cmp $r + ); +} + +sub vgt { + my($self,$l,$r) = @_; + $self->vcmp($l,$r) > 0; +} + +sub vlt { + my($self,$l,$r) = @_; + $self->vcmp($l,$r) < 0; +} + +sub vge { + my($self,$l,$r) = @_; + $self->vcmp($l,$r) >= 0; +} + +sub vle { + my($self,$l,$r) = @_; + $self->vcmp($l,$r) <= 0; +} + +sub vstring { + my($self,$n) = @_; + $n =~ s/^v// or die "CPAN::Version::vstring() called with invalid arg [$n]"; + pack "U*", split /\./, $n; +} + +# vv => visible vstring +sub float2vv { + my($self,$n) = @_; + my($rev) = int($n); + $rev ||= 0; + my($mantissa) = $n =~ /\.(\d{1,12})/; # limit to 12 digits to limit + # architecture influence + $mantissa ||= 0; + $mantissa .= "0" while length($mantissa)%3; + my $ret = "v" . $rev; + while ($mantissa) { + $mantissa =~ s/(\d{1,3})// or + die "Panic: length>0 but not a digit? mantissa[$mantissa]"; + $ret .= ".".int($1); + } + # warn "n[$n]ret[$ret]"; + $ret =~ s/(\.0)+/.0/; # v1.0.0 => v1.0 + $ret; +} + +sub readable { + my($self,$n) = @_; + $n =~ /^([\w\-\+\.]+)/; + + return $1 if defined $1 && length($1)>0; + # if the first user reaches version v43, he will be treated as "+". + # We'll have to decide about a new rule here then, depending on what + # will be the prevailing versioning behavior then. + + if ($] < 5.006) { # or whenever v-strings were introduced + # we get them wrong anyway, whatever we do, because 5.005 will + # have already interpreted 0.2.4 to be "0.24". So even if he + # indexer sends us something like "v0.2.4" we compare wrongly. + + # And if they say v1.2, then the old perl takes it as "v12" + + if (defined $CPAN::Frontend) { + $CPAN::Frontend->mywarn("Suspicious version string seen [$n]\n"); + } else { + warn("Suspicious version string seen [$n]\n"); + } + return $n; + } + my $better = sprintf "v%vd", $n; + CPAN->debug("n[$n] better[$better]") if $CPAN::DEBUG; + return $better; +} + +1; + +__END__ + +=head1 NAME + +CPAN::Version - utility functions to compare CPAN versions + +=head1 SYNOPSIS + + use CPAN::Version; + + CPAN::Version->vgt("1.1","1.1.1"); # 1 bc. 1.1 > 1.001001 + + CPAN::Version->vlt("1.1","1.1"); # 0 bc. 1.1 not < 1.1 + + CPAN::Version->vcmp("1.1","1.1.1"); # 1 bc. first is larger + + CPAN::Version->vcmp("1.1.1","1.1"); # -1 bc. first is smaller + + CPAN::Version->readable(v1.2.3); # "v1.2.3" + + CPAN::Version->vstring("v1.2.3"); # v1.2.3 + + CPAN::Version->float2vv(1.002003); # "v1.2.3" + +=head1 DESCRIPTION + +This module mediates between some version that perl sees in a package +and the version that is published by the CPAN indexer. + +It's only written as a helper module for both CPAN.pm and CPANPLUS.pm. + +As it stands it predates version.pm but has the same goal: make +version strings visible and comparable. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# End: diff --git a/data/miniconda3/lib/perl5/core_perl/Carp.pm b/data/miniconda3/lib/perl5/core_perl/Carp.pm new file mode 100644 index 0000000000000000000000000000000000000000..109b7fec7703f2f1211bcd67c24f2fc57ae0de81 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Carp.pm @@ -0,0 +1,1072 @@ +package Carp; + +{ use 5.006; } +use strict; +use warnings; +BEGIN { + # Very old versions of warnings.pm load Carp. This can go wrong due + # to the circular dependency. If warnings is invoked before Carp, + # then warnings starts by loading Carp, then Carp (above) tries to + # invoke warnings, and gets nothing because warnings is in the process + # of loading and hasn't defined its import method yet. If we were + # only turning on warnings ("use warnings" above) this wouldn't be too + # bad, because Carp would just gets the state of the -w switch and so + # might not get some warnings that it wanted. The real problem is + # that we then want to turn off Unicode warnings, but "no warnings + # 'utf8'" won't be effective if we're in this circular-dependency + # situation. So, if warnings.pm is an affected version, we turn + # off all warnings ourselves by directly setting ${^WARNING_BITS}. + # On unaffected versions, we turn off just Unicode warnings, via + # the proper API. + if(!defined($warnings::VERSION) || eval($warnings::VERSION) < 1.06) { + ${^WARNING_BITS} = ""; + } else { + "warnings"->unimport("utf8"); + } +} + +sub _fetch_sub { # fetch sub without autovivifying + my($pack, $sub) = @_; + $pack .= '::'; + # only works with top-level packages + return unless exists($::{$pack}); + for ($::{$pack}) { + return unless ref \$_ eq 'GLOB' && *$_{HASH} && exists $$_{$sub}; + for ($$_{$sub}) { + return ref \$_ eq 'GLOB' ? *$_{CODE} : undef + } + } +} + +# UTF8_REGEXP_PROBLEM is a compile-time constant indicating whether Carp +# must avoid applying a regular expression to an upgraded (is_utf8) +# string. There are multiple problems, on different Perl versions, +# that require this to be avoided. All versions prior to 5.13.8 will +# load utf8_heavy.pl for the swash system, even if the regexp doesn't +# use character classes. Perl 5.6 and Perls [5.11.2, 5.13.11) exhibit +# specific problems when Carp is being invoked in the aftermath of a +# syntax error. +BEGIN { + if("$]" < 5.013011) { + *UTF8_REGEXP_PROBLEM = sub () { 1 }; + } else { + *UTF8_REGEXP_PROBLEM = sub () { 0 }; + } +} + +# is_utf8() is essentially the utf8::is_utf8() function, which indicates +# whether a string is represented in the upgraded form (using UTF-8 +# internally). As utf8::is_utf8() is only available from Perl 5.8 +# onwards, extra effort is required here to make it work on Perl 5.6. +BEGIN { + if(defined(my $sub = _fetch_sub utf8 => 'is_utf8')) { + *is_utf8 = $sub; + } else { + # black magic for perl 5.6 + *is_utf8 = sub { unpack("C", "\xaa".$_[0]) != 170 }; + } +} + +# The downgrade() function defined here is to be used for attempts to +# downgrade where it is acceptable to fail. It must be called with a +# second argument that is a true value. +BEGIN { + if(defined(my $sub = _fetch_sub utf8 => 'downgrade')) { + *downgrade = \&{"utf8::downgrade"}; + } else { + *downgrade = sub { + my $r = ""; + my $l = length($_[0]); + for(my $i = 0; $i != $l; $i++) { + my $o = ord(substr($_[0], $i, 1)); + return if $o > 255; + $r .= chr($o); + } + $_[0] = $r; + }; + } +} + +# is_safe_printable_codepoint() indicates whether a character, specified +# by integer codepoint, is OK to output literally in a trace. Generally +# this is if it is a printable character in the ancestral character set +# (ASCII or EBCDIC). This is used on some Perls in situations where a +# regexp can't be used. +BEGIN { + *is_safe_printable_codepoint = + "$]" >= 5.007_003 ? + eval(q(sub ($) { + my $u = utf8::native_to_unicode($_[0]); + $u >= 0x20 && $u <= 0x7e; + })) + : ord("A") == 65 ? + sub ($) { $_[0] >= 0x20 && $_[0] <= 0x7e } + : + sub ($) { + # Early EBCDIC + # 3 EBCDIC code pages supported then; all controls but one + # are the code points below SPACE. The other one is 0x5F on + # POSIX-BC; FF on the other two. + # FIXME: there are plenty of unprintable codepoints other + # than those that this code and the comment above identifies + # as "controls". + $_[0] >= ord(" ") && $_[0] <= 0xff && + $_[0] != (ord ("^") == 106 ? 0x5f : 0xff); + } + ; +} + +sub _univ_mod_loaded { + return 0 unless exists($::{"UNIVERSAL::"}); + for ($::{"UNIVERSAL::"}) { + return 0 unless ref \$_ eq "GLOB" && *$_{HASH} && exists $$_{"$_[0]::"}; + for ($$_{"$_[0]::"}) { + return 0 unless ref \$_ eq "GLOB" && *$_{HASH} && exists $$_{"VERSION"}; + for ($$_{"VERSION"}) { + return 0 unless ref \$_ eq "GLOB"; + return ${*$_{SCALAR}}; + } + } + } +} + +# _maybe_isa() is usually the UNIVERSAL::isa function. We have to avoid +# the latter if the UNIVERSAL::isa module has been loaded, to avoid infi- +# nite recursion; in that case _maybe_isa simply returns true. +my $isa; +BEGIN { + if (_univ_mod_loaded('isa')) { + *_maybe_isa = sub { 1 } + } + else { + # Since we have already done the check, record $isa for use below + # when defining _StrVal. + *_maybe_isa = $isa = _fetch_sub(UNIVERSAL => "isa"); + } +} + + +# We need an overload::StrVal or equivalent function, but we must avoid +# loading any modules on demand, as Carp is used from __DIE__ handlers and +# may be invoked after a syntax error. +# We can copy recent implementations of overload::StrVal and use +# overloading.pm, which is the fastest implementation, so long as +# overloading is available. If it is not available, we use our own pure- +# Perl StrVal. We never actually use overload::StrVal, for various rea- +# sons described below. +# overload versions are as follows: +# undef-1.00 (up to perl 5.8.0) uses bless (avoid!) +# 1.01-1.17 (perl 5.8.1 to 5.14) uses Scalar::Util +# 1.18+ (perl 5.16+) uses overloading +# The ancient 'bless' implementation (that inspires our pure-Perl version) +# blesses unblessed references and must be avoided. Those using +# Scalar::Util use refaddr, possibly the pure-Perl implementation, which +# has the same blessing bug, and must be avoided. Also, Scalar::Util is +# loaded on demand. Since we avoid the Scalar::Util implementations, we +# end up having to implement our own overloading.pm-based version for perl +# 5.10.1 to 5.14. Since it also works just as well in more recent ver- +# sions, we use it there, too. +BEGIN { + if (eval { require "overloading.pm" }) { + *_StrVal = eval 'sub { no overloading; "$_[0]" }' + } + else { + # Work around the UNIVERSAL::can/isa modules to avoid recursion. + + # _mycan is either UNIVERSAL::can, or, in the presence of an + # override, overload::mycan. + *_mycan = _univ_mod_loaded('can') + ? do { require "overload.pm"; _fetch_sub overload => 'mycan' } + : \&UNIVERSAL::can; + + # _blessed is either UNIVERAL::isa(...), or, in the presence of an + # override, a hideous, but fairly reliable, workaround. + *_blessed = $isa + ? sub { &$isa($_[0], "UNIVERSAL") } + : sub { + my $probe = "UNIVERSAL::Carp_probe_" . rand; + no strict 'refs'; + local *$probe = sub { "unlikely string" }; + local $@; + local $SIG{__DIE__} = sub{}; + (eval { $_[0]->$probe } || '') eq 'unlikely string' + }; + + *_StrVal = sub { + my $pack = ref $_[0]; + # Perl's overload mechanism uses the presence of a special + # "method" named "((" or "()" to signal it is in effect. + # This test seeks to see if it has been set up. "((" post- + # dates overloading.pm, so we can skip it. + return "$_[0]" unless _mycan($pack, "()"); + # Even at this point, the invocant may not be blessed, so + # check for that. + return "$_[0]" if not _blessed($_[0]); + bless $_[0], "Carp"; + my $str = "$_[0]"; + bless $_[0], $pack; + $pack . substr $str, index $str, "="; + } + } +} + + +our $VERSION = '1.50'; +$VERSION =~ tr/_//d; + +our $MaxEvalLen = 0; +our $Verbose = 0; +our $CarpLevel = 0; +our $MaxArgLen = 64; # How much of each argument to print. 0 = all. +our $MaxArgNums = 8; # How many arguments to print. 0 = all. +our $RefArgFormatter = undef; # allow caller to format reference arguments + +require Exporter; +our @ISA = ('Exporter'); +our @EXPORT = qw(confess croak carp); +our @EXPORT_OK = qw(cluck verbose longmess shortmess); +our @EXPORT_FAIL = qw(verbose); # hook to enable verbose mode + +# The members of %Internal are packages that are internal to perl. +# Carp will not report errors from within these packages if it +# can. The members of %CarpInternal are internal to Perl's warning +# system. Carp will not report errors from within these packages +# either, and will not report calls *to* these packages for carp and +# croak. They replace $CarpLevel, which is deprecated. The +# $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval +# text and function arguments should be formatted when printed. + +our %CarpInternal; +our %Internal; + +# disable these by default, so they can live w/o require Carp +$CarpInternal{Carp}++; +$CarpInternal{warnings}++; +$Internal{Exporter}++; +$Internal{'Exporter::Heavy'}++; + +# if the caller specifies verbose usage ("perl -MCarp=verbose script.pl") +# then the following method will be called by the Exporter which knows +# to do this thanks to @EXPORT_FAIL, above. $_[1] will contain the word +# 'verbose'. + +sub export_fail { shift; $Verbose = shift if $_[0] eq 'verbose'; @_ } + +sub _cgc { + no strict 'refs'; + return \&{"CORE::GLOBAL::caller"} if defined &{"CORE::GLOBAL::caller"}; + return; +} + +sub longmess { + local($!, $^E); + # Icky backwards compatibility wrapper. :-( + # + # The story is that the original implementation hard-coded the + # number of call levels to go back, so calls to longmess were off + # by one. Other code began calling longmess and expecting this + # behaviour, so the replacement has to emulate that behaviour. + my $cgc = _cgc(); + my $call_pack = $cgc ? $cgc->() : caller(); + if ( $Internal{$call_pack} or $CarpInternal{$call_pack} ) { + return longmess_heavy(@_); + } + else { + local $CarpLevel = $CarpLevel + 1; + return longmess_heavy(@_); + } +} + +our @CARP_NOT; + +sub shortmess { + local($!, $^E); + my $cgc = _cgc(); + + # Icky backwards compatibility wrapper. :-( + local @CARP_NOT = $cgc ? $cgc->() : caller(); + shortmess_heavy(@_); +} + +sub croak { die shortmess @_ } +sub confess { die longmess @_ } +sub carp { warn shortmess @_ } +sub cluck { warn longmess @_ } + +BEGIN { + if("$]" >= 5.015002 || ("$]" >= 5.014002 && "$]" < 5.015) || + ("$]" >= 5.012005 && "$]" < 5.013)) { + *CALLER_OVERRIDE_CHECK_OK = sub () { 1 }; + } else { + *CALLER_OVERRIDE_CHECK_OK = sub () { 0 }; + } +} + +sub caller_info { + my $i = shift(@_) + 1; + my %call_info; + my $cgc = _cgc(); + { + # Some things override caller() but forget to implement the + # @DB::args part of it, which we need. We check for this by + # pre-populating @DB::args with a sentinel which no-one else + # has the address of, so that we can detect whether @DB::args + # has been properly populated. However, on earlier versions + # of perl this check tickles a bug in CORE::caller() which + # leaks memory. So we only check on fixed perls. + @DB::args = \$i if CALLER_OVERRIDE_CHECK_OK; + package DB; + @call_info{ + qw(pack file line sub has_args wantarray evaltext is_require) } + = $cgc ? $cgc->($i) : caller($i); + } + + unless ( defined $call_info{file} ) { + return (); + } + + my $sub_name = Carp::get_subname( \%call_info ); + if ( $call_info{has_args} ) { + # Guard our serialization of the stack from stack refcounting bugs + # NOTE this is NOT a complete solution, we cannot 100% guard against + # these bugs. However in many cases Perl *is* capable of detecting + # them and throws an error when it does. Unfortunately serializing + # the arguments on the stack is a perfect way of finding these bugs, + # even when they would not affect normal program flow that did not + # poke around inside the stack. Inside of Carp.pm it makes little + # sense reporting these bugs, as Carp's job is to report the callers + # errors, not the ones it might happen to tickle while doing so. + # See: https://rt.perl.org/Public/Bug/Display.html?id=131046 + # and: https://rt.perl.org/Public/Bug/Display.html?id=52610 + # for more details and discussion. - Yves + my @args = map { + my $arg; + local $@= $@; + eval { + $arg = $_; + 1; + } or do { + $arg = '** argument not available anymore **'; + }; + $arg; + } @DB::args; + if (CALLER_OVERRIDE_CHECK_OK && @args == 1 + && ref $args[0] eq ref \$i + && $args[0] == \$i ) { + @args = (); # Don't let anyone see the address of $i + local $@; + my $where = eval { + my $func = $cgc or return ''; + my $gv = + (_fetch_sub B => 'svref_2object' or return '') + ->($func)->GV; + my $package = $gv->STASH->NAME; + my $subname = $gv->NAME; + return unless defined $package && defined $subname; + + # returning CORE::GLOBAL::caller isn't useful for tracing the cause: + return if $package eq 'CORE::GLOBAL' && $subname eq 'caller'; + " in &${package}::$subname"; + } || ''; + @args + = "** Incomplete caller override detected$where; \@DB::args were not set **"; + } + else { + my $overflow; + if ( $MaxArgNums and @args > $MaxArgNums ) + { # More than we want to show? + $#args = $MaxArgNums - 1; + $overflow = 1; + } + + @args = map { Carp::format_arg($_) } @args; + + if ($overflow) { + push @args, '...'; + } + } + + # Push the args onto the subroutine + $sub_name .= '(' . join( ', ', @args ) . ')'; + } + $call_info{sub_name} = $sub_name; + return wantarray() ? %call_info : \%call_info; +} + +# Transform an argument to a function into a string. +our $in_recurse; +sub format_arg { + my $arg = shift; + + if ( my $pack= ref($arg) ) { + + # legitimate, let's not leak it. + if (!$in_recurse && _maybe_isa( $arg, 'UNIVERSAL' ) && + do { + local $@; + local $in_recurse = 1; + local $SIG{__DIE__} = sub{}; + eval {$arg->can('CARP_TRACE') } + }) + { + return $arg->CARP_TRACE(); + } + elsif (!$in_recurse && + defined($RefArgFormatter) && + do { + local $@; + local $in_recurse = 1; + local $SIG{__DIE__} = sub{}; + eval {$arg = $RefArgFormatter->($arg); 1} + }) + { + return $arg; + } + else + { + # Argument may be blessed into a class with overloading, and so + # might have an overloaded stringification. We don't want to + # risk getting the overloaded stringification, so we need to + # use _StrVal, our overload::StrVal()-equivalent. + return _StrVal $arg; + } + } + return "undef" if !defined($arg); + downgrade($arg, 1); + return $arg if !(UTF8_REGEXP_PROBLEM && is_utf8($arg)) && + $arg =~ /\A-?[0-9]+(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?\z/; + my $suffix = ""; + if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) { + substr ( $arg, $MaxArgLen - 3 ) = ""; + $suffix = "..."; + } + if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) { + for(my $i = length($arg); $i--; ) { + my $c = substr($arg, $i, 1); + my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2} + if($c eq "\"" || $c eq "\\" || $c eq "\$" || $c eq "\@") { + substr $arg, $i, 0, "\\"; + next; + } + my $o = ord($c); + substr $arg, $i, 1, sprintf("\\x{%x}", $o) + unless is_safe_printable_codepoint($o); + } + } else { + $arg =~ s/([\"\\\$\@])/\\$1/g; + # This is all the ASCII printables spelled-out. It is portable to all + # Perl versions and platforms (such as EBCDIC). There are other more + # compact ways to do this, but may not work everywhere every version. + $arg =~ s/([^ !"#\$\%\&'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg; + } + downgrade($arg, 1); + return "\"".$arg."\"".$suffix; +} + +sub Regexp::CARP_TRACE { + my $arg = "$_[0]"; + downgrade($arg, 1); + if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) { + for(my $i = length($arg); $i--; ) { + my $o = ord(substr($arg, $i, 1)); + my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2} + substr $arg, $i, 1, sprintf("\\x{%x}", $o) + unless is_safe_printable_codepoint($o); + } + } else { + # See comment in format_arg() about this same regex. + $arg =~ s/([^ !"#\$\%\&'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg; + } + downgrade($arg, 1); + my $suffix = ""; + if($arg =~ /\A\(\?\^?([a-z]*)(?:-[a-z]*)?:(.*)\)\z/s) { + ($suffix, $arg) = ($1, $2); + } + if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) { + substr ( $arg, $MaxArgLen - 3 ) = ""; + $suffix = "...".$suffix; + } + return "qr($arg)$suffix"; +} + +# Takes an inheritance cache and a package and returns +# an anon hash of known inheritances and anon array of +# inheritances which consequences have not been figured +# for. +sub get_status { + my $cache = shift; + my $pkg = shift; + $cache->{$pkg} ||= [ { $pkg => $pkg }, [ trusts_directly($pkg) ] ]; + return @{ $cache->{$pkg} }; +} + +# Takes the info from caller() and figures out the name of +# the sub/require/eval +sub get_subname { + my $info = shift; + if ( defined( $info->{evaltext} ) ) { + my $eval = $info->{evaltext}; + if ( $info->{is_require} ) { + return "require $eval"; + } + else { + $eval =~ s/([\\\'])/\\$1/g; + return "eval '" . str_len_trim( $eval, $MaxEvalLen ) . "'"; + } + } + + # this can happen on older perls when the sub (or the stash containing it) + # has been deleted + if ( !defined( $info->{sub} ) ) { + return '__ANON__::__ANON__'; + } + + return ( $info->{sub} eq '(eval)' ) ? 'eval {...}' : $info->{sub}; +} + +# Figures out what call (from the point of view of the caller) +# the long error backtrace should start at. +sub long_error_loc { + my $i; + my $lvl = $CarpLevel; + { + ++$i; + my $cgc = _cgc(); + my @caller = $cgc ? $cgc->($i) : caller($i); + my $pkg = $caller[0]; + unless ( defined($pkg) ) { + + # This *shouldn't* happen. + if (%Internal) { + local %Internal; + $i = long_error_loc(); + last; + } + elsif (defined $caller[2]) { + # this can happen when the stash has been deleted + # in that case, just assume that it's a reasonable place to + # stop (the file and line data will still be intact in any + # case) - the only issue is that we can't detect if the + # deleted package was internal (so don't do that then) + # -doy + redo unless 0 > --$lvl; + last; + } + else { + return 2; + } + } + redo if $CarpInternal{$pkg}; + redo unless 0 > --$lvl; + redo if $Internal{$pkg}; + } + return $i - 1; +} + +sub longmess_heavy { + if ( ref( $_[0] ) ) { # don't break references as exceptions + return wantarray ? @_ : $_[0]; + } + my $i = long_error_loc(); + return ret_backtrace( $i, @_ ); +} + +BEGIN { + if("$]" >= 5.017004) { + # The LAST_FH constant is a reference to the variable. + $Carp::{LAST_FH} = \eval '\${^LAST_FH}'; + } else { + eval '*LAST_FH = sub () { 0 }'; + } +} + +# Returns a full stack backtrace starting from where it is +# told. +sub ret_backtrace { + my ( $i, @error ) = @_; + my $mess; + my $err = join '', @error; + $i++; + + my $tid_msg = ''; + if ( defined &threads::tid ) { + my $tid = threads->tid; + $tid_msg = " thread $tid" if $tid; + } + + my %i = caller_info($i); + $mess = "$err at $i{file} line $i{line}$tid_msg"; + if( $. ) { + # Use ${^LAST_FH} if available. + if (LAST_FH) { + if (${+LAST_FH}) { + $mess .= sprintf ", <%s> %s %d", + *${+LAST_FH}{NAME}, + ($/ eq "\n" ? "line" : "chunk"), $. + } + } + else { + local $@ = ''; + local $SIG{__DIE__}; + eval { + CORE::die; + }; + if($@ =~ /^Died at .*(, <.*?> (?:line|chunk) \d+).$/ ) { + $mess .= $1; + } + } + } + $mess .= "\.\n"; + + while ( my %i = caller_info( ++$i ) ) { + $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n"; + } + + return $mess; +} + +sub ret_summary { + my ( $i, @error ) = @_; + my $err = join '', @error; + $i++; + + my $tid_msg = ''; + if ( defined &threads::tid ) { + my $tid = threads->tid; + $tid_msg = " thread $tid" if $tid; + } + + my %i = caller_info($i); + return "$err at $i{file} line $i{line}$tid_msg\.\n"; +} + +sub short_error_loc { + # You have to create your (hash)ref out here, rather than defaulting it + # inside trusts *on a lexical*, as you want it to persist across calls. + # (You can default it on $_[2], but that gets messy) + my $cache = {}; + my $i = 1; + my $lvl = $CarpLevel; + { + my $cgc = _cgc(); + my $called = $cgc ? $cgc->($i) : caller($i); + $i++; + my $caller = $cgc ? $cgc->($i) : caller($i); + + if (!defined($caller)) { + my @caller = $cgc ? $cgc->($i) : caller($i); + if (@caller) { + # if there's no package but there is other caller info, then + # the package has been deleted - treat this as a valid package + # in this case + redo if defined($called) && $CarpInternal{$called}; + redo unless 0 > --$lvl; + last; + } + else { + return 0; + } + } + redo if $Internal{$caller}; + redo if $CarpInternal{$caller}; + redo if $CarpInternal{$called}; + redo if trusts( $called, $caller, $cache ); + redo if trusts( $caller, $called, $cache ); + redo unless 0 > --$lvl; + } + return $i - 1; +} + +sub shortmess_heavy { + return longmess_heavy(@_) if $Verbose; + return @_ if ref( $_[0] ); # don't break references as exceptions + my $i = short_error_loc(); + if ($i) { + ret_summary( $i, @_ ); + } + else { + longmess_heavy(@_); + } +} + +# If a string is too long, trims it with ... +sub str_len_trim { + my $str = shift; + my $max = shift || 0; + if ( 2 < $max and $max < length($str) ) { + substr( $str, $max - 3 ) = '...'; + } + return $str; +} + +# Takes two packages and an optional cache. Says whether the +# first inherits from the second. +# +# Recursive versions of this have to work to avoid certain +# possible endless loops, and when following long chains of +# inheritance are less efficient. +sub trusts { + my $child = shift; + my $parent = shift; + my $cache = shift; + my ( $known, $partial ) = get_status( $cache, $child ); + + # Figure out consequences until we have an answer + while ( @$partial and not exists $known->{$parent} ) { + my $anc = shift @$partial; + next if exists $known->{$anc}; + $known->{$anc}++; + my ( $anc_knows, $anc_partial ) = get_status( $cache, $anc ); + my @found = keys %$anc_knows; + @$known{@found} = (); + push @$partial, @$anc_partial; + } + return exists $known->{$parent}; +} + +# Takes a package and gives a list of those trusted directly +sub trusts_directly { + my $class = shift; + no strict 'refs'; + my $stash = \%{"$class\::"}; + for my $var (qw/ CARP_NOT ISA /) { + # Don't try using the variable until we know it exists, + # to avoid polluting the caller's namespace. + if ( $stash->{$var} && ref \$stash->{$var} eq 'GLOB' + && *{$stash->{$var}}{ARRAY} && @{$stash->{$var}} ) { + return @{$stash->{$var}} + } + } + return; +} + +if(!defined($warnings::VERSION) || + do { no warnings "numeric"; $warnings::VERSION < 1.03 }) { + # Very old versions of warnings.pm import from Carp. This can go + # wrong due to the circular dependency. If Carp is invoked before + # warnings, then Carp starts by loading warnings, then warnings + # tries to import from Carp, and gets nothing because Carp is in + # the process of loading and hasn't defined its import method yet. + # So we work around that by manually exporting to warnings here. + no strict "refs"; + *{"warnings::$_"} = \&$_ foreach @EXPORT; +} + +1; + +__END__ + +=head1 NAME + +Carp - alternative warn and die for modules + +=head1 SYNOPSIS + + use Carp; + + # warn user (from perspective of caller) + carp "string trimmed to 80 chars"; + + # die of errors (from perspective of caller) + croak "We're outta here!"; + + # die of errors with stack backtrace + confess "not implemented"; + + # cluck, longmess and shortmess not exported by default + use Carp qw(cluck longmess shortmess); + cluck "This is how we got here!"; # warn with stack backtrace + $long_message = longmess( "message from cluck() or confess()" ); + $short_message = shortmess( "message from carp() or croak()" ); + +=head1 DESCRIPTION + +The Carp routines are useful in your own modules because +they act like C<die()> or C<warn()>, but with a message which is more +likely to be useful to a user of your module. In the case of +C<cluck()> and C<confess()>, that context is a summary of every +call in the call-stack; C<longmess()> returns the contents of the error +message. + +For a shorter message you can use C<carp()> or C<croak()> which report the +error as being from where your module was called. C<shortmess()> returns the +contents of this error message. There is no guarantee that that is where the +error was, but it is a good educated guess. + +C<Carp> takes care not to clobber the status variables C<$!> and C<$^E> +in the course of assembling its error messages. This means that a +C<$SIG{__DIE__}> or C<$SIG{__WARN__}> handler can capture the error +information held in those variables, if it is required to augment the +error message, and if the code calling C<Carp> left useful values there. +Of course, C<Carp> can't guarantee the latter. + +You can also alter the way the output and logic of C<Carp> works, by +changing some global variables in the C<Carp> namespace. See the +section on C<GLOBAL VARIABLES> below. + +Here is a more complete description of how C<carp> and C<croak> work. +What they do is search the call-stack for a function call stack where +they have not been told that there shouldn't be an error. If every +call is marked safe, they give up and give a full stack backtrace +instead. In other words they presume that the first likely looking +potential suspect is guilty. Their rules for telling whether +a call shouldn't generate errors work as follows: + +=over 4 + +=item 1. + +Any call from a package to itself is safe. + +=item 2. + +Packages claim that there won't be errors on calls to or from +packages explicitly marked as safe by inclusion in C<@CARP_NOT>, or +(if that array is empty) C<@ISA>. The ability to override what +@ISA says is new in 5.8. + +=item 3. + +The trust in item 2 is transitive. If A trusts B, and B +trusts C, then A trusts C. So if you do not override C<@ISA> +with C<@CARP_NOT>, then this trust relationship is identical to, +"inherits from". + +=item 4. + +Any call from an internal Perl module is safe. (Nothing keeps +user modules from marking themselves as internal to Perl, but +this practice is discouraged.) + +=item 5. + +Any call to Perl's warning system (eg Carp itself) is safe. +(This rule is what keeps it from reporting the error at the +point where you call C<carp> or C<croak>.) + +=item 6. + +C<$Carp::CarpLevel> can be set to skip a fixed number of additional +call levels. Using this is not recommended because it is very +difficult to get it to behave correctly. + +=back + +=head2 Forcing a Stack Trace + +As a debugging aid, you can force Carp to treat a croak as a confess +and a carp as a cluck across I<all> modules. In other words, force a +detailed stack trace to be given. This can be very helpful when trying +to understand why, or from where, a warning or error is being generated. + +This feature is enabled by 'importing' the non-existent symbol +'verbose'. You would typically enable it by saying + + perl -MCarp=verbose script.pl + +or by including the string C<-MCarp=verbose> in the PERL5OPT +environment variable. + +Alternately, you can set the global variable C<$Carp::Verbose> to true. +See the C<GLOBAL VARIABLES> section below. + +=head2 Stack Trace formatting + +At each stack level, the subroutine's name is displayed along with +its parameters. For simple scalars, this is sufficient. For complex +data types, such as objects and other references, this can simply +display C<'HASH(0x1ab36d8)'>. + +Carp gives two ways to control this. + +=over 4 + +=item 1. + +For objects, a method, C<CARP_TRACE>, will be called, if it exists. If +this method doesn't exist, or it recurses into C<Carp>, or it otherwise +throws an exception, this is skipped, and Carp moves on to the next option, +otherwise checking stops and the string returned is used. It is recommended +that the object's type is part of the string to make debugging easier. + +=item 2. + +For any type of reference, C<$Carp::RefArgFormatter> is checked (see below). +This variable is expected to be a code reference, and the current parameter +is passed in. If this function doesn't exist (the variable is undef), or +it recurses into C<Carp>, or it otherwise throws an exception, this is +skipped, and Carp moves on to the next option, otherwise checking stops +and the string returned is used. + +=item 3. + +Otherwise, if neither C<CARP_TRACE> nor C<$Carp::RefArgFormatter> is +available, stringify the value ignoring any overloading. + +=back + +=head1 GLOBAL VARIABLES + +=head2 $Carp::MaxEvalLen + +This variable determines how many characters of a string-eval are to +be shown in the output. Use a value of C<0> to show all text. + +Defaults to C<0>. + +=head2 $Carp::MaxArgLen + +This variable determines how many characters of each argument to a +function to print. Use a value of C<0> to show the full length of the +argument. + +Defaults to C<64>. + +=head2 $Carp::MaxArgNums + +This variable determines how many arguments to each function to show. +Use a false value to show all arguments to a function call. To suppress all +arguments, use C<-1> or C<'0 but true'>. + +Defaults to C<8>. + +=head2 $Carp::Verbose + +This variable makes C<carp()> and C<croak()> generate stack backtraces +just like C<cluck()> and C<confess()>. This is how C<use Carp 'verbose'> +is implemented internally. + +Defaults to C<0>. + +=head2 $Carp::RefArgFormatter + +This variable sets a general argument formatter to display references. +Plain scalars and objects that implement C<CARP_TRACE> will not go through +this formatter. Calling C<Carp> from within this function is not supported. + +local $Carp::RefArgFormatter = sub { + require Data::Dumper; + Data::Dumper::Dump($_[0]); # not necessarily safe +}; + +=head2 @CARP_NOT + +This variable, I<in your package>, says which packages are I<not> to be +considered as the location of an error. The C<carp()> and C<cluck()> +functions will skip over callers when reporting where an error occurred. + +NB: This variable must be in the package's symbol table, thus: + + # These work + our @CARP_NOT; # file scope + use vars qw(@CARP_NOT); # package scope + @My::Package::CARP_NOT = ... ; # explicit package variable + + # These don't work + sub xyz { ... @CARP_NOT = ... } # w/o declarations above + my @CARP_NOT; # even at top-level + +Example of use: + + package My::Carping::Package; + use Carp; + our @CARP_NOT; + sub bar { .... or _error('Wrong input') } + sub _error { + # temporary control of where'ness, __PACKAGE__ is implicit + local @CARP_NOT = qw(My::Friendly::Caller); + carp(@_) + } + +This would make C<Carp> report the error as coming from a caller not +in C<My::Carping::Package>, nor from C<My::Friendly::Caller>. + +Also read the L</DESCRIPTION> section above, about how C<Carp> decides +where the error is reported from. + +Use C<@CARP_NOT>, instead of C<$Carp::CarpLevel>. + +Overrides C<Carp>'s use of C<@ISA>. + +=head2 %Carp::Internal + +This says what packages are internal to Perl. C<Carp> will never +report an error as being from a line in a package that is internal to +Perl. For example: + + $Carp::Internal{ (__PACKAGE__) }++; + # time passes... + sub foo { ... or confess("whatever") }; + +would give a full stack backtrace starting from the first caller +outside of __PACKAGE__. (Unless that package was also internal to +Perl.) + +=head2 %Carp::CarpInternal + +This says which packages are internal to Perl's warning system. For +generating a full stack backtrace this is the same as being internal +to Perl, the stack backtrace will not start inside packages that are +listed in C<%Carp::CarpInternal>. But it is slightly different for +the summary message generated by C<carp> or C<croak>. There errors +will not be reported on any lines that are calling packages in +C<%Carp::CarpInternal>. + +For example C<Carp> itself is listed in C<%Carp::CarpInternal>. +Therefore the full stack backtrace from C<confess> will not start +inside of C<Carp>, and the short message from calling C<croak> is +not placed on the line where C<croak> was called. + +=head2 $Carp::CarpLevel + +This variable determines how many additional call frames are to be +skipped that would not otherwise be when reporting where an error +occurred on a call to one of C<Carp>'s functions. It is fairly easy +to count these call frames on calls that generate a full stack +backtrace. However it is much harder to do this accounting for calls +that generate a short message. Usually people skip too many call +frames. If they are lucky they skip enough that C<Carp> goes all of +the way through the call stack, realizes that something is wrong, and +then generates a full stack backtrace. If they are unlucky then the +error is reported from somewhere misleading very high in the call +stack. + +Therefore it is best to avoid C<$Carp::CarpLevel>. Instead use +C<@CARP_NOT>, C<%Carp::Internal> and C<%Carp::CarpInternal>. + +Defaults to C<0>. + +=head1 BUGS + +The Carp routines don't handle exception objects currently. +If called with a first argument that is a reference, they simply +call die() or warn(), as appropriate. + +=head1 SEE ALSO + +L<Carp::Always>, +L<Carp::Clan> + +=head1 CONTRIBUTING + +L<Carp> is maintained by the perl 5 porters as part of the core perl 5 +version control repository. Please see the L<perlhack> perldoc for how to +submit patches and contribute to it. + +=head1 AUTHOR + +The Carp module first appeared in Larry Wall's perl 5.000 distribution. +Since then it has been modified by several of the perl 5 porters. +Andrew Main (Zefram) <zefram@fysh.org> divested Carp into an independent +distribution. + +=head1 COPYRIGHT + +Copyright (C) 1994-2013 Larry Wall + +Copyright (C) 2011, 2012, 2013 Andrew Main (Zefram) <zefram@fysh.org> + +=head1 LICENSE + +This module is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. diff --git a/data/miniconda3/lib/perl5/core_perl/Carp/Heavy.pm b/data/miniconda3/lib/perl5/core_perl/Carp/Heavy.pm new file mode 100644 index 0000000000000000000000000000000000000000..a9b803c76ad617d64175c42cb507f714f121a52a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Carp/Heavy.pm @@ -0,0 +1,21 @@ +package Carp::Heavy; + +use Carp (); + +our $VERSION = '1.50'; +$VERSION =~ tr/_//d; + +# Carp::Heavy was merged into Carp in version 1.12. Any mismatched versions +# after this point are not significant and can be ignored. +if(($Carp::VERSION || 0) < 1.12) { + my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef"; + die "Version mismatch between Carp $cv ($INC{q(Carp.pm)}) and Carp::Heavy $VERSION ($INC{q(Carp/Heavy.pm)}). Did you alter \@INC after Carp was loaded?\n"; +} + +1; + +# Most of the machinery of Carp used to be here. +# It has been moved in Carp.pm now, but this placeholder remains for +# the benefit of modules that like to preload Carp::Heavy directly. +# This must load Carp, because some modules rely on the historical +# behaviour of Carp::Heavy loading Carp. diff --git a/data/miniconda3/lib/perl5/core_perl/Class/Struct.pm b/data/miniconda3/lib/perl5/core_perl/Class/Struct.pm new file mode 100644 index 0000000000000000000000000000000000000000..c593dc7c3900a0aef9272ff5a7725fc1b6c6e479 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Class/Struct.pm @@ -0,0 +1,637 @@ +package Class::Struct; + +## See POD after __END__ + +use 5.006_001; + +use strict; +use warnings::register; +our(@ISA, @EXPORT, $VERSION); + +use Carp; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(struct); + +$VERSION = '0.66'; + +my $print = 0; +sub printem { + if (@_) { $print = shift } + else { $print++ } +} + +{ + package Class::Struct::Tie_ISA; + + sub TIEARRAY { + my $class = shift; + return bless [], $class; + } + + sub STORE { + my ($self, $index, $value) = @_; + Class::Struct::_subclass_error(); + } + + sub FETCH { + my ($self, $index) = @_; + $self->[$index]; + } + + sub FETCHSIZE { + my $self = shift; + return scalar(@$self); + } + + sub DESTROY { } +} + +sub import { + my $self = shift; + + if ( @_ == 0 ) { + $self->export_to_level( 1, $self, @EXPORT ); + } elsif ( @_ == 1 ) { + # This is admittedly a little bit silly: + # do we ever export anything else than 'struct'...? + $self->export_to_level( 1, $self, @_ ); + } else { + goto &struct; + } +} + +sub struct { + + # Determine parameter list structure, one of: + # struct( class => [ element-list ]) + # struct( class => { element-list }) + # struct( element-list ) + # Latter form assumes current package name as struct name. + + my ($class, @decls); + my $base_type = ref $_[1]; + if ( $base_type eq 'HASH' ) { + $class = shift; + @decls = %{shift()}; + _usage_error() if @_; + } + elsif ( $base_type eq 'ARRAY' ) { + $class = shift; + @decls = @{shift()}; + _usage_error() if @_; + } + else { + $base_type = 'ARRAY'; + $class = (caller())[0]; + @decls = @_; + } + + _usage_error() if @decls % 2 == 1; + + # Ensure we are not, and will not be, a subclass. + + my $isa = do { + no strict 'refs'; + \@{$class . '::ISA'}; + }; + _subclass_error() if @$isa; + tie @$isa, 'Class::Struct::Tie_ISA'; + + # Create constructor. + + croak "function 'new' already defined in package $class" + if do { no strict 'refs'; defined &{$class . "::new"} }; + + my @methods = (); + my %refs = (); + my %arrays = (); + my %hashes = (); + my %classes = (); + my $got_class = 0; + my $out = ''; + + $out = "{\n package $class;\n use Carp;\n sub new {\n"; + $out .= " my (\$class, \%init) = \@_;\n"; + $out .= " \$class = __PACKAGE__ unless \@_;\n"; + + my $cnt = 0; + my $idx = 0; + my( $cmt, $name, $type, $elem ); + + if( $base_type eq 'HASH' ){ + $out .= " my(\$r) = {};\n"; + $cmt = ''; + } + elsif( $base_type eq 'ARRAY' ){ + $out .= " my(\$r) = [];\n"; + } + + $out .= " bless \$r, \$class;\n\n"; + + while( $idx < @decls ){ + $name = $decls[$idx]; + $type = $decls[$idx+1]; + push( @methods, $name ); + if( $base_type eq 'HASH' ){ + $elem = "{'${class}::$name'}"; + } + elsif( $base_type eq 'ARRAY' ){ + $elem = "[$cnt]"; + ++$cnt; + $cmt = " # $name"; + } + if( $type =~ /^\*(.)/ ){ + $refs{$name}++; + $type = $1; + } + my $init = "defined(\$init{'$name'}) ? \$init{'$name'} :"; + if( $type eq '@' ){ + $out .= " croak 'Initializer for $name must be array reference'\n"; + $out .= " if defined(\$init{'$name'}) && ref(\$init{'$name'}) ne 'ARRAY';\n"; + $out .= " \$r->$name( $init [] );$cmt\n"; + $arrays{$name}++; + } + elsif( $type eq '%' ){ + $out .= " croak 'Initializer for $name must be hash reference'\n"; + $out .= " if defined(\$init{'$name'}) && ref(\$init{'$name'}) ne 'HASH';\n"; + $out .= " \$r->$name( $init {} );$cmt\n"; + $hashes{$name}++; + } + elsif ( $type eq '$') { + $out .= " \$r->$name( $init undef );$cmt\n"; + } + elsif( $type =~ /^\w+(?:::\w+)*$/ ){ + $out .= " if (defined(\$init{'$name'})) {\n"; + $out .= " if (ref \$init{'$name'} eq 'HASH')\n"; + $out .= " { \$r->$name( $type->new(\%{\$init{'$name'}}) ) } $cmt\n"; + $out .= " elsif (UNIVERSAL::isa(\$init{'$name'}, '$type'))\n"; + $out .= " { \$r->$name( \$init{'$name'} ) } $cmt\n"; + $out .= " else { croak 'Initializer for $name must be hash or $type reference' }\n"; + $out .= " }\n"; + $classes{$name} = $type; + $got_class = 1; + } + else{ + croak "'$type' is not a valid struct element type"; + } + $idx += 2; + } + + $out .= "\n \$r;\n}\n"; + + # Create accessor methods. + + my( $pre, $pst, $sel ); + $cnt = 0; + foreach $name (@methods){ + if ( do { no strict 'refs'; defined &{$class . "::$name"} } ) { + warnings::warnif("function '$name' already defined, overrides struct accessor method"); + } + else { + $pre = $pst = $cmt = $sel = ''; + if( defined $refs{$name} ){ + $pre = "\\("; + $pst = ")"; + $cmt = " # returns ref"; + } + $out .= " sub $name {$cmt\n my \$r = shift;\n"; + if( $base_type eq 'ARRAY' ){ + $elem = "[$cnt]"; + ++$cnt; + } + elsif( $base_type eq 'HASH' ){ + $elem = "{'${class}::$name'}"; + } + if( defined $arrays{$name} ){ + $out .= " my \$i;\n"; + $out .= " \@_ ? (\$i = shift) : return \$r->$elem;\n"; + $out .= " if (ref(\$i) eq 'ARRAY' && !\@_) { \$r->$elem = \$i; return \$r }\n"; + $sel = "->[\$i]"; + } + elsif( defined $hashes{$name} ){ + $out .= " my \$i;\n"; + $out .= " \@_ ? (\$i = shift) : return \$r->$elem;\n"; + $out .= " if (ref(\$i) eq 'HASH' && !\@_) { \$r->$elem = \$i; return \$r }\n"; + $sel = "->{\$i}"; + } + elsif( defined $classes{$name} ){ + $out .= " croak '$name argument is wrong class' if \@_ && ! UNIVERSAL::isa(\$_[0], '$classes{$name}');\n"; + } + $out .= " croak 'Too many args to $name' if \@_ > 1;\n"; + $out .= " \@_ ? ($pre\$r->$elem$sel = shift$pst) : $pre\$r->$elem$sel$pst;\n"; + $out .= " }\n"; + } + } + $out .= "}\n1;\n"; + + print $out if $print; + my $result = eval $out; + carp $@ if $@; +} + +sub _usage_error { + confess "struct usage error"; +} + +sub _subclass_error { + croak 'struct class cannot be a subclass (@ISA not allowed)'; +} + +1; # for require + + +__END__ + +=head1 NAME + +Class::Struct - declare struct-like datatypes as Perl classes + +=head1 SYNOPSIS + + use Class::Struct; + # declare struct, based on array: + struct( CLASS_NAME => [ ELEMENT_NAME => ELEMENT_TYPE, ... ]); + # declare struct, based on hash: + struct( CLASS_NAME => { ELEMENT_NAME => ELEMENT_TYPE, ... }); + + package CLASS_NAME; + use Class::Struct; + # declare struct, based on array, implicit class name: + struct( ELEMENT_NAME => ELEMENT_TYPE, ... ); + + # Declare struct at compile time + use Class::Struct CLASS_NAME => [ELEMENT_NAME => ELEMENT_TYPE, ...]; + use Class::Struct CLASS_NAME => {ELEMENT_NAME => ELEMENT_TYPE, ...}; + + # declare struct at compile time, based on array, implicit + # class name: + package CLASS_NAME; + use Class::Struct ELEMENT_NAME => ELEMENT_TYPE, ... ; + + package Myobj; + use Class::Struct; + # declare struct with four types of elements: + struct( s => '$', a => '@', h => '%', c => 'My_Other_Class' ); + + $obj = new Myobj; # constructor + + # scalar type accessor: + $element_value = $obj->s; # element value + $obj->s('new value'); # assign to element + + # array type accessor: + $ary_ref = $obj->a; # reference to whole array + $ary_element_value = $obj->a(2); # array element value + $obj->a(2, 'new value'); # assign to array element + + # hash type accessor: + $hash_ref = $obj->h; # reference to whole hash + $hash_element_value = $obj->h('x'); # hash element value + $obj->h('x', 'new value'); # assign to hash element + + # class type accessor: + $element_value = $obj->c; # object reference + $obj->c->method(...); # call method of object + $obj->c(new My_Other_Class); # assign a new object + +=head1 DESCRIPTION + +C<Class::Struct> exports a single function, C<struct>. +Given a list of element names and types, and optionally +a class name, C<struct> creates a Perl 5 class that implements +a "struct-like" data structure. + +The new class is given a constructor method, C<new>, for creating +struct objects. + +Each element in the struct data has an accessor method, which is +used to assign to the element and to fetch its value. The +default accessor can be overridden by declaring a C<sub> of the +same name in the package. (See Example 2.) + +Each element's type can be scalar, array, hash, or class. + +=head2 The C<struct()> function + +The C<struct> function has three forms of parameter-list. + + struct( CLASS_NAME => [ ELEMENT_LIST ]); + struct( CLASS_NAME => { ELEMENT_LIST }); + struct( ELEMENT_LIST ); + +The first and second forms explicitly identify the name of the +class being created. The third form assumes the current package +name as the class name. + +An object of a class created by the first and third forms is +based on an array, whereas an object of a class created by the +second form is based on a hash. The array-based forms will be +somewhat faster and smaller; the hash-based forms are more +flexible. + +The class created by C<struct> must not be a subclass of another +class other than C<UNIVERSAL>. + +It can, however, be used as a superclass for other classes. To facilitate +this, the generated constructor method uses a two-argument blessing. +Furthermore, if the class is hash-based, the key of each element is +prefixed with the class name (see I<Perl Cookbook>, Recipe 13.12). + +A function named C<new> must not be explicitly defined in a class +created by C<struct>. + +The I<ELEMENT_LIST> has the form + + NAME => TYPE, ... + +Each name-type pair declares one element of the struct. Each +element name will be defined as an accessor method unless a +method by that name is explicitly defined; in the latter case, a +warning is issued if the warning flag (B<-w>) is set. + +=head2 Class Creation at Compile Time + +C<Class::Struct> can create your class at compile time. The main reason +for doing this is obvious, so your class acts like every other class in +Perl. Creating your class at compile time will make the order of events +similar to using any other class ( or Perl module ). + +There is no significant speed gain between compile time and run time +class creation, there is just a new, more standard order of events. + +=head2 Element Types and Accessor Methods + +The four element types -- scalar, array, hash, and class -- are +represented by strings -- C<'$'>, C<'@'>, C<'%'>, and a class name -- +optionally preceded by a C<'*'>. + +The accessor method provided by C<struct> for an element depends +on the declared type of the element. + +=over 4 + +=item Scalar (C<'$'> or C<'*$'>) + +The element is a scalar, and by default is initialized to C<undef> +(but see L</Initializing with new>). + +The accessor's argument, if any, is assigned to the element. + +If the element type is C<'$'>, the value of the element (after +assignment) is returned. If the element type is C<'*$'>, a reference +to the element is returned. + +=item Array (C<'@'> or C<'*@'>) + +The element is an array, initialized by default to C<()>. + +With no argument, the accessor returns a reference to the +element's whole array (whether or not the element was +specified as C<'@'> or C<'*@'>). + +With one or two arguments, the first argument is an index +specifying one element of the array; the second argument, if +present, is assigned to the array element. If the element type +is C<'@'>, the accessor returns the array element value. If the +element type is C<'*@'>, a reference to the array element is +returned. + +As a special case, when the accessor is called with an array reference +as the sole argument, this causes an assignment of the whole array element. +The object reference is returned. + +=item Hash (C<'%'> or C<'*%'>) + +The element is a hash, initialized by default to C<()>. + +With no argument, the accessor returns a reference to the +element's whole hash (whether or not the element was +specified as C<'%'> or C<'*%'>). + +With one or two arguments, the first argument is a key specifying +one element of the hash; the second argument, if present, is +assigned to the hash element. If the element type is C<'%'>, the +accessor returns the hash element value. If the element type is +C<'*%'>, a reference to the hash element is returned. + +As a special case, when the accessor is called with a hash reference +as the sole argument, this causes an assignment of the whole hash element. +The object reference is returned. + +=item Class (C<'Class_Name'> or C<'*Class_Name'>) + +The element's value must be a reference blessed to the named +class or to one of its subclasses. The element is not initialized +by default. + +The accessor's argument, if any, is assigned to the element. The +accessor will C<croak> if this is not an appropriate object +reference. + +If the element type does not start with a C<'*'>, the accessor +returns the element value (after assignment). If the element type +starts with a C<'*'>, a reference to the element itself is returned. + +=back + +=head2 Initializing with C<new> + +C<struct> always creates a constructor called C<new>. That constructor +may take a list of initializers for the various elements of the new +struct. + +Each initializer is a pair of values: I<element name>C< =E<gt> >I<value>. +The initializer value for a scalar element is just a scalar value. The +initializer for an array element is an array reference. The initializer +for a hash is a hash reference. + +The initializer for a class element is an object of the corresponding class, +or of one of it's subclasses, or a reference to a hash containing named +arguments to be passed to the element's constructor. + +See Example 3 below for an example of initialization. + +=head1 EXAMPLES + +=over 4 + +=item Example 1 + +Giving a struct element a class type that is also a struct is how +structs are nested. Here, C<Timeval> represents a time (seconds and +microseconds), and C<Rusage> has two elements, each of which is of +type C<Timeval>. + + use Class::Struct; + + struct( Rusage => { + ru_utime => 'Timeval', # user time used + ru_stime => 'Timeval', # system time used + }); + + struct( Timeval => [ + tv_secs => '$', # seconds + tv_usecs => '$', # microseconds + ]); + + # create an object: + my $t = Rusage->new(ru_utime=>Timeval->new(), + ru_stime=>Timeval->new()); + + # $t->ru_utime and $t->ru_stime are objects of type Timeval. + # set $t->ru_utime to 100.0 sec and $t->ru_stime to 5.0 sec. + $t->ru_utime->tv_secs(100); + $t->ru_utime->tv_usecs(0); + $t->ru_stime->tv_secs(5); + $t->ru_stime->tv_usecs(0); + +=item Example 2 + +An accessor function can be redefined in order to provide +additional checking of values, etc. Here, we want the C<count> +element always to be nonnegative, so we redefine the C<count> +accessor accordingly. + + package MyObj; + use Class::Struct; + + # declare the struct + struct ( 'MyObj', { count => '$', stuff => '%' } ); + + # override the default accessor method for 'count' + sub count { + my $self = shift; + if ( @_ ) { + die 'count must be nonnegative' if $_[0] < 0; + $self->{'MyObj::count'} = shift; + warn "Too many args to count" if @_; + } + return $self->{'MyObj::count'}; + } + + package main; + $x = new MyObj; + print "\$x->count(5) = ", $x->count(5), "\n"; + # prints '$x->count(5) = 5' + + print "\$x->count = ", $x->count, "\n"; + # prints '$x->count = 5' + + print "\$x->count(-5) = ", $x->count(-5), "\n"; + # dies due to negative argument! + +=item Example 3 + +The constructor of a generated class can be passed a list +of I<element>=>I<value> pairs, with which to initialize the struct. +If no initializer is specified for a particular element, its default +initialization is performed instead. Initializers for non-existent +elements are silently ignored. + +Note that the initializer for a nested class may be specified as +an object of that class, or as a reference to a hash of initializers +that are passed on to the nested struct's constructor. + + use Class::Struct; + + struct Breed => + { + name => '$', + cross => '$', + }; + + struct Cat => + [ + name => '$', + kittens => '@', + markings => '%', + breed => 'Breed', + ]; + + + my $cat = Cat->new( name => 'Socks', + kittens => ['Monica', 'Kenneth'], + markings => { socks=>1, blaze=>"white" }, + breed => Breed->new(name=>'short-hair', cross=>1), + or: breed => {name=>'short-hair', cross=>1}, + ); + + print "Once a cat called ", $cat->name, "\n"; + print "(which was a ", $cat->breed->name, ")\n"; + print "had 2 kittens: ", join(' and ', @{$cat->kittens}), "\n"; + +=back + +=head1 Author and Modification History + +Modified by Damian Conway, 2001-09-10, v0.62. + + Modified implicit construction of nested objects. + Now will also take an object ref instead of requiring a hash ref. + Also default initializes nested object attributes to undef, rather + than calling object constructor without args + Original over-helpfulness was fraught with problems: + * the class's constructor might not be called 'new' + * the class might not have a hash-like-arguments constructor + * the class might not have a no-argument constructor + * "recursive" data structures didn't work well: + package Person; + struct { mother => 'Person', father => 'Person'}; + + +Modified by Casey West, 2000-11-08, v0.59. + + Added the ability for compile time class creation. + +Modified by Damian Conway, 1999-03-05, v0.58. + + Added handling of hash-like arg list to class ctor. + + Changed to two-argument blessing in ctor to support + derivation from created classes. + + Added classname prefixes to keys in hash-based classes + (refer to "Perl Cookbook", Recipe 13.12 for rationale). + + Corrected behaviour of accessors for '*@' and '*%' struct + elements. Package now implements documented behaviour when + returning a reference to an entire hash or array element. + Previously these were returned as a reference to a reference + to the element. + +Renamed to C<Class::Struct> and modified by Jim Miner, 1997-04-02. + + members() function removed. + Documentation corrected and extended. + Use of struct() in a subclass prohibited. + User definition of accessor allowed. + Treatment of '*' in element types corrected. + Treatment of classes as element types corrected. + Class name to struct() made optional. + Diagnostic checks added. + +Originally C<Class::Template> by Dean Roehrich. + + # Template.pm --- struct/member template builder + # 12mar95 + # Dean Roehrich + # + # changes/bugs fixed since 28nov94 version: + # - podified + # changes/bugs fixed since 21nov94 version: + # - Fixed examples. + # changes/bugs fixed since 02sep94 version: + # - Moved to Class::Template. + # changes/bugs fixed since 20feb94 version: + # - Updated to be a more proper module. + # - Added "use strict". + # - Bug in build_methods, was using @var when @$var needed. + # - Now using my() rather than local(). + # + # Uses perl5 classes to create nested data types. + # This is offered as one implementation of Tom Christiansen's + # "structs.pl" idea. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Compress/Zlib.pm b/data/miniconda3/lib/perl5/core_perl/Compress/Zlib.pm new file mode 100644 index 0000000000000000000000000000000000000000..4a0aae6c4bc23078eb6e6234103323b71af6c1be --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Compress/Zlib.pm @@ -0,0 +1,1513 @@ + +package Compress::Zlib; + +require 5.006 ; +require Exporter; +use Carp ; +use IO::Handle ; +use Scalar::Util qw(dualvar); + +use IO::Compress::Base::Common 2.093 ; +use Compress::Raw::Zlib 2.093 ; +use IO::Compress::Gzip 2.093 ; +use IO::Uncompress::Gunzip 2.093 ; + +use strict ; +use warnings ; +use bytes ; +our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); + +$VERSION = '2.093'; +$XS_VERSION = $VERSION; +$VERSION = eval $VERSION; + +@ISA = qw(Exporter); +# Items to export into callers namespace by default. Note: do not export +# names by default without a very good reason. Use EXPORT_OK instead. +# Do not simply export all your public functions/methods/constants. +@EXPORT = qw( + deflateInit inflateInit + + compress uncompress + + gzopen $gzerrno + ); + +push @EXPORT, @Compress::Raw::Zlib::EXPORT ; + +@EXPORT_OK = qw(memGunzip memGzip zlib_version); +%EXPORT_TAGS = ( + ALL => \@EXPORT +); + +BEGIN +{ + *zlib_version = \&Compress::Raw::Zlib::zlib_version; +} + +use constant FLAG_APPEND => 1 ; +use constant FLAG_CRC => 2 ; +use constant FLAG_ADLER => 4 ; +use constant FLAG_CONSUME_INPUT => 8 ; + +our (@my_z_errmsg); + +@my_z_errmsg = ( + "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) + ); + + +sub _set_gzerr +{ + my $value = shift ; + + if ($value == 0) { + $Compress::Zlib::gzerrno = 0 ; + } + elsif ($value == Z_ERRNO() || $value > 2) { + $Compress::Zlib::gzerrno = $! ; + } + else { + $Compress::Zlib::gzerrno = dualvar($value+0, $my_z_errmsg[2 - $value]); + } + + return $value ; +} + +sub _set_gzerr_undef +{ + _set_gzerr(@_); + return undef; +} + +sub _save_gzerr +{ + my $gz = shift ; + my $test_eof = shift ; + + my $value = $gz->errorNo() || 0 ; + my $eof = $gz->eof() ; + + if ($test_eof) { + # gzread uses Z_STREAM_END to denote a successful end + $value = Z_STREAM_END() if $gz->eof() && $value == 0 ; + } + + _set_gzerr($value) ; +} + +sub gzopen($$) +{ + my ($file, $mode) = @_ ; + + my $gz ; + my %defOpts = (Level => Z_DEFAULT_COMPRESSION(), + Strategy => Z_DEFAULT_STRATEGY(), + ); + + my $writing ; + $writing = ! ($mode =~ /r/i) ; + $writing = ($mode =~ /[wa]/i) ; + + $defOpts{Level} = $1 if $mode =~ /(\d)/; + $defOpts{Strategy} = Z_FILTERED() if $mode =~ /f/i; + $defOpts{Strategy} = Z_HUFFMAN_ONLY() if $mode =~ /h/i; + $defOpts{Append} = 1 if $mode =~ /a/i; + + my $infDef = $writing ? 'deflate' : 'inflate'; + my @params = () ; + + croak "gzopen: file parameter is not a filehandle or filename" + unless isaFilehandle $file || isaFilename $file || + (ref $file && ref $file eq 'SCALAR'); + + return undef unless $mode =~ /[rwa]/i ; + + _set_gzerr(0) ; + + if ($writing) { + $gz = new IO::Compress::Gzip($file, Minimal => 1, AutoClose => 1, + %defOpts) + or $Compress::Zlib::gzerrno = $IO::Compress::Gzip::GzipError; + } + else { + $gz = new IO::Uncompress::Gunzip($file, + Transparent => 1, + Append => 0, + AutoClose => 1, + MultiStream => 1, + Strict => 0) + or $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; + } + + return undef + if ! defined $gz ; + + bless [$gz, $infDef], 'Compress::Zlib::gzFile'; +} + +sub Compress::Zlib::gzFile::gzread +{ + my $self = shift ; + + return _set_gzerr(Z_STREAM_ERROR()) + if $self->[1] ne 'inflate'; + + my $len = defined $_[1] ? $_[1] : 4096 ; + + my $gz = $self->[0] ; + if ($self->gzeof() || $len == 0) { + # Zap the output buffer to match ver 1 behaviour. + $_[0] = "" ; + _save_gzerr($gz, 1); + return 0 ; + } + + my $status = $gz->read($_[0], $len) ; + _save_gzerr($gz, 1); + return $status ; +} + +sub Compress::Zlib::gzFile::gzreadline +{ + my $self = shift ; + + my $gz = $self->[0] ; + { + # Maintain backward compatibility with 1.x behaviour + # It didn't support $/, so this can't either. + local $/ = "\n" ; + $_[0] = $gz->getline() ; + } + _save_gzerr($gz, 1); + return defined $_[0] ? length $_[0] : 0 ; +} + +sub Compress::Zlib::gzFile::gzwrite +{ + my $self = shift ; + my $gz = $self->[0] ; + + return _set_gzerr(Z_STREAM_ERROR()) + if $self->[1] ne 'deflate'; + + $] >= 5.008 and (utf8::downgrade($_[0], 1) + or croak "Wide character in gzwrite"); + + my $status = $gz->write($_[0]) ; + _save_gzerr($gz); + return $status ; +} + +sub Compress::Zlib::gzFile::gztell +{ + my $self = shift ; + my $gz = $self->[0] ; + my $status = $gz->tell() ; + _save_gzerr($gz); + return $status ; +} + +sub Compress::Zlib::gzFile::gzseek +{ + my $self = shift ; + my $offset = shift ; + my $whence = shift ; + + my $gz = $self->[0] ; + my $status ; + eval { local $SIG{__DIE__}; $status = $gz->seek($offset, $whence) ; }; + if ($@) + { + my $error = $@; + $error =~ s/^.*: /gzseek: /; + $error =~ s/ at .* line \d+\s*$//; + croak $error; + } + _save_gzerr($gz); + return $status ; +} + +sub Compress::Zlib::gzFile::gzflush +{ + my $self = shift ; + my $f = shift ; + + my $gz = $self->[0] ; + my $status = $gz->flush($f) ; + my $err = _save_gzerr($gz); + return $status ? 0 : $err; +} + +sub Compress::Zlib::gzFile::gzclose +{ + my $self = shift ; + my $gz = $self->[0] ; + + my $status = $gz->close() ; + my $err = _save_gzerr($gz); + return $status ? 0 : $err; +} + +sub Compress::Zlib::gzFile::gzeof +{ + my $self = shift ; + my $gz = $self->[0] ; + + return 0 + if $self->[1] ne 'inflate'; + + my $status = $gz->eof() ; + _save_gzerr($gz); + return $status ; +} + +sub Compress::Zlib::gzFile::gzsetparams +{ + my $self = shift ; + croak "Usage: Compress::Zlib::gzFile::gzsetparams(file, level, strategy)" + unless @_ eq 2 ; + + my $gz = $self->[0] ; + my $level = shift ; + my $strategy = shift; + + return _set_gzerr(Z_STREAM_ERROR()) + if $self->[1] ne 'deflate'; + + my $status = *$gz->{Compress}->deflateParams(-Level => $level, + -Strategy => $strategy); + _save_gzerr($gz); + return $status ; +} + +sub Compress::Zlib::gzFile::gzerror +{ + my $self = shift ; + my $gz = $self->[0] ; + + return $Compress::Zlib::gzerrno ; +} + + +sub compress($;$) +{ + my ($x, $output, $err, $in) =('', '', '', '') ; + + if (ref $_[0] ) { + $in = $_[0] ; + croak "not a scalar reference" unless ref $in eq 'SCALAR' ; + } + else { + $in = \$_[0] ; + } + + $] >= 5.008 and (utf8::downgrade($$in, 1) + or croak "Wide character in compress"); + + my $level = (@_ == 2 ? $_[1] : Z_DEFAULT_COMPRESSION() ); + + $x = Compress::Raw::Zlib::_deflateInit(FLAG_APPEND, + $level, + Z_DEFLATED, + MAX_WBITS, + MAX_MEM_LEVEL, + Z_DEFAULT_STRATEGY, + 4096, + '') + or return undef ; + + $err = $x->deflate($in, $output) ; + return undef unless $err == Z_OK() ; + + $err = $x->flush($output) ; + return undef unless $err == Z_OK() ; + + return $output ; +} + +sub uncompress($) +{ + my ($output, $in) =('', '') ; + + if (ref $_[0] ) { + $in = $_[0] ; + croak "not a scalar reference" unless ref $in eq 'SCALAR' ; + } + else { + $in = \$_[0] ; + } + + $] >= 5.008 and (utf8::downgrade($$in, 1) + or croak "Wide character in uncompress"); + + my ($obj, $status) = Compress::Raw::Zlib::_inflateInit(0, + MAX_WBITS, 4096, "") ; + + $status == Z_OK + or return undef; + + $obj->inflate($in, $output) == Z_STREAM_END + or return undef; + + return $output; +} + +sub deflateInit(@) +{ + my ($got) = ParseParameters(0, + { + 'bufsize' => [IO::Compress::Base::Common::Parse_unsigned, 4096], + 'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION()], + 'method' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFLATED()], + 'windowbits' => [IO::Compress::Base::Common::Parse_signed, MAX_WBITS()], + 'memlevel' => [IO::Compress::Base::Common::Parse_unsigned, MAX_MEM_LEVEL()], + 'strategy' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFAULT_STRATEGY()], + 'dictionary' => [IO::Compress::Base::Common::Parse_any, ""], + }, @_ ) ; + + croak "Compress::Zlib::deflateInit: Bufsize must be >= 1, you specified " . + $got->getValue('bufsize') + unless $got->getValue('bufsize') >= 1; + + my $obj ; + + my $status = 0 ; + ($obj, $status) = + Compress::Raw::Zlib::_deflateInit(0, + $got->getValue('level'), + $got->getValue('method'), + $got->getValue('windowbits'), + $got->getValue('memlevel'), + $got->getValue('strategy'), + $got->getValue('bufsize'), + $got->getValue('dictionary')) ; + + my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldDeflate" : undef) ; + return wantarray ? ($x, $status) : $x ; +} + +sub inflateInit(@) +{ + my ($got) = ParseParameters(0, + { + 'bufsize' => [IO::Compress::Base::Common::Parse_unsigned, 4096], + 'windowbits' => [IO::Compress::Base::Common::Parse_signed, MAX_WBITS()], + 'dictionary' => [IO::Compress::Base::Common::Parse_any, ""], + }, @_) ; + + + croak "Compress::Zlib::inflateInit: Bufsize must be >= 1, you specified " . + $got->getValue('bufsize') + unless $got->getValue('bufsize') >= 1; + + my $status = 0 ; + my $obj ; + ($obj, $status) = Compress::Raw::Zlib::_inflateInit(FLAG_CONSUME_INPUT, + $got->getValue('windowbits'), + $got->getValue('bufsize'), + $got->getValue('dictionary')) ; + + my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldInflate" : undef) ; + + wantarray ? ($x, $status) : $x ; +} + +package Zlib::OldDeflate ; + +our (@ISA); +@ISA = qw(Compress::Raw::Zlib::deflateStream); + + +sub deflate +{ + my $self = shift ; + my $output ; + + my $status = $self->SUPER::deflate($_[0], $output) ; + wantarray ? ($output, $status) : $output ; +} + +sub flush +{ + my $self = shift ; + my $output ; + my $flag = shift || Compress::Zlib::Z_FINISH(); + my $status = $self->SUPER::flush($output, $flag) ; + + wantarray ? ($output, $status) : $output ; +} + +package Zlib::OldInflate ; + +our (@ISA); +@ISA = qw(Compress::Raw::Zlib::inflateStream); + +sub inflate +{ + my $self = shift ; + my $output ; + my $status = $self->SUPER::inflate($_[0], $output) ; + wantarray ? ($output, $status) : $output ; +} + +package Compress::Zlib ; + +use IO::Compress::Gzip::Constants 2.093 ; + +sub memGzip($) +{ + _set_gzerr(0); + my $x = Compress::Raw::Zlib::_deflateInit(FLAG_APPEND|FLAG_CRC, + Z_BEST_COMPRESSION, + Z_DEFLATED, + -MAX_WBITS(), + MAX_MEM_LEVEL, + Z_DEFAULT_STRATEGY, + 4096, + '') + or return undef ; + + # if the deflation buffer isn't a reference, make it one + my $string = (ref $_[0] ? $_[0] : \$_[0]) ; + + $] >= 5.008 and (utf8::downgrade($$string, 1) + or croak "Wide character in memGzip"); + + my $out; + my $status ; + + $x->deflate($string, $out) == Z_OK + or return undef ; + + $x->flush($out) == Z_OK + or return undef ; + + return IO::Compress::Gzip::Constants::GZIP_MINIMUM_HEADER . + $out . + pack("V V", $x->crc32(), $x->total_in()); +} + + +sub _removeGzipHeader($) +{ + my $string = shift ; + + return Z_DATA_ERROR() + if length($$string) < GZIP_MIN_HEADER_SIZE ; + + my ($magic1, $magic2, $method, $flags, $time, $xflags, $oscode) = + unpack ('CCCCVCC', $$string); + + return Z_DATA_ERROR() + unless $magic1 == GZIP_ID1 and $magic2 == GZIP_ID2 and + $method == Z_DEFLATED() and !($flags & GZIP_FLG_RESERVED) ; + substr($$string, 0, GZIP_MIN_HEADER_SIZE) = '' ; + + # skip extra field + if ($flags & GZIP_FLG_FEXTRA) + { + return Z_DATA_ERROR() + if length($$string) < GZIP_FEXTRA_HEADER_SIZE ; + + my ($extra_len) = unpack ('v', $$string); + $extra_len += GZIP_FEXTRA_HEADER_SIZE; + return Z_DATA_ERROR() + if length($$string) < $extra_len ; + + substr($$string, 0, $extra_len) = ''; + } + + # skip orig name + if ($flags & GZIP_FLG_FNAME) + { + my $name_end = index ($$string, GZIP_NULL_BYTE); + return Z_DATA_ERROR() + if $name_end == -1 ; + substr($$string, 0, $name_end + 1) = ''; + } + + # skip comment + if ($flags & GZIP_FLG_FCOMMENT) + { + my $comment_end = index ($$string, GZIP_NULL_BYTE); + return Z_DATA_ERROR() + if $comment_end == -1 ; + substr($$string, 0, $comment_end + 1) = ''; + } + + # skip header crc + if ($flags & GZIP_FLG_FHCRC) + { + return Z_DATA_ERROR() + if length ($$string) < GZIP_FHCRC_SIZE ; + substr($$string, 0, GZIP_FHCRC_SIZE) = ''; + } + + return Z_OK(); +} + +sub _ret_gun_error +{ + $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; + return undef; +} + + +sub memGunzip($) +{ + # if the buffer isn't a reference, make it one + my $string = (ref $_[0] ? $_[0] : \$_[0]); + + $] >= 5.008 and (utf8::downgrade($$string, 1) + or croak "Wide character in memGunzip"); + + _set_gzerr(0); + + my $status = _removeGzipHeader($string) ; + $status == Z_OK() + or return _set_gzerr_undef($status); + + my $bufsize = length $$string > 4096 ? length $$string : 4096 ; + my $x = Compress::Raw::Zlib::_inflateInit(FLAG_CRC | FLAG_CONSUME_INPUT, + -MAX_WBITS(), $bufsize, '') + or return _ret_gun_error(); + + my $output = '' ; + $status = $x->inflate($string, $output); + + if ( $status == Z_OK() ) + { + _set_gzerr(Z_DATA_ERROR()); + return undef; + } + + return _ret_gun_error() + if ($status != Z_STREAM_END()); + + if (length $$string >= 8) + { + my ($crc, $len) = unpack ("VV", substr($$string, 0, 8)); + substr($$string, 0, 8) = ''; + return _set_gzerr_undef(Z_DATA_ERROR()) + unless $len == length($output) and + $crc == Compress::Raw::Zlib::crc32($output); + } + else + { + $$string = ''; + } + + return $output; +} + +# Autoload methods go after __END__, and are processed by the autosplit program. + +1; +__END__ + + +=head1 NAME + +Compress::Zlib - Interface to zlib compression library + +=head1 SYNOPSIS + + use Compress::Zlib ; + + ($d, $status) = deflateInit( [OPT] ) ; + $status = $d->deflate($input, $output) ; + $status = $d->flush([$flush_type]) ; + $d->deflateParams(OPTS) ; + $d->deflateTune(OPTS) ; + $d->dict_adler() ; + $d->crc32() ; + $d->adler32() ; + $d->total_in() ; + $d->total_out() ; + $d->msg() ; + $d->get_Strategy(); + $d->get_Level(); + $d->get_BufSize(); + + ($i, $status) = inflateInit( [OPT] ) ; + $status = $i->inflate($input, $output [, $eof]) ; + $status = $i->inflateSync($input) ; + $i->dict_adler() ; + $d->crc32() ; + $d->adler32() ; + $i->total_in() ; + $i->total_out() ; + $i->msg() ; + $d->get_BufSize(); + + $dest = compress($source) ; + $dest = uncompress($source) ; + + $gz = gzopen($filename or filehandle, $mode) ; + $bytesread = $gz->gzread($buffer [,$size]) ; + $bytesread = $gz->gzreadline($line) ; + $byteswritten = $gz->gzwrite($buffer) ; + $status = $gz->gzflush($flush) ; + $offset = $gz->gztell() ; + $status = $gz->gzseek($offset, $whence) ; + $status = $gz->gzclose() ; + $status = $gz->gzeof() ; + $status = $gz->gzsetparams($level, $strategy) ; + $errstring = $gz->gzerror() ; + $gzerrno + + $dest = Compress::Zlib::memGzip($buffer) ; + $dest = Compress::Zlib::memGunzip($buffer) ; + + $crc = adler32($buffer [,$crc]) ; + $crc = crc32($buffer [,$crc]) ; + + $crc = crc32_combine($crc1, $crc2, $len2); + $adler = adler32_combine($adler1, $adler2, $len2); + + my $version = Compress::Raw::Zlib::zlib_version(); + +=head1 DESCRIPTION + +The I<Compress::Zlib> module provides a Perl interface to the I<zlib> +compression library (see L</AUTHOR> for details about where to get +I<zlib>). + +The C<Compress::Zlib> module can be split into two general areas of +functionality, namely a simple read/write interface to I<gzip> files +and a low-level in-memory compression/decompression interface. + +Each of these areas will be discussed in the following sections. + +=head2 Notes for users of Compress::Zlib version 1 + +The main change in C<Compress::Zlib> version 2.x is that it does not now +interface directly to the zlib library. Instead it uses the +C<IO::Compress::Gzip> and C<IO::Uncompress::Gunzip> modules for +reading/writing gzip files, and the C<Compress::Raw::Zlib> module for some +low-level zlib access. + +The interface provided by version 2 of this module should be 100% backward +compatible with version 1. If you find a difference in the expected +behaviour please contact the author (See L</AUTHOR>). See L<GZIP INTERFACE> + +With the creation of the C<IO::Compress> and C<IO::Uncompress> modules no +new features are planned for C<Compress::Zlib> - the new modules do +everything that C<Compress::Zlib> does and then some. Development on +C<Compress::Zlib> will be limited to bug fixes only. + +If you are writing new code, your first port of call should be one of the +new C<IO::Compress> or C<IO::Uncompress> modules. + +=head1 GZIP INTERFACE + +A number of functions are supplied in I<zlib> for reading and writing +I<gzip> files that conform to RFC 1952. This module provides an interface +to most of them. + +If you have previously used C<Compress::Zlib> 1.x, the following +enhancements/changes have been made to the C<gzopen> interface: + +=over 5 + +=item 1 + +If you want to open either STDIN or STDOUT with C<gzopen>, you can now +optionally use the special filename "C<->" as a synonym for C<\*STDIN> and +C<\*STDOUT>. + +=item 2 + +In C<Compress::Zlib> version 1.x, C<gzopen> used the zlib library to open +the underlying file. This made things especially tricky when a Perl +filehandle was passed to C<gzopen>. Behind the scenes the numeric C file +descriptor had to be extracted from the Perl filehandle and this passed to +the zlib library. + +Apart from being non-portable to some operating systems, this made it +difficult to use C<gzopen> in situations where you wanted to extract/create +a gzip data stream that is embedded in a larger file, without having to +resort to opening and closing the file multiple times. + +It also made it impossible to pass a perl filehandle that wasn't associated +with a real filesystem file, like, say, an C<IO::String>. + +In C<Compress::Zlib> version 2.x, the C<gzopen> interface has been +completely rewritten to use the L<IO::Compress::Gzip|IO::Compress::Gzip> +for writing gzip files and L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip> +for reading gzip files. None of the limitations mentioned above apply. + +=item 3 + +Addition of C<gzseek> to provide a restricted C<seek> interface. + +=item 4. + +Added C<gztell>. + +=back + +A more complete and flexible interface for reading/writing gzip +files/buffers is included with the module C<IO-Compress-Zlib>. See +L<IO::Compress::Gzip|IO::Compress::Gzip> and +L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip> for more details. + +=over 5 + +=item B<$gz = gzopen($filename, $mode)> + +=item B<$gz = gzopen($filehandle, $mode)> + +This function opens either the I<gzip> file C<$filename> for reading or +writing or attaches to the opened filehandle, C<$filehandle>. +It returns an object on success and C<undef> on failure. + +When writing a gzip file this interface will I<always> create the smallest +possible gzip header (exactly 10 bytes). If you want greater control over +what gets stored in the gzip header (like the original filename or a +comment) use L<IO::Compress::Gzip|IO::Compress::Gzip> instead. Similarly if +you want to read the contents of the gzip header use +L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip>. + +The second parameter, C<$mode>, is used to specify whether the file is +opened for reading or writing and to optionally specify a compression +level and compression strategy when writing. The format of the C<$mode> +parameter is similar to the mode parameter to the 'C' function C<fopen>, +so "rb" is used to open for reading, "wb" for writing and "ab" for +appending (writing at the end of the file). + +To specify a compression level when writing, append a digit between 0 +and 9 to the mode string -- 0 means no compression and 9 means maximum +compression. +If no compression level is specified Z_DEFAULT_COMPRESSION is used. + +To specify the compression strategy when writing, append 'f' for filtered +data, 'h' for Huffman only compression, or 'R' for run-length encoding. +If no strategy is specified Z_DEFAULT_STRATEGY is used. + +So, for example, "wb9" means open for writing with the maximum compression +using the default strategy and "wb4R" means open for writing with compression +level 4 and run-length encoding. + +Refer to the I<zlib> documentation for the exact format of the C<$mode> +parameter. + +=item B<$bytesread = $gz-E<gt>gzread($buffer [, $size]) ;> + +Reads C<$size> bytes from the compressed file into C<$buffer>. If +C<$size> is not specified, it will default to 4096. If the scalar +C<$buffer> is not large enough, it will be extended automatically. + +Returns the number of bytes actually read. On EOF it returns 0 and in +the case of an error, -1. + +=item B<$bytesread = $gz-E<gt>gzreadline($line) ;> + +Reads the next line from the compressed file into C<$line>. + +Returns the number of bytes actually read. On EOF it returns 0 and in +the case of an error, -1. + +It is legal to intermix calls to C<gzread> and C<gzreadline>. + +To maintain backward compatibility with version 1.x of this module +C<gzreadline> ignores the C<$/> variable - it I<always> uses the string +C<"\n"> as the line delimiter. + +If you want to read a gzip file a line at a time and have it respect the +C<$/> variable (or C<$INPUT_RECORD_SEPARATOR>, or C<$RS> when C<English> is +in use) see L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip>. + +=item B<$byteswritten = $gz-E<gt>gzwrite($buffer) ;> + +Writes the contents of C<$buffer> to the compressed file. Returns the +number of bytes actually written, or 0 on error. + +=item B<$status = $gz-E<gt>gzflush($flush_type) ;> + +Flushes all pending output into the compressed file. + +This method takes an optional parameter, C<$flush_type>, that controls +how the flushing will be carried out. By default the C<$flush_type> +used is C<Z_FINISH>. Other valid values for C<$flush_type> are +C<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It is +strongly recommended that you only set the C<flush_type> parameter if +you fully understand the implications of what it does - overuse of C<flush> +can seriously degrade the level of compression achieved. See the C<zlib> +documentation for details. + +Returns 0 on success. + +=item B<$offset = $gz-E<gt>gztell() ;> + +Returns the uncompressed file offset. + +=item B<$status = $gz-E<gt>gzseek($offset, $whence) ;> + +Provides a sub-set of the C<seek> functionality, with the restriction +that it is only legal to seek forward in the compressed file. +It is a fatal error to attempt to seek backward. + +When opened for writing, empty parts of the file will have NULL (0x00) +bytes written to them. + +The C<$whence> parameter should be one of SEEK_SET, SEEK_CUR or SEEK_END. + +Returns 1 on success, 0 on failure. + +=item B<$gz-E<gt>gzclose> + +Closes the compressed file. Any pending data is flushed to the file +before it is closed. + +Returns 0 on success. + +=item B<$gz-E<gt>gzsetparams($level, $strategy> + +Change settings for the deflate stream C<$gz>. + +The list of the valid options is shown below. Options not specified +will remain unchanged. + +Note: This method is only available if you are running zlib 1.0.6 or better. + +=over 5 + +=item B<$level> + +Defines the compression level. Valid values are 0 through 9, +C<Z_NO_COMPRESSION>, C<Z_BEST_SPEED>, C<Z_BEST_COMPRESSION>, and +C<Z_DEFAULT_COMPRESSION>. + +=item B<$strategy> + +Defines the strategy used to tune the compression. The valid values are +C<Z_DEFAULT_STRATEGY>, C<Z_FILTERED> and C<Z_HUFFMAN_ONLY>. + +=back + +=item B<$gz-E<gt>gzerror> + +Returns the I<zlib> error message or number for the last operation +associated with C<$gz>. The return value will be the I<zlib> error +number when used in a numeric context and the I<zlib> error message +when used in a string context. The I<zlib> error number constants, +shown below, are available for use. + + Z_OK + Z_STREAM_END + Z_ERRNO + Z_STREAM_ERROR + Z_DATA_ERROR + Z_MEM_ERROR + Z_BUF_ERROR + +=item B<$gzerrno> + +The C<$gzerrno> scalar holds the error code associated with the most +recent I<gzip> routine. Note that unlike C<gzerror()>, the error is +I<not> associated with a particular file. + +As with C<gzerror()> it returns an error number in numeric context and +an error message in string context. Unlike C<gzerror()> though, the +error message will correspond to the I<zlib> message when the error is +associated with I<zlib> itself, or the UNIX error message when it is +not (i.e. I<zlib> returned C<Z_ERRORNO>). + +As there is an overlap between the error numbers used by I<zlib> and +UNIX, C<$gzerrno> should only be used to check for the presence of +I<an> error in numeric context. Use C<gzerror()> to check for specific +I<zlib> errors. The I<gzcat> example below shows how the variable can +be used safely. + +=back + +=head2 Examples + +Here is an example script which uses the interface. It implements a +I<gzcat> function. + + use strict ; + use warnings ; + + use Compress::Zlib ; + + # use stdin if no files supplied + @ARGV = '-' unless @ARGV ; + + foreach my $file (@ARGV) { + my $buffer ; + + my $gz = gzopen($file, "rb") + or die "Cannot open $file: $gzerrno\n" ; + + print $buffer while $gz->gzread($buffer) > 0 ; + + die "Error reading from $file: $gzerrno" . ($gzerrno+0) . "\n" + if $gzerrno != Z_STREAM_END ; + + $gz->gzclose() ; + } + +Below is a script which makes use of C<gzreadline>. It implements a +very simple I<grep> like script. + + use strict ; + use warnings ; + + use Compress::Zlib ; + + die "Usage: gzgrep pattern [file...]\n" + unless @ARGV >= 1; + + my $pattern = shift ; + + # use stdin if no files supplied + @ARGV = '-' unless @ARGV ; + + foreach my $file (@ARGV) { + my $gz = gzopen($file, "rb") + or die "Cannot open $file: $gzerrno\n" ; + + while ($gz->gzreadline($_) > 0) { + print if /$pattern/ ; + } + + die "Error reading from $file: $gzerrno\n" + if $gzerrno != Z_STREAM_END ; + + $gz->gzclose() ; + } + +This script, I<gzstream>, does the opposite of the I<gzcat> script +above. It reads from standard input and writes a gzip data stream to +standard output. + + use strict ; + use warnings ; + + use Compress::Zlib ; + + binmode STDOUT; # gzopen only sets it on the fd + + my $gz = gzopen(\*STDOUT, "wb") + or die "Cannot open stdout: $gzerrno\n" ; + + while (<>) { + $gz->gzwrite($_) + or die "error writing: $gzerrno\n" ; + } + + $gz->gzclose ; + +=head2 Compress::Zlib::memGzip + +This function is used to create an in-memory gzip file with the minimum +possible gzip header (exactly 10 bytes). + + $dest = Compress::Zlib::memGzip($buffer) + or die "Cannot compress: $gzerrno\n"; + +If successful, it returns the in-memory gzip file. Otherwise it returns +C<undef> and the C<$gzerrno> variable will store the zlib error code. + +The C<$buffer> parameter can either be a scalar or a scalar reference. + +See L<IO::Compress::Gzip|IO::Compress::Gzip> for an alternative way to +carry out in-memory gzip compression. + +=head2 Compress::Zlib::memGunzip + +This function is used to uncompress an in-memory gzip file. + + $dest = Compress::Zlib::memGunzip($buffer) + or die "Cannot uncompress: $gzerrno\n"; + +If successful, it returns the uncompressed gzip file. Otherwise it +returns C<undef> and the C<$gzerrno> variable will store the zlib error +code. + +The C<$buffer> parameter can either be a scalar or a scalar reference. The +contents of the C<$buffer> parameter are destroyed after calling this function. + +If C<$buffer> consists of multiple concatenated gzip data streams only the +first will be uncompressed. Use C<gunzip> with the C<MultiStream> option in +the C<IO::Uncompress::Gunzip> module if you need to deal with concatenated +data streams. + +See L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip> for an alternative way +to carry out in-memory gzip uncompression. + +=head1 COMPRESS/UNCOMPRESS + +Two functions are provided to perform in-memory compression/uncompression of +RFC 1950 data streams. They are called C<compress> and C<uncompress>. + +=over 5 + +=item B<$dest = compress($source [, $level] ) ;> + +Compresses C<$source>. If successful it returns the compressed +data. Otherwise it returns I<undef>. + +The source buffer, C<$source>, can either be a scalar or a scalar +reference. + +The C<$level> parameter defines the compression level. Valid values are +0 through 9, C<Z_NO_COMPRESSION>, C<Z_BEST_SPEED>, +C<Z_BEST_COMPRESSION>, and C<Z_DEFAULT_COMPRESSION>. +If C<$level> is not specified C<Z_DEFAULT_COMPRESSION> will be used. + +=item B<$dest = uncompress($source) ;> + +Uncompresses C<$source>. If successful it returns the uncompressed +data. Otherwise it returns I<undef>. + +The source buffer can either be a scalar or a scalar reference. + +=back + +Please note: the two functions defined above are I<not> compatible with +the Unix commands of the same name. + +See L<IO::Deflate|IO::Deflate> and L<IO::Inflate|IO::Inflate> included with +this distribution for an alternative interface for reading/writing RFC 1950 +files/buffers. + +=head1 Deflate Interface + +This section defines an interface that allows in-memory compression using +the I<deflate> interface provided by zlib. + +Here is a definition of the interface available: + +=head2 B<($d, $status) = deflateInit( [OPT] )> + +Initialises a deflation stream. + +It combines the features of the I<zlib> functions C<deflateInit>, +C<deflateInit2> and C<deflateSetDictionary>. + +If successful, it will return the initialised deflation stream, C<$d> +and C<$status> of C<Z_OK> in a list context. In scalar context it +returns the deflation stream, C<$d>, only. + +If not successful, the returned deflation stream (C<$d>) will be +I<undef> and C<$status> will hold the exact I<zlib> error code. + +The function optionally takes a number of named options specified as +C<< -Name=>value >> pairs. This allows individual options to be +tailored without having to specify them all in the parameter list. + +For backward compatibility, it is also possible to pass the parameters +as a reference to a hash containing the name=>value pairs. + +The function takes one optional parameter, a reference to a hash. The +contents of the hash allow the deflation interface to be tailored. + +Here is a list of the valid options: + +=over 5 + +=item B<-Level> + +Defines the compression level. Valid values are 0 through 9, +C<Z_NO_COMPRESSION>, C<Z_BEST_SPEED>, C<Z_BEST_COMPRESSION>, and +C<Z_DEFAULT_COMPRESSION>. + +The default is Z_DEFAULT_COMPRESSION. + +=item B<-Method> + +Defines the compression method. The only valid value at present (and +the default) is Z_DEFLATED. + +=item B<-WindowBits> + +To create an RFC 1950 data stream, set C<WindowBits> to a positive number. + +To create an RFC 1951 data stream, set C<WindowBits> to C<-MAX_WBITS>. + +For a full definition of the meaning and valid values for C<WindowBits> refer +to the I<zlib> documentation for I<deflateInit2>. + +Defaults to MAX_WBITS. + +=item B<-MemLevel> + +For a definition of the meaning and valid values for C<MemLevel> +refer to the I<zlib> documentation for I<deflateInit2>. + +Defaults to MAX_MEM_LEVEL. + +=item B<-Strategy> + +Defines the strategy used to tune the compression. The valid values are +C<Z_DEFAULT_STRATEGY>, C<Z_FILTERED> and C<Z_HUFFMAN_ONLY>. + +The default is Z_DEFAULT_STRATEGY. + +=item B<-Dictionary> + +When a dictionary is specified I<Compress::Zlib> will automatically +call C<deflateSetDictionary> directly after calling C<deflateInit>. The +Adler32 value for the dictionary can be obtained by calling the method +C<< $d->dict_adler() >>. + +The default is no dictionary. + +=item B<-Bufsize> + +Sets the initial size for the deflation buffer. If the buffer has to be +reallocated to increase the size, it will grow in increments of +C<Bufsize>. + +The default is 4096. + +=back + +Here is an example of using the C<deflateInit> optional parameter list +to override the default buffer size and compression level. All other +options will take their default values. + + deflateInit( -Bufsize => 300, + -Level => Z_BEST_SPEED ) ; + +=head2 B<($out, $status) = $d-E<gt>deflate($buffer)> + +Deflates the contents of C<$buffer>. The buffer can either be a scalar +or a scalar reference. When finished, C<$buffer> will be +completely processed (assuming there were no errors). If the deflation +was successful it returns the deflated output, C<$out>, and a status +value, C<$status>, of C<Z_OK>. + +On error, C<$out> will be I<undef> and C<$status> will contain the +I<zlib> error code. + +In a scalar context C<deflate> will return C<$out> only. + +As with the I<deflate> function in I<zlib>, it is not necessarily the +case that any output will be produced by this method. So don't rely on +the fact that C<$out> is empty for an error test. + +=head2 B<($out, $status) = $d-E<gt>flush()> +=head2 B<($out, $status) = $d-E<gt>flush($flush_type)> + +Typically used to finish the deflation. Any pending output will be +returned via C<$out>. +C<$status> will have a value C<Z_OK> if successful. + +In a scalar context C<flush> will return C<$out> only. + +Note that flushing can seriously degrade the compression ratio, so it +should only be used to terminate a decompression (using C<Z_FINISH>) or +when you want to create a I<full flush point> (using C<Z_FULL_FLUSH>). + +By default the C<flush_type> used is C<Z_FINISH>. Other valid values +for C<flush_type> are C<Z_NO_FLUSH>, C<Z_PARTIAL_FLUSH>, C<Z_SYNC_FLUSH> +and C<Z_FULL_FLUSH>. It is strongly recommended that you only set the +C<flush_type> parameter if you fully understand the implications of +what it does. See the C<zlib> documentation for details. + +=head2 B<$status = $d-E<gt>deflateParams([OPT])> + +Change settings for the deflate stream C<$d>. + +The list of the valid options is shown below. Options not specified +will remain unchanged. + +=over 5 + +=item B<-Level> + +Defines the compression level. Valid values are 0 through 9, +C<Z_NO_COMPRESSION>, C<Z_BEST_SPEED>, C<Z_BEST_COMPRESSION>, and +C<Z_DEFAULT_COMPRESSION>. + +=item B<-Strategy> + +Defines the strategy used to tune the compression. The valid values are +C<Z_DEFAULT_STRATEGY>, C<Z_FILTERED> and C<Z_HUFFMAN_ONLY>. + +=back + +=head2 B<$d-E<gt>dict_adler()> + +Returns the adler32 value for the dictionary. + +=head2 B<$d-E<gt>msg()> + +Returns the last error message generated by zlib. + +=head2 B<$d-E<gt>total_in()> + +Returns the total number of bytes uncompressed bytes input to deflate. + +=head2 B<$d-E<gt>total_out()> + +Returns the total number of compressed bytes output from deflate. + +=head2 Example + +Here is a trivial example of using C<deflate>. It simply reads standard +input, deflates it and writes it to standard output. + + use strict ; + use warnings ; + + use Compress::Zlib ; + + binmode STDIN; + binmode STDOUT; + my $x = deflateInit() + or die "Cannot create a deflation stream\n" ; + + my ($output, $status) ; + while (<>) + { + ($output, $status) = $x->deflate($_) ; + + $status == Z_OK + or die "deflation failed\n" ; + + print $output ; + } + + ($output, $status) = $x->flush() ; + + $status == Z_OK + or die "deflation failed\n" ; + + print $output ; + +=head1 Inflate Interface + +This section defines the interface available that allows in-memory +uncompression using the I<deflate> interface provided by zlib. + +Here is a definition of the interface: + +=head2 B<($i, $status) = inflateInit()> + +Initialises an inflation stream. + +In a list context it returns the inflation stream, C<$i>, and the +I<zlib> status code in C<$status>. In a scalar context it returns the +inflation stream only. + +If successful, C<$i> will hold the inflation stream and C<$status> will +be C<Z_OK>. + +If not successful, C<$i> will be I<undef> and C<$status> will hold the +I<zlib> error code. + +The function optionally takes a number of named options specified as +C<< -Name=>value >> pairs. This allows individual options to be +tailored without having to specify them all in the parameter list. + +For backward compatibility, it is also possible to pass the parameters +as a reference to a hash containing the name=>value pairs. + +The function takes one optional parameter, a reference to a hash. The +contents of the hash allow the deflation interface to be tailored. + +Here is a list of the valid options: + +=over 5 + +=item B<-WindowBits> + +To uncompress an RFC 1950 data stream, set C<WindowBits> to a positive number. + +To uncompress an RFC 1951 data stream, set C<WindowBits> to C<-MAX_WBITS>. + +For a full definition of the meaning and valid values for C<WindowBits> refer +to the I<zlib> documentation for I<inflateInit2>. + +Defaults to MAX_WBITS. + +=item B<-Bufsize> + +Sets the initial size for the inflation buffer. If the buffer has to be +reallocated to increase the size, it will grow in increments of +C<Bufsize>. + +Default is 4096. + +=item B<-Dictionary> + +The default is no dictionary. + +=back + +Here is an example of using the C<inflateInit> optional parameter to +override the default buffer size. + + inflateInit( -Bufsize => 300 ) ; + +=head2 B<($out, $status) = $i-E<gt>inflate($buffer)> + +Inflates the complete contents of C<$buffer>. The buffer can either be +a scalar or a scalar reference. + +Returns C<Z_OK> if successful and C<Z_STREAM_END> if the end of the +compressed data has been successfully reached. +If not successful, C<$out> will be I<undef> and C<$status> will hold +the I<zlib> error code. + +The C<$buffer> parameter is modified by C<inflate>. On completion it +will contain what remains of the input buffer after inflation. This +means that C<$buffer> will be an empty string when the return status is +C<Z_OK>. When the return status is C<Z_STREAM_END> the C<$buffer> +parameter will contains what (if anything) was stored in the input +buffer after the deflated data stream. + +This feature is useful when processing a file format that encapsulates +a compressed data stream (e.g. gzip, zip). + +=head2 B<$status = $i-E<gt>inflateSync($buffer)> + +Scans C<$buffer> until it reaches either a I<full flush point> or the +end of the buffer. + +If a I<full flush point> is found, C<Z_OK> is returned and C<$buffer> +will be have all data up to the flush point removed. This can then be +passed to the C<deflate> method. + +Any other return code means that a flush point was not found. If more +data is available, C<inflateSync> can be called repeatedly with more +compressed data until the flush point is found. + +=head2 B<$i-E<gt>dict_adler()> + +Returns the adler32 value for the dictionary. + +=head2 B<$i-E<gt>msg()> + +Returns the last error message generated by zlib. + +=head2 B<$i-E<gt>total_in()> + +Returns the total number of bytes compressed bytes input to inflate. + +=head2 B<$i-E<gt>total_out()> + +Returns the total number of uncompressed bytes output from inflate. + +=head2 Example + +Here is an example of using C<inflate>. + + use strict ; + use warnings ; + + use Compress::Zlib ; + + my $x = inflateInit() + or die "Cannot create a inflation stream\n" ; + + my $input = '' ; + binmode STDIN; + binmode STDOUT; + + my ($output, $status) ; + while (read(STDIN, $input, 4096)) + { + ($output, $status) = $x->inflate(\$input) ; + + print $output + if $status == Z_OK or $status == Z_STREAM_END ; + + last if $status != Z_OK ; + } + + die "inflation failed\n" + unless $status == Z_STREAM_END ; + +=head1 CHECKSUM FUNCTIONS + +Two functions are provided by I<zlib> to calculate checksums. For the +Perl interface, the order of the two parameters in both functions has +been reversed. This allows both running checksums and one off +calculations to be done. + + $crc = adler32($buffer [,$crc]) ; + $crc = crc32($buffer [,$crc]) ; + +The buffer parameters can either be a scalar or a scalar reference. + +If the $crc parameters is C<undef>, the crc value will be reset. + +If you have built this module with zlib 1.2.3 or better, two more +CRC-related functions are available. + + $crc = crc32_combine($crc1, $crc2, $len2); + $adler = adler32_combine($adler1, $adler2, $len2); + +These functions allow checksums to be merged. +Refer to the I<zlib> documentation for more details. + +=head1 Misc + +=head2 my $version = Compress::Zlib::zlib_version(); + +Returns the version of the zlib library. + +=head1 CONSTANTS + +All the I<zlib> constants are automatically imported when you make use +of I<Compress::Zlib>. + +=head1 SUPPORT + +General feedback/questions/bug reports should be sent to +L<https://github.com/pmqs/IO-Compress/issues> (preferred) or +L<https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>. + +=head1 SEE ALSO + +L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzip>, L<IO::Uncompress::UnLzip>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Compress::Zstd>, L<IO::Uncompress::UnZstd>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress> + +L<IO::Compress::FAQ|IO::Compress::FAQ> + +L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>, +L<Archive::Tar|Archive::Tar>, +L<IO::Zlib|IO::Zlib> + +For RFC 1950, 1951 and 1952 see +L<http://www.faqs.org/rfcs/rfc1950.html>, +L<http://www.faqs.org/rfcs/rfc1951.html> and +L<http://www.faqs.org/rfcs/rfc1952.html> + +The I<zlib> compression library was written by Jean-loup Gailly +C<gzip@prep.ai.mit.edu> and Mark Adler C<madler@alumni.caltech.edu>. + +The primary site for the I<zlib> compression library is +L<http://www.zlib.org>. + +The primary site for gzip is L<http://www.gzip.org>. + +=head1 AUTHOR + +This module was written by Paul Marquess, C<pmqs@cpan.org>. + +=head1 MODIFICATION HISTORY + +See the Changes file. + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 1995-2019 Paul Marquess. All rights reserved. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + diff --git a/data/miniconda3/lib/perl5/core_perl/Config/Extensions.pm b/data/miniconda3/lib/perl5/core_perl/Config/Extensions.pm new file mode 100644 index 0000000000000000000000000000000000000000..b92ebf8ab8299d3a4741768a144bd9b1c45c9c99 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Config/Extensions.pm @@ -0,0 +1,64 @@ +package Config::Extensions; +use strict; +our (%Extensions, $VERSION, @ISA, @EXPORT_OK); +use Config; +require Exporter; + +$VERSION = '0.03'; +@ISA = 'Exporter'; +@EXPORT_OK = '%Extensions'; + +foreach my $type (qw(static dynamic nonxs)) { + foreach (split /\s+/, $Config{$type . '_ext'}) { + s!/!::!g; + $Extensions{$_} = $type; + } +} + +1; +__END__ + +=head1 NAME + +Config::Extensions - hash lookup of which core extensions were built. + +=head1 SYNOPSIS + + use Config::Extensions '%Extensions'; + if ($Extensions{PerlIO::via}) { + # This perl has PerlIO::via built + } + +=head1 DESCRIPTION + +The Config::Extensions module provides a hash C<%Extensions> containing all +the core extensions that were enabled for this perl. The hash is keyed by +extension name, with each entry having one of 3 possible values: + +=over 4 + +=item dynamic + +The extension is dynamically linked + +=item nonxs + +The extension is pure perl, so doesn't need linking to the perl executable + +=item static + +The extension is statically linked to the perl binary + +=back + +As all values evaluate to true, a simple C<if> test is good enough to determine +whether an extension is present. + +All the data uses to generate the C<%Extensions> hash is already present in +the C<Config> module, but not in such a convenient format to quickly reference. + +=head1 AUTHOR + +Nicholas Clark <nick@ccl4.org> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Config/Perl/V.pm b/data/miniconda3/lib/perl5/core_perl/Config/Perl/V.pm new file mode 100644 index 0000000000000000000000000000000000000000..dbb0f88ec15719fd140a35eea6f7b36b0bf448e0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Config/Perl/V.pm @@ -0,0 +1,561 @@ +package Config::Perl::V; + +use strict; +use warnings; + +use Config; +use Exporter; +use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); +$VERSION = "0.32"; +@ISA = qw( Exporter ); +@EXPORT_OK = qw( plv2hash summary myconfig signature ); +%EXPORT_TAGS = ( + all => [ @EXPORT_OK ], + sig => [ "signature" ], + ); + +# Characteristics of this binary (from libperl): +# Compile-time options: DEBUGGING PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP +# USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO + +# The list are as the perl binary has stored it in PL_bincompat_options +# search for it in +# perl.c line 1643 S_Internals_V () +# perl -ne'(/^S_Internals_V/../^}/)&&s/^\s+"( .*)"/$1/ and print' perl.c +# perl.h line 4566 PL_bincompat_options +# perl -ne'(/^\w.*PL_bincompat/../^\w}/)&&s/^\s+"( .*)"/$1/ and print' perl.h +my %BTD = map { $_ => 0 } qw( + + DEBUGGING + NO_HASH_SEED + NO_MATHOMS + NO_TAINT_SUPPORT + PERL_BOOL_AS_CHAR + PERL_COPY_ON_WRITE + PERL_DISABLE_PMC + PERL_DONT_CREATE_GVSV + PERL_EXTERNAL_GLOB + PERL_HASH_FUNC_DJB2 + PERL_HASH_FUNC_MURMUR3 + PERL_HASH_FUNC_ONE_AT_A_TIME + PERL_HASH_FUNC_ONE_AT_A_TIME_HARD + PERL_HASH_FUNC_ONE_AT_A_TIME_OLD + PERL_HASH_FUNC_SDBM + PERL_HASH_FUNC_SIPHASH + PERL_HASH_FUNC_SUPERFAST + PERL_IS_MINIPERL + PERL_MALLOC_WRAP + PERL_MEM_LOG + PERL_MEM_LOG_ENV + PERL_MEM_LOG_ENV_FD + PERL_MEM_LOG_NOIMPL + PERL_MEM_LOG_STDERR + PERL_MEM_LOG_TIMESTAMP + PERL_NEW_COPY_ON_WRITE + PERL_OP_PARENT + PERL_PERTURB_KEYS_DETERMINISTIC + PERL_PERTURB_KEYS_DISABLED + PERL_PERTURB_KEYS_RANDOM + PERL_PRESERVE_IVUV + PERL_RELOCATABLE_INCPUSH + PERL_USE_DEVEL + PERL_USE_SAFE_PUTENV + SILENT_NO_TAINT_SUPPORT + UNLINK_ALL_VERSIONS + USE_ATTRIBUTES_FOR_PERLIO + USE_FAST_STDIO + USE_HASH_SEED_EXPLICIT + USE_LOCALE + USE_LOCALE_CTYPE + USE_NO_REGISTRY + USE_PERL_ATOF + USE_SITECUSTOMIZE + USE_THREAD_SAFE_LOCALE + + DEBUG_LEAKING_SCALARS + DEBUG_LEAKING_SCALARS_FORK_DUMP + DECCRTL_SOCKETS + FAKE_THREADS + FCRYPT + HAS_TIMES + HAVE_INTERP_INTERN + MULTIPLICITY + MYMALLOC + PERL_DEBUG_READONLY_COW + PERL_DEBUG_READONLY_OPS + PERL_GLOBAL_STRUCT + PERL_GLOBAL_STRUCT_PRIVATE + PERL_IMPLICIT_CONTEXT + PERL_IMPLICIT_SYS + PERLIO_LAYERS + PERL_MAD + PERL_MICRO + PERL_NEED_APPCTX + PERL_NEED_TIMESBASE + PERL_OLD_COPY_ON_WRITE + PERL_POISON + PERL_SAWAMPERSAND + PERL_TRACK_MEMPOOL + PERL_USES_PL_PIDSTATUS + PL_OP_SLAB_ALLOC + THREADS_HAVE_PIDS + USE_64_BIT_ALL + USE_64_BIT_INT + USE_IEEE + USE_ITHREADS + USE_LARGE_FILES + USE_LOCALE_COLLATE + USE_LOCALE_NUMERIC + USE_LOCALE_TIME + USE_LONG_DOUBLE + USE_PERLIO + USE_QUADMATH + USE_REENTRANT_API + USE_SFIO + USE_SOCKS + VMS_DO_SOCKETS + VMS_SHORTEN_LONG_SYMBOLS + VMS_SYMBOL_CASE_AS_IS + ); + +# These are all the keys that are +# 1. Always present in %Config - lib/Config.pm #87 tie %Config +# 2. Reported by 'perl -V' (the rest) +my @config_vars = qw( + + api_subversion + api_version + api_versionstring + archlibexp + dont_use_nlink + d_readlink + d_symlink + exe_ext + inc_version_list + ldlibpthname + patchlevel + path_sep + perl_patchlevel + privlibexp + scriptdir + sitearchexp + sitelibexp + subversion + usevendorprefix + version + + git_commit_id + git_describe + git_branch + git_uncommitted_changes + git_commit_id_title + git_snapshot_date + + package revision version_patchlevel_string + + osname osvers archname + myuname + config_args + hint useposix d_sigaction + useithreads usemultiplicity + useperlio d_sfio uselargefiles usesocks + use64bitint use64bitall uselongdouble + usemymalloc default_inc_excludes_dot bincompat5005 + + cc ccflags + optimize + cppflags + ccversion gccversion gccosandvers + intsize longsize ptrsize doublesize byteorder + d_longlong longlongsize d_longdbl longdblsize + ivtype ivsize nvtype nvsize lseektype lseeksize + alignbytes prototype + + ld ldflags + libpth + libs + perllibs + libc so useshrplib libperl + gnulibc_version + + dlsrc dlext d_dlsymun ccdlflags + cccdlflags lddlflags + ); + +my %empty_build = ( + osname => "", + stamp => 0, + options => { %BTD }, + patches => [], + ); + +sub _make_derived { + my $conf = shift; + + for ( [ lseektype => "Off_t" ], + [ myuname => "uname" ], + [ perl_patchlevel => "patch" ], + ) { + my ($official, $derived) = @$_; + $conf->{config}{$derived} ||= $conf->{config}{$official}; + $conf->{config}{$official} ||= $conf->{config}{$derived}; + $conf->{derived}{$derived} = delete $conf->{config}{$derived}; + } + + if (exists $conf->{config}{version_patchlevel_string} && + !exists $conf->{config}{api_version}) { + my $vps = $conf->{config}{version_patchlevel_string}; + $vps =~ s{\b revision \s+ (\S+) }{}x and + $conf->{config}{revision} ||= $1; + + $vps =~ s{\b version \s+ (\S+) }{}x and + $conf->{config}{api_version} ||= $1; + $vps =~ s{\b subversion \s+ (\S+) }{}x and + $conf->{config}{subversion} ||= $1; + $vps =~ s{\b patch \s+ (\S+) }{}x and + $conf->{config}{perl_patchlevel} ||= $1; + } + + ($conf->{config}{version_patchlevel_string} ||= join " ", + map { ($_, $conf->{config}{$_} ) } + grep { $conf->{config}{$_} } + qw( api_version subversion perl_patchlevel )) =~ s/\bperl_//; + + $conf->{config}{perl_patchlevel} ||= ""; # 0 is not a valid patchlevel + + if ($conf->{config}{perl_patchlevel} =~ m{^git\w*-([^-]+)}i) { + $conf->{config}{git_branch} ||= $1; + $conf->{config}{git_describe} ||= $conf->{config}{perl_patchlevel}; + } + + $conf->{config}{$_} ||= "undef" for grep m/^(?:use|def)/ => @config_vars; + + $conf; + } # _make_derived + +sub plv2hash { + my %config; + + my $pv = join "\n" => @_; + + if ($pv =~ m/^Summary of my\s+(\S+)\s+\(\s*(.*?)\s*\)/m) { + $config{"package"} = $1; + my $rev = $2; + $rev =~ s/^ revision \s+ (\S+) \s*//x and $config{revision} = $1; + $rev and $config{version_patchlevel_string} = $rev; + my ($rel) = $config{"package"} =~ m{perl(\d)}; + my ($vers, $subvers) = $rev =~ m{version\s+(\d+)\s+subversion\s+(\d+)}; + defined $vers && defined $subvers && defined $rel and + $config{version} = "$rel.$vers.$subvers"; + } + + if ($pv =~ m/^\s+(Snapshot of:)\s+(\S+)/) { + $config{git_commit_id_title} = $1; + $config{git_commit_id} = $2; + } + + # these are always last on line and can have multiple quotation styles + for my $k (qw( ccflags ldflags lddlflags )) { + $pv =~ s{, \s* $k \s*=\s* (.*) \s*$}{}mx or next; + my $v = $1; + $v =~ s/\s*,\s*$//; + $v =~ s/^(['"])(.*)\1$/$2/; + $config{$k} = $v; + } + + if (my %kv = ($pv =~ m{\b + (\w+) # key + \s*= # assign + ( '\s*[^']*?\s*' # quoted value + | \S+[^=]*?\s*\n # unquoted running till end of line + | \S+ # unquoted value + | \s*\n # empty + ) + (?:,?\s+|\s*\n)? # separator (5.8.x reports did not have a ',' + }gx)) { # between every kv pair + + while (my ($k, $v) = each %kv) { + $k =~ s/\s+$//; + $v =~ s/\s*\n\z//; + $v =~ s/,$//; + $v =~ m/^'(.*)'$/ and $v = $1; + $v =~ s/\s+$//; + $config{$k} = $v; + } + } + + my $build = { %empty_build }; + + $pv =~ m{^\s+Compiled at\s+(.*)}m + and $build->{stamp} = $1; + $pv =~ m{^\s+Locally applied patches:(?:\s+|\n)(.*?)(?:[\s\n]+Buil[td] under)}ms + and $build->{patches} = [ split m/\n+\s*/, $1 ]; + $pv =~ m{^\s+Compile-time options:(?:\s+|\n)(.*?)(?:[\s\n]+(?:Locally applied|Buil[td] under))}ms + and map { $build->{options}{$_} = 1 } split m/\s+|\n/ => $1; + + $build->{osname} = $config{osname}; + $pv =~ m{^\s+Built under\s+(.*)}m + and $build->{osname} = $1; + $config{osname} ||= $build->{osname}; + + return _make_derived ({ + build => $build, + environment => {}, + config => \%config, + derived => {}, + inc => [], + }); + } # plv2hash + +sub summary { + my $conf = shift || myconfig (); + ref $conf eq "HASH" + && exists $conf->{config} + && exists $conf->{build} + && ref $conf->{config} eq "HASH" + && ref $conf->{build} eq "HASH" or return; + + my %info = map { + exists $conf->{config}{$_} ? ( $_ => $conf->{config}{$_} ) : () } + qw( archname osname osvers revision patchlevel subversion version + cc ccversion gccversion config_args inc_version_list + d_longdbl d_longlong use64bitall use64bitint useithreads + uselongdouble usemultiplicity usemymalloc useperlio useshrplib + doublesize intsize ivsize nvsize longdblsize longlongsize lseeksize + default_inc_excludes_dot + ); + $info{$_}++ for grep { $conf->{build}{options}{$_} } keys %{$conf->{build}{options}}; + + return \%info; + } # summary + +sub signature { + my $no_md5 = "0" x 32; + my $conf = summary (shift) or return $no_md5; + + eval { require Digest::MD5 }; + $@ and return $no_md5; + + $conf->{cc} =~ s{.*\bccache\s+}{}; + $conf->{cc} =~ s{.*[/\\]}{}; + + delete $conf->{config_args}; + return Digest::MD5::md5_hex (join "\xFF" => map { + "$_=".(defined $conf->{$_} ? $conf->{$_} : "\xFE"); + } sort keys %$conf); + } # signature + +sub myconfig { + my $args = shift; + my %args = ref $args eq "HASH" ? %$args : + ref $args eq "ARRAY" ? @$args : (); + + my $build = { %empty_build }; + + # 5.14.0 and later provide all the information without shelling out + my $stamp = eval { Config::compile_date () }; + if (defined $stamp) { + $stamp =~ s/^Compiled at //; + $build->{osname} = $^O; + $build->{stamp} = $stamp; + $build->{patches} = [ Config::local_patches () ]; + $build->{options}{$_} = 1 for Config::bincompat_options (), + Config::non_bincompat_options (); + } + else { + #y $pv = qx[$^X -e"sub Config::myconfig{};" -V]; + my $cnf = plv2hash (qx[$^X -V]); + + $build->{$_} = $cnf->{build}{$_} for qw( osname stamp patches options ); + } + + my @KEYS = keys %ENV; + my %env = + map { $_ => $ENV{$_} } grep m/^PERL/ => @KEYS; + $args{env} and + map { $env{$_} = $ENV{$_} } grep m{$args{env}} => @KEYS; + + my %config = map { $_ => $Config{$_} } @config_vars; + + return _make_derived ({ + build => $build, + environment => \%env, + config => \%config, + derived => {}, + inc => \@INC, + }); + } # myconfig + +1; + +__END__ + +=head1 NAME + +Config::Perl::V - Structured data retrieval of perl -V output + +=head1 SYNOPSIS + + use Config::Perl::V; + + my $local_config = Config::Perl::V::myconfig (); + print $local_config->{config}{osname}; + +=head1 DESCRIPTION + +=head2 $conf = myconfig () + +This function will collect the data described in L</"The hash structure"> below, +and return that as a hash reference. It optionally accepts an option to +include more entries from %ENV. See L</environment> below. + +Note that this will not work on uninstalled perls when called with +C<-I/path/to/uninstalled/perl/lib>, but it works when that path is in +C<$PERL5LIB> or in C<$PERL5OPT>, as paths passed using C<-I> are not +known when the C<-V> information is collected. + +=head2 $conf = plv2hash ($text [, ...]) + +Convert a sole 'perl -V' text block, or list of lines, to a complete +myconfig hash. All unknown entries are defaulted. + +=head2 $info = summary ([$conf]) + +Return an arbitrary selection of the information. If no C<$conf> is +given, C<myconfig ()> is used instead. + +=head2 $md5 = signature ([$conf]) + +Return the MD5 of the info returned by C<summary ()> without the +C<config_args> entry. + +If C<Digest::MD5> is not available, it return a string with only C<0>'s. + +=head2 The hash structure + +The returned hash consists of 4 parts: + +=over 4 + +=item build + +This information is extracted from the second block that is emitted by +C<perl -V>, and usually looks something like + + Characteristics of this binary (from libperl): + Compile-time options: DEBUGGING USE_64_BIT_INT USE_LARGE_FILES + Locally applied patches: + defined-or + MAINT24637 + Built under linux + Compiled at Jun 13 2005 10:44:20 + @INC: + /usr/lib/perl5/5.8.7/i686-linux-64int + /usr/lib/perl5/5.8.7 + /usr/lib/perl5/site_perl/5.8.7/i686-linux-64int + /usr/lib/perl5/site_perl/5.8.7 + /usr/lib/perl5/site_perl + . + +or + + Characteristics of this binary (from libperl): + Compile-time options: DEBUGGING MULTIPLICITY + PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT + PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL + PERL_USE_SAFE_PUTENV USE_ITHREADS + USE_LARGE_FILES USE_PERLIO + USE_REENTRANT_API + Built under linux + Compiled at Jan 28 2009 15:26:59 + +This information is not available anywhere else, including C<%Config>, +but it is the information that is only known to the perl binary. + +The extracted information is stored in 5 entries in the C<build> hash: + +=over 4 + +=item osname + +This is most likely the same as C<$Config{osname}>, and was the name +known when perl was built. It might be different if perl was cross-compiled. + +The default for this field, if it cannot be extracted, is to copy +C<$Config{osname}>. The two may be differing in casing (OpenBSD vs openbsd). + +=item stamp + +This is the time string for which the perl binary was compiled. The default +value is 0. + +=item options + +This is a hash with all the known defines as keys. The value is either 0, +which means unknown or unset, or 1, which means defined. + +=item derived + +As some variables are reported by a different name in the output of C<perl -V> +than their actual name in C<%Config>, I decided to leave the C<config> entry +as close to reality as possible, and put in the entries that might have been +guessed by the printed output in a separate block. + +=item patches + +This is a list of optionally locally applied patches. Default is an empty list. + +=back + +=item environment + +By default this hash is only filled with the environment variables +out of %ENV that start with C<PERL>, but you can pass the C<env> option +to myconfig to get more + + my $conf = Config::Perl::V::myconfig ({ env => qr/^ORACLE/ }); + my $conf = Config::Perl::V::myconfig ([ env => qr/^ORACLE/ ]); + +=item config + +This hash is filled with the variables that C<perl -V> fills its report +with, and it has the same variables that C<Config::myconfig> returns +from C<%Config>. + +=item inc + +This is the list of default @INC. + +=back + +=head1 REASONING + +This module was written to be able to return the configuration for the +currently used perl as deeply as needed for the CPANTESTERS framework. +Up until now they used the output of myconfig as a single text blob, +and so it was missing the vital binary characteristics of the running +perl and the optional applied patches. + +=head1 BUGS + +Please feedback what is wrong + +=head1 TODO + + * Implement retrieval functions/methods + * Documentation + * Error checking + * Tests + +=head1 AUTHOR + +H.Merijn Brand <h.m.brand@xs4all.nl> + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2009-2018 H.Merijn Brand + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/DB.pm b/data/miniconda3/lib/perl5/core_perl/DB.pm new file mode 100644 index 0000000000000000000000000000000000000000..404c57cb25cfb3921abe636cc8bf28b30bdcab0a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DB.pm @@ -0,0 +1,802 @@ +# +# Documentation is at the __END__ +# + +package DB; + +# "private" globals + +my ($running, $ready, $deep, $usrctxt, $evalarg, + @stack, @saved, @skippkg, @clients); +my $preeval = {}; +my $posteval = {}; +my $ineval = {}; + +#### +# +# Globals - must be defined at startup so that clients can refer to +# them right after a C<require DB;> +# +#### + +BEGIN { + + # these are hardcoded in perl source (some are magical) + + $DB::sub = ''; # name of current subroutine + %DB::sub = (); # "filename:fromline-toline" for every known sub + $DB::single = 0; # single-step flag (set it to 1 to enable stops in BEGIN/use) + $DB::signal = 0; # signal flag (will cause a stop at the next line) + $DB::trace = 0; # are we tracing through subroutine calls? + @DB::args = (); # arguments of current subroutine or @ARGV array + @DB::dbline = (); # list of lines in currently loaded file + %DB::dbline = (); # actions in current file (keyed by line number) + @DB::ret = (); # return value of last sub executed in list context + $DB::ret = ''; # return value of last sub executed in scalar context + + # other "public" globals + + $DB::package = ''; # current package space + $DB::filename = ''; # current filename + $DB::subname = ''; # currently executing sub (fully qualified name) + $DB::lineno = ''; # current line number + + $DB::VERSION = $DB::VERSION = '1.08'; + + # initialize private globals to avoid warnings + + $running = 1; # are we running, or are we stopped? + @stack = (0); + @clients = (); + $deep = 1000; + $ready = 0; + @saved = (); + @skippkg = (); + $usrctxt = ''; + $evalarg = ''; +} + +#### +# entry point for all subroutine calls +# +sub sub { + push(@stack, $DB::single); + $DB::single &= 1; + $DB::single |= 4 if $#stack == $deep; + if ($DB::sub eq 'DESTROY' or substr($DB::sub, -9) eq '::DESTROY' or not defined wantarray) { + &$DB::sub; + $DB::single |= pop(@stack); + $DB::ret = undef; + } + elsif (wantarray) { + @DB::ret = &$DB::sub; + $DB::single |= pop(@stack); + @DB::ret; + } + else { + $DB::ret = &$DB::sub; + $DB::single |= pop(@stack); + $DB::ret; + } +} + +#### +# this is called by perl for every statement +# +sub DB { + return unless $ready; + &save; + ($DB::package, $DB::filename, $DB::lineno) = caller; + + return if @skippkg and grep { $_ eq $DB::package } @skippkg; + + $usrctxt = "package $DB::package;"; # this won't let them modify, alas + local(*DB::dbline) = "::_<$DB::filename"; + + my ($stop, $action); + if (($stop,$action) = split(/\0/,$DB::dbline{$DB::lineno})) { + if ($stop eq '1') { + $DB::signal |= 1; + } + else { + $stop = 0 unless $stop; # avoid un_init warning + $evalarg = "\$DB::signal |= do { $stop; }"; &eval; + $DB::dbline{$DB::lineno} =~ s/;9($|\0)/$1/; # clear any temp breakpt + } + } + if ($DB::single || $DB::trace || $DB::signal) { + $DB::subname = ($DB::sub =~ /\'|::/) ? $DB::sub : "${DB::package}::$DB::sub"; #'; + DB->loadfile($DB::filename, $DB::lineno); + } + $evalarg = $action, &eval if $action; + if ($DB::single || $DB::signal) { + _outputall($#stack . " levels deep in subroutine calls.\n") if $DB::single & 4; + $DB::single = 0; + $DB::signal = 0; + $running = 0; + + &eval if ($evalarg = DB->prestop); + my $c; + for $c (@clients) { + # perform any client-specific prestop actions + &eval if ($evalarg = $c->cprestop); + + # Now sit in an event loop until something sets $running + do { + $c->idle; # call client event loop; must not block + if ($running == 2) { # client wants something eval-ed + &eval if ($evalarg = $c->evalcode); + $running = 0; + } + } until $running; + + # perform any client-specific poststop actions + &eval if ($evalarg = $c->cpoststop); + } + &eval if ($evalarg = DB->poststop); + } + ($@, $!, $,, $/, $\, $^W) = @saved; + (); +} + +#### +# this takes its argument via $evalarg to preserve current @_ +# +sub eval { + ($@, $!, $,, $/, $\, $^W) = @saved; + eval "$usrctxt $evalarg; &DB::save"; + _outputall($@) if $@; +} + +############################################################################### +# no compile-time subroutine call allowed before this point # +############################################################################### + +use strict; # this can run only after DB() and sub() are defined + +sub save { + @saved = ($@, $!, $,, $/, $\, $^W); + $, = ""; $/ = "\n"; $\ = ""; $^W = 0; +} + +sub catch { + for (@clients) { $_->awaken; } + $DB::signal = 1; + $ready = 1; +} + +#### +# +# Client callable (read inheritable) methods defined after this point +# +#### + +sub register { + my $s = shift; + $s = _clientname($s) if ref($s); + push @clients, $s; +} + +sub done { + my $s = shift; + $s = _clientname($s) if ref($s); + @clients = grep {$_ ne $s} @clients; + $s->cleanup; +# $running = 3 unless @clients; + exit(0) unless @clients; +} + +sub _clientname { + my $name = shift; + "$name" =~ /^(.+)=[A-Z]+\(.+\)$/; + return $1; +} + +sub next { + my $s = shift; + $DB::single = 2; + $running = 1; +} + +sub step { + my $s = shift; + $DB::single = 1; + $running = 1; +} + +sub cont { + my $s = shift; + my $i = shift; + $s->set_tbreak($i) if $i; + for ($i = 0; $i <= $#stack;) { + $stack[$i++] &= ~1; + } + $DB::single = 0; + $running = 1; +} + +#### +# XXX caller must experimentally determine $i (since it depends +# on how many client call frames are between this call and the DB call). +# Such is life. +# +sub ret { + my $s = shift; + my $i = shift; # how many levels to get to DB sub + $i = 0 unless defined $i; + $stack[$#stack-$i] |= 1; + $DB::single = 0; + $running = 1; +} + +#### +# XXX caller must experimentally determine $start (since it depends +# on how many client call frames are between this call and the DB call). +# Such is life. +# +sub backtrace { + my $self = shift; + my $start = shift; + my($p,$f,$l,$s,$h,$w,$e,$r,$a, @a, @ret,$i); + $start = 1 unless $start; + for ($i = $start; ($p,$f,$l,$s,$h,$w,$e,$r) = caller($i); $i++) { + @a = @DB::args; + for (@a) { + s/'/\\'/g; + s/([^\0]*)/'$1'/ unless /^-?[\d.]+$/; + require 'meta_notation.pm'; + $_ = _meta_notation($_) if /[[:^print:]]/a; + } + $w = $w ? '@ = ' : '$ = '; + $a = $h ? '(' . join(', ', @a) . ')' : ''; + $e =~ s/\n\s*\;\s*\Z// if $e; + $e =~ s/[\\\']/\\$1/g if $e; + if ($r) { + $s = "require '$e'"; + } elsif (defined $r) { + $s = "eval '$e'"; + } elsif ($s eq '(eval)') { + $s = "eval {...}"; + } + $f = "file '$f'" unless $f eq '-e'; + push @ret, "$w&$s$a from $f line $l"; + last if $DB::signal; + } + return @ret; +} + +sub _outputall { + my $c; + for $c (@clients) { + $c->output(@_); + } +} + +sub trace_toggle { + my $s = shift; + $DB::trace = !$DB::trace; +} + + +#### +# without args: returns all defined subroutine names +# with subname args: returns a listref [file, start, end] +# +sub subs { + my $s = shift; + if (@_) { + my(@ret) = (); + while (@_) { + my $name = shift; + push @ret, [$DB::sub{$name} =~ /^(.*)\:(\d+)-(\d+)$/] + if exists $DB::sub{$name}; + } + return @ret; + } + return keys %DB::sub; +} + +#### +# first argument is a filename whose subs will be returned +# if a filename is not supplied, all subs in the current +# filename are returned. +# +sub filesubs { + my $s = shift; + my $fname = shift; + $fname = $DB::filename unless $fname; + return grep { $DB::sub{$_} =~ /^$fname/ } keys %DB::sub; +} + +#### +# returns a list of all filenames that DB knows about +# +sub files { + my $s = shift; + my(@f) = grep(m|^_<|, keys %main::); + return map { substr($_,2) } @f; +} + +#### +# returns reference to an array holding the lines in currently +# loaded file +# +sub lines { + my $s = shift; + return \@DB::dbline; +} + +#### +# loadfile($file, $line) +# +sub loadfile { + my $s = shift; + my($file, $line) = @_; + if (!defined $main::{'_<' . $file}) { + my $try; + if (($try) = grep(m|^_<.*$file|, keys %main::)) { + $file = substr($try,2); + } + } + if (defined($main::{'_<' . $file})) { + my $c; +# _outputall("Loading file $file.."); + *DB::dbline = "::_<$file"; + $DB::filename = $file; + for $c (@clients) { +# print "2 ", $file, '|', $line, "\n"; + $c->showfile($file, $line); + } + return $file; + } + return undef; +} + +sub lineevents { + my $s = shift; + my $fname = shift; + my(%ret) = (); + my $i; + $fname = $DB::filename unless $fname; + local(*DB::dbline) = "::_<$fname"; + for ($i = 1; $i <= $#DB::dbline; $i++) { + $ret{$i} = [$DB::dbline[$i], split(/\0/, $DB::dbline{$i})] + if defined $DB::dbline{$i}; + } + return %ret; +} + +sub set_break { + my $s = shift; + my $i = shift; + my $cond = shift; + $i ||= $DB::lineno; + $cond ||= '1'; + $i = _find_subline($i) if ($i =~ /\D/); + $s->output("Subroutine not found.\n") unless $i; + if ($i) { + if ($DB::dbline[$i] == 0) { + $s->output("Line $i not breakable.\n"); + } + else { + $DB::dbline{$i} =~ s/^[^\0]*/$cond/; + } + } +} + +sub set_tbreak { + my $s = shift; + my $i = shift; + $i = _find_subline($i) if ($i =~ /\D/); + $s->output("Subroutine not found.\n") unless $i; + if ($i) { + if ($DB::dbline[$i] == 0) { + $s->output("Line $i not breakable.\n"); + } + else { + $DB::dbline{$i} =~ s/($|\0)/;9$1/; # add one-time-only b.p. + } + } +} + +sub _find_subline { + my $name = shift; + $name =~ s/\'/::/; + $name = "${DB::package}\:\:" . $name if $name !~ /::/; + $name = "main" . $name if substr($name,0,2) eq "::"; + my($fname, $from, $to) = ($DB::sub{$name} =~ /^(.*):(\d+)-(\d+)$/); + if ($from) { + local *DB::dbline = "::_<$fname"; + ++$from while $DB::dbline[$from] == 0 && $from < $to; + return $from; + } + return undef; +} + +sub clr_breaks { + my $s = shift; + my $i; + if (@_) { + while (@_) { + $i = shift; + $i = _find_subline($i) if ($i =~ /\D/); + $s->output("Subroutine not found.\n") unless $i; + if (defined $DB::dbline{$i}) { + $DB::dbline{$i} =~ s/^[^\0]+//; + if ($DB::dbline{$i} =~ s/^\0?$//) { + delete $DB::dbline{$i}; + } + } + } + } + else { + for ($i = 1; $i <= $#DB::dbline ; $i++) { + if (defined $DB::dbline{$i}) { + $DB::dbline{$i} =~ s/^[^\0]+//; + if ($DB::dbline{$i} =~ s/^\0?$//) { + delete $DB::dbline{$i}; + } + } + } + } +} + +sub set_action { + my $s = shift; + my $i = shift; + my $act = shift; + $i = _find_subline($i) if ($i =~ /\D/); + $s->output("Subroutine not found.\n") unless $i; + if ($i) { + if ($DB::dbline[$i] == 0) { + $s->output("Line $i not actionable.\n"); + } + else { + $DB::dbline{$i} =~ s/\0[^\0]*//; + $DB::dbline{$i} .= "\0" . $act; + } + } +} + +sub clr_actions { + my $s = shift; + my $i; + if (@_) { + while (@_) { + my $i = shift; + $i = _find_subline($i) if ($i =~ /\D/); + $s->output("Subroutine not found.\n") unless $i; + if ($i && $DB::dbline[$i] != 0) { + $DB::dbline{$i} =~ s/\0[^\0]*//; + delete $DB::dbline{$i} if $DB::dbline{$i} =~ s/^\0?$//; + } + } + } + else { + for ($i = 1; $i <= $#DB::dbline ; $i++) { + if (defined $DB::dbline{$i}) { + $DB::dbline{$i} =~ s/\0[^\0]*//; + delete $DB::dbline{$i} if $DB::dbline{$i} =~ s/^\0?$//; + } + } + } +} + +sub prestop { + my ($client, $val) = @_; + return defined($val) ? $preeval->{$client} = $val : $preeval->{$client}; +} + +sub poststop { + my ($client, $val) = @_; + return defined($val) ? $posteval->{$client} = $val : $posteval->{$client}; +} + +# +# "pure virtual" methods +# + +# client-specific pre/post-stop actions. +sub cprestop {} +sub cpoststop {} + +# client complete startup +sub awaken {} + +sub skippkg { + my $s = shift; + push @skippkg, @_ if @_; +} + +sub evalcode { + my ($client, $val) = @_; + if (defined $val) { + $running = 2; # hand over to DB() to evaluate in its context + $ineval->{$client} = $val; + } + return $ineval->{$client}; +} + +sub ready { + my $s = shift; + return $ready = 1; +} + +# stubs + +sub init {} +sub stop {} +sub idle {} +sub cleanup {} +sub output {} + +# +# client init +# +for (@clients) { $_->init } + +$SIG{'INT'} = \&DB::catch; + +# disable this if stepping through END blocks is desired +# (looks scary and deconstructivist with Swat) +END { $ready = 0 } + +1; +__END__ + +=head1 NAME + +DB - programmatic interface to the Perl debugging API + +=head1 SYNOPSIS + + package CLIENT; + use DB; + @ISA = qw(DB); + + # these (inherited) methods can be called by the client + + CLIENT->register() # register a client package name + CLIENT->done() # de-register from the debugging API + CLIENT->skippkg('hide::hide') # ask DB not to stop in this package + CLIENT->cont([WHERE]) # run some more (until BREAK or + # another breakpointt) + CLIENT->step() # single step + CLIENT->next() # step over + CLIENT->ret() # return from current subroutine + CLIENT->backtrace() # return the call stack description + CLIENT->ready() # call when client setup is done + CLIENT->trace_toggle() # toggle subroutine call trace mode + CLIENT->subs([SUBS]) # return subroutine information + CLIENT->files() # return list of all files known to DB + CLIENT->lines() # return lines in currently loaded file + CLIENT->loadfile(FILE,LINE) # load a file and let other clients know + CLIENT->lineevents() # return info on lines with actions + CLIENT->set_break([WHERE],[COND]) + CLIENT->set_tbreak([WHERE]) + CLIENT->clr_breaks([LIST]) + CLIENT->set_action(WHERE,ACTION) + CLIENT->clr_actions([LIST]) + CLIENT->evalcode(STRING) # eval STRING in executing code's context + CLIENT->prestop([STRING]) # execute in code context before stopping + CLIENT->poststop([STRING])# execute in code context before resuming + + # These methods will be called at the appropriate times. + # Stub versions provided do nothing. + # None of these can block. + + CLIENT->init() # called when debug API inits itself + CLIENT->stop(FILE,LINE) # when execution stops + CLIENT->idle() # while stopped (can be a client event loop) + CLIENT->cleanup() # just before exit + CLIENT->output(LIST) # called to print any output that + # the API must show + +=head1 DESCRIPTION + +Perl debug information is frequently required not just by debuggers, +but also by modules that need some "special" information to do their +job properly, like profilers. + +This module abstracts and provides all of the hooks into Perl internal +debugging functionality, so that various implementations of Perl debuggers +(or packages that want to simply get at the "privileged" debugging data) +can all benefit from the development of this common code. Currently used +by Swat, the perl/Tk GUI debugger. + +Note that multiple "front-ends" can latch into this debugging API +simultaneously. This is intended to facilitate things like +debugging with a command line and GUI at the same time, debugging +debuggers etc. [Sounds nice, but this needs some serious support -- GSAR] + +In particular, this API does B<not> provide the following functions: + +=over 4 + +=item * + +data display + +=item * + +command processing + +=item * + +command alias management + +=item * + +user interface (tty or graphical) + +=back + +These are intended to be services performed by the clients of this API. + +This module attempts to be squeaky clean w.r.t C<use strict;> and when +warnings are enabled. + + +=head2 Global Variables + +The following "public" global names can be read by clients of this API. +Beware that these should be considered "readonly". + +=over 8 + +=item $DB::sub + +Name of current executing subroutine. + +=item %DB::sub + +The keys of this hash are the names of all the known subroutines. Each value +is an encoded string that has the sprintf(3) format +C<("%s:%d-%d", filename, fromline, toline)>. + +=item $DB::single + +Single-step flag. Will be true if the API will stop at the next statement. + +=item $DB::signal + +Signal flag. Will be set to a true value if a signal was caught. Clients may +check for this flag to abort time-consuming operations. + +=item $DB::trace + +This flag is set to true if the API is tracing through subroutine calls. + +=item @DB::args + +Contains the arguments of current subroutine, or the C<@ARGV> array if in the +toplevel context. + +=item @DB::dbline + +List of lines in currently loaded file. + +=item %DB::dbline + +Actions in current file (keys are line numbers). The values are strings that +have the sprintf(3) format C<("%s\000%s", breakcondition, actioncode)>. + +=item $DB::package + +Package namespace of currently executing code. + +=item $DB::filename + +Currently loaded filename. + +=item $DB::subname + +Fully qualified name of currently executing subroutine. + +=item $DB::lineno + +Line number that will be executed next. + +=back + +=head2 API Methods + +The following are methods in the DB base class. A client must +access these methods by inheritance (*not* by calling them directly), +since the API keeps track of clients through the inheritance +mechanism. + +=over 8 + +=item CLIENT->register() + +register a client object/package + +=item CLIENT->evalcode(STRING) + +eval STRING in executing code context + +=item CLIENT->skippkg('D::hide') + +ask DB not to stop in these packages + +=item CLIENT->run() + +run some more (until a breakpt is reached) + +=item CLIENT->step() + +single step + +=item CLIENT->next() + +step over + +=item CLIENT->done() + +de-register from the debugging API + +=back + +=head2 Client Callback Methods + +The following "virtual" methods can be defined by the client. They will +be called by the API at appropriate points. Note that unless specified +otherwise, the debug API only defines empty, non-functional default versions +of these methods. + +=over 8 + +=item CLIENT->init() + +Called after debug API inits itself. + +=item CLIENT->prestop([STRING]) + +Usually inherited from DB package. If no arguments are passed, +returns the prestop action string. + +=item CLIENT->stop() + +Called when execution stops (w/ args file, line). + +=item CLIENT->idle() + +Called while stopped (can be a client event loop). + +=item CLIENT->poststop([STRING]) + +Usually inherited from DB package. If no arguments are passed, +returns the poststop action string. + +=item CLIENT->evalcode(STRING) + +Usually inherited from DB package. Ask for a STRING to be C<eval>-ed +in executing code context. + +=item CLIENT->cleanup() + +Called just before exit. + +=item CLIENT->output(LIST) + +Called when API must show a message (warnings, errors etc.). + + +=back + + +=head1 BUGS + +The interface defined by this module is missing some of the later additions +to perl's debugging functionality. As such, this interface should be considered +highly experimental and subject to change. + +=head1 AUTHOR + +Gurusamy Sarathy gsar@activestate.com + +This code heavily adapted from an early version of perl5db.pl attributable +to Larry Wall and the Perl Porters. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter.pm new file mode 100644 index 0000000000000000000000000000000000000000..033fd1c75f4109e2bee482856abba23cdbe5f4c1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter.pm @@ -0,0 +1,601 @@ +package DBM_Filter ; + +use strict; +use warnings; +our $VERSION = '0.06'; + +package Tie::Hash ; + +use strict; +use warnings; + +use Carp; + + +our %LayerStack = (); +our %origDESTROY = (); + +our %Filters = map { $_, undef } qw( + Fetch_Key + Fetch_Value + Store_Key + Store_Value + ); + +our %Options = map { $_, 1 } qw( + fetch + store + ); + +#sub Filter_Enable +#{ +#} +# +#sub Filter_Disable +#{ +#} + +sub Filtered +{ + my $this = shift; + return defined $LayerStack{$this} ; +} + +sub Filter_Pop +{ + my $this = shift; + my $stack = $LayerStack{$this} || return undef ; + my $filter = pop @{ $stack }; + + # remove the filter hooks if this is the last filter to pop + if ( @{ $stack } == 0 ) { + $this->filter_store_key ( undef ); + $this->filter_store_value( undef ); + $this->filter_fetch_key ( undef ); + $this->filter_fetch_value( undef ); + delete $LayerStack{$this}; + } + + return $filter; +} + +sub Filter_Key_Push +{ + &_do_Filter_Push; +} + +sub Filter_Value_Push +{ + &_do_Filter_Push; +} + + +sub Filter_Push +{ + &_do_Filter_Push; +} + +sub _do_Filter_Push +{ + my $this = shift; + my %callbacks = (); + my $caller = (caller(1))[3]; + $caller =~ s/^.*:://; + + croak "$caller: no parameters present" unless @_ ; + + if ( ! $Options{lc $_[0]} ) { + my $class = shift; + my @params = @_; + + # if $class already contains "::", don't prefix "DBM_Filter::" + $class = "DBM_Filter::$class" unless $class =~ /::/; + + no strict 'refs'; + # does the "DBM_Filter::$class" exist? + if ( ! %{ "${class}::"} ) { + # Nope, so try to load it. + eval " require $class ; " ; + croak "$caller: Cannot Load DBM Filter '$class': $@" if $@; + } + + my $fetch = *{ "${class}::Fetch" }{CODE}; + my $store = *{ "${class}::Store" }{CODE}; + my $filter = *{ "${class}::Filter" }{CODE}; + use strict 'refs'; + + my $count = defined($filter) + defined($store) + defined($fetch) ; + + if ( $count == 0 ) + { croak "$caller: No methods (Filter, Fetch or Store) found in class '$class'" } + elsif ( $count == 1 && ! defined $filter) { + my $need = defined($fetch) ? 'Store' : 'Fetch'; + croak "$caller: Missing method '$need' in class '$class'" ; + } + elsif ( $count >= 2 && defined $filter) + { croak "$caller: Can't mix Filter with Store and Fetch in class '$class'" } + + if (defined $filter) { + my $callbacks = &{ $filter }(@params); + croak "$caller: '${class}::Filter' did not return a hash reference" + unless ref $callbacks && ref $callbacks eq 'HASH'; + %callbacks = %{ $callbacks } ; + } + else { + $callbacks{Fetch} = $fetch; + $callbacks{Store} = $store; + } + } + else { + croak "$caller: not even params" unless @_ % 2 == 0; + %callbacks = @_; + } + + my %filters = %Filters ; + my @got = (); + while (my ($k, $v) = each %callbacks ) + { + my $key = $k; + $k = lc $k; + if ($k eq 'fetch') { + push @got, 'Fetch'; + if ($caller eq 'Filter_Push') + { $filters{Fetch_Key} = $filters{Fetch_Value} = $v } + elsif ($caller eq 'Filter_Key_Push') + { $filters{Fetch_Key} = $v } + elsif ($caller eq 'Filter_Value_Push') + { $filters{Fetch_Value} = $v } + } + elsif ($k eq 'store') { + push @got, 'Store'; + if ($caller eq 'Filter_Push') + { $filters{Store_Key} = $filters{Store_Value} = $v } + elsif ($caller eq 'Filter_Key_Push') + { $filters{Store_Key} = $v } + elsif ($caller eq 'Filter_Value_Push') + { $filters{Store_Value} = $v } + } + else + { croak "$caller: Unknown key '$key'" } + + croak "$caller: value associated with key '$key' is not a code reference" + unless ref $v && ref $v eq 'CODE'; + } + + if ( @got != 2 ) { + push @got, 'neither' if @got == 0 ; + croak "$caller: expected both Store & Fetch - got @got"; + } + + # remember the class + push @{ $LayerStack{$this} }, \%filters ; + + my $str_this = "$this" ; # Avoid a closure with $this in the subs below + + $this->filter_store_key ( sub { store_hook($str_this, 'Store_Key') }); + $this->filter_store_value( sub { store_hook($str_this, 'Store_Value') }); + $this->filter_fetch_key ( sub { fetch_hook($str_this, 'Fetch_Key') }); + $this->filter_fetch_value( sub { fetch_hook($str_this, 'Fetch_Value') }); + + # Hijack the callers DESTROY method + $this =~ /^(.*)=/; + my $type = $1 ; + no strict 'refs'; + if ( *{ "${type}::DESTROY" }{CODE} ne \&MyDESTROY ) + { + $origDESTROY{$type} = *{ "${type}::DESTROY" }{CODE}; + no warnings 'redefine'; + *{ "${type}::DESTROY" } = \&MyDESTROY ; + } +} + +sub store_hook +{ + my $this = shift ; + my $type = shift ; + foreach my $layer (@{ $LayerStack{$this} }) + { + &{ $layer->{$type} }() if defined $layer->{$type} ; + } +} + +sub fetch_hook +{ + my $this = shift ; + my $type = shift ; + foreach my $layer (reverse @{ $LayerStack{$this} }) + { + &{ $layer->{$type} }() if defined $layer->{$type} ; + } +} + +sub MyDESTROY +{ + my $this = shift ; + delete $LayerStack{$this} ; + + # call real DESTROY + $this =~ /^(.*)=/; + &{ $origDESTROY{$1} }($this); +} + +1; + +__END__ + +=head1 NAME + +DBM_Filter -- Filter DBM keys/values + +=head1 SYNOPSIS + + use DBM_Filter ; + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File + + $db = tie %hash, ... + + $db->Filter_Push(Fetch => sub {...}, + Store => sub {...}); + + $db->Filter_Push('my_filter1'); + $db->Filter_Push('my_filter2', params...); + + $db->Filter_Key_Push(...) ; + $db->Filter_Value_Push(...) ; + + $db->Filter_Pop(); + $db->Filtered(); + + package DBM_Filter::my_filter1; + + sub Store { ... } + sub Fetch { ... } + + 1; + + package DBM_Filter::my_filter2; + + sub Filter + { + my @opts = @_; + ... + return ( + sub Store { ... }, + sub Fetch { ... } ); + } + + 1; + +=head1 DESCRIPTION + +This module provides an interface that allows filters to be applied +to tied Hashes associated with DBM files. It builds on the DBM Filter +hooks that are present in all the *DB*_File modules included with the +standard Perl source distribution from version 5.6.1 onwards. In addition +to the *DB*_File modules distributed with Perl, the BerkeleyDB module, +available on CPAN, supports the DBM Filter hooks. See L<perldbmfilter> +for more details on the DBM Filter hooks. + +=head1 What is a DBM Filter? + +A DBM Filter allows the keys and/or values in a tied hash to be modified +by some user-defined code just before it is written to the DBM file and +just after it is read back from the DBM file. For example, this snippet +of code + + $some_hash{"abc"} = 42; + +could potentially trigger two filters, one for the writing of the key +"abc" and another for writing the value 42. Similarly, this snippet + + my ($key, $value) = each %some_hash + +will trigger two filters, one for the reading of the key and one for +the reading of the value. + +Like the existing DBM Filter functionality, this module arranges for the +C<$_> variable to be populated with the key or value that a filter will +check. This usually means that most DBM filters tend to be very short. + +=head2 So what's new? + +The main enhancements over the standard DBM Filter hooks are: + +=over 4 + +=item * + +A cleaner interface. + +=item * + +The ability to easily apply multiple filters to a single DBM file. + +=item * + +The ability to create "canned" filters. These allow commonly used filters +to be packaged into a stand-alone module. + +=back + +=head1 METHODS + +This module will arrange for the following methods to be available via +the object returned from the C<tie> call. + +=head2 $db->Filter_Push() / $db->Filter_Key_Push() / $db->Filter_Value_Push() + +Add a filter to filter stack for the database, C<$db>. The three formats +vary only in whether they apply to the DBM key, the DBM value or both. + +=over 5 + +=item Filter_Push + +The filter is applied to I<both> keys and values. + +=item Filter_Key_Push + +The filter is applied to the key I<only>. + +=item Filter_Value_Push + +The filter is applied to the value I<only>. + +=back + + +=head2 $db->Filter_Pop() + +Removes the last filter that was applied to the DBM file associated with +C<$db>, if present. + +=head2 $db->Filtered() + +Returns TRUE if there are any filters applied to the DBM associated +with C<$db>. Otherwise returns FALSE. + + + +=head1 Writing a Filter + +Filters can be created in two main ways + +=head2 Immediate Filters + +An immediate filter allows you to specify the filter code to be used +at the point where the filter is applied to a dbm. In this mode the +Filter_*_Push methods expects to receive exactly two parameters. + + my $db = tie %hash, 'SDBM_File', ... + $db->Filter_Push( Store => sub { }, + Fetch => sub { }); + +The code reference associated with C<Store> will be called before any +key/value is written to the database and the code reference associated +with C<Fetch> will be called after any key/value is read from the +database. + +For example, here is a sample filter that adds a trailing NULL character +to all strings before they are written to the DBM file, and removes the +trailing NULL when they are read from the DBM file + + my $db = tie %hash, 'SDBM_File', ... + $db->Filter_Push( Store => sub { $_ .= "\x00" ; }, + Fetch => sub { s/\x00$// ; }); + + +Points to note: + +=over 5 + +=item 1. + +Both the Store and Fetch filters manipulate C<$_>. + +=back + +=head2 Canned Filters + +Immediate filters are useful for one-off situations. For more generic +problems it can be useful to package the filter up in its own module. + +The usage is for a canned filter is: + + $db->Filter_Push("name", params) + +where + +=over 5 + +=item "name" + +is the name of the module to load. If the string specified does not +contain the package separator characters "::", it is assumed to refer to +the full module name "DBM_Filter::name". This means that the full names +for canned filters, "null" and "utf8", included with this module are: + + DBM_Filter::null + DBM_Filter::utf8 + +=item params + +any optional parameters that need to be sent to the filter. See the +encode filter for an example of a module that uses parameters. + +=back + +The module that implements the canned filter can take one of two +forms. Here is a template for the first + + package DBM_Filter::null ; + + use strict; + use warnings; + + sub Store + { + # store code here + } + + sub Fetch + { + # fetch code here + } + + 1; + + +Notes: + +=over 5 + +=item 1. + +The package name uses the C<DBM_Filter::> prefix. + +=item 2. + +The module I<must> have both a Store and a Fetch method. If only one is +present, or neither are present, a fatal error will be thrown. + +=back + +The second form allows the filter to hold state information using a +closure, thus: + + package DBM_Filter::encoding ; + + use strict; + use warnings; + + sub Filter + { + my @params = @_ ; + + ... + return { + Store => sub { $_ = $encoding->encode($_) }, + Fetch => sub { $_ = $encoding->decode($_) } + } ; + } + + 1; + + +In this instance the "Store" and "Fetch" methods are encapsulated inside a +"Filter" method. + + +=head1 Filters Included + +A number of canned filers are provided with this module. They cover a +number of the main areas that filters are needed when interfacing with +DBM files. They also act as templates for your own filters. + +The filter included are: + +=over 5 + +=item * utf8 + +This module will ensure that all data written to the DBM will be encoded +in UTF-8. + +This module needs the Encode module. + +=item * encode + +Allows you to choose the character encoding will be store in the DBM file. + +=item * compress + +This filter will compress all data before it is written to the database +and uncompressed it on reading. + +This module needs Compress::Zlib. + +=item * int32 + +This module is used when interoperating with a C/C++ application that +uses a C int as either the key and/or value in the DBM file. + +=item * null + +This module ensures that all data written to the DBM file is null +terminated. This is useful when you have a perl script that needs +to interoperate with a DBM file that a C program also uses. A fairly +common issue is for the C application to include the terminating null +in a string when it writes to the DBM file. This filter will ensure that +all data written to the DBM file can be read by the C application. + +=back + +=head1 NOTES + +=head2 Maintain Round Trip Integrity + +When writing a DBM filter it is I<very> important to ensure that it is +possible to retrieve all data that you have written when the DBM filter +is in place. In practice, this means that whatever transformation is +applied to the data in the Store method, the I<exact> inverse operation +should be applied in the Fetch method. + +If you don't provide an exact inverse transformation, you will find that +code like this will not behave as you expect. + + while (my ($k, $v) = each %hash) + { + ... + } + +Depending on the transformation, you will find that one or more of the +following will happen + +=over 5 + +=item 1 + +The loop will never terminate. + +=item 2 + +Too few records will be retrieved. + +=item 3 + +Too many will be retrieved. + +=item 4 + +The loop will do the right thing for a while, but it will unexpectedly fail. + +=back + +=head2 Don't mix filtered & non-filtered data in the same database file. + +This is just a restatement of the previous section. Unless you are +completely certain you know what you are doing, avoid mixing filtered & +non-filtered data. + +=head1 EXAMPLE + +Say you need to interoperate with a legacy C application that stores +keys as C ints and the values and null terminated UTF-8 strings. Here +is how you would set that up + + my $db = tie %hash, 'SDBM_File', ... + + $db->Filter_Key_Push('int32') ; + + $db->Filter_Value_Push('utf8'); + $db->Filter_Value_Push('null'); + +=head1 SEE ALSO + +<DB_File>, L<GDBM_File>, L<NDBM_File>, L<ODBM_File>, L<SDBM_File>, L<perldbmfilter> + +=head1 AUTHOR + +Paul Marquess <pmqs@cpan.org> + diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter/compress.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/compress.pm new file mode 100644 index 0000000000000000000000000000000000000000..cb286a73bd00100279672cb248c71cc18ea86f16 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/compress.pm @@ -0,0 +1,53 @@ +package DBM_Filter::compress ; + +use strict; +use warnings; +use Carp; + +our $VERSION = '0.03'; + +BEGIN +{ + eval { require Compress::Zlib; Compress::Zlib->import() }; + + croak "Compress::Zlib module not found.\n" + if $@; +} + + + +sub Store { $_ = compress($_) } +sub Fetch { $_ = uncompress($_) } + +1; + +__END__ + +=head1 NAME + +DBM_Filter::compress - filter for DBM_Filter + +=head1 SYNOPSIS + + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, ODBM_File + use DBM_Filter ; + + $db = tie %hash, ... + $db->Filter_Push('compress'); + +=head1 DESCRIPTION + +This DBM filter will compress all data before it is written to the database +and uncompressed it on reading. + +A fatal error will be thrown if the Compress::Zlib module is not +available. + +=head1 SEE ALSO + +L<DBM_Filter>, L<perldbmfilter>, L<Compress::Zlib> + +=head1 AUTHOR + +Paul Marquess pmqs@cpan.org + diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter/encode.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/encode.pm new file mode 100644 index 0000000000000000000000000000000000000000..907f51d73ee434a840da273119f00ee0ada63c7f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/encode.pm @@ -0,0 +1,86 @@ +package DBM_Filter::encode ; + +use strict; +use warnings; +use Carp; + +our $VERSION = '0.03'; + +BEGIN +{ + eval { require Encode; }; + + croak "Encode module not found.\n" + if $@; +} + + +sub Filter +{ + my $encoding_name = shift || "utf8"; + + my $encoding = Encode::find_encoding($encoding_name) ; + + croak "Encoding '$encoding_name' is not available" + unless $encoding; + + return { + Store => sub { + $_ = $encoding->encode($_) + if defined $_ ; + }, + Fetch => sub { + $_ = $encoding->decode($_) + if defined $_ ; + } + } ; +} + +1; + +__END__ + +=head1 NAME + +DBM_Filter::encode - filter for DBM_Filter + +=head1 SYNOPSIS + + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, ODBM_File + use DBM_Filter ; + + $db = tie %hash, ... + $db->Filter_Push('encode' => 'iso-8859-16'); + +=head1 DESCRIPTION + +This DBM filter allows you to choose the character encoding will be +store in the DBM file. The usage is + + $db->Filter_Push('encode' => ENCODING); + +where "ENCODING" must be a valid encoding name that the Encode module +recognises. + +A fatal error will be thrown if: + +=over 5 + +=item 1 + +The Encode module is not available. + +=item 2 + +The encoding requested is not supported by the Encode module. + +=back + +=head1 SEE ALSO + +L<DBM_Filter>, L<perldbmfilter>, L<Encode> + +=head1 AUTHOR + +Paul Marquess pmqs@cpan.org + diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter/int32.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/int32.pm new file mode 100644 index 0000000000000000000000000000000000000000..bedcebad660825c98bd9f4e2af627e122bd5a1b7 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/int32.pm @@ -0,0 +1,50 @@ +package DBM_Filter::int32 ; + +use strict; +use warnings; + +our $VERSION = '0.03'; + +# todo get Filter to figure endian. + +sub Store +{ + $_ = 0 if ! defined $_ || $_ eq "" ; + $_ = pack("i", $_); +} + +sub Fetch +{ + no warnings 'uninitialized'; + $_ = unpack("i", $_); +} + +1; + +__END__ + +=head1 NAME + +DBM_Filter::int32 - filter for DBM_Filter + +=head1 SYNOPSIS + + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File + use DBM_Filter ; + + $db = tie %hash, ... + $db->Filter_Push('int32'); + +=head1 DESCRIPTION + +This DBM filter is used when interoperating with a C/C++ application +that uses a C int as either the key and/or value in the DBM file. + +=head1 SEE ALSO + +L<DBM_Filter>, L<perldbmfilter> + +=head1 AUTHOR + +Paul Marquess pmqs@cpan.org + diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter/null.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/null.pm new file mode 100644 index 0000000000000000000000000000000000000000..d06ffac8f661f0e1c2de0187bb4a404d80d664b0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/null.pm @@ -0,0 +1,52 @@ +package DBM_Filter::null ; + +use strict; +use warnings; + +our $VERSION = '0.03'; + +sub Store +{ + no warnings 'uninitialized'; + $_ .= "\x00" ; +} + +sub Fetch +{ + no warnings 'uninitialized'; + s/\x00$// ; +} + +1; + +__END__ + +=head1 NAME + +DBM_Filter::null - filter for DBM_Filter + +=head1 SYNOPSIS + + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File + use DBM_Filter ; + + $db = tie %hash, ... + $db->Filter_Push('null'); + +=head1 DESCRIPTION + +This filter ensures that all data written to the DBM file is null +terminated. This is useful when you have a perl script that needs +to interoperate with a DBM file that a C program also uses. A fairly +common issue is for the C application to include the terminating null +in a string when it writes to the DBM file. This filter will ensure that +all data written to the DBM file can be read by the C application. + + +=head1 SEE ALSO + +L<DBM_Filter>, L<perldbmfilter> + +=head1 AUTHOR + +Paul Marquess pmqs@cpan.org diff --git a/data/miniconda3/lib/perl5/core_perl/DBM_Filter/utf8.pm b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/utf8.pm new file mode 100644 index 0000000000000000000000000000000000000000..56efd12f082ef0df8a9acd9da7cba26c1eb36b0e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DBM_Filter/utf8.pm @@ -0,0 +1,51 @@ +package DBM_Filter::utf8 ; + +use strict; +use warnings; +use Carp; + +our $VERSION = '0.03'; + +BEGIN +{ + eval { require Encode; }; + + croak "Encode module not found.\n" + if $@; +} + +sub Store { $_ = Encode::encode_utf8($_) if defined $_ } + +sub Fetch { $_ = Encode::decode_utf8($_) if defined $_ } + +1; + +__END__ + +=head1 NAME + +DBM_Filter::utf8 - filter for DBM_Filter + +=head1 SYNOPSIS + + use SDBM_File; # or DB_File, GDBM_File, NDBM_File, or ODBM_File + use DBM_Filter; + + $db = tie %hash, ... + $db->Filter_Push('utf8'); + +=head1 DESCRIPTION + +This Filter will ensure that all data written to the DBM will be encoded +in UTF-8. + +This module uses the Encode module. + +=head1 SEE ALSO + +L<DBM_Filter>, L<perldbmfilter>, L<Encode> + +=head1 AUTHOR + +Paul Marquess pmqs@cpan.org + diff --git a/data/miniconda3/lib/perl5/core_perl/Devel/SelfStubber.pm b/data/miniconda3/lib/perl5/core_perl/Devel/SelfStubber.pm new file mode 100644 index 0000000000000000000000000000000000000000..781dd9f3e971095ae2183b869249621a45bf0963 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Devel/SelfStubber.pm @@ -0,0 +1,152 @@ +package Devel::SelfStubber; +use File::Spec; +require SelfLoader; +@ISA = qw(SelfLoader); +@EXPORT = 'AUTOLOAD'; +$JUST_STUBS = 1; +$VERSION = 1.06; +sub Version {$VERSION} + +# Use as +# perl -e 'use Devel::SelfStubber;Devel::SelfStubber->stub(MODULE_NAME,LIB)' +# (LIB defaults to '.') e.g. +# perl -e 'use Devel::SelfStubber;Devel::SelfStubber->stub('Math::BigInt')' +# would print out stubs needed if you added a __DATA__ before the subs. +# Setting $Devel::SelfStubber::JUST_STUBS to 0 will print out the whole +# module with the stubs entered just before the __DATA__ + +sub _add_to_cache { + my($self,$fullname,$pack,$lines, $prototype) = @_; + push(@DATA,@{$lines}); + if($fullname){push(@STUBS,"sub $fullname $prototype;\n")}; # stubs + '1;'; +} + +sub _package_defined { + my($self,$line) = @_; + push(@DATA,$line); +} + +sub stub { + my($self,$module,$lib) = @_; + my($line,$end_data,$fh,$mod_file,$found_selfloader); + $lib ||= File::Spec->curdir(); + ($mod_file = $module) =~ s,::,/,g; + $mod_file =~ tr|/|:| if $^O eq 'MacOS'; + + $mod_file = File::Spec->catfile($lib, "$mod_file.pm"); + $fh = "${module}::DATA"; + my (@BEFORE_DATA, @AFTER_DATA, @AFTER_END); + @DATA = @STUBS = (); + + open($fh,'<',$mod_file) || die "Unable to open $mod_file"; + local $/ = "\n"; + while(defined ($line = <$fh>) and $line !~ m/^__DATA__/) { + push(@BEFORE_DATA,$line); + $line =~ /use\s+SelfLoader/ && $found_selfloader++; + } + (defined ($line) && $line =~ m/^__DATA__/) + || die "$mod_file doesn't contain a __DATA__ token"; + $found_selfloader || + print 'die "\'use SelfLoader;\' statement NOT FOUND!!\n"',"\n"; + if ($JUST_STUBS) { + $self->_load_stubs($module); + } else { + $self->_load_stubs($module, \@AFTER_END); + } + if ( fileno($fh) ) { + $end_data = 1; + while(defined($line = <$fh>)) { + push(@AFTER_DATA,$line); + } + } + close($fh); + unless ($JUST_STUBS) { + print @BEFORE_DATA; + } + print @STUBS; + unless ($JUST_STUBS) { + print "1;\n__DATA__\n",@DATA; + if($end_data) { print "__END__ DATA\n",@AFTER_DATA; } + if(@AFTER_END) { print "__END__\n",@AFTER_END; } + } +} + +1; +__END__ + +=head1 NAME + +Devel::SelfStubber - generate stubs for a SelfLoading module + +=head1 SYNOPSIS + +To generate just the stubs: + + use Devel::SelfStubber; + Devel::SelfStubber->stub('MODULENAME','MY_LIB_DIR'); + +or to generate the whole module with stubs inserted correctly + + use Devel::SelfStubber; + $Devel::SelfStubber::JUST_STUBS=0; + Devel::SelfStubber->stub('MODULENAME','MY_LIB_DIR'); + +MODULENAME is the Perl module name, e.g. Devel::SelfStubber, +NOT 'Devel/SelfStubber' or 'Devel/SelfStubber.pm'. + +MY_LIB_DIR defaults to '.' if not present. + +=head1 DESCRIPTION + +Devel::SelfStubber prints the stubs you need to put in the module +before the __DATA__ token (or you can get it to print the entire +module with stubs correctly placed). The stubs ensure that if +a method is called, it will get loaded. They are needed specifically +for inherited autoloaded methods. + +This is best explained using the following example: + +Assume four classes, A,B,C & D. + +A is the root class, B is a subclass of A, C is a subclass of B, +and D is another subclass of A. + + A + / \ + B D + / + C + +If D calls an autoloaded method 'foo' which is defined in class A, +then the method is loaded into class A, then executed. If C then +calls method 'foo', and that method was reimplemented in class +B, but set to be autoloaded, then the lookup mechanism never gets to +the AUTOLOAD mechanism in B because it first finds the method +already loaded in A, and so erroneously uses that. If the method +foo had been stubbed in B, then the lookup mechanism would have +found the stub, and correctly loaded and used the sub from B. + +So, for classes and subclasses to have inheritance correctly +work with autoloading, you need to ensure stubs are loaded. + +The SelfLoader can load stubs automatically at module initialization +with the statement 'SelfLoader-E<gt>load_stubs()';, but you may wish to +avoid having the stub loading overhead associated with your +initialization (though note that the SelfLoader::load_stubs method +will be called sooner or later - at latest when the first sub +is being autoloaded). In this case, you can put the sub stubs +before the __DATA__ token. This can be done manually, but this +module allows automatic generation of the stubs. + +By default it just prints the stubs, but you can set the +global $Devel::SelfStubber::JUST_STUBS to 0 and it will +print out the entire module with the stubs positioned correctly. + +At the very least, this is useful to see what the SelfLoader +thinks are stubs - in order to ensure future versions of the +SelfStubber remain in step with the SelfLoader, the +SelfStubber actually uses the SelfLoader to determine which +stubs are needed. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Digest.pm b/data/miniconda3/lib/perl5/core_perl/Digest.pm new file mode 100644 index 0000000000000000000000000000000000000000..16dae9d16e51219bb43f632bc6ed4a680a7e64cb --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Digest.pm @@ -0,0 +1,323 @@ +package Digest; + +use strict; +use vars qw($VERSION %MMAP $AUTOLOAD); + +$VERSION = "1.17_01"; + +%MMAP = ( + "SHA-1" => [["Digest::SHA", 1], "Digest::SHA1", ["Digest::SHA2", 1]], + "SHA-224" => [["Digest::SHA", 224]], + "SHA-256" => [["Digest::SHA", 256], ["Digest::SHA2", 256]], + "SHA-384" => [["Digest::SHA", 384], ["Digest::SHA2", 384]], + "SHA-512" => [["Digest::SHA", 512], ["Digest::SHA2", 512]], + "HMAC-MD5" => "Digest::HMAC_MD5", + "HMAC-SHA-1" => "Digest::HMAC_SHA1", + "CRC-16" => [["Digest::CRC", type => "crc16"]], + "CRC-32" => [["Digest::CRC", type => "crc32"]], + "CRC-CCITT" => [["Digest::CRC", type => "crcccitt"]], + "RIPEMD-160" => "Crypt::RIPEMD160", +); + +sub new +{ + shift; # class ignored + my $algorithm = shift; + my $impl = $MMAP{$algorithm} || do { + $algorithm =~ s/\W+//g; + "Digest::$algorithm"; + }; + $impl = [$impl] unless ref($impl); + local $@; # don't clobber it for our caller + my $err; + for (@$impl) { + my $class = $_; + my @args; + ($class, @args) = @$class if ref($class); + no strict 'refs'; + unless (exists ${"$class\::"}{"VERSION"}) { + my $pm_file = $class . ".pm"; + $pm_file =~ s{::}{/}g; + eval { + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + require $pm_file + }; + if ($@) { + $err ||= $@; + next; + } + } + return $class->new(@args, @_); + } + die $err; +} + +sub AUTOLOAD +{ + my $class = shift; + my $algorithm = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2); + $class->new($algorithm, @_); +} + +1; + +__END__ + +=head1 NAME + +Digest - Modules that calculate message digests + +=head1 SYNOPSIS + + $md5 = Digest->new("MD5"); + $sha1 = Digest->new("SHA-1"); + $sha256 = Digest->new("SHA-256"); + $sha384 = Digest->new("SHA-384"); + $sha512 = Digest->new("SHA-512"); + + $hmac = Digest->HMAC_MD5($key); + +=head1 DESCRIPTION + +The C<Digest::> modules calculate digests, also called "fingerprints" +or "hashes", of some data, called a message. The digest is (usually) +some small/fixed size string. The actual size of the digest depend of +the algorithm used. The message is simply a sequence of arbitrary +bytes or bits. + +An important property of the digest algorithms is that the digest is +I<likely> to change if the message change in some way. Another +property is that digest functions are one-way functions, that is it +should be I<hard> to find a message that correspond to some given +digest. Algorithms differ in how "likely" and how "hard", as well as +how efficient they are to compute. + +Note that the properties of the algorithms change over time, as the +algorithms are analyzed and machines grow faster. If your application +for instance depends on it being "impossible" to generate the same +digest for a different message it is wise to make it easy to plug in +stronger algorithms as the one used grow weaker. Using the interface +documented here should make it easy to change algorithms later. + +All C<Digest::> modules provide the same programming interface. A +functional interface for simple use, as well as an object oriented +interface that can handle messages of arbitrary length and which can +read files directly. + +The digest can be delivered in three formats: + +=over 8 + +=item I<binary> + +This is the most compact form, but it is not well suited for printing +or embedding in places that can't handle arbitrary data. + +=item I<hex> + +A twice as long string of lowercase hexadecimal digits. + +=item I<base64> + +A string of portable printable characters. This is the base64 encoded +representation of the digest with any trailing padding removed. The +string will be about 30% longer than the binary version. +L<MIME::Base64> tells you more about this encoding. + +=back + + +The functional interface is simply importable functions with the same +name as the algorithm. The functions take the message as argument and +return the digest. Example: + + use Digest::MD5 qw(md5); + $digest = md5($message); + +There are also versions of the functions with "_hex" or "_base64" +appended to the name, which returns the digest in the indicated form. + +=head1 OO INTERFACE + +The following methods are available for all C<Digest::> modules: + +=over 4 + +=item $ctx = Digest->XXX($arg,...) + +=item $ctx = Digest->new(XXX => $arg,...) + +=item $ctx = Digest::XXX->new($arg,...) + +The constructor returns some object that encapsulate the state of the +message-digest algorithm. You can add data to the object and finally +ask for the digest. The "XXX" should of course be replaced by the proper +name of the digest algorithm you want to use. + +The two first forms are simply syntactic sugar which automatically +load the right module on first use. The second form allow you to use +algorithm names which contains letters which are not legal perl +identifiers, e.g. "SHA-1". If no implementation for the given algorithm +can be found, then an exception is raised. + +If new() is called as an instance method (i.e. $ctx->new) it will just +reset the state the object to the state of a newly created object. No +new object is created in this case, and the return value is the +reference to the object (i.e. $ctx). + +=item $other_ctx = $ctx->clone + +The clone method creates a copy of the digest state object and returns +a reference to the copy. + +=item $ctx->reset + +This is just an alias for $ctx->new. + +=item $ctx->add( $data ) + +=item $ctx->add( $chunk1, $chunk2, ... ) + +The string value of the $data provided as argument is appended to the +message we calculate the digest for. The return value is the $ctx +object itself. + +If more arguments are provided then they are all appended to the +message, thus all these lines will have the same effect on the state +of the $ctx object: + + $ctx->add("a"); $ctx->add("b"); $ctx->add("c"); + $ctx->add("a")->add("b")->add("c"); + $ctx->add("a", "b", "c"); + $ctx->add("abc"); + +Most algorithms are only defined for strings of bytes and this method +might therefore croak if the provided arguments contain chars with +ordinal number above 255. + +=item $ctx->addfile( $io_handle ) + +The $io_handle is read until EOF and the content is appended to the +message we calculate the digest for. The return value is the $ctx +object itself. + +The addfile() method will croak() if it fails reading data for some +reason. If it croaks it is unpredictable what the state of the $ctx +object will be in. The addfile() method might have been able to read +the file partially before it failed. It is probably wise to discard +or reset the $ctx object if this occurs. + +In most cases you want to make sure that the $io_handle is in +"binmode" before you pass it as argument to the addfile() method. + +=item $ctx->add_bits( $data, $nbits ) + +=item $ctx->add_bits( $bitstring ) + +The add_bits() method is an alternative to add() that allow partial +bytes to be appended to the message. Most users should just ignore +this method as partial bytes is very unlikely to be of any practical +use. + +The two argument form of add_bits() will add the first $nbits bits +from $data. For the last potentially partial byte only the high order +C<< $nbits % 8 >> bits are used. If $nbits is greater than C<< +length($data) * 8 >>, then this method would do the same as C<< +$ctx->add($data) >>. + +The one argument form of add_bits() takes a $bitstring of "1" and "0" +chars as argument. It's a shorthand for C<< $ctx->add_bits(pack("B*", +$bitstring), length($bitstring)) >>. + +The return value is the $ctx object itself. + +This example shows two calls that should have the same effect: + + $ctx->add_bits("111100001010"); + $ctx->add_bits("\xF0\xA0", 12); + +Most digest algorithms are byte based and for these it is not possible +to add bits that are not a multiple of 8, and the add_bits() method +will croak if you try. + +=item $ctx->digest + +Return the binary digest for the message. + +Note that the C<digest> operation is effectively a destructive, +read-once operation. Once it has been performed, the $ctx object is +automatically C<reset> and can be used to calculate another digest +value. Call $ctx->clone->digest if you want to calculate the digest +without resetting the digest state. + +=item $ctx->hexdigest + +Same as $ctx->digest, but will return the digest in hexadecimal form. + +=item $ctx->b64digest + +Same as $ctx->digest, but will return the digest as a base64 encoded +string. + +=back + +=head1 Digest speed + +This table should give some indication on the relative speed of +different algorithms. It is sorted by throughput based on a benchmark +done with of some implementations of this API: + + Algorithm Size Implementation MB/s + + MD4 128 Digest::MD4 v1.3 165.0 + MD5 128 Digest::MD5 v2.33 98.8 + SHA-256 256 Digest::SHA2 v1.1.0 66.7 + SHA-1 160 Digest::SHA v4.3.1 58.9 + SHA-1 160 Digest::SHA1 v2.10 48.8 + SHA-256 256 Digest::SHA v4.3.1 41.3 + Haval-256 256 Digest::Haval256 v1.0.4 39.8 + SHA-384 384 Digest::SHA2 v1.1.0 19.6 + SHA-512 512 Digest::SHA2 v1.1.0 19.3 + SHA-384 384 Digest::SHA v4.3.1 19.2 + SHA-512 512 Digest::SHA v4.3.1 19.2 + Whirlpool 512 Digest::Whirlpool v1.0.2 13.0 + MD2 128 Digest::MD2 v2.03 9.5 + + Adler-32 32 Digest::Adler32 v0.03 1.3 + CRC-16 16 Digest::CRC v0.05 1.1 + CRC-32 32 Digest::CRC v0.05 1.1 + MD5 128 Digest::Perl::MD5 v1.5 1.0 + CRC-CCITT 16 Digest::CRC v0.05 0.8 + +These numbers was achieved Apr 2004 with ActivePerl-5.8.3 running +under Linux on a P4 2.8 GHz CPU. The last 5 entries differ by being +pure perl implementations of the algorithms, which explains why they +are so slow. + +=head1 SEE ALSO + +L<Digest::Adler32>, L<Digest::CRC>, L<Digest::Haval256>, +L<Digest::HMAC>, L<Digest::MD2>, L<Digest::MD4>, L<Digest::MD5>, +L<Digest::SHA>, L<Digest::SHA1>, L<Digest::SHA2>, L<Digest::Whirlpool> + +New digest implementations should consider subclassing from L<Digest::base>. + +L<MIME::Base64> + +http://en.wikipedia.org/wiki/Cryptographic_hash_function + +=head1 AUTHOR + +Gisle Aas <gisle@aas.no> + +The C<Digest::> interface is based on the interface originally +developed by Neil Winton for his C<MD5> module. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + + Copyright 1998-2006 Gisle Aas. + Copyright 1995,1996 Neil Winton. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Digest/base.pm b/data/miniconda3/lib/perl5/core_perl/Digest/base.pm new file mode 100644 index 0000000000000000000000000000000000000000..b2844ba34008d6a1c554a316645b4894bede5052 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Digest/base.pm @@ -0,0 +1,100 @@ +package Digest::base; + +use strict; +use vars qw($VERSION); +$VERSION = "1.16"; + +# subclass is supposed to implement at least these +sub new; +sub clone; +sub add; +sub digest; + +sub reset { + my $self = shift; + $self->new(@_); # ugly +} + +sub addfile { + my ($self, $handle) = @_; + + my $n; + my $buf = ""; + + while (($n = read($handle, $buf, 4*1024))) { + $self->add($buf); + } + unless (defined $n) { + require Carp; + Carp::croak("Read failed: $!"); + } + + $self; +} + +sub add_bits { + my $self = shift; + my $bits; + my $nbits; + if (@_ == 1) { + my $arg = shift; + $bits = pack("B*", $arg); + $nbits = length($arg); + } + else { + ($bits, $nbits) = @_; + } + if (($nbits % 8) != 0) { + require Carp; + Carp::croak("Number of bits must be multiple of 8 for this algorithm"); + } + return $self->add(substr($bits, 0, $nbits/8)); +} + +sub hexdigest { + my $self = shift; + return unpack("H*", $self->digest(@_)); +} + +sub b64digest { + my $self = shift; + require MIME::Base64; + my $b64 = MIME::Base64::encode($self->digest(@_), ""); + $b64 =~ s/=+$//; + return $b64; +} + +1; + +__END__ + +=head1 NAME + +Digest::base - Digest base class + +=head1 SYNOPSIS + + package Digest::Foo; + use base 'Digest::base'; + +=head1 DESCRIPTION + +The C<Digest::base> class provide implementations of the methods +C<addfile> and C<add_bits> in terms of C<add>, and of the methods +C<hexdigest> and C<b64digest> in terms of C<digest>. + +Digest implementations might want to inherit from this class to get +this implementations of the alternative I<add> and I<digest> methods. +A minimal subclass needs to implement the following methods by itself: + + new + clone + add + digest + +The arguments and expected behaviour of these methods are described in +L<Digest>. + +=head1 SEE ALSO + +L<Digest> diff --git a/data/miniconda3/lib/perl5/core_perl/Digest/file.pm b/data/miniconda3/lib/perl5/core_perl/Digest/file.pm new file mode 100644 index 0000000000000000000000000000000000000000..3b86e63503a35501f7cd7dc97b5c13c62df3aea4 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Digest/file.pm @@ -0,0 +1,85 @@ +package Digest::file; + +use strict; + +use Exporter (); +use Carp qw(croak); +use Digest (); + +use vars qw($VERSION @ISA @EXPORT_OK); + +$VERSION = "1.16"; +@ISA = qw(Exporter); +@EXPORT_OK = qw(digest_file_ctx digest_file digest_file_hex digest_file_base64); + +sub digest_file_ctx { + my $file = shift; + croak("No digest algorithm specified") unless @_; + local *F; + open(F, "<", $file) || croak("Can't open '$file': $!"); + binmode(F); + my $ctx = Digest->new(@_); + $ctx->addfile(*F); + close(F); + return $ctx; +} + +sub digest_file { + digest_file_ctx(@_)->digest; +} + +sub digest_file_hex { + digest_file_ctx(@_)->hexdigest; +} + +sub digest_file_base64 { + digest_file_ctx(@_)->b64digest; +} + +1; + +__END__ + +=head1 NAME + +Digest::file - Calculate digests of files + +=head1 SYNOPSIS + + # Poor mans "md5sum" command + use Digest::file qw(digest_file_hex); + for (@ARGV) { + print digest_file_hex($_, "MD5"), " $_\n"; + } + +=head1 DESCRIPTION + +This module provide 3 convenience functions to calculate the digest +of files. The following functions are provided: + +=over + +=item digest_file( $file, $algorithm, [$arg,...] ) + +This function will calculate and return the binary digest of the bytes +of the given file. The function will croak if it fails to open or +read the file. + +The $algorithm is a string like "MD2", "MD5", "SHA-1", "SHA-512". +Additional arguments are passed to the constructor for the +implementation of the given algorithm. + +=item digest_file_hex( $file, $algorithm, [$arg,...] ) + +Same as digest_file(), but return the digest in hex form. + +=item digest_file_base64( $file, $algorithm, [$arg,...] ) + +Same as digest_file(), but return the digest as a base64 encoded +string. + +=back + +=head1 SEE ALSO + +L<Digest> diff --git a/data/miniconda3/lib/perl5/core_perl/DirHandle.pm b/data/miniconda3/lib/perl5/core_perl/DirHandle.pm new file mode 100644 index 0000000000000000000000000000000000000000..bebce9f5ce2c36f468d01c64b5fc5d346eef8df3 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/DirHandle.pm @@ -0,0 +1,89 @@ +package DirHandle; + +our $VERSION = '1.05'; + +=head1 NAME + +DirHandle - (obsolete) supply object methods for directory handles + +=head1 SYNOPSIS + + # recommended approach since Perl 5.6: do not use DirHandle + if (opendir my $d, '.') { + while (readdir $d) { something($_); } + rewind $d; + while (readdir $d) { something_else($_); } + } + + # how you would use this module if you were going to + use DirHandle; + if (my $d = DirHandle->new(".")) { + while (defined($_ = $d->read)) { something($_); } + $d->rewind; + while (defined($_ = $d->read)) { something_else($_); } + } + +=head1 DESCRIPTION + +B<There is no reason to use this module nowadays.> + +The C<DirHandle> method provide an alternative interface to the +opendir(), closedir(), readdir(), and rewinddir() functions. + +Up to Perl 5.5, opendir() could not autovivify a directory handle from +C<undef>, so using a lexical handle required using a function from L<Symbol> +to create an anonymous glob, which took a separate step. +C<DirHandle> encapsulates this, which allowed cleaner code than opendir(). +Since Perl 5.6, opendir() alone has been all you need for lexical handles. + +=cut + +require 5.000; +use Carp; +use Symbol; + +sub new { + @_ >= 1 && @_ <= 2 or croak 'usage: DirHandle->new( [DIRNAME] )'; + my $class = shift; + my $dh = gensym; + if (@_) { + DirHandle::open($dh, $_[0]) + or return undef; + } + bless $dh, $class; +} + +sub DESTROY { + my ($dh) = @_; + # Don't warn about already being closed as it may have been closed + # correctly, or maybe never opened at all. + local($., $@, $!, $^E, $?); + no warnings 'io'; + closedir($dh); +} + +sub open { + @_ == 2 or croak 'usage: $dh->open(DIRNAME)'; + my ($dh, $dirname) = @_; + opendir($dh, $dirname); +} + +sub close { + @_ == 1 or croak 'usage: $dh->close()'; + my ($dh) = @_; + closedir($dh); +} + +sub read { + @_ == 1 or croak 'usage: $dh->read()'; + my ($dh) = @_; + readdir($dh); +} + +sub rewind { + @_ == 1 or croak 'usage: $dh->rewind()'; + my ($dh) = @_; + rewinddir($dh); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Dumpvalue.pm b/data/miniconda3/lib/perl5/core_perl/Dumpvalue.pm new file mode 100644 index 0000000000000000000000000000000000000000..5a0d58ade7a0f8555dde7f99b9849a2e07055deb --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Dumpvalue.pm @@ -0,0 +1,675 @@ +use 5.006_001; # for (defined ref) and $#$v and our +package Dumpvalue; +use strict; +use warnings; +our $VERSION = '1.21'; +our(%address, $stab, @stab, %stab, %subs); + +sub ASCII { return ord('A') == 65; } + +# This module will give incorrect results for some inputs on EBCDIC platforms +# before v5.8 +*to_native = ($] lt "5.008") + ? sub { return shift } + : sub { return utf8::unicode_to_native(shift) }; + +my $APC = chr to_native(0x9F); +my $backslash_c_question = (ASCII) ? '\177' : $APC; + +# documentation nits, handle complex data structures better by chromatic +# translate control chars to ^X - Randal Schwartz +# Modifications to print types by Peter Gordon v1.0 + +# Ilya Zakharevich -- patches after 5.001 (and some before ;-) + +# Won't dump symbol tables and contents of debugged files by default + +# (IZ) changes for objectification: +# c) quote() renamed to method set_quote(); +# d) unctrlSet() renamed to method set_unctrl(); +# f) Compiles with 'use strict', but in two places no strict refs is needed: +# maybe more problems are waiting... + +my %defaults = ( + globPrint => 0, + printUndef => 1, + tick => "auto", + unctrl => 'quote', + subdump => 1, + dumpReused => 0, + bareStringify => 1, + hashDepth => '', + arrayDepth => '', + dumpDBFiles => '', + dumpPackages => '', + quoteHighBit => '', + usageOnly => '', + compactDump => '', + veryCompact => '', + stopDbSignal => '', + ); + +sub new { + my $class = shift; + my %opt = (%defaults, @_); + bless \%opt, $class; +} + +sub set { + my $self = shift; + my %opt = @_; + @$self{keys %opt} = values %opt; +} + +sub get { + my $self = shift; + wantarray ? @$self{@_} : $$self{pop @_}; +} + +sub dumpValue { + my $self = shift; + die "usage: \$dumper->dumpValue(value)" unless @_ == 1; + local %address; + local $^W=0; + (print "undef\n"), return unless defined $_[0]; + (print $self->stringify($_[0]), "\n"), return unless ref $_[0]; + $self->unwrap($_[0],0); +} + +sub dumpValues { + my $self = shift; + local %address; + local $^W=0; + (print "undef\n"), return if (@_ == 1 and not defined $_[0]); + $self->unwrap(\@_,0); +} + +# This one is good for variable names: + +sub unctrl { + local($_) = @_; + + return \$_ if ref \$_ eq "GLOB"; + s/([\000-\037])/'^' . chr(to_native(ord($1)^64))/eg; + s/ $backslash_c_question /^?/xg; + $_; +} + +sub stringify { + my $self = shift; + local $_ = shift; + my $noticks = shift; + my $tick = $self->{tick}; + + return 'undef' unless defined $_ or not $self->{printUndef}; + $_ = '' if not defined $_; + return $_ . "" if ref \$_ eq 'GLOB'; + { no strict 'refs'; + $_ = &{'overload::StrVal'}($_) + if $self->{bareStringify} and ref $_ + and %overload:: and defined &{'overload::StrVal'}; + } + if ($tick eq 'auto') { + if (/[^[:^cntrl:]\n]/) { # All ASCII controls but \n get '"' + $tick = '"'; + } else { + $tick = "'"; + } + } + if ($tick eq "'") { + s/([\'\\])/\\$1/g; + } elsif ($self->{unctrl} eq 'unctrl') { + s/([\"\\])/\\$1/g ; + $_ = &unctrl($_); + s/([[:^ascii:]])/'\\0x'.sprintf('%2X',ord($1))/eg + if $self->{quoteHighBit}; + } elsif ($self->{unctrl} eq 'quote') { + s/([\"\\\$\@])/\\$1/g if $tick eq '"'; + s/\e/\\e/g; + s/([\000-\037$backslash_c_question])/'\\c'._escaped_ord($1)/eg; + } + s/([[:^ascii:]])/'\\'.sprintf('%3o',ord($1))/eg if $self->{quoteHighBit}; + ($noticks || /^\d+(\.\d*)?\Z/) + ? $_ + : $tick . $_ . $tick; +} + +# Ensure a resulting \ is escaped to be \\ +sub _escaped_ord { + my $chr = shift; + if ($chr eq $backslash_c_question) { + $chr = '?'; + } + else { + $chr = chr(to_native(ord($chr)^64)); + $chr =~ s{\\}{\\\\}g; + } + return $chr; +} + +sub DumpElem { + my ($self, $v) = (shift, shift); + my $short = $self->stringify($v, ref $v); + my $shortmore = ''; + if ($self->{veryCompact} && ref $v + && (ref $v eq 'ARRAY' and !grep(ref $_, @$v) )) { + my $depth = $#$v; + ($shortmore, $depth) = (' ...', $self->{arrayDepth} - 1) + if $self->{arrayDepth} and $depth >= $self->{arrayDepth}; + my @a = map $self->stringify($_), @$v[0..$depth]; + print "0..$#{$v} @a$shortmore\n"; + } elsif ($self->{veryCompact} && ref $v + && (ref $v eq 'HASH') and !grep(ref $_, values %$v)) { + my @a = sort keys %$v; + my $depth = $#a; + ($shortmore, $depth) = (' ...', $self->{hashDepth} - 1) + if $self->{hashDepth} and $depth >= $self->{hashDepth}; + my @b = map {$self->stringify($_) . " => " . $self->stringify($$v{$_})} + @a[0..$depth]; + local $" = ', '; + print "@b$shortmore\n"; + } else { + print "$short\n"; + $self->unwrap($v,shift); + } +} + +sub unwrap { + my $self = shift; + return if $DB::signal and $self->{stopDbSignal}; + my ($v) = shift ; + my ($s) = shift || 0; # extra no of spaces + my $sp; + my (%v,@v,$address,$short,$fileno); + + $sp = " " x $s ; + $s += 3 ; + + # Check for reused addresses + if (ref $v) { + my $val = $v; + { no strict 'refs'; + $val = &{'overload::StrVal'}($v) + if %overload:: and defined &{'overload::StrVal'}; + } + ($address) = $val =~ /(0x[0-9a-f]+)\)$/ ; + if (!$self->{dumpReused} && defined $address) { + $address{$address}++ ; + if ( $address{$address} > 1 ) { + print "${sp}-> REUSED_ADDRESS\n" ; + return ; + } + } + } elsif (ref \$v eq 'GLOB') { + $address = "$v" . ""; # To avoid a bug with globs + $address{$address}++ ; + if ( $address{$address} > 1 ) { + print "${sp}*DUMPED_GLOB*\n" ; + return ; + } + } + + if (ref $v eq 'Regexp') { + my $re = "$v"; + $re =~ s,/,\\/,g; + print "$sp-> qr/$re/\n"; + return; + } + + if ( UNIVERSAL::isa($v, 'HASH') ) { + my @sortKeys = sort keys(%$v) ; + my $more; + my $tHashDepth = $#sortKeys ; + $tHashDepth = $#sortKeys < $self->{hashDepth}-1 ? $#sortKeys : $self->{hashDepth}-1 + unless $self->{hashDepth} eq '' ; + $more = "....\n" if $tHashDepth < $#sortKeys ; + my $shortmore = ""; + $shortmore = ", ..." if $tHashDepth < $#sortKeys ; + $#sortKeys = $tHashDepth ; + if ($self->{compactDump} && !grep(ref $_, values %{$v})) { + $short = $sp; + my @keys; + for (@sortKeys) { + push @keys, $self->stringify($_) . " => " . $self->stringify($v->{$_}); + } + $short .= join ', ', @keys; + $short .= $shortmore; + (print "$short\n"), return if length $short <= $self->{compactDump}; + } + for my $key (@sortKeys) { + return if $DB::signal and $self->{stopDbSignal}; + my $value = $ {$v}{$key} ; + print $sp, $self->stringify($key), " => "; + $self->DumpElem($value, $s); + } + print "$sp empty hash\n" unless @sortKeys; + print "$sp$more" if defined $more ; + } elsif ( UNIVERSAL::isa($v, 'ARRAY') ) { + my $tArrayDepth = $#{$v} ; + my $more ; + $tArrayDepth = $#$v < $self->{arrayDepth}-1 ? $#$v : $self->{arrayDepth}-1 + unless $self->{arrayDepth} eq '' ; + $more = "....\n" if $tArrayDepth < $#{$v} ; + my $shortmore = ""; + $shortmore = " ..." if $tArrayDepth < $#{$v} ; + if ($self->{compactDump} && !grep(ref $_, @{$v})) { + if ($#$v >= 0) { + $short = $sp . "0..$#{$v} " . + join(" ", + map {defined $v->[$_] ? $self->stringify($v->[$_]) : "empty"} (0..$tArrayDepth) + ) . "$shortmore"; + } else { + $short = $sp . "empty array"; + } + (print "$short\n"), return if length $short <= $self->{compactDump}; + } + for my $num (0 .. $tArrayDepth) { + return if $DB::signal and $self->{stopDbSignal}; + print "$sp$num "; + if (defined $v->[$num]) { + $self->DumpElem($v->[$num], $s); + } else { + print "empty slot\n"; + } + } + print "$sp empty array\n" unless @$v; + print "$sp$more" if defined $more ; + } elsif ( UNIVERSAL::isa($v, 'SCALAR') or ref $v eq 'REF' ) { + print "$sp-> "; + $self->DumpElem($$v, $s); + } elsif ( UNIVERSAL::isa($v, 'CODE') ) { + print "$sp-> "; + $self->dumpsub(0, $v); + } elsif ( UNIVERSAL::isa($v, 'GLOB') ) { + print "$sp-> ",$self->stringify($$v,1),"\n"; + if ($self->{globPrint}) { + $s += 3; + $self->dumpglob('', $s, "{$$v}", $$v, 1); + } elsif (defined ($fileno = fileno($v))) { + print( (' ' x ($s+3)) . "FileHandle({$$v}) => fileno($fileno)\n" ); + } + } elsif (ref \$v eq 'GLOB') { + if ($self->{globPrint}) { + $self->dumpglob('', $s, "{$v}", $v, 1); + } elsif (defined ($fileno = fileno(\$v))) { + print( (' ' x $s) . "FileHandle({$v}) => fileno($fileno)\n" ); + } + } +} + +sub matchvar { + $_[0] eq $_[1] or + ($_[1] =~ /^([!~])(.)([\x00-\xff]*)/) and + ($1 eq '!') ^ (eval {($_[2] . "::" . $_[0]) =~ /$2$3/}); +} + +sub compactDump { + my $self = shift; + $self->{compactDump} = shift if @_; + $self->{compactDump} = 6*80-1 + if $self->{compactDump} and $self->{compactDump} < 2; + $self->{compactDump}; +} + +sub veryCompact { + my $self = shift; + $self->{veryCompact} = shift if @_; + $self->compactDump(1) if !$self->{compactDump} and $self->{veryCompact}; + $self->{veryCompact}; +} + +sub set_unctrl { + my $self = shift; + if (@_) { + my $in = shift; + if ($in eq 'unctrl' or $in eq 'quote') { + $self->{unctrl} = $in; + } else { + print "Unknown value for 'unctrl'.\n"; + } + } + $self->{unctrl}; +} + +sub set_quote { + my $self = shift; + if (@_ and $_[0] eq '"') { + $self->{tick} = '"'; + $self->{unctrl} = 'quote'; + } elsif (@_ and $_[0] eq 'auto') { + $self->{tick} = 'auto'; + $self->{unctrl} = 'quote'; + } elsif (@_) { # Need to set + $self->{tick} = "'"; + $self->{unctrl} = 'unctrl'; + } + $self->{tick}; +} + +sub dumpglob { + my $self = shift; + return if $DB::signal and $self->{stopDbSignal}; + my ($package, $off, $key, $val, $all) = @_; + local(*stab) = $val; + my $fileno; + if (($key !~ /^_</ or $self->{dumpDBFiles}) and defined $stab) { + print( (' ' x $off) . "\$", &unctrl($key), " = " ); + $self->DumpElem($stab, 3+$off); + } + if (($key !~ /^_</ or $self->{dumpDBFiles}) and @stab) { + print( (' ' x $off) . "\@$key = (\n" ); + $self->unwrap(\@stab,3+$off) ; + print( (' ' x $off) . ")\n" ); + } + if ($key ne "main::" && $key ne "DB::" && %stab + && ($self->{dumpPackages} or $key !~ /::$/) + && ($key !~ /^_</ or $self->{dumpDBFiles}) + && !($package eq "Dumpvalue" and $key eq "stab")) { + print( (' ' x $off) . "\%$key = (\n" ); + $self->unwrap(\%stab,3+$off) ; + print( (' ' x $off) . ")\n" ); + } + if (defined ($fileno = fileno(*stab))) { + print( (' ' x $off) . "FileHandle($key) => fileno($fileno)\n" ); + } + if ($all) { + if (defined &stab) { + $self->dumpsub($off, $key); + } + } +} + +sub CvGV_name { + my $self = shift; + my $in = shift; + return if $self->{skipCvGV}; # Backdoor to avoid problems if XS broken... + $in = \&$in; # Hard reference... + eval {require Devel::Peek; 1} or return; + my $gv = Devel::Peek::CvGV($in) or return; + *$gv{PACKAGE} . '::' . *$gv{NAME}; +} + +sub dumpsub { + my $self = shift; + my ($off,$sub) = @_; + $off ||= 0; + my $ini = $sub; + my $s; + $sub = $1 if $sub =~ /^\{\*(.*)\}$/; + my $subref = defined $1 ? \&$sub : \&$ini; + my $place = $DB::sub{$sub} || (($s = $subs{"$subref"}) && $DB::sub{$s}) + || (($s = $self->CvGV_name($subref)) && $DB::sub{$s}) + || ($self->{subdump} && ($s = $self->findsubs("$subref")) + && $DB::sub{$s}); + $s = $sub unless defined $s; + $place = '???' unless defined $place; + print( (' ' x $off) . "&$s in $place\n" ); +} + +sub findsubs { + my $self = shift; + return undef unless %DB::sub; + my ($addr, $name, $loc); + while (($name, $loc) = each %DB::sub) { + $addr = \&$name; + $subs{"$addr"} = $name; + } + $self->{subdump} = 0; + $subs{ shift() }; +} + +sub dumpvars { + my $self = shift; + my ($package,@vars) = @_; + local(%address,$^W); + $package .= "::" unless $package =~ /::$/; + *stab = *main::; + + while ($package =~ /(\w+?::)/g) { + *stab = defined ${stab}{$1} ? ${stab}{$1} : ''; + } + $self->{TotalStrings} = 0; + $self->{Strings} = 0; + $self->{CompleteTotal} = 0; + for my $k (keys %stab) { + my ($key,$val) = ($k, $stab{$k}); + return if $DB::signal and $self->{stopDbSignal}; + next if @vars && !grep( matchvar($key, $_), @vars ); + if ($self->{usageOnly}) { + $self->globUsage(\$val, $key) + if ($package ne 'Dumpvalue' or $key ne 'stab') + and ref(\$val) eq 'GLOB'; + } else { + $self->dumpglob($package, 0,$key, $val); + } + } + if ($self->{usageOnly}) { + print <<EOP; +String space: $self->{TotalStrings} bytes in $self->{Strings} strings. +EOP + $self->{CompleteTotal} += $self->{TotalStrings}; + print <<EOP; +Grand total = $self->{CompleteTotal} bytes (1 level deep) + overhead. +EOP + } +} + +sub scalarUsage { + my $self = shift; + my $size; + if (UNIVERSAL::isa($_[0], 'ARRAY')) { + $size = $self->arrayUsage($_[0]); + } elsif (UNIVERSAL::isa($_[0], 'HASH')) { + $size = $self->hashUsage($_[0]); + } elsif (!ref($_[0])) { + $size = length($_[0]); + } + $self->{TotalStrings} += $size; + $self->{Strings}++; + $size; +} + +sub arrayUsage { # array ref, name + my $self = shift; + my $size = 0; + map {$size += $self->scalarUsage($_)} @{$_[0]}; + my $len = @{$_[0]}; + print "\@$_[1] = $len item", ($len > 1 ? "s" : ""), " (data: $size bytes)\n" + if defined $_[1]; + $self->{CompleteTotal} += $size; + $size; +} + +sub hashUsage { # hash ref, name + my $self = shift; + my @keys = keys %{$_[0]}; + my @values = values %{$_[0]}; + my $keys = $self->arrayUsage(\@keys); + my $values = $self->arrayUsage(\@values); + my $len = @keys; + my $total = $keys + $values; + print "\%$_[1] = $len item", ($len > 1 ? "s" : ""), + " (keys: $keys; values: $values; total: $total bytes)\n" + if defined $_[1]; + $total; +} + +sub globUsage { # glob ref, name + my $self = shift; + local *stab = *{$_[0]}; + my $total = 0; + $total += $self->scalarUsage($stab) if defined $stab; + $total += $self->arrayUsage(\@stab, $_[1]) if @stab; + $total += $self->hashUsage(\%stab, $_[1]) + if %stab and $_[1] ne "main::" and $_[1] ne "DB::"; + #and !($package eq "Dumpvalue" and $key eq "stab")); + $total; +} + +1; + +=head1 NAME + +Dumpvalue - provides screen dump of Perl data. + +=head1 SYNOPSIS + + use Dumpvalue; + my $dumper = Dumpvalue->new; + $dumper->set(globPrint => 1); + $dumper->dumpValue(\*::); + $dumper->dumpvars('main'); + my $dump = $dumper->stringify($some_value); + +=head1 DESCRIPTION + +=head2 Creation + +A new dumper is created by a call + + $d = Dumpvalue->new(option1 => value1, option2 => value2) + +Recognized options: + +=over 4 + +=item C<arrayDepth>, C<hashDepth> + +Print only first N elements of arrays and hashes. If false, prints all the +elements. + +=item C<compactDump>, C<veryCompact> + +Change style of array and hash dump. If true, short array +may be printed on one line. + +=item C<globPrint> + +Whether to print contents of globs. + +=item C<dumpDBFiles> + +Dump arrays holding contents of debugged files. + +=item C<dumpPackages> + +Dump symbol tables of packages. + +=item C<dumpReused> + +Dump contents of "reused" addresses. + +=item C<tick>, C<quoteHighBit>, C<printUndef> + +Change style of string dump. Default value of C<tick> is C<auto>, one +can enable either double-quotish dump, or single-quotish by setting it +to C<"> or C<'>. By default, characters with high bit set are printed +I<as is>. If C<quoteHighBit> is set, they will be quoted. + +=item C<usageOnly> + +rudimentary per-package memory usage dump. If set, +C<dumpvars> calculates total size of strings in variables in the package. + +=item unctrl + +Changes the style of printout of strings. Possible values are +C<unctrl> and C<quote>. + +=item subdump + +Whether to try to find the subroutine name given the reference. + +=item bareStringify + +Whether to write the non-overloaded form of the stringify-overloaded objects. + +=item quoteHighBit + +Whether to print chars with high bit set in binary or "as is". + +=item stopDbSignal + +Whether to abort printing if debugger signal flag is raised. + +=back + +Later in the life of the object the methods may be queries with get() +method and set() method (which accept multiple arguments). + +=head2 Methods + +=over 4 + +=item dumpValue + + $dumper->dumpValue($value); + $dumper->dumpValue([$value1, $value2]); + +Prints a dump to the currently selected filehandle. + +=item dumpValues + + $dumper->dumpValues($value1, $value2); + +Same as C<< $dumper->dumpValue([$value1, $value2]); >>. + +=item stringify + + my $dump = $dumper->stringify($value [,$noticks] ); + +Returns the dump of a single scalar without printing. If the second +argument is true, the return value does not contain enclosing ticks. +Does not handle data structures. + +=item dumpvars + + $dumper->dumpvars('my_package'); + $dumper->dumpvars('my_package', 'foo', '~bar$', '!......'); + +The optional arguments are considered as literal strings unless they +start with C<~> or C<!>, in which case they are interpreted as regular +expressions (possibly negated). + +The second example prints entries with names C<foo>, and also entries +with names which ends on C<bar>, or are shorter than 5 chars. + +=item set_quote + + $d->set_quote('"'); + +Sets C<tick> and C<unctrl> options to suitable values for printout with the +given quote char. Possible values are C<auto>, C<'> and C<">. + +=item set_unctrl + + $d->set_unctrl('unctrl'); + +Sets C<unctrl> option with checking for an invalid argument. +Possible values are C<unctrl> and C<quote>. + +=item compactDump + + $d->compactDump(1); + +Sets C<compactDump> option. If the value is 1, sets to a reasonable +big number. + +=item veryCompact + + $d->veryCompact(1); + +Sets C<compactDump> and C<veryCompact> options simultaneously. + +=item set + + $d->set(option1 => value1, option2 => value2); + +=item get + + @values = $d->get('option1', 'option2'); + +=back + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/Changes.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/Changes.e2x new file mode 100644 index 0000000000000000000000000000000000000000..5c67c55cb93b4091a71a5daa2f6504cb31cdd7c1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/Changes.e2x @@ -0,0 +1,7 @@ +# +# $Id: Changes.e2x,v 2.0 2004/05/16 20:55:15 dankogai Exp $ +# Revision history for Perl extension Encode::$_Name_. +# + +0.01 $_Now_ + Autogenerated by enc2xs version $_Version_. diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/ConfigLocal_PM.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/ConfigLocal_PM.e2x new file mode 100644 index 0000000000000000000000000000000000000000..e203dfded5025f71791feaf154643361d0020544 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/ConfigLocal_PM.e2x @@ -0,0 +1,13 @@ +# +# Local demand-load module list +# +# You should not edit this file by hand! use "enc2xs -C" +# +package Encode::ConfigLocal; +our $VERSION = $_LocalVer_; + +use strict; + +$_ModLines_ + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/Makefile_PL.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/Makefile_PL.e2x new file mode 100644 index 0000000000000000000000000000000000000000..c17a5096f79137d24e54c47419914bfc2d8a5279 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/Makefile_PL.e2x @@ -0,0 +1,190 @@ +# +# This file is auto-generated by: +# enc2xs version $_Version_ +# $_Now_ +# +use 5.7.2; +use strict; +use ExtUtils::MakeMaker; +use Config; + +# Please edit the following to the taste! +my $name = '$_Name_'; +my %tables = ( + $_Name__t => [ $_TableFiles_ ], + ); + +#### DO NOT EDIT BEYOND THIS POINT! +require File::Spec; +my ($enc2xs, $encode_h) = (); +my @path_ext = (''); +@path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32'; +PATHLOOP: +for my $d (@Config{qw/bin sitebin vendorbin/}, + (split /$Config{path_sep}/o, $ENV{PATH})){ + for my $f (qw/enc2xs enc2xs5.7.3/){ + my $path = File::Spec->catfile($d, $f); + for my $ext (@path_ext) { + my $bin = "$path$ext"; + -r "$bin" and $enc2xs = $bin and last PATHLOOP; + } + } +} +$enc2xs or die "enc2xs not found!"; +print "enc2xs is $enc2xs\n"; +my %encode_h = (); +for my $d (@INC){ + my $dir = File::Spec->catfile($d, "Encode"); + my $file = File::Spec->catfile($dir, "encode.h"); + -f $file and $encode_h{$dir} = -M $file; +} +%encode_h or die "encode.h not found!"; +# find the latest one +($encode_h) = sort {$encode_h{$b} <=> $encode_h{$a}} keys %encode_h; +print "encode.h is at $encode_h\n"; + +WriteMakefile( + INC => "-I$encode_h", +#### END_OF_HEADER -- DO NOT EDIT THIS LINE BY HAND! #### + NAME => 'Encode::'.$name, + VERSION_FROM => "$name.pm", + OBJECT => '$(O_FILES)', + 'dist' => { + COMPRESS => 'gzip -9f', + SUFFIX => 'gz', + DIST_DEFAULT => 'all tardist', + }, + MAN3PODS => {}, + PREREQ_PM => { + 'Encode' => "1.41", + }, + # OS 390 winges about line numbers > 64K ??? + XSOPT => '-nolinenumbers', + ); + +package MY; + +sub post_initialize +{ + my ($self) = @_; + my %o; + my $x = $self->{'OBJ_EXT'}; + # Add the table O_FILES + foreach my $e (keys %tables) + { + $o{$e.$x} = 1; + } + $o{"$name$x"} = 1; + $self->{'O_FILES'} = [sort keys %o]; + my @files = ("$name.xs"); + $self->{'C'} = ["$name.c"]; + # The next two lines to make MacPerl Happy -- dankogai via pudge + $self->{SOURCE} .= " $name.c" + if $^O eq 'MacOS' && $self->{SOURCE} !~ /\b$name\.c\b/; + # $self->{'H'} = [$self->catfile($self->updir,'encode.h')]; + my %xs; + foreach my $table (sort keys %tables) { + push (@{$self->{'C'}},"$table.c"); + # Do NOT add $table.h etc. to H_FILES unless we own up as to how they + # get built. + foreach my $ext (qw($(OBJ_EXT) .c .h .exh .fnm)) { + push (@files,$table.$ext); + } + } + $self->{'XS'} = { "$name.xs" => "$name.c" }; + $self->{'clean'}{'FILES'} .= join(' ',@files); + open(XS,">$name.xs") || die "Cannot open $name.xs:$!"; + print XS <<'END'; +#include <EXTERN.h> +#include <perl.h> +#include <XSUB.h> +#include "encode.h" +END + foreach my $table (sort keys %tables) { + print XS qq[#include "${table}.h"\n]; + } + print XS <<"END"; + +static void +Encode_XSEncoding(pTHX_ encode_t *enc) +{ + dSP; + HV *stash = gv_stashpv("Encode::XS", TRUE); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); + int i = 0; + /* with the SvLEN() == 0 hack, PVX won't be freed. We cast away name's + constness, in the hope that perl won't mess with it. */ + assert(SvTYPE(iv) >= SVt_PV); assert(SvLEN(iv) == 0); + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = (char*) enc->name[0]; + PUSHMARK(sp); + XPUSHs(sv); + while (enc->name[i]) + { + const char *name = enc->name[i++]; + XPUSHs(sv_2mortal(newSVpvn(name,strlen(name)))); + } + PUTBACK; + call_pv("Encode::define_encoding",G_DISCARD); + SvREFCNT_dec(sv); +} + +MODULE = Encode::$name PACKAGE = Encode::$name +PROTOTYPES: DISABLE +BOOT: +{ +END + foreach my $table (sort keys %tables) { + print XS qq[#include "${table}.exh"\n]; + } + print XS "}\n"; + close(XS); + return "# Built $name.xs\n\n"; +} + +sub postamble +{ + my $self = shift; + my $dir = "."; # $self->catdir('Encode'); + my $str = "# $name\$(OBJ_EXT) depends on .h and .exh files not .c files - but all written by enc2xs\n"; + $str .= "$name.c : $name.xs "; + foreach my $table (sort keys %tables) + { + $str .= " $table.c"; + } + $str .= "\n\n"; + $str .= "$name\$(OBJ_EXT) : $name.c\n\n"; + + foreach my $table (sort keys %tables) + { + my $numlines = 1; + my $lengthsofar = length($str); + my $continuator = ''; + $str .= "$table.c : Makefile.PL"; + foreach my $file (@{$tables{$table}}) + { + $str .= $continuator.' '.$self->catfile($dir,$file); + if ( length($str)-$lengthsofar > 128*$numlines ) + { + $continuator .= " \\\n\t"; + $numlines++; + } else { + $continuator = ''; + } + } + my $plib = $self->{PERL_CORE} ? '"-I$(PERL_LIB)"' : ''; + my $ucopts = '-"Q"'; + $str .= + qq{\n\t\$(PERL) $plib $enc2xs $ucopts -o \$\@ -f $table.fnm\n\n}; + open (FILELIST, ">$table.fnm") + || die "Could not open $table.fnm: $!"; + foreach my $file (@{$tables{$table}}) + { + print FILELIST $self->catfile($dir,$file) . "\n"; + } + close(FILELIST); + } + return $str; +} + diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/PerlIO.pod b/data/miniconda3/lib/perl5/core_perl/Encode/PerlIO.pod new file mode 100644 index 0000000000000000000000000000000000000000..1a9269a9b0c1ec1e007fe3fc9cceadcf2c1679ae --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/PerlIO.pod @@ -0,0 +1,167 @@ +=head1 NAME + +Encode::PerlIO -- a detailed document on Encode and PerlIO + +=head1 Overview + +It is very common to want to do encoding transformations when +reading or writing files, network connections, pipes etc. +If Perl is configured to use the new 'perlio' IO system then +C<Encode> provides a "layer" (see L<PerlIO>) which can transform +data as it is read or written. + +Here is how the blind poet would modernise the encoding: + + use Encode; + open(my $iliad,'<:encoding(iso-8859-7)','iliad.greek'); + open(my $utf8,'>:utf8','iliad.utf8'); + my @epic = <$iliad>; + print $utf8 @epic; + close($utf8); + close($illiad); + +In addition, the new IO system can also be configured to read/write +UTF-8 encoded characters (as noted above, this is efficient): + + open(my $fh,'>:utf8','anything'); + print $fh "Any \x{0021} string \N{SMILEY FACE}\n"; + +Either of the above forms of "layer" specifications can be made the default +for a lexical scope with the C<use open ...> pragma. See L<open>. + +Once a handle is open, its layers can be altered using C<binmode>. + +Without any such configuration, or if Perl itself is built using the +system's own IO, then write operations assume that the file handle +accepts only I<bytes> and will C<die> if a character larger than 255 is +written to the handle. When reading, each octet from the handle becomes +a byte-in-a-character. Note that this default is the same behaviour +as bytes-only languages (including Perl before v5.6) would have, +and is sufficient to handle native 8-bit encodings e.g. iso-8859-1, +EBCDIC etc. and any legacy mechanisms for handling other encodings +and binary data. + +In other cases, it is the program's responsibility to transform +characters into bytes using the API above before doing writes, and to +transform the bytes read from a handle into characters before doing +"character operations" (e.g. C<lc>, C</\W+/>, ...). + +You can also use PerlIO to convert larger amounts of data you don't +want to bring into memory. For example, to convert between ISO-8859-1 +(Latin 1) and UTF-8 (or UTF-EBCDIC in EBCDIC machines): + + open(F, "<:encoding(iso-8859-1)", "data.txt") or die $!; + open(G, ">:utf8", "data.utf") or die $!; + while (<F>) { print G } + + # Could also do "print G <F>" but that would pull + # the whole file into memory just to write it out again. + +More examples: + + open(my $f, "<:encoding(cp1252)") + open(my $g, ">:encoding(iso-8859-2)") + open(my $h, ">:encoding(latin9)") # iso-8859-15 + +See also L<encoding> for how to change the default encoding of the +data in your script. + +=head1 How does it work? + +Here is a crude diagram of how filehandle, PerlIO, and Encode +interact. + + filehandle <-> PerlIO PerlIO <-> scalar (read/printed) + \ / + Encode + +When PerlIO receives data from either direction, it fills a buffer +(currently with 1024 bytes) and passes the buffer to Encode. +Encode tries to convert the valid part and passes it back to PerlIO, +leaving invalid parts (usually a partial character) in the buffer. +PerlIO then appends more data to the buffer, calls Encode again, +and so on until the data stream ends. + +To do so, PerlIO always calls (de|en)code methods with CHECK set to 1. +This ensures that the method stops at the right place when it +encounters partial character. The following is what happens when +PerlIO and Encode tries to encode (from utf8) more than 1024 bytes +and the buffer boundary happens to be in the middle of a character. + + A B C .... ~ \x{3000} .... + 41 42 43 .... 7E e3 80 80 .... + <- buffer ---------------> + << encoded >>>>>>>>>> + <- next buffer ------ + +Encode converts from the beginning to \x7E, leaving \xe3 in the buffer +because it is invalid (partial character). + +Unfortunately, this scheme does not work well with escape-based +encodings such as ISO-2022-JP. + +=head1 Line Buffering + +Now let's see what happens when you try to decode from ISO-2022-JP and +the buffer ends in the middle of a character. + + JIS208-ESC \x{5f3e} + A B C .... ~ \e $ B |DAN | .... + 41 42 43 .... 7E 1b 24 41 43 46 .... + <- buffer ---------------------------> + << encoded >>>>>>>>>>>>>>>>>>>>>>> + +As you see, the next buffer begins with \x43. But \x43 is 'C' in +ASCII, which is wrong in this case because we are now in JISX 0208 +area so it has to convert \x43\x46, not \x43. Unlike utf8 and EUC, +in escape-based encodings you can't tell if a given octet is a whole +character or just part of it. + +Fortunately PerlIO also supports line buffer if you tell PerlIO to use +one instead of fixed buffer. Since ISO-2022-JP is guaranteed to revert to ASCII at the end of the line, partial +character will never happen when line buffer is used. + +To tell PerlIO to use line buffer, implement -E<gt>needs_lines method +for your encoding object. See L<Encode::Encoding> for details. + +Thanks to these efforts most encodings that come with Encode support +PerlIO but that still leaves following encodings. + + iso-2022-kr + MIME-B + MIME-Header + MIME-Q + +Fortunately iso-2022-kr is hardly used (according to Jungshik) and +MIME-* are very unlikely to be fed to PerlIO because they are for mail +headers. See L<Encode::MIME::Header> for details. + +=head2 How can I tell whether my encoding fully supports PerlIO ? + +As of this writing, any encoding whose class belongs to Encode::XS and +Encode::Unicode works. The Encode module has a C<perlio_ok> method +which you can use before applying PerlIO encoding to the filehandle. +Here is an example: + + my $use_perlio = perlio_ok($enc); + my $layer = $use_perlio ? "<:raw" : "<:encoding($enc)"; + open my $fh, $layer, $file or die "$file : $!"; + while(<$fh>){ + $_ = decode($enc, $_) unless $use_perlio; + # .... + } + +=head1 SEE ALSO + +L<Encode::Encoding>, +L<Encode::Supported>, +L<Encode::PerlIO>, +L<encoding>, +L<perlebcdic>, +L<perlfunc/open>, +L<perlunicode>, +L<utf8>, +the Perl Unicode Mailing List E<lt>perl-unicode@perl.orgE<gt> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/README.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/README.e2x new file mode 100644 index 0000000000000000000000000000000000000000..28a31a655c220973cc3fff33871214b664d084ce --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/README.e2x @@ -0,0 +1,31 @@ +Encode::$_Name_ version 0.1 +======== + +NAME + Encode::$_Name_ - <describe encoding> + +SYNOPSIS + use Encode::$_Name_; + #<put more words here> +ABSTRACT + <fill this in> +INSTALLATION + +To install this module type the following: + + perl Makefile.PL + make + make test + make install + +DEPENDENCIES + +This module requires perl version 5.7.3 or later. + +COPYRIGHT AND LICENCE + +Copyright (C) 2002 Your Name <your@address.domain> + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/Supported.pod b/data/miniconda3/lib/perl5/core_perl/Encode/Supported.pod new file mode 100644 index 0000000000000000000000000000000000000000..b23f6ca83ecb2aa552c6e79e10f61f3028d8790b --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/Supported.pod @@ -0,0 +1,901 @@ +=head1 NAME + +Encode::Supported -- Encodings supported by Encode + +=head1 DESCRIPTION + +=head2 Encoding Names + +Encoding names are case insensitive. White space in names +is ignored. In addition, an encoding may have aliases. +Each encoding has one "canonical" name. The "canonical" +name is chosen from the names of the encoding by picking +the first in the following sequence (with a few exceptions). + +=over 2 + +=item * + +The name used by the Perl community. That includes 'utf8' and 'ascii'. +Unlike aliases, canonical names directly reach the method so such +frequently used words like 'utf8' don't need to do alias lookups. + +=item * + +The MIME name as defined in IETF RFCs. This includes all "iso-"s. + +=item * + +The name in the IANA registry. + +=item * + +The name used by the organization that defined it. + +=back + +In case I<de jure> canonical names differ from that of the Encode +module, they are always aliased if it ever be implemented. So you can +safely tell if a given encoding is implemented or not just by passing +the canonical name. + +Because of all the alias issues, and because in the general case +encodings have state, "Encode" uses an encoding object internally +once an operation is in progress. + +=head1 Supported Encodings + +As of Perl 5.8.0, at least the following encodings are recognized. +Note that unless otherwise specified, they are all case insensitive +(via alias) and all occurrence of spaces are replaced with '-'. +In other words, "ISO 8859 1" and "iso-8859-1" are identical. + +Encodings are categorized and implemented in several different modules +but you don't have to C<use Encode::XX> to make them available for +most cases. Encode.pm will automatically load those modules on demand. + +=head2 Built-in Encodings + +The following encodings are always available. + + Canonical Aliases Comments & References + ---------------------------------------------------------------- + ascii US-ascii ISO-646-US [ECMA] + ascii-ctrl Special Encoding + iso-8859-1 latin1 [ISO] + null Special Encoding + utf8 UTF-8 [RFC2279] + ---------------------------------------------------------------- + +I<null> and I<ascii-ctrl> are special. "null" fails for all character +so when you set fallback mode to PERLQQ, HTMLCREF or XMLCREF, ALL +CHARACTERS will fall back to character references. Ditto for +"ascii-ctrl" except for control characters. For fallback modes, see +L<Encode>. + +=head2 Encode::Unicode -- other Unicode encodings + +Unicode coding schemes other than native utf8 are supported by +Encode::Unicode, which will be autoloaded on demand. + + ---------------------------------------------------------------- + UCS-2BE UCS-2, iso-10646-1 [IANA, UC] + UCS-2LE [UC] + UTF-16 [UC] + UTF-16BE [UC] + UTF-16LE [UC] + UTF-32 [UC] + UTF-32BE UCS-4 [UC] + UTF-32LE [UC] + UTF-7 [RFC2152] + ---------------------------------------------------------------- + +To find how (UCS-2|UTF-(16|32))(LE|BE)? differ from one another, +see L<Encode::Unicode>. + +UTF-7 is a special encoding which "re-encodes" UTF-16BE into a 7-bit +encoding. It is implemented separately by Encode::Unicode::UTF7. + +=head2 Encode::Byte -- Extended ASCII + +Encode::Byte implements most single-byte encodings except for +Symbols and EBCDIC. The following encodings are based on single-byte +encodings implemented as extended ASCII. Most of them map +\x80-\xff (upper half) to non-ASCII characters. + +=over 2 + +=item ISO-8859 and corresponding vendor mappings + +Since there are so many, they are presented in table format with +languages and corresponding encoding names by vendors. Note that +the table is sorted in order of ISO-8859 and the corresponding vendor +mappings are slightly different from that of ISO. See +L<http://czyborra.com/charsets/iso8859.html> for details. + + Lang/Regions ISO/Other Std. DOS Windows Macintosh Others + ---------------------------------------------------------------- + N. America (ASCII) cp437 AdobeStandardEncoding + cp863 (DOSCanadaF) + W. Europe iso-8859-1 cp850 cp1252 MacRoman nextstep + hp-roman8 + cp860 (DOSPortuguese) + Cntrl. Europe iso-8859-2 cp852 cp1250 MacCentralEurRoman + MacCroatian + MacRomanian + MacRumanian + Latin3[1] iso-8859-3 + Latin4[2] iso-8859-4 + Cyrillics iso-8859-5 cp855 cp1251 MacCyrillic + (See also next section) cp866 MacUkrainian + Arabic iso-8859-6 cp864 cp1256 MacArabic + cp1006 MacFarsi + Greek iso-8859-7 cp737 cp1253 MacGreek + cp869 (DOSGreek2) + Hebrew iso-8859-8 cp862 cp1255 MacHebrew + Turkish iso-8859-9 cp857 cp1254 MacTurkish + Nordics iso-8859-10 cp865 + cp861 MacIcelandic + MacSami + Thai iso-8859-11[3] cp874 MacThai + (iso-8859-12 is nonexistent. Reserved for Indics?) + Baltics iso-8859-13 cp775 cp1257 + Celtics iso-8859-14 + Latin9 [4] iso-8859-15 + Latin10 iso-8859-16 + Vietnamese viscii cp1258 MacVietnamese + ---------------------------------------------------------------- + + [1] Esperanto, Maltese, and Turkish. Turkish is now on 8859-9. + [2] Baltics. Now on 8859-10, except for Latvian. + [3] TIS 620 + Non-Breaking Space (0xA0 / U+00A0) + [4] Nicknamed Latin0; the Euro sign as well as French and Finnish + letters that are missing from 8859-1 were added. + +All cp* are also available as ibm-*, ms-*, and windows-* . See also +L<http://czyborra.com/charsets/codepages.html>. + +Macintosh encodings don't seem to be registered in such entities as +IANA. "Canonical" names in Encode are based upon Apple's Tech Note +1150. See L<http://developer.apple.com/technotes/tn/tn1150.html> +for details. + +=item KOI8 - De Facto Standard for the Cyrillic world + +Though ISO-8859 does have ISO-8859-5, the KOI8 series is far more +popular in the Net. L<Encode> comes with the following KOI charsets. +For gory details, see L<http://czyborra.com/charsets/cyrillic.html> + + ---------------------------------------------------------------- + koi8-f + koi8-r cp878 [RFC1489] + koi8-u [RFC2319] + ---------------------------------------------------------------- + +=back + +=head2 gsm0338 - Hentai Latin 1 + +GSM0338 is for GSM handsets. Though it shares alphanumerals with +ASCII, control character ranges and other parts are mapped very +differently, mainly to store Greek characters. There are also escape +sequences (starting with 0x1B) to cover e.g. the Euro sign. + +This was once handled by L<Encode::Bytes> but because of all those +unusual specifications, Encode 2.20 has relocated the support to +L<Encode::GSM0338>. See L<Encode::GSM0338> for details. + +=over 2 + +=item gsm0338 support before 2.19 + +Some special cases like a trailing 0x00 byte or a lone 0x1B byte are not +well-defined and decode() will return an empty string for them. +One possible workaround is + + $gsm =~ s/\x00\z/\x00\x00/; + $uni = decode("gsm0338", $gsm); + $uni .= "\xA0" if $gsm =~ /\x1B\z/; + +Note that the Encode implementation of GSM0338 does not implement the +reuse of Latin capital letters as Greek capital letters (for example, +the 0x5A is U+005A (LATIN CAPITAL LETTER Z), not U+0396 (GREEK CAPITAL +LETTER ZETA). + +The GSM0338 is also covered in Encode::Byte even though it is not +an "extended ASCII" encoding. + +=back + +=head2 CJK: Chinese, Japanese, Korean (Multibyte) + +Note that Vietnamese is listed above. Also read "Encoding vs Charset" +below. Also note that these are implemented in distinct modules by +countries, due to the size concerns (simplified Chinese is mapped +to 'CN', continental China, while traditional Chinese is mapped to +'TW', Taiwan). Please refer to their respective documentation pages. + +=over 2 + +=item Encode::CN -- Continental China + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + euc-cn [1] MacChineseSimp + (gbk) cp936 [2] + gb12345-raw { GB12345 without CES } + gb2312-raw { GB2312 without CES } + hz + iso-ir-165 + ---------------------------------------------------------------- + + [1] GB2312 is aliased to this. See L<Microsoft-related naming mess> + [2] gbk is aliased to this. See L<Microsoft-related naming mess> + +=item Encode::JP -- Japan + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + euc-jp + shiftjis cp932 macJapanese + 7bit-jis + iso-2022-jp [RFC1468] + iso-2022-jp-1 [RFC2237] + jis0201-raw { JIS X 0201 (roman + halfwidth kana) without CES } + jis0208-raw { JIS X 0208 (Kanji + fullwidth kana) without CES } + jis0212-raw { JIS X 0212 (Extended Kanji) without CES } + ---------------------------------------------------------------- + +=item Encode::KR -- Korea + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + euc-kr MacKorean [RFC1557] + cp949 [1] + iso-2022-kr [RFC1557] + johab [KS X 1001:1998, Annex 3] + ksc5601-raw { KSC5601 without CES } + ---------------------------------------------------------------- + + [1] ks_c_5601-1987, (x-)?windows-949, and uhc are aliased to this. + See below. + +=item Encode::TW -- Taiwan + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + big5-eten cp950 MacChineseTrad {big5 aliased to big5-eten} + big5-hkscs + ---------------------------------------------------------------- + +=item Encode::HanExtra -- More Chinese via CPAN + +Due to the size concerns, additional Chinese encodings below are +distributed separately on CPAN, under the name Encode::HanExtra. + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + big5ext CMEX's Big5e Extension + big5plus CMEX's Big5+ Extension + cccii Chinese Character Code for Information Interchange + euc-tw EUC (Extended Unix Character) + gb18030 GBK with Traditional Characters + ---------------------------------------------------------------- + +=item Encode::JIS2K -- JIS X 0213 encodings via CPAN + +Due to size concerns, additional Japanese encodings below are +distributed separately on CPAN, under the name Encode::JIS2K. + + Standard DOS/Win Macintosh Comment/Reference + ---------------------------------------------------------------- + euc-jisx0213 + shiftjisx0123 + iso-2022-jp-3 + jis0213-1-raw + jis0213-2-raw + ---------------------------------------------------------------- + +=back + +=head2 Miscellaneous encodings + +=over 2 + +=item Encode::EBCDIC + +See L<perlebcdic> for details. + + ---------------------------------------------------------------- + cp37 + cp500 + cp875 + cp1026 + cp1047 + posix-bc + ---------------------------------------------------------------- + +=item Encode::Symbols + +For symbols and dingbats. + + ---------------------------------------------------------------- + symbol + dingbats + MacDingbats + AdobeZdingbat + AdobeSymbol + ---------------------------------------------------------------- + +=item Encode::MIME::Header + +Strictly speaking, MIME header encoding documented in RFC 2047 is more +of encapsulation than encoding. However, their support in modern +world is imperative so they are supported. + + ---------------------------------------------------------------- + MIME-Header [RFC2047] + MIME-B [RFC2047] + MIME-Q [RFC2047] + ---------------------------------------------------------------- + +=item Encode::Guess + +This one is not a name of encoding but a utility that lets you pick up +the most appropriate encoding for a data out of given I<suspects>. See +L<Encode::Guess> for details. + +=back + +=head1 Unsupported encodings + +The following encodings are not supported as yet; some because they +are rarely used, some because of technical difficulties. They may +be supported by external modules via CPAN in the future, however. + +=over 2 + +=item ISO-2022-JP-2 [RFC1554] + +Not very popular yet. Needs Unicode Database or equivalent to +implement encode() (because it includes JIS X 0208/0212, KSC5601, and +GB2312 simultaneously, whose code points in Unicode overlap. So you +need to lookup the database to determine to what character set a given +Unicode character should belong). + +=item ISO-2022-CN [RFC1922] + +Not very popular. Needs CNS 11643-1 and -2 which are not available in +this module. CNS 11643 is supported (via euc-tw) in Encode::HanExtra. +Audrey Tang may add support for this encoding in her module in future. + +=item Various HP-UX encodings + +The following are unsupported due to the lack of mapping data. + + '8' - arabic8, greek8, hebrew8, kana8, thai8, and turkish8 + '15' - japanese15, korean15, and roi15 + +=item Cyrillic encoding ISO-IR-111 + +Anton Tagunov doubts its usefulness. + +=item ISO-8859-8-1 [Hebrew] + +None of the Encode team knows Hebrew enough (ISO-8859-8, cp1255 and +MacHebrew are supported because and just because there were mappings +available at L<http://www.unicode.org/>). Contributions welcome. + +=item ISIRI 3342, Iran System, ISIRI 2900 [Farsi] + +Ditto. + +=item Thai encoding TCVN + +Ditto. + +=item Vietnamese encodings VPS + +Though Jungshik Shin has reported that Mozilla supports this encoding, +it was too late before 5.8.0 for us to add it. In the future, it +may be available via a separate module. See +L<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.uf> +and +L<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.ut> +if you are interested in helping us. + +=item Various Mac encodings + +The following are unsupported due to the lack of mapping data. + + MacArmenian, MacBengali, MacBurmese, MacEthiopic + MacExtArabic, MacGeorgian, MacKannada, MacKhmer + MacLaotian, MacMalayalam, MacMongolian, MacOriya + MacSinhalese, MacTamil, MacTelugu, MacTibetan + MacVietnamese + +The rest which are already available are based upon the vendor mappings +at L<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/> . + +=item (Mac) Indic encodings + +The maps for the following are available at L<http://www.unicode.org/> +but remain unsupported because those encodings need an algorithmical +approach, currently unsupported by F<enc2xs>: + + MacDevanagari + MacGurmukhi + MacGujarati + +For details, please see C<Unicode mapping issues and notes:> at +L<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/DEVANAGA.TXT> . + +I believe this issue is prevalent not only for Mac Indics but also in +other Indic encodings, but the above were the only Indic encodings +maps that I could find at L<http://www.unicode.org/> . + +=back + +=head1 Encoding vs. Charset -- terminology + +We are used to using the term (character) I<encoding> and I<character +set> interchangeably. But just as confusing the terms byte and +character is dangerous and the terms should be differentiated when +needed, we need to differentiate I<encoding> and I<character set>. + +To understand that, here is a description of how we make computers +grok our characters. + +=over 2 + +=item * + +First we start with which characters to include. We call this +collection of characters I<character repertoire>. + +=item * + +Then we have to give each character a unique ID so your computer can +tell the difference between 'a' and 'A'. This itemized character +repertoire is now a I<character set>. + +=item * + +If your computer can grow the character set without further +processing, you can go ahead and use it. This is called a I<coded +character set> (CCS) or I<raw character encoding>. ASCII is used this +way for most cases. + +=item * + +But in many cases, especially multi-byte CJK encodings, you have to +tweak a little more. Your network connection may not accept any data +with the Most Significant Bit set, and your computer may not be able to +tell if a given byte is a whole character or just half of it. So you +have to I<encode> the character set to use it. + +A I<character encoding scheme> (CES) determines how to encode a given +character set, or a set of multiple character sets. 7bit ISO-2022 is +an example of a CES. You switch between character sets via I<escape +sequences>. + +=back + +Technically, or mathematically, speaking, a character set encoded in +such a CES that maps character by character may form a CCS. EUC is such +an example. The CES of EUC is as follows: + +=over 2 + +=item * + +Map ASCII unchanged. + +=item * + +Map such a character set that consists of 94 or 96 powered by N +members by adding 0x80 to each byte. + +=item * + +You can also use 0x8e and 0x8f to indicate that the following sequence of +characters belongs to yet another character set. To each following byte +is added the value 0x80. + +=back + +By carefully looking at the encoded byte sequence, you can find that the +byte sequence conforms a unique number. In that sense, EUC is a CCS +generated by a CES above from up to four CCS (complicated?). UTF-8 +falls into this category. See L<perlUnicode/"UTF-8"> to find out how +UTF-8 maps Unicode to a byte sequence. + +You may also have found out by now why 7bit ISO-2022 cannot comprise +a CCS. If you look at a byte sequence \x21\x21, you can't tell if +it is two !'s or IDEOGRAPHIC SPACE. EUC maps the latter to \xA1\xA1 +so you have no trouble differentiating between "!!". and S<" ">. + +=head1 Encoding Classification (by Anton Tagunov and Dan Kogai) + +This section tries to classify the supported encodings by their +applicability for information exchange over the Internet and to +choose the most suitable aliases to name them in the context of +such communication. + +=over 2 + +=item * + +To (en|de)code encodings marked by C<(**)>, you need +C<Encode::HanExtra>, available from CPAN. + +=back + +Encoding names + + US-ASCII UTF-8 ISO-8859-* KOI8-R + Shift_JIS EUC-JP ISO-2022-JP ISO-2022-JP-1 + EUC-KR Big5 GB2312 + +are registered with IANA as preferred MIME names and may +be used over the Internet. + +C<Shift_JIS> has been officialized by JIS X 0208:1997. +L<Microsoft-related naming mess> gives details. + +C<GB2312> is the IANA name for C<EUC-CN>. +See L<Microsoft-related naming mess> for details. + +C<GB_2312-80> I<raw> encoding is available as C<gb2312-raw> +with Encode. See L<Encode::CN> for details. + + EUC-CN + KOI8-U [RFC2319] + +have not been registered with IANA (as of March 2002) but +seem to be supported by major web browsers. +The IANA name for C<EUC-CN> is C<GB2312>. + + KS_C_5601-1987 + +is heavily misused. +See L<Microsoft-related naming mess> for details. + +C<KS_C_5601-1987> I<raw> encoding is available as C<kcs5601-raw> +with Encode. See L<Encode::KR> for details. + + UTF-16 UTF-16BE UTF-16LE + +are IANA-registered C<charset>s. See [RFC 2781] for details. +Jungshik Shin reports that UTF-16 with a BOM is well accepted +by MS IE 5/6 and NS 4/6. Beware however that + +=over 2 + +=item * + +C<UTF-16> support in any software you're going to be +using/interoperating with has probably been less tested +then C<UTF-8> support + +=item * + +C<UTF-8> coded data seamlessly passes traditional +command piping (C<cat>, C<more>, etc.) while C<UTF-16> coded +data is likely to cause confusion (with its zero bytes, +for example) + +=item * + +it is beyond the power of words to describe the way HTML browsers +encode non-C<ASCII> form data. To get a general impression, visit +L<http://www.alanflavell.org.uk/charset/form-i18n.html>. +While encoding of form data has stabilized for C<UTF-8> encoded pages +(at least IE 5/6, NS 6, and Opera 6 behave consistently), be sure to +expect fun (and cross-browser discrepancies) with C<UTF-16> encoded +pages! + +=back + +The rule of thumb is to use C<UTF-8> unless you know what +you're doing and unless you really benefit from using C<UTF-16>. + + ISO-IR-165 [RFC1345] + VISCII + GB 12345 + GB 18030 (**) (see links below) + EUC-TW (**) + +are totally valid encodings but not registered at IANA. +The names under which they are listed here are probably the +most widely-known names for these encodings and are recommended +names. + + BIG5PLUS (**) + +is a proprietary name. + +=head2 Microsoft-related naming mess + +Microsoft products misuse the following names: + +=over 2 + +=item KS_C_5601-1987 + +Microsoft extension to C<EUC-KR>. + +Proper names: C<CP949>, C<UHC>, C<x-windows-949> (as used by Mozilla). + +See L<http://lists.w3.org/Archives/Public/ietf-charsets/2001AprJun/0033.html> +for details. + +Encode aliases C<KS_C_5601-1987> to C<cp949> to reflect this common +misusage. I<Raw> C<KS_C_5601-1987> encoding is available as +C<kcs5601-raw>. + +See L<Encode::KR> for details. + +=item GB2312 + +Microsoft extension to C<EUC-CN>. + +Proper names: C<CP936>, C<GBK>. + +C<GB2312> has been registered in the C<EUC-CN> meaning at +IANA. This has partially repaired the situation: Microsoft's +C<GB2312> has become a superset of the official C<GB2312>. + +Encode aliases C<GB2312> to C<euc-cn> in full agreement with +IANA registration. C<cp936> is supported separately. +I<Raw> C<GB_2312-80> encoding is available as C<gb2312-raw>. + +See L<Encode::CN> for details. + +=item Big5 + +Microsoft extension to C<Big5>. + +Proper name: C<CP950>. + +Encode separately supports C<Big5> and C<cp950>. + +=item Shift_JIS + +Microsoft's understanding of C<Shift_JIS>. + +JIS has not endorsed the full Microsoft standard however. +The official C<Shift_JIS> includes only JIS X 0201 and JIS X 0208 +character sets, while Microsoft has always used C<Shift_JIS> +to encode a wider character repertoire. See C<IANA> registration for +C<Windows-31J>. + +As a historical predecessor, Microsoft's variant +probably has more rights for the name, though it may be objected +that Microsoft shouldn't have used JIS as part of the name +in the first place. + +Unambiguous name: C<CP932>. C<IANA> name (also used by Mozilla, and +provided as an alias by Encode): C<Windows-31J>. + +Encode separately supports C<Shift_JIS> and C<cp932>. + +=back + +=head1 Glossary + +=over 2 + +=item character repertoire + +A collection of unique characters. A I<character> set in the strictest +sense. At this stage, characters are not numbered. + +=item coded character set (CCS) + +A character set that is mapped in a way computers can use directly. +Many character encodings, including EUC, fall in this category. + +=item character encoding scheme (CES) + +An algorithm to map a character set to a byte sequence. You don't +have to be able to tell which character set a given byte sequence +belongs. 7-bit ISO-2022 is a CES but it cannot be a CCS. EUC is an +example of being both a CCS and CES. + +=item charset (in MIME context) + +has long been used in the meaning of C<encoding>, CES. + +While the word combination C<character set> has lost this meaning +in MIME context since [RFC 2130], the C<charset> abbreviation has +retained it. This is how [RFC 2277] and [RFC 2278] bless C<charset>: + + This document uses the term "charset" to mean a set of rules for + mapping from a sequence of octets to a sequence of characters, such + as the combination of a coded character set and a character encoding + scheme; this is also what is used as an identifier in MIME "charset=" + parameters, and registered in the IANA charset registry ... (Note + that this is NOT a term used by other standards bodies, such as ISO). + [RFC 2277] + +=item EUC + +Extended Unix Character. See ISO-2022. + +=item ISO-2022 + +A CES that was carefully designed to coexist with ASCII. There are a 7 +bit version and an 8 bit version. + +The 7 bit version switches character set via escape sequence so it +cannot form a CCS. Since this is more difficult to handle in programs +than the 8 bit version, the 7 bit version is not very popular except for +iso-2022-jp, the I<de facto> standard CES for e-mails. + +The 8 bit version can form a CCS. EUC and ISO-8859 are two examples +thereof. Pre-5.6 perl could use them as string literals. + +=item UCS + +Short for I<Universal Character Set>. When you say just UCS, it means +I<Unicode>. + +=item UCS-2 + +ISO/IEC 10646 encoding form: Universal Character Set coded in two +octets. + +=item Unicode + +A character set that aims to include all character repertoires of the +world. Many character sets in various national as well as industrial +standards have become, in a way, just subsets of Unicode. + +=item UTF + +Short for I<Unicode Transformation Format>. Determines how to map a +Unicode character into a byte sequence. + +=item UTF-16 + +A UTF in 16-bit encoding. Can either be in big endian or little +endian. The big endian version is called UTF-16BE (equal to UCS-2 + +surrogate support) and the little endian version is called UTF-16LE. + +=back + +=head1 See Also + +L<Encode>, +L<Encode::Byte>, +L<Encode::CN>, L<Encode::JP>, L<Encode::KR>, L<Encode::TW>, +L<Encode::EBCDIC>, L<Encode::Symbol> +L<Encode::MIME::Header>, L<Encode::Guess> + +=head1 References + +=over 2 + +=item ECMA + +European Computer Manufacturers Association +L<http://www.ecma.ch> + +=over 2 + +=item ECMA-035 (eq C<ISO-2022>) + +L<http://www.ecma.ch/ecma1/STAND/ECMA-035.HTM> + +The specification of ISO-2022 is available from the link above. + +=back + +=item IANA + +Internet Assigned Numbers Authority +L<http://www.iana.org/> + +=over 2 + +=item Assigned Charset Names by IANA + +L<http://www.iana.org/assignments/character-sets> + +Most of the C<canonical names> in Encode derive from this list +so you can directly apply the string you have extracted from MIME +header of mails and web pages. + +=back + +=item ISO + +International Organization for Standardization +L<http://www.iso.ch/> + +=item RFC + +Request For Comments -- need I say more? +L<http://www.rfc-editor.org/>, L<http://www.ietf.org/rfc.html>, +L<http://www.faqs.org/rfcs/> + +=item UC + +Unicode Consortium +L<http://www.unicode.org/> + +=over 2 + +=item Unicode Glossary + +L<http://www.unicode.org/glossary/> + +The glossary of this document is based upon this site. + +=back + +=back + +=head2 Other Notable Sites + +=over 2 + +=item czyborra.com + +L<http://czyborra.com/> + +Contains a lot of useful information, especially gory details of ISO +vs. vendor mappings. + +=item CJK.inf + +L<http://examples.oreilly.com/cjkvinfo/doc/cjk.inf> + +Somewhat obsolete (last update in 1996), but still useful. Also try + +L<ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/pdf/GB18030_Summary.pdf> + +You will find brief info on C<EUC-CN>, C<GBK> and mostly on C<GB 18030>. + +=item Jungshik Shin's Hangul FAQ + +L<http://jshin.net/faq> + +And especially its subject 8. + +L<http://jshin.net/faq/qa8.html> + +A comprehensive overview of the Korean (C<KS *>) standards. + +=item debian.org: "Introduction to i18n" + +A brief description for most of the mentioned CJK encodings is +contained in +L<http://www.debian.org/doc/manuals/intro-i18n/ch-codes.en.html> + +=back + +=head2 Offline sources + +=over 2 + +=item C<CJKV Information Processing> by Ken Lunde + +CJKV Information Processing +1999 O'Reilly & Associates, ISBN : 1-56592-224-7 + +The modern successor of C<CJK.inf>. + +Features a comprehensive coverage of CJKV character sets and +encodings along with many other issues faced by anyone trying +to better support CJKV languages/scripts in all the areas of +information processing. + +To purchase this book, visit +L<http://oreilly.com/catalog/9780596514471/> +or your favourite bookstore. + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/_PM.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/_PM.e2x new file mode 100644 index 0000000000000000000000000000000000000000..eb59cd1b520323bddb2f11d65d26b757d5e91c94 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/_PM.e2x @@ -0,0 +1,23 @@ +package Encode::$_Name_; +our $VERSION = "0.01"; + +use Encode; +use XSLoader; +XSLoader::load(__PACKAGE__,$VERSION); + +1; +__END__ + +=head1 NAME + +Encode::$_Name_ - New Encoding + +=head1 SYNOPSIS + +You got to fill this in! + +=head1 SEE ALSO + +L<Encode> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/_T.e2x b/data/miniconda3/lib/perl5/core_perl/Encode/_T.e2x new file mode 100644 index 0000000000000000000000000000000000000000..7b9a67e43d74454c1f8f9f607fd460a8e2047ee0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/_T.e2x @@ -0,0 +1,9 @@ +use strict; +# Adjust the number here! +use Test::More tests => 2; + +BEGIN { + use_ok('Encode'); + use_ok('Encode::$_Name_'); +} +# Add more test here! diff --git a/data/miniconda3/lib/perl5/core_perl/Encode/encode.h b/data/miniconda3/lib/perl5/core_perl/Encode/encode.h new file mode 100644 index 0000000000000000000000000000000000000000..ba884d42d1a6c63d173d504de998d02bf509601d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Encode/encode.h @@ -0,0 +1,1358 @@ +#ifndef ENCODE_H +#define ENCODE_H + +#ifndef H_PERL +/* check whether we're "in perl" so that we can do data parts without + getting extern references to the code parts +*/ +typedef unsigned char U8; +#endif + +typedef struct encpage_s encpage_t; + +struct encpage_s +{ + /* fields ordered to pack nicely on 32-bit machines */ + const U8 *const seq; /* Packed output sequences we generate + if we match */ + const encpage_t *const next; /* Page to go to if we match */ + const U8 min; /* Min value of octet to match this entry */ + const U8 max; /* Max value of octet to match this entry */ + const U8 dlen; /* destination length - + size of entries in seq */ + const U8 slen; /* source length - + number of source octets needed */ +}; + +/* + At any point in a translation there is a page pointer which points + at an array of the above structures. + + Basic operation : + get octet from source stream. + if (octet >= min && octet < max) { + if slen is 0 then we cannot represent this character. + if we have less than slen octets (including this one) then + we have a partial character. + otherwise + copy dlen octets from seq + dlen*(octet-min) to output + (dlen may be zero if we don't know yet.) + load page pointer with next to continue. + (is slen is one this is end of a character) + get next octet. + } + else { + increment the page pointer to look at next slot in the array + } + + arrays SHALL be constructed so there is an entry which matches + ..0xFF at the end, and either maps it or indicates no + representation. + + if MSB of slen is set then mapping is an approximate "FALLBACK" entry. + +*/ + + +typedef struct encode_s encode_t; +struct encode_s +{ + const encpage_t *const t_utf8; /* Starting table for translation from + the encoding to UTF-8 form */ + const encpage_t *const f_utf8; /* Starting table for translation + from UTF-8 to the encoding */ + const U8 *const rep; /* Replacement character in this + encoding e.g. "?" */ + int replen; /* Number of octets in rep */ + U8 min_el; /* Minimum octets to represent a + character */ + U8 max_el; /* Maximum octets to represent a + character */ + const char *const name[2]; /* name(s) of this encoding */ +}; + +#ifdef H_PERL +/* See comment at top of file for deviousness */ + +extern int do_encode(const encpage_t *enc, const U8 *src, STRLEN *slen, + U8 *dst, STRLEN dlen, STRLEN *dout, int approx, + const U8 *term, STRLEN tlen); + +extern void Encode_DefineEncoding(encode_t *enc); + +#endif /* H_PERL */ + +#define ENCODE_NOSPACE 1 +#define ENCODE_PARTIAL 2 +#define ENCODE_NOREP 3 +#define ENCODE_FALLBACK 4 +#define ENCODE_FOUND_TERM 5 + +/* Use the perl core value if available; it is portable to EBCDIC */ +#ifdef REPLACEMENT_CHARACTER_UTF8 +# define FBCHAR_UTF8 REPLACEMENT_CHARACTER_UTF8 +#else +# define FBCHAR_UTF8 "\xEF\xBF\xBD" +#endif + +#define ENCODE_DIE_ON_ERR 0x0001 /* croaks immediately */ +#define ENCODE_WARN_ON_ERR 0x0002 /* warn on error; may proceed */ +#define ENCODE_RETURN_ON_ERR 0x0004 /* immediately returns on NOREP */ +#define ENCODE_LEAVE_SRC 0x0008 /* $src updated unless set */ +#define ENCODE_ONLY_PRAGMA_WARNINGS 0x0010 /* when enabled report only warnings configured by pragma warnings, otherwise report all warnings; no effect without ENCODE_WARN_ON_ERR */ +#define ENCODE_PERLQQ 0x0100 /* perlqq fallback string */ +#define ENCODE_HTMLCREF 0x0200 /* HTML character ref. fb mode */ +#define ENCODE_XMLCREF 0x0400 /* XML character ref. fb mode */ +#define ENCODE_STOP_AT_PARTIAL 0x0800 /* stop at partial explicitly */ + +#define ENCODE_FB_DEFAULT 0x0000 +#define ENCODE_FB_CROAK 0x0001 +#define ENCODE_FB_QUIET ENCODE_RETURN_ON_ERR +#define ENCODE_FB_WARN (ENCODE_RETURN_ON_ERR|ENCODE_WARN_ON_ERR) +#define ENCODE_FB_PERLQQ (ENCODE_PERLQQ|ENCODE_LEAVE_SRC) +#define ENCODE_FB_HTMLCREF (ENCODE_HTMLCREF|ENCODE_LEAVE_SRC) +#define ENCODE_FB_XMLCREF (ENCODE_XMLCREF|ENCODE_LEAVE_SRC) + +#define encode_ckWARN(c, w) ((c & ENCODE_WARN_ON_ERR) \ + && (!(c & ENCODE_ONLY_PRAGMA_WARNINGS) || ckWARN(w))) + +#ifdef UTF8SKIP +# ifdef EBCDIC /* The value on early perls is wrong */ +# undef UTF8_MAXBYTES +# define UTF8_MAXBYTES 14 +# endif +# ifndef UNLIKELY +# define UNLIKELY(x) (x) +# endif +# ifndef LIKELY +# define LIKELY(x) (x) +# endif + +/* EBCDIC requires a later perl to work, so the next two definitions are for + * ASCII machines only */ +# ifndef NATIVE_UTF8_TO_I8 +# define NATIVE_UTF8_TO_I8(x) (x) +# endif +# ifndef I8_TO_NATIVE_UTF8 +# define I8_TO_NATIVE_UTF8(x) (x) +# endif +# ifndef OFFUNISKIP +# define OFFUNISKIP(x) UNISKIP(x) +# endif +# ifndef uvoffuni_to_utf8_flags +# define uvoffuni_to_utf8_flags(a,b,c) uvuni_to_utf8_flags(a,b,c) +# endif +# ifndef WARN_SURROGATE /* Use the overarching category if these + subcategories are missing */ +# define WARN_SURROGATE WARN_UTF8 +# define WARN_NONCHAR WARN_UTF8 +# define WARN_NON_UNICODE WARN_UTF8 + /* If there's only one possible category, then packing is a no-op */ +# define encode_ckWARN_packed(c, w) encode_ckWARN(c, w) +# else +# define encode_ckWARN_packed(c, w) \ + ((c & ENCODE_WARN_ON_ERR) \ + && (!(c & ENCODE_ONLY_PRAGMA_WARNINGS) || Perl_ckwarn(aTHX_ w))) +# endif + +/* All these formats take a single UV code point argument */ +static const char surrogate_cp_format[] = "UTF-16 surrogate U+%04" UVXf; +static const char nonchar_cp_format[] = "Unicode non-character U+%04" UVXf + " is not recommended for open interchange"; +static const char super_cp_format[] = "Code point 0x%" UVXf " is not Unicode," + " may not be portable"; + +/* If the perl doesn't have the 5.28 functions, this file includes + * stripped-down versions of them but containing enough functionality to be + * suitable for Encode's needs. Many of the comments have been removed. But + * you can inspect the 5.28 source if you get stuck. + * + * These could be put in Devel::PPPort, but Encode is likely the only user */ + +#if (defined(IN_ENCODE_XS) || defined(IN_UNICODE_XS)) \ + && (! defined(utf8n_to_uvchr_msgs) && ! defined(uvchr_to_utf8_flags_msgs)) + +# ifndef hv_stores +# define hv_stores(hv, key, val) hv_store((hv), ("" key ""), (sizeof(key)-1), (val), 0) +# endif + +static HV * +S_new_msg_hv(const char * const message, /* The message text */ + U32 categories) /* Packed warning categories */ +{ + /* Creates, populates, and returns an HV* that describes an error message + * for the translators between UTF8 and code point */ + + dTHX; + SV* msg_sv = newSVpv(message, 0); + SV* category_sv = newSVuv(categories); + + HV* msg_hv = newHV(); + + (void) hv_stores(msg_hv, "text", msg_sv); + (void) hv_stores(msg_hv, "warn_categories", category_sv); + + return msg_hv; +} + +#endif + +#if ! defined(utf8n_to_uvchr_msgs) \ + && (defined(IN_ENCODE_XS) || defined(IN_UNICODE_XS)) + +# undef utf8n_to_uvchr /* Don't use an earlier version: use the version + defined in this file */ +# define utf8n_to_uvchr(a,b,c,d) utf8n_to_uvchr_msgs(a, b, c, d, 0, NULL) + +# undef UTF8_IS_START /* Early perls wrongly accepted C0 and C1 */ +# define UTF8_IS_START(c) (((U8)(c)) >= 0xc2) +# ifndef isUTF8_POSSIBLY_PROBLEMATIC +# ifdef EBCDIC +# define isUTF8_POSSIBLY_PROBLEMATIC(c) ((U8) c > ' ') +# else +# define isUTF8_POSSIBLY_PROBLEMATIC(c) ((U8) c >= 0xED) +# endif +# endif +# ifndef UTF8_ALLOW_OVERFLOW +# define UTF8_ALLOW_OVERFLOW (1U<<31) /* Choose highest bit to avoid + potential conflicts */ +# define UTF8_GOT_OVERFLOW UTF8_ALLOW_OVERFLOW +# endif +# undef UTF8_ALLOW_ANY /* Early perl definitions don't work properly with + the code in this file */ +# define UTF8_ALLOW_ANY ( UTF8_ALLOW_CONTINUATION \ + |UTF8_ALLOW_NON_CONTINUATION \ + |UTF8_ALLOW_SHORT \ + |UTF8_ALLOW_LONG \ + |UTF8_ALLOW_OVERFLOW) + +/* The meanings of these were complemented at some point, but the functions + * bundled in this file use the complemented meanings */ +# ifndef UTF8_DISALLOW_SURROGATE +# define UTF8_DISALLOW_SURROGATE UTF8_ALLOW_SURROGATE +# define UTF8_DISALLOW_NONCHAR UTF8_ALLOW_FFFF +# define UTF8_DISALLOW_SUPER UTF8_ALLOW_FE_FF + + /* In the stripped-down implementation in this file, disallowing is not + * independent of warning */ +# define UTF8_WARN_SURROGATE UTF8_DISALLOW_SURROGATE +# define UTF8_WARN_NONCHAR UTF8_DISALLOW_NONCHAR +# define UTF8_WARN_SUPER UTF8_DISALLOW_SUPER +# endif +# ifndef UTF8_DISALLOW_ILLEGAL_INTERCHANGE +# define UTF8_DISALLOW_ILLEGAL_INTERCHANGE \ + (UTF8_DISALLOW_SUPER|UTF8_DISALLOW_SURROGATE|UTF8_DISALLOW_NONCHAR) +# endif +# ifndef UTF8_WARN_ILLEGAL_INTERCHANGE +# define UTF8_WARN_ILLEGAL_INTERCHANGE \ + (UTF8_WARN_SUPER|UTF8_WARN_SURROGATE|UTF8_WARN_NONCHAR) +# endif +# ifndef FIRST_START_BYTE_THAT_IS_DEFINITELY_SUPER +# ifdef EBCDIC /* On EBCDIC, these are actually I8 bytes */ +# define FIRST_START_BYTE_THAT_IS_DEFINITELY_SUPER 0xFA +# define IS_UTF8_2_BYTE_SUPER(s0, s1) ((s0) == 0xF9 && (s1) >= 0xA2) + +# define IS_UTF8_2_BYTE_SURROGATE(s0, s1) ((s0) == 0xF1 \ + && ((s1) & 0xFE ) == 0xB6) +# else +# define FIRST_START_BYTE_THAT_IS_DEFINITELY_SUPER 0xF5 +# define IS_UTF8_2_BYTE_SUPER(s0, s1) ((s0) == 0xF4 && (s1) >= 0x90) +# define IS_UTF8_2_BYTE_SURROGATE(s0, s1) ((s0) == 0xED && (s1) >= 0xA0) +# endif +# ifndef HIGHEST_REPRESENTABLE_UTF8 +# if defined(UV_IS_QUAD) /* These assume IV_MAX is 2**63-1 */ +# ifdef EBCDIC /* Actually is I8 */ +# define HIGHEST_REPRESENTABLE_UTF8 \ + "\xFF\xA7\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF" +# else +# define HIGHEST_REPRESENTABLE_UTF8 \ + "\xFF\x80\x87\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF" +# endif +# endif +# endif +# endif + +# ifndef Newx +# define Newx(v,n,t) New(0,v,n,t) +# endif + +# ifndef PERL_UNUSED_ARG +# define PERL_UNUSED_ARG(x) ((void)x) +# endif + +# ifndef memGT +# define memGT(s1,s2,l) (memcmp(s1,s2,l) > 0) +# endif + +# ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +# endif + +static const char malformed_text[] = "Malformed UTF-8 character"; + +static char * +_byte_dump_string(const U8 * const start, const STRLEN len) +{ + /* Returns a mortalized C string that is a displayable copy of the 'len' */ + + const STRLEN output_len = 4 * len + 1; /* 4 bytes per each input, plus a + trailing NUL */ + const U8 * s = start; + const U8 * const e = start + len; + char * output; + char * d; + dTHX; + + Newx(output, output_len, char); + SAVEFREEPV(output); + + d = output; + for (s = start; s < e; s++) { + const unsigned high_nibble = (*s & 0xF0) >> 4; + const unsigned low_nibble = (*s & 0x0F); + + *d++ = '\\'; + *d++ = 'x'; + + if (high_nibble < 10) { + *d++ = high_nibble + '0'; + } + else { + *d++ = high_nibble - 10 + 'a'; + } + + if (low_nibble < 10) { + *d++ = low_nibble + '0'; + } + else { + *d++ = low_nibble - 10 + 'a'; + } + } + + *d = '\0'; + return output; +} + +static char * +S_unexpected_non_continuation_text(const U8 * const s, + + /* Max number of bytes to print */ + STRLEN print_len, + + /* Which one is the non-continuation */ + const STRLEN non_cont_byte_pos, + + /* How many bytes should there be? */ + const STRLEN expect_len) +{ + /* Return the malformation warning text for an unexpected continuation + * byte. */ + + dTHX; + const char * const where = (non_cont_byte_pos == 1) + ? "immediately" + : Perl_form(aTHX_ "%d bytes", + (int) non_cont_byte_pos); + const U8 * x = s + non_cont_byte_pos; + const U8 * e = s + print_len; + + /* We don't need to pass this parameter, but since it has already been + * calculated, it's likely faster to pass it; verify under DEBUGGING */ + assert(expect_len == UTF8SKIP(s)); + + /* As a defensive coding measure, don't output anything past a NUL. Such + * bytes shouldn't be in the middle of a malformation, and could mark the + * end of the allocated string, and what comes after is undefined */ + for (; x < e; x++) { + if (*x == '\0') { + x++; /* Output this particular NUL */ + break; + } + } + + return Perl_form(aTHX_ "%s: %s (unexpected non-continuation byte 0x%02x," + " %s after start byte 0x%02x; need %d bytes, got %d)", + malformed_text, + _byte_dump_string(s, x - s), + *(s + non_cont_byte_pos), + where, + *s, + (int) expect_len, + (int) non_cont_byte_pos); +} + +static int +S_is_utf8_overlong_given_start_byte_ok(const U8 * const s, const STRLEN len); + +static int +S_does_utf8_overflow(const U8 * const s, + const U8 * e, + const bool consider_overlongs) +{ + /* Returns an int indicating whether or not the UTF-8 sequence from 's' to + * 'e' - 1 would overflow an IV on this platform. */ + +# if ! defined(UV_IS_QUAD) + + const STRLEN len = e - s; + int is_overlong; + + assert(s <= e && s + UTF8SKIP(s) >= e); + assert(! UTF8_IS_INVARIANT(*s) && e > s); + +# ifdef EBCDIC + + PERL_UNUSED_ARG(consider_overlongs); + + if (*s != 0xFE) { + return 0; + } + + if (len == 1) { + return -1; + } + +# else + + if (LIKELY(*s < 0xFE)) { + return 0; + } + + if (! consider_overlongs) { + return 1; + } + + if (len == 1) { + return -1; + } + + is_overlong = S_is_utf8_overlong_given_start_byte_ok(s, len); + + if (is_overlong == 0) { + return 1; + } + + if (is_overlong < 0) { + return -1; + } + + if (*s == 0xFE) { + return 0; + } + +# endif + + /* Here, ASCII and EBCDIC rejoin: + * On ASCII: We have an overlong sequence starting with FF + * On EBCDIC: We have a sequence starting with FE. */ + + { /* For C89, use a block so the declaration can be close to its use */ + +# ifdef EBCDIC + const U8 conts_for_highest_30_bit[] = "\x41\x41\x41\x41\x41\x41\x42"; +# else + const U8 conts_for_highest_30_bit[] = "\x80\x80\x80\x80\x80\x80\x81"; +# endif + const STRLEN conts_len = sizeof(conts_for_highest_30_bit) - 1; + const STRLEN cmp_len = MIN(conts_len, len - 1); + + if (cmp_len >= conts_len || memNE(s + 1, + conts_for_highest_30_bit, + cmp_len)) + { + return memGT(s + 1, conts_for_highest_30_bit, cmp_len); + } + + return -1; + } + +# else /* Below is 64-bit word */ + + PERL_UNUSED_ARG(consider_overlongs); + + { + const STRLEN len = e - s; + const U8 *x; + const U8 * y = (const U8 *) HIGHEST_REPRESENTABLE_UTF8; + + for (x = s; x < e; x++, y++) { + + if (UNLIKELY(NATIVE_UTF8_TO_I8(*x) == *y)) { + continue; + } + return NATIVE_UTF8_TO_I8(*x) > *y; + } + + if (len < sizeof(HIGHEST_REPRESENTABLE_UTF8) - 1) { + return -1; + } + + return 0; + } + +# endif + +} + +static int +S_isFF_OVERLONG(const U8 * const s, const STRLEN len); + +static int +S_is_utf8_overlong_given_start_byte_ok(const U8 * const s, const STRLEN len) +{ + const U8 s0 = NATIVE_UTF8_TO_I8(s[0]); + const U8 s1 = NATIVE_UTF8_TO_I8(s[1]); + + assert(len > 1 && UTF8_IS_START(*s)); + +# ifdef EBCDIC +# define F0_ABOVE_OVERLONG 0xB0 +# define F8_ABOVE_OVERLONG 0xA8 +# define FC_ABOVE_OVERLONG 0xA4 +# define FE_ABOVE_OVERLONG 0xA2 +# define FF_OVERLONG_PREFIX "\xfe\x41\x41\x41\x41\x41\x41\x41" +# else + + if (s0 == 0xE0 && UNLIKELY(s1 < 0xA0)) { + return 1; + } + +# define F0_ABOVE_OVERLONG 0x90 +# define F8_ABOVE_OVERLONG 0x88 +# define FC_ABOVE_OVERLONG 0x84 +# define FE_ABOVE_OVERLONG 0x82 +# define FF_OVERLONG_PREFIX "\xff\x80\x80\x80\x80\x80\x80" +# endif + + if ( (s0 == 0xF0 && UNLIKELY(s1 < F0_ABOVE_OVERLONG)) + || (s0 == 0xF8 && UNLIKELY(s1 < F8_ABOVE_OVERLONG)) + || (s0 == 0xFC && UNLIKELY(s1 < FC_ABOVE_OVERLONG)) + || (s0 == 0xFE && UNLIKELY(s1 < FE_ABOVE_OVERLONG))) + { + return 1; + } + + /* Check for the FF overlong */ + return S_isFF_OVERLONG(s, len); +} + +int +S_isFF_OVERLONG(const U8 * const s, const STRLEN len) +{ + if (LIKELY(memNE(s, FF_OVERLONG_PREFIX, + MIN(len, sizeof(FF_OVERLONG_PREFIX) - 1)))) + { + return 0; + } + + if (len >= sizeof(FF_OVERLONG_PREFIX) - 1) { + return 1; + } + + return -1; +} + +# ifndef UTF8_GOT_CONTINUATION +# define UTF8_GOT_CONTINUATION UTF8_ALLOW_CONTINUATION +# define UTF8_GOT_EMPTY UTF8_ALLOW_EMPTY +# define UTF8_GOT_LONG UTF8_ALLOW_LONG +# define UTF8_GOT_NON_CONTINUATION UTF8_ALLOW_NON_CONTINUATION +# define UTF8_GOT_SHORT UTF8_ALLOW_SHORT +# define UTF8_GOT_SURROGATE UTF8_DISALLOW_SURROGATE +# define UTF8_GOT_NONCHAR UTF8_DISALLOW_NONCHAR +# define UTF8_GOT_SUPER UTF8_DISALLOW_SUPER +# endif + +# ifndef UNICODE_IS_SUPER +# define UNICODE_IS_SUPER(uv) ((UV) (uv) > PERL_UNICODE_MAX) +# endif +# ifndef UNICODE_IS_32_CONTIGUOUS_NONCHARS +# define UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) ((UV) (uv) >= 0xFDD0 \ + && (UV) (uv) <= 0xFDEF) +# endif +# ifndef UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER +# define UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv) \ + (((UV) (uv) & 0xFFFE) == 0xFFFE) +# endif +# ifndef is_NONCHAR_utf8_safe +# define is_NONCHAR_utf8_safe(s,e) /*** GENERATED CODE ***/ \ +( ( ( LIKELY((e) > (s)) ) && ( LIKELY(((e) - (s)) >= UTF8SKIP(s)) ) ) ? ( ( 0xEF == ((const U8*)s)[0] ) ?\ + ( ( 0xB7 == ((const U8*)s)[1] ) ? \ + ( ( 0x90 <= ((const U8*)s)[2] && ((const U8*)s)[2] <= 0xAF ) ? 3 : 0 )\ + : ( ( 0xBF == ((const U8*)s)[1] ) && ( ( ((const U8*)s)[2] & 0xFE ) == 0xBE ) ) ? 3 : 0 )\ + : ( 0xF0 == ((const U8*)s)[0] ) ? \ + ( ( ( ( ((const U8*)s)[1] == 0x9F || ( ( ((const U8*)s)[1] & 0xEF ) == 0xAF ) ) && ( 0xBF == ((const U8*)s)[2] ) ) && ( ( ((const U8*)s)[3] & 0xFE ) == 0xBE ) ) ? 4 : 0 )\ + : ( 0xF1 <= ((const U8*)s)[0] && ((const U8*)s)[0] <= 0xF3 ) ? \ + ( ( ( ( ( ((const U8*)s)[1] & 0xCF ) == 0x8F ) && ( 0xBF == ((const U8*)s)[2] ) ) && ( ( ((const U8*)s)[3] & 0xFE ) == 0xBE ) ) ? 4 : 0 )\ + : ( ( ( ( 0xF4 == ((const U8*)s)[0] ) && ( 0x8F == ((const U8*)s)[1] ) ) && ( 0xBF == ((const U8*)s)[2] ) ) && ( ( ((const U8*)s)[3] & 0xFE ) == 0xBE ) ) ? 4 : 0 ) : 0 ) +# endif + +# ifndef UTF8_IS_NONCHAR +# define UTF8_IS_NONCHAR(s, e) (is_NONCHAR_utf8_safe(s,e) > 0) +# endif +# ifndef UNICODE_IS_NONCHAR +# define UNICODE_IS_NONCHAR(uv) \ + ( UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) \ + || ( LIKELY( ! UNICODE_IS_SUPER(uv)) \ + && UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv))) +# endif + +# ifndef UTF8_MAXBYTES +# define UTF8_MAXBYTES UTF8_MAXLEN +# endif + +static UV +utf8n_to_uvchr_msgs(const U8 *s, + STRLEN curlen, + STRLEN *retlen, + const U32 flags, + U32 * errors, + AV ** msgs) +{ + const U8 * const s0 = s; + const U8 * send = NULL; + U32 possible_problems = 0; + UV uv = *s; + STRLEN expectlen = 0; + U8 * adjusted_s0 = (U8 *) s0; + U8 temp_char_buf[UTF8_MAXBYTES + 1]; + UV uv_so_far = 0; + dTHX; + + assert(errors == NULL); /* This functionality has been stripped */ + + if (UNLIKELY(curlen == 0)) { + possible_problems |= UTF8_GOT_EMPTY; + curlen = 0; + uv = UNICODE_REPLACEMENT; + goto ready_to_handle_errors; + } + + expectlen = UTF8SKIP(s); + + if (retlen) { + *retlen = expectlen; + } + + if (UTF8_IS_INVARIANT(uv)) { + return uv; + } + + if (UNLIKELY(UTF8_IS_CONTINUATION(uv))) { + possible_problems |= UTF8_GOT_CONTINUATION; + curlen = 1; + uv = UNICODE_REPLACEMENT; + goto ready_to_handle_errors; + } + + uv = NATIVE_UTF8_TO_I8(uv) & UTF_START_MASK(expectlen); + + send = (U8*) s0; + if (UNLIKELY(curlen < expectlen)) { + possible_problems |= UTF8_GOT_SHORT; + send += curlen; + } + else { + send += expectlen; + } + + for (s = s0 + 1; s < send; s++) { + if (LIKELY(UTF8_IS_CONTINUATION(*s))) { + uv = UTF8_ACCUMULATE(uv, *s); + continue; + } + + possible_problems |= UTF8_GOT_NON_CONTINUATION; + break; + } /* End of loop through the character's bytes */ + + curlen = s - s0; + +# define UTF8_GOT_TOO_SHORT (UTF8_GOT_SHORT|UTF8_GOT_NON_CONTINUATION) + + if (UNLIKELY(possible_problems & UTF8_GOT_TOO_SHORT)) { + uv_so_far = uv; + uv = UNICODE_REPLACEMENT; + } + + if (UNLIKELY(0 < S_does_utf8_overflow(s0, s, 1))) { + possible_problems |= UTF8_GOT_OVERFLOW; + uv = UNICODE_REPLACEMENT; + } + + if ( ( LIKELY(! possible_problems) + && UNLIKELY(expectlen > (STRLEN) OFFUNISKIP(uv))) + || ( UNLIKELY(possible_problems) + && ( UNLIKELY(! UTF8_IS_START(*s0)) + || ( curlen > 1 + && UNLIKELY(0 < S_is_utf8_overlong_given_start_byte_ok(s0, + s - s0)))))) + { + possible_problems |= UTF8_GOT_LONG; + + if ( UNLIKELY( possible_problems & UTF8_GOT_TOO_SHORT) + && LIKELY(! (possible_problems & UTF8_GOT_OVERFLOW))) + { + UV min_uv = uv_so_far; + STRLEN i; + + for (i = curlen; i < expectlen; i++) { + min_uv = UTF8_ACCUMULATE(min_uv, + I8_TO_NATIVE_UTF8(UTF_CONTINUATION_MARK)); + } + + adjusted_s0 = temp_char_buf; + (void) uvoffuni_to_utf8_flags(adjusted_s0, min_uv, 0); + } + } + + /* Here, we have found all the possible problems, except for when the input + * is for a problematic code point not allowed by the input parameters. */ + + /* uv is valid for overlongs */ + if ( ( ( LIKELY(! (possible_problems & ~UTF8_GOT_LONG)) + && uv >= UNICODE_SURROGATE_FIRST) + || ( UNLIKELY(possible_problems) + && isUTF8_POSSIBLY_PROBLEMATIC(*adjusted_s0))) + && ((flags & ( UTF8_DISALLOW_NONCHAR + |UTF8_DISALLOW_SURROGATE + |UTF8_DISALLOW_SUPER)))) + { + if (LIKELY(! (possible_problems & ~UTF8_GOT_LONG))) { + if (UNLIKELY(UNICODE_IS_SURROGATE(uv))) { + possible_problems |= UTF8_GOT_SURROGATE; + } + else if (UNLIKELY(uv > PERL_UNICODE_MAX)) { + possible_problems |= UTF8_GOT_SUPER; + } + else if (UNLIKELY(UNICODE_IS_NONCHAR(uv))) { + possible_problems |= UTF8_GOT_NONCHAR; + } + } + else { + if (UNLIKELY(NATIVE_UTF8_TO_I8(*adjusted_s0) + >= FIRST_START_BYTE_THAT_IS_DEFINITELY_SUPER)) + { + possible_problems |= UTF8_GOT_SUPER; + } + else if (curlen > 1) { + if (UNLIKELY(IS_UTF8_2_BYTE_SUPER( + NATIVE_UTF8_TO_I8(*adjusted_s0), + NATIVE_UTF8_TO_I8(*(adjusted_s0 + 1))))) + { + possible_problems |= UTF8_GOT_SUPER; + } + else if (UNLIKELY(IS_UTF8_2_BYTE_SURROGATE( + NATIVE_UTF8_TO_I8(*adjusted_s0), + NATIVE_UTF8_TO_I8(*(adjusted_s0 + 1))))) + { + possible_problems |= UTF8_GOT_SURROGATE; + } + } + } + } + + ready_to_handle_errors: + + if (UNLIKELY(possible_problems)) { + bool disallowed = FALSE; + const U32 orig_problems = possible_problems; + + if (msgs) { + *msgs = NULL; + } + + while (possible_problems) { /* Handle each possible problem */ + UV pack_warn = 0; + char * message = NULL; + U32 this_flag_bit = 0; + + /* Each 'if' clause handles one problem. They are ordered so that + * the first ones' messages will be displayed before the later + * ones; this is kinda in decreasing severity order. But the + * overlong must come last, as it changes 'uv' looked at by the + * others */ + if (possible_problems & UTF8_GOT_OVERFLOW) { + + /* Overflow means also got a super; we handle both here */ + possible_problems + &= ~(UTF8_GOT_OVERFLOW|UTF8_GOT_SUPER); + + /* Disallow if any of the categories say to */ + if ( ! (flags & UTF8_ALLOW_OVERFLOW) + || (flags & UTF8_DISALLOW_SUPER)) + { + disallowed = TRUE; + } + + /* Likewise, warn if any say to */ + if ( ! (flags & UTF8_ALLOW_OVERFLOW)) { + + /* The warnings code explicitly says it doesn't handle the + * case of packWARN2 and two categories which have + * parent-child relationship. Even if it works now to + * raise the warning if either is enabled, it wouldn't + * necessarily do so in the future. We output (only) the + * most dire warning */ + if (! (flags & UTF8_CHECK_ONLY)) { + if (msgs || ckWARN_d(WARN_UTF8)) { + pack_warn = packWARN(WARN_UTF8); + } + else if (msgs || ckWARN_d(WARN_NON_UNICODE)) { + pack_warn = packWARN(WARN_NON_UNICODE); + } + if (pack_warn) { + message = Perl_form(aTHX_ "%s: %s (overflows)", + malformed_text, + _byte_dump_string(s0, curlen)); + this_flag_bit = UTF8_GOT_OVERFLOW; + } + } + } + } + else if (possible_problems & UTF8_GOT_EMPTY) { + possible_problems &= ~UTF8_GOT_EMPTY; + + if (! (flags & UTF8_ALLOW_EMPTY)) { + disallowed = TRUE; + if ( (msgs + || ckWARN_d(WARN_UTF8)) && ! (flags & UTF8_CHECK_ONLY)) + { + pack_warn = packWARN(WARN_UTF8); + message = Perl_form(aTHX_ "%s (empty string)", + malformed_text); + this_flag_bit = UTF8_GOT_EMPTY; + } + } + } + else if (possible_problems & UTF8_GOT_CONTINUATION) { + possible_problems &= ~UTF8_GOT_CONTINUATION; + + if (! (flags & UTF8_ALLOW_CONTINUATION)) { + disallowed = TRUE; + if (( msgs + || ckWARN_d(WARN_UTF8)) && ! (flags & UTF8_CHECK_ONLY)) + { + pack_warn = packWARN(WARN_UTF8); + message = Perl_form(aTHX_ + "%s: %s (unexpected continuation byte 0x%02x," + " with no preceding start byte)", + malformed_text, + _byte_dump_string(s0, 1), *s0); + this_flag_bit = UTF8_GOT_CONTINUATION; + } + } + } + else if (possible_problems & UTF8_GOT_SHORT) { + possible_problems &= ~UTF8_GOT_SHORT; + + if (! (flags & UTF8_ALLOW_SHORT)) { + disallowed = TRUE; + if (( msgs + || ckWARN_d(WARN_UTF8)) && ! (flags & UTF8_CHECK_ONLY)) + { + pack_warn = packWARN(WARN_UTF8); + message = Perl_form(aTHX_ + "%s: %s (too short; %d byte%s available, need %d)", + malformed_text, + _byte_dump_string(s0, send - s0), + (int)curlen, + curlen == 1 ? "" : "s", + (int)expectlen); + this_flag_bit = UTF8_GOT_SHORT; + } + } + + } + else if (possible_problems & UTF8_GOT_NON_CONTINUATION) { + possible_problems &= ~UTF8_GOT_NON_CONTINUATION; + + if (! (flags & UTF8_ALLOW_NON_CONTINUATION)) { + disallowed = TRUE; + if (( msgs + || ckWARN_d(WARN_UTF8)) && ! (flags & UTF8_CHECK_ONLY)) + { + int printlen = s - s0; + pack_warn = packWARN(WARN_UTF8); + message = Perl_form(aTHX_ "%s", + S_unexpected_non_continuation_text(s0, + printlen, + s - s0, + (int) expectlen)); + this_flag_bit = UTF8_GOT_NON_CONTINUATION; + } + } + } + else if (possible_problems & UTF8_GOT_SURROGATE) { + possible_problems &= ~UTF8_GOT_SURROGATE; + + if (flags & UTF8_WARN_SURROGATE) { + + if ( ! (flags & UTF8_CHECK_ONLY) + && (msgs || ckWARN_d(WARN_SURROGATE))) + { + pack_warn = packWARN(WARN_SURROGATE); + + /* These are the only errors that can occur with a + * surrogate when the 'uv' isn't valid */ + if (orig_problems & UTF8_GOT_TOO_SHORT) { + message = Perl_form(aTHX_ + "UTF-16 surrogate (any UTF-8 sequence that" + " starts with \"%s\" is for a surrogate)", + _byte_dump_string(s0, curlen)); + } + else { + message = Perl_form(aTHX_ surrogate_cp_format, uv); + } + this_flag_bit = UTF8_GOT_SURROGATE; + } + } + + if (flags & UTF8_DISALLOW_SURROGATE) { + disallowed = TRUE; + } + } + else if (possible_problems & UTF8_GOT_SUPER) { + possible_problems &= ~UTF8_GOT_SUPER; + + if (flags & UTF8_WARN_SUPER) { + + if ( ! (flags & UTF8_CHECK_ONLY) + && (msgs || ckWARN_d(WARN_NON_UNICODE))) + { + pack_warn = packWARN(WARN_NON_UNICODE); + + if (orig_problems & UTF8_GOT_TOO_SHORT) { + message = Perl_form(aTHX_ + "Any UTF-8 sequence that starts with" + " \"%s\" is for a non-Unicode code point," + " may not be portable", + _byte_dump_string(s0, curlen)); + } + else { + message = Perl_form(aTHX_ super_cp_format, uv); + } + this_flag_bit = UTF8_GOT_SUPER; + } + } + + if (flags & UTF8_DISALLOW_SUPER) { + disallowed = TRUE; + } + } + else if (possible_problems & UTF8_GOT_NONCHAR) { + possible_problems &= ~UTF8_GOT_NONCHAR; + + if (flags & UTF8_WARN_NONCHAR) { + + if ( ! (flags & UTF8_CHECK_ONLY) + && (msgs || ckWARN_d(WARN_NONCHAR))) + { + /* The code above should have guaranteed that we don't + * get here with errors other than overlong */ + assert (! (orig_problems + & ~(UTF8_GOT_LONG|UTF8_GOT_NONCHAR))); + + pack_warn = packWARN(WARN_NONCHAR); + message = Perl_form(aTHX_ nonchar_cp_format, uv); + this_flag_bit = UTF8_GOT_NONCHAR; + } + } + + if (flags & UTF8_DISALLOW_NONCHAR) { + disallowed = TRUE; + } + } + else if (possible_problems & UTF8_GOT_LONG) { + possible_problems &= ~UTF8_GOT_LONG; + + if (flags & UTF8_ALLOW_LONG) { + uv = UNICODE_REPLACEMENT; + } + else { + disallowed = TRUE; + + if (( msgs + || ckWARN_d(WARN_UTF8)) && ! (flags & UTF8_CHECK_ONLY)) + { + pack_warn = packWARN(WARN_UTF8); + + /* These error types cause 'uv' to be something that + * isn't what was intended, so can't use it in the + * message. The other error types either can't + * generate an overlong, or else the 'uv' is valid */ + if (orig_problems & + (UTF8_GOT_TOO_SHORT|UTF8_GOT_OVERFLOW)) + { + message = Perl_form(aTHX_ + "%s: %s (any UTF-8 sequence that starts" + " with \"%s\" is overlong which can and" + " should be represented with a" + " different, shorter sequence)", + malformed_text, + _byte_dump_string(s0, send - s0), + _byte_dump_string(s0, curlen)); + } + else { + U8 tmpbuf[UTF8_MAXBYTES+1]; + const U8 * const e = uvoffuni_to_utf8_flags(tmpbuf, + uv, 0); + /* Don't use U+ for non-Unicode code points, which + * includes those in the Latin1 range */ + const char * preface = ( uv > PERL_UNICODE_MAX +# ifdef EBCDIC + || uv <= 0xFF +# endif + ) + ? "0x" + : "U+"; + message = Perl_form(aTHX_ + "%s: %s (overlong; instead use %s to represent" + " %s%0*" UVXf ")", + malformed_text, + _byte_dump_string(s0, send - s0), + _byte_dump_string(tmpbuf, e - tmpbuf), + preface, + ((uv < 256) ? 2 : 4), /* Field width of 2 for + small code points */ + UNI_TO_NATIVE(uv)); + } + this_flag_bit = UTF8_GOT_LONG; + } + } + } /* End of looking through the possible flags */ + + /* Display the message (if any) for the problem being handled in + * this iteration of the loop */ + if (message) { + if (msgs) { + assert(this_flag_bit); + + if (*msgs == NULL) { + *msgs = newAV(); + } + + av_push(*msgs, newRV_noinc((SV*) S_new_msg_hv(message, + pack_warn))); + } + else if (PL_op) + Perl_warner(aTHX_ pack_warn, "%s in %s", message, + OP_DESC(PL_op)); + else + Perl_warner(aTHX_ pack_warn, "%s", message); + } + } /* End of 'while (possible_problems)' */ + + if (retlen) { + *retlen = curlen; + } + + if (disallowed) { + if (flags & UTF8_CHECK_ONLY && retlen) { + *retlen = ((STRLEN) -1); + } + return 0; + } + } + + return UNI_TO_NATIVE(uv); +} + +static STRLEN +S_is_utf8_char_helper(const U8 * const s, const U8 * e, const U32 flags) +{ + STRLEN len; + const U8 *x; + + assert(0 == (flags & ~UTF8_DISALLOW_ILLEGAL_INTERCHANGE)); + assert(! UTF8_IS_INVARIANT(*s)); + + if (UNLIKELY(! UTF8_IS_START(*s))) { + return 0; + } + + /* Examine a maximum of a single whole code point */ + if (e - s > UTF8SKIP(s)) { + e = s + UTF8SKIP(s); + } + + len = e - s; + + if (flags && isUTF8_POSSIBLY_PROBLEMATIC(*s)) { + const U8 s0 = NATIVE_UTF8_TO_I8(s[0]); + + if ( (flags & UTF8_DISALLOW_SUPER) + && UNLIKELY(s0 >= FIRST_START_BYTE_THAT_IS_DEFINITELY_SUPER)) + { + return 0; /* Above Unicode */ + } + + if (len > 1) { + const U8 s1 = NATIVE_UTF8_TO_I8(s[1]); + + if ( (flags & UTF8_DISALLOW_SUPER) + && UNLIKELY(IS_UTF8_2_BYTE_SUPER(s0, s1))) + { + return 0; /* Above Unicode */ + } + + if ( (flags & UTF8_DISALLOW_SURROGATE) + && UNLIKELY(IS_UTF8_2_BYTE_SURROGATE(s0, s1))) + { + return 0; /* Surrogate */ + } + + if ( (flags & UTF8_DISALLOW_NONCHAR) + && UNLIKELY(UTF8_IS_NONCHAR(s, e))) + { + return 0; /* Noncharacter code point */ + } + } + } + + for (x = s + 1; x < e; x++) { + if (UNLIKELY(! UTF8_IS_CONTINUATION(*x))) { + return 0; + } + } + + if (len > 1 && S_is_utf8_overlong_given_start_byte_ok(s, len) > 0) { + return 0; + } + + if (0 < S_does_utf8_overflow(s, e, 0)) { + return 0; + } + + return UTF8SKIP(s); +} + +# undef is_utf8_valid_partial_char_flags + +static bool +is_utf8_valid_partial_char_flags(const U8 * const s, const U8 * const e, const U32 flags) +{ + + return S_is_utf8_char_helper(s, e, flags) > 0; +} + +# undef is_utf8_string_loc_flags + +static bool +is_utf8_string_loc_flags(const U8 *s, STRLEN len, const U8 **ep, const U32 flags) +{ + const U8* send = s + len; + + assert(0 == (flags & ~UTF8_DISALLOW_ILLEGAL_INTERCHANGE)); + + while (s < send) { + if (UTF8_IS_INVARIANT(*s)) { + s++; + } + else if ( UNLIKELY(send - s < UTF8SKIP(s)) + || ! S_is_utf8_char_helper(s, send, flags)) + { + *ep = s; + return 0; + } + else { + s += UTF8SKIP(s); + } + } + + *ep = send; + + return 1; +} + +#endif + +#if defined(IN_UNICODE_XS) && ! defined(uvchr_to_utf8_flags_msgs) + +# define MY_SHIFT UTF_ACCUMULATION_SHIFT +# define MY_MARK UTF_CONTINUATION_MARK +# define MY_MASK UTF_CONTINUATION_MASK + +static const char cp_above_legal_max[] = + "Use of code point 0x%" UVXf " is not allowed; the" + " permissible max is 0x%" UVXf; + +/* These two can be dummys, as they are not looked at by the function, which + * has hard-coded into it what flags it is expecting are */ +# ifndef UNICODE_DISALLOW_ILLEGAL_INTERCHANGE +# define UNICODE_DISALLOW_ILLEGAL_INTERCHANGE 0 +# endif +# ifndef UNICODE_WARN_ILLEGAL_INTERCHANGE +# define UNICODE_WARN_ILLEGAL_INTERCHANGE 0 +# endif + +# ifndef OFFUNI_IS_INVARIANT +# define OFFUNI_IS_INVARIANT(cp) UNI_IS_INVARIANT(cp) +# endif +# ifndef MAX_EXTERNALLY_LEGAL_CP +# define MAX_EXTERNALLY_LEGAL_CP ((UV) (IV_MAX)) +# endif +# ifndef LATIN1_TO_NATIVE +# define LATIN1_TO_NATIVE(a) ASCII_TO_NATIVE(a) +# endif +# ifndef I8_TO_NATIVE_UTF8 +# define I8_TO_NATIVE_UTF8(a) NATIVE_TO_UTF(a) +# endif +# ifndef MAX_UTF8_TWO_BYTE +# define MAX_UTF8_TWO_BYTE (32 * (1U << UTF_ACCUMULATION_SHIFT) - 1) +# endif +# ifndef UNICODE_IS_32_CONTIGUOUS_NONCHARS +# define UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) ((UV) (uv) >= 0xFDD0 \ + && (UV) (uv) <= 0xFDEF) +# endif +# ifndef UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER +# define UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv) \ + (((UV) (uv) & 0xFFFE) == 0xFFFE) +# endif +# ifndef UNICODE_IS_SUPER +# define UNICODE_IS_SUPER(uv) ((UV) (uv) > PERL_UNICODE_MAX) +# endif +# ifndef OFFUNISKIP +# define OFFUNISKIP(cp) UNISKIP(NATIVE_TO_UNI(cp)) +# endif + +# define HANDLE_UNICODE_SURROGATE(uv, flags, msgs) \ + STMT_START { \ + U32 category = packWARN(WARN_SURROGATE); \ + const char * format = surrogate_cp_format; \ + *msgs = S_new_msg_hv(Perl_form(aTHX_ format, uv), \ + category); \ + return NULL; \ + } STMT_END; + +# define HANDLE_UNICODE_NONCHAR(uv, flags, msgs) \ + STMT_START { \ + U32 category = packWARN(WARN_NONCHAR); \ + const char * format = nonchar_cp_format; \ + *msgs = S_new_msg_hv(Perl_form(aTHX_ format, uv), \ + category); \ + return NULL; \ + } STMT_END; + +static U8 * +uvchr_to_utf8_flags_msgs(U8 *d, UV uv, const UV flags, HV** msgs) +{ + dTHX; + + assert(msgs); + + PERL_UNUSED_ARG(flags); + + uv = NATIVE_TO_UNI(uv); + + *msgs = NULL; + + if (OFFUNI_IS_INVARIANT(uv)) { + *d++ = LATIN1_TO_NATIVE(uv); + return d; + } + + if (uv <= MAX_UTF8_TWO_BYTE) { + *d++ = I8_TO_NATIVE_UTF8(( uv >> MY_SHIFT) | UTF_START_MARK(2)); + *d++ = I8_TO_NATIVE_UTF8(( uv & MY_MASK) | MY_MARK); + return d; + } + + /* Not 2-byte; test for and handle 3-byte result. In the test immediately + * below, the 16 is for start bytes E0-EF (which are all the possible ones + * for 3 byte characters). The 2 is for 2 continuation bytes; these each + * contribute MY_SHIFT bits. This yields 0x4000 on EBCDIC platforms, 0x1_0000 + * on ASCII; so 3 bytes covers the range 0x400-0x3FFF on EBCDIC; + * 0x800-0xFFFF on ASCII */ + if (uv < (16 * (1U << (2 * MY_SHIFT)))) { + *d++ = I8_TO_NATIVE_UTF8(( uv >> ((3 - 1) * MY_SHIFT)) | UTF_START_MARK(3)); + *d++ = I8_TO_NATIVE_UTF8(((uv >> ((2 - 1) * MY_SHIFT)) & MY_MASK) | MY_MARK); + *d++ = I8_TO_NATIVE_UTF8(( uv /* (1 - 1) */ & MY_MASK) | MY_MARK); + +#ifndef EBCDIC /* These problematic code points are 4 bytes on EBCDIC, so + aren't tested here */ + /* The most likely code points in this range are below the surrogates. + * Do an extra test to quickly exclude those. */ + if (UNLIKELY(uv >= UNICODE_SURROGATE_FIRST)) { + if (UNLIKELY( UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv) + || UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv))) + { + HANDLE_UNICODE_NONCHAR(uv, flags, msgs); + } + else if (UNLIKELY(UNICODE_IS_SURROGATE(uv))) { + HANDLE_UNICODE_SURROGATE(uv, flags, msgs); + } + } +#endif + return d; + } + + /* Not 3-byte; that means the code point is at least 0x1_0000 on ASCII + * platforms, and 0x4000 on EBCDIC. There are problematic cases that can + * happen starting with 4-byte characters on ASCII platforms. We unify the + * code for these with EBCDIC, even though some of them require 5-bytes on + * those, because khw believes the code saving is worth the very slight + * performance hit on these high EBCDIC code points. */ + + if (UNLIKELY(UNICODE_IS_SUPER(uv))) { + const char * format = super_cp_format; + U32 category = packWARN(WARN_NON_UNICODE); + if (UNLIKELY(uv > MAX_EXTERNALLY_LEGAL_CP)) { + Perl_croak(aTHX_ cp_above_legal_max, uv, MAX_EXTERNALLY_LEGAL_CP); + } + *msgs = S_new_msg_hv(Perl_form(aTHX_ format, uv), category); + return NULL; + } + else if (UNLIKELY(UNICODE_IS_END_PLANE_NONCHAR_GIVEN_NOT_SUPER(uv))) { + HANDLE_UNICODE_NONCHAR(uv, flags, msgs); + } + + /* Test for and handle 4-byte result. In the test immediately below, the + * 8 is for start bytes F0-F7 (which are all the possible ones for 4 byte + * characters). The 3 is for 3 continuation bytes; these each contribute + * MY_SHIFT bits. This yields 0x4_0000 on EBCDIC platforms, 0x20_0000 on + * ASCII, so 4 bytes covers the range 0x4000-0x3_FFFF on EBCDIC; + * 0x1_0000-0x1F_FFFF on ASCII */ + if (uv < (8 * (1U << (3 * MY_SHIFT)))) { + *d++ = I8_TO_NATIVE_UTF8(( uv >> ((4 - 1) * MY_SHIFT)) | UTF_START_MARK(4)); + *d++ = I8_TO_NATIVE_UTF8(((uv >> ((3 - 1) * MY_SHIFT)) & MY_MASK) | MY_MARK); + *d++ = I8_TO_NATIVE_UTF8(((uv >> ((2 - 1) * MY_SHIFT)) & MY_MASK) | MY_MARK); + *d++ = I8_TO_NATIVE_UTF8(( uv /* (1 - 1) */ & MY_MASK) | MY_MARK); + +#ifdef EBCDIC /* These were handled on ASCII platforms in the code for 3-byte + characters. The end-plane non-characters for EBCDIC were + handled just above */ + if (UNLIKELY(UNICODE_IS_32_CONTIGUOUS_NONCHARS(uv))) { + HANDLE_UNICODE_NONCHAR(uv, flags, msgs); + } + else if (UNLIKELY(UNICODE_IS_SURROGATE(uv))) { + HANDLE_UNICODE_SURROGATE(uv, flags, msgs); + } +#endif + + return d; + } + + /* Not 4-byte; that means the code point is at least 0x20_0000 on ASCII + * platforms, and 0x4000 on EBCDIC. At this point we switch to a loop + * format. The unrolled version above turns out to not save all that much + * time, and at these high code points (well above the legal Unicode range + * on ASCII platforms, and well above anything in common use in EBCDIC), + * khw believes that less code outweighs slight performance gains. */ + + { + STRLEN len = OFFUNISKIP(uv); + U8 *p = d+len-1; + while (p > d) { + *p-- = I8_TO_NATIVE_UTF8((uv & MY_MASK) | MY_MARK); + uv >>= MY_SHIFT; + } + *p = I8_TO_NATIVE_UTF8((uv & UTF_START_MASK(len)) | UTF_START_MARK(len)); + return d+len; + } +} + +#endif /* End of defining our own uvchr_to_utf8_flags_msgs() */ +#endif /* End of UTF8SKIP */ + +#endif /* ENCODE_H */ diff --git a/data/miniconda3/lib/perl5/core_perl/English.pm b/data/miniconda3/lib/perl5/core_perl/English.pm new file mode 100644 index 0000000000000000000000000000000000000000..283cd010701aae04accfee82e5968a092b3c0a24 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/English.pm @@ -0,0 +1,237 @@ +package English; + +our $VERSION = '1.11'; + +require Exporter; +@ISA = qw(Exporter); + +=head1 NAME + +English - use nice English (or awk) names for ugly punctuation variables + +=head1 SYNOPSIS + + use English; + use English qw( -no_match_vars ) ; # Avoids regex performance + # penalty in perl 5.18 and + # earlier + ... + if ($ERRNO =~ /denied/) { ... } + +=head1 DESCRIPTION + +This module provides aliases for the built-in variables whose +names no one seems to like to read. Variables with side-effects +which get triggered just by accessing them (like $0) will still +be affected. + +For those variables that have an B<awk> version, both long +and short English alternatives are provided. For example, +the C<$/> variable can be referred to either $RS or +$INPUT_RECORD_SEPARATOR if you are using the English module. + +See L<perlvar> for a complete list of these. + +=head1 PERFORMANCE + +NOTE: This was fixed in perl 5.20. Mentioning these three variables no +longer makes a speed difference. This section still applies if your code +is to run on perl 5.18 or earlier. + +This module can provoke sizeable inefficiencies for regular expressions, +due to unfortunate implementation details. If performance matters in +your application and you don't need $PREMATCH, $MATCH, or $POSTMATCH, +try doing + + use English qw( -no_match_vars ) ; + +. B<It is especially important to do this in modules to avoid penalizing +all applications which use them.> + +=cut + +no warnings; + +my $globbed_match ; + +# Grandfather $NAME import +sub import { + my $this = shift; + my @list = grep { ! /^-no_match_vars$/ } @_ ; + local $Exporter::ExportLevel = 1; + if ( @_ == @list ) { + *EXPORT = \@COMPLETE_EXPORT ; + $globbed_match ||= ( + eval q{ + *MATCH = *& ; + *PREMATCH = *` ; + *POSTMATCH = *' ; + 1 ; + } + || do { + require Carp ; + Carp::croak("Can't create English for match leftovers: $@") ; + } + ) ; + } + else { + *EXPORT = \@MINIMAL_EXPORT ; + } + Exporter::import($this,grep {s/^\$/*/} @list); +} + +@MINIMAL_EXPORT = qw( + *ARG + *LAST_PAREN_MATCH + *INPUT_LINE_NUMBER + *NR + *INPUT_RECORD_SEPARATOR + *RS + *OUTPUT_AUTOFLUSH + *OUTPUT_FIELD_SEPARATOR + *OFS + *OUTPUT_RECORD_SEPARATOR + *ORS + *LIST_SEPARATOR + *SUBSCRIPT_SEPARATOR + *SUBSEP + *FORMAT_PAGE_NUMBER + *FORMAT_LINES_PER_PAGE + *FORMAT_LINES_LEFT + *FORMAT_NAME + *FORMAT_TOP_NAME + *FORMAT_LINE_BREAK_CHARACTERS + *FORMAT_FORMFEED + *CHILD_ERROR + *OS_ERROR + *ERRNO + *EXTENDED_OS_ERROR + *EVAL_ERROR + *PROCESS_ID + *PID + *REAL_USER_ID + *UID + *EFFECTIVE_USER_ID + *EUID + *REAL_GROUP_ID + *GID + *EFFECTIVE_GROUP_ID + *EGID + *PROGRAM_NAME + *PERL_VERSION + *OLD_PERL_VERSION + *ACCUMULATOR + *COMPILING + *DEBUGGING + *SYSTEM_FD_MAX + *INPLACE_EDIT + *PERLDB + *BASETIME + *WARNING + *EXECUTABLE_NAME + *OSNAME + *LAST_REGEXP_CODE_RESULT + *EXCEPTIONS_BEING_CAUGHT + *LAST_SUBMATCH_RESULT + @LAST_MATCH_START + @LAST_MATCH_END +); + + +@MATCH_EXPORT = qw( + *MATCH + *PREMATCH + *POSTMATCH +); + +@COMPLETE_EXPORT = ( @MINIMAL_EXPORT, @MATCH_EXPORT ) ; + +# The ground of all being. + + *ARG = *_ ; + +# Matching. + + *LAST_PAREN_MATCH = *+ ; + *LAST_SUBMATCH_RESULT = *^N ; + *LAST_MATCH_START = *-{ARRAY} ; + *LAST_MATCH_END = *+{ARRAY} ; + +# Input. + + *INPUT_LINE_NUMBER = *. ; + *NR = *. ; + *INPUT_RECORD_SEPARATOR = */ ; + *RS = */ ; + +# Output. + + *OUTPUT_AUTOFLUSH = *| ; + *OUTPUT_FIELD_SEPARATOR = *, ; + *OFS = *, ; + *OUTPUT_RECORD_SEPARATOR = *\ ; + *ORS = *\ ; + +# Interpolation "constants". + + *LIST_SEPARATOR = *" ; + *SUBSCRIPT_SEPARATOR = *; ; + *SUBSEP = *; ; + +# Formats + + *FORMAT_PAGE_NUMBER = *% ; + *FORMAT_LINES_PER_PAGE = *= ; + *FORMAT_LINES_LEFT = *-{SCALAR} ; + *FORMAT_NAME = *~ ; + *FORMAT_TOP_NAME = *^ ; + *FORMAT_LINE_BREAK_CHARACTERS = *: ; + *FORMAT_FORMFEED = *^L ; + +# Error status. + + *CHILD_ERROR = *? ; + *OS_ERROR = *! ; + *ERRNO = *! ; + *OS_ERROR = *! ; + *ERRNO = *! ; + *EXTENDED_OS_ERROR = *^E ; + *EVAL_ERROR = *@ ; + +# Process info. + + *PROCESS_ID = *$ ; + *PID = *$ ; + *REAL_USER_ID = *< ; + *UID = *< ; + *EFFECTIVE_USER_ID = *> ; + *EUID = *> ; + *REAL_GROUP_ID = *( ; + *GID = *( ; + *EFFECTIVE_GROUP_ID = *) ; + *EGID = *) ; + *PROGRAM_NAME = *0 ; + +# Internals. + + *PERL_VERSION = *^V ; + *OLD_PERL_VERSION = *] ; + *ACCUMULATOR = *^A ; + *COMPILING = *^C ; + *DEBUGGING = *^D ; + *SYSTEM_FD_MAX = *^F ; + *INPLACE_EDIT = *^I ; + *PERLDB = *^P ; + *LAST_REGEXP_CODE_RESULT = *^R ; + *EXCEPTIONS_BEING_CAUGHT = *^S ; + *BASETIME = *^T ; + *WARNING = *^W ; + *EXECUTABLE_NAME = *^X ; + *OSNAME = *^O ; + +# Deprecated. + +# *ARRAY_BASE = *[ ; +# *OFMT = *# ; + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Env.pm b/data/miniconda3/lib/perl5/core_perl/Env.pm new file mode 100644 index 0000000000000000000000000000000000000000..6e6cd8b2305f812c00d81ef51053d393a400684e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Env.pm @@ -0,0 +1,254 @@ +package Env; + +our $VERSION = '1.04'; + +=head1 NAME + +Env - perl module that imports environment variables as scalars or arrays + +=head1 SYNOPSIS + + use Env; + use Env qw(PATH HOME TERM); + use Env qw($SHELL @LD_LIBRARY_PATH); + +=head1 DESCRIPTION + +Perl maintains environment variables in a special hash named C<%ENV>. For +when this access method is inconvenient, the Perl module C<Env> allows +environment variables to be treated as scalar or array variables. + +The C<Env::import()> function ties environment variables with suitable +names to global Perl variables with the same names. By default it +ties all existing environment variables (C<keys %ENV>) to scalars. If +the C<import> function receives arguments, it takes them to be a list of +variables to tie; it's okay if they don't yet exist. The scalar type +prefix '$' is inferred for any element of this list not prefixed by '$' +or '@'. Arrays are implemented in terms of C<split> and C<join>, using +C<$Config::Config{path_sep}> as the delimiter. + +After an environment variable is tied, merely use it like a normal variable. +You may access its value + + @path = split(/:/, $PATH); + print join("\n", @LD_LIBRARY_PATH), "\n"; + +or modify it + + $PATH .= ":."; + push @LD_LIBRARY_PATH, $dir; + +however you'd like. Bear in mind, however, that each access to a tied array +variable requires splitting the environment variable's string anew. + +The code: + + use Env qw(@PATH); + push @PATH, '.'; + +is equivalent to: + + use Env qw(PATH); + $PATH .= ":."; + +except that if C<$ENV{PATH}> started out empty, the second approach leaves +it with the (odd) value "C<:.>", but the first approach leaves it with "C<.>". + +To remove a tied environment variable from +the environment, assign it the undefined value + + undef $PATH; + undef @LD_LIBRARY_PATH; + +=head1 LIMITATIONS + +On VMS systems, arrays tied to environment variables are read-only. Attempting +to change anything will cause a warning. + +=head1 AUTHOR + +Chip Salzenberg E<lt>F<chip@fin.uucp>E<gt> +and +Gregor N. Purdy E<lt>F<gregor@focusresearch.com>E<gt> + +=cut + +sub import { + my ($callpack) = caller(0); + my $pack = shift; + my @vars = grep /^[\$\@]?[A-Za-z_]\w*$/, (@_ ? @_ : keys(%ENV)); + return unless @vars; + + @vars = map { m/^[\$\@]/ ? $_ : '$'.$_ } @vars; + + eval "package $callpack; use vars qw(" . join(' ', @vars) . ")"; + die $@ if $@; + foreach (@vars) { + my ($type, $name) = m/^([\$\@])(.*)$/; + if ($type eq '$') { + tie ${"${callpack}::$name"}, Env, $name; + } else { + if ($^O eq 'VMS') { + tie @{"${callpack}::$name"}, Env::Array::VMS, $name; + } else { + tie @{"${callpack}::$name"}, Env::Array, $name; + } + } + } +} + +sub TIESCALAR { + bless \($_[1]); +} + +sub FETCH { + my ($self) = @_; + $ENV{$$self}; +} + +sub STORE { + my ($self, $value) = @_; + if (defined($value)) { + $ENV{$$self} = $value; + } else { + delete $ENV{$$self}; + } +} + +###################################################################### + +package Env::Array; + +use Config; +use Tie::Array; + +@ISA = qw(Tie::Array); + +my $sep = $Config::Config{path_sep}; + +sub TIEARRAY { + bless \($_[1]); +} + +sub FETCHSIZE { + my ($self) = @_; + return 1 + scalar(() = $ENV{$$self} =~ /\Q$sep\E/g); +} + +sub STORESIZE { + my ($self, $size) = @_; + my @temp = split($sep, $ENV{$$self}); + $#temp = $size - 1; + $ENV{$$self} = join($sep, @temp); +} + +sub CLEAR { + my ($self) = @_; + $ENV{$$self} = ''; +} + +sub FETCH { + my ($self, $index) = @_; + return (split($sep, $ENV{$$self}))[$index]; +} + +sub STORE { + my ($self, $index, $value) = @_; + my @temp = split($sep, $ENV{$$self}); + $temp[$index] = $value; + $ENV{$$self} = join($sep, @temp); + return $value; +} + +sub EXISTS { + my ($self, $index) = @_; + return $index < $self->FETCHSIZE; +} + +sub DELETE { + my ($self, $index) = @_; + my @temp = split($sep, $ENV{$$self}); + my $value = splice(@temp, $index, 1, ()); + $ENV{$$self} = join($sep, @temp); + return $value; +} + +sub PUSH { + my $self = shift; + my @temp = split($sep, $ENV{$$self}); + push @temp, @_; + $ENV{$$self} = join($sep, @temp); + return scalar(@temp); +} + +sub POP { + my ($self) = @_; + my @temp = split($sep, $ENV{$$self}); + my $result = pop @temp; + $ENV{$$self} = join($sep, @temp); + return $result; +} + +sub UNSHIFT { + my $self = shift; + my @temp = split($sep, $ENV{$$self}); + my $result = unshift @temp, @_; + $ENV{$$self} = join($sep, @temp); + return $result; +} + +sub SHIFT { + my ($self) = @_; + my @temp = split($sep, $ENV{$$self}); + my $result = shift @temp; + $ENV{$$self} = join($sep, @temp); + return $result; +} + +sub SPLICE { + my $self = shift; + my $offset = shift; + my $length = shift; + my @temp = split($sep, $ENV{$$self}); + if (wantarray) { + my @result = splice @temp, $offset, $length, @_; + $ENV{$$self} = join($sep, @temp); + return @result; + } else { + my $result = scalar splice @temp, $offset, $length, @_; + $ENV{$$self} = join($sep, @temp); + return $result; + } +} + +###################################################################### + +package Env::Array::VMS; +use Tie::Array; + +@ISA = qw(Tie::Array); + +sub TIEARRAY { + bless \($_[1]); +} + +sub FETCHSIZE { + my ($self) = @_; + my $i = 0; + while ($i < 127 and defined $ENV{$$self . ';' . $i}) { $i++; }; + return $i; +} + +sub FETCH { + my ($self, $index) = @_; + return $ENV{$$self . ';' . $index}; +} + +sub EXISTS { + my ($self, $index) = @_; + return $index < $self->FETCHSIZE; +} + +sub DELETE { } + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Exporter.pm b/data/miniconda3/lib/perl5/core_perl/Exporter.pm new file mode 100644 index 0000000000000000000000000000000000000000..19d7645ac5a344a4d5b43358e479ec46eeb4d077 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Exporter.pm @@ -0,0 +1,591 @@ +package Exporter; + +require 5.006; + +# Be lean. +#use strict; +#no strict 'refs'; + +our $Debug = 0; +our $ExportLevel = 0; +our $Verbose ||= 0; +our $VERSION = '5.74'; +our (%Cache); + +sub as_heavy { + require Exporter::Heavy; + # Unfortunately, this does not work if the caller is aliased as *name = \&foo + # Thus the need to create a lot of identical subroutines + my $c = (caller(1))[3]; + $c =~ s/.*:://; + \&{"Exporter::Heavy::heavy_$c"}; +} + +sub export { + goto &{as_heavy()}; +} + +sub import { + my $pkg = shift; + my $callpkg = caller($ExportLevel); + + if ($pkg eq "Exporter" and @_ and $_[0] eq "import") { + *{$callpkg."::import"} = \&import; + return; + } + + # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-( + my $exports = \@{"$pkg\::EXPORT"}; + # But, avoid creating things if they don't exist, which saves a couple of + # hundred bytes per package processed. + my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"}; + return export $pkg, $callpkg, @_ + if $Verbose or $Debug or $fail && @$fail > 1; + my $export_cache = ($Cache{$pkg} ||= {}); + my $args = @_ or @_ = @$exports; + + if ($args and not %$export_cache) { + s/^&//, $export_cache->{$_} = 1 + foreach (@$exports, @{"$pkg\::EXPORT_OK"}); + } + my $heavy; + # Try very hard not to use {} and hence have to enter scope on the foreach + # We bomb out of the loop with last as soon as heavy is set. + if ($args or $fail) { + ($heavy = (/\W/ or $args and not exists $export_cache->{$_} + or $fail and @$fail and $_ eq $fail->[0])) and last + foreach (@_); + } else { + ($heavy = /\W/) and last + foreach (@_); + } + return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy; + local $SIG{__WARN__} = + sub {require Carp; &Carp::carp} if not $SIG{__WARN__}; + # shortcut for the common case of no type character + *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_; +} + +# Default methods + +sub export_fail { + my $self = shift; + @_; +} + +# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as +# *name = \&foo. Thus the need to create a lot of identical subroutines +# Otherwise we could have aliased them to export(). + +sub export_to_level { + goto &{as_heavy()}; +} + +sub export_tags { + goto &{as_heavy()}; +} + +sub export_ok_tags { + goto &{as_heavy()}; +} + +sub require_version { + goto &{as_heavy()}; +} + +1; +__END__ + +=head1 NAME + +Exporter - Implements default import method for modules + +=head1 SYNOPSIS + +In module F<YourModule.pm>: + + package YourModule; + require Exporter; + our @ISA = qw(Exporter); + our @EXPORT_OK = qw(munge frobnicate); # symbols to export on request + +or + + package YourModule; + use Exporter 'import'; # gives you Exporter's import() method directly + our @EXPORT_OK = qw(munge frobnicate); # symbols to export on request + +In other files which wish to use C<YourModule>: + + use YourModule qw(frobnicate); # import listed symbols + frobnicate ($left, $right) # calls YourModule::frobnicate + +Take a look at L</Good Practices> for some variants +you will like to use in modern Perl code. + +=head1 DESCRIPTION + +The Exporter module implements an C<import> method which allows a module +to export functions and variables to its users' namespaces. Many modules +use Exporter rather than implementing their own C<import> method because +Exporter provides a highly flexible interface, with an implementation optimised +for the common case. + +Perl automatically calls the C<import> method when processing a +C<use> statement for a module. Modules and C<use> are documented +in L<perlfunc> and L<perlmod>. Understanding the concept of +modules and how the C<use> statement operates is important to +understanding the Exporter. + +=head2 How to Export + +The arrays C<@EXPORT> and C<@EXPORT_OK> in a module hold lists of +symbols that are going to be exported into the users name space by +default, or which they can request to be exported, respectively. The +symbols can represent functions, scalars, arrays, hashes, or typeglobs. +The symbols must be given by full name with the exception that the +ampersand in front of a function is optional, e.g. + + our @EXPORT = qw(afunc $scalar @array); # afunc is a function + our @EXPORT_OK = qw(&bfunc %hash *typeglob); # explicit prefix on &bfunc + +If you are only exporting function names it is recommended to omit the +ampersand, as the implementation is faster this way. + +=head2 Selecting What to Export + +Do B<not> export method names! + +Do B<not> export anything else by default without a good reason! + +Exports pollute the namespace of the module user. If you must export +try to use C<@EXPORT_OK> in preference to C<@EXPORT> and avoid short or +common symbol names to reduce the risk of name clashes. + +Generally anything not exported is still accessible from outside the +module using the C<YourModule::item_name> (or C<< $blessed_ref->method >>) +syntax. By convention you can use a leading underscore on names to +informally indicate that they are 'internal' and not for public use. + +(It is actually possible to get private functions by saying: + + my $subref = sub { ... }; + $subref->(@args); # Call it as a function + $obj->$subref(@args); # Use it as a method + +However if you use them for methods it is up to you to figure out +how to make inheritance work.) + +As a general rule, if the module is trying to be object oriented +then export nothing. If it's just a collection of functions then +C<@EXPORT_OK> anything but use C<@EXPORT> with caution. For function and +method names use barewords in preference to names prefixed with +ampersands for the export lists. + +Other module design guidelines can be found in L<perlmod>. + +=head2 How to Import + +In other files which wish to use your module there are three basic ways for +them to load your module and import its symbols: + +=over 4 + +=item C<use YourModule;> + +This imports all the symbols from YourModule's C<@EXPORT> into the namespace +of the C<use> statement. + +=item C<use YourModule ();> + +This causes perl to load your module but does not import any symbols. + +=item C<use YourModule qw(...);> + +This imports only the symbols listed by the caller into their namespace. +All listed symbols must be in your C<@EXPORT> or C<@EXPORT_OK>, else an error +occurs. The advanced export features of Exporter are accessed like this, +but with list entries that are syntactically distinct from symbol names. + +=back + +Unless you want to use its advanced features, this is probably all you +need to know to use Exporter. + +=head1 Advanced Features + +=head2 Specialised Import Lists + +If any of the entries in an import list begins with !, : or / then +the list is treated as a series of specifications which either add to +or delete from the list of names to import. They are processed left to +right. Specifications are in the form: + + [!]name This name only + [!]:DEFAULT All names in @EXPORT + [!]:tag All names in $EXPORT_TAGS{tag} anonymous array + [!]/pattern/ All names in @EXPORT and @EXPORT_OK which match + +A leading ! indicates that matching names should be deleted from the +list of names to import. If the first specification is a deletion it +is treated as though preceded by :DEFAULT. If you just want to import +extra names in addition to the default set you will still need to +include :DEFAULT explicitly. + +e.g., F<Module.pm> defines: + + our @EXPORT = qw(A1 A2 A3 A4 A5); + our @EXPORT_OK = qw(B1 B2 B3 B4 B5); + our %EXPORT_TAGS = (T1 => [qw(A1 A2 B1 B2)], T2 => [qw(A1 A2 B3 B4)]); + +Note that you cannot use tags in @EXPORT or @EXPORT_OK. + +Names in EXPORT_TAGS must also appear in @EXPORT or @EXPORT_OK. + +An application using Module can say something like: + + use Module qw(:DEFAULT :T2 !B3 A3); + +Other examples include: + + use Socket qw(!/^[AP]F_/ !SOMAXCONN !SOL_SOCKET); + use POSIX qw(:errno_h :termios_h !TCSADRAIN !/^EXIT/); + +Remember that most patterns (using //) will need to be anchored +with a leading ^, e.g., C</^EXIT/> rather than C</EXIT/>. + +You can say C<BEGIN { $Exporter::Verbose=1 }> to see how the +specifications are being processed and what is actually being imported +into modules. + +=head2 Exporting Without Using Exporter's import Method + +Exporter has a special method, 'export_to_level' which is used in situations +where you can't directly call Exporter's +import method. The export_to_level +method looks like: + + MyPackage->export_to_level( + $where_to_export, $package, @what_to_export + ); + +where C<$where_to_export> is an integer telling how far up the calling stack +to export your symbols, and C<@what_to_export> is an array telling what +symbols *to* export (usually this is C<@_>). The C<$package> argument is +currently unused. + +For example, suppose that you have a module, A, which already has an +import function: + + package A; + + our @ISA = qw(Exporter); + our @EXPORT_OK = qw($b); + + sub import + { + $A::b = 1; # not a very useful import method + } + +and you want to Export symbol C<$A::b> back to the module that called +package A. Since Exporter relies on the import method to work, via +inheritance, as it stands Exporter::import() will never get called. +Instead, say the following: + + package A; + our @ISA = qw(Exporter); + our @EXPORT_OK = qw($b); + + sub import + { + $A::b = 1; + A->export_to_level(1, @_); + } + +This will export the symbols one level 'above' the current package - ie: to +the program or module that used package A. + +Note: Be careful not to modify C<@_> at all before you call export_to_level +- or people using your package will get very unexplained results! + +=head2 Exporting Without Inheriting from Exporter + +By including Exporter in your C<@ISA> you inherit an Exporter's import() method +but you also inherit several other helper methods which you probably don't +want. To avoid this you can do: + + package YourModule; + use Exporter qw(import); + +which will export Exporter's own import() method into YourModule. +Everything will work as before but you won't need to include Exporter in +C<@YourModule::ISA>. + +Note: This feature was introduced in version 5.57 +of Exporter, released with perl 5.8.3. + +=head2 Module Version Checking + +The Exporter module will convert an attempt to import a number from a +module into a call to C<< $module_name->VERSION($value) >>. This can +be used to validate that the version of the module being used is +greater than or equal to the required version. + +For historical reasons, Exporter supplies a C<require_version> method that +simply delegates to C<VERSION>. Originally, before C<UNIVERSAL::VERSION> +existed, Exporter would call C<require_version>. + +Since the C<UNIVERSAL::VERSION> method treats the C<$VERSION> number as +a simple numeric value it will regard version 1.10 as lower than +1.9. For this reason it is strongly recommended that you use numbers +with at least two decimal places, e.g., 1.09. + +=head2 Managing Unknown Symbols + +In some situations you may want to prevent certain symbols from being +exported. Typically this applies to extensions which have functions +or constants that may not exist on some systems. + +The names of any symbols that cannot be exported should be listed +in the C<@EXPORT_FAIL> array. + +If a module attempts to import any of these symbols the Exporter +will give the module an opportunity to handle the situation before +generating an error. The Exporter will call an export_fail method +with a list of the failed symbols: + + @failed_symbols = $module_name->export_fail(@failed_symbols); + +If the C<export_fail> method returns an empty list then no error is +recorded and all the requested symbols are exported. If the returned +list is not empty then an error is generated for each symbol and the +export fails. The Exporter provides a default C<export_fail> method which +simply returns the list unchanged. + +Uses for the C<export_fail> method include giving better error messages +for some symbols and performing lazy architectural checks (put more +symbols into C<@EXPORT_FAIL> by default and then take them out if someone +actually tries to use them and an expensive check shows that they are +usable on that platform). + +=head2 Tag Handling Utility Functions + +Since the symbols listed within C<%EXPORT_TAGS> must also appear in either +C<@EXPORT> or C<@EXPORT_OK>, two utility functions are provided which allow +you to easily add tagged sets of symbols to C<@EXPORT> or C<@EXPORT_OK>: + + our %EXPORT_TAGS = (foo => [qw(aa bb cc)], bar => [qw(aa cc dd)]); + + Exporter::export_tags('foo'); # add aa, bb and cc to @EXPORT + Exporter::export_ok_tags('bar'); # add aa, cc and dd to @EXPORT_OK + +Any names which are not tags are added to C<@EXPORT> or C<@EXPORT_OK> +unchanged but will trigger a warning (with C<-w>) to avoid misspelt tags +names being silently added to C<@EXPORT> or C<@EXPORT_OK>. Future versions +may make this a fatal error. + +=head2 Generating Combined Tags + +If several symbol categories exist in C<%EXPORT_TAGS>, it's usually +useful to create the utility ":all" to simplify "use" statements. + +The simplest way to do this is: + + our %EXPORT_TAGS = (foo => [qw(aa bb cc)], bar => [qw(aa cc dd)]); + + # add all the other ":class" tags to the ":all" class, + # deleting duplicates + { + my %seen; + + push @{$EXPORT_TAGS{all}}, + grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; + } + +F<CGI.pm> creates an ":all" tag which contains some (but not really +all) of its categories. That could be done with one small +change: + + # add some of the other ":class" tags to the ":all" class, + # deleting duplicates + { + my %seen; + + push @{$EXPORT_TAGS{all}}, + grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} + foreach qw/html2 html3 netscape form cgi internal/; + } + +Note that the tag names in C<%EXPORT_TAGS> don't have the leading ':'. + +=head2 C<AUTOLOAD>ed Constants + +Many modules make use of C<AUTOLOAD>ing for constant subroutines to +avoid having to compile and waste memory on rarely used values (see +L<perlsub> for details on constant subroutines). Calls to such +constant subroutines are not optimized away at compile time because +they can't be checked at compile time for constancy. + +Even if a prototype is available at compile time, the body of the +subroutine is not (it hasn't been C<AUTOLOAD>ed yet). perl needs to +examine both the C<()> prototype and the body of a subroutine at +compile time to detect that it can safely replace calls to that +subroutine with the constant value. + +A workaround for this is to call the constants once in a C<BEGIN> block: + + package My ; + + use Socket ; + + foo( SO_LINGER ); ## SO_LINGER NOT optimized away; called at runtime + BEGIN { SO_LINGER } + foo( SO_LINGER ); ## SO_LINGER optimized away at compile time. + +This forces the C<AUTOLOAD> for C<SO_LINGER> to take place before +SO_LINGER is encountered later in C<My> package. + +If you are writing a package that C<AUTOLOAD>s, consider forcing +an C<AUTOLOAD> for any constants explicitly imported by other packages +or which are usually used when your package is C<use>d. + +=head1 Good Practices + +=head2 Declaring C<@EXPORT_OK> and Friends + +When using C<Exporter> with the standard C<strict> and C<warnings> +pragmas, the C<our> keyword is needed to declare the package +variables C<@EXPORT_OK>, C<@EXPORT>, C<@ISA>, etc. + + our @ISA = qw(Exporter); + our @EXPORT_OK = qw(munge frobnicate); + +If backward compatibility for Perls B<under> 5.6 is important, +one must write instead a C<use vars> statement. + + use vars qw(@ISA @EXPORT_OK); + @ISA = qw(Exporter); + @EXPORT_OK = qw(munge frobnicate); + +=head2 Playing Safe + +There are some caveats with the use of runtime statements +like C<require Exporter> and the assignment to package +variables, which can be very subtle for the unaware programmer. +This may happen for instance with mutually recursive +modules, which are affected by the time the relevant +constructions are executed. + +The ideal (but a bit ugly) way to never have to think +about that is to use C<BEGIN> blocks. So the first part +of the L</SYNOPSIS> code could be rewritten as: + + package YourModule; + + use strict; + use warnings; + + our (@ISA, @EXPORT_OK); + BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw(munge frobnicate); # symbols to export on request + } + +The C<BEGIN> will assure that the loading of F<Exporter.pm> +and the assignments to C<@ISA> and C<@EXPORT_OK> happen +immediately, leaving no room for something to get awry +or just plain wrong. + +With respect to loading C<Exporter> and inheriting, there +are alternatives with the use of modules like C<base> and C<parent>. + + use base qw(Exporter); + # or + use parent qw(Exporter); + +Any of these statements are nice replacements for +C<BEGIN { require Exporter; @ISA = qw(Exporter); }> +with the same compile-time effect. The basic difference +is that C<base> code interacts with declared C<fields> +while C<parent> is a streamlined version of the older +C<base> code to just establish the IS-A relationship. + +For more details, see the documentation and code of +L<base> and L<parent>. + +Another thorough remedy to that runtime +vs. compile-time trap is to use L<Exporter::Easy>, +which is a wrapper of Exporter that allows all +boilerplate code at a single gulp in the +use statement. + + use Exporter::Easy ( + OK => [ qw(munge frobnicate) ], + ); + # @ISA setup is automatic + # all assignments happen at compile time + +=head2 What Not to Export + +You have been warned already in L</Selecting What to Export> +to not export: + +=over 4 + +=item * + +method names (because you don't need to +and that's likely to not do what you want), + +=item * + +anything by default (because you don't want to surprise your users... +badly) + +=item * + +anything you don't need to (because less is more) + +=back + +There's one more item to add to this list. Do B<not> +export variable names. Just because C<Exporter> lets you +do that, it does not mean you should. + + @EXPORT_OK = qw($svar @avar %hvar); # DON'T! + +Exporting variables is not a good idea. They can +change under the hood, provoking horrible +effects at-a-distance that are too hard to track +and to fix. Trust me: they are not worth it. + +To provide the capability to set/get class-wide +settings, it is best instead to provide accessors +as subroutines or class methods instead. + +=head1 SEE ALSO + +C<Exporter> is definitely not the only module with +symbol exporter capabilities. At CPAN, you may find +a bunch of them. Some are lighter. Some +provide improved APIs and features. Pick the one +that fits your needs. The following is +a sample list of such modules. + + Exporter::Easy + Exporter::Lite + Exporter::Renaming + Exporter::Tidy + Sub::Exporter / Sub::Installer + Perl6::Export / Perl6::Export::Attrs + +=head1 LICENSE + +This library is free software. You can redistribute it +and/or modify it under the same terms as Perl itself. + +=cut + + + diff --git a/data/miniconda3/lib/perl5/core_perl/Exporter/Heavy.pm b/data/miniconda3/lib/perl5/core_perl/Exporter/Heavy.pm new file mode 100644 index 0000000000000000000000000000000000000000..004815ea47ba7aeb73694a6fcef4515d1d9f4044 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Exporter/Heavy.pm @@ -0,0 +1,253 @@ +package Exporter::Heavy; + +use strict; +no strict 'refs'; + +# On one line so MakeMaker will see it. +require Exporter; our $VERSION = $Exporter::VERSION; + +=head1 NAME + +Exporter::Heavy - Exporter guts + +=head1 SYNOPSIS + +(internal use only) + +=head1 DESCRIPTION + +No user-serviceable parts inside. + +=cut + +# +# We go to a lot of trouble not to 'require Carp' at file scope, +# because Carp requires Exporter, and something has to give. +# + +sub _rebuild_cache { + my ($pkg, $exports, $cache) = @_; + s/^&// foreach @$exports; + @{$cache}{@$exports} = (1) x @$exports; + my $ok = \@{"${pkg}::EXPORT_OK"}; + if (@$ok) { + s/^&// foreach @$ok; + @{$cache}{@$ok} = (1) x @$ok; + } +} + +sub heavy_export { + + # Save the old __WARN__ handler in case it was defined + my $oldwarn = $SIG{__WARN__}; + + # First make import warnings look like they're coming from the "use". + local $SIG{__WARN__} = sub { + # restore it back so proper stacking occurs + local $SIG{__WARN__} = $oldwarn; + my $text = shift; + if ($text =~ s/ at \S*Exporter\S*.pm line \d+.*\n//) { + require Carp; + local $Carp::CarpLevel = 1; # ignore package calling us too. + Carp::carp($text); + } + else { + warn $text; + } + }; + local $SIG{__DIE__} = sub { + require Carp; + local $Carp::CarpLevel = 1; # ignore package calling us too. + Carp::croak("$_[0]Illegal null symbol in \@${1}::EXPORT") + if $_[0] =~ /^Unable to create sub named "(.*?)::"/; + }; + + my($pkg, $callpkg, @imports) = @_; + my($type, $sym, $cache_is_current, $oops); + my($exports, $export_cache) = (\@{"${pkg}::EXPORT"}, + $Exporter::Cache{$pkg} ||= {}); + + if (@imports) { + if (!%$export_cache) { + _rebuild_cache ($pkg, $exports, $export_cache); + $cache_is_current = 1; + } + + if (grep m{^[/!:]}, @imports) { + my $tagsref = \%{"${pkg}::EXPORT_TAGS"}; + my $tagdata; + my %imports; + my($remove, $spec, @names, @allexports); + # negated first item implies starting with default set: + unshift @imports, ':DEFAULT' if $imports[0] =~ m/^!/; + foreach $spec (@imports){ + $remove = $spec =~ s/^!//; + + if ($spec =~ s/^://){ + if ($spec eq 'DEFAULT'){ + @names = @$exports; + } + elsif ($tagdata = $tagsref->{$spec}) { + @names = @$tagdata; + } + else { + warn qq["$spec" is not defined in %${pkg}::EXPORT_TAGS]; + ++$oops; + next; + } + } + elsif ($spec =~ m:^/(.*)/$:){ + my $patn = $1; + @allexports = keys %$export_cache unless @allexports; # only do keys once + @names = grep(/$patn/, @allexports); # not anchored by default + } + else { + @names = ($spec); # is a normal symbol name + } + + warn "Import ".($remove ? "del":"add").": @names " + if $Exporter::Verbose; + + if ($remove) { + foreach $sym (@names) { delete $imports{$sym} } + } + else { + @imports{@names} = (1) x @names; + } + } + @imports = keys %imports; + } + + my @carp; + foreach $sym (@imports) { + if (!$export_cache->{$sym}) { + if ($sym =~ m/^\d/) { + $pkg->VERSION($sym); # inherit from UNIVERSAL + # If the version number was the only thing specified + # then we should act as if nothing was specified: + if (@imports == 1) { + @imports = @$exports; + last; + } + # We need a way to emulate 'use Foo ()' but still + # allow an easy version check: "use Foo 1.23, ''"; + if (@imports == 2 and !$imports[1]) { + @imports = (); + last; + } + } elsif ($sym !~ s/^&// || !$export_cache->{$sym}) { + # Last chance - see if they've updated EXPORT_OK since we + # cached it. + + unless ($cache_is_current) { + %$export_cache = (); + _rebuild_cache ($pkg, $exports, $export_cache); + $cache_is_current = 1; + } + + if (!$export_cache->{$sym}) { + # accumulate the non-exports + push @carp, + qq["$sym" is not exported by the $pkg module]; + $oops++; + } + } + } + } + if ($oops) { + require Carp; + Carp::croak(join("\n", @carp, "Can't continue after import errors")); + } + } + else { + @imports = @$exports; + } + + my($fail, $fail_cache) = (\@{"${pkg}::EXPORT_FAIL"}, + $Exporter::FailCache{$pkg} ||= {}); + + if (@$fail) { + if (!%$fail_cache) { + # Build cache of symbols. Optimise the lookup by adding + # barewords twice... both with and without a leading &. + # (Technique could be applied to $export_cache at cost of memory) + my @expanded = map { /^\w/ ? ($_, '&'.$_) : $_ } @$fail; + warn "${pkg}::EXPORT_FAIL cached: @expanded" if $Exporter::Verbose; + @{$fail_cache}{@expanded} = (1) x @expanded; + } + my @failed; + foreach $sym (@imports) { push(@failed, $sym) if $fail_cache->{$sym} } + if (@failed) { + @failed = $pkg->export_fail(@failed); + foreach $sym (@failed) { + require Carp; + Carp::carp(qq["$sym" is not implemented by the $pkg module ], + "on this architecture"); + } + if (@failed) { + require Carp; + Carp::croak("Can't continue after import errors"); + } + } + } + + warn "Importing into $callpkg from $pkg: ", + join(", ",sort @imports) if $Exporter::Verbose; + + foreach $sym (@imports) { + # shortcut for the common case of no type character + (*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next) + unless $sym =~ s/^(\W)//; + $type = $1; + no warnings 'once'; + *{"${callpkg}::$sym"} = + $type eq '&' ? \&{"${pkg}::$sym"} : + $type eq '$' ? \${"${pkg}::$sym"} : + $type eq '@' ? \@{"${pkg}::$sym"} : + $type eq '%' ? \%{"${pkg}::$sym"} : + $type eq '*' ? *{"${pkg}::$sym"} : + do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; + } +} + +sub heavy_export_to_level +{ + my $pkg = shift; + my $level = shift; + (undef) = shift; # XXX redundant arg + my $callpkg = caller($level); + $pkg->export($callpkg, @_); +} + +# Utility functions + +sub _push_tags { + my($pkg, $var, $syms) = @_; + my @nontag = (); + my $export_tags = \%{"${pkg}::EXPORT_TAGS"}; + push(@{"${pkg}::$var"}, + map { $export_tags->{$_} ? @{$export_tags->{$_}} + : scalar(push(@nontag,$_),$_) } + (@$syms) ? @$syms : keys %$export_tags); + if (@nontag and $^W) { + # This may change to a die one day + require Carp; + Carp::carp(join(", ", @nontag)." are not tags of $pkg"); + } +} + +sub heavy_require_version { + my($self, $wanted) = @_; + my $pkg = ref $self || $self; + return ${pkg}->VERSION($wanted); +} + +sub heavy_export_tags { + _push_tags((caller)[0], "EXPORT", \@_); +} + +sub heavy_export_ok_tags { + _push_tags((caller)[0], "EXPORT_OK", \@_); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/CBuilder.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/CBuilder.pm new file mode 100644 index 0000000000000000000000000000000000000000..60b1662d58eedf48a0b388e70d189f23f0134329 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/CBuilder.pm @@ -0,0 +1,298 @@ +package ExtUtils::CBuilder; + +use File::Spec (); +use File::Path (); +use File::Basename (); +use Perl::OSType qw/os_type/; + +use warnings; +use strict; +our $VERSION = '0.280234'; # VERSION +our @ISA; + +# We only use this once - don't waste a symbol table entry on it. +# More importantly, don't make it an inheritable method. +my $load = sub { + my $mod = shift; + eval "use $mod"; + die $@ if $@; + @ISA = ($mod); +}; + +{ + my @package = split /::/, __PACKAGE__; + + my $ostype = os_type(); + + if (grep {-e File::Spec->catfile($_, @package, 'Platform', $^O) . '.pm'} @INC) { + $load->(__PACKAGE__ . "::Platform::$^O"); + + } elsif ( $ostype && + grep {-e File::Spec->catfile($_, @package, 'Platform', $ostype) . '.pm'} @INC) { + $load->(__PACKAGE__ . "::Platform::$ostype"); + + } else { + $load->(__PACKAGE__ . "::Base"); + } +} + +1; +__END__ + +=head1 NAME + +ExtUtils::CBuilder - Compile and link C code for Perl modules + +=head1 SYNOPSIS + + use ExtUtils::CBuilder; + + my $b = ExtUtils::CBuilder->new(%options); + $obj_file = $b->compile(source => 'MyModule.c'); + $lib_file = $b->link(objects => $obj_file); + +=head1 DESCRIPTION + +This module can build the C portions of Perl modules by invoking the +appropriate compilers and linkers in a cross-platform manner. It was +motivated by the C<Module::Build> project, but may be useful for other +purposes as well. However, it is I<not> intended as a general +cross-platform interface to all your C building needs. That would +have been a much more ambitious goal! + +=head1 METHODS + +=over 4 + +=item new + +Returns a new C<ExtUtils::CBuilder> object. A C<config> parameter +lets you override C<Config.pm> settings for all operations performed +by the object, as in the following example: + + # Use a different compiler than Config.pm says + my $b = ExtUtils::CBuilder->new( config => + { ld => 'gcc' } ); + +A C<quiet> parameter tells C<CBuilder> to not print its C<system()> +commands before executing them: + + # Be quieter than normal + my $b = ExtUtils::CBuilder->new( quiet => 1 ); + +=item have_compiler + +Returns true if the current system has a working C compiler and +linker, false otherwise. To determine this, we actually compile and +link a sample C library. The sample will be compiled in the system +tempdir or, if that fails for some reason, in the current directory. + +=item have_cplusplus + +Just like have_compiler but for C++ instead of C. + +=item compile + +Compiles a C source file and produces an object file. The name of the +object file is returned. The source file is specified in a C<source> +parameter, which is required; the other parameters listed below are +optional. + +=over 4 + +=item C<object_file> + +Specifies the name of the output file to create. Otherwise the +C<object_file()> method will be consulted, passing it the name of the +C<source> file. + +=item C<include_dirs> + +Specifies any additional directories in which to search for header +files. May be given as a string indicating a single directory, or as +a list reference indicating multiple directories. + +=item C<extra_compiler_flags> + +Specifies any additional arguments to pass to the compiler. Should be +given as a list reference containing the arguments individually, or if +this is not possible, as a string containing all the arguments +together. + +=item C<C++> + +Specifies that the source file is a C++ source file and sets appropriate +compiler flags + +=back + +The operation of this method is also affected by the +C<archlibexp>, C<cccdlflags>, C<ccflags>, C<optimize>, and C<cc> +entries in C<Config.pm>. + +=item link + +Invokes the linker to produce a library file from object files. In +scalar context, the name of the library file is returned. In list +context, the library file and any temporary files created are +returned. A required C<objects> parameter contains the name of the +object files to process, either in a string (for one object file) or +list reference (for one or more files). The following parameters are +optional: + + +=over 4 + +=item lib_file + +Specifies the name of the output library file to create. Otherwise +the C<lib_file()> method will be consulted, passing it the name of +the first entry in C<objects>. + +=item module_name + +Specifies the name of the Perl module that will be created by linking. +On platforms that need to do prelinking (Win32, OS/2, etc.) this is a +required parameter. + +=item extra_linker_flags + +Any additional flags you wish to pass to the linker. + +=back + +On platforms where C<need_prelink()> returns true, C<prelink()> +will be called automatically. + +The operation of this method is also affected by the C<lddlflags>, +C<shrpenv>, and C<ld> entries in C<Config.pm>. + +=item link_executable + +Invokes the linker to produce an executable file from object files. In +scalar context, the name of the executable file is returned. In list +context, the executable file and any temporary files created are +returned. A required C<objects> parameter contains the name of the +object files to process, either in a string (for one object file) or +list reference (for one or more files). The optional parameters are +the same as C<link> with exception for + + +=over 4 + +=item exe_file + +Specifies the name of the output executable file to create. Otherwise +the C<exe_file()> method will be consulted, passing it the name of the +first entry in C<objects>. + +=back + +=item object_file + + my $object_file = $b->object_file($source_file); + +Converts the name of a C source file to the most natural name of an +output object file to create from it. For instance, on Unix the +source file F<foo.c> would result in the object file F<foo.o>. + +=item lib_file + + my $lib_file = $b->lib_file($object_file); + +Converts the name of an object file to the most natural name of a +output library file to create from it. For instance, on Mac OS X the +object file F<foo.o> would result in the library file F<foo.bundle>. + +=item exe_file + + my $exe_file = $b->exe_file($object_file); + +Converts the name of an object file to the most natural name of an +executable file to create from it. For instance, on Mac OS X the +object file F<foo.o> would result in the executable file F<foo>, and +on Windows it would result in F<foo.exe>. + + +=item prelink + +On certain platforms like Win32, OS/2, VMS, and AIX, it is necessary +to perform some actions before invoking the linker. The +C<ExtUtils::Mksymlists> module does this, writing files used by the +linker during the creation of shared libraries for dynamic extensions. +The names of any files written will be returned as a list. + +Several parameters correspond to C<ExtUtils::Mksymlists::Mksymlists()> +options, as follows: + + Mksymlists() prelink() type + -------------|-------------------|------------------- + NAME | dl_name | string (required) + DLBASE | dl_base | string + FILE | dl_file | string + DL_VARS | dl_vars | array reference + DL_FUNCS | dl_funcs | hash reference + FUNCLIST | dl_func_list | array reference + IMPORTS | dl_imports | hash reference + VERSION | dl_version | string + +Please see the documentation for C<ExtUtils::Mksymlists> for the +details of what these parameters do. + +=item need_prelink + +Returns true on platforms where C<prelink()> should be called +during linking, and false otherwise. + +=item extra_link_args_after_prelink + +Returns list of extra arguments to give to the link command; the arguments +are the same as for prelink(), with addition of array reference to the +results of prelink(); this reference is indexed by key C<prelink_res>. + +=back + +=head1 TO DO + +Currently this has only been tested on Unix and doesn't contain any of +the Windows-specific code from the C<Module::Build> project. I'll do +that next. + +=head1 HISTORY + +This module is an outgrowth of the C<Module::Build> project, to which +there have been many contributors. Notably, Randy W. Sims submitted +lots of code to support 3 compilers on Windows and helped with various +other platform-specific issues. Ilya Zakharevich has contributed +fixes for OS/2; John E. Malmberg and Peter Prymmer have done likewise +for VMS. + +=head1 SUPPORT + +ExtUtils::CBuilder is maintained as part of the Perl 5 core. Please +submit any bug reports via the F<perlbug> tool included with Perl 5. +Bug reports will be included in the Perl 5 ticket system at +L<https://rt.perl.org>. + +The Perl 5 source code is available at L<https://perl5.git.perl.org/perl.git> +and ExtUtils-CBuilder may be found in the F<dist/ExtUtils-CBuilder> directory +of the repository. + +=head1 AUTHOR + +Ken Williams, kwilliams@cpan.org + +Additional contributions by The Perl 5 Porters. + +=head1 COPYRIGHT + +Copyright (c) 2003-2005 Ken Williams. All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +perl(1), Module::Build(3) + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Command.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Command.pm new file mode 100644 index 0000000000000000000000000000000000000000..c5101c37b7d44e69c963367d8a11164bd26f26b2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Command.pm @@ -0,0 +1,381 @@ +package ExtUtils::Command; + +use 5.00503; +use strict; +require Exporter; +use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); +@ISA = qw(Exporter); +@EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f test_d chmod + dos2unix); +$VERSION = '7.44'; +$VERSION =~ tr/_//d; + +my $Is_VMS = $^O eq 'VMS'; +my $Is_VMS_mode = $Is_VMS; +my $Is_VMS_noefs = $Is_VMS; +my $Is_Win32 = $^O eq 'MSWin32'; + +if( $Is_VMS ) { + my $vms_unix_rpt; + my $vms_efs; + my $vms_case; + + if (eval { local $SIG{__DIE__}; + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + require VMS::Feature; }) { + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); + $vms_efs = VMS::Feature::current("efs_charset"); + $vms_case = VMS::Feature::current("efs_case_preserve"); + } else { + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_case = $efs_case =~ /^[ET1]/i; + } + $Is_VMS_mode = 0 if $vms_unix_rpt; + $Is_VMS_noefs = 0 if ($vms_efs); +} + + +=head1 NAME + +ExtUtils::Command - utilities to replace common UNIX commands in Makefiles etc. + +=head1 SYNOPSIS + + perl -MExtUtils::Command -e cat files... > destination + perl -MExtUtils::Command -e mv source... destination + perl -MExtUtils::Command -e cp source... destination + perl -MExtUtils::Command -e touch files... + perl -MExtUtils::Command -e rm_f files... + perl -MExtUtils::Command -e rm_rf directories... + perl -MExtUtils::Command -e mkpath directories... + perl -MExtUtils::Command -e eqtime source destination + perl -MExtUtils::Command -e test_f file + perl -MExtUtils::Command -e test_d directory + perl -MExtUtils::Command -e chmod mode files... + ... + +=head1 DESCRIPTION + +The module is used to replace common UNIX commands. In all cases the +functions work from @ARGV rather than taking arguments. This makes +them easier to deal with in Makefiles. Call them like this: + + perl -MExtUtils::Command -e some_command some files to work on + +and I<NOT> like this: + + perl -MExtUtils::Command -e 'some_command qw(some files to work on)' + +For that use L<Shell::Command>. + +Filenames with * and ? will be glob expanded. + + +=head2 FUNCTIONS + +=over 4 + +=cut + +# VMS uses % instead of ? to mean "one character" +my $wild_regex = $Is_VMS ? '*%' : '*?'; +sub expand_wildcards +{ + @ARGV = map(/[$wild_regex]/o ? glob($_) : $_,@ARGV); +} + + +=item cat + + cat file ... + +Concatenates all files mentioned on command line to STDOUT. + +=cut + +sub cat () +{ + expand_wildcards(); + print while (<>); +} + +=item eqtime + + eqtime source destination + +Sets modified time of destination to that of source. + +=cut + +sub eqtime +{ + my ($src,$dst) = @ARGV; + local @ARGV = ($dst); touch(); # in case $dst doesn't exist + utime((stat($src))[8,9],$dst); +} + +=item rm_rf + + rm_rf files or directories ... + +Removes files and directories - recursively (even if readonly) + +=cut + +sub rm_rf +{ + expand_wildcards(); + require File::Path; + File::Path::rmtree([grep -e $_,@ARGV],0,0); +} + +=item rm_f + + rm_f file ... + +Removes files (even if readonly) + +=cut + +sub rm_f { + expand_wildcards(); + + foreach my $file (@ARGV) { + next unless -f $file; + + next if _unlink($file); + + chmod(0777, $file); + + next if _unlink($file); + + require Carp; + Carp::carp("Cannot delete $file: $!"); + } +} + +sub _unlink { + my $files_unlinked = 0; + foreach my $file (@_) { + my $delete_count = 0; + $delete_count++ while unlink $file; + $files_unlinked++ if $delete_count; + } + return $files_unlinked; +} + + +=item touch + + touch file ... + +Makes files exist, with current timestamp + +=cut + +sub touch { + my $t = time; + expand_wildcards(); + foreach my $file (@ARGV) { + open(FILE,">>$file") || die "Cannot write $file:$!"; + close(FILE); + utime($t,$t,$file); + } +} + +=item mv + + mv source_file destination_file + mv source_file source_file destination_dir + +Moves source to destination. Multiple sources are allowed if +destination is an existing directory. + +Returns true if all moves succeeded, false otherwise. + +=cut + +sub mv { + expand_wildcards(); + my @src = @ARGV; + my $dst = pop @src; + + if (@src > 1 && ! -d $dst) { + require Carp; + Carp::croak("Too many arguments"); + } + + require File::Copy; + my $nok = 0; + foreach my $src (@src) { + $nok ||= !File::Copy::move($src,$dst); + } + return !$nok; +} + +=item cp + + cp source_file destination_file + cp source_file source_file destination_dir + +Copies sources to the destination. Multiple sources are allowed if +destination is an existing directory. + +Returns true if all copies succeeded, false otherwise. + +=cut + +sub cp { + expand_wildcards(); + my @src = @ARGV; + my $dst = pop @src; + + if (@src > 1 && ! -d $dst) { + require Carp; + Carp::croak("Too many arguments"); + } + + require File::Copy; + my $nok = 0; + foreach my $src (@src) { + $nok ||= !File::Copy::copy($src,$dst); + + # Win32 does not update the mod time of a copied file, just the + # created time which make does not look at. + utime(time, time, $dst) if $Is_Win32; + } + return $nok; +} + +=item chmod + + chmod mode files ... + +Sets UNIX like permissions 'mode' on all the files. e.g. 0666 + +=cut + +sub chmod { + local @ARGV = @ARGV; + my $mode = shift(@ARGV); + expand_wildcards(); + + if( $Is_VMS_mode && $Is_VMS_noefs) { + require File::Spec; + foreach my $idx (0..$#ARGV) { + my $path = $ARGV[$idx]; + next unless -d $path; + + # chmod 0777, [.foo.bar] doesn't work on VMS, you have to do + # chmod 0777, [.foo]bar.dir + my @dirs = File::Spec->splitdir( $path ); + $dirs[-1] .= '.dir'; + $path = File::Spec->catfile(@dirs); + + $ARGV[$idx] = $path; + } + } + + chmod(oct $mode,@ARGV) || die "Cannot chmod ".join(' ',$mode,@ARGV).":$!"; +} + +=item mkpath + + mkpath directory ... + +Creates directories, including any parent directories. + +=cut + +sub mkpath +{ + expand_wildcards(); + require File::Path; + File::Path::mkpath([@ARGV],0,0777); +} + +=item test_f + + test_f file + +Tests if a file exists. I<Exits> with 0 if it does, 1 if it does not (ie. +shell's idea of true and false). + +=cut + +sub test_f +{ + exit(-f $ARGV[0] ? 0 : 1); +} + +=item test_d + + test_d directory + +Tests if a directory exists. I<Exits> with 0 if it does, 1 if it does +not (ie. shell's idea of true and false). + +=cut + +sub test_d +{ + exit(-d $ARGV[0] ? 0 : 1); +} + +=item dos2unix + + dos2unix files or dirs ... + +Converts DOS and OS/2 linefeeds to Unix style recursively. + +=cut + +sub dos2unix { + require File::Find; + File::Find::find(sub { + return if -d; + return unless -w _; + return unless -r _; + return if -B _; + + local $\; + + my $orig = $_; + my $temp = '.dos2unix_tmp'; + open ORIG, $_ or do { warn "dos2unix can't open $_: $!"; return }; + open TEMP, ">$temp" or + do { warn "dos2unix can't create .dos2unix_tmp: $!"; return }; + binmode ORIG; binmode TEMP; + while (my $line = <ORIG>) { + $line =~ s/\015\012/\012/g; + print TEMP $line; + } + close ORIG; + close TEMP; + rename $temp, $orig; + + }, @ARGV); +} + +=back + +=head1 SEE ALSO + +Shell::Command which is these same functions but take arguments normally. + + +=head1 AUTHOR + +Nick Ing-Simmons C<ni-s@cpan.org> + +Maintained by Michael G Schwern C<schwern@pobox.com> within the +ExtUtils-MakeMaker package and, as a separate CPAN package, by +Randy Kobes C<r.kobes@uwinnipeg.ca>. + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Constant.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Constant.pm new file mode 100644 index 0000000000000000000000000000000000000000..e6d71f9b10be03405114e579a1f070f8314794ed --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Constant.pm @@ -0,0 +1,567 @@ +package ExtUtils::Constant; +use vars qw (@ISA $VERSION @EXPORT_OK %EXPORT_TAGS); +$VERSION = '0.25'; + +=head1 NAME + +ExtUtils::Constant - generate XS code to import C header constants + +=head1 SYNOPSIS + + use ExtUtils::Constant qw (WriteConstants); + WriteConstants( + NAME => 'Foo', + NAMES => [qw(FOO BAR BAZ)], + ); + # Generates wrapper code to make the values of the constants FOO BAR BAZ + # available to perl + +=head1 DESCRIPTION + +ExtUtils::Constant facilitates generating C and XS wrapper code to allow +perl modules to AUTOLOAD constants defined in C library header files. +It is principally used by the C<h2xs> utility, on which this code is based. +It doesn't contain the routines to scan header files to extract these +constants. + +=head1 USAGE + +Generally one only needs to call the C<WriteConstants> function, and then + + #include "const-c.inc" + +in the C section of C<Foo.xs> + + INCLUDE: const-xs.inc + +in the XS section of C<Foo.xs>. + +For greater flexibility use C<constant_types()>, C<C_constant> and +C<XS_constant>, with which C<WriteConstants> is implemented. + +Currently this module understands the following types. h2xs may only know +a subset. The sizes of the numeric types are chosen by the C<Configure> +script at compile time. + +=over 4 + +=item IV + +signed integer, at least 32 bits. + +=item UV + +unsigned integer, the same size as I<IV> + +=item NV + +floating point type, probably C<double>, possibly C<long double> + +=item PV + +NUL terminated string, length will be determined with C<strlen> + +=item PVN + +A fixed length thing, given as a [pointer, length] pair. If you know the +length of a string at compile time you may use this instead of I<PV> + +=item SV + +A B<mortal> SV. + +=item YES + +Truth. (C<PL_sv_yes>) The value is not needed (and ignored). + +=item NO + +Defined Falsehood. (C<PL_sv_no>) The value is not needed (and ignored). + +=item UNDEF + +C<undef>. The value of the macro is not needed. + +=back + +=head1 FUNCTIONS + +=over 4 + +=cut + +if ($] >= 5.006) { + eval "use warnings; 1" or die $@; +} +use strict; +use Carp qw(croak cluck); + +use Exporter; +use ExtUtils::Constant::Utils qw(C_stringify); +use ExtUtils::Constant::XS qw(%XS_Constant %XS_TypeSet); + +@ISA = 'Exporter'; + +%EXPORT_TAGS = ( 'all' => [ qw( + XS_constant constant_types return_clause memEQ_clause C_stringify + C_constant autoload WriteConstants WriteMakefileSnippet +) ] ); + +@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); + +=item constant_types + +A function returning a single scalar with C<#define> definitions for the +constants used internally between the generated C and XS functions. + +=cut + +sub constant_types { + ExtUtils::Constant::XS->header(); +} + +sub memEQ_clause { + cluck "ExtUtils::Constant::memEQ_clause is deprecated"; + ExtUtils::Constant::XS->memEQ_clause({name=>$_[0], checked_at=>$_[1], + indent=>$_[2]}); +} + +sub return_clause ($$) { + cluck "ExtUtils::Constant::return_clause is deprecated"; + my $indent = shift; + ExtUtils::Constant::XS->return_clause({indent=>$indent}, @_); +} + +sub switch_clause { + cluck "ExtUtils::Constant::switch_clause is deprecated"; + my $indent = shift; + my $comment = shift; + ExtUtils::Constant::XS->switch_clause({indent=>$indent, comment=>$comment}, + @_); +} + +sub C_constant { + my ($package, $subname, $default_type, $what, $indent, $breakout, @items) + = @_; + ExtUtils::Constant::XS->C_constant({package => $package, subname => $subname, + default_type => $default_type, + types => $what, indent => $indent, + breakout => $breakout}, @items); +} + +=item XS_constant PACKAGE, TYPES, XS_SUBNAME, C_SUBNAME + +A function to generate the XS code to implement the perl subroutine +I<PACKAGE>::constant used by I<PACKAGE>::AUTOLOAD to load constants. +This XS code is a wrapper around a C subroutine usually generated by +C<C_constant>, and usually named C<constant>. + +I<TYPES> should be given either as a comma separated list of types that the +C subroutine C<constant> will generate or as a reference to a hash. It should +be the same list of types as C<C_constant> was given. +[Otherwise C<XS_constant> and C<C_constant> may have different ideas about +the number of parameters passed to the C function C<constant>] + +You can call the perl visible subroutine something other than C<constant> if +you give the parameter I<XS_SUBNAME>. The C subroutine it calls defaults to +the name of the perl visible subroutine, unless you give the parameter +I<C_SUBNAME>. + +=cut + +sub XS_constant { + my $package = shift; + my $what = shift; + my $XS_subname = shift; + my $C_subname = shift; + $XS_subname ||= 'constant'; + $C_subname ||= $XS_subname; + + if (!ref $what) { + # Convert line of the form IV,UV,NV to hash + $what = {map {$_ => 1} split /,\s*/, ($what)}; + } + my $params = ExtUtils::Constant::XS->params ($what); + my $type; + + my $xs = <<"EOT"; +void +$XS_subname(sv) + PREINIT: +#ifdef dXSTARG + dXSTARG; /* Faster if we have it. */ +#else + dTARGET; +#endif + STRLEN len; + int type; +EOT + + if ($params->{IV}) { + $xs .= " IV iv = 0; /* avoid uninit var warning */\n"; + } else { + $xs .= " /* IV\t\tiv;\tUncomment this if you need to return IVs */\n"; + } + if ($params->{NV}) { + $xs .= " NV nv = 0.0; /* avoid uninit var warning */\n"; + } else { + $xs .= " /* NV\t\tnv;\tUncomment this if you need to return NVs */\n"; + } + if ($params->{PV}) { + $xs .= " const char *pv = NULL; /* avoid uninit var warning */\n"; + } else { + $xs .= + " /* const char\t*pv;\tUncomment this if you need to return PVs */\n"; + } + + $xs .= << 'EOT'; + INPUT: + SV * sv; + const char * s = SvPV(sv, len); +EOT + if ($params->{''}) { + $xs .= << 'EOT'; + INPUT: + int utf8 = SvUTF8(sv); +EOT + } + $xs .= << 'EOT'; + PPCODE: +EOT + + if ($params->{IV} xor $params->{NV}) { + $xs .= << "EOT"; + /* Change this to $C_subname(aTHX_ s, len, &iv, &nv); + if you need to return both NVs and IVs */ +EOT + } + $xs .= " type = $C_subname(aTHX_ s, len"; + $xs .= ', utf8' if $params->{''}; + $xs .= ', &iv' if $params->{IV}; + $xs .= ', &nv' if $params->{NV}; + $xs .= ', &pv' if $params->{PV}; + $xs .= ', &sv' if $params->{SV}; + $xs .= ");\n"; + + # If anyone is insane enough to suggest a package name containing % + my $package_sprintf_safe = $package; + $package_sprintf_safe =~ s/%/%%/g; + + $xs .= << "EOT"; + /* Return 1 or 2 items. First is error message, or undef if no error. + Second, if present, is found value */ + switch (type) { + case PERL_constant_NOTFOUND: + sv = + sv_2mortal(newSVpvf("%s is not a valid $package_sprintf_safe macro", s)); + PUSHs(sv); + break; + case PERL_constant_NOTDEF: + sv = sv_2mortal(newSVpvf( + "Your vendor has not defined $package_sprintf_safe macro %s, used", + s)); + PUSHs(sv); + break; +EOT + + foreach $type (sort keys %XS_Constant) { + # '' marks utf8 flag needed. + next if $type eq ''; + $xs .= "\t/* Uncomment this if you need to return ${type}s\n" + unless $what->{$type}; + $xs .= " case PERL_constant_IS$type:\n"; + if (length $XS_Constant{$type}) { + $xs .= << "EOT"; + EXTEND(SP, 2); + PUSHs(&PL_sv_undef); + $XS_Constant{$type}; +EOT + } else { + # Do nothing. return (), which will be correctly interpreted as + # (undef, undef) + } + $xs .= " break;\n"; + unless ($what->{$type}) { + chop $xs; # Yes, another need for chop not chomp. + $xs .= " */\n"; + } + } + $xs .= << "EOT"; + default: + sv = sv_2mortal(newSVpvf( + "Unexpected return type %d while processing $package_sprintf_safe macro %s, used", + type, s)); + PUSHs(sv); + } +EOT + + return $xs; +} + + +=item autoload PACKAGE, VERSION, AUTOLOADER + +A function to generate the AUTOLOAD subroutine for the module I<PACKAGE> +I<VERSION> is the perl version the code should be backwards compatible with. +It defaults to the version of perl running the subroutine. If I<AUTOLOADER> +is true, the AUTOLOAD subroutine falls back on AutoLoader::AUTOLOAD for all +names that the constant() routine doesn't recognise. + +=cut + +# ' # Grr. syntax highlighters that don't grok pod. + +sub autoload { + my ($module, $compat_version, $autoloader) = @_; + $compat_version ||= $]; + croak "Can't maintain compatibility back as far as version $compat_version" + if $compat_version < 5; + my $func = "sub AUTOLOAD {\n" + . " # This AUTOLOAD is used to 'autoload' constants from the constant()\n" + . " # XS function."; + $func .= " If a constant is not found then control is passed\n" + . " # to the AUTOLOAD in AutoLoader." if $autoloader; + + + $func .= "\n\n" + . " my \$constname;\n"; + $func .= + " our \$AUTOLOAD;\n" if ($compat_version >= 5.006); + + $func .= <<"EOT"; + (\$constname = \$AUTOLOAD) =~ s/.*:://; + croak "&${module}::constant not defined" if \$constname eq 'constant'; + my (\$error, \$val) = constant(\$constname); +EOT + + if ($autoloader) { + $func .= <<'EOT'; + if ($error) { + if ($error =~ /is not a valid/) { + $AutoLoader::AUTOLOAD = $AUTOLOAD; + goto &AutoLoader::AUTOLOAD; + } else { + croak $error; + } + } +EOT + } else { + $func .= + " if (\$error) { croak \$error; }\n"; + } + + $func .= <<'END'; + { + no strict 'refs'; + # Fixed between 5.005_53 and 5.005_61 +#XXX if ($] >= 5.00561) { +#XXX *$AUTOLOAD = sub () { $val }; +#XXX } +#XXX else { + *$AUTOLOAD = sub { $val }; +#XXX } + } + goto &$AUTOLOAD; +} + +END + + return $func; +} + + +=item WriteMakefileSnippet + +WriteMakefileSnippet ATTRIBUTE =E<gt> VALUE [, ...] + +A function to generate perl code for Makefile.PL that will regenerate +the constant subroutines. Parameters are named as passed to C<WriteConstants>, +with the addition of C<INDENT> to specify the number of leading spaces +(default 2). + +Currently only C<INDENT>, C<NAME>, C<DEFAULT_TYPE>, C<NAMES>, C<C_FILE> and +C<XS_FILE> are recognised. + +=cut + +sub WriteMakefileSnippet { + my %args = @_; + my $indent = $args{INDENT} || 2; + + my $result = <<"EOT"; +ExtUtils::Constant::WriteConstants( + NAME => '$args{NAME}', + NAMES => \\\@names, + DEFAULT_TYPE => '$args{DEFAULT_TYPE}', +EOT + foreach (qw (C_FILE XS_FILE)) { + next unless exists $args{$_}; + $result .= sprintf " %-12s => '%s',\n", + $_, $args{$_}; + } + $result .= <<'EOT'; + ); +EOT + + $result =~ s/^/' 'x$indent/gem; + return ExtUtils::Constant::XS->dump_names({default_type=>$args{DEFAULT_TYPE}, + indent=>$indent,}, + @{$args{NAMES}}) + . $result; +} + +=item WriteConstants ATTRIBUTE =E<gt> VALUE [, ...] + +Writes a file of C code and a file of XS code which you should C<#include> +and C<INCLUDE> in the C and XS sections respectively of your module's XS +code. You probably want to do this in your C<Makefile.PL>, so that you can +easily edit the list of constants without touching the rest of your module. +The attributes supported are + +=over 4 + +=item NAME + +Name of the module. This must be specified + +=item DEFAULT_TYPE + +The default type for the constants. If not specified C<IV> is assumed. + +=item BREAKOUT_AT + +The names of the constants are grouped by length. Generate child subroutines +for each group with this number or more names in. + +=item NAMES + +An array of constants' names, either scalars containing names, or hashrefs +as detailed in L<"C_constant">. + +=item PROXYSUBS + +If true, uses proxy subs. See L<ExtUtils::Constant::ProxySubs>. + +=item C_FH + +A filehandle to write the C code to. If not given, then I<C_FILE> is opened +for writing. + +=item C_FILE + +The name of the file to write containing the C code. The default is +C<const-c.inc>. The C<-> in the name ensures that the file can't be +mistaken for anything related to a legitimate perl package name, and +not naming the file C<.c> avoids having to override Makefile.PL's +C<.xs> to C<.c> rules. + +=item XS_FH + +A filehandle to write the XS code to. If not given, then I<XS_FILE> is opened +for writing. + +=item XS_FILE + +The name of the file to write containing the XS code. The default is +C<const-xs.inc>. + +=item XS_SUBNAME + +The perl visible name of the XS subroutine generated which will return the +constants. The default is C<constant>. + +=item C_SUBNAME + +The name of the C subroutine generated which will return the constants. +The default is I<XS_SUBNAME>. Child subroutines have C<_> and the name +length appended, so constants with 10 character names would be in +C<constant_10> with the default I<XS_SUBNAME>. + +=back + +=cut + +sub WriteConstants { + my %ARGS = + ( # defaults + C_FILE => 'const-c.inc', + XS_FILE => 'const-xs.inc', + XS_SUBNAME => 'constant', + DEFAULT_TYPE => 'IV', + @_); + + $ARGS{C_SUBNAME} ||= $ARGS{XS_SUBNAME}; # No-one sane will have C_SUBNAME eq '0' + + croak "Module name not specified" unless length $ARGS{NAME}; + + # Do this before creating (empty) files, in case it fails: + require ExtUtils::Constant::ProxySubs if $ARGS{PROXYSUBS}; + + my $c_fh = $ARGS{C_FH}; + if (!$c_fh) { + if ($] <= 5.008) { + # We need these little games, rather than doing things + # unconditionally, because we're used in core Makefile.PLs before + # IO is available (needed by filehandle), but also we want to work on + # older perls where undefined scalars do not automatically turn into + # anonymous file handles. + require FileHandle; + $c_fh = FileHandle->new(); + } + open $c_fh, ">$ARGS{C_FILE}" or die "Can't open $ARGS{C_FILE}: $!"; + } + + my $xs_fh = $ARGS{XS_FH}; + if (!$xs_fh) { + if ($] <= 5.008) { + require FileHandle; + $xs_fh = FileHandle->new(); + } + open $xs_fh, ">$ARGS{XS_FILE}" or die "Can't open $ARGS{XS_FILE}: $!"; + } + + # As this subroutine is intended to make code that isn't edited, there's no + # need for the user to specify any types that aren't found in the list of + # names. + + if ($ARGS{PROXYSUBS}) { + $ARGS{C_FH} = $c_fh; + $ARGS{XS_FH} = $xs_fh; + ExtUtils::Constant::ProxySubs->WriteConstants(%ARGS); + } else { + my $types = {}; + + print $c_fh constant_types(); # macro defs + print $c_fh "\n"; + + # indent is still undef. Until anyone implements indent style rules with + # it. + foreach (ExtUtils::Constant::XS->C_constant({package => $ARGS{NAME}, + subname => $ARGS{C_SUBNAME}, + default_type => + $ARGS{DEFAULT_TYPE}, + types => $types, + breakout => + $ARGS{BREAKOUT_AT}}, + @{$ARGS{NAMES}})) { + print $c_fh $_, "\n"; # C constant subs + } + print $xs_fh XS_constant ($ARGS{NAME}, $types, $ARGS{XS_SUBNAME}, + $ARGS{C_SUBNAME}); + } + + close $c_fh or warn "Error closing $ARGS{C_FILE}: $!" unless $ARGS{C_FH}; + close $xs_fh or warn "Error closing $ARGS{XS_FILE}: $!" unless $ARGS{XS_FH}; +} + +1; +__END__ + +=back + +=head1 AUTHOR + +Nicholas Clark <nick@ccl4.org> based on the code in C<h2xs> by Larry Wall and +others + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Embed.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Embed.pm new file mode 100644 index 0000000000000000000000000000000000000000..e75e41f8c48468da49b69fbb850d407ea31d36ed --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Embed.pm @@ -0,0 +1,491 @@ +package ExtUtils::Embed; +require Exporter; +use Config; +require File::Spec; + +our ( @Extensions, $opt_o, $opt_s ); +use strict; + +# This is not a dual-life module, so no need for development version numbers +our $VERSION = '1.35'; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&xsinit &ldopts + &ccopts &ccflags &ccdlflags &perl_inc + &xsi_header &xsi_protos &xsi_body); + +our $Verbose = 0; +our $lib_ext = $Config{lib_ext} || '.a'; + +sub is_cmd { $0 eq '-e' } + +sub my_return { + my $val = shift; + if(is_cmd) { + print $val; + } + else { + return $val; + } +} + +sub xsinit { + my($file, $std, $mods) = @_; + my($fh,@mods,%seen); + $file ||= "perlxsi.c"; + my $xsinit_proto = "pTHX"; + + if (@_) { + @mods = @$mods if $mods; + } + else { + require Getopt::Std; + Getopt::Std::getopts('o:s:'); + $file = $opt_o if defined $opt_o; + $std = $opt_s if defined $opt_s; + @mods = @ARGV; + } + $std = 1 unless scalar @mods; + + if ($file eq "STDOUT") { + $fh = \*STDOUT; + } + else { + open $fh, '>', $file + or die "Can't open '$file': $!"; + } + + push(@mods, static_ext()) if defined $std; + @mods = grep(!$seen{$_}++, @mods); + + print $fh &xsi_header(); + print $fh "\nEXTERN_C void xs_init ($xsinit_proto);\n\n"; + print $fh &xsi_protos(@mods); + + print $fh "\nEXTERN_C void\nxs_init($xsinit_proto)\n{\n"; + print $fh &xsi_body(@mods); + print $fh "}\n"; + +} + +sub xsi_header { + return <<EOF; +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +EOF +} + +sub xsi_protos { + my @exts = @_; + my %seen; + my $retval = ''; + foreach my $cname (canon('__', @exts)) { + my $ccode = "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n"; + $retval .= $ccode + unless $seen{$ccode}++; + } + return $retval; +} + +sub xsi_body { + my @exts = @_; + my %seen; + my $retval; + $retval .= " static const char file[] = __FILE__;\n" + if @exts; + $retval .= <<'EOT'; + dXSUB_SYS; + PERL_UNUSED_CONTEXT; +EOT + $retval .= "\n" + if @exts; + + foreach my $pname (canon('/', @exts)) { + next + if $seen{$pname}++; + (my $mname = $pname) =~ s!/!::!g; + (my $cname = $pname) =~ s!/!__!g; + my $fname; + if ($pname eq 'DynaLoader'){ + # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! + # boot_DynaLoader is called directly in DynaLoader.pm + $retval .= " /* DynaLoader is a special case */\n"; + $fname = "${mname}::boot_DynaLoader"; + } else { + $fname = "${mname}::bootstrap"; + } + $retval .= " newXS(\"$fname\", boot_${cname}, file);\n" + } + return $retval; +} + +sub static_ext { + @Extensions = ('DynaLoader', sort $Config{static_ext} =~ /(\S+)/g) + unless @Extensions; + @Extensions; +} + +sub _escape { + my $arg = shift; + return $$arg if $^O eq 'VMS'; # parens legal in qualifier lists + $$arg =~ s/([\(\)])/\\$1/g; +} + +sub _ldflags { + my $ldflags = $Config{ldflags}; + _escape(\$ldflags); + return $ldflags; +} + +sub _ccflags { + my $ccflags = $Config{ccflags}; + _escape(\$ccflags); + return $ccflags; +} + +sub _ccdlflags { + my $ccdlflags = $Config{ccdlflags}; + _escape(\$ccdlflags); + return $ccdlflags; +} + +sub ldopts { + require ExtUtils::MakeMaker; + require ExtUtils::Liblist; + my($std,$mods,$link_args,$path) = @_; + my(@mods,@link_args,@argv); + my($dllib,$config_libs,@potential_libs,@path); + local($") = ' ' unless $" eq ' '; + if (scalar @_) { + @link_args = @$link_args if $link_args; + @mods = @$mods if $mods; + } + else { + @argv = @ARGV; + #hmm + while($_ = shift @argv) { + /^-std$/ && do { $std = 1; next; }; + /^--$/ && do { @link_args = @argv; last; }; + /^-I(.*)/ && do { $path = $1 || shift @argv; next; }; + push(@mods, $_); + } + } + $std = 1 unless scalar @link_args; + my $sep = $Config{path_sep} || ':'; + @path = $path ? split(/\Q$sep/, $path) : @INC; + + push(@potential_libs, @link_args) if scalar @link_args; + # makemaker includes std libs on windows by default + if ($^O ne 'MSWin32' and defined($std)) { + push(@potential_libs, $Config{perllibs}); + } + + push(@mods, static_ext()) if $std; + + my($mod,@ns,$root,$sub,$extra,$archive,@archives); + print STDERR "Searching (@path) for archives\n" if $Verbose; + foreach $mod (@mods) { + @ns = split(/::|\/|\\/, $mod); + $sub = $ns[-1]; + $root = File::Spec->catdir(@ns); + + print STDERR "searching for '$sub${lib_ext}'\n" if $Verbose; + foreach (@path) { + next unless -e ($archive = File::Spec->catdir($_,"auto",$root,"$sub$lib_ext")); + push @archives, $archive; + if(-e ($extra = File::Spec->catdir($_,"auto",$root,"extralibs.ld"))) { + local(*FH); + if(open(FH, '<', $extra)) { + my($libs) = <FH>; chomp $libs; + push @potential_libs, split /\s+/, $libs; + } + else { + warn "Couldn't open '$extra'"; + } + } + last; + } + } + #print STDERR "\@potential_libs = @potential_libs\n"; + + my $libperl; + if ($^O eq 'MSWin32') { + $libperl = $Config{libperl}; + } + elsif ($^O eq 'os390' && $Config{usedl}) { + # Nothing for OS/390 (z/OS) dynamic. + } else { + $libperl = (grep(/^-l\w*perl\w*$/, @link_args))[0] + || ($Config{libperl} =~ /^lib(\w+)(\Q$lib_ext\E|\.\Q$Config{dlext}\E)$/ + ? "-l$1" : '') + || "-lperl"; + } + + my $lpath = File::Spec->catdir($Config{archlibexp}, 'CORE'); + $lpath = qq["$lpath"] if $^O eq 'MSWin32'; + my($extralibs, $bsloadlibs, $ldloadlibs, $ld_run_path) = + MM->ext(join ' ', "-L$lpath", $libperl, @potential_libs); + + my $ld_or_bs = $bsloadlibs || $ldloadlibs; + print STDERR "bs: $bsloadlibs ** ld: $ldloadlibs" if $Verbose; + my $ccdlflags = _ccdlflags(); + my $ldflags = _ldflags(); + my $linkage = "$ccdlflags $ldflags @archives $ld_or_bs"; + print STDERR "ldopts: '$linkage'\n" if $Verbose; + + return $linkage if scalar @_; + my_return("$linkage\n"); +} + +sub ccflags { + my $ccflags = _ccflags(); + my_return(" $ccflags "); +} + +sub ccdlflags { + my $ccdlflags = _ccdlflags(); + my_return(" $ccdlflags "); +} + +sub perl_inc { + my $dir = File::Spec->catdir($Config{archlibexp}, 'CORE'); + $dir = qq["$dir"] if $^O eq 'MSWin32'; + my_return(" -I$dir "); +} + +sub ccopts { + ccflags . perl_inc; +} + +sub canon { + my($as, @ext) = @_; + foreach(@ext) { + # might be X::Y or lib/auto/X/Y/Y.a + next + if s!::!/!g; + s!^(?:lib|ext|dist|cpan)/(?:auto/)?!!; + s!/\w+\.\w+$!!; + } + if ($as ne '/') { + s!/!$as!g + foreach @ext; + } + @ext; +} + +__END__ + +=head1 NAME + +ExtUtils::Embed - Utilities for embedding Perl in C/C++ applications + +=head1 SYNOPSIS + + perl -MExtUtils::Embed -e xsinit + perl -MExtUtils::Embed -e ccopts + perl -MExtUtils::Embed -e ldopts + +=head1 DESCRIPTION + +C<ExtUtils::Embed> provides utility functions for embedding a Perl interpreter +and extensions in your C/C++ applications. +Typically, an application F<Makefile> will invoke C<ExtUtils::Embed> +functions while building your application. + +=head1 @EXPORT + +C<ExtUtils::Embed> exports the following functions: + +xsinit(), ldopts(), ccopts(), perl_inc(), ccflags(), +ccdlflags(), xsi_header(), xsi_protos(), xsi_body() + +=head1 FUNCTIONS + +=over 4 + +=item xsinit() + +Generate C/C++ code for the XS initializer function. + +When invoked as C<`perl -MExtUtils::Embed -e xsinit --`> +the following options are recognized: + +B<-o> E<lt>output filenameE<gt> (Defaults to B<perlxsi.c>) + +B<-o STDOUT> will print to STDOUT. + +B<-std> (Write code for extensions that are linked with the current Perl.) + +Any additional arguments are expected to be names of modules +to generate code for. + +When invoked with parameters the following are accepted and optional: + +C<xsinit($filename,$std,[@modules])> + +Where, + +B<$filename> is equivalent to the B<-o> option. + +B<$std> is boolean, equivalent to the B<-std> option. + +B<[@modules]> is an array ref, same as additional arguments mentioned above. + +=item Examples + + perl -MExtUtils::Embed -e xsinit -- -o xsinit.c Socket + +This will generate code with an C<xs_init> function that glues the perl C<Socket::bootstrap> function +to the C C<boot_Socket> function and writes it to a file named F<xsinit.c>. + +Note that L<DynaLoader> is a special case where it must call C<boot_DynaLoader> directly. + + perl -MExtUtils::Embed -e xsinit + +This will generate code for linking with C<DynaLoader> and +each static extension found in C<$Config{static_ext}>. +The code is written to the default file name F<perlxsi.c>. + + perl -MExtUtils::Embed -e xsinit -- -o xsinit.c \ + -std DBI DBD::Oracle + +Here, code is written for all the currently linked extensions along with code +for C<DBI> and C<DBD::Oracle>. + +If you have a working C<DynaLoader> then there is rarely any need to statically link in any +other extensions. + +=item ldopts() + +Output arguments for linking the Perl library and extensions to your +application. + +When invoked as C<`perl -MExtUtils::Embed -e ldopts --`> +the following options are recognized: + +B<-std> + +Output arguments for linking the Perl library and any extensions linked +with the current Perl. + +B<-I> E<lt>path1:path2E<gt> + +Search path for ModuleName.a archives. +Default path is C<@INC>. +Library archives are expected to be found as +F</some/path/auto/ModuleName/ModuleName.a> +For example, when looking for F<Socket.a> relative to a search path, +we should find F<auto/Socket/Socket.a> + +When looking for C<DBD::Oracle> relative to a search path, +we should find F<auto/DBD/Oracle/Oracle.a> + +Keep in mind that you can always supply F</my/own/path/ModuleName.a> +as an additional linker argument. + +B<--> E<lt>list of linker argsE<gt> + +Additional linker arguments to be considered. + +Any additional arguments found before the B<--> token +are expected to be names of modules to generate code for. + +When invoked with parameters the following are accepted and optional: + +C<ldopts($std,[@modules],[@link_args],$path)> + +Where: + +B<$std> is boolean, equivalent to the B<-std> option. + +B<[@modules]> is equivalent to additional arguments found before the B<--> token. + +B<[@link_args]> is equivalent to arguments found after the B<--> token. + +B<$path> is equivalent to the B<-I> option. + +In addition, when ldopts is called with parameters, it will return the argument string +rather than print it to STDOUT. + +=item Examples + + perl -MExtUtils::Embed -e ldopts + +This will print arguments for linking with C<libperl> and +extensions found in C<$Config{static_ext}>. This includes libraries +found in C<$Config{libs}> and the first ModuleName.a library +for each extension that is found by searching C<@INC> or the path +specified by the B<-I> option. +In addition, when ModuleName.a is found, additional linker arguments +are picked up from the F<extralibs.ld> file in the same directory. + + perl -MExtUtils::Embed -e ldopts -- -std Socket + +This will do the same as the above example, along with printing additional +arguments for linking with the C<Socket> extension. + + perl -MExtUtils::Embed -e ldopts -- -std Msql -- \ + -L/usr/msql/lib -lmsql + +Any arguments after the second '--' token are additional linker +arguments that will be examined for potential conflict. If there is no +conflict, the additional arguments will be part of the output. + +=item perl_inc() + +For including perl header files this function simply prints: + + -I$Config{archlibexp}/CORE + +So, rather than having to say: + + perl -MConfig -e 'print "-I$Config{archlibexp}/CORE"' + +Just say: + + perl -MExtUtils::Embed -e perl_inc + +=item ccflags(), ccdlflags() + +These functions simply print $Config{ccflags} and $Config{ccdlflags} + +=item ccopts() + +This function combines C<perl_inc()>, C<ccflags()> and C<ccdlflags()> into one. + +=item xsi_header() + +This function simply returns a string defining the same C<EXTERN_C> macro as +F<perlmain.c> along with #including F<perl.h> and F<EXTERN.h>. + +=item xsi_protos(@modules) + +This function returns a string of C<boot_$ModuleName> prototypes for each @modules. + +=item xsi_body(@modules) + +This function returns a string of calls to C<newXS()> that glue the module I<bootstrap> +function to I<boot_ModuleName> for each @modules. + +C<xsinit()> uses the xsi_* functions to generate most of its code. + +=back + +=head1 EXAMPLES + +For examples on how to use C<ExtUtils::Embed> for building C/C++ applications +with embedded perl, see L<perlembed>. + +=head1 SEE ALSO + +L<perlembed> + +=head1 AUTHOR + +Doug MacEachern E<lt>C<dougm@osf.org>E<gt> + +Based on ideas from Tim Bunce E<lt>C<Tim.Bunce@ig.co.uk>E<gt> and +F<minimod.pl> by Andreas Koenig E<lt>C<k@anna.in-berlin.de>E<gt> and Tim Bunce. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Install.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Install.pm new file mode 100644 index 0000000000000000000000000000000000000000..047c007145e0bf6e912b6fa5420077e6be5ddbf4 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Install.pm @@ -0,0 +1,1375 @@ +package ExtUtils::Install; +use strict; + +use Config qw(%Config); +use Cwd qw(cwd); +use Exporter (); +use File::Basename qw(dirname); +use File::Copy; +use File::Path; +use File::Spec; + +our @ISA = ('Exporter'); +our @EXPORT = ('install','uninstall','pm_to_blib', 'install_default'); + +our $MUST_REBOOT; + +=pod + +=head1 NAME + +ExtUtils::Install - install files from here to there + +=head1 SYNOPSIS + + use ExtUtils::Install; + + install({ 'blib/lib' => 'some/install/dir' } ); + + uninstall($packlist); + + pm_to_blib({ 'lib/Foo/Bar.pm' => 'blib/lib/Foo/Bar.pm' }); + +=head1 VERSION + +2.14 + +=cut + +our $VERSION = '2.14'; # <-- do not forget to update the POD section just above this line! +$VERSION = eval $VERSION; + +=pod + +=head1 DESCRIPTION + +Handles the installing and uninstalling of perl modules, scripts, man +pages, etc... + +Both install() and uninstall() are specific to the way +ExtUtils::MakeMaker handles the installation and deinstallation of +perl modules. They are not designed as general purpose tools. + +On some operating systems such as Win32 installation may not be possible +until after a reboot has occurred. This can have varying consequences: +removing an old DLL does not impact programs using the new one, but if +a new DLL cannot be installed properly until reboot then anything +depending on it must wait. The package variable + + $ExtUtils::Install::MUST_REBOOT + +is used to store this status. + +If this variable is true then such an operation has occurred and +anything depending on this module cannot proceed until a reboot +has occurred. + +If this value is defined but false then such an operation has +ocurred, but should not impact later operations. + +=over + +=begin _private + +=item _chmod($$;$) + +Wrapper to chmod() for debugging and error trapping. + +=item _warnonce(@) + +Warns about something only once. + +=item _choke(@) + +Dies with a special message. + +=back + +=end _private + +=cut + +BEGIN { + *Is_VMS = $^O eq 'VMS' ? sub(){1} : sub(){0}; + *Is_Win32 = $^O eq 'MSWin32' ? sub(){1} : sub(){0}; + *Is_cygwin = $^O eq 'cygwin' ? sub(){1} : sub(){0}; + *CanMoveAtBoot = ($^O eq 'MSWin32' || $^O eq 'cygwin') ? sub(){1} : sub(){0}; +} + +my $Inc_uninstall_warn_handler; + +# install relative to here + +my $INSTALL_ROOT = $ENV{PERL_INSTALL_ROOT}; +my $INSTALL_QUIET = $ENV{PERL_INSTALL_QUIET}; +$INSTALL_QUIET = 1 + if (!exists $ENV{PERL_INSTALL_QUIET} and + defined $ENV{MAKEFLAGS} and + $ENV{MAKEFLAGS} =~ /\b(s|silent|quiet)\b/); + +my $Curdir = File::Spec->curdir; + +sub _estr(@) { + return join "\n",'!' x 72,@_,'!' x 72,''; +} + +{my %warned; +sub _warnonce(@) { + my $first=shift; + my $msg=_estr "WARNING: $first",@_; + warn $msg unless $warned{$msg}++; +}} + +sub _choke(@) { + my $first=shift; + my $msg=_estr "ERROR: $first",@_; + require Carp; + Carp::croak($msg); +} + +sub _croak { + require Carp; + Carp::croak(@_); +} +sub _confess { + require Carp; + Carp::confess(@_); +} + +sub _compare { + require File::Compare; + File::Compare::compare(@_); +} + + +sub _chmod($$;$) { + my ( $mode, $item, $verbose )=@_; + $verbose ||= 0; + if (chmod $mode, $item) { + printf "chmod(0%o, %s)\n",$mode, $item if $verbose > 1; + } else { + my $err="$!"; + _warnonce sprintf "WARNING: Failed chmod(0%o, %s): %s\n", + $mode, $item, $err + if -e $item; + } +} + +=begin _private + +=over + +=item _move_file_at_boot( $file, $target, $moan ) + +OS-Specific, Win32/Cygwin + +Schedules a file to be moved/renamed/deleted at next boot. +$file should be a filespec of an existing file +$target should be a ref to an array if the file is to be deleted +otherwise it should be a filespec for a rename. If the file is existing +it will be replaced. + +Sets $MUST_REBOOT to 0 to indicate a deletion operation has occurred +and sets it to 1 to indicate that a move operation has been requested. + +returns 1 on success, on failure if $moan is false errors are fatal. +If $moan is true then returns 0 on error and warns instead of dies. + +=end _private + +=cut + +{ + my $Has_Win32API_File; + sub _move_file_at_boot { #XXX OS-SPECIFIC + my ( $file, $target, $moan )= @_; + _confess("Panic: Can't _move_file_at_boot on this platform!") + unless CanMoveAtBoot; + + my $descr= ref $target + ? "'$file' for deletion" + : "'$file' for installation as '$target'"; + + # *note* CanMoveAtBoot is only incidentally the same condition as below + # this needs not hold true in the future. + $Has_Win32API_File = (Is_Win32 || Is_cygwin) + ? (eval {require Win32API::File; 1} || 0) + : 0 unless defined $Has_Win32API_File; + if ( ! $Has_Win32API_File ) { + + my @msg=( + "Cannot schedule $descr at reboot.", + "Try installing Win32API::File to allow operations on locked files", + "to be scheduled during reboot. Or try to perform the operation by", + "hand yourself. (You may need to close other perl processes first)" + ); + if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) } + return 0; + } + my $opts= Win32API::File::MOVEFILE_DELAY_UNTIL_REBOOT(); + $opts= $opts | Win32API::File::MOVEFILE_REPLACE_EXISTING() + unless ref $target; + + _chmod( 0666, $file ); + _chmod( 0666, $target ) unless ref $target; + + if (Win32API::File::MoveFileEx( $file, $target, $opts )) { + $MUST_REBOOT ||= ref $target ? 0 : 1; + return 1; + } else { + my @msg=( + "MoveFileEx $descr at reboot failed: $^E", + "You may try to perform the operation by hand yourself. ", + "(You may need to close other perl processes first).", + ); + if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) } + } + return 0; + } +} + + +=begin _private + + +=item _unlink_or_rename( $file, $tryhard, $installing ) + +OS-Specific, Win32/Cygwin + +Tries to get a file out of the way by unlinking it or renaming it. On +some OS'es (Win32 based) DLL files can end up locked such that they can +be renamed but not deleted. Likewise sometimes a file can be locked such +that it cant even be renamed or changed except at reboot. To handle +these cases this routine finds a tempfile name that it can either rename +the file out of the way or use as a proxy for the install so that the +rename can happen later (at reboot). + + $file : the file to remove. + $tryhard : should advanced tricks be used for deletion + $installing : we are not merely deleting but we want to overwrite + +When $tryhard is not true if the unlink fails its fatal. When $tryhard +is true then the file is attempted to be renamed. The renamed file is +then scheduled for deletion. If the rename fails then $installing +governs what happens. If it is false the failure is fatal. If it is true +then an attempt is made to schedule installation at boot using a +temporary file to hold the new file. If this fails then a fatal error is +thrown, if it succeeds it returns the temporary file name (which will be +a derivative of the original in the same directory) so that the caller can +use it to install under. In all other cases of success returns $file. +On failure throws a fatal error. + +=end _private + +=cut + + + +sub _unlink_or_rename { #XXX OS-SPECIFIC + my ( $file, $tryhard, $installing )= @_; + + # this chmod was originally unconditional. However, its not needed on + # POSIXy systems since permission to unlink a file is specified by the + # directory rather than the file; and in fact it screwed up hard- and + # symlinked files. Keep it for other platforms in case its still + # needed there. + if ($^O =~ /^(dos|os2|MSWin32|VMS)$/) { + _chmod( 0666, $file ); + } + my $unlink_count = 0; + while (unlink $file) { $unlink_count++; } + return $file if $unlink_count > 0; + my $error="$!"; + + _choke("Cannot unlink '$file': $!") + unless CanMoveAtBoot && $tryhard; + + my $tmp= "AAA"; + ++$tmp while -e "$file.$tmp"; + $tmp= "$file.$tmp"; + + warn "WARNING: Unable to unlink '$file': $error\n", + "Going to try to rename it to '$tmp'.\n"; + + if ( rename $file, $tmp ) { + warn "Rename successful. Scheduling '$tmp'\nfor deletion at reboot.\n"; + # when $installing we can set $moan to true. + # IOW, if we cant delete the renamed file at reboot its + # not the end of the world. The other cases are more serious + # and need to be fatal. + _move_file_at_boot( $tmp, [], $installing ); + return $file; + } elsif ( $installing ) { + _warnonce("Rename failed: $!. Scheduling '$tmp'\nfor". + " installation as '$file' at reboot.\n"); + _move_file_at_boot( $tmp, $file ); + return $tmp; + } else { + _choke("Rename failed:$!", "Cannot proceed."); + } + +} + + +=pod + +=back + +=head2 Functions + +=begin _private + +=over + +=item _get_install_skip + +Handles loading the INSTALL.SKIP file. Returns an array of patterns to use. + +=cut + + + +sub _get_install_skip { + my ( $skip, $verbose )= @_; + if ($ENV{EU_INSTALL_IGNORE_SKIP}) { + print "EU_INSTALL_IGNORE_SKIP is set, ignore skipfile settings\n" + if $verbose>2; + return []; + } + if ( ! defined $skip ) { + print "Looking for install skip list\n" + if $verbose>2; + for my $file ( 'INSTALL.SKIP', $ENV{EU_INSTALL_SITE_SKIPFILE} ) { + next unless $file; + print "\tChecking for $file\n" + if $verbose>2; + if (-e $file) { + $skip= $file; + last; + } + } + } + if ($skip && !ref $skip) { + print "Reading skip patterns from '$skip'.\n" + if $verbose; + if (open my $fh,$skip ) { + my @patterns; + while (<$fh>) { + chomp; + next if /^\s*(?:#|$)/; + print "\tSkip pattern: $_\n" if $verbose>3; + push @patterns, $_; + } + $skip= \@patterns; + } else { + warn "Can't read skip file:'$skip':$!\n"; + $skip=[]; + } + } elsif ( UNIVERSAL::isa($skip,'ARRAY') ) { + print "Using array for skip list\n" + if $verbose>2; + } elsif ($verbose) { + print "No skip list found.\n" + if $verbose>1; + $skip= []; + } + warn "Got @{[0+@$skip]} skip patterns.\n" + if $verbose>3; + return $skip +} + +=pod + +=item _have_write_access + +Abstract a -w check that tries to use POSIX::access() if possible. + +=cut + +{ + my $has_posix; + sub _have_write_access { + my $dir=shift; + unless (defined $has_posix) { + $has_posix = (!Is_cygwin && !Is_Win32 + && eval { local $^W; require POSIX; 1} ) || 0; + } + if ($has_posix) { + return POSIX::access($dir, POSIX::W_OK()); + } else { + return -w $dir; + } + } +} + +=pod + +=item _can_write_dir(C<$dir>) + +Checks whether a given directory is writable, taking account +the possibility that the directory might not exist and would have to +be created first. + +Returns a list, containing: C<($writable, $determined_by, @create)> + +C<$writable> says whether the directory is (hypothetically) writable + +C<$determined_by> is the directory the status was determined from. It will be +either the C<$dir>, or one of its parents. + +C<@create> is a list of directories that would probably have to be created +to make the requested directory. It may not actually be correct on +relative paths with C<..> in them. But for our purposes it should work ok + +=cut + + +sub _can_write_dir { + my $dir=shift; + return + unless defined $dir and length $dir; + + my ($vol, $dirs, $file) = File::Spec->splitpath($dir,1); + my @dirs = File::Spec->splitdir($dirs); + unshift @dirs, File::Spec->curdir + unless File::Spec->file_name_is_absolute($dir); + + my $path=''; + my @make; + while (@dirs) { + if (Is_VMS) { + $dir = File::Spec->catdir($vol,@dirs); + } + else { + $dir = File::Spec->catdir(@dirs); + $dir = File::Spec->catpath($vol,$dir,'') + if defined $vol and length $vol; + } + next if ( $dir eq $path ); + if ( ! -e $dir ) { + unshift @make,$dir; + next; + } + if ( _have_write_access($dir) ) { + return 1,$dir,@make + } else { + return 0,$dir,@make + } + } continue { + pop @dirs; + } + return 0; +} + +=pod + +=item _mkpath($dir,$show,$mode,$verbose,$dry_run) + +Wrapper around File::Path::mkpath() to handle errors. + +If $verbose is true and >1 then additional diagnostics will be produced, also +this will force $show to true. + +If $dry_run is true then the directory will not be created but a check will be +made to see whether it would be possible to write to the directory, or that +it would be possible to create the directory. + +If $dry_run is not true dies if the directory can not be created or is not +writable. + +=cut + +sub _mkpath { + my ($dir,$show,$mode,$verbose,$dry_run)=@_; + if ( $verbose && $verbose > 1 && ! -d $dir) { + $show= 1; + printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode; + } + if (!$dry_run) { + if ( ! eval { File::Path::mkpath($dir,$show,$mode); 1 } ) { + _choke("Can't create '$dir'","$@"); + } + + } + my ($can,$root,@make)=_can_write_dir($dir); + if (!$can) { + my @msg=( + "Can't create '$dir'", + $root ? "Do not have write permissions on '$root'" + : "Unknown Error" + ); + if ($dry_run) { + _warnonce @msg; + } else { + _choke @msg; + } + } elsif ($show and $dry_run) { + print "$_\n" for @make; + } + +} + +=pod + +=item _copy($from,$to,$verbose,$dry_run) + +Wrapper around File::Copy::copy to handle errors. + +If $verbose is true and >1 then additional diagnostics will be emitted. + +If $dry_run is true then the copy will not actually occur. + +Dies if the copy fails. + +=cut + + +sub _copy { + my ( $from, $to, $verbose, $dry_run)=@_; + if ($verbose && $verbose>1) { + printf "copy(%s,%s)\n", $from, $to; + } + if (!$dry_run) { + File::Copy::copy($from,$to) + or _croak( _estr "ERROR: Cannot copy '$from' to '$to': $!" ); + } +} + +=pod + +=item _chdir($from) + +Wrapper around chdir to catch errors. + +If not called in void context returns the cwd from before the chdir. + +dies on error. + +=cut + +sub _chdir { + my ($dir)= @_; + my $ret; + if (defined wantarray) { + $ret= cwd; + } + chdir $dir + or _choke("Couldn't chdir to '$dir': $!"); + return $ret; +} + +=pod + +=back + +=end _private + +=over + +=item B<install> + + # deprecated forms + install(\%from_to); + install(\%from_to, $verbose, $dry_run, $uninstall_shadows, + $skip, $always_copy, \%result); + + # recommended form as of 1.47 + install([ + from_to => \%from_to, + verbose => 1, + dry_run => 0, + uninstall_shadows => 1, + skip => undef, + always_copy => 1, + result => \%install_results, + ]); + + +Copies each directory tree of %from_to to its corresponding value +preserving timestamps and permissions. + +There are two keys with a special meaning in the hash: "read" and +"write". These contain packlist files. After the copying is done, +install() will write the list of target files to $from_to{write}. If +$from_to{read} is given the contents of this file will be merged into +the written file. The read and the written file may be identical, but +on AFS it is quite likely that people are installing to a different +directory than the one where the files later appear. + +If $verbose is true, will print out each file removed. Default is +false. This is "make install VERBINST=1". $verbose values going +up to 5 show increasingly more diagnostics output. + +If $dry_run is true it will only print what it was going to do +without actually doing it. Default is false. + +If $uninstall_shadows is true any differing versions throughout @INC +will be uninstalled. This is "make install UNINST=1" + +As of 1.37_02 install() supports the use of a list of patterns to filter out +files that shouldn't be installed. If $skip is omitted or undefined then +install will try to read the list from INSTALL.SKIP in the CWD. This file is +a list of regular expressions and is just like the MANIFEST.SKIP file used +by L<ExtUtils::Manifest>. + +A default site INSTALL.SKIP may be provided by setting then environment +variable EU_INSTALL_SITE_SKIPFILE, this will only be used when there isn't a +distribution specific INSTALL.SKIP. If the environment variable +EU_INSTALL_IGNORE_SKIP is true then no install file filtering will be +performed. + +If $skip is undefined then the skip file will be autodetected and used if it +is found. If $skip is a reference to an array then it is assumed the array +contains the list of patterns, if $skip is a true non reference it is +assumed to be the filename holding the list of patterns, any other value of +$skip is taken to mean that no install filtering should occur. + +B<Changes As of Version 1.47> + +As of version 1.47 the following additions were made to the install interface. +Note that the new argument style and use of the %result hash is recommended. + +The $always_copy parameter which when true causes files to be updated +regardless as to whether they have changed, if it is defined but false then +copies are made only if the files have changed, if it is undefined then the +value of the environment variable EU_INSTALL_ALWAYS_COPY is used as default. + +The %result hash will be populated with the various keys/subhashes reflecting +the install. Currently these keys and their structure are: + + install => { $target => $source }, + install_fail => { $target => $source }, + install_unchanged => { $target => $source }, + + install_filtered => { $source => $pattern }, + + uninstall => { $uninstalled => $source }, + uninstall_fail => { $uninstalled => $source }, + +where C<$source> is the filespec of the file being installed. C<$target> is where +it is being installed to, and C<$uninstalled> is any shadow file that is in C<@INC> +or C<$ENV{PERL5LIB}> or other standard locations, and C<$pattern> is the pattern that +caused a source file to be skipped. In future more keys will be added, such as to +show created directories, however this requires changes in other modules and must +therefore wait. + +These keys will be populated before any exceptions are thrown should there be an +error. + +Note that all updates of the %result are additive, the hash will not be +cleared before use, thus allowing status results of many installs to be easily +aggregated. + +B<NEW ARGUMENT STYLE> + +If there is only one argument and it is a reference to an array then +the array is assumed to contain a list of key-value pairs specifying +the options. In this case the option "from_to" is mandatory. This style +means that you do not have to supply a cryptic list of arguments and can +use a self documenting argument list that is easier to understand. + +This is now the recommended interface to install(). + +B<RETURN> + +If all actions were successful install will return a hashref of the results +as described above for the $result parameter. If any action is a failure +then install will die, therefore it is recommended to pass in the $result +parameter instead of using the return value. If the result parameter is +provided then the returned hashref will be the passed in hashref. + +=cut + +sub install { #XXX OS-SPECIFIC + my($from_to,$verbose,$dry_run,$uninstall_shadows,$skip,$always_copy,$result) = @_; + if (@_==1 and eval { 1+@$from_to }) { + my %opts = @$from_to; + $from_to = $opts{from_to} + or _confess("from_to is a mandatory parameter"); + $verbose = $opts{verbose}; + $dry_run = $opts{dry_run}; + $uninstall_shadows = $opts{uninstall_shadows}; + $skip = $opts{skip}; + $always_copy = $opts{always_copy}; + $result = $opts{result}; + } + + $result ||= {}; + $verbose ||= 0; + $dry_run ||= 0; + + $skip= _get_install_skip($skip,$verbose); + $always_copy = $ENV{EU_INSTALL_ALWAYS_COPY} + || $ENV{EU_ALWAYS_COPY} + || 0 + unless defined $always_copy; + + my(%from_to) = %$from_to; + my(%pack, $dir, %warned); + require ExtUtils::Packlist; + my($packlist) = ExtUtils::Packlist->new(); + + local(*DIR); + for (qw/read write/) { + $pack{$_}=$from_to{$_}; + delete $from_to{$_}; + } + my $tmpfile = install_rooted_file($pack{"read"}); + $packlist->read($tmpfile) if (-f $tmpfile); + my $cwd = cwd(); + my @found_files; + my %check_dirs; + require File::Find; + + my $blib_lib = File::Spec->catdir('blib', 'lib'); + my $blib_arch = File::Spec->catdir('blib', 'arch'); + + # File::Find seems to always be Unixy except on MacPerl :( + my $current_directory = $^O eq 'MacOS' ? $Curdir : '.'; + + MOD_INSTALL: foreach my $source (sort keys %from_to) { + #copy the tree to the target directory without altering + #timestamp and permission and remember for the .packlist + #file. The packlist file contains the absolute paths of the + #install locations. AFS users may call this a bug. We'll have + #to reconsider how to add the means to satisfy AFS users also. + + #October 1997: we want to install .pm files into archlib if + #there are any files in arch. So we depend on having ./blib/arch + #hardcoded here. + + my $targetroot = install_rooted_dir($from_to{$source}); + + if ($source eq $blib_lib and + exists $from_to{$blib_arch} and + directory_not_empty($blib_arch) + ){ + $targetroot = install_rooted_dir($from_to{$blib_arch}); + print "Files found in $blib_arch: installing files in $blib_lib into architecture dependent library tree\n"; + } + + next unless -d $source; + _chdir($source); + # 5.5.3's File::Find missing no_chdir option + # XXX OS-SPECIFIC + File::Find::find(sub { + my ($mode,$size,$atime,$mtime) = (stat)[2,7,8,9]; + + return if !-f _; + my $origfile = $_; + + return if $origfile eq ".exists"; + my $targetdir = File::Spec->catdir($targetroot, $File::Find::dir); + my $targetfile = File::Spec->catfile($targetdir, $origfile); + my $sourcedir = File::Spec->catdir($source, $File::Find::dir); + my $sourcefile = File::Spec->catfile($sourcedir, $origfile); + + for my $pat (@$skip) { + if ( $sourcefile=~/$pat/ ) { + print "Skipping $targetfile (filtered)\n" + if $verbose>1; + $result->{install_filtered}{$sourcefile} = $pat; + return; + } + } + # we have to do this for back compat with old File::Finds + # and because the target is relative + my $save_cwd = _chdir($cwd); + my $diff = 0; + # XXX: I wonder how useful this logic is actually -- demerphq + if ( $always_copy or !-f $targetfile or -s $targetfile != $size) { + $diff++; + } else { + # we might not need to copy this file + $diff = _compare($sourcefile, $targetfile); + } + $check_dirs{$targetdir}++ + unless -w $targetfile; + + push @found_files, + [ $diff, $File::Find::dir, $origfile, + $mode, $size, $atime, $mtime, + $targetdir, $targetfile, $sourcedir, $sourcefile, + + ]; + #restore the original directory we were in when File::Find + #called us so that it doesn't get horribly confused. + _chdir($save_cwd); + }, $current_directory ); + _chdir($cwd); + } + foreach my $targetdir (sort keys %check_dirs) { + _mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); + } + foreach my $found (@found_files) { + my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime, + $targetdir, $targetfile, $sourcedir, $sourcefile)= @$found; + + my $realtarget= $targetfile; + if ($diff) { + eval { + if (-f $targetfile) { + print "_unlink_or_rename($targetfile)\n" if $verbose>1; + $targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' ) + unless $dry_run; + } elsif ( ! -d $targetdir ) { + _mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); + } + print "Installing $targetfile\n"; + + _copy( $sourcefile, $targetfile, $verbose, $dry_run, ); + + + #XXX OS-SPECIFIC + print "utime($atime,$mtime,$targetfile)\n" if $verbose>1; + utime($atime,$mtime + Is_VMS,$targetfile) unless $dry_run>1; + + + $mode = 0444 | ( $mode & 0111 ? 0111 : 0 ); + $mode = $mode | 0222 + if $realtarget ne $targetfile; + _chmod( $mode, $targetfile, $verbose ); + $result->{install}{$targetfile} = $sourcefile; + 1 + } or do { + $result->{install_fail}{$targetfile} = $sourcefile; + die $@; + }; + } else { + $result->{install_unchanged}{$targetfile} = $sourcefile; + print "Skipping $targetfile (unchanged)\n" if $verbose; + } + + if ( $uninstall_shadows ) { + inc_uninstall($sourcefile,$ffd, $verbose, + $dry_run, + $realtarget ne $targetfile ? $realtarget : "", + $result); + } + + # Record the full pathname. + $packlist->{$targetfile}++; + } + + if ($pack{'write'}) { + $dir = install_rooted_dir(dirname($pack{'write'})); + _mkpath( $dir, 0, 0755, $verbose, $dry_run ); + print "Writing $pack{'write'}\n" if $verbose; + $packlist->write(install_rooted_file($pack{'write'})) unless $dry_run; + } + + _do_cleanup($verbose); + return $result; +} + +=begin _private + +=item _do_cleanup + +Standardize finish event for after another instruction has occurred. +Handles converting $MUST_REBOOT to a die for instance. + +=end _private + +=cut + +sub _do_cleanup { + my ($verbose) = @_; + if ($MUST_REBOOT) { + die _estr "Operation not completed! ", + "You must reboot to complete the installation.", + "Sorry."; + } elsif (defined $MUST_REBOOT & $verbose) { + warn _estr "Installation will be completed at the next reboot.\n", + "However it is not necessary to reboot immediately.\n"; + } +} + +=begin _undocumented + +=item install_rooted_file( $file ) + +Returns $file, or catfile($INSTALL_ROOT,$file) if $INSTALL_ROOT +is defined. + +=item install_rooted_dir( $dir ) + +Returns $dir, or catdir($INSTALL_ROOT,$dir) if $INSTALL_ROOT +is defined. + +=end _undocumented + +=cut + + +sub install_rooted_file { + if (defined $INSTALL_ROOT) { + File::Spec->catfile($INSTALL_ROOT, $_[0]); + } else { + $_[0]; + } +} + + +sub install_rooted_dir { + if (defined $INSTALL_ROOT) { + File::Spec->catdir($INSTALL_ROOT, $_[0]); + } else { + $_[0]; + } +} + +=begin _undocumented + +=item forceunlink( $file, $tryhard ) + +Tries to delete a file. If $tryhard is true then we will use whatever +devious tricks we can to delete the file. Currently this only applies to +Win32 in that it will try to use Win32API::File to schedule a delete at +reboot. A wrapper for _unlink_or_rename(). + +=end _undocumented + +=cut + + +sub forceunlink { + my ( $file, $tryhard )= @_; #XXX OS-SPECIFIC + _unlink_or_rename( $file, $tryhard, not("installing") ); +} + +=begin _undocumented + +=item directory_not_empty( $dir ) + +Returns 1 if there is an .exists file somewhere in a directory tree. +Returns 0 if there is not. + +=end _undocumented + +=cut + +sub directory_not_empty ($) { + my($dir) = @_; + my $files = 0; + require File::Find; + File::Find::find(sub { + return if $_ eq ".exists"; + if (-f) { + $File::Find::prune++; + $files = 1; + } + }, $dir); + return $files; +} + +=pod + +=item B<install_default> I<DISCOURAGED> + + install_default(); + install_default($fullext); + +Calls install() with arguments to copy a module from blib/ to the +default site installation location. + +$fullext is the name of the module converted to a directory +(ie. Foo::Bar would be Foo/Bar). If $fullext is not specified, it +will attempt to read it from @ARGV. + +This is primarily useful for install scripts. + +B<NOTE> This function is not really useful because of the hard-coded +install location with no way to control site vs core vs vendor +directories and the strange way in which the module name is given. +Consider its use discouraged. + +=cut + +sub install_default { + @_ < 2 or _croak("install_default should be called with 0 or 1 argument"); + my $FULLEXT = @_ ? shift : $ARGV[0]; + defined $FULLEXT or die "Do not know to where to write install log"; + my $INST_LIB = File::Spec->catdir($Curdir,"blib","lib"); + my $INST_ARCHLIB = File::Spec->catdir($Curdir,"blib","arch"); + my $INST_BIN = File::Spec->catdir($Curdir,'blib','bin'); + my $INST_SCRIPT = File::Spec->catdir($Curdir,'blib','script'); + my $INST_MAN1DIR = File::Spec->catdir($Curdir,'blib','man1'); + my $INST_MAN3DIR = File::Spec->catdir($Curdir,'blib','man3'); + + my @INST_HTML; + if($Config{installhtmldir}) { + my $INST_HTMLDIR = File::Spec->catdir($Curdir,'blib','html'); + @INST_HTML = ($INST_HTMLDIR => $Config{installhtmldir}); + } + + install({ + read => "$Config{sitearchexp}/auto/$FULLEXT/.packlist", + write => "$Config{installsitearch}/auto/$FULLEXT/.packlist", + $INST_LIB => (directory_not_empty($INST_ARCHLIB)) ? + $Config{installsitearch} : + $Config{installsitelib}, + $INST_ARCHLIB => $Config{installsitearch}, + $INST_BIN => $Config{installbin} , + $INST_SCRIPT => $Config{installscript}, + $INST_MAN1DIR => $Config{installman1dir}, + $INST_MAN3DIR => $Config{installman3dir}, + @INST_HTML, + },1,0,0); +} + + +=item B<uninstall> + + uninstall($packlist_file); + uninstall($packlist_file, $verbose, $dont_execute); + +Removes the files listed in a $packlist_file. + +If $verbose is true, will print out each file removed. Default is +false. + +If $dont_execute is true it will only print what it was going to do +without actually doing it. Default is false. + +=cut + +sub uninstall { + my($fil,$verbose,$dry_run) = @_; + $verbose ||= 0; + $dry_run ||= 0; + + die _estr "ERROR: no packlist file found: '$fil'" + unless -f $fil; + # my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al)); + # require $my_req; # Hairy, but for the first + require ExtUtils::Packlist; + my ($packlist) = ExtUtils::Packlist->new($fil); + foreach (sort(keys(%$packlist))) { + chomp; + print "unlink $_\n" if $verbose; + forceunlink($_,'tryhard') unless $dry_run; + } + print "unlink $fil\n" if $verbose; + forceunlink($fil, 'tryhard') unless $dry_run; + _do_cleanup($verbose); +} + +=begin _undocumented + +=item inc_uninstall($filepath,$libdir,$verbose,$dry_run,$ignore,$results) + +Remove shadowed files. If $ignore is true then it is assumed to hold +a filename to ignore. This is used to prevent spurious warnings from +occurring when doing an install at reboot. + +We now only die when failing to remove a file that has precedence over +our own, when our install has precedence we only warn. + +$results is assumed to contain a hashref which will have the keys +'uninstall' and 'uninstall_fail' populated with keys for the files +removed and values of the source files they would shadow. + +=end _undocumented + +=cut + +sub inc_uninstall { + my($filepath,$libdir,$verbose,$dry_run,$ignore,$results) = @_; + my($dir); + $ignore||=""; + my $file = (File::Spec->splitpath($filepath))[2]; + my %seen_dir = (); + + my @PERL_ENV_LIB = split $Config{path_sep}, defined $ENV{'PERL5LIB'} + ? $ENV{'PERL5LIB'} : $ENV{'PERLLIB'} || ''; + + my @dirs=( @PERL_ENV_LIB, + @INC, + @Config{qw(archlibexp + privlibexp + sitearchexp + sitelibexp)}); + + #warn join "\n","---",@dirs,"---"; + my $seen_ours; + foreach $dir ( @dirs ) { + my $canonpath = Is_VMS ? $dir : File::Spec->canonpath($dir); + next if $canonpath eq $Curdir; + next if $seen_dir{$canonpath}++; + my $targetfile = File::Spec->catfile($canonpath,$libdir,$file); + next unless -f $targetfile; + + # The reason why we compare file's contents is, that we cannot + # know, which is the file we just installed (AFS). So we leave + # an identical file in place + my $diff = 0; + if ( -f $targetfile && -s _ == -s $filepath) { + # We have a good chance, we can skip this one + $diff = _compare($filepath,$targetfile); + } else { + $diff++; + } + print "#$file and $targetfile differ\n" if $diff && $verbose > 1; + + if (!$diff or $targetfile eq $ignore) { + $seen_ours = 1; + next; + } + if ($dry_run) { + $results->{uninstall}{$targetfile} = $filepath; + if ($verbose) { + $Inc_uninstall_warn_handler ||= ExtUtils::Install::Warn->new(); + $libdir =~ s|^\./||s ; # That's just cosmetics, no need to port. It looks prettier. + $Inc_uninstall_warn_handler->add( + File::Spec->catfile($libdir, $file), + $targetfile + ); + } + # if not verbose, we just say nothing + } else { + print "Unlinking $targetfile (shadowing?)\n" if $verbose; + eval { + die "Fake die for testing" + if $ExtUtils::Install::Testing and + ucase(File::Spec->canonpath($ExtUtils::Install::Testing)) eq ucase($targetfile); + forceunlink($targetfile,'tryhard'); + $results->{uninstall}{$targetfile} = $filepath; + 1; + } or do { + $results->{fail_uninstall}{$targetfile} = $filepath; + if ($seen_ours) { + warn "Failed to remove probably harmless shadow file '$targetfile'\n"; + } else { + die "$@\n"; + } + }; + } + } +} + +=begin _undocumented + +=item run_filter($cmd,$src,$dest) + +Filter $src using $cmd into $dest. + +=end _undocumented + +=cut + +sub run_filter { + my ($cmd, $src, $dest) = @_; + local(*CMD, *SRC); + open(CMD, "|$cmd >$dest") || die "Cannot fork: $!"; + open(SRC, $src) || die "Cannot open $src: $!"; + my $buf; + my $sz = 1024; + while (my $len = sysread(SRC, $buf, $sz)) { + syswrite(CMD, $buf, $len); + } + close SRC; + close CMD or die "Filter command '$cmd' failed for $src"; +} + +=pod + +=item B<pm_to_blib> + + pm_to_blib(\%from_to); + pm_to_blib(\%from_to, $autosplit_dir); + pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd); + +Copies each key of %from_to to its corresponding value efficiently. +If an $autosplit_dir is provided, all .pm files will be autosplit into it. +Any destination directories are created. + +$filter_cmd is an optional shell command to run each .pm file through +prior to splitting and copying. Input is the contents of the module, +output the new module contents. + +You can have an environment variable PERL_INSTALL_ROOT set which will +be prepended as a directory to each installed file (and directory). + +By default verbose output is generated, setting the PERL_INSTALL_QUIET +environment variable will silence this output. + +=cut + +sub pm_to_blib { + my($fromto,$autodir,$pm_filter) = @_; + + _mkpath($autodir,0,0755) if defined $autodir; + while(my($from, $to) = each %$fromto) { + if( -f $to && -s $from == -s $to && -M $to < -M $from ) { + print "Skip $to (unchanged)\n" unless $INSTALL_QUIET; + next; + } + + # When a pm_filter is defined, we need to pre-process the source first + # to determine whether it has changed or not. Therefore, only perform + # the comparison check when there's no filter to be ran. + # -- RAM, 03/01/2001 + + my $need_filtering = defined $pm_filter && length $pm_filter && + $from =~ /\.pm$/; + + if (!$need_filtering && 0 == _compare($from,$to)) { + print "Skip $to (unchanged)\n" unless $INSTALL_QUIET; + next; + } + if (-f $to){ + # we wont try hard here. its too likely to mess things up. + forceunlink($to); + } else { + _mkpath(dirname($to),0,0755); + } + if ($need_filtering) { + run_filter($pm_filter, $from, $to); + print "$pm_filter <$from >$to\n"; + } else { + _copy( $from, $to ); + print "cp $from $to\n" unless $INSTALL_QUIET; + } + my($mode,$atime,$mtime) = (stat $from)[2,8,9]; + utime($atime,$mtime+Is_VMS,$to); + _chmod(0444 | ( $mode & 0111 ? 0111 : 0 ),$to); + next unless $from =~ /\.pm$/; + _autosplit($to,$autodir) if defined $autodir; + } +} + + +=begin _private + +=item _autosplit + +From 1.0307 back, AutoSplit will sometimes leave an open filehandle to +the file being split. This causes problems on systems with mandatory +locking (ie. Windows). So we wrap it and close the filehandle. + +=end _private + +=cut + +sub _autosplit { #XXX OS-SPECIFIC + require AutoSplit; + my $retval = AutoSplit::autosplit(@_); + close *AutoSplit::IN if defined *AutoSplit::IN{IO}; + + return $retval; +} + + +package ExtUtils::Install::Warn; + +sub new { bless {}, shift } + +sub add { + my($self,$file,$targetfile) = @_; + push @{$self->{$file}}, $targetfile; +} + +sub DESTROY { + unless(defined $INSTALL_ROOT) { + my $self = shift; + my($file,$i,$plural); + foreach $file (sort keys %$self) { + $plural = @{$self->{$file}} > 1 ? "s" : ""; + print "## Differing version$plural of $file found. You might like to\n"; + for (0..$#{$self->{$file}}) { + print "rm ", $self->{$file}[$_], "\n"; + $i++; + } + } + $plural = $i>1 ? "all those files" : "this file"; + my $inst = (_invokant() eq 'ExtUtils::MakeMaker') + ? ( $Config::Config{make} || 'make' ).' install' + . ( ExtUtils::Install::Is_VMS ? '/MACRO="UNINST"=1' : ' UNINST=1' ) + : './Build install uninst=1'; + print "## Running '$inst' will unlink $plural for you.\n"; + } +} + +=begin _private + +=item _invokant + +Does a heuristic on the stack to see who called us for more intelligent +error messages. Currently assumes we will be called only by Module::Build +or by ExtUtils::MakeMaker. + +=end _private + +=cut + +sub _invokant { + my @stack; + my $frame = 0; + while (my $file = (caller($frame++))[1]) { + push @stack, (File::Spec->splitpath($file))[2]; + } + + my $builder; + my $top = pop @stack; + if ($top =~ /^Build/i || exists($INC{'Module/Build.pm'})) { + $builder = 'Module::Build'; + } else { + $builder = 'ExtUtils::MakeMaker'; + } + return $builder; +} + +=pod + +=back + +=head1 ENVIRONMENT + +=over 4 + +=item B<PERL_INSTALL_ROOT> + +Will be prepended to each install path. + +=item B<EU_INSTALL_IGNORE_SKIP> + +Will prevent the automatic use of INSTALL.SKIP as the install skip file. + +=item B<EU_INSTALL_SITE_SKIPFILE> + +If there is no INSTALL.SKIP file in the make directory then this value +can be used to provide a default. + +=item B<EU_INSTALL_ALWAYS_COPY> + +If this environment variable is true then normal install processes will +always overwrite older identical files during the install process. + +Note that the alias EU_ALWAYS_COPY will be supported if EU_INSTALL_ALWAYS_COPY +is not defined until at least the 1.50 release. Please ensure you use the +correct EU_INSTALL_ALWAYS_COPY. + +=back + +=head1 AUTHOR + +Original author lost in the mists of time. Probably the same as Makemaker. + +Production release currently maintained by demerphq C<yves at cpan.org>, +extensive changes by Michael G. Schwern. + +Send bug reports via http://rt.cpan.org/. Please send your +generated Makefile along with your report. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See L<http://www.perl.com/perl/misc/Artistic.html> + + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Installed.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Installed.pm new file mode 100644 index 0000000000000000000000000000000000000000..8327a95a3dbe410d192208180dec797f3289b5a9 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Installed.pm @@ -0,0 +1,471 @@ +package ExtUtils::Installed; + +use 5.00503; +use strict; +#use warnings; # XXX requires 5.6 +use Carp qw(); +use ExtUtils::Packlist; +use ExtUtils::MakeMaker; +use Config; +use File::Find; +use File::Basename; +use File::Spec; + +my $Is_VMS = $^O eq 'VMS'; +my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); + +require VMS::Filespec if $Is_VMS; + +use vars qw($VERSION); +$VERSION = '2.14'; +$VERSION = eval $VERSION; + +sub _is_prefix { + my ($self, $path, $prefix) = @_; + return unless defined $prefix && defined $path; + + if( $Is_VMS ) { + $prefix = VMS::Filespec::unixify($prefix); + $path = VMS::Filespec::unixify($path); + } + + # Unix path normalization. + $prefix = File::Spec->canonpath($prefix); + + return 1 if substr($path, 0, length($prefix)) eq $prefix; + + if ($DOSISH) { + $path =~ s|\\|/|g; + $prefix =~ s|\\|/|g; + return 1 if $path =~ m{^\Q$prefix\E}i; + } + return(0); +} + +sub _is_doc { + my ($self, $path) = @_; + + my $man1dir = $self->{':private:'}{Config}{man1direxp}; + my $man3dir = $self->{':private:'}{Config}{man3direxp}; + return(($man1dir && $self->_is_prefix($path, $man1dir)) + || + ($man3dir && $self->_is_prefix($path, $man3dir)) + ? 1 : 0) +} + +sub _is_type { + my ($self, $path, $type) = @_; + return 1 if $type eq "all"; + + return($self->_is_doc($path)) if $type eq "doc"; + my $conf= $self->{':private:'}{Config}; + if ($type eq "prog") { + return($self->_is_prefix($path, $conf->{prefix} || $conf->{prefixexp}) + && !($self->_is_doc($path)) ? 1 : 0); + } + return(0); +} + +sub _is_under { + my ($self, $path, @under) = @_; + $under[0] = "" if (! @under); + foreach my $dir (@under) { + return(1) if ($self->_is_prefix($path, $dir)); + } + + return(0); +} + +sub _fix_dirs { + my ($self, @dirs)= @_; + # File::Find does not know how to deal with VMS filepaths. + if( $Is_VMS ) { + $_ = VMS::Filespec::unixify($_) + for @dirs; + } + + if ($DOSISH) { + s|\\|/|g for @dirs; + } + return wantarray ? @dirs : $dirs[0]; +} + +sub _make_entry { + my ($self, $module, $packlist_file, $modfile)= @_; + + my $data= { + module => $module, + packlist => scalar(ExtUtils::Packlist->new($packlist_file)), + packlist_file => $packlist_file, + }; + + if (!$modfile) { + $data->{version} = $self->{':private:'}{Config}{version}; + } else { + $data->{modfile} = $modfile; + # Find the top-level module file in @INC + $data->{version} = ''; + foreach my $dir (@{$self->{':private:'}{INC}}) { + my $p = File::Spec->catfile($dir, $modfile); + if (-r $p) { + $module = _module_name($p, $module) if $Is_VMS; + + $data->{version} = MM->parse_version($p); + $data->{version_from} = $p; + $data->{packlist_valid} = exists $data->{packlist}{$p}; + last; + } + } + } + $self->{$module}= $data; +} + +our $INSTALLED; +sub new { + my ($class) = shift(@_); + $class = ref($class) || $class; + + my %args = @_; + + return $INSTALLED if $INSTALLED and ($args{default_get} || $args{default}); + + my $self = bless {}, $class; + + $INSTALLED= $self if $args{default_set} || $args{default}; + + + if ($args{config_override}) { + eval { + $self->{':private:'}{Config} = { %{$args{config_override}} }; + } or Carp::croak( + "The 'config_override' parameter must be a hash reference." + ); + } + else { + $self->{':private:'}{Config} = \%Config; + } + + for my $tuple ([inc_override => INC => [ @INC ] ], + [ extra_libs => EXTRA => [] ]) + { + my ($arg,$key,$val)=@$tuple; + if ( $args{$arg} ) { + eval { + $self->{':private:'}{$key} = [ @{$args{$arg}} ]; + } or Carp::croak( + "The '$arg' parameter must be an array reference." + ); + } + elsif ($val) { + $self->{':private:'}{$key} = $val; + } + } + { + my %dupe; + @{$self->{':private:'}{LIBDIRS}} = + grep { $_ ne '.' || ! $args{skip_cwd} } + grep { -e $_ && !$dupe{$_}++ } + @{$self->{':private:'}{EXTRA}}, @{$self->{':private:'}{INC}}; + } + + my @dirs= $self->_fix_dirs(@{$self->{':private:'}{LIBDIRS}}); + + # Read the core packlist + my $archlib = $self->_fix_dirs($self->{':private:'}{Config}{archlibexp}); + $self->_make_entry("Perl",File::Spec->catfile($archlib, '.packlist')); + + my $root; + # Read the module packlists + my $sub = sub { + # Only process module .packlists + return if $_ ne ".packlist" || $File::Find::dir eq $archlib; + + # Hack of the leading bits of the paths & convert to a module name + my $module = $File::Find::name; + my $found = $module =~ s!^.*?/auto/(.*)/.packlist!$1!s + or do { + # warn "Woah! \$_=$_\n\$module=$module\n\$File::Find::dir=$File::Find::dir\n", + # join ("\n",@dirs); + return; + }; + + my $modfile = "$module.pm"; + $module =~ s!/!::!g; + + return if $self->{$module}; #shadowing? + $self->_make_entry($module,$File::Find::name,$modfile); + }; + while (@dirs) { + $root= shift @dirs; + next if !-d $root; + find($sub,$root); + } + + return $self; +} + +# VMS's non-case preserving file-system means the package name can't +# be reconstructed from the filename. +sub _module_name { + my($file, $orig_module) = @_; + + my $module = ''; + if (open PACKFH, $file) { + while (<PACKFH>) { + if (/package\s+(\S+)\s*;/) { + my $pack = $1; + # Make a sanity check, that lower case $module + # is identical to lowercase $pack before + # accepting it + if (lc($pack) eq lc($orig_module)) { + $module = $pack; + last; + } + } + } + close PACKFH; + } + + print STDERR "Couldn't figure out the package name for $file\n" + unless $module; + + return $module; +} + +sub modules { + my ($self) = @_; + $self= $self->new(default=>1) if !ref $self; + + # Bug/feature of sort in scalar context requires this. + return wantarray + ? sort grep { not /^:private:$/ } keys %$self + : grep { not /^:private:$/ } keys %$self; +} + +sub files { + my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; + + # Validate arguments + Carp::croak("$module is not installed") if (! exists($self->{$module})); + $type = "all" if (! defined($type)); + Carp::croak('type must be "all", "prog" or "doc"') + if ($type ne "all" && $type ne "prog" && $type ne "doc"); + + my (@files); + foreach my $file (keys(%{$self->{$module}{packlist}})) { + push(@files, $file) + if ($self->_is_type($file, $type) && + $self->_is_under($file, @under)); + } + return(@files); +} + +sub directories { + my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; + my (%dirs); + foreach my $file ($self->files($module, $type, @under)) { + $dirs{dirname($file)}++; + } + return sort keys %dirs; +} + +sub directory_tree { + my ($self, $module, $type, @under) = @_; + $self= $self->new(default=>1) if !ref $self; + my (%dirs); + foreach my $dir ($self->directories($module, $type, @under)) { + $dirs{$dir}++; + my ($last) = (""); + while ($last ne $dir) { + $last = $dir; + $dir = dirname($dir); + last if !$self->_is_under($dir, @under); + $dirs{$dir}++; + } + } + return(sort(keys(%dirs))); +} + +sub validate { + my ($self, $module, $remove) = @_; + $self= $self->new(default=>1) if !ref $self; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{packlist}->validate($remove)); +} + +sub packlist { + my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{packlist}); +} + +sub version { + my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{version}); +} + +sub debug_dump { + my ($self, $module) = @_; + $self= $self->new(default=>1) if !ref $self; + local $self->{":private:"}{Config}; + require Data::Dumper; + print Data::Dumper->new([$self])->Sortkeys(1)->Indent(1)->Dump(); +} + + +1; + +__END__ + +=head1 NAME + +ExtUtils::Installed - Inventory management of installed modules + +=head1 SYNOPSIS + + use ExtUtils::Installed; + my ($inst) = ExtUtils::Installed->new( skip_cwd => 1 ); + my (@modules) = $inst->modules(); + my (@missing) = $inst->validate("DBI"); + my $all_files = $inst->files("DBI"); + my $files_below_usr_local = $inst->files("DBI", "all", "/usr/local"); + my $all_dirs = $inst->directories("DBI"); + my $dirs_below_usr_local = $inst->directory_tree("DBI", "prog"); + my $packlist = $inst->packlist("DBI"); + +=head1 DESCRIPTION + +ExtUtils::Installed provides a standard way to find out what core and module +files have been installed. It uses the information stored in .packlist files +created during installation to provide this information. In addition it +provides facilities to classify the installed files and to extract directory +information from the .packlist files. + +=head1 USAGE + +The new() function searches for all the installed .packlists on the system, and +stores their contents. The .packlists can be queried with the functions +described below. Where it searches by default is determined by the settings found +in C<%Config::Config>, and what the value is of the PERL5LIB environment variable. + +=head1 METHODS + +Unless specified otherwise all method can be called as class methods, or as object +methods. If called as class methods then the "default" object will be used, and if +necessary created using the current processes %Config and @INC. See the +'default' option to new() for details. + + +=over 4 + +=item new() + +This takes optional named parameters. Without parameters, this +searches for all the installed .packlists on the system using +information from C<%Config::Config> and the default module search +paths C<@INC>. The packlists are read using the +L<ExtUtils::Packlist> module. + +If the named parameter C<skip_cwd> is true, the current directory C<.> will +be stripped from C<@INC> before searching for .packlists. This keeps +ExtUtils::Installed from finding modules installed in other perls that +happen to be located below the current directory. + +If the named parameter C<config_override> is specified, +it should be a reference to a hash which contains all information +usually found in C<%Config::Config>. For example, you can obtain +the configuration information for a separate perl installation and +pass that in. + + my $yoda_cfg = get_fake_config('yoda'); + my $yoda_inst = + ExtUtils::Installed->new(config_override=>$yoda_cfg); + +Similarly, the parameter C<inc_override> may be a reference to an +array which is used in place of the default module search paths +from C<@INC>. + + use Config; + my @dirs = split(/\Q$Config{path_sep}\E/, $ENV{PERL5LIB}); + my $p5libs = ExtUtils::Installed->new(inc_override=>\@dirs); + +B<Note>: You probably do not want to use these options alone, almost always +you will want to set both together. + +The parameter C<extra_libs> can be used to specify B<additional> paths to +search for installed modules. For instance + + my $installed = + ExtUtils::Installed->new(extra_libs=>["/my/lib/path"]); + +This should only be necessary if F</my/lib/path> is not in PERL5LIB. + +Finally there is the 'default', and the related 'default_get' and 'default_set' +options. These options control the "default" object which is provided by the +class interface to the methods. Setting C<default_get> to true tells the constructor +to return the default object if it is defined. Setting C<default_set> to true tells +the constructor to make the default object the constructed object. Setting the +C<default> option is like setting both to true. This is used primarily internally +and probably isn't interesting to any real user. + +=item modules() + +This returns a list of the names of all the installed modules. The perl 'core' +is given the special name 'Perl'. + +=item files() + +This takes one mandatory parameter, the name of a module. It returns a list of +all the filenames from the package. To obtain a list of core perl files, use +the module name 'Perl'. Additional parameters are allowed. The first is one +of the strings "prog", "doc" or "all", to select either just program files, +just manual files or all files. The remaining parameters are a list of +directories. The filenames returned will be restricted to those under the +specified directories. + +=item directories() + +This takes one mandatory parameter, the name of a module. It returns a list of +all the directories from the package. Additional parameters are allowed. The +first is one of the strings "prog", "doc" or "all", to select either just +program directories, just manual directories or all directories. The remaining +parameters are a list of directories. The directories returned will be +restricted to those under the specified directories. This method returns only +the leaf directories that contain files from the specified module. + +=item directory_tree() + +This is identical in operation to directories(), except that it includes all the +intermediate directories back up to the specified directories. + +=item validate() + +This takes one mandatory parameter, the name of a module. It checks that all +the files listed in the modules .packlist actually exist, and returns a list of +any missing files. If an optional second argument which evaluates to true is +given any missing files will be removed from the .packlist + +=item packlist() + +This returns the ExtUtils::Packlist object for the specified module. + +=item version() + +This returns the version number for the specified module. + +=back + +=head1 EXAMPLE + +See the example in L<ExtUtils::Packlist>. + +=head1 AUTHOR + +Alan Burlison <Alan.Burlison@uk.sun.com> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Liblist.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Liblist.pm new file mode 100644 index 0000000000000000000000000000000000000000..deec54d28832dfa0f7a29efaae94110aa1a94a56 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Liblist.pm @@ -0,0 +1,287 @@ +package ExtUtils::Liblist; + +use strict; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +use File::Spec; +require ExtUtils::Liblist::Kid; +our @ISA = qw(ExtUtils::Liblist::Kid File::Spec); + +# Backwards compatibility with old interface. +sub ext { + goto &ExtUtils::Liblist::Kid::ext; +} + +sub lsdir { + shift; + my $rex = qr/$_[1]/; + opendir my $dir_fh, $_[0]; + my @out = grep /$rex/, readdir $dir_fh; + closedir $dir_fh; + return @out; +} + +__END__ + +=head1 NAME + +ExtUtils::Liblist - determine libraries to use and how to use them + +=head1 SYNOPSIS + + require ExtUtils::Liblist; + + $MM->ext($potential_libs, $verbose, $need_names); + + # Usually you can get away with: + ExtUtils::Liblist->ext($potential_libs, $verbose, $need_names) + +=head1 DESCRIPTION + +This utility takes a list of libraries in the form C<-llib1 -llib2 +-llib3> and returns lines suitable for inclusion in an extension +Makefile. Extra library paths may be included with the form +C<-L/another/path> this will affect the searches for all subsequent +libraries. + +It returns an array of four or five scalar values: EXTRALIBS, +BSLOADLIBS, LDLOADLIBS, LD_RUN_PATH, and, optionally, a reference to +the array of the filenames of actual libraries. Some of these don't +mean anything unless on Unix. See the details about those platform +specifics below. The list of the filenames is returned only if +$need_names argument is true. + +Dependent libraries can be linked in one of three ways: + +=over 2 + +=item * For static extensions + +by the ld command when the perl binary is linked with the extension +library. See EXTRALIBS below. + +=item * For dynamic extensions at build/link time + +by the ld command when the shared object is built/linked. See +LDLOADLIBS below. + +=item * For dynamic extensions at load time + +by the DynaLoader when the shared object is loaded. See BSLOADLIBS +below. + +=back + +=head2 EXTRALIBS + +List of libraries that need to be linked with when linking a perl +binary which includes this extension. Only those libraries that +actually exist are included. These are written to a file and used +when linking perl. + +=head2 LDLOADLIBS and LD_RUN_PATH + +List of those libraries which can or must be linked into the shared +library when created using ld. These may be static or dynamic +libraries. LD_RUN_PATH is a colon separated list of the directories +in LDLOADLIBS. It is passed as an environment variable to the process +that links the shared library. + +=head2 BSLOADLIBS + +List of those libraries that are needed but can be linked in +dynamically at run time on this platform. SunOS/Solaris does not need +this because ld records the information (from LDLOADLIBS) into the +object file. This list is used to create a .bs (bootstrap) file. + +=head1 PORTABILITY + +This module deals with a lot of system dependencies and has quite a +few architecture specific C<if>s in the code. + +=head2 VMS implementation + +The version of ext() which is executed under VMS differs from the +Unix-OS/2 version in several respects: + +=over 2 + +=item * + +Input library and path specifications are accepted with or without the +C<-l> and C<-L> prefixes used by Unix linkers. If neither prefix is +present, a token is considered a directory to search if it is in fact +a directory, and a library to search for otherwise. Authors who wish +their extensions to be portable to Unix or OS/2 should use the Unix +prefixes, since the Unix-OS/2 version of ext() requires them. + +=item * + +Wherever possible, shareable images are preferred to object libraries, +and object libraries to plain object files. In accordance with VMS +naming conventions, ext() looks for files named I<lib>shr and I<lib>rtl; +it also looks for I<lib>lib and libI<lib> to accommodate Unix conventions +used in some ported software. + +=item * + +For each library that is found, an appropriate directive for a linker options +file is generated. The return values are space-separated strings of +these directives, rather than elements used on the linker command line. + +=item * + +LDLOADLIBS contains both the libraries found based on C<$potential_libs> and +the CRTLs, if any, specified in Config.pm. EXTRALIBS contains just those +libraries found based on C<$potential_libs>. BSLOADLIBS and LD_RUN_PATH +are always empty. + +=back + +In addition, an attempt is made to recognize several common Unix library +names, and filter them out or convert them to their VMS equivalents, as +appropriate. + +In general, the VMS version of ext() should properly handle input from +extensions originally designed for a Unix or VMS environment. If you +encounter problems, or discover cases where the search could be improved, +please let us know. + +=head2 Win32 implementation + +The version of ext() which is executed under Win32 differs from the +Unix-OS/2 version in several respects: + +=over 2 + +=item * + +If C<$potential_libs> is empty, the return value will be empty. +Otherwise, the libraries specified by C<$Config{perllibs}> (see Config.pm) +will be appended to the list of C<$potential_libs>. The libraries +will be searched for in the directories specified in C<$potential_libs>, +C<$Config{libpth}>, and in C<$Config{installarchlib}/CORE>. +For each library that is found, a space-separated list of fully qualified +library pathnames is generated. + +=item * + +Input library and path specifications are accepted with or without the +C<-l> and C<-L> prefixes used by Unix linkers. + +An entry of the form C<-La:\foo> specifies the C<a:\foo> directory to look +for the libraries that follow. + +An entry of the form C<-lfoo> specifies the library C<foo>, which may be +spelled differently depending on what kind of compiler you are using. If +you are using GCC, it gets translated to C<libfoo.a>, but for other win32 +compilers, it becomes C<foo.lib>. If no files are found by those translated +names, one more attempt is made to find them using either C<foo.a> or +C<libfoo.lib>, depending on whether GCC or some other win32 compiler is +being used, respectively. + +If neither the C<-L> or C<-l> prefix is present in an entry, the entry is +considered a directory to search if it is in fact a directory, and a +library to search for otherwise. The C<$Config{lib_ext}> suffix will +be appended to any entries that are not directories and don't already have +the suffix. + +Note that the C<-L> and C<-l> prefixes are B<not required>, but authors +who wish their extensions to be portable to Unix or OS/2 should use the +prefixes, since the Unix-OS/2 version of ext() requires them. + +=item * + +Entries cannot be plain object files, as many Win32 compilers will +not handle object files in the place of libraries. + +=item * + +Entries in C<$potential_libs> beginning with a colon and followed by +alphanumeric characters are treated as flags. Unknown flags will be ignored. + +An entry that matches C</:nodefault/i> disables the appending of default +libraries found in C<$Config{perllibs}> (this should be only needed very rarely). + +An entry that matches C</:nosearch/i> disables all searching for +the libraries specified after it. Translation of C<-Lfoo> and +C<-lfoo> still happens as appropriate (depending on compiler being used, +as reflected by C<$Config{cc}>), but the entries are not verified to be +valid files or directories. + +An entry that matches C</:search/i> reenables searching for +the libraries specified after it. You can put it at the end to +enable searching for default libraries specified by C<$Config{perllibs}>. + +=item * + +The libraries specified may be a mixture of static libraries and +import libraries (to link with DLLs). Since both kinds are used +pretty transparently on the Win32 platform, we do not attempt to +distinguish between them. + +=item * + +LDLOADLIBS and EXTRALIBS are always identical under Win32, and BSLOADLIBS +and LD_RUN_PATH are always empty (this may change in future). + +=item * + +You must make sure that any paths and path components are properly +surrounded with double-quotes if they contain spaces. For example, +C<$potential_libs> could be (literally): + + "-Lc:\Program Files\vc\lib" msvcrt.lib "la test\foo bar.lib" + +Note how the first and last entries are protected by quotes in order +to protect the spaces. + +=item * + +Since this module is most often used only indirectly from extension +C<Makefile.PL> files, here is an example C<Makefile.PL> entry to add +a library to the build process for an extension: + + LIBS => ['-lgl'] + +When using GCC, that entry specifies that MakeMaker should first look +for C<libgl.a> (followed by C<gl.a>) in all the locations specified by +C<$Config{libpth}>. + +When using a compiler other than GCC, the above entry will search for +C<gl.lib> (followed by C<libgl.lib>). + +If the library happens to be in a location not in C<$Config{libpth}>, +you need: + + LIBS => ['-Lc:\gllibs -lgl'] + +Here is a less often used example: + + LIBS => ['-lgl', ':nosearch -Ld:\mesalibs -lmesa -luser32'] + +This specifies a search for library C<gl> as before. If that search +fails to find the library, it looks at the next item in the list. The +C<:nosearch> flag will prevent searching for the libraries that follow, +so it simply returns the value as C<-Ld:\mesalibs -lmesa -luser32>, +since GCC can use that value as is with its linker. + +When using the Visual C compiler, the second item is returned as +C<-libpath:d:\mesalibs mesa.lib user32.lib>. + +When using the Borland compiler, the second item is returned as +C<-Ld:\mesalibs mesa.lib user32.lib>, and MakeMaker takes care of +moving the C<-Ld:\mesalibs> to the correct place in the linker +command line. + +=back + + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MANIFEST.SKIP b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MANIFEST.SKIP new file mode 100644 index 0000000000000000000000000000000000000000..72286fdf199be25c292beeb9720722e56a1b1482 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MANIFEST.SKIP @@ -0,0 +1,72 @@ +# Avoid version control files. +\bRCS\b +\bCVS\b +\bSCCS\b +,v$ +\B\.svn\b +\B\.git\b +\B\.gitignore\b +\b_darcs\b +\B\.cvsignore$ + +# Avoid VMS specific MakeMaker generated files +\bDescrip.MMS$ +\bDESCRIP.MMS$ +\bdescrip.mms$ + +# Avoid Makemaker generated and utility files. +\bMANIFEST\.bak +\bMakefile$ +\bblib/ +\bMakeMaker-\d +\bpm_to_blib\.ts$ +\bpm_to_blib$ +\bblibdirs\.ts$ # 6.18 through 6.25 generated this +\b_eumm/ # 7.05_05 and above + +# Avoid Module::Build generated and utility files. +\bBuild$ +\b_build/ +\bBuild.bat$ +\bBuild.COM$ +\bBUILD.COM$ +\bbuild.com$ + +# and Module::Build::Tiny generated files +\b_build_params$ + +# Avoid temp and backup files. +~$ +\.old$ +\#$ +\b\.# +\.bak$ +\.tmp$ +\.# +\.rej$ +\..*\.sw.?$ + +# Avoid OS-specific files/dirs +# Mac OSX metadata +\B\.DS_Store +# Mac OSX SMB mount metadata files +\B\._ + +# Avoid Devel::Cover and Devel::CoverX::Covered files. +\bcover_db\b +\bcovered\b + +# Avoid prove files +\B\.prove$ + +# Avoid MYMETA files +^MYMETA\. + +# Temp files for new META +^META_new\.(?:json|yml) + +# Avoid travis-ci.org file +^\.travis\.yml + +# Avoid AppVeyor file +^\.?appveyor.yml diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM.pm new file mode 100644 index 0000000000000000000000000000000000000000..f1ffa91849e78d11451f2f3132a40ab332dd91e7 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM.pm @@ -0,0 +1,91 @@ +package ExtUtils::MM; + +use strict; +use ExtUtils::MakeMaker::Config; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::Liblist; +require ExtUtils::MakeMaker; +our @ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker); + +=head1 NAME + +ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass + +=head1 SYNOPSIS + + require ExtUtils::MM; + my $mm = MM->new(...); + +=head1 DESCRIPTION + +B<FOR INTERNAL USE ONLY> + +ExtUtils::MM is a subclass of L<ExtUtils::MakeMaker> which automatically +chooses the appropriate OS specific subclass for you +(ie. L<ExtUtils::MM_Unix>, etc...). + +It also provides a convenient alias via the MM class (I didn't want +MakeMaker modules outside of ExtUtils/). + +This class might turn out to be a temporary solution, but MM won't go +away. + +=cut + +{ + # Convenient alias. + package MM; + our @ISA = qw(ExtUtils::MM); + sub DESTROY {} +} + +sub _is_win95 { + # miniperl might not have the Win32 functions available and we need + # to run in miniperl. + my $have_win32 = eval { require Win32 }; + return $have_win32 && defined &Win32::IsWin95 ? Win32::IsWin95() + : ! defined $ENV{SYSTEMROOT}; +} + +my %Is = (); +$Is{VMS} = $^O eq 'VMS'; +$Is{OS2} = $^O eq 'os2'; +$Is{MacOS} = $^O eq 'MacOS'; +if( $^O eq 'MSWin32' ) { + _is_win95() ? $Is{Win95} = 1 : $Is{Win32} = 1; +} +$Is{UWIN} = $^O =~ /^uwin(-nt)?$/; +$Is{Cygwin} = $^O eq 'cygwin'; +$Is{NW5} = $Config{osname} eq 'NetWare'; # intentional +$Is{BeOS} = ($^O =~ /beos/i or $^O eq 'haiku'); +$Is{DOS} = $^O eq 'dos'; +if( $Is{NW5} ) { + $^O = 'NetWare'; + delete $Is{Win32}; +} +$Is{VOS} = $^O eq 'vos'; +$Is{QNX} = $^O eq 'qnx'; +$Is{AIX} = $^O eq 'aix'; +$Is{Darwin} = $^O eq 'darwin'; + +$Is{Unix} = !grep { $_ } values %Is; + +map { delete $Is{$_} unless $Is{$_} } keys %Is; +_assert( keys %Is == 1 ); +my($OS) = keys %Is; + + +my $class = "ExtUtils::MM_$OS"; +eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; ## no critic +die $@ if $@; +unshift @ISA, $class; + + +sub _assert { + my $sanity = shift; + die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity; + return; +} diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_AIX.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_AIX.pm new file mode 100644 index 0000000000000000000000000000000000000000..654e221359420019e1a36dd9b01671bda1903deb --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_AIX.pm @@ -0,0 +1,79 @@ +package ExtUtils::MM_AIX; + +use strict; +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +use ExtUtils::MakeMaker::Config; +require ExtUtils::MM_Unix; +our @ISA = qw(ExtUtils::MM_Unix); + +=head1 NAME + +ExtUtils::MM_AIX - AIX specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Unix> which contains functionality for +AIX. + +Unless otherwise stated it works just like ExtUtils::MM_Unix. + +=head2 Overridden methods + +=head3 dlsyms + +Define DL_FUNCS and DL_VARS and write the *.exp files. + +=cut + +sub dlsyms { + my($self,%attribs) = @_; + return '' unless $self->needs_linking; + join "\n", $self->xs_dlsyms_iterator(\%attribs); +} + +=head3 xs_dlsyms_ext + +On AIX, is C<.exp>. + +=cut + +sub xs_dlsyms_ext { + '.exp'; +} + +sub xs_dlsyms_arg { + my($self, $file) = @_; + my $arg = qq{-bE:${file}}; + $arg = '-Wl,'.$arg if $Config{lddlflags} =~ /-Wl,-bE:/; + return $arg; +} + +sub init_others { + my $self = shift; + $self->SUPER::init_others; + # perl "hints" add -bE:$(BASEEXT).exp to LDDLFLAGS. strip that out + # so right value can be added by xs_make_dynamic_lib to work for XSMULTI + $self->{LDDLFLAGS} ||= $Config{lddlflags}; + $self->{LDDLFLAGS} =~ s#(\s*)\S*\Q$(BASEEXT)\E\S*(\s*)#$1$2#; + return; +} + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Any.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Any.pm new file mode 100644 index 0000000000000000000000000000000000000000..4f4b252c261bd99109dc331286c6aa8732b7352e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Any.pm @@ -0,0 +1,3100 @@ +package ExtUtils::MM_Any; + +use strict; +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +use Carp; +use File::Spec; +use File::Basename; +BEGIN { our @ISA = qw(File::Spec); } + +# We need $Verbose +use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562); + +use ExtUtils::MakeMaker::Config; + + +# So we don't have to keep calling the methods over and over again, +# we have these globals to cache the values. Faster and shrtr. +my $Curdir = __PACKAGE__->curdir; +#my $Updir = __PACKAGE__->updir; + +my $METASPEC_URL = 'https://metacpan.org/pod/CPAN::Meta::Spec'; +my $METASPEC_V = 2; + +=head1 NAME + +ExtUtils::MM_Any - Platform-agnostic MM methods + +=head1 SYNOPSIS + + FOR INTERNAL USE ONLY! + + package ExtUtils::MM_SomeOS; + + # Temporarily, you have to subclass both. Put MM_Any first. + require ExtUtils::MM_Any; + require ExtUtils::MM_Unix; + @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix); + +=head1 DESCRIPTION + +B<FOR INTERNAL USE ONLY!> + +ExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of +modules. It contains methods which are either inherently +cross-platform or are written in a cross-platform manner. + +Subclass off of ExtUtils::MM_Any I<and> L<ExtUtils::MM_Unix>. This is a +temporary solution. + +B<THIS MAY BE TEMPORARY!> + + +=head1 METHODS + +Any methods marked I<Abstract> must be implemented by subclasses. + + +=head2 Cross-platform helper methods + +These are methods which help writing cross-platform code. + + + +=head3 os_flavor I<Abstract> + + my @os_flavor = $mm->os_flavor; + +@os_flavor is the style of operating system this is, usually +corresponding to the MM_*.pm file we're using. + +The first element of @os_flavor is the major family (ie. Unix, +Windows, VMS, OS/2, etc...) and the rest are sub families. + +Some examples: + + Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x') + Windows ('Win32') + Win98 ('Win32', 'Win9x') + Linux ('Unix', 'Linux') + MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X') + OS/2 ('OS/2') + +This is used to write code for styles of operating system. +See os_flavor_is() for use. + + +=head3 os_flavor_is + + my $is_this_flavor = $mm->os_flavor_is($this_flavor); + my $is_this_flavor = $mm->os_flavor_is(@one_of_these_flavors); + +Checks to see if the current operating system is one of the given flavors. + +This is useful for code like: + + if( $mm->os_flavor_is('Unix') ) { + $out = `foo 2>&1`; + } + else { + $out = `foo`; + } + +=cut + +sub os_flavor_is { + my $self = shift; + my %flavors = map { ($_ => 1) } $self->os_flavor; + return (grep { $flavors{$_} } @_) ? 1 : 0; +} + + +=head3 can_load_xs + + my $can_load_xs = $self->can_load_xs; + +Returns true if we have the ability to load XS. + +This is important because miniperl, used to build XS modules in the +core, can not load XS. + +=cut + +sub can_load_xs { + return defined &DynaLoader::boot_DynaLoader ? 1 : 0; +} + + +=head3 can_run + + use ExtUtils::MM; + my $runnable = MM->can_run($Config{make}); + +If called in a scalar context it will return the full path to the binary +you asked for if it was found, or C<undef> if it was not. + +If called in a list context, it will return a list of the full paths to instances +of the binary where found in C<PATH>, or an empty list if it was not found. + +Copied from L<IPC::Cmd|IPC::Cmd/"$path = can_run( PROGRAM );">, but modified into +a method (and removed C<$INSTANCES> capability). + +=cut + +sub can_run { + my ($self, $command) = @_; + + # a lot of VMS executables have a symbol defined + # check those first + if ( $^O eq 'VMS' ) { + require VMS::DCLsym; + my $syms = VMS::DCLsym->new; + return $command if scalar $syms->getsym( uc $command ); + } + + my @possibles; + + if( File::Spec->file_name_is_absolute($command) ) { + return $self->maybe_command($command); + + } else { + for my $dir ( + File::Spec->path, + File::Spec->curdir + ) { + next if ! $dir || ! -d $dir; + my $abs = File::Spec->catfile($self->os_flavor_is('Win32') ? Win32::GetShortPathName( $dir ) : $dir, $command); + push @possibles, $abs if $abs = $self->maybe_command($abs); + } + } + return @possibles if wantarray; + return shift @possibles; +} + + +=head3 can_redirect_error + + $useredirect = MM->can_redirect_error; + +True if on an OS where qx operator (or backticks) can redirect C<STDERR> +onto C<STDOUT>. + +=cut + +sub can_redirect_error { + my $self = shift; + $self->os_flavor_is('Unix') + or ($self->os_flavor_is('Win32') and !$self->os_flavor_is('Win9x')) + or $self->os_flavor_is('OS/2') +} + + +=head3 is_make_type + + my $is_dmake = $self->is_make_type('dmake'); + +Returns true if C<< $self->make >> is the given type; possibilities are: + + gmake GNU make + dmake + nmake + bsdmake BSD pmake-derived + +=cut + +my %maketype2true; +# undocumented - so t/cd.t can still do its thing +sub _clear_maketype_cache { %maketype2true = () } + +sub is_make_type { + my($self, $type) = @_; + return $maketype2true{$type} if defined $maketype2true{$type}; + (undef, undef, my $make_basename) = $self->splitpath($self->make); + return $maketype2true{$type} = 1 + if $make_basename =~ /\b$type\b/i; # executable's filename + return $maketype2true{$type} = 0 + if $make_basename =~ /\b[gdn]make\b/i; # Never fall through for dmake/nmake/gmake + # now have to run with "-v" and guess + my $redirect = $self->can_redirect_error ? '2>&1' : ''; + my $make = $self->make || $self->{MAKE}; + my $minus_v = `"$make" -v $redirect`; + return $maketype2true{$type} = 1 + if $type eq 'gmake' and $minus_v =~ /GNU make/i; + return $maketype2true{$type} = 1 + if $type eq 'bsdmake' + and $minus_v =~ /^usage: make \[-BeikNnqrstWwX\]/im; + $maketype2true{$type} = 0; # it wasn't whatever you asked +} + + +=head3 can_dep_space + + my $can_dep_space = $self->can_dep_space; + +Returns true if C<make> can handle (probably by quoting) +dependencies that contain a space. Currently known true for GNU make, +false for BSD pmake derivative. + +=cut + +my $cached_dep_space; +sub can_dep_space { + my $self = shift; + return $cached_dep_space if defined $cached_dep_space; + return $cached_dep_space = 1 if $self->is_make_type('gmake'); + return $cached_dep_space = 0 if $self->is_make_type('dmake'); # only on W32 + return $cached_dep_space = 0 if $self->is_make_type('bsdmake'); + return $cached_dep_space = 0; # assume no +} + + +=head3 quote_dep + + $text = $mm->quote_dep($text); + +Method that protects Makefile single-value constants (mainly filenames), +so that make will still treat them as single values even if they +inconveniently have spaces in. If the make program being used cannot +achieve such protection and the given text would need it, throws an +exception. + +=cut + +sub quote_dep { + my ($self, $arg) = @_; + die <<EOF if $arg =~ / / and not $self->can_dep_space; +Tried to use make dependency with space for make that can't: + '$arg' +EOF + $arg =~ s/( )/\\$1/g; # how GNU make does it + return $arg; +} + + +=head3 split_command + + my @cmds = $MM->split_command($cmd, @args); + +Most OS have a maximum command length they can execute at once. Large +modules can easily generate commands well past that limit. Its +necessary to split long commands up into a series of shorter commands. + +C<split_command> will return a series of @cmds each processing part of +the args. Collectively they will process all the arguments. Each +individual line in @cmds will not be longer than the +$self->max_exec_len being careful to take into account macro expansion. + +$cmd should include any switches and repeated initial arguments. + +If no @args are given, no @cmds will be returned. + +Pairs of arguments will always be preserved in a single command, this +is a heuristic for things like pm_to_blib and pod2man which work on +pairs of arguments. This makes things like this safe: + + $self->split_command($cmd, %pod2man); + + +=cut + +sub split_command { + my($self, $cmd, @args) = @_; + + my @cmds = (); + return(@cmds) unless @args; + + # If the command was given as a here-doc, there's probably a trailing + # newline. + chomp $cmd; + + # set aside 30% for macro expansion. + my $len_left = int($self->max_exec_len * 0.70); + $len_left -= length $self->_expand_macros($cmd); + + do { + my $arg_str = ''; + my @next_args; + while( @next_args = splice(@args, 0, 2) ) { + # Two at a time to preserve pairs. + my $next_arg_str = "\t ". join ' ', @next_args, "\n"; + + if( !length $arg_str ) { + $arg_str .= $next_arg_str + } + elsif( length($arg_str) + length($next_arg_str) > $len_left ) { + unshift @args, @next_args; + last; + } + else { + $arg_str .= $next_arg_str; + } + } + chop $arg_str; + + push @cmds, $self->escape_newlines("$cmd \n$arg_str"); + } while @args; + + return @cmds; +} + + +sub _expand_macros { + my($self, $cmd) = @_; + + $cmd =~ s{\$\((\w+)\)}{ + defined $self->{$1} ? $self->{$1} : "\$($1)" + }e; + return $cmd; +} + + +=head3 make_type + +Returns a suitable string describing the type of makefile being written. + +=cut + +# override if this isn't suitable! +sub make_type { return 'Unix-style'; } + + +=head3 stashmeta + + my @recipelines = $MM->stashmeta($text, $file); + +Generates a set of C<@recipelines> which will result in the literal +C<$text> ending up in literal C<$file> when the recipe is executed. Call +it once, with all the text you want in C<$file>. Make macros will not +be expanded, so the locations will be fixed at configure-time, not +at build-time. + +=cut + +sub stashmeta { + my($self, $text, $file) = @_; + $self->echo($text, $file, { allow_variables => 0, append => 0 }); +} + + +=head3 echo + + my @commands = $MM->echo($text); + my @commands = $MM->echo($text, $file); + my @commands = $MM->echo($text, $file, \%opts); + +Generates a set of @commands which print the $text to a $file. + +If $file is not given, output goes to STDOUT. + +If $opts{append} is true the $file will be appended to rather than +overwritten. Default is to overwrite. + +If $opts{allow_variables} is true, make variables of the form +C<$(...)> will not be escaped. Other C<$> will. Default is to escape +all C<$>. + +Example of use: + + my $make = join '', map "\t$_\n", $MM->echo($text, $file); + +=cut + +sub echo { + my($self, $text, $file, $opts) = @_; + + # Compatibility with old options + if( !ref $opts ) { + my $append = $opts; + $opts = { append => $append || 0 }; + } + $opts->{allow_variables} = 0 unless defined $opts->{allow_variables}; + + my $ql_opts = { allow_variables => $opts->{allow_variables} }; + my @cmds = map { '$(NOECHO) $(ECHO) '.$self->quote_literal($_, $ql_opts) } + split /\n/, $text; + if( $file ) { + my $redirect = $opts->{append} ? '>>' : '>'; + $cmds[0] .= " $redirect $file"; + $_ .= " >> $file" foreach @cmds[1..$#cmds]; + } + + return @cmds; +} + + +=head3 wraplist + + my $args = $mm->wraplist(@list); + +Takes an array of items and turns them into a well-formatted list of +arguments. In most cases this is simply something like: + + FOO \ + BAR \ + BAZ + +=cut + +sub wraplist { + my $self = shift; + return join " \\\n\t", @_; +} + + +=head3 maketext_filter + + my $filter_make_text = $mm->maketext_filter($make_text); + +The text of the Makefile is run through this method before writing to +disk. It allows systems a chance to make portability fixes to the +Makefile. + +By default it does nothing. + +This method is protected and not intended to be called outside of +MakeMaker. + +=cut + +sub maketext_filter { return $_[1] } + + +=head3 cd I<Abstract> + + my $subdir_cmd = $MM->cd($subdir, @cmds); + +This will generate a make fragment which runs the @cmds in the given +$dir. The rough equivalent to this, except cross platform. + + cd $subdir && $cmd + +Currently $dir can only go down one level. "foo" is fine. "foo/bar" is +not. "../foo" is right out. + +The resulting $subdir_cmd has no leading tab nor trailing newline. This +makes it easier to embed in a make string. For example. + + my $make = sprintf <<'CODE', $subdir_cmd; + foo : + $(ECHO) what + %s + $(ECHO) mouche + CODE + + +=head3 oneliner I<Abstract> + + my $oneliner = $MM->oneliner($perl_code); + my $oneliner = $MM->oneliner($perl_code, \@switches); + +This will generate a perl one-liner safe for the particular platform +you're on based on the given $perl_code and @switches (a -e is +assumed) suitable for using in a make target. It will use the proper +shell quoting and escapes. + +$(PERLRUN) will be used as perl. + +Any newlines in $perl_code will be escaped. Leading and trailing +newlines will be stripped. Makes this idiom much easier: + + my $code = $MM->oneliner(<<'CODE', [...switches...]); +some code here +another line here +CODE + +Usage might be something like: + + # an echo emulation + $oneliner = $MM->oneliner('print "Foo\n"'); + $make = '$oneliner > somefile'; + +Dollar signs in the $perl_code will be protected from make using the +C<quote_literal> method, unless they are recognised as being a make +variable, C<$(varname)>, in which case they will be left for make +to expand. Remember to quote make macros else it might be used as a +bareword. For example: + + # Assign the value of the $(VERSION_FROM) make macro to $vf. + $oneliner = $MM->oneliner('$vf = "$(VERSION_FROM)"'); + +Its currently very simple and may be expanded sometime in the figure +to include more flexible code and switches. + + +=head3 quote_literal I<Abstract> + + my $safe_text = $MM->quote_literal($text); + my $safe_text = $MM->quote_literal($text, \%options); + +This will quote $text so it is interpreted literally in the shell. + +For example, on Unix this would escape any single-quotes in $text and +put single-quotes around the whole thing. + +If $options{allow_variables} is true it will leave C<'$(FOO)'> make +variables untouched. If false they will be escaped like any other +C<$>. Defaults to true. + +=head3 escape_dollarsigns + + my $escaped_text = $MM->escape_dollarsigns($text); + +Escapes stray C<$> so they are not interpreted as make variables. + +It lets by C<$(...)>. + +=cut + +sub escape_dollarsigns { + my($self, $text) = @_; + + # Escape dollar signs which are not starting a variable + $text =~ s{\$ (?!\() }{\$\$}gx; + + return $text; +} + + +=head3 escape_all_dollarsigns + + my $escaped_text = $MM->escape_all_dollarsigns($text); + +Escapes all C<$> so they are not interpreted as make variables. + +=cut + +sub escape_all_dollarsigns { + my($self, $text) = @_; + + # Escape dollar signs + $text =~ s{\$}{\$\$}gx; + + return $text; +} + + +=head3 escape_newlines I<Abstract> + + my $escaped_text = $MM->escape_newlines($text); + +Shell escapes newlines in $text. + + +=head3 max_exec_len I<Abstract> + + my $max_exec_len = $MM->max_exec_len; + +Calculates the maximum command size the OS can exec. Effectively, +this is the max size of a shell command line. + +=for _private +$self->{_MAX_EXEC_LEN} is set by this method, but only for testing purposes. + + +=head3 make + + my $make = $MM->make; + +Returns the make variant we're generating the Makefile for. This attempts +to do some normalization on the information from %Config or the user. + +=cut + +sub make { + my $self = shift; + + my $make = lc $self->{MAKE}; + + # Truncate anything like foomake6 to just foomake. + $make =~ s/^(\w+make).*/$1/; + + # Turn gnumake into gmake. + $make =~ s/^gnu/g/; + + return $make; +} + + +=head2 Targets + +These are methods which produce make targets. + + +=head3 all_target + +Generate the default target 'all'. + +=cut + +sub all_target { + my $self = shift; + + return <<'MAKE_EXT'; +all :: pure_all + $(NOECHO) $(NOOP) +MAKE_EXT + +} + + +=head3 blibdirs_target + + my $make_frag = $mm->blibdirs_target; + +Creates the blibdirs target which creates all the directories we use +in blib/. + +The blibdirs.ts target is deprecated. Depend on blibdirs instead. + + +=cut + +sub _xs_list_basenames { + my ($self) = @_; + map { (my $b = $_) =~ s/\.xs$//; $b } sort keys %{ $self->{XS} }; +} + +sub blibdirs_target { + my $self = shift; + + my @dirs = map { uc "\$(INST_$_)" } qw(libdir archlib + autodir archautodir + bin script + man1dir man3dir + ); + if ($self->{XSMULTI}) { + for my $ext ($self->_xs_list_basenames) { + my ($v, $d, $f) = File::Spec->splitpath($ext); + my @d = File::Spec->splitdir($d); + shift @d if $d[0] eq 'lib'; + push @dirs, $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); + } + } + + my @exists = map { $_.'$(DFSEP).exists' } @dirs; + + my $make = sprintf <<'MAKE', join(' ', @exists); +blibdirs : %s + $(NOECHO) $(NOOP) + +# Backwards compat with 6.18 through 6.25 +blibdirs.ts : blibdirs + $(NOECHO) $(NOOP) + +MAKE + + $make .= $self->dir_target(@dirs); + + return $make; +} + + +=head3 clean (o) + +Defines the clean target. + +=cut + +sub clean { +# --- Cleanup and Distribution Sections --- + + my($self, %attribs) = @_; + my @m; + push(@m, ' +# Delete temporary files but do not touch installed files. We don\'t delete +# the Makefile here so a later make realclean still has a makefile to use. + +clean :: clean_subdirs +'); + + my @files = sort values %{$self->{XS}}; # .c files from *.xs files + push @files, map { + my $file = $_; + map { $file.$_ } $self->{OBJ_EXT}, qw(.def _def.old .bs .bso .exp .base); + } $self->_xs_list_basenames; + my @dirs = qw(blib); + + # Normally these are all under blib but they might have been + # redefined. + # XXX normally this would be a good idea, but the Perl core sets + # INST_LIB = ../../lib rather than actually installing the files. + # So a "make clean" in an ext/ directory would blow away lib. + # Until the core is adjusted let's leave this out. +# push @dirs, qw($(INST_ARCHLIB) $(INST_LIB) +# $(INST_BIN) $(INST_SCRIPT) +# $(INST_MAN1DIR) $(INST_MAN3DIR) +# $(INST_LIBDIR) $(INST_ARCHLIBDIR) $(INST_AUTODIR) +# $(INST_STATIC) $(INST_DYNAMIC) +# ); + + + if( $attribs{FILES} ) { + # Use @dirs because we don't know what's in here. + push @dirs, ref $attribs{FILES} ? + @{$attribs{FILES}} : + split /\s+/, $attribs{FILES} ; + } + + push(@files, qw[$(MAKE_APERL_FILE) + MYMETA.json MYMETA.yml perlmain.c tmon.out mon.out so_locations + blibdirs.ts pm_to_blib pm_to_blib.ts + *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) + $(BOOTSTRAP) $(BASEEXT).bso + $(BASEEXT).def lib$(BASEEXT).def + $(BASEEXT).exp $(BASEEXT).x + ]); + + push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all')); + push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld')); + + # core files + if ($^O eq 'vos') { + push(@files, qw[perl*.kp]); + } + else { + push(@files, qw[core core.*perl.*.? *perl.core]); + } + + push(@files, map { "core." . "[0-9]"x$_ } (1..5)); + + # OS specific things to clean up. Use @dirs since we don't know + # what might be in here. + push @dirs, $self->extra_clean_files; + + # Occasionally files are repeated several times from different sources + { my(%f) = map { ($_ => 1) } @files; @files = sort keys %f; } + { my(%d) = map { ($_ => 1) } @dirs; @dirs = sort keys %d; } + + push @m, map "\t$_\n", $self->split_command('- $(RM_F)', @files); + push @m, map "\t$_\n", $self->split_command('- $(RM_RF)', @dirs); + + # Leave Makefile.old around for realclean + push @m, <<'MAKE'; + $(NOECHO) $(RM_F) $(MAKEFILE_OLD) + - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) +MAKE + + push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; + + join("", @m); +} + + +=head3 clean_subdirs_target + + my $make_frag = $MM->clean_subdirs_target; + +Returns the clean_subdirs target. This is used by the clean target to +call clean on any subdirectories which contain Makefiles. + +=cut + +sub clean_subdirs_target { + my($self) = shift; + + # No subdirectories, no cleaning. + return <<'NOOP_FRAG' unless @{$self->{DIR}}; +clean_subdirs : + $(NOECHO) $(NOOP) +NOOP_FRAG + + + my $clean = "clean_subdirs :\n"; + + for my $dir (@{$self->{DIR}}) { + my $subclean = $self->oneliner(sprintf <<'CODE', $dir); +exit 0 unless chdir '%s'; system '$(MAKE) clean' if -f '$(FIRST_MAKEFILE)'; +CODE + + $clean .= "\t$subclean\n"; + } + + return $clean; +} + + +=head3 dir_target + + my $make_frag = $mm->dir_target(@directories); + +Generates targets to create the specified directories and set its +permission to PERM_DIR. + +Because depending on a directory to just ensure it exists doesn't work +too well (the modified time changes too often) dir_target() creates a +.exists file in the created directory. It is this you should depend on. +For portability purposes you should use the $(DIRFILESEP) macro rather +than a '/' to separate the directory from the file. + + yourdirectory$(DIRFILESEP).exists + +=cut + +sub dir_target { + my($self, @dirs) = @_; + + my $make = ''; + foreach my $dir (@dirs) { + $make .= sprintf <<'MAKE', ($dir) x 4; +%s$(DFSEP).exists :: Makefile.PL + $(NOECHO) $(MKPATH) %s + $(NOECHO) $(CHMOD) $(PERM_DIR) %s + $(NOECHO) $(TOUCH) %s$(DFSEP).exists + +MAKE + + } + + return $make; +} + + +=head3 distdir + +Defines the scratch directory target that will hold the distribution +before tar-ing (or shar-ing). + +=cut + +# For backwards compatibility. +*dist_dir = *distdir; + +sub distdir { + my($self) = shift; + + my $meta_target = $self->{NO_META} ? '' : 'distmeta'; + my $sign_target = !$self->{SIGN} ? '' : 'distsignature'; + + return sprintf <<'MAKE_FRAG', $meta_target, $sign_target; +create_distdir : + $(RM_RF) $(DISTVNAME) + $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ + -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" + +distdir : create_distdir %s %s + $(NOECHO) $(NOOP) + +MAKE_FRAG + +} + + +=head3 dist_test + +Defines a target that produces the distribution in the +scratch directory, and runs 'perl Makefile.PL; make ;make test' in that +subdirectory. + +=cut + +sub dist_test { + my($self) = shift; + + my $mpl_args = join " ", map qq["$_"], @ARGV; + + my $test = $self->cd('$(DISTVNAME)', + '$(ABSPERLRUN) Makefile.PL '.$mpl_args, + '$(MAKE) $(PASTHRU)', + '$(MAKE) test $(PASTHRU)' + ); + + return sprintf <<'MAKE_FRAG', $test; +disttest : distdir + %s + +MAKE_FRAG + + +} + + +=head3 xs_dlsyms_arg + +Returns command-line arg(s) to linker for file listing dlsyms to export. +Defaults to returning empty string, can be overridden by e.g. AIX. + +=cut + +sub xs_dlsyms_arg { + return ''; +} + +=head3 xs_dlsyms_ext + +Returns file-extension for C<xs_make_dlsyms> method's output file, +including any "." character. + +=cut + +sub xs_dlsyms_ext { + die "Pure virtual method"; +} + +=head3 xs_dlsyms_extra + +Returns any extra text to be prepended to the C<$extra> argument of +C<xs_make_dlsyms>. + +=cut + +sub xs_dlsyms_extra { + ''; +} + +=head3 xs_dlsyms_iterator + +Iterates over necessary shared objects, calling C<xs_make_dlsyms> method +for each with appropriate arguments. + +=cut + +sub xs_dlsyms_iterator { + my ($self, $attribs) = @_; + if ($self->{XSMULTI}) { + my @m; + for my $ext ($self->_xs_list_basenames) { + my @parts = File::Spec->splitdir($ext); + shift @parts if $parts[0] eq 'lib'; + my $name = join '::', @parts; + push @m, $self->xs_make_dlsyms( + $attribs, + $ext . $self->xs_dlsyms_ext, + "$ext.xs", + $name, + $parts[-1], + {}, [], {}, [], + $self->xs_dlsyms_extra . q!, 'FILE' => ! . neatvalue($ext), + ); + } + return join "\n", @m; + } else { + return $self->xs_make_dlsyms( + $attribs, + $self->{BASEEXT} . $self->xs_dlsyms_ext, + 'Makefile.PL', + $self->{NAME}, + $self->{DLBASE}, + $attribs->{DL_FUNCS} || $self->{DL_FUNCS} || {}, + $attribs->{FUNCLIST} || $self->{FUNCLIST} || [], + $attribs->{IMPORTS} || $self->{IMPORTS} || {}, + $attribs->{DL_VARS} || $self->{DL_VARS} || [], + $self->xs_dlsyms_extra, + ); + } +} + +=head3 xs_make_dlsyms + + $self->xs_make_dlsyms( + \%attribs, # hashref from %attribs in caller + "$self->{BASEEXT}.def", # output file for Makefile target + 'Makefile.PL', # dependency + $self->{NAME}, # shared object's "name" + $self->{DLBASE}, # last ::-separated part of name + $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}, # various params + $attribs{FUNCLIST} || $self->{FUNCLIST} || [], + $attribs{IMPORTS} || $self->{IMPORTS} || {}, + $attribs{DL_VARS} || $self->{DL_VARS} || [], + # optional extra param that will be added as param to Mksymlists + ); + +Utility method that returns Makefile snippet to call C<Mksymlists>. + +=cut + +sub xs_make_dlsyms { + my ($self, $attribs, $target, $dep, $name, $dlbase, $funcs, $funclist, $imports, $vars, $extra) = @_; + my @m = ( + "\n$target: $dep\n", + q! $(PERLRUN) -MExtUtils::Mksymlists \\ + -e "Mksymlists('NAME'=>\"!, $name, + q!\", 'DLBASE' => '!,$dlbase, + # The above two lines quoted differently to work around + # a bug in the 4DOS/4NT command line interpreter. The visible + # result of the bug was files named q('extension_name',) *with the + # single quotes and the comma* in the extension build directories. + q!', 'DL_FUNCS' => !,neatvalue($funcs), + q!, 'FUNCLIST' => !,neatvalue($funclist), + q!, 'IMPORTS' => !,neatvalue($imports), + q!, 'DL_VARS' => !, neatvalue($vars) + ); + push @m, $extra if defined $extra; + push @m, qq!);"\n!; + join '', @m; +} + +=head3 dynamic (o) + +Defines the dynamic target. + +=cut + +sub dynamic { +# --- Dynamic Loading Sections --- + + my($self) = shift; + ' +dynamic :: $(FIRST_MAKEFILE) config $(INST_BOOT) $(INST_DYNAMIC) + $(NOECHO) $(NOOP) +'; +} + + +=head3 makemakerdflt_target + + my $make_frag = $mm->makemakerdflt_target + +Returns a make fragment with the makemakerdeflt_target specified. +This target is the first target in the Makefile, is the default target +and simply points off to 'all' just in case any make variant gets +confused or something gets snuck in before the real 'all' target. + +=cut + +sub makemakerdflt_target { + return <<'MAKE_FRAG'; +makemakerdflt : all + $(NOECHO) $(NOOP) +MAKE_FRAG + +} + + +=head3 manifypods_target + + my $manifypods_target = $self->manifypods_target; + +Generates the manifypods target. This target generates man pages from +all POD files in MAN1PODS and MAN3PODS. + +=cut + +sub manifypods_target { + my($self) = shift; + + my $man1pods = ''; + my $man3pods = ''; + my $dependencies = ''; + + # populate manXpods & dependencies: + foreach my $name (sort keys %{$self->{MAN1PODS}}, sort keys %{$self->{MAN3PODS}}) { + $dependencies .= " \\\n\t$name"; + } + + my $manify = <<END; +manifypods : pure_all config $dependencies +END + + my @man_cmds; + foreach my $num (qw(1 3)) { + my $pods = $self->{"MAN${num}PODS"}; + my $p2m = sprintf <<'CMD', "\$(MAN${num}SECTION)", "$]" > 5.008 ? " -u" : ""; + $(NOECHO) $(POD2MAN) --section=%s --perm_rw=$(PERM_RW)%s +CMD + push @man_cmds, $self->split_command($p2m, map {($_,$pods->{$_})} sort keys %$pods); + } + + $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds; + $manify .= join '', map { "$_\n" } @man_cmds; + + return $manify; +} + +{ + my $has_cpan_meta; + sub _has_cpan_meta { + return $has_cpan_meta if defined $has_cpan_meta; + return $has_cpan_meta = !!eval { + require CPAN::Meta; + CPAN::Meta->VERSION(2.112150); + 1; + }; + } +} + +=head3 metafile_target + + my $target = $mm->metafile_target; + +Generate the metafile target. + +Writes the file META.yml (YAML encoded meta-data) and META.json +(JSON encoded meta-data) about the module in the distdir. +The format follows Module::Build's as closely as possible. + +=cut + +sub metafile_target { + my $self = shift; + return <<'MAKE_FRAG' if $self->{NO_META} or ! _has_cpan_meta(); +metafile : + $(NOECHO) $(NOOP) +MAKE_FRAG + + my $metadata = $self->metafile_data( + $self->{META_ADD} || {}, + $self->{META_MERGE} || {}, + ); + + my $meta = $self->_fix_metadata_before_conversion( $metadata ); + + my @write_metayml = $self->stashmeta( + $meta->as_string({version => "1.4"}), 'META_new.yml' + ); + my @write_metajson = $self->stashmeta( + $meta->as_string({version => "2.0"}), 'META_new.json' + ); + + my $metayml = join("\n\t", @write_metayml); + my $metajson = join("\n\t", @write_metajson); + return sprintf <<'MAKE_FRAG', $metayml, $metajson; +metafile : create_distdir + $(NOECHO) $(ECHO) Generating META.yml + %s + -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml + $(NOECHO) $(ECHO) Generating META.json + %s + -$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json +MAKE_FRAG + +} + +=begin private + +=head3 _fix_metadata_before_conversion + + $mm->_fix_metadata_before_conversion( \%metadata ); + +Fixes errors in the metadata before it's handed off to L<CPAN::Meta> for +conversion. This hopefully results in something that can be used further +on, no guarantee is made though. + +=end private + +=cut + +sub _fix_metadata_before_conversion { + my ( $self, $metadata ) = @_; + + # we should never be called unless this already passed but + # prefer to be defensive in case somebody else calls this + + return unless _has_cpan_meta; + + my $bad_version = $metadata->{version} && + !CPAN::Meta::Validator->new->version( 'version', $metadata->{version} ); + # just delete all invalid versions + if( $bad_version ) { + warn "Can't parse version '$metadata->{version}'\n"; + $metadata->{version} = ''; + } + + my $validator2 = CPAN::Meta::Validator->new( $metadata ); + my @errors; + push @errors, $validator2->errors if !$validator2->is_valid; + my $validator14 = CPAN::Meta::Validator->new( + { + %$metadata, + 'meta-spec' => { version => 1.4 }, + } + ); + push @errors, $validator14->errors if !$validator14->is_valid; + # fix non-camelcase custom resource keys (only other trick we know) + for my $error ( @errors ) { + my ( $key ) = ( $error =~ /Custom resource '(.*)' must be in CamelCase./ ); + next if !$key; + + # first try to remove all non-alphabetic chars + ( my $new_key = $key ) =~ s/[^_a-zA-Z]//g; + + # if that doesn't work, uppercase first one + $new_key = ucfirst $new_key if !$validator14->custom_1( $new_key ); + + # copy to new key if that worked + $metadata->{resources}{$new_key} = $metadata->{resources}{$key} + if $validator14->custom_1( $new_key ); + + # and delete old one in any case + delete $metadata->{resources}{$key}; + } + + # paper over validation issues, but still complain, necessary because + # there's no guarantee that the above will fix ALL errors + my $meta = eval { CPAN::Meta->create( $metadata, { lazy_validation => 1 } ) }; + warn $@ if $@ and + $@ !~ /encountered CODE.*, but JSON can only represent references to arrays or hashes/; + + # use the original metadata straight if the conversion failed + # or if it can't be stringified. + if( !$meta || + !eval { $meta->as_string( { version => $METASPEC_V } ) } || + !eval { $meta->as_string } + ) { + $meta = bless $metadata, 'CPAN::Meta'; + } + + my $now_license = $meta->as_struct({ version => 2 })->{license}; + if ($self->{LICENSE} and $self->{LICENSE} ne 'unknown' and + @{$now_license} == 1 and $now_license->[0] eq 'unknown' + ) { + warn "Invalid LICENSE value '$self->{LICENSE}' ignored\n"; + } + + $meta; +} + + +=begin private + +=head3 _sort_pairs + + my @pairs = _sort_pairs($sort_sub, \%hash); + +Sorts the pairs of a hash based on keys ordered according +to C<$sort_sub>. + +=end private + +=cut + +sub _sort_pairs { + my $sort = shift; + my $pairs = shift; + return map { $_ => $pairs->{$_} } + sort $sort + keys %$pairs; +} + + +# Taken from Module::Build::Base +sub _hash_merge { + my ($self, $h, $k, $v) = @_; + if (ref $h->{$k} eq 'ARRAY') { + push @{$h->{$k}}, ref $v ? @$v : $v; + } elsif (ref $h->{$k} eq 'HASH') { + $self->_hash_merge($h->{$k}, $_, $v->{$_}) foreach keys %$v; + } else { + $h->{$k} = $v; + } +} + + +=head3 metafile_data + + my $metadata_hashref = $mm->metafile_data(\%meta_add, \%meta_merge); + +Returns the data which MakeMaker turns into the META.yml file +and the META.json file. It is always in version 2.0 of the format. + +Values of %meta_add will overwrite any existing metadata in those +keys. %meta_merge will be merged with them. + +=cut + +sub metafile_data { + my $self = shift; + my($meta_add, $meta_merge) = @_; + + $meta_add ||= {}; + $meta_merge ||= {}; + + my $version = _normalize_version($self->{VERSION}); + my $release_status = ($version =~ /_/) ? 'unstable' : 'stable'; + my %meta = ( + # required + abstract => $self->{ABSTRACT} || 'unknown', + author => defined($self->{AUTHOR}) ? $self->{AUTHOR} : ['unknown'], + dynamic_config => 1, + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + license => [ $self->{LICENSE} || 'unknown' ], + 'meta-spec' => { + url => $METASPEC_URL, + version => $METASPEC_V, + }, + name => $self->{DISTNAME}, + release_status => $release_status, + version => $version, + + # optional + no_index => { directory => [qw(t inc)] }, + ); + $self->_add_requirements_to_meta(\%meta); + + if (!eval { require JSON::PP; require CPAN::Meta::Converter; CPAN::Meta::Converter->VERSION(2.141170) }) { + return \%meta; + } + + # needs to be based on the original version + my $v1_add = _metaspec_version($meta_add) !~ /^2/; + + my ($add_v, $merge_v) = map _metaspec_version($_), $meta_add, $meta_merge; + for my $frag ($meta_add, $meta_merge) { + my $def_v = $frag == $meta_add ? $merge_v : $add_v; + $frag = CPAN::Meta::Converter->new($frag, default_version => $def_v)->upgrade_fragment; + } + + # if we upgraded a 1.x _ADD fragment, we gave it a prereqs key that + # will override all prereqs, which is more than the user asked for; + # instead, we'll go inside the prereqs and override all those + while( my($key, $val) = each %$meta_add ) { + if ($v1_add and $key eq 'prereqs') { + $meta{$key}{$_} = $val->{$_} for keys %$val; + } elsif ($key ne 'meta-spec') { + $meta{$key} = $val; + } + } + + while( my($key, $val) = each %$meta_merge ) { + next if $key eq 'meta-spec'; + $self->_hash_merge(\%meta, $key, $val); + } + + return \%meta; +} + + +=begin private + +=cut + +sub _add_requirements_to_meta { + my ( $self, $meta ) = @_; + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + $meta->{prereqs}{configure}{requires} = $self->{ARGS}{CONFIGURE_REQUIRES} + ? $self->{CONFIGURE_REQUIRES} + : { 'ExtUtils::MakeMaker' => 0, }; + $meta->{prereqs}{build}{requires} = $self->{ARGS}{BUILD_REQUIRES} + ? $self->{BUILD_REQUIRES} + : { 'ExtUtils::MakeMaker' => 0, }; + $meta->{prereqs}{test}{requires} = $self->{TEST_REQUIRES} + if $self->{ARGS}{TEST_REQUIRES}; + $meta->{prereqs}{runtime}{requires} = $self->{PREREQ_PM} + if $self->{ARGS}{PREREQ_PM}; + $meta->{prereqs}{runtime}{requires}{perl} = _normalize_version($self->{MIN_PERL_VERSION}) + if $self->{MIN_PERL_VERSION}; +} + +# spec version of given fragment - if not given, assume 1.4 +sub _metaspec_version { + my ( $meta ) = @_; + return $meta->{'meta-spec'}->{version} + if defined $meta->{'meta-spec'} + and defined $meta->{'meta-spec'}->{version}; + return '1.4'; +} + +sub _add_requirements_to_meta_v1_4 { + my ( $self, $meta ) = @_; + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { + $meta->{configure_requires} = $self->{CONFIGURE_REQUIRES}; + } else { + $meta->{configure_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; + } + if( $self->{ARGS}{BUILD_REQUIRES} ) { + $meta->{build_requires} = $self->{BUILD_REQUIRES}; + } else { + $meta->{build_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; + } + if( $self->{ARGS}{TEST_REQUIRES} ) { + $meta->{build_requires} = { + %{ $meta->{build_requires} }, + %{ $self->{TEST_REQUIRES} }, + }; + } + $meta->{requires} = $self->{PREREQ_PM} + if defined $self->{PREREQ_PM}; + $meta->{requires}{perl} = _normalize_version($self->{MIN_PERL_VERSION}) + if $self->{MIN_PERL_VERSION}; +} + +# Adapted from Module::Build::Base +sub _normalize_version { + my ($version) = @_; + $version = 0 unless defined $version; + + if ( ref $version eq 'version' ) { # version objects + $version = $version->stringify; + } + elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots + # normalize string tuples without "v": "1.2.3" -> "v1.2.3" + $version = "v$version"; + } + else { + # leave alone + } + return $version; +} + +=head3 _dump_hash + + $yaml = _dump_hash(\%options, %hash); + +Implements a fake YAML dumper for a hash given +as a list of pairs. No quoting/escaping is done. Keys +are supposed to be strings. Values are undef, strings, +hash refs or array refs of strings. + +Supported options are: + + delta => STR - indentation delta + use_header => BOOL - whether to include a YAML header + indent => STR - a string of spaces + default: '' + + max_key_length => INT - maximum key length used to align + keys and values of the same hash + default: 20 + key_sort => CODE - a sort sub + It may be undef, which means no sorting by keys + default: sub { lc $a cmp lc $b } + + customs => HASH - special options for certain keys + (whose values are hashes themselves) + may contain: max_key_length, key_sort, customs + +=end private + +=cut + +sub _dump_hash { + croak "first argument should be a hash ref" unless ref $_[0] eq 'HASH'; + my $options = shift; + my %hash = @_; + + # Use a list to preserve order. + my @pairs; + + my $k_sort + = exists $options->{key_sort} ? $options->{key_sort} + : sub { lc $a cmp lc $b }; + if ($k_sort) { + croak "'key_sort' should be a coderef" unless ref $k_sort eq 'CODE'; + @pairs = _sort_pairs($k_sort, \%hash); + } else { # list of pairs, no sorting + @pairs = @_; + } + + my $yaml = $options->{use_header} ? "--- #YAML:1.0\n" : ''; + my $indent = $options->{indent} || ''; + my $k_length = min( + ($options->{max_key_length} || 20), + max(map { length($_) + 1 } grep { !ref $hash{$_} } keys %hash) + ); + my $customs = $options->{customs} || {}; + + # printf format for key + my $k_format = "%-${k_length}s"; + + while( @pairs ) { + my($key, $val) = splice @pairs, 0, 2; + $val = '~' unless defined $val; + if(ref $val eq 'HASH') { + if ( keys %$val ) { + my %k_options = ( # options for recursive call + delta => $options->{delta}, + use_header => 0, + indent => $indent . $options->{delta}, + ); + if (exists $customs->{$key}) { + my %k_custom = %{$customs->{$key}}; + foreach my $k (qw(key_sort max_key_length customs)) { + $k_options{$k} = $k_custom{$k} if exists $k_custom{$k}; + } + } + $yaml .= $indent . "$key:\n" + . _dump_hash(\%k_options, %$val); + } + else { + $yaml .= $indent . "$key: {}\n"; + } + } + elsif (ref $val eq 'ARRAY') { + if( @$val ) { + $yaml .= $indent . "$key:\n"; + + for (@$val) { + croak "only nested arrays of non-refs are supported" if ref $_; + $yaml .= $indent . $options->{delta} . "- $_\n"; + } + } + else { + $yaml .= $indent . "$key: []\n"; + } + } + elsif( ref $val and !blessed($val) ) { + croak "only nested hashes, arrays and objects are supported"; + } + else { # if it's an object, just stringify it + $yaml .= $indent . sprintf "$k_format %s\n", "$key:", $val; + } + }; + + return $yaml; + +} + +sub blessed { + return eval { $_[0]->isa("UNIVERSAL"); }; +} + +sub max { + return (sort { $b <=> $a } @_)[0]; +} + +sub min { + return (sort { $a <=> $b } @_)[0]; +} + +=head3 metafile_file + + my $meta_yml = $mm->metafile_file(@metadata_pairs); + +Turns the @metadata_pairs into YAML. + +This method does not implement a complete YAML dumper, being limited +to dump a hash with values which are strings, undef's or nested hashes +and arrays of strings. No quoting/escaping is done. + +=cut + +sub metafile_file { + my $self = shift; + + my %dump_options = ( + use_header => 1, + delta => ' ' x 4, + key_sort => undef, + ); + return _dump_hash(\%dump_options, @_); + +} + + +=head3 distmeta_target + + my $make_frag = $mm->distmeta_target; + +Generates the distmeta target to add META.yml and META.json to the MANIFEST +in the distdir. + +=cut + +sub distmeta_target { + my $self = shift; + + my @add_meta = ( + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']), +exit unless -e q{META.yml}; +eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) } + or die "Could not add META.yml to MANIFEST: ${'@'}" +CODE + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']) +exit unless -f q{META.json}; +eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) } + or die "Could not add META.json to MANIFEST: ${'@'}" +CODE + ); + + my @add_meta_to_distdir = map { $self->cd('$(DISTVNAME)', $_) } @add_meta; + + return sprintf <<'MAKE', @add_meta_to_distdir; +distmeta : create_distdir metafile + $(NOECHO) %s + $(NOECHO) %s + +MAKE + +} + + +=head3 mymeta + + my $mymeta = $mm->mymeta; + +Generate MYMETA information as a hash either from an existing CPAN Meta file +(META.json or META.yml) or from internal data. + +=cut + +sub mymeta { + my $self = shift; + my $file = shift || ''; # for testing + + my $mymeta = $self->_mymeta_from_meta($file); + my $v2 = 1; + + unless ( $mymeta ) { + $mymeta = $self->metafile_data( + $self->{META_ADD} || {}, + $self->{META_MERGE} || {}, + ); + $v2 = 0; + } + + # Overwrite the non-configure dependency hashes + $self->_add_requirements_to_meta($mymeta); + + $mymeta->{dynamic_config} = 0; + + return $mymeta; +} + + +sub _mymeta_from_meta { + my $self = shift; + my $metafile = shift || ''; # for testing + + return unless _has_cpan_meta(); + + my $meta; + for my $file ( $metafile, "META.json", "META.yml" ) { + next unless -e $file; + eval { + $meta = CPAN::Meta->load_file($file)->as_struct( { version => 2 } ); + }; + last if $meta; + } + return unless $meta; + + # META.yml before 6.25_01 cannot be trusted. META.yml lived in the source directory. + # There was a good chance the author accidentally uploaded a stale META.yml if they + # rolled their own tarball rather than using "make dist". + if ($meta->{generated_by} && + $meta->{generated_by} =~ /ExtUtils::MakeMaker version ([\d\._]+)/) { + my $eummv = do { local $^W = 0; $1+0; }; + if ($eummv < 6.2501) { + return; + } + } + + return $meta; +} + +=head3 write_mymeta + + $self->write_mymeta( $mymeta ); + +Write MYMETA information to MYMETA.json and MYMETA.yml. + +=cut + +sub write_mymeta { + my $self = shift; + my $mymeta = shift; + + return unless _has_cpan_meta(); + + my $meta_obj = $self->_fix_metadata_before_conversion( $mymeta ); + + $meta_obj->save( 'MYMETA.json', { version => "2.0" } ); + $meta_obj->save( 'MYMETA.yml', { version => "1.4" } ); + return 1; +} + +=head3 realclean (o) + +Defines the realclean target. + +=cut + +sub realclean { + my($self, %attribs) = @_; + + my @dirs = qw($(DISTVNAME)); + my @files = qw($(FIRST_MAKEFILE) $(MAKEFILE_OLD)); + + # Special exception for the perl core where INST_* is not in blib. + # This cleans up the files built from the ext/ directory (all XS). + if( $self->{PERL_CORE} ) { + push @dirs, qw($(INST_AUTODIR) $(INST_ARCHAUTODIR)); + push @files, values %{$self->{PM}}; + } + + if( $self->has_link_code ){ + push @files, qw($(OBJECT)); + } + + if( $attribs{FILES} ) { + if( ref $attribs{FILES} ) { + push @dirs, @{ $attribs{FILES} }; + } + else { + push @dirs, split /\s+/, $attribs{FILES}; + } + } + + # Occasionally files are repeated several times from different sources + { my(%f) = map { ($_ => 1) } @files; @files = sort keys %f; } + { my(%d) = map { ($_ => 1) } @dirs; @dirs = sort keys %d; } + + my $rm_cmd = join "\n\t", map { "$_" } + $self->split_command('- $(RM_F)', @files); + my $rmf_cmd = join "\n\t", map { "$_" } + $self->split_command('- $(RM_RF)', @dirs); + + my $m = sprintf <<'MAKE', $rm_cmd, $rmf_cmd; +# Delete temporary files (via clean) and also delete dist files +realclean purge :: realclean_subdirs + %s + %s +MAKE + + $m .= "\t$attribs{POSTOP}\n" if $attribs{POSTOP}; + + return $m; +} + + +=head3 realclean_subdirs_target + + my $make_frag = $MM->realclean_subdirs_target; + +Returns the realclean_subdirs target. This is used by the realclean +target to call realclean on any subdirectories which contain Makefiles. + +=cut + +sub realclean_subdirs_target { + my $self = shift; + my @m = <<'EOF'; +# so clean is forced to complete before realclean_subdirs runs +realclean_subdirs : clean +EOF + return join '', @m, "\t\$(NOECHO) \$(NOOP)\n" unless @{$self->{DIR}}; + foreach my $dir (@{$self->{DIR}}) { + foreach my $makefile ('$(MAKEFILE_OLD)', '$(FIRST_MAKEFILE)' ) { + my $subrclean .= $self->oneliner(_sprintf562 <<'CODE', $dir, $makefile); +chdir '%1$s'; system '$(MAKE) $(USEMAKEFILE) %2$s realclean' if -f '%2$s'; +CODE + push @m, "\t- $subrclean\n"; + } + } + return join '', @m; +} + + +=head3 signature_target + + my $target = $mm->signature_target; + +Generate the signature target. + +Writes the file SIGNATURE with "cpansign -s". + +=cut + +sub signature_target { + my $self = shift; + + return <<'MAKE_FRAG'; +signature : + cpansign -s +MAKE_FRAG + +} + + +=head3 distsignature_target + + my $make_frag = $mm->distsignature_target; + +Generates the distsignature target to add SIGNATURE to the MANIFEST in the +distdir. + +=cut + +sub distsignature_target { + my $self = shift; + + my $add_sign = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']); +eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } + or die "Could not add SIGNATURE to MANIFEST: ${'@'}" +CODE + + my $sign_dist = $self->cd('$(DISTVNAME)' => 'cpansign -s'); + + # cpansign -s complains if SIGNATURE is in the MANIFEST yet does not + # exist + my $touch_sig = $self->cd('$(DISTVNAME)' => '$(TOUCH) SIGNATURE'); + my $add_sign_to_dist = $self->cd('$(DISTVNAME)' => $add_sign ); + + return sprintf <<'MAKE', $add_sign_to_dist, $touch_sig, $sign_dist +distsignature : distmeta + $(NOECHO) %s + $(NOECHO) %s + %s + +MAKE + +} + + +=head3 special_targets + + my $make_frag = $mm->special_targets + +Returns a make fragment containing any targets which have special +meaning to make. For example, .SUFFIXES and .PHONY. + +=cut + +sub special_targets { + my $make_frag = <<'MAKE_FRAG'; +.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) + +.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir pure_all subdirs clean_subdirs makemakerdflt manifypods realclean_subdirs subdirs_dynamic subdirs_pure_nolink subdirs_static subdirs-test_dynamic subdirs-test_static test_dynamic test_static + +MAKE_FRAG + + $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT}; +.NO_CONFIG_REC: Makefile + +MAKE_FRAG + + return $make_frag; +} + + + + +=head2 Init methods + +Methods which help initialize the MakeMaker object and macros. + + +=head3 init_ABSTRACT + + $mm->init_ABSTRACT + +=cut + +sub init_ABSTRACT { + my $self = shift; + + if( $self->{ABSTRACT_FROM} and $self->{ABSTRACT} ) { + warn "Both ABSTRACT_FROM and ABSTRACT are set. ". + "Ignoring ABSTRACT_FROM.\n"; + return; + } + + if ($self->{ABSTRACT_FROM}){ + $self->{ABSTRACT} = $self->parse_abstract($self->{ABSTRACT_FROM}) or + carp "WARNING: Setting ABSTRACT via file ". + "'$self->{ABSTRACT_FROM}' failed\n"; + } + + if ($self->{ABSTRACT} && $self->{ABSTRACT} =~ m![[:cntrl:]]+!) { + warn "WARNING: ABSTRACT contains control character(s),". + " they will be removed\n"; + $self->{ABSTRACT} =~ s![[:cntrl:]]+!!g; + return; + } +} + +=head3 init_INST + + $mm->init_INST; + +Called by init_main. Sets up all INST_* variables except those related +to XS code. Those are handled in init_xs. + +=cut + +sub init_INST { + my($self) = shift; + + $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch"); + $self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin'); + + # INST_LIB typically pre-set if building an extension after + # perl has been built and installed. Setting INST_LIB allows + # you to build directly into, say $Config{privlibexp}. + unless ($self->{INST_LIB}){ + if ($self->{PERL_CORE}) { + $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; + } else { + $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); + } + } + + my @parentdir = split(/::/, $self->{PARENT_NAME}); + $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir); + $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir); + $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto', + '$(FULLEXT)'); + $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto', + '$(FULLEXT)'); + + $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script'); + + $self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1'); + $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3'); + + return 1; +} + + +=head3 init_INSTALL + + $mm->init_INSTALL; + +Called by init_main. Sets up all INSTALL_* variables (except +INSTALLDIRS) and *PREFIX. + +=cut + +sub init_INSTALL { + my($self) = shift; + + if( $self->{ARGS}{INSTALL_BASE} and $self->{ARGS}{PREFIX} ) { + die "Only one of PREFIX or INSTALL_BASE can be given. Not both.\n"; + } + + if( $self->{ARGS}{INSTALL_BASE} ) { + $self->init_INSTALL_from_INSTALL_BASE; + } + else { + $self->init_INSTALL_from_PREFIX; + } +} + + +=head3 init_INSTALL_from_PREFIX + + $mm->init_INSTALL_from_PREFIX; + +=cut + +sub init_INSTALL_from_PREFIX { + my $self = shift; + + $self->init_lib2arch; + + # There are often no Config.pm defaults for these new man variables so + # we fall back to the old behavior which is to use installman*dir + foreach my $num (1, 3) { + my $k = 'installsiteman'.$num.'dir'; + + $self->{uc $k} ||= uc "\$(installman${num}dir)" + unless $Config{$k}; + } + + foreach my $num (1, 3) { + my $k = 'installvendorman'.$num.'dir'; + + unless( $Config{$k} ) { + $self->{uc $k} ||= $Config{usevendorprefix} + ? uc "\$(installman${num}dir)" + : ''; + } + } + + $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)' + unless $Config{installsitebin}; + $self->{INSTALLSITESCRIPT} ||= '$(INSTALLSCRIPT)' + unless $Config{installsitescript}; + + unless( $Config{installvendorbin} ) { + $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix} + ? $Config{installbin} + : ''; + } + unless( $Config{installvendorscript} ) { + $self->{INSTALLVENDORSCRIPT} ||= $Config{usevendorprefix} + ? $Config{installscript} + : ''; + } + + + my $iprefix = $Config{installprefixexp} || $Config{installprefix} || + $Config{prefixexp} || $Config{prefix} || ''; + my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : ''; + my $sprefix = $Config{siteprefixexp} || ''; + + # 5.005_03 doesn't have a siteprefix. + $sprefix = $iprefix unless $sprefix; + + + $self->{PREFIX} ||= ''; + + if( $self->{PREFIX} ) { + @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} = + ('$(PREFIX)') x 3; + } + else { + $self->{PERLPREFIX} ||= $iprefix; + $self->{SITEPREFIX} ||= $sprefix; + $self->{VENDORPREFIX} ||= $vprefix; + + # Lots of MM extension authors like to use $(PREFIX) so we + # put something sensible in there no matter what. + $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)'; + } + + my $arch = $Config{archname}; + my $version = $Config{version}; + + # default style + my $libstyle = $Config{installstyle} || 'lib/perl5'; + my $manstyle = ''; + + if( $self->{LIBSTYLE} ) { + $libstyle = $self->{LIBSTYLE}; + $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : ''; + } + + # Some systems, like VOS, set installman*dir to '' if they can't + # read man pages. + for my $num (1, 3) { + $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none' + unless $Config{'installman'.$num.'dir'}; + } + + my %bin_layouts = + ( + bin => { s => $iprefix, + t => 'perl', + d => 'bin' }, + vendorbin => { s => $vprefix, + t => 'vendor', + d => 'bin' }, + sitebin => { s => $sprefix, + t => 'site', + d => 'bin' }, + script => { s => $iprefix, + t => 'perl', + d => 'bin' }, + vendorscript=> { s => $vprefix, + t => 'vendor', + d => 'bin' }, + sitescript => { s => $sprefix, + t => 'site', + d => 'bin' }, + ); + + my %man_layouts = + ( + man1dir => { s => $iprefix, + t => 'perl', + d => 'man/man1', + style => $manstyle, }, + siteman1dir => { s => $sprefix, + t => 'site', + d => 'man/man1', + style => $manstyle, }, + vendorman1dir => { s => $vprefix, + t => 'vendor', + d => 'man/man1', + style => $manstyle, }, + + man3dir => { s => $iprefix, + t => 'perl', + d => 'man/man3', + style => $manstyle, }, + siteman3dir => { s => $sprefix, + t => 'site', + d => 'man/man3', + style => $manstyle, }, + vendorman3dir => { s => $vprefix, + t => 'vendor', + d => 'man/man3', + style => $manstyle, }, + ); + + my %lib_layouts = + ( + privlib => { s => $iprefix, + t => 'perl', + d => '', + style => $libstyle, }, + vendorlib => { s => $vprefix, + t => 'vendor', + d => '', + style => $libstyle, }, + sitelib => { s => $sprefix, + t => 'site', + d => 'site_perl', + style => $libstyle, }, + + archlib => { s => $iprefix, + t => 'perl', + d => "$version/$arch", + style => $libstyle }, + vendorarch => { s => $vprefix, + t => 'vendor', + d => "$version/$arch", + style => $libstyle }, + sitearch => { s => $sprefix, + t => 'site', + d => "site_perl/$version/$arch", + style => $libstyle }, + ); + + + # Special case for LIB. + if( $self->{LIB} ) { + foreach my $var (keys %lib_layouts) { + my $Installvar = uc "install$var"; + + if( $var =~ /arch/ ) { + $self->{$Installvar} ||= + $self->catdir($self->{LIB}, $Config{archname}); + } + else { + $self->{$Installvar} ||= $self->{LIB}; + } + } + } + + my %type2prefix = ( perl => 'PERLPREFIX', + site => 'SITEPREFIX', + vendor => 'VENDORPREFIX' + ); + + my %layouts = (%bin_layouts, %man_layouts, %lib_layouts); + while( my($var, $layout) = each(%layouts) ) { + my($s, $t, $d, $style) = @{$layout}{qw(s t d style)}; + my $r = '$('.$type2prefix{$t}.')'; + + warn "Prefixing $var\n" if $Verbose >= 2; + + my $installvar = "install$var"; + my $Installvar = uc $installvar; + next if $self->{$Installvar}; + + $d = "$style/$d" if $style; + $self->prefixify($installvar, $s, $r, $d); + + warn " $Installvar == $self->{$Installvar}\n" + if $Verbose >= 2; + } + + # Generate these if they weren't figured out. + $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH}; + $self->{VENDORLIBEXP} ||= $self->{INSTALLVENDORLIB}; + + return 1; +} + + +=head3 init_from_INSTALL_BASE + + $mm->init_from_INSTALL_BASE + +=cut + +my %map = ( + lib => [qw(lib perl5)], + arch => [('lib', 'perl5', $Config{archname})], + bin => [qw(bin)], + man1dir => [qw(man man1)], + man3dir => [qw(man man3)] + ); +$map{script} = $map{bin}; + +sub init_INSTALL_from_INSTALL_BASE { + my $self = shift; + + @{$self}{qw(PREFIX VENDORPREFIX SITEPREFIX PERLPREFIX)} = + '$(INSTALL_BASE)'; + + my %install; + foreach my $thing (keys %map) { + foreach my $dir (('', 'SITE', 'VENDOR')) { + my $uc_thing = uc $thing; + my $key = "INSTALL".$dir.$uc_thing; + + $install{$key} ||= + ($thing =~ /^man.dir$/ and not $Config{lc $key}) + ? 'none' + : $self->catdir('$(INSTALL_BASE)', @{$map{$thing}}); + } + } + + # Adjust for variable quirks. + $install{INSTALLARCHLIB} ||= delete $install{INSTALLARCH}; + $install{INSTALLPRIVLIB} ||= delete $install{INSTALLLIB}; + + foreach my $key (keys %install) { + $self->{$key} ||= $install{$key}; + } + + return 1; +} + + +=head3 init_VERSION I<Abstract> + + $mm->init_VERSION + +Initialize macros representing versions of MakeMaker and other tools + +MAKEMAKER: path to the MakeMaker module. + +MM_VERSION: ExtUtils::MakeMaker Version + +MM_REVISION: ExtUtils::MakeMaker version control revision (for backwards + compat) + +VERSION: version of your module + +VERSION_MACRO: which macro represents the version (usually 'VERSION') + +VERSION_SYM: like version but safe for use as an RCS revision number + +DEFINE_VERSION: -D line to set the module version when compiling + +XS_VERSION: version in your .xs file. Defaults to $(VERSION) + +XS_VERSION_MACRO: which macro represents the XS version. + +XS_DEFINE_VERSION: -D line to set the xs version when compiling. + +Called by init_main. + +=cut + +sub init_VERSION { + my($self) = shift; + + $self->{MAKEMAKER} = $ExtUtils::MakeMaker::Filename; + $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION; + $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision; + $self->{VERSION_FROM} ||= ''; + + if ($self->{VERSION_FROM}){ + $self->{VERSION} = $self->parse_version($self->{VERSION_FROM}); + if( $self->{VERSION} eq 'undef' ) { + carp("WARNING: Setting VERSION via file ". + "'$self->{VERSION_FROM}' failed\n"); + } + } + + if (defined $self->{VERSION}) { + if ( $self->{VERSION} !~ /^\s*v?[\d_\.]+\s*$/ ) { + require version; + my $normal = eval { version->new( $self->{VERSION} ) }; + $self->{VERSION} = $normal if defined $normal; + } + $self->{VERSION} =~ s/^\s+//; + $self->{VERSION} =~ s/\s+$//; + } + else { + $self->{VERSION} = ''; + } + + + $self->{VERSION_MACRO} = 'VERSION'; + ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g; + $self->{DEFINE_VERSION} = '-D$(VERSION_MACRO)=\"$(VERSION)\"'; + + + # Graham Barr and Paul Marquess had some ideas how to ensure + # version compatibility between the *.pm file and the + # corresponding *.xs file. The bottom line was, that we need an + # XS_VERSION macro that defaults to VERSION: + $self->{XS_VERSION} ||= $self->{VERSION}; + + $self->{XS_VERSION_MACRO} = 'XS_VERSION'; + $self->{XS_DEFINE_VERSION} = '-D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"'; + +} + + +=head3 init_tools + + $MM->init_tools(); + +Initializes the simple macro definitions used by tools_other() and +places them in the $MM object. These use conservative cross platform +versions and should be overridden with platform specific versions for +performance. + +Defines at least these macros. + + Macro Description + + NOOP Do nothing + NOECHO Tell make not to display the command itself + + SHELL Program used to run shell commands + + ECHO Print text adding a newline on the end + RM_F Remove a file + RM_RF Remove a directory + TOUCH Update a file's timestamp + TEST_F Test for a file's existence + TEST_S Test the size of a file + CP Copy a file + CP_NONEMPTY Copy a file if it is not empty + MV Move a file + CHMOD Change permissions on a file + FALSE Exit with non-zero + TRUE Exit with zero + + UMASK_NULL Nullify umask + DEV_NULL Suppress all command output + +=cut + +sub init_tools { + my $self = shift; + + $self->{ECHO} ||= $self->oneliner('binmode STDOUT, qq{:raw}; print qq{@ARGV}', ['-l']); + $self->{ECHO_N} ||= $self->oneliner('print qq{@ARGV}'); + + $self->{TOUCH} ||= $self->oneliner('touch', ["-MExtUtils::Command"]); + $self->{CHMOD} ||= $self->oneliner('chmod', ["-MExtUtils::Command"]); + $self->{RM_F} ||= $self->oneliner('rm_f', ["-MExtUtils::Command"]); + $self->{RM_RF} ||= $self->oneliner('rm_rf', ["-MExtUtils::Command"]); + $self->{TEST_F} ||= $self->oneliner('test_f', ["-MExtUtils::Command"]); + $self->{TEST_S} ||= $self->oneliner('test_s', ["-MExtUtils::Command::MM"]); + $self->{CP_NONEMPTY} ||= $self->oneliner('cp_nonempty', ["-MExtUtils::Command::MM"]); + $self->{FALSE} ||= $self->oneliner('exit 1'); + $self->{TRUE} ||= $self->oneliner('exit 0'); + + $self->{MKPATH} ||= $self->oneliner('mkpath', ["-MExtUtils::Command"]); + + $self->{CP} ||= $self->oneliner('cp', ["-MExtUtils::Command"]); + $self->{MV} ||= $self->oneliner('mv', ["-MExtUtils::Command"]); + + $self->{MOD_INSTALL} ||= + $self->oneliner(<<'CODE', ['-MExtUtils::Install']); +install([ from_to => {@ARGV}, verbose => '$(VERBINST)', uninstall_shadows => '$(UNINST)', dir_mode => '$(PERM_DIR)' ]); +CODE + $self->{DOC_INSTALL} ||= $self->oneliner('perllocal_install', ["-MExtUtils::Command::MM"]); + $self->{UNINSTALL} ||= $self->oneliner('uninstall', ["-MExtUtils::Command::MM"]); + $self->{WARN_IF_OLD_PACKLIST} ||= + $self->oneliner('warn_if_old_packlist', ["-MExtUtils::Command::MM"]); + $self->{FIXIN} ||= $self->oneliner('MY->fixin(shift)', ["-MExtUtils::MY"]); + $self->{EQUALIZE_TIMESTAMP} ||= $self->oneliner('eqtime', ["-MExtUtils::Command"]); + + $self->{UNINST} ||= 0; + $self->{VERBINST} ||= 0; + + $self->{SHELL} ||= $Config{sh}; + + # UMASK_NULL is not used by MakeMaker but some CPAN modules + # make use of it. + $self->{UMASK_NULL} ||= "umask 0"; + + # Not the greatest default, but its something. + $self->{DEV_NULL} ||= "> /dev/null 2>&1"; + + $self->{NOOP} ||= '$(TRUE)'; + $self->{NOECHO} = '@' unless defined $self->{NOECHO}; + + $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE} || 'Makefile'; + $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE}; + $self->{MAKEFILE_OLD} ||= $self->{MAKEFILE}.'.old'; + $self->{MAKE_APERL_FILE} ||= $self->{MAKEFILE}.'.aperl'; + + # Not everybody uses -f to indicate "use this Makefile instead" + $self->{USEMAKEFILE} ||= '-f'; + + # Some makes require a wrapper around macros passed in on the command + # line. + $self->{MACROSTART} ||= ''; + $self->{MACROEND} ||= ''; + + return; +} + + +=head3 init_others + + $MM->init_others(); + +Initializes the macro definitions having to do with compiling and +linking used by tools_other() and places them in the $MM object. + +If there is no description, its the same as the parameter to +WriteMakefile() documented in L<ExtUtils::MakeMaker>. + +=cut + +sub init_others { + my $self = shift; + + $self->{LD_RUN_PATH} = ""; + + $self->{LIBS} = $self->_fix_libs($self->{LIBS}); + + # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS} + foreach my $libs ( @{$self->{LIBS}} ){ + $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace + my(@libs) = $self->extliblist($libs); + if ($libs[0] or $libs[1] or $libs[2]){ + # LD_RUN_PATH now computed by ExtUtils::Liblist + ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, + $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs; + last; + } + } + + if ( $self->{OBJECT} ) { + $self->{OBJECT} = join(" ", @{$self->{OBJECT}}) if ref $self->{OBJECT}; + $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g; + } elsif ( ($self->{MAGICXS} || $self->{XSMULTI}) && @{$self->{O_FILES}||[]} ) { + $self->{OBJECT} = join(" ", @{$self->{O_FILES}}); + $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g; + } else { + # init_dirscan should have found out, if we have C files + $self->{OBJECT} = ""; + $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]}; + } + $self->{OBJECT} =~ s/\n+/ \\\n\t/g; + + $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : ""; + $self->{PERLMAINCC} ||= '$(CC)'; + $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM}; + + # Sanity check: don't define LINKTYPE = dynamic if we're skipping + # the 'dynamic' section of MM. We don't have this problem with + # 'static', since we either must use it (%Config says we can't + # use dynamic loading) or the caller asked for it explicitly. + if (!$self->{LINKTYPE}) { + $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'} + ? 'static' + : ($Config{usedl} ? 'dynamic' : 'static'); + } + + return; +} + + +# Lets look at $self->{LIBS} carefully: It may be an anon array, a string or +# undefined. In any case we turn it into an anon array +sub _fix_libs { + my($self, $libs) = @_; + + return !defined $libs ? [''] : + !ref $libs ? [$libs] : + !defined $libs->[0] ? [''] : + $libs ; +} + + +=head3 tools_other + + my $make_frag = $MM->tools_other; + +Returns a make fragment containing definitions for the macros init_others() +initializes. + +=cut + +sub tools_other { + my($self) = shift; + my @m; + + # We set PM_FILTER as late as possible so it can see all the earlier + # on macro-order sensitive makes such as nmake. + for my $tool (qw{ SHELL CHMOD CP MV NOOP NOECHO RM_F RM_RF TEST_F TOUCH + UMASK_NULL DEV_NULL MKPATH EQUALIZE_TIMESTAMP + FALSE TRUE + ECHO ECHO_N + UNINST VERBINST + MOD_INSTALL DOC_INSTALL UNINSTALL + WARN_IF_OLD_PACKLIST + MACROSTART MACROEND + USEMAKEFILE + PM_FILTER + FIXIN + CP_NONEMPTY + } ) + { + next unless defined $self->{$tool}; + push @m, "$tool = $self->{$tool}\n"; + } + + return join "", @m; +} + + +=head3 init_DIRFILESEP I<Abstract> + + $MM->init_DIRFILESEP; + my $dirfilesep = $MM->{DIRFILESEP}; + +Initializes the DIRFILESEP macro which is the separator between the +directory and filename in a filepath. ie. / on Unix, \ on Win32 and +nothing on VMS. + +For example: + + # instead of $(INST_ARCHAUTODIR)/extralibs.ld + $(INST_ARCHAUTODIR)$(DIRFILESEP)extralibs.ld + +Something of a hack but it prevents a lot of code duplication between +MM_* variants. + +Do not use this as a separator between directories. Some operating +systems use different separators between subdirectories as between +directories and filenames (for example: VOLUME:[dir1.dir2]file on VMS). + +=head3 init_linker I<Abstract> + + $mm->init_linker; + +Initialize macros which have to do with linking. + +PERL_ARCHIVE: path to libperl.a equivalent to be linked to dynamic +extensions. + +PERL_ARCHIVE_AFTER: path to a library which should be put on the +linker command line I<after> the external libraries to be linked to +dynamic extensions. This may be needed if the linker is one-pass, and +Perl includes some overrides for C RTL functions, such as malloc(). + +EXPORT_LIST: name of a file that is passed to linker to define symbols +to be exported. + +Some OSes do not need these in which case leave it blank. + + +=head3 init_platform + + $mm->init_platform + +Initialize any macros which are for platform specific use only. + +A typical one is the version number of your OS specific module. +(ie. MM_Unix_VERSION or MM_VMS_VERSION). + +=cut + +sub init_platform { + return ''; +} + + +=head3 init_MAKE + + $mm->init_MAKE + +Initialize MAKE from either a MAKE environment variable or $Config{make}. + +=cut + +sub init_MAKE { + my $self = shift; + + $self->{MAKE} ||= $ENV{MAKE} || $Config{make}; +} + + +=head2 Tools + +A grab bag of methods to generate specific macros and commands. + + + +=head3 manifypods + +Defines targets and routines to translate the pods into manpages and +put them into the INST_* directories. + +=cut + +sub manifypods { + my $self = shift; + + my $POD2MAN_macro = $self->POD2MAN_macro(); + my $manifypods_target = $self->manifypods_target(); + + return <<END_OF_TARGET; + +$POD2MAN_macro + +$manifypods_target + +END_OF_TARGET + +} + + +=head3 POD2MAN_macro + + my $pod2man_macro = $self->POD2MAN_macro + +Returns a definition for the POD2MAN macro. This is a program +which emulates the pod2man utility. You can add more switches to the +command by simply appending them on the macro. + +Typical usage: + + $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) podfile1 man_page1 ... + +=cut + +sub POD2MAN_macro { + my $self = shift; + +# Need the trailing '--' so perl stops gobbling arguments and - happens +# to be an alternative end of line separator on VMS so we quote it + return <<'END_OF_DEF'; +POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" +POD2MAN = $(POD2MAN_EXE) +END_OF_DEF +} + + +=head3 test_via_harness + + my $command = $mm->test_via_harness($perl, $tests); + +Returns a $command line which runs the given set of $tests with +Test::Harness and the given $perl. + +Used on the t/*.t files. + +=cut + +sub test_via_harness { + my($self, $perl, $tests) = @_; + + return qq{\t$perl "-MExtUtils::Command::MM" "-MTest::Harness" }. + qq{"-e" "undef *Test::Harness::Switches; test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n}; +} + +=head3 test_via_script + + my $command = $mm->test_via_script($perl, $script); + +Returns a $command line which just runs a single test without +Test::Harness. No checks are done on the results, they're just +printed. + +Used for test.pl, since they don't always follow Test::Harness +formatting. + +=cut + +sub test_via_script { + my($self, $perl, $script) = @_; + return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n}; +} + + +=head3 tool_autosplit + +Defines a simple perl call that runs autosplit. May be deprecated by +pm_to_blib soon. + +=cut + +sub tool_autosplit { + my($self, %attribs) = @_; + + my $maxlen = $attribs{MAXLEN} ? '$$AutoSplit::Maxlen=$attribs{MAXLEN};' + : ''; + + my $asplit = $self->oneliner(sprintf <<'PERL_CODE', $maxlen); +use AutoSplit; %s autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) +PERL_CODE + + return sprintf <<'MAKE_FRAG', $asplit; +# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto +AUTOSPLITFILE = %s + +MAKE_FRAG + +} + + +=head3 arch_check + + my $arch_ok = $mm->arch_check( + $INC{"Config.pm"}, + File::Spec->catfile($Config{archlibexp}, "Config.pm") + ); + +A sanity check that what Perl thinks the architecture is and what +Config thinks the architecture is are the same. If they're not it +will return false and show a diagnostic message. + +When building Perl it will always return true, as nothing is installed +yet. + +The interface is a bit odd because this is the result of a +quick refactoring. Don't rely on it. + +=cut + +sub arch_check { + my $self = shift; + my($pconfig, $cconfig) = @_; + + return 1 if $self->{PERL_SRC}; + + my($pvol, $pthinks) = $self->splitpath($pconfig); + my($cvol, $cthinks) = $self->splitpath($cconfig); + + $pthinks = $self->canonpath($pthinks); + $cthinks = $self->canonpath($cthinks); + + my $ret = 1; + if ($pthinks ne $cthinks) { + print "Have $pthinks\n"; + print "Want $cthinks\n"; + + $ret = 0; + + my $arch = (grep length, $self->splitdir($pthinks))[-1]; + + print <<END unless $self->{UNINSTALLED_PERL}; +Your perl and your Config.pm seem to have different ideas about the +architecture they are running on. +Perl thinks: [$arch] +Config says: [$Config{archname}] +This may or may not cause problems. Please check your installation of perl +if you have problems building this extension. +END + } + + return $ret; +} + + + +=head2 File::Spec wrappers + +ExtUtils::MM_Any is a subclass of L<File::Spec>. The methods noted here +override File::Spec. + + + +=head3 catfile + +File::Spec <= 0.83 has a bug where the file part of catfile is not +canonicalized. This override fixes that bug. + +=cut + +sub catfile { + my $self = shift; + return $self->canonpath($self->SUPER::catfile(@_)); +} + + + +=head2 Misc + +Methods I can't really figure out where they should go yet. + + +=head3 find_tests + + my $test = $mm->find_tests; + +Returns a string suitable for feeding to the shell to return all +tests in t/*.t. + +=cut + +sub find_tests { + my($self) = shift; + return -d 't' ? 't/*.t' : ''; +} + +=head3 find_tests_recursive + + my $tests = $mm->find_tests_recursive; + +Returns a string suitable for feeding to the shell to return all +tests in t/ but recursively. Equivalent to + + my $tests = $mm->find_tests_recursive_in('t'); + +=cut + +sub find_tests_recursive { + my $self = shift; + return $self->find_tests_recursive_in('t'); +} + +=head3 find_tests_recursive_in + + my $tests = $mm->find_tests_recursive_in($dir); + +Returns a string suitable for feeding to the shell to return all +tests in $dir recursively. + +=cut + +sub find_tests_recursive_in { + my($self, $dir) = @_; + return '' unless -d $dir; + + require File::Find; + + my $base_depth = grep { $_ ne '' } File::Spec->splitdir( (File::Spec->splitpath($dir))[1] ); + my %depths; + + my $wanted = sub { + return unless m!\.t$!; + my ($volume,$directories,$file) = + File::Spec->splitpath( $File::Find::name ); + my $depth = grep { $_ ne '' } File::Spec->splitdir( $directories ); + $depth -= $base_depth; + $depths{ $depth } = 1; + }; + + File::Find::find( $wanted, $dir ); + + return join ' ', + map { $dir . '/*' x $_ . '.t' } + sort { $a <=> $b } + keys %depths; +} + +=head3 extra_clean_files + + my @files_to_clean = $MM->extra_clean_files; + +Returns a list of OS specific files to be removed in the clean target in +addition to the usual set. + +=cut + +# An empty method here tickled a perl 5.8.1 bug and would return its object. +sub extra_clean_files { + return; +} + + +=head3 installvars + + my @installvars = $mm->installvars; + +A list of all the INSTALL* variables without the INSTALL prefix. Useful +for iteration or building related variable sets. + +=cut + +sub installvars { + return qw(PRIVLIB SITELIB VENDORLIB + ARCHLIB SITEARCH VENDORARCH + BIN SITEBIN VENDORBIN + SCRIPT SITESCRIPT VENDORSCRIPT + MAN1DIR SITEMAN1DIR VENDORMAN1DIR + MAN3DIR SITEMAN3DIR VENDORMAN3DIR + ); +} + + +=head3 libscan + + my $wanted = $self->libscan($path); + +Takes a path to a file or dir and returns an empty string if we don't +want to include this file in the library. Otherwise it returns the +the $path unchanged. + +Mainly used to exclude version control administrative directories +and base-level F<README.pod> from installation. + +=cut + +sub libscan { + my($self,$path) = @_; + + if ($path =~ m<^README\.pod$>i) { + warn "WARNING: Older versions of ExtUtils::MakeMaker may errantly install $path as part of this distribution. It is recommended to avoid using this path in CPAN modules.\n"; + return ''; + } + + my($dirs,$file) = ($self->splitpath($path))[1,2]; + return '' if grep /^(?:RCS|CVS|SCCS|\.svn|_darcs)$/, + $self->splitdir($dirs), $file; + + return $path; +} + + +=head3 platform_constants + + my $make_frag = $mm->platform_constants + +Returns a make fragment defining all the macros initialized in +init_platform() rather than put them in constants(). + +=cut + +sub platform_constants { + return ''; +} + +=head3 post_constants (o) + +Returns an empty string per default. Dedicated to overrides from +within Makefile.PL after all constants have been defined. + +=cut + +sub post_constants { + ""; +} + +=head3 post_initialize (o) + +Returns an empty string per default. Used in Makefile.PLs to add some +chunk of text to the Makefile after the object is initialized. + +=cut + +sub post_initialize { + ""; +} + +=head3 postamble (o) + +Returns an empty string. Can be used in Makefile.PLs to write some +text to the Makefile at the end. + +=cut + +sub postamble { + ""; +} + +=begin private + +=head3 _PREREQ_PRINT + + $self->_PREREQ_PRINT; + +Implements PREREQ_PRINT. + +Refactored out of MakeMaker->new(). + +=end private + +=cut + +sub _PREREQ_PRINT { + my $self = shift; + + require Data::Dumper; + my @what = ('PREREQ_PM'); + push @what, 'MIN_PERL_VERSION' if $self->{MIN_PERL_VERSION}; + push @what, 'BUILD_REQUIRES' if $self->{BUILD_REQUIRES}; + print Data::Dumper->Dump([@{$self}{@what}], \@what); + exit 0; +} + + +=begin private + +=head3 _PRINT_PREREQ + + $mm->_PRINT_PREREQ; + +Implements PRINT_PREREQ, a slightly different version of PREREQ_PRINT +added by Redhat to, I think, support generating RPMs from Perl modules. + +Should not include BUILD_REQUIRES as RPMs do not include them. + +Refactored out of MakeMaker->new(). + +=end private + +=cut + +sub _PRINT_PREREQ { + my $self = shift; + + my $prereqs= $self->{PREREQ_PM}; + my @prereq = map { [$_, $prereqs->{$_}] } keys %$prereqs; + + if ( $self->{MIN_PERL_VERSION} ) { + push @prereq, ['perl' => $self->{MIN_PERL_VERSION}]; + } + + print join(" ", map { "perl($_->[0])>=$_->[1] " } + sort { $a->[0] cmp $b->[0] } @prereq), "\n"; + exit 0; +} + + +=begin private + +=head3 _perl_header_files + + my $perl_header_files= $self->_perl_header_files; + +returns a sorted list of header files as found in PERL_SRC or $archlibexp/CORE. + +Used by perldepend() in MM_Unix and MM_VMS via _perl_header_files_fragment() + +=end private + +=cut + +sub _perl_header_files { + my $self = shift; + + my $header_dir = $self->{PERL_SRC} || $ENV{PERL_SRC} || $self->catdir($Config{archlibexp}, 'CORE'); + opendir my $dh, $header_dir + or die "Failed to opendir '$header_dir' to find header files: $!"; + + # we need to use a temporary here as the sort in scalar context would have undefined results. + my @perl_headers= sort grep { /\.h\z/ } readdir($dh); + + closedir $dh; + + return @perl_headers; +} + +=begin private + +=head3 _perl_header_files_fragment ($o, $separator) + + my $perl_header_files_fragment= $self->_perl_header_files_fragment("/"); + +return a Makefile fragment which holds the list of perl header files which +XS code depends on $(PERL_INC), and sets up the dependency for the $(OBJECT) file. + +The $separator argument defaults to "". MM_VMS will set it to "" and MM_UNIX to "/" +in perldepend(). This reason child subclasses need to control this is that in +VMS the $(PERL_INC) directory will already have delimiters in it, but in +UNIX $(PERL_INC) will need a slash between it an the filename. Hypothetically +win32 could use "\\" (but it doesn't need to). + +=end private + +=cut + +sub _perl_header_files_fragment { + my ($self, $separator)= @_; + $separator ||= ""; + return join("\\\n", + "PERL_HDRS = ", + map { + sprintf( " \$(PERL_INCDEP)%s%s ", $separator, $_ ) + } $self->_perl_header_files() + ) . "\n\n" + . "\$(OBJECT) : \$(PERL_HDRS)\n"; +} + + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> and the denizens of +makemaker@perl.org with code from ExtUtils::MM_Unix and +ExtUtils::MM_Win32. + + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_BeOS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_BeOS.pm new file mode 100644 index 0000000000000000000000000000000000000000..d62a7d132f34773a0abfc6ec8a4a01ebc6de4dc6 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_BeOS.pm @@ -0,0 +1,65 @@ +package ExtUtils::MM_BeOS; + +use strict; + +=head1 NAME + +ExtUtils::MM_BeOS - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_BeOS; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided +there. This package overrides the implementation of these methods, not +the semantics. + +=over 4 + +=cut + +use ExtUtils::MakeMaker::Config; +use File::Spec; +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; + +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + + +=item os_flavor + +BeOS is BeOS. + +=cut + +sub os_flavor { + return('BeOS'); +} + +=item init_linker + +libperl.a equivalent to be linked to dynamic extensions. + +=cut + +sub init_linker { + my($self) = shift; + + $self->{PERL_ARCHIVE} ||= + File::Spec->catdir('$(PERL_INC)',$Config{libperl}); + $self->{PERL_ARCHIVEDEP} ||= ''; + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} + +=back + +=cut + +1; +__END__ + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Cygwin.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Cygwin.pm new file mode 100644 index 0000000000000000000000000000000000000000..2052c7c3aa3ad89857349a4e35883440a840ae46 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Cygwin.pm @@ -0,0 +1,165 @@ +package ExtUtils::MM_Cygwin; + +use strict; + +use ExtUtils::MakeMaker::Config; +use File::Spec; + +require ExtUtils::MM_Unix; +require ExtUtils::MM_Win32; +our @ISA = qw( ExtUtils::MM_Unix ); + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + + +=head1 NAME + +ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided there. + +=over 4 + +=item os_flavor + +We're Unix and Cygwin. + +=cut + +sub os_flavor { + return('Unix', 'Cygwin'); +} + +=item cflags + +if configured for dynamic loading, triggers #define EXT in EXTERN.h + +=cut + +sub cflags { + my($self,$libperl)=@_; + return $self->{CFLAGS} if $self->{CFLAGS}; + return '' unless $self->needs_linking(); + + my $base = $self->SUPER::cflags($libperl); + foreach (split /\n/, $base) { + /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; + }; + $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true'); + + return $self->{CFLAGS} = qq{ +CCFLAGS = $self->{CCFLAGS} +OPTIMIZE = $self->{OPTIMIZE} +PERLTYPE = $self->{PERLTYPE} +}; + +} + + +=item replace_manpage_separator + +replaces strings '::' with '.' in MAN*POD man page names + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + $man =~ s{/+}{.}g; + return $man; +} + +=item init_linker + +points to libperl.a + +=cut + +sub init_linker { + my $self = shift; + + if ($Config{useshrplib} eq 'true') { + my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; + if( "$]" >= 5.006002 ) { + $libperl =~ s/(dll\.)?a$/dll.a/; + } + $self->{PERL_ARCHIVE} = $libperl; + } else { + $self->{PERL_ARCHIVE} = + '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); + } + + $self->{PERL_ARCHIVEDEP} ||= ''; + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} + +=item maybe_command + +Determine whether a file is native to Cygwin by checking whether it +resides inside the Cygwin installation (using Windows paths). If so, +use L<ExtUtils::MM_Unix> to determine if it may be a command. +Otherwise use the tests from L<ExtUtils::MM_Win32>. + +=cut + +sub maybe_command { + my ($self, $file) = @_; + + my $cygpath = Cygwin::posix_to_win_path('/', 1); + my $filepath = Cygwin::posix_to_win_path($file, 1); + + return (substr($filepath,0,length($cygpath)) eq $cygpath) + ? $self->SUPER::maybe_command($file) # Unix + : ExtUtils::MM_Win32->maybe_command($file); # Win32 +} + +=item dynamic_lib + +Use the default to produce the *.dll's. +But for new archdir dll's use the same rebase address if the old exists. + +=cut + +sub dynamic_lib { + my($self, %attribs) = @_; + my $s = ExtUtils::MM_Unix::dynamic_lib($self, %attribs); + return '' unless $s; + return $s unless %{$self->{XS}}; + + # do an ephemeral rebase so the new DLL fits to the current rebase map + $s .= "\t/bin/find \$\(INST_ARCHLIB\)/auto -xdev -name \\*.$self->{DLEXT} | /bin/rebase -sOT -" if (( $Config{myarchname} eq 'i686-cygwin' ) and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} )); + $s; +} + +=item install + +Rebase dll's with the global rebase database after installation. + +=cut + +sub install { + my($self, %attribs) = @_; + my $s = ExtUtils::MM_Unix::install($self, %attribs); + return '' unless $s; + return $s unless %{$self->{XS}}; + + my $INSTALLDIRS = $self->{INSTALLDIRS}; + my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")}; + my $dop = "\$\(DESTDIR\)$INSTALLLIB/auto/"; + my $dll = "$dop/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}"; + $s =~ s|^(pure_install :: pure_\$\(INSTALLDIRS\)_install\n\t)\$\(NOECHO\) \$\(NOOP\)\n|$1\$(CHMOD) \$(PERM_RWX) $dll\n\t/bin/find $dop -xdev -name \\*.$self->{DLEXT} \| /bin/rebase -sOT -\n|m if (( $Config{myarchname} eq 'i686-cygwin') and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} )); + $s; +} + +=back + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_DOS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_DOS.pm new file mode 100644 index 0000000000000000000000000000000000000000..d5c66deb895179f8926b4c810120ccb1c51a0f0a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_DOS.pm @@ -0,0 +1,74 @@ +package ExtUtils::MM_DOS; + +use strict; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); + + +=head1 NAME + +ExtUtils::MM_DOS - DOS specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Unix> which contains functionality +for DOS. + +Unless otherwise stated, it works just like ExtUtils::MM_Unix. + +=head2 Overridden methods + +=over 4 + +=item os_flavor + +=cut + +sub os_flavor { + return('DOS'); +} + +=item B<replace_manpage_separator> + +Generates Foo__Bar.3 style man page names + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + + $man =~ s,/+,__,g; + return $man; +} + +=item xs_static_lib_is_xs + +=cut + +sub xs_static_lib_is_xs { + return 1; +} + +=back + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L<ExtUtils::MM_Unix>, L<ExtUtils::MakeMaker> + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Darwin.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Darwin.pm new file mode 100644 index 0000000000000000000000000000000000000000..9ca9d2c62144f59424a6089d6969f377e8d2eda8 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Darwin.pm @@ -0,0 +1,48 @@ +package ExtUtils::MM_Darwin; + +use strict; + +BEGIN { + require ExtUtils::MM_Unix; + our @ISA = qw( ExtUtils::MM_Unix ); +} + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + + +=head1 NAME + +ExtUtils::MM_Darwin - special behaviors for OS X + +=head1 SYNOPSIS + + For internal MakeMaker use only + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> or L<ExtUtils::MM_Any> for documentation on the +methods overridden here. + +=head2 Overridden Methods + +=head3 init_dist + +Turn off Apple tar's tendency to copy resource forks as "._foo" files. + +=cut + +sub init_dist { + my $self = shift; + + # Thank you, Apple, for breaking tar and then breaking the work around. + # 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE while 10.5 wants + # COPYFILE_DISABLE. I'm not going to push my luck and instead just + # set both. + $self->{TAR} ||= + 'COPY_EXTENDED_ATTRIBUTES_DISABLE=1 COPYFILE_DISABLE=1 tar'; + + $self->SUPER::init_dist(@_); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_MacOS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_MacOS.pm new file mode 100644 index 0000000000000000000000000000000000000000..b10e3f9cfba001570ff281f327d2813a89ba8627 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_MacOS.pm @@ -0,0 +1,34 @@ +package ExtUtils::MM_MacOS; + +use strict; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +sub new { + die 'MacOS Classic (MacPerl) is no longer supported by MakeMaker'; +} + +=head1 NAME + +ExtUtils::MM_MacOS - once produced Makefiles for MacOS Classic + +=head1 SYNOPSIS + + # MM_MacOS no longer contains any code. This is just a stub. + +=head1 DESCRIPTION + +Once upon a time, MakeMaker could produce an approximation of a correct +Makefile on MacOS Classic (MacPerl). Due to a lack of maintainers, this +fell out of sync with the rest of MakeMaker and hadn't worked in years. +Since there's little chance of it being repaired, MacOS Classic is fading +away, and the code was icky to begin with, the code has been deleted to +make maintenance easier. + +Anyone interested in resurrecting this file should pull the old version +from the MakeMaker CVS repository and contact makemaker@perl.org. + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_NW5.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_NW5.pm new file mode 100644 index 0000000000000000000000000000000000000000..a9e2e1af5424cd27de1beab60ea568f9f3a3e82d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_NW5.pm @@ -0,0 +1,208 @@ +package ExtUtils::MM_NW5; + +=head1 NAME + +ExtUtils::MM_NW5 - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_NW5; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided +there. This package overrides the implementation of these methods, not +the semantics. + +=over + +=cut + +use strict; +use ExtUtils::MakeMaker::Config; +use File::Basename; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Win32; +our @ISA = qw(ExtUtils::MM_Win32); + +use ExtUtils::MakeMaker qw(&neatvalue &_sprintf562); + +$ENV{EMXSHELL} = 'sh'; # to run `commands` + +my $BORLAND = $Config{'cc'} =~ /\bbcc/i; +my $GCC = $Config{'cc'} =~ /\bgcc/i; + + +=item os_flavor + +We're Netware in addition to being Windows. + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Netware'); +} + +=item init_platform + +Add Netware macros. + +LIBPTH, BASE_IMPORT, NLM_VERSION, MPKTOOL, TOOLPATH, BOOT_SYMBOL, +NLM_SHORT_NAME, INCLUDE, PATH, MM_NW5_REVISION + + +=item platform_constants + +Add Netware macros initialized above to the Makefile. + +=cut + +sub init_platform { + my($self) = shift; + + # To get Win32's setup. + $self->SUPER::init_platform; + + # incpath is copied to makefile var INCLUDE in constants sub, here just + # make it empty + my $libpth = $Config{'libpth'}; + $libpth =~ s( )(;); + $self->{'LIBPTH'} = $libpth; + + $self->{'BASE_IMPORT'} = $Config{'base_import'}; + + # Additional import file specified from Makefile.pl + if($self->{'base_import'}) { + $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'}; + } + + $self->{'NLM_VERSION'} = $Config{'nlm_version'}; + $self->{'MPKTOOL'} = $Config{'mpktool'}; + $self->{'TOOLPATH'} = $Config{'toolpath'}; + + (my $boot = $self->{'NAME'}) =~ s/:/_/g; + $self->{'BOOT_SYMBOL'}=$boot; + + # If the final binary name is greater than 8 chars, + # truncate it here. + if(length($self->{'BASEEXT'}) > 8) { + $self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8); + } + + # Get the include path and replace the spaces with ; + # Copy this to makefile as INCLUDE = d:\...;d:\; + ($self->{INCLUDE} = $Config{'incpath'}) =~ s/([ ]*)-I/;/g; + + # Set the path to CodeWarrior binaries which might not have been set in + # any other place + $self->{PATH} = '$(PATH);$(TOOLPATH)'; + + $self->{MM_NW5_VERSION} = $VERSION; +} + +sub platform_constants { + my($self) = shift; + my $make_frag = ''; + + # Setup Win32's constants. + $make_frag .= $self->SUPER::platform_constants; + + foreach my $macro (qw(LIBPTH BASE_IMPORT NLM_VERSION MPKTOOL + TOOLPATH BOOT_SYMBOL NLM_SHORT_NAME INCLUDE PATH + MM_NW5_VERSION + )) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } + + return $make_frag; +} + +=item static_lib_pure_cmd + +Defines how to run the archive utility + +=cut + +sub static_lib_pure_cmd { + my ($self, $src) = @_; + $src =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND; + sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $src + : ($GCC ? '-ru $@ ' . $src + : '-type library -o $@ ' . $src)); +} + +=item xs_static_lib_is_xs + +=cut + +sub xs_static_lib_is_xs { + return 1; +} + +=item dynamic_lib + +Override of utility methods for OS-specific work. + +=cut + +sub xs_make_dynamic_lib { + my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_; + my @m; + # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc + if ($to =~ /^\$/) { + if ($self->{NLM_SHORT_NAME}) { + # deal with shortnames + my $newto = q{$(INST_AUTODIR)\\$(NLM_SHORT_NAME).$(DLEXT)}; + push @m, "$to: $newto\n\n"; + $to = $newto; + } + } else { + my ($v, $d, $f) = File::Spec->splitpath($to); + # relies on $f having a literal "." in it, unlike for $(OBJ_EXT) + if ($f =~ /[^\.]{9}\./) { + # 9+ chars before '.', need to shorten + $f = substr $f, 0, 8; + } + my $newto = File::Spec->catpath($v, $d, $f); + push @m, "$to: $newto\n\n"; + $to = $newto; + } + # bits below should be in dlsyms, not here + # 1 2 3 4 + push @m, _sprintf562 <<'MAKE_FRAG', $to, $from, $todir, $exportlist; +# Create xdc data for an MT safe NLM in case of mpk build +%1$s: %2$s $(MYEXTLIB) $(BOOTSTRAP) %3$s$(DFSEP).exists + $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > %4$s + $(NOECHO) $(ECHO) $(BASE_IMPORT) >> %4$s + $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> %4$s +MAKE_FRAG + if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) { + (my $xdc = $exportlist) =~ s#def\z#xdc#; + $xdc = '$(BASEEXT).xdc'; + push @m, sprintf <<'MAKE_FRAG', $xdc, $exportlist; + $(MPKTOOL) $(XDCFLAGS) %s + $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> %s +MAKE_FRAG + } + # Reconstruct the X.Y.Z version. + my $version = join '.', map { sprintf "%d", $_ } + "$]" =~ /(\d)\.(\d{3})(\d{2})/; + push @m, sprintf <<'EOF', $from, $version, $to, $exportlist; + $(LD) $(LDFLAGS) %s -desc "Perl %s Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION) -o %s $(MYEXTLIB) $(PERL_INC)\Main.lib -commandfile %s + $(CHMOD) 755 $@ +EOF + join '', @m; +} + +1; +__END__ + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_OS2.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_OS2.pm new file mode 100644 index 0000000000000000000000000000000000000000..300f091c351da9539ec84307a3f0ef79c13bf507 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_OS2.pm @@ -0,0 +1,146 @@ +package ExtUtils::MM_OS2; + +use strict; + +use ExtUtils::MakeMaker qw(neatvalue); +use File::Spec; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +our @ISA = qw(ExtUtils::MM_Any ExtUtils::MM_Unix); + +=pod + +=head1 NAME + +ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided +there. This package overrides the implementation of these methods, not +the semantics. + +=head1 METHODS + +=over 4 + +=item init_dist + +Define TO_UNIX to convert OS2 linefeeds to Unix style. + +=cut + +sub init_dist { + my($self) = @_; + + $self->{TO_UNIX} ||= <<'MAKE_TEXT'; +$(NOECHO) $(TEST_F) tmp.zip && $(RM_F) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM_F) tmp.zip +MAKE_TEXT + + $self->SUPER::init_dist; +} + +sub dlsyms { + my($self,%attribs) = @_; + if ($self->{IMPORTS} && %{$self->{IMPORTS}}) { + # Make import files (needed for static build) + -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp"; + open my $imp, '>', 'tmpimp.imp' or die "Can't open tmpimp.imp"; + foreach my $name (sort keys %{$self->{IMPORTS}}) { + my $exp = $self->{IMPORTS}->{$name}; + my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'"; + print $imp "$name $lib $id ?\n"; + } + close $imp or die "Can't close tmpimp.imp"; + # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n"; + system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp" + and die "Cannot make import library: $!, \$?=$?"; + # May be running under miniperl, so have no glob... + eval { unlink <tmp_imp/*>; 1 } or system "rm tmp_imp/*"; + system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}" + and die "Cannot extract import objects: $!, \$?=$?"; + } + return '' if $self->{SKIPHASH}{'dynamic'}; + $self->xs_dlsyms_iterator(\%attribs); +} + +sub xs_dlsyms_ext { + '.def'; +} + +sub xs_dlsyms_extra { + join '', map { qq{, "$_" => "\$($_)"} } qw(VERSION DISTNAME INSTALLDIRS); +} + +sub static_lib_pure_cmd { + my($self) = @_; + my $old = $self->SUPER::static_lib_pure_cmd; + return $old unless $self->{IMPORTS} && %{$self->{IMPORTS}}; + $old . <<'EOC'; + $(AR) $(AR_STATIC_ARGS) "$@" tmp_imp/* + $(RANLIB) "$@" +EOC +} + +sub replace_manpage_separator { + my($self,$man) = @_; + $man =~ s,/+,.,g; + $man; +} + +sub maybe_command { + my($self,$file) = @_; + $file =~ s,[/\\]+,/,g; + return $file if -x $file && ! -d _; + return "$file.exe" if -x "$file.exe" && ! -d _; + return "$file.cmd" if -x "$file.cmd" && ! -d _; + return; +} + +=item init_linker + +=cut + +sub init_linker { + my $self = shift; + + $self->{PERL_ARCHIVE} = "\$(PERL_INC)/libperl\$(LIB_EXT)"; + + $self->{PERL_ARCHIVEDEP} ||= ''; + $self->{PERL_ARCHIVE_AFTER} = $OS2::is_aout + ? '' + : '$(PERL_INC)/libperl_override$(LIB_EXT)'; + $self->{EXPORT_LIST} = '$(BASEEXT).def'; +} + +=item os_flavor + +OS/2 is OS/2 + +=cut + +sub os_flavor { + return('OS/2'); +} + +=item xs_static_lib_is_xs + +=cut + +sub xs_static_lib_is_xs { + return 1; +} + +=back + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_QNX.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_QNX.pm new file mode 100644 index 0000000000000000000000000000000000000000..3e6f6d06995d647c170272469acf05195e9134f5 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_QNX.pm @@ -0,0 +1,58 @@ +package ExtUtils::MM_QNX; + +use strict; +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Unix; +our @ISA = qw(ExtUtils::MM_Unix); + + +=head1 NAME + +ExtUtils::MM_QNX - QNX specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Unix> which contains functionality for +QNX. + +Unless otherwise stated it works just like ExtUtils::MM_Unix. + +=head2 Overridden methods + +=head3 extra_clean_files + +Add .err files corresponding to each .c file. + +=cut + +sub extra_clean_files { + my $self = shift; + + my @errfiles = @{$self->{C}}; + for ( @errfiles ) { + s/.c$/.err/; + } + + return( @errfiles, 'perlmain.err' ); +} + + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_UWIN.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_UWIN.pm new file mode 100644 index 0000000000000000000000000000000000000000..4201585e3262ad044032fff97800042137367029 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_UWIN.pm @@ -0,0 +1,65 @@ +package ExtUtils::MM_UWIN; + +use strict; +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Unix; +our @ISA = qw(ExtUtils::MM_Unix); + + +=head1 NAME + +ExtUtils::MM_UWIN - U/WIN specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Unix> which contains functionality for +the AT&T U/WIN UNIX on Windows environment. + +Unless otherwise stated it works just like ExtUtils::MM_Unix. + +=head2 Overridden methods + +=over 4 + +=item os_flavor + +In addition to being Unix, we're U/WIN. + +=cut + +sub os_flavor { + return('Unix', 'U/WIN'); +} + + +=item B<replace_manpage_separator> + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + + $man =~ s,/+,.,g; + return $man; +} + +=back + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L<ExtUtils::MM_Win32>, L<ExtUtils::MakeMaker> + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Unix.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Unix.pm new file mode 100644 index 0000000000000000000000000000000000000000..ce1292740f04292d678d8b6007913594c4daf106 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Unix.pm @@ -0,0 +1,4120 @@ +package ExtUtils::MM_Unix; + +require 5.006; + +use strict; + +use Carp; +use ExtUtils::MakeMaker::Config; +use File::Basename qw(basename dirname); + +our %Config_Override; + +use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562); + +# If we make $VERSION an our variable parse_version() breaks +use vars qw($VERSION); +$VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Any; +our @ISA = qw(ExtUtils::MM_Any); + +my %Is; +BEGIN { + $Is{OS2} = $^O eq 'os2'; + $Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare'; + $Is{Dos} = $^O eq 'dos'; + $Is{VMS} = $^O eq 'VMS'; + $Is{OSF} = $^O eq 'dec_osf'; + $Is{IRIX} = $^O eq 'irix'; + $Is{NetBSD} = $^O eq 'netbsd'; + $Is{Interix} = $^O eq 'interix'; + $Is{SunOS4} = $^O eq 'sunos'; + $Is{Solaris} = $^O eq 'solaris'; + $Is{SunOS} = $Is{SunOS4} || $Is{Solaris}; + $Is{BSD} = ($^O =~ /^(?:free|net|open)bsd$/ or + grep( $^O eq $_, qw(bsdos interix dragonfly) ) + ); + $Is{Android} = $^O =~ /android/; + if ( $^O eq 'darwin' && $^X eq '/usr/bin/perl' ) { + my @osvers = split /\./, $Config{osvers}; + $Is{ApplCor} = ( $osvers[0] >= 18 ); + } +} + +BEGIN { + if( $Is{VMS} ) { + # For things like vmsify() + require VMS::Filespec; + VMS::Filespec->import; + } +} + + +=head1 NAME + +ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker + +=head1 SYNOPSIS + + require ExtUtils::MM_Unix; + +=head1 DESCRIPTION + +The methods provided by this package are designed to be used in +conjunction with L<ExtUtils::MakeMaker>. When MakeMaker writes a +Makefile, it creates one or more objects that inherit their methods +from a package L<MM|ExtUtils::MM>. MM itself doesn't provide any methods, but +it ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating +specific packages take the responsibility for all the methods provided +by MM_Unix. We are trying to reduce the number of the necessary +overrides by defining rather primitive operations within +ExtUtils::MM_Unix. + +If you are going to write a platform specific MM package, please try +to limit the necessary overrides to primitive methods, and if it is not +possible to do so, let's work out how to achieve that gain. + +If you are overriding any of these methods in your Makefile.PL (in the +MY class), please report that to the makemaker mailing list. We are +trying to minimize the necessary method overrides and switch to data +driven Makefile.PLs wherever possible. In the long run less methods +will be overridable via the MY class. + +=head1 METHODS + +The following description of methods is still under +development. Please refer to the code for not suitably documented +sections and complain loudly to the makemaker@perl.org mailing list. +Better yet, provide a patch. + +Not all of the methods below are overridable in a +Makefile.PL. Overridable methods are marked as (o). All methods are +overridable by a platform specific MM_*.pm file. + +Cross-platform methods are being moved into L<MM_Any|ExtUtils::MM_Any>. +If you can't find something that used to be in here, look in MM_Any. + +=cut + +# So we don't have to keep calling the methods over and over again, +# we have these globals to cache the values. Faster and shrtr. +my $Curdir = __PACKAGE__->curdir; +my $Updir = __PACKAGE__->updir; + + +=head2 Methods + +=over 4 + +=item os_flavor + +Simply says that we're Unix. + +=cut + +sub os_flavor { + return('Unix'); +} + + +=item c_o (o) + +Defines the suffix rules to compile different flavors of C files to +object files. + +=cut + +sub c_o { +# --- Translation Sections --- + + my($self) = shift; + return '' unless $self->needs_linking(); + my(@m); + + my $command = '$(CCCMD)'; + my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)'; + + if ( $Is{ApplCor} ) { + $flags =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/; + } + + if (my $cpp = $Config{cpprun}) { + my $cpp_cmd = $self->const_cccmd; + $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/; + push @m, qq{ +.c.i: + $cpp_cmd $flags \$*.c > \$*.i +}; + } + + my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*.s') : ''; + push @m, sprintf <<'EOF', $command, $flags, $m_o; + +.c.s : + %s -S %s $*.c %s +EOF + + my @exts = qw(c cpp cxx cc); + push @exts, 'C' if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific + $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; + my $dbgout = $self->dbgoutflag; + for my $ext (@exts) { + push @m, "\n.$ext\$(OBJ_EXT) :\n\t$command $flags " + .($dbgout?"$dbgout ":'') + ."\$*.$ext" . ( $m_o ? " $m_o" : '' ) . "\n"; + } + return join "", @m; +} + + +=item xs_obj_opt + +Takes the object file as an argument, and returns the portion of compile +command-line that will output to the specified object file. + +=cut + +sub xs_obj_opt { + my ($self, $output_file) = @_; + "-o $output_file"; +} + +=item dbgoutflag + +Returns a CC flag that tells the CC to emit a separate debugging symbol file +when compiling an object file. + +=cut + +sub dbgoutflag { + ''; +} + +=item cflags (o) + +Does very much the same as the cflags script in the perl +distribution. It doesn't return the whole compiler command line, but +initializes all of its parts. The const_cccmd method then actually +returns the definition of the CCCMD macro which uses these parts. + +=cut + +#' + +sub cflags { + my($self,$libperl)=@_; + return $self->{CFLAGS} if $self->{CFLAGS}; + return '' unless $self->needs_linking(); + + my($prog, $uc, $perltype, %cflags); + $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ; + $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/; + + @cflags{qw(cc ccflags optimize shellflags)} + = @Config{qw(cc ccflags optimize shellflags)}; + + # Perl 5.21.4 adds the (gcc) warning (-Wall ...) and std (-std=c89) + # flags to the %Config, and the modules in the core should be built + # with the warning flags, but NOT the -std=c89 flags (the latter + # would break using any system header files that are strict C99). + my @ccextraflags = qw(ccwarnflags); + if ($ENV{PERL_CORE}) { + for my $x (@ccextraflags) { + if (exists $Config{$x}) { + $cflags{$x} = $Config{$x}; + } + } + } + + my($optdebug) = ""; + + $cflags{shellflags} ||= ''; + + my(%map) = ( + D => '-DDEBUGGING', + E => '-DEMBED', + DE => '-DDEBUGGING -DEMBED', + M => '-DEMBED -DMULTIPLICITY', + DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', + ); + + if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){ + $uc = uc($1); + } else { + $uc = ""; # avoid warning + } + $perltype = $map{$uc} ? $map{$uc} : ""; + + if ($uc =~ /^D/) { + $optdebug = "-g"; + } + + + my($name); + ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; + if ($prog = $Config{$name}) { + # Expand hints for this extension via the shell + print "Processing $name hint:\n" if $Verbose; + my(@o)=`cc=\"$cflags{cc}\" + ccflags=\"$cflags{ccflags}\" + optimize=\"$cflags{optimize}\" + perltype=\"$cflags{perltype}\" + optdebug=\"$cflags{optdebug}\" + eval '$prog' + echo cc=\$cc + echo ccflags=\$ccflags + echo optimize=\$optimize + echo perltype=\$perltype + echo optdebug=\$optdebug + `; + foreach my $line (@o){ + chomp $line; + if ($line =~ /(.*?)=\s*(.*)\s*$/){ + $cflags{$1} = $2; + print " $1 = $2\n" if $Verbose; + } else { + print "Unrecognised result from hint: '$line'\n"; + } + } + } + + if ($optdebug) { + $cflags{optimize} = $optdebug; + } + + for (qw(ccflags optimize perltype)) { + $cflags{$_} ||= ''; + $cflags{$_} =~ s/^\s+//; + $cflags{$_} =~ s/\s+/ /g; + $cflags{$_} =~ s/\s+$//; + $self->{uc $_} ||= $cflags{$_}; + } + + if ($self->{POLLUTE}) { + $self->{CCFLAGS} .= ' -DPERL_POLLUTE '; + } + + for my $x (@ccextraflags) { + next unless exists $cflags{$x}; + $self->{CCFLAGS} .= $cflags{$x} =~ m!^\s! ? $cflags{$x} : ' ' . $cflags{$x}; + } + + my $pollute = ''; + if ($Config{usemymalloc} and not $Config{bincompat5005} + and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/ + and $self->{PERL_MALLOC_OK}) { + $pollute = '$(PERL_MALLOC_DEF)'; + } + + return $self->{CFLAGS} = qq{ +CCFLAGS = $self->{CCFLAGS} +OPTIMIZE = $self->{OPTIMIZE} +PERLTYPE = $self->{PERLTYPE} +MPOLLUTE = $pollute +}; + +} + + +=item const_cccmd (o) + +Returns the full compiler call for C programs and stores the +definition in CONST_CCCMD. + +=cut + +sub const_cccmd { + my($self,$libperl)=@_; + return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; + return '' unless $self->needs_linking(); + return $self->{CONST_CCCMD} = + q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\ + $(CCFLAGS) $(OPTIMIZE) \\ + $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\ + $(XS_DEFINE_VERSION)}; +} + +=item const_config (o) + +Sets SHELL if needed, then defines a couple of constants in the Makefile +that are imported from %Config. + +=cut + +sub const_config { +# --- Constants Sections --- + + my($self) = shift; + my @m = $self->specify_shell(); # Usually returns empty string + push @m, <<"END"; + +# These definitions are from config.sh (via $INC{'Config.pm'}). +# They may have been overridden via Makefile.PL or on the command line. +END + + my(%once_only); + foreach my $key (@{$self->{CONFIG}}){ + # SITE*EXP macros are defined in &constants; avoid duplicates here + next if $once_only{$key}; + push @m, uc($key) , ' = ' , $self->{uc $key}, "\n"; + $once_only{$key} = 1; + } + join('', @m); +} + +=item const_loadlibs (o) + +Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See +L<ExtUtils::Liblist> for details. + +=cut + +sub const_loadlibs { + my($self) = shift; + return "" unless $self->needs_linking; + my @m; + push @m, qq{ +# $self->{NAME} might depend on some other libraries: +# See ExtUtils::Liblist for details +# +}; + for my $tmp (qw/ + EXTRALIBS LDLOADLIBS BSLOADLIBS + /) { + next unless defined $self->{$tmp}; + push @m, "$tmp = $self->{$tmp}\n"; + } + # don't set LD_RUN_PATH if empty + for my $tmp (qw/ + LD_RUN_PATH + /) { + next unless $self->{$tmp}; + push @m, "$tmp = $self->{$tmp}\n"; + } + return join "", @m; +} + +=item constants (o) + + my $make_frag = $mm->constants; + +Prints out macros for lots of constants. + +=cut + +sub constants { + my($self) = @_; + my @m = (); + + $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use + + for my $macro (qw( + + AR_STATIC_ARGS DIRFILESEP DFSEP + NAME NAME_SYM + VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION + XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION + INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB + INST_MAN1DIR INST_MAN3DIR + MAN1EXT MAN3EXT + MAN1SECTION MAN3SECTION + INSTALLDIRS INSTALL_BASE DESTDIR PREFIX + PERLPREFIX SITEPREFIX VENDORPREFIX + ), + (map { ("INSTALL".$_, + "DESTINSTALL".$_) + } $self->installvars), + qw( + PERL_LIB + PERL_ARCHLIB PERL_ARCHLIBDEP + LIBPERL_A MYEXTLIB + FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE + PERLMAINCC PERL_SRC PERL_INC PERL_INCDEP + PERL FULLPERL ABSPERL + PERLRUN FULLPERLRUN ABSPERLRUN + PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST + PERL_CORE + PERM_DIR PERM_RW PERM_RWX + + ) ) + { + next unless defined $self->{$macro}; + + # pathnames can have sharp signs in them; escape them so + # make doesn't think it is a comment-start character. + $self->{$macro} =~ s/#/\\#/g; + $self->{$macro} = $self->quote_dep($self->{$macro}) + if $ExtUtils::MakeMaker::macro_dep{$macro}; + push @m, "$macro = $self->{$macro}\n"; + } + + push @m, qq{ +MAKEMAKER = $self->{MAKEMAKER} +MM_VERSION = $self->{MM_VERSION} +MM_REVISION = $self->{MM_REVISION} +}; + + push @m, q{ +# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). +# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) +# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) +# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. +}; + + for my $macro (qw/ + MAKE + FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT + LDFROM LINKTYPE BOOTDEP + / ) + { + next unless defined $self->{$macro}; + push @m, "$macro = $self->{$macro}\n"; + } + + push @m, " +# Handy lists of source code files: +XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})." +C_FILES = ".$self->wraplist(sort @{$self->{C}})." +O_FILES = ".$self->wraplist(sort @{$self->{O_FILES}})." +H_FILES = ".$self->wraplist(sort @{$self->{H}})." +MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})." +MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})." +"; + + push @m, q{ +SDKROOT := $(shell xcrun --show-sdk-path) +PERL_SYSROOT = $(SDKROOT) +} if $Is{ApplCor} && $self->{'PERL_INC'} =~ m!^/System/Library/Perl/!; + + push @m, q{ +# Where is the Config information that we are using/depend on +CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_SYSROOT)$(PERL_INCDEP)$(DFSEP)config.h +} if $Is{ApplCor}; + + push @m, q{ +# Where is the Config information that we are using/depend on +CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h +} if -e $self->catfile( $self->{PERL_INC}, 'config.h' ) && !$Is{ApplCor}; + + push @m, qq{ +# Where to build things +INST_LIBDIR = $self->{INST_LIBDIR} +INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR} + +INST_AUTODIR = $self->{INST_AUTODIR} +INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR} + +INST_STATIC = $self->{INST_STATIC} +INST_DYNAMIC = $self->{INST_DYNAMIC} +INST_BOOT = $self->{INST_BOOT} +}; + + push @m, qq{ +# Extra linker info +EXPORT_LIST = $self->{EXPORT_LIST} +PERL_ARCHIVE = $self->{PERL_ARCHIVE} +PERL_ARCHIVEDEP = $self->{PERL_ARCHIVEDEP} +PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER} +}; + + push @m, " + +TO_INST_PM = ".$self->wraplist(map $self->quote_dep($_), sort keys %{$self->{PM}})."\n"; + + join('',@m); +} + + +=item depend (o) + +Same as macro for the depend attribute. + +=cut + +sub depend { + my($self,%attribs) = @_; + my(@m,$key,$val); + for my $key (sort keys %attribs){ + my $val = $attribs{$key}; + next unless defined $key and defined $val; + push @m, "$key : $val\n"; + } + join "", @m; +} + + +=item init_DEST + + $mm->init_DEST + +Defines the DESTDIR and DEST* variables paralleling the INSTALL*. + +=cut + +sub init_DEST { + my $self = shift; + + # Initialize DESTDIR + $self->{DESTDIR} ||= ''; + + # Make DEST variables. + foreach my $var ($self->installvars) { + my $destvar = 'DESTINSTALL'.$var; + $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')'; + } +} + + +=item init_dist + + $mm->init_dist; + +Defines a lot of macros for distribution support. + + macro description default + + TAR tar command to use tar + TARFLAGS flags to pass to TAR cvf + + ZIP zip command to use zip + ZIPFLAGS flags to pass to ZIP -r + + COMPRESS compression command to gzip --best + use for tarfiles + SUFFIX suffix to put on .gz + compressed files + + SHAR shar command to use shar + + PREOP extra commands to run before + making the archive + POSTOP extra commands to run after + making the archive + + TO_UNIX a command to convert linefeeds + to Unix style in your archive + + CI command to checkin your ci -u + sources to version control + RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q + just after CI is run + + DIST_CP $how argument to manicopy() best + when the distdir is created + + DIST_DEFAULT default target to use to tardist + create a distribution + + DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION) + (minus suffixes) + +=cut + +sub init_dist { + my $self = shift; + + $self->{TAR} ||= 'tar'; + $self->{TARFLAGS} ||= 'cvf'; + $self->{ZIP} ||= 'zip'; + $self->{ZIPFLAGS} ||= '-r'; + $self->{COMPRESS} ||= 'gzip --best'; + $self->{SUFFIX} ||= '.gz'; + $self->{SHAR} ||= 'shar'; + $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST + $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir + $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)'; + + $self->{CI} ||= 'ci -u'; + $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; + $self->{DIST_CP} ||= 'best'; + $self->{DIST_DEFAULT} ||= 'tardist'; + + ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME}; + $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION}; +} + +=item dist (o) + + my $dist_macros = $mm->dist(%overrides); + +Generates a make fragment defining all the macros initialized in +init_dist. + +%overrides can be used to override any of the above. + +=cut + +sub dist { + my($self, %attribs) = @_; + + my $make = ''; + if ( $attribs{SUFFIX} && $attribs{SUFFIX} !~ m!^\.! ) { + $attribs{SUFFIX} = '.' . $attribs{SUFFIX}; + } + foreach my $key (qw( + TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR + PREOP POSTOP TO_UNIX + CI RCS_LABEL DIST_CP DIST_DEFAULT + DISTNAME DISTVNAME + )) + { + my $value = $attribs{$key} || $self->{$key}; + $make .= "$key = $value\n"; + } + + return $make; +} + +=item dist_basics (o) + +Defines the targets distclean, distcheck, skipcheck, manifest, veryclean. + +=cut + +sub dist_basics { + my($self) = shift; + + return <<'MAKE_FRAG'; +distclean :: realclean distcheck + $(NOECHO) $(NOOP) + +distcheck : + $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck + +skipcheck : + $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck + +manifest : + $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest + +veryclean : realclean + $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old + +MAKE_FRAG + +} + +=item dist_ci (o) + +Defines a check in target for RCS. + +=cut + +sub dist_ci { + my($self) = shift; + return sprintf "ci :\n\t%s\n", $self->oneliner(<<'EOF', [qw(-MExtUtils::Manifest=maniread)]); +@all = sort keys %{ maniread() }; +print(qq{Executing $(CI) @all\n}); +system(qq{$(CI) @all}) == 0 or die $!; +print(qq{Executing $(RCS_LABEL) ...\n}); +system(qq{$(RCS_LABEL) @all}) == 0 or die $!; +EOF +} + +=item dist_core (o) + + my $dist_make_fragment = $MM->dist_core; + +Puts the targets necessary for 'make dist' together into one make +fragment. + +=cut + +sub dist_core { + my($self) = shift; + + my $make_frag = ''; + foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile + shdist)) + { + my $method = $target.'_target'; + $make_frag .= "\n"; + $make_frag .= $self->$method(); + } + + return $make_frag; +} + + +=item B<dist_target> + + my $make_frag = $MM->dist_target; + +Returns the 'dist' target to make an archive for distribution. This +target simply checks to make sure the Makefile is up-to-date and +depends on $(DIST_DEFAULT). + +=cut + +sub dist_target { + my($self) = shift; + + my $date_check = $self->oneliner(<<'CODE', ['-l']); +print 'Warning: Makefile possibly out of date with $(VERSION_FROM)' + if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)'; +CODE + + return sprintf <<'MAKE_FRAG', $date_check; +dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) + $(NOECHO) %s +MAKE_FRAG +} + +=item B<tardist_target> + + my $make_frag = $MM->tardist_target; + +Returns the 'tardist' target which is simply so 'make tardist' works. +The real work is done by the dynamically named tardistfile_target() +method, tardist should have that as a dependency. + +=cut + +sub tardist_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +tardist : $(DISTVNAME).tar$(SUFFIX) + $(NOECHO) $(NOOP) +MAKE_FRAG +} + +=item B<zipdist_target> + + my $make_frag = $MM->zipdist_target; + +Returns the 'zipdist' target which is simply so 'make zipdist' works. +The real work is done by the dynamically named zipdistfile_target() +method, zipdist should have that as a dependency. + +=cut + +sub zipdist_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +zipdist : $(DISTVNAME).zip + $(NOECHO) $(NOOP) +MAKE_FRAG +} + +=item B<tarfile_target> + + my $make_frag = $MM->tarfile_target; + +The name of this target is the name of the tarball generated by +tardist. This target does the actual work of turning the distdir into +a tarball. + +=cut + +sub tarfile_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +$(DISTVNAME).tar$(SUFFIX) : distdir + $(PREOP) + $(TO_UNIX) + $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) + $(RM_RF) $(DISTVNAME) + $(COMPRESS) $(DISTVNAME).tar + $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)' + $(POSTOP) +MAKE_FRAG +} + +=item zipfile_target + + my $make_frag = $MM->zipfile_target; + +The name of this target is the name of the zip file generated by +zipdist. This target does the actual work of turning the distdir into +a zip file. + +=cut + +sub zipfile_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +$(DISTVNAME).zip : distdir + $(PREOP) + $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) + $(RM_RF) $(DISTVNAME) + $(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip' + $(POSTOP) +MAKE_FRAG +} + +=item uutardist_target + + my $make_frag = $MM->uutardist_target; + +Converts the tarfile into a uuencoded file + +=cut + +sub uutardist_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +uutardist : $(DISTVNAME).tar$(SUFFIX) + uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu + $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu' +MAKE_FRAG +} + + +=item shdist_target + + my $make_frag = $MM->shdist_target; + +Converts the distdir into a shell archive. + +=cut + +sub shdist_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +shdist : distdir + $(PREOP) + $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar + $(RM_RF) $(DISTVNAME) + $(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar' + $(POSTOP) +MAKE_FRAG +} + + +=item dlsyms (o) + +Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files. + +Normally just returns an empty string. + +=cut + +sub dlsyms { + return ''; +} + + +=item dynamic_bs (o) + +Defines targets for bootstrap files. + +=cut + +sub dynamic_bs { + my($self, %attribs) = @_; + return "\nBOOTSTRAP =\n" unless $self->has_link_code(); + my @exts; + if ($self->{XSMULTI}) { + @exts = $self->_xs_list_basenames; + } else { + @exts = '$(BASEEXT)'; + } + return join "\n", + "BOOTSTRAP = @{[map { qq{$_.bs} } @exts]}\n", + map { $self->_xs_make_bs($_) } @exts; +} + +sub _xs_make_bs { + my ($self, $basename) = @_; + my ($v, $d, $f) = File::Spec->splitpath($basename); + my @d = File::Spec->splitdir($d); + shift @d if $self->{XSMULTI} and $d[0] eq 'lib'; + my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); + $instdir = '$(INST_ARCHAUTODIR)' if $basename eq '$(BASEEXT)'; + my $instfile = $self->catfile($instdir, "$f.bs"); + my $exists = "$instdir\$(DFSEP).exists"; # match blibdirs_target + # 1 2 3 + return _sprintf562 <<'MAKE_FRAG', $basename, $instfile, $exists; +# As Mkbootstrap might not write a file (if none is required) +# we use touch to prevent make continually trying to remake it. +# The DynaLoader only reads a non-empty file. +%1$s.bs : $(FIRST_MAKEFILE) $(BOOTDEP) + $(NOECHO) $(ECHO) "Running Mkbootstrap for %1$s ($(BSLOADLIBS))" + $(NOECHO) $(PERLRUN) \ + "-MExtUtils::Mkbootstrap" \ + -e "Mkbootstrap('%1$s','$(BSLOADLIBS)');" + $(NOECHO) $(TOUCH) "%1$s.bs" + $(CHMOD) $(PERM_RW) "%1$s.bs" + +%2$s : %1$s.bs %3$s + $(NOECHO) $(RM_RF) %2$s + - $(CP_NONEMPTY) %1$s.bs %2$s $(PERM_RW) +MAKE_FRAG +} + +=item dynamic_lib (o) + +Defines how to produce the *.so (or equivalent) files. + +=cut + +sub dynamic_lib { + my($self, %attribs) = @_; + return '' unless $self->needs_linking(); #might be because of a subdir + return '' unless $self->has_link_code; + my @m = $self->xs_dynamic_lib_macros(\%attribs); + my @libs; + my $dlsyms_ext = eval { $self->xs_dlsyms_ext }; + if ($self->{XSMULTI}) { + my @exts = $self->_xs_list_basenames; + for my $ext (@exts) { + my ($v, $d, $f) = File::Spec->splitpath($ext); + my @d = File::Spec->splitdir($d); + shift @d if $d[0] eq 'lib'; + pop @d if $d[$#d] eq ''; + my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); + + # Dynamic library names may need special handling. + eval { require DynaLoader }; + if (defined &DynaLoader::mod2fname) { + $f = &DynaLoader::mod2fname([@d, $f]); + } + + my $instfile = $self->catfile($instdir, "$f.\$(DLEXT)"); + my $objfile = $self->_xsbuild_value('xs', $ext, 'OBJECT'); + $objfile = "$ext\$(OBJ_EXT)" unless defined $objfile; + my $ldfrom = $self->_xsbuild_value('xs', $ext, 'LDFROM'); + $ldfrom = $objfile unless defined $ldfrom; + my $exportlist = "$ext.def"; + my @libchunk = ($objfile, $instfile, $instdir, $ldfrom, $exportlist); + push @libchunk, $dlsyms_ext ? $ext.$dlsyms_ext : undef; + push @libs, \@libchunk; + } + } else { + my @libchunk = qw($(OBJECT) $(INST_DYNAMIC) $(INST_ARCHAUTODIR) $(LDFROM) $(EXPORT_LIST)); + push @libchunk, $dlsyms_ext ? '$(BASEEXT)'.$dlsyms_ext : undef; + @libs = (\@libchunk); + } + push @m, map { $self->xs_make_dynamic_lib(\%attribs, @$_); } @libs; + + return join("\n",@m); +} + +=item xs_dynamic_lib_macros + +Defines the macros for the C<dynamic_lib> section. + +=cut + +sub xs_dynamic_lib_macros { + my ($self, $attribs) = @_; + my $otherldflags = $attribs->{OTHERLDFLAGS} || ""; + my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; + my $armaybe = $self->_xs_armaybe($attribs); + my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? + my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : ''; + sprintf <<'EOF', $armaybe, $ld_opt.$otherldflags, $inst_dynamic_dep, $ld_fix; +# This section creates the dynamically loadable objects from relevant +# objects and possibly $(MYEXTLIB). +ARMAYBE = %s +OTHERLDFLAGS = %s +INST_DYNAMIC_DEP = %s +INST_DYNAMIC_FIX = %s +EOF +} + +sub _xs_armaybe { + my ($self, $attribs) = @_; + my $armaybe = $attribs->{ARMAYBE} || $self->{ARMAYBE} || ":"; + $armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':'); + $armaybe; +} + +=item xs_make_dynamic_lib + +Defines the recipes for the C<dynamic_lib> section. + +=cut + +sub xs_make_dynamic_lib { + my ($self, $attribs, $object, $to, $todir, $ldfrom, $exportlist, $dlsyms) = @_; + $exportlist = '' if $exportlist ne '$(EXPORT_LIST)'; + my $armaybe = $self->_xs_armaybe($attribs); + my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) %s'."\n", $to, $object, $todir, $exportlist, ($dlsyms || ''); + my $dlsyms_arg = $self->xs_dlsyms_arg($dlsyms); + if ($armaybe ne ':'){ + $ldfrom = 'tmp$(LIB_EXT)'; + push(@m," \$(ARMAYBE) cr $ldfrom $object\n"); + push(@m," \$(RANLIB) $ldfrom\n"); + } + $ldfrom = "-all $ldfrom -none" if $Is{OSF}; + + # The IRIX linker doesn't use LD_RUN_PATH + my $ldrun = $Is{IRIX} && $self->{LD_RUN_PATH} ? + qq{-rpath "$self->{LD_RUN_PATH}"} : ''; + + # For example in AIX the shared objects/libraries from previous builds + # linger quite a while in the shared dynalinker cache even when nobody + # is using them. This is painful if one for instance tries to restart + # a failed build because the link command will fail unnecessarily 'cos + # the shared object/library is 'busy'. + push(@m," \$(RM_F) \$\@\n"); + + my $libs = '$(LDLOADLIBS)'; + if (($Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') { + # Use nothing on static perl platforms, and to the flags needed + # to link against the shared libperl library on shared perl + # platforms. We peek at lddlflags to see if we need -Wl,-R + # or -R to add paths to the run-time library search path. + if ($Config{'lddlflags'} =~ /-Wl,-R/) { + $libs .= ' "-L$(PERL_INC)" "-Wl,-R$(INSTALLARCHLIB)/CORE" "-Wl,-R$(PERL_ARCHLIB)/CORE" -lperl'; + } elsif ($Config{'lddlflags'} =~ /-R/) { + $libs .= ' "-L$(PERL_INC)" "-R$(INSTALLARCHLIB)/CORE" "-R$(PERL_ARCHLIB)/CORE" -lperl'; + } elsif ( $Is{Android} ) { + # The Android linker will not recognize symbols from + # libperl unless the module explicitly depends on it. + $libs .= ' "-L$(PERL_INC)" -lperl'; + } + } + + my $ld_run_path_shell = ""; + if ($self->{LD_RUN_PATH} ne "") { + $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; + } + + push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $dlsyms_arg, $ldfrom, $self->xs_obj_opt('$@'), $libs, $exportlist; + %s$(LD) %s $(LDDLFLAGS) %s %s $(OTHERLDFLAGS) %s $(MYEXTLIB) \ + $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) %s \ + $(INST_DYNAMIC_FIX) + $(CHMOD) $(PERM_RWX) $@ +MAKE + join '', @m; +} + +=item exescan + +Deprecated method. Use libscan instead. + +=cut + +sub exescan { + my($self,$path) = @_; + $path; +} + +=item extliblist + +Called by init_others, and calls ext ExtUtils::Liblist. See +L<ExtUtils::Liblist> for details. + +=cut + +sub extliblist { + my($self,$libs) = @_; + require ExtUtils::Liblist; + $self->ext($libs, $Verbose); +} + +=item find_perl + +Finds the executables PERL and FULLPERL + +=cut + +sub find_perl { + my($self, $ver, $names, $dirs, $trace) = @_; + if ($trace >= 2){ + print "Looking for perl $ver by these names: +@$names +in these dirs: +@$dirs +"; + } + + my $stderr_duped = 0; + local *STDERR_COPY; + + unless ($Is{BSD}) { + # >& and lexical filehandles together give 5.6.2 indigestion + if( open(STDERR_COPY, '>&STDERR') ) { ## no critic + $stderr_duped = 1; + } + else { + warn <<WARNING; +find_perl() can't dup STDERR: $! +You might see some garbage while we search for Perl +WARNING + } + } + + foreach my $name (@$names){ + my ($abs, $use_dir); + if ($self->file_name_is_absolute($name)) { # /foo/bar + $abs = $name; + } elsif ($self->canonpath($name) eq + $self->canonpath(basename($name))) { # foo + $use_dir = 1; + } else { # foo/bar + $abs = $self->catfile($Curdir, $name); + } + foreach my $dir ($use_dir ? @$dirs : 1){ + next unless defined $dir; # $self->{PERL_SRC} may be undefined + + $abs = $self->catfile($dir, $name) + if $use_dir; + + print "Checking $abs\n" if ($trace >= 2); + next unless $self->maybe_command($abs); + print "Executing $abs\n" if ($trace >= 2); + + my $val; + my $version_check = qq{"$abs" -le "require $ver; print qq{VER_OK}"}; + + # To avoid using the unportable 2>&1 to suppress STDERR, + # we close it before running the command. + # However, thanks to a thread library bug in many BSDs + # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 ) + # we cannot use the fancier more portable way in here + # but instead need to use the traditional 2>&1 construct. + if ($Is{BSD}) { + $val = `$version_check 2>&1`; + } else { + close STDERR if $stderr_duped; + $val = `$version_check`; + + # 5.6.2's 3-arg open doesn't work with >& + open STDERR, ">&STDERR_COPY" ## no critic + if $stderr_duped; + } + + if ($val =~ /^VER_OK/m) { + print "Using PERL=$abs\n" if $trace; + return $abs; + } elsif ($trace >= 2) { + print "Result: '$val' ".($? >> 8)."\n"; + } + } + } + print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; + 0; # false and not empty +} + + +=item fixin + + $mm->fixin(@files); + +Inserts the sharpbang or equivalent magic number to a set of @files. + +=cut + +sub fixin { # stolen from the pink Camel book, more or less + my ( $self, @files ) = @_; + + for my $file (@files) { + my $file_new = "$file.new"; + my $file_bak = "$file.bak"; + + open( my $fixin, '<', $file ) or croak "Can't process '$file': $!"; + local $/ = "\n"; + chomp( my $line = <$fixin> ); + next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file. + + my $shb = $self->_fixin_replace_shebang( $file, $line ); + next unless defined $shb; + + open( my $fixout, ">", "$file_new" ) or do { + warn "Can't create new $file: $!\n"; + next; + }; + + # Print out the new #! line (or equivalent). + local $\; + local $/; + print $fixout $shb, <$fixin>; + close $fixin; + close $fixout; + + chmod 0666, $file_bak; + unlink $file_bak; + unless ( _rename( $file, $file_bak ) ) { + warn "Can't rename $file to $file_bak: $!"; + next; + } + unless ( _rename( $file_new, $file ) ) { + warn "Can't rename $file_new to $file: $!"; + unless ( _rename( $file_bak, $file ) ) { + warn "Can't rename $file_bak back to $file either: $!"; + warn "Leaving $file renamed as $file_bak\n"; + } + next; + } + unlink $file_bak; + } + continue { + system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; + } +} + + +sub _rename { + my($old, $new) = @_; + + foreach my $file ($old, $new) { + if( $Is{VMS} and basename($file) !~ /\./ ) { + # rename() in 5.8.0 on VMS will not rename a file if it + # does not contain a dot yet it returns success. + $file = "$file."; + } + } + + return rename($old, $new); +} + +sub _fixin_replace_shebang { + my ( $self, $file, $line ) = @_; + + # Now figure out the interpreter name. + my ( $origcmd, $arg ) = split ' ', $line, 2; + (my $cmd = $origcmd) =~ s!^.*/!!; + + # Now look (in reverse) for interpreter in absolute PATH (unless perl). + my $interpreter; + if ( defined $ENV{PERL_MM_SHEBANG} && $ENV{PERL_MM_SHEBANG} eq "relocatable" ) { + $interpreter = "/usr/bin/env perl"; + } + elsif ( $cmd =~ m{^perl(?:\z|[^a-z])} ) { + if ( $Config{startperl} =~ m,^\#!.*/perl, ) { + $interpreter = $Config{startperl}; + $interpreter =~ s,^\#!,,; + } + else { + $interpreter = $Config{perlpath}; + } + } + else { + my (@absdirs) + = reverse grep { $self->file_name_is_absolute($_) } $self->path; + $interpreter = ''; + + foreach my $dir (@absdirs) { + my $maybefile = $self->catfile($dir,$cmd); + if ( $self->maybe_command($maybefile) ) { + warn "Ignoring $interpreter in $file\n" + if $Verbose && $interpreter; + $interpreter = $maybefile; + } + } + + # If the shebang is absolute and exists in PATH, but was not + # the first one found, leave it alone if it's actually the + # same file as first one. This avoids packages built on + # merged-/usr systems with /usr/bin before /bin in the path + # breaking when installed on systems without merged /usr + if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) { + my $origdir = dirname($origcmd); + if ($self->maybe_command($origcmd) && grep { $_ eq $origdir } @absdirs) { + my ($odev, $oino) = stat $origcmd; + my ($idev, $iino) = stat $interpreter; + if ($odev == $idev && $oino == $iino) { + warn "$origcmd is the same as $interpreter, leaving alone" + if $Verbose; + $interpreter = $origcmd; + } + } + } + } + + # Figure out how to invoke interpreter on this machine. + + my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; + my ($shb) = ""; + if ($interpreter) { + print "Changing sharpbang in $file to $interpreter" + if $Verbose; + # this is probably value-free on DOSISH platforms + if ($does_shbang) { + $shb .= "$Config{'sharpbang'}$interpreter"; + $shb .= ' ' . $arg if defined $arg; + $shb .= "\n"; + } + } + else { + warn "Can't find $cmd in PATH, $file unchanged" + if $Verbose; + return; + } + return $shb +} + +=item force (o) + +Writes an empty FORCE: target. + +=cut + +sub force { + my($self) = shift; + '# Phony target to force checking subdirectories. +FORCE : + $(NOECHO) $(NOOP) +'; +} + +=item guess_name + +Guess the name of this package by examining the working directory's +name. MakeMaker calls this only if the developer has not supplied a +NAME attribute. + +=cut + +# '; + +sub guess_name { + my($self) = @_; + use Cwd 'cwd'; + my $name = basename(cwd()); + $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we + # strip minus or underline + # followed by a float or some such + print "Warning: Guessing NAME [$name] from current directory name.\n"; + $name; +} + +=item has_link_code + +Returns true if C, XS, MYEXTLIB or similar objects exist within this +object that need a compiler. Does not descend into subdirectories as +needs_linking() does. + +=cut + +sub has_link_code { + my($self) = shift; + return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE}; + if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){ + $self->{HAS_LINK_CODE} = 1; + return 1; + } + return $self->{HAS_LINK_CODE} = 0; +} + + +=item init_dirscan + +Scans the directory structure and initializes DIR, XS, XS_FILES, +C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES. + +Called by init_main. + +=cut + +sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) + my($self) = @_; + my(%dir, %xs, %c, %o, %h, %pl_files, %pm); + + my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t); + + # ignore the distdir + $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1 + : $ignore{$self->{DISTVNAME}} = 1; + + my $distprefix = $Is{VMS} ? qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+\.dir$/i + : qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+$/; + + @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS}; + + if ( defined $self->{XS} and !defined $self->{C} ) { + my @c_files = grep { m/\.c(pp|xx)?\z/i } values %{$self->{XS}}; + my @o_files = grep { m/(?:.(?:o(?:bj)?)|\$\(OBJ_EXT\))\z/i } values %{$self->{XS}}; + %c = map { $_ => 1 } @c_files; + %o = map { $_ => 1 } @o_files; + } + + foreach my $name ($self->lsdir($Curdir)){ + next if $name =~ /\#/; + next if $name =~ $distprefix && -d $name; + $name = lc($name) if $Is{VMS}; + next if $name eq $Curdir or $name eq $Updir or $ignore{$name}; + next unless $self->libscan($name); + if (-d $name){ + next if -l $name; # We do not support symlinks at all + next if $self->{NORECURS}; + $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL")); + } elsif ($name =~ /\.xs\z/){ + my($c); ($c = $name) =~ s/\.xs\z/.c/; + $xs{$name} = $c; + $c{$c} = 1; + } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc + $c{$name} = 1 + unless $name =~ m/perlmain\.c/; # See MAP_TARGET + } elsif ($name =~ /\.h\z/i){ + $h{$name} = 1; + } elsif ($name =~ /\.PL\z/) { + ($pl_files{$name} = $name) =~ s/\.PL\z// ; + } elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) { + # case-insensitive filesystem, one dot per name, so foo.h.PL + # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos + local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl; + if ($txt =~ /Extracting \S+ \(with variable substitutions/) { + ($pl_files{$name} = $name) =~ s/[._]pl\z//i ; + } + else { + $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); + } + } elsif ($name =~ /\.(p[ml]|pod)\z/){ + $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); + } + } + + $self->{PL_FILES} ||= \%pl_files; + $self->{DIR} ||= [sort keys %dir]; + $self->{XS} ||= \%xs; + $self->{C} ||= [sort keys %c]; + $self->{H} ||= [sort keys %h]; + $self->{PM} ||= \%pm; + + my @o_files = @{$self->{C}}; + %o = (%o, map { $_ => 1 } grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files); + $self->{O_FILES} = [sort keys %o]; +} + + +=item init_MANPODS + +Determines if man pages should be generated and initializes MAN1PODS +and MAN3PODS as appropriate. + +=cut + +sub init_MANPODS { + my $self = shift; + + # Set up names of manual pages to generate from pods + foreach my $man (qw(MAN1 MAN3)) { + if ( $self->{"${man}PODS"} + or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/ + ) { + $self->{"${man}PODS"} ||= {}; + } + else { + my $init_method = "init_${man}PODS"; + $self->$init_method(); + } + } + + # logic similar to picking man${num}ext in perl's Configure script + foreach my $num (1,3) { + my $installdirs = uc $self->{INSTALLDIRS}; + $installdirs = '' if $installdirs eq 'PERL'; + my @mandirs = File::Spec->splitdir( $self->_expand_macros( + $self->{ "INSTALL${installdirs}MAN${num}DIR" } ) ); + my $mandir = pop @mandirs; + my $section = $num; + + foreach ($num, "${num}p", "${num}pm", qw< l n o C L >, "L$num") { + if ( $mandir =~ /^(?:man|cat)$_$/ ) { + $section = $_; + last; + } + } + + $self->{"MAN${num}SECTION"} = $section; + } +} + + +sub _has_pod { + my($self, $file) = @_; + + my($ispod)=0; + if (open( my $fh, '<', $file )) { + while (<$fh>) { + if (/^=(?:head\d+|item|pod)\b/) { + $ispod=1; + last; + } + } + close $fh; + } else { + # If it doesn't exist yet, we assume, it has pods in it + $ispod = 1; + } + + return $ispod; +} + + +=item init_MAN1PODS + +Initializes MAN1PODS from the list of EXE_FILES. + +=cut + +sub init_MAN1PODS { + my($self) = @_; + + if ( exists $self->{EXE_FILES} ) { + foreach my $name (@{$self->{EXE_FILES}}) { + next unless $self->_has_pod($name); + + $self->{MAN1PODS}->{$name} = + $self->catfile("\$(INST_MAN1DIR)", + basename($name).".\$(MAN1EXT)"); + } + } +} + + +=item init_MAN3PODS + +Initializes MAN3PODS from the list of PM files. + +=cut + +sub init_MAN3PODS { + my $self = shift; + + my %manifypods = (); # we collect the keys first, i.e. the files + # we have to convert to pod + + foreach my $name (keys %{$self->{PM}}) { + if ($name =~ /\.pod\z/ ) { + $manifypods{$name} = $self->{PM}{$name}; + } elsif ($name =~ /\.p[ml]\z/ ) { + if( $self->_has_pod($name) ) { + $manifypods{$name} = $self->{PM}{$name}; + } + } + } + + my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; + + # Remove "Configure.pm" and similar, if it's not the only pod listed + # To force inclusion, just name it "Configure.pod", or override + # MAN3PODS + foreach my $name (keys %manifypods) { + if ( + ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) or + ( $name =~ m/^README\.pod$/i ) # don't manify top-level README.pod + ) { + delete $manifypods{$name}; + next; + } + my($manpagename) = $name; + $manpagename =~ s/\.p(od|m|l)\z//; + # everything below lib is ok + unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) { + $manpagename = $self->catfile( + split(/::/,$self->{PARENT_NAME}),$manpagename + ); + } + $manpagename = $self->replace_manpage_separator($manpagename); + $self->{MAN3PODS}->{$name} = + $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)"); + } +} + + +=item init_PM + +Initializes PMLIBDIRS and PM from PMLIBDIRS. + +=cut + +sub init_PM { + my $self = shift; + + # Some larger extensions often wish to install a number of *.pm/pl + # files into the library in various locations. + + # The attribute PMLIBDIRS holds an array reference which lists + # subdirectories which we should search for library files to + # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We + # recursively search through the named directories (skipping any + # which don't exist or contain Makefile.PL files). + + # For each *.pm or *.pl file found $self->libscan() is called with + # the default installation path in $_[1]. The return value of + # libscan defines the actual installation location. The default + # libscan function simply returns the path. The file is skipped + # if libscan returns false. + + # The default installation location passed to libscan in $_[1] is: + # + # ./*.pm => $(INST_LIBDIR)/*.pm + # ./xyz/... => $(INST_LIBDIR)/xyz/... + # ./lib/... => $(INST_LIB)/... + # + # In this way the 'lib' directory is seen as the root of the actual + # perl library whereas the others are relative to INST_LIBDIR + # (which includes PARENT_NAME). This is a subtle distinction but one + # that's important for nested modules. + + unless( $self->{PMLIBDIRS} ) { + if( $Is{VMS} ) { + # Avoid logical name vs directory collisions + $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"]; + } + else { + $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]; + } + } + + #only existing directories that aren't in $dir are allowed + + # Avoid $_ wherever possible: + # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}}; + my (@pmlibdirs) = @{$self->{PMLIBDIRS}}; + @{$self->{PMLIBDIRS}} = (); + my %dir = map { ($_ => $_) } @{$self->{DIR}}; + foreach my $pmlibdir (@pmlibdirs) { + -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir; + } + + unless( $self->{PMLIBPARENTDIRS} ) { + @{$self->{PMLIBPARENTDIRS}} = ('lib'); + } + + return if $self->{PM} and $self->{ARGS}{PM}; + + if (@{$self->{PMLIBDIRS}}){ + print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n" + if ($Verbose >= 2); + require File::Find; + File::Find::find(sub { + if (-d $_){ + unless ($self->libscan($_)){ + $File::Find::prune = 1; + } + return; + } + return if /\#/; + return if /~$/; # emacs temp files + return if /,v$/; # RCS files + return if m{\.swp$}; # vim swap files + + my $path = $File::Find::name; + my $prefix = $self->{INST_LIBDIR}; + my $striplibpath; + + my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; + $prefix = $self->{INST_LIB} + if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W} + {$1}i; + + my($inst) = $self->catfile($prefix,$striplibpath); + local($_) = $inst; # for backwards compatibility + $inst = $self->libscan($inst); + print "libscan($path) => '$inst'\n" if ($Verbose >= 2); + return unless $inst; + if ($self->{XSMULTI} and $inst =~ /\.xs\z/) { + my($base); ($base = $path) =~ s/\.xs\z//; + $self->{XS}{$path} = "$base.c"; + push @{$self->{C}}, "$base.c"; + push @{$self->{O_FILES}}, "$base$self->{OBJ_EXT}"; + } else { + $self->{PM}{$path} = $inst; + } + }, @{$self->{PMLIBDIRS}}); + } +} + + +=item init_DIRFILESEP + +Using / for Unix. Called by init_main. + +=cut + +sub init_DIRFILESEP { + my($self) = shift; + + $self->{DIRFILESEP} = '/'; +} + + +=item init_main + +Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE, +EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*, +INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME, +OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB, +PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, +VERSION_SYM, XS_VERSION. + +=cut + +sub init_main { + my($self) = @_; + + # --- Initialize Module Name and Paths + + # NAME = Foo::Bar::Oracle + # FULLEXT = Foo/Bar/Oracle + # BASEEXT = Oracle + # PARENT_NAME = Foo::Bar +### Only UNIX: +### ($self->{FULLEXT} = +### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket + $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME}); + + + # Copied from DynaLoader: + + my(@modparts) = split(/::/,$self->{NAME}); + my($modfname) = $modparts[-1]; + + # Some systems have restrictions on files names for DLL's etc. + # mod2fname returns appropriate file base name (typically truncated) + # It may also edit @modparts if required. + # We require DynaLoader to make sure that mod2fname is loaded + eval { require DynaLoader }; + if (defined &DynaLoader::mod2fname) { + $modfname = &DynaLoader::mod2fname(\@modparts); + } + + ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ; + $self->{PARENT_NAME} ||= ''; + + if (defined &DynaLoader::mod2fname) { + # As of 5.001m, dl_os2 appends '_' + $self->{DLBASE} = $modfname; + } else { + $self->{DLBASE} = '$(BASEEXT)'; + } + + + # --- Initialize PERL_LIB, PERL_SRC + + # *Real* information: where did we get these two from? ... + my $inc_config_dir = dirname($INC{'Config.pm'}); + my $inc_carp_dir = dirname($INC{'Carp.pm'}); + + unless ($self->{PERL_SRC}){ + foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting + my $dir = $self->catdir(($Updir) x $dir_count); + + if (-f $self->catfile($dir,"config_h.SH") && + -f $self->catfile($dir,"perl.h") && + -f $self->catfile($dir,"lib","strict.pm") + ) { + $self->{PERL_SRC}=$dir ; + last; + } + } + } + + warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if + $self->{PERL_CORE} and !$self->{PERL_SRC}; + + if ($self->{PERL_SRC}){ + $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); + + $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; + $self->{PERL_INC} = ($Is{Win32}) ? + $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; + + # catch a situation that has occurred a few times in the past: + unless ( + -s $self->catfile($self->{PERL_SRC},'cflags') + or + $Is{VMS} + && + -s $self->catfile($self->{PERL_SRC},'vmsish.h') + or + $Is{Win32} + ){ + warn qq{ +You cannot build extensions below the perl source tree after executing +a 'make clean' in the perl source tree. + +To rebuild extensions distributed with the perl source you should +simply Configure (to include those extensions) and then build perl as +normal. After installing perl the source tree can be deleted. It is +not needed for building extensions by running 'perl Makefile.PL' +usually without extra arguments. + +It is recommended that you unpack and build additional extensions away +from the perl source tree. +}; + } + } else { + # we should also consider $ENV{PERL5LIB} here + my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC}; + $self->{PERL_LIB} ||= $Config{privlibexp}; + $self->{PERL_ARCHLIB} ||= $Config{archlibexp}; + $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now + my $perl_h; + + if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")) + and not $old){ + # Maybe somebody tries to build an extension with an + # uninstalled Perl outside of Perl build tree + my $lib; + for my $dir (@INC) { + $lib = $dir, last if -e $self->catfile($dir, "Config.pm"); + } + if ($lib) { + # Win32 puts its header files in /perl/src/lib/CORE. + # Unix leaves them in /perl/src. + my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" ) + : dirname $lib; + if (-e $self->catfile($inc, "perl.h")) { + $self->{PERL_LIB} = $lib; + $self->{PERL_ARCHLIB} = $lib; + $self->{PERL_INC} = $inc; + $self->{UNINSTALLED_PERL} = 1; + print <<EOP; +... Detected uninstalled Perl. Trying to continue. +EOP + } + } + } + } + + if ($Is{Android}) { + # Android fun times! + # ../../perl -I../../lib -MFile::Glob -e1 works + # ../../../perl -I../../../lib -MFile::Glob -e1 fails to find + # the .so for File::Glob. + # This always affects core perl, but may also affect an installed + # perl built with -Duserelocatableinc. + $self->{PERL_LIB} = File::Spec->rel2abs($self->{PERL_LIB}); + $self->{PERL_ARCHLIB} = File::Spec->rel2abs($self->{PERL_ARCHLIB}); + } + $self->{PERL_INCDEP} = $self->{PERL_INC}; + $self->{PERL_ARCHLIBDEP} = $self->{PERL_ARCHLIB}; + + # We get SITELIBEXP and SITEARCHEXP directly via + # Get_from_Config. When we are running standard modules, these + # won't matter, we will set INSTALLDIRS to "perl". Otherwise we + # set it to "site". I prefer that INSTALLDIRS be set from outside + # MakeMaker. + $self->{INSTALLDIRS} ||= "site"; + + $self->{MAN1EXT} ||= $Config{man1ext}; + $self->{MAN3EXT} ||= $Config{man3ext}; + + # Get some stuff out of %Config if we haven't yet done so + print "CONFIG must be an array ref\n" + if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); + $self->{CONFIG} = [] unless (ref $self->{CONFIG}); + push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config); + push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags}; + my(%once_only); + foreach my $m (@{$self->{CONFIG}}){ + next if $once_only{$m}; + print "CONFIG key '$m' does not exist in Config.pm\n" + unless exists $Config{$m}; + $self->{uc $m} ||= $Config{$m}; + $once_only{$m} = 1; + } + +# This is too dangerous: +# if ($^O eq "next") { +# $self->{AR} = "libtool"; +# $self->{AR_STATIC_ARGS} = "-o"; +# } +# But I leave it as a placeholder + + $self->{AR_STATIC_ARGS} ||= "cr"; + + # These should never be needed + $self->{OBJ_EXT} ||= '.o'; + $self->{LIB_EXT} ||= '.a'; + + $self->{MAP_TARGET} ||= "perl"; + + $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}"; + + # make a simple check if we find strict + warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory + (strict.pm not found)" + unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") || + $self->{NAME} eq "ExtUtils::MakeMaker"; +} + +=item init_tools + +Initializes tools to use their common (and faster) Unix commands. + +=cut + +sub init_tools { + my $self = shift; + + $self->{ECHO} ||= 'echo'; + $self->{ECHO_N} ||= 'echo -n'; + $self->{RM_F} ||= "rm -f"; + $self->{RM_RF} ||= "rm -rf"; + $self->{TOUCH} ||= "touch"; + $self->{TEST_F} ||= "test -f"; + $self->{TEST_S} ||= "test -s"; + $self->{CP} ||= "cp"; + $self->{MV} ||= "mv"; + $self->{CHMOD} ||= "chmod"; + $self->{FALSE} ||= 'false'; + $self->{TRUE} ||= 'true'; + + $self->{LD} ||= 'ld'; + + return $self->SUPER::init_tools(@_); + + # After SUPER::init_tools so $Config{shell} has a + # chance to get set. + $self->{SHELL} ||= '/bin/sh'; + + return; +} + + +=item init_linker + +Unix has no need of special linker flags. + +=cut + +sub init_linker { + my($self) = shift; + $self->{PERL_ARCHIVE} ||= ''; + $self->{PERL_ARCHIVEDEP} ||= ''; + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} + + +=begin _protected + +=item init_lib2arch + + $mm->init_lib2arch + +=end _protected + +=cut + +sub init_lib2arch { + my($self) = shift; + + # The user who requests an installation directory explicitly + # should not have to tell us an architecture installation directory + # as well. We look if a directory exists that is named after the + # architecture. If not we take it as a sign that it should be the + # same as the requested installation directory. Otherwise we take + # the found one. + for my $libpair ({l=>"privlib", a=>"archlib"}, + {l=>"sitelib", a=>"sitearch"}, + {l=>"vendorlib", a=>"vendorarch"}, + ) + { + my $lib = "install$libpair->{l}"; + my $Lib = uc $lib; + my $Arch = uc "install$libpair->{a}"; + if( $self->{$Lib} && ! $self->{$Arch} ){ + my($ilib) = $Config{$lib}; + + $self->prefixify($Arch,$ilib,$self->{$Lib}); + + unless (-d $self->{$Arch}) { + print "Directory $self->{$Arch} not found\n" + if $Verbose; + $self->{$Arch} = $self->{$Lib}; + } + print "Defaulting $Arch to $self->{$Arch}\n" if $Verbose; + } + } +} + + +=item init_PERL + + $mm->init_PERL; + +Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the +*PERLRUN* permutations. + + PERL is allowed to be miniperl + FULLPERL must be a complete perl + + ABSPERL is PERL converted to an absolute path + + *PERLRUN contains everything necessary to run perl, find it's + libraries, etc... + + *PERLRUNINST is *PERLRUN + everything necessary to find the + modules being built. + +=cut + +sub init_PERL { + my($self) = shift; + + my @defpath = (); + foreach my $component ($self->{PERL_SRC}, $self->path(), + $Config{binexp}) + { + push @defpath, $component if defined $component; + } + + # Build up a set of file names (not command names). + my $thisperl = $self->canonpath($^X); + $thisperl .= $Config{exe_ext} unless + # VMS might have a file version # at the end + $Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i + : $thisperl =~ m/$Config{exe_ext}$/i; + + # We need a relative path to perl when in the core. + $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE}; + + my @perls = ($thisperl); + push @perls, map { "$_$Config{exe_ext}" } + ("perl$Config{version}", 'perl5', 'perl'); + + # miniperl has priority over all but the canonical perl when in the + # core. Otherwise its a last resort. + my $miniperl = "miniperl$Config{exe_ext}"; + if( $self->{PERL_CORE} ) { + splice @perls, 1, 0, $miniperl; + } + else { + push @perls, $miniperl; + } + + $self->{PERL} ||= + $self->find_perl(5.0, \@perls, \@defpath, $Verbose ); + + my $perl = $self->{PERL}; + $perl =~ s/^"//; + my $has_mcr = $perl =~ s/^MCR\s*//; + my $perlflags = ''; + my $stripped_perl; + while ($perl) { + ($stripped_perl = $perl) =~ s/"$//; + last if -x $stripped_perl; + last unless $perl =~ s/(\s+\S+)$//; + $perlflags = $1.$perlflags; + } + $self->{PERL} = $stripped_perl; + $self->{PERL} = 'MCR '.$self->{PERL} if $has_mcr || $Is{VMS}; + + # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe. + my $perl_name = 'perl'; + $perl_name = 'ndbgperl' if $Is{VMS} && + defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define'; + + # XXX This logic is flawed. If "miniperl" is anywhere in the path + # it will get confused. It should be fixed to work only on the filename. + # Define 'FULLPERL' to be a non-miniperl (used in test: target) + unless ($self->{FULLPERL}) { + ($self->{FULLPERL} = $self->{PERL}) =~ s/\Q$miniperl\E$/$perl_name$Config{exe_ext}/i; + $self->{FULLPERL} = qq{"$self->{FULLPERL}"}.$perlflags; + } + # Can't have an image name with quotes, and findperl will have + # already escaped spaces. + $self->{FULLPERL} =~ tr/"//d if $Is{VMS}; + + # `dmake` can fail for image (aka, executable) names which start with double-quotes + # * push quote inward by at least one character (or the drive prefix, if present) + # * including any initial directory separator preserves the `file_name_is_absolute` property + $self->{FULLPERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); + + # Little hack to get around VMS's find_perl putting "MCR" in front + # sometimes. + $self->{ABSPERL} = $self->{PERL}; + $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//; + if( $self->file_name_is_absolute($self->{ABSPERL}) ) { + $self->{ABSPERL} = '$(PERL)'; + } + else { + $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL}); + + # Quote the perl command if it contains whitespace + $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL}) + if $self->{ABSPERL} =~ /\s/; + + $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr; + } + $self->{PERL} = qq{"$self->{PERL}"}.$perlflags; + + # Can't have an image name with quotes, and findperl will have + # already escaped spaces. + $self->{PERL} =~ tr/"//d if $Is{VMS}; + + # `dmake` can fail for image (aka, executable) names which start with double-quotes + # * push quote inward by at least one character (or the drive prefix, if present) + # * including any initial directory separator preserves the `file_name_is_absolute` property + $self->{PERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); + + # Are we building the core? + $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE}; + $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE}; + + # Make sure perl can find itself before it's installed. + my $lib_paths = $self->{UNINSTALLED_PERL} || $self->{PERL_CORE} + ? ( $self->{PERL_ARCHLIB} && $self->{PERL_LIB} && $self->{PERL_ARCHLIB} ne $self->{PERL_LIB} ) ? + q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} : q{ "-I$(PERL_LIB)"} + : undef; + my $inst_lib_paths = $self->{INST_ARCHLIB} ne $self->{INST_LIB} + ? 'RUN)'.$perlflags.' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"' + : 'RUN)'.$perlflags.' "-I$(INST_LIB)"'; + # How do we run perl? + foreach my $perl (qw(PERL FULLPERL ABSPERL)) { + my $run = $perl.'RUN'; + + $self->{$run} = qq{\$($perl)}; + $self->{$run} .= $lib_paths if $lib_paths; + + $self->{$perl.'RUNINST'} = '$('.$perl.$inst_lib_paths; + } + + return 1; +} + + +=item init_platform + +=item platform_constants + +Add MM_Unix_VERSION. + +=cut + +sub init_platform { + my($self) = shift; + + $self->{MM_Unix_VERSION} = $VERSION; + $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '. + '-Dfree=Perl_mfree -Drealloc=Perl_realloc '. + '-Dcalloc=Perl_calloc'; + +} + +sub platform_constants { + my($self) = shift; + my $make_frag = ''; + + foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF)) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } + + return $make_frag; +} + + +=item init_PERM + + $mm->init_PERM + +Called by init_main. Initializes PERL_* + +=cut + +sub init_PERM { + my($self) = shift; + + $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR}; + $self->{PERM_RW} = 644 unless defined $self->{PERM_RW}; + $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX}; + + return 1; +} + + +=item init_xs + + $mm->init_xs + +Sets up macros having to do with XS code. Currently just INST_STATIC, +INST_DYNAMIC and INST_BOOT. + +=cut + +sub init_xs { + my $self = shift; + + if ($self->has_link_code()) { + $self->{INST_STATIC} = + $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)'); + $self->{INST_DYNAMIC} = + $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)'); + $self->{INST_BOOT} = + $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs'); + if ($self->{XSMULTI}) { + my @exts = $self->_xs_list_basenames; + my (@statics, @dynamics, @boots); + for my $ext (@exts) { + my ($v, $d, $f) = File::Spec->splitpath($ext); + my @d = File::Spec->splitdir($d); + shift @d if defined $d[0] and $d[0] eq 'lib'; + pop @d if $d[$#d] eq ''; + my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); + my $instfile = $self->catfile($instdir, $f); + push @statics, "$instfile\$(LIB_EXT)"; + + # Dynamic library names may need special handling. + my $dynfile = $instfile; + eval { require DynaLoader }; + if (defined &DynaLoader::mod2fname) { + $dynfile = $self->catfile($instdir, &DynaLoader::mod2fname([@d, $f])); + } + + push @dynamics, "$dynfile.\$(DLEXT)"; + push @boots, "$instfile.bs"; + } + $self->{INST_STATIC} = join ' ', @statics; + $self->{INST_DYNAMIC} = join ' ', @dynamics; + $self->{INST_BOOT} = join ' ', @boots; + } + } else { + $self->{INST_STATIC} = ''; + $self->{INST_DYNAMIC} = ''; + $self->{INST_BOOT} = ''; + } +} + +=item install (o) + +Defines the install target. + +=cut + +sub install { + my($self, %attribs) = @_; + my(@m); + + push @m, q{ +install :: pure_install doc_install + $(NOECHO) $(NOOP) + +install_perl :: pure_perl_install doc_perl_install + $(NOECHO) $(NOOP) + +install_site :: pure_site_install doc_site_install + $(NOECHO) $(NOOP) + +install_vendor :: pure_vendor_install doc_vendor_install + $(NOECHO) $(NOOP) + +pure_install :: pure_$(INSTALLDIRS)_install + $(NOECHO) $(NOOP) + +doc_install :: doc_$(INSTALLDIRS)_install + $(NOECHO) $(NOOP) + +pure__install : pure_site_install + $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site + +doc__install : doc_site_install + $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site + +pure_perl_install :: all + $(NOECHO) $(MOD_INSTALL) \ +}; + + push @m, +q{ read "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \ + write "}.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \ +} unless $self->{NO_PACKLIST}; + + push @m, +q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \ + "$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \ + "$(INST_BIN)" "$(DESTINSTALLBIN)" \ + "$(INST_SCRIPT)" "$(DESTINSTALLSCRIPT)" \ + "$(INST_MAN1DIR)" "$(DESTINSTALLMAN1DIR)" \ + "$(INST_MAN3DIR)" "$(DESTINSTALLMAN3DIR)" + $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ + "}.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{" + + +pure_site_install :: all + $(NOECHO) $(MOD_INSTALL) \ +}; + push @m, +q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \ + write "}.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{" \ +} unless $self->{NO_PACKLIST}; + + push @m, +q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \ + "$(INST_ARCHLIB)" "$(DESTINSTALLSITEARCH)" \ + "$(INST_BIN)" "$(DESTINSTALLSITEBIN)" \ + "$(INST_SCRIPT)" "$(DESTINSTALLSITESCRIPT)" \ + "$(INST_MAN1DIR)" "$(DESTINSTALLSITEMAN1DIR)" \ + "$(INST_MAN3DIR)" "$(DESTINSTALLSITEMAN3DIR)" + $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ + "}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{" + +pure_vendor_install :: all + $(NOECHO) $(MOD_INSTALL) \ +}; + push @m, +q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \ + write "}.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{" \ +} unless $self->{NO_PACKLIST}; + + push @m, +q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \ + "$(INST_ARCHLIB)" "$(DESTINSTALLVENDORARCH)" \ + "$(INST_BIN)" "$(DESTINSTALLVENDORBIN)" \ + "$(INST_SCRIPT)" "$(DESTINSTALLVENDORSCRIPT)" \ + "$(INST_MAN1DIR)" "$(DESTINSTALLVENDORMAN1DIR)" \ + "$(INST_MAN3DIR)" "$(DESTINSTALLVENDORMAN3DIR)" + +}; + + push @m, q{ +doc_perl_install :: all + $(NOECHO) $(NOOP) + +doc_site_install :: all + $(NOECHO) $(NOOP) + +doc_vendor_install :: all + $(NOECHO) $(NOOP) + +} if $self->{NO_PERLLOCAL}; + + push @m, q{ +doc_perl_install :: all + $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" + -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" + -$(NOECHO) $(DOC_INSTALL) \ + "Module" "$(NAME)" \ + "installed into" "$(INSTALLPRIVLIB)" \ + LINKTYPE "$(LINKTYPE)" \ + VERSION "$(VERSION)" \ + EXE_FILES "$(EXE_FILES)" \ + >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" + +doc_site_install :: all + $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" + -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" + -$(NOECHO) $(DOC_INSTALL) \ + "Module" "$(NAME)" \ + "installed into" "$(INSTALLSITELIB)" \ + LINKTYPE "$(LINKTYPE)" \ + VERSION "$(VERSION)" \ + EXE_FILES "$(EXE_FILES)" \ + >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" + +doc_vendor_install :: all + $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" + -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" + -$(NOECHO) $(DOC_INSTALL) \ + "Module" "$(NAME)" \ + "installed into" "$(INSTALLVENDORLIB)" \ + LINKTYPE "$(LINKTYPE)" \ + VERSION "$(VERSION)" \ + EXE_FILES "$(EXE_FILES)" \ + >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" + +} unless $self->{NO_PERLLOCAL}; + + push @m, q{ +uninstall :: uninstall_from_$(INSTALLDIRS)dirs + $(NOECHO) $(NOOP) + +uninstall_from_perldirs :: + $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" + +uninstall_from_sitedirs :: + $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" + +uninstall_from_vendordirs :: + $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" +}; + + join("",@m); +} + +=item installbin (o) + +Defines targets to make and to install EXE_FILES. + +=cut + +sub installbin { + my($self) = shift; + + return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; + my @exefiles = sort @{$self->{EXE_FILES}}; + return "" unless @exefiles; + + @exefiles = map vmsify($_), @exefiles if $Is{VMS}; + + my %fromto; + for my $from (@exefiles) { + my($path)= $self->catfile('$(INST_SCRIPT)', basename($from)); + + local($_) = $path; # for backwards compatibility + my $to = $self->libscan($path); + print "libscan($from) => '$to'\n" if ($Verbose >=2); + + $to = vmsify($to) if $Is{VMS}; + $fromto{$from} = $to; + } + my @to = sort values %fromto; + + my @m; + push(@m, qq{ +EXE_FILES = @exefiles + +pure_all :: @to + \$(NOECHO) \$(NOOP) + +realclean :: +}); + + # realclean can get rather large. + push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to); + push @m, "\n"; + + # A target for each exe file. + my @froms = sort keys %fromto; + for my $from (@froms) { + # 1 2 + push @m, _sprintf562 <<'MAKE', $from, $fromto{$from}; +%2$s : %1$s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists + $(NOECHO) $(RM_F) %2$s + $(CP) %1$s %2$s + $(FIXIN) %2$s + -$(NOECHO) $(CHMOD) $(PERM_RWX) %2$s + +MAKE + + } + + join "", @m; +} + +=item linkext (o) + +Defines the linkext target which in turn defines the LINKTYPE. + +=cut + +# LINKTYPE => static or dynamic or '' +sub linkext { + my($self, %attribs) = @_; + my $linktype = $attribs{LINKTYPE}; + $linktype = $self->{LINKTYPE} unless defined $linktype; + if (defined $linktype and $linktype eq '') { + warn "Warning: LINKTYPE set to '', no longer necessary\n"; + } + $linktype = '$(LINKTYPE)' unless defined $linktype; + " +linkext :: $linktype + \$(NOECHO) \$(NOOP) +"; +} + +=item lsdir + +Takes as arguments a directory name and a regular expression. Returns +all entries in the directory that match the regular expression. + +=cut + +sub lsdir { + # $self + my(undef, $dir, $regex) = @_; + opendir(my $dh, defined($dir) ? $dir : ".") + or return; + my @ls = readdir $dh; + closedir $dh; + @ls = grep(/$regex/, @ls) if defined $regex; + @ls; +} + +=item macro (o) + +Simple subroutine to insert the macros defined by the macro attribute +into the Makefile. + +=cut + +sub macro { + my($self,%attribs) = @_; + my @m; + foreach my $key (sort keys %attribs) { + my $val = $attribs{$key}; + push @m, "$key = $val\n"; + } + join "", @m; +} + +=item makeaperl (o) + +Called by staticmake. Defines how to write the Makefile to produce a +static new perl. + +By default the Makefile produced includes all the static extensions in +the perl library. (Purified versions of library files, e.g., +DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.) + +=cut + +sub makeaperl { + my($self, %attribs) = @_; + my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = + @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; + s/^(.*)/"-I$1"/ for @{$perlinc || []}; + my(@m); + push @m, " +# --- MakeMaker makeaperl section --- +MAP_TARGET = $target +FULLPERL = $self->{FULLPERL} +MAP_PERLINC = @{$perlinc || []} +"; + return join '', @m if $self->{PARENT}; + + my($dir) = join ":", @{$self->{DIR}}; + + unless ($self->{MAKEAPERL}) { + push @m, q{ +$(MAP_TARGET) :: $(MAKE_APERL_FILE) + $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ + +$(MAKE_APERL_FILE) : static $(FIRST_MAKEFILE) pm_to_blib + $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) + $(NOECHO) $(PERLRUNINST) \ + Makefile.PL DIR="}, $dir, q{" \ + MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ + MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}; + + foreach (@ARGV){ + my $arg = $_; # avoid lvalue aliasing + if ( $arg =~ /(^.*?=)(.*['\s].*)/ ) { + $arg = $1 . $self->quote_literal($2); + } + push @m, " \\\n\t\t$arg"; + } + push @m, "\n"; + + return join '', @m; + } + + my $cccmd = $self->const_cccmd($libperl); + $cccmd =~ s/^CCCMD\s*=\s*//; + $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /; + $cccmd .= " $Config{cccdlflags}" + if ($Config{useshrplib} eq 'true'); + $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; + + # The front matter of the linkcommand... + my $linkcmd = join ' ', "\$(CC)", + grep($_, @Config{qw(ldflags ccdlflags)}); + $linkcmd =~ s/\s+/ /g; + $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,; + + # Which *.a files could we make use of... + my $staticlib21 = $self->_find_static_libs($searchdirs); + # We trust that what has been handed in as argument, will be buildable + $static = [] unless $static; + @$staticlib21{@{$static}} = (1) x @{$static}; + + $extra = [] unless $extra && ref $extra eq 'ARRAY'; + for (sort keys %$staticlib21) { + next unless /\Q$self->{LIB_EXT}\E\z/; + $_ = dirname($_) . "/extralibs.ld"; + push @$extra, $_; + } + + s/^(.*)/"-I$1"/ for @{$perlinc || []}; + + $target ||= "perl"; + $tmp ||= "."; + +# MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we +# regenerate the Makefiles, MAP_STATIC and the dependencies for +# extralibs.all are computed correctly + my @map_static = reverse sort keys %$staticlib21; + push @m, " +MAP_LINKCMD = $linkcmd +MAP_STATIC = ", join(" \\\n\t", map { qq{"$_"} } @map_static), " +MAP_STATICDEP = ", join(' ', map { $self->quote_dep($_) } @map_static), " + +MAP_PRELIBS = $Config{perllibs} $Config{cryptlib} +"; + + my $lperl; + if (defined $libperl) { + ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; + } + unless ($libperl && -f $lperl) { # Ilya's code... + my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE"; + $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL}; + $libperl ||= "libperl$self->{LIB_EXT}"; + $libperl = "$dir/$libperl"; + $lperl ||= "libperl$self->{LIB_EXT}"; + $lperl = "$dir/$lperl"; + + if (! -f $libperl and ! -f $lperl) { + # We did not find a static libperl. Maybe there is a shared one? + if ($Is{SunOS}) { + $lperl = $libperl = "$dir/$Config{libperl}"; + # SUNOS ld does not take the full path to a shared library + $libperl = '' if $Is{SunOS4}; + } + } + + print <<EOF unless -f $lperl || defined($self->{PERL_SRC}); +Warning: $libperl not found +If you're going to build a static perl binary, make sure perl is installed +otherwise ignore this warning +EOF + } + + # SUNOS ld does not take the full path to a shared library + my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl'; + my $libperl_dep = $self->quote_dep($libperl); + + push @m, " +MAP_LIBPERL = $libperl +MAP_LIBPERLDEP = $libperl_dep +LLIBPERL = $llibperl +"; + + push @m, ' +$(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).' + $(NOECHO) $(RM_F) $@ + $(NOECHO) $(TOUCH) $@ +'; + + foreach my $catfile (@$extra){ + push @m, "\tcat $catfile >> \$\@\n"; + } + + my $ldfrom = $self->{XSMULTI} ? '' : '$(LDFROM)'; + # 1 2 3 4 + push @m, _sprintf562 <<'EOF', $tmp, $ldfrom, $self->xs_obj_opt('$@'), $makefilename; +$(MAP_TARGET) :: %1$s/perlmain$(OBJ_EXT) $(MAP_LIBPERLDEP) $(MAP_STATICDEP) $(INST_ARCHAUTODIR)/extralibs.all + $(MAP_LINKCMD) %2$s $(OPTIMIZE) %1$s/perlmain$(OBJ_EXT) %3$s $(MAP_STATIC) "$(LLIBPERL)" `cat $(INST_ARCHAUTODIR)/extralibs.all` $(MAP_PRELIBS) + $(NOECHO) $(ECHO) "To install the new '$(MAP_TARGET)' binary, call" + $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s inst_perl MAP_TARGET=$(MAP_TARGET)" + $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s map_clean" + +%1$s/perlmain\$(OBJ_EXT): %1$s/perlmain.c +EOF + push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n"; + + my $maybe_DynaLoader = $Config{usedl} ? 'q(DynaLoader)' : ''; + push @m, _sprintf562 <<'EOF', $tmp, $makefilename, $maybe_DynaLoader; + +%1$s/perlmain.c: %2$s + $(NOECHO) $(ECHO) Writing $@ + $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \ + -e "writemain(grep(s#.*/auto/##s, @ARGV), %3$s)" $(MAP_STATIC) > $@t + $(MV) $@t $@ + +EOF + push @m, "\t", q{$(NOECHO) $(PERL) "$(INSTALLSCRIPT)/fixpmain" +} if (defined (&Dos::UseLFN) && Dos::UseLFN()==0); + + + push @m, q{ +doc_inst_perl : + $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" + -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" + -$(NOECHO) $(DOC_INSTALL) \ + "Perl binary" "$(MAP_TARGET)" \ + MAP_STATIC "$(MAP_STATIC)" \ + MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \ + MAP_LIBPERL "$(MAP_LIBPERL)" \ + >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" + +}; + + push @m, q{ +inst_perl : pure_inst_perl doc_inst_perl + +pure_inst_perl : $(MAP_TARGET) + }.$self->{CP}.q{ $(MAP_TARGET) "}.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{" + +clean :: map_clean + +map_clean : + }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all +}; + + join '', @m; +} + +# utility method +sub _find_static_libs { + my ($self, $searchdirs) = @_; + # don't use File::Spec here because on Win32 F::F still uses "/" + my $installed_version = join('/', + 'auto', $self->{FULLEXT}, "$self->{BASEEXT}$self->{LIB_EXT}" + ); + my %staticlib21; + require File::Find; + File::Find::find(sub { + if ($File::Find::name =~ m{/auto/share\z}) { + # in a subdir of auto/share, prune because e.g. + # Alien::pkgconfig uses File::ShareDir to put .a files + # there. do not want + $File::Find::prune = 1; + return; + } + + return unless m/\Q$self->{LIB_EXT}\E$/; + + return unless -f 'extralibs.ld'; # this checks is a "proper" XS installation + + # Skip perl's libraries. + return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/; + + # Skip purified versions of libraries + # (e.g., DynaLoader_pure_p1_c0_032.a) + return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"; + + if( exists $self->{INCLUDE_EXT} ){ + my $found = 0; + + (my $xx = $File::Find::name) =~ s,.*?/auto/,,s; + $xx =~ s,/?$_,,; + $xx =~ s,/,::,g; + + # Throw away anything not explicitly marked for inclusion. + # DynaLoader is implied. + foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ + if( $xx eq $incl ){ + $found++; + last; + } + } + return unless $found; + } + elsif( exists $self->{EXCLUDE_EXT} ){ + (my $xx = $File::Find::name) =~ s,.*?/auto/,,s; + $xx =~ s,/?$_,,; + $xx =~ s,/,::,g; + + # Throw away anything explicitly marked for exclusion + foreach my $excl (@{$self->{EXCLUDE_EXT}}){ + return if( $xx eq $excl ); + } + } + + # don't include the installed version of this extension. I + # leave this line here, although it is not necessary anymore: + # I patched minimod.PL instead, so that Miniperl.pm won't + # include duplicates + + # Once the patch to minimod.PL is in the distribution, I can + # drop it + return if $File::Find::name =~ m:\Q$installed_version\E\z:; + return if !$self->xs_static_lib_is_xs($_); + use Cwd 'cwd'; + $staticlib21{cwd() . "/" . $_}++; + }, grep( -d $_, map { $self->catdir($_, 'auto') } @{$searchdirs || []}) ); + return \%staticlib21; +} + +=item xs_static_lib_is_xs (o) + +Called by a utility method of makeaperl. Checks whether a given file +is an XS library by seeing whether it defines any symbols starting +with C<boot_> (with an optional leading underscore - needed on MacOS). + +=cut + +sub xs_static_lib_is_xs { + my ($self, $libfile) = @_; + my $devnull = File::Spec->devnull; + return `nm $libfile 2>$devnull` =~ /\b_?boot_/; +} + +=item makefile (o) + +Defines how to rewrite the Makefile. + +=cut + +sub makefile { + my($self) = shift; + my $m; + # We do not know what target was originally specified so we + # must force a manual rerun to be sure. But as it should only + # happen very rarely it is not a significant problem. + $m = ' +$(OBJECT) : $(FIRST_MAKEFILE) + +' if $self->{OBJECT}; + + my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?'; + my $mpl_args = join " ", map qq["$_"], @ARGV; + my $cross = ''; + if (defined $::Cross::platform) { + # Inherited from win32/buildext.pl + $cross = "-MCross=$::Cross::platform "; + } + $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $cross, $mpl_args; +# We take a very conservative approach here, but it's worth it. +# We move Makefile to Makefile.old here to avoid gnu make looping. +$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) + $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s" + $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." + -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) + -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) + - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) + $(PERLRUN) %sMakefile.PL %s + $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" + $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" + $(FALSE) + +MAKE_FRAG + + return $m; +} + + +=item maybe_command + +Returns true, if the argument is likely to be a command. + +=cut + +sub maybe_command { + my($self,$file) = @_; + return $file if -x $file && ! -d $file; + return; +} + + +=item needs_linking (o) + +Does this module need linking? Looks into subdirectory objects (see +also has_link_code()) + +=cut + +sub needs_linking { + my($self) = shift; + + my $caller = (caller(0))[3]; + confess("needs_linking called too early") if + $caller =~ /^ExtUtils::MakeMaker::/; + return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING}; + if ($self->has_link_code or $self->{MAKEAPERL}){ + $self->{NEEDS_LINKING} = 1; + return 1; + } + foreach my $child (keys %{$self->{CHILDREN}}) { + if ($self->{CHILDREN}->{$child}->needs_linking) { + $self->{NEEDS_LINKING} = 1; + return 1; + } + } + return $self->{NEEDS_LINKING} = 0; +} + + +=item parse_abstract + +parse a file and return what you think is the ABSTRACT + +=cut + +sub parse_abstract { + my($self,$parsefile) = @_; + my $result; + + local $/ = "\n"; + open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; + binmode $fh; + my $inpod = 0; + my $pod_encoding; + my $package = $self->{DISTNAME}; + $package =~ s/-/::/g; + while (<$fh>) { + $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; + next if !$inpod; + s#\r*\n\z##; # handle CRLF input + + if ( /^=encoding\s*(.*)$/i ) { + $pod_encoding = $1; + } + + if ( /^($package(?:\.pm)? \s+ -+ \s+)(.*)/x ) { + $result = $2; + next; + } + next unless $result; + + if ( $result && ( /^\s*$/ || /^\=/ ) ) { + last; + } + $result = join ' ', $result, $_; + } + close $fh; + + if ( $pod_encoding and !( "$]" < 5.008 or !$Config{useperlio} ) ) { + # Have to wrap in an eval{} for when running under PERL_CORE + # Encode isn't available during build phase and parsing + # ABSTRACT isn't important there + eval { + require Encode; + $result = Encode::decode($pod_encoding, $result); + } + } + + return $result; +} + +=item parse_version + + my $version = MM->parse_version($file); + +Parse a $file and return what $VERSION is set to by the first assignment. +It will return the string "undef" if it can't figure out what $VERSION +is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION +are okay, but C<my $VERSION> is not. + +C<package Foo VERSION> is also checked for. The first version +declaration found is used, but this may change as it differs from how +Perl does it. + +parse_version() will try to C<use version> before checking for +C<$VERSION> so the following will work. + + $VERSION = qv(1.2.3); + +=cut + +sub parse_version { + my($self,$parsefile) = @_; + my $result; + + local $/ = "\n"; + local $_; + open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; + my $inpod = 0; + while (<$fh>) { + $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; + next if $inpod || /^\s*#/; + chop; + next if /^\s*(if|unless|elsif)/; + if ( m{^ \s* package \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* (;|\{) }x ) { + local $^W = 0; + $result = $1; + } + elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* (?<![<>=!])\=[^=]}x ) { + $result = $self->get_version($parsefile, $1, $2); + } + else { + next; + } + last if defined $result; + } + close $fh; + + if ( defined $result && $result !~ /^v?[\d_\.]+$/ ) { + require version; + my $normal = eval { version->new( $result ) }; + $result = $normal if defined $normal; + } + $result = "undef" unless defined $result; + return $result; +} + +sub get_version { + my ($self, $parsefile, $sigil, $name) = @_; + my $line = $_; # from the while() loop in parse_version + { + package ExtUtils::MakeMaker::_version; + undef *version; # in case of unexpected version() sub + eval { + require version; + version::->import; + }; + no strict; + local *{$name}; + local $^W = 0; + $line = $1 if $line =~ m{^(.+)}s; + eval($line); ## no critic + return ${$name}; + } +} + +=item pasthru (o) + +Defines the string that is passed to recursive make calls in +subdirectories. The variables like C<PASTHRU_DEFINE> are used in each +level, and passed downwards on the command-line with e.g. the value of +that level's DEFINE. Example: + + # Level 0 has DEFINE = -Dfunky + # This code will define level 0's PASTHRU=PASTHRU_DEFINE="$(DEFINE) + # $(PASTHRU_DEFINE)" + # Level 0's $(CCCMD) will include macros $(DEFINE) and $(PASTHRU_DEFINE) + # So will level 1's, so when level 1 compiles, it will get right values + # And so ad infinitum + +=cut + +sub pasthru { + my($self) = shift; + my(@m); + + my(@pasthru); + my($sep) = $Is{VMS} ? ',' : ''; + $sep .= "\\\n\t"; + + foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE + PREFIX INSTALL_BASE) + ) + { + next unless defined $self->{$key}; + push @pasthru, "$key=\"\$($key)\""; + } + + foreach my $key (qw(DEFINE INC)) { + # default to the make var + my $val = qq{\$($key)}; + # expand within perl if given since need to use quote_literal + # since INC might include space-protecting ""! + chomp($val = $self->{$key}) if defined $self->{$key}; + $val .= " \$(PASTHRU_$key)"; + my $quoted = $self->quote_literal($val); + push @pasthru, qq{PASTHRU_$key=$quoted}; + } + + push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n"; + join "", @m; +} + +=item perl_script + +Takes one argument, a file name, and returns the file name, if the +argument is likely to be a perl script. On MM_Unix this is true for +any ordinary, readable file. + +=cut + +sub perl_script { + my($self,$file) = @_; + return $file if -r $file && -f _; + return; +} + +=item perldepend (o) + +Defines the dependency from all *.h files that come with the perl +distribution. + +=cut + +sub perldepend { + my($self) = shift; + my(@m); + + my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm'); + + push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC}; +# Check for unpropogated config.sh changes. Should never happen. +# We do NOT just update config.h because that is not sufficient. +# An out of date config.h is not fatal but complains loudly! +$(PERL_INCDEP)/config.h: $(PERL_SRC)/config.sh + -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE) + +$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh + $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" + %s +MAKE_FRAG + + return join "", @m unless $self->needs_linking; + + if ($self->{OBJECT}) { + # Need to add an object file dependency on the perl headers. + # this is very important for XS modules in perl.git development. + push @m, $self->_perl_header_files_fragment("/"); # Directory separator between $(PERL_INC)/header.h + } + + push @m, join(" ", sort values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}}; + + return join "\n", @m; +} + + +=item pm_to_blib + +Defines target that copies all files in the hash PM to their +destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> + +=cut + +sub pm_to_blib { + my $self = shift; + my($autodir) = $self->catdir('$(INST_LIB)','auto'); + my $r = q{ +pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM) +}; + + # VMS will swallow '' and PM_FILTER is often empty. So use q[] + my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']); +pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)') +CODE + + my @cmds = $self->split_command($pm_to_blib, + map { ($self->quote_literal($_) => $self->quote_literal($self->{PM}->{$_})) } sort keys %{$self->{PM}}); + + $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds; + $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n}; + + return $r; +} + +# transform dot-separated version string into comma-separated quadruple +# examples: '1.2.3.4.5' => '1,2,3,4' +# '1.2.3' => '1,2,3,0' +sub _ppd_version { + my ($self, $string) = @_; + return join ',', ((split /\./, $string), (0) x 4)[0..3]; +} + +=item ppd + +Defines target that creates a PPD (Perl Package Description) file +for a binary distribution. + +=cut + +sub ppd { + my($self) = @_; + + my $abstract = $self->{ABSTRACT} || ''; + $abstract =~ s/\n/\\n/sg; + $abstract =~ s/</</g; + $abstract =~ s/>/>/g; + + my $author = join(', ',@{ ref $self->{AUTHOR} eq 'ARRAY' ? $self->{AUTHOR} : [ $self->{AUTHOR} || '']}); + $author =~ s/</</g; + $author =~ s/>/>/g; + + my $ppd_file = "$self->{DISTNAME}.ppd"; + + my @ppd_chunks = qq(<SOFTPKG NAME="$self->{DISTNAME}" VERSION="$self->{VERSION}">\n); + + push @ppd_chunks, sprintf <<'PPD_HTML', $abstract, $author; + <ABSTRACT>%s</ABSTRACT> + <AUTHOR>%s</AUTHOR> +PPD_HTML + + push @ppd_chunks, " <IMPLEMENTATION>\n"; + if ( $self->{MIN_PERL_VERSION} ) { + my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION}); + push @ppd_chunks, sprintf <<'PPD_PERLVERS', $min_perl_version; + <PERLCORE VERSION="%s" /> +PPD_PERLVERS + + } + + # Don't add "perl" to requires. perl dependencies are + # handles by ARCHITECTURE. + my %prereqs = %{$self->{PREREQ_PM}}; + delete $prereqs{perl}; + + # Build up REQUIRE + foreach my $prereq (sort keys %prereqs) { + my $name = $prereq; + $name .= '::' unless $name =~ /::/; + my $version = $prereqs{$prereq}; + + my %attrs = ( NAME => $name ); + $attrs{VERSION} = $version if $version; + my $attrs = join " ", map { qq[$_="$attrs{$_}"] } sort keys %attrs; + push @ppd_chunks, qq( <REQUIRE $attrs />\n); + } + + my $archname = $Config{archname}; + if ("$]" >= 5.008) { + # archname did not change from 5.6 to 5.8, but those versions may + # not be not binary compatible so now we append the part of the + # version that changes when binary compatibility may change + $archname .= "-$Config{PERL_REVISION}.$Config{PERL_VERSION}"; + } + push @ppd_chunks, sprintf <<'PPD_OUT', $archname; + <ARCHITECTURE NAME="%s" /> +PPD_OUT + + if ($self->{PPM_INSTALL_SCRIPT}) { + if ($self->{PPM_INSTALL_EXEC}) { + push @ppd_chunks, sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n}, + $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT}; + } + else { + push @ppd_chunks, sprintf qq{ <INSTALL>%s</INSTALL>\n}, + $self->{PPM_INSTALL_SCRIPT}; + } + } + + if ($self->{PPM_UNINSTALL_SCRIPT}) { + if ($self->{PPM_UNINSTALL_EXEC}) { + push @ppd_chunks, sprintf qq{ <UNINSTALL EXEC="%s">%s</UNINSTALL>\n}, + $self->{PPM_UNINSTALL_EXEC}, $self->{PPM_UNINSTALL_SCRIPT}; + } + else { + push @ppd_chunks, sprintf qq{ <UNINSTALL>%s</UNINSTALL>\n}, + $self->{PPM_UNINSTALL_SCRIPT}; + } + } + + my ($bin_location) = $self->{BINARY_LOCATION} || ''; + $bin_location =~ s/\\/\\\\/g; + + push @ppd_chunks, sprintf <<'PPD_XML', $bin_location; + <CODEBASE HREF="%s" /> + </IMPLEMENTATION> +</SOFTPKG> +PPD_XML + + my @ppd_cmds = $self->stashmeta(join('', @ppd_chunks), $ppd_file); + + return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds; +# Creates a PPD (Perl Package Description) for a binary distribution. +ppd : + %s +PPD_OUT + +} + +=item prefixify + + $MM->prefixify($var, $prefix, $new_prefix, $default); + +Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to +replace it's $prefix with a $new_prefix. + +Should the $prefix fail to match I<AND> a PREFIX was given as an +argument to WriteMakefile() it will set it to the $new_prefix + +$default. This is for systems whose file layouts don't neatly fit into +our ideas of prefixes. + +This is for heuristics which attempt to create directory structures +that mirror those of the installed perl. + +For example: + + $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1'); + +this will attempt to remove '/usr' from the front of the +$MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir} +if necessary) and replace it with '/home/foo'. If this fails it will +simply use '/home/foo/man/man1'. + +=cut + +sub prefixify { + my($self,$var,$sprefix,$rprefix,$default) = @_; + + my $path = $self->{uc $var} || + $Config_Override{lc $var} || $Config{lc $var} || ''; + + $rprefix .= '/' if $sprefix =~ m|/$|; + + warn " prefixify $var => $path\n" if $Verbose >= 2; + warn " from $sprefix to $rprefix\n" if $Verbose >= 2; + + if( $self->{ARGS}{PREFIX} && + $path !~ s{^\Q$sprefix\E\b}{$rprefix}s ) + { + + warn " cannot prefix, using default.\n" if $Verbose >= 2; + warn " no default!\n" if !$default && $Verbose >= 2; + + $path = $self->catdir($rprefix, $default) if $default; + } + + print " now $path\n" if $Verbose >= 2; + return $self->{uc $var} = $path; +} + + +=item processPL (o) + +Defines targets to run *.PL files. + +=cut + +sub processPL { + my $self = shift; + my $pl_files = $self->{PL_FILES}; + + return "" unless $pl_files; + + my $m = ''; + foreach my $plfile (sort keys %$pl_files) { + my $targets = $pl_files->{$plfile}; + my $list = + ref($targets) eq 'HASH' ? [ sort keys %$targets ] : + ref($targets) eq 'ARRAY' ? $pl_files->{$plfile} : + [$pl_files->{$plfile}]; + + foreach my $target (@$list) { + if( $Is{VMS} ) { + $plfile = vmsify($self->eliminate_macros($plfile)); + $target = vmsify($self->eliminate_macros($target)); + } + + # Normally a .PL file runs AFTER pm_to_blib so it can have + # blib in its @INC and load the just built modules. BUT if + # the generated module is something in $(TO_INST_PM) which + # pm_to_blib depends on then it can't depend on pm_to_blib + # else we have a dependency loop. + my $pm_dep; + my $perlrun; + if( defined $self->{PM}{$target} ) { + $pm_dep = ''; + $perlrun = 'PERLRUN'; + } + else { + $pm_dep = 'pm_to_blib'; + $perlrun = 'PERLRUNINST'; + } + + my $extra_inputs = ''; + if( ref($targets) eq 'HASH' ) { + my $inputs = ref($targets->{$target}) + ? $targets->{$target} + : [$targets->{$target}]; + + for my $input (@$inputs) { + if( $Is{VMS} ) { + $input = vmsify($self->eliminate_macros($input)); + } + $extra_inputs .= ' '.$input; + } + } + + $m .= <<MAKE_FRAG; + +pure_all :: $target + \$(NOECHO) \$(NOOP) + +$target :: $plfile $pm_dep $extra_inputs + \$($perlrun) $plfile $target $extra_inputs +MAKE_FRAG + + } + } + + return $m; +} + +=item specify_shell + +Specify SHELL if needed - not done on Unix. + +=cut + +sub specify_shell { + return ''; +} + +=item quote_paren + +Backslashes parentheses C<()> in command line arguments. +Doesn't handle recursive Makefile C<$(...)> constructs, +but handles simple ones. + +=cut + +sub quote_paren { + my $arg = shift; + $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...) + $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected + $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...) + return $arg; +} + +=item replace_manpage_separator + + my $man_name = $MM->replace_manpage_separator($file_path); + +Takes the name of a package, which may be a nested package, in the +form 'Foo/Bar.pm' and replaces the slash with C<::> or something else +safe for a man page file name. Returns the replacement. + +=cut + +sub replace_manpage_separator { + my($self,$man) = @_; + + $man =~ s,/+,::,g; + return $man; +} + + +=item cd + +=cut + +sub cd { + my($self, $dir, @cmds) = @_; + + # No leading tab and no trailing newline makes for easier embedding + my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds; + + return $make_frag; +} + +=item oneliner + +=cut + +sub oneliner { + my($self, $cmd, $switches) = @_; + $switches = [] unless defined $switches; + + # Strip leading and trailing newlines + $cmd =~ s{^\n+}{}; + $cmd =~ s{\n+$}{}; + + my @cmds = split /\n/, $cmd; + $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds; + $cmd = $self->escape_newlines($cmd); + + $switches = join ' ', @$switches; + + return qq{\$(ABSPERLRUN) $switches -e $cmd --}; +} + + +=item quote_literal + +Quotes macro literal value suitable for being used on a command line so +that when expanded by make, will be received by command as given to +this method: + + my $quoted = $mm->quote_literal(q{it isn't}); + # returns: + # 'it isn'\''t' + print MAKEFILE "target:\n\techo $quoted\n"; + # when run "make target", will output: + # it isn't + +=cut + +sub quote_literal { + my($self, $text, $opts) = @_; + $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; + + # Quote single quotes + $text =~ s{'}{'\\''}g; + + $text = $opts->{allow_variables} + ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); + + return "'$text'"; +} + + +=item escape_newlines + +=cut + +sub escape_newlines { + my($self, $text) = @_; + + $text =~ s{\n}{\\\n}g; + + return $text; +} + + +=item max_exec_len + +Using L<POSIX>::ARG_MAX. Otherwise falling back to 4096. + +=cut + +sub max_exec_len { + my $self = shift; + + if (!defined $self->{_MAX_EXEC_LEN}) { + if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) { + $self->{_MAX_EXEC_LEN} = $arg_max; + } + else { # POSIX minimum exec size + $self->{_MAX_EXEC_LEN} = 4096; + } + } + + return $self->{_MAX_EXEC_LEN}; +} + + +=item static (o) + +Defines the static target. + +=cut + +sub static { +# --- Static Loading Sections --- + + my($self) = shift; + ' +## $(INST_PM) has been moved to the all: target. +## It remains here for awhile to allow for old usage: "make static" +static :: $(FIRST_MAKEFILE) $(INST_STATIC) + $(NOECHO) $(NOOP) +'; +} + +sub static_lib { + my($self) = @_; + return '' unless $self->has_link_code; + my(@m); + my @libs; + if ($self->{XSMULTI}) { + for my $ext ($self->_xs_list_basenames) { + my ($v, $d, $f) = File::Spec->splitpath($ext); + my @d = File::Spec->splitdir($d); + shift @d if $d[0] eq 'lib'; + my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); + my $instfile = $self->catfile($instdir, "$f\$(LIB_EXT)"); + my $objfile = "$ext\$(OBJ_EXT)"; + push @libs, [ $objfile, $instfile, $instdir ]; + } + } else { + @libs = ([ qw($(OBJECT) $(INST_STATIC) $(INST_ARCHAUTODIR)) ]); + } + push @m, map { $self->xs_make_static_lib(@$_); } @libs; + join "\n", @m; +} + +=item xs_make_static_lib + +Defines the recipes for the C<static_lib> section. + +=cut + +sub xs_make_static_lib { + my ($self, $from, $to, $todir) = @_; + my @m = sprintf '%s: %s $(MYEXTLIB) %s$(DFSEP).exists'."\n", $to, $from, $todir; + push @m, "\t\$(RM_F) \"\$\@\"\n"; + push @m, $self->static_lib_fixtures; + push @m, $self->static_lib_pure_cmd($from); + push @m, "\t\$(CHMOD) \$(PERM_RWX) \$\@\n"; + push @m, $self->static_lib_closures($todir); + join '', @m; +} + +=item static_lib_closures + +Records C<$(EXTRALIBS)> in F<extralibs.ld> and F<$(PERL_SRC)/ext.libs>. + +=cut + +sub static_lib_closures { + my ($self, $todir) = @_; + my @m = sprintf <<'MAKE_FRAG', $todir; + $(NOECHO) $(ECHO) "$(EXTRALIBS)" > %s$(DFSEP)extralibs.ld +MAKE_FRAG + # Old mechanism - still available: + push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; + $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)$(DFSEP)ext.libs +MAKE_FRAG + @m; +} + +=item static_lib_fixtures + +Handles copying C<$(MYEXTLIB)> as starter for final static library that +then gets added to. + +=cut + +sub static_lib_fixtures { + my ($self) = @_; + # If this extension has its own library (eg SDBM_File) + # then copy that to $(INST_STATIC) and add $(OBJECT) into it. + return unless $self->{MYEXTLIB}; + "\t\$(CP) \$(MYEXTLIB) \"\$\@\"\n"; +} + +=item static_lib_pure_cmd + +Defines how to run the archive utility. + +=cut + +sub static_lib_pure_cmd { + my ($self, $from) = @_; + my $ar; + if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) { + # Prefer the absolute pathed ar if available so that PATH + # doesn't confuse us. Perl itself is built with the full_ar. + $ar = 'FULL_AR'; + } else { + $ar = 'AR'; + } + sprintf <<'MAKE_FRAG', $ar, $from; + $(%s) $(AR_STATIC_ARGS) "$@" %s + $(RANLIB) "$@" +MAKE_FRAG +} + +=item staticmake (o) + +Calls makeaperl. + +=cut + +sub staticmake { + my($self, %attribs) = @_; + my(@static); + + my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB}); + + # And as it's not yet built, we add the current extension + # but only if it has some C code (or XS code, which implies C code) + if (@{$self->{C}}) { + @static = $self->catfile($self->{INST_ARCHLIB}, + "auto", + $self->{FULLEXT}, + "$self->{BASEEXT}$self->{LIB_EXT}" + ); + } + + # Either we determine now, which libraries we will produce in the + # subdirectories or we do it at runtime of the make. + + # We could ask all subdir objects, but I cannot imagine, why it + # would be necessary. + + # Instead we determine all libraries for the new perl at + # runtime. + my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB}); + + $self->makeaperl(MAKE => $self->{MAKEFILE}, + DIRS => \@searchdirs, + STAT => \@static, + INCL => \@perlinc, + TARGET => $self->{MAP_TARGET}, + TMP => "", + LIBPERL => $self->{LIBPERL_A} + ); +} + +=item subdir_x (o) + +Helper subroutine for subdirs + +=cut + +sub subdir_x { + my($self, $subdir) = @_; + + my $subdir_cmd = $self->cd($subdir, + '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)' + ); + return sprintf <<'EOT', $subdir_cmd; + +subdirs :: + $(NOECHO) %s +EOT + +} + +=item subdirs (o) + +Defines targets to process subdirectories. + +=cut + +sub subdirs { +# --- Sub-directory Sections --- + my($self) = shift; + my(@m); + # This method provides a mechanism to automatically deal with + # subdirectories containing further Makefile.PL scripts. + # It calls the subdir_x() method for each subdirectory. + foreach my $dir (@{$self->{DIR}}){ + push @m, $self->subdir_x($dir); +#### print "Including $dir subdirectory\n"; + } + if (@m){ + unshift @m, <<'EOF'; + +# The default clean, realclean and test targets in this Makefile +# have automatically been given entries for each subdir. + +EOF + } else { + push(@m, "\n# none") + } + join('',@m); +} + +=item test (o) + +Defines the test targets. + +=cut + +sub test { + my($self, %attribs) = @_; + my $tests = $attribs{TESTS} || ''; + if (!$tests && -d 't' && defined $attribs{RECURSIVE_TEST_FILES}) { + $tests = $self->find_tests_recursive; + } + elsif (!$tests && -d 't') { + $tests = $self->find_tests; + } + # have to do this because nmake is broken + $tests =~ s!/!\\!g if $self->is_make_type('nmake'); + # note: 'test.pl' name is also hardcoded in init_dirscan() + my @m; + my $default_testtype = $Config{usedl} ? 'dynamic' : 'static'; + push @m, <<EOF; +TEST_VERBOSE=0 +TEST_TYPE=test_\$(LINKTYPE) +TEST_FILE = test.pl +TEST_FILES = $tests +TESTDB_SW = -d + +testdb :: testdb_\$(LINKTYPE) + \$(NOECHO) \$(NOOP) + +test :: \$(TEST_TYPE) + \$(NOECHO) \$(NOOP) + +# Occasionally we may face this degenerate target: +test_ : test_$default_testtype + \$(NOECHO) \$(NOOP) + +EOF + + for my $linktype (qw(dynamic static)) { + my $directdeps = join ' ', grep !$self->{SKIPHASH}{$_}, $linktype, "pure_all"; # no depend on a linktype if SKIPped + push @m, "subdirs-test_$linktype :: $directdeps\n"; + foreach my $dir (@{ $self->{DIR} }) { + my $test = $self->cd($dir, "\$(MAKE) test_$linktype \$(PASTHRU)"); + push @m, "\t\$(NOECHO) $test\n"; + } + push @m, "\n"; + if ($tests or -f "test.pl") { + for my $testspec ([ '', '' ], [ 'db', ' $(TESTDB_SW)' ]) { + my ($db, $switch) = @$testspec; + my ($command, $deps); + # if testdb, build all but don't test all + $deps = $db eq 'db' ? $directdeps : "subdirs-test_$linktype"; + if ($linktype eq 'static' and $self->needs_linking) { + my $target = File::Spec->rel2abs('$(MAP_TARGET)'); + $command = qq{"$target" \$(MAP_PERLINC)}; + $deps .= ' $(MAP_TARGET)'; + } else { + $command = '$(FULLPERLRUN)' . $switch; + } + push @m, "test${db}_$linktype :: $deps\n"; + if ($db eq 'db') { + push @m, $self->test_via_script($command, '$(TEST_FILE)') + } else { + push @m, $self->test_via_script($command, '$(TEST_FILE)') + if -f "test.pl"; + push @m, $self->test_via_harness($command, '$(TEST_FILES)') + if $tests; + } + push @m, "\n"; + } + } else { + push @m, _sprintf562 <<'EOF', $linktype; +testdb_%1$s test_%1$s :: subdirs-test_%1$s + $(NOECHO) $(ECHO) 'No tests defined for $(NAME) extension.' + +EOF + } + } + + join "", @m; +} + +=item test_via_harness (override) + +For some reason which I forget, Unix machines like to have +PERL_DL_NONLAZY set for tests. + +=cut + +sub test_via_harness { + my($self, $perl, $tests) = @_; + return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests); +} + +=item test_via_script (override) + +Again, the PERL_DL_NONLAZY thing. + +=cut + +sub test_via_script { + my($self, $perl, $script) = @_; + return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script); +} + + +=item tool_xsubpp (o) + +Determines typemaps, xsubpp version, prototype behaviour. + +=cut + +sub tool_xsubpp { + my($self) = shift; + return "" unless $self->needs_linking; + + my $xsdir; + my @xsubpp_dirs = @INC; + + # Make sure we pick up the new xsubpp if we're building perl. + unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE}; + + my $foundxsubpp = 0; + foreach my $dir (@xsubpp_dirs) { + $xsdir = $self->catdir($dir, 'ExtUtils'); + if( -r $self->catfile($xsdir, "xsubpp") ) { + $foundxsubpp = 1; + last; + } + } + die "ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp" if !$foundxsubpp; + + my $tmdir = $self->catdir($self->{PERL_LIB},"ExtUtils"); + my(@tmdeps) = $self->catfile($tmdir,'typemap'); + if( $self->{TYPEMAPS} ){ + foreach my $typemap (@{$self->{TYPEMAPS}}){ + if( ! -f $typemap ) { + warn "Typemap $typemap not found.\n"; + } + else { + $typemap = vmsify($typemap) if $Is{VMS}; + push(@tmdeps, $typemap); + } + } + } + push(@tmdeps, "typemap") if -f "typemap"; + # absolutised because with deep-located typemaps, eg "lib/XS/typemap", + # if xsubpp is called from top level with + # $(XSUBPP) ... -typemap "lib/XS/typemap" "lib/XS/Test.xs" + # it says: + # Can't find lib/XS/type map in (fulldir)/lib/XS + # because ExtUtils::ParseXS::process_file chdir's to .xs file's + # location. This is the only way to get all specified typemaps used, + # wherever located. + my @tmargs = map { '-typemap '.$self->quote_literal(File::Spec->rel2abs($_)) } @tmdeps; + $_ = $self->quote_dep($_) for @tmdeps; + if( exists $self->{XSOPT} ){ + unshift( @tmargs, $self->{XSOPT} ); + } + + if ($Is{VMS} && + $Config{'ldflags'} && + $Config{'ldflags'} =~ m!/Debug!i && + (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/) + ) + { + unshift(@tmargs,'-nolinenumbers'); + } + + + $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG}; + my $xsdirdep = $self->quote_dep($xsdir); + # -dep for use when dependency not command + + return qq{ +XSUBPPDIR = $xsdir +XSUBPP = "\$(XSUBPPDIR)\$(DFSEP)xsubpp" +XSUBPPRUN = \$(PERLRUN) \$(XSUBPP) +XSPROTOARG = $self->{XSPROTOARG} +XSUBPPDEPS = @tmdeps $xsdirdep\$(DFSEP)xsubpp +XSUBPPARGS = @tmargs +XSUBPP_EXTRA_ARGS = +}; +} + + +=item all_target + +Build man pages, too + +=cut + +sub all_target { + my $self = shift; + + return <<'MAKE_EXT'; +all :: pure_all manifypods + $(NOECHO) $(NOOP) +MAKE_EXT +} + +=item top_targets (o) + +Defines the targets all, subdirs, config, and O_FILES + +=cut + +sub top_targets { +# --- Target Sections --- + + my($self) = shift; + my(@m); + + push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'}; + + push @m, sprintf <<'EOF'; +pure_all :: config pm_to_blib subdirs linkext + $(NOECHO) $(NOOP) + + $(NOECHO) $(NOOP) + +subdirs :: $(MYEXTLIB) + $(NOECHO) $(NOOP) + +config :: $(FIRST_MAKEFILE) blibdirs + $(NOECHO) $(NOOP) +EOF + + push @m, ' +$(O_FILES) : $(H_FILES) +' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; + + push @m, q{ +help : + perldoc ExtUtils::MakeMaker +}; + + join('',@m); +} + +=item writedoc + +Obsolete, deprecated method. Not used since Version 5.21. + +=cut + +sub writedoc { +# --- perllocal.pod section --- + my($self,$what,$name,@attribs)=@_; + my $time = gmtime($ENV{SOURCE_DATE_EPOCH} || time); + print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; + print join "\n\n=item *\n\n", map("C<$_>",@attribs); + print "\n\n=back\n\n"; +} + +=item xs_c (o) + +Defines the suffix rules to compile XS files to C. + +=cut + +sub xs_c { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.c: + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc + $(MV) $*.xsc $*.c +'; +} + +=item xs_cpp (o) + +Defines the suffix rules to compile XS files to C++. + +=cut + +sub xs_cpp { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.cpp: + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc + $(MV) $*.xsc $*.cpp +'; +} + +=item xs_o (o) + +Defines suffix rules to go from XS to object files directly. This was +originally only intended for broken make implementations, but is now +necessary for per-XS file under C<XSMULTI>, since each XS file might +have an individual C<$(VERSION)>. + +=cut + +sub xs_o { + my ($self) = @_; + return '' unless $self->needs_linking(); + my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; + my $dbgout = $self->dbgoutflag; + $dbgout = $dbgout ? "$dbgout " : ''; + my $frag = ''; + # dmake makes noise about ambiguous rule + $frag .= sprintf <<'EOF', $dbgout, $m_o unless $self->is_make_type('dmake'); +.xs$(OBJ_EXT) : + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc + $(MV) $*.xsc $*.c + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) %s$*.c %s +EOF + if ($self->{XSMULTI}) { + for my $ext ($self->_xs_list_basenames) { + my $pmfile = "$ext.pm"; + croak "$ext.xs has no matching $pmfile: $!" unless -f $pmfile; + my $version = $self->parse_version($pmfile); + my $cccmd = $self->{CONST_CCCMD}; + $cccmd =~ s/^\s*CCCMD\s*=\s*//; + $cccmd =~ s/\$\(DEFINE_VERSION\)/-DVERSION=\\"$version\\"/; + $cccmd =~ s/\$\(XS_DEFINE_VERSION\)/-DXS_VERSION=\\"$version\\"/; + $self->_xsbuild_replace_macro($cccmd, 'xs', $ext, 'INC'); + my $define = '$(DEFINE)'; + $self->_xsbuild_replace_macro($define, 'xs', $ext, 'DEFINE'); + # 1 2 3 4 5 + $frag .= _sprintf562 <<'EOF', $ext, $cccmd, $m_o, $define, $dbgout; + +%1$s$(OBJ_EXT): %1$s.xs + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc + $(MV) $*.xsc $*.c + %2$s $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) %4$s %5$s$*.c %3$s +EOF + } + } + $frag =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/sg if $Is{ApplCor}; + $frag; +} + +# param gets modified +sub _xsbuild_replace_macro { + my ($self, undef, $xstype, $ext, $varname) = @_; + my $value = $self->_xsbuild_value($xstype, $ext, $varname); + return unless defined $value; + $_[1] =~ s/\$\($varname\)/$value/; +} + +sub _xsbuild_value { + my ($self, $xstype, $ext, $varname) = @_; + return $self->{XSBUILD}{$xstype}{$ext}{$varname} + if $self->{XSBUILD}{$xstype}{$ext}{$varname}; + return $self->{XSBUILD}{$xstype}{all}{$varname} + if $self->{XSBUILD}{$xstype}{all}{$varname}; + (); +} + +1; + +=back + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + +__END__ diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VMS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VMS.pm new file mode 100644 index 0000000000000000000000000000000000000000..fbf5f9ee26508b22282c502f9a1c0c99c609d3cd --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VMS.pm @@ -0,0 +1,2282 @@ +package ExtUtils::MM_VMS; + +use strict; + +use ExtUtils::MakeMaker::Config; +require Exporter; + +BEGIN { + # so we can compile the thing on non-VMS platforms. + if( $^O eq 'VMS' ) { + require VMS::Filespec; + VMS::Filespec->import; + } +} + +use File::Basename; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); + +use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562); +our $Revision = $ExtUtils::MakeMaker::Revision; + + +=head1 NAME + +ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + Do not use this directly. + Instead, use ExtUtils::MM and it will figure out which MM_* + class to use for you. + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided +there. This package overrides the implementation of these methods, not +the semantics. + +=head2 Methods always loaded + +=over 4 + +=item wraplist + +Converts a list into a string wrapped at approximately 80 columns. + +=cut + +sub wraplist { + my($self) = shift; + my($line,$hlen) = ('',0); + + foreach my $word (@_) { + # Perl bug -- seems to occasionally insert extra elements when + # traversing array (scalar(@array) doesn't show them, but + # foreach(@array) does) (5.00307) + next unless $word =~ /\w/; + $line .= ' ' if length($line); + if ($hlen > 80) { $line .= "\\\n\t"; $hlen = 0; } + $line .= $word; + $hlen += length($word) + 2; + } + $line; +} + + +# This isn't really an override. It's just here because ExtUtils::MM_VMS +# appears in @MM::ISA before ExtUtils::Liblist::Kid, so if there isn't an ext() +# in MM_VMS, then AUTOLOAD is called, and bad things happen. So, we just +# mimic inheritance here and hand off to ExtUtils::Liblist::Kid. +# XXX This hackery will die soon. --Schwern +sub ext { + require ExtUtils::Liblist::Kid; + goto &ExtUtils::Liblist::Kid::ext; +} + +=back + +=head2 Methods + +Those methods which override default MM_Unix methods are marked +"(override)", while methods unique to MM_VMS are marked "(specific)". +For overridden methods, documentation is limited to an explanation +of why this method overrides the MM_Unix method; see the L<ExtUtils::MM_Unix> +documentation for more details. + +=over 4 + +=item guess_name (override) + +Try to determine name of extension being built. We begin with the name +of the current directory. Since VMS filenames are case-insensitive, +however, we look for a F<.pm> file whose name matches that of the current +directory (presumably the 'main' F<.pm> file for this extension), and try +to find a C<package> statement from which to obtain the Mixed::Case +package name. + +=cut + +sub guess_name { + my($self) = @_; + my($defname,$defpm,@pm,%xs); + local *PM; + + $defname = basename(fileify($ENV{'DEFAULT'})); + $defname =~ s![\d\-_]*\.dir.*$!!; # Clip off .dir;1 suffix, and package version + $defpm = $defname; + # Fallback in case for some reason a user has copied the files for an + # extension into a working directory whose name doesn't reflect the + # extension's name. We'll use the name of a unique .pm file, or the + # first .pm file with a matching .xs file. + if (not -e "${defpm}.pm") { + @pm = glob('*.pm'); + s/.pm$// for @pm; + if (@pm == 1) { ($defpm = $pm[0]) =~ s/.pm$//; } + elsif (@pm) { + %xs = map { s/.xs$//; ($_,1) } glob('*.xs'); ## no critic + if (keys %xs) { + foreach my $pm (@pm) { + $defpm = $pm, last if exists $xs{$pm}; + } + } + } + } + if (open(my $pm, '<', "${defpm}.pm")){ + while (<$pm>) { + if (/^\s*package\s+([^;]+)/i) { + $defname = $1; + last; + } + } + print "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t", + "defaulting package name to $defname\n" + if eof($pm); + close $pm; + } + else { + print "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t", + "defaulting package name to $defname\n"; + } + $defname =~ s#[\d.\-_]+$##; + $defname; +} + +=item find_perl (override) + +Use VMS file specification syntax and CLI commands to find and +invoke Perl images. + +=cut + +sub find_perl { + my($self, $ver, $names, $dirs, $trace) = @_; + my($vmsfile,@sdirs,@snames,@cand); + my($rslt); + my($inabs) = 0; + local *TCF; + + if( $self->{PERL_CORE} ) { + # Check in relative directories first, so we pick up the current + # version of Perl if we're running MakeMaker as part of the main build. + @sdirs = sort { my($absa) = $self->file_name_is_absolute($a); + my($absb) = $self->file_name_is_absolute($b); + if ($absa && $absb) { return $a cmp $b } + else { return $absa ? 1 : ($absb ? -1 : ($a cmp $b)); } + } @$dirs; + # Check miniperl before perl, and check names likely to contain + # version numbers before "generic" names, so we pick up an + # executable that's less likely to be from an old installation. + @snames = sort { my($ba) = $a =~ m!([^:>\]/]+)$!; # basename + my($bb) = $b =~ m!([^:>\]/]+)$!; + my($ahasdir) = (length($a) - length($ba) > 0); + my($bhasdir) = (length($b) - length($bb) > 0); + if ($ahasdir and not $bhasdir) { return 1; } + elsif ($bhasdir and not $ahasdir) { return -1; } + else { $bb =~ /\d/ <=> $ba =~ /\d/ + or substr($ba,0,1) cmp substr($bb,0,1) + or length($bb) <=> length($ba) } } @$names; + } + else { + @sdirs = @$dirs; + @snames = @$names; + } + + # Image names containing Perl version use '_' instead of '.' under VMS + s/\.(\d+)$/_$1/ for @snames; + if ($trace >= 2){ + print "Looking for perl $ver by these names:\n"; + print "\t@snames,\n"; + print "in these dirs:\n"; + print "\t@sdirs\n"; + } + foreach my $dir (@sdirs){ + next unless defined $dir; # $self->{PERL_SRC} may be undefined + $inabs++ if $self->file_name_is_absolute($dir); + if ($inabs == 1) { + # We've covered relative dirs; everything else is an absolute + # dir (probably an installed location). First, we'll try + # potential command names, to see whether we can avoid a long + # MCR expression. + foreach my $name (@snames) { + push(@cand,$name) if $name =~ /^[\w\-\$]+$/; + } + $inabs++; # Should happen above in next $dir, but just in case... + } + foreach my $name (@snames){ + push @cand, ($name !~ m![/:>\]]!) ? $self->catfile($dir,$name) + : $self->fixpath($name,0); + } + } + foreach my $name (@cand) { + print "Checking $name\n" if $trace >= 2; + # If it looks like a potential command, try it without the MCR + if ($name =~ /^[\w\-\$]+$/) { + open(my $tcf, ">", "temp_mmvms.com") + or die('unable to open temp file'); + print $tcf "\$ set message/nofacil/nosever/noident/notext\n"; + print $tcf "\$ $name -e \"require $ver; print \"\"VER_OK\\n\"\"\"\n"; + close $tcf; + $rslt = `\@temp_mmvms.com` ; + unlink('temp_mmvms.com'); + if ($rslt =~ /VER_OK/) { + print "Using PERL=$name\n" if $trace; + return $name; + } + } + next unless $vmsfile = $self->maybe_command($name); + $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well + print "Executing $vmsfile\n" if ($trace >= 2); + open(my $tcf, '>', "temp_mmvms.com") + or die('unable to open temp file'); + print $tcf "\$ set message/nofacil/nosever/noident/notext\n"; + print $tcf "\$ mcr $vmsfile -e \"require $ver; print \"\"VER_OK\\n\"\"\" \n"; + close $tcf; + $rslt = `\@temp_mmvms.com`; + unlink('temp_mmvms.com'); + if ($rslt =~ /VER_OK/) { + print "Using PERL=MCR $vmsfile\n" if $trace; + return "MCR $vmsfile"; + } + } + print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; + 0; # false and not empty +} + +=item _fixin_replace_shebang (override) + +Helper routine for L<< MM->fixin()|ExtUtils::MM_Unix/fixin >>, overridden +because there's no such thing as an +actual shebang line that will be interpreted by the shell, so we just prepend +$Config{startperl} and preserve the shebang line argument for any switches it +may contain. + +=cut + +sub _fixin_replace_shebang { + my ( $self, $file, $line ) = @_; + + my ( undef, $arg ) = split ' ', $line, 2; + + return $Config{startperl} . "\n" . $Config{sharpbang} . "perl $arg\n"; +} + +=item maybe_command (override) + +Follows VMS naming conventions for executable files. +If the name passed in doesn't exactly match an executable file, +appends F<.Exe> (or equivalent) to check for executable image, and F<.Com> +to check for DCL procedure. If this fails, checks directories in DCL$PATH +and finally F<Sys$System:> for an executable file having the name specified, +with or without the F<.Exe>-equivalent suffix. + +=cut + +sub maybe_command { + my($self,$file) = @_; + return $file if -x $file && ! -d _; + my(@dirs) = (''); + my(@exts) = ('',$Config{'exe_ext'},'.exe','.com'); + + if ($file !~ m![/:>\]]!) { + for (my $i = 0; defined $ENV{"DCL\$PATH;$i"}; $i++) { + my $dir = $ENV{"DCL\$PATH;$i"}; + $dir .= ':' unless $dir =~ m%[\]:]$%; + push(@dirs,$dir); + } + push(@dirs,'Sys$System:'); + foreach my $dir (@dirs) { + my $sysfile = "$dir$file"; + foreach my $ext (@exts) { + return $file if -x "$sysfile$ext" && ! -d _; + } + } + } + return 0; +} + + +=item pasthru (override) + +The list of macro definitions to be passed through must be specified using +the /MACRO qualifier and must not add another /DEFINE qualifier. We prepend +our own comma here to the contents of $(PASTHRU_DEFINE) because it is often +empty and a comma always present in CCFLAGS would generate a missing +qualifier value error. + +=cut + +sub pasthru { + my($self) = shift; + my $pasthru = $self->SUPER::pasthru; + $pasthru =~ s|(PASTHRU\s*=\s*)|$1/MACRO=(|; + $pasthru =~ s|\n\z|)\n|m; + $pasthru =~ s|/defi?n?e?=\(?([^\),]+)\)?|,$1|ig; + + return $pasthru; +} + + +=item pm_to_blib (override) + +VMS wants a dot in every file so we can't have one called 'pm_to_blib', +it becomes 'pm_to_blib.' and MMS/K isn't smart enough to know that when +you have a target called 'pm_to_blib' it should look for 'pm_to_blib.'. + +So in VMS its pm_to_blib.ts. + +=cut + +sub pm_to_blib { + my $self = shift; + + my $make = $self->SUPER::pm_to_blib; + + $make =~ s{^pm_to_blib :}{pm_to_blib.ts :}m; + $make =~ s{\$\(TOUCH\) pm_to_blib}{\$(TOUCH) pm_to_blib.ts}; + + $make = <<'MAKE' . $make; +# Dummy target to match Unix target name; we use pm_to_blib.ts as +# timestamp file to avoid repeated invocations under VMS +pm_to_blib : pm_to_blib.ts + $(NOECHO) $(NOOP) + +MAKE + + return $make; +} + + +=item perl_script (override) + +If name passed in doesn't specify a readable file, appends F<.com> or +F<.pl> and tries again, since it's customary to have file types on all files +under VMS. + +=cut + +sub perl_script { + my($self,$file) = @_; + return $file if -r $file && ! -d _; + return "$file.com" if -r "$file.com"; + return "$file.pl" if -r "$file.pl"; + return ''; +} + + +=item replace_manpage_separator + +Use as separator a character which is legal in a VMS-syntax file name. + +=cut + +sub replace_manpage_separator { + my($self,$man) = @_; + $man = unixify($man); + $man =~ s#/+#__#g; + $man; +} + +=item init_DEST + +(override) Because of the difficulty concatenating VMS filepaths we +must pre-expand the DEST* variables. + +=cut + +sub init_DEST { + my $self = shift; + + $self->SUPER::init_DEST; + + # Expand DEST variables. + foreach my $var ($self->installvars) { + my $destvar = 'DESTINSTALL'.$var; + $self->{$destvar} = $self->eliminate_macros($self->{$destvar}); + } +} + + +=item init_DIRFILESEP + +No separator between a directory path and a filename on VMS. + +=cut + +sub init_DIRFILESEP { + my($self) = shift; + + $self->{DIRFILESEP} = ''; + return 1; +} + + +=item init_main (override) + + +=cut + +sub init_main { + my($self) = shift; + + $self->SUPER::init_main; + + $self->{DEFINE} ||= ''; + if ($self->{DEFINE} ne '') { + my(@terms) = split(/\s+/,$self->{DEFINE}); + my(@defs,@udefs); + foreach my $def (@terms) { + next unless $def; + my $targ = \@defs; + if ($def =~ s/^-([DU])//) { # If it was a Unix-style definition + $targ = \@udefs if $1 eq 'U'; + $def =~ s/='(.*)'$/=$1/; # then remove shell-protection '' + $def =~ s/^'(.*)'$/$1/; # from entire term or argument + } + if ($def =~ /=/) { + $def =~ s/"/""/g; # Protect existing " from DCL + $def = qq["$def"]; # and quote to prevent parsing of = + } + push @$targ, $def; + } + + $self->{DEFINE} = ''; + if (@defs) { + $self->{DEFINE} = '/Define=(' . join(',',@defs) . ')'; + } + if (@udefs) { + $self->{DEFINE} .= '/Undef=(' . join(',',@udefs) . ')'; + } + } +} + +=item init_tools (override) + +Provide VMS-specific forms of various utility commands. + +Sets DEV_NULL to nothing because I don't know how to do it on VMS. + +Changes EQUALIZE_TIMESTAMP to set revision date of target file to +one second later than source file, since MMK interprets precisely +equal revision dates for a source and target file as a sign that the +target needs to be updated. + +=cut + +sub init_tools { + my($self) = @_; + + $self->{NOOP} = 'Continue'; + $self->{NOECHO} ||= '@ '; + + $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE} || 'Descrip.MMS'; + $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE}; + $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS'; + $self->{MAKEFILE_OLD} ||= $self->eliminate_macros('$(FIRST_MAKEFILE)_old'); +# +# If an extension is not specified, then MMS/MMK assumes an +# an extension of .MMS. If there really is no extension, +# then a trailing "." needs to be appended to specify a +# a null extension. +# + $self->{MAKEFILE} .= '.' unless $self->{MAKEFILE} =~ m/\./; + $self->{FIRST_MAKEFILE} .= '.' unless $self->{FIRST_MAKEFILE} =~ m/\./; + $self->{MAKE_APERL_FILE} .= '.' unless $self->{MAKE_APERL_FILE} =~ m/\./; + $self->{MAKEFILE_OLD} .= '.' unless $self->{MAKEFILE_OLD} =~ m/\./; + + $self->{MACROSTART} ||= '/Macro=('; + $self->{MACROEND} ||= ')'; + $self->{USEMAKEFILE} ||= '/Descrip='; + + $self->{EQUALIZE_TIMESTAMP} ||= '$(ABSPERLRUN) -we "open F,qq{>>$ARGV[1]};close F;utime(0,(stat($ARGV[0]))[9]+1,$ARGV[1])"'; + + $self->{MOD_INSTALL} ||= + $self->oneliner(<<'CODE', ['-MExtUtils::Install']); +install([ from_to => {split('\|', <STDIN>)}, verbose => '$(VERBINST)', uninstall_shadows => '$(UNINST)', dir_mode => '$(PERM_DIR)' ]); +CODE + + $self->{UMASK_NULL} = '! '; + + $self->SUPER::init_tools; + + # Use the default shell + $self->{SHELL} ||= 'Posix'; + + # Redirection on VMS goes before the command, not after as on Unix. + # $(DEV_NULL) is used once and its not worth going nuts over making + # it work. However, Unix's DEV_NULL is quite wrong for VMS. + $self->{DEV_NULL} = ''; + + return; +} + +=item init_platform (override) + +Add PERL_VMS, MM_VMS_REVISION and MM_VMS_VERSION. + +MM_VMS_REVISION is for backwards compatibility before MM_VMS had a +$VERSION. + +=cut + +sub init_platform { + my($self) = shift; + + $self->{MM_VMS_REVISION} = $Revision; + $self->{MM_VMS_VERSION} = $VERSION; + $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC}, 'VMS') + if $self->{PERL_SRC}; +} + + +=item platform_constants + +=cut + +sub platform_constants { + my($self) = shift; + my $make_frag = ''; + + foreach my $macro (qw(PERL_VMS MM_VMS_REVISION MM_VMS_VERSION)) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } + + return $make_frag; +} + + +=item init_VERSION (override) + +Override the *DEFINE_VERSION macros with VMS semantics. Translate the +MAKEMAKER filepath to VMS style. + +=cut + +sub init_VERSION { + my $self = shift; + + $self->SUPER::init_VERSION; + + $self->{DEFINE_VERSION} = '"$(VERSION_MACRO)=""$(VERSION)"""'; + $self->{XS_DEFINE_VERSION} = '"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""'; + $self->{MAKEMAKER} = vmsify($INC{'ExtUtils/MakeMaker.pm'}); +} + + +=item constants (override) + +Fixes up numerous file and directory macros to insure VMS syntax +regardless of input syntax. Also makes lists of files +comma-separated. + +=cut + +sub constants { + my($self) = @_; + + # Be kind about case for pollution + for (@ARGV) { $_ = uc($_) if /POLLUTE/i; } + + # Cleanup paths for directories in MMS macros. + foreach my $macro ( qw [ + INST_BIN INST_SCRIPT INST_LIB INST_ARCHLIB + PERL_LIB PERL_ARCHLIB PERL_ARCHLIBDEP + PERL_INC PERL_SRC ], + (map { 'INSTALL'.$_ } $self->installvars), + (map { 'DESTINSTALL'.$_ } $self->installvars) + ) + { + next unless defined $self->{$macro}; + next if $macro =~ /MAN/ && $self->{$macro} eq 'none'; + $self->{$macro} = $self->fixpath($self->{$macro},1); + } + + # Cleanup paths for files in MMS macros. + foreach my $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKEFILE_OLD + MAKE_APERL_FILE MYEXTLIB] ) + { + next unless defined $self->{$macro}; + $self->{$macro} = $self->fixpath($self->{$macro},0); + } + + # Fixup files for MMS macros + # XXX is this list complete? + for my $macro (qw/ + FULLEXT VERSION_FROM + / ) { + next unless defined $self->{$macro}; + $self->{$macro} = $self->fixpath($self->{$macro},0); + } + + + for my $macro (qw/ + OBJECT LDFROM + / ) { + next unless defined $self->{$macro}; + + # Must expand macros before splitting on unescaped whitespace. + $self->{$macro} = $self->eliminate_macros($self->{$macro}); + if ($self->{$macro} =~ /(?<!\^)\s/) { + $self->{$macro} =~ s/(\\)?\n+\s+/ /g; + $self->{$macro} = $self->wraplist( + map $self->fixpath($_,0), split /,?(?<!\^)\s+/, $self->{$macro} + ); + } + else { + $self->{$macro} = $self->fixpath($self->{$macro},0); + } + } + + for my $macro (qw/ XS MAN1PODS MAN3PODS PM /) { + # Where is the space coming from? --jhi + next unless $self ne " " && defined $self->{$macro}; + my %tmp = (); + for my $key (keys %{$self->{$macro}}) { + $tmp{$self->fixpath($key,0)} = + $self->fixpath($self->{$macro}{$key},0); + } + $self->{$macro} = \%tmp; + } + + for my $macro (qw/ C O_FILES H /) { + next unless defined $self->{$macro}; + my @tmp = (); + for my $val (@{$self->{$macro}}) { + push(@tmp,$self->fixpath($val,0)); + } + $self->{$macro} = \@tmp; + } + + # mms/k does not define a $(MAKE) macro. + $self->{MAKE} = '$(MMS)$(MMSQUALIFIERS)'; + + return $self->SUPER::constants; +} + + +=item special_targets + +Clear the default .SUFFIXES and put in our own list. + +=cut + +sub special_targets { + my $self = shift; + + my $make_frag .= <<'MAKE_FRAG'; +.SUFFIXES : +.SUFFIXES : $(OBJ_EXT) .c .cpp .cxx .xs + +MAKE_FRAG + + return $make_frag; +} + +=item cflags (override) + +Bypass shell script and produce qualifiers for CC directly (but warn +user if a shell script for this extension exists). Fold multiple +/Defines into one, since some C compilers pay attention to only one +instance of this qualifier on the command line. + +=cut + +sub cflags { + my($self,$libperl) = @_; + my($quals) = $self->{CCFLAGS} || $Config{'ccflags'}; + my($definestr,$undefstr,$flagoptstr) = ('','',''); + my($incstr) = '/Include=($(PERL_INC)'; + my($name,$sys,@m); + + ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; + print "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}. + " required to modify CC command for $self->{'BASEEXT'}\n" + if ($Config{$name}); + + if ($quals =~ / -[DIUOg]/) { + while ($quals =~ / -([Og])(\d*)\b/) { + my($type,$lvl) = ($1,$2); + $quals =~ s/ -$type$lvl\b\s*//; + if ($type eq 'g') { $flagoptstr = '/NoOptimize'; } + else { $flagoptstr = '/Optimize' . (defined($lvl) ? "=$lvl" : ''); } + } + while ($quals =~ / -([DIU])(\S+)/) { + my($type,$def) = ($1,$2); + $quals =~ s/ -$type$def\s*//; + $def =~ s/"/""/g; + if ($type eq 'D') { $definestr .= qq["$def",]; } + elsif ($type eq 'I') { $incstr .= ',' . $self->fixpath($def,1); } + else { $undefstr .= qq["$def",]; } + } + } + if (length $quals and $quals !~ m!/!) { + warn "MM_VMS: Ignoring unrecognized CCFLAGS elements \"$quals\"\n"; + $quals = ''; + } + $definestr .= q["PERL_POLLUTE",] if $self->{POLLUTE}; + if (length $definestr) { chop($definestr); $quals .= "/Define=($definestr)"; } + if (length $undefstr) { chop($undefstr); $quals .= "/Undef=($undefstr)"; } + # Deal with $self->{DEFINE} here since some C compilers pay attention + # to only one /Define clause on command line, so we have to + # conflate the ones from $Config{'ccflags'} and $self->{DEFINE} + # ($self->{DEFINE} has already been VMSified in constants() above) + if ($self->{DEFINE}) { $quals .= $self->{DEFINE}; } + for my $type (qw(Def Undef)) { + my(@terms); + while ($quals =~ m:/${type}i?n?e?=([^/]+):ig) { + my $term = $1; + $term =~ s:^\((.+)\)$:$1:; + push @terms, $term; + } + if ($type eq 'Def') { + push @terms, qw[ $(DEFINE_VERSION) $(XS_DEFINE_VERSION) ]; + } + if (@terms) { + $quals =~ s:/${type}i?n?e?=[^/]+::ig; + # PASTHRU_DEFINE will have its own comma + $quals .= "/${type}ine=(" . join(',',@terms) . ($type eq 'Def' ? '$(PASTHRU_DEFINE)' : '') . ')'; + } + } + + $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb"; + + # Likewise with $self->{INC} and /Include + if ($self->{'INC'}) { + my(@includes) = split(/\s+/,$self->{INC}); + foreach (@includes) { + s/^-I//; + $incstr .= ','.$self->fixpath($_,1); + } + } + $quals .= "$incstr)"; +# $quals =~ s/,,/,/g; $quals =~ s/\(,/(/g; + $self->{CCFLAGS} = $quals; + + $self->{PERLTYPE} ||= ''; + + $self->{OPTIMIZE} ||= $flagoptstr || $Config{'optimize'}; + if ($self->{OPTIMIZE} !~ m!/!) { + if ($self->{OPTIMIZE} =~ m!-g!) { $self->{OPTIMIZE} = '/Debug/NoOptimize' } + elsif ($self->{OPTIMIZE} =~ /-O(\d*)/) { + $self->{OPTIMIZE} = '/Optimize' . (defined($1) ? "=$1" : ''); + } + else { + warn "MM_VMS: Can't parse OPTIMIZE \"$self->{OPTIMIZE}\"; using default\n" if length $self->{OPTIMIZE}; + $self->{OPTIMIZE} = '/Optimize'; + } + } + + return $self->{CFLAGS} = qq{ +CCFLAGS = $self->{CCFLAGS} +OPTIMIZE = $self->{OPTIMIZE} +PERLTYPE = $self->{PERLTYPE} +}; +} + +=item const_cccmd (override) + +Adds directives to point C preprocessor to the right place when +handling #include E<lt>sys/foo.hE<gt> directives. Also constructs CC +command line a bit differently than MM_Unix method. + +=cut + +sub const_cccmd { + my($self,$libperl) = @_; + my(@m); + + return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; + return '' unless $self->needs_linking(); + if ($Config{'vms_cc_type'} eq 'gcc') { + push @m,' +.FIRST + ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS GNU_CC_Include:[VMS]'; + } + elsif ($Config{'vms_cc_type'} eq 'vaxc') { + push @m,' +.FIRST + ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library + ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include'; + } + else { + push @m,' +.FIRST + ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ', + ($Config{'archname'} eq 'VMS_AXP' ? 'Sys$Library' : 'DECC$Library_Include'),' + ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include'; + } + + push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n"); + + $self->{CONST_CCCMD} = join('',@m); +} + + +=item tools_other (override) + +Throw in some dubious extra macros for Makefile args. + +Also keep around the old $(SAY) macro in case somebody's using it. + +=cut + +sub tools_other { + my($self) = @_; + + # XXX Are these necessary? Does anyone override them? They're longer + # than just typing the literal string. + my $extra_tools = <<'EXTRA_TOOLS'; + +# Just in case anyone is using the old macro. +USEMACROS = $(MACROSTART) +SAY = $(ECHO) + +EXTRA_TOOLS + + return $self->SUPER::tools_other . $extra_tools; +} + +=item init_dist (override) + +VMSish defaults for some values. + + macro description default + + ZIPFLAGS flags to pass to ZIP -Vu + + COMPRESS compression command to gzip + use for tarfiles + SUFFIX suffix to put on -gz + compressed files + + SHAR shar command to use vms_share + + DIST_DEFAULT default target to use to tardist + create a distribution + + DISTVNAME Use VERSION_SYM instead of $(DISTNAME)-$(VERSION_SYM) + VERSION for the name + +=cut + +sub init_dist { + my($self) = @_; + $self->{ZIPFLAGS} ||= '-Vu'; + $self->{COMPRESS} ||= 'gzip'; + $self->{SUFFIX} ||= '-gz'; + $self->{SHAR} ||= 'vms_share'; + $self->{DIST_DEFAULT} ||= 'zipdist'; + + $self->SUPER::init_dist; + + $self->{DISTVNAME} = "$self->{DISTNAME}-$self->{VERSION_SYM}" + unless $self->{ARGS}{DISTVNAME}; + + return; +} + +=item c_o (override) + +Use VMS syntax on command line. In particular, $(DEFINE) and +$(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros. + +=cut + +sub c_o { + my($self) = @_; + return '' unless $self->needs_linking(); + ' +.c$(OBJ_EXT) : + $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) + +.cpp$(OBJ_EXT) : + $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cpp /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) + +.cxx$(OBJ_EXT) : + $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cxx /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) + +'; +} + +=item xs_c (override) + +Use MM[SK] macros. + +=cut + +sub xs_c { + my($self) = @_; + return '' unless $self->needs_linking(); + ' +.xs.c : + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).xsc + $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c +'; +} + +=item xs_o (override) + +Use MM[SK] macros, and VMS command line for C compiler. + +=cut + +sub xs_o { + my ($self) = @_; + return '' unless $self->needs_linking(); + my $frag = ' +.xs$(OBJ_EXT) : + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).xsc + $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c + $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) +'; + if ($self->{XSMULTI}) { + for my $ext ($self->_xs_list_basenames) { + my $version = $self->parse_version("$ext.pm"); + my $ccflags = $self->{CCFLAGS}; + $ccflags =~ s/\$\(DEFINE_VERSION\)/\"VERSION_MACRO=\\"\"$version\\"\"/; + $ccflags =~ s/\$\(XS_DEFINE_VERSION\)/\"XS_VERSION_MACRO=\\"\"$version\\"\"/; + $self->_xsbuild_replace_macro($ccflags, 'xs', $ext, 'INC'); + $self->_xsbuild_replace_macro($ccflags, 'xs', $ext, 'DEFINE'); + + $frag .= _sprintf562 <<'EOF', $ext, $ccflags; + +%1$s$(OBJ_EXT) : %1$s.xs + $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs > $(MMS$TARGET_NAME).xsc + $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c + $(CC)%2$s$(OPTIMIZE) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) +EOF + } + } + $frag; +} + +=item _xsbuild_replace_macro (override) + +There is no simple replacement possible since a qualifier and all its +subqualifiers must be considered together, so we use our own utility +routine for the replacement. + +=cut + +sub _xsbuild_replace_macro { + my ($self, undef, $xstype, $ext, $varname) = @_; + my $value = $self->_xsbuild_value($xstype, $ext, $varname); + return unless defined $value; + $_[1] = _vms_replace_qualifier($self, $_[1], $value, $varname); +} + +=item _xsbuild_value (override) + +Convert the extension spec to Unix format, as that's what will +match what's in the XSBUILD data structure. + +=cut + +sub _xsbuild_value { + my ($self, $xstype, $ext, $varname) = @_; + $ext = unixify($ext); + return $self->SUPER::_xsbuild_value($xstype, $ext, $varname); +} + +sub _vms_replace_qualifier { + my ($self, $flags, $newflag, $macro) = @_; + my $qual_type; + my $type_suffix; + my $quote_subquals = 0; + my @subquals_new = split /\s+/, $newflag; + + if ($macro eq 'DEFINE') { + $qual_type = 'Def'; + $type_suffix = 'ine'; + map { $_ =~ s/^-D// } @subquals_new; + $quote_subquals = 1; + } + elsif ($macro eq 'INC') { + $qual_type = 'Inc'; + $type_suffix = 'lude'; + map { $_ =~ s/^-I//; $_ = $self->fixpath($_) } @subquals_new; + } + + my @subquals = (); + while ($flags =~ m:/${qual_type}\S{0,4}=([^/]+):ig) { + my $term = $1; + $term =~ s/\"//g; + $term =~ s:^\((.+)\)$:$1:; + push @subquals, split /,/, $term; + } + for my $new (@subquals_new) { + my ($sq_new, $sqval_new) = split /=/, $new; + my $replaced_old = 0; + for my $old (@subquals) { + my ($sq, $sqval) = split /=/, $old; + if ($sq_new eq $sq) { + $old = $sq_new; + $old .= '=' . $sqval_new if defined($sqval_new) and length($sqval_new); + $replaced_old = 1; + last; + } + } + push @subquals, $new unless $replaced_old; + } + + if (@subquals) { + $flags =~ s:/${qual_type}\S{0,4}=[^/]+::ig; + # add quotes if requested but not for unexpanded macros + map { $_ = qq/"$_"/ if $_ !~ m/^\$\(/ } @subquals if $quote_subquals; + $flags .= "/${qual_type}$type_suffix=(" . join(',',@subquals) . ')'; + } + + return $flags; +} + + +sub xs_dlsyms_ext { + '.opt'; +} + +=item dlsyms (override) + +Create VMS linker options files specifying universal symbols for this +extension's shareable image(s), and listing other shareable images or +libraries to which it should be linked. + +=cut + +sub dlsyms { + my ($self, %attribs) = @_; + return '' unless $self->needs_linking; + $self->xs_dlsyms_iterator; +} + +sub xs_make_dlsyms { + my ($self, $attribs, $target, $dep, $name, $dlbase, $funcs, $funclist, $imports, $vars, $extra) = @_; + my @m; + my $instloc; + if ($self->{XSMULTI}) { + my ($v, $d, $f) = File::Spec->splitpath($target); + my @d = File::Spec->splitdir($d); + shift @d if $d[0] eq 'lib'; + $instloc = $self->catfile('$(INST_ARCHLIB)', 'auto', @d, $f); + push @m,"\ndynamic :: $instloc\n\t\$(NOECHO) \$(NOOP)\n" + unless $self->{SKIPHASH}{'dynamic'}; + push @m,"\nstatic :: $instloc\n\t\$(NOECHO) \$(NOOP)\n" + unless $self->{SKIPHASH}{'static'}; + push @m, "\n", sprintf <<'EOF', $instloc, $target; +%s : %s + $(CP) $(MMS$SOURCE) $(MMS$TARGET) +EOF + } + else { + push @m,"\ndynamic :: \$(INST_ARCHAUTODIR)$self->{BASEEXT}.opt\n\t\$(NOECHO) \$(NOOP)\n" + unless $self->{SKIPHASH}{'dynamic'}; + push @m,"\nstatic :: \$(INST_ARCHAUTODIR)$self->{BASEEXT}.opt\n\t\$(NOECHO) \$(NOOP)\n" + unless $self->{SKIPHASH}{'static'}; + push @m, "\n", sprintf <<'EOF', $target; +$(INST_ARCHAUTODIR)$(BASEEXT).opt : %s + $(CP) $(MMS$SOURCE) $(MMS$TARGET) +EOF + } + push @m, + "\n$target : $dep\n\t", + q!$(PERLRUN) -MExtUtils::Mksymlists -e "Mksymlists('NAME'=>'!, $name, + q!', 'DLBASE' => '!,$dlbase, + q!', 'DL_FUNCS' => !,neatvalue($funcs), + q!, 'FUNCLIST' => !,neatvalue($funclist), + q!, 'IMPORTS' => !,neatvalue($imports), + q!, 'DL_VARS' => !, neatvalue($vars); + push @m, $extra if defined $extra; + push @m, qq!);"\n\t!; + # Can't use dlbase as it's been through mod2fname. + my $olb_base = basename($target, '.opt'); + if ($self->{XSMULTI}) { + # We've been passed everything but the kitchen sink -- and the location of the + # static library we're using to build the dynamic library -- so concoct that + # location from what we do have. + my $olb_dir = $self->catdir(dirname($instloc), $olb_base); + push @m, qq!\$(PERL) -e "print ""${olb_dir}${olb_base}\$(LIB_EXT)/Include=!; + push @m, ($Config{d_vms_case_sensitive_symbols} ? uc($olb_base) : $olb_base); + push @m, '\n' . $olb_dir . $olb_base . '$(LIB_EXT)/Library\n"";" >>$(MMS$TARGET)',"\n"; + } + else { + push @m, qq!\$(PERL) -e "print ""\$(INST_ARCHAUTODIR)${olb_base}\$(LIB_EXT)/Include=!; + if ($self->{OBJECT} =~ /\bBASEEXT\b/ or + $self->{OBJECT} =~ /\b$self->{BASEEXT}\b/i) { + push @m, ($Config{d_vms_case_sensitive_symbols} + ? uc($self->{BASEEXT}) :'$(BASEEXT)'); + } + else { # We don't have a "main" object file, so pull 'em all in + # Upcase module names if linker is being case-sensitive + my($upcase) = $Config{d_vms_case_sensitive_symbols}; + my(@omods) = split ' ', $self->eliminate_macros($self->{OBJECT}); + for (@omods) { + s/\.[^.]*$//; # Trim off file type + s[\$\(\w+_EXT\)][]; # even as a macro + s/.*[:>\/\]]//; # Trim off dir spec + $_ = uc if $upcase; + }; + my(@lines); + my $tmp = shift @omods; + foreach my $elt (@omods) { + $tmp .= ",$elt"; + if (length($tmp) > 80) { push @lines, $tmp; $tmp = ''; } + } + push @lines, $tmp; + push @m, '(', join( qq[, -\\n\\t"";" >>\$(MMS\$TARGET)\n\t\$(PERL) -e "print ""], @lines),')'; + } + push @m, '\n$(INST_ARCHAUTODIR)' . $olb_base . '$(LIB_EXT)/Library\n"";" >>$(MMS$TARGET)',"\n"; + } + if (length $self->{LDLOADLIBS}) { + my($line) = ''; + foreach my $lib (split ' ', $self->{LDLOADLIBS}) { + $lib =~ s%\$%\\\$%g; # Escape '$' in VMS filespecs + if (length($line) + length($lib) > 160) { + push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n"; + $line = $lib . '\n'; + } + else { $line .= $lib . '\n'; } + } + push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n" if $line; + } + join '', @m; +} + + +=item xs_obj_opt + +Override to fixup -o flags. + +=cut + +sub xs_obj_opt { + my ($self, $output_file) = @_; + "/OBJECT=$output_file"; +} + +=item dynamic_lib (override) + +Use VMS Link command. + +=cut + +sub xs_dynamic_lib_macros { + my ($self, $attribs) = @_; + my $otherldflags = $attribs->{OTHERLDFLAGS} || ""; + my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; + sprintf <<'EOF', $otherldflags, $inst_dynamic_dep; +# This section creates the dynamically loadable objects from relevant +# objects and possibly $(MYEXTLIB). +OTHERLDFLAGS = %s +INST_DYNAMIC_DEP = %s +EOF +} + +sub xs_make_dynamic_lib { + my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_; + my $shr = $Config{'dbgprefix'} . 'PerlShr'; + $exportlist =~ s/.def$/.opt/; # it's a linker options file + # 1 2 3 4 5 + _sprintf562 <<'EOF', $to, $todir, $exportlist, $shr, "$shr Sys\$Share:$shr.$Config{'dlext'}"; +%1$s : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt %2$s$(DFSEP).exists %3$s $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) + If F$TrnLNm("%4$s").eqs."" Then Define/NoLog/User %5$s + Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) %3$s/Option,$(PERL_INC)perlshr_attr.opt/Option +EOF +} + +=item xs_make_static_lib (override) + +Use VMS commands to manipulate object library. + +=cut + +sub xs_make_static_lib { + my ($self, $object, $to, $todir) = @_; + + my @objects; + if ($self->{XSMULTI}) { + # The extension name should be the main object file name minus file type. + my $lib = $object; + $lib =~ s/\$\(OBJ_EXT\)\z//; + my $override = $self->_xsbuild_value('xs', $lib, 'OBJECT'); + $object = $override if defined $override; + @objects = map { $self->fixpath($_,0) } split /(?<!\^)\s+/, $object; + } + else { + push @objects, $object; + } + + my @m; + for my $obj (@objects) { + push(@m, sprintf "\n%s : %s\$(DFSEP).exists", $obj, $todir); + } + push(@m, sprintf "\n\n%s : %s \$(MYEXTLIB)\n", $to, (join ' ', @objects)); + + # If this extension has its own library (eg SDBM_File) + # then copy that to $(INST_STATIC) and add $(OBJECT) into it. + push(@m, "\t",'$(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB}; + + push(@m,"\t",'If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)',"\n"); + + # if there was a library to copy, then we can't use MMS$SOURCE_LIST, + # 'cause it's a library and you can't stick them in other libraries. + # In that case, we use $OBJECT instead and hope for the best + if ($self->{MYEXTLIB}) { + for my $obj (@objects) { + push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) ' . $obj,"\n"); + } + } + else { + push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)',"\n"); + } + + push @m, "\t\$(NOECHO) \$(PERL) -e 1 >\$(INST_ARCHAUTODIR)extralibs.ld\n"; + foreach my $lib (split ' ', $self->{EXTRALIBS}) { + push(@m,"\t",'$(NOECHO) $(PERL) -e "print qq{',$lib,'\n}" >>$(INST_ARCHAUTODIR)extralibs.ld',"\n"); + } + join('',@m); +} + + +=item static_lib_pure_cmd (override) + +Use VMS commands to manipulate object library. + +=cut + +sub static_lib_pure_cmd { + my ($self, $from) = @_; + + sprintf <<'MAKE_FRAG', $from; + If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET) + Library/Object/Replace $(MMS$TARGET) %s +MAKE_FRAG +} + +=item xs_static_lib_is_xs + +=cut + +sub xs_static_lib_is_xs { + return 1; +} + +=item extra_clean_files + +Clean up some OS specific files. Plus the temp file used to shorten +a lot of commands. And the name mangler database. + +=cut + +sub extra_clean_files { + return qw( + *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *.Opt $(BASEEXT).bso + .MM_Tmp cxx_repository + ); +} + + +=item zipfile_target + +=item tarfile_target + +=item shdist_target + +Syntax for invoking shar, tar and zip differs from that for Unix. + +=cut + +sub zipfile_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +$(DISTVNAME).zip : distdir + $(PREOP) + $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) [.$(DISTVNAME)...]*.*; + $(RM_RF) $(DISTVNAME) + $(POSTOP) +MAKE_FRAG +} + +sub tarfile_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +$(DISTVNAME).tar$(SUFFIX) : distdir + $(PREOP) + $(TO_UNIX) + $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar [.$(DISTVNAME)...] + $(RM_RF) $(DISTVNAME) + $(COMPRESS) $(DISTVNAME).tar + $(POSTOP) +MAKE_FRAG +} + +sub shdist_target { + my($self) = shift; + + return <<'MAKE_FRAG'; +shdist : distdir + $(PREOP) + $(SHAR) [.$(DISTVNAME)...]*.*; $(DISTVNAME).share + $(RM_RF) $(DISTVNAME) + $(POSTOP) +MAKE_FRAG +} + + +# --- Test and Installation Sections --- + +=item install (override) + +Work around DCL's 255 character limit several times,and use +VMS-style command line quoting in a few cases. + +=cut + +sub install { + my($self, %attribs) = @_; + my(@m); + + push @m, q[ +install :: all pure_install doc_install + $(NOECHO) $(NOOP) + +install_perl :: all pure_perl_install doc_perl_install + $(NOECHO) $(NOOP) + +install_site :: all pure_site_install doc_site_install + $(NOECHO) $(NOOP) + +install_vendor :: all pure_vendor_install doc_vendor_install + $(NOECHO) $(NOOP) + +pure_install :: pure_$(INSTALLDIRS)_install + $(NOECHO) $(NOOP) + +doc_install :: doc_$(INSTALLDIRS)_install + $(NOECHO) $(NOOP) + +pure__install : pure_site_install + $(NOECHO) $(ECHO) "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site" + +doc__install : doc_site_install + $(NOECHO) $(ECHO) "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site" + +# This hack brought to you by DCL's 255-character command line limit +pure_perl_install :: +]; + push @m, +q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp + $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp +] unless $self->{NO_PACKLIST}; + + push @m, +q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLPRIVLIB)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLARCHLIB)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLBIN)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) " >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLMAN3DIR)" >>.MM_tmp + $(NOECHO) $(MOD_INSTALL) <.MM_tmp + $(NOECHO) $(RM_F) .MM_tmp + $(NOECHO) $(WARN_IF_OLD_PACKLIST) "].$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[" + +# Likewise +pure_site_install :: +]; + push @m, +q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp + $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp +] unless $self->{NO_PACKLIST}; + + push @m, +q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLSITELIB)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLSITEARCH)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLSITEBIN)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR)|$(DESTINSTALLSITEMAN1DIR)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLSITEMAN3DIR)" >>.MM_tmp + $(NOECHO) $(MOD_INSTALL) <.MM_tmp + $(NOECHO) $(RM_F) .MM_tmp + $(NOECHO) $(WARN_IF_OLD_PACKLIST) "].$self->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[" + +pure_vendor_install :: +]; + push @m, +q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp + $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp +] unless $self->{NO_PACKLIST}; + + push @m, +q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLVENDORLIB)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLVENDORARCH)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLVENDORBIN)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR)|$(DESTINSTALLVENDORMAN1DIR)|" >>.MM_tmp + $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLVENDORMAN3DIR)" >>.MM_tmp + $(NOECHO) $(MOD_INSTALL) <.MM_tmp + $(NOECHO) $(RM_F) .MM_tmp + +]; + + push @m, q[ +# Ditto +doc_perl_install :: + $(NOECHO) $(NOOP) + +# And again +doc_site_install :: + $(NOECHO) $(NOOP) + +doc_vendor_install :: + $(NOECHO) $(NOOP) + +] if $self->{NO_PERLLOCAL}; + + push @m, q[ +# Ditto +doc_perl_install :: + $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" + $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) + $(NOECHO) $(ECHO_N) "installed into|$(INSTALLPRIVLIB)|" >.MM_tmp + $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp + $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ + $(NOECHO) $(RM_F) .MM_tmp + +# And again +doc_site_install :: + $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" + $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) + $(NOECHO) $(ECHO_N) "installed into|$(INSTALLSITELIB)|" >.MM_tmp + $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp + $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ + $(NOECHO) $(RM_F) .MM_tmp + +doc_vendor_install :: + $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" + $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) + $(NOECHO) $(ECHO_N) "installed into|$(INSTALLVENDORLIB)|" >.MM_tmp + $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp + $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ + $(NOECHO) $(RM_F) .MM_tmp + +] unless $self->{NO_PERLLOCAL}; + + push @m, q[ +uninstall :: uninstall_from_$(INSTALLDIRS)dirs + $(NOECHO) $(NOOP) + +uninstall_from_perldirs :: + $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[ + +uninstall_from_sitedirs :: + $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[ + +uninstall_from_vendordirs :: + $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{VENDORARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[ +]; + + join('',@m); +} + +=item perldepend (override) + +Use VMS-style syntax for files; it's cheaper to just do it directly here +than to have the L<MM_Unix|ExtUtils::MM_Unix> method call C<catfile> +repeatedly. Also, if we have to rebuild Config.pm, use MM[SK] to do it. + +=cut + +sub perldepend { + my($self) = @_; + my(@m); + + if ($self->{OBJECT}) { + # Need to add an object file dependency on the perl headers. + # this is very important for XS modules in perl.git development. + + push @m, $self->_perl_header_files_fragment(""); # empty separator on VMS as its in the $(PERL_INC) + } + + if ($self->{PERL_SRC}) { + my(@macros); + my($mmsquals) = '$(USEMAKEFILE)[.vms]$(FIRST_MAKEFILE)'; + push(@macros,'__AXP__=1') if $Config{'archname'} eq 'VMS_AXP'; + push(@macros,'DECC=1') if $Config{'vms_cc_type'} eq 'decc'; + push(@macros,'GNUC=1') if $Config{'vms_cc_type'} eq 'gcc'; + push(@macros,'SOCKET=1') if $Config{'d_has_sockets'}; + push(@macros,qq["CC=$Config{'cc'}"]) if $Config{'cc'} =~ m!/!; + $mmsquals .= '$(USEMACROS)' . join(',',@macros) . '$(MACROEND)' if @macros; + push(@m,q[ +# Check for unpropagated config.sh changes. Should never happen. +# We do NOT just update config.h because that is not sufficient. +# An out of date config.h is not fatal but complains loudly! +$(PERL_INC)config.h : $(PERL_SRC)config.sh + $(NOOP) + +$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh + $(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.h or genconfig.pl" + olddef = F$Environment("Default") + Set Default $(PERL_SRC) + $(MMS)],$mmsquals,); + if ($self->{PERL_ARCHLIB} =~ m|\[-| && $self->{PERL_SRC} =~ m|(\[-+)|) { + my($prefix,$target) = ($1,$self->fixpath('$(PERL_ARCHLIB)Config.pm',0)); + $target =~ s/\Q$prefix/[/; + push(@m," $target"); + } + else { push(@m,' $(MMS$TARGET)'); } + push(@m,q[ + Set Default 'olddef' +]); + } + + push(@m, join(" ", map($self->fixpath($_,0),sort values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n") + if %{$self->{XS}}; + + join('',@m); +} + + +=item makeaperl (override) + +Undertake to build a new set of Perl images using VMS commands. Since +VMS does dynamic loading, it's not necessary to statically link each +extension into the Perl image, so this isn't the normal build path. +Consequently, it hasn't really been tested, and may well be incomplete. + +=cut + +our %olbs; # needs to be localized + +sub makeaperl { + my($self, %attribs) = @_; + my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmpdir, $libperl) = + @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; + my(@m); + push @m, " +# --- MakeMaker makeaperl section --- +MAP_TARGET = $target +"; + return join '', @m if $self->{PARENT}; + + my($dir) = join ":", @{$self->{DIR}}; + + unless ($self->{MAKEAPERL}) { + push @m, q{ +$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) + $(NOECHO) $(ECHO) "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)" + $(NOECHO) $(PERLRUNINST) \ + Makefile.PL DIR=}, $dir, q{ \ + FIRST_MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ + MAKEAPERL=1 NORECURS=1 }; + + push @m, map(q[ \\\n\t\t"$_"], @ARGV),q{ + +$(MAP_TARGET) :: $(MAKE_APERL_FILE) + $(MAKE)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET) +}; + push @m, "\n"; + + return join '', @m; + } + + + my($linkcmd,@optlibs,@staticpkgs,$extralist,$targdir,$libperldir,%libseen); + local($_); + + # The front matter of the linkcommand... + $linkcmd = join ' ', $Config{'ld'}, + grep($_, @Config{qw(large split ldflags ccdlflags)}); + $linkcmd =~ s/\s+/ /g; + + # Which *.olb files could we make use of... + local(%olbs); # XXX can this be lexical? + $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)"; + require File::Find; + File::Find::find(sub { + return unless m/\Q$self->{LIB_EXT}\E$/; + return if m/^libperl/; + + if( exists $self->{INCLUDE_EXT} ){ + my $found = 0; + + (my $xx = $File::Find::name) =~ s,.*?/auto/,,; + $xx =~ s,/?$_,,; + $xx =~ s,/,::,g; + + # Throw away anything not explicitly marked for inclusion. + # DynaLoader is implied. + foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ + if( $xx eq $incl ){ + $found++; + last; + } + } + return unless $found; + } + elsif( exists $self->{EXCLUDE_EXT} ){ + (my $xx = $File::Find::name) =~ s,.*?/auto/,,; + $xx =~ s,/?$_,,; + $xx =~ s,/,::,g; + + # Throw away anything explicitly marked for exclusion + foreach my $excl (@{$self->{EXCLUDE_EXT}}){ + return if( $xx eq $excl ); + } + } + + $olbs{$ENV{DEFAULT}} = $_; + }, grep( -d $_, @{$searchdirs || []})); + + # We trust that what has been handed in as argument will be buildable + $static = [] unless $static; + @olbs{@{$static}} = (1) x @{$static}; + + $extra = [] unless $extra && ref $extra eq 'ARRAY'; + # Sort the object libraries in inverse order of + # filespec length to try to insure that dependent extensions + # will appear before their parents, so the linker will + # search the parent library to resolve references. + # (e.g. Intuit::DWIM will precede Intuit, so unresolved + # references from [.intuit.dwim]dwim.obj can be found + # in [.intuit]intuit.olb). + for (sort { length($a) <=> length($b) || $a cmp $b } keys %olbs) { + next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/; + my($dir) = $self->fixpath($_,1); + my($extralibs) = $dir . "extralibs.ld"; + my($extopt) = $dir . $olbs{$_}; + $extopt =~ s/$self->{LIB_EXT}$/.opt/; + push @optlibs, "$dir$olbs{$_}"; + # Get external libraries this extension will need + if (-f $extralibs ) { + my %seenthis; + open my $list, "<", $extralibs or warn $!,next; + while (<$list>) { + chomp; + # Include a library in the link only once, unless it's mentioned + # multiple times within a single extension's options file, in which + # case we assume the builder needed to search it again later in the + # link. + my $skip = exists($libseen{$_}) && !exists($seenthis{$_}); + $libseen{$_}++; $seenthis{$_}++; + next if $skip; + push @$extra,$_; + } + } + # Get full name of extension for ExtUtils::Miniperl + if (-f $extopt) { + open my $opt, '<', $extopt or die $!; + while (<$opt>) { + next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/; + my $pkg = $1; + $pkg =~ s#__*#::#g; + push @staticpkgs,$pkg; + } + } + } + # Place all of the external libraries after all of the Perl extension + # libraries in the final link, in order to maximize the opportunity + # for XS code from multiple extensions to resolve symbols against the + # same external library while only including that library once. + push @optlibs, @$extra; + + $target = "Perl$Config{'exe_ext'}" unless $target; + my $shrtarget; + ($shrtarget,$targdir) = fileparse($target); + $shrtarget =~ s/^([^.]*)/$1Shr/; + $shrtarget = $targdir . $shrtarget; + $target = "Perlshr.$Config{'dlext'}" unless $target; + $tmpdir = "[]" unless $tmpdir; + $tmpdir = $self->fixpath($tmpdir,1); + if (@optlibs) { $extralist = join(' ',@optlibs); } + else { $extralist = ''; } + # Let ExtUtils::Liblist find the necessary libs for us (but skip PerlShr) + # that's what we're building here). + push @optlibs, grep { !/PerlShr/i } split ' ', +($self->ext())[2]; + if ($libperl) { + unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) { + print "Warning: $libperl not found\n"; + undef $libperl; + } + } + unless ($libperl) { + if (defined $self->{PERL_SRC}) { + $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}"); + } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) { + } else { + print "Warning: $libperl not found + If you're going to build a static perl binary, make sure perl is installed + otherwise ignore this warning\n"; + } + } + $libperldir = $self->fixpath((fileparse($libperl))[1],1); + + push @m, ' +# Fill in the target you want to produce if it\'s not perl +MAP_TARGET = ',$self->fixpath($target,0),' +MAP_SHRTARGET = ',$self->fixpath($shrtarget,0)," +MAP_LINKCMD = $linkcmd +MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : ''," +MAP_EXTRA = $extralist +MAP_LIBPERL = ",$self->fixpath($libperl,0),' +'; + + + push @m,"\n${tmpdir}Makeaperl.Opt : \$(MAP_EXTRA)\n"; + foreach (@optlibs) { + push @m,' $(NOECHO) $(PERL) -e "print q{',$_,'}" >>$(MMS$TARGET)',"\n"; + } + push @m,"\n${tmpdir}PerlShr.Opt :\n\t"; + push @m,'$(NOECHO) $(PERL) -e "print q{$(MAP_SHRTARGET)}" >$(MMS$TARGET)',"\n"; + + push @m,' +$(MAP_SHRTARGET) : $(MAP_LIBPERL) Makeaperl.Opt ',"${libperldir}Perlshr_Attr.Opt",' + $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_LIBPERL), Makeaperl.Opt/Option ',"${libperldir}Perlshr_Attr.Opt/Option",' +$(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmpdir}perlmain\$(OBJ_EXT) ${tmpdir}PerlShr.Opt",' + $(MAP_LINKCMD) ',"${tmpdir}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option + $(NOECHO) $(ECHO) "To install the new ""$(MAP_TARGET)"" binary, say" + $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)" + $(NOECHO) $(ECHO) "To remove the intermediate files, say + $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) map_clean" +'; + push @m,"\n${tmpdir}perlmain.c : \$(FIRST_MAKEFILE)\n\t\$(NOECHO) \$(PERL) -e 1 >${tmpdir}Writemain.tmp\n"; + push @m, "# More from the 255-char line length limit\n"; + foreach (@staticpkgs) { + push @m,' $(NOECHO) $(PERL) -e "print q{',$_,qq[}" >>${tmpdir}Writemain.tmp\n]; + } + + push @m, sprintf <<'MAKE_FRAG', $tmpdir, $tmpdir; + $(NOECHO) $(PERL) $(MAP_PERLINC) -ane "use ExtUtils::Miniperl; writemain(@F)" %sWritemain.tmp >$(MMS$TARGET) + $(NOECHO) $(RM_F) %sWritemain.tmp +MAKE_FRAG + + push @m, q[ +# Still more from the 255-char line length limit +doc_inst_perl : + $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) + $(NOECHO) $(ECHO) "Perl binary $(MAP_TARGET)|" >.MM_tmp + $(NOECHO) $(ECHO) "MAP_STATIC|$(MAP_STATIC)|" >>.MM_tmp + $(NOECHO) $(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp + $(NOECHO) $(ECHO) -e "MAP_LIBPERL|$(MAP_LIBPERL)|" >>.MM_tmp + $(NOECHO) $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q[ + $(NOECHO) $(RM_F) .MM_tmp +]; + + push @m, " +inst_perl : pure_inst_perl doc_inst_perl + \$(NOECHO) \$(NOOP) + +pure_inst_perl : \$(MAP_TARGET) + $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1)," + $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1)," + +clean :: map_clean + \$(NOECHO) \$(NOOP) + +map_clean : + \$(RM_F) ${tmpdir}perlmain\$(OBJ_EXT) ${tmpdir}perlmain.c \$(FIRST_MAKEFILE) + \$(RM_F) ${tmpdir}Makeaperl.Opt ${tmpdir}PerlShr.Opt \$(MAP_TARGET) +"; + + join '', @m; +} + + +# --- Output postprocessing section --- + +=item maketext_filter (override) + +Ensure that colons marking targets are preceded by space, in order +to distinguish the target delimiter from a colon appearing as +part of a filespec. + +=cut + +sub maketext_filter { + my($self, $text) = @_; + + $text =~ s/^([^\s:=]+)(:+\s)/$1 $2/mg; + return $text; +} + +=item prefixify (override) + +prefixifying on VMS is simple. Each should simply be: + + perl_root:[some.dir] + +which can just be converted to: + + volume:[your.prefix.some.dir] + +otherwise you get the default layout. + +In effect, your search prefix is ignored and $Config{vms_prefix} is +used instead. + +=cut + +sub prefixify { + my($self, $var, $sprefix, $rprefix, $default) = @_; + + # Translate $(PERLPREFIX) to a real path. + $rprefix = $self->eliminate_macros($rprefix); + $rprefix = vmspath($rprefix) if $rprefix; + $sprefix = vmspath($sprefix) if $sprefix; + + $default = vmsify($default) + unless $default =~ /\[.*\]/; + + (my $var_no_install = $var) =~ s/^install//; + my $path = $self->{uc $var} || + $ExtUtils::MM_Unix::Config_Override{lc $var} || + $Config{lc $var} || $Config{lc $var_no_install}; + + if( !$path ) { + warn " no Config found for $var.\n" if $Verbose >= 2; + $path = $self->_prefixify_default($rprefix, $default); + } + elsif( !$self->{ARGS}{PREFIX} || !$self->file_name_is_absolute($path) ) { + # do nothing if there's no prefix or if its relative + } + elsif( $sprefix eq $rprefix ) { + warn " no new prefix.\n" if $Verbose >= 2; + } + else { + + warn " prefixify $var => $path\n" if $Verbose >= 2; + warn " from $sprefix to $rprefix\n" if $Verbose >= 2; + + my($path_vol, $path_dirs) = $self->splitpath( $path ); + if( $path_vol eq $Config{vms_prefix}.':' ) { + warn " $Config{vms_prefix}: seen\n" if $Verbose >= 2; + + $path_dirs =~ s{^\[}{\[.} unless $path_dirs =~ m{^\[\.}; + $path = $self->_catprefix($rprefix, $path_dirs); + } + else { + $path = $self->_prefixify_default($rprefix, $default); + } + } + + print " now $path\n" if $Verbose >= 2; + return $self->{uc $var} = $path; +} + + +sub _prefixify_default { + my($self, $rprefix, $default) = @_; + + warn " cannot prefix, using default.\n" if $Verbose >= 2; + + if( !$default ) { + warn "No default!\n" if $Verbose >= 1; + return; + } + if( !$rprefix ) { + warn "No replacement prefix!\n" if $Verbose >= 1; + return ''; + } + + return $self->_catprefix($rprefix, $default); +} + +sub _catprefix { + my($self, $rprefix, $default) = @_; + + my($rvol, $rdirs) = $self->splitpath($rprefix); + if( $rvol ) { + return $self->catpath($rvol, + $self->catdir($rdirs, $default), + '' + ) + } + else { + return $self->catdir($rdirs, $default); + } +} + + +=item cd + +=cut + +sub cd { + my($self, $dir, @cmds) = @_; + + $dir = vmspath($dir); + + my $cmd = join "\n\t", map "$_", @cmds; + + # No leading tab makes it look right when embedded + my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd; +startdir = F$Environment("Default") + Set Default %s + %s + Set Default 'startdir' +MAKE_FRAG + + # No trailing newline makes this easier to embed + chomp $make_frag; + + return $make_frag; +} + + +=item oneliner + +=cut + +sub oneliner { + my($self, $cmd, $switches) = @_; + $switches = [] unless defined $switches; + + # Strip leading and trailing newlines + $cmd =~ s{^\n+}{}; + $cmd =~ s{\n+$}{}; + + my @cmds = split /\n/, $cmd; + $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds; + $cmd = $self->escape_newlines($cmd); + + # Switches must be quoted else they will be lowercased. + $switches = join ' ', map { qq{"$_"} } @$switches; + + return qq{\$(ABSPERLRUN) $switches -e $cmd "--"}; +} + + +=item B<echo> + +perl trips up on "<foo>" thinking it's an input redirect. So we use the +native Write command instead. Besides, it's faster. + +=cut + +sub echo { + my($self, $text, $file, $opts) = @_; + + # Compatibility with old options + if( !ref $opts ) { + my $append = $opts; + $opts = { append => $append || 0 }; + } + my $opencmd = $opts->{append} ? 'Open/Append' : 'Open/Write'; + + $opts->{allow_variables} = 0 unless defined $opts->{allow_variables}; + + my $ql_opts = { allow_variables => $opts->{allow_variables} }; + + my @cmds = ("\$(NOECHO) $opencmd MMECHOFILE $file "); + push @cmds, map { '$(NOECHO) Write MMECHOFILE '.$self->quote_literal($_, $ql_opts) } + split /\n/, $text; + push @cmds, '$(NOECHO) Close MMECHOFILE'; + return @cmds; +} + + +=item quote_literal + +=cut + +sub quote_literal { + my($self, $text, $opts) = @_; + $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; + + # I believe this is all we should need. + $text =~ s{"}{""}g; + + $text = $opts->{allow_variables} + ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); + + return qq{"$text"}; +} + +=item escape_dollarsigns + +Quote, don't escape. + +=cut + +sub escape_dollarsigns { + my($self, $text) = @_; + + # Quote dollar signs which are not starting a variable + $text =~ s{\$ (?!\() }{"\$"}gx; + + return $text; +} + + +=item escape_all_dollarsigns + +Quote, don't escape. + +=cut + +sub escape_all_dollarsigns { + my($self, $text) = @_; + + # Quote dollar signs + $text =~ s{\$}{"\$\"}gx; + + return $text; +} + +=item escape_newlines + +=cut + +sub escape_newlines { + my($self, $text) = @_; + + $text =~ s{\n}{-\n}g; + + return $text; +} + +=item max_exec_len + +256 characters. + +=cut + +sub max_exec_len { + my $self = shift; + + return $self->{_MAX_EXEC_LEN} ||= 256; +} + +=item init_linker + +=cut + +sub init_linker { + my $self = shift; + $self->{EXPORT_LIST} ||= '$(BASEEXT).opt'; + + my $shr = $Config{dbgprefix} . 'PERLSHR'; + if ($self->{PERL_SRC}) { + $self->{PERL_ARCHIVE} ||= + $self->catfile($self->{PERL_SRC}, "$shr.$Config{'dlext'}"); + } + else { + $self->{PERL_ARCHIVE} ||= + $ENV{$shr} ? $ENV{$shr} : "Sys\$Share:$shr.$Config{'dlext'}"; + } + + $self->{PERL_ARCHIVEDEP} ||= ''; + $self->{PERL_ARCHIVE_AFTER} ||= ''; +} + + +=item catdir (override) + +=item catfile (override) + +Eliminate the macros in the output to the MMS/MMK file. + +(L<File::Spec::VMS> used to do this for us, but it's being removed) + +=cut + +sub catdir { + my $self = shift; + + # Process the macros on VMS MMS/MMK + my @args = map { m{\$\(} ? $self->eliminate_macros($_) : $_ } @_; + + my $dir = $self->SUPER::catdir(@args); + + # Fix up the directory and force it to VMS format. + $dir = $self->fixpath($dir, 1); + + return $dir; +} + +sub catfile { + my $self = shift; + + # Process the macros on VMS MMS/MMK + my @args = map { m{\$\(} ? $self->eliminate_macros($_) : $_ } @_; + + my $file = $self->SUPER::catfile(@args); + + $file = vmsify($file); + + return $file +} + + +=item eliminate_macros + +Expands MM[KS]/Make macros in a text string, using the contents of +identically named elements of C<%$self>, and returns the result +as a file specification in Unix syntax. + +NOTE: This is the canonical version of the method. The version in +L<File::Spec::VMS> is deprecated. + +=cut + +sub eliminate_macros { + my($self,$path) = @_; + return '' unless $path; + $self = {} unless ref $self; + + my($npath) = unixify($path); + # sometimes unixify will return a string with an off-by-one trailing null + $npath =~ s{\0$}{}; + + my($complex) = 0; + my($head,$macro,$tail); + + # perform m##g in scalar context so it acts as an iterator + while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#gs) { + if (defined $self->{$2}) { + ($head,$macro,$tail) = ($1,$2,$3); + if (ref $self->{$macro}) { + if (ref $self->{$macro} eq 'ARRAY') { + $macro = join ' ', @{$self->{$macro}}; + } + else { + print "Note: can't expand macro \$($macro) containing ",ref($self->{$macro}), + "\n\t(using MMK-specific deferred substitutuon; MMS will break)\n"; + $macro = "\cB$macro\cB"; + $complex = 1; + } + } + else { + $macro = $self->{$macro}; + # Don't unixify if there is unescaped whitespace + $macro = unixify($macro) unless ($macro =~ /(?<!\^)\s/); + $macro =~ s#/\Z(?!\n)##; + } + $npath = "$head$macro$tail"; + } + } + if ($complex) { $npath =~ s#\cB(.*?)\cB#\${$1}#gs; } + $npath; +} + +=item fixpath + + my $path = $mm->fixpath($path); + my $path = $mm->fixpath($path, $is_dir); + +Catchall routine to clean up problem MM[SK]/Make macros. Expands macros +in any directory specification, in order to avoid juxtaposing two +VMS-syntax directories when MM[SK] is run. Also expands expressions which +are all macro, so that we can tell how long the expansion is, and avoid +overrunning DCL's command buffer when MM[KS] is running. + +fixpath() checks to see whether the result matches the name of a +directory in the current default directory and returns a directory or +file specification accordingly. C<$is_dir> can be set to true to +force fixpath() to consider the path to be a directory or false to force +it to be a file. + +NOTE: This is the canonical version of the method. The version in +L<File::Spec::VMS> is deprecated. + +=cut + +sub fixpath { + my($self,$path,$force_path) = @_; + return '' unless $path; + $self = bless {}, $self unless ref $self; + my($fixedpath,$prefix,$name); + + if ($path =~ m#^\$\([^\)]+\)\Z(?!\n)#s || $path =~ m#[/:>\]]#) { + if ($force_path or $path =~ /(?:DIR\)|\])\Z(?!\n)/) { + $fixedpath = vmspath($self->eliminate_macros($path)); + } + else { + $fixedpath = vmsify($self->eliminate_macros($path)); + } + } + elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#s)) && $self->{$prefix}) { + my($vmspre) = $self->eliminate_macros("\$($prefix)"); + # is it a dir or just a name? + $vmspre = ($vmspre =~ m|/| or $prefix =~ /DIR\Z(?!\n)/) ? vmspath($vmspre) : ''; + $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name; + $fixedpath = vmspath($fixedpath) if $force_path; + } + else { + $fixedpath = $path; + $fixedpath = vmspath($fixedpath) if $force_path; + } + # No hints, so we try to guess + if (!defined($force_path) and $fixedpath !~ /[:>(.\]]/) { + $fixedpath = vmspath($fixedpath) if -d $fixedpath; + } + + # Trim off root dirname if it's had other dirs inserted in front of it. + $fixedpath =~ s/\.000000([\]>])/$1/; + # Special case for VMS absolute directory specs: these will have had device + # prepended during trip through Unix syntax in eliminate_macros(), since + # Unix syntax has no way to express "absolute from the top of this device's + # directory tree". + if ($path =~ /^[\[>][^.\-]/) { $fixedpath =~ s/^[^\[<]+//; } + + return $fixedpath; +} + + +=item os_flavor + +VMS is VMS. + +=cut + +sub os_flavor { + return('VMS'); +} + + +=item is_make_type (override) + +None of the make types being checked for is viable on VMS, +plus our $self->{MAKE} is an unexpanded (and unexpandable) +macro whose value is known only to the make utility itself. + +=cut + +sub is_make_type { + my($self, $type) = @_; + return 0; +} + + +=item make_type (override) + +Returns a suitable string describing the type of makefile being written. + +=cut + +sub make_type { "$Config{make}-style"; } + + +=back + + +=head1 AUTHOR + +Original author Charles Bailey F<bailey@newman.upenn.edu> + +Maintained by Michael G Schwern F<schwern@pobox.com> + +See L<ExtUtils::MakeMaker> for patching and contact information. + + +=cut + +1; + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VOS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VOS.pm new file mode 100644 index 0000000000000000000000000000000000000000..dea49e1a566c4478b67cfcfbfa009fafb6d6dc0e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_VOS.pm @@ -0,0 +1,51 @@ +package ExtUtils::MM_VOS; + +use strict; +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Unix; +our @ISA = qw(ExtUtils::MM_Unix); + + +=head1 NAME + +ExtUtils::MM_VOS - VOS specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Unix> which contains functionality for +VOS. + +Unless otherwise stated it works just like ExtUtils::MM_Unix. + +=head2 Overridden methods + +=head3 extra_clean_files + +Cleanup VOS core files + +=cut + +sub extra_clean_files { + return qw(*.kp); +} + + +=head1 AUTHOR + +Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win32.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win32.pm new file mode 100644 index 0000000000000000000000000000000000000000..3db0f45260f3782f5785c074fb42071a48b0150c --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win32.pm @@ -0,0 +1,656 @@ +package ExtUtils::MM_Win32; + +use strict; + + +=head1 NAME + +ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See L<ExtUtils::MM_Unix> for a documentation of the methods provided +there. This package overrides the implementation of these methods, not +the semantics. + +=cut + +use ExtUtils::MakeMaker::Config; +use File::Basename; +use File::Spec; +use ExtUtils::MakeMaker qw(neatvalue _sprintf562); + +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +$ENV{EMXSHELL} = 'sh'; # to run `commands` + +my ( $BORLAND, $GCC, $MSVC ) = _identify_compiler_environment( \%Config ); + +sub _identify_compiler_environment { + my ( $config ) = @_; + + my $BORLAND = $config->{cc} =~ /\bbcc/i ? 1 : 0; + my $GCC = $config->{cc} =~ /\bgcc\b/i ? 1 : 0; + my $MSVC = $config->{cc} =~ /\b(?:cl|icl)/i ? 1 : 0; # MSVC can come as clarm.exe, icl=Intel C + + return ( $BORLAND, $GCC, $MSVC ); +} + + +=head2 Overridden methods + +=over 4 + +=item B<dlsyms> + +=cut + +sub dlsyms { + my($self,%attribs) = @_; + return '' if $self->{SKIPHASH}{'dynamic'}; + $self->xs_dlsyms_iterator(\%attribs); +} + +=item xs_dlsyms_ext + +On Win32, is C<.def>. + +=cut + +sub xs_dlsyms_ext { + '.def'; +} + +=item replace_manpage_separator + +Changes the path separator with . + +=cut + +sub replace_manpage_separator { + my($self,$man) = @_; + $man =~ s,[/\\]+,.,g; + $man; +} + + +=item B<maybe_command> + +Since Windows has nothing as simple as an executable bit, we check the +file extension. + +The PATHEXT env variable will be used to get a list of extensions that +might indicate a command, otherwise .com, .exe, .bat and .cmd will be +used by default. + +=cut + +sub maybe_command { + my($self,$file) = @_; + my @e = exists($ENV{'PATHEXT'}) + ? split(/;/, $ENV{PATHEXT}) + : qw(.com .exe .bat .cmd); + my $e = ''; + for (@e) { $e .= "\Q$_\E|" } + chop $e; + # see if file ends in one of the known extensions + if ($file =~ /($e)$/i) { + return $file if -e $file; + } + else { + for (@e) { + return "$file$_" if -e "$file$_"; + } + } + return; +} + + +=item B<init_DIRFILESEP> + +Using \ for Windows, except for "gmake" where it is /. + +=cut + +sub init_DIRFILESEP { + my($self) = shift; + + # The ^ makes sure its not interpreted as an escape in nmake + $self->{DIRFILESEP} = $self->is_make_type('nmake') ? '^\\' : + $self->is_make_type('dmake') ? '\\\\' : + $self->is_make_type('gmake') ? '/' + : '\\'; +} + +=item init_tools + +Override some of the slower, portable commands with Windows specific ones. + +=cut + +sub init_tools { + my ($self) = @_; + + $self->{NOOP} ||= 'rem'; + $self->{DEV_NULL} ||= '> NUL'; + + $self->{FIXIN} ||= $self->{PERL_CORE} ? + "\$(PERLRUN) -I$self->{PERL_SRC}\\cpan\\ExtUtils-PL2Bat\\lib $self->{PERL_SRC}\\win32\\bin\\pl2bat.pl" : + 'pl2bat.bat'; + + $self->SUPER::init_tools; + + # Setting SHELL from $Config{sh} can break dmake. Its ok without it. + delete $self->{SHELL}; + + return; +} + + +=item init_others + +Override the default link and compile tools. + +LDLOADLIBS's default is changed to $Config{libs}. + +Adjustments are made for Borland's quirks needing -L to come first. + +=cut + +sub init_others { + my $self = shift; + + $self->{LD} ||= 'link'; + $self->{AR} ||= 'lib'; + + $self->SUPER::init_others; + + $self->{LDLOADLIBS} ||= $Config{libs}; + # -Lfoo must come first for Borland, so we put it in LDDLFLAGS + if ($BORLAND) { + my $libs = $self->{LDLOADLIBS}; + my $libpath = ''; + while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { + $libpath .= ' ' if length $libpath; + $libpath .= $1; + } + $self->{LDLOADLIBS} = $libs; + $self->{LDDLFLAGS} ||= $Config{lddlflags}; + $self->{LDDLFLAGS} .= " $libpath"; + } + + return; +} + + +=item init_platform + +Add MM_Win32_VERSION. + +=item platform_constants + +=cut + +sub init_platform { + my($self) = shift; + + $self->{MM_Win32_VERSION} = $VERSION; + + return; +} + +sub platform_constants { + my($self) = shift; + my $make_frag = ''; + + foreach my $macro (qw(MM_Win32_VERSION)) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } + + return $make_frag; +} + +=item specify_shell + +Set SHELL to $ENV{COMSPEC} only if make is type 'gmake'. + +=cut + +sub specify_shell { + my $self = shift; + return '' unless $self->is_make_type('gmake'); + "\nSHELL = $ENV{COMSPEC}\n"; +} + +=item constants + +Add MAXLINELENGTH for dmake before all the constants are output. + +=cut + +sub constants { + my $self = shift; + + my $make_text = $self->SUPER::constants; + return $make_text unless $self->is_make_type('dmake'); + + # dmake won't read any single "line" (even those with escaped newlines) + # larger than a certain size which can be as small as 8k. PM_TO_BLIB + # on large modules like DateTime::TimeZone can create lines over 32k. + # So we'll crank it up to a <ironic>WHOPPING</ironic> 64k. + # + # This has to come here before all the constants and not in + # platform_constants which is after constants. + my $size = $self->{MAXLINELENGTH} || 800000; + my $prefix = qq{ +# Get dmake to read long commands like PM_TO_BLIB +MAXLINELENGTH = $size + +}; + + return $prefix . $make_text; +} + + +=item special_targets + +Add .USESHELL target for dmake. + +=cut + +sub special_targets { + my($self) = @_; + + my $make_frag = $self->SUPER::special_targets; + + $make_frag .= <<'MAKE_FRAG' if $self->is_make_type('dmake'); +.USESHELL : +MAKE_FRAG + + return $make_frag; +} + +=item static_lib_pure_cmd + +Defines how to run the archive utility + +=cut + +sub static_lib_pure_cmd { + my ($self, $from) = @_; + $from =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND; + sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $from + : ($GCC ? '-ru $@ ' . $from + : '-out:$@ ' . $from)); +} + +=item dynamic_lib + +Methods are overridden here: not dynamic_lib itself, but the utility +ones that do the OS-specific work. + +=cut + +sub xs_make_dynamic_lib { + my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_; + my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(INST_DYNAMIC_DEP)'."\n", $to, $from, $todir, $exportlist; + if ($GCC) { + # per https://rt.cpan.org/Ticket/Display.html?id=78395 no longer + # uses dlltool - relies on post 2002 MinGW + # 1 2 + push @m, _sprintf562 <<'EOF', $exportlist, $ldfrom; + $(LD) %1$s -o $@ $(LDDLFLAGS) %2$s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -Wl,--enable-auto-image-base +EOF + } elsif ($BORLAND) { + my $ldargs = $self->is_make_type('dmake') + ? q{"$(PERL_ARCHIVE:s,/,\,)" $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),} + : q{"$(subst /,\,$(PERL_ARCHIVE))" $(subst /,\,$(LDLOADLIBS)) $(subst /,\,$(MYEXTLIB)),}; + my $subbed; + if ($exportlist eq '$(EXPORT_LIST)') { + $subbed = $self->is_make_type('dmake') + ? q{$(EXPORT_LIST:s,/,\,)} + : q{$(subst /,\,$(EXPORT_LIST))}; + } else { + # in XSMULTI, exportlist is per-XS, so have to sub in perl not make + ($subbed = $exportlist) =~ s#/#\\#g; + } + push @m, sprintf <<'EOF', $ldfrom, $ldargs . $subbed; + $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) %s,$@,,%s,$(RESFILES) +EOF + } else { # VC + push @m, sprintf <<'EOF', $ldfrom, $exportlist; + $(LD) -out:$@ $(LDDLFLAGS) %s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -def:%s +EOF + # Embed the manifest file if it exists + push(@m, q{ if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 + if exist $@.manifest del $@.manifest}); + } + push @m, "\n\t\$(CHMOD) \$(PERM_RWX) \$\@\n"; + + join '', @m; +} + +sub xs_dynamic_lib_macros { + my ($self, $attribs) = @_; + my $otherldflags = $attribs->{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); + my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; + sprintf <<'EOF', $otherldflags, $inst_dynamic_dep; +# This section creates the dynamically loadable objects from relevant +# objects and possibly $(MYEXTLIB). +OTHERLDFLAGS = %s +INST_DYNAMIC_DEP = %s +EOF +} + +=item extra_clean_files + +Clean out some extra dll.{base,exp} files which might be generated by +gcc. Otherwise, take out all *.pdb files. + +=cut + +sub extra_clean_files { + my $self = shift; + + return $GCC ? (qw(dll.base dll.exp)) : ('*.pdb'); +} + +=item init_linker + +=cut + +sub init_linker { + my $self = shift; + + $self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}"; + $self->{PERL_ARCHIVEDEP} = "\$(PERL_INCDEP)\\$Config{libperl}"; + $self->{PERL_ARCHIVE_AFTER} = ''; + $self->{EXPORT_LIST} = '$(BASEEXT).def'; +} + + +=item perl_script + +Checks for the perl program under several common perl extensions. + +=cut + +sub perl_script { + my($self,$file) = @_; + return $file if -r $file && -f _; + return "$file.pl" if -r "$file.pl" && -f _; + return "$file.plx" if -r "$file.plx" && -f _; + return "$file.bat" if -r "$file.bat" && -f _; + return; +} + +sub can_dep_space { + my $self = shift; + 1; # with Win32::GetShortPathName +} + +=item quote_dep + +=cut + +sub quote_dep { + my ($self, $arg) = @_; + if ($arg =~ / / and not $self->is_make_type('gmake')) { + require Win32; + $arg = Win32::GetShortPathName($arg); + die <<EOF if not defined $arg or $arg =~ / /; +Tried to use make dependency with space for non-GNU make: + '$arg' +Fallback to short pathname failed. +EOF + return $arg; + } + return $self->SUPER::quote_dep($arg); +} + + +=item xs_obj_opt + +Override to fixup -o flags for MSVC. + +=cut + +sub xs_obj_opt { + my ($self, $output_file) = @_; + ($MSVC ? "/Fo" : "-o ") . $output_file; +} + + +=item pasthru + +All we send is -nologo to nmake to prevent it from printing its damned +banner. + +=cut + +sub pasthru { + my($self) = shift; + my $old = $self->SUPER::pasthru; + return $old unless $self->is_make_type('nmake'); + $old =~ s/(PASTHRU\s*=\s*)/$1 -nologo /; + $old; +} + + +=item arch_check (override) + +Normalize all arguments for consistency of comparison. + +=cut + +sub arch_check { + my $self = shift; + + # Win32 is an XS module, minperl won't have it. + # arch_check() is not critical, so just fake it. + return 1 unless $self->can_load_xs; + return $self->SUPER::arch_check( map { $self->_normalize_path_name($_) } @_); +} + +sub _normalize_path_name { + my $self = shift; + my $file = shift; + + require Win32; + my $short = Win32::GetShortPathName($file); + return defined $short ? lc $short : lc $file; +} + + +=item oneliner + +These are based on what command.com does on Win98. They may be wrong +for other Windows shells, I don't know. + +=cut + +sub oneliner { + my($self, $cmd, $switches) = @_; + $switches = [] unless defined $switches; + + # Strip leading and trailing newlines + $cmd =~ s{^\n+}{}; + $cmd =~ s{\n+$}{}; + + $cmd = $self->quote_literal($cmd); + $cmd = $self->escape_newlines($cmd); + + $switches = join ' ', @$switches; + + return qq{\$(ABSPERLRUN) $switches -e $cmd --}; +} + + +sub quote_literal { + my($self, $text, $opts) = @_; + $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; + + # See: http://www.autohotkey.net/~deleyd/parameters/parameters.htm#CPP + + # Apply the Microsoft C/C++ parsing rules + $text =~ s{\\\\"}{\\\\\\\\\\"}g; # \\" -> \\\\\" + $text =~ s{(?<!\\)\\"}{\\\\\\"}g; # \" -> \\\" + $text =~ s{(?<!\\)"}{\\"}g; # " -> \" + $text = qq{"$text"} if $text =~ /[ \t#]/; # hash because gmake 4.2.1 + + # Apply the Command Prompt parsing rules (cmd.exe) + my @text = split /("[^"]*")/, $text; + # We should also escape parentheses, but it breaks one-liners containing + # $(MACRO)s in makefiles. + s{([<>|&^@!])}{^$1}g foreach grep { !/^"[^"]*"$/ } @text; + $text = join('', @text); + + # dmake expands {{ to { and }} to }. + if( $self->is_make_type('dmake') ) { + $text =~ s/{/{{/g; + $text =~ s/}/}}/g; + } + + $text = $opts->{allow_variables} + ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); + + return $text; +} + + +sub escape_newlines { + my($self, $text) = @_; + + # Escape newlines + $text =~ s{\n}{\\\n}g; + + return $text; +} + + +=item cd + +dmake can handle Unix style cd'ing but nmake (at least 1.5) cannot. It +wants: + + cd dir1\dir2 + command + another_command + cd ..\.. + +=cut + +sub cd { + my($self, $dir, @cmds) = @_; + + return $self->SUPER::cd($dir, @cmds) unless $self->is_make_type('nmake'); + + my $cmd = join "\n\t", map "$_", @cmds; + + my $updirs = $self->catdir(map { $self->updir } $self->splitdir($dir)); + + # No leading tab and no trailing newline makes for easier embedding. + my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd, $updirs; +cd %s + %s + cd %s +MAKE_FRAG + + chomp $make_frag; + + return $make_frag; +} + + +=item max_exec_len + +nmake 1.50 limits command length to 2048 characters. + +=cut + +sub max_exec_len { + my $self = shift; + + return $self->{_MAX_EXEC_LEN} ||= 2 * 1024; +} + + +=item os_flavor + +Windows is Win32. + +=cut + +sub os_flavor { + return('Win32'); +} + +=item dbgoutflag + +Returns a CC flag that tells the CC to emit a separate debugging symbol file +when compiling an object file. + +=cut + +sub dbgoutflag { + $MSVC ? '-Fd$(*).pdb' : ''; +} + +=item cflags + +Defines the PERLDLL symbol if we are configured for static building since all +code destined for the perl5xx.dll must be compiled with the PERLDLL symbol +defined. + +=cut + +sub cflags { + my($self,$libperl)=@_; + return $self->{CFLAGS} if $self->{CFLAGS}; + return '' unless $self->needs_linking(); + + my $base = $self->SUPER::cflags($libperl); + foreach (split /\n/, $base) { + /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; + }; + $self->{CCFLAGS} .= " -DPERLDLL" if ($self->{LINKTYPE} eq 'static'); + + return $self->{CFLAGS} = qq{ +CCFLAGS = $self->{CCFLAGS} +OPTIMIZE = $self->{OPTIMIZE} +PERLTYPE = $self->{PERLTYPE} +}; + +} + +=item make_type + +Returns a suitable string describing the type of makefile being written. + +=cut + +sub make_type { + my ($self) = @_; + my $make = $self->make; + $make = +( File::Spec->splitpath( $make ) )[-1]; + $make =~ s!\.exe$!!i; + if ( $make =~ m![^A-Z0-9]!i ) { + ($make) = grep { m!make!i } split m![^A-Z0-9]!i, $make; + } + return "$make-style"; +} + +1; +__END__ + +=back diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win95.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win95.pm new file mode 100644 index 0000000000000000000000000000000000000000..4220e52dc373ffdc141af2260c3112612afdd2ee --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MM_Win95.pm @@ -0,0 +1,76 @@ +package ExtUtils::MM_Win95; + +use strict; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require ExtUtils::MM_Win32; +our @ISA = qw(ExtUtils::MM_Win32); + +use ExtUtils::MakeMaker::Config; + + +=head1 NAME + +ExtUtils::MM_Win95 - method to customize MakeMaker for Win9X + +=head1 SYNOPSIS + + You should not be using this module directly. + +=head1 DESCRIPTION + +This is a subclass of L<ExtUtils::MM_Win32> containing changes necessary +to get MakeMaker playing nice with command.com and other Win9Xisms. + +=head2 Overridden methods + +Most of these make up for limitations in the Win9x/nmake command shell. + +=over 4 + + +=item max_exec_len + +Win98 chokes on things like Encode if we set the max length to nmake's max +of 2K. So we go for a more conservative value of 1K. + +=cut + +sub max_exec_len { + my $self = shift; + + return $self->{_MAX_EXEC_LEN} ||= 1024; +} + + +=item os_flavor + +Win95 and Win98 and WinME are collectively Win9x and Win32 + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Win9x'); +} + + +=back + + +=head1 AUTHOR + +Code originally inside MM_Win32. Original author unknown. + +Currently maintained by Michael G Schwern C<schwern@pobox.com>. + +Send patches and ideas to C<makemaker@perl.org>. + +See https://metacpan.org/release/ExtUtils-MakeMaker. + +=cut + + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MY.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MY.pm new file mode 100644 index 0000000000000000000000000000000000000000..957ab164592a23711b95bf9653ae0ec1c2f5c8cd --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MY.pm @@ -0,0 +1,41 @@ +package ExtUtils::MY; + +use strict; +require ExtUtils::MM; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; +our @ISA = qw(ExtUtils::MM); + +{ + package MY; + our @ISA = qw(ExtUtils::MY); +} + +sub DESTROY {} + + +=head1 NAME + +ExtUtils::MY - ExtUtils::MakeMaker subclass for customization + +=head1 SYNOPSIS + + # in your Makefile.PL + sub MY::whatever { + ... + } + +=head1 DESCRIPTION + +B<FOR INTERNAL USE ONLY> + +ExtUtils::MY is a subclass of L<ExtUtils::MM>. Its provided in your +Makefile.PL for you to add and override MakeMaker functionality. + +It also provides a convenient alias via the MY class. + +ExtUtils::MY might turn out to be a temporary solution, but MY won't +go away. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/MakeMaker.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MakeMaker.pm new file mode 100644 index 0000000000000000000000000000000000000000..6dceb98be41ddd64f9cd47e15988c7dcd4d0de2d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/MakeMaker.pm @@ -0,0 +1,3444 @@ +# $Id$ +package ExtUtils::MakeMaker; + +use strict; + +BEGIN {require 5.006;} + +require Exporter; +use ExtUtils::MakeMaker::Config; +use ExtUtils::MakeMaker::version; # ensure we always have our fake version.pm +use Carp; +use File::Path; +my $CAN_DECODE = eval { require ExtUtils::MakeMaker::Locale; }; # 2 birds, 1 stone +eval { ExtUtils::MakeMaker::Locale::reinit('UTF-8') } + if $CAN_DECODE and Encode::find_encoding('locale')->name eq 'ascii'; + +our $Verbose = 0; # exported +our @Parent; # needs to be localized +our @Get_from_Config; # referenced by MM_Unix +our @MM_Sections; +our @Overridable; +my @Prepend_parent; +my %Recognized_Att_Keys; +our %macro_fsentity; # whether a macro is a filesystem name +our %macro_dep; # whether a macro is a dependency + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +# Emulate something resembling CVS $Revision$ +(our $Revision = $VERSION) =~ s{_}{}; +$Revision = int $Revision * 10000; + +our $Filename = __FILE__; # referenced outside MakeMaker + +our @ISA = qw(Exporter); +our @EXPORT = qw(&WriteMakefile $Verbose &prompt &os_unsupported); +our @EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists + &WriteEmptyMakefile &open_for_writing &write_file_via_tmp + &_sprintf562); + +# These will go away once the last of the Win32 & VMS specific code is +# purged. +my $Is_VMS = $^O eq 'VMS'; +my $Is_Win32 = $^O eq 'MSWin32'; +our $UNDER_CORE = $ENV{PERL_CORE}; # needs to be our + +full_setup(); + +require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker + # will give them MM. + +require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect + # loading ExtUtils::MakeMaker will give them MY. + # This will go when Embed is its own CPAN module. + + +# 5.6.2 can't do sprintf "%1$s" - this can only do %s +sub _sprintf562 { + my ($format, @args) = @_; + for (my $i = 1; $i <= @args; $i++) { + $format =~ s#%$i\$s#$args[$i-1]#g; + } + $format; +} + +sub WriteMakefile { + croak "WriteMakefile: Need even number of args" if @_ % 2; + + require ExtUtils::MY; + my %att = @_; + + _convert_compat_attrs(\%att); + + _verify_att(\%att); + + my $mm = MM->new(\%att); + $mm->flush; + + return $mm; +} + + +# Basic signatures of the attributes WriteMakefile takes. Each is the +# reference type. Empty value indicate it takes a non-reference +# scalar. +my %Att_Sigs; +my %Special_Sigs = ( + AUTHOR => 'ARRAY', + C => 'ARRAY', + CONFIG => 'ARRAY', + CONFIGURE => 'CODE', + DIR => 'ARRAY', + DL_FUNCS => 'HASH', + DL_VARS => 'ARRAY', + EXCLUDE_EXT => 'ARRAY', + EXE_FILES => 'ARRAY', + FUNCLIST => 'ARRAY', + H => 'ARRAY', + IMPORTS => 'HASH', + INCLUDE_EXT => 'ARRAY', + LIBS => ['ARRAY',''], + MAN1PODS => 'HASH', + MAN3PODS => 'HASH', + META_ADD => 'HASH', + META_MERGE => 'HASH', + OBJECT => ['ARRAY', ''], + PL_FILES => 'HASH', + PM => 'HASH', + PMLIBDIRS => 'ARRAY', + PMLIBPARENTDIRS => 'ARRAY', + PREREQ_PM => 'HASH', + BUILD_REQUIRES => 'HASH', + CONFIGURE_REQUIRES => 'HASH', + TEST_REQUIRES => 'HASH', + SKIP => 'ARRAY', + TYPEMAPS => 'ARRAY', + XS => 'HASH', + XSBUILD => 'HASH', + VERSION => ['version',''], + _KEEP_AFTER_FLUSH => '', + + clean => 'HASH', + depend => 'HASH', + dist => 'HASH', + dynamic_lib=> 'HASH', + linkext => 'HASH', + macro => 'HASH', + postamble => 'HASH', + realclean => 'HASH', + test => 'HASH', + tool_autosplit => 'HASH', +); + +@Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys; +@Att_Sigs{keys %Special_Sigs} = values %Special_Sigs; + +sub _convert_compat_attrs { #result of running several times should be same + my($att) = @_; + if (exists $att->{AUTHOR}) { + if ($att->{AUTHOR}) { + if (!ref($att->{AUTHOR})) { + my $t = $att->{AUTHOR}; + $att->{AUTHOR} = [$t]; + } + } else { + $att->{AUTHOR} = []; + } + } +} + +sub _verify_att { + my($att) = @_; + + foreach my $key (sort keys %$att) { + my $val = $att->{$key}; + my $sig = $Att_Sigs{$key}; + unless( defined $sig ) { + warn "WARNING: $key is not a known parameter.\n"; + next; + } + + my @sigs = ref $sig ? @$sig : $sig; + my $given = ref $val; + unless( grep { _is_of_type($val, $_) } @sigs ) { + my $takes = join " or ", map { _format_att($_) } @sigs; + + my $has = _format_att($given); + warn "WARNING: $key takes a $takes not a $has.\n". + " Please inform the author.\n"; + } + } +} + + +# Check if a given thing is a reference or instance of $type +sub _is_of_type { + my($thing, $type) = @_; + + return 1 if ref $thing eq $type; + + local $SIG{__DIE__}; + return 1 if eval{ $thing->isa($type) }; + + return 0; +} + + +sub _format_att { + my $given = shift; + + return $given eq '' ? "string/number" + : uc $given eq $given ? "$given reference" + : "$given object" + ; +} + + +sub prompt ($;$) { ## no critic + my($mess, $def) = @_; + confess("prompt function called without an argument") + unless defined $mess; + + my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; + + my $dispdef = defined $def ? "[$def] " : " "; + $def = defined $def ? $def : ""; + + local $|=1; + local $\; + print "$mess $dispdef"; + + my $ans; + if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) { + print "$def\n"; + } + else { + $ans = <STDIN>; + if( defined $ans ) { + $ans =~ s{\015?\012$}{}; + } + else { # user hit ctrl-D + print "\n"; + } + } + + return (!defined $ans || $ans eq '') ? $def : $ans; +} + +sub os_unsupported { + die "OS unsupported\n"; +} + +sub eval_in_subdirs { + my($self) = @_; + use Cwd qw(cwd abs_path); + my $pwd = cwd() || die "Can't figure out your cwd!"; + + local @INC = map eval {abs_path($_) if -e} || $_, @INC; + push @INC, '.'; # '.' has to always be at the end of @INC + + foreach my $dir (@{$self->{DIR}}){ + my($abs) = $self->catdir($pwd,$dir); + eval { $self->eval_in_x($abs); }; + last if $@; + } + chdir $pwd; + die $@ if $@; +} + +sub eval_in_x { + my($self,$dir) = @_; + chdir $dir or carp("Couldn't change to directory $dir: $!"); + + { + package main; + do './Makefile.PL'; + }; + if ($@) { +# if ($@ =~ /prerequisites/) { +# die "MakeMaker WARNING: $@"; +# } else { +# warn "WARNING from evaluation of $dir/Makefile.PL: $@"; +# } + die "ERROR from evaluation of $dir/Makefile.PL: $@"; + } +} + + +# package name for the classes into which the first object will be blessed +my $PACKNAME = 'PACK000'; + +sub full_setup { + $Verbose ||= 0; + + my @dep_macros = qw/ + PERL_INCDEP PERL_ARCHLIBDEP PERL_ARCHIVEDEP + /; + + my @fs_macros = qw/ + FULLPERL XSUBPPDIR + + INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR + INSTALLDIRS + DESTDIR PREFIX INSTALL_BASE + PERLPREFIX SITEPREFIX VENDORPREFIX + INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB + INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH + INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN + INSTALLMAN1DIR INSTALLMAN3DIR + INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR + INSTALLVENDORMAN1DIR INSTALLVENDORMAN3DIR + INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT + PERL_LIB PERL_ARCHLIB + SITELIBEXP SITEARCHEXP + + MAKE LIBPERL_A LIB PERL_SRC PERL_INC + PPM_INSTALL_EXEC PPM_UNINSTALL_EXEC + PPM_INSTALL_SCRIPT PPM_UNINSTALL_SCRIPT + /; + + my @attrib_help = qw/ + + AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION + C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DISTVNAME + DL_FUNCS DL_VARS + EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE + FULLPERLRUN FULLPERLRUNINST + FUNCLIST H IMPORTS + + INC INCLUDE_EXT LDFROM LIBS LICENSE + LINKTYPE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET + META_ADD META_MERGE MIN_PERL_VERSION BUILD_REQUIRES CONFIGURE_REQUIRES + MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NO_MYMETA NO_PACKLIST NO_PERLLOCAL + NORECURS NO_VC OBJECT OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN + PERLRUNINST PERL_CORE + PERM_DIR PERM_RW PERM_RWX MAGICXS + PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE + PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ PUREPERL_ONLY + SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST VERSION VERSION_FROM XS + XSBUILD XSMULTI XSOPT XSPROTOARG XS_VERSION + clean depend dist dynamic_lib linkext macro realclean tool_autosplit + + MAN1EXT MAN3EXT + + MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC + MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED + /; + push @attrib_help, @fs_macros; + @macro_fsentity{@fs_macros, @dep_macros} = (1) x (@fs_macros+@dep_macros); + @macro_dep{@dep_macros} = (1) x @dep_macros; + + # IMPORTS is used under OS/2 and Win32 + + # @Overridable is close to @MM_Sections but not identical. The + # order is important. Many subroutines declare macros. These + # depend on each other. Let's try to collect the macros up front, + # then pasthru, then the rules. + + # MM_Sections are the sections we have to call explicitly + # in Overridable we have subroutines that are used indirectly + + + @MM_Sections = + qw( + + post_initialize const_config constants platform_constants + tool_autosplit tool_xsubpp tools_other + + makemakerdflt + + dist macro depend cflags const_loadlibs const_cccmd + post_constants + + pasthru + + special_targets + c_o xs_c xs_o + top_targets blibdirs linkext dlsyms dynamic_bs dynamic + dynamic_lib static static_lib manifypods processPL + installbin subdirs + clean_subdirs clean realclean_subdirs realclean + metafile signature + dist_basics dist_core distdir dist_test dist_ci distmeta distsignature + install force perldepend makefile staticmake test ppd + + ); # loses section ordering + + @Overridable = @MM_Sections; + push @Overridable, qw[ + + libscan makeaperl needs_linking + subdir_x test_via_harness test_via_script + + init_VERSION init_dist init_INST init_INSTALL init_DEST init_dirscan + init_PM init_MANPODS init_xs init_PERL init_DIRFILESEP init_linker + ]; + + push @MM_Sections, qw[ + + pm_to_blib selfdocument + + ]; + + # Postamble needs to be the last that was always the case + push @MM_Sections, "postamble"; + push @Overridable, "postamble"; + + # All sections are valid keys. + @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections; + + # we will use all these variables in the Makefile + @Get_from_Config = + qw( + ar cc cccdlflags ccdlflags dlext dlsrc exe_ext full_ar ld + lddlflags ldflags libc lib_ext obj_ext osname osvers ranlib + sitelibexp sitearchexp so + ); + + # 5.5.3 doesn't have any concept of vendor libs + push @Get_from_Config, qw( vendorarchexp vendorlibexp ) if "$]" >= 5.006; + + foreach my $item (@attrib_help){ + $Recognized_Att_Keys{$item} = 1; + } + foreach my $item (@Get_from_Config) { + $Recognized_Att_Keys{uc $item} = $Config{$item}; + print "Attribute '\U$item\E' => '$Config{$item}'\n" + if ($Verbose >= 2); + } + + # + # When we eval a Makefile.PL in a subdirectory, that one will ask + # us (the parent) for the values and will prepend "..", so that + # all files to be installed end up below OUR ./blib + # + @Prepend_parent = qw( + INST_BIN INST_LIB INST_ARCHLIB INST_SCRIPT + MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC + PERL FULLPERL + ); +} + +sub _has_cpan_meta_requirements { + return eval { + require CPAN::Meta::Requirements; + CPAN::Meta::Requirements->VERSION(2.130); + require B; # CMR requires this, for core we have to too. + }; +} + +sub new { + my($class,$self) = @_; + my($key); + + _convert_compat_attrs($self) if defined $self && $self; + + # Store the original args passed to WriteMakefile() + foreach my $k (keys %$self) { + $self->{ARGS}{$k} = $self->{$k}; + } + + $self = {} unless defined $self; + + # Temporarily bless it into MM so it can be used as an + # object. It will be blessed into a temp package later. + bless $self, "MM"; + + # Cleanup all the module requirement bits + my %key2cmr; + for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { + $self->{$key} ||= {}; + if (_has_cpan_meta_requirements) { + my $cmr = CPAN::Meta::Requirements->from_string_hash( + $self->{$key}, + { + bad_version_hook => sub { + #no warnings 'numeric'; # module doesn't use warnings + my $fallback; + if ( $_[0] =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { + $fallback = sprintf "%f", $_[0]; + } else { + ($fallback) = $_[0] ? ($_[0] =~ /^([0-9.]+)/) : 0; + $fallback += 0; + carp "Unparsable version '$_[0]' for prerequisite $_[1] treated as $fallback"; + } + version->new($fallback); + }, + }, + ); + $self->{$key} = $cmr->as_string_hash; + $key2cmr{$key} = $cmr; + } else { + for my $module (sort keys %{ $self->{$key} }) { + my $version = $self->{$key}->{$module}; + my $fallback = 0; + if (!defined($version) or !length($version)) { + carp "Undefined requirement for $module treated as '0' (CPAN::Meta::Requirements not available)"; + } + elsif ($version =~ /^\d+(?:\.\d+(?:_\d+)*)?$/) { + next; + } + else { + if ( $version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { + $fallback = sprintf "%f", $version; + } else { + ($fallback) = $version ? ($version =~ /^([0-9.]+)/) : 0; + $fallback += 0; + carp "Unparsable version '$version' for prerequisite $module treated as $fallback (CPAN::Meta::Requirements not available)"; + } + } + $self->{$key}->{$module} = $fallback; + } + } + } + + if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { + $self->_PREREQ_PRINT; + } + + # PRINT_PREREQ is RedHatism. + if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { + $self->_PRINT_PREREQ; + } + + print "MakeMaker (v$VERSION)\n" if $Verbose; + if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){ + check_manifest(); + } + + check_hints($self); + + if ( defined $self->{MIN_PERL_VERSION} + && $self->{MIN_PERL_VERSION} !~ /^v?[\d_\.]+$/ ) { + require version; + my $normal = eval { + local $SIG{__WARN__} = sub { + # simulate "use warnings FATAL => 'all'" for vintage perls + die @_; + }; + version->new( $self->{MIN_PERL_VERSION} ) + }; + $self->{MIN_PERL_VERSION} = $normal if defined $normal && !$@; + } + + # Translate X.Y.Z to X.00Y00Z + if( defined $self->{MIN_PERL_VERSION} ) { + $self->{MIN_PERL_VERSION} =~ s{ ^v? (\d+) \. (\d+) \. (\d+) $ } + {sprintf "%d.%03d%03d", $1, $2, $3}ex; + } + + my $perl_version_ok = eval { + local $SIG{__WARN__} = sub { + # simulate "use warnings FATAL => 'all'" for vintage perls + die @_; + }; + !$self->{MIN_PERL_VERSION} or $self->{MIN_PERL_VERSION} <= "$]" + }; + if (!$perl_version_ok) { + if (!defined $perl_version_ok) { + die <<'END'; +Warning: MIN_PERL_VERSION is not in a recognized format. +Recommended is a quoted numerical value like '5.005' or '5.008001'. +END + } + elsif ($self->{PREREQ_FATAL}) { + die sprintf <<"END", $self->{MIN_PERL_VERSION}, $]; +MakeMaker FATAL: perl version too low for this distribution. +Required is %s. We run %s. +END + } + else { + warn sprintf + "Warning: Perl version %s or higher required. We run %s.\n", + $self->{MIN_PERL_VERSION}, $]; + } + } + + my %configure_att; # record &{$self->{CONFIGURE}} attributes + my(%initial_att) = %$self; # record initial attributes + + my(%unsatisfied) = (); + my %prereq2version; + my $cmr; + if (_has_cpan_meta_requirements) { + $cmr = CPAN::Meta::Requirements->new; + for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { + $cmr->add_requirements($key2cmr{$key}) if $key2cmr{$key}; + } + foreach my $prereq ($cmr->required_modules) { + $prereq2version{$prereq} = $cmr->requirements_for_module($prereq); + } + } else { + for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { + next unless my $module2version = $self->{$key}; + $prereq2version{$_} = $module2version->{$_} for keys %$module2version; + } + } + foreach my $prereq (sort keys %prereq2version) { + my $required_version = $prereq2version{$prereq}; + + my $pr_version = 0; + my $installed_file; + + if ( $prereq eq 'perl' ) { + if ( defined $required_version && $required_version =~ /^v?[\d_\.]+$/ + || $required_version !~ /^v?[\d_\.]+$/ ) { + require version; + my $normal = eval { version->new( $required_version ) }; + $required_version = $normal if defined $normal; + } + $installed_file = $prereq; + $pr_version = $]; + } + else { + $installed_file = MM->_installed_file_for_module($prereq); + $pr_version = MM->parse_version($installed_file) if $installed_file; + $pr_version = 0 if $pr_version eq 'undef'; + if ( !eval { version->new( $pr_version ); 1 } ) { + #no warnings 'numeric'; # module doesn't use warnings + my $fallback; + if ( $pr_version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { + $fallback = sprintf '%f', $pr_version; + } else { + ($fallback) = $pr_version ? ($pr_version =~ /^([0-9.]+)/) : 0; + $fallback += 0; + carp "Unparsable version '$pr_version' for installed prerequisite $prereq treated as $fallback"; + } + $pr_version = $fallback; + } + } + + # convert X.Y_Z alpha version #s to X.YZ for easier comparisons + $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/; + + if (!$installed_file) { + warn sprintf "Warning: prerequisite %s %s not found.\n", + $prereq, $required_version + unless $self->{PREREQ_FATAL} + or $UNDER_CORE; + + $unsatisfied{$prereq} = 'not installed'; + } + elsif ( + $cmr + ? !$cmr->accepts_module($prereq, $pr_version) + : $required_version > $pr_version + ) { + warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n", + $prereq, $required_version, ($pr_version || 'unknown version') + unless $self->{PREREQ_FATAL} + or $UNDER_CORE; + + $unsatisfied{$prereq} = $required_version || 'unknown version' ; + } + } + + if (%unsatisfied && $self->{PREREQ_FATAL}){ + my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"} + sort { $a cmp $b } keys %unsatisfied; + die <<"END"; +MakeMaker FATAL: prerequisites not found. +$failedprereqs + +Please install these modules first and rerun 'perl Makefile.PL'. +END + } + + if (defined $self->{CONFIGURE}) { + if (ref $self->{CONFIGURE} eq 'CODE') { + %configure_att = %{&{$self->{CONFIGURE}}}; + _convert_compat_attrs(\%configure_att); + $self = { %$self, %configure_att }; + } else { + croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; + } + } + + my $newclass = ++$PACKNAME; + local @Parent = @Parent; # Protect against non-local exits + { + print "Blessing Object into class [$newclass]\n" if $Verbose>=2; + mv_all_methods("MY",$newclass); + bless $self, $newclass; + push @Parent, $self; + require ExtUtils::MY; + + no strict 'refs'; ## no critic; + @{"$newclass\:\:ISA"} = 'MM'; + } + + if (defined $Parent[-2]){ + $self->{PARENT} = $Parent[-2]; + for my $key (@Prepend_parent) { + next unless defined $self->{PARENT}{$key}; + + # Don't stomp on WriteMakefile() args. + next if defined $self->{ARGS}{$key} and + $self->{ARGS}{$key} eq $self->{$key}; + + $self->{$key} = $self->{PARENT}{$key}; + + if ($Is_VMS && $key =~ /PERL$/) { + # PERL or FULLPERL will be a command verb or even a + # command with an argument instead of a full file + # specification under VMS. So, don't turn the command + # into a filespec, but do add a level to the path of + # the argument if not already absolute. + my @cmd = split /\s+/, $self->{$key}; + $cmd[1] = $self->catfile('[-]',$cmd[1]) + unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]); + $self->{$key} = join(' ', @cmd); + } else { + my $value = $self->{$key}; + # not going to test in FS so only stripping start + $value =~ s/"// if $key =~ /PERL$/ and $self->is_make_type('dmake'); + $value =~ s/^"// if $key =~ /PERL$/; + $value = $self->catdir("..", $value) + unless $self->file_name_is_absolute($value); + $value = qq{"$value} if $key =~ /PERL$/; + $self->{$key} = $value; + } + } + if ($self->{PARENT}) { + $self->{PARENT}->{CHILDREN}->{$newclass} = $self; + foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE AR FULL_AR CC CCFLAGS + OPTIMIZE LD LDDLFLAGS LDFLAGS PERL_ARCHLIB DESTDIR)) { + if (exists $self->{PARENT}->{$opt} + and not exists $self->{$opt}) + { + # inherit, but only if already unspecified + $self->{$opt} = $self->{PARENT}->{$opt}; + } + } + } + my @fm = grep /^FIRST_MAKEFILE=/, @ARGV; + parse_args($self,@fm) if @fm; + } + else { + parse_args($self, _shellwords($ENV{PERL_MM_OPT} || ''),@ARGV); + } + + # RT#91540 PREREQ_FATAL not recognized on command line + if (%unsatisfied && $self->{PREREQ_FATAL}){ + my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"} + sort { $a cmp $b } keys %unsatisfied; + die <<"END"; +MakeMaker FATAL: prerequisites not found. +$failedprereqs + +Please install these modules first and rerun 'perl Makefile.PL'. +END + } + + $self->{NAME} ||= $self->guess_name; + + warn "Warning: NAME must be a package name\n" + unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!; + + ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g; + + $self->init_MAKE; + $self->init_main; + $self->init_VERSION; + $self->init_dist; + $self->init_INST; + $self->init_INSTALL; + $self->init_DEST; + $self->init_dirscan; + $self->init_PM; + $self->init_MANPODS; + $self->init_xs; + $self->init_PERL; + $self->init_DIRFILESEP; + $self->init_linker; + $self->init_ABSTRACT; + + $self->arch_check( + $INC{'Config.pm'}, + $self->catfile($Config{'archlibexp'}, "Config.pm") + ); + + $self->init_tools(); + $self->init_others(); + $self->init_platform(); + $self->init_PERM(); + my @args = @ARGV; + @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE; + my($argv) = neatvalue(\@args); + $argv =~ s/^\[/(/; + $argv =~ s/\]$/)/; + + push @{$self->{RESULT}}, <<END; +# This Makefile is for the $self->{NAME} extension to perl. +# +# It was generated automatically by MakeMaker version +# $VERSION (Revision: $Revision) from the contents of +# Makefile.PL. Don't edit this file, edit Makefile.PL instead. +# +# ANY CHANGES MADE HERE WILL BE LOST! +# +# MakeMaker ARGV: $argv +# +END + + push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att); + + if (defined $self->{CONFIGURE}) { + push @{$self->{RESULT}}, <<END; + +# MakeMaker 'CONFIGURE' Parameters: +END + if (scalar(keys %configure_att) > 0) { + foreach my $key (sort keys %configure_att){ + next if $key eq 'ARGS'; + my($v) = neatvalue($configure_att{$key}); + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @{$self->{RESULT}}, "# $key => $v"; + } + } + else + { + push @{$self->{RESULT}}, "# no values returned"; + } + undef %configure_att; # free memory + } + + # turn the SKIP array into a SKIPHASH hash + for my $skip (@{$self->{SKIP} || []}) { + $self->{SKIPHASH}{$skip} = 1; + } + delete $self->{SKIP}; # free memory + + if ($self->{PARENT}) { + for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) { + $self->{SKIPHASH}{$_} = 1; + } + } + + # We run all the subdirectories now. They don't have much to query + # from the parent, but the parent has to query them: if they need linking! + unless ($self->{NORECURS}) { + $self->eval_in_subdirs if @{$self->{DIR}}; + } + + foreach my $section ( @MM_Sections ){ + # Support for new foo_target() methods. + my $method = $section; + $method .= '_target' unless $self->can($method); + + print "Processing Makefile '$section' section\n" if ($Verbose >= 2); + my($skipit) = $self->skipcheck($section); + if ($skipit){ + push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit."; + } else { + my(%a) = %{$self->{$section} || {}}; + push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:"; + push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a; + push @{$self->{RESULT}}, $self->maketext_filter( + $self->$method( %a ) + ); + } + } + + push @{$self->{RESULT}}, "\n# End."; + + $self; +} + +sub WriteEmptyMakefile { + croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; + + my %att = @_; + $att{DIR} = [] unless $att{DIR}; # don't recurse by default + my $self = MM->new(\%att); + + my $new = $self->{MAKEFILE}; + my $old = $self->{MAKEFILE_OLD}; + if (-f $old) { + _unlink($old) or warn "unlink $old: $!"; + } + if ( -f $new ) { + _rename($new, $old) or warn "rename $new => $old: $!" + } + open my $mfh, '>', $new or die "open $new for write: $!"; + print $mfh <<'EOP'; +all : + +manifypods : + +subdirs : + +dynamic : + +static : + +clean : + +install : + +makemakerdflt : + +test : + +test_dynamic : + +test_static : + +EOP + close $mfh or die "close $new for write: $!"; +} + + +=begin private + +=head3 _installed_file_for_module + + my $file = MM->_installed_file_for_module($module); + +Return the first installed .pm $file associated with the $module. The +one which will show up when you C<use $module>. + +$module is something like "strict" or "Test::More". + +=end private + +=cut + +sub _installed_file_for_module { + my $class = shift; + my $prereq = shift; + + my $file = "$prereq.pm"; + $file =~ s{::}{/}g; + + my $path; + for my $dir (@INC) { + my $tmp = File::Spec->catfile($dir, $file); + if ( -r $tmp ) { + $path = $tmp; + last; + } + } + + return $path; +} + + +# Extracted from MakeMaker->new so we can test it +sub _MakeMaker_Parameters_section { + my $self = shift; + my $att = shift; + + my @result = <<'END'; +# MakeMaker Parameters: +END + + foreach my $key (sort keys %$att){ + next if $key eq 'ARGS'; + my $v; + if ($key eq 'PREREQ_PM') { + # CPAN.pm takes prereqs from this field in 'Makefile' + # and does not know about BUILD_REQUIRES + $v = neatvalue({ + %{ $att->{PREREQ_PM} || {} }, + %{ $att->{BUILD_REQUIRES} || {} }, + %{ $att->{TEST_REQUIRES} || {} }, + }); + } else { + $v = neatvalue($att->{$key}); + } + + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @result, "# $key => $v"; + } + + return @result; +} + +# _shellwords and _parseline borrowed from Text::ParseWords +sub _shellwords { + my (@lines) = @_; + my @allwords; + + foreach my $line (@lines) { + $line =~ s/^\s+//; + my @words = _parse_line('\s+', 0, $line); + pop @words if (@words and !defined $words[-1]); + return() unless (@words || !length($line)); + push(@allwords, @words); + } + return(@allwords); +} + +sub _parse_line { + my($delimiter, $keep, $line) = @_; + my($word, @pieces); + + no warnings 'uninitialized'; # we will be testing undef strings + + while (length($line)) { + # This pattern is optimised to be stack conservative on older perls. + # Do not refactor without being careful and testing it on very long strings. + # See Perl bug #42980 for an example of a stack busting input. + $line =~ s/^ + (?: + # double quoted string + (") # $quote + ((?>[^\\"]*(?:\\.[^\\"]*)*))" # $quoted + | # --OR-- + # singe quoted string + (') # $quote + ((?>[^\\']*(?:\\.[^\\']*)*))' # $quoted + | # --OR-- + # unquoted string + ( # $unquoted + (?:\\.|[^\\"'])*? + ) + # followed by + ( # $delim + \Z(?!\n) # EOL + | # --OR-- + (?-x:$delimiter) # delimiter + | # --OR-- + (?!^)(?=["']) # a quote + ) + )//xs or return; # extended layout + my ($quote, $quoted, $unquoted, $delim) = (($1 ? ($1,$2) : ($3,$4)), $5, $6); + + + return() unless( defined($quote) || length($unquoted) || length($delim)); + + if ($keep) { + $quoted = "$quote$quoted$quote"; + } + else { + $unquoted =~ s/\\(.)/$1/sg; + if (defined $quote) { + $quoted =~ s/\\(.)/$1/sg if ($quote eq '"'); + #$quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'"); + } + } + $word .= substr($line, 0, 0); # leave results tainted + $word .= defined $quote ? $quoted : $unquoted; + + if (length($delim)) { + push(@pieces, $word); + push(@pieces, $delim) if ($keep eq 'delimiters'); + undef $word; + } + if (!length($line)) { + push(@pieces, $word); + } + } + return(@pieces); +} + +sub check_manifest { + print "Checking if your kit is complete...\n"; + require ExtUtils::Manifest; + # avoid warning + $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1; + my(@missed) = ExtUtils::Manifest::manicheck(); + if (@missed) { + print "Warning: the following files are missing in your kit:\n"; + print "\t", join "\n\t", @missed; + print "\n"; + print "Please inform the author.\n"; + } else { + print "Looks good\n"; + } +} + +sub parse_args{ + my($self, @args) = @_; + @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE; + foreach (@args) { + unless (m/(.*?)=(.*)/) { + ++$Verbose if m/^verb/; + next; + } + my($name, $value) = ($1, $2); + if ($value =~ m/^~(\w+)?/) { # tilde with optional username + $value =~ s [^~(\w*)] + [$1 ? + ((getpwnam($1))[7] || "~$1") : + (getpwuid($>))[7] + ]ex; + } + + # Remember the original args passed it. It will be useful later. + $self->{ARGS}{uc $name} = $self->{uc $name} = $value; + } + + # catch old-style 'potential_libs' and inform user how to 'upgrade' + if (defined $self->{potential_libs}){ + my($msg)="'potential_libs' => '$self->{potential_libs}' should be"; + if ($self->{potential_libs}){ + print "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"; + } else { + print "$msg deleted.\n"; + } + $self->{LIBS} = [$self->{potential_libs}]; + delete $self->{potential_libs}; + } + # catch old-style 'ARMAYBE' and inform user how to 'upgrade' + if (defined $self->{ARMAYBE}){ + my($armaybe) = $self->{ARMAYBE}; + print "ARMAYBE => '$armaybe' should be changed to:\n", + "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; + my(%dl) = %{$self->{dynamic_lib} || {}}; + $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe}; + delete $self->{ARMAYBE}; + } + if (defined $self->{LDTARGET}){ + print "LDTARGET should be changed to LDFROM\n"; + $self->{LDFROM} = $self->{LDTARGET}; + delete $self->{LDTARGET}; + } + # Turn a DIR argument on the command line into an array + if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') { + # So they can choose from the command line, which extensions they want + # the grep enables them to have some colons too much in case they + # have to build a list with the shell + $self->{DIR} = [grep $_, split ":", $self->{DIR}]; + } + # Turn a INCLUDE_EXT argument on the command line into an array + if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') { + $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}]; + } + # Turn a EXCLUDE_EXT argument on the command line into an array + if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') { + $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}]; + } + + foreach my $mmkey (sort keys %$self){ + next if $mmkey eq 'ARGS'; + print " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose; + print "'$mmkey' is not a known MakeMaker parameter name.\n" + unless exists $Recognized_Att_Keys{$mmkey}; + } + $| = 1 if $Verbose; +} + +sub check_hints { + my($self) = @_; + # We allow extension-specific hints files. + + require File::Spec; + my $curdir = File::Spec->curdir; + + my $hint_dir = File::Spec->catdir($curdir, "hints"); + return unless -d $hint_dir; + + # First we look for the best hintsfile we have + my($hint)="${^O}_$Config{osvers}"; + $hint =~ s/\./_/g; + $hint =~ s/_$//; + return unless $hint; + + # Also try without trailing minor version numbers. + while (1) { + last if -f File::Spec->catfile($hint_dir, "$hint.pl"); # found + } continue { + last unless $hint =~ s/_[^_]*$//; # nothing to cut off + } + my $hint_file = File::Spec->catfile($hint_dir, "$hint.pl"); + + return unless -f $hint_file; # really there + + _run_hintfile($self, $hint_file); +} + +sub _run_hintfile { + our $self; + local($self) = shift; # make $self available to the hint file. + my($hint_file) = shift; + + local($@, $!); + print "Processing hints file $hint_file\n" if $Verbose; + + # Just in case the ./ isn't on the hint file, which File::Spec can + # often strip off, we bung the curdir into @INC + local @INC = (File::Spec->curdir, @INC); + my $ret = do $hint_file; + if( !defined $ret ) { + my $error = $@ || $!; + warn $error; + } +} + +sub mv_all_methods { + my($from,$to) = @_; + local $SIG{__WARN__} = sub { + # can't use 'no warnings redefined', 5.6 only + warn @_ unless $_[0] =~ /^Subroutine .* redefined/ + }; + foreach my $method (@Overridable) { + next unless defined &{"${from}::$method"}; + no strict 'refs'; ## no critic + *{"${to}::$method"} = \&{"${from}::$method"}; + + # If we delete a method, then it will be undefined and cannot + # be called. But as long as we have Makefile.PLs that rely on + # %MY:: being intact, we have to fill the hole with an + # inheriting method: + + { + package MY; + my $super = "SUPER::".$method; + *{$method} = sub { + shift->$super(@_); + }; + } + } +} + +sub skipcheck { + my($self) = shift; + my($section) = @_; + return 'skipped' if $section eq 'metafile' && $UNDER_CORE; + if ($section eq 'dynamic') { + print "Warning (non-fatal): Target 'dynamic' depends on targets ", + "in skipped section 'dynamic_bs'\n" + if $self->{SKIPHASH}{dynamic_bs} && $Verbose; + print "Warning (non-fatal): Target 'dynamic' depends on targets ", + "in skipped section 'dynamic_lib'\n" + if $self->{SKIPHASH}{dynamic_lib} && $Verbose; + } + if ($section eq 'dynamic_lib') { + print "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ", + "targets in skipped section 'dynamic_bs'\n" + if $self->{SKIPHASH}{dynamic_bs} && $Verbose; + } + if ($section eq 'static') { + print "Warning (non-fatal): Target 'static' depends on targets ", + "in skipped section 'static_lib'\n" + if $self->{SKIPHASH}{static_lib} && $Verbose; + } + return 'skipped' if $self->{SKIPHASH}{$section}; + return ''; +} + +# returns filehandle, dies on fail. :raw so no :crlf +sub open_for_writing { + my ($file) = @_; + open my $fh ,">", $file or die "Unable to open $file: $!"; + my @layers = ':raw'; + push @layers, join ' ', ':encoding(locale)' if $CAN_DECODE; + binmode $fh, join ' ', @layers; + $fh; +} + +sub flush { + my $self = shift; + + my $finalname = $self->{MAKEFILE}; + printf "Generating a %s %s\n", $self->make_type, $finalname if $Verbose || !$self->{PARENT}; + print "Writing $finalname for $self->{NAME}\n" if $Verbose || !$self->{PARENT}; + + unlink($finalname, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ()); + + write_file_via_tmp($finalname, $self->{RESULT}); + + # Write MYMETA.yml to communicate metadata up to the CPAN clients + print "Writing MYMETA.yml and MYMETA.json\n" + if !$self->{NO_MYMETA} and $self->write_mymeta( $self->mymeta ); + + # save memory + if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) { + my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE); + delete $self->{$_} for grep !$keep{$_}, keys %$self; + } + + system("$Config::Config{eunicefix} $finalname") + if $Config::Config{eunicefix} ne ":"; + + return; +} + +sub write_file_via_tmp { + my ($finalname, $contents) = @_; + my $fh = open_for_writing("MakeMaker.tmp"); + die "write_file_via_tmp: 2nd arg must be ref" unless ref $contents; + for my $chunk (@$contents) { + my $to_write = $chunk; + utf8::encode $to_write if !$CAN_DECODE && "$]" > 5.008; + print $fh "$to_write\n" or die "Can't write to MakeMaker.tmp: $!"; + } + close $fh or die "Can't write to MakeMaker.tmp: $!"; + _rename("MakeMaker.tmp", $finalname) or + warn "rename MakeMaker.tmp => $finalname: $!"; + chmod 0644, $finalname if !$Is_VMS; + return; +} + +# This is a rename for OS's where the target must be unlinked first. +sub _rename { + my($src, $dest) = @_; + _unlink($dest); + return rename $src, $dest; +} + +# This is an unlink for OS's where the target must be writable first. +sub _unlink { + my @files = @_; + chmod 0666, @files; + return unlink @files; +} + + +# The following mkbootstrap() is only for installations that are calling +# the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker +# writes Makefiles, that use ExtUtils::Mkbootstrap directly. +sub mkbootstrap { + die <<END; +!!! Your Makefile has been built such a long time ago, !!! +!!! that is unlikely to work with current MakeMaker. !!! +!!! Please rebuild your Makefile !!! +END +} + +# Ditto for mksymlists() as of MakeMaker 5.17 +sub mksymlists { + die <<END; +!!! Your Makefile has been built such a long time ago, !!! +!!! that is unlikely to work with current MakeMaker. !!! +!!! Please rebuild your Makefile !!! +END +} + +sub neatvalue { + my($v) = @_; + return "undef" unless defined $v; + my($t) = ref $v; + return "q[$v]" unless $t; + if ($t eq 'ARRAY') { + my(@m, @neat); + push @m, "["; + foreach my $elem (@$v) { + push @neat, "q[$elem]"; + } + push @m, join ", ", @neat; + push @m, "]"; + return join "", @m; + } + return $v unless $t eq 'HASH'; + my(@m, $key, $val); + for my $key (sort keys %$v) { + last unless defined $key; # cautious programming in case (undef,undef) is true + push @m,"$key=>".neatvalue($v->{$key}); + } + return "{ ".join(', ',@m)." }"; +} + +sub _find_magic_vstring { + my $value = shift; + return $value if $UNDER_CORE; + my $tvalue = ''; + require B; + my $sv = B::svref_2object(\$value); + my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef; + while ( $magic ) { + if ( $magic->TYPE eq 'V' ) { + $tvalue = $magic->PTR; + $tvalue =~ s/^v?(.+)$/v$1/; + last; + } + else { + $magic = $magic->MOREMAGIC; + } + } + return $tvalue; +} + +sub selfdocument { + my($self) = @_; + my(@m); + if ($Verbose){ + push @m, "\n# Full list of MakeMaker attribute values:"; + foreach my $key (sort keys %$self){ + next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/; + my($v) = neatvalue($self->{$key}); + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @m, "# $key => $v"; + } + } + # added here as selfdocument is not overridable + push @m, <<'EOF'; + +# here so even if top_targets is overridden, these will still be defined +# gmake will silently still work if any are .PHONY-ed but nmake won't +EOF + push @m, join "\n", map "$_ ::\n\t\$(NOECHO) \$(NOOP)\n", + # config is so manifypods won't puke if no subdirs + grep !$self->{SKIPHASH}{$_}, + qw(static dynamic config); + join "\n", @m; +} + +1; + +__END__ + +=head1 NAME + +ExtUtils::MakeMaker - Create a module Makefile + +=head1 SYNOPSIS + + use ExtUtils::MakeMaker; + + WriteMakefile( + NAME => "Foo::Bar", + VERSION_FROM => "lib/Foo/Bar.pm", + ); + +=head1 DESCRIPTION + +This utility is designed to write a Makefile for an extension module +from a Makefile.PL. It is based on the Makefile.SH model provided by +Andy Dougherty and the perl5-porters. + +It splits the task of generating the Makefile into several subroutines +that can be individually overridden. Each subroutine returns the text +it wishes to have written to the Makefile. + +As there are various Make programs with incompatible syntax, which +use operating system shells, again with incompatible syntax, it is +important for users of this module to know which flavour of Make +a Makefile has been written for so they'll use the correct one and +won't have to face the possibly bewildering errors resulting from +using the wrong one. + +On POSIX systems, that program will likely be GNU Make; on Microsoft +Windows, it will be either Microsoft NMake, DMake or GNU Make. +See the section on the L</"MAKE"> parameter for details. + +ExtUtils::MakeMaker (EUMM) is object oriented. Each directory below the current +directory that contains a Makefile.PL is treated as a separate +object. This makes it possible to write an unlimited number of +Makefiles with a single invocation of WriteMakefile(). + +All inputs to WriteMakefile are Unicode characters, not just octets. EUMM +seeks to handle all of these correctly. It is currently still not possible +to portably use Unicode characters in module names, because this requires +Perl to handle Unicode filenames, which is not yet the case on Windows. + +See L<ExtUtils::MakeMaker::FAQ> for details of the design and usage. + +=head2 How To Write A Makefile.PL + +See L<ExtUtils::MakeMaker::Tutorial>. + +The long answer is the rest of the manpage :-) + +=head2 Default Makefile Behaviour + +The generated Makefile enables the user of the extension to invoke + + perl Makefile.PL # optionally "perl Makefile.PL verbose" + make + make test # optionally set TEST_VERBOSE=1 + make install # See below + +The Makefile to be produced may be altered by adding arguments of the +form C<KEY=VALUE>. E.g. + + perl Makefile.PL INSTALL_BASE=~ + +Other interesting targets in the generated Makefile are + + make config # to check if the Makefile is up-to-date + make clean # delete local temp files (Makefile gets renamed) + make realclean # delete derived files (including ./blib) + make ci # check in all the files in the MANIFEST file + make dist # see below the Distribution Support section + +=head2 make test + +MakeMaker checks for the existence of a file named F<test.pl> in the +current directory, and if it exists it executes the script with the +proper set of perl C<-I> options. + +MakeMaker also checks for any files matching glob("t/*.t"). It will +execute all matching files in alphabetical order via the +L<Test::Harness> module with the C<-I> switches set correctly. + +You can also organize your tests within subdirectories in the F<t/> directory. +To do so, use the F<test> directive in your I<Makefile.PL>. For example, if you +had tests in: + + t/foo + t/foo/bar + +You could tell make to run tests in both of those directories with the +following directives: + + test => {TESTS => 't/*/*.t t/*/*/*.t'} + test => {TESTS => 't/foo/*.t t/foo/bar/*.t'} + +The first will run all test files in all first-level subdirectories and all +subdirectories they contain. The second will run tests in only the F<t/foo> +and F<t/foo/bar>. + +If you'd like to see the raw output of your tests, set the +C<TEST_VERBOSE> variable to true. + + make test TEST_VERBOSE=1 + +If you want to run particular test files, set the C<TEST_FILES> variable. +It is possible to use globbing with this mechanism. + + make test TEST_FILES='t/foobar.t t/dagobah*.t' + +Windows users who are using C<nmake> should note that due to a bug in C<nmake>, +when specifying C<TEST_FILES> you must use back-slashes instead of forward-slashes. + + nmake test TEST_FILES='t\foobar.t t\dagobah*.t' + +=head2 make testdb + +A useful variation of the above is the target C<testdb>. It runs the +test under the Perl debugger (see L<perldebug>). If the file +F<test.pl> exists in the current directory, it is used for the test. + +If you want to debug some other testfile, set the C<TEST_FILE> variable +thusly: + + make testdb TEST_FILE=t/mytest.t + +By default the debugger is called using C<-d> option to perl. If you +want to specify some other option, set the C<TESTDB_SW> variable: + + make testdb TESTDB_SW=-Dx + +=head2 make install + +make alone puts all relevant files into directories that are named by +the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_MAN1DIR and +INST_MAN3DIR. All these default to something below ./blib if you are +I<not> building below the perl source directory. If you I<are> +building below the perl source, INST_LIB and INST_ARCHLIB default to +../../lib, and INST_SCRIPT is not defined. + +The I<install> target of the generated Makefile copies the files found +below each of the INST_* directories to their INSTALL* +counterparts. Which counterparts are chosen depends on the setting of +INSTALLDIRS according to the following table: + + INSTALLDIRS set to + perl site vendor + + PERLPREFIX SITEPREFIX VENDORPREFIX + INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH + INST_LIB INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB + INST_BIN INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN + INST_SCRIPT INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT + INST_MAN1DIR INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR + INST_MAN3DIR INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR + +The INSTALL... macros in turn default to their %Config +($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts. + +You can check the values of these variables on your system with + + perl '-V:install.*' + +And to check the sequence in which the library directories are +searched by perl, run + + perl -le 'print join $/, @INC' + +Sometimes older versions of the module you're installing live in other +directories in @INC. Because Perl loads the first version of a module it +finds, not the newest, you might accidentally get one of these older +versions even after installing a brand new version. To delete I<all other +versions of the module you're installing> (not simply older ones) set the +C<UNINST> variable. + + make install UNINST=1 + + +=head2 INSTALL_BASE + +INSTALL_BASE can be passed into Makefile.PL to change where your +module will be installed. INSTALL_BASE is more like what everyone +else calls "prefix" than PREFIX is. + +To have everything installed in your home directory, do the following. + + # Unix users, INSTALL_BASE=~ works fine + perl Makefile.PL INSTALL_BASE=/path/to/your/home/dir + +Like PREFIX, it sets several INSTALL* attributes at once. Unlike +PREFIX it is easy to predict where the module will end up. The +installation pattern looks like this: + + INSTALLARCHLIB INSTALL_BASE/lib/perl5/$Config{archname} + INSTALLPRIVLIB INSTALL_BASE/lib/perl5 + INSTALLBIN INSTALL_BASE/bin + INSTALLSCRIPT INSTALL_BASE/bin + INSTALLMAN1DIR INSTALL_BASE/man/man1 + INSTALLMAN3DIR INSTALL_BASE/man/man3 + +INSTALL_BASE in MakeMaker and C<--install_base> in Module::Build (as +of 0.28) install to the same location. If you want MakeMaker and +Module::Build to install to the same location simply set INSTALL_BASE +and C<--install_base> to the same location. + +INSTALL_BASE was added in 6.31. + + +=head2 PREFIX and LIB attribute + +PREFIX and LIB can be used to set several INSTALL* attributes in one +go. Here's an example for installing into your home directory. + + # Unix users, PREFIX=~ works fine + perl Makefile.PL PREFIX=/path/to/your/home/dir + +This will install all files in the module under your home directory, +with man pages and libraries going into an appropriate place (usually +~/man and ~/lib). How the exact location is determined is complicated +and depends on how your Perl was configured. INSTALL_BASE works more +like what other build systems call "prefix" than PREFIX and we +recommend you use that instead. + +Another way to specify many INSTALL directories with a single +parameter is LIB. + + perl Makefile.PL LIB=~/lib + +This will install the module's architecture-independent files into +~/lib, the architecture-dependent files into ~/lib/$archname. + +Note, that in both cases the tilde expansion is done by MakeMaker, not +by perl by default, nor by make. + +Conflicts between parameters LIB, PREFIX and the various INSTALL* +arguments are resolved so that: + +=over 4 + +=item * + +setting LIB overrides any setting of INSTALLPRIVLIB, INSTALLARCHLIB, +INSTALLSITELIB, INSTALLSITEARCH (and they are not affected by PREFIX); + +=item * + +without LIB, setting PREFIX replaces the initial C<$Config{prefix}> +part of those INSTALL* arguments, even if the latter are explicitly +set (but are set to still start with C<$Config{prefix}>). + +=back + +If the user has superuser privileges, and is not working on AFS or +relatives, then the defaults for INSTALLPRIVLIB, INSTALLARCHLIB, +INSTALLSCRIPT, etc. will be appropriate, and this incantation will be +the best: + + perl Makefile.PL; + make; + make test + make install + +make install by default writes some documentation of what has been +done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature +can be bypassed by calling make pure_install. + +=head2 AFS users + +will have to specify the installation directories as these most +probably have changed since perl itself has been installed. They will +have to do this by calling + + perl Makefile.PL INSTALLSITELIB=/afs/here/today \ + INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages + make + +Be careful to repeat this procedure every time you recompile an +extension, unless you are sure the AFS installation directories are +still valid. + +=head2 Static Linking of a new Perl Binary + +An extension that is built with the above steps is ready to use on +systems supporting dynamic loading. On systems that do not support +dynamic loading, any newly created extension has to be linked together +with the available resources. MakeMaker supports the linking process +by creating appropriate targets in the Makefile whenever an extension +is built. You can invoke the corresponding section of the makefile with + + make perl + +That produces a new perl binary in the current directory with all +extensions linked in that can be found in INST_ARCHLIB, SITELIBEXP, +and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on +UNIX, this is called F<Makefile.aperl> (may be system dependent). If you +want to force the creation of a new perl, it is recommended that you +delete this F<Makefile.aperl>, so the directories are searched through +for linkable libraries again. + +The binary can be installed into the directory where perl normally +resides on your machine with + + make inst_perl + +To produce a perl binary with a different name than C<perl>, either say + + perl Makefile.PL MAP_TARGET=myperl + make myperl + make inst_perl + +or say + + perl Makefile.PL + make myperl MAP_TARGET=myperl + make inst_perl MAP_TARGET=myperl + +In any case you will be prompted with the correct invocation of the +C<inst_perl> target that installs the new binary into INSTALLBIN. + +make inst_perl by default writes some documentation of what has been +done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This +can be bypassed by calling make pure_inst_perl. + +Warning: the inst_perl: target will most probably overwrite your +existing perl binary. Use with care! + +Sometimes you might want to build a statically linked perl although +your system supports dynamic loading. In this case you may explicitly +set the linktype with the invocation of the Makefile.PL or make: + + perl Makefile.PL LINKTYPE=static # recommended + +or + + make LINKTYPE=static # works on most systems + +=head2 Determination of Perl Library and Installation Locations + +MakeMaker needs to know, or to guess, where certain things are +located. Especially INST_LIB and INST_ARCHLIB (where to put the files +during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read +existing modules from), and PERL_INC (header files and C<libperl*.*>). + +Extensions may be built either using the contents of the perl source +directory tree or from the installed perl library. The recommended way +is to build extensions after you have run 'make install' on perl +itself. You can do that in any directory on your hard disk that is not +below the perl source tree. The support for extensions below the ext +directory of the perl distribution is only good for the standard +extensions that come with perl. + +If an extension is being built below the C<ext/> directory of the perl +source then MakeMaker will set PERL_SRC automatically (e.g., +C<../..>). If PERL_SRC is defined and the extension is recognized as +a standard extension, then other variables default to the following: + + PERL_INC = PERL_SRC + PERL_LIB = PERL_SRC/lib + PERL_ARCHLIB = PERL_SRC/lib + INST_LIB = PERL_LIB + INST_ARCHLIB = PERL_ARCHLIB + +If an extension is being built away from the perl source then MakeMaker +will leave PERL_SRC undefined and default to using the installed copy +of the perl library. The other variables default to the following: + + PERL_INC = $archlibexp/CORE + PERL_LIB = $privlibexp + PERL_ARCHLIB = $archlibexp + INST_LIB = ./blib/lib + INST_ARCHLIB = ./blib/arch + +If perl has not yet been installed then PERL_SRC can be defined on the +command line as shown in the previous section. + + +=head2 Which architecture dependent directory? + +If you don't want to keep the defaults for the INSTALL* macros, +MakeMaker helps you to minimize the typing needed: the usual +relationship between INSTALLPRIVLIB and INSTALLARCHLIB is determined +by Configure at perl compilation time. MakeMaker supports the user who +sets INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not, +then MakeMaker defaults the latter to be the same subdirectory of +INSTALLPRIVLIB as Configure decided for the counterparts in %Config, +otherwise it defaults to INSTALLPRIVLIB. The same relationship holds +for INSTALLSITELIB and INSTALLSITEARCH. + +MakeMaker gives you much more freedom than needed to configure +internal variables and get different results. It is worth mentioning +that make(1) also lets you configure most of the variables that are +used in the Makefile. But in the majority of situations this will not +be necessary, and should only be done if the author of a package +recommends it (or you know what you're doing). + +=head2 Using Attributes and Parameters + +The following attributes may be specified as arguments to WriteMakefile() +or as NAME=VALUE pairs on the command line. Attributes that became +available with later versions of MakeMaker are indicated. + +In order to maintain portability of attributes with older versions of +MakeMaker you may want to use L<App::EUMM::Upgrade> with your C<Makefile.PL>. + +=over 2 + +=item ABSTRACT + +One line description of the module. Will be included in PPD file. + +=item ABSTRACT_FROM + +Name of the file that contains the package description. MakeMaker looks +for a line in the POD matching /^($package\s-\s)(.*)/. This is typically +the first line in the "=head1 NAME" section. $2 becomes the abstract. + +=item AUTHOR + +Array of strings containing name (and email address) of package author(s). +Is used in CPAN Meta files (META.yml or META.json) and PPD +(Perl Package Description) files for PPM (Perl Package Manager). + +=item BINARY_LOCATION + +Used when creating PPD files for binary packages. It can be set to a +full or relative path or URL to the binary archive for a particular +architecture. For example: + + perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz + +builds a PPD package that references a binary of the C<Agent> package, +located in the C<x86> directory relative to the PPD itself. + +=item BUILD_REQUIRES + +Available in version 6.55_03 and above. + +A hash of modules that are needed to build your module but not run it. + +This will go into the C<build_requires> field of your F<META.yml> and the C<build> of the C<prereqs> field of your F<META.json>. + +Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> if this attribute is not specified. + +The format is the same as PREREQ_PM. + +=item C + +Ref to array of *.c file names. Initialised from a directory scan +and the values portion of the XS attribute hash. This is not +currently used by MakeMaker but may be handy in Makefile.PLs. + +=item CCFLAGS + +String that will be included in the compiler call command line between +the arguments INC and OPTIMIZE. + +=item CONFIG + +Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from +config.sh. MakeMaker will add to CONFIG the following values anyway: +ar +cc +cccdlflags +ccdlflags +dlext +dlsrc +ld +lddlflags +ldflags +libc +lib_ext +obj_ext +ranlib +sitelibexp +sitearchexp +so + +=item CONFIGURE + +CODE reference. The subroutine should return a hash reference. The +hash may contain further attributes, e.g. {LIBS =E<gt> ...}, that have to +be determined by some evaluation method. + +=item CONFIGURE_REQUIRES + +Available in version 6.52 and above. + +A hash of modules that are required to run Makefile.PL itself, but not +to run your distribution. + +This will go into the C<configure_requires> field of your F<META.yml> and the C<configure> of the C<prereqs> field of your F<META.json>. + +Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> if this attribute is not specified. + +The format is the same as PREREQ_PM. + +=item DEFINE + +Something like C<"-DHAVE_UNISTD_H"> + +=item DESTDIR + +This is the root directory into which the code will be installed. It +I<prepends itself to the normal prefix>. For example, if your code +would normally go into F</usr/local/lib/perl> you could set DESTDIR=~/tmp/ +and installation would go into F<~/tmp/usr/local/lib/perl>. + +This is primarily of use for people who repackage Perl modules. + +NOTE: Due to the nature of make, it is important that you put the trailing +slash on your DESTDIR. F<~/tmp/> not F<~/tmp>. + +=item DIR + +Ref to array of subdirectories containing Makefile.PLs e.g. ['sdbm'] +in ext/SDBM_File + +=item DISTNAME + +A safe filename for the package. + +Defaults to NAME below but with :: replaced with -. + +For example, Foo::Bar becomes Foo-Bar. + +=item DISTVNAME + +Your name for distributing the package with the version number +included. This is used by 'make dist' to name the resulting archive +file. + +Defaults to DISTNAME-VERSION. + +For example, version 1.04 of Foo::Bar becomes Foo-Bar-1.04. + +On some OS's where . has special meaning VERSION_SYM may be used in +place of VERSION. + +=item DLEXT + +Specifies the extension of the module's loadable object. For example: + + DLEXT => 'unusual_ext', # Default value is $Config{so} + +NOTE: When using this option to alter the extension of a module's +loadable object, it is also necessary that the module's pm file +specifies the same change: + + local $DynaLoader::dl_dlext = 'unusual_ext'; + +=item DL_FUNCS + +Hashref of symbol names for routines to be made available as universal +symbols. Each key/value pair consists of the package name and an +array of routine names in that package. Used only under AIX, OS/2, +VMS and Win32 at present. The routine names supplied will be expanded +in the same way as XSUB names are expanded by the XS() macro. +Defaults to + + {"$(NAME)" => ["boot_$(NAME)" ] } + +e.g. + + {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )], + "NetconfigPtr" => [ 'DESTROY'] } + +Please see the L<ExtUtils::Mksymlists> documentation for more information +about the DL_FUNCS, DL_VARS and FUNCLIST attributes. + +=item DL_VARS + +Array of symbol names for variables to be made available as universal symbols. +Used only under AIX, OS/2, VMS and Win32 at present. Defaults to []. +(e.g. [ qw(Foo_version Foo_numstreams Foo_tree ) ]) + +=item EXCLUDE_EXT + +Array of extension names to exclude when doing a static build. This +is ignored if INCLUDE_EXT is present. Consult INCLUDE_EXT for more +details. (e.g. [ qw( Socket POSIX ) ] ) + +This attribute may be most useful when specified as a string on the +command line: perl Makefile.PL EXCLUDE_EXT='Socket Safe' + +=item EXE_FILES + +Ref to array of executable files. The files will be copied to the +INST_SCRIPT directory. Make realclean will delete them from there +again. + +If your executables start with something like #!perl or +#!/usr/bin/perl MakeMaker will change this to the path of the perl +'Makefile.PL' was invoked with so the programs will be sure to run +properly even if perl is not in /usr/bin/perl. + +=item FIRST_MAKEFILE + +The name of the Makefile to be produced. This is used for the second +Makefile that will be produced for the MAP_TARGET. + +Defaults to 'Makefile' or 'Descrip.MMS' on VMS. + +(Note: we couldn't use MAKEFILE because dmake uses this for something +else). + +=item FULLPERL + +Perl binary able to run this extension, load XS modules, etc... + +=item FULLPERLRUN + +Like PERLRUN, except it uses FULLPERL. + +=item FULLPERLRUNINST + +Like PERLRUNINST, except it uses FULLPERL. + +=item FUNCLIST + +This provides an alternate means to specify function names to be +exported from the extension. Its value is a reference to an +array of function names to be exported by the extension. These +names are passed through unaltered to the linker options file. + +=item H + +Ref to array of *.h file names. Similar to C. + +=item IMPORTS + +This attribute is used to specify names to be imported into the +extension. Takes a hash ref. + +It is only used on OS/2 and Win32. + +=item INC + +Include file dirs eg: C<"-I/usr/5include -I/path/to/inc"> + +=item INCLUDE_EXT + +Array of extension names to be included when doing a static build. +MakeMaker will normally build with all of the installed extensions when +doing a static build, and that is usually the desired behavior. If +INCLUDE_EXT is present then MakeMaker will build only with those extensions +which are explicitly mentioned. (e.g. [ qw( Socket POSIX ) ]) + +It is not necessary to mention DynaLoader or the current extension when +filling in INCLUDE_EXT. If the INCLUDE_EXT is mentioned but is empty then +only DynaLoader and the current extension will be included in the build. + +This attribute may be most useful when specified as a string on the +command line: perl Makefile.PL INCLUDE_EXT='POSIX Socket Devel::Peek' + +=item INSTALLARCHLIB + +Used by 'make install', which copies files from INST_ARCHLIB to this +directory if INSTALLDIRS is set to perl. + +=item INSTALLBIN + +Directory to install binary files (e.g. tkperl) into if +INSTALLDIRS=perl. + +=item INSTALLDIRS + +Determines which of the sets of installation directories to choose: +perl, site or vendor. Defaults to site. + +=item INSTALLMAN1DIR + +=item INSTALLMAN3DIR + +These directories get the man pages at 'make install' time if +INSTALLDIRS=perl. Defaults to $Config{installman*dir}. + +If set to 'none', no man pages will be installed. + +=item INSTALLPRIVLIB + +Used by 'make install', which copies files from INST_LIB to this +directory if INSTALLDIRS is set to perl. + +Defaults to $Config{installprivlib}. + +=item INSTALLSCRIPT + +Available in version 6.30_02 and above. + +Used by 'make install' which copies files from INST_SCRIPT to this +directory if INSTALLDIRS=perl. + +=item INSTALLSITEARCH + +Used by 'make install', which copies files from INST_ARCHLIB to this +directory if INSTALLDIRS is set to site (default). + +=item INSTALLSITEBIN + +Used by 'make install', which copies files from INST_BIN to this +directory if INSTALLDIRS is set to site (default). + +=item INSTALLSITELIB + +Used by 'make install', which copies files from INST_LIB to this +directory if INSTALLDIRS is set to site (default). + +=item INSTALLSITEMAN1DIR + +=item INSTALLSITEMAN3DIR + +These directories get the man pages at 'make install' time if +INSTALLDIRS=site (default). Defaults to +$(SITEPREFIX)/man/man$(MAN*EXT). + +If set to 'none', no man pages will be installed. + +=item INSTALLSITESCRIPT + +Used by 'make install' which copies files from INST_SCRIPT to this +directory if INSTALLDIRS is set to site (default). + +=item INSTALLVENDORARCH + +Used by 'make install', which copies files from INST_ARCHLIB to this +directory if INSTALLDIRS is set to vendor. Note that if you do not set +this, the value of INSTALLVENDORLIB will be used, which is probably not +what you want. + +=item INSTALLVENDORBIN + +Used by 'make install', which copies files from INST_BIN to this +directory if INSTALLDIRS is set to vendor. + +=item INSTALLVENDORLIB + +Used by 'make install', which copies files from INST_LIB to this +directory if INSTALLDIRS is set to vendor. + +=item INSTALLVENDORMAN1DIR + +=item INSTALLVENDORMAN3DIR + +These directories get the man pages at 'make install' time if +INSTALLDIRS=vendor. Defaults to $(VENDORPREFIX)/man/man$(MAN*EXT). + +If set to 'none', no man pages will be installed. + +=item INSTALLVENDORSCRIPT + +Available in version 6.30_02 and above. + +Used by 'make install' which copies files from INST_SCRIPT to this +directory if INSTALLDIRS is set to vendor. + +=item INST_ARCHLIB + +Same as INST_LIB for architecture dependent files. + +=item INST_BIN + +Directory to put real binary files during 'make'. These will be copied +to INSTALLBIN during 'make install' + +=item INST_LIB + +Directory where we put library files of this extension while building +it. + +=item INST_MAN1DIR + +Directory to hold the man pages at 'make' time + +=item INST_MAN3DIR + +Directory to hold the man pages at 'make' time + +=item INST_SCRIPT + +Directory where executable files should be installed during +'make'. Defaults to "./blib/script", just to have a dummy location during +testing. make install will copy the files in INST_SCRIPT to +INSTALLSCRIPT. + +=item LD + +Program to be used to link libraries for dynamic loading. + +Defaults to $Config{ld}. + +=item LDDLFLAGS + +Any special flags that might need to be passed to ld to create a +shared library suitable for dynamic loading. It is up to the makefile +to use it. (See L<Config/lddlflags>) + +Defaults to $Config{lddlflags}. + +=item LDFROM + +Defaults to "$(OBJECT)" and is used in the ld command to specify +what files to link/load from (also see dynamic_lib below for how to +specify ld flags) + +=item LIB + +LIB should only be set at C<perl Makefile.PL> time but is allowed as a +MakeMaker argument. It has the effect of setting both INSTALLPRIVLIB +and INSTALLSITELIB to that value regardless any explicit setting of +those arguments (or of PREFIX). INSTALLARCHLIB and INSTALLSITEARCH +are set to the corresponding architecture subdirectory. + +=item LIBPERL_A + +The filename of the perllibrary that will be used together with this +extension. Defaults to libperl.a. + +=item LIBS + +An anonymous array of alternative library +specifications to be searched for (in order) until +at least one library is found. E.g. + + 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"] + +Mind, that any element of the array +contains a complete set of arguments for the ld +command. So do not specify + + 'LIBS' => ["-ltcl", "-ltk", "-lX11"] + +See ODBM_File/Makefile.PL for an example, where an array is needed. If +you specify a scalar as in + + 'LIBS' => "-ltcl -ltk -lX11" + +MakeMaker will turn it into an array with one element. + +=item LICENSE + +Available in version 6.31 and above. + +The licensing terms of your distribution. Generally it's "perl_5" for the +same license as Perl itself. + +See L<CPAN::Meta::Spec> for the list of options. + +Defaults to "unknown". + +=item LINKTYPE + +'static' or 'dynamic' (default unless usedl=undef in +config.sh). Should only be used to force static linking (also see +linkext below). + +=item MAGICXS + +Available in version 6.8305 and above. + +When this is set to C<1>, C<OBJECT> will be automagically derived from +C<O_FILES>. + +=item MAKE + +Available in version 6.30_01 and above. + +Variant of make you intend to run the generated Makefile with. This +parameter lets Makefile.PL know what make quirks to account for when +generating the Makefile. + +MakeMaker also honors the MAKE environment variable. This parameter +takes precedence. + +Currently the only significant values are 'dmake' and 'nmake' for Windows +users, instructing MakeMaker to generate a Makefile in the flavour of +DMake ("Dennis Vadura's Make") or Microsoft NMake respectively. + +Defaults to $Config{make}, which may go looking for a Make program +in your environment. + +How are you supposed to know what flavour of Make a Makefile has +been generated for if you didn't specify a value explicitly? Search +the generated Makefile for the definition of the MAKE variable, +which is used to recursively invoke the Make utility. That will tell +you what Make you're supposed to invoke the Makefile with. + +=item MAKEAPERL + +Boolean which tells MakeMaker that it should include the rules to +make a perl. This is handled automatically as a switch by +MakeMaker. The user normally does not need it. + +=item MAKEFILE_OLD + +When 'make clean' or similar is run, the $(FIRST_MAKEFILE) will be +backed up at this location. + +Defaults to $(FIRST_MAKEFILE).old or $(FIRST_MAKEFILE)_old on VMS. + +=item MAN1PODS + +Hashref of pod-containing files. MakeMaker will default this to all +EXE_FILES files that include POD directives. The files listed +here will be converted to man pages and installed as was requested +at Configure time. + +This hash should map POD files (or scripts containing POD) to the +man file names under the C<blib/man1/> directory, as in the following +example: + + MAN1PODS => { + 'doc/command.pod' => 'blib/man1/command.1', + 'scripts/script.pl' => 'blib/man1/script.1', + } + +=item MAN3PODS + +Hashref that assigns to *.pm and *.pod files the files into which the +manpages are to be written. MakeMaker parses all *.pod and *.pm files +for POD directives. Files that contain POD will be the default keys of +the MAN3PODS hashref. These will then be converted to man pages during +C<make> and will be installed during C<make install>. + +Example similar to MAN1PODS. + +=item MAP_TARGET + +If it is intended that a new perl binary be produced, this variable +may hold a name for that binary. Defaults to perl + +=item META_ADD + +=item META_MERGE + +Available in version 6.46 and above. + +A hashref of items to add to the CPAN Meta file (F<META.yml> or +F<META.json>). + +They differ in how they behave if they have the same key as the +default metadata. META_ADD will override the default value with its +own. META_MERGE will merge its value with the default. + +Unless you want to override the defaults, prefer META_MERGE so as to +get the advantage of any future defaults. + +Where prereqs are concerned, if META_MERGE is used, prerequisites are merged +with their counterpart C<WriteMakefile()> argument +(PREREQ_PM is merged into {prereqs}{runtime}{requires}, +BUILD_REQUIRES into C<{prereqs}{build}{requires}>, +CONFIGURE_REQUIRES into C<{prereqs}{configure}{requires}>, +and TEST_REQUIRES into C<{prereqs}{test}{requires})>. +When prereqs are specified with META_ADD, the only prerequisites added to the +file come from the metadata, not C<WriteMakefile()> arguments. + +Note that these configuration options are only used for generating F<META.yml> +and F<META.json> -- they are NOT used for F<MYMETA.yml> and F<MYMETA.json>. +Therefore data in these fields should NOT be used for dynamic (user-side) +configuration. + +By default CPAN Meta specification C<1.4> is used. In order to use +CPAN Meta specification C<2.0>, indicate with C<meta-spec> the version +you want to use. + + META_MERGE => { + + "meta-spec" => { version => 2 }, + + resources => { + + repository => { + type => 'git', + url => 'git://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker.git', + web => 'https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker', + }, + + }, + + }, + +=item MIN_PERL_VERSION + +Available in version 6.48 and above. + +The minimum required version of Perl for this distribution. + +Either the 5.006001 or the 5.6.1 format is acceptable. + +=item MYEXTLIB + +If the extension links to a library that it builds, set this to the +name of the library (see SDBM_File) + +=item NAME + +The package representing the distribution. For example, C<Test::More> +or C<ExtUtils::MakeMaker>. It will be used to derive information about +the distribution such as the L</DISTNAME>, installation locations +within the Perl library and where XS files will be looked for by +default (see L</XS>). + +C<NAME> I<must> be a valid Perl package name and it I<must> have an +associated C<.pm> file. For example, C<Foo::Bar> is a valid C<NAME> +and there must exist F<Foo/Bar.pm>. Any XS code should be in +F<Bar.xs> unless stated otherwise. + +Your distribution B<must> have a C<NAME>. + +=item NEEDS_LINKING + +MakeMaker will figure out if an extension contains linkable code +anywhere down the directory tree, and will set this variable +accordingly, but you can speed it up a very little bit if you define +this boolean variable yourself. + +=item NOECHO + +Command so make does not print the literal commands it's running. + +By setting it to an empty string you can generate a Makefile that +prints all commands. Mainly used in debugging MakeMaker itself. + +Defaults to C<@>. + +=item NORECURS + +Boolean. Attribute to inhibit descending into subdirectories. + +=item NO_META + +When true, suppresses the generation and addition to the MANIFEST of +the META.yml and META.json module meta-data files during 'make distdir'. + +Defaults to false. + +=item NO_MYMETA + +Available in version 6.57_02 and above. + +When true, suppresses the generation of MYMETA.yml and MYMETA.json module +meta-data files during 'perl Makefile.PL'. + +Defaults to false. + +=item NO_PACKLIST + +Available in version 6.7501 and above. + +When true, suppresses the writing of C<packlist> files for installs. + +Defaults to false. + +=item NO_PERLLOCAL + +Available in version 6.7501 and above. + +When true, suppresses the appending of installations to C<perllocal>. + +Defaults to false. + +=item NO_VC + +In general, any generated Makefile checks for the current version of +MakeMaker and the version the Makefile was built under. If NO_VC is +set, the version check is neglected. Do not write this into your +Makefile.PL, use it interactively instead. + +=item OBJECT + +List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long +string or an array containing all object files, e.g. "tkpBind.o +tkpButton.o tkpCanvas.o" or ["tkpBind.o", "tkpButton.o", "tkpCanvas.o"] + +(Where BASEEXT is the last component of NAME, and OBJ_EXT is $Config{obj_ext}.) + +=item OPTIMIZE + +Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is +passed to subdirectory makes. + +=item PERL + +Perl binary for tasks that can be done by miniperl. If it contains +spaces or other shell metacharacters, it needs to be quoted in a way +that protects them, since this value is intended to be inserted in a +shell command line in the Makefile. E.g.: + + # Perl executable lives in "C:/Program Files/Perl/bin" + # Normally you don't need to set this yourself! + $ perl Makefile.PL PERL='"C:/Program Files/Perl/bin/perl.exe" -w' + +=item PERL_CORE + +Set only when MakeMaker is building the extensions of the Perl core +distribution. + +=item PERLMAINCC + +The call to the program that is able to compile perlmain.c. Defaults +to $(CC). + +=item PERL_ARCHLIB + +Same as for PERL_LIB, but for architecture dependent files. + +Used only when MakeMaker is building the extensions of the Perl core +distribution (because normally $(PERL_ARCHLIB) is automatically in @INC, +and adding it would get in the way of PERL5LIB). + +=item PERL_LIB + +Directory containing the Perl library to use. + +Used only when MakeMaker is building the extensions of the Perl core +distribution (because normally $(PERL_LIB) is automatically in @INC, +and adding it would get in the way of PERL5LIB). + +=item PERL_MALLOC_OK + +defaults to 0. Should be set to TRUE if the extension can work with +the memory allocation routines substituted by the Perl malloc() subsystem. +This should be applicable to most extensions with exceptions of those + +=over 4 + +=item * + +with bugs in memory allocations which are caught by Perl's malloc(); + +=item * + +which interact with the memory allocator in other ways than via +malloc(), realloc(), free(), calloc(), sbrk() and brk(); + +=item * + +which rely on special alignment which is not provided by Perl's malloc(). + +=back + +B<NOTE.> Neglecting to set this flag in I<any one> of the loaded extension +nullifies many advantages of Perl's malloc(), such as better usage of +system resources, error detection, memory usage reporting, catchable failure +of memory allocations, etc. + +=item PERLPREFIX + +Directory under which core modules are to be installed. + +Defaults to $Config{installprefixexp}, falling back to +$Config{installprefix}, $Config{prefixexp} or $Config{prefix} should +$Config{installprefixexp} not exist. + +Overridden by PREFIX. + +=item PERLRUN + +Use this instead of $(PERL) when you wish to run perl. It will set up +extra necessary flags for you. + +=item PERLRUNINST + +Use this instead of $(PERL) when you wish to run perl to work with +modules. It will add things like -I$(INST_ARCH) and other necessary +flags so perl can see the modules you're about to install. + +=item PERL_SRC + +Directory containing the Perl source code (use of this should be +avoided, it may be undefined) + +=item PERM_DIR + +Available in version 6.51_01 and above. + +Desired permission for directories. Defaults to C<755>. + +=item PERM_RW + +Desired permission for read/writable files. Defaults to C<644>. + +=item PERM_RWX + +Desired permission for executable files. Defaults to C<755>. + +=item PL_FILES + +MakeMaker can run programs to generate files for you at build time. +By default any file named *.PL (except Makefile.PL and Build.PL) in +the top level directory will be assumed to be a Perl program and run +passing its own basename in as an argument. This basename is actually a build +target, and there is an intention, but not a requirement, that the *.PL file +make the file passed to to as an argument. For example... + + perl foo.PL foo + +This behavior can be overridden by supplying your own set of files to +search. PL_FILES accepts a hash ref, the key being the file to run +and the value is passed in as the first argument when the PL file is run. + + PL_FILES => {'bin/foobar.PL' => 'bin/foobar'} + + PL_FILES => {'foo.PL' => 'foo.c'} + +Would run bin/foobar.PL like this: + + perl bin/foobar.PL bin/foobar + +If multiple files from one program are desired an array ref can be used. + + PL_FILES => {'bin/foobar.PL' => [qw(bin/foobar1 bin/foobar2)]} + +In this case the program will be run multiple times using each target file. + + perl bin/foobar.PL bin/foobar1 + perl bin/foobar.PL bin/foobar2 + +If an output file depends on extra input files beside the script itself, +a hash ref can be used in version 7.36 and above: + + PL_FILES => { 'foo.PL' => { + 'foo.out' => 'foo.in', + 'bar.out' => [qw(bar1.in bar2.in)], + } + +In this case the extra input files will be passed to the program after +the target file: + + perl foo.PL foo.out foo.in + perl foo.PL bar.out bar1.in bar2.in + +PL files are normally run B<after> pm_to_blib and include INST_LIB and +INST_ARCH in their C<@INC>, so the just built modules can be +accessed... unless the PL file is making a module (or anything else in +PM) in which case it is run B<before> pm_to_blib and does not include +INST_LIB and INST_ARCH in its C<@INC>. This apparently odd behavior +is there for backwards compatibility (and it's somewhat DWIM). The argument +passed to the .PL is set up as a target to build in the Makefile. In other +sections such as C<postamble> you can specify a dependency on the +filename/argument that the .PL is supposed (or will have, now that that is +is a dependency) to generate. Note the file to be generated will still be +generated and the .PL will still run even without an explicit dependency created +by you, since the C<all> target still depends on running all eligible to run.PL +files. + +=item PM + +Hashref of .pm files and *.pl files to be installed. e.g. + + {'name_of_file.pm' => '$(INST_LIB)/install_as.pm'} + +By default this will include *.pm and *.pl and the files found in +the PMLIBDIRS directories. Defining PM in the +Makefile.PL will override PMLIBDIRS. + +=item PMLIBDIRS + +Ref to array of subdirectories containing library files. Defaults to +[ 'lib', $(BASEEXT) ]. The directories will be scanned and I<any> files +they contain will be installed in the corresponding location in the +library. A libscan() method can be used to alter the behaviour. +Defining PM in the Makefile.PL will override PMLIBDIRS. + +(Where BASEEXT is the last component of NAME.) + +=item PM_FILTER + +A filter program, in the traditional Unix sense (input from stdin, output +to stdout) that is passed on each .pm file during the build (in the +pm_to_blib() phase). It is empty by default, meaning no filtering is done. +You could use: + + PM_FILTER => 'perl -ne "print unless /^\\#/"', + +to remove all the leading comments on the fly during the build. In order +to be as portable as possible, please consider using a Perl one-liner +rather than Unix (or other) utilities, as above. The # is escaped for +the Makefile, since what is going to be generated will then be: + + PM_FILTER = perl -ne "print unless /^\#/" + +Without the \ before the #, we'd have the start of a Makefile comment, +and the macro would be incorrectly defined. + +You will almost certainly be better off using the C<PL_FILES> system, +instead. See above, or the L<ExtUtils::MakeMaker::FAQ> entry. + +=item POLLUTE + +Release 5.005 grandfathered old global symbol names by providing preprocessor +macros for extension source compatibility. As of release 5.6, these +preprocessor definitions are not available by default. The POLLUTE flag +specifies that the old names should still be defined: + + perl Makefile.PL POLLUTE=1 + +Please inform the module author if this is necessary to successfully install +a module under 5.6 or later. + +=item PPM_INSTALL_EXEC + +Name of the executable used to run C<PPM_INSTALL_SCRIPT> below. (e.g. perl) + +=item PPM_INSTALL_SCRIPT + +Name of the script that gets executed by the Perl Package Manager after +the installation of a package. + +=item PPM_UNINSTALL_EXEC + +Available in version 6.8502 and above. + +Name of the executable used to run C<PPM_UNINSTALL_SCRIPT> below. (e.g. perl) + +=item PPM_UNINSTALL_SCRIPT + +Available in version 6.8502 and above. + +Name of the script that gets executed by the Perl Package Manager before +the removal of a package. + +=item PREFIX + +This overrides all the default install locations. Man pages, +libraries, scripts, etc... MakeMaker will try to make an educated +guess about where to place things under the new PREFIX based on your +Config defaults. Failing that, it will fall back to a structure +which should be sensible for your platform. + +If you specify LIB or any INSTALL* variables they will not be affected +by the PREFIX. + +=item PREREQ_FATAL + +Bool. If this parameter is true, failing to have the required modules +(or the right versions thereof) will be fatal. C<perl Makefile.PL> +will C<die> instead of simply informing the user of the missing dependencies. + +It is I<extremely> rare to have to use C<PREREQ_FATAL>. Its use by module +authors is I<strongly discouraged> and should never be used lightly. + +For dependencies that are required in order to run C<Makefile.PL>, +see C<CONFIGURE_REQUIRES>. + +Module installation tools have ways of resolving unmet dependencies but +to do that they need a F<Makefile>. Using C<PREREQ_FATAL> breaks this. +That's bad. + +Assuming you have good test coverage, your tests should fail with +missing dependencies informing the user more strongly that something +is wrong. You can write a F<t/00compile.t> test which will simply +check that your code compiles and stop "make test" prematurely if it +doesn't. See L<Test::More/BAIL_OUT> for more details. + + +=item PREREQ_PM + +A hash of modules that are needed to run your module. The keys are +the module names ie. Test::More, and the minimum version is the +value. If the required version number is 0 any version will do. +The versions given may be a Perl v-string (see L<version>) or a range +(see L<CPAN::Meta::Requirements>). + +This will go into the C<requires> field of your F<META.yml> and the +C<runtime> of the C<prereqs> field of your F<META.json>. + + PREREQ_PM => { + # Require Test::More at least 0.47 + "Test::More" => "0.47", + + # Require any version of Acme::Buffy + "Acme::Buffy" => 0, + } + +=item PREREQ_PRINT + +Bool. If this parameter is true, the prerequisites will be printed to +stdout and MakeMaker will exit. The output format is an evalable hash +ref. + + $PREREQ_PM = { + 'A::B' => Vers1, + 'C::D' => Vers2, + ... + }; + +If a distribution defines a minimal required perl version, this is +added to the output as an additional line of the form: + + $MIN_PERL_VERSION = '5.008001'; + +If BUILD_REQUIRES is not empty, it will be dumped as $BUILD_REQUIRES hashref. + +=item PRINT_PREREQ + +RedHatism for C<PREREQ_PRINT>. The output format is different, though: + + perl(A::B)>=Vers1 perl(C::D)>=Vers2 ... + +A minimal required perl version, if present, will look like this: + + perl(perl)>=5.008001 + +=item SITEPREFIX + +Like PERLPREFIX, but only for the site install locations. + +Defaults to $Config{siteprefixexp}. Perls prior to 5.6.0 didn't have +an explicit siteprefix in the Config. In those cases +$Config{installprefix} will be used. + +Overridable by PREFIX + +=item SIGN + +Available in version 6.18 and above. + +When true, perform the generation and addition to the MANIFEST of the +SIGNATURE file in the distdir during 'make distdir', via 'cpansign +-s'. + +Note that you need to install the Module::Signature module to +perform this operation. + +Defaults to false. + +=item SKIP + +Arrayref. E.g. [qw(name1 name2)] skip (do not write) sections of the +Makefile. Caution! Do not use the SKIP attribute for the negligible +speedup. It may seriously damage the resulting Makefile. Only use it +if you really need it. + +=item TEST_REQUIRES + +Available in version 6.64 and above. + +A hash of modules that are needed to test your module but not run or +build it. + +This will go into the C<build_requires> field of your F<META.yml> and the C<test> of the C<prereqs> field of your F<META.json>. + +The format is the same as PREREQ_PM. + +=item TYPEMAPS + +Ref to array of typemap file names. Use this when the typemaps are +in some directory other than the current directory or when they are +not named B<typemap>. The last typemap in the list takes +precedence. A typemap in the current directory has highest +precedence, even if it isn't listed in TYPEMAPS. The default system +typemap has lowest precedence. + +=item VENDORPREFIX + +Like PERLPREFIX, but only for the vendor install locations. + +Defaults to $Config{vendorprefixexp}. + +Overridable by PREFIX + +=item VERBINST + +If true, make install will be verbose + +=item VERSION + +Your version number for distributing the package. This defaults to +0.1. + +=item VERSION_FROM + +Instead of specifying the VERSION in the Makefile.PL you can let +MakeMaker parse a file to determine the version number. The parsing +routine requires that the file named by VERSION_FROM contains one +single line to compute the version number. The first line in the file +that contains something like a $VERSION assignment or C<package Name +VERSION> will be used. The following lines will be parsed o.k.: + + # Good + package Foo::Bar 1.23; # 1.23 + $VERSION = '1.00'; # 1.00 + *VERSION = \'1.01'; # 1.01 + ($VERSION) = q$Revision$ =~ /(\d+)/g; # The digits in $Revision$ + $FOO::VERSION = '1.10'; # 1.10 + *FOO::VERSION = \'1.11'; # 1.11 + +but these will fail: + + # Bad + my $VERSION = '1.01'; + local $VERSION = '1.02'; + local $FOO::VERSION = '1.30'; + +(Putting C<my> or C<local> on the preceding line will work o.k.) + +"Version strings" are incompatible and should not be used. + + # Bad + $VERSION = 1.2.3; + $VERSION = v1.2.3; + +L<version> objects are fine. As of MakeMaker 6.35 version.pm will be +automatically loaded, but you must declare the dependency on version.pm. +For compatibility with older MakeMaker you should load on the same line +as $VERSION is declared. + + # All on one line + use version; our $VERSION = qv(1.2.3); + +The file named in VERSION_FROM is not added as a dependency to +Makefile. This is not really correct, but it would be a major pain +during development to have to rewrite the Makefile for any smallish +change in that file. If you want to make sure that the Makefile +contains the correct VERSION macro after any change of the file, you +would have to do something like + + depend => { Makefile => '$(VERSION_FROM)' } + +See attribute C<depend> below. + +=item VERSION_SYM + +A sanitized VERSION with . replaced by _. For places where . has +special meaning (some filesystems, RCS labels, etc...) + +=item XS + +Hashref of .xs files. MakeMaker will default this. e.g. + + {'name_of_file.xs' => 'name_of_file.c'} + +The .c files will automatically be included in the list of files +deleted by a make clean. + +=item XSBUILD + +Available in version 7.12 and above. + +Hashref with options controlling the operation of C<XSMULTI>: + + { + xs => { + all => { + # options applying to all .xs files for this distribution + }, + 'lib/Class/Name/File' => { # specifically for this file + DEFINE => '-Dfunktastic', # defines for only this file + INC => "-I$funkyliblocation", # include flags for only this file + # OBJECT => 'lib/Class/Name/File$(OBJ_EXT)', # default + LDFROM => "lib/Class/Name/File\$(OBJ_EXT) $otherfile\$(OBJ_EXT)", # what's linked + }, + }, + } + +Note C<xs> is the file-extension. More possibilities may arise in the +future. Note that object names are specified without their XS extension. + +C<LDFROM> defaults to the same as C<OBJECT>. C<OBJECT> defaults to, +for C<XSMULTI>, just the XS filename with the extension replaced with +the compiler-specific object-file extension. + +The distinction between C<OBJECT> and C<LDFROM>: C<OBJECT> is the make +target, so make will try to build it. However, C<LDFROM> is what will +actually be linked together to make the shared object or static library +(SO/SL), so if you override it, make sure it includes what you want to +make the final SO/SL, almost certainly including the XS basename with +C<$(OBJ_EXT)> appended. + +=item XSMULTI + +Available in version 7.12 and above. + +When this is set to C<1>, multiple XS files may be placed under F<lib/> +next to their corresponding C<*.pm> files (this is essential for compiling +with the correct C<VERSION> values). This feature should be considered +experimental, and details of it may change. + +This feature was inspired by, and small portions of code copied from, +L<ExtUtils::MakeMaker::BigHelper>. Hopefully this feature will render +that module mainly obsolete. + +=item XSOPT + +String of options to pass to xsubpp. This might include C<-C++> or +C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for +that purpose. + +=item XSPROTOARG + +May be set to C<-protoypes>, C<-noprototypes> or the empty string. The +empty string is equivalent to the xsubpp default, or C<-noprototypes>. +See the xsubpp documentation for details. MakeMaker +defaults to the empty string. + +=item XS_VERSION + +Your version number for the .xs file of this package. This defaults +to the value of the VERSION attribute. + +=back + +=head2 Additional lowercase attributes + +can be used to pass parameters to the methods which implement that +part of the Makefile. Parameters are specified as a hash ref but are +passed to the method as a hash. + +=over 2 + +=item clean + + {FILES => "*.xyz foo"} + +=item depend + + {ANY_TARGET => ANY_DEPENDENCY, ...} + +(ANY_TARGET must not be given a double-colon rule by MakeMaker.) + +=item dist + + {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz', + SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip', + ZIPFLAGS => '-rl', DIST_DEFAULT => 'private tardist' } + +If you specify COMPRESS, then SUFFIX should also be altered, as it is +needed to tell make the target file of the compression. Setting +DIST_CP to ln can be useful, if you need to preserve the timestamps on +your files. DIST_CP can take the values 'cp', which copies the file, +'ln', which links the file, and 'best' which copies symbolic links and +links the rest. Default is 'best'. + +=item dynamic_lib + + {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'} + +=item linkext + + {LINKTYPE => 'static', 'dynamic' or ''} + +NB: Extensions that have nothing but *.pm files had to say + + {LINKTYPE => ''} + +with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line +can be deleted safely. MakeMaker recognizes when there's nothing to +be linked. + +=item macro + + {ANY_MACRO => ANY_VALUE, ...} + +=item postamble + +Anything put here will be passed to +L<MY::postamble()|ExtUtils::MM_Any/postamble (o)> if you have one. + +=item realclean + + {FILES => '$(INST_ARCHAUTODIR)/*.xyz'} + +=item test + +Specify the targets for testing. + + {TESTS => 't/*.t'} + +C<RECURSIVE_TEST_FILES> can be used to include all directories +recursively under C<t> that contain C<.t> files. It will be ignored if +you provide your own C<TESTS> attribute, defaults to false. + + {RECURSIVE_TEST_FILES=>1} + +This is supported since 6.76 + +=item tool_autosplit + + {MAXLEN => 8} + +=back + +=head2 Overriding MakeMaker Methods + +If you cannot achieve the desired Makefile behaviour by specifying +attributes you may define private subroutines in the Makefile.PL. +Each subroutine returns the text it wishes to have written to +the Makefile. To override a section of the Makefile you can +either say: + + sub MY::c_o { "new literal text" } + +or you can edit the default by saying something like: + + package MY; # so that "SUPER" works right + sub c_o { + my $inherited = shift->SUPER::c_o(@_); + $inherited =~ s/old text/new text/; + $inherited; + } + +If you are running experiments with embedding perl as a library into +other applications, you might find MakeMaker is not sufficient. You'd +better have a look at L<ExtUtils::Embed> which is a collection of utilities +for embedding. + +If you still need a different solution, try to develop another +subroutine that fits your needs and submit the diffs to +C<makemaker@perl.org> + +For a complete description of all MakeMaker methods see +L<ExtUtils::MM_Unix>. + +Here is a simple example of how to add a new target to the generated +Makefile: + + sub MY::postamble { + return <<'MAKE_FRAG'; + $(MYEXTLIB): sdbm/Makefile + cd sdbm && $(MAKE) all + + MAKE_FRAG + } + +=head2 The End Of Cargo Cult Programming + +WriteMakefile() now does some basic sanity checks on its parameters to +protect against typos and malformatted values. This means some things +which happened to work in the past will now throw warnings and +possibly produce internal errors. + +Some of the most common mistakes: + +=over 2 + +=item C<< MAN3PODS => ' ' >> + +This is commonly used to suppress the creation of man pages. MAN3PODS +takes a hash ref not a string, but the above worked by accident in old +versions of MakeMaker. + +The correct code is C<< MAN3PODS => { } >>. + +=back + + +=head2 Hintsfile support + +MakeMaker.pm uses the architecture-specific information from +Config.pm. In addition it evaluates architecture specific hints files +in a C<hints/> directory. The hints files are expected to be named +like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file +name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by +MakeMaker within the WriteMakefile() subroutine, and can be used to +execute commands as well as to include special variables. The rules +which hintsfile is chosen are the same as in Configure. + +The hintsfile is eval()ed immediately after the arguments given to +WriteMakefile are stuffed into a hash reference $self but before this +reference becomes blessed. So if you want to do the equivalent to +override or create an attribute you would say something like + + $self->{LIBS} = ['-ldbm -lucb -lc']; + +=head2 Distribution Support + +For authors of extensions MakeMaker provides several Makefile +targets. Most of the support comes from the L<ExtUtils::Manifest> module, +where additional documentation can be found. + +=over 4 + +=item make distcheck + +reports which files are below the build directory but not in the +MANIFEST file and vice versa. (See L<ExtUtils::Manifest/fullcheck> for +details) + +=item make skipcheck + +reports which files are skipped due to the entries in the +C<MANIFEST.SKIP> file (See L<ExtUtils::Manifest/skipcheck> for +details) + +=item make distclean + +does a realclean first and then the distcheck. Note that this is not +needed to build a new distribution as long as you are sure that the +MANIFEST file is ok. + +=item make veryclean + +does a realclean first and then removes backup files such as C<*~>, +C<*.bak>, C<*.old> and C<*.orig> + +=item make manifest + +rewrites the MANIFEST file, adding all remaining files found (See +L<ExtUtils::Manifest/mkmanifest> for details) + +=item make distdir + +Copies all the files that are in the MANIFEST file to a newly created +directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory +exists, it will be removed first. + +Additionally, it will create META.yml and META.json module meta-data file +in the distdir and add this to the distdir's MANIFEST. You can shut this +behavior off with the NO_META flag. + +=item make disttest + +Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and +a make test in that directory. + +=item make tardist + +First does a distdir. Then a command $(PREOP) which defaults to a null +command, followed by $(TO_UNIX), which defaults to a null command under +UNIX, and will convert files in distribution directory to UNIX format +otherwise. Next it runs C<tar> on that directory into a tarfile and +deletes the directory. Finishes with a command $(POSTOP) which +defaults to a null command. + +=item make dist + +Defaults to $(DIST_DEFAULT) which in turn defaults to tardist. + +=item make uutardist + +Runs a tardist first and uuencodes the tarfile. + +=item make shdist + +First does a distdir. Then a command $(PREOP) which defaults to a null +command. Next it runs C<shar> on that directory into a sharfile and +deletes the intermediate directory again. Finishes with a command +$(POSTOP) which defaults to a null command. Note: For shdist to work +properly a C<shar> program that can handle directories is mandatory. + +=item make zipdist + +First does a distdir. Then a command $(PREOP) which defaults to a null +command. Runs C<$(ZIP) $(ZIPFLAGS)> on that directory into a +zipfile. Then deletes that directory. Finishes with a command +$(POSTOP) which defaults to a null command. + +=item make ci + +Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file. + +=back + +Customization of the dist targets can be done by specifying a hash +reference to the dist attribute of the WriteMakefile call. The +following parameters are recognized: + + CI ('ci -u') + COMPRESS ('gzip --best') + POSTOP ('@ :') + PREOP ('@ :') + TO_UNIX (depends on the system) + RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):') + SHAR ('shar') + SUFFIX ('.gz') + TAR ('tar') + TARFLAGS ('cvf') + ZIP ('zip') + ZIPFLAGS ('-r') + +An example: + + WriteMakefile( + ...other options... + dist => { + COMPRESS => "bzip2", + SUFFIX => ".bz2" + } + ); + + +=head2 Module Meta-Data (META and MYMETA) + +Long plaguing users of MakeMaker based modules has been the problem of +getting basic information about the module out of the sources +I<without> running the F<Makefile.PL> and doing a bunch of messy +heuristics on the resulting F<Makefile>. Over the years, it has become +standard to keep this information in one or more CPAN Meta files +distributed with each distribution. + +The original format of CPAN Meta files was L<YAML> and the corresponding +file was called F<META.yml>. In 2010, version 2 of the L<CPAN::Meta::Spec> +was released, which mandates JSON format for the metadata in order to +overcome certain compatibility issues between YAML serializers and to +avoid breaking older clients unable to handle a new version of the spec. +The L<CPAN::Meta> library is now standard for accessing old and new-style +Meta files. + +If L<CPAN::Meta> is installed, MakeMaker will automatically generate +F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as +part of the 'distdir' target (and thus the 'dist' target). This is intended to +seamlessly and rapidly populate CPAN with module meta-data. If you wish to +shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true. + +At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agreed +to use the CPAN Meta format to communicate post-configuration requirements +between toolchain components. These files, F<MYMETA.json> and F<MYMETA.yml>, +are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta> +is installed). Clients like L<CPAN> or L<CPANPLUS> will read these +files to see what prerequisites must be fulfilled before building or testing +the distribution. If you wish to shut this feature off, set the C<NO_MYMETA> +C<WriteMakeFile()> flag to true. + +=head2 Disabling an extension + +If some events detected in F<Makefile.PL> imply that there is no way +to create the Module, but this is a normal state of things, then you +can create a F<Makefile> which does nothing, but succeeds on all the +"usual" build targets. To do so, use + + use ExtUtils::MakeMaker qw(WriteEmptyMakefile); + WriteEmptyMakefile(); + +instead of WriteMakefile(). + +This may be useful if other modules expect this module to be I<built> +OK, as opposed to I<work> OK (say, this system-dependent module builds +in a subdirectory of some other distribution, or is listed as a +dependency in a CPAN::Bundle, but the functionality is supported by +different means on the current architecture). + +=head2 Other Handy Functions + +=over 4 + +=item prompt + + my $value = prompt($message); + my $value = prompt($message, $default); + +The C<prompt()> function provides an easy way to request user input +used to write a makefile. It displays the $message as a prompt for +input. If a $default is provided it will be used as a default. The +function returns the $value selected by the user. + +If C<prompt()> detects that it is not running interactively and there +is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable +is set to true, the $default will be used without prompting. This +prevents automated processes from blocking on user input. + +If no $default is provided an empty string will be used instead. + +=item os_unsupported + + os_unsupported(); + os_unsupported if $^O eq 'MSWin32'; + +The C<os_unsupported()> function provides a way to correctly exit your +C<Makefile.PL> before calling C<WriteMakefile>. It is essentially a +C<die> with the message "OS unsupported". + +This is supported since 7.26 + +=back + +=head2 Supported versions of Perl + +Please note that while this module works on Perl 5.6, it is no longer +being routinely tested on 5.6 - the earliest Perl version being routinely +tested, and expressly supported, is 5.8.1. However, patches to repair +any breakage on 5.6 are still being accepted. + +=head1 ENVIRONMENT + +=over 4 + +=item PERL_MM_OPT + +Command line options used by C<MakeMaker-E<gt>new()>, and thus by +C<WriteMakefile()>. The string is split as the shell would, and the result +is processed before any actual command line arguments are processed. + + PERL_MM_OPT='CCFLAGS="-Wl,-rpath -Wl,/foo/bar/lib" LIBS="-lwibble -lwobble"' + +=item PERL_MM_USE_DEFAULT + +If set to a true value then MakeMaker's prompt function will +always return the default without waiting for user input. + +=item PERL_CORE + +Same as the PERL_CORE parameter. The parameter overrides this. + +=back + +=head1 SEE ALSO + +L<Module::Build> is a pure-Perl alternative to MakeMaker which does +not rely on make or any other external utility. It may be easier to +extend to suit your needs. + +L<Module::Build::Tiny> is a minimal pure-Perl alternative to MakeMaker +that follows the Build.PL protocol of Module::Build but without its +complexity and cruft, implementing only the installation of the module +and leaving authoring to L<mbtiny> or other authoring tools. + +L<Module::Install> is a (now discouraged) wrapper around MakeMaker which +adds features not normally available. + +L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to +help you setup your distribution. + +L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail. + +L<File::ShareDir::Install> makes it easy to install static, sometimes +also referred to as 'shared' files. L<File::ShareDir> helps accessing +the shared files after installation. L<Test::File::ShareDir> helps when +writing tests to use the shared files both before and after installation. + +L<Dist::Zilla> is an authoring tool which allows great customization and +extensibility of the author experience, relying on the existing install +tools like ExtUtils::MakeMaker only for installation. + +L<Dist::Milla> is a Dist::Zilla bundle that greatly simplifies common +usage. + +L<Minilla> is a minimal authoring tool that does the same things as +Dist::Milla without the overhead of Dist::Zilla. + +=head1 AUTHORS + +Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig +C<andreas.koenig@mind.de>, Tim Bunce C<timb@cpan.org>. VMS +support by Charles Bailey C<bailey@newman.upenn.edu>. OS/2 support +by Ilya Zakharevich C<ilya@math.ohio-state.edu>. + +Currently maintained by Michael G Schwern C<schwern@pobox.com> + +Send patches and ideas to C<makemaker@perl.org>. + +Send bug reports via http://rt.cpan.org/. Please send your +generated Makefile along with your report. + +For more up-to-date information, see L<https://metacpan.org/release/ExtUtils-MakeMaker>. + +Repository available at L<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker>. + +=head1 LICENSE + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See L<http://www.perl.com/perl/misc/Artistic.html> + + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Manifest.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Manifest.pm new file mode 100644 index 0000000000000000000000000000000000000000..201fd36cb9ebd20db12b1327cb9d6c7843d1c8fb --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Manifest.pm @@ -0,0 +1,908 @@ +package ExtUtils::Manifest; # git description: 1.71-18-g17b7919 + +require Exporter; +use Config; +use File::Basename; +use File::Copy 'copy'; +use File::Find; +use File::Spec 0.8; +use Carp; +use strict; +use warnings; + +our $VERSION = '1.72'; +our @ISA = ('Exporter'); +our @EXPORT_OK = qw(mkmanifest + manicheck filecheck fullcheck skipcheck + manifind maniread manicopy maniadd + maniskip + ); + +our $Is_MacOS = $^O eq 'MacOS'; +our $Is_VMS = $^O eq 'VMS'; +our $Is_VMS_mode = 0; +our $Is_VMS_lc = 0; +our $Is_VMS_nodot = 0; # No dots in dir names or double dots in files + +if ($Is_VMS) { + require VMS::Filespec if $Is_VMS; + my $vms_unix_rpt; + my $vms_efs; + my $vms_case; + + $Is_VMS_mode = 1; + $Is_VMS_lc = 1; + $Is_VMS_nodot = 1; + if (eval { local $SIG{__DIE__}; require VMS::Feature; }) { + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); + $vms_efs = VMS::Feature::current("efs_charset"); + $vms_case = VMS::Feature::current("efs_case_preserve"); + } else { + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_case = $efs_case =~ /^[ET1]/i; + } + $Is_VMS_lc = 0 if ($vms_case); + $Is_VMS_mode = 0 if ($vms_unix_rpt); + $Is_VMS_nodot = 0 if ($vms_efs); +} + +our $Debug = $ENV{PERL_MM_MANIFEST_DEBUG} || 0; +our $Verbose = defined $ENV{PERL_MM_MANIFEST_VERBOSE} ? + $ENV{PERL_MM_MANIFEST_VERBOSE} : 1; +our $Quiet = 0; +our $MANIFEST = 'MANIFEST'; + +our $DEFAULT_MSKIP = File::Spec->catfile( dirname(__FILE__), "$MANIFEST.SKIP" ); + + +=head1 NAME + +ExtUtils::Manifest - Utilities to write and check a MANIFEST file + +=head1 VERSION + +version 1.72 + +=head1 SYNOPSIS + + use ExtUtils::Manifest qw(...funcs to import...); + + mkmanifest(); + + my @missing_files = manicheck; + my @skipped = skipcheck; + my @extra_files = filecheck; + my($missing, $extra) = fullcheck; + + my $found = manifind(); + + my $manifest = maniread(); + + manicopy($read,$target); + + maniadd({$file => $comment, ...}); + + +=head1 DESCRIPTION + +... + +=head1 FUNCTIONS + +ExtUtils::Manifest exports no functions by default. The following are +exported on request: + +=head2 mkmanifest + + mkmanifest(); + +Writes all files in and below the current directory to your F<MANIFEST>. +It works similar to the result of the Unix command + + find . > MANIFEST + +All files that match any regular expression in a file F<MANIFEST.SKIP> +(if it exists) are ignored. + +Any existing F<MANIFEST> file will be saved as F<MANIFEST.bak>. + +=cut + +sub _sort { + return sort { lc $a cmp lc $b } @_; +} + +sub mkmanifest { + my $manimiss = 0; + my $read = (-r 'MANIFEST' && maniread()) or $manimiss++; + $read = {} if $manimiss; + local *M; + my $bakbase = $MANIFEST; + $bakbase =~ s/\./_/g if $Is_VMS_nodot; # avoid double dots + rename $MANIFEST, "$bakbase.bak" unless $manimiss; + open M, "> $MANIFEST" or die "Could not open $MANIFEST: $!"; + binmode M, ':raw'; + my $skip = maniskip(); + my $found = manifind(); + my($key,$val,$file,%all); + %all = (%$found, %$read); + $all{$MANIFEST} = ($Is_VMS_mode ? "$MANIFEST\t\t" : '') . + 'This list of files' + if $manimiss; # add new MANIFEST to known file list + foreach $file (_sort keys %all) { + if ($skip->($file)) { + # Policy: only remove files if they're listed in MANIFEST.SKIP. + # Don't remove files just because they don't exist. + warn "Removed from $MANIFEST: $file\n" if $Verbose and exists $read->{$file}; + next; + } + if ($Verbose){ + warn "Added to $MANIFEST: $file\n" unless exists $read->{$file}; + } + my $text = $all{$file}; + $file = _unmacify($file); + my $tabs = (5 - (length($file)+1)/8); + $tabs = 1 if $tabs < 1; + $tabs = 0 unless $text; + if ($file =~ /\s/) { + $file =~ s/([\\'])/\\$1/g; + $file = "'$file'"; + } + print M $file, "\t" x $tabs, $text, "\n"; + } + close M; +} + +# Geez, shouldn't this use File::Spec or File::Basename or something? +# Why so careful about dependencies? +sub clean_up_filename { + my $filename = shift; + $filename =~ s|^\./||; + $filename =~ s/^:([^:]+)$/$1/ if $Is_MacOS; + if ( $Is_VMS ) { + $filename =~ s/\.$//; # trim trailing dot + $filename = VMS::Filespec::unixify($filename); # unescape spaces, etc. + if( $Is_VMS_lc ) { + $filename = lc($filename); + $filename = uc($filename) if $filename =~ /^MANIFEST(\.SKIP)?$/i; + } + } + return $filename; +} + + +=head2 manifind + + my $found = manifind(); + +returns a hash reference. The keys of the hash are the files found +below the current directory. + +=cut + +sub manifind { + my $p = shift || {}; + my $found = {}; + + my $wanted = sub { + my $name = clean_up_filename($File::Find::name); + warn "Debug: diskfile $name\n" if $Debug; + return if -d $_; + $found->{$name} = ""; + }; + + # We have to use "$File::Find::dir/$_" in preprocess, because + # $File::Find::name is unavailable. + # Also, it's okay to use / here, because MANIFEST files use Unix-style + # paths. + find({wanted => $wanted, follow_fast => 1}, + $Is_MacOS ? ":" : "."); + + return $found; +} + + +=head2 manicheck + + my @missing_files = manicheck(); + +checks if all the files within a C<MANIFEST> in the current directory +really do exist. If C<MANIFEST> and the tree below the current +directory are in sync it silently returns an empty list. +Otherwise it returns a list of files which are listed in the +C<MANIFEST> but missing from the directory, and by default also +outputs these names to STDERR. + +=cut + +sub manicheck { + return _check_files(); +} + + +=head2 filecheck + + my @extra_files = filecheck(); + +finds files below the current directory that are not mentioned in the +C<MANIFEST> file. An optional file C<MANIFEST.SKIP> will be +consulted. Any file matching a regular expression in such a file will +not be reported as missing in the C<MANIFEST> file. The list of any +extraneous files found is returned, and by default also reported to +STDERR. + +=cut + +sub filecheck { + return _check_manifest(); +} + + +=head2 fullcheck + + my($missing, $extra) = fullcheck(); + +does both a manicheck() and a filecheck(), returning then as two array +refs. + +=cut + +sub fullcheck { + return [_check_files()], [_check_manifest()]; +} + + +=head2 skipcheck + + my @skipped = skipcheck(); + +lists all the files that are skipped due to your C<MANIFEST.SKIP> +file. + +=cut + +sub skipcheck { + my($p) = @_; + my $found = manifind(); + my $matches = maniskip(); + + my @skipped = (); + foreach my $file (_sort keys %$found){ + if (&$matches($file)){ + warn "Skipping $file\n" unless $Quiet; + push @skipped, $file; + next; + } + } + + return @skipped; +} + + +sub _check_files { + my $p = shift; + my $dosnames=(defined(&Dos::UseLFN) && Dos::UseLFN()==0); + my $read = maniread() || {}; + my $found = manifind($p); + + my(@missfile) = (); + foreach my $file (_sort keys %$read){ + warn "Debug: manicheck checking from $MANIFEST $file\n" if $Debug; + if ($dosnames){ + $file = lc $file; + $file =~ s=(\.(\w|-)+)=substr ($1,0,4)=ge; + $file =~ s=((\w|-)+)=substr ($1,0,8)=ge; + } + unless ( exists $found->{$file} ) { + warn "No such file: $file\n" unless $Quiet; + push @missfile, $file; + } + } + + return @missfile; +} + + +sub _check_manifest { + my($p) = @_; + my $read = maniread() || {}; + my $found = manifind($p); + my $skip = maniskip(); + + my @missentry = (); + foreach my $file (_sort keys %$found){ + next if $skip->($file); + warn "Debug: manicheck checking from disk $file\n" if $Debug; + unless ( exists $read->{$file} ) { + my $canon = $Is_MacOS ? "\t" . _unmacify($file) : ''; + warn "Not in $MANIFEST: $file$canon\n" unless $Quiet; + push @missentry, $file; + } + } + + return @missentry; +} + + +=head2 maniread + + my $manifest = maniread(); + my $manifest = maniread($manifest_file); + +reads a named C<MANIFEST> file (defaults to C<MANIFEST> in the current +directory) and returns a HASH reference with files being the keys and +comments being the values of the HASH. Blank lines and lines which +start with C<#> in the C<MANIFEST> file are discarded. + +=cut + +sub maniread { + my ($mfile) = @_; + $mfile ||= $MANIFEST; + my $read = {}; + local *M; + unless (open M, "< $mfile"){ + warn "Problem opening $mfile: $!"; + return $read; + } + local $_; + while (<M>){ + chomp; + next if /^\s*#/; + + my($file, $comment); + + # filename may contain spaces if enclosed in '' + # (in which case, \\ and \' are escapes) + if (($file, $comment) = /^'((?:\\[\\']|.+)+)'\s*(.*)/) { + $file =~ s/\\([\\'])/$1/g; + } + else { + ($file, $comment) = /^(\S+)\s*(.*)/; + } + next unless $file; + + if ($Is_MacOS) { + $file = _macify($file); + $file =~ s/\\([0-3][0-7][0-7])/sprintf("%c", oct($1))/ge; + } + elsif ($Is_VMS_mode) { + require File::Basename; + my($base,$dir) = File::Basename::fileparse($file); + # Resolve illegal file specifications in the same way as tar + if ($Is_VMS_nodot) { + $dir =~ tr/./_/; + my(@pieces) = split(/\./,$base); + if (@pieces > 2) + { $base = shift(@pieces) . '.' . join('_',@pieces); } + my $okfile = "$dir$base"; + warn "Debug: Illegal name $file changed to $okfile\n" if $Debug; + $file = $okfile; + } + if( $Is_VMS_lc ) { + $file = lc($file); + $file = uc($file) if $file =~ /^MANIFEST(\.SKIP)?$/i; + } + } + + $read->{$file} = $comment; + } + close M; + $read; +} + +=head2 maniskip + + my $skipchk = maniskip(); + my $skipchk = maniskip($manifest_skip_file); + + if ($skipchk->($file)) { .. } + +reads a named C<MANIFEST.SKIP> file (defaults to C<MANIFEST.SKIP> in +the current directory) and returns a CODE reference that tests whether +a given filename should be skipped. + +=cut + +# returns an anonymous sub that decides if an argument matches +sub maniskip { + my @skip ; + my $mfile = shift || "$MANIFEST.SKIP"; + _check_mskip_directives($mfile) if -f $mfile; + local(*M, $_); + open M, "< $mfile" or open M, "< $DEFAULT_MSKIP" or return sub {0}; + while (<M>){ + chomp; + s/\r//; + $_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$}; + #my $comment = $3; + my $filename = $2; + if ( defined($1) ) { + $filename = $1; + $filename =~ s/\\(['\\])/$1/g; + } + next if (not defined($filename) or not $filename); + push @skip, _macify($filename); + } + close M; + return sub {0} unless (scalar @skip > 0); + + my $opts = $Is_VMS_mode ? '(?i)' : ''; + + # Make sure each entry is isolated in its own parentheses, in case + # any of them contain alternations + my $regex = join '|', map "(?:$_)", @skip; + + return sub { $_[0] =~ qr{$opts$regex} }; +} + +# checks for the special directives +# #!include_default +# #!include /path/to/some/manifest.skip +# in a custom MANIFEST.SKIP for, for including +# the content of, respectively, the default MANIFEST.SKIP +# and an external manifest.skip file +sub _check_mskip_directives { + my $mfile = shift; + local (*M, $_); + my @lines = (); + my $flag = 0; + unless (open M, "< $mfile") { + warn "Problem opening $mfile: $!"; + return; + } + while (<M>) { + if (/^#!include_default\s*$/) { + if (my @default = _include_mskip_file()) { + push @lines, @default; + warn "Debug: Including default MANIFEST.SKIP\n" if $Debug; + $flag++; + } + next; + } + if (/^#!include\s+(.*)\s*$/) { + my $external_file = $1; + if (my @external = _include_mskip_file($external_file)) { + push @lines, @external; + warn "Debug: Including external $external_file\n" if $Debug; + $flag++; + } + next; + } + push @lines, $_; + } + close M; + return unless $flag; + my $bakbase = $mfile; + $bakbase =~ s/\./_/g if $Is_VMS_nodot; # avoid double dots + rename $mfile, "$bakbase.bak"; + warn "Debug: Saving original $mfile as $bakbase.bak\n" if $Debug; + unless (open M, "> $mfile") { + warn "Problem opening $mfile: $!"; + return; + } + binmode M, ':raw'; + print M $_ for (@lines); + close M; + return; +} + +# returns an array containing the lines of an external +# manifest.skip file, if given, or $DEFAULT_MSKIP +sub _include_mskip_file { + my $mskip = shift || $DEFAULT_MSKIP; + unless (-f $mskip) { + warn qq{Included file "$mskip" not found - skipping}; + return; + } + local (*M, $_); + unless (open M, "< $mskip") { + warn "Problem opening $mskip: $!"; + return; + } + my @lines = (); + push @lines, "\n#!start included $mskip\n"; + push @lines, $_ while <M>; + close M; + push @lines, "#!end included $mskip\n\n"; + return @lines; +} + +=head2 manicopy + + manicopy(\%src, $dest_dir); + manicopy(\%src, $dest_dir, $how); + +Copies the files that are the keys in %src to the $dest_dir. %src is +typically returned by the maniread() function. + + manicopy( maniread(), $dest_dir ); + +This function is useful for producing a directory tree identical to the +intended distribution tree. + +$how can be used to specify a different methods of "copying". Valid +values are C<cp>, which actually copies the files, C<ln> which creates +hard links, and C<best> which mostly links the files but copies any +symbolic link to make a tree without any symbolic link. C<cp> is the +default. + +=cut + +sub manicopy { + my($read,$target,$how)=@_; + croak "manicopy() called without target argument" unless defined $target; + $how ||= 'cp'; + require File::Path; + require File::Basename; + + $target = VMS::Filespec::unixify($target) if $Is_VMS_mode; + File::Path::mkpath([ $target ],! $Quiet,$Is_VMS ? undef : 0755); + foreach my $file (keys %$read){ + if ($Is_MacOS) { + if ($file =~ m!:!) { + my $dir = _maccat($target, $file); + $dir =~ s/[^:]+$//; + File::Path::mkpath($dir,1,0755); + } + cp_if_diff($file, _maccat($target, $file), $how); + } else { + $file = VMS::Filespec::unixify($file) if $Is_VMS_mode; + if ($file =~ m!/!) { # Ilya, that hurts, I fear, or maybe not? + my $dir = File::Basename::dirname($file); + $dir = VMS::Filespec::unixify($dir) if $Is_VMS_mode; + File::Path::mkpath(["$target/$dir"],! $Quiet,$Is_VMS ? undef : 0755); + } + cp_if_diff($file, "$target/$file", $how); + } + } +} + +sub cp_if_diff { + my($from, $to, $how)=@_; + if (! -f $from) { + carp "$from not found"; + return; + } + my($diff) = 0; + local(*F,*T); + open(F,"< $from\0") or die "Can't read $from: $!\n"; + if (open(T,"< $to\0")) { + local $_; + while (<F>) { $diff++,last if $_ ne <T>; } + $diff++ unless eof(T); + close T; + } + else { $diff++; } + close F; + if ($diff) { + if (-e $to) { + unlink($to) or confess "unlink $to: $!"; + } + STRICT_SWITCH: { + best($from,$to), last STRICT_SWITCH if $how eq 'best'; + cp($from,$to), last STRICT_SWITCH if $how eq 'cp'; + ln($from,$to), last STRICT_SWITCH if $how eq 'ln'; + croak("ExtUtils::Manifest::cp_if_diff " . + "called with illegal how argument [$how]. " . + "Legal values are 'best', 'cp', and 'ln'."); + } + } +} + +sub cp { + my ($srcFile, $dstFile) = @_; + my ($access,$mod) = (stat $srcFile)[8,9]; + + copy($srcFile,$dstFile); + utime $access, $mod + ($Is_VMS ? 1 : 0), $dstFile; + _manicopy_chmod($srcFile, $dstFile); +} + + +sub ln { + my ($srcFile, $dstFile) = @_; + # Fix-me - VMS can support links. + return &cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95()); + link($srcFile, $dstFile); + + unless( _manicopy_chmod($srcFile, $dstFile) ) { + unlink $dstFile; + return; + } + 1; +} + +# 1) Strip off all group and world permissions. +# 2) Let everyone read it. +# 3) If the owner can execute it, everyone can. +sub _manicopy_chmod { + my($srcFile, $dstFile) = @_; + + my $perm = 0444 | (stat $srcFile)[2] & 0700; + chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $dstFile ); +} + +# Files that are often modified in the distdir. Don't hard link them. +my @Exceptions = qw(MANIFEST META.yml SIGNATURE); +sub best { + my ($srcFile, $dstFile) = @_; + + my $is_exception = grep $srcFile =~ /$_/, @Exceptions; + if ($is_exception or !$Config{d_link} or -l $srcFile) { + cp($srcFile, $dstFile); + } else { + ln($srcFile, $dstFile) or cp($srcFile, $dstFile); + } +} + +sub _macify { + my($file) = @_; + + return $file unless $Is_MacOS; + + $file =~ s|^\./||; + if ($file =~ m|/|) { + $file =~ s|/+|:|g; + $file = ":$file"; + } + + $file; +} + +sub _maccat { + my($f1, $f2) = @_; + + return "$f1/$f2" unless $Is_MacOS; + + $f1 .= ":$f2"; + $f1 =~ s/([^:]:):/$1/g; + return $f1; +} + +sub _unmacify { + my($file) = @_; + + return $file unless $Is_MacOS; + + $file =~ s|^:||; + $file =~ s|([/ \n])|sprintf("\\%03o", unpack("c", $1))|ge; + $file =~ y|:|/|; + + $file; +} + + +=head2 maniadd + + maniadd({ $file => $comment, ...}); + +Adds an entry to an existing F<MANIFEST> unless its already there. + +$file will be normalized (ie. Unixified). B<UNIMPLEMENTED> + +=cut + +sub maniadd { + my($additions) = shift; + + _normalize($additions); + _fix_manifest($MANIFEST); + + my $manifest = maniread(); + my @needed = grep !exists $manifest->{$_}, keys %$additions; + return 1 unless @needed; + + open(MANIFEST, ">>$MANIFEST") or + die "maniadd() could not open $MANIFEST: $!"; + binmode MANIFEST, ':raw'; + + foreach my $file (_sort @needed) { + my $comment = $additions->{$file} || ''; + if ($file =~ /\s/) { + $file =~ s/([\\'])/\\$1/g; + $file = "'$file'"; + } + printf MANIFEST "%-40s %s\n", $file, $comment; + } + close MANIFEST or die "Error closing $MANIFEST: $!"; + + return 1; +} + + +# Make sure this MANIFEST is consistently written with native +# newlines and has a terminal newline. +sub _fix_manifest { + my $manifest_file = shift; + + open MANIFEST, $MANIFEST or die "Could not open $MANIFEST: $!"; + local $/; + my @manifest = split /(\015\012|\012|\015)/, <MANIFEST>, -1; + close MANIFEST; + my $must_rewrite = ""; + if ($manifest[-1] eq ""){ + # sane case: last line had a terminal newline + pop @manifest; + for (my $i=1; $i<=$#manifest; $i+=2) { + unless ($manifest[$i] eq "\n") { + $must_rewrite = "not a newline at pos $i"; + last; + } + } + } else { + $must_rewrite = "last line without newline"; + } + + if ( $must_rewrite ) { + 1 while unlink $MANIFEST; # avoid multiple versions on VMS + open MANIFEST, ">", $MANIFEST or die "(must_rewrite=$must_rewrite) Could not open >$MANIFEST: $!"; + binmode MANIFEST, ':raw'; + for (my $i=0; $i<=$#manifest; $i+=2) { + print MANIFEST "$manifest[$i]\n"; + } + close MANIFEST or die "could not write $MANIFEST: $!"; + } +} + + +# UNIMPLEMENTED +sub _normalize { + return; +} + +=head2 MANIFEST + +A list of files in the distribution, one file per line. The MANIFEST +always uses Unix filepath conventions even if you're not on Unix. This +means F<foo/bar> style not F<foo\bar>. + +Anything between white space and an end of line within a C<MANIFEST> +file is considered to be a comment. Any line beginning with # is also +a comment. Beginning with ExtUtils::Manifest 1.52, a filename may +contain whitespace characters if it is enclosed in single quotes; single +quotes or backslashes in that filename must be backslash-escaped. + + # this a comment + some/file + some/other/file comment about some/file + 'some/third file' comment + + +=head2 MANIFEST.SKIP + +The file MANIFEST.SKIP may contain regular expressions of files that +should be ignored by mkmanifest() and filecheck(). The regular +expressions should appear one on each line. Blank lines and lines +which start with C<#> are skipped. Use C<\#> if you need a regular +expression to start with a C<#>. + +For example: + + # Version control files and dirs. + \bRCS\b + \bCVS\b + ,v$ + \B\.svn\b + + # Makemaker generated files and dirs. + ^MANIFEST\. + ^Makefile$ + ^blib/ + ^MakeMaker-\d + + # Temp, old and emacs backup files. + ~$ + \.old$ + ^#.*#$ + ^\.# + +If no MANIFEST.SKIP file is found, a default set of skips will be +used, similar to the example above. If you want nothing skipped, +simply make an empty MANIFEST.SKIP file. + +In one's own MANIFEST.SKIP file, certain directives +can be used to include the contents of other MANIFEST.SKIP +files. At present two such directives are recognized. + +=over 4 + +=item #!include_default + +This inserts the contents of the default MANIFEST.SKIP file + +=item #!include /Path/to/another/manifest.skip + +This inserts the contents of the specified external file + +=back + +The included contents will be inserted into the MANIFEST.SKIP +file in between I<#!start included /path/to/manifest.skip> +and I<#!end included /path/to/manifest.skip> markers. +The original MANIFEST.SKIP is saved as MANIFEST.SKIP.bak. + +=head2 EXPORT_OK + +C<&mkmanifest>, C<&manicheck>, C<&filecheck>, C<&fullcheck>, +C<&maniread>, and C<&manicopy> are exportable. + +=head2 GLOBAL VARIABLES + +C<$ExtUtils::Manifest::MANIFEST> defaults to C<MANIFEST>. Changing it +results in both a different C<MANIFEST> and a different +C<MANIFEST.SKIP> file. This is useful if you want to maintain +different distributions for different audiences (say a user version +and a developer version including RCS). + +C<$ExtUtils::Manifest::Quiet> defaults to 0. If set to a true value, +all functions act silently. + +C<$ExtUtils::Manifest::Debug> defaults to 0. If set to a true value, +or if PERL_MM_MANIFEST_DEBUG is true, debugging output will be +produced. + +=head1 DIAGNOSTICS + +All diagnostic output is sent to C<STDERR>. + +=over 4 + +=item C<Not in MANIFEST:> I<file> + +is reported if a file is found which is not in C<MANIFEST>. + +=item C<Skipping> I<file> + +is reported if a file is skipped due to an entry in C<MANIFEST.SKIP>. + +=item C<No such file:> I<file> + +is reported if a file mentioned in a C<MANIFEST> file does not +exist. + +=item C<MANIFEST:> I<$!> + +is reported if C<MANIFEST> could not be opened. + +=item C<Added to MANIFEST:> I<file> + +is reported by mkmanifest() if $Verbose is set and a file is added +to MANIFEST. $Verbose is set to 1 by default. + +=back + +=head1 ENVIRONMENT + +=over 4 + +=item B<PERL_MM_MANIFEST_DEBUG> + +Turns on debugging + +=back + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> which has handy targets for most of the functionality. + +=head1 AUTHOR + +Andreas Koenig C<andreas.koenig@anima.de> + +Currently maintained by the Perl Toolchain Gang. + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 1996- by Andreas Koenig. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Miniperl.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Miniperl.pm new file mode 100644 index 0000000000000000000000000000000000000000..46af2a60739a0dfb821df7ef137268935eb16e52 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Miniperl.pm @@ -0,0 +1,264 @@ +#!./perl -w +package ExtUtils::Miniperl; +use strict; +require Exporter; +use ExtUtils::Embed 1.31, qw(xsi_header xsi_protos xsi_body); + +our @ISA = qw(Exporter); +our @EXPORT = qw(writemain); +our $VERSION = '1.09'; + +# blead will run this with miniperl, hence we can't use autodie or File::Temp +my $temp; + +END { + return if !defined $temp || !-e $temp; + unlink $temp or warn "Can't unlink '$temp': $!"; +} + +sub writemain{ + my ($fh, $real); + + if (ref $_[0] eq 'SCALAR') { + $real = ${+shift}; + $temp = $real; + $temp =~ s/(?:.c)?\z/.new/; + open $fh, '>', $temp + or die "Can't open '$temp' for writing: $!"; + } elsif (ref $_[0]) { + $fh = shift; + } else { + $fh = \*STDOUT; + } + + my(@exts) = @_; + + printf $fh <<'EOF!HEAD', xsi_header(); +/* miniperlmain.c or perlmain.c - a generated file + * + * Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, + * 2004, 2005, 2006, 2007, 2016 by Larry Wall and others + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * The Road goes ever on and on + * Down from the door where it began. + * + * [Bilbo on p.35 of _The Lord of the Rings_, I/i: "A Long-Expected Party"] + * [Frodo on p.73 of _The Lord of the Rings_, I/iii: "Three Is Company"] + */ + +/* This file contains the main() function for the perl interpreter. + * Note that miniperlmain.c contains main() for the 'miniperl' binary, + * while perlmain.c contains main() for the 'perl' binary. The typical + * difference being that the latter includes Dynaloader. + * + * Miniperl is like perl except that it does not support dynamic loading, + * and in fact is used to build the dynamic modules needed for the 'real' + * perl executable. + * + * The content of the body of this generated file is mostly contained + * in Miniperl.pm - edit that file if you want to change anything. + * miniperlmain.c is generated by running regen/miniperlmain.pl, while + * perlmain.c is built automatically by Makefile (so the former is + * included in the tarball while the latter isn't). + */ + +#ifdef OEMVS +#ifdef MYMALLOC +/* sbrk is limited to first heap segment so make it big */ +#pragma runopts(HEAP(8M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON)) +#else +#pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON)) +#endif +#endif + +#define PERL_IN_MINIPERLMAIN_C + +/* work round bug in MakeMaker which doesn't currently (2019) supply this + * flag when making a statically linked perl */ +#define PERL_CORE 1 + +%s +static void xs_init (pTHX); +static PerlInterpreter *my_perl; + +#if defined(PERL_GLOBAL_STRUCT_PRIVATE) +/* The static struct perl_vars* may seem counterproductive since the + * whole idea PERL_GLOBAL_STRUCT_PRIVATE was to avoid statics, but note + * that this static is not in the shared perl library, the globals PL_Vars + * and PL_VarsPtr will stay away. */ +static struct perl_vars* my_plvarsp; +struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; } +#endif + +#ifdef NO_ENV_ARRAY_IN_MAIN +extern char **environ; +int +main(int argc, char **argv) +#else +int +main(int argc, char **argv, char **env) +#endif +{ + int exitstatus, i; +#ifdef PERL_GLOBAL_STRUCT + struct perl_vars *my_vars = init_global_struct(); +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + int veto; + + my_plvarsp = my_vars; +# endif +#endif /* PERL_GLOBAL_STRUCT */ +#ifndef NO_ENV_ARRAY_IN_MAIN + PERL_UNUSED_ARG(env); +#endif +#ifndef PERL_USE_SAFE_PUTENV + PL_use_safe_putenv = FALSE; +#endif /* PERL_USE_SAFE_PUTENV */ + + /* if user wants control of gprof profiling off by default */ + /* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */ + PERL_GPROF_MONCONTROL(0); + +#ifdef NO_ENV_ARRAY_IN_MAIN + PERL_SYS_INIT3(&argc,&argv,&environ); +#else + PERL_SYS_INIT3(&argc,&argv,&env); +#endif + +#if defined(USE_ITHREADS) + /* XXX Ideally, this should really be happening in perl_alloc() or + * perl_construct() to keep libperl.a transparently fork()-safe. + * It is currently done here only because Apache/mod_perl have + * problems due to lack of a call to cancel pthread_atfork() + * handlers when shared objects that contain the handlers may + * be dlclose()d. This forces applications that embed perl to + * call PTHREAD_ATFORK() explicitly, but if and only if it hasn't + * been called at least once before in the current process. + * --GSAR 2001-07-20 */ + PTHREAD_ATFORK(Perl_atfork_lock, + Perl_atfork_unlock, + Perl_atfork_unlock); +#endif + + PERL_SYS_FPU_INIT; + + if (!PL_do_undump) { + my_perl = perl_alloc(); + if (!my_perl) + exit(1); + perl_construct(my_perl); + PL_perl_destruct_level = 0; + } + PL_exit_flags |= PERL_EXIT_DESTRUCT_END; + if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) + perl_run(my_perl); + +#ifndef PERL_MICRO + /* Unregister our signal handler before destroying my_perl */ + for (i = 1; PL_sig_name[i]; i++) { + if (rsignal_state(PL_sig_num[i]) == (Sighandler_t) PL_csighandlerp) { + rsignal(PL_sig_num[i], (Sighandler_t) SIG_DFL); + } + } +#endif + + exitstatus = perl_destruct(my_perl); + + perl_free(my_perl); + +#if defined(USE_ENVIRON_ARRAY) && defined(PERL_TRACK_MEMPOOL) && !defined(NO_ENV_ARRAY_IN_MAIN) + /* + * The old environment may have been freed by perl_free() + * when PERL_TRACK_MEMPOOL is defined, but without having + * been restored by perl_destruct() before (this is only + * done if destruct_level > 0). + * + * It is important to have a valid environment for atexit() + * routines that are eventually called. + */ + environ = env; +#endif + + PERL_SYS_TERM(); + +#ifdef PERL_GLOBAL_STRUCT +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + veto = my_plvarsp->Gveto_cleanup; +# endif + free_global_struct(my_vars); +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + if (!veto) + my_plvarsp = NULL; + /* Remember, functions registered with atexit() can run after this point, + and may access "global" variables, and hence end up calling + Perl_GetVarsPrivate() */ +#endif +#endif /* PERL_GLOBAL_STRUCT */ + + exit(exitstatus); +} + +/* Register any extra external extensions */ + +EOF!HEAD + + print $fh xsi_protos(@exts), <<'EOT', xsi_body(@exts), "}\n"; + +static void +xs_init(pTHX) +{ +EOT + + if ($real) { + close $fh or die "Can't close '$temp': $!"; + rename $temp, $real or die "Can't rename '$temp' to '$real': $!"; + } +} + +1; +__END__ + +=head1 NAME + +ExtUtils::Miniperl - write the C code for miniperlmain.c and perlmain.c + +=head1 SYNOPSIS + + use ExtUtils::Miniperl; + writemain(@directories); + # or + writemain($fh, @directories); + # or + writemain(\$filename, @directories); + +=head1 DESCRIPTION + +C<writemain()> takes an argument list of zero or more directories +containing archive +libraries that relate to perl modules and should be linked into a new +perl binary. It writes a corresponding F<miniperlmain.c> or F<perlmain.c> +file that +is a plain C file containing all the bootstrap code to make the +modules associated with the libraries available from within perl. +If the first argument to C<writemain()> is a reference to a scalar it is +used as the filename to open for output. Any other reference is used as +the filehandle to write to. Otherwise output defaults to C<STDOUT>. + +The typical usage is from within perl's own Makefile (to build +F<perlmain.c>) or from F<regen/miniperlmain.pl> (to build miniperlmain.c). +So under normal circumstances you won't have to deal with this module +directly. + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut + +# ex: set ts=8 sts=4 sw=4 et: diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mkbootstrap.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mkbootstrap.pm new file mode 100644 index 0000000000000000000000000000000000000000..a11a950c1b6b4b341c6a92a6c933d659defa71e1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mkbootstrap.pm @@ -0,0 +1,112 @@ +package ExtUtils::Mkbootstrap; + +# There's just too much Dynaloader incest here to turn on strict vars. +use strict 'refs'; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +require Exporter; +our @ISA = ('Exporter'); +our @EXPORT = ('&Mkbootstrap'); + +use Config; + +our $Verbose = 0; + + +sub Mkbootstrap { + my($baseext, @bsloadlibs)=@_; + @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs + + print " bsloadlibs=@bsloadlibs\n" if $Verbose; + + # We need DynaLoader here because we and/or the *_BS file may + # call dl_findfile(). We don't say `use' here because when + # first building perl extensions the DynaLoader will not have + # been built when MakeMaker gets first used. + require DynaLoader; + + rename "$baseext.bs", "$baseext.bso" + if -s "$baseext.bs"; + + if (-f "${baseext}_BS"){ + $_ = "${baseext}_BS"; + package DynaLoader; # execute code as if in DynaLoader + local($osname, $dlsrc) = (); # avoid warnings + ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)}; + $bscode = ""; + unshift @INC, "."; + require $_; + shift @INC; + } + + if ($Config{'dlsrc'} =~ /^dl_dld/){ + package DynaLoader; + push(@dl_resolve_using, dl_findfile('-lc')); + } + + my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using); + my($method) = ''; + if (@all || (defined $DynaLoader::bscode && length $DynaLoader::bscode)){ + open my $bs, ">", "$baseext.bs" + or die "Unable to open $baseext.bs: $!"; + print "Writing $baseext.bs\n"; + print " containing: @all" if $Verbose; + print $bs "# $baseext DynaLoader bootstrap file for $^O architecture.\n"; + print $bs "# Do not edit this file, changes will be lost.\n"; + print $bs "# This file was automatically generated by the\n"; + print $bs "# Mkbootstrap routine in ExtUtils::Mkbootstrap (v$VERSION).\n"; + if (@all) { + print $bs "\@DynaLoader::dl_resolve_using = "; + # If @all contains names in the form -lxxx or -Lxxx then it's asking for + # runtime library location so we automatically add a call to dl_findfile() + if (" @all" =~ m/ -[lLR]/){ + print $bs " dl_findfile(qw(\n @all\n ));\n"; + } else { + print $bs " qw(@all);\n"; + } + } + # write extra code if *_BS says so + print $bs $DynaLoader::bscode if $DynaLoader::bscode; + print $bs "\n1;\n"; + close $bs; + } +} + +1; + +__END__ + +=head1 NAME + +ExtUtils::Mkbootstrap - make a bootstrap file for use by DynaLoader + +=head1 SYNOPSIS + + Mkbootstrap + +=head1 DESCRIPTION + +Mkbootstrap typically gets called from an extension Makefile. + +There is no C<*.bs> file supplied with the extension. Instead, there may +be a C<*_BS> file which has code for the special cases, like posix for +berkeley db on the NeXT. + +This file will get parsed, and produce a maybe empty +C<@DynaLoader::dl_resolve_using> array for the current architecture. +That will be extended by $BSLOADLIBS, which was computed by +ExtUtils::Liblist::ext(). If this array still is empty, we do nothing, +else we write a .bs file with an C<@DynaLoader::dl_resolve_using> +array. + +The C<*_BS> file can put some code into the generated C<*.bs> file by +placing it in C<$bscode>. This is a handy 'escape' mechanism that may +prove useful in complex situations. + +If @DynaLoader::dl_resolve_using contains C<-L*> or C<-l*> entries then +Mkbootstrap will automatically add a dl_findfile() call to the +generated C<*.bs> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mksymlists.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mksymlists.pm new file mode 100644 index 0000000000000000000000000000000000000000..9279b6b78521a7bbf4ac6a891436fe67a73d8911 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Mksymlists.pm @@ -0,0 +1,318 @@ +package ExtUtils::Mksymlists; + +use 5.006; +use strict qw[ subs refs ]; +# no strict 'vars'; # until filehandles are exempted + +use Carp; +use Exporter; +use Config; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&Mksymlists); +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +sub Mksymlists { + my(%spec) = @_; + my($osname) = $^O; + + croak("Insufficient information specified to Mksymlists") + unless ( $spec{NAME} or + ($spec{FILE} and ($spec{DL_FUNCS} or $spec{FUNCLIST})) ); + + $spec{DL_VARS} = [] unless $spec{DL_VARS}; + ($spec{FILE} = $spec{NAME}) =~ s/.*::// unless $spec{FILE}; + $spec{FUNCLIST} = [] unless $spec{FUNCLIST}; + $spec{DL_FUNCS} = { $spec{NAME} => [] } + unless ( ($spec{DL_FUNCS} and keys %{$spec{DL_FUNCS}}) or + @{$spec{FUNCLIST}}); + if (defined $spec{DL_FUNCS}) { + foreach my $package (sort keys %{$spec{DL_FUNCS}}) { + my($packprefix,$bootseen); + ($packprefix = $package) =~ s/\W/_/g; + foreach my $sym (@{$spec{DL_FUNCS}->{$package}}) { + if ($sym =~ /^boot_/) { + push(@{$spec{FUNCLIST}},$sym); + $bootseen++; + } + else { + push(@{$spec{FUNCLIST}},"XS_${packprefix}_$sym"); + } + } + push(@{$spec{FUNCLIST}},"boot_$packprefix") unless $bootseen; + } + } + +# We'll need this if we ever add any OS which uses mod2fname +# not as pseudo-builtin. +# require DynaLoader; + if (defined &DynaLoader::mod2fname and not $spec{DLBASE}) { + $spec{DLBASE} = DynaLoader::mod2fname([ split(/::/,$spec{NAME}) ]); + } + + if ($osname eq 'aix') { _write_aix(\%spec); } + elsif ($osname eq 'MacOS'){ _write_aix(\%spec) } + elsif ($osname eq 'VMS') { _write_vms(\%spec) } + elsif ($osname eq 'os2') { _write_os2(\%spec) } + elsif ($osname eq 'MSWin32') { _write_win32(\%spec) } + else { + croak("Don't know how to create linker option file for $osname\n"); + } +} + + +sub _write_aix { + my($data) = @_; + + rename "$data->{FILE}.exp", "$data->{FILE}.exp_old"; + + open( my $exp, ">", "$data->{FILE}.exp") + or croak("Can't create $data->{FILE}.exp: $!\n"); + print $exp join("\n",@{$data->{DL_VARS}}, "\n") if @{$data->{DL_VARS}}; + print $exp join("\n",@{$data->{FUNCLIST}}, "\n") if @{$data->{FUNCLIST}}; + close $exp; +} + + +sub _write_os2 { + my($data) = @_; + require Config; + my $threaded = ($Config::Config{archname} =~ /-thread/ ? " threaded" : ""); + + if (not $data->{DLBASE}) { + ($data->{DLBASE} = $data->{NAME}) =~ s/.*:://; + $data->{DLBASE} = substr($data->{DLBASE},0,7) . '_'; + } + my $distname = $data->{DISTNAME} || $data->{NAME}; + $distname = "Distribution $distname"; + my $patchlevel = " pl$Config{perl_patchlevel}" || ''; + my $comment = sprintf "Perl (v%s%s%s) module %s", + $Config::Config{version}, $threaded, $patchlevel, $data->{NAME}; + chomp $comment; + if ($data->{INSTALLDIRS} and $data->{INSTALLDIRS} eq 'perl') { + $distname = 'perl5-porters@perl.org'; + $comment = "Core $comment"; + } + $comment = "$comment (Perl-config: $Config{config_args})"; + $comment = substr($comment, 0, 200) . "...)" if length $comment > 203; + rename "$data->{FILE}.def", "$data->{FILE}_def.old"; + + open(my $def, ">", "$data->{FILE}.def") + or croak("Can't create $data->{FILE}.def: $!\n"); + print $def "LIBRARY '$data->{DLBASE}' INITINSTANCE TERMINSTANCE\n"; + print $def "DESCRIPTION '\@#$distname:$data->{VERSION}#\@ $comment'\n"; + print $def "CODE LOADONCALL\n"; + print $def "DATA LOADONCALL NONSHARED MULTIPLE\n"; + print $def "EXPORTS\n "; + print $def join("\n ",@{$data->{DL_VARS}}, "\n") if @{$data->{DL_VARS}}; + print $def join("\n ",@{$data->{FUNCLIST}}, "\n") if @{$data->{FUNCLIST}}; + _print_imports($def, $data); + close $def; +} + +sub _print_imports { + my ($def, $data)= @_; + my $imports= $data->{IMPORTS} + or return; + if ( keys %$imports ) { + print $def "IMPORTS\n"; + foreach my $name (sort keys %$imports) { + print $def " $name=$imports->{$name}\n"; + } + } +} + +sub _write_win32 { + my($data) = @_; + + require Config; + if (not $data->{DLBASE}) { + ($data->{DLBASE} = $data->{NAME}) =~ s/.*:://; + $data->{DLBASE} = substr($data->{DLBASE},0,7) . '_'; + } + rename "$data->{FILE}.def", "$data->{FILE}_def.old"; + + open( my $def, ">", "$data->{FILE}.def" ) + or croak("Can't create $data->{FILE}.def: $!\n"); + # put library name in quotes (it could be a keyword, like 'Alias') + if ($Config::Config{'cc'} !~ /\bgcc/i) { + print $def "LIBRARY \"$data->{DLBASE}\"\n"; + } + print $def "EXPORTS\n "; + my @syms; + # Export public symbols both with and without underscores to + # ensure compatibility between DLLs from Borland C and Visual C + # NOTE: DynaLoader itself only uses the names without underscores, + # so this is only to cover the case when the extension DLL may be + # linked to directly from C. GSAR 97-07-10 + + #bcc dropped in 5.16, so dont create useless extra symbols for export table + unless("$]" >= 5.016) { + if ($Config::Config{'cc'} =~ /^bcc/i) { + push @syms, "_$_", "$_ = _$_" + for (@{$data->{DL_VARS}}, @{$data->{FUNCLIST}}); + } + else { + push @syms, "$_", "_$_ = $_" + for (@{$data->{DL_VARS}}, @{$data->{FUNCLIST}}); + } + } else { + push @syms, "$_" + for (@{$data->{DL_VARS}}, @{$data->{FUNCLIST}}); + } + print $def join("\n ",@syms, "\n") if @syms; + _print_imports($def, $data); + close $def; +} + + +sub _write_vms { + my($data) = @_; + + require Config; # a reminder for once we do $^O + require ExtUtils::XSSymSet; + + my($isvax) = $Config::Config{'archname'} =~ /VAX/i; + my($set) = new ExtUtils::XSSymSet; + + rename "$data->{FILE}.opt", "$data->{FILE}.opt_old"; + + open(my $opt,">", "$data->{FILE}.opt") + or croak("Can't create $data->{FILE}.opt: $!\n"); + + # Options file declaring universal symbols + # Used when linking shareable image for dynamic extension, + # or when linking PerlShr into which we've added this package + # as a static extension + # We don't do anything to preserve order, so we won't relax + # the GSMATCH criteria for a dynamic extension + + print $opt "case_sensitive=yes\n" + if $Config::Config{d_vms_case_sensitive_symbols}; + + foreach my $sym (@{$data->{FUNCLIST}}) { + my $safe = $set->addsym($sym); + if ($isvax) { print $opt "UNIVERSAL=$safe\n" } + else { print $opt "SYMBOL_VECTOR=($safe=PROCEDURE)\n"; } + } + + foreach my $sym (@{$data->{DL_VARS}}) { + my $safe = $set->addsym($sym); + print $opt "PSECT_ATTR=${sym},PIC,OVR,RD,NOEXE,WRT,NOSHR\n"; + if ($isvax) { print $opt "UNIVERSAL=$safe\n" } + else { print $opt "SYMBOL_VECTOR=($safe=DATA)\n"; } + } + + close $opt; +} + +1; + +__END__ + +=head1 NAME + +ExtUtils::Mksymlists - write linker options files for dynamic extension + +=head1 SYNOPSIS + + use ExtUtils::Mksymlists; + Mksymlists( NAME => $name , + DL_VARS => [ $var1, $var2, $var3 ], + DL_FUNCS => { $pkg1 => [ $func1, $func2 ], + $pkg2 => [ $func3 ] ); + +=head1 DESCRIPTION + +C<ExtUtils::Mksymlists> produces files used by the linker under some OSs +during the creation of shared libraries for dynamic extensions. It is +normally called from a MakeMaker-generated Makefile when the extension +is built. The linker option file is generated by calling the function +C<Mksymlists>, which is exported by default from C<ExtUtils::Mksymlists>. +It takes one argument, a list of key-value pairs, in which the following +keys are recognized: + +=over 4 + +=item DLBASE + +This item specifies the name by which the linker knows the +extension, which may be different from the name of the +extension itself (for instance, some linkers add an '_' to the +name of the extension). If it is not specified, it is derived +from the NAME attribute. It is presently used only by OS2 and Win32. + +=item DL_FUNCS + +This is identical to the DL_FUNCS attribute available via MakeMaker, +from which it is usually taken. Its value is a reference to an +associative array, in which each key is the name of a package, and +each value is an a reference to an array of function names which +should be exported by the extension. For instance, one might say +C<DL_FUNCS =E<gt> { Homer::Iliad =E<gt> [ qw(trojans greeks) ], +Homer::Odyssey =E<gt> [ qw(travellers family suitors) ] }>. The +function names should be identical to those in the XSUB code; +C<Mksymlists> will alter the names written to the linker option +file to match the changes made by F<xsubpp>. In addition, if +none of the functions in a list begin with the string B<boot_>, +C<Mksymlists> will add a bootstrap function for that package, +just as xsubpp does. (If a B<boot_E<lt>pkgE<gt>> function is +present in the list, it is passed through unchanged.) If +DL_FUNCS is not specified, it defaults to the bootstrap +function for the extension specified in NAME. + +=item DL_VARS + +This is identical to the DL_VARS attribute available via MakeMaker, +and, like DL_FUNCS, it is usually specified via MakeMaker. Its +value is a reference to an array of variable names which should +be exported by the extension. + +=item FILE + +This key can be used to specify the name of the linker option file +(minus the OS-specific extension), if for some reason you do not +want to use the default value, which is the last word of the NAME +attribute (I<e.g.> for C<Tk::Canvas>, FILE defaults to C<Canvas>). + +=item FUNCLIST + +This provides an alternate means to specify function names to be +exported from the extension. Its value is a reference to an +array of function names to be exported by the extension. These +names are passed through unaltered to the linker options file. +Specifying a value for the FUNCLIST attribute suppresses automatic +generation of the bootstrap function for the package. To still create +the bootstrap name you have to specify the package name in the +DL_FUNCS hash: + + Mksymlists( NAME => $name , + FUNCLIST => [ $func1, $func2 ], + DL_FUNCS => { $pkg => [] } ); + + +=item IMPORTS + +This attribute is used to specify names to be imported into the +extension. It is currently only used by OS/2 and Win32. + +=item NAME + +This gives the name of the extension (I<e.g.> C<Tk::Canvas>) for which +the linker option file will be produced. + +=back + +When calling C<Mksymlists>, one should always specify the NAME +attribute. In most cases, this is all that's necessary. In +the case of unusual extensions, however, the other attributes +can be used to provide additional information to the linker. + +=head1 AUTHOR + +Charles Bailey I<E<lt>bailey@newman.upenn.eduE<gt>> + +=head1 REVISION + +Last revised 14-Feb-1996, for Perl 5.002. diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Packlist.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Packlist.pm new file mode 100644 index 0000000000000000000000000000000000000000..f94e3d05cc82feab4f8ee3b4aa2b36790d87944e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Packlist.pm @@ -0,0 +1,353 @@ +package ExtUtils::Packlist; + +use 5.00503; +use strict; +use Carp qw(); +use Config; +use vars qw($VERSION $Relocations); +$VERSION = '2.14'; +$VERSION = eval $VERSION; + +# Used for generating filehandle globs. IO::File might not be available! +my $fhname = "FH1"; + +=begin _undocumented + +=over + +=item mkfh() + +Make a filehandle. Same kind of idea as Symbol::gensym(). + +=cut + +sub mkfh() +{ +no strict; +local $^W; +my $fh = \*{$fhname++}; +use strict; +return($fh); +} + +=item __find_relocations + +Works out what absolute paths in the configuration have been located at run +time relative to $^X, and generates a regexp that matches them + +=back + +=end _undocumented + +=cut + +sub __find_relocations +{ + my %paths; + while (my ($raw_key, $raw_val) = each %Config) { + my $exp_key = $raw_key . "exp"; + next unless exists $Config{$exp_key}; + next unless $raw_val =~ m!\.\.\./!; + $paths{$Config{$exp_key}}++; + } + # Longest prefixes go first in the alternatives + my $alternations = join "|", map {quotemeta $_} + sort {length $b <=> length $a} keys %paths; + qr/^($alternations)/o; +} + +sub new($$) +{ +my ($class, $packfile) = @_; +$class = ref($class) || $class; +my %self; +tie(%self, $class, $packfile); +return(bless(\%self, $class)); +} + +sub TIEHASH +{ +my ($class, $packfile) = @_; +my $self = { packfile => $packfile }; +bless($self, $class); +$self->read($packfile) if (defined($packfile) && -f $packfile); +return($self); +} + +sub STORE +{ +$_[0]->{data}->{$_[1]} = $_[2]; +} + +sub FETCH +{ +return($_[0]->{data}->{$_[1]}); +} + +sub FIRSTKEY +{ +my $reset = scalar(keys(%{$_[0]->{data}})); +return(each(%{$_[0]->{data}})); +} + +sub NEXTKEY +{ +return(each(%{$_[0]->{data}})); +} + +sub EXISTS +{ +return(exists($_[0]->{data}->{$_[1]})); +} + +sub DELETE +{ +return(delete($_[0]->{data}->{$_[1]})); +} + +sub CLEAR +{ +%{$_[0]->{data}} = (); +} + +sub DESTROY +{ +} + +sub read($;$) +{ +my ($self, $packfile) = @_; +$self = tied(%$self) || $self; + +if (defined($packfile)) { $self->{packfile} = $packfile; } +else { $packfile = $self->{packfile}; } +Carp::croak("No packlist filename specified") if (! defined($packfile)); +my $fh = mkfh(); +open($fh, "<$packfile") || Carp::croak("Can't open file $packfile: $!"); +$self->{data} = {}; +my ($line); +while (defined($line = <$fh>)) + { + chomp $line; + my ($key, $data) = $line; + if ($key =~ /^(.*?)( \w+=.*)$/) + { + $key = $1; + $data = { map { split('=', $_) } split(' ', $2)}; + + if ($Config{userelocatableinc} && $data->{relocate_as}) + { + require File::Spec; + require Cwd; + my ($vol, $dir) = File::Spec->splitpath($packfile); + my $newpath = File::Spec->catpath($vol, $dir, $data->{relocate_as}); + $key = Cwd::realpath($newpath); + } + } + $key =~ s!/\./!/!g; # Some .packlists have spurious '/./' bits in the paths + $self->{data}->{$key} = $data; + } +close($fh); +} + +sub write($;$) +{ +my ($self, $packfile) = @_; +$self = tied(%$self) || $self; +if (defined($packfile)) { $self->{packfile} = $packfile; } +else { $packfile = $self->{packfile}; } +Carp::croak("No packlist filename specified") if (! defined($packfile)); +my $fh = mkfh(); +open($fh, ">$packfile") || Carp::croak("Can't open file $packfile: $!"); +foreach my $key (sort(keys(%{$self->{data}}))) + { + my $data = $self->{data}->{$key}; + if ($Config{userelocatableinc}) { + $Relocations ||= __find_relocations(); + if ($packfile =~ $Relocations) { + # We are writing into a subdirectory of a run-time relocated + # path. Figure out if the this file is also within a subdir. + my $prefix = $1; + if (File::Spec->no_upwards(File::Spec->abs2rel($key, $prefix))) + { + # The relocated path is within the found prefix + my $packfile_prefix; + (undef, $packfile_prefix) + = File::Spec->splitpath($packfile); + + my $relocate_as + = File::Spec->abs2rel($key, $packfile_prefix); + + if (!ref $data) { + $data = {}; + } + $data->{relocate_as} = $relocate_as; + } + } + } + print $fh ("$key"); + if (ref($data)) + { + foreach my $k (sort(keys(%$data))) + { + print $fh (" $k=$data->{$k}"); + } + } + print $fh ("\n"); + } +close($fh); +} + +sub validate($;$) +{ +my ($self, $remove) = @_; +$self = tied(%$self) || $self; +my @missing; +foreach my $key (sort(keys(%{$self->{data}}))) + { + if (! -e $key) + { + push(@missing, $key); + delete($self->{data}{$key}) if ($remove); + } + } +return(@missing); +} + +sub packlist_file($) +{ +my ($self) = @_; +$self = tied(%$self) || $self; +return($self->{packfile}); +} + +1; + +__END__ + +=head1 NAME + +ExtUtils::Packlist - manage .packlist files + +=head1 SYNOPSIS + + use ExtUtils::Packlist; + my ($pl) = ExtUtils::Packlist->new('.packlist'); + $pl->read('/an/old/.packlist'); + my @missing_files = $pl->validate(); + $pl->write('/a/new/.packlist'); + + $pl->{'/some/file/name'}++; + or + $pl->{'/some/other/file/name'} = { type => 'file', + from => '/some/file' }; + +=head1 DESCRIPTION + +ExtUtils::Packlist provides a standard way to manage .packlist files. +Functions are provided to read and write .packlist files. The original +.packlist format is a simple list of absolute pathnames, one per line. In +addition, this package supports an extended format, where as well as a filename +each line may contain a list of attributes in the form of a space separated +list of key=value pairs. This is used by the installperl script to +differentiate between files and links, for example. + +=head1 USAGE + +The hash reference returned by the new() function can be used to examine and +modify the contents of the .packlist. Items may be added/deleted from the +.packlist by modifying the hash. If the value associated with a hash key is a +scalar, the entry written to the .packlist by any subsequent write() will be a +simple filename. If the value is a hash, the entry written will be the +filename followed by the key=value pairs from the hash. Reading back the +.packlist will recreate the original entries. + +=head1 FUNCTIONS + +=over 4 + +=item new() + +This takes an optional parameter, the name of a .packlist. If the file exists, +it will be opened and the contents of the file will be read. The new() method +returns a reference to a hash. This hash holds an entry for each line in the +.packlist. In the case of old-style .packlists, the value associated with each +key is undef. In the case of new-style .packlists, the value associated with +each key is a hash containing the key=value pairs following the filename in the +.packlist. + +=item read() + +This takes an optional parameter, the name of the .packlist to be read. If +no file is specified, the .packlist specified to new() will be read. If the +.packlist does not exist, Carp::croak will be called. + +=item write() + +This takes an optional parameter, the name of the .packlist to be written. If +no file is specified, the .packlist specified to new() will be overwritten. + +=item validate() + +This checks that every file listed in the .packlist actually exists. If an +argument which evaluates to true is given, any missing files will be removed +from the internal hash. The return value is a list of the missing files, which +will be empty if they all exist. + +=item packlist_file() + +This returns the name of the associated .packlist file + +=back + +=head1 EXAMPLE + +Here's C<modrm>, a little utility to cleanly remove an installed module. + + #!/usr/local/bin/perl -w + + use strict; + use IO::Dir; + use ExtUtils::Packlist; + use ExtUtils::Installed; + + sub emptydir($) { + my ($dir) = @_; + my $dh = IO::Dir->new($dir) || return(0); + my @count = $dh->read(); + $dh->close(); + return(@count == 2 ? 1 : 0); + } + + # Find all the installed packages + print("Finding all installed modules...\n"); + my $installed = ExtUtils::Installed->new(); + + foreach my $module (grep(!/^Perl$/, $installed->modules())) { + my $version = $installed->version($module) || "???"; + print("Found module $module Version $version\n"); + print("Do you want to delete $module? [n] "); + my $r = <STDIN>; chomp($r); + if ($r && $r =~ /^y/i) { + # Remove all the files + foreach my $file (sort($installed->files($module))) { + print("rm $file\n"); + unlink($file); + } + my $pf = $installed->packlist($module)->packlist_file(); + print("rm $pf\n"); + unlink($pf); + foreach my $dir (sort($installed->directory_tree($module))) { + if (emptydir($dir)) { + print("rmdir $dir\n"); + rmdir($dir); + } + } + } + } + +=head1 AUTHOR + +Alan Burlison <Alan.Burlison@uk.sun.com> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pm new file mode 100644 index 0000000000000000000000000000000000000000..fba7f4d73dea3fbc98aa70414342c38fe115834b --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pm @@ -0,0 +1,2151 @@ +package ExtUtils::ParseXS; +use strict; + +use 5.006001; +use Cwd; +use Config; +use Exporter 'import'; +use File::Basename; +use File::Spec; +use Symbol; + +our $VERSION; +BEGIN { + $VERSION = '3.40'; + require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION); + require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION); + require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION); + require ExtUtils::ParseXS::Eval; ExtUtils::ParseXS::Eval->VERSION($VERSION); +} +$VERSION = eval $VERSION if $VERSION =~ /_/; + +use ExtUtils::ParseXS::Utilities qw( + standard_typemap_locations + trim_whitespace + C_string + valid_proto_string + process_typemaps + map_type + standard_XS_defs + assign_func_args + analyze_preprocessor_statements + set_cond + Warn + current_line_number + blurt + death + check_conditional_preprocessor_statements + escape_file_for_line_directive + report_typemap_failure +); + +our @EXPORT_OK = qw( + process_file + report_error_count +); + +############################## +# A number of "constants" + +our ($C_group_rex, $C_arg); +# Group in C (no support for comments or literals) +$C_group_rex = qr/ [({\[] + (?: (?> [^()\[\]{}]+ ) | (??{ $C_group_rex }) )* + [)}\]] /x; +# Chunk in C without comma at toplevel (no comments): +$C_arg = qr/ (?: (?> [^()\[\]{},"']+ ) + | (??{ $C_group_rex }) + | " (?: (?> [^\\"]+ ) + | \\. + )* " # String literal + | ' (?: (?> [^\\']+ ) | \\. )* ' # Char literal + )* /xs; + +# "impossible" keyword (multiple newline) +my $END = "!End!\n\n"; +# Match an XS Keyword +my $BLOCK_regexp = '\s*(' . $ExtUtils::ParseXS::Constants::XSKeywordsAlternation . "|$END)\\s*:"; + + + +sub new { + return bless {} => shift; +} + +our $Singleton = __PACKAGE__->new; + +sub process_file { + my $self; + # Allow for $package->process_file(%hash), $obj->process_file, and process_file() + if (@_ % 2) { + my $invocant = shift; + $self = ref($invocant) ? $invocant : $invocant->new; + } + else { + $self = $Singleton; + } + + my %options = @_; + $self->{ProtoUsed} = exists $options{prototypes}; + + # Set defaults. + my %args = ( + argtypes => 1, + csuffix => '.c', + except => 0, + hiertype => 0, + inout => 1, + linenumbers => 1, + optimize => 1, + output => \*STDOUT, + prototypes => 0, + typemap => [], + versioncheck => 1, + FH => Symbol::gensym(), + %options, + ); + $args{except} = $args{except} ? ' TRY' : ''; + + # Global Constants + + my ($Is_VMS, $SymSet); + if ($^O eq 'VMS') { + $Is_VMS = 1; + # Establish set of global symbols with max length 28, since xsubpp + # will later add the 'XS_' prefix. + require ExtUtils::XSSymSet; + $SymSet = ExtUtils::XSSymSet->new(28); + } + @{ $self->{XSStack} } = ({type => 'none'}); + $self->{InitFileCode} = [ @ExtUtils::ParseXS::Constants::InitFileCode ]; + $self->{Overload} = 0; # bool + $self->{errors} = 0; # count + $self->{Fallback} = '&PL_sv_undef'; + + # Most of the 1500 lines below uses these globals. We'll have to + # clean this up sometime, probably. For now, we just pull them out + # of %args. -Ken + + $self->{RetainCplusplusHierarchicalTypes} = $args{hiertype}; + $self->{WantPrototypes} = $args{prototypes}; + $self->{WantVersionChk} = $args{versioncheck}; + $self->{WantLineNumbers} = $args{linenumbers}; + $self->{IncludedFiles} = {}; + + die "Missing required parameter 'filename'" unless $args{filename}; + $self->{filepathname} = $args{filename}; + ($self->{dir}, $self->{filename}) = + (dirname($args{filename}), basename($args{filename})); + $self->{filepathname} =~ s/\\/\\\\/g; + $self->{IncludedFiles}->{$args{filename}}++; + + # Open the output file if given as a string. If they provide some + # other kind of reference, trust them that we can print to it. + if (not ref $args{output}) { + open my($fh), "> $args{output}" or die "Can't create $args{output}: $!"; + $args{outfile} = $args{output}; + $args{output} = $fh; + } + + # Really, we shouldn't have to chdir() or select() in the first + # place. For now, just save and restore. + my $orig_cwd = cwd(); + my $orig_fh = select(); + + chdir($self->{dir}); + my $pwd = cwd(); + my $csuffix = $args{csuffix}; + + if ($self->{WantLineNumbers}) { + my $cfile; + if ( $args{outfile} ) { + $cfile = $args{outfile}; + } + else { + $cfile = $args{filename}; + $cfile =~ s/\.xs$/$csuffix/i or $cfile .= $csuffix; + } + tie(*PSEUDO_STDOUT, 'ExtUtils::ParseXS::CountLines', $cfile, $args{output}); + select PSEUDO_STDOUT; + } + else { + select $args{output}; + } + + $self->{typemap} = process_typemaps( $args{typemap}, $pwd ); + + # Move more settings from parameters to object + foreach my $datum ( qw| argtypes except inout optimize | ) { + $self->{$datum} = $args{$datum}; + } + $self->{strip_c_func_prefix} = $args{s}; + + # Identify the version of xsubpp used + print <<EOM; +/* + * This file was generated automatically by ExtUtils::ParseXS version $VERSION from the + * contents of $self->{filename}. Do not edit this file, edit $self->{filename} instead. + * + * ANY CHANGES MADE HERE WILL BE LOST! + * + */ + +EOM + + + print("#line 1 \"" . escape_file_for_line_directive($self->{filepathname}) . "\"\n") + if $self->{WantLineNumbers}; + + # Open the input file (using $self->{filename} which + # is a basename'd $args{filename} due to chdir above) + open($self->{FH}, '<', $self->{filename}) or die "cannot open $self->{filename}: $!\n"; + + FIRSTMODULE: + while (readline($self->{FH})) { + if (/^=/) { + my $podstartline = $.; + do { + if (/^=cut\s*$/) { + # We can't just write out a /* */ comment, as our embedded + # POD might itself be in a comment. We can't put a /**/ + # comment inside #if 0, as the C standard says that the source + # file is decomposed into preprocessing characters in the stage + # before preprocessing commands are executed. + # I don't want to leave the text as barewords, because the spec + # isn't clear whether macros are expanded before or after + # preprocessing commands are executed, and someone pathological + # may just have defined one of the 3 words as a macro that does + # something strange. Multiline strings are illegal in C, so + # the "" we write must be a string literal. And they aren't + # concatenated until 2 steps later, so we are safe. + # - Nicholas Clark + print("#if 0\n \"Skipped embedded POD.\"\n#endif\n"); + printf("#line %d \"%s\"\n", $. + 1, escape_file_for_line_directive($self->{filepathname})) + if $self->{WantLineNumbers}; + next FIRSTMODULE; + } + + } while (readline($self->{FH})); + # At this point $. is at end of file so die won't state the start + # of the problem, and as we haven't yet read any lines &death won't + # show the correct line in the message either. + die ("Error: Unterminated pod in $self->{filename}, line $podstartline\n") + unless $self->{lastline}; + } + last if ($self->{Package}, $self->{Prefix}) = + /^MODULE\s*=\s*[\w:]+(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/; + + print $_; + } + unless (defined $_) { + warn "Didn't find a 'MODULE ... PACKAGE ... PREFIX' line\n"; + exit 0; # Not a fatal error for the caller process + } + + print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $self->{WantLineNumbers}; + + standard_XS_defs(); + + print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $self->{WantLineNumbers}; + + $self->{lastline} = $_; + $self->{lastline_no} = $.; + + my $BootCode_ref = []; + my $XSS_work_idx = 0; + my $cpp_next_tmp = 'XSubPPtmpAAAA'; + PARAGRAPH: + while ($self->fetch_para()) { + my $outlist_ref = []; + # Print initial preprocessor statements and blank lines + while (@{ $self->{line} } && $self->{line}->[0] !~ /^[^\#]/) { + my $ln = shift(@{ $self->{line} }); + print $ln, "\n"; + next unless $ln =~ /^\#\s*((if)(?:n?def)?|elsif|else|endif)\b/; + my $statement = $+; + ( $self, $XSS_work_idx, $BootCode_ref ) = + analyze_preprocessor_statements( + $self, $statement, $XSS_work_idx, $BootCode_ref + ); + } + + next PARAGRAPH unless @{ $self->{line} }; + + if ($XSS_work_idx && !$self->{XSStack}->[$XSS_work_idx]{varname}) { + # We are inside an #if, but have not yet #defined its xsubpp variable. + print "#define $cpp_next_tmp 1\n\n"; + push(@{ $self->{InitFileCode} }, "#if $cpp_next_tmp\n"); + push(@{ $BootCode_ref }, "#if $cpp_next_tmp"); + $self->{XSStack}->[$XSS_work_idx]{varname} = $cpp_next_tmp++; + } + + $self->death( + "Code is not inside a function" + ." (maybe last function was ended by a blank line " + ." followed by a statement on column one?)") + if $self->{line}->[0] =~ /^\s/; + + # initialize info arrays + foreach my $member (qw(args_match var_types defaults arg_list + argtype_seen in_out lengthof)) + { + $self->{$member} = {}; + } + $self->{proto_arg} = []; + $self->{processing_arg_with_types} = 0; # bool + $self->{proto_in_this_xsub} = 0; # counter & bool + $self->{scope_in_this_xsub} = 0; # counter & bool + $self->{interface} = 0; # bool + $self->{interface_macro} = 'XSINTERFACE_FUNC'; + $self->{interface_macro_set} = 'XSINTERFACE_FUNC_SET'; + $self->{ProtoThisXSUB} = $self->{WantPrototypes}; # states 0 (none), 1 (yes), 2 (empty prototype) + $self->{ScopeThisXSUB} = 0; # bool + + my $xsreturn = 0; + + $_ = shift(@{ $self->{line} }); + while (my $kwd = $self->check_keyword("REQUIRE|PROTOTYPES|EXPORT_XSUB_SYMBOLS|FALLBACK|VERSIONCHECK|INCLUDE(?:_COMMAND)?|SCOPE")) { + my $method = $kwd . "_handler"; + $self->$method($_); + next PARAGRAPH unless @{ $self->{line} }; + $_ = shift(@{ $self->{line} }); + } + + if ($self->check_keyword("BOOT")) { + check_conditional_preprocessor_statements($self); + push (@{ $BootCode_ref }, "#line $self->{line_no}->[@{ $self->{line_no} } - @{ $self->{line} }] \"" + . escape_file_for_line_directive($self->{filepathname}) . "\"") + if $self->{WantLineNumbers} && $self->{line}->[0] !~ /^\s*#\s*line\b/; + push (@{ $BootCode_ref }, @{ $self->{line} }, ""); + next PARAGRAPH; + } + + # extract return type, function name and arguments + ($self->{ret_type}) = ExtUtils::Typemaps::tidy_type($_); + my $RETVAL_no_return = 1 if $self->{ret_type} =~ s/^NO_OUTPUT\s+//; + + # Allow one-line ANSI-like declaration + unshift @{ $self->{line} }, $2 + if $self->{argtypes} + and $self->{ret_type} =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s; + + # a function definition needs at least 2 lines + $self->blurt("Error: Function definition too short '$self->{ret_type}'"), next PARAGRAPH + unless @{ $self->{line} }; + + my $externC = 1 if $self->{ret_type} =~ s/^extern "C"\s+//; + my $static = 1 if $self->{ret_type} =~ s/^static\s+//; + + my $func_header = shift(@{ $self->{line} }); + $self->blurt("Error: Cannot parse function definition from '$func_header'"), next PARAGRAPH + unless $func_header =~ /^(?:([\w:]*)::)?(\w+)\s*\(\s*(.*?)\s*\)\s*(const)?\s*(;\s*)?$/s; + + my ($class, $orig_args); + ($class, $self->{func_name}, $orig_args) = ($1, $2, $3); + $class = "$4 $class" if $4; + ($self->{pname} = $self->{func_name}) =~ s/^($self->{Prefix})?/$self->{Packprefix}/; + my $clean_func_name; + ($clean_func_name = $self->{func_name}) =~ s/^$self->{Prefix}//; + $self->{Full_func_name} = "$self->{Packid}_$clean_func_name"; + if ($Is_VMS) { + $self->{Full_func_name} = $SymSet->addsym( $self->{Full_func_name} ); + } + + # Check for duplicate function definition + for my $tmp (@{ $self->{XSStack} }) { + next unless defined $tmp->{functions}{ $self->{Full_func_name} }; + Warn( $self, "Warning: duplicate function definition '$clean_func_name' detected"); + last; + } + $self->{XSStack}->[$XSS_work_idx]{functions}{ $self->{Full_func_name} }++; + delete $self->{XsubAliases}; + delete $self->{XsubAliasValues}; + %{ $self->{Interfaces} } = (); + @{ $self->{Attributes} } = (); + $self->{DoSetMagic} = 1; + + $orig_args =~ s/\\\s*/ /g; # process line continuations + my @args; + + my (@fake_INPUT_pre); # For length(s) generated variables + my (@fake_INPUT); + my $only_C_inlist_ref = {}; # Not in the signature of Perl function + if ($self->{argtypes} and $orig_args =~ /\S/) { + my $args = "$orig_args ,"; + use re 'eval'; + if ($args =~ /^( (??{ $C_arg }) , )* $ /x) { + @args = ($args =~ /\G ( (??{ $C_arg }) ) , /xg); + no re 'eval'; + for ( @args ) { + s/^\s+//; + s/\s+$//; + my ($arg, $default) = ($_ =~ m/ ( [^=]* ) ( (?: = .* )? ) /x); + my ($pre, $len_name) = ($arg =~ /(.*?) \s* + \b ( \w+ | length\( \s*\w+\s* \) ) + \s* $ /x); + next unless defined($pre) && length($pre); + my $out_type = ''; + my $inout_var; + if ($self->{inout} and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//) { + my $type = $1; + $out_type = $type if $type ne 'IN'; + $arg =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//; + $pre =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//; + } + my $islength; + if ($len_name =~ /^length\( \s* (\w+) \s* \)\z/x) { + $len_name = "XSauto_length_of_$1"; + $islength = 1; + die "Default value on length() argument: '$_'" + if length $default; + } + if (length $pre or $islength) { # Has a type + if ($islength) { + push @fake_INPUT_pre, $arg; + } + else { + push @fake_INPUT, $arg; + } + # warn "pushing '$arg'\n"; + $self->{argtype_seen}->{$len_name}++; + $_ = "$len_name$default"; # Assigns to @args + } + $only_C_inlist_ref->{$_} = 1 if $out_type eq "OUTLIST" or $islength; + push @{ $outlist_ref }, $len_name if $out_type =~ /OUTLIST$/; + $self->{in_out}->{$len_name} = $out_type if $out_type; + } + } + else { + no re 'eval'; + @args = split(/\s*,\s*/, $orig_args); + Warn( $self, "Warning: cannot parse argument list '$orig_args', fallback to split"); + } + } + else { + @args = split(/\s*,\s*/, $orig_args); + for (@args) { + if ($self->{inout} and s/^(IN|IN_OUTLIST|OUTLIST|IN_OUT|OUT)\b\s*//) { + my $out_type = $1; + next if $out_type eq 'IN'; + $only_C_inlist_ref->{$_} = 1 if $out_type eq "OUTLIST"; + if ($out_type =~ /OUTLIST$/) { + push @{ $outlist_ref }, undef; + } + $self->{in_out}->{$_} = $out_type; + } + } + } + if (defined($class)) { + my $arg0 = ((defined($static) or $self->{func_name} eq 'new') + ? "CLASS" : "THIS"); + unshift(@args, $arg0); + } + my $extra_args = 0; + my @args_num = (); + my $num_args = 0; + my $report_args = ''; + my $ellipsis; + foreach my $i (0 .. $#args) { + if ($args[$i] =~ s/\.\.\.//) { + $ellipsis = 1; + if ($args[$i] eq '' && $i == $#args) { + $report_args .= ", ..."; + pop(@args); + last; + } + } + if ($only_C_inlist_ref->{$args[$i]}) { + push @args_num, undef; + } + else { + push @args_num, ++$num_args; + $report_args .= ", $args[$i]"; + } + if ($args[$i] =~ /^([^=]*[^\s=])\s*=\s*(.*)/s) { + $extra_args++; + $args[$i] = $1; + $self->{defaults}->{$args[$i]} = $2; + $self->{defaults}->{$args[$i]} =~ s/"/\\"/g; + } + $self->{proto_arg}->[$i+1] = '$' unless $only_C_inlist_ref->{$args[$i]}; + } + my $min_args = $num_args - $extra_args; + $report_args =~ s/"/\\"/g; + $report_args =~ s/^,\s+//; + $self->{func_args} = assign_func_args($self, \@args, $class); + @{ $self->{args_match} }{@args} = @args_num; + + my $PPCODE = grep(/^\s*PPCODE\s*:/, @{ $self->{line} }); + my $CODE = grep(/^\s*CODE\s*:/, @{ $self->{line} }); + # Detect CODE: blocks which use ST(n)= or XST_m*(n,v) + # to set explicit return values. + my $EXPLICIT_RETURN = ($CODE && + ("@{ $self->{line} }" =~ /(\bST\s*\([^;]*=) | (\bXST_m\w+\s*\()/x )); + + $self->{ALIAS} = grep(/^\s*ALIAS\s*:/, @{ $self->{line} }); + + my $INTERFACE = grep(/^\s*INTERFACE\s*:/, @{ $self->{line} }); + + $xsreturn = 1 if $EXPLICIT_RETURN; + + $externC = $externC ? qq[extern "C"] : ""; + + # print function header + print Q(<<"EOF"); +#$externC +#XS_EUPXS(XS_$self->{Full_func_name}); /* prototype to pass -Wmissing-prototypes */ +#XS_EUPXS(XS_$self->{Full_func_name}) +#[[ +# dVAR; dXSARGS; +EOF + print Q(<<"EOF") if $self->{ALIAS}; +# dXSI32; +EOF + print Q(<<"EOF") if $INTERFACE; +# dXSFUNCTION($self->{ret_type}); +EOF + + $self->{cond} = set_cond($ellipsis, $min_args, $num_args); + + print Q(<<"EOF") if $self->{except}; +# char errbuf[1024]; +# *errbuf = '\\0'; +EOF + + if($self->{cond}) { + print Q(<<"EOF"); +# if ($self->{cond}) +# croak_xs_usage(cv, "$report_args"); +EOF + } + else { + # cv and items likely to be unused + print Q(<<"EOF"); +# PERL_UNUSED_VAR(cv); /* -W */ +# PERL_UNUSED_VAR(items); /* -W */ +EOF + } + + #gcc -Wall: if an xsub has PPCODE is used + #it is possible none of ST, XSRETURN or XSprePUSH macros are used + #hence 'ax' (setup by dXSARGS) is unused + #XXX: could breakup the dXSARGS; into dSP;dMARK;dITEMS + #but such a move could break third-party extensions + print Q(<<"EOF") if $PPCODE; +# PERL_UNUSED_VAR(ax); /* -Wall */ +EOF + + print Q(<<"EOF") if $PPCODE; +# SP -= items; +EOF + + # Now do a block of some sort. + + $self->{condnum} = 0; + $self->{cond} = ''; # last CASE: conditional + push(@{ $self->{line} }, "$END:"); + push(@{ $self->{line_no} }, $self->{line_no}->[-1]); + $_ = ''; + check_conditional_preprocessor_statements(); + while (@{ $self->{line} }) { + + $self->CASE_handler($_) if $self->check_keyword("CASE"); + print Q(<<"EOF"); +# $self->{except} [[ +EOF + + # do initialization of input variables + $self->{thisdone} = 0; + $self->{retvaldone} = 0; + $self->{deferred} = ""; + %{ $self->{arg_list} } = (); + $self->{gotRETVAL} = 0; + $self->INPUT_handler($_); + $self->process_keyword("INPUT|PREINIT|INTERFACE_MACRO|C_ARGS|ALIAS|ATTRS|PROTOTYPE|SCOPE|OVERLOAD"); + + print Q(<<"EOF") if $self->{ScopeThisXSUB}; +# ENTER; +# [[ +EOF + + if (!$self->{thisdone} && defined($class)) { + if (defined($static) or $self->{func_name} eq 'new') { + print "\tchar *"; + $self->{var_types}->{"CLASS"} = "char *"; + $self->generate_init( { + type => "char *", + num => 1, + var => "CLASS", + printed_name => undef, + } ); + } + else { + print "\t" . map_type($self, "$class *"); + $self->{var_types}->{"THIS"} = "$class *"; + $self->generate_init( { + type => "$class *", + num => 1, + var => "THIS", + printed_name => undef, + } ); + } + } + + # These are set if OUTPUT is found and/or CODE using RETVAL + $self->{have_OUTPUT} = $self->{have_CODE_with_RETVAL} = 0; + + my ($wantRETVAL); + # do code + if (/^\s*NOT_IMPLEMENTED_YET/) { + print "\n\tPerl_croak(aTHX_ \"$self->{pname}: not implemented yet\");\n"; + $_ = ''; + } + else { + if ($self->{ret_type} ne "void") { + print "\t" . map_type($self, $self->{ret_type}, 'RETVAL') . ";\n" + if !$self->{retvaldone}; + $self->{args_match}->{"RETVAL"} = 0; + $self->{var_types}->{"RETVAL"} = $self->{ret_type}; + my $outputmap = $self->{typemap}->get_outputmap( ctype => $self->{ret_type} ); + print "\tdXSTARG;\n" + if $self->{optimize} and $outputmap and $outputmap->targetable; + } + + if (@fake_INPUT or @fake_INPUT_pre) { + unshift @{ $self->{line} }, @fake_INPUT_pre, @fake_INPUT, $_; + $_ = ""; + $self->{processing_arg_with_types} = 1; + $self->INPUT_handler($_); + } + print $self->{deferred}; + + $self->process_keyword("INIT|ALIAS|ATTRS|PROTOTYPE|INTERFACE_MACRO|INTERFACE|C_ARGS|OVERLOAD"); + + if ($self->check_keyword("PPCODE")) { + $self->print_section(); + $self->death("PPCODE must be last thing") if @{ $self->{line} }; + print "\tLEAVE;\n" if $self->{ScopeThisXSUB}; + print "\tPUTBACK;\n\treturn;\n"; + } + elsif ($self->check_keyword("CODE")) { + my $consumed_code = $self->print_section(); + if ($consumed_code =~ /\bRETVAL\b/) { + $self->{have_CODE_with_RETVAL} = 1; + } + } + elsif (defined($class) and $self->{func_name} eq "DESTROY") { + print "\n\t"; + print "delete THIS;\n"; + } + else { + print "\n\t"; + if ($self->{ret_type} ne "void") { + print "RETVAL = "; + $wantRETVAL = 1; + } + if (defined($static)) { + if ($self->{func_name} eq 'new') { + $self->{func_name} = "$class"; + } + else { + print "${class}::"; + } + } + elsif (defined($class)) { + if ($self->{func_name} eq 'new') { + $self->{func_name} .= " $class"; + } + else { + print "THIS->"; + } + } + my $strip = $self->{strip_c_func_prefix}; + $self->{func_name} =~ s/^\Q$strip// + if defined $strip; + $self->{func_name} = 'XSFUNCTION' if $self->{interface}; + print "$self->{func_name}($self->{func_args});\n"; + } + } + + # do output variables + $self->{gotRETVAL} = 0; # 1 if RETVAL seen in OUTPUT section; + undef $self->{RETVAL_code} ; # code to set RETVAL (from OUTPUT section); + # $wantRETVAL set if 'RETVAL =' autogenerated + ($wantRETVAL, $self->{ret_type}) = (0, 'void') if $RETVAL_no_return; + undef %{ $self->{outargs} }; + + $self->process_keyword("POSTCALL|OUTPUT|ALIAS|ATTRS|PROTOTYPE|OVERLOAD"); + + # A CODE section with RETVAL, but no OUTPUT? FAIL! + if ($self->{have_CODE_with_RETVAL} and not $self->{have_OUTPUT} and $self->{ret_type} ne 'void') { + $self->Warn("Warning: Found a 'CODE' section which seems to be using 'RETVAL' but no 'OUTPUT' section."); + } + + $self->generate_output( { + type => $self->{var_types}->{$_}, + num => $self->{args_match}->{$_}, + var => $_, + do_setmagic => $self->{DoSetMagic}, + do_push => undef, + } ) for grep $self->{in_out}->{$_} =~ /OUT$/, sort keys %{ $self->{in_out} }; + + my $prepush_done; + # all OUTPUT done, so now push the return value on the stack + if ($self->{gotRETVAL} && $self->{RETVAL_code}) { + print "\t$self->{RETVAL_code}\n"; + } + elsif ($self->{gotRETVAL} || $wantRETVAL) { + my $outputmap = $self->{typemap}->get_outputmap( ctype => $self->{ret_type} ); + my $trgt = $self->{optimize} && $outputmap && $outputmap->targetable; + my $var = 'RETVAL'; + my $type = $self->{ret_type}; + + if ($trgt) { + my $what = $self->eval_output_typemap_code( + qq("$trgt->{what}"), + {var => $var, type => $self->{ret_type}} + ); + if (not $trgt->{with_size} and $trgt->{type} eq 'p') { # sv_setpv + # PUSHp corresponds to sv_setpvn. Treat sv_setpv directly + print "\tsv_setpv(TARG, $what); XSprePUSH; PUSHTARG;\n"; + $prepush_done = 1; + } + else { + my $tsize = $trgt->{what_size}; + $tsize = '' unless defined $tsize; + $tsize = $self->eval_output_typemap_code( + qq("$tsize"), + {var => $var, type => $self->{ret_type}} + ); + print "\tXSprePUSH; PUSH$trgt->{type}($what$tsize);\n"; + $prepush_done = 1; + } + } + else { + # RETVAL almost never needs SvSETMAGIC() + $self->generate_output( { + type => $self->{ret_type}, + num => 0, + var => 'RETVAL', + do_setmagic => 0, + do_push => undef, + } ); + } + } + + $xsreturn = 1 if $self->{ret_type} ne "void"; + my $num = $xsreturn; + my $c = @{ $outlist_ref }; + print "\tXSprePUSH;" if $c and not $prepush_done; + print "\tEXTEND(SP,$c);\n" if $c; + $xsreturn += $c; + $self->generate_output( { + type => $self->{var_types}->{$_}, + num => $num++, + var => $_, + do_setmagic => 0, + do_push => 1, + } ) for @{ $outlist_ref }; + + # do cleanup + $self->process_keyword("CLEANUP|ALIAS|ATTRS|PROTOTYPE|OVERLOAD"); + + print Q(<<"EOF") if $self->{ScopeThisXSUB}; +# ]] +EOF + print Q(<<"EOF") if $self->{ScopeThisXSUB} and not $PPCODE; +# LEAVE; +EOF + + # print function trailer + print Q(<<"EOF"); +# ]] +EOF + print Q(<<"EOF") if $self->{except}; +# BEGHANDLERS +# CATCHALL +# sprintf(errbuf, "%s: %s\\tpropagated", Xname, Xreason); +# ENDHANDLERS +EOF + if ($self->check_keyword("CASE")) { + $self->blurt("Error: No 'CASE:' at top of function") + unless $self->{condnum}; + $_ = "CASE: $_"; # Restore CASE: label + next; + } + last if $_ eq "$END:"; + $self->death(/^$BLOCK_regexp/o ? "Misplaced '$1:'" : "Junk at end of function ($_)"); + } + + print Q(<<"EOF") if $self->{except}; +# if (errbuf[0]) +# Perl_croak(aTHX_ errbuf); +EOF + + if ($xsreturn) { + print Q(<<"EOF") unless $PPCODE; +# XSRETURN($xsreturn); +EOF + } + else { + print Q(<<"EOF") unless $PPCODE; +# XSRETURN_EMPTY; +EOF + } + + print Q(<<"EOF"); +#]] +# +EOF + + $self->{proto} = ""; + unless($self->{ProtoThisXSUB}) { + $self->{newXS} = "newXS_deffile"; + $self->{file} = ""; + } + else { + # Build the prototype string for the xsub + $self->{newXS} = "newXSproto_portable"; + $self->{file} = ", file"; + + if ($self->{ProtoThisXSUB} eq 2) { + # User has specified empty prototype + } + elsif ($self->{ProtoThisXSUB} eq 1) { + my $s = ';'; + if ($min_args < $num_args) { + $s = ''; + $self->{proto_arg}->[$min_args] .= ";"; + } + push @{ $self->{proto_arg} }, "$s\@" + if $ellipsis; + + $self->{proto} = join ("", grep defined, @{ $self->{proto_arg} } ); + } + else { + # User has specified a prototype + $self->{proto} = $self->{ProtoThisXSUB}; + } + $self->{proto} = qq{, "$self->{proto}"}; + } + + if ($self->{XsubAliases} and keys %{ $self->{XsubAliases} }) { + $self->{XsubAliases}->{ $self->{pname} } = 0 + unless defined $self->{XsubAliases}->{ $self->{pname} }; + foreach my $xname (sort keys %{ $self->{XsubAliases} }) { + my $value = $self->{XsubAliases}{$xname}; + push(@{ $self->{InitFileCode} }, Q(<<"EOF")); +# cv = $self->{newXS}(\"$xname\", XS_$self->{Full_func_name}$self->{file}$self->{proto}); +# XSANY.any_i32 = $value; +EOF + } + } + elsif (@{ $self->{Attributes} }) { + push(@{ $self->{InitFileCode} }, Q(<<"EOF")); +# cv = $self->{newXS}(\"$self->{pname}\", XS_$self->{Full_func_name}$self->{file}$self->{proto}); +# apply_attrs_string("$self->{Package}", cv, "@{ $self->{Attributes} }", 0); +EOF + } + elsif ($self->{interface}) { + foreach my $yname (sort keys %{ $self->{Interfaces} }) { + my $value = $self->{Interfaces}{$yname}; + $yname = "$self->{Package}\::$yname" unless $yname =~ /::/; + push(@{ $self->{InitFileCode} }, Q(<<"EOF")); +# cv = $self->{newXS}(\"$yname\", XS_$self->{Full_func_name}$self->{file}$self->{proto}); +# $self->{interface_macro_set}(cv,$value); +EOF + } + } + elsif($self->{newXS} eq 'newXS_deffile'){ # work around P5NCI's empty newXS macro + push(@{ $self->{InitFileCode} }, + " $self->{newXS}(\"$self->{pname}\", XS_$self->{Full_func_name}$self->{file}$self->{proto});\n"); + } + else { + push(@{ $self->{InitFileCode} }, + " (void)$self->{newXS}(\"$self->{pname}\", XS_$self->{Full_func_name}$self->{file}$self->{proto});\n"); + } + } # END 'PARAGRAPH' 'while' loop + + if ($self->{Overload}) { # make it findable with fetchmethod + print Q(<<"EOF"); +#XS_EUPXS(XS_$self->{Packid}_nil); /* prototype to pass -Wmissing-prototypes */ +#XS_EUPXS(XS_$self->{Packid}_nil) +#{ +# dXSARGS; +# PERL_UNUSED_VAR(items); +# XSRETURN_EMPTY; +#} +# +EOF + unshift(@{ $self->{InitFileCode} }, <<"MAKE_FETCHMETHOD_WORK"); + /* Making a sub named "$self->{Package}::()" allows the package */ + /* to be findable via fetchmethod(), and causes */ + /* overload::Overloaded("$self->{Package}") to return true. */ + (void)$self->{newXS}("$self->{Package}::()", XS_$self->{Packid}_nil$self->{file}$self->{proto}); +MAKE_FETCHMETHOD_WORK + } + + # print initialization routine + + print Q(<<"EOF"); +##ifdef __cplusplus +#extern "C" +##endif +EOF + + print Q(<<"EOF"); +#XS_EXTERNAL(boot_$self->{Module_cname}); /* prototype to pass -Wmissing-prototypes */ +#XS_EXTERNAL(boot_$self->{Module_cname}) +#[[ +##if PERL_VERSION_LE(5, 21, 5) +# dVAR; dXSARGS; +##else +# dVAR; ${\($self->{WantVersionChk} ? + 'dXSBOOTARGSXSAPIVERCHK;' : 'dXSBOOTARGSAPIVERCHK;')} +##endif +EOF + + #Under 5.8.x and lower, newXS is declared in proto.h as expecting a non-const + #file name argument. If the wrong qualifier is used, it causes breakage with + #C++ compilers and warnings with recent gcc. + #-Wall: if there is no $self->{Full_func_name} there are no xsubs in this .xs + #so 'file' is unused + print Q(<<"EOF") if $self->{Full_func_name}; +##if (PERL_REVISION == 5 && PERL_VERSION < 9) +# char* file = __FILE__; +##else +# const char* file = __FILE__; +##endif +# +# PERL_UNUSED_VAR(file); +EOF + + print Q("#\n"); + + print Q(<<"EOF"); +# PERL_UNUSED_VAR(cv); /* -W */ +# PERL_UNUSED_VAR(items); /* -W */ +EOF + + if( $self->{WantVersionChk}){ + print Q(<<"EOF") ; +##if PERL_VERSION_LE(5, 21, 5) +# XS_VERSION_BOOTCHECK; +## ifdef XS_APIVERSION_BOOTCHECK +# XS_APIVERSION_BOOTCHECK; +## endif +##endif + +EOF + } else { + print Q(<<"EOF") ; +##if PERL_VERSION_LE(5, 21, 5) && defined(XS_APIVERSION_BOOTCHECK) +# XS_APIVERSION_BOOTCHECK; +##endif + +EOF + } + + print Q(<<"EOF") if defined $self->{XsubAliases} or defined $self->{interfaces}; +# { +# CV * cv; +# +EOF + + print Q(<<"EOF") if ($self->{Overload}); +# /* register the overloading (type 'A') magic */ +##if (PERL_REVISION == 5 && PERL_VERSION < 9) +# PL_amagic_generation++; +##endif +# /* The magic for overload gets a GV* via gv_fetchmeth as */ +# /* mentioned above, and looks in the SV* slot of it for */ +# /* the "fallback" status. */ +# sv_setsv( +# get_sv( "$self->{Package}::()", TRUE ), +# $self->{Fallback} +# ); +EOF + + print @{ $self->{InitFileCode} }; + + print Q(<<"EOF") if defined $self->{XsubAliases} or defined $self->{interfaces}; +# } +EOF + + if (@{ $BootCode_ref }) { + print "\n /* Initialisation Section */\n\n"; + @{ $self->{line} } = @{ $BootCode_ref }; + $self->print_section(); + print "\n /* End of Initialisation Section */\n\n"; + } + + print Q(<<'EOF'); +##if PERL_VERSION_LE(5, 21, 5) +## if PERL_VERSION_GE(5, 9, 0) +# if (PL_unitcheckav) +# call_list(PL_scopestack_ix, PL_unitcheckav); +## endif +# XSRETURN_YES; +##else +# Perl_xs_boot_epilog(aTHX_ ax); +##endif +#]] +# +EOF + + warn("Please specify prototyping behavior for $self->{filename} (see perlxs manual)\n") + unless $self->{ProtoUsed}; + + chdir($orig_cwd); + select($orig_fh); + untie *PSEUDO_STDOUT if tied *PSEUDO_STDOUT; + close $self->{FH}; + + return 1; +} + +sub report_error_count { + if (@_) { + return $_[0]->{errors}||0; + } + else { + return $Singleton->{errors}||0; + } +} + +# Input: ($self, $_, @{ $self->{line} }) == unparsed input. +# Output: ($_, @{ $self->{line} }) == (rest of line, following lines). +# Return: the matched keyword if found, otherwise 0 +sub check_keyword { + my $self = shift; + $_ = shift(@{ $self->{line} }) while !/\S/ && @{ $self->{line} }; + s/^(\s*)($_[0])\s*:\s*(?:#.*)?/$1/s && $2; +} + +sub print_section { + my $self = shift; + + # the "do" is required for right semantics + do { $_ = shift(@{ $self->{line} }) } while !/\S/ && @{ $self->{line} }; + + my $consumed_code = ''; + + print("#line ", $self->{line_no}->[@{ $self->{line_no} } - @{ $self->{line} } -1], " \"", + escape_file_for_line_directive($self->{filepathname}), "\"\n") + if $self->{WantLineNumbers} && !/^\s*#\s*line\b/ && !/^#if XSubPPtmp/; + for (; defined($_) && !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + print "$_\n"; + $consumed_code .= "$_\n"; + } + print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $self->{WantLineNumbers}; + + return $consumed_code; +} + +sub merge_section { + my $self = shift; + my $in = ''; + + while (!/\S/ && @{ $self->{line} }) { + $_ = shift(@{ $self->{line} }); + } + + for (; defined($_) && !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + $in .= "$_\n"; + } + chomp $in; + return $in; +} + +sub process_keyword { + my($self, $pattern) = @_; + + while (my $kwd = $self->check_keyword($pattern)) { + my $method = $kwd . "_handler"; + $self->$method($_); + } +} + +sub CASE_handler { + my $self = shift; + $_ = shift; + $self->blurt("Error: 'CASE:' after unconditional 'CASE:'") + if $self->{condnum} && $self->{cond} eq ''; + $self->{cond} = $_; + trim_whitespace($self->{cond}); + print " ", ($self->{condnum}++ ? " else" : ""), ($self->{cond} ? " if ($self->{cond})\n" : "\n"); + $_ = ''; +} + +sub INPUT_handler { + my $self = shift; + $_ = shift; + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + last if /^\s*NOT_IMPLEMENTED_YET/; + next unless /\S/; # skip blank lines + + trim_whitespace($_); + my $ln = $_; + + # remove trailing semicolon if no initialisation + s/\s*;$//g unless /[=;+].*\S/; + + # Process the length(foo) declarations + if (s/^([^=]*)\blength\(\s*(\w+)\s*\)\s*$/$1 XSauto_length_of_$2=NO_INIT/x) { + print "\tSTRLEN\tSTRLEN_length_of_$2;\n"; + $self->{lengthof}->{$2} = undef; + $self->{deferred} .= "\n\tXSauto_length_of_$2 = STRLEN_length_of_$2;\n"; + } + + # check for optional initialisation code + my $var_init = ''; + $var_init = $1 if s/\s*([=;+].*)$//s; + $var_init =~ s/"/\\"/g; + # *sigh* It's valid to supply explicit input typemaps in the argument list... + my $is_overridden_typemap = $var_init =~ /ST\s*\(|\$arg\b/; + + s/\s+/ /g; + my ($var_type, $var_addr, $var_name) = /^(.*?[^&\s])\s*(\&?)\s*\b(\w+)$/s + or $self->blurt("Error: invalid argument declaration '$ln'"), next; + + # Check for duplicate definitions + $self->blurt("Error: duplicate definition of argument '$var_name' ignored"), next + if $self->{arg_list}->{$var_name}++ + or defined $self->{argtype_seen}->{$var_name} and not $self->{processing_arg_with_types}; + + $self->{thisdone} |= $var_name eq "THIS"; + $self->{retvaldone} |= $var_name eq "RETVAL"; + $self->{var_types}->{$var_name} = $var_type; + # XXXX This check is a safeguard against the unfinished conversion of + # generate_init(). When generate_init() is fixed, + # one can use 2-args map_type() unconditionally. + my $printed_name; + if ($var_type =~ / \( \s* \* \s* \) /x) { + # Function pointers are not yet supported with output_init()! + print "\t" . map_type($self, $var_type, $var_name); + $printed_name = 1; + } + else { + print "\t" . map_type($self, $var_type, undef); + $printed_name = 0; + } + $self->{var_num} = $self->{args_match}->{$var_name}; + + if ($self->{var_num}) { + my $typemap = $self->{typemap}->get_typemap(ctype => $var_type); + $self->report_typemap_failure($self->{typemap}, $var_type, "death") + if not $typemap and not $is_overridden_typemap; + $self->{proto_arg}->[$self->{var_num}] = ($typemap && $typemap->proto) || "\$"; + } + $self->{func_args} =~ s/\b($var_name)\b/&$1/ if $var_addr; + if ($var_init =~ /^[=;]\s*NO_INIT\s*;?\s*$/ + or $self->{in_out}->{$var_name} and $self->{in_out}->{$var_name} =~ /^OUT/ + and $var_init !~ /\S/) { + if ($printed_name) { + print ";\n"; + } + else { + print "\t$var_name;\n"; + } + } + elsif ($var_init =~ /\S/) { + $self->output_init( { + type => $var_type, + num => $self->{var_num}, + var => $var_name, + init => $var_init, + printed_name => $printed_name, + } ); + } + elsif ($self->{var_num}) { + $self->generate_init( { + type => $var_type, + num => $self->{var_num}, + var => $var_name, + printed_name => $printed_name, + } ); + } + else { + print ";\n"; + } + } +} + +sub OUTPUT_handler { + my $self = shift; + $self->{have_OUTPUT} = 1; + + $_ = shift; + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + next unless /\S/; + if (/^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/) { + $self->{DoSetMagic} = ($1 eq "ENABLE" ? 1 : 0); + next; + } + my ($outarg, $outcode) = /^\s*(\S+)\s*(.*?)\s*$/s; + $self->blurt("Error: duplicate OUTPUT argument '$outarg' ignored"), next + if $self->{outargs}->{$outarg}++; + if (!$self->{gotRETVAL} and $outarg eq 'RETVAL') { + # deal with RETVAL last + $self->{RETVAL_code} = $outcode; + $self->{gotRETVAL} = 1; + next; + } + $self->blurt("Error: OUTPUT $outarg not an argument"), next + unless defined($self->{args_match}->{$outarg}); + $self->blurt("Error: No input definition for OUTPUT argument '$outarg' - ignored"), next + unless defined $self->{var_types}->{$outarg}; + $self->{var_num} = $self->{args_match}->{$outarg}; + if ($outcode) { + print "\t$outcode\n"; + print "\tSvSETMAGIC(ST(" , $self->{var_num} - 1 , "));\n" if $self->{DoSetMagic}; + } + else { + $self->generate_output( { + type => $self->{var_types}->{$outarg}, + num => $self->{var_num}, + var => $outarg, + do_setmagic => $self->{DoSetMagic}, + do_push => undef, + } ); + } + delete $self->{in_out}->{$outarg} # No need to auto-OUTPUT + if exists $self->{in_out}->{$outarg} and $self->{in_out}->{$outarg} =~ /OUT$/; + } +} + +sub C_ARGS_handler { + my $self = shift; + $_ = shift; + my $in = $self->merge_section(); + + trim_whitespace($in); + $self->{func_args} = $in; +} + +sub INTERFACE_MACRO_handler { + my $self = shift; + $_ = shift; + my $in = $self->merge_section(); + + trim_whitespace($in); + if ($in =~ /\s/) { # two + ($self->{interface_macro}, $self->{interface_macro_set}) = split ' ', $in; + } + else { + $self->{interface_macro} = $in; + $self->{interface_macro_set} = 'UNKNOWN_CVT'; # catch later + } + $self->{interface} = 1; # local + $self->{interfaces} = 1; # global +} + +sub INTERFACE_handler { + my $self = shift; + $_ = shift; + my $in = $self->merge_section(); + + trim_whitespace($in); + + foreach (split /[\s,]+/, $in) { + my $iface_name = $_; + $iface_name =~ s/^$self->{Prefix}//; + $self->{Interfaces}->{$iface_name} = $_; + } + print Q(<<"EOF"); +# XSFUNCTION = $self->{interface_macro}($self->{ret_type},cv,XSANY.any_dptr); +EOF + $self->{interface} = 1; # local + $self->{interfaces} = 1; # global +} + +sub CLEANUP_handler { + my $self = shift; + $self->print_section(); +} + +sub PREINIT_handler { + my $self = shift; + $self->print_section(); +} + +sub POSTCALL_handler { + my $self = shift; + $self->print_section(); +} + +sub INIT_handler { + my $self = shift; + $self->print_section(); +} + +sub get_aliases { + my $self = shift; + my ($line) = @_; + my ($orig) = $line; + + # Parse alias definitions + # format is + # alias = value alias = value ... + + while ($line =~ s/^\s*([\w:]+)\s*=\s*(\w+)\s*//) { + my ($alias, $value) = ($1, $2); + my $orig_alias = $alias; + + # check for optional package definition in the alias + $alias = $self->{Packprefix} . $alias if $alias !~ /::/; + + # check for duplicate alias name & duplicate value + Warn( $self, "Warning: Ignoring duplicate alias '$orig_alias'") + if defined $self->{XsubAliases}->{$alias}; + + Warn( $self, "Warning: Aliases '$orig_alias' and '$self->{XsubAliasValues}->{$value}' have identical values") + if $self->{XsubAliasValues}->{$value}; + + $self->{XsubAliases}->{$alias} = $value; + $self->{XsubAliasValues}->{$value} = $orig_alias; + } + + blurt( $self, "Error: Cannot parse ALIAS definitions from '$orig'") + if $line; +} + +sub ATTRS_handler { + my $self = shift; + $_ = shift; + + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + next unless /\S/; + trim_whitespace($_); + push @{ $self->{Attributes} }, $_; + } +} + +sub ALIAS_handler { + my $self = shift; + $_ = shift; + + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + next unless /\S/; + trim_whitespace($_); + $self->get_aliases($_) if $_; + } +} + +sub OVERLOAD_handler { + my $self = shift; + $_ = shift; + + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + next unless /\S/; + trim_whitespace($_); + while ( s/^\s*([\w:"\\)\+\-\*\/\%\<\>\.\&\|\^\!\~\{\}\=]+)\s*//) { + $self->{Overload} = 1 unless $self->{Overload}; + my $overload = "$self->{Package}\::(".$1; + push(@{ $self->{InitFileCode} }, + " (void)$self->{newXS}(\"$overload\", XS_$self->{Full_func_name}$self->{file}$self->{proto});\n"); + } + } +} + +sub FALLBACK_handler { + my ($self, $setting) = @_; + + # the rest of the current line should contain either TRUE, + # FALSE or UNDEF + + trim_whitespace($setting); + $setting = uc($setting); + + my %map = ( + TRUE => "&PL_sv_yes", 1 => "&PL_sv_yes", + FALSE => "&PL_sv_no", 0 => "&PL_sv_no", + UNDEF => "&PL_sv_undef", + ); + + # check for valid FALLBACK value + $self->death("Error: FALLBACK: TRUE/FALSE/UNDEF") unless exists $map{$setting}; + + $self->{Fallback} = $map{$setting}; +} + + +sub REQUIRE_handler { + # the rest of the current line should contain a version number + my ($self, $ver) = @_; + + trim_whitespace($ver); + + $self->death("Error: REQUIRE expects a version number") + unless $ver; + + # check that the version number is of the form n.n + $self->death("Error: REQUIRE: expected a number, got '$ver'") + unless $ver =~ /^\d+(\.\d*)?/; + + $self->death("Error: xsubpp $ver (or better) required--this is only $VERSION.") + unless $VERSION >= $ver; +} + +sub VERSIONCHECK_handler { + # the rest of the current line should contain either ENABLE or + # DISABLE + my ($self, $setting) = @_; + + trim_whitespace($setting); + + # check for ENABLE/DISABLE + $self->death("Error: VERSIONCHECK: ENABLE/DISABLE") + unless $setting =~ /^(ENABLE|DISABLE)/i; + + $self->{WantVersionChk} = 1 if $1 eq 'ENABLE'; + $self->{WantVersionChk} = 0 if $1 eq 'DISABLE'; + +} + +sub PROTOTYPE_handler { + my $self = shift; + $_ = shift; + + my $specified; + + $self->death("Error: Only 1 PROTOTYPE definition allowed per xsub") + if $self->{proto_in_this_xsub}++; + + for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) { + next unless /\S/; + $specified = 1; + trim_whitespace($_); + if ($_ eq 'DISABLE') { + $self->{ProtoThisXSUB} = 0; + } + elsif ($_ eq 'ENABLE') { + $self->{ProtoThisXSUB} = 1; + } + else { + # remove any whitespace + s/\s+//g; + $self->death("Error: Invalid prototype '$_'") + unless valid_proto_string($_); + $self->{ProtoThisXSUB} = C_string($_); + } + } + + # If no prototype specified, then assume empty prototype "" + $self->{ProtoThisXSUB} = 2 unless $specified; + + $self->{ProtoUsed} = 1; +} + +sub SCOPE_handler { + # Rest of line should be either ENABLE or DISABLE + my ($self, $setting) = @_; + + $self->death("Error: Only 1 SCOPE declaration allowed per xsub") + if $self->{scope_in_this_xsub}++; + + trim_whitespace($setting); + $self->death("Error: SCOPE: ENABLE/DISABLE") + unless $setting =~ /^(ENABLE|DISABLE)\b/i; + $self->{ScopeThisXSUB} = ( uc($1) eq 'ENABLE' ); +} + +sub PROTOTYPES_handler { + # the rest of the current line should contain either ENABLE or + # DISABLE + my ($self, $setting) = @_; + + trim_whitespace($setting); + + # check for ENABLE/DISABLE + $self->death("Error: PROTOTYPES: ENABLE/DISABLE") + unless $setting =~ /^(ENABLE|DISABLE)/i; + + $self->{WantPrototypes} = 1 if $1 eq 'ENABLE'; + $self->{WantPrototypes} = 0 if $1 eq 'DISABLE'; + $self->{ProtoUsed} = 1; +} + +sub EXPORT_XSUB_SYMBOLS_handler { + # the rest of the current line should contain either ENABLE or + # DISABLE + my ($self, $setting) = @_; + + trim_whitespace($setting); + + # check for ENABLE/DISABLE + $self->death("Error: EXPORT_XSUB_SYMBOLS: ENABLE/DISABLE") + unless $setting =~ /^(ENABLE|DISABLE)/i; + + my $xs_impl = $1 eq 'ENABLE' ? 'XS_EXTERNAL' : 'XS_INTERNAL'; + + print Q(<<"EOF"); +##undef XS_EUPXS +##if defined(PERL_EUPXS_ALWAYS_EXPORT) +## define XS_EUPXS(name) XS_EXTERNAL(name) +##elif defined(PERL_EUPXS_NEVER_EXPORT) +## define XS_EUPXS(name) XS_INTERNAL(name) +##else +## define XS_EUPXS(name) $xs_impl(name) +##endif +EOF +} + + +sub PushXSStack { + my $self = shift; + my %args = @_; + # Save the current file context. + push(@{ $self->{XSStack} }, { + type => 'file', + LastLine => $self->{lastline}, + LastLineNo => $self->{lastline_no}, + Line => $self->{line}, + LineNo => $self->{line_no}, + Filename => $self->{filename}, + Filepathname => $self->{filepathname}, + Handle => $self->{FH}, + IsPipe => scalar($self->{filename} =~ /\|\s*$/), + %args, + }); + +} + +sub INCLUDE_handler { + my $self = shift; + $_ = shift; + # the rest of the current line should contain a valid filename + + trim_whitespace($_); + + $self->death("INCLUDE: filename missing") + unless $_; + + $self->death("INCLUDE: output pipe is illegal") + if /^\s*\|/; + + # simple minded recursion detector + $self->death("INCLUDE loop detected") + if $self->{IncludedFiles}->{$_}; + + ++$self->{IncludedFiles}->{$_} unless /\|\s*$/; + + if (/\|\s*$/ && /^\s*perl\s/) { + Warn( $self, "The INCLUDE directive with a command is discouraged." . + " Use INCLUDE_COMMAND instead! In particular using 'perl'" . + " in an 'INCLUDE: ... |' directive is not guaranteed to pick" . + " up the correct perl. The INCLUDE_COMMAND directive allows" . + " the use of \$^X as the currently running perl, see" . + " 'perldoc perlxs' for details."); + } + + $self->PushXSStack(); + + $self->{FH} = Symbol::gensym(); + + # open the new file + open($self->{FH}, $_) or $self->death("Cannot open '$_': $!"); + + print Q(<<"EOF"); +# +#/* INCLUDE: Including '$_' from '$self->{filename}' */ +# +EOF + + $self->{filename} = $_; + $self->{filepathname} = ( $^O =~ /^mswin/i ) + ? qq($self->{dir}/$self->{filename}) # See CPAN RT #61908: gcc doesn't like backslashes on win32? + : File::Spec->catfile($self->{dir}, $self->{filename}); + + # Prime the pump by reading the first + # non-blank line + + # skip leading blank lines + while (readline($self->{FH})) { + last unless /^\s*$/; + } + + $self->{lastline} = $_; + $self->{lastline_no} = $.; +} + +sub QuoteArgs { + my $cmd = shift; + my @args = split /\s+/, $cmd; + $cmd = shift @args; + for (@args) { + $_ = q(").$_.q(") if !/^\"/ && length($_) > 0; + } + return join (' ', ($cmd, @args)); +} + +# code copied from CPAN::HandleConfig::safe_quote +# - that has doc saying leave if start/finish with same quote, but no code +# given text, will conditionally quote it to protect from shell +{ + my ($quote, $use_quote) = $^O eq 'MSWin32' + ? (q{"}, q{"}) + : (q{"'}, q{'}); + sub _safe_quote { + my ($self, $command) = @_; + # Set up quote/default quote + if (defined($command) + and $command =~ /\s/ + and $command !~ /[$quote]/) { + return qq{$use_quote$command$use_quote} + } + return $command; + } +} + +sub INCLUDE_COMMAND_handler { + my $self = shift; + $_ = shift; + # the rest of the current line should contain a valid command + + trim_whitespace($_); + + $_ = QuoteArgs($_) if $^O eq 'VMS'; + + $self->death("INCLUDE_COMMAND: command missing") + unless $_; + + $self->death("INCLUDE_COMMAND: pipes are illegal") + if /^\s*\|/ or /\|\s*$/; + + $self->PushXSStack( IsPipe => 1 ); + + $self->{FH} = Symbol::gensym(); + + # If $^X is used in INCLUDE_COMMAND, we know it's supposed to be + # the same perl interpreter as we're currently running + my $X = $self->_safe_quote($^X); # quotes if has spaces + s/^\s*\$\^X/$X/; + + # open the new file + open ($self->{FH}, "-|", $_) + or $self->death( $self, "Cannot run command '$_' to include its output: $!"); + + print Q(<<"EOF"); +# +#/* INCLUDE_COMMAND: Including output of '$_' from '$self->{filename}' */ +# +EOF + + $self->{filename} = $_; + $self->{filepathname} = $self->{filename}; + #$self->{filepathname} =~ s/\"/\\"/g; # Fails? See CPAN RT #53938: MinGW Broken after 2.21 + $self->{filepathname} =~ s/\\/\\\\/g; # Works according to reporter of #53938 + + # Prime the pump by reading the first + # non-blank line + + # skip leading blank lines + while (readline($self->{FH})) { + last unless /^\s*$/; + } + + $self->{lastline} = $_; + $self->{lastline_no} = $.; +} + +sub PopFile { + my $self = shift; + + return 0 unless $self->{XSStack}->[-1]{type} eq 'file'; + + my $data = pop @{ $self->{XSStack} }; + my $ThisFile = $self->{filename}; + my $isPipe = $data->{IsPipe}; + + --$self->{IncludedFiles}->{$self->{filename}} + unless $isPipe; + + close $self->{FH}; + + $self->{FH} = $data->{Handle}; + # $filename is the leafname, which for some reason is used for diagnostic + # messages, whereas $filepathname is the full pathname, and is used for + # #line directives. + $self->{filename} = $data->{Filename}; + $self->{filepathname} = $data->{Filepathname}; + $self->{lastline} = $data->{LastLine}; + $self->{lastline_no} = $data->{LastLineNo}; + @{ $self->{line} } = @{ $data->{Line} }; + @{ $self->{line_no} } = @{ $data->{LineNo} }; + + if ($isPipe and $? ) { + --$self->{lastline_no}; + print STDERR "Error reading from pipe '$ThisFile': $! in $self->{filename}, line $self->{lastline_no}\n" ; + exit 1; + } + + print Q(<<"EOF"); +# +#/* INCLUDE: Returning to '$self->{filename}' from '$ThisFile' */ +# +EOF + + return 1; +} + +sub Q { + my($text) = @_; + $text =~ s/^#//gm; + $text =~ s/\[\[/{/g; + $text =~ s/\]\]/}/g; + $text; +} + +# Process "MODULE = Foo ..." lines and update global state accordingly +sub _process_module_xs_line { + my ($self, $module, $pkg, $prefix) = @_; + + ($self->{Module_cname} = $module) =~ s/\W/_/g; + + $self->{Package} = defined($pkg) ? $pkg : ''; + $self->{Prefix} = quotemeta( defined($prefix) ? $prefix : '' ); + + ($self->{Packid} = $self->{Package}) =~ tr/:/_/; + + $self->{Packprefix} = $self->{Package}; + $self->{Packprefix} .= "::" if $self->{Packprefix} ne ""; + + $self->{lastline} = ""; +} + +# Skip any embedded POD sections +sub _maybe_skip_pod { + my ($self) = @_; + + while ($self->{lastline} =~ /^=/) { + while ($self->{lastline} = readline($self->{FH})) { + last if ($self->{lastline} =~ /^=cut\s*$/); + } + $self->death("Error: Unterminated pod") unless defined $self->{lastline}; + $self->{lastline} = readline($self->{FH}); + chomp $self->{lastline}; + $self->{lastline} =~ s/^\s+$//; + } +} + +# This chunk of code strips out (and parses) embedded TYPEMAP blocks +# which support a HEREdoc-alike block syntax. +sub _maybe_parse_typemap_block { + my ($self) = @_; + + # This is special cased from the usual paragraph-handler logic + # due to the HEREdoc-ish syntax. + if ($self->{lastline} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+?))\s*;?\s*$/) + { + my $end_marker = quotemeta(defined($1) ? $2 : $3); + + # Scan until we find $end_marker alone on a line. + my @tmaplines; + while (1) { + $self->{lastline} = readline($self->{FH}); + $self->death("Error: Unterminated TYPEMAP section") if not defined $self->{lastline}; + last if $self->{lastline} =~ /^$end_marker\s*$/; + push @tmaplines, $self->{lastline}; + } + + my $tmap = ExtUtils::Typemaps->new( + string => join("", @tmaplines), + lineno_offset => 1 + ($self->current_line_number() || 0), + fake_filename => $self->{filename}, + ); + $self->{typemap}->merge(typemap => $tmap, replace => 1); + + $self->{lastline} = ""; + } +} + +# Read next xsub into @{ $self->{line} } from ($lastline, readline($self->{FH})). +sub fetch_para { + my $self = shift; + + # parse paragraph + $self->death("Error: Unterminated '#if/#ifdef/#ifndef'") + if !defined $self->{lastline} && $self->{XSStack}->[-1]{type} eq 'if'; + @{ $self->{line} } = (); + @{ $self->{line_no} } = (); + return $self->PopFile() if not defined $self->{lastline}; # EOF + + if ($self->{lastline} =~ + /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/) + { + $self->_process_module_xs_line($1, $2, $3); + } + + for (;;) { + $self->_maybe_skip_pod; + + $self->_maybe_parse_typemap_block; + + if ($self->{lastline} !~ /^\s*#/ # not a CPP directive + # CPP directives: + # ANSI: if ifdef ifndef elif else endif define undef + # line error pragma + # gcc: warning include_next + # obj-c: import + # others: ident (gcc notes that some cpps have this one) + || $self->{lastline} =~ /^\#[ \t]* + (?: + (?:if|ifn?def|elif|else|endif| + define|undef|pragma|error| + warning|line\s+\d+|ident) + \b + | (?:include(?:_next)?|import) + \s* ["<] .* [>"] + ) + /x + ) + { + last if $self->{lastline} =~ /^\S/ && @{ $self->{line} } && $self->{line}->[-1] eq ""; + push(@{ $self->{line} }, $self->{lastline}); + push(@{ $self->{line_no} }, $self->{lastline_no}); + } + + # Read next line and continuation lines + last unless defined($self->{lastline} = readline($self->{FH})); + $self->{lastline_no} = $.; + my $tmp_line; + $self->{lastline} .= $tmp_line + while ($self->{lastline} =~ /\\$/ && defined($tmp_line = readline($self->{FH}))); + + chomp $self->{lastline}; + $self->{lastline} =~ s/^\s+$//; + } + + # Nuke trailing "line" entries until there's one that's not empty + pop(@{ $self->{line} }), pop(@{ $self->{line_no} }) + while @{ $self->{line} } && $self->{line}->[-1] eq ""; + + return 1; +} + +sub output_init { + my $self = shift; + my $argsref = shift; + + my ($type, $num, $var, $init, $printed_name) + = @{$argsref}{qw(type num var init printed_name)}; + + # local assign for efficiently passing in to eval_input_typemap_code + local $argsref->{arg} = $num + ? "ST(" . ($num-1) . ")" + : "/* not a parameter */"; + + if ( $init =~ /^=/ ) { + if ($printed_name) { + $self->eval_input_typemap_code(qq/print " $init\\n"/, $argsref); + } + else { + $self->eval_input_typemap_code(qq/print "\\t$var $init\\n"/, $argsref); + } + } + else { + if ( $init =~ s/^\+// && $num ) { + $self->generate_init( { + type => $type, + num => $num, + var => $var, + printed_name => $printed_name, + } ); + } + elsif ($printed_name) { + print ";\n"; + $init =~ s/^;//; + } + else { + $self->eval_input_typemap_code(qq/print "\\t$var;\\n"/, $argsref); + $init =~ s/^;//; + } + $self->{deferred} + .= $self->eval_input_typemap_code(qq/"\\n\\t$init\\n"/, $argsref); + } +} + +sub generate_init { + my $self = shift; + my $argsref = shift; + + my ($type, $num, $var, $printed_name) + = @{$argsref}{qw(type num var printed_name)}; + + my $argoff = $num - 1; + my $arg = "ST($argoff)"; + + my $typemaps = $self->{typemap}; + + $type = ExtUtils::Typemaps::tidy_type($type); + if (not $typemaps->get_typemap(ctype => $type)) { + $self->report_typemap_failure($typemaps, $type); + return; + } + + (my $ntype = $type) =~ s/\s*\*/Ptr/g; + (my $subtype = $ntype) =~ s/(?:Array)?(?:Ptr)?$//; + + my $typem = $typemaps->get_typemap(ctype => $type); + my $xstype = $typem->xstype; + #this is an optimization from perl 5.0 alpha 6, class check is skipped + #T_REF_IV_REF is missing since it has no untyped analog at the moment + $xstype =~ s/OBJ$/REF/ || $xstype =~ s/^T_REF_IV_PTR$/T_PTRREF/ + if $self->{func_name} =~ /DESTROY$/; + if ($xstype eq 'T_PV' and exists $self->{lengthof}->{$var}) { + print "\t$var" unless $printed_name; + print " = ($type)SvPV($arg, STRLEN_length_of_$var);\n"; + die "default value not supported with length(NAME) supplied" + if defined $self->{defaults}->{$var}; + return; + } + $type =~ tr/:/_/ unless $self->{RetainCplusplusHierarchicalTypes}; + + my $inputmap = $typemaps->get_inputmap(xstype => $xstype); + if (not defined $inputmap) { + $self->blurt("Error: No INPUT definition for type '$type', typekind '" . $type->xstype . "' found"); + return; + } + + my $expr = $inputmap->cleaned_code; + # Note: This gruesome bit either needs heavy rethinking or documentation. I vote for the former. --Steffen + if ($expr =~ /DO_ARRAY_ELEM/) { + my $subtypemap = $typemaps->get_typemap(ctype => $subtype); + if (not $subtypemap) { + $self->report_typemap_failure($typemaps, $subtype); + return; + } + + my $subinputmap = $typemaps->get_inputmap(xstype => $subtypemap->xstype); + if (not $subinputmap) { + $self->blurt("Error: No INPUT definition for type '$subtype', typekind '" . $subtypemap->xstype . "' found"); + return; + } + + my $subexpr = $subinputmap->cleaned_code; + $subexpr =~ s/\$type/\$subtype/g; + $subexpr =~ s/ntype/subtype/g; + $subexpr =~ s/\$arg/ST(ix_$var)/g; + $subexpr =~ s/\n\t/\n\t\t/g; + $subexpr =~ s/is not of (.*\")/[arg %d] is not of $1, ix_$var + 1/g; + $subexpr =~ s/\$var/${var}\[ix_$var - $argoff]/; + $expr =~ s/DO_ARRAY_ELEM/$subexpr/; + } + if ($expr =~ m#/\*.*scope.*\*/#i) { # "scope" in C comments + $self->{ScopeThisXSUB} = 1; + } + + my $eval_vars = { + var => $var, + printed_name => $printed_name, + type => $type, + ntype => $ntype, + subtype => $subtype, + num => $num, + arg => $arg, + argoff => $argoff, + }; + + if (defined($self->{defaults}->{$var})) { + $expr =~ s/(\t+)/$1 /g; + $expr =~ s/ /\t/g; + if ($printed_name) { + print ";\n"; + } + else { + $self->eval_input_typemap_code(qq/print "\\t$var;\\n"/, $eval_vars); + } + if ($self->{defaults}->{$var} eq 'NO_INIT') { + $self->{deferred} .= $self->eval_input_typemap_code( + qq/"\\n\\tif (items >= $num) {\\n$expr;\\n\\t}\\n"/, + $eval_vars + ); + } + else { + $self->{deferred} .= $self->eval_input_typemap_code( + qq/"\\n\\tif (items < $num)\\n\\t $var = $self->{defaults}->{$var};\\n\\telse {\\n$expr;\\n\\t}\\n"/, + $eval_vars + ); + } + } + elsif ($self->{ScopeThisXSUB} or $expr !~ /^\s*\$var =/) { + if ($printed_name) { + print ";\n"; + } + else { + $self->eval_input_typemap_code(qq/print "\\t$var;\\n"/, $eval_vars); + } + $self->{deferred} + .= $self->eval_input_typemap_code(qq/"\\n$expr;\\n"/, $eval_vars); + } + else { + die "panic: do not know how to handle this branch for function pointers" + if $printed_name; + $self->eval_input_typemap_code(qq/print "$expr;\\n"/, $eval_vars); + } +} + +sub generate_output { + my $self = shift; + my $argsref = shift; + my ($type, $num, $var, $do_setmagic, $do_push) + = @{$argsref}{qw(type num var do_setmagic do_push)}; + + my $arg = "ST(" . ($num - ($num != 0)) . ")"; + + my $typemaps = $self->{typemap}; + + $type = ExtUtils::Typemaps::tidy_type($type); + local $argsref->{type} = $type; + + if ($type =~ /^array\(([^,]*),(.*)\)/) { + print "\t$arg = sv_newmortal();\n"; + print "\tsv_setpvn($arg, (char *)$var, $2 * sizeof($1));\n"; + print "\tSvSETMAGIC($arg);\n" if $do_setmagic; + } + else { + my $typemap = $typemaps->get_typemap(ctype => $type); + if (not $typemap) { + $self->report_typemap_failure($typemaps, $type); + return; + } + + my $outputmap = $typemaps->get_outputmap(xstype => $typemap->xstype); + if (not $outputmap) { + $self->blurt("Error: No OUTPUT definition for type '$type', typekind '" . $typemap->xstype . "' found"); + return; + } + + (my $ntype = $type) =~ s/\s*\*/Ptr/g; + $ntype =~ s/\(\)//g; + (my $subtype = $ntype) =~ s/(?:Array)?(?:Ptr)?$//; + + my $eval_vars = {%$argsref, subtype => $subtype, ntype => $ntype, arg => $arg}; + my $expr = $outputmap->cleaned_code; + if ($expr =~ /DO_ARRAY_ELEM/) { + my $subtypemap = $typemaps->get_typemap(ctype => $subtype); + if (not $subtypemap) { + $self->report_typemap_failure($typemaps, $subtype); + return; + } + + my $suboutputmap = $typemaps->get_outputmap(xstype => $subtypemap->xstype); + if (not $suboutputmap) { + $self->blurt("Error: No OUTPUT definition for type '$subtype', typekind '" . $subtypemap->xstype . "' found"); + return; + } + + my $subexpr = $suboutputmap->cleaned_code; + $subexpr =~ s/ntype/subtype/g; + $subexpr =~ s/\$arg/ST(ix_$var)/g; + $subexpr =~ s/\$var/${var}\[ix_$var]/g; + $subexpr =~ s/\n\t/\n\t\t/g; + $expr =~ s/DO_ARRAY_ELEM\n/$subexpr/; + $self->eval_output_typemap_code("print qq\a$expr\a", $eval_vars); + print "\t\tSvSETMAGIC(ST(ix_$var));\n" if $do_setmagic; + } + elsif ($var eq 'RETVAL') { + my $orig_arg = $arg; + my $indent; + my $use_RETVALSV = 1; + my $do_mortal = 0; + my $do_copy_tmp = 1; + my $pre_expr; + local $eval_vars->{arg} = $arg = 'RETVALSV'; + my $evalexpr = $self->eval_output_typemap_code("qq\a$expr\a", $eval_vars); + + if ($expr =~ /^\t\Q$arg\E = new/) { + # We expect that $arg has refcnt 1, so we need to + # mortalize it. + $do_mortal = 1; + } + # If RETVAL is immortal, don't mortalize it. This code is not perfect: + # It won't detect a func or expression that only returns immortals, for + # example, this RE must be tried before next elsif. + elsif ($evalexpr =~ /^\t\Q$arg\E\s*=\s*(boolSV\(|(&PL_sv_yes|&PL_sv_no|&PL_sv_undef)\s*;)/) { + $do_copy_tmp = 0; #$arg will be a ST(X), no SV* RETVAL, no RETVALSV + $use_RETVALSV = 0; + } + elsif ($evalexpr =~ /^\s*\Q$arg\E\s*=/) { + # We expect that $arg has refcnt >=1, so we need + # to mortalize it! + $use_RETVALSV = 0 if $ntype eq "SVPtr";#reuse SV* RETVAL vs open new block + $do_mortal = 1; + } + else { + # Just hope that the entry would safely write it + # over an already mortalized value. By + # coincidence, something like $arg = &PL_sv_undef + # works too, but should be caught above. + $pre_expr = "RETVALSV = sv_newmortal();\n"; + # new mortals don't have set magic + $do_setmagic = 0; + } + if($use_RETVALSV) { + print "\t{\n\t SV * RETVALSV;\n"; + $indent = "\t "; + } else { + $indent = "\t"; + } + print $indent.$pre_expr if $pre_expr; + + if($use_RETVALSV) { + #take control of 1 layer of indent, may or may not indent more + $evalexpr =~ s/^(\t| )/$indent/gm; + #"\t \t" doesn't draw right in some IDEs + #break down all \t into spaces + $evalexpr =~ s/\t/ /g; + #rebuild back into \t'es, \t==8 spaces, indent==4 spaces + $evalexpr =~ s/ /\t/g; + } + else { + if($do_mortal || $do_setmagic) { + #typemap entry evaled with RETVALSV, if we aren't using RETVALSV replace + $evalexpr =~ s/RETVALSV/RETVAL/g; #all uses with RETVAL for prettier code + } + else { #if no extra boilerplate (no mortal, no set magic) is needed + #after $evalexport, get rid of RETVALSV's visual cluter and change + $evalexpr =~ s/RETVALSV/$orig_arg/g;#the lvalue to ST(X) + } + } + #stop " RETVAL = RETVAL;" for SVPtr type + print $evalexpr if $evalexpr !~ /^\s*RETVAL = RETVAL;$/; + print $indent.'RETVAL'.($use_RETVALSV ? 'SV':'') + .' = sv_2mortal(RETVAL'.($use_RETVALSV ? 'SV':'').");\n" if $do_mortal; + print $indent.'SvSETMAGIC(RETVAL'.($use_RETVALSV ? 'SV':'').");\n" if $do_setmagic; + #dont do "RETVALSV = boolSV(RETVAL); ST(0) = RETVALSV;", it is visual clutter + print $indent."$orig_arg = RETVAL".($use_RETVALSV ? 'SV':'').";\n" + if $do_mortal || $do_setmagic || $do_copy_tmp; + print "\t}\n" if $use_RETVALSV; + } + elsif ($do_push) { + print "\tPUSHs(sv_newmortal());\n"; + local $eval_vars->{arg} = "ST($num)"; + $self->eval_output_typemap_code("print qq\a$expr\a", $eval_vars); + print "\tSvSETMAGIC($arg);\n" if $do_setmagic; + } + elsif ($arg =~ /^ST\(\d+\)$/) { + $self->eval_output_typemap_code("print qq\a$expr\a", $eval_vars); + print "\tSvSETMAGIC($arg);\n" if $do_setmagic; + } + } +} + + +# Just delegates to a clean package. +# Shim to evaluate Perl code in the right variable context +# for typemap code (having things such as $ALIAS set up). +sub eval_output_typemap_code { + my ($self, $code, $other) = @_; + return ExtUtils::ParseXS::Eval::eval_output_typemap_code($self, $code, $other); +} + +sub eval_input_typemap_code { + my ($self, $code, $other) = @_; + return ExtUtils::ParseXS::Eval::eval_input_typemap_code($self, $code, $other); +} + +1; + +# vim: ts=2 sw=2 et: diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pod b/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pod new file mode 100644 index 0000000000000000000000000000000000000000..80bf13fd071afde9e39228fe4389ea7e2611f0be --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/ParseXS.pod @@ -0,0 +1,177 @@ +=head1 NAME + +ExtUtils::ParseXS - converts Perl XS code into C code + +=head1 SYNOPSIS + + use ExtUtils::ParseXS; + + my $pxs = ExtUtils::ParseXS->new; + $pxs->process_file( filename => 'foo.xs' ); + + $pxs->process_file( filename => 'foo.xs', + output => 'bar.c', + 'C++' => 1, + typemap => 'path/to/typemap', + hiertype => 1, + except => 1, + versioncheck => 1, + linenumbers => 1, + optimize => 1, + prototypes => 1, + ); + + # Legacy non-OO interface using a singleton: + use ExtUtils::ParseXS qw(process_file); + process_file( filename => 'foo.xs' ); + +=head1 DESCRIPTION + +C<ExtUtils::ParseXS> will compile XS code into C code by embedding the constructs +necessary to let C functions manipulate Perl values and creates the glue +necessary to let Perl access those functions. The compiler uses typemaps to +determine how to map C function parameters and variables to Perl values. + +The compiler will search for typemap files called I<typemap>. It will use +the following search path to find default typemaps, with the rightmost +typemap taking precedence. + + ../../../typemap:../../typemap:../typemap:typemap + +=head1 EXPORT + +None by default. C<process_file()> and/or C<report_error_count()> +may be exported upon request. Using the functional interface is +discouraged. + +=head1 METHODS + +=over 4 + +=item $pxs->new() + +Returns a new, empty XS parser/compiler object. + +=item $pxs->process_file() + +This method processes an XS file and sends output to a C file. +The method may be called as a function (this is the legacy +interface) and will then use a singleton as invocant. + +Named parameters control how the processing is done. +The following parameters are accepted: + +=over 4 + +=item B<C++> + +Adds C<extern "C"> to the C code. Default is false. + +=item B<hiertype> + +Retains C<::> in type names so that C++ hierarchical types can be +mapped. Default is false. + +=item B<except> + +Adds exception handling stubs to the C code. Default is false. + +=item B<typemap> + +Indicates that a user-supplied typemap should take precedence over the +default typemaps. A single typemap may be specified as a string, or +multiple typemaps can be specified in an array reference, with the +last typemap having the highest precedence. + +=item B<prototypes> + +Generates prototype code for all xsubs. Default is false. + +=item B<versioncheck> + +Makes sure at run time that the object file (derived from the C<.xs> +file) and the C<.pm> files have the same version number. Default is +true. + +=item B<linenumbers> + +Adds C<#line> directives to the C output so error messages will look +like they came from the original XS file. Default is true. + +=item B<optimize> + +Enables certain optimizations. The only optimization that is currently +affected is the use of I<target>s by the output C code (see L<perlguts>). +Not optimizing may significantly slow down the generated code, but this is the way +B<xsubpp> of 5.005 and earlier operated. Default is to optimize. + +=item B<inout> + +Enable recognition of C<IN>, C<OUT_LIST> and C<INOUT_LIST> +declarations. Default is true. + +=item B<argtypes> + +Enable recognition of ANSI-like descriptions of function signature. +Default is true. + +=item B<s> + +I<Maintainer note:> I have no clue what this does. Strips function prefixes? + +=back + +=item $pxs->report_error_count() + +This method returns the number of [a certain kind of] errors +encountered during processing of the XS file. + +The method may be called as a function (this is the legacy +interface) and will then use a singleton as invocant. + +=back + +=head1 AUTHOR + +Based on xsubpp code, written by Larry Wall. + +Maintained by: + +=over 4 + +=item * + +Ken Williams, <ken@mathforum.org> + +=item * + +David Golden, <dagolden@cpan.org> + +=item * + +James Keenan, <jkeenan@cpan.org> + +=item * + +Steffen Mueller, <smueller@cpan.org> + +=back + +=head1 COPYRIGHT + +Copyright 2002-2014 by Ken Williams, David Golden and other contributors. All +rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +Based on the C<ExtUtils::xsubpp> code by Larry Wall and the Perl 5 +Porters, which was released under the same license terms. + +=head1 SEE ALSO + +L<perl>, ExtUtils::xsubpp, ExtUtils::MakeMaker, L<perlxs>, L<perlxstut>. + +=cut + + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/Typemaps.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Typemaps.pm new file mode 100644 index 0000000000000000000000000000000000000000..a762322df9f36094fbf9b912c19508127ae2278f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/Typemaps.pm @@ -0,0 +1,1093 @@ +package ExtUtils::Typemaps; +use 5.006001; +use strict; +use warnings; +our $VERSION = '3.38'; + +require ExtUtils::ParseXS; +require ExtUtils::ParseXS::Constants; +require ExtUtils::Typemaps::InputMap; +require ExtUtils::Typemaps::OutputMap; +require ExtUtils::Typemaps::Type; + +=head1 NAME + +ExtUtils::Typemaps - Read/Write/Modify Perl/XS typemap files + +=head1 SYNOPSIS + + # read/create file + my $typemap = ExtUtils::Typemaps->new(file => 'typemap'); + # alternatively create an in-memory typemap + # $typemap = ExtUtils::Typemaps->new(); + # alternatively create an in-memory typemap by parsing a string + # $typemap = ExtUtils::Typemaps->new(string => $sometypemap); + + # add a mapping + $typemap->add_typemap(ctype => 'NV', xstype => 'T_NV'); + $typemap->add_inputmap( + xstype => 'T_NV', code => '$var = ($type)SvNV($arg);' + ); + $typemap->add_outputmap( + xstype => 'T_NV', code => 'sv_setnv($arg, (NV)$var);' + ); + $typemap->add_string(string => $typemapstring); + # will be parsed and merged + + # remove a mapping (same for remove_typemap and remove_outputmap...) + $typemap->remove_inputmap(xstype => 'SomeType'); + + # save a typemap to a file + $typemap->write(file => 'anotherfile.map'); + + # merge the other typemap into this one + $typemap->merge(typemap => $another_typemap); + +=head1 DESCRIPTION + +This module can read, modify, create and write Perl XS typemap files. If you don't know +what a typemap is, please confer the L<perlxstut> and L<perlxs> manuals. + +The module is not entirely round-trip safe: For example it currently simply strips all comments. +The order of entries in the maps is, however, preserved. + +We check for duplicate entries in the typemap, but do not check for missing +C<TYPEMAP> entries for C<INPUTMAP> or C<OUTPUTMAP> entries since these might be hidden +in a different typemap. + +=head1 METHODS + +=cut + +=head2 new + +Returns a new typemap object. Takes an optional C<file> parameter. +If set, the given file will be read. If the file doesn't exist, an empty typemap +is returned. + +Alternatively, if the C<string> parameter is given, the supplied +string will be parsed instead of a file. + +=cut + +sub new { + my $class = shift; + my %args = @_; + + if (defined $args{file} and defined $args{string}) { + die("Cannot handle both 'file' and 'string' arguments to constructor"); + } + + my $self = bless { + file => undef, + %args, + typemap_section => [], + typemap_lookup => {}, + input_section => [], + input_lookup => {}, + output_section => [], + output_lookup => {}, + } => $class; + + $self->_init(); + + return $self; +} + +sub _init { + my $self = shift; + if (defined $self->{string}) { + $self->_parse(\($self->{string}), $self->{lineno_offset}, $self->{fake_filename}); + delete $self->{string}; + } + elsif (defined $self->{file} and -e $self->{file}) { + open my $fh, '<', $self->{file} + or die "Cannot open typemap file '" + . $self->{file} . "' for reading: $!"; + local $/ = undef; + my $string = <$fh>; + $self->_parse(\$string, $self->{lineno_offset}, $self->{file}); + } +} + + +=head2 file + +Get/set the file that the typemap is written to when the +C<write> method is called. + +=cut + +sub file { + $_[0]->{file} = $_[1] if @_ > 1; + $_[0]->{file} +} + +=head2 add_typemap + +Add a C<TYPEMAP> entry to the typemap. + +Required named arguments: The C<ctype> (e.g. C<ctype =E<gt> 'double'>) +and the C<xstype> (e.g. C<xstype =E<gt> 'T_NV'>). + +Optional named arguments: C<replace =E<gt> 1> forces removal/replacement of +existing C<TYPEMAP> entries of the same C<ctype>. C<skip =E<gt> 1> +triggers a I<"first come first serve"> logic by which new entries that conflict +with existing entries are silently ignored. + +As an alternative to the named parameters usage, you may pass in +an C<ExtUtils::Typemaps::Type> object as first argument, a copy of which will be +added to the typemap. In that case, only the C<replace> or C<skip> named parameters +may be used after the object. Example: + + $map->add_typemap($type_obj, replace => 1); + +=cut + +sub add_typemap { + my $self = shift; + my $type; + my %args; + + if ((@_ % 2) == 1) { + my $orig = shift; + $type = $orig->new(); + %args = @_; + } + else { + %args = @_; + my $ctype = $args{ctype}; + die("Need ctype argument") if not defined $ctype; + my $xstype = $args{xstype}; + die("Need xstype argument") if not defined $xstype; + + $type = ExtUtils::Typemaps::Type->new( + xstype => $xstype, + 'prototype' => $args{'prototype'}, + ctype => $ctype, + ); + } + + if ($args{skip} and $args{replace}) { + die("Cannot use both 'skip' and 'replace'"); + } + + if ($args{replace}) { + $self->remove_typemap(ctype => $type->ctype); + } + elsif ($args{skip}) { + return() if exists $self->{typemap_lookup}{$type->ctype}; + } + else { + $self->validate(typemap_xstype => $type->xstype, ctype => $type->ctype); + } + + # store + push @{$self->{typemap_section}}, $type; + # remember type for lookup, too. + $self->{typemap_lookup}{$type->tidy_ctype} = $#{$self->{typemap_section}}; + + return 1; +} + +=head2 add_inputmap + +Add an C<INPUT> entry to the typemap. + +Required named arguments: +The C<xstype> (e.g. C<xstype =E<gt> 'T_NV'>) +and the C<code> to associate with it for input. + +Optional named arguments: C<replace =E<gt> 1> forces removal/replacement of +existing C<INPUT> entries of the same C<xstype>. C<skip =E<gt> 1> +triggers a I<"first come first serve"> logic by which new entries that conflict +with existing entries are silently ignored. + +As an alternative to the named parameters usage, you may pass in +an C<ExtUtils::Typemaps::InputMap> object as first argument, a copy of which will be +added to the typemap. In that case, only the C<replace> or C<skip> named parameters +may be used after the object. Example: + + $map->add_inputmap($type_obj, replace => 1); + +=cut + +sub add_inputmap { + my $self = shift; + my $input; + my %args; + + if ((@_ % 2) == 1) { + my $orig = shift; + $input = $orig->new(); + %args = @_; + } + else { + %args = @_; + my $xstype = $args{xstype}; + die("Need xstype argument") if not defined $xstype; + my $code = $args{code}; + die("Need code argument") if not defined $code; + + $input = ExtUtils::Typemaps::InputMap->new( + xstype => $xstype, + code => $code, + ); + } + + if ($args{skip} and $args{replace}) { + die("Cannot use both 'skip' and 'replace'"); + } + + if ($args{replace}) { + $self->remove_inputmap(xstype => $input->xstype); + } + elsif ($args{skip}) { + return() if exists $self->{input_lookup}{$input->xstype}; + } + else { + $self->validate(inputmap_xstype => $input->xstype); + } + + # store + push @{$self->{input_section}}, $input; + # remember type for lookup, too. + $self->{input_lookup}{$input->xstype} = $#{$self->{input_section}}; + + return 1; +} + +=head2 add_outputmap + +Add an C<OUTPUT> entry to the typemap. +Works exactly the same as C<add_inputmap>. + +=cut + +sub add_outputmap { + my $self = shift; + my $output; + my %args; + + if ((@_ % 2) == 1) { + my $orig = shift; + $output = $orig->new(); + %args = @_; + } + else { + %args = @_; + my $xstype = $args{xstype}; + die("Need xstype argument") if not defined $xstype; + my $code = $args{code}; + die("Need code argument") if not defined $code; + + $output = ExtUtils::Typemaps::OutputMap->new( + xstype => $xstype, + code => $code, + ); + } + + if ($args{skip} and $args{replace}) { + die("Cannot use both 'skip' and 'replace'"); + } + + if ($args{replace}) { + $self->remove_outputmap(xstype => $output->xstype); + } + elsif ($args{skip}) { + return() if exists $self->{output_lookup}{$output->xstype}; + } + else { + $self->validate(outputmap_xstype => $output->xstype); + } + + # store + push @{$self->{output_section}}, $output; + # remember type for lookup, too. + $self->{output_lookup}{$output->xstype} = $#{$self->{output_section}}; + + return 1; +} + +=head2 add_string + +Parses a string as a typemap and merge it into the typemap object. + +Required named argument: C<string> to specify the string to parse. + +=cut + +sub add_string { + my $self = shift; + my %args = @_; + die("Need 'string' argument") if not defined $args{string}; + + # no, this is not elegant. + my $other = ExtUtils::Typemaps->new(string => $args{string}); + $self->merge(typemap => $other); +} + +=head2 remove_typemap + +Removes a C<TYPEMAP> entry from the typemap. + +Required named argument: C<ctype> to specify the entry to remove from the typemap. + +Alternatively, you may pass a single C<ExtUtils::Typemaps::Type> object. + +=cut + +sub remove_typemap { + my $self = shift; + my $ctype; + if (@_ > 1) { + my %args = @_; + $ctype = $args{ctype}; + die("Need ctype argument") if not defined $ctype; + $ctype = tidy_type($ctype); + } + else { + $ctype = $_[0]->tidy_ctype; + } + + return $self->_remove($ctype, $self->{typemap_section}, $self->{typemap_lookup}); +} + +=head2 remove_inputmap + +Removes an C<INPUT> entry from the typemap. + +Required named argument: C<xstype> to specify the entry to remove from the typemap. + +Alternatively, you may pass a single C<ExtUtils::Typemaps::InputMap> object. + +=cut + +sub remove_inputmap { + my $self = shift; + my $xstype; + if (@_ > 1) { + my %args = @_; + $xstype = $args{xstype}; + die("Need xstype argument") if not defined $xstype; + } + else { + $xstype = $_[0]->xstype; + } + + return $self->_remove($xstype, $self->{input_section}, $self->{input_lookup}); +} + +=head2 remove_inputmap + +Removes an C<OUTPUT> entry from the typemap. + +Required named argument: C<xstype> to specify the entry to remove from the typemap. + +Alternatively, you may pass a single C<ExtUtils::Typemaps::OutputMap> object. + +=cut + +sub remove_outputmap { + my $self = shift; + my $xstype; + if (@_ > 1) { + my %args = @_; + $xstype = $args{xstype}; + die("Need xstype argument") if not defined $xstype; + } + else { + $xstype = $_[0]->xstype; + } + + return $self->_remove($xstype, $self->{output_section}, $self->{output_lookup}); +} + +sub _remove { + my $self = shift; + my $rm = shift; + my $array = shift; + my $lookup = shift; + + # Just fetch the index of the item from the lookup table + my $index = $lookup->{$rm}; + return() if not defined $index; + + # Nuke the item from storage + splice(@$array, $index, 1); + + # Decrement the storage position of all items thereafter + foreach my $key (keys %$lookup) { + if ($lookup->{$key} > $index) { + $lookup->{$key}--; + } + } + return(); +} + +=head2 get_typemap + +Fetches an entry of the TYPEMAP section of the typemap. + +Mandatory named arguments: The C<ctype> of the entry. + +Returns the C<ExtUtils::Typemaps::Type> +object for the entry if found. + +=cut + +sub get_typemap { + my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + + my %args = @_; + my $ctype = $args{ctype}; + die("Need ctype argument") if not defined $ctype; + $ctype = tidy_type($ctype); + + my $index = $self->{typemap_lookup}{$ctype}; + return() if not defined $index; + return $self->{typemap_section}[$index]; +} + +=head2 get_inputmap + +Fetches an entry of the INPUT section of the +typemap. + +Mandatory named arguments: The C<xstype> of the +entry or the C<ctype> of the typemap that can be used to find +the C<xstype>. To wit, the following pieces of code +are equivalent: + + my $type = $typemap->get_typemap(ctype => $ctype) + my $input_map = $typemap->get_inputmap(xstype => $type->xstype); + + my $input_map = $typemap->get_inputmap(ctype => $ctype); + +Returns the C<ExtUtils::Typemaps::InputMap> +object for the entry if found. + +=cut + +sub get_inputmap { + my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + + my %args = @_; + my $xstype = $args{xstype}; + my $ctype = $args{ctype}; + die("Need xstype or ctype argument") + if not defined $xstype + and not defined $ctype; + die("Need xstype OR ctype arguments, not both") + if defined $xstype and defined $ctype; + + if (defined $ctype) { + my $tm = $self->get_typemap(ctype => $ctype); + $xstype = $tm && $tm->xstype; + return() if not defined $xstype; + } + + my $index = $self->{input_lookup}{$xstype}; + return() if not defined $index; + return $self->{input_section}[$index]; +} + +=head2 get_outputmap + +Fetches an entry of the OUTPUT section of the +typemap. + +Mandatory named arguments: The C<xstype> of the +entry or the C<ctype> of the typemap that can be used to +resolve the C<xstype>. (See above for an example.) + +Returns the C<ExtUtils::Typemaps::InputMap> +object for the entry if found. + +=cut + +sub get_outputmap { + my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + + my %args = @_; + my $xstype = $args{xstype}; + my $ctype = $args{ctype}; + die("Need xstype or ctype argument") + if not defined $xstype + and not defined $ctype; + die("Need xstype OR ctype arguments, not both") + if defined $xstype and defined $ctype; + + if (defined $ctype) { + my $tm = $self->get_typemap(ctype => $ctype); + $xstype = $tm && $tm->xstype; + return() if not defined $xstype; + } + + my $index = $self->{output_lookup}{$xstype}; + return() if not defined $index; + return $self->{output_section}[$index]; +} + +=head2 write + +Write the typemap to a file. Optionally takes a C<file> argument. If given, the +typemap will be written to the specified file. If not, the typemap is written +to the currently stored file name (see L</file> above, this defaults to the file +it was read from if any). + +=cut + +sub write { + my $self = shift; + my %args = @_; + my $file = defined $args{file} ? $args{file} : $self->file(); + die("write() needs a file argument (or set the file name of the typemap using the 'file' method)") + if not defined $file; + + open my $fh, '>', $file + or die "Cannot open typemap file '$file' for writing: $!"; + print $fh $self->as_string(); + close $fh; +} + +=head2 as_string + +Generates and returns the string form of the typemap. + +=cut + +sub as_string { + my $self = shift; + my $typemap = $self->{typemap_section}; + my @code; + push @code, "TYPEMAP\n"; + foreach my $entry (@$typemap) { + # type kind proto + # /^(.*?\S)\s+(\S+)\s*($ExtUtils::ParseXS::Constants::PrototypeRegexp*)$/o + push @code, $entry->ctype . "\t" . $entry->xstype + . ($entry->proto ne '' ? "\t".$entry->proto : '') . "\n"; + } + + my $input = $self->{input_section}; + if (@$input) { + push @code, "\nINPUT\n"; + foreach my $entry (@$input) { + push @code, $entry->xstype, "\n", $entry->code, "\n"; + } + } + + my $output = $self->{output_section}; + if (@$output) { + push @code, "\nOUTPUT\n"; + foreach my $entry (@$output) { + push @code, $entry->xstype, "\n", $entry->code, "\n"; + } + } + return join '', @code; +} + +=head2 as_embedded_typemap + +Generates and returns the string form of the typemap with the +appropriate prefix around it for verbatim inclusion into an +XS file as an embedded typemap. This will return a string like + + TYPEMAP: <<END_OF_TYPEMAP + ... typemap here (see as_string) ... + END_OF_TYPEMAP + +The method takes care not to use a HERE-doc end marker that +appears in the typemap string itself. + +=cut + +sub as_embedded_typemap { + my $self = shift; + my $string = $self->as_string; + + my @ident_cand = qw(END_TYPEMAP END_OF_TYPEMAP END); + my $icand = 0; + my $cand_suffix = ""; + while ($string =~ /^\Q$ident_cand[$icand]$cand_suffix\E\s*$/m) { + $icand++; + if ($icand == @ident_cand) { + $icand = 0; + ++$cand_suffix; + } + } + + my $marker = "$ident_cand[$icand]$cand_suffix"; + return "TYPEMAP: <<$marker;\n$string\n$marker\n"; +} + +=head2 merge + +Merges a given typemap into the object. Note that a failed merge +operation leaves the object in an inconsistent state so clone it if necessary. + +Mandatory named arguments: Either C<typemap =E<gt> $another_typemap_obj> +or C<file =E<gt> $path_to_typemap_file> but not both. + +Optional arguments: C<replace =E<gt> 1> to force replacement +of existing typemap entries without warning or C<skip =E<gt> 1> +to skip entries that exist already in the typemap. + +=cut + +sub merge { + my $self = shift; + my %args = @_; + + if (exists $args{typemap} and exists $args{file}) { + die("Need {file} OR {typemap} argument. Not both!"); + } + elsif (not exists $args{typemap} and not exists $args{file}) { + die("Need {file} or {typemap} argument!"); + } + + my @params; + push @params, 'replace' => $args{replace} if exists $args{replace}; + push @params, 'skip' => $args{skip} if exists $args{skip}; + + my $typemap = $args{typemap}; + if (not defined $typemap) { + $typemap = ref($self)->new(file => $args{file}, @params); + } + + # FIXME breaking encapsulation. Add accessor code. + foreach my $entry (@{$typemap->{typemap_section}}) { + $self->add_typemap( $entry, @params ); + } + + foreach my $entry (@{$typemap->{input_section}}) { + $self->add_inputmap( $entry, @params ); + } + + foreach my $entry (@{$typemap->{output_section}}) { + $self->add_outputmap( $entry, @params ); + } + + return 1; +} + +=head2 is_empty + +Returns a bool indicating whether this typemap is entirely empty. + +=cut + +sub is_empty { + my $self = shift; + + return @{ $self->{typemap_section} } == 0 + && @{ $self->{input_section} } == 0 + && @{ $self->{output_section} } == 0; +} + +=head2 list_mapped_ctypes + +Returns a list of the C types that are mappable by +this typemap object. + +=cut + +sub list_mapped_ctypes { + my $self = shift; + return sort keys %{ $self->{typemap_lookup} }; +} + +=head2 _get_typemap_hash + +Returns a hash mapping the C types to the XS types: + + { + 'char **' => 'T_PACKEDARRAY', + 'bool_t' => 'T_IV', + 'AV *' => 'T_AVREF', + 'InputStream' => 'T_IN', + 'double' => 'T_DOUBLE', + # ... + } + +This is documented because it is used by C<ExtUtils::ParseXS>, +but it's not intended for general consumption. May be removed +at any time. + +=cut + +sub _get_typemap_hash { + my $self = shift; + my $lookup = $self->{typemap_lookup}; + my $storage = $self->{typemap_section}; + + my %rv; + foreach my $ctype (keys %$lookup) { + $rv{$ctype} = $storage->[ $lookup->{$ctype} ]->xstype; + } + + return \%rv; +} + +=head2 _get_inputmap_hash + +Returns a hash mapping the XS types (identifiers) to the +corresponding INPUT code: + + { + 'T_CALLBACK' => ' $var = make_perl_cb_$type($arg) + ', + 'T_OUT' => ' $var = IoOFP(sv_2io($arg)) + ', + 'T_REF_IV_PTR' => ' if (sv_isa($arg, \\"${ntype}\\")) { + # ... + } + +This is documented because it is used by C<ExtUtils::ParseXS>, +but it's not intended for general consumption. May be removed +at any time. + +=cut + +sub _get_inputmap_hash { + my $self = shift; + my $lookup = $self->{input_lookup}; + my $storage = $self->{input_section}; + + my %rv; + foreach my $xstype (keys %$lookup) { + $rv{$xstype} = $storage->[ $lookup->{$xstype} ]->code; + + # Squash trailing whitespace to one line break + # This isn't strictly necessary, but makes the output more similar + # to the original ExtUtils::ParseXS. + $rv{$xstype} =~ s/\s*\z/\n/; + } + + return \%rv; +} + + +=head2 _get_outputmap_hash + +Returns a hash mapping the XS types (identifiers) to the +corresponding OUTPUT code: + + { + 'T_CALLBACK' => ' sv_setpvn($arg, $var.context.value().chp(), + $var.context.value().size()); + ', + 'T_OUT' => ' { + GV *gv = (GV *)sv_newmortal(); + gv_init_pvn(gv, gv_stashpvs("$Package",1), + "__ANONIO__",10,0); + if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) ) + sv_setsv( + $arg, + sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)) + ); + else + $arg = &PL_sv_undef; + } + ', + # ... + } + +This is documented because it is used by C<ExtUtils::ParseXS>, +but it's not intended for general consumption. May be removed +at any time. + +=cut + +sub _get_outputmap_hash { + my $self = shift; + my $lookup = $self->{output_lookup}; + my $storage = $self->{output_section}; + + my %rv; + foreach my $xstype (keys %$lookup) { + $rv{$xstype} = $storage->[ $lookup->{$xstype} ]->code; + + # Squash trailing whitespace to one line break + # This isn't strictly necessary, but makes the output more similar + # to the original ExtUtils::ParseXS. + $rv{$xstype} =~ s/\s*\z/\n/; + } + + return \%rv; +} + +=head2 _get_prototype_hash + +Returns a hash mapping the C types of the typemap to their +corresponding prototypes. + + { + 'char **' => '$', + 'bool_t' => '$', + 'AV *' => '$', + 'InputStream' => '$', + 'double' => '$', + # ... + } + +This is documented because it is used by C<ExtUtils::ParseXS>, +but it's not intended for general consumption. May be removed +at any time. + +=cut + +sub _get_prototype_hash { + my $self = shift; + my $lookup = $self->{typemap_lookup}; + my $storage = $self->{typemap_section}; + + my %rv; + foreach my $ctype (keys %$lookup) { + $rv{$ctype} = $storage->[ $lookup->{$ctype} ]->proto || '$'; + } + + return \%rv; +} + + + +# make sure that the provided types wouldn't collide with what's +# in the object already. +sub validate { + my $self = shift; + my %args = @_; + + if ( exists $args{ctype} + and exists $self->{typemap_lookup}{tidy_type($args{ctype})} ) + { + die("Multiple definition of ctype '$args{ctype}' in TYPEMAP section"); + } + + if ( exists $args{inputmap_xstype} + and exists $self->{input_lookup}{$args{inputmap_xstype}} ) + { + die("Multiple definition of xstype '$args{inputmap_xstype}' in INPUTMAP section"); + } + + if ( exists $args{outputmap_xstype} + and exists $self->{output_lookup}{$args{outputmap_xstype}} ) + { + die("Multiple definition of xstype '$args{outputmap_xstype}' in OUTPUTMAP section"); + } + + return 1; +} + +=head2 clone + +Creates and returns a clone of a full typemaps object. + +Takes named parameters: If C<shallow> is true, +the clone will share the actual individual type/input/outputmap objects, +but not share their storage. Use with caution. Without C<shallow>, +the clone will be fully independent. + +=cut + +sub clone { + my $proto = shift; + my %args = @_; + + my $self; + if ($args{shallow}) { + $self = bless( { + %$proto, + typemap_section => [@{$proto->{typemap_section}}], + typemap_lookup => {%{$proto->{typemap_lookup}}}, + input_section => [@{$proto->{input_section}}], + input_lookup => {%{$proto->{input_lookup}}}, + output_section => [@{$proto->{output_section}}], + output_lookup => {%{$proto->{output_lookup}}}, + } => ref($proto) ); + } + else { + $self = bless( { + %$proto, + typemap_section => [map $_->new, @{$proto->{typemap_section}}], + typemap_lookup => {%{$proto->{typemap_lookup}}}, + input_section => [map $_->new, @{$proto->{input_section}}], + input_lookup => {%{$proto->{input_lookup}}}, + output_section => [map $_->new, @{$proto->{output_section}}], + output_lookup => {%{$proto->{output_lookup}}}, + } => ref($proto) ); + } + + return $self; +} + +=head2 tidy_type + +Function to (heuristically) canonicalize a C type. Works to some +degree with C++ types. + + $halfway_canonical_type = tidy_type($ctype); + +Moved from C<ExtUtils::ParseXS>. + +=cut + +sub tidy_type { + local $_ = shift; + + # for templated C++ types, do some bit of flawed canonicalization + # wrt. templates at least + if (/[<>]/) { + s/\s*([<>])\s*/$1/g; + s/>>/> >/g; + } + + # rationalise any '*' by joining them into bunches and removing whitespace + s#\s*(\*+)\s*#$1#g; + s#(\*+)# $1 #g ; + + # trim leading & trailing whitespace + s/^\s+//; s/\s+$//; + + # change multiple whitespace into a single space + s/\s+/ /g; + + $_; +} + + + +sub _parse { + my $self = shift; + my $stringref = shift; + my $lineno_offset = shift; + $lineno_offset = 0 if not defined $lineno_offset; + my $filename = shift; + $filename = '<string>' if not defined $filename; + + my $replace = $self->{replace}; + my $skip = $self->{skip}; + die "Can only replace OR skip" if $replace and $skip; + my @add_params; + push @add_params, replace => 1 if $replace; + push @add_params, skip => 1 if $skip; + + # TODO comments should round-trip, currently ignoring + # TODO order of sections, multiple sections of same type + # Heavily influenced by ExtUtils::ParseXS + my $section = 'typemap'; + my $lineno = $lineno_offset; + my $junk = ""; + my $current = \$junk; + my @input_expr; + my @output_expr; + while ($$stringref =~ /^(.*)$/gcm) { + local $_ = $1; + ++$lineno; + chomp; + next if /^\s*#/; + if (/^INPUT\s*$/) { + $section = 'input'; + $current = \$junk; + next; + } + elsif (/^OUTPUT\s*$/) { + $section = 'output'; + $current = \$junk; + next; + } + elsif (/^TYPEMAP\s*$/) { + $section = 'typemap'; + $current = \$junk; + next; + } + + if ($section eq 'typemap') { + my $line = $_; + s/^\s+//; s/\s+$//; + next if $_ eq '' or /^#/; + my($type, $kind, $proto) = /^(.*?\S)\s+(\S+)\s*($ExtUtils::ParseXS::Constants::PrototypeRegexp*)$/o + or warn("Warning: File '$filename' Line $lineno '$line' TYPEMAP entry needs 2 or 3 columns\n"), + next; + # prototype defaults to '$' + $proto = '$' unless $proto; + warn("Warning: File '$filename' Line $lineno '$line' Invalid prototype '$proto'\n") + unless _valid_proto_string($proto); + $self->add_typemap( + ExtUtils::Typemaps::Type->new( + xstype => $kind, proto => $proto, ctype => $type + ), + @add_params + ); + } elsif (/^\s/) { + s/\s+$//; + $$current .= $$current eq '' ? $_ : "\n".$_; + } elsif ($_ eq '') { + next; + } elsif ($section eq 'input') { + s/\s+$//; + push @input_expr, {xstype => $_, code => ''}; + $current = \$input_expr[-1]{code}; + } else { # output section + s/\s+$//; + push @output_expr, {xstype => $_, code => ''}; + $current = \$output_expr[-1]{code}; + } + + } # end while lines + + foreach my $inexpr (@input_expr) { + $self->add_inputmap( ExtUtils::Typemaps::InputMap->new(%$inexpr), @add_params ); + } + foreach my $outexpr (@output_expr) { + $self->add_outputmap( ExtUtils::Typemaps::OutputMap->new(%$outexpr), @add_params ); + } + + return 1; +} + +# taken from ExtUtils::ParseXS +sub _valid_proto_string { + my $string = shift; + if ($string =~ /^$ExtUtils::ParseXS::Constants::PrototypeRegexp+$/o) { + return $string; + } + + return 0 ; +} + +# taken from ExtUtils::ParseXS (C_string) +sub _escape_backslashes { + my $string = shift; + $string =~ s[\\][\\\\]g; + $string; +} + +=head1 CAVEATS + +Inherits some evil code from C<ExtUtils::ParseXS>. + +=head1 SEE ALSO + +The parser is heavily inspired from the one in L<ExtUtils::ParseXS>. + +For details on typemaps: L<perlxstut>, L<perlxs>. + +=head1 AUTHOR + +Steffen Mueller C<<smueller@cpan.org>> + +=head1 COPYRIGHT & LICENSE + +Copyright 2009, 2010, 2011, 2012, 2013 Steffen Mueller + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut + +1; + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/testlib.pm b/data/miniconda3/lib/perl5/core_perl/ExtUtils/testlib.pm new file mode 100644 index 0000000000000000000000000000000000000000..1ccaf776a032399f0ceede0bfbb9cca606135908 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/testlib.pm @@ -0,0 +1,42 @@ +package ExtUtils::testlib; + +use strict; +use warnings; + +our $VERSION = '7.44'; +$VERSION =~ tr/_//d; + +use Cwd; +use File::Spec; + +# So the tests can chdir around and not break @INC. +# We use getcwd() because otherwise rel2abs will blow up under taint +# mode pre-5.8. We detaint is so @INC won't be tainted. This is +# no worse, and probably better, than just shoving an untainted, +# relative "blib/lib" onto @INC. +my $cwd; +BEGIN { + ($cwd) = getcwd() =~ /(.*)/; +} +use lib map { File::Spec->rel2abs($_, $cwd) } qw(blib/arch blib/lib); +1; +__END__ + +=head1 NAME + +ExtUtils::testlib - add blib/* directories to @INC + +=head1 SYNOPSIS + + use ExtUtils::testlib; + +=head1 DESCRIPTION + +After an extension has been built and before it is installed it may be +desirable to test it bypassing C<make test>. By adding + + use ExtUtils::testlib; + +to a test program the intermediate directories used by C<make> are +added to @INC. + diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/typemap b/data/miniconda3/lib/perl5/core_perl/ExtUtils/typemap new file mode 100644 index 0000000000000000000000000000000000000000..db700b75bf61faa644ee69672147de1e2ae51324 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/typemap @@ -0,0 +1,451 @@ +# basic C types +int T_IV +unsigned T_UV +unsigned int T_UV +long T_IV +unsigned long T_UV +short T_IV +unsigned short T_UV +char T_CHAR +unsigned char T_U_CHAR +char * T_PV +unsigned char * T_PV +const char * T_PV +caddr_t T_PV +wchar_t * T_PV +wchar_t T_IV +# bool_t is defined in <rpc/rpc.h> +bool_t T_IV +size_t T_UV +ssize_t T_IV +time_t T_NV +unsigned long * T_OPAQUEPTR +char ** T_PACKEDARRAY +void * T_PTR +Time_t * T_PV +SV * T_SV + +# These are the backwards-compatibility AV*/HV* typemaps that +# do not decrement refcounts. Locally override with +# "AV* T_AVREF_REFCOUNT_FIXED", "HV* T_HVREF_REFCOUNT_FIXED", +# "CV* T_CVREF_REFCOUNT_FIXED", "SVREF T_SVREF_REFCOUNT_FIXED", +# to get the fixed versions. +SVREF T_SVREF +CV * T_CVREF +AV * T_AVREF +HV * T_HVREF + +IV T_IV +UV T_UV +NV T_NV +I32 T_IV +I16 T_IV +I8 T_IV +STRLEN T_UV +U32 T_U_LONG +U16 T_U_SHORT +U8 T_UV +Result T_U_CHAR +Boolean T_BOOL +float T_FLOAT +double T_DOUBLE +SysRet T_SYSRET +SysRetLong T_SYSRET +FILE * T_STDIO +PerlIO * T_INOUT +FileHandle T_PTROBJ +InputStream T_IN +InOutStream T_INOUT +OutputStream T_OUT +bool T_BOOL + +############################################################################# +INPUT +T_SV + $var = $arg +T_SVREF + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv)){ + $var = SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not a reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_SVREF_REFCOUNT_FIXED + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv)){ + $var = SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not a reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_AVREF + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){ + $var = (AV*)SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not an ARRAY reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_AVREF_REFCOUNT_FIXED + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){ + $var = (AV*)SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not an ARRAY reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_HVREF + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ + $var = (HV*)SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not a HASH reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_HVREF_REFCOUNT_FIXED + STMT_START { + SV* const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVHV){ + $var = (HV*)SvRV(xsub_tmp_sv); + } + else{ + Perl_croak_nocontext(\"%s: %s is not a HASH reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_CVREF + STMT_START { + HV *st; + GV *gvp; + SV * const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + $var = sv_2cv(xsub_tmp_sv, &st, &gvp, 0); + if (!$var) { + Perl_croak_nocontext(\"%s: %s is not a CODE reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_CVREF_REFCOUNT_FIXED + STMT_START { + HV *st; + GV *gvp; + SV * const xsub_tmp_sv = $arg; + SvGETMAGIC(xsub_tmp_sv); + $var = sv_2cv(xsub_tmp_sv, &st, &gvp, 0); + if (!$var) { + Perl_croak_nocontext(\"%s: %s is not a CODE reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\"); + } + } STMT_END +T_SYSRET + $var NOT IMPLEMENTED +T_UV + $var = ($type)SvUV($arg) +T_IV + $var = ($type)SvIV($arg) +T_INT + $var = (int)SvIV($arg) +T_ENUM + $var = ($type)SvIV($arg) +T_BOOL + $var = (bool)SvTRUE($arg) +T_U_INT + $var = (unsigned int)SvUV($arg) +T_SHORT + $var = (short)SvIV($arg) +T_U_SHORT + $var = (unsigned short)SvUV($arg) +T_LONG + $var = (long)SvIV($arg) +T_U_LONG + $var = (unsigned long)SvUV($arg) +T_CHAR + $var = (char)*SvPV_nolen($arg) +T_U_CHAR + $var = (unsigned char)SvUV($arg) +T_FLOAT + $var = (float)SvNV($arg) +T_NV + $var = ($type)SvNV($arg) +T_DOUBLE + $var = (double)SvNV($arg) +T_PV + $var = ($type)SvPV_nolen($arg) +T_PTR + $var = INT2PTR($type,SvIV($arg)) +T_PTRREF + if (SvROK($arg)) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = INT2PTR($type,tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not a reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\") +T_REF_IV_REF + if (sv_isa($arg, \"${ntype}\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = *INT2PTR($type *, tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\") +T_REF_IV_PTR + if (sv_isa($arg, \"${ntype}\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = INT2PTR($type, tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\") +T_PTROBJ + if (SvROK($arg) && sv_derived_from($arg, \"${ntype}\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = INT2PTR($type,tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\") +T_PTRDESC + if (sv_isa($arg, \"${ntype}\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + ${type}_desc = (\U${type}_DESC\E*) tmp; + $var = ${type}_desc->ptr; + } + else + Perl_croak_nocontext(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\") +T_REFREF + if (SvROK($arg)) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = *INT2PTR($type,tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not a reference\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\") +T_REFOBJ + if (sv_isa($arg, \"${ntype}\")) { + IV tmp = SvIV((SV*)SvRV($arg)); + $var = *INT2PTR($type,tmp); + } + else + Perl_croak_nocontext(\"%s: %s is not of type %s\", + ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]}, + \"$var\", \"$ntype\") +T_OPAQUE + $var = *($type *)SvPV_nolen($arg) +T_OPAQUEPTR + $var = ($type)SvPV_nolen($arg) +T_PACKED + $var = XS_unpack_$ntype($arg) +T_PACKEDARRAY + $var = XS_unpack_$ntype($arg) +T_ARRAY + U32 ix_$var = $argoff; + $var = $ntype(items -= $argoff); + while (items--) { + DO_ARRAY_ELEM; + ix_$var++; + } + /* this is the number of elements in the array */ + ix_$var -= $argoff +T_STDIO + $var = PerlIO_findFILE(IoIFP(sv_2io($arg))) +T_IN + $var = IoIFP(sv_2io($arg)) +T_INOUT + $var = IoIFP(sv_2io($arg)) +T_OUT + $var = IoOFP(sv_2io($arg)) +############################################################################# +OUTPUT +T_SV + $arg = $var; +T_SVREF + $arg = newRV((SV*)$var); +T_SVREF_REFCOUNT_FIXED + $arg = newRV_noinc((SV*)$var); +T_AVREF + $arg = newRV((SV*)$var); +T_AVREF_REFCOUNT_FIXED + $arg = newRV_noinc((SV*)$var); +T_HVREF + $arg = newRV((SV*)$var); +T_HVREF_REFCOUNT_FIXED + $arg = newRV_noinc((SV*)$var); +T_CVREF + $arg = newRV((SV*)$var); +T_CVREF_REFCOUNT_FIXED + $arg = newRV_noinc((SV*)$var); +T_IV + sv_setiv($arg, (IV)$var); +T_UV + sv_setuv($arg, (UV)$var); +T_INT + sv_setiv($arg, (IV)$var); +T_SYSRET + if ($var != -1) { + if ($var == 0) + sv_setpvn($arg, "0 but true", 10); + else + sv_setiv($arg, (IV)$var); + } +T_ENUM + sv_setiv($arg, (IV)$var); +T_BOOL + ${"$var" eq "RETVAL" ? \"$arg = boolSV($var);" : \"sv_setsv($arg, boolSV($var));"} +T_U_INT + sv_setuv($arg, (UV)$var); +T_SHORT + sv_setiv($arg, (IV)$var); +T_U_SHORT + sv_setuv($arg, (UV)$var); +T_LONG + sv_setiv($arg, (IV)$var); +T_U_LONG + sv_setuv($arg, (UV)$var); +T_CHAR + sv_setpvn($arg, (char *)&$var, 1); +T_U_CHAR + sv_setuv($arg, (UV)$var); +T_FLOAT + sv_setnv($arg, (double)$var); +T_NV + sv_setnv($arg, (NV)$var); +T_DOUBLE + sv_setnv($arg, (double)$var); +T_PV + sv_setpv((SV*)$arg, $var); +T_PTR + sv_setiv($arg, PTR2IV($var)); +T_PTRREF + sv_setref_pv($arg, Nullch, (void*)$var); +T_REF_IV_REF + sv_setref_pv($arg, \"${ntype}\", (void*)new $ntype($var)); +T_REF_IV_PTR + sv_setref_pv($arg, \"${ntype}\", (void*)$var); +T_PTROBJ + sv_setref_pv($arg, \"${ntype}\", (void*)$var); +T_PTRDESC + sv_setref_pv($arg, \"${ntype}\", (void*)new\U${type}_DESC\E($var)); +T_REFREF + NOT_IMPLEMENTED +T_REFOBJ + NOT IMPLEMENTED +T_OPAQUE + sv_setpvn($arg, (char *)&$var, sizeof($var)); +T_OPAQUEPTR + sv_setpvn($arg, (char *)$var, sizeof(*$var)); +T_PACKED + XS_pack_$ntype($arg, $var); +T_PACKEDARRAY + XS_pack_$ntype($arg, $var, count_$ntype); +T_ARRAY + { + U32 ix_$var; + SSize_t extend_size = + /* The weird way this is written is because g++ is dumb + * enough to warn "comparison is always false" on something + * like: + * + * sizeof(a) > sizeof(b) && a > B_t_MAX + * + * (where the LH condition is false) + */ + (size_$var > (sizeof(size_$var) > sizeof(SSize_t) + ? SSize_t_MAX : size_$var)) + ? -1 : (SSize_t)size_$var; + EXTEND(SP, extend_size); + for (ix_$var = 0; ix_$var < size_$var; ix_$var++) { + ST(ix_$var) = sv_newmortal(); + DO_ARRAY_ELEM + } + } +T_STDIO + { + GV *gv = (GV *)sv_newmortal(); + PerlIO *fp = PerlIO_importFILE($var,0); + gv_init_pvn(gv, gv_stashpvs("$Package",1),"__ANONIO__",10,0); + if ( fp && do_open(gv, "+<&", 3, FALSE, 0, 0, fp) ) { + SV *rv = newRV_inc((SV*)gv); + rv = sv_bless(rv, GvSTASH(gv)); + ${"$var" eq "RETVAL" ? \"$arg = sv_2mortal(rv);" + : \"sv_setsv($arg, rv);\n\t\tSvREFCNT_dec_NN(rv);"} + }${"$var" ne "RETVAL" ? \" + else + sv_setsv($arg, &PL_sv_undef);\n" : \""} + } +T_IN + { + GV *gv = (GV *)sv_newmortal(); + gv_init_pvn(gv, gv_stashpvs("$Package",1),"__ANONIO__",10,0); + if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) ) { + SV *rv = newRV_inc((SV*)gv); + rv = sv_bless(rv, GvSTASH(gv)); + ${"$var" eq "RETVAL" ? \"$arg = sv_2mortal(rv);" + : \"sv_setsv($arg, rv);\n\t\tSvREFCNT_dec_NN(rv);"} + }${"$var" ne "RETVAL" ? \" + else + sv_setsv($arg, &PL_sv_undef);\n" : \""} + } +T_INOUT + { + GV *gv = (GV *)sv_newmortal(); + gv_init_pvn(gv, gv_stashpvs("$Package",1),"__ANONIO__",10,0); + if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) ) { + SV *rv = newRV_inc((SV*)gv); + rv = sv_bless(rv, GvSTASH(gv)); + ${"$var" eq "RETVAL" ? \"$arg = sv_2mortal(rv);" + : \"sv_setsv($arg, rv);\n\t\tSvREFCNT_dec_NN(rv);"} + }${"$var" ne "RETVAL" ? \" + else + sv_setsv($arg, &PL_sv_undef);\n" : \""} + } +T_OUT + { + GV *gv = (GV *)sv_newmortal(); + gv_init_pvn(gv, gv_stashpvs("$Package",1),"__ANONIO__",10,0); + if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) ) { + SV *rv = newRV_inc((SV*)gv); + rv = sv_bless(rv, GvSTASH(gv)); + ${"$var" eq "RETVAL" ? \"$arg = sv_2mortal(rv);" + : \"sv_setsv($arg, rv);\n\t\tSvREFCNT_dec_NN(rv);"} + }${"$var" ne "RETVAL" ? \" + else + sv_setsv($arg, &PL_sv_undef);\n" : \""} + } diff --git a/data/miniconda3/lib/perl5/core_perl/ExtUtils/xsubpp b/data/miniconda3/lib/perl5/core_perl/ExtUtils/xsubpp new file mode 100644 index 0000000000000000000000000000000000000000..d596cdff42aa1b369be5b43d2985b3b0270095b3 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/ExtUtils/xsubpp @@ -0,0 +1,185 @@ +#!perl +use 5.006; +BEGIN { pop @INC if $INC[-1] eq '.' } +use strict; +eval { + require ExtUtils::ParseXS; + 1; +} +or do { + my $err = $@ || 'Zombie error'; + my $v = $ExtUtils::ParseXS::VERSION; + $v = '<undef>' if not defined $v; + die "Failed to load or import from ExtUtils::ParseXS (version $v). Please check that ExtUtils::ParseXS is installed correctly and that the newest version will be found in your \@INC path: $err"; +}; + +use Getopt::Long; + +my %args = (); + +my $usage = "Usage: xsubpp [-v] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-strip|s pattern] [-typemap typemap]... file.xs\n"; + +Getopt::Long::Configure qw(no_auto_abbrev no_ignore_case); + +@ARGV = grep {$_ ne '-C++'} @ARGV; # Allow -C++ for backward compatibility +GetOptions(\%args, qw(hiertype! + prototypes! + versioncheck! + linenumbers! + optimize! + inout! + argtypes! + object_capi! + except! + v + typemap=s@ + output=s + s|strip=s + csuffix=s + )) + or die $usage; + +if ($args{v}) { + print "xsubpp version $ExtUtils::ParseXS::VERSION\n"; + exit; +} + +@ARGV == 1 or die $usage; + +$args{filename} = shift @ARGV; + +my $pxs = ExtUtils::ParseXS->new; +$pxs->process_file(%args); +exit( $pxs->report_error_count() ? 1 : 0 ); + +__END__ + +=head1 NAME + +xsubpp - compiler to convert Perl XS code into C code + +=head1 SYNOPSIS + +B<xsubpp> [B<-v>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] [B<-output filename>]... file.xs + +=head1 DESCRIPTION + +This compiler is typically run by the makefiles created by L<ExtUtils::MakeMaker> +or by L<Module::Build> or other Perl module build tools. + +I<xsubpp> will compile XS code into C code by embedding the constructs +necessary to let C functions manipulate Perl values and creates the glue +necessary to let Perl access those functions. The compiler uses typemaps to +determine how to map C function parameters and variables to Perl values. + +The compiler will search for typemap files called I<typemap>. It will use +the following search path to find default typemaps, with the rightmost +typemap taking precedence. + + ../../../typemap:../../typemap:../typemap:typemap + +It will also use a default typemap installed as C<ExtUtils::typemap>. + +=head1 OPTIONS + +Note that the C<XSOPT> MakeMaker option may be used to add these options to +any makefiles generated by MakeMaker. + +=over 5 + +=item B<-hiertype> + +Retains '::' in type names so that C++ hierarchical types can be mapped. + +=item B<-except> + +Adds exception handling stubs to the C code. + +=item B<-typemap typemap> + +Indicates that a user-supplied typemap should take precedence over the +default typemaps. This option may be used multiple times, with the last +typemap having the highest precedence. + +=item B<-output filename> + +Specifies the name of the output file to generate. If no file is +specified, output will be written to standard output. + +=item B<-v> + +Prints the I<xsubpp> version number to standard output, then exits. + +=item B<-prototypes> + +By default I<xsubpp> will not automatically generate prototype code for +all xsubs. This flag will enable prototypes. + +=item B<-noversioncheck> + +Disables the run time test that determines if the object file (derived +from the C<.xs> file) and the C<.pm> files have the same version +number. + +=item B<-nolinenumbers> + +Prevents the inclusion of '#line' directives in the output. + +=item B<-nooptimize> + +Disables certain optimizations. The only optimization that is currently +affected is the use of I<target>s by the output C code (see L<perlguts>). +This may significantly slow down the generated code, but this is the way +B<xsubpp> of 5.005 and earlier operated. + +=item B<-noinout> + +Disable recognition of C<IN>, C<OUT_LIST> and C<INOUT_LIST> declarations. + +=item B<-noargtypes> + +Disable recognition of ANSI-like descriptions of function signature. + +=item B<-C++> + +Currently doesn't do anything at all. This flag has been a no-op for +many versions of perl, at least as far back as perl5.003_07. It's +allowed here for backwards compatibility. + +=item B<-s=...> or B<-strip=...> + +I<This option is obscure and discouraged.> + +If specified, the given string will be stripped off from the beginning +of the C function name in the generated XS functions (if it starts with that prefix). +This only applies to XSUBs without C<CODE> or C<PPCODE> blocks. +For example, the XS: + + void foo_bar(int i); + +when C<xsubpp> is invoked with C<-s foo_> will install a C<foo_bar> +function in Perl, but really call C<bar(i)> in C. Most of the time, +this is the opposite of what you want and failure modes are somewhat +obscure, so please avoid this option where possible. + +=back + +=head1 ENVIRONMENT + +No environment variables are used. + +=head1 AUTHOR + +Originally by Larry Wall. Turned into the C<ExtUtils::ParseXS> module +by Ken Williams. + +=head1 MODIFICATION HISTORY + +See the file F<Changes>. + +=head1 SEE ALSO + +perl(1), perlxs(1), perlxstut(1), ExtUtils::ParseXS + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Fatal.pm b/data/miniconda3/lib/perl5/core_perl/Fatal.pm new file mode 100644 index 0000000000000000000000000000000000000000..09abfb8536d8f80b49b7edfcc8c62afc9d7c6ec4 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Fatal.pm @@ -0,0 +1,1841 @@ +package Fatal; + +# ABSTRACT: Replace functions with equivalents which succeed or die + +use 5.008; # 5.8.x needed for autodie +use Carp; +use strict; +use warnings; +use Tie::RefHash; # To cache subroutine refs +use Config; +use Scalar::Util qw(set_prototype looks_like_number); + +use autodie::Util qw( + fill_protos + install_subs + make_core_trampoline + on_end_of_compile_scope +); + +use constant PERL510 => ( $] >= 5.010 ); + +use constant LEXICAL_TAG => q{:lexical}; +use constant VOID_TAG => q{:void}; +use constant INSIST_TAG => q{!}; + +# Keys for %Cached_fatalised_sub (used in 3rd level) +use constant CACHE_AUTODIE_LEAK_GUARD => 0; +use constant CACHE_FATAL_WRAPPER => 1; +use constant CACHE_FATAL_VOID => 2; + + +use constant ERROR_NOARGS => 'Cannot use lexical %s with no arguments'; +use constant ERROR_VOID_LEX => VOID_TAG.' cannot be used with lexical scope'; +use constant ERROR_LEX_FIRST => LEXICAL_TAG.' must be used as first argument'; +use constant ERROR_NO_LEX => "no %s can only start with ".LEXICAL_TAG; +use constant ERROR_BADNAME => "Bad subroutine name for %s: %s"; +use constant ERROR_NOTSUB => "%s is not a Perl subroutine"; +use constant ERROR_NOT_BUILT => "%s is neither a builtin, nor a Perl subroutine"; +use constant ERROR_NOHINTS => "No user hints defined for %s"; + +use constant ERROR_CANT_OVERRIDE => "Cannot make the non-overridable builtin %s fatal"; + +use constant ERROR_NO_IPC_SYS_SIMPLE => "IPC::System::Simple required for Fatalised/autodying system()"; + +use constant ERROR_IPC_SYS_SIMPLE_OLD => "IPC::System::Simple version %f required for Fatalised/autodying system(). We only have version %f"; + +use constant ERROR_AUTODIE_CONFLICT => q{"no autodie '%s'" is not allowed while "use Fatal '%s'" is in effect}; + +use constant ERROR_FATAL_CONFLICT => q{"use Fatal '%s'" is not allowed while "no autodie '%s'" is in effect}; + +use constant ERROR_58_HINTS => q{Non-subroutine %s hints for %s are not supported under Perl 5.8.x}; + +# Older versions of IPC::System::Simple don't support all the +# features we need. + +use constant MIN_IPC_SYS_SIMPLE_VER => 0.12; + +our $VERSION = '2.32'; # VERSION: Generated by DZP::OurPkg::Version + +our $Debug ||= 0; + +# EWOULDBLOCK values for systems that don't supply their own. +# Even though this is defined with our, that's to help our +# test code. Please don't rely upon this variable existing in +# the future. + +our %_EWOULDBLOCK = ( + MSWin32 => 33, +); + +$Carp::CarpInternal{'Fatal'} = 1; +$Carp::CarpInternal{'autodie'} = 1; +$Carp::CarpInternal{'autodie::exception'} = 1; + +# the linux parisc port has separate EAGAIN and EWOULDBLOCK, +# and the kernel returns EAGAIN +my $try_EAGAIN = ($^O eq 'linux' and $Config{archname} =~ /hppa|parisc/) ? 1 : 0; + +# We have some tags that can be passed in for use with import. +# These are all assumed to be CORE:: + +my %TAGS = ( + ':io' => [qw(:dbm :file :filesys :ipc :socket + read seek sysread syswrite sysseek )], + ':dbm' => [qw(dbmopen dbmclose)], + ':file' => [qw(open close flock sysopen fcntl binmode + ioctl truncate)], + ':filesys' => [qw(opendir closedir chdir link unlink rename mkdir + symlink rmdir readlink chmod chown utime)], + ':ipc' => [qw(:msg :semaphore :shm pipe kill)], + ':msg' => [qw(msgctl msgget msgrcv msgsnd)], + ':threads' => [qw(fork)], + ':semaphore'=>[qw(semctl semget semop)], + ':shm' => [qw(shmctl shmget shmread)], + ':system' => [qw(system exec)], + + # Can we use qw(getpeername getsockname)? What do they do on failure? + # TODO - Can socket return false? + ':socket' => [qw(accept bind connect getsockopt listen recv send + setsockopt shutdown socketpair)], + + # Our defaults don't include system(), because it depends upon + # an optional module, and it breaks the exotic form. + # + # This *may* change in the future. I'd love IPC::System::Simple + # to be a dependency rather than a recommendation, and hence for + # system() to be autodying by default. + + ':default' => [qw(:io :threads)], + + # Everything in v2.07 and before. This was :default less chmod and chown + ':v207' => [qw(:threads :dbm :socket read seek sysread + syswrite sysseek open close flock sysopen fcntl fileno + binmode ioctl truncate opendir closedir chdir link unlink + rename mkdir symlink rmdir readlink umask + :msg :semaphore :shm pipe)], + + # Chmod was added in 2.13 + ':v213' => [qw(:v207 chmod)], + + # chown, utime, kill were added in 2.14 + ':v214' => [qw(:v213 chown utime kill)], + + # umask was removed in 2.26 + ':v225' => [qw(:io :threads umask fileno)], + + # Version specific tags. These allow someone to specify + # use autodie qw(:1.994) and know exactly what they'll get. + + ':1.994' => [qw(:v207)], + ':1.995' => [qw(:v207)], + ':1.996' => [qw(:v207)], + ':1.997' => [qw(:v207)], + ':1.998' => [qw(:v207)], + ':1.999' => [qw(:v207)], + ':1.999_01' => [qw(:v207)], + ':2.00' => [qw(:v207)], + ':2.01' => [qw(:v207)], + ':2.02' => [qw(:v207)], + ':2.03' => [qw(:v207)], + ':2.04' => [qw(:v207)], + ':2.05' => [qw(:v207)], + ':2.06' => [qw(:v207)], + ':2.06_01' => [qw(:v207)], + ':2.07' => [qw(:v207)], # Last release without chmod + ':2.08' => [qw(:v213)], + ':2.09' => [qw(:v213)], + ':2.10' => [qw(:v213)], + ':2.11' => [qw(:v213)], + ':2.12' => [qw(:v213)], + ':2.13' => [qw(:v213)], # Last release without chown + ':2.14' => [qw(:v225)], + ':2.15' => [qw(:v225)], + ':2.16' => [qw(:v225)], + ':2.17' => [qw(:v225)], + ':2.18' => [qw(:v225)], + ':2.19' => [qw(:v225)], + ':2.20' => [qw(:v225)], + ':2.21' => [qw(:v225)], + ':2.22' => [qw(:v225)], + ':2.23' => [qw(:v225)], + ':2.24' => [qw(:v225)], + ':2.25' => [qw(:v225)], + ':2.26' => [qw(:default)], + ':2.27' => [qw(:default)], + ':2.28' => [qw(:default)], + ':2.29' => [qw(:default)], + ':2.30' => [qw(:default)], + ':2.31' => [qw(:default)], + ':2.32' => [qw(:default)], +); + + +{ + # Expand :all immediately by expanding and flattening all tags. + # _expand_tag is not really optimised for expanding the ":all" + # case (i.e. keys %TAGS, or values %TAGS for that matter), so we + # just do it here. + # + # NB: The %tag_cache/_expand_tag relies on $TAGS{':all'} being + # pre-expanded. + my %seen; + my @all = grep { + !/^:/ && !$seen{$_}++ + } map { @{$_} } values %TAGS; + $TAGS{':all'} = \@all; +} + +# This hash contains subroutines for which we should +# subroutine() // die() rather than subroutine() || die() + +my %Use_defined_or; + +# CORE::open returns undef on failure. It can legitimately return +# 0 on success, eg: open(my $fh, '-|') || exec(...); + +@Use_defined_or{qw( + CORE::fork + CORE::recv + CORE::send + CORE::open + CORE::fileno + CORE::read + CORE::readlink + CORE::sysread + CORE::syswrite + CORE::sysseek + CORE::umask +)} = (); + +# Some functions can return true because they changed *some* things, but +# not all of them. This is a list of offending functions, and how many +# items to subtract from @_ to determine the "success" value they return. + +my %Returns_num_things_changed = ( + 'CORE::chmod' => 1, + 'CORE::chown' => 2, + 'CORE::kill' => 1, # TODO: Could this return anything on negative args? + 'CORE::unlink' => 0, + 'CORE::utime' => 2, +); + +# Optional actions to take on the return value before returning it. + +my %Retval_action = ( + "CORE::open" => q{ + + # apply the open pragma from our caller + if( defined $retval && !( @_ >= 3 && $_[1] =~ /:/ )) { + # Get the caller's hint hash + my $hints = (caller 0)[10]; + + # Decide if we're reading or writing and apply the appropriate encoding + # These keys are undocumented. + # Match what PerlIO_context_layers() does. Read gets the read layer, + # everything else gets the write layer. + my $encoding = $_[1] =~ /^\+?>/ ? $hints->{"open>"} : $hints->{"open<"}; + + # Apply the encoding, if any. + if( $encoding ) { + binmode $_[0], $encoding; + } + } + +}, + "CORE::sysopen" => q{ + + # apply the open pragma from our caller + if( defined $retval ) { + # Get the caller's hint hash + my $hints = (caller 0)[10]; + + require Fcntl; + + # Decide if we're reading or writing and apply the appropriate encoding. + # Match what PerlIO_context_layers() does. Read gets the read layer, + # everything else gets the write layer. + my $open_read_only = !($_[2] ^ Fcntl::O_RDONLY()); + my $encoding = $open_read_only ? $hints->{"open<"} : $hints->{"open>"}; + + # Apply the encoding, if any. + if( $encoding ) { + binmode $_[0], $encoding; + } + } + +}, +); + +my %reusable_builtins; + +# "Wait!" I hear you cry, "truncate() and chdir() are not reuseable! They can +# take file and directory handles, which are package depedent." +# +# You would be correct, except that prototype() returns signatures which don't +# allow for passing of globs, and nobody's complained about that. You can +# still use \*FILEHANDLE, but that results in a reference coming through, +# and it's already pointing to the filehandle in the caller's packge, so +# it's all okay. + +@reusable_builtins{qw( + CORE::fork + CORE::kill + CORE::truncate + CORE::chdir + CORE::link + CORE::unlink + CORE::rename + CORE::mkdir + CORE::symlink + CORE::rmdir + CORE::readlink + CORE::umask + CORE::chmod + CORE::chown + CORE::utime + CORE::msgctl + CORE::msgget + CORE::msgrcv + CORE::msgsnd + CORE::semctl + CORE::semget + CORE::semop + CORE::shmctl + CORE::shmget + CORE::shmread + CORE::exec + CORE::system +)} = (); + +# Cached_fatalised_sub caches the various versions of our +# fatalised subs as they're produced. This means we don't +# have to build our own replacement of CORE::open and friends +# for every single package that wants to use them. + +my %Cached_fatalised_sub = (); + +# Every time we're called with package scope, we record the subroutine +# (including package or CORE::) in %Package_Fatal. This allows us +# to detect illegal combinations of autodie and Fatal, and makes sure +# we don't accidently make a Fatal function autodying (which isn't +# very useful). + +my %Package_Fatal = (); + +# The first time we're called with a user-sub, we cache it here. +# In the case of a "no autodie ..." we put back the cached copy. + +my %Original_user_sub = (); + +# Is_fatalised_sub simply records a big map of fatalised subroutine +# refs. It means we can avoid repeating work, or fatalising something +# we've already processed. + +my %Is_fatalised_sub = (); +tie %Is_fatalised_sub, 'Tie::RefHash'; + +# Our trampoline cache allows us to cache trampolines which are used to +# bounce leaked wrapped core subroutines to their actual core counterparts. + +my %Trampoline_cache; + +# A cache mapping "CORE::<name>" to their prototype. Turns out that if +# you "use autodie;" enough times, this pays off. +my %CORE_prototype_cache; + +# We use our package in a few hash-keys. Having it in a scalar is +# convenient. The "guard $PACKAGE" string is used as a key when +# setting up lexical guards. + +my $PACKAGE = __PACKAGE__; +my $NO_PACKAGE = "no $PACKAGE"; # Used to detect 'no autodie' + +# Here's where all the magic happens when someone write 'use Fatal' +# or 'use autodie'. + +sub import { + my $class = shift(@_); + my @original_args = @_; + my $void = 0; + my $lexical = 0; + my $insist_hints = 0; + + my ($pkg, $filename) = caller(); + + @_ or return; # 'use Fatal' is a no-op. + + # If we see the :lexical flag, then _all_ arguments are + # changed lexically + + if ($_[0] eq LEXICAL_TAG) { + $lexical = 1; + shift @_; + + # It is currently an implementation detail that autodie is + # implemented as "use Fatal qw(:lexical ...)". For backwards + # compatibility, we allow it - but not without a warning. + # NB: Optimise for autodie as it is quite possibly the most + # freq. consumer of this case. + if ($class ne 'autodie' and not $class->isa('autodie')) { + if ($class eq 'Fatal') { + warnings::warnif( + 'deprecated', + '[deprecated] The "use Fatal qw(:lexical ...)" ' + . 'should be replaced by "use autodie qw(...)". ' + . 'Seen' # warnif appends " at <...>" + ); + } else { + warnings::warnif( + 'deprecated', + "[deprecated] The class/Package $class is a " + . 'subclass of Fatal and used the :lexical. ' + . 'If $class provides lexical error checking ' + . 'it should extend autodie instead of using :lexical. ' + . 'Seen' # warnif appends " at <...>" + ); + } + # "Promote" the call to autodie from here on. This is + # already mostly the case (e.g. use Fatal qw(:lexical ...) + # would throw autodie::exceptions on error rather than the + # Fatal errors. + $class = 'autodie'; + # This requires that autodie is in fact loaded; otherwise + # the "$class->X()" method calls below will explode. + require autodie; + # TODO, when autodie and Fatal are cleanly separated, we + # should go a "goto &autodie::import" here instead. + } + + # If we see no arguments and :lexical, we assume they + # wanted ':default'. + + if (@_ == 0) { + push(@_, ':default'); + } + + # Don't allow :lexical with :void, it's needlessly confusing. + if ( grep { $_ eq VOID_TAG } @_ ) { + croak(ERROR_VOID_LEX); + } + } + + if ( grep { $_ eq LEXICAL_TAG } @_ ) { + # If we see the lexical tag as the non-first argument, complain. + croak(ERROR_LEX_FIRST); + } + + my @fatalise_these = @_; + + # These subs will get unloaded at the end of lexical scope. + my %unload_later; + # These subs are to be installed into callers namespace. + my %install_subs; + + # Use _translate_import_args to expand tags for us. It will + # pass-through unknown tags (i.e. we have to manually handle + # VOID_TAG). + # + # NB: _translate_import_args re-orders everything for us, so + # we don't have to worry about stuff like: + # + # :default :void :io + # + # That will (correctly) translated into + # + # expand(:defaults-without-io) :void :io + # + # by _translate_import_args. + for my $func ($class->_translate_import_args(@fatalise_these)) { + + if ($func eq VOID_TAG) { + + # When we see :void, set the void flag. + $void = 1; + + } elsif ($func eq INSIST_TAG) { + + $insist_hints = 1; + + } else { + + # Otherwise, fatalise it. + + # Check to see if there's an insist flag at the front. + # If so, remove it, and insist we have hints for this sub. + my $insist_this = $insist_hints; + + if (substr($func, 0, 1) eq '!') { + $func = substr($func, 1); + $insist_this = 1; + } + + # We're going to make a subroutine fatalistic. + # However if we're being invoked with 'use Fatal qw(x)' + # and we've already been called with 'no autodie qw(x)' + # in the same scope, we consider this to be an error. + # Mixing Fatal and autodie effects was considered to be + # needlessly confusing on p5p. + + my $sub = $func; + $sub = "${pkg}::$sub" unless $sub =~ /::/; + + # If we're being called as Fatal, and we've previously + # had a 'no X' in scope for the subroutine, then complain + # bitterly. + + if (! $lexical and $^H{$NO_PACKAGE}{$sub}) { + croak(sprintf(ERROR_FATAL_CONFLICT, $func, $func)); + } + + # We're not being used in a confusing way, so make + # the sub fatal. Note that _make_fatal returns the + # old (original) version of the sub, or undef for + # built-ins. + + my $sub_ref = $class->_make_fatal( + $func, $pkg, $void, $lexical, $filename, + $insist_this, \%install_subs, + ); + + $Original_user_sub{$sub} ||= $sub_ref; + + # If we're making lexical changes, we need to arrange + # for them to be cleaned at the end of our scope, so + # record them here. + + $unload_later{$func} = $sub_ref if $lexical; + } + } + + install_subs($pkg, \%install_subs); + + if ($lexical) { + + # Dark magic to have autodie work under 5.8 + # Copied from namespace::clean, that copied it from + # autobox, that found it on an ancient scroll written + # in blood. + + # This magic bit causes %^H to be lexically scoped. + + $^H |= 0x020000; + + # Our package guard gets invoked when we leave our lexical + # scope. + + on_end_of_compile_scope(sub { + install_subs($pkg, \%unload_later); + }); + + # To allow others to determine when autodie was in scope, + # and with what arguments, we also set a %^H hint which + # is how we were called. + + # This feature should be considered EXPERIMENTAL, and + # may change without notice. Please e-mail pjf@cpan.org + # if you're actually using it. + + $^H{autodie} = "$PACKAGE @original_args"; + + } + + return; + +} + +sub unimport { + my $class = shift; + + # Calling "no Fatal" must start with ":lexical" + if ($_[0] ne LEXICAL_TAG) { + croak(sprintf(ERROR_NO_LEX,$class)); + } + + shift @_; # Remove :lexical + + my $pkg = (caller)[0]; + + # If we've been called with arguments, then the developer + # has explicitly stated 'no autodie qw(blah)', + # in which case, we disable Fatalistic behaviour for 'blah'. + + my @unimport_these = @_ ? @_ : ':all'; + my (%uninstall_subs, %reinstall_subs); + + for my $symbol ($class->_translate_import_args(@unimport_these)) { + + my $sub = $symbol; + $sub = "${pkg}::$sub" unless $sub =~ /::/; + + # If 'blah' was already enabled with Fatal (which has package + # scope) then, this is considered an error. + + if (exists $Package_Fatal{$sub}) { + croak(sprintf(ERROR_AUTODIE_CONFLICT,$symbol,$symbol)); + } + + # Record 'no autodie qw($sub)' as being in effect. + # This is to catch conflicting semantics elsewhere + # (eg, mixing Fatal with no autodie) + + $^H{$NO_PACKAGE}{$sub} = 1; + # Record the current sub to be reinstalled at end of scope + # and then restore the original (can be undef for "CORE::" + # subs) + + { + no strict 'refs'; ## no critic # to avoid: Can't use string (...) as a symbol ref ... + $reinstall_subs{$symbol} = \&$sub + if exists ${"${pkg}::"}{$symbol}; + } + $uninstall_subs{$symbol} = $Original_user_sub{$sub}; + + } + + install_subs($pkg, \%uninstall_subs); + on_end_of_compile_scope(sub { + install_subs($pkg, \%reinstall_subs); + }); + + return; + +} + +sub _translate_import_args { + my ($class, @args) = @_; + my @result; + my %seen; + + if (@args < 2) { + # Optimize for this case, as it is fairly common. (e.g. use + # autodie; or use autodie qw(:all); both trigger this). + return unless @args; + + # Not a (known) tag, pass through. + return @args unless exists($TAGS{$args[0]}); + + # Strip "CORE::" from all elements in the list as import and + # unimport does not handle the "CORE::" prefix too well. + # + # NB: we use substr as it is faster than s/^CORE::// and + # it does not change the elements. + return map { substr($_, 6) } @{ $class->_expand_tag($args[0]) }; + } + + # We want to translate + # + # :default :void :io + # + # into (pseudo-ish): + # + # expanded(:threads) :void expanded(:io) + # + # We accomplish this by "reverse, expand + filter, reverse". + for my $a (reverse(@args)) { + if (exists $TAGS{$a}) { + my $expanded = $class->_expand_tag($a); + push(@result, + # Remove duplicates after ... + grep { !$seen{$_}++ } + # we have stripped CORE:: (see above) + map { substr($_, 6) } + # We take the elements in reverse order + # (as @result be reversed later). + reverse(@{$expanded})); + } else { + # pass through - no filtering here for tags. + # + # The reason for not filtering tags cases like: + # + # ":default :void :io :void :threads" + # + # As we have reversed args, we see this as: + # + # ":threads :void :io :void* :default*" + # + # (Entries marked with "*" will be filtered out completely). When + # reversed again, this will be: + # + # ":io :void :threads" + # + # But we would rather want it to be: + # + # ":void :io :threads" or ":void :io :void :threads" + # + + my $letter = substr($a, 0, 1); + if ($letter ne ':' && $a ne INSIST_TAG) { + next if $seen{$a}++; + if ($letter eq '!' and $seen{substr($a, 1)}++) { + my $name = substr($a, 1); + # People are being silly and doing: + # + # use autodie qw(!a a); + # + # Enjoy this little O(n) clean up... + @result = grep { $_ ne $name } @result; + } + } + push @result, $a; + } + } + # Reverse the result to restore the input order + return reverse(@result); +} + + +# NB: Perl::Critic's dump-autodie-tag-contents depends upon this +# continuing to work. + +{ + # We assume that $TAGS{':all'} is pre-expanded and just fill it in + # from the beginning. + my %tag_cache = ( + 'all' => [map { "CORE::$_" } @{$TAGS{':all'}}], + ); + + # Expand a given tag (e.g. ":default") into a listref containing + # all sub names covered by that tag. Each sub is returned as + # "CORE::<name>" (i.e. "CORE::open" rather than "open"). + # + # NB: the listref must not be modified. + sub _expand_tag { + my ($class, $tag) = @_; + + if (my $cached = $tag_cache{$tag}) { + return $cached; + } + + if (not exists $TAGS{$tag}) { + croak "Invalid exception class $tag"; + } + + my @to_process = @{$TAGS{$tag}}; + + # If the tag is basically an alias of another tag (like e.g. ":2.11"), + # then just share the resulting reference with the original content (so + # we only pay for an extra reference for the alias memory-wise). + if (@to_process == 1 && substr($to_process[0], 0, 1) eq ':') { + # We could do this for "non-tags" as well, but that only occurs + # once at the time of writing (":threads" => ["fork"]), so + # probably not worth it. + my $expanded = $class->_expand_tag($to_process[0]); + $tag_cache{$tag} = $expanded; + return $expanded; + } + + my %seen = (); + my @taglist = (); + + for my $item (@to_process) { + # substr is more efficient than m/^:/ for stuff like this, + # at the price of being a bit more verbose/low-level. + if (substr($item, 0, 1) eq ':') { + # Use recursion here to ensure we expand a tag at most once. + + my $expanded = $class->_expand_tag($item); + push @taglist, grep { !$seen{$_}++ } @{$expanded}; + } else { + my $subname = "CORE::$item"; + push @taglist, $subname + unless $seen{$subname}++; + } + } + + $tag_cache{$tag} = \@taglist; + + return \@taglist; + + } + +} + +# This is a backwards compatible version of _write_invocation. It's +# recommended you don't use it. + +sub write_invocation { + my ($core, $call, $name, $void, @args) = @_; + + return Fatal->_write_invocation( + $core, $call, $name, $void, + 0, # Lexical flag + undef, # Sub, unused in legacy mode + undef, # Subref, unused in legacy mode. + @args + ); +} + +# This version of _write_invocation is used internally. It's not +# recommended you call it from external code, as the interface WILL +# change in the future. + +sub _write_invocation { + + my ($class, $core, $call, $name, $void, $lexical, $sub, $sref, @argvs) = @_; + + if (@argvs == 1) { # No optional arguments + + my @argv = @{$argvs[0]}; + shift @argv; + + return $class->_one_invocation($core,$call,$name,$void,$sub,! $lexical, $sref, @argv); + + } else { + my $else = "\t"; + my (@out, @argv, $n); + while (@argvs) { + @argv = @{shift @argvs}; + $n = shift @argv; + + my $condition = "\@_ == $n"; + + if (@argv and $argv[-1] =~ /[#@]_/) { + # This argv ends with '@' in the prototype, so it matches + # any number of args >= the number of expressions in the + # argv. + $condition = "\@_ >= $n"; + } + + push @out, "${else}if ($condition) {\n"; + + $else = "\t} els"; + + push @out, $class->_one_invocation($core,$call,$name,$void,$sub,! $lexical, $sref, @argv); + } + push @out, qq[ + } + die "Internal error: $name(\@_): Do not expect to get ", scalar(\@_), " arguments"; + ]; + + return join '', @out; + } +} + + +# This is a slim interface to ensure backward compatibility with +# anyone doing very foolish things with old versions of Fatal. + +sub one_invocation { + my ($core, $call, $name, $void, @argv) = @_; + + return Fatal->_one_invocation( + $core, $call, $name, $void, + undef, # Sub. Unused in back-compat mode. + 1, # Back-compat flag + undef, # Subref, unused in back-compat mode. + @argv + ); + +} + +# This is the internal interface that generates code. +# NOTE: This interface WILL change in the future. Please do not +# call this subroutine directly. + +# TODO: Whatever's calling this code has already looked up hints. Pass +# them in, rather than look them up a second time. + +sub _one_invocation { + my ($class, $core, $call, $name, $void, $sub, $back_compat, $sref, @argv) = @_; + + + # If someone is calling us directly (a child class perhaps?) then + # they could try to mix void without enabling backwards + # compatibility. We just don't support this at all, so we gripe + # about it rather than doing something unwise. + + if ($void and not $back_compat) { + Carp::confess("Internal error: :void mode not supported with $class"); + } + + # @argv only contains the results of the in-built prototype + # function, and is therefore safe to interpolate in the + # code generators below. + + # TODO - The following clobbers context, but that's what the + # old Fatal did. Do we care? + + if ($back_compat) { + + # Use Fatal qw(system) will never be supported. It generated + # a compile-time error with legacy Fatal, and there's no reason + # to support it when autodie does a better job. + + if ($call eq 'CORE::system') { + return q{ + croak("UNIMPLEMENTED: use Fatal qw(system) not supported."); + }; + } + + local $" = ', '; + + if ($void) { + return qq/return (defined wantarray)?$call(@argv): + $call(@argv) || Carp::croak("Can't $name(\@_)/ . + ($core ? ': $!' : ', \$! is \"$!\"') . '")' + } else { + return qq{return $call(@argv) || Carp::croak("Can't $name(\@_)} . + ($core ? ': $!' : ', \$! is \"$!\"') . '")'; + } + } + + # The name of our original function is: + # $call if the function is CORE + # $sub if our function is non-CORE + + # The reason for this is that $call is what we're actually + # calling. For our core functions, this is always + # CORE::something. However for user-defined subs, we're about to + # replace whatever it is that we're calling; as such, we actually + # calling a subroutine ref. + + my $human_sub_name = $core ? $call : $sub; + + # Should we be testing to see if our result is defined, or + # just true? + + my $use_defined_or; + + my $hints; # All user-sub hints, including list hints. + + if ( $core ) { + + # Core hints are built into autodie. + + $use_defined_or = exists ( $Use_defined_or{$call} ); + + } + else { + + # User sub hints are looked up using autodie::hints, + # since users may wish to add their own hints. + + require autodie::hints; + + $hints = autodie::hints->get_hints_for( $sref ); + + # We'll look up the sub's fullname. This means we + # get better reports of where it came from in our + # error messages, rather than what imported it. + + $human_sub_name = autodie::hints->sub_fullname( $sref ); + + } + + # Checks for special core subs. + + if ($call eq 'CORE::system') { + + # Leverage IPC::System::Simple if we're making an autodying + # system. + + local $" = ", "; + + # We need to stash $@ into $E, rather than using + # local $@ for the whole sub. If we don't then + # any exceptions from internal errors in autodie/Fatal + # will mysteriously disappear before propagating + # upwards. + + return qq{ + my \$retval; + my \$E; + + + { + local \$@; + + eval { + \$retval = IPC::System::Simple::system(@argv); + }; + + \$E = \$@; + } + + if (\$E) { + + # TODO - This can't be overridden in child + # classes! + + die autodie::exception::system->new( + function => q{CORE::system}, args => [ @argv ], + message => "\$E", errno => \$!, + ); + } + + return \$retval; + }; + + } + + local $" = ', '; + + # If we're going to throw an exception, here's the code to use. + my $die = qq{ + die $class->throw( + function => q{$human_sub_name}, args => [ @argv ], + pragma => q{$class}, errno => \$!, + context => \$context, return => \$retval, + eval_error => \$@ + ) + }; + + if ($call eq 'CORE::flock') { + + # flock needs special treatment. When it fails with + # LOCK_UN and EWOULDBLOCK, then it's not really fatal, it just + # means we couldn't get the lock right now. + + require POSIX; # For POSIX::EWOULDBLOCK + + local $@; # Don't blat anyone else's $@. + + # Ensure that our vendor supports EWOULDBLOCK. If they + # don't (eg, Windows), then we use known values for its + # equivalent on other systems. + + my $EWOULDBLOCK = eval { POSIX::EWOULDBLOCK(); } + || $_EWOULDBLOCK{$^O} + || _autocroak("Internal error - can't overload flock - EWOULDBLOCK not defined on this system."); + my $EAGAIN = $EWOULDBLOCK; + if ($try_EAGAIN) { + $EAGAIN = eval { POSIX::EAGAIN(); } + || _autocroak("Internal error - can't overload flock - EAGAIN not defined on this system."); + } + + require Fcntl; # For Fcntl::LOCK_NB + + return qq{ + + my \$context = wantarray() ? "list" : "scalar"; + + # Try to flock. If successful, return it immediately. + + my \$retval = $call(@argv); + return \$retval if \$retval; + + # If we failed, but we're using LOCK_NB and + # returned EWOULDBLOCK, it's not a real error. + + if (\$_[1] & Fcntl::LOCK_NB() and + (\$! == $EWOULDBLOCK or + ($try_EAGAIN and \$! == $EAGAIN ))) { + return \$retval; + } + + # Otherwise, we failed. Die noisily. + + $die; + + }; + } + + if ($call eq 'CORE::kill') { + + return qq[ + + my \$num_things = \@_ - $Returns_num_things_changed{$call}; + my \$context = ! defined wantarray() ? 'void' : 'scalar'; + my \$signal = \$_[0]; + my \$retval = $call(@argv); + my \$sigzero = looks_like_number( \$signal ) && \$signal == 0; + + if ( ( \$sigzero && \$context eq 'void' ) + or ( ! \$sigzero && \$retval != \$num_things ) ) { + + $die; + } + + return \$retval; + ]; + } + + if (exists $Returns_num_things_changed{$call}) { + + # Some things return the number of things changed (like + # chown, kill, chmod, etc). We only consider these successful + # if *all* the things are changed. + + return qq[ + my \$num_things = \@_ - $Returns_num_things_changed{$call}; + my \$retval = $call(@argv); + + if (\$retval != \$num_things) { + + # We need \$context to throw an exception. + # It's *always* set to scalar, because that's how + # autodie calls chown() above. + + my \$context = "scalar"; + $die; + } + + return \$retval; + ]; + } + + # AFAIK everything that can be given an unopned filehandle + # will fail if it tries to use it, so we don't really need + # the 'unopened' warning class here. Especially since they + # then report the wrong line number. + + # Other warnings are disabled because they produce excessive + # complaints from smart-match hints under 5.10.1. + + my $code = qq[ + no warnings qw(unopened uninitialized numeric); + no if \$\] >= 5.017011, warnings => "experimental::smartmatch"; + + if (wantarray) { + my \@results = $call(@argv); + my \$retval = \\\@results; + my \$context = "list"; + + ]; + + my $retval_action = $Retval_action{$call} || ''; + + if ( $hints and ( ref($hints->{list} ) || "" ) eq 'CODE' ) { + + # NB: Subroutine hints are passed as a full list. + # This differs from the 5.10.0 smart-match behaviour, + # but means that context unaware subroutines can use + # the same hints in both list and scalar context. + + $code .= qq{ + if ( \$hints->{list}->(\@results) ) { $die }; + }; + } + elsif ( PERL510 and $hints ) { + $code .= qq{ + if ( \@results ~~ \$hints->{list} ) { $die }; + }; + } + elsif ( $hints ) { + croak sprintf(ERROR_58_HINTS, 'list', $sub); + } + else { + $code .= qq{ + # An empty list, or a single undef is failure + if (! \@results or (\@results == 1 and ! defined \$results[0])) { + $die; + } + } + } + + # Tidy up the end of our wantarray call. + + $code .= qq[ + return \@results; + } + ]; + + + # Otherwise, we're in scalar context. + # We're never in a void context, since we have to look + # at the result. + + $code .= qq{ + my \$retval = $call(@argv); + my \$context = "scalar"; + }; + + if ( $hints and ( ref($hints->{scalar} ) || "" ) eq 'CODE' ) { + + # We always call code refs directly, since that always + # works in 5.8.x, and always works in 5.10.1 + + return $code .= qq{ + if ( \$hints->{scalar}->(\$retval) ) { $die }; + $retval_action + return \$retval; + }; + + } + elsif (PERL510 and $hints) { + return $code . qq{ + + if ( \$retval ~~ \$hints->{scalar} ) { $die }; + $retval_action + return \$retval; + }; + } + elsif ( $hints ) { + croak sprintf(ERROR_58_HINTS, 'scalar', $sub); + } + + return $code . + ( $use_defined_or ? qq{ + + $die if not defined \$retval; + $retval_action + return \$retval; + + } : qq{ + + $retval_action + return \$retval || $die; + + } ) ; + +} + +# This returns the old copy of the sub, so we can +# put it back at end of scope. + +# TODO : Check to make sure prototypes are restored correctly. + +# TODO: Taking a huge list of arguments is awful. Rewriting to +# take a hash would be lovely. + +# TODO - BACKCOMPAT - This is not yet compatible with 5.10.0 + +sub _make_fatal { + my($class, $sub, $pkg, $void, $lexical, $filename, $insist, $install_subs) = @_; + my($code, $sref, $proto, $core, $call, $hints, $cache, $cache_type); + my $ini = $sub; + my $name = $sub; + + + if (index($sub, '::') == -1) { + $sub = "${pkg}::$sub"; + if (substr($name, 0, 1) eq '&') { + $name = substr($name, 1); + } + } else { + $name =~ s/.*:://; + } + + + # Figure if we're using lexical or package semantics and + # twiddle the appropriate bits. + + if (not $lexical) { + $Package_Fatal{$sub} = 1; + } + + # TODO - We *should* be able to do skipping, since we know when + # we've lexicalised / unlexicalised a subroutine. + + + warn "# _make_fatal: sub=$sub pkg=$pkg name=$name void=$void\n" if $Debug; + croak(sprintf(ERROR_BADNAME, $class, $name)) unless $name =~ /^\w+$/; + + if (defined(&$sub)) { # user subroutine + + # NOTE: Previously we would localise $@ at this point, so + # the following calls to eval {} wouldn't interfere with anything + # that's already in $@. Unfortunately, it would also stop + # any of our croaks from triggering(!), which is even worse. + + # This could be something that we've fatalised that + # was in core. + + # Store the current sub in case we need to restore it. + $sref = \&$sub; + + if ( $Package_Fatal{$sub} and exists($CORE_prototype_cache{"CORE::$name"})) { + + # Something we previously made Fatal that was core. + # This is safe to replace with an autodying to core + # version. + + $core = 1; + $call = "CORE::$name"; + $proto = $CORE_prototype_cache{$call}; + + # We return our $sref from this subroutine later + # on, indicating this subroutine should be placed + # back when we're finished. + + + + } else { + + # If this is something we've already fatalised or played with, + # then look-up the name of the original sub for the rest of + # our processing. + + if (exists($Is_fatalised_sub{$sref})) { + # $sub is one of our wrappers around a CORE sub or a + # user sub. Instead of wrapping our wrapper, lets just + # generate a new wrapper for the original sub. + # - NB: the current wrapper might be for a different class + # than the one we are generating now (e.g. some limited + # mixing between use Fatal + use autodie can occur). + # - Even for nested autodie, we need this as the leak guards + # differ. + my $s = $Is_fatalised_sub{$sref}; + if (defined($s)) { + # It is a wrapper for a user sub + $sub = $s; + } else { + # It is a wrapper for a CORE:: sub + $core = 1; + $call = "CORE::$name"; + $proto = $CORE_prototype_cache{$call}; + } + } + + # A regular user sub, or a user sub wrapping a + # core sub. + + if (!$core) { + # A non-CORE sub might have hints and such... + $proto = prototype($sref); + $call = '&$sref'; + require autodie::hints; + + $hints = autodie::hints->get_hints_for( $sref ); + + # If we've insisted on hints, but don't have them, then + # bail out! + + if ($insist and not $hints) { + croak(sprintf(ERROR_NOHINTS, $name)); + } + + # Otherwise, use the default hints if we don't have + # any. + + $hints ||= autodie::hints::DEFAULT_HINTS(); + } + + } + + } elsif ($sub eq $ini && $sub !~ /^CORE::GLOBAL::/) { + # Stray user subroutine + croak(sprintf(ERROR_NOTSUB,$sub)); + + } elsif ($name eq 'system') { + + # If we're fatalising system, then we need to load + # helper code. + + # The business with $E is to avoid clobbering our caller's + # $@, and to avoid $@ being localised when we croak. + + my $E; + + { + local $@; + + eval { + require IPC::System::Simple; # Only load it if we need it. + require autodie::exception::system; + }; + $E = $@; + } + + if ($E) { croak ERROR_NO_IPC_SYS_SIMPLE; } + + # Make sure we're using a recent version of ISS that actually + # support fatalised system. + if ($IPC::System::Simple::VERSION < MIN_IPC_SYS_SIMPLE_VER) { + croak sprintf( + ERROR_IPC_SYS_SIMPLE_OLD, MIN_IPC_SYS_SIMPLE_VER, + $IPC::System::Simple::VERSION + ); + } + + $call = 'CORE::system'; + $core = 1; + + } elsif ($name eq 'exec') { + # Exec doesn't have a prototype. We don't care. This + # breaks the exotic form with lexical scope, and gives + # the regular form a "do or die" behavior as expected. + + $call = 'CORE::exec'; + $core = 1; + + } else { # CORE subroutine + $call = "CORE::$name"; + if (exists($CORE_prototype_cache{$call})) { + $proto = $CORE_prototype_cache{$call}; + } else { + my $E; + { + local $@; + $proto = eval { prototype $call }; + $E = $@; + } + croak(sprintf(ERROR_NOT_BUILT,$name)) if $E; + croak(sprintf(ERROR_CANT_OVERRIDE,$name)) if not defined $proto; + $CORE_prototype_cache{$call} = $proto; + } + $core = 1; + } + + # TODO: This caching works, but I don't like using $void and + # $lexical as keys. In particular, I suspect our code may end up + # wrapping already wrapped code when autodie and Fatal are used + # together. + + # NB: We must use '$sub' (the name plus package) and not + # just '$name' (the short name) here. Failing to do so + # results code that's in the wrong package, and hence has + # access to the wrong package filehandles. + + $cache = $Cached_fatalised_sub{$class}{$sub}; + if ($lexical) { + $cache_type = CACHE_AUTODIE_LEAK_GUARD; + } else { + $cache_type = CACHE_FATAL_WRAPPER; + $cache_type = CACHE_FATAL_VOID if $void; + } + + if (my $subref = $cache->{$cache_type}) { + $install_subs->{$name} = $subref; + return $sref; + } + + # If our subroutine is reusable (ie, not package depdendent), + # then check to see if we've got a cached copy, and use that. + # See RT #46984. (Thanks to Niels Thykier for being awesome!) + + if ($core && exists $reusable_builtins{$call}) { + # For non-lexical subs, we can just use this cache directly + # - for lexical variants, we need a leak guard as well. + $code = $reusable_builtins{$call}{$lexical}; + if (!$lexical && defined($code)) { + $install_subs->{$name} = $code; + return $sref; + } + } + + if (!($lexical && $core) && !defined($code)) { + # No code available, generate it now. + my $wrapper_pkg = $pkg; + $wrapper_pkg = undef if (exists($reusable_builtins{$call})); + $code = $class->_compile_wrapper($wrapper_pkg, $core, $call, $name, + $void, $lexical, $sub, $sref, + $hints, $proto); + if (!defined($wrapper_pkg)) { + # cache it so we don't recompile this part again + $reusable_builtins{$call}{$lexical} = $code; + } + } + + # Now we need to wrap our fatalised sub inside an itty bitty + # closure, which can detect if we've leaked into another file. + # Luckily, we only need to do this for lexical (autodie) + # subs. Fatal subs can leak all they want, it's considered + # a "feature" (or at least backwards compatible). + + # TODO: Cache our leak guards! + + # TODO: This is pretty hairy code. A lot more tests would + # be really nice for this. + + my $installed_sub = $code; + + if ($lexical) { + $installed_sub = $class->_make_leak_guard($filename, $code, $sref, $call, + $pkg, $proto); + } + + $cache->{$cache_type} = $code; + + $install_subs->{$name} = $installed_sub; + + # Cache that we've now overridden this sub. If we get called + # again, we may need to find that find subroutine again (eg, for hints). + + $Is_fatalised_sub{$installed_sub} = $sref; + + return $sref; + +} + +# This subroutine exists primarily so that child classes can override +# it to point to their own exception class. Doing this is significantly +# less complex than overriding throw() + +sub exception_class { return "autodie::exception" }; + +{ + my %exception_class_for; + my %class_loaded; + + sub throw { + my ($class, @args) = @_; + + # Find our exception class if we need it. + my $exception_class = + $exception_class_for{$class} ||= $class->exception_class; + + if (not $class_loaded{$exception_class}) { + if ($exception_class =~ /[^\w:']/) { + confess "Bad exception class '$exception_class'.\nThe '$class->exception_class' method wants to use $exception_class\nfor exceptions, but it contains characters which are not word-characters or colons."; + } + + # Alas, Perl does turn barewords into modules unless they're + # actually barewords. As such, we're left doing a string eval + # to make sure we load our file correctly. + + my $E; + + { + local $@; # We can't clobber $@, it's wrong! + my $pm_file = $exception_class . ".pm"; + $pm_file =~ s{ (?: :: | ' ) }{/}gx; + eval { require $pm_file }; + $E = $@; # Save $E despite ending our local. + } + + # We need quotes around $@ to make sure it's stringified + # while still in scope. Without them, we run the risk of + # $@ having been cleared by us exiting the local() block. + + confess "Failed to load '$exception_class'.\nThis may be a typo in the '$class->exception_class' method,\nor the '$exception_class' module may not exist.\n\n $E" if $E; + + $class_loaded{$exception_class}++; + + } + + return $exception_class->new(@args); + } +} + +# Creates and returns a leak guard (with prototype if needed). +sub _make_leak_guard { + my ($class, $filename, $wrapped_sub, $orig_sub, $call, $pkg, $proto) = @_; + + # The leak guard is rather lengthly (in fact it makes up the most + # of _make_leak_guard). It is possible to split it into a large + # "generic" part and a small wrapper with call-specific + # information. This was done in v2.19 and profiling suggested + # that we ended up using a substantial amount of runtime in "goto" + # between the leak guard(s) and the final sub. Therefore, the two + # parts were merged into one to reduce the runtime overhead. + + my $leak_guard = sub { + my $caller_level = 0; + my $caller; + + while ( ($caller = (caller $caller_level)[1]) =~ m{^\(eval \d+\)$} ) { + + # If our filename is actually an eval, and we + # reach it, then go to our autodying code immediatately. + + last if ($caller eq $filename); + $caller_level++; + } + + # We're now out of the eval stack. + + if ($caller eq $filename) { + # No leak, call the wrapper. NB: In this case, it doesn't + # matter if it is a CORE sub or not. + if (!defined($wrapped_sub)) { + # CORE sub that we were too lazy to compile when we + # created this leak guard. + die "$call is not CORE::<something>" + if substr($call, 0, 6) ne 'CORE::'; + + my $name = substr($call, 6); + my $sub = $name; + my $lexical = 1; + my $wrapper_pkg = $pkg; + my $code; + if (exists($reusable_builtins{$call})) { + $code = $reusable_builtins{$call}{$lexical}; + $wrapper_pkg = undef; + } + if (!defined($code)) { + $code = $class->_compile_wrapper($wrapper_pkg, + 1, # core + $call, + $name, + 0, # void + $lexical, + $sub, + undef, # subref (not used for core) + undef, # hints (not used for core) + $proto); + + if (!defined($wrapper_pkg)) { + # cache it so we don't recompile this part again + $reusable_builtins{$call}{$lexical} = $code; + } + } + # As $wrapped_sub is "closed over", updating its value will + # be "remembered" for the next call. + $wrapped_sub = $code; + } + goto $wrapped_sub; + } + + # We leaked, time to call the original function. + # - for non-core functions that will be $orig_sub + # - for CORE functions, $orig_sub may be a trampoline + goto $orig_sub if defined($orig_sub); + + # We are wrapping a CORE sub and we do not have a trampoline + # yet. + # + # If we've cached a trampoline, then use it. Usually only + # resuable subs will have cache hits, but non-reusuably ones + # can get it as well in (very) rare cases. It is mostly in + # cases where a package uses autodie multiple times and leaks + # from multiple places. Possibly something like: + # + # package Pkg::With::LeakyCode; + # sub a { + # use autodie; + # code_that_leaks(); + # } + # + # sub b { + # use autodie; + # more_leaky_code(); + # } + # + # Note that we use "Fatal" as package name for reusable subs + # because A) that allows us to trivially re-use the + # trampolines as well and B) because the reusable sub is + # compiled into "package Fatal" as well. + + $pkg = 'Fatal' if exists $reusable_builtins{$call}; + $orig_sub = $Trampoline_cache{$pkg}{$call}; + + if (not $orig_sub) { + # If we don't have a trampoline, we need to build it. + # + # We only generate trampolines when we need them, and + # we can cache them by subroutine + package. + # + # As $orig_sub is "closed over", updating its value will + # be "remembered" for the next call. + + $orig_sub = make_core_trampoline($call, $pkg, $proto); + + # We still cache it despite remembering it in $orig_sub as + # well. In particularly, we rely on this to avoid + # re-compiling the reusable trampolines. + $Trampoline_cache{$pkg}{$call} = $orig_sub; + } + + # Bounce to our trampoline, which takes us to our core sub. + goto $orig_sub; + }; # <-- end of leak guard + + # If there is a prototype on the original sub, copy it to the leak + # guard. + if (defined $proto) { + # The "\&" may appear to be redundant but set_prototype + # croaks when it is removed. + set_prototype(\&$leak_guard, $proto); + } + + return $leak_guard; +} + +sub _compile_wrapper { + my ($class, $wrapper_pkg, $core, $call, $name, $void, $lexical, $sub, $sref, $hints, $proto) = @_; + my $real_proto = ''; + my @protos; + my $code; + if (defined $proto) { + $real_proto = " ($proto)"; + } else { + $proto = '@'; + } + + @protos = fill_protos($proto); + $code = qq[ + sub$real_proto { + ]; + + if (!$lexical) { + $code .= q[ + local($", $!) = (', ', 0); + ]; + } + + # Don't have perl whine if exec fails, since we'll be handling + # the exception now. + $code .= "no warnings qw(exec);\n" if $call eq "CORE::exec"; + + $code .= $class->_write_invocation($core, $call, $name, $void, $lexical, + $sub, $sref, @protos); + $code .= "}\n"; + warn $code if $Debug; + + # I thought that changing package was a monumental waste of + # time for CORE subs, since they'll always be the same. However + # that's not the case, since they may refer to package-based + # filehandles (eg, with open). + # + # The %reusable_builtins hash defines ones we can aggressively + # cache as they never depend upon package-based symbols. + + my $E; + + { + no strict 'refs'; ## no critic # to avoid: Can't use string (...) as a symbol ref ... + local $@; + if (defined($wrapper_pkg)) { + $code = eval("package $wrapper_pkg; require Carp; $code"); ## no critic + } else { + $code = eval("require Carp; $code"); ## no critic + + } + $E = $@; + } + + if (not $code) { + my $true_name = $core ? $call : $sub; + croak("Internal error in autodie/Fatal processing $true_name: $E"); + } + return $code; +} + +# For some reason, dying while replacing our subs doesn't +# kill our calling program. It simply stops the loading of +# autodie and keeps going with everything else. The _autocroak +# sub allows us to die with a vengeance. It should *only* ever be +# used for serious internal errors, since the results of it can't +# be captured. + +sub _autocroak { + warn Carp::longmess(@_); + exit(255); # Ugh! +} + +1; + +__END__ + +=head1 NAME + +Fatal - Replace functions with equivalents which succeed or die + +=head1 SYNOPSIS + + use Fatal qw(open close); + + open(my $fh, "<", $filename); # No need to check errors! + + use File::Copy qw(move); + use Fatal qw(move); + + move($file1, $file2); # No need to check errors! + + sub juggle { . . . } + Fatal->import('juggle'); + +=head1 BEST PRACTICE + +B<Fatal has been obsoleted by the new L<autodie> pragma.> Please use +L<autodie> in preference to C<Fatal>. L<autodie> supports lexical scoping, +throws real exception objects, and provides much nicer error messages. + +The use of C<:void> with Fatal is discouraged. + +=head1 DESCRIPTION + +C<Fatal> provides a way to conveniently replace +functions which normally return a false value when they fail with +equivalents which raise exceptions if they are not successful. This +lets you use these functions without having to test their return +values explicitly on each call. Exceptions can be caught using +C<eval{}>. See L<perlfunc> and L<perlvar> for details. + +The do-or-die equivalents are set up simply by calling Fatal's +C<import> routine, passing it the names of the functions to be +replaced. You may wrap both user-defined functions and overridable +CORE operators (except C<exec>, C<system>, C<print>, or any other +built-in that cannot be expressed via prototypes) in this way. + +If the symbol C<:void> appears in the import list, then functions +named later in that import list raise an exception only when +these are called in void context--that is, when their return +values are ignored. For example + + use Fatal qw/:void open close/; + + # properly checked, so no exception raised on error + if (not open(my $fh, '<', '/bogotic') { + warn "Can't open /bogotic: $!"; + } + + # not checked, so error raises an exception + close FH; + +The use of C<:void> is discouraged, as it can result in exceptions +not being thrown if you I<accidentally> call a method without +void context. Use L<autodie> instead if you need to be able to +disable autodying/Fatal behaviour for a small block of code. + +=head1 DIAGNOSTICS + +=over 4 + +=item Bad subroutine name for Fatal: %s + +You've called C<Fatal> with an argument that doesn't look like +a subroutine name, nor a switch that this version of Fatal +understands. + +=item %s is not a Perl subroutine + +You've asked C<Fatal> to try and replace a subroutine which does not +exist, or has not yet been defined. + +=item %s is neither a builtin, nor a Perl subroutine + +You've asked C<Fatal> to replace a subroutine, but it's not a Perl +built-in, and C<Fatal> couldn't find it as a regular subroutine. +It either doesn't exist or has not yet been defined. + +=item Cannot make the non-overridable %s fatal + +You've tried to use C<Fatal> on a Perl built-in that can't be +overridden, such as C<print> or C<system>, which means that +C<Fatal> can't help you, although some other modules might. +See the L</"SEE ALSO"> section of this documentation. + +=item Internal error: %s + +You've found a bug in C<Fatal>. Please report it using +the C<perlbug> command. + +=back + +=head1 BUGS + +C<Fatal> clobbers the context in which a function is called and always +makes it a scalar context, except when the C<:void> tag is used. +This problem does not exist in L<autodie>. + +"Used only once" warnings can be generated when C<autodie> or C<Fatal> +is used with package filehandles (eg, C<FILE>). It's strongly recommended +you use scalar filehandles instead. + +=head1 AUTHOR + +Original module by Lionel Cons (CERN). + +Prototype updates by Ilya Zakharevich <ilya@math.ohio-state.edu>. + +L<autodie> support, bugfixes, extended diagnostics, C<system> +support, and major overhauling by Paul Fenwick <pjf@perltraining.com.au> + +=head1 LICENSE + +This module is free software, you may distribute it under the +same terms as Perl itself. + +=head1 SEE ALSO + +L<autodie> for a nicer way to use lexical Fatal. + +L<IPC::System::Simple> for a similar idea for calls to C<system()> +and backticks. + +=for Pod::Coverage exception_class fill_protos one_invocation throw write_invocation ERROR_NO_IPC_SYS_SIMPLE LEXICAL_TAG + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/File/Basename.pm b/data/miniconda3/lib/perl5/core_perl/File/Basename.pm new file mode 100644 index 0000000000000000000000000000000000000000..4b4fe95cfd7cffb8e4b9e2dcab13d665ec9f36d6 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Basename.pm @@ -0,0 +1,402 @@ +=head1 NAME + +File::Basename - Parse file paths into directory, filename and suffix. + +=head1 SYNOPSIS + + use File::Basename; + + ($name,$path,$suffix) = fileparse($fullname,@suffixlist); + $name = fileparse($fullname,@suffixlist); + + $basename = basename($fullname,@suffixlist); + $dirname = dirname($fullname); + + +=head1 DESCRIPTION + +These routines allow you to parse file paths into their directory, filename +and suffix. + +B<NOTE>: C<dirname()> and C<basename()> emulate the behaviours, and +quirks, of the shell and C functions of the same name. See each +function's documentation for details. If your concern is just parsing +paths it is safer to use L<File::Spec>'s C<splitpath()> and +C<splitdir()> methods. + +It is guaranteed that + + # Where $path_separator is / for Unix, \ for Windows, etc... + dirname($path) . $path_separator . basename($path); + +is equivalent to the original path for all systems but VMS. + + +=cut + + +package File::Basename; + +# File::Basename is used during the Perl build, when the re extension may +# not be available, but we only actually need it if running under tainting. +BEGIN { + if (${^TAINT}) { + require re; + re->import('taint'); + } +} + + +use strict; +use 5.006; +use warnings; +our(@ISA, @EXPORT, $VERSION, $Fileparse_fstype, $Fileparse_igncase); +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(fileparse fileparse_set_fstype basename dirname); +$VERSION = "2.85"; + +fileparse_set_fstype($^O); + + +=over 4 + +=item C<fileparse> +X<fileparse> + + my($filename, $dirs, $suffix) = fileparse($path); + my($filename, $dirs, $suffix) = fileparse($path, @suffixes); + my $filename = fileparse($path, @suffixes); + +The C<fileparse()> routine divides a file path into its $dirs, $filename +and (optionally) the filename $suffix. + +$dirs contains everything up to and including the last +directory separator in the $path including the volume (if applicable). +The remainder of the $path is the $filename. + + # On Unix returns ("baz", "/foo/bar/", "") + fileparse("/foo/bar/baz"); + + # On Windows returns ("baz", 'C:\foo\bar\', "") + fileparse('C:\foo\bar\baz'); + + # On Unix returns ("", "/foo/bar/baz/", "") + fileparse("/foo/bar/baz/"); + +If @suffixes are given each element is a pattern (either a string or a +C<qr//>) matched against the end of the $filename. The matching +portion is removed and becomes the $suffix. + + # On Unix returns ("baz", "/foo/bar/", ".txt") + fileparse("/foo/bar/baz.txt", qr/\.[^.]*/); + +If type is non-Unix (see L</fileparse_set_fstype>) then the pattern +matching for suffix removal is performed case-insensitively, since +those systems are not case-sensitive when opening existing files. + +You are guaranteed that C<$dirs . $filename . $suffix> will +denote the same location as the original $path. + +=cut + + +sub fileparse { + my($fullname,@suffices) = @_; + + unless (defined $fullname) { + require Carp; + Carp::croak("fileparse(): need a valid pathname"); + } + + my $orig_type = ''; + my($type,$igncase) = ($Fileparse_fstype, $Fileparse_igncase); + + my($taint) = substr($fullname,0,0); # Is $fullname tainted? + + if ($type eq "VMS" and $fullname =~ m{/} ) { + # We're doing Unix emulation + $orig_type = $type; + $type = 'Unix'; + } + + my($dirpath, $basename); + + if (grep { $type eq $_ } qw(MSDOS DOS MSWin32 Epoc)) { + ($dirpath,$basename) = ($fullname =~ /^((?:.*[:\\\/])?)(.*)/s); + $dirpath .= '.\\' unless $dirpath =~ /[\\\/]\z/; + } + elsif ($type eq "OS2") { + ($dirpath,$basename) = ($fullname =~ m#^((?:.*[:\\/])?)(.*)#s); + $dirpath = './' unless $dirpath; # Can't be 0 + $dirpath .= '/' unless $dirpath =~ m#[\\/]\z#; + } + elsif ($type eq "MacOS") { + ($dirpath,$basename) = ($fullname =~ /^(.*:)?(.*)/s); + $dirpath = ':' unless $dirpath; + } + elsif ($type eq "AmigaOS") { + ($dirpath,$basename) = ($fullname =~ /(.*[:\/])?(.*)/s); + $dirpath = './' unless $dirpath; + } + elsif ($type eq 'VMS' ) { + ($dirpath,$basename) = ($fullname =~ /^(.*[:>\]])?(.*)/s); + $dirpath ||= ''; # should always be defined + } + else { # Default to Unix semantics. + ($dirpath,$basename) = ($fullname =~ m{^(.*/)?(.*)}s); + if ($orig_type eq 'VMS' and $fullname =~ m{^(/[^/]+/000000(/|$))(.*)}) { + # dev:[000000] is top of VMS tree, similar to Unix '/' + # so strip it off and treat the rest as "normal" + my $devspec = $1; + my $remainder = $3; + ($dirpath,$basename) = ($remainder =~ m{^(.*/)?(.*)}s); + $dirpath ||= ''; # should always be defined + $dirpath = $devspec.$dirpath; + } + $dirpath = './' unless $dirpath; + } + + + my $tail = ''; + my $suffix = ''; + if (@suffices) { + foreach $suffix (@suffices) { + my $pat = ($igncase ? '(?i)' : '') . "($suffix)\$"; + if ($basename =~ s/$pat//s) { + $taint .= substr($suffix,0,0); + $tail = $1 . $tail; + } + } + } + + # Ensure taint is propagated from the path to its pieces. + $tail .= $taint; + wantarray ? ($basename .= $taint, $dirpath .= $taint, $tail) + : ($basename .= $taint); +} + + + +=item C<basename> +X<basename> X<filename> + + my $filename = basename($path); + my $filename = basename($path, @suffixes); + +This function is provided for compatibility with the Unix shell command +C<basename(1)>. It does B<NOT> always return the file name portion of a +path as you might expect. To be safe, if you want the file name portion of +a path use C<fileparse()>. + +C<basename()> returns the last level of a filepath even if the last +level is clearly directory. In effect, it is acting like C<pop()> for +paths. This differs from C<fileparse()>'s behaviour. + + # Both return "bar" + basename("/foo/bar"); + basename("/foo/bar/"); + +@suffixes work as in C<fileparse()> except all regex metacharacters are +quoted. + + # These two function calls are equivalent. + my $filename = basename("/foo/bar/baz.txt", ".txt"); + my $filename = fileparse("/foo/bar/baz.txt", qr/\Q.txt\E/); + +Also note that in order to be compatible with the shell command, +C<basename()> does not strip off a suffix if it is identical to the +remaining characters in the filename. + +=cut + + +sub basename { + my($path) = shift; + + # From BSD basename(1) + # The basename utility deletes any prefix ending with the last slash '/' + # character present in string (after first stripping trailing slashes) + _strip_trailing_sep($path); + + my($basename, $dirname, $suffix) = fileparse( $path, map("\Q$_\E",@_) ); + + # From BSD basename(1) + # The suffix is not stripped if it is identical to the remaining + # characters in string. + if( length $suffix and !length $basename ) { + $basename = $suffix; + } + + # Ensure that basename '/' == '/' + if( !length $basename ) { + $basename = $dirname; + } + + return $basename; +} + + + +=item C<dirname> +X<dirname> + +This function is provided for compatibility with the Unix shell +command C<dirname(1)> and has inherited some of its quirks. In spite of +its name it does B<NOT> always return the directory name as you might +expect. To be safe, if you want the directory name of a path use +C<fileparse()>. + +Only on VMS (where there is no ambiguity between the file and directory +portions of a path) and AmigaOS (possibly due to an implementation quirk in +this module) does C<dirname()> work like C<fileparse($path)>, returning just the +$dirs. + + # On VMS and AmigaOS + my $dirs = dirname($path); + +When using Unix or MSDOS syntax this emulates the C<dirname(1)> shell function +which is subtly different from how C<fileparse()> works. It returns all but +the last level of a file path even if the last level is clearly a directory. +In effect, it is not returning the directory portion but simply the path one +level up acting like C<chop()> for file paths. + +Also unlike C<fileparse()>, C<dirname()> does not include a trailing slash on +its returned path. + + # returns /foo/bar. fileparse() would return /foo/bar/ + dirname("/foo/bar/baz"); + + # also returns /foo/bar despite the fact that baz is clearly a + # directory. fileparse() would return /foo/bar/baz/ + dirname("/foo/bar/baz/"); + + # returns '.'. fileparse() would return 'foo/' + dirname("foo/"); + +Under VMS, if there is no directory information in the $path, then the +current default device and directory is used. + +=cut + + +sub dirname { + my $path = shift; + + my($type) = $Fileparse_fstype; + + if( $type eq 'VMS' and $path =~ m{/} ) { + # Parse as Unix + local($File::Basename::Fileparse_fstype) = ''; + return dirname($path); + } + + my($basename, $dirname) = fileparse($path); + + if ($type eq 'VMS') { + $dirname ||= $ENV{DEFAULT}; + } + elsif ($type eq 'MacOS') { + if( !length($basename) && $dirname !~ /^[^:]+:\z/) { + _strip_trailing_sep($dirname); + ($basename,$dirname) = fileparse $dirname; + } + $dirname .= ":" unless $dirname =~ /:\z/; + } + elsif (grep { $type eq $_ } qw(MSDOS DOS MSWin32 OS2)) { + _strip_trailing_sep($dirname); + unless( length($basename) ) { + ($basename,$dirname) = fileparse $dirname; + _strip_trailing_sep($dirname); + } + } + elsif ($type eq 'AmigaOS') { + if ( $dirname =~ /:\z/) { return $dirname } + chop $dirname; + $dirname =~ s{[^:/]+\z}{} unless length($basename); + } + else { + _strip_trailing_sep($dirname); + unless( length($basename) ) { + ($basename,$dirname) = fileparse $dirname; + _strip_trailing_sep($dirname); + } + } + + $dirname; +} + + +# Strip the trailing path separator. +sub _strip_trailing_sep { + my $type = $Fileparse_fstype; + + if ($type eq 'MacOS') { + $_[0] =~ s/([^:]):\z/$1/s; + } + elsif (grep { $type eq $_ } qw(MSDOS DOS MSWin32 OS2)) { + $_[0] =~ s/([^:])[\\\/]*\z/$1/; + } + else { + $_[0] =~ s{(.)/*\z}{$1}s; + } +} + + +=item C<fileparse_set_fstype> +X<filesystem> + + my $type = fileparse_set_fstype(); + my $previous_type = fileparse_set_fstype($type); + +Normally File::Basename will assume a file path type native to your current +operating system (ie. /foo/bar style on Unix, \foo\bar on Windows, etc...). +With this function you can override that assumption. + +Valid $types are "MacOS", "VMS", "AmigaOS", "OS2", "RISCOS", +"MSWin32", "DOS" (also "MSDOS" for backwards bug compatibility), +"Epoc" and "Unix" (all case-insensitive). If an unrecognized $type is +given "Unix" will be assumed. + +If you've selected VMS syntax, and the file specification you pass to +one of these routines contains a "/", they assume you are using Unix +emulation and apply the Unix syntax rules instead, for that function +call only. + +=back + +=cut + + +BEGIN { + +my @Ignore_Case = qw(MacOS VMS AmigaOS OS2 RISCOS MSWin32 MSDOS DOS Epoc); +my @Types = (@Ignore_Case, qw(Unix)); + +sub fileparse_set_fstype { + my $old = $Fileparse_fstype; + + if (@_) { + my $new_type = shift; + + $Fileparse_fstype = 'Unix'; # default + foreach my $type (@Types) { + $Fileparse_fstype = $type if $new_type =~ /^$type/i; + } + + $Fileparse_igncase = + (grep $Fileparse_fstype eq $_, @Ignore_Case) ? 1 : 0; + } + + return $old; +} + +} + + +1; + + +=head1 SEE ALSO + +L<dirname(1)>, L<basename(1)>, L<File::Spec> diff --git a/data/miniconda3/lib/perl5/core_perl/File/Compare.pm b/data/miniconda3/lib/perl5/core_perl/File/Compare.pm new file mode 100644 index 0000000000000000000000000000000000000000..05e1c41d211b4ed987c2139ddaa4269674574c06 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Compare.pm @@ -0,0 +1,182 @@ +package File::Compare; + +use 5.006; +use strict; +use warnings; +our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Too_Big); + +require Exporter; + +$VERSION = '1.1006'; +@ISA = qw(Exporter); +@EXPORT = qw(compare); +@EXPORT_OK = qw(cmp compare_text); + +$Too_Big = 1024 * 1024 * 2; + +sub croak { + require Carp; + goto &Carp::croak; +} + +sub compare { + croak("Usage: compare( file1, file2 [, buffersize]) ") + unless(@_ == 2 || @_ == 3); + + my ($from,$to,$size) = @_; + my $text_mode = defined($size) && (ref($size) eq 'CODE' || $size < 0); + + my ($fromsize,$closefrom,$closeto); + local (*FROM, *TO); + + croak("from undefined") unless (defined $from); + croak("to undefined") unless (defined $to); + + if (ref($from) && + (UNIVERSAL::isa($from,'GLOB') || UNIVERSAL::isa($from,'IO::Handle'))) { + *FROM = *$from; + } elsif (ref(\$from) eq 'GLOB') { + *FROM = $from; + } else { + open(FROM,"<",$from) or goto fail_open1; + unless ($text_mode) { + binmode FROM; + $fromsize = -s FROM; + } + $closefrom = 1; + } + + if (ref($to) && + (UNIVERSAL::isa($to,'GLOB') || UNIVERSAL::isa($to,'IO::Handle'))) { + *TO = *$to; + } elsif (ref(\$to) eq 'GLOB') { + *TO = $to; + } else { + open(TO,"<",$to) or goto fail_open2; + binmode TO unless $text_mode; + $closeto = 1; + } + + if (!$text_mode && $closefrom && $closeto) { + # If both are opened files we know they differ if their size differ + goto fail_inner if $fromsize != -s TO; + } + + if ($text_mode) { + local $/ = "\n"; + my ($fline,$tline); + while (defined($fline = <FROM>)) { + goto fail_inner unless defined($tline = <TO>); + if (ref $size) { + # $size contains ref to comparison function + goto fail_inner if &$size($fline, $tline); + } else { + goto fail_inner if $fline ne $tline; + } + } + goto fail_inner if defined($tline = <TO>); + } + else { + unless (defined($size) && $size > 0) { + $size = $fromsize || -s TO || 0; + $size = 1024 if $size < 512; + $size = $Too_Big if $size > $Too_Big; + } + + my ($fr,$tr,$fbuf,$tbuf); + $fbuf = $tbuf = ''; + while(defined($fr = read(FROM,$fbuf,$size)) && $fr > 0) { + unless (defined($tr = read(TO,$tbuf,$fr)) && $tbuf eq $fbuf) { + goto fail_inner; + } + } + goto fail_inner if defined($tr = read(TO,$tbuf,$size)) && $tr > 0; + } + + close(TO) || goto fail_open2 if $closeto; + close(FROM) || goto fail_open1 if $closefrom; + + return 0; + + # All of these contortions try to preserve error messages... + fail_inner: + close(TO) || goto fail_open2 if $closeto; + close(FROM) || goto fail_open1 if $closefrom; + + return 1; + + fail_open2: + if ($closefrom) { + my $status = $!; + $! = 0; + close FROM; + $! = $status unless $!; + } + fail_open1: + return -1; +} + +sub cmp; +*cmp = \&compare; + +sub compare_text { + my ($from,$to,$cmp) = @_; + croak("Usage: compare_text( file1, file2 [, cmp-function])") + unless @_ == 2 || @_ == 3; + croak("Third arg to compare_text() function must be a code reference") + if @_ == 3 && ref($cmp) ne 'CODE'; + + # Using a negative buffer size puts compare into text_mode too + $cmp = -1 unless defined $cmp; + compare($from, $to, $cmp); +} + +1; + +__END__ + +=head1 NAME + +File::Compare - Compare files or filehandles + +=head1 SYNOPSIS + + use File::Compare; + + if (compare("file1","file2") == 0) { + print "They're equal\n"; + } + +=head1 DESCRIPTION + +The File::Compare::compare function compares the contents of two +sources, each of which can be a file or a file handle. It is exported +from File::Compare by default. + +File::Compare::cmp is a synonym for File::Compare::compare. It is +exported from File::Compare only by request. + +File::Compare::compare_text does a line by line comparison of the two +files. It stops as soon as a difference is detected. compare_text() +accepts an optional third argument: This must be a CODE reference to +a line comparison function, which returns 0 when both lines are considered +equal. For example: + + compare_text($file1, $file2) + +is basically equivalent to + + compare_text($file1, $file2, sub {$_[0] ne $_[1]} ) + +=head1 RETURN + +File::Compare::compare and its sibling functions return 0 if the files +are equal, 1 if the files are unequal, or -1 if an error was encountered. + +=head1 AUTHOR + +File::Compare was written by Nick Ing-Simmons. +Its original documentation was written by Chip Salzenberg. + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/File/Copy.pm b/data/miniconda3/lib/perl5/core_perl/File/Copy.pm new file mode 100644 index 0000000000000000000000000000000000000000..63609cc28e6300d52cfa306c862e56c80d908808 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Copy.pm @@ -0,0 +1,513 @@ +# File/Copy.pm. Written in 1994 by Aaron Sherman <ajs@ajs.com>. This +# source code has been placed in the public domain by the author. +# Please be kind and preserve the documentation. +# +# Additions copyright 1996 by Charles Bailey. Permission is granted +# to distribute the revised code under the same terms as Perl itself. + +package File::Copy; + +use 5.006; +use strict; +use warnings; no warnings 'newline'; +use File::Spec; +use Config; +# During perl build, we need File::Copy but Scalar::Util might not be built yet +# And then we need these games to avoid loading overload, as that will +# confuse miniperl during the bootstrap of perl. +my $Scalar_Util_loaded = eval q{ require Scalar::Util; require overload; 1 }; +# We want HiRes stat and utime if available +BEGIN { eval q{ use Time::HiRes qw( stat utime ) } }; +our(@ISA, @EXPORT, @EXPORT_OK, $VERSION, $Too_Big, $Syscopy_is_copy); +sub copy; +sub syscopy; +sub cp; +sub mv; + +$VERSION = '2.34'; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(copy move); +@EXPORT_OK = qw(cp mv); + +$Too_Big = 1024 * 1024 * 2; + +sub croak { + require Carp; + goto &Carp::croak; +} + +sub carp { + require Carp; + goto &Carp::carp; +} + +sub _catname { + my($from, $to) = @_; + if (not defined &basename) { + require File::Basename; + import File::Basename 'basename'; + } + + return File::Spec->catfile($to, basename($from)); +} + +# _eq($from, $to) tells whether $from and $to are identical +sub _eq { + my ($from, $to) = map { + $Scalar_Util_loaded && Scalar::Util::blessed($_) + && overload::Method($_, q{""}) + ? "$_" + : $_ + } (@_); + return '' if ( (ref $from) xor (ref $to) ); + return $from == $to if ref $from; + return $from eq $to; +} + +sub copy { + croak("Usage: copy(FROM, TO [, BUFFERSIZE]) ") + unless(@_ == 2 || @_ == 3); + + my $from = shift; + my $to = shift; + + my $size; + if (@_) { + $size = shift(@_) + 0; + croak("Bad buffer size for copy: $size\n") unless ($size > 0); + } + + my $from_a_handle = (ref($from) + ? (ref($from) eq 'GLOB' + || UNIVERSAL::isa($from, 'GLOB') + || UNIVERSAL::isa($from, 'IO::Handle')) + : (ref(\$from) eq 'GLOB')); + my $to_a_handle = (ref($to) + ? (ref($to) eq 'GLOB' + || UNIVERSAL::isa($to, 'GLOB') + || UNIVERSAL::isa($to, 'IO::Handle')) + : (ref(\$to) eq 'GLOB')); + + if (_eq($from, $to)) { # works for references, too + carp("'$from' and '$to' are identical (not copied)"); + return 0; + } + + if (!$from_a_handle && !$to_a_handle && -d $to && ! -d $from) { + $to = _catname($from, $to); + } + + if ((($Config{d_symlink} && $Config{d_readlink}) || $Config{d_link}) && + !($^O eq 'MSWin32' || $^O eq 'os2')) { + my @fs = stat($from); + if (@fs) { + my @ts = stat($to); + if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1] && !-p $from) { + carp("'$from' and '$to' are identical (not copied)"); + return 0; + } + } + } + elsif (_eq($from, $to)) { + carp("'$from' and '$to' are identical (not copied)"); + return 0; + } + + if (defined &syscopy && !$Syscopy_is_copy + && !$to_a_handle + && !($from_a_handle && $^O eq 'os2' ) # OS/2 cannot handle handles + && !($from_a_handle && $^O eq 'MSWin32') + && !($from_a_handle && $^O eq 'NetWare') + ) + { + if ($^O eq 'VMS' && -e $from + && ! -d $to && ! -d $from) { + + # VMS natively inherits path components from the source of a + # copy, but we want the Unixy behavior of inheriting from + # the current working directory. Also, default in a trailing + # dot for null file types. + + $to = VMS::Filespec::rmsexpand(VMS::Filespec::vmsify($to), '.'); + + # Get rid of the old versions to be like UNIX + 1 while unlink $to; + } + + return syscopy($from, $to) || 0; + } + + my $closefrom = 0; + my $closeto = 0; + my ($status, $r, $buf); + local($\) = ''; + + my $from_h; + if ($from_a_handle) { + $from_h = $from; + } else { + open $from_h, "<", $from or goto fail_open1; + binmode $from_h or die "($!,$^E)"; + $closefrom = 1; + } + + # Seems most logical to do this here, in case future changes would want to + # make this croak for some reason. + unless (defined $size) { + $size = tied(*$from_h) ? 0 : -s $from_h || 0; + $size = 1024 if ($size < 512); + $size = $Too_Big if ($size > $Too_Big); + } + + my $to_h; + if ($to_a_handle) { + $to_h = $to; + } else { + $to_h = \do { local *FH }; # XXX is this line obsolete? + open $to_h, ">", $to or goto fail_open2; + binmode $to_h or die "($!,$^E)"; + $closeto = 1; + } + + $! = 0; + for (;;) { + my ($r, $w, $t); + defined($r = sysread($from_h, $buf, $size)) + or goto fail_inner; + last unless $r; + for ($w = 0; $w < $r; $w += $t) { + $t = syswrite($to_h, $buf, $r - $w, $w) + or goto fail_inner; + } + } + + close($to_h) || goto fail_open2 if $closeto; + close($from_h) || goto fail_open1 if $closefrom; + + # Use this idiom to avoid uninitialized value warning. + return 1; + + # All of these contortions try to preserve error messages... + fail_inner: + if ($closeto) { + $status = $!; + $! = 0; + close $to_h; + $! = $status unless $!; + } + fail_open2: + if ($closefrom) { + $status = $!; + $! = 0; + close $from_h; + $! = $status unless $!; + } + fail_open1: + return 0; +} + +sub cp { + my($from,$to) = @_; + my(@fromstat) = stat $from; + my(@tostat) = stat $to; + my $perm; + + return 0 unless copy(@_) and @fromstat; + + if (@tostat) { + $perm = $tostat[2]; + } else { + $perm = $fromstat[2] & ~(umask || 0); + @tostat = stat $to; + } + # Might be more robust to look for S_I* in Fcntl, but we're + # trying to avoid dependence on any XS-containing modules, + # since File::Copy is used during the Perl build. + $perm &= 07777; + if ($perm & 06000) { + croak("Unable to check setuid/setgid permissions for $to: $!") + unless @tostat; + + if ($perm & 04000 and # setuid + $fromstat[4] != $tostat[4]) { # owner must match + $perm &= ~06000; + } + + if ($perm & 02000 && $> != 0) { # if not root, setgid + my $ok = $fromstat[5] == $tostat[5]; # group must match + if ($ok) { # and we must be in group + $ok = grep { $_ == $fromstat[5] } split /\s+/, $) + } + $perm &= ~06000 unless $ok; + } + } + return 0 unless @tostat; + return 1 if $perm == ($tostat[2] & 07777); + return eval { chmod $perm, $to; } ? 1 : 0; +} + +sub _move { + croak("Usage: move(FROM, TO) ") unless @_ == 3; + + my($from,$to,$fallback) = @_; + + my($fromsz,$tosz1,$tomt1,$tosz2,$tomt2,$sts,$ossts); + + if (-d $to && ! -d $from) { + $to = _catname($from, $to); + } + + ($tosz1,$tomt1) = (stat($to))[7,9]; + $fromsz = -s $from; + if ($^O eq 'os2' and defined $tosz1 and defined $fromsz) { + # will not rename with overwrite + unlink $to; + } + + if ($^O eq 'VMS' && -e $from + && ! -d $to && ! -d $from) { + + # VMS natively inherits path components from the source of a + # copy, but we want the Unixy behavior of inheriting from + # the current working directory. Also, default in a trailing + # dot for null file types. + + $to = VMS::Filespec::rmsexpand(VMS::Filespec::vmsify($to), '.'); + + # Get rid of the old versions to be like UNIX + 1 while unlink $to; + } + + return 1 if rename $from, $to; + + # Did rename return an error even though it succeeded, because $to + # is on a remote NFS file system, and NFS lost the server's ack? + return 1 if defined($fromsz) && !-e $from && # $from disappeared + (($tosz2,$tomt2) = (stat($to))[7,9]) && # $to's there + ((!defined $tosz1) || # not before or + ($tosz1 != $tosz2 or $tomt1 != $tomt2)) && # was changed + $tosz2 == $fromsz; # it's all there + + ($tosz1,$tomt1) = (stat($to))[7,9]; # just in case rename did something + + { + local $@; + eval { + local $SIG{__DIE__}; + $fallback->($from,$to) or die; + my($atime, $mtime) = (stat($from))[8,9]; + utime($atime, $mtime, $to); + unlink($from) or die; + }; + return 1 unless $@; + } + ($sts,$ossts) = ($! + 0, $^E + 0); + + ($tosz2,$tomt2) = ((stat($to))[7,9],0,0) if defined $tomt1; + unlink($to) if !defined($tomt1) or $tomt1 != $tomt2 or $tosz1 != $tosz2; + ($!,$^E) = ($sts,$ossts); + return 0; +} + +sub move { _move(@_,\©); } +sub mv { _move(@_,\&cp); } + +# &syscopy is an XSUB under OS/2 +unless (defined &syscopy) { + if ($^O eq 'VMS') { + *syscopy = \&rmscopy; + } elsif ($^O eq 'MSWin32' && defined &DynaLoader::boot_DynaLoader) { + # Win32::CopyFile() fill only work if we can load Win32.xs + *syscopy = sub { + return 0 unless @_ == 2; + return Win32::CopyFile(@_, 1); + }; + } else { + $Syscopy_is_copy = 1; + *syscopy = \© + } +} + +1; + +__END__ + +=head1 NAME + +File::Copy - Copy files or filehandles + +=head1 SYNOPSIS + + use File::Copy; + + copy("sourcefile","destinationfile") or die "Copy failed: $!"; + copy("Copy.pm",\*STDOUT); + move("/dev1/sourcefile","/dev2/destinationfile"); + + use File::Copy "cp"; + + $n = FileHandle->new("/a/file","r"); + cp($n,"x"); + +=head1 DESCRIPTION + +The File::Copy module provides two basic functions, C<copy> and +C<move>, which are useful for getting the contents of a file from +one place to another. + +=over 4 + +=item copy +X<copy> X<cp> + +The C<copy> function takes two +parameters: a file to copy from and a file to copy to. Either +argument may be a string, a FileHandle reference or a FileHandle +glob. Obviously, if the first argument is a filehandle of some +sort, it will be read from, and if it is a file I<name> it will +be opened for reading. Likewise, the second argument will be +written to. If the second argument does not exist but the parent +directory does exist, then it will be created. Trying to copy +a file into a non-existent directory is an error. +Trying to copy a file on top of itself is also an error. +C<copy> will not overwrite read-only files. + +If the destination (second argument) already exists and is a directory, +and the source (first argument) is not a filehandle, then the source +file will be copied into the directory specified by the destination, +using the same base name as the source file. It's a failure to have a +filehandle as the source when the destination is a directory. + +B<Note that passing in +files as handles instead of names may lead to loss of information +on some operating systems; it is recommended that you use file +names whenever possible.> Files are opened in binary mode where +applicable. To get a consistent behaviour when copying from a +filehandle to a file, use C<binmode> on the filehandle. + +An optional third parameter can be used to specify the buffer +size used for copying. This is the number of bytes from the +first file, that will be held in memory at any given time, before +being written to the second file. The default buffer size depends +upon the file, but will generally be the whole file (up to 2MB), or +1k for filehandles that do not reference files (eg. sockets). + +You may use the syntax C<use File::Copy "cp"> to get at the C<cp> +alias for this function. The syntax is I<exactly> the same. The +behavior is nearly the same as well: as of version 2.15, C<cp> will +preserve the source file's permission bits like the shell utility +C<cp(1)> would do, while C<copy> uses the default permissions for the +target file (which may depend on the process' C<umask>, file +ownership, inherited ACLs, etc.). If an error occurs in setting +permissions, C<cp> will return 0, regardless of whether the file was +successfully copied. + +=item move +X<move> X<mv> X<rename> + +The C<move> function also takes two parameters: the current name +and the intended name of the file to be moved. If the destination +already exists and is a directory, and the source is not a +directory, then the source file will be renamed into the directory +specified by the destination. + +If possible, move() will simply rename the file. Otherwise, it copies +the file to the new location and deletes the original. If an error occurs +during this copy-and-delete process, you may be left with a (possibly partial) +copy of the file under the destination name. + +You may use the C<mv> alias for this function in the same way that +you may use the C<cp> alias for C<copy>. + +=item syscopy +X<syscopy> + +File::Copy also provides the C<syscopy> routine, which copies the +file specified in the first parameter to the file specified in the +second parameter, preserving OS-specific attributes and file +structure. For Unix systems, this is equivalent to the simple +C<copy> routine, which doesn't preserve OS-specific attributes. For +VMS systems, this calls the C<rmscopy> routine (see below). For OS/2 +systems, this calls the C<syscopy> XSUB directly. For Win32 systems, +this calls C<Win32::CopyFile>. + +B<Special behaviour if C<syscopy> is defined (OS/2, VMS and Win32)>: + +If both arguments to C<copy> are not file handles, +then C<copy> will perform a "system copy" of +the input file to a new output file, in order to preserve file +attributes, indexed file structure, I<etc.> The buffer size +parameter is ignored. If either argument to C<copy> is a +handle to an opened file, then data is copied using Perl +operators, and no effort is made to preserve file attributes +or record structure. + +The system copy routine may also be called directly under VMS and OS/2 +as C<File::Copy::syscopy> (or under VMS as C<File::Copy::rmscopy>, which +is the routine that does the actual work for syscopy). + +=item rmscopy($from,$to[,$date_flag]) +X<rmscopy> + +The first and second arguments may be strings, typeglobs, typeglob +references, or objects inheriting from IO::Handle; +they are used in all cases to obtain the +I<filespec> of the input and output files, respectively. The +name and type of the input file are used as defaults for the +output file, if necessary. + +A new version of the output file is always created, which +inherits the structure and RMS attributes of the input file, +except for owner and protections (and possibly timestamps; +see below). All data from the input file is copied to the +output file; if either of the first two parameters to C<rmscopy> +is a file handle, its position is unchanged. (Note that this +means a file handle pointing to the output file will be +associated with an old version of that file after C<rmscopy> +returns, not the newly created version.) + +The third parameter is an integer flag, which tells C<rmscopy> +how to handle timestamps. If it is E<lt> 0, none of the input file's +timestamps are propagated to the output file. If it is E<gt> 0, then +it is interpreted as a bitmask: if bit 0 (the LSB) is set, then +timestamps other than the revision date are propagated; if bit 1 +is set, the revision date is propagated. If the third parameter +to C<rmscopy> is 0, then it behaves much like the DCL COPY command: +if the name or type of the output file was explicitly specified, +then no timestamps are propagated, but if they were taken implicitly +from the input filespec, then all timestamps other than the +revision date are propagated. If this parameter is not supplied, +it defaults to 0. + +C<rmscopy> is VMS specific and cannot be exported; it must be +referenced by its full name, e.g.: + + File::Copy::rmscopy($from, $to) or die $!; + +Like C<copy>, C<rmscopy> returns 1 on success. If an error occurs, +it sets C<$!>, deletes the output file, and returns 0. + +=back + +=head1 RETURN + +All functions return 1 on success, 0 on failure. +$! will be set if an error was encountered. + +=head1 NOTES + +Before calling copy() or move() on a filehandle, the caller should +close or flush() the file to avoid writes being lost. Note that this +is the case even for move(), because it may actually copy the file, +depending on the OS-specific implementation, and the underlying +filesystem(s). + +=head1 AUTHOR + +File::Copy was written by Aaron Sherman I<E<lt>ajs@ajs.comE<gt>> in 1995, +and updated by Charles Bailey I<E<lt>bailey@newman.upenn.eduE<gt>> in 1996. + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/File/Fetch.pm b/data/miniconda3/lib/perl5/core_perl/File/Fetch.pm new file mode 100644 index 0000000000000000000000000000000000000000..90c62e96bee43728709ffcb625834b59a309e8c8 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Fetch.pm @@ -0,0 +1,1731 @@ +package File::Fetch; + +use strict; +use FileHandle; +use File::Temp; +use File::Copy; +use File::Spec; +use File::Spec::Unix; +use File::Basename qw[dirname]; + +use Cwd qw[cwd]; +use Carp qw[carp]; +use IPC::Cmd qw[can_run run QUOTE]; +use File::Path qw[mkpath]; +use File::Temp qw[tempdir]; +use Params::Check qw[check]; +use Module::Load::Conditional qw[can_load]; +use Locale::Maketext::Simple Style => 'gettext'; + +use vars qw[ $VERBOSE $PREFER_BIN $FROM_EMAIL $USER_AGENT + $BLACKLIST $METHOD_FAIL $VERSION $METHODS + $FTP_PASSIVE $TIMEOUT $DEBUG $WARN $FORCEIPV4 + ]; + +$VERSION = '0.56'; +$VERSION = eval $VERSION; # avoid warnings with development releases +$PREFER_BIN = 0; # XXX TODO implement +$FROM_EMAIL = 'File-Fetch@example.com'; +$USER_AGENT = "File::Fetch/$VERSION"; +$BLACKLIST = [qw|ftp|]; +push @$BLACKLIST, qw|lftp| if $^O eq 'dragonfly' || $^O eq 'hpux'; +$METHOD_FAIL = { }; +$FTP_PASSIVE = 1; +$TIMEOUT = 0; +$DEBUG = 0; +$WARN = 1; +$FORCEIPV4 = 0; + +### methods available to fetch the file depending on the scheme +$METHODS = { + http => [ qw|lwp httptiny wget curl lftp fetch httplite lynx iosock| ], + https => [ qw|lwp wget curl| ], + ftp => [ qw|lwp netftp wget curl lftp fetch ncftp ftp| ], + file => [ qw|lwp lftp file| ], + rsync => [ qw|rsync| ], + git => [ qw|git| ], +}; + +### silly warnings ### +local $Params::Check::VERBOSE = 1; +local $Params::Check::VERBOSE = 1; +local $Module::Load::Conditional::VERBOSE = 0; +local $Module::Load::Conditional::VERBOSE = 0; + +### Fix CVE-2016-1238 ### +local $Module::Load::Conditional::FORCE_SAFE_INC = 1; + +### see what OS we are on, important for file:// uris ### +use constant ON_WIN => ($^O eq 'MSWin32'); +use constant ON_VMS => ($^O eq 'VMS'); +use constant ON_UNIX => (!ON_WIN); +use constant HAS_VOL => (ON_WIN); +use constant HAS_SHARE => (ON_WIN); +use constant HAS_FETCH => ( $^O =~ m!^(freebsd|netbsd|dragonfly)$! ); + +=pod + +=head1 NAME + +File::Fetch - A generic file fetching mechanism + +=head1 SYNOPSIS + + use File::Fetch; + + ### build a File::Fetch object ### + my $ff = File::Fetch->new(uri => 'http://some.where.com/dir/a.txt'); + + ### fetch the uri to cwd() ### + my $where = $ff->fetch() or die $ff->error; + + ### fetch the uri to /tmp ### + my $where = $ff->fetch( to => '/tmp' ); + + ### parsed bits from the uri ### + $ff->uri; + $ff->scheme; + $ff->host; + $ff->path; + $ff->file; + +=head1 DESCRIPTION + +File::Fetch is a generic file fetching mechanism. + +It allows you to fetch any file pointed to by a C<ftp>, C<http>, +C<file>, C<git> or C<rsync> uri by a number of different means. + +See the C<HOW IT WORKS> section further down for details. + +=head1 ACCESSORS + +A C<File::Fetch> object has the following accessors + +=over 4 + +=item $ff->uri + +The uri you passed to the constructor + +=item $ff->scheme + +The scheme from the uri (like 'file', 'http', etc) + +=item $ff->host + +The hostname in the uri. Will be empty if host was originally +'localhost' for a 'file://' url. + +=item $ff->vol + +On operating systems with the concept of a volume the second element +of a file:// is considered to the be volume specification for the file. +Thus on Win32 this routine returns the volume, on other operating +systems this returns nothing. + +On Windows this value may be empty if the uri is to a network share, in +which case the 'share' property will be defined. Additionally, volume +specifications that use '|' as ':' will be converted on read to use ':'. + +On VMS, which has a volume concept, this field will be empty because VMS +file specifications are converted to absolute UNIX format and the volume +information is transparently included. + +=item $ff->share + +On systems with the concept of a network share (currently only Windows) returns +the sharename from a file://// url. On other operating systems returns empty. + +=item $ff->path + +The path from the uri, will be at least a single '/'. + +=item $ff->file + +The name of the remote file. For the local file name, the +result of $ff->output_file will be used. + +=item $ff->file_default + +The name of the default local file, that $ff->output_file falls back to if +it would otherwise return no filename. For example when fetching a URI like +http://www.abc.net.au/ the contents retrieved may be from a remote file called +'index.html'. The default value of this attribute is literally 'file_default'. + +=cut + + +########################## +### Object & Accessors ### +########################## + +{ + ### template for autogenerated accessors ### + my $Tmpl = { + scheme => { default => 'http' }, + host => { default => 'localhost' }, + path => { default => '/' }, + file => { required => 1 }, + uri => { required => 1 }, + userinfo => { default => '' }, + vol => { default => '' }, # windows for file:// uris + share => { default => '' }, # windows for file:// uris + file_default => { default => 'file_default' }, + tempdir_root => { required => 1 }, # Should be lazy-set at ->new() + _error_msg => { no_override => 1 }, + _error_msg_long => { no_override => 1 }, + }; + + for my $method ( keys %$Tmpl ) { + no strict 'refs'; + *$method = sub { + my $self = shift; + $self->{$method} = $_[0] if @_; + return $self->{$method}; + } + } + + sub _create { + my $class = shift; + my %hash = @_; + + my $args = check( $Tmpl, \%hash ) or return; + + bless $args, $class; + + if( lc($args->scheme) ne 'file' and not $args->host ) { + return $class->_error(loc( + "Hostname required when fetching from '%1'",$args->scheme)); + } + + for (qw[path]) { + unless( $args->$_() ) { # 5.5.x needs the () + return $class->_error(loc("No '%1' specified",$_)); + } + } + + return $args; + } +} + +=item $ff->output_file + +The name of the output file. This is the same as $ff->file, +but any query parameters are stripped off. For example: + + http://example.com/index.html?x=y + +would make the output file be C<index.html> rather than +C<index.html?x=y>. + +=back + +=cut + +sub output_file { + my $self = shift; + my $file = $self->file; + + $file =~ s/\?.*$//g; + + $file ||= $self->file_default; + + return $file; +} + +### XXX do this or just point to URI::Escape? +# =head2 $esc_uri = $ff->escaped_uri +# +# =cut +# +# ### most of this is stolen straight from URI::escape +# { ### Build a char->hex map +# my %escapes = map { chr($_) => sprintf("%%%02X", $_) } 0..255; +# +# sub escaped_uri { +# my $self = shift; +# my $uri = $self->uri; +# +# ### Default unsafe characters. RFC 2732 ^(uric - reserved) +# $uri =~ s/([^A-Za-z0-9\-_.!~*'()])/ +# $escapes{$1} || $self->_fail_hi($1)/ge; +# +# return $uri; +# } +# +# sub _fail_hi { +# my $self = shift; +# my $char = shift; +# +# $self->_error(loc( +# "Can't escape '%1', try using the '%2' module instead", +# sprintf("\\x{%04X}", ord($char)), 'URI::Escape' +# )); +# } +# +# sub output_file { +# +# } +# +# +# } + +=head1 METHODS + +=head2 $ff = File::Fetch->new( uri => 'http://some.where.com/dir/file.txt' ); + +Parses the uri and creates a corresponding File::Fetch::Item object, +that is ready to be C<fetch>ed and returns it. + +Returns false on failure. + +=cut + +sub new { + my $class = shift; + my %hash = @_; + + my ($uri, $file_default, $tempdir_root); + my $tmpl = { + uri => { required => 1, store => \$uri }, + file_default => { required => 0, store => \$file_default }, + tempdir_root => { required => 0, store => \$tempdir_root }, + }; + + check( $tmpl, \%hash ) or return; + + ### parse the uri to usable parts ### + my $href = $class->_parse_uri( $uri ) or return; + + $href->{file_default} = $file_default if $file_default; + $href->{tempdir_root} = File::Spec->rel2abs( $tempdir_root ) if $tempdir_root; + $href->{tempdir_root} = File::Spec->rel2abs( Cwd::cwd ) if not $href->{tempdir_root}; + + ### make it into a FFI object ### + my $ff = $class->_create( %$href ) or return; + + + ### return the object ### + return $ff; +} + +### parses an uri to a hash structure: +### +### $class->_parse_uri( 'ftp://ftp.cpan.org/pub/mirror/index.txt' ) +### +### becomes: +### +### $href = { +### scheme => 'ftp', +### host => 'ftp.cpan.org', +### path => '/pub/mirror', +### file => 'index.html' +### }; +### +### In the case of file:// urls there maybe be additional fields +### +### For systems with volume specifications such as Win32 there will be +### a volume specifier provided in the 'vol' field. +### +### 'vol' => 'volumename' +### +### For windows file shares there may be a 'share' key specified +### +### 'share' => 'sharename' +### +### Note that the rules of what a file:// url means vary by the operating system +### of the host being addressed. Thus file:///d|/foo/bar.txt means the obvious +### 'D:\foo\bar.txt' on windows, but on unix it means '/d|/foo/bar.txt' and +### not '/foo/bar.txt' +### +### Similarly if the host interpreting the url is VMS then +### file:///disk$user/my/notes/note12345.txt' means +### 'DISK$USER:[MY.NOTES]NOTE123456.TXT' but will be returned the same as +### if it is unix where it means /disk$user/my/notes/note12345.txt'. +### Except for some cases in the File::Spec methods, Perl on VMS will generally +### handle UNIX format file specifications. +### +### This means it is impossible to serve certain file:// urls on certain systems. +### +### Thus are the problems with a protocol-less specification. :-( +### + +sub _parse_uri { + my $self = shift; + my $uri = shift or return; + + my $href = { uri => $uri }; + + ### find the scheme ### + $uri =~ s|^(\w+)://||; + $href->{scheme} = $1; + + ### See rfc 1738 section 3.10 + ### http://www.faqs.org/rfcs/rfc1738.html + ### And wikipedia for more on windows file:// urls + ### http://en.wikipedia.org/wiki/File:// + if( $href->{scheme} eq 'file' ) { + + my @parts = split '/',$uri; + + ### file://hostname/... + ### file://hostname/... + ### normalize file://localhost with file:/// + $href->{host} = $parts[0] || ''; + + ### index in @parts where the path components begin; + my $index = 1; + + ### file:////hostname/sharename/blah.txt + if ( HAS_SHARE and not length $parts[0] and not length $parts[1] ) { + + $href->{host} = $parts[2] || ''; # avoid warnings + $href->{share} = $parts[3] || ''; # avoid warnings + + $index = 4 # index after the share + + ### file:///D|/blah.txt + ### file:///D:/blah.txt + } elsif (HAS_VOL) { + + ### this code comes from dmq's patch, but: + ### XXX if volume is empty, wouldn't that be an error? --kane + ### if so, our file://localhost test needs to be fixed as wel + $href->{vol} = $parts[1] || ''; + + ### correct D| style colume descriptors + $href->{vol} =~ s/\A([A-Z])\|\z/$1:/i if ON_WIN; + + $index = 2; # index after the volume + } + + ### rebuild the path from the leftover parts; + $href->{path} = join '/', '', splice( @parts, $index, $#parts ); + + } else { + ### using anything but qw() in hash slices may produce warnings + ### in older perls :-( + @{$href}{ qw(userinfo host path) } = $uri =~ m|(?:([^\@:]*:[^\:\@]*)@)?([^/]*)(/.*)$|s; + } + + ### split the path into file + dir ### + { my @parts = File::Spec::Unix->splitpath( delete $href->{path} ); + $href->{path} = $parts[1]; + $href->{file} = $parts[2]; + } + + ### host will be empty if the target was 'localhost' and the + ### scheme was 'file' + $href->{host} = '' if ($href->{host} eq 'localhost') and + ($href->{scheme} eq 'file'); + + return $href; +} + +=head2 $where = $ff->fetch( [to => /my/output/dir/ | \$scalar] ) + +Fetches the file you requested and returns the full path to the file. + +By default it writes to C<cwd()>, but you can override that by specifying +the C<to> argument: + + ### file fetch to /tmp, full path to the file in $where + $where = $ff->fetch( to => '/tmp' ); + + ### file slurped into $scalar, full path to the file in $where + ### file is downloaded to a temp directory and cleaned up at exit time + $where = $ff->fetch( to => \$scalar ); + +Returns the full path to the downloaded file on success, and false +on failure. + +=cut + +sub fetch { + my $self = shift or return; + my %hash = @_; + + my $target; + my $tmpl = { + to => { default => cwd(), store => \$target }, + }; + + check( $tmpl, \%hash ) or return; + + my ($to, $fh); + ### you want us to slurp the contents + if( ref $target and UNIVERSAL::isa( $target, 'SCALAR' ) ) { + $to = tempdir( 'FileFetch.XXXXXX', DIR => $self->tempdir_root, CLEANUP => 1 ); + + ### plain old fetch + } else { + $to = $target; + + ### On VMS force to VMS format so File::Spec will work. + $to = VMS::Filespec::vmspath($to) if ON_VMS; + + ### create the path if it doesn't exist yet ### + unless( -d $to ) { + eval { mkpath( $to ) }; + + return $self->_error(loc("Could not create path '%1'",$to)) if $@; + } + } + + ### set passive ftp if required ### + local $ENV{FTP_PASSIVE} = $FTP_PASSIVE; + + ### we dont use catfile on win32 because if we are using a cygwin tool + ### under cmd.exe they wont understand windows style separators. + my $out_to = ON_WIN ? $to.'/'.$self->output_file + : File::Spec->catfile( $to, $self->output_file ); + + for my $method ( @{ $METHODS->{$self->scheme} } ) { + my $sub = '_'.$method.'_fetch'; + + unless( __PACKAGE__->can($sub) ) { + $self->_error(loc("Cannot call method for '%1' -- WEIRD!", + $method)); + next; + } + + ### method is blacklisted ### + next if grep { lc $_ eq $method } @$BLACKLIST; + + ### method is known to fail ### + next if $METHOD_FAIL->{$method}; + + ### there's serious issues with IPC::Run and quoting of command + ### line arguments. using quotes in the wrong place breaks things, + ### and in the case of say, + ### C:\cygwin\bin\wget.EXE --quiet --passive-ftp --output-document + ### "index.html" "http://www.cpan.org/index.html?q=1&y=2" + ### it doesn't matter how you quote, it always fails. + local $IPC::Cmd::USE_IPC_RUN = 0; + + if( my $file = $self->$sub( + to => $out_to + )){ + + unless( -e $file && -s _ ) { + $self->_error(loc("'%1' said it fetched '%2', ". + "but it was not created",$method,$file)); + + ### mark the failure ### + $METHOD_FAIL->{$method} = 1; + + next; + + } else { + + ### slurp mode? + if( ref $target and UNIVERSAL::isa( $target, 'SCALAR' ) ) { + + ### open the file + open my $fh, "<$file" or do { + $self->_error( + loc("Could not open '%1': %2", $file, $!)); + return; + }; + + ### slurp + $$target = do { local $/; <$fh> }; + + } + + my $abs = File::Spec->rel2abs( $file ); + return $abs; + + } + } + } + + + ### if we got here, we looped over all methods, but we weren't able + ### to fetch it. + return; +} + +######################## +### _*_fetch methods ### +######################## + +### LWP fetching ### +sub _lwp_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### modules required to download with lwp ### + my $use_list = { + LWP => '0.0', + 'LWP::UserAgent' => '0.0', + 'HTTP::Request' => '0.0', + 'HTTP::Status' => '0.0', + URI => '0.0', + + }; + + if ($self->scheme eq 'https') { + $use_list->{'LWP::Protocol::https'} = '0'; + } + + unless( can_load( modules => $use_list ) ) { + $METHOD_FAIL->{'lwp'} = 1; + return; + } + + ### setup the uri object + my $uri = URI->new( File::Spec::Unix->catfile( + $self->path, $self->file + ) ); + + ### special rules apply for file:// uris ### + $uri->scheme( $self->scheme ); + $uri->host( $self->scheme eq 'file' ? '' : $self->host ); + + if ($self->userinfo) { + $uri->userinfo($self->userinfo); + } elsif ($self->scheme ne 'file') { + $uri->userinfo("anonymous:$FROM_EMAIL"); + } + + ### set up the useragent object + my $ua = LWP::UserAgent->new(); + $ua->timeout( $TIMEOUT ) if $TIMEOUT; + $ua->agent( $USER_AGENT ); + $ua->from( $FROM_EMAIL ); + $ua->env_proxy; + + my $res = $ua->mirror($uri, $to) or return; + + ### uptodate or fetched ok ### + if ( $res->code == 304 or $res->code == 200 ) { + return $to; + + } else { + return $self->_error(loc("Fetch failed! HTTP response: %1 %2 [%3]", + $res->code, HTTP::Status::status_message($res->code), + $res->status_line)); + } + +} + +### HTTP::Tiny fetching ### +sub _httptiny_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + my $use_list = { + 'HTTP::Tiny' => '0.008', + + }; + + unless( can_load(modules => $use_list) ) { + $METHOD_FAIL->{'httptiny'} = 1; + return; + } + + my $uri = $self->uri; + + my $http = HTTP::Tiny->new( ( $TIMEOUT ? ( timeout => $TIMEOUT ) : () ) ); + + my $rc = $http->mirror( $uri, $to ); + + unless ( $rc->{success} ) { + + return $self->_error(loc( "Fetch failed! HTTP response: %1 [%2]", + $rc->{status}, $rc->{reason} ) ); + + } + + return $to; + +} + +### HTTP::Lite fetching ### +sub _httplite_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### modules required to download with lwp ### + my $use_list = { + 'HTTP::Lite' => '2.2', + 'MIME::Base64' => '0', + }; + + unless( can_load(modules => $use_list) ) { + $METHOD_FAIL->{'httplite'} = 1; + return; + } + + my $uri = $self->uri; + my $retries = 0; + + RETRIES: while ( $retries++ < 5 ) { + + my $http = HTTP::Lite->new(); + # Naughty naughty but there isn't any accessor/setter + $http->{timeout} = $TIMEOUT if $TIMEOUT; + $http->http11_mode(1); + + if ($self->userinfo) { + my $encoded = MIME::Base64::encode($self->userinfo, ''); + $http->add_req_header("Authorization", "Basic $encoded"); + } + + my $fh = FileHandle->new; + + unless ( $fh->open($to,'>') ) { + return $self->_error(loc( + "Could not open '%1' for writing: %2",$to,$!)); + } + + $fh->autoflush(1); + + binmode $fh; + + my $rc = $http->request( $uri, sub { my ($self,$dref,$cbargs) = @_; local $\; print {$cbargs} $$dref }, $fh ); + + close $fh; + + if ( $rc == 301 || $rc == 302 ) { + my $loc; + HEADERS: for ($http->headers_array) { + /Location: (\S+)/ and $loc = $1, last HEADERS; + } + #$loc or last; # Think we should squeal here. + if ($loc =~ m!^/!) { + $uri =~ s{^(\w+?://[^/]+)/.*$}{$1}; + $uri .= $loc; + } + else { + $uri = $loc; + } + next RETRIES; + } + elsif ( $rc == 200 ) { + return $to; + } + else { + return $self->_error(loc("Fetch failed! HTTP response: %1 [%2]", + $rc, $http->status_message)); + } + + } # Loop for 5 retries. + + return $self->_error("Fetch failed! Gave up after 5 tries"); + +} + +### Simple IO::Socket::INET fetching ### +sub _iosock_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + my $use_list = { + 'IO::Socket::INET' => '0.0', + 'IO::Select' => '0.0', + }; + + unless( can_load(modules => $use_list) ) { + $METHOD_FAIL->{'iosock'} = 1; + return; + } + + my $sock = IO::Socket::INET->new( + PeerHost => $self->host, + ( $self->host =~ /:/ ? () : ( PeerPort => 80 ) ), + ); + + unless ( $sock ) { + return $self->_error(loc("Could not open socket to '%1', '%2'",$self->host,$!)); + } + + my $fh = FileHandle->new; + + # Check open() + + unless ( $fh->open($to,'>') ) { + return $self->_error(loc( + "Could not open '%1' for writing: %2",$to,$!)); + } + + $fh->autoflush(1); + binmode $fh; + + my $path = File::Spec::Unix->catfile( $self->path, $self->file ); + my $req = "GET $path HTTP/1.0\x0d\x0aHost: " . $self->host . "\x0d\x0a\x0d\x0a"; + $sock->send( $req ); + + my $select = IO::Select->new( $sock ); + + my $resp = ''; + my $normal = 0; + while ( $select->can_read( $TIMEOUT || 60 ) ) { + my $ret = $sock->sysread( $resp, 4096, length($resp) ); + if ( !defined $ret or $ret == 0 ) { + $select->remove( $sock ); + $normal++; + } + } + close $sock; + + unless ( $normal ) { + return $self->_error(loc("Socket timed out after '%1' seconds", ( $TIMEOUT || 60 ))); + } + + # Check the "response" + # Strip preceding blank lines apparently they are allowed (RFC 2616 4.1) + $resp =~ s/^(\x0d?\x0a)+//; + # Check it is an HTTP response + unless ( $resp =~ m!^HTTP/(\d+)\.(\d+)!i ) { + return $self->_error(loc("Did not get a HTTP response from '%1'",$self->host)); + } + + # Check for OK + my ($code) = $resp =~ m!^HTTP/\d+\.\d+\s+(\d+)!i; + unless ( $code eq '200' ) { + return $self->_error(loc("Got a '%1' from '%2' expected '200'",$code,$self->host)); + } + + { + local $\; + print $fh +($resp =~ m/\x0d\x0a\x0d\x0a(.*)$/s )[0]; + } + close $fh; + return $to; +} + +### Net::FTP fetching +sub _netftp_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### required modules ### + my $use_list = { 'Net::FTP' => 0 }; + + unless( can_load( modules => $use_list ) ) { + $METHOD_FAIL->{'netftp'} = 1; + return; + } + + ### make connection ### + my $ftp; + my @options = ($self->host); + push(@options, Timeout => $TIMEOUT) if $TIMEOUT; + unless( $ftp = Net::FTP->new( @options ) ) { + return $self->_error(loc("Ftp creation failed: %1",$@)); + } + + ### login ### + unless( $ftp->login( anonymous => $FROM_EMAIL ) ) { + return $self->_error(loc("Could not login to '%1'",$self->host)); + } + + ### set binary mode, just in case ### + $ftp->binary; + + ### create the remote path + ### remember remote paths are unix paths! [#11483] + my $remote = File::Spec::Unix->catfile( $self->path, $self->file ); + + ### fetch the file ### + my $target; + unless( $target = $ftp->get( $remote, $to ) ) { + return $self->_error(loc("Could not fetch '%1' from '%2'", + $remote, $self->host)); + } + + ### log out ### + $ftp->quit; + + return $target; + +} + +### /bin/wget fetch ### +sub _wget_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + my $wget; + ### see if we have a wget binary ### + unless( $wget = can_run('wget') ) { + $METHOD_FAIL->{'wget'} = 1; + return; + } + + ### no verboseness, thanks ### + my $cmd = [ $wget, '--quiet' ]; + + ### if a timeout is set, add it ### + push(@$cmd, '--timeout=' . $TIMEOUT) if $TIMEOUT; + + ### run passive if specified ### + push @$cmd, '--passive-ftp' if $FTP_PASSIVE; + + ### set the output document, add the uri ### + push @$cmd, '--output-document', $to, $self->uri; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + ### shell out ### + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG + )) { + ### wget creates the output document always, even if the fetch + ### fails.. so unlink it in that case + 1 while unlink $to; + + return $self->_error(loc( "Command failed: %1", $captured || '' )); + } + + return $to; +} + +### /bin/lftp fetch ### +sub _lftp_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### see if we have a lftp binary ### + my $lftp; + unless( $lftp = can_run('lftp') ) { + $METHOD_FAIL->{'lftp'} = 1; + return; + } + + ### no verboseness, thanks ### + my $cmd = [ $lftp, '-f' ]; + + my $fh = File::Temp->new; + + my $str; + + ### if a timeout is set, add it ### + $str .= "set net:timeout $TIMEOUT;\n" if $TIMEOUT; + + ### run passive if specified ### + $str .= "set ftp:passive-mode 1;\n" if $FTP_PASSIVE; + + ### set the output document, add the uri ### + ### quote the URI, because lftp supports certain shell + ### expansions, most notably & for backgrounding. + ### ' quote does nto work, must be " + $str .= q[get ']. $self->uri .q[' -o ]. $to . $/; + + if( $DEBUG ) { + my $pp_str = join ' ', split $/, $str; + print "# lftp command: $pp_str\n"; + } + + ### write straight to the file. + $fh->autoflush(1); + print $fh $str; + + ### the command needs to be 1 string to be executed + push @$cmd, $fh->filename; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + + ### shell out ### + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG + )) { + ### wget creates the output document always, even if the fetch + ### fails.. so unlink it in that case + 1 while unlink $to; + + return $self->_error(loc( "Command failed: %1", $captured || '' )); + } + + return $to; +} + + + +### /bin/ftp fetch ### +sub _ftp_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### see if we have a ftp binary ### + my $ftp; + unless( $ftp = can_run('ftp') ) { + $METHOD_FAIL->{'ftp'} = 1; + return; + } + + my $fh = FileHandle->new; + + local $SIG{CHLD} = 'IGNORE'; + + unless ($fh->open("$ftp -n", '|-')) { + return $self->_error(loc("%1 creation failed: %2", $ftp, $!)); + } + + my @dialog = ( + "lcd " . dirname($to), + "open " . $self->host, + "user anonymous $FROM_EMAIL", + "cd /", + "cd " . $self->path, + "binary", + "get " . $self->file . " " . $self->output_file, + "quit", + ); + + foreach (@dialog) { $fh->print($_, "\n") } + $fh->close or return; + + return $to; +} + +### lynx is stupid - it decompresses any .gz file it finds to be text +### use /bin/lynx to fetch files +sub _lynx_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### see if we have a lynx binary ### + my $lynx; + unless ( $lynx = can_run('lynx') ){ + $METHOD_FAIL->{'lynx'} = 1; + return; + } + + unless( IPC::Cmd->can_capture_buffer ) { + $METHOD_FAIL->{'lynx'} = 1; + + return $self->_error(loc( + "Can not capture buffers. Can not use '%1' to fetch files", + 'lynx' )); + } + + ### check if the HTTP resource exists ### + if ($self->uri =~ /^https?:\/\//i) { + my $cmd = [ + $lynx, + '-head', + '-source', + "-auth=anonymous:$FROM_EMAIL", + ]; + + push @$cmd, "-connect_timeout=$TIMEOUT" if $TIMEOUT; + + push @$cmd, $self->uri; + + ### shell out ### + my $head; + unless(run( command => $cmd, + buffer => \$head, + verbose => $DEBUG ) + ) { + return $self->_error(loc("Command failed: %1", $head || '')); + } + + unless($head =~ /^HTTP\/\d+\.\d+ 200\b/) { + return $self->_error(loc("Command failed: %1", $head || '')); + } + } + + ### write to the output file ourselves, since lynx ass_u_mes to much + my $local = FileHandle->new( $to, 'w' ) + or return $self->_error(loc( + "Could not open '%1' for writing: %2",$to,$!)); + + ### dump to stdout ### + my $cmd = [ + $lynx, + '-source', + "-auth=anonymous:$FROM_EMAIL", + ]; + + push @$cmd, "-connect_timeout=$TIMEOUT" if $TIMEOUT; + + ### DO NOT quote things for IPC::Run, it breaks stuff. + push @$cmd, $self->uri; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? $self->uri + # : QUOTE. $self->uri .QUOTE; + + + ### shell out ### + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG ) + ) { + return $self->_error(loc("Command failed: %1", $captured || '')); + } + + ### print to local file ### + ### XXX on a 404 with a special error page, $captured will actually + ### hold the contents of that page, and make it *appear* like the + ### request was a success, when really it wasn't :( + ### there doesn't seem to be an option for lynx to change the exit + ### code based on a 4XX status or so. + ### the closest we can come is using --error_file and parsing that, + ### which is very unreliable ;( + $local->print( $captured ); + $local->close or return; + + return $to; +} + +### use /bin/ncftp to fetch files +sub _ncftp_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### we can only set passive mode in interactive sessions, so bail out + ### if $FTP_PASSIVE is set + return if $FTP_PASSIVE; + + ### see if we have a ncftp binary ### + my $ncftp; + unless( $ncftp = can_run('ncftp') ) { + $METHOD_FAIL->{'ncftp'} = 1; + return; + } + + my $cmd = [ + $ncftp, + '-V', # do not be verbose + '-p', $FROM_EMAIL, # email as password + $self->host, # hostname + dirname($to), # local dir for the file + # remote path to the file + ### DO NOT quote things for IPC::Run, it breaks stuff. + $IPC::Cmd::USE_IPC_RUN + ? File::Spec::Unix->catdir( $self->path, $self->file ) + : QUOTE. File::Spec::Unix->catdir( + $self->path, $self->file ) .QUOTE + + ]; + + ### shell out ### + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG ) + ) { + return $self->_error(loc("Command failed: %1", $captured || '')); + } + + return $to; + +} + +### use /bin/curl to fetch files +sub _curl_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + my $curl; + unless ( $curl = can_run('curl') ) { + $METHOD_FAIL->{'curl'} = 1; + return; + } + + ### these long opts are self explanatory - I like that -jmb + my $cmd = [ $curl, '-q' ]; + + push(@$cmd, '-4') if $^O eq 'netbsd' && $FORCEIPV4; # only seen this on NetBSD so far + + push(@$cmd, '--connect-timeout', $TIMEOUT) if $TIMEOUT; + + push(@$cmd, '--silent') unless $DEBUG; + + ### curl does the right thing with passive, regardless ### + if ($self->scheme eq 'ftp') { + push(@$cmd, '--user', "anonymous:$FROM_EMAIL"); + } + + ### curl doesn't follow 302 (temporarily moved) etc automatically + ### so we add --location to enable that. + push @$cmd, '--fail', '--location', '--output', $to, $self->uri; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG ) + ) { + + return $self->_error(loc("Command failed: %1", $captured || '')); + } + + return $to; + +} + +### /usr/bin/fetch fetch! ### +sub _fetch_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + ### see if we have a fetch binary ### + my $fetch; + unless( HAS_FETCH and $fetch = can_run('fetch') ) { + $METHOD_FAIL->{'fetch'} = 1; + return; + } + + ### no verboseness, thanks ### + my $cmd = [ $fetch, '-q' ]; + + ### if a timeout is set, add it ### + push(@$cmd, '-T', $TIMEOUT) if $TIMEOUT; + + ### run passive if specified ### + #push @$cmd, '-p' if $FTP_PASSIVE; + local $ENV{'FTP_PASSIVE_MODE'} = 1 if $FTP_PASSIVE; + + ### set the output document, add the uri ### + push @$cmd, '-o', $to, $self->uri; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + ### shell out ### + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG + )) { + ### wget creates the output document always, even if the fetch + ### fails.. so unlink it in that case + 1 while unlink $to; + + return $self->_error(loc( "Command failed: %1", $captured || '' )); + } + + return $to; +} + +### use File::Copy for fetching file:// urls ### +### +### See section 3.10 of RFC 1738 (http://www.faqs.org/rfcs/rfc1738.html) +### Also see wikipedia on file:// (http://en.wikipedia.org/wiki/File://) +### + +sub _file_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + + + + ### prefix a / on unix systems with a file uri, since it would + ### look somewhat like this: + ### file:///home/kane/file + ### whereas windows file uris for 'c:\some\dir\file' might look like: + ### file:///C:/some/dir/file + ### file:///C|/some/dir/file + ### or for a network share '\\host\share\some\dir\file': + ### file:////host/share/some/dir/file + ### + ### VMS file uri's for 'DISK$USER:[MY.NOTES]NOTE123456.TXT' might look like: + ### file://vms.host.edu/disk$user/my/notes/note12345.txt + ### + + my $path = $self->path; + my $vol = $self->vol; + my $share = $self->share; + + my $remote; + if (!$share and $self->host) { + return $self->_error(loc( + "Currently %1 cannot handle hosts in %2 urls", + 'File::Fetch', 'file://' + )); + } + + if( $vol ) { + $path = File::Spec->catdir( split /\//, $path ); + $remote = File::Spec->catpath( $vol, $path, $self->file); + + } elsif( $share ) { + ### win32 specific, and a share name, so we wont bother with File::Spec + $path =~ s|/+|\\|g; + $remote = "\\\\".$self->host."\\$share\\$path"; + + } else { + ### File::Spec on VMS can not currently handle UNIX syntax. + my $file_class = ON_VMS + ? 'File::Spec::Unix' + : 'File::Spec'; + + $remote = $file_class->catfile( $path, $self->file ); + } + + ### File::Copy is littered with 'die' statements :( ### + my $rv = eval { File::Copy::copy( $remote, $to ) }; + + ### something went wrong ### + if( !$rv or $@ ) { + return $self->_error(loc("Could not copy '%1' to '%2': %3 %4", + $remote, $to, $!, $@)); + } + + return $to; +} + +### use /usr/bin/rsync to fetch files +sub _rsync_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + my $rsync; + unless ( $rsync = can_run('rsync') ) { + $METHOD_FAIL->{'rsync'} = 1; + return; + } + + my $cmd = [ $rsync ]; + + ### XXX: rsync has no I/O timeouts at all, by default + push(@$cmd, '--timeout=' . $TIMEOUT) if $TIMEOUT; + + push(@$cmd, '--quiet') unless $DEBUG; + + ### DO NOT quote things for IPC::Run, it breaks stuff. + push @$cmd, $self->uri, $to; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG ) + ) { + + return $self->_error(loc("Command %1 failed: %2", + "@$cmd" || '', $captured || '')); + } + + return $to; + +} + +### use git to fetch files +sub _git_fetch { + my $self = shift; + my %hash = @_; + + my ($to); + my $tmpl = { + to => { required => 1, store => \$to } + }; + check( $tmpl, \%hash ) or return; + my $git; + unless ( $git = can_run('git') ) { + $METHOD_FAIL->{'git'} = 1; + return; + } + + my $cmd = [ $git, 'clone' ]; + + #push(@$cmd, '--timeout=' . $TIMEOUT) if $TIMEOUT; + + push(@$cmd, '--quiet') unless $DEBUG; + + ### DO NOT quote things for IPC::Run, it breaks stuff. + push @$cmd, $self->uri, $to; + + ### with IPC::Cmd > 0.41, this is fixed in teh library, + ### and there's no need for special casing any more. + ### DO NOT quote things for IPC::Run, it breaks stuff. + # $IPC::Cmd::USE_IPC_RUN + # ? ($to, $self->uri) + # : (QUOTE. $to .QUOTE, QUOTE. $self->uri .QUOTE); + + my $captured; + unless(run( command => $cmd, + buffer => \$captured, + verbose => $DEBUG ) + ) { + + return $self->_error(loc("Command %1 failed: %2", + "@$cmd" || '', $captured || '')); + } + + return $to; + +} + +################################# +# +# Error code +# +################################# + +=pod + +=head2 $ff->error([BOOL]) + +Returns the last encountered error as string. +Pass it a true value to get the C<Carp::longmess()> output instead. + +=cut + +### error handling the way Archive::Extract does it +sub _error { + my $self = shift; + my $error = shift; + + $self->_error_msg( $error ); + $self->_error_msg_long( Carp::longmess($error) ); + + if( $WARN ) { + carp $DEBUG ? $self->_error_msg_long : $self->_error_msg; + } + + return; +} + +sub error { + my $self = shift; + return shift() ? $self->_error_msg_long : $self->_error_msg; +} + + +1; + +=pod + +=head1 HOW IT WORKS + +File::Fetch is able to fetch a variety of uris, by using several +external programs and modules. + +Below is a mapping of what utilities will be used in what order +for what schemes, if available: + + file => LWP, lftp, file + http => LWP, HTTP::Tiny, wget, curl, lftp, fetch, HTTP::Lite, lynx, iosock + ftp => LWP, Net::FTP, wget, curl, lftp, fetch, ncftp, ftp + rsync => rsync + git => git + +If you'd like to disable the use of one or more of these utilities +and/or modules, see the C<$BLACKLIST> variable further down. + +If a utility or module isn't available, it will be marked in a cache +(see the C<$METHOD_FAIL> variable further down), so it will not be +tried again. The C<fetch> method will only fail when all options are +exhausted, and it was not able to retrieve the file. + +The C<fetch> utility is available on FreeBSD. NetBSD and Dragonfly BSD +may also have it from C<pkgsrc>. We only check for C<fetch> on those +three platforms. + +C<iosock> is a very limited L<IO::Socket::INET> based mechanism for +retrieving C<http> schemed urls. It doesn't follow redirects for instance. + +C<git> only supports C<git://> style urls. + +A special note about fetching files from an ftp uri: + +By default, all ftp connections are done in passive mode. To change +that, see the C<$FTP_PASSIVE> variable further down. + +Furthermore, ftp uris only support anonymous connections, so no +named user/password pair can be passed along. + +C</bin/ftp> is blacklisted by default; see the C<$BLACKLIST> variable +further down. + +=head1 GLOBAL VARIABLES + +The behaviour of File::Fetch can be altered by changing the following +global variables: + +=head2 $File::Fetch::FROM_EMAIL + +This is the email address that will be sent as your anonymous ftp +password. + +Default is C<File-Fetch@example.com>. + +=head2 $File::Fetch::USER_AGENT + +This is the useragent as C<LWP> will report it. + +Default is C<File::Fetch/$VERSION>. + +=head2 $File::Fetch::FTP_PASSIVE + +This variable controls whether the environment variable C<FTP_PASSIVE> +and any passive switches to commandline tools will be set to true. + +Default value is 1. + +Note: When $FTP_PASSIVE is true, C<ncftp> will not be used to fetch +files, since passive mode can only be set interactively for this binary + +=head2 $File::Fetch::TIMEOUT + +When set, controls the network timeout (counted in seconds). + +Default value is 0. + +=head2 $File::Fetch::WARN + +This variable controls whether errors encountered internally by +C<File::Fetch> should be C<carp>'d or not. + +Set to false to silence warnings. Inspect the output of the C<error()> +method manually to see what went wrong. + +Defaults to C<true>. + +=head2 $File::Fetch::DEBUG + +This enables debugging output when calling commandline utilities to +fetch files. +This also enables C<Carp::longmess> errors, instead of the regular +C<carp> errors. + +Good for tracking down why things don't work with your particular +setup. + +Default is 0. + +=head2 $File::Fetch::BLACKLIST + +This is an array ref holding blacklisted modules/utilities for fetching +files with. + +To disallow the use of, for example, C<LWP> and C<Net::FTP>, you could +set $File::Fetch::BLACKLIST to: + + $File::Fetch::BLACKLIST = [qw|lwp netftp|] + +The default blacklist is [qw|ftp|], as C</bin/ftp> is rather unreliable. + +See the note on C<MAPPING> below. + +=head2 $File::Fetch::METHOD_FAIL + +This is a hashref registering what modules/utilities were known to fail +for fetching files (mostly because they weren't installed). + +You can reset this cache by assigning an empty hashref to it, or +individually remove keys. + +See the note on C<MAPPING> below. + +=head1 MAPPING + + +Here's a quick mapping for the utilities/modules, and their names for +the $BLACKLIST, $METHOD_FAIL and other internal functions. + + LWP => lwp + HTTP::Lite => httplite + HTTP::Tiny => httptiny + Net::FTP => netftp + wget => wget + lynx => lynx + ncftp => ncftp + ftp => ftp + curl => curl + rsync => rsync + lftp => lftp + fetch => fetch + IO::Socket => iosock + +=head1 FREQUENTLY ASKED QUESTIONS + +=head2 So how do I use a proxy with File::Fetch? + +C<File::Fetch> currently only supports proxies with LWP::UserAgent. +You will need to set your environment variables accordingly. For +example, to use an ftp proxy: + + $ENV{ftp_proxy} = 'foo.com'; + +Refer to the LWP::UserAgent manpage for more details. + +=head2 I used 'lynx' to fetch a file, but its contents is all wrong! + +C<lynx> can only fetch remote files by dumping its contents to C<STDOUT>, +which we in turn capture. If that content is a 'custom' error file +(like, say, a C<404 handler>), you will get that contents instead. + +Sadly, C<lynx> doesn't support any options to return a different exit +code on non-C<200 OK> status, giving us no way to tell the difference +between a 'successful' fetch and a custom error page. + +Therefor, we recommend to only use C<lynx> as a last resort. This is +why it is at the back of our list of methods to try as well. + +=head2 Files I'm trying to fetch have reserved characters or non-ASCII characters in them. What do I do? + +C<File::Fetch> is relatively smart about things. When trying to write +a file to disk, it removes the C<query parameters> (see the +C<output_file> method for details) from the file name before creating +it. In most cases this suffices. + +If you have any other characters you need to escape, please install +the C<URI::Escape> module from CPAN, and pre-encode your URI before +passing it to C<File::Fetch>. You can read about the details of URIs +and URI encoding here: + + http://www.faqs.org/rfcs/rfc2396.html + +=head1 TODO + +=over 4 + +=item Implement $PREFER_BIN + +To indicate to rather use commandline tools than modules + +=back + +=head1 BUG REPORTS + +Please report bugs or other issues to E<lt>bug-file-fetch@rt.cpan.org<gt>. + +=head1 AUTHOR + +This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. + +=head1 COPYRIGHT + +This library is free software; you may redistribute and/or modify it +under the same terms as Perl itself. + + +=cut + +# Local variables: +# c-indentation-style: bsd +# c-basic-offset: 4 +# indent-tabs-mode: nil +# End: +# vim: expandtab shiftwidth=4: + + + + diff --git a/data/miniconda3/lib/perl5/core_perl/File/Find.pm b/data/miniconda3/lib/perl5/core_perl/File/Find.pm new file mode 100644 index 0000000000000000000000000000000000000000..4c67e882a5e0130c34371476feacc80b65aef77e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Find.pm @@ -0,0 +1,1127 @@ +package File::Find; +use 5.006; +use strict; +use warnings; +use warnings::register; +our $VERSION = '1.37'; +require Exporter; +require Cwd; + +our @ISA = qw(Exporter); +our @EXPORT = qw(find finddepth); + + +use strict; +my $Is_VMS = $^O eq 'VMS'; +my $Is_Win32 = $^O eq 'MSWin32'; + +require File::Basename; +require File::Spec; + +# Should ideally be my() not our() but local() currently +# refuses to operate on lexicals + +our %SLnkSeen; +our ($wanted_callback, $avoid_nlink, $bydepth, $no_chdir, $follow, + $follow_skip, $full_check, $untaint, $untaint_skip, $untaint_pat, + $pre_process, $post_process, $dangling_symlinks); + +sub contract_name { + my ($cdir,$fn) = @_; + + return substr($cdir,0,rindex($cdir,'/')) if $fn eq $File::Find::current_dir; + + $cdir = substr($cdir,0,rindex($cdir,'/')+1); + + $fn =~ s|^\./||; + + my $abs_name= $cdir . $fn; + + if (substr($fn,0,3) eq '../') { + 1 while $abs_name =~ s!/[^/]*/\.\./+!/!; + } + + return $abs_name; +} + +sub PathCombine($$) { + my ($Base,$Name) = @_; + my $AbsName; + + if (substr($Name,0,1) eq '/') { + $AbsName= $Name; + } + else { + $AbsName= contract_name($Base,$Name); + } + + # (simple) check for recursion + my $newlen= length($AbsName); + if ($newlen <= length($Base)) { + if (($newlen == length($Base) || substr($Base,$newlen,1) eq '/') + && $AbsName eq substr($Base,0,$newlen)) + { + return undef; + } + } + return $AbsName; +} + +sub Follow_SymLink($) { + my ($AbsName) = @_; + + my ($NewName,$DEV, $INO); + ($DEV, $INO)= lstat $AbsName; + + while (-l _) { + if ($SLnkSeen{$DEV, $INO}++) { + if ($follow_skip < 2) { + die "$AbsName is encountered a second time"; + } + else { + return undef; + } + } + $NewName= PathCombine($AbsName, readlink($AbsName)); + unless(defined $NewName) { + if ($follow_skip < 2) { + die "$AbsName is a recursive symbolic link"; + } + else { + return undef; + } + } + else { + $AbsName= $NewName; + } + ($DEV, $INO) = lstat($AbsName); + return undef unless defined $DEV; # dangling symbolic link + } + + if ($full_check && defined $DEV && $SLnkSeen{$DEV, $INO}++) { + if ( ($follow_skip < 1) || ((-d _) && ($follow_skip < 2)) ) { + die "$AbsName encountered a second time"; + } + else { + return undef; + } + } + + return $AbsName; +} + +our($dir, $name, $fullname, $prune); +sub _find_dir_symlnk($$$); +sub _find_dir($$$); + +# check whether or not a scalar variable is tainted +# (code straight from the Camel, 3rd ed., page 561) +sub is_tainted_pp { + my $arg = shift; + my $nada = substr($arg, 0, 0); # zero-length + local $@; + eval { eval "# $nada" }; + return length($@) != 0; +} + +sub _find_opt { + my $wanted = shift; + return unless @_; + die "invalid top directory" unless defined $_[0]; + + # This function must local()ize everything because callbacks may + # call find() or finddepth() + + local %SLnkSeen; + local ($wanted_callback, $avoid_nlink, $bydepth, $no_chdir, $follow, + $follow_skip, $full_check, $untaint, $untaint_skip, $untaint_pat, + $pre_process, $post_process, $dangling_symlinks); + local($dir, $name, $fullname, $prune); + local *_ = \my $a; + + my $cwd = $wanted->{bydepth} ? Cwd::fastcwd() : Cwd::getcwd(); + if ($Is_VMS) { + # VMS returns this by default in VMS format which just doesn't + # work for the rest of this module. + $cwd = VMS::Filespec::unixpath($cwd); + + # Apparently this is not expected to have a trailing space. + # To attempt to make VMS/UNIX conversions mostly reversible, + # a trailing slash is needed. The run-time functions ignore the + # resulting double slash, but it causes the perl tests to fail. + $cwd =~ s#/\z##; + + # This comes up in upper case now, but should be lower. + # In the future this could be exact case, no need to change. + } + my $cwd_untainted = $cwd; + my $check_t_cwd = 1; + $wanted_callback = $wanted->{wanted}; + $bydepth = $wanted->{bydepth}; + $pre_process = $wanted->{preprocess}; + $post_process = $wanted->{postprocess}; + $no_chdir = $wanted->{no_chdir}; + $full_check = $Is_Win32 ? 0 : $wanted->{follow}; + $follow = $Is_Win32 ? 0 : + $full_check || $wanted->{follow_fast}; + $follow_skip = $wanted->{follow_skip}; + $untaint = $wanted->{untaint}; + $untaint_pat = $wanted->{untaint_pattern}; + $untaint_skip = $wanted->{untaint_skip}; + $dangling_symlinks = $wanted->{dangling_symlinks}; + + # for compatibility reasons (find.pl, find2perl) + local our ($topdir, $topdev, $topino, $topmode, $topnlink); + + # a symbolic link to a directory doesn't increase the link count + $avoid_nlink = $follow || $File::Find::dont_use_nlink; + + my ($abs_dir, $Is_Dir); + + Proc_Top_Item: + foreach my $TOP (@_) { + my $top_item = $TOP; + $top_item = VMS::Filespec::unixify($top_item) if $Is_VMS; + + ($topdev,$topino,$topmode,$topnlink) = $follow ? stat $top_item : lstat $top_item; + + if ($Is_Win32) { + $top_item =~ s|[/\\]\z|| + unless $top_item =~ m{^(?:\w:)?[/\\]$}; + } + else { + $top_item =~ s|/\z|| unless $top_item eq '/'; + } + + $Is_Dir= 0; + + if ($follow) { + + if (substr($top_item,0,1) eq '/') { + $abs_dir = $top_item; + } + elsif ($top_item eq $File::Find::current_dir) { + $abs_dir = $cwd; + } + else { # care about any ../ + $top_item =~ s/\.dir\z//i if $Is_VMS; + $abs_dir = contract_name("$cwd/",$top_item); + } + $abs_dir= Follow_SymLink($abs_dir); + unless (defined $abs_dir) { + if ($dangling_symlinks) { + if (ref $dangling_symlinks eq 'CODE') { + $dangling_symlinks->($top_item, $cwd); + } else { + warnings::warnif "$top_item is a dangling symbolic link\n"; + } + } + next Proc_Top_Item; + } + + if (-d _) { + $top_item =~ s/\.dir\z//i if $Is_VMS; + _find_dir_symlnk($wanted, $abs_dir, $top_item); + $Is_Dir= 1; + } + } + else { # no follow + $topdir = $top_item; + unless (defined $topnlink) { + warnings::warnif "Can't stat $top_item: $!\n"; + next Proc_Top_Item; + } + if (-d _) { + $top_item =~ s/\.dir\z//i if $Is_VMS; + _find_dir($wanted, $top_item, $topnlink); + $Is_Dir= 1; + } + else { + $abs_dir= $top_item; + } + } + + unless ($Is_Dir) { + unless (($_,$dir) = File::Basename::fileparse($abs_dir)) { + ($dir,$_) = ('./', $top_item); + } + + $abs_dir = $dir; + if (( $untaint ) && (is_tainted($dir) )) { + ( $abs_dir ) = $dir =~ m|$untaint_pat|; + unless (defined $abs_dir) { + if ($untaint_skip == 0) { + die "directory $dir is still tainted"; + } + else { + next Proc_Top_Item; + } + } + } + + unless ($no_chdir || chdir $abs_dir) { + warnings::warnif "Couldn't chdir $abs_dir: $!\n"; + next Proc_Top_Item; + } + + $name = $abs_dir . $_; # $File::Find::name + $_ = $name if $no_chdir; + + { $wanted_callback->() }; # protect against wild "next" + + } + + unless ( $no_chdir ) { + if ( ($check_t_cwd) && (($untaint) && (is_tainted($cwd) )) ) { + ( $cwd_untainted ) = $cwd =~ m|$untaint_pat|; + unless (defined $cwd_untainted) { + die "insecure cwd in find(depth)"; + } + $check_t_cwd = 0; + } + unless (chdir $cwd_untainted) { + die "Can't cd to $cwd: $!\n"; + } + } + } +} + +# API: +# $wanted +# $p_dir : "parent directory" +# $nlink : what came back from the stat +# preconditions: +# chdir (if not no_chdir) to dir + +sub _find_dir($$$) { + my ($wanted, $p_dir, $nlink) = @_; + my ($CdLvl,$Level) = (0,0); + my @Stack; + my @filenames; + my ($subcount,$sub_nlink); + my $SE= []; + my $dir_name= $p_dir; + my $dir_pref; + my $dir_rel = $File::Find::current_dir; + my $tainted = 0; + my $no_nlink; + + if ($Is_Win32) { + $dir_pref + = ($p_dir =~ m{^(?:\w:[/\\]?|[/\\])$} ? $p_dir : "$p_dir/" ); + } elsif ($Is_VMS) { + + # VMS is returning trailing .dir on directories + # and trailing . on files and symbolic links + # in UNIX syntax. + # + + $p_dir =~ s/\.(dir)?$//i unless $p_dir eq '.'; + + $dir_pref = ($p_dir =~ m/[\]>]+$/ ? $p_dir : "$p_dir/" ); + } + else { + $dir_pref= ( $p_dir eq '/' ? '/' : "$p_dir/" ); + } + + local ($dir, $name, $prune, *DIR); + + unless ( $no_chdir || ($p_dir eq $File::Find::current_dir)) { + my $udir = $p_dir; + if (( $untaint ) && (is_tainted($p_dir) )) { + ( $udir ) = $p_dir =~ m|$untaint_pat|; + unless (defined $udir) { + if ($untaint_skip == 0) { + die "directory $p_dir is still tainted"; + } + else { + return; + } + } + } + unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { + warnings::warnif "Can't cd to $udir: $!\n"; + return; + } + } + + # push the starting directory + push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; + + while (defined $SE) { + unless ($bydepth) { + $dir= $p_dir; # $File::Find::dir + $name= $dir_name; # $File::Find::name + $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ + # prune may happen here + $prune= 0; + { $wanted_callback->() }; # protect against wild "next" + next if $prune; + } + + # change to that directory + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + my $udir= $dir_rel; + if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_rel) )) ) { + ( $udir ) = $dir_rel =~ m|$untaint_pat|; + unless (defined $udir) { + if ($untaint_skip == 0) { + die "directory (" . ($p_dir ne '/' ? $p_dir : '') . "/) $dir_rel is still tainted"; + } else { # $untaint_skip == 1 + next; + } + } + } + unless (chdir ($Is_VMS && $udir !~ /[\/\[<]+/ ? "./$udir" : $udir)) { + warnings::warnif "Can't cd to (" . + ($p_dir ne '/' ? $p_dir : '') . "/) $udir: $!\n"; + next; + } + $CdLvl++; + } + + $dir= $dir_name; # $File::Find::dir + + # Get the list of files in the current directory. + unless (opendir DIR, ($no_chdir ? $dir_name : $File::Find::current_dir)) { + warnings::warnif "Can't opendir($dir_name): $!\n"; + next; + } + @filenames = readdir DIR; + closedir(DIR); + @filenames = $pre_process->(@filenames) if $pre_process; + push @Stack,[$CdLvl,$dir_name,"",-2] if $post_process; + + # default: use whatever was specified + # (if $nlink >= 2, and $avoid_nlink == 0, this will switch back) + $no_nlink = $avoid_nlink; + # if dir has wrong nlink count, force switch to slower stat method + $no_nlink = 1 if ($nlink < 2); + + if ($nlink == 2 && !$no_nlink) { + # This dir has no subdirectories. + for my $FN (@filenames) { + if ($Is_VMS) { + # Big hammer here - Compensate for VMS trailing . and .dir + # No win situation until this is changed, but this + # will handle the majority of the cases with breaking the fewest + + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + } + next if $FN =~ $File::Find::skip_pattern; + + $name = $dir_pref . $FN; # $File::Find::name + $_ = ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + + } + else { + # This dir has subdirectories. + $subcount = $nlink - 2; + + # HACK: insert directories at this position, so as to preserve + # the user pre-processed ordering of files (thus ensuring + # directory traversal is in user sorted order, not at random). + my $stack_top = @Stack; + + for my $FN (@filenames) { + next if $FN =~ $File::Find::skip_pattern; + if ($subcount > 0 || $no_nlink) { + # Seen all the subdirs? + # check for directoriness. + # stat is faster for a file in the current directory + $sub_nlink = (lstat ($no_chdir ? $dir_pref . $FN : $FN))[3]; + + if (-d _) { + --$subcount; + $FN =~ s/\.dir\z//i if $Is_VMS; + # HACK: replace push to preserve dir traversal order + #push @Stack,[$CdLvl,$dir_name,$FN,$sub_nlink]; + splice @Stack, $stack_top, 0, + [$CdLvl,$dir_name,$FN,$sub_nlink]; + } + else { + $name = $dir_pref . $FN; # $File::Find::name + $_= ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } + else { + $name = $dir_pref . $FN; # $File::Find::name + $_= ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } + } + } + continue { + while ( defined ($SE = pop @Stack) ) { + ($Level, $p_dir, $dir_rel, $nlink) = @$SE; + if ($CdLvl > $Level && !$no_chdir) { + my $tmp; + if ($Is_VMS) { + $tmp = '[' . ('-' x ($CdLvl-$Level)) . ']'; + } + else { + $tmp = join('/',('..') x ($CdLvl-$Level)); + } + die "Can't cd to $tmp from $dir_name: $!" + unless chdir ($tmp); + $CdLvl = $Level; + } + + if ($Is_Win32) { + $dir_name = ($p_dir =~ m{^(?:\w:[/\\]?|[/\\])$} + ? "$p_dir$dir_rel" : "$p_dir/$dir_rel"); + $dir_pref = "$dir_name/"; + } + elsif ($^O eq 'VMS') { + if ($p_dir =~ m/[\]>]+$/) { + $dir_name = $p_dir; + $dir_name =~ s/([\]>]+)$/.$dir_rel$1/; + $dir_pref = $dir_name; + } + else { + $dir_name = "$p_dir/$dir_rel"; + $dir_pref = "$dir_name/"; + } + } + else { + $dir_name = ($p_dir eq '/' ? "/$dir_rel" : "$p_dir/$dir_rel"); + $dir_pref = "$dir_name/"; + } + + if ( $nlink == -2 ) { + $name = $dir = $p_dir; # $File::Find::name / dir + $_ = $File::Find::current_dir; + $post_process->(); # End-of-directory processing + } + elsif ( $nlink < 0 ) { # must be finddepth, report dirname now + $name = $dir_name; + if ( substr($name,-2) eq '/.' ) { + substr($name, length($name) == 2 ? -1 : -2) = ''; + } + $dir = $p_dir; + $_ = ($no_chdir ? $dir_name : $dir_rel ); + if ( substr($_,-2) eq '/.' ) { + substr($_, length($_) == 2 ? -1 : -2) = ''; + } + { $wanted_callback->() }; # protect against wild "next" + } + else { + push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; + last; + } + } + } +} + + +# API: +# $wanted +# $dir_loc : absolute location of a dir +# $p_dir : "parent directory" +# preconditions: +# chdir (if not no_chdir) to dir + +sub _find_dir_symlnk($$$) { + my ($wanted, $dir_loc, $p_dir) = @_; # $dir_loc is the absolute directory + my @Stack; + my @filenames; + my $new_loc; + my $updir_loc = $dir_loc; # untainted parent directory + my $SE = []; + my $dir_name = $p_dir; + my $dir_pref; + my $loc_pref; + my $dir_rel = $File::Find::current_dir; + my $byd_flag; # flag for pending stack entry if $bydepth + my $tainted = 0; + my $ok = 1; + + $dir_pref = ( $p_dir eq '/' ? '/' : "$p_dir/" ); + $loc_pref = ( $dir_loc eq '/' ? '/' : "$dir_loc/" ); + + local ($dir, $name, $fullname, $prune, *DIR); + + unless ($no_chdir) { + # untaint the topdir + if (( $untaint ) && (is_tainted($dir_loc) )) { + ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; # parent dir, now untainted + # once untainted, $updir_loc is pushed on the stack (as parent directory); + # hence, we don't need to untaint the parent directory every time we chdir + # to it later + unless (defined $updir_loc) { + if ($untaint_skip == 0) { + die "directory $dir_loc is still tainted"; + } + else { + return; + } + } + } + $ok = chdir($updir_loc) unless ($p_dir eq $File::Find::current_dir); + unless ($ok) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + return; + } + } + + push @Stack,[$dir_loc,$updir_loc,$p_dir,$dir_rel,-1] if $bydepth; + + while (defined $SE) { + + unless ($bydepth) { + # change (back) to parent directory (always untainted) + unless ($no_chdir) { + unless (chdir $updir_loc) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + $dir= $p_dir; # $File::Find::dir + $name= $dir_name; # $File::Find::name + $_= ($no_chdir ? $dir_name : $dir_rel ); # $_ + $fullname= $dir_loc; # $File::Find::fullname + # prune may happen here + $prune= 0; + lstat($_); # make sure file tests with '_' work + { $wanted_callback->() }; # protect against wild "next" + next if $prune; + } + + # change to that directory + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + $updir_loc = $dir_loc; + if ( ($untaint) && (($tainted) || ($tainted = is_tainted($dir_loc) )) ) { + # untaint $dir_loc, what will be pushed on the stack as (untainted) parent dir + ( $updir_loc ) = $dir_loc =~ m|$untaint_pat|; + unless (defined $updir_loc) { + if ($untaint_skip == 0) { + die "directory $dir_loc is still tainted"; + } + else { + next; + } + } + } + unless (chdir $updir_loc) { + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + + $dir = $dir_name; # $File::Find::dir + + # Get the list of files in the current directory. + unless (opendir DIR, ($no_chdir ? $dir_loc : $File::Find::current_dir)) { + warnings::warnif "Can't opendir($dir_loc): $!\n"; + next; + } + @filenames = readdir DIR; + closedir(DIR); + + for my $FN (@filenames) { + if ($Is_VMS) { + # Big hammer here - Compensate for VMS trailing . and .dir + # No win situation until this is changed, but this + # will handle the majority of the cases with breaking the fewest. + + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + } + next if $FN =~ $File::Find::skip_pattern; + + # follow symbolic links / do an lstat + $new_loc = Follow_SymLink($loc_pref.$FN); + + # ignore if invalid symlink + unless (defined $new_loc) { + if (!defined -l _ && $dangling_symlinks) { + $fullname = undef; + if (ref $dangling_symlinks eq 'CODE') { + $dangling_symlinks->($FN, $dir_pref); + } else { + warnings::warnif "$dir_pref$FN is a dangling symbolic link\n"; + } + } + else { + $fullname = $loc_pref . $FN; + } + $name = $dir_pref . $FN; + $_ = ($no_chdir ? $name : $FN); + { $wanted_callback->() }; + next; + } + + if (-d _) { + if ($Is_VMS) { + $FN =~ s/\.dir\z//i; + $FN =~ s#\.$## if ($FN ne '.'); + $new_loc =~ s/\.dir\z//i; + $new_loc =~ s#\.$## if ($new_loc ne '.'); + } + push @Stack,[$new_loc,$updir_loc,$dir_name,$FN,1]; + } + else { + $fullname = $new_loc; # $File::Find::fullname + $name = $dir_pref . $FN; # $File::Find::name + $_ = ($no_chdir ? $name : $FN); # $_ + { $wanted_callback->() }; # protect against wild "next" + } + } + + } + continue { + while (defined($SE = pop @Stack)) { + ($dir_loc, $updir_loc, $p_dir, $dir_rel, $byd_flag) = @$SE; + $dir_name = ($p_dir eq '/' ? "/$dir_rel" : "$p_dir/$dir_rel"); + $dir_pref = "$dir_name/"; + $loc_pref = "$dir_loc/"; + if ( $byd_flag < 0 ) { # must be finddepth, report dirname now + unless ($no_chdir || ($dir_rel eq $File::Find::current_dir)) { + unless (chdir $updir_loc) { # $updir_loc (parent dir) is always untainted + warnings::warnif "Can't cd to $updir_loc: $!\n"; + next; + } + } + $fullname = $dir_loc; # $File::Find::fullname + $name = $dir_name; # $File::Find::name + if ( substr($name,-2) eq '/.' ) { + substr($name, length($name) == 2 ? -1 : -2) = ''; # $File::Find::name + } + $dir = $p_dir; # $File::Find::dir + $_ = ($no_chdir ? $dir_name : $dir_rel); # $_ + if ( substr($_,-2) eq '/.' ) { + substr($_, length($_) == 2 ? -1 : -2) = ''; + } + + lstat($_); # make sure file tests with '_' work + { $wanted_callback->() }; # protect against wild "next" + } + else { + push @Stack,[$dir_loc, $updir_loc, $p_dir, $dir_rel,-1] if $bydepth; + last; + } + } + } +} + + +sub wrap_wanted { + my $wanted = shift; + if ( ref($wanted) eq 'HASH' ) { + # RT #122547 + my %valid_options = map {$_ => 1} qw( + wanted + bydepth + preprocess + postprocess + follow + follow_fast + follow_skip + dangling_symlinks + no_chdir + untaint + untaint_pattern + untaint_skip + ); + my @invalid_options = (); + for my $v (keys %{$wanted}) { + push @invalid_options, $v unless exists $valid_options{$v}; + } + warn "Invalid option(s): @invalid_options" if @invalid_options; + + unless( exists $wanted->{wanted} and ref( $wanted->{wanted} ) eq 'CODE' ) { + die 'no &wanted subroutine given'; + } + if ( $wanted->{follow} || $wanted->{follow_fast}) { + $wanted->{follow_skip} = 1 unless defined $wanted->{follow_skip}; + } + if ( $wanted->{untaint} ) { + $wanted->{untaint_pattern} = $File::Find::untaint_pattern + unless defined $wanted->{untaint_pattern}; + $wanted->{untaint_skip} = 0 unless defined $wanted->{untaint_skip}; + } + return $wanted; + } + elsif( ref( $wanted ) eq 'CODE' ) { + return { wanted => $wanted }; + } + else { + die 'no &wanted subroutine given'; + } +} + +sub find { + my $wanted = shift; + _find_opt(wrap_wanted($wanted), @_); +} + +sub finddepth { + my $wanted = wrap_wanted(shift); + $wanted->{bydepth} = 1; + _find_opt($wanted, @_); +} + +# default +$File::Find::skip_pattern = qr/^\.{1,2}\z/; +$File::Find::untaint_pattern = qr|^([-+@\w./]+)$|; + +# this _should_ work properly on all platforms +# where File::Find can be expected to work +$File::Find::current_dir = File::Spec->curdir || '.'; + +$File::Find::dont_use_nlink = 1; + +# We need a function that checks if a scalar is tainted. Either use the +# Scalar::Util module's tainted() function or our (slower) pure Perl +# fallback is_tainted_pp() +{ + local $@; + eval { require Scalar::Util }; + *is_tainted = $@ ? \&is_tainted_pp : \&Scalar::Util::tainted; +} + +1; + +__END__ + +=head1 NAME + +File::Find - Traverse a directory tree. + +=head1 SYNOPSIS + + use File::Find; + find(\&wanted, @directories_to_search); + sub wanted { ... } + + use File::Find; + finddepth(\&wanted, @directories_to_search); + sub wanted { ... } + + use File::Find; + find({ wanted => \&process, follow => 1 }, '.'); + +=head1 DESCRIPTION + +These are functions for searching through directory trees doing work +on each file found similar to the Unix I<find> command. File::Find +exports two functions, C<find> and C<finddepth>. They work similarly +but have subtle differences. + +=over 4 + +=item B<find> + + find(\&wanted, @directories); + find(\%options, @directories); + +C<find()> does a depth-first search over the given C<@directories> in +the order they are given. For each file or directory found, it calls +the C<&wanted> subroutine. (See below for details on how to use the +C<&wanted> function). Additionally, for each directory found, it will +C<chdir()> into that directory and continue the search, invoking the +C<&wanted> function on each file or subdirectory in the directory. + +=item B<finddepth> + + finddepth(\&wanted, @directories); + finddepth(\%options, @directories); + +C<finddepth()> works just like C<find()> except that it invokes the +C<&wanted> function for a directory I<after> invoking it for the +directory's contents. It does a postorder traversal instead of a +preorder traversal, working from the bottom of the directory tree up +where C<find()> works from the top of the tree down. + +=back + +=head2 %options + +The first argument to C<find()> is either a code reference to your +C<&wanted> function, or a hash reference describing the operations +to be performed for each file. The +code reference is described in L</The wanted function> below. + +Here are the possible keys for the hash: + +=over 3 + +=item C<wanted> + +The value should be a code reference. This code reference is +described in L</The wanted function> below. The C<&wanted> subroutine is +mandatory. + +=item C<bydepth> + +Reports the name of a directory only AFTER all its entries +have been reported. Entry point C<finddepth()> is a shortcut for +specifying C<< { bydepth => 1 } >> in the first argument of C<find()>. + +=item C<preprocess> + +The value should be a code reference. This code reference is used to +preprocess the current directory. The name of the currently processed +directory is in C<$File::Find::dir>. Your preprocessing function is +called after C<readdir()>, but before the loop that calls the C<wanted()> +function. It is called with a list of strings (actually file/directory +names) and is expected to return a list of strings. The code can be +used to sort the file/directory names alphabetically, numerically, +or to filter out directory entries based on their name alone. When +I<follow> or I<follow_fast> are in effect, C<preprocess> is a no-op. + +=item C<postprocess> + +The value should be a code reference. It is invoked just before leaving +the currently processed directory. It is called in void context with no +arguments. The name of the current directory is in C<$File::Find::dir>. This +hook is handy for summarizing a directory, such as calculating its disk +usage. When I<follow> or I<follow_fast> are in effect, C<postprocess> is a +no-op. + +=item C<follow> + +Causes symbolic links to be followed. Since directory trees with symbolic +links (followed) may contain files more than once and may even have +cycles, a hash has to be built up with an entry for each file. +This might be expensive both in space and time for a large +directory tree. See L</follow_fast> and L</follow_skip> below. +If either I<follow> or I<follow_fast> is in effect: + +=over 6 + +=item * + +It is guaranteed that an I<lstat> has been called before the user's +C<wanted()> function is called. This enables fast file checks involving C<_>. +Note that this guarantee no longer holds if I<follow> or I<follow_fast> +are not set. + +=item * + +There is a variable C<$File::Find::fullname> which holds the absolute +pathname of the file with all symbolic links resolved. If the link is +a dangling symbolic link, then fullname will be set to C<undef>. + +=back + +This is a no-op on Win32. + +=item C<follow_fast> + +This is similar to I<follow> except that it may report some files more +than once. It does detect cycles, however. Since only symbolic links +have to be hashed, this is much cheaper both in space and time. If +processing a file more than once (by the user's C<wanted()> function) +is worse than just taking time, the option I<follow> should be used. + +This is also a no-op on Win32. + +=item C<follow_skip> + +C<follow_skip==1>, which is the default, causes all files which are +neither directories nor symbolic links to be ignored if they are about +to be processed a second time. If a directory or a symbolic link +are about to be processed a second time, File::Find dies. + +C<follow_skip==0> causes File::Find to die if any file is about to be +processed a second time. + +C<follow_skip==2> causes File::Find to ignore any duplicate files and +directories but to proceed normally otherwise. + +=item C<dangling_symlinks> + +Specifies what to do with symbolic links whose target doesn't exist. +If true and a code reference, will be called with the symbolic link +name and the directory it lives in as arguments. Otherwise, if true +and warnings are on, a warning of the form C<"symbolic_link_name is a dangling +symbolic link\n"> will be issued. If false, the dangling symbolic link +will be silently ignored. + +=item C<no_chdir> + +Does not C<chdir()> to each directory as it recurses. The C<wanted()> +function will need to be aware of this, of course. In this case, +C<$_> will be the same as C<$File::Find::name>. + +=item C<untaint> + +If find is used in L<taint-mode|perlsec/Taint mode> (-T command line switch or +if EUID != UID or if EGID != GID), then internally directory names have to be +untainted before they can be C<chdir>'d to. Therefore they are checked against +a regular expression I<untaint_pattern>. Note that all names passed to the +user's C<wanted()> function are still tainted. If this option is used while not +in taint-mode, C<untaint> is a no-op. + +=item C<untaint_pattern> + +See above. This should be set using the C<qr> quoting operator. +The default is set to C<qr|^([-+@\w./]+)$|>. +Note that the parentheses are vital. + +=item C<untaint_skip> + +If set, a directory which fails the I<untaint_pattern> is skipped, +including all its sub-directories. The default is to C<die> in such a case. + +=back + +=head2 The wanted function + +The C<wanted()> function does whatever verifications you want on +each file and directory. Note that despite its name, the C<wanted()> +function is a generic callback function, and does B<not> tell +File::Find if a file is "wanted" or not. In fact, its return value +is ignored. + +The wanted function takes no arguments but rather does its work +through a collection of variables. + +=over 4 + +=item C<$File::Find::dir> is the current directory name, + +=item C<$_> is the current filename within that directory + +=item C<$File::Find::name> is the complete pathname to the file. + +=back + +The above variables have all been localized and may be changed without +affecting data outside of the wanted function. + +For example, when examining the file F</some/path/foo.ext> you will have: + + $File::Find::dir = /some/path/ + $_ = foo.ext + $File::Find::name = /some/path/foo.ext + +You are chdir()'d to C<$File::Find::dir> when the function is called, +unless C<no_chdir> was specified. Note that when changing to +directories is in effect, the root directory (F</>) is a somewhat +special case inasmuch as the concatenation of C<$File::Find::dir>, +C<'/'> and C<$_> is not literally equal to C<$File::Find::name>. The +table below summarizes all variants: + + $File::Find::name $File::Find::dir $_ + default / / . + no_chdir=>0 /etc / etc + /etc/x /etc x + + no_chdir=>1 / / / + /etc / /etc + /etc/x /etc /etc/x + + +When C<follow> or C<follow_fast> are in effect, there is +also a C<$File::Find::fullname>. The function may set +C<$File::Find::prune> to prune the tree unless C<bydepth> was +specified. Unless C<follow> or C<follow_fast> is specified, for +compatibility reasons (find.pl, find2perl) there are in addition the +following globals available: C<$File::Find::topdir>, +C<$File::Find::topdev>, C<$File::Find::topino>, +C<$File::Find::topmode> and C<$File::Find::topnlink>. + +This library is useful for the C<find2perl> tool (distributed as part of the +App-find2perl CPAN distribution), which when fed, + + find2perl / -name .nfs\* -mtime +7 \ + -exec rm -f {} \; -o -fstype nfs -prune + +produces something like: + + sub wanted { + /^\.nfs.*\z/s && + (($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($_)) && + int(-M _) > 7 && + unlink($_) + || + ($nlink || (($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($_))) && + $dev < 0 && + ($File::Find::prune = 1); + } + +Notice the C<_> in the above C<int(-M _)>: the C<_> is a magical +filehandle that caches the information from the preceding +C<stat()>, C<lstat()>, or filetest. + +Here's another interesting wanted function. It will find all symbolic +links that don't resolve: + + sub wanted { + -l && !-e && print "bogus link: $File::Find::name\n"; + } + +Note that you may mix directories and (non-directory) files in the list of +directories to be searched by the C<wanted()> function. + + find(\&wanted, "./foo", "./bar", "./baz/epsilon"); + +In the example above, no file in F<./baz/> other than F<./baz/epsilon> will be +evaluated by C<wanted()>. + +See also the script C<pfind> on CPAN for a nice application of this +module. + +=head1 WARNINGS + +If you run your program with the C<-w> switch, or if you use the +C<warnings> pragma, File::Find will report warnings for several weird +situations. You can disable these warnings by putting the statement + + no warnings 'File::Find'; + +in the appropriate scope. See L<warnings> for more info about lexical +warnings. + +=head1 CAVEAT + +=over 2 + +=item $dont_use_nlink + +You can set the variable C<$File::Find::dont_use_nlink> to 0 if you +are sure the filesystem you are scanning reflects the number of +subdirectories in the parent directory's C<nlink> count. + +If you do set C<$File::Find::dont_use_nlink> to 0, you may notice an +improvement in speed at the risk of not recursing into subdirectories +if a filesystem doesn't populate C<nlink> as expected. + +C<$File::Find::dont_use_nlink> now defaults to 1 on all platforms. + +=item symlinks + +Be aware that the option to follow symbolic links can be dangerous. +Depending on the structure of the directory tree (including symbolic +links to directories) you might traverse a given (physical) directory +more than once (only if C<follow_fast> is in effect). +Furthermore, deleting or changing files in a symbolically linked directory +might cause very unpleasant surprises, since you delete or change files +in an unknown directory. + +=back + +=head1 BUGS AND CAVEATS + +Despite the name of the C<finddepth()> function, both C<find()> and +C<finddepth()> perform a depth-first search of the directory +hierarchy. + +=head1 HISTORY + +File::Find used to produce incorrect results if called recursively. +During the development of perl 5.8 this bug was fixed. +The first fixed version of File::Find was 1.01. + +=head1 SEE ALSO + +L<find(1)>, find2perl. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/File/GlobMapper.pm b/data/miniconda3/lib/perl5/core_perl/File/GlobMapper.pm new file mode 100644 index 0000000000000000000000000000000000000000..a4e5385565e720bb86a8fc6d2b1e6acf974d9bbf --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/GlobMapper.pm @@ -0,0 +1,679 @@ +package File::GlobMapper; + +use strict; +use warnings; +use Carp; + +our ($CSH_GLOB); + +BEGIN +{ + if ($] < 5.006) + { + require File::BSDGlob; import File::BSDGlob qw(:glob) ; + $CSH_GLOB = File::BSDGlob::GLOB_CSH() ; + *globber = \&File::BSDGlob::csh_glob; + } + else + { + require File::Glob; import File::Glob qw(:glob) ; + $CSH_GLOB = File::Glob::GLOB_CSH() ; + #*globber = \&File::Glob::bsd_glob; + *globber = \&File::Glob::csh_glob; + } +} + +our ($Error); + +our ($VERSION, @EXPORT_OK); +$VERSION = '1.001'; +@EXPORT_OK = qw( globmap ); + + +our ($noPreBS, $metachars, $matchMetaRE, %mapping, %wildCount); +$noPreBS = '(?<!\\\)' ; # no preceding backslash +$metachars = '.*?[](){}'; +$matchMetaRE = '[' . quotemeta($metachars) . ']'; + +%mapping = ( + '*' => '([^/]*)', + '?' => '([^/])', + '.' => '\.', + '[' => '([', + '(' => '(', + ')' => ')', + ); + +%wildCount = map { $_ => 1 } qw/ * ? . { ( [ /; + +sub globmap ($$;) +{ + my $inputGlob = shift ; + my $outputGlob = shift ; + + my $obj = new File::GlobMapper($inputGlob, $outputGlob, @_) + or croak "globmap: $Error" ; + return $obj->getFileMap(); +} + +sub new +{ + my $class = shift ; + my $inputGlob = shift ; + my $outputGlob = shift ; + # TODO -- flags needs to default to whatever File::Glob does + my $flags = shift || $CSH_GLOB ; + #my $flags = shift ; + + $inputGlob =~ s/^\s*\<\s*//; + $inputGlob =~ s/\s*\>\s*$//; + + $outputGlob =~ s/^\s*\<\s*//; + $outputGlob =~ s/\s*\>\s*$//; + + my %object = + ( InputGlob => $inputGlob, + OutputGlob => $outputGlob, + GlobFlags => $flags, + Braces => 0, + WildCount => 0, + Pairs => [], + Sigil => '#', + ); + + my $self = bless \%object, ref($class) || $class ; + + $self->_parseInputGlob() + or return undef ; + + $self->_parseOutputGlob() + or return undef ; + + my @inputFiles = globber($self->{InputGlob}, $flags) ; + + if (GLOB_ERROR) + { + $Error = $!; + return undef ; + } + + #if (whatever) + { + my $missing = grep { ! -e $_ } @inputFiles ; + + if ($missing) + { + $Error = "$missing input files do not exist"; + return undef ; + } + } + + $self->{InputFiles} = \@inputFiles ; + + $self->_getFiles() + or return undef ; + + return $self; +} + +sub _retError +{ + my $string = shift ; + $Error = "$string in input fileglob" ; + return undef ; +} + +sub _unmatched +{ + my $delimeter = shift ; + + _retError("Unmatched $delimeter"); + return undef ; +} + +sub _parseBit +{ + my $self = shift ; + + my $string = shift ; + + my $out = ''; + my $depth = 0 ; + + while ($string =~ s/(.*?)$noPreBS(,|$matchMetaRE)//) + { + $out .= quotemeta($1) ; + $out .= $mapping{$2} if defined $mapping{$2}; + + ++ $self->{WildCount} if $wildCount{$2} ; + + if ($2 eq ',') + { + return _unmatched("(") + if $depth ; + + $out .= '|'; + } + elsif ($2 eq '(') + { + ++ $depth ; + } + elsif ($2 eq ')') + { + return _unmatched(")") + if ! $depth ; + + -- $depth ; + } + elsif ($2 eq '[') + { + # TODO -- quotemeta & check no '/' + # TODO -- check for \] & other \ within the [] + $string =~ s#(.*?\])## + or return _unmatched("["); + $out .= "$1)" ; + } + elsif ($2 eq ']') + { + return _unmatched("]"); + } + elsif ($2 eq '{' || $2 eq '}') + { + return _retError("Nested {} not allowed"); + } + } + + $out .= quotemeta $string; + + return _unmatched("(") + if $depth ; + + return $out ; +} + +sub _parseInputGlob +{ + my $self = shift ; + + my $string = $self->{InputGlob} ; + my $inGlob = ''; + + # Multiple concatenated *'s don't make sense + #$string =~ s#\*\*+#*# ; + + # TODO -- Allow space to delimit patterns? + #my @strings = split /\s+/, $string ; + #for my $str (@strings) + my $out = ''; + my $depth = 0 ; + + while ($string =~ s/(.*?)$noPreBS($matchMetaRE)//) + { + $out .= quotemeta($1) ; + $out .= $mapping{$2} if defined $mapping{$2}; + ++ $self->{WildCount} if $wildCount{$2} ; + + if ($2 eq '(') + { + ++ $depth ; + } + elsif ($2 eq ')') + { + return _unmatched(")") + if ! $depth ; + + -- $depth ; + } + elsif ($2 eq '[') + { + # TODO -- quotemeta & check no '/' or '(' or ')' + # TODO -- check for \] & other \ within the [] + $string =~ s#(.*?\])## + or return _unmatched("["); + $out .= "$1)" ; + } + elsif ($2 eq ']') + { + return _unmatched("]"); + } + elsif ($2 eq '}') + { + return _unmatched("}"); + } + elsif ($2 eq '{') + { + # TODO -- check no '/' within the {} + # TODO -- check for \} & other \ within the {} + + my $tmp ; + unless ( $string =~ s/(.*?)$noPreBS\}//) + { + return _unmatched("{"); + } + #$string =~ s#(.*?)\}##; + + #my $alt = join '|', + # map { quotemeta $_ } + # split "$noPreBS,", $1 ; + my $alt = $self->_parseBit($1); + defined $alt or return 0 ; + $out .= "($alt)" ; + + ++ $self->{Braces} ; + } + } + + return _unmatched("(") + if $depth ; + + $out .= quotemeta $string ; + + + $self->{InputGlob} =~ s/$noPreBS[\(\)]//g; + $self->{InputPattern} = $out ; + + #print "# INPUT '$self->{InputGlob}' => '$out'\n"; + + return 1 ; + +} + +sub _parseOutputGlob +{ + my $self = shift ; + + my $string = $self->{OutputGlob} ; + my $maxwild = $self->{WildCount}; + + if ($self->{GlobFlags} & GLOB_TILDE) + #if (1) + { + $string =~ s{ + ^ ~ # find a leading tilde + ( # save this in $1 + [^/] # a non-slash character + * # repeated 0 or more times (0 means me) + ) + }{ + $1 + ? (getpwnam($1))[7] + : ( $ENV{HOME} || $ENV{LOGDIR} ) + }ex; + + } + + # max #1 must be == to max no of '*' in input + while ( $string =~ m/#(\d)/g ) + { + croak "Max wild is #$maxwild, you tried #$1" + if $1 > $maxwild ; + } + + my $noPreBS = '(?<!\\\)' ; # no preceding backslash + #warn "noPreBS = '$noPreBS'\n"; + + #$string =~ s/${noPreBS}\$(\d)/\${$1}/g; + $string =~ s/${noPreBS}#(\d)/\${$1}/g; + $string =~ s#${noPreBS}\*#\${inFile}#g; + $string = '"' . $string . '"'; + + #print "OUTPUT '$self->{OutputGlob}' => '$string'\n"; + $self->{OutputPattern} = $string ; + + return 1 ; +} + +sub _getFiles +{ + my $self = shift ; + + my %outInMapping = (); + my %inFiles = () ; + + foreach my $inFile (@{ $self->{InputFiles} }) + { + next if $inFiles{$inFile} ++ ; + + my $outFile = $inFile ; + + if ( $inFile =~ m/$self->{InputPattern}/ ) + { + no warnings 'uninitialized'; + eval "\$outFile = $self->{OutputPattern};" ; + + if (defined $outInMapping{$outFile}) + { + $Error = "multiple input files map to one output file"; + return undef ; + } + $outInMapping{$outFile} = $inFile; + push @{ $self->{Pairs} }, [$inFile, $outFile]; + } + } + + return 1 ; +} + +sub getFileMap +{ + my $self = shift ; + + return $self->{Pairs} ; +} + +sub getHash +{ + my $self = shift ; + + return { map { $_->[0] => $_->[1] } @{ $self->{Pairs} } } ; +} + +1; + +__END__ + +=head1 NAME + +File::GlobMapper - Extend File Glob to Allow Input and Output Files + +=head1 SYNOPSIS + + use File::GlobMapper qw( globmap ); + + my $aref = globmap $input => $output + or die $File::GlobMapper::Error ; + + my $gm = new File::GlobMapper $input => $output + or die $File::GlobMapper::Error ; + + +=head1 DESCRIPTION + +This module needs Perl5.005 or better. + +This module takes the existing C<File::Glob> module as a starting point and +extends it to allow new filenames to be derived from the files matched by +C<File::Glob>. + +This can be useful when carrying out batch operations on multiple files that +have both an input filename and output filename and the output file can be +derived from the input filename. Examples of operations where this can be +useful include, file renaming, file copying and file compression. + + +=head2 Behind The Scenes + +To help explain what C<File::GlobMapper> does, consider what code you +would write if you wanted to rename all files in the current directory +that ended in C<.tar.gz> to C<.tgz>. So say these files are in the +current directory + + alpha.tar.gz + beta.tar.gz + gamma.tar.gz + +and they need renamed to this + + alpha.tgz + beta.tgz + gamma.tgz + +Below is a possible implementation of a script to carry out the rename +(error cases have been omitted) + + foreach my $old ( glob "*.tar.gz" ) + { + my $new = $old; + $new =~ s#(.*)\.tar\.gz$#$1.tgz# ; + + rename $old => $new + or die "Cannot rename '$old' to '$new': $!\n; + } + +Notice that a file glob pattern C<*.tar.gz> was used to match the +C<.tar.gz> files, then a fairly similar regular expression was used in +the substitute to allow the new filename to be created. + +Given that the file glob is just a cut-down regular expression and that it +has already done a lot of the hard work in pattern matching the filenames, +wouldn't it be handy to be able to use the patterns in the fileglob to +drive the new filename? + +Well, that's I<exactly> what C<File::GlobMapper> does. + +Here is same snippet of code rewritten using C<globmap> + + for my $pair (globmap '<*.tar.gz>' => '<#1.tgz>' ) + { + my ($from, $to) = @$pair; + rename $from => $to + or die "Cannot rename '$old' to '$new': $!\n; + } + +So how does it work? + +Behind the scenes the C<globmap> function does a combination of a +file glob to match existing filenames followed by a substitute +to create the new filenames. + +Notice how both parameters to C<globmap> are strings that are delimited by <>. +This is done to make them look more like file globs - it is just syntactic +sugar, but it can be handy when you want the strings to be visually +distinctive. The enclosing <> are optional, so you don't have to use them - in +fact the first thing globmap will do is remove these delimiters if they are +present. + +The first parameter to C<globmap>, C<*.tar.gz>, is an I<Input File Glob>. +Once the enclosing "< ... >" is removed, this is passed (more or +less) unchanged to C<File::Glob> to carry out a file match. + +Next the fileglob C<*.tar.gz> is transformed behind the scenes into a +full Perl regular expression, with the additional step of wrapping each +transformed wildcard metacharacter sequence in parenthesis. + +In this case the input fileglob C<*.tar.gz> will be transformed into +this Perl regular expression + + ([^/]*)\.tar\.gz + +Wrapping with parenthesis allows the wildcard parts of the Input File +Glob to be referenced by the second parameter to C<globmap>, C<#1.tgz>, +the I<Output File Glob>. This parameter operates just like the replacement +part of a substitute command. The difference is that the C<#1> syntax +is used to reference sub-patterns matched in the input fileglob, rather +than the C<$1> syntax that is used with perl regular expressions. In +this case C<#1> is used to refer to the text matched by the C<*> in the +Input File Glob. This makes it easier to use this module where the +parameters to C<globmap> are typed at the command line. + +The final step involves passing each filename matched by the C<*.tar.gz> +file glob through the derived Perl regular expression in turn and +expanding the output fileglob using it. + +The end result of all this is a list of pairs of filenames. By default +that is what is returned by C<globmap>. In this example the data structure +returned will look like this + + ( ['alpha.tar.gz' => 'alpha.tgz'], + ['beta.tar.gz' => 'beta.tgz' ], + ['gamma.tar.gz' => 'gamma.tgz'] + ) + + +Each pair is an array reference with two elements - namely the I<from> +filename, that C<File::Glob> has matched, and a I<to> filename that is +derived from the I<from> filename. + + + +=head2 Limitations + +C<File::GlobMapper> has been kept simple deliberately, so it isn't intended to +solve all filename mapping operations. Under the hood C<File::Glob> (or for +older versions of Perl, C<File::BSDGlob>) is used to match the files, so you +will never have the flexibility of full Perl regular expression. + +=head2 Input File Glob + +The syntax for an Input FileGlob is identical to C<File::Glob>, except +for the following + +=over 5 + +=item 1. + +No nested {} + +=item 2. + +Whitespace does not delimit fileglobs. + +=item 3. + +The use of parenthesis can be used to capture parts of the input filename. + +=item 4. + +If an Input glob matches the same file more than once, only the first +will be used. + +=back + +The syntax + +=over 5 + +=item B<~> + +=item B<~user> + + +=item B<.> + +Matches a literal '.'. +Equivalent to the Perl regular expression + + \. + +=item B<*> + +Matches zero or more characters, except '/'. Equivalent to the Perl +regular expression + + [^/]* + +=item B<?> + +Matches zero or one character, except '/'. Equivalent to the Perl +regular expression + + [^/]? + +=item B<\> + +Backslash is used, as usual, to escape the next character. + +=item B<[]> + +Character class. + +=item B<{,}> + +Alternation + +=item B<()> + +Capturing parenthesis that work just like perl + +=back + +Any other character it taken literally. + +=head2 Output File Glob + +The Output File Glob is a normal string, with 2 glob-like features. + +The first is the '*' metacharacter. This will be replaced by the complete +filename matched by the input file glob. So + + *.c *.Z + +The second is + +Output FileGlobs take the + +=over 5 + +=item "*" + +The "*" character will be replaced with the complete input filename. + +=item #1 + +Patterns of the form /#\d/ will be replaced with the + +=back + +=head2 Returned Data + + +=head1 EXAMPLES + +=head2 A Rename script + +Below is a simple "rename" script that uses C<globmap> to determine the +source and destination filenames. + + use File::GlobMapper qw(globmap) ; + use File::Copy; + + die "rename: Usage rename 'from' 'to'\n" + unless @ARGV == 2 ; + + my $fromGlob = shift @ARGV; + my $toGlob = shift @ARGV; + + my $pairs = globmap($fromGlob, $toGlob) + or die $File::GlobMapper::Error; + + for my $pair (@$pairs) + { + my ($from, $to) = @$pair; + move $from => $to ; + } + + + +Here is an example that renames all c files to cpp. + + $ rename '*.c' '#1.cpp' + +=head2 A few example globmaps + +Below are a few examples of globmaps + +To copy all your .c file to a backup directory + + '</my/home/*.c>' '</my/backup/#1.c>' + +If you want to compress all + + '</my/home/*.[ch]>' '<*.gz>' + +To uncompress + + '</my/home/*.[ch].gz>' '</my/home/#1.#2>' + +=head1 SEE ALSO + +L<File::Glob|File::Glob> + +=head1 AUTHOR + +The I<File::GlobMapper> module was written by Paul Marquess, F<pmqs@cpan.org>. + +=head1 COPYRIGHT AND LICENSE + +Copyright (c) 2005 Paul Marquess. All rights reserved. +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. diff --git a/data/miniconda3/lib/perl5/core_perl/File/Path.pm b/data/miniconda3/lib/perl5/core_perl/File/Path.pm new file mode 100644 index 0000000000000000000000000000000000000000..22e53f8ff9e57a98385ebf9bde0992ea6bec3059 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Path.pm @@ -0,0 +1,1287 @@ +package File::Path; + +use 5.005_04; +use strict; + +use Cwd 'getcwd'; +use File::Basename (); +use File::Spec (); + +BEGIN { + if ( $] < 5.006 ) { + + # can't say 'opendir my $dh, $dirname' + # need to initialise $dh + eval 'use Symbol'; + } +} + +use Exporter (); +use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); +$VERSION = '2.16'; +$VERSION = eval $VERSION; +@ISA = qw(Exporter); +@EXPORT = qw(mkpath rmtree); +@EXPORT_OK = qw(make_path remove_tree); + +BEGIN { + for (qw(VMS MacOS MSWin32 os2)) { + no strict 'refs'; + *{"_IS_\U$_"} = $^O eq $_ ? sub () { 1 } : sub () { 0 }; + } + + # These OSes complain if you want to remove a file that you have no + # write permission to: + *_FORCE_WRITABLE = ( + grep { $^O eq $_ } qw(amigaos dos epoc MSWin32 MacOS os2) + ) ? sub () { 1 } : sub () { 0 }; + + # Unix-like systems need to stat each directory in order to detect + # race condition. MS-Windows is immune to this particular attack. + *_NEED_STAT_CHECK = !(_IS_MSWIN32()) ? sub () { 1 } : sub () { 0 }; +} + +sub _carp { + require Carp; + goto &Carp::carp; +} + +sub _croak { + require Carp; + goto &Carp::croak; +} + +sub _error { + my $arg = shift; + my $message = shift; + my $object = shift; + + if ( $arg->{error} ) { + $object = '' unless defined $object; + $message .= ": $!" if $!; + push @{ ${ $arg->{error} } }, { $object => $message }; + } + else { + _carp( defined($object) ? "$message for $object: $!" : "$message: $!" ); + } +} + +sub __is_arg { + my ($arg) = @_; + + # If client code blessed an array ref to HASH, this will not work + # properly. We could have done $arg->isa() wrapped in eval, but + # that would be expensive. This implementation should suffice. + # We could have also used Scalar::Util:blessed, but we choose not + # to add this dependency + return ( ref $arg eq 'HASH' ); +} + +sub make_path { + push @_, {} unless @_ and __is_arg( $_[-1] ); + goto &mkpath; +} + +sub mkpath { + my $old_style = !( @_ and __is_arg( $_[-1] ) ); + + my $data; + my $paths; + + if ($old_style) { + my ( $verbose, $mode ); + ( $paths, $verbose, $mode ) = @_; + $paths = [$paths] unless UNIVERSAL::isa( $paths, 'ARRAY' ); + $data->{verbose} = $verbose; + $data->{mode} = defined $mode ? $mode : oct '777'; + } + else { + my %args_permitted = map { $_ => 1 } ( qw| + chmod + error + group + mask + mode + owner + uid + user + verbose + | ); + my %not_on_win32_args = map { $_ => 1 } ( qw| + group + owner + uid + user + | ); + my @bad_args = (); + my @win32_implausible_args = (); + my $arg = pop @_; + for my $k (sort keys %{$arg}) { + if (! $args_permitted{$k}) { + push @bad_args, $k; + } + elsif ($not_on_win32_args{$k} and _IS_MSWIN32) { + push @win32_implausible_args, $k; + } + else { + $data->{$k} = $arg->{$k}; + } + } + _carp("Unrecognized option(s) passed to mkpath() or make_path(): @bad_args") + if @bad_args; + _carp("Option(s) implausible on Win32 passed to mkpath() or make_path(): @win32_implausible_args") + if @win32_implausible_args; + $data->{mode} = delete $data->{mask} if exists $data->{mask}; + $data->{mode} = oct '777' unless exists $data->{mode}; + ${ $data->{error} } = [] if exists $data->{error}; + unless (@win32_implausible_args) { + $data->{owner} = delete $data->{user} if exists $data->{user}; + $data->{owner} = delete $data->{uid} if exists $data->{uid}; + if ( exists $data->{owner} and $data->{owner} =~ /\D/ ) { + my $uid = ( getpwnam $data->{owner} )[2]; + if ( defined $uid ) { + $data->{owner} = $uid; + } + else { + _error( $data, + "unable to map $data->{owner} to a uid, ownership not changed" + ); + delete $data->{owner}; + } + } + if ( exists $data->{group} and $data->{group} =~ /\D/ ) { + my $gid = ( getgrnam $data->{group} )[2]; + if ( defined $gid ) { + $data->{group} = $gid; + } + else { + _error( $data, + "unable to map $data->{group} to a gid, group ownership not changed" + ); + delete $data->{group}; + } + } + if ( exists $data->{owner} and not exists $data->{group} ) { + $data->{group} = -1; # chown will leave group unchanged + } + if ( exists $data->{group} and not exists $data->{owner} ) { + $data->{owner} = -1; # chown will leave owner unchanged + } + } + $paths = [@_]; + } + return _mkpath( $data, $paths ); +} + +sub _mkpath { + my $data = shift; + my $paths = shift; + + my ( @created ); + foreach my $path ( @{$paths} ) { + next unless defined($path) and length($path); + $path .= '/' if _IS_OS2 and $path =~ /^\w:\z/s; # feature of CRT + + # Logic wants Unix paths, so go with the flow. + if (_IS_VMS) { + next if $path eq '/'; + $path = VMS::Filespec::unixify($path); + } + next if -d $path; + my $parent = File::Basename::dirname($path); + # Coverage note: It's not clear how we would test the condition: + # '-d $parent or $path eq $parent' + unless ( -d $parent or $path eq $parent ) { + push( @created, _mkpath( $data, [$parent] ) ); + } + print "mkdir $path\n" if $data->{verbose}; + if ( mkdir( $path, $data->{mode} ) ) { + push( @created, $path ); + if ( exists $data->{owner} ) { + + # NB: $data->{group} guaranteed to be set during initialisation + if ( !chown $data->{owner}, $data->{group}, $path ) { + _error( $data, + "Cannot change ownership of $path to $data->{owner}:$data->{group}" + ); + } + } + if ( exists $data->{chmod} ) { + # Coverage note: It's not clear how we would trigger the next + # 'if' block. Failure of 'chmod' might first result in a + # system error: "Permission denied". + if ( !chmod $data->{chmod}, $path ) { + _error( $data, + "Cannot change permissions of $path to $data->{chmod}" ); + } + } + } + else { + my $save_bang = $!; + + # From 'perldoc perlvar': $EXTENDED_OS_ERROR ($^E) is documented + # as: + # Error information specific to the current operating system. At the + # moment, this differs from "$!" under only VMS, OS/2, and Win32 + # (and for MacPerl). On all other platforms, $^E is always just the + # same as $!. + + my ( $e, $e1 ) = ( $save_bang, $^E ); + $e .= "; $e1" if $e ne $e1; + + # allow for another process to have created it meanwhile + if ( ! -d $path ) { + $! = $save_bang; + if ( $data->{error} ) { + push @{ ${ $data->{error} } }, { $path => $e }; + } + else { + _croak("mkdir $path: $e"); + } + } + } + } + return @created; +} + +sub remove_tree { + push @_, {} unless @_ and __is_arg( $_[-1] ); + goto &rmtree; +} + +sub _is_subdir { + my ( $dir, $test ) = @_; + + my ( $dv, $dd ) = File::Spec->splitpath( $dir, 1 ); + my ( $tv, $td ) = File::Spec->splitpath( $test, 1 ); + + # not on same volume + return 0 if $dv ne $tv; + + my @d = File::Spec->splitdir($dd); + my @t = File::Spec->splitdir($td); + + # @t can't be a subdir if it's shorter than @d + return 0 if @t < @d; + + return join( '/', @d ) eq join( '/', splice @t, 0, +@d ); +} + +sub rmtree { + my $old_style = !( @_ and __is_arg( $_[-1] ) ); + + my ($arg, $data, $paths); + + if ($old_style) { + my ( $verbose, $safe ); + ( $paths, $verbose, $safe ) = @_; + $data->{verbose} = $verbose; + $data->{safe} = defined $safe ? $safe : 0; + + if ( defined($paths) and length($paths) ) { + $paths = [$paths] unless UNIVERSAL::isa( $paths, 'ARRAY' ); + } + else { + _carp("No root path(s) specified\n"); + return 0; + } + } + else { + my %args_permitted = map { $_ => 1 } ( qw| + error + keep_root + result + safe + verbose + | ); + my @bad_args = (); + my $arg = pop @_; + for my $k (sort keys %{$arg}) { + if (! $args_permitted{$k}) { + push @bad_args, $k; + } + else { + $data->{$k} = $arg->{$k}; + } + } + _carp("Unrecognized option(s) passed to remove_tree(): @bad_args") + if @bad_args; + ${ $data->{error} } = [] if exists $data->{error}; + ${ $data->{result} } = [] if exists $data->{result}; + + # Wouldn't it make sense to do some validation on @_ before assigning + # to $paths here? + # In the $old_style case we guarantee that each path is both defined + # and non-empty. We don't check that here, which means we have to + # check it later in the first condition in this line: + # if ( $ortho_root_length && _is_subdir( $ortho_root, $ortho_cwd ) ) { + # Granted, that would be a change in behavior for the two + # non-old-style interfaces. + + $paths = [@_]; + } + + $data->{prefix} = ''; + $data->{depth} = 0; + + my @clean_path; + $data->{cwd} = getcwd() or do { + _error( $data, "cannot fetch initial working directory" ); + return 0; + }; + for ( $data->{cwd} ) { /\A(.*)\Z/s; $_ = $1 } # untaint + + for my $p (@$paths) { + + # need to fixup case and map \ to / on Windows + my $ortho_root = _IS_MSWIN32 ? _slash_lc($p) : $p; + my $ortho_cwd = + _IS_MSWIN32 ? _slash_lc( $data->{cwd} ) : $data->{cwd}; + my $ortho_root_length = length($ortho_root); + $ortho_root_length-- if _IS_VMS; # don't compare '.' with ']' + if ( $ortho_root_length && _is_subdir( $ortho_root, $ortho_cwd ) ) { + local $! = 0; + _error( $data, "cannot remove path when cwd is $data->{cwd}", $p ); + next; + } + + if (_IS_MACOS) { + $p = ":$p" unless $p =~ /:/; + $p .= ":" unless $p =~ /:\z/; + } + elsif ( _IS_MSWIN32 ) { + $p =~ s{[/\\]\z}{}; + } + else { + $p =~ s{/\z}{}; + } + push @clean_path, $p; + } + + @{$data}{qw(device inode)} = ( lstat $data->{cwd} )[ 0, 1 ] or do { + _error( $data, "cannot stat initial working directory", $data->{cwd} ); + return 0; + }; + + return _rmtree( $data, \@clean_path ); +} + +sub _rmtree { + my $data = shift; + my $paths = shift; + + my $count = 0; + my $curdir = File::Spec->curdir(); + my $updir = File::Spec->updir(); + + my ( @files, $root ); + ROOT_DIR: + foreach my $root (@$paths) { + + # since we chdir into each directory, it may not be obvious + # to figure out where we are if we generate a message about + # a file name. We therefore construct a semi-canonical + # filename, anchored from the directory being unlinked (as + # opposed to being truly canonical, anchored from the root (/). + + my $canon = + $data->{prefix} + ? File::Spec->catfile( $data->{prefix}, $root ) + : $root; + + my ( $ldev, $lino, $perm ) = ( lstat $root )[ 0, 1, 2 ] + or next ROOT_DIR; + + if ( -d _ ) { + $root = VMS::Filespec::vmspath( VMS::Filespec::pathify($root) ) + if _IS_VMS; + + if ( !chdir($root) ) { + + # see if we can escalate privileges to get in + # (e.g. funny protection mask such as -w- instead of rwx) + # This uses fchmod to avoid traversing outside of the proper + # location (CVE-2017-6512) + my $root_fh; + if (open($root_fh, '<', $root)) { + my ($fh_dev, $fh_inode) = (stat $root_fh )[0,1]; + $perm &= oct '7777'; + my $nperm = $perm | oct '700'; + local $@; + if ( + !( + $data->{safe} + or $nperm == $perm + or !-d _ + or $fh_dev ne $ldev + or $fh_inode ne $lino + or eval { chmod( $nperm, $root_fh ) } + ) + ) + { + _error( $data, + "cannot make child directory read-write-exec", $canon ); + next ROOT_DIR; + } + close $root_fh; + } + if ( !chdir($root) ) { + _error( $data, "cannot chdir to child", $canon ); + next ROOT_DIR; + } + } + + my ( $cur_dev, $cur_inode, $perm ) = ( stat $curdir )[ 0, 1, 2 ] + or do { + _error( $data, "cannot stat current working directory", $canon ); + next ROOT_DIR; + }; + + if (_NEED_STAT_CHECK) { + ( $ldev eq $cur_dev and $lino eq $cur_inode ) + or _croak( +"directory $canon changed before chdir, expected dev=$ldev ino=$lino, actual dev=$cur_dev ino=$cur_inode, aborting." + ); + } + + $perm &= oct '7777'; # don't forget setuid, setgid, sticky bits + my $nperm = $perm | oct '700'; + + # notabene: 0700 is for making readable in the first place, + # it's also intended to change it to writable in case we have + # to recurse in which case we are better than rm -rf for + # subtrees with strange permissions + + if ( + !( + $data->{safe} + or $nperm == $perm + or chmod( $nperm, $curdir ) + ) + ) + { + _error( $data, "cannot make directory read+writeable", $canon ); + $nperm = $perm; + } + + my $d; + $d = gensym() if $] < 5.006; + if ( !opendir $d, $curdir ) { + _error( $data, "cannot opendir", $canon ); + @files = (); + } + else { + if ( !defined ${^TAINT} or ${^TAINT} ) { + # Blindly untaint dir names if taint mode is active + @files = map { /\A(.*)\z/s; $1 } readdir $d; + } + else { + @files = readdir $d; + } + closedir $d; + } + + if (_IS_VMS) { + + # Deleting large numbers of files from VMS Files-11 + # filesystems is faster if done in reverse ASCIIbetical order. + # include '.' to '.;' from blead patch #31775 + @files = map { $_ eq '.' ? '.;' : $_ } reverse @files; + } + + @files = grep { $_ ne $updir and $_ ne $curdir } @files; + + if (@files) { + + # remove the contained files before the directory itself + my $narg = {%$data}; + @{$narg}{qw(device inode cwd prefix depth)} = + ( $cur_dev, $cur_inode, $updir, $canon, $data->{depth} + 1 ); + $count += _rmtree( $narg, \@files ); + } + + # restore directory permissions of required now (in case the rmdir + # below fails), while we are still in the directory and may do so + # without a race via '.' + if ( $nperm != $perm and not chmod( $perm, $curdir ) ) { + _error( $data, "cannot reset chmod", $canon ); + } + + # don't leave the client code in an unexpected directory + chdir( $data->{cwd} ) + or + _croak("cannot chdir to $data->{cwd} from $canon: $!, aborting."); + + # ensure that a chdir upwards didn't take us somewhere other + # than we expected (see CVE-2002-0435) + ( $cur_dev, $cur_inode ) = ( stat $curdir )[ 0, 1 ] + or _croak( + "cannot stat prior working directory $data->{cwd}: $!, aborting." + ); + + if (_NEED_STAT_CHECK) { + ( $data->{device} eq $cur_dev and $data->{inode} eq $cur_inode ) + or _croak( "previous directory $data->{cwd} " + . "changed before entering $canon, " + . "expected dev=$ldev ino=$lino, " + . "actual dev=$cur_dev ino=$cur_inode, aborting." + ); + } + + if ( $data->{depth} or !$data->{keep_root} ) { + if ( $data->{safe} + && ( _IS_VMS + ? !&VMS::Filespec::candelete($root) + : !-w $root ) ) + { + print "skipped $root\n" if $data->{verbose}; + next ROOT_DIR; + } + if ( _FORCE_WRITABLE and !chmod $perm | oct '700', $root ) { + _error( $data, "cannot make directory writeable", $canon ); + } + print "rmdir $root\n" if $data->{verbose}; + if ( rmdir $root ) { + push @{ ${ $data->{result} } }, $root if $data->{result}; + ++$count; + } + else { + _error( $data, "cannot remove directory", $canon ); + if ( + _FORCE_WRITABLE + && !chmod( $perm, + ( _IS_VMS ? VMS::Filespec::fileify($root) : $root ) + ) + ) + { + _error( + $data, + sprintf( "cannot restore permissions to 0%o", + $perm ), + $canon + ); + } + } + } + } + else { + # not a directory + $root = VMS::Filespec::vmsify("./$root") + if _IS_VMS + && !File::Spec->file_name_is_absolute($root) + && ( $root !~ m/(?<!\^)[\]>]+/ ); # not already in VMS syntax + + if ( + $data->{safe} + && ( + _IS_VMS + ? !&VMS::Filespec::candelete($root) + : !( -l $root || -w $root ) + ) + ) + { + print "skipped $root\n" if $data->{verbose}; + next ROOT_DIR; + } + + my $nperm = $perm & oct '7777' | oct '600'; + if ( _FORCE_WRITABLE + and $nperm != $perm + and not chmod $nperm, $root ) + { + _error( $data, "cannot make file writeable", $canon ); + } + print "unlink $canon\n" if $data->{verbose}; + + # delete all versions under VMS + for ( ; ; ) { + if ( unlink $root ) { + push @{ ${ $data->{result} } }, $root if $data->{result}; + } + else { + _error( $data, "cannot unlink file", $canon ); + _FORCE_WRITABLE and chmod( $perm, $root ) + or _error( $data, + sprintf( "cannot restore permissions to 0%o", $perm ), + $canon ); + last; + } + ++$count; + last unless _IS_VMS && lstat $root; + } + } + } + return $count; +} + +sub _slash_lc { + + # fix up slashes and case on MSWin32 so that we can determine that + # c:\path\to\dir is underneath C:/Path/To + my $path = shift; + $path =~ tr{\\}{/}; + return lc($path); +} + +1; + +__END__ + +=head1 NAME + +File::Path - Create or remove directory trees + +=head1 VERSION + +2.16 - released August 31 2018. + +=head1 SYNOPSIS + + use File::Path qw(make_path remove_tree); + + @created = make_path('foo/bar/baz', '/zug/zwang'); + @created = make_path('foo/bar/baz', '/zug/zwang', { + verbose => 1, + mode => 0711, + }); + make_path('foo/bar/baz', '/zug/zwang', { + chmod => 0777, + }); + + $removed_count = remove_tree('foo/bar/baz', '/zug/zwang', { + verbose => 1, + error => \my $err_list, + safe => 1, + }); + + # legacy (interface promoted before v2.00) + @created = mkpath('/foo/bar/baz'); + @created = mkpath('/foo/bar/baz', 1, 0711); + @created = mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711); + $removed_count = rmtree('foo/bar/baz', 1, 1); + $removed_count = rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1); + + # legacy (interface promoted before v2.06) + @created = mkpath('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 }); + $removed_count = rmtree('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 }); + +=head1 DESCRIPTION + +This module provides a convenient way to create directories of +arbitrary depth and to delete an entire directory subtree from the +filesystem. + +The following functions are provided: + +=over + +=item make_path( $dir1, $dir2, .... ) + +=item make_path( $dir1, $dir2, ...., \%opts ) + +The C<make_path> function creates the given directories if they don't +exist before, much like the Unix command C<mkdir -p>. + +The function accepts a list of directories to be created. Its +behaviour may be tuned by an optional hashref appearing as the last +parameter on the call. + +The function returns the list of directories actually created during +the call; in scalar context the number of directories created. + +The following keys are recognised in the option hash: + +=over + +=item mode => $num + +The numeric permissions mode to apply to each created directory +(defaults to C<0777>), to be modified by the current C<umask>. If the +directory already exists (and thus does not need to be created), +the permissions will not be modified. + +C<mask> is recognised as an alias for this parameter. + +=item chmod => $num + +Takes a numeric mode to apply to each created directory (not +modified by the current C<umask>). If the directory already exists +(and thus does not need to be created), the permissions will +not be modified. + +=item verbose => $bool + +If present, will cause C<make_path> to print the name of each directory +as it is created. By default nothing is printed. + +=item error => \$err + +If present, it should be a reference to a scalar. +This scalar will be made to reference an array, which will +be used to store any errors that are encountered. See the L</"ERROR +HANDLING"> section for more information. + +If this parameter is not used, certain error conditions may raise +a fatal error that will cause the program to halt, unless trapped +in an C<eval> block. + +=item owner => $owner + +=item user => $owner + +=item uid => $owner + +If present, will cause any created directory to be owned by C<$owner>. +If the value is numeric, it will be interpreted as a uid; otherwise a +username is assumed. An error will be issued if the username cannot be +mapped to a uid, the uid does not exist or the process lacks the +privileges to change ownership. + +Ownership of directories that already exist will not be changed. + +C<user> and C<uid> are aliases of C<owner>. + +=item group => $group + +If present, will cause any created directory to be owned by the group +C<$group>. If the value is numeric, it will be interpreted as a gid; +otherwise a group name is assumed. An error will be issued if the +group name cannot be mapped to a gid, the gid does not exist or the +process lacks the privileges to change group ownership. + +Group ownership of directories that already exist will not be changed. + + make_path '/var/tmp/webcache', {owner=>'nobody', group=>'nogroup'}; + +=back + +=item mkpath( $dir ) + +=item mkpath( $dir, $verbose, $mode ) + +=item mkpath( [$dir1, $dir2,...], $verbose, $mode ) + +=item mkpath( $dir1, $dir2,..., \%opt ) + +The C<mkpath()> function provide the legacy interface of +C<make_path()> with a different interpretation of the arguments +passed. The behaviour and return value of the function is otherwise +identical to C<make_path()>. + +=item remove_tree( $dir1, $dir2, .... ) + +=item remove_tree( $dir1, $dir2, ...., \%opts ) + +The C<remove_tree> function deletes the given directories and any +files and subdirectories they might contain, much like the Unix +command C<rm -rf> or the Windows commands C<rmdir /s> and C<rd /s>. + +The function accepts a list of directories to be removed. (In point of fact, +it will also accept filesystem entries which are not directories, such as +regular files and symlinks. But, as its name suggests, its intent is to +remove trees rather than individual files.) + +C<remove_tree()>'s behaviour may be tuned by an optional hashref +appearing as the last parameter on the call. If an empty string is +passed to C<remove_tree>, an error will occur. + +B<NOTE:> For security reasons, we strongly advise use of the +hashref-as-final-argument syntax -- specifically, with a setting of the C<safe> +element to a true value. + + remove_tree( $dir1, $dir2, ...., + { + safe => 1, + ... # other key-value pairs + }, + ); + +The function returns the number of files successfully deleted. + +The following keys are recognised in the option hash: + +=over + +=item verbose => $bool + +If present, will cause C<remove_tree> to print the name of each file as +it is unlinked. By default nothing is printed. + +=item safe => $bool + +When set to a true value, will cause C<remove_tree> to skip the files +for which the process lacks the required privileges needed to delete +files, such as delete privileges on VMS. In other words, the code +will make no attempt to alter file permissions. Thus, if the process +is interrupted, no filesystem object will be left in a more +permissive mode. + +=item keep_root => $bool + +When set to a true value, will cause all files and subdirectories +to be removed, except the initially specified directories. This comes +in handy when cleaning out an application's scratch directory. + + remove_tree( '/tmp', {keep_root => 1} ); + +=item result => \$res + +If present, it should be a reference to a scalar. +This scalar will be made to reference an array, which will +be used to store all files and directories unlinked +during the call. If nothing is unlinked, the array will be empty. + + remove_tree( '/tmp', {result => \my $list} ); + print "unlinked $_\n" for @$list; + +This is a useful alternative to the C<verbose> key. + +=item error => \$err + +If present, it should be a reference to a scalar. +This scalar will be made to reference an array, which will +be used to store any errors that are encountered. See the L</"ERROR +HANDLING"> section for more information. + +Removing things is a much more dangerous proposition than +creating things. As such, there are certain conditions that +C<remove_tree> may encounter that are so dangerous that the only +sane action left is to kill the program. + +Use C<error> to trap all that is reasonable (problems with +permissions and the like), and let it die if things get out +of hand. This is the safest course of action. + +=back + +=item rmtree( $dir ) + +=item rmtree( $dir, $verbose, $safe ) + +=item rmtree( [$dir1, $dir2,...], $verbose, $safe ) + +=item rmtree( $dir1, $dir2,..., \%opt ) + +The C<rmtree()> function provide the legacy interface of +C<remove_tree()> with a different interpretation of the arguments +passed. The behaviour and return value of the function is otherwise +identical to C<remove_tree()>. + +B<NOTE:> For security reasons, we strongly advise use of the +hashref-as-final-argument syntax, specifically with a setting of the C<safe> +element to a true value. + + rmtree( $dir1, $dir2, ...., + { + safe => 1, + ... # other key-value pairs + }, + ); + +=back + +=head2 ERROR HANDLING + +=over 4 + +=item B<NOTE:> + +The following error handling mechanism is consistent throughout all +code paths EXCEPT in cases where the ROOT node is nonexistent. In +version 2.11 the maintainers attempted to rectify this inconsistency +but too many downstream modules encountered problems. In such case, +if you require root node evaluation or error checking prior to calling +C<make_path> or C<remove_tree>, you should take additional precautions. + +=back + +If C<make_path> or C<remove_tree> encounters an error, a diagnostic +message will be printed to C<STDERR> via C<carp> (for non-fatal +errors) or via C<croak> (for fatal errors). + +If this behaviour is not desirable, the C<error> attribute may be +used to hold a reference to a variable, which will be used to store +the diagnostics. The variable is made a reference to an array of hash +references. Each hash contain a single key/value pair where the key +is the name of the file, and the value is the error message (including +the contents of C<$!> when appropriate). If a general error is +encountered the diagnostic key will be empty. + +An example usage looks like: + + remove_tree( 'foo/bar', 'bar/rat', {error => \my $err} ); + if ($err && @$err) { + for my $diag (@$err) { + my ($file, $message) = %$diag; + if ($file eq '') { + print "general error: $message\n"; + } + else { + print "problem unlinking $file: $message\n"; + } + } + } + else { + print "No error encountered\n"; + } + +Note that if no errors are encountered, C<$err> will reference an +empty array. This means that C<$err> will always end up TRUE; so you +need to test C<@$err> to determine if errors occurred. + +=head2 NOTES + +C<File::Path> blindly exports C<mkpath> and C<rmtree> into the +current namespace. These days, this is considered bad style, but +to change it now would break too much code. Nonetheless, you are +invited to specify what it is you are expecting to use: + + use File::Path 'rmtree'; + +The routines C<make_path> and C<remove_tree> are B<not> exported +by default. You must specify which ones you want to use. + + use File::Path 'remove_tree'; + +Note that a side-effect of the above is that C<mkpath> and C<rmtree> +are no longer exported at all. This is due to the way the C<Exporter> +module works. If you are migrating a codebase to use the new +interface, you will have to list everything explicitly. But that's +just good practice anyway. + + use File::Path qw(remove_tree rmtree); + +=head3 API CHANGES + +The API was changed in the 2.0 branch. For a time, C<mkpath> and +C<rmtree> tried, unsuccessfully, to deal with the two different +calling mechanisms. This approach was considered a failure. + +The new semantics are now only available with C<make_path> and +C<remove_tree>. The old semantics are only available through +C<mkpath> and C<rmtree>. Users are strongly encouraged to upgrade +to at least 2.08 in order to avoid surprises. + +=head3 SECURITY CONSIDERATIONS + +There were race conditions in the 1.x implementations of File::Path's +C<rmtree> function (although sometimes patched depending on the OS +distribution or platform). The 2.0 version contains code to avoid the +problem mentioned in CVE-2002-0435. + +See the following pages for more information: + + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=286905 + http://www.nntp.perl.org/group/perl.perl5.porters/2005/01/msg97623.html + http://www.debian.org/security/2005/dsa-696 + +Additionally, unless the C<safe> parameter is set (or the +third parameter in the traditional interface is TRUE), should a +C<remove_tree> be interrupted, files that were originally in read-only +mode may now have their permissions set to a read-write (or "delete +OK") mode. + +The following CVE reports were previously filed against File-Path and are +believed to have been addressed: + +=over 4 + +=item * L<http://cve.circl.lu/cve/CVE-2004-0452> + +=item * L<http://cve.circl.lu/cve/CVE-2005-0448> + +=back + +In February 2017 the cPanel Security Team reported an additional vulnerability +in File-Path. The C<chmod()> logic to make directories traversable can be +abused to set the mode on an attacker-chosen file to an attacker-chosen value. +This is due to the time-of-check-to-time-of-use (TOCTTOU) race condition +(L<https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use>) between the +C<stat()> that decides the inode is a directory and the C<chmod()> that tries +to make it user-rwx. CPAN versions 2.13 and later incorporate a patch +provided by John Lightsey to address this problem. This vulnerability has +been reported as CVE-2017-6512. + +=head1 DIAGNOSTICS + +FATAL errors will cause the program to halt (C<croak>), since the +problem is so severe that it would be dangerous to continue. (This +can always be trapped with C<eval>, but it's not a good idea. Under +the circumstances, dying is the best thing to do). + +SEVERE errors may be trapped using the modern interface. If the +they are not trapped, or if the old interface is used, such an error +will cause the program will halt. + +All other errors may be trapped using the modern interface, otherwise +they will be C<carp>ed about. Program execution will not be halted. + +=over 4 + +=item mkdir [path]: [errmsg] (SEVERE) + +C<make_path> was unable to create the path. Probably some sort of +permissions error at the point of departure or insufficient resources +(such as free inodes on Unix). + +=item No root path(s) specified + +C<make_path> was not given any paths to create. This message is only +emitted if the routine is called with the traditional interface. +The modern interface will remain silent if given nothing to do. + +=item No such file or directory + +On Windows, if C<make_path> gives you this warning, it may mean that +you have exceeded your filesystem's maximum path length. + +=item cannot fetch initial working directory: [errmsg] + +C<remove_tree> attempted to determine the initial directory by calling +C<Cwd::getcwd>, but the call failed for some reason. No attempt +will be made to delete anything. + +=item cannot stat initial working directory: [errmsg] + +C<remove_tree> attempted to stat the initial directory (after having +successfully obtained its name via C<getcwd>), however, the call +failed for some reason. No attempt will be made to delete anything. + +=item cannot chdir to [dir]: [errmsg] + +C<remove_tree> attempted to set the working directory in order to +begin deleting the objects therein, but was unsuccessful. This is +usually a permissions issue. The routine will continue to delete +other things, but this directory will be left intact. + +=item directory [dir] changed before chdir, expected dev=[n] ino=[n], actual dev=[n] ino=[n], aborting. (FATAL) + +C<remove_tree> recorded the device and inode of a directory, and then +moved into it. It then performed a C<stat> on the current directory +and detected that the device and inode were no longer the same. As +this is at the heart of the race condition problem, the program +will die at this point. + +=item cannot make directory [dir] read+writeable: [errmsg] + +C<remove_tree> attempted to change the permissions on the current directory +to ensure that subsequent unlinkings would not run into problems, +but was unable to do so. The permissions remain as they were, and +the program will carry on, doing the best it can. + +=item cannot read [dir]: [errmsg] + +C<remove_tree> tried to read the contents of the directory in order +to acquire the names of the directory entries to be unlinked, but +was unsuccessful. This is usually a permissions issue. The +program will continue, but the files in this directory will remain +after the call. + +=item cannot reset chmod [dir]: [errmsg] + +C<remove_tree>, after having deleted everything in a directory, attempted +to restore its permissions to the original state but failed. The +directory may wind up being left behind. + +=item cannot remove [dir] when cwd is [dir] + +The current working directory of the program is F</some/path/to/here> +and you are attempting to remove an ancestor, such as F</some/path>. +The directory tree is left untouched. + +The solution is to C<chdir> out of the child directory to a place +outside the directory tree to be removed. + +=item cannot chdir to [parent-dir] from [child-dir]: [errmsg], aborting. (FATAL) + +C<remove_tree>, after having deleted everything and restored the permissions +of a directory, was unable to chdir back to the parent. The program +halts to avoid a race condition from occurring. + +=item cannot stat prior working directory [dir]: [errmsg], aborting. (FATAL) + +C<remove_tree> was unable to stat the parent directory after having returned +from the child. Since there is no way of knowing if we returned to +where we think we should be (by comparing device and inode) the only +way out is to C<croak>. + +=item previous directory [parent-dir] changed before entering [child-dir], expected dev=[n] ino=[n], actual dev=[n] ino=[n], aborting. (FATAL) + +When C<remove_tree> returned from deleting files in a child directory, a +check revealed that the parent directory it returned to wasn't the one +it started out from. This is considered a sign of malicious activity. + +=item cannot make directory [dir] writeable: [errmsg] + +Just before removing a directory (after having successfully removed +everything it contained), C<remove_tree> attempted to set the permissions +on the directory to ensure it could be removed and failed. Program +execution continues, but the directory may possibly not be deleted. + +=item cannot remove directory [dir]: [errmsg] + +C<remove_tree> attempted to remove a directory, but failed. This may be because +some objects that were unable to be removed remain in the directory, or +it could be a permissions issue. The directory will be left behind. + +=item cannot restore permissions of [dir] to [0nnn]: [errmsg] + +After having failed to remove a directory, C<remove_tree> was unable to +restore its permissions from a permissive state back to a possibly +more restrictive setting. (Permissions given in octal). + +=item cannot make file [file] writeable: [errmsg] + +C<remove_tree> attempted to force the permissions of a file to ensure it +could be deleted, but failed to do so. It will, however, still attempt +to unlink the file. + +=item cannot unlink file [file]: [errmsg] + +C<remove_tree> failed to remove a file. Probably a permissions issue. + +=item cannot restore permissions of [file] to [0nnn]: [errmsg] + +After having failed to remove a file, C<remove_tree> was also unable +to restore the permissions on the file to a possibly less permissive +setting. (Permissions given in octal). + +=item unable to map [owner] to a uid, ownership not changed"); + +C<make_path> was instructed to give the ownership of created +directories to the symbolic name [owner], but C<getpwnam> did +not return the corresponding numeric uid. The directory will +be created, but ownership will not be changed. + +=item unable to map [group] to a gid, group ownership not changed + +C<make_path> was instructed to give the group ownership of created +directories to the symbolic name [group], but C<getgrnam> did +not return the corresponding numeric gid. The directory will +be created, but group ownership will not be changed. + +=back + +=head1 SEE ALSO + +=over 4 + +=item * + +L<File::Remove> + +Allows files and directories to be moved to the Trashcan/Recycle +Bin (where they may later be restored if necessary) if the operating +system supports such functionality. This feature may one day be +made available directly in C<File::Path>. + +=item * + +L<File::Find::Rule> + +When removing directory trees, if you want to examine each file to +decide whether to delete it (and possibly leaving large swathes +alone), F<File::Find::Rule> offers a convenient and flexible approach +to examining directory trees. + +=back + +=head1 BUGS AND LIMITATIONS + +The following describes F<File::Path> limitations and how to report bugs. + +=head2 MULTITHREADED APPLICATIONS + +F<File::Path> C<rmtree> and C<remove_tree> will not work with +multithreaded applications due to its use of C<chdir>. At this time, +no warning or error is generated in this situation. You will +certainly encounter unexpected results. + +The implementation that surfaces this limitation will not be changed. See the +F<File::Path::Tiny> module for functionality similar to F<File::Path> but which does +not C<chdir>. + +=head2 NFS Mount Points + +F<File::Path> is not responsible for triggering the automounts, mirror mounts, +and the contents of network mounted filesystems. If your NFS implementation +requires an action to be performed on the filesystem in order for +F<File::Path> to perform operations, it is strongly suggested you assure +filesystem availability by reading the root of the mounted filesystem. + +=head2 REPORTING BUGS + +Please report all bugs on the RT queue, either via the web interface: + +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Path> + +or by email: + + bug-File-Path@rt.cpan.org + +In either case, please B<attach> patches to the bug report rather than +including them inline in the web post or the body of the email. + +You can also send pull requests to the Github repository: + +L<https://github.com/rpcme/File-Path> + +=head1 ACKNOWLEDGEMENTS + +Paul Szabo identified the race condition originally, and Brendan +O'Dea wrote an implementation for Debian that addressed the problem. +That code was used as a basis for the current code. Their efforts +are greatly appreciated. + +Gisle Aas made a number of improvements to the documentation for +2.07 and his advice and assistance is also greatly appreciated. + +=head1 AUTHORS + +Prior authors and maintainers: Tim Bunce, Charles Bailey, and +David Landgren <F<david@landgren.net>>. + +Current maintainers are Richard Elberger <F<riche@cpan.org>> and +James (Jim) Keenan <F<jkeenan@cpan.org>>. + +=head1 CONTRIBUTORS + +Contributors to File::Path, in alphabetical order by first name. + +=over 1 + +=item <F<bulkdd@cpan.org>> + +=item Charlie Gonzalez <F<itcharlie@cpan.org>> + +=item Craig A. Berry <F<craigberry@mac.com>> + +=item James E Keenan <F<jkeenan@cpan.org>> + +=item John Lightsey <F<john@perlsec.org>> + +=item Nigel Horne <F<njh@bandsman.co.uk>> + +=item Richard Elberger <F<riche@cpan.org>> + +=item Ryan Yee <F<ryee@cpan.org>> + +=item Skye Shaw <F<shaw@cpan.org>> + +=item Tom Lutz <F<tommylutz@gmail.com>> + +=item Will Sheppard <F<willsheppard@github>> + +=back + +=head1 COPYRIGHT + +This module is copyright (C) Charles Bailey, Tim Bunce, David Landgren, +James Keenan and Richard Elberger 1995-2018. All rights reserved. + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/File/Temp.pm b/data/miniconda3/lib/perl5/core_perl/File/Temp.pm new file mode 100644 index 0000000000000000000000000000000000000000..39e15d5c3c8b07c732d1e3f2973e2acba0d49cfa --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/Temp.pm @@ -0,0 +1,3686 @@ +package File::Temp; # git description: v0.2308-7-g3bb4d88 +# ABSTRACT: return name and handle of a temporary file safely + +our $VERSION = '0.2309'; + +#pod =begin :__INTERNALS +#pod +#pod =head1 PORTABILITY +#pod +#pod This section is at the top in order to provide easier access to +#pod porters. It is not expected to be rendered by a standard pod +#pod formatting tool. Please skip straight to the SYNOPSIS section if you +#pod are not trying to port this module to a new platform. +#pod +#pod This module is designed to be portable across operating systems and it +#pod currently supports Unix, VMS, DOS, OS/2, Windows and Mac OS +#pod (Classic). When porting to a new OS there are generally three main +#pod issues that have to be solved: +#pod +#pod =over 4 +#pod +#pod =item * +#pod +#pod Can the OS unlink an open file? If it can not then the +#pod C<_can_unlink_opened_file> method should be modified. +#pod +#pod =item * +#pod +#pod Are the return values from C<stat> reliable? By default all the +#pod return values from C<stat> are compared when unlinking a temporary +#pod file using the filename and the handle. Operating systems other than +#pod unix do not always have valid entries in all fields. If utility function +#pod C<File::Temp::unlink0> fails then the C<stat> comparison should be +#pod modified accordingly. +#pod +#pod =item * +#pod +#pod Security. Systems that can not support a test for the sticky bit +#pod on a directory can not use the MEDIUM and HIGH security tests. +#pod The C<_can_do_level> method should be modified accordingly. +#pod +#pod =back +#pod +#pod =end :__INTERNALS +#pod +#pod =head1 SYNOPSIS +#pod +#pod use File::Temp qw/ tempfile tempdir /; +#pod +#pod $fh = tempfile(); +#pod ($fh, $filename) = tempfile(); +#pod +#pod ($fh, $filename) = tempfile( $template, DIR => $dir); +#pod ($fh, $filename) = tempfile( $template, SUFFIX => '.dat'); +#pod ($fh, $filename) = tempfile( $template, TMPDIR => 1 ); +#pod +#pod binmode( $fh, ":utf8" ); +#pod +#pod $dir = tempdir( CLEANUP => 1 ); +#pod ($fh, $filename) = tempfile( DIR => $dir ); +#pod +#pod Object interface: +#pod +#pod require File::Temp; +#pod use File::Temp (); +#pod use File::Temp qw/ :seekable /; +#pod +#pod $fh = File::Temp->new(); +#pod $fname = $fh->filename; +#pod +#pod $fh = File::Temp->new(TEMPLATE => $template); +#pod $fname = $fh->filename; +#pod +#pod $tmp = File::Temp->new( UNLINK => 0, SUFFIX => '.dat' ); +#pod print $tmp "Some data\n"; +#pod print "Filename is $tmp\n"; +#pod $tmp->seek( 0, SEEK_END ); +#pod +#pod $dir = File::Temp->newdir(); # CLEANUP => 1 by default +#pod +#pod The following interfaces are provided for compatibility with +#pod existing APIs. They should not be used in new code. +#pod +#pod MkTemp family: +#pod +#pod use File::Temp qw/ :mktemp /; +#pod +#pod ($fh, $file) = mkstemp( "tmpfileXXXXX" ); +#pod ($fh, $file) = mkstemps( "tmpfileXXXXXX", $suffix); +#pod +#pod $tmpdir = mkdtemp( $template ); +#pod +#pod $unopened_file = mktemp( $template ); +#pod +#pod POSIX functions: +#pod +#pod use File::Temp qw/ :POSIX /; +#pod +#pod $file = tmpnam(); +#pod $fh = tmpfile(); +#pod +#pod ($fh, $file) = tmpnam(); +#pod +#pod Compatibility functions: +#pod +#pod $unopened_file = File::Temp::tempnam( $dir, $pfx ); +#pod +#pod =head1 DESCRIPTION +#pod +#pod C<File::Temp> can be used to create and open temporary files in a safe +#pod way. There is both a function interface and an object-oriented +#pod interface. The File::Temp constructor or the tempfile() function can +#pod be used to return the name and the open filehandle of a temporary +#pod file. The tempdir() function can be used to create a temporary +#pod directory. +#pod +#pod The security aspect of temporary file creation is emphasized such that +#pod a filehandle and filename are returned together. This helps guarantee +#pod that a race condition can not occur where the temporary file is +#pod created by another process between checking for the existence of the +#pod file and its opening. Additional security levels are provided to +#pod check, for example, that the sticky bit is set on world writable +#pod directories. See L<"safe_level"> for more information. +#pod +#pod For compatibility with popular C library functions, Perl implementations of +#pod the mkstemp() family of functions are provided. These are, mkstemp(), +#pod mkstemps(), mkdtemp() and mktemp(). +#pod +#pod Additionally, implementations of the standard L<POSIX|POSIX> +#pod tmpnam() and tmpfile() functions are provided if required. +#pod +#pod Implementations of mktemp(), tmpnam(), and tempnam() are provided, +#pod but should be used with caution since they return only a filename +#pod that was valid when function was called, so cannot guarantee +#pod that the file will not exist by the time the caller opens the filename. +#pod +#pod Filehandles returned by these functions support the seekable methods. +#pod +#pod =cut + +# Toolchain targets v5.8.1, but we'll try to support back to v5.6 anyway. +# It might be possible to make this v5.5, but many v5.6isms are creeping +# into the code and tests. +use 5.006; +use strict; +use Carp; +use File::Spec 0.8; +use Cwd (); +use File::Path 2.06 qw/ rmtree /; +use Fcntl 1.03; +use IO::Seekable; # For SEEK_* +use Errno; +use Scalar::Util 'refaddr'; +require VMS::Stdio if $^O eq 'VMS'; + +# pre-emptively load Carp::Heavy. If we don't when we run out of file +# handles and attempt to call croak() we get an error message telling +# us that Carp::Heavy won't load rather than an error telling us we +# have run out of file handles. We either preload croak() or we +# switch the calls to croak from _gettemp() to use die. +eval { require Carp::Heavy; }; + +# Need the Symbol package if we are running older perl +require Symbol if $] < 5.006; + +### For the OO interface +use parent 0.221 qw/ IO::Handle IO::Seekable /; +use overload '""' => "STRINGIFY", '0+' => "NUMIFY", + fallback => 1; + +our $DEBUG = 0; +our $KEEP_ALL = 0; + +# We are exporting functions + +use Exporter 5.57 'import'; # 5.57 lets us import 'import' + +# Export list - to allow fine tuning of export table + +our @EXPORT_OK = qw{ + tempfile + tempdir + tmpnam + tmpfile + mktemp + mkstemp + mkstemps + mkdtemp + unlink0 + cleanup + SEEK_SET + SEEK_CUR + SEEK_END + }; + +# Groups of functions for export + +our %EXPORT_TAGS = ( + 'POSIX' => [qw/ tmpnam tmpfile /], + 'mktemp' => [qw/ mktemp mkstemp mkstemps mkdtemp/], + 'seekable' => [qw/ SEEK_SET SEEK_CUR SEEK_END /], + ); + +# add contents of these tags to @EXPORT +Exporter::export_tags('POSIX','mktemp','seekable'); + +# This is a list of characters that can be used in random filenames + +my @CHARS = (qw/ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + a b c d e f g h i j k l m n o p q r s t u v w x y z + 0 1 2 3 4 5 6 7 8 9 _ + /); + +# Maximum number of tries to make a temp file before failing + +use constant MAX_TRIES => 1000; + +# Minimum number of X characters that should be in a template +use constant MINX => 4; + +# Default template when no template supplied + +use constant TEMPXXX => 'X' x 10; + +# Constants for the security level + +use constant STANDARD => 0; +use constant MEDIUM => 1; +use constant HIGH => 2; + +# OPENFLAGS. If we defined the flag to use with Sysopen here this gives +# us an optimisation when many temporary files are requested + +my $OPENFLAGS = O_CREAT | O_EXCL | O_RDWR; +my $LOCKFLAG; + +unless ($^O eq 'MacOS') { + for my $oflag (qw/ NOFOLLOW BINARY LARGEFILE NOINHERIT /) { + my ($bit, $func) = (0, "Fcntl::O_" . $oflag); + no strict 'refs'; + $OPENFLAGS |= $bit if eval { + # Make sure that redefined die handlers do not cause problems + # e.g. CGI::Carp + local $SIG{__DIE__} = sub {}; + local $SIG{__WARN__} = sub {}; + $bit = &$func(); + 1; + }; + } + # Special case O_EXLOCK + $LOCKFLAG = eval { + local $SIG{__DIE__} = sub {}; + local $SIG{__WARN__} = sub {}; + &Fcntl::O_EXLOCK(); + }; +} + +# On some systems the O_TEMPORARY flag can be used to tell the OS +# to automatically remove the file when it is closed. This is fine +# in most cases but not if tempfile is called with UNLINK=>0 and +# the filename is requested -- in the case where the filename is to +# be passed to another routine. This happens on windows. We overcome +# this by using a second open flags variable + +my $OPENTEMPFLAGS = $OPENFLAGS; +unless ($^O eq 'MacOS') { + for my $oflag (qw/ TEMPORARY /) { + my ($bit, $func) = (0, "Fcntl::O_" . $oflag); + local($@); + no strict 'refs'; + $OPENTEMPFLAGS |= $bit if eval { + # Make sure that redefined die handlers do not cause problems + # e.g. CGI::Carp + local $SIG{__DIE__} = sub {}; + local $SIG{__WARN__} = sub {}; + $bit = &$func(); + 1; + }; + } +} + +# Private hash tracking which files have been created by each process id via the OO interface +my %FILES_CREATED_BY_OBJECT; + +# INTERNAL ROUTINES - not to be used outside of package + +# Generic routine for getting a temporary filename +# modelled on OpenBSD _gettemp() in mktemp.c + +# The template must contain X's that are to be replaced +# with the random values + +# Arguments: + +# TEMPLATE - string containing the XXXXX's that is converted +# to a random filename and opened if required + +# Optionally, a hash can also be supplied containing specific options +# "open" => if true open the temp file, else just return the name +# default is 0 +# "mkdir"=> if true, we are creating a temp directory rather than tempfile +# default is 0 +# "suffixlen" => number of characters at end of PATH to be ignored. +# default is 0. +# "unlink_on_close" => indicates that, if possible, the OS should remove +# the file as soon as it is closed. Usually indicates +# use of the O_TEMPORARY flag to sysopen. +# Usually irrelevant on unix +# "use_exlock" => Indicates that O_EXLOCK should be used. Default is false. + +# Optionally a reference to a scalar can be passed into the function +# On error this will be used to store the reason for the error +# "ErrStr" => \$errstr + +# "open" and "mkdir" can not both be true +# "unlink_on_close" is not used when "mkdir" is true. + +# The default options are equivalent to mktemp(). + +# Returns: +# filehandle - open file handle (if called with doopen=1, else undef) +# temp name - name of the temp file or directory + +# For example: +# ($fh, $name) = _gettemp($template, "open" => 1); + +# for the current version, failures are associated with +# stored in an error string and returned to give the reason whilst debugging +# This routine is not called by any external function +sub _gettemp { + + croak 'Usage: ($fh, $name) = _gettemp($template, OPTIONS);' + unless scalar(@_) >= 1; + + # the internal error string - expect it to be overridden + # Need this in case the caller decides not to supply us a value + # need an anonymous scalar + my $tempErrStr; + + # Default options + my %options = ( + "open" => 0, + "mkdir" => 0, + "suffixlen" => 0, + "unlink_on_close" => 0, + "use_exlock" => 0, + "ErrStr" => \$tempErrStr, + ); + + # Read the template + my $template = shift; + if (ref($template)) { + # Use a warning here since we have not yet merged ErrStr + carp "File::Temp::_gettemp: template must not be a reference"; + return (); + } + + # Check that the number of entries on stack are even + if (scalar(@_) % 2 != 0) { + # Use a warning here since we have not yet merged ErrStr + carp "File::Temp::_gettemp: Must have even number of options"; + return (); + } + + # Read the options and merge with defaults + %options = (%options, @_) if @_; + + # Make sure the error string is set to undef + ${$options{ErrStr}} = undef; + + # Can not open the file and make a directory in a single call + if ($options{"open"} && $options{"mkdir"}) { + ${$options{ErrStr}} = "doopen and domkdir can not both be true\n"; + return (); + } + + # Find the start of the end of the Xs (position of last X) + # Substr starts from 0 + my $start = length($template) - 1 - $options{"suffixlen"}; + + # Check that we have at least MINX x X (e.g. 'XXXX") at the end of the string + # (taking suffixlen into account). Any fewer is insecure. + + # Do it using substr - no reason to use a pattern match since + # we know where we are looking and what we are looking for + + if (substr($template, $start - MINX + 1, MINX) ne 'X' x MINX) { + ${$options{ErrStr}} = "The template must end with at least ". + MINX . " 'X' characters\n"; + return (); + } + + # Replace all the X at the end of the substring with a + # random character or just all the XX at the end of a full string. + # Do it as an if, since the suffix adjusts which section to replace + # and suffixlen=0 returns nothing if used in the substr directly + # and generate a full path from the template + + my $path = _replace_XX($template, $options{"suffixlen"}); + + + # Split the path into constituent parts - eventually we need to check + # whether the directory exists + # We need to know whether we are making a temp directory + # or a tempfile + + my ($volume, $directories, $file); + my $parent; # parent directory + if ($options{"mkdir"}) { + # There is no filename at the end + ($volume, $directories, $file) = File::Spec->splitpath( $path, 1); + + # The parent is then $directories without the last directory + # Split the directory and put it back together again + my @dirs = File::Spec->splitdir($directories); + + # If @dirs only has one entry (i.e. the directory template) that means + # we are in the current directory + if ($#dirs == 0) { + $parent = File::Spec->curdir; + } else { + + if ($^O eq 'VMS') { # need volume to avoid relative dir spec + $parent = File::Spec->catdir($volume, @dirs[0..$#dirs-1]); + $parent = 'sys$disk:[]' if $parent eq ''; + } else { + + # Put it back together without the last one + $parent = File::Spec->catdir(@dirs[0..$#dirs-1]); + + # ...and attach the volume (no filename) + $parent = File::Spec->catpath($volume, $parent, ''); + } + + } + + } else { + + # Get rid of the last filename (use File::Basename for this?) + ($volume, $directories, $file) = File::Spec->splitpath( $path ); + + # Join up without the file part + $parent = File::Spec->catpath($volume,$directories,''); + + # If $parent is empty replace with curdir + $parent = File::Spec->curdir + unless $directories ne ''; + + } + + # Check that the parent directories exist + # Do this even for the case where we are simply returning a name + # not a file -- no point returning a name that includes a directory + # that does not exist or is not writable + + unless (-e $parent) { + ${$options{ErrStr}} = "Parent directory ($parent) does not exist"; + return (); + } + unless (-d $parent) { + ${$options{ErrStr}} = "Parent directory ($parent) is not a directory"; + return (); + } + + # Check the stickiness of the directory and chown giveaway if required + # If the directory is world writable the sticky bit + # must be set + + if (File::Temp->safe_level == MEDIUM) { + my $safeerr; + unless (_is_safe($parent,\$safeerr)) { + ${$options{ErrStr}} = "Parent directory ($parent) is not safe ($safeerr)"; + return (); + } + } elsif (File::Temp->safe_level == HIGH) { + my $safeerr; + unless (_is_verysafe($parent, \$safeerr)) { + ${$options{ErrStr}} = "Parent directory ($parent) is not safe ($safeerr)"; + return (); + } + } + + + # Now try MAX_TRIES time to open the file + for (my $i = 0; $i < MAX_TRIES; $i++) { + + # Try to open the file if requested + if ($options{"open"}) { + my $fh; + + # If we are running before perl5.6.0 we can not auto-vivify + if ($] < 5.006) { + $fh = &Symbol::gensym; + } + + # Try to make sure this will be marked close-on-exec + # XXX: Win32 doesn't respect this, nor the proper fcntl, + # but may have O_NOINHERIT. This may or may not be in Fcntl. + local $^F = 2; + + # Attempt to open the file + my $open_success = undef; + if ( $^O eq 'VMS' and $options{"unlink_on_close"} && !$KEEP_ALL) { + # make it auto delete on close by setting FAB$V_DLT bit + $fh = VMS::Stdio::vmssysopen($path, $OPENFLAGS, 0600, 'fop=dlt'); + $open_success = $fh; + } else { + my $flags = ( ($options{"unlink_on_close"} && !$KEEP_ALL) ? + $OPENTEMPFLAGS : + $OPENFLAGS ); + $flags |= $LOCKFLAG if (defined $LOCKFLAG && $options{use_exlock}); + $open_success = sysopen($fh, $path, $flags, 0600); + } + if ( $open_success ) { + + # in case of odd umask force rw + chmod(0600, $path); + + # Opened successfully - return file handle and name + return ($fh, $path); + + } else { + + # Error opening file - abort with error + # if the reason was anything but EEXIST + unless ($!{EEXIST}) { + ${$options{ErrStr}} = "Could not create temp file $path: $!"; + return (); + } + + # Loop round for another try + + } + } elsif ($options{"mkdir"}) { + + # Open the temp directory + if (mkdir( $path, 0700)) { + # in case of odd umask + chmod(0700, $path); + + return undef, $path; + } else { + + # Abort with error if the reason for failure was anything + # except EEXIST + unless ($!{EEXIST}) { + ${$options{ErrStr}} = "Could not create directory $path: $!"; + return (); + } + + # Loop round for another try + + } + + } else { + + # Return true if the file can not be found + # Directory has been checked previously + + return (undef, $path) unless -e $path; + + # Try again until MAX_TRIES + + } + + # Did not successfully open the tempfile/dir + # so try again with a different set of random letters + # No point in trying to increment unless we have only + # 1 X say and the randomness could come up with the same + # file MAX_TRIES in a row. + + # Store current attempt - in principle this implies that the + # 3rd time around the open attempt that the first temp file + # name could be generated again. Probably should store each + # attempt and make sure that none are repeated + + my $original = $path; + my $counter = 0; # Stop infinite loop + my $MAX_GUESS = 50; + + do { + + # Generate new name from original template + $path = _replace_XX($template, $options{"suffixlen"}); + + $counter++; + + } until ($path ne $original || $counter > $MAX_GUESS); + + # Check for out of control looping + if ($counter > $MAX_GUESS) { + ${$options{ErrStr}} = "Tried to get a new temp name different to the previous value $MAX_GUESS times.\nSomething wrong with template?? ($template)"; + return (); + } + + } + + # If we get here, we have run out of tries + ${ $options{ErrStr} } = "Have exceeded the maximum number of attempts (" + . MAX_TRIES . ") to open temp file/dir"; + + return (); + +} + +# Internal routine to replace the XXXX... with random characters +# This has to be done by _gettemp() every time it fails to +# open a temp file/dir + +# Arguments: $template (the template with XXX), +# $ignore (number of characters at end to ignore) + +# Returns: modified template + +sub _replace_XX { + + croak 'Usage: _replace_XX($template, $ignore)' + unless scalar(@_) == 2; + + my ($path, $ignore) = @_; + + # Do it as an if, since the suffix adjusts which section to replace + # and suffixlen=0 returns nothing if used in the substr directly + # Alternatively, could simply set $ignore to length($path)-1 + # Don't want to always use substr when not required though. + my $end = ( $] >= 5.006 ? "\\z" : "\\Z" ); + + if ($ignore) { + substr($path, 0, - $ignore) =~ s/X(?=X*$end)/$CHARS[ int( rand( @CHARS ) ) ]/ge; + } else { + $path =~ s/X(?=X*$end)/$CHARS[ int( rand( @CHARS ) ) ]/ge; + } + return $path; +} + +# Internal routine to force a temp file to be writable after +# it is created so that we can unlink it. Windows seems to occasionally +# force a file to be readonly when written to certain temp locations +sub _force_writable { + my $file = shift; + chmod 0600, $file; +} + + +# internal routine to check to see if the directory is safe +# First checks to see if the directory is not owned by the +# current user or root. Then checks to see if anyone else +# can write to the directory and if so, checks to see if +# it has the sticky bit set + +# Will not work on systems that do not support sticky bit + +#Args: directory path to check +# Optionally: reference to scalar to contain error message +# Returns true if the path is safe and false otherwise. +# Returns undef if can not even run stat() on the path + +# This routine based on version written by Tom Christiansen + +# Presumably, by the time we actually attempt to create the +# file or directory in this directory, it may not be safe +# anymore... Have to run _is_safe directly after the open. + +sub _is_safe { + + my $path = shift; + my $err_ref = shift; + + # Stat path + my @info = stat($path); + unless (scalar(@info)) { + $$err_ref = "stat(path) returned no values"; + return 0; + } + ; + return 1 if $^O eq 'VMS'; # owner delete control at file level + + # Check to see whether owner is neither superuser (or a system uid) nor me + # Use the effective uid from the $> variable + # UID is in [4] + if ($info[4] > File::Temp->top_system_uid() && $info[4] != $>) { + + Carp::cluck(sprintf "uid=$info[4] topuid=%s euid=$> path='$path'", + File::Temp->top_system_uid()); + + $$err_ref = "Directory owned neither by root nor the current user" + if ref($err_ref); + return 0; + } + + # check whether group or other can write file + # use 066 to detect either reading or writing + # use 022 to check writability + # Do it with S_IWOTH and S_IWGRP for portability (maybe) + # mode is in info[2] + if (($info[2] & &Fcntl::S_IWGRP) || # Is group writable? + ($info[2] & &Fcntl::S_IWOTH) ) { # Is world writable? + # Must be a directory + unless (-d $path) { + $$err_ref = "Path ($path) is not a directory" + if ref($err_ref); + return 0; + } + # Must have sticky bit set + unless (-k $path) { + $$err_ref = "Sticky bit not set on $path when dir is group|world writable" + if ref($err_ref); + return 0; + } + } + + return 1; +} + +# Internal routine to check whether a directory is safe +# for temp files. Safer than _is_safe since it checks for +# the possibility of chown giveaway and if that is a possibility +# checks each directory in the path to see if it is safe (with _is_safe) + +# If _PC_CHOWN_RESTRICTED is not set, does the full test of each +# directory anyway. + +# Takes optional second arg as scalar ref to error reason + +sub _is_verysafe { + + # Need POSIX - but only want to bother if really necessary due to overhead + require POSIX; + + my $path = shift; + print "_is_verysafe testing $path\n" if $DEBUG; + return 1 if $^O eq 'VMS'; # owner delete control at file level + + my $err_ref = shift; + + # Should Get the value of _PC_CHOWN_RESTRICTED if it is defined + # and If it is not there do the extensive test + local($@); + my $chown_restricted; + $chown_restricted = &POSIX::_PC_CHOWN_RESTRICTED() + if eval { &POSIX::_PC_CHOWN_RESTRICTED(); 1}; + + # If chown_resticted is set to some value we should test it + if (defined $chown_restricted) { + + # Return if the current directory is safe + return _is_safe($path,$err_ref) if POSIX::sysconf( $chown_restricted ); + + } + + # To reach this point either, the _PC_CHOWN_RESTRICTED symbol + # was not available or the symbol was there but chown giveaway + # is allowed. Either way, we now have to test the entire tree for + # safety. + + # Convert path to an absolute directory if required + unless (File::Spec->file_name_is_absolute($path)) { + $path = File::Spec->rel2abs($path); + } + + # Split directory into components - assume no file + my ($volume, $directories, undef) = File::Spec->splitpath( $path, 1); + + # Slightly less efficient than having a function in File::Spec + # to chop off the end of a directory or even a function that + # can handle ../ in a directory tree + # Sometimes splitdir() returns a blank at the end + # so we will probably check the bottom directory twice in some cases + my @dirs = File::Spec->splitdir($directories); + + # Concatenate one less directory each time around + foreach my $pos (0.. $#dirs) { + # Get a directory name + my $dir = File::Spec->catpath($volume, + File::Spec->catdir(@dirs[0.. $#dirs - $pos]), + '' + ); + + print "TESTING DIR $dir\n" if $DEBUG; + + # Check the directory + return 0 unless _is_safe($dir,$err_ref); + + } + + return 1; +} + + + +# internal routine to determine whether unlink works on this +# platform for files that are currently open. +# Returns true if we can, false otherwise. + +# Currently WinNT, OS/2 and VMS can not unlink an opened file +# On VMS this is because the O_EXCL flag is used to open the +# temporary file. Currently I do not know enough about the issues +# on VMS to decide whether O_EXCL is a requirement. + +sub _can_unlink_opened_file { + + if (grep { $^O eq $_ } qw/MSWin32 os2 VMS dos MacOS haiku/) { + return 0; + } else { + return 1; + } + +} + +# internal routine to decide which security levels are allowed +# see safe_level() for more information on this + +# Controls whether the supplied security level is allowed + +# $cando = _can_do_level( $level ) + +sub _can_do_level { + + # Get security level + my $level = shift; + + # Always have to be able to do STANDARD + return 1 if $level == STANDARD; + + # Currently, the systems that can do HIGH or MEDIUM are identical + if ( $^O eq 'MSWin32' || $^O eq 'os2' || $^O eq 'cygwin' || $^O eq 'dos' || $^O eq 'MacOS' || $^O eq 'mpeix') { + return 0; + } else { + return 1; + } + +} + +# This routine sets up a deferred unlinking of a specified +# filename and filehandle. It is used in the following cases: +# - Called by unlink0 if an opened file can not be unlinked +# - Called by tempfile() if files are to be removed on shutdown +# - Called by tempdir() if directories are to be removed on shutdown + +# Arguments: +# _deferred_unlink( $fh, $fname, $isdir ); +# +# - filehandle (so that it can be explicitly closed if open +# - filename (the thing we want to remove) +# - isdir (flag to indicate that we are being given a directory) +# [and hence no filehandle] + +# Status is not referred to since all the magic is done with an END block + +{ + # Will set up two lexical variables to contain all the files to be + # removed. One array for files, another for directories They will + # only exist in this block. + + # This means we only have to set up a single END block to remove + # all files. + + # in order to prevent child processes inadvertently deleting the parent + # temp files we use a hash to store the temp files and directories + # created by a particular process id. + + # %files_to_unlink contains values that are references to an array of + # array references containing the filehandle and filename associated with + # the temp file. + my (%files_to_unlink, %dirs_to_unlink); + + # Set up an end block to use these arrays + END { + local($., $@, $!, $^E, $?); + cleanup(at_exit => 1); + } + + # Cleanup function. Always triggered on END (with at_exit => 1) but + # can be invoked manually. + sub cleanup { + my %h = @_; + my $at_exit = delete $h{at_exit}; + $at_exit = 0 if not defined $at_exit; + { my @k = sort keys %h; die "unrecognized parameters: @k" if @k } + + if (!$KEEP_ALL) { + # Files + my @files = (exists $files_to_unlink{$$} ? + @{ $files_to_unlink{$$} } : () ); + foreach my $file (@files) { + # close the filehandle without checking its state + # in order to make real sure that this is closed + # if its already closed then I don't care about the answer + # probably a better way to do this + close($file->[0]); # file handle is [0] + + if (-f $file->[1]) { # file name is [1] + _force_writable( $file->[1] ); # for windows + unlink $file->[1] or warn "Error removing ".$file->[1]; + } + } + # Dirs + my @dirs = (exists $dirs_to_unlink{$$} ? + @{ $dirs_to_unlink{$$} } : () ); + my ($cwd, $cwd_to_remove); + foreach my $dir (@dirs) { + if (-d $dir) { + # Some versions of rmtree will abort if you attempt to remove + # the directory you are sitting in. For automatic cleanup + # at program exit, we avoid this by chdir()ing out of the way + # first. If not at program exit, it's best not to mess with the + # current directory, so just let it fail with a warning. + if ($at_exit) { + $cwd = Cwd::abs_path(File::Spec->curdir) if not defined $cwd; + my $abs = Cwd::abs_path($dir); + if ($abs eq $cwd) { + $cwd_to_remove = $dir; + next; + } + } + eval { rmtree($dir, $DEBUG, 0); }; + warn $@ if ($@ && $^W); + } + } + + if (defined $cwd_to_remove) { + # We do need to clean up the current directory, and everything + # else is done, so get out of there and remove it. + chdir $cwd_to_remove or die "cannot chdir to $cwd_to_remove: $!"; + my $updir = File::Spec->updir; + chdir $updir or die "cannot chdir to $updir: $!"; + eval { rmtree($cwd_to_remove, $DEBUG, 0); }; + warn $@ if ($@ && $^W); + } + + # clear the arrays + @{ $files_to_unlink{$$} } = () + if exists $files_to_unlink{$$}; + @{ $dirs_to_unlink{$$} } = () + if exists $dirs_to_unlink{$$}; + } + } + + + # This is the sub called to register a file for deferred unlinking + # This could simply store the input parameters and defer everything + # until the END block. For now we do a bit of checking at this + # point in order to make sure that (1) we have a file/dir to delete + # and (2) we have been called with the correct arguments. + sub _deferred_unlink { + + croak 'Usage: _deferred_unlink($fh, $fname, $isdir)' + unless scalar(@_) == 3; + + my ($fh, $fname, $isdir) = @_; + + warn "Setting up deferred removal of $fname\n" + if $DEBUG; + + # make sure we save the absolute path for later cleanup + # OK to untaint because we only ever use this internally + # as a file path, never interpolating into the shell + $fname = Cwd::abs_path($fname); + ($fname) = $fname =~ /^(.*)$/; + + # If we have a directory, check that it is a directory + if ($isdir) { + + if (-d $fname) { + + # Directory exists so store it + # first on VMS turn []foo into [.foo] for rmtree + $fname = VMS::Filespec::vmspath($fname) if $^O eq 'VMS'; + $dirs_to_unlink{$$} = [] + unless exists $dirs_to_unlink{$$}; + push (@{ $dirs_to_unlink{$$} }, $fname); + + } else { + carp "Request to remove directory $fname could not be completed since it does not exist!\n" if $^W; + } + + } else { + + if (-f $fname) { + + # file exists so store handle and name for later removal + $files_to_unlink{$$} = [] + unless exists $files_to_unlink{$$}; + push(@{ $files_to_unlink{$$} }, [$fh, $fname]); + + } else { + carp "Request to remove file $fname could not be completed since it is not there!\n" if $^W; + } + + } + + } + + +} + +# normalize argument keys to upper case and do consistent handling +# of leading template vs TEMPLATE +sub _parse_args { + my $leading_template = (scalar(@_) % 2 == 1 ? shift(@_) : '' ); + my %args = @_; + %args = map { uc($_), $args{$_} } keys %args; + + # template (store it in an array so that it will + # disappear from the arg list of tempfile) + my @template = ( + exists $args{TEMPLATE} ? $args{TEMPLATE} : + $leading_template ? $leading_template : () + ); + delete $args{TEMPLATE}; + + return( \@template, \%args ); +} + +#pod =head1 OBJECT-ORIENTED INTERFACE +#pod +#pod This is the primary interface for interacting with +#pod C<File::Temp>. Using the OO interface a temporary file can be created +#pod when the object is constructed and the file can be removed when the +#pod object is no longer required. +#pod +#pod Note that there is no method to obtain the filehandle from the +#pod C<File::Temp> object. The object itself acts as a filehandle. The object +#pod isa C<IO::Handle> and isa C<IO::Seekable> so all those methods are +#pod available. +#pod +#pod Also, the object is configured such that it stringifies to the name of the +#pod temporary file and so can be compared to a filename directly. It numifies +#pod to the C<refaddr> the same as other handles and so can be compared to other +#pod handles with C<==>. +#pod +#pod $fh eq $filename # as a string +#pod $fh != \*STDOUT # as a number +#pod +#pod Available since 0.14. +#pod +#pod =over 4 +#pod +#pod =item B<new> +#pod +#pod Create a temporary file object. +#pod +#pod my $tmp = File::Temp->new(); +#pod +#pod by default the object is constructed as if C<tempfile> +#pod was called without options, but with the additional behaviour +#pod that the temporary file is removed by the object destructor +#pod if UNLINK is set to true (the default). +#pod +#pod Supported arguments are the same as for C<tempfile>: UNLINK +#pod (defaulting to true), DIR, EXLOCK and SUFFIX. Additionally, the filename +#pod template is specified using the TEMPLATE option. The OPEN option +#pod is not supported (the file is always opened). +#pod +#pod $tmp = File::Temp->new( TEMPLATE => 'tempXXXXX', +#pod DIR => 'mydir', +#pod SUFFIX => '.dat'); +#pod +#pod Arguments are case insensitive. +#pod +#pod Can call croak() if an error occurs. +#pod +#pod Available since 0.14. +#pod +#pod TEMPLATE available since 0.23 +#pod +#pod =cut + +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + + my ($maybe_template, $args) = _parse_args(@_); + + # see if they are unlinking (defaulting to yes) + my $unlink = (exists $args->{UNLINK} ? $args->{UNLINK} : 1 ); + delete $args->{UNLINK}; + + # Protect OPEN + delete $args->{OPEN}; + + # Open the file and retain file handle and file name + my ($fh, $path) = tempfile( @$maybe_template, %$args ); + + print "Tmp: $fh - $path\n" if $DEBUG; + + # Store the filename in the scalar slot + ${*$fh} = $path; + + # Cache the filename by pid so that the destructor can decide whether to remove it + $FILES_CREATED_BY_OBJECT{$$}{$path} = 1; + + # Store unlink information in hash slot (plus other constructor info) + %{*$fh} = %$args; + + # create the object + bless $fh, $class; + + # final method-based configuration + $fh->unlink_on_destroy( $unlink ); + + return $fh; +} + +#pod =item B<newdir> +#pod +#pod Create a temporary directory using an object oriented interface. +#pod +#pod $dir = File::Temp->newdir(); +#pod +#pod By default the directory is deleted when the object goes out of scope. +#pod +#pod Supports the same options as the C<tempdir> function. Note that directories +#pod created with this method default to CLEANUP => 1. +#pod +#pod $dir = File::Temp->newdir( $template, %options ); +#pod +#pod A template may be specified either with a leading template or +#pod with a TEMPLATE argument. +#pod +#pod Available since 0.19. +#pod +#pod TEMPLATE available since 0.23. +#pod +#pod =cut + +sub newdir { + my $self = shift; + + my ($maybe_template, $args) = _parse_args(@_); + + # handle CLEANUP without passing CLEANUP to tempdir + my $cleanup = (exists $args->{CLEANUP} ? $args->{CLEANUP} : 1 ); + delete $args->{CLEANUP}; + + my $tempdir = tempdir( @$maybe_template, %$args); + + # get a safe absolute path for cleanup, just like + # happens in _deferred_unlink + my $real_dir = Cwd::abs_path( $tempdir ); + ($real_dir) = $real_dir =~ /^(.*)$/; + + return bless { DIRNAME => $tempdir, + REALNAME => $real_dir, + CLEANUP => $cleanup, + LAUNCHPID => $$, + }, "File::Temp::Dir"; +} + +#pod =item B<filename> +#pod +#pod Return the name of the temporary file associated with this object +#pod (if the object was created using the "new" constructor). +#pod +#pod $filename = $tmp->filename; +#pod +#pod This method is called automatically when the object is used as +#pod a string. +#pod +#pod Current API available since 0.14 +#pod +#pod =cut + +sub filename { + my $self = shift; + return ${*$self}; +} + +sub STRINGIFY { + my $self = shift; + return $self->filename; +} + +# For reference, can't use '0+'=>\&Scalar::Util::refaddr directly because +# refaddr() demands one parameter only, whereas overload.pm calls with three +# even for unary operations like '0+'. +sub NUMIFY { + return refaddr($_[0]); +} + +#pod =item B<dirname> +#pod +#pod Return the name of the temporary directory associated with this +#pod object (if the object was created using the "newdir" constructor). +#pod +#pod $dirname = $tmpdir->dirname; +#pod +#pod This method is called automatically when the object is used in string context. +#pod +#pod =item B<unlink_on_destroy> +#pod +#pod Control whether the file is unlinked when the object goes out of scope. +#pod The file is removed if this value is true and $KEEP_ALL is not. +#pod +#pod $fh->unlink_on_destroy( 1 ); +#pod +#pod Default is for the file to be removed. +#pod +#pod Current API available since 0.15 +#pod +#pod =cut + +sub unlink_on_destroy { + my $self = shift; + if (@_) { + ${*$self}{UNLINK} = shift; + } + return ${*$self}{UNLINK}; +} + +#pod =item B<DESTROY> +#pod +#pod When the object goes out of scope, the destructor is called. This +#pod destructor will attempt to unlink the file (using L<unlink1|"unlink1">) +#pod if the constructor was called with UNLINK set to 1 (the default state +#pod if UNLINK is not specified). +#pod +#pod No error is given if the unlink fails. +#pod +#pod If the object has been passed to a child process during a fork, the +#pod file will be deleted when the object goes out of scope in the parent. +#pod +#pod For a temporary directory object the directory will be removed unless +#pod the CLEANUP argument was used in the constructor (and set to false) or +#pod C<unlink_on_destroy> was modified after creation. Note that if a temp +#pod directory is your current directory, it cannot be removed - a warning +#pod will be given in this case. C<chdir()> out of the directory before +#pod letting the object go out of scope. +#pod +#pod If the global variable $KEEP_ALL is true, the file or directory +#pod will not be removed. +#pod +#pod =cut + +sub DESTROY { + local($., $@, $!, $^E, $?); + my $self = shift; + + # Make sure we always remove the file from the global hash + # on destruction. This prevents the hash from growing uncontrollably + # and post-destruction there is no reason to know about the file. + my $file = $self->filename; + my $was_created_by_proc; + if (exists $FILES_CREATED_BY_OBJECT{$$}{$file}) { + $was_created_by_proc = 1; + delete $FILES_CREATED_BY_OBJECT{$$}{$file}; + } + + if (${*$self}{UNLINK} && !$KEEP_ALL) { + print "# ---------> Unlinking $self\n" if $DEBUG; + + # only delete if this process created it + return unless $was_created_by_proc; + + # The unlink1 may fail if the file has been closed + # by the caller. This leaves us with the decision + # of whether to refuse to remove the file or simply + # do an unlink without test. Seems to be silly + # to do this when we are trying to be careful + # about security + _force_writable( $file ); # for windows + unlink1( $self, $file ) + or unlink($file); + } +} + +#pod =back +#pod +#pod =head1 FUNCTIONS +#pod +#pod This section describes the recommended interface for generating +#pod temporary files and directories. +#pod +#pod =over 4 +#pod +#pod =item B<tempfile> +#pod +#pod This is the basic function to generate temporary files. +#pod The behaviour of the file can be changed using various options: +#pod +#pod $fh = tempfile(); +#pod ($fh, $filename) = tempfile(); +#pod +#pod Create a temporary file in the directory specified for temporary +#pod files, as specified by the tmpdir() function in L<File::Spec>. +#pod +#pod ($fh, $filename) = tempfile($template); +#pod +#pod Create a temporary file in the current directory using the supplied +#pod template. Trailing `X' characters are replaced with random letters to +#pod generate the filename. At least four `X' characters must be present +#pod at the end of the template. +#pod +#pod ($fh, $filename) = tempfile($template, SUFFIX => $suffix) +#pod +#pod Same as previously, except that a suffix is added to the template +#pod after the `X' translation. Useful for ensuring that a temporary +#pod filename has a particular extension when needed by other applications. +#pod But see the WARNING at the end. +#pod +#pod ($fh, $filename) = tempfile($template, DIR => $dir); +#pod +#pod Translates the template as before except that a directory name +#pod is specified. +#pod +#pod ($fh, $filename) = tempfile($template, TMPDIR => 1); +#pod +#pod Equivalent to specifying a DIR of "File::Spec->tmpdir", writing the file +#pod into the same temporary directory as would be used if no template was +#pod specified at all. +#pod +#pod ($fh, $filename) = tempfile($template, UNLINK => 1); +#pod +#pod Return the filename and filehandle as before except that the file is +#pod automatically removed when the program exits (dependent on +#pod $KEEP_ALL). Default is for the file to be removed if a file handle is +#pod requested and to be kept if the filename is requested. In a scalar +#pod context (where no filename is returned) the file is always deleted +#pod either (depending on the operating system) on exit or when it is +#pod closed (unless $KEEP_ALL is true when the temp file is created). +#pod +#pod Use the object-oriented interface if fine-grained control of when +#pod a file is removed is required. +#pod +#pod If the template is not specified, a template is always +#pod automatically generated. This temporary file is placed in tmpdir() +#pod (L<File::Spec>) unless a directory is specified explicitly with the +#pod DIR option. +#pod +#pod $fh = tempfile( DIR => $dir ); +#pod +#pod If called in scalar context, only the filehandle is returned and the +#pod file will automatically be deleted when closed on operating systems +#pod that support this (see the description of tmpfile() elsewhere in this +#pod document). This is the preferred mode of operation, as if you only +#pod have a filehandle, you can never create a race condition by fumbling +#pod with the filename. On systems that can not unlink an open file or can +#pod not mark a file as temporary when it is opened (for example, Windows +#pod NT uses the C<O_TEMPORARY> flag) the file is marked for deletion when +#pod the program ends (equivalent to setting UNLINK to 1). The C<UNLINK> +#pod flag is ignored if present. +#pod +#pod (undef, $filename) = tempfile($template, OPEN => 0); +#pod +#pod This will return the filename based on the template but +#pod will not open this file. Cannot be used in conjunction with +#pod UNLINK set to true. Default is to always open the file +#pod to protect from possible race conditions. A warning is issued +#pod if warnings are turned on. Consider using the tmpnam() +#pod and mktemp() functions described elsewhere in this document +#pod if opening the file is not required. +#pod +#pod To open the temporary filehandle with O_EXLOCK (open with exclusive +#pod file lock) use C<< EXLOCK=>1 >>. This is supported only by some +#pod operating systems (most notably BSD derived systems). By default +#pod EXLOCK will be false. Former C<File::Temp> versions set EXLOCK to +#pod true, so to be sure to get an unlocked filehandle also with older +#pod versions, explicitly set C<< EXLOCK=>0 >>. +#pod +#pod ($fh, $filename) = tempfile($template, EXLOCK => 1); +#pod +#pod Options can be combined as required. +#pod +#pod Will croak() if there is an error. +#pod +#pod Available since 0.05. +#pod +#pod UNLINK flag available since 0.10. +#pod +#pod TMPDIR flag available since 0.19. +#pod +#pod EXLOCK flag available since 0.19. +#pod +#pod =cut + +sub tempfile { + if ( @_ && $_[0] eq 'File::Temp' ) { + croak "'tempfile' can't be called as a method"; + } + # Can not check for argument count since we can have any + # number of args + + # Default options + my %options = ( + "DIR" => undef, # Directory prefix + "SUFFIX" => '', # Template suffix + "UNLINK" => 0, # Do not unlink file on exit + "OPEN" => 1, # Open file + "TMPDIR" => 0, # Place tempfile in tempdir if template specified + "EXLOCK" => 0, # Open file with O_EXLOCK + ); + + # Check to see whether we have an odd or even number of arguments + my ($maybe_template, $args) = _parse_args(@_); + my $template = @$maybe_template ? $maybe_template->[0] : undef; + + # Read the options and merge with defaults + %options = (%options, %$args); + + # First decision is whether or not to open the file + if (! $options{"OPEN"}) { + + warn "tempfile(): temporary filename requested but not opened.\nPossibly unsafe, consider using tempfile() with OPEN set to true\n" + if $^W; + + } + + if ($options{"DIR"} and $^O eq 'VMS') { + + # on VMS turn []foo into [.foo] for concatenation + $options{"DIR"} = VMS::Filespec::vmspath($options{"DIR"}); + } + + # Construct the template + + # Have a choice of trying to work around the mkstemp/mktemp/tmpnam etc + # functions or simply constructing a template and using _gettemp() + # explicitly. Go for the latter + + # First generate a template if not defined and prefix the directory + # If no template must prefix the temp directory + if (defined $template) { + # End up with current directory if neither DIR not TMPDIR are set + if ($options{"DIR"}) { + + $template = File::Spec->catfile($options{"DIR"}, $template); + + } elsif ($options{TMPDIR}) { + + $template = File::Spec->catfile(_wrap_file_spec_tmpdir(), $template ); + + } + + } else { + + if ($options{"DIR"}) { + + $template = File::Spec->catfile($options{"DIR"}, TEMPXXX); + + } else { + + $template = File::Spec->catfile(_wrap_file_spec_tmpdir(), TEMPXXX); + + } + + } + + # Now add a suffix + $template .= $options{"SUFFIX"}; + + # Determine whether we should tell _gettemp to unlink the file + # On unix this is irrelevant and can be worked out after the file is + # opened (simply by unlinking the open filehandle). On Windows or VMS + # we have to indicate temporary-ness when we open the file. In general + # we only want a true temporary file if we are returning just the + # filehandle - if the user wants the filename they probably do not + # want the file to disappear as soon as they close it (which may be + # important if they want a child process to use the file) + # For this reason, tie unlink_on_close to the return context regardless + # of OS. + my $unlink_on_close = ( wantarray ? 0 : 1); + + # Create the file + my ($fh, $path, $errstr); + croak "Error in tempfile() using template $template: $errstr" + unless (($fh, $path) = _gettemp($template, + "open" => $options{'OPEN'}, + "mkdir"=> 0 , + "unlink_on_close" => $unlink_on_close, + "suffixlen" => length($options{'SUFFIX'}), + "ErrStr" => \$errstr, + "use_exlock" => $options{EXLOCK}, + ) ); + + # Set up an exit handler that can do whatever is right for the + # system. This removes files at exit when requested explicitly or when + # system is asked to unlink_on_close but is unable to do so because + # of OS limitations. + # The latter should be achieved by using a tied filehandle. + # Do not check return status since this is all done with END blocks. + _deferred_unlink($fh, $path, 0) if $options{"UNLINK"}; + + # Return + if (wantarray()) { + + if ($options{'OPEN'}) { + return ($fh, $path); + } else { + return (undef, $path); + } + + } else { + + # Unlink the file. It is up to unlink0 to decide what to do with + # this (whether to unlink now or to defer until later) + unlink0($fh, $path) or croak "Error unlinking file $path using unlink0"; + + # Return just the filehandle. + return $fh; + } + + +} + +# On Windows under taint mode, File::Spec could suggest "C:\" as a tempdir +# which might not be writable. If that is the case, we fallback to a +# user directory. See https://rt.cpan.org/Ticket/Display.html?id=60340 + +{ + my ($alt_tmpdir, $checked); + + sub _wrap_file_spec_tmpdir { + return File::Spec->tmpdir unless $^O eq "MSWin32" && ${^TAINT}; + + if ( $checked ) { + return $alt_tmpdir ? $alt_tmpdir : File::Spec->tmpdir; + } + + # probe what File::Spec gives and find a fallback + my $xxpath = _replace_XX( "X" x 10, 0 ); + + # First, see if File::Spec->tmpdir is writable + my $tmpdir = File::Spec->tmpdir; + my $testpath = File::Spec->catdir( $tmpdir, $xxpath ); + if (mkdir( $testpath, 0700) ) { + $checked = 1; + rmdir $testpath; + return $tmpdir; + } + + # Next, see if CSIDL_LOCAL_APPDATA is writable + require Win32; + my $local_app = File::Spec->catdir( + Win32::GetFolderPath( Win32::CSIDL_LOCAL_APPDATA() ), 'Temp' + ); + $testpath = File::Spec->catdir( $local_app, $xxpath ); + if ( -e $local_app or mkdir( $local_app, 0700 ) ) { + if (mkdir( $testpath, 0700) ) { + $checked = 1; + rmdir $testpath; + return $alt_tmpdir = $local_app; + } + } + + # Can't find something writable + croak << "HERE"; +Couldn't find a writable temp directory in taint mode. Tried: + $tmpdir + $local_app + +Try setting and untainting the TMPDIR environment variable. +HERE + + } +} + +#pod =item B<tempdir> +#pod +#pod This is the recommended interface for creation of temporary +#pod directories. By default the directory will not be removed on exit +#pod (that is, it won't be temporary; this behaviour can not be changed +#pod because of issues with backwards compatibility). To enable removal +#pod either use the CLEANUP option which will trigger removal on program +#pod exit, or consider using the "newdir" method in the object interface which +#pod will allow the directory to be cleaned up when the object goes out of +#pod scope. +#pod +#pod The behaviour of the function depends on the arguments: +#pod +#pod $tempdir = tempdir(); +#pod +#pod Create a directory in tmpdir() (see L<File::Spec|File::Spec>). +#pod +#pod $tempdir = tempdir( $template ); +#pod +#pod Create a directory from the supplied template. This template is +#pod similar to that described for tempfile(). `X' characters at the end +#pod of the template are replaced with random letters to construct the +#pod directory name. At least four `X' characters must be in the template. +#pod +#pod $tempdir = tempdir ( DIR => $dir ); +#pod +#pod Specifies the directory to use for the temporary directory. +#pod The temporary directory name is derived from an internal template. +#pod +#pod $tempdir = tempdir ( $template, DIR => $dir ); +#pod +#pod Prepend the supplied directory name to the template. The template +#pod should not include parent directory specifications itself. Any parent +#pod directory specifications are removed from the template before +#pod prepending the supplied directory. +#pod +#pod $tempdir = tempdir ( $template, TMPDIR => 1 ); +#pod +#pod Using the supplied template, create the temporary directory in +#pod a standard location for temporary files. Equivalent to doing +#pod +#pod $tempdir = tempdir ( $template, DIR => File::Spec->tmpdir); +#pod +#pod but shorter. Parent directory specifications are stripped from the +#pod template itself. The C<TMPDIR> option is ignored if C<DIR> is set +#pod explicitly. Additionally, C<TMPDIR> is implied if neither a template +#pod nor a directory are supplied. +#pod +#pod $tempdir = tempdir( $template, CLEANUP => 1); +#pod +#pod Create a temporary directory using the supplied template, but +#pod attempt to remove it (and all files inside it) when the program +#pod exits. Note that an attempt will be made to remove all files from +#pod the directory even if they were not created by this module (otherwise +#pod why ask to clean it up?). The directory removal is made with +#pod the rmtree() function from the L<File::Path|File::Path> module. +#pod Of course, if the template is not specified, the temporary directory +#pod will be created in tmpdir() and will also be removed at program exit. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +# ' + +sub tempdir { + if ( @_ && $_[0] eq 'File::Temp' ) { + croak "'tempdir' can't be called as a method"; + } + + # Can not check for argument count since we can have any + # number of args + + # Default options + my %options = ( + "CLEANUP" => 0, # Remove directory on exit + "DIR" => '', # Root directory + "TMPDIR" => 0, # Use tempdir with template + ); + + # Check to see whether we have an odd or even number of arguments + my ($maybe_template, $args) = _parse_args(@_); + my $template = @$maybe_template ? $maybe_template->[0] : undef; + + # Read the options and merge with defaults + %options = (%options, %$args); + + # Modify or generate the template + + # Deal with the DIR and TMPDIR options + if (defined $template) { + + # Need to strip directory path if using DIR or TMPDIR + if ($options{'TMPDIR'} || $options{'DIR'}) { + + # Strip parent directory from the filename + # + # There is no filename at the end + $template = VMS::Filespec::vmspath($template) if $^O eq 'VMS'; + my ($volume, $directories, undef) = File::Spec->splitpath( $template, 1); + + # Last directory is then our template + $template = (File::Spec->splitdir($directories))[-1]; + + # Prepend the supplied directory or temp dir + if ($options{"DIR"}) { + + $template = File::Spec->catdir($options{"DIR"}, $template); + + } elsif ($options{TMPDIR}) { + + # Prepend tmpdir + $template = File::Spec->catdir(_wrap_file_spec_tmpdir(), $template); + + } + + } + + } else { + + if ($options{"DIR"}) { + + $template = File::Spec->catdir($options{"DIR"}, TEMPXXX); + + } else { + + $template = File::Spec->catdir(_wrap_file_spec_tmpdir(), TEMPXXX); + + } + + } + + # Create the directory + my $tempdir; + my $suffixlen = 0; + if ($^O eq 'VMS') { # dir names can end in delimiters + $template =~ m/([\.\]:>]+)$/; + $suffixlen = length($1); + } + if ( ($^O eq 'MacOS') && (substr($template, -1) eq ':') ) { + # dir name has a trailing ':' + ++$suffixlen; + } + + my $errstr; + croak "Error in tempdir() using $template: $errstr" + unless ((undef, $tempdir) = _gettemp($template, + "open" => 0, + "mkdir"=> 1 , + "suffixlen" => $suffixlen, + "ErrStr" => \$errstr, + ) ); + + # Install exit handler; must be dynamic to get lexical + if ( $options{'CLEANUP'} && -d $tempdir) { + _deferred_unlink(undef, $tempdir, 1); + } + + # Return the dir name + return $tempdir; + +} + +#pod =back +#pod +#pod =head1 MKTEMP FUNCTIONS +#pod +#pod The following functions are Perl implementations of the +#pod mktemp() family of temp file generation system calls. +#pod +#pod =over 4 +#pod +#pod =item B<mkstemp> +#pod +#pod Given a template, returns a filehandle to the temporary file and the name +#pod of the file. +#pod +#pod ($fh, $name) = mkstemp( $template ); +#pod +#pod In scalar context, just the filehandle is returned. +#pod +#pod The template may be any filename with some number of X's appended +#pod to it, for example F</tmp/temp.XXXX>. The trailing X's are replaced +#pod with unique alphanumeric combinations. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + + + +sub mkstemp { + + croak "Usage: mkstemp(template)" + if scalar(@_) != 1; + + my $template = shift; + + my ($fh, $path, $errstr); + croak "Error in mkstemp using $template: $errstr" + unless (($fh, $path) = _gettemp($template, + "open" => 1, + "mkdir"=> 0 , + "suffixlen" => 0, + "ErrStr" => \$errstr, + ) ); + + if (wantarray()) { + return ($fh, $path); + } else { + return $fh; + } + +} + + +#pod =item B<mkstemps> +#pod +#pod Similar to mkstemp(), except that an extra argument can be supplied +#pod with a suffix to be appended to the template. +#pod +#pod ($fh, $name) = mkstemps( $template, $suffix ); +#pod +#pod For example a template of C<testXXXXXX> and suffix of C<.dat> +#pod would generate a file similar to F<testhGji_w.dat>. +#pod +#pod Returns just the filehandle alone when called in scalar context. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +sub mkstemps { + + croak "Usage: mkstemps(template, suffix)" + if scalar(@_) != 2; + + + my $template = shift; + my $suffix = shift; + + $template .= $suffix; + + my ($fh, $path, $errstr); + croak "Error in mkstemps using $template: $errstr" + unless (($fh, $path) = _gettemp($template, + "open" => 1, + "mkdir"=> 0 , + "suffixlen" => length($suffix), + "ErrStr" => \$errstr, + ) ); + + if (wantarray()) { + return ($fh, $path); + } else { + return $fh; + } + +} + +#pod =item B<mkdtemp> +#pod +#pod Create a directory from a template. The template must end in +#pod X's that are replaced by the routine. +#pod +#pod $tmpdir_name = mkdtemp($template); +#pod +#pod Returns the name of the temporary directory created. +#pod +#pod Directory must be removed by the caller. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +#' # for emacs + +sub mkdtemp { + + croak "Usage: mkdtemp(template)" + if scalar(@_) != 1; + + my $template = shift; + my $suffixlen = 0; + if ($^O eq 'VMS') { # dir names can end in delimiters + $template =~ m/([\.\]:>]+)$/; + $suffixlen = length($1); + } + if ( ($^O eq 'MacOS') && (substr($template, -1) eq ':') ) { + # dir name has a trailing ':' + ++$suffixlen; + } + my ($junk, $tmpdir, $errstr); + croak "Error creating temp directory from template $template\: $errstr" + unless (($junk, $tmpdir) = _gettemp($template, + "open" => 0, + "mkdir"=> 1 , + "suffixlen" => $suffixlen, + "ErrStr" => \$errstr, + ) ); + + return $tmpdir; + +} + +#pod =item B<mktemp> +#pod +#pod Returns a valid temporary filename but does not guarantee +#pod that the file will not be opened by someone else. +#pod +#pod $unopened_file = mktemp($template); +#pod +#pod Template is the same as that required by mkstemp(). +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +sub mktemp { + + croak "Usage: mktemp(template)" + if scalar(@_) != 1; + + my $template = shift; + + my ($tmpname, $junk, $errstr); + croak "Error getting name to temp file from template $template: $errstr" + unless (($junk, $tmpname) = _gettemp($template, + "open" => 0, + "mkdir"=> 0 , + "suffixlen" => 0, + "ErrStr" => \$errstr, + ) ); + + return $tmpname; +} + +#pod =back +#pod +#pod =head1 POSIX FUNCTIONS +#pod +#pod This section describes the re-implementation of the tmpnam() +#pod and tmpfile() functions described in L<POSIX> +#pod using the mkstemp() from this module. +#pod +#pod Unlike the L<POSIX|POSIX> implementations, the directory used +#pod for the temporary file is not specified in a system include +#pod file (C<P_tmpdir>) but simply depends on the choice of tmpdir() +#pod returned by L<File::Spec|File::Spec>. On some implementations this +#pod location can be set using the C<TMPDIR> environment variable, which +#pod may not be secure. +#pod If this is a problem, simply use mkstemp() and specify a template. +#pod +#pod =over 4 +#pod +#pod =item B<tmpnam> +#pod +#pod When called in scalar context, returns the full name (including path) +#pod of a temporary file (uses mktemp()). The only check is that the file does +#pod not already exist, but there is no guarantee that that condition will +#pod continue to apply. +#pod +#pod $file = tmpnam(); +#pod +#pod When called in list context, a filehandle to the open file and +#pod a filename are returned. This is achieved by calling mkstemp() +#pod after constructing a suitable template. +#pod +#pod ($fh, $file) = tmpnam(); +#pod +#pod If possible, this form should be used to prevent possible +#pod race conditions. +#pod +#pod See L<File::Spec/tmpdir> for information on the choice of temporary +#pod directory for a particular operating system. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +sub tmpnam { + + # Retrieve the temporary directory name + my $tmpdir = _wrap_file_spec_tmpdir(); + + # XXX I don't know under what circumstances this occurs, -- xdg 2016-04-02 + croak "Error temporary directory is not writable" + if $tmpdir eq ''; + + # Use a ten character template and append to tmpdir + my $template = File::Spec->catfile($tmpdir, TEMPXXX); + + if (wantarray() ) { + return mkstemp($template); + } else { + return mktemp($template); + } + +} + +#pod =item B<tmpfile> +#pod +#pod Returns the filehandle of a temporary file. +#pod +#pod $fh = tmpfile(); +#pod +#pod The file is removed when the filehandle is closed or when the program +#pod exits. No access to the filename is provided. +#pod +#pod If the temporary file can not be created undef is returned. +#pod Currently this command will probably not work when the temporary +#pod directory is on an NFS file system. +#pod +#pod Will croak() if there is an error. +#pod +#pod Available since 0.05. +#pod +#pod Returning undef if unable to create file added in 0.12. +#pod +#pod =cut + +sub tmpfile { + + # Simply call tmpnam() in a list context + my ($fh, $file) = tmpnam(); + + # Make sure file is removed when filehandle is closed + # This will fail on NFS + unlink0($fh, $file) + or return undef; + + return $fh; + +} + +#pod =back +#pod +#pod =head1 ADDITIONAL FUNCTIONS +#pod +#pod These functions are provided for backwards compatibility +#pod with common tempfile generation C library functions. +#pod +#pod They are not exported and must be addressed using the full package +#pod name. +#pod +#pod =over 4 +#pod +#pod =item B<tempnam> +#pod +#pod Return the name of a temporary file in the specified directory +#pod using a prefix. The file is guaranteed not to exist at the time +#pod the function was called, but such guarantees are good for one +#pod clock tick only. Always use the proper form of C<sysopen> +#pod with C<O_CREAT | O_EXCL> if you must open such a filename. +#pod +#pod $filename = File::Temp::tempnam( $dir, $prefix ); +#pod +#pod Equivalent to running mktemp() with $dir/$prefixXXXXXXXX +#pod (using unix file convention as an example) +#pod +#pod Because this function uses mktemp(), it can suffer from race conditions. +#pod +#pod Will croak() if there is an error. +#pod +#pod Current API available since 0.05. +#pod +#pod =cut + +sub tempnam { + + croak 'Usage tempnam($dir, $prefix)' unless scalar(@_) == 2; + + my ($dir, $prefix) = @_; + + # Add a string to the prefix + $prefix .= 'XXXXXXXX'; + + # Concatenate the directory to the file + my $template = File::Spec->catfile($dir, $prefix); + + return mktemp($template); + +} + +#pod =back +#pod +#pod =head1 UTILITY FUNCTIONS +#pod +#pod Useful functions for dealing with the filehandle and filename. +#pod +#pod =over 4 +#pod +#pod =item B<unlink0> +#pod +#pod Given an open filehandle and the associated filename, make a safe +#pod unlink. This is achieved by first checking that the filename and +#pod filehandle initially point to the same file and that the number of +#pod links to the file is 1 (all fields returned by stat() are compared). +#pod Then the filename is unlinked and the filehandle checked once again to +#pod verify that the number of links on that file is now 0. This is the +#pod closest you can come to making sure that the filename unlinked was the +#pod same as the file whose descriptor you hold. +#pod +#pod unlink0($fh, $path) +#pod or die "Error unlinking file $path safely"; +#pod +#pod Returns false on error but croaks() if there is a security +#pod anomaly. The filehandle is not closed since on some occasions this is +#pod not required. +#pod +#pod On some platforms, for example Windows NT, it is not possible to +#pod unlink an open file (the file must be closed first). On those +#pod platforms, the actual unlinking is deferred until the program ends and +#pod good status is returned. A check is still performed to make sure that +#pod the filehandle and filename are pointing to the same thing (but not at +#pod the time the end block is executed since the deferred removal may not +#pod have access to the filehandle). +#pod +#pod Additionally, on Windows NT not all the fields returned by stat() can +#pod be compared. For example, the C<dev> and C<rdev> fields seem to be +#pod different. Also, it seems that the size of the file returned by stat() +#pod does not always agree, with C<stat(FH)> being more accurate than +#pod C<stat(filename)>, presumably because of caching issues even when +#pod using autoflush (this is usually overcome by waiting a while after +#pod writing to the tempfile before attempting to C<unlink0> it). +#pod +#pod Finally, on NFS file systems the link count of the file handle does +#pod not always go to zero immediately after unlinking. Currently, this +#pod command is expected to fail on NFS disks. +#pod +#pod This function is disabled if the global variable $KEEP_ALL is true +#pod and an unlink on open file is supported. If the unlink is to be deferred +#pod to the END block, the file is still registered for removal. +#pod +#pod This function should not be called if you are using the object oriented +#pod interface since the it will interfere with the object destructor deleting +#pod the file. +#pod +#pod Available Since 0.05. +#pod +#pod If can not unlink open file, defer removal until later available since 0.06. +#pod +#pod =cut + +sub unlink0 { + + croak 'Usage: unlink0(filehandle, filename)' + unless scalar(@_) == 2; + + # Read args + my ($fh, $path) = @_; + + cmpstat($fh, $path) or return 0; + + # attempt remove the file (does not work on some platforms) + if (_can_unlink_opened_file()) { + + # return early (Without unlink) if we have been instructed to retain files. + return 1 if $KEEP_ALL; + + # XXX: do *not* call this on a directory; possible race + # resulting in recursive removal + croak "unlink0: $path has become a directory!" if -d $path; + unlink($path) or return 0; + + # Stat the filehandle + my @fh = stat $fh; + + print "Link count = $fh[3] \n" if $DEBUG; + + # Make sure that the link count is zero + # - Cygwin provides deferred unlinking, however, + # on Win9x the link count remains 1 + # On NFS the link count may still be 1 but we can't know that + # we are on NFS. Since we can't be sure, we'll defer it + + return 1 if $fh[3] == 0 || $^O eq 'cygwin'; + } + # fall-through if we can't unlink now + _deferred_unlink($fh, $path, 0); + return 1; +} + +#pod =item B<cmpstat> +#pod +#pod Compare C<stat> of filehandle with C<stat> of provided filename. This +#pod can be used to check that the filename and filehandle initially point +#pod to the same file and that the number of links to the file is 1 (all +#pod fields returned by stat() are compared). +#pod +#pod cmpstat($fh, $path) +#pod or die "Error comparing handle with file"; +#pod +#pod Returns false if the stat information differs or if the link count is +#pod greater than 1. Calls croak if there is a security anomaly. +#pod +#pod On certain platforms, for example Windows, not all the fields returned by stat() +#pod can be compared. For example, the C<dev> and C<rdev> fields seem to be +#pod different in Windows. Also, it seems that the size of the file +#pod returned by stat() does not always agree, with C<stat(FH)> being more +#pod accurate than C<stat(filename)>, presumably because of caching issues +#pod even when using autoflush (this is usually overcome by waiting a while +#pod after writing to the tempfile before attempting to C<unlink0> it). +#pod +#pod Not exported by default. +#pod +#pod Current API available since 0.14. +#pod +#pod =cut + +sub cmpstat { + + croak 'Usage: cmpstat(filehandle, filename)' + unless scalar(@_) == 2; + + # Read args + my ($fh, $path) = @_; + + warn "Comparing stat\n" + if $DEBUG; + + # Stat the filehandle - which may be closed if someone has manually + # closed the file. Can not turn off warnings without using $^W + # unless we upgrade to 5.006 minimum requirement + my @fh; + { + local ($^W) = 0; + @fh = stat $fh; + } + return unless @fh; + + if ($fh[3] > 1 && $^W) { + carp "unlink0: fstat found too many links; SB=@fh" if $^W; + } + + # Stat the path + my @path = stat $path; + + unless (@path) { + carp "unlink0: $path is gone already" if $^W; + return; + } + + # this is no longer a file, but may be a directory, or worse + unless (-f $path) { + confess "panic: $path is no longer a file: SB=@fh"; + } + + # Do comparison of each member of the array + # On WinNT dev and rdev seem to be different + # depending on whether it is a file or a handle. + # Cannot simply compare all members of the stat return + # Select the ones we can use + my @okstat = (0..$#fh); # Use all by default + if ($^O eq 'MSWin32') { + @okstat = (1,2,3,4,5,7,8,9,10); + } elsif ($^O eq 'os2') { + @okstat = (0, 2..$#fh); + } elsif ($^O eq 'VMS') { # device and file ID are sufficient + @okstat = (0, 1); + } elsif ($^O eq 'dos') { + @okstat = (0,2..7,11..$#fh); + } elsif ($^O eq 'mpeix') { + @okstat = (0..4,8..10); + } + + # Now compare each entry explicitly by number + for (@okstat) { + print "Comparing: $_ : $fh[$_] and $path[$_]\n" if $DEBUG; + # Use eq rather than == since rdev, blksize, and blocks (6, 11, + # and 12) will be '' on platforms that do not support them. This + # is fine since we are only comparing integers. + unless ($fh[$_] eq $path[$_]) { + warn "Did not match $_ element of stat\n" if $DEBUG; + return 0; + } + } + + return 1; +} + +#pod =item B<unlink1> +#pod +#pod Similar to C<unlink0> except after file comparison using cmpstat, the +#pod filehandle is closed prior to attempting to unlink the file. This +#pod allows the file to be removed without using an END block, but does +#pod mean that the post-unlink comparison of the filehandle state provided +#pod by C<unlink0> is not available. +#pod +#pod unlink1($fh, $path) +#pod or die "Error closing and unlinking file"; +#pod +#pod Usually called from the object destructor when using the OO interface. +#pod +#pod Not exported by default. +#pod +#pod This function is disabled if the global variable $KEEP_ALL is true. +#pod +#pod Can call croak() if there is a security anomaly during the stat() +#pod comparison. +#pod +#pod Current API available since 0.14. +#pod +#pod =cut + +sub unlink1 { + croak 'Usage: unlink1(filehandle, filename)' + unless scalar(@_) == 2; + + # Read args + my ($fh, $path) = @_; + + cmpstat($fh, $path) or return 0; + + # Close the file + close( $fh ) or return 0; + + # Make sure the file is writable (for windows) + _force_writable( $path ); + + # return early (without unlink) if we have been instructed to retain files. + return 1 if $KEEP_ALL; + + # remove the file + return unlink($path); +} + +#pod =item B<cleanup> +#pod +#pod Calling this function will cause any temp files or temp directories +#pod that are registered for removal to be removed. This happens automatically +#pod when the process exits but can be triggered manually if the caller is sure +#pod that none of the temp files are required. This method can be registered as +#pod an Apache callback. +#pod +#pod Note that if a temp directory is your current directory, it cannot be +#pod removed. C<chdir()> out of the directory first before calling +#pod C<cleanup()>. (For the cleanup at program exit when the CLEANUP flag +#pod is set, this happens automatically.) +#pod +#pod On OSes where temp files are automatically removed when the temp file +#pod is closed, calling this function will have no effect other than to remove +#pod temporary directories (which may include temporary files). +#pod +#pod File::Temp::cleanup(); +#pod +#pod Not exported by default. +#pod +#pod Current API available since 0.15. +#pod +#pod =back +#pod +#pod =head1 PACKAGE VARIABLES +#pod +#pod These functions control the global state of the package. +#pod +#pod =over 4 +#pod +#pod =item B<safe_level> +#pod +#pod Controls the lengths to which the module will go to check the safety of the +#pod temporary file or directory before proceeding. +#pod Options are: +#pod +#pod =over 8 +#pod +#pod =item STANDARD +#pod +#pod Do the basic security measures to ensure the directory exists and is +#pod writable, that temporary files are opened only if they do not already +#pod exist, and that possible race conditions are avoided. Finally the +#pod L<unlink0|"unlink0"> function is used to remove files safely. +#pod +#pod =item MEDIUM +#pod +#pod In addition to the STANDARD security, the output directory is checked +#pod to make sure that it is owned either by root or the user running the +#pod program. If the directory is writable by group or by other, it is then +#pod checked to make sure that the sticky bit is set. +#pod +#pod Will not work on platforms that do not support the C<-k> test +#pod for sticky bit. +#pod +#pod =item HIGH +#pod +#pod In addition to the MEDIUM security checks, also check for the +#pod possibility of ``chown() giveaway'' using the L<POSIX|POSIX> +#pod sysconf() function. If this is a possibility, each directory in the +#pod path is checked in turn for safeness, recursively walking back to the +#pod root directory. +#pod +#pod For platforms that do not support the L<POSIX|POSIX> +#pod C<_PC_CHOWN_RESTRICTED> symbol (for example, Windows NT) it is +#pod assumed that ``chown() giveaway'' is possible and the recursive test +#pod is performed. +#pod +#pod =back +#pod +#pod The level can be changed as follows: +#pod +#pod File::Temp->safe_level( File::Temp::HIGH ); +#pod +#pod The level constants are not exported by the module. +#pod +#pod Currently, you must be running at least perl v5.6.0 in order to +#pod run with MEDIUM or HIGH security. This is simply because the +#pod safety tests use functions from L<Fcntl|Fcntl> that are not +#pod available in older versions of perl. The problem is that the version +#pod number for Fcntl is the same in perl 5.6.0 and in 5.005_03 even though +#pod they are different versions. +#pod +#pod On systems that do not support the HIGH or MEDIUM safety levels +#pod (for example Win NT or OS/2) any attempt to change the level will +#pod be ignored. The decision to ignore rather than raise an exception +#pod allows portable programs to be written with high security in mind +#pod for the systems that can support this without those programs failing +#pod on systems where the extra tests are irrelevant. +#pod +#pod If you really need to see whether the change has been accepted +#pod simply examine the return value of C<safe_level>. +#pod +#pod $newlevel = File::Temp->safe_level( File::Temp::HIGH ); +#pod die "Could not change to high security" +#pod if $newlevel != File::Temp::HIGH; +#pod +#pod Available since 0.05. +#pod +#pod =cut + +{ + # protect from using the variable itself + my $LEVEL = STANDARD; + sub safe_level { + my $self = shift; + if (@_) { + my $level = shift; + if (($level != STANDARD) && ($level != MEDIUM) && ($level != HIGH)) { + carp "safe_level: Specified level ($level) not STANDARD, MEDIUM or HIGH - ignoring\n" if $^W; + } else { + # Don't allow this on perl 5.005 or earlier + if ($] < 5.006 && $level != STANDARD) { + # Cant do MEDIUM or HIGH checks + croak "Currently requires perl 5.006 or newer to do the safe checks"; + } + # Check that we are allowed to change level + # Silently ignore if we can not. + $LEVEL = $level if _can_do_level($level); + } + } + return $LEVEL; + } +} + +#pod =item TopSystemUID +#pod +#pod This is the highest UID on the current system that refers to a root +#pod UID. This is used to make sure that the temporary directory is +#pod owned by a system UID (C<root>, C<bin>, C<sys> etc) rather than +#pod simply by root. +#pod +#pod This is required since on many unix systems C</tmp> is not owned +#pod by root. +#pod +#pod Default is to assume that any UID less than or equal to 10 is a root +#pod UID. +#pod +#pod File::Temp->top_system_uid(10); +#pod my $topid = File::Temp->top_system_uid; +#pod +#pod This value can be adjusted to reduce security checking if required. +#pod The value is only relevant when C<safe_level> is set to MEDIUM or higher. +#pod +#pod Available since 0.05. +#pod +#pod =cut + +{ + my $TopSystemUID = 10; + $TopSystemUID = 197108 if $^O eq 'interix'; # "Administrator" + sub top_system_uid { + my $self = shift; + if (@_) { + my $newuid = shift; + croak "top_system_uid: UIDs should be numeric" + unless $newuid =~ /^\d+$/s; + $TopSystemUID = $newuid; + } + return $TopSystemUID; + } +} + +#pod =item B<$KEEP_ALL> +#pod +#pod Controls whether temporary files and directories should be retained +#pod regardless of any instructions in the program to remove them +#pod automatically. This is useful for debugging but should not be used in +#pod production code. +#pod +#pod $File::Temp::KEEP_ALL = 1; +#pod +#pod Default is for files to be removed as requested by the caller. +#pod +#pod In some cases, files will only be retained if this variable is true +#pod when the file is created. This means that you can not create a temporary +#pod file, set this variable and expect the temp file to still be around +#pod when the program exits. +#pod +#pod =item B<$DEBUG> +#pod +#pod Controls whether debugging messages should be enabled. +#pod +#pod $File::Temp::DEBUG = 1; +#pod +#pod Default is for debugging mode to be disabled. +#pod +#pod Available since 0.15. +#pod +#pod =back +#pod +#pod =head1 WARNING +#pod +#pod For maximum security, endeavour always to avoid ever looking at, +#pod touching, or even imputing the existence of the filename. You do not +#pod know that that filename is connected to the same file as the handle +#pod you have, and attempts to check this can only trigger more race +#pod conditions. It's far more secure to use the filehandle alone and +#pod dispense with the filename altogether. +#pod +#pod If you need to pass the handle to something that expects a filename +#pod then on a unix system you can use C<"/dev/fd/" . fileno($fh)> for +#pod arbitrary programs. Perl code that uses the 2-argument version of +#pod C<< open >> can be passed C<< "+<=&" . fileno($fh) >>. Otherwise you +#pod will need to pass the filename. You will have to clear the +#pod close-on-exec bit on that file descriptor before passing it to another +#pod process. +#pod +#pod use Fcntl qw/F_SETFD F_GETFD/; +#pod fcntl($tmpfh, F_SETFD, 0) +#pod or die "Can't clear close-on-exec flag on temp fh: $!\n"; +#pod +#pod =head2 Temporary files and NFS +#pod +#pod Some problems are associated with using temporary files that reside +#pod on NFS file systems and it is recommended that a local filesystem +#pod is used whenever possible. Some of the security tests will most probably +#pod fail when the temp file is not local. Additionally, be aware that +#pod the performance of I/O operations over NFS will not be as good as for +#pod a local disk. +#pod +#pod =head2 Forking +#pod +#pod In some cases files created by File::Temp are removed from within an +#pod END block. Since END blocks are triggered when a child process exits +#pod (unless C<POSIX::_exit()> is used by the child) File::Temp takes care +#pod to only remove those temp files created by a particular process ID. This +#pod means that a child will not attempt to remove temp files created by the +#pod parent process. +#pod +#pod If you are forking many processes in parallel that are all creating +#pod temporary files, you may need to reset the random number seed using +#pod srand(EXPR) in each child else all the children will attempt to walk +#pod through the same set of random file names and may well cause +#pod themselves to give up if they exceed the number of retry attempts. +#pod +#pod =head2 Directory removal +#pod +#pod Note that if you have chdir'ed into the temporary directory and it is +#pod subsequently cleaned up (either in the END block or as part of object +#pod destruction), then you will get a warning from File::Path::rmtree(). +#pod +#pod =head2 Taint mode +#pod +#pod If you need to run code under taint mode, updating to the latest +#pod L<File::Spec> is highly recommended. On Windows, if the directory +#pod given by L<File::Spec::tmpdir> isn't writable, File::Temp will attempt +#pod to fallback to the user's local application data directory or croak +#pod with an error. +#pod +#pod =head2 BINMODE +#pod +#pod The file returned by File::Temp will have been opened in binary mode +#pod if such a mode is available. If that is not correct, use the C<binmode()> +#pod function to change the mode of the filehandle. +#pod +#pod Note that you can modify the encoding of a file opened by File::Temp +#pod also by using C<binmode()>. +#pod +#pod =head1 HISTORY +#pod +#pod Originally began life in May 1999 as an XS interface to the system +#pod mkstemp() function. In March 2000, the OpenBSD mkstemp() code was +#pod translated to Perl for total control of the code's +#pod security checking, to ensure the presence of the function regardless of +#pod operating system and to help with portability. The module was shipped +#pod as a standard part of perl from v5.6.1. +#pod +#pod Thanks to Tom Christiansen for suggesting that this module +#pod should be written and providing ideas for code improvements and +#pod security enhancements. +#pod +#pod =head1 SEE ALSO +#pod +#pod L<POSIX/tmpnam>, L<POSIX/tmpfile>, L<File::Spec>, L<File::Path> +#pod +#pod See L<IO::File> and L<File::MkTemp>, L<Apache::TempFile> for +#pod different implementations of temporary file handling. +#pod +#pod See L<File::Tempdir> for an alternative object-oriented wrapper for +#pod the C<tempdir> function. +#pod +#pod =cut + +package ## hide from PAUSE + File::Temp::Dir; + +our $VERSION = '0.2309'; + +use File::Path qw/ rmtree /; +use strict; +use overload '""' => "STRINGIFY", + '0+' => \&File::Temp::NUMIFY, + fallback => 1; + +# private class specifically to support tempdir objects +# created by File::Temp->newdir + +# ostensibly the same method interface as File::Temp but without +# inheriting all the IO::Seekable methods and other cruft + +# Read-only - returns the name of the temp directory + +sub dirname { + my $self = shift; + return $self->{DIRNAME}; +} + +sub STRINGIFY { + my $self = shift; + return $self->dirname; +} + +sub unlink_on_destroy { + my $self = shift; + if (@_) { + $self->{CLEANUP} = shift; + } + return $self->{CLEANUP}; +} + +sub DESTROY { + my $self = shift; + local($., $@, $!, $^E, $?); + if ($self->unlink_on_destroy && + $$ == $self->{LAUNCHPID} && !$File::Temp::KEEP_ALL) { + if (-d $self->{REALNAME}) { + # Some versions of rmtree will abort if you attempt to remove + # the directory you are sitting in. We protect that and turn it + # into a warning. We do this because this occurs during object + # destruction and so can not be caught by the user. + eval { rmtree($self->{REALNAME}, $File::Temp::DEBUG, 0); }; + warn $@ if ($@ && $^W); + } + } +} + +1; + + +# vim: ts=2 sts=2 sw=2 et: + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +File::Temp - return name and handle of a temporary file safely + +=head1 VERSION + +version 0.2309 + +=head1 SYNOPSIS + + use File::Temp qw/ tempfile tempdir /; + + $fh = tempfile(); + ($fh, $filename) = tempfile(); + + ($fh, $filename) = tempfile( $template, DIR => $dir); + ($fh, $filename) = tempfile( $template, SUFFIX => '.dat'); + ($fh, $filename) = tempfile( $template, TMPDIR => 1 ); + + binmode( $fh, ":utf8" ); + + $dir = tempdir( CLEANUP => 1 ); + ($fh, $filename) = tempfile( DIR => $dir ); + +Object interface: + + require File::Temp; + use File::Temp (); + use File::Temp qw/ :seekable /; + + $fh = File::Temp->new(); + $fname = $fh->filename; + + $fh = File::Temp->new(TEMPLATE => $template); + $fname = $fh->filename; + + $tmp = File::Temp->new( UNLINK => 0, SUFFIX => '.dat' ); + print $tmp "Some data\n"; + print "Filename is $tmp\n"; + $tmp->seek( 0, SEEK_END ); + + $dir = File::Temp->newdir(); # CLEANUP => 1 by default + +The following interfaces are provided for compatibility with +existing APIs. They should not be used in new code. + +MkTemp family: + + use File::Temp qw/ :mktemp /; + + ($fh, $file) = mkstemp( "tmpfileXXXXX" ); + ($fh, $file) = mkstemps( "tmpfileXXXXXX", $suffix); + + $tmpdir = mkdtemp( $template ); + + $unopened_file = mktemp( $template ); + +POSIX functions: + + use File::Temp qw/ :POSIX /; + + $file = tmpnam(); + $fh = tmpfile(); + + ($fh, $file) = tmpnam(); + +Compatibility functions: + + $unopened_file = File::Temp::tempnam( $dir, $pfx ); + +=head1 DESCRIPTION + +C<File::Temp> can be used to create and open temporary files in a safe +way. There is both a function interface and an object-oriented +interface. The File::Temp constructor or the tempfile() function can +be used to return the name and the open filehandle of a temporary +file. The tempdir() function can be used to create a temporary +directory. + +The security aspect of temporary file creation is emphasized such that +a filehandle and filename are returned together. This helps guarantee +that a race condition can not occur where the temporary file is +created by another process between checking for the existence of the +file and its opening. Additional security levels are provided to +check, for example, that the sticky bit is set on world writable +directories. See L<"safe_level"> for more information. + +For compatibility with popular C library functions, Perl implementations of +the mkstemp() family of functions are provided. These are, mkstemp(), +mkstemps(), mkdtemp() and mktemp(). + +Additionally, implementations of the standard L<POSIX|POSIX> +tmpnam() and tmpfile() functions are provided if required. + +Implementations of mktemp(), tmpnam(), and tempnam() are provided, +but should be used with caution since they return only a filename +that was valid when function was called, so cannot guarantee +that the file will not exist by the time the caller opens the filename. + +Filehandles returned by these functions support the seekable methods. + +=begin :__INTERNALS + +=head1 PORTABILITY + +This section is at the top in order to provide easier access to +porters. It is not expected to be rendered by a standard pod +formatting tool. Please skip straight to the SYNOPSIS section if you +are not trying to port this module to a new platform. + +This module is designed to be portable across operating systems and it +currently supports Unix, VMS, DOS, OS/2, Windows and Mac OS +(Classic). When porting to a new OS there are generally three main +issues that have to be solved: + +=over 4 + +=item * + +Can the OS unlink an open file? If it can not then the +C<_can_unlink_opened_file> method should be modified. + +=item * + +Are the return values from C<stat> reliable? By default all the +return values from C<stat> are compared when unlinking a temporary +file using the filename and the handle. Operating systems other than +unix do not always have valid entries in all fields. If utility function +C<File::Temp::unlink0> fails then the C<stat> comparison should be +modified accordingly. + +=item * + +Security. Systems that can not support a test for the sticky bit +on a directory can not use the MEDIUM and HIGH security tests. +The C<_can_do_level> method should be modified accordingly. + +=back + +=end :__INTERNALS + +=head1 OBJECT-ORIENTED INTERFACE + +This is the primary interface for interacting with +C<File::Temp>. Using the OO interface a temporary file can be created +when the object is constructed and the file can be removed when the +object is no longer required. + +Note that there is no method to obtain the filehandle from the +C<File::Temp> object. The object itself acts as a filehandle. The object +isa C<IO::Handle> and isa C<IO::Seekable> so all those methods are +available. + +Also, the object is configured such that it stringifies to the name of the +temporary file and so can be compared to a filename directly. It numifies +to the C<refaddr> the same as other handles and so can be compared to other +handles with C<==>. + + $fh eq $filename # as a string + $fh != \*STDOUT # as a number + +Available since 0.14. + +=over 4 + +=item B<new> + +Create a temporary file object. + + my $tmp = File::Temp->new(); + +by default the object is constructed as if C<tempfile> +was called without options, but with the additional behaviour +that the temporary file is removed by the object destructor +if UNLINK is set to true (the default). + +Supported arguments are the same as for C<tempfile>: UNLINK +(defaulting to true), DIR, EXLOCK and SUFFIX. Additionally, the filename +template is specified using the TEMPLATE option. The OPEN option +is not supported (the file is always opened). + + $tmp = File::Temp->new( TEMPLATE => 'tempXXXXX', + DIR => 'mydir', + SUFFIX => '.dat'); + +Arguments are case insensitive. + +Can call croak() if an error occurs. + +Available since 0.14. + +TEMPLATE available since 0.23 + +=item B<newdir> + +Create a temporary directory using an object oriented interface. + + $dir = File::Temp->newdir(); + +By default the directory is deleted when the object goes out of scope. + +Supports the same options as the C<tempdir> function. Note that directories +created with this method default to CLEANUP => 1. + + $dir = File::Temp->newdir( $template, %options ); + +A template may be specified either with a leading template or +with a TEMPLATE argument. + +Available since 0.19. + +TEMPLATE available since 0.23. + +=item B<filename> + +Return the name of the temporary file associated with this object +(if the object was created using the "new" constructor). + + $filename = $tmp->filename; + +This method is called automatically when the object is used as +a string. + +Current API available since 0.14 + +=item B<dirname> + +Return the name of the temporary directory associated with this +object (if the object was created using the "newdir" constructor). + + $dirname = $tmpdir->dirname; + +This method is called automatically when the object is used in string context. + +=item B<unlink_on_destroy> + +Control whether the file is unlinked when the object goes out of scope. +The file is removed if this value is true and $KEEP_ALL is not. + + $fh->unlink_on_destroy( 1 ); + +Default is for the file to be removed. + +Current API available since 0.15 + +=item B<DESTROY> + +When the object goes out of scope, the destructor is called. This +destructor will attempt to unlink the file (using L<unlink1|"unlink1">) +if the constructor was called with UNLINK set to 1 (the default state +if UNLINK is not specified). + +No error is given if the unlink fails. + +If the object has been passed to a child process during a fork, the +file will be deleted when the object goes out of scope in the parent. + +For a temporary directory object the directory will be removed unless +the CLEANUP argument was used in the constructor (and set to false) or +C<unlink_on_destroy> was modified after creation. Note that if a temp +directory is your current directory, it cannot be removed - a warning +will be given in this case. C<chdir()> out of the directory before +letting the object go out of scope. + +If the global variable $KEEP_ALL is true, the file or directory +will not be removed. + +=back + +=head1 FUNCTIONS + +This section describes the recommended interface for generating +temporary files and directories. + +=over 4 + +=item B<tempfile> + +This is the basic function to generate temporary files. +The behaviour of the file can be changed using various options: + + $fh = tempfile(); + ($fh, $filename) = tempfile(); + +Create a temporary file in the directory specified for temporary +files, as specified by the tmpdir() function in L<File::Spec>. + + ($fh, $filename) = tempfile($template); + +Create a temporary file in the current directory using the supplied +template. Trailing `X' characters are replaced with random letters to +generate the filename. At least four `X' characters must be present +at the end of the template. + + ($fh, $filename) = tempfile($template, SUFFIX => $suffix) + +Same as previously, except that a suffix is added to the template +after the `X' translation. Useful for ensuring that a temporary +filename has a particular extension when needed by other applications. +But see the WARNING at the end. + + ($fh, $filename) = tempfile($template, DIR => $dir); + +Translates the template as before except that a directory name +is specified. + + ($fh, $filename) = tempfile($template, TMPDIR => 1); + +Equivalent to specifying a DIR of "File::Spec->tmpdir", writing the file +into the same temporary directory as would be used if no template was +specified at all. + + ($fh, $filename) = tempfile($template, UNLINK => 1); + +Return the filename and filehandle as before except that the file is +automatically removed when the program exits (dependent on +$KEEP_ALL). Default is for the file to be removed if a file handle is +requested and to be kept if the filename is requested. In a scalar +context (where no filename is returned) the file is always deleted +either (depending on the operating system) on exit or when it is +closed (unless $KEEP_ALL is true when the temp file is created). + +Use the object-oriented interface if fine-grained control of when +a file is removed is required. + +If the template is not specified, a template is always +automatically generated. This temporary file is placed in tmpdir() +(L<File::Spec>) unless a directory is specified explicitly with the +DIR option. + + $fh = tempfile( DIR => $dir ); + +If called in scalar context, only the filehandle is returned and the +file will automatically be deleted when closed on operating systems +that support this (see the description of tmpfile() elsewhere in this +document). This is the preferred mode of operation, as if you only +have a filehandle, you can never create a race condition by fumbling +with the filename. On systems that can not unlink an open file or can +not mark a file as temporary when it is opened (for example, Windows +NT uses the C<O_TEMPORARY> flag) the file is marked for deletion when +the program ends (equivalent to setting UNLINK to 1). The C<UNLINK> +flag is ignored if present. + + (undef, $filename) = tempfile($template, OPEN => 0); + +This will return the filename based on the template but +will not open this file. Cannot be used in conjunction with +UNLINK set to true. Default is to always open the file +to protect from possible race conditions. A warning is issued +if warnings are turned on. Consider using the tmpnam() +and mktemp() functions described elsewhere in this document +if opening the file is not required. + +To open the temporary filehandle with O_EXLOCK (open with exclusive +file lock) use C<< EXLOCK=>1 >>. This is supported only by some +operating systems (most notably BSD derived systems). By default +EXLOCK will be false. Former C<File::Temp> versions set EXLOCK to +true, so to be sure to get an unlocked filehandle also with older +versions, explicitly set C<< EXLOCK=>0 >>. + + ($fh, $filename) = tempfile($template, EXLOCK => 1); + +Options can be combined as required. + +Will croak() if there is an error. + +Available since 0.05. + +UNLINK flag available since 0.10. + +TMPDIR flag available since 0.19. + +EXLOCK flag available since 0.19. + +=item B<tempdir> + +This is the recommended interface for creation of temporary +directories. By default the directory will not be removed on exit +(that is, it won't be temporary; this behaviour can not be changed +because of issues with backwards compatibility). To enable removal +either use the CLEANUP option which will trigger removal on program +exit, or consider using the "newdir" method in the object interface which +will allow the directory to be cleaned up when the object goes out of +scope. + +The behaviour of the function depends on the arguments: + + $tempdir = tempdir(); + +Create a directory in tmpdir() (see L<File::Spec|File::Spec>). + + $tempdir = tempdir( $template ); + +Create a directory from the supplied template. This template is +similar to that described for tempfile(). `X' characters at the end +of the template are replaced with random letters to construct the +directory name. At least four `X' characters must be in the template. + + $tempdir = tempdir ( DIR => $dir ); + +Specifies the directory to use for the temporary directory. +The temporary directory name is derived from an internal template. + + $tempdir = tempdir ( $template, DIR => $dir ); + +Prepend the supplied directory name to the template. The template +should not include parent directory specifications itself. Any parent +directory specifications are removed from the template before +prepending the supplied directory. + + $tempdir = tempdir ( $template, TMPDIR => 1 ); + +Using the supplied template, create the temporary directory in +a standard location for temporary files. Equivalent to doing + + $tempdir = tempdir ( $template, DIR => File::Spec->tmpdir); + +but shorter. Parent directory specifications are stripped from the +template itself. The C<TMPDIR> option is ignored if C<DIR> is set +explicitly. Additionally, C<TMPDIR> is implied if neither a template +nor a directory are supplied. + + $tempdir = tempdir( $template, CLEANUP => 1); + +Create a temporary directory using the supplied template, but +attempt to remove it (and all files inside it) when the program +exits. Note that an attempt will be made to remove all files from +the directory even if they were not created by this module (otherwise +why ask to clean it up?). The directory removal is made with +the rmtree() function from the L<File::Path|File::Path> module. +Of course, if the template is not specified, the temporary directory +will be created in tmpdir() and will also be removed at program exit. + +Will croak() if there is an error. + +Current API available since 0.05. + +=back + +=head1 MKTEMP FUNCTIONS + +The following functions are Perl implementations of the +mktemp() family of temp file generation system calls. + +=over 4 + +=item B<mkstemp> + +Given a template, returns a filehandle to the temporary file and the name +of the file. + + ($fh, $name) = mkstemp( $template ); + +In scalar context, just the filehandle is returned. + +The template may be any filename with some number of X's appended +to it, for example F</tmp/temp.XXXX>. The trailing X's are replaced +with unique alphanumeric combinations. + +Will croak() if there is an error. + +Current API available since 0.05. + +=item B<mkstemps> + +Similar to mkstemp(), except that an extra argument can be supplied +with a suffix to be appended to the template. + + ($fh, $name) = mkstemps( $template, $suffix ); + +For example a template of C<testXXXXXX> and suffix of C<.dat> +would generate a file similar to F<testhGji_w.dat>. + +Returns just the filehandle alone when called in scalar context. + +Will croak() if there is an error. + +Current API available since 0.05. + +=item B<mkdtemp> + +Create a directory from a template. The template must end in +X's that are replaced by the routine. + + $tmpdir_name = mkdtemp($template); + +Returns the name of the temporary directory created. + +Directory must be removed by the caller. + +Will croak() if there is an error. + +Current API available since 0.05. + +=item B<mktemp> + +Returns a valid temporary filename but does not guarantee +that the file will not be opened by someone else. + + $unopened_file = mktemp($template); + +Template is the same as that required by mkstemp(). + +Will croak() if there is an error. + +Current API available since 0.05. + +=back + +=head1 POSIX FUNCTIONS + +This section describes the re-implementation of the tmpnam() +and tmpfile() functions described in L<POSIX> +using the mkstemp() from this module. + +Unlike the L<POSIX|POSIX> implementations, the directory used +for the temporary file is not specified in a system include +file (C<P_tmpdir>) but simply depends on the choice of tmpdir() +returned by L<File::Spec|File::Spec>. On some implementations this +location can be set using the C<TMPDIR> environment variable, which +may not be secure. +If this is a problem, simply use mkstemp() and specify a template. + +=over 4 + +=item B<tmpnam> + +When called in scalar context, returns the full name (including path) +of a temporary file (uses mktemp()). The only check is that the file does +not already exist, but there is no guarantee that that condition will +continue to apply. + + $file = tmpnam(); + +When called in list context, a filehandle to the open file and +a filename are returned. This is achieved by calling mkstemp() +after constructing a suitable template. + + ($fh, $file) = tmpnam(); + +If possible, this form should be used to prevent possible +race conditions. + +See L<File::Spec/tmpdir> for information on the choice of temporary +directory for a particular operating system. + +Will croak() if there is an error. + +Current API available since 0.05. + +=item B<tmpfile> + +Returns the filehandle of a temporary file. + + $fh = tmpfile(); + +The file is removed when the filehandle is closed or when the program +exits. No access to the filename is provided. + +If the temporary file can not be created undef is returned. +Currently this command will probably not work when the temporary +directory is on an NFS file system. + +Will croak() if there is an error. + +Available since 0.05. + +Returning undef if unable to create file added in 0.12. + +=back + +=head1 ADDITIONAL FUNCTIONS + +These functions are provided for backwards compatibility +with common tempfile generation C library functions. + +They are not exported and must be addressed using the full package +name. + +=over 4 + +=item B<tempnam> + +Return the name of a temporary file in the specified directory +using a prefix. The file is guaranteed not to exist at the time +the function was called, but such guarantees are good for one +clock tick only. Always use the proper form of C<sysopen> +with C<O_CREAT | O_EXCL> if you must open such a filename. + + $filename = File::Temp::tempnam( $dir, $prefix ); + +Equivalent to running mktemp() with $dir/$prefixXXXXXXXX +(using unix file convention as an example) + +Because this function uses mktemp(), it can suffer from race conditions. + +Will croak() if there is an error. + +Current API available since 0.05. + +=back + +=head1 UTILITY FUNCTIONS + +Useful functions for dealing with the filehandle and filename. + +=over 4 + +=item B<unlink0> + +Given an open filehandle and the associated filename, make a safe +unlink. This is achieved by first checking that the filename and +filehandle initially point to the same file and that the number of +links to the file is 1 (all fields returned by stat() are compared). +Then the filename is unlinked and the filehandle checked once again to +verify that the number of links on that file is now 0. This is the +closest you can come to making sure that the filename unlinked was the +same as the file whose descriptor you hold. + + unlink0($fh, $path) + or die "Error unlinking file $path safely"; + +Returns false on error but croaks() if there is a security +anomaly. The filehandle is not closed since on some occasions this is +not required. + +On some platforms, for example Windows NT, it is not possible to +unlink an open file (the file must be closed first). On those +platforms, the actual unlinking is deferred until the program ends and +good status is returned. A check is still performed to make sure that +the filehandle and filename are pointing to the same thing (but not at +the time the end block is executed since the deferred removal may not +have access to the filehandle). + +Additionally, on Windows NT not all the fields returned by stat() can +be compared. For example, the C<dev> and C<rdev> fields seem to be +different. Also, it seems that the size of the file returned by stat() +does not always agree, with C<stat(FH)> being more accurate than +C<stat(filename)>, presumably because of caching issues even when +using autoflush (this is usually overcome by waiting a while after +writing to the tempfile before attempting to C<unlink0> it). + +Finally, on NFS file systems the link count of the file handle does +not always go to zero immediately after unlinking. Currently, this +command is expected to fail on NFS disks. + +This function is disabled if the global variable $KEEP_ALL is true +and an unlink on open file is supported. If the unlink is to be deferred +to the END block, the file is still registered for removal. + +This function should not be called if you are using the object oriented +interface since the it will interfere with the object destructor deleting +the file. + +Available Since 0.05. + +If can not unlink open file, defer removal until later available since 0.06. + +=item B<cmpstat> + +Compare C<stat> of filehandle with C<stat> of provided filename. This +can be used to check that the filename and filehandle initially point +to the same file and that the number of links to the file is 1 (all +fields returned by stat() are compared). + + cmpstat($fh, $path) + or die "Error comparing handle with file"; + +Returns false if the stat information differs or if the link count is +greater than 1. Calls croak if there is a security anomaly. + +On certain platforms, for example Windows, not all the fields returned by stat() +can be compared. For example, the C<dev> and C<rdev> fields seem to be +different in Windows. Also, it seems that the size of the file +returned by stat() does not always agree, with C<stat(FH)> being more +accurate than C<stat(filename)>, presumably because of caching issues +even when using autoflush (this is usually overcome by waiting a while +after writing to the tempfile before attempting to C<unlink0> it). + +Not exported by default. + +Current API available since 0.14. + +=item B<unlink1> + +Similar to C<unlink0> except after file comparison using cmpstat, the +filehandle is closed prior to attempting to unlink the file. This +allows the file to be removed without using an END block, but does +mean that the post-unlink comparison of the filehandle state provided +by C<unlink0> is not available. + + unlink1($fh, $path) + or die "Error closing and unlinking file"; + +Usually called from the object destructor when using the OO interface. + +Not exported by default. + +This function is disabled if the global variable $KEEP_ALL is true. + +Can call croak() if there is a security anomaly during the stat() +comparison. + +Current API available since 0.14. + +=item B<cleanup> + +Calling this function will cause any temp files or temp directories +that are registered for removal to be removed. This happens automatically +when the process exits but can be triggered manually if the caller is sure +that none of the temp files are required. This method can be registered as +an Apache callback. + +Note that if a temp directory is your current directory, it cannot be +removed. C<chdir()> out of the directory first before calling +C<cleanup()>. (For the cleanup at program exit when the CLEANUP flag +is set, this happens automatically.) + +On OSes where temp files are automatically removed when the temp file +is closed, calling this function will have no effect other than to remove +temporary directories (which may include temporary files). + + File::Temp::cleanup(); + +Not exported by default. + +Current API available since 0.15. + +=back + +=head1 PACKAGE VARIABLES + +These functions control the global state of the package. + +=over 4 + +=item B<safe_level> + +Controls the lengths to which the module will go to check the safety of the +temporary file or directory before proceeding. +Options are: + +=over 8 + +=item STANDARD + +Do the basic security measures to ensure the directory exists and is +writable, that temporary files are opened only if they do not already +exist, and that possible race conditions are avoided. Finally the +L<unlink0|"unlink0"> function is used to remove files safely. + +=item MEDIUM + +In addition to the STANDARD security, the output directory is checked +to make sure that it is owned either by root or the user running the +program. If the directory is writable by group or by other, it is then +checked to make sure that the sticky bit is set. + +Will not work on platforms that do not support the C<-k> test +for sticky bit. + +=item HIGH + +In addition to the MEDIUM security checks, also check for the +possibility of ``chown() giveaway'' using the L<POSIX|POSIX> +sysconf() function. If this is a possibility, each directory in the +path is checked in turn for safeness, recursively walking back to the +root directory. + +For platforms that do not support the L<POSIX|POSIX> +C<_PC_CHOWN_RESTRICTED> symbol (for example, Windows NT) it is +assumed that ``chown() giveaway'' is possible and the recursive test +is performed. + +=back + +The level can be changed as follows: + + File::Temp->safe_level( File::Temp::HIGH ); + +The level constants are not exported by the module. + +Currently, you must be running at least perl v5.6.0 in order to +run with MEDIUM or HIGH security. This is simply because the +safety tests use functions from L<Fcntl|Fcntl> that are not +available in older versions of perl. The problem is that the version +number for Fcntl is the same in perl 5.6.0 and in 5.005_03 even though +they are different versions. + +On systems that do not support the HIGH or MEDIUM safety levels +(for example Win NT or OS/2) any attempt to change the level will +be ignored. The decision to ignore rather than raise an exception +allows portable programs to be written with high security in mind +for the systems that can support this without those programs failing +on systems where the extra tests are irrelevant. + +If you really need to see whether the change has been accepted +simply examine the return value of C<safe_level>. + + $newlevel = File::Temp->safe_level( File::Temp::HIGH ); + die "Could not change to high security" + if $newlevel != File::Temp::HIGH; + +Available since 0.05. + +=item TopSystemUID + +This is the highest UID on the current system that refers to a root +UID. This is used to make sure that the temporary directory is +owned by a system UID (C<root>, C<bin>, C<sys> etc) rather than +simply by root. + +This is required since on many unix systems C</tmp> is not owned +by root. + +Default is to assume that any UID less than or equal to 10 is a root +UID. + + File::Temp->top_system_uid(10); + my $topid = File::Temp->top_system_uid; + +This value can be adjusted to reduce security checking if required. +The value is only relevant when C<safe_level> is set to MEDIUM or higher. + +Available since 0.05. + +=item B<$KEEP_ALL> + +Controls whether temporary files and directories should be retained +regardless of any instructions in the program to remove them +automatically. This is useful for debugging but should not be used in +production code. + + $File::Temp::KEEP_ALL = 1; + +Default is for files to be removed as requested by the caller. + +In some cases, files will only be retained if this variable is true +when the file is created. This means that you can not create a temporary +file, set this variable and expect the temp file to still be around +when the program exits. + +=item B<$DEBUG> + +Controls whether debugging messages should be enabled. + + $File::Temp::DEBUG = 1; + +Default is for debugging mode to be disabled. + +Available since 0.15. + +=back + +=head1 WARNING + +For maximum security, endeavour always to avoid ever looking at, +touching, or even imputing the existence of the filename. You do not +know that that filename is connected to the same file as the handle +you have, and attempts to check this can only trigger more race +conditions. It's far more secure to use the filehandle alone and +dispense with the filename altogether. + +If you need to pass the handle to something that expects a filename +then on a unix system you can use C<"/dev/fd/" . fileno($fh)> for +arbitrary programs. Perl code that uses the 2-argument version of +C<< open >> can be passed C<< "+<=&" . fileno($fh) >>. Otherwise you +will need to pass the filename. You will have to clear the +close-on-exec bit on that file descriptor before passing it to another +process. + + use Fcntl qw/F_SETFD F_GETFD/; + fcntl($tmpfh, F_SETFD, 0) + or die "Can't clear close-on-exec flag on temp fh: $!\n"; + +=head2 Temporary files and NFS + +Some problems are associated with using temporary files that reside +on NFS file systems and it is recommended that a local filesystem +is used whenever possible. Some of the security tests will most probably +fail when the temp file is not local. Additionally, be aware that +the performance of I/O operations over NFS will not be as good as for +a local disk. + +=head2 Forking + +In some cases files created by File::Temp are removed from within an +END block. Since END blocks are triggered when a child process exits +(unless C<POSIX::_exit()> is used by the child) File::Temp takes care +to only remove those temp files created by a particular process ID. This +means that a child will not attempt to remove temp files created by the +parent process. + +If you are forking many processes in parallel that are all creating +temporary files, you may need to reset the random number seed using +srand(EXPR) in each child else all the children will attempt to walk +through the same set of random file names and may well cause +themselves to give up if they exceed the number of retry attempts. + +=head2 Directory removal + +Note that if you have chdir'ed into the temporary directory and it is +subsequently cleaned up (either in the END block or as part of object +destruction), then you will get a warning from File::Path::rmtree(). + +=head2 Taint mode + +If you need to run code under taint mode, updating to the latest +L<File::Spec> is highly recommended. On Windows, if the directory +given by L<File::Spec::tmpdir> isn't writable, File::Temp will attempt +to fallback to the user's local application data directory or croak +with an error. + +=head2 BINMODE + +The file returned by File::Temp will have been opened in binary mode +if such a mode is available. If that is not correct, use the C<binmode()> +function to change the mode of the filehandle. + +Note that you can modify the encoding of a file opened by File::Temp +also by using C<binmode()>. + +=head1 HISTORY + +Originally began life in May 1999 as an XS interface to the system +mkstemp() function. In March 2000, the OpenBSD mkstemp() code was +translated to Perl for total control of the code's +security checking, to ensure the presence of the function regardless of +operating system and to help with portability. The module was shipped +as a standard part of perl from v5.6.1. + +Thanks to Tom Christiansen for suggesting that this module +should be written and providing ideas for code improvements and +security enhancements. + +=head1 SEE ALSO + +L<POSIX/tmpnam>, L<POSIX/tmpfile>, L<File::Spec>, L<File::Path> + +See L<IO::File> and L<File::MkTemp>, L<Apache::TempFile> for +different implementations of temporary file handling. + +See L<File::Tempdir> for an alternative object-oriented wrapper for +the C<tempdir> function. + +=for Pod::Coverage STRINGIFY NUMIFY top_system_uid + +=head1 SUPPORT + +Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=File-Temp> +(or L<bug-File-Temp@rt.cpan.org|mailto:bug-File-Temp@rt.cpan.org>). + +There is also a mailing list available for users of this distribution, at +L<http://lists.perl.org/list/cpan-workers.html>. + +There is also an irc channel available for users of this distribution, at +L<C<#toolchain> on C<irc.perl.org>|irc://irc.perl.org/#toolchain>. + +=head1 AUTHOR + +Tim Jenness <tjenness@cpan.org> + +=head1 CONTRIBUTORS + +=for stopwords David Golden Karen Etheridge Slaven Rezic Peter Rabbitson Olivier Mengue Kevin Ryde John Acklam James E. Keenan Brian Mowrey Dagfinn Ilmari Mannsåker Steinbrunner Ed Avis Guillem Jover Ben Tilly + +=over 4 + +=item * + +David Golden <dagolden@cpan.org> + +=item * + +Karen Etheridge <ether@cpan.org> + +=item * + +Slaven Rezic <slaven@rezic.de> + +=item * + +Peter Rabbitson <ribasushi@cpan.org> + +=item * + +Olivier Mengue <dolmen@cpan.org> + +=item * + +David Golden <xdg@xdg.me> + +=item * + +Kevin Ryde <user42@zip.com.au> + +=item * + +Peter John Acklam <pjacklam@online.no> + +=item * + +Slaven Rezic <slaven.rezic@idealo.de> + +=item * + +James E. Keenan <jkeen@verizon.net> + +=item * + +Brian Mowrey <brian@drlabs.org> + +=item * + +Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> + +=item * + +David Steinbrunner <dsteinbrunner@pobox.com> + +=item * + +Ed Avis <eda@linux01.wcl.local> + +=item * + +Guillem Jover <guillem@hadrons.org> + +=item * + +Ben Tilly <btilly@gmail.com> + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2019 by Tim Jenness and the UK Particle Physics and Astronomy Research Council. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/File/stat.pm b/data/miniconda3/lib/perl5/core_perl/File/stat.pm new file mode 100644 index 0000000000000000000000000000000000000000..863092c93dcee0394320d46c4c551bc7f90ba811 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/File/stat.pm @@ -0,0 +1,363 @@ +package File::stat; +use 5.006; + +use strict; +use warnings; +use warnings::register; +use Carp; +use constant _IS_CYGWIN => $^O eq "cygwin"; + +BEGIN { *warnif = \&warnings::warnif } + +our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS); + +our $VERSION = '1.09'; + +our @fields; +our ( $st_dev, $st_ino, $st_mode, + $st_nlink, $st_uid, $st_gid, + $st_rdev, $st_size, + $st_atime, $st_mtime, $st_ctime, + $st_blksize, $st_blocks +); + +BEGIN { + use Exporter (); + @EXPORT = qw(stat lstat); + @fields = qw( $st_dev $st_ino $st_mode + $st_nlink $st_uid $st_gid + $st_rdev $st_size + $st_atime $st_mtime $st_ctime + $st_blksize $st_blocks + ); + @EXPORT_OK = ( @fields, "stat_cando" ); + %EXPORT_TAGS = ( FIELDS => [ @fields, @EXPORT ] ); +} + +use Fcntl qw(S_IRUSR S_IWUSR S_IXUSR); + +BEGIN { + # These constants will croak on use if the platform doesn't define + # them. It's important to avoid inflicting that on the user. + no strict 'refs'; + for (qw(suid sgid svtx)) { + my $val = eval { &{"Fcntl::S_I\U$_"} }; + *{"_$_"} = defined $val ? sub { $_[0] & $val ? 1 : "" } : sub { "" }; + } + for (qw(SOCK CHR BLK REG DIR LNK)) { + *{"S_IS$_"} = defined eval { &{"Fcntl::S_IF$_"} } + ? \&{"Fcntl::S_IS$_"} : sub { "" }; + } + # FIFO flag and macro don't quite follow the S_IF/S_IS pattern above + # RT #111638 + *{"S_ISFIFO"} = defined &Fcntl::S_IFIFO + ? \&Fcntl::S_ISFIFO : sub { "" }; +} + +# from doio.c +sub _ingroup { + my ($gid, $eff) = @_; + + # I am assuming that since VMS doesn't have getgroups(2), $) will + # always only contain a single entry. + $^O eq "VMS" and return $_[0] == $); + + my ($egid, @supp) = split " ", $); + my ($rgid) = split " ", $(; + + $gid == ($eff ? $egid : $rgid) and return 1; + grep $gid == $_, @supp and return 1; + + return ""; +} + +# VMS uses the Unix version of the routine, even though this is very +# suboptimal. VMS has a permissions structure that doesn't really fit +# into struct stat, and unlike on Win32 the normal -X operators respect +# that, but unfortunately by the time we get here we've already lost the +# information we need. It looks to me as though if we were to preserve +# the st_devnam entry of vmsish.h's fake struct stat (which actually +# holds the filename) it might be possible to do this right, but both +# getting that value out of the struct (perl's stat doesn't return it) +# and interpreting it later would require this module to have an XS +# component (at which point we might as well just call Perl_cando and +# have done with it). + +if (grep $^O eq $_, qw/os2 MSWin32 dos/) { + + # from doio.c + *cando = sub { ($_[0][2] & $_[1]) ? 1 : "" }; +} +else { + + # from doio.c + *cando = sub { + my ($s, $mode, $eff) = @_; + my $uid = $eff ? $> : $<; + my ($stmode, $stuid, $stgid) = @$s[2,4,5]; + + # This code basically assumes that the rwx bits of the mode are + # the 0777 bits, but so does Perl_cando. + + if (_IS_CYGWIN ? _ingroup(544, $eff) : ($uid == 0 && $^O ne "VMS")) { + # If we're root on unix + # not testing for executable status => all file tests are true + return 1 if !($mode & 0111); + # testing for executable status => + # for a file, any x bit will do + # for a directory, always true + return 1 if $stmode & 0111 || S_ISDIR($stmode); + return ""; + } + + if ($stuid == $uid) { + $stmode & $mode and return 1; + } + elsif (_ingroup($stgid, $eff)) { + $stmode & ($mode >> 3) and return 1; + } + else { + $stmode & ($mode >> 6) and return 1; + } + return ""; + }; +} + +# alias for those who don't like objects +*stat_cando = \&cando; + +my %op = ( + r => sub { cando($_[0], S_IRUSR, 1) }, + w => sub { cando($_[0], S_IWUSR, 1) }, + x => sub { cando($_[0], S_IXUSR, 1) }, + o => sub { $_[0][4] == $> }, + + R => sub { cando($_[0], S_IRUSR, 0) }, + W => sub { cando($_[0], S_IWUSR, 0) }, + X => sub { cando($_[0], S_IXUSR, 0) }, + O => sub { $_[0][4] == $< }, + + e => sub { 1 }, + z => sub { $_[0][7] == 0 }, + s => sub { $_[0][7] }, + + f => sub { S_ISREG ($_[0][2]) }, + d => sub { S_ISDIR ($_[0][2]) }, + l => sub { S_ISLNK ($_[0][2]) }, + p => sub { S_ISFIFO($_[0][2]) }, + S => sub { S_ISSOCK($_[0][2]) }, + b => sub { S_ISBLK ($_[0][2]) }, + c => sub { S_ISCHR ($_[0][2]) }, + + u => sub { _suid($_[0][2]) }, + g => sub { _sgid($_[0][2]) }, + k => sub { _svtx($_[0][2]) }, + + M => sub { ($^T - $_[0][9] ) / 86400 }, + C => sub { ($^T - $_[0][10]) / 86400 }, + A => sub { ($^T - $_[0][8] ) / 86400 }, +); + +use constant HINT_FILETEST_ACCESS => 0x00400000; + +# we need fallback=>1 or stringifying breaks +use overload + fallback => 1, + -X => sub { + my ($s, $op) = @_; + + if (index("rwxRWX", $op) >= 0) { + (caller 0)[8] & HINT_FILETEST_ACCESS + and warnif("File::stat ignores use filetest 'access'"); + + $^O eq "VMS" and warnif("File::stat ignores VMS ACLs"); + + # It would be nice to have a warning about using -l on a + # non-lstat, but that would require an extra member in the + # object. + } + + if ($op{$op}) { + return $op{$op}->($_[0]); + } + else { + croak "-$op is not implemented on a File::stat object"; + } + }; + +# Class::Struct forbids use of @ISA +sub import { goto &Exporter::import } + +use Class::Struct qw(struct); +struct 'File::stat' => [ + map { $_ => '$' } qw{ + dev ino mode nlink uid gid rdev size + atime mtime ctime blksize blocks + } +]; + +sub populate (@) { + return unless @_; + my $stob = new(); + @$stob = ( + $st_dev, $st_ino, $st_mode, $st_nlink, $st_uid, $st_gid, $st_rdev, + $st_size, $st_atime, $st_mtime, $st_ctime, $st_blksize, $st_blocks ) + = @_; + return $stob; +} + +sub lstat ($) { populate(CORE::lstat(shift)) } + +sub stat ($) { + my $arg = shift; + my $st = populate(CORE::stat $arg); + return $st if defined $st; + my $fh; + { + local $!; + no strict 'refs'; + require Symbol; + $fh = \*{ Symbol::qualify( $arg, caller() )}; + return unless defined fileno $fh; + } + return populate(CORE::stat $fh); +} + +1; +__END__ + +=head1 NAME + +File::stat - by-name interface to Perl's built-in stat() functions + +=head1 SYNOPSIS + + use File::stat; + $st = stat($file) or die "No $file: $!"; + if ( ($st->mode & 0111) && $st->nlink > 1) ) { + print "$file is executable with lotsa links\n"; + } + + if ( -x $st ) { + print "$file is executable\n"; + } + + use Fcntl "S_IRUSR"; + if ( $st->cando(S_IRUSR, 1) ) { + print "My effective uid can read $file\n"; + } + + use File::stat qw(:FIELDS); + stat($file) or die "No $file: $!"; + if ( ($st_mode & 0111) && ($st_nlink > 1) ) { + print "$file is executable with lotsa links\n"; + } + +=head1 DESCRIPTION + +This module's default exports override the core stat() +and lstat() functions, replacing them with versions that return +"File::stat" objects. This object has methods that +return the similarly named structure field name from the +stat(2) function; namely, +dev, +ino, +mode, +nlink, +uid, +gid, +rdev, +size, +atime, +mtime, +ctime, +blksize, +and +blocks. + +As of version 1.02 (provided with perl 5.12) the object provides C<"-X"> +overloading, so you can call filetest operators (C<-f>, C<-x>, and so +on) on it. It also provides a C<< ->cando >> method, called like + + $st->cando( ACCESS, EFFECTIVE ) + +where I<ACCESS> is one of C<S_IRUSR>, C<S_IWUSR> or C<S_IXUSR> from the +L<Fcntl|Fcntl> module, and I<EFFECTIVE> indicates whether to use +effective (true) or real (false) ids. The method interprets the C<mode>, +C<uid> and C<gid> fields, and returns whether or not the current process +would be allowed the specified access. + +If you don't want to use the objects, you may import the C<< ->cando >> +method into your namespace as a regular function called C<stat_cando>. +This takes an arrayref containing the return values of C<stat> or +C<lstat> as its first argument, and interprets it for you. + +You may also import all the structure fields directly into your namespace +as regular variables using the :FIELDS import tag. (Note that this still +overrides your stat() and lstat() functions.) Access these fields as +variables named with a preceding C<st_> in front their method names. +Thus, C<$stat_obj-E<gt>dev()> corresponds to $st_dev if you import +the fields. + +To access this functionality without the core overrides, +pass the C<use> an empty import list, and then access +function functions with their full qualified names. +On the other hand, the built-ins are still available +via the C<CORE::> pseudo-package. + +=head1 BUGS + +As of Perl 5.8.0 after using this module you cannot use the implicit +C<$_> or the special filehandle C<_> with stat() or lstat(), trying +to do so leads into strange errors. The workaround is for C<$_> to +be explicit + + my $stat_obj = stat $_; + +and for C<_> to explicitly populate the object using the unexported +and undocumented populate() function with CORE::stat(): + + my $stat_obj = File::stat::populate(CORE::stat(_)); + +=head1 ERRORS + +=over 4 + +=item -%s is not implemented on a File::stat object + +The filetest operators C<-t>, C<-T> and C<-B> are not implemented, as +they require more information than just a stat buffer. + +=back + +=head1 WARNINGS + +These can all be disabled with + + no warnings "File::stat"; + +=over 4 + +=item File::stat ignores use filetest 'access' + +You have tried to use one of the C<-rwxRWX> filetests with C<use +filetest 'access'> in effect. C<File::stat> will ignore the pragma, and +just use the information in the C<mode> member as usual. + +=item File::stat ignores VMS ACLs + +VMS systems have a permissions structure that cannot be completely +represented in a stat buffer, and unlike on other systems the builtin +filetest operators respect this. The C<File::stat> overloads, however, +do not, since the information required is not available. + +=back + +=head1 NOTE + +While this class is currently implemented using the Class::Struct +module to build a struct-like class, you shouldn't rely upon this. + +=head1 AUTHOR + +Tom Christiansen diff --git a/data/miniconda3/lib/perl5/core_perl/FileCache.pm b/data/miniconda3/lib/perl5/core_perl/FileCache.pm new file mode 100644 index 0000000000000000000000000000000000000000..0834719d9b9d412853b0ca02b2429f854a9c028e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/FileCache.pm @@ -0,0 +1,188 @@ +package FileCache; + +our $VERSION = '1.10'; + +=head1 NAME + +FileCache - keep more files open than the system permits + +=head1 SYNOPSIS + + no strict 'refs'; + + use FileCache; + # or + use FileCache maxopen => 16; + + cacheout $mode, $path; + # or + cacheout $path; + print $path @data; + + $fh = cacheout $mode, $path; + # or + $fh = cacheout $path; + print $fh @data; + +=head1 DESCRIPTION + +The C<cacheout> function will make sure that there's a filehandle open +for reading or writing available as the pathname you give it. It +automatically closes and re-opens files if you exceed your system's +maximum number of file descriptors, or the suggested maximum I<maxopen>. + +=over + +=item cacheout EXPR + +The 1-argument form of cacheout will open a file for writing (C<< '>' >>) +on it's first use, and appending (C<<< '>>' >>>) thereafter. + +Returns EXPR on success for convenience. You may neglect the +return value and manipulate EXPR as the filehandle directly if you prefer. + +=item cacheout MODE, EXPR + +The 2-argument form of cacheout will use the supplied mode for the initial +and subsequent openings. Most valid modes for 3-argument C<open> are supported +namely; C<< '>' >>, C<< '+>' >>, C<< '<' >>, C<< '<+' >>, C<<< '>>' >>>, +C< '|-' > and C< '-|' > + +To pass supplemental arguments to a program opened with C< '|-' > or C< '-|' > +append them to the command string as you would system EXPR. + +Returns EXPR on success for convenience. You may neglect the +return value and manipulate EXPR as the filehandle directly if you prefer. + +=back + +=head1 CAVEATS + +While it is permissible to C<close> a FileCache managed file, +do not do so if you are calling C<FileCache::cacheout> from a package other +than which it was imported, or with another module which overrides C<close>. +If you must, use C<FileCache::cacheout_close>. + +Although FileCache can be used with piped opens ('-|' or '|-') doing so is +strongly discouraged. If FileCache finds it necessary to close and then reopen +a pipe, the command at the far end of the pipe will be reexecuted - the results +of performing IO on FileCache'd pipes is unlikely to be what you expect. The +ability to use FileCache on pipes may be removed in a future release. + +FileCache does not store the current file offset if it finds it necessary to +close a file. When the file is reopened, the offset will be as specified by the +original C<open> file mode. This could be construed to be a bug. + +The module functionality relies on symbolic references, so things will break +under 'use strict' unless 'no strict "refs"' is also specified. + +=head1 BUGS + +F<sys/param.h> lies with its C<NOFILE> define on some systems, +so you may have to set I<maxopen> yourself. + +=cut + +require 5.006; +use Carp; +use strict; +no strict 'refs'; + +# These are not C<my> for legacy reasons. +# Previous versions requested the user set $cacheout_maxopen by hand. +# Some authors fiddled with %saw to overcome the clobber on initial open. +our %saw; +our $cacheout_maxopen = 16; + +use parent 'Exporter'; +our @EXPORT = qw[cacheout cacheout_close]; + + +my %isopen; +my $cacheout_seq = 0; + +sub import { + my ($pkg,%args) = @_; + + # Use Exporter. %args are for us, not Exporter. + # Make sure to up export_to_level, or we will import into ourselves, + # rather than our calling package; + + __PACKAGE__->export_to_level(1); + Exporter::import( $pkg ); + + # Truth is okay here because setting maxopen to 0 would be bad + return $cacheout_maxopen = $args{maxopen} if $args{maxopen}; + + # XXX This code is crazy. Why is it a one element foreach loop? + # Why is it using $param both as a filename and filehandle? + foreach my $param ( '/usr/include/sys/param.h' ){ + if (open($param, '<', $param)) { + local ($_, $.); + while (<$param>) { + if( /^\s*#\s*define\s+NOFILE\s+(\d+)/ ){ + $cacheout_maxopen = $1 - 4; + close($param); + last; + } + } + close $param; + } + } + $cacheout_maxopen ||= 16; +} + +# Open in their package. +sub cacheout_open { + return open(*{caller(1) . '::' . $_[1]}, $_[0], $_[1]) && $_[1]; +} + +# Close in their package. +sub cacheout_close { + # Short-circuit in case the filehandle disappeared + my $pkg = caller($_[1]||0); + defined fileno(*{$pkg . '::' . $_[0]}) && + CORE::close(*{$pkg . '::' . $_[0]}); + delete $isopen{$_[0]}; +} + +# But only this sub name is visible to them. +sub cacheout { + my($mode, $file, $class, $ret, $ref, $narg); + croak "Not enough arguments for cacheout" unless $narg = scalar @_; + croak "Too many arguments for cacheout" if $narg > 2; + + ($mode, $file) = @_; + ($file, $mode) = ($mode, $file) if $narg == 1; + croak "Invalid mode for cacheout" if $mode && + ( $mode !~ /^\s*(?:>>|\+?>|\+?<|\|\-|)|\-\|\s*$/ ); + + # Mode changed? + if( $isopen{$file} && ($mode||'>') ne $isopen{$file}->[1] ){ + &cacheout_close($file, 1); + } + + if( $isopen{$file}) { + $ret = $file; + $isopen{$file}->[0]++; + } + else{ + if( scalar keys(%isopen) > $cacheout_maxopen -1 ) { + my @lru = sort{ $isopen{$a}->[0] <=> $isopen{$b}->[0] } keys(%isopen); + $cacheout_seq = 0; + $isopen{$_}->[0] = $cacheout_seq++ for + splice(@lru, int($cacheout_maxopen / 3)||$cacheout_maxopen); + &cacheout_close($_, 1) for @lru; + } + + unless( $ref ){ + $mode ||= $saw{$file} ? '>>' : ($saw{$file}=1, '>'); + } + #XXX should we just return the value from cacheout_open, no croak? + $ret = cacheout_open($mode, $file) or croak("Can't create $file: $!"); + + $isopen{$file} = [++$cacheout_seq, $mode]; + } + return $ret; +} +1; diff --git a/data/miniconda3/lib/perl5/core_perl/FileHandle.pm b/data/miniconda3/lib/perl5/core_perl/FileHandle.pm new file mode 100644 index 0000000000000000000000000000000000000000..133221bb6b53417d44027a36f6319adb489dc12d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/FileHandle.pm @@ -0,0 +1,262 @@ +package FileHandle; + +use 5.006; +use strict; +our($VERSION, @ISA, @EXPORT, @EXPORT_OK); + +$VERSION = "2.03"; + +require IO::File; +@ISA = qw(IO::File); + +@EXPORT = qw(_IOFBF _IOLBF _IONBF); + +@EXPORT_OK = qw( + pipe + + autoflush + output_field_separator + output_record_separator + input_record_separator + input_line_number + format_page_number + format_lines_per_page + format_lines_left + format_name + format_top_name + format_line_break_characters + format_formfeed + + print + printf + getline + getlines +); + +# +# Everything we're willing to export, we must first import. +# +IO::Handle->import( grep { !defined(&$_) } @EXPORT, @EXPORT_OK ); + +# +# Some people call "FileHandle::function", so all the functions +# that were in the old FileHandle class must be imported, too. +# +{ + no strict 'refs'; + + my %import = ( + 'IO::Handle' => + [qw(DESTROY new_from_fd fdopen close fileno getc ungetc gets + eof flush error clearerr setbuf setvbuf _open_mode_string)], + 'IO::Seekable' => + [qw(seek tell getpos setpos)], + 'IO::File' => + [qw(new new_tmpfile open)] + ); + for my $pkg (keys %import) { + for my $func (@{$import{$pkg}}) { + my $c = *{"${pkg}::$func"}{CODE} + or die "${pkg}::$func missing"; + *$func = $c; + } + } +} + +# +# Specialized importer for Fcntl magic. +# +sub import { + my $pkg = shift; + my $callpkg = caller; + require Exporter; + Exporter::export($pkg, $callpkg, @_); + + # + # If the Fcntl extension is available, + # export its constants. + # + eval { + require Fcntl; + Exporter::export('Fcntl', $callpkg); + }; +} + +################################################ +# This is the only exported function we define; +# the rest come from other classes. +# + +sub pipe { + my $r = IO::Handle->new; + my $w = IO::Handle->new; + CORE::pipe($r, $w) or return undef; + ($r, $w); +} + +# Rebless standard file handles +bless *STDIN{IO}, "FileHandle" if ref *STDIN{IO} eq "IO::Handle"; +bless *STDOUT{IO}, "FileHandle" if ref *STDOUT{IO} eq "IO::Handle"; +bless *STDERR{IO}, "FileHandle" if ref *STDERR{IO} eq "IO::Handle"; + +1; + +__END__ + +=head1 NAME + +FileHandle - supply object methods for filehandles + +=head1 SYNOPSIS + + use FileHandle; + + $fh = FileHandle->new; + if ($fh->open("< file")) { + print <$fh>; + $fh->close; + } + + $fh = FileHandle->new("> FOO"); + if (defined $fh) { + print $fh "bar\n"; + $fh->close; + } + + $fh = FileHandle->new("file", "r"); + if (defined $fh) { + print <$fh>; + undef $fh; # automatically closes the file + } + + $fh = FileHandle->new("file", O_WRONLY|O_APPEND); + if (defined $fh) { + print $fh "corge\n"; + undef $fh; # automatically closes the file + } + + $pos = $fh->getpos; + $fh->setpos($pos); + + $fh->setvbuf($buffer_var, _IOLBF, 1024); + + ($readfh, $writefh) = FileHandle::pipe; + + autoflush STDOUT 1; + +=head1 DESCRIPTION + +NOTE: This class is now a front-end to the IO::* classes. + +C<FileHandle::new> creates a C<FileHandle>, which is a reference to a +newly created symbol (see the C<Symbol> package). If it receives any +parameters, they are passed to C<FileHandle::open>; if the open fails, +the C<FileHandle> object is destroyed. Otherwise, it is returned to +the caller. + +C<FileHandle::new_from_fd> creates a C<FileHandle> like C<new> does. +It requires two parameters, which are passed to C<FileHandle::fdopen>; +if the fdopen fails, the C<FileHandle> object is destroyed. +Otherwise, it is returned to the caller. + +C<FileHandle::open> accepts one parameter or two. With one parameter, +it is just a front end for the built-in C<open> function. With two +parameters, the first parameter is a filename that may include +whitespace or other special characters, and the second parameter is +the open mode, optionally followed by a file permission value. + +If C<FileHandle::open> receives a Perl mode string (">", "+<", etc.) +or a POSIX fopen() mode string ("w", "r+", etc.), it uses the basic +Perl C<open> operator. + +If C<FileHandle::open> is given a numeric mode, it passes that mode +and the optional permissions value to the Perl C<sysopen> operator. +For convenience, C<FileHandle::import> tries to import the O_XXX +constants from the Fcntl module. If dynamic loading is not available, +this may fail, but the rest of FileHandle will still work. + +C<FileHandle::fdopen> is like C<open> except that its first parameter +is not a filename but rather a file handle name, a FileHandle object, +or a file descriptor number. + +If the C functions fgetpos() and fsetpos() are available, then +C<FileHandle::getpos> returns an opaque value that represents the +current position of the FileHandle, and C<FileHandle::setpos> uses +that value to return to a previously visited position. + +If the C function setvbuf() is available, then C<FileHandle::setvbuf> +sets the buffering policy for the FileHandle. The calling sequence +for the Perl function is the same as its C counterpart, including the +macros C<_IOFBF>, C<_IOLBF>, and C<_IONBF>, except that the buffer +parameter specifies a scalar variable to use as a buffer. WARNING: A +variable used as a buffer by C<FileHandle::setvbuf> must not be +modified in any way until the FileHandle is closed or until +C<FileHandle::setvbuf> is called again, or memory corruption may +result! + +See L<perlfunc> for complete descriptions of each of the following +supported C<FileHandle> methods, which are just front ends for the +corresponding built-in functions: + + close + fileno + getc + gets + eof + clearerr + seek + tell + +See L<perlvar> for complete descriptions of each of the following +supported C<FileHandle> methods: + + autoflush + output_field_separator + output_record_separator + input_record_separator + input_line_number + format_page_number + format_lines_per_page + format_lines_left + format_name + format_top_name + format_line_break_characters + format_formfeed + +Furthermore, for doing normal I/O you might need these: + +=over 4 + +=item $fh->print + +See L<perlfunc/print>. + +=item $fh->printf + +See L<perlfunc/printf>. + +=item $fh->getline + +This works like <$fh> described in L<perlop/"I/O Operators"> +except that it's more readable and can be safely called in a +list context but still returns just one line. + +=item $fh->getlines + +This works like <$fh> when called in a list context to +read all the remaining lines in a file, except that it's more readable. +It will also croak() if accidentally called in a scalar context. + +=back + +There are many other functions available since FileHandle is descended +from IO::File, IO::Seekable, and IO::Handle. Please see those +respective pages for documentation on more functions. + +=head1 SEE ALSO + +The B<IO> extension, +L<perlfunc>, +L<perlop/"I/O Operators">. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Filter/Simple.pm b/data/miniconda3/lib/perl5/core_perl/Filter/Simple.pm new file mode 100644 index 0000000000000000000000000000000000000000..924c2aecbd3c87dd071a156c41d3ccdc54d61de8 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Filter/Simple.pm @@ -0,0 +1,805 @@ +package Filter::Simple; + +use Text::Balanced ':ALL'; + +our $VERSION = '0.96'; + +use Filter::Util::Call; +use Carp; + +our @EXPORT = qw( FILTER FILTER_ONLY ); + + +sub import { + if (@_>1) { shift; goto &FILTER } + else { *{caller()."::$_"} = \&$_ foreach @EXPORT } +} + +sub fail { + croak "FILTER_ONLY: ", @_; +} + +my $exql = sub { + my @bits = extract_quotelike $_[0], qr//; + return unless $bits[0]; + return \@bits; +}; + +my $ncws = qr/\s+/; +my $comment = qr/(?<![\$\@%])#.*/; +my $ws = qr/(?:$ncws|$comment)+/; +my $id = qr/\b(?!([ysm]|q[rqxw]?|tr)\b)\w+/; +my $EOP = qr/\n\n|\Z/; +my $CUT = qr/\n=cut.*$EOP/; +my $pod_or_DATA = qr/ + ^=(?:head[1-4]|item) .*? $CUT + | ^=pod .*? $CUT + | ^=for .*? $CUT + | ^=begin .*? $CUT + | ^__(DATA|END)__\r?\n.* + /smx; +my $variable = qr{ + [\$*\@%]\s* + \{\s*(?!::)(?:\d+|[][&`'#+*./|,";%=~:?!\@<>()-]|\^[A-Z]?)\} + | (?:\$#?|[*\@\%]|\\&)\$*\s* + (?: \{\s*(?:\^(?=[A-Z_]))?(?:\w|::|'\w)*\s*\} + | (?:\^(?=[A-Z_]))?(?:\w|::|'\w)* + | (?=\{) # ${ block } + ) + ) + | \$\s*(?!::)(?:\d+|[][&`'#+*./|,";%=~:?!\@<>()-]|\^[A-Z]?) + }x; + +my %extractor_for = ( + quotelike => [ $ws, $variable, $id, { MATCH => \&extract_quotelike } ], + regex => [ $ws, $pod_or_DATA, $id, $exql ], + string => [ $ws, $pod_or_DATA, $id, $exql ], + code => [ $ws, { DONT_MATCH => $pod_or_DATA }, $variable, + $id, { DONT_MATCH => \&extract_quotelike } ], + code_no_comments + => [ { DONT_MATCH => $comment }, + $ncws, { DONT_MATCH => $pod_or_DATA }, $variable, + $id, { DONT_MATCH => \&extract_quotelike } ], + executable => [ $ws, { DONT_MATCH => $pod_or_DATA } ], + executable_no_comments + => [ { DONT_MATCH => $comment }, + $ncws, { DONT_MATCH => $pod_or_DATA } ], + all => [ { MATCH => qr/(?s:.*)/ } ], +); + +my %selector_for = ( + all => sub { my ($t)=@_; sub{ $_=$$_; $t->(@_); $_} }, + executable=> sub { my ($t)=@_; sub{ref() ? $_=$$_ : $t->(@_); $_} }, + executable_no_comments=> sub { my ($t)=@_; sub{ref() ? $_=$$_ : $t->(@_); $_} }, + quotelike => sub { my ($t)=@_; sub{ref() && do{$_=$$_; $t->(@_)}; $_} }, + regex => sub { my ($t)=@_; + sub{ref() or return $_; + my ($ql,undef,$pre,$op,$ld,$pat) = @$_; + return $_->[0] unless $op =~ /^(qr|m|s)/ + || !$op && ($ld eq '/' || $ld eq '?'); + $_ = $pat; + $t->(@_); + $ql =~ s/^(\s*\Q$op\E\s*\Q$ld\E)\Q$pat\E/$1$_/; + return "$pre$ql"; + }; + }, + string => sub { my ($t)=@_; + sub{ref() or return $_; + local *args = \@_; + my ($pre,$op,$ld1,$str1,$rd1,$ld2,$str2,$rd2,$flg) = @{$_}[2..10]; + return $_->[0] if $op =~ /^(qr|m)/ + || !$op && ($ld1 eq '/' || $ld1 eq '?'); + if (!$op || $op eq 'tr' || $op eq 'y') { + local *_ = \$str1; + $t->(@args); + } + if ($op =~ /^(tr|y|s)/) { + local *_ = \$str2; + $t->(@args); + } + my $result = "$pre$op$ld1$str1$rd1"; + $result .= $ld2 if $ld1 =~ m/[[({<]/; #])}> + $result .= "$str2$rd2$flg"; + return $result; + }; + }, +); + + +sub gen_std_filter_for { + my ($type, $transform) = @_; + return sub { + my $instr; + local @components; + for (extract_multiple($_,$extractor_for{$type})) { + if (ref()) { push @components, $_; $instr=0 } + elsif ($instr) { $components[-1] .= $_ } + else { push @components, $_; $instr=1 } + } + if ($type =~ /^code/) { + my $count = 0; + local $placeholder = qr/\Q$;\E(.{4})\Q$;\E/s; + my $extractor = qr/\Q$;\E(.{4})\Q$;\E/s; + $_ = join "", + map { ref $_ ? $;.pack('N',$count++).$; : $_ } + @components; + @components = grep { ref $_ } @components; + $transform->(@_); + s/$extractor/${$components[unpack('N',$1)]}/g; + } + else { + my $selector = $selector_for{$type}->($transform); + $_ = join "", map $selector->(@_), @components; + } + } +}; + +sub FILTER (&;$) { + my $caller = caller; + my ($filter, $terminator) = @_; + no warnings 'redefine'; + *{"${caller}::import"} = gen_filter_import($caller,$filter,$terminator); + *{"${caller}::unimport"} = gen_filter_unimport($caller); +} + +sub FILTER_ONLY { + my $caller = caller; + while (@_ > 1) { + my ($what, $how) = splice(@_, 0, 2); + fail "Unknown selector: $what" + unless exists $extractor_for{$what}; + fail "Filter for $what is not a subroutine reference" + unless ref $how eq 'CODE'; + push @transforms, gen_std_filter_for($what,$how); + } + my $terminator = shift; + + my $multitransform = sub { + foreach my $transform ( @transforms ) { + $transform->(@_); + } + }; + no warnings 'redefine'; + *{"${caller}::import"} = + gen_filter_import($caller,$multitransform,$terminator); + *{"${caller}::unimport"} = gen_filter_unimport($caller); +} + +my $ows = qr/(?:[ \t]+|#[^\n]*)*/; + +sub gen_filter_import { + my ($class, $filter, $terminator) = @_; + my %terminator; + my $prev_import = *{$class."::import"}{CODE}; + return sub { + my ($imported_class, @args) = @_; + my $def_terminator = + qr/^(?:\s*no\s+$imported_class\s*;$ows|__(?:END|DATA)__)\r?$/; + if (!defined $terminator) { + $terminator{terminator} = $def_terminator; + } + elsif (!ref $terminator || ref $terminator eq 'Regexp') { + $terminator{terminator} = $terminator; + } + elsif (ref $terminator ne 'HASH') { + croak "Terminator must be specified as scalar or hash ref" + } + elsif (!exists $terminator->{terminator}) { + $terminator{terminator} = $def_terminator; + } + filter_add( + sub { + my ($status, $lastline); + my $count = 0; + my $data = ""; + while ($status = filter_read()) { + return $status if $status < 0; + if ($terminator{terminator} && + m/$terminator{terminator}/) { + $lastline = $_; + $count++; + last; + } + $data .= $_; + $count++; + $_ = ""; + } + return $count if not $count; + $_ = $data; + $filter->($imported_class, @args) unless $status < 0; + if (defined $lastline) { + if (defined $terminator{becomes}) { + $_ .= $terminator{becomes}; + } + elsif ($lastline =~ $def_terminator) { + $_ .= $lastline; + } + } + return $count; + } + ); + if ($prev_import) { + goto &$prev_import; + } + elsif ($class->isa('Exporter')) { + $class->export_to_level(1,@_); + } + } +} + +sub gen_filter_unimport { + my ($class) = @_; + return sub { + filter_del(); + goto &$prev_unimport if $prev_unimport; + } +} + +1; + +__END__ + +=head1 NAME + +Filter::Simple - Simplified source filtering + +=head1 SYNOPSIS + + # in MyFilter.pm: + + package MyFilter; + + use Filter::Simple; + + FILTER { ... }; + + # or just: + # + # use Filter::Simple sub { ... }; + + # in user's code: + + use MyFilter; + + # this code is filtered + + no MyFilter; + + # this code is not + + +=head1 DESCRIPTION + +=head2 The Problem + +Source filtering is an immensely powerful feature of recent versions of Perl. +It allows one to extend the language itself (e.g. the Switch module), to +simplify the language (e.g. Language::Pythonesque), or to completely recast the +language (e.g. Lingua::Romana::Perligata). Effectively, it allows one to use +the full power of Perl as its own, recursively applied, macro language. + +The excellent Filter::Util::Call module (by Paul Marquess) provides a +usable Perl interface to source filtering, but it is often too powerful +and not nearly as simple as it could be. + +To use the module it is necessary to do the following: + +=over 4 + +=item 1. + +Download, build, and install the Filter::Util::Call module. +(If you have Perl 5.7.1 or later, this is already done for you.) + +=item 2. + +Set up a module that does a C<use Filter::Util::Call>. + +=item 3. + +Within that module, create an C<import> subroutine. + +=item 4. + +Within the C<import> subroutine do a call to C<filter_add>, passing +it either a subroutine reference. + +=item 5. + +Within the subroutine reference, call C<filter_read> or C<filter_read_exact> +to "prime" $_ with source code data from the source file that will +C<use> your module. Check the status value returned to see if any +source code was actually read in. + +=item 6. + +Process the contents of $_ to change the source code in the desired manner. + +=item 7. + +Return the status value. + +=item 8. + +If the act of unimporting your module (via a C<no>) should cause source +code filtering to cease, create an C<unimport> subroutine, and have it call +C<filter_del>. Make sure that the call to C<filter_read> or +C<filter_read_exact> in step 5 will not accidentally read past the +C<no>. Effectively this limits source code filters to line-by-line +operation, unless the C<import> subroutine does some fancy +pre-pre-parsing of the source code it's filtering. + +=back + +For example, here is a minimal source code filter in a module named +BANG.pm. It simply converts every occurrence of the sequence C<BANG\s+BANG> +to the sequence C<die 'BANG' if $BANG> in any piece of code following a +C<use BANG;> statement (until the next C<no BANG;> statement, if any): + + package BANG; + + use Filter::Util::Call ; + + sub import { + filter_add( sub { + my $caller = caller; + my ($status, $no_seen, $data); + while ($status = filter_read()) { + if (/^\s*no\s+$caller\s*;\s*?$/) { + $no_seen=1; + last; + } + $data .= $_; + $_ = ""; + } + $_ = $data; + s/BANG\s+BANG/die 'BANG' if \$BANG/g + unless $status < 0; + $_ .= "no $class;\n" if $no_seen; + return 1; + }) + } + + sub unimport { + filter_del(); + } + + 1 ; + +This level of sophistication puts filtering out of the reach of +many programmers. + + +=head2 A Solution + +The Filter::Simple module provides a simplified interface to +Filter::Util::Call; one that is sufficient for most common cases. + +Instead of the above process, with Filter::Simple the task of setting up +a source code filter is reduced to: + +=over 4 + +=item 1. + +Download and install the Filter::Simple module. +(If you have Perl 5.7.1 or later, this is already done for you.) + +=item 2. + +Set up a module that does a C<use Filter::Simple> and then +calls C<FILTER { ... }>. + +=item 3. + +Within the anonymous subroutine or block that is passed to +C<FILTER>, process the contents of $_ to change the source code in +the desired manner. + +=back + +In other words, the previous example, would become: + + package BANG; + use Filter::Simple; + + FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + }; + + 1 ; + +Note that the source code is passed as a single string, so any regex that +uses C<^> or C<$> to detect line boundaries will need the C</m> flag. + +=head2 Disabling or changing <no> behaviour + +By default, the installed filter only filters up to a line consisting of one of +the three standard source "terminators": + + no ModuleName; # optional comment + +or: + + __END__ + +or: + + __DATA__ + +but this can be altered by passing a second argument to C<use Filter::Simple> +or C<FILTER> (just remember: there's I<no> comma after the initial block when +you use C<FILTER>). + +That second argument may be either a C<qr>'d regular expression (which is then +used to match the terminator line), or a defined false value (which indicates +that no terminator line should be looked for), or a reference to a hash +(in which case the terminator is the value associated with the key +C<'terminator'>. + +For example, to cause the previous filter to filter only up to a line of the +form: + + GNAB esu; + +you would write: + + package BANG; + use Filter::Simple; + + FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + } + qr/^\s*GNAB\s+esu\s*;\s*?$/; + +or: + + FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + } + { terminator => qr/^\s*GNAB\s+esu\s*;\s*?$/ }; + +and to prevent the filter's being turned off in any way: + + package BANG; + use Filter::Simple; + + FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + } + ""; # or: 0 + +or: + + FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + } + { terminator => "" }; + +B<Note that, no matter what you set the terminator pattern to, +the actual terminator itself I<must> be contained on a single source line.> + + +=head2 All-in-one interface + +Separating the loading of Filter::Simple: + + use Filter::Simple; + +from the setting up of the filtering: + + FILTER { ... }; + +is useful because it allows other code (typically parser support code +or caching variables) to be defined before the filter is invoked. +However, there is often no need for such a separation. + +In those cases, it is easier to just append the filtering subroutine and +any terminator specification directly to the C<use> statement that loads +Filter::Simple, like so: + + use Filter::Simple sub { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + }; + +This is exactly the same as: + + use Filter::Simple; + BEGIN { + Filter::Simple::FILTER { + s/BANG\s+BANG/die 'BANG' if \$BANG/g; + }; + } + +except that the C<FILTER> subroutine is not exported by Filter::Simple. + + +=head2 Filtering only specific components of source code + +One of the problems with a filter like: + + use Filter::Simple; + + FILTER { s/BANG\s+BANG/die 'BANG' if \$BANG/g }; + +is that it indiscriminately applies the specified transformation to +the entire text of your source program. So something like: + + warn 'BANG BANG, YOU'RE DEAD'; + BANG BANG; + +will become: + + warn 'die 'BANG' if $BANG, YOU'RE DEAD'; + die 'BANG' if $BANG; + +It is very common when filtering source to only want to apply the filter +to the non-character-string parts of the code, or alternatively to I<only> +the character strings. + +Filter::Simple supports this type of filtering by automatically +exporting the C<FILTER_ONLY> subroutine. + +C<FILTER_ONLY> takes a sequence of specifiers that install separate +(and possibly multiple) filters that act on only parts of the source code. +For example: + + use Filter::Simple; + + FILTER_ONLY + code => sub { s/BANG\s+BANG/die 'BANG' if \$BANG/g }, + quotelike => sub { s/BANG\s+BANG/CHITTY CHITTY/g }; + +The C<"code"> subroutine will only be used to filter parts of the source +code that are not quotelikes, POD, or C<__DATA__>. The C<quotelike> +subroutine only filters Perl quotelikes (including here documents). + +The full list of alternatives is: + +=over + +=item C<"code"> + +Filters only those sections of the source code that are not quotelikes, POD, or +C<__DATA__>. + +=item C<"code_no_comments"> + +Filters only those sections of the source code that are not quotelikes, POD, +comments, or C<__DATA__>. + +=item C<"executable"> + +Filters only those sections of the source code that are not POD or C<__DATA__>. + +=item C<"executable_no_comments"> + +Filters only those sections of the source code that are not POD, comments, or C<__DATA__>. + +=item C<"quotelike"> + +Filters only Perl quotelikes (as interpreted by +C<&Text::Balanced::extract_quotelike>). + +=item C<"string"> + +Filters only the string literal parts of a Perl quotelike (i.e. the +contents of a string literal, either half of a C<tr///>, the second +half of an C<s///>). + +=item C<"regex"> + +Filters only the pattern literal parts of a Perl quotelike (i.e. the +contents of a C<qr//> or an C<m//>, the first half of an C<s///>). + +=item C<"all"> + +Filters everything. Identical in effect to C<FILTER>. + +=back + +Except for C<< FILTER_ONLY code => sub {...} >>, each of +the component filters is called repeatedly, once for each component +found in the source code. + +Note that you can also apply two or more of the same type of filter in +a single C<FILTER_ONLY>. For example, here's a simple +macro-preprocessor that is only applied within regexes, +with a final debugging pass that prints the resulting source code: + + use Regexp::Common; + FILTER_ONLY + regex => sub { s/!\[/[^/g }, + regex => sub { s/%d/$RE{num}{int}/g }, + regex => sub { s/%f/$RE{num}{real}/g }, + all => sub { print if $::DEBUG }; + + + +=head2 Filtering only the code parts of source code + +Most source code ceases to be grammatically correct when it is broken up +into the pieces between string literals and regexes. So the C<'code'> +and C<'code_no_comments'> component filter behave slightly differently +from the other partial filters described in the previous section. + +Rather than calling the specified processor on each individual piece of +code (i.e. on the bits between quotelikes), the C<'code...'> partial +filters operate on the entire source code, but with the quotelike bits +(and, in the case of C<'code_no_comments'>, the comments) "blanked out". + +That is, a C<'code...'> filter I<replaces> each quoted string, quotelike, +regex, POD, and __DATA__ section with a placeholder. The +delimiters of this placeholder are the contents of the C<$;> variable +at the time the filter is applied (normally C<"\034">). The remaining +four bytes are a unique identifier for the component being replaced. + +This approach makes it comparatively easy to write code preprocessors +without worrying about the form or contents of strings, regexes, etc. + +For convenience, during a C<'code...'> filtering operation, Filter::Simple +provides a package variable (C<$Filter::Simple::placeholder>) that +contains a pre-compiled regex that matches any placeholder...and +captures the identifier within the placeholder. Placeholders can be +moved and re-ordered within the source code as needed. + +In addition, a second package variable (C<@Filter::Simple::components>) +contains a list of the various pieces of C<$_>, as they were originally split +up to allow placeholders to be inserted. + +Once the filtering has been applied, the original strings, regexes, POD, +etc. are re-inserted into the code, by replacing each placeholder with +the corresponding original component (from C<@components>). Note that +this means that the C<@components> variable must be treated with extreme +care within the filter. The C<@components> array stores the "back- +translations" of each placeholder inserted into C<$_>, as well as the +interstitial source code between placeholders. If the placeholder +backtranslations are altered in C<@components>, they will be similarly +changed when the placeholders are removed from C<$_> after the filter +is complete. + +For example, the following filter detects concatenated pairs of +strings/quotelikes and reverses the order in which they are +concatenated: + + package DemoRevCat; + use Filter::Simple; + + FILTER_ONLY code => sub { + my $ph = $Filter::Simple::placeholder; + s{ ($ph) \s* [.] \s* ($ph) }{ $2.$1 }gx + }; + +Thus, the following code: + + use DemoRevCat; + + my $str = "abc" . q(def); + + print "$str\n"; + +would become: + + my $str = q(def)."abc"; + + print "$str\n"; + +and hence print: + + defabc + + +=head2 Using Filter::Simple with an explicit C<import> subroutine + +Filter::Simple generates a special C<import> subroutine for +your module (see L<"How it works">) which would normally replace any +C<import> subroutine you might have explicitly declared. + +However, Filter::Simple is smart enough to notice your existing +C<import> and Do The Right Thing with it. +That is, if you explicitly define an C<import> subroutine in a package +that's using Filter::Simple, that C<import> subroutine will still +be invoked immediately after any filter you install. + +The only thing you have to remember is that the C<import> subroutine +I<must> be declared I<before> the filter is installed. If you use C<FILTER> +to install the filter: + + package Filter::TurnItUpTo11; + + use Filter::Simple; + + FILTER { s/(\w+)/\U$1/ }; + +that will almost never be a problem, but if you install a filtering +subroutine by passing it directly to the C<use Filter::Simple> +statement: + + package Filter::TurnItUpTo11; + + use Filter::Simple sub{ s/(\w+)/\U$1/ }; + +then you must make sure that your C<import> subroutine appears before +that C<use> statement. + + +=head2 Using Filter::Simple and Exporter together + +Likewise, Filter::Simple is also smart enough +to Do The Right Thing if you use Exporter: + + package Switch; + use base Exporter; + use Filter::Simple; + + @EXPORT = qw(switch case); + @EXPORT_OK = qw(given when); + + FILTER { $_ = magic_Perl_filter($_) } + +Immediately after the filter has been applied to the source, +Filter::Simple will pass control to Exporter, so it can do its magic too. + +Of course, here too, Filter::Simple has to know you're using Exporter +before it applies the filter. That's almost never a problem, but if you're +nervous about it, you can guarantee that things will work correctly by +ensuring that your C<use base Exporter> always precedes your +C<use Filter::Simple>. + + +=head2 How it works + +The Filter::Simple module exports into the package that calls C<FILTER> +(or C<use>s it directly) -- such as package "BANG" in the above example -- +two automagically constructed +subroutines -- C<import> and C<unimport> -- which take care of all the +nasty details. + +In addition, the generated C<import> subroutine passes its own argument +list to the filtering subroutine, so the BANG.pm filter could easily +be made parametric: + + package BANG; + + use Filter::Simple; + + FILTER { + my ($die_msg, $var_name) = @_; + s/BANG\s+BANG/die '$die_msg' if \${$var_name}/g; + }; + + # and in some user code: + + use BANG "BOOM", "BAM"; # "BANG BANG" becomes: die 'BOOM' if $BAM + + +The specified filtering subroutine is called every time a C<use BANG> is +encountered, and passed all the source code following that call, up to +either the next C<no BANG;> (or whatever terminator you've set) or the +end of the source file, whichever occurs first. By default, any C<no +BANG;> call must appear by itself on a separate line, or it is ignored. + + +=head1 AUTHOR + +Damian Conway + +=head1 CONTACT + +Filter::Simple is now maintained by the Perl5-Porters. +Please submit bug via the C<perlbug> tool that comes with your perl. +For usage instructions, read C<perldoc perlbug> or possibly C<man perlbug>. +For mostly anything else, please contact E<lt>perl5-porters@perl.orgE<gt>. + +Maintainer of the CPAN release is Steffen Mueller E<lt>smueller@cpan.orgE<gt>. +Contact him with technical difficulties with respect to the packaging of the +CPAN module. + +Praise of the module, flowers, and presents still go to the author, +Damian Conway E<lt>damian@conway.orgE<gt>. + +=head1 COPYRIGHT AND LICENSE + + Copyright (c) 2000-2014, Damian Conway. All Rights Reserved. + This module is free software. It may be used, redistributed + and/or modified under the same terms as Perl itself. diff --git a/data/miniconda3/lib/perl5/core_perl/FindBin.pm b/data/miniconda3/lib/perl5/core_perl/FindBin.pm new file mode 100644 index 0000000000000000000000000000000000000000..cf6ecf2904024d7bb62b51a985e52014ade05fc0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/FindBin.pm @@ -0,0 +1,170 @@ +# FindBin.pm +# +# Copyright (c) 1995 Graham Barr & Nick Ing-Simmons. All rights reserved. +# This program is free software; you can redistribute it and/or modify it +# under the same terms as Perl itself. + +=head1 NAME + +FindBin - Locate directory of original perl script + +=head1 SYNOPSIS + + use FindBin; + use lib "$FindBin::Bin/../lib"; + + or + + use FindBin qw($Bin); + use lib "$Bin/../lib"; + +=head1 DESCRIPTION + +Locates the full path to the script bin directory to allow the use +of paths relative to the bin directory. + +This allows a user to setup a directory tree for some software with +directories C<< <root>/bin >> and C<< <root>/lib >>, and then the above +example will allow the use of modules in the lib directory without knowing +where the software tree is installed. + +If perl is invoked using the B<-e> option or the perl script is read from +C<STDIN> then FindBin sets both C<$Bin> and C<$RealBin> to the current +directory. + +=head1 EXPORTABLE VARIABLES + + $Bin - path to bin directory from where script was invoked + $Script - basename of script from which perl was invoked + $RealBin - $Bin with all links resolved + $RealScript - $Script with all links resolved + +=head1 KNOWN ISSUES + +If there are two modules using C<FindBin> from different directories +under the same interpreter, this won't work. Since C<FindBin> uses a +C<BEGIN> block, it'll be executed only once, and only the first caller +will get it right. This is a problem under mod_perl and other persistent +Perl environments, where you shouldn't use this module. Which also means +that you should avoid using C<FindBin> in modules that you plan to put +on CPAN. To make sure that C<FindBin> will work is to call the C<again> +function: + + use FindBin; + FindBin::again(); # or FindBin->again; + +In former versions of FindBin there was no C<again> function. The +workaround was to force the C<BEGIN> block to be executed again: + + delete $INC{'FindBin.pm'}; + require FindBin; + +=head1 AUTHORS + +FindBin is supported as part of the core perl distribution. Please send bug +reports to E<lt>F<perlbug@perl.org>E<gt> using the perlbug program +included with perl. + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt> +Nick Ing-Simmons E<lt>F<nik@tiuk.ti.com>E<gt> + +=head1 COPYRIGHT + +Copyright (c) 1995 Graham Barr & Nick Ing-Simmons. All rights reserved. +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + +package FindBin; +use Carp; +require 5.000; +require Exporter; +use Cwd qw(getcwd cwd abs_path); +use File::Basename; +use File::Spec; + +@EXPORT_OK = qw($Bin $Script $RealBin $RealScript $Dir $RealDir); +%EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]); +@ISA = qw(Exporter); + +$VERSION = "1.51"; + + +# needed for VMS-specific filename translation +if( $^O eq 'VMS' ) { + require VMS::Filespec; + VMS::Filespec->import; +} + +sub cwd2 { + my $cwd = getcwd(); + # getcwd might fail if it hasn't access to the current directory. + # try harder. + defined $cwd or $cwd = cwd(); + $cwd; +} + +sub init +{ + *Dir = \$Bin; + *RealDir = \$RealBin; + + if($0 eq '-e' || $0 eq '-') + { + # perl invoked with -e or script is on C<STDIN> + $Script = $RealScript = $0; + $Bin = $RealBin = cwd2(); + $Bin = VMS::Filespec::unixify($Bin) if $^O eq 'VMS'; + } + else + { + my $script = $0; + + if ($^O eq 'VMS') + { + ($Bin,$Script) = VMS::Filespec::rmsexpand($0) =~ /(.*[\]>\/]+)(.*)/s; + # C<use disk:[dev]/lib> isn't going to work, so unixify first + ($Bin = VMS::Filespec::unixify($Bin)) =~ s/\/\z//; + ($RealBin,$RealScript) = ($Bin,$Script); + } + else + { + croak("Cannot find current script '$0'") unless(-f $script); + + # Ensure $script contains the complete path in case we C<chdir> + + $script = File::Spec->catfile(cwd2(), $script) + unless File::Spec->file_name_is_absolute($script); + + ($Script,$Bin) = fileparse($script); + + # Resolve $script if it is a link + while(1) + { + my $linktext = readlink($script); + + ($RealScript,$RealBin) = fileparse($script); + last unless defined $linktext; + + $script = (File::Spec->file_name_is_absolute($linktext)) + ? $linktext + : File::Spec->catfile($RealBin, $linktext); + } + + # Get absolute paths to directories + if ($Bin) { + my $BinOld = $Bin; + $Bin = abs_path($Bin); + defined $Bin or $Bin = File::Spec->canonpath($BinOld); + } + $RealBin = abs_path($RealBin) if($RealBin); + } + } +} + +BEGIN { init } + +*again = \&init; + +1; # Keep require happy diff --git a/data/miniconda3/lib/perl5/core_perl/Getopt/Long.pm b/data/miniconda3/lib/perl5/core_perl/Getopt/Long.pm new file mode 100644 index 0000000000000000000000000000000000000000..70ac41595657a7dbf2961e6f424364433081e108 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Getopt/Long.pm @@ -0,0 +1,2772 @@ +#! perl + +# Getopt::Long.pm -- Universal options parsing +# Author : Johan Vromans +# Created On : Tue Sep 11 15:00:12 1990 +# Last Modified By: Johan Vromans +# Last Modified On: Mon Aug 12 17:05:46 2019 +# Update Count : 1728 +# Status : Released + +################ Module Preamble ################ + +use 5.004; + +use strict; +use warnings; + +package Getopt::Long; + +use vars qw($VERSION); +$VERSION = 2.51; +# For testing versions only. +use vars qw($VERSION_STRING); +$VERSION_STRING = "2.51"; + +use Exporter; +use vars qw(@ISA @EXPORT @EXPORT_OK); +@ISA = qw(Exporter); + +# Exported subroutines. +sub GetOptions(@); # always +sub GetOptionsFromArray(@); # on demand +sub GetOptionsFromString(@); # on demand +sub Configure(@); # on demand +sub HelpMessage(@); # on demand +sub VersionMessage(@); # in demand + +BEGIN { + # Init immediately so their contents can be used in the 'use vars' below. + @EXPORT = qw(&GetOptions $REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER); + @EXPORT_OK = qw(&HelpMessage &VersionMessage &Configure + &GetOptionsFromArray &GetOptionsFromString); +} + +# User visible variables. +use vars @EXPORT, @EXPORT_OK; +use vars qw($error $debug $major_version $minor_version); +# Deprecated visible variables. +use vars qw($autoabbrev $getopt_compat $ignorecase $bundling $order + $passthrough); +# Official invisible variables. +use vars qw($genprefix $caller $gnu_compat $auto_help $auto_version $longprefix); + +# Really invisible variables. +my $bundling_values; + +# Public subroutines. +sub config(@); # deprecated name + +# Private subroutines. +sub ConfigDefaults(); +sub ParseOptionSpec($$); +sub OptCtl($); +sub FindOption($$$$$); +sub ValidValue ($$$$$); + +################ Local Variables ################ + +# $requested_version holds the version that was mentioned in the 'use' +# or 'require', if any. It can be used to enable or disable specific +# features. +my $requested_version = 0; + +################ Resident subroutines ################ + +sub ConfigDefaults() { + # Handle POSIX compliancy. + if ( defined $ENV{"POSIXLY_CORRECT"} ) { + $genprefix = "(--|-)"; + $autoabbrev = 0; # no automatic abbrev of options + $bundling = 0; # no bundling of single letter switches + $getopt_compat = 0; # disallow '+' to start options + $order = $REQUIRE_ORDER; + } + else { + $genprefix = "(--|-|\\+)"; + $autoabbrev = 1; # automatic abbrev of options + $bundling = 0; # bundling off by default + $getopt_compat = 1; # allow '+' to start options + $order = $PERMUTE; + } + # Other configurable settings. + $debug = 0; # for debugging + $error = 0; # error tally + $ignorecase = 1; # ignore case when matching options + $passthrough = 0; # leave unrecognized options alone + $gnu_compat = 0; # require --opt=val if value is optional + $longprefix = "(--)"; # what does a long prefix look like + $bundling_values = 0; # no bundling of values +} + +# Override import. +sub import { + my $pkg = shift; # package + my @syms = (); # symbols to import + my @config = (); # configuration + my $dest = \@syms; # symbols first + for ( @_ ) { + if ( $_ eq ':config' ) { + $dest = \@config; # config next + next; + } + push(@$dest, $_); # push + } + # Hide one level and call super. + local $Exporter::ExportLevel = 1; + push(@syms, qw(&GetOptions)) if @syms; # always export GetOptions + $requested_version = 0; + $pkg->SUPER::import(@syms); + # And configure. + Configure(@config) if @config; +} + +################ Initialization ################ + +# Values for $order. See GNU getopt.c for details. +($REQUIRE_ORDER, $PERMUTE, $RETURN_IN_ORDER) = (0..2); +# Version major/minor numbers. +($major_version, $minor_version) = $VERSION =~ /^(\d+)\.(\d+)/; + +ConfigDefaults(); + +################ OO Interface ################ + +package Getopt::Long::Parser; + +# Store a copy of the default configuration. Since ConfigDefaults has +# just been called, what we get from Configure is the default. +my $default_config = do { + Getopt::Long::Configure () +}; + +sub new { + my $that = shift; + my $class = ref($that) || $that; + my %atts = @_; + + # Register the callers package. + my $self = { caller_pkg => (caller)[0] }; + + bless ($self, $class); + + # Process config attributes. + if ( defined $atts{config} ) { + my $save = Getopt::Long::Configure ($default_config, @{$atts{config}}); + $self->{settings} = Getopt::Long::Configure ($save); + delete ($atts{config}); + } + # Else use default config. + else { + $self->{settings} = $default_config; + } + + if ( %atts ) { # Oops + die(__PACKAGE__.": unhandled attributes: ". + join(" ", sort(keys(%atts)))."\n"); + } + + $self; +} + +sub configure { + my ($self) = shift; + + # Restore settings, merge new settings in. + my $save = Getopt::Long::Configure ($self->{settings}, @_); + + # Restore orig config and save the new config. + $self->{settings} = Getopt::Long::Configure ($save); +} + +sub getoptions { + my ($self) = shift; + + return $self->getoptionsfromarray(\@ARGV, @_); +} + +sub getoptionsfromarray { + my ($self) = shift; + + # Restore config settings. + my $save = Getopt::Long::Configure ($self->{settings}); + + # Call main routine. + my $ret = 0; + $Getopt::Long::caller = $self->{caller_pkg}; + + eval { + # Locally set exception handler to default, otherwise it will + # be called implicitly here, and again explicitly when we try + # to deliver the messages. + local ($SIG{__DIE__}) = 'DEFAULT'; + $ret = Getopt::Long::GetOptionsFromArray (@_); + }; + + # Restore saved settings. + Getopt::Long::Configure ($save); + + # Handle errors and return value. + die ($@) if $@; + return $ret; +} + +package Getopt::Long; + +################ Back to Normal ################ + +# Indices in option control info. +# Note that ParseOptions uses the fields directly. Search for 'hard-wired'. +use constant CTL_TYPE => 0; +#use constant CTL_TYPE_FLAG => ''; +#use constant CTL_TYPE_NEG => '!'; +#use constant CTL_TYPE_INCR => '+'; +#use constant CTL_TYPE_INT => 'i'; +#use constant CTL_TYPE_INTINC => 'I'; +#use constant CTL_TYPE_XINT => 'o'; +#use constant CTL_TYPE_FLOAT => 'f'; +#use constant CTL_TYPE_STRING => 's'; + +use constant CTL_CNAME => 1; + +use constant CTL_DEFAULT => 2; + +use constant CTL_DEST => 3; + use constant CTL_DEST_SCALAR => 0; + use constant CTL_DEST_ARRAY => 1; + use constant CTL_DEST_HASH => 2; + use constant CTL_DEST_CODE => 3; + +use constant CTL_AMIN => 4; +use constant CTL_AMAX => 5; + +# FFU. +#use constant CTL_RANGE => ; +#use constant CTL_REPEAT => ; + +# Rather liberal patterns to match numbers. +use constant PAT_INT => "[-+]?_*[0-9][0-9_]*"; +use constant PAT_XINT => + "(?:". + "[-+]?_*[1-9][0-9_]*". + "|". + "0x_*[0-9a-f][0-9a-f_]*". + "|". + "0b_*[01][01_]*". + "|". + "0[0-7_]*". + ")"; +use constant PAT_FLOAT => + "[-+]?". # optional sign + "(?=[0-9.])". # must start with digit or dec.point + "[0-9_]*". # digits before the dec.point + "(\.[0-9_]+)?". # optional fraction + "([eE][-+]?[0-9_]+)?"; # optional exponent + +sub GetOptions(@) { + # Shift in default array. + unshift(@_, \@ARGV); + # Try to keep caller() and Carp consistent. + goto &GetOptionsFromArray; +} + +sub GetOptionsFromString(@) { + my ($string) = shift; + require Text::ParseWords; + my $args = [ Text::ParseWords::shellwords($string) ]; + $caller ||= (caller)[0]; # current context + my $ret = GetOptionsFromArray($args, @_); + return ( $ret, $args ) if wantarray; + if ( @$args ) { + $ret = 0; + warn("GetOptionsFromString: Excess data \"@$args\" in string \"$string\"\n"); + } + $ret; +} + +sub GetOptionsFromArray(@) { + + my ($argv, @optionlist) = @_; # local copy of the option descriptions + my $argend = '--'; # option list terminator + my %opctl = (); # table of option specs + my $pkg = $caller || (caller)[0]; # current context + # Needed if linkage is omitted. + my @ret = (); # accum for non-options + my %linkage; # linkage + my $userlinkage; # user supplied HASH + my $opt; # current option + my $prefix = $genprefix; # current prefix + + $error = ''; + + if ( $debug ) { + # Avoid some warnings if debugging. + local ($^W) = 0; + print STDERR + ("Getopt::Long $Getopt::Long::VERSION_STRING ", + "called from package \"$pkg\".", + "\n ", + "argv: ", + defined($argv) + ? UNIVERSAL::isa( $argv, 'ARRAY' ) ? "(@$argv)" : $argv + : "<undef>", + "\n ", + "autoabbrev=$autoabbrev,". + "bundling=$bundling,", + "bundling_values=$bundling_values,", + "getopt_compat=$getopt_compat,", + "gnu_compat=$gnu_compat,", + "order=$order,", + "\n ", + "ignorecase=$ignorecase,", + "requested_version=$requested_version,", + "passthrough=$passthrough,", + "genprefix=\"$genprefix\",", + "longprefix=\"$longprefix\".", + "\n"); + } + + # Check for ref HASH as first argument. + # First argument may be an object. It's OK to use this as long + # as it is really a hash underneath. + $userlinkage = undef; + if ( @optionlist && ref($optionlist[0]) and + UNIVERSAL::isa($optionlist[0],'HASH') ) { + $userlinkage = shift (@optionlist); + print STDERR ("=> user linkage: $userlinkage\n") if $debug; + } + + # See if the first element of the optionlist contains option + # starter characters. + # Be careful not to interpret '<>' as option starters. + if ( @optionlist && $optionlist[0] =~ /^\W+$/ + && !($optionlist[0] eq '<>' + && @optionlist > 0 + && ref($optionlist[1])) ) { + $prefix = shift (@optionlist); + # Turn into regexp. Needs to be parenthesized! + $prefix =~ s/(\W)/\\$1/g; + $prefix = "([" . $prefix . "])"; + print STDERR ("=> prefix=\"$prefix\"\n") if $debug; + } + + # Verify correctness of optionlist. + %opctl = (); + while ( @optionlist ) { + my $opt = shift (@optionlist); + + unless ( defined($opt) ) { + $error .= "Undefined argument in option spec\n"; + next; + } + + # Strip leading prefix so people can specify "--foo=i" if they like. + $opt = $+ if $opt =~ /^$prefix+(.*)$/s; + + if ( $opt eq '<>' ) { + if ( (defined $userlinkage) + && !(@optionlist > 0 && ref($optionlist[0])) + && (exists $userlinkage->{$opt}) + && ref($userlinkage->{$opt}) ) { + unshift (@optionlist, $userlinkage->{$opt}); + } + unless ( @optionlist > 0 + && ref($optionlist[0]) && ref($optionlist[0]) eq 'CODE' ) { + $error .= "Option spec <> requires a reference to a subroutine\n"; + # Kill the linkage (to avoid another error). + shift (@optionlist) + if @optionlist && ref($optionlist[0]); + next; + } + $linkage{'<>'} = shift (@optionlist); + next; + } + + # Parse option spec. + my ($name, $orig) = ParseOptionSpec ($opt, \%opctl); + unless ( defined $name ) { + # Failed. $orig contains the error message. Sorry for the abuse. + $error .= $orig; + # Kill the linkage (to avoid another error). + shift (@optionlist) + if @optionlist && ref($optionlist[0]); + next; + } + + # If no linkage is supplied in the @optionlist, copy it from + # the userlinkage if available. + if ( defined $userlinkage ) { + unless ( @optionlist > 0 && ref($optionlist[0]) ) { + if ( exists $userlinkage->{$orig} && + ref($userlinkage->{$orig}) ) { + print STDERR ("=> found userlinkage for \"$orig\": ", + "$userlinkage->{$orig}\n") + if $debug; + unshift (@optionlist, $userlinkage->{$orig}); + } + else { + # Do nothing. Being undefined will be handled later. + next; + } + } + } + + # Copy the linkage. If omitted, link to global variable. + if ( @optionlist > 0 && ref($optionlist[0]) ) { + print STDERR ("=> link \"$orig\" to $optionlist[0]\n") + if $debug; + my $rl = ref($linkage{$orig} = shift (@optionlist)); + + if ( $rl eq "ARRAY" ) { + $opctl{$name}[CTL_DEST] = CTL_DEST_ARRAY; + } + elsif ( $rl eq "HASH" ) { + $opctl{$name}[CTL_DEST] = CTL_DEST_HASH; + } + elsif ( $rl eq "SCALAR" || $rl eq "REF" ) { +# if ( $opctl{$name}[CTL_DEST] == CTL_DEST_ARRAY ) { +# my $t = $linkage{$orig}; +# $$t = $linkage{$orig} = []; +# } +# elsif ( $opctl{$name}[CTL_DEST] == CTL_DEST_HASH ) { +# } +# else { + # Ok. +# } + } + elsif ( $rl eq "CODE" ) { + # Ok. + } + else { + $error .= "Invalid option linkage for \"$opt\"\n"; + } + } + else { + # Link to global $opt_XXX variable. + # Make sure a valid perl identifier results. + my $ov = $orig; + $ov =~ s/\W/_/g; + if ( $opctl{$name}[CTL_DEST] == CTL_DEST_ARRAY ) { + print STDERR ("=> link \"$orig\" to \@$pkg","::opt_$ov\n") + if $debug; + eval ("\$linkage{\$orig} = \\\@".$pkg."::opt_$ov;"); + } + elsif ( $opctl{$name}[CTL_DEST] == CTL_DEST_HASH ) { + print STDERR ("=> link \"$orig\" to \%$pkg","::opt_$ov\n") + if $debug; + eval ("\$linkage{\$orig} = \\\%".$pkg."::opt_$ov;"); + } + else { + print STDERR ("=> link \"$orig\" to \$$pkg","::opt_$ov\n") + if $debug; + eval ("\$linkage{\$orig} = \\\$".$pkg."::opt_$ov;"); + } + } + + if ( $opctl{$name}[CTL_TYPE] eq 'I' + && ( $opctl{$name}[CTL_DEST] == CTL_DEST_ARRAY + || $opctl{$name}[CTL_DEST] == CTL_DEST_HASH ) + ) { + $error .= "Invalid option linkage for \"$opt\"\n"; + } + + } + + $error .= "GetOptionsFromArray: 1st parameter is not an array reference\n" + unless $argv && UNIVERSAL::isa( $argv, 'ARRAY' ); + + # Bail out if errors found. + die ($error) if $error; + $error = 0; + + # Supply --version and --help support, if needed and allowed. + if ( defined($auto_version) ? $auto_version : ($requested_version >= 2.3203) ) { + if ( !defined($opctl{version}) ) { + $opctl{version} = ['','version',0,CTL_DEST_CODE,undef]; + $linkage{version} = \&VersionMessage; + } + $auto_version = 1; + } + if ( defined($auto_help) ? $auto_help : ($requested_version >= 2.3203) ) { + if ( !defined($opctl{help}) && !defined($opctl{'?'}) ) { + $opctl{help} = $opctl{'?'} = ['','help',0,CTL_DEST_CODE,undef]; + $linkage{help} = \&HelpMessage; + } + $auto_help = 1; + } + + # Show the options tables if debugging. + if ( $debug ) { + my ($arrow, $k, $v); + $arrow = "=> "; + while ( ($k,$v) = each(%opctl) ) { + print STDERR ($arrow, "\$opctl{$k} = $v ", OptCtl($v), "\n"); + $arrow = " "; + } + } + + # Process argument list + my $goon = 1; + while ( $goon && @$argv > 0 ) { + + # Get next argument. + $opt = shift (@$argv); + print STDERR ("=> arg \"", $opt, "\"\n") if $debug; + + # Double dash is option list terminator. + if ( defined($opt) && $opt eq $argend ) { + push (@ret, $argend) if $passthrough; + last; + } + + # Look it up. + my $tryopt = $opt; + my $found; # success status + my $key; # key (if hash type) + my $arg; # option argument + my $ctl; # the opctl entry + + ($found, $opt, $ctl, $arg, $key) = + FindOption ($argv, $prefix, $argend, $opt, \%opctl); + + if ( $found ) { + + # FindOption undefines $opt in case of errors. + next unless defined $opt; + + my $argcnt = 0; + while ( defined $arg ) { + + # Get the canonical name. + print STDERR ("=> cname for \"$opt\" is ") if $debug; + $opt = $ctl->[CTL_CNAME]; + print STDERR ("\"$ctl->[CTL_CNAME]\"\n") if $debug; + + if ( defined $linkage{$opt} ) { + print STDERR ("=> ref(\$L{$opt}) -> ", + ref($linkage{$opt}), "\n") if $debug; + + if ( ref($linkage{$opt}) eq 'SCALAR' + || ref($linkage{$opt}) eq 'REF' ) { + if ( $ctl->[CTL_TYPE] eq '+' ) { + print STDERR ("=> \$\$L{$opt} += \"$arg\"\n") + if $debug; + if ( defined ${$linkage{$opt}} ) { + ${$linkage{$opt}} += $arg; + } + else { + ${$linkage{$opt}} = $arg; + } + } + elsif ( $ctl->[CTL_DEST] == CTL_DEST_ARRAY ) { + print STDERR ("=> ref(\$L{$opt}) auto-vivified", + " to ARRAY\n") + if $debug; + my $t = $linkage{$opt}; + $$t = $linkage{$opt} = []; + print STDERR ("=> push(\@{\$L{$opt}, \"$arg\")\n") + if $debug; + push (@{$linkage{$opt}}, $arg); + } + elsif ( $ctl->[CTL_DEST] == CTL_DEST_HASH ) { + print STDERR ("=> ref(\$L{$opt}) auto-vivified", + " to HASH\n") + if $debug; + my $t = $linkage{$opt}; + $$t = $linkage{$opt} = {}; + print STDERR ("=> \$\$L{$opt}->{$key} = \"$arg\"\n") + if $debug; + $linkage{$opt}->{$key} = $arg; + } + else { + print STDERR ("=> \$\$L{$opt} = \"$arg\"\n") + if $debug; + ${$linkage{$opt}} = $arg; + } + } + elsif ( ref($linkage{$opt}) eq 'ARRAY' ) { + print STDERR ("=> push(\@{\$L{$opt}, \"$arg\")\n") + if $debug; + push (@{$linkage{$opt}}, $arg); + } + elsif ( ref($linkage{$opt}) eq 'HASH' ) { + print STDERR ("=> \$\$L{$opt}->{$key} = \"$arg\"\n") + if $debug; + $linkage{$opt}->{$key} = $arg; + } + elsif ( ref($linkage{$opt}) eq 'CODE' ) { + print STDERR ("=> &L{$opt}(\"$opt\"", + $ctl->[CTL_DEST] == CTL_DEST_HASH ? ", \"$key\"" : "", + ", \"$arg\")\n") + if $debug; + my $eval_error = do { + local $@; + local $SIG{__DIE__} = 'DEFAULT'; + eval { + &{$linkage{$opt}} + (Getopt::Long::CallBack->new + (name => $opt, + ctl => $ctl, + opctl => \%opctl, + linkage => \%linkage, + prefix => $prefix, + ), + $ctl->[CTL_DEST] == CTL_DEST_HASH ? ($key) : (), + $arg); + }; + $@; + }; + print STDERR ("=> die($eval_error)\n") + if $debug && $eval_error ne ''; + if ( $eval_error =~ /^!/ ) { + if ( $eval_error =~ /^!FINISH\b/ ) { + $goon = 0; + } + } + elsif ( $eval_error ne '' ) { + warn ($eval_error); + $error++; + } + } + else { + print STDERR ("Invalid REF type \"", ref($linkage{$opt}), + "\" in linkage\n"); + die("Getopt::Long -- internal error!\n"); + } + } + # No entry in linkage means entry in userlinkage. + elsif ( $ctl->[CTL_DEST] == CTL_DEST_ARRAY ) { + if ( defined $userlinkage->{$opt} ) { + print STDERR ("=> push(\@{\$L{$opt}}, \"$arg\")\n") + if $debug; + push (@{$userlinkage->{$opt}}, $arg); + } + else { + print STDERR ("=>\$L{$opt} = [\"$arg\"]\n") + if $debug; + $userlinkage->{$opt} = [$arg]; + } + } + elsif ( $ctl->[CTL_DEST] == CTL_DEST_HASH ) { + if ( defined $userlinkage->{$opt} ) { + print STDERR ("=> \$L{$opt}->{$key} = \"$arg\"\n") + if $debug; + $userlinkage->{$opt}->{$key} = $arg; + } + else { + print STDERR ("=>\$L{$opt} = {$key => \"$arg\"}\n") + if $debug; + $userlinkage->{$opt} = {$key => $arg}; + } + } + else { + if ( $ctl->[CTL_TYPE] eq '+' ) { + print STDERR ("=> \$L{$opt} += \"$arg\"\n") + if $debug; + if ( defined $userlinkage->{$opt} ) { + $userlinkage->{$opt} += $arg; + } + else { + $userlinkage->{$opt} = $arg; + } + } + else { + print STDERR ("=>\$L{$opt} = \"$arg\"\n") if $debug; + $userlinkage->{$opt} = $arg; + } + } + + $argcnt++; + last if $argcnt >= $ctl->[CTL_AMAX] && $ctl->[CTL_AMAX] != -1; + undef($arg); + + # Need more args? + if ( $argcnt < $ctl->[CTL_AMIN] ) { + if ( @$argv ) { + if ( ValidValue($ctl, $argv->[0], 1, $argend, $prefix) ) { + $arg = shift(@$argv); + if ( $ctl->[CTL_TYPE] =~ /^[iIo]$/ ) { + $arg =~ tr/_//d; + $arg = $ctl->[CTL_TYPE] eq 'o' && $arg =~ /^0/ + ? oct($arg) + : 0+$arg + } + ($key,$arg) = $arg =~ /^([^=]+)=(.*)/ + if $ctl->[CTL_DEST] == CTL_DEST_HASH; + next; + } + warn("Value \"$$argv[0]\" invalid for option $opt\n"); + $error++; + } + else { + warn("Insufficient arguments for option $opt\n"); + $error++; + } + } + + # Any more args? + if ( @$argv && ValidValue($ctl, $argv->[0], 0, $argend, $prefix) ) { + $arg = shift(@$argv); + if ( $ctl->[CTL_TYPE] =~ /^[iIo]$/ ) { + $arg =~ tr/_//d; + $arg = $ctl->[CTL_TYPE] eq 'o' && $arg =~ /^0/ + ? oct($arg) + : 0+$arg + } + ($key,$arg) = $arg =~ /^([^=]+)=(.*)/ + if $ctl->[CTL_DEST] == CTL_DEST_HASH; + next; + } + } + } + + # Not an option. Save it if we $PERMUTE and don't have a <>. + elsif ( $order == $PERMUTE ) { + # Try non-options call-back. + my $cb; + if ( defined ($cb = $linkage{'<>'}) ) { + print STDERR ("=> &L{$tryopt}(\"$tryopt\")\n") + if $debug; + my $eval_error = do { + local $@; + local $SIG{__DIE__} = 'DEFAULT'; + eval { + # The arg to <> cannot be the CallBack object + # since it may be passed to other modules that + # get confused (e.g., Archive::Tar). Well, + # it's not relevant for this callback anyway. + &$cb($tryopt); + }; + $@; + }; + print STDERR ("=> die($eval_error)\n") + if $debug && $eval_error ne ''; + if ( $eval_error =~ /^!/ ) { + if ( $eval_error =~ /^!FINISH\b/ ) { + $goon = 0; + } + } + elsif ( $eval_error ne '' ) { + warn ($eval_error); + $error++; + } + } + else { + print STDERR ("=> saving \"$tryopt\" ", + "(not an option, may permute)\n") if $debug; + push (@ret, $tryopt); + } + next; + } + + # ...otherwise, terminate. + else { + # Push this one back and exit. + unshift (@$argv, $tryopt); + return ($error == 0); + } + + } + + # Finish. + if ( @ret && ( $order == $PERMUTE || $passthrough ) ) { + # Push back accumulated arguments + print STDERR ("=> restoring \"", join('" "', @ret), "\"\n") + if $debug; + unshift (@$argv, @ret); + } + + return ($error == 0); +} + +# A readable representation of what's in an optbl. +sub OptCtl ($) { + my ($v) = @_; + my @v = map { defined($_) ? ($_) : ("<undef>") } @$v; + "[". + join(",", + "\"$v[CTL_TYPE]\"", + "\"$v[CTL_CNAME]\"", + "\"$v[CTL_DEFAULT]\"", + ("\$","\@","\%","\&")[$v[CTL_DEST] || 0], + $v[CTL_AMIN] || '', + $v[CTL_AMAX] || '', +# $v[CTL_RANGE] || '', +# $v[CTL_REPEAT] || '', + ). "]"; +} + +# Parse an option specification and fill the tables. +sub ParseOptionSpec ($$) { + my ($opt, $opctl) = @_; + + # Match option spec. + if ( $opt !~ m;^ + ( + # Option name + (?: \w+[-\w]* ) + # Aliases + (?: \| (?: . [^|!+=:]* )? )* + )? + ( + # Either modifiers ... + [!+] + | + # ... or a value/dest/repeat specification + [=:] [ionfs] [@%]? (?: \{\d*,?\d*\} )? + | + # ... or an optional-with-default spec + : (?: -?\d+ | \+ ) [@%]? + )? + $;x ) { + return (undef, "Error in option spec: \"$opt\"\n"); + } + + my ($names, $spec) = ($1, $2); + $spec = '' unless defined $spec; + + # $orig keeps track of the primary name the user specified. + # This name will be used for the internal or external linkage. + # In other words, if the user specifies "FoO|BaR", it will + # match any case combinations of 'foo' and 'bar', but if a global + # variable needs to be set, it will be $opt_FoO in the exact case + # as specified. + my $orig; + + my @names; + if ( defined $names ) { + @names = split (/\|/, $names); + $orig = $names[0]; + } + else { + @names = (''); + $orig = ''; + } + + # Construct the opctl entries. + my $entry; + if ( $spec eq '' || $spec eq '+' || $spec eq '!' ) { + # Fields are hard-wired here. + $entry = [$spec,$orig,undef,CTL_DEST_SCALAR,0,0]; + } + elsif ( $spec =~ /^:(-?\d+|\+)([@%])?$/ ) { + my $def = $1; + my $dest = $2; + my $type = $def eq '+' ? 'I' : 'i'; + $dest ||= '$'; + $dest = $dest eq '@' ? CTL_DEST_ARRAY + : $dest eq '%' ? CTL_DEST_HASH : CTL_DEST_SCALAR; + # Fields are hard-wired here. + $entry = [$type,$orig,$def eq '+' ? undef : $def, + $dest,0,1]; + } + else { + my ($mand, $type, $dest) = + $spec =~ /^([=:])([ionfs])([@%])?(\{(\d+)?(,)?(\d+)?\})?$/; + return (undef, "Cannot repeat while bundling: \"$opt\"\n") + if $bundling && defined($4); + my ($mi, $cm, $ma) = ($5, $6, $7); + return (undef, "{0} is useless in option spec: \"$opt\"\n") + if defined($mi) && !$mi && !defined($ma) && !defined($cm); + + $type = 'i' if $type eq 'n'; + $dest ||= '$'; + $dest = $dest eq '@' ? CTL_DEST_ARRAY + : $dest eq '%' ? CTL_DEST_HASH : CTL_DEST_SCALAR; + # Default minargs to 1/0 depending on mand status. + $mi = $mand eq '=' ? 1 : 0 unless defined $mi; + # Adjust mand status according to minargs. + $mand = $mi ? '=' : ':'; + # Adjust maxargs. + $ma = $mi ? $mi : 1 unless defined $ma || defined $cm; + return (undef, "Max must be greater than zero in option spec: \"$opt\"\n") + if defined($ma) && !$ma; + return (undef, "Max less than min in option spec: \"$opt\"\n") + if defined($ma) && $ma < $mi; + + # Fields are hard-wired here. + $entry = [$type,$orig,undef,$dest,$mi,$ma||-1]; + } + + # Process all names. First is canonical, the rest are aliases. + my $dups = ''; + foreach ( @names ) { + + $_ = lc ($_) + if $ignorecase > (($bundling && length($_) == 1) ? 1 : 0); + + if ( exists $opctl->{$_} ) { + $dups .= "Duplicate specification \"$opt\" for option \"$_\"\n"; + } + + if ( $spec eq '!' ) { + $opctl->{"no$_"} = $entry; + $opctl->{"no-$_"} = $entry; + $opctl->{$_} = [@$entry]; + $opctl->{$_}->[CTL_TYPE] = ''; + } + else { + $opctl->{$_} = $entry; + } + } + + if ( $dups && $^W ) { + foreach ( split(/\n+/, $dups) ) { + warn($_."\n"); + } + } + ($names[0], $orig); +} + +# Option lookup. +sub FindOption ($$$$$) { + + # returns (1, $opt, $ctl, $arg, $key) if okay, + # returns (1, undef) if option in error, + # returns (0) otherwise. + + my ($argv, $prefix, $argend, $opt, $opctl) = @_; + + print STDERR ("=> find \"$opt\"\n") if $debug; + + return (0) unless defined($opt); + return (0) unless $opt =~ /^($prefix)(.*)$/s; + return (0) if $opt eq "-" && !defined $opctl->{''}; + + $opt = substr( $opt, length($1) ); # retain taintedness + my $starter = $1; + + print STDERR ("=> split \"$starter\"+\"$opt\"\n") if $debug; + + my $optarg; # value supplied with --opt=value + my $rest; # remainder from unbundling + + # If it is a long option, it may include the value. + # With getopt_compat, only if not bundling. + if ( ($starter=~/^$longprefix$/ + || ($getopt_compat && ($bundling == 0 || $bundling == 2))) + && (my $oppos = index($opt, '=', 1)) > 0) { + my $optorg = $opt; + $opt = substr($optorg, 0, $oppos); + $optarg = substr($optorg, $oppos + 1); # retain tainedness + print STDERR ("=> option \"", $opt, + "\", optarg = \"$optarg\"\n") if $debug; + } + + #### Look it up ### + + my $tryopt = $opt; # option to try + + if ( ( $bundling || $bundling_values ) && $starter eq '-' ) { + + # To try overrides, obey case ignore. + $tryopt = $ignorecase ? lc($opt) : $opt; + + # If bundling == 2, long options can override bundles. + if ( $bundling == 2 && length($tryopt) > 1 + && defined ($opctl->{$tryopt}) ) { + print STDERR ("=> $starter$tryopt overrides unbundling\n") + if $debug; + } + + # If bundling_values, option may be followed by the value. + elsif ( $bundling_values ) { + $tryopt = $opt; + # Unbundle single letter option. + $rest = length ($tryopt) > 0 ? substr ($tryopt, 1) : ''; + $tryopt = substr ($tryopt, 0, 1); + $tryopt = lc ($tryopt) if $ignorecase > 1; + print STDERR ("=> $starter$tryopt unbundled from ", + "$starter$tryopt$rest\n") if $debug; + # Whatever remains may not be considered an option. + $optarg = $rest eq '' ? undef : $rest; + $rest = undef; + } + + # Split off a single letter and leave the rest for + # further processing. + else { + $tryopt = $opt; + # Unbundle single letter option. + $rest = length ($tryopt) > 0 ? substr ($tryopt, 1) : ''; + $tryopt = substr ($tryopt, 0, 1); + $tryopt = lc ($tryopt) if $ignorecase > 1; + print STDERR ("=> $starter$tryopt unbundled from ", + "$starter$tryopt$rest\n") if $debug; + $rest = undef unless $rest ne ''; + } + } + + # Try auto-abbreviation. + elsif ( $autoabbrev && $opt ne "" ) { + # Sort the possible long option names. + my @names = sort(keys (%$opctl)); + # Downcase if allowed. + $opt = lc ($opt) if $ignorecase; + $tryopt = $opt; + # Turn option name into pattern. + my $pat = quotemeta ($opt); + # Look up in option names. + my @hits = grep (/^$pat/, @names); + print STDERR ("=> ", scalar(@hits), " hits (@hits) with \"$pat\" ", + "out of ", scalar(@names), "\n") if $debug; + + # Check for ambiguous results. + unless ( (@hits <= 1) || (grep ($_ eq $opt, @hits) == 1) ) { + # See if all matches are for the same option. + my %hit; + foreach ( @hits ) { + my $hit = $opctl->{$_}->[CTL_CNAME] + if defined $opctl->{$_}->[CTL_CNAME]; + $hit = "no" . $hit if $opctl->{$_}->[CTL_TYPE] eq '!'; + $hit{$hit} = 1; + } + # Remove auto-supplied options (version, help). + if ( keys(%hit) == 2 ) { + if ( $auto_version && exists($hit{version}) ) { + delete $hit{version}; + } + elsif ( $auto_help && exists($hit{help}) ) { + delete $hit{help}; + } + } + # Now see if it really is ambiguous. + unless ( keys(%hit) == 1 ) { + return (0) if $passthrough; + warn ("Option ", $opt, " is ambiguous (", + join(", ", @hits), ")\n"); + $error++; + return (1, undef); + } + @hits = keys(%hit); + } + + # Complete the option name, if appropriate. + if ( @hits == 1 && $hits[0] ne $opt ) { + $tryopt = $hits[0]; + $tryopt = lc ($tryopt) + if $ignorecase > (($bundling && length($tryopt) == 1) ? 1 : 0); + print STDERR ("=> option \"$opt\" -> \"$tryopt\"\n") + if $debug; + } + } + + # Map to all lowercase if ignoring case. + elsif ( $ignorecase ) { + $tryopt = lc ($opt); + } + + # Check validity by fetching the info. + my $ctl = $opctl->{$tryopt}; + unless ( defined $ctl ) { + return (0) if $passthrough; + # Pretend one char when bundling. + if ( $bundling == 1 && length($starter) == 1 ) { + $opt = substr($opt,0,1); + unshift (@$argv, $starter.$rest) if defined $rest; + } + if ( $opt eq "" ) { + warn ("Missing option after ", $starter, "\n"); + } + else { + warn ("Unknown option: ", $opt, "\n"); + } + $error++; + return (1, undef); + } + # Apparently valid. + $opt = $tryopt; + print STDERR ("=> found ", OptCtl($ctl), + " for \"", $opt, "\"\n") if $debug; + + #### Determine argument status #### + + # If it is an option w/o argument, we're almost finished with it. + my $type = $ctl->[CTL_TYPE]; + my $arg; + + if ( $type eq '' || $type eq '!' || $type eq '+' ) { + if ( defined $optarg ) { + return (0) if $passthrough; + warn ("Option ", $opt, " does not take an argument\n"); + $error++; + undef $opt; + undef $optarg if $bundling_values; + } + elsif ( $type eq '' || $type eq '+' ) { + # Supply explicit value. + $arg = 1; + } + else { + $opt =~ s/^no-?//i; # strip NO prefix + $arg = 0; # supply explicit value + } + unshift (@$argv, $starter.$rest) if defined $rest; + return (1, $opt, $ctl, $arg); + } + + # Get mandatory status and type info. + my $mand = $ctl->[CTL_AMIN]; + + # Check if there is an option argument available. + if ( $gnu_compat ) { + my $optargtype = 0; # none, 1 = empty, 2 = nonempty, 3 = aux + if ( defined($optarg) ) { + $optargtype = (length($optarg) == 0) ? 1 : 2; + } + elsif ( defined $rest || @$argv > 0 ) { + # GNU getopt_long() does not accept the (optional) + # argument to be passed to the option without = sign. + # We do, since not doing so breaks existing scripts. + $optargtype = 3; + } + if(($optargtype == 0) && !$mand) { + if ( $type eq 'I' ) { + # Fake incremental type. + my @c = @$ctl; + $c[CTL_TYPE] = '+'; + return (1, $opt, \@c, 1); + } + my $val + = defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] + : $type eq 's' ? '' + : 0; + return (1, $opt, $ctl, $val); + } + return (1, $opt, $ctl, $type eq 's' ? '' : 0) + if $optargtype == 1; # --foo= -> return nothing + } + + # Check if there is an option argument available. + if ( defined $optarg + ? ($optarg eq '') + : !(defined $rest || @$argv > 0) ) { + # Complain if this option needs an argument. +# if ( $mand && !($type eq 's' ? defined($optarg) : 0) ) { + if ( $mand ) { + return (0) if $passthrough; + warn ("Option ", $opt, " requires an argument\n"); + $error++; + return (1, undef); + } + if ( $type eq 'I' ) { + # Fake incremental type. + my @c = @$ctl; + $c[CTL_TYPE] = '+'; + return (1, $opt, \@c, 1); + } + return (1, $opt, $ctl, + defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : + $type eq 's' ? '' : 0); + } + + # Get (possibly optional) argument. + $arg = (defined $rest ? $rest + : (defined $optarg ? $optarg : shift (@$argv))); + + # Get key if this is a "name=value" pair for a hash option. + my $key; + if ($ctl->[CTL_DEST] == CTL_DEST_HASH && defined $arg) { + ($key, $arg) = ($arg =~ /^([^=]*)=(.*)$/s) ? ($1, $2) + : ($arg, defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : + ($mand ? undef : ($type eq 's' ? "" : 1))); + if (! defined $arg) { + warn ("Option $opt, key \"$key\", requires a value\n"); + $error++; + # Push back. + unshift (@$argv, $starter.$rest) if defined $rest; + return (1, undef); + } + } + + #### Check if the argument is valid for this option #### + + my $key_valid = $ctl->[CTL_DEST] == CTL_DEST_HASH ? "[^=]+=" : ""; + + if ( $type eq 's' ) { # string + # A mandatory string takes anything. + return (1, $opt, $ctl, $arg, $key) if $mand; + + # Same for optional string as a hash value + return (1, $opt, $ctl, $arg, $key) + if $ctl->[CTL_DEST] == CTL_DEST_HASH; + + # An optional string takes almost anything. + return (1, $opt, $ctl, $arg, $key) + if defined $optarg || defined $rest; + return (1, $opt, $ctl, $arg, $key) if $arg eq "-"; # ?? + + # Check for option or option list terminator. + if ($arg eq $argend || + $arg =~ /^$prefix.+/) { + # Push back. + unshift (@$argv, $arg); + # Supply empty value. + $arg = ''; + } + } + + elsif ( $type eq 'i' # numeric/integer + || $type eq 'I' # numeric/integer w/ incr default + || $type eq 'o' ) { # dec/oct/hex/bin value + + my $o_valid = $type eq 'o' ? PAT_XINT : PAT_INT; + + if ( $bundling && defined $rest + && $rest =~ /^($key_valid)($o_valid)(.*)$/si ) { + ($key, $arg, $rest) = ($1, $2, $+); + chop($key) if $key; + $arg = ($type eq 'o' && $arg =~ /^0/) ? oct($arg) : 0+$arg; + unshift (@$argv, $starter.$rest) if defined $rest && $rest ne ''; + } + elsif ( $arg =~ /^$o_valid$/si ) { + $arg =~ tr/_//d; + $arg = ($type eq 'o' && $arg =~ /^0/) ? oct($arg) : 0+$arg; + } + else { + if ( defined $optarg || $mand ) { + if ( $passthrough ) { + unshift (@$argv, defined $rest ? $starter.$rest : $arg) + unless defined $optarg; + return (0); + } + warn ("Value \"", $arg, "\" invalid for option ", + $opt, " (", + $type eq 'o' ? "extended " : '', + "number expected)\n"); + $error++; + # Push back. + unshift (@$argv, $starter.$rest) if defined $rest; + return (1, undef); + } + else { + # Push back. + unshift (@$argv, defined $rest ? $starter.$rest : $arg); + if ( $type eq 'I' ) { + # Fake incremental type. + my @c = @$ctl; + $c[CTL_TYPE] = '+'; + return (1, $opt, \@c, 1); + } + # Supply default value. + $arg = defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT] : 0; + } + } + } + + elsif ( $type eq 'f' ) { # real number, int is also ok + my $o_valid = PAT_FLOAT; + if ( $bundling && defined $rest && + $rest =~ /^($key_valid)($o_valid)(.*)$/s ) { + $arg =~ tr/_//d; + ($key, $arg, $rest) = ($1, $2, $+); + chop($key) if $key; + unshift (@$argv, $starter.$rest) if defined $rest && $rest ne ''; + } + elsif ( $arg =~ /^$o_valid$/ ) { + $arg =~ tr/_//d; + } + else { + if ( defined $optarg || $mand ) { + if ( $passthrough ) { + unshift (@$argv, defined $rest ? $starter.$rest : $arg) + unless defined $optarg; + return (0); + } + warn ("Value \"", $arg, "\" invalid for option ", + $opt, " (real number expected)\n"); + $error++; + # Push back. + unshift (@$argv, $starter.$rest) if defined $rest; + return (1, undef); + } + else { + # Push back. + unshift (@$argv, defined $rest ? $starter.$rest : $arg); + # Supply default value. + $arg = 0.0; + } + } + } + else { + die("Getopt::Long internal error (Can't happen)\n"); + } + return (1, $opt, $ctl, $arg, $key); +} + +sub ValidValue ($$$$$) { + my ($ctl, $arg, $mand, $argend, $prefix) = @_; + + if ( $ctl->[CTL_DEST] == CTL_DEST_HASH ) { + return 0 unless $arg =~ /[^=]+=(.*)/; + $arg = $1; + } + + my $type = $ctl->[CTL_TYPE]; + + if ( $type eq 's' ) { # string + # A mandatory string takes anything. + return (1) if $mand; + + return (1) if $arg eq "-"; + + # Check for option or option list terminator. + return 0 if $arg eq $argend || $arg =~ /^$prefix.+/; + return 1; + } + + elsif ( $type eq 'i' # numeric/integer + || $type eq 'I' # numeric/integer w/ incr default + || $type eq 'o' ) { # dec/oct/hex/bin value + + my $o_valid = $type eq 'o' ? PAT_XINT : PAT_INT; + return $arg =~ /^$o_valid$/si; + } + + elsif ( $type eq 'f' ) { # real number, int is also ok + my $o_valid = PAT_FLOAT; + return $arg =~ /^$o_valid$/; + } + die("ValidValue: Cannot happen\n"); +} + +# Getopt::Long Configuration. +sub Configure (@) { + my (@options) = @_; + + my $prevconfig = + [ $error, $debug, $major_version, $minor_version, $caller, + $autoabbrev, $getopt_compat, $ignorecase, $bundling, $order, + $gnu_compat, $passthrough, $genprefix, $auto_version, $auto_help, + $longprefix, $bundling_values ]; + + if ( ref($options[0]) eq 'ARRAY' ) { + ( $error, $debug, $major_version, $minor_version, $caller, + $autoabbrev, $getopt_compat, $ignorecase, $bundling, $order, + $gnu_compat, $passthrough, $genprefix, $auto_version, $auto_help, + $longprefix, $bundling_values ) = @{shift(@options)}; + } + + my $opt; + foreach $opt ( @options ) { + my $try = lc ($opt); + my $action = 1; + if ( $try =~ /^no_?(.*)$/s ) { + $action = 0; + $try = $+; + } + if ( ($try eq 'default' or $try eq 'defaults') && $action ) { + ConfigDefaults (); + } + elsif ( ($try eq 'posix_default' or $try eq 'posix_defaults') ) { + local $ENV{POSIXLY_CORRECT}; + $ENV{POSIXLY_CORRECT} = 1 if $action; + ConfigDefaults (); + } + elsif ( $try eq 'auto_abbrev' or $try eq 'autoabbrev' ) { + $autoabbrev = $action; + } + elsif ( $try eq 'getopt_compat' ) { + $getopt_compat = $action; + $genprefix = $action ? "(--|-|\\+)" : "(--|-)"; + } + elsif ( $try eq 'gnu_getopt' ) { + if ( $action ) { + $gnu_compat = 1; + $bundling = 1; + $getopt_compat = 0; + $genprefix = "(--|-)"; + $order = $PERMUTE; + $bundling_values = 0; + } + } + elsif ( $try eq 'gnu_compat' ) { + $gnu_compat = $action; + $bundling = 0; + $bundling_values = 1; + } + elsif ( $try =~ /^(auto_?)?version$/ ) { + $auto_version = $action; + } + elsif ( $try =~ /^(auto_?)?help$/ ) { + $auto_help = $action; + } + elsif ( $try eq 'ignorecase' or $try eq 'ignore_case' ) { + $ignorecase = $action; + } + elsif ( $try eq 'ignorecase_always' or $try eq 'ignore_case_always' ) { + $ignorecase = $action ? 2 : 0; + } + elsif ( $try eq 'bundling' ) { + $bundling = $action; + $bundling_values = 0 if $action; + } + elsif ( $try eq 'bundling_override' ) { + $bundling = $action ? 2 : 0; + $bundling_values = 0 if $action; + } + elsif ( $try eq 'bundling_values' ) { + $bundling_values = $action; + $bundling = 0 if $action; + } + elsif ( $try eq 'require_order' ) { + $order = $action ? $REQUIRE_ORDER : $PERMUTE; + } + elsif ( $try eq 'permute' ) { + $order = $action ? $PERMUTE : $REQUIRE_ORDER; + } + elsif ( $try eq 'pass_through' or $try eq 'passthrough' ) { + $passthrough = $action; + } + elsif ( $try =~ /^prefix=(.+)$/ && $action ) { + $genprefix = $1; + # Turn into regexp. Needs to be parenthesized! + $genprefix = "(" . quotemeta($genprefix) . ")"; + eval { '' =~ /$genprefix/; }; + die("Getopt::Long: invalid pattern \"$genprefix\"\n") if $@; + } + elsif ( $try =~ /^prefix_pattern=(.+)$/ && $action ) { + $genprefix = $1; + # Parenthesize if needed. + $genprefix = "(" . $genprefix . ")" + unless $genprefix =~ /^\(.*\)$/; + eval { '' =~ m"$genprefix"; }; + die("Getopt::Long: invalid pattern \"$genprefix\"\n") if $@; + } + elsif ( $try =~ /^long_prefix_pattern=(.+)$/ && $action ) { + $longprefix = $1; + # Parenthesize if needed. + $longprefix = "(" . $longprefix . ")" + unless $longprefix =~ /^\(.*\)$/; + eval { '' =~ m"$longprefix"; }; + die("Getopt::Long: invalid long prefix pattern \"$longprefix\"\n") if $@; + } + elsif ( $try eq 'debug' ) { + $debug = $action; + } + else { + die("Getopt::Long: unknown or erroneous config parameter \"$opt\"\n") + } + } + $prevconfig; +} + +# Deprecated name. +sub config (@) { + Configure (@_); +} + +# Issue a standard message for --version. +# +# The arguments are mostly the same as for Pod::Usage::pod2usage: +# +# - a number (exit value) +# - a string (lead in message) +# - a hash with options. See Pod::Usage for details. +# +sub VersionMessage(@) { + # Massage args. + my $pa = setup_pa_args("version", @_); + + my $v = $main::VERSION; + my $fh = $pa->{-output} || + ( ($pa->{-exitval} eq "NOEXIT" || $pa->{-exitval} < 2) ? \*STDOUT : \*STDERR ); + + print $fh (defined($pa->{-message}) ? $pa->{-message} : (), + $0, defined $v ? " version $v" : (), + "\n", + "(", __PACKAGE__, "::", "GetOptions", + " version ", + defined($Getopt::Long::VERSION_STRING) + ? $Getopt::Long::VERSION_STRING : $VERSION, ";", + " Perl version ", + $] >= 5.006 ? sprintf("%vd", $^V) : $], + ")\n"); + exit($pa->{-exitval}) unless $pa->{-exitval} eq "NOEXIT"; +} + +# Issue a standard message for --help. +# +# The arguments are the same as for Pod::Usage::pod2usage: +# +# - a number (exit value) +# - a string (lead in message) +# - a hash with options. See Pod::Usage for details. +# +sub HelpMessage(@) { + eval { + require Pod::Usage; + import Pod::Usage; + 1; + } || die("Cannot provide help: cannot load Pod::Usage\n"); + + # Note that pod2usage will issue a warning if -exitval => NOEXIT. + pod2usage(setup_pa_args("help", @_)); + +} + +# Helper routine to set up a normalized hash ref to be used as +# argument to pod2usage. +sub setup_pa_args($@) { + my $tag = shift; # who's calling + + # If called by direct binding to an option, it will get the option + # name and value as arguments. Remove these, if so. + @_ = () if @_ == 2 && $_[0] eq $tag; + + my $pa; + if ( @_ > 1 ) { + $pa = { @_ }; + } + else { + $pa = shift || {}; + } + + # At this point, $pa can be a number (exit value), string + # (message) or hash with options. + + if ( UNIVERSAL::isa($pa, 'HASH') ) { + # Get rid of -msg vs. -message ambiguity. + $pa->{-message} = $pa->{-msg}; + delete($pa->{-msg}); + } + elsif ( $pa =~ /^-?\d+$/ ) { + $pa = { -exitval => $pa }; + } + else { + $pa = { -message => $pa }; + } + + # These are _our_ defaults. + $pa->{-verbose} = 0 unless exists($pa->{-verbose}); + $pa->{-exitval} = 0 unless exists($pa->{-exitval}); + $pa; +} + +# Sneak way to know what version the user requested. +sub VERSION { + $requested_version = $_[1] if @_ > 1; + shift->SUPER::VERSION(@_); +} + +package Getopt::Long::CallBack; + +sub new { + my ($pkg, %atts) = @_; + bless { %atts }, $pkg; +} + +sub name { + my $self = shift; + ''.$self->{name}; +} + +use overload + # Treat this object as an ordinary string for legacy API. + '""' => \&name, + fallback => 1; + +1; + +################ Documentation ################ + +=head1 NAME + +Getopt::Long - Extended processing of command line options + +=head1 SYNOPSIS + + use Getopt::Long; + my $data = "file.dat"; + my $length = 24; + my $verbose; + GetOptions ("length=i" => \$length, # numeric + "file=s" => \$data, # string + "verbose" => \$verbose) # flag + or die("Error in command line arguments\n"); + +=head1 DESCRIPTION + +The Getopt::Long module implements an extended getopt function called +GetOptions(). It parses the command line from C<@ARGV>, recognizing +and removing specified options and their possible values. + +This function adheres to the POSIX syntax for command +line options, with GNU extensions. In general, this means that options +have long names instead of single letters, and are introduced with a +double dash "--". Support for bundling of command line options, as was +the case with the more traditional single-letter approach, is provided +but not enabled by default. + +=head1 Command Line Options, an Introduction + +Command line operated programs traditionally take their arguments from +the command line, for example filenames or other information that the +program needs to know. Besides arguments, these programs often take +command line I<options> as well. Options are not necessary for the +program to work, hence the name 'option', but are used to modify its +default behaviour. For example, a program could do its job quietly, +but with a suitable option it could provide verbose information about +what it did. + +Command line options come in several flavours. Historically, they are +preceded by a single dash C<->, and consist of a single letter. + + -l -a -c + +Usually, these single-character options can be bundled: + + -lac + +Options can have values, the value is placed after the option +character. Sometimes with whitespace in between, sometimes not: + + -s 24 -s24 + +Due to the very cryptic nature of these options, another style was +developed that used long names. So instead of a cryptic C<-l> one +could use the more descriptive C<--long>. To distinguish between a +bundle of single-character options and a long one, two dashes are used +to precede the option name. Early implementations of long options used +a plus C<+> instead. Also, option values could be specified either +like + + --size=24 + +or + + --size 24 + +The C<+> form is now obsolete and strongly deprecated. + +=head1 Getting Started with Getopt::Long + +Getopt::Long is the Perl5 successor of C<newgetopt.pl>. This was the +first Perl module that provided support for handling the new style of +command line options, in particular long option names, hence the Perl5 +name Getopt::Long. This module also supports single-character options +and bundling. + +To use Getopt::Long from a Perl program, you must include the +following line in your Perl program: + + use Getopt::Long; + +This will load the core of the Getopt::Long module and prepare your +program for using it. Most of the actual Getopt::Long code is not +loaded until you really call one of its functions. + +In the default configuration, options names may be abbreviated to +uniqueness, case does not matter, and a single dash is sufficient, +even for long option names. Also, options may be placed between +non-option arguments. See L<Configuring Getopt::Long> for more +details on how to configure Getopt::Long. + +=head2 Simple options + +The most simple options are the ones that take no values. Their mere +presence on the command line enables the option. Popular examples are: + + --all --verbose --quiet --debug + +Handling simple options is straightforward: + + my $verbose = ''; # option variable with default value (false) + my $all = ''; # option variable with default value (false) + GetOptions ('verbose' => \$verbose, 'all' => \$all); + +The call to GetOptions() parses the command line arguments that are +present in C<@ARGV> and sets the option variable to the value C<1> if +the option did occur on the command line. Otherwise, the option +variable is not touched. Setting the option value to true is often +called I<enabling> the option. + +The option name as specified to the GetOptions() function is called +the option I<specification>. Later we'll see that this specification +can contain more than just the option name. The reference to the +variable is called the option I<destination>. + +GetOptions() will return a true value if the command line could be +processed successfully. Otherwise, it will write error messages using +die() and warn(), and return a false result. + +=head2 A little bit less simple options + +Getopt::Long supports two useful variants of simple options: +I<negatable> options and I<incremental> options. + +A negatable option is specified with an exclamation mark C<!> after the +option name: + + my $verbose = ''; # option variable with default value (false) + GetOptions ('verbose!' => \$verbose); + +Now, using C<--verbose> on the command line will enable C<$verbose>, +as expected. But it is also allowed to use C<--noverbose>, which will +disable C<$verbose> by setting its value to C<0>. Using a suitable +default value, the program can find out whether C<$verbose> is false +by default, or disabled by using C<--noverbose>. + +An incremental option is specified with a plus C<+> after the +option name: + + my $verbose = ''; # option variable with default value (false) + GetOptions ('verbose+' => \$verbose); + +Using C<--verbose> on the command line will increment the value of +C<$verbose>. This way the program can keep track of how many times the +option occurred on the command line. For example, each occurrence of +C<--verbose> could increase the verbosity level of the program. + +=head2 Mixing command line option with other arguments + +Usually programs take command line options as well as other arguments, +for example, file names. It is good practice to always specify the +options first, and the other arguments last. Getopt::Long will, +however, allow the options and arguments to be mixed and 'filter out' +all the options before passing the rest of the arguments to the +program. To stop Getopt::Long from processing further arguments, +insert a double dash C<--> on the command line: + + --size 24 -- --all + +In this example, C<--all> will I<not> be treated as an option, but +passed to the program unharmed, in C<@ARGV>. + +=head2 Options with values + +For options that take values it must be specified whether the option +value is required or not, and what kind of value the option expects. + +Three kinds of values are supported: integer numbers, floating point +numbers, and strings. + +If the option value is required, Getopt::Long will take the +command line argument that follows the option and assign this to the +option variable. If, however, the option value is specified as +optional, this will only be done if that value does not look like a +valid command line option itself. + + my $tag = ''; # option variable with default value + GetOptions ('tag=s' => \$tag); + +In the option specification, the option name is followed by an equals +sign C<=> and the letter C<s>. The equals sign indicates that this +option requires a value. The letter C<s> indicates that this value is +an arbitrary string. Other possible value types are C<i> for integer +values, and C<f> for floating point values. Using a colon C<:> instead +of the equals sign indicates that the option value is optional. In +this case, if no suitable value is supplied, string valued options get +an empty string C<''> assigned, while numeric options are set to C<0>. + +=head2 Options with multiple values + +Options sometimes take several values. For example, a program could +use multiple directories to search for library files: + + --library lib/stdlib --library lib/extlib + +To accomplish this behaviour, simply specify an array reference as the +destination for the option: + + GetOptions ("library=s" => \@libfiles); + +Alternatively, you can specify that the option can have multiple +values by adding a "@", and pass a reference to a scalar as the +destination: + + GetOptions ("library=s@" => \$libfiles); + +Used with the example above, C<@libfiles> c.q. C<@$libfiles> would +contain two strings upon completion: C<"lib/stdlib"> and +C<"lib/extlib">, in that order. It is also possible to specify that +only integer or floating point numbers are acceptable values. + +Often it is useful to allow comma-separated lists of values as well as +multiple occurrences of the options. This is easy using Perl's split() +and join() operators: + + GetOptions ("library=s" => \@libfiles); + @libfiles = split(/,/,join(',',@libfiles)); + +Of course, it is important to choose the right separator string for +each purpose. + +Warning: What follows is an experimental feature. + +Options can take multiple values at once, for example + + --coordinates 52.2 16.4 --rgbcolor 255 255 149 + +This can be accomplished by adding a repeat specifier to the option +specification. Repeat specifiers are very similar to the C<{...}> +repeat specifiers that can be used with regular expression patterns. +For example, the above command line would be handled as follows: + + GetOptions('coordinates=f{2}' => \@coor, 'rgbcolor=i{3}' => \@color); + +The destination for the option must be an array or array reference. + +It is also possible to specify the minimal and maximal number of +arguments an option takes. C<foo=s{2,4}> indicates an option that +takes at least two and at most 4 arguments. C<foo=s{1,}> indicates one +or more values; C<foo:s{,}> indicates zero or more option values. + +=head2 Options with hash values + +If the option destination is a reference to a hash, the option will +take, as value, strings of the form I<key>C<=>I<value>. The value will +be stored with the specified key in the hash. + + GetOptions ("define=s" => \%defines); + +Alternatively you can use: + + GetOptions ("define=s%" => \$defines); + +When used with command line options: + + --define os=linux --define vendor=redhat + +the hash C<%defines> (or C<%$defines>) will contain two keys, C<"os"> +with value C<"linux"> and C<"vendor"> with value C<"redhat">. It is +also possible to specify that only integer or floating point numbers +are acceptable values. The keys are always taken to be strings. + +=head2 User-defined subroutines to handle options + +Ultimate control over what should be done when (actually: each time) +an option is encountered on the command line can be achieved by +designating a reference to a subroutine (or an anonymous subroutine) +as the option destination. When GetOptions() encounters the option, it +will call the subroutine with two or three arguments. The first +argument is the name of the option. (Actually, it is an object that +stringifies to the name of the option.) For a scalar or array destination, +the second argument is the value to be stored. For a hash destination, +the second argument is the key to the hash, and the third argument +the value to be stored. It is up to the subroutine to store the value, +or do whatever it thinks is appropriate. + +A trivial application of this mechanism is to implement options that +are related to each other. For example: + + my $verbose = ''; # option variable with default value (false) + GetOptions ('verbose' => \$verbose, + 'quiet' => sub { $verbose = 0 }); + +Here C<--verbose> and C<--quiet> control the same variable +C<$verbose>, but with opposite values. + +If the subroutine needs to signal an error, it should call die() with +the desired error message as its argument. GetOptions() will catch the +die(), issue the error message, and record that an error result must +be returned upon completion. + +If the text of the error message starts with an exclamation mark C<!> +it is interpreted specially by GetOptions(). There is currently one +special command implemented: C<die("!FINISH")> will cause GetOptions() +to stop processing options, as if it encountered a double dash C<-->. + +In version 2.37 the first argument to the callback function was +changed from string to object. This was done to make room for +extensions and more detailed control. The object stringifies to the +option name so this change should not introduce compatibility +problems. + +Here is an example of how to access the option name and value from within +a subroutine: + + GetOptions ('opt=i' => \&handler); + sub handler { + my ($opt_name, $opt_value) = @_; + print("Option name is $opt_name and value is $opt_value\n"); + } + +=head2 Options with multiple names + +Often it is user friendly to supply alternate mnemonic names for +options. For example C<--height> could be an alternate name for +C<--length>. Alternate names can be included in the option +specification, separated by vertical bar C<|> characters. To implement +the above example: + + GetOptions ('length|height=f' => \$length); + +The first name is called the I<primary> name, the other names are +called I<aliases>. When using a hash to store options, the key will +always be the primary name. + +Multiple alternate names are possible. + +=head2 Case and abbreviations + +Without additional configuration, GetOptions() will ignore the case of +option names, and allow the options to be abbreviated to uniqueness. + + GetOptions ('length|height=f' => \$length, "head" => \$head); + +This call will allow C<--l> and C<--L> for the length option, but +requires a least C<--hea> and C<--hei> for the head and height options. + +=head2 Summary of Option Specifications + +Each option specifier consists of two parts: the name specification +and the argument specification. + +The name specification contains the name of the option, optionally +followed by a list of alternative names separated by vertical bar +characters. + + length option name is "length" + length|size|l name is "length", aliases are "size" and "l" + +The argument specification is optional. If omitted, the option is +considered boolean, a value of 1 will be assigned when the option is +used on the command line. + +The argument specification can be + +=over 4 + +=item ! + +The option does not take an argument and may be negated by prefixing +it with "no" or "no-". E.g. C<"foo!"> will allow C<--foo> (a value of +1 will be assigned) as well as C<--nofoo> and C<--no-foo> (a value of +0 will be assigned). If the option has aliases, this applies to the +aliases as well. + +Using negation on a single letter option when bundling is in effect is +pointless and will result in a warning. + +=item + + +The option does not take an argument and will be incremented by 1 +every time it appears on the command line. E.g. C<"more+">, when used +with C<--more --more --more>, will increment the value three times, +resulting in a value of 3 (provided it was 0 or undefined at first). + +The C<+> specifier is ignored if the option destination is not a scalar. + +=item = I<type> [ I<desttype> ] [ I<repeat> ] + +The option requires an argument of the given type. Supported types +are: + +=over 4 + +=item s + +String. An arbitrary sequence of characters. It is valid for the +argument to start with C<-> or C<-->. + +=item i + +Integer. An optional leading plus or minus sign, followed by a +sequence of digits. + +=item o + +Extended integer, Perl style. This can be either an optional leading +plus or minus sign, followed by a sequence of digits, or an octal +string (a zero, optionally followed by '0', '1', .. '7'), or a +hexadecimal string (C<0x> followed by '0' .. '9', 'a' .. 'f', case +insensitive), or a binary string (C<0b> followed by a series of '0' +and '1'). + +=item f + +Real number. For example C<3.14>, C<-6.23E24> and so on. + +=back + +The I<desttype> can be C<@> or C<%> to specify that the option is +list or a hash valued. This is only needed when the destination for +the option value is not otherwise specified. It should be omitted when +not needed. + +The I<repeat> specifies the number of values this option takes per +occurrence on the command line. It has the format C<{> [ I<min> ] [ C<,> [ I<max> ] ] C<}>. + +I<min> denotes the minimal number of arguments. It defaults to 1 for +options with C<=> and to 0 for options with C<:>, see below. Note that +I<min> overrules the C<=> / C<:> semantics. + +I<max> denotes the maximum number of arguments. It must be at least +I<min>. If I<max> is omitted, I<but the comma is not>, there is no +upper bound to the number of argument values taken. + +=item : I<type> [ I<desttype> ] + +Like C<=>, but designates the argument as optional. +If omitted, an empty string will be assigned to string values options, +and the value zero to numeric options. + +Note that if a string argument starts with C<-> or C<-->, it will be +considered an option on itself. + +=item : I<number> [ I<desttype> ] + +Like C<:i>, but if the value is omitted, the I<number> will be assigned. + +=item : + [ I<desttype> ] + +Like C<:i>, but if the value is omitted, the current value for the +option will be incremented. + +=back + +=head1 Advanced Possibilities + +=head2 Object oriented interface + +Getopt::Long can be used in an object oriented way as well: + + use Getopt::Long; + $p = Getopt::Long::Parser->new; + $p->configure(...configuration options...); + if ($p->getoptions(...options descriptions...)) ... + if ($p->getoptionsfromarray( \@array, ...options descriptions...)) ... + +Configuration options can be passed to the constructor: + + $p = new Getopt::Long::Parser + config => [...configuration options...]; + +=head2 Thread Safety + +Getopt::Long is thread safe when using ithreads as of Perl 5.8. It is +I<not> thread safe when using the older (experimental and now +obsolete) threads implementation that was added to Perl 5.005. + +=head2 Documentation and help texts + +Getopt::Long encourages the use of Pod::Usage to produce help +messages. For example: + + use Getopt::Long; + use Pod::Usage; + + my $man = 0; + my $help = 0; + + GetOptions('help|?' => \$help, man => \$man) or pod2usage(2); + pod2usage(1) if $help; + pod2usage(-exitval => 0, -verbose => 2) if $man; + + __END__ + + =head1 NAME + + sample - Using Getopt::Long and Pod::Usage + + =head1 SYNOPSIS + + sample [options] [file ...] + + Options: + -help brief help message + -man full documentation + + =head1 OPTIONS + + =over 8 + + =item B<-help> + + Print a brief help message and exits. + + =item B<-man> + + Prints the manual page and exits. + + =back + + =head1 DESCRIPTION + + B<This program> will read the given input file(s) and do something + useful with the contents thereof. + + =cut + +See L<Pod::Usage> for details. + +=head2 Parsing options from an arbitrary array + +By default, GetOptions parses the options that are present in the +global array C<@ARGV>. A special entry C<GetOptionsFromArray> can be +used to parse options from an arbitrary array. + + use Getopt::Long qw(GetOptionsFromArray); + $ret = GetOptionsFromArray(\@myopts, ...); + +When used like this, options and their possible values are removed +from C<@myopts>, the global C<@ARGV> is not touched at all. + +The following two calls behave identically: + + $ret = GetOptions( ... ); + $ret = GetOptionsFromArray(\@ARGV, ... ); + +This also means that a first argument hash reference now becomes the +second argument: + + $ret = GetOptions(\%opts, ... ); + $ret = GetOptionsFromArray(\@ARGV, \%opts, ... ); + +=head2 Parsing options from an arbitrary string + +A special entry C<GetOptionsFromString> can be used to parse options +from an arbitrary string. + + use Getopt::Long qw(GetOptionsFromString); + $ret = GetOptionsFromString($string, ...); + +The contents of the string are split into arguments using a call to +C<Text::ParseWords::shellwords>. As with C<GetOptionsFromArray>, the +global C<@ARGV> is not touched. + +It is possible that, upon completion, not all arguments in the string +have been processed. C<GetOptionsFromString> will, when called in list +context, return both the return status and an array reference to any +remaining arguments: + + ($ret, $args) = GetOptionsFromString($string, ... ); + +If any arguments remain, and C<GetOptionsFromString> was not called in +list context, a message will be given and C<GetOptionsFromString> will +return failure. + +As with GetOptionsFromArray, a first argument hash reference now +becomes the second argument. + +=head2 Storing options values in a hash + +Sometimes, for example when there are a lot of options, having a +separate variable for each of them can be cumbersome. GetOptions() +supports, as an alternative mechanism, storing options values in a +hash. + +To obtain this, a reference to a hash must be passed I<as the first +argument> to GetOptions(). For each option that is specified on the +command line, the option value will be stored in the hash with the +option name as key. Options that are not actually used on the command +line will not be put in the hash, on other words, +C<exists($h{option})> (or defined()) can be used to test if an option +was used. The drawback is that warnings will be issued if the program +runs under C<use strict> and uses C<$h{option}> without testing with +exists() or defined() first. + + my %h = (); + GetOptions (\%h, 'length=i'); # will store in $h{length} + +For options that take list or hash values, it is necessary to indicate +this by appending an C<@> or C<%> sign after the type: + + GetOptions (\%h, 'colours=s@'); # will push to @{$h{colours}} + +To make things more complicated, the hash may contain references to +the actual destinations, for example: + + my $len = 0; + my %h = ('length' => \$len); + GetOptions (\%h, 'length=i'); # will store in $len + +This example is fully equivalent with: + + my $len = 0; + GetOptions ('length=i' => \$len); # will store in $len + +Any mixture is possible. For example, the most frequently used options +could be stored in variables while all other options get stored in the +hash: + + my $verbose = 0; # frequently referred + my $debug = 0; # frequently referred + my %h = ('verbose' => \$verbose, 'debug' => \$debug); + GetOptions (\%h, 'verbose', 'debug', 'filter', 'size=i'); + if ( $verbose ) { ... } + if ( exists $h{filter} ) { ... option 'filter' was specified ... } + +=head2 Bundling + +With bundling it is possible to set several single-character options +at once. For example if C<a>, C<v> and C<x> are all valid options, + + -vax + +will set all three. + +Getopt::Long supports three styles of bundling. To enable bundling, a +call to Getopt::Long::Configure is required. + +The simplest style of bundling can be enabled with: + + Getopt::Long::Configure ("bundling"); + +Configured this way, single-character options can be bundled but long +options B<must> always start with a double dash C<--> to avoid +ambiguity. For example, when C<vax>, C<a>, C<v> and C<x> are all valid +options, + + -vax + +will set C<a>, C<v> and C<x>, but + + --vax + +will set C<vax>. + +The second style of bundling lifts this restriction. It can be enabled +with: + + Getopt::Long::Configure ("bundling_override"); + +Now, C<-vax> will set the option C<vax>. + +In all of the above cases, option values may be inserted in the +bundle. For example: + + -h24w80 + +is equivalent to + + -h 24 -w 80 + +A third style of bundling allows only values to be bundled with +options. It can be enabled with: + + Getopt::Long::Configure ("bundling_values"); + +Now, C<-h24> will set the option C<h> to C<24>, but option bundles +like C<-vxa> and C<-h24w80> are flagged as errors. + +Enabling C<bundling_values> will disable the other two styles of +bundling. + +When configured for bundling, single-character options are matched +case sensitive while long options are matched case insensitive. To +have the single-character options matched case insensitive as well, +use: + + Getopt::Long::Configure ("bundling", "ignorecase_always"); + +It goes without saying that bundling can be quite confusing. + +=head2 The lonesome dash + +Normally, a lone dash C<-> on the command line will not be considered +an option. Option processing will terminate (unless "permute" is +configured) and the dash will be left in C<@ARGV>. + +It is possible to get special treatment for a lone dash. This can be +achieved by adding an option specification with an empty name, for +example: + + GetOptions ('' => \$stdio); + +A lone dash on the command line will now be a legal option, and using +it will set variable C<$stdio>. + +=head2 Argument callback + +A special option 'name' C<< <> >> can be used to designate a subroutine +to handle non-option arguments. When GetOptions() encounters an +argument that does not look like an option, it will immediately call this +subroutine and passes it one parameter: the argument name. + +For example: + + my $width = 80; + sub process { ... } + GetOptions ('width=i' => \$width, '<>' => \&process); + +When applied to the following command line: + + arg1 --width=72 arg2 --width=60 arg3 + +This will call +C<process("arg1")> while C<$width> is C<80>, +C<process("arg2")> while C<$width> is C<72>, and +C<process("arg3")> while C<$width> is C<60>. + +This feature requires configuration option B<permute>, see section +L<Configuring Getopt::Long>. + +=head1 Configuring Getopt::Long + +Getopt::Long can be configured by calling subroutine +Getopt::Long::Configure(). This subroutine takes a list of quoted +strings, each specifying a configuration option to be enabled, e.g. +C<ignore_case>, or disabled, e.g. C<no_ignore_case>. Case does not +matter. Multiple calls to Configure() are possible. + +Alternatively, as of version 2.24, the configuration options may be +passed together with the C<use> statement: + + use Getopt::Long qw(:config no_ignore_case bundling); + +The following options are available: + +=over 12 + +=item default + +This option causes all configuration options to be reset to their +default values. + +=item posix_default + +This option causes all configuration options to be reset to their +default values as if the environment variable POSIXLY_CORRECT had +been set. + +=item auto_abbrev + +Allow option names to be abbreviated to uniqueness. +Default is enabled unless environment variable +POSIXLY_CORRECT has been set, in which case C<auto_abbrev> is disabled. + +=item getopt_compat + +Allow C<+> to start options. +Default is enabled unless environment variable +POSIXLY_CORRECT has been set, in which case C<getopt_compat> is disabled. + +=item gnu_compat + +C<gnu_compat> controls whether C<--opt=> is allowed, and what it should +do. Without C<gnu_compat>, C<--opt=> gives an error. With C<gnu_compat>, +C<--opt=> will give option C<opt> and empty value. +This is the way GNU getopt_long() does it. + +Note that C<--opt value> is still accepted, even though GNU +getopt_long() doesn't. + +=item gnu_getopt + +This is a short way of setting C<gnu_compat> C<bundling> C<permute> +C<no_getopt_compat>. With C<gnu_getopt>, command line handling should be +reasonably compatible with GNU getopt_long(). + +=item require_order + +Whether command line arguments are allowed to be mixed with options. +Default is disabled unless environment variable +POSIXLY_CORRECT has been set, in which case C<require_order> is enabled. + +See also C<permute>, which is the opposite of C<require_order>. + +=item permute + +Whether command line arguments are allowed to be mixed with options. +Default is enabled unless environment variable +POSIXLY_CORRECT has been set, in which case C<permute> is disabled. +Note that C<permute> is the opposite of C<require_order>. + +If C<permute> is enabled, this means that + + --foo arg1 --bar arg2 arg3 + +is equivalent to + + --foo --bar arg1 arg2 arg3 + +If an argument callback routine is specified, C<@ARGV> will always be +empty upon successful return of GetOptions() since all options have been +processed. The only exception is when C<--> is used: + + --foo arg1 --bar arg2 -- arg3 + +This will call the callback routine for arg1 and arg2, and then +terminate GetOptions() leaving C<"arg3"> in C<@ARGV>. + +If C<require_order> is enabled, options processing +terminates when the first non-option is encountered. + + --foo arg1 --bar arg2 arg3 + +is equivalent to + + --foo -- arg1 --bar arg2 arg3 + +If C<pass_through> is also enabled, options processing will terminate +at the first unrecognized option, or non-option, whichever comes +first. + +=item bundling (default: disabled) + +Enabling this option will allow single-character options to be +bundled. To distinguish bundles from long option names, long options +I<must> be introduced with C<--> and bundles with C<->. + +Note that, if you have options C<a>, C<l> and C<all>, and +auto_abbrev enabled, possible arguments and option settings are: + + using argument sets option(s) + ------------------------------------------ + -a, --a a + -l, --l l + -al, -la, -ala, -all,... a, l + --al, --all all + +The surprising part is that C<--a> sets option C<a> (due to auto +completion), not C<all>. + +Note: disabling C<bundling> also disables C<bundling_override>. + +=item bundling_override (default: disabled) + +If C<bundling_override> is enabled, bundling is enabled as with +C<bundling> but now long option names override option bundles. + +Note: disabling C<bundling_override> also disables C<bundling>. + +B<Note:> Using option bundling can easily lead to unexpected results, +especially when mixing long options and bundles. Caveat emptor. + +=item ignore_case (default: enabled) + +If enabled, case is ignored when matching option names. If, however, +bundling is enabled as well, single character options will be treated +case-sensitive. + +With C<ignore_case>, option specifications for options that only +differ in case, e.g., C<"foo"> and C<"Foo">, will be flagged as +duplicates. + +Note: disabling C<ignore_case> also disables C<ignore_case_always>. + +=item ignore_case_always (default: disabled) + +When bundling is in effect, case is ignored on single-character +options also. + +Note: disabling C<ignore_case_always> also disables C<ignore_case>. + +=item auto_version (default:disabled) + +Automatically provide support for the B<--version> option if +the application did not specify a handler for this option itself. + +Getopt::Long will provide a standard version message that includes the +program name, its version (if $main::VERSION is defined), and the +versions of Getopt::Long and Perl. The message will be written to +standard output and processing will terminate. + +C<auto_version> will be enabled if the calling program explicitly +specified a version number higher than 2.32 in the C<use> or +C<require> statement. + +=item auto_help (default:disabled) + +Automatically provide support for the B<--help> and B<-?> options if +the application did not specify a handler for this option itself. + +Getopt::Long will provide a help message using module L<Pod::Usage>. The +message, derived from the SYNOPSIS POD section, will be written to +standard output and processing will terminate. + +C<auto_help> will be enabled if the calling program explicitly +specified a version number higher than 2.32 in the C<use> or +C<require> statement. + +=item pass_through (default: disabled) + +With C<pass_through> anything that is unknown, ambiguous or supplied with +an invalid option will not be flagged as an error. Instead the unknown +option(s) will be passed to the catchall C<< <> >> if present, otherwise +through to C<@ARGV>. This makes it possible to write wrapper scripts that +process only part of the user supplied command line arguments, and pass the +remaining options to some other program. + +If C<require_order> is enabled, options processing will terminate at the +first unrecognized option, or non-option, whichever comes first and all +remaining arguments are passed to C<@ARGV> instead of the catchall +C<< <> >> if present. However, if C<permute> is enabled instead, results +can become confusing. + +Note that the options terminator (default C<-->), if present, will +also be passed through in C<@ARGV>. + +=item prefix + +The string that starts options. If a constant string is not +sufficient, see C<prefix_pattern>. + +=item prefix_pattern + +A Perl pattern that identifies the strings that introduce options. +Default is C<--|-|\+> unless environment variable +POSIXLY_CORRECT has been set, in which case it is C<--|->. + +=item long_prefix_pattern + +A Perl pattern that allows the disambiguation of long and short +prefixes. Default is C<-->. + +Typically you only need to set this if you are using nonstandard +prefixes and want some or all of them to have the same semantics as +'--' does under normal circumstances. + +For example, setting prefix_pattern to C<--|-|\+|\/> and +long_prefix_pattern to C<--|\/> would add Win32 style argument +handling. + +=item debug (default: disabled) + +Enable debugging output. + +=back + +=head1 Exportable Methods + +=over + +=item VersionMessage + +This subroutine provides a standard version message. Its argument can be: + +=over 4 + +=item * + +A string containing the text of a message to print I<before> printing +the standard message. + +=item * + +A numeric value corresponding to the desired exit status. + +=item * + +A reference to a hash. + +=back + +If more than one argument is given then the entire argument list is +assumed to be a hash. If a hash is supplied (either as a reference or +as a list) it should contain one or more elements with the following +keys: + +=over 4 + +=item C<-message> + +=item C<-msg> + +The text of a message to print immediately prior to printing the +program's usage message. + +=item C<-exitval> + +The desired exit status to pass to the B<exit()> function. +This should be an integer, or else the string "NOEXIT" to +indicate that control should simply be returned without +terminating the invoking process. + +=item C<-output> + +A reference to a filehandle, or the pathname of a file to which the +usage message should be written. The default is C<\*STDERR> unless the +exit value is less than 2 (in which case the default is C<\*STDOUT>). + +=back + +You cannot tie this routine directly to an option, e.g.: + + GetOptions("version" => \&VersionMessage); + +Use this instead: + + GetOptions("version" => sub { VersionMessage() }); + +=item HelpMessage + +This subroutine produces a standard help message, derived from the +program's POD section SYNOPSIS using L<Pod::Usage>. It takes the same +arguments as VersionMessage(). In particular, you cannot tie it +directly to an option, e.g.: + + GetOptions("help" => \&HelpMessage); + +Use this instead: + + GetOptions("help" => sub { HelpMessage() }); + +=back + +=head1 Return values and Errors + +Configuration errors and errors in the option definitions are +signalled using die() and will terminate the calling program unless +the call to Getopt::Long::GetOptions() was embedded in C<eval { ... +}>, or die() was trapped using C<$SIG{__DIE__}>. + +GetOptions returns true to indicate success. +It returns false when the function detected one or more errors during +option parsing. These errors are signalled using warn() and can be +trapped with C<$SIG{__WARN__}>. + +=head1 Legacy + +The earliest development of C<newgetopt.pl> started in 1990, with Perl +version 4. As a result, its development, and the development of +Getopt::Long, has gone through several stages. Since backward +compatibility has always been extremely important, the current version +of Getopt::Long still supports a lot of constructs that nowadays are +no longer necessary or otherwise unwanted. This section describes +briefly some of these 'features'. + +=head2 Default destinations + +When no destination is specified for an option, GetOptions will store +the resultant value in a global variable named C<opt_>I<XXX>, where +I<XXX> is the primary name of this option. When a program executes +under C<use strict> (recommended), these variables must be +pre-declared with our() or C<use vars>. + + our $opt_length = 0; + GetOptions ('length=i'); # will store in $opt_length + +To yield a usable Perl variable, characters that are not part of the +syntax for variables are translated to underscores. For example, +C<--fpp-struct-return> will set the variable +C<$opt_fpp_struct_return>. Note that this variable resides in the +namespace of the calling program, not necessarily C<main>. For +example: + + GetOptions ("size=i", "sizes=i@"); + +with command line "-size 10 -sizes 24 -sizes 48" will perform the +equivalent of the assignments + + $opt_size = 10; + @opt_sizes = (24, 48); + +=head2 Alternative option starters + +A string of alternative option starter characters may be passed as the +first argument (or the first argument after a leading hash reference +argument). + + my $len = 0; + GetOptions ('/', 'length=i' => $len); + +Now the command line may look like: + + /length 24 -- arg + +Note that to terminate options processing still requires a double dash +C<-->. + +GetOptions() will not interpret a leading C<< "<>" >> as option starters +if the next argument is a reference. To force C<< "<" >> and C<< ">" >> as +option starters, use C<< "><" >>. Confusing? Well, B<using a starter +argument is strongly deprecated> anyway. + +=head2 Configuration variables + +Previous versions of Getopt::Long used variables for the purpose of +configuring. Although manipulating these variables still work, it is +strongly encouraged to use the C<Configure> routine that was introduced +in version 2.17. Besides, it is much easier. + +=head1 Tips and Techniques + +=head2 Pushing multiple values in a hash option + +Sometimes you want to combine the best of hashes and arrays. For +example, the command line: + + --list add=first --list add=second --list add=third + +where each successive 'list add' option will push the value of add +into array ref $list->{'add'}. The result would be like + + $list->{add} = [qw(first second third)]; + +This can be accomplished with a destination routine: + + GetOptions('list=s%' => + sub { push(@{$list{$_[1]}}, $_[2]) }); + +=head1 Troubleshooting + +=head2 GetOptions does not return a false result when an option is not supplied + +That's why they're called 'options'. + +=head2 GetOptions does not split the command line correctly + +The command line is not split by GetOptions, but by the command line +interpreter (CLI). On Unix, this is the shell. On Windows, it is +COMMAND.COM or CMD.EXE. Other operating systems have other CLIs. + +It is important to know that these CLIs may behave different when the +command line contains special characters, in particular quotes or +backslashes. For example, with Unix shells you can use single quotes +(C<'>) and double quotes (C<">) to group words together. The following +alternatives are equivalent on Unix: + + "two words" + 'two words' + two\ words + +In case of doubt, insert the following statement in front of your Perl +program: + + print STDERR (join("|",@ARGV),"\n"); + +to verify how your CLI passes the arguments to the program. + +=head2 Undefined subroutine &main::GetOptions called + +Are you running Windows, and did you write + + use GetOpt::Long; + +(note the capital 'O')? + +=head2 How do I put a "-?" option into a Getopt::Long? + +You can only obtain this using an alias, and Getopt::Long of at least +version 2.13. + + use Getopt::Long; + GetOptions ("help|?"); # -help and -? will both set $opt_help + +Other characters that can't appear in Perl identifiers are also +supported in aliases with Getopt::Long of at version 2.39. Note that +the characters C<!>, C<|>, C<+>, C<=>, and C<:> can only appear as the +first (or only) character of an alias. + +As of version 2.32 Getopt::Long provides auto-help, a quick and easy way +to add the options --help and -? to your program, and handle them. + +See C<auto_help> in section L<Configuring Getopt::Long>. + +=head1 AUTHOR + +Johan Vromans <jvromans@squirrel.nl> + +=head1 COPYRIGHT AND DISCLAIMER + +This program is Copyright 1990,2015 by Johan Vromans. +This program is free software; you can redistribute it and/or +modify it under the terms of the Perl Artistic License or 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. + +If you do not have a copy of the GNU General Public License write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +MA 02139, USA. + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Getopt/Std.pm b/data/miniconda3/lib/perl5/core_perl/Getopt/Std.pm new file mode 100644 index 0000000000000000000000000000000000000000..5b8878dbb860fe5b325a65dc3fe07b9592f0b6e0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Getopt/Std.pm @@ -0,0 +1,304 @@ +package Getopt::Std; +require 5.000; +require Exporter; + +=head1 NAME + +Getopt::Std - Process single-character switches with switch clustering + +=head1 SYNOPSIS + + use Getopt::Std; + + getopts('oif:'); # -o & -i are boolean flags, -f takes an argument + # Sets $opt_* as a side effect. + getopts('oif:', \%opts); # options as above. Values in %opts + getopt('oDI'); # -o, -D & -I take arg. + # Sets $opt_* as a side effect. + getopt('oDI', \%opts); # -o, -D & -I take arg. Values in %opts + +=head1 DESCRIPTION + +The C<getopts()> function processes single-character switches with switch +clustering. Pass one argument which is a string containing all switches to be +recognized. For each switch found, if an argument is expected and provided, +C<getopts()> sets C<$opt_x> (where C<x> is the switch name) to the value of +the argument. If an argument is expected but none is provided, C<$opt_x> is +set to an undefined value. If a switch does not take an argument, C<$opt_x> +is set to C<1>. + +Switches which take an argument don't care whether there is a space between +the switch and the argument. If unspecified switches are found on the +command-line, the user will be warned that an unknown option was given. + +The C<getopts()> function returns true unless an invalid option was found. + +The C<getopt()> function is similar, but its argument is a string containing +all switches that take an argument. If no argument is provided for a switch, +say, C<y>, the corresponding C<$opt_y> will be set to an undefined value. +Unspecified switches are silently accepted. Use of C<getopt()> is not +recommended. + +Note that, if your code is running under the recommended C<use strict +vars> pragma, you will need to declare these package variables +with C<our>: + + our($opt_x, $opt_y); + +For those of you who don't like additional global variables being created, +C<getopt()> and C<getopts()> will also accept a hash reference as an optional +second argument. Hash keys will be C<x> (where C<x> is the switch name) with +key values the value of the argument or C<1> if no argument is specified. + +To allow programs to process arguments that look like switches, but aren't, +both functions will stop processing switches when they see the argument +C<-->. The C<--> will be removed from @ARGV. + +=head1 C<--help> and C<--version> + +If C<-> is not a recognized switch letter, getopts() supports arguments +C<--help> and C<--version>. If C<main::HELP_MESSAGE()> and/or +C<main::VERSION_MESSAGE()> are defined, they are called; the arguments are +the output file handle, the name of option-processing package, its version, +and the switches string. If the subroutines are not defined, an attempt is +made to generate intelligent messages; for best results, define $main::VERSION. + +If embedded documentation (in pod format, see L<perlpod>) is detected +in the script, C<--help> will also show how to access the documentation. + +Note that due to excessive paranoia, if $Getopt::Std::STANDARD_HELP_VERSION +isn't true (the default is false), then the messages are printed on STDERR, +and the processing continues after the messages are printed. This being +the opposite of the standard-conforming behaviour, it is strongly recommended +to set $Getopt::Std::STANDARD_HELP_VERSION to true. + +One can change the output file handle of the messages by setting +$Getopt::Std::OUTPUT_HELP_VERSION. One can print the messages of C<--help> +(without the C<Usage:> line) and C<--version> by calling functions help_mess() +and version_mess() with the switches string as an argument. + +=cut + +@ISA = qw(Exporter); +@EXPORT = qw(getopt getopts); +$VERSION = '1.12'; +# uncomment the next line to disable 1.03-backward compatibility paranoia +# $STANDARD_HELP_VERSION = 1; + +# Process single-character switches with switch clustering. Pass one argument +# which is a string containing all switches that take an argument. For each +# switch found, sets $opt_x (where x is the switch name) to the value of the +# argument, or 1 if no argument. Switches which take an argument don't care +# whether there is a space between the switch and the argument. + +# Usage: +# getopt('oDI'); # -o, -D & -I take arg. Sets opt_* as a side effect. + +sub getopt (;$$) { + my ($argumentative, $hash) = @_; + $argumentative = '' if !defined $argumentative; + my ($first,$rest); + local $_; + local @EXPORT; + + while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { + ($first,$rest) = ($1,$2); + if (/^--$/) { # early exit if -- + shift @ARGV; + last; + } + if (index($argumentative,$first) >= 0) { + if ($rest ne '') { + shift(@ARGV); + } + else { + shift(@ARGV); + $rest = shift(@ARGV); + } + if (ref $hash) { + $$hash{$first} = $rest; + } + else { + ${"opt_$first"} = $rest; + push( @EXPORT, "\$opt_$first" ); + } + } + else { + if (ref $hash) { + $$hash{$first} = 1; + } + else { + ${"opt_$first"} = 1; + push( @EXPORT, "\$opt_$first" ); + } + if ($rest ne '') { + $ARGV[0] = "-$rest"; + } + else { + shift(@ARGV); + } + } + } + unless (ref $hash) { + local $Exporter::ExportLevel = 1; + import Getopt::Std; + } +} + +sub output_h () { + return $OUTPUT_HELP_VERSION if defined $OUTPUT_HELP_VERSION; + return \*STDOUT if $STANDARD_HELP_VERSION; + return \*STDERR; +} + +sub try_exit () { + exit 0 if $STANDARD_HELP_VERSION; + my $p = __PACKAGE__; + print {output_h()} <<EOM; + [Now continuing due to backward compatibility and excessive paranoia. + See 'perldoc $p' about \$$p\::STANDARD_HELP_VERSION.] +EOM +} + +sub version_mess ($;$) { + my $args = shift; + my $h = output_h; + if (@_ and defined &main::VERSION_MESSAGE) { + main::VERSION_MESSAGE($h, __PACKAGE__, $VERSION, $args); + } else { + my $v = $main::VERSION; + $v = '[unknown]' unless defined $v; + my $myv = $VERSION; + $myv .= ' [paranoid]' unless $STANDARD_HELP_VERSION; + my $perlv = $]; + $perlv = sprintf "%vd", $^V if $] >= 5.006; + print $h <<EOH; +$0 version $v calling Getopt::Std::getopts (version $myv), +running under Perl version $perlv. +EOH + } +} + +sub help_mess ($;$) { + my $args = shift; + my $h = output_h; + if (@_ and defined &main::HELP_MESSAGE) { + main::HELP_MESSAGE($h, __PACKAGE__, $VERSION, $args); + } else { + my (@witharg) = ($args =~ /(\S)\s*:/g); + my (@rest) = ($args =~ /([^\s:])(?!\s*:)/g); + my ($help, $arg) = ('', ''); + if (@witharg) { + $help .= "\n\tWith arguments: -" . join " -", @witharg; + $arg = "\nSpace is not required between options and their arguments."; + } + if (@rest) { + $help .= "\n\tBoolean (without arguments): -" . join " -", @rest; + } + my ($scr) = ($0 =~ m,([^/\\]+)$,); + print $h <<EOH if @_; # Let the script override this + +Usage: $scr [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...] +EOH + print $h <<EOH; + +The following single-character options are accepted:$help + +Options may be merged together. -- stops processing of options.$arg +EOH + my $has_pod; + if ( defined $0 and $0 ne '-e' and -f $0 and -r $0 + and open my $script, '<', $0 ) { + while (<$script>) { + $has_pod = 1, last if /^=(pod|head1)/; + } + } + print $h <<EOH if $has_pod; + +For more details run + perldoc -F $0 +EOH + } +} + +# Usage: +# getopts('a:bc'); # -a takes arg. -b & -c not. Sets opt_* as a +# # side effect. + +sub getopts ($;$) { + my ($argumentative, $hash) = @_; + my (@args,$first,$rest,$exit); + my $errs = 0; + local $_; + local @EXPORT; + + @args = split( / */, $argumentative ); + while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/s) { + ($first,$rest) = ($1,$2); + if (/^--$/) { # early exit if -- + shift @ARGV; + last; + } + my $pos = index($argumentative,$first); + if ($pos >= 0) { + if (defined($args[$pos+1]) and ($args[$pos+1] eq ':')) { + shift(@ARGV); + if ($rest eq '') { + ++$errs unless @ARGV; + $rest = shift(@ARGV); + } + if (ref $hash) { + $$hash{$first} = $rest; + } + else { + ${"opt_$first"} = $rest; + push( @EXPORT, "\$opt_$first" ); + } + } + else { + if (ref $hash) { + $$hash{$first} = 1; + } + else { + ${"opt_$first"} = 1; + push( @EXPORT, "\$opt_$first" ); + } + if ($rest eq '') { + shift(@ARGV); + } + else { + $ARGV[0] = "-$rest"; + } + } + } + else { + if ($first eq '-' and $rest eq 'help') { + version_mess($argumentative, 'main'); + help_mess($argumentative, 'main'); + try_exit(); + shift(@ARGV); + next; + } elsif ($first eq '-' and $rest eq 'version') { + version_mess($argumentative, 'main'); + try_exit(); + shift(@ARGV); + next; + } + warn "Unknown option: $first\n"; + ++$errs; + if ($rest ne '') { + $ARGV[0] = "-$rest"; + } + else { + shift(@ARGV); + } + } + } + unless (ref $hash) { + local $Exporter::ExportLevel = 1; + import Getopt::Std; + } + $errs == 0; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/HTTP/Tiny.pm b/data/miniconda3/lib/perl5/core_perl/HTTP/Tiny.pm new file mode 100644 index 0000000000000000000000000000000000000000..5803e4599f017ebabc2ef398170a209bc3b68b6d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/HTTP/Tiny.pm @@ -0,0 +1,2467 @@ +# vim: ts=4 sts=4 sw=4 et: +package HTTP::Tiny; +use strict; +use warnings; +# ABSTRACT: A small, simple, correct HTTP/1.1 client + +our $VERSION = '0.076'; + +sub _croak { require Carp; Carp::croak(@_) } + +#pod =method new +#pod +#pod $http = HTTP::Tiny->new( %attributes ); +#pod +#pod This constructor returns a new HTTP::Tiny object. Valid attributes include: +#pod +#pod =for :list +#pod * C<agent> — A user-agent string (defaults to 'HTTP-Tiny/$VERSION'). If +#pod C<agent> — ends in a space character, the default user-agent string is +#pod appended. +#pod * C<cookie_jar> — An instance of L<HTTP::CookieJar> — or equivalent class +#pod that supports the C<add> and C<cookie_header> methods +#pod * C<default_headers> — A hashref of default headers to apply to requests +#pod * C<local_address> — The local IP address to bind to +#pod * C<keep_alive> — Whether to reuse the last connection (if for the same +#pod scheme, host and port) (defaults to 1) +#pod * C<max_redirect> — Maximum number of redirects allowed (defaults to 5) +#pod * C<max_size> — Maximum response size in bytes (only when not using a data +#pod callback). If defined, responses larger than this will return an +#pod exception. +#pod * C<http_proxy> — URL of a proxy server to use for HTTP connections +#pod (default is C<$ENV{http_proxy}> — if set) +#pod * C<https_proxy> — URL of a proxy server to use for HTTPS connections +#pod (default is C<$ENV{https_proxy}> — if set) +#pod * C<proxy> — URL of a generic proxy server for both HTTP and HTTPS +#pod connections (default is C<$ENV{all_proxy}> — if set) +#pod * C<no_proxy> — List of domain suffixes that should not be proxied. Must +#pod be a comma-separated string or an array reference. (default is +#pod C<$ENV{no_proxy}> —) +#pod * C<timeout> — Request timeout in seconds (default is 60) If a socket open, +#pod read or write takes longer than the timeout, an exception is thrown. +#pod * C<verify_SSL> — A boolean that indicates whether to validate the SSL +#pod certificate of an C<https> — connection (default is false) +#pod * C<SSL_options> — A hashref of C<SSL_*> — options to pass through to +#pod L<IO::Socket::SSL> +#pod +#pod Passing an explicit C<undef> for C<proxy>, C<http_proxy> or C<https_proxy> will +#pod prevent getting the corresponding proxies from the environment. +#pod +#pod Exceptions from C<max_size>, C<timeout> or other errors will result in a +#pod pseudo-HTTP status code of 599 and a reason of "Internal Exception". The +#pod content field in the response will contain the text of the exception. +#pod +#pod The C<keep_alive> parameter enables a persistent connection, but only to a +#pod single destination scheme, host and port. Also, if any connection-relevant +#pod attributes are modified, or if the process ID or thread ID change, the +#pod persistent connection will be dropped. If you want persistent connections +#pod across multiple destinations, use multiple HTTP::Tiny objects. +#pod +#pod See L</SSL SUPPORT> for more on the C<verify_SSL> and C<SSL_options> attributes. +#pod +#pod =cut + +my @attributes; +BEGIN { + @attributes = qw( + cookie_jar default_headers http_proxy https_proxy keep_alive + local_address max_redirect max_size proxy no_proxy + SSL_options verify_SSL + ); + my %persist_ok = map {; $_ => 1 } qw( + cookie_jar default_headers max_redirect max_size + ); + no strict 'refs'; + no warnings 'uninitialized'; + for my $accessor ( @attributes ) { + *{$accessor} = sub { + @_ > 1 + ? do { + delete $_[0]->{handle} if !$persist_ok{$accessor} && $_[1] ne $_[0]->{$accessor}; + $_[0]->{$accessor} = $_[1] + } + : $_[0]->{$accessor}; + }; + } +} + +sub agent { + my($self, $agent) = @_; + if( @_ > 1 ){ + $self->{agent} = + (defined $agent && $agent =~ / $/) ? $agent . $self->_agent : $agent; + } + return $self->{agent}; +} + +sub timeout { + my ($self, $timeout) = @_; + if ( @_ > 1 ) { + $self->{timeout} = $timeout; + if ($self->{handle}) { + $self->{handle}->timeout($timeout); + } + } + return $self->{timeout}; +} + +sub new { + my($class, %args) = @_; + + my $self = { + max_redirect => 5, + timeout => defined $args{timeout} ? $args{timeout} : 60, + keep_alive => 1, + verify_SSL => $args{verify_SSL} || $args{verify_ssl} || 0, # no verification by default + no_proxy => $ENV{no_proxy}, + }; + + bless $self, $class; + + $class->_validate_cookie_jar( $args{cookie_jar} ) if $args{cookie_jar}; + + for my $key ( @attributes ) { + $self->{$key} = $args{$key} if exists $args{$key} + } + + $self->agent( exists $args{agent} ? $args{agent} : $class->_agent ); + + $self->_set_proxies; + + return $self; +} + +sub _set_proxies { + my ($self) = @_; + + # get proxies from %ENV only if not provided; explicit undef will disable + # getting proxies from the environment + + # generic proxy + if (! exists $self->{proxy} ) { + $self->{proxy} = $ENV{all_proxy} || $ENV{ALL_PROXY}; + } + + if ( defined $self->{proxy} ) { + $self->_split_proxy( 'generic proxy' => $self->{proxy} ); # validate + } + else { + delete $self->{proxy}; + } + + # http proxy + if (! exists $self->{http_proxy} ) { + # under CGI, bypass HTTP_PROXY as request sets it from Proxy header + local $ENV{HTTP_PROXY} if $ENV{REQUEST_METHOD}; + $self->{http_proxy} = $ENV{http_proxy} || $ENV{HTTP_PROXY} || $self->{proxy}; + } + + if ( defined $self->{http_proxy} ) { + $self->_split_proxy( http_proxy => $self->{http_proxy} ); # validate + $self->{_has_proxy}{http} = 1; + } + else { + delete $self->{http_proxy}; + } + + # https proxy + if (! exists $self->{https_proxy} ) { + $self->{https_proxy} = $ENV{https_proxy} || $ENV{HTTPS_PROXY} || $self->{proxy}; + } + + if ( $self->{https_proxy} ) { + $self->_split_proxy( https_proxy => $self->{https_proxy} ); # validate + $self->{_has_proxy}{https} = 1; + } + else { + delete $self->{https_proxy}; + } + + # Split no_proxy to array reference if not provided as such + unless ( ref $self->{no_proxy} eq 'ARRAY' ) { + $self->{no_proxy} = + (defined $self->{no_proxy}) ? [ split /\s*,\s*/, $self->{no_proxy} ] : []; + } + + return; +} + +#pod =method get|head|put|post|delete +#pod +#pod $response = $http->get($url); +#pod $response = $http->get($url, \%options); +#pod $response = $http->head($url); +#pod +#pod These methods are shorthand for calling C<request()> for the given method. The +#pod URL must have unsafe characters escaped and international domain names encoded. +#pod See C<request()> for valid options and a description of the response. +#pod +#pod The C<success> field of the response will be true if the status code is 2XX. +#pod +#pod =cut + +for my $sub_name ( qw/get head put post delete/ ) { + my $req_method = uc $sub_name; + no strict 'refs'; + eval <<"HERE"; ## no critic + sub $sub_name { + my (\$self, \$url, \$args) = \@_; + \@_ == 2 || (\@_ == 3 && ref \$args eq 'HASH') + or _croak(q/Usage: \$http->$sub_name(URL, [HASHREF])/ . "\n"); + return \$self->request('$req_method', \$url, \$args || {}); + } +HERE +} + +#pod =method post_form +#pod +#pod $response = $http->post_form($url, $form_data); +#pod $response = $http->post_form($url, $form_data, \%options); +#pod +#pod This method executes a C<POST> request and sends the key/value pairs from a +#pod form data hash or array reference to the given URL with a C<content-type> of +#pod C<application/x-www-form-urlencoded>. If data is provided as an array +#pod reference, the order is preserved; if provided as a hash reference, the terms +#pod are sorted on key and value for consistency. See documentation for the +#pod C<www_form_urlencode> method for details on the encoding. +#pod +#pod The URL must have unsafe characters escaped and international domain names +#pod encoded. See C<request()> for valid options and a description of the response. +#pod Any C<content-type> header or content in the options hashref will be ignored. +#pod +#pod The C<success> field of the response will be true if the status code is 2XX. +#pod +#pod =cut + +sub post_form { + my ($self, $url, $data, $args) = @_; + (@_ == 3 || @_ == 4 && ref $args eq 'HASH') + or _croak(q/Usage: $http->post_form(URL, DATAREF, [HASHREF])/ . "\n"); + + my $headers = {}; + while ( my ($key, $value) = each %{$args->{headers} || {}} ) { + $headers->{lc $key} = $value; + } + delete $args->{headers}; + + return $self->request('POST', $url, { + %$args, + content => $self->www_form_urlencode($data), + headers => { + %$headers, + 'content-type' => 'application/x-www-form-urlencoded' + }, + } + ); +} + +#pod =method mirror +#pod +#pod $response = $http->mirror($url, $file, \%options) +#pod if ( $response->{success} ) { +#pod print "$file is up to date\n"; +#pod } +#pod +#pod Executes a C<GET> request for the URL and saves the response body to the file +#pod name provided. The URL must have unsafe characters escaped and international +#pod domain names encoded. If the file already exists, the request will include an +#pod C<If-Modified-Since> header with the modification timestamp of the file. You +#pod may specify a different C<If-Modified-Since> header yourself in the C<< +#pod $options->{headers} >> hash. +#pod +#pod The C<success> field of the response will be true if the status code is 2XX +#pod or if the status code is 304 (unmodified). +#pod +#pod If the file was modified and the server response includes a properly +#pod formatted C<Last-Modified> header, the file modification time will +#pod be updated accordingly. +#pod +#pod =cut + +sub mirror { + my ($self, $url, $file, $args) = @_; + @_ == 3 || (@_ == 4 && ref $args eq 'HASH') + or _croak(q/Usage: $http->mirror(URL, FILE, [HASHREF])/ . "\n"); + + if ( exists $args->{headers} ) { + my $headers = {}; + while ( my ($key, $value) = each %{$args->{headers} || {}} ) { + $headers->{lc $key} = $value; + } + $args->{headers} = $headers; + } + + if ( -e $file and my $mtime = (stat($file))[9] ) { + $args->{headers}{'if-modified-since'} ||= $self->_http_date($mtime); + } + my $tempfile = $file . int(rand(2**31)); + + require Fcntl; + sysopen my $fh, $tempfile, Fcntl::O_CREAT()|Fcntl::O_EXCL()|Fcntl::O_WRONLY() + or _croak(qq/Error: Could not create temporary file $tempfile for downloading: $!\n/); + binmode $fh; + $args->{data_callback} = sub { print {$fh} $_[0] }; + my $response = $self->request('GET', $url, $args); + close $fh + or _croak(qq/Error: Caught error closing temporary file $tempfile: $!\n/); + + if ( $response->{success} ) { + rename $tempfile, $file + or _croak(qq/Error replacing $file with $tempfile: $!\n/); + my $lm = $response->{headers}{'last-modified'}; + if ( $lm and my $mtime = $self->_parse_http_date($lm) ) { + utime $mtime, $mtime, $file; + } + } + $response->{success} ||= $response->{status} eq '304'; + unlink $tempfile; + return $response; +} + +#pod =method request +#pod +#pod $response = $http->request($method, $url); +#pod $response = $http->request($method, $url, \%options); +#pod +#pod Executes an HTTP request of the given method type ('GET', 'HEAD', 'POST', +#pod 'PUT', etc.) on the given URL. The URL must have unsafe characters escaped and +#pod international domain names encoded. +#pod +#pod B<NOTE>: Method names are B<case-sensitive> per the HTTP/1.1 specification. +#pod Don't use C<get> when you really want C<GET>. See L<LIMITATIONS> for +#pod how this applies to redirection. +#pod +#pod If the URL includes a "user:password" stanza, they will be used for Basic-style +#pod authorization headers. (Authorization headers will not be included in a +#pod redirected request.) For example: +#pod +#pod $http->request('GET', 'http://Aladdin:open sesame@example.com/'); +#pod +#pod If the "user:password" stanza contains reserved characters, they must +#pod be percent-escaped: +#pod +#pod $http->request('GET', 'http://john%40example.com:password@example.com/'); +#pod +#pod A hashref of options may be appended to modify the request. +#pod +#pod Valid options are: +#pod +#pod =for :list +#pod * C<headers> — +#pod A hashref containing headers to include with the request. If the value for +#pod a header is an array reference, the header will be output multiple times with +#pod each value in the array. These headers over-write any default headers. +#pod * C<content> — +#pod A scalar to include as the body of the request OR a code reference +#pod that will be called iteratively to produce the body of the request +#pod * C<trailer_callback> — +#pod A code reference that will be called if it exists to provide a hashref +#pod of trailing headers (only used with chunked transfer-encoding) +#pod * C<data_callback> — +#pod A code reference that will be called for each chunks of the response +#pod body received. +#pod * C<peer> — +#pod Override host resolution and force all connections to go only to a +#pod specific peer address, regardless of the URL of the request. This will +#pod include any redirections! This options should be used with extreme +#pod caution (e.g. debugging or very special circumstances). It can be given as +#pod either a scalar or a code reference that will receive the hostname and +#pod whose response will be taken as the address. +#pod +#pod The C<Host> header is generated from the URL in accordance with RFC 2616. It +#pod is a fatal error to specify C<Host> in the C<headers> option. Other headers +#pod may be ignored or overwritten if necessary for transport compliance. +#pod +#pod If the C<content> option is a code reference, it will be called iteratively +#pod to provide the content body of the request. It should return the empty +#pod string or undef when the iterator is exhausted. +#pod +#pod If the C<content> option is the empty string, no C<content-type> or +#pod C<content-length> headers will be generated. +#pod +#pod If the C<data_callback> option is provided, it will be called iteratively until +#pod the entire response body is received. The first argument will be a string +#pod containing a chunk of the response body, the second argument will be the +#pod in-progress response hash reference, as described below. (This allows +#pod customizing the action of the callback based on the C<status> or C<headers> +#pod received prior to the content body.) +#pod +#pod The C<request> method returns a hashref containing the response. The hashref +#pod will have the following keys: +#pod +#pod =for :list +#pod * C<success> — +#pod Boolean indicating whether the operation returned a 2XX status code +#pod * C<url> — +#pod URL that provided the response. This is the URL of the request unless +#pod there were redirections, in which case it is the last URL queried +#pod in a redirection chain +#pod * C<status> — +#pod The HTTP status code of the response +#pod * C<reason> — +#pod The response phrase returned by the server +#pod * C<content> — +#pod The body of the response. If the response does not have any content +#pod or if a data callback is provided to consume the response body, +#pod this will be the empty string +#pod * C<headers> — +#pod A hashref of header fields. All header field names will be normalized +#pod to be lower case. If a header is repeated, the value will be an arrayref; +#pod it will otherwise be a scalar string containing the value +#pod * C<protocol> - +#pod If this field exists, it is the protocol of the response +#pod such as HTTP/1.0 or HTTP/1.1 +#pod * C<redirects> +#pod If this field exists, it is an arrayref of response hash references from +#pod redirects in the same order that redirections occurred. If it does +#pod not exist, then no redirections occurred. +#pod +#pod On an exception during the execution of the request, the C<status> field will +#pod contain 599, and the C<content> field will contain the text of the exception. +#pod +#pod =cut + +my %idempotent = map { $_ => 1 } qw/GET HEAD PUT DELETE OPTIONS TRACE/; + +sub request { + my ($self, $method, $url, $args) = @_; + @_ == 3 || (@_ == 4 && ref $args eq 'HASH') + or _croak(q/Usage: $http->request(METHOD, URL, [HASHREF])/ . "\n"); + $args ||= {}; # we keep some state in this during _request + + # RFC 2616 Section 8.1.4 mandates a single retry on broken socket + my $response; + for ( 0 .. 1 ) { + $response = eval { $self->_request($method, $url, $args) }; + last unless $@ && $idempotent{$method} + && $@ =~ m{^(?:Socket closed|Unexpected end)}; + } + + if (my $e = $@) { + # maybe we got a response hash thrown from somewhere deep + if ( ref $e eq 'HASH' && exists $e->{status} ) { + $e->{redirects} = delete $args->{_redirects} if @{ $args->{_redirects} || []}; + return $e; + } + + # otherwise, stringify it + $e = "$e"; + $response = { + url => $url, + success => q{}, + status => 599, + reason => 'Internal Exception', + content => $e, + headers => { + 'content-type' => 'text/plain', + 'content-length' => length $e, + }, + ( @{$args->{_redirects} || []} ? (redirects => delete $args->{_redirects}) : () ), + }; + } + return $response; +} + +#pod =method www_form_urlencode +#pod +#pod $params = $http->www_form_urlencode( $data ); +#pod $response = $http->get("http://example.com/query?$params"); +#pod +#pod This method converts the key/value pairs from a data hash or array reference +#pod into a C<x-www-form-urlencoded> string. The keys and values from the data +#pod reference will be UTF-8 encoded and escaped per RFC 3986. If a value is an +#pod array reference, the key will be repeated with each of the values of the array +#pod reference. If data is provided as a hash reference, the key/value pairs in the +#pod resulting string will be sorted by key and value for consistent ordering. +#pod +#pod =cut + +sub www_form_urlencode { + my ($self, $data) = @_; + (@_ == 2 && ref $data) + or _croak(q/Usage: $http->www_form_urlencode(DATAREF)/ . "\n"); + (ref $data eq 'HASH' || ref $data eq 'ARRAY') + or _croak("form data must be a hash or array reference\n"); + + my @params = ref $data eq 'HASH' ? %$data : @$data; + @params % 2 == 0 + or _croak("form data reference must have an even number of terms\n"); + + my @terms; + while( @params ) { + my ($key, $value) = splice(@params, 0, 2); + if ( ref $value eq 'ARRAY' ) { + unshift @params, map { $key => $_ } @$value; + } + else { + push @terms, join("=", map { $self->_uri_escape($_) } $key, $value); + } + } + + return join("&", (ref $data eq 'ARRAY') ? (@terms) : (sort @terms) ); +} + +#pod =method can_ssl +#pod +#pod $ok = HTTP::Tiny->can_ssl; +#pod ($ok, $why) = HTTP::Tiny->can_ssl; +#pod ($ok, $why) = $http->can_ssl; +#pod +#pod Indicates if SSL support is available. When called as a class object, it +#pod checks for the correct version of L<Net::SSLeay> and L<IO::Socket::SSL>. +#pod When called as an object methods, if C<SSL_verify> is true or if C<SSL_verify_mode> +#pod is set in C<SSL_options>, it checks that a CA file is available. +#pod +#pod In scalar context, returns a boolean indicating if SSL is available. +#pod In list context, returns the boolean and a (possibly multi-line) string of +#pod errors indicating why SSL isn't available. +#pod +#pod =cut + +sub can_ssl { + my ($self) = @_; + + my($ok, $reason) = (1, ''); + + # Need IO::Socket::SSL 1.42 for SSL_create_ctx_callback + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + unless (eval {require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.42)}) { + $ok = 0; + $reason .= qq/IO::Socket::SSL 1.42 must be installed for https support\n/; + } + + # Need Net::SSLeay 1.49 for MODE_AUTO_RETRY + unless (eval {require Net::SSLeay; Net::SSLeay->VERSION(1.49)}) { + $ok = 0; + $reason .= qq/Net::SSLeay 1.49 must be installed for https support\n/; + } + + # If an object, check that SSL config lets us get a CA if necessary + if ( ref($self) && ( $self->{verify_SSL} || $self->{SSL_options}{SSL_verify_mode} ) ) { + my $handle = HTTP::Tiny::Handle->new( + SSL_options => $self->{SSL_options}, + verify_SSL => $self->{verify_SSL}, + ); + unless ( eval { $handle->_find_CA_file; 1 } ) { + $ok = 0; + $reason .= "$@"; + } + } + + wantarray ? ($ok, $reason) : $ok; +} + +#pod =method connected +#pod +#pod $host = $http->connected; +#pod ($host, $port) = $http->connected; +#pod +#pod Indicates if a connection to a peer is being kept alive, per the C<keep_alive> +#pod option. +#pod +#pod In scalar context, returns the peer host and port, joined with a colon, or +#pod C<undef> (if no peer is connected). +#pod In list context, returns the peer host and port or an empty list (if no peer +#pod is connected). +#pod +#pod B<Note>: This method cannot reliably be used to discover whether the remote +#pod host has closed its end of the socket. +#pod +#pod =cut + +sub connected { + my ($self) = @_; + + # If a socket exists... + if ($self->{handle} && $self->{handle}{fh}) { + my $socket = $self->{handle}{fh}; + + # ...and is connected, return the peer host and port. + if ($socket->connected) { + return wantarray + ? ($socket->peerhost, $socket->peerport) + : join(':', $socket->peerhost, $socket->peerport); + } + } + return; +} + +#--------------------------------------------------------------------------# +# private methods +#--------------------------------------------------------------------------# + +my %DefaultPort = ( + http => 80, + https => 443, +); + +sub _agent { + my $class = ref($_[0]) || $_[0]; + (my $default_agent = $class) =~ s{::}{-}g; + return $default_agent . "/" . $class->VERSION; +} + +sub _request { + my ($self, $method, $url, $args) = @_; + + my ($scheme, $host, $port, $path_query, $auth) = $self->_split_url($url); + + my $request = { + method => $method, + scheme => $scheme, + host => $host, + port => $port, + host_port => ($port == $DefaultPort{$scheme} ? $host : "$host:$port"), + uri => $path_query, + headers => {}, + }; + + my $peer = $args->{peer} || $host; + + # Allow 'peer' to be a coderef. + if ('CODE' eq ref $peer) { + $peer = $peer->($host); + } + + # We remove the cached handle so it is not reused in the case of redirect. + # If all is well, it will be recached at the end of _request. We only + # reuse for the same scheme, host and port + my $handle = delete $self->{handle}; + if ( $handle ) { + unless ( $handle->can_reuse( $scheme, $host, $port, $peer ) ) { + $handle->close; + undef $handle; + } + } + $handle ||= $self->_open_handle( $request, $scheme, $host, $port, $peer ); + + $self->_prepare_headers_and_cb($request, $args, $url, $auth); + $handle->write_request($request); + + my $response; + do { $response = $handle->read_response_header } + until (substr($response->{status},0,1) ne '1'); + + $self->_update_cookie_jar( $url, $response ) if $self->{cookie_jar}; + my @redir_args = $self->_maybe_redirect($request, $response, $args); + + my $known_message_length; + if ($method eq 'HEAD' || $response->{status} =~ /^[23]04/) { + # response has no message body + $known_message_length = 1; + } + else { + # Ignore any data callbacks during redirection. + my $cb_args = @redir_args ? +{} : $args; + my $data_cb = $self->_prepare_data_cb($response, $cb_args); + $known_message_length = $handle->read_body($data_cb, $response); + } + + if ( $self->{keep_alive} + && $known_message_length + && $response->{protocol} eq 'HTTP/1.1' + && ($response->{headers}{connection} || '') ne 'close' + ) { + $self->{handle} = $handle; + } + else { + $handle->close; + } + + $response->{success} = substr( $response->{status}, 0, 1 ) eq '2'; + $response->{url} = $url; + + # Push the current response onto the stack of redirects if redirecting. + if (@redir_args) { + push @{$args->{_redirects}}, $response; + return $self->_request(@redir_args, $args); + } + + # Copy the stack of redirects into the response before returning. + $response->{redirects} = delete $args->{_redirects} + if @{$args->{_redirects}}; + return $response; +} + +sub _open_handle { + my ($self, $request, $scheme, $host, $port, $peer) = @_; + + my $handle = HTTP::Tiny::Handle->new( + timeout => $self->{timeout}, + SSL_options => $self->{SSL_options}, + verify_SSL => $self->{verify_SSL}, + local_address => $self->{local_address}, + keep_alive => $self->{keep_alive} + ); + + if ($self->{_has_proxy}{$scheme} && ! grep { $host =~ /\Q$_\E$/ } @{$self->{no_proxy}}) { + return $self->_proxy_connect( $request, $handle ); + } + else { + return $handle->connect($scheme, $host, $port, $peer); + } +} + +sub _proxy_connect { + my ($self, $request, $handle) = @_; + + my @proxy_vars; + if ( $request->{scheme} eq 'https' ) { + _croak(qq{No https_proxy defined}) unless $self->{https_proxy}; + @proxy_vars = $self->_split_proxy( https_proxy => $self->{https_proxy} ); + if ( $proxy_vars[0] eq 'https' ) { + _croak(qq{Can't proxy https over https: $request->{uri} via $self->{https_proxy}}); + } + } + else { + _croak(qq{No http_proxy defined}) unless $self->{http_proxy}; + @proxy_vars = $self->_split_proxy( http_proxy => $self->{http_proxy} ); + } + + my ($p_scheme, $p_host, $p_port, $p_auth) = @proxy_vars; + + if ( length $p_auth && ! defined $request->{headers}{'proxy-authorization'} ) { + $self->_add_basic_auth_header( $request, 'proxy-authorization' => $p_auth ); + } + + $handle->connect($p_scheme, $p_host, $p_port, $p_host); + + if ($request->{scheme} eq 'https') { + $self->_create_proxy_tunnel( $request, $handle ); + } + else { + # non-tunneled proxy requires absolute URI + $request->{uri} = "$request->{scheme}://$request->{host_port}$request->{uri}"; + } + + return $handle; +} + +sub _split_proxy { + my ($self, $type, $proxy) = @_; + + my ($scheme, $host, $port, $path_query, $auth) = eval { $self->_split_url($proxy) }; + + unless( + defined($scheme) && length($scheme) && length($host) && length($port) + && $path_query eq '/' + ) { + _croak(qq{$type URL must be in format http[s]://[auth@]<host>:<port>/\n}); + } + + return ($scheme, $host, $port, $auth); +} + +sub _create_proxy_tunnel { + my ($self, $request, $handle) = @_; + + $handle->_assert_ssl; + + my $agent = exists($request->{headers}{'user-agent'}) + ? $request->{headers}{'user-agent'} : $self->{agent}; + + my $connect_request = { + method => 'CONNECT', + uri => "$request->{host}:$request->{port}", + headers => { + host => "$request->{host}:$request->{port}", + 'user-agent' => $agent, + } + }; + + if ( $request->{headers}{'proxy-authorization'} ) { + $connect_request->{headers}{'proxy-authorization'} = + delete $request->{headers}{'proxy-authorization'}; + } + + $handle->write_request($connect_request); + my $response; + do { $response = $handle->read_response_header } + until (substr($response->{status},0,1) ne '1'); + + # if CONNECT failed, throw the response so it will be + # returned from the original request() method; + unless (substr($response->{status},0,1) eq '2') { + die $response; + } + + # tunnel established, so start SSL handshake + $handle->start_ssl( $request->{host} ); + + return; +} + +sub _prepare_headers_and_cb { + my ($self, $request, $args, $url, $auth) = @_; + + for ($self->{default_headers}, $args->{headers}) { + next unless defined; + while (my ($k, $v) = each %$_) { + $request->{headers}{lc $k} = $v; + $request->{header_case}{lc $k} = $k; + } + } + + if (exists $request->{headers}{'host'}) { + die(qq/The 'Host' header must not be provided as header option\n/); + } + + $request->{headers}{'host'} = $request->{host_port}; + $request->{headers}{'user-agent'} ||= $self->{agent}; + $request->{headers}{'connection'} = "close" + unless $self->{keep_alive}; + + if ( defined $args->{content} ) { + if (ref $args->{content} eq 'CODE') { + $request->{headers}{'content-type'} ||= "application/octet-stream"; + $request->{headers}{'transfer-encoding'} = 'chunked' + unless $request->{headers}{'content-length'} + || $request->{headers}{'transfer-encoding'}; + $request->{cb} = $args->{content}; + } + elsif ( length $args->{content} ) { + my $content = $args->{content}; + if ( $] ge '5.008' ) { + utf8::downgrade($content, 1) + or die(qq/Wide character in request message body\n/); + } + $request->{headers}{'content-type'} ||= "application/octet-stream"; + $request->{headers}{'content-length'} = length $content + unless $request->{headers}{'content-length'} + || $request->{headers}{'transfer-encoding'}; + $request->{cb} = sub { substr $content, 0, length $content, '' }; + } + $request->{trailer_cb} = $args->{trailer_callback} + if ref $args->{trailer_callback} eq 'CODE'; + } + + ### If we have a cookie jar, then maybe add relevant cookies + if ( $self->{cookie_jar} ) { + my $cookies = $self->cookie_jar->cookie_header( $url ); + $request->{headers}{cookie} = $cookies if length $cookies; + } + + # if we have Basic auth parameters, add them + if ( length $auth && ! defined $request->{headers}{authorization} ) { + $self->_add_basic_auth_header( $request, 'authorization' => $auth ); + } + + return; +} + +sub _add_basic_auth_header { + my ($self, $request, $header, $auth) = @_; + require MIME::Base64; + $request->{headers}{$header} = + "Basic " . MIME::Base64::encode_base64($auth, ""); + return; +} + +sub _prepare_data_cb { + my ($self, $response, $args) = @_; + my $data_cb = $args->{data_callback}; + $response->{content} = ''; + + if (!$data_cb || $response->{status} !~ /^2/) { + if (defined $self->{max_size}) { + $data_cb = sub { + $_[1]->{content} .= $_[0]; + die(qq/Size of response body exceeds the maximum allowed of $self->{max_size}\n/) + if length $_[1]->{content} > $self->{max_size}; + }; + } + else { + $data_cb = sub { $_[1]->{content} .= $_[0] }; + } + } + return $data_cb; +} + +sub _update_cookie_jar { + my ($self, $url, $response) = @_; + + my $cookies = $response->{headers}->{'set-cookie'}; + return unless defined $cookies; + + my @cookies = ref $cookies ? @$cookies : $cookies; + + $self->cookie_jar->add( $url, $_ ) for @cookies; + + return; +} + +sub _validate_cookie_jar { + my ($class, $jar) = @_; + + # duck typing + for my $method ( qw/add cookie_header/ ) { + _croak(qq/Cookie jar must provide the '$method' method\n/) + unless ref($jar) && ref($jar)->can($method); + } + + return; +} + +sub _maybe_redirect { + my ($self, $request, $response, $args) = @_; + my $headers = $response->{headers}; + my ($status, $method) = ($response->{status}, $request->{method}); + $args->{_redirects} ||= []; + + if (($status eq '303' or ($status =~ /^30[1278]/ && $method =~ /^GET|HEAD$/)) + and $headers->{location} + and @{$args->{_redirects}} < $self->{max_redirect} + ) { + my $location = ($headers->{location} =~ /^\//) + ? "$request->{scheme}://$request->{host_port}$headers->{location}" + : $headers->{location} ; + return (($status eq '303' ? 'GET' : $method), $location); + } + return; +} + +sub _split_url { + my $url = pop; + + # URI regex adapted from the URI module + my ($scheme, $host, $path_query) = $url =~ m<\A([^:/?#]+)://([^/?#]*)([^#]*)> + or die(qq/Cannot parse URL: '$url'\n/); + + $scheme = lc $scheme; + $path_query = "/$path_query" unless $path_query =~ m<\A/>; + + my $auth = ''; + if ( (my $i = index $host, '@') != -1 ) { + # user:pass@host + $auth = substr $host, 0, $i, ''; # take up to the @ for auth + substr $host, 0, 1, ''; # knock the @ off the host + + # userinfo might be percent escaped, so recover real auth info + $auth =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; + } + my $port = $host =~ s/:(\d*)\z// && length $1 ? $1 + : $scheme eq 'http' ? 80 + : $scheme eq 'https' ? 443 + : undef; + + return ($scheme, (length $host ? lc $host : "localhost") , $port, $path_query, $auth); +} + +# Date conversions adapted from HTTP::Date +my $DoW = "Sun|Mon|Tue|Wed|Thu|Fri|Sat"; +my $MoY = "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec"; +sub _http_date { + my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($_[1]); + return sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT", + substr($DoW,$wday*4,3), + $mday, substr($MoY,$mon*4,3), $year+1900, + $hour, $min, $sec + ); +} + +sub _parse_http_date { + my ($self, $str) = @_; + require Time::Local; + my @tl_parts; + if ($str =~ /^[SMTWF][a-z]+, +(\d{1,2}) ($MoY) +(\d\d\d\d) +(\d\d):(\d\d):(\d\d) +GMT$/) { + @tl_parts = ($6, $5, $4, $1, (index($MoY,$2)/4), $3); + } + elsif ($str =~ /^[SMTWF][a-z]+, +(\d\d)-($MoY)-(\d{2,4}) +(\d\d):(\d\d):(\d\d) +GMT$/ ) { + @tl_parts = ($6, $5, $4, $1, (index($MoY,$2)/4), $3); + } + elsif ($str =~ /^[SMTWF][a-z]+ +($MoY) +(\d{1,2}) +(\d\d):(\d\d):(\d\d) +(?:[^0-9]+ +)?(\d\d\d\d)$/ ) { + @tl_parts = ($5, $4, $3, $2, (index($MoY,$1)/4), $6); + } + return eval { + my $t = @tl_parts ? Time::Local::timegm(@tl_parts) : -1; + $t < 0 ? undef : $t; + }; +} + +# URI escaping adapted from URI::Escape +# c.f. http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 +# perl 5.6 ready UTF-8 encoding adapted from JSON::PP +my %escapes = map { chr($_) => sprintf("%%%02X", $_) } 0..255; +$escapes{' '}="+"; +my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/; + +sub _uri_escape { + my ($self, $str) = @_; + if ( $] ge '5.008' ) { + utf8::encode($str); + } + else { + $str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string + if ( length $str == do { use bytes; length $str } ); + $str = pack("C*", unpack("C*", $str)); # clear UTF-8 flag + } + $str =~ s/($unsafe_char)/$escapes{$1}/g; + return $str; +} + +package + HTTP::Tiny::Handle; # hide from PAUSE/indexers +use strict; +use warnings; + +use Errno qw[EINTR EPIPE]; +use IO::Socket qw[SOCK_STREAM]; +use Socket qw[SOL_SOCKET SO_KEEPALIVE]; + +# PERL_HTTP_TINY_IPV4_ONLY is a private environment variable to force old +# behavior if someone is unable to boostrap CPAN from a new perl install; it is +# not intended for general, per-client use and may be removed in the future +my $SOCKET_CLASS = + $ENV{PERL_HTTP_TINY_IPV4_ONLY} ? 'IO::Socket::INET' : + eval { require IO::Socket::IP; IO::Socket::IP->VERSION(0.25) } ? 'IO::Socket::IP' : + 'IO::Socket::INET'; + +sub BUFSIZE () { 32768 } ## no critic + +my $Printable = sub { + local $_ = shift; + s/\r/\\r/g; + s/\n/\\n/g; + s/\t/\\t/g; + s/([^\x20-\x7E])/sprintf('\\x%.2X', ord($1))/ge; + $_; +}; + +my $Token = qr/[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]/; +my $Field_Content = qr/[[:print:]]+ (?: [\x20\x09]+ [[:print:]]+ )*/x; + +sub new { + my ($class, %args) = @_; + return bless { + rbuf => '', + timeout => 60, + max_line_size => 16384, + max_header_lines => 64, + verify_SSL => 0, + SSL_options => {}, + %args + }, $class; +} + +sub timeout { + my ($self, $timeout) = @_; + if ( @_ > 1 ) { + $self->{timeout} = $timeout; + if ( $self->{fh} && $self->{fh}->can('timeout') ) { + $self->{fh}->timeout($timeout); + } + } + return $self->{timeout}; +} + +sub connect { + @_ == 5 || die(q/Usage: $handle->connect(scheme, host, port, peer)/ . "\n"); + my ($self, $scheme, $host, $port, $peer) = @_; + + if ( $scheme eq 'https' ) { + $self->_assert_ssl; + } + elsif ( $scheme ne 'http' ) { + die(qq/Unsupported URL scheme '$scheme'\n/); + } + $self->{fh} = $SOCKET_CLASS->new( + PeerHost => $peer, + PeerPort => $port, + $self->{local_address} ? + ( LocalAddr => $self->{local_address} ) : (), + Proto => 'tcp', + Type => SOCK_STREAM, + Timeout => $self->{timeout}, + ) or die(qq/Could not connect to '$host:$port': $@\n/); + + binmode($self->{fh}) + or die(qq/Could not binmode() socket: '$!'\n/); + + if ( $self->{keep_alive} ) { + unless ( defined( $self->{fh}->setsockopt( SOL_SOCKET, SO_KEEPALIVE, 1 ) ) ) { + CORE::close($self->{fh}); + die(qq/Could not set SO_KEEPALIVE on socket: '$!'\n/); + } + } + + $self->start_ssl($host) if $scheme eq 'https'; + + $self->{scheme} = $scheme; + $self->{host} = $host; + $self->{peer} = $peer; + $self->{port} = $port; + $self->{pid} = $$; + $self->{tid} = _get_tid(); + + return $self; +} + +sub start_ssl { + my ($self, $host) = @_; + + # As this might be used via CONNECT after an SSL session + # to a proxy, we shut down any existing SSL before attempting + # the handshake + if ( ref($self->{fh}) eq 'IO::Socket::SSL' ) { + unless ( $self->{fh}->stop_SSL ) { + my $ssl_err = IO::Socket::SSL->errstr; + die(qq/Error halting prior SSL connection: $ssl_err/); + } + } + + my $ssl_args = $self->_ssl_args($host); + IO::Socket::SSL->start_SSL( + $self->{fh}, + %$ssl_args, + SSL_create_ctx_callback => sub { + my $ctx = shift; + Net::SSLeay::CTX_set_mode($ctx, Net::SSLeay::MODE_AUTO_RETRY()); + }, + ); + + unless ( ref($self->{fh}) eq 'IO::Socket::SSL' ) { + my $ssl_err = IO::Socket::SSL->errstr; + die(qq/SSL connection failed for $host: $ssl_err\n/); + } +} + +sub close { + @_ == 1 || die(q/Usage: $handle->close()/ . "\n"); + my ($self) = @_; + CORE::close($self->{fh}) + or die(qq/Could not close socket: '$!'\n/); +} + +sub write { + @_ == 2 || die(q/Usage: $handle->write(buf)/ . "\n"); + my ($self, $buf) = @_; + + if ( $] ge '5.008' ) { + utf8::downgrade($buf, 1) + or die(qq/Wide character in write()\n/); + } + + my $len = length $buf; + my $off = 0; + + local $SIG{PIPE} = 'IGNORE'; + + while () { + $self->can_write + or die(qq/Timed out while waiting for socket to become ready for writing\n/); + my $r = syswrite($self->{fh}, $buf, $len, $off); + if (defined $r) { + $len -= $r; + $off += $r; + last unless $len > 0; + } + elsif ($! == EPIPE) { + die(qq/Socket closed by remote server: $!\n/); + } + elsif ($! != EINTR) { + if ($self->{fh}->can('errstr')){ + my $err = $self->{fh}->errstr(); + die (qq/Could not write to SSL socket: '$err'\n /); + } + else { + die(qq/Could not write to socket: '$!'\n/); + } + + } + } + return $off; +} + +sub read { + @_ == 2 || @_ == 3 || die(q/Usage: $handle->read(len [, allow_partial])/ . "\n"); + my ($self, $len, $allow_partial) = @_; + + my $buf = ''; + my $got = length $self->{rbuf}; + + if ($got) { + my $take = ($got < $len) ? $got : $len; + $buf = substr($self->{rbuf}, 0, $take, ''); + $len -= $take; + } + + while ($len > 0) { + $self->can_read + or die(q/Timed out while waiting for socket to become ready for reading/ . "\n"); + my $r = sysread($self->{fh}, $buf, $len, length $buf); + if (defined $r) { + last unless $r; + $len -= $r; + } + elsif ($! != EINTR) { + if ($self->{fh}->can('errstr')){ + my $err = $self->{fh}->errstr(); + die (qq/Could not read from SSL socket: '$err'\n /); + } + else { + die(qq/Could not read from socket: '$!'\n/); + } + } + } + if ($len && !$allow_partial) { + die(qq/Unexpected end of stream\n/); + } + return $buf; +} + +sub readline { + @_ == 1 || die(q/Usage: $handle->readline()/ . "\n"); + my ($self) = @_; + + while () { + if ($self->{rbuf} =~ s/\A ([^\x0D\x0A]* \x0D?\x0A)//x) { + return $1; + } + if (length $self->{rbuf} >= $self->{max_line_size}) { + die(qq/Line size exceeds the maximum allowed size of $self->{max_line_size}\n/); + } + $self->can_read + or die(qq/Timed out while waiting for socket to become ready for reading\n/); + my $r = sysread($self->{fh}, $self->{rbuf}, BUFSIZE, length $self->{rbuf}); + if (defined $r) { + last unless $r; + } + elsif ($! != EINTR) { + if ($self->{fh}->can('errstr')){ + my $err = $self->{fh}->errstr(); + die (qq/Could not read from SSL socket: '$err'\n /); + } + else { + die(qq/Could not read from socket: '$!'\n/); + } + } + } + die(qq/Unexpected end of stream while looking for line\n/); +} + +sub read_header_lines { + @_ == 1 || @_ == 2 || die(q/Usage: $handle->read_header_lines([headers])/ . "\n"); + my ($self, $headers) = @_; + $headers ||= {}; + my $lines = 0; + my $val; + + while () { + my $line = $self->readline; + + if (++$lines >= $self->{max_header_lines}) { + die(qq/Header lines exceeds maximum number allowed of $self->{max_header_lines}\n/); + } + elsif ($line =~ /\A ([^\x00-\x1F\x7F:]+) : [\x09\x20]* ([^\x0D\x0A]*)/x) { + my ($field_name) = lc $1; + if (exists $headers->{$field_name}) { + for ($headers->{$field_name}) { + $_ = [$_] unless ref $_ eq "ARRAY"; + push @$_, $2; + $val = \$_->[-1]; + } + } + else { + $val = \($headers->{$field_name} = $2); + } + } + elsif ($line =~ /\A [\x09\x20]+ ([^\x0D\x0A]*)/x) { + $val + or die(qq/Unexpected header continuation line\n/); + next unless length $1; + $$val .= ' ' if length $$val; + $$val .= $1; + } + elsif ($line =~ /\A \x0D?\x0A \z/x) { + last; + } + else { + die(q/Malformed header line: / . $Printable->($line) . "\n"); + } + } + return $headers; +} + +sub write_request { + @_ == 2 || die(q/Usage: $handle->write_request(request)/ . "\n"); + my($self, $request) = @_; + $self->write_request_header(@{$request}{qw/method uri headers header_case/}); + $self->write_body($request) if $request->{cb}; + return; +} + +# Standard request header names/case from HTTP/1.1 RFCs +my @rfc_request_headers = qw( + Accept Accept-Charset Accept-Encoding Accept-Language Authorization + Cache-Control Connection Content-Length Expect From Host + If-Match If-Modified-Since If-None-Match If-Range If-Unmodified-Since + Max-Forwards Pragma Proxy-Authorization Range Referer TE Trailer + Transfer-Encoding Upgrade User-Agent Via +); + +my @other_request_headers = qw( + Content-Encoding Content-MD5 Content-Type Cookie DNT Date Origin + X-XSS-Protection +); + +my %HeaderCase = map { lc($_) => $_ } @rfc_request_headers, @other_request_headers; + +# to avoid multiple small writes and hence nagle, you can pass the method line or anything else to +# combine writes. +sub write_header_lines { + (@_ >= 2 && @_ <= 4 && ref $_[1] eq 'HASH') || die(q/Usage: $handle->write_header_lines(headers, [header_case, prefix])/ . "\n"); + my($self, $headers, $header_case, $prefix_data) = @_; + $header_case ||= {}; + + my $buf = (defined $prefix_data ? $prefix_data : ''); + + # Per RFC, control fields should be listed first + my %seen; + for my $k ( qw/host cache-control expect max-forwards pragma range te/ ) { + next unless exists $headers->{$k}; + $seen{$k}++; + my $field_name = $HeaderCase{$k}; + my $v = $headers->{$k}; + for (ref $v eq 'ARRAY' ? @$v : $v) { + $_ = '' unless defined $_; + $buf .= "$field_name: $_\x0D\x0A"; + } + } + + # Other headers sent in arbitrary order + while (my ($k, $v) = each %$headers) { + my $field_name = lc $k; + next if $seen{$field_name}; + if (exists $HeaderCase{$field_name}) { + $field_name = $HeaderCase{$field_name}; + } + else { + if (exists $header_case->{$field_name}) { + $field_name = $header_case->{$field_name}; + } + else { + $field_name =~ s/\b(\w)/\u$1/g; + } + $field_name =~ /\A $Token+ \z/xo + or die(q/Invalid HTTP header field name: / . $Printable->($field_name) . "\n"); + $HeaderCase{lc $field_name} = $field_name; + } + for (ref $v eq 'ARRAY' ? @$v : $v) { + # unwrap a field value if pre-wrapped by user + s/\x0D?\x0A\s+/ /g; + die(qq/Invalid HTTP header field value ($field_name): / . $Printable->($_). "\n") + unless $_ eq '' || /\A $Field_Content \z/xo; + $_ = '' unless defined $_; + $buf .= "$field_name: $_\x0D\x0A"; + } + } + $buf .= "\x0D\x0A"; + return $self->write($buf); +} + +# return value indicates whether message length was defined; this is generally +# true unless there was no content-length header and we just read until EOF. +# Other message length errors are thrown as exceptions +sub read_body { + @_ == 3 || die(q/Usage: $handle->read_body(callback, response)/ . "\n"); + my ($self, $cb, $response) = @_; + my $te = $response->{headers}{'transfer-encoding'} || ''; + my $chunked = grep { /chunked/i } ( ref $te eq 'ARRAY' ? @$te : $te ) ; + return $chunked + ? $self->read_chunked_body($cb, $response) + : $self->read_content_body($cb, $response); +} + +sub write_body { + @_ == 2 || die(q/Usage: $handle->write_body(request)/ . "\n"); + my ($self, $request) = @_; + if ($request->{headers}{'content-length'}) { + return $self->write_content_body($request); + } + else { + return $self->write_chunked_body($request); + } +} + +sub read_content_body { + @_ == 3 || @_ == 4 || die(q/Usage: $handle->read_content_body(callback, response, [read_length])/ . "\n"); + my ($self, $cb, $response, $content_length) = @_; + $content_length ||= $response->{headers}{'content-length'}; + + if ( defined $content_length ) { + my $len = $content_length; + while ($len > 0) { + my $read = ($len > BUFSIZE) ? BUFSIZE : $len; + $cb->($self->read($read, 0), $response); + $len -= $read; + } + return length($self->{rbuf}) == 0; + } + + my $chunk; + $cb->($chunk, $response) while length( $chunk = $self->read(BUFSIZE, 1) ); + + return; +} + +sub write_content_body { + @_ == 2 || die(q/Usage: $handle->write_content_body(request)/ . "\n"); + my ($self, $request) = @_; + + my ($len, $content_length) = (0, $request->{headers}{'content-length'}); + while () { + my $data = $request->{cb}->(); + + defined $data && length $data + or last; + + if ( $] ge '5.008' ) { + utf8::downgrade($data, 1) + or die(qq/Wide character in write_content()\n/); + } + + $len += $self->write($data); + } + + $len == $content_length + or die(qq/Content-Length mismatch (got: $len expected: $content_length)\n/); + + return $len; +} + +sub read_chunked_body { + @_ == 3 || die(q/Usage: $handle->read_chunked_body(callback, $response)/ . "\n"); + my ($self, $cb, $response) = @_; + + while () { + my $head = $self->readline; + + $head =~ /\A ([A-Fa-f0-9]+)/x + or die(q/Malformed chunk head: / . $Printable->($head) . "\n"); + + my $len = hex($1) + or last; + + $self->read_content_body($cb, $response, $len); + + $self->read(2) eq "\x0D\x0A" + or die(qq/Malformed chunk: missing CRLF after chunk data\n/); + } + $self->read_header_lines($response->{headers}); + return 1; +} + +sub write_chunked_body { + @_ == 2 || die(q/Usage: $handle->write_chunked_body(request)/ . "\n"); + my ($self, $request) = @_; + + my $len = 0; + while () { + my $data = $request->{cb}->(); + + defined $data && length $data + or last; + + if ( $] ge '5.008' ) { + utf8::downgrade($data, 1) + or die(qq/Wide character in write_chunked_body()\n/); + } + + $len += length $data; + + my $chunk = sprintf '%X', length $data; + $chunk .= "\x0D\x0A"; + $chunk .= $data; + $chunk .= "\x0D\x0A"; + + $self->write($chunk); + } + $self->write("0\x0D\x0A"); + if ( ref $request->{trailer_cb} eq 'CODE' ) { + $self->write_header_lines($request->{trailer_cb}->()) + } + else { + $self->write("\x0D\x0A"); + } + return $len; +} + +sub read_response_header { + @_ == 1 || die(q/Usage: $handle->read_response_header()/ . "\n"); + my ($self) = @_; + + my $line = $self->readline; + + $line =~ /\A (HTTP\/(0*\d+\.0*\d+)) [\x09\x20]+ ([0-9]{3}) [\x09\x20]+ ([^\x0D\x0A]*) \x0D?\x0A/x + or die(q/Malformed Status-Line: / . $Printable->($line). "\n"); + + my ($protocol, $version, $status, $reason) = ($1, $2, $3, $4); + + die (qq/Unsupported HTTP protocol: $protocol\n/) + unless $version =~ /0*1\.0*[01]/; + + return { + status => $status, + reason => $reason, + headers => $self->read_header_lines, + protocol => $protocol, + }; +} + +sub write_request_header { + @_ == 5 || die(q/Usage: $handle->write_request_header(method, request_uri, headers, header_case)/ . "\n"); + my ($self, $method, $request_uri, $headers, $header_case) = @_; + + return $self->write_header_lines($headers, $header_case, "$method $request_uri HTTP/1.1\x0D\x0A"); +} + +sub _do_timeout { + my ($self, $type, $timeout) = @_; + $timeout = $self->{timeout} + unless defined $timeout && $timeout >= 0; + + my $fd = fileno $self->{fh}; + defined $fd && $fd >= 0 + or die(qq/select(2): 'Bad file descriptor'\n/); + + my $initial = time; + my $pending = $timeout; + my $nfound; + + vec(my $fdset = '', $fd, 1) = 1; + + while () { + $nfound = ($type eq 'read') + ? select($fdset, undef, undef, $pending) + : select(undef, $fdset, undef, $pending) ; + if ($nfound == -1) { + $! == EINTR + or die(qq/select(2): '$!'\n/); + redo if !$timeout || ($pending = $timeout - (time - $initial)) > 0; + $nfound = 0; + } + last; + } + $! = 0; + return $nfound; +} + +sub can_read { + @_ == 1 || @_ == 2 || die(q/Usage: $handle->can_read([timeout])/ . "\n"); + my $self = shift; + if ( ref($self->{fh}) eq 'IO::Socket::SSL' ) { + return 1 if $self->{fh}->pending; + } + return $self->_do_timeout('read', @_) +} + +sub can_write { + @_ == 1 || @_ == 2 || die(q/Usage: $handle->can_write([timeout])/ . "\n"); + my $self = shift; + return $self->_do_timeout('write', @_) +} + +sub _assert_ssl { + my($ok, $reason) = HTTP::Tiny->can_ssl(); + die $reason unless $ok; +} + +sub can_reuse { + my ($self,$scheme,$host,$port,$peer) = @_; + return 0 if + $self->{pid} != $$ + || $self->{tid} != _get_tid() + || length($self->{rbuf}) + || $scheme ne $self->{scheme} + || $host ne $self->{host} + || $port ne $self->{port} + || $peer ne $self->{peer} + || eval { $self->can_read(0) } + || $@ ; + return 1; +} + +# Try to find a CA bundle to validate the SSL cert, +# prefer Mozilla::CA or fallback to a system file +sub _find_CA_file { + my $self = shift(); + + my $ca_file = + defined( $self->{SSL_options}->{SSL_ca_file} ) + ? $self->{SSL_options}->{SSL_ca_file} + : $ENV{SSL_CERT_FILE}; + + if ( defined $ca_file ) { + unless ( -r $ca_file ) { + die qq/SSL_ca_file '$ca_file' not found or not readable\n/; + } + return $ca_file; + } + + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + return Mozilla::CA::SSL_ca_file() + if eval { require Mozilla::CA; 1 }; + + # cert list copied from golang src/crypto/x509/root_unix.go + foreach my $ca_bundle ( + "/etc/ssl/certs/ca-certificates.crt", # Debian/Ubuntu/Gentoo etc. + "/etc/pki/tls/certs/ca-bundle.crt", # Fedora/RHEL + "/etc/ssl/ca-bundle.pem", # OpenSUSE + "/etc/openssl/certs/ca-certificates.crt", # NetBSD + "/etc/ssl/cert.pem", # OpenBSD + "/usr/local/share/certs/ca-root-nss.crt", # FreeBSD/DragonFly + "/etc/pki/tls/cacert.pem", # OpenELEC + "/etc/certs/ca-certificates.crt", # Solaris 11.2+ + ) { + return $ca_bundle if -e $ca_bundle; + } + + die qq/Couldn't find a CA bundle with which to verify the SSL certificate.\n/ + . qq/Try installing Mozilla::CA from CPAN\n/; +} + +# for thread safety, we need to know thread id if threads are loaded +sub _get_tid { + no warnings 'reserved'; # for 'threads' + return threads->can("tid") ? threads->tid : 0; +} + +sub _ssl_args { + my ($self, $host) = @_; + + my %ssl_args; + + # This test reimplements IO::Socket::SSL::can_client_sni(), which wasn't + # added until IO::Socket::SSL 1.84 + if ( Net::SSLeay::OPENSSL_VERSION_NUMBER() >= 0x01000000 ) { + $ssl_args{SSL_hostname} = $host, # Sane SNI support + } + + if ($self->{verify_SSL}) { + $ssl_args{SSL_verifycn_scheme} = 'http'; # enable CN validation + $ssl_args{SSL_verifycn_name} = $host; # set validation hostname + $ssl_args{SSL_verify_mode} = 0x01; # enable cert validation + $ssl_args{SSL_ca_file} = $self->_find_CA_file; + } + else { + $ssl_args{SSL_verifycn_scheme} = 'none'; # disable CN validation + $ssl_args{SSL_verify_mode} = 0x00; # disable cert validation + } + + # user options override settings from verify_SSL + for my $k ( keys %{$self->{SSL_options}} ) { + $ssl_args{$k} = $self->{SSL_options}{$k} if $k =~ m/^SSL_/; + } + + return \%ssl_args; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +HTTP::Tiny - A small, simple, correct HTTP/1.1 client + +=head1 VERSION + +version 0.076 + +=head1 SYNOPSIS + + use HTTP::Tiny; + + my $response = HTTP::Tiny->new->get('http://example.com/'); + + die "Failed!\n" unless $response->{success}; + + print "$response->{status} $response->{reason}\n"; + + while (my ($k, $v) = each %{$response->{headers}}) { + for (ref $v eq 'ARRAY' ? @$v : $v) { + print "$k: $_\n"; + } + } + + print $response->{content} if length $response->{content}; + +=head1 DESCRIPTION + +This is a very simple HTTP/1.1 client, designed for doing simple +requests without the overhead of a large framework like L<LWP::UserAgent>. + +It is more correct and more complete than L<HTTP::Lite>. It supports +proxies and redirection. It also correctly resumes after EINTR. + +If L<IO::Socket::IP> 0.25 or later is installed, HTTP::Tiny will use it instead +of L<IO::Socket::INET> for transparent support for both IPv4 and IPv6. + +Cookie support requires L<HTTP::CookieJar> or an equivalent class. + +=head1 METHODS + +=head2 new + + $http = HTTP::Tiny->new( %attributes ); + +This constructor returns a new HTTP::Tiny object. Valid attributes include: + +=over 4 + +=item * + +C<agent> — A user-agent string (defaults to 'HTTP-Tiny/$VERSION'). If C<agent> — ends in a space character, the default user-agent string is appended. + +=item * + +C<cookie_jar> — An instance of L<HTTP::CookieJar> — or equivalent class that supports the C<add> and C<cookie_header> methods + +=item * + +C<default_headers> — A hashref of default headers to apply to requests + +=item * + +C<local_address> — The local IP address to bind to + +=item * + +C<keep_alive> — Whether to reuse the last connection (if for the same scheme, host and port) (defaults to 1) + +=item * + +C<max_redirect> — Maximum number of redirects allowed (defaults to 5) + +=item * + +C<max_size> — Maximum response size in bytes (only when not using a data callback). If defined, responses larger than this will return an exception. + +=item * + +C<http_proxy> — URL of a proxy server to use for HTTP connections (default is C<$ENV{http_proxy}> — if set) + +=item * + +C<https_proxy> — URL of a proxy server to use for HTTPS connections (default is C<$ENV{https_proxy}> — if set) + +=item * + +C<proxy> — URL of a generic proxy server for both HTTP and HTTPS connections (default is C<$ENV{all_proxy}> — if set) + +=item * + +C<no_proxy> — List of domain suffixes that should not be proxied. Must be a comma-separated string or an array reference. (default is C<$ENV{no_proxy}> —) + +=item * + +C<timeout> — Request timeout in seconds (default is 60) If a socket open, read or write takes longer than the timeout, an exception is thrown. + +=item * + +C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is false) + +=item * + +C<SSL_options> — A hashref of C<SSL_*> — options to pass through to L<IO::Socket::SSL> + +=back + +Passing an explicit C<undef> for C<proxy>, C<http_proxy> or C<https_proxy> will +prevent getting the corresponding proxies from the environment. + +Exceptions from C<max_size>, C<timeout> or other errors will result in a +pseudo-HTTP status code of 599 and a reason of "Internal Exception". The +content field in the response will contain the text of the exception. + +The C<keep_alive> parameter enables a persistent connection, but only to a +single destination scheme, host and port. Also, if any connection-relevant +attributes are modified, or if the process ID or thread ID change, the +persistent connection will be dropped. If you want persistent connections +across multiple destinations, use multiple HTTP::Tiny objects. + +See L</SSL SUPPORT> for more on the C<verify_SSL> and C<SSL_options> attributes. + +=head2 get|head|put|post|delete + + $response = $http->get($url); + $response = $http->get($url, \%options); + $response = $http->head($url); + +These methods are shorthand for calling C<request()> for the given method. The +URL must have unsafe characters escaped and international domain names encoded. +See C<request()> for valid options and a description of the response. + +The C<success> field of the response will be true if the status code is 2XX. + +=head2 post_form + + $response = $http->post_form($url, $form_data); + $response = $http->post_form($url, $form_data, \%options); + +This method executes a C<POST> request and sends the key/value pairs from a +form data hash or array reference to the given URL with a C<content-type> of +C<application/x-www-form-urlencoded>. If data is provided as an array +reference, the order is preserved; if provided as a hash reference, the terms +are sorted on key and value for consistency. See documentation for the +C<www_form_urlencode> method for details on the encoding. + +The URL must have unsafe characters escaped and international domain names +encoded. See C<request()> for valid options and a description of the response. +Any C<content-type> header or content in the options hashref will be ignored. + +The C<success> field of the response will be true if the status code is 2XX. + +=head2 mirror + + $response = $http->mirror($url, $file, \%options) + if ( $response->{success} ) { + print "$file is up to date\n"; + } + +Executes a C<GET> request for the URL and saves the response body to the file +name provided. The URL must have unsafe characters escaped and international +domain names encoded. If the file already exists, the request will include an +C<If-Modified-Since> header with the modification timestamp of the file. You +may specify a different C<If-Modified-Since> header yourself in the C<< +$options->{headers} >> hash. + +The C<success> field of the response will be true if the status code is 2XX +or if the status code is 304 (unmodified). + +If the file was modified and the server response includes a properly +formatted C<Last-Modified> header, the file modification time will +be updated accordingly. + +=head2 request + + $response = $http->request($method, $url); + $response = $http->request($method, $url, \%options); + +Executes an HTTP request of the given method type ('GET', 'HEAD', 'POST', +'PUT', etc.) on the given URL. The URL must have unsafe characters escaped and +international domain names encoded. + +B<NOTE>: Method names are B<case-sensitive> per the HTTP/1.1 specification. +Don't use C<get> when you really want C<GET>. See L<LIMITATIONS> for +how this applies to redirection. + +If the URL includes a "user:password" stanza, they will be used for Basic-style +authorization headers. (Authorization headers will not be included in a +redirected request.) For example: + + $http->request('GET', 'http://Aladdin:open sesame@example.com/'); + +If the "user:password" stanza contains reserved characters, they must +be percent-escaped: + + $http->request('GET', 'http://john%40example.com:password@example.com/'); + +A hashref of options may be appended to modify the request. + +Valid options are: + +=over 4 + +=item * + +C<headers> — A hashref containing headers to include with the request. If the value for a header is an array reference, the header will be output multiple times with each value in the array. These headers over-write any default headers. + +=item * + +C<content> — A scalar to include as the body of the request OR a code reference that will be called iteratively to produce the body of the request + +=item * + +C<trailer_callback> — A code reference that will be called if it exists to provide a hashref of trailing headers (only used with chunked transfer-encoding) + +=item * + +C<data_callback> — A code reference that will be called for each chunks of the response body received. + +=item * + +C<peer> — Override host resolution and force all connections to go only to a specific peer address, regardless of the URL of the request. This will include any redirections! This options should be used with extreme caution (e.g. debugging or very special circumstances). It can be given as either a scalar or a code reference that will receive the hostname and whose response will be taken as the address. + +=back + +The C<Host> header is generated from the URL in accordance with RFC 2616. It +is a fatal error to specify C<Host> in the C<headers> option. Other headers +may be ignored or overwritten if necessary for transport compliance. + +If the C<content> option is a code reference, it will be called iteratively +to provide the content body of the request. It should return the empty +string or undef when the iterator is exhausted. + +If the C<content> option is the empty string, no C<content-type> or +C<content-length> headers will be generated. + +If the C<data_callback> option is provided, it will be called iteratively until +the entire response body is received. The first argument will be a string +containing a chunk of the response body, the second argument will be the +in-progress response hash reference, as described below. (This allows +customizing the action of the callback based on the C<status> or C<headers> +received prior to the content body.) + +The C<request> method returns a hashref containing the response. The hashref +will have the following keys: + +=over 4 + +=item * + +C<success> — Boolean indicating whether the operation returned a 2XX status code + +=item * + +C<url> — URL that provided the response. This is the URL of the request unless there were redirections, in which case it is the last URL queried in a redirection chain + +=item * + +C<status> — The HTTP status code of the response + +=item * + +C<reason> — The response phrase returned by the server + +=item * + +C<content> — The body of the response. If the response does not have any content or if a data callback is provided to consume the response body, this will be the empty string + +=item * + +C<headers> — A hashref of header fields. All header field names will be normalized to be lower case. If a header is repeated, the value will be an arrayref; it will otherwise be a scalar string containing the value + +=item * + +C<protocol> - If this field exists, it is the protocol of the response such as HTTP/1.0 or HTTP/1.1 + +=item * + +C<redirects> If this field exists, it is an arrayref of response hash references from redirects in the same order that redirections occurred. If it does not exist, then no redirections occurred. + +=back + +On an exception during the execution of the request, the C<status> field will +contain 599, and the C<content> field will contain the text of the exception. + +=head2 www_form_urlencode + + $params = $http->www_form_urlencode( $data ); + $response = $http->get("http://example.com/query?$params"); + +This method converts the key/value pairs from a data hash or array reference +into a C<x-www-form-urlencoded> string. The keys and values from the data +reference will be UTF-8 encoded and escaped per RFC 3986. If a value is an +array reference, the key will be repeated with each of the values of the array +reference. If data is provided as a hash reference, the key/value pairs in the +resulting string will be sorted by key and value for consistent ordering. + +=head2 can_ssl + + $ok = HTTP::Tiny->can_ssl; + ($ok, $why) = HTTP::Tiny->can_ssl; + ($ok, $why) = $http->can_ssl; + +Indicates if SSL support is available. When called as a class object, it +checks for the correct version of L<Net::SSLeay> and L<IO::Socket::SSL>. +When called as an object methods, if C<SSL_verify> is true or if C<SSL_verify_mode> +is set in C<SSL_options>, it checks that a CA file is available. + +In scalar context, returns a boolean indicating if SSL is available. +In list context, returns the boolean and a (possibly multi-line) string of +errors indicating why SSL isn't available. + +=head2 connected + + $host = $http->connected; + ($host, $port) = $http->connected; + +Indicates if a connection to a peer is being kept alive, per the C<keep_alive> +option. + +In scalar context, returns the peer host and port, joined with a colon, or +C<undef> (if no peer is connected). +In list context, returns the peer host and port or an empty list (if no peer +is connected). + +B<Note>: This method cannot reliably be used to discover whether the remote +host has closed its end of the socket. + +=for Pod::Coverage SSL_options +agent +cookie_jar +default_headers +http_proxy +https_proxy +keep_alive +local_address +max_redirect +max_size +no_proxy +proxy +timeout +verify_SSL + +=head1 SSL SUPPORT + +Direct C<https> connections are supported only if L<IO::Socket::SSL> 1.56 or +greater and L<Net::SSLeay> 1.49 or greater are installed. An exception will be +thrown if new enough versions of these modules are not installed or if the SSL +encryption fails. You can also use C<HTTP::Tiny::can_ssl()> utility function +that returns boolean to see if the required modules are installed. + +An C<https> connection may be made via an C<http> proxy that supports the CONNECT +command (i.e. RFC 2817). You may not proxy C<https> via a proxy that itself +requires C<https> to communicate. + +SSL provides two distinct capabilities: + +=over 4 + +=item * + +Encrypted communication channel + +=item * + +Verification of server identity + +=back + +B<By default, HTTP::Tiny does not verify server identity>. + +Server identity verification is controversial and potentially tricky because it +depends on a (usually paid) third-party Certificate Authority (CA) trust model +to validate a certificate as legitimate. This discriminates against servers +with self-signed certificates or certificates signed by free, community-driven +CA's such as L<CAcert.org|http://cacert.org>. + +By default, HTTP::Tiny does not make any assumptions about your trust model, +threat level or risk tolerance. It just aims to give you an encrypted channel +when you need one. + +Setting the C<verify_SSL> attribute to a true value will make HTTP::Tiny verify +that an SSL connection has a valid SSL certificate corresponding to the host +name of the connection and that the SSL certificate has been verified by a CA. +Assuming you trust the CA, this will protect against a L<man-in-the-middle +attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>. If you are +concerned about security, you should enable this option. + +Certificate verification requires a file containing trusted CA certificates. + +If the environment variable C<SSL_CERT_FILE> is present, HTTP::Tiny +will try to find a CA certificate file in that location. + +If the L<Mozilla::CA> module is installed, HTTP::Tiny will use the CA file +included with it as a source of trusted CA's. (This means you trust Mozilla, +the author of Mozilla::CA, the CPAN mirror where you got Mozilla::CA, the +toolchain used to install it, and your operating system security, right?) + +If that module is not available, then HTTP::Tiny will search several +system-specific default locations for a CA certificate file: + +=over 4 + +=item * + +/etc/ssl/certs/ca-certificates.crt + +=item * + +/etc/pki/tls/certs/ca-bundle.crt + +=item * + +/etc/ssl/ca-bundle.pem + +=back + +An exception will be raised if C<verify_SSL> is true and no CA certificate file +is available. + +If you desire complete control over SSL connections, the C<SSL_options> attribute +lets you provide a hash reference that will be passed through to +C<IO::Socket::SSL::start_SSL()>, overriding any options set by HTTP::Tiny. For +example, to provide your own trusted CA file: + + SSL_options => { + SSL_ca_file => $file_path, + } + +The C<SSL_options> attribute could also be used for such things as providing a +client certificate for authentication to a server or controlling the choice of +cipher used for the SSL connection. See L<IO::Socket::SSL> documentation for +details. + +=head1 PROXY SUPPORT + +HTTP::Tiny can proxy both C<http> and C<https> requests. Only Basic proxy +authorization is supported and it must be provided as part of the proxy URL: +C<http://user:pass@proxy.example.com/>. + +HTTP::Tiny supports the following proxy environment variables: + +=over 4 + +=item * + +http_proxy or HTTP_PROXY + +=item * + +https_proxy or HTTPS_PROXY + +=item * + +all_proxy or ALL_PROXY + +=back + +If the C<REQUEST_METHOD> environment variable is set, then this might be a CGI +process and C<HTTP_PROXY> would be set from the C<Proxy:> header, which is a +security risk. If C<REQUEST_METHOD> is set, C<HTTP_PROXY> (the upper case +variant only) is ignored. + +Tunnelling C<https> over an C<http> proxy using the CONNECT method is +supported. If your proxy uses C<https> itself, you can not tunnel C<https> +over it. + +Be warned that proxying an C<https> connection opens you to the risk of a +man-in-the-middle attack by the proxy server. + +The C<no_proxy> environment variable is supported in the format of a +comma-separated list of domain extensions proxy should not be used for. + +Proxy arguments passed to C<new> will override their corresponding +environment variables. + +=head1 LIMITATIONS + +HTTP::Tiny is I<conditionally compliant> with the +L<HTTP/1.1 specifications|http://www.w3.org/Protocols/>: + +=over 4 + +=item * + +"Message Syntax and Routing" [RFC7230] + +=item * + +"Semantics and Content" [RFC7231] + +=item * + +"Conditional Requests" [RFC7232] + +=item * + +"Range Requests" [RFC7233] + +=item * + +"Caching" [RFC7234] + +=item * + +"Authentication" [RFC7235] + +=back + +It attempts to meet all "MUST" requirements of the specification, but does not +implement all "SHOULD" requirements. (Note: it was developed against the +earlier RFC 2616 specification and may not yet meet the revised RFC 7230-7235 +spec.) + +Some particular limitations of note include: + +=over + +=item * + +HTTP::Tiny focuses on correct transport. Users are responsible for ensuring +that user-defined headers and content are compliant with the HTTP/1.1 +specification. + +=item * + +Users must ensure that URLs are properly escaped for unsafe characters and that +international domain names are properly encoded to ASCII. See L<URI::Escape>, +L<URI::_punycode> and L<Net::IDN::Encode>. + +=item * + +Redirection is very strict against the specification. Redirection is only +automatic for response codes 301, 302, 307 and 308 if the request method is +'GET' or 'HEAD'. Response code 303 is always converted into a 'GET' +redirection, as mandated by the specification. There is no automatic support +for status 305 ("Use proxy") redirections. + +=item * + +There is no provision for delaying a request body using an C<Expect> header. +Unexpected C<1XX> responses are silently ignored as per the specification. + +=item * + +Only 'chunked' C<Transfer-Encoding> is supported. + +=item * + +There is no support for a Request-URI of '*' for the 'OPTIONS' request. + +=item * + +Headers mentioned in the RFCs and some other, well-known headers are +generated with their canonical case. Other headers are sent in the +case provided by the user. Except for control headers (which are sent first), +headers are sent in arbitrary order. + +=back + +Despite the limitations listed above, HTTP::Tiny is considered +feature-complete. New feature requests should be directed to +L<HTTP::Tiny::UA>. + +=head1 SEE ALSO + +=over 4 + +=item * + +L<HTTP::Tiny::UA> - Higher level UA features for HTTP::Tiny + +=item * + +L<HTTP::Thin> - HTTP::Tiny wrapper with L<HTTP::Request>/L<HTTP::Response> compatibility + +=item * + +L<HTTP::Tiny::Mech> - Wrap L<WWW::Mechanize> instance in HTTP::Tiny compatible interface + +=item * + +L<IO::Socket::IP> - Required for IPv6 support + +=item * + +L<IO::Socket::SSL> - Required for SSL support + +=item * + +L<LWP::UserAgent> - If HTTP::Tiny isn't enough for you, this is the "standard" way to do things + +=item * + +L<Mozilla::CA> - Required if you want to validate SSL certificates + +=item * + +L<Net::SSLeay> - Required for SSL support + +=back + +=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan + +=head1 SUPPORT + +=head2 Bugs / Feature Requests + +Please report any bugs or feature requests through the issue tracker +at L<https://github.com/chansen/p5-http-tiny/issues>. +You will be notified automatically of any progress on your issue. + +=head2 Source Code + +This is open source software. The code repository is available for +public review and contribution under the terms of the license. + +L<https://github.com/chansen/p5-http-tiny> + + git clone https://github.com/chansen/p5-http-tiny.git + +=head1 AUTHORS + +=over 4 + +=item * + +Christian Hansen <chansen@cpan.org> + +=item * + +David Golden <dagolden@cpan.org> + +=back + +=head1 CONTRIBUTORS + +=for stopwords Alan Gardner Alessandro Ghedini A. Sinan Unur Brad Gilbert brian m. carlson Chris Nehren Weyl Claes Jakobsson Clinton Gormley Craig Berry David Golden Mitchell Dean Pearce Edward Zborowski Felipe Gasper James Raspass Jeremy Mates Jess Robinson Karen Etheridge Lukas Eklund Martin J. Evans Martin-Louis Bright Mike Doherty Nicolas Rochelemagne Olaf Alders Olivier Mengué Petr Písař Serguei Trouchelle Shoichi Kaji SkyMarshal Sören Kornetzki Steve Grazzini Syohei YOSHIDA Tatsuhiko Miyagawa Tom Hukins Tony Cook + +=over 4 + +=item * + +Alan Gardner <gardner@pythian.com> + +=item * + +Alessandro Ghedini <al3xbio@gmail.com> + +=item * + +A. Sinan Unur <nanis@cpan.org> + +=item * + +Brad Gilbert <bgills@cpan.org> + +=item * + +brian m. carlson <sandals@crustytoothpaste.net> + +=item * + +Chris Nehren <apeiron@cpan.org> + +=item * + +Chris Weyl <cweyl@alumni.drew.edu> + +=item * + +Claes Jakobsson <claes@surfar.nu> + +=item * + +Clinton Gormley <clint@traveljury.com> + +=item * + +Craig A. Berry <craigberry@mac.com> + +=item * + +Craig Berry <cberry@cpan.org> + +=item * + +David Golden <xdg@xdg.me> + +=item * + +David Mitchell <davem@iabyn.com> + +=item * + +Dean Pearce <pearce@pythian.com> + +=item * + +Edward Zborowski <ed@rubensteintech.com> + +=item * + +Felipe Gasper <felipe@felipegasper.com> + +=item * + +James Raspass <jraspass@gmail.com> + +=item * + +Jeremy Mates <jmates@cpan.org> + +=item * + +Jess Robinson <castaway@desert-island.me.uk> + +=item * + +Karen Etheridge <ether@cpan.org> + +=item * + +Lukas Eklund <leklund@gmail.com> + +=item * + +Martin J. Evans <mjegh@ntlworld.com> + +=item * + +Martin-Louis Bright <mlbright@gmail.com> + +=item * + +Mike Doherty <doherty@cpan.org> + +=item * + +Nicolas Rochelemagne <rochelemagne@cpanel.net> + +=item * + +Olaf Alders <olaf@wundersolutions.com> + +=item * + +Olivier Mengué <dolmen@cpan.org> + +=item * + +Petr Písař <ppisar@redhat.com> + +=item * + +Serguei Trouchelle <stro@cpan.org> + +=item * + +Shoichi Kaji <skaji@cpan.org> + +=item * + +SkyMarshal <skymarshal1729@gmail.com> + +=item * + +Sören Kornetzki <soeren.kornetzki@delti.com> + +=item * + +Steve Grazzini <steve.grazzini@grantstreet.com> + +=item * + +Syohei YOSHIDA <syohex@gmail.com> + +=item * + +Tatsuhiko Miyagawa <miyagawa@bulknews.net> + +=item * + +Tom Hukins <tom@eborcom.com> + +=item * + +Tony Cook <tony@develop-help.com> + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Christian Hansen. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/I18N/Collate.pm b/data/miniconda3/lib/perl5/core_perl/I18N/Collate.pm new file mode 100644 index 0000000000000000000000000000000000000000..e080fe6eabc065a3b7f3f7a4b601b5485d963c41 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/I18N/Collate.pm @@ -0,0 +1,196 @@ +package I18N::Collate; + +use strict; +our $VERSION = '1.02'; + +=head1 NAME + +I18N::Collate - compare 8-bit scalar data according to the current locale + +=head1 SYNOPSIS + + use I18N::Collate; + setlocale(LC_COLLATE, 'locale-of-your-choice'); + $s1 = I18N::Collate->new("scalar_data_1"); + $s2 = I18N::Collate->new("scalar_data_2"); + +=head1 DESCRIPTION + + *** + + WARNING: starting from the Perl version 5.003_06 + the I18N::Collate interface for comparing 8-bit scalar data + according to the current locale + + HAS BEEN DEPRECATED + + That is, please do not use it anymore for any new applications + and please migrate the old applications away from it because its + functionality was integrated into the Perl core language in the + release 5.003_06. + + See the perllocale manual page for further information. + + *** + +This module provides you with objects that will collate +according to your national character set, provided that the +POSIX setlocale() function is supported on your system. + +You can compare $s1 and $s2 above with + + $s1 le $s2 + +to extract the data itself, you'll need a dereference: $$s1 + +This module uses POSIX::setlocale(). The basic collation conversion is +done by strxfrm() which terminates at NUL characters being a decent C +routine. collate_xfrm() handles embedded NUL characters gracefully. + +The available locales depend on your operating system; try whether +C<locale -a> shows them or man pages for "locale" or "nlsinfo" or the +direct approach C<ls /usr/lib/nls/loc> or C<ls /usr/lib/nls> or +C<ls /usr/lib/locale>. Not all the locales that your vendor supports +are necessarily installed: please consult your operating system's +documentation and possibly your local system administration. The +locale names are probably something like C<xx_XX.(ISO)?8859-N> or +C<xx_XX.(ISO)?8859N>, for example C<fr_CH.ISO8859-1> is the Swiss (CH) +variant of French (fr), ISO Latin (8859) 1 (-1) which is the Western +European character set. + +=cut + +# I18N::Collate.pm +# +# Author: Jarkko Hietaniemi <F<jhi@iki.fi>> +# Helsinki University of Technology, Finland +# +# Acks: Guy Decoux <F<decoux@moulon.inra.fr>> understood +# overloading magic much deeper than I and told +# how to cut the size of this code by more than half. +# (my first version did overload all of lt gt eq le ge cmp) +# +# Purpose: compare 8-bit scalar data according to the current locale +# +# Requirements: Perl5 POSIX::setlocale() and POSIX::strxfrm() +# +# Exports: setlocale 1) +# collate_xfrm 2) +# +# Overloads: cmp # 3) +# +# Usage: use I18N::Collate; +# setlocale(LC_COLLATE, 'locale-of-your-choice'); # 4) +# $s1 = I18N::Collate->("scalar_data_1"); +# $s2 = I18N::Collate->("scalar_data_2"); +# +# now you can compare $s1 and $s2: $s1 le $s2 +# to extract the data itself, you need to deref: $$s1 +# +# Notes: +# 1) this uses POSIX::setlocale +# 2) the basic collation conversion is done by strxfrm() which +# terminates at NUL characters being a decent C routine. +# collate_xfrm handles embedded NUL characters gracefully. +# 3) due to cmp and overload magic, lt le eq ge gt work also +# 4) the available locales depend on your operating system; +# try whether "locale -a" shows them or man pages for +# "locale" or "nlsinfo" work or the more direct +# approach "ls /usr/lib/nls/loc" or "ls /usr/lib/nls". +# Not all the locales that your vendor supports +# are necessarily installed: please consult your +# operating system's documentation. +# The locale names are probably something like +# 'xx_XX.(ISO)?8859-N' or 'xx_XX.(ISO)?8859N', +# for example 'fr_CH.ISO8859-1' is the Swiss (CH) +# variant of French (fr), ISO Latin (8859) 1 (-1) +# which is the Western European character set. +# +# Updated: 19961005 +# +# --- + +use POSIX qw(strxfrm LC_COLLATE); +use warnings::register; + +require Exporter; + +our @ISA = qw(Exporter); +our @EXPORT = qw(collate_xfrm setlocale LC_COLLATE); +our @EXPORT_OK = qw(); + +use overload qw( +fallback 1 +cmp collate_cmp +); + +our($LOCALE, $C); + +our $please_use_I18N_Collate_even_if_deprecated = 0; +sub new { + my $new = $_[1]; + + if (warnings::enabled() && $] >= 5.003_06) { + unless ($please_use_I18N_Collate_even_if_deprecated) { + warnings::warn <<___EOD___; +*** + + WARNING: starting from the Perl version 5.003_06 + the I18N::Collate interface for comparing 8-bit scalar data + according to the current locale + + HAS BEEN DEPRECATED + + That is, please do not use it anymore for any new applications + and please migrate the old applications away from it because its + functionality was integrated into the Perl core language in the + release 5.003_06. + + See the perllocale manual page for further information. + +*** +___EOD___ + $please_use_I18N_Collate_even_if_deprecated++; + } + } + + bless \$new; +} + +sub setlocale { + my ($category, $locale) = @_[0,1]; + + POSIX::setlocale($category, $locale) if (defined $category); + # the current $LOCALE + $LOCALE = $locale || $ENV{'LC_COLLATE'} || $ENV{'LC_ALL'} || ''; +} + +sub C { + my $s = ${$_[0]}; + + $C->{$LOCALE}->{$s} = collate_xfrm($s) + unless (defined $C->{$LOCALE}->{$s}); # cache when met + + $C->{$LOCALE}->{$s}; +} + +sub collate_xfrm { + my $s = $_[0]; + my $x = ''; + + for (split(/(\000+)/, $s)) { + $x .= (/^\000/) ? $_ : strxfrm("$_\000"); + } + + $x; +} + +sub collate_cmp { + &C($_[0]) cmp &C($_[1]); +} + +# init $LOCALE + +&I18N::Collate::setlocale(); + +1; # keep require happy diff --git a/data/miniconda3/lib/perl5/core_perl/I18N/LangTags.pm b/data/miniconda3/lib/perl5/core_perl/I18N/LangTags.pm new file mode 100644 index 0000000000000000000000000000000000000000..35751bce03a4a353f1a25454d1c6efc9d16d3762 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/I18N/LangTags.pm @@ -0,0 +1,887 @@ + +# Time-stamp: "2004-10-06 23:26:33 ADT" +# Sean M. Burke <sburke@cpan.org> + +require 5.000; +package I18N::LangTags; +use strict; +require Exporter; +our @ISA = qw(Exporter); +our @EXPORT = qw(); +our @EXPORT_OK = qw(is_language_tag same_language_tag + extract_language_tags super_languages + similarity_language_tag is_dialect_of + locale2language_tag alternate_language_tags + encode_language_tag panic_languages + implicate_supers + implicate_supers_strictly + ); +our %EXPORT_TAGS = ('ALL' => \@EXPORT_OK); + +our $VERSION = "0.44"; +our %Panic; + +sub uniq { my %seen; return grep(!($seen{$_}++), @_); } # a util function + + +=head1 NAME + +I18N::LangTags - functions for dealing with RFC3066-style language tags + +=head1 SYNOPSIS + + use I18N::LangTags(); + +...or specify whichever of those functions you want to import, like so: + + use I18N::LangTags qw(implicate_supers similarity_language_tag); + +All the exportable functions are listed below -- you're free to import +only some, or none at all. By default, none are imported. If you +say: + + use I18N::LangTags qw(:ALL) + +...then all are exported. (This saves you from having to use +something less obvious like C<use I18N::LangTags qw(/./)>.) + +If you don't import any of these functions, assume a C<&I18N::LangTags::> +in front of all the function names in the following examples. + +=head1 DESCRIPTION + +Language tags are a formalism, described in RFC 3066 (obsoleting +1766), for declaring what language form (language and possibly +dialect) a given chunk of information is in. + +This library provides functions for common tasks involving language +tags as they are needed in a variety of protocols and applications. + +Please see the "See Also" references for a thorough explanation +of how to correctly use language tags. + +=over + +=cut + +########################################################################### + +=item * the function is_language_tag($lang1) + +Returns true iff $lang1 is a formally valid language tag. + + is_language_tag("fr") is TRUE + is_language_tag("x-jicarilla") is FALSE + (Subtags can be 8 chars long at most -- 'jicarilla' is 9) + + is_language_tag("sgn-US") is TRUE + (That's American Sign Language) + + is_language_tag("i-Klikitat") is TRUE + (True without regard to the fact noone has actually + registered Klikitat -- it's a formally valid tag) + + is_language_tag("fr-patois") is TRUE + (Formally valid -- altho descriptively weak!) + + is_language_tag("Spanish") is FALSE + is_language_tag("french-patois") is FALSE + (No good -- first subtag has to match + /^([xXiI]|[a-zA-Z]{2,3})$/ -- see RFC3066) + + is_language_tag("x-borg-prot2532") is TRUE + (Yes, subtags can contain digits, as of RFC3066) + +=cut + +sub is_language_tag { + + ## Changes in the language tagging standards may have to be reflected here. + + my($tag) = lc($_[0]); + + return 0 if $tag eq "i" or $tag eq "x"; + # Bad degenerate cases that the following + # regexp would erroneously let pass + + return $tag =~ + /^(?: # First subtag + [xi] | [a-z]{2,3} + ) + (?: # Subtags thereafter + - # separator + [a-z0-9]{1,8} # subtag + )* + $/xs ? 1 : 0; +} + +########################################################################### + +=item * the function extract_language_tags($whatever) + +Returns a list of whatever looks like formally valid language tags +in $whatever. Not very smart, so don't get too creative with +what you want to feed it. + + extract_language_tags("fr, fr-ca, i-mingo") + returns: ('fr', 'fr-ca', 'i-mingo') + + extract_language_tags("It's like this: I'm in fr -- French!") + returns: ('It', 'in', 'fr') + (So don't just feed it any old thing.) + +The output is untainted. If you don't know what tainting is, +don't worry about it. + +=cut + +sub extract_language_tags { + + ## Changes in the language tagging standards may have to be reflected here. + + my($text) = + $_[0] =~ m/(.+)/ # to make for an untainted result + ? $1 : '' + ; + + return grep(!m/^[ixIX]$/s, # 'i' and 'x' aren't good tags + $text =~ + m/ + \b + (?: # First subtag + [iIxX] | [a-zA-Z]{2,3} + ) + (?: # Subtags thereafter + - # separator + [a-zA-Z0-9]{1,8} # subtag + )* + \b + /xsg + ); +} + +########################################################################### + +=item * the function same_language_tag($lang1, $lang2) + +Returns true iff $lang1 and $lang2 are acceptable variant tags +representing the same language-form. + + same_language_tag('x-kadara', 'i-kadara') is TRUE + (The x/i- alternation doesn't matter) + same_language_tag('X-KADARA', 'i-kadara') is TRUE + (...and neither does case) + same_language_tag('en', 'en-US') is FALSE + (all-English is not the SAME as US English) + same_language_tag('x-kadara', 'x-kadar') is FALSE + (these are totally unrelated tags) + same_language_tag('no-bok', 'nb') is TRUE + (no-bok is a legacy tag for nb (Norwegian Bokmal)) + +C<same_language_tag> works by just seeing whether +C<encode_language_tag($lang1)> is the same as +C<encode_language_tag($lang2)>. + +(Yes, I know this function is named a bit oddly. Call it historic +reasons.) + +=cut + +sub same_language_tag { + my $el1 = &encode_language_tag($_[0]); + return 0 unless defined $el1; + # this avoids the problem of + # encode_language_tag($lang1) eq and encode_language_tag($lang2) + # being true if $lang1 and $lang2 are both undef + + return $el1 eq &encode_language_tag($_[1]) ? 1 : 0; +} + +########################################################################### + +=item * the function similarity_language_tag($lang1, $lang2) + +Returns an integer representing the degree of similarity between +tags $lang1 and $lang2 (the order of which does not matter), where +similarity is the number of common elements on the left, +without regard to case and to x/i- alternation. + + similarity_language_tag('fr', 'fr-ca') is 1 + (one element in common) + similarity_language_tag('fr-ca', 'fr-FR') is 1 + (one element in common) + + similarity_language_tag('fr-CA-joual', + 'fr-CA-PEI') is 2 + similarity_language_tag('fr-CA-joual', 'fr-CA') is 2 + (two elements in common) + + similarity_language_tag('x-kadara', 'i-kadara') is 1 + (x/i- doesn't matter) + + similarity_language_tag('en', 'x-kadar') is 0 + similarity_language_tag('x-kadara', 'x-kadar') is 0 + (unrelated tags -- no similarity) + + similarity_language_tag('i-cree-syllabic', + 'i-cherokee-syllabic') is 0 + (no B<leftmost> elements in common!) + +=cut + +sub similarity_language_tag { + my $lang1 = &encode_language_tag($_[0]); + my $lang2 = &encode_language_tag($_[1]); + # And encode_language_tag takes care of the whole + # no-nyn==nn, i-hakka==zh-hakka, etc, things + + # NB: (i-sil-...)? (i-sgn-...)? + + return undef if !defined($lang1) and !defined($lang2); + return 0 if !defined($lang1) or !defined($lang2); + + my @l1_subtags = split('-', $lang1); + my @l2_subtags = split('-', $lang2); + my $similarity = 0; + + while(@l1_subtags and @l2_subtags) { + if(shift(@l1_subtags) eq shift(@l2_subtags)) { + ++$similarity; + } else { + last; + } + } + return $similarity; +} + +########################################################################### + +=item * the function is_dialect_of($lang1, $lang2) + +Returns true iff language tag $lang1 represents a subform of +language tag $lang2. + +B<Get the order right! It doesn't work the other way around!> + + is_dialect_of('en-US', 'en') is TRUE + (American English IS a dialect of all-English) + + is_dialect_of('fr-CA-joual', 'fr-CA') is TRUE + is_dialect_of('fr-CA-joual', 'fr') is TRUE + (Joual is a dialect of (a dialect of) French) + + is_dialect_of('en', 'en-US') is FALSE + (all-English is a NOT dialect of American English) + + is_dialect_of('fr', 'en-CA') is FALSE + + is_dialect_of('en', 'en' ) is TRUE + is_dialect_of('en-US', 'en-US') is TRUE + (B<Note:> these are degenerate cases) + + is_dialect_of('i-mingo-tom', 'x-Mingo') is TRUE + (the x/i thing doesn't matter, nor does case) + + is_dialect_of('nn', 'no') is TRUE + (because 'nn' (New Norse) is aliased to 'no-nyn', + as a special legacy case, and 'no-nyn' is a + subform of 'no' (Norwegian)) + +=cut + +sub is_dialect_of { + + my $lang1 = &encode_language_tag($_[0]); + my $lang2 = &encode_language_tag($_[1]); + + return undef if !defined($lang1) and !defined($lang2); + return 0 if !defined($lang1) or !defined($lang2); + + return 1 if $lang1 eq $lang2; + return 0 if length($lang1) < length($lang2); + + $lang1 .= '-'; + $lang2 .= '-'; + return + (substr($lang1, 0, length($lang2)) eq $lang2) ? 1 : 0; +} + +########################################################################### + +=item * the function super_languages($lang1) + +Returns a list of language tags that are superordinate tags to $lang1 +-- it gets this by removing subtags from the end of $lang1 until +nothing (or just "i" or "x") is left. + + super_languages("fr-CA-joual") is ("fr-CA", "fr") + + super_languages("en-AU") is ("en") + + super_languages("en") is empty-list, () + + super_languages("i-cherokee") is empty-list, () + ...not ("i"), which would be illegal as well as pointless. + +If $lang1 is not a valid language tag, returns empty-list in +a list context, undef in a scalar context. + +A notable and rather unavoidable problem with this method: +"x-mingo-tom" has an "x" because the whole tag isn't an +IANA-registered tag -- but super_languages('x-mingo-tom') is +('x-mingo') -- which isn't really right, since 'i-mingo' is +registered. But this module has no way of knowing that. (But note +that same_language_tag('x-mingo', 'i-mingo') is TRUE.) + +More importantly, you assume I<at your peril> that superordinates of +$lang1 are mutually intelligible with $lang1. Consider this +carefully. + +=cut + +sub super_languages { + my $lang1 = $_[0]; + return() unless defined($lang1) && &is_language_tag($lang1); + + # a hack for those annoying new (2001) tags: + $lang1 =~ s/^nb\b/no-bok/i; # yes, backwards + $lang1 =~ s/^nn\b/no-nyn/i; # yes, backwards + $lang1 =~ s/^[ix](-hakka\b)/zh$1/i; # goes the right way + # i-hakka-bork-bjork-bjark => zh-hakka-bork-bjork-bjark + + my @l1_subtags = split('-', $lang1); + + ## Changes in the language tagging standards may have to be reflected here. + + # NB: (i-sil-...)? + + my @supers = (); + foreach my $bit (@l1_subtags) { + push @supers, + scalar(@supers) ? ($supers[-1] . '-' . $bit) : $bit; + } + pop @supers if @supers; + shift @supers if @supers && $supers[0] =~ m<^[iIxX]$>s; + return reverse @supers; +} + +########################################################################### + +=item * the function locale2language_tag($locale_identifier) + +This takes a locale name (like "en", "en_US", or "en_US.ISO8859-1") +and maps it to a language tag. If it's not mappable (as with, +notably, "C" and "POSIX"), this returns empty-list in a list context, +or undef in a scalar context. + + locale2language_tag("en") is "en" + + locale2language_tag("en_US") is "en-US" + + locale2language_tag("en_US.ISO8859-1") is "en-US" + + locale2language_tag("C") is undef or () + + locale2language_tag("POSIX") is undef or () + + locale2language_tag("POSIX") is undef or () + +I'm not totally sure that locale names map satisfactorily to language +tags. Think REAL hard about how you use this. YOU HAVE BEEN WARNED. + +The output is untainted. If you don't know what tainting is, +don't worry about it. + +=cut + +sub locale2language_tag { + my $lang = + $_[0] =~ m/(.+)/ # to make for an untainted result + ? $1 : '' + ; + + return $lang if &is_language_tag($lang); # like "en" + + $lang =~ tr<_><->; # "en_US" -> en-US + $lang =~ s<(?:[\.\@][-_a-zA-Z0-9]+)+$><>s; # "en_US.ISO8859-1" -> en-US + # it_IT.utf8@euro => it-IT + + return $lang if &is_language_tag($lang); + + return; +} + +########################################################################### + +=item * the function encode_language_tag($lang1) + +This function, if given a language tag, returns an encoding of it such +that: + +* tags representing different languages never get the same encoding. + +* tags representing the same language always get the same encoding. + +* an encoding of a formally valid language tag always is a string +value that is defined, has length, and is true if considered as a +boolean. + +Note that the encoding itself is B<not> a formally valid language tag. +Note also that you cannot, currently, go from an encoding back to a +language tag that it's an encoding of. + +Note also that you B<must> consider the encoded value as atomic; i.e., +you should not consider it as anything but an opaque, unanalysable +string value. (The internals of the encoding method may change in +future versions, as the language tagging standard changes over time.) + +C<encode_language_tag> returns undef if given anything other than a +formally valid language tag. + +The reason C<encode_language_tag> exists is because different language +tags may represent the same language; this is normally treatable with +C<same_language_tag>, but consider this situation: + +You have a data file that expresses greetings in different languages. +Its format is "[language tag]=[how to say 'Hello']", like: + + en-US=Hiho + fr=Bonjour + i-mingo=Hau' + +And suppose you write a program that reads that file and then runs as +a daemon, answering client requests that specify a language tag and +then expect the string that says how to greet in that language. So an +interaction looks like: + + greeting-client asks: fr + greeting-server answers: Bonjour + +So far so good. But suppose the way you're implementing this is: + + my %greetings; + die unless open(IN, "<", "in.dat"); + while(<IN>) { + chomp; + next unless /^([^=]+)=(.+)/s; + my($lang, $expr) = ($1, $2); + $greetings{$lang} = $expr; + } + close(IN); + +at which point %greetings has the contents: + + "en-US" => "Hiho" + "fr" => "Bonjour" + "i-mingo" => "Hau'" + +And suppose then that you answer client requests for language $wanted +by just looking up $greetings{$wanted}. + +If the client asks for "fr", that will look up successfully in +%greetings, to the value "Bonjour". And if the client asks for +"i-mingo", that will look up successfully in %greetings, to the value +"Hau'". + +But if the client asks for "i-Mingo" or "x-mingo", or "Fr", then the +lookup in %greetings fails. That's the Wrong Thing. + +You could instead do lookups on $wanted with: + + use I18N::LangTags qw(same_language_tag); + my $response = ''; + foreach my $l2 (keys %greetings) { + if(same_language_tag($wanted, $l2)) { + $response = $greetings{$l2}; + last; + } + } + +But that's rather inefficient. A better way to do it is to start your +program with: + + use I18N::LangTags qw(encode_language_tag); + my %greetings; + die unless open(IN, "<", "in.dat"); + while(<IN>) { + chomp; + next unless /^([^=]+)=(.+)/s; + my($lang, $expr) = ($1, $2); + $greetings{ + encode_language_tag($lang) + } = $expr; + } + close(IN); + +and then just answer client requests for language $wanted by just +looking up + + $greetings{encode_language_tag($wanted)} + +And that does the Right Thing. + +=cut + +sub encode_language_tag { + # Only similarity_language_tag() is allowed to analyse encodings! + + ## Changes in the language tagging standards may have to be reflected here. + + my($tag) = $_[0] || return undef; + return undef unless &is_language_tag($tag); + + # For the moment, these legacy variances are few enough that + # we can just handle them here with regexps. + $tag =~ s/^iw\b/he/i; # Hebrew + $tag =~ s/^in\b/id/i; # Indonesian + $tag =~ s/^cre\b/cr/i; # Cree + $tag =~ s/^jw\b/jv/i; # Javanese + $tag =~ s/^[ix]-lux\b/lb/i; # Luxemburger + $tag =~ s/^[ix]-navajo\b/nv/i; # Navajo + $tag =~ s/^ji\b/yi/i; # Yiddish + # SMB 2003 -- Hm. There's a bunch of new XXX->YY variances now, + # but maybe they're all so obscure I can ignore them. "Obscure" + # meaning either that the language is obscure, and/or that the + # XXX form was extant so briefly that it's unlikely it was ever + # used. I hope. + # + # These go FROM the simplex to complex form, to get + # similarity-comparison right. And that's okay, since + # similarity_language_tag is the only thing that + # analyzes our output. + $tag =~ s/^[ix]-hakka\b/zh-hakka/i; # Hakka + $tag =~ s/^nb\b/no-bok/i; # BACKWARDS for Bokmal + $tag =~ s/^nn\b/no-nyn/i; # BACKWARDS for Nynorsk + + $tag =~ s/^[xiXI]-//s; + # Just lop off any leading "x/i-" + + return "~" . uc($tag); +} + +#-------------------------------------------------------------------------- + +=item * the function alternate_language_tags($lang1) + +This function, if given a language tag, returns all language tags that +are alternate forms of this language tag. (I.e., tags which refer to +the same language.) This is meant to handle legacy tags caused by +the minor changes in language tag standards over the years; and +the x-/i- alternation is also dealt with. + +Note that this function does I<not> try to equate new (and never-used, +and unusable) +ISO639-2 three-letter tags to old (and still in use) ISO639-1 +two-letter equivalents -- like "ara" -> "ar" -- because +"ara" has I<never> been in use as an Internet language tag, +and RFC 3066 stipulates that it never should be, since a shorter +tag ("ar") exists. + +Examples: + + alternate_language_tags('no-bok') is ('nb') + alternate_language_tags('nb') is ('no-bok') + alternate_language_tags('he') is ('iw') + alternate_language_tags('iw') is ('he') + alternate_language_tags('i-hakka') is ('zh-hakka', 'x-hakka') + alternate_language_tags('zh-hakka') is ('i-hakka', 'x-hakka') + alternate_language_tags('en') is () + alternate_language_tags('x-mingo-tom') is ('i-mingo-tom') + alternate_language_tags('x-klikitat') is ('i-klikitat') + alternate_language_tags('i-klikitat') is ('x-klikitat') + +This function returns empty-list if given anything other than a formally +valid language tag. + +=cut + +my %alt = qw( i x x i I X X I ); +sub alternate_language_tags { + my $tag = $_[0]; + return() unless &is_language_tag($tag); + + my @em; # push 'em real goood! + + # For the moment, these legacy variances are few enough that + # we can just handle them here with regexps. + + if( $tag =~ m/^[ix]-hakka\b(.*)/i) {push @em, "zh-hakka$1"; + } elsif($tag =~ m/^zh-hakka\b(.*)/i) { push @em, "x-hakka$1", "i-hakka$1"; + + } elsif($tag =~ m/^he\b(.*)/i) { push @em, "iw$1"; + } elsif($tag =~ m/^iw\b(.*)/i) { push @em, "he$1"; + + } elsif($tag =~ m/^in\b(.*)/i) { push @em, "id$1"; + } elsif($tag =~ m/^id\b(.*)/i) { push @em, "in$1"; + + } elsif($tag =~ m/^[ix]-lux\b(.*)/i) { push @em, "lb$1"; + } elsif($tag =~ m/^lb\b(.*)/i) { push @em, "i-lux$1", "x-lux$1"; + + } elsif($tag =~ m/^[ix]-navajo\b(.*)/i) { push @em, "nv$1"; + } elsif($tag =~ m/^nv\b(.*)/i) { push @em, "i-navajo$1", "x-navajo$1"; + + } elsif($tag =~ m/^yi\b(.*)/i) { push @em, "ji$1"; + } elsif($tag =~ m/^ji\b(.*)/i) { push @em, "yi$1"; + + } elsif($tag =~ m/^nb\b(.*)/i) { push @em, "no-bok$1"; + } elsif($tag =~ m/^no-bok\b(.*)/i) { push @em, "nb$1"; + + } elsif($tag =~ m/^nn\b(.*)/i) { push @em, "no-nyn$1"; + } elsif($tag =~ m/^no-nyn\b(.*)/i) { push @em, "nn$1"; + } + + push @em, $alt{$1} . $2 if $tag =~ /^([XIxi])(-.+)/; + return @em; +} + +########################################################################### + +{ + # Init %Panic... + + my @panic = ( # MUST all be lowercase! + # Only large ("national") languages make it in this list. + # If you, as a user, are so bizarre that the /only/ language + # you claim to accept is Galician, then no, we won't do you + # the favor of providing Catalan as a panic-fallback for + # you. Because if I start trying to add "little languages" in + # here, I'll just go crazy. + + # Scandinavian lgs. All based on opinion and hearsay. + 'sv' => [qw(nb no da nn)], + 'da' => [qw(nb no sv nn)], # I guess + [qw(no nn nb)], [qw(no nn nb sv da)], + 'is' => [qw(da sv no nb nn)], + 'fo' => [qw(da is no nb nn sv)], # I guess + + # I think this is about the extent of tolerable intelligibility + # among large modern Romance languages. + 'pt' => [qw(es ca it fr)], # Portuguese, Spanish, Catalan, Italian, French + 'ca' => [qw(es pt it fr)], + 'es' => [qw(ca it fr pt)], + 'it' => [qw(es fr ca pt)], + 'fr' => [qw(es it ca pt)], + + # Also assume that speakers of the main Indian languages prefer + # to read/hear Hindi over English + [qw( + as bn gu kn ks kok ml mni mr ne or pa sa sd te ta ur + )] => 'hi', + # Assamese, Bengali, Gujarati, [Hindi,] Kannada (Kanarese), Kashmiri, + # Konkani, Malayalam, Meithei (Manipuri), Marathi, Nepali, Oriya, + # Punjabi, Sanskrit, Sindhi, Telugu, Tamil, and Urdu. + 'hi' => [qw(bn pa as or)], + # I welcome finer data for the other Indian languages. + # E.g., what should Oriya's list be, besides just Hindi? + + # And the panic languages for English is, of course, nil! + + # My guesses at Slavic intelligibility: + ([qw(ru be uk)]) x 2, # Russian, Belarusian, Ukranian + ([qw(sr hr bs)]) x 2, # Serbian, Croatian, Bosnian + 'cs' => 'sk', 'sk' => 'cs', # Czech + Slovak + + 'ms' => 'id', 'id' => 'ms', # Malay + Indonesian + + 'et' => 'fi', 'fi' => 'et', # Estonian + Finnish + + #?? 'lo' => 'th', 'th' => 'lo', # Lao + Thai + + ); + my($k,$v); + while(@panic) { + ($k,$v) = splice(@panic,0,2); + foreach my $k (ref($k) ? @$k : $k) { + foreach my $v (ref($v) ? @$v : $v) { + push @{$Panic{$k} ||= []}, $v unless $k eq $v; + } + } + } +} + +=item * the function @langs = panic_languages(@accept_languages) + +This function takes a list of 0 or more language +tags that constitute a given user's Accept-Language list, and +returns a list of tags for I<other> (non-super) +languages that are probably acceptable to the user, to be +used I<if all else fails>. + +For example, if a user accepts only 'ca' (Catalan) and +'es' (Spanish), and the documents/interfaces you have +available are just in German, Italian, and Chinese, then +the user will most likely want the Italian one (and not +the Chinese or German one!), instead of getting +nothing. So C<panic_languages('ca', 'es')> returns +a list containing 'it' (Italian). + +English ('en') is I<always> in the return list, but +whether it's at the very end or not depends +on the input languages. This function works by consulting +an internal table that stipulates what common +languages are "close" to each other. + +A useful construct you might consider using is: + + @fallbacks = super_languages(@accept_languages); + push @fallbacks, panic_languages( + @accept_languages, @fallbacks, + ); + +=cut + +sub panic_languages { + # When in panic or in doubt, run in circles, scream, and shout! + my(@out, %seen); + foreach my $t (@_) { + next unless $t; + next if $seen{$t}++; # so we don't return it or hit it again + # push @out, super_languages($t); # nah, keep that separate + push @out, @{ $Panic{lc $t} || next }; + } + return grep !$seen{$_}++, @out, 'en'; +} + +#--------------------------------------------------------------------------- +#--------------------------------------------------------------------------- + +=item * the function implicate_supers( ...languages... ) + +This takes a list of strings (which are presumed to be language-tags; +strings that aren't, are ignored); and after each one, this function +inserts super-ordinate forms that don't already appear in the list. +The original list, plus these insertions, is returned. + +In other words, it takes this: + + pt-br de-DE en-US fr pt-br-janeiro + +and returns this: + + pt-br pt de-DE de en-US en fr pt-br-janeiro + +This function is most useful in the idiom + + implicate_supers( I18N::LangTags::Detect::detect() ); + +(See L<I18N::LangTags::Detect>.) + + +=item * the function implicate_supers_strictly( ...languages... ) + +This works like C<implicate_supers> except that the implicated +forms are added to the end of the return list. + +In other words, implicate_supers_strictly takes a list of strings +(which are presumed to be language-tags; strings that aren't, are +ignored) and after the whole given list, it inserts the super-ordinate forms +of all given tags, minus any tags that already appear in the input list. + +In other words, it takes this: + + pt-br de-DE en-US fr pt-br-janeiro + +and returns this: + + pt-br de-DE en-US fr pt-br-janeiro pt de en + +The reason this function has "_strictly" in its name is that when +you're processing an Accept-Language list according to the RFCs, if +you interpret the RFCs quite strictly, then you would use +implicate_supers_strictly, but for normal use (i.e., common-sense use, +as far as I'm concerned) you'd use implicate_supers. + +=cut + +sub implicate_supers { + my @languages = grep is_language_tag($_), @_; + my %seen_encoded; + foreach my $lang (@languages) { + $seen_encoded{ I18N::LangTags::encode_language_tag($lang) } = 1 + } + + my(@output_languages); + foreach my $lang (@languages) { + push @output_languages, $lang; + foreach my $s ( I18N::LangTags::super_languages($lang) ) { + # Note that super_languages returns the longest first. + last if $seen_encoded{ I18N::LangTags::encode_language_tag($s) }; + push @output_languages, $s; + } + } + return uniq( @output_languages ); + +} + +sub implicate_supers_strictly { + my @tags = grep is_language_tag($_), @_; + return uniq( @_, map super_languages($_), @_ ); +} + + + +########################################################################### +1; +__END__ + +=back + +=head1 ABOUT LOWERCASING + +I've considered making all the above functions that output language +tags return all those tags strictly in lowercase. Having all your +language tags in lowercase does make some things easier. But you +might as well just lowercase as you like, or call +C<encode_language_tag($lang1)> where appropriate. + +=head1 ABOUT UNICODE PLAINTEXT LANGUAGE TAGS + +In some future version of I18N::LangTags, I plan to include support +for RFC2482-style language tags -- which are basically just normal +language tags with their ASCII characters shifted into Plane 14. + +=head1 SEE ALSO + +* L<I18N::LangTags::List|I18N::LangTags::List> + +* RFC 3066, C<L<http://www.ietf.org/rfc/rfc3066.txt>>, "Tags for the +Identification of Languages". (Obsoletes RFC 1766) + +* RFC 2277, C<L<http://www.ietf.org/rfc/rfc2277.txt>>, "IETF Policy on +Character Sets and Languages". + +* RFC 2231, C<L<http://www.ietf.org/rfc/rfc2231.txt>>, "MIME Parameter +Value and Encoded Word Extensions: Character Sets, Languages, and +Continuations". + +* RFC 2482, C<L<http://www.ietf.org/rfc/rfc2482.txt>>, +"Language Tagging in Unicode Plain Text". + +* Locale::Codes, in +C<L<http://www.perl.com/CPAN/modules/by-module/Locale/>> + +* ISO 639-2, "Codes for the representation of names of languages", +including two-letter and three-letter codes, +C<L<http://www.loc.gov/standards/iso639-2/php/code_list.php>> + +* The IANA list of registered languages (hopefully up-to-date), +C<L<http://www.iana.org/assignments/language-tags>> + +=head1 COPYRIGHT + +Copyright (c) 1998+ Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +The programs and documentation in this dist are distributed in +the hope that they will be useful, but without any warranty; without +even the implied warranty of merchantability or fitness for a +particular purpose. + +=head1 AUTHOR + +Sean M. Burke C<sburke@cpan.org> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/IO/Zlib.pm b/data/miniconda3/lib/perl5/core_perl/IO/Zlib.pm new file mode 100644 index 0000000000000000000000000000000000000000..55534b4f374067c45476ef37ba2fcd72408fc779 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/IO/Zlib.pm @@ -0,0 +1,652 @@ +# IO::Zlib.pm +# +# Copyright (c) 1998-2004 Tom Hughes <tom@compton.nu>. +# All rights reserved. This program is free software; you can redistribute +# it and/or modify it under the same terms as Perl itself. + +package IO::Zlib; + +$VERSION = "1.10"; + +=head1 NAME + +IO::Zlib - IO:: style interface to L<Compress::Zlib> + +=head1 SYNOPSIS + +With any version of Perl 5 you can use the basic OO interface: + + use IO::Zlib; + + $fh = new IO::Zlib; + if ($fh->open("file.gz", "rb")) { + print <$fh>; + $fh->close; + } + + $fh = IO::Zlib->new("file.gz", "wb9"); + if (defined $fh) { + print $fh "bar\n"; + $fh->close; + } + + $fh = IO::Zlib->new("file.gz", "rb"); + if (defined $fh) { + print <$fh>; + undef $fh; # automatically closes the file + } + +With Perl 5.004 you can also use the TIEHANDLE interface to access +compressed files just like ordinary files: + + use IO::Zlib; + + tie *FILE, 'IO::Zlib', "file.gz", "wb"; + print FILE "line 1\nline2\n"; + + tie *FILE, 'IO::Zlib', "file.gz", "rb"; + while (<FILE>) { print "LINE: ", $_ }; + +=head1 DESCRIPTION + +C<IO::Zlib> provides an IO:: style interface to L<Compress::Zlib> and +hence to gzip/zlib compressed files. It provides many of the same methods +as the L<IO::Handle> interface. + +Starting from IO::Zlib version 1.02, IO::Zlib can also use an +external F<gzip> command. The default behaviour is to try to use +an external F<gzip> if no C<Compress::Zlib> can be loaded, unless +explicitly disabled by + + use IO::Zlib qw(:gzip_external 0); + +If explicitly enabled by + + use IO::Zlib qw(:gzip_external 1); + +then the external F<gzip> is used B<instead> of C<Compress::Zlib>. + +=head1 CONSTRUCTOR + +=over 4 + +=item new ( [ARGS] ) + +Creates an C<IO::Zlib> object. If it receives any parameters, they are +passed to the method C<open>; if the open fails, the object is destroyed. +Otherwise, it is returned to the caller. + +=back + +=head1 OBJECT METHODS + +=over 4 + +=item open ( FILENAME, MODE ) + +C<open> takes two arguments. The first is the name of the file to open +and the second is the open mode. The mode can be anything acceptable to +L<Compress::Zlib> and by extension anything acceptable to I<zlib> (that +basically means POSIX fopen() style mode strings plus an optional number +to indicate the compression level). + +=item opened + +Returns true if the object currently refers to a opened file. + +=item close + +Close the file associated with the object and disassociate +the file from the handle. +Done automatically on destroy. + +=item getc + +Return the next character from the file, or undef if none remain. + +=item getline + +Return the next line from the file, or undef on end of string. +Can safely be called in an array context. +Currently ignores $/ ($INPUT_RECORD_SEPARATOR or $RS when L<English> +is in use) and treats lines as delimited by "\n". + +=item getlines + +Get all remaining lines from the file. +It will croak() if accidentally called in a scalar context. + +=item print ( ARGS... ) + +Print ARGS to the file. + +=item read ( BUF, NBYTES, [OFFSET] ) + +Read some bytes from the file. +Returns the number of bytes actually read, 0 on end-of-file, undef on error. + +=item eof + +Returns true if the handle is currently positioned at end of file? + +=item seek ( OFFSET, WHENCE ) + +Seek to a given position in the stream. +Not yet supported. + +=item tell + +Return the current position in the stream, as a numeric offset. +Not yet supported. + +=item setpos ( POS ) + +Set the current position, using the opaque value returned by C<getpos()>. +Not yet supported. + +=item getpos ( POS ) + +Return the current position in the string, as an opaque object. +Not yet supported. + +=back + +=head1 USING THE EXTERNAL GZIP + +If the external F<gzip> is used, the following C<open>s are used: + + open(FH, "gzip -dc $filename |") # for read opens + open(FH, " | gzip > $filename") # for write opens + +You can modify the 'commands' for example to hardwire +an absolute path by e.g. + + use IO::Zlib ':gzip_read_open' => '/some/where/gunzip -c %s |'; + use IO::Zlib ':gzip_write_open' => '| /some/where/gzip.exe > %s'; + +The C<%s> is expanded to be the filename (C<sprintf> is used, so be +careful to escape any other C<%> signs). The 'commands' are checked +for sanity - they must contain the C<%s>, and the read open must end +with the pipe sign, and the write open must begin with the pipe sign. + +=head1 CLASS METHODS + +=over 4 + +=item has_Compress_Zlib + +Returns true if C<Compress::Zlib> is available. Note that this does +not mean that C<Compress::Zlib> is being used: see L</gzip_external> +and L<gzip_used>. + +=item gzip_external + +Undef if an external F<gzip> B<can> be used if C<Compress::Zlib> is +not available (see L</has_Compress_Zlib>), true if an external F<gzip> +is explicitly used, false if an external F<gzip> must not be used. +See L</gzip_used>. + +=item gzip_used + +True if an external F<gzip> is being used, false if not. + +=item gzip_read_open + +Return the 'command' being used for opening a file for reading using an +external F<gzip>. + +=item gzip_write_open + +Return the 'command' being used for opening a file for writing using an +external F<gzip>. + +=back + +=head1 DIAGNOSTICS + +=over 4 + +=item IO::Zlib::getlines: must be called in list context + +If you want read lines, you must read in list context. + +=item IO::Zlib::gzopen_external: mode '...' is illegal + +Use only modes 'rb' or 'wb' or /wb[1-9]/. + +=item IO::Zlib::import: '...' is illegal + +The known import symbols are the C<:gzip_external>, C<:gzip_read_open>, +and C<:gzip_write_open>. Anything else is not recognized. + +=item IO::Zlib::import: ':gzip_external' requires an argument + +The C<:gzip_external> requires one boolean argument. + +=item IO::Zlib::import: 'gzip_read_open' requires an argument + +The C<:gzip_external> requires one string argument. + +=item IO::Zlib::import: 'gzip_read' '...' is illegal + +The C<:gzip_read_open> argument must end with the pipe sign (|) +and have the C<%s> for the filename. See L</"USING THE EXTERNAL GZIP">. + +=item IO::Zlib::import: 'gzip_write_open' requires an argument + +The C<:gzip_external> requires one string argument. + +=item IO::Zlib::import: 'gzip_write_open' '...' is illegal + +The C<:gzip_write_open> argument must begin with the pipe sign (|) +and have the C<%s> for the filename. An output redirect (>) is also +often a good idea, depending on your operating system shell syntax. +See L</"USING THE EXTERNAL GZIP">. + +=item IO::Zlib::import: no Compress::Zlib and no external gzip + +Given that we failed to load C<Compress::Zlib> and that the use of + an external F<gzip> was disabled, IO::Zlib has not much chance of working. + +=item IO::Zlib::open: needs a filename + +No filename, no open. + +=item IO::Zlib::READ: NBYTES must be specified + +We must know how much to read. + +=item IO::Zlib::WRITE: too long LENGTH + +The LENGTH must be less than or equal to the buffer size. + +=back + +=head1 SEE ALSO + +L<perlfunc>, +L<perlop/"I/O Operators">, +L<IO::Handle>, +L<Compress::Zlib> + +=head1 HISTORY + +Created by Tom Hughes E<lt>F<tom@compton.nu>E<gt>. + +Support for external gzip added by Jarkko Hietaniemi E<lt>F<jhi@iki.fi>E<gt>. + +=head1 COPYRIGHT + +Copyright (c) 1998-2004 Tom Hughes E<lt>F<tom@compton.nu>E<gt>. +All rights reserved. This program is free software; you can redistribute +it and/or modify it under the same terms as Perl itself. + +=cut + +require 5.006; + +use strict; +use vars qw($VERSION $AUTOLOAD @ISA); + +use Carp; +use Fcntl qw(SEEK_SET); + +my $has_Compress_Zlib; +my $aliased; + +sub has_Compress_Zlib { + $has_Compress_Zlib; +} + +BEGIN { + eval { require Compress::Zlib }; + $has_Compress_Zlib = $@ || $Compress::Zlib::VERSION < 2.000 ? 0 : 1; +} + +use Symbol; +use Tie::Handle; + +# These might use some $^O logic. +my $gzip_read_open = "gzip -dc %s |"; +my $gzip_write_open = "| gzip > %s"; + +my $gzip_external; +my $gzip_used; + +sub gzip_read_open { + $gzip_read_open; +} + +sub gzip_write_open { + $gzip_write_open; +} + +sub gzip_external { + $gzip_external; +} + +sub gzip_used { + $gzip_used; +} + +sub can_gunzip { + $has_Compress_Zlib || $gzip_external; +} + +sub _import { + my $import = shift; + while (@_) { + if ($_[0] eq ':gzip_external') { + shift; + if (@_) { + $gzip_external = shift; + } else { + croak "$import: ':gzip_external' requires an argument"; + } + } + elsif ($_[0] eq ':gzip_read_open') { + shift; + if (@_) { + $gzip_read_open = shift; + croak "$import: ':gzip_read_open' '$gzip_read_open' is illegal" + unless $gzip_read_open =~ /^.+%s.+\|\s*$/; + } else { + croak "$import: ':gzip_read_open' requires an argument"; + } + } + elsif ($_[0] eq ':gzip_write_open') { + shift; + if (@_) { + $gzip_write_open = shift; + croak "$import: ':gzip_write_open' '$gzip_read_open' is illegal" + unless $gzip_write_open =~ /^\s*\|.+%s.*$/; + } else { + croak "$import: ':gzip_write_open' requires an argument"; + } + } + else { + last; + } + } + return @_; +} + +sub _alias { + my $import = shift; + if ((!$has_Compress_Zlib && !defined $gzip_external) || $gzip_external) { + # The undef *gzopen is really needed only during + # testing where we eval several 'use IO::Zlib's. + undef *gzopen; + *gzopen = \&gzopen_external; + *IO::Handle::gzread = \&gzread_external; + *IO::Handle::gzwrite = \&gzwrite_external; + *IO::Handle::gzreadline = \&gzreadline_external; + *IO::Handle::gzeof = \&gzeof_external; + *IO::Handle::gzclose = \&gzclose_external; + $gzip_used = 1; + } else { + croak "$import: no Compress::Zlib and no external gzip" + unless $has_Compress_Zlib; + *gzopen = \&Compress::Zlib::gzopen; + *gzread = \&Compress::Zlib::gzread; + *gzwrite = \&Compress::Zlib::gzwrite; + *gzreadline = \&Compress::Zlib::gzreadline; + *gzeof = \&Compress::Zlib::gzeof; + } + $aliased = 1; +} + +sub import { + shift; + my $import = "IO::Zlib::import"; + if (@_) { + if (_import($import, @_)) { + croak "$import: '@_' is illegal"; + } + } + _alias($import); +} + +@ISA = qw(Tie::Handle); + +sub TIEHANDLE +{ + my $class = shift; + my @args = @_; + + my $self = bless {}, $class; + + return @args ? $self->OPEN(@args) : $self; +} + +sub DESTROY +{ +} + +sub OPEN +{ + my $self = shift; + my $filename = shift; + my $mode = shift; + + croak "IO::Zlib::open: needs a filename" unless defined($filename); + + $self->{'file'} = gzopen($filename,$mode); + + return defined($self->{'file'}) ? $self : undef; +} + +sub CLOSE +{ + my $self = shift; + + return undef unless defined($self->{'file'}); + + my $status = $self->{'file'}->gzclose(); + + delete $self->{'file'}; + + return ($status == 0) ? 1 : undef; +} + +sub READ +{ + my $self = shift; + my $bufref = \$_[0]; + my $nbytes = $_[1]; + my $offset = $_[2] || 0; + + croak "IO::Zlib::READ: NBYTES must be specified" unless defined($nbytes); + + $$bufref = "" unless defined($$bufref); + + my $bytesread = $self->{'file'}->gzread(substr($$bufref,$offset),$nbytes); + + return undef if $bytesread < 0; + + return $bytesread; +} + +sub READLINE +{ + my $self = shift; + + my $line; + + return () if $self->{'file'}->gzreadline($line) <= 0; + + return $line unless wantarray; + + my @lines = $line; + + while ($self->{'file'}->gzreadline($line) > 0) + { + push @lines, $line; + } + + return @lines; +} + +sub WRITE +{ + my $self = shift; + my $buf = shift; + my $length = shift; + my $offset = shift; + + croak "IO::Zlib::WRITE: too long LENGTH" unless $offset + $length <= length($buf); + + return $self->{'file'}->gzwrite(substr($buf,$offset,$length)); +} + +sub EOF +{ + my $self = shift; + + return $self->{'file'}->gzeof(); +} + +sub FILENO +{ + return undef; +} + +sub new +{ + my $class = shift; + my @args = @_; + + _alias("new", @_) unless $aliased; # Some call new IO::Zlib directly... + + my $self = gensym(); + + tie *{$self}, $class, @args; + + return tied(${$self}) ? bless $self, $class : undef; +} + +sub getline +{ + my $self = shift; + + return scalar tied(*{$self})->READLINE(); +} + +sub getlines +{ + my $self = shift; + + croak "IO::Zlib::getlines: must be called in list context" + unless wantarray; + + return tied(*{$self})->READLINE(); +} + +sub opened +{ + my $self = shift; + + return defined tied(*{$self})->{'file'}; +} + +sub AUTOLOAD +{ + my $self = shift; + + $AUTOLOAD =~ s/.*:://; + $AUTOLOAD =~ tr/a-z/A-Z/; + + return tied(*{$self})->$AUTOLOAD(@_); +} + +sub gzopen_external { + my ($filename, $mode) = @_; + require IO::Handle; + my $fh = IO::Handle->new(); + if ($mode =~ /r/) { + # Because someone will try to read ungzipped files + # with this we peek and verify the signature. Yes, + # this means that we open the file twice (if it is + # gzipped). + # Plenty of race conditions exist in this code, but + # the alternative would be to capture the stderr of + # gzip and parse it, which would be a portability nightmare. + if (-e $filename && open($fh, $filename)) { + binmode $fh; + my $sig; + my $rdb = read($fh, $sig, 2); + if ($rdb == 2 && $sig eq "\x1F\x8B") { + my $ropen = sprintf $gzip_read_open, $filename; + if (open($fh, $ropen)) { + binmode $fh; + return $fh; + } else { + return undef; + } + } + seek($fh, 0, SEEK_SET) or + die "IO::Zlib: open('$filename', 'r'): seek: $!"; + return $fh; + } else { + return undef; + } + } elsif ($mode =~ /w/) { + my $level = ''; + $level = "-$1" if $mode =~ /([1-9])/; + # To maximize portability we would need to open + # two filehandles here, one for "| gzip $level" + # and another for "> $filename", and then when + # writing copy bytes from the first to the second. + # We are using IO::Handle objects for now, however, + # and they can only contain one stream at a time. + my $wopen = sprintf $gzip_write_open, $filename; + if (open($fh, $wopen)) { + $fh->autoflush(1); + binmode $fh; + return $fh; + } else { + return undef; + } + } else { + croak "IO::Zlib::gzopen_external: mode '$mode' is illegal"; + } + return undef; +} + +sub gzread_external { + # Use read() instead of syswrite() because people may + # mix reads and readlines, and we don't want to mess + # the stdio buffering. See also gzreadline_external() + # and gzwrite_external(). + my $nread = read($_[0], $_[1], @_ == 3 ? $_[2] : 4096); + defined $nread ? $nread : -1; +} + +sub gzwrite_external { + # Using syswrite() is okay (cf. gzread_external()) + # since the bytes leave this process and buffering + # is therefore not an issue. + my $nwrote = syswrite($_[0], $_[1]); + defined $nwrote ? $nwrote : -1; +} + +sub gzreadline_external { + # See the comment in gzread_external(). + $_[1] = readline($_[0]); + return defined $_[1] ? length($_[1]) : -1; +} + +sub gzeof_external { + return eof($_[0]); +} + +sub gzclose_external { + close($_[0]); + # I am not entirely certain why this is needed but it seems + # the above close() always fails (as if the stream would have + # been already closed - something to do with using external + # processes via pipes?) + return 0; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/IPC/Cmd.pm b/data/miniconda3/lib/perl5/core_perl/IPC/Cmd.pm new file mode 100644 index 0000000000000000000000000000000000000000..88ed2955a9d57bda63bc9c4f76b341ceb7605c53 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/IPC/Cmd.pm @@ -0,0 +1,2187 @@ +package IPC::Cmd; + +use strict; + +BEGIN { + + use constant IS_VMS => $^O eq 'VMS' ? 1 : 0; + use constant IS_WIN32 => $^O eq 'MSWin32' ? 1 : 0; + use constant IS_HPUX => $^O eq 'hpux' ? 1 : 0; + use constant IS_WIN98 => (IS_WIN32 and !Win32::IsWinNT()) ? 1 : 0; + use constant ALARM_CLASS => __PACKAGE__ . '::TimeOut'; + use constant SPECIAL_CHARS => qw[< > | &]; + use constant QUOTE => do { IS_WIN32 ? q["] : q['] }; + + use Exporter (); + use vars qw[ @ISA $VERSION @EXPORT_OK $VERBOSE $DEBUG + $USE_IPC_RUN $USE_IPC_OPEN3 $CAN_USE_RUN_FORKED $WARN + $INSTANCES $ALLOW_NULL_ARGS + $HAVE_MONOTONIC + ]; + + $VERSION = '1.04'; + $VERBOSE = 0; + $DEBUG = 0; + $WARN = 1; + $USE_IPC_RUN = IS_WIN32 && !IS_WIN98; + $USE_IPC_OPEN3 = not IS_VMS; + $ALLOW_NULL_ARGS = 0; + + $CAN_USE_RUN_FORKED = 0; + eval { + require POSIX; POSIX->import(); + require IPC::Open3; IPC::Open3->import(); + require IO::Select; IO::Select->import(); + require IO::Handle; IO::Handle->import(); + require FileHandle; FileHandle->import(); + require Socket; + require Time::HiRes; Time::HiRes->import(); + require Win32 if IS_WIN32; + }; + $CAN_USE_RUN_FORKED = $@ || !IS_VMS && !IS_WIN32; + + eval { + my $wait_start_time = Time::HiRes::clock_gettime(&Time::HiRes::CLOCK_MONOTONIC); + }; + if ($@) { + $HAVE_MONOTONIC = 0; + } + else { + $HAVE_MONOTONIC = 1; + } + + @ISA = qw[Exporter]; + @EXPORT_OK = qw[can_run run run_forked QUOTE]; +} + +require Carp; +use File::Spec; +use Params::Check qw[check]; +use Text::ParseWords (); # import ONLY if needed! +use Module::Load::Conditional qw[can_load]; +use Locale::Maketext::Simple Style => 'gettext'; + +local $Module::Load::Conditional::FORCE_SAFE_INC = 1; + +=pod + +=head1 NAME + +IPC::Cmd - finding and running system commands made easy + +=head1 SYNOPSIS + + use IPC::Cmd qw[can_run run run_forked]; + + my $full_path = can_run('wget') or warn 'wget is not installed!'; + + ### commands can be arrayrefs or strings ### + my $cmd = "$full_path -b theregister.co.uk"; + my $cmd = [$full_path, '-b', 'theregister.co.uk']; + + ### in scalar context ### + my $buffer; + if( scalar run( command => $cmd, + verbose => 0, + buffer => \$buffer, + timeout => 20 ) + ) { + print "fetched webpage successfully: $buffer\n"; + } + + + ### in list context ### + my( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = + run( command => $cmd, verbose => 0 ); + + if( $success ) { + print "this is what the command printed:\n"; + print join "", @$full_buf; + } + + ### run_forked example ### + my $result = run_forked("$full_path -q -O - theregister.co.uk", {'timeout' => 20}); + if ($result->{'exit_code'} eq 0 && !$result->{'timeout'}) { + print "this is what wget returned:\n"; + print $result->{'stdout'}; + } + + ### check for features + print "IPC::Open3 available: " . IPC::Cmd->can_use_ipc_open3; + print "IPC::Run available: " . IPC::Cmd->can_use_ipc_run; + print "Can capture buffer: " . IPC::Cmd->can_capture_buffer; + + ### don't have IPC::Cmd be verbose, ie don't print to stdout or + ### stderr when running commands -- default is '0' + $IPC::Cmd::VERBOSE = 0; + + +=head1 DESCRIPTION + +IPC::Cmd allows you to run commands platform independently, +interactively if desired, but have them still work. + +The C<can_run> function can tell you if a certain binary is installed +and if so where, whereas the C<run> function can actually execute any +of the commands you give it and give you a clear return value, as well +as adhere to your verbosity settings. + +=head1 CLASS METHODS + +=head2 $ipc_run_version = IPC::Cmd->can_use_ipc_run( [VERBOSE] ) + +Utility function that tells you if C<IPC::Run> is available. +If the C<verbose> flag is passed, it will print diagnostic messages +if L<IPC::Run> can not be found or loaded. + +=cut + + +sub can_use_ipc_run { + my $self = shift; + my $verbose = shift || 0; + + ### IPC::Run doesn't run on win98 + return if IS_WIN98; + + ### if we don't have ipc::run, we obviously can't use it. + return unless can_load( + modules => { 'IPC::Run' => '0.55' }, + verbose => ($WARN && $verbose), + ); + + ### otherwise, we're good to go + return $IPC::Run::VERSION; +} + +=head2 $ipc_open3_version = IPC::Cmd->can_use_ipc_open3( [VERBOSE] ) + +Utility function that tells you if C<IPC::Open3> is available. +If the verbose flag is passed, it will print diagnostic messages +if C<IPC::Open3> can not be found or loaded. + +=cut + + +sub can_use_ipc_open3 { + my $self = shift; + my $verbose = shift || 0; + + ### IPC::Open3 is not working on VMS because of a lack of fork. + return if IS_VMS; + + ### IPC::Open3 works on every non-VMS platform, but it can't + ### capture buffers on win32 :( + return unless can_load( + modules => { map {$_ => '0.0'} qw|IPC::Open3 IO::Select Symbol| }, + verbose => ($WARN && $verbose), + ); + + return $IPC::Open3::VERSION; +} + +=head2 $bool = IPC::Cmd->can_capture_buffer + +Utility function that tells you if C<IPC::Cmd> is capable of +capturing buffers in it's current configuration. + +=cut + +sub can_capture_buffer { + my $self = shift; + + return 1 if $USE_IPC_RUN && $self->can_use_ipc_run; + return 1 if $USE_IPC_OPEN3 && $self->can_use_ipc_open3; + return; +} + +=head2 $bool = IPC::Cmd->can_use_run_forked + +Utility function that tells you if C<IPC::Cmd> is capable of +providing C<run_forked> on the current platform. + +=head1 FUNCTIONS + +=head2 $path = can_run( PROGRAM ); + +C<can_run> takes only one argument: the name of a binary you wish +to locate. C<can_run> works much like the unix binary C<which> or the bash +command C<type>, which scans through your path, looking for the requested +binary. + +Unlike C<which> and C<type>, this function is platform independent and +will also work on, for example, Win32. + +If called in a scalar context it will return the full path to the binary +you asked for if it was found, or C<undef> if it was not. + +If called in a list context and the global variable C<$INSTANCES> is a true +value, it will return a list of the full paths to instances +of the binary where found in C<PATH>, or an empty list if it was not found. + +=cut + +sub can_run { + my $command = shift; + + # a lot of VMS executables have a symbol defined + # check those first + if ( $^O eq 'VMS' ) { + require VMS::DCLsym; + my $syms = VMS::DCLsym->new; + return $command if scalar $syms->getsym( uc $command ); + } + + require File::Spec; + require ExtUtils::MakeMaker; + + my @possibles; + + if( File::Spec->file_name_is_absolute($command) ) { + return MM->maybe_command($command); + + } else { + for my $dir ( + File::Spec->path, + ( IS_WIN32 ? File::Spec->curdir : () ) + ) { + next if ! $dir || ! -d $dir; + my $abs = File::Spec->catfile( IS_WIN32 ? Win32::GetShortPathName( $dir ) : $dir, $command); + push @possibles, $abs if $abs = MM->maybe_command($abs); + } + } + return @possibles if wantarray and $INSTANCES; + return shift @possibles; +} + +=head2 $ok | ($ok, $err, $full_buf, $stdout_buff, $stderr_buff) = run( command => COMMAND, [verbose => BOOL, buffer => \$SCALAR, timeout => DIGIT] ); + +C<run> takes 4 arguments: + +=over 4 + +=item command + +This is the command to execute. It may be either a string or an array +reference. +This is a required argument. + +See L<"Caveats"> for remarks on how commands are parsed and their +limitations. + +=item verbose + +This controls whether all output of a command should also be printed +to STDOUT/STDERR or should only be trapped in buffers (NOTE: buffers +require L<IPC::Run> to be installed, or your system able to work with +L<IPC::Open3>). + +It will default to the global setting of C<$IPC::Cmd::VERBOSE>, +which by default is 0. + +=item buffer + +This will hold all the output of a command. It needs to be a reference +to a scalar. +Note that this will hold both the STDOUT and STDERR messages, and you +have no way of telling which is which. +If you require this distinction, run the C<run> command in list context +and inspect the individual buffers. + +Of course, this requires that the underlying call supports buffers. See +the note on buffers above. + +=item timeout + +Sets the maximum time the command is allowed to run before aborting, +using the built-in C<alarm()> call. If the timeout is triggered, the +C<errorcode> in the return value will be set to an object of the +C<IPC::Cmd::TimeOut> class. See the L<"error message"> section below for +details. + +Defaults to C<0>, meaning no timeout is set. + +=back + +C<run> will return a simple C<true> or C<false> when called in scalar +context. +In list context, you will be returned a list of the following items: + +=over 4 + +=item success + +A simple boolean indicating if the command executed without errors or +not. + +=item error message + +If the first element of the return value (C<success>) was 0, then some +error occurred. This second element is the error message the command +you requested exited with, if available. This is generally a pretty +printed value of C<$?> or C<$@>. See C<perldoc perlvar> for details on +what they can contain. +If the error was a timeout, the C<error message> will be prefixed with +the string C<IPC::Cmd::TimeOut>, the timeout class. + +=item full_buffer + +This is an array reference containing all the output the command +generated. +Note that buffers are only available if you have L<IPC::Run> installed, +or if your system is able to work with L<IPC::Open3> -- see below). +Otherwise, this element will be C<undef>. + +=item out_buffer + +This is an array reference containing all the output sent to STDOUT the +command generated. The notes from L<"full_buffer"> apply. + +=item error_buffer + +This is an arrayreference containing all the output sent to STDERR the +command generated. The notes from L<"full_buffer"> apply. + + +=back + +See the L<"HOW IT WORKS"> section below to see how C<IPC::Cmd> decides +what modules or function calls to use when issuing a command. + +=cut + +{ my @acc = qw[ok error _fds]; + + ### autogenerate accessors ### + for my $key ( @acc ) { + no strict 'refs'; + *{__PACKAGE__."::$key"} = sub { + $_[0]->{$key} = $_[1] if @_ > 1; + return $_[0]->{$key}; + } + } +} + +sub can_use_run_forked { + return $CAN_USE_RUN_FORKED eq "1"; +} + +sub get_monotonic_time { + if ($HAVE_MONOTONIC) { + return Time::HiRes::clock_gettime(&Time::HiRes::CLOCK_MONOTONIC); + } + else { + return time(); + } +} + +sub adjust_monotonic_start_time { + my ($ref_vars, $now, $previous) = @_; + + # workaround only for those systems which don't have + # Time::HiRes::CLOCK_MONOTONIC (Mac OSX in particular) + return if $HAVE_MONOTONIC; + + # don't have previous monotonic value (only happens once + # in the beginning of the program execution) + return unless $previous; + + my $time_diff = $now - $previous; + + # adjust previously saved time with the skew value which is + # either negative when clock moved back or more than 5 seconds -- + # assuming that event loop does happen more often than once + # per five seconds, which might not be always true (!) but + # hopefully that's ok, because it's just a workaround + if ($time_diff > 5 || $time_diff < 0) { + foreach my $ref_var (@{$ref_vars}) { + if (defined($$ref_var)) { + $$ref_var = $$ref_var + $time_diff; + } + } + } +} + +sub uninstall_signals { + return unless defined($IPC::Cmd::{'__old_signals'}); + + foreach my $sig_name (keys %{$IPC::Cmd::{'__old_signals'}}) { + $SIG{$sig_name} = $IPC::Cmd::{'__old_signals'}->{$sig_name}; + } +} + +# incompatible with POSIX::SigAction +# +sub install_layered_signal { + my ($s, $handler_code) = @_; + + my %available_signals = map {$_ => 1} keys %SIG; + + Carp::confess("install_layered_signal got nonexistent signal name [$s]") + unless defined($available_signals{$s}); + Carp::confess("install_layered_signal expects coderef") + if !ref($handler_code) || ref($handler_code) ne 'CODE'; + + $IPC::Cmd::{'__old_signals'} = {} + unless defined($IPC::Cmd::{'__old_signals'}); + $IPC::Cmd::{'__old_signals'}->{$s} = $SIG{$s}; + + my $previous_handler = $SIG{$s}; + + my $sig_handler = sub { + my ($called_sig_name, @sig_param) = @_; + + # $s is a closure referring to real signal name + # for which this handler is being installed. + # it is used to distinguish between + # real signal handlers and aliased signal handlers + my $signal_name = $s; + + # $called_sig_name is a signal name which + # was passed to this signal handler; + # it doesn't equal $signal_name in case + # some signal handlers in %SIG point + # to other signal handler (CHLD and CLD, + # ABRT and IOT) + # + # initial signal handler for aliased signal + # calls some other signal handler which + # should not execute the same handler_code again + if ($called_sig_name eq $signal_name) { + $handler_code->($signal_name); + } + + # run original signal handler if any (including aliased) + # + if (ref($previous_handler)) { + $previous_handler->($called_sig_name, @sig_param); + } + }; + + $SIG{$s} = $sig_handler; +} + +# give process a chance sending TERM, +# waiting for a while (2 seconds) +# and killing it with KILL +sub kill_gently { + my ($pid, $opts) = @_; + + require POSIX; + + $opts = {} unless $opts; + $opts->{'wait_time'} = 2 unless defined($opts->{'wait_time'}); + $opts->{'first_kill_type'} = 'just_process' unless $opts->{'first_kill_type'}; + $opts->{'final_kill_type'} = 'just_process' unless $opts->{'final_kill_type'}; + + if ($opts->{'first_kill_type'} eq 'just_process') { + kill(15, $pid); + } + elsif ($opts->{'first_kill_type'} eq 'process_group') { + kill(-15, $pid); + } + + my $do_wait = 1; + my $child_finished = 0; + + my $wait_start_time = get_monotonic_time(); + my $now; + my $previous_monotonic_value; + + while ($do_wait) { + $previous_monotonic_value = $now; + $now = get_monotonic_time(); + + adjust_monotonic_start_time([\$wait_start_time], $now, $previous_monotonic_value); + + if ($now > $wait_start_time + $opts->{'wait_time'}) { + $do_wait = 0; + next; + } + + my $waitpid = waitpid($pid, POSIX::WNOHANG); + + if ($waitpid eq -1) { + $child_finished = 1; + $do_wait = 0; + next; + } + + Time::HiRes::usleep(250000); # quarter of a second + } + + if (!$child_finished) { + if ($opts->{'final_kill_type'} eq 'just_process') { + kill(9, $pid); + } + elsif ($opts->{'final_kill_type'} eq 'process_group') { + kill(-9, $pid); + } + } +} + +sub open3_run { + my ($cmd, $opts) = @_; + + $opts = {} unless $opts; + + my $child_in = FileHandle->new; + my $child_out = FileHandle->new; + my $child_err = FileHandle->new; + $child_out->autoflush(1); + $child_err->autoflush(1); + + my $pid = open3($child_in, $child_out, $child_err, $cmd); + Time::HiRes::usleep(1) if IS_HPUX; + + # will consider myself orphan if my ppid changes + # from this one: + my $original_ppid = $opts->{'original_ppid'}; + + # push my child's pid to our parent + # so in case i am killed parent + # could stop my child (search for + # child_child_pid in parent code) + if ($opts->{'parent_info'}) { + my $ps = $opts->{'parent_info'}; + print $ps "spawned $pid\n"; + } + + if ($child_in && $child_out->opened && $opts->{'child_stdin'}) { + # If the child process dies for any reason, + # the next write to CHLD_IN is likely to generate + # a SIGPIPE in the parent, which is fatal by default. + # So you may wish to handle this signal. + # + # from http://perldoc.perl.org/IPC/Open3.html, + # absolutely needed to catch piped commands errors. + # + local $SIG{'PIPE'} = sub { 1; }; + + print $child_in $opts->{'child_stdin'}; + } + close($child_in); + + my $child_output = { + 'out' => $child_out->fileno, + 'err' => $child_err->fileno, + $child_out->fileno => { + 'parent_socket' => $opts->{'parent_stdout'}, + 'scalar_buffer' => "", + 'child_handle' => $child_out, + 'block_size' => ($child_out->stat)[11] || 1024, + }, + $child_err->fileno => { + 'parent_socket' => $opts->{'parent_stderr'}, + 'scalar_buffer' => "", + 'child_handle' => $child_err, + 'block_size' => ($child_err->stat)[11] || 1024, + }, + }; + + my $select = IO::Select->new(); + $select->add($child_out, $child_err); + + # pass any signal to the child + # effectively creating process + # strongly attached to the child: + # it will terminate only after child + # has terminated (except for SIGKILL, + # which is specially handled) + SIGNAL: foreach my $s (keys %SIG) { + next SIGNAL if $s eq '__WARN__' or $s eq '__DIE__'; # Skip and don't clobber __DIE__ & __WARN__ + my $sig_handler; + $sig_handler = sub { + kill("$s", $pid); + $SIG{$s} = $sig_handler; + }; + $SIG{$s} = $sig_handler; + } + + my $child_finished = 0; + + my $real_exit; + my $exit_value; + + while(!$child_finished) { + + # parent was killed otherwise we would have got + # the same signal as parent and process it same way + if (getppid() != $original_ppid) { + + # end my process group with all the children + # (i am the process group leader, so my pid + # equals to the process group id) + # + # same thing which is done + # with $opts->{'clean_up_children'} + # in run_forked + # + kill(-9, $$); + + POSIX::_exit 1; + } + + my $waitpid = waitpid($pid, POSIX::WNOHANG); + + # child finished, catch it's exit status + if ($waitpid ne 0 && $waitpid ne -1) { + $real_exit = $?; + $exit_value = $? >> 8; + } + + if ($waitpid eq -1) { + $child_finished = 1; + } + + + my $ready_fds = []; + push @{$ready_fds}, $select->can_read(1/100); + + READY_FDS: while (scalar(@{$ready_fds})) { + my $fd = shift @{$ready_fds}; + $ready_fds = [grep {$_ ne $fd} @{$ready_fds}]; + + my $str = $child_output->{$fd->fileno}; + Carp::confess("child stream not found: $fd") unless $str; + + my $data; + my $count = $fd->sysread($data, $str->{'block_size'}); + + if ($count) { + if ($str->{'parent_socket'}) { + my $ph = $str->{'parent_socket'}; + print $ph $data; + } + else { + $str->{'scalar_buffer'} .= $data; + } + } + elsif ($count eq 0) { + $select->remove($fd); + $fd->close(); + } + else { + Carp::confess("error during sysread: " . $!); + } + + push @{$ready_fds}, $select->can_read(1/100) if $child_finished; + } + + Time::HiRes::usleep(1); + } + + # since we've successfully reaped the child, + # let our parent know about this. + # + if ($opts->{'parent_info'}) { + my $ps = $opts->{'parent_info'}; + + # child was killed, inform parent + if ($real_exit & 127) { + print $ps "$pid killed with " . ($real_exit & 127) . "\n"; + } + + print $ps "reaped $pid\n"; + } + + if ($opts->{'parent_stdout'} || $opts->{'parent_stderr'}) { + return $exit_value; + } + else { + return { + 'stdout' => $child_output->{$child_output->{'out'}}->{'scalar_buffer'}, + 'stderr' => $child_output->{$child_output->{'err'}}->{'scalar_buffer'}, + 'exit_code' => $exit_value, + }; + } +} + +=head2 $hashref = run_forked( COMMAND, { child_stdin => SCALAR, timeout => DIGIT, stdout_handler => CODEREF, stderr_handler => CODEREF} ); + +C<run_forked> is used to execute some program or a coderef, +optionally feed it with some input, get its return code +and output (both stdout and stderr into separate buffers). +In addition, it allows to terminate the program +if it takes too long to finish. + +The important and distinguishing feature of run_forked +is execution timeout which at first seems to be +quite a simple task but if you think +that the program which you're spawning +might spawn some children itself (which +in their turn could do the same and so on) +it turns out to be not a simple issue. + +C<run_forked> is designed to survive and +successfully terminate almost any long running task, +even a fork bomb in case your system has the resources +to survive during given timeout. + +This is achieved by creating separate watchdog process +which spawns the specified program in a separate +process session and supervises it: optionally +feeds it with input, stores its exit code, +stdout and stderr, terminates it in case +it runs longer than specified. + +Invocation requires the command to be executed or a coderef and optionally a hashref of options: + +=over + +=item C<timeout> + +Specify in seconds how long to run the command before it is killed with SIG_KILL (9), +which effectively terminates it and all of its children (direct or indirect). + +=item C<child_stdin> + +Specify some text that will be passed into the C<STDIN> of the executed program. + +=item C<stdout_handler> + +Coderef of a subroutine to call when a portion of data is received on +STDOUT from the executing program. + +=item C<stderr_handler> + +Coderef of a subroutine to call when a portion of data is received on +STDERR from the executing program. + +=item C<wait_loop_callback> + +Coderef of a subroutine to call inside of the main waiting loop +(while C<run_forked> waits for the external to finish or fail). +It is useful to stop running external process before it ends +by itself, e.g. + + my $r = run_forked("some external command", { + 'wait_loop_callback' => sub { + if (condition) { + kill(1, $$); + } + }, + 'terminate_on_signal' => 'HUP', + }); + +Combined with C<stdout_handler> and C<stderr_handler> allows terminating +external command based on its output. Could also be used as a timer +without engaging with L<alarm> (signals). + +Remember that this code could be called every millisecond (depending +on the output which external command generates), so try to make it +as lightweight as possible. + +=item C<discard_output> + +Discards the buffering of the standard output and standard errors for return by run_forked(). +With this option you have to use the std*_handlers to read what the command outputs. +Useful for commands that send a lot of output. + +=item C<terminate_on_parent_sudden_death> + +Enable this option if you wish all spawned processes to be killed if the initially spawned +process (the parent) is killed or dies without waiting for child processes. + +=back + +C<run_forked> will return a HASHREF with the following keys: + +=over + +=item C<exit_code> + +The exit code of the executed program. + +=item C<timeout> + +The number of seconds the program ran for before being terminated, or 0 if no timeout occurred. + +=item C<stdout> + +Holds the standard output of the executed command (or empty string if +there was no STDOUT output or if C<discard_output> was used; it's always defined!) + +=item C<stderr> + +Holds the standard error of the executed command (or empty string if +there was no STDERR output or if C<discard_output> was used; it's always defined!) + +=item C<merged> + +Holds the standard output and error of the executed command merged into one stream +(or empty string if there was no output at all or if C<discard_output> was used; it's always defined!) + +=item C<err_msg> + +Holds some explanation in the case of an error. + +=back + +=cut + +sub run_forked { + ### container to store things in + my $self = bless {}, __PACKAGE__; + + if (!can_use_run_forked()) { + Carp::carp("run_forked is not available: $CAN_USE_RUN_FORKED"); + return; + } + + require POSIX; + + my ($cmd, $opts) = @_; + if (ref($cmd) eq 'ARRAY') { + $cmd = join(" ", @{$cmd}); + } + + if (!$cmd) { + Carp::carp("run_forked expects command to run"); + return; + } + + $opts = {} unless $opts; + $opts->{'timeout'} = 0 unless $opts->{'timeout'}; + $opts->{'terminate_wait_time'} = 2 unless defined($opts->{'terminate_wait_time'}); + + # turned on by default + $opts->{'clean_up_children'} = 1 unless defined($opts->{'clean_up_children'}); + + # sockets to pass child stdout to parent + my $child_stdout_socket; + my $parent_stdout_socket; + + # sockets to pass child stderr to parent + my $child_stderr_socket; + my $parent_stderr_socket; + + # sockets for child -> parent internal communication + my $child_info_socket; + my $parent_info_socket; + + socketpair($child_stdout_socket, $parent_stdout_socket, &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC) || + Carp::confess ("socketpair: $!"); + socketpair($child_stderr_socket, $parent_stderr_socket, &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC) || + Carp::confess ("socketpair: $!"); + socketpair($child_info_socket, $parent_info_socket, &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC) || + Carp::confess ("socketpair: $!"); + + $child_stdout_socket->autoflush(1); + $parent_stdout_socket->autoflush(1); + $child_stderr_socket->autoflush(1); + $parent_stderr_socket->autoflush(1); + $child_info_socket->autoflush(1); + $parent_info_socket->autoflush(1); + + my $start_time = get_monotonic_time(); + + my $pid; + my $ppid = $$; + if ($pid = fork) { + + # we are a parent + close($parent_stdout_socket); + close($parent_stderr_socket); + close($parent_info_socket); + + my $flags; + + # prepare sockets to read from child + + $flags = fcntl($child_stdout_socket, POSIX::F_GETFL, 0) || Carp::confess "can't fnctl F_GETFL: $!"; + $flags |= POSIX::O_NONBLOCK; + fcntl($child_stdout_socket, POSIX::F_SETFL, $flags) || Carp::confess "can't fnctl F_SETFL: $!"; + + $flags = fcntl($child_stderr_socket, POSIX::F_GETFL, 0) || Carp::confess "can't fnctl F_GETFL: $!"; + $flags |= POSIX::O_NONBLOCK; + fcntl($child_stderr_socket, POSIX::F_SETFL, $flags) || Carp::confess "can't fnctl F_SETFL: $!"; + + $flags = fcntl($child_info_socket, POSIX::F_GETFL, 0) || Carp::confess "can't fnctl F_GETFL: $!"; + $flags |= POSIX::O_NONBLOCK; + fcntl($child_info_socket, POSIX::F_SETFL, $flags) || Carp::confess "can't fnctl F_SETFL: $!"; + + # print "child $pid started\n"; + + my $child_output = { + $child_stdout_socket->fileno => { + 'scalar_buffer' => "", + 'child_handle' => $child_stdout_socket, + 'block_size' => ($child_stdout_socket->stat)[11] || 1024, + 'protocol' => 'stdout', + }, + $child_stderr_socket->fileno => { + 'scalar_buffer' => "", + 'child_handle' => $child_stderr_socket, + 'block_size' => ($child_stderr_socket->stat)[11] || 1024, + 'protocol' => 'stderr', + }, + $child_info_socket->fileno => { + 'scalar_buffer' => "", + 'child_handle' => $child_info_socket, + 'block_size' => ($child_info_socket->stat)[11] || 1024, + 'protocol' => 'info', + }, + }; + + my $select = IO::Select->new(); + $select->add($child_stdout_socket, $child_stderr_socket, $child_info_socket); + + my $child_timedout = 0; + my $child_finished = 0; + my $child_stdout = ''; + my $child_stderr = ''; + my $child_merged = ''; + my $child_exit_code = 0; + my $child_killed_by_signal = 0; + my $parent_died = 0; + + my $last_parent_check = 0; + my $got_sig_child = 0; + my $got_sig_quit = 0; + my $orig_sig_child = $SIG{'CHLD'}; + + $SIG{'CHLD'} = sub { $got_sig_child = get_monotonic_time(); }; + + if ($opts->{'terminate_on_signal'}) { + install_layered_signal($opts->{'terminate_on_signal'}, sub { $got_sig_quit = time(); }); + } + + my $child_child_pid; + my $now; + my $previous_monotonic_value; + + while (!$child_finished) { + $previous_monotonic_value = $now; + $now = get_monotonic_time(); + + adjust_monotonic_start_time([\$start_time, \$last_parent_check, \$got_sig_child], $now, $previous_monotonic_value); + + if ($opts->{'terminate_on_parent_sudden_death'}) { + # check for parent once each five seconds + if ($now > $last_parent_check + 5) { + if (getppid() eq "1") { + kill_gently ($pid, { + 'first_kill_type' => 'process_group', + 'final_kill_type' => 'process_group', + 'wait_time' => $opts->{'terminate_wait_time'} + }); + $parent_died = 1; + } + + $last_parent_check = $now; + } + } + + # user specified timeout + if ($opts->{'timeout'}) { + if ($now > $start_time + $opts->{'timeout'}) { + kill_gently ($pid, { + 'first_kill_type' => 'process_group', + 'final_kill_type' => 'process_group', + 'wait_time' => $opts->{'terminate_wait_time'} + }); + $child_timedout = 1; + } + } + + # give OS 10 seconds for correct return of waitpid, + # kill process after that and finish wait loop; + # shouldn't ever happen -- remove this code? + if ($got_sig_child) { + if ($now > $got_sig_child + 10) { + print STDERR "waitpid did not return -1 for 10 seconds after SIG_CHLD, killing [$pid]\n"; + kill (-9, $pid); + $child_finished = 1; + } + } + + if ($got_sig_quit) { + kill_gently ($pid, { + 'first_kill_type' => 'process_group', + 'final_kill_type' => 'process_group', + 'wait_time' => $opts->{'terminate_wait_time'} + }); + $child_finished = 1; + } + + my $waitpid = waitpid($pid, POSIX::WNOHANG); + + # child finished, catch it's exit status + if ($waitpid ne 0 && $waitpid ne -1) { + $child_exit_code = $? >> 8; + } + + if ($waitpid eq -1) { + $child_finished = 1; + } + + my $ready_fds = []; + push @{$ready_fds}, $select->can_read(1/100); + + READY_FDS: while (scalar(@{$ready_fds})) { + my $fd = shift @{$ready_fds}; + $ready_fds = [grep {$_ ne $fd} @{$ready_fds}]; + + my $str = $child_output->{$fd->fileno}; + Carp::confess("child stream not found: $fd") unless $str; + + my $data = ""; + my $count = $fd->sysread($data, $str->{'block_size'}); + + if ($count) { + # extract all the available lines and store the rest in temporary buffer + if ($data =~ /(.+\n)([^\n]*)/so) { + $data = $str->{'scalar_buffer'} . $1; + $str->{'scalar_buffer'} = $2 || ""; + } + else { + $str->{'scalar_buffer'} .= $data; + $data = ""; + } + } + elsif ($count eq 0) { + $select->remove($fd); + $fd->close(); + if ($str->{'scalar_buffer'}) { + $data = $str->{'scalar_buffer'} . "\n"; + } + } + else { + Carp::confess("error during sysread on [$fd]: " . $!); + } + + # $data contains only full lines (or last line if it was unfinished read + # or now new-line in the output of the child); dat is processed + # according to the "protocol" of socket + if ($str->{'protocol'} eq 'info') { + if ($data =~ /^spawned ([0-9]+?)\n(.*?)/so) { + $child_child_pid = $1; + $data = $2; + } + if ($data =~ /^reaped ([0-9]+?)\n(.*?)/so) { + $child_child_pid = undef; + $data = $2; + } + if ($data =~ /^[\d]+ killed with ([0-9]+?)\n(.*?)/so) { + $child_killed_by_signal = $1; + $data = $2; + } + + # we don't expect any other data in info socket, so it's + # some strange violation of protocol, better know about this + if ($data) { + Carp::confess("info protocol violation: [$data]"); + } + } + if ($str->{'protocol'} eq 'stdout') { + if (!$opts->{'discard_output'}) { + $child_stdout .= $data; + $child_merged .= $data; + } + + if ($opts->{'stdout_handler'} && ref($opts->{'stdout_handler'}) eq 'CODE') { + $opts->{'stdout_handler'}->($data); + } + } + if ($str->{'protocol'} eq 'stderr') { + if (!$opts->{'discard_output'}) { + $child_stderr .= $data; + $child_merged .= $data; + } + + if ($opts->{'stderr_handler'} && ref($opts->{'stderr_handler'}) eq 'CODE') { + $opts->{'stderr_handler'}->($data); + } + } + + # process may finish (waitpid returns -1) before + # we've read all of its output because of buffering; + # so try to read all the way it is possible to read + # in such case - this shouldn't be too much (unless + # the buffer size is HUGE -- should introduce + # another counter in such case, maybe later) + # + push @{$ready_fds}, $select->can_read(1/100) if $child_finished; + } + + if ($opts->{'wait_loop_callback'} && ref($opts->{'wait_loop_callback'}) eq 'CODE') { + $opts->{'wait_loop_callback'}->(); + } + + Time::HiRes::usleep(1); + } + + # $child_pid_pid is not defined in two cases: + # * when our child was killed before + # it had chance to tell us the pid + # of the child it spawned. we can do + # nothing in this case :( + # * our child successfully reaped its child, + # we have nothing left to do in this case + # + # defined $child_pid_pid means child's child + # has not died but nobody is waiting for it, + # killing it brutally. + # + if ($child_child_pid) { + kill_gently($child_child_pid); + } + + # in case there are forks in child which + # do not forward or process signals (TERM) correctly + # kill whole child process group, effectively trying + # not to return with some children or their parts still running + # + # to be more accurate -- we need to be sure + # that this is process group created by our child + # (and not some other process group with the same pgid, + # created just after death of our child) -- fortunately + # this might happen only when process group ids + # are reused quickly (there are lots of processes + # spawning new process groups for example) + # + if ($opts->{'clean_up_children'}) { + kill(-9, $pid); + } + + # print "child $pid finished\n"; + + close($child_stdout_socket); + close($child_stderr_socket); + close($child_info_socket); + + my $o = { + 'stdout' => $child_stdout, + 'stderr' => $child_stderr, + 'merged' => $child_merged, + 'timeout' => $child_timedout ? $opts->{'timeout'} : 0, + 'exit_code' => $child_exit_code, + 'parent_died' => $parent_died, + 'killed_by_signal' => $child_killed_by_signal, + 'child_pgid' => $pid, + 'cmd' => $cmd, + }; + + my $err_msg = ''; + if ($o->{'exit_code'}) { + $err_msg .= "exited with code [$o->{'exit_code'}]\n"; + } + if ($o->{'timeout'}) { + $err_msg .= "ran more than [$o->{'timeout'}] seconds\n"; + } + if ($o->{'parent_died'}) { + $err_msg .= "parent died\n"; + } + if ($o->{'stdout'} && !$opts->{'non_empty_stdout_ok'}) { + $err_msg .= "stdout:\n" . $o->{'stdout'} . "\n"; + } + if ($o->{'stderr'}) { + $err_msg .= "stderr:\n" . $o->{'stderr'} . "\n"; + } + if ($o->{'killed_by_signal'}) { + $err_msg .= "killed by signal [" . $o->{'killed_by_signal'} . "]\n"; + } + $o->{'err_msg'} = $err_msg; + + if ($orig_sig_child) { + $SIG{'CHLD'} = $orig_sig_child; + } + else { + delete($SIG{'CHLD'}); + } + + uninstall_signals(); + + return $o; + } + else { + Carp::confess("cannot fork: $!") unless defined($pid); + + # create new process session for open3 call, + # so we hopefully can kill all the subprocesses + # which might be spawned in it (except for those + # which do setsid theirselves -- can't do anything + # with those) + + POSIX::setsid() == -1 and Carp::confess("Error running setsid: " . $!); + + if ($opts->{'child_BEGIN'} && ref($opts->{'child_BEGIN'}) eq 'CODE') { + $opts->{'child_BEGIN'}->(); + } + + close($child_stdout_socket); + close($child_stderr_socket); + close($child_info_socket); + + my $child_exit_code; + + # allow both external programs + # and internal perl calls + if (!ref($cmd)) { + $child_exit_code = open3_run($cmd, { + 'parent_info' => $parent_info_socket, + 'parent_stdout' => $parent_stdout_socket, + 'parent_stderr' => $parent_stderr_socket, + 'child_stdin' => $opts->{'child_stdin'}, + 'original_ppid' => $ppid, + }); + } + elsif (ref($cmd) eq 'CODE') { + # reopen STDOUT and STDERR for child code: + # https://rt.cpan.org/Ticket/Display.html?id=85912 + open STDOUT, '>&', $parent_stdout_socket || Carp::confess("Unable to reopen STDOUT: $!\n"); + open STDERR, '>&', $parent_stderr_socket || Carp::confess("Unable to reopen STDERR: $!\n"); + + $child_exit_code = $cmd->({ + 'opts' => $opts, + 'parent_info' => $parent_info_socket, + 'parent_stdout' => $parent_stdout_socket, + 'parent_stderr' => $parent_stderr_socket, + 'child_stdin' => $opts->{'child_stdin'}, + }); + } + else { + print $parent_stderr_socket "Invalid command reference: " . ref($cmd) . "\n"; + $child_exit_code = 1; + } + + close($parent_stdout_socket); + close($parent_stderr_socket); + close($parent_info_socket); + + if ($opts->{'child_END'} && ref($opts->{'child_END'}) eq 'CODE') { + $opts->{'child_END'}->(); + } + + $| = 1; + POSIX::_exit $child_exit_code; + } +} + +sub run { + ### container to store things in + my $self = bless {}, __PACKAGE__; + + my %hash = @_; + + ### if the user didn't provide a buffer, we'll store it here. + my $def_buf = ''; + + my($verbose,$cmd,$buffer,$timeout); + my $tmpl = { + verbose => { default => $VERBOSE, store => \$verbose }, + buffer => { default => \$def_buf, store => \$buffer }, + command => { required => 1, store => \$cmd, + allow => sub { !ref($_[0]) or ref($_[0]) eq 'ARRAY' }, + }, + timeout => { default => 0, store => \$timeout }, + }; + + unless( check( $tmpl, \%hash, $VERBOSE ) ) { + Carp::carp( loc( "Could not validate input: %1", + Params::Check->last_error ) ); + return; + }; + + $cmd = _quote_args_vms( $cmd ) if IS_VMS; + + ### strip any empty elements from $cmd if present + if ( $ALLOW_NULL_ARGS ) { + $cmd = [ grep { defined } @$cmd ] if ref $cmd; + } + else { + $cmd = [ grep { defined && length } @$cmd ] if ref $cmd; + } + + my $pp_cmd = (ref $cmd ? "@$cmd" : $cmd); + print loc("Running [%1]...\n", $pp_cmd ) if $verbose; + + ### did the user pass us a buffer to fill or not? if so, set this + ### flag so we know what is expected of us + ### XXX this is now being ignored. in the future, we could add diagnostic + ### messages based on this logic + #my $user_provided_buffer = $buffer == \$def_buf ? 0 : 1; + + ### buffers that are to be captured + my( @buffer, @buff_err, @buff_out ); + + ### capture STDOUT + my $_out_handler = sub { + my $buf = shift; + return unless defined $buf; + + print STDOUT $buf if $verbose; + push @buffer, $buf; + push @buff_out, $buf; + }; + + ### capture STDERR + my $_err_handler = sub { + my $buf = shift; + return unless defined $buf; + + print STDERR $buf if $verbose; + push @buffer, $buf; + push @buff_err, $buf; + }; + + + ### flag to indicate we have a buffer captured + my $have_buffer = $self->can_capture_buffer ? 1 : 0; + + ### flag indicating if the subcall went ok + my $ok; + + ### don't look at previous errors: + local $?; + local $@; + local $!; + + ### we might be having a timeout set + eval { + local $SIG{ALRM} = sub { die bless sub { + ALARM_CLASS . + qq[: Command '$pp_cmd' aborted by alarm after $timeout seconds] + }, ALARM_CLASS } if $timeout; + alarm $timeout || 0; + + ### IPC::Run is first choice if $USE_IPC_RUN is set. + if( !IS_WIN32 and $USE_IPC_RUN and $self->can_use_ipc_run( 1 ) ) { + ### ipc::run handlers needs the command as a string or an array ref + + $self->_debug( "# Using IPC::Run. Have buffer: $have_buffer" ) + if $DEBUG; + + $ok = $self->_ipc_run( $cmd, $_out_handler, $_err_handler ); + + ### since IPC::Open3 works on all platforms, and just fails on + ### win32 for capturing buffers, do that ideally + } elsif ( $USE_IPC_OPEN3 and $self->can_use_ipc_open3( 1 ) ) { + + $self->_debug("# Using IPC::Open3. Have buffer: $have_buffer") + if $DEBUG; + + ### in case there are pipes in there; + ### IPC::Open3 will call exec and exec will do the right thing + + my $method = IS_WIN32 ? '_open3_run_win32' : '_open3_run'; + + $ok = $self->$method( + $cmd, $_out_handler, $_err_handler, $verbose + ); + + ### if we are allowed to run verbose, just dispatch the system command + } else { + $self->_debug( "# Using system(). Have buffer: $have_buffer" ) + if $DEBUG; + $ok = $self->_system_run( $cmd, $verbose ); + } + + alarm 0; + }; + + ### restore STDIN after duping, or STDIN will be closed for + ### this current perl process! + $self->__reopen_fds( @{ $self->_fds} ) if $self->_fds; + + my $err; + unless( $ok ) { + ### alarm happened + if ( $@ and ref $@ and $@->isa( ALARM_CLASS ) ) { + $err = $@->(); # the error code is an expired alarm + + ### another error happened, set by the dispatchub + } else { + $err = $self->error; + } + } + + ### fill the buffer; + $$buffer = join '', @buffer if @buffer; + + ### return a list of flags and buffers (if available) in list + ### context, or just a simple 'ok' in scalar + return wantarray + ? $have_buffer + ? ($ok, $err, \@buffer, \@buff_out, \@buff_err) + : ($ok, $err ) + : $ok + + +} + +sub _open3_run_win32 { + my $self = shift; + my $cmd = shift; + my $outhand = shift; + my $errhand = shift; + + require Socket; + + my $pipe = sub { + socketpair($_[0], $_[1], &Socket::AF_UNIX, &Socket::SOCK_STREAM, &Socket::PF_UNSPEC) + or return undef; + shutdown($_[0], 1); # No more writing for reader + shutdown($_[1], 0); # No more reading for writer + return 1; + }; + + my $open3 = sub { + local (*TO_CHLD_R, *TO_CHLD_W); + local (*FR_CHLD_R, *FR_CHLD_W); + local (*FR_CHLD_ERR_R, *FR_CHLD_ERR_W); + + $pipe->(*TO_CHLD_R, *TO_CHLD_W ) or die $^E; + $pipe->(*FR_CHLD_R, *FR_CHLD_W ) or die $^E; + $pipe->(*FR_CHLD_ERR_R, *FR_CHLD_ERR_W) or die $^E; + + my $pid = IPC::Open3::open3('>&TO_CHLD_R', '<&FR_CHLD_W', '<&FR_CHLD_ERR_W', @_); + + return ( $pid, *TO_CHLD_W, *FR_CHLD_R, *FR_CHLD_ERR_R ); + }; + + $cmd = [ grep { defined && length } @$cmd ] if ref $cmd; + $cmd = $self->__fix_cmd_whitespace_and_special_chars( $cmd ); + + my ($pid, $to_chld, $fr_chld, $fr_chld_err) = + $open3->( ( ref $cmd ? @$cmd : $cmd ) ); + + my $in_sel = IO::Select->new(); + my $out_sel = IO::Select->new(); + + my %objs; + + $objs{ fileno( $fr_chld ) } = $outhand; + $objs{ fileno( $fr_chld_err ) } = $errhand; + $in_sel->add( $fr_chld ); + $in_sel->add( $fr_chld_err ); + + close($to_chld); + + while ($in_sel->count() + $out_sel->count()) { + my ($ins, $outs) = IO::Select::select($in_sel, $out_sel, undef); + + for my $fh (@$ins) { + my $obj = $objs{ fileno($fh) }; + my $buf; + my $bytes_read = sysread($fh, $buf, 64*1024 ); #, length($buf)); + if (!$bytes_read) { + $in_sel->remove($fh); + } + else { + $obj->( "$buf" ); + } + } + + for my $fh (@$outs) { + } + } + + waitpid($pid, 0); + + ### some error occurred + if( $? ) { + $self->error( $self->_pp_child_error( $cmd, $? ) ); + $self->ok( 0 ); + return; + } else { + return $self->ok( 1 ); + } +} + +sub _open3_run { + my $self = shift; + my $cmd = shift; + my $_out_handler = shift; + my $_err_handler = shift; + my $verbose = shift || 0; + + ### Following code are adapted from Friar 'abstracts' in the + ### Perl Monastery (http://www.perlmonks.org/index.pl?node_id=151886). + ### XXX that code didn't work. + ### we now use the following code, thanks to theorbtwo + + ### define them beforehand, so we always have defined FH's + ### to read from. + use Symbol; + my $kidout = Symbol::gensym(); + my $kiderror = Symbol::gensym(); + + ### Dup the filehandle so we can pass 'our' STDIN to the + ### child process. This stops us from having to pump input + ### from ourselves to the childprocess. However, we will need + ### to revive the FH afterwards, as IPC::Open3 closes it. + ### We'll do the same for STDOUT and STDERR. It works without + ### duping them on non-unix derivatives, but not on win32. + my @fds_to_dup = ( IS_WIN32 && !$verbose + ? qw[STDIN STDOUT STDERR] + : qw[STDIN] + ); + $self->_fds( \@fds_to_dup ); + $self->__dup_fds( @fds_to_dup ); + + ### pipes have to come in a quoted string, and that clashes with + ### whitespace. This sub fixes up such commands so they run properly + $cmd = $self->__fix_cmd_whitespace_and_special_chars( $cmd ); + + ### don't stringify @$cmd, so spaces in filenames/paths are + ### treated properly + my $pid = eval { + IPC::Open3::open3( + '<&STDIN', + (IS_WIN32 ? '>&STDOUT' : $kidout), + (IS_WIN32 ? '>&STDERR' : $kiderror), + ( ref $cmd ? @$cmd : $cmd ), + ); + }; + + ### open3 error occurred + if( $@ and $@ =~ /^open3:/ ) { + $self->ok( 0 ); + $self->error( $@ ); + return; + }; + + ### use OUR stdin, not $kidin. Somehow, + ### we never get the input.. so jump through + ### some hoops to do it :( + my $selector = IO::Select->new( + (IS_WIN32 ? \*STDERR : $kiderror), + \*STDIN, + (IS_WIN32 ? \*STDOUT : $kidout) + ); + + STDOUT->autoflush(1); STDERR->autoflush(1); STDIN->autoflush(1); + $kidout->autoflush(1) if UNIVERSAL::can($kidout, 'autoflush'); + $kiderror->autoflush(1) if UNIVERSAL::can($kiderror, 'autoflush'); + + ### add an explicit break statement + ### code courtesy of theorbtwo from #london.pm + my $stdout_done = 0; + my $stderr_done = 0; + OUTER: while ( my @ready = $selector->can_read ) { + + for my $h ( @ready ) { + my $buf; + + ### $len is the amount of bytes read + my $len = sysread( $h, $buf, 4096 ); # try to read 4096 bytes + + ### see perldoc -f sysread: it returns undef on error, + ### so bail out. + if( not defined $len ) { + warn(loc("Error reading from process: %1", $!)); + last OUTER; + } + + ### check for $len. it may be 0, at which point we're + ### done reading, so don't try to process it. + ### if we would print anyway, we'd provide bogus information + $_out_handler->( "$buf" ) if $len && $h == $kidout; + $_err_handler->( "$buf" ) if $len && $h == $kiderror; + + ### Wait till child process is done printing to both + ### stdout and stderr. + $stdout_done = 1 if $h == $kidout and $len == 0; + $stderr_done = 1 if $h == $kiderror and $len == 0; + last OUTER if ($stdout_done && $stderr_done); + } + } + + waitpid $pid, 0; # wait for it to die + + ### restore STDIN after duping, or STDIN will be closed for + ### this current perl process! + ### done in the parent call now + # $self->__reopen_fds( @fds_to_dup ); + + ### some error occurred + if( $? ) { + $self->error( $self->_pp_child_error( $cmd, $? ) ); + $self->ok( 0 ); + return; + } else { + return $self->ok( 1 ); + } +} + +### Text::ParseWords::shellwords() uses unix semantics. that will break +### on win32 +{ my $parse_sub = IS_WIN32 + ? __PACKAGE__->can('_split_like_shell_win32') + : Text::ParseWords->can('shellwords'); + + sub _ipc_run { + my $self = shift; + my $cmd = shift; + my $_out_handler = shift; + my $_err_handler = shift; + + STDOUT->autoflush(1); STDERR->autoflush(1); + + ### a command like: + # [ + # '/usr/bin/gzip', + # '-cdf', + # '/Users/kane/sources/p4/other/archive-extract/t/src/x.tgz', + # '|', + # '/usr/bin/tar', + # '-tf -' + # ] + ### needs to become: + # [ + # ['/usr/bin/gzip', '-cdf', + # '/Users/kane/sources/p4/other/archive-extract/t/src/x.tgz'] + # '|', + # ['/usr/bin/tar', '-tf -'] + # ] + + + my @command; + my $special_chars; + + my $re = do { my $x = join '', SPECIAL_CHARS; qr/([$x])/ }; + if( ref $cmd ) { + my $aref = []; + for my $item (@$cmd) { + if( $item =~ $re ) { + push @command, $aref, $item; + $aref = []; + $special_chars .= $1; + } else { + push @$aref, $item; + } + } + push @command, $aref; + } else { + @command = map { if( $_ =~ $re ) { + $special_chars .= $1; $_; + } else { +# [ split /\s+/ ] + [ map { m/[ ]/ ? qq{'$_'} : $_ } $parse_sub->($_) ] + } + } split( /\s*$re\s*/, $cmd ); + } + + ### if there's a pipe in the command, *STDIN needs to + ### be inserted *BEFORE* the pipe, to work on win32 + ### this also works on *nix, so we should do it when possible + ### this should *also* work on multiple pipes in the command + ### if there's no pipe in the command, append STDIN to the back + ### of the command instead. + ### XXX seems IPC::Run works it out for itself if you just + ### don't pass STDIN at all. + # if( $special_chars and $special_chars =~ /\|/ ) { + # ### only add STDIN the first time.. + # my $i; + # @command = map { ($_ eq '|' && not $i++) + # ? ( \*STDIN, $_ ) + # : $_ + # } @command; + # } else { + # push @command, \*STDIN; + # } + + # \*STDIN is already included in the @command, see a few lines up + my $ok = eval { IPC::Run::run( @command, + fileno(STDOUT).'>', + $_out_handler, + fileno(STDERR).'>', + $_err_handler + ) + }; + + ### all is well + if( $ok ) { + return $self->ok( $ok ); + + ### some error occurred + } else { + $self->ok( 0 ); + + ### if the eval fails due to an exception, deal with it + ### unless it's an alarm + if( $@ and not UNIVERSAL::isa( $@, ALARM_CLASS ) ) { + $self->error( $@ ); + + ### if it *is* an alarm, propagate + } elsif( $@ ) { + die $@; + + ### some error in the sub command + } else { + $self->error( $self->_pp_child_error( $cmd, $? ) ); + } + + return; + } + } +} + +sub _system_run { + my $self = shift; + my $cmd = shift; + my $verbose = shift || 0; + + ### pipes have to come in a quoted string, and that clashes with + ### whitespace. This sub fixes up such commands so they run properly + $cmd = $self->__fix_cmd_whitespace_and_special_chars( $cmd ); + + my @fds_to_dup = $verbose ? () : qw[STDOUT STDERR]; + $self->_fds( \@fds_to_dup ); + $self->__dup_fds( @fds_to_dup ); + + ### system returns 'true' on failure -- the exit code of the cmd + $self->ok( 1 ); + system( ref $cmd ? @$cmd : $cmd ) == 0 or do { + $self->error( $self->_pp_child_error( $cmd, $? ) ); + $self->ok( 0 ); + }; + + ### done in the parent call now + #$self->__reopen_fds( @fds_to_dup ); + + return unless $self->ok; + return $self->ok; +} + +{ my %sc_lookup = map { $_ => $_ } SPECIAL_CHARS; + + + sub __fix_cmd_whitespace_and_special_chars { + my $self = shift; + my $cmd = shift; + + ### command has a special char in it + if( ref $cmd and grep { $sc_lookup{$_} } @$cmd ) { + + ### since we have special chars, we have to quote white space + ### this *may* conflict with the parsing :( + my $fixed; + my @cmd = map { / / ? do { $fixed++; QUOTE.$_.QUOTE } : $_ } @$cmd; + + $self->_debug( "# Quoted $fixed arguments containing whitespace" ) + if $DEBUG && $fixed; + + ### stringify it, so the special char isn't escaped as argument + ### to the program + $cmd = join ' ', @cmd; + } + + return $cmd; + } +} + +### Command-line arguments (but not the command itself) must be quoted +### to ensure case preservation. Borrowed from Module::Build with adaptations. +### Patch for this supplied by Craig Berry, see RT #46288: [PATCH] Add argument +### quoting for run() on VMS +sub _quote_args_vms { + ### Returns a command string with proper quoting so that the subprocess + ### sees this same list of args, or if we get a single arg that is an + ### array reference, quote the elements of it (except for the first) + ### and return the reference. + my @args = @_; + my $got_arrayref = (scalar(@args) == 1 + && UNIVERSAL::isa($args[0], 'ARRAY')) + ? 1 + : 0; + + @args = split(/\s+/, $args[0]) unless $got_arrayref || scalar(@args) > 1; + + my $cmd = $got_arrayref ? shift @{$args[0]} : shift @args; + + ### Do not quote qualifiers that begin with '/' or previously quoted args. + map { if (/^[^\/\"]/) { + $_ =~ s/\"/""/g; # escape C<"> by doubling + $_ = q(").$_.q("); + } + } + ($got_arrayref ? @{$args[0]} + : @args + ); + + $got_arrayref ? unshift(@{$args[0]}, $cmd) : unshift(@args, $cmd); + + return $got_arrayref ? $args[0] + : join(' ', @args); +} + + +### XXX this is cribbed STRAIGHT from M::B 0.30 here: +### http://search.cpan.org/src/KWILLIAMS/Module-Build-0.30/lib/Module/Build/Platform/Windows.pm:split_like_shell +### XXX this *should* be integrated into text::parsewords +sub _split_like_shell_win32 { + # As it turns out, Windows command-parsing is very different from + # Unix command-parsing. Double-quotes mean different things, + # backslashes don't necessarily mean escapes, and so on. So we + # can't use Text::ParseWords::shellwords() to break a command string + # into words. The algorithm below was bashed out by Randy and Ken + # (mostly Randy), and there are a lot of regression tests, so we + # should feel free to adjust if desired. + + local $_ = shift; + + my @argv; + return @argv unless defined() && length(); + + my $arg = ''; + my( $i, $quote_mode ) = ( 0, 0 ); + + while ( $i < length() ) { + + my $ch = substr( $_, $i , 1 ); + my $next_ch = substr( $_, $i+1, 1 ); + + if ( $ch eq '\\' && $next_ch eq '"' ) { + $arg .= '"'; + $i++; + } elsif ( $ch eq '\\' && $next_ch eq '\\' ) { + $arg .= '\\'; + $i++; + } elsif ( $ch eq '"' && $next_ch eq '"' && $quote_mode ) { + $quote_mode = !$quote_mode; + $arg .= '"'; + $i++; + } elsif ( $ch eq '"' && $next_ch eq '"' && !$quote_mode && + ( $i + 2 == length() || + substr( $_, $i + 2, 1 ) eq ' ' ) + ) { # for cases like: a"" => [ 'a' ] + push( @argv, $arg ); + $arg = ''; + $i += 2; + } elsif ( $ch eq '"' ) { + $quote_mode = !$quote_mode; + } elsif ( $ch eq ' ' && !$quote_mode ) { + push( @argv, $arg ) if defined( $arg ) && length( $arg ); + $arg = ''; + ++$i while substr( $_, $i + 1, 1 ) eq ' '; + } else { + $arg .= $ch; + } + + $i++; + } + + push( @argv, $arg ) if defined( $arg ) && length( $arg ); + return @argv; +} + + + +{ use File::Spec; + use Symbol; + + my %Map = ( + STDOUT => [qw|>&|, \*STDOUT, Symbol::gensym() ], + STDERR => [qw|>&|, \*STDERR, Symbol::gensym() ], + STDIN => [qw|<&|, \*STDIN, Symbol::gensym() ], + ); + + ### dups FDs and stores them in a cache + sub __dup_fds { + my $self = shift; + my @fds = @_; + + __PACKAGE__->_debug( "# Closing the following fds: @fds" ) if $DEBUG; + + for my $name ( @fds ) { + my($redir, $fh, $glob) = @{$Map{$name}} or ( + Carp::carp(loc("No such FD: '%1'", $name)), next ); + + ### MUST use the 2-arg version of open for dup'ing for + ### 5.6.x compatibility. 5.8.x can use 3-arg open + ### see perldoc5.6.2 -f open for details + open $glob, $redir . fileno($fh) or ( + Carp::carp(loc("Could not dup '$name': %1", $!)), + return + ); + + ### we should re-open this filehandle right now, not + ### just dup it + ### Use 2-arg version of open, as 5.5.x doesn't support + ### 3-arg version =/ + if( $redir eq '>&' ) { + open( $fh, '>' . File::Spec->devnull ) or ( + Carp::carp(loc("Could not reopen '$name': %1", $!)), + return + ); + } + } + + return 1; + } + + ### reopens FDs from the cache + sub __reopen_fds { + my $self = shift; + my @fds = @_; + + __PACKAGE__->_debug( "# Reopening the following fds: @fds" ) if $DEBUG; + + for my $name ( @fds ) { + my($redir, $fh, $glob) = @{$Map{$name}} or ( + Carp::carp(loc("No such FD: '%1'", $name)), next ); + + ### MUST use the 2-arg version of open for dup'ing for + ### 5.6.x compatibility. 5.8.x can use 3-arg open + ### see perldoc5.6.2 -f open for details + open( $fh, $redir . fileno($glob) ) or ( + Carp::carp(loc("Could not restore '$name': %1", $!)), + return + ); + + ### close this FD, we're not using it anymore + close $glob; + } + return 1; + + } +} + +sub _debug { + my $self = shift; + my $msg = shift or return; + my $level = shift || 0; + + local $Carp::CarpLevel += $level; + Carp::carp($msg); + + return 1; +} + +sub _pp_child_error { + my $self = shift; + my $cmd = shift or return; + my $ce = shift or return; + my $pp_cmd = ref $cmd ? "@$cmd" : $cmd; + + + my $str; + if( $ce == -1 ) { + ### Include $! in the error message, so that the user can + ### see 'No such file or directory' versus 'Permission denied' + ### versus 'Cannot fork' or whatever the cause was. + $str = "Failed to execute '$pp_cmd': $!"; + + } elsif ( $ce & 127 ) { + ### some signal + $str = loc( "'%1' died with signal %2, %3 coredump", + $pp_cmd, ($ce & 127), ($ce & 128) ? 'with' : 'without'); + + } else { + ### Otherwise, the command run but gave error status. + $str = "'$pp_cmd' exited with value " . ($ce >> 8); + } + + $self->_debug( "# Child error '$ce' translated to: $str" ) if $DEBUG; + + return $str; +} + +1; + +__END__ + +=head2 $q = QUOTE + +Returns the character used for quoting strings on this platform. This is +usually a C<'> (single quote) on most systems, but some systems use different +quotes. For example, C<Win32> uses C<"> (double quote). + +You can use it as follows: + + use IPC::Cmd qw[run QUOTE]; + my $cmd = q[echo ] . QUOTE . q[foo bar] . QUOTE; + +This makes sure that C<foo bar> is treated as a string, rather than two +separate arguments to the C<echo> function. + +=head1 HOW IT WORKS + +C<run> will try to execute your command using the following logic: + +=over 4 + +=item * + +If you have C<IPC::Run> installed, and the variable C<$IPC::Cmd::USE_IPC_RUN> +is set to true (See the L<"Global Variables"> section) use that to execute +the command. You will have the full output available in buffers, interactive commands +are sure to work and you are guaranteed to have your verbosity +settings honored cleanly. + +=item * + +Otherwise, if the variable C<$IPC::Cmd::USE_IPC_OPEN3> is set to true +(See the L<"Global Variables"> section), try to execute the command using +L<IPC::Open3>. Buffers will be available on all platforms, +interactive commands will still execute cleanly, and also your verbosity +settings will be adhered to nicely; + +=item * + +Otherwise, if you have the C<verbose> argument set to true, we fall back +to a simple C<system()> call. We cannot capture any buffers, but +interactive commands will still work. + +=item * + +Otherwise we will try and temporarily redirect STDERR and STDOUT, do a +C<system()> call with your command and then re-open STDERR and STDOUT. +This is the method of last resort and will still allow you to execute +your commands cleanly. However, no buffers will be available. + +=back + +=head1 Global Variables + +The behaviour of IPC::Cmd can be altered by changing the following +global variables: + +=head2 $IPC::Cmd::VERBOSE + +This controls whether IPC::Cmd will print any output from the +commands to the screen or not. The default is 0. + +=head2 $IPC::Cmd::USE_IPC_RUN + +This variable controls whether IPC::Cmd will try to use L<IPC::Run> +when available and suitable. + +=head2 $IPC::Cmd::USE_IPC_OPEN3 + +This variable controls whether IPC::Cmd will try to use L<IPC::Open3> +when available and suitable. Defaults to true. + +=head2 $IPC::Cmd::WARN + +This variable controls whether run-time warnings should be issued, like +the failure to load an C<IPC::*> module you explicitly requested. + +Defaults to true. Turn this off at your own risk. + +=head2 $IPC::Cmd::INSTANCES + +This variable controls whether C<can_run> will return all instances of +the binary it finds in the C<PATH> when called in a list context. + +Defaults to false, set to true to enable the described behaviour. + +=head2 $IPC::Cmd::ALLOW_NULL_ARGS + +This variable controls whether C<run> will remove any empty/null arguments +it finds in command arguments. + +Defaults to false, so it will remove null arguments. Set to true to allow +them. + +=head1 Caveats + +=over 4 + +=item Whitespace and IPC::Open3 / system() + +When using C<IPC::Open3> or C<system>, if you provide a string as the +C<command> argument, it is assumed to be appropriately escaped. You can +use the C<QUOTE> constant to use as a portable quote character (see above). +However, if you provide an array reference, special rules apply: + +If your command contains B<special characters> (< > | &), it will +be internally stringified before executing the command, to avoid that these +special characters are escaped and passed as arguments instead of retaining +their special meaning. + +However, if the command contained arguments that contained whitespace, +stringifying the command would lose the significance of the whitespace. +Therefore, C<IPC::Cmd> will quote any arguments containing whitespace in your +command if the command is passed as an arrayref and contains special characters. + +=item Whitespace and IPC::Run + +When using C<IPC::Run>, if you provide a string as the C<command> argument, +the string will be split on whitespace to determine the individual elements +of your command. Although this will usually just Do What You Mean, it may +break if you have files or commands with whitespace in them. + +If you do not wish this to happen, you should provide an array +reference, where all parts of your command are already separated out. +Note however, if there are extra or spurious whitespaces in these parts, +the parser or underlying code may not interpret it correctly, and +cause an error. + +Example: +The following code + + gzip -cdf foo.tar.gz | tar -xf - + +should either be passed as + + "gzip -cdf foo.tar.gz | tar -xf -" + +or as + + ['gzip', '-cdf', 'foo.tar.gz', '|', 'tar', '-xf', '-'] + +But take care not to pass it as, for example + + ['gzip -cdf foo.tar.gz', '|', 'tar -xf -'] + +Since this will lead to issues as described above. + + +=item IO Redirect + +Currently it is too complicated to parse your command for IO +redirections. For capturing STDOUT or STDERR there is a work around +however, since you can just inspect your buffers for the contents. + +=item Interleaving STDOUT/STDERR + +Neither IPC::Run nor IPC::Open3 can interleave STDOUT and STDERR. For short +bursts of output from a program, e.g. this sample, + + for ( 1..4 ) { + $_ % 2 ? print STDOUT $_ : print STDERR $_; + } + +IPC::[Run|Open3] will first read all of STDOUT, then all of STDERR, meaning +the output looks like '13' on STDOUT and '24' on STDERR, instead of + + 1 + 2 + 3 + 4 + +This has been recorded in L<rt.cpan.org> as bug #37532: Unable to interleave +STDOUT and STDERR. + +=back + +=head1 See Also + +L<IPC::Run>, L<IPC::Open3> + +=head1 ACKNOWLEDGEMENTS + +Thanks to James Mastros and Martijn van der Streek for their +help in getting L<IPC::Open3> to behave nicely. + +Thanks to Petya Kohts for the C<run_forked> code. + +=head1 BUG REPORTS + +Please report bugs or other issues to E<lt>bug-ipc-cmd@rt.cpan.orgE<gt>. + +=head1 AUTHOR + +Original author: Jos Boumans E<lt>kane@cpan.orgE<gt>. +Current maintainer: Chris Williams E<lt>bingos@cpan.orgE<gt>. + +=head1 COPYRIGHT + +This library is free software; you may redistribute and/or modify it +under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/IPC/Open2.pm b/data/miniconda3/lib/perl5/core_perl/IPC/Open2.pm new file mode 100644 index 0000000000000000000000000000000000000000..cd330507990020e17a08691b3a4bff0554682d84 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/IPC/Open2.pm @@ -0,0 +1,124 @@ +package IPC::Open2; + +use strict; +our ($VERSION, @ISA, @EXPORT); + +require 5.000; +require Exporter; + +$VERSION = 1.05; +@ISA = qw(Exporter); +@EXPORT = qw(open2); + +=head1 NAME + +IPC::Open2 - open a process for both reading and writing using open2() + +=head1 SYNOPSIS + + use IPC::Open2; + + my $pid = open2(my $chld_out, my $chld_in, + 'some', 'cmd', 'and', 'args'); + # or passing the command through the shell + my $pid = open2(my $chld_out, my $chld_in, 'some cmd and args'); + + # read from parent STDIN and write to already open handle + open my $outfile, '>', 'outfile.txt' or die "open failed: $!"; + my $pid = open2($outfile, '<&STDIN', 'some', 'cmd', 'and', 'args'); + + # read from already open handle and write to parent STDOUT + open my $infile, '<', 'infile.txt' or die "open failed: $!"; + my $pid = open2('>&STDOUT', $infile, 'some', 'cmd', 'and', 'args'); + + # reap zombie and retrieve exit status + waitpid( $pid, 0 ); + my $child_exit_status = $? >> 8; + +=head1 DESCRIPTION + +The open2() function runs the given command and connects $chld_out for +reading and $chld_in for writing. It's what you think should work +when you try + + my $pid = open(my $fh, "|cmd args|"); + +The $chld_in filehandle will have autoflush turned on. + +If $chld_out is a string (that is, a bareword filehandle rather than a glob +or a reference) and it begins with C<< >& >>, then the child will send output +directly to that file handle. If $chld_in is a string that begins with +C<< <& >>, then $chld_in will be closed in the parent, and the child will +read from it directly. In both cases, there will be a L<dup(2)> instead of a +L<pipe(2)> made. + +If either reader or writer is the empty string or undefined, this will be +replaced by an autogenerated filehandle. If so, you must pass a valid lvalue +in the parameter slot so it can be overwritten in the caller, or +an exception will be raised. + +open2() returns the process ID of the child process. It doesn't return on +failure: it just raises an exception matching C</^open2:/>. However, +C<exec> failures in the child are not detected. You'll have to +trap SIGPIPE yourself. + +open2() does not wait for and reap the child process after it exits. +Except for short programs where it's acceptable to let the operating system +take care of this, you need to do this yourself. This is normally as +simple as calling C<waitpid $pid, 0> when you're done with the process. +Failing to do this can result in an accumulation of defunct or "zombie" +processes. See L<perlfunc/waitpid> for more information. + +This whole affair is quite dangerous, as you may block forever. It +assumes it's going to talk to something like L<bc(1)>, both writing +to it and reading from it. This is presumably safe because you +"know" that commands like L<bc(1)> will read a line at a time and +output a line at a time. Programs like L<sort(1)> that read their +entire input stream first, however, are quite apt to cause deadlock. + +The big problem with this approach is that if you don't have control +over source code being run in the child process, you can't control +what it does with pipe buffering. Thus you can't just open a pipe to +C<cat -v> and continually read and write a line from it. + +The L<IO::Pty> and L<Expect> modules from CPAN can help with this, as +they provide a real tty (well, a pseudo-tty, actually), which gets you +back to line buffering in the invoked command again. + +=head1 WARNING + +The order of arguments differs from that of open3(). + +=head1 SEE ALSO + +See L<IPC::Open3> for an alternative that handles STDERR as well. This +function is really just a wrapper around open3(). + +=cut + +# &open2: tom christiansen, <tchrist@convex.com> +# +# usage: $pid = open2('rdr', 'wtr', 'some cmd and args'); +# or $pid = open2('rdr', 'wtr', 'some', 'cmd', 'and', 'args'); +# +# spawn the given $cmd and connect $rdr for +# reading and $wtr for writing. return pid +# of child, or 0 on failure. +# +# WARNING: this is dangerous, as you may block forever +# unless you are very careful. +# +# $wtr is left unbuffered. +# +# abort program if +# rdr or wtr are null +# a system call fails + +require IPC::Open3; + +sub open2 { + local $Carp::CarpLevel = $Carp::CarpLevel + 1; + return IPC::Open3::_open3('open2', $_[1], $_[0], '>&STDERR', @_[2 .. $#_]); +} + +1 diff --git a/data/miniconda3/lib/perl5/core_perl/IPC/Open3.pm b/data/miniconda3/lib/perl5/core_perl/IPC/Open3.pm new file mode 100644 index 0000000000000000000000000000000000000000..ce39d78f1ead9d4f00245155acabef282859be1f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/IPC/Open3.pm @@ -0,0 +1,444 @@ +package IPC::Open3; + +use strict; +no strict 'refs'; # because users pass me bareword filehandles +our ($VERSION, @ISA, @EXPORT); + +require Exporter; + +use Carp; +use Symbol qw(gensym qualify); + +$VERSION = '1.21'; +@ISA = qw(Exporter); +@EXPORT = qw(open3); + +=head1 NAME + +IPC::Open3 - open a process for reading, writing, and error handling using open3() + +=head1 SYNOPSIS + + use Symbol 'gensym'; # vivify a separate handle for STDERR + my $pid = open3(my $chld_in, my $chld_out, my $chld_err = gensym, + 'some', 'cmd', 'and', 'args'); + # or pass the command through the shell + my $pid = open3(my $chld_in, my $chld_out, my $chld_err = gensym, + 'some cmd and args'); + + # read from parent STDIN + # send STDOUT and STDERR to already open handle + open my $outfile, '>>', 'output.txt' or die "open failed: $!"; + my $pid = open3('<&STDIN', $outfile, undef, + 'some', 'cmd', 'and', 'args'); + + # write to parent STDOUT and STDERR + my $pid = open3(my $chld_in, '>&STDOUT', '>&STDERR', + 'some', 'cmd', 'and', 'args'); + + # reap zombie and retrieve exit status + waitpid( $pid, 0 ); + my $child_exit_status = $? >> 8; + +=head1 DESCRIPTION + +Extremely similar to open2(), open3() spawns the given command and +connects $chld_out for reading from the child, $chld_in for writing to +the child, and $chld_err for errors. If $chld_err is false, or the +same file descriptor as $chld_out, then STDOUT and STDERR of the child +are on the same filehandle. This means that an autovivified lexical +cannot be used for the STDERR filehandle, but gensym from L<Symbol> can +be used to vivify a new glob reference, see L</SYNOPSIS>. The $chld_in +will have autoflush turned on. + +If $chld_in begins with C<< <& >>, then $chld_in will be closed in the +parent, and the child will read from it directly. If $chld_out or +$chld_err begins with C<< >& >>, then the child will send output +directly to that filehandle. In both cases, there will be a L<dup(2)> +instead of a L<pipe(2)> made. + +If either reader or writer is the empty string or undefined, this will +be replaced by an autogenerated filehandle. If so, you must pass a +valid lvalue in the parameter slot so it can be overwritten in the +caller, or an exception will be raised. + +The filehandles may also be integers, in which case they are understood +as file descriptors. + +open3() returns the process ID of the child process. It doesn't return on +failure: it just raises an exception matching C</^open3:/>. However, +C<exec> failures in the child (such as no such file or permission denied), +are just reported to $chld_err under Windows and OS/2, as it is not possible +to trap them. + +If the child process dies for any reason, the next write to $chld_in is +likely to generate a SIGPIPE in the parent, which is fatal by default. +So you may wish to handle this signal. + +Note if you specify C<-> as the command, in an analogous fashion to +C<open(my $fh, "-|")> the child process will just be the forked Perl +process rather than an external command. This feature isn't yet +supported on Win32 platforms. + +open3() does not wait for and reap the child process after it exits. +Except for short programs where it's acceptable to let the operating system +take care of this, you need to do this yourself. This is normally as +simple as calling C<waitpid $pid, 0> when you're done with the process. +Failing to do this can result in an accumulation of defunct or "zombie" +processes. See L<perlfunc/waitpid> for more information. + +If you try to read from the child's stdout writer and their stderr +writer, you'll have problems with blocking, which means you'll want +to use select() or L<IO::Select>, which means you'd best use +sysread() instead of readline() for normal stuff. + +This is very dangerous, as you may block forever. It assumes it's +going to talk to something like L<bc(1)>, both writing to it and reading +from it. This is presumably safe because you "know" that commands +like L<bc(1)> will read a line at a time and output a line at a time. +Programs like L<sort(1)> that read their entire input stream first, +however, are quite apt to cause deadlock. + +The big problem with this approach is that if you don't have control +over source code being run in the child process, you can't control +what it does with pipe buffering. Thus you can't just open a pipe to +C<cat -v> and continually read and write a line from it. + +=head1 See Also + +=over 4 + +=item L<IPC::Open2> + +Like Open3 but without STDERR capture. + +=item L<IPC::Run> + +This is a CPAN module that has better error handling and more facilities +than Open3. + +=back + +=head1 WARNING + +The order of arguments differs from that of open2(). + +=cut + +# &open3: Marc Horowitz <marc@mit.edu> +# derived mostly from &open2 by tom christiansen, <tchrist@convex.com> +# fixed for 5.001 by Ulrich Kunitz <kunitz@mai-koeln.com> +# ported to Win32 by Ron Schmidt, Merrill Lynch almost ended my career +# fixed for autovivving FHs, tchrist again +# allow fd numbers to be used, by Frank Tobin +# allow '-' as command (c.f. open "-|"), by Adam Spiers <perl@adamspiers.org> +# +# usage: $pid = open3('wtr', 'rdr', 'err' 'some cmd and args', 'optarg', ...); +# +# spawn the given $cmd and connect rdr for +# reading, wtr for writing, and err for errors. +# if err is '', or the same as rdr, then stdout and +# stderr of the child are on the same fh. returns pid +# of child (or dies on failure). + + +# if wtr begins with '<&', then wtr will be closed in the parent, and +# the child will read from it directly. if rdr or err begins with +# '>&', then the child will send output directly to that fd. In both +# cases, there will be a dup() instead of a pipe() made. + + +# WARNING: this is dangerous, as you may block forever +# unless you are very careful. +# +# $wtr is left unbuffered. +# +# abort program if +# rdr or wtr are null +# a system call fails + +our $Me = 'open3 (bug)'; # you should never see this, it's always localized + +# Fatal.pm needs to be fixed WRT prototypes. + +sub xpipe { + pipe $_[0], $_[1] or croak "$Me: pipe($_[0], $_[1]) failed: $!"; +} + +# I tried using a * prototype character for the filehandle but it still +# disallows a bareword while compiling under strict subs. + +sub xopen { + open $_[0], $_[1], @_[2..$#_] and return; + local $" = ', '; + carp "$Me: open(@_) failed: $!"; +} + +sub xclose { + $_[0] =~ /\A=?(\d+)\z/ + ? do { my $fh; open($fh, $_[1] . '&=' . $1) and close($fh); } + : close $_[0] + or croak "$Me: close($_[0]) failed: $!"; +} + +sub xfileno { + return $1 if $_[0] =~ /\A=?(\d+)\z/; # deal with fh just being an fd + return fileno $_[0]; +} + +use constant FORCE_DEBUG_SPAWN => 0; +use constant DO_SPAWN => $^O eq 'os2' || $^O eq 'MSWin32' || FORCE_DEBUG_SPAWN; + +sub _open3 { + local $Me = shift; + + # simulate autovivification of filehandles because + # it's too ugly to use @_ throughout to make perl do it for us + # tchrist 5-Mar-00 + + # Historically, open3(undef...) has silently worked, so keep + # it working. + splice @_, 0, 1, undef if \$_[0] == \undef; + splice @_, 1, 1, undef if \$_[1] == \undef; + unless (eval { + $_[0] = gensym unless defined $_[0] && length $_[0]; + $_[1] = gensym unless defined $_[1] && length $_[1]; + 1; }) + { + # must strip crud for croak to add back, or looks ugly + $@ =~ s/(?<=value attempted) at .*//s; + croak "$Me: $@"; + } + + my @handles = ({ mode => '<', handle => \*STDIN }, + { mode => '>', handle => \*STDOUT }, + { mode => '>', handle => \*STDERR }, + ); + + foreach (@handles) { + $_->{parent} = shift; + $_->{open_as} = gensym; + } + + if (@_ > 1 and $_[0] eq '-') { + croak "Arguments don't make sense when the command is '-'" + } + + $handles[2]{parent} ||= $handles[1]{parent}; + $handles[2]{dup_of_out} = $handles[1]{parent} eq $handles[2]{parent}; + + my $package; + foreach (@handles) { + $_->{dup} = ($_->{parent} =~ s/^[<>]&//); + + if ($_->{parent} !~ /\A=?(\d+)\z/) { + # force unqualified filehandles into caller's package + $package //= caller 1; + $_->{parent} = qualify $_->{parent}, $package; + } + + next if $_->{dup} or $_->{dup_of_out}; + if ($_->{mode} eq '<') { + xpipe $_->{open_as}, $_->{parent}; + } else { + xpipe $_->{parent}, $_->{open_as}; + } + } + + my $kidpid; + if (!DO_SPAWN) { + # Used to communicate exec failures. + xpipe my $stat_r, my $stat_w; + + $kidpid = fork; + croak "$Me: fork failed: $!" unless defined $kidpid; + if ($kidpid == 0) { # Kid + eval { + # A tie in the parent should not be allowed to cause problems. + untie *STDIN; + untie *STDOUT; + untie *STDERR; + + close $stat_r; + require Fcntl; + my $flags = fcntl $stat_w, &Fcntl::F_GETFD, 0; + croak "$Me: fcntl failed: $!" unless $flags; + fcntl $stat_w, &Fcntl::F_SETFD, $flags|&Fcntl::FD_CLOEXEC + or croak "$Me: fcntl failed: $!"; + + # If she wants to dup the kid's stderr onto her stdout I need to + # save a copy of her stdout before I put something else there. + if (!$handles[2]{dup_of_out} && $handles[2]{dup} + && xfileno($handles[2]{parent}) == fileno \*STDOUT) { + my $tmp = gensym; + xopen($tmp, '>&', $handles[2]{parent}); + $handles[2]{parent} = $tmp; + } + + foreach (@handles) { + if ($_->{dup_of_out}) { + xopen \*STDERR, ">&STDOUT" + if defined fileno STDERR && fileno STDERR != fileno STDOUT; + } elsif ($_->{dup}) { + xopen $_->{handle}, $_->{mode} . '&', $_->{parent} + if fileno $_->{handle} != xfileno($_->{parent}); + } else { + xclose $_->{parent}, $_->{mode}; + xopen $_->{handle}, $_->{mode} . '&=', + fileno $_->{open_as}; + } + } + return 1 if ($_[0] eq '-'); + exec @_ or do { + local($")=(" "); + croak "$Me: exec of @_ failed: $!"; + }; + } and do { + close $stat_w; + return 0; + }; + + my $bang = 0+$!; + my $err = $@; + utf8::encode $err if $] >= 5.008; + print $stat_w pack('IIa*', $bang, length($err), $err); + close $stat_w; + + eval { require POSIX; POSIX::_exit(255); }; + exit 255; + } + else { # Parent + close $stat_w; + my $to_read = length(pack('I', 0)) * 2; + my $bytes_read = read($stat_r, my $buf = '', $to_read); + if ($bytes_read) { + (my $bang, $to_read) = unpack('II', $buf); + read($stat_r, my $err = '', $to_read); + waitpid $kidpid, 0; # Reap child which should have exited + if ($err) { + utf8::decode $err if $] >= 5.008; + } else { + $err = "$Me: " . ($! = $bang); + } + $! = $bang; + die($err); + } + } + } + else { # DO_SPAWN + # All the bookkeeping of coincidence between handles is + # handled in spawn_with_handles. + + my @close; + + foreach (@handles) { + if ($_->{dup_of_out}) { + $_->{open_as} = $handles[1]{open_as}; + } elsif ($_->{dup}) { + $_->{open_as} = $_->{parent} =~ /\A[0-9]+\z/ + ? $_->{parent} : \*{$_->{parent}}; + push @close, $_->{open_as}; + } else { + push @close, \*{$_->{parent}}, $_->{open_as}; + } + } + require IO::Pipe; + $kidpid = eval { + spawn_with_handles(\@handles, \@close, @_); + }; + die "$Me: $@" if $@; + } + + foreach (@handles) { + next if $_->{dup} or $_->{dup_of_out}; + xclose $_->{open_as}, $_->{mode}; + } + + # If the write handle is a dup give it away entirely, close my copy + # of it. + xclose $handles[0]{parent}, $handles[0]{mode} if $handles[0]{dup}; + + select((select($handles[0]{parent}), $| = 1)[0]); # unbuffer pipe + $kidpid; +} + +sub open3 { + if (@_ < 4) { + local $" = ', '; + croak "open3(@_): not enough arguments"; + } + return _open3 'open3', @_ +} + +sub spawn_with_handles { + my $fds = shift; # Fields: handle, mode, open_as + my $close_in_child = shift; + my ($fd, %saved, @errs); + + foreach $fd (@$fds) { + $fd->{tmp_copy} = IO::Handle->new_from_fd($fd->{handle}, $fd->{mode}); + $saved{fileno $fd->{handle}} = $fd->{tmp_copy} if $fd->{tmp_copy}; + } + foreach $fd (@$fds) { + bless $fd->{handle}, 'IO::Handle' + unless eval { $fd->{handle}->isa('IO::Handle') } ; + # If some of handles to redirect-to coincide with handles to + # redirect, we need to use saved variants: + my $open_as = $fd->{open_as}; + my $fileno = fileno($open_as); + $fd->{handle}->fdopen(defined($fileno) + ? $saved{$fileno} || $open_as + : $open_as, + $fd->{mode}); + } + unless ($^O eq 'MSWin32') { + require Fcntl; + # Stderr may be redirected below, so we save the err text: + foreach $fd (@$close_in_child) { + next unless fileno $fd; + fcntl($fd, Fcntl::F_SETFD(), 1) or push @errs, "fcntl $fd: $!" + unless $saved{fileno $fd}; # Do not close what we redirect! + } + } + + my $pid; + unless (@errs) { + if (FORCE_DEBUG_SPAWN) { + pipe my $r, my $w or die "Pipe failed: $!"; + $pid = fork; + die "Fork failed: $!" unless defined $pid; + if (!$pid) { + { no warnings; exec @_ } + print $w 0 + $!; + close $w; + require POSIX; + POSIX::_exit(255); + } + close $w; + my $bad = <$r>; + if (defined $bad) { + $! = $bad; + undef $pid; + } + } else { + $pid = eval { system 1, @_ }; # 1 == P_NOWAIT + } + if($@) { + push @errs, "IO::Pipe: Can't spawn-NOWAIT: $@"; + } elsif(!$pid || $pid < 0) { + push @errs, "IO::Pipe: Can't spawn-NOWAIT: $!"; + } + } + + # Do this in reverse, so that STDERR is restored first: + foreach $fd (reverse @$fds) { + $fd->{handle}->fdopen($fd->{tmp_copy}, $fd->{mode}); + } + foreach (values %saved) { + $_->close or croak "Can't close: $!"; + } + croak join "\n", @errs if @errs; + return $pid; +} + +1; # so require is happy diff --git a/data/miniconda3/lib/perl5/core_perl/Internals.pod b/data/miniconda3/lib/perl5/core_perl/Internals.pod new file mode 100644 index 0000000000000000000000000000000000000000..454ab0deb504bda15f41fa9ebacb8bd07414f815 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Internals.pod @@ -0,0 +1,78 @@ +=head1 NAME + +Internals - Reserved special namespace for internals related functions + +=head1 SYNOPSIS + + $is_ro= Internals::SvREADONLY($x) + $refcnt= Internals::SvREFCNT($x) + hv_clear_placeholders(%hash); + +=head1 DESCRIPTION + +The Internals namespace is used by the core Perl development team to +expose certain low level internals routines for testing and other purposes. + +In theory these routines were not and are not intended to be used outside +of the perl core, and are subject to change and removal at any time. + +In practice people have come to depend on these over the years, despite +being historically undocumented, so we will provide some level of +forward compatibility for some time. Nevertheless you can assume that any +routine documented here is experimental or deprecated and you should find +alternatives to their use. + +=head2 FUNCTIONS + +=over 4 + +=item SvREFCNT(THING [, $value]) + +Historically Perl has been a refcounted language. This means that each +variable tracks how many things reference it, and when the variable is no +longer referenced it will automatically free itself. In theory Perl code +should not have to care about this, and in a future version Perl might +change to some other strategy, although in practice this is unlikely. + +This function allows one to violate the abstraction of variables and get +or set the refcount of a variable, and in generally is really only useful +in code that is testing refcount behavior. + +*NOTE* You are strongly discouraged from using this function in non-test +code and especially discouraged from using the set form of this function. +The results of doing so may result in segmentation faults or other undefined +behavior. + +=item SvREADONLY(THING, [, $value]) + +Set or get whether a variable is readonly or not. Exactly what the +readonly flag means depend on the type of the variable affected and the +version of perl used. + +You are strongly discouraged from using this function directly. It is used +by various core modules, like C<Hash::Util>, and the C<constant> pragma +to implement higher-level behavior which should be used instead. + +See the core implementation for the exact meaning of the readonly flag for +each internal variable type. + +=item hv_clear_placeholders(%hash) + +Clear any placeholders from a locked hash. Should not be used directly. +You should use the wrapper functions provided by Hash::Util instead. +As of 5.25 also available as C< Hash::Util::_clear_placeholders(%hash) > + +=back + +=head1 AUTHOR + +Perl core development team. + +=head1 SEE ALSO + +L<perlguts> +L<Hash::Util> +L<constant> +universal.c + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/JSON/PP.pm b/data/miniconda3/lib/perl5/core_perl/JSON/PP.pm new file mode 100644 index 0000000000000000000000000000000000000000..9f083542851f877e705b3d3770971d9186c1dc4e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/JSON/PP.pm @@ -0,0 +1,3147 @@ +package JSON::PP; + +# JSON-2.0 + +use 5.005; +use strict; + +use Exporter (); +BEGIN { @JSON::PP::ISA = ('Exporter') } + +use overload (); +use JSON::PP::Boolean; + +use Carp (); +#use Devel::Peek; + +$JSON::PP::VERSION = '4.04'; + +@JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json); + +# instead of hash-access, i tried index-access for speed. +# but this method is not faster than what i expected. so it will be changed. + +use constant P_ASCII => 0; +use constant P_LATIN1 => 1; +use constant P_UTF8 => 2; +use constant P_INDENT => 3; +use constant P_CANONICAL => 4; +use constant P_SPACE_BEFORE => 5; +use constant P_SPACE_AFTER => 6; +use constant P_ALLOW_NONREF => 7; +use constant P_SHRINK => 8; +use constant P_ALLOW_BLESSED => 9; +use constant P_CONVERT_BLESSED => 10; +use constant P_RELAXED => 11; + +use constant P_LOOSE => 12; +use constant P_ALLOW_BIGNUM => 13; +use constant P_ALLOW_BAREKEY => 14; +use constant P_ALLOW_SINGLEQUOTE => 15; +use constant P_ESCAPE_SLASH => 16; +use constant P_AS_NONBLESSED => 17; + +use constant P_ALLOW_UNKNOWN => 18; +use constant P_ALLOW_TAGS => 19; + +use constant OLD_PERL => $] < 5.008 ? 1 : 0; +use constant USE_B => $ENV{PERL_JSON_PP_USE_B} || 0; + +BEGIN { + if (USE_B) { + require B; + } +} + +BEGIN { + my @xs_compati_bit_properties = qw( + latin1 ascii utf8 indent canonical space_before space_after allow_nonref shrink + allow_blessed convert_blessed relaxed allow_unknown + allow_tags + ); + my @pp_bit_properties = qw( + allow_singlequote allow_bignum loose + allow_barekey escape_slash as_nonblessed + ); + + # Perl version check, Unicode handling is enabled? + # Helper module sets @JSON::PP::_properties. + if ( OLD_PERL ) { + my $helper = $] >= 5.006 ? 'JSON::PP::Compat5006' : 'JSON::PP::Compat5005'; + eval qq| require $helper |; + if ($@) { Carp::croak $@; } + } + + for my $name (@xs_compati_bit_properties, @pp_bit_properties) { + my $property_id = 'P_' . uc($name); + + eval qq/ + sub $name { + my \$enable = defined \$_[1] ? \$_[1] : 1; + + if (\$enable) { + \$_[0]->{PROPS}->[$property_id] = 1; + } + else { + \$_[0]->{PROPS}->[$property_id] = 0; + } + + \$_[0]; + } + + sub get_$name { + \$_[0]->{PROPS}->[$property_id] ? 1 : ''; + } + /; + } + +} + + + +# Functions + +my $JSON; # cache + +sub encode_json ($) { # encode + ($JSON ||= __PACKAGE__->new->utf8)->encode(@_); +} + + +sub decode_json { # decode + ($JSON ||= __PACKAGE__->new->utf8)->decode(@_); +} + +# Obsoleted + +sub to_json($) { + Carp::croak ("JSON::PP::to_json has been renamed to encode_json."); +} + + +sub from_json($) { + Carp::croak ("JSON::PP::from_json has been renamed to decode_json."); +} + + +# Methods + +sub new { + my $class = shift; + my $self = { + max_depth => 512, + max_size => 0, + indent_length => 3, + }; + + $self->{PROPS}[P_ALLOW_NONREF] = 1; + + bless $self, $class; +} + + +sub encode { + return $_[0]->PP_encode_json($_[1]); +} + + +sub decode { + return $_[0]->PP_decode_json($_[1], 0x00000000); +} + + +sub decode_prefix { + return $_[0]->PP_decode_json($_[1], 0x00000001); +} + + +# accessor + + +# pretty printing + +sub pretty { + my ($self, $v) = @_; + my $enable = defined $v ? $v : 1; + + if ($enable) { # indent_length(3) for JSON::XS compatibility + $self->indent(1)->space_before(1)->space_after(1); + } + else { + $self->indent(0)->space_before(0)->space_after(0); + } + + $self; +} + +# etc + +sub max_depth { + my $max = defined $_[1] ? $_[1] : 0x80000000; + $_[0]->{max_depth} = $max; + $_[0]; +} + + +sub get_max_depth { $_[0]->{max_depth}; } + + +sub max_size { + my $max = defined $_[1] ? $_[1] : 0; + $_[0]->{max_size} = $max; + $_[0]; +} + + +sub get_max_size { $_[0]->{max_size}; } + +sub boolean_values { + my $self = shift; + if (@_) { + my ($false, $true) = @_; + $self->{false} = $false; + $self->{true} = $true; + return ($false, $true); + } else { + delete $self->{false}; + delete $self->{true}; + return; + } +} + +sub get_boolean_values { + my $self = shift; + if (exists $self->{true} and exists $self->{false}) { + return @$self{qw/false true/}; + } + return; +} + +sub filter_json_object { + if (defined $_[1] and ref $_[1] eq 'CODE') { + $_[0]->{cb_object} = $_[1]; + } else { + delete $_[0]->{cb_object}; + } + $_[0]->{F_HOOK} = ($_[0]->{cb_object} or $_[0]->{cb_sk_object}) ? 1 : 0; + $_[0]; +} + +sub filter_json_single_key_object { + if (@_ == 1 or @_ > 3) { + Carp::croak("Usage: JSON::PP::filter_json_single_key_object(self, key, callback = undef)"); + } + if (defined $_[2] and ref $_[2] eq 'CODE') { + $_[0]->{cb_sk_object}->{$_[1]} = $_[2]; + } else { + delete $_[0]->{cb_sk_object}->{$_[1]}; + delete $_[0]->{cb_sk_object} unless %{$_[0]->{cb_sk_object} || {}}; + } + $_[0]->{F_HOOK} = ($_[0]->{cb_object} or $_[0]->{cb_sk_object}) ? 1 : 0; + $_[0]; +} + +sub indent_length { + if (!defined $_[1] or $_[1] > 15 or $_[1] < 0) { + Carp::carp "The acceptable range of indent_length() is 0 to 15."; + } + else { + $_[0]->{indent_length} = $_[1]; + } + $_[0]; +} + +sub get_indent_length { + $_[0]->{indent_length}; +} + +sub sort_by { + $_[0]->{sort_by} = defined $_[1] ? $_[1] : 1; + $_[0]; +} + +sub allow_bigint { + Carp::carp("allow_bigint() is obsoleted. use allow_bignum() instead."); + $_[0]->allow_bignum; +} + +############################### + +### +### Perl => JSON +### + + +{ # Convert + + my $max_depth; + my $indent; + my $ascii; + my $latin1; + my $utf8; + my $space_before; + my $space_after; + my $canonical; + my $allow_blessed; + my $convert_blessed; + + my $indent_length; + my $escape_slash; + my $bignum; + my $as_nonblessed; + my $allow_tags; + + my $depth; + my $indent_count; + my $keysort; + + + sub PP_encode_json { + my $self = shift; + my $obj = shift; + + $indent_count = 0; + $depth = 0; + + my $props = $self->{PROPS}; + + ($ascii, $latin1, $utf8, $indent, $canonical, $space_before, $space_after, $allow_blessed, + $convert_blessed, $escape_slash, $bignum, $as_nonblessed, $allow_tags) + = @{$props}[P_ASCII .. P_SPACE_AFTER, P_ALLOW_BLESSED, P_CONVERT_BLESSED, + P_ESCAPE_SLASH, P_ALLOW_BIGNUM, P_AS_NONBLESSED, P_ALLOW_TAGS]; + + ($max_depth, $indent_length) = @{$self}{qw/max_depth indent_length/}; + + $keysort = $canonical ? sub { $a cmp $b } : undef; + + if ($self->{sort_by}) { + $keysort = ref($self->{sort_by}) eq 'CODE' ? $self->{sort_by} + : $self->{sort_by} =~ /\D+/ ? $self->{sort_by} + : sub { $a cmp $b }; + } + + encode_error("hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)") + if(!ref $obj and !$props->[ P_ALLOW_NONREF ]); + + my $str = $self->object_to_json($obj); + + $str .= "\n" if ( $indent ); # JSON::XS 2.26 compatible + + unless ($ascii or $latin1 or $utf8) { + utf8::upgrade($str); + } + + if ($props->[ P_SHRINK ]) { + utf8::downgrade($str, 1); + } + + return $str; + } + + + sub object_to_json { + my ($self, $obj) = @_; + my $type = ref($obj); + + if($type eq 'HASH'){ + return $self->hash_to_json($obj); + } + elsif($type eq 'ARRAY'){ + return $self->array_to_json($obj); + } + elsif ($type) { # blessed object? + if (blessed($obj)) { + + return $self->value_to_json($obj) if ( $obj->isa('JSON::PP::Boolean') ); + + if ( $allow_tags and $obj->can('FREEZE') ) { + my $obj_class = ref $obj || $obj; + $obj = bless $obj, $obj_class; + my @results = $obj->FREEZE('JSON'); + if ( @results and ref $results[0] ) { + if ( refaddr( $obj ) eq refaddr( $results[0] ) ) { + encode_error( sprintf( + "%s::FREEZE method returned same object as was passed instead of a new one", + ref $obj + ) ); + } + } + return '("'.$obj_class.'")['.join(',', @results).']'; + } + + if ( $convert_blessed and $obj->can('TO_JSON') ) { + my $result = $obj->TO_JSON(); + if ( defined $result and ref( $result ) ) { + if ( refaddr( $obj ) eq refaddr( $result ) ) { + encode_error( sprintf( + "%s::TO_JSON method returned same object as was passed instead of a new one", + ref $obj + ) ); + } + } + + return $self->object_to_json( $result ); + } + + return "$obj" if ( $bignum and _is_bignum($obj) ); + + if ($allow_blessed) { + return $self->blessed_to_json($obj) if ($as_nonblessed); # will be removed. + return 'null'; + } + encode_error( sprintf("encountered object '%s', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)", $obj) + ); + } + else { + return $self->value_to_json($obj); + } + } + else{ + return $self->value_to_json($obj); + } + } + + + sub hash_to_json { + my ($self, $obj) = @_; + my @res; + + encode_error("json text or perl structure exceeds maximum nesting level (max_depth set too low?)") + if (++$depth > $max_depth); + + my ($pre, $post) = $indent ? $self->_up_indent() : ('', ''); + my $del = ($space_before ? ' ' : '') . ':' . ($space_after ? ' ' : ''); + + for my $k ( _sort( $obj ) ) { + if ( OLD_PERL ) { utf8::decode($k) } # key for Perl 5.6 / be optimized + push @res, $self->string_to_json( $k ) + . $del + . ( ref $obj->{$k} ? $self->object_to_json( $obj->{$k} ) : $self->value_to_json( $obj->{$k} ) ); + } + + --$depth; + $self->_down_indent() if ($indent); + + return '{}' unless @res; + return '{' . $pre . join( ",$pre", @res ) . $post . '}'; + } + + + sub array_to_json { + my ($self, $obj) = @_; + my @res; + + encode_error("json text or perl structure exceeds maximum nesting level (max_depth set too low?)") + if (++$depth > $max_depth); + + my ($pre, $post) = $indent ? $self->_up_indent() : ('', ''); + + for my $v (@$obj){ + push @res, ref($v) ? $self->object_to_json($v) : $self->value_to_json($v); + } + + --$depth; + $self->_down_indent() if ($indent); + + return '[]' unless @res; + return '[' . $pre . join( ",$pre", @res ) . $post . ']'; + } + + sub _looks_like_number { + my $value = shift; + if (USE_B) { + my $b_obj = B::svref_2object(\$value); + my $flags = $b_obj->FLAGS; + return 1 if $flags & ( B::SVp_IOK() | B::SVp_NOK() ) and !( $flags & B::SVp_POK() ); + return; + } else { + no warnings 'numeric'; + # if the utf8 flag is on, it almost certainly started as a string + return if utf8::is_utf8($value); + # detect numbers + # string & "" -> "" + # number & "" -> 0 (with warning) + # nan and inf can detect as numbers, so check with * 0 + return unless length((my $dummy = "") & $value); + return unless 0 + $value eq $value; + return 1 if $value * 0 == 0; + return -1; # inf/nan + } + } + + sub value_to_json { + my ($self, $value) = @_; + + return 'null' if(!defined $value); + + my $type = ref($value); + + if (!$type) { + if (_looks_like_number($value)) { + return $value; + } + return $self->string_to_json($value); + } + elsif( blessed($value) and $value->isa('JSON::PP::Boolean') ){ + return $$value == 1 ? 'true' : 'false'; + } + else { + if ((overload::StrVal($value) =~ /=(\w+)/)[0]) { + return $self->value_to_json("$value"); + } + + if ($type eq 'SCALAR' and defined $$value) { + return $$value eq '1' ? 'true' + : $$value eq '0' ? 'false' + : $self->{PROPS}->[ P_ALLOW_UNKNOWN ] ? 'null' + : encode_error("cannot encode reference to scalar"); + } + + if ( $self->{PROPS}->[ P_ALLOW_UNKNOWN ] ) { + return 'null'; + } + else { + if ( $type eq 'SCALAR' or $type eq 'REF' ) { + encode_error("cannot encode reference to scalar"); + } + else { + encode_error("encountered $value, but JSON can only represent references to arrays or hashes"); + } + } + + } + } + + + my %esc = ( + "\n" => '\n', + "\r" => '\r', + "\t" => '\t', + "\f" => '\f', + "\b" => '\b', + "\"" => '\"', + "\\" => '\\\\', + "\'" => '\\\'', + ); + + + sub string_to_json { + my ($self, $arg) = @_; + + $arg =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/g; + $arg =~ s/\//\\\//g if ($escape_slash); + $arg =~ s/([\x00-\x08\x0b\x0e-\x1f])/'\\u00' . unpack('H2', $1)/eg; + + if ($ascii) { + $arg = JSON_PP_encode_ascii($arg); + } + + if ($latin1) { + $arg = JSON_PP_encode_latin1($arg); + } + + if ($utf8) { + utf8::encode($arg); + } + + return '"' . $arg . '"'; + } + + + sub blessed_to_json { + my $reftype = reftype($_[1]) || ''; + if ($reftype eq 'HASH') { + return $_[0]->hash_to_json($_[1]); + } + elsif ($reftype eq 'ARRAY') { + return $_[0]->array_to_json($_[1]); + } + else { + return 'null'; + } + } + + + sub encode_error { + my $error = shift; + Carp::croak "$error"; + } + + + sub _sort { + defined $keysort ? (sort $keysort (keys %{$_[0]})) : keys %{$_[0]}; + } + + + sub _up_indent { + my $self = shift; + my $space = ' ' x $indent_length; + + my ($pre,$post) = ('',''); + + $post = "\n" . $space x $indent_count; + + $indent_count++; + + $pre = "\n" . $space x $indent_count; + + return ($pre,$post); + } + + + sub _down_indent { $indent_count--; } + + + sub PP_encode_box { + { + depth => $depth, + indent_count => $indent_count, + }; + } + +} # Convert + + +sub _encode_ascii { + join('', + map { + $_ <= 127 ? + chr($_) : + $_ <= 65535 ? + sprintf('\u%04x', $_) : sprintf('\u%x\u%x', _encode_surrogates($_)); + } unpack('U*', $_[0]) + ); +} + + +sub _encode_latin1 { + join('', + map { + $_ <= 255 ? + chr($_) : + $_ <= 65535 ? + sprintf('\u%04x', $_) : sprintf('\u%x\u%x', _encode_surrogates($_)); + } unpack('U*', $_[0]) + ); +} + + +sub _encode_surrogates { # from perlunicode + my $uni = $_[0] - 0x10000; + return ($uni / 0x400 + 0xD800, $uni % 0x400 + 0xDC00); +} + + +sub _is_bignum { + $_[0]->isa('Math::BigInt') or $_[0]->isa('Math::BigFloat'); +} + + + +# +# JSON => Perl +# + +my $max_intsize; + +BEGIN { + my $checkint = 1111; + for my $d (5..64) { + $checkint .= 1; + my $int = eval qq| $checkint |; + if ($int =~ /[eE]/) { + $max_intsize = $d - 1; + last; + } + } +} + +{ # PARSE + + my %escapes = ( # by Jeremy Muhlich <jmuhlich [at] bitflood.org> + b => "\x8", + t => "\x9", + n => "\xA", + f => "\xC", + r => "\xD", + '\\' => '\\', + '"' => '"', + '/' => '/', + ); + + my $text; # json data + my $at; # offset + my $ch; # first character + my $len; # text length (changed according to UTF8 or NON UTF8) + # INTERNAL + my $depth; # nest counter + my $encoding; # json text encoding + my $is_valid_utf8; # temp variable + my $utf8_len; # utf8 byte length + # FLAGS + my $utf8; # must be utf8 + my $max_depth; # max nest number of objects and arrays + my $max_size; + my $relaxed; + my $cb_object; + my $cb_sk_object; + + my $F_HOOK; + + my $allow_bignum; # using Math::BigInt/BigFloat + my $singlequote; # loosely quoting + my $loose; # + my $allow_barekey; # bareKey + my $allow_tags; + + my $alt_true; + my $alt_false; + + sub _detect_utf_encoding { + my $text = shift; + my @octets = unpack('C4', $text); + return 'unknown' unless defined $octets[3]; + return ( $octets[0] and $octets[1]) ? 'UTF-8' + : (!$octets[0] and $octets[1]) ? 'UTF-16BE' + : (!$octets[0] and !$octets[1]) ? 'UTF-32BE' + : ( $octets[2] ) ? 'UTF-16LE' + : (!$octets[2] ) ? 'UTF-32LE' + : 'unknown'; + } + + sub PP_decode_json { + my ($self, $want_offset); + + ($self, $text, $want_offset) = @_; + + ($at, $ch, $depth) = (0, '', 0); + + if ( !defined $text or ref $text ) { + decode_error("malformed JSON string, neither array, object, number, string or atom"); + } + + my $props = $self->{PROPS}; + + ($utf8, $relaxed, $loose, $allow_bignum, $allow_barekey, $singlequote, $allow_tags) + = @{$props}[P_UTF8, P_RELAXED, P_LOOSE .. P_ALLOW_SINGLEQUOTE, P_ALLOW_TAGS]; + + ($alt_true, $alt_false) = @$self{qw/true false/}; + + if ( $utf8 ) { + $encoding = _detect_utf_encoding($text); + if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { + require Encode; + Encode::from_to($text, $encoding, 'utf-8'); + } else { + utf8::downgrade( $text, 1 ) or Carp::croak("Wide character in subroutine entry"); + } + } + else { + utf8::upgrade( $text ); + utf8::encode( $text ); + } + + $len = length $text; + + ($max_depth, $max_size, $cb_object, $cb_sk_object, $F_HOOK) + = @{$self}{qw/max_depth max_size cb_object cb_sk_object F_HOOK/}; + + if ($max_size > 1) { + use bytes; + my $bytes = length $text; + decode_error( + sprintf("attempted decode of JSON text of %s bytes size, but max_size is set to %s" + , $bytes, $max_size), 1 + ) if ($bytes > $max_size); + } + + white(); # remove head white space + + decode_error("malformed JSON string, neither array, object, number, string or atom") unless defined $ch; # Is there a first character for JSON structure? + + my $result = value(); + + if ( !$props->[ P_ALLOW_NONREF ] and !ref $result ) { + decode_error( + 'JSON text must be an object or array (but found number, string, true, false or null,' + . ' use allow_nonref to allow this)', 1); + } + + Carp::croak('something wrong.') if $len < $at; # we won't arrive here. + + my $consumed = defined $ch ? $at - 1 : $at; # consumed JSON text length + + white(); # remove tail white space + + return ( $result, $consumed ) if $want_offset; # all right if decode_prefix + + decode_error("garbage after JSON object") if defined $ch; + + $result; + } + + + sub next_chr { + return $ch = undef if($at >= $len); + $ch = substr($text, $at++, 1); + } + + + sub value { + white(); + return if(!defined $ch); + return object() if($ch eq '{'); + return array() if($ch eq '['); + return tag() if($ch eq '('); + return string() if($ch eq '"' or ($singlequote and $ch eq "'")); + return number() if($ch =~ /[0-9]/ or $ch eq '-'); + return word(); + } + + sub string { + my $utf16; + my $is_utf8; + + ($is_valid_utf8, $utf8_len) = ('', 0); + + my $s = ''; # basically UTF8 flag on + + if($ch eq '"' or ($singlequote and $ch eq "'")){ + my $boundChar = $ch; + + OUTER: while( defined(next_chr()) ){ + + if($ch eq $boundChar){ + next_chr(); + + if ($utf16) { + decode_error("missing low surrogate character in surrogate pair"); + } + + utf8::decode($s) if($is_utf8); + + return $s; + } + elsif($ch eq '\\'){ + next_chr(); + if(exists $escapes{$ch}){ + $s .= $escapes{$ch}; + } + elsif($ch eq 'u'){ # UNICODE handling + my $u = ''; + + for(1..4){ + $ch = next_chr(); + last OUTER if($ch !~ /[0-9a-fA-F]/); + $u .= $ch; + } + + # U+D800 - U+DBFF + if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { # UTF-16 high surrogate? + $utf16 = $u; + } + # U+DC00 - U+DFFF + elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { # UTF-16 low surrogate? + unless (defined $utf16) { + decode_error("missing high surrogate character in surrogate pair"); + } + $is_utf8 = 1; + $s .= JSON_PP_decode_surrogates($utf16, $u) || next; + $utf16 = undef; + } + else { + if (defined $utf16) { + decode_error("surrogate pair expected"); + } + + if ( ( my $hex = hex( $u ) ) > 127 ) { + $is_utf8 = 1; + $s .= JSON_PP_decode_unicode($u) || next; + } + else { + $s .= chr $hex; + } + } + + } + else{ + unless ($loose) { + $at -= 2; + decode_error('illegal backslash escape sequence in string'); + } + $s .= $ch; + } + } + else{ + + if ( ord $ch > 127 ) { + unless( $ch = is_valid_utf8($ch) ) { + $at -= 1; + decode_error("malformed UTF-8 character in JSON string"); + } + else { + $at += $utf8_len - 1; + } + + $is_utf8 = 1; + } + + if (!$loose) { + if ($ch =~ /[\x00-\x1f\x22\x5c]/) { # '/' ok + if (!$relaxed or $ch ne "\t") { + $at--; + decode_error('invalid character encountered while parsing JSON string'); + } + } + } + + $s .= $ch; + } + } + } + + decode_error("unexpected end of string while parsing JSON string"); + } + + + sub white { + while( defined $ch ){ + if($ch eq '' or $ch =~ /\A[ \t\r\n]\z/){ + next_chr(); + } + elsif($relaxed and $ch eq '/'){ + next_chr(); + if(defined $ch and $ch eq '/'){ + 1 while(defined(next_chr()) and $ch ne "\n" and $ch ne "\r"); + } + elsif(defined $ch and $ch eq '*'){ + next_chr(); + while(1){ + if(defined $ch){ + if($ch eq '*'){ + if(defined(next_chr()) and $ch eq '/'){ + next_chr(); + last; + } + } + else{ + next_chr(); + } + } + else{ + decode_error("Unterminated comment"); + } + } + next; + } + else{ + $at--; + decode_error("malformed JSON string, neither array, object, number, string or atom"); + } + } + else{ + if ($relaxed and $ch eq '#') { # correctly? + pos($text) = $at; + $text =~ /\G([^\n]*(?:\r\n|\r|\n|$))/g; + $at = pos($text); + next_chr; + next; + } + + last; + } + } + } + + + sub array { + my $a = $_[0] || []; # you can use this code to use another array ref object. + + decode_error('json text or perl structure exceeds maximum nesting level (max_depth set too low?)') + if (++$depth > $max_depth); + + next_chr(); + white(); + + if(defined $ch and $ch eq ']'){ + --$depth; + next_chr(); + return $a; + } + else { + while(defined($ch)){ + push @$a, value(); + + white(); + + if (!defined $ch) { + last; + } + + if($ch eq ']'){ + --$depth; + next_chr(); + return $a; + } + + if($ch ne ','){ + last; + } + + next_chr(); + white(); + + if ($relaxed and $ch eq ']') { + --$depth; + next_chr(); + return $a; + } + + } + } + + $at-- if defined $ch and $ch ne ''; + decode_error(", or ] expected while parsing array"); + } + + sub tag { + decode_error('malformed JSON string, neither array, object, number, string or atom') unless $allow_tags; + + next_chr(); + white(); + + my $tag = value(); + return unless defined $tag; + decode_error('malformed JSON string, (tag) must be a string') if ref $tag; + + white(); + + if (!defined $ch or $ch ne ')') { + decode_error(') expected after tag'); + } + + next_chr(); + white(); + + my $val = value(); + return unless defined $val; + decode_error('malformed JSON string, tag value must be an array') unless ref $val eq 'ARRAY'; + + if (!eval { $tag->can('THAW') }) { + decode_error('cannot decode perl-object (package does not exist)') if $@; + decode_error('cannot decode perl-object (package does not have a THAW method)'); + } + $tag->THAW('JSON', @$val); + } + + sub object { + my $o = $_[0] || {}; # you can use this code to use another hash ref object. + my $k; + + decode_error('json text or perl structure exceeds maximum nesting level (max_depth set too low?)') + if (++$depth > $max_depth); + next_chr(); + white(); + + if(defined $ch and $ch eq '}'){ + --$depth; + next_chr(); + if ($F_HOOK) { + return _json_object_hook($o); + } + return $o; + } + else { + while (defined $ch) { + $k = ($allow_barekey and $ch ne '"' and $ch ne "'") ? bareKey() : string(); + white(); + + if(!defined $ch or $ch ne ':'){ + $at--; + decode_error("':' expected"); + } + + next_chr(); + $o->{$k} = value(); + white(); + + last if (!defined $ch); + + if($ch eq '}'){ + --$depth; + next_chr(); + if ($F_HOOK) { + return _json_object_hook($o); + } + return $o; + } + + if($ch ne ','){ + last; + } + + next_chr(); + white(); + + if ($relaxed and $ch eq '}') { + --$depth; + next_chr(); + if ($F_HOOK) { + return _json_object_hook($o); + } + return $o; + } + + } + + } + + $at-- if defined $ch and $ch ne ''; + decode_error(", or } expected while parsing object/hash"); + } + + + sub bareKey { # doesn't strictly follow Standard ECMA-262 3rd Edition + my $key; + while($ch =~ /[^\x00-\x23\x25-\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/){ + $key .= $ch; + next_chr(); + } + return $key; + } + + + sub word { + my $word = substr($text,$at-1,4); + + if($word eq 'true'){ + $at += 3; + next_chr; + return defined $alt_true ? $alt_true : $JSON::PP::true; + } + elsif($word eq 'null'){ + $at += 3; + next_chr; + return undef; + } + elsif($word eq 'fals'){ + $at += 3; + if(substr($text,$at,1) eq 'e'){ + $at++; + next_chr; + return defined $alt_false ? $alt_false : $JSON::PP::false; + } + } + + $at--; # for decode_error report + + decode_error("'null' expected") if ($word =~ /^n/); + decode_error("'true' expected") if ($word =~ /^t/); + decode_error("'false' expected") if ($word =~ /^f/); + decode_error("malformed JSON string, neither array, object, number, string or atom"); + } + + + sub number { + my $n = ''; + my $v; + my $is_dec; + my $is_exp; + + if($ch eq '-'){ + $n = '-'; + next_chr; + if (!defined $ch or $ch !~ /\d/) { + decode_error("malformed number (no digits after initial minus)"); + } + } + + # According to RFC4627, hex or oct digits are invalid. + if($ch eq '0'){ + my $peek = substr($text,$at,1); + if($peek =~ /^[0-9a-dfA-DF]/){ # e may be valid (exponential) + decode_error("malformed number (leading zero must not be followed by another digit)"); + } + $n .= $ch; + next_chr; + } + + while(defined $ch and $ch =~ /\d/){ + $n .= $ch; + next_chr; + } + + if(defined $ch and $ch eq '.'){ + $n .= '.'; + $is_dec = 1; + + next_chr; + if (!defined $ch or $ch !~ /\d/) { + decode_error("malformed number (no digits after decimal point)"); + } + else { + $n .= $ch; + } + + while(defined(next_chr) and $ch =~ /\d/){ + $n .= $ch; + } + } + + if(defined $ch and ($ch eq 'e' or $ch eq 'E')){ + $n .= $ch; + $is_exp = 1; + next_chr; + + if(defined($ch) and ($ch eq '+' or $ch eq '-')){ + $n .= $ch; + next_chr; + if (!defined $ch or $ch =~ /\D/) { + decode_error("malformed number (no digits after exp sign)"); + } + $n .= $ch; + } + elsif(defined($ch) and $ch =~ /\d/){ + $n .= $ch; + } + else { + decode_error("malformed number (no digits after exp sign)"); + } + + while(defined(next_chr) and $ch =~ /\d/){ + $n .= $ch; + } + + } + + $v .= $n; + + if ($is_dec or $is_exp) { + if ($allow_bignum) { + require Math::BigFloat; + return Math::BigFloat->new($v); + } + } else { + if (length $v > $max_intsize) { + if ($allow_bignum) { # from Adam Sussman + require Math::BigInt; + return Math::BigInt->new($v); + } + else { + return "$v"; + } + } + } + + return $is_dec ? $v/1.0 : 0+$v; + } + + + sub is_valid_utf8 { + + $utf8_len = $_[0] =~ /[\x00-\x7F]/ ? 1 + : $_[0] =~ /[\xC2-\xDF]/ ? 2 + : $_[0] =~ /[\xE0-\xEF]/ ? 3 + : $_[0] =~ /[\xF0-\xF4]/ ? 4 + : 0 + ; + + return unless $utf8_len; + + my $is_valid_utf8 = substr($text, $at - 1, $utf8_len); + + return ( $is_valid_utf8 =~ /^(?: + [\x00-\x7F] + |[\xC2-\xDF][\x80-\xBF] + |[\xE0][\xA0-\xBF][\x80-\xBF] + |[\xE1-\xEC][\x80-\xBF][\x80-\xBF] + |[\xED][\x80-\x9F][\x80-\xBF] + |[\xEE-\xEF][\x80-\xBF][\x80-\xBF] + |[\xF0][\x90-\xBF][\x80-\xBF][\x80-\xBF] + |[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF] + |[\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF] + )$/x ) ? $is_valid_utf8 : ''; + } + + + sub decode_error { + my $error = shift; + my $no_rep = shift; + my $str = defined $text ? substr($text, $at) : ''; + my $mess = ''; + my $type = 'U*'; + + if ( OLD_PERL ) { + my $type = $] < 5.006 ? 'C*' + : utf8::is_utf8( $str ) ? 'U*' # 5.6 + : 'C*' + ; + } + + for my $c ( unpack( $type, $str ) ) { # emulate pv_uni_display() ? + $mess .= $c == 0x07 ? '\a' + : $c == 0x09 ? '\t' + : $c == 0x0a ? '\n' + : $c == 0x0d ? '\r' + : $c == 0x0c ? '\f' + : $c < 0x20 ? sprintf('\x{%x}', $c) + : $c == 0x5c ? '\\\\' + : $c < 0x80 ? chr($c) + : sprintf('\x{%x}', $c) + ; + if ( length $mess >= 20 ) { + $mess .= '...'; + last; + } + } + + unless ( length $mess ) { + $mess = '(end of string)'; + } + + Carp::croak ( + $no_rep ? "$error" : "$error, at character offset $at (before \"$mess\")" + ); + + } + + + sub _json_object_hook { + my $o = $_[0]; + my @ks = keys %{$o}; + + if ( $cb_sk_object and @ks == 1 and exists $cb_sk_object->{ $ks[0] } and ref $cb_sk_object->{ $ks[0] } ) { + my @val = $cb_sk_object->{ $ks[0] }->( $o->{$ks[0]} ); + if (@val == 0) { + return $o; + } + elsif (@val == 1) { + return $val[0]; + } + else { + Carp::croak("filter_json_single_key_object callbacks must not return more than one scalar"); + } + } + + my @val = $cb_object->($o) if ($cb_object); + if (@val == 0) { + return $o; + } + elsif (@val == 1) { + return $val[0]; + } + else { + Carp::croak("filter_json_object callbacks must not return more than one scalar"); + } + } + + + sub PP_decode_box { + { + text => $text, + at => $at, + ch => $ch, + len => $len, + depth => $depth, + encoding => $encoding, + is_valid_utf8 => $is_valid_utf8, + }; + } + +} # PARSE + + +sub _decode_surrogates { # from perlunicode + my $uni = 0x10000 + (hex($_[0]) - 0xD800) * 0x400 + (hex($_[1]) - 0xDC00); + my $un = pack('U*', $uni); + utf8::encode( $un ); + return $un; +} + + +sub _decode_unicode { + my $un = pack('U', hex shift); + utf8::encode( $un ); + return $un; +} + +# +# Setup for various Perl versions (the code from JSON::PP58) +# + +BEGIN { + + unless ( defined &utf8::is_utf8 ) { + require Encode; + *utf8::is_utf8 = *Encode::is_utf8; + } + + if ( !OLD_PERL ) { + *JSON::PP::JSON_PP_encode_ascii = \&_encode_ascii; + *JSON::PP::JSON_PP_encode_latin1 = \&_encode_latin1; + *JSON::PP::JSON_PP_decode_surrogates = \&_decode_surrogates; + *JSON::PP::JSON_PP_decode_unicode = \&_decode_unicode; + + if ($] < 5.008003) { # join() in 5.8.0 - 5.8.2 is broken. + package JSON::PP; + require subs; + subs->import('join'); + eval q| + sub join { + return '' if (@_ < 2); + my $j = shift; + my $str = shift; + for (@_) { $str .= $j . $_; } + return $str; + } + |; + } + } + + + sub JSON::PP::incr_parse { + local $Carp::CarpLevel = 1; + ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_parse( @_ ); + } + + + sub JSON::PP::incr_skip { + ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_skip; + } + + + sub JSON::PP::incr_reset { + ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_reset; + } + + eval q{ + sub JSON::PP::incr_text : lvalue { + $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new; + + if ( $_[0]->{_incr_parser}->{incr_pos} ) { + Carp::croak("incr_text cannot be called when the incremental parser already started parsing"); + } + $_[0]->{_incr_parser}->{incr_text}; + } + } if ( $] >= 5.006 ); + +} # Setup for various Perl versions (the code from JSON::PP58) + + +############################### +# Utilities +# + +BEGIN { + eval 'require Scalar::Util'; + unless($@){ + *JSON::PP::blessed = \&Scalar::Util::blessed; + *JSON::PP::reftype = \&Scalar::Util::reftype; + *JSON::PP::refaddr = \&Scalar::Util::refaddr; + } + else{ # This code is from Scalar::Util. + # warn $@; + eval 'sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) }'; + *JSON::PP::blessed = sub { + local($@, $SIG{__DIE__}, $SIG{__WARN__}); + ref($_[0]) ? eval { $_[0]->a_sub_not_likely_to_be_here } : undef; + }; + require B; + my %tmap = qw( + B::NULL SCALAR + B::HV HASH + B::AV ARRAY + B::CV CODE + B::IO IO + B::GV GLOB + B::REGEXP REGEXP + ); + *JSON::PP::reftype = sub { + my $r = shift; + + return undef unless length(ref($r)); + + my $t = ref(B::svref_2object($r)); + + return + exists $tmap{$t} ? $tmap{$t} + : length(ref($$r)) ? 'REF' + : 'SCALAR'; + }; + *JSON::PP::refaddr = sub { + return undef unless length(ref($_[0])); + + my $addr; + if(defined(my $pkg = blessed($_[0]))) { + $addr .= bless $_[0], 'Scalar::Util::Fake'; + bless $_[0], $pkg; + } + else { + $addr .= $_[0] + } + + $addr =~ /0x(\w+)/; + local $^W; + #no warnings 'portable'; + hex($1); + } + } +} + + +# shamelessly copied and modified from JSON::XS code. + +$JSON::PP::true = do { bless \(my $dummy = 1), "JSON::PP::Boolean" }; +$JSON::PP::false = do { bless \(my $dummy = 0), "JSON::PP::Boolean" }; + +sub is_bool { blessed $_[0] and ( $_[0]->isa("JSON::PP::Boolean") or $_[0]->isa("Types::Serialiser::BooleanBase") or $_[0]->isa("JSON::XS::Boolean") ); } + +sub true { $JSON::PP::true } +sub false { $JSON::PP::false } +sub null { undef; } + +############################### + +package JSON::PP::IncrParser; + +use strict; + +use constant INCR_M_WS => 0; # initial whitespace skipping +use constant INCR_M_STR => 1; # inside string +use constant INCR_M_BS => 2; # inside backslash +use constant INCR_M_JSON => 3; # outside anything, count nesting +use constant INCR_M_C0 => 4; +use constant INCR_M_C1 => 5; +use constant INCR_M_TFN => 6; +use constant INCR_M_NUM => 7; + +$JSON::PP::IncrParser::VERSION = '1.01'; + +sub new { + my ( $class ) = @_; + + bless { + incr_nest => 0, + incr_text => undef, + incr_pos => 0, + incr_mode => 0, + }, $class; +} + + +sub incr_parse { + my ( $self, $coder, $text ) = @_; + + $self->{incr_text} = '' unless ( defined $self->{incr_text} ); + + if ( defined $text ) { + if ( utf8::is_utf8( $text ) and !utf8::is_utf8( $self->{incr_text} ) ) { + utf8::upgrade( $self->{incr_text} ) ; + utf8::decode( $self->{incr_text} ) ; + } + $self->{incr_text} .= $text; + } + + if ( defined wantarray ) { + my $max_size = $coder->get_max_size; + my $p = $self->{incr_pos}; + my @ret; + { + do { + unless ( $self->{incr_nest} <= 0 and $self->{incr_mode} == INCR_M_JSON ) { + $self->_incr_parse( $coder ); + + if ( $max_size and $self->{incr_pos} > $max_size ) { + Carp::croak("attempted decode of JSON text of $self->{incr_pos} bytes size, but max_size is set to $max_size"); + } + unless ( $self->{incr_nest} <= 0 and $self->{incr_mode} == INCR_M_JSON ) { + # as an optimisation, do not accumulate white space in the incr buffer + if ( $self->{incr_mode} == INCR_M_WS and $self->{incr_pos} ) { + $self->{incr_pos} = 0; + $self->{incr_text} = ''; + } + last; + } + } + + my ($obj, $offset) = $coder->PP_decode_json( $self->{incr_text}, 0x00000001 ); + push @ret, $obj; + use bytes; + $self->{incr_text} = substr( $self->{incr_text}, $offset || 0 ); + $self->{incr_pos} = 0; + $self->{incr_nest} = 0; + $self->{incr_mode} = 0; + last unless wantarray; + } while ( wantarray ); + } + + if ( wantarray ) { + return @ret; + } + else { # in scalar context + return defined $ret[0] ? $ret[0] : undef; + } + } +} + + +sub _incr_parse { + my ($self, $coder) = @_; + my $text = $self->{incr_text}; + my $len = length $text; + my $p = $self->{incr_pos}; + +INCR_PARSE: + while ( $len > $p ) { + my $s = substr( $text, $p, 1 ); + last INCR_PARSE unless defined $s; + my $mode = $self->{incr_mode}; + + if ( $mode == INCR_M_WS ) { + while ( $len > $p ) { + $s = substr( $text, $p, 1 ); + last INCR_PARSE unless defined $s; + if ( ord($s) > 0x20 ) { + if ( $s eq '#' ) { + $self->{incr_mode} = INCR_M_C0; + redo INCR_PARSE; + } else { + $self->{incr_mode} = INCR_M_JSON; + redo INCR_PARSE; + } + } + $p++; + } + } elsif ( $mode == INCR_M_BS ) { + $p++; + $self->{incr_mode} = INCR_M_STR; + redo INCR_PARSE; + } elsif ( $mode == INCR_M_C0 or $mode == INCR_M_C1 ) { + while ( $len > $p ) { + $s = substr( $text, $p, 1 ); + last INCR_PARSE unless defined $s; + if ( $s eq "\n" ) { + $self->{incr_mode} = $self->{incr_mode} == INCR_M_C0 ? INCR_M_WS : INCR_M_JSON; + last; + } + $p++; + } + next; + } elsif ( $mode == INCR_M_TFN ) { + while ( $len > $p ) { + $s = substr( $text, $p++, 1 ); + next if defined $s and $s =~ /[rueals]/; + last; + } + $p--; + $self->{incr_mode} = INCR_M_JSON; + + last INCR_PARSE unless $self->{incr_nest}; + redo INCR_PARSE; + } elsif ( $mode == INCR_M_NUM ) { + while ( $len > $p ) { + $s = substr( $text, $p++, 1 ); + next if defined $s and $s =~ /[0-9eE.+\-]/; + last; + } + $p--; + $self->{incr_mode} = INCR_M_JSON; + + last INCR_PARSE unless $self->{incr_nest}; + redo INCR_PARSE; + } elsif ( $mode == INCR_M_STR ) { + while ( $len > $p ) { + $s = substr( $text, $p, 1 ); + last INCR_PARSE unless defined $s; + if ( $s eq '"' ) { + $p++; + $self->{incr_mode} = INCR_M_JSON; + + last INCR_PARSE unless $self->{incr_nest}; + redo INCR_PARSE; + } + elsif ( $s eq '\\' ) { + $p++; + if ( !defined substr($text, $p, 1) ) { + $self->{incr_mode} = INCR_M_BS; + last INCR_PARSE; + } + } + $p++; + } + } elsif ( $mode == INCR_M_JSON ) { + while ( $len > $p ) { + $s = substr( $text, $p++, 1 ); + if ( $s eq "\x00" ) { + $p--; + last INCR_PARSE; + } elsif ( $s eq "\x09" or $s eq "\x0a" or $s eq "\x0d" or $s eq "\x20" ) { + if ( !$self->{incr_nest} ) { + $p--; # do not eat the whitespace, let the next round do it + last INCR_PARSE; + } + next; + } elsif ( $s eq 't' or $s eq 'f' or $s eq 'n' ) { + $self->{incr_mode} = INCR_M_TFN; + redo INCR_PARSE; + } elsif ( $s =~ /^[0-9\-]$/ ) { + $self->{incr_mode} = INCR_M_NUM; + redo INCR_PARSE; + } elsif ( $s eq '"' ) { + $self->{incr_mode} = INCR_M_STR; + redo INCR_PARSE; + } elsif ( $s eq '[' or $s eq '{' ) { + if ( ++$self->{incr_nest} > $coder->get_max_depth ) { + Carp::croak('json text or perl structure exceeds maximum nesting level (max_depth set too low?)'); + } + next; + } elsif ( $s eq ']' or $s eq '}' ) { + if ( --$self->{incr_nest} <= 0 ) { + last INCR_PARSE; + } + } elsif ( $s eq '#' ) { + $self->{incr_mode} = INCR_M_C1; + redo INCR_PARSE; + } + } + } + } + + $self->{incr_pos} = $p; + $self->{incr_parsing} = $p ? 1 : 0; # for backward compatibility +} + + +sub incr_text { + if ( $_[0]->{incr_pos} ) { + Carp::croak("incr_text cannot be called when the incremental parser already started parsing"); + } + $_[0]->{incr_text}; +} + + +sub incr_skip { + my $self = shift; + $self->{incr_text} = substr( $self->{incr_text}, $self->{incr_pos} ); + $self->{incr_pos} = 0; + $self->{incr_mode} = 0; + $self->{incr_nest} = 0; +} + + +sub incr_reset { + my $self = shift; + $self->{incr_text} = undef; + $self->{incr_pos} = 0; + $self->{incr_mode} = 0; + $self->{incr_nest} = 0; +} + +############################### + + +1; +__END__ +=pod + +=head1 NAME + +JSON::PP - JSON::XS compatible pure-Perl module. + +=head1 SYNOPSIS + + use JSON::PP; + + # exported functions, they croak on error + # and expect/generate UTF-8 + + $utf8_encoded_json_text = encode_json $perl_hash_or_arrayref; + $perl_hash_or_arrayref = decode_json $utf8_encoded_json_text; + + # OO-interface + + $json = JSON::PP->new->ascii->pretty->allow_nonref; + + $pretty_printed_json_text = $json->encode( $perl_scalar ); + $perl_scalar = $json->decode( $json_text ); + + # Note that JSON version 2.0 and above will automatically use + # JSON::XS or JSON::PP, so you should be able to just: + + use JSON; + + +=head1 VERSION + + 4.04 + +=head1 DESCRIPTION + +JSON::PP is a pure perl JSON decoder/encoder, and (almost) compatible to much +faster L<JSON::XS> written by Marc Lehmann in C. JSON::PP works as +a fallback module when you use L<JSON> module without having +installed JSON::XS. + +Because of this fallback feature of JSON.pm, JSON::PP tries not to +be more JavaScript-friendly than JSON::XS (i.e. not to escape extra +characters such as U+2028 and U+2029, etc), +in order for you not to lose such JavaScript-friendliness silently +when you use JSON.pm and install JSON::XS for speed or by accident. +If you need JavaScript-friendly RFC7159-compliant pure perl module, +try L<JSON::Tiny>, which is derived from L<Mojolicious> web +framework and is also smaller and faster than JSON::PP. + +JSON::PP has been in the Perl core since Perl 5.14, mainly for +CPAN toolchain modules to parse META.json. + +=head1 FUNCTIONAL INTERFACE + +This section is taken from JSON::XS almost verbatim. C<encode_json> +and C<decode_json> are exported by default. + +=head2 encode_json + + $json_text = encode_json $perl_scalar + +Converts the given Perl data structure to a UTF-8 encoded, binary string +(that is, the string contains octets only). Croaks on error. + +This function call is functionally identical to: + + $json_text = JSON::PP->new->utf8->encode($perl_scalar) + +Except being faster. + +=head2 decode_json + + $perl_scalar = decode_json $json_text + +The opposite of C<encode_json>: expects an UTF-8 (binary) string and tries +to parse that as an UTF-8 encoded JSON text, returning the resulting +reference. Croaks on error. + +This function call is functionally identical to: + + $perl_scalar = JSON::PP->new->utf8->decode($json_text) + +Except being faster. + +=head2 JSON::PP::is_bool + + $is_boolean = JSON::PP::is_bool($scalar) + +Returns true if the passed scalar represents either JSON::PP::true or +JSON::PP::false, two constants that act like C<1> and C<0> respectively +and are also used to represent JSON C<true> and C<false> in Perl strings. + +See L<MAPPING>, below, for more information on how JSON values are mapped to +Perl. + +=head1 OBJECT-ORIENTED INTERFACE + +This section is also taken from JSON::XS. + +The object oriented interface lets you configure your own encoding or +decoding style, within the limits of supported formats. + +=head2 new + + $json = JSON::PP->new + +Creates a new JSON::PP object that can be used to de/encode JSON +strings. All boolean flags described below are by default I<disabled> +(with the exception of C<allow_nonref>, which defaults to I<enabled> since +version C<4.0>). + +The mutators for flags all return the JSON::PP object again and thus calls can +be chained: + + my $json = JSON::PP->new->utf8->space_after->encode({a => [1,2]}) + => {"a": [1, 2]} + +=head2 ascii + + $json = $json->ascii([$enable]) + + $enabled = $json->get_ascii + +If C<$enable> is true (or missing), then the C<encode> method will not +generate characters outside the code range C<0..127> (which is ASCII). Any +Unicode characters outside that range will be escaped using either a +single \uXXXX (BMP characters) or a double \uHHHH\uLLLLL escape sequence, +as per RFC4627. The resulting encoded JSON text can be treated as a native +Unicode string, an ascii-encoded, latin1-encoded or UTF-8 encoded string, +or any other superset of ASCII. + +If C<$enable> is false, then the C<encode> method will not escape Unicode +characters unless required by the JSON syntax or other flags. This results +in a faster and more compact format. + +See also the section I<ENCODING/CODESET FLAG NOTES> later in this document. + +The main use for this flag is to produce JSON texts that can be +transmitted over a 7-bit channel, as the encoded JSON texts will not +contain any 8 bit characters. + + JSON::PP->new->ascii(1)->encode([chr 0x10401]) + => ["\ud801\udc01"] + +=head2 latin1 + + $json = $json->latin1([$enable]) + + $enabled = $json->get_latin1 + +If C<$enable> is true (or missing), then the C<encode> method will encode +the resulting JSON text as latin1 (or iso-8859-1), escaping any characters +outside the code range C<0..255>. The resulting string can be treated as a +latin1-encoded JSON text or a native Unicode string. The C<decode> method +will not be affected in any way by this flag, as C<decode> by default +expects Unicode, which is a strict superset of latin1. + +If C<$enable> is false, then the C<encode> method will not escape Unicode +characters unless required by the JSON syntax or other flags. + +See also the section I<ENCODING/CODESET FLAG NOTES> later in this document. + +The main use for this flag is efficiently encoding binary data as JSON +text, as most octets will not be escaped, resulting in a smaller encoded +size. The disadvantage is that the resulting JSON text is encoded +in latin1 (and must correctly be treated as such when storing and +transferring), a rare encoding for JSON. It is therefore most useful when +you want to store data structures known to contain binary data efficiently +in files or databases, not when talking to other JSON encoders/decoders. + + JSON::PP->new->latin1->encode (["\x{89}\x{abc}"] + => ["\x{89}\\u0abc"] # (perl syntax, U+abc escaped, U+89 not) + +=head2 utf8 + + $json = $json->utf8([$enable]) + + $enabled = $json->get_utf8 + +If C<$enable> is true (or missing), then the C<encode> method will encode +the JSON result into UTF-8, as required by many protocols, while the +C<decode> method expects to be handled an UTF-8-encoded string. Please +note that UTF-8-encoded strings do not contain any characters outside the +range C<0..255>, they are thus useful for bytewise/binary I/O. In future +versions, enabling this option might enable autodetection of the UTF-16 +and UTF-32 encoding families, as described in RFC4627. + +If C<$enable> is false, then the C<encode> method will return the JSON +string as a (non-encoded) Unicode string, while C<decode> expects thus a +Unicode string. Any decoding or encoding (e.g. to UTF-8 or UTF-16) needs +to be done yourself, e.g. using the Encode module. + +See also the section I<ENCODING/CODESET FLAG NOTES> later in this document. + +Example, output UTF-16BE-encoded JSON: + + use Encode; + $jsontext = encode "UTF-16BE", JSON::PP->new->encode ($object); + +Example, decode UTF-32LE-encoded JSON: + + use Encode; + $object = JSON::PP->new->decode (decode "UTF-32LE", $jsontext); + +=head2 pretty + + $json = $json->pretty([$enable]) + +This enables (or disables) all of the C<indent>, C<space_before> and +C<space_after> (and in the future possibly more) flags in one call to +generate the most readable (or most compact) form possible. + +=head2 indent + + $json = $json->indent([$enable]) + + $enabled = $json->get_indent + +If C<$enable> is true (or missing), then the C<encode> method will use a multiline +format as output, putting every array member or object/hash key-value pair +into its own line, indenting them properly. + +If C<$enable> is false, no newlines or indenting will be produced, and the +resulting JSON text is guaranteed not to contain any C<newlines>. + +This setting has no effect when decoding JSON texts. + +The default indent space length is three. +You can use C<indent_length> to change the length. + +=head2 space_before + + $json = $json->space_before([$enable]) + + $enabled = $json->get_space_before + +If C<$enable> is true (or missing), then the C<encode> method will add an extra +optional space before the C<:> separating keys from values in JSON objects. + +If C<$enable> is false, then the C<encode> method will not add any extra +space at those places. + +This setting has no effect when decoding JSON texts. You will also +most likely combine this setting with C<space_after>. + +Example, space_before enabled, space_after and indent disabled: + + {"key" :"value"} + +=head2 space_after + + $json = $json->space_after([$enable]) + + $enabled = $json->get_space_after + +If C<$enable> is true (or missing), then the C<encode> method will add an extra +optional space after the C<:> separating keys from values in JSON objects +and extra whitespace after the C<,> separating key-value pairs and array +members. + +If C<$enable> is false, then the C<encode> method will not add any extra +space at those places. + +This setting has no effect when decoding JSON texts. + +Example, space_before and indent disabled, space_after enabled: + + {"key": "value"} + +=head2 relaxed + + $json = $json->relaxed([$enable]) + + $enabled = $json->get_relaxed + +If C<$enable> is true (or missing), then C<decode> will accept some +extensions to normal JSON syntax (see below). C<encode> will not be +affected in anyway. I<Be aware that this option makes you accept invalid +JSON texts as if they were valid!>. I suggest only to use this option to +parse application-specific files written by humans (configuration files, +resource files etc.) + +If C<$enable> is false (the default), then C<decode> will only accept +valid JSON texts. + +Currently accepted extensions are: + +=over 4 + +=item * list items can have an end-comma + +JSON I<separates> array elements and key-value pairs with commas. This +can be annoying if you write JSON texts manually and want to be able to +quickly append elements, so this extension accepts comma at the end of +such items not just between them: + + [ + 1, + 2, <- this comma not normally allowed + ] + { + "k1": "v1", + "k2": "v2", <- this comma not normally allowed + } + +=item * shell-style '#'-comments + +Whenever JSON allows whitespace, shell-style comments are additionally +allowed. They are terminated by the first carriage-return or line-feed +character, after which more white-space and comments are allowed. + + [ + 1, # this comment not allowed in JSON + # neither this one... + ] + +=item * C-style multiple-line '/* */'-comments (JSON::PP only) + +Whenever JSON allows whitespace, C-style multiple-line comments are additionally +allowed. Everything between C</*> and C<*/> is a comment, after which +more white-space and comments are allowed. + + [ + 1, /* this comment not allowed in JSON */ + /* neither this one... */ + ] + +=item * C++-style one-line '//'-comments (JSON::PP only) + +Whenever JSON allows whitespace, C++-style one-line comments are additionally +allowed. They are terminated by the first carriage-return or line-feed +character, after which more white-space and comments are allowed. + + [ + 1, // this comment not allowed in JSON + // neither this one... + ] + +=item * literal ASCII TAB characters in strings + +Literal ASCII TAB characters are now allowed in strings (and treated as +C<\t>). + + [ + "Hello\tWorld", + "Hello<TAB>World", # literal <TAB> would not normally be allowed + ] + +=back + +=head2 canonical + + $json = $json->canonical([$enable]) + + $enabled = $json->get_canonical + +If C<$enable> is true (or missing), then the C<encode> method will output JSON objects +by sorting their keys. This is adding a comparatively high overhead. + +If C<$enable> is false, then the C<encode> method will output key-value +pairs in the order Perl stores them (which will likely change between runs +of the same script, and can change even within the same run from 5.18 +onwards). + +This option is useful if you want the same data structure to be encoded as +the same JSON text (given the same overall settings). If it is disabled, +the same hash might be encoded differently even if contains the same data, +as key-value pairs have no inherent ordering in Perl. + +This setting has no effect when decoding JSON texts. + +This setting has currently no effect on tied hashes. + +=head2 allow_nonref + + $json = $json->allow_nonref([$enable]) + + $enabled = $json->get_allow_nonref + +Unlike other boolean options, this opotion is enabled by default beginning +with version C<4.0>. + +If C<$enable> is true (or missing), then the C<encode> method can convert a +non-reference into its corresponding string, number or null JSON value, +which is an extension to RFC4627. Likewise, C<decode> will accept those JSON +values instead of croaking. + +If C<$enable> is false, then the C<encode> method will croak if it isn't +passed an arrayref or hashref, as JSON texts must either be an object +or array. Likewise, C<decode> will croak if given something that is not a +JSON object or array. + +Example, encode a Perl scalar as JSON value without enabled C<allow_nonref>, +resulting in an error: + + JSON::PP->new->allow_nonref(0)->encode ("Hello, World!") + => hash- or arrayref expected... + +=head2 allow_unknown + + $json = $json->allow_unknown([$enable]) + + $enabled = $json->get_allow_unknown + +If C<$enable> is true (or missing), then C<encode> will I<not> throw an +exception when it encounters values it cannot represent in JSON (for +example, filehandles) but instead will encode a JSON C<null> value. Note +that blessed objects are not included here and are handled separately by +c<allow_blessed>. + +If C<$enable> is false (the default), then C<encode> will throw an +exception when it encounters anything it cannot encode as JSON. + +This option does not affect C<decode> in any way, and it is recommended to +leave it off unless you know your communications partner. + +=head2 allow_blessed + + $json = $json->allow_blessed([$enable]) + + $enabled = $json->get_allow_blessed + +See L<OBJECT SERIALISATION> for details. + +If C<$enable> is true (or missing), then the C<encode> method will not +barf when it encounters a blessed reference that it cannot convert +otherwise. Instead, a JSON C<null> value is encoded instead of the object. + +If C<$enable> is false (the default), then C<encode> will throw an +exception when it encounters a blessed object that it cannot convert +otherwise. + +This setting has no effect on C<decode>. + +=head2 convert_blessed + + $json = $json->convert_blessed([$enable]) + + $enabled = $json->get_convert_blessed + +See L<OBJECT SERIALISATION> for details. + +If C<$enable> is true (or missing), then C<encode>, upon encountering a +blessed object, will check for the availability of the C<TO_JSON> method +on the object's class. If found, it will be called in scalar context and +the resulting scalar will be encoded instead of the object. + +The C<TO_JSON> method may safely call die if it wants. If C<TO_JSON> +returns other blessed objects, those will be handled in the same +way. C<TO_JSON> must take care of not causing an endless recursion cycle +(== crash) in this case. The name of C<TO_JSON> was chosen because other +methods called by the Perl core (== not by the user of the object) are +usually in upper case letters and to avoid collisions with any C<to_json> +function or method. + +If C<$enable> is false (the default), then C<encode> will not consider +this type of conversion. + +This setting has no effect on C<decode>. + +=head2 allow_tags + + $json = $json->allow_tags([$enable]) + + $enabled = $json->get_allow_tags + +See L<OBJECT SERIALISATION> for details. + +If C<$enable> is true (or missing), then C<encode>, upon encountering a +blessed object, will check for the availability of the C<FREEZE> method on +the object's class. If found, it will be used to serialise the object into +a nonstandard tagged JSON value (that JSON decoders cannot decode). + +It also causes C<decode> to parse such tagged JSON values and deserialise +them via a call to the C<THAW> method. + +If C<$enable> is false (the default), then C<encode> will not consider +this type of conversion, and tagged JSON values will cause a parse error +in C<decode>, as if tags were not part of the grammar. + +=head2 boolean_values + + $json->boolean_values([$false, $true]) + + ($false, $true) = $json->get_boolean_values + +By default, JSON booleans will be decoded as overloaded +C<$JSON::PP::false> and C<$JSON::PP::true> objects. + +With this method you can specify your own boolean values for decoding - +on decode, JSON C<false> will be decoded as a copy of C<$false>, and JSON +C<true> will be decoded as C<$true> ("copy" here is the same thing as +assigning a value to another variable, i.e. C<$copy = $false>). + +This is useful when you want to pass a decoded data structure directly +to other serialisers like YAML, Data::MessagePack and so on. + +Note that this works only when you C<decode>. You can set incompatible +boolean objects (like L<boolean>), but when you C<encode> a data structure +with such boolean objects, you still need to enable C<convert_blessed> +(and add a C<TO_JSON> method if necessary). + +Calling this method without any arguments will reset the booleans +to their default values. + +C<get_boolean_values> will return both C<$false> and C<$true> values, or +the empty list when they are set to the default. + +=head2 filter_json_object + + $json = $json->filter_json_object([$coderef]) + +When C<$coderef> is specified, it will be called from C<decode> each +time it decodes a JSON object. The only argument is a reference to +the newly-created hash. If the code references returns a single scalar +(which need not be a reference), this value (or rather a copy of it) is +inserted into the deserialised data structure. If it returns an empty +list (NOTE: I<not> C<undef>, which is a valid scalar), the original +deserialised hash will be inserted. This setting can slow down decoding +considerably. + +When C<$coderef> is omitted or undefined, any existing callback will +be removed and C<decode> will not change the deserialised hash in any +way. + +Example, convert all JSON objects into the integer 5: + + my $js = JSON::PP->new->filter_json_object(sub { 5 }); + # returns [5] + $js->decode('[{}]'); + # returns 5 + $js->decode('{"a":1, "b":2}'); + +=head2 filter_json_single_key_object + + $json = $json->filter_json_single_key_object($key [=> $coderef]) + +Works remotely similar to C<filter_json_object>, but is only called for +JSON objects having a single key named C<$key>. + +This C<$coderef> is called before the one specified via +C<filter_json_object>, if any. It gets passed the single value in the JSON +object. If it returns a single value, it will be inserted into the data +structure. If it returns nothing (not even C<undef> but the empty list), +the callback from C<filter_json_object> will be called next, as if no +single-key callback were specified. + +If C<$coderef> is omitted or undefined, the corresponding callback will be +disabled. There can only ever be one callback for a given key. + +As this callback gets called less often then the C<filter_json_object> +one, decoding speed will not usually suffer as much. Therefore, single-key +objects make excellent targets to serialise Perl objects into, especially +as single-key JSON objects are as close to the type-tagged value concept +as JSON gets (it's basically an ID/VALUE tuple). Of course, JSON does not +support this in any way, so you need to make sure your data never looks +like a serialised Perl hash. + +Typical names for the single object key are C<__class_whatever__>, or +C<$__dollars_are_rarely_used__$> or C<}ugly_brace_placement>, or even +things like C<__class_md5sum(classname)__>, to reduce the risk of clashing +with real hashes. + +Example, decode JSON objects of the form C<< { "__widget__" => <id> } >> +into the corresponding C<< $WIDGET{<id>} >> object: + + # return whatever is in $WIDGET{5}: + JSON::PP + ->new + ->filter_json_single_key_object (__widget__ => sub { + $WIDGET{ $_[0] } + }) + ->decode ('{"__widget__": 5') + + # this can be used with a TO_JSON method in some "widget" class + # for serialisation to json: + sub WidgetBase::TO_JSON { + my ($self) = @_; + + unless ($self->{id}) { + $self->{id} = ..get..some..id..; + $WIDGET{$self->{id}} = $self; + } + + { __widget__ => $self->{id} } + } + +=head2 shrink + + $json = $json->shrink([$enable]) + + $enabled = $json->get_shrink + +If C<$enable> is true (or missing), the string returned by C<encode> will +be shrunk (i.e. downgraded if possible). + +The actual definition of what shrink does might change in future versions, +but it will always try to save space at the expense of time. + +If C<$enable> is false, then JSON::PP does nothing. + +=head2 max_depth + + $json = $json->max_depth([$maximum_nesting_depth]) + + $max_depth = $json->get_max_depth + +Sets the maximum nesting level (default C<512>) accepted while encoding +or decoding. If a higher nesting level is detected in JSON text or a Perl +data structure, then the encoder and decoder will stop and croak at that +point. + +Nesting level is defined by number of hash- or arrayrefs that the encoder +needs to traverse to reach a given point or the number of C<{> or C<[> +characters without their matching closing parenthesis crossed to reach a +given character in a string. + +Setting the maximum depth to one disallows any nesting, so that ensures +that the object is only a single hash/object or array. + +If no argument is given, the highest possible setting will be used, which +is rarely useful. + +See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful. + +=head2 max_size + + $json = $json->max_size([$maximum_string_size]) + + $max_size = $json->get_max_size + +Set the maximum length a JSON text may have (in bytes) where decoding is +being attempted. The default is C<0>, meaning no limit. When C<decode> +is called on a string that is longer then this many bytes, it will not +attempt to decode the string but throw an exception. This setting has no +effect on C<encode> (yet). + +If no argument is given, the limit check will be deactivated (same as when +C<0> is specified). + +See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful. + +=head2 encode + + $json_text = $json->encode($perl_scalar) + +Converts the given Perl value or data structure to its JSON +representation. Croaks on error. + +=head2 decode + + $perl_scalar = $json->decode($json_text) + +The opposite of C<encode>: expects a JSON text and tries to parse it, +returning the resulting simple scalar or reference. Croaks on error. + +=head2 decode_prefix + + ($perl_scalar, $characters) = $json->decode_prefix($json_text) + +This works like the C<decode> method, but instead of raising an exception +when there is trailing garbage after the first JSON object, it will +silently stop parsing there and return the number of characters consumed +so far. + +This is useful if your JSON texts are not delimited by an outer protocol +and you need to know where the JSON text ends. + + JSON::PP->new->decode_prefix ("[1] the tail") + => ([1], 3) + +=head1 FLAGS FOR JSON::PP ONLY + +The following flags and properties are for JSON::PP only. If you use +any of these, you can't make your application run faster by replacing +JSON::PP with JSON::XS. If you need these and also speed boost, +you might want to try L<Cpanel::JSON::XS>, a fork of JSON::XS by +Reini Urban, which supports some of these (with a different set of +incompatibilities). Most of these historical flags are only kept +for backward compatibility, and should not be used in a new application. + +=head2 allow_singlequote + + $json = $json->allow_singlequote([$enable]) + $enabled = $json->get_allow_singlequote + +If C<$enable> is true (or missing), then C<decode> will accept +invalid JSON texts that contain strings that begin and end with +single quotation marks. C<encode> will not be affected in any way. +I<Be aware that this option makes you accept invalid JSON texts +as if they were valid!>. I suggest only to use this option to +parse application-specific files written by humans (configuration +files, resource files etc.) + +If C<$enable> is false (the default), then C<decode> will only accept +valid JSON texts. + + $json->allow_singlequote->decode(qq|{"foo":'bar'}|); + $json->allow_singlequote->decode(qq|{'foo':"bar"}|); + $json->allow_singlequote->decode(qq|{'foo':'bar'}|); + +=head2 allow_barekey + + $json = $json->allow_barekey([$enable]) + $enabled = $json->get_allow_barekey + +If C<$enable> is true (or missing), then C<decode> will accept +invalid JSON texts that contain JSON objects whose names don't +begin and end with quotation marks. C<encode> will not be affected +in any way. I<Be aware that this option makes you accept invalid JSON +texts as if they were valid!>. I suggest only to use this option to +parse application-specific files written by humans (configuration +files, resource files etc.) + +If C<$enable> is false (the default), then C<decode> will only accept +valid JSON texts. + + $json->allow_barekey->decode(qq|{foo:"bar"}|); + +=head2 allow_bignum + + $json = $json->allow_bignum([$enable]) + $enabled = $json->get_allow_bignum + +If C<$enable> is true (or missing), then C<decode> will convert +big integers Perl cannot handle as integer into L<Math::BigInt> +objects and convert floating numbers into L<Math::BigFloat> +objects. C<encode> will convert C<Math::BigInt> and C<Math::BigFloat> +objects into JSON numbers. + + $json->allow_nonref->allow_bignum; + $bigfloat = $json->decode('2.000000000000000000000000001'); + print $json->encode($bigfloat); + # => 2.000000000000000000000000001 + +See also L<MAPPING>. + +=head2 loose + + $json = $json->loose([$enable]) + $enabled = $json->get_loose + +If C<$enable> is true (or missing), then C<decode> will accept +invalid JSON texts that contain unescaped [\x00-\x1f\x22\x5c] +characters. C<encode> will not be affected in any way. +I<Be aware that this option makes you accept invalid JSON texts +as if they were valid!>. I suggest only to use this option to +parse application-specific files written by humans (configuration +files, resource files etc.) + +If C<$enable> is false (the default), then C<decode> will only accept +valid JSON texts. + + $json->loose->decode(qq|["abc + def"]|); + +=head2 escape_slash + + $json = $json->escape_slash([$enable]) + $enabled = $json->get_escape_slash + +If C<$enable> is true (or missing), then C<encode> will explicitly +escape I<slash> (solidus; C<U+002F>) characters to reduce the risk of +XSS (cross site scripting) that may be caused by C<< </script> >> +in a JSON text, with the cost of bloating the size of JSON texts. + +This option may be useful when you embed JSON in HTML, but embedding +arbitrary JSON in HTML (by some HTML template toolkit or by string +interpolation) is risky in general. You must escape necessary +characters in correct order, depending on the context. + +C<decode> will not be affected in any way. + +=head2 indent_length + + $json = $json->indent_length($number_of_spaces) + $length = $json->get_indent_length + +This option is only useful when you also enable C<indent> or C<pretty>. + +JSON::XS indents with three spaces when you C<encode> (if requested +by C<indent> or C<pretty>), and the number cannot be changed. +JSON::PP allows you to change/get the number of indent spaces with these +mutator/accessor. The default number of spaces is three (the same as +JSON::XS), and the acceptable range is from C<0> (no indentation; +it'd be better to disable indentation by C<indent(0)>) to C<15>. + +=head2 sort_by + + $json = $json->sort_by($code_ref) + $json = $json->sort_by($subroutine_name) + +If you just want to sort keys (names) in JSON objects when you +C<encode>, enable C<canonical> option (see above) that allows you to +sort object keys alphabetically. + +If you do need to sort non-alphabetically for whatever reasons, +you can give a code reference (or a subroutine name) to C<sort_by>, +then the argument will be passed to Perl's C<sort> built-in function. + +As the sorting is done in the JSON::PP scope, you usually need to +prepend C<JSON::PP::> to the subroutine name, and the special variables +C<$a> and C<$b> used in the subrontine used by C<sort> function. + +Example: + + my %ORDER = (id => 1, class => 2, name => 3); + $json->sort_by(sub { + ($ORDER{$JSON::PP::a} // 999) <=> ($ORDER{$JSON::PP::b} // 999) + or $JSON::PP::a cmp $JSON::PP::b + }); + print $json->encode([ + {name => 'CPAN', id => 1, href => 'http://cpan.org'} + ]); + # [{"id":1,"name":"CPAN","href":"http://cpan.org"}] + +Note that C<sort_by> affects all the plain hashes in the data structure. +If you need finer control, C<tie> necessary hashes with a module that +implements ordered hash (such as L<Hash::Ordered> and L<Tie::IxHash>). +C<canonical> and C<sort_by> don't affect the key order in C<tie>d +hashes. + + use Hash::Ordered; + tie my %hash, 'Hash::Ordered', + (name => 'CPAN', id => 1, href => 'http://cpan.org'); + print $json->encode([\%hash]); + # [{"name":"CPAN","id":1,"href":"http://cpan.org"}] # order is kept + +=head1 INCREMENTAL PARSING + +This section is also taken from JSON::XS. + +In some cases, there is the need for incremental parsing of JSON +texts. While this module always has to keep both JSON text and resulting +Perl data structure in memory at one time, it does allow you to parse a +JSON stream incrementally. It does so by accumulating text until it has +a full JSON object, which it then can decode. This process is similar to +using C<decode_prefix> to see if a full JSON object is available, but +is much more efficient (and can be implemented with a minimum of method +calls). + +JSON::PP will only attempt to parse the JSON text once it is sure it +has enough text to get a decisive result, using a very simple but +truly incremental parser. This means that it sometimes won't stop as +early as the full parser, for example, it doesn't detect mismatched +parentheses. The only thing it guarantees is that it starts decoding as +soon as a syntactically valid JSON text has been seen. This means you need +to set resource limits (e.g. C<max_size>) to ensure the parser will stop +parsing in the presence if syntax errors. + +The following methods implement this incremental parser. + +=head2 incr_parse + + $json->incr_parse( [$string] ) # void context + + $obj_or_undef = $json->incr_parse( [$string] ) # scalar context + + @obj_or_empty = $json->incr_parse( [$string] ) # list context + +This is the central parsing function. It can both append new text and +extract objects from the stream accumulated so far (both of these +functions are optional). + +If C<$string> is given, then this string is appended to the already +existing JSON fragment stored in the C<$json> object. + +After that, if the function is called in void context, it will simply +return without doing anything further. This can be used to add more text +in as many chunks as you want. + +If the method is called in scalar context, then it will try to extract +exactly I<one> JSON object. If that is successful, it will return this +object, otherwise it will return C<undef>. If there is a parse error, +this method will croak just as C<decode> would do (one can then use +C<incr_skip> to skip the erroneous part). This is the most common way of +using the method. + +And finally, in list context, it will try to extract as many objects +from the stream as it can find and return them, or the empty list +otherwise. For this to work, there must be no separators (other than +whitespace) between the JSON objects or arrays, instead they must be +concatenated back-to-back. If an error occurs, an exception will be +raised as in the scalar context case. Note that in this case, any +previously-parsed JSON texts will be lost. + +Example: Parse some JSON arrays/objects in a given string and return +them. + + my @objs = JSON::PP->new->incr_parse ("[5][7][1,2]"); + +=head2 incr_text + + $lvalue_string = $json->incr_text + +This method returns the currently stored JSON fragment as an lvalue, that +is, you can manipulate it. This I<only> works when a preceding call to +C<incr_parse> in I<scalar context> successfully returned an object. Under +all other circumstances you must not call this function (I mean it. +although in simple tests it might actually work, it I<will> fail under +real world conditions). As a special exception, you can also call this +method before having parsed anything. + +That means you can only use this function to look at or manipulate text +before or after complete JSON objects, not while the parser is in the +middle of parsing a JSON object. + +This function is useful in two cases: a) finding the trailing text after a +JSON object or b) parsing multiple JSON objects separated by non-JSON text +(such as commas). + +=head2 incr_skip + + $json->incr_skip + +This will reset the state of the incremental parser and will remove +the parsed text from the input buffer so far. This is useful after +C<incr_parse> died, in which case the input buffer and incremental parser +state is left unchanged, to skip the text parsed so far and to reset the +parse state. + +The difference to C<incr_reset> is that only text until the parse error +occurred is removed. + +=head2 incr_reset + + $json->incr_reset + +This completely resets the incremental parser, that is, after this call, +it will be as if the parser had never parsed anything. + +This is useful if you want to repeatedly parse JSON objects and want to +ignore any trailing data, which means you have to reset the parser after +each successful decode. + +=head1 MAPPING + +Most of this section is also taken from JSON::XS. + +This section describes how JSON::PP maps Perl values to JSON values and +vice versa. These mappings are designed to "do the right thing" in most +circumstances automatically, preserving round-tripping characteristics +(what you put in comes out as something equivalent). + +For the more enlightened: note that in the following descriptions, +lowercase I<perl> refers to the Perl interpreter, while uppercase I<Perl> +refers to the abstract Perl language itself. + +=head2 JSON -> PERL + +=over 4 + +=item object + +A JSON object becomes a reference to a hash in Perl. No ordering of object +keys is preserved (JSON does not preserve object key ordering itself). + +=item array + +A JSON array becomes a reference to an array in Perl. + +=item string + +A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON +are represented by the same codepoints in the Perl string, so no manual +decoding is necessary. + +=item number + +A JSON number becomes either an integer, numeric (floating point) or +string scalar in perl, depending on its range and any fractional parts. On +the Perl level, there is no difference between those as Perl handles all +the conversion details, but an integer may take slightly less memory and +might represent more values exactly than floating point numbers. + +If the number consists of digits only, JSON::PP will try to represent +it as an integer value. If that fails, it will try to represent it as +a numeric (floating point) value if that is possible without loss of +precision. Otherwise it will preserve the number as a string value (in +which case you lose roundtripping ability, as the JSON number will be +re-encoded to a JSON string). + +Numbers containing a fractional or exponential part will always be +represented as numeric (floating point) values, possibly at a loss of +precision (in which case you might lose perfect roundtripping ability, but +the JSON number will still be re-encoded as a JSON number). + +Note that precision is not accuracy - binary floating point values cannot +represent most decimal fractions exactly, and when converting from and to +floating point, JSON::PP only guarantees precision up to but not including +the least significant bit. + +When C<allow_bignum> is enabled, big integer values and any numeric +values will be converted into L<Math::BigInt> and L<Math::BigFloat> +objects respectively, without becoming string scalars or losing +precision. + +=item true, false + +These JSON atoms become C<JSON::PP::true> and C<JSON::PP::false>, +respectively. They are overloaded to act almost exactly like the numbers +C<1> and C<0>. You can check whether a scalar is a JSON boolean by using +the C<JSON::PP::is_bool> function. + +=item null + +A JSON null atom becomes C<undef> in Perl. + +=item shell-style comments (C<< # I<text> >>) + +As a nonstandard extension to the JSON syntax that is enabled by the +C<relaxed> setting, shell-style comments are allowed. They can start +anywhere outside strings and go till the end of the line. + +=item tagged values (C<< (I<tag>)I<value> >>). + +Another nonstandard extension to the JSON syntax, enabled with the +C<allow_tags> setting, are tagged values. In this implementation, the +I<tag> must be a perl package/class name encoded as a JSON string, and the +I<value> must be a JSON array encoding optional constructor arguments. + +See L<OBJECT SERIALISATION>, below, for details. + +=back + + +=head2 PERL -> JSON + +The mapping from Perl to JSON is slightly more difficult, as Perl is a +truly typeless language, so we can only guess which JSON type is meant by +a Perl value. + +=over 4 + +=item hash references + +Perl hash references become JSON objects. As there is no inherent +ordering in hash keys (or JSON objects), they will usually be encoded +in a pseudo-random order. JSON::PP can optionally sort the hash keys +(determined by the I<canonical> flag and/or I<sort_by> property), so +the same data structure will serialise to the same JSON text (given +same settings and version of JSON::PP), but this incurs a runtime +overhead and is only rarely useful, e.g. when you want to compare some +JSON text against another for equality. + +=item array references + +Perl array references become JSON arrays. + +=item other references + +Other unblessed references are generally not allowed and will cause an +exception to be thrown, except for references to the integers C<0> and +C<1>, which get turned into C<false> and C<true> atoms in JSON. You can +also use C<JSON::PP::false> and C<JSON::PP::true> to improve +readability. + + to_json [\0, JSON::PP::true] # yields [false,true] + +=item JSON::PP::true, JSON::PP::false + +These special values become JSON true and JSON false values, +respectively. You can also use C<\1> and C<\0> directly if you want. + +=item JSON::PP::null + +This special value becomes JSON null. + +=item blessed objects + +Blessed objects are not directly representable in JSON, but C<JSON::PP> +allows various ways of handling objects. See L<OBJECT SERIALISATION>, +below, for details. + +=item simple scalars + +Simple Perl scalars (any scalar that is not a reference) are the most +difficult objects to encode: JSON::PP will encode undefined scalars as +JSON C<null> values, scalars that have last been used in a string context +before encoding as JSON strings, and anything else as number value: + + # dump as number + encode_json [2] # yields [2] + encode_json [-3.0e17] # yields [-3e+17] + my $value = 5; encode_json [$value] # yields [5] + + # used as string, so dump as string + print $value; + encode_json [$value] # yields ["5"] + + # undef becomes null + encode_json [undef] # yields [null] + +You can force the type to be a JSON string by stringifying it: + + my $x = 3.1; # some variable containing a number + "$x"; # stringified + $x .= ""; # another, more awkward way to stringify + print $x; # perl does it for you, too, quite often + # (but for older perls) + +You can force the type to be a JSON number by numifying it: + + my $x = "3"; # some variable containing a string + $x += 0; # numify it, ensuring it will be dumped as a number + $x *= 1; # same thing, the choice is yours. + +You can not currently force the type in other, less obscure, ways. + +Since version 2.91_01, JSON::PP uses a different number detection logic +that converts a scalar that is possible to turn into a number safely. +The new logic is slightly faster, and tends to help people who use older +perl or who want to encode complicated data structure. However, this may +results in a different JSON text from the one JSON::XS encodes (and +thus may break tests that compare entire JSON texts). If you do +need the previous behavior for compatibility or for finer control, +set PERL_JSON_PP_USE_B environmental variable to true before you +C<use> JSON::PP (or JSON.pm). + +Note that numerical precision has the same meaning as under Perl (so +binary to decimal conversion follows the same rules as in Perl, which +can differ to other languages). Also, your perl interpreter might expose +extensions to the floating point numbers of your platform, such as +infinities or NaN's - these cannot be represented in JSON, and it is an +error to pass those in. + +JSON::PP (and JSON::XS) trusts what you pass to C<encode> method +(or C<encode_json> function) is a clean, validated data structure with +values that can be represented as valid JSON values only, because it's +not from an external data source (as opposed to JSON texts you pass to +C<decode> or C<decode_json>, which JSON::PP considers tainted and +doesn't trust). As JSON::PP doesn't know exactly what you and consumers +of your JSON texts want the unexpected values to be (you may want to +convert them into null, or to stringify them with or without +normalisation (string representation of infinities/NaN may vary +depending on platforms), or to croak without conversion), you're advised +to do what you and your consumers need before you encode, and also not +to numify values that may start with values that look like a number +(including infinities/NaN), without validating. + +=back + +=head2 OBJECT SERIALISATION + +As JSON cannot directly represent Perl objects, you have to choose between +a pure JSON representation (without the ability to deserialise the object +automatically again), and a nonstandard extension to the JSON syntax, +tagged values. + +=head3 SERIALISATION + +What happens when C<JSON::PP> encounters a Perl object depends on the +C<allow_blessed>, C<convert_blessed>, C<allow_tags> and C<allow_bignum> +settings, which are used in this order: + +=over 4 + +=item 1. C<allow_tags> is enabled and the object has a C<FREEZE> method. + +In this case, C<JSON::PP> creates a tagged JSON value, using a nonstandard +extension to the JSON syntax. + +This works by invoking the C<FREEZE> method on the object, with the first +argument being the object to serialise, and the second argument being the +constant string C<JSON> to distinguish it from other serialisers. + +The C<FREEZE> method can return any number of values (i.e. zero or +more). These values and the paclkage/classname of the object will then be +encoded as a tagged JSON value in the following format: + + ("classname")[FREEZE return values...] + +e.g.: + + ("URI")["http://www.google.com/"] + ("MyDate")[2013,10,29] + ("ImageData::JPEG")["Z3...VlCg=="] + +For example, the hypothetical C<My::Object> C<FREEZE> method might use the +objects C<type> and C<id> members to encode the object: + + sub My::Object::FREEZE { + my ($self, $serialiser) = @_; + + ($self->{type}, $self->{id}) + } + +=item 2. C<convert_blessed> is enabled and the object has a C<TO_JSON> method. + +In this case, the C<TO_JSON> method of the object is invoked in scalar +context. It must return a single scalar that can be directly encoded into +JSON. This scalar replaces the object in the JSON text. + +For example, the following C<TO_JSON> method will convert all L<URI> +objects to JSON strings when serialised. The fact that these values +originally were L<URI> objects is lost. + + sub URI::TO_JSON { + my ($uri) = @_; + $uri->as_string + } + +=item 3. C<allow_bignum> is enabled and the object is a C<Math::BigInt> or C<Math::BigFloat>. + +The object will be serialised as a JSON number value. + +=item 4. C<allow_blessed> is enabled. + +The object will be serialised as a JSON null value. + +=item 5. none of the above + +If none of the settings are enabled or the respective methods are missing, +C<JSON::PP> throws an exception. + +=back + +=head3 DESERIALISATION + +For deserialisation there are only two cases to consider: either +nonstandard tagging was used, in which case C<allow_tags> decides, +or objects cannot be automatically be deserialised, in which +case you can use postprocessing or the C<filter_json_object> or +C<filter_json_single_key_object> callbacks to get some real objects our of +your JSON. + +This section only considers the tagged value case: a tagged JSON object +is encountered during decoding and C<allow_tags> is disabled, a parse +error will result (as if tagged values were not part of the grammar). + +If C<allow_tags> is enabled, C<JSON::PP> will look up the C<THAW> method +of the package/classname used during serialisation (it will not attempt +to load the package as a Perl module). If there is no such method, the +decoding will fail with an error. + +Otherwise, the C<THAW> method is invoked with the classname as first +argument, the constant string C<JSON> as second argument, and all the +values from the JSON array (the values originally returned by the +C<FREEZE> method) as remaining arguments. + +The method must then return the object. While technically you can return +any Perl scalar, you might have to enable the C<allow_nonref> setting to +make that work in all cases, so better return an actual blessed reference. + +As an example, let's implement a C<THAW> function that regenerates the +C<My::Object> from the C<FREEZE> example earlier: + + sub My::Object::THAW { + my ($class, $serialiser, $type, $id) = @_; + + $class->new (type => $type, id => $id) + } + + +=head1 ENCODING/CODESET FLAG NOTES + +This section is taken from JSON::XS. + +The interested reader might have seen a number of flags that signify +encodings or codesets - C<utf8>, C<latin1> and C<ascii>. There seems to be +some confusion on what these do, so here is a short comparison: + +C<utf8> controls whether the JSON text created by C<encode> (and expected +by C<decode>) is UTF-8 encoded or not, while C<latin1> and C<ascii> only +control whether C<encode> escapes character values outside their respective +codeset range. Neither of these flags conflict with each other, although +some combinations make less sense than others. + +Care has been taken to make all flags symmetrical with respect to +C<encode> and C<decode>, that is, texts encoded with any combination of +these flag values will be correctly decoded when the same flags are used +- in general, if you use different flag settings while encoding vs. when +decoding you likely have a bug somewhere. + +Below comes a verbose discussion of these flags. Note that a "codeset" is +simply an abstract set of character-codepoint pairs, while an encoding +takes those codepoint numbers and I<encodes> them, in our case into +octets. Unicode is (among other things) a codeset, UTF-8 is an encoding, +and ISO-8859-1 (= latin 1) and ASCII are both codesets I<and> encodings at +the same time, which can be confusing. + +=over 4 + +=item C<utf8> flag disabled + +When C<utf8> is disabled (the default), then C<encode>/C<decode> generate +and expect Unicode strings, that is, characters with high ordinal Unicode +values (> 255) will be encoded as such characters, and likewise such +characters are decoded as-is, no changes to them will be done, except +"(re-)interpreting" them as Unicode codepoints or Unicode characters, +respectively (to Perl, these are the same thing in strings unless you do +funny/weird/dumb stuff). + +This is useful when you want to do the encoding yourself (e.g. when you +want to have UTF-16 encoded JSON texts) or when some other layer does +the encoding for you (for example, when printing to a terminal using a +filehandle that transparently encodes to UTF-8 you certainly do NOT want +to UTF-8 encode your data first and have Perl encode it another time). + +=item C<utf8> flag enabled + +If the C<utf8>-flag is enabled, C<encode>/C<decode> will encode all +characters using the corresponding UTF-8 multi-byte sequence, and will +expect your input strings to be encoded as UTF-8, that is, no "character" +of the input string must have any value > 255, as UTF-8 does not allow +that. + +The C<utf8> flag therefore switches between two modes: disabled means you +will get a Unicode string in Perl, enabled means you get an UTF-8 encoded +octet/binary string in Perl. + +=item C<latin1> or C<ascii> flags enabled + +With C<latin1> (or C<ascii>) enabled, C<encode> will escape characters +with ordinal values > 255 (> 127 with C<ascii>) and encode the remaining +characters as specified by the C<utf8> flag. + +If C<utf8> is disabled, then the result is also correctly encoded in those +character sets (as both are proper subsets of Unicode, meaning that a +Unicode string with all character values < 256 is the same thing as a +ISO-8859-1 string, and a Unicode string with all character values < 128 is +the same thing as an ASCII string in Perl). + +If C<utf8> is enabled, you still get a correct UTF-8-encoded string, +regardless of these flags, just some more characters will be escaped using +C<\uXXXX> then before. + +Note that ISO-8859-1-I<encoded> strings are not compatible with UTF-8 +encoding, while ASCII-encoded strings are. That is because the ISO-8859-1 +encoding is NOT a subset of UTF-8 (despite the ISO-8859-1 I<codeset> being +a subset of Unicode), while ASCII is. + +Surprisingly, C<decode> will ignore these flags and so treat all input +values as governed by the C<utf8> flag. If it is disabled, this allows you +to decode ISO-8859-1- and ASCII-encoded strings, as both strict subsets of +Unicode. If it is enabled, you can correctly decode UTF-8 encoded strings. + +So neither C<latin1> nor C<ascii> are incompatible with the C<utf8> flag - +they only govern when the JSON output engine escapes a character or not. + +The main use for C<latin1> is to relatively efficiently store binary data +as JSON, at the expense of breaking compatibility with most JSON decoders. + +The main use for C<ascii> is to force the output to not contain characters +with values > 127, which means you can interpret the resulting string +as UTF-8, ISO-8859-1, ASCII, KOI8-R or most about any character set and +8-bit-encoding, and still get the same data structure back. This is useful +when your channel for JSON transfer is not 8-bit clean or the encoding +might be mangled in between (e.g. in mail), and works because ASCII is a +proper subset of most 8-bit and multibyte encodings in use in the world. + +=back + +=head1 BUGS + +Please report bugs on a specific behavior of this module to RT or GitHub +issues (preferred): + +L<https://github.com/makamaka/JSON-PP/issues> + +L<https://rt.cpan.org/Public/Dist/Display.html?Queue=JSON-PP> + +As for new features and requests to change common behaviors, please +ask the author of JSON::XS (Marc Lehmann, E<lt>schmorp[at]schmorp.deE<gt>) +first, by email (important!), to keep compatibility among JSON.pm backends. + +Generally speaking, if you need something special for you, you are advised +to create a new module, maybe based on L<JSON::Tiny>, which is smaller and +written in a much cleaner way than this module. + +=head1 SEE ALSO + +The F<json_pp> command line utility for quick experiments. + +L<JSON::XS>, L<Cpanel::JSON::XS>, and L<JSON::Tiny> for faster alternatives. +L<JSON> and L<JSON::MaybeXS> for easy migration. + +L<JSON::PP::Compat5005> and L<JSON::PP::Compat5006> for older perl users. + +RFC4627 (L<http://www.ietf.org/rfc/rfc4627.txt>) + +RFC7159 (L<http://www.ietf.org/rfc/rfc7159.txt>) + +RFC8259 (L<http://www.ietf.org/rfc/rfc8259.txt>) + +=head1 AUTHOR + +Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt> + +=head1 CURRENT MAINTAINER + +Kenichi Ishigaki, E<lt>ishigaki[at]cpan.orgE<gt> + +=head1 COPYRIGHT AND LICENSE + +Copyright 2007-2016 by Makamaka Hannyaharamitu + +Most of the documentation is taken from JSON::XS by Marc Lehmann + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pm b/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pm new file mode 100644 index 0000000000000000000000000000000000000000..f70438b78d4528a1623ea1a37f9cb0d1b6204dd1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pm @@ -0,0 +1,859 @@ +package Locale::Maketext; +use strict; +our $USE_LITERALS; +use Carp (); +use I18N::LangTags (); +use I18N::LangTags::Detect (); + +#-------------------------------------------------------------------------- + +BEGIN { unless(defined &DEBUG) { *DEBUG = sub () {0} } } +# define the constant 'DEBUG' at compile-time + +# turn on utf8 if we have it (this is what GutsLoader.pm used to do essentially ) +# use if (exists $INC{'utf8.pm'} || eval 'use utf8'), 'utf8'; +BEGIN { + + # if we have it || we can load it + if ( exists $INC{'utf8.pm'} || eval { local $SIG{'__DIE__'};require utf8; } ) { + utf8->import(); + DEBUG and warn " utf8 on for _compile()\n"; + } + else { + DEBUG and warn " utf8 not available for _compile() ($INC{'utf8.pm'})\n$@\n"; + } +} + + +our $VERSION = '1.29'; +our @ISA = (); + +our $MATCH_SUPERS = 1; +our $MATCH_SUPERS_TIGHTLY = 1; +our $USING_LANGUAGE_TAGS = 1; +# Turning this off is somewhat of a security risk in that little or no +# checking will be done on the legality of tokens passed to the +# eval("use $module_name") in _try_use. If you turn this off, you have +# to do your own taint checking. + +$USE_LITERALS = 1 unless defined $USE_LITERALS; +# a hint for compiling bracket-notation things. + +my %isa_scan = (); + +########################################################################### + +sub quant { + my($handle, $num, @forms) = @_; + + return $num if @forms == 0; # what should this mean? + return $forms[2] if @forms > 2 and $num == 0; # special zeroth case + + # Normal case: + # Note that the formatting of $num is preserved. + return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) ); + # Most human languages put the number phrase before the qualified phrase. +} + + +sub numerate { + # return this lexical item in a form appropriate to this number + my($handle, $num, @forms) = @_; + my $s = ($num == 1); + + return '' unless @forms; + if(@forms == 1) { # only the headword form specified + return $s ? $forms[0] : ($forms[0] . 's'); # very cheap hack. + } + else { # sing and plural were specified + return $s ? $forms[0] : $forms[1]; + } +} + +#-------------------------------------------------------------------------- + +sub numf { + my($handle, $num) = @_[0,1]; + if($num < 10_000_000_000 and $num > -10_000_000_000 and $num == int($num)) { + $num += 0; # Just use normal integer stringification. + # Specifically, don't let %G turn ten million into 1E+007 + } + else { + $num = CORE::sprintf('%G', $num); + # "CORE::" is there to avoid confusion with the above sub sprintf. + } + while( $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/s ) {1} # right from perlfaq5 + # The initial \d+ gobbles as many digits as it can, and then we + # backtrack so it un-eats the rightmost three, and then we + # insert the comma there. + + $num =~ tr<.,><,.> if ref($handle) and $handle->{'numf_comma'}; + # This is just a lame hack instead of using Number::Format + return $num; +} + +sub sprintf { + no integer; + my($handle, $format, @params) = @_; + return CORE::sprintf($format, @params); + # "CORE::" is there to avoid confusion with myself! +} + +#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=# + +use integer; # vroom vroom... applies to the whole rest of the module + +sub language_tag { + my $it = ref($_[0]) || $_[0]; + return undef unless $it =~ m/([^':]+)(?:::)?$/s; + $it = lc($1); + $it =~ tr<_><->; + return $it; +} + +sub encoding { + my $it = $_[0]; + return( + (ref($it) && $it->{'encoding'}) + || 'iso-8859-1' # Latin-1 + ); +} + +#-------------------------------------------------------------------------- + +sub fallback_languages { return('i-default', 'en', 'en-US') } + +sub fallback_language_classes { return () } + +#-------------------------------------------------------------------------- + +sub fail_with { # an actual attribute method! + my($handle, @params) = @_; + return unless ref($handle); + $handle->{'fail'} = $params[0] if @params; + return $handle->{'fail'}; +} + +#-------------------------------------------------------------------------- + +sub blacklist { + my ( $handle, @methods ) = @_; + + unless ( defined $handle->{'blacklist'} ) { + no strict 'refs'; + + # Don't let people call methods they're not supposed to from maketext. + # Explicitly exclude all methods in this package that start with an + # underscore on principle. + $handle->{'blacklist'} = { + map { $_ => 1 } ( + qw/ + blacklist + encoding + fail_with + failure_handler_auto + fallback_language_classes + fallback_languages + get_handle + init + language_tag + maketext + new + whitelist + /, grep { /^_/ } keys %{ __PACKAGE__ . "::" } + ), + }; + } + + if ( scalar @methods ) { + $handle->{'blacklist'} = { %{ $handle->{'blacklist'} }, map { $_ => 1 } @methods }; + } + + delete $handle->{'_external_lex_cache'}; + return; +} + +sub whitelist { + my ( $handle, @methods ) = @_; + if ( scalar @methods ) { + $handle->{'whitelist'} = {} unless defined $handle->{'whitelist'}; + $handle->{'whitelist'} = { %{ $handle->{'whitelist'} }, map { $_ => 1 } @methods }; + } + + delete $handle->{'_external_lex_cache'}; + return; +} + +#-------------------------------------------------------------------------- + +sub failure_handler_auto { + # Meant to be used like: + # $handle->fail_with('failure_handler_auto') + + my $handle = shift; + my $phrase = shift; + + $handle->{'failure_lex'} ||= {}; + my $lex = $handle->{'failure_lex'}; + + my $value ||= ($lex->{$phrase} ||= $handle->_compile($phrase)); + + # Dumbly copied from sub maketext: + return ${$value} if ref($value) eq 'SCALAR'; + return $value if ref($value) ne 'CODE'; + { + local $SIG{'__DIE__'}; + eval { $value = &$value($handle, @_) }; + } + # If we make it here, there was an exception thrown in the + # call to $value, and so scream: + if($@) { + # pretty up the error message + $@ =~ s{\s+at\s+\(eval\s+\d+\)\s+line\s+(\d+)\.?\n?} + {\n in bracket code [compiled line $1],}s; + #$err =~ s/\n?$/\n/s; + Carp::croak "Error in maketexting \"$phrase\":\n$@ as used"; + # Rather unexpected, but suppose that the sub tried calling + # a method that didn't exist. + } + else { + return $value; + } +} + +#========================================================================== + +sub new { + # Nothing fancy! + my $class = ref($_[0]) || $_[0]; + my $handle = bless {}, $class; + $handle->blacklist; + $handle->init; + return $handle; +} + +sub init { return } # no-op + +########################################################################### + +sub maketext { + # Remember, this can fail. Failure is controllable many ways. + Carp::croak 'maketext requires at least one parameter' unless @_ > 1; + + my($handle, $phrase) = splice(@_,0,2); + Carp::confess('No handle/phrase') unless (defined($handle) && defined($phrase)); + + # backup $@ in case it's still being used in the calling code. + # If no failures, we'll re-set it back to what it was later. + my $at = $@; + + # Copy @_ case one of its elements is $@. + @_ = @_; + + # Look up the value: + + my $value; + if (exists $handle->{'_external_lex_cache'}{$phrase}) { + DEBUG and warn "* Using external lex cache version of \"$phrase\"\n"; + $value = $handle->{'_external_lex_cache'}{$phrase}; + } + else { + foreach my $h_r ( + @{ $isa_scan{ref($handle) || $handle} || $handle->_lex_refs } + ) { + DEBUG and warn "* Looking up \"$phrase\" in $h_r\n"; + if(exists $h_r->{$phrase}) { + DEBUG and warn " Found \"$phrase\" in $h_r\n"; + unless(ref($value = $h_r->{$phrase})) { + # Nonref means it's not yet compiled. Compile and replace. + if ($handle->{'use_external_lex_cache'}) { + $value = $handle->{'_external_lex_cache'}{$phrase} = $handle->_compile($value); + } + else { + $value = $h_r->{$phrase} = $handle->_compile($value); + } + } + last; + } + # extending packages need to be able to localize _AUTO and if readonly can't "local $h_r->{'_AUTO'} = 1;" + # but they can "local $handle->{'_external_lex_cache'}{'_AUTO'} = 1;" + elsif($phrase !~ m/^_/s and ($handle->{'use_external_lex_cache'} ? ( exists $handle->{'_external_lex_cache'}{'_AUTO'} ? $handle->{'_external_lex_cache'}{'_AUTO'} : $h_r->{'_AUTO'} ) : $h_r->{'_AUTO'})) { + # it's an auto lex, and this is an autoable key! + DEBUG and warn " Automaking \"$phrase\" into $h_r\n"; + if ($handle->{'use_external_lex_cache'}) { + $value = $handle->{'_external_lex_cache'}{$phrase} = $handle->_compile($phrase); + } + else { + $value = $h_r->{$phrase} = $handle->_compile($phrase); + } + last; + } + DEBUG>1 and print " Not found in $h_r, nor automakable\n"; + # else keep looking + } + } + + unless(defined($value)) { + DEBUG and warn "! Lookup of \"$phrase\" in/under ", ref($handle) || $handle, " fails.\n"; + if(ref($handle) and $handle->{'fail'}) { + DEBUG and warn "WARNING0: maketext fails looking for <$phrase>\n"; + my $fail; + if(ref($fail = $handle->{'fail'}) eq 'CODE') { # it's a sub reference + $@ = $at; # Put $@ back in case we altered it along the way. + return &{$fail}($handle, $phrase, @_); + # If it ever returns, it should return a good value. + } + else { # It's a method name + $@ = $at; # Put $@ back in case we altered it along the way. + return $handle->$fail($phrase, @_); + # If it ever returns, it should return a good value. + } + } + else { + # All we know how to do is this; + Carp::croak("maketext doesn't know how to say:\n$phrase\nas needed"); + } + } + + if(ref($value) eq 'SCALAR'){ + $@ = $at; # Put $@ back in case we altered it along the way. + return $$value ; + } + if(ref($value) ne 'CODE'){ + $@ = $at; # Put $@ back in case we altered it along the way. + return $value ; + } + + { + local $SIG{'__DIE__'}; + eval { $value = &$value($handle, @_) }; + } + # If we make it here, there was an exception thrown in the + # call to $value, and so scream: + if ($@) { + # pretty up the error message + $@ =~ s{\s+at\s+\(eval\s+\d+\)\s+line\s+(\d+)\.?\n?} + {\n in bracket code [compiled line $1],}s; + #$err =~ s/\n?$/\n/s; + Carp::croak "Error in maketexting \"$phrase\":\n$@ as used"; + # Rather unexpected, but suppose that the sub tried calling + # a method that didn't exist. + } + else { + $@ = $at; # Put $@ back in case we altered it along the way. + return $value; + } + $@ = $at; # Put $@ back in case we altered it along the way. +} + +########################################################################### + +sub get_handle { # This is a constructor and, yes, it CAN FAIL. + # Its class argument has to be the base class for the current + # application's l10n files. + + my($base_class, @languages) = @_; + $base_class = ref($base_class) || $base_class; + # Complain if they use __PACKAGE__ as a project base class? + + if( @languages ) { + DEBUG and warn 'Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + if($USING_LANGUAGE_TAGS) { # An explicit language-list was given! + @languages = + map {; $_, I18N::LangTags::alternate_language_tags($_) } + # Catch alternation + map I18N::LangTags::locale2language_tag($_), + # If it's a lg tag, fine, pass thru (untainted) + # If it's a locale ID, try converting to a lg tag (untainted), + # otherwise nix it. + @languages; + DEBUG and warn 'Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + } + } + else { + @languages = $base_class->_ambient_langprefs; + } + + @languages = $base_class->_langtag_munging(@languages); + + my %seen; + foreach my $module_name ( map { $base_class . '::' . $_ } @languages ) { + next unless length $module_name; # sanity + next if $seen{$module_name}++ # Already been here, and it was no-go + || !&_try_use($module_name); # Try to use() it, but can't it. + return($module_name->new); # Make it! + } + + return undef; # Fail! +} + +########################################################################### + +sub _langtag_munging { + my($base_class, @languages) = @_; + + # We have all these DEBUG statements because otherwise it's hard as hell + # to diagnose if/when something goes wrong. + + DEBUG and warn 'Lgs1: ', map("<$_>", @languages), "\n"; + + if($USING_LANGUAGE_TAGS) { + DEBUG and warn 'Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + @languages = $base_class->_add_supers( @languages ); + + push @languages, I18N::LangTags::panic_languages(@languages); + DEBUG and warn "After adding panic languages:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + push @languages, $base_class->fallback_languages; + # You are free to override fallback_languages to return empty-list! + DEBUG and warn 'Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + @languages = # final bit of processing to turn them into classname things + map { + my $it = $_; # copy + $it =~ tr<-A-Z><_a-z>; # lc, and turn - to _ + $it =~ tr<_a-z0-9><>cd; # remove all but a-z0-9_ + $it; + } @languages + ; + DEBUG and warn "Nearing end of munging:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + } + else { + DEBUG and warn "Bypassing language-tags.\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + } + + DEBUG and warn "Before adding fallback classes:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + push @languages, $base_class->fallback_language_classes; + # You are free to override that to return whatever. + + DEBUG and warn "Finally:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + return @languages; +} + +########################################################################### + +sub _ambient_langprefs { + return I18N::LangTags::Detect::detect(); +} + +########################################################################### + +sub _add_supers { + my($base_class, @languages) = @_; + + if (!$MATCH_SUPERS) { + # Nothing + DEBUG and warn "Bypassing any super-matching.\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + } + elsif( $MATCH_SUPERS_TIGHTLY ) { + DEBUG and warn "Before adding new supers tightly:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + @languages = I18N::LangTags::implicate_supers( @languages ); + DEBUG and warn "After adding new supers tightly:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + + } + else { + DEBUG and warn "Before adding supers to end:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + @languages = I18N::LangTags::implicate_supers_strictly( @languages ); + DEBUG and warn "After adding supers to end:\n", + ' Lgs@', __LINE__, ': ', map("<$_>", @languages), "\n"; + } + + return @languages; +} + +########################################################################### +# +# This is where most people should stop reading. +# +########################################################################### + +my %tried = (); +# memoization of whether we've used this module, or found it unusable. + +sub _try_use { # Basically a wrapper around "require Modulename" + # "Many men have tried..." "They tried and failed?" "They tried and died." + return $tried{$_[0]} if exists $tried{$_[0]}; # memoization + + my $module = $_[0]; # ASSUME sane module name! + { no strict 'refs'; + no warnings 'once'; + return($tried{$module} = 1) + if %{$module . '::Lexicon'} or @{$module . '::ISA'}; + # weird case: we never use'd it, but there it is! + } + + DEBUG and warn " About to use $module ...\n"; + + local $SIG{'__DIE__'}; + local $@; + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + eval "require $module"; # used to be "use $module", but no point in that. + + if($@) { + DEBUG and warn "Error using $module \: $@\n"; + return $tried{$module} = 0; + } + else { + DEBUG and warn " OK, $module is used\n"; + return $tried{$module} = 1; + } +} + +#-------------------------------------------------------------------------- + +sub _lex_refs { # report the lexicon references for this handle's class + # returns an arrayREF! + no strict 'refs'; + no warnings 'once'; + my $class = ref($_[0]) || $_[0]; + DEBUG and warn "Lex refs lookup on $class\n"; + return $isa_scan{$class} if exists $isa_scan{$class}; # memoization! + + my @lex_refs; + my $seen_r = ref($_[1]) ? $_[1] : {}; + + if( defined( *{$class . '::Lexicon'}{'HASH'} )) { + push @lex_refs, *{$class . '::Lexicon'}{'HASH'}; + DEBUG and warn '%' . $class . '::Lexicon contains ', + scalar(keys %{$class . '::Lexicon'}), " entries\n"; + } + + # Implements depth(height?)-first recursive searching of superclasses. + # In hindsight, I suppose I could have just used Class::ISA! + foreach my $superclass (@{$class . '::ISA'}) { + DEBUG and warn " Super-class search into $superclass\n"; + next if $seen_r->{$superclass}++; + push @lex_refs, @{&_lex_refs($superclass, $seen_r)}; # call myself + } + + $isa_scan{$class} = \@lex_refs; # save for next time + return \@lex_refs; +} + +sub clear_isa_scan { %isa_scan = (); return; } # end on a note of simplicity! + +#-------------------------------------------------------------------------- + +sub _compile { + # This big scary routine compiles an entry. + # It returns either a coderef if there's brackety bits in this, or + # otherwise a ref to a scalar. + + my $string_to_compile = $_[1]; # There are taint issues using regex on @_ - perlbug 60378,27344 + + # The while() regex is more expensive than this check on strings that don't need a compile. + # this op causes a ~2% speed hit for strings that need compile and a 250% speed improvement + # on strings that don't need compiling. + return \"$string_to_compile" if($string_to_compile !~ m/[\[~\]]/ms); # return a string ref if chars [~] are not in the string + + my $handle = $_[0]; + + my(@code); + my(@c) = (''); # "chunks" -- scratch. + my $call_count = 0; + my $big_pile = ''; + { + my $in_group = 0; # start out outside a group + my($m, @params); # scratch + + while($string_to_compile =~ # Iterate over chunks. + m/( + [^\~\[\]]+ # non-~[] stuff (Capture everything else here) + | + ~. # ~[, ~], ~~, ~other + | + \[ # [ presumably opening a group + | + \] # ] presumably closing a group + | + ~ # terminal ~ ? + | + $ + )/xgs + ) { + DEBUG>2 and warn qq{ "$1"\n}; + + if($1 eq '[' or $1 eq '') { # "[" or end + # Whether this is "[" or end, force processing of any + # preceding literal. + if($in_group) { + if($1 eq '') { + $handle->_die_pointing($string_to_compile, 'Unterminated bracket group'); + } + else { + $handle->_die_pointing($string_to_compile, 'You can\'t nest bracket groups'); + } + } + else { + if ($1 eq '') { + DEBUG>2 and warn " [end-string]\n"; + } + else { + $in_group = 1; + } + die "How come \@c is empty?? in <$string_to_compile>" unless @c; # sanity + if(length $c[-1]) { + # Now actually processing the preceding literal + $big_pile .= $c[-1]; + if($USE_LITERALS and ( + (ord('A') == 65) + ? $c[-1] !~ m/[^\x20-\x7E]/s + # ASCII very safe chars + : $c[-1] !~ m/[^ !"\#\$%&'()*+,\-.\/0-9:;<=>?\@A-Z[\\\]^_`a-z{|}~\x07]/s + # EBCDIC very safe chars + )) { + # normal case -- all very safe chars + $c[-1] =~ s/'/\\'/g; + push @code, q{ '} . $c[-1] . "',\n"; + $c[-1] = ''; # reuse this slot + } + else { + $c[-1] =~ s/\\\\/\\/g; + push @code, ' $c[' . $#c . "],\n"; + push @c, ''; # new chunk + } + } + # else just ignore the empty string. + } + + } + elsif($1 eq ']') { # "]" + # close group -- go back in-band + if($in_group) { + $in_group = 0; + + DEBUG>2 and warn " --Closing group [$c[-1]]\n"; + + # And now process the group... + + if(!length($c[-1]) or $c[-1] =~ m/^\s+$/s) { + DEBUG>2 and warn " -- (Ignoring)\n"; + $c[-1] = ''; # reset out chink + next; + } + + #$c[-1] =~ s/^\s+//s; + #$c[-1] =~ s/\s+$//s; + ($m,@params) = split(/,/, $c[-1], -1); # was /\s*,\s*/ + + # A bit of a hack -- we've turned "~,"'s into DELs, so turn + # 'em into real commas here. + if (ord('A') == 65) { # ASCII, etc + foreach($m, @params) { tr/\x7F/,/ } + } + else { # EBCDIC (1047, 0037, POSIX-BC) + # Thanks to Peter Prymmer for the EBCDIC handling + foreach($m, @params) { tr/\x07/,/ } + } + + # Special-case handling of some method names: + if($m eq '_*' or $m =~ m/^_(-?\d+)$/s) { + # Treat [_1,...] as [,_1,...], etc. + unshift @params, $m; + $m = ''; + } + elsif($m eq '*') { + $m = 'quant'; # "*" for "times": "4 cars" is 4 times "cars" + } + elsif($m eq '#') { + $m = 'numf'; # "#" for "number": [#,_1] for "the number _1" + } + + # Most common case: a simple, legal-looking method name + if($m eq '') { + # 0-length method name means to just interpolate: + push @code, ' ('; + } + elsif($m =~ /^\w+$/s + && !$handle->{'blacklist'}{$m} + && ( !defined $handle->{'whitelist'} || $handle->{'whitelist'}{$m} ) + # exclude anything fancy and restrict to the whitelist/blacklist. + ) { + push @code, ' $_[0]->' . $m . '('; + } + else { + # TODO: implement something? or just too icky to consider? + $handle->_die_pointing( + $string_to_compile, + "Can't use \"$m\" as a method name in bracket group", + 2 + length($c[-1]) + ); + } + + pop @c; # we don't need that chunk anymore + ++$call_count; + + foreach my $p (@params) { + if($p eq '_*') { + # Meaning: all parameters except $_[0] + $code[-1] .= ' @_[1 .. $#_], '; + # and yes, that does the right thing for all @_ < 3 + } + elsif($p =~ m/^_(-?\d+)$/s) { + # _3 meaning $_[3] + $code[-1] .= '$_[' . (0 + $1) . '], '; + } + elsif($USE_LITERALS and ( + (ord('A') == 65) + ? $p !~ m/[^\x20-\x7E]/s + # ASCII very safe chars + : $p !~ m/[^ !"\#\$%&'()*+,\-.\/0-9:;<=>?\@A-Z[\\\]^_`a-z{|}~\x07]/s + # EBCDIC very safe chars + )) { + # Normal case: a literal containing only safe characters + $p =~ s/'/\\'/g; + $code[-1] .= q{'} . $p . q{', }; + } + else { + # Stow it on the chunk-stack, and just refer to that. + push @c, $p; + push @code, ' $c[' . $#c . '], '; + } + } + $code[-1] .= "),\n"; + + push @c, ''; + } + else { + $handle->_die_pointing($string_to_compile, q{Unbalanced ']'}); + } + + } + elsif(substr($1,0,1) ne '~') { + # it's stuff not containing "~" or "[" or "]" + # i.e., a literal blob + my $text = $1; + $text =~ s/\\/\\\\/g; + $c[-1] .= $text; + + } + elsif($1 eq '~~') { # "~~" + $c[-1] .= '~'; + + } + elsif($1 eq '~[') { # "~[" + $c[-1] .= '['; + + } + elsif($1 eq '~]') { # "~]" + $c[-1] .= ']'; + + } + elsif($1 eq '~,') { # "~," + if($in_group) { + # This is a hack, based on the assumption that no-one will actually + # want a DEL inside a bracket group. Let's hope that's it's true. + if (ord('A') == 65) { # ASCII etc + $c[-1] .= "\x7F"; + } + else { # EBCDIC (cp 1047, 0037, POSIX-BC) + $c[-1] .= "\x07"; + } + } + else { + $c[-1] .= '~,'; + } + + } + elsif($1 eq '~') { # possible only at string-end, it seems. + $c[-1] .= '~'; + + } + else { + # It's a "~X" where X is not a special character. + # Consider it a literal ~ and X. + my $text = $1; + $text =~ s/\\/\\\\/g; + $c[-1] .= $text; + } + } + } + + if($call_count) { + undef $big_pile; # Well, nevermind that. + } + else { + # It's all literals! Ahwell, that can happen. + # So don't bother with the eval. Return a SCALAR reference. + return \$big_pile; + } + + die q{Last chunk isn't null??} if @c and length $c[-1]; # sanity + DEBUG and warn scalar(@c), " chunks under closure\n"; + if(@code == 0) { # not possible? + DEBUG and warn "Empty code\n"; + return \''; + } + elsif(@code > 1) { # most cases, presumably! + unshift @code, "join '',\n"; + } + unshift @code, "use strict; sub {\n"; + push @code, "}\n"; + + DEBUG and warn @code; + my $sub = eval(join '', @code); + die "$@ while evalling" . join('', @code) if $@; # Should be impossible. + return $sub; +} + +#-------------------------------------------------------------------------- + +sub _die_pointing { + # This is used by _compile to throw a fatal error + my $target = shift; + $target = ref($target) || $target; # class name + # ...leaving $_[0] the error-causing text, and $_[1] the error message + + my $i = index($_[0], "\n"); + + my $pointy; + my $pos = pos($_[0]) - (defined($_[2]) ? $_[2] : 0) - 1; + if($pos < 1) { + $pointy = "^=== near there\n"; + } + else { # we need to space over + my $first_tab = index($_[0], "\t"); + if($pos > 2 and ( -1 == $first_tab or $first_tab > pos($_[0]))) { + # No tabs, or the first tab is harmlessly after where we will point to, + # AND we're far enough from the margin that we can draw a proper arrow. + $pointy = ('=' x $pos) . "^ near there\n"; + } + else { + # tabs screw everything up! + $pointy = substr($_[0],0,$pos); + $pointy =~ tr/\t //cd; + # make everything into whitespace, but preserving tabs + $pointy .= "^=== near there\n"; + } + } + + my $errmsg = "$_[1], in\:\n$_[0]"; + + if($i == -1) { + # No newline. + $errmsg .= "\n" . $pointy; + } + elsif($i == (length($_[0]) - 1) ) { + # Already has a newline at end. + $errmsg .= $pointy; + } + else { + # don't bother with the pointy bit, I guess. + } + Carp::croak( "$errmsg via $target, as used" ); +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pod b/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pod new file mode 100644 index 0000000000000000000000000000000000000000..26be348353da13f6541a7c5144984a15d8ed15ef --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Locale/Maketext.pod @@ -0,0 +1,1424 @@ + +# Time-stamp: "2004-01-11 18:35:34 AST" + +=head1 NAME + +Locale::Maketext - framework for localization + +=head1 SYNOPSIS + + package MyProgram; + use strict; + use MyProgram::L10N; + # ...which inherits from Locale::Maketext + my $lh = MyProgram::L10N->get_handle() || die "What language?"; + ... + # And then any messages your program emits, like: + warn $lh->maketext( "Can't open file [_1]: [_2]\n", $f, $! ); + ... + +=head1 DESCRIPTION + +It is a common feature of applications (whether run directly, +or via the Web) for them to be "localized" -- i.e., for them +to a present an English interface to an English-speaker, a German +interface to a German-speaker, and so on for all languages it's +programmed with. Locale::Maketext +is a framework for software localization; it provides you with the +tools for organizing and accessing the bits of text and text-processing +code that you need for producing localized applications. + +In order to make sense of Maketext and how all its +components fit together, you should probably +go read L<Locale::Maketext::TPJ13|Locale::Maketext::TPJ13>, and +I<then> read the following documentation. + +You may also want to read over the source for C<File::Findgrep> +and its constituent modules -- they are a complete (if small) +example application that uses Maketext. + +=head1 QUICK OVERVIEW + +The basic design of Locale::Maketext is object-oriented, and +Locale::Maketext is an abstract base class, from which you +derive a "project class". +The project class (with a name like "TkBocciBall::Localize", +which you then use in your module) is in turn the base class +for all the "language classes" for your project +(with names "TkBocciBall::Localize::it", +"TkBocciBall::Localize::en", +"TkBocciBall::Localize::fr", etc.). + +A language class is +a class containing a lexicon of phrases as class data, +and possibly also some methods that are of use in interpreting +phrases in the lexicon, or otherwise dealing with text in that +language. + +An object belonging to a language class is called a "language +handle"; it's typically a flyweight object. + +The normal course of action is to call: + + use TkBocciBall::Localize; # the localization project class + $lh = TkBocciBall::Localize->get_handle(); + # Depending on the user's locale, etc., this will + # make a language handle from among the classes available, + # and any defaults that you declare. + die "Couldn't make a language handle??" unless $lh; + +From then on, you use the C<maketext> function to access +entries in whatever lexicon(s) belong to the language handle +you got. So, this: + + print $lh->maketext("You won!"), "\n"; + +...emits the right text for this language. If the object +in C<$lh> belongs to class "TkBocciBall::Localize::fr" and +%TkBocciBall::Localize::fr::Lexicon contains C<("You won!" +=E<gt> "Tu as gagnE<eacute>!")>, then the above +code happily tells the user "Tu as gagnE<eacute>!". + +=head1 METHODS + +Locale::Maketext offers a variety of methods, which fall +into three categories: + +=over + +=item * + +Methods to do with constructing language handles. + +=item * + +C<maketext> and other methods to do with accessing %Lexicon data +for a given language handle. + +=item * + +Methods that you may find it handy to use, from routines of +yours that you put in %Lexicon entries. + +=back + +These are covered in the following section. + +=head2 Construction Methods + +These are to do with constructing a language handle: + +=over + +=item * + +$lh = YourProjClass->get_handle( ...langtags... ) || die "lg-handle?"; + +This tries loading classes based on the language-tags you give (like +C<("en-US", "sk", "kon", "es-MX", "ja", "i-klingon")>, and for the first class +that succeeds, returns YourProjClass::I<language>->new(). + +If it runs thru the entire given list of language-tags, and finds no classes +for those exact terms, it then tries "superordinate" language classes. +So if no "en-US" class (i.e., YourProjClass::en_us) +was found, nor classes for anything else in that list, we then try +its superordinate, "en" (i.e., YourProjClass::en), and so on thru +the other language-tags in the given list: "es". +(The other language-tags in our example list: +happen to have no superordinates.) + +If none of those language-tags leads to loadable classes, we then +try classes derived from YourProjClass->fallback_languages() and +then if nothing comes of that, we use classes named by +YourProjClass->fallback_language_classes(). Then in the (probably +quite unlikely) event that that fails, we just return undef. + +=item * + +$lh = YourProjClass->get_handleB<()> || die "lg-handle?"; + +When C<get_handle> is called with an empty parameter list, magic happens: + +If C<get_handle> senses that it's running in program that was +invoked as a CGI, then it tries to get language-tags out of the +environment variable "HTTP_ACCEPT_LANGUAGE", and it pretends that +those were the languages passed as parameters to C<get_handle>. + +Otherwise (i.e., if not a CGI), this tries various OS-specific ways +to get the language-tags for the current locale/language, and then +pretends that those were the value(s) passed to C<get_handle>. + +Currently this OS-specific stuff consists of looking in the environment +variables "LANG" and "LANGUAGE"; and on MSWin machines (where those +variables are typically unused), this also tries using +the module Win32::Locale to get a language-tag for whatever language/locale +is currently selected in the "Regional Settings" (or "International"?) +Control Panel. I welcome further +suggestions for making this do the Right Thing under other operating +systems that support localization. + +If you're using localization in an application that keeps a configuration +file, you might consider something like this in your project class: + + sub get_handle_via_config { + my $class = $_[0]; + my $chosen_language = $Config_settings{'language'}; + my $lh; + if($chosen_language) { + $lh = $class->get_handle($chosen_language) + || die "No language handle for \"$chosen_language\"" + . " or the like"; + } else { + # Config file missing, maybe? + $lh = $class->get_handle() + || die "Can't get a language handle"; + } + return $lh; + } + +=item * + +$lh = YourProjClass::langname->new(); + +This constructs a language handle. You usually B<don't> call this +directly, but instead let C<get_handle> find a language class to C<use> +and to then call ->new on. + +=item * + +$lh->init(); + +This is called by ->new to initialize newly-constructed language handles. +If you define an init method in your class, remember that it's usually +considered a good idea to call $lh->SUPER::init in it (presumably at the +beginning), so that all classes get a chance to initialize a new object +however they see fit. + +=item * + +YourProjClass->fallback_languages() + +C<get_handle> appends the return value of this to the end of +whatever list of languages you pass C<get_handle>. Unless +you override this method, your project class +will inherit Locale::Maketext's C<fallback_languages>, which +currently returns C<('i-default', 'en', 'en-US')>. +("i-default" is defined in RFC 2277). + +This method (by having it return the name +of a language-tag that has an existing language class) +can be used for making sure that +C<get_handle> will always manage to construct a language +handle (assuming your language classes are in an appropriate +@INC directory). Or you can use the next method: + +=item * + +YourProjClass->fallback_language_classes() + +C<get_handle> appends the return value of this to the end +of the list of classes it will try using. Unless +you override this method, your project class +will inherit Locale::Maketext's C<fallback_language_classes>, +which currently returns an empty list, C<()>. +By setting this to some value (namely, the name of a loadable +language class), you can be sure that +C<get_handle> will always manage to construct a language +handle. + +=back + +=head2 The "maketext" Method + +This is the most important method in Locale::Maketext: + + $text = $lh->maketext(I<key>, ...parameters for this phrase...); + +This looks in the %Lexicon of the language handle +$lh and all its superclasses, looking +for an entry whose key is the string I<key>. Assuming such +an entry is found, various things then happen, depending on the +value found: + +If the value is a scalarref, the scalar is dereferenced and returned +(and any parameters are ignored). + +If the value is a coderef, we return &$value($lh, ...parameters...). + +If the value is a string that I<doesn't> look like it's in Bracket Notation, +we return it (after replacing it with a scalarref, in its %Lexicon). + +If the value I<does> look like it's in Bracket Notation, then we compile +it into a sub, replace the string in the %Lexicon with the new coderef, +and then we return &$new_sub($lh, ...parameters...). + +Bracket Notation is discussed in a later section. Note +that trying to compile a string into Bracket Notation can throw +an exception if the string is not syntactically valid (say, by not +balancing brackets right.) + +Also, calling &$coderef($lh, ...parameters...) can throw any sort of +exception (if, say, code in that sub tries to divide by zero). But +a very common exception occurs when you have Bracket +Notation text that says to call a method "foo", but there is no such +method. (E.g., "You have [quaB<tn>,_1,ball]." will throw an exception +on trying to call $lh->quaB<tn>($_[1],'ball') -- you presumably meant +"quant".) C<maketext> catches these exceptions, but only to make the +error message more readable, at which point it rethrows the exception. + +An exception I<may> be thrown if I<key> is not found in any +of $lh's %Lexicon hashes. What happens if a key is not found, +is discussed in a later section, "Controlling Lookup Failure". + +Note that you might find it useful in some cases to override +the C<maketext> method with an "after method", if you want to +translate encodings, or even scripts: + + package YrProj::zh_cn; # Chinese with PRC-style glyphs + use base ('YrProj::zh_tw'); # Taiwan-style + sub maketext { + my $self = shift(@_); + my $value = $self->maketext(@_); + return Chineeze::taiwan2mainland($value); + } + +Or you may want to override it with something that traps +any exceptions, if that's critical to your program: + + sub maketext { + my($lh, @stuff) = @_; + my $out; + eval { $out = $lh->SUPER::maketext(@stuff) }; + return $out unless $@; + ...otherwise deal with the exception... + } + +Other than those two situations, I don't imagine that +it's useful to override the C<maketext> method. (If +you run into a situation where it is useful, I'd be +interested in hearing about it.) + +=over + +=item $lh->fail_with I<or> $lh->fail_with(I<PARAM>) + +=item $lh->failure_handler_auto + +These two methods are discussed in the section "Controlling +Lookup Failure". + +=item $lh->blacklist(@list) + +=item $lh->whitelist(@list) + +These methods are discussed in the section "Bracket Notation +Security". + +=back + +=head2 Utility Methods + +These are methods that you may find it handy to use, generally +from %Lexicon routines of yours (whether expressed as +Bracket Notation or not). + +=over + +=item $language->quant($number, $singular) + +=item $language->quant($number, $singular, $plural) + +=item $language->quant($number, $singular, $plural, $negative) + +This is generally meant to be called from inside Bracket Notation +(which is discussed later), as in + + "Your search matched [quant,_1,document]!" + +It's for I<quantifying> a noun (i.e., saying how much of it there is, +while giving the correct form of it). The behavior of this method is +handy for English and a few other Western European languages, and you +should override it for languages where it's not suitable. You can feel +free to read the source, but the current implementation is basically +as this pseudocode describes: + + if $number is 0 and there's a $negative, + return $negative; + elsif $number is 1, + return "1 $singular"; + elsif there's a $plural, + return "$number $plural"; + else + return "$number " . $singular . "s"; + # + # ...except that we actually call numf to + # stringify $number before returning it. + +So for English (with Bracket Notation) +C<"...[quant,_1,file]..."> is fine (for 0 it returns "0 files", +for 1 it returns "1 file", and for more it returns "2 files", etc.) + +But for "directory", you'd want C<"[quant,_1,directory,directories]"> +so that our elementary C<quant> method doesn't think that the +plural of "directory" is "directorys". And you might find that the +output may sound better if you specify a negative form, as in: + + "[quant,_1,file,files,No files] matched your query.\n" + +Remember to keep in mind verb agreement (or adjectives too, in +other languages), as in: + + "[quant,_1,document] were matched.\n" + +Because if _1 is one, you get "1 document B<were> matched". +An acceptable hack here is to do something like this: + + "[quant,_1,document was, documents were] matched.\n" + +=item $language->numf($number) + +This returns the given number formatted nicely according to +this language's conventions. Maketext's default method is +mostly to just take the normal string form of the number +(applying sprintf "%G" for only very large numbers), and then +to add commas as necessary. (Except that +we apply C<tr/,./.,/> if $language->{'numf_comma'} is true; +that's a bit of a hack that's useful for languages that express +two million as "2.000.000" and not as "2,000,000"). + +If you want anything fancier, consider overriding this with something +that uses L<Number::Format|Number::Format>, or does something else +entirely. + +Note that numf is called by quant for stringifying all quantifying +numbers. + +=item $language->numerate($number, $singular, $plural, $negative) + +This returns the given noun form which is appropriate for the quantity +C<$number> according to this language's conventions. C<numerate> is +used internally by C<quant> to quantify nouns. Use it directly -- +usually from bracket notation -- to avoid C<quant>'s implicit call to +C<numf> and output of a numeric quantity. + +=item $language->sprintf($format, @items) + +This is just a wrapper around Perl's normal C<sprintf> function. +It's provided so that you can use "sprintf" in Bracket Notation: + + "Couldn't access datanode [sprintf,%10x=~[%s~],_1,_2]!\n" + +returning... + + Couldn't access datanode Stuff=[thangamabob]! + +=item $language->language_tag() + +Currently this just takes the last bit of C<ref($language)>, turns +underscores to dashes, and returns it. So if $language is +an object of class Hee::HOO::Haw::en_us, $language->language_tag() +returns "en-us". (Yes, the usual representation for that language +tag is "en-US", but case is I<never> considered meaningful in +language-tag comparison.) + +You may override this as you like; Maketext doesn't use it for +anything. + +=item $language->encoding() + +Currently this isn't used for anything, but it's provided +(with default value of +C<(ref($language) && $language-E<gt>{'encoding'})) or "iso-8859-1"> +) as a sort of suggestion that it may be useful/necessary to +associate encodings with your language handles (whether on a +per-class or even per-handle basis.) + +=back + +=head2 Language Handle Attributes and Internals + +A language handle is a flyweight object -- i.e., it doesn't (necessarily) +carry any data of interest, other than just being a member of +whatever class it belongs to. + +A language handle is implemented as a blessed hash. Subclasses of yours +can store whatever data you want in the hash. Currently the only hash +entry used by any crucial Maketext method is "fail", so feel free to +use anything else as you like. + +B<Remember: Don't be afraid to read the Maketext source if there's +any point on which this documentation is unclear.> This documentation +is vastly longer than the module source itself. + +=head1 LANGUAGE CLASS HIERARCHIES + +These are Locale::Maketext's assumptions about the class +hierarchy formed by all your language classes: + +=over + +=item * + +You must have a project base class, which you load, and +which you then use as the first argument in +the call to YourProjClass->get_handle(...). It should derive +(whether directly or indirectly) from Locale::Maketext. +It B<doesn't matter> how you name this class, although assuming this +is the localization component of your Super Mega Program, +good names for your project class might be +SuperMegaProgram::Localization, SuperMegaProgram::L10N, +SuperMegaProgram::I18N, SuperMegaProgram::International, +or even SuperMegaProgram::Languages or SuperMegaProgram::Messages. + +=item * + +Language classes are what YourProjClass->get_handle will try to load. +It will look for them by taking each language-tag (B<skipping> it +if it doesn't look like a language-tag or locale-tag!), turning it to +all lowercase, turning dashes to underscores, and appending it +to YourProjClass . "::". So this: + + $lh = YourProjClass->get_handle( + 'en-US', 'fr', 'kon', 'i-klingon', 'i-klingon-romanized' + ); + +will try loading the classes +YourProjClass::en_us (note lowercase!), YourProjClass::fr, +YourProjClass::kon, +YourProjClass::i_klingon +and YourProjClass::i_klingon_romanized. (And it'll stop at the +first one that actually loads.) + +=item * + +I assume that each language class derives (directly or indirectly) +from your project class, and also defines its @ISA, its %Lexicon, +or both. But I anticipate no dire consequences if these assumptions +do not hold. + +=item * + +Language classes may derive from other language classes (although they +should have "use I<Thatclassname>" or "use base qw(I<...classes...>)"). +They may derive from the project +class. They may derive from some other class altogether. Or via +multiple inheritance, it may derive from any mixture of these. + +=item * + +I foresee no problems with having multiple inheritance in +your hierarchy of language classes. (As usual, however, Perl will +complain bitterly if you have a cycle in the hierarchy: i.e., if +any class is its own ancestor.) + +=back + +=head1 ENTRIES IN EACH LEXICON + +A typical %Lexicon entry is meant to signify a phrase, +taking some number (0 or more) of parameters. An entry +is meant to be accessed by via +a string I<key> in $lh->maketext(I<key>, ...parameters...), +which should return a string that is generally meant for +be used for "output" to the user -- regardless of whether +this actually means printing to STDOUT, writing to a file, +or putting into a GUI widget. + +While the key must be a string value (since that's a basic +restriction that Perl places on hash keys), the value in +the lexicon can currently be of several types: +a defined scalar, scalarref, or coderef. The use of these is +explained above, in the section 'The "maketext" Method', and +Bracket Notation for strings is discussed in the next section. + +While you can use arbitrary unique IDs for lexicon keys +(like "_min_larger_max_error"), it is often +useful for if an entry's key is itself a valid value, like +this example error message: + + "Minimum ([_1]) is larger than maximum ([_2])!\n", + +Compare this code that uses an arbitrary ID... + + die $lh->maketext( "_min_larger_max_error", $min, $max ) + if $min > $max; + +...to this code that uses a key-as-value: + + die $lh->maketext( + "Minimum ([_1]) is larger than maximum ([_2])!\n", + $min, $max + ) if $min > $max; + +The second is, in short, more readable. In particular, it's obvious +that the number of parameters you're feeding to that phrase (two) is +the number of parameters that it I<wants> to be fed. (Since you see +_1 and a _2 being used in the key there.) + +Also, once a project is otherwise +complete and you start to localize it, you can scrape together +all the various keys you use, and pass it to a translator; and then +the translator's work will go faster if what he's presented is this: + + "Minimum ([_1]) is larger than maximum ([_2])!\n", + => "", # fill in something here, Jacques! + +rather than this more cryptic mess: + + "_min_larger_max_error" + => "", # fill in something here, Jacques + +I think that keys as lexicon values makes the completed lexicon +entries more readable: + + "Minimum ([_1]) is larger than maximum ([_2])!\n", + => "Le minimum ([_1]) est plus grand que le maximum ([_2])!\n", + +Also, having valid values as keys becomes very useful if you set +up an _AUTO lexicon. _AUTO lexicons are discussed in a later +section. + +I almost always use keys that are themselves +valid lexicon values. One notable exception is when the value is +quite long. For example, to get the screenful of data that +a command-line program might return when given an unknown switch, +I often just use a brief, self-explanatory key such as "_USAGE_MESSAGE". At that point I then go +and immediately to define that lexicon entry in the +ProjectClass::L10N::en lexicon (since English is always my "project +language"): + + '_USAGE_MESSAGE' => <<'EOSTUFF', + ...long long message... + EOSTUFF + +and then I can use it as: + + getopt('oDI', \%opts) or die $lh->maketext('_USAGE_MESSAGE'); + +Incidentally, +note that each class's C<%Lexicon> inherits-and-extends +the lexicons in its superclasses. This is not because these are +special hashes I<per se>, but because you access them via the +C<maketext> method, which looks for entries across all the +C<%Lexicon> hashes in a language class I<and> all its ancestor classes. +(This is because the idea of "class data" isn't directly implemented +in Perl, but is instead left to individual class-systems to implement +as they see fit..) + +Note that you may have things stored in a lexicon +besides just phrases for output: for example, if your program +takes input from the keyboard, asking a "(Y/N)" question, +you probably need to know what the equivalent of "Y[es]/N[o]" is +in whatever language. You probably also need to know what +the equivalents of the answers "y" and "n" are. You can +store that information in the lexicon (say, under the keys +"~answer_y" and "~answer_n", and the long forms as +"~answer_yes" and "~answer_no", where "~" is just an ad-hoc +character meant to indicate to programmers/translators that +these are not phrases for output). + +Or instead of storing this in the language class's lexicon, +you can (and, in some cases, really should) represent the same bit +of knowledge as code in a method in the language class. (That +leaves a tidy distinction between the lexicon as the things we +know how to I<say>, and the rest of the things in the lexicon class +as things that we know how to I<do>.) Consider +this example of a processor for responses to French "oui/non" +questions: + + sub y_or_n { + return undef unless defined $_[1] and length $_[1]; + my $answer = lc $_[1]; # smash case + return 1 if $answer eq 'o' or $answer eq 'oui'; + return 0 if $answer eq 'n' or $answer eq 'non'; + return undef; + } + +...which you'd then call in a construct like this: + + my $response; + until(defined $response) { + print $lh->maketext("Open the pod bay door (y/n)? "); + $response = $lh->y_or_n( get_input_from_keyboard_somehow() ); + } + if($response) { $pod_bay_door->open() } + else { $pod_bay_door->leave_closed() } + +Other data worth storing in a lexicon might be things like +filenames for language-targetted resources: + + ... + "_main_splash_png" + => "/styles/en_us/main_splash.png", + "_main_splash_imagemap" + => "/styles/en_us/main_splash.incl", + "_general_graphics_path" + => "/styles/en_us/", + "_alert_sound" + => "/styles/en_us/hey_there.wav", + "_forward_icon" + => "left_arrow.png", + "_backward_icon" + => "right_arrow.png", + # In some other languages, left equals + # BACKwards, and right is FOREwards. + ... + +You might want to do the same thing for expressing key bindings +or the like (since hardwiring "q" as the binding for the function +that quits a screen/menu/program is useful only if your language +happens to associate "q" with "quit"!) + +=head1 BRACKET NOTATION + +Bracket Notation is a crucial feature of Locale::Maketext. I mean +Bracket Notation to provide a replacement for the use of sprintf formatting. +Everything you do with Bracket Notation could be done with a sub block, +but bracket notation is meant to be much more concise. + +Bracket Notation is a like a miniature "template" system (in the sense +of L<Text::Template|Text::Template>, not in the sense of C++ templates), +where normal text is passed thru basically as is, but text in special +regions is specially interpreted. In Bracket Notation, you use square brackets ("[...]"), +not curly braces ("{...}") to note sections that are specially interpreted. + +For example, here all the areas that are taken literally are underlined with +a "^", and all the in-bracket special regions are underlined with an X: + + "Minimum ([_1]) is larger than maximum ([_2])!\n", + ^^^^^^^^^ XX ^^^^^^^^^^^^^^^^^^^^^^^^^^ XX ^^^^ + +When that string is compiled from bracket notation into a real Perl sub, +it's basically turned into: + + sub { + my $lh = $_[0]; + my @params = @_; + return join '', + "Minimum (", + ...some code here... + ") is larger than maximum (", + ...some code here... + ")!\n", + } + # to be called by $lh->maketext(KEY, params...) + +In other words, text outside bracket groups is turned into string +literals. Text in brackets is rather more complex, and currently follows +these rules: + +=over + +=item * + +Bracket groups that are empty, or which consist only of whitespace, +are ignored. (Examples: "[]", "[ ]", or a [ and a ] with returns +and/or tabs and/or spaces between them. + +Otherwise, each group is taken to be a comma-separated group of items, +and each item is interpreted as follows: + +=item * + +An item that is "_I<digits>" or "_-I<digits>" is interpreted as +$_[I<value>]. I.e., "_1" becomes with $_[1], and "_-3" is interpreted +as $_[-3] (in which case @_ should have at least three elements in it). +Note that $_[0] is the language handle, and is typically not named +directly. + +=item * + +An item "_*" is interpreted to mean "all of @_ except $_[0]". +I.e., C<@_[1..$#_]>. Note that this is an empty list in the case +of calls like $lh->maketext(I<key>) where there are no +parameters (except $_[0], the language handle). + +=item * + +Otherwise, each item is interpreted as a string literal. + +=back + +The group as a whole is interpreted as follows: + +=over + +=item * + +If the first item in a bracket group looks like a method name, +then that group is interpreted like this: + + $lh->that_method_name( + ...rest of items in this group... + ), + +=item * + +If the first item in a bracket group is "*", it's taken as shorthand +for the so commonly called "quant" method. Similarly, if the first +item in a bracket group is "#", it's taken to be shorthand for +"numf". + +=item * + +If the first item in a bracket group is the empty-string, or "_*" +or "_I<digits>" or "_-I<digits>", then that group is interpreted +as just the interpolation of all its items: + + join('', + ...rest of items in this group... + ), + +Examples: "[_1]" and "[,_1]", which are synonymous; and +"C<[,ID-(,_4,-,_2,)]>", which compiles as +C<join "", "ID-(", $_[4], "-", $_[2], ")">. + +=item * + +Otherwise this bracket group is invalid. For example, in the group +"[!@#,whatever]", the first item C<"!@#"> is neither the empty-string, +"_I<number>", "_-I<number>", "_*", nor a valid method name; and so +Locale::Maketext will throw an exception of you try compiling an +expression containing this bracket group. + +=back + +Note, incidentally, that items in each group are comma-separated, +not C</\s*,\s*/>-separated. That is, you might expect that this +bracket group: + + "Hoohah [foo, _1 , bar ,baz]!" + +would compile to this: + + sub { + my $lh = $_[0]; + return join '', + "Hoohah ", + $lh->foo( $_[1], "bar", "baz"), + "!", + } + +But it actually compiles as this: + + sub { + my $lh = $_[0]; + return join '', + "Hoohah ", + $lh->foo(" _1 ", " bar ", "baz"), # note the <space> in " bar " + "!", + } + +In the notation discussed so far, the characters "[" and "]" are given +special meaning, for opening and closing bracket groups, and "," has +a special meaning inside bracket groups, where it separates items in the +group. This begs the question of how you'd express a literal "[" or +"]" in a Bracket Notation string, and how you'd express a literal +comma inside a bracket group. For this purpose I've adopted "~" (tilde) +as an escape character: "~[" means a literal '[' character anywhere +in Bracket Notation (i.e., regardless of whether you're in a bracket +group or not), and ditto for "~]" meaning a literal ']', and "~," meaning +a literal comma. (Altho "," means a literal comma outside of +bracket groups -- it's only inside bracket groups that commas are special.) + +And on the off chance you need a literal tilde in a bracket expression, +you get it with "~~". + +Currently, an unescaped "~" before a character +other than a bracket or a comma is taken to mean just a "~" and that +character. I.e., "~X" means the same as "~~X" -- i.e., one literal tilde, +and then one literal "X". However, by using "~X", you are assuming that +no future version of Maketext will use "~X" as a magic escape sequence. +In practice this is not a great problem, since first off you can just +write "~~X" and not worry about it; second off, I doubt I'll add lots +of new magic characters to bracket notation; and third off, you +aren't likely to want literal "~" characters in your messages anyway, +since it's not a character with wide use in natural language text. + +Brackets must be balanced -- every openbracket must have +one matching closebracket, and vice versa. So these are all B<invalid>: + + "I ate [quant,_1,rhubarb pie." + "I ate [quant,_1,rhubarb pie[." + "I ate quant,_1,rhubarb pie]." + "I ate quant,_1,rhubarb pie[." + +Currently, bracket groups do not nest. That is, you B<cannot> say: + + "Foo [bar,baz,[quux,quuux]]\n"; + +If you need a notation that's that powerful, use normal Perl: + + %Lexicon = ( + ... + "some_key" => sub { + my $lh = $_[0]; + join '', + "Foo ", + $lh->bar('baz', $lh->quux('quuux')), + "\n", + }, + ... + ); + +Or write the "bar" method so you don't need to pass it the +output from calling quux. + +I do not anticipate that you will need (or particularly want) +to nest bracket groups, but you are welcome to email me with +convincing (real-life) arguments to the contrary. + +=head1 BRACKET NOTATION SECURITY + +Locale::Maketext does not use any special syntax to differentiate +bracket notation methods from normal class or object methods. This +design makes it vulnerable to format string attacks whenever it is +used to process strings provided by untrusted users. + +Locale::Maketext does support blacklist and whitelist functionality +to limit which methods may be called as bracket notation methods. + +By default, Locale::Maketext blacklists all methods in the +Locale::Maketext namespace that begin with the '_' character, +and all methods which include Perl's namespace separator characters. + +The default blacklist for Locale::Maketext also prevents use of the +following methods in bracket notation: + + blacklist + encoding + fail_with + failure_handler_auto + fallback_language_classes + fallback_languages + get_handle + init + language_tag + maketext + new + whitelist + +This list can be extended by either blacklisting additional "known bad" +methods, or whitelisting only "known good" methods. + +To prevent specific methods from being called in bracket notation, use +the blacklist() method: + + my $lh = MyProgram::L10N->get_handle(); + $lh->blacklist(qw{my_internal_method my_other_method}); + $lh->maketext('[my_internal_method]'); # dies + +To limit the allowed bracked notation methods to a specific list, use the +whitelist() method: + + my $lh = MyProgram::L10N->get_handle(); + $lh->whitelist('numerate', 'numf'); + $lh->maketext('[_1] [numerate, _1,shoe,shoes]', 12); # works + $lh->maketext('[my_internal_method]'); # dies + +The blacklist() and whitelist() methods extend their internal lists +whenever they are called. To reset the blacklist or whitelist, create +a new maketext object. + + my $lh = MyProgram::L10N->get_handle(); + $lh->blacklist('numerate'); + $lh->blacklist('numf'); + $lh->maketext('[_1] [numerate,_1,shoe,shoes]', 12); # dies + +For lexicons that use an internal cache, translations which have already +been cached in their compiled form are not affected by subsequent changes +to the whitelist or blacklist settings. Lexicons that use an external +cache will have their cache cleared whenever the whitelist of blacklist +setings change. The difference between the two types of caching is explained +in the "Readonly Lexicons" section. + +Methods disallowed by the blacklist cannot be permitted by the +whitelist. + +=head1 AUTO LEXICONS + +If maketext goes to look in an individual %Lexicon for an entry +for I<key> (where I<key> does not start with an underscore), and +sees none, B<but does see> an entry of "_AUTO" => I<some_true_value>, +then we actually define $Lexicon{I<key>} = I<key> right then and there, +and then use that value as if it had been there all +along. This happens before we even look in any superclass %Lexicons! + +(This is meant to be somewhat like the AUTOLOAD mechanism in +Perl's function call system -- or, looked at another way, +like the L<AutoLoader|AutoLoader> module.) + +I can picture all sorts of circumstances where you just +do not want lookup to be able to fail (since failing +normally means that maketext throws a C<die>, although +see the next section for greater control over that). But +here's one circumstance where _AUTO lexicons are meant to +be I<especially> useful: + +As you're writing an application, you decide as you go what messages +you need to emit. Normally you'd go to write this: + + if(-e $filename) { + go_process_file($filename) + } else { + print qq{Couldn't find file "$filename"!\n}; + } + +but since you anticipate localizing this, you write: + + use ThisProject::I18N; + my $lh = ThisProject::I18N->get_handle(); + # For the moment, assume that things are set up so + # that we load class ThisProject::I18N::en + # and that that's the class that $lh belongs to. + ... + if(-e $filename) { + go_process_file($filename) + } else { + print $lh->maketext( + qq{Couldn't find file "[_1]"!\n}, $filename + ); + } + +Now, right after you've just written the above lines, you'd +normally have to go open the file +ThisProject/I18N/en.pm, and immediately add an entry: + + "Couldn't find file \"[_1]\"!\n" + => "Couldn't find file \"[_1]\"!\n", + +But I consider that somewhat of a distraction from the work +of getting the main code working -- to say nothing of the fact +that I often have to play with the program a few times before +I can decide exactly what wording I want in the messages (which +in this case would require me to go changing three lines of code: +the call to maketext with that key, and then the two lines in +ThisProject/I18N/en.pm). + +However, if you set "_AUTO => 1" in the %Lexicon in, +ThisProject/I18N/en.pm (assuming that English (en) is +the language that all your programmers will be using for this +project's internal message keys), then you don't ever have to +go adding lines like this + + "Couldn't find file \"[_1]\"!\n" + => "Couldn't find file \"[_1]\"!\n", + +to ThisProject/I18N/en.pm, because if _AUTO is true there, +then just looking for an entry with the key "Couldn't find +file \"[_1]\"!\n" in that lexicon will cause it to be added, +with that value! + +Note that the reason that keys that start with "_" +are immune to _AUTO isn't anything generally magical about +the underscore character -- I just wanted a way to have most +lexicon keys be autoable, except for possibly a few, and I +arbitrarily decided to use a leading underscore as a signal +to distinguish those few. + +=head1 READONLY LEXICONS + +If your lexicon is a tied hash the simple act of caching the compiled value can be fatal. + +For example a L<GDBM_File> GDBM_READER tied hash will die with something like: + + gdbm store returned -1, errno 2, key "..." at ... + +All you need to do is turn on caching outside of the lexicon hash itself like so: + + sub init { + my ($lh) = @_; + ... + $lh->{'use_external_lex_cache'} = 1; + ... + } + +And then instead of storing the compiled value in the lexicon hash it will store it in $lh->{'_external_lex_cache'} + +=head1 CONTROLLING LOOKUP FAILURE + +If you call $lh->maketext(I<key>, ...parameters...), +and there's no entry I<key> in $lh's class's %Lexicon, nor +in the superclass %Lexicon hash, I<and> if we can't auto-make +I<key> (because either it starts with a "_", or because none +of its lexicons have C<_AUTO =E<gt> 1,>), then we have +failed to find a normal way to maketext I<key>. What then +happens in these failure conditions, depends on the $lh object's +"fail" attribute. + +If the language handle has no "fail" attribute, maketext +will simply throw an exception (i.e., it calls C<die>, mentioning +the I<key> whose lookup failed, and naming the line number where +the calling $lh->maketext(I<key>,...) was. + +If the language handle has a "fail" attribute whose value is a +coderef, then $lh->maketext(I<key>,...params...) gives up and calls: + + return $that_subref->($lh, $key, @params); + +Otherwise, the "fail" attribute's value should be a string denoting +a method name, so that $lh->maketext(I<key>,...params...) can +give up with: + + return $lh->$that_method_name($phrase, @params); + +The "fail" attribute can be accessed with the C<fail_with> method: + + # Set to a coderef: + $lh->fail_with( \&failure_handler ); + + # Set to a method name: + $lh->fail_with( 'failure_method' ); + + # Set to nothing (i.e., so failure throws a plain exception) + $lh->fail_with( undef ); + + # Get the current value + $handler = $lh->fail_with(); + +Now, as to what you may want to do with these handlers: Maybe you'd +want to log what key failed for what class, and then die. Maybe +you don't like C<die> and instead you want to send the error message +to STDOUT (or wherever) and then merely C<exit()>. + +Or maybe you don't want to C<die> at all! Maybe you could use a +handler like this: + + # Make all lookups fall back onto an English value, + # but only after we log it for later fingerpointing. + my $lh_backup = ThisProject->get_handle('en'); + open(LEX_FAIL_LOG, ">>wherever/lex.log") || die "GNAARGH $!"; + sub lex_fail { + my($failing_lh, $key, $params) = @_; + print LEX_FAIL_LOG scalar(localtime), "\t", + ref($failing_lh), "\t", $key, "\n"; + return $lh_backup->maketext($key,@params); + } + +Some users have expressed that they think this whole mechanism of +having a "fail" attribute at all, seems a rather pointless complication. +But I want Locale::Maketext to be usable for software projects of I<any> +scale and type; and different software projects have different ideas +of what the right thing is to do in failure conditions. I could simply +say that failure always throws an exception, and that if you want to be +careful, you'll just have to wrap every call to $lh->maketext in an +S<eval { }>. However, I want programmers to reserve the right (via +the "fail" attribute) to treat lookup failure as something other than +an exception of the same level of severity as a config file being +unreadable, or some essential resource being inaccessible. + +One possibly useful value for the "fail" attribute is the method name +"failure_handler_auto". This is a method defined in the class +Locale::Maketext itself. You set it with: + + $lh->fail_with('failure_handler_auto'); + +Then when you call $lh->maketext(I<key>, ...parameters...) and +there's no I<key> in any of those lexicons, maketext gives up with + + return $lh->failure_handler_auto($key, @params); + +But failure_handler_auto, instead of dying or anything, compiles +$key, caching it in + + $lh->{'failure_lex'}{$key} = $compiled + +and then calls the compiled value, and returns that. (I.e., if +$key looks like bracket notation, $compiled is a sub, and we return +&{$compiled}(@params); but if $key is just a plain string, we just +return that.) + +The effect of using "failure_auto_handler" +is like an AUTO lexicon, except that it 1) compiles $key even if +it starts with "_", and 2) you have a record in the new hashref +$lh->{'failure_lex'} of all the keys that have failed for +this object. This should avoid your program dying -- as long +as your keys aren't actually invalid as bracket code, and as +long as they don't try calling methods that don't exist. + +"failure_auto_handler" may not be exactly what you want, but I +hope it at least shows you that maketext failure can be mitigated +in any number of very flexible ways. If you can formalize exactly +what you want, you should be able to express that as a failure +handler. You can even make it default for every object of a given +class, by setting it in that class's init: + + sub init { + my $lh = $_[0]; # a newborn handle + $lh->SUPER::init(); + $lh->fail_with('my_clever_failure_handler'); + return; + } + sub my_clever_failure_handler { + ...you clever things here... + } + +=head1 HOW TO USE MAKETEXT + +Here is a brief checklist on how to use Maketext to localize +applications: + +=over + +=item * + +Decide what system you'll use for lexicon keys. If you insist, +you can use opaque IDs (if you're nostalgic for C<catgets>), +but I have better suggestions in the +section "Entries in Each Lexicon", above. Assuming you opt for +meaningful keys that double as values (like "Minimum ([_1]) is +larger than maximum ([_2])!\n"), you'll have to settle on what +language those should be in. For the sake of argument, I'll +call this English, specifically American English, "en-US". + +=item * + +Create a class for your localization project. This is +the name of the class that you'll use in the idiom: + + use Projname::L10N; + my $lh = Projname::L10N->get_handle(...) || die "Language?"; + +Assuming you call your class Projname::L10N, create a class +consisting minimally of: + + package Projname::L10N; + use base qw(Locale::Maketext); + ...any methods you might want all your languages to share... + + # And, assuming you want the base class to be an _AUTO lexicon, + # as is discussed a few sections up: + + 1; + +=item * + +Create a class for the language your internal keys are in. Name +the class after the language-tag for that language, in lowercase, +with dashes changed to underscores. Assuming your project's first +language is US English, you should call this Projname::L10N::en_us. +It should consist minimally of: + + package Projname::L10N::en_us; + use base qw(Projname::L10N); + %Lexicon = ( + '_AUTO' => 1, + ); + 1; + +(For the rest of this section, I'll assume that this "first +language class" of Projname::L10N::en_us has +_AUTO lexicon.) + +=item * + +Go and write your program. Everywhere in your program where +you would say: + + print "Foobar $thing stuff\n"; + +instead do it thru maketext, using no variable interpolation in +the key: + + print $lh->maketext("Foobar [_1] stuff\n", $thing); + +If you get tired of constantly saying C<print $lh-E<gt>maketext>, +consider making a functional wrapper for it, like so: + + use Projname::L10N; + our $lh; + $lh = Projname::L10N->get_handle(...) || die "Language?"; + sub pmt (@) { print( $lh->maketext(@_)) } + # "pmt" is short for "Print MakeText" + $Carp::Verbose = 1; + # so if maketext fails, we see made the call to pmt + +Besides whole phrases meant for output, anything language-dependent +should be put into the class Projname::L10N::en_us, +whether as methods, or as lexicon entries -- this is discussed +in the section "Entries in Each Lexicon", above. + +=item * + +Once the program is otherwise done, and once its localization for +the first language works right (via the data and methods in +Projname::L10N::en_us), you can get together the data for translation. +If your first language lexicon isn't an _AUTO lexicon, then you already +have all the messages explicitly in the lexicon (or else you'd be +getting exceptions thrown when you call $lh->maketext to get +messages that aren't in there). But if you were (advisedly) lazy and are +using an _AUTO lexicon, then you've got to make a list of all the phrases +that you've so far been letting _AUTO generate for you. There are very +many ways to assemble such a list. The most straightforward is to simply +grep the source for every occurrence of "maketext" (or calls +to wrappers around it, like the above C<pmt> function), and to log the +following phrase. + +=item * + +You may at this point want to consider whether your base class +(Projname::L10N), from which all lexicons inherit from (Projname::L10N::en, +Projname::L10N::es, etc.), should be an _AUTO lexicon. It may be true +that in theory, all needed messages will be in each language class; +but in the presumably unlikely or "impossible" case of lookup failure, +you should consider whether your program should throw an exception, +emit text in English (or whatever your project's first language is), +or some more complex solution as described in the section +"Controlling Lookup Failure", above. + +=item * + +Submit all messages/phrases/etc. to translators. + +(You may, in fact, want to start with localizing to I<one> other language +at first, if you're not sure that you've properly abstracted the +language-dependent parts of your code.) + +Translators may request clarification of the situation in which a +particular phrase is found. For example, in English we are entirely happy +saying "I<n> files found", regardless of whether we mean "I looked for files, +and found I<n> of them" or the rather distinct situation of "I looked for +something else (like lines in files), and along the way I saw I<n> +files." This may involve rethinking things that you thought quite clear: +should "Edit" on a toolbar be a noun ("editing") or a verb ("to edit")? Is +there already a conventionalized way to express that menu option, separate +from the target language's normal word for "to edit"? + +In all cases where the very common phenomenon of quantification +(saying "I<N> files", for B<any> value of N) +is involved, each translator should make clear what dependencies the +number causes in the sentence. In many cases, dependency is +limited to words adjacent to the number, in places where you might +expect them ("I found the-?PLURAL I<N> +empty-?PLURAL directory-?PLURAL"), but in some cases there are +unexpected dependencies ("I found-?PLURAL ..."!) as well as long-distance +dependencies "The I<N> directory-?PLURAL could not be deleted-?PLURAL"!). + +Remind the translators to consider the case where N is 0: +"0 files found" isn't exactly natural-sounding in any language, but it +may be unacceptable in many -- or it may condition special +kinds of agreement (similar to English "I didN'T find ANY files"). + +Remember to ask your translators about numeral formatting in their +language, so that you can override the C<numf> method as +appropriate. Typical variables in number formatting are: what to +use as a decimal point (comma? period?); what to use as a thousands +separator (space? nonbreaking space? comma? period? small +middot? prime? apostrophe?); and even whether the so-called "thousands +separator" is actually for every third digit -- I've heard reports of +two hundred thousand being expressible as "2,00,000" for some Indian +(Subcontinental) languages, besides the less surprising "S<200 000>", +"200.000", "200,000", and "200'000". Also, using a set of numeral +glyphs other than the usual ASCII "0"-"9" might be appreciated, as via +C<tr/0-9/\x{0966}-\x{096F}/> for getting digits in Devanagari script +(for Hindi, Konkani, others). + +The basic C<quant> method that Locale::Maketext provides should be +good for many languages. For some languages, it might be useful +to modify it (or its constituent C<numerate> method) +to take a plural form in the two-argument call to C<quant> +(as in "[quant,_1,files]") if +it's all-around easier to infer the singular form from the plural, than +to infer the plural form from the singular. + +But for other languages (as is discussed at length +in L<Locale::Maketext::TPJ13|Locale::Maketext::TPJ13>), simple +C<quant>/C<numf> is not enough. For the particularly problematic +Slavic languages, what you may need is a method which you provide +with the number, the citation form of the noun to quantify, and +the case and gender that the sentence's syntax projects onto that +noun slot. The method would then be responsible for determining +what grammatical number that numeral projects onto its noun phrase, +and what case and gender it may override the normal case and gender +with; and then it would look up the noun in a lexicon providing +all needed inflected forms. + +=item * + +You may also wish to discuss with the translators the question of +how to relate different subforms of the same language tag, +considering how this reacts with C<get_handle>'s treatment of +these. For example, if a user accepts interfaces in "en, fr", and +you have interfaces available in "en-US" and "fr", what should +they get? You may wish to resolve this by establishing that "en" +and "en-US" are effectively synonymous, by having one class +zero-derive from the other. + +For some languages this issue may never come up (Danish is rarely +expressed as "da-DK", but instead is just "da"). And for other +languages, the whole concept of a "generic" form may verge on +being uselessly vague, particularly for interfaces involving voice +media in forms of Arabic or Chinese. + +=item * + +Once you've localized your program/site/etc. for all desired +languages, be sure to show the result (whether live, or via +screenshots) to the translators. Once they approve, make every +effort to have it then checked by at least one other speaker of +that language. This holds true even when (or especially when) the +translation is done by one of your own programmers. Some +kinds of systems may be harder to find testers for than others, +depending on the amount of domain-specific jargon and concepts +involved -- it's easier to find people who can tell you whether +they approve of your translation for "delete this message" in an +email-via-Web interface, than to find people who can give you +an informed opinion on your translation for "attribute value" +in an XML query tool's interface. + +=back + +=head1 SEE ALSO + +I recommend reading all of these: + +L<Locale::Maketext::TPJ13|Locale::Maketext::TPJ13> -- my I<The Perl +Journal> article about Maketext. It explains many important concepts +underlying Locale::Maketext's design, and some insight into why +Maketext is better than the plain old approach of having +message catalogs that are just databases of sprintf formats. + +L<File::Findgrep|File::Findgrep> is a sample application/module +that uses Locale::Maketext to localize its messages. For a larger +internationalized system, see also L<Apache::MP3>. + +L<I18N::LangTags|I18N::LangTags>. + +L<Win32::Locale|Win32::Locale>. + +RFC 3066, I<Tags for the Identification of Languages>, +as at L<http://sunsite.dk/RFC/rfc/rfc3066.html> + +RFC 2277, I<IETF Policy on Character Sets and Languages> +is at L<http://sunsite.dk/RFC/rfc/rfc2277.html> -- much of it is +just things of interest to protocol designers, but it explains +some basic concepts, like the distinction between locales and +language-tags. + +The manual for GNU C<gettext>. The gettext dist is available in +C<L<ftp://prep.ai.mit.edu/pub/gnu/>> -- get +a recent gettext tarball and look in its "doc/" directory, there's +an easily browsable HTML version in there. The +gettext documentation asks lots of questions worth thinking +about, even if some of their answers are sometimes wonky, +particularly where they start talking about pluralization. + +The Locale/Maketext.pm source. Observe that the module is much +shorter than its documentation! + +=head1 COPYRIGHT AND DISCLAIMER + +Copyright (c) 1999-2004 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Sean M. Burke C<sburke@cpan.org> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Math/BigFloat.pm b/data/miniconda3/lib/perl5/core_perl/Math/BigFloat.pm new file mode 100644 index 0000000000000000000000000000000000000000..f1d7a1a0a0abee78d59f72260951b2a622042ef5 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Math/BigFloat.pm @@ -0,0 +1,6037 @@ +package Math::BigFloat; + +# +# Mike grinned. 'Two down, infinity to go' - Mike Nostrus in 'Before and After' +# + +# The following hash values are used internally: +# sign : "+", "-", "+inf", "-inf", or "NaN" if not a number +# _m : mantissa ($LIB thingy) +# _es : sign of _e +# _e : exponent ($LIB thingy) +# _a : accuracy +# _p : precision + +use 5.006001; +use strict; +use warnings; + +use Carp qw< carp croak >; +use Math::BigInt (); + +our $VERSION = '1.999818'; + +require Exporter; +our @ISA = qw/Math::BigInt/; +our @EXPORT_OK = qw/bpi/; + +# $_trap_inf/$_trap_nan are internal and should never be accessed from outside +our ($AUTOLOAD, $accuracy, $precision, $div_scale, $round_mode, $rnd_mode, + $upgrade, $downgrade, $_trap_nan, $_trap_inf); + +use overload + + # overload key: with_assign + + '+' => sub { $_[0] -> copy() -> badd($_[1]); }, + + '-' => sub { my $c = $_[0] -> copy(); + $_[2] ? $c -> bneg() -> badd($_[1]) + : $c -> bsub($_[1]); }, + + '*' => sub { $_[0] -> copy() -> bmul($_[1]); }, + + '/' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bdiv($_[0]) + : $_[0] -> copy() -> bdiv($_[1]); }, + + '%' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bmod($_[0]) + : $_[0] -> copy() -> bmod($_[1]); }, + + '**' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bpow($_[0]) + : $_[0] -> copy() -> bpow($_[1]); }, + + '<<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blsft($_[0]) + : $_[0] -> copy() -> blsft($_[1]); }, + + '>>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> brsft($_[0]) + : $_[0] -> copy() -> brsft($_[1]); }, + + # overload key: assign + + '+=' => sub { $_[0]->badd($_[1]); }, + + '-=' => sub { $_[0]->bsub($_[1]); }, + + '*=' => sub { $_[0]->bmul($_[1]); }, + + '/=' => sub { scalar $_[0]->bdiv($_[1]); }, + + '%=' => sub { $_[0]->bmod($_[1]); }, + + '**=' => sub { $_[0]->bpow($_[1]); }, + + '<<=' => sub { $_[0]->blsft($_[1]); }, + + '>>=' => sub { $_[0]->brsft($_[1]); }, + +# 'x=' => sub { }, + +# '.=' => sub { }, + + # overload key: num_comparison + + '<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blt($_[0]) + : $_[0] -> blt($_[1]); }, + + '<=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> ble($_[0]) + : $_[0] -> ble($_[1]); }, + + '>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bgt($_[0]) + : $_[0] -> bgt($_[1]); }, + + '>=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bge($_[0]) + : $_[0] -> bge($_[1]); }, + + '==' => sub { $_[0] -> beq($_[1]); }, + + '!=' => sub { $_[0] -> bne($_[1]); }, + + # overload key: 3way_comparison + + '<=>' => sub { my $cmp = $_[0] -> bcmp($_[1]); + defined($cmp) && $_[2] ? -$cmp : $cmp; }, + + 'cmp' => sub { $_[2] ? "$_[1]" cmp $_[0] -> bstr() + : $_[0] -> bstr() cmp "$_[1]"; }, + + # overload key: str_comparison + +# 'lt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrlt($_[0]) +# : $_[0] -> bstrlt($_[1]); }, +# +# 'le' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrle($_[0]) +# : $_[0] -> bstrle($_[1]); }, +# +# 'gt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrgt($_[0]) +# : $_[0] -> bstrgt($_[1]); }, +# +# 'ge' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrge($_[0]) +# : $_[0] -> bstrge($_[1]); }, +# +# 'eq' => sub { $_[0] -> bstreq($_[1]); }, +# +# 'ne' => sub { $_[0] -> bstrne($_[1]); }, + + # overload key: binary + + '&' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> band($_[0]) + : $_[0] -> copy() -> band($_[1]); }, + + '&=' => sub { $_[0] -> band($_[1]); }, + + '|' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bior($_[0]) + : $_[0] -> copy() -> bior($_[1]); }, + + '|=' => sub { $_[0] -> bior($_[1]); }, + + '^' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bxor($_[0]) + : $_[0] -> copy() -> bxor($_[1]); }, + + '^=' => sub { $_[0] -> bxor($_[1]); }, + +# '&.' => sub { }, + +# '&.=' => sub { }, + +# '|.' => sub { }, + +# '|.=' => sub { }, + +# '^.' => sub { }, + +# '^.=' => sub { }, + + # overload key: unary + + 'neg' => sub { $_[0] -> copy() -> bneg(); }, + +# '!' => sub { }, + + '~' => sub { $_[0] -> copy() -> bnot(); }, + +# '~.' => sub { }, + + # overload key: mutators + + '++' => sub { $_[0] -> binc() }, + + '--' => sub { $_[0] -> bdec() }, + + # overload key: func + + 'atan2' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> batan2($_[0]) + : $_[0] -> copy() -> batan2($_[1]); }, + + 'cos' => sub { $_[0] -> copy() -> bcos(); }, + + 'sin' => sub { $_[0] -> copy() -> bsin(); }, + + 'exp' => sub { $_[0] -> copy() -> bexp($_[1]); }, + + 'abs' => sub { $_[0] -> copy() -> babs(); }, + + 'log' => sub { $_[0] -> copy() -> blog(); }, + + 'sqrt' => sub { $_[0] -> copy() -> bsqrt(); }, + + 'int' => sub { $_[0] -> copy() -> bint(); }, + + # overload key: conversion + + 'bool' => sub { $_[0] -> is_zero() ? '' : 1; }, + + '""' => sub { $_[0] -> bstr(); }, + + '0+' => sub { $_[0] -> numify(); }, + + '=' => sub { $_[0]->copy(); }, + + ; + +############################################################################## +# global constants, flags and assorted stuff + +# the following are public, but their usage is not recommended. Use the +# accessor methods instead. + +# class constants, use Class->constant_name() to access +# one of 'even', 'odd', '+inf', '-inf', 'zero', 'trunc' or 'common' +$round_mode = 'even'; +$accuracy = undef; +$precision = undef; +$div_scale = 40; + +$upgrade = undef; +$downgrade = undef; +# the package we are using for our private parts, defaults to: +# Math::BigInt->config('lib') +my $LIB = 'Math::BigInt::Calc'; + +# are NaNs ok? (otherwise it dies when encountering an NaN) set w/ config() +$_trap_nan = 0; +# the same for infinity +$_trap_inf = 0; + +# constant for easier life +my $nan = 'NaN'; + +my $IMPORT = 0; # was import() called yet? used to make require work + +# some digits of accuracy for blog(undef, 10); which we use in blog() for speed +my $LOG_10 = + '2.3025850929940456840179914546843642076011014886287729760333279009675726097'; +my $LOG_10_A = length($LOG_10)-1; +# ditto for log(2) +my $LOG_2 = + '0.6931471805599453094172321214581765680755001343602552541206800094933936220'; +my $LOG_2_A = length($LOG_2)-1; +my $HALF = '0.5'; # made into an object if nec. + +############################################################################## +# the old code had $rnd_mode, so we need to support it, too + +sub TIESCALAR { + my ($class) = @_; + bless \$round_mode, $class; +} + +sub FETCH { + return $round_mode; +} + +sub STORE { + $rnd_mode = $_[0]->round_mode($_[1]); +} + +BEGIN { + # when someone sets $rnd_mode, we catch this and check the value to see + # whether it is valid or not. + $rnd_mode = 'even'; + tie $rnd_mode, 'Math::BigFloat'; + + # we need both of them in this package: + *as_int = \&as_number; +} + +sub DESTROY { + # going through AUTOLOAD for every DESTROY is costly, avoid it by empty sub +} + +sub AUTOLOAD { + # make fxxx and bxxx both work by selectively mapping fxxx() to MBF::bxxx() + my $name = $AUTOLOAD; + + $name =~ s/(.*):://; # split package + my $c = $1 || __PACKAGE__; + no strict 'refs'; + $c->import() if $IMPORT == 0; + if (!_method_alias($name)) { + if (!defined $name) { + # delayed load of Carp and avoid recursion + croak("$c: Can't call a method without name"); + } + if (!_method_hand_up($name)) { + # delayed load of Carp and avoid recursion + croak("Can't call $c\-\>$name, not a valid method"); + } + # try one level up, but subst. bxxx() for fxxx() since MBI only got bxxx() + $name =~ s/^f/b/; + return &{"Math::BigInt"."::$name"}(@_); + } + my $bname = $name; + $bname =~ s/^f/b/; + $c .= "::$name"; + *{$c} = \&{$bname}; + &{$c}; # uses @_ +} + +############################################################################## + +{ + # valid method aliases for AUTOLOAD + my %methods = map { $_ => 1 } + qw / fadd fsub fmul fdiv fround ffround fsqrt fmod fstr fsstr fpow fnorm + fint facmp fcmp fzero fnan finf finc fdec ffac fneg + fceil ffloor frsft flsft fone flog froot fexp + /; + # valid methods that can be handed up (for AUTOLOAD) + my %hand_ups = map { $_ => 1 } + qw / is_nan is_inf is_negative is_positive is_pos is_neg + accuracy precision div_scale round_mode fabs fnot + objectify upgrade downgrade + bone binf bnan bzero + bsub + /; + + sub _method_alias { exists $methods{$_[0]||''}; } + sub _method_hand_up { exists $hand_ups{$_[0]||''}; } +} + +sub isa { + my ($self, $class) = @_; + return if $class =~ /^Math::BigInt/; # we aren't one of these + UNIVERSAL::isa($self, $class); +} + +sub config { + # return (later set?) configuration data as hash ref + my $class = shift || 'Math::BigFloat'; + + # Getter/accessor. + + if (@_ == 1 && ref($_[0]) ne 'HASH') { + my $param = shift; + return $class if $param eq 'class'; + return $LIB if $param eq 'with'; + return $class->SUPER::config($param); + } + + # Setter. + + my $cfg = $class->SUPER::config(@_); + + # now we need only to override the ones that are different from our parent + $cfg->{class} = $class; + $cfg->{with} = $LIB; + $cfg; +} + +############################################################################### +# Constructor methods +############################################################################### + +sub new { + # Create a new Math::BigFloat object from a string or another bigfloat object. + # _e: exponent + # _m: mantissa + # sign => ("+", "-", "+inf", "-inf", or "NaN") + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + my ($wanted, @r) = @_; + + # avoid numify-calls by not using || on $wanted! + + unless (defined $wanted) { + #carp("Use of uninitialized value in new"); + return $self->bzero(@r); + } + + # Using $wanted->isa("Math::BigFloat") here causes a 'Deep recursion on + # subroutine "Math::BigFloat::as_number"' in some tests. Fixme! + + if (UNIVERSAL::isa($wanted, 'Math::BigFloat')) { + my $copy = $wanted -> copy(); + if ($selfref) { # if new() called as instance method + %$self = %$copy; + } else { # if new() called as class method + $self = $copy; + } + return $copy; + } + + $class->import() if $IMPORT == 0; # make require work + + # If called as a class method, initialize a new object. + + $self = bless {}, $class unless $selfref; + + # shortcut for bigints and its subclasses + if ((ref($wanted)) && $wanted -> can("as_number")) { + $self->{_m} = $wanted->as_number()->{value}; # get us a bigint copy + $self->{_e} = $LIB->_zero(); + $self->{_es} = '+'; + $self->{sign} = $wanted->sign(); + return $self->bnorm(); + } + + # else: got a string or something masquerading as number (with overload) + + # Handle Infs. + + if ($wanted =~ /^\s*([+-]?)inf(inity)?\s*\z/i) { + return $downgrade->new($wanted) if $downgrade; + my $sgn = $1 || '+'; + $self->{sign} = $sgn . 'inf'; # set a default sign for bstr() + return $self->binf($sgn); + } + + # Handle explicit NaNs (not the ones returned due to invalid input). + + if ($wanted =~ /^\s*([+-]?)nan\s*\z/i) { + return $downgrade->new($wanted) if $downgrade; + $self = $class -> bnan(); + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + + # Handle hexadecimal numbers. We auto-detect hexadecimal numbers if they + # have a "0x" or "0X" prefix. + + if ($wanted =~ /^\s*[+-]?0[Xx]/) { + $self = $class -> from_hex($wanted); + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + + # Handle octal numbers. We auto-detect octal numbers if they have a "0" + # prefix and a binary exponent. + + if ($wanted =~ / + ^ + \s* + + # sign + [+-]? + + # prefix + 0 + + # significand using the octal digits 0..7 + [0-7]+ (?: _ [0-7]+ )* + (?: + \. + (?: [0-7]+ (?: _ [0-7]+ )* )? + )? + + # exponent (power of 2) using decimal digits + [Pp] + [+-]? + \d+ (?: _ \d+ )* + + \s* + $ + /x) + { + $self = $class -> from_oct($wanted); + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + + # Handle binary numbers. We auto-detect binary numbers if they have a "0b" + # or "0B" prefix. + + if ($wanted =~ /^\s*[+-]?0[Bb]/) { + $self = $class -> from_bin($wanted); + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + + # Shortcut for simple forms like '12' that have no trailing zeros. + if ($wanted =~ /^([+-]?)0*([1-9][0-9]*[1-9])$/) { + $self->{_e} = $LIB -> _zero(); + $self->{_es} = '+'; + $self->{sign} = $1 || '+'; + $self->{_m} = $LIB -> _new($2); + if (!$downgrade) { + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + } + + my ($mis, $miv, $mfv, $es, $ev) = Math::BigInt::_split($wanted); + if (!ref $mis) { + if ($_trap_nan) { + croak("$wanted is not a number initialized to $class"); + } + + return $downgrade->bnan() if $downgrade; + + $self->{_e} = $LIB->_zero(); + $self->{_es} = '+'; + $self->{_m} = $LIB->_zero(); + $self->{sign} = $nan; + } else { + # make integer from mantissa by adjusting exp, then convert to int + $self->{_e} = $LIB->_new($$ev); # exponent + $self->{_es} = $$es || '+'; + my $mantissa = "$$miv$$mfv"; # create mant. + $mantissa =~ s/^0+(\d)/$1/; # strip leading zeros + $self->{_m} = $LIB->_new($mantissa); # create mant. + + # 3.123E0 = 3123E-3, and 3.123E-2 => 3123E-5 + if (CORE::length($$mfv) != 0) { + my $len = $LIB->_new(CORE::length($$mfv)); + ($self->{_e}, $self->{_es}) = + _e_sub($self->{_e}, $len, $self->{_es}, '+'); + } + # we can only have trailing zeros on the mantissa if $$mfv eq '' + else { + # Use a regexp to count the trailing zeros in $$miv instead of + # _zeros() because that is faster, especially when _m is not stored + # in base 10. + my $zeros = 0; + $zeros = CORE::length($1) if $$miv =~ /[1-9](0*)$/; + if ($zeros != 0) { + my $z = $LIB->_new($zeros); + # turn '120e2' into '12e3' + $self->{_m} = $LIB->_rsft($self->{_m}, $z, 10); + ($self->{_e}, $self->{_es}) = + _e_add($self->{_e}, $z, $self->{_es}, '+'); + } + } + $self->{sign} = $$mis; + + # for something like 0Ey, set y to 0, and -0 => +0 + # Check $$miv for being '0' and $$mfv eq '', because otherwise _m could not + # have become 0. That's faster than to call $LIB->_is_zero(). + $self->{sign} = '+', $self->{_e} = $LIB->_zero() + if $$miv eq '0' and $$mfv eq ''; + + if (!$downgrade) { + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; + } + } + + # if downgrade, inf, NaN or integers go down + + if ($downgrade && $self->{_es} eq '+') { + if ($LIB->_is_zero($self->{_e})) { + return $downgrade->new($$mis . $LIB->_str($self->{_m})); + } + return $downgrade->new($self->bsstr()); + } + $self->bnorm(); + $self->round(@r) unless @r >= 2 && !defined $r[0] && !defined $r[1]; + return $self; +} + +sub from_hex { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_hex'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + + # sign + ( [+-]? ) + + # optional "hex marker" + (?: 0? x )? + + # significand using the hex digits 0..9 and a..f + ( + [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )* + (?: + \. + (?: [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )* )? + )? + | + \. + [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )* + ) + + # exponent (power of 2) using decimal digits + (?: + [Pp] + ( [+-]? ) + ( \d+ (?: _ \d+ )* ) + )? + + \s* + $ + //x) + { + my $s_sign = $1 || '+'; + my $s_value = $2; + my $e_sign = $3 || '+'; + my $e_value = $4 || '0'; + $s_value =~ tr/_//d; + $e_value =~ tr/_//d; + + # The significand must be multiplied by 2 raised to this exponent. + + my $two_expon = $class -> new($e_value); + $two_expon -> bneg() if $e_sign eq '-'; + + # If there is a dot in the significand, remove it and adjust the + # exponent according to the number of digits in the fraction part of + # the significand. Since the digits in the significand are in base 16, + # but the exponent is only in base 2, multiply the exponent adjustment + # value by log(16) / log(2) = 4. + + my $idx = index($s_value, '.'); + if ($idx >= 0) { + substr($s_value, $idx, 1) = ''; + $two_expon -= $class -> new(CORE::length($s_value)) + -> bsub($idx) + -> bmul("4"); + } + + $self -> {sign} = $s_sign; + $self -> {_m} = $LIB -> _from_hex('0x' . $s_value); + + if ($two_expon > 0) { + my $factor = $class -> new("2") -> bpow($two_expon); + $self -> bmul($factor); + } elsif ($two_expon < 0) { + my $factor = $class -> new("0.5") -> bpow(-$two_expon); + $self -> bmul($factor); + } + + return $self; + } + + return $self->bnan(); +} + +sub from_oct { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_oct'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + + # sign + ( [+-]? ) + + # significand using the octal digits 0..7 + ( + [0-7]+ (?: _ [0-7]+ )* + (?: + \. + (?: [0-7]+ (?: _ [0-7]+ )* )? + )? + | + \. + [0-7]+ (?: _ [0-7]+ )* + ) + + # exponent (power of 2) using decimal digits + (?: + [Pp] + ( [+-]? ) + ( \d+ (?: _ \d+ )* ) + )? + + \s* + $ + //x) + { + my $s_sign = $1 || '+'; + my $s_value = $2; + my $e_sign = $3 || '+'; + my $e_value = $4 || '0'; + $s_value =~ tr/_//d; + $e_value =~ tr/_//d; + + # The significand must be multiplied by 2 raised to this exponent. + + my $two_expon = $class -> new($e_value); + $two_expon -> bneg() if $e_sign eq '-'; + + # If there is a dot in the significand, remove it and adjust the + # exponent according to the number of digits in the fraction part of + # the significand. Since the digits in the significand are in base 8, + # but the exponent is only in base 2, multiply the exponent adjustment + # value by log(8) / log(2) = 3. + + my $idx = index($s_value, '.'); + if ($idx >= 0) { + substr($s_value, $idx, 1) = ''; + $two_expon -= $class -> new(CORE::length($s_value)) + -> bsub($idx) + -> bmul("3"); + } + + $self -> {sign} = $s_sign; + $self -> {_m} = $LIB -> _from_oct($s_value); + + if ($two_expon > 0) { + my $factor = $class -> new("2") -> bpow($two_expon); + $self -> bmul($factor); + } elsif ($two_expon < 0) { + my $factor = $class -> new("0.5") -> bpow(-$two_expon); + $self -> bmul($factor); + } + + return $self; + } + + return $self->bnan(); +} + +sub from_bin { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_bin'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + + # sign + ( [+-]? ) + + # optional "bin marker" + (?: 0? b )? + + # significand using the binary digits 0 and 1 + ( + [01]+ (?: _ [01]+ )* + (?: + \. + (?: [01]+ (?: _ [01]+ )* )? + )? + | + \. + [01]+ (?: _ [01]+ )* + ) + + # exponent (power of 2) using decimal digits + (?: + [Pp] + ( [+-]? ) + ( \d+ (?: _ \d+ )* ) + )? + + \s* + $ + //x) + { + my $s_sign = $1 || '+'; + my $s_value = $2; + my $e_sign = $3 || '+'; + my $e_value = $4 || '0'; + $s_value =~ tr/_//d; + $e_value =~ tr/_//d; + + # The significand must be multiplied by 2 raised to this exponent. + + my $two_expon = $class -> new($e_value); + $two_expon -> bneg() if $e_sign eq '-'; + + # If there is a dot in the significand, remove it and adjust the + # exponent according to the number of digits in the fraction part of + # the significand. + + my $idx = index($s_value, '.'); + if ($idx >= 0) { + substr($s_value, $idx, 1) = ''; + $two_expon -= $class -> new(CORE::length($s_value)) + -> bsub($idx); + } + + $self -> {sign} = $s_sign; + $self -> {_m} = $LIB -> _from_bin('0b' . $s_value); + + if ($two_expon > 0) { + my $factor = $class -> new("2") -> bpow($two_expon); + $self -> bmul($factor); + } elsif ($two_expon < 0) { + my $factor = $class -> new("0.5") -> bpow(-$two_expon); + $self -> bmul($factor); + } + + return $self; + } + + return $self->bnan(); +} + +sub from_ieee754 { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_ieee754'); + + my $in = shift; # input string (or raw bytes) + my $format = shift; # format ("binary32", "decimal64" etc.) + my $enc; # significand encoding (applies only to decimal) + my $k; # storage width in bits + my $b; # base + + if ($format =~ /^binary(\d+)\z/) { + $k = $1; + $b = 2; + } elsif ($format =~ /^decimal(\d+)(dpd|bcd)?\z/) { + $k = $1; + $b = 10; + $enc = $2 || 'dpd'; # default is dencely-packed decimals (DPD) + } elsif ($format eq 'half') { + $k = 16; + $b = 2; + } elsif ($format eq 'single') { + $k = 32; + $b = 2; + } elsif ($format eq 'double') { + $k = 64; + $b = 2; + } elsif ($format eq 'quadruple') { + $k = 128; + $b = 2; + } elsif ($format eq 'octuple') { + $k = 256; + $b = 2; + } elsif ($format eq 'sexdecuple') { + $k = 512; + $b = 2; + } + + if ($b == 2) { + + # Get the parameters for this format. + + my $p; # precision (in bits) + my $t; # number of bits in significand + my $w; # number of bits in exponent + + if ($k == 16) { # binary16 (half-precision) + $p = 11; + $t = 10; + $w = 5; + } elsif ($k == 32) { # binary32 (single-precision) + $p = 24; + $t = 23; + $w = 8; + } elsif ($k == 64) { # binary64 (double-precision) + $p = 53; + $t = 52; + $w = 11; + } else { # binaryN (quadruple-precision and above) + if ($k < 128 || $k != 32 * sprintf('%.0f', $k / 32)) { + croak "Number of bits must be 16, 32, 64, or >= 128 and", + " a multiple of 32"; + } + $p = $k - sprintf('%.0f', 4 * log($k) / log(2)) + 13; + $t = $p - 1; + $w = $k - $t - 1; + } + + # The maximum exponent, minimum exponent, and exponent bias. + + my $emax = Math::BigInt -> new(2) -> bpow($w - 1) -> bdec(); + my $emin = 1 - $emax; + my $bias = $emax; + + # Undefined input. + + unless (defined $in) { + carp("Input is undefined"); + return $self -> bzero(); + } + + # Make sure input string is a string of zeros and ones. + + my $len = CORE::length $in; + if (8 * $len == $k) { # bytes + $in = unpack "B*", $in; + } elsif (4 * $len == $k) { # hexadecimal + if ($in =~ /([^\da-f])/i) { + croak "Illegal hexadecimal digit '$1'"; + } + $in = unpack "B*", pack "H*", $in; + } elsif ($len == $k) { # bits + if ($in =~ /([^01])/) { + croak "Illegal binary digit '$1'"; + } + } else { + croak "Unknown input -- $in"; + } + + # Split bit string into sign, exponent, and mantissa/significand. + + my $sign = substr($in, 0, 1) eq '1' ? '-' : '+'; + my $expo = $class -> from_bin(substr($in, 1, $w)); + my $mant = $class -> from_bin(substr($in, $w + 1)); + + my $x; + + $expo -> bsub($bias); # subtract bias + + if ($expo < $emin) { # zero and subnormals + if ($mant == 0) { # zero + $x = $class -> bzero(); + } else { # subnormals + # compute (1/$b)**(N) rather than ($b)**(-N) + $x = $class -> new("0.5"); # 1/$b + $x -> bpow($bias + $t - 1) -> bmul($mant); + $x -> bneg() if $sign eq '-'; + } + } + + elsif ($expo > $emax) { # inf and nan + if ($mant == 0) { # inf + $x = $class -> binf($sign); + } else { # nan + $x = $class -> bnan(); + } + } + + else { # normals + $mant = $class -> new(2) -> bpow($t) -> badd($mant); + if ($expo < $t) { + # compute (1/$b)**(N) rather than ($b)**(-N) + $x = $class -> new("0.5"); # 1/$b + $x -> bpow($t - $expo) -> bmul($mant); + } else { + $x = $class -> new(2); + $x -> bpow($expo - $t) -> bmul($mant); + } + $x -> bneg() if $sign eq '-'; + } + + if ($selfref) { + $self -> {sign} = $x -> {sign}; + $self -> {_m} = $x -> {_m}; + $self -> {_es} = $x -> {_es}; + $self -> {_e} = $x -> {_e}; + } else { + $self = $x; + } + return $self; + } + + croak("The format '$format' is not yet supported."); +} + +sub bzero { + # create/assign '+0' + + if (@_ == 0) { + #carp("Using bone() as a function is deprecated;", + # " use bone() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self->import() if $IMPORT == 0; # make require work + return if $selfref && $self->modify('bzero'); + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = '+'; + $self -> {_m} = $LIB -> _zero(); + $self -> {_es} = '+'; + $self -> {_e} = $LIB -> _zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub bone { + # Create or assign '+1' (or -1 if given sign '-'). + + if (@_ == 0 || (defined($_[0]) && ($_[0] eq '+' || $_[0] eq '-'))) { + #carp("Using bone() as a function is deprecated;", + # " use bone() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self->import() if $IMPORT == 0; # make require work + return if $selfref && $self->modify('bone'); + + my $sign = shift; + $sign = defined $sign && $sign =~ /^\s*-/ ? "-" : "+"; + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = $sign; + $self -> {_m} = $LIB -> _one(); + $self -> {_es} = '+'; + $self -> {_e} = $LIB -> _zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub binf { + # create/assign a '+inf' or '-inf' + + if (@_ == 0 || (defined($_[0]) && !ref($_[0]) && + $_[0] =~ /^\s*[+-](inf(inity)?)?\s*$/)) + { + #carp("Using binf() as a function is deprecated;", + # " use binf() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + { + no strict 'refs'; + if (${"${class}::_trap_inf"}) { + croak("Tried to create +-inf in $class->binf()"); + } + } + + $self->import() if $IMPORT == 0; # make require work + return if $selfref && $self->modify('binf'); + + my $sign = shift; + $sign = defined $sign && $sign =~ /^\s*-/ ? "-" : "+"; + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = $sign . 'inf'; + $self -> {_m} = $LIB -> _zero(); + $self -> {_es} = '+'; + $self -> {_e} = $LIB -> _zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub bnan { + # create/assign a 'NaN' + + if (@_ == 0) { + #carp("Using bnan() as a function is deprecated;", + # " use bnan() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + { + no strict 'refs'; + if (${"${class}::_trap_nan"}) { + croak("Tried to create NaN in $class->bnan()"); + } + } + + $self->import() if $IMPORT == 0; # make require work + return if $selfref && $self->modify('bnan'); + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = $nan; + $self -> {_m} = $LIB -> _zero(); + $self -> {_es} = '+'; + $self -> {_e} = $LIB -> _zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub bpi { + + # Called as Argument list + # --------- ------------- + # Math::BigFloat->bpi() ("Math::BigFloat") + # Math::BigFloat->bpi(10) ("Math::BigFloat", 10) + # $x->bpi() ($x) + # $x->bpi(10) ($x, 10) + # Math::BigFloat::bpi() () + # Math::BigFloat::bpi(10) (10) + # + # In ambiguous cases, we favour the OO-style, so the following case + # + # $n = Math::BigFloat->new("10"); + # $x = Math::BigFloat->bpi($n); + # + # which gives an argument list with the single element $n, is resolved as + # + # $n->bpi(); + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + my @r; # rounding paramters + + # If bpi() is called as a function ... + # + # This cludge is necessary because we still support bpi() as a function. If + # bpi() is called with either no argument or one argument, and that one + # argument is either undefined or a scalar that looks like a number, then + # we assume bpi() is called as a function. + + if (@_ == 0 && + (defined($self) && !ref($self) && $self =~ /^\s*[+-]?\d/i) + || + !defined($self)) + { + $r[0] = $self; + $class = __PACKAGE__; + $self = $class -> bzero(@r); # initialize + } + + # ... or if bpi() is called as a method ... + + else { + @r = @_; + if ($selfref) { # bpi() called as instance method + return $self if $self -> modify('bpi'); + } else { # bpi() called as class method + $self = $class -> bzero(@r); # initialize + } + } + + ($self, @r) = $self -> _find_round_parameters(@r); + + # The accuracy, i.e., the number of digits. Pi has one digit before the + # dot, so a precision of 4 digits is equivalent to an accuracy of 5 digits. + + my $n = defined $r[0] ? $r[0] + : defined $r[1] ? 1 - $r[1] + : $self -> div_scale(); + + my $rmode = defined $r[2] ? $r[2] : $self -> round_mode(); + + my $pi; + + if ($n <= 1000) { + + # 75 x 14 = 1050 digits + + my $all_digits = <<EOF; +314159265358979323846264338327950288419716939937510582097494459230781640628 +620899862803482534211706798214808651328230664709384460955058223172535940812 +848111745028410270193852110555964462294895493038196442881097566593344612847 +564823378678316527120190914564856692346034861045432664821339360726024914127 +372458700660631558817488152092096282925409171536436789259036001133053054882 +046652138414695194151160943305727036575959195309218611738193261179310511854 +807446237996274956735188575272489122793818301194912983367336244065664308602 +139494639522473719070217986094370277053921717629317675238467481846766940513 +200056812714526356082778577134275778960917363717872146844090122495343014654 +958537105079227968925892354201995611212902196086403441815981362977477130996 +051870721134999999837297804995105973173281609631859502445945534690830264252 +230825334468503526193118817101000313783875288658753320838142061717766914730 +359825349042875546873115956286388235378759375195778185778053217122680661300 +192787661119590921642019893809525720106548586327886593615338182796823030195 +EOF + + # Should we round up? + + my $round_up; + + # From the string above, we need to extract the number of digits we + # want plus extra characters for the newlines. + + my $nchrs = $n + int($n / 75); + + # Extract the digits we want. + + my $digits = substr($all_digits, 0, $nchrs); + + # Find out whether we should round up or down. Rounding is easy, since + # pi is trancendental. With directed rounding, it doesn't matter what + # the following digits are. With rounding to nearest, we only have to + # look at one extra digit. + + if ($rmode eq 'trunc') { + $round_up = 0; + } else { + my $next_digit = substr($all_digits, $nchrs, 1); + $round_up = $next_digit lt '5' ? 0 : 1; + } + + # Remove the newlines. + + $digits =~ tr/0-9//cd; + + # Now do the rounding. We could easily make the regex substitution + # handle all cases, but we avoid using the regex engine when it is + # simple to avoid it. + + if ($round_up) { + my $last_digit = substr($digits, -1, 1); + if ($last_digit lt '9') { + substr($digits, -1, 1) = ++$last_digit; + } else { + $digits =~ s/([0-8])(9+)$/ ($1 + 1) . ("0" x CORE::length($2)) /e; + } + } + + # Append the exponent and convert to an object. + + $pi = Math::BigFloat -> new($digits . 'e-' . ($n - 1)); + + } else { + + # For large accuracy, the arctan formulas become very inefficient with + # Math::BigFloat, so use Brent-Salamin (aka AGM or Gauss-Legendre). + + # Use a few more digits in the intermediate computations. + $n += 8; + + $HALF = $class -> new($HALF) unless ref($HALF); + my ($an, $bn, $tn, $pn) = ($class -> bone, $HALF -> copy() -> bsqrt($n), + $HALF -> copy() -> bmul($HALF), $class -> bone); + while ($pn < $n) { + my $prev_an = $an -> copy(); + $an -> badd($bn) -> bmul($HALF, $n); + $bn -> bmul($prev_an) -> bsqrt($n); + $prev_an -> bsub($an); + $tn -> bsub($pn * $prev_an * $prev_an); + $pn -> badd($pn); + } + $an -> badd($bn); + $an -> bmul($an, $n) -> bdiv(4 * $tn, $n); + + $an -> round(@r); + $pi = $an; + } + + if (defined $r[0]) { + $pi -> accuracy($r[0]); + } elsif (defined $r[1]) { + $pi -> precision($r[1]); + } + + for my $key (qw/ sign _m _es _e _a _p /) { + $self -> {$key} = $pi -> {$key}; + } + + return $self; +} + +sub copy { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # If called as a class method, the object to copy is the next argument. + + $self = shift() unless $selfref; + + my $copy = bless {}, $class; + + $copy->{sign} = $self->{sign}; + $copy->{_es} = $self->{_es}; + $copy->{_m} = $LIB->_copy($self->{_m}); + $copy->{_e} = $LIB->_copy($self->{_e}); + $copy->{_a} = $self->{_a} if exists $self->{_a}; + $copy->{_p} = $self->{_p} if exists $self->{_p}; + + return $copy; +} + +sub as_number { + # return copy as a bigint representation of this Math::BigFloat number + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x if $x->modify('as_number'); + + if (!$x->isa('Math::BigFloat')) { + # if the object can as_number(), use it + return $x->as_number() if $x->can('as_number'); + # otherwise, get us a float and then a number + $x = $x->can('as_float') ? $x->as_float() : $class->new(0+"$x"); + } + + return Math::BigInt->binf($x->sign()) if $x->is_inf(); + return Math::BigInt->bnan() if $x->is_nan(); + + my $z = $LIB->_copy($x->{_m}); + if ($x->{_es} eq '-') { # < 0 + $z = $LIB->_rsft($z, $x->{_e}, 10); + } elsif (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + $z = Math::BigInt->new($x->{sign} . $LIB->_str($z)); + $z; +} + +############################################################################### +# Boolean methods +############################################################################### + +sub is_zero { + # return true if arg (BFLOAT or num_str) is zero + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + ($x->{sign} eq '+' && $LIB->_is_zero($x->{_m})) ? 1 : 0; +} + +sub is_one { + # return true if arg (BFLOAT or num_str) is +1 or -1 if signis given + my ($class, $x, $sign) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $sign = '+' if !defined $sign || $sign ne '-'; + + ($x->{sign} eq $sign && + $LIB->_is_zero($x->{_e}) && + $LIB->_is_one($x->{_m})) ? 1 : 0; +} + +sub is_odd { + # return true if arg (BFLOAT or num_str) is odd or false if even + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + (($x->{sign} =~ /^[+-]$/) && # NaN & +-inf aren't + ($LIB->_is_zero($x->{_e})) && + ($LIB->_is_odd($x->{_m}))) ? 1 : 0; +} + +sub is_even { + # return true if arg (BINT or num_str) is even or false if odd + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + (($x->{sign} =~ /^[+-]$/) && # NaN & +-inf aren't + ($x->{_es} eq '+') && # 123.45 isn't + ($LIB->_is_even($x->{_m}))) ? 1 : 0; # but 1200 is +} + +sub is_int { + # return true if arg (BFLOAT or num_str) is an integer + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + (($x->{sign} =~ /^[+-]$/) && # NaN and +-inf aren't + ($x->{_es} eq '+')) ? 1 : 0; # 1e-1 => no integer +} + +############################################################################### +# Comparison methods +############################################################################### + +sub bcmp { + # Compares 2 values. Returns one of undef, <0, =0, >0. (suitable for sort) + + # set up parameters + my ($class, $x, $y) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y) = objectify(2, @_); + } + + return $upgrade->bcmp($x, $y) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + # Handle all 'nan' cases. + + return undef if ($x->{sign} eq $nan) || ($y->{sign} eq $nan); + + # Handle all '+inf' and '-inf' cases. + + return 0 if ($x->{sign} eq '+inf' && $y->{sign} eq '+inf' || + $x->{sign} eq '-inf' && $y->{sign} eq '-inf'); + return +1 if $x->{sign} eq '+inf'; # x = +inf and y < +inf + return -1 if $x->{sign} eq '-inf'; # x = -inf and y > -inf + return -1 if $y->{sign} eq '+inf'; # x < +inf and y = +inf + return +1 if $y->{sign} eq '-inf'; # x > -inf and y = -inf + + # Handle all cases with opposite signs. + + return +1 if $x->{sign} eq '+' && $y->{sign} eq '-'; # also does 0 <=> -y + return -1 if $x->{sign} eq '-' && $y->{sign} eq '+'; # also does -x <=> 0 + + # Handle all remaining zero cases. + + my $xz = $x->is_zero(); + my $yz = $y->is_zero(); + return 0 if $xz && $yz; # 0 <=> 0 + return -1 if $xz && $y->{sign} eq '+'; # 0 <=> +y + return +1 if $yz && $x->{sign} eq '+'; # +x <=> 0 + + # Both arguments are now finite, non-zero numbers with the same sign. + + my $cmp; + + # The next step is to compare the exponents, but since each mantissa is an + # integer of arbitrary value, the exponents must be normalized by the length + # of the mantissas before we can compare them. + + my $mxl = $LIB->_len($x->{_m}); + my $myl = $LIB->_len($y->{_m}); + + # If the mantissas have the same length, there is no point in normalizing the + # exponents by the length of the mantissas, so treat that as a special case. + + if ($mxl == $myl) { + + # First handle the two cases where the exponents have different signs. + + if ($x->{_es} eq '+' && $y->{_es} eq '-') { + $cmp = +1; + } elsif ($x->{_es} eq '-' && $y->{_es} eq '+') { + $cmp = -1; + } + + # Then handle the case where the exponents have the same sign. + + else { + $cmp = $LIB->_acmp($x->{_e}, $y->{_e}); + $cmp = -$cmp if $x->{_es} eq '-'; + } + + # Adjust for the sign, which is the same for x and y, and bail out if + # we're done. + + $cmp = -$cmp if $x->{sign} eq '-'; # 124 > 123, but -124 < -123 + return $cmp if $cmp; + + } + + # We must normalize each exponent by the length of the corresponding + # mantissa. Life is a lot easier if we first make both exponents + # non-negative. We do this by adding the same positive value to both + # exponent. This is safe, because when comparing the exponents, only the + # relative difference is important. + + my $ex; + my $ey; + + if ($x->{_es} eq '+') { + + # If the exponent of x is >= 0 and the exponent of y is >= 0, there is no + # need to do anything special. + + if ($y->{_es} eq '+') { + $ex = $LIB->_copy($x->{_e}); + $ey = $LIB->_copy($y->{_e}); + } + + # If the exponent of x is >= 0 and the exponent of y is < 0, add the + # absolute value of the exponent of y to both. + + else { + $ex = $LIB->_copy($x->{_e}); + $ex = $LIB->_add($ex, $y->{_e}); # ex + |ey| + $ey = $LIB->_zero(); # -ex + |ey| = 0 + } + + } else { + + # If the exponent of x is < 0 and the exponent of y is >= 0, add the + # absolute value of the exponent of x to both. + + if ($y->{_es} eq '+') { + $ex = $LIB->_zero(); # -ex + |ex| = 0 + $ey = $LIB->_copy($y->{_e}); + $ey = $LIB->_add($ey, $x->{_e}); # ey + |ex| + } + + # If the exponent of x is < 0 and the exponent of y is < 0, add the + # absolute values of both exponents to both exponents. + + else { + $ex = $LIB->_copy($y->{_e}); # -ex + |ey| + |ex| = |ey| + $ey = $LIB->_copy($x->{_e}); # -ey + |ex| + |ey| = |ex| + } + + } + + # Now we can normalize the exponents by adding lengths of the mantissas. + + $ex = $LIB->_add($ex, $LIB->_new($mxl)); + $ey = $LIB->_add($ey, $LIB->_new($myl)); + + # We're done if the exponents are different. + + $cmp = $LIB->_acmp($ex, $ey); + $cmp = -$cmp if $x->{sign} eq '-'; # 124 > 123, but -124 < -123 + return $cmp if $cmp; + + # Compare the mantissas, but first normalize them by padding the shorter + # mantissa with zeros (shift left) until it has the same length as the longer + # mantissa. + + my $mx = $x->{_m}; + my $my = $y->{_m}; + + if ($mxl > $myl) { + $my = $LIB->_lsft($LIB->_copy($my), $LIB->_new($mxl - $myl), 10); + } elsif ($mxl < $myl) { + $mx = $LIB->_lsft($LIB->_copy($mx), $LIB->_new($myl - $mxl), 10); + } + + $cmp = $LIB->_acmp($mx, $my); + $cmp = -$cmp if $x->{sign} eq '-'; # 124 > 123, but -124 < -123 + return $cmp; + +} + +sub bacmp { + # Compares 2 values, ignoring their signs. + # Returns one of undef, <0, =0, >0. (suitable for sort) + + # set up parameters + my ($class, $x, $y) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y) = objectify(2, @_); + } + + return $upgrade->bacmp($x, $y) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + # handle +-inf and NaN's + if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/) { + return undef if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + return 0 if ($x->is_inf() && $y->is_inf()); + return 1 if ($x->is_inf() && !$y->is_inf()); + return -1; + } + + # shortcut + my $xz = $x->is_zero(); + my $yz = $y->is_zero(); + return 0 if $xz && $yz; # 0 <=> 0 + return -1 if $xz && !$yz; # 0 <=> +y + return 1 if $yz && !$xz; # +x <=> 0 + + # adjust so that exponents are equal + my $lxm = $LIB->_len($x->{_m}); + my $lym = $LIB->_len($y->{_m}); + my ($xes, $yes) = (1, 1); + $xes = -1 if $x->{_es} ne '+'; + $yes = -1 if $y->{_es} ne '+'; + # the numify somewhat limits our length, but makes it much faster + my $lx = $lxm + $xes * $LIB->_num($x->{_e}); + my $ly = $lym + $yes * $LIB->_num($y->{_e}); + my $l = $lx - $ly; + return $l <=> 0 if $l != 0; + + # lengths (corrected by exponent) are equal + # so make mantissa equal-length by padding with zero (shift left) + my $diff = $lxm - $lym; + my $xm = $x->{_m}; # not yet copy it + my $ym = $y->{_m}; + if ($diff > 0) { + $ym = $LIB->_copy($y->{_m}); + $ym = $LIB->_lsft($ym, $LIB->_new($diff), 10); + } elsif ($diff < 0) { + $xm = $LIB->_copy($x->{_m}); + $xm = $LIB->_lsft($xm, $LIB->_new(-$diff), 10); + } + $LIB->_acmp($xm, $ym); +} + +############################################################################### +# Arithmetic methods +############################################################################### + +sub bneg { + # (BINT or num_str) return BINT + # negate number or make a negated number from string + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x if $x->modify('bneg'); + + # for +0 do not negate (to have always normalized +0). Does nothing for 'NaN' + $x->{sign} =~ tr/+-/-+/ unless ($x->{sign} eq '+' && $LIB->_is_zero($x->{_m})); + $x; +} + +sub bnorm { + # adjust m and e so that m is smallest possible + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $zeros = $LIB->_zeros($x->{_m}); # correct for trailing zeros + if ($zeros != 0) { + my $z = $LIB->_new($zeros); + $x->{_m} = $LIB->_rsft($x->{_m}, $z, 10); + if ($x->{_es} eq '-') { + if ($LIB->_acmp($x->{_e}, $z) >= 0) { + $x->{_e} = $LIB->_sub($x->{_e}, $z); + $x->{_es} = '+' if $LIB->_is_zero($x->{_e}); + } else { + $x->{_e} = $LIB->_sub($LIB->_copy($z), $x->{_e}); + $x->{_es} = '+'; + } + } else { + $x->{_e} = $LIB->_add($x->{_e}, $z); + } + } else { + # $x can only be 0Ey if there are no trailing zeros ('0' has 0 trailing + # zeros). So, for something like 0Ey, set y to 1, and -0 => +0 + $x->{sign} = '+', $x->{_es} = '+', $x->{_e} = $LIB->_one() + if $LIB->_is_zero($x->{_m}); + } + + $x; +} + +sub binc { + # increment arg by one + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('binc'); + + if ($x->{_es} eq '-') { + return $x->badd($class->bone(), @r); # digits after dot + } + + if (!$LIB->_is_zero($x->{_e})) # _e == 0 for NaN, inf, -inf + { + # 1e2 => 100, so after the shift below _m has a '0' as last digit + $x->{_m} = $LIB->_lsft($x->{_m}, $x->{_e}, 10); # 1e2 => 100 + $x->{_e} = $LIB->_zero(); # normalize + $x->{_es} = '+'; + # we know that the last digit of $x will be '1' or '9', depending on the + # sign + } + # now $x->{_e} == 0 + if ($x->{sign} eq '+') { + $x->{_m} = $LIB->_inc($x->{_m}); + return $x->bnorm()->bround(@r); + } elsif ($x->{sign} eq '-') { + $x->{_m} = $LIB->_dec($x->{_m}); + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # -1 +1 => -0 => +0 + return $x->bnorm()->bround(@r); + } + # inf, nan handling etc + $x->badd($class->bone(), @r); # badd() does round +} + +sub bdec { + # decrement arg by one + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bdec'); + + if ($x->{_es} eq '-') { + return $x->badd($class->bone('-'), @r); # digits after dot + } + + if (!$LIB->_is_zero($x->{_e})) { + $x->{_m} = $LIB->_lsft($x->{_m}, $x->{_e}, 10); # 1e2 => 100 + $x->{_e} = $LIB->_zero(); # normalize + $x->{_es} = '+'; + } + # now $x->{_e} == 0 + my $zero = $x->is_zero(); + # <= 0 + if (($x->{sign} eq '-') || $zero) { + $x->{_m} = $LIB->_inc($x->{_m}); + $x->{sign} = '-' if $zero; # 0 => 1 => -1 + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # -1 +1 => -0 => +0 + return $x->bnorm()->round(@r); + } + # > 0 + elsif ($x->{sign} eq '+') { + $x->{_m} = $LIB->_dec($x->{_m}); + return $x->bnorm()->round(@r); + } + # inf, nan handling etc + $x->badd($class->bone('-'), @r); # does round +} + +sub badd { + # add second arg (BFLOAT or string) to first (BFLOAT) (modifies first) + # return result as BFLOAT + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('badd'); + + # inf and NaN handling + if (($x->{sign} !~ /^[+-]$/) || ($y->{sign} !~ /^[+-]$/)) { + # NaN first + return $x->bnan() if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + # inf handling + if (($x->{sign} =~ /^[+-]inf$/) && ($y->{sign} =~ /^[+-]inf$/)) { + # +inf++inf or -inf+-inf => same, rest is NaN + return $x if $x->{sign} eq $y->{sign}; + return $x->bnan(); + } + # +-inf + something => +inf; something +-inf => +-inf + $x->{sign} = $y->{sign}, return $x if $y->{sign} =~ /^[+-]inf$/; + return $x; + } + + return $upgrade->badd($x, $y, @r) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + $r[3] = $y; # no push! + + # speed: no add for 0+y or x+0 + return $x->bround(@r) if $y->is_zero(); # x+0 + if ($x->is_zero()) # 0+y + { + # make copy, clobbering up x (modify in place!) + $x->{_e} = $LIB->_copy($y->{_e}); + $x->{_es} = $y->{_es}; + $x->{_m} = $LIB->_copy($y->{_m}); + $x->{sign} = $y->{sign} || $nan; + return $x->round(@r); + } + + # take lower of the two e's and adapt m1 to it to match m2 + my $e = $y->{_e}; + $e = $LIB->_zero() if !defined $e; # if no BFLOAT? + $e = $LIB->_copy($e); # make copy (didn't do it yet) + + my $es; + + ($e, $es) = _e_sub($e, $x->{_e}, $y->{_es} || '+', $x->{_es}); + + my $add = $LIB->_copy($y->{_m}); + + if ($es eq '-') # < 0 + { + $x->{_m} = $LIB->_lsft($x->{_m}, $e, 10); + ($x->{_e}, $x->{_es}) = _e_add($x->{_e}, $e, $x->{_es}, $es); + } elsif (!$LIB->_is_zero($e)) # > 0 + { + $add = $LIB->_lsft($add, $e, 10); + } + # else: both e are the same, so just leave them + + if ($x->{sign} eq $y->{sign}) { + # add + $x->{_m} = $LIB->_add($x->{_m}, $add); + } else { + ($x->{_m}, $x->{sign}) = + _e_add($x->{_m}, $add, $x->{sign}, $y->{sign}); + } + + # delete trailing zeros, then round + $x->bnorm()->round(@r); +} + +sub bsub { + # (BINT or num_str, BINT or num_str) return BINT + # subtract second arg from first, modify first + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('bsub'); + + return $upgrade -> new($x) -> bsub($upgrade -> new($y), @r) + if defined $upgrade && (!$x -> isa($class) || !$y -> isa($class)); + + return $x -> round(@r) if $y -> is_zero(); + + # To correctly handle the lone special case $x -> bsub($x), we note the + # sign of $x, then flip the sign from $y, and if the sign of $x did change, + # too, then we caught the special case: + + my $xsign = $x -> {sign}; + $y -> {sign} =~ tr/+-/-+/; # does nothing for NaN + if ($xsign ne $x -> {sign}) { + # special case of $x -> bsub($x) results in 0 + return $x -> bzero(@r) if $xsign =~ /^[+-]$/; + return $x -> bnan(); # NaN, -inf, +inf + } + $x -> badd($y, @r); # badd does not leave internal zeros + $y -> {sign} =~ tr/+-/-+/; # refix $y (does nothing for NaN) + $x; # already rounded by badd() or no rounding +} + +sub bmul { + # multiply two numbers + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bmul'); + + return $x->bnan() if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + + # inf handling + if (($x->{sign} =~ /^[+-]inf$/) || ($y->{sign} =~ /^[+-]inf$/)) { + return $x->bnan() if $x->is_zero() || $y->is_zero(); + # result will always be +-inf: + # +inf * +/+inf => +inf, -inf * -/-inf => +inf + # +inf * -/-inf => -inf, -inf * +/+inf => -inf + return $x->binf() if ($x->{sign} =~ /^\+/ && $y->{sign} =~ /^\+/); + return $x->binf() if ($x->{sign} =~ /^-/ && $y->{sign} =~ /^-/); + return $x->binf('-'); + } + + return $upgrade->bmul($x, $y, @r) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + # aEb * cEd = (a*c)E(b+d) + $x->{_m} = $LIB->_mul($x->{_m}, $y->{_m}); + ($x->{_e}, $x->{_es}) = _e_add($x->{_e}, $y->{_e}, $x->{_es}, $y->{_es}); + + $r[3] = $y; # no push! + + # adjust sign: + $x->{sign} = $x->{sign} ne $y->{sign} ? '-' : '+'; + $x->bnorm->round(@r); +} + +sub bmuladd { + # multiply two numbers and add the third to the result + + # set up parameters + my ($class, $x, $y, $z, @r) = objectify(3, @_); + + return $x if $x->modify('bmuladd'); + + return $x->bnan() if (($x->{sign} eq $nan) || + ($y->{sign} eq $nan) || + ($z->{sign} eq $nan)); + + # inf handling + if (($x->{sign} =~ /^[+-]inf$/) || ($y->{sign} =~ /^[+-]inf$/)) { + return $x->bnan() if $x->is_zero() || $y->is_zero(); + # result will always be +-inf: + # +inf * +/+inf => +inf, -inf * -/-inf => +inf + # +inf * -/-inf => -inf, -inf * +/+inf => -inf + return $x->binf() if ($x->{sign} =~ /^\+/ && $y->{sign} =~ /^\+/); + return $x->binf() if ($x->{sign} =~ /^-/ && $y->{sign} =~ /^-/); + return $x->binf('-'); + } + + return $upgrade->bmul($x, $y, @r) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + # aEb * cEd = (a*c)E(b+d) + $x->{_m} = $LIB->_mul($x->{_m}, $y->{_m}); + ($x->{_e}, $x->{_es}) = _e_add($x->{_e}, $y->{_e}, $x->{_es}, $y->{_es}); + + $r[3] = $y; # no push! + + # adjust sign: + $x->{sign} = $x->{sign} ne $y->{sign} ? '-' : '+'; + + # z=inf handling (z=NaN handled above) + $x->{sign} = $z->{sign}, return $x if $z->{sign} =~ /^[+-]inf$/; + + # take lower of the two e's and adapt m1 to it to match m2 + my $e = $z->{_e}; + $e = $LIB->_zero() if !defined $e; # if no BFLOAT? + $e = $LIB->_copy($e); # make copy (didn't do it yet) + + my $es; + + ($e, $es) = _e_sub($e, $x->{_e}, $z->{_es} || '+', $x->{_es}); + + my $add = $LIB->_copy($z->{_m}); + + if ($es eq '-') # < 0 + { + $x->{_m} = $LIB->_lsft($x->{_m}, $e, 10); + ($x->{_e}, $x->{_es}) = _e_add($x->{_e}, $e, $x->{_es}, $es); + } elsif (!$LIB->_is_zero($e)) # > 0 + { + $add = $LIB->_lsft($add, $e, 10); + } + # else: both e are the same, so just leave them + + if ($x->{sign} eq $z->{sign}) { + # add + $x->{_m} = $LIB->_add($x->{_m}, $add); + } else { + ($x->{_m}, $x->{sign}) = + _e_add($x->{_m}, $add, $x->{sign}, $z->{sign}); + } + + # delete trailing zeros, then round + $x->bnorm()->round(@r); +} + +sub bdiv { + # (dividend: BFLOAT or num_str, divisor: BFLOAT or num_str) return + # (BFLOAT, BFLOAT) (quo, rem) or BFLOAT (only quo) + + # set up parameters + my ($class, $x, $y, $a, $p, $r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x->modify('bdiv'); + + my $wantarray = wantarray; # call only once + + # At least one argument is NaN. This is handled the same way as in + # Math::BigInt -> bdiv(). + + if ($x -> is_nan() || $y -> is_nan()) { + return $wantarray ? ($x -> bnan(), $class -> bnan()) : $x -> bnan(); + } + + # Divide by zero and modulo zero. This is handled the same way as in + # Math::BigInt -> bdiv(). See the comment in the code for Math::BigInt -> + # bdiv() for further details. + + if ($y -> is_zero()) { + my ($quo, $rem); + if ($wantarray) { + $rem = $x -> copy(); + } + if ($x -> is_zero()) { + $quo = $x -> bnan(); + } else { + $quo = $x -> binf($x -> {sign}); + } + return $wantarray ? ($quo, $rem) : $quo; + } + + # Numerator (dividend) is +/-inf. This is handled the same way as in + # Math::BigInt -> bdiv(). See the comment in the code for Math::BigInt -> + # bdiv() for further details. + + if ($x -> is_inf()) { + my ($quo, $rem); + $rem = $class -> bnan() if $wantarray; + if ($y -> is_inf()) { + $quo = $x -> bnan(); + } else { + my $sign = $x -> bcmp(0) == $y -> bcmp(0) ? '+' : '-'; + $quo = $x -> binf($sign); + } + return $wantarray ? ($quo, $rem) : $quo; + } + + # Denominator (divisor) is +/-inf. This is handled the same way as in + # Math::BigInt -> bdiv(), with one exception: In scalar context, + # Math::BigFloat does true division (although rounded), not floored division + # (F-division), so a finite number divided by +/-inf is always zero. See the + # comment in the code for Math::BigInt -> bdiv() for further details. + + if ($y -> is_inf()) { + my ($quo, $rem); + if ($wantarray) { + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + $rem = $x -> copy(); + $quo = $x -> bzero(); + } else { + $rem = $class -> binf($y -> {sign}); + $quo = $x -> bone('-'); + } + return ($quo, $rem); + } else { + if ($y -> is_inf()) { + if ($x -> is_nan() || $x -> is_inf()) { + return $x -> bnan(); + } else { + return $x -> bzero(); + } + } + } + } + + # At this point, both the numerator and denominator are finite numbers, and + # the denominator (divisor) is non-zero. + + # x == 0? + return wantarray ? ($x, $class->bzero()) : $x if $x->is_zero(); + + # upgrade ? + return $upgrade->bdiv($upgrade->new($x), $y, $a, $p, $r) if defined $upgrade; + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my (@params, $scale); + ($x, @params) = $x->_find_round_parameters($a, $p, $r, $y); + + return $x if $x->is_nan(); # error in _find_round_parameters? + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + my $rem; + $rem = $class -> bzero() if wantarray; + + $y = $class->new($y) unless $y->isa('Math::BigFloat'); + + my $lx = $LIB -> _len($x->{_m}); my $ly = $LIB -> _len($y->{_m}); + $scale = $lx if $lx > $scale; + $scale = $ly if $ly > $scale; + my $diff = $ly - $lx; + $scale += $diff if $diff > 0; # if lx << ly, but not if ly << lx! + + # check that $y is not 1 nor -1 and cache the result: + my $y_not_one = !($LIB->_is_zero($y->{_e}) && $LIB->_is_one($y->{_m})); + + # flipping the sign of $y will also flip the sign of $x for the special + # case of $x->bsub($x); so we can catch it below: + my $xsign = $x->{sign}; + $y->{sign} =~ tr/+-/-+/; + + if ($xsign ne $x->{sign}) { + # special case of $x /= $x results in 1 + $x->bone(); # "fixes" also sign of $y, since $x is $y + } else { + # correct $y's sign again + $y->{sign} =~ tr/+-/-+/; + # continue with normal div code: + + # make copy of $x in case of list context for later remainder calculation + if (wantarray && $y_not_one) { + $rem = $x->copy(); + } + + $x->{sign} = $x->{sign} ne $y->sign() ? '-' : '+'; + + # check for / +-1 (+/- 1E0) + if ($y_not_one) { + # promote BigInts and it's subclasses (except when already a Math::BigFloat) + $y = $class->new($y) unless $y->isa('Math::BigFloat'); + + # calculate the result to $scale digits and then round it + # a * 10 ** b / c * 10 ** d => a/c * 10 ** (b-d) + $x->{_m} = $LIB->_lsft($x->{_m}, $LIB->_new($scale), 10); + $x->{_m} = $LIB->_div($x->{_m}, $y->{_m}); # a/c + + # correct exponent of $x + ($x->{_e}, $x->{_es}) = _e_sub($x->{_e}, $y->{_e}, $x->{_es}, $y->{_es}); + # correct for 10**scale + ($x->{_e}, $x->{_es}) = _e_sub($x->{_e}, $LIB->_new($scale), $x->{_es}, '+'); + $x->bnorm(); # remove trailing 0's + } + } # end else $x != $y + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + delete $x->{_a}; # clear before round + $x->bround($params[0], $params[2]); # then round accordingly + } else { + delete $x->{_p}; # clear before round + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; delete $x->{_p}; + } + + if (wantarray) { + if ($y_not_one) { + $x -> bfloor(); + $rem->bmod($y, @params); # copy already done + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $rem->{_a}; delete $rem->{_p}; + } + return ($x, $rem); + } + $x; +} + +sub bmod { + # (dividend: BFLOAT or num_str, divisor: BFLOAT or num_str) return remainder + + # set up parameters + my ($class, $x, $y, $a, $p, $r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x->modify('bmod'); + + # At least one argument is NaN. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($x -> is_nan() || $y -> is_nan()) { + return $x -> bnan(); + } + + # Modulo zero. This is handled the same way as in Math::BigInt -> bmod(). + + if ($y -> is_zero()) { + return $x; + } + + # Numerator (dividend) is +/-inf. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($x -> is_inf()) { + return $x -> bnan(); + } + + # Denominator (divisor) is +/-inf. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($y -> is_inf()) { + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + return $x; + } else { + return $x -> binf($y -> sign()); + } + } + + return $x->bzero() if $x->is_zero() + || ($x->is_int() && + # check that $y == +1 or $y == -1: + ($LIB->_is_zero($y->{_e}) && $LIB->_is_one($y->{_m}))); + + my $cmp = $x->bacmp($y); # equal or $x < $y? + if ($cmp == 0) { # $x == $y => result 0 + return $x -> bzero($a, $p); + } + + # only $y of the operands negative? + my $neg = $x->{sign} ne $y->{sign} ? 1 : 0; + + $x->{sign} = $y->{sign}; # calc sign first + if ($cmp < 0 && $neg == 0) { # $x < $y => result $x + return $x -> round($a, $p, $r); + } + + my $ym = $LIB->_copy($y->{_m}); + + # 2e1 => 20 + $ym = $LIB->_lsft($ym, $y->{_e}, 10) + if $y->{_es} eq '+' && !$LIB->_is_zero($y->{_e}); + + # if $y has digits after dot + my $shifty = 0; # correct _e of $x by this + if ($y->{_es} eq '-') # has digits after dot + { + # 123 % 2.5 => 1230 % 25 => 5 => 0.5 + $shifty = $LIB->_num($y->{_e}); # no more digits after dot + $x->{_m} = $LIB->_lsft($x->{_m}, $y->{_e}, 10); # 123 => 1230, $y->{_m} is already 25 + } + # $ym is now mantissa of $y based on exponent 0 + + my $shiftx = 0; # correct _e of $x by this + if ($x->{_es} eq '-') # has digits after dot + { + # 123.4 % 20 => 1234 % 200 + $shiftx = $LIB->_num($x->{_e}); # no more digits after dot + $ym = $LIB->_lsft($ym, $x->{_e}, 10); # 123 => 1230 + } + # 123e1 % 20 => 1230 % 20 + if ($x->{_es} eq '+' && !$LIB->_is_zero($x->{_e})) { + $x->{_m} = $LIB->_lsft($x->{_m}, $x->{_e}, 10); # es => '+' here + } + + $x->{_e} = $LIB->_new($shiftx); + $x->{_es} = '+'; + $x->{_es} = '-' if $shiftx != 0 || $shifty != 0; + $x->{_e} = $LIB->_add($x->{_e}, $LIB->_new($shifty)) if $shifty != 0; + + # now mantissas are equalized, exponent of $x is adjusted, so calc result + + $x->{_m} = $LIB->_mod($x->{_m}, $ym); + + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # fix sign for -0 + $x->bnorm(); + + if ($neg != 0 && ! $x -> is_zero()) # one of them negative => correct in place + { + my $r = $y - $x; + $x->{_m} = $r->{_m}; + $x->{_e} = $r->{_e}; + $x->{_es} = $r->{_es}; + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # fix sign for -0 + $x->bnorm(); + } + + $x->round($a, $p, $r, $y); # round and return +} + +sub bmodpow { + # takes a very large number to a very large exponent in a given very + # large modulus, quickly, thanks to binary exponentiation. Supports + # negative exponents. + my ($class, $num, $exp, $mod) = objectify(3, @_); + + return $num if $num->modify('bmodpow'); + + # check modulus for valid values + return $num->bnan() if ($mod->{sign} ne '+' # NaN, -, -inf, +inf + || $mod->is_zero()); + + # check exponent for valid values + if ($exp->{sign} =~ /\w/) { + # i.e., if it's NaN, +inf, or -inf... + return $num->bnan(); + } + + $num->bmodinv ($mod) if ($exp->{sign} eq '-'); + + # check num for valid values (also NaN if there was no inverse but $exp < 0) + return $num->bnan() if $num->{sign} !~ /^[+-]$/; + + # $mod is positive, sign on $exp is ignored, result also positive + + # XXX TODO: speed it up when all three numbers are integers + $num->bpow($exp)->bmod($mod); +} + +sub bpow { + # (BFLOAT or num_str, BFLOAT or num_str) return BFLOAT + # compute power of two numbers, second arg is used as integer + # modifies first argument + + # set up parameters + my ($class, $x, $y, $a, $p, $r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x->modify('bpow'); + + # $x and/or $y is a NaN + return $x->bnan() if $x->is_nan() || $y->is_nan(); + + # $x and/or $y is a +/-Inf + if ($x->is_inf("-")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x if $y->is_odd(); + return $x->bneg(); + } elsif ($x->is_inf("+")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x; + } elsif ($y->is_inf("-")) { + return $x->bnan() if $x -> is_one("-"); + return $x->binf("+") if $x > -1 && $x < 1; + return $x->bone() if $x -> is_one("+"); + return $x->bzero(); + } elsif ($y->is_inf("+")) { + return $x->bnan() if $x -> is_one("-"); + return $x->bzero() if $x > -1 && $x < 1; + return $x->bone() if $x -> is_one("+"); + return $x->binf("+"); + } + + # we don't support complex numbers, so return NaN + return $x->bnan() if $x->is_negative() && !$y->is_int(); + + # cache the result of is_zero + my $y_is_zero = $y->is_zero(); + return $x->bone() if $y_is_zero; + return $x if $x->is_one() || $y->is_one(); + + my $x_is_zero = $x->is_zero(); + return $x->_pow($y, $a, $p, $r) if !$x_is_zero && !$y->is_int(); + + my $y1 = $y->as_number()->{value}; # make MBI part + + if ($x->is_one("-")) { + # if $x == -1 and odd/even y => +1/-1 because +-1 ^ (+-1) => +-1 + return $LIB->_is_odd($y1) ? $x : $x->babs(1); + } + if ($x_is_zero) { + return $x if $y->{sign} eq '+'; # 0**y => 0 (if not y <= 0) + # 0 ** -y => 1 / (0 ** y) => 1 / 0! (1 / 0 => +inf) + return $x->binf(); + } + + my $new_sign = '+'; + $new_sign = $LIB->_is_odd($y1) ? '-' : '+' if $x->{sign} ne '+'; + + # calculate $x->{_m} ** $y and $x->{_e} * $y separately (faster) + $x->{_m} = $LIB->_pow($x->{_m}, $y1); + $x->{_e} = $LIB->_mul ($x->{_e}, $y1); + + $x->{sign} = $new_sign; + $x->bnorm(); + if ($y->{sign} eq '-') { + # modify $x in place! + my $z = $x->copy(); $x->bone(); + return scalar $x->bdiv($z, $a, $p, $r); # round in one go (might ignore y's A!) + } + $x->round($a, $p, $r, $y); +} + +sub blog { + # Return the logarithm of the operand. If a second operand is defined, that + # value is used as the base, otherwise the base is assumed to be Euler's + # constant. + + my ($class, $x, $base, $a, $p, $r); + + # Don't objectify the base, since an undefined base, as in $x->blog() or + # $x->blog(undef) signals that the base is Euler's number. + + if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { + # E.g., Math::BigFloat->blog(256, 2) + ($class, $x, $base, $a, $p, $r) = + defined $_[2] ? objectify(2, @_) : objectify(1, @_); + } else { + # E.g., Math::BigFloat::blog(256, 2) or $x->blog(2) + ($class, $x, $base, $a, $p, $r) = + defined $_[1] ? objectify(2, @_) : objectify(1, @_); + } + + return $x if $x->modify('blog'); + + return $x -> bnan() if $x -> is_nan(); + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters($a, $p, $r); + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # P = undef + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + my $done = 0; + if (defined $base) { + $base = $class -> new($base) unless ref $base; + if ($base -> is_nan() || $base -> is_one()) { + $x -> bnan(); + $done = 1; + } elsif ($base -> is_inf() || $base -> is_zero()) { + if ($x -> is_inf() || $x -> is_zero()) { + $x -> bnan(); + } else { + $x -> bzero(@params); + } + $done = 1; + } elsif ($base -> is_negative()) { # -inf < base < 0 + if ($x -> is_one()) { # x = 1 + $x -> bzero(@params); + } elsif ($x == $base) { + $x -> bone('+', @params); # x = base + } else { + $x -> bnan(); # otherwise + } + $done = 1; + } elsif ($x == $base) { + $x -> bone('+', @params); # 0 < base && 0 < x < inf + $done = 1; + } + } + + # We now know that the base is either undefined or positive and finite. + + unless ($done) { + if ($x -> is_inf()) { # x = +/-inf + my $sign = defined $base && $base < 1 ? '-' : '+'; + $x -> binf($sign); + $done = 1; + } elsif ($x -> is_neg()) { # -inf < x < 0 + $x -> bnan(); + $done = 1; + } elsif ($x -> is_one()) { # x = 1 + $x -> bzero(@params); + $done = 1; + } elsif ($x -> is_zero()) { # x = 0 + my $sign = defined $base && $base < 1 ? '+' : '-'; + $x -> binf($sign); + $done = 1; + } + } + + if ($done) { + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + return $x; + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; + local $Math::BigFloat::downgrade = undef; + + # upgrade $x if $x is not a Math::BigFloat (handle BigInt input) + # XXX TODO: rebless! + if (!$x->isa('Math::BigFloat')) { + $x = Math::BigFloat->new($x); + $class = ref($x); + } + + $done = 0; + + # If the base is defined and an integer, try to calculate integer result + # first. This is very fast, and in case the real result was found, we can + # stop right here. + if (defined $base && $base->is_int() && $x->is_int()) { + my $xint = Math::BigInt -> new($x -> bdstr()); + my $bint = Math::BigInt -> new($base -> bdstr()); + $xint->blog($bint); + + # if we found the exact result, we're done + if ($bint -> bpow($xint) == $x) { + my $xflt = Math::BigFloat -> new($xint -> bdstr()); + $x->{sign} = $xflt->{sign}; + $x->{_m} = $xflt->{_m}; + $x->{_es} = $xflt->{_es}; + $x->{_e} = $xflt->{_e}; + $done = 1; + } + } + + if ($done == 0) { + # First calculate the log to base e (using reduction by 10 and possibly + # also by 2): + $x->_log_10($scale); + + # and if a different base was requested, convert it + if (defined $base) { + $base = Math::BigFloat->new($base) + unless $base->isa('Math::BigFloat'); + # log_b(x) = ln(x) / ln(b), so compute ln(b) + my $base_log_e = $base->copy()->_log_10($scale); + $x->bdiv($base_log_e, $scale); + } + } + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + + $x; +} + +sub bexp { + # Calculate e ** X (Euler's number to the power of X) + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bexp'); + + return $x->binf() if $x->{sign} eq '+inf'; + return $x->bzero() if $x->{sign} eq '-inf'; + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters($a, $p, $r); + + # also takes care of the "error in _find_round_parameters?" case + return $x if $x->{sign} eq 'NaN'; + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # P = undef + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it's not + # enough ... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + return $x->bone(@params) if $x->is_zero(); + + if (!$x->isa('Math::BigFloat')) { + $x = Math::BigFloat->new($x); + $class = ref($x); + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; + delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; + local $Math::BigFloat::downgrade = undef; + + my $x_org = $x->copy(); + + # We use the following Taylor series: + + # x x^2 x^3 x^4 + # e = 1 + --- + --- + --- + --- ... + # 1! 2! 3! 4! + + # The difference for each term is X and N, which would result in: + # 2 copy, 2 mul, 2 add, 1 inc, 1 div operations per term + + # But it is faster to compute exp(1) and then raising it to the + # given power, esp. if $x is really big and an integer because: + + # * The numerator is always 1, making the computation faster + # * the series converges faster in the case of x == 1 + # * We can also easily check when we have reached our limit: when the + # term to be added is smaller than "1E$scale", we can stop - f.i. + # scale == 5, and we have 1/40320, then we stop since 1/40320 < 1E-5. + # * we can compute the *exact* result by simulating bigrat math: + + # 1 1 gcd(3, 4) = 1 1*24 + 1*6 5 + # - + - = ---------- = -- + # 6 24 6*24 24 + + # We do not compute the gcd() here, but simple do: + # 1 1 1*24 + 1*6 30 + # - + - = --------- = -- + # 6 24 6*24 144 + + # In general: + # a c a*d + c*b and note that c is always 1 and d = (b*f) + # - + - = --------- + # b d b*d + + # This leads to: which can be reduced by b to: + # a 1 a*b*f + b a*f + 1 + # - + - = --------- = ------- + # b b*f b*b*f b*f + + # The first terms in the series are: + + # 1 1 1 1 1 1 1 1 13700 + # -- + -- + -- + -- + -- + --- + --- + ---- = ----- + # 1 1 2 6 24 120 720 5040 5040 + + # Note that we cannot simply reduce 13700/5040 to 685/252, but must keep + # the numerator and the denominator! + + if ($scale <= 75) { + # set $x directly from a cached string form + $x->{_m} = $LIB->_new("2718281828459045235360287471352662497757" . + "2470936999595749669676277240766303535476"); + $x->{sign} = '+'; + $x->{_es} = '-'; + $x->{_e} = $LIB->_new(79); + } else { + # compute A and B so that e = A / B. + + # After some terms we end up with this, so we use it as a starting point: + my $A = $LIB->_new("9093339520860578540197197" . + "0164779391644753259799242"); + my $F = $LIB->_new(42); + my $step = 42; + + # Compute how many steps we need to take to get $A and $B sufficiently big + my $steps = _len_to_steps($scale - 4); + # print STDERR "# Doing $steps steps for ", $scale-4, " digits\n"; + while ($step++ <= $steps) { + # calculate $a * $f + 1 + $A = $LIB->_mul($A, $F); + $A = $LIB->_inc($A); + # increment f + $F = $LIB->_inc($F); + } + # compute $B as factorial of $steps (this is faster than doing it manually) + my $B = $LIB->_fac($LIB->_new($steps)); + + # print "A ", $LIB->_str($A), "\nB ", $LIB->_str($B), "\n"; + + # compute A/B with $scale digits in the result (truncate, not round) + $A = $LIB->_lsft($A, $LIB->_new($scale), 10); + $A = $LIB->_div($A, $B); + + $x->{_m} = $A; + $x->{sign} = '+'; + $x->{_es} = '-'; + $x->{_e} = $LIB->_new($scale); + } + + # $x contains now an estimate of e, with some surplus digits, so we can round + if (!$x_org->is_one()) { + # Reduce size of fractional part, followup with integer power of two. + my $lshift = 0; + while ($lshift < 30 && $x_org->bacmp(2 << $lshift) > 0) { + $lshift++; + } + # Raise $x to the wanted power and round it. + if ($lshift == 0) { + $x->bpow($x_org, @params); + } else { + my($mul, $rescale) = (1 << $lshift, $scale+1+$lshift); + $x->bpow(scalar $x_org->bdiv($mul, $rescale), $rescale)->bpow($mul, @params); + } + } else { + # else just round the already computed result + delete $x->{_a}; + delete $x->{_p}; + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + + $x; # return modified $x +} + +sub bnok { + # Calculate n over k (binomial coefficient or "choose" function) as integer. + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bnok'); + + return $x->bnan() if $x->is_nan() || $y->is_nan(); + return $x->bnan() if (($x->is_finite() && !$x->is_int()) || + ($y->is_finite() && !$y->is_int())); + + my $xint = Math::BigInt -> new($x -> bsstr()); + my $yint = Math::BigInt -> new($y -> bsstr()); + $xint -> bnok($yint); + my $xflt = Math::BigFloat -> new($xint); + + $x->{_m} = $xflt->{_m}; + $x->{_e} = $xflt->{_e}; + $x->{_es} = $xflt->{_es}; + $x->{sign} = $xflt->{sign}; + + return $x; +} + +sub bsin { + # Calculate a sinus of x. + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + # taylor: x^3 x^5 x^7 x^9 + # sin = x - --- + --- - --- + --- ... + # 3! 5! 7! 9! + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters(@r); + + # constant object or error in _find_round_parameters? + return $x if $x->modify('bsin') || $x->is_nan(); + + return $x->bzero(@r) if $x->is_zero(); + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # disable P + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; + delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; + + my $over = $x * $x; # X ^ 2 + my $x2 = $over->copy(); # X ^ 2; difference between terms + $over->bmul($x); # X ^ 3 as starting value + my $sign = 1; # start with -= + my $below = $class->new(6); my $factorial = $class->new(4); + delete $x->{_a}; + delete $x->{_p}; + + my $limit = $class->new("1E-". ($scale-1)); + #my $steps = 0; + while (3 < 5) { + # we calculate the next term, and add it to the last + # when the next term is below our limit, it won't affect the outcome + # anymore, so we stop: + my $next = $over->copy()->bdiv($below, $scale); + last if $next->bacmp($limit) <= 0; + + if ($sign == 0) { + $x->badd($next); + } else { + $x->bsub($next); + } + $sign = 1-$sign; # alternate + # calculate things for the next term + $over->bmul($x2); # $x*$x + $below->bmul($factorial); $factorial->binc(); # n*(n+1) + $below->bmul($factorial); $factorial->binc(); # n*(n+1) + } + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + $x; +} + +sub bcos { + # Calculate a cosinus of x. + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + # Taylor: x^2 x^4 x^6 x^8 + # cos = 1 - --- + --- - --- + --- ... + # 2! 4! 6! 8! + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters(@r); + + # constant object or error in _find_round_parameters? + return $x if $x->modify('bcos') || $x->is_nan(); + + return $x->bone(@r) if $x->is_zero(); + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # disable P + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; + + my $over = $x * $x; # X ^ 2 + my $x2 = $over->copy(); # X ^ 2; difference between terms + my $sign = 1; # start with -= + my $below = $class->new(2); + my $factorial = $class->new(3); + $x->bone(); + delete $x->{_a}; + delete $x->{_p}; + + my $limit = $class->new("1E-". ($scale-1)); + #my $steps = 0; + while (3 < 5) { + # we calculate the next term, and add it to the last + # when the next term is below our limit, it won't affect the outcome + # anymore, so we stop: + my $next = $over->copy()->bdiv($below, $scale); + last if $next->bacmp($limit) <= 0; + + if ($sign == 0) { + $x->badd($next); + } else { + $x->bsub($next); + } + $sign = 1-$sign; # alternate + # calculate things for the next term + $over->bmul($x2); # $x*$x + $below->bmul($factorial); $factorial->binc(); # n*(n+1) + $below->bmul($factorial); $factorial->binc(); # n*(n+1) + } + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + $x; +} + +sub batan { + # Calculate a arcus tangens of x. + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + my (@r) = @_; + + # taylor: x^3 x^5 x^7 x^9 + # atan = x - --- + --- - --- + --- ... + # 3 5 7 9 + + # We need to limit the accuracy to protect against overflow. + + my $fallback = 0; + my ($scale, @params); + ($self, @params) = $self->_find_round_parameters(@r); + + # Constant object or error in _find_round_parameters? + + return $self if $self->modify('batan') || $self->is_nan(); + + if ($self->{sign} =~ /^[+-]inf\z/) { + # +inf result is PI/2 + # -inf result is -PI/2 + # calculate PI/2 + my $pi = $class->bpi(@r); + # modify $self in place + $self->{_m} = $pi->{_m}; + $self->{_e} = $pi->{_e}; + $self->{_es} = $pi->{_es}; + # -y => -PI/2, +y => PI/2 + $self->{sign} = substr($self->{sign}, 0, 1); # "+inf" => "+" + $self -> {_m} = $LIB->_div($self->{_m}, $LIB->_new(2)); + return $self; + } + + return $self->bzero(@r) if $self->is_zero(); + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # disable P + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # 1 or -1 => PI/4 + # inlined is_one() && is_one('-') + if ($LIB->_is_one($self->{_m}) && $LIB->_is_zero($self->{_e})) { + my $pi = $class->bpi($scale - 3); + # modify $self in place + $self->{_m} = $pi->{_m}; + $self->{_e} = $pi->{_e}; + $self->{_es} = $pi->{_es}; + # leave the sign of $self alone (+1 => +PI/4, -1 => -PI/4) + $self->{_m} = $LIB->_div($self->{_m}, $LIB->_new(4)); + return $self; + } + + # This series is only valid if -1 < x < 1, so for other x we need to + # calculate PI/2 - atan(1/x): + my $pi = undef; + if ($self->bacmp($self->copy()->bone) >= 0) { + # calculate PI/2 + $pi = $class->bpi($scale - 3); + $pi->{_m} = $LIB->_div($pi->{_m}, $LIB->_new(2)); + # calculate 1/$self: + my $self_copy = $self->copy(); + # modify $self in place + $self->bone(); + $self->bdiv($self_copy, $scale); + } + + my $fmul = 1; + foreach (0 .. int($scale / 20)) { + $fmul *= 2; + $self->bdiv($self->copy()->bmul($self)->binc->bsqrt($scale + 4)->binc, $scale + 4); + } + + # When user set globals, they would interfere with our calculation, so + # disable them and later re-enable them. + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # We also need to disable any set A or P on $self (_find_round_parameters + # took them already into account), since these would interfere, too + delete $self->{_a}; + delete $self->{_p}; + # Need to disable $upgrade in BigInt, to avoid deep recursion. + local $Math::BigInt::upgrade = undef; + + my $over = $self * $self; # X ^ 2 + my $self2 = $over->copy(); # X ^ 2; difference between terms + $over->bmul($self); # X ^ 3 as starting value + my $sign = 1; # start with -= + my $below = $class->new(3); + my $two = $class->new(2); + delete $self->{_a}; + delete $self->{_p}; + + my $limit = $class->new("1E-". ($scale-1)); + #my $steps = 0; + while (1) { + # We calculate the next term, and add it to the last. When the next + # term is below our limit, it won't affect the outcome anymore, so we + # stop: + my $next = $over->copy()->bdiv($below, $scale); + last if $next->bacmp($limit) <= 0; + + if ($sign == 0) { + $self->badd($next); + } else { + $self->bsub($next); + } + $sign = 1-$sign; # alternatex + # calculate things for the next term + $over->bmul($self2); # $self*$self + $below->badd($two); # n += 2 + } + $self->bmul($fmul); + + if (defined $pi) { + my $self_copy = $self->copy(); + # modify $self in place + $self->{_m} = $pi->{_m}; + $self->{_e} = $pi->{_e}; + $self->{_es} = $pi->{_es}; + # PI/2 - $self + $self->bsub($self_copy); + } + + # Shortcut to not run through _find_round_parameters again. + if (defined $params[0]) { + $self->bround($params[0], $params[2]); # then round accordingly + } else { + $self->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # Clear a/p after round, since user did not request it. + delete $self->{_a}; + delete $self->{_p}; + } + + # restore globals + $$abr = $ab; + $$pbr = $pb; + $self; +} + +sub batan2 { + # $y -> batan2($x) returns the arcus tangens of $y / $x. + + # Set up parameters. + my ($class, $y, $x, @r) = (ref($_[0]), @_); + + # Objectify is costly, so avoid it if we can. + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $y, $x, @r) = objectify(2, @_); + } + + # Quick exit if $y is read-only. + return $y if $y -> modify('batan2'); + + # Handle all NaN cases. + return $y -> bnan() if $x->{sign} eq $nan || $y->{sign} eq $nan; + + # We need to limit the accuracy to protect against overflow. + my $fallback = 0; + my ($scale, @params); + ($y, @params) = $y -> _find_round_parameters(@r); + + # Error in _find_round_parameters? + return $y if $y->is_nan(); + + # No rounding at all, so must use fallback. + if (scalar @params == 0) { + # Simulate old behaviour + $params[0] = $class -> div_scale(); # and round to it as accuracy + $params[1] = undef; # disable P + $scale = $params[0] + 4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # The 4 below is empirical, and there might be cases where it is not + # enough ... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + if ($x -> is_inf("+")) { # x = inf + if ($y -> is_inf("+")) { # y = inf + $y -> bpi($scale) -> bmul("0.25"); # pi/4 + } elsif ($y -> is_inf("-")) { # y = -inf + $y -> bpi($scale) -> bmul("-0.25"); # -pi/4 + } else { # -inf < y < inf + return $y -> bzero(@r); # 0 + } + } elsif ($x -> is_inf("-")) { # x = -inf + if ($y -> is_inf("+")) { # y = inf + $y -> bpi($scale) -> bmul("0.75"); # 3/4 pi + } elsif ($y -> is_inf("-")) { # y = -inf + $y -> bpi($scale) -> bmul("-0.75"); # -3/4 pi + } elsif ($y >= 0) { # y >= 0 + $y -> bpi($scale); # pi + } else { # y < 0 + $y -> bpi($scale) -> bneg(); # -pi + } + } elsif ($x > 0) { # 0 < x < inf + if ($y -> is_inf("+")) { # y = inf + $y -> bpi($scale) -> bmul("0.5"); # pi/2 + } elsif ($y -> is_inf("-")) { # y = -inf + $y -> bpi($scale) -> bmul("-0.5"); # -pi/2 + } else { # -inf < y < inf + $y -> bdiv($x, $scale) -> batan($scale); # atan(y/x) + } + } elsif ($x < 0) { # -inf < x < 0 + my $pi = $class -> bpi($scale); + if ($y >= 0) { # y >= 0 + $y -> bdiv($x, $scale) -> batan() # atan(y/x) + pi + -> badd($pi); + } else { # y < 0 + $y -> bdiv($x, $scale) -> batan() # atan(y/x) - pi + -> bsub($pi); + } + } else { # x = 0 + if ($y > 0) { # y > 0 + $y -> bpi($scale) -> bmul("0.5"); # pi/2 + } elsif ($y < 0) { # y < 0 + $y -> bpi($scale) -> bmul("-0.5"); # -pi/2 + } else { # y = 0 + return $y -> bzero(@r); # 0 + } + } + + $y -> round(@r); + + if ($fallback) { + delete $y->{_a}; + delete $y->{_p}; + } + + return $y; +} +############################################################################## + +sub bsqrt { + # calculate square root + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bsqrt'); + + return $x->bnan() if $x->{sign} !~ /^\+/; # NaN, -inf or < 0 + return $x if $x->{sign} eq '+inf'; # sqrt(inf) == inf + return $x->round($a, $p, $r) if $x->is_zero() || $x->is_one(); + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my (@params, $scale); + ($x, @params) = $x->_find_round_parameters($a, $p, $r); + + return $x if $x->is_nan(); # error in _find_round_parameters? + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; + delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; # should be really parent class vs MBI + + my $i = $LIB->_copy($x->{_m}); + $i = $LIB->_lsft($i, $x->{_e}, 10) unless $LIB->_is_zero($x->{_e}); + my $xas = Math::BigInt->bzero(); + $xas->{value} = $i; + + my $gs = $xas->copy()->bsqrt(); # some guess + + if (($x->{_es} ne '-') # guess can't be accurate if there are + # digits after the dot + && ($xas->bacmp($gs * $gs) == 0)) # guess hit the nail on the head? + { + # exact result, copy result over to keep $x + $x->{_m} = $gs->{value}; + $x->{_e} = $LIB->_zero(); + $x->{_es} = '+'; + $x->bnorm(); + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # re-enable A and P, upgrade is taken care of by "local" + ${"$class\::accuracy"} = $ab; + ${"$class\::precision"} = $pb; + return $x; + } + + # sqrt(2) = 1.4 because sqrt(2*100) = 1.4*10; so we can increase the accuracy + # of the result by multiplying the input by 100 and then divide the integer + # result of sqrt(input) by 10. Rounding afterwards returns the real result. + + # The following steps will transform 123.456 (in $x) into 123456 (in $y1) + my $y1 = $LIB->_copy($x->{_m}); + + my $length = $LIB->_len($y1); + + # Now calculate how many digits the result of sqrt(y1) would have + my $digits = int($length / 2); + + # But we need at least $scale digits, so calculate how many are missing + my $shift = $scale - $digits; + + # This happens if the input had enough digits + # (we take care of integer guesses above) + $shift = 0 if $shift < 0; + + # Multiply in steps of 100, by shifting left two times the "missing" digits + my $s2 = $shift * 2; + + # We now make sure that $y1 has the same odd or even number of digits than + # $x had. So when _e of $x is odd, we must shift $y1 by one digit left, + # because we always must multiply by steps of 100 (sqrt(100) is 10) and not + # steps of 10. The length of $x does not count, since an even or odd number + # of digits before the dot is not changed by adding an even number of digits + # after the dot (the result is still odd or even digits long). + $s2++ if $LIB->_is_odd($x->{_e}); + + $y1 = $LIB->_lsft($y1, $LIB->_new($s2), 10); + + # now take the square root and truncate to integer + $y1 = $LIB->_sqrt($y1); + + # By "shifting" $y1 right (by creating a negative _e) we calculate the final + # result, which is than later rounded to the desired scale. + + # calculate how many zeros $x had after the '.' (or before it, depending + # on sign of $dat, the result should have half as many: + my $dat = $LIB->_num($x->{_e}); + $dat = -$dat if $x->{_es} eq '-'; + $dat += $length; + + if ($dat > 0) { + # no zeros after the dot (e.g. 1.23, 0.49 etc) + # preserve half as many digits before the dot than the input had + # (but round this "up") + $dat = int(($dat+1)/2); + } else { + $dat = int(($dat)/2); + } + $dat -= $LIB->_len($y1); + if ($dat < 0) { + $dat = abs($dat); + $x->{_e} = $LIB->_new($dat); + $x->{_es} = '-'; + } else { + $x->{_e} = $LIB->_new($dat); + $x->{_es} = '+'; + } + $x->{_m} = $y1; + $x->bnorm(); + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + $x; +} + +sub broot { + # calculate $y'th root of $x + + # set up parameters + my ($class, $x, $y, $a, $p, $r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x->modify('broot'); + + # NaN handling: $x ** 1/0, x or y NaN, or y inf/-inf or y == 0 + return $x->bnan() if $x->{sign} !~ /^\+/ || $y->is_zero() || + $y->{sign} !~ /^\+$/; + + return $x if $x->is_zero() || $x->is_one() || $x->is_inf() || $y->is_one(); + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my (@params, $scale); + ($x, @params) = $x->_find_round_parameters($a, $p, $r); + + return $x if $x->is_nan(); # error in _find_round_parameters? + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; + delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; # should be really parent class vs MBI + + # remember sign and make $x positive, since -4 ** (1/2) => -2 + my $sign = 0; + $sign = 1 if $x->{sign} eq '-'; + $x->{sign} = '+'; + + my $is_two = 0; + if ($y->isa('Math::BigFloat')) { + $is_two = ($y->{sign} eq '+' && $LIB->_is_two($y->{_m}) && $LIB->_is_zero($y->{_e})); + } else { + $is_two = ($y == 2); + } + + # normal square root if $y == 2: + if ($is_two) { + $x->bsqrt($scale+4); + } elsif ($y->is_one('-')) { + # $x ** -1 => 1/$x + my $u = $class->bone()->bdiv($x, $scale); + # copy private parts over + $x->{_m} = $u->{_m}; + $x->{_e} = $u->{_e}; + $x->{_es} = $u->{_es}; + } else { + # calculate the broot() as integer result first, and if it fits, return + # it rightaway (but only if $x and $y are integer): + + my $done = 0; # not yet + if ($y->is_int() && $x->is_int()) { + my $i = $LIB->_copy($x->{_m}); + $i = $LIB->_lsft($i, $x->{_e}, 10) unless $LIB->_is_zero($x->{_e}); + my $int = Math::BigInt->bzero(); + $int->{value} = $i; + $int->broot($y->as_number()); + # if ($exact) + if ($int->copy()->bpow($y) == $x) { + # found result, return it + $x->{_m} = $int->{value}; + $x->{_e} = $LIB->_zero(); + $x->{_es} = '+'; + $x->bnorm(); + $done = 1; + } + } + if ($done == 0) { + my $u = $class->bone()->bdiv($y, $scale+4); + delete $u->{_a}; delete $u->{_p}; # otherwise it conflicts + $x->bpow($u, $scale+4); # el cheapo + } + } + $x->bneg() if $sign == 1; + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + $x; +} + +sub bfac { + # (BFLOAT or num_str, BFLOAT or num_str) return BFLOAT + # compute factorial number, modifies first argument + + # set up parameters + my ($class, $x, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + ($class, $x, @r) = objectify(1, @_) if !ref($x); + + # inf => inf + return $x if $x->modify('bfac') || $x->{sign} eq '+inf'; + + return $x->bnan() + if (($x->{sign} ne '+') || # inf, NaN, <0 etc => NaN + ($x->{_es} ne '+')); # digits after dot? + + if (! $LIB->_is_zero($x->{_e})) { + $x->{_m} = $LIB->_lsft($x->{_m}, $x->{_e}, 10); # change 12e1 to 120e0 + $x->{_e} = $LIB->_zero(); # normalize + $x->{_es} = '+'; + } + $x->{_m} = $LIB->_fac($x->{_m}); # calculate factorial + $x->bnorm()->round(@r); # norm again and round result +} + +sub bdfac { + # compute double factorial + + # set up parameters + my ($class, $x, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + ($class, $x, @r) = objectify(1, @_) if !ref($x); + + # inf => inf + return $x if $x->modify('bfac') || $x->{sign} eq '+inf'; + + return $x->bnan() + if (($x->{sign} ne '+') || # inf, NaN, <0 etc => NaN + ($x->{_es} ne '+')); # digits after dot? + + croak("bdfac() requires a newer version of the $LIB library.") + unless $LIB->can('_dfac'); + + if (! $LIB->_is_zero($x->{_e})) { + $x->{_m} = $LIB->_lsft($x->{_m}, $x->{_e}, 10); # change 12e1 to 120e0 + $x->{_e} = $LIB->_zero(); # normalize + $x->{_es} = '+'; + } + $x->{_m} = $LIB->_dfac($x->{_m}); # calculate factorial + $x->bnorm()->round(@r); # norm again and round result +} + +sub blsft { + # shift left by $y (multiply by $b ** $y) + + # set up parameters + my ($class, $x, $y, $b, $a, $p, $r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $b, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x -> modify('blsft'); + return $x if $x -> {sign} !~ /^[+-]$/; # nan, +inf, -inf + + $b = 2 if !defined $b; + $b = $class -> new($b) unless ref($b) && $b -> isa($class); + + return $x -> bnan() if $x -> is_nan() || $y -> is_nan() || $b -> is_nan(); + + # shift by a negative amount? + return $x -> brsft($y -> copy() -> babs(), $b) if $y -> {sign} =~ /^-/; + + $x -> bmul($b -> bpow($y), $a, $p, $r, $y); +} + +sub brsft { + # shift right by $y (divide $b ** $y) + + # set up parameters + my ($class, $x, $y, $b, $a, $p, $r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $b, $a, $p, $r) = objectify(2, @_); + } + + return $x if $x -> modify('brsft'); + return $x if $x -> {sign} !~ /^[+-]$/; # nan, +inf, -inf + + $b = 2 if !defined $b; + $b = $class -> new($b) unless ref($b) && $b -> isa($class); + + return $x -> bnan() if $x -> is_nan() || $y -> is_nan() || $b -> is_nan(); + + # shift by a negative amount? + return $x -> blsft($y -> copy() -> babs(), $b) if $y -> {sign} =~ /^-/; + + # the following call to bdiv() will return either quotient (scalar context) + # or quotient and remainder (list context). + $x -> bdiv($b -> bpow($y), $a, $p, $r, $y); +} + +############################################################################### +# Bitwise methods +############################################################################### + +sub band { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'band() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for band()' if @_ < 1; + + return if $x -> modify('band'); + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> band($y); + $xtmp = $class -> new($xtmp); # back to Math::BigFloat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_m} = $xtmp -> {_m}; + $x -> {_es} = $xtmp -> {_es}; + $x -> {_e} = $xtmp -> {_e}; + + return $x -> round(@r); +} + +sub bior { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bior() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for bior()' if @_ < 1; + + return if $x -> modify('bior'); + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bior($y); + $xtmp = $class -> new($xtmp); # back to Math::BigFloat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_m} = $xtmp -> {_m}; + $x -> {_es} = $xtmp -> {_es}; + $x -> {_e} = $xtmp -> {_e}; + + return $x -> round(@r); +} + +sub bxor { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bxor() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for bxor()' if @_ < 1; + + return if $x -> modify('bxor'); + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bxor($y); + $xtmp = $class -> new($xtmp); # back to Math::BigFloat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_m} = $xtmp -> {_m}; + $x -> {_es} = $xtmp -> {_es}; + $x -> {_e} = $xtmp -> {_e}; + + return $x -> round(@r); +} + +sub bnot { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bnot() is an instance method, not a class method' unless $xref; + + return if $x -> modify('bnot'); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bnot(); + $xtmp = $class -> new($xtmp); # back to Math::BigFloat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_m} = $xtmp -> {_m}; + $x -> {_es} = $xtmp -> {_es}; + $x -> {_e} = $xtmp -> {_e}; + + return $x -> round(@r); +} + +############################################################################### +# Rounding methods +############################################################################### + +sub bround { + # accuracy: preserve $N digits, and overwrite the rest with 0's + my $x = shift; + my $class = ref($x) || $x; + $x = $class->new(shift) if !ref($x); + + if (($_[0] || 0) < 0) { + croak('bround() needs positive accuracy'); + } + + my ($scale, $mode) = $x->_scale_a(@_); + return $x if !defined $scale || $x->modify('bround'); # no-op + + # scale is now either $x->{_a}, $accuracy, or the user parameter + # test whether $x already has lower accuracy, do nothing in this case + # but do round if the accuracy is the same, since a math operation might + # want to round a number with A=5 to 5 digits afterwards again + return $x if defined $x->{_a} && $x->{_a} < $scale; + + # scale < 0 makes no sense + # scale == 0 => keep all digits + # never round a +-inf, NaN + return $x if ($scale <= 0) || $x->{sign} !~ /^[+-]$/; + + # 1: never round a 0 + # 2: if we should keep more digits than the mantissa has, do nothing + if ($x->is_zero() || $LIB->_len($x->{_m}) <= $scale) { + $x->{_a} = $scale if !defined $x->{_a} || $x->{_a} > $scale; + return $x; + } + + # pass sign to bround for '+inf' and '-inf' rounding modes + my $m = bless { sign => $x->{sign}, value => $x->{_m} }, 'Math::BigInt'; + + $m->bround($scale, $mode); # round mantissa + $x->{_m} = $m->{value}; # get our mantissa back + $x->{_a} = $scale; # remember rounding + delete $x->{_p}; # and clear P + $x->bnorm(); # del trailing zeros gen. by bround() +} + +sub bfround { + # precision: round to the $Nth digit left (+$n) or right (-$n) from the '.' + # $n == 0 means round to integer + # expects and returns normalized numbers! + my $x = shift; + my $class = ref($x) || $x; + $x = $class->new(shift) if !ref($x); + + my ($scale, $mode) = $x->_scale_p(@_); + return $x if !defined $scale || $x->modify('bfround'); # no-op + + # never round a 0, +-inf, NaN + if ($x->is_zero()) { + $x->{_p} = $scale if !defined $x->{_p} || $x->{_p} < $scale; # -3 < -2 + return $x; + } + return $x if $x->{sign} !~ /^[+-]$/; + + # don't round if x already has lower precision + return $x if (defined $x->{_p} && $x->{_p} < 0 && $scale < $x->{_p}); + + $x->{_p} = $scale; # remember round in any case + delete $x->{_a}; # and clear A + if ($scale < 0) { + # round right from the '.' + + return $x if $x->{_es} eq '+'; # e >= 0 => nothing to round + + $scale = -$scale; # positive for simplicity + my $len = $LIB->_len($x->{_m}); # length of mantissa + + # the following poses a restriction on _e, but if _e is bigger than a + # scalar, you got other problems (memory etc) anyway + my $dad = -(0+ ($x->{_es}.$LIB->_num($x->{_e}))); # digits after dot + my $zad = 0; # zeros after dot + $zad = $dad - $len if (-$dad < -$len); # for 0.00..00xxx style + + # print "scale $scale dad $dad zad $zad len $len\n"; + # number bsstr len zad dad + # 0.123 123e-3 3 0 3 + # 0.0123 123e-4 3 1 4 + # 0.001 1e-3 1 2 3 + # 1.23 123e-2 3 0 2 + # 1.2345 12345e-4 5 0 4 + + # do not round after/right of the $dad + return $x if $scale > $dad; # 0.123, scale >= 3 => exit + + # round to zero if rounding inside the $zad, but not for last zero like: + # 0.0065, scale -2, round last '0' with following '65' (scale == zad case) + return $x->bzero() if $scale < $zad; + if ($scale == $zad) # for 0.006, scale -3 and trunc + { + $scale = -$len; + } else { + # adjust round-point to be inside mantissa + if ($zad != 0) { + $scale = $scale-$zad; + } else { + my $dbd = $len - $dad; + $dbd = 0 if $dbd < 0; # digits before dot + $scale = $dbd+$scale; + } + } + } else { + # round left from the '.' + + # 123 => 100 means length(123) = 3 - $scale (2) => 1 + + my $dbt = $LIB->_len($x->{_m}); + # digits before dot + my $dbd = $dbt + ($x->{_es} . $LIB->_num($x->{_e})); + # should be the same, so treat it as this + $scale = 1 if $scale == 0; + # shortcut if already integer + return $x if $scale == 1 && $dbt <= $dbd; + # maximum digits before dot + ++$dbd; + + if ($scale > $dbd) { + # not enough digits before dot, so round to zero + return $x->bzero; + } elsif ($scale == $dbd) { + # maximum + $scale = -$dbt; + } else { + $scale = $dbd - $scale; + } + } + # pass sign to bround for rounding modes '+inf' and '-inf' + my $m = bless { sign => $x->{sign}, value => $x->{_m} }, 'Math::BigInt'; + $m->bround($scale, $mode); + $x->{_m} = $m->{value}; # get our mantissa back + $x->bnorm(); +} + +sub bfloor { + # round towards minus infinity + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bfloor'); + return $x if $x->{sign} !~ /^[+-]$/; # nan, +inf, -inf + + # if $x has digits after dot + if ($x->{_es} eq '-') { + $x->{_m} = $LIB->_rsft($x->{_m}, $x->{_e}, 10); # cut off digits after dot + $x->{_e} = $LIB->_zero(); # trunc/norm + $x->{_es} = '+'; # abs e + $x->{_m} = $LIB->_inc($x->{_m}) if $x->{sign} eq '-'; # increment if negative + } + $x->round($a, $p, $r); +} + +sub bceil { + # round towards plus infinity + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bceil'); + return $x if $x->{sign} !~ /^[+-]$/; # nan, +inf, -inf + + # if $x has digits after dot + if ($x->{_es} eq '-') { + $x->{_m} = $LIB->_rsft($x->{_m}, $x->{_e}, 10); # cut off digits after dot + $x->{_e} = $LIB->_zero(); # trunc/norm + $x->{_es} = '+'; # abs e + if ($x->{sign} eq '+') { + $x->{_m} = $LIB->_inc($x->{_m}); # increment if positive + } else { + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # avoid -0 + } + } + $x->round($a, $p, $r); +} + +sub bint { + # round towards zero + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->modify('bint'); + return $x if $x->{sign} !~ /^[+-]$/; # nan, +inf, -inf + + # if $x has digits after the decimal point + if ($x->{_es} eq '-') { + $x->{_m} = $LIB->_rsft($x->{_m}, $x->{_e}, 10); # cut off digits after dot + $x->{_e} = $LIB->_zero(); # truncate/normalize + $x->{_es} = '+'; # abs e + $x->{sign} = '+' if $LIB->_is_zero($x->{_m}); # avoid -0 + } + $x->round($a, $p, $r); +} + +############################################################################### +# Other mathematical methods +############################################################################### + +sub bgcd { + # (BINT or num_str, BINT or num_str) return BINT + # does not modify arguments, but returns new object + + unshift @_, __PACKAGE__ + unless ref($_[0]) || $_[0] =~ /^[a-z]\w*(?:::[a-z]\w*)*$/i; + + my ($class, @args) = objectify(0, @_); + + my $x = shift @args; + $x = ref($x) && $x -> isa($class) ? $x -> copy() : $class -> new($x); + return $class->bnan() unless $x -> is_int(); + + while (@args) { + my $y = shift @args; + $y = $class->new($y) unless ref($y) && $y -> isa($class); + return $class->bnan() unless $y -> is_int(); + + # greatest common divisor + while (! $y->is_zero()) { + ($x, $y) = ($y->copy(), $x->copy()->bmod($y)); + } + + last if $x -> is_one(); + } + return $x -> babs(); +} + +sub blcm { + # (BFLOAT or num_str, BFLOAT or num_str) return BFLOAT + # does not modify arguments, but returns new object + # Least Common Multiple + + unshift @_, __PACKAGE__ + unless ref($_[0]) || $_[0] =~ /^[a-z]\w*(?:::[a-z]\w*)*$/i; + + my ($class, @args) = objectify(0, @_); + + my $x = shift @args; + $x = ref($x) && $x -> isa($class) ? $x -> copy() : $class -> new($x); + return $class->bnan() if $x->{sign} !~ /^[+-]$/; # x NaN? + + while (@args) { + my $y = shift @args; + $y = $class -> new($y) unless ref($y) && $y -> isa($class); + return $x->bnan() unless $y -> is_int(); + my $gcd = $x -> bgcd($y); + $x -> bdiv($gcd) -> bmul($y); + } + + return $x -> babs(); +} + +############################################################################### +# Object property methods +############################################################################### + +sub length { + my $x = shift; + my $class = ref($x) || $x; + $x = $class->new(shift) unless ref($x); + + return 1 if $LIB->_is_zero($x->{_m}); + + my $len = $LIB->_len($x->{_m}); + $len += $LIB->_num($x->{_e}) if $x->{_es} eq '+'; + if (wantarray()) { + my $t = 0; + $t = $LIB->_num($x->{_e}) if $x->{_es} eq '-'; + return ($len, $t); + } + $len; +} + +sub mantissa { + # return a copy of the mantissa + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + my $s = $x->{sign}; + $s =~ s/^\+//; + return Math::BigInt->new($s, undef, undef); # -inf, +inf => +inf + } + my $m = Math::BigInt->new($LIB->_str($x->{_m}), undef, undef); + $m->bneg() if $x->{sign} eq '-'; + + $m; +} + +sub exponent { + # return a copy of the exponent + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + my $s = $x->{sign}; + $s =~ s/^[+-]//; + return Math::BigInt->new($s, undef, undef); # -inf, +inf => +inf + } + Math::BigInt->new($x->{_es} . $LIB->_str($x->{_e}), undef, undef); +} + +sub parts { + # return a copy of both the exponent and the mantissa + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + my $s = $x->{sign}; + $s =~ s/^\+//; + my $se = $s; + $se =~ s/^-//; + return ($class->new($s), $class->new($se)); # +inf => inf and -inf, +inf => inf + } + my $m = Math::BigInt->bzero(); + $m->{value} = $LIB->_copy($x->{_m}); + $m->bneg() if $x->{sign} eq '-'; + ($m, Math::BigInt->new($x->{_es} . $LIB->_num($x->{_e}))); +} + +sub sparts { + my $self = shift; + my $class = ref $self; + + croak("sparts() is an instance method, not a class method") + unless $class; + + # Not-a-number. + + if ($self -> is_nan()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> bnan(); # exponent + return ($mant, $expo); # list context + } + + # Infinity. + + if ($self -> is_inf()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> binf('+'); # exponent + return ($mant, $expo); # list context + } + + # Finite number. + + my $mant = $class -> bzero(); + $mant -> {sign} = $self -> {sign}; + $mant -> {_m} = $LIB->_copy($self -> {_m}); + return $mant unless wantarray; + + my $expo = $class -> bzero(); + $expo -> {sign} = $self -> {_es}; + $expo -> {_m} = $LIB->_copy($self -> {_e}); + + return ($mant, $expo); +} + +sub nparts { + my $self = shift; + my $class = ref $self; + + croak("nparts() is an instance method, not a class method") + unless $class; + + # Not-a-number. + + if ($self -> is_nan()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> bnan(); # exponent + return ($mant, $expo); # list context + } + + # Infinity. + + if ($self -> is_inf()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> binf('+'); # exponent + return ($mant, $expo); # list context + } + + # Finite number. + + my ($mant, $expo) = $self -> sparts(); + + if ($mant -> bcmp(0)) { + my ($ndigtot, $ndigfrac) = $mant -> length(); + my $expo10adj = $ndigtot - $ndigfrac - 1; + + if ($expo10adj != 0) { + my $factor = "1e" . -$expo10adj; + $mant -> bmul($factor); + return $mant unless wantarray; + $expo -> badd($expo10adj); + return ($mant, $expo); + } + } + + return $mant unless wantarray; + return ($mant, $expo); +} + +sub eparts { + my $self = shift; + my $class = ref $self; + + croak("eparts() is an instance method, not a class method") + unless $class; + + # Not-a-number and Infinity. + + return $self -> sparts() if $self -> is_nan() || $self -> is_inf(); + + # Finite number. + + my ($mant, $expo) = $self -> nparts(); + + my $c = $expo -> copy() -> bmod(3); + $mant -> blsft($c, 10); + return $mant unless wantarray; + + $expo -> bsub($c); + return ($mant, $expo); +} + +sub dparts { + my $self = shift; + my $class = ref $self; + + croak("dparts() is an instance method, not a class method") + unless $class; + + # Not-a-number and Infinity. + + if ($self -> is_nan() || $self -> is_inf()) { + my $int = $self -> copy(); + return $int unless wantarray; + my $frc = $class -> bzero(); + return ($int, $frc); + } + + my $int = $self -> copy(); + my $frc = $class -> bzero(); + + # If the input has a fraction part. + + if ($int->{_es} eq '-') { + $int->{_m} = $LIB -> _rsft($int->{_m}, $int->{_e}, 10); + $int->{_e} = $LIB -> _zero(); + $int->{_es} = '+'; + $int->{sign} = '+' if $LIB->_is_zero($int->{_m}); # avoid -0 + + return $int unless wantarray; + $frc = $self -> copy() -> bsub($int); + return ($int, $frc); + } + + return $int unless wantarray; + return ($int, $frc); +} + +############################################################################### +# String conversion methods +############################################################################### + +sub bstr { + # (ref to BFLOAT or num_str) return num_str + # Convert number from internal format to (non-scientific) string format. + # internal format is always normalized (no leading zeros, "-0" => "+0") + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my $es = '0'; + my $len = 1; + my $cad = 0; + my $dot = '.'; + + # $x is zero? + my $not_zero = !($x->{sign} eq '+' && $LIB->_is_zero($x->{_m})); + if ($not_zero) { + $es = $LIB->_str($x->{_m}); + $len = CORE::length($es); + my $e = $LIB->_num($x->{_e}); + $e = -$e if $x->{_es} eq '-'; + if ($e < 0) { + $dot = ''; + # if _e is bigger than a scalar, the following will blow your memory + if ($e <= -$len) { + my $r = abs($e) - $len; + $es = '0.'. ('0' x $r) . $es; + $cad = -($len+$r); + } else { + substr($es, $e, 0) = '.'; + $cad = $LIB->_num($x->{_e}); + $cad = -$cad if $x->{_es} eq '-'; + } + } elsif ($e > 0) { + # expand with zeros + $es .= '0' x $e; + $len += $e; + $cad = 0; + } + } # if not zero + + $es = '-'.$es if $x->{sign} eq '-'; + # if set accuracy or precision, pad with zeros on the right side + if ((defined $x->{_a}) && ($not_zero)) { + # 123400 => 6, 0.1234 => 4, 0.001234 => 4 + my $zeros = $x->{_a} - $cad; # cad == 0 => 12340 + $zeros = $x->{_a} - $len if $cad != $len; + $es .= $dot.'0' x $zeros if $zeros > 0; + } elsif ((($x->{_p} || 0) < 0)) { + # 123400 => 6, 0.1234 => 4, 0.001234 => 6 + my $zeros = -$x->{_p} + $cad; + $es .= $dot.'0' x $zeros if $zeros > 0; + } + $es; +} + +# Decimal notation, e.g., "12345.6789". + +sub bdstr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my $mant = $LIB->_str($x->{_m}); + my $expo = $x -> exponent(); + + my $str = $mant; + if ($expo >= 0) { + $str .= "0" x $expo; + } else { + my $mantlen = CORE::length($mant); + my $c = $mantlen + $expo; + $str = "0" x (1 - $c) . $str if $c <= 0; + substr($str, $expo, 0) = '.'; + } + + return $x->{sign} eq '-' ? "-$str" : $str; +} + +# Scientific notation with significand/mantissa as an integer, e.g., "12345.6789" +# is written as "123456789e-4". + +sub bsstr { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my $str = $LIB->_str($x->{_m}) . 'e' . $x->{_es}. $LIB->_str($x->{_e}); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +# Normalized notation, e.g., "12345.6789" is written as "1.23456789e+4". + +sub bnstr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my ($mant, $expo) = $x -> nparts(); + + my $esgn = $expo < 0 ? '-' : '+'; + my $eabs = $expo -> babs() -> bfround(0) -> bstr(); + #$eabs = '0' . $eabs if length($eabs) < 2; + + return $mant . 'e' . $esgn . $eabs; +} + +# Engineering notation, e.g., "12345.6789" is written as "12.3456789e+3". + +sub bestr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my ($mant, $expo) = $x -> eparts(); + + my $esgn = $expo < 0 ? '-' : '+'; + my $eabs = $expo -> babs() -> bfround(0) -> bstr(); + #$eabs = '0' . $eabs if length($eabs) < 2; + + return $mant . 'e' . $esgn . $eabs; +} + +sub to_hex { + # return number as hexadecimal string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '0' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in hex? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_to_hex($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub to_oct { + # return number as octal digit string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '0' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in octal? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_to_oct($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub to_bin { + # return number as binary digit string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '0' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in binary? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_to_bin($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub to_ieee754 { + my $x = shift; + my $format = shift; + my $class = ref $x; + + my $enc; # significand encoding (applies only to decimal) + my $k; # storage width in bits + my $b; # base + + if ($format =~ /^binary(\d+)\z/) { + $k = $1; + $b = 2; + } elsif ($format =~ /^decimal(\d+)(dpd|bcd)?\z/) { + $k = $1; + $b = 10; + $enc = $2 || 'dpd'; # default is dencely-packed decimals (DPD) + } elsif ($format eq 'half') { + $k = 16; + $b = 2; + } elsif ($format eq 'single') { + $k = 32; + $b = 2; + } elsif ($format eq 'double') { + $k = 64; + $b = 2; + } elsif ($format eq 'quadruple') { + $k = 128; + $b = 2; + } elsif ($format eq 'octuple') { + $k = 256; + $b = 2; + } elsif ($format eq 'sexdecuple') { + $k = 512; + $b = 2; + } + + if ($b == 2) { + + # Get the parameters for this format. + + my $p; # precision (in bits) + my $t; # number of bits in significand + my $w; # number of bits in exponent + + if ($k == 16) { # binary16 (half-precision) + $p = 11; + $t = 10; + $w = 5; + } elsif ($k == 32) { # binary32 (single-precision) + $p = 24; + $t = 23; + $w = 8; + } elsif ($k == 64) { # binary64 (double-precision) + $p = 53; + $t = 52; + $w = 11; + } else { # binaryN (quadruple-precition and above) + if ($k < 128 || $k != 32 * sprintf('%.0f', $k / 32)) { + croak "Number of bits must be 16, 32, 64, or >= 128 and", + " a multiple of 32"; + } + $p = $k - sprintf('%.0f', 4 * log($k) / log(2)) + 13; + $t = $p - 1; + $w = $k - $t - 1; + } + + # The maximum exponent, minimum exponent, and exponent bias. + + my $emax = $class -> new(2) -> bpow($w - 1) -> bdec(); + my $emin = 1 - $emax; + my $bias = $emax; + + # Get numerical sign, exponent, and mantissa/significand for bit + # string. + + my $sign = 0; + my $expo; + my $mant; + + if ($x -> is_nan()) { # nan + $sign = 1; + $expo = $emax -> copy() -> binc(); + $mant = $class -> new(2) -> bpow($t - 1); + } elsif ($x -> is_inf()) { # inf + $sign = 1 if $x -> is_neg(); + $expo = $emax -> copy() -> binc(); + $mant = $class -> bzero(); + } elsif ($x -> is_zero()) { # zero + $expo = $emin -> copy() -> bdec(); + $mant = $class -> bzero(); + } else { # normal and subnormal + + $sign = 1 if $x -> is_neg(); + + # Now we need to compute the mantissa and exponent in base $b. + + my $binv = $class -> new("0.5"); + my $b = $class -> new(2); + my $one = $class -> bone(); + + # We start off by initializing the exponent to zero and the + # mantissa to the input value. Then we increase the mantissa and + # decrease the exponent, or vice versa, until the mantissa is in + # the desired range or we hit one of the limits for the exponent. + + $mant = $x -> copy() -> babs(); + + # We need to find the base 2 exponent. First make an estimate of + # the base 2 exponent, before adjusting it below. We could skip + # this estimation and go straight to the while-loops below, but the + # loops are slow, especially when the final exponent is far from + # zero and even more so if the number of digits is large. This + # initial estimation speeds up the computation dramatically. + # + # log2($m * 10**$e) = log10($m + 10**$e) * log(10)/log(2) + # = (log10($m) + $e) * log(10)/log(2) + # = (log($m)/log(10) + $e) * log(10)/log(2) + + my ($m, $e) = $x -> nparts(); + my $ms = $m -> numify(); + my $es = $e -> numify(); + + my $expo_est = (log(abs($ms))/log(10) + $es) * log(10)/log(2); + $expo_est = int($expo_est); + + # Limit the exponent. + + if ($expo_est > $emax) { + $expo_est = $emax; + } elsif ($expo_est < $emin) { + $expo_est = $emin; + } + + # Don't multiply by a number raised to a negative exponent. This + # will cause a division, whose result is truncated to some fixed + # number of digits. Instead, multiply by the inverse number raised + # to a positive exponent. + + $expo = $class -> new($expo_est); + if ($expo_est > 0) { + $mant -> bmul($binv -> copy() -> bpow($expo)); + } elsif ($expo_est < 0) { + my $expo_abs = $expo -> copy() -> bneg(); + $mant -> bmul($b -> copy() -> bpow($expo_abs)); + } + + # Final adjustment. + + while ($mant >= $b && $expo <= $emax) { + $mant -> bmul($binv); + $expo -> binc(); + } + + while ($mant < $one && $expo >= $emin) { + $mant -> bmul($b); + $expo -> bdec(); + } + + # Encode as infinity, normal number or subnormal number? + + if ($expo > $emax) { # overflow => infinity + $expo = $emax -> copy() -> binc(); + $mant = $class -> bzero(); + } elsif ($expo < $emin) { # subnormal number + my $const = $class -> new(2) -> bpow($t - 1); + $mant -> bmul($const); + $mant -> bfround(0); + } else { # normal number + $mant -> bdec(); # remove implicit leading bit + my $const = $class -> new(2) -> bpow($t); + $mant -> bmul($const) -> bfround(0); + } + } + + $expo -> badd($bias); # add bias + + my $signbit = "$sign"; + + my $mantbits = $mant -> to_bin(); + $mantbits = ("0" x ($t - CORE::length($mantbits))) . $mantbits; + + my $expobits = $expo -> to_bin(); + $expobits = ("0" x ($w - CORE::length($expobits))) . $expobits; + + my $bin = $signbit . $expobits . $mantbits; + return pack "B*", $bin; + } + + croak("The format '$format' is not yet supported."); +} + +sub as_hex { + # return number as hexadecimal string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '0x0' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in hex? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_as_hex($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub as_oct { + # return number as octal digit string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '00' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in octal? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_as_oct($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub as_bin { + # return number as binary digit string (only for integers defined) + + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + return '0b0' if $x->is_zero(); + + return $nan if $x->{_es} ne '+'; # how to do 1e-1 in binary? + + my $z = $LIB->_copy($x->{_m}); + if (! $LIB->_is_zero($x->{_e})) { # > 0 + $z = $LIB->_lsft($z, $x->{_e}, 10); + } + my $str = $LIB->_as_bin($z); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub numify { + # Make a Perl scalar number from a Math::BigFloat object. + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x -> is_nan()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $inf - $inf; + } + + if ($x -> is_inf()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $x -> is_negative() ? -$inf : $inf; + } + + # Create a string and let Perl's atoi()/atof() handle the rest. + return 0 + $x -> bnstr(); +} + +############################################################################### +# Private methods and functions. +############################################################################### + +sub import { + my $class = shift; + my $l = scalar @_; + my $lib = ''; + my @a; + my $lib_kind = 'try'; + $IMPORT=1; + for (my $i = 0; $i < $l ; $i++) { + if ($_[$i] eq ':constant') { + # This causes overlord er load to step in. 'binary' and 'integer' + # are handled by BigInt. + overload::constant float => sub { $class->new(shift); }; + } elsif ($_[$i] eq 'upgrade') { + # this causes upgrading + $upgrade = $_[$i+1]; # or undef to disable + $i++; + } elsif ($_[$i] eq 'downgrade') { + # this causes downgrading + $downgrade = $_[$i+1]; # or undef to disable + $i++; + } elsif ($_[$i] =~ /^(lib|try|only)\z/) { + # alternative library + $lib = $_[$i+1] || ''; # default Calc + $lib_kind = $1; # lib, try or only + $i++; + } elsif ($_[$i] eq 'with') { + # alternative class for our private parts() + # XXX: no longer supported + # $LIB = $_[$i+1] || 'Math::BigInt'; + $i++; + } else { + push @a, $_[$i]; + } + } + + $lib =~ tr/a-zA-Z0-9,://cd; # restrict to sane characters + # let use Math::BigInt lib => 'GMP'; use Math::BigFloat; still work + my $mbilib = eval { Math::BigInt->config('lib') }; + if ((defined $mbilib) && ($LIB eq 'Math::BigInt::Calc')) { + # $LIB already loaded + Math::BigInt->import($lib_kind, "$lib, $mbilib", 'objectify'); + } else { + # $LIB not loaded, or with ne "Math::BigInt::Calc" + $lib .= ",$mbilib" if defined $mbilib; + $lib =~ s/^,//; # don't leave empty + + # replacement library can handle lib statement, but also could ignore it + + # Perl < 5.6.0 dies with "out of memory!" when eval() and ':constant' is + # used in the same script, or eval inside import(). So we require MBI: + require Math::BigInt; + Math::BigInt->import($lib_kind => $lib, 'objectify'); + } + if ($@) { + croak("Couldn't load $lib: $! $@"); + } + # find out which one was actually loaded + $LIB = Math::BigInt->config('lib'); + + # register us with MBI to get notified of future lib changes + Math::BigInt::_register_callback($class, sub { $LIB = $_[0]; }); + + $class->export_to_level(1, $class, @a); # export wanted functions +} + +sub _len_to_steps { + # Given D (digits in decimal), compute N so that N! (N factorial) is + # at least D digits long. D should be at least 50. + my $d = shift; + + # two constants for the Ramanujan estimate of ln(N!) + my $lg2 = log(2 * 3.14159265) / 2; + my $lg10 = log(10); + + # D = 50 => N => 42, so L = 40 and R = 50 + my $l = 40; + my $r = $d; + + # Otherwise this does not work under -Mbignum and we do not yet have "no bignum;" :( + $l = $l->numify if ref($l); + $r = $r->numify if ref($r); + $lg2 = $lg2->numify if ref($lg2); + $lg10 = $lg10->numify if ref($lg10); + + # binary search for the right value (could this be written as the reverse of lg(n!)?) + while ($r - $l > 1) { + my $n = int(($r - $l) / 2) + $l; + my $ramanujan = + int(($n * log($n) - $n + log($n * (1 + 4*$n*(1+2*$n))) / 6 + $lg2) / $lg10); + $ramanujan > $d ? $r = $n : $l = $n; + } + $l; +} + +sub _log { + # internal log function to calculate ln() based on Taylor series. + # Modifies $x in place. + my ($x, $scale) = @_; + my $class = ref $x; + + # in case of $x == 1, result is 0 + return $x->bzero() if $x->is_one(); + + # XXX TODO: rewrite this in a similar manner to bexp() + + # http://www.efunda.com/math/taylor_series/logarithmic.cfm?search_string=log + + # u = x-1, v = x+1 + # _ _ + # Taylor: | u 1 u^3 1 u^5 | + # ln (x) = 2 | --- + - * --- + - * --- + ... | x > 0 + # |_ v 3 v^3 5 v^5 _| + + # This takes much more steps to calculate the result and is thus not used + # u = x-1 + # _ _ + # Taylor: | u 1 u^2 1 u^3 | + # ln (x) = 2 | --- + - * --- + - * --- + ... | x > 1/2 + # |_ x 2 x^2 3 x^3 _| + + my ($limit, $v, $u, $below, $factor, $next, $over, $f); + + $v = $x->copy(); $v->binc(); # v = x+1 + $x->bdec(); $u = $x->copy(); # u = x-1; x = x-1 + $x->bdiv($v, $scale); # first term: u/v + $below = $v->copy(); + $over = $u->copy(); + $u *= $u; $v *= $v; # u^2, v^2 + $below->bmul($v); # u^3, v^3 + $over->bmul($u); + $factor = $class->new(3); $f = $class->new(2); + + $limit = $class->new("1E-". ($scale-1)); + + while (3 < 5) { + # we calculate the next term, and add it to the last + # when the next term is below our limit, it won't affect the outcome + # anymore, so we stop + + # calculating the next term simple from over/below will result in quite + # a time hog if the input has many digits, since over and below will + # accumulate more and more digits, and the result will also have many + # digits, but in the end it is rounded to $scale digits anyway. So if we + # round $over and $below first, we save a lot of time for the division + # (not with log(1.2345), but try log (123**123) to see what I mean. This + # can introduce a rounding error if the division result would be f.i. + # 0.1234500000001 and we round it to 5 digits it would become 0.12346, but + # if we truncated $over and $below we might get 0.12345. Does this matter + # for the end result? So we give $over and $below 4 more digits to be + # on the safe side (unscientific error handling as usual... :+D + + $next = $over->copy()->bround($scale+4) + ->bdiv($below->copy()->bmul($factor)->bround($scale+4), + $scale); + + ## old version: + ## $next = $over->copy()->bdiv($below->copy()->bmul($factor), $scale); + + last if $next->bacmp($limit) <= 0; + + delete $next->{_a}; + delete $next->{_p}; + $x->badd($next); + # calculate things for the next term + $over *= $u; + $below *= $v; + $factor->badd($f); + } + $x->bmul($f); # $x *= 2 +} + +sub _log_10 { + # Internal log function based on reducing input to the range of 0.1 .. 9.99 + # and then "correcting" the result to the proper one. Modifies $x in place. + my ($x, $scale) = @_; + my $class = ref $x; + + # Taking blog() from numbers greater than 10 takes a *very long* time, so we + # break the computation down into parts based on the observation that: + # blog(X*Y) = blog(X) + blog(Y) + # We set Y here to multiples of 10 so that $x becomes below 1 - the smaller + # $x is the faster it gets. Since 2*$x takes about 10 times as + # long, we make it faster by about a factor of 100 by dividing $x by 10. + + # The same observation is valid for numbers smaller than 0.1, e.g. computing + # log(1) is fastest, and the further away we get from 1, the longer it takes. + # So we also 'break' this down by multiplying $x with 10 and subtract the + # log(10) afterwards to get the correct result. + + # To get $x even closer to 1, we also divide by 2 and then use log(2) to + # correct for this. For instance if $x is 2.4, we use the formula: + # blog(2.4 * 2) == blog(1.2) + blog(2) + # and thus calculate only blog(1.2) and blog(2), which is faster in total + # than calculating blog(2.4). + + # In addition, the values for blog(2) and blog(10) are cached. + + # Calculate nr of digits before dot. x = 123, dbd = 3; x = 1.23, dbd = 1; + # x = 0.0123, dbd = -1; x = 0.000123, dbd = -3, etc. + + my $dbd = $LIB->_num($x->{_e}); + $dbd = -$dbd if $x->{_es} eq '-'; + $dbd += $LIB->_len($x->{_m}); + + # more than one digit (e.g. at least 10), but *not* exactly 10 to avoid + # infinite recursion + + my $calc = 1; # do some calculation? + + # disable the shortcut for 10, since we need log(10) and this would recurse + # infinitely deep + if ($x->{_es} eq '+' && # $x == 10 + ($LIB->_is_one($x->{_e}) && + $LIB->_is_one($x->{_m}))) + { + $dbd = 0; # disable shortcut + # we can use the cached value in these cases + if ($scale <= $LOG_10_A) { + $x->bzero(); + $x->badd($LOG_10); # modify $x in place + $calc = 0; # no need to calc, but round + } + # if we can't use the shortcut, we continue normally + } else { + # disable the shortcut for 2, since we maybe have it cached + if (($LIB->_is_zero($x->{_e}) && # $x == 2 + $LIB->_is_two($x->{_m}))) + { + $dbd = 0; # disable shortcut + # we can use the cached value in these cases + if ($scale <= $LOG_2_A) { + $x->bzero(); + $x->badd($LOG_2); # modify $x in place + $calc = 0; # no need to calc, but round + } + # if we can't use the shortcut, we continue normally + } + } + + # if $x = 0.1, we know the result must be 0-log(10) + if ($calc != 0 && + ($x->{_es} eq '-' && # $x == 0.1 + ($LIB->_is_one($x->{_e}) && + $LIB->_is_one($x->{_m})))) + { + $dbd = 0; # disable shortcut + # we can use the cached value in these cases + if ($scale <= $LOG_10_A) { + $x->bzero(); + $x->bsub($LOG_10); + $calc = 0; # no need to calc, but round + } + } + + return $x if $calc == 0; # already have the result + + # default: these correction factors are undef and thus not used + my $l_10; # value of ln(10) to A of $scale + my $l_2; # value of ln(2) to A of $scale + + my $two = $class->new(2); + + # $x == 2 => 1, $x == 13 => 2, $x == 0.1 => 0, $x == 0.01 => -1 + # so don't do this shortcut for 1 or 0 + if (($dbd > 1) || ($dbd < 0)) { + # convert our cached value to an object if not already (avoid doing this + # at import() time, since not everybody needs this) + $LOG_10 = $class->new($LOG_10, undef, undef) unless ref $LOG_10; + + #print "x = $x, dbd = $dbd, calc = $calc\n"; + # got more than one digit before the dot, or more than one zero after the + # dot, so do: + # log(123) == log(1.23) + log(10) * 2 + # log(0.0123) == log(1.23) - log(10) * 2 + + if ($scale <= $LOG_10_A) { + # use cached value + $l_10 = $LOG_10->copy(); # copy for mul + } else { + # else: slower, compute and cache result + # also disable downgrade for this code path + local $Math::BigFloat::downgrade = undef; + + # shorten the time to calculate log(10) based on the following: + # log(1.25 * 8) = log(1.25) + log(8) + # = log(1.25) + log(2) + log(2) + log(2) + + # first get $l_2 (and possible compute and cache log(2)) + $LOG_2 = $class->new($LOG_2, undef, undef) unless ref $LOG_2; + if ($scale <= $LOG_2_A) { + # use cached value + $l_2 = $LOG_2->copy(); # copy() for the mul below + } else { + # else: slower, compute and cache result + $l_2 = $two->copy(); + $l_2->_log($scale); # scale+4, actually + $LOG_2 = $l_2->copy(); # cache the result for later + # the copy() is for mul below + $LOG_2_A = $scale; + } + + # now calculate log(1.25): + $l_10 = $class->new('1.25'); + $l_10->_log($scale); # scale+4, actually + + # log(1.25) + log(2) + log(2) + log(2): + $l_10->badd($l_2); + $l_10->badd($l_2); + $l_10->badd($l_2); + $LOG_10 = $l_10->copy(); # cache the result for later + # the copy() is for mul below + $LOG_10_A = $scale; + } + $dbd-- if ($dbd > 1); # 20 => dbd=2, so make it dbd=1 + $l_10->bmul($class->new($dbd)); # log(10) * (digits_before_dot-1) + my $dbd_sign = '+'; + if ($dbd < 0) { + $dbd = -$dbd; + $dbd_sign = '-'; + } + ($x->{_e}, $x->{_es}) = + _e_sub($x->{_e}, $LIB->_new($dbd), $x->{_es}, $dbd_sign); # 123 => 1.23 + + } + + # Now: 0.1 <= $x < 10 (and possible correction in l_10) + + ### Since $x in the range 0.5 .. 1.5 is MUCH faster, we do a repeated div + ### or mul by 2 (maximum times 3, since x < 10 and x > 0.1) + + $HALF = $class->new($HALF) unless ref($HALF); + + my $twos = 0; # default: none (0 times) + while ($x->bacmp($HALF) <= 0) { # X <= 0.5 + $twos--; + $x->bmul($two); + } + while ($x->bacmp($two) >= 0) { # X >= 2 + $twos++; + $x->bdiv($two, $scale+4); # keep all digits + } + $x->bround($scale+4); + # $twos > 0 => did mul 2, < 0 => did div 2 (but we never did both) + # So calculate correction factor based on ln(2): + if ($twos != 0) { + $LOG_2 = $class->new($LOG_2, undef, undef) unless ref $LOG_2; + if ($scale <= $LOG_2_A) { + # use cached value + $l_2 = $LOG_2->copy(); # copy() for the mul below + } else { + # else: slower, compute and cache result + # also disable downgrade for this code path + local $Math::BigFloat::downgrade = undef; + $l_2 = $two->copy(); + $l_2->_log($scale); # scale+4, actually + $LOG_2 = $l_2->copy(); # cache the result for later + # the copy() is for mul below + $LOG_2_A = $scale; + } + $l_2->bmul($twos); # * -2 => subtract, * 2 => add + } else { + undef $l_2; + } + + $x->_log($scale); # need to do the "normal" way + $x->badd($l_10) if defined $l_10; # correct it by ln(10) + $x->badd($l_2) if defined $l_2; # and maybe by ln(2) + + # all done, $x contains now the result + $x; +} + +sub _e_add { + # Internal helper sub to take two positive integers and their signs and + # then add them. Input ($LIB, $LIB, ('+'|'-'), ('+'|'-')), output + # ($LIB, ('+'|'-')). + + my ($x, $y, $xs, $ys) = @_; + + # if the signs are equal we can add them (-5 + -3 => -(5 + 3) => -8) + if ($xs eq $ys) { + $x = $LIB->_add($x, $y); # +a + +b or -a + -b + } else { + my $a = $LIB->_acmp($x, $y); + if ($a == 0) { + # This does NOT modify $x in-place. TODO: Fix this? + $x = $LIB->_zero(); # result is 0 + $xs = '+'; + return ($x, $xs); + } + if ($a > 0) { + $x = $LIB->_sub($x, $y); # abs sub + } else { # a < 0 + $x = $LIB->_sub ($y, $x, 1); # abs sub + $xs = $ys; + } + } + + $xs = '+' if $xs eq '-' && $LIB->_is_zero($x); # no "-0" + + return ($x, $xs); +} + +sub _e_sub { + # Internal helper sub to take two positive integers and their signs and + # then subtract them. Input ($LIB, $LIB, ('+'|'-'), ('+'|'-')), + # output ($LIB, ('+'|'-')) + my ($x, $y, $xs, $ys) = @_; + + # flip sign + $ys = $ys eq '+' ? '-' : '+'; # swap sign of second operand ... + _e_add($x, $y, $xs, $ys); # ... and let _e_add() do the job +} + +sub _pow { + # Calculate a power where $y is a non-integer, like 2 ** 0.3 + my ($x, $y, @r) = @_; + my $class = ref($x); + + # if $y == 0.5, it is sqrt($x) + $HALF = $class->new($HALF) unless ref($HALF); + return $x->bsqrt(@r, $y) if $y->bcmp($HALF) == 0; + + # Using: + # a ** x == e ** (x * ln a) + + # u = y * ln x + # _ _ + # Taylor: | u u^2 u^3 | + # x ** y = 1 + | --- + --- + ----- + ... | + # |_ 1 1*2 1*2*3 _| + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters(@r); + + return $x if $x->is_nan(); # error in _find_round_parameters? + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # disable P + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it is not + # enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + # when user set globals, they would interfere with our calculation, so + # disable them and later re-enable them + no strict 'refs'; + my $abr = "$class\::accuracy"; my $ab = $$abr; $$abr = undef; + my $pbr = "$class\::precision"; my $pb = $$pbr; $$pbr = undef; + # we also need to disable any set A or P on $x (_find_round_parameters took + # them already into account), since these would interfere, too + delete $x->{_a}; + delete $x->{_p}; + # need to disable $upgrade in BigInt, to avoid deep recursion + local $Math::BigInt::upgrade = undef; + + my ($limit, $v, $u, $below, $factor, $next, $over); + + $u = $x->copy()->blog(undef, $scale)->bmul($y); + my $do_invert = ($u->{sign} eq '-'); + $u->bneg() if $do_invert; + $v = $class->bone(); # 1 + $factor = $class->new(2); # 2 + $x->bone(); # first term: 1 + + $below = $v->copy(); + $over = $u->copy(); + + $limit = $class->new("1E-". ($scale-1)); + while (3 < 5) { + # we calculate the next term, and add it to the last + # when the next term is below our limit, it won't affect the outcome + # anymore, so we stop: + $next = $over->copy()->bdiv($below, $scale); + last if $next->bacmp($limit) <= 0; + $x->badd($next); + # calculate things for the next term + $over *= $u; + $below *= $factor; + $factor->binc(); + + last if $x->{sign} !~ /^[-+]$/; + } + + if ($do_invert) { + my $x_copy = $x->copy(); + $x->bone->bdiv($x_copy, $scale); + } + + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; + delete $x->{_p}; + } + # restore globals + $$abr = $ab; + $$pbr = $pb; + $x; +} + +1; + +__END__ + +=pod + +=head1 NAME + +Math::BigFloat - Arbitrary size floating point math package + +=head1 SYNOPSIS + + use Math::BigFloat; + + # Configuration methods (may be used as class methods and instance methods) + + Math::BigFloat->accuracy(); # get class accuracy + Math::BigFloat->accuracy($n); # set class accuracy + Math::BigFloat->precision(); # get class precision + Math::BigFloat->precision($n); # set class precision + Math::BigFloat->round_mode(); # get class rounding mode + Math::BigFloat->round_mode($m); # set global round mode, must be one of + # 'even', 'odd', '+inf', '-inf', 'zero', + # 'trunc', or 'common' + Math::BigFloat->config("lib"); # name of backend math library + + # Constructor methods (when the class methods below are used as instance + # methods, the value is assigned the invocand) + + $x = Math::BigFloat->new($str); # defaults to 0 + $x = Math::BigFloat->new('0x123'); # from hexadecimal + $x = Math::BigFloat->new('0b101'); # from binary + $x = Math::BigFloat->from_hex('0xc.afep+3'); # from hex + $x = Math::BigFloat->from_hex('cafe'); # ditto + $x = Math::BigFloat->from_oct('1.3267p-4'); # from octal + $x = Math::BigFloat->from_oct('0377'); # ditto + $x = Math::BigFloat->from_bin('0b1.1001p-4'); # from binary + $x = Math::BigFloat->from_bin('0101'); # ditto + $x = Math::BigFloat->from_ieee754($b, "binary64"); # from IEEE-754 bytes + $x = Math::BigFloat->bzero(); # create a +0 + $x = Math::BigFloat->bone(); # create a +1 + $x = Math::BigFloat->bone('-'); # create a -1 + $x = Math::BigFloat->binf(); # create a +inf + $x = Math::BigFloat->binf('-'); # create a -inf + $x = Math::BigFloat->bnan(); # create a Not-A-Number + $x = Math::BigFloat->bpi(); # returns pi + + $y = $x->copy(); # make a copy (unlike $y = $x) + $y = $x->as_int(); # return as BigInt + + # Boolean methods (these don't modify the invocand) + + $x->is_zero(); # if $x is 0 + $x->is_one(); # if $x is +1 + $x->is_one("+"); # ditto + $x->is_one("-"); # if $x is -1 + $x->is_inf(); # if $x is +inf or -inf + $x->is_inf("+"); # if $x is +inf + $x->is_inf("-"); # if $x is -inf + $x->is_nan(); # if $x is NaN + + $x->is_positive(); # if $x > 0 + $x->is_pos(); # ditto + $x->is_negative(); # if $x < 0 + $x->is_neg(); # ditto + + $x->is_odd(); # if $x is odd + $x->is_even(); # if $x is even + $x->is_int(); # if $x is an integer + + # Comparison methods + + $x->bcmp($y); # compare numbers (undef, < 0, == 0, > 0) + $x->bacmp($y); # compare absolutely (undef, < 0, == 0, > 0) + $x->beq($y); # true if and only if $x == $y + $x->bne($y); # true if and only if $x != $y + $x->blt($y); # true if and only if $x < $y + $x->ble($y); # true if and only if $x <= $y + $x->bgt($y); # true if and only if $x > $y + $x->bge($y); # true if and only if $x >= $y + + # Arithmetic methods + + $x->bneg(); # negation + $x->babs(); # absolute value + $x->bsgn(); # sign function (-1, 0, 1, or NaN) + $x->bnorm(); # normalize (no-op) + $x->binc(); # increment $x by 1 + $x->bdec(); # decrement $x by 1 + $x->badd($y); # addition (add $y to $x) + $x->bsub($y); # subtraction (subtract $y from $x) + $x->bmul($y); # multiplication (multiply $x by $y) + $x->bmuladd($y,$z); # $x = $x * $y + $z + $x->bdiv($y); # division (floored), set $x to quotient + # return (quo,rem) or quo if scalar + $x->btdiv($y); # division (truncated), set $x to quotient + # return (quo,rem) or quo if scalar + $x->bmod($y); # modulus (x % y) + $x->btmod($y); # modulus (truncated) + $x->bmodinv($mod); # modular multiplicative inverse + $x->bmodpow($y,$mod); # modular exponentiation (($x ** $y) % $mod) + $x->bpow($y); # power of arguments (x ** y) + $x->blog(); # logarithm of $x to base e (Euler's number) + $x->blog($base); # logarithm of $x to base $base (e.g., base 2) + $x->bexp(); # calculate e ** $x where e is Euler's number + $x->bnok($y); # x over y (binomial coefficient n over k) + $x->bsin(); # sine + $x->bcos(); # cosine + $x->batan(); # inverse tangent + $x->batan2($y); # two-argument inverse tangent + $x->bsqrt(); # calculate square root + $x->broot($y); # $y'th root of $x (e.g. $y == 3 => cubic root) + $x->bfac(); # factorial of $x (1*2*3*4*..$x) + + $x->blsft($n); # left shift $n places in base 2 + $x->blsft($n,$b); # left shift $n places in base $b + # returns (quo,rem) or quo (scalar context) + $x->brsft($n); # right shift $n places in base 2 + $x->brsft($n,$b); # right shift $n places in base $b + # returns (quo,rem) or quo (scalar context) + + # Bitwise methods + + $x->band($y); # bitwise and + $x->bior($y); # bitwise inclusive or + $x->bxor($y); # bitwise exclusive or + $x->bnot(); # bitwise not (two's complement) + + # Rounding methods + $x->round($A,$P,$mode); # round to accuracy or precision using + # rounding mode $mode + $x->bround($n); # accuracy: preserve $n digits + $x->bfround($n); # $n > 0: round to $nth digit left of dec. point + # $n < 0: round to $nth digit right of dec. point + $x->bfloor(); # round towards minus infinity + $x->bceil(); # round towards plus infinity + $x->bint(); # round towards zero + + # Other mathematical methods + + $x->bgcd($y); # greatest common divisor + $x->blcm($y); # least common multiple + + # Object property methods (do not modify the invocand) + + $x->sign(); # the sign, either +, - or NaN + $x->digit($n); # the nth digit, counting from the right + $x->digit(-$n); # the nth digit, counting from the left + $x->length(); # return number of digits in number + ($xl,$f) = $x->length(); # length of number and length of fraction + # part, latter is always 0 digits long + # for Math::BigInt objects + $x->mantissa(); # return (signed) mantissa as BigInt + $x->exponent(); # return exponent as BigInt + $x->parts(); # return (mantissa,exponent) as BigInt + $x->sparts(); # mantissa and exponent (as integers) + $x->nparts(); # mantissa and exponent (normalised) + $x->eparts(); # mantissa and exponent (engineering notation) + $x->dparts(); # integer and fraction part + + # Conversion methods (do not modify the invocand) + + $x->bstr(); # decimal notation, possibly zero padded + $x->bsstr(); # string in scientific notation with integers + $x->bnstr(); # string in normalized notation + $x->bestr(); # string in engineering notation + $x->bdstr(); # string in decimal notation + $x->as_hex(); # as signed hexadecimal string with prefixed 0x + $x->as_bin(); # as signed binary string with prefixed 0b + $x->as_oct(); # as signed octal string with prefixed 0 + $x->to_ieee754($format); # to bytes encoded according to IEEE 754-2008 + + # Other conversion methods + + $x->numify(); # return as scalar (might overflow or underflow) + +=head1 DESCRIPTION + +Math::BigFloat provides support for arbitrary precision floating point. +Overloading is also provided for Perl operators. + +All operators (including basic math operations) are overloaded if you +declare your big floating point numbers as + + $x = Math::BigFloat -> new('12_3.456_789_123_456_789E-2'); + +Operations with overloaded operators preserve the arguments, which is +exactly what you expect. + +=head2 Input + +Input values to these routines may be any scalar number or string that looks +like a number and represents a floating point number. + +=over + +=item * + +Leading and trailing whitespace is ignored. + +=item * + +Leading and trailing zeros are ignored. + +=item * + +If the string has a "0x" prefix, it is interpreted as a hexadecimal number. + +=item * + +If the string has a "0b" prefix, it is interpreted as a binary number. + +=item * + +For hexadecimal and binary numbers, the exponent must be separated from the +significand (mantissa) by the letter "p" or "P", not "e" or "E" as with decimal +numbers. + +=item * + +One underline is allowed between any two digits, including hexadecimal and +binary digits. + +=item * + +If the string can not be interpreted, NaN is returned. + +=back + +Octal numbers are typically prefixed by "0", but since leading zeros are +stripped, these methods can not automatically recognize octal numbers, so use +the constructor from_oct() to interpret octal strings. + +Some examples of valid string input + + Input string Resulting value + 123 123 + 1.23e2 123 + 12300e-2 123 + 0xcafe 51966 + 0b1101 13 + 67_538_754 67538754 + -4_5_6.7_8_9e+0_1_0 -4567890000000 + 0x1.921fb5p+1 3.14159262180328369140625e+0 + 0b1.1001p-4 9.765625e-2 + +=head2 Output + +Output values are usually Math::BigFloat objects. + +Boolean operators C<is_zero()>, C<is_one()>, C<is_inf()>, etc. return true or +false. + +Comparison operators C<bcmp()> and C<bacmp()>) return -1, 0, 1, or +undef. + +=head1 METHODS + +Math::BigFloat supports all methods that Math::BigInt supports, except it +calculates non-integer results when possible. Please see L<Math::BigInt> for a +full description of each method. Below are just the most important differences: + +=head2 Configuration methods + +=over + +=item accuracy() + + $x->accuracy(5); # local for $x + CLASS->accuracy(5); # global for all members of CLASS + # Note: This also applies to new()! + + $A = $x->accuracy(); # read out accuracy that affects $x + $A = CLASS->accuracy(); # read out global accuracy + +Set or get the global or local accuracy, aka how many significant digits the +results have. If you set a global accuracy, then this also applies to new()! + +Warning! The accuracy I<sticks>, e.g. once you created a number under the +influence of C<< CLASS->accuracy($A) >>, all results from math operations with +that number will also be rounded. + +In most cases, you should probably round the results explicitly using one of +L<Math::BigInt/round()>, L<Math::BigInt/bround()> or L<Math::BigInt/bfround()> +or by passing the desired accuracy to the math operation as additional +parameter: + + my $x = Math::BigInt->new(30000); + my $y = Math::BigInt->new(7); + print scalar $x->copy()->bdiv($y, 2); # print 4300 + print scalar $x->copy()->bdiv($y)->bround(2); # print 4300 + +=item precision() + + $x->precision(-2); # local for $x, round at the second + # digit right of the dot + $x->precision(2); # ditto, round at the second digit + # left of the dot + + CLASS->precision(5); # Global for all members of CLASS + # This also applies to new()! + CLASS->precision(-5); # ditto + + $P = CLASS->precision(); # read out global precision + $P = $x->precision(); # read out precision that affects $x + +Note: You probably want to use L</accuracy()> instead. With L</accuracy()> you +set the number of digits each result should have, with L</precision()> you +set the place where to round! + +=back + +=head2 Constructor methods + +=over + +=item from_hex() + + $x -> from_hex("0x1.921fb54442d18p+1"); + $x = Math::BigFloat -> from_hex("0x1.921fb54442d18p+1"); + +Interpret input as a hexadecimal string.A prefix ("0x", "x", ignoring case) is +optional. A single underscore character ("_") may be placed between any two +digits. If the input is invalid, a NaN is returned. The exponent is in base 2 +using decimal digits. + +If called as an instance method, the value is assigned to the invocand. + +=item from_oct() + + $x -> from_oct("1.3267p-4"); + $x = Math::BigFloat -> from_oct("1.3267p-4"); + +Interpret input as an octal string. A single underscore character ("_") may be +placed between any two digits. If the input is invalid, a NaN is returned. The +exponent is in base 2 using decimal digits. + +If called as an instance method, the value is assigned to the invocand. + +=item from_bin() + + $x -> from_bin("0b1.1001p-4"); + $x = Math::BigFloat -> from_bin("0b1.1001p-4"); + +Interpret input as a hexadecimal string. A prefix ("0b" or "b", ignoring case) +is optional. A single underscore character ("_") may be placed between any two +digits. If the input is invalid, a NaN is returned. The exponent is in base 2 +using decimal digits. + +If called as an instance method, the value is assigned to the invocand. + +=item from_ieee754() + +Interpret the input as a value encoded as described in IEEE754-2008. The input +can be given as a byte string, hex string or binary string. The input is +assumed to be in big-endian byte-order. + + # both $dbl and $mbf are 3.141592... + $bytes = "\x40\x09\x21\xfb\x54\x44\x2d\x18"; + $dbl = unpack "d>", $bytes; + $mbf = Math::BigFloat -> from_ieee754($bytes, "binary64"); + +=item bpi() + + print Math::BigFloat->bpi(100), "\n"; + +Calculate PI to N digits (including the 3 before the dot). The result is +rounded according to the current rounding mode, which defaults to "even". + +This method was added in v1.87 of Math::BigInt (June 2007). + +=back + +=head2 Arithmetic methods + +=over + +=item bmuladd() + + $x->bmuladd($y,$z); + +Multiply $x by $y, and then add $z to the result. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item bdiv() + + $q = $x->bdiv($y); + ($q, $r) = $x->bdiv($y); + +In scalar context, divides $x by $y and returns the result to the given or +default accuracy/precision. In list context, does floored division +(F-division), returning an integer $q and a remainder $r so that $x = $q * $y + +$r. The remainer (modulo) is equal to what is returned by C<< $x->bmod($y) >>. + +=item bmod() + + $x->bmod($y); + +Returns $x modulo $y. When $x is finite, and $y is finite and non-zero, the +result is identical to the remainder after floored division (F-division). If, +in addition, both $x and $y are integers, the result is identical to the result +from Perl's % operator. + +=item bexp() + + $x->bexp($accuracy); # calculate e ** X + +Calculates the expression C<e ** $x> where C<e> is Euler's number. + +This method was added in v1.82 of Math::BigInt (April 2007). + +=item bnok() + + $x->bnok($y); # x over y (binomial coefficient n over k) + +Calculates the binomial coefficient n over k, also called the "choose" +function. The result is equivalent to: + + ( n ) n! + | - | = ------- + ( k ) k!(n-k)! + +This method was added in v1.84 of Math::BigInt (April 2007). + +=item bsin() + + my $x = Math::BigFloat->new(1); + print $x->bsin(100), "\n"; + +Calculate the sinus of $x, modifying $x in place. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item bcos() + + my $x = Math::BigFloat->new(1); + print $x->bcos(100), "\n"; + +Calculate the cosinus of $x, modifying $x in place. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item batan() + + my $x = Math::BigFloat->new(1); + print $x->batan(100), "\n"; + +Calculate the arcus tanges of $x, modifying $x in place. See also L</batan2()>. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item batan2() + + my $y = Math::BigFloat->new(2); + my $x = Math::BigFloat->new(3); + print $y->batan2($x), "\n"; + +Calculate the arcus tanges of C<$y> divided by C<$x>, modifying $y in place. +See also L</batan()>. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item as_float() + +This method is called when Math::BigFloat encounters an object it doesn't know +how to handle. For instance, assume $x is a Math::BigFloat, or subclass +thereof, and $y is defined, but not a Math::BigFloat, or subclass thereof. If +you do + + $x -> badd($y); + +$y needs to be converted into an object that $x can deal with. This is done by +first checking if $y is something that $x might be upgraded to. If that is the +case, no further attempts are made. The next is to see if $y supports the +method C<as_float()>. The method C<as_float()> is expected to return either an +object that has the same class as $x, a subclass thereof, or a string that +C<ref($x)-E<gt>new()> can parse to create an object. + +In Math::BigFloat, C<as_float()> has the same effect as C<copy()>. + +=item to_ieee754() + +Encodes the invocand as a byte string in the given format as specified in IEEE +754-2008. Note that the encoded value is the nearest possible representation of +the value. This value might not be exactly the same as the value in the +invocand. + + # $x = 3.1415926535897932385 + $x = Math::BigFloat -> bpi(30); + + $b = $x -> to_ieee754("binary64"); # encode as 8 bytes + $h = unpack "H*", $b; # "400921fb54442d18" + + # 3.141592653589793115997963... + $y = Math::BigFloat -> from_ieee754($h, "binary64"); + +All binary formats in IEEE 754-2008 are accepted. For convenience, som aliases +are recognized: "half" for "binary16", "single" for "binary32", "double" for +"binary64", "quadruple" for "binary128", "octuple" for "binary256", and +"sexdecuple" for "binary512". + +See also L<https://en.wikipedia.org/wiki/IEEE_754>. + +=back + +=head2 ACCURACY AND PRECISION + +See also: L<Rounding|/Rounding>. + +Math::BigFloat supports both precision (rounding to a certain place before or +after the dot) and accuracy (rounding to a certain number of digits). For a +full documentation, examples and tips on these topics please see the large +section about rounding in L<Math::BigInt>. + +Since things like C<sqrt(2)> or C<1 / 3> must presented with a limited +accuracy lest a operation consumes all resources, each operation produces +no more than the requested number of digits. + +If there is no global precision or accuracy set, B<and> the operation in +question was not called with a requested precision or accuracy, B<and> the +input $x has no accuracy or precision set, then a fallback parameter will +be used. For historical reasons, it is called C<div_scale> and can be accessed +via: + + $d = Math::BigFloat->div_scale(); # query + Math::BigFloat->div_scale($n); # set to $n digits + +The default value for C<div_scale> is 40. + +In case the result of one operation has more digits than specified, +it is rounded. The rounding mode taken is either the default mode, or the one +supplied to the operation after the I<scale>: + + $x = Math::BigFloat->new(2); + Math::BigFloat->accuracy(5); # 5 digits max + $y = $x->copy()->bdiv(3); # gives 0.66667 + $y = $x->copy()->bdiv(3,6); # gives 0.666667 + $y = $x->copy()->bdiv(3,6,undef,'odd'); # gives 0.666667 + Math::BigFloat->round_mode('zero'); + $y = $x->copy()->bdiv(3,6); # will also give 0.666667 + +Note that C<< Math::BigFloat->accuracy() >> and C<< Math::BigFloat->precision() >> +set the global variables, and thus B<any> newly created number will be subject +to the global rounding B<immediately>. This means that in the examples above, the +C<3> as argument to C<bdiv()> will also get an accuracy of B<5>. + +It is less confusing to either calculate the result fully, and afterwards +round it explicitly, or use the additional parameters to the math +functions like so: + + use Math::BigFloat; + $x = Math::BigFloat->new(2); + $y = $x->copy()->bdiv(3); + print $y->bround(5),"\n"; # gives 0.66667 + + or + + use Math::BigFloat; + $x = Math::BigFloat->new(2); + $y = $x->copy()->bdiv(3,5); # gives 0.66667 + print "$y\n"; + +=head2 Rounding + +=over + +=item bfround ( +$scale ) + +Rounds to the $scale'th place left from the '.', counting from the dot. +The first digit is numbered 1. + +=item bfround ( -$scale ) + +Rounds to the $scale'th place right from the '.', counting from the dot. + +=item bfround ( 0 ) + +Rounds to an integer. + +=item bround ( +$scale ) + +Preserves accuracy to $scale digits from the left (aka significant digits) and +pads the rest with zeros. If the number is between 1 and -1, the significant +digits count from the first non-zero after the '.' + +=item bround ( -$scale ) and bround ( 0 ) + +These are effectively no-ops. + +=back + +All rounding functions take as a second parameter a rounding mode from one of +the following: 'even', 'odd', '+inf', '-inf', 'zero', 'trunc' or 'common'. + +The default rounding mode is 'even'. By using +C<< Math::BigFloat->round_mode($round_mode); >> you can get and set the default +mode for subsequent rounding. The usage of C<$Math::BigFloat::$round_mode> is +no longer supported. +The second parameter to the round functions then overrides the default +temporarily. + +The C<as_number()> function returns a BigInt from a Math::BigFloat. It uses +'trunc' as rounding mode to make it equivalent to: + + $x = 2.5; + $y = int($x) + 2; + +You can override this by passing the desired rounding mode as parameter to +C<as_number()>: + + $x = Math::BigFloat->new(2.5); + $y = $x->as_number('odd'); # $y = 3 + +=head1 Autocreating constants + +After C<use Math::BigFloat ':constant'> all the floating point constants +in the given scope are converted to C<Math::BigFloat>. This conversion +happens at compile time. + +In particular + + perl -MMath::BigFloat=:constant -e 'print 2E-100,"\n"' + +prints the value of C<2E-100>. Note that without conversion of +constants the expression 2E-100 will be calculated as normal floating point +number. + +Please note that ':constant' does not affect integer constants, nor binary +nor hexadecimal constants. Use L<bignum> or L<Math::BigInt> to get this to +work. + +=head2 Math library + +Math with the numbers is done (by default) by a module called +Math::BigInt::Calc. This is equivalent to saying: + + use Math::BigFloat lib => 'Calc'; + +You can change this by using: + + use Math::BigFloat lib => 'GMP'; + +B<Note>: General purpose packages should not be explicit about the library +to use; let the script author decide which is best. + +Note: The keyword 'lib' will warn when the requested library could not be +loaded. To suppress the warning use 'try' instead: + + use Math::BigFloat try => 'GMP'; + +If your script works with huge numbers and Calc is too slow for them, +you can also for the loading of one of these libraries and if none +of them can be used, the code will die: + + use Math::BigFloat only => 'GMP,Pari'; + +The following would first try to find Math::BigInt::Foo, then +Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc: + + use Math::BigFloat lib => 'Foo,Math::BigInt::Bar'; + +See the respective low-level library documentation for further details. + +Please note that Math::BigFloat does B<not> use the denoted library itself, +but it merely passes the lib argument to Math::BigInt. So, instead of the need +to do: + + use Math::BigInt lib => 'GMP'; + use Math::BigFloat; + +you can roll it all into one line: + + use Math::BigFloat lib => 'GMP'; + +It is also possible to just require Math::BigFloat: + + require Math::BigFloat; + +This will load the necessary things (like BigInt) when they are needed, and +automatically. + +See L<Math::BigInt> for more details than you ever wanted to know about using +a different low-level library. + +=head2 Using Math::BigInt::Lite + +For backwards compatibility reasons it is still possible to +request a different storage class for use with Math::BigFloat: + + use Math::BigFloat with => 'Math::BigInt::Lite'; + +However, this request is ignored, as the current code now uses the low-level +math library for directly storing the number parts. + +=head1 EXPORTS + +C<Math::BigFloat> exports nothing by default, but can export the C<bpi()> method: + + use Math::BigFloat qw/bpi/; + + print bpi(10), "\n"; + +=head1 CAVEATS + +Do not try to be clever to insert some operations in between switching +libraries: + + require Math::BigFloat; + my $matter = Math::BigFloat->bone() + 4; # load BigInt and Calc + Math::BigFloat->import( lib => 'Pari' ); # load Pari, too + my $anti_matter = Math::BigFloat->bone()+4; # now use Pari + +This will create objects with numbers stored in two different backend libraries, +and B<VERY BAD THINGS> will happen when you use these together: + + my $flash_and_bang = $matter + $anti_matter; # Don't do this! + +=over + +=item stringify, bstr() + +Both stringify and bstr() now drop the leading '+'. The old code would return +'+1.23', the new returns '1.23'. See the documentation in L<Math::BigInt> for +reasoning and details. + +=item brsft() + +The following will probably not print what you expect: + + my $c = Math::BigFloat->new('3.14159'); + print $c->brsft(3,10),"\n"; # prints 0.00314153.1415 + +It prints both quotient and remainder, since print calls C<brsft()> in list +context. Also, C<< $c->brsft() >> will modify $c, so be careful. +You probably want to use + + print scalar $c->copy()->brsft(3,10),"\n"; + # or if you really want to modify $c + print scalar $c->brsft(3,10),"\n"; + +instead. + +=item Modifying and = + +Beware of: + + $x = Math::BigFloat->new(5); + $y = $x; + +It will not do what you think, e.g. making a copy of $x. Instead it just makes +a second reference to the B<same> object and stores it in $y. Thus anything +that modifies $x will modify $y (except overloaded math operators), and vice +versa. See L<Math::BigInt> for details and how to avoid that. + +=item precision() vs. accuracy() + +A common pitfall is to use L</precision()> when you want to round a result to +a certain number of digits: + + use Math::BigFloat; + + Math::BigFloat->precision(4); # does not do what you + # think it does + my $x = Math::BigFloat->new(12345); # rounds $x to "12000"! + print "$x\n"; # print "12000" + my $y = Math::BigFloat->new(3); # rounds $y to "0"! + print "$y\n"; # print "0" + $z = $x / $y; # 12000 / 0 => NaN! + print "$z\n"; + print $z->precision(),"\n"; # 4 + +Replacing L</precision()> with L</accuracy()> is probably not what you want, either: + + use Math::BigFloat; + + Math::BigFloat->accuracy(4); # enables global rounding: + my $x = Math::BigFloat->new(123456); # rounded immediately + # to "12350" + print "$x\n"; # print "123500" + my $y = Math::BigFloat->new(3); # rounded to "3 + print "$y\n"; # print "3" + print $z = $x->copy()->bdiv($y),"\n"; # 41170 + print $z->accuracy(),"\n"; # 4 + +What you want to use instead is: + + use Math::BigFloat; + + my $x = Math::BigFloat->new(123456); # no rounding + print "$x\n"; # print "123456" + my $y = Math::BigFloat->new(3); # no rounding + print "$y\n"; # print "3" + print $z = $x->copy()->bdiv($y,4),"\n"; # 41150 + print $z->accuracy(),"\n"; # undef + +In addition to computing what you expected, the last example also does B<not> +"taint" the result with an accuracy or precision setting, which would +influence any further operation. + +=back + +=head1 BUGS + +Please report any bugs or feature requests to +C<bug-math-bigint at rt.cpan.org>, or through the web interface at +L<https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigInt> +(requires login). +We will be notified, and then you'll automatically be notified of progress on +your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Math::BigFloat + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt> + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/Math-BigInt> + +=item * CPAN Ratings + +L<https://cpanratings.perl.org/dist/Math-BigInt> + +=item * MetaCPAN + +L<https://metacpan.org/release/Math-BigInt> + +=item * CPAN Testers Matrix + +L<http://matrix.cpantesters.org/?dist=Math-BigInt> + +=item * The Bignum mailing list + +=over 4 + +=item * Post to mailing list + +C<bignum at lists.scsys.co.uk> + +=item * View mailing list + +L<http://lists.scsys.co.uk/pipermail/bignum/> + +=item * Subscribe/Unsubscribe + +L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> + +=back + +=back + +=head1 LICENSE + +This program is free software; you may redistribute it and/or modify it under +the same terms as Perl itself. + +=head1 SEE ALSO + +L<Math::BigFloat> and L<Math::BigInt> as well as the backends +L<Math::BigInt::FastCalc>, L<Math::BigInt::GMP>, and L<Math::BigInt::Pari>. + +The pragmas L<bignum>, L<bigint> and L<bigrat> also might be of interest +because they solve the autoupgrading/downgrading issue, at least partly. + +=head1 AUTHORS + +=over 4 + +=item * + +Mark Biggar, overloaded interface by Ilya Zakharevich, 1996-2001. + +=item * + +Completely rewritten by Tels L<http://bloodgate.com> in 2001-2008. + +=item * + +Florian Ragwitz E<lt>flora@cpan.orgE<gt>, 2010. + +=item * + +Peter John Acklam E<lt>pjacklam@online.noE<gt>, 2011-. + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Math/BigInt.pm b/data/miniconda3/lib/perl5/core_perl/Math/BigInt.pm new file mode 100644 index 0000000000000000000000000000000000000000..185f8028350db8ec5dbac790b80e7b61a4ed36f1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Math/BigInt.pm @@ -0,0 +1,6953 @@ +# -*- coding: utf-8-unix -*- + +package Math::BigInt; + +# +# "Mike had an infinite amount to do and a negative amount of time in which +# to do it." - Before and After +# + +# The following hash values are used: +# value: unsigned int with actual value (as a Math::BigInt::Calc or similar) +# sign : +, -, NaN, +inf, -inf +# _a : accuracy +# _p : precision + +# Remember not to take shortcuts ala $xs = $x->{value}; $LIB->foo($xs); since +# underlying lib might change the reference! + +use 5.006001; +use strict; +use warnings; + +use Carp qw< carp croak >; + +our $VERSION = '1.999818'; + +require Exporter; +our @ISA = qw(Exporter); +our @EXPORT_OK = qw(objectify bgcd blcm); + +# Inside overload, the first arg is always an object. If the original code had +# it reversed (like $x = 2 * $y), then the third parameter is true. +# In some cases (like add, $x = $x + 2 is the same as $x = 2 + $x) this makes +# no difference, but in some cases it does. + +# For overloaded ops with only one argument we simple use $_[0]->copy() to +# preserve the argument. + +# Thus inheritance of overload operators becomes possible and transparent for +# our subclasses without the need to repeat the entire overload section there. + +use overload + + # overload key: with_assign + + '+' => sub { $_[0] -> copy() -> badd($_[1]); }, + + '-' => sub { my $c = $_[0] -> copy; + $_[2] ? $c -> bneg() -> badd($_[1]) + : $c -> bsub($_[1]); }, + + '*' => sub { $_[0] -> copy() -> bmul($_[1]); }, + + '/' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bdiv($_[0]) + : $_[0] -> copy -> bdiv($_[1]); }, + + '%' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bmod($_[0]) + : $_[0] -> copy -> bmod($_[1]); }, + + '**' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bpow($_[0]) + : $_[0] -> copy -> bpow($_[1]); }, + + '<<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blsft($_[0]) + : $_[0] -> copy -> blsft($_[1]); }, + + '>>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> brsft($_[0]) + : $_[0] -> copy -> brsft($_[1]); }, + + # overload key: assign + + '+=' => sub { $_[0]->badd($_[1]); }, + + '-=' => sub { $_[0]->bsub($_[1]); }, + + '*=' => sub { $_[0]->bmul($_[1]); }, + + '/=' => sub { scalar $_[0]->bdiv($_[1]); }, + + '%=' => sub { $_[0]->bmod($_[1]); }, + + '**=' => sub { $_[0]->bpow($_[1]); }, + + '<<=' => sub { $_[0]->blsft($_[1]); }, + + '>>=' => sub { $_[0]->brsft($_[1]); }, + +# 'x=' => sub { }, + +# '.=' => sub { }, + + # overload key: num_comparison + + '<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blt($_[0]) + : $_[0] -> blt($_[1]); }, + + '<=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> ble($_[0]) + : $_[0] -> ble($_[1]); }, + + '>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bgt($_[0]) + : $_[0] -> bgt($_[1]); }, + + '>=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bge($_[0]) + : $_[0] -> bge($_[1]); }, + + '==' => sub { $_[0] -> beq($_[1]); }, + + '!=' => sub { $_[0] -> bne($_[1]); }, + + # overload key: 3way_comparison + + '<=>' => sub { my $cmp = $_[0] -> bcmp($_[1]); + defined($cmp) && $_[2] ? -$cmp : $cmp; }, + + 'cmp' => sub { $_[2] ? "$_[1]" cmp $_[0] -> bstr() + : $_[0] -> bstr() cmp "$_[1]"; }, + + # overload key: str_comparison + +# 'lt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrlt($_[0]) +# : $_[0] -> bstrlt($_[1]); }, +# +# 'le' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrle($_[0]) +# : $_[0] -> bstrle($_[1]); }, +# +# 'gt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrgt($_[0]) +# : $_[0] -> bstrgt($_[1]); }, +# +# 'ge' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrge($_[0]) +# : $_[0] -> bstrge($_[1]); }, +# +# 'eq' => sub { $_[0] -> bstreq($_[1]); }, +# +# 'ne' => sub { $_[0] -> bstrne($_[1]); }, + + # overload key: binary + + '&' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> band($_[0]) + : $_[0] -> copy -> band($_[1]); }, + + '&=' => sub { $_[0] -> band($_[1]); }, + + '|' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bior($_[0]) + : $_[0] -> copy -> bior($_[1]); }, + + '|=' => sub { $_[0] -> bior($_[1]); }, + + '^' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bxor($_[0]) + : $_[0] -> copy -> bxor($_[1]); }, + + '^=' => sub { $_[0] -> bxor($_[1]); }, + +# '&.' => sub { }, + +# '&.=' => sub { }, + +# '|.' => sub { }, + +# '|.=' => sub { }, + +# '^.' => sub { }, + +# '^.=' => sub { }, + + # overload key: unary + + 'neg' => sub { $_[0] -> copy() -> bneg(); }, + +# '!' => sub { }, + + '~' => sub { $_[0] -> copy() -> bnot(); }, + +# '~.' => sub { }, + + # overload key: mutators + + '++' => sub { $_[0] -> binc() }, + + '--' => sub { $_[0] -> bdec() }, + + # overload key: func + + 'atan2' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> batan2($_[0]) + : $_[0] -> copy() -> batan2($_[1]); }, + + 'cos' => sub { $_[0] -> copy -> bcos(); }, + + 'sin' => sub { $_[0] -> copy -> bsin(); }, + + 'exp' => sub { $_[0] -> copy() -> bexp($_[1]); }, + + 'abs' => sub { $_[0] -> copy() -> babs(); }, + + 'log' => sub { $_[0] -> copy() -> blog(); }, + + 'sqrt' => sub { $_[0] -> copy() -> bsqrt(); }, + + 'int' => sub { $_[0] -> copy() -> bint(); }, + + # overload key: conversion + + 'bool' => sub { $_[0] -> is_zero() ? '' : 1; }, + + '""' => sub { $_[0] -> bstr(); }, + + '0+' => sub { $_[0] -> numify(); }, + + '=' => sub { $_[0]->copy(); }, + + ; + +############################################################################## +# global constants, flags and accessory + +# These vars are public, but their direct usage is not recommended, use the +# accessor methods instead + +our $round_mode = 'even'; # one of 'even', 'odd', '+inf', '-inf', 'zero', 'trunc' or 'common' +our $accuracy = undef; +our $precision = undef; +our $div_scale = 40; +our $upgrade = undef; # default is no upgrade +our $downgrade = undef; # default is no downgrade + +# These are internally, and not to be used from the outside at all + +our $_trap_nan = 0; # are NaNs ok? set w/ config() +our $_trap_inf = 0; # are infs ok? set w/ config() + +my $nan = 'NaN'; # constants for easier life + +my $LIB = 'Math::BigInt::Calc'; # module to do the low level math + # default is Calc.pm +my $IMPORT = 0; # was import() called yet? + # used to make require work +my %CALLBACKS; # callbacks to notify on lib loads + +############################################################################## +# the old code had $rnd_mode, so we need to support it, too + +our $rnd_mode = 'even'; + +sub TIESCALAR { + my ($class) = @_; + bless \$round_mode, $class; +} + +sub FETCH { + return $round_mode; +} + +sub STORE { + $rnd_mode = $_[0]->round_mode($_[1]); +} + +BEGIN { + # tie to enable $rnd_mode to work transparently + tie $rnd_mode, 'Math::BigInt'; + + # set up some handy alias names + *as_int = \&as_number; + *is_pos = \&is_positive; + *is_neg = \&is_negative; +} + +############################################################################### +# Configuration methods +############################################################################### + +sub round_mode { + no strict 'refs'; + # make Class->round_mode() work + my $self = shift; + my $class = ref($self) || $self || __PACKAGE__; + if (defined $_[0]) { + my $m = shift; + if ($m !~ /^(even|odd|\+inf|\-inf|zero|trunc|common)$/) { + croak("Unknown round mode '$m'"); + } + return ${"${class}::round_mode"} = $m; + } + ${"${class}::round_mode"}; +} + +sub upgrade { + no strict 'refs'; + # make Class->upgrade() work + my $self = shift; + my $class = ref($self) || $self || __PACKAGE__; + # need to set new value? + if (@_ > 0) { + return ${"${class}::upgrade"} = $_[0]; + } + ${"${class}::upgrade"}; +} + +sub downgrade { + no strict 'refs'; + # make Class->downgrade() work + my $self = shift; + my $class = ref($self) || $self || __PACKAGE__; + # need to set new value? + if (@_ > 0) { + return ${"${class}::downgrade"} = $_[0]; + } + ${"${class}::downgrade"}; +} + +sub div_scale { + no strict 'refs'; + # make Class->div_scale() work + my $self = shift; + my $class = ref($self) || $self || __PACKAGE__; + if (defined $_[0]) { + if ($_[0] < 0) { + croak('div_scale must be greater than zero'); + } + ${"${class}::div_scale"} = $_[0]; + } + ${"${class}::div_scale"}; +} + +sub accuracy { + # $x->accuracy($a); ref($x) $a + # $x->accuracy(); ref($x) + # Class->accuracy(); class + # Class->accuracy($a); class $a + + my $x = shift; + my $class = ref($x) || $x || __PACKAGE__; + + no strict 'refs'; + if (@_ > 0) { + my $a = shift; + if (defined $a) { + $a = $a->numify() if ref($a) && $a->can('numify'); + # also croak on non-numerical + if (!$a || $a <= 0) { + croak('Argument to accuracy must be greater than zero'); + } + if (int($a) != $a) { + croak('Argument to accuracy must be an integer'); + } + } + + if (ref($x)) { + # Set instance variable. + $x->bround($a) if $a; # not for undef, 0 + $x->{_a} = $a; # set/overwrite, even if not rounded + delete $x->{_p}; # clear P + # Why return class variable here? Fixme! + $a = ${"${class}::accuracy"} unless defined $a; # proper return value + } else { + # Set class variable. + ${"${class}::accuracy"} = $a; # set global A + ${"${class}::precision"} = undef; # clear global P + } + + return $a; # shortcut + } + + # Return instance variable. + return $x->{_a} if ref($x) && (defined $x->{_a} || defined $x->{_p}); + + # Return class variable. + return ${"${class}::accuracy"}; +} + +sub precision { + # $x->precision($p); ref($x) $p + # $x->precision(); ref($x) + # Class->precision(); class + # Class->precision($p); class $p + + my $x = shift; + my $class = ref($x) || $x || __PACKAGE__; + + no strict 'refs'; + if (@_ > 0) { + my $p = shift; + if (defined $p) { + $p = $p->numify() if ref($p) && $p->can('numify'); + if ($p != int $p) { + croak('Argument to precision must be an integer'); + } + } + + if (ref($x)) { + # Set instance variable. + $x->bfround($p) if $p; # not for undef, 0 + $x->{_p} = $p; # set/overwrite, even if not rounded + delete $x->{_a}; # clear A + # Why return class variable here? Fixme! + $p = ${"${class}::precision"} unless defined $p; # proper return value + } else { + # Set class variable. + ${"${class}::precision"} = $p; # set global P + ${"${class}::accuracy"} = undef; # clear global A + } + + return $p; # shortcut + } + + # Return instance variable. + return $x->{_p} if ref($x) && (defined $x->{_a} || defined $x->{_p}); + + # Return class variable. + return ${"${class}::precision"}; +} + +sub config { + # return (or set) configuration data. + my $class = shift || __PACKAGE__; + + no strict 'refs'; + if (@_ > 1 || (@_ == 1 && (ref($_[0]) eq 'HASH'))) { + # try to set given options as arguments from hash + + my $args = $_[0]; + if (ref($args) ne 'HASH') { + $args = { @_ }; + } + # these values can be "set" + my $set_args = {}; + foreach my $key (qw/ + accuracy precision + round_mode div_scale + upgrade downgrade + trap_inf trap_nan + /) + { + $set_args->{$key} = $args->{$key} if exists $args->{$key}; + delete $args->{$key}; + } + if (keys %$args > 0) { + croak("Illegal key(s) '", join("', '", keys %$args), + "' passed to $class\->config()"); + } + foreach my $key (keys %$set_args) { + if ($key =~ /^trap_(inf|nan)\z/) { + ${"${class}::_trap_$1"} = ($set_args->{"trap_$1"} ? 1 : 0); + next; + } + # use a call instead of just setting the $variable to check argument + $class->$key($set_args->{$key}); + } + } + + # now return actual configuration + + my $cfg = { + lib => $LIB, + lib_version => ${"${LIB}::VERSION"}, + class => $class, + trap_nan => ${"${class}::_trap_nan"}, + trap_inf => ${"${class}::_trap_inf"}, + version => ${"${class}::VERSION"}, + }; + foreach my $key (qw/ + accuracy precision + round_mode div_scale + upgrade downgrade + /) + { + $cfg->{$key} = ${"${class}::$key"}; + } + if (@_ == 1 && (ref($_[0]) ne 'HASH')) { + # calls of the style config('lib') return just this value + return $cfg->{$_[0]}; + } + $cfg; +} + +sub _scale_a { + # select accuracy parameter based on precedence, + # used by bround() and bfround(), may return undef for scale (means no op) + my ($x, $scale, $mode) = @_; + + $scale = $x->{_a} unless defined $scale; + + no strict 'refs'; + my $class = ref($x); + + $scale = ${ $class . '::accuracy' } unless defined $scale; + $mode = ${ $class . '::round_mode' } unless defined $mode; + + if (defined $scale) { + $scale = $scale->can('numify') ? $scale->numify() + : "$scale" if ref($scale); + $scale = int($scale); + } + + ($scale, $mode); +} + +sub _scale_p { + # select precision parameter based on precedence, + # used by bround() and bfround(), may return undef for scale (means no op) + my ($x, $scale, $mode) = @_; + + $scale = $x->{_p} unless defined $scale; + + no strict 'refs'; + my $class = ref($x); + + $scale = ${ $class . '::precision' } unless defined $scale; + $mode = ${ $class . '::round_mode' } unless defined $mode; + + if (defined $scale) { + $scale = $scale->can('numify') ? $scale->numify() + : "$scale" if ref($scale); + $scale = int($scale); + } + + ($scale, $mode); +} + +############################################################################### +# Constructor methods +############################################################################### + +sub new { + # Create a new Math::BigInt object from a string or another Math::BigInt + # object. See hash keys documented at top. + + # The argument could be an object, so avoid ||, && etc. on it. This would + # cause costly overloaded code to be called. The only allowed ops are ref() + # and defined. + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # The POD says: + # + # "Currently, Math::BigInt->new() defaults to 0, while Math::BigInt->new('') + # results in 'NaN'. This might change in the future, so use always the + # following explicit forms to get a zero or NaN: + # $zero = Math::BigInt->bzero(); + # $nan = Math::BigInt->bnan(); + # + # But although this use has been discouraged for more than 10 years, people + # apparently still use it, so we still support it. + + return $self->bzero() unless @_; + + my ($wanted, $a, $p, $r) = @_; + + # Always return a new object, so if called as an instance method, copy the + # invocand, and if called as a class method, initialize a new object. + + $self = $selfref ? $self -> copy() + : bless {}, $class; + + unless (defined $wanted) { + #carp("Use of uninitialized value in new()"); + return $self->bzero($a, $p, $r); + } + + if (ref($wanted) && $wanted->isa($class)) { # MBI or subclass + # Using "$copy = $wanted -> copy()" here fails some tests. Fixme! + my $copy = $class -> copy($wanted); + if ($selfref) { + %$self = %$copy; + } else { + $self = $copy; + } + return $self; + } + + $class->import() if $IMPORT == 0; # make require work + + # Shortcut for non-zero scalar integers with no non-zero exponent. + + if (!ref($wanted) && + $wanted =~ / ^ + ([+-]?) # optional sign + ([1-9][0-9]*) # non-zero significand + (\.0*)? # ... with optional zero fraction + ([Ee][+-]?0+)? # optional zero exponent + \z + /x) + { + my $sgn = $1; + my $abs = $2; + $self->{sign} = $sgn || '+'; + $self->{value} = $LIB->_new($abs); + + no strict 'refs'; + if (defined($a) || defined($p) + || defined(${"${class}::precision"}) + || defined(${"${class}::accuracy"})) + { + $self->round($a, $p, $r) + unless @_ >= 3 && !defined $a && !defined $p; + } + + return $self; + } + + # Handle Infs. + + if ($wanted =~ /^\s*([+-]?)inf(inity)?\s*\z/i) { + my $sgn = $1 || '+'; + $self->{sign} = $sgn . 'inf'; # set a default sign for bstr() + return $class->binf($sgn); + } + + # Handle explicit NaNs (not the ones returned due to invalid input). + + if ($wanted =~ /^\s*([+-]?)nan\s*\z/i) { + $self = $class -> bnan(); + $self->round($a, $p, $r) unless @_ >= 3 && !defined $a && !defined $p; + return $self; + } + + # Handle hexadecimal numbers. + + if ($wanted =~ /^\s*[+-]?0[Xx]/) { + $self = $class -> from_hex($wanted); + $self->round($a, $p, $r) unless @_ >= 3 && !defined $a && !defined $p; + return $self; + } + + # Handle binary numbers. + + if ($wanted =~ /^\s*[+-]?0[Bb]/) { + $self = $class -> from_bin($wanted); + $self->round($a, $p, $r) unless @_ >= 3 && !defined $a && !defined $p; + return $self; + } + + # Split string into mantissa, exponent, integer, fraction, value, and sign. + my ($mis, $miv, $mfv, $es, $ev) = _split($wanted); + if (!ref $mis) { + if ($_trap_nan) { + croak("$wanted is not a number in $class"); + } + $self->{value} = $LIB->_zero(); + $self->{sign} = $nan; + return $self; + } + + if (!ref $miv) { + # _from_hex or _from_bin + $self->{value} = $mis->{value}; + $self->{sign} = $mis->{sign}; + return $self; # throw away $mis + } + + # Make integer from mantissa by adjusting exponent, then convert to a + # Math::BigInt. + $self->{sign} = $$mis; # store sign + $self->{value} = $LIB->_zero(); # for all the NaN cases + my $e = int("$$es$$ev"); # exponent (avoid recursion) + if ($e > 0) { + my $diff = $e - CORE::length($$mfv); + if ($diff < 0) { # Not integer + if ($_trap_nan) { + croak("$wanted not an integer in $class"); + } + #print "NOI 1\n"; + return $upgrade->new($wanted, $a, $p, $r) if defined $upgrade; + $self->{sign} = $nan; + } else { # diff >= 0 + # adjust fraction and add it to value + #print "diff > 0 $$miv\n"; + $$miv = $$miv . ($$mfv . '0' x $diff); + } + } + + else { + if ($$mfv ne '') { # e <= 0 + # fraction and negative/zero E => NOI + if ($_trap_nan) { + croak("$wanted not an integer in $class"); + } + #print "NOI 2 \$\$mfv '$$mfv'\n"; + return $upgrade->new($wanted, $a, $p, $r) if defined $upgrade; + $self->{sign} = $nan; + } elsif ($e < 0) { + # xE-y, and empty mfv + # Split the mantissa at the decimal point. E.g., if + # $$miv = 12345 and $e = -2, then $frac = 45 and $$miv = 123. + + my $frac = substr($$miv, $e); # $frac is fraction part + substr($$miv, $e) = ""; # $$miv is now integer part + + if ($frac =~ /[^0]/) { + if ($_trap_nan) { + croak("$wanted not an integer in $class"); + } + #print "NOI 3\n"; + return $upgrade->new($wanted, $a, $p, $r) if defined $upgrade; + $self->{sign} = $nan; + } + } + } + + unless ($self->{sign} eq $nan) { + $self->{sign} = '+' if $$miv eq '0'; # normalize -0 => +0 + $self->{value} = $LIB->_new($$miv) if $self->{sign} =~ /^[+-]$/; + } + + # If any of the globals are set, use them to round, and store them inside + # $self. Do not round for new($x, undef, undef) since that is used by MBF + # to signal no rounding. + + $self->round($a, $p, $r) unless @_ >= 3 && !defined $a && !defined $p; + $self; +} + +# Create a Math::BigInt from a hexadecimal string. + +sub from_hex { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_hex'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + ( [+-]? ) + (0?x)? + ( + [0-9a-fA-F]* + ( _ [0-9a-fA-F]+ )* + ) + \s* + $ + //x) + { + # Get a "clean" version of the string, i.e., non-emtpy and with no + # underscores or invalid characters. + + my $sign = $1; + my $chrs = $3; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + + # The library method requires a prefix. + + $self->{value} = $LIB->_from_hex('0x' . $chrs); + + # Place the sign. + + $self->{sign} = $sign eq '-' && ! $LIB->_is_zero($self->{value}) + ? '-' : '+'; + + return $self; + } + + # CORE::hex() parses as much as it can, and ignores any trailing garbage. + # For backwards compatibility, we return NaN. + + return $self->bnan(); +} + +# Create a Math::BigInt from an octal string. + +sub from_oct { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_oct'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + ( [+-]? ) + ( + [0-7]* + ( _ [0-7]+ )* + ) + \s* + $ + //x) + { + # Get a "clean" version of the string, i.e., non-emtpy and with no + # underscores or invalid characters. + + my $sign = $1; + my $chrs = $2; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + + # The library method requires a prefix. + + $self->{value} = $LIB->_from_oct('0' . $chrs); + + # Place the sign. + + $self->{sign} = $sign eq '-' && ! $LIB->_is_zero($self->{value}) + ? '-' : '+'; + + return $self; + } + + # CORE::oct() parses as much as it can, and ignores any trailing garbage. + # For backwards compatibility, we return NaN. + + return $self->bnan(); +} + +# Create a Math::BigInt from a binary string. + +sub from_bin { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_bin'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + if ($str =~ s/ + ^ + \s* + ( [+-]? ) + (0?b)? + ( + [01]* + ( _ [01]+ )* + ) + \s* + $ + //x) + { + # Get a "clean" version of the string, i.e., non-emtpy and with no + # underscores or invalid characters. + + my $sign = $1; + my $chrs = $3; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + + # The library method requires a prefix. + + $self->{value} = $LIB->_from_bin('0b' . $chrs); + + # Place the sign. + + $self->{sign} = $sign eq '-' && ! $LIB->_is_zero($self->{value}) + ? '-' : '+'; + + return $self; + } + + # For consistency with from_hex() and from_oct(), we return NaN when the + # input is invalid. + + return $self->bnan(); + +} + +# Create a Math::BigInt from a byte string. + +sub from_bytes { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_bytes'); + + croak("from_bytes() requires a newer version of the $LIB library.") + unless $LIB->can('_from_bytes'); + + my $str = shift; + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + $self -> {sign} = '+'; + $self -> {value} = $LIB -> _from_bytes($str); + return $self; +} + +sub from_base { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('from_base'); + + my $str = shift; + + my $base = shift; + $base = $class->new($base) unless ref($base); + + croak("the base must be a finite integer >= 2") + if $base < 2 || ! $base -> is_int(); + + # If called as a class method, initialize a new object. + + $self = $class -> bzero() unless $selfref; + + # If no collating sequence is given, pass some of the conversions to + # methods optimized for those cases. + + if (! @_) { + return $self -> from_bin($str) if $base == 2; + return $self -> from_oct($str) if $base == 8; + return $self -> from_hex($str) if $base == 16; + if ($base == 10) { + my $tmp = $class -> new($str); + $self -> {value} = $tmp -> {value}; + $self -> {sign} = '+'; + } + } + + croak("from_base() requires a newer version of the $LIB library.") + unless $LIB->can('_from_base'); + + $self -> {sign} = '+'; + $self -> {value} + = $LIB->_from_base($str, $base -> {value}, @_ ? shift() : ()); + return $self +} + +sub bzero { + # create/assign '+0' + + if (@_ == 0) { + #carp("Using bzero() as a function is deprecated;", + # " use bzero() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self->import() if $IMPORT == 0; # make require work + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('bzero'); + + $self = bless {}, $class unless $selfref; + + $self->{sign} = '+'; + $self->{value} = $LIB->_zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub bone { + # Create or assign '+1' (or -1 if given sign '-'). + + if (@_ == 0 || (defined($_[0]) && ($_[0] eq '+' || $_[0] eq '-'))) { + #carp("Using bone() as a function is deprecated;", + # " use bone() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self->import() if $IMPORT == 0; # make require work + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('bone'); + + my $sign = '+'; # default + if (@_) { + $sign = shift; + $sign = $sign =~ /^\s*-/ ? "-" : "+"; + } + + $self = bless {}, $class unless $selfref; + + $self->{sign} = $sign; + $self->{value} = $LIB->_one(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub binf { + # create/assign a '+inf' or '-inf' + + if (@_ == 0 || (defined($_[0]) && !ref($_[0]) && + $_[0] =~ /^\s*[+-](inf(inity)?)?\s*$/)) + { + #carp("Using binf() as a function is deprecated;", + # " use binf() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + { + no strict 'refs'; + if (${"${class}::_trap_inf"}) { + croak("Tried to create +-inf in $class->binf()"); + } + } + + $self->import() if $IMPORT == 0; # make require work + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('binf'); + + my $sign = shift; + $sign = defined $sign && $sign =~ /^\s*-/ ? "-" : "+"; + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = $sign . 'inf'; + $self -> {value} = $LIB -> _zero(); + + # If rounding parameters are given as arguments, use them. If no rounding + # parameters are given, and if called as a class method initialize the new + # instance with the class variables. + + if (@_) { + croak "can't specify both accuracy and precision" + if @_ >= 2 && defined $_[0] && defined $_[1]; + $self->{_a} = $_[0]; + $self->{_p} = $_[1]; + } else { + unless($selfref) { + $self->{_a} = $class -> accuracy(); + $self->{_p} = $class -> precision(); + } + } + + return $self; +} + +sub bnan { + # create/assign a 'NaN' + + if (@_ == 0) { + #carp("Using bnan() as a function is deprecated;", + # " use bnan() as a method instead"); + unshift @_, __PACKAGE__; + } + + my $self = shift; + my $selfref = ref($self); + my $class = $selfref || $self; + + { + no strict 'refs'; + if (${"${class}::_trap_nan"}) { + croak("Tried to create NaN in $class->bnan()"); + } + } + + $self->import() if $IMPORT == 0; # make require work + + # Don't modify constant (read-only) objects. + + return if $selfref && $self->modify('bnan'); + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = $nan; + $self -> {value} = $LIB -> _zero(); + + return $self; +} + +sub bpi { + # Calculate PI to N digits. Unless upgrading is in effect, returns the + # result truncated to an integer, that is, always returns '3'. + my ($self, $n) = @_; + if (@_ == 1) { + # called like Math::BigInt::bpi(10); + $n = $self; + $self = __PACKAGE__; + } + $self = ref($self) if ref($self); + + return $upgrade->new($n) if defined $upgrade; + + # hard-wired to "3" + $self->new(3); +} + +sub copy { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # If called as a class method, the object to copy is the next argument. + + $self = shift() unless $selfref; + + my $copy = bless {}, $class; + + $copy->{sign} = $self->{sign}; + $copy->{value} = $LIB->_copy($self->{value}); + $copy->{_a} = $self->{_a} if exists $self->{_a}; + $copy->{_p} = $self->{_p} if exists $self->{_p}; + + return $copy; +} + +sub as_number { + # An object might be asked to return itself as bigint on certain overloaded + # operations. This does exactly this, so that sub classes can simple inherit + # it or override with their own integer conversion routine. + $_[0]->copy(); +} + +############################################################################### +# Boolean methods +############################################################################### + +sub is_zero { + # return true if arg (BINT or num_str) is zero (array '+', '0') + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 0 if $x->{sign} !~ /^\+$/; # -, NaN & +-inf aren't + $LIB->_is_zero($x->{value}); +} + +sub is_one { + # return true if arg (BINT or num_str) is +1, or -1 if sign is given + my ($class, $x, $sign) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $sign = '+' if !defined $sign || $sign ne '-'; + + return 0 if $x->{sign} ne $sign; # -1 != +1, NaN, +-inf aren't either + $LIB->_is_one($x->{value}); +} + +sub is_finite { + my $x = shift; + return $x->{sign} eq '+' || $x->{sign} eq '-'; +} + +sub is_inf { + # return true if arg (BINT or num_str) is +-inf + my ($class, $x, $sign) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + if (defined $sign) { + $sign = '[+-]inf' if $sign eq ''; # +- doesn't matter, only that's inf + $sign = "[$1]inf" if $sign =~ /^([+-])(inf)?$/; # extract '+' or '-' + return $x->{sign} =~ /^$sign$/ ? 1 : 0; + } + $x->{sign} =~ /^[+-]inf$/ ? 1 : 0; # only +-inf is infinity +} + +sub is_nan { + # return true if arg (BINT or num_str) is NaN + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + $x->{sign} eq $nan ? 1 : 0; +} + +sub is_positive { + # return true when arg (BINT or num_str) is positive (> 0) + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 1 if $x->{sign} eq '+inf'; # +inf is positive + + # 0+ is neither positive nor negative + ($x->{sign} eq '+' && !$x->is_zero()) ? 1 : 0; +} + +sub is_negative { + # return true when arg (BINT or num_str) is negative (< 0) + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + $x->{sign} =~ /^-/ ? 1 : 0; # -inf is negative, but NaN is not +} + +sub is_non_negative { + # Return true if argument is non-negative (>= 0). + my ($class, $x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_); + + return 1 if $x->{sign} =~ /^\+/; + return 1 if $x -> is_zero(); + return 0; +} + +sub is_non_positive { + # Return true if argument is non-positive (<= 0). + my ($class, $x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_); + + return 1 if $x->{sign} =~ /^\-/; + return 1 if $x -> is_zero(); + return 0; +} + +sub is_odd { + # return true when arg (BINT or num_str) is odd, false for even + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 0 if $x->{sign} !~ /^[+-]$/; # NaN & +-inf aren't + $LIB->_is_odd($x->{value}); +} + +sub is_even { + # return true when arg (BINT or num_str) is even, false for odd + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 0 if $x->{sign} !~ /^[+-]$/; # NaN & +-inf aren't + $LIB->_is_even($x->{value}); +} + +sub is_int { + # return true when arg (BINT or num_str) is an integer + # always true for Math::BigInt, but different for Math::BigFloat objects + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + $x->{sign} =~ /^[+-]$/ ? 1 : 0; # inf/-inf/NaN aren't +} + +############################################################################### +# Comparison methods +############################################################################### + +sub bcmp { + # Compares 2 values. Returns one of undef, <0, =0, >0. (suitable for sort) + # (BINT or num_str, BINT or num_str) return cond_code + + # set up parameters + my ($class, $x, $y) = ref($_[0]) && ref($_[0]) eq ref($_[1]) + ? (ref($_[0]), @_) + : objectify(2, @_); + + return $upgrade->bcmp($x, $y) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + if (($x->{sign} !~ /^[+-]$/) || ($y->{sign} !~ /^[+-]$/)) { + # handle +-inf and NaN + return undef if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + return 0 if $x->{sign} eq $y->{sign} && $x->{sign} =~ /^[+-]inf$/; + return +1 if $x->{sign} eq '+inf'; + return -1 if $x->{sign} eq '-inf'; + return -1 if $y->{sign} eq '+inf'; + return +1; + } + # check sign for speed first + return 1 if $x->{sign} eq '+' && $y->{sign} eq '-'; # does also 0 <=> -y + return -1 if $x->{sign} eq '-' && $y->{sign} eq '+'; # does also -x <=> 0 + + # have same sign, so compare absolute values. Don't make tests for zero + # here because it's actually slower than testing in Calc (especially w/ Pari + # et al) + + # post-normalized compare for internal use (honors signs) + if ($x->{sign} eq '+') { + # $x and $y both > 0 + return $LIB->_acmp($x->{value}, $y->{value}); + } + + # $x && $y both < 0 + $LIB->_acmp($y->{value}, $x->{value}); # swapped acmp (lib returns 0, 1, -1) +} + +sub bacmp { + # Compares 2 values, ignoring their signs. + # Returns one of undef, <0, =0, >0. (suitable for sort) + # (BINT, BINT) return cond_code + + # set up parameters + my ($class, $x, $y) = ref($_[0]) && ref($_[0]) eq ref($_[1]) + ? (ref($_[0]), @_) + : objectify(2, @_); + + return $upgrade->bacmp($x, $y) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + if (($x->{sign} !~ /^[+-]$/) || ($y->{sign} !~ /^[+-]$/)) { + # handle +-inf and NaN + return undef if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + return 0 if $x->{sign} =~ /^[+-]inf$/ && $y->{sign} =~ /^[+-]inf$/; + return 1 if $x->{sign} =~ /^[+-]inf$/ && $y->{sign} !~ /^[+-]inf$/; + return -1; + } + $LIB->_acmp($x->{value}, $y->{value}); # lib does only 0, 1, -1 +} + +sub beq { + my $self = shift; + my $selfref = ref $self; + + croak 'beq() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for beq()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && ! $cmp; +} + +sub bne { + my $self = shift; + my $selfref = ref $self; + + croak 'bne() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for bne()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && ! $cmp ? '' : 1; +} + +sub blt { + my $self = shift; + my $selfref = ref $self; + + croak 'blt() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for blt()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp < 0; +} + +sub ble { + my $self = shift; + my $selfref = ref $self; + + croak 'ble() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for ble()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp <= 0; +} + +sub bgt { + my $self = shift; + my $selfref = ref $self; + + croak 'bgt() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for bgt()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp > 0; +} + +sub bge { + my $self = shift; + my $selfref = ref $self; + + croak 'bge() is an instance method, not a class method' + unless $selfref; + croak 'Wrong number of arguments for bge()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp >= 0; +} + +############################################################################### +# Arithmetic methods +############################################################################### + +sub bneg { + # (BINT or num_str) return BINT + # negate number or make a negated number from string + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x if $x->modify('bneg'); + + # for +0 do not negate (to have always normalized +0). Does nothing for 'NaN' + $x->{sign} =~ tr/+-/-+/ unless ($x->{sign} eq '+' && $LIB->_is_zero($x->{value})); + $x; +} + +sub babs { + # (BINT or num_str) return BINT + # make number absolute, or return absolute BINT from string + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x if $x->modify('babs'); + # post-normalized abs for internal use (does nothing for NaN) + $x->{sign} =~ s/^-/+/; + $x; +} + +sub bsgn { + # Signum function. + + my $self = shift; + + return $self if $self->modify('bsgn'); + + return $self -> bone("+") if $self -> is_pos(); + return $self -> bone("-") if $self -> is_neg(); + return $self; # zero or NaN +} + +sub bnorm { + # (numstr or BINT) return BINT + # Normalize number -- no-op here + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + $x; +} + +sub binc { + # increment arg by one + my ($class, $x, $a, $p, $r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + return $x if $x->modify('binc'); + + if ($x->{sign} eq '+') { + $x->{value} = $LIB->_inc($x->{value}); + return $x->round($a, $p, $r); + } elsif ($x->{sign} eq '-') { + $x->{value} = $LIB->_dec($x->{value}); + $x->{sign} = '+' if $LIB->_is_zero($x->{value}); # -1 +1 => -0 => +0 + return $x->round($a, $p, $r); + } + # inf, nan handling etc + $x->badd($class->bone(), $a, $p, $r); # badd does round +} + +sub bdec { + # decrement arg by one + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + return $x if $x->modify('bdec'); + + if ($x->{sign} eq '-') { + # x already < 0 + $x->{value} = $LIB->_inc($x->{value}); + } else { + return $x->badd($class->bone('-'), @r) + unless $x->{sign} eq '+'; # inf or NaN + # >= 0 + if ($LIB->_is_zero($x->{value})) { + # == 0 + $x->{value} = $LIB->_one(); + $x->{sign} = '-'; # 0 => -1 + } else { + # > 0 + $x->{value} = $LIB->_dec($x->{value}); + } + } + $x->round(@r); +} + +#sub bstrcmp { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrcmp() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrcmp()' unless @_ == 1; +# +# return $self -> bstr() CORE::cmp shift; +#} +# +#sub bstreq { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstreq() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstreq()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && ! $cmp; +#} +# +#sub bstrne { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrne() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrne()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && ! $cmp ? '' : 1; +#} +# +#sub bstrlt { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrlt() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrlt()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && $cmp < 0; +#} +# +#sub bstrle { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrle() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrle()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && $cmp <= 0; +#} +# +#sub bstrgt { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrgt() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrgt()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && $cmp > 0; +#} +# +#sub bstrge { +# my $self = shift; +# my $selfref = ref $self; +# my $class = $selfref || $self; +# +# croak 'bstrge() is an instance method, not a class method' +# unless $selfref; +# croak 'Wrong number of arguments for bstrge()' unless @_ == 1; +# +# my $cmp = $self -> bstrcmp(shift); +# return defined($cmp) && $cmp >= 0; +#} + +sub badd { + # add second arg (BINT or string) to first (BINT) (modifies first) + # return result as BINT + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('badd'); + return $upgrade->badd($upgrade->new($x), $upgrade->new($y), @r) if defined $upgrade && + ((!$x->isa($class)) || (!$y->isa($class))); + + $r[3] = $y; # no push! + # inf and NaN handling + if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/) { + # NaN first + return $x->bnan() if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + # inf handling + if (($x->{sign} =~ /^[+-]inf$/) && ($y->{sign} =~ /^[+-]inf$/)) { + # +inf++inf or -inf+-inf => same, rest is NaN + return $x if $x->{sign} eq $y->{sign}; + return $x->bnan(); + } + # +-inf + something => +inf + # something +-inf => +-inf + $x->{sign} = $y->{sign}, return $x if $y->{sign} =~ /^[+-]inf$/; + return $x; + } + + my ($sx, $sy) = ($x->{sign}, $y->{sign}); # get signs + + if ($sx eq $sy) { + $x->{value} = $LIB->_add($x->{value}, $y->{value}); # same sign, abs add + } else { + my $a = $LIB->_acmp ($y->{value}, $x->{value}); # absolute compare + if ($a > 0) { + $x->{value} = $LIB->_sub($y->{value}, $x->{value}, 1); # abs sub w/ swap + $x->{sign} = $sy; + } elsif ($a == 0) { + # speedup, if equal, set result to 0 + $x->{value} = $LIB->_zero(); + $x->{sign} = '+'; + } else # a < 0 + { + $x->{value} = $LIB->_sub($x->{value}, $y->{value}); # abs sub + } + } + $x->round(@r); +} + +sub bsub { + # (BINT or num_str, BINT or num_str) return BINT + # subtract second arg from first, modify first + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('bsub'); + + return $upgrade -> new($x) -> bsub($upgrade -> new($y), @r) + if defined $upgrade && (!$x -> isa($class) || !$y -> isa($class)); + + return $x -> round(@r) if $y -> is_zero(); + + # To correctly handle the lone special case $x -> bsub($x), we note the + # sign of $x, then flip the sign from $y, and if the sign of $x did change, + # too, then we caught the special case: + + my $xsign = $x -> {sign}; + $y -> {sign} =~ tr/+-/-+/; # does nothing for NaN + if ($xsign ne $x -> {sign}) { + # special case of $x -> bsub($x) results in 0 + return $x -> bzero(@r) if $xsign =~ /^[+-]$/; + return $x -> bnan(); # NaN, -inf, +inf + } + $x -> badd($y, @r); # badd does not leave internal zeros + $y -> {sign} =~ tr/+-/-+/; # refix $y (does nothing for NaN) + $x; # already rounded by badd() or no rounding +} + +sub bmul { + # multiply the first number by the second number + # (BINT or num_str, BINT or num_str) return BINT + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bmul'); + + return $x->bnan() if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + + # inf handling + if (($x->{sign} =~ /^[+-]inf$/) || ($y->{sign} =~ /^[+-]inf$/)) { + return $x->bnan() if $x->is_zero() || $y->is_zero(); + # result will always be +-inf: + # +inf * +/+inf => +inf, -inf * -/-inf => +inf + # +inf * -/-inf => -inf, -inf * +/+inf => -inf + return $x->binf() if ($x->{sign} =~ /^\+/ && $y->{sign} =~ /^\+/); + return $x->binf() if ($x->{sign} =~ /^-/ && $y->{sign} =~ /^-/); + return $x->binf('-'); + } + + return $upgrade->bmul($x, $upgrade->new($y), @r) + if defined $upgrade && !$y->isa($class); + + $r[3] = $y; # no push here + + $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; # +1 * +1 or -1 * -1 => + + + $x->{value} = $LIB->_mul($x->{value}, $y->{value}); # do actual math + $x->{sign} = '+' if $LIB->_is_zero($x->{value}); # no -0 + + $x->round(@r); +} + +sub bmuladd { + # multiply two numbers and then add the third to the result + # (BINT or num_str, BINT or num_str, BINT or num_str) return BINT + + # set up parameters + my ($class, $x, $y, $z, @r) = objectify(3, @_); + + return $x if $x->modify('bmuladd'); + + return $x->bnan() if (($x->{sign} eq $nan) || + ($y->{sign} eq $nan) || + ($z->{sign} eq $nan)); + + # inf handling of x and y + if (($x->{sign} =~ /^[+-]inf$/) || ($y->{sign} =~ /^[+-]inf$/)) { + return $x->bnan() if $x->is_zero() || $y->is_zero(); + # result will always be +-inf: + # +inf * +/+inf => +inf, -inf * -/-inf => +inf + # +inf * -/-inf => -inf, -inf * +/+inf => -inf + return $x->binf() if ($x->{sign} =~ /^\+/ && $y->{sign} =~ /^\+/); + return $x->binf() if ($x->{sign} =~ /^-/ && $y->{sign} =~ /^-/); + return $x->binf('-'); + } + # inf handling x*y and z + if (($z->{sign} =~ /^[+-]inf$/)) { + # something +-inf => +-inf + $x->{sign} = $z->{sign}, return $x if $z->{sign} =~ /^[+-]inf$/; + } + + return $upgrade->bmuladd($x, $upgrade->new($y), $upgrade->new($z), @r) + if defined $upgrade && (!$y->isa($class) || !$z->isa($class) || !$x->isa($class)); + + # TODO: what if $y and $z have A or P set? + $r[3] = $z; # no push here + + $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; # +1 * +1 or -1 * -1 => + + + $x->{value} = $LIB->_mul($x->{value}, $y->{value}); # do actual math + $x->{sign} = '+' if $LIB->_is_zero($x->{value}); # no -0 + + my ($sx, $sz) = ( $x->{sign}, $z->{sign} ); # get signs + + if ($sx eq $sz) { + $x->{value} = $LIB->_add($x->{value}, $z->{value}); # same sign, abs add + } else { + my $a = $LIB->_acmp ($z->{value}, $x->{value}); # absolute compare + if ($a > 0) { + $x->{value} = $LIB->_sub($z->{value}, $x->{value}, 1); # abs sub w/ swap + $x->{sign} = $sz; + } elsif ($a == 0) { + # speedup, if equal, set result to 0 + $x->{value} = $LIB->_zero(); + $x->{sign} = '+'; + } else # a < 0 + { + $x->{value} = $LIB->_sub($x->{value}, $z->{value}); # abs sub + } + } + $x->round(@r); +} + +sub bdiv { + # This does floored division, where the quotient is floored, i.e., rounded + # towards negative infinity. As a consequence, the remainder has the same + # sign as the divisor. + + # Set up parameters. + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify() is costly, so avoid it if we can. + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('bdiv'); + + my $wantarray = wantarray; # call only once + + # At least one argument is NaN. Return NaN for both quotient and the + # modulo/remainder. + + if ($x -> is_nan() || $y -> is_nan()) { + return $wantarray ? ($x -> bnan(), $class -> bnan()) : $x -> bnan(); + } + + # Divide by zero and modulo zero. + # + # Division: Use the common convention that x / 0 is inf with the same sign + # as x, except when x = 0, where we return NaN. This is also what earlier + # versions did. + # + # Modulo: In modular arithmetic, the congruence relation z = x (mod y) + # means that there is some integer k such that z - x = k y. If y = 0, we + # get z - x = 0 or z = x. This is also what earlier versions did, except + # that 0 % 0 returned NaN. + # + # inf / 0 = inf inf % 0 = inf + # 5 / 0 = inf 5 % 0 = 5 + # 0 / 0 = NaN 0 % 0 = 0 + # -5 / 0 = -inf -5 % 0 = -5 + # -inf / 0 = -inf -inf % 0 = -inf + + if ($y -> is_zero()) { + my $rem; + if ($wantarray) { + $rem = $x -> copy(); + } + if ($x -> is_zero()) { + $x -> bnan(); + } else { + $x -> binf($x -> {sign}); + } + return $wantarray ? ($x, $rem) : $x; + } + + # Numerator (dividend) is +/-inf, and denominator is finite and non-zero. + # The divide by zero cases are covered above. In all of the cases listed + # below we return the same as core Perl. + # + # inf / -inf = NaN inf % -inf = NaN + # inf / -5 = -inf inf % -5 = NaN + # inf / 5 = inf inf % 5 = NaN + # inf / inf = NaN inf % inf = NaN + # + # -inf / -inf = NaN -inf % -inf = NaN + # -inf / -5 = inf -inf % -5 = NaN + # -inf / 5 = -inf -inf % 5 = NaN + # -inf / inf = NaN -inf % inf = NaN + + if ($x -> is_inf()) { + my $rem; + $rem = $class -> bnan() if $wantarray; + if ($y -> is_inf()) { + $x -> bnan(); + } else { + my $sign = $x -> bcmp(0) == $y -> bcmp(0) ? '+' : '-'; + $x -> binf($sign); + } + return $wantarray ? ($x, $rem) : $x; + } + + # Denominator (divisor) is +/-inf. The cases when the numerator is +/-inf + # are covered above. In the modulo cases (in the right column) we return + # the same as core Perl, which does floored division, so for consistency we + # also do floored division in the division cases (in the left column). + # + # -5 / inf = -1 -5 % inf = inf + # 0 / inf = 0 0 % inf = 0 + # 5 / inf = 0 5 % inf = 5 + # + # -5 / -inf = 0 -5 % -inf = -5 + # 0 / -inf = 0 0 % -inf = 0 + # 5 / -inf = -1 5 % -inf = -inf + + if ($y -> is_inf()) { + my $rem; + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + $rem = $x -> copy() if $wantarray; + $x -> bzero(); + } else { + $rem = $class -> binf($y -> {sign}) if $wantarray; + $x -> bone('-'); + } + return $wantarray ? ($x, $rem) : $x; + } + + # At this point, both the numerator and denominator are finite numbers, and + # the denominator (divisor) is non-zero. + + return $upgrade -> bdiv($upgrade -> new($x), $upgrade -> new($y), @r) + if defined $upgrade; + + $r[3] = $y; # no push! + + # Inialize remainder. + + my $rem = $class -> bzero(); + + # Are both operands the same object, i.e., like $x -> bdiv($x)? If so, + # flipping the sign of $y also flips the sign of $x. + + my $xsign = $x -> {sign}; + my $ysign = $y -> {sign}; + + $y -> {sign} =~ tr/+-/-+/; # Flip the sign of $y, and see ... + my $same = $xsign ne $x -> {sign}; # ... if that changed the sign of $x. + $y -> {sign} = $ysign; # Re-insert the original sign. + + if ($same) { + $x -> bone(); + } else { + ($x -> {value}, $rem -> {value}) = + $LIB -> _div($x -> {value}, $y -> {value}); + + if ($LIB -> _is_zero($rem -> {value})) { + if ($xsign eq $ysign || $LIB -> _is_zero($x -> {value})) { + $x -> {sign} = '+'; + } else { + $x -> {sign} = '-'; + } + } else { + if ($xsign eq $ysign) { + $x -> {sign} = '+'; + } else { + if ($xsign eq '+') { + $x -> badd(1); + } else { + $x -> bsub(1); + } + $x -> {sign} = '-'; + } + } + } + + $x -> round(@r); + + if ($wantarray) { + unless ($LIB -> _is_zero($rem -> {value})) { + if ($xsign ne $ysign) { + $rem = $y -> copy() -> babs() -> bsub($rem); + } + $rem -> {sign} = $ysign; + } + $rem -> {_a} = $x -> {_a}; + $rem -> {_p} = $x -> {_p}; + $rem -> round(@r); + return ($x, $rem); + } + + return $x; +} + +sub btdiv { + # This does truncated division, where the quotient is truncted, i.e., + # rounded towards zero. + # + # ($q, $r) = $x -> btdiv($y) returns $q and $r so that $q is int($x / $y) + # and $q * $y + $r = $x. + + # Set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it if we can. + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('btdiv'); + + my $wantarray = wantarray; # call only once + + # At least one argument is NaN. Return NaN for both quotient and the + # modulo/remainder. + + if ($x -> is_nan() || $y -> is_nan()) { + return $wantarray ? ($x -> bnan(), $class -> bnan()) : $x -> bnan(); + } + + # Divide by zero and modulo zero. + # + # Division: Use the common convention that x / 0 is inf with the same sign + # as x, except when x = 0, where we return NaN. This is also what earlier + # versions did. + # + # Modulo: In modular arithmetic, the congruence relation z = x (mod y) + # means that there is some integer k such that z - x = k y. If y = 0, we + # get z - x = 0 or z = x. This is also what earlier versions did, except + # that 0 % 0 returned NaN. + # + # inf / 0 = inf inf % 0 = inf + # 5 / 0 = inf 5 % 0 = 5 + # 0 / 0 = NaN 0 % 0 = 0 + # -5 / 0 = -inf -5 % 0 = -5 + # -inf / 0 = -inf -inf % 0 = -inf + + if ($y -> is_zero()) { + my $rem; + if ($wantarray) { + $rem = $x -> copy(); + } + if ($x -> is_zero()) { + $x -> bnan(); + } else { + $x -> binf($x -> {sign}); + } + return $wantarray ? ($x, $rem) : $x; + } + + # Numerator (dividend) is +/-inf, and denominator is finite and non-zero. + # The divide by zero cases are covered above. In all of the cases listed + # below we return the same as core Perl. + # + # inf / -inf = NaN inf % -inf = NaN + # inf / -5 = -inf inf % -5 = NaN + # inf / 5 = inf inf % 5 = NaN + # inf / inf = NaN inf % inf = NaN + # + # -inf / -inf = NaN -inf % -inf = NaN + # -inf / -5 = inf -inf % -5 = NaN + # -inf / 5 = -inf -inf % 5 = NaN + # -inf / inf = NaN -inf % inf = NaN + + if ($x -> is_inf()) { + my $rem; + $rem = $class -> bnan() if $wantarray; + if ($y -> is_inf()) { + $x -> bnan(); + } else { + my $sign = $x -> bcmp(0) == $y -> bcmp(0) ? '+' : '-'; + $x -> binf($sign); + } + return $wantarray ? ($x, $rem) : $x; + } + + # Denominator (divisor) is +/-inf. The cases when the numerator is +/-inf + # are covered above. In the modulo cases (in the right column) we return + # the same as core Perl, which does floored division, so for consistency we + # also do floored division in the division cases (in the left column). + # + # -5 / inf = 0 -5 % inf = -5 + # 0 / inf = 0 0 % inf = 0 + # 5 / inf = 0 5 % inf = 5 + # + # -5 / -inf = 0 -5 % -inf = -5 + # 0 / -inf = 0 0 % -inf = 0 + # 5 / -inf = 0 5 % -inf = 5 + + if ($y -> is_inf()) { + my $rem; + $rem = $x -> copy() if $wantarray; + $x -> bzero(); + return $wantarray ? ($x, $rem) : $x; + } + + return $upgrade -> btdiv($upgrade -> new($x), $upgrade -> new($y), @r) + if defined $upgrade; + + $r[3] = $y; # no push! + + # Inialize remainder. + + my $rem = $class -> bzero(); + + # Are both operands the same object, i.e., like $x -> bdiv($x)? If so, + # flipping the sign of $y also flips the sign of $x. + + my $xsign = $x -> {sign}; + my $ysign = $y -> {sign}; + + $y -> {sign} =~ tr/+-/-+/; # Flip the sign of $y, and see ... + my $same = $xsign ne $x -> {sign}; # ... if that changed the sign of $x. + $y -> {sign} = $ysign; # Re-insert the original sign. + + if ($same) { + $x -> bone(); + } else { + ($x -> {value}, $rem -> {value}) = + $LIB -> _div($x -> {value}, $y -> {value}); + + $x -> {sign} = $xsign eq $ysign ? '+' : '-'; + $x -> {sign} = '+' if $LIB -> _is_zero($x -> {value}); + $x -> round(@r); + } + + if (wantarray) { + $rem -> {sign} = $xsign; + $rem -> {sign} = '+' if $LIB -> _is_zero($rem -> {value}); + $rem -> {_a} = $x -> {_a}; + $rem -> {_p} = $x -> {_p}; + $rem -> round(@r); + return ($x, $rem); + } + + return $x; +} + +sub bmod { + # This is the remainder after floored division. + + # Set up parameters. + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('bmod'); + $r[3] = $y; # no push! + + # At least one argument is NaN. + + if ($x -> is_nan() || $y -> is_nan()) { + return $x -> bnan(); + } + + # Modulo zero. See documentation for bdiv(). + + if ($y -> is_zero()) { + return $x; + } + + # Numerator (dividend) is +/-inf. + + if ($x -> is_inf()) { + return $x -> bnan(); + } + + # Denominator (divisor) is +/-inf. + + if ($y -> is_inf()) { + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + return $x; + } else { + return $x -> binf($y -> sign()); + } + } + + # Calc new sign and in case $y == +/- 1, return $x. + + $x -> {value} = $LIB -> _mod($x -> {value}, $y -> {value}); + if ($LIB -> _is_zero($x -> {value})) { + $x -> {sign} = '+'; # do not leave -0 + } else { + $x -> {value} = $LIB -> _sub($y -> {value}, $x -> {value}, 1) # $y-$x + if ($x -> {sign} ne $y -> {sign}); + $x -> {sign} = $y -> {sign}; + } + + $x -> round(@r); +} + +sub btmod { + # Remainder after truncated division. + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x -> modify('btmod'); + + # At least one argument is NaN. + + if ($x -> is_nan() || $y -> is_nan()) { + return $x -> bnan(); + } + + # Modulo zero. See documentation for btdiv(). + + if ($y -> is_zero()) { + return $x; + } + + # Numerator (dividend) is +/-inf. + + if ($x -> is_inf()) { + return $x -> bnan(); + } + + # Denominator (divisor) is +/-inf. + + if ($y -> is_inf()) { + return $x; + } + + return $upgrade -> btmod($upgrade -> new($x), $upgrade -> new($y), @r) + if defined $upgrade; + + $r[3] = $y; # no push! + + my $xsign = $x -> {sign}; + + $x -> {value} = $LIB -> _mod($x -> {value}, $y -> {value}); + + $x -> {sign} = $xsign; + $x -> {sign} = '+' if $LIB -> _is_zero($x -> {value}); + $x -> round(@r); + return $x; +} + +sub bmodinv { + # Return modular multiplicative inverse: + # + # z is the modular inverse of x (mod y) if and only if + # + # x*z ≡ 1 (mod y) + # + # If the modulus y is larger than one, x and z are relative primes (i.e., + # their greatest common divisor is one). + # + # If no modular multiplicative inverse exists, NaN is returned. + + # set up parameters + my ($class, $x, $y, @r) = (undef, @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bmodinv'); + + # Return NaN if one or both arguments is +inf, -inf, or nan. + + return $x->bnan() if ($y->{sign} !~ /^[+-]$/ || + $x->{sign} !~ /^[+-]$/); + + # Return NaN if $y is zero; 1 % 0 makes no sense. + + return $x->bnan() if $y->is_zero(); + + # Return 0 in the trivial case. $x % 1 or $x % -1 is zero for all finite + # integers $x. + + return $x->bzero() if ($y->is_one() || + $y->is_one('-')); + + # Return NaN if $x = 0, or $x modulo $y is zero. The only valid case when + # $x = 0 is when $y = 1 or $y = -1, but that was covered above. + # + # Note that computing $x modulo $y here affects the value we'll feed to + # $LIB->_modinv() below when $x and $y have opposite signs. E.g., if $x = + # 5 and $y = 7, those two values are fed to _modinv(), but if $x = -5 and + # $y = 7, the values fed to _modinv() are $x = 2 (= -5 % 7) and $y = 7. + # The value if $x is affected only when $x and $y have opposite signs. + + $x->bmod($y); + return $x->bnan() if $x->is_zero(); + + # Compute the modular multiplicative inverse of the absolute values. We'll + # correct for the signs of $x and $y later. Return NaN if no GCD is found. + + ($x->{value}, $x->{sign}) = $LIB->_modinv($x->{value}, $y->{value}); + return $x->bnan() if !defined $x->{value}; + + # Library inconsistency workaround: _modinv() in Math::BigInt::GMP versions + # <= 1.32 return undef rather than a "+" for the sign. + + $x->{sign} = '+' unless defined $x->{sign}; + + # When one or both arguments are negative, we have the following + # relations. If x and y are positive: + # + # modinv(-x, -y) = -modinv(x, y) + # modinv(-x, y) = y - modinv(x, y) = -modinv(x, y) (mod y) + # modinv( x, -y) = modinv(x, y) - y = modinv(x, y) (mod -y) + + # We must swap the sign of the result if the original $x is negative. + # However, we must compensate for ignoring the signs when computing the + # inverse modulo. The net effect is that we must swap the sign of the + # result if $y is negative. + + $x -> bneg() if $y->{sign} eq '-'; + + # Compute $x modulo $y again after correcting the sign. + + $x -> bmod($y) if $x->{sign} ne $y->{sign}; + + return $x; +} + +sub bmodpow { + # Modular exponentiation. Raises a very large number to a very large exponent + # in a given very large modulus quickly, thanks to binary exponentiation. + # Supports negative exponents. + my ($class, $num, $exp, $mod, @r) = objectify(3, @_); + + return $num if $num->modify('bmodpow'); + + # When the exponent 'e' is negative, use the following relation, which is + # based on finding the multiplicative inverse 'd' of 'b' modulo 'm': + # + # b^(-e) (mod m) = d^e (mod m) where b*d = 1 (mod m) + + $num->bmodinv($mod) if ($exp->{sign} eq '-'); + + # Check for valid input. All operands must be finite, and the modulus must be + # non-zero. + + return $num->bnan() if ($num->{sign} =~ /NaN|inf/ || # NaN, -inf, +inf + $exp->{sign} =~ /NaN|inf/ || # NaN, -inf, +inf + $mod->{sign} =~ /NaN|inf/); # NaN, -inf, +inf + + # Modulo zero. See documentation for Math::BigInt's bmod() method. + + if ($mod -> is_zero()) { + if ($num -> is_zero()) { + return $class -> bnan(); + } else { + return $num -> copy(); + } + } + + # Compute 'a (mod m)', ignoring the signs on 'a' and 'm'. If the resulting + # value is zero, the output is also zero, regardless of the signs on 'a' and + # 'm'. + + my $value = $LIB->_modpow($num->{value}, $exp->{value}, $mod->{value}); + my $sign = '+'; + + # If the resulting value is non-zero, we have four special cases, depending + # on the signs on 'a' and 'm'. + + unless ($LIB->_is_zero($value)) { + + # There is a negative sign on 'a' (= $num**$exp) only if the number we + # are exponentiating ($num) is negative and the exponent ($exp) is odd. + + if ($num->{sign} eq '-' && $exp->is_odd()) { + + # When both the number 'a' and the modulus 'm' have a negative sign, + # use this relation: + # + # -a (mod -m) = -(a (mod m)) + + if ($mod->{sign} eq '-') { + $sign = '-'; + } + + # When only the number 'a' has a negative sign, use this relation: + # + # -a (mod m) = m - (a (mod m)) + + else { + # Use copy of $mod since _sub() modifies the first argument. + my $mod = $LIB->_copy($mod->{value}); + $value = $LIB->_sub($mod, $value); + $sign = '+'; + } + + } else { + + # When only the modulus 'm' has a negative sign, use this relation: + # + # a (mod -m) = (a (mod m)) - m + # = -(m - (a (mod m))) + + if ($mod->{sign} eq '-') { + # Use copy of $mod since _sub() modifies the first argument. + my $mod = $LIB->_copy($mod->{value}); + $value = $LIB->_sub($mod, $value); + $sign = '-'; + } + + # When neither the number 'a' nor the modulus 'm' have a negative + # sign, directly return the already computed value. + # + # (a (mod m)) + + } + + } + + $num->{value} = $value; + $num->{sign} = $sign; + + return $num -> round(@r); +} + +sub bpow { + # (BINT or num_str, BINT or num_str) return BINT + # compute power of two numbers -- stolen from Knuth Vol 2 pg 233 + # modifies first argument + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bpow'); + + # $x and/or $y is a NaN + return $x->bnan() if $x->is_nan() || $y->is_nan(); + + # $x and/or $y is a +/-Inf + if ($x->is_inf("-")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x if $y->is_odd(); + return $x->bneg(); + } elsif ($x->is_inf("+")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x; + } elsif ($y->is_inf("-")) { + return $x->bnan() if $x -> is_one("-"); + return $x->binf("+") if $x -> is_zero(); + return $x->bone() if $x -> is_one("+"); + return $x->bzero(); + } elsif ($y->is_inf("+")) { + return $x->bnan() if $x -> is_one("-"); + return $x->bzero() if $x -> is_zero(); + return $x->bone() if $x -> is_one("+"); + return $x->binf("+"); + } + + return $upgrade->bpow($upgrade->new($x), $y, @r) + if defined $upgrade && (!$y->isa($class) || $y->{sign} eq '-'); + + $r[3] = $y; # no push! + + # 0 ** -y => ( 1 / (0 ** y)) => 1 / 0 => +inf + return $x->binf() if $y->is_negative() && $x->is_zero(); + + # 1 ** -y => 1 / (1 ** |y|) + return $x->bzero() if $y->is_negative() && !$LIB->_is_one($x->{value}); + + $x->{value} = $LIB->_pow($x->{value}, $y->{value}); + $x->{sign} = $x->is_negative() && $y->is_odd() ? '-' : '+'; + $x->round(@r); +} + +sub blog { + # Return the logarithm of the operand. If a second operand is defined, that + # value is used as the base, otherwise the base is assumed to be Euler's + # constant. + + my ($class, $x, $base, @r); + + # Don't objectify the base, since an undefined base, as in $x->blog() or + # $x->blog(undef) signals that the base is Euler's number. + + if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { + # E.g., Math::BigInt->blog(256, 2) + ($class, $x, $base, @r) = + defined $_[2] ? objectify(2, @_) : objectify(1, @_); + } else { + # E.g., Math::BigInt::blog(256, 2) or $x->blog(2) + ($class, $x, $base, @r) = + defined $_[1] ? objectify(2, @_) : objectify(1, @_); + } + + return $x if $x->modify('blog'); + + # Handle all exception cases and all trivial cases. I have used Wolfram + # Alpha (http://www.wolframalpha.com) as the reference for these cases. + + return $x -> bnan() if $x -> is_nan(); + + if (defined $base) { + $base = $class -> new($base) unless ref $base; + if ($base -> is_nan() || $base -> is_one()) { + return $x -> bnan(); + } elsif ($base -> is_inf() || $base -> is_zero()) { + return $x -> bnan() if $x -> is_inf() || $x -> is_zero(); + return $x -> bzero(); + } elsif ($base -> is_negative()) { # -inf < base < 0 + return $x -> bzero() if $x -> is_one(); # x = 1 + return $x -> bone() if $x == $base; # x = base + return $x -> bnan(); # otherwise + } + return $x -> bone() if $x == $base; # 0 < base && 0 < x < inf + } + + # We now know that the base is either undefined or >= 2 and finite. + + return $x -> binf('+') if $x -> is_inf(); # x = +/-inf + return $x -> bnan() if $x -> is_neg(); # -inf < x < 0 + return $x -> bzero() if $x -> is_one(); # x = 1 + return $x -> binf('-') if $x -> is_zero(); # x = 0 + + # At this point we are done handling all exception cases and trivial cases. + + return $upgrade -> blog($upgrade -> new($x), $base, @r) if defined $upgrade; + + # fix for bug #24969: + # the default base is e (Euler's number) which is not an integer + if (!defined $base) { + require Math::BigFloat; + my $u = Math::BigFloat->blog(Math::BigFloat->new($x))->as_int(); + # modify $x in place + $x->{value} = $u->{value}; + $x->{sign} = $u->{sign}; + return $x; + } + + my ($rc) = $LIB->_log_int($x->{value}, $base->{value}); + return $x->bnan() unless defined $rc; # not possible to take log? + $x->{value} = $rc; + $x->round(@r); +} + +sub bexp { + # Calculate e ** $x (Euler's number to the power of X), truncated to + # an integer value. + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + return $x if $x->modify('bexp'); + + # inf, -inf, NaN, <0 => NaN + return $x->bnan() if $x->{sign} eq 'NaN'; + return $x->bone() if $x->is_zero(); + return $x if $x->{sign} eq '+inf'; + return $x->bzero() if $x->{sign} eq '-inf'; + + my $u; + { + # run through Math::BigFloat unless told otherwise + require Math::BigFloat unless defined $upgrade; + local $upgrade = 'Math::BigFloat' unless defined $upgrade; + # calculate result, truncate it to integer + $u = $upgrade->bexp($upgrade->new($x), @r); + } + + if (defined $upgrade) { + $x = $u; + } else { + $u = $u->as_int(); + # modify $x in place + $x->{value} = $u->{value}; + $x->round(@r); + } +} + +sub bnok { + # Calculate n over k (binomial coefficient or "choose" function) as + # integer. + + # Set up parameters. + my ($self, $n, $k, @r) = (ref($_[0]), @_); + + # Objectify is costly, so avoid it. + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($self, $n, $k, @r) = objectify(2, @_); + } + + return $n if $n->modify('bnok'); + + # All cases where at least one argument is NaN. + + return $n->bnan() if $n->{sign} eq 'NaN' || $k->{sign} eq 'NaN'; + + # All cases where at least one argument is +/-inf. + + if ($n -> is_inf()) { + if ($k -> is_inf()) { # bnok(+/-inf,+/-inf) + return $n -> bnan(); + } elsif ($k -> is_neg()) { # bnok(+/-inf,k), k < 0 + return $n -> bzero(); + } elsif ($k -> is_zero()) { # bnok(+/-inf,k), k = 0 + return $n -> bone(); + } else { + if ($n -> is_inf("+")) { # bnok(+inf,k), 0 < k < +inf + return $n -> binf("+"); + } else { # bnok(-inf,k), k > 0 + my $sign = $k -> is_even() ? "+" : "-"; + return $n -> binf($sign); + } + } + } + + elsif ($k -> is_inf()) { # bnok(n,+/-inf), -inf <= n <= inf + return $n -> bnan(); + } + + # At this point, both n and k are real numbers. + + my $sign = 1; + + if ($n >= 0) { + if ($k < 0 || $k > $n) { + return $n -> bzero(); + } + } else { + + if ($k >= 0) { + + # n < 0 and k >= 0: bnok(n,k) = (-1)^k * bnok(-n+k-1,k) + + $sign = (-1) ** $k; + $n -> bneg() -> badd($k) -> bdec(); + + } elsif ($k <= $n) { + + # n < 0 and k <= n: bnok(n,k) = (-1)^(n-k) * bnok(-k-1,n-k) + + $sign = (-1) ** ($n - $k); + my $x0 = $n -> copy(); + $n -> bone() -> badd($k) -> bneg(); + $k = $k -> copy(); + $k -> bneg() -> badd($x0); + + } else { + + # n < 0 and n < k < 0: + + return $n -> bzero(); + } + } + + $n->{value} = $LIB->_nok($n->{value}, $k->{value}); + $n -> bneg() if $sign == -1; + + $n->round(@r); +} + +sub buparrow { + my $a = shift; + my $y = $a -> uparrow(@_); + $a -> {value} = $y -> {value}; + return $a; +} + +sub uparrow { + # Knuth's up-arrow notation buparrow(a, n, b) + # + # The following is a simple, recursive implementation of the up-arrow + # notation, just to show the idea. Such implementations cause "Deep + # recursion on subroutine ..." warnings, so we use a faster, non-recursive + # algorithm below with @_ as a stack. + # + # sub buparrow { + # my ($a, $n, $b) = @_; + # return $a ** $b if $n == 1; + # return $a * $b if $n == 0; + # return 1 if $b == 0; + # return buparrow($a, $n - 1, buparrow($a, $n, $b - 1)); + # } + + my ($a, $b, $n) = @_; + my $class = ref $a; + croak("a must be non-negative") if $a < 0; + croak("n must be non-negative") if $n < 0; + croak("b must be non-negative") if $b < 0; + + while (@_ >= 3) { + + # return $a ** $b if $n == 1; + + if ($_[-2] == 1) { + my ($a, $n, $b) = splice @_, -3; + push @_, $a ** $b; + next; + } + + # return $a * $b if $n == 0; + + if ($_[-2] == 0) { + my ($a, $n, $b) = splice @_, -3; + push @_, $a * $b; + next; + } + + # return 1 if $b == 0; + + if ($_[-1] == 0) { + splice @_, -3; + push @_, $class -> bone(); + next; + } + + # return buparrow($a, $n - 1, buparrow($a, $n, $b - 1)); + + my ($a, $n, $b) = splice @_, -3; + push @_, ($a, $n - 1, + $a, $n, $b - 1); + + } + + pop @_; +} + +sub backermann { + my $m = shift; + my $y = $m -> ackermann(@_); + $m -> {value} = $y -> {value}; + return $m; +} + +sub ackermann { + # Ackermann's function ackermann(m, n) + # + # The following is a simple, recursive implementation of the ackermann + # function, just to show the idea. Such implementations cause "Deep + # recursion on subroutine ..." warnings, so we use a faster, non-recursive + # algorithm below with @_ as a stack. + # + # sub ackermann { + # my ($m, $n) = @_; + # return $n + 1 if $m == 0; + # return ackermann($m - 1, 1) if $m > 0 && $n == 0; + # return ackermann($m - 1, ackermann($m, $n - 1) if $m > 0 && $n > 0; + # } + + my ($m, $n) = @_; + my $class = ref $m; + croak("m must be non-negative") if $m < 0; + croak("n must be non-negative") if $n < 0; + + my $two = $class -> new("2"); + my $three = $class -> new("3"); + my $thirteen = $class -> new("13"); + + $n = pop; + $n = $class -> new($n) unless ref($n); + while (@_) { + my $m = pop; + if ($m > $three) { + push @_, (--$m) x $n; + while (--$m >= $three) { + push @_, $m; + } + $n = $thirteen; + } elsif ($m == $three) { + $n = $class -> bone() -> blsft($n + $three) -> bsub($three); + } elsif ($m == $two) { + $n -> bmul($two) -> badd($three); + } elsif ($m >= 0) { + $n -> badd($m) -> binc(); + } else { + die "negative m!"; + } + } + $n; +} + +sub bsin { + # Calculate sinus(x) to N digits. Unless upgrading is in effect, returns the + # result truncated to an integer. + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bsin'); + + return $x->bnan() if $x->{sign} !~ /^[+-]\z/; # -inf +inf or NaN => NaN + + return $upgrade->new($x)->bsin(@r) if defined $upgrade; + + require Math::BigFloat; + # calculate the result and truncate it to integer + my $t = Math::BigFloat->new($x)->bsin(@r)->as_int(); + + $x->bone() if $t->is_one(); + $x->bzero() if $t->is_zero(); + $x->round(@r); +} + +sub bcos { + # Calculate cosinus(x) to N digits. Unless upgrading is in effect, returns the + # result truncated to an integer. + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bcos'); + + return $x->bnan() if $x->{sign} !~ /^[+-]\z/; # -inf +inf or NaN => NaN + + return $upgrade->new($x)->bcos(@r) if defined $upgrade; + + require Math::BigFloat; + # calculate the result and truncate it to integer + my $t = Math::BigFloat->new($x)->bcos(@r)->as_int(); + + $x->bone() if $t->is_one(); + $x->bzero() if $t->is_zero(); + $x->round(@r); +} + +sub batan { + # Calculate arcus tangens of x to N digits. Unless upgrading is in effect, returns the + # result truncated to an integer. + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('batan'); + + return $x->bnan() if $x->{sign} !~ /^[+-]\z/; # -inf +inf or NaN => NaN + + return $upgrade->new($x)->batan(@r) if defined $upgrade; + + # calculate the result and truncate it to integer + my $tmp = Math::BigFloat->new($x)->batan(@r); + + $x->{value} = $LIB->_new($tmp->as_int()->bstr()); + $x->round(@r); +} + +sub batan2 { + # calculate arcus tangens of ($y/$x) + + # set up parameters + my ($class, $y, $x, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $y, $x, @r) = objectify(2, @_); + } + + return $y if $y->modify('batan2'); + + return $y->bnan() if ($y->{sign} eq $nan) || ($x->{sign} eq $nan); + + # Y X + # != 0 -inf result is +- pi + if ($x->is_inf() || $y->is_inf()) { + # upgrade to Math::BigFloat etc. + return $upgrade->new($y)->batan2($upgrade->new($x), @r) if defined $upgrade; + if ($y->is_inf()) { + if ($x->{sign} eq '-inf') { + # calculate 3 pi/4 => 2.3.. => 2 + $y->bone(substr($y->{sign}, 0, 1)); + $y->bmul($class->new(2)); + } elsif ($x->{sign} eq '+inf') { + # calculate pi/4 => 0.7 => 0 + $y->bzero(); + } else { + # calculate pi/2 => 1.5 => 1 + $y->bone(substr($y->{sign}, 0, 1)); + } + } else { + if ($x->{sign} eq '+inf') { + # calculate pi/4 => 0.7 => 0 + $y->bzero(); + } else { + # PI => 3.1415.. => 3 + $y->bone(substr($y->{sign}, 0, 1)); + $y->bmul($class->new(3)); + } + } + return $y; + } + + return $upgrade->new($y)->batan2($upgrade->new($x), @r) if defined $upgrade; + + require Math::BigFloat; + my $r = Math::BigFloat->new($y) + ->batan2(Math::BigFloat->new($x), @r) + ->as_int(); + + $x->{value} = $r->{value}; + $x->{sign} = $r->{sign}; + + $x; +} + +sub bsqrt { + # calculate square root of $x + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bsqrt'); + + return $x->bnan() if $x->{sign} !~ /^\+/; # -x or -inf or NaN => NaN + return $x if $x->{sign} eq '+inf'; # sqrt(+inf) == inf + + return $upgrade->bsqrt($x, @r) if defined $upgrade; + + $x->{value} = $LIB->_sqrt($x->{value}); + $x->round(@r); +} + +sub broot { + # calculate $y'th root of $x + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + $y = $class->new(2) unless defined $y; + + # objectify is costly, so avoid it + if ((!ref($x)) || (ref($x) ne ref($y))) { + ($class, $x, $y, @r) = objectify(2, $class || $class, @_); + } + + return $x if $x->modify('broot'); + + # NaN handling: $x ** 1/0, x or y NaN, or y inf/-inf or y == 0 + return $x->bnan() if $x->{sign} !~ /^\+/ || $y->is_zero() || + $y->{sign} !~ /^\+$/; + + return $x->round(@r) + if $x->is_zero() || $x->is_one() || $x->is_inf() || $y->is_one(); + + return $upgrade->new($x)->broot($upgrade->new($y), @r) if defined $upgrade; + + $x->{value} = $LIB->_root($x->{value}, $y->{value}); + $x->round(@r); +} + +sub bfac { + # (BINT or num_str, BINT or num_str) return BINT + # compute factorial number from $x, modify $x in place + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bfac') || $x->{sign} eq '+inf'; # inf => inf + return $x->bnan() if $x->{sign} ne '+'; # NaN, <0 etc => NaN + + $x->{value} = $LIB->_fac($x->{value}); + $x->round(@r); +} + +sub bdfac { + # compute double factorial, modify $x in place + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bdfac') || $x->{sign} eq '+inf'; # inf => inf + return $x->bnan() if $x->{sign} ne '+'; # NaN, <0 etc => NaN + + croak("bdfac() requires a newer version of the $LIB library.") + unless $LIB->can('_dfac'); + + $x->{value} = $LIB->_dfac($x->{value}); + $x->round(@r); +} + +sub bfib { + # compute Fibonacci number(s) + my ($class, $x, @r) = objectify(1, @_); + + croak("bfib() requires a newer version of the $LIB library.") + unless $LIB->can('_fib'); + + return $x if $x->modify('bfib'); + + # List context. + + if (wantarray) { + return () if $x -> is_nan(); + croak("bfib() can't return an infinitely long list of numbers") + if $x -> is_inf(); + + # Use the backend library to compute the first $x Fibonacci numbers. + + my @values = $LIB->_fib($x->{value}); + + # Make objects out of them. The last element in the array is the + # invocand. + + for (my $i = 0 ; $i < $#values ; ++ $i) { + my $fib = $class -> bzero(); + $fib -> {value} = $values[$i]; + $values[$i] = $fib; + } + + $x -> {value} = $values[-1]; + $values[-1] = $x; + + # If negative, insert sign as appropriate. + + if ($x -> is_neg()) { + for (my $i = 2 ; $i <= $#values ; $i += 2) { + $values[$i]{sign} = '-'; + } + } + + @values = map { $_ -> round(@r) } @values; + return @values; + } + + # Scalar context. + + else { + return $x if $x->modify('bdfac') || $x -> is_inf('+'); + return $x->bnan() if $x -> is_nan() || $x -> is_inf('-'); + + $x->{sign} = $x -> is_neg() && $x -> is_even() ? '-' : '+'; + $x->{value} = $LIB->_fib($x->{value}); + return $x->round(@r); + } +} + +sub blucas { + # compute Lucas number(s) + my ($class, $x, @r) = objectify(1, @_); + + croak("blucas() requires a newer version of the $LIB library.") + unless $LIB->can('_lucas'); + + return $x if $x->modify('blucas'); + + # List context. + + if (wantarray) { + return () if $x -> is_nan(); + croak("blucas() can't return an infinitely long list of numbers") + if $x -> is_inf(); + + # Use the backend library to compute the first $x Lucas numbers. + + my @values = $LIB->_lucas($x->{value}); + + # Make objects out of them. The last element in the array is the + # invocand. + + for (my $i = 0 ; $i < $#values ; ++ $i) { + my $lucas = $class -> bzero(); + $lucas -> {value} = $values[$i]; + $values[$i] = $lucas; + } + + $x -> {value} = $values[-1]; + $values[-1] = $x; + + # If negative, insert sign as appropriate. + + if ($x -> is_neg()) { + for (my $i = 2 ; $i <= $#values ; $i += 2) { + $values[$i]{sign} = '-'; + } + } + + @values = map { $_ -> round(@r) } @values; + return @values; + } + + # Scalar context. + + else { + return $x if $x -> is_inf('+'); + return $x->bnan() if $x -> is_nan() || $x -> is_inf('-'); + + $x->{sign} = $x -> is_neg() && $x -> is_even() ? '-' : '+'; + $x->{value} = $LIB->_lucas($x->{value}); + return $x->round(@r); + } +} + +sub blsft { + # (BINT or num_str, BINT or num_str) return BINT + # compute x << y, base n, y >= 0 + + my ($class, $x, $y, $b, @r); + + # Objectify the base only when it is defined, since an undefined base, as + # in $x->blsft(3) or $x->blog(3, undef) means use the default base 2. + + if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { + # E.g., Math::BigInt->blog(256, 5, 2) + ($class, $x, $y, $b, @r) = + defined $_[3] ? objectify(3, @_) : objectify(2, @_); + } else { + # E.g., Math::BigInt::blog(256, 5, 2) or $x->blog(5, 2) + ($class, $x, $y, $b, @r) = + defined $_[2] ? objectify(3, @_) : objectify(2, @_); + } + + return $x if $x -> modify('blsft'); + return $x -> bnan() if ($x -> {sign} !~ /^[+-]$/ || + $y -> {sign} !~ /^[+-]$/); + return $x -> round(@r) if $y -> is_zero(); + + $b = defined($b) ? $b -> numify() : 2; + + # While some of the libraries support an arbitrarily large base, not all of + # them do, so rather than returning an incorrect result in those cases, + # disallow bases that don't work with all libraries. + + my $uintmax = ~0; + croak("Base is too large.") if $b > $uintmax; + + return $x -> bnan() if $b <= 0 || $y -> {sign} eq '-'; + + $x -> {value} = $LIB -> _lsft($x -> {value}, $y -> {value}, $b); + $x -> round(@r); +} + +sub brsft { + # (BINT or num_str, BINT or num_str) return BINT + # compute x >> y, base n, y >= 0 + + # set up parameters + my ($class, $x, $y, $b, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $b, @r) = objectify(2, @_); + } + + return $x if $x -> modify('brsft'); + return $x -> bnan() if ($x -> {sign} !~ /^[+-]$/ || $y -> {sign} !~ /^[+-]$/); + return $x -> round(@r) if $y -> is_zero(); + return $x -> bzero(@r) if $x -> is_zero(); # 0 => 0 + + $b = 2 if !defined $b; + return $x -> bnan() if $b <= 0 || $y -> {sign} eq '-'; + + # this only works for negative numbers when shifting in base 2 + if (($x -> {sign} eq '-') && ($b == 2)) { + return $x -> round(@r) if $x -> is_one('-'); # -1 => -1 + if (!$y -> is_one()) { + # although this is O(N*N) in calc (as_bin!) it is O(N) in Pari et + # al but perhaps there is a better emulation for two's complement + # shift... + # if $y != 1, we must simulate it by doing: + # convert to bin, flip all bits, shift, and be done + $x -> binc(); # -3 => -2 + my $bin = $x -> as_bin(); + $bin =~ s/^-0b//; # strip '-0b' prefix + $bin =~ tr/10/01/; # flip bits + # now shift + if ($y >= CORE::length($bin)) { + $bin = '0'; # shifting to far right creates -1 + # 0, because later increment makes + # that 1, attached '-' makes it '-1' + # because -1 >> x == -1 ! + } else { + $bin =~ s/.{$y}$//; # cut off at the right side + $bin = '1' . $bin; # extend left side by one dummy '1' + $bin =~ tr/10/01/; # flip bits back + } + my $res = $class -> new('0b' . $bin); # add prefix and convert back + $res -> binc(); # remember to increment + $x -> {value} = $res -> {value}; # take over value + return $x -> round(@r); # we are done now, magic, isn't? + } + + # x < 0, n == 2, y == 1 + $x -> bdec(); # n == 2, but $y == 1: this fixes it + } + + $x -> {value} = $LIB -> _rsft($x -> {value}, $y -> {value}, $b); + $x -> round(@r); +} + +############################################################################### +# Bitwise methods +############################################################################### + +sub band { + #(BINT or num_str, BINT or num_str) return BINT + # compute x & y + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('band'); + + $r[3] = $y; # no push! + + return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/); + + if ($x->{sign} eq '+' && $y->{sign} eq '+') { + $x->{value} = $LIB->_and($x->{value}, $y->{value}); + } else { + ($x->{value}, $x->{sign}) = $LIB->_sand($x->{value}, $x->{sign}, + $y->{value}, $y->{sign}); + } + return $x->round(@r); +} + +sub bior { + #(BINT or num_str, BINT or num_str) return BINT + # compute x | y + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bior'); + + $r[3] = $y; # no push! + + return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/); + + if ($x->{sign} eq '+' && $y->{sign} eq '+') { + $x->{value} = $LIB->_or($x->{value}, $y->{value}); + } else { + ($x->{value}, $x->{sign}) = $LIB->_sor($x->{value}, $x->{sign}, + $y->{value}, $y->{sign}); + } + return $x->round(@r); +} + +sub bxor { + #(BINT or num_str, BINT or num_str) return BINT + # compute x ^ y + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bxor'); + + $r[3] = $y; # no push! + + return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/); + + if ($x->{sign} eq '+' && $y->{sign} eq '+') { + $x->{value} = $LIB->_xor($x->{value}, $y->{value}); + } else { + ($x->{value}, $x->{sign}) = $LIB->_sxor($x->{value}, $x->{sign}, + $y->{value}, $y->{sign}); + } + return $x->round(@r); +} + +sub bnot { + # (num_str or BINT) return BINT + # represent ~x as twos-complement number + # we don't need $class, so undef instead of ref($_[0]) make it slightly faster + my ($class, $x) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + return $x if $x->modify('bnot'); + $x->binc()->bneg(); # binc already does round +} + +############################################################################### +# Rounding methods +############################################################################### + +sub round { + # Round $self according to given parameters, or given second argument's + # parameters or global defaults + + # for speed reasons, _find_round_parameters is embedded here: + + my ($self, $a, $p, $r, @args) = @_; + # $a accuracy, if given by caller + # $p precision, if given by caller + # $r round_mode, if given by caller + # @args all 'other' arguments (0 for unary, 1 for binary ops) + + my $class = ref($self); # find out class of argument(s) + no strict 'refs'; + + # now pick $a or $p, but only if we have got "arguments" + if (!defined $a) { + foreach ($self, @args) { + # take the defined one, or if both defined, the one that is smaller + $a = $_->{_a} if (defined $_->{_a}) && (!defined $a || $_->{_a} < $a); + } + } + if (!defined $p) { + # even if $a is defined, take $p, to signal error for both defined + foreach ($self, @args) { + # take the defined one, or if both defined, the one that is bigger + # -2 > -3, and 3 > 2 + $p = $_->{_p} if (defined $_->{_p}) && (!defined $p || $_->{_p} > $p); + } + } + + # if still none defined, use globals + unless (defined $a || defined $p) { + $a = ${"$class\::accuracy"}; + $p = ${"$class\::precision"}; + } + + # A == 0 is useless, so undef it to signal no rounding + $a = undef if defined $a && $a == 0; + + # no rounding today? + return $self unless defined $a || defined $p; # early out + + # set A and set P is an fatal error + return $self->bnan() if defined $a && defined $p; + + $r = ${"$class\::round_mode"} unless defined $r; + if ($r !~ /^(even|odd|[+-]inf|zero|trunc|common)$/) { + croak("Unknown round mode '$r'"); + } + + # now round, by calling either bround or bfround: + if (defined $a) { + $self->bround(int($a), $r) if !defined $self->{_a} || $self->{_a} >= $a; + } else { # both can't be undefined due to early out + $self->bfround(int($p), $r) if !defined $self->{_p} || $self->{_p} <= $p; + } + + # bround() or bfround() already called bnorm() if nec. + $self; +} + +sub bround { + # accuracy: +$n preserve $n digits from left, + # -$n preserve $n digits from right (f.i. for 0.1234 style in MBF) + # no-op for $n == 0 + # and overwrite the rest with 0's, return normalized number + # do not return $x->bnorm(), but $x + + my $x = shift; + $x = __PACKAGE__->new($x) unless ref $x; + my ($scale, $mode) = $x->_scale_a(@_); + return $x if !defined $scale || $x->modify('bround'); # no-op + + if ($x->is_zero() || $scale == 0) { + $x->{_a} = $scale if !defined $x->{_a} || $x->{_a} > $scale; # 3 > 2 + return $x; + } + return $x if $x->{sign} !~ /^[+-]$/; # inf, NaN + + # we have fewer digits than we want to scale to + my $len = $x->length(); + # convert $scale to a scalar in case it is an object (put's a limit on the + # number length, but this would already limited by memory constraints), makes + # it faster + $scale = $scale->numify() if ref ($scale); + + # scale < 0, but > -len (not >=!) + if (($scale < 0 && $scale < -$len-1) || ($scale >= $len)) { + $x->{_a} = $scale if !defined $x->{_a} || $x->{_a} > $scale; # 3 > 2 + return $x; + } + + # count of 0's to pad, from left (+) or right (-): 9 - +6 => 3, or |-6| => 6 + my ($pad, $digit_round, $digit_after); + $pad = $len - $scale; + $pad = abs($scale-1) if $scale < 0; + + # do not use digit(), it is very costly for binary => decimal + # getting the entire string is also costly, but we need to do it only once + my $xs = $LIB->_str($x->{value}); + my $pl = -$pad-1; + + # pad: 123: 0 => -1, at 1 => -2, at 2 => -3, at 3 => -4 + # pad+1: 123: 0 => 0, at 1 => -1, at 2 => -2, at 3 => -3 + $digit_round = '0'; + $digit_round = substr($xs, $pl, 1) if $pad <= $len; + $pl++; + $pl ++ if $pad >= $len; + $digit_after = '0'; + $digit_after = substr($xs, $pl, 1) if $pad > 0; + + # in case of 01234 we round down, for 6789 up, and only in case 5 we look + # closer at the remaining digits of the original $x, remember decision + my $round_up = 1; # default round up + $round_up -- if + ($mode eq 'trunc') || # trunc by round down + ($digit_after =~ /[01234]/) || # round down anyway, + # 6789 => round up + ($digit_after eq '5') && # not 5000...0000 + ($x->_scan_for_nonzero($pad, $xs, $len) == 0) && + ( + ($mode eq 'even') && ($digit_round =~ /[24680]/) || + ($mode eq 'odd') && ($digit_round =~ /[13579]/) || + ($mode eq '+inf') && ($x->{sign} eq '-') || + ($mode eq '-inf') && ($x->{sign} eq '+') || + ($mode eq 'zero') # round down if zero, sign adjusted below + ); + my $put_back = 0; # not yet modified + + if (($pad > 0) && ($pad <= $len)) { + substr($xs, -$pad, $pad) = '0' x $pad; # replace with '00...' + $put_back = 1; # need to put back + } elsif ($pad > $len) { + $x->bzero(); # round to '0' + } + + if ($round_up) { # what gave test above? + $put_back = 1; # need to put back + $pad = $len, $xs = '0' x $pad if $scale < 0; # tlr: whack 0.51=>1.0 + + # we modify directly the string variant instead of creating a number and + # adding it, since that is faster (we already have the string) + my $c = 0; + $pad ++; # for $pad == $len case + while ($pad <= $len) { + $c = substr($xs, -$pad, 1) + 1; + $c = '0' if $c eq '10'; + substr($xs, -$pad, 1) = $c; + $pad++; + last if $c != 0; # no overflow => early out + } + $xs = '1'.$xs if $c == 0; + + } + $x->{value} = $LIB->_new($xs) if $put_back == 1; # put back, if needed + + $x->{_a} = $scale if $scale >= 0; + if ($scale < 0) { + $x->{_a} = $len+$scale; + $x->{_a} = 0 if $scale < -$len; + } + $x; +} + +sub bfround { + # precision: round to the $Nth digit left (+$n) or right (-$n) from the '.' + # $n == 0 || $n == 1 => round to integer + my $x = shift; + my $class = ref($x) || $x; + $x = $class->new($x) unless ref $x; + + my ($scale, $mode) = $x->_scale_p(@_); + + return $x if !defined $scale || $x->modify('bfround'); # no-op + + # no-op for Math::BigInt objects if $n <= 0 + $x->bround($x->length()-$scale, $mode) if $scale > 0; + + delete $x->{_a}; # delete to save memory + $x->{_p} = $scale; # store new _p + $x; +} + +sub fround { + # Exists to make life easier for switch between MBF and MBI (should we + # autoload fxxx() like MBF does for bxxx()?) + my $x = shift; + $x = __PACKAGE__->new($x) unless ref $x; + $x->bround(@_); +} + +sub bfloor { + # round towards minus infinity; no-op since it's already integer + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $x->round(@r); +} + +sub bceil { + # round towards plus infinity; no-op since it's already int + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $x->round(@r); +} + +sub bint { + # round towards zero; no-op since it's already integer + my ($class, $x, @r) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $x->round(@r); +} + +############################################################################### +# Other mathematical methods +############################################################################### + +sub bgcd { + # (BINT or num_str, BINT or num_str) return BINT + # does not modify arguments, but returns new object + # GCD -- Euclid's algorithm, variant C (Knuth Vol 3, pg 341 ff) + + my ($class, @args) = objectify(0, @_); + + my $x = shift @args; + $x = ref($x) && $x -> isa($class) ? $x -> copy() : $class -> new($x); + + return $class->bnan() if $x->{sign} !~ /^[+-]$/; # x NaN? + + while (@args) { + my $y = shift @args; + $y = $class->new($y) unless ref($y) && $y -> isa($class); + return $class->bnan() if $y->{sign} !~ /^[+-]$/; # y NaN? + $x->{value} = $LIB->_gcd($x->{value}, $y->{value}); + last if $LIB->_is_one($x->{value}); + } + + return $x -> babs(); +} + +sub blcm { + # (BINT or num_str, BINT or num_str) return BINT + # does not modify arguments, but returns new object + # Least Common Multiple + + my ($class, @args) = objectify(0, @_); + + my $x = shift @args; + $x = ref($x) && $x -> isa($class) ? $x -> copy() : $class -> new($x); + return $class->bnan() if $x->{sign} !~ /^[+-]$/; # x NaN? + + while (@args) { + my $y = shift @args; + $y = $class -> new($y) unless ref($y) && $y -> isa($class); + return $x->bnan() if $y->{sign} !~ /^[+-]$/; # y not integer + $x -> {value} = $LIB->_lcm($x -> {value}, $y -> {value}); + } + + return $x -> babs(); +} + +############################################################################### +# Object property methods +############################################################################### + +sub sign { + # return the sign of the number: +/-/-inf/+inf/NaN + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + $x->{sign}; +} + +sub digit { + # return the nth decimal digit, negative values count backward, 0 is right + my ($class, $x, $n) = ref($_[0]) ? (undef, @_) : objectify(1, @_); + + $n = $n->numify() if ref($n); + $LIB->_digit($x->{value}, $n || 0); +} + +sub bdigitsum { + # like digitsum(), but assigns the result to the invocand + my $x = shift; + + return $x if $x -> is_nan(); + return $x -> bnan() if $x -> is_inf(); + + $x -> {value} = $LIB -> _digitsum($x -> {value}); + $x -> {sign} = '+'; + return $x; +} + +sub digitsum { + # compute sum of decimal digits and return it + my $x = shift; + my $class = ref $x; + + return $class -> bnan() if $x -> is_nan(); + return $class -> bnan() if $x -> is_inf(); + + my $y = $class -> bzero(); + $y -> {value} = $LIB -> _digitsum($x -> {value}); + return $y; +} + +sub length { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + my $e = $LIB->_len($x->{value}); + wantarray ? ($e, 0) : $e; +} + +sub exponent { + # return a copy of the exponent (here always 0, NaN or 1 for $m == 0) + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + my $s = $x->{sign}; + $s =~ s/^[+-]//; # NaN, -inf, +inf => NaN or inf + return $class->new($s); + } + return $class->bzero() if $x->is_zero(); + + # 12300 => 2 trailing zeros => exponent is 2 + $class->new($LIB->_zeros($x->{value})); +} + +sub mantissa { + # return the mantissa (compatible to Math::BigFloat, e.g. reduced) + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { + # for NaN, +inf, -inf: keep the sign + return $class->new($x->{sign}); + } + my $m = $x->copy(); + delete $m->{_p}; + delete $m->{_a}; + + # that's a bit inefficient: + my $zeros = $LIB->_zeros($m->{value}); + $m->brsft($zeros, 10) if $zeros != 0; + $m; +} + +sub parts { + # return a copy of both the exponent and the mantissa + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + ($x->mantissa(), $x->exponent()); +} + +sub sparts { + my $self = shift; + my $class = ref $self; + + croak("sparts() is an instance method, not a class method") + unless $class; + + # Not-a-number. + + if ($self -> is_nan()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> bnan(); # exponent + return ($mant, $expo); # list context + } + + # Infinity. + + if ($self -> is_inf()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> binf('+'); # exponent + return ($mant, $expo); # list context + } + + # Finite number. + + my $mant = $self -> copy(); + my $nzeros = $LIB -> _zeros($mant -> {value}); + + $mant -> brsft($nzeros, 10) if $nzeros != 0; + return $mant unless wantarray; + + my $expo = $class -> new($nzeros); + return ($mant, $expo); +} + +sub nparts { + my $self = shift; + my $class = ref $self; + + croak("nparts() is an instance method, not a class method") + unless $class; + + # Not-a-number. + + if ($self -> is_nan()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> bnan(); # exponent + return ($mant, $expo); # list context + } + + # Infinity. + + if ($self -> is_inf()) { + my $mant = $self -> copy(); # mantissa + return $mant unless wantarray; # scalar context + my $expo = $class -> binf('+'); # exponent + return ($mant, $expo); # list context + } + + # Finite number. + + my ($mant, $expo) = $self -> sparts(); + + if ($mant -> bcmp(0)) { + my ($ndigtot, $ndigfrac) = $mant -> length(); + my $expo10adj = $ndigtot - $ndigfrac - 1; + + if ($expo10adj != 0) { + return $upgrade -> new($self) -> nparts() if $upgrade; + $mant -> bnan(); + return $mant unless wantarray; + $expo -> badd($expo10adj); + return ($mant, $expo); + } + } + + return $mant unless wantarray; + return ($mant, $expo); +} + +sub eparts { + my $self = shift; + my $class = ref $self; + + croak("eparts() is an instance method, not a class method") + unless $class; + + # Not-a-number and Infinity. + + return $self -> sparts() if $self -> is_nan() || $self -> is_inf(); + + # Finite number. + + my ($mant, $expo) = $self -> sparts(); + + if ($mant -> bcmp(0)) { + my $ndigmant = $mant -> length(); + $expo -> badd($ndigmant); + + # $c is the number of digits that will be in the integer part of the + # final mantissa. + + my $c = $expo -> copy() -> bdec() -> bmod(3) -> binc(); + $expo -> bsub($c); + + if ($ndigmant > $c) { + return $upgrade -> new($self) -> eparts() if $upgrade; + $mant -> bnan(); + return $mant unless wantarray; + return ($mant, $expo); + } + + $mant -> blsft($c - $ndigmant, 10); + } + + return $mant unless wantarray; + return ($mant, $expo); +} + +sub dparts { + my $self = shift; + my $class = ref $self; + + croak("dparts() is an instance method, not a class method") + unless $class; + + my $int = $self -> copy(); + return $int unless wantarray; + + my $frc = $class -> bzero(); + return ($int, $frc); +} + +############################################################################### +# String conversion methods +############################################################################### + +sub bstr { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + my $str = $LIB->_str($x->{value}); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +# Scientific notation with significand/mantissa as an integer, e.g., "12345" is +# written as "1.2345e+4". + +sub bsstr { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + my ($m, $e) = $x -> parts(); + my $str = $LIB->_str($m->{value}) . 'e+' . $LIB->_str($e->{value}); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +# Normalized notation, e.g., "12345" is written as "12345e+0". + +sub bnstr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + return $x -> bstr() if $x -> is_nan() || $x -> is_inf(); + + my ($mant, $expo) = $x -> parts(); + + # The "fraction posision" is the position (offset) for the decimal point + # relative to the end of the digit string. + + my $fracpos = $mant -> length() - 1; + if ($fracpos == 0) { + my $str = $LIB->_str($mant->{value}) . "e+" . $LIB->_str($expo->{value}); + return $x->{sign} eq '-' ? "-$str" : $str; + } + + $expo += $fracpos; + my $mantstr = $LIB->_str($mant -> {value}); + substr($mantstr, -$fracpos, 0) = '.'; + + my $str = $mantstr . 'e+' . $LIB->_str($expo -> {value}); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +# Engineering notation, e.g., "12345" is written as "12.345e+3". + +sub bestr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my ($mant, $expo) = $x -> parts(); + + my $sign = $mant -> sign(); + $mant -> babs(); + + my $mantstr = $LIB->_str($mant -> {value}); + my $mantlen = CORE::length($mantstr); + + my $dotidx = 1; + $expo += $mantlen - 1; + + my $c = $expo -> copy() -> bmod(3); + $expo -= $c; + $dotidx += $c; + + if ($mantlen < $dotidx) { + $mantstr .= "0" x ($dotidx - $mantlen); + } elsif ($mantlen > $dotidx) { + substr($mantstr, $dotidx, 0) = "."; + } + + my $str = $mantstr . 'e+' . $LIB->_str($expo -> {value}); + return $sign eq "-" ? "-$str" : $str; +} + +# Decimal notation, e.g., "12345". + +sub bdstr { + my $x = shift; + + if ($x->{sign} ne '+' && $x->{sign} ne '-') { + return $x->{sign} unless $x->{sign} eq '+inf'; # -inf, NaN + return 'inf'; # +inf + } + + my $str = $LIB->_str($x->{value}); + return $x->{sign} eq '-' ? "-$str" : $str; +} + +sub to_hex { + # return as hex string, with prefixed 0x + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $hex = $LIB->_to_hex($x->{value}); + return $x->{sign} eq '-' ? "-$hex" : $hex; +} + +sub to_oct { + # return as octal string, with prefixed 0 + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $oct = $LIB->_to_oct($x->{value}); + return $x->{sign} eq '-' ? "-$oct" : $oct; +} + +sub to_bin { + # return as binary string, with prefixed 0b + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $bin = $LIB->_to_bin($x->{value}); + return $x->{sign} eq '-' ? "-$bin" : $bin; +} + +sub to_bytes { + # return a byte string + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + croak("to_bytes() requires a finite, non-negative integer") + if $x -> is_neg() || ! $x -> is_int(); + + croak("to_bytes() requires a newer version of the $LIB library.") + unless $LIB->can('_to_bytes'); + + return $LIB->_to_bytes($x->{value}); +} + +sub to_base { + # return a base anything string + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + croak("the value to convert must be a finite, non-negative integer") + if $x -> is_neg() || !$x -> is_int(); + + my $base = shift; + $base = __PACKAGE__->new($base) unless ref($base); + + croak("the base must be a finite integer >= 2") + if $base < 2 || ! $base -> is_int(); + + # If no collating sequence is given, pass some of the conversions to + # methods optimized for those cases. + + if (! @_) { + return $x -> to_bin() if $base == 2; + return $x -> to_oct() if $base == 8; + return uc $x -> to_hex() if $base == 16; + return $x -> bstr() if $base == 10; + } + + croak("to_base() requires a newer version of the $LIB library.") + unless $LIB->can('_to_base'); + + return $LIB->_to_base($x->{value}, $base -> {value}, @_ ? shift() : ()); +} + +sub as_hex { + # return as hex string, with prefixed 0x + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $hex = $LIB->_as_hex($x->{value}); + return $x->{sign} eq '-' ? "-$hex" : $hex; +} + +sub as_oct { + # return as octal string, with prefixed 0 + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $oct = $LIB->_as_oct($x->{value}); + return $x->{sign} eq '-' ? "-$oct" : $oct; +} + +sub as_bin { + # return as binary string, with prefixed 0b + my $x = shift; + $x = __PACKAGE__->new($x) if !ref($x); + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, nan etc + + my $bin = $LIB->_as_bin($x->{value}); + return $x->{sign} eq '-' ? "-$bin" : $bin; +} + +*as_bytes = \&to_bytes; + +############################################################################### +# Other conversion methods +############################################################################### + +sub numify { + # Make a Perl scalar number from a Math::BigInt object. + my $x = shift; + $x = __PACKAGE__->new($x) unless ref $x; + + if ($x -> is_nan()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $inf - $inf; + } + + if ($x -> is_inf()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $x -> is_negative() ? -$inf : $inf; + } + + my $num = 0 + $LIB->_num($x->{value}); + return $x->{sign} eq '-' ? -$num : $num; +} + +############################################################################### +# Private methods and functions. +############################################################################### + +sub objectify { + # Convert strings and "foreign objects" to the objects we want. + + # The first argument, $count, is the number of following arguments that + # objectify() looks at and converts to objects. The first is a classname. + # If the given count is 0, all arguments will be used. + + # After the count is read, objectify obtains the name of the class to which + # the following arguments are converted. If the second argument is a + # reference, use the reference type as the class name. Otherwise, if it is + # a string that looks like a class name, use that. Otherwise, use $class. + + # Caller: Gives us: + # + # $x->badd(1); => ref x, scalar y + # Class->badd(1, 2); => classname x (scalar), scalar x, scalar y + # Class->badd(Class->(1), 2); => classname x (scalar), ref x, scalar y + # Math::BigInt::badd(1, 2); => scalar x, scalar y + + # A shortcut for the common case $x->unary_op(), in which case the argument + # list is (0, $x) or (1, $x). + + return (ref($_[1]), $_[1]) if @_ == 2 && ($_[0] || 0) == 1 && ref($_[1]); + + # Check the context. + + unless (wantarray) { + croak(__PACKAGE__ . "::objectify() needs list context"); + } + + # Get the number of arguments to objectify. + + my $count = shift; + + # Initialize the output array. + + my @a = @_; + + # If the first argument is a reference, use that reference type as our + # class name. Otherwise, if the first argument looks like a class name, + # then use that as our class name. Otherwise, use the default class name. + + my $class; + if (ref($a[0])) { # reference? + $class = ref($a[0]); + } elsif ($a[0] =~ /^[A-Z].*::/) { # string with class name? + $class = shift @a; + } else { + $class = __PACKAGE__; # default class name + } + + $count ||= @a; + unshift @a, $class; + + no strict 'refs'; + + # What we upgrade to, if anything. + + my $up = ${"$a[0]::upgrade"}; + + # Disable downgrading, because Math::BigFloat -> foo('1.0', '2.0') needs + # floats. + + my $down; + if (defined ${"$a[0]::downgrade"}) { + $down = ${"$a[0]::downgrade"}; + ${"$a[0]::downgrade"} = undef; + } + + for my $i (1 .. $count) { + + my $ref = ref $a[$i]; + + # Perl scalars are fed to the appropriate constructor. + + unless ($ref) { + $a[$i] = $a[0] -> new($a[$i]); + next; + } + + # If it is an object of the right class, all is fine. + + next if $ref -> isa($a[0]); + + # Upgrading is OK, so skip further tests if the argument is upgraded. + + if (defined $up && $ref -> isa($up)) { + next; + } + + # See if we can call one of the as_xxx() methods. We don't know whether + # the as_xxx() method returns an object or a scalar, so re-check + # afterwards. + + my $recheck = 0; + + if ($a[0] -> isa('Math::BigInt')) { + if ($a[$i] -> can('as_int')) { + $a[$i] = $a[$i] -> as_int(); + $recheck = 1; + } elsif ($a[$i] -> can('as_number')) { + $a[$i] = $a[$i] -> as_number(); + $recheck = 1; + } + } + + elsif ($a[0] -> isa('Math::BigFloat')) { + if ($a[$i] -> can('as_float')) { + $a[$i] = $a[$i] -> as_float(); + $recheck = $1; + } + } + + # If we called one of the as_xxx() methods, recheck. + + if ($recheck) { + $ref = ref($a[$i]); + + # Perl scalars are fed to the appropriate constructor. + + unless ($ref) { + $a[$i] = $a[0] -> new($a[$i]); + next; + } + + # If it is an object of the right class, all is fine. + + next if $ref -> isa($a[0]); + } + + # Last resort. + + $a[$i] = $a[0] -> new($a[$i]); + } + + # Reset the downgrading. + + ${"$a[0]::downgrade"} = $down; + + return @a; +} + +sub import { + my $class = shift; + $IMPORT++; # remember we did import() + my @a; # unrecognized arguments + my $warn_or_die = 0; # 0 - no warn, 1 - warn, 2 - die + for (my $i = 0; $i <= $#_ ; $i++) { + if ($_[$i] eq ':constant') { + # this causes overlord er load to step in + overload::constant + integer => sub { $class->new(shift) }, + binary => sub { $class->new(shift) }; + } elsif ($_[$i] eq 'upgrade') { + # this causes upgrading + $upgrade = $_[$i+1]; # or undef to disable + $i++; + } elsif ($_[$i] =~ /^(lib|try|only)\z/) { + # this causes a different low lib to take care... + $LIB = $_[$i+1] || ''; + # try => 0 (no warn) + # lib => 1 (warn on fallback) + # only => 2 (die on fallback) + $warn_or_die = 1 if $_[$i] eq 'lib'; + $warn_or_die = 2 if $_[$i] eq 'only'; + $i++; + } else { + push @a, $_[$i]; + } + } + # any non :constant stuff is handled by our parent, Exporter + if (@a > 0) { + $class->SUPER::import(@a); # need it for subclasses + $class->export_to_level(1, $class, @a); # need it for MBF + } + + # try to load core math lib + my @c = split /\s*,\s*/, $LIB; + foreach (@c) { + tr/a-zA-Z0-9://cd; # limit to sane characters + } + push @c, \'Calc' # if all fail, try these + if $warn_or_die < 2; # but not for "only" + $LIB = ''; # signal error + foreach my $l (@c) { + # fallback libraries are "marked" as \'string', extract string if nec. + my $lib = $l; + $lib = $$l if ref($l); + + next unless defined($lib) && CORE::length($lib); + $lib = 'Math::BigInt::'.$lib if $lib !~ /^Math::BigInt/i; + $lib =~ s/\.pm$//; + my @parts = split /::/, $lib; # Math::BigInt => Math BigInt + $parts[-1] .= '.pm'; # BigInt => BigInt.pm + require File::Spec; + my $file = File::Spec->catfile(@parts); + eval { require $file; }; + if ($@ eq '') { + $lib->import(); + $LIB = $lib; + if ($warn_or_die > 0 && ref($l)) { + my $msg = "Math::BigInt: couldn't load specified" + . " math lib(s), fallback to $lib"; + carp($msg) if $warn_or_die == 1; + croak($msg) if $warn_or_die == 2; + } + last; # found a usable one, break + } + } + if ($LIB eq '') { + if ($warn_or_die == 2) { + croak("Couldn't load specified math lib(s)" . + " and fallback disallowed"); + } else { + croak("Couldn't load any math lib(s), not even fallback to Calc.pm"); + } + } + + # notify callbacks + foreach my $class (keys %CALLBACKS) { + &{$CALLBACKS{$class}}($LIB); + } + + # import done +} + +sub _register_callback { + my ($class, $callback) = @_; + + if (ref($callback) ne 'CODE') { + croak("$callback is not a coderef"); + } + $CALLBACKS{$class} = $callback; +} + +sub _split_dec_string { + my $str = shift; + + if ($str =~ s/ + ^ + + # leading whitespace + ( \s* ) + + # optional sign + ( [+-]? ) + + # significand + ( + \d+ (?: _ \d+ )* + (?: + \. + (?: \d+ (?: _ \d+ )* )? + )? + | + \. + \d+ (?: _ \d+ )* + ) + + # optional exponent + (?: + [Ee] + ( [+-]? ) + ( \d+ (?: _ \d+ )* ) + )? + + # trailing stuff + ( \D .*? )? + + \z + //x) { + my $leading = $1; + my $significand_sgn = $2 || '+'; + my $significand_abs = $3; + my $exponent_sgn = $4 || '+'; + my $exponent_abs = $5 || '0'; + my $trailing = $6; + + # Remove underscores and leading zeros. + + $significand_abs =~ tr/_//d; + $exponent_abs =~ tr/_//d; + + $significand_abs =~ s/^0+(.)/$1/; + $exponent_abs =~ s/^0+(.)/$1/; + + # If the significand contains a dot, remove it and adjust the exponent + # accordingly. E.g., "1234.56789e+3" -> "123456789e-2" + + my $idx = index $significand_abs, '.'; + if ($idx > -1) { + $significand_abs =~ s/0+\z//; + substr($significand_abs, $idx, 1) = ''; + my $exponent = $exponent_sgn . $exponent_abs; + $exponent .= $idx - CORE::length($significand_abs); + $exponent_abs = abs $exponent; + $exponent_sgn = $exponent < 0 ? '-' : '+'; + } + + return($leading, + $significand_sgn, $significand_abs, + $exponent_sgn, $exponent_abs, + $trailing); + } + + return undef; +} + +sub _split { + # input: num_str; output: undef for invalid or + # (\$mantissa_sign, \$mantissa_value, \$mantissa_fraction, + # \$exp_sign, \$exp_value) + # Internal, take apart a string and return the pieces. + # Strip leading/trailing whitespace, leading zeros, underscore and reject + # invalid input. + my $x = shift; + + # strip white space at front, also extraneous leading zeros + $x =~ s/^\s*([-]?)0*([0-9])/$1$2/g; # will not strip ' .2' + $x =~ s/^\s+//; # but this will + $x =~ s/\s+$//g; # strip white space at end + + # shortcut, if nothing to split, return early + if ($x =~ /^[+-]?[0-9]+\z/) { + $x =~ s/^([+-])0*([0-9])/$2/; + my $sign = $1 || '+'; + return (\$sign, \$x, \'', \'', \0); + } + + # invalid starting char? + return if $x !~ /^[+-]?(\.?[0-9]|0b[0-1]|0x[0-9a-fA-F])/; + + return Math::BigInt->from_hex($x) if $x =~ /^[+-]?0x/; # hex string + return Math::BigInt->from_bin($x) if $x =~ /^[+-]?0b/; # binary string + + # strip underscores between digits + $x =~ s/([0-9])_([0-9])/$1$2/g; + $x =~ s/([0-9])_([0-9])/$1$2/g; # do twice for 1_2_3 + + # some possible inputs: + # 2.1234 # 0.12 # 1 # 1E1 # 2.134E1 # 434E-10 # 1.02009E-2 + # .2 # 1_2_3.4_5_6 # 1.4E1_2_3 # 1e3 # +.2 # 0e999 + + my ($m, $e, $last) = split /[Ee]/, $x; + return if defined $last; # last defined => 1e2E3 or others + $e = '0' if !defined $e || $e eq ""; + + # sign, value for exponent, mantint, mantfrac + my ($es, $ev, $mis, $miv, $mfv); + # valid exponent? + if ($e =~ /^([+-]?)0*([0-9]+)$/) # strip leading zeros + { + $es = $1; + $ev = $2; + # valid mantissa? + return if $m eq '.' || $m eq ''; + my ($mi, $mf, $lastf) = split /\./, $m; + return if defined $lastf; # lastf defined => 1.2.3 or others + $mi = '0' if !defined $mi; + $mi .= '0' if $mi =~ /^[\-\+]?$/; + $mf = '0' if !defined $mf || $mf eq ''; + if ($mi =~ /^([+-]?)0*([0-9]+)$/) # strip leading zeros + { + $mis = $1 || '+'; + $miv = $2; + return unless ($mf =~ /^([0-9]*?)0*$/); # strip trailing zeros + $mfv = $1; + # handle the 0e999 case here + $ev = 0 if $miv eq '0' && $mfv eq ''; + return (\$mis, \$miv, \$mfv, \$es, \$ev); + } + } + return; # NaN, not a number +} + +sub _trailing_zeros { + # return the amount of trailing zeros in $x (as scalar) + my $x = shift; + $x = __PACKAGE__->new($x) unless ref $x; + + return 0 if $x->{sign} !~ /^[+-]$/; # NaN, inf, -inf etc + + $LIB->_zeros($x->{value}); # must handle odd values, 0 etc +} + +sub _scan_for_nonzero { + # internal, used by bround() to scan for non-zeros after a '5' + my ($x, $pad, $xs, $len) = @_; + + return 0 if $len == 1; # "5" is trailed by invisible zeros + my $follow = $pad - 1; + return 0 if $follow > $len || $follow < 1; + + # use the string form to check whether only '0's follow or not + substr ($xs, -$follow) =~ /[^0]/ ? 1 : 0; +} + +sub _find_round_parameters { + # After any operation or when calling round(), the result is rounded by + # regarding the A & P from arguments, local parameters, or globals. + + # !!!!!!! If you change this, remember to change round(), too! !!!!!!!!!! + + # This procedure finds the round parameters, but it is for speed reasons + # duplicated in round. Otherwise, it is tested by the testsuite and used + # by bdiv(). + + # returns ($self) or ($self, $a, $p, $r) - sets $self to NaN of both A and P + # were requested/defined (locally or globally or both) + + my ($self, $a, $p, $r, @args) = @_; + # $a accuracy, if given by caller + # $p precision, if given by caller + # $r round_mode, if given by caller + # @args all 'other' arguments (0 for unary, 1 for binary ops) + + my $class = ref($self); # find out class of argument(s) + no strict 'refs'; + + # convert to normal scalar for speed and correctness in inner parts + $a = $a->can('numify') ? $a->numify() : "$a" if defined $a && ref($a); + $p = $p->can('numify') ? $p->numify() : "$p" if defined $p && ref($p); + + # now pick $a or $p, but only if we have got "arguments" + if (!defined $a) { + foreach ($self, @args) { + # take the defined one, or if both defined, the one that is smaller + $a = $_->{_a} if (defined $_->{_a}) && (!defined $a || $_->{_a} < $a); + } + } + if (!defined $p) { + # even if $a is defined, take $p, to signal error for both defined + foreach ($self, @args) { + # take the defined one, or if both defined, the one that is bigger + # -2 > -3, and 3 > 2 + $p = $_->{_p} if (defined $_->{_p}) && (!defined $p || $_->{_p} > $p); + } + } + + # if still none defined, use globals (#2) + $a = ${"$class\::accuracy"} unless defined $a; + $p = ${"$class\::precision"} unless defined $p; + + # A == 0 is useless, so undef it to signal no rounding + $a = undef if defined $a && $a == 0; + + # no rounding today? + return ($self) unless defined $a || defined $p; # early out + + # set A and set P is an fatal error + return ($self->bnan()) if defined $a && defined $p; # error + + $r = ${"$class\::round_mode"} unless defined $r; + if ($r !~ /^(even|odd|[+-]inf|zero|trunc|common)$/) { + croak("Unknown round mode '$r'"); + } + + $a = int($a) if defined $a; + $p = int($p) if defined $p; + + ($self, $a, $p, $r); +} + +############################################################################### +# this method returns 0 if the object can be modified, or 1 if not. +# We use a fast constant sub() here, to avoid costly calls. Subclasses +# may override it with special code (f.i. Math::BigInt::Constant does so) + +sub modify () { 0; } + +1; + +__END__ + +=pod + +=head1 NAME + +Math::BigInt - Arbitrary size integer/float math package + +=head1 SYNOPSIS + + use Math::BigInt; + + # or make it faster with huge numbers: install (optional) + # Math::BigInt::GMP and always use (it falls back to + # pure Perl if the GMP library is not installed): + # (See also the L<MATH LIBRARY> section!) + + # warns if Math::BigInt::GMP cannot be found + use Math::BigInt lib => 'GMP'; + + # to suppress the warning use this: + # use Math::BigInt try => 'GMP'; + + # dies if GMP cannot be loaded: + # use Math::BigInt only => 'GMP'; + + my $str = '1234567890'; + my @values = (64, 74, 18); + my $n = 1; my $sign = '-'; + + # Configuration methods (may be used as class methods and instance methods) + + Math::BigInt->accuracy(); # get class accuracy + Math::BigInt->accuracy($n); # set class accuracy + Math::BigInt->precision(); # get class precision + Math::BigInt->precision($n); # set class precision + Math::BigInt->round_mode(); # get class rounding mode + Math::BigInt->round_mode($m); # set global round mode, must be one of + # 'even', 'odd', '+inf', '-inf', 'zero', + # 'trunc', or 'common' + Math::BigInt->config(); # return hash with configuration + + # Constructor methods (when the class methods below are used as instance + # methods, the value is assigned the invocand) + + $x = Math::BigInt->new($str); # defaults to 0 + $x = Math::BigInt->new('0x123'); # from hexadecimal + $x = Math::BigInt->new('0b101'); # from binary + $x = Math::BigInt->from_hex('cafe'); # from hexadecimal + $x = Math::BigInt->from_oct('377'); # from octal + $x = Math::BigInt->from_bin('1101'); # from binary + $x = Math::BigInt->from_base('why', 36); # from any base + $x = Math::BigInt->bzero(); # create a +0 + $x = Math::BigInt->bone(); # create a +1 + $x = Math::BigInt->bone('-'); # create a -1 + $x = Math::BigInt->binf(); # create a +inf + $x = Math::BigInt->binf('-'); # create a -inf + $x = Math::BigInt->bnan(); # create a Not-A-Number + $x = Math::BigInt->bpi(); # returns pi + + $y = $x->copy(); # make a copy (unlike $y = $x) + $y = $x->as_int(); # return as a Math::BigInt + + # Boolean methods (these don't modify the invocand) + + $x->is_zero(); # if $x is 0 + $x->is_one(); # if $x is +1 + $x->is_one("+"); # ditto + $x->is_one("-"); # if $x is -1 + $x->is_inf(); # if $x is +inf or -inf + $x->is_inf("+"); # if $x is +inf + $x->is_inf("-"); # if $x is -inf + $x->is_nan(); # if $x is NaN + + $x->is_positive(); # if $x > 0 + $x->is_pos(); # ditto + $x->is_negative(); # if $x < 0 + $x->is_neg(); # ditto + + $x->is_odd(); # if $x is odd + $x->is_even(); # if $x is even + $x->is_int(); # if $x is an integer + + # Comparison methods + + $x->bcmp($y); # compare numbers (undef, < 0, == 0, > 0) + $x->bacmp($y); # compare absolutely (undef, < 0, == 0, > 0) + $x->beq($y); # true if and only if $x == $y + $x->bne($y); # true if and only if $x != $y + $x->blt($y); # true if and only if $x < $y + $x->ble($y); # true if and only if $x <= $y + $x->bgt($y); # true if and only if $x > $y + $x->bge($y); # true if and only if $x >= $y + + # Arithmetic methods + + $x->bneg(); # negation + $x->babs(); # absolute value + $x->bsgn(); # sign function (-1, 0, 1, or NaN) + $x->bnorm(); # normalize (no-op) + $x->binc(); # increment $x by 1 + $x->bdec(); # decrement $x by 1 + $x->badd($y); # addition (add $y to $x) + $x->bsub($y); # subtraction (subtract $y from $x) + $x->bmul($y); # multiplication (multiply $x by $y) + $x->bmuladd($y,$z); # $x = $x * $y + $z + $x->bdiv($y); # division (floored), set $x to quotient + # return (quo,rem) or quo if scalar + $x->btdiv($y); # division (truncated), set $x to quotient + # return (quo,rem) or quo if scalar + $x->bmod($y); # modulus (x % y) + $x->btmod($y); # modulus (truncated) + $x->bmodinv($mod); # modular multiplicative inverse + $x->bmodpow($y,$mod); # modular exponentiation (($x ** $y) % $mod) + $x->bpow($y); # power of arguments (x ** y) + $x->blog(); # logarithm of $x to base e (Euler's number) + $x->blog($base); # logarithm of $x to base $base (e.g., base 2) + $x->bexp(); # calculate e ** $x where e is Euler's number + $x->bnok($y); # x over y (binomial coefficient n over k) + $x->buparrow($n, $y); # Knuth's up-arrow notation + $x->backermann($y); # the Ackermann function + $x->bsin(); # sine + $x->bcos(); # cosine + $x->batan(); # inverse tangent + $x->batan2($y); # two-argument inverse tangent + $x->bsqrt(); # calculate square root + $x->broot($y); # $y'th root of $x (e.g. $y == 3 => cubic root) + $x->bfac(); # factorial of $x (1*2*3*4*..$x) + + $x->blsft($n); # left shift $n places in base 2 + $x->blsft($n,$b); # left shift $n places in base $b + # returns (quo,rem) or quo (scalar context) + $x->brsft($n); # right shift $n places in base 2 + $x->brsft($n,$b); # right shift $n places in base $b + # returns (quo,rem) or quo (scalar context) + + # Bitwise methods + + $x->band($y); # bitwise and + $x->bior($y); # bitwise inclusive or + $x->bxor($y); # bitwise exclusive or + $x->bnot(); # bitwise not (two's complement) + + # Rounding methods + $x->round($A,$P,$mode); # round to accuracy or precision using + # rounding mode $mode + $x->bround($n); # accuracy: preserve $n digits + $x->bfround($n); # $n > 0: round to $nth digit left of dec. point + # $n < 0: round to $nth digit right of dec. point + $x->bfloor(); # round towards minus infinity + $x->bceil(); # round towards plus infinity + $x->bint(); # round towards zero + + # Other mathematical methods + + $x->bgcd($y); # greatest common divisor + $x->blcm($y); # least common multiple + + # Object property methods (do not modify the invocand) + + $x->sign(); # the sign, either +, - or NaN + $x->digit($n); # the nth digit, counting from the right + $x->digit(-$n); # the nth digit, counting from the left + $x->length(); # return number of digits in number + ($xl,$f) = $x->length(); # length of number and length of fraction + # part, latter is always 0 digits long + # for Math::BigInt objects + $x->mantissa(); # return (signed) mantissa as a Math::BigInt + $x->exponent(); # return exponent as a Math::BigInt + $x->parts(); # return (mantissa,exponent) as a Math::BigInt + $x->sparts(); # mantissa and exponent (as integers) + $x->nparts(); # mantissa and exponent (normalised) + $x->eparts(); # mantissa and exponent (engineering notation) + $x->dparts(); # integer and fraction part + + # Conversion methods (do not modify the invocand) + + $x->bstr(); # decimal notation, possibly zero padded + $x->bsstr(); # string in scientific notation with integers + $x->bnstr(); # string in normalized notation + $x->bestr(); # string in engineering notation + $x->bdstr(); # string in decimal notation + + $x->to_hex(); # as signed hexadecimal string + $x->to_bin(); # as signed binary string + $x->to_oct(); # as signed octal string + $x->to_bytes(); # as byte string + $x->to_base($b); # as string in any base + + $x->as_hex(); # as signed hexadecimal string with prefixed 0x + $x->as_bin(); # as signed binary string with prefixed 0b + $x->as_oct(); # as signed octal string with prefixed 0 + + # Other conversion methods + + $x->numify(); # return as scalar (might overflow or underflow) + +=head1 DESCRIPTION + +Math::BigInt provides support for arbitrary precision integers. Overloading is +also provided for Perl operators. + +=head2 Input + +Input values to these routines may be any scalar number or string that looks +like a number and represents an integer. + +=over + +=item * + +Leading and trailing whitespace is ignored. + +=item * + +Leading and trailing zeros are ignored. + +=item * + +If the string has a "0x" prefix, it is interpreted as a hexadecimal number. + +=item * + +If the string has a "0b" prefix, it is interpreted as a binary number. + +=item * + +One underline is allowed between any two digits. + +=item * + +If the string can not be interpreted, NaN is returned. + +=back + +Octal numbers are typically prefixed by "0", but since leading zeros are +stripped, these methods can not automatically recognize octal numbers, so use +the constructor from_oct() to interpret octal strings. + +Some examples of valid string input + + Input string Resulting value + 123 123 + 1.23e2 123 + 12300e-2 123 + 0xcafe 51966 + 0b1101 13 + 67_538_754 67538754 + -4_5_6.7_8_9e+0_1_0 -4567890000000 + +Input given as scalar numbers might lose precision. Quote your input to ensure +that no digits are lost: + + $x = Math::BigInt->new( 56789012345678901234 ); # bad + $x = Math::BigInt->new('56789012345678901234'); # good + +Currently, Math::BigInt->new() defaults to 0, while Math::BigInt->new('') +results in 'NaN'. This might change in the future, so use always the following +explicit forms to get a zero or NaN: + + $zero = Math::BigInt->bzero(); + $nan = Math::BigInt->bnan(); + +=head2 Output + +Output values are usually Math::BigInt objects. + +Boolean operators C<is_zero()>, C<is_one()>, C<is_inf()>, etc. return true or +false. + +Comparison operators C<bcmp()> and C<bacmp()>) return -1, 0, 1, or +undef. + +=head1 METHODS + +=head2 Configuration methods + +Each of the methods below (except config(), accuracy() and precision()) accepts +three additional parameters. These arguments C<$A>, C<$P> and C<$R> are +C<accuracy>, C<precision> and C<round_mode>. Please see the section about +L</ACCURACY and PRECISION> for more information. + +Setting a class variable effects all object instance that are created +afterwards. + +=over + +=item accuracy() + + Math::BigInt->accuracy(5); # set class accuracy + $x->accuracy(5); # set instance accuracy + + $A = Math::BigInt->accuracy(); # get class accuracy + $A = $x->accuracy(); # get instance accuracy + +Set or get the accuracy, i.e., the number of significant digits. The accuracy +must be an integer. If the accuracy is set to C<undef>, no rounding is done. + +Alternatively, one can round the results explicitly using one of L</round()>, +L</bround()> or L</bfround()> or by passing the desired accuracy to the method +as an additional parameter: + + my $x = Math::BigInt->new(30000); + my $y = Math::BigInt->new(7); + print scalar $x->copy()->bdiv($y, 2); # prints 4300 + print scalar $x->copy()->bdiv($y)->bround(2); # prints 4300 + +Please see the section about L</ACCURACY and PRECISION> for further details. + + $y = Math::BigInt->new(1234567); # $y is not rounded + Math::BigInt->accuracy(4); # set class accuracy to 4 + $x = Math::BigInt->new(1234567); # $x is rounded automatically + print "$x $y"; # prints "1235000 1234567" + + print $x->accuracy(); # prints "4" + print $y->accuracy(); # also prints "4", since + # class accuracy is 4 + + Math::BigInt->accuracy(5); # set class accuracy to 5 + print $x->accuracy(); # prints "4", since instance + # accuracy is 4 + print $y->accuracy(); # prints "5", since no instance + # accuracy, and class accuracy is 5 + +Note: Each class has it's own globals separated from Math::BigInt, but it is +possible to subclass Math::BigInt and make the globals of the subclass aliases +to the ones from Math::BigInt. + +=item precision() + + Math::BigInt->precision(-2); # set class precision + $x->precision(-2); # set instance precision + + $P = Math::BigInt->precision(); # get class precision + $P = $x->precision(); # get instance precision + +Set or get the precision, i.e., the place to round relative to the decimal +point. The precision must be a integer. Setting the precision to $P means that +each number is rounded up or down, depending on the rounding mode, to the +nearest multiple of 10**$P. If the precision is set to C<undef>, no rounding is +done. + +You might want to use L</accuracy()> instead. With L</accuracy()> you set the +number of digits each result should have, with L</precision()> you set the +place where to round. + +Please see the section about L</ACCURACY and PRECISION> for further details. + + $y = Math::BigInt->new(1234567); # $y is not rounded + Math::BigInt->precision(4); # set class precision to 4 + $x = Math::BigInt->new(1234567); # $x is rounded automatically + print $x; # prints "1230000" + +Note: Each class has its own globals separated from Math::BigInt, but it is +possible to subclass Math::BigInt and make the globals of the subclass aliases +to the ones from Math::BigInt. + +=item div_scale() + +Set/get the fallback accuracy. This is the accuracy used when neither accuracy +nor precision is set explicitly. It is used when a computation might otherwise +attempt to return an infinite number of digits. + +=item round_mode() + +Set/get the rounding mode. + +=item upgrade() + +Set/get the class for upgrading. When a computation might result in a +non-integer, the operands are upgraded to this class. This is used for instance +by L<bignum>. The default is C<undef>, thus the following operation creates +a Math::BigInt, not a Math::BigFloat: + + my $i = Math::BigInt->new(123); + my $f = Math::BigFloat->new('123.1'); + + print $i + $f, "\n"; # prints 246 + +=item downgrade() + +Set/get the class for downgrading. The default is C<undef>. Downgrading is not +done by Math::BigInt. + +=item modify() + + $x->modify('bpowd'); + +This method returns 0 if the object can be modified with the given operation, +or 1 if not. + +This is used for instance by L<Math::BigInt::Constant>. + +=item config() + + Math::BigInt->config("trap_nan" => 1); # set + $accu = Math::BigInt->config("accuracy"); # get + +Set or get class variables. Read-only parameters are marked as RO. Read-write +parameters are marked as RW. The following parameters are supported. + + Parameter RO/RW Description + Example + ============================================================ + lib RO Name of the math backend library + Math::BigInt::Calc + lib_version RO Version of the math backend library + 0.30 + class RO The class of config you just called + Math::BigRat + version RO version number of the class you used + 0.10 + upgrade RW To which class numbers are upgraded + undef + downgrade RW To which class numbers are downgraded + undef + precision RW Global precision + undef + accuracy RW Global accuracy + undef + round_mode RW Global round mode + even + div_scale RW Fallback accuracy for division etc. + 40 + trap_nan RW Trap NaNs + undef + trap_inf RW Trap +inf/-inf + undef + +=back + +=head2 Constructor methods + +=over + +=item new() + + $x = Math::BigInt->new($str,$A,$P,$R); + +Creates a new Math::BigInt object from a scalar or another Math::BigInt object. +The input is accepted as decimal, hexadecimal (with leading '0x') or binary +(with leading '0b'). + +See L</Input> for more info on accepted input formats. + +=item from_hex() + + $x = Math::BigInt->from_hex("0xcafe"); # input is hexadecimal + +Interpret input as a hexadecimal string. A "0x" or "x" prefix is optional. A +single underscore character may be placed right after the prefix, if present, +or between any two digits. If the input is invalid, a NaN is returned. + +=item from_oct() + + $x = Math::BigInt->from_oct("0775"); # input is octal + +Interpret the input as an octal string and return the corresponding value. A +"0" (zero) prefix is optional. A single underscore character may be placed +right after the prefix, if present, or between any two digits. If the input is +invalid, a NaN is returned. + +=item from_bin() + + $x = Math::BigInt->from_bin("0b10011"); # input is binary + +Interpret the input as a binary string. A "0b" or "b" prefix is optional. A +single underscore character may be placed right after the prefix, if present, +or between any two digits. If the input is invalid, a NaN is returned. + +=item from_bytes() + + $x = Math::BigInt->from_bytes("\xf3\x6b"); # $x = 62315 + +Interpret the input as a byte string, assuming big endian byte order. The +output is always a non-negative, finite integer. + +In some special cases, from_bytes() matches the conversion done by unpack(): + + $b = "\x4e"; # one char byte string + $x = Math::BigInt->from_bytes($b); # = 78 + $y = unpack "C", $b; # ditto, but scalar + + $b = "\xf3\x6b"; # two char byte string + $x = Math::BigInt->from_bytes($b); # = 62315 + $y = unpack "S>", $b; # ditto, but scalar + + $b = "\x2d\xe0\x49\xad"; # four char byte string + $x = Math::BigInt->from_bytes($b); # = 769673645 + $y = unpack "L>", $b; # ditto, but scalar + + $b = "\x2d\xe0\x49\xad\x2d\xe0\x49\xad"; # eight char byte string + $x = Math::BigInt->from_bytes($b); # = 3305723134637787565 + $y = unpack "Q>", $b; # ditto, but scalar + +=item from_base() + +Given a string, a base, and an optional collation sequence, interpret the +string as a number in the given base. The collation sequence describes the +value of each character in the string. + +If a collation sequence is not given, a default collation sequence is used. If +the base is less than or equal to 36, the collation sequence is the string +consisting of the 36 characters "0" to "9" and "A" to "Z". In this case, the +letter case in the input is ignored. If the base is greater than 36, and +smaller than or equal to 62, the collation sequence is the string consisting of +the 62 characters "0" to "9", "A" to "Z", and "a" to "z". A base larger than 62 +requires the collation sequence to be specified explicitly. + +These examples show standard binary, octal, and hexadecimal conversion. All +cases return 250. + + $x = Math::BigInt->from_base("11111010", 2); + $x = Math::BigInt->from_base("372", 8); + $x = Math::BigInt->from_base("fa", 16); + +When the base is less than or equal to 36, and no collation sequence is given, +the letter case is ignored, so both of these also return 250: + + $x = Math::BigInt->from_base("6Y", 16); + $x = Math::BigInt->from_base("6y", 16); + +When the base greater than 36, and no collation sequence is given, the default +collation sequence contains both uppercase and lowercase letters, so +the letter case in the input is not ignored: + + $x = Math::BigInt->from_base("6S", 37); # $x is 250 + $x = Math::BigInt->from_base("6s", 37); # $x is 276 + $x = Math::BigInt->from_base("121", 3); # $x is 16 + $x = Math::BigInt->from_base("XYZ", 36); # $x is 44027 + $x = Math::BigInt->from_base("Why", 42); # $x is 58314 + +The collation sequence can be any set of unique characters. These two cases +are equivalent + + $x = Math::BigInt->from_base("100", 2, "01"); # $x is 4 + $x = Math::BigInt->from_base("|--", 2, "-|"); # $x is 4 + +=item bzero() + + $x = Math::BigInt->bzero(); + $x->bzero(); + +Returns a new Math::BigInt object representing zero. If used as an instance +method, assigns the value to the invocand. + +=item bone() + + $x = Math::BigInt->bone(); # +1 + $x = Math::BigInt->bone("+"); # +1 + $x = Math::BigInt->bone("-"); # -1 + $x->bone(); # +1 + $x->bone("+"); # +1 + $x->bone('-'); # -1 + +Creates a new Math::BigInt object representing one. The optional argument is +either '-' or '+', indicating whether you want plus one or minus one. If used +as an instance method, assigns the value to the invocand. + +=item binf() + + $x = Math::BigInt->binf($sign); + +Creates a new Math::BigInt object representing infinity. The optional argument +is either '-' or '+', indicating whether you want infinity or minus infinity. +If used as an instance method, assigns the value to the invocand. + + $x->binf(); + $x->binf('-'); + +=item bnan() + + $x = Math::BigInt->bnan(); + +Creates a new Math::BigInt object representing NaN (Not A Number). If used as +an instance method, assigns the value to the invocand. + + $x->bnan(); + +=item bpi() + + $x = Math::BigInt->bpi(100); # 3 + $x->bpi(100); # 3 + +Creates a new Math::BigInt object representing PI. If used as an instance +method, assigns the value to the invocand. With Math::BigInt this always +returns 3. + +If upgrading is in effect, returns PI, rounded to N digits with the current +rounding mode: + + use Math::BigFloat; + use Math::BigInt upgrade => "Math::BigFloat"; + print Math::BigInt->bpi(3), "\n"; # 3.14 + print Math::BigInt->bpi(100), "\n"; # 3.1415.... + +=item copy() + + $x->copy(); # make a true copy of $x (unlike $y = $x) + +=item as_int() + +=item as_number() + +These methods are called when Math::BigInt encounters an object it doesn't know +how to handle. For instance, assume $x is a Math::BigInt, or subclass thereof, +and $y is defined, but not a Math::BigInt, or subclass thereof. If you do + + $x -> badd($y); + +$y needs to be converted into an object that $x can deal with. This is done by +first checking if $y is something that $x might be upgraded to. If that is the +case, no further attempts are made. The next is to see if $y supports the +method C<as_int()>. If it does, C<as_int()> is called, but if it doesn't, the +next thing is to see if $y supports the method C<as_number()>. If it does, +C<as_number()> is called. The method C<as_int()> (and C<as_number()>) is +expected to return either an object that has the same class as $x, a subclass +thereof, or a string that C<ref($x)-E<gt>new()> can parse to create an object. + +C<as_number()> is an alias to C<as_int()>. C<as_number> was introduced in +v1.22, while C<as_int()> was introduced in v1.68. + +In Math::BigInt, C<as_int()> has the same effect as C<copy()>. + +=back + +=head2 Boolean methods + +None of these methods modify the invocand object. + +=over + +=item is_zero() + + $x->is_zero(); # true if $x is 0 + +Returns true if the invocand is zero and false otherwise. + +=item is_one( [ SIGN ]) + + $x->is_one(); # true if $x is +1 + $x->is_one("+"); # ditto + $x->is_one("-"); # true if $x is -1 + +Returns true if the invocand is one and false otherwise. + +=item is_finite() + + $x->is_finite(); # true if $x is not +inf, -inf or NaN + +Returns true if the invocand is a finite number, i.e., it is neither +inf, +-inf, nor NaN. + +=item is_inf( [ SIGN ] ) + + $x->is_inf(); # true if $x is +inf + $x->is_inf("+"); # ditto + $x->is_inf("-"); # true if $x is -inf + +Returns true if the invocand is infinite and false otherwise. + +=item is_nan() + + $x->is_nan(); # true if $x is NaN + +=item is_positive() + +=item is_pos() + + $x->is_positive(); # true if > 0 + $x->is_pos(); # ditto + +Returns true if the invocand is positive and false otherwise. A C<NaN> is +neither positive nor negative. + +=item is_negative() + +=item is_neg() + + $x->is_negative(); # true if < 0 + $x->is_neg(); # ditto + +Returns true if the invocand is negative and false otherwise. A C<NaN> is +neither positive nor negative. + +=item is_non_positive() + + $x->is_non_positive(); # true if <= 0 + +Returns true if the invocand is negative or zero. + +=item is_non_negative() + + $x->is_non_negative(); # true if >= 0 + +Returns true if the invocand is positive or zero. + +=item is_odd() + + $x->is_odd(); # true if odd, false for even + +Returns true if the invocand is odd and false otherwise. C<NaN>, C<+inf>, and +C<-inf> are neither odd nor even. + +=item is_even() + + $x->is_even(); # true if $x is even + +Returns true if the invocand is even and false otherwise. C<NaN>, C<+inf>, +C<-inf> are not integers and are neither odd nor even. + +=item is_int() + + $x->is_int(); # true if $x is an integer + +Returns true if the invocand is an integer and false otherwise. C<NaN>, +C<+inf>, C<-inf> are not integers. + +=back + +=head2 Comparison methods + +None of these methods modify the invocand object. Note that a C<NaN> is neither +less than, greater than, or equal to anything else, even a C<NaN>. + +=over + +=item bcmp() + + $x->bcmp($y); + +Returns -1, 0, 1 depending on whether $x is less than, equal to, or grater than +$y. Returns undef if any operand is a NaN. + +=item bacmp() + + $x->bacmp($y); + +Returns -1, 0, 1 depending on whether the absolute value of $x is less than, +equal to, or grater than the absolute value of $y. Returns undef if any operand +is a NaN. + +=item beq() + + $x -> beq($y); + +Returns true if and only if $x is equal to $y, and false otherwise. + +=item bne() + + $x -> bne($y); + +Returns true if and only if $x is not equal to $y, and false otherwise. + +=item blt() + + $x -> blt($y); + +Returns true if and only if $x is equal to $y, and false otherwise. + +=item ble() + + $x -> ble($y); + +Returns true if and only if $x is less than or equal to $y, and false +otherwise. + +=item bgt() + + $x -> bgt($y); + +Returns true if and only if $x is greater than $y, and false otherwise. + +=item bge() + + $x -> bge($y); + +Returns true if and only if $x is greater than or equal to $y, and false +otherwise. + +=back + +=head2 Arithmetic methods + +These methods modify the invocand object and returns it. + +=over + +=item bneg() + + $x->bneg(); + +Negate the number, e.g. change the sign between '+' and '-', or between '+inf' +and '-inf', respectively. Does nothing for NaN or zero. + +=item babs() + + $x->babs(); + +Set the number to its absolute value, e.g. change the sign from '-' to '+' +and from '-inf' to '+inf', respectively. Does nothing for NaN or positive +numbers. + +=item bsgn() + + $x->bsgn(); + +Signum function. Set the number to -1, 0, or 1, depending on whether the +number is negative, zero, or positive, respectively. Does not modify NaNs. + +=item bnorm() + + $x->bnorm(); # normalize (no-op) + +Normalize the number. This is a no-op and is provided only for backwards +compatibility. + +=item binc() + + $x->binc(); # increment x by 1 + +=item bdec() + + $x->bdec(); # decrement x by 1 + +=item badd() + + $x->badd($y); # addition (add $y to $x) + +=item bsub() + + $x->bsub($y); # subtraction (subtract $y from $x) + +=item bmul() + + $x->bmul($y); # multiplication (multiply $x by $y) + +=item bmuladd() + + $x->bmuladd($y,$z); + +Multiply $x by $y, and then add $z to the result, + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item bdiv() + + $x->bdiv($y); # divide, set $x to quotient + +Divides $x by $y by doing floored division (F-division), where the quotient is +the floored (rounded towards negative infinity) quotient of the two operands. +In list context, returns the quotient and the remainder. The remainder is +either zero or has the same sign as the second operand. In scalar context, only +the quotient is returned. + +The quotient is always the greatest integer less than or equal to the +real-valued quotient of the two operands, and the remainder (when it is +non-zero) always has the same sign as the second operand; so, for example, + + 1 / 4 => ( 0, 1) + 1 / -4 => (-1, -3) + -3 / 4 => (-1, 1) + -3 / -4 => ( 0, -3) + -11 / 2 => (-5, 1) + 11 / -2 => (-5, -1) + +The behavior of the overloaded operator % agrees with the behavior of Perl's +built-in % operator (as documented in the perlop manpage), and the equation + + $x == ($x / $y) * $y + ($x % $y) + +holds true for any finite $x and finite, non-zero $y. + +Perl's "use integer" might change the behaviour of % and / for scalars. This is +because under 'use integer' Perl does what the underlying C library thinks is +right, and this varies. However, "use integer" does not change the way things +are done with Math::BigInt objects. + +=item btdiv() + + $x->btdiv($y); # divide, set $x to quotient + +Divides $x by $y by doing truncated division (T-division), where quotient is +the truncated (rouneded towards zero) quotient of the two operands. In list +context, returns the quotient and the remainder. The remainder is either zero +or has the same sign as the first operand. In scalar context, only the quotient +is returned. + +=item bmod() + + $x->bmod($y); # modulus (x % y) + +Returns $x modulo $y, i.e., the remainder after floored division (F-division). +This method is like Perl's % operator. See L</bdiv()>. + +=item btmod() + + $x->btmod($y); # modulus + +Returns the remainer after truncated division (T-division). See L</btdiv()>. + +=item bmodinv() + + $x->bmodinv($mod); # modular multiplicative inverse + +Returns the multiplicative inverse of C<$x> modulo C<$mod>. If + + $y = $x -> copy() -> bmodinv($mod) + +then C<$y> is the number closest to zero, and with the same sign as C<$mod>, +satisfying + + ($x * $y) % $mod = 1 % $mod + +If C<$x> and C<$y> are non-zero, they must be relative primes, i.e., +C<bgcd($y, $mod)==1>. 'C<NaN>' is returned when no modular multiplicative +inverse exists. + +=item bmodpow() + + $num->bmodpow($exp,$mod); # modular exponentiation + # ($num**$exp % $mod) + +Returns the value of C<$num> taken to the power C<$exp> in the modulus +C<$mod> using binary exponentiation. C<bmodpow> is far superior to +writing + + $num ** $exp % $mod + +because it is much faster - it reduces internal variables into +the modulus whenever possible, so it operates on smaller numbers. + +C<bmodpow> also supports negative exponents. + + bmodpow($num, -1, $mod) + +is exactly equivalent to + + bmodinv($num, $mod) + +=item bpow() + + $x->bpow($y); # power of arguments (x ** y) + +C<bpow()> (and the rounding functions) now modifies the first argument and +returns it, unlike the old code which left it alone and only returned the +result. This is to be consistent with C<badd()> etc. The first three modifies +$x, the last one won't: + + print bpow($x,$i),"\n"; # modify $x + print $x->bpow($i),"\n"; # ditto + print $x **= $i,"\n"; # the same + print $x ** $i,"\n"; # leave $x alone + +The form C<$x **= $y> is faster than C<$x = $x ** $y;>, though. + +=item blog() + + $x->blog($base, $accuracy); # logarithm of x to the base $base + +If C<$base> is not defined, Euler's number (e) is used: + + print $x->blog(undef, 100); # log(x) to 100 digits + +=item bexp() + + $x->bexp($accuracy); # calculate e ** X + +Calculates the expression C<e ** $x> where C<e> is Euler's number. + +This method was added in v1.82 of Math::BigInt (April 2007). + +See also L</blog()>. + +=item bnok() + + $x->bnok($y); # x over y (binomial coefficient n over k) + +Calculates the binomial coefficient n over k, also called the "choose" +function, which is + + ( n ) n! + | | = -------- + ( k ) k!(n-k)! + +when n and k are non-negative. This method implements the full Kronenburg +extension (Kronenburg, M.J. "The Binomial Coefficient for Negative Arguments." +18 May 2011. http://arxiv.org/abs/1105.3689/) illustrated by the following +pseudo-code: + + if n >= 0 and k >= 0: + return binomial(n, k) + if k >= 0: + return (-1)^k*binomial(-n+k-1, k) + if k <= n: + return (-1)^(n-k)*binomial(-k-1, n-k) + else + return 0 + +The behaviour is identical to the behaviour of the Maple and Mathematica +function for negative integers n, k. + +=item buparrow() + +=item uparrow() + + $a -> buparrow($n, $b); # modifies $a + $x = $a -> uparrow($n, $b); # does not modify $a + +This method implements Knuth's up-arrow notation, where $n is a non-negative +integer representing the number of up-arrows. $n = 0 gives multiplication, $n = +1 gives exponentiation, $n = 2 gives tetration, $n = 3 gives hexation etc. The +following illustrates the relation between the first values of $n. + +See L<https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation>. + +=item backermann() + +=item ackermann() + + $m -> backermann($n); # modifies $a + $x = $m -> ackermann($n); # does not modify $a + +This method implements the Ackermann function: + + / n + 1 if m = 0 + A(m, n) = | A(m-1, 1) if m > 0 and n = 0 + \ A(m-1, A(m, n-1)) if m > 0 and n > 0 + +Its value grows rapidly, even for small inputs. For example, A(4, 2) is an +integer of 19729 decimal digits. + +See https://en.wikipedia.org/wiki/Ackermann_function + +=item bsin() + + my $x = Math::BigInt->new(1); + print $x->bsin(100), "\n"; + +Calculate the sine of $x, modifying $x in place. + +In Math::BigInt, unless upgrading is in effect, the result is truncated to an +integer. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item bcos() + + my $x = Math::BigInt->new(1); + print $x->bcos(100), "\n"; + +Calculate the cosine of $x, modifying $x in place. + +In Math::BigInt, unless upgrading is in effect, the result is truncated to an +integer. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item batan() + + my $x = Math::BigFloat->new(0.5); + print $x->batan(100), "\n"; + +Calculate the arcus tangens of $x, modifying $x in place. + +In Math::BigInt, unless upgrading is in effect, the result is truncated to an +integer. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item batan2() + + my $x = Math::BigInt->new(1); + my $y = Math::BigInt->new(1); + print $y->batan2($x), "\n"; + +Calculate the arcus tangens of C<$y> divided by C<$x>, modifying $y in place. + +In Math::BigInt, unless upgrading is in effect, the result is truncated to an +integer. + +This method was added in v1.87 of Math::BigInt (June 2007). + +=item bsqrt() + + $x->bsqrt(); # calculate square root + +C<bsqrt()> returns the square root truncated to an integer. + +If you want a better approximation of the square root, then use: + + $x = Math::BigFloat->new(12); + Math::BigFloat->precision(0); + Math::BigFloat->round_mode('even'); + print $x->copy->bsqrt(),"\n"; # 4 + + Math::BigFloat->precision(2); + print $x->bsqrt(),"\n"; # 3.46 + print $x->bsqrt(3),"\n"; # 3.464 + +=item broot() + + $x->broot($N); + +Calculates the N'th root of C<$x>. + +=item bfac() + + $x->bfac(); # factorial of $x (1*2*3*4*..*$x) + +Returns the factorial of C<$x>, i.e., the product of all positive integers up +to and including C<$x>. + +=item bdfac() + + $x->bdfac(); # double factorial of $x (1*2*3*4*..*$x) + +Returns the double factorial of C<$x>. If C<$x> is an even integer, returns the +product of all positive, even integers up to and including C<$x>, i.e., +2*4*6*...*$x. If C<$x> is an odd integer, returns the product of all positive, +odd integers, i.e., 1*3*5*...*$x. + +=item bfib() + + $F = $n->bfib(); # a single Fibonacci number + @F = $n->bfib(); # a list of Fibonacci numbers + +In scalar context, returns a single Fibonacci number. In list context, returns +a list of Fibonacci numbers. The invocand is the last element in the output. + +The Fibonacci sequence is defined by + + F(0) = 0 + F(1) = 1 + F(n) = F(n-1) + F(n-2) + +In list context, F(0) and F(n) is the first and last number in the output, +respectively. For example, if $n is 12, then C<< @F = $n->bfib() >> returns the +following values, F(0) to F(12): + + 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 + +The sequence can also be extended to negative index n using the re-arranged +recurrence relation + + F(n-2) = F(n) - F(n-1) + +giving the bidirectional sequence + + n -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 + F(n) 13 -8 5 -3 2 -1 1 0 1 1 2 3 5 8 13 + +If $n is -12, the following values, F(0) to F(12), are returned: + + 0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55, 89, -144 + +=item blucas() + + $F = $n->blucas(); # a single Lucas number + @F = $n->blucas(); # a list of Lucas numbers + +In scalar context, returns a single Lucas number. In list context, returns a +list of Lucas numbers. The invocand is the last element in the output. + +The Lucas sequence is defined by + + L(0) = 2 + L(1) = 1 + L(n) = L(n-1) + L(n-2) + +In list context, L(0) and L(n) is the first and last number in the output, +respectively. For example, if $n is 12, then C<< @L = $n->blucas() >> returns +the following values, L(0) to L(12): + + 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322 + +The sequence can also be extended to negative index n using the re-arranged +recurrence relation + + L(n-2) = L(n) - L(n-1) + +giving the bidirectional sequence + + n -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 + L(n) 29 -18 11 -7 4 -3 1 2 1 3 4 7 11 18 29 + +If $n is -12, the following values, L(0) to L(-12), are returned: + + 2, 1, -3, 4, -7, 11, -18, 29, -47, 76, -123, 199, -322 + +=item brsft() + + $x->brsft($n); # right shift $n places in base 2 + $x->brsft($n, $b); # right shift $n places in base $b + +The latter is equivalent to + + $x -> bdiv($b -> copy() -> bpow($n)) + +=item blsft() + + $x->blsft($n); # left shift $n places in base 2 + $x->blsft($n, $b); # left shift $n places in base $b + +The latter is equivalent to + + $x -> bmul($b -> copy() -> bpow($n)) + +=back + +=head2 Bitwise methods + +=over + +=item band() + + $x->band($y); # bitwise and + +=item bior() + + $x->bior($y); # bitwise inclusive or + +=item bxor() + + $x->bxor($y); # bitwise exclusive or + +=item bnot() + + $x->bnot(); # bitwise not (two's complement) + +Two's complement (bitwise not). This is equivalent to, but faster than, + + $x->binc()->bneg(); + +=back + +=head2 Rounding methods + +=over + +=item round() + + $x->round($A,$P,$round_mode); + +Round $x to accuracy C<$A> or precision C<$P> using the round mode +C<$round_mode>. + +=item bround() + + $x->bround($N); # accuracy: preserve $N digits + +Rounds $x to an accuracy of $N digits. + +=item bfround() + + $x->bfround($N); + +Rounds to a multiple of 10**$N. Examples: + + Input N Result + + 123456.123456 3 123500 + 123456.123456 2 123450 + 123456.123456 -2 123456.12 + 123456.123456 -3 123456.123 + +=item bfloor() + + $x->bfloor(); + +Round $x towards minus infinity, i.e., set $x to the largest integer less than +or equal to $x. + +=item bceil() + + $x->bceil(); + +Round $x towards plus infinity, i.e., set $x to the smallest integer greater +than or equal to $x). + +=item bint() + + $x->bint(); + +Round $x towards zero. + +=back + +=head2 Other mathematical methods + +=over + +=item bgcd() + + $x -> bgcd($y); # GCD of $x and $y + $x -> bgcd($y, $z, ...); # GCD of $x, $y, $z, ... + +Returns the greatest common divisor (GCD). + +=item blcm() + + $x -> blcm($y); # LCM of $x and $y + $x -> blcm($y, $z, ...); # LCM of $x, $y, $z, ... + +Returns the least common multiple (LCM). + +=back + +=head2 Object property methods + +=over + +=item sign() + + $x->sign(); + +Return the sign, of $x, meaning either C<+>, C<->, C<-inf>, C<+inf> or NaN. + +If you want $x to have a certain sign, use one of the following methods: + + $x->babs(); # '+' + $x->babs()->bneg(); # '-' + $x->bnan(); # 'NaN' + $x->binf(); # '+inf' + $x->binf('-'); # '-inf' + +=item digit() + + $x->digit($n); # return the nth digit, counting from right + +If C<$n> is negative, returns the digit counting from left. + +=item digitsum() + + $x->digitsum(); + +Computes the sum of the base 10 digits and returns it. + +=item bdigitsum() + + $x->bdigitsum(); + +Computes the sum of the base 10 digits and assigns the result to the invocand. + +=item length() + + $x->length(); + ($xl, $fl) = $x->length(); + +Returns the number of digits in the decimal representation of the number. In +list context, returns the length of the integer and fraction part. For +Math::BigInt objects, the length of the fraction part is always 0. + +The following probably doesn't do what you expect: + + $c = Math::BigInt->new(123); + print $c->length(),"\n"; # prints 30 + +It prints both the number of digits in the number and in the fraction part +since print calls C<length()> in list context. Use something like: + + print scalar $c->length(),"\n"; # prints 3 + +=item mantissa() + + $x->mantissa(); + +Return the signed mantissa of $x as a Math::BigInt. + +=item exponent() + + $x->exponent(); + +Return the exponent of $x as a Math::BigInt. + +=item parts() + + $x->parts(); + +Returns the significand (mantissa) and the exponent as integers. In +Math::BigFloat, both are returned as Math::BigInt objects. + +=item sparts() + +Returns the significand (mantissa) and the exponent as integers. In scalar +context, only the significand is returned. The significand is the integer with +the smallest absolute value. The output of C<sparts()> corresponds to the +output from C<bsstr()>. + +In Math::BigInt, this method is identical to C<parts()>. + +=item nparts() + +Returns the significand (mantissa) and exponent corresponding to normalized +notation. In scalar context, only the significand is returned. For finite +non-zero numbers, the significand's absolute value is greater than or equal to +1 and less than 10. The output of C<nparts()> corresponds to the output from +C<bnstr()>. In Math::BigInt, if the significand can not be represented as an +integer, upgrading is performed or NaN is returned. + +=item eparts() + +Returns the significand (mantissa) and exponent corresponding to engineering +notation. In scalar context, only the significand is returned. For finite +non-zero numbers, the significand's absolute value is greater than or equal to +1 and less than 1000, and the exponent is a multiple of 3. The output of +C<eparts()> corresponds to the output from C<bestr()>. In Math::BigInt, if the +significand can not be represented as an integer, upgrading is performed or NaN +is returned. + +=item dparts() + +Returns the integer part and the fraction part. If the fraction part can not be +represented as an integer, upgrading is performed or NaN is returned. The +output of C<dparts()> corresponds to the output from C<bdstr()>. + +=back + +=head2 String conversion methods + +=over + +=item bstr() + +Returns a string representing the number using decimal notation. In +Math::BigFloat, the output is zero padded according to the current accuracy or +precision, if any of those are defined. + +=item bsstr() + +Returns a string representing the number using scientific notation where both +the significand (mantissa) and the exponent are integers. The output +corresponds to the output from C<sparts()>. + + 123 is returned as "123e+0" + 1230 is returned as "123e+1" + 12300 is returned as "123e+2" + 12000 is returned as "12e+3" + 10000 is returned as "1e+4" + +=item bnstr() + +Returns a string representing the number using normalized notation, the most +common variant of scientific notation. For finite non-zero numbers, the +absolute value of the significand is greater than or equal to 1 and less than +10. The output corresponds to the output from C<nparts()>. + + 123 is returned as "1.23e+2" + 1230 is returned as "1.23e+3" + 12300 is returned as "1.23e+4" + 12000 is returned as "1.2e+4" + 10000 is returned as "1e+4" + +=item bestr() + +Returns a string representing the number using engineering notation. For finite +non-zero numbers, the absolute value of the significand is greater than or +equal to 1 and less than 1000, and the exponent is a multiple of 3. The output +corresponds to the output from C<eparts()>. + + 123 is returned as "123e+0" + 1230 is returned as "1.23e+3" + 12300 is returned as "12.3e+3" + 12000 is returned as "12e+3" + 10000 is returned as "10e+3" + +=item bdstr() + +Returns a string representing the number using decimal notation. The output +corresponds to the output from C<dparts()>. + + 123 is returned as "123" + 1230 is returned as "1230" + 12300 is returned as "12300" + 12000 is returned as "12000" + 10000 is returned as "10000" + +=item to_hex() + + $x->to_hex(); + +Returns a hexadecimal string representation of the number. See also from_hex(). + +=item to_bin() + + $x->to_bin(); + +Returns a binary string representation of the number. See also from_bin(). + +=item to_oct() + + $x->to_oct(); + +Returns an octal string representation of the number. See also from_oct(). + +=item to_bytes() + + $x = Math::BigInt->new("1667327589"); + $s = $x->to_bytes(); # $s = "cafe" + +Returns a byte string representation of the number using big endian byte +order. The invocand must be a non-negative, finite integer. See also from_bytes(). + +=item to_base() + + $x = Math::BigInt->new("250"); + $x->to_base(2); # returns "11111010" + $x->to_base(8); # returns "372" + $x->to_base(16); # returns "fa" + +Returns a string representation of the number in the given base. If a collation +sequence is given, the collation sequence determines which characters are used +in the output. + +Here are some more examples + + $x = Math::BigInt->new("16")->to_base(3); # returns "121" + $x = Math::BigInt->new("44027")->to_base(36); # returns "XYZ" + $x = Math::BigInt->new("58314")->to_base(42); # returns "Why" + $x = Math::BigInt->new("4")->to_base(2, "-|"); # returns "|--" + +See from_base() for information and examples. + +=item as_hex() + + $x->as_hex(); + +As, C<to_hex()>, but with a "0x" prefix. + +=item as_bin() + + $x->as_bin(); + +As, C<to_bin()>, but with a "0b" prefix. + +=item as_oct() + + $x->as_oct(); + +As, C<to_oct()>, but with a "0" prefix. + +=item as_bytes() + +This is just an alias for C<to_bytes()>. + +=back + +=head2 Other conversion methods + +=over + +=item numify() + + print $x->numify(); + +Returns a Perl scalar from $x. It is used automatically whenever a scalar is +needed, for instance in array index operations. + +=back + +=head1 ACCURACY and PRECISION + +Math::BigInt and Math::BigFloat have full support for accuracy and precision +based rounding, both automatically after every operation, as well as manually. + +This section describes the accuracy/precision handling in Math::BigInt and +Math::BigFloat as it used to be and as it is now, complete with an explanation +of all terms and abbreviations. + +Not yet implemented things (but with correct description) are marked with '!', +things that need to be answered are marked with '?'. + +In the next paragraph follows a short description of terms used here (because +these may differ from terms used by others people or documentation). + +During the rest of this document, the shortcuts A (for accuracy), P (for +precision), F (fallback) and R (rounding mode) are be used. + +=head2 Precision P + +Precision is a fixed number of digits before (positive) or after (negative) the +decimal point. For example, 123.45 has a precision of -2. 0 means an integer +like 123 (or 120). A precision of 2 means at least two digits to the left of +the decimal point are zero, so 123 with P = 1 becomes 120. Note that numbers +with zeros before the decimal point may have different precisions, because 1200 +can have P = 0, 1 or 2 (depending on what the initial value was). It could also +have p < 0, when the digits after the decimal point are zero. + +The string output (of floating point numbers) is padded with zeros: + + Initial value P A Result String + ------------------------------------------------------------ + 1234.01 -3 1000 1000 + 1234 -2 1200 1200 + 1234.5 -1 1230 1230 + 1234.001 1 1234 1234.0 + 1234.01 0 1234 1234 + 1234.01 2 1234.01 1234.01 + 1234.01 5 1234.01 1234.01000 + +For Math::BigInt objects, no padding occurs. + +=head2 Accuracy A + +Number of significant digits. Leading zeros are not counted. A number may have +an accuracy greater than the non-zero digits when there are zeros in it or +trailing zeros. For example, 123.456 has A of 6, 10203 has 5, 123.0506 has 7, +123.45000 has 8 and 0.000123 has 3. + +The string output (of floating point numbers) is padded with zeros: + + Initial value P A Result String + ------------------------------------------------------------ + 1234.01 3 1230 1230 + 1234.01 6 1234.01 1234.01 + 1234.1 8 1234.1 1234.1000 + +For Math::BigInt objects, no padding occurs. + +=head2 Fallback F + +When both A and P are undefined, this is used as a fallback accuracy when +dividing numbers. + +=head2 Rounding mode R + +When rounding a number, different 'styles' or 'kinds' of rounding are possible. +(Note that random rounding, as in Math::Round, is not implemented.) + +=head3 Directed rounding + +These round modes always round in the same direction. + +=over + +=item 'trunc' + +Round towards zero. Remove all digits following the rounding place, i.e., +replace them with zeros. Thus, 987.65 rounded to tens (P=1) becomes 980, and +rounded to the fourth significant digit becomes 987.6 (A=4). 123.456 rounded to +the second place after the decimal point (P=-2) becomes 123.46. This +corresponds to the IEEE 754 rounding mode 'roundTowardZero'. + +=back + +=head3 Rounding to nearest + +These rounding modes round to the nearest digit. They differ in how they +determine which way to round in the ambiguous case when there is a tie. + +=over + +=item 'even' + +Round towards the nearest even digit, e.g., when rounding to nearest integer, +-5.5 becomes -6, 4.5 becomes 4, but 4.501 becomes 5. This corresponds to the +IEEE 754 rounding mode 'roundTiesToEven'. + +=item 'odd' + +Round towards the nearest odd digit, e.g., when rounding to nearest integer, +4.5 becomes 5, -5.5 becomes -5, but 5.501 becomes 6. This corresponds to the +IEEE 754 rounding mode 'roundTiesToOdd'. + +=item '+inf' + +Round towards plus infinity, i.e., always round up. E.g., when rounding to the +nearest integer, 4.5 becomes 5, -5.5 becomes -5, and 4.501 also becomes 5. This +corresponds to the IEEE 754 rounding mode 'roundTiesToPositive'. + +=item '-inf' + +Round towards minus infinity, i.e., always round down. E.g., when rounding to +the nearest integer, 4.5 becomes 4, -5.5 becomes -6, but 4.501 becomes 5. This +corresponds to the IEEE 754 rounding mode 'roundTiesToNegative'. + +=item 'zero' + +Round towards zero, i.e., round positive numbers down and negative numbers up. +E.g., when rounding to the nearest integer, 4.5 becomes 4, -5.5 becomes -5, but +4.501 becomes 5. This corresponds to the IEEE 754 rounding mode +'roundTiesToZero'. + +=item 'common' + +Round away from zero, i.e., round to the number with the largest absolute +value. E.g., when rounding to the nearest integer, -1.5 becomes -2, 1.5 becomes +2 and 1.49 becomes 1. This corresponds to the IEEE 754 rounding mode +'roundTiesToAway'. + +=back + +The handling of A & P in MBI/MBF (the old core code shipped with Perl versions +<= 5.7.2) is like this: + +=over + +=item Precision + + * bfround($p) is able to round to $p number of digits after the decimal + point + * otherwise P is unused + +=item Accuracy (significant digits) + + * bround($a) rounds to $a significant digits + * only bdiv() and bsqrt() take A as (optional) parameter + + other operations simply create the same number (bneg etc), or + more (bmul) of digits + + rounding/truncating is only done when explicitly calling one + of bround or bfround, and never for Math::BigInt (not implemented) + * bsqrt() simply hands its accuracy argument over to bdiv. + * the documentation and the comment in the code indicate two + different ways on how bdiv() determines the maximum number + of digits it should calculate, and the actual code does yet + another thing + POD: + max($Math::BigFloat::div_scale,length(dividend)+length(divisor)) + Comment: + result has at most max(scale, length(dividend), length(divisor)) digits + Actual code: + scale = max(scale, length(dividend)-1,length(divisor)-1); + scale += length(divisor) - length(dividend); + So for lx = 3, ly = 9, scale = 10, scale will actually be 16 (10 + So for lx = 3, ly = 9, scale = 10, scale will actually be 16 + (10+9-3). Actually, the 'difference' added to the scale is cal- + culated from the number of "significant digits" in dividend and + divisor, which is derived by looking at the length of the man- + tissa. Which is wrong, since it includes the + sign (oops) and + actually gets 2 for '+100' and 4 for '+101'. Oops again. Thus + 124/3 with div_scale=1 will get you '41.3' based on the strange + assumption that 124 has 3 significant digits, while 120/7 will + get you '17', not '17.1' since 120 is thought to have 2 signif- + icant digits. The rounding after the division then uses the + remainder and $y to determine whether it must round up or down. + ? I have no idea which is the right way. That's why I used a slightly more + ? simple scheme and tweaked the few failing testcases to match it. + +=back + +This is how it works now: + +=over + +=item Setting/Accessing + + * You can set the A global via Math::BigInt->accuracy() or + Math::BigFloat->accuracy() or whatever class you are using. + * You can also set P globally by using Math::SomeClass->precision() + likewise. + * Globals are classwide, and not inherited by subclasses. + * to undefine A, use Math::SomeCLass->accuracy(undef); + * to undefine P, use Math::SomeClass->precision(undef); + * Setting Math::SomeClass->accuracy() clears automatically + Math::SomeClass->precision(), and vice versa. + * To be valid, A must be > 0, P can have any value. + * If P is negative, this means round to the P'th place to the right of the + decimal point; positive values mean to the left of the decimal point. + P of 0 means round to integer. + * to find out the current global A, use Math::SomeClass->accuracy() + * to find out the current global P, use Math::SomeClass->precision() + * use $x->accuracy() respective $x->precision() for the local + setting of $x. + * Please note that $x->accuracy() respective $x->precision() + return eventually defined global A or P, when $x's A or P is not + set. + +=item Creating numbers + + * When you create a number, you can give the desired A or P via: + $x = Math::BigInt->new($number,$A,$P); + * Only one of A or P can be defined, otherwise the result is NaN + * If no A or P is give ($x = Math::BigInt->new($number) form), then the + globals (if set) will be used. Thus changing the global defaults later on + will not change the A or P of previously created numbers (i.e., A and P of + $x will be what was in effect when $x was created) + * If given undef for A and P, NO rounding will occur, and the globals will + NOT be used. This is used by subclasses to create numbers without + suffering rounding in the parent. Thus a subclass is able to have its own + globals enforced upon creation of a number by using + $x = Math::BigInt->new($number,undef,undef): + + use Math::BigInt::SomeSubclass; + use Math::BigInt; + + Math::BigInt->accuracy(2); + Math::BigInt::SomeSubClass->accuracy(3); + $x = Math::BigInt::SomeSubClass->new(1234); + + $x is now 1230, and not 1200. A subclass might choose to implement + this otherwise, e.g. falling back to the parent's A and P. + +=item Usage + + * If A or P are enabled/defined, they are used to round the result of each + operation according to the rules below + * Negative P is ignored in Math::BigInt, since Math::BigInt objects never + have digits after the decimal point + * Math::BigFloat uses Math::BigInt internally, but setting A or P inside + Math::BigInt as globals does not tamper with the parts of a Math::BigFloat. + A flag is used to mark all Math::BigFloat numbers as 'never round'. + +=item Precedence + + * It only makes sense that a number has only one of A or P at a time. + If you set either A or P on one object, or globally, the other one will + be automatically cleared. + * If two objects are involved in an operation, and one of them has A in + effect, and the other P, this results in an error (NaN). + * A takes precedence over P (Hint: A comes before P). + If neither of them is defined, nothing is used, i.e. the result will have + as many digits as it can (with an exception for bdiv/bsqrt) and will not + be rounded. + * There is another setting for bdiv() (and thus for bsqrt()). If neither of + A or P is defined, bdiv() will use a fallback (F) of $div_scale digits. + If either the dividend's or the divisor's mantissa has more digits than + the value of F, the higher value will be used instead of F. + This is to limit the digits (A) of the result (just consider what would + happen with unlimited A and P in the case of 1/3 :-) + * bdiv will calculate (at least) 4 more digits than required (determined by + A, P or F), and, if F is not used, round the result + (this will still fail in the case of a result like 0.12345000000001 with A + or P of 5, but this can not be helped - or can it?) + * Thus you can have the math done by on Math::Big* class in two modi: + + never round (this is the default): + This is done by setting A and P to undef. No math operation + will round the result, with bdiv() and bsqrt() as exceptions to guard + against overflows. You must explicitly call bround(), bfround() or + round() (the latter with parameters). + Note: Once you have rounded a number, the settings will 'stick' on it + and 'infect' all other numbers engaged in math operations with it, since + local settings have the highest precedence. So, to get SaferRound[tm], + use a copy() before rounding like this: + + $x = Math::BigFloat->new(12.34); + $y = Math::BigFloat->new(98.76); + $z = $x * $y; # 1218.6984 + print $x->copy()->bround(3); # 12.3 (but A is now 3!) + $z = $x * $y; # still 1218.6984, without + # copy would have been 1210! + + + round after each op: + After each single operation (except for testing like is_zero()), the + method round() is called and the result is rounded appropriately. By + setting proper values for A and P, you can have all-the-same-A or + all-the-same-P modes. For example, Math::Currency might set A to undef, + and P to -2, globally. + + ?Maybe an extra option that forbids local A & P settings would be in order, + ?so that intermediate rounding does not 'poison' further math? + +=item Overriding globals + + * you will be able to give A, P and R as an argument to all the calculation + routines; the second parameter is A, the third one is P, and the fourth is + R (shift right by one for binary operations like badd). P is used only if + the first parameter (A) is undefined. These three parameters override the + globals in the order detailed as follows, i.e. the first defined value + wins: + (local: per object, global: global default, parameter: argument to sub) + + parameter A + + parameter P + + local A (if defined on both of the operands: smaller one is taken) + + local P (if defined on both of the operands: bigger one is taken) + + global A + + global P + + global F + * bsqrt() will hand its arguments to bdiv(), as it used to, only now for two + arguments (A and P) instead of one + +=item Local settings + + * You can set A or P locally by using $x->accuracy() or + $x->precision() + and thus force different A and P for different objects/numbers. + * Setting A or P this way immediately rounds $x to the new value. + * $x->accuracy() clears $x->precision(), and vice versa. + +=item Rounding + + * the rounding routines will use the respective global or local settings. + bround() is for accuracy rounding, while bfround() is for precision + * the two rounding functions take as the second parameter one of the + following rounding modes (R): + 'even', 'odd', '+inf', '-inf', 'zero', 'trunc', 'common' + * you can set/get the global R by using Math::SomeClass->round_mode() + or by setting $Math::SomeClass::round_mode + * after each operation, $result->round() is called, and the result may + eventually be rounded (that is, if A or P were set either locally, + globally or as parameter to the operation) + * to manually round a number, call $x->round($A,$P,$round_mode); + this will round the number by using the appropriate rounding function + and then normalize it. + * rounding modifies the local settings of the number: + + $x = Math::BigFloat->new(123.456); + $x->accuracy(5); + $x->bround(4); + + Here 4 takes precedence over 5, so 123.5 is the result and $x->accuracy() + will be 4 from now on. + +=item Default values + + * R: 'even' + * F: 40 + * A: undef + * P: undef + +=item Remarks + + * The defaults are set up so that the new code gives the same results as + the old code (except in a few cases on bdiv): + + Both A and P are undefined and thus will not be used for rounding + after each operation. + + round() is thus a no-op, unless given extra parameters A and P + +=back + +=head1 Infinity and Not a Number + +While Math::BigInt has extensive handling of inf and NaN, certain quirks +remain. + +=over + +=item oct()/hex() + +These perl routines currently (as of Perl v.5.8.6) cannot handle passed inf. + + te@linux:~> perl -wle 'print 2 ** 3333' + Inf + te@linux:~> perl -wle 'print 2 ** 3333 == 2 ** 3333' + 1 + te@linux:~> perl -wle 'print oct(2 ** 3333)' + 0 + te@linux:~> perl -wle 'print hex(2 ** 3333)' + Illegal hexadecimal digit 'I' ignored at -e line 1. + 0 + +The same problems occur if you pass them Math::BigInt->binf() objects. Since +overloading these routines is not possible, this cannot be fixed from +Math::BigInt. + +=back + +=head1 INTERNALS + +You should neither care about nor depend on the internal representation; it +might change without notice. Use B<ONLY> method calls like C<< $x->sign(); >> +instead relying on the internal representation. + +=head2 MATH LIBRARY + +Math with the numbers is done (by default) by a module called +C<Math::BigInt::Calc>. This is equivalent to saying: + + use Math::BigInt try => 'Calc'; + +You can change this backend library by using: + + use Math::BigInt try => 'GMP'; + +B<Note>: General purpose packages should not be explicit about the library to +use; let the script author decide which is best. + +If your script works with huge numbers and Calc is too slow for them, you can +also for the loading of one of these libraries and if none of them can be used, +the code dies: + + use Math::BigInt only => 'GMP,Pari'; + +The following would first try to find Math::BigInt::Foo, then +Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc: + + use Math::BigInt try => 'Foo,Math::BigInt::Bar'; + +The library that is loaded last is used. Note that this can be overwritten at +any time by loading a different library, and numbers constructed with different +libraries cannot be used in math operations together. + +=head3 What library to use? + +B<Note>: General purpose packages should not be explicit about the library to +use; let the script author decide which is best. + +L<Math::BigInt::GMP> and L<Math::BigInt::Pari> are in cases involving big +numbers much faster than Calc, however it is slower when dealing with very +small numbers (less than about 20 digits) and when converting very large +numbers to decimal (for instance for printing, rounding, calculating their +length in decimal etc). + +So please select carefully what library you want to use. + +Different low-level libraries use different formats to store the numbers. +However, you should B<NOT> depend on the number having a specific format +internally. + +See the respective math library module documentation for further details. + +=head2 SIGN + +The sign is either '+', '-', 'NaN', '+inf' or '-inf'. + +A sign of 'NaN' is used to represent the result when input arguments are not +numbers or as a result of 0/0. '+inf' and '-inf' represent plus respectively +minus infinity. You get '+inf' when dividing a positive number by 0, and '-inf' +when dividing any negative number by 0. + +=head1 EXAMPLES + + use Math::BigInt; + + sub bigint { Math::BigInt->new(shift); } + + $x = Math::BigInt->bstr("1234") # string "1234" + $x = "$x"; # same as bstr() + $x = Math::BigInt->bneg("1234"); # Math::BigInt "-1234" + $x = Math::BigInt->babs("-12345"); # Math::BigInt "12345" + $x = Math::BigInt->bnorm("-0.00"); # Math::BigInt "0" + $x = bigint(1) + bigint(2); # Math::BigInt "3" + $x = bigint(1) + "2"; # ditto (auto-Math::BigIntify of "2") + $x = bigint(1); # Math::BigInt "1" + $x = $x + 5 / 2; # Math::BigInt "3" + $x = $x ** 3; # Math::BigInt "27" + $x *= 2; # Math::BigInt "54" + $x = Math::BigInt->new(0); # Math::BigInt "0" + $x--; # Math::BigInt "-1" + $x = Math::BigInt->badd(4,5) # Math::BigInt "9" + print $x->bsstr(); # 9e+0 + +Examples for rounding: + + use Math::BigFloat; + use Test::More; + + $x = Math::BigFloat->new(123.4567); + $y = Math::BigFloat->new(123.456789); + Math::BigFloat->accuracy(4); # no more A than 4 + + is ($x->copy()->bround(),123.4); # even rounding + print $x->copy()->bround(),"\n"; # 123.4 + Math::BigFloat->round_mode('odd'); # round to odd + print $x->copy()->bround(),"\n"; # 123.5 + Math::BigFloat->accuracy(5); # no more A than 5 + Math::BigFloat->round_mode('odd'); # round to odd + print $x->copy()->bround(),"\n"; # 123.46 + $y = $x->copy()->bround(4),"\n"; # A = 4: 123.4 + print "$y, ",$y->accuracy(),"\n"; # 123.4, 4 + + Math::BigFloat->accuracy(undef); # A not important now + Math::BigFloat->precision(2); # P important + print $x->copy()->bnorm(),"\n"; # 123.46 + print $x->copy()->bround(),"\n"; # 123.46 + +Examples for converting: + + my $x = Math::BigInt->new('0b1'.'01' x 123); + print "bin: ",$x->as_bin()," hex:",$x->as_hex()," dec: ",$x,"\n"; + +=head1 Autocreating constants + +After C<use Math::BigInt ':constant'> all the B<integer> decimal, hexadecimal +and binary constants in the given scope are converted to C<Math::BigInt>. This +conversion happens at compile time. + +In particular, + + perl -MMath::BigInt=:constant -e 'print 2**100,"\n"' + +prints the integer value of C<2**100>. Note that without conversion of +constants the expression 2**100 is calculated using Perl scalars. + +Please note that strings and floating point constants are not affected, so that + + use Math::BigInt qw/:constant/; + + $x = 1234567890123456789012345678901234567890 + + 123456789123456789; + $y = '1234567890123456789012345678901234567890' + + '123456789123456789'; + +does not give you what you expect. You need an explicit Math::BigInt->new() +around one of the operands. You should also quote large constants to protect +loss of precision: + + use Math::BigInt; + + $x = Math::BigInt->new('1234567889123456789123456789123456789'); + +Without the quotes Perl would convert the large number to a floating point +constant at compile time and then hand the result to Math::BigInt, which +results in an truncated result or a NaN. + +This also applies to integers that look like floating point constants: + + use Math::BigInt ':constant'; + + print ref(123e2),"\n"; + print ref(123.2e2),"\n"; + +prints nothing but newlines. Use either L<bignum> or L<Math::BigFloat> to get +this to work. + +=head1 PERFORMANCE + +Using the form $x += $y; etc over $x = $x + $y is faster, since a copy of $x +must be made in the second case. For long numbers, the copy can eat up to 20% +of the work (in the case of addition/subtraction, less for +multiplication/division). If $y is very small compared to $x, the form $x += $y +is MUCH faster than $x = $x + $y since making the copy of $x takes more time +then the actual addition. + +With a technique called copy-on-write, the cost of copying with overload could +be minimized or even completely avoided. A test implementation of COW did show +performance gains for overloaded math, but introduced a performance loss due to +a constant overhead for all other operations. So Math::BigInt does currently +not COW. + +The rewritten version of this module (vs. v0.01) is slower on certain +operations, like C<new()>, C<bstr()> and C<numify()>. The reason are that it +does now more work and handles much more cases. The time spent in these +operations is usually gained in the other math operations so that code on the +average should get (much) faster. If they don't, please contact the author. + +Some operations may be slower for small numbers, but are significantly faster +for big numbers. Other operations are now constant (O(1), like C<bneg()>, +C<babs()> etc), instead of O(N) and thus nearly always take much less time. +These optimizations were done on purpose. + +If you find the Calc module to slow, try to install any of the replacement +modules and see if they help you. + +=head2 Alternative math libraries + +You can use an alternative library to drive Math::BigInt. See the section +L</MATH LIBRARY> for more information. + +For more benchmark results see L<http://bloodgate.com/perl/benchmarks.html>. + +=head1 SUBCLASSING + +=head2 Subclassing Math::BigInt + +The basic design of Math::BigInt allows simple subclasses with very little +work, as long as a few simple rules are followed: + +=over + +=item * + +The public API must remain consistent, i.e. if a sub-class is overloading +addition, the sub-class must use the same name, in this case badd(). The reason +for this is that Math::BigInt is optimized to call the object methods directly. + +=item * + +The private object hash keys like C<< $x->{sign} >> may not be changed, but +additional keys can be added, like C<< $x->{_custom} >>. + +=item * + +Accessor functions are available for all existing object hash keys and should +be used instead of directly accessing the internal hash keys. The reason for +this is that Math::BigInt itself has a pluggable interface which permits it to +support different storage methods. + +=back + +More complex sub-classes may have to replicate more of the logic internal of +Math::BigInt if they need to change more basic behaviors. A subclass that needs +to merely change the output only needs to overload C<bstr()>. + +All other object methods and overloaded functions can be directly inherited +from the parent class. + +At the very minimum, any subclass needs to provide its own C<new()> and can +store additional hash keys in the object. There are also some package globals +that must be defined, e.g.: + + # Globals + $accuracy = undef; + $precision = -2; # round to 2 decimal places + $round_mode = 'even'; + $div_scale = 40; + +Additionally, you might want to provide the following two globals to allow +auto-upgrading and auto-downgrading to work correctly: + + $upgrade = undef; + $downgrade = undef; + +This allows Math::BigInt to correctly retrieve package globals from the +subclass, like C<$SubClass::precision>. See t/Math/BigInt/Subclass.pm or +t/Math/BigFloat/SubClass.pm completely functional subclass examples. + +Don't forget to + + use overload; + +in your subclass to automatically inherit the overloading from the parent. If +you like, you can change part of the overloading, look at Math::String for an +example. + +=head1 UPGRADING + +When used like this: + + use Math::BigInt upgrade => 'Foo::Bar'; + +certain operations 'upgrade' their calculation and thus the result to the class +Foo::Bar. Usually this is used in conjunction with Math::BigFloat: + + use Math::BigInt upgrade => 'Math::BigFloat'; + +As a shortcut, you can use the module L<bignum>: + + use bignum; + +Also good for one-liners: + + perl -Mbignum -le 'print 2 ** 255' + +This makes it possible to mix arguments of different classes (as in 2.5 + 2) as +well es preserve accuracy (as in sqrt(3)). + +Beware: This feature is not fully implemented yet. + +=head2 Auto-upgrade + +The following methods upgrade themselves unconditionally; that is if upgrade is +in effect, they always hands up their work: + + div bsqrt blog bexp bpi bsin bcos batan batan2 + +All other methods upgrade themselves only when one (or all) of their arguments +are of the class mentioned in $upgrade. + +=head1 EXPORTS + +C<Math::BigInt> exports nothing by default, but can export the following +methods: + + bgcd + blcm + +=head1 CAVEATS + +Some things might not work as you expect them. Below is documented what is +known to be troublesome: + +=over + +=item Comparing numbers as strings + +Both C<bstr()> and C<bsstr()> as well as stringify via overload drop the +leading '+'. This is to be consistent with Perl and to make C<cmp> (especially +with overloading) to work as you expect. It also solves problems with +C<Test.pm> and L<Test::More>, which stringify arguments before comparing them. + +Mark Biggar said, when asked about to drop the '+' altogether, or make only +C<cmp> work: + + I agree (with the first alternative), don't add the '+' on positive + numbers. It's not as important anymore with the new internal form + for numbers. It made doing things like abs and neg easier, but + those have to be done differently now anyway. + +So, the following examples now works as expected: + + use Test::More tests => 1; + use Math::BigInt; + + my $x = Math::BigInt -> new(3*3); + my $y = Math::BigInt -> new(3*3); + + is($x,3*3, 'multiplication'); + print "$x eq 9" if $x eq $y; + print "$x eq 9" if $x eq '9'; + print "$x eq 9" if $x eq 3*3; + +Additionally, the following still works: + + print "$x == 9" if $x == $y; + print "$x == 9" if $x == 9; + print "$x == 9" if $x == 3*3; + +There is now a C<bsstr()> method to get the string in scientific notation aka +C<1e+2> instead of C<100>. Be advised that overloaded 'eq' always uses bstr() +for comparison, but Perl represents some numbers as 100 and others as 1e+308. +If in doubt, convert both arguments to Math::BigInt before comparing them as +strings: + + use Test::More tests => 3; + use Math::BigInt; + + $x = Math::BigInt->new('1e56'); $y = 1e56; + is($x,$y); # fails + is($x->bsstr(),$y); # okay + $y = Math::BigInt->new($y); + is($x,$y); # okay + +Alternatively, simply use C<< <=> >> for comparisons, this always gets it +right. There is not yet a way to get a number automatically represented as a +string that matches exactly the way Perl represents it. + +See also the section about L<Infinity and Not a Number> for problems in +comparing NaNs. + +=item int() + +C<int()> returns (at least for Perl v5.7.1 and up) another Math::BigInt, not a +Perl scalar: + + $x = Math::BigInt->new(123); + $y = int($x); # 123 as a Math::BigInt + $x = Math::BigFloat->new(123.45); + $y = int($x); # 123 as a Math::BigFloat + +If you want a real Perl scalar, use C<numify()>: + + $y = $x->numify(); # 123 as a scalar + +This is seldom necessary, though, because this is done automatically, like when +you access an array: + + $z = $array[$x]; # does work automatically + +=item Modifying and = + +Beware of: + + $x = Math::BigFloat->new(5); + $y = $x; + +This makes a second reference to the B<same> object and stores it in $y. Thus +anything that modifies $x (except overloaded operators) also modifies $y, and +vice versa. Or in other words, C<=> is only safe if you modify your +Math::BigInt objects only via overloaded math. As soon as you use a method call +it breaks: + + $x->bmul(2); + print "$x, $y\n"; # prints '10, 10' + +If you want a true copy of $x, use: + + $y = $x->copy(); + +You can also chain the calls like this, this first makes a copy and then +multiply it by 2: + + $y = $x->copy()->bmul(2); + +See also the documentation for overload.pm regarding C<=>. + +=item Overloading -$x + +The following: + + $x = -$x; + +is slower than + + $x->bneg(); + +since overload calls C<sub($x,0,1);> instead of C<neg($x)>. The first variant +needs to preserve $x since it does not know that it later gets overwritten. +This makes a copy of $x and takes O(N), but $x->bneg() is O(1). + +=item Mixing different object types + +With overloaded operators, it is the first (dominating) operand that determines +which method is called. Here are some examples showing what actually gets +called in various cases. + + use Math::BigInt; + use Math::BigFloat; + + $mbf = Math::BigFloat->new(5); + $mbi2 = Math::BigInt->new(5); + $mbi = Math::BigInt->new(2); + # what actually gets called: + $float = $mbf + $mbi; # $mbf->badd($mbi) + $float = $mbf / $mbi; # $mbf->bdiv($mbi) + $integer = $mbi + $mbf; # $mbi->badd($mbf) + $integer = $mbi2 / $mbi; # $mbi2->bdiv($mbi) + $integer = $mbi2 / $mbf; # $mbi2->bdiv($mbf) + +For instance, Math::BigInt->bdiv() always returns a Math::BigInt, regardless of +whether the second operant is a Math::BigFloat. To get a Math::BigFloat you +either need to call the operation manually, make sure each operand already is a +Math::BigFloat, or cast to that type via Math::BigFloat->new(): + + $float = Math::BigFloat->new($mbi2) / $mbi; # = 2.5 + +Beware of casting the entire expression, as this would cast the +result, at which point it is too late: + + $float = Math::BigFloat->new($mbi2 / $mbi); # = 2 + +Beware also of the order of more complicated expressions like: + + $integer = ($mbi2 + $mbi) / $mbf; # int / float => int + $integer = $mbi2 / Math::BigFloat->new($mbi); # ditto + +If in doubt, break the expression into simpler terms, or cast all operands +to the desired resulting type. + +Scalar values are a bit different, since: + + $float = 2 + $mbf; + $float = $mbf + 2; + +both result in the proper type due to the way the overloaded math works. + +This section also applies to other overloaded math packages, like Math::String. + +One solution to you problem might be autoupgrading|upgrading. See the +pragmas L<bignum>, L<bigint> and L<bigrat> for an easy way to do this. + +=back + +=head1 BUGS + +Please report any bugs or feature requests to +C<bug-math-bigint at rt.cpan.org>, or through the web interface at +L<https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigInt> (requires login). +We will be notified, and then you'll automatically be notified of progress on +your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Math::BigInt + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt> + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/Math-BigInt> + +=item * CPAN Ratings + +L<https://cpanratings.perl.org/dist/Math-BigInt> + +=item * MetaCPAN + +L<https://metacpan.org/release/Math-BigInt> + +=item * CPAN Testers Matrix + +L<http://matrix.cpantesters.org/?dist=Math-BigInt> + +=item * The Bignum mailing list + +=over 4 + +=item * Post to mailing list + +C<bignum at lists.scsys.co.uk> + +=item * View mailing list + +L<http://lists.scsys.co.uk/pipermail/bignum/> + +=item * Subscribe/Unsubscribe + +L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> + +=back + +=back + +=head1 LICENSE + +This program is free software; you may redistribute it and/or modify it under +the same terms as Perl itself. + +=head1 SEE ALSO + +L<Math::BigFloat> and L<Math::BigRat> as well as the backends +L<Math::BigInt::FastCalc>, L<Math::BigInt::GMP>, and L<Math::BigInt::Pari>. + +The pragmas L<bignum>, L<bigint> and L<bigrat> also might be of interest +because they solve the autoupgrading/downgrading issue, at least partly. + +=head1 AUTHORS + +=over 4 + +=item * + +Mark Biggar, overloaded interface by Ilya Zakharevich, 1996-2001. + +=item * + +Completely rewritten by Tels L<http://bloodgate.com>, 2001-2008. + +=item * + +Florian Ragwitz E<lt>flora@cpan.orgE<gt>, 2010. + +=item * + +Peter John Acklam E<lt>pjacklam@online.noE<gt>, 2011-. + +=back + +Many people contributed in one or more ways to the final beast, see the file +CREDITS for an (incomplete) list. If you miss your name, please drop me a +mail. Thank you! + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Math/BigRat.pm b/data/miniconda3/lib/perl5/core_perl/Math/BigRat.pm new file mode 100644 index 0000000000000000000000000000000000000000..e3d172836c0f6bf6277a06b19909028ad8f3860b --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Math/BigRat.pm @@ -0,0 +1,2781 @@ +# +# "Tax the rat farms." - Lord Vetinari +# + +# The following hash values are used: +# sign : +,-,NaN,+inf,-inf +# _d : denominator +# _n : numerator (value = _n/_d) +# _a : accuracy +# _p : precision +# You should not look at the innards of a BigRat - use the methods for this. + +package Math::BigRat; + +use 5.006; +use strict; +use warnings; + +use Carp qw< carp croak >; + +use Math::BigFloat 1.999718; + +our $VERSION = '0.2614'; + +our @ISA = qw(Math::BigFloat); + +our ($accuracy, $precision, $round_mode, $div_scale, + $upgrade, $downgrade, $_trap_nan, $_trap_inf); + +use overload + + # overload key: with_assign + + '+' => sub { $_[0] -> copy() -> badd($_[1]); }, + + '-' => sub { my $c = $_[0] -> copy; + $_[2] ? $c -> bneg() -> badd( $_[1]) + : $c -> bsub($_[1]); }, + + '*' => sub { $_[0] -> copy() -> bmul($_[1]); }, + + '/' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bdiv($_[0]) + : $_[0] -> copy() -> bdiv($_[1]); }, + + '%' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bmod($_[0]) + : $_[0] -> copy() -> bmod($_[1]); }, + + '**' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bpow($_[0]) + : $_[0] -> copy() -> bpow($_[1]); }, + + '<<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blsft($_[0]) + : $_[0] -> copy() -> blsft($_[1]); }, + + '>>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> brsft($_[0]) + : $_[0] -> copy() -> brsft($_[1]); }, + + # overload key: assign + + '+=' => sub { $_[0]->badd($_[1]); }, + + '-=' => sub { $_[0]->bsub($_[1]); }, + + '*=' => sub { $_[0]->bmul($_[1]); }, + + '/=' => sub { scalar $_[0]->bdiv($_[1]); }, + + '%=' => sub { $_[0]->bmod($_[1]); }, + + '**=' => sub { $_[0]->bpow($_[1]); }, + + '<<=' => sub { $_[0]->blsft($_[1]); }, + + '>>=' => sub { $_[0]->brsft($_[1]); }, + +# 'x=' => sub { }, + +# '.=' => sub { }, + + # overload key: num_comparison + + '<' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> blt($_[0]) + : $_[0] -> blt($_[1]); }, + + '<=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> ble($_[0]) + : $_[0] -> ble($_[1]); }, + + '>' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bgt($_[0]) + : $_[0] -> bgt($_[1]); }, + + '>=' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bge($_[0]) + : $_[0] -> bge($_[1]); }, + + '==' => sub { $_[0] -> beq($_[1]); }, + + '!=' => sub { $_[0] -> bne($_[1]); }, + + # overload key: 3way_comparison + + '<=>' => sub { my $cmp = $_[0] -> bcmp($_[1]); + defined($cmp) && $_[2] ? -$cmp : $cmp; }, + + 'cmp' => sub { $_[2] ? "$_[1]" cmp $_[0] -> bstr() + : $_[0] -> bstr() cmp "$_[1]"; }, + + # overload key: str_comparison + +# 'lt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrlt($_[0]) +# : $_[0] -> bstrlt($_[1]); }, +# +# 'le' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrle($_[0]) +# : $_[0] -> bstrle($_[1]); }, +# +# 'gt' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrgt($_[0]) +# : $_[0] -> bstrgt($_[1]); }, +# +# 'ge' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bstrge($_[0]) +# : $_[0] -> bstrge($_[1]); }, +# +# 'eq' => sub { $_[0] -> bstreq($_[1]); }, +# +# 'ne' => sub { $_[0] -> bstrne($_[1]); }, + + # overload key: binary + + '&' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> band($_[0]) + : $_[0] -> copy() -> band($_[1]); }, + + '&=' => sub { $_[0] -> band($_[1]); }, + + '|' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bior($_[0]) + : $_[0] -> copy() -> bior($_[1]); }, + + '|=' => sub { $_[0] -> bior($_[1]); }, + + '^' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> bxor($_[0]) + : $_[0] -> copy() -> bxor($_[1]); }, + + '^=' => sub { $_[0] -> bxor($_[1]); }, + +# '&.' => sub { }, + +# '&.=' => sub { }, + +# '|.' => sub { }, + +# '|.=' => sub { }, + +# '^.' => sub { }, + +# '^.=' => sub { }, + + # overload key: unary + + 'neg' => sub { $_[0] -> copy() -> bneg(); }, + +# '!' => sub { }, + + '~' => sub { $_[0] -> copy() -> bnot(); }, + +# '~.' => sub { }, + + # overload key: mutators + + '++' => sub { $_[0] -> binc() }, + + '--' => sub { $_[0] -> bdec() }, + + # overload key: func + + 'atan2' => sub { $_[2] ? ref($_[0]) -> new($_[1]) -> batan2($_[0]) + : $_[0] -> copy() -> batan2($_[1]); }, + + 'cos' => sub { $_[0] -> copy() -> bcos(); }, + + 'sin' => sub { $_[0] -> copy() -> bsin(); }, + + 'exp' => sub { $_[0] -> copy() -> bexp($_[1]); }, + + 'abs' => sub { $_[0] -> copy() -> babs(); }, + + 'log' => sub { $_[0] -> copy() -> blog(); }, + + 'sqrt' => sub { $_[0] -> copy() -> bsqrt(); }, + + 'int' => sub { $_[0] -> copy() -> bint(); }, + + # overload key: conversion + + 'bool' => sub { $_[0] -> is_zero() ? '' : 1; }, + + '""' => sub { $_[0] -> bstr(); }, + + '0+' => sub { $_[0] -> numify(); }, + + '=' => sub { $_[0]->copy(); }, + + ; + +BEGIN { + *objectify = \&Math::BigInt::objectify; # inherit this from BigInt + *AUTOLOAD = \&Math::BigFloat::AUTOLOAD; # can't inherit AUTOLOAD + # We inherit these from BigFloat because currently it is not possible that + # Math::BigFloat has a different $LIB variable than we, because + # Math::BigFloat also uses Math::BigInt::config->('lib') (there is always + # only one library loaded) + *_e_add = \&Math::BigFloat::_e_add; + *_e_sub = \&Math::BigFloat::_e_sub; + *as_number = \&as_int; + *is_pos = \&is_positive; + *is_neg = \&is_negative; +} + +############################################################################## +# Global constants and flags. Access these only via the accessor methods! + +$accuracy = $precision = undef; +$round_mode = 'even'; +$div_scale = 40; +$upgrade = undef; +$downgrade = undef; + +# These are internally, and not to be used from the outside at all! + +$_trap_nan = 0; # are NaNs ok? set w/ config() +$_trap_inf = 0; # are infs ok? set w/ config() + +# the math backend library + +my $LIB = 'Math::BigInt::Calc'; + +my $nan = 'NaN'; +#my $class = 'Math::BigRat'; + +sub isa { + return 0 if $_[1] =~ /^Math::Big(Int|Float)/; # we aren't + UNIVERSAL::isa(@_); +} + +############################################################################## + +sub new { + my $proto = shift; + my $protoref = ref $proto; + my $class = $protoref || $proto; + + # Check the way we are called. + + if ($protoref) { + croak("new() is a class method, not an instance method"); + } + + if (@_ < 1) { + #carp("Using new() with no argument is deprecated;", + # " use bzero() or new(0) instead"); + return $class -> bzero(); + } + + if (@_ > 2) { + carp("Superfluous arguments to new() ignored."); + } + + # Get numerator and denominator. If any of the arguments is undefined, + # return zero. + + my ($n, $d) = @_; + + if (@_ == 1 && !defined $n || + @_ == 2 && (!defined $n || !defined $d)) + { + #carp("Use of uninitialized value in new()"); + return $class -> bzero(); + } + + # Initialize a new object. + + my $self = bless {}, $class; + + # One or two input arguments may be given. First handle the numerator $n. + + if (ref($n)) { + $n = Math::BigFloat -> new($n, undef, undef) + unless ($n -> isa('Math::BigRat') || + $n -> isa('Math::BigInt') || + $n -> isa('Math::BigFloat')); + } else { + if (defined $d) { + # If the denominator is defined, the numerator is not a string + # fraction, e.g., "355/113". + $n = Math::BigFloat -> new($n, undef, undef); + } else { + # If the denominator is undefined, the numerator might be a string + # fraction, e.g., "355/113". + if ($n =~ m| ^ \s* (\S+) \s* / \s* (\S+) \s* $ |x) { + $n = Math::BigFloat -> new($1, undef, undef); + $d = Math::BigFloat -> new($2, undef, undef); + } else { + $n = Math::BigFloat -> new($n, undef, undef); + } + } + } + + # At this point $n is an object and $d is either an object or undefined. An + # undefined $d means that $d was not specified by the caller (not that $d + # was specified as an undefined value). + + unless (defined $d) { + #return $n -> copy($n) if $n -> isa('Math::BigRat'); + return $class -> copy($n) if $n -> isa('Math::BigRat'); + return $class -> bnan() if $n -> is_nan(); + return $class -> binf($n -> sign()) if $n -> is_inf(); + + if ($n -> isa('Math::BigInt')) { + $self -> {_n} = $LIB -> _new($n -> copy() -> babs() -> bstr()); + $self -> {_d} = $LIB -> _one(); + $self -> {sign} = $n -> sign(); + return $self; + } + + if ($n -> isa('Math::BigFloat')) { + my $m = $n -> mantissa() -> babs(); + my $e = $n -> exponent(); + $self -> {_n} = $LIB -> _new($m -> bstr()); + $self -> {_d} = $LIB -> _one(); + + if ($e > 0) { + $self -> {_n} = $LIB -> _lsft($self -> {_n}, + $LIB -> _new($e -> bstr()), 10); + } elsif ($e < 0) { + $self -> {_d} = $LIB -> _lsft($self -> {_d}, + $LIB -> _new(-$e -> bstr()), 10); + + my $gcd = $LIB -> _gcd($LIB -> _copy($self -> {_n}), $self -> {_d}); + if (!$LIB -> _is_one($gcd)) { + $self -> {_n} = $LIB -> _div($self->{_n}, $gcd); + $self -> {_d} = $LIB -> _div($self->{_d}, $gcd); + } + } + + $self -> {sign} = $n -> sign(); + return $self; + } + + die "I don't know how to handle this"; # should never get here + } + + # At the point we know that both $n and $d are defined. We know that $n is + # an object, but $d might still be a scalar. Now handle $d. + + $d = Math::BigFloat -> new($d, undef, undef) + unless ref($d) && ($d -> isa('Math::BigRat') || + $d -> isa('Math::BigInt') || + $d -> isa('Math::BigFloat')); + + # At this point both $n and $d are objects. + + return $class -> bnan() if $n -> is_nan() || $d -> is_nan(); + + # At this point neither $n nor $d is a NaN. + + if ($n -> is_zero()) { + return $class -> bnan() if $d -> is_zero(); # 0/0 = NaN + return $class -> bzero(); + } + + return $class -> binf($d -> sign()) if $d -> is_zero(); + + # At this point, neither $n nor $d is a NaN or a zero. + + if ($d < 0) { # make sure denominator is positive + $n -> bneg(); + $d -> bneg(); + } + + if ($n -> is_inf()) { + return $class -> bnan() if $d -> is_inf(); # Inf/Inf = NaN + return $class -> binf($n -> sign()); + } + + # At this point $n is finite. + + return $class -> bzero() if $d -> is_inf(); + return $class -> binf($d -> sign()) if $d -> is_zero(); + + # At this point both $n and $d are finite and non-zero. + + if ($n < 0) { + $n -> bneg(); + $self -> {sign} = '-'; + } else { + $self -> {sign} = '+'; + } + + if ($n -> isa('Math::BigRat')) { + + if ($d -> isa('Math::BigRat')) { + + # At this point both $n and $d is a Math::BigRat. + + # p r p * s (p / gcd(p, r)) * (s / gcd(s, q)) + # - / - = ----- = --------------------------------- + # q s q * r (q / gcd(s, q)) * (r / gcd(p, r)) + + my $p = $n -> {_n}; + my $q = $n -> {_d}; + my $r = $d -> {_n}; + my $s = $d -> {_d}; + my $gcd_pr = $LIB -> _gcd($LIB -> _copy($p), $r); + my $gcd_sq = $LIB -> _gcd($LIB -> _copy($s), $q); + $self -> {_n} = $LIB -> _mul($LIB -> _div($LIB -> _copy($p), $gcd_pr), + $LIB -> _div($LIB -> _copy($s), $gcd_sq)); + $self -> {_d} = $LIB -> _mul($LIB -> _div($LIB -> _copy($q), $gcd_sq), + $LIB -> _div($LIB -> _copy($r), $gcd_pr)); + + return $self; # no need for $self -> bnorm() here + } + + # At this point, $n is a Math::BigRat and $d is a Math::Big(Int|Float). + + my $p = $n -> {_n}; + my $q = $n -> {_d}; + my $m = $d -> mantissa(); + my $e = $d -> exponent(); + + # / p + # | ------------ if e > 0 + # | q * m * 10^e + # | + # p | p + # - / (m * 10^e) = | ----- if e == 0 + # q | q * m + # | + # | p * 10^-e + # | -------- if e < 0 + # \ q * m + + $self -> {_n} = $LIB -> _copy($p); + $self -> {_d} = $LIB -> _mul($LIB -> _copy($q), $m); + if ($e > 0) { + $self -> {_d} = $LIB -> _lsft($self -> {_d}, $e, 10); + } elsif ($e < 0) { + $self -> {_n} = $LIB -> _lsft($self -> {_n}, -$e, 10); + } + + return $self -> bnorm(); + + } else { + + if ($d -> isa('Math::BigRat')) { + + # At this point $n is a Math::Big(Int|Float) and $d is a + # Math::BigRat. + + my $m = $n -> mantissa(); + my $e = $n -> exponent(); + my $p = $d -> {_n}; + my $q = $d -> {_d}; + + # / q * m * 10^e + # | ------------ if e > 0 + # | p + # | + # p | m * q + # (m * 10^e) / - = | ----- if e == 0 + # q | p + # | + # | q * m + # | --------- if e < 0 + # \ p * 10^-e + + $self -> {_n} = $LIB -> _mul($LIB -> _copy($q), $m); + $self -> {_d} = $LIB -> _copy($p); + if ($e > 0) { + $self -> {_n} = $LIB -> _lsft($self -> {_n}, $e, 10); + } elsif ($e < 0) { + $self -> {_d} = $LIB -> _lsft($self -> {_d}, -$e, 10); + } + return $self -> bnorm(); + + } else { + + # At this point $n and $d are both a Math::Big(Int|Float) + + my $m1 = $n -> mantissa(); + my $e1 = $n -> exponent(); + my $m2 = $d -> mantissa(); + my $e2 = $d -> exponent(); + + # / + # | m1 * 10^(e1 - e2) + # | ----------------- if e1 > e2 + # | m2 + # | + # m1 * 10^e1 | m1 + # ---------- = | -- if e1 = e2 + # m2 * 10^e2 | m2 + # | + # | m1 + # | ----------------- if e1 < e2 + # | m2 * 10^(e2 - e1) + # \ + + $self -> {_n} = $LIB -> _new($m1 -> bstr()); + $self -> {_d} = $LIB -> _new($m2 -> bstr()); + my $ediff = $e1 - $e2; + if ($ediff > 0) { + $self -> {_n} = $LIB -> _lsft($self -> {_n}, + $LIB -> _new($ediff -> bstr()), + 10); + } elsif ($ediff < 0) { + $self -> {_d} = $LIB -> _lsft($self -> {_d}, + $LIB -> _new(-$ediff -> bstr()), + 10); + } + + return $self -> bnorm(); + } + } + + return $self; +} + +sub copy { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + # If called as a class method, the object to copy is the next argument. + + $self = shift() unless $selfref; + + my $copy = bless {}, $class; + + $copy->{sign} = $self->{sign}; + $copy->{_d} = $LIB->_copy($self->{_d}); + $copy->{_n} = $LIB->_copy($self->{_n}); + $copy->{_a} = $self->{_a} if defined $self->{_a}; + $copy->{_p} = $self->{_p} if defined $self->{_p}; + + #($copy, $copy->{_a}, $copy->{_p}) + # = $copy->_find_round_parameters(@_); + + return $copy; +} + +sub bnan { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self = bless {}, $class unless $selfref; + + if ($_trap_nan) { + croak ("Tried to set a variable to NaN in $class->bnan()"); + } + + $self -> {sign} = $nan; + $self -> {_n} = $LIB -> _zero(); + $self -> {_d} = $LIB -> _one(); + + ($self, $self->{_a}, $self->{_p}) + = $self->_find_round_parameters(@_); + + return $self; +} + +sub binf { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self = bless {}, $class unless $selfref; + + my $sign = shift(); + $sign = defined($sign) && substr($sign, 0, 1) eq '-' ? '-inf' : '+inf'; + + if ($_trap_inf) { + croak ("Tried to set a variable to +-inf in $class->binf()"); + } + + $self -> {sign} = $sign; + $self -> {_n} = $LIB -> _zero(); + $self -> {_d} = $LIB -> _one(); + + ($self, $self->{_a}, $self->{_p}) + = $self->_find_round_parameters(@_); + + return $self; +} + +sub bone { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self = bless {}, $class unless $selfref; + + my $sign = shift(); + $sign = '+' unless defined($sign) && $sign eq '-'; + + $self -> {sign} = $sign; + $self -> {_n} = $LIB -> _one(); + $self -> {_d} = $LIB -> _one(); + + ($self, $self->{_a}, $self->{_p}) + = $self->_find_round_parameters(@_); + + return $self; +} + +sub bzero { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + $self = bless {}, $class unless $selfref; + + $self -> {sign} = '+'; + $self -> {_n} = $LIB -> _zero(); + $self -> {_d} = $LIB -> _one(); + + ($self, $self->{_a}, $self->{_p}) + = $self->_find_round_parameters(@_); + + return $self; +} + +############################################################################## + +sub config { + # return (later set?) configuration data as hash ref + my $class = shift() || 'Math::BigRat'; + + if (@_ == 1 && ref($_[0]) ne 'HASH') { + my $cfg = $class->SUPER::config(); + return $cfg->{$_[0]}; + } + + my $cfg = $class->SUPER::config(@_); + + # now we need only to override the ones that are different from our parent + $cfg->{class} = $class; + $cfg->{with} = $LIB; + + $cfg; +} + +############################################################################## + +sub bstr { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { # inf, NaN etc + my $s = $x->{sign}; + $s =~ s/^\+//; # +inf => inf + return $s; + } + + my $s = ''; + $s = $x->{sign} if $x->{sign} ne '+'; # '+3/2' => '3/2' + + return $s . $LIB->_str($x->{_n}) if $LIB->_is_one($x->{_d}); + $s . $LIB->_str($x->{_n}) . '/' . $LIB->_str($x->{_d}); +} + +sub bsstr { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + if ($x->{sign} !~ /^[+-]$/) { # inf, NaN etc + my $s = $x->{sign}; + $s =~ s/^\+//; # +inf => inf + return $s; + } + + my $s = ''; + $s = $x->{sign} if $x->{sign} ne '+'; # +3 vs 3 + $s . $LIB->_str($x->{_n}) . '/' . $LIB->_str($x->{_d}); +} + +sub bnorm { + # reduce the number to the shortest form + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + # Both parts must be objects of whatever we are using today. + if (my $c = $LIB->_check($x->{_n})) { + croak("n did not pass the self-check ($c) in bnorm()"); + } + if (my $c = $LIB->_check($x->{_d})) { + croak("d did not pass the self-check ($c) in bnorm()"); + } + + # no normalize for NaN, inf etc. + return $x if $x->{sign} !~ /^[+-]$/; + + # normalize zeros to 0/1 + if ($LIB->_is_zero($x->{_n})) { + $x->{sign} = '+'; # never leave a -0 + $x->{_d} = $LIB->_one() unless $LIB->_is_one($x->{_d}); + return $x; + } + + return $x if $LIB->_is_one($x->{_d}); # no need to reduce + + # Compute the GCD. + my $gcd = $LIB->_gcd($LIB->_copy($x->{_n}), $x->{_d}); + if (!$LIB->_is_one($gcd)) { + $x->{_n} = $LIB->_div($x->{_n}, $gcd); + $x->{_d} = $LIB->_div($x->{_d}, $gcd); + } + + $x; +} + +############################################################################## +# sign manipulation + +sub bneg { + # (BRAT or num_str) return BRAT + # negate number or make a negated number from string + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x if $x->modify('bneg'); + + # for +0 do not negate (to have always normalized +0). Does nothing for 'NaN' + $x->{sign} =~ tr/+-/-+/ + unless ($x->{sign} eq '+' && $LIB->_is_zero($x->{_n})); + $x; +} + +############################################################################## +# special values + +sub _bnan { + # used by parent class bnan() to initialize number to NaN + my $self = shift; + + if ($_trap_nan) { + my $class = ref($self); + # "$self" below will stringify the object, this blows up if $self is a + # partial object (happens under trap_nan), so fix it beforehand + $self->{_d} = $LIB->_zero() unless defined $self->{_d}; + $self->{_n} = $LIB->_zero() unless defined $self->{_n}; + croak ("Tried to set $self to NaN in $class\::_bnan()"); + } + $self->{_n} = $LIB->_zero(); + $self->{_d} = $LIB->_zero(); +} + +sub _binf { + # used by parent class bone() to initialize number to +inf/-inf + my $self = shift; + + if ($_trap_inf) { + my $class = ref($self); + # "$self" below will stringify the object, this blows up if $self is a + # partial object (happens under trap_nan), so fix it beforehand + $self->{_d} = $LIB->_zero() unless defined $self->{_d}; + $self->{_n} = $LIB->_zero() unless defined $self->{_n}; + croak ("Tried to set $self to inf in $class\::_binf()"); + } + $self->{_n} = $LIB->_zero(); + $self->{_d} = $LIB->_zero(); +} + +sub _bone { + # used by parent class bone() to initialize number to +1/-1 + my $self = shift; + $self->{_n} = $LIB->_one(); + $self->{_d} = $LIB->_one(); +} + +sub _bzero { + # used by parent class bzero() to initialize number to 0 + my $self = shift; + $self->{_n} = $LIB->_zero(); + $self->{_d} = $LIB->_one(); +} + +############################################################################## +# mul/add/div etc + +sub badd { + # add two rational numbers + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + # +inf + +inf => +inf, -inf + -inf => -inf + return $x->binf(substr($x->{sign}, 0, 1)) + if $x->{sign} eq $y->{sign} && $x->{sign} =~ /^[+-]inf$/; + + # +inf + -inf or -inf + +inf => NaN + return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/); + + # 1 1 gcd(3, 4) = 1 1*3 + 1*4 7 + # - + - = --------- = -- + # 4 3 4*3 12 + + # we do not compute the gcd() here, but simple do: + # 5 7 5*3 + 7*4 43 + # - + - = --------- = -- + # 4 3 4*3 12 + + # and bnorm() will then take care of the rest + + # 5 * 3 + $x->{_n} = $LIB->_mul($x->{_n}, $y->{_d}); + + # 7 * 4 + my $m = $LIB->_mul($LIB->_copy($y->{_n}), $x->{_d}); + + # 5 * 3 + 7 * 4 + ($x->{_n}, $x->{sign}) = _e_add($x->{_n}, $m, $x->{sign}, $y->{sign}); + + # 4 * 3 + $x->{_d} = $LIB->_mul($x->{_d}, $y->{_d}); + + # normalize result, and possible round + $x->bnorm()->round(@r); +} + +sub bsub { + # subtract two rational numbers + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + # flip sign of $x, call badd(), then flip sign of result + $x->{sign} =~ tr/+-/-+/ + unless $x->{sign} eq '+' && $LIB->_is_zero($x->{_n}); # not -0 + $x->badd($y, @r); # does norm and round + $x->{sign} =~ tr/+-/-+/ + unless $x->{sign} eq '+' && $LIB->_is_zero($x->{_n}); # not -0 + + $x; +} + +sub bmul { + # multiply two rational numbers + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x->bnan() if $x->{sign} eq 'NaN' || $y->{sign} eq 'NaN'; + + # inf handling + if ($x->{sign} =~ /^[+-]inf$/ || $y->{sign} =~ /^[+-]inf$/) { + return $x->bnan() if $x->is_zero() || $y->is_zero(); + # result will always be +-inf: + # +inf * +/+inf => +inf, -inf * -/-inf => +inf + # +inf * -/-inf => -inf, -inf * +/+inf => -inf + return $x->binf() if ($x->{sign} =~ /^\+/ && $y->{sign} =~ /^\+/); + return $x->binf() if ($x->{sign} =~ /^-/ && $y->{sign} =~ /^-/); + return $x->binf('-'); + } + + # x == 0 # also: or y == 1 or y == -1 + return wantarray ? ($x, $class->bzero()) : $x if $x -> is_zero(); + + if ($y -> is_zero()) { + $x -> bzero(); + return wantarray ? ($x, $class->bzero()) : $x; + } + + # According to Knuth, this can be optimized by doing gcd twice (for d + # and n) and reducing in one step. This saves us a bnorm() at the end. + # + # p s p * s (p / gcd(p, r)) * (s / gcd(s, q)) + # - * - = ----- = --------------------------------- + # q r q * r (q / gcd(s, q)) * (r / gcd(p, r)) + + my $gcd_pr = $LIB -> _gcd($LIB -> _copy($x->{_n}), $y->{_d}); + my $gcd_sq = $LIB -> _gcd($LIB -> _copy($y->{_n}), $x->{_d}); + + $x->{_n} = $LIB -> _mul(scalar $LIB -> _div($x->{_n}, $gcd_pr), + scalar $LIB -> _div($LIB -> _copy($y->{_n}), + $gcd_sq)); + $x->{_d} = $LIB -> _mul(scalar $LIB -> _div($x->{_d}, $gcd_sq), + scalar $LIB -> _div($LIB -> _copy($y->{_d}), + $gcd_pr)); + + # compute new sign + $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; + + $x->round(@r); +} + +sub bdiv { + # (dividend: BRAT or num_str, divisor: BRAT or num_str) return + # (BRAT, BRAT) (quo, rem) or BRAT (only rem) + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bdiv'); + + my $wantarray = wantarray; # call only once + + # At least one argument is NaN. This is handled the same way as in + # Math::BigInt -> bdiv(). See the comments in the code implementing that + # method. + + if ($x -> is_nan() || $y -> is_nan()) { + return $wantarray ? ($x -> bnan(), $class -> bnan()) : $x -> bnan(); + } + + # Divide by zero and modulo zero. This is handled the same way as in + # Math::BigInt -> bdiv(). See the comments in the code implementing that + # method. + + if ($y -> is_zero()) { + my ($quo, $rem); + if ($wantarray) { + $rem = $x -> copy(); + } + if ($x -> is_zero()) { + $quo = $x -> bnan(); + } else { + $quo = $x -> binf($x -> {sign}); + } + return $wantarray ? ($quo, $rem) : $quo; + } + + # Numerator (dividend) is +/-inf. This is handled the same way as in + # Math::BigInt -> bdiv(). See the comments in the code implementing that + # method. + + if ($x -> is_inf()) { + my ($quo, $rem); + $rem = $class -> bnan() if $wantarray; + if ($y -> is_inf()) { + $quo = $x -> bnan(); + } else { + my $sign = $x -> bcmp(0) == $y -> bcmp(0) ? '+' : '-'; + $quo = $x -> binf($sign); + } + return $wantarray ? ($quo, $rem) : $quo; + } + + # Denominator (divisor) is +/-inf. This is handled the same way as in + # Math::BigFloat -> bdiv(). See the comments in the code implementing that + # method. + + if ($y -> is_inf()) { + my ($quo, $rem); + if ($wantarray) { + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + $rem = $x -> copy(); + $quo = $x -> bzero(); + } else { + $rem = $class -> binf($y -> {sign}); + $quo = $x -> bone('-'); + } + return ($quo, $rem); + } else { + if ($y -> is_inf()) { + if ($x -> is_nan() || $x -> is_inf()) { + return $x -> bnan(); + } else { + return $x -> bzero(); + } + } + } + } + + # At this point, both the numerator and denominator are finite numbers, and + # the denominator (divisor) is non-zero. + + # x == 0? + return wantarray ? ($x, $class->bzero()) : $x if $x->is_zero(); + + # XXX TODO: list context, upgrade + # According to Knuth, this can be optimized by doing gcd twice (for d and n) + # and reducing in one step. This would save us the bnorm() at the end. + # + # p r p * s (p / gcd(p, r)) * (s / gcd(s, q)) + # - / - = ----- = --------------------------------- + # q s q * r (q / gcd(s, q)) * (r / gcd(p, r)) + + $x->{_n} = $LIB->_mul($x->{_n}, $y->{_d}); + $x->{_d} = $LIB->_mul($x->{_d}, $y->{_n}); + + # compute new sign + $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; + + $x -> bnorm(); + if (wantarray) { + my $rem = $x -> copy(); + $x -> bfloor(); + $x -> round(@r); + $rem -> bsub($x -> copy()) -> bmul($y); + return $x, $rem; + } else { + $x -> round(@r); + return $x; + } +} + +sub bmod { + # compute "remainder" (in Perl way) of $x / $y + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + return $x if $x->modify('bmod'); + + # At least one argument is NaN. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($x -> is_nan() || $y -> is_nan()) { + return $x -> bnan(); + } + + # Modulo zero. This is handled the same way as in Math::BigInt -> bmod(). + + if ($y -> is_zero()) { + return $x; + } + + # Numerator (dividend) is +/-inf. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($x -> is_inf()) { + return $x -> bnan(); + } + + # Denominator (divisor) is +/-inf. This is handled the same way as in + # Math::BigInt -> bmod(). + + if ($y -> is_inf()) { + if ($x -> is_zero() || $x -> bcmp(0) == $y -> bcmp(0)) { + return $x; + } else { + return $x -> binf($y -> sign()); + } + } + + # At this point, both the numerator and denominator are finite numbers, and + # the denominator (divisor) is non-zero. + + return $x if $x->is_zero(); # 0 / 7 = 0, mod 0 + + # Compute $x - $y * floor($x/$y). This can probably be optimized by working + # on a lower level. + + $x -> bsub($x -> copy() -> bdiv($y) -> bfloor() -> bmul($y)); + return $x -> round(@r); +} + +############################################################################## +# bdec/binc + +sub bdec { + # decrement value (subtract 1) + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->{sign} !~ /^[+-]$/; # NaN, inf, -inf + + if ($x->{sign} eq '-') { + $x->{_n} = $LIB->_add($x->{_n}, $x->{_d}); # -5/2 => -7/2 + } else { + if ($LIB->_acmp($x->{_n}, $x->{_d}) < 0) # n < d? + { + # 1/3 -- => -2/3 + $x->{_n} = $LIB->_sub($LIB->_copy($x->{_d}), $x->{_n}); + $x->{sign} = '-'; + } else { + $x->{_n} = $LIB->_sub($x->{_n}, $x->{_d}); # 5/2 => 3/2 + } + } + $x->bnorm()->round(@r); +} + +sub binc { + # increment value (add 1) + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x if $x->{sign} !~ /^[+-]$/; # NaN, inf, -inf + + if ($x->{sign} eq '-') { + if ($LIB->_acmp($x->{_n}, $x->{_d}) < 0) { + # -1/3 ++ => 2/3 (overflow at 0) + $x->{_n} = $LIB->_sub($LIB->_copy($x->{_d}), $x->{_n}); + $x->{sign} = '+'; + } else { + $x->{_n} = $LIB->_sub($x->{_n}, $x->{_d}); # -5/2 => -3/2 + } + } else { + $x->{_n} = $LIB->_add($x->{_n}, $x->{_d}); # 5/2 => 7/2 + } + $x->bnorm()->round(@r); +} + +############################################################################## +# is_foo methods (the rest is inherited) + +sub is_int { + # return true if arg (BRAT or num_str) is an integer + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 1 if ($x->{sign} =~ /^[+-]$/) && # NaN and +-inf aren't + $LIB->_is_one($x->{_d}); # x/y && y != 1 => no integer + 0; +} + +sub is_zero { + # return true if arg (BRAT or num_str) is zero + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 1 if $x->{sign} eq '+' && $LIB->_is_zero($x->{_n}); + 0; +} + +sub is_one { + # return true if arg (BRAT or num_str) is +1 or -1 if signis given + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + croak "too many arguments for is_one()" if @_ > 2; + my $sign = $_[1] || ''; + $sign = '+' if $sign ne '-'; + return 1 if ($x->{sign} eq $sign && + $LIB->_is_one($x->{_n}) && $LIB->_is_one($x->{_d})); + 0; +} + +sub is_odd { + # return true if arg (BFLOAT or num_str) is odd or false if even + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 1 if ($x->{sign} =~ /^[+-]$/) && # NaN & +-inf aren't + ($LIB->_is_one($x->{_d}) && $LIB->_is_odd($x->{_n})); # x/2 is not, but 3/1 + 0; +} + +sub is_even { + # return true if arg (BINT or num_str) is even or false if odd + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return 0 if $x->{sign} !~ /^[+-]$/; # NaN & +-inf aren't + return 1 if ($LIB->_is_one($x->{_d}) # x/3 is never + && $LIB->_is_even($x->{_n})); # but 4/1 is + 0; +} + +############################################################################## +# parts() and friends + +sub numerator { + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + # NaN, inf, -inf + return Math::BigInt->new($x->{sign}) if ($x->{sign} !~ /^[+-]$/); + + my $n = Math::BigInt->new($LIB->_str($x->{_n})); + $n->{sign} = $x->{sign}; + $n; +} + +sub denominator { + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + # NaN + return Math::BigInt->new($x->{sign}) if $x->{sign} eq 'NaN'; + # inf, -inf + return Math::BigInt->bone() if $x->{sign} !~ /^[+-]$/; + + Math::BigInt->new($LIB->_str($x->{_d})); +} + +sub parts { + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + my $c = 'Math::BigInt'; + + return ($c->bnan(), $c->bnan()) if $x->{sign} eq 'NaN'; + return ($c->binf(), $c->binf()) if $x->{sign} eq '+inf'; + return ($c->binf('-'), $c->binf()) if $x->{sign} eq '-inf'; + + my $n = $c->new($LIB->_str($x->{_n})); + $n->{sign} = $x->{sign}; + my $d = $c->new($LIB->_str($x->{_d})); + ($n, $d); +} + +sub length { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $nan unless $x->is_int(); + $LIB->_len($x->{_n}); # length(-123/1) => length(123) +} + +sub digit { + my ($class, $x, $n) = ref($_[0]) ? (undef, $_[0], $_[1]) : objectify(1, @_); + + return $nan unless $x->is_int(); + $LIB->_digit($x->{_n}, $n || 0); # digit(-123/1, 2) => digit(123, 2) +} + +############################################################################## +# special calc routines + +sub bceil { + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x if ($x->{sign} !~ /^[+-]$/ || # not for NaN, inf + $LIB->_is_one($x->{_d})); # 22/1 => 22, 0/1 => 0 + + $x->{_n} = $LIB->_div($x->{_n}, $x->{_d}); # 22/7 => 3/1 w/ truncate + $x->{_d} = $LIB->_one(); # d => 1 + $x->{_n} = $LIB->_inc($x->{_n}) if $x->{sign} eq '+'; # +22/7 => 4/1 + $x->{sign} = '+' if $x->{sign} eq '-' && $LIB->_is_zero($x->{_n}); # -0 => 0 + $x; +} + +sub bfloor { + my ($class, $x) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x if ($x->{sign} !~ /^[+-]$/ || # not for NaN, inf + $LIB->_is_one($x->{_d})); # 22/1 => 22, 0/1 => 0 + + $x->{_n} = $LIB->_div($x->{_n}, $x->{_d}); # 22/7 => 3/1 w/ truncate + $x->{_d} = $LIB->_one(); # d => 1 + $x->{_n} = $LIB->_inc($x->{_n}) if $x->{sign} eq '-'; # -22/7 => -4/1 + $x; +} + +sub bint { + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), $_[0]) : objectify(1, @_); + + return $x if ($x->{sign} !~ /^[+-]$/ || # +/-inf or NaN + $LIB -> _is_one($x->{_d})); # already an integer + + $x->{_n} = $LIB->_div($x->{_n}, $x->{_d}); # 22/7 => 3/1 w/ truncate + $x->{_d} = $LIB->_one(); # d => 1 + $x->{sign} = '+' if $x->{sign} eq '-' && $LIB -> _is_zero($x->{_n}); + return $x; +} + +sub bfac { + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + # if $x is not an integer + if (($x->{sign} ne '+') || (!$LIB->_is_one($x->{_d}))) { + return $x->bnan(); + } + + $x->{_n} = $LIB->_fac($x->{_n}); + # since _d is 1, we don't need to reduce/norm the result + $x->round(@r); +} + +sub bpow { + # power ($x ** $y) + + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + # $x and/or $y is a NaN + return $x->bnan() if $x->is_nan() || $y->is_nan(); + + # $x and/or $y is a +/-Inf + if ($x->is_inf("-")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x if $y->is_odd(); + return $x->bneg(); + } elsif ($x->is_inf("+")) { + return $x->bzero() if $y->is_negative(); + return $x->bnan() if $y->is_zero(); + return $x; + } elsif ($y->is_inf("-")) { + return $x->bnan() if $x -> is_one("-"); + return $x->binf("+") if $x > -1 && $x < 1; + return $x->bone() if $x -> is_one("+"); + return $x->bzero(); + } elsif ($y->is_inf("+")) { + return $x->bnan() if $x -> is_one("-"); + return $x->bzero() if $x > -1 && $x < 1; + return $x->bone() if $x -> is_one("+"); + return $x->binf("+"); + } + + if ($x->is_zero()) { + return $x->binf() if $y->is_negative(); + return $x->bone("+") if $y->is_zero(); + return $x; + } elsif ($x->is_one()) { + return $x->round(@r) if $y->is_odd(); # x is -1, y is odd => -1 + return $x->babs()->round(@r); # x is -1, y is even => 1 + } elsif ($y->is_zero()) { + return $x->bone(@r); # x^0 and x != 0 => 1 + } elsif ($y->is_one()) { + return $x->round(@r); # x^1 => x + } + + # we don't support complex numbers, so return NaN + return $x->bnan() if $x->is_negative() && !$y->is_int(); + + # (a/b)^-(c/d) = (b/a)^(c/d) + ($x->{_n}, $x->{_d}) = ($x->{_d}, $x->{_n}) if $y->is_negative(); + + unless ($LIB->_is_one($y->{_n})) { + $x->{_n} = $LIB->_pow($x->{_n}, $y->{_n}); + $x->{_d} = $LIB->_pow($x->{_d}, $y->{_n}); + $x->{sign} = '+' if $x->{sign} eq '-' && $LIB->_is_even($y->{_n}); + } + + unless ($LIB->_is_one($y->{_d})) { + return $x->bsqrt(@r) if $LIB->_is_two($y->{_d}); # 1/2 => sqrt + return $x->broot($LIB->_str($y->{_d}), @r); # 1/N => root(N) + } + + return $x->round(@r); +} + +sub blog { + # Return the logarithm of the operand. If a second operand is defined, that + # value is used as the base, otherwise the base is assumed to be Euler's + # constant. + + my ($class, $x, $base, @r); + + # Don't objectify the base, since an undefined base, as in $x->blog() or + # $x->blog(undef) signals that the base is Euler's number. + + if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { + # E.g., Math::BigFloat->blog(256, 2) + ($class, $x, $base, @r) = + defined $_[2] ? objectify(2, @_) : objectify(1, @_); + } else { + # E.g., Math::BigFloat::blog(256, 2) or $x->blog(2) + ($class, $x, $base, @r) = + defined $_[1] ? objectify(2, @_) : objectify(1, @_); + } + + return $x if $x->modify('blog'); + + # Handle all exception cases and all trivial cases. I have used Wolfram Alpha + # (http://www.wolframalpha.com) as the reference for these cases. + + return $x -> bnan() if $x -> is_nan(); + + if (defined $base) { + $base = $class -> new($base) unless ref $base; + if ($base -> is_nan() || $base -> is_one()) { + return $x -> bnan(); + } elsif ($base -> is_inf() || $base -> is_zero()) { + return $x -> bnan() if $x -> is_inf() || $x -> is_zero(); + return $x -> bzero(); + } elsif ($base -> is_negative()) { # -inf < base < 0 + return $x -> bzero() if $x -> is_one(); # x = 1 + return $x -> bone() if $x == $base; # x = base + return $x -> bnan(); # otherwise + } + return $x -> bone() if $x == $base; # 0 < base && 0 < x < inf + } + + # We now know that the base is either undefined or positive and finite. + + if ($x -> is_inf()) { # x = +/-inf + my $sign = defined $base && $base < 1 ? '-' : '+'; + return $x -> binf($sign); + } elsif ($x -> is_neg()) { # -inf < x < 0 + return $x -> bnan(); + } elsif ($x -> is_one()) { # x = 1 + return $x -> bzero(); + } elsif ($x -> is_zero()) { # x = 0 + my $sign = defined $base && $base < 1 ? '+' : '-'; + return $x -> binf($sign); + } + + # At this point we are done handling all exception cases and trivial cases. + + $base = Math::BigFloat -> new($base) if defined $base; + + my $xn = Math::BigFloat -> new($LIB -> _str($x->{_n})); + my $xd = Math::BigFloat -> new($LIB -> _str($x->{_d})); + + my $xtmp = Math::BigRat -> new($xn -> bdiv($xd) -> blog($base, @r) -> bsstr()); + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x; +} + +sub bexp { + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(1, @_); + } + + return $x->binf(@r) if $x->{sign} eq '+inf'; + return $x->bzero(@r) if $x->{sign} eq '-inf'; + + # we need to limit the accuracy to protect against overflow + my $fallback = 0; + my ($scale, @params); + ($x, @params) = $x->_find_round_parameters(@r); + + # also takes care of the "error in _find_round_parameters?" case + return $x if $x->{sign} eq 'NaN'; + + # no rounding at all, so must use fallback + if (scalar @params == 0) { + # simulate old behaviour + $params[0] = $class->div_scale(); # and round to it as accuracy + $params[1] = undef; # P = undef + $scale = $params[0]+4; # at least four more for proper round + $params[2] = $r[2]; # round mode by caller or undef + $fallback = 1; # to clear a/p afterwards + } else { + # the 4 below is empirical, and there might be cases where it's not enough... + $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined + } + + return $x->bone(@params) if $x->is_zero(); + + # See the comments in Math::BigFloat on how this algorithm works. + # Basically we calculate A and B (where B is faculty(N)) so that A/B = e + + my $x_org = $x->copy(); + if ($scale <= 75) { + # set $x directly from a cached string form + $x->{_n} = + $LIB->_new("90933395208605785401971970164779391644753259799242"); + $x->{_d} = + $LIB->_new("33452526613163807108170062053440751665152000000000"); + $x->{sign} = '+'; + } else { + # compute A and B so that e = A / B. + + # After some terms we end up with this, so we use it as a starting point: + my $A = $LIB->_new("90933395208605785401971970164779391644753259799242"); + my $F = $LIB->_new(42); my $step = 42; + + # Compute how many steps we need to take to get $A and $B sufficiently big + my $steps = Math::BigFloat::_len_to_steps($scale - 4); + # print STDERR "# Doing $steps steps for ", $scale-4, " digits\n"; + while ($step++ <= $steps) { + # calculate $a * $f + 1 + $A = $LIB->_mul($A, $F); + $A = $LIB->_inc($A); + # increment f + $F = $LIB->_inc($F); + } + # compute $B as factorial of $steps (this is faster than doing it manually) + my $B = $LIB->_fac($LIB->_new($steps)); + + # print "A ", $LIB->_str($A), "\nB ", $LIB->_str($B), "\n"; + + $x->{_n} = $A; + $x->{_d} = $B; + $x->{sign} = '+'; + } + + # $x contains now an estimate of e, with some surplus digits, so we can round + if (!$x_org->is_one()) { + # raise $x to the wanted power and round it in one step: + $x->bpow($x_org, @params); + } else { + # else just round the already computed result + delete $x->{_a}; delete $x->{_p}; + # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { + $x->bround($params[0], $params[2]); # then round accordingly + } else { + $x->bfround($params[1], $params[2]); # then round accordingly + } + } + if ($fallback) { + # clear a/p after round, since user did not request it + delete $x->{_a}; delete $x->{_p}; + } + + $x; +} + +sub bnok { + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + my $xint = Math::BigInt -> new($x -> bint() -> bsstr()); + my $yint = Math::BigInt -> new($y -> bint() -> bsstr()); + $xint -> bnok($yint); + + $x -> {sign} = $xint -> {sign}; + $x -> {_n} = $xint -> {_n}; + $x -> {_d} = $xint -> {_d}; + + return $x; +} + +sub broot { + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + # Convert $x into a Math::BigFloat. + + my $xd = Math::BigFloat -> new($LIB -> _str($x->{_d})); + my $xflt = Math::BigFloat -> new($LIB -> _str($x->{_n})) -> bdiv($xd); + $xflt -> {sign} = $x -> {sign}; + + # Convert $y into a Math::BigFloat. + + my $yd = Math::BigFloat -> new($LIB -> _str($y->{_d})); + my $yflt = Math::BigFloat -> new($LIB -> _str($y->{_n})) -> bdiv($yd); + $yflt -> {sign} = $y -> {sign}; + + # Compute the root and convert back to a Math::BigRat. + + $xflt -> broot($yflt, @r); + my $xtmp = Math::BigRat -> new($xflt -> bsstr()); + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x; +} + +sub bmodpow { + # set up parameters + my ($class, $x, $y, $m, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, $m, @r) = objectify(3, @_); + } + + # Convert $x, $y, and $m into Math::BigInt objects. + + my $xint = Math::BigInt -> new($x -> copy() -> bint()); + my $yint = Math::BigInt -> new($y -> copy() -> bint()); + my $mint = Math::BigInt -> new($m -> copy() -> bint()); + + $xint -> bmodpow($y, $m, @r); + my $xtmp = Math::BigRat -> new($xint -> bsstr()); + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + return $x; +} + +sub bmodinv { + # set up parameters + my ($class, $x, $y, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y, @r) = objectify(2, @_); + } + + # Convert $x and $y into Math::BigInt objects. + + my $xint = Math::BigInt -> new($x -> copy() -> bint()); + my $yint = Math::BigInt -> new($y -> copy() -> bint()); + + $xint -> bmodinv($y, @r); + my $xtmp = Math::BigRat -> new($xint -> bsstr()); + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + return $x; +} + +sub bsqrt { + my ($class, $x, @r) = ref($_[0]) ? (ref($_[0]), @_) : objectify(1, @_); + + return $x->bnan() if $x->{sign} !~ /^[+]/; # NaN, -inf or < 0 + return $x if $x->{sign} eq '+inf'; # sqrt(inf) == inf + return $x->round(@r) if $x->is_zero() || $x->is_one(); + + my $n = $x -> {_n}; + my $d = $x -> {_d}; + + # Look for an exact solution. For the numerator and the denominator, take + # the square root and square it and see if we got the original value. If we + # did, for both the numerator and the denominator, we have an exact + # solution. + + { + my $nsqrt = $LIB -> _sqrt($LIB -> _copy($n)); + my $n2 = $LIB -> _mul($LIB -> _copy($nsqrt), $nsqrt); + if ($LIB -> _acmp($n, $n2) == 0) { + my $dsqrt = $LIB -> _sqrt($LIB -> _copy($d)); + my $d2 = $LIB -> _mul($LIB -> _copy($dsqrt), $dsqrt); + if ($LIB -> _acmp($d, $d2) == 0) { + $x -> {_n} = $nsqrt; + $x -> {_d} = $dsqrt; + return $x->round(@r); + } + } + } + + local $Math::BigFloat::upgrade = undef; + local $Math::BigFloat::downgrade = undef; + local $Math::BigFloat::precision = undef; + local $Math::BigFloat::accuracy = undef; + local $Math::BigInt::upgrade = undef; + local $Math::BigInt::precision = undef; + local $Math::BigInt::accuracy = undef; + + my $xn = Math::BigFloat -> new($LIB -> _str($n)); + my $xd = Math::BigFloat -> new($LIB -> _str($d)); + + my $xtmp = Math::BigRat -> new($xn -> bdiv($xd) -> bsqrt() -> bsstr()); + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + $x->round(@r); +} + +sub blsft { + my ($class, $x, $y, $b, @r) = objectify(2, @_); + + $b = 2 if !defined $b; + $b = $class -> new($b) unless ref($b) && $b -> isa($class); + + return $x -> bnan() if $x -> is_nan() || $y -> is_nan() || $b -> is_nan(); + + # shift by a negative amount? + return $x -> brsft($y -> copy() -> babs(), $b) if $y -> {sign} =~ /^-/; + + $x -> bmul($b -> bpow($y)); +} + +sub brsft { + my ($class, $x, $y, $b, @r) = objectify(2, @_); + + $b = 2 if !defined $b; + $b = $class -> new($b) unless ref($b) && $b -> isa($class); + + return $x -> bnan() if $x -> is_nan() || $y -> is_nan() || $b -> is_nan(); + + # shift by a negative amount? + return $x -> blsft($y -> copy() -> babs(), $b) if $y -> {sign} =~ /^-/; + + # the following call to bdiv() will return either quotient (scalar context) + # or quotient and remainder (list context). + $x -> bdiv($b -> bpow($y)); +} + +sub band { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'band() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for band()' if @_ < 1; + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> band($y); + $xtmp = $class -> new($xtmp); # back to Math::BigRat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x -> round(@r); +} + +sub bior { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bior() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for bior()' if @_ < 1; + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bior($y); + $xtmp = $class -> new($xtmp); # back to Math::BigRat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x -> round(@r); +} + +sub bxor { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bxor() is an instance method, not a class method' unless $xref; + croak 'Not enough arguments for bxor()' if @_ < 1; + + my $y = shift; + $y = $class -> new($y) unless ref($y); + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bxor($y); + $xtmp = $class -> new($xtmp); # back to Math::BigRat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x -> round(@r); +} + +sub bnot { + my $x = shift; + my $xref = ref($x); + my $class = $xref || $x; + + croak 'bnot() is an instance method, not a class method' unless $xref; + + my @r = @_; + + my $xtmp = Math::BigInt -> new($x -> bint()); # to Math::BigInt + $xtmp -> bnot(); + $xtmp = $class -> new($xtmp); # back to Math::BigRat + + $x -> {sign} = $xtmp -> {sign}; + $x -> {_n} = $xtmp -> {_n}; + $x -> {_d} = $xtmp -> {_d}; + + return $x -> round(@r); +} + +############################################################################## +# round + +sub round { + $_[0]; +} + +sub bround { + $_[0]; +} + +sub bfround { + $_[0]; +} + +############################################################################## +# comparing + +sub bcmp { + # compare two signed numbers + + # set up parameters + my ($class, $x, $y) = (ref($_[0]), @_); + + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y) = objectify(2, @_); + } + + if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/) { + # $x is NaN and/or $y is NaN + return undef if $x->{sign} eq $nan || $y->{sign} eq $nan; + # $x and $y are both either +inf or -inf + return 0 if $x->{sign} eq $y->{sign} && $x->{sign} =~ /^[+-]inf$/; + # $x = +inf and $y < +inf + return +1 if $x->{sign} eq '+inf'; + # $x = -inf and $y > -inf + return -1 if $x->{sign} eq '-inf'; + # $x < +inf and $y = +inf + return -1 if $y->{sign} eq '+inf'; + # $x > -inf and $y = -inf + return +1; + } + + # $x >= 0 and $y < 0 + return 1 if $x->{sign} eq '+' && $y->{sign} eq '-'; + # $x < 0 and $y >= 0 + return -1 if $x->{sign} eq '-' && $y->{sign} eq '+'; + + # At this point, we know that $x and $y have the same sign. + + # shortcut + my $xz = $LIB->_is_zero($x->{_n}); + my $yz = $LIB->_is_zero($y->{_n}); + return 0 if $xz && $yz; # 0 <=> 0 + return -1 if $xz && $y->{sign} eq '+'; # 0 <=> +y + return 1 if $yz && $x->{sign} eq '+'; # +x <=> 0 + + my $t = $LIB->_mul($LIB->_copy($x->{_n}), $y->{_d}); + my $u = $LIB->_mul($LIB->_copy($y->{_n}), $x->{_d}); + + my $cmp = $LIB->_acmp($t, $u); # signs are equal + $cmp = -$cmp if $x->{sign} eq '-'; # both are '-' => reverse + $cmp; +} + +sub bacmp { + # compare two numbers (as unsigned) + + # set up parameters + my ($class, $x, $y) = (ref($_[0]), @_); + # objectify is costly, so avoid it + if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { + ($class, $x, $y) = objectify(2, @_); + } + + if (($x->{sign} !~ /^[+-]$/) || ($y->{sign} !~ /^[+-]$/)) { + # handle +-inf and NaN + return undef if (($x->{sign} eq $nan) || ($y->{sign} eq $nan)); + return 0 if $x->{sign} =~ /^[+-]inf$/ && $y->{sign} =~ /^[+-]inf$/; + return 1 if $x->{sign} =~ /^[+-]inf$/ && $y->{sign} !~ /^[+-]inf$/; + return -1; + } + + my $t = $LIB->_mul($LIB->_copy($x->{_n}), $y->{_d}); + my $u = $LIB->_mul($LIB->_copy($y->{_n}), $x->{_d}); + $LIB->_acmp($t, $u); # ignore signs +} + +sub beq { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'beq() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for beq()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && ! $cmp; +} + +sub bne { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'bne() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for bne()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && ! $cmp ? '' : 1; +} + +sub blt { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'blt() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for blt()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp < 0; +} + +sub ble { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'ble() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for ble()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp <= 0; +} + +sub bgt { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'bgt() is an instance method, not a class method' unless $selfref; + croak 'Wrong number of arguments for bgt()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp > 0; +} + +sub bge { + my $self = shift; + my $selfref = ref $self; + my $class = $selfref || $self; + + croak 'bge() is an instance method, not a class method' + unless $selfref; + croak 'Wrong number of arguments for bge()' unless @_ == 1; + + my $cmp = $self -> bcmp(shift); + return defined($cmp) && $cmp >= 0; +} + +############################################################################## +# output conversion + +sub numify { + # convert 17/8 => float (aka 2.125) + my ($self, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + # Non-finite number. + + return $x->bstr() if $x->{sign} !~ /^[+-]$/; + + # Finite number. + + my $abs = $LIB->_is_one($x->{_d}) + ? $LIB->_num($x->{_n}) + : Math::BigFloat -> new($LIB->_str($x->{_n})) + -> bdiv($LIB->_str($x->{_d})) + -> bstr(); + return $x->{sign} eq '-' ? 0 - $abs : 0 + $abs; +} + +sub as_int { + my ($self, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + # NaN, inf etc + return Math::BigInt->new($x->{sign}) if $x->{sign} !~ /^[+-]$/; + + my $u = Math::BigInt->bzero(); + $u->{value} = $LIB->_div($LIB->_copy($x->{_n}), $x->{_d}); # 22/7 => 3 + $u->bneg if $x->{sign} eq '-'; # no negative zero + $u; +} + +sub as_float { + # return N/D as Math::BigFloat + + # set up parameters + my ($class, $x, @r) = (ref($_[0]), @_); + # objectify is costly, so avoid it + ($class, $x, @r) = objectify(1, @_) unless ref $_[0]; + + # NaN, inf etc + return Math::BigFloat->new($x->{sign}) if $x->{sign} !~ /^[+-]$/; + + my $xd = Math::BigFloat -> new($LIB -> _str($x->{_d})); + my $xflt = Math::BigFloat -> new($LIB -> _str($x->{_n})); + $xflt -> {sign} = $x -> {sign}; + $xflt -> bdiv($xd, @r); + + return $xflt; +} + +sub as_bin { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x unless $x->is_int(); + + my $s = $x->{sign}; + $s = '' if $s eq '+'; + $s . $LIB->_as_bin($x->{_n}); +} + +sub as_hex { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x unless $x->is_int(); + + my $s = $x->{sign}; $s = '' if $s eq '+'; + $s . $LIB->_as_hex($x->{_n}); +} + +sub as_oct { + my ($class, $x) = ref($_[0]) ? (undef, $_[0]) : objectify(1, @_); + + return $x unless $x->is_int(); + + my $s = $x->{sign}; $s = '' if $s eq '+'; + $s . $LIB->_as_oct($x->{_n}); +} + +############################################################################## + +sub from_hex { + my $class = shift; + + $class->new(@_); +} + +sub from_bin { + my $class = shift; + + $class->new(@_); +} + +sub from_oct { + my $class = shift; + + my @parts; + for my $c (@_) { + push @parts, Math::BigInt->from_oct($c); + } + $class->new (@parts); +} + +############################################################################## +# import + +sub import { + my $class = shift; + my $l = scalar @_; + my $lib = ''; my @a; + my $try = 'try'; + + for (my $i = 0; $i < $l ; $i++) { + if ($_[$i] eq ':constant') { + # this rest causes overlord er load to step in + overload::constant float => sub { $class->new(shift); }; + } + # elsif ($_[$i] eq 'upgrade') + # { + # # this causes upgrading + # $upgrade = $_[$i+1]; # or undef to disable + # $i++; + # } + elsif ($_[$i] eq 'downgrade') { + # this causes downgrading + $downgrade = $_[$i+1]; # or undef to disable + $i++; + } elsif ($_[$i] =~ /^(lib|try|only)\z/) { + $lib = $_[$i+1] || ''; # default Calc + $try = $1; # lib, try or only + $i++; + } elsif ($_[$i] eq 'with') { + # this argument is no longer used + #$LIB = $_[$i+1] || 'Math::BigInt::Calc'; # default Math::BigInt::Calc + $i++; + } else { + push @a, $_[$i]; + } + } + require Math::BigInt; + + # let use Math::BigInt lib => 'GMP'; use Math::BigRat; still have GMP + if ($lib ne '') { + my @c = split /\s*,\s*/, $lib; + foreach (@c) { + $_ =~ tr/a-zA-Z0-9://cd; # limit to sane characters + } + $lib = join(",", @c); + } + my @import = ('objectify'); + push @import, $try => $lib if $lib ne ''; + + # LIB already loaded, so feed it our lib arguments + Math::BigInt->import(@import); + + $LIB = Math::BigFloat->config("lib"); + + # register us with LIB to get notified of future lib changes + Math::BigInt::_register_callback($class, sub { $LIB = $_[0]; }); + + # any non :constant stuff is handled by Exporter (loaded by parent class) + # even if @_ is empty, to give it a chance + $class->SUPER::import(@a); # for subclasses + $class->export_to_level(1, $class, @a); # need this, too +} + +1; + +__END__ + +=pod + +=head1 NAME + +Math::BigRat - Arbitrary big rational numbers + +=head1 SYNOPSIS + + use Math::BigRat; + + my $x = Math::BigRat->new('3/7'); $x += '5/9'; + + print $x->bstr(), "\n"; + print $x ** 2, "\n"; + + my $y = Math::BigRat->new('inf'); + print "$y ", ($y->is_inf ? 'is' : 'is not'), " infinity\n"; + + my $z = Math::BigRat->new(144); $z->bsqrt(); + +=head1 DESCRIPTION + +Math::BigRat complements Math::BigInt and Math::BigFloat by providing support +for arbitrary big rational numbers. + +=head2 MATH LIBRARY + +You can change the underlying module that does the low-level +math operations by using: + + use Math::BigRat try => 'GMP'; + +Note: This needs Math::BigInt::GMP installed. + +The following would first try to find Math::BigInt::Foo, then +Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc: + + use Math::BigRat try => 'Foo,Math::BigInt::Bar'; + +If you want to get warned when the fallback occurs, replace "try" with "lib": + + use Math::BigRat lib => 'Foo,Math::BigInt::Bar'; + +If you want the code to die instead, replace "try" with "only": + + use Math::BigRat only => 'Foo,Math::BigInt::Bar'; + +=head1 METHODS + +Any methods not listed here are derived from Math::BigFloat (or +Math::BigInt), so make sure you check these two modules for further +information. + +=over + +=item new() + + $x = Math::BigRat->new('1/3'); + +Create a new Math::BigRat object. Input can come in various forms: + + $x = Math::BigRat->new(123); # scalars + $x = Math::BigRat->new('inf'); # infinity + $x = Math::BigRat->new('123.3'); # float + $x = Math::BigRat->new('1/3'); # simple string + $x = Math::BigRat->new('1 / 3'); # spaced + $x = Math::BigRat->new('1 / 0.1'); # w/ floats + $x = Math::BigRat->new(Math::BigInt->new(3)); # BigInt + $x = Math::BigRat->new(Math::BigFloat->new('3.1')); # BigFloat + $x = Math::BigRat->new(Math::BigInt::Lite->new('2')); # BigLite + + # You can also give D and N as different objects: + $x = Math::BigRat->new( + Math::BigInt->new(-123), + Math::BigInt->new(7), + ); # => -123/7 + +=item numerator() + + $n = $x->numerator(); + +Returns a copy of the numerator (the part above the line) as signed BigInt. + +=item denominator() + + $d = $x->denominator(); + +Returns a copy of the denominator (the part under the line) as positive BigInt. + +=item parts() + + ($n, $d) = $x->parts(); + +Return a list consisting of (signed) numerator and (unsigned) denominator as +BigInts. + +=item numify() + + my $y = $x->numify(); + +Returns the object as a scalar. This will lose some data if the object +cannot be represented by a normal Perl scalar (integer or float), so +use L</as_int()> or L</as_float()> instead. + +This routine is automatically used whenever a scalar is required: + + my $x = Math::BigRat->new('3/1'); + @array = (0, 1, 2, 3); + $y = $array[$x]; # set $y to 3 + +=item as_int() + +=item as_number() + + $x = Math::BigRat->new('13/7'); + print $x->as_int(), "\n"; # '1' + +Returns a copy of the object as BigInt, truncated to an integer. + +C<as_number()> is an alias for C<as_int()>. + +=item as_float() + + $x = Math::BigRat->new('13/7'); + print $x->as_float(), "\n"; # '1' + + $x = Math::BigRat->new('2/3'); + print $x->as_float(5), "\n"; # '0.66667' + +Returns a copy of the object as BigFloat, preserving the +accuracy as wanted, or the default of 40 digits. + +This method was added in v0.22 of Math::BigRat (April 2008). + +=item as_hex() + + $x = Math::BigRat->new('13'); + print $x->as_hex(), "\n"; # '0xd' + +Returns the BigRat as hexadecimal string. Works only for integers. + +=item as_bin() + + $x = Math::BigRat->new('13'); + print $x->as_bin(), "\n"; # '0x1101' + +Returns the BigRat as binary string. Works only for integers. + +=item as_oct() + + $x = Math::BigRat->new('13'); + print $x->as_oct(), "\n"; # '015' + +Returns the BigRat as octal string. Works only for integers. + +=item from_hex() + + my $h = Math::BigRat->from_hex('0x10'); + +Create a BigRat from a hexadecimal number in string form. + +=item from_oct() + + my $o = Math::BigRat->from_oct('020'); + +Create a BigRat from an octal number in string form. + +=item from_bin() + + my $b = Math::BigRat->from_bin('0b10000000'); + +Create a BigRat from an binary number in string form. + +=item bnan() + + $x = Math::BigRat->bnan(); + +Creates a new BigRat object representing NaN (Not A Number). +If used on an object, it will set it to NaN: + + $x->bnan(); + +=item bzero() + + $x = Math::BigRat->bzero(); + +Creates a new BigRat object representing zero. +If used on an object, it will set it to zero: + + $x->bzero(); + +=item binf() + + $x = Math::BigRat->binf($sign); + +Creates a new BigRat object representing infinity. The optional argument is +either '-' or '+', indicating whether you want infinity or minus infinity. +If used on an object, it will set it to infinity: + + $x->binf(); + $x->binf('-'); + +=item bone() + + $x = Math::BigRat->bone($sign); + +Creates a new BigRat object representing one. The optional argument is +either '-' or '+', indicating whether you want one or minus one. +If used on an object, it will set it to one: + + $x->bone(); # +1 + $x->bone('-'); # -1 + +=item length() + + $len = $x->length(); + +Return the length of $x in digits for integer values. + +=item digit() + + print Math::BigRat->new('123/1')->digit(1); # 1 + print Math::BigRat->new('123/1')->digit(-1); # 3 + +Return the N'ths digit from X when X is an integer value. + +=item bnorm() + + $x->bnorm(); + +Reduce the number to the shortest form. This routine is called +automatically whenever it is needed. + +=item bfac() + + $x->bfac(); + +Calculates the factorial of $x. For instance: + + print Math::BigRat->new('3/1')->bfac(), "\n"; # 1*2*3 + print Math::BigRat->new('5/1')->bfac(), "\n"; # 1*2*3*4*5 + +Works currently only for integers. + +=item bround()/round()/bfround() + +Are not yet implemented. + +=item bmod() + + $x->bmod($y); + +Returns $x modulo $y. When $x is finite, and $y is finite and non-zero, the +result is identical to the remainder after floored division (F-division). If, +in addition, both $x and $y are integers, the result is identical to the result +from Perl's % operator. + +=item bmodinv() + + $x->bmodinv($mod); # modular multiplicative inverse + +Returns the multiplicative inverse of C<$x> modulo C<$mod>. If + + $y = $x -> copy() -> bmodinv($mod) + +then C<$y> is the number closest to zero, and with the same sign as C<$mod>, +satisfying + + ($x * $y) % $mod = 1 % $mod + +If C<$x> and C<$y> are non-zero, they must be relative primes, i.e., +C<bgcd($y, $mod)==1>. 'C<NaN>' is returned when no modular multiplicative +inverse exists. + +=item bmodpow() + + $num->bmodpow($exp,$mod); # modular exponentiation + # ($num**$exp % $mod) + +Returns the value of C<$num> taken to the power C<$exp> in the modulus +C<$mod> using binary exponentiation. C<bmodpow> is far superior to +writing + + $num ** $exp % $mod + +because it is much faster - it reduces internal variables into +the modulus whenever possible, so it operates on smaller numbers. + +C<bmodpow> also supports negative exponents. + + bmodpow($num, -1, $mod) + +is exactly equivalent to + + bmodinv($num, $mod) + +=item bneg() + + $x->bneg(); + +Used to negate the object in-place. + +=item is_one() + + print "$x is 1\n" if $x->is_one(); + +Return true if $x is exactly one, otherwise false. + +=item is_zero() + + print "$x is 0\n" if $x->is_zero(); + +Return true if $x is exactly zero, otherwise false. + +=item is_pos()/is_positive() + + print "$x is >= 0\n" if $x->is_positive(); + +Return true if $x is positive (greater than or equal to zero), otherwise +false. Please note that '+inf' is also positive, while 'NaN' and '-inf' aren't. + +C<is_positive()> is an alias for C<is_pos()>. + +=item is_neg()/is_negative() + + print "$x is < 0\n" if $x->is_negative(); + +Return true if $x is negative (smaller than zero), otherwise false. Please +note that '-inf' is also negative, while 'NaN' and '+inf' aren't. + +C<is_negative()> is an alias for C<is_neg()>. + +=item is_int() + + print "$x is an integer\n" if $x->is_int(); + +Return true if $x has a denominator of 1 (e.g. no fraction parts), otherwise +false. Please note that '-inf', 'inf' and 'NaN' aren't integer. + +=item is_odd() + + print "$x is odd\n" if $x->is_odd(); + +Return true if $x is odd, otherwise false. + +=item is_even() + + print "$x is even\n" if $x->is_even(); + +Return true if $x is even, otherwise false. + +=item bceil() + + $x->bceil(); + +Set $x to the next bigger integer value (e.g. truncate the number to integer +and then increment it by one). + +=item bfloor() + + $x->bfloor(); + +Truncate $x to an integer value. + +=item bint() + + $x->bint(); + +Round $x towards zero. + +=item bsqrt() + + $x->bsqrt(); + +Calculate the square root of $x. + +=item broot() + + $x->broot($n); + +Calculate the N'th root of $x. + +=item badd() + + $x->badd($y); + +Adds $y to $x and returns the result. + +=item bmul() + + $x->bmul($y); + +Multiplies $y to $x and returns the result. + +=item bsub() + + $x->bsub($y); + +Subtracts $y from $x and returns the result. + +=item bdiv() + + $q = $x->bdiv($y); + ($q, $r) = $x->bdiv($y); + +In scalar context, divides $x by $y and returns the result. In list context, +does floored division (F-division), returning an integer $q and a remainder $r +so that $x = $q * $y + $r. The remainer (modulo) is equal to what is returned +by C<$x->bmod($y)>. + +=item bdec() + + $x->bdec(); + +Decrements $x by 1 and returns the result. + +=item binc() + + $x->binc(); + +Increments $x by 1 and returns the result. + +=item copy() + + my $z = $x->copy(); + +Makes a deep copy of the object. + +Please see the documentation in L<Math::BigInt> for further details. + +=item bstr()/bsstr() + + my $x = Math::BigRat->new('8/4'); + print $x->bstr(), "\n"; # prints 1/2 + print $x->bsstr(), "\n"; # prints 1/2 + +Return a string representing this object. + +=item bcmp() + + $x->bcmp($y); + +Compares $x with $y and takes the sign into account. +Returns -1, 0, 1 or undef. + +=item bacmp() + + $x->bacmp($y); + +Compares $x with $y while ignoring their sign. Returns -1, 0, 1 or undef. + +=item beq() + + $x -> beq($y); + +Returns true if and only if $x is equal to $y, and false otherwise. + +=item bne() + + $x -> bne($y); + +Returns true if and only if $x is not equal to $y, and false otherwise. + +=item blt() + + $x -> blt($y); + +Returns true if and only if $x is equal to $y, and false otherwise. + +=item ble() + + $x -> ble($y); + +Returns true if and only if $x is less than or equal to $y, and false +otherwise. + +=item bgt() + + $x -> bgt($y); + +Returns true if and only if $x is greater than $y, and false otherwise. + +=item bge() + + $x -> bge($y); + +Returns true if and only if $x is greater than or equal to $y, and false +otherwise. + +=item blsft()/brsft() + +Used to shift numbers left/right. + +Please see the documentation in L<Math::BigInt> for further details. + +=item band() + + $x->band($y); # bitwise and + +=item bior() + + $x->bior($y); # bitwise inclusive or + +=item bxor() + + $x->bxor($y); # bitwise exclusive or + +=item bnot() + + $x->bnot(); # bitwise not (two's complement) + +=item bpow() + + $x->bpow($y); + +Compute $x ** $y. + +Please see the documentation in L<Math::BigInt> for further details. + +=item blog() + + $x->blog($base, $accuracy); # logarithm of x to the base $base + +If C<$base> is not defined, Euler's number (e) is used: + + print $x->blog(undef, 100); # log(x) to 100 digits + +=item bexp() + + $x->bexp($accuracy); # calculate e ** X + +Calculates two integers A and B so that A/B is equal to C<e ** $x>, where C<e> is +Euler's number. + +This method was added in v0.20 of Math::BigRat (May 2007). + +See also C<blog()>. + +=item bnok() + + $x->bnok($y); # x over y (binomial coefficient n over k) + +Calculates the binomial coefficient n over k, also called the "choose" +function. The result is equivalent to: + + ( n ) n! + | - | = ------- + ( k ) k!(n-k)! + +This method was added in v0.20 of Math::BigRat (May 2007). + +=item config() + + Math::BigRat->config("trap_nan" => 1); # set + $accu = Math::BigRat->config("accuracy"); # get + +Set or get configuration parameter values. Read-only parameters are marked as +RO. Read-write parameters are marked as RW. The following parameters are +supported. + + Parameter RO/RW Description + Example + ============================================================ + lib RO Name of the math backend library + Math::BigInt::Calc + lib_version RO Version of the math backend library + 0.30 + class RO The class of config you just called + Math::BigRat + version RO version number of the class you used + 0.10 + upgrade RW To which class numbers are upgraded + undef + downgrade RW To which class numbers are downgraded + undef + precision RW Global precision + undef + accuracy RW Global accuracy + undef + round_mode RW Global round mode + even + div_scale RW Fallback accuracy for div, sqrt etc. + 40 + trap_nan RW Trap NaNs + undef + trap_inf RW Trap +inf/-inf + undef + +=back + +=head1 BUGS + +Please report any bugs or feature requests to +C<bug-math-bigrat at rt.cpan.org>, or through the web interface at +L<https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigRat> +(requires login). +We will be notified, and then you'll automatically be notified of progress on +your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Math::BigRat + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigRat> + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/Math-BigRat> + +=item * CPAN Ratings + +L<http://cpanratings.perl.org/dist/Math-BigRat> + +=item * Search CPAN + +L<http://search.cpan.org/dist/Math-BigRat/> + +=item * CPAN Testers Matrix + +L<http://matrix.cpantesters.org/?dist=Math-BigRat> + +=item * The Bignum mailing list + +=over 4 + +=item * Post to mailing list + +C<bignum at lists.scsys.co.uk> + +=item * View mailing list + +L<http://lists.scsys.co.uk/pipermail/bignum/> + +=item * Subscribe/Unsubscribe + +L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> + +=back + +=back + +=head1 LICENSE + +This program is free software; you may redistribute it and/or modify it under +the same terms as Perl itself. + +=head1 SEE ALSO + +L<bigrat>, L<Math::BigFloat> and L<Math::BigInt> as well as the backends +L<Math::BigInt::FastCalc>, L<Math::BigInt::GMP>, and L<Math::BigInt::Pari>. + +=head1 AUTHORS + +=over 4 + +=item * + +Tels L<http://bloodgate.com/> 2001-2009. + +=item * + +Maintained by Peter John Acklam <pjacklam@online.no> 2011- + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Math/Complex.pm b/data/miniconda3/lib/perl5/core_perl/Math/Complex.pm new file mode 100644 index 0000000000000000000000000000000000000000..ea3e006fe5808919fe82074bc015dfce23642c55 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Math/Complex.pm @@ -0,0 +1,2132 @@ +# +# Complex numbers and associated mathematical functions +# -- Raphael Manfredi Since Sep 1996 +# -- Jarkko Hietaniemi Since Mar 1997 +# -- Daniel S. Lewart Since Sep 1997 +# + +package Math::Complex; + +{ use 5.006; } +use strict; + +our $VERSION = 1.59_01; + +use Config; + +our ($Inf, $ExpInf); +our ($vax_float, $has_inf, $has_nan); + +BEGIN { + $vax_float = (pack("d",1) =~ /^[\x80\x10]\x40/); + $has_inf = !$vax_float; + $has_nan = !$vax_float; + + unless ($has_inf) { + # For example in vax, there is no Inf, + # and just mentioning the DBL_MAX (1.70141183460469229e+38) + # causes SIGFPE. + + # These are pretty useless without a real infinity, + # but setting them makes for less warnings about their + # undefined values. + $Inf = "Inf"; + $ExpInf = "Inf"; + return; + } + + my %DBL_MAX = # These are IEEE 754 maxima. + ( + 4 => '1.70141183460469229e+38', + 8 => '1.7976931348623157e+308', + # AFAICT the 10, 12, and 16-byte long doubles + # all have the same maximum. + 10 => '1.1897314953572317650857593266280070162E+4932', + 12 => '1.1897314953572317650857593266280070162E+4932', + 16 => '1.1897314953572317650857593266280070162E+4932', + ); + + my $nvsize = $Config{nvsize} || + ($Config{uselongdouble} && $Config{longdblsize}) || + $Config{doublesize}; + die "Math::Complex: Could not figure out nvsize\n" + unless defined $nvsize; + die "Math::Complex: Cannot not figure out max nv (nvsize = $nvsize)\n" + unless defined $DBL_MAX{$nvsize}; + my $DBL_MAX = eval $DBL_MAX{$nvsize}; + die "Math::Complex: Could not figure out max nv (nvsize = $nvsize)\n" + unless defined $DBL_MAX; + my $BIGGER_THAN_THIS = 1e30; # Must find something bigger than this. + if ($^O eq 'unicosmk') { + $Inf = $DBL_MAX; + } else { + local $SIG{FPE} = sub { }; + local $!; + # We do want an arithmetic overflow, Inf INF inf Infinity. + for my $t ( + 'exp(99999)', # Enough even with 128-bit long doubles. + 'inf', + 'Inf', + 'INF', + 'infinity', + 'Infinity', + 'INFINITY', + '1e99999', + ) { + local $^W = 0; + my $i = eval "$t+1.0"; + if (defined $i && $i > $BIGGER_THAN_THIS) { + $Inf = $i; + last; + } + } + $Inf = $DBL_MAX unless defined $Inf; # Oh well, close enough. + die "Math::Complex: Could not get Infinity" + unless $Inf > $BIGGER_THAN_THIS; + $ExpInf = eval 'exp(99999)'; + } + # print "# On this machine, Inf = '$Inf'\n"; +} + +use Scalar::Util qw(set_prototype); + +use warnings; +no warnings 'syntax'; # To avoid the (_) warnings. + +BEGIN { + # For certain functions that we override, in 5.10 or better + # we can set a smarter prototype that will handle the lexical $_ + # (also a 5.10+ feature). + if ($] >= 5.010000) { + set_prototype \&abs, '_'; + set_prototype \&cos, '_'; + set_prototype \&exp, '_'; + set_prototype \&log, '_'; + set_prototype \&sin, '_'; + set_prototype \&sqrt, '_'; + } +} + +my $i; +my %LOGN; + +# Regular expression for floating point numbers. +# These days we could use Scalar::Util::lln(), I guess. +my $gre = qr'\s*([\+\-]?(?:(?:(?:\d+(?:_\d+)*(?:\.\d*(?:_\d+)*)?|\.\d+(?:_\d+)*)(?:[eE][\+\-]?\d+(?:_\d+)*)?))|inf)'i; + +require Exporter; + +our @ISA = qw(Exporter); + +my @trig = qw( + pi + tan + csc cosec sec cot cotan + asin acos atan + acsc acosec asec acot acotan + sinh cosh tanh + csch cosech sech coth cotanh + asinh acosh atanh + acsch acosech asech acoth acotanh + ); + +our @EXPORT = (qw( + i Re Im rho theta arg + sqrt log ln + log10 logn cbrt root + cplx cplxe + atan2 + ), + @trig); + +my @pi = qw(pi pi2 pi4 pip2 pip4 Inf); + +our @EXPORT_OK = @pi; + +our %EXPORT_TAGS = ( + 'trig' => [@trig], + 'pi' => [@pi], +); + +use overload + '=' => \&_copy, + '+=' => \&_plus, + '+' => \&_plus, + '-=' => \&_minus, + '-' => \&_minus, + '*=' => \&_multiply, + '*' => \&_multiply, + '/=' => \&_divide, + '/' => \&_divide, + '**=' => \&_power, + '**' => \&_power, + '==' => \&_numeq, + '<=>' => \&_spaceship, + 'neg' => \&_negate, + '~' => \&_conjugate, + 'abs' => \&abs, + 'sqrt' => \&sqrt, + 'exp' => \&exp, + 'log' => \&log, + 'sin' => \&sin, + 'cos' => \&cos, + 'atan2' => \&atan2, + '""' => \&_stringify; + +# +# Package "privates" +# + +my %DISPLAY_FORMAT = ('style' => 'cartesian', + 'polar_pretty_print' => 1); +my $eps = 1e-14; # Epsilon + +# +# Object attributes (internal): +# cartesian [real, imaginary] -- cartesian form +# polar [rho, theta] -- polar form +# c_dirty cartesian form not up-to-date +# p_dirty polar form not up-to-date +# display display format (package's global when not set) +# + +# Die on bad *make() arguments. + +sub _cannot_make { + die "@{[(caller(1))[3]]}: Cannot take $_[0] of '$_[1]'.\n"; +} + +sub _make { + my $arg = shift; + my ($p, $q); + + if ($arg =~ /^$gre$/) { + ($p, $q) = ($1, 0); + } elsif ($arg =~ /^(?:$gre)?$gre\s*i\s*$/) { + ($p, $q) = ($1 || 0, $2); + } elsif ($arg =~ /^\s*\(\s*$gre\s*(?:,\s*$gre\s*)?\)\s*$/) { + ($p, $q) = ($1, $2 || 0); + } + + if (defined $p) { + $p =~ s/^\+//; + $p =~ s/^(-?)inf$/"${1}9**9**9"/e if $has_inf; + $q =~ s/^\+//; + $q =~ s/^(-?)inf$/"${1}9**9**9"/e if $has_inf; + } + + return ($p, $q); +} + +sub _emake { + my $arg = shift; + my ($p, $q); + + if ($arg =~ /^\s*\[\s*$gre\s*(?:,\s*$gre\s*)?\]\s*$/) { + ($p, $q) = ($1, $2 || 0); + } elsif ($arg =~ m!^\s*\[\s*$gre\s*(?:,\s*([-+]?\d*\s*)?pi(?:/\s*(\d+))?\s*)?\]\s*$!) { + ($p, $q) = ($1, ($2 eq '-' ? -1 : ($2 || 1)) * pi() / ($3 || 1)); + } elsif ($arg =~ /^\s*\[\s*$gre\s*\]\s*$/) { + ($p, $q) = ($1, 0); + } elsif ($arg =~ /^\s*$gre\s*$/) { + ($p, $q) = ($1, 0); + } + + if (defined $p) { + $p =~ s/^\+//; + $q =~ s/^\+//; + $p =~ s/^(-?)inf$/"${1}9**9**9"/e if $has_inf; + $q =~ s/^(-?)inf$/"${1}9**9**9"/e if $has_inf; + } + + return ($p, $q); +} + +sub _copy { + my $self = shift; + my $clone = {%$self}; + if ($self->{'cartesian'}) { + $clone->{'cartesian'} = [@{$self->{'cartesian'}}]; + } + if ($self->{'polar'}) { + $clone->{'polar'} = [@{$self->{'polar'}}]; + } + bless $clone,__PACKAGE__; + return $clone; +} + +# +# ->make +# +# Create a new complex number (cartesian form) +# +sub make { + my $self = bless {}, shift; + my ($re, $im); + if (@_ == 0) { + ($re, $im) = (0, 0); + } elsif (@_ == 1) { + return (ref $self)->emake($_[0]) + if ($_[0] =~ /^\s*\[/); + ($re, $im) = _make($_[0]); + } elsif (@_ == 2) { + ($re, $im) = @_; + } + if (defined $re) { + _cannot_make("real part", $re) unless $re =~ /^$gre$/; + } + $im ||= 0; + _cannot_make("imaginary part", $im) unless $im =~ /^$gre$/; + $self->_set_cartesian([$re, $im ]); + $self->display_format('cartesian'); + + return $self; +} + +# +# ->emake +# +# Create a new complex number (exponential form) +# +sub emake { + my $self = bless {}, shift; + my ($rho, $theta); + if (@_ == 0) { + ($rho, $theta) = (0, 0); + } elsif (@_ == 1) { + return (ref $self)->make($_[0]) + if ($_[0] =~ /^\s*\(/ || $_[0] =~ /i\s*$/); + ($rho, $theta) = _emake($_[0]); + } elsif (@_ == 2) { + ($rho, $theta) = @_; + } + if (defined $rho && defined $theta) { + if ($rho < 0) { + $rho = -$rho; + $theta = ($theta <= 0) ? $theta + pi() : $theta - pi(); + } + } + if (defined $rho) { + _cannot_make("rho", $rho) unless $rho =~ /^$gre$/; + } + $theta ||= 0; + _cannot_make("theta", $theta) unless $theta =~ /^$gre$/; + $self->_set_polar([$rho, $theta]); + $self->display_format('polar'); + + return $self; +} + +sub new { &make } # For backward compatibility only. + +# +# cplx +# +# Creates a complex number from a (re, im) tuple. +# This avoids the burden of writing Math::Complex->make(re, im). +# +sub cplx { + return __PACKAGE__->make(@_); +} + +# +# cplxe +# +# Creates a complex number from a (rho, theta) tuple. +# This avoids the burden of writing Math::Complex->emake(rho, theta). +# +sub cplxe { + return __PACKAGE__->emake(@_); +} + +# +# pi +# +# The number defined as pi = 180 degrees +# +sub pi () { 4 * CORE::atan2(1, 1) } + +# +# pi2 +# +# The full circle +# +sub pi2 () { 2 * pi } + +# +# pi4 +# +# The full circle twice. +# +sub pi4 () { 4 * pi } + +# +# pip2 +# +# The quarter circle +# +sub pip2 () { pi / 2 } + +# +# pip4 +# +# The eighth circle. +# +sub pip4 () { pi / 4 } + +# +# _uplog10 +# +# Used in log10(). +# +sub _uplog10 () { 1 / CORE::log(10) } + +# +# i +# +# The number defined as i*i = -1; +# +sub i () { + return $i if ($i); + $i = bless {}; + $i->{'cartesian'} = [0, 1]; + $i->{'polar'} = [1, pip2]; + $i->{c_dirty} = 0; + $i->{p_dirty} = 0; + return $i; +} + +# +# _ip2 +# +# Half of i. +# +sub _ip2 () { i / 2 } + +# +# Attribute access/set routines +# + +sub _cartesian {$_[0]->{c_dirty} ? + $_[0]->_update_cartesian : $_[0]->{'cartesian'}} +sub _polar {$_[0]->{p_dirty} ? + $_[0]->_update_polar : $_[0]->{'polar'}} + +sub _set_cartesian { $_[0]->{p_dirty}++; $_[0]->{c_dirty} = 0; + $_[0]->{'cartesian'} = $_[1] } +sub _set_polar { $_[0]->{c_dirty}++; $_[0]->{p_dirty} = 0; + $_[0]->{'polar'} = $_[1] } + +# +# ->_update_cartesian +# +# Recompute and return the cartesian form, given accurate polar form. +# +sub _update_cartesian { + my $self = shift; + my ($r, $t) = @{$self->{'polar'}}; + $self->{c_dirty} = 0; + return $self->{'cartesian'} = [$r * CORE::cos($t), $r * CORE::sin($t)]; +} + +# +# +# ->_update_polar +# +# Recompute and return the polar form, given accurate cartesian form. +# +sub _update_polar { + my $self = shift; + my ($x, $y) = @{$self->{'cartesian'}}; + $self->{p_dirty} = 0; + return $self->{'polar'} = [0, 0] if $x == 0 && $y == 0; + return $self->{'polar'} = [CORE::sqrt($x*$x + $y*$y), + CORE::atan2($y, $x)]; +} + +# +# (_plus) +# +# Computes z1+z2. +# +sub _plus { + my ($z1, $z2, $regular) = @_; + my ($re1, $im1) = @{$z1->_cartesian}; + $z2 = cplx($z2) unless ref $z2; + my ($re2, $im2) = ref $z2 ? @{$z2->_cartesian} : ($z2, 0); + unless (defined $regular) { + $z1->_set_cartesian([$re1 + $re2, $im1 + $im2]); + return $z1; + } + return (ref $z1)->make($re1 + $re2, $im1 + $im2); +} + +# +# (_minus) +# +# Computes z1-z2. +# +sub _minus { + my ($z1, $z2, $inverted) = @_; + my ($re1, $im1) = @{$z1->_cartesian}; + $z2 = cplx($z2) unless ref $z2; + my ($re2, $im2) = @{$z2->_cartesian}; + unless (defined $inverted) { + $z1->_set_cartesian([$re1 - $re2, $im1 - $im2]); + return $z1; + } + return $inverted ? + (ref $z1)->make($re2 - $re1, $im2 - $im1) : + (ref $z1)->make($re1 - $re2, $im1 - $im2); + +} + +# +# (_multiply) +# +# Computes z1*z2. +# +sub _multiply { + my ($z1, $z2, $regular) = @_; + if ($z1->{p_dirty} == 0 and ref $z2 and $z2->{p_dirty} == 0) { + # if both polar better use polar to avoid rounding errors + my ($r1, $t1) = @{$z1->_polar}; + my ($r2, $t2) = @{$z2->_polar}; + my $t = $t1 + $t2; + if ($t > pi()) { $t -= pi2 } + elsif ($t <= -pi()) { $t += pi2 } + unless (defined $regular) { + $z1->_set_polar([$r1 * $r2, $t]); + return $z1; + } + return (ref $z1)->emake($r1 * $r2, $t); + } else { + my ($x1, $y1) = @{$z1->_cartesian}; + if (ref $z2) { + my ($x2, $y2) = @{$z2->_cartesian}; + return (ref $z1)->make($x1*$x2-$y1*$y2, $x1*$y2+$y1*$x2); + } else { + return (ref $z1)->make($x1*$z2, $y1*$z2); + } + } +} + +# +# _divbyzero +# +# Die on division by zero. +# +sub _divbyzero { + my $mess = "$_[0]: Division by zero.\n"; + + if (defined $_[1]) { + $mess .= "(Because in the definition of $_[0], the divisor "; + $mess .= "$_[1] " unless ("$_[1]" eq '0'); + $mess .= "is 0)\n"; + } + + my @up = caller(1); + + $mess .= "Died at $up[1] line $up[2].\n"; + + die $mess; +} + +# +# (_divide) +# +# Computes z1/z2. +# +sub _divide { + my ($z1, $z2, $inverted) = @_; + if ($z1->{p_dirty} == 0 and ref $z2 and $z2->{p_dirty} == 0) { + # if both polar better use polar to avoid rounding errors + my ($r1, $t1) = @{$z1->_polar}; + my ($r2, $t2) = @{$z2->_polar}; + my $t; + if ($inverted) { + _divbyzero "$z2/0" if ($r1 == 0); + $t = $t2 - $t1; + if ($t > pi()) { $t -= pi2 } + elsif ($t <= -pi()) { $t += pi2 } + return (ref $z1)->emake($r2 / $r1, $t); + } else { + _divbyzero "$z1/0" if ($r2 == 0); + $t = $t1 - $t2; + if ($t > pi()) { $t -= pi2 } + elsif ($t <= -pi()) { $t += pi2 } + return (ref $z1)->emake($r1 / $r2, $t); + } + } else { + my ($d, $x2, $y2); + if ($inverted) { + ($x2, $y2) = @{$z1->_cartesian}; + $d = $x2*$x2 + $y2*$y2; + _divbyzero "$z2/0" if $d == 0; + return (ref $z1)->make(($x2*$z2)/$d, -($y2*$z2)/$d); + } else { + my ($x1, $y1) = @{$z1->_cartesian}; + if (ref $z2) { + ($x2, $y2) = @{$z2->_cartesian}; + $d = $x2*$x2 + $y2*$y2; + _divbyzero "$z1/0" if $d == 0; + my $u = ($x1*$x2 + $y1*$y2)/$d; + my $v = ($y1*$x2 - $x1*$y2)/$d; + return (ref $z1)->make($u, $v); + } else { + _divbyzero "$z1/0" if $z2 == 0; + return (ref $z1)->make($x1/$z2, $y1/$z2); + } + } + } +} + +# +# (_power) +# +# Computes z1**z2 = exp(z2 * log z1)). +# +sub _power { + my ($z1, $z2, $inverted) = @_; + if ($inverted) { + return 1 if $z1 == 0 || $z2 == 1; + return 0 if $z2 == 0 && Re($z1) > 0; + } else { + return 1 if $z2 == 0 || $z1 == 1; + return 0 if $z1 == 0 && Re($z2) > 0; + } + my $w = $inverted ? &exp($z1 * &log($z2)) + : &exp($z2 * &log($z1)); + # If both arguments cartesian, return cartesian, else polar. + return $z1->{c_dirty} == 0 && + (not ref $z2 or $z2->{c_dirty} == 0) ? + cplx(@{$w->_cartesian}) : $w; +} + +# +# (_spaceship) +# +# Computes z1 <=> z2. +# Sorts on the real part first, then on the imaginary part. Thus 2-4i < 3+8i. +# +sub _spaceship { + my ($z1, $z2, $inverted) = @_; + my ($re1, $im1) = ref $z1 ? @{$z1->_cartesian} : ($z1, 0); + my ($re2, $im2) = ref $z2 ? @{$z2->_cartesian} : ($z2, 0); + my $sgn = $inverted ? -1 : 1; + return $sgn * ($re1 <=> $re2) if $re1 != $re2; + return $sgn * ($im1 <=> $im2); +} + +# +# (_numeq) +# +# Computes z1 == z2. +# +# (Required in addition to _spaceship() because of NaNs.) +sub _numeq { + my ($z1, $z2, $inverted) = @_; + my ($re1, $im1) = ref $z1 ? @{$z1->_cartesian} : ($z1, 0); + my ($re2, $im2) = ref $z2 ? @{$z2->_cartesian} : ($z2, 0); + return $re1 == $re2 && $im1 == $im2 ? 1 : 0; +} + +# +# (_negate) +# +# Computes -z. +# +sub _negate { + my ($z) = @_; + if ($z->{c_dirty}) { + my ($r, $t) = @{$z->_polar}; + $t = ($t <= 0) ? $t + pi : $t - pi; + return (ref $z)->emake($r, $t); + } + my ($re, $im) = @{$z->_cartesian}; + return (ref $z)->make(-$re, -$im); +} + +# +# (_conjugate) +# +# Compute complex's _conjugate. +# +sub _conjugate { + my ($z) = @_; + if ($z->{c_dirty}) { + my ($r, $t) = @{$z->_polar}; + return (ref $z)->emake($r, -$t); + } + my ($re, $im) = @{$z->_cartesian}; + return (ref $z)->make($re, -$im); +} + +# +# (abs) +# +# Compute or set complex's norm (rho). +# +sub abs { + my ($z, $rho) = @_ ? @_ : $_; + unless (ref $z) { + if (@_ == 2) { + $_[0] = $_[1]; + } else { + return CORE::abs($z); + } + } + if (defined $rho) { + $z->{'polar'} = [ $rho, ${$z->_polar}[1] ]; + $z->{p_dirty} = 0; + $z->{c_dirty} = 1; + return $rho; + } else { + return ${$z->_polar}[0]; + } +} + +sub _theta { + my $theta = $_[0]; + + if ($$theta > pi()) { $$theta -= pi2 } + elsif ($$theta <= -pi()) { $$theta += pi2 } +} + +# +# arg +# +# Compute or set complex's argument (theta). +# +sub arg { + my ($z, $theta) = @_; + return $z unless ref $z; + if (defined $theta) { + _theta(\$theta); + $z->{'polar'} = [ ${$z->_polar}[0], $theta ]; + $z->{p_dirty} = 0; + $z->{c_dirty} = 1; + } else { + $theta = ${$z->_polar}[1]; + _theta(\$theta); + } + return $theta; +} + +# +# (sqrt) +# +# Compute sqrt(z). +# +# It is quite tempting to use wantarray here so that in list context +# sqrt() would return the two solutions. This, however, would +# break things like +# +# print "sqrt(z) = ", sqrt($z), "\n"; +# +# The two values would be printed side by side without no intervening +# whitespace, quite confusing. +# Therefore if you want the two solutions use the root(). +# +sub sqrt { + my ($z) = @_ ? $_[0] : $_; + my ($re, $im) = ref $z ? @{$z->_cartesian} : ($z, 0); + return $re < 0 ? cplx(0, CORE::sqrt(-$re)) : CORE::sqrt($re) + if $im == 0; + my ($r, $t) = @{$z->_polar}; + return (ref $z)->emake(CORE::sqrt($r), $t/2); +} + +# +# cbrt +# +# Compute cbrt(z) (cubic root). +# +# Why are we not returning three values? The same answer as for sqrt(). +# +sub cbrt { + my ($z) = @_; + return $z < 0 ? + -CORE::exp(CORE::log(-$z)/3) : + ($z > 0 ? CORE::exp(CORE::log($z)/3): 0) + unless ref $z; + my ($r, $t) = @{$z->_polar}; + return 0 if $r == 0; + return (ref $z)->emake(CORE::exp(CORE::log($r)/3), $t/3); +} + +# +# _rootbad +# +# Die on bad root. +# +sub _rootbad { + my $mess = "Root '$_[0]' illegal, root rank must be positive integer.\n"; + + my @up = caller(1); + + $mess .= "Died at $up[1] line $up[2].\n"; + + die $mess; +} + +# +# root +# +# Computes all nth root for z, returning an array whose size is n. +# `n' must be a positive integer. +# +# The roots are given by (for k = 0..n-1): +# +# z^(1/n) = r^(1/n) (cos ((t+2 k pi)/n) + i sin ((t+2 k pi)/n)) +# +sub root { + my ($z, $n, $k) = @_; + _rootbad($n) if ($n < 1 or int($n) != $n); + my ($r, $t) = ref $z ? + @{$z->_polar} : (CORE::abs($z), $z >= 0 ? 0 : pi); + my $theta_inc = pi2 / $n; + my $rho = $r ** (1/$n); + my $cartesian = ref $z && $z->{c_dirty} == 0; + if (@_ == 2) { + my @root; + for (my $i = 0, my $theta = $t / $n; + $i < $n; + $i++, $theta += $theta_inc) { + my $w = cplxe($rho, $theta); + # Yes, $cartesian is loop invariant. + push @root, $cartesian ? cplx(@{$w->_cartesian}) : $w; + } + return @root; + } elsif (@_ == 3) { + my $w = cplxe($rho, $t / $n + $k * $theta_inc); + return $cartesian ? cplx(@{$w->_cartesian}) : $w; + } +} + +# +# Re +# +# Return or set Re(z). +# +sub Re { + my ($z, $Re) = @_; + return $z unless ref $z; + if (defined $Re) { + $z->{'cartesian'} = [ $Re, ${$z->_cartesian}[1] ]; + $z->{c_dirty} = 0; + $z->{p_dirty} = 1; + } else { + return ${$z->_cartesian}[0]; + } +} + +# +# Im +# +# Return or set Im(z). +# +sub Im { + my ($z, $Im) = @_; + return 0 unless ref $z; + if (defined $Im) { + $z->{'cartesian'} = [ ${$z->_cartesian}[0], $Im ]; + $z->{c_dirty} = 0; + $z->{p_dirty} = 1; + } else { + return ${$z->_cartesian}[1]; + } +} + +# +# rho +# +# Return or set rho(w). +# +sub rho { + Math::Complex::abs(@_); +} + +# +# theta +# +# Return or set theta(w). +# +sub theta { + Math::Complex::arg(@_); +} + +# +# (exp) +# +# Computes exp(z). +# +sub exp { + my ($z) = @_ ? @_ : $_; + return CORE::exp($z) unless ref $z; + my ($x, $y) = @{$z->_cartesian}; + return (ref $z)->emake(CORE::exp($x), $y); +} + +# +# _logofzero +# +# Die on logarithm of zero. +# +sub _logofzero { + my $mess = "$_[0]: Logarithm of zero.\n"; + + if (defined $_[1]) { + $mess .= "(Because in the definition of $_[0], the argument "; + $mess .= "$_[1] " unless ($_[1] eq '0'); + $mess .= "is 0)\n"; + } + + my @up = caller(1); + + $mess .= "Died at $up[1] line $up[2].\n"; + + die $mess; +} + +# +# (log) +# +# Compute log(z). +# +sub log { + my ($z) = @_ ? @_ : $_; + unless (ref $z) { + _logofzero("log") if $z == 0; + return $z > 0 ? CORE::log($z) : cplx(CORE::log(-$z), pi); + } + my ($r, $t) = @{$z->_polar}; + _logofzero("log") if $r == 0; + if ($t > pi()) { $t -= pi2 } + elsif ($t <= -pi()) { $t += pi2 } + return (ref $z)->make(CORE::log($r), $t); +} + +# +# ln +# +# Alias for log(). +# +sub ln { Math::Complex::log(@_) } + +# +# log10 +# +# Compute log10(z). +# + +sub log10 { + return Math::Complex::log($_[0]) * _uplog10; +} + +# +# logn +# +# Compute logn(z,n) = log(z) / log(n) +# +sub logn { + my ($z, $n) = @_; + $z = cplx($z, 0) unless ref $z; + my $logn = $LOGN{$n}; + $logn = $LOGN{$n} = CORE::log($n) unless defined $logn; # Cache log(n) + return &log($z) / $logn; +} + +# +# (cos) +# +# Compute cos(z) = (exp(iz) + exp(-iz))/2. +# +sub cos { + my ($z) = @_ ? @_ : $_; + return CORE::cos($z) unless ref $z; + my ($x, $y) = @{$z->_cartesian}; + my $ey = CORE::exp($y); + my $sx = CORE::sin($x); + my $cx = CORE::cos($x); + my $ey_1 = $ey ? 1 / $ey : Inf(); + return (ref $z)->make($cx * ($ey + $ey_1)/2, + $sx * ($ey_1 - $ey)/2); +} + +# +# (sin) +# +# Compute sin(z) = (exp(iz) - exp(-iz))/2. +# +sub sin { + my ($z) = @_ ? @_ : $_; + return CORE::sin($z) unless ref $z; + my ($x, $y) = @{$z->_cartesian}; + my $ey = CORE::exp($y); + my $sx = CORE::sin($x); + my $cx = CORE::cos($x); + my $ey_1 = $ey ? 1 / $ey : Inf(); + return (ref $z)->make($sx * ($ey + $ey_1)/2, + $cx * ($ey - $ey_1)/2); +} + +# +# tan +# +# Compute tan(z) = sin(z) / cos(z). +# +sub tan { + my ($z) = @_; + my $cz = &cos($z); + _divbyzero "tan($z)", "cos($z)" if $cz == 0; + return &sin($z) / $cz; +} + +# +# sec +# +# Computes the secant sec(z) = 1 / cos(z). +# +sub sec { + my ($z) = @_; + my $cz = &cos($z); + _divbyzero "sec($z)", "cos($z)" if ($cz == 0); + return 1 / $cz; +} + +# +# csc +# +# Computes the cosecant csc(z) = 1 / sin(z). +# +sub csc { + my ($z) = @_; + my $sz = &sin($z); + _divbyzero "csc($z)", "sin($z)" if ($sz == 0); + return 1 / $sz; +} + +# +# cosec +# +# Alias for csc(). +# +sub cosec { Math::Complex::csc(@_) } + +# +# cot +# +# Computes cot(z) = cos(z) / sin(z). +# +sub cot { + my ($z) = @_; + my $sz = &sin($z); + _divbyzero "cot($z)", "sin($z)" if ($sz == 0); + return &cos($z) / $sz; +} + +# +# cotan +# +# Alias for cot(). +# +sub cotan { Math::Complex::cot(@_) } + +# +# acos +# +# Computes the arc cosine acos(z) = -i log(z + sqrt(z*z-1)). +# +sub acos { + my $z = $_[0]; + return CORE::atan2(CORE::sqrt(1-$z*$z), $z) + if (! ref $z) && CORE::abs($z) <= 1; + $z = cplx($z, 0) unless ref $z; + my ($x, $y) = @{$z->_cartesian}; + return 0 if $x == 1 && $y == 0; + my $t1 = CORE::sqrt(($x+1)*($x+1) + $y*$y); + my $t2 = CORE::sqrt(($x-1)*($x-1) + $y*$y); + my $alpha = ($t1 + $t2)/2; + my $beta = ($t1 - $t2)/2; + $alpha = 1 if $alpha < 1; + if ($beta > 1) { $beta = 1 } + elsif ($beta < -1) { $beta = -1 } + my $u = CORE::atan2(CORE::sqrt(1-$beta*$beta), $beta); + my $v = CORE::log($alpha + CORE::sqrt($alpha*$alpha-1)); + $v = -$v if $y > 0 || ($y == 0 && $x < -1); + return (ref $z)->make($u, $v); +} + +# +# asin +# +# Computes the arc sine asin(z) = -i log(iz + sqrt(1-z*z)). +# +sub asin { + my $z = $_[0]; + return CORE::atan2($z, CORE::sqrt(1-$z*$z)) + if (! ref $z) && CORE::abs($z) <= 1; + $z = cplx($z, 0) unless ref $z; + my ($x, $y) = @{$z->_cartesian}; + return 0 if $x == 0 && $y == 0; + my $t1 = CORE::sqrt(($x+1)*($x+1) + $y*$y); + my $t2 = CORE::sqrt(($x-1)*($x-1) + $y*$y); + my $alpha = ($t1 + $t2)/2; + my $beta = ($t1 - $t2)/2; + $alpha = 1 if $alpha < 1; + if ($beta > 1) { $beta = 1 } + elsif ($beta < -1) { $beta = -1 } + my $u = CORE::atan2($beta, CORE::sqrt(1-$beta*$beta)); + my $v = -CORE::log($alpha + CORE::sqrt($alpha*$alpha-1)); + $v = -$v if $y > 0 || ($y == 0 && $x < -1); + return (ref $z)->make($u, $v); +} + +# +# atan +# +# Computes the arc tangent atan(z) = i/2 log((i+z) / (i-z)). +# +sub atan { + my ($z) = @_; + return CORE::atan2($z, 1) unless ref $z; + my ($x, $y) = ref $z ? @{$z->_cartesian} : ($z, 0); + return 0 if $x == 0 && $y == 0; + _divbyzero "atan(i)" if ( $z == i); + _logofzero "atan(-i)" if (-$z == i); # -i is a bad file test... + my $log = &log((i + $z) / (i - $z)); + return _ip2 * $log; +} + +# +# asec +# +# Computes the arc secant asec(z) = acos(1 / z). +# +sub asec { + my ($z) = @_; + _divbyzero "asec($z)", $z if ($z == 0); + return acos(1 / $z); +} + +# +# acsc +# +# Computes the arc cosecant acsc(z) = asin(1 / z). +# +sub acsc { + my ($z) = @_; + _divbyzero "acsc($z)", $z if ($z == 0); + return asin(1 / $z); +} + +# +# acosec +# +# Alias for acsc(). +# +sub acosec { Math::Complex::acsc(@_) } + +# +# acot +# +# Computes the arc cotangent acot(z) = atan(1 / z) +# +sub acot { + my ($z) = @_; + _divbyzero "acot(0)" if $z == 0; + return ($z >= 0) ? CORE::atan2(1, $z) : CORE::atan2(-1, -$z) + unless ref $z; + _divbyzero "acot(i)" if ($z - i == 0); + _logofzero "acot(-i)" if ($z + i == 0); + return atan(1 / $z); +} + +# +# acotan +# +# Alias for acot(). +# +sub acotan { Math::Complex::acot(@_) } + +# +# cosh +# +# Computes the hyperbolic cosine cosh(z) = (exp(z) + exp(-z))/2. +# +sub cosh { + my ($z) = @_; + my $ex; + unless (ref $z) { + $ex = CORE::exp($z); + return $ex ? ($ex == $ExpInf ? Inf() : ($ex + 1/$ex)/2) : Inf(); + } + my ($x, $y) = @{$z->_cartesian}; + $ex = CORE::exp($x); + my $ex_1 = $ex ? 1 / $ex : Inf(); + return (ref $z)->make(CORE::cos($y) * ($ex + $ex_1)/2, + CORE::sin($y) * ($ex - $ex_1)/2); +} + +# +# sinh +# +# Computes the hyperbolic sine sinh(z) = (exp(z) - exp(-z))/2. +# +sub sinh { + my ($z) = @_; + my $ex; + unless (ref $z) { + return 0 if $z == 0; + $ex = CORE::exp($z); + return $ex ? ($ex == $ExpInf ? Inf() : ($ex - 1/$ex)/2) : -Inf(); + } + my ($x, $y) = @{$z->_cartesian}; + my $cy = CORE::cos($y); + my $sy = CORE::sin($y); + $ex = CORE::exp($x); + my $ex_1 = $ex ? 1 / $ex : Inf(); + return (ref $z)->make(CORE::cos($y) * ($ex - $ex_1)/2, + CORE::sin($y) * ($ex + $ex_1)/2); +} + +# +# tanh +# +# Computes the hyperbolic tangent tanh(z) = sinh(z) / cosh(z). +# +sub tanh { + my ($z) = @_; + my $cz = cosh($z); + _divbyzero "tanh($z)", "cosh($z)" if ($cz == 0); + my $sz = sinh($z); + return 1 if $cz == $sz; + return -1 if $cz == -$sz; + return $sz / $cz; +} + +# +# sech +# +# Computes the hyperbolic secant sech(z) = 1 / cosh(z). +# +sub sech { + my ($z) = @_; + my $cz = cosh($z); + _divbyzero "sech($z)", "cosh($z)" if ($cz == 0); + return 1 / $cz; +} + +# +# csch +# +# Computes the hyperbolic cosecant csch(z) = 1 / sinh(z). +# +sub csch { + my ($z) = @_; + my $sz = sinh($z); + _divbyzero "csch($z)", "sinh($z)" if ($sz == 0); + return 1 / $sz; +} + +# +# cosech +# +# Alias for csch(). +# +sub cosech { Math::Complex::csch(@_) } + +# +# coth +# +# Computes the hyperbolic cotangent coth(z) = cosh(z) / sinh(z). +# +sub coth { + my ($z) = @_; + my $sz = sinh($z); + _divbyzero "coth($z)", "sinh($z)" if $sz == 0; + my $cz = cosh($z); + return 1 if $cz == $sz; + return -1 if $cz == -$sz; + return $cz / $sz; +} + +# +# cotanh +# +# Alias for coth(). +# +sub cotanh { Math::Complex::coth(@_) } + +# +# acosh +# +# Computes the area/inverse hyperbolic cosine acosh(z) = log(z + sqrt(z*z-1)). +# +sub acosh { + my ($z) = @_; + unless (ref $z) { + $z = cplx($z, 0); + } + my ($re, $im) = @{$z->_cartesian}; + if ($im == 0) { + return CORE::log($re + CORE::sqrt($re*$re - 1)) + if $re >= 1; + return cplx(0, CORE::atan2(CORE::sqrt(1 - $re*$re), $re)) + if CORE::abs($re) < 1; + } + my $t = &sqrt($z * $z - 1) + $z; + # Try Taylor if looking bad (this usually means that + # $z was large negative, therefore the sqrt is really + # close to abs(z), summing that with z...) + $t = 1/(2 * $z) - 1/(8 * $z**3) + 1/(16 * $z**5) - 5/(128 * $z**7) + if $t == 0; + my $u = &log($t); + $u->Im(-$u->Im) if $re < 0 && $im == 0; + return $re < 0 ? -$u : $u; +} + +# +# asinh +# +# Computes the area/inverse hyperbolic sine asinh(z) = log(z + sqrt(z*z+1)) +# +sub asinh { + my ($z) = @_; + unless (ref $z) { + my $t = $z + CORE::sqrt($z*$z + 1); + return CORE::log($t) if $t; + } + my $t = &sqrt($z * $z + 1) + $z; + # Try Taylor if looking bad (this usually means that + # $z was large negative, therefore the sqrt is really + # close to abs(z), summing that with z...) + $t = 1/(2 * $z) - 1/(8 * $z**3) + 1/(16 * $z**5) - 5/(128 * $z**7) + if $t == 0; + return &log($t); +} + +# +# atanh +# +# Computes the area/inverse hyperbolic tangent atanh(z) = 1/2 log((1+z) / (1-z)). +# +sub atanh { + my ($z) = @_; + unless (ref $z) { + return CORE::log((1 + $z)/(1 - $z))/2 if CORE::abs($z) < 1; + $z = cplx($z, 0); + } + _divbyzero 'atanh(1)', "1 - $z" if (1 - $z == 0); + _logofzero 'atanh(-1)' if (1 + $z == 0); + return 0.5 * &log((1 + $z) / (1 - $z)); +} + +# +# asech +# +# Computes the area/inverse hyperbolic secant asech(z) = acosh(1 / z). +# +sub asech { + my ($z) = @_; + _divbyzero 'asech(0)', "$z" if ($z == 0); + return acosh(1 / $z); +} + +# +# acsch +# +# Computes the area/inverse hyperbolic cosecant acsch(z) = asinh(1 / z). +# +sub acsch { + my ($z) = @_; + _divbyzero 'acsch(0)', $z if ($z == 0); + return asinh(1 / $z); +} + +# +# acosech +# +# Alias for acosh(). +# +sub acosech { Math::Complex::acsch(@_) } + +# +# acoth +# +# Computes the area/inverse hyperbolic cotangent acoth(z) = 1/2 log((1+z) / (z-1)). +# +sub acoth { + my ($z) = @_; + _divbyzero 'acoth(0)' if ($z == 0); + unless (ref $z) { + return CORE::log(($z + 1)/($z - 1))/2 if CORE::abs($z) > 1; + $z = cplx($z, 0); + } + _divbyzero 'acoth(1)', "$z - 1" if ($z - 1 == 0); + _logofzero 'acoth(-1)', "1 + $z" if (1 + $z == 0); + return &log((1 + $z) / ($z - 1)) / 2; +} + +# +# acotanh +# +# Alias for acot(). +# +sub acotanh { Math::Complex::acoth(@_) } + +# +# (atan2) +# +# Compute atan(z1/z2), minding the right quadrant. +# +sub atan2 { + my ($z1, $z2, $inverted) = @_; + my ($re1, $im1, $re2, $im2); + if ($inverted) { + ($re1, $im1) = ref $z2 ? @{$z2->_cartesian} : ($z2, 0); + ($re2, $im2) = ref $z1 ? @{$z1->_cartesian} : ($z1, 0); + } else { + ($re1, $im1) = ref $z1 ? @{$z1->_cartesian} : ($z1, 0); + ($re2, $im2) = ref $z2 ? @{$z2->_cartesian} : ($z2, 0); + } + if ($im1 || $im2) { + # In MATLAB the imaginary parts are ignored. + # warn "atan2: Imaginary parts ignored"; + # http://documents.wolfram.com/mathematica/functions/ArcTan + # NOTE: Mathematica ArcTan[x,y] while atan2(y,x) + my $s = $z1 * $z1 + $z2 * $z2; + _divbyzero("atan2") if $s == 0; + my $i = &i; + my $r = $z2 + $z1 * $i; + return -$i * &log($r / &sqrt( $s )); + } + return CORE::atan2($re1, $re2); +} + +# +# display_format +# ->display_format +# +# Set (get if no argument) the display format for all complex numbers that +# don't happen to have overridden it via ->display_format +# +# When called as an object method, this actually sets the display format for +# the current object. +# +# Valid object formats are 'c' and 'p' for cartesian and polar. The first +# letter is used actually, so the type can be fully spelled out for clarity. +# +sub display_format { + my $self = shift; + my %display_format = %DISPLAY_FORMAT; + + if (ref $self) { # Called as an object method + if (exists $self->{display_format}) { + my %obj = %{$self->{display_format}}; + @display_format{keys %obj} = values %obj; + } + } + if (@_ == 1) { + $display_format{style} = shift; + } else { + my %new = @_; + @display_format{keys %new} = values %new; + } + + if (ref $self) { # Called as an object method + $self->{display_format} = { %display_format }; + return + wantarray ? + %{$self->{display_format}} : + $self->{display_format}->{style}; + } + + # Called as a class method + %DISPLAY_FORMAT = %display_format; + return + wantarray ? + %DISPLAY_FORMAT : + $DISPLAY_FORMAT{style}; +} + +# +# (_stringify) +# +# Show nicely formatted complex number under its cartesian or polar form, +# depending on the current display format: +# +# . If a specific display format has been recorded for this object, use it. +# . Otherwise, use the generic current default for all complex numbers, +# which is a package global variable. +# +sub _stringify { + my ($z) = shift; + + my $style = $z->display_format; + + $style = $DISPLAY_FORMAT{style} unless defined $style; + + return $z->_stringify_polar if $style =~ /^p/i; + return $z->_stringify_cartesian; +} + +# +# ->_stringify_cartesian +# +# Stringify as a cartesian representation 'a+bi'. +# +sub _stringify_cartesian { + my $z = shift; + my ($x, $y) = @{$z->_cartesian}; + my ($re, $im); + + my %format = $z->display_format; + my $format = $format{format}; + + if ($x) { + if ($x =~ /^NaN[QS]?$/i) { + $re = $x; + } else { + if ($x =~ /^-?\Q$Inf\E$/oi) { + $re = $x; + } else { + $re = defined $format ? sprintf($format, $x) : $x; + } + } + } else { + undef $re; + } + + if ($y) { + if ($y =~ /^(NaN[QS]?)$/i) { + $im = $y; + } else { + if ($y =~ /^-?\Q$Inf\E$/oi) { + $im = $y; + } else { + $im = + defined $format ? + sprintf($format, $y) : + ($y == 1 ? "" : ($y == -1 ? "-" : $y)); + } + } + $im .= "i"; + } else { + undef $im; + } + + my $str = $re; + + if (defined $im) { + if ($y < 0) { + $str .= $im; + } elsif ($y > 0 || $im =~ /^NaN[QS]?i$/i) { + $str .= "+" if defined $re; + $str .= $im; + } + } elsif (!defined $re) { + $str = "0"; + } + + return $str; +} + + +# +# ->_stringify_polar +# +# Stringify as a polar representation '[r,t]'. +# +sub _stringify_polar { + my $z = shift; + my ($r, $t) = @{$z->_polar}; + my $theta; + + my %format = $z->display_format; + my $format = $format{format}; + + if ($t =~ /^NaN[QS]?$/i || $t =~ /^-?\Q$Inf\E$/oi) { + $theta = $t; + } elsif ($t == pi) { + $theta = "pi"; + } elsif ($r == 0 || $t == 0) { + $theta = defined $format ? sprintf($format, $t) : $t; + } + + return "[$r,$theta]" if defined $theta; + + # + # Try to identify pi/n and friends. + # + + $t -= int(CORE::abs($t) / pi2) * pi2; + + if ($format{polar_pretty_print} && $t) { + my ($a, $b); + for $a (2..9) { + $b = $t * $a / pi; + if ($b =~ /^-?\d+$/) { + $b = $b < 0 ? "-" : "" if CORE::abs($b) == 1; + $theta = "${b}pi/$a"; + last; + } + } + } + + if (defined $format) { + $r = sprintf($format, $r); + $theta = sprintf($format, $t) unless defined $theta; + } else { + $theta = $t unless defined $theta; + } + + return "[$r,$theta]"; +} + +sub Inf { + return $Inf; +} + +1; +__END__ + +=pod + +=head1 NAME + +Math::Complex - complex numbers and associated mathematical functions + +=head1 SYNOPSIS + + use Math::Complex; + + $z = Math::Complex->make(5, 6); + $t = 4 - 3*i + $z; + $j = cplxe(1, 2*pi/3); + +=head1 DESCRIPTION + +This package lets you create and manipulate complex numbers. By default, +I<Perl> limits itself to real numbers, but an extra C<use> statement brings +full complex support, along with a full set of mathematical functions +typically associated with and/or extended to complex numbers. + +If you wonder what complex numbers are, they were invented to be able to solve +the following equation: + + x*x = -1 + +and by definition, the solution is noted I<i> (engineers use I<j> instead since +I<i> usually denotes an intensity, but the name does not matter). The number +I<i> is a pure I<imaginary> number. + +The arithmetics with pure imaginary numbers works just like you would expect +it with real numbers... you just have to remember that + + i*i = -1 + +so you have: + + 5i + 7i = i * (5 + 7) = 12i + 4i - 3i = i * (4 - 3) = i + 4i * 2i = -8 + 6i / 2i = 3 + 1 / i = -i + +Complex numbers are numbers that have both a real part and an imaginary +part, and are usually noted: + + a + bi + +where C<a> is the I<real> part and C<b> is the I<imaginary> part. The +arithmetic with complex numbers is straightforward. You have to +keep track of the real and the imaginary parts, but otherwise the +rules used for real numbers just apply: + + (4 + 3i) + (5 - 2i) = (4 + 5) + i(3 - 2) = 9 + i + (2 + i) * (4 - i) = 2*4 + 4i -2i -i*i = 8 + 2i + 1 = 9 + 2i + +A graphical representation of complex numbers is possible in a plane +(also called the I<complex plane>, but it's really a 2D plane). +The number + + z = a + bi + +is the point whose coordinates are (a, b). Actually, it would +be the vector originating from (0, 0) to (a, b). It follows that the addition +of two complex numbers is a vectorial addition. + +Since there is a bijection between a point in the 2D plane and a complex +number (i.e. the mapping is unique and reciprocal), a complex number +can also be uniquely identified with polar coordinates: + + [rho, theta] + +where C<rho> is the distance to the origin, and C<theta> the angle between +the vector and the I<x> axis. There is a notation for this using the +exponential form, which is: + + rho * exp(i * theta) + +where I<i> is the famous imaginary number introduced above. Conversion +between this form and the cartesian form C<a + bi> is immediate: + + a = rho * cos(theta) + b = rho * sin(theta) + +which is also expressed by this formula: + + z = rho * exp(i * theta) = rho * (cos theta + i * sin theta) + +In other words, it's the projection of the vector onto the I<x> and I<y> +axes. Mathematicians call I<rho> the I<norm> or I<modulus> and I<theta> +the I<argument> of the complex number. The I<norm> of C<z> is +marked here as C<abs(z)>. + +The polar notation (also known as the trigonometric representation) is +much more handy for performing multiplications and divisions of +complex numbers, whilst the cartesian notation is better suited for +additions and subtractions. Real numbers are on the I<x> axis, and +therefore I<y> or I<theta> is zero or I<pi>. + +All the common operations that can be performed on a real number have +been defined to work on complex numbers as well, and are merely +I<extensions> of the operations defined on real numbers. This means +they keep their natural meaning when there is no imaginary part, provided +the number is within their definition set. + +For instance, the C<sqrt> routine which computes the square root of +its argument is only defined for non-negative real numbers and yields a +non-negative real number (it is an application from B<R+> to B<R+>). +If we allow it to return a complex number, then it can be extended to +negative real numbers to become an application from B<R> to B<C> (the +set of complex numbers): + + sqrt(x) = x >= 0 ? sqrt(x) : sqrt(-x)*i + +It can also be extended to be an application from B<C> to B<C>, +whilst its restriction to B<R> behaves as defined above by using +the following definition: + + sqrt(z = [r,t]) = sqrt(r) * exp(i * t/2) + +Indeed, a negative real number can be noted C<[x,pi]> (the modulus +I<x> is always non-negative, so C<[x,pi]> is really C<-x>, a negative +number) and the above definition states that + + sqrt([x,pi]) = sqrt(x) * exp(i*pi/2) = [sqrt(x),pi/2] = sqrt(x)*i + +which is exactly what we had defined for negative real numbers above. +The C<sqrt> returns only one of the solutions: if you want the both, +use the C<root> function. + +All the common mathematical functions defined on real numbers that +are extended to complex numbers share that same property of working +I<as usual> when the imaginary part is zero (otherwise, it would not +be called an extension, would it?). + +A I<new> operation possible on a complex number that is +the identity for real numbers is called the I<conjugate>, and is noted +with a horizontal bar above the number, or C<~z> here. + + z = a + bi + ~z = a - bi + +Simple... Now look: + + z * ~z = (a + bi) * (a - bi) = a*a + b*b + +We saw that the norm of C<z> was noted C<abs(z)> and was defined as the +distance to the origin, also known as: + + rho = abs(z) = sqrt(a*a + b*b) + +so + + z * ~z = abs(z) ** 2 + +If z is a pure real number (i.e. C<b == 0>), then the above yields: + + a * a = abs(a) ** 2 + +which is true (C<abs> has the regular meaning for real number, i.e. stands +for the absolute value). This example explains why the norm of C<z> is +noted C<abs(z)>: it extends the C<abs> function to complex numbers, yet +is the regular C<abs> we know when the complex number actually has no +imaginary part... This justifies I<a posteriori> our use of the C<abs> +notation for the norm. + +=head1 OPERATIONS + +Given the following notations: + + z1 = a + bi = r1 * exp(i * t1) + z2 = c + di = r2 * exp(i * t2) + z = <any complex or real number> + +the following (overloaded) operations are supported on complex numbers: + + z1 + z2 = (a + c) + i(b + d) + z1 - z2 = (a - c) + i(b - d) + z1 * z2 = (r1 * r2) * exp(i * (t1 + t2)) + z1 / z2 = (r1 / r2) * exp(i * (t1 - t2)) + z1 ** z2 = exp(z2 * log z1) + ~z = a - bi + abs(z) = r1 = sqrt(a*a + b*b) + sqrt(z) = sqrt(r1) * exp(i * t/2) + exp(z) = exp(a) * exp(i * b) + log(z) = log(r1) + i*t + sin(z) = 1/2i (exp(i * z1) - exp(-i * z)) + cos(z) = 1/2 (exp(i * z1) + exp(-i * z)) + atan2(y, x) = atan(y / x) # Minding the right quadrant, note the order. + +The definition used for complex arguments of atan2() is + + -i log((x + iy)/sqrt(x*x+y*y)) + +Note that atan2(0, 0) is not well-defined. + +The following extra operations are supported on both real and complex +numbers: + + Re(z) = a + Im(z) = b + arg(z) = t + abs(z) = r + + cbrt(z) = z ** (1/3) + log10(z) = log(z) / log(10) + logn(z, n) = log(z) / log(n) + + tan(z) = sin(z) / cos(z) + + csc(z) = 1 / sin(z) + sec(z) = 1 / cos(z) + cot(z) = 1 / tan(z) + + asin(z) = -i * log(i*z + sqrt(1-z*z)) + acos(z) = -i * log(z + i*sqrt(1-z*z)) + atan(z) = i/2 * log((i+z) / (i-z)) + + acsc(z) = asin(1 / z) + asec(z) = acos(1 / z) + acot(z) = atan(1 / z) = -i/2 * log((i+z) / (z-i)) + + sinh(z) = 1/2 (exp(z) - exp(-z)) + cosh(z) = 1/2 (exp(z) + exp(-z)) + tanh(z) = sinh(z) / cosh(z) = (exp(z) - exp(-z)) / (exp(z) + exp(-z)) + + csch(z) = 1 / sinh(z) + sech(z) = 1 / cosh(z) + coth(z) = 1 / tanh(z) + + asinh(z) = log(z + sqrt(z*z+1)) + acosh(z) = log(z + sqrt(z*z-1)) + atanh(z) = 1/2 * log((1+z) / (1-z)) + + acsch(z) = asinh(1 / z) + asech(z) = acosh(1 / z) + acoth(z) = atanh(1 / z) = 1/2 * log((1+z) / (z-1)) + +I<arg>, I<abs>, I<log>, I<csc>, I<cot>, I<acsc>, I<acot>, I<csch>, +I<coth>, I<acosech>, I<acotanh>, have aliases I<rho>, I<theta>, I<ln>, +I<cosec>, I<cotan>, I<acosec>, I<acotan>, I<cosech>, I<cotanh>, +I<acosech>, I<acotanh>, respectively. C<Re>, C<Im>, C<arg>, C<abs>, +C<rho>, and C<theta> can be used also as mutators. The C<cbrt> +returns only one of the solutions: if you want all three, use the +C<root> function. + +The I<root> function is available to compute all the I<n> +roots of some complex, where I<n> is a strictly positive integer. +There are exactly I<n> such roots, returned as a list. Getting the +number mathematicians call C<j> such that: + + 1 + j + j*j = 0; + +is a simple matter of writing: + + $j = ((root(1, 3))[1]; + +The I<k>th root for C<z = [r,t]> is given by: + + (root(z, n))[k] = r**(1/n) * exp(i * (t + 2*k*pi)/n) + +You can return the I<k>th root directly by C<root(z, n, k)>, +indexing starting from I<zero> and ending at I<n - 1>. + +The I<spaceship> numeric comparison operator, E<lt>=E<gt>, is also +defined. In order to ensure its restriction to real numbers is conform +to what you would expect, the comparison is run on the real part of +the complex number first, and imaginary parts are compared only when +the real parts match. + +=head1 CREATION + +To create a complex number, use either: + + $z = Math::Complex->make(3, 4); + $z = cplx(3, 4); + +if you know the cartesian form of the number, or + + $z = 3 + 4*i; + +if you like. To create a number using the polar form, use either: + + $z = Math::Complex->emake(5, pi/3); + $x = cplxe(5, pi/3); + +instead. The first argument is the modulus, the second is the angle +(in radians, the full circle is 2*pi). (Mnemonic: C<e> is used as a +notation for complex numbers in the polar form). + +It is possible to write: + + $x = cplxe(-3, pi/4); + +but that will be silently converted into C<[3,-3pi/4]>, since the +modulus must be non-negative (it represents the distance to the origin +in the complex plane). + +It is also possible to have a complex number as either argument of the +C<make>, C<emake>, C<cplx>, and C<cplxe>: the appropriate component of +the argument will be used. + + $z1 = cplx(-2, 1); + $z2 = cplx($z1, 4); + +The C<new>, C<make>, C<emake>, C<cplx>, and C<cplxe> will also +understand a single (string) argument of the forms + + 2-3i + -3i + [2,3] + [2,-3pi/4] + [2] + +in which case the appropriate cartesian and exponential components +will be parsed from the string and used to create new complex numbers. +The imaginary component and the theta, respectively, will default to zero. + +The C<new>, C<make>, C<emake>, C<cplx>, and C<cplxe> will also +understand the case of no arguments: this means plain zero or (0, 0). + +=head1 DISPLAYING + +When printed, a complex number is usually shown under its cartesian +style I<a+bi>, but there are legitimate cases where the polar style +I<[r,t]> is more appropriate. The process of converting the complex +number into a string that can be displayed is known as I<stringification>. + +By calling the class method C<Math::Complex::display_format> and +supplying either C<"polar"> or C<"cartesian"> as an argument, you +override the default display style, which is C<"cartesian">. Not +supplying any argument returns the current settings. + +This default can be overridden on a per-number basis by calling the +C<display_format> method instead. As before, not supplying any argument +returns the current display style for this number. Otherwise whatever you +specify will be the new display style for I<this> particular number. + +For instance: + + use Math::Complex; + + Math::Complex::display_format('polar'); + $j = (root(1, 3))[1]; + print "j = $j\n"; # Prints "j = [1,2pi/3]" + $j->display_format('cartesian'); + print "j = $j\n"; # Prints "j = -0.5+0.866025403784439i" + +The polar style attempts to emphasize arguments like I<k*pi/n> +(where I<n> is a positive integer and I<k> an integer within [-9, +9]), +this is called I<polar pretty-printing>. + +For the reverse of stringifying, see the C<make> and C<emake>. + +=head2 CHANGED IN PERL 5.6 + +The C<display_format> class method and the corresponding +C<display_format> object method can now be called using +a parameter hash instead of just a one parameter. + +The old display format style, which can have values C<"cartesian"> or +C<"polar">, can be changed using the C<"style"> parameter. + + $j->display_format(style => "polar"); + +The one parameter calling convention also still works. + + $j->display_format("polar"); + +There are two new display parameters. + +The first one is C<"format">, which is a sprintf()-style format string +to be used for both numeric parts of the complex number(s). The is +somewhat system-dependent but most often it corresponds to C<"%.15g">. +You can revert to the default by setting the C<format> to C<undef>. + + # the $j from the above example + + $j->display_format('format' => '%.5f'); + print "j = $j\n"; # Prints "j = -0.50000+0.86603i" + $j->display_format('format' => undef); + print "j = $j\n"; # Prints "j = -0.5+0.86603i" + +Notice that this affects also the return values of the +C<display_format> methods: in list context the whole parameter hash +will be returned, as opposed to only the style parameter value. +This is a potential incompatibility with earlier versions if you +have been calling the C<display_format> method in list context. + +The second new display parameter is C<"polar_pretty_print">, which can +be set to true or false, the default being true. See the previous +section for what this means. + +=head1 USAGE + +Thanks to overloading, the handling of arithmetics with complex numbers +is simple and almost transparent. + +Here are some examples: + + use Math::Complex; + + $j = cplxe(1, 2*pi/3); # $j ** 3 == 1 + print "j = $j, j**3 = ", $j ** 3, "\n"; + print "1 + j + j**2 = ", 1 + $j + $j**2, "\n"; + + $z = -16 + 0*i; # Force it to be a complex + print "sqrt($z) = ", sqrt($z), "\n"; + + $k = exp(i * 2*pi/3); + print "$j - $k = ", $j - $k, "\n"; + + $z->Re(3); # Re, Im, arg, abs, + $j->arg(2); # (the last two aka rho, theta) + # can be used also as mutators. + +=head1 CONSTANTS + +=head2 PI + +The constant C<pi> and some handy multiples of it (pi2, pi4, +and pip2 (pi/2) and pip4 (pi/4)) are also available if separately +exported: + + use Math::Complex ':pi'; + $third_of_circle = pi2 / 3; + +=head2 Inf + +The floating point infinity can be exported as a subroutine Inf(): + + use Math::Complex qw(Inf sinh); + my $AlsoInf = Inf() + 42; + my $AnotherInf = sinh(1e42); + print "$AlsoInf is $AnotherInf\n" if $AlsoInf == $AnotherInf; + +Note that the stringified form of infinity varies between platforms: +it can be for example any of + + inf + infinity + INF + 1.#INF + +or it can be something else. + +Also note that in some platforms trying to use the infinity in +arithmetic operations may result in Perl crashing because using +an infinity causes SIGFPE or its moral equivalent to be sent. +The way to ignore this is + + local $SIG{FPE} = sub { }; + +=head1 ERRORS DUE TO DIVISION BY ZERO OR LOGARITHM OF ZERO + +The division (/) and the following functions + + log ln log10 logn + tan sec csc cot + atan asec acsc acot + tanh sech csch coth + atanh asech acsch acoth + +cannot be computed for all arguments because that would mean dividing +by zero or taking logarithm of zero. These situations cause fatal +runtime errors looking like this + + cot(0): Division by zero. + (Because in the definition of cot(0), the divisor sin(0) is 0) + Died at ... + +or + + atanh(-1): Logarithm of zero. + Died at... + +For the C<csc>, C<cot>, C<asec>, C<acsc>, C<acot>, C<csch>, C<coth>, +C<asech>, C<acsch>, the argument cannot be C<0> (zero). For the +logarithmic functions and the C<atanh>, C<acoth>, the argument cannot +be C<1> (one). For the C<atanh>, C<acoth>, the argument cannot be +C<-1> (minus one). For the C<atan>, C<acot>, the argument cannot be +C<i> (the imaginary unit). For the C<atan>, C<acoth>, the argument +cannot be C<-i> (the negative imaginary unit). For the C<tan>, +C<sec>, C<tanh>, the argument cannot be I<pi/2 + k * pi>, where I<k> +is any integer. atan2(0, 0) is undefined, and if the complex arguments +are used for atan2(), a division by zero will happen if z1**2+z2**2 == 0. + +Note that because we are operating on approximations of real numbers, +these errors can happen when merely `too close' to the singularities +listed above. + +=head1 ERRORS DUE TO INDIGESTIBLE ARGUMENTS + +The C<make> and C<emake> accept both real and complex arguments. +When they cannot recognize the arguments they will die with error +messages like the following + + Math::Complex::make: Cannot take real part of ... + Math::Complex::make: Cannot take real part of ... + Math::Complex::emake: Cannot take rho of ... + Math::Complex::emake: Cannot take theta of ... + +=head1 BUGS + +Saying C<use Math::Complex;> exports many mathematical routines in the +caller environment and even overrides some (C<sqrt>, C<log>, C<atan2>). +This is construed as a feature by the Authors, actually... ;-) + +All routines expect to be given real or complex numbers. Don't attempt to +use BigFloat, since Perl has currently no rule to disambiguate a '+' +operation (for instance) between two overloaded entities. + +In Cray UNICOS there is some strange numerical instability that results +in root(), cos(), sin(), cosh(), sinh(), losing accuracy fast. Beware. +The bug may be in UNICOS math libs, in UNICOS C compiler, in Math::Complex. +Whatever it is, it does not manifest itself anywhere else where Perl runs. + +=head1 SEE ALSO + +L<Math::Trig> + +=head1 AUTHORS + +Daniel S. Lewart <F<lewart!at!uiuc.edu>>, +Jarkko Hietaniemi <F<jhi!at!iki.fi>>, +Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>, +Zefram <zefram@fysh.org> + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +1; + +# eof diff --git a/data/miniconda3/lib/perl5/core_perl/Math/Trig.pm b/data/miniconda3/lib/perl5/core_perl/Math/Trig.pm new file mode 100644 index 0000000000000000000000000000000000000000..1d9612a41c2a824c53724708580b2310edb262e9 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Math/Trig.pm @@ -0,0 +1,761 @@ +# +# Trigonometric functions, mostly inherited from Math::Complex. +# -- Jarkko Hietaniemi, since April 1997 +# -- Raphael Manfredi, September 1996 (indirectly: because of Math::Complex) +# + +package Math::Trig; + +{ use 5.006; } +use strict; + +use Math::Complex 1.59; +use Math::Complex qw(:trig :pi); +require Exporter; + +our @ISA = qw(Exporter); + +our $VERSION = 1.23; + +my @angcnv = qw(rad2deg rad2grad + deg2rad deg2grad + grad2rad grad2deg); + +my @areal = qw(asin_real acos_real); + +our @EXPORT = (@{$Math::Complex::EXPORT_TAGS{'trig'}}, + @angcnv, @areal); + +my @rdlcnv = qw(cartesian_to_cylindrical + cartesian_to_spherical + cylindrical_to_cartesian + cylindrical_to_spherical + spherical_to_cartesian + spherical_to_cylindrical); + +my @greatcircle = qw( + great_circle_distance + great_circle_direction + great_circle_bearing + great_circle_waypoint + great_circle_midpoint + great_circle_destination + ); + +my @pi = qw(pi pi2 pi4 pip2 pip4); + +our @EXPORT_OK = (@rdlcnv, @greatcircle, @pi, 'Inf'); + +# See e.g. the following pages: +# http://www.movable-type.co.uk/scripts/LatLong.html +# http://williams.best.vwh.net/avform.htm + +our %EXPORT_TAGS = ('radial' => [ @rdlcnv ], + 'great_circle' => [ @greatcircle ], + 'pi' => [ @pi ]); + +sub _DR () { pi2/360 } +sub _RD () { 360/pi2 } +sub _DG () { 400/360 } +sub _GD () { 360/400 } +sub _RG () { 400/pi2 } +sub _GR () { pi2/400 } + +# +# Truncating remainder. +# + +sub _remt ($$) { + # Oh yes, POSIX::fmod() would be faster. Possibly. If it is available. + $_[0] - $_[1] * int($_[0] / $_[1]); +} + +# +# Angle conversions. +# + +sub rad2rad($) { _remt($_[0], pi2) } + +sub deg2deg($) { _remt($_[0], 360) } + +sub grad2grad($) { _remt($_[0], 400) } + +sub rad2deg ($;$) { my $d = _RD * $_[0]; $_[1] ? $d : deg2deg($d) } + +sub deg2rad ($;$) { my $d = _DR * $_[0]; $_[1] ? $d : rad2rad($d) } + +sub grad2deg ($;$) { my $d = _GD * $_[0]; $_[1] ? $d : deg2deg($d) } + +sub deg2grad ($;$) { my $d = _DG * $_[0]; $_[1] ? $d : grad2grad($d) } + +sub rad2grad ($;$) { my $d = _RG * $_[0]; $_[1] ? $d : grad2grad($d) } + +sub grad2rad ($;$) { my $d = _GR * $_[0]; $_[1] ? $d : rad2rad($d) } + +# +# acos and asin functions which always return a real number +# + +sub acos_real { + return 0 if $_[0] >= 1; + return pi if $_[0] <= -1; + return acos($_[0]); +} + +sub asin_real { + return &pip2 if $_[0] >= 1; + return -&pip2 if $_[0] <= -1; + return asin($_[0]); +} + +sub cartesian_to_spherical { + my ( $x, $y, $z ) = @_; + + my $rho = sqrt( $x * $x + $y * $y + $z * $z ); + + return ( $rho, + atan2( $y, $x ), + $rho ? acos_real( $z / $rho ) : 0 ); +} + +sub spherical_to_cartesian { + my ( $rho, $theta, $phi ) = @_; + + return ( $rho * cos( $theta ) * sin( $phi ), + $rho * sin( $theta ) * sin( $phi ), + $rho * cos( $phi ) ); +} + +sub spherical_to_cylindrical { + my ( $x, $y, $z ) = spherical_to_cartesian( @_ ); + + return ( sqrt( $x * $x + $y * $y ), $_[1], $z ); +} + +sub cartesian_to_cylindrical { + my ( $x, $y, $z ) = @_; + + return ( sqrt( $x * $x + $y * $y ), atan2( $y, $x ), $z ); +} + +sub cylindrical_to_cartesian { + my ( $rho, $theta, $z ) = @_; + + return ( $rho * cos( $theta ), $rho * sin( $theta ), $z ); +} + +sub cylindrical_to_spherical { + return ( cartesian_to_spherical( cylindrical_to_cartesian( @_ ) ) ); +} + +sub great_circle_distance { + my ( $theta0, $phi0, $theta1, $phi1, $rho ) = @_; + + $rho = 1 unless defined $rho; # Default to the unit sphere. + + my $lat0 = pip2 - $phi0; + my $lat1 = pip2 - $phi1; + + return $rho * + acos_real( cos( $lat0 ) * cos( $lat1 ) * cos( $theta0 - $theta1 ) + + sin( $lat0 ) * sin( $lat1 ) ); +} + +sub great_circle_direction { + my ( $theta0, $phi0, $theta1, $phi1 ) = @_; + + my $lat0 = pip2 - $phi0; + my $lat1 = pip2 - $phi1; + + return rad2rad(pi2 - + atan2(sin($theta0-$theta1) * cos($lat1), + cos($lat0) * sin($lat1) - + sin($lat0) * cos($lat1) * cos($theta0-$theta1))); +} + +*great_circle_bearing = \&great_circle_direction; + +sub great_circle_waypoint { + my ( $theta0, $phi0, $theta1, $phi1, $point ) = @_; + + $point = 0.5 unless defined $point; + + my $d = great_circle_distance( $theta0, $phi0, $theta1, $phi1 ); + + return undef if $d == pi; + + my $sd = sin($d); + + return ($theta0, $phi0) if $sd == 0; + + my $A = sin((1 - $point) * $d) / $sd; + my $B = sin( $point * $d) / $sd; + + my $lat0 = pip2 - $phi0; + my $lat1 = pip2 - $phi1; + + my $x = $A * cos($lat0) * cos($theta0) + $B * cos($lat1) * cos($theta1); + my $y = $A * cos($lat0) * sin($theta0) + $B * cos($lat1) * sin($theta1); + my $z = $A * sin($lat0) + $B * sin($lat1); + + my $theta = atan2($y, $x); + my $phi = acos_real($z); + + return ($theta, $phi); +} + +sub great_circle_midpoint { + great_circle_waypoint(@_[0..3], 0.5); +} + +sub great_circle_destination { + my ( $theta0, $phi0, $dir0, $dst ) = @_; + + my $lat0 = pip2 - $phi0; + + my $phi1 = asin_real(sin($lat0)*cos($dst) + + cos($lat0)*sin($dst)*cos($dir0)); + + my $theta1 = $theta0 + atan2(sin($dir0)*sin($dst)*cos($lat0), + cos($dst)-sin($lat0)*sin($phi1)); + + my $dir1 = great_circle_bearing($theta1, $phi1, $theta0, $phi0) + pi; + + $dir1 -= pi2 if $dir1 > pi2; + + return ($theta1, $phi1, $dir1); +} + +1; + +__END__ +=pod + +=head1 NAME + +Math::Trig - trigonometric functions + +=head1 SYNOPSIS + + use Math::Trig; + + $x = tan(0.9); + $y = acos(3.7); + $z = asin(2.4); + + $halfpi = pi/2; + + $rad = deg2rad(120); + + # Import constants pi2, pip2, pip4 (2*pi, pi/2, pi/4). + use Math::Trig ':pi'; + + # Import the conversions between cartesian/spherical/cylindrical. + use Math::Trig ':radial'; + + # Import the great circle formulas. + use Math::Trig ':great_circle'; + +=head1 DESCRIPTION + +C<Math::Trig> defines many trigonometric functions not defined by the +core Perl which defines only the C<sin()> and C<cos()>. The constant +B<pi> is also defined as are a few convenience functions for angle +conversions, and I<great circle formulas> for spherical movement. + +=head1 TRIGONOMETRIC FUNCTIONS + +The tangent + +=over 4 + +=item B<tan> + +=back + +The cofunctions of the sine, cosine, and tangent (cosec/csc and cotan/cot +are aliases) + +B<csc>, B<cosec>, B<sec>, B<sec>, B<cot>, B<cotan> + +The arcus (also known as the inverse) functions of the sine, cosine, +and tangent + +B<asin>, B<acos>, B<atan> + +The principal value of the arc tangent of y/x + +B<atan2>(y, x) + +The arcus cofunctions of the sine, cosine, and tangent (acosec/acsc +and acotan/acot are aliases). Note that atan2(0, 0) is not well-defined. + +B<acsc>, B<acosec>, B<asec>, B<acot>, B<acotan> + +The hyperbolic sine, cosine, and tangent + +B<sinh>, B<cosh>, B<tanh> + +The cofunctions of the hyperbolic sine, cosine, and tangent (cosech/csch +and cotanh/coth are aliases) + +B<csch>, B<cosech>, B<sech>, B<coth>, B<cotanh> + +The area (also known as the inverse) functions of the hyperbolic +sine, cosine, and tangent + +B<asinh>, B<acosh>, B<atanh> + +The area cofunctions of the hyperbolic sine, cosine, and tangent +(acsch/acosech and acoth/acotanh are aliases) + +B<acsch>, B<acosech>, B<asech>, B<acoth>, B<acotanh> + +The trigonometric constant B<pi> and some of handy multiples +of it are also defined. + +B<pi, pi2, pi4, pip2, pip4> + +=head2 ERRORS DUE TO DIVISION BY ZERO + +The following functions + + acoth + acsc + acsch + asec + asech + atanh + cot + coth + csc + csch + sec + sech + tan + tanh + +cannot be computed for all arguments because that would mean dividing +by zero or taking logarithm of zero. These situations cause fatal +runtime errors looking like this + + cot(0): Division by zero. + (Because in the definition of cot(0), the divisor sin(0) is 0) + Died at ... + +or + + atanh(-1): Logarithm of zero. + Died at... + +For the C<csc>, C<cot>, C<asec>, C<acsc>, C<acot>, C<csch>, C<coth>, +C<asech>, C<acsch>, the argument cannot be C<0> (zero). For the +C<atanh>, C<acoth>, the argument cannot be C<1> (one). For the +C<atanh>, C<acoth>, the argument cannot be C<-1> (minus one). For the +C<tan>, C<sec>, C<tanh>, C<sech>, the argument cannot be I<pi/2 + k * +pi>, where I<k> is any integer. + +Note that atan2(0, 0) is not well-defined. + +=head2 SIMPLE (REAL) ARGUMENTS, COMPLEX RESULTS + +Please note that some of the trigonometric functions can break out +from the B<real axis> into the B<complex plane>. For example +C<asin(2)> has no definition for plain real numbers but it has +definition for complex numbers. + +In Perl terms this means that supplying the usual Perl numbers (also +known as scalars, please see L<perldata>) as input for the +trigonometric functions might produce as output results that no more +are simple real numbers: instead they are complex numbers. + +The C<Math::Trig> handles this by using the C<Math::Complex> package +which knows how to handle complex numbers, please see L<Math::Complex> +for more information. In practice you need not to worry about getting +complex numbers as results because the C<Math::Complex> takes care of +details like for example how to display complex numbers. For example: + + print asin(2), "\n"; + +should produce something like this (take or leave few last decimals): + + 1.5707963267949-1.31695789692482i + +That is, a complex number with the real part of approximately C<1.571> +and the imaginary part of approximately C<-1.317>. + +=head1 PLANE ANGLE CONVERSIONS + +(Plane, 2-dimensional) angles may be converted with the following functions. + +=over + +=item deg2rad + + $radians = deg2rad($degrees); + +=item grad2rad + + $radians = grad2rad($gradians); + +=item rad2deg + + $degrees = rad2deg($radians); + +=item grad2deg + + $degrees = grad2deg($gradians); + +=item deg2grad + + $gradians = deg2grad($degrees); + +=item rad2grad + + $gradians = rad2grad($radians); + +=back + +The full circle is 2 I<pi> radians or I<360> degrees or I<400> gradians. +The result is by default wrapped to be inside the [0, {2pi,360,400}[ circle. +If you don't want this, supply a true second argument: + + $zillions_of_radians = deg2rad($zillions_of_degrees, 1); + $negative_degrees = rad2deg($negative_radians, 1); + +You can also do the wrapping explicitly by rad2rad(), deg2deg(), and +grad2grad(). + +=over 4 + +=item rad2rad + + $radians_wrapped_by_2pi = rad2rad($radians); + +=item deg2deg + + $degrees_wrapped_by_360 = deg2deg($degrees); + +=item grad2grad + + $gradians_wrapped_by_400 = grad2grad($gradians); + +=back + +=head1 RADIAL COORDINATE CONVERSIONS + +B<Radial coordinate systems> are the B<spherical> and the B<cylindrical> +systems, explained shortly in more detail. + +You can import radial coordinate conversion functions by using the +C<:radial> tag: + + use Math::Trig ':radial'; + + ($rho, $theta, $z) = cartesian_to_cylindrical($x, $y, $z); + ($rho, $theta, $phi) = cartesian_to_spherical($x, $y, $z); + ($x, $y, $z) = cylindrical_to_cartesian($rho, $theta, $z); + ($rho_s, $theta, $phi) = cylindrical_to_spherical($rho_c, $theta, $z); + ($x, $y, $z) = spherical_to_cartesian($rho, $theta, $phi); + ($rho_c, $theta, $z) = spherical_to_cylindrical($rho_s, $theta, $phi); + +B<All angles are in radians>. + +=head2 COORDINATE SYSTEMS + +B<Cartesian> coordinates are the usual rectangular I<(x, y, z)>-coordinates. + +Spherical coordinates, I<(rho, theta, pi)>, are three-dimensional +coordinates which define a point in three-dimensional space. They are +based on a sphere surface. The radius of the sphere is B<rho>, also +known as the I<radial> coordinate. The angle in the I<xy>-plane +(around the I<z>-axis) is B<theta>, also known as the I<azimuthal> +coordinate. The angle from the I<z>-axis is B<phi>, also known as the +I<polar> coordinate. The North Pole is therefore I<0, 0, rho>, and +the Gulf of Guinea (think of the missing big chunk of Africa) I<0, +pi/2, rho>. In geographical terms I<phi> is latitude (northward +positive, southward negative) and I<theta> is longitude (eastward +positive, westward negative). + +B<BEWARE>: some texts define I<theta> and I<phi> the other way round, +some texts define the I<phi> to start from the horizontal plane, some +texts use I<r> in place of I<rho>. + +Cylindrical coordinates, I<(rho, theta, z)>, are three-dimensional +coordinates which define a point in three-dimensional space. They are +based on a cylinder surface. The radius of the cylinder is B<rho>, +also known as the I<radial> coordinate. The angle in the I<xy>-plane +(around the I<z>-axis) is B<theta>, also known as the I<azimuthal> +coordinate. The third coordinate is the I<z>, pointing up from the +B<theta>-plane. + +=head2 3-D ANGLE CONVERSIONS + +Conversions to and from spherical and cylindrical coordinates are +available. Please notice that the conversions are not necessarily +reversible because of the equalities like I<pi> angles being equal to +I<-pi> angles. + +=over 4 + +=item cartesian_to_cylindrical + + ($rho, $theta, $z) = cartesian_to_cylindrical($x, $y, $z); + +=item cartesian_to_spherical + + ($rho, $theta, $phi) = cartesian_to_spherical($x, $y, $z); + +=item cylindrical_to_cartesian + + ($x, $y, $z) = cylindrical_to_cartesian($rho, $theta, $z); + +=item cylindrical_to_spherical + + ($rho_s, $theta, $phi) = cylindrical_to_spherical($rho_c, $theta, $z); + +Notice that when C<$z> is not 0 C<$rho_s> is not equal to C<$rho_c>. + +=item spherical_to_cartesian + + ($x, $y, $z) = spherical_to_cartesian($rho, $theta, $phi); + +=item spherical_to_cylindrical + + ($rho_c, $theta, $z) = spherical_to_cylindrical($rho_s, $theta, $phi); + +Notice that when C<$z> is not 0 C<$rho_c> is not equal to C<$rho_s>. + +=back + +=head1 GREAT CIRCLE DISTANCES AND DIRECTIONS + +A great circle is section of a circle that contains the circle +diameter: the shortest distance between two (non-antipodal) points on +the spherical surface goes along the great circle connecting those two +points. + +=head2 great_circle_distance + +You can compute spherical distances, called B<great circle distances>, +by importing the great_circle_distance() function: + + use Math::Trig 'great_circle_distance'; + + $distance = great_circle_distance($theta0, $phi0, $theta1, $phi1, [, $rho]); + +The I<great circle distance> is the shortest distance between two +points on a sphere. The distance is in C<$rho> units. The C<$rho> is +optional, it defaults to 1 (the unit sphere), therefore the distance +defaults to radians. + +If you think geographically the I<theta> are longitudes: zero at the +Greenwhich meridian, eastward positive, westward negative -- and the +I<phi> are latitudes: zero at the North Pole, northward positive, +southward negative. B<NOTE>: this formula thinks in mathematics, not +geographically: the I<phi> zero is at the North Pole, not at the +Equator on the west coast of Africa (Bay of Guinea). You need to +subtract your geographical coordinates from I<pi/2> (also known as 90 +degrees). + + $distance = great_circle_distance($lon0, pi/2 - $lat0, + $lon1, pi/2 - $lat1, $rho); + +=head2 great_circle_direction + +The direction you must follow the great circle (also known as I<bearing>) +can be computed by the great_circle_direction() function: + + use Math::Trig 'great_circle_direction'; + + $direction = great_circle_direction($theta0, $phi0, $theta1, $phi1); + +=head2 great_circle_bearing + +Alias 'great_circle_bearing' for 'great_circle_direction' is also available. + + use Math::Trig 'great_circle_bearing'; + + $direction = great_circle_bearing($theta0, $phi0, $theta1, $phi1); + +The result of great_circle_direction is in radians, zero indicating +straight north, pi or -pi straight south, pi/2 straight west, and +-pi/2 straight east. + +=head2 great_circle_destination + +You can inversely compute the destination if you know the +starting point, direction, and distance: + + use Math::Trig 'great_circle_destination'; + + # $diro is the original direction, + # for example from great_circle_bearing(). + # $distance is the angular distance in radians, + # for example from great_circle_distance(). + # $thetad and $phid are the destination coordinates, + # $dird is the final direction at the destination. + + ($thetad, $phid, $dird) = + great_circle_destination($theta, $phi, $diro, $distance); + +or the midpoint if you know the end points: + +=head2 great_circle_midpoint + + use Math::Trig 'great_circle_midpoint'; + + ($thetam, $phim) = + great_circle_midpoint($theta0, $phi0, $theta1, $phi1); + +The great_circle_midpoint() is just a special case of + +=head2 great_circle_waypoint + + use Math::Trig 'great_circle_waypoint'; + + ($thetai, $phii) = + great_circle_waypoint($theta0, $phi0, $theta1, $phi1, $way); + +Where the $way is a value from zero ($theta0, $phi0) to one ($theta1, +$phi1). Note that antipodal points (where their distance is I<pi> +radians) do not have waypoints between them (they would have an an +"equator" between them), and therefore C<undef> is returned for +antipodal points. If the points are the same and the distance +therefore zero and all waypoints therefore identical, the first point +(either point) is returned. + +The thetas, phis, direction, and distance in the above are all in radians. + +You can import all the great circle formulas by + + use Math::Trig ':great_circle'; + +Notice that the resulting directions might be somewhat surprising if +you are looking at a flat worldmap: in such map projections the great +circles quite often do not look like the shortest routes -- but for +example the shortest possible routes from Europe or North America to +Asia do often cross the polar regions. (The common Mercator projection +does B<not> show great circles as straight lines: straight lines in the +Mercator projection are lines of constant bearing.) + +=head1 EXAMPLES + +To calculate the distance between London (51.3N 0.5W) and Tokyo +(35.7N 139.8E) in kilometers: + + use Math::Trig qw(great_circle_distance deg2rad); + + # Notice the 90 - latitude: phi zero is at the North Pole. + sub NESW { deg2rad($_[0]), deg2rad(90 - $_[1]) } + my @L = NESW( -0.5, 51.3); + my @T = NESW(139.8, 35.7); + my $km = great_circle_distance(@L, @T, 6378); # About 9600 km. + +The direction you would have to go from London to Tokyo (in radians, +straight north being zero, straight east being pi/2). + + use Math::Trig qw(great_circle_direction); + + my $rad = great_circle_direction(@L, @T); # About 0.547 or 0.174 pi. + +The midpoint between London and Tokyo being + + use Math::Trig qw(great_circle_midpoint); + + my @M = great_circle_midpoint(@L, @T); + +or about 69 N 89 E, in the frozen wastes of Siberia. + +B<NOTE>: you B<cannot> get from A to B like this: + + Dist = great_circle_distance(A, B) + Dir = great_circle_direction(A, B) + C = great_circle_destination(A, Dist, Dir) + +and expect C to be B, because the bearing constantly changes when +going from A to B (except in some special case like the meridians or +the circles of latitudes) and in great_circle_destination() one gives +a B<constant> bearing to follow. + +=head2 CAVEAT FOR GREAT CIRCLE FORMULAS + +The answers may be off by few percentages because of the irregular +(slightly aspherical) form of the Earth. The errors are at worst +about 0.55%, but generally below 0.3%. + +=head2 Real-valued asin and acos + +For small inputs asin() and acos() may return complex numbers even +when real numbers would be enough and correct, this happens because of +floating-point inaccuracies. You can see these inaccuracies for +example by trying theses: + + print cos(1e-6)**2+sin(1e-6)**2 - 1,"\n"; + printf "%.20f", cos(1e-6)**2+sin(1e-6)**2,"\n"; + +which will print something like this + + -1.11022302462516e-16 + 0.99999999999999988898 + +even though the expected results are of course exactly zero and one. +The formulas used to compute asin() and acos() are quite sensitive to +this, and therefore they might accidentally slip into the complex +plane even when they should not. To counter this there are two +interfaces that are guaranteed to return a real-valued output. + +=over 4 + +=item asin_real + + use Math::Trig qw(asin_real); + + $real_angle = asin_real($input_sin); + +Return a real-valued arcus sine if the input is between [-1, 1], +B<inclusive> the endpoints. For inputs greater than one, pi/2 +is returned. For inputs less than minus one, -pi/2 is returned. + +=item acos_real + + use Math::Trig qw(acos_real); + + $real_angle = acos_real($input_cos); + +Return a real-valued arcus cosine if the input is between [-1, 1], +B<inclusive> the endpoints. For inputs greater than one, zero +is returned. For inputs less than minus one, pi is returned. + +=back + +=head1 BUGS + +Saying C<use Math::Trig;> exports many mathematical routines in the +caller environment and even overrides some (C<sin>, C<cos>). This is +construed as a feature by the Authors, actually... ;-) + +The code is not optimized for speed, especially because we use +C<Math::Complex> and thus go quite near complex numbers while doing +the computations even when the arguments are not. This, however, +cannot be completely avoided if we want things like C<asin(2)> to give +an answer instead of giving a fatal runtime error. + +Do not attempt navigation using these formulas. + +L<Math::Complex> + +=head1 AUTHORS + +Jarkko Hietaniemi <F<jhi!at!iki.fi>>, +Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>, +Zefram <zefram@fysh.org> + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +# eof diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize.pm b/data/miniconda3/lib/perl5/core_perl/Memoize.pm new file mode 100644 index 0000000000000000000000000000000000000000..f4e6522d483e0a95e9bd8ea6335d5f8270364b58 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize.pm @@ -0,0 +1,1077 @@ +# -*- mode: perl; perl-indent-level: 2; -*- +# Memoize.pm +# +# Transparent memoization of idempotent functions +# +# Copyright 1998, 1999, 2000, 2001, 2012 M. J. Dominus. +# You may copy and distribute this program under the +# same terms as Perl itself. If in doubt, +# write to mjd-perl-memoize+@plover.com for a license. + +package Memoize; +$VERSION = '1.03_01'; + +# Compile-time constants +sub SCALAR () { 0 } +sub LIST () { 1 } + + +# +# Usage memoize(functionname/ref, +# { NORMALIZER => coderef, INSTALL => name, +# LIST_CACHE => descriptor, SCALAR_CACHE => descriptor } +# + +use Carp; +use Exporter; +use vars qw($DEBUG); +use Config; # Dammit. +@ISA = qw(Exporter); +@EXPORT = qw(memoize); +@EXPORT_OK = qw(unmemoize flush_cache); +use strict; + +my %memotable; +my %revmemotable; +my @CONTEXT_TAGS = qw(MERGE TIE MEMORY FAULT HASH); +my %IS_CACHE_TAG = map {($_ => 1)} @CONTEXT_TAGS; + +# Raise an error if the user tries to specify one of thesepackage as a +# tie for LIST_CACHE + +my %scalar_only = map {($_ => 1)} qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File); + +sub memoize { + my $fn = shift; + my %options = @_; + my $options = \%options; + + unless (defined($fn) && + (ref $fn eq 'CODE' || ref $fn eq '')) { + croak "Usage: memoize 'functionname'|coderef {OPTIONS}"; + } + + my $uppack = caller; # TCL me Elmo! + my $cref; # Code reference to original function + my $name = (ref $fn ? undef : $fn); + + # Convert function names to code references + $cref = &_make_cref($fn, $uppack); + + # Locate function prototype, if any + my $proto = prototype $cref; + if (defined $proto) { $proto = "($proto)" } + else { $proto = "" } + + # I would like to get rid of the eval, but there seems not to be any + # other way to set the prototype properly. The switch here for + # 'usethreads' works around a bug in threadperl having to do with + # magic goto. It would be better to fix the bug and use the magic + # goto version everywhere. + my $wrapper = + $Config{usethreads} + ? eval "sub $proto { &_memoizer(\$cref, \@_); }" + : eval "sub $proto { unshift \@_, \$cref; goto &_memoizer; }"; + + my $normalizer = $options{NORMALIZER}; + if (defined $normalizer && ! ref $normalizer) { + $normalizer = _make_cref($normalizer, $uppack); + } + + my $install_name; + if (defined $options->{INSTALL}) { + # INSTALL => name + $install_name = $options->{INSTALL}; + } elsif (! exists $options->{INSTALL}) { + # No INSTALL option provided; use original name if possible + $install_name = $name; + } else { + # INSTALL => undef means don't install + } + + if (defined $install_name) { + $install_name = $uppack . '::' . $install_name + unless $install_name =~ /::/; + no strict; + local($^W) = 0; # ``Subroutine $install_name redefined at ...'' + *{$install_name} = $wrapper; # Install memoized version + } + + $revmemotable{$wrapper} = "" . $cref; # Turn code ref into hash key + + # These will be the caches + my %caches; + for my $context (qw(SCALAR LIST)) { + # suppress subsequent 'uninitialized value' warnings + $options{"${context}_CACHE"} ||= ''; + + my $cache_opt = $options{"${context}_CACHE"}; + my @cache_opt_args; + if (ref $cache_opt) { + @cache_opt_args = @$cache_opt; + $cache_opt = shift @cache_opt_args; + } + if ($cache_opt eq 'FAULT') { # no cache + $caches{$context} = undef; + } elsif ($cache_opt eq 'HASH') { # user-supplied hash + my $cache = $cache_opt_args[0]; + my $package = ref(tied %$cache); + if ($context eq 'LIST' && $scalar_only{$package}) { + croak("You can't use $package for LIST_CACHE because it can only store scalars"); + } + $caches{$context} = $cache; + } elsif ($cache_opt eq '' || $IS_CACHE_TAG{$cache_opt}) { + # default is that we make up an in-memory hash + $caches{$context} = {}; + # (this might get tied later, or MERGEd away) + } else { + croak "Unrecognized option to `${context}_CACHE': `$cache_opt' should be one of (@CONTEXT_TAGS); aborting"; + } + } + + # Perhaps I should check here that you didn't supply *both* merge + # options. But if you did, it does do something reasonable: They + # both get merged to the same in-memory hash. + if ($options{SCALAR_CACHE} eq 'MERGE' || $options{LIST_CACHE} eq 'MERGE') { + $options{MERGED} = 1; + $caches{SCALAR} = $caches{LIST}; + } + + # Now deal with the TIE options + { + my $context; + foreach $context (qw(SCALAR LIST)) { + # If the relevant option wasn't `TIE', this call does nothing. + _my_tie($context, $caches{$context}, $options); # Croaks on failure + } + } + + # We should put some more stuff in here eventually. + # We've been saying that for serveral versions now. + # And you know what? More stuff keeps going in! + $memotable{$cref} = + { + O => $options, # Short keys here for things we need to access frequently + N => $normalizer, + U => $cref, + MEMOIZED => $wrapper, + PACKAGE => $uppack, + NAME => $install_name, + S => $caches{SCALAR}, + L => $caches{LIST}, + }; + + $wrapper # Return just memoized version +} + +# This function tries to load a tied hash class and tie the hash to it. +sub _my_tie { + my ($context, $hash, $options) = @_; + my $fullopt = $options->{"${context}_CACHE"}; + + # We already checked to make sure that this works. + my $shortopt = (ref $fullopt) ? $fullopt->[0] : $fullopt; + + return unless defined $shortopt && $shortopt eq 'TIE'; + carp("TIE option to memoize() is deprecated; use HASH instead") + if $^W; + + my @args = ref $fullopt ? @$fullopt : (); + shift @args; + my $module = shift @args; + if ($context eq 'LIST' && $scalar_only{$module}) { + croak("You can't use $module for LIST_CACHE because it can only store scalars"); + } + my $modulefile = $module . '.pm'; + $modulefile =~ s{::}{/}g; + eval { + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + require $modulefile + }; + if ($@) { + croak "Memoize: Couldn't load hash tie module `$module': $@; aborting"; + } + my $rc = (tie %$hash => $module, @args); + unless ($rc) { + croak "Memoize: Couldn't tie hash to `$module': $!; aborting"; + } + 1; +} + +sub flush_cache { + my $func = _make_cref($_[0], scalar caller); + my $info = $memotable{$revmemotable{$func}}; + die "$func not memoized" unless defined $info; + for my $context (qw(S L)) { + my $cache = $info->{$context}; + if (tied %$cache && ! (tied %$cache)->can('CLEAR')) { + my $funcname = defined($info->{NAME}) ? + "function $info->{NAME}" : "anonymous function $func"; + my $context = {S => 'scalar', L => 'list'}->{$context}; + croak "Tied cache hash for $context-context $funcname does not support flushing"; + } else { + %$cache = (); + } + } +} + +# This is the function that manages the memo tables. +sub _memoizer { + my $orig = shift; # stringized version of ref to original func. + my $info = $memotable{$orig}; + my $normalizer = $info->{N}; + + my $argstr; + my $context = (wantarray() ? LIST : SCALAR); + + if (defined $normalizer) { + no strict; + if ($context == SCALAR) { + $argstr = &{$normalizer}(@_); + } elsif ($context == LIST) { + ($argstr) = &{$normalizer}(@_); + } else { + croak "Internal error \#41; context was neither LIST nor SCALAR\n"; + } + } else { # Default normalizer + local $^W = 0; + $argstr = join chr(28),@_; + } + + if ($context == SCALAR) { + my $cache = $info->{S}; + _crap_out($info->{NAME}, 'scalar') unless $cache; + if (exists $cache->{$argstr}) { + return $info->{O}{MERGED} + ? $cache->{$argstr}[0] : $cache->{$argstr}; + } else { + my $val = &{$info->{U}}(@_); + # Scalars are considered to be lists; store appropriately + if ($info->{O}{MERGED}) { + $cache->{$argstr} = [$val]; + } else { + $cache->{$argstr} = $val; + } + $val; + } + } elsif ($context == LIST) { + my $cache = $info->{L}; + _crap_out($info->{NAME}, 'list') unless $cache; + if (exists $cache->{$argstr}) { + return @{$cache->{$argstr}}; + } else { + my @q = &{$info->{U}}(@_); + $cache->{$argstr} = \@q; + @q; + } + } else { + croak "Internal error \#42; context was neither LIST nor SCALAR\n"; + } +} + +sub unmemoize { + my $f = shift; + my $uppack = caller; + my $cref = _make_cref($f, $uppack); + + unless (exists $revmemotable{$cref}) { + croak "Could not unmemoize function `$f', because it was not memoized to begin with"; + } + + my $tabent = $memotable{$revmemotable{$cref}}; + unless (defined $tabent) { + croak "Could not figure out how to unmemoize function `$f'"; + } + my $name = $tabent->{NAME}; + if (defined $name) { + no strict; + local($^W) = 0; # ``Subroutine $install_name redefined at ...'' + *{$name} = $tabent->{U}; # Replace with original function + } + undef $memotable{$revmemotable{$cref}}; + undef $revmemotable{$cref}; + + # This removes the last reference to the (possibly tied) memo tables + # my ($old_function, $memotabs) = @{$tabent}{'U','S','L'}; + # undef $tabent; + +# # Untie the memo tables if they were tied. +# my $i; +# for $i (0,1) { +# if (tied %{$memotabs->[$i]}) { +# warn "Untying hash #$i\n"; +# untie %{$memotabs->[$i]}; +# } +# } + + $tabent->{U}; +} + +sub _make_cref { + my $fn = shift; + my $uppack = shift; + my $cref; + my $name; + + if (ref $fn eq 'CODE') { + $cref = $fn; + } elsif (! ref $fn) { + if ($fn =~ /::/) { + $name = $fn; + } else { + $name = $uppack . '::' . $fn; + } + no strict; + if (defined $name and !defined(&$name)) { + croak "Cannot operate on nonexistent function `$fn'"; + } +# $cref = \&$name; + $cref = *{$name}{CODE}; + } else { + my $parent = (caller(1))[3]; # Function that called _make_cref + croak "Usage: argument 1 to `$parent' must be a function name or reference.\n"; + } + $DEBUG and warn "${name}($fn) => $cref in _make_cref\n"; + $cref; +} + +sub _crap_out { + my ($funcname, $context) = @_; + if (defined $funcname) { + croak "Function `$funcname' called in forbidden $context context; faulting"; + } else { + croak "Anonymous function called in forbidden $context context; faulting"; + } +} + +1; + + + + + +=head1 NAME + +Memoize - Make functions faster by trading space for time + +=head1 SYNOPSIS + + # This is the documentation for Memoize 1.03 + use Memoize; + memoize('slow_function'); + slow_function(arguments); # Is faster than it was before + + +This is normally all you need to know. However, many options are available: + + memoize(function, options...); + +Options include: + + NORMALIZER => function + INSTALL => new_name + + SCALAR_CACHE => 'MEMORY' + SCALAR_CACHE => ['HASH', \%cache_hash ] + SCALAR_CACHE => 'FAULT' + SCALAR_CACHE => 'MERGE' + + LIST_CACHE => 'MEMORY' + LIST_CACHE => ['HASH', \%cache_hash ] + LIST_CACHE => 'FAULT' + LIST_CACHE => 'MERGE' + +=head1 DESCRIPTION + +`Memoizing' a function makes it faster by trading space for time. It +does this by caching the return values of the function in a table. +If you call the function again with the same arguments, C<memoize> +jumps in and gives you the value out of the table, instead of letting +the function compute the value all over again. + +Here is an extreme example. Consider the Fibonacci sequence, defined +by the following function: + + # Compute Fibonacci numbers + sub fib { + my $n = shift; + return $n if $n < 2; + fib($n-1) + fib($n-2); + } + +This function is very slow. Why? To compute fib(14), it first wants +to compute fib(13) and fib(12), and add the results. But to compute +fib(13), it first has to compute fib(12) and fib(11), and then it +comes back and computes fib(12) all over again even though the answer +is the same. And both of the times that it wants to compute fib(12), +it has to compute fib(11) from scratch, and then it has to do it +again each time it wants to compute fib(13). This function does so +much recomputing of old results that it takes a really long time to +run---fib(14) makes 1,200 extra recursive calls to itself, to compute +and recompute things that it already computed. + +This function is a good candidate for memoization. If you memoize the +`fib' function above, it will compute fib(14) exactly once, the first +time it needs to, and then save the result in a table. Then if you +ask for fib(14) again, it gives you the result out of the table. +While computing fib(14), instead of computing fib(12) twice, it does +it once; the second time it needs the value it gets it from the table. +It doesn't compute fib(11) four times; it computes it once, getting it +from the table the next three times. Instead of making 1,200 +recursive calls to `fib', it makes 15. This makes the function about +150 times faster. + +You could do the memoization yourself, by rewriting the function, like +this: + + # Compute Fibonacci numbers, memoized version + { my @fib; + sub fib { + my $n = shift; + return $fib[$n] if defined $fib[$n]; + return $fib[$n] = $n if $n < 2; + $fib[$n] = fib($n-1) + fib($n-2); + } + } + +Or you could use this module, like this: + + use Memoize; + memoize('fib'); + + # Rest of the fib function just like the original version. + +This makes it easy to turn memoizing on and off. + +Here's an even simpler example: I wrote a simple ray tracer; the +program would look in a certain direction, figure out what it was +looking at, and then convert the `color' value (typically a string +like `red') of that object to a red, green, and blue pixel value, like +this: + + for ($direction = 0; $direction < 300; $direction++) { + # Figure out which object is in direction $direction + $color = $object->{color}; + ($r, $g, $b) = @{&ColorToRGB($color)}; + ... + } + +Since there are relatively few objects in a picture, there are only a +few colors, which get looked up over and over again. Memoizing +C<ColorToRGB> sped up the program by several percent. + +=head1 DETAILS + +This module exports exactly one function, C<memoize>. The rest of the +functions in this package are None of Your Business. + +You should say + + memoize(function) + +where C<function> is the name of the function you want to memoize, or +a reference to it. C<memoize> returns a reference to the new, +memoized version of the function, or C<undef> on a non-fatal error. +At present, there are no non-fatal errors, but there might be some in +the future. + +If C<function> was the name of a function, then C<memoize> hides the +old version and installs the new memoized version under the old name, +so that C<&function(...)> actually invokes the memoized version. + +=head1 OPTIONS + +There are some optional options you can pass to C<memoize> to change +the way it behaves a little. To supply options, invoke C<memoize> +like this: + + memoize(function, NORMALIZER => function, + INSTALL => newname, + SCALAR_CACHE => option, + LIST_CACHE => option + ); + +Each of these options is optional; you can include some, all, or none +of them. + +=head2 INSTALL + +If you supply a function name with C<INSTALL>, memoize will install +the new, memoized version of the function under the name you give. +For example, + + memoize('fib', INSTALL => 'fastfib') + +installs the memoized version of C<fib> as C<fastfib>; without the +C<INSTALL> option it would have replaced the old C<fib> with the +memoized version. + +To prevent C<memoize> from installing the memoized version anywhere, use +C<INSTALL =E<gt> undef>. + +=head2 NORMALIZER + +Suppose your function looks like this: + + # Typical call: f('aha!', A => 11, B => 12); + sub f { + my $a = shift; + my %hash = @_; + $hash{B} ||= 2; # B defaults to 2 + $hash{C} ||= 7; # C defaults to 7 + + # Do something with $a, %hash + } + +Now, the following calls to your function are all completely equivalent: + + f(OUCH); + f(OUCH, B => 2); + f(OUCH, C => 7); + f(OUCH, B => 2, C => 7); + f(OUCH, C => 7, B => 2); + (etc.) + +However, unless you tell C<Memoize> that these calls are equivalent, +it will not know that, and it will compute the values for these +invocations of your function separately, and store them separately. + +To prevent this, supply a C<NORMALIZER> function that turns the +program arguments into a string in a way that equivalent arguments +turn into the same string. A C<NORMALIZER> function for C<f> above +might look like this: + + sub normalize_f { + my $a = shift; + my %hash = @_; + $hash{B} ||= 2; + $hash{C} ||= 7; + + join(',', $a, map ($_ => $hash{$_}) sort keys %hash); + } + +Each of the argument lists above comes out of the C<normalize_f> +function looking exactly the same, like this: + + OUCH,B,2,C,7 + +You would tell C<Memoize> to use this normalizer this way: + + memoize('f', NORMALIZER => 'normalize_f'); + +C<memoize> knows that if the normalized version of the arguments is +the same for two argument lists, then it can safely look up the value +that it computed for one argument list and return it as the result of +calling the function with the other argument list, even if the +argument lists look different. + +The default normalizer just concatenates the arguments with character +28 in between. (In ASCII, this is called FS or control-\.) This +always works correctly for functions with only one string argument, +and also when the arguments never contain character 28. However, it +can confuse certain argument lists: + + normalizer("a\034", "b") + normalizer("a", "\034b") + normalizer("a\034\034b") + +for example. + +Since hash keys are strings, the default normalizer will not +distinguish between C<undef> and the empty string. It also won't work +when the function's arguments are references. For example, consider a +function C<g> which gets two arguments: A number, and a reference to +an array of numbers: + + g(13, [1,2,3,4,5,6,7]); + +The default normalizer will turn this into something like +C<"13\034ARRAY(0x436c1f)">. That would be all right, except that a +subsequent array of numbers might be stored at a different location +even though it contains the same data. If this happens, C<Memoize> +will think that the arguments are different, even though they are +equivalent. In this case, a normalizer like this is appropriate: + + sub normalize { join ' ', $_[0], @{$_[1]} } + +For the example above, this produces the key "13 1 2 3 4 5 6 7". + +Another use for normalizers is when the function depends on data other +than those in its arguments. Suppose you have a function which +returns a value which depends on the current hour of the day: + + sub on_duty { + my ($problem_type) = @_; + my $hour = (localtime)[2]; + open my $fh, "$DIR/$problem_type" or die...; + my $line; + while ($hour-- > 0) + $line = <$fh>; + } + return $line; + } + +At 10:23, this function generates the 10th line of a data file; at +3:45 PM it generates the 15th line instead. By default, C<Memoize> +will only see the $problem_type argument. To fix this, include the +current hour in the normalizer: + + sub normalize { join ' ', (localtime)[2], @_ } + +The calling context of the function (scalar or list context) is +propagated to the normalizer. This means that if the memoized +function will treat its arguments differently in list context than it +would in scalar context, you can have the normalizer function select +its behavior based on the results of C<wantarray>. Even if called in +a list context, a normalizer should still return a single string. + +=head2 C<SCALAR_CACHE>, C<LIST_CACHE> + +Normally, C<Memoize> caches your function's return values into an +ordinary Perl hash variable. However, you might like to have the +values cached on the disk, so that they persist from one run of your +program to the next, or you might like to associate some other +interesting semantics with the cached values. + +There's a slight complication under the hood of C<Memoize>: There are +actually I<two> caches, one for scalar values and one for list values. +When your function is called in scalar context, its return value is +cached in one hash, and when your function is called in list context, +its value is cached in the other hash. You can control the caching +behavior of both contexts independently with these options. + +The argument to C<LIST_CACHE> or C<SCALAR_CACHE> must either be one of +the following four strings: + + MEMORY + FAULT + MERGE + HASH + +or else it must be a reference to an array whose first element is one of +these four strings, such as C<[HASH, arguments...]>. + +=over 4 + +=item C<MEMORY> + +C<MEMORY> means that return values from the function will be cached in +an ordinary Perl hash variable. The hash variable will not persist +after the program exits. This is the default. + +=item C<HASH> + +C<HASH> allows you to specify that a particular hash that you supply +will be used as the cache. You can tie this hash beforehand to give +it any behavior you want. + +A tied hash can have any semantics at all. It is typically tied to an +on-disk database, so that cached values are stored in the database and +retrieved from it again when needed, and the disk file typically +persists after your program has exited. See C<perltie> for more +complete details about C<tie>. + +A typical example is: + + use DB_File; + tie my %cache => 'DB_File', $filename, O_RDWR|O_CREAT, 0666; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + +This has the effect of storing the cache in a C<DB_File> database +whose name is in C<$filename>. The cache will persist after the +program has exited. Next time the program runs, it will find the +cache already populated from the previous run of the program. Or you +can forcibly populate the cache by constructing a batch program that +runs in the background and populates the cache file. Then when you +come to run your real program the memoized function will be fast +because all its results have been precomputed. + +Another reason to use C<HASH> is to provide your own hash variable. +You can then inspect or modify the contents of the hash to gain finer +control over the cache management. + +=item C<TIE> + +This option is no longer supported. It is still documented only to +aid in the debugging of old programs that use it. Old programs should +be converted to use the C<HASH> option instead. + + memoize ... ['TIE', PACKAGE, ARGS...] + +is merely a shortcut for + + require PACKAGE; + { tie my %cache, PACKAGE, ARGS...; + memoize ... [HASH => \%cache]; + } + +=item C<FAULT> + +C<FAULT> means that you never expect to call the function in scalar +(or list) context, and that if C<Memoize> detects such a call, it +should abort the program. The error message is one of + + `foo' function called in forbidden list context at line ... + `foo' function called in forbidden scalar context at line ... + +=item C<MERGE> + +C<MERGE> normally means that the memoized function does not +distinguish between list and sclar context, and that return values in +both contexts should be stored together. Both C<LIST_CACHE =E<gt> +MERGE> and C<SCALAR_CACHE =E<gt> MERGE> mean the same thing. + +Consider this function: + + sub complicated { + # ... time-consuming calculation of $result + return $result; + } + +The C<complicated> function will return the same numeric C<$result> +regardless of whether it is called in list or in scalar context. + +Normally, the following code will result in two calls to C<complicated>, even +if C<complicated> is memoized: + + $x = complicated(142); + ($y) = complicated(142); + $z = complicated(142); + +The first call will cache the result, say 37, in the scalar cache; the +second will cach the list C<(37)> in the list cache. The third call +doesn't call the real C<complicated> function; it gets the value 37 +from the scalar cache. + +Obviously, the second call to C<complicated> is a waste of time, and +storing its return value is a waste of space. Specifying C<LIST_CACHE +=E<gt> MERGE> will make C<memoize> use the same cache for scalar and +list context return values, so that the second call uses the scalar +cache that was populated by the first call. C<complicated> ends up +being called only once, and both subsequent calls return C<3> from the +cache, regardless of the calling context. + +=head3 List values in scalar context + +Consider this function: + + sub iota { return reverse (1..$_[0]) } + +This function normally returns a list. Suppose you memoize it and +merge the caches: + + memoize 'iota', SCALAR_CACHE => 'MERGE'; + + @i7 = iota(7); + $i7 = iota(7); + +Here the first call caches the list (1,2,3,4,5,6,7). The second call +does not really make sense. C<Memoize> cannot guess what behavior +C<iota> should have in scalar context without actually calling it in +scalar context. Normally C<Memoize> I<would> call C<iota> in scalar +context and cache the result, but the C<SCALAR_CACHE =E<gt> 'MERGE'> +option says not to do that, but to use the cache list-context value +instead. But it cannot return a list of seven elements in a scalar +context. In this case C<$i7> will receive the B<first element> of the +cached list value, namely 7. + +=head3 Merged disk caches + +Another use for C<MERGE> is when you want both kinds of return values +stored in the same disk file; this saves you from having to deal with +two disk files instead of one. You can use a normalizer function to +keep the two sets of return values separate. For example: + + tie my %cache => 'MLDBM', 'DB_File', $filename, ...; + + memoize 'myfunc', + NORMALIZER => 'n', + SCALAR_CACHE => [HASH => \%cache], + LIST_CACHE => 'MERGE', + ; + + sub n { + my $context = wantarray() ? 'L' : 'S'; + # ... now compute the hash key from the arguments ... + $hashkey = "$context:$hashkey"; + } + +This normalizer function will store scalar context return values in +the disk file under keys that begin with C<S:>, and list context +return values under keys that begin with C<L:>. + +=back + +=head1 OTHER FACILITIES + +=head2 C<unmemoize> + +There's an C<unmemoize> function that you can import if you want to. +Why would you want to? Here's an example: Suppose you have your cache +tied to a DBM file, and you want to make sure that the cache is +written out to disk if someone interrupts the program. If the program +exits normally, this will happen anyway, but if someone types +control-C or something then the program will terminate immediately +without synchronizing the database. So what you can do instead is + + $SIG{INT} = sub { unmemoize 'function' }; + +C<unmemoize> accepts a reference to, or the name of a previously +memoized function, and undoes whatever it did to provide the memoized +version in the first place, including making the name refer to the +unmemoized version if appropriate. It returns a reference to the +unmemoized version of the function. + +If you ask it to unmemoize a function that was never memoized, it +croaks. + +=head2 C<flush_cache> + +C<flush_cache(function)> will flush out the caches, discarding I<all> +the cached data. The argument may be a function name or a reference +to a function. For finer control over when data is discarded or +expired, see the documentation for C<Memoize::Expire>, included in +this package. + +Note that if the cache is a tied hash, C<flush_cache> will attempt to +invoke the C<CLEAR> method on the hash. If there is no C<CLEAR> +method, this will cause a run-time error. + +An alternative approach to cache flushing is to use the C<HASH> option +(see above) to request that C<Memoize> use a particular hash variable +as its cache. Then you can examine or modify the hash at any time in +any way you desire. You may flush the cache by using C<%hash = ()>. + +=head1 CAVEATS + +Memoization is not a cure-all: + +=over 4 + +=item * + +Do not memoize a function whose behavior depends on program +state other than its own arguments, such as global variables, the time +of day, or file input. These functions will not produce correct +results when memoized. For a particularly easy example: + + sub f { + time; + } + +This function takes no arguments, and as far as C<Memoize> is +concerned, it always returns the same result. C<Memoize> is wrong, of +course, and the memoized version of this function will call C<time> once +to get the current time, and it will return that same time +every time you call it after that. + +=item * + +Do not memoize a function with side effects. + + sub f { + my ($a, $b) = @_; + my $s = $a + $b; + print "$a + $b = $s.\n"; + } + +This function accepts two arguments, adds them, and prints their sum. +Its return value is the numuber of characters it printed, but you +probably didn't care about that. But C<Memoize> doesn't understand +that. If you memoize this function, you will get the result you +expect the first time you ask it to print the sum of 2 and 3, but +subsequent calls will return 1 (the return value of +C<print>) without actually printing anything. + +=item * + +Do not memoize a function that returns a data structure that is +modified by its caller. + +Consider these functions: C<getusers> returns a list of users somehow, +and then C<main> throws away the first user on the list and prints the +rest: + + sub main { + my $userlist = getusers(); + shift @$userlist; + foreach $u (@$userlist) { + print "User $u\n"; + } + } + + sub getusers { + my @users; + # Do something to get a list of users; + \@users; # Return reference to list. + } + +If you memoize C<getusers> here, it will work right exactly once. The +reference to the users list will be stored in the memo table. C<main> +will discard the first element from the referenced list. The next +time you invoke C<main>, C<Memoize> will not call C<getusers>; it will +just return the same reference to the same list it got last time. But +this time the list has already had its head removed; C<main> will +erroneously remove another element from it. The list will get shorter +and shorter every time you call C<main>. + +Similarly, this: + + $u1 = getusers(); + $u2 = getusers(); + pop @$u1; + +will modify $u2 as well as $u1, because both variables are references +to the same array. Had C<getusers> not been memoized, $u1 and $u2 +would have referred to different arrays. + +=item * + +Do not memoize a very simple function. + +Recently someone mentioned to me that the Memoize module made his +program run slower instead of faster. It turned out that he was +memoizing the following function: + + sub square { + $_[0] * $_[0]; + } + +I pointed out that C<Memoize> uses a hash, and that looking up a +number in the hash is necessarily going to take a lot longer than a +single multiplication. There really is no way to speed up the +C<square> function. + +Memoization is not magical. + +=back + +=head1 PERSISTENT CACHE SUPPORT + +You can tie the cache tables to any sort of tied hash that you want +to, as long as it supports C<TIEHASH>, C<FETCH>, C<STORE>, and +C<EXISTS>. For example, + + tie my %cache => 'GDBM_File', $filename, O_RDWR|O_CREAT, 0666; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + +works just fine. For some storage methods, you need a little glue. + +C<SDBM_File> doesn't supply an C<EXISTS> method, so included in this +package is a glue module called C<Memoize::SDBM_File> which does +provide one. Use this instead of plain C<SDBM_File> to store your +cache table on disk in an C<SDBM_File> database: + + tie my %cache => 'Memoize::SDBM_File', $filename, O_RDWR|O_CREAT, 0666; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + +C<NDBM_File> has the same problem and the same solution. (Use +C<Memoize::NDBM_File instead of plain NDBM_File.>) + +C<Storable> isn't a tied hash class at all. You can use it to store a +hash to disk and retrieve it again, but you can't modify the hash while +it's on the disk. So if you want to store your cache table in a +C<Storable> database, use C<Memoize::Storable>, which puts a hashlike +front-end onto C<Storable>. The hash table is actually kept in +memory, and is loaded from your C<Storable> file at the time you +memoize the function, and stored back at the time you unmemoize the +function (or when your program exits): + + tie my %cache => 'Memoize::Storable', $filename; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + + tie my %cache => 'Memoize::Storable', $filename, 'nstore'; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + +Include the `nstore' option to have the C<Storable> database written +in `network order'. (See L<Storable> for more details about this.) + +The C<flush_cache()> function will raise a run-time error unless the +tied package provides a C<CLEAR> method. + +=head1 EXPIRATION SUPPORT + +See Memoize::Expire, which is a plug-in module that adds expiration +functionality to Memoize. If you don't like the kinds of policies +that Memoize::Expire implements, it is easy to write your own plug-in +module to implement whatever policy you desire. Memoize comes with +several examples. An expiration manager that implements a LRU policy +is available on CPAN as Memoize::ExpireLRU. + +=head1 BUGS + +The test suite is much better, but always needs improvement. + +There is some problem with the way C<goto &f> works under threaded +Perl, perhaps because of the lexical scoping of C<@_>. This is a bug +in Perl, and until it is resolved, memoized functions will see a +slightly different C<caller()> and will perform a little more slowly +on threaded perls than unthreaded perls. + +Some versions of C<DB_File> won't let you store data under a key of +length 0. That means that if you have a function C<f> which you +memoized and the cache is in a C<DB_File> database, then the value of +C<f()> (C<f> called with no arguments) will not be memoized. If this +is a big problem, you can supply a normalizer function that prepends +C<"x"> to every key. + +=head1 MAILING LIST + +To join a very low-traffic mailing list for announcements about +C<Memoize>, send an empty note to C<mjd-perl-memoize-request@plover.com>. + +=head1 AUTHOR + +Mark-Jason Dominus (C<mjd-perl-memoize+@plover.com>), Plover Systems co. + +See the C<Memoize.pm> Page at http://perl.plover.com/Memoize/ +for news and upgrades. Near this page, at +http://perl.plover.com/MiniMemoize/ there is an article about +memoization and about the internals of Memoize that appeared in The +Perl Journal, issue #13. (This article is also included in the +Memoize distribution as `article.html'.) + +The author's book I<Higher-Order Perl> (2005, ISBN 1558607013, published +by Morgan Kaufmann) discusses memoization (and many other +topics) in tremendous detail. It is available on-line for free. +For more information, visit http://hop.perl.plover.com/ . + +To join a mailing list for announcements about C<Memoize>, send an +empty message to C<mjd-perl-memoize-request@plover.com>. This mailing +list is for announcements only and has extremely low traffic---fewer than +two messages per year. + +=head1 COPYRIGHT AND LICENSE + +Copyright 1998, 1999, 2000, 2001, 2012 by Mark Jason Dominus + +This library is free software; you may redistribute it and/or modify +it under the same terms as Perl itself. + +=head1 THANK YOU + +Many thanks to Florian Ragwitz for administration and packaging +assistance, to John Tromp for bug reports, to Jonathan Roy for bug reports +and suggestions, to Michael Schwern for other bug reports and patches, +to Mike Cariaso for helping me to figure out the Right Thing to Do +About Expiration, to Joshua Gerth, Joshua Chamas, Jonathan Roy +(again), Mark D. Anderson, and Andrew Johnson for more suggestions +about expiration, to Brent Powers for the Memoize::ExpireLRU module, +to Ariel Scolnicov for delightful messages about the Fibonacci +function, to Dion Almaer for thought-provoking suggestions about the +default normalizer, to Walt Mankowski and Kurt Starsinic for much help +investigating problems under threaded Perl, to Alex Dudkevich for +reporting the bug in prototyped functions and for checking my patch, +to Tony Bass for many helpful suggestions, to Jonathan Roy (again) for +finding a use for C<unmemoize()>, to Philippe Verdret for enlightening +discussion of C<Hook::PrePostCall>, to Nat Torkington for advice I +ignored, to Chris Nandor for portability advice, to Randal Schwartz +for suggesting the 'C<flush_cache> function, and to Jenda Krynicky for +being a light in the world. + +Special thanks to Jarkko Hietaniemi, the 5.8.0 pumpking, for including +this module in the core and for his patient and helpful guidance +during the integration process. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/AnyDBM_File.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/AnyDBM_File.pm new file mode 100644 index 0000000000000000000000000000000000000000..cf5f7f5bc218a634944d9099d57d8cbbc8e2322d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/AnyDBM_File.pm @@ -0,0 +1,31 @@ +package Memoize::AnyDBM_File; + +=head1 NAME + +Memoize::AnyDBM_File - glue to provide EXISTS for AnyDBM_File for Storable use + +=head1 DESCRIPTION + +See L<Memoize>. + +=cut + +use vars qw(@ISA $VERSION); +$VERSION = '1.03'; +@ISA = qw(DB_File GDBM_File Memoize::NDBM_File Memoize::SDBM_File ODBM_File) unless @ISA; + +my $verbose = 1; + +my $mod; +for $mod (@ISA) { +# (my $truemod = $mod) =~ s/^Memoize:://; +# my $file = "$mod.pm"; +# $file =~ s{::}{/}g; + if (eval "require $mod") { + print STDERR "AnyDBM_File => Selected $mod.\n" if $Verbose; + @ISA = ($mod); # if we leave @ISA alone, warnings abound + return 1; + } +} + +die "No DBM package was successfully found or installed"; diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/Expire.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/Expire.pm new file mode 100644 index 0000000000000000000000000000000000000000..9b3b94444c155648e3c952bc6851124e06c65c4c --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/Expire.pm @@ -0,0 +1,370 @@ + +package Memoize::Expire; +# require 5.00556; +use Carp; +$DEBUG = 0; +$VERSION = '1.03'; + +# This package will implement expiration by prepending a fixed-length header +# to the font of the cached data. The format of the header will be: +# (4-byte number of last-access-time) (For LRU when I implement it) +# (4-byte expiration time: unsigned seconds-since-unix-epoch) +# (2-byte number-of-uses-before-expire) + +sub _header_fmt () { "N N n" } +sub _header_size () { length(_header_fmt) } + +# Usage: memoize func +# TIE => [Memoize::Expire, LIFETIME => sec, NUM_USES => n, +# TIE => [...] ] + +BEGIN { + eval {require Time::HiRes}; + unless ($@) { + Time::HiRes->import('time'); + } +} + +sub TIEHASH { + my ($package, %args) = @_; + my %cache; + if ($args{TIE}) { + my ($module, @opts) = @{$args{TIE}}; + my $modulefile = $module . '.pm'; + $modulefile =~ s{::}{/}g; + eval { require $modulefile }; + if ($@) { + croak "Memoize::Expire: Couldn't load hash tie module `$module': $@; aborting"; + } + my $rc = (tie %cache => $module, @opts); + unless ($rc) { + croak "Memoize::Expire: Couldn't tie hash to `$module': $@; aborting"; + } + } + $args{LIFETIME} ||= 0; + $args{NUM_USES} ||= 0; + $args{C} = \%cache; + bless \%args => $package; +} + +sub STORE { + $DEBUG and print STDERR " >> Store $_[1] $_[2]\n"; + my ($self, $key, $value) = @_; + my $expire_time = $self->{LIFETIME} > 0 ? $self->{LIFETIME} + time : 0; + # The call that results in a value to store into the cache is the + # first of the NUM_USES allowed calls. + my $header = _make_header(time, $expire_time, $self->{NUM_USES}-1); + $self->{C}{$key} = $header . $value; + $value; +} + +sub FETCH { + $DEBUG and print STDERR " >> Fetch cached value for $_[1]\n"; + my ($data, $last_access, $expire_time, $num_uses_left) = _get_item($_[0]{C}{$_[1]}); + $DEBUG and print STDERR " >> (ttl: ", ($expire_time-time()), ", nuses: $num_uses_left)\n"; + $num_uses_left--; + $last_access = time; + _set_header(@_, $data, $last_access, $expire_time, $num_uses_left); + $data; +} + +sub EXISTS { + $DEBUG and print STDERR " >> Exists $_[1]\n"; + unless (exists $_[0]{C}{$_[1]}) { + $DEBUG and print STDERR " Not in underlying hash at all.\n"; + return 0; + } + my $item = $_[0]{C}{$_[1]}; + my ($last_access, $expire_time, $num_uses_left) = _get_header($item); + my $ttl = $expire_time - time; + if ($DEBUG) { + $_[0]{LIFETIME} and print STDERR " Time to live for this item: $ttl\n"; + $_[0]{NUM_USES} and print STDERR " Uses remaining: $num_uses_left\n"; + } + if ( (! $_[0]{LIFETIME} || $expire_time > time) + && (! $_[0]{NUM_USES} || $num_uses_left > 0 )) { + $DEBUG and print STDERR " (Still good)\n"; + return 1; + } else { + $DEBUG and print STDERR " (Expired)\n"; + return 0; + } +} + +# Arguments: last access time, expire time, number of uses remaining +sub _make_header { + pack "N N n", @_; +} + +sub _strip_header { + substr($_[0], 10); +} + +# Arguments: last access time, expire time, number of uses remaining +sub _set_header { + my ($self, $key, $data, @header) = @_; + $self->{C}{$key} = _make_header(@header) . $data; +} + +sub _get_item { + my $data = substr($_[0], 10); + my @header = unpack "N N n", substr($_[0], 0, 10); +# print STDERR " >> _get_item: $data => $data @header\n"; + ($data, @header); +} + +# Return last access time, expire time, number of uses remaining +sub _get_header { + unpack "N N n", substr($_[0], 0, 10); +} + +1; + +=head1 NAME + +Memoize::Expire - Plug-in module for automatic expiration of memoized values + +=head1 SYNOPSIS + + use Memoize; + use Memoize::Expire; + tie my %cache => 'Memoize::Expire', + LIFETIME => $lifetime, # In seconds + NUM_USES => $n_uses; + + memoize 'function', SCALAR_CACHE => [HASH => \%cache ]; + +=head1 DESCRIPTION + +Memoize::Expire is a plug-in module for Memoize. It allows the cached +values for memoized functions to expire automatically. This manual +assumes you are already familiar with the Memoize module. If not, you +should study that manual carefully first, paying particular attention +to the HASH feature. + +Memoize::Expire is a layer of software that you can insert in between +Memoize itself and whatever underlying package implements the cache. +The layer presents a hash variable whose values expire whenever they +get too old, have been used too often, or both. You tell C<Memoize> to +use this forgetful hash as its cache instead of the default, which is +an ordinary hash. + +To specify a real-time timeout, supply the C<LIFETIME> option with a +numeric value. Cached data will expire after this many seconds, and +will be looked up afresh when it expires. When a data item is looked +up afresh, its lifetime is reset. + +If you specify C<NUM_USES> with an argument of I<n>, then each cached +data item will be discarded and looked up afresh after the I<n>th time +you access it. When a data item is looked up afresh, its number of +uses is reset. + +If you specify both arguments, data will be discarded from the cache +when either expiration condition holds. + +Memoize::Expire uses a real hash internally to store the cached data. +You can use the C<HASH> option to Memoize::Expire to supply a tied +hash in place of the ordinary hash that Memoize::Expire will normally +use. You can use this feature to add Memoize::Expire as a layer in +between a persistent disk hash and Memoize. If you do this, you get a +persistent disk cache whose entries expire automatically. For +example: + + # Memoize + # | + # Memoize::Expire enforces data expiration policy + # | + # DB_File implements persistence of data in a disk file + # | + # Disk file + + use Memoize; + use Memoize::Expire; + use DB_File; + + # Set up persistence + tie my %disk_cache => 'DB_File', $filename, O_CREAT|O_RDWR, 0666]; + + # Set up expiration policy, supplying persistent hash as a target + tie my %cache => 'Memoize::Expire', + LIFETIME => $lifetime, # In seconds + NUM_USES => $n_uses, + HASH => \%disk_cache; + + # Set up memoization, supplying expiring persistent hash for cache + memoize 'function', SCALAR_CACHE => [ HASH => \%cache ]; + +=head1 INTERFACE + +There is nothing special about Memoize::Expire. It is just an +example. If you don't like the policy that it implements, you are +free to write your own expiration policy module that implements +whatever policy you desire. Here is how to do that. Let us suppose +that your module will be named MyExpirePolicy. + +Short summary: You need to create a package that defines four methods: + +=over 4 + +=item +TIEHASH + +Construct and return cache object. + +=item +EXISTS + +Given a function argument, is the corresponding function value in the +cache, and if so, is it fresh enough to use? + +=item +FETCH + +Given a function argument, look up the corresponding function value in +the cache and return it. + +=item +STORE + +Given a function argument and the corresponding function value, store +them into the cache. + +=item +CLEAR + +(Optional.) Flush the cache completely. + +=back + +The user who wants the memoization cache to be expired according to +your policy will say so by writing + + tie my %cache => 'MyExpirePolicy', args...; + memoize 'function', SCALAR_CACHE => [HASH => \%cache]; + +This will invoke C<< MyExpirePolicy->TIEHASH(args) >>. +MyExpirePolicy::TIEHASH should do whatever is appropriate to set up +the cache, and it should return the cache object to the caller. + +For example, MyExpirePolicy::TIEHASH might create an object that +contains a regular Perl hash (which it will to store the cached +values) and some extra information about the arguments and how old the +data is and things like that. Let us call this object `C'. + +When Memoize needs to check to see if an entry is in the cache +already, it will invoke C<< C->EXISTS(key) >>. C<key> is the normalized +function argument. MyExpirePolicy::EXISTS should return 0 if the key +is not in the cache, or if it has expired, and 1 if an unexpired value +is in the cache. It should I<not> return C<undef>, because there is a +bug in some versions of Perl that will cause a spurious FETCH if the +EXISTS method returns C<undef>. + +If your EXISTS function returns true, Memoize will try to fetch the +cached value by invoking C<< C->FETCH(key) >>. MyExpirePolicy::FETCH should +return the cached value. Otherwise, Memoize will call the memoized +function to compute the appropriate value, and will store it into the +cache by calling C<< C->STORE(key, value) >>. + +Here is a very brief example of a policy module that expires each +cache item after ten seconds. + + package Memoize::TenSecondExpire; + + sub TIEHASH { + my ($package, %args) = @_; + my $cache = $args{HASH} || {}; + bless $cache => $package; + } + + sub EXISTS { + my ($cache, $key) = @_; + if (exists $cache->{$key} && + $cache->{$key}{EXPIRE_TIME} > time) { + return 1 + } else { + return 0; # Do NOT return `undef' here. + } + } + + sub FETCH { + my ($cache, $key) = @_; + return $cache->{$key}{VALUE}; + } + + sub STORE { + my ($cache, $key, $newvalue) = @_; + $cache->{$key}{VALUE} = $newvalue; + $cache->{$key}{EXPIRE_TIME} = time + 10; + } + +To use this expiration policy, the user would say + + use Memoize; + tie my %cache10sec => 'Memoize::TenSecondExpire'; + memoize 'function', SCALAR_CACHE => [HASH => \%cache10sec]; + +Memoize would then call C<function> whenever a cached value was +entirely absent or was older than ten seconds. + +You should always support a C<HASH> argument to C<TIEHASH> that ties +the underlying cache so that the user can specify that the cache is +also persistent or that it has some other interesting semantics. The +example above demonstrates how to do this, as does C<Memoize::Expire>. + +Another sample module, L<Memoize::Saves>, is available in a separate +distribution on CPAN. It implements a policy that allows you to +specify that certain function values would always be looked up afresh. +See the documentation for details. + +=head1 ALTERNATIVES + +Brent Powers has a C<Memoize::ExpireLRU> module that was designed to +work with Memoize and provides expiration of least-recently-used data. +The cache is held at a fixed number of entries, and when new data +comes in, the least-recently used data is expired. See +L<http://search.cpan.org/search?mode=module&query=ExpireLRU>. + +Joshua Chamas's Tie::Cache module may be useful as an expiration +manager. (If you try this, let me know how it works out.) + +If you develop any useful expiration managers that you think should be +distributed with Memoize, please let me know. + +=head1 CAVEATS + +This module is experimental, and may contain bugs. Please report bugs +to the address below. + +Number-of-uses is stored as a 16-bit unsigned integer, so can't exceed +65535. + +Because of clock granularity, expiration times may occur up to one +second sooner than you expect. For example, suppose you store a value +with a lifetime of ten seconds, and you store it at 12:00:00.998 on a +certain day. Memoize will look at the clock and see 12:00:00. Then +9.01 seconds later, at 12:00:10.008 you try to read it back. Memoize +will look at the clock and see 12:00:10 and conclude that the value +has expired. This will probably not occur if you have +C<Time::HiRes> installed. + +=head1 AUTHOR + +Mark-Jason Dominus (mjd-perl-memoize+@plover.com) + +Mike Cariaso provided valuable insight into the best way to solve this +problem. + +=head1 SEE ALSO + +perl(1) + +The Memoize man page. + +http://www.plover.com/~mjd/perl/Memoize/ (for news and updates) + +I maintain a mailing list on which I occasionally announce new +versions of Memoize. The list is for announcements only, not +discussion. To join, send an empty message to +mjd-perl-memoize-request@Plover.com. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireFile.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireFile.pm new file mode 100644 index 0000000000000000000000000000000000000000..06b72f8ef2a5ae855d0b4207b510eb4b7b84faf2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireFile.pm @@ -0,0 +1,52 @@ +package Memoize::ExpireFile; + +=head1 NAME + +Memoize::ExpireFile - test for Memoize expiration semantics + +=head1 DESCRIPTION + +See L<Memoize::Expire>. + +=cut + +$VERSION = '1.03'; +use Carp; + +my $Zero = pack("N", 0); + +sub TIEHASH { + my ($package, %args) = @_; + my $cache = $args{HASH} || {}; + bless {ARGS => \%args, C => $cache} => $package; +} + + +sub STORE { +# print "Expiry manager STORE handler\n"; + my ($self, $key, $data) = @_; + my $cache = $self->{C}; + my $cur_date = pack("N", (stat($key))[9]); + $cache->{"C$key"} = $data; + $cache->{"T$key"} = $cur_date; +} + +sub FETCH { + my ($self, $key) = @_; + $self->{C}{"C$key"}; +} + +sub EXISTS { +# print "Expiry manager EXISTS handler\n"; + my ($self, $key) = @_; + my $cache_date = $self->{C}{"T$key"} || $Zero; + my $file_date = pack("N", (stat($key))[9]);# +# if ($self->{ARGS}{CHECK_DATE} && $old_date gt $cur_date) { +# return $self->{ARGS}{CHECK_DATE}->($key, $old_date, $cur_date); +# } + my $res = $cache_date ge $file_date; +# print $res ? "... still good\n" : "... expired\n"; + $res; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireTest.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireTest.pm new file mode 100644 index 0000000000000000000000000000000000000000..7f7dd28af6f7a9226dc6ae0a11aa597a5a2a2729 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/ExpireTest.pm @@ -0,0 +1,49 @@ +package Memoize::ExpireTest; + +=head1 NAME + +Memoize::ExpireTest - test for Memoize expiration semantics + +=head1 DESCRIPTION + +This module is just for testing expiration semantics. It's not a very +good example of how to write an expiration module. + +If you are looking for an example, I recommend that you look at the +simple example in the Memoize::Expire documentation, or at the code +for Memoize::Expire itself. + +If you have questions, I will be happy to answer them if you send them +to mjd-perl-memoize+@plover.com. + +=cut + +$VERSION = '1.03'; +my %cache; + +sub TIEHASH { + my ($pack) = @_; + bless \%cache => $pack; +} + +sub EXISTS { + my ($cache, $key) = @_; + exists $cache->{$key} ? 1 : 0; +} + +sub FETCH { + my ($cache, $key) = @_; + $cache->{$key}; +} + +sub STORE { + my ($cache, $key, $val) = @_; + $cache->{$key} = $val; +} + +sub expire { + my ($key) = @_; + delete $cache{$key}; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/NDBM_File.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/NDBM_File.pm new file mode 100644 index 0000000000000000000000000000000000000000..ff934c656bcf875657e6f089edeb1fde73032603 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/NDBM_File.pm @@ -0,0 +1,77 @@ +package Memoize::NDBM_File; + +=head1 NAME + +Memoize::NDBM_File - glue to provide EXISTS for NDBM_File for Storable use + +=head1 DESCRIPTION + +See L<Memoize>. + +=cut + +use NDBM_File; +@ISA = qw(NDBM_File); +$VERSION = '1.03'; + +$Verbose = 0; + +sub AUTOLOAD { + warn "Nonexistent function $AUTOLOAD invoked in Memoize::NDBM_File\n"; +} + +sub import { + warn "Importing Memoize::NDBM_File\n" if $Verbose; +} + + +my %keylist; + +# This is so ridiculous... +sub _backhash { + my $self = shift; + my %fakehash; + my $k; + for ($k = $self->FIRSTKEY(); defined $k; $k = $self->NEXTKEY($k)) { + $fakehash{$k} = undef; + } + $keylist{$self} = \%fakehash; +} + +sub EXISTS { + warn "Memoize::NDBM_File EXISTS (@_)\n" if $Verbose; + my $self = shift; + _backhash($self) unless exists $keylist{$self}; + my $r = exists $keylist{$self}{$_[0]}; + warn "Memoize::NDBM_File EXISTS (@_) ==> $r\n" if $Verbose; + $r; +} + +sub DEFINED { + warn "Memoize::NDBM_File DEFINED (@_)\n" if $Verbose; + my $self = shift; + _backhash($self) unless exists $keylist{$self}; + defined $keylist{$self}{$_[0]}; +} + +sub DESTROY { + warn "Memoize::NDBM_File DESTROY (@_)\n" if $Verbose; + my $self = shift; + delete $keylist{$self}; # So much for reference counting... + $self->SUPER::DESTROY(@_); +} + +# Maybe establish the keylist at TIEHASH time instead? + +sub STORE { + warn "Memoize::NDBM_File STORE (@_)\n" if $VERBOSE; + my $self = shift; + $keylist{$self}{$_[0]} = undef; + $self->SUPER::STORE(@_); +} + + + +# Inherit FETCH and TIEHASH + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/SDBM_File.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/SDBM_File.pm new file mode 100644 index 0000000000000000000000000000000000000000..7cfaa4afb98882bbe8d62f558e2ef0aa156f5a10 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/SDBM_File.pm @@ -0,0 +1,75 @@ +package Memoize::SDBM_File; + +=head1 NAME + +Memoize::SDBM_File - glue to provide EXISTS for SDBM_File for Storable use + +=head1 DESCRIPTION + +See L<Memoize>. + +=cut + +use SDBM_File; +@ISA = qw(SDBM_File); +$VERSION = '1.03'; + +$Verbose = 0; + +sub AUTOLOAD { + warn "Nonexistent function $AUTOLOAD invoked in Memoize::SDBM_File\n"; +} + +sub import { + warn "Importing Memoize::SDBM_File\n" if $Verbose; +} + + +my %keylist; + +# This is so ridiculous... +sub _backhash { + my $self = shift; + my %fakehash; + my $k; + for ($k = $self->FIRSTKEY(); defined $k; $k = $self->NEXTKEY($k)) { + $fakehash{$k} = undef; + } + $keylist{$self} = \%fakehash; +} + +sub EXISTS { + warn "Memoize::SDBM_File EXISTS (@_)\n" if $Verbose; + my $self = shift; + _backhash($self) unless exists $keylist{$self}; + my $r = exists $keylist{$self}{$_[0]}; + warn "Memoize::SDBM_File EXISTS (@_) ==> $r\n" if $Verbose; + $r; +} + +sub DEFINED { + warn "Memoize::SDBM_File DEFINED (@_)\n" if $Verbose; + my $self = shift; + _backhash($self) unless exists $keylist{$self}; + defined $keylist{$self}{$_[0]}; +} + +sub DESTROY { + warn "Memoize::SDBM_File DESTROY (@_)\n" if $Verbose; + my $self = shift; + delete $keylist{$self}; # So much for reference counting... + $self->SUPER::DESTROY(@_); +} + +# Maybe establish the keylist at TIEHASH time instead? + +sub STORE { + warn "Memoize::SDBM_File STORE (@_)\n" if $VERBOSE; + my $self = shift; + $keylist{$self}{$_[0]} = undef; + $self->SUPER::STORE(@_); +} + +# Inherit FETCH and TIEHASH + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Memoize/Storable.pm b/data/miniconda3/lib/perl5/core_perl/Memoize/Storable.pm new file mode 100644 index 0000000000000000000000000000000000000000..131479729722412551ea9a85ee51cc6527086bc2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Memoize/Storable.pm @@ -0,0 +1,72 @@ +package Memoize::Storable; + +=head1 NAME + +Memoize::Storable - store Memoized data in Storable database + +=head1 DESCRIPTION + +See L<Memoize>. + +=cut + +use Storable (); +$VERSION = '1.03'; +$Verbose = 0; + +sub TIEHASH { + require Carp if $Verbose; + my $package = shift; + my $filename = shift; + my $truehash = (-e $filename) ? Storable::retrieve($filename) : {}; + my %options; + print STDERR "Memoize::Storable::TIEHASH($filename, @_)\n" if $Verbose; + @options{@_} = (); + my $self = + {FILENAME => $filename, + H => $truehash, + OPTIONS => \%options + }; + bless $self => $package; +} + +sub STORE { + require Carp if $Verbose; + my $self = shift; + print STDERR "Memoize::Storable::STORE(@_)\n" if $Verbose; + $self->{H}{$_[0]} = $_[1]; +} + +sub FETCH { + require Carp if $Verbose; + my $self = shift; + print STDERR "Memoize::Storable::FETCH(@_)\n" if $Verbose; + $self->{H}{$_[0]}; +} + +sub EXISTS { + require Carp if $Verbose; + my $self = shift; + print STDERR "Memoize::Storable::EXISTS(@_)\n" if $Verbose; + exists $self->{H}{$_[0]}; +} + +sub DESTROY { + require Carp if $Verbose; + my $self= shift; + print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose; + if ($self->{OPTIONS}{'nstore'}) { + Storable::nstore($self->{H}, $self->{FILENAME}); + } else { + Storable::store($self->{H}, $self->{FILENAME}); + } +} + +sub FIRSTKEY { + 'Fake hash from Memoize::Storable'; +} + +sub NEXTKEY { + undef; +} +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pm b/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pm new file mode 100644 index 0000000000000000000000000000000000000000..cd63e480adfec30bf406ffeb1b7a8780a0dce70e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pm @@ -0,0 +1,20373 @@ +package Module::CoreList; +use strict; + +our ( %released, %version, %families, %upstream, %bug_tracker, %deprecated, %delta ); + +use version; +our $VERSION = '5.20210123'; + +sub PKG_PATTERN () { q#\A[a-zA-Z_][0-9a-zA-Z_]*(?:(::|')[0-9a-zA-Z_]+)*\z# } +sub _looks_like_invocant ($) { local $@; !!eval { $_[0]->isa(__PACKAGE__) } } + +sub _undelta { + my ($delta) = @_; + my (%expanded, $delta_from, $base, $changed, $removed); + for my $v (sort keys %$delta) { + ($delta_from, $changed, $removed) = @{$delta->{$v}}{qw( delta_from changed removed )}; + $base = $delta_from ? $expanded{$delta_from} : {}; + my %full = ( %$base, %{$changed || {}} ); + delete @full{ keys %$removed }; + $expanded{$v} = \%full; + } + return %expanded; +} + +sub _released_order { # Sort helper, to make '?' sort after everything else + (substr($released{$a}, 0, 1) eq "?") + ? ((substr($released{$b}, 0, 1) eq "?") + ? 0 + : 1) + : ((substr($released{$b}, 0, 1) eq "?") + ? -1 + : $released{$a} cmp $released{$b} ) +} + +my $dumpinc = 0; +sub import { + my $self = shift; + my $what = shift || ''; + if ($what eq 'dumpinc') { + $dumpinc = 1; + } +} + +END { + print "---INC---\n", join "\n" => keys %INC + if $dumpinc; +} + + +sub first_release_raw { + shift if defined $_[1] and $_[1] =~ PKG_PATTERN and _looks_like_invocant $_[0]; + my $module = shift; + my $version = shift; + + my @perls = $version + ? grep { defined $version{$_}{ $module } && + $version{$_}{ $module } ge $version } keys %version + : grep { exists $version{$_}{ $module } } keys %version; + + return @perls; +} + +sub first_release_by_date { + my @perls = &first_release_raw; + return unless @perls; + return (sort _released_order @perls)[0]; +} + +sub first_release { + my @perls = &first_release_raw; + return unless @perls; + return (sort { $a cmp $b } @perls)[0]; +} + +sub find_modules { + shift if _looks_like_invocant $_[0]; + my $regex = shift; + my @perls = @_ ? @_ : keys %version; + + my %mods; + foreach (@perls) { + while (my ($k, $v) = each %{$version{$_}}) { + $mods{$k}++ if $k =~ $regex; + } + } + return sort keys %mods +} + +sub find_version { + shift if _looks_like_invocant $_[0]; + my $v = shift; + return $version{$v} if defined $v and defined $version{$v}; + return; +} + +sub is_deprecated { + shift if defined $_[1] and $_[1] =~ PKG_PATTERN and _looks_like_invocant $_[0]; + my $module = shift; + my $perl_version = shift || $]; + return unless $module && exists $deprecated{$perl_version}{$module}; + return $deprecated{$perl_version}{$module}; +} + +sub deprecated_in { + shift if defined $_[1] and $_[1] =~ PKG_PATTERN and _looks_like_invocant $_[0]; + my $module = shift or return; + my @perls = grep { exists $deprecated{$_}{$module} } keys %deprecated; + return unless @perls; + require List::Util; + return List::Util::minstr(@perls); +} + +sub removed_from { + my @perls = &removed_raw; + return shift @perls; +} + +sub removed_from_by_date { + my @perls = sort _released_order &removed_raw; + return shift @perls; +} + +sub removed_raw { + shift if defined $_[1] and $_[1] =~ PKG_PATTERN and _looks_like_invocant $_[0]; + my $mod = shift; + return unless my @perls = sort { $a cmp $b } first_release_raw($mod); + my $last = pop @perls; + my @removed = grep { $_ > $last } sort { $a cmp $b } keys %version; + return @removed; +} + +sub changes_between { + shift if _looks_like_invocant $_[0]; + my $left_ver = shift; + my $right_ver = shift; + + my $left = $version{ $left_ver } || {}; + my $right = $version{ $right_ver } || {}; + + my %uniq = (%$left, %$right); + + my %changes; + for my $lib (keys %uniq) { + my $lhs = exists $left->{ $lib } + ? (defined $left->{ $lib } ? $left->{ $lib } : '(undef)') + : '(absent)'; + my $rhs = exists $right->{ $lib } + ? (defined $right->{ $lib } ? $right->{ $lib } : '(undef)') + : '(absent)'; + + next if $lhs eq $rhs; + + my $change = { + (exists $left->{$lib} ? (left => $left->{$lib}) : ()), + (exists $right->{$lib} ? (right => $right->{$lib}) : ()), + }; + + $changes{$lib} = $change; + } + + return %changes; +} + +# When things escaped. +# NB. If you put version numbers with trailing zeroes here, you +# should also add an alias for the numerical ($]) version; see +# just before the __END__ of this module. +%released = ( + 5.000 => '1994-10-17', + 5.001 => '1995-03-14', + 5.002 => '1996-02-29', + 5.00307 => '1996-10-10', + 5.004 => '1997-05-15', + 5.005 => '1998-07-22', + 5.00503 => '1999-03-28', + 5.00405 => '1999-04-29', + 5.006 => '2000-03-22', + 5.006001 => '2001-04-08', + 5.007003 => '2002-03-05', + 5.008 => '2002-07-19', + 5.008001 => '2003-09-25', + 5.009 => '2003-10-27', + 5.008002 => '2003-11-05', + 5.006002 => '2003-11-15', + 5.008003 => '2004-01-14', + 5.00504 => '2004-02-23', + 5.009001 => '2004-03-16', + 5.008004 => '2004-04-21', + 5.008005 => '2004-07-19', + 5.008006 => '2004-11-27', + 5.009002 => '2005-04-01', + 5.008007 => '2005-05-30', + 5.009003 => '2006-01-28', + 5.008008 => '2006-01-31', + 5.009004 => '2006-08-15', + 5.009005 => '2007-07-07', + 5.010000 => '2007-12-18', + 5.008009 => '2008-12-14', + 5.010001 => '2009-08-22', + 5.011000 => '2009-10-02', + 5.011001 => '2009-10-20', + 5.011002 => '2009-11-20', + 5.011003 => '2009-12-20', + 5.011004 => '2010-01-20', + 5.011005 => '2010-02-20', + 5.012000 => '2010-04-12', + 5.013000 => '2010-04-20', + 5.012001 => '2010-05-16', + 5.013001 => '2010-05-20', + 5.013002 => '2010-06-22', + 5.013003 => '2010-07-20', + 5.013004 => '2010-08-20', + 5.012002 => '2010-09-06', + 5.013005 => '2010-09-19', + 5.013006 => '2010-10-20', + 5.013007 => '2010-11-20', + 5.013008 => '2010-12-20', + 5.012003 => '2011-01-21', + 5.013009 => '2011-01-20', + 5.013010 => '2011-02-20', + 5.013011 => '2011-03-20', + 5.014000 => '2011-05-14', + 5.012004 => '2011-06-20', + 5.012005 => '2012-11-10', + 5.014001 => '2011-06-16', + 5.015000 => '2011-06-20', + 5.015001 => '2011-07-20', + 5.015002 => '2011-08-20', + 5.014002 => '2011-09-26', + 5.015003 => '2011-09-20', + 5.015004 => '2011-10-20', + 5.015005 => '2011-11-20', + 5.015006 => '2011-12-20', + 5.015007 => '2012-01-20', + 5.015008 => '2012-02-20', + 5.015009 => '2012-03-20', + 5.016000 => '2012-05-20', + 5.016001 => '2012-08-08', + 5.016002 => '2012-11-01', + 5.017000 => '2012-05-26', + 5.017001 => '2012-06-20', + 5.017002 => '2012-07-20', + 5.017003 => '2012-08-20', + 5.017004 => '2012-09-20', + 5.014003 => '2012-10-12', + 5.017005 => '2012-10-20', + 5.017006 => '2012-11-20', + 5.017007 => '2012-12-18', + 5.017008 => '2013-01-20', + 5.017009 => '2013-02-20', + 5.014004 => '2013-03-10', + 5.016003 => '2013-03-11', + 5.017010 => '2013-03-21', + 5.017011 => '2013-04-20', + 5.018000 => '2013-05-18', + 5.019000 => '2013-05-20', + 5.019001 => '2013-06-21', + 5.019002 => '2013-07-22', + 5.018001 => '2013-08-12', + 5.019003 => '2013-08-20', + 5.019004 => '2013-09-20', + 5.019005 => '2013-10-20', + 5.019006 => '2013-11-20', + 5.019007 => '2013-12-20', + 5.018002 => '2014-01-06', + 5.018003 => '2014-10-01', + 5.018004 => '2014-10-01', + 5.019008 => '2014-01-20', + 5.019009 => '2014-02-20', + 5.01901 => '2014-03-20', + 5.019011 => '2014-04-20', + 5.020000 => '2014-05-27', + 5.021000 => '2014-05-27', + 5.021001 => '2014-06-20', + 5.021002 => '2014-07-20', + 5.021003 => '2014-08-20', + 5.020001 => '2014-09-14', + 5.021004 => '2014-09-20', + 5.021005 => '2014-10-20', + 5.021006 => '2014-11-20', + 5.021007 => '2014-12-20', + 5.021008 => '2015-01-20', + 5.020002 => '2015-02-14', + 5.021009 => '2015-02-21', + 5.021010 => '2015-03-20', + 5.021011 => '2015-04-20', + 5.022000 => '2015-06-01', + 5.023000 => '2015-06-20', + 5.023001 => '2015-07-20', + 5.023002 => '2015-08-20', + 5.020003 => '2015-09-12', + 5.023003 => '2015-09-20', + 5.023004 => '2015-10-20', + 5.023005 => '2015-11-20', + 5.022001 => '2015-12-13', + 5.023006 => '2015-12-21', + 5.023007 => '2016-01-20', + 5.023008 => '2016-02-20', + 5.023009 => '2016-03-20', + 5.022002 => '2016-04-29', + 5.024000 => '2016-05-09', + 5.025000 => '2016-05-09', + 5.025001 => '2016-05-20', + 5.025002 => '2016-06-20', + 5.025003 => '2016-07-20', + 5.025004 => '2016-08-20', + 5.025005 => '2016-09-20', + 5.025006 => '2016-10-20', + 5.025007 => '2016-11-20', + 5.025008 => '2016-12-20', + 5.022003 => '2017-01-14', + 5.024001 => '2017-01-14', + 5.025009 => '2017-01-20', + 5.025010 => '2017-02-20', + 5.025011 => '2017-03-20', + 5.025012 => '2017-04-20', + 5.026000 => '2017-05-30', + 5.027000 => '2017-05-31', + 5.027001 => '2017-06-20', + 5.022004 => '2017-07-15', + 5.024002 => '2017-07-15', + 5.027002 => '2017-07-20', + 5.027003 => '2017-08-21', + 5.027004 => '2017-09-20', + 5.024003 => '2017-09-22', + 5.026001 => '2017-09-22', + 5.027005 => '2017-10-20', + 5.027006 => '2017-11-20', + 5.027007 => '2017-12-20', + 5.027008 => '2018-01-20', + 5.027009 => '2018-02-20', + 5.027010 => '2018-03-20', + 5.024004 => '2018-04-14', + 5.026002 => '2018-04-14', + 5.027011 => '2018-04-20', + 5.028000 => '2018-06-22', + 5.029000 => '2018-06-26', + 5.029001 => '2018-07-20', + 5.029002 => '2018-08-20', + 5.029003 => '2018-09-20', + 5.029004 => '2018-10-20', + 5.029005 => '2018-11-20', + 5.026003 => '2018-11-29', + 5.028001 => '2018-11-29', + 5.029006 => '2018-12-18', + 5.029007 => '2019-01-20', + 5.029008 => '2019-02-20', + 5.029009 => '2019-03-20', + 5.028002 => '2019-04-19', + 5.029010 => '2019-04-20', + 5.030000 => '2019-05-22', + 5.031000 => '2019-05-24', + 5.031001 => '2019-06-20', + 5.031002 => '2019-07-20', + 5.031003 => '2019-08-20', + 5.031004 => '2019-09-20', + 5.031005 => '2019-10-20', + 5.030001 => '2019-11-10', + 5.031006 => '2019-11-20', + 5.031007 => '2019-12-20', + 5.031008 => '2020-01-20', + 5.031009 => '2020-02-20', + 5.030002 => '2020-03-14', + 5.031010 => '2020-03-20', + 5.031011 => '2020-04-28', + 5.028003 => '2020-06-01', + 5.030003 => '2020-06-01', + 5.032000 => '2020-06-20', + 5.033000 => '2020-07-17', + 5.033001 => '2020-08-20', + 5.033002 => '2020-09-20', + 5.033003 => '2020-10-20', + 5.033004 => '2020-11-20', + 5.033005 => '2020-12-20', + 5.033006 => '2021-01-20', + 5.032001 => '2021-01-23', + ); + +for my $version ( sort { $a <=> $b } keys %released ) { + my $family = int ($version * 1000) / 1000; + push @{ $families{ $family }} , $version; +} + +%delta = ( + 5 => { + changed => { + 'AnyDBM_File' => undef, + 'AutoLoader' => undef, + 'AutoSplit' => undef, + 'Benchmark' => undef, + 'Carp' => undef, + 'Cwd' => undef, + 'DB_File' => undef, + 'DynaLoader' => undef, + 'English' => undef, + 'Env' => undef, + 'Exporter' => undef, + 'ExtUtils::MakeMaker' => undef, + 'Fcntl' => undef, + 'File::Basename' => undef, + 'File::CheckTree' => undef, + 'File::Find' => undef, + 'FileHandle' => undef, + 'GDBM_File' => undef, + 'Getopt::Long' => undef, + 'Getopt::Std' => undef, + 'I18N::Collate' => undef, + 'IPC::Open2' => undef, + 'IPC::Open3' => undef, + 'Math::BigFloat' => undef, + 'Math::BigInt' => undef, + 'Math::Complex' => undef, + 'NDBM_File' => undef, + 'Net::Ping' => undef, + 'ODBM_File' => undef, + 'POSIX' => undef, + 'SDBM_File' => undef, + 'Search::Dict' => undef, + 'Shell' => undef, + 'Socket' => undef, + 'Sys::Hostname' => undef, + 'Sys::Syslog' => undef, + 'Term::Cap' => undef, + 'Term::Complete' => undef, + 'Test::Harness' => undef, + 'Text::Abbrev' => undef, + 'Text::ParseWords' => undef, + 'Text::Soundex' => undef, + 'Text::Tabs' => undef, + 'TieHash' => undef, + 'Time::Local' => undef, + 'integer' => undef, + 'less' => undef, + 'sigtrap' => undef, + 'strict' => undef, + 'subs' => undef, + }, + removed => { + } + }, + 5.001 => { + delta_from => 5, + changed => { + 'ExtUtils::Liblist' => undef, + 'ExtUtils::Manifest' => undef, + 'ExtUtils::Mkbootstrap' => undef, + 'File::Path' => undef, + 'SubstrHash' => undef, + 'lib' => undef, + }, + removed => { + } + }, + 5.002 => { + delta_from => 5.001, + changed => { + 'DB_File' => '1.01', + 'Devel::SelfStubber' => '1.01', + 'DirHandle' => undef, + 'DynaLoader' => '1.00', + 'ExtUtils::Install' => undef, + 'ExtUtils::MM_OS2' => undef, + 'ExtUtils::MM_Unix' => undef, + 'ExtUtils::MM_VMS' => undef, + 'ExtUtils::MakeMaker' => '5.21', + 'ExtUtils::Manifest' => '1.22', + 'ExtUtils::Mksymlists' => '1.00', + 'Fcntl' => '1.00', + 'File::Copy' => '1.5', + 'File::Path' => '1.01', + 'FileCache' => undef, + 'FileHandle' => '1.00', + 'GDBM_File' => '1.00', + 'Getopt::Long' => '2.01', + 'NDBM_File' => '1.00', + 'Net::Ping' => '1', + 'ODBM_File' => '1.00', + 'POSIX' => '1.00', + 'Pod::Functions' => undef, + 'Pod::Text' => undef, + 'SDBM_File' => '1.00', + 'Safe' => '1.00', + 'SelectSaver' => undef, + 'SelfLoader' => '1.06', + 'Socket' => '1.5', + 'Symbol' => undef, + 'Term::ReadLine' => undef, + 'Test::Harness' => '1.07', + 'Text::Wrap' => undef, + 'Tie::Hash' => undef, + 'Tie::Scalar' => undef, + 'Tie::SubstrHash' => undef, + 'diagnostics' => undef, + 'overload' => undef, + 'vars' => undef, + }, + removed => { + 'SubstrHash' => 1, + 'TieHash' => 1, + } + }, + 5.00307 => { + delta_from => 5.002, + changed => { + 'Config' => undef, + 'DB_File' => '1.03', + 'ExtUtils::Embed' => '1.18', + 'ExtUtils::Install' => '1.15', + 'ExtUtils::Liblist' => '1.20', + 'ExtUtils::MM_Unix' => '1.107', + 'ExtUtils::MakeMaker' => '5.38', + 'ExtUtils::Manifest' => '1.27', + 'ExtUtils::Mkbootstrap' => '1.13', + 'ExtUtils::Mksymlists' => '1.12', + 'ExtUtils::testlib' => '1.11', + 'Fatal' => undef, + 'File::Basename' => '2.4', + 'FindBin' => '1.04', + 'Getopt::Long' => '2.04', + 'IO' => undef, + 'IO::File' => '1.05', + 'IO::Handle' => '1.12', + 'IO::Pipe' => '1.07', + 'IO::Seekable' => '1.05', + 'IO::Select' => '1.09', + 'IO::Socket' => '1.13', + 'Net::Ping' => '1.01', + 'OS2::ExtAttr' => '0.01', + 'OS2::PrfDB' => '0.02', + 'OS2::Process' => undef, + 'OS2::REXX' => undef, + 'Opcode' => '1.01', + 'Safe' => '2.06', + 'Test::Harness' => '1.13', + 'Text::Tabs' => '96.051501', + 'Text::Wrap' => '96.041801', + 'UNIVERSAL' => undef, + 'VMS::Filespec' => undef, + 'VMS::Stdio' => '2.0', + 'ops' => undef, + 'sigtrap' => '1.01', + }, + removed => { + } + }, + 5.004 => { + delta_from => 5.00307, + changed => { + 'Bundle::CPAN' => '0.02', + 'CGI' => '2.36', + 'CGI::Apache' => '1.01', + 'CGI::Carp' => '1.06', + 'CGI::Fast' => '1.00a', + 'CGI::Push' => '1.00', + 'CGI::Switch' => '0.05', + 'CPAN' => '1.2401', + 'CPAN::FirstTime' => '1.18', + 'CPAN::Nox' => undef, + 'Class::Struct' => undef, + 'Cwd' => '2.00', + 'DB_File' => '1.14', + 'DynaLoader' => '1.02', + 'ExtUtils::Command' => '1.00', + 'ExtUtils::Embed' => '1.2501', + 'ExtUtils::Install' => '1.16', + 'ExtUtils::Liblist' => '1.2201', + 'ExtUtils::MM_Unix' => '1.114', + 'ExtUtils::MM_Win32' => undef, + 'ExtUtils::MakeMaker' => '5.4002', + 'ExtUtils::Manifest' => '1.33', + 'ExtUtils::Mksymlists' => '1.13', + 'ExtUtils::XSSymSet' => '1.0', + 'Fcntl' => '1.03', + 'File::Basename' => '2.5', + 'File::Compare' => '1.1001', + 'File::Copy' => '2.02', + 'File::Path' => '1.04', + 'File::stat' => undef, + 'FileHandle' => '2.00', + 'Getopt::Long' => '2.10', + 'IO::File' => '1.0602', + 'IO::Handle' => '1.1504', + 'IO::Pipe' => '1.0901', + 'IO::Seekable' => '1.06', + 'IO::Select' => '1.10', + 'IO::Socket' => '1.1602', + 'IPC::Open2' => '1.01', + 'IPC::Open3' => '1.0101', + 'Math::Complex' => '1.01', + 'Math::Trig' => '1', + 'Net::Ping' => '2.02', + 'Net::hostent' => undef, + 'Net::netent' => undef, + 'Net::protoent' => undef, + 'Net::servent' => undef, + 'Opcode' => '1.04', + 'POSIX' => '1.02', + 'Pod::Html' => undef, + 'Pod::Text' => '1.0203', + 'SelfLoader' => '1.07', + 'Socket' => '1.6', + 'Symbol' => '1.02', + 'Test::Harness' => '1.1502', + 'Text::Tabs' => '96.121201', + 'Text::Wrap' => '97.011701', + 'Tie::RefHash' => undef, + 'Time::gmtime' => '1.01', + 'Time::localtime' => '1.01', + 'Time::tm' => undef, + 'User::grent' => undef, + 'User::pwent' => undef, + 'VMS::DCLsym' => '1.01', + 'VMS::Stdio' => '2.02', + 'autouse' => '1.01', + 'blib' => undef, + 'constant' => '1.00', + 'locale' => undef, + 'sigtrap' => '1.02', + 'vmsish' => undef, + }, + removed => { + 'Fatal' => 1, + } + }, + 5.00405 => { + delta_from => 5.004, + changed => { + 'AutoLoader' => '5.56', + 'AutoSplit' => '1.0303', + 'Bundle::CPAN' => '0.03', + 'CGI' => '2.42', + 'CGI::Apache' => '1.1', + 'CGI::Carp' => '1.10', + 'CGI::Cookie' => '1.06', + 'CGI::Push' => '1.01', + 'CGI::Switch' => '0.06', + 'CPAN' => '1.40', + 'CPAN::FirstTime' => '1.30', + 'Cwd' => '2.01', + 'DB_File' => '1.15', + 'DynaLoader' => '1.03', + 'ExtUtils::Command' => '1.01', + 'ExtUtils::Embed' => '1.2505', + 'ExtUtils::Install' => '1.28', + 'ExtUtils::Liblist' => '1.25', + 'ExtUtils::MM_Unix' => '1.118', + 'ExtUtils::MakeMaker' => '5.42', + 'ExtUtils::Mkbootstrap' => '1.14', + 'ExtUtils::Mksymlists' => '1.16', + 'File::Basename' => '2.6', + 'File::DosGlob' => undef, + 'File::Path' => '1.0402', + 'File::Spec' => '0.6', + 'File::Spec::Mac' => '1.0', + 'File::Spec::OS2' => undef, + 'File::Spec::Unix' => undef, + 'File::Spec::VMS' => undef, + 'File::Spec::Win32' => undef, + 'FindBin' => '1.41', + 'Getopt::Long' => '2.19', + 'IO::File' => '1.06021', + 'IO::Socket' => '1.1603', + 'IPC::Open3' => '1.0103', + 'Math::Complex' => '1.25', + 'NDBM_File' => '1.01', + 'Pod::Html' => '1.0101', + 'Pod::Text' => '1.0204', + 'SelfLoader' => '1.08', + 'Socket' => '1.7', + 'Test' => '1.04', + 'Test::Harness' => '1.1602', + 'Text::ParseWords' => '3.1001', + 'Text::Wrap' => '98.112902', + 'Tie::Handle' => undef, + 'attrs' => '0.1', + 'base' => undef, + 'blib' => '1.00', + 're' => undef, + 'strict' => '1.01', + }, + removed => { + } + }, + 5.005 => { + delta_from => 5.00405, + changed => { + 'AutoLoader' => undef, + 'AutoSplit' => '1.0302', + 'B' => undef, + 'B::Asmdata' => undef, + 'B::Assembler' => undef, + 'B::Bblock' => undef, + 'B::Bytecode' => undef, + 'B::C' => undef, + 'B::CC' => undef, + 'B::Debug' => undef, + 'B::Deparse' => '0.56', + 'B::Disassembler' => undef, + 'B::Lint' => undef, + 'B::Showlex' => undef, + 'B::Stackobj' => undef, + 'B::Terse' => undef, + 'B::Xref' => undef, + 'CGI::Carp' => '1.101', + 'CPAN' => '1.3901', + 'CPAN::FirstTime' => '1.29', + 'DB_File' => '1.60', + 'Data::Dumper' => '2.09', + 'Errno' => '1.09', + 'ExtUtils::Installed' => '0.02', + 'ExtUtils::MM_Unix' => '1.12601', + 'ExtUtils::MakeMaker' => '5.4301', + 'ExtUtils::Mkbootstrap' => '1.13', + 'ExtUtils::Mksymlists' => '1.17', + 'ExtUtils::Packlist' => '0.03', + 'Fatal' => '1.02', + 'File::Path' => '1.0401', + 'Getopt::Long' => '2.17', + 'IO::Handle' => '1.1505', + 'IPC::Msg' => '1.00', + 'IPC::Open3' => '1.0102', + 'IPC::Semaphore' => '1.00', + 'IPC::SysV' => '1.03', + 'O' => undef, + 'OS2::Process' => '0.2', + 'Pod::Html' => '1.01', + 'Pod::Text' => '1.0203', + 'Text::ParseWords' => '3.1', + 'Text::Wrap' => '97.02', + 'Thread' => '1.0', + 'Thread::Queue' => undef, + 'Thread::Semaphore' => undef, + 'Thread::Signal' => undef, + 'Thread::Specific' => undef, + 'Tie::Array' => '1.00', + 'VMS::Stdio' => '2.1', + 'attrs' => '1.0', + 'fields' => '0.02', + 're' => '0.02', + }, + removed => { + 'Bundle::CPAN' => 1, + } + }, + 5.00503 => { + delta_from => 5.005, + changed => { + 'AutoSplit' => '1.0303', + 'CGI' => '2.46', + 'CGI::Carp' => '1.13', + 'CGI::Fast' => '1.01', + 'CPAN' => '1.48', + 'CPAN::FirstTime' => '1.36', + 'CPAN::Nox' => '1.00', + 'DB_File' => '1.65', + 'Data::Dumper' => '2.101', + 'Dumpvalue' => undef, + 'Errno' => '1.111', + 'ExtUtils::Install' => '1.28', + 'ExtUtils::Liblist' => '1.25', + 'ExtUtils::MM_Unix' => '1.12602', + 'ExtUtils::MakeMaker' => '5.4302', + 'ExtUtils::Manifest' => '1.33', + 'ExtUtils::Mkbootstrap' => '1.14', + 'ExtUtils::Mksymlists' => '1.17', + 'ExtUtils::testlib' => '1.11', + 'FindBin' => '1.42', + 'Getopt::Long' => '2.19', + 'Getopt::Std' => '1.01', + 'IO::Pipe' => '1.0902', + 'IPC::Open3' => '1.0103', + 'Math::Complex' => '1.26', + 'Test' => '1.122', + 'Text::Wrap' => '98.112902', + }, + removed => { + } + }, + 5.00504 => { + delta_from => 5.00503, + changed => { + 'CPAN::FirstTime' => '1.36', + 'DB_File' => '1.807', + 'ExtUtils::Install' => '1.28', + 'ExtUtils::Liblist' => '1.25', + 'ExtUtils::MM_Unix' => '1.12602', + 'ExtUtils::Manifest' => '1.33', + 'ExtUtils::Miniperl' => undef, + 'ExtUtils::Mkbootstrap' => '1.14', + 'ExtUtils::Mksymlists' => '1.17', + 'ExtUtils::testlib' => '1.11', + 'File::Compare' => '1.1002', + 'File::Spec' => '0.8', + 'File::Spec::Functions' => undef, + 'File::Spec::Mac' => undef, + 'Getopt::Long' => '2.20', + 'Pod::Html' => '1.02', + }, + removed => { + } + }, + 5.006 => { + delta_from => 5.00504, + changed => { + 'AutoLoader' => '5.57', + 'AutoSplit' => '1.0305', + 'B::Deparse' => '0.59', + 'B::Stash' => undef, + 'Benchmark' => '1', + 'ByteLoader' => '0.03', + 'CGI' => '2.56', + 'CGI::Apache' => undef, + 'CGI::Carp' => '1.14', + 'CGI::Cookie' => '1.12', + 'CGI::Fast' => '1.02', + 'CGI::Pretty' => '1.03', + 'CGI::Switch' => undef, + 'CPAN' => '1.52', + 'CPAN::FirstTime' => '1.38', + 'Carp::Heavy' => undef, + 'Class::Struct' => '0.58', + 'Cwd' => '2.02', + 'DB' => '1.0', + 'DB_File' => '1.72', + 'Devel::DProf' => '20000000.00_00', + 'Devel::Peek' => '1.00_01', + 'DynaLoader' => '1.04', + 'Exporter' => '5.562', + 'Exporter::Heavy' => undef, + 'ExtUtils::MM_Cygwin' => undef, + 'ExtUtils::MM_Unix' => '1.12603', + 'ExtUtils::MakeMaker' => '5.45', + 'File::Copy' => '2.03', + 'File::Glob' => '0.991', + 'File::Path' => '1.0403', + 'GDBM_File' => '1.03', + 'Getopt::Long' => '2.23', + 'Getopt::Std' => '1.02', + 'IO' => '1.20', + 'IO::Dir' => '1.03', + 'IO::File' => '1.08', + 'IO::Handle' => '1.21', + 'IO::Pipe' => '1.121', + 'IO::Poll' => '0.01', + 'IO::Seekable' => '1.08', + 'IO::Select' => '1.14', + 'IO::Socket' => '1.26', + 'IO::Socket::INET' => '1.25', + 'IO::Socket::UNIX' => '1.20', + 'JNI' => '0.01', + 'JPL::AutoLoader' => undef, + 'JPL::Class' => undef, + 'JPL::Compile' => undef, + 'NDBM_File' => '1.03', + 'ODBM_File' => '1.02', + 'OS2::DLL' => undef, + 'POSIX' => '1.03', + 'Pod::Checker' => '1.098', + 'Pod::Find' => '0.12', + 'Pod::Html' => '1.03', + 'Pod::InputObjects' => '1.12', + 'Pod::Man' => '1.02', + 'Pod::ParseUtils' => '0.2', + 'Pod::Parser' => '1.12', + 'Pod::Plainer' => '0.01', + 'Pod::Select' => '1.12', + 'Pod::Text' => '2.03', + 'Pod::Text::Color' => '0.05', + 'Pod::Text::Termcap' => '0.04', + 'Pod::Usage' => '1.12', + 'SDBM_File' => '1.02', + 'SelfLoader' => '1.0901', + 'Shell' => '0.2', + 'Socket' => '1.72', + 'Sys::Hostname' => '1.1', + 'Sys::Syslog' => '0.01', + 'Term::ANSIColor' => '1.01', + 'Test' => '1.13', + 'Test::Harness' => '1.1604', + 'Text::ParseWords' => '3.2', + 'Text::Soundex' => '1.0', + 'Text::Tabs' => '98.112801', + 'Tie::Array' => '1.01', + 'Tie::Handle' => '1.0', + 'VMS::Stdio' => '2.2', + 'XSLoader' => '0.01', + 'attributes' => '0.03', + 'autouse' => '1.02', + 'base' => '1.01', + 'bytes' => undef, + 'charnames' => undef, + 'constant' => '1.02', + 'diagnostics' => '1.0', + 'fields' => '1.01', + 'filetest' => undef, + 'lib' => '0.5564', + 'open' => undef, + 'utf8' => undef, + 'warnings' => undef, + 'warnings::register' => undef, + }, + removed => { + } + }, + 5.006001 => { + delta_from => 5.006, + changed => { + 'AutoLoader' => '5.58', + 'B::Assembler' => '0.02', + 'B::Concise' => '0.51', + 'B::Deparse' => '0.6', + 'ByteLoader' => '0.04', + 'CGI' => '2.752', + 'CGI::Carp' => '1.20', + 'CGI::Cookie' => '1.18', + 'CGI::Pretty' => '1.05', + 'CGI::Push' => '1.04', + 'CGI::Util' => '1.1', + 'CPAN' => '1.59_54', + 'CPAN::FirstTime' => '1.53', + 'Class::Struct' => '0.59', + 'Cwd' => '2.04', + 'DB_File' => '1.75', + 'Data::Dumper' => '2.102', + 'ExtUtils::Install' => '1.28', + 'ExtUtils::Liblist' => '1.26', + 'ExtUtils::MM_Unix' => '1.12603', + 'ExtUtils::Manifest' => '1.33', + 'ExtUtils::Mkbootstrap' => '1.14', + 'ExtUtils::Mksymlists' => '1.17', + 'ExtUtils::testlib' => '1.11', + 'File::Path' => '1.0404', + 'File::Spec' => '0.82', + 'File::Spec::Epoc' => undef, + 'File::Spec::Functions' => '1.1', + 'File::Spec::Mac' => '1.2', + 'File::Spec::OS2' => '1.1', + 'File::Spec::Unix' => '1.2', + 'File::Spec::VMS' => '1.1', + 'File::Spec::Win32' => '1.2', + 'File::Temp' => '0.12', + 'GDBM_File' => '1.05', + 'Getopt::Long' => '2.25', + 'IO::Poll' => '0.05', + 'JNI' => '0.1', + 'Math::BigFloat' => '0.02', + 'Math::BigInt' => '0.01', + 'Math::Complex' => '1.31', + 'NDBM_File' => '1.04', + 'ODBM_File' => '1.03', + 'OS2::REXX' => '1.00', + 'Pod::Checker' => '1.2', + 'Pod::Find' => '0.21', + 'Pod::InputObjects' => '1.13', + 'Pod::LaTeX' => '0.53', + 'Pod::Man' => '1.15', + 'Pod::ParseUtils' => '0.22', + 'Pod::Parser' => '1.13', + 'Pod::Select' => '1.13', + 'Pod::Text' => '2.08', + 'Pod::Text::Color' => '0.06', + 'Pod::Text::Overstrike' => '1.01', + 'Pod::Text::Termcap' => '1', + 'Pod::Usage' => '1.14', + 'SDBM_File' => '1.03', + 'SelfLoader' => '1.0902', + 'Shell' => '0.3', + 'Term::ANSIColor' => '1.03', + 'Test' => '1.15', + 'Text::Wrap' => '2001.0131', + 'Tie::Handle' => '4.0', + 'Tie::RefHash' => '1.3', + }, + removed => { + } + }, + 5.006002 => { + delta_from => 5.006001, + changed => { + 'CPAN::FirstTime' => '1.53', + 'DB_File' => '1.806', + 'Data::Dumper' => '2.121', + 'ExtUtils::Command' => '1.05', + 'ExtUtils::Command::MM' => '0.03', + 'ExtUtils::Install' => '1.32', + 'ExtUtils::Installed' => '0.08', + 'ExtUtils::Liblist' => '1.01', + 'ExtUtils::Liblist::Kid'=> '1.3', + 'ExtUtils::MM' => '0.04', + 'ExtUtils::MM_Any' => '0.07', + 'ExtUtils::MM_BeOS' => '1.04', + 'ExtUtils::MM_Cygwin' => '1.06', + 'ExtUtils::MM_DOS' => '0.02', + 'ExtUtils::MM_MacOS' => '1.07', + 'ExtUtils::MM_NW5' => '2.06', + 'ExtUtils::MM_OS2' => '1.04', + 'ExtUtils::MM_UWIN' => '0.02', + 'ExtUtils::MM_Unix' => '1.42', + 'ExtUtils::MM_VMS' => '5.70', + 'ExtUtils::MM_Win32' => '1.09', + 'ExtUtils::MM_Win95' => '0.03', + 'ExtUtils::MY' => '0.01', + 'ExtUtils::MakeMaker' => '6.17', + 'ExtUtils::MakeMaker::bytes'=> '0.01', + 'ExtUtils::MakeMaker::vmsish'=> '0.01', + 'ExtUtils::Manifest' => '1.42', + 'ExtUtils::Mkbootstrap' => '1.15', + 'ExtUtils::Mksymlists' => '1.19', + 'ExtUtils::Packlist' => '0.04', + 'ExtUtils::testlib' => '1.15', + 'File::Spec' => '0.86', + 'File::Spec::Cygwin' => '1.1', + 'File::Spec::Epoc' => '1.1', + 'File::Spec::Functions' => '1.3', + 'File::Spec::Mac' => '1.4', + 'File::Spec::OS2' => '1.2', + 'File::Spec::Unix' => '1.5', + 'File::Spec::VMS' => '1.4', + 'File::Spec::Win32' => '1.4', + 'File::Temp' => '0.14', + 'Safe' => '2.10', + 'Test' => '1.24', + 'Test::Builder' => '0.17', + 'Test::Harness' => '2.30', + 'Test::Harness::Assert' => '0.01', + 'Test::Harness::Iterator'=> '0.01', + 'Test::Harness::Straps' => '0.15', + 'Test::More' => '0.47', + 'Test::Simple' => '0.47', + 'Unicode' => '3.0.1', + 'if' => '0.03', + 'ops' => '1.00', + }, + removed => { + } + }, + 5.007003 => { + delta_from => 5.006001, + changed => { + 'AnyDBM_File' => '1.00', + 'Attribute::Handlers' => '0.76', + 'AutoLoader' => '5.59', + 'AutoSplit' => '1.0307', + 'B' => '1.00', + 'B::Asmdata' => '1.00', + 'B::Assembler' => '0.04', + 'B::Bblock' => '1.00', + 'B::Bytecode' => '1.00', + 'B::C' => '1.01', + 'B::CC' => '1.00', + 'B::Concise' => '0.52', + 'B::Debug' => '1.00', + 'B::Deparse' => '0.63', + 'B::Disassembler' => '1.01', + 'B::Lint' => '1.00', + 'B::Showlex' => '1.00', + 'B::Stackobj' => '1.00', + 'B::Stash' => '1.00', + 'B::Terse' => '1.00', + 'B::Xref' => '1.00', + 'Benchmark' => '1.04', + 'CGI' => '2.80', + 'CGI::Apache' => '1.00', + 'CGI::Carp' => '1.22', + 'CGI::Cookie' => '1.20', + 'CGI::Fast' => '1.04', + 'CGI::Pretty' => '1.05_00', + 'CGI::Switch' => '1.00', + 'CGI::Util' => '1.3', + 'CPAN' => '1.59_56', + 'CPAN::FirstTime' => '1.54', + 'CPAN::Nox' => '1.00_01', + 'Carp' => '1.01', + 'Carp::Heavy' => '1.01', + 'Class::ISA' => '0.32', + 'Class::Struct' => '0.61', + 'Cwd' => '2.06', + 'DB_File' => '1.804', + 'Data::Dumper' => '2.12', + 'Devel::DProf' => '20000000.00_01', + 'Devel::PPPort' => '2.0002', + 'Devel::Peek' => '1.00_03', + 'Devel::SelfStubber' => '1.03', + 'Digest' => '1.00', + 'Digest::MD5' => '2.16', + 'DirHandle' => '1.00', + 'Dumpvalue' => '1.10', + 'Encode' => '0.40', + 'Encode::CN' => '0.02', + 'Encode::CN::HZ' => undef, + 'Encode::Encoding' => '0.02', + 'Encode::Internal' => '0.30', + 'Encode::JP' => '0.02', + 'Encode::JP::Constants' => '1.02', + 'Encode::JP::H2Z' => '0.77', + 'Encode::JP::ISO_2022_JP'=> undef, + 'Encode::JP::JIS' => undef, + 'Encode::JP::Tr' => '0.77', + 'Encode::KR' => '0.02', + 'Encode::TW' => '0.02', + 'Encode::Tcl' => '1.01', + 'Encode::Tcl::Escape' => '1.01', + 'Encode::Tcl::Extended' => '1.01', + 'Encode::Tcl::HanZi' => '1.01', + 'Encode::Tcl::Table' => '1.01', + 'Encode::Unicode' => '0.30', + 'Encode::XS' => '0.40', + 'Encode::iso10646_1' => '0.30', + 'Encode::usc2_le' => '0.30', + 'Encode::utf8' => '0.30', + 'English' => '1.00', + 'Env' => '1.00', + 'Exporter' => '5.566', + 'Exporter::Heavy' => '5.562', + 'ExtUtils::Command' => '1.02', + 'ExtUtils::Constant' => '0.11', + 'ExtUtils::Embed' => '1.250601', + 'ExtUtils::Install' => '1.29', + 'ExtUtils::Installed' => '0.04', + 'ExtUtils::Liblist' => '1.2701', + 'ExtUtils::MM_BeOS' => '1.00', + 'ExtUtils::MM_Cygwin' => '1.00', + 'ExtUtils::MM_OS2' => '1.00', + 'ExtUtils::MM_Unix' => '1.12607', + 'ExtUtils::MM_VMS' => '5.56', + 'ExtUtils::MM_Win32' => '1.00_02', + 'ExtUtils::MakeMaker' => '5.48_03', + 'ExtUtils::Manifest' => '1.35', + 'ExtUtils::Mkbootstrap' => '1.1401', + 'ExtUtils::Mksymlists' => '1.18', + 'ExtUtils::Packlist' => '0.04', + 'ExtUtils::testlib' => '1.1201', + 'Fatal' => '1.03', + 'Fcntl' => '1.04', + 'File::Basename' => '2.71', + 'File::CheckTree' => '4.1', + 'File::Compare' => '1.1003', + 'File::Copy' => '2.05', + 'File::DosGlob' => '1.00', + 'File::Find' => '1.04', + 'File::Glob' => '1.01', + 'File::Path' => '1.05', + 'File::Spec' => '0.83', + 'File::Spec::Cygwin' => '1.0', + 'File::Spec::Epoc' => '1.00', + 'File::Spec::Functions' => '1.2', + 'File::Spec::Mac' => '1.3', + 'File::Spec::Unix' => '1.4', + 'File::Spec::VMS' => '1.2', + 'File::Spec::Win32' => '1.3', + 'File::Temp' => '0.13', + 'File::stat' => '1.00', + 'FileCache' => '1.00', + 'FileHandle' => '2.01', + 'Filter::Simple' => '0.77', + 'Filter::Util::Call' => '1.06', + 'FindBin' => '1.43', + 'GDBM_File' => '1.06', + 'Getopt::Long' => '2.28', + 'Getopt::Std' => '1.03', + 'I18N::Collate' => '1.00', + 'I18N::LangTags' => '0.27', + 'I18N::LangTags::List' => '0.25', + 'I18N::Langinfo' => '0.01', + 'IO::Dir' => '1.03_00', + 'IO::File' => '1.09', + 'IO::Handle' => '1.21_00', + 'IO::Pipe' => '1.122', + 'IO::Poll' => '0.06', + 'IO::Seekable' => '1.08_00', + 'IO::Select' => '1.15', + 'IO::Socket' => '1.27', + 'IO::Socket::INET' => '1.26', + 'IO::Socket::UNIX' => '1.20_00', + 'IPC::Msg' => '1.00_00', + 'IPC::Open3' => '1.0104', + 'IPC::Semaphore' => '1.00_00', + 'IPC::SysV' => '1.03_00', + 'List::Util' => '1.06_00', + 'Locale::Constants' => '2.01', + 'Locale::Country' => '2.01', + 'Locale::Currency' => '2.01', + 'Locale::Language' => '2.01', + 'Locale::Maketext' => '1.03', + 'Locale::Script' => '2.01', + 'MIME::Base64' => '2.12', + 'MIME::QuotedPrint' => '2.03', + 'Math::BigFloat' => '1.30', + 'Math::BigInt' => '1.54', + 'Math::BigInt::Calc' => '0.25', + 'Math::Complex' => '1.34', + 'Math::Trig' => '1.01', + 'Memoize' => '0.66', + 'Memoize::AnyDBM_File' => '0.65', + 'Memoize::Expire' => '0.66', + 'Memoize::ExpireFile' => '0.65', + 'Memoize::ExpireTest' => '0.65', + 'Memoize::NDBM_File' => '0.65', + 'Memoize::SDBM_File' => '0.65', + 'Memoize::Storable' => '0.65', + 'NEXT' => '0.50', + 'Net::Cmd' => '2.21', + 'Net::Config' => '1.10', + 'Net::Domain' => '2.17', + 'Net::FTP' => '2.64', + 'Net::FTP::A' => '1.15', + 'Net::FTP::E' => '0.01', + 'Net::FTP::I' => '1.12', + 'Net::FTP::L' => '0.01', + 'Net::FTP::dataconn' => '0.10', + 'Net::NNTP' => '2.21', + 'Net::Netrc' => '2.12', + 'Net::POP3' => '2.23', + 'Net::Ping' => '2.12', + 'Net::SMTP' => '2.21', + 'Net::Time' => '2.09', + 'Net::hostent' => '1.00', + 'Net::netent' => '1.00', + 'Net::protoent' => '1.00', + 'Net::servent' => '1.00', + 'O' => '1.00', + 'OS2::DLL' => '1.00', + 'OS2::Process' => '1.0', + 'OS2::REXX' => '1.01', + 'Opcode' => '1.05', + 'POSIX' => '1.05', + 'PerlIO' => '1.00', + 'PerlIO::Scalar' => '0.01', + 'PerlIO::Via' => '0.01', + 'Pod::Checker' => '1.3', + 'Pod::Find' => '0.22', + 'Pod::Functions' => '1.01', + 'Pod::Html' => '1.04', + 'Pod::LaTeX' => '0.54', + 'Pod::Man' => '1.32', + 'Pod::ParseLink' => '1.05', + 'Pod::Text' => '2.18', + 'Pod::Text::Color' => '1.03', + 'Pod::Text::Overstrike' => '1.08', + 'Pod::Text::Termcap' => '1.09', + 'Safe' => '2.07', + 'Scalar::Util' => '1.06_00', + 'Search::Dict' => '1.02', + 'SelectSaver' => '1.00', + 'SelfLoader' => '1.0903', + 'Shell' => '0.4', + 'Socket' => '1.75', + 'Storable' => '1.015', + 'Switch' => '2.06', + 'Symbol' => '1.04', + 'Sys::Syslog' => '0.02', + 'Term::ANSIColor' => '1.04', + 'Term::Cap' => '1.07', + 'Term::Complete' => '1.4', + 'Term::ReadLine' => '1.00', + 'Test' => '1.18', + 'Test::Builder' => '0.11', + 'Test::Harness' => '2.01', + 'Test::Harness::Assert' => '0.01', + 'Test::Harness::Iterator'=> '0.01', + 'Test::Harness::Straps' => '0.08', + 'Test::More' => '0.41', + 'Test::Simple' => '0.41', + 'Text::Abbrev' => '1.00', + 'Text::Balanced' => '1.89', + 'Text::ParseWords' => '3.21', + 'Text::Soundex' => '1.01', + 'Text::Wrap' => '2001.0929', + 'Thread' => '2.00', + 'Thread::Queue' => '1.00', + 'Thread::Semaphore' => '1.00', + 'Thread::Signal' => '1.00', + 'Thread::Specific' => '1.00', + 'Tie::Array' => '1.02', + 'Tie::File' => '0.17', + 'Tie::Handle' => '4.1', + 'Tie::Hash' => '1.00', + 'Tie::Memoize' => '1.0', + 'Tie::RefHash' => '1.3_00', + 'Tie::Scalar' => '1.00', + 'Tie::SubstrHash' => '1.00', + 'Time::HiRes' => '1.20_00', + 'Time::Local' => '1.04', + 'Time::gmtime' => '1.02', + 'Time::localtime' => '1.02', + 'Time::tm' => '1.00', + 'UNIVERSAL' => '1.00', + 'Unicode::Collate' => '0.10', + 'Unicode::Normalize' => '0.14', + 'Unicode::UCD' => '0.2', + 'User::grent' => '1.00', + 'User::pwent' => '1.00', + 'VMS::DCLsym' => '1.02', + 'VMS::Filespec' => '1.1', + 'VMS::Stdio' => '2.3', + 'XS::Typemap' => '0.01', + 'attributes' => '0.04_01', + 'attrs' => '1.01', + 'autouse' => '1.03', + 'base' => '1.02', + 'blib' => '1.01', + 'bytes' => '1.00', + 'charnames' => '1.01', + 'constant' => '1.04', + 'diagnostics' => '1.1', + 'encoding' => '1.00', + 'fields' => '1.02', + 'filetest' => '1.00', + 'if' => '0.01', + 'integer' => '1.00', + 'less' => '0.01', + 'locale' => '1.00', + 'open' => '1.01', + 'ops' => '1.00', + 'overload' => '1.00', + 're' => '0.03', + 'sort' => '1.00', + 'strict' => '1.02', + 'subs' => '1.00', + 'threads' => '0.05', + 'threads::shared' => '0.90', + 'utf8' => '1.00', + 'vars' => '1.01', + 'vmsish' => '1.00', + 'warnings' => '1.00', + 'warnings::register' => '1.00', + }, + removed => { + } + }, + 5.008 => { + delta_from => 5.007003, + changed => { + 'Attribute::Handlers' => '0.77', + 'B' => '1.01', + 'B::Lint' => '1.01', + 'B::Xref' => '1.01', + 'CGI' => '2.81', + 'CGI::Carp' => '1.23', + 'CPAN' => '1.61', + 'CPAN::FirstTime' => '1.56', + 'CPAN::Nox' => '1.02', + 'Digest::MD5' => '2.20', + 'Dumpvalue' => '1.11', + 'Encode' => '1.75', + 'Encode::Alias' => '1.32', + 'Encode::Byte' => '1.22', + 'Encode::CJKConstants' => '1.00', + 'Encode::CN' => '1.24', + 'Encode::CN::HZ' => '1.04', + 'Encode::Config' => '1.06', + 'Encode::EBCDIC' => '1.21', + 'Encode::Encoder' => '0.05', + 'Encode::Encoding' => '1.30', + 'Encode::Guess' => '1.06', + 'Encode::JP' => '1.25', + 'Encode::JP::H2Z' => '1.02', + 'Encode::JP::JIS7' => '1.08', + 'Encode::KR' => '1.22', + 'Encode::KR::2022_KR' => '1.05', + 'Encode::MIME::Header' => '1.05', + 'Encode::Symbol' => '1.22', + 'Encode::TW' => '1.26', + 'Encode::Unicode' => '1.37', + 'Exporter::Heavy' => '5.566', + 'ExtUtils::Command' => '1.04', + 'ExtUtils::Command::MM' => '0.01', + 'ExtUtils::Constant' => '0.12', + 'ExtUtils::Installed' => '0.06', + 'ExtUtils::Liblist' => '1.00', + 'ExtUtils::Liblist::Kid'=> '1.29', + 'ExtUtils::MM' => '0.04', + 'ExtUtils::MM_Any' => '0.04', + 'ExtUtils::MM_BeOS' => '1.03', + 'ExtUtils::MM_Cygwin' => '1.04', + 'ExtUtils::MM_DOS' => '0.01', + 'ExtUtils::MM_MacOS' => '1.03', + 'ExtUtils::MM_NW5' => '2.05', + 'ExtUtils::MM_OS2' => '1.03', + 'ExtUtils::MM_UWIN' => '0.01', + 'ExtUtils::MM_Unix' => '1.33', + 'ExtUtils::MM_VMS' => '5.65', + 'ExtUtils::MM_Win32' => '1.05', + 'ExtUtils::MM_Win95' => '0.02', + 'ExtUtils::MY' => '0.01', + 'ExtUtils::MakeMaker' => '6.03', + 'ExtUtils::Manifest' => '1.38', + 'ExtUtils::Mkbootstrap' => '1.15', + 'ExtUtils::Mksymlists' => '1.19', + 'ExtUtils::testlib' => '1.15', + 'File::CheckTree' => '4.2', + 'FileCache' => '1.021', + 'Filter::Simple' => '0.78', + 'Getopt::Long' => '2.32', + 'Hash::Util' => '0.04', + 'List::Util' => '1.07_00', + 'Locale::Country' => '2.04', + 'Math::BigFloat' => '1.35', + 'Math::BigFloat::Trace' => '0.01', + 'Math::BigInt' => '1.60', + 'Math::BigInt::Calc' => '0.30', + 'Math::BigInt::Trace' => '0.01', + 'Math::BigRat' => '0.07', + 'Memoize' => '1.01', + 'Memoize::Expire' => '1.00', + 'Memoize::ExpireFile' => '1.01', + 'Net::FTP' => '2.65', + 'Net::FTP::dataconn' => '0.11', + 'Net::Ping' => '2.19', + 'Net::SMTP' => '2.24', + 'PerlIO' => '1.01', + 'PerlIO::encoding' => '0.06', + 'PerlIO::scalar' => '0.01', + 'PerlIO::via' => '0.01', + 'PerlIO::via::QuotedPrint'=> '0.04', + 'Pod::Man' => '1.33', + 'Pod::Text' => '2.19', + 'Scalar::Util' => '1.07_00', + 'Storable' => '2.04', + 'Switch' => '2.09', + 'Sys::Syslog' => '0.03', + 'Test' => '1.20', + 'Test::Builder' => '0.15', + 'Test::Harness' => '2.26', + 'Test::Harness::Straps' => '0.14', + 'Test::More' => '0.45', + 'Test::Simple' => '0.45', + 'Thread::Queue' => '2.00', + 'Thread::Semaphore' => '2.00', + 'Tie::File' => '0.93', + 'Tie::RefHash' => '1.30', + 'Unicode' => '3.2.0', + 'Unicode::Collate' => '0.12', + 'Unicode::Normalize' => '0.17', + 'XS::APItest' => '0.01', + 'attributes' => '0.05', + 'base' => '1.03', + 'bigint' => '0.02', + 'bignum' => '0.11', + 'bigrat' => '0.04', + 'blib' => '1.02', + 'encoding' => '1.35', + 'sort' => '1.01', + 'threads' => '0.99', + }, + removed => { + 'Encode::Internal' => 1, + 'Encode::JP::Constants' => 1, + 'Encode::JP::ISO_2022_JP'=> 1, + 'Encode::JP::JIS' => 1, + 'Encode::JP::Tr' => 1, + 'Encode::Tcl' => 1, + 'Encode::Tcl::Escape' => 1, + 'Encode::Tcl::Extended' => 1, + 'Encode::Tcl::HanZi' => 1, + 'Encode::Tcl::Table' => 1, + 'Encode::XS' => 1, + 'Encode::iso10646_1' => 1, + 'Encode::usc2_le' => 1, + 'Encode::utf8' => 1, + 'PerlIO::Scalar' => 1, + 'PerlIO::Via' => 1, + } + }, + 5.008001 => { + delta_from => 5.008, + changed => { + 'Attribute::Handlers' => '0.78', + 'AutoLoader' => '5.60', + 'AutoSplit' => '1.04', + 'B' => '1.02', + 'B::Asmdata' => '1.01', + 'B::Assembler' => '0.06', + 'B::Bblock' => '1.02', + 'B::Bytecode' => '1.01', + 'B::C' => '1.02', + 'B::Concise' => '0.56', + 'B::Debug' => '1.01', + 'B::Deparse' => '0.64', + 'B::Disassembler' => '1.03', + 'B::Lint' => '1.02', + 'B::Terse' => '1.02', + 'Benchmark' => '1.051', + 'ByteLoader' => '0.05', + 'CGI' => '3.00', + 'CGI::Carp' => '1.26', + 'CGI::Cookie' => '1.24', + 'CGI::Fast' => '1.041', + 'CGI::Pretty' => '1.07_00', + 'CGI::Util' => '1.31', + 'CPAN' => '1.76_01', + 'CPAN::FirstTime' => '1.60', + 'CPAN::Nox' => '1.03', + 'Class::Struct' => '0.63', + 'Cwd' => '2.08', + 'DB_File' => '1.806', + 'Data::Dumper' => '2.121', + 'Devel::DProf' => '20030813.00', + 'Devel::PPPort' => '2.007', + 'Devel::Peek' => '1.01', + 'Digest' => '1.02', + 'Digest::MD5' => '2.27', + 'Encode' => '1.9801', + 'Encode::Alias' => '1.38', + 'Encode::Byte' => '1.23', + 'Encode::CJKConstants' => '1.02', + 'Encode::CN::HZ' => '1.05', + 'Encode::Config' => '1.07', + 'Encode::Encoder' => '0.07', + 'Encode::Encoding' => '1.33', + 'Encode::Guess' => '1.09', + 'Encode::JP::JIS7' => '1.12', + 'Encode::KR' => '1.23', + 'Encode::KR::2022_KR' => '1.06', + 'Encode::MIME::Header' => '1.09', + 'Encode::Unicode' => '1.40', + 'Encode::Unicode::UTF7' => '0.02', + 'English' => '1.01', + 'Errno' => '1.09_00', + 'Exporter' => '5.567', + 'Exporter::Heavy' => '5.567', + 'ExtUtils::Command' => '1.05', + 'ExtUtils::Command::MM' => '0.03', + 'ExtUtils::Constant' => '0.14', + 'ExtUtils::Install' => '1.32', + 'ExtUtils::Installed' => '0.08', + 'ExtUtils::Liblist' => '1.01', + 'ExtUtils::Liblist::Kid'=> '1.3', + 'ExtUtils::MM_Any' => '0.07', + 'ExtUtils::MM_BeOS' => '1.04', + 'ExtUtils::MM_Cygwin' => '1.06', + 'ExtUtils::MM_DOS' => '0.02', + 'ExtUtils::MM_MacOS' => '1.07', + 'ExtUtils::MM_NW5' => '2.06', + 'ExtUtils::MM_OS2' => '1.04', + 'ExtUtils::MM_UWIN' => '0.02', + 'ExtUtils::MM_Unix' => '1.42', + 'ExtUtils::MM_VMS' => '5.70', + 'ExtUtils::MM_Win32' => '1.09', + 'ExtUtils::MM_Win95' => '0.03', + 'ExtUtils::MakeMaker' => '6.17', + 'ExtUtils::MakeMaker::bytes'=> '0.01', + 'ExtUtils::MakeMaker::vmsish'=> '0.01', + 'ExtUtils::Manifest' => '1.42', + 'Fcntl' => '1.05', + 'File::Basename' => '2.72', + 'File::Copy' => '2.06', + 'File::Find' => '1.05', + 'File::Glob' => '1.02', + 'File::Path' => '1.06', + 'File::Spec' => '0.86', + 'File::Spec::Cygwin' => '1.1', + 'File::Spec::Epoc' => '1.1', + 'File::Spec::Functions' => '1.3', + 'File::Spec::Mac' => '1.4', + 'File::Spec::OS2' => '1.2', + 'File::Spec::Unix' => '1.5', + 'File::Spec::VMS' => '1.4', + 'File::Spec::Win32' => '1.4', + 'File::Temp' => '0.14', + 'FileCache' => '1.03', + 'Filter::Util::Call' => '1.0601', + 'GDBM_File' => '1.07', + 'Getopt::Long' => '2.34', + 'Getopt::Std' => '1.04', + 'Hash::Util' => '0.05', + 'I18N::LangTags' => '0.28', + 'I18N::LangTags::List' => '0.26', + 'I18N::Langinfo' => '0.02', + 'IO' => '1.21', + 'IO::Dir' => '1.04', + 'IO::File' => '1.10', + 'IO::Handle' => '1.23', + 'IO::Seekable' => '1.09', + 'IO::Select' => '1.16', + 'IO::Socket' => '1.28', + 'IO::Socket::INET' => '1.27', + 'IO::Socket::UNIX' => '1.21', + 'IPC::Msg' => '1.02', + 'IPC::Open3' => '1.0105', + 'IPC::Semaphore' => '1.02', + 'IPC::SysV' => '1.04', + 'JNI' => '0.2', + 'List::Util' => '1.13', + 'Locale::Country' => '2.61', + 'Locale::Currency' => '2.21', + 'Locale::Language' => '2.21', + 'Locale::Maketext' => '1.06', + 'Locale::Maketext::Guts'=> undef, + 'Locale::Maketext::GutsLoader'=> undef, + 'Locale::Script' => '2.21', + 'MIME::Base64' => '2.20', + 'MIME::QuotedPrint' => '2.20', + 'Math::BigFloat' => '1.40', + 'Math::BigInt' => '1.66', + 'Math::BigInt::Calc' => '0.36', + 'Math::BigInt::Scalar' => '0.11', + 'Math::BigRat' => '0.10', + 'Math::Trig' => '1.02', + 'NDBM_File' => '1.05', + 'NEXT' => '0.60', + 'Net::Cmd' => '2.24', + 'Net::Domain' => '2.18', + 'Net::FTP' => '2.71', + 'Net::FTP::A' => '1.16', + 'Net::NNTP' => '2.22', + 'Net::POP3' => '2.24', + 'Net::Ping' => '2.31', + 'Net::SMTP' => '2.26', + 'Net::hostent' => '1.01', + 'Net::servent' => '1.01', + 'ODBM_File' => '1.04', + 'OS2::DLL' => '1.01', + 'OS2::ExtAttr' => '0.02', + 'OS2::PrfDB' => '0.03', + 'OS2::Process' => '1.01', + 'OS2::REXX' => '1.02', + 'POSIX' => '1.06', + 'PerlIO' => '1.02', + 'PerlIO::encoding' => '0.07', + 'PerlIO::scalar' => '0.02', + 'PerlIO::via' => '0.02', + 'PerlIO::via::QuotedPrint'=> '0.05', + 'Pod::Checker' => '1.41', + 'Pod::Find' => '0.24', + 'Pod::Functions' => '1.02', + 'Pod::Html' => '1.0501', + 'Pod::InputObjects' => '1.14', + 'Pod::LaTeX' => '0.55', + 'Pod::Man' => '1.37', + 'Pod::ParseLink' => '1.06', + 'Pod::ParseUtils' => '0.3', + 'Pod::Perldoc' => '3.10', + 'Pod::Perldoc::BaseTo' => undef, + 'Pod::Perldoc::GetOptsOO'=> undef, + 'Pod::Perldoc::ToChecker'=> undef, + 'Pod::Perldoc::ToMan' => undef, + 'Pod::Perldoc::ToNroff' => undef, + 'Pod::Perldoc::ToPod' => undef, + 'Pod::Perldoc::ToRtf' => undef, + 'Pod::Perldoc::ToText' => undef, + 'Pod::Perldoc::ToTk' => undef, + 'Pod::Perldoc::ToXml' => undef, + 'Pod::PlainText' => '2.01', + 'Pod::Text' => '2.21', + 'Pod::Text::Color' => '1.04', + 'Pod::Text::Overstrike' => '1.1', + 'Pod::Text::Termcap' => '1.11', + 'Pod::Usage' => '1.16', + 'SDBM_File' => '1.04', + 'Safe' => '2.10', + 'Scalar::Util' => '1.13', + 'SelfLoader' => '1.0904', + 'Shell' => '0.5', + 'Socket' => '1.76', + 'Storable' => '2.08', + 'Switch' => '2.10', + 'Symbol' => '1.05', + 'Sys::Hostname' => '1.11', + 'Sys::Syslog' => '0.04', + 'Term::ANSIColor' => '1.07', + 'Term::Cap' => '1.08', + 'Term::Complete' => '1.401', + 'Term::ReadLine' => '1.01', + 'Test' => '1.24', + 'Test::Builder' => '0.17', + 'Test::Harness' => '2.30', + 'Test::Harness::Straps' => '0.15', + 'Test::More' => '0.47', + 'Test::Simple' => '0.47', + 'Text::Abbrev' => '1.01', + 'Text::Balanced' => '1.95', + 'Text::Wrap' => '2001.09291', + 'Thread::Semaphore' => '2.01', + 'Tie::Array' => '1.03', + 'Tie::File' => '0.97', + 'Tie::RefHash' => '1.31', + 'Time::HiRes' => '1.51', + 'Time::Local' => '1.07', + 'UNIVERSAL' => '1.01', + 'Unicode' => '4.0.0', + 'Unicode::Collate' => '0.28', + 'Unicode::Normalize' => '0.23', + 'Unicode::UCD' => '0.21', + 'VMS::Filespec' => '1.11', + 'XS::APItest' => '0.02', + 'XSLoader' => '0.02', + 'attributes' => '0.06', + 'base' => '2.03', + 'bigint' => '0.04', + 'bignum' => '0.14', + 'bigrat' => '0.06', + 'bytes' => '1.01', + 'charnames' => '1.02', + 'diagnostics' => '1.11', + 'encoding' => '1.47', + 'fields' => '2.03', + 'filetest' => '1.01', + 'if' => '0.03', + 'lib' => '0.5565', + 'open' => '1.02', + 'overload' => '1.01', + 're' => '0.04', + 'sort' => '1.02', + 'strict' => '1.03', + 'threads' => '1.00', + 'threads::shared' => '0.91', + 'utf8' => '1.02', + 'vmsish' => '1.01', + 'warnings' => '1.03', + }, + removed => { + } + }, + 5.008002 => { + delta_from => 5.008001, + changed => { + 'DB_File' => '1.807', + 'Devel::PPPort' => '2.009', + 'Digest::MD5' => '2.30', + 'I18N::LangTags' => '0.29', + 'I18N::LangTags::List' => '0.29', + 'MIME::Base64' => '2.21', + 'MIME::QuotedPrint' => '2.21', + 'Net::Domain' => '2.19', + 'Net::FTP' => '2.72', + 'Pod::Perldoc' => '3.11', + 'Time::HiRes' => '1.52', + 'Unicode::Collate' => '0.30', + 'Unicode::Normalize' => '0.25', + }, + removed => { + } + }, + 5.008003 => { + delta_from => 5.008002, + changed => { + 'Benchmark' => '1.052', + 'CGI' => '3.01', + 'CGI::Carp' => '1.27', + 'CGI::Fast' => '1.05', + 'CGI::Pretty' => '1.08', + 'CGI::Util' => '1.4', + 'Cwd' => '2.12', + 'DB_File' => '1.808', + 'Devel::PPPort' => '2.011', + 'Digest' => '1.05', + 'Digest::MD5' => '2.33', + 'Digest::base' => '1.00', + 'Encode' => '1.99', + 'Exporter' => '5.57', + 'File::CheckTree' => '4.3', + 'File::Copy' => '2.07', + 'File::Find' => '1.06', + 'File::Spec' => '0.87', + 'FindBin' => '1.44', + 'Getopt::Std' => '1.05', + 'Math::BigFloat' => '1.42', + 'Math::BigInt' => '1.68', + 'Math::BigInt::Calc' => '0.38', + 'Math::BigInt::CalcEmu' => '0.02', + 'OS2::DLL' => '1.02', + 'POSIX' => '1.07', + 'PerlIO' => '1.03', + 'PerlIO::via::QuotedPrint'=> '0.06', + 'Pod::Html' => '1.0502', + 'Pod::Parser' => '1.14', + 'Pod::Perldoc' => '3.12', + 'Pod::PlainText' => '2.02', + 'Storable' => '2.09', + 'Test::Harness' => '2.40', + 'Test::Harness::Assert' => '0.02', + 'Test::Harness::Iterator'=> '0.02', + 'Test::Harness::Straps' => '0.19', + 'Tie::Hash' => '1.01', + 'Unicode::Collate' => '0.33', + 'Unicode::Normalize' => '0.28', + 'XS::APItest' => '0.03', + 'base' => '2.04', + 'diagnostics' => '1.12', + 'encoding' => '1.48', + 'threads' => '1.01', + 'threads::shared' => '0.92', + }, + removed => { + 'Math::BigInt::Scalar' => 1, + } + }, + 5.008004 => { + delta_from => 5.008003, + changed => { + 'Attribute::Handlers' => '0.78_01', + 'B::Assembler' => '0.07', + 'B::Concise' => '0.60', + 'B::Deparse' => '0.66', + 'Benchmark' => '1.06', + 'CGI' => '3.04', + 'Carp' => '1.02', + 'Cwd' => '2.17', + 'DBM_Filter' => '0.01', + 'DBM_Filter::compress' => '0.01', + 'DBM_Filter::encode' => '0.01', + 'DBM_Filter::int32' => '0.01', + 'DBM_Filter::null' => '0.01', + 'DBM_Filter::utf8' => '0.01', + 'Digest' => '1.06', + 'DynaLoader' => '1.05', + 'Encode' => '1.99_01', + 'Encode::CN::HZ' => '1.0501', + 'Exporter' => '5.58', + 'Exporter::Heavy' => '5.57', + 'ExtUtils::Liblist::Kid'=> '1.3001', + 'ExtUtils::MM_NW5' => '2.07_02', + 'ExtUtils::MM_Win95' => '0.0301', + 'File::Find' => '1.07', + 'IO::Handle' => '1.24', + 'IO::Pipe' => '1.123', + 'IPC::Open3' => '1.0106', + 'Locale::Maketext' => '1.08', + 'MIME::Base64' => '3.01', + 'MIME::QuotedPrint' => '3.01', + 'Math::BigFloat' => '1.44', + 'Math::BigInt' => '1.70', + 'Math::BigInt::Calc' => '0.40', + 'Math::BigInt::CalcEmu' => '0.04', + 'Math::BigRat' => '0.12', + 'ODBM_File' => '1.05', + 'POSIX' => '1.08', + 'Shell' => '0.5.2', + 'Socket' => '1.77', + 'Storable' => '2.12', + 'Sys::Syslog' => '0.05', + 'Term::ANSIColor' => '1.08', + 'Time::HiRes' => '1.59', + 'Unicode' => '4.0.1', + 'Unicode::UCD' => '0.22', + 'Win32' => '0.23', + 'base' => '2.05', + 'bigint' => '0.05', + 'bignum' => '0.15', + 'charnames' => '1.03', + 'open' => '1.03', + 'threads' => '1.03', + 'utf8' => '1.03', + }, + removed => { + } + }, + 5.008005 => { + delta_from => 5.008004, + changed => { + 'B::Concise' => '0.61', + 'B::Deparse' => '0.67', + 'CGI' => '3.05', + 'CGI::Carp' => '1.28', + 'CGI::Util' => '1.5', + 'Carp' => '1.03', + 'Carp::Heavy' => '1.03', + 'Cwd' => '2.19', + 'DB_File' => '1.809', + 'Digest' => '1.08', + 'Encode' => '2.01', + 'Encode::Alias' => '2.00', + 'Encode::Byte' => '2.00', + 'Encode::CJKConstants' => '2.00', + 'Encode::CN' => '2.00', + 'Encode::CN::HZ' => '2.01', + 'Encode::Config' => '2.00', + 'Encode::EBCDIC' => '2.00', + 'Encode::Encoder' => '2.00', + 'Encode::Encoding' => '2.00', + 'Encode::Guess' => '2.00', + 'Encode::JP' => '2.00', + 'Encode::JP::H2Z' => '2.00', + 'Encode::JP::JIS7' => '2.00', + 'Encode::KR' => '2.00', + 'Encode::KR::2022_KR' => '2.00', + 'Encode::MIME::Header' => '2.00', + 'Encode::Symbol' => '2.00', + 'Encode::TW' => '2.00', + 'Encode::Unicode' => '2.00', + 'Encode::Unicode::UTF7' => '2.01', + 'File::Basename' => '2.73', + 'File::Copy' => '2.08', + 'File::Glob' => '1.03', + 'FileCache' => '1.04_01', + 'I18N::LangTags' => '0.33', + 'I18N::LangTags::Detect'=> '1.03', + 'List::Util' => '1.14', + 'Locale::Constants' => '2.07', + 'Locale::Country' => '2.07', + 'Locale::Currency' => '2.07', + 'Locale::Language' => '2.07', + 'Locale::Maketext' => '1.09', + 'Locale::Script' => '2.07', + 'Net::Cmd' => '2.26', + 'Net::FTP' => '2.75', + 'Net::NNTP' => '2.23', + 'Net::POP3' => '2.28', + 'Net::SMTP' => '2.29', + 'Net::Time' => '2.10', + 'Pod::Checker' => '1.42', + 'Pod::Find' => '0.2401', + 'Pod::LaTeX' => '0.56', + 'Pod::ParseUtils' => '1.2', + 'Pod::Perldoc' => '3.13', + 'Safe' => '2.11', + 'Scalar::Util' => '1.14', + 'Shell' => '0.6', + 'Storable' => '2.13', + 'Term::Cap' => '1.09', + 'Test' => '1.25', + 'Test::Harness' => '2.42', + 'Text::ParseWords' => '3.22', + 'Text::Wrap' => '2001.09292', + 'Time::Local' => '1.10', + 'Unicode::Collate' => '0.40', + 'Unicode::Normalize' => '0.30', + 'XS::APItest' => '0.04', + 'autouse' => '1.04', + 'base' => '2.06', + 'charnames' => '1.04', + 'diagnostics' => '1.13', + 'encoding' => '2.00', + 'threads' => '1.05', + 'utf8' => '1.04', + }, + removed => { + } + }, + 5.008006 => { + delta_from => 5.008005, + changed => { + 'B' => '1.07', + 'B::C' => '1.04', + 'B::Concise' => '0.64', + 'B::Debug' => '1.02', + 'B::Deparse' => '0.69', + 'B::Lint' => '1.03', + 'B::Showlex' => '1.02', + 'Cwd' => '3.01', + 'DB_File' => '1.810', + 'Data::Dumper' => '2.121_02', + 'Devel::PPPort' => '3.03', + 'Devel::Peek' => '1.02', + 'Encode' => '2.08', + 'Encode::Alias' => '2.02', + 'Encode::Encoding' => '2.02', + 'Encode::JP' => '2.01', + 'Encode::Unicode' => '2.02', + 'Exporter::Heavy' => '5.58', + 'ExtUtils::Constant' => '0.1401', + 'File::Spec' => '3.01', + 'File::Spec::Win32' => '1.5', + 'I18N::LangTags' => '0.35', + 'I18N::LangTags::List' => '0.35', + 'MIME::Base64' => '3.05', + 'MIME::QuotedPrint' => '3.03', + 'Math::BigFloat' => '1.47', + 'Math::BigInt' => '1.73', + 'Math::BigInt::Calc' => '0.43', + 'Math::BigRat' => '0.13', + 'Text::ParseWords' => '3.23', + 'Time::HiRes' => '1.65', + 'XS::APItest' => '0.05', + 'diagnostics' => '1.14', + 'encoding' => '2.01', + 'open' => '1.04', + 'overload' => '1.02', + }, + removed => { + } + }, + 5.008007 => { + delta_from => 5.008006, + changed => { + 'B' => '1.09', + 'B::Concise' => '0.65', + 'B::Deparse' => '0.7', + 'B::Disassembler' => '1.04', + 'B::Terse' => '1.03', + 'Benchmark' => '1.07', + 'CGI' => '3.10', + 'CGI::Carp' => '1.29', + 'CGI::Cookie' => '1.25', + 'Carp' => '1.04', + 'Carp::Heavy' => '1.04', + 'Class::ISA' => '0.33', + 'Cwd' => '3.05', + 'DB_File' => '1.811', + 'Data::Dumper' => '2.121_04', + 'Devel::DProf' => '20050310.00', + 'Devel::PPPort' => '3.06', + 'Digest' => '1.10', + 'Digest::file' => '0.01', + 'Encode' => '2.10', + 'Encode::Alias' => '2.03', + 'Errno' => '1.09_01', + 'ExtUtils::Constant' => '0.16', + 'ExtUtils::Constant::Base'=> '0.01', + 'ExtUtils::Constant::Utils'=> '0.01', + 'ExtUtils::Constant::XS'=> '0.01', + 'File::Find' => '1.09', + 'File::Glob' => '1.04', + 'File::Path' => '1.07', + 'File::Spec' => '3.05', + 'File::Temp' => '0.16', + 'FileCache' => '1.05', + 'IO::File' => '1.11', + 'IO::Socket::INET' => '1.28', + 'Math::BigFloat' => '1.51', + 'Math::BigInt' => '1.77', + 'Math::BigInt::Calc' => '0.47', + 'Math::BigInt::CalcEmu' => '0.05', + 'Math::BigRat' => '0.15', + 'Pod::Find' => '1.3', + 'Pod::Html' => '1.0503', + 'Pod::InputObjects' => '1.3', + 'Pod::LaTeX' => '0.58', + 'Pod::ParseUtils' => '1.3', + 'Pod::Parser' => '1.3', + 'Pod::Perldoc' => '3.14', + 'Pod::Select' => '1.3', + 'Pod::Usage' => '1.3', + 'SelectSaver' => '1.01', + 'Symbol' => '1.06', + 'Sys::Syslog' => '0.06', + 'Term::ANSIColor' => '1.09', + 'Term::Complete' => '1.402', + 'Test::Builder' => '0.22', + 'Test::Harness' => '2.48', + 'Test::Harness::Point' => '0.01', + 'Test::Harness::Straps' => '0.23', + 'Test::More' => '0.54', + 'Test::Simple' => '0.54', + 'Text::ParseWords' => '3.24', + 'Text::Wrap' => '2001.09293', + 'Tie::RefHash' => '1.32', + 'Time::HiRes' => '1.66', + 'Time::Local' => '1.11', + 'Unicode' => '4.1.0', + 'Unicode::Normalize' => '0.32', + 'Unicode::UCD' => '0.23', + 'Win32' => '0.24', + 'XS::APItest' => '0.06', + 'base' => '2.07', + 'bigint' => '0.07', + 'bignum' => '0.17', + 'bigrat' => '0.08', + 'bytes' => '1.02', + 'constant' => '1.05', + 'overload' => '1.03', + 'threads::shared' => '0.93', + 'utf8' => '1.05', + }, + removed => { + 'JNI' => 1, + 'JPL::AutoLoader' => 1, + 'JPL::Class' => 1, + 'JPL::Compile' => 1, + } + }, + 5.008008 => { + delta_from => 5.008007, + changed => { + 'Attribute::Handlers' => '0.78_02', + 'B' => '1.09_01', + 'B::Bblock' => '1.02_01', + 'B::Bytecode' => '1.01_01', + 'B::C' => '1.04_01', + 'B::CC' => '1.00_01', + 'B::Concise' => '0.66', + 'B::Debug' => '1.02_01', + 'B::Deparse' => '0.71', + 'B::Disassembler' => '1.05', + 'B::Terse' => '1.03_01', + 'ByteLoader' => '0.06', + 'CGI' => '3.15', + 'CGI::Cookie' => '1.26', + 'CPAN' => '1.76_02', + 'Cwd' => '3.12', + 'DB' => '1.01', + 'DB_File' => '1.814', + 'Data::Dumper' => '2.121_08', + 'Devel::DProf' => '20050603.00', + 'Devel::PPPort' => '3.06_01', + 'Devel::Peek' => '1.03', + 'Digest' => '1.14', + 'Digest::MD5' => '2.36', + 'Digest::file' => '1.00', + 'Dumpvalue' => '1.12', + 'Encode' => '2.12', + 'Encode::Alias' => '2.04', + 'Encode::Config' => '2.01', + 'Encode::MIME::Header' => '2.01', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.01', + 'English' => '1.02', + 'ExtUtils::Command' => '1.09', + 'ExtUtils::Command::MM' => '0.05', + 'ExtUtils::Constant' => '0.17', + 'ExtUtils::Embed' => '1.26', + 'ExtUtils::Install' => '1.33', + 'ExtUtils::Liblist::Kid'=> '1.3', + 'ExtUtils::MM' => '0.05', + 'ExtUtils::MM_AIX' => '0.03', + 'ExtUtils::MM_Any' => '0.13', + 'ExtUtils::MM_BeOS' => '1.05', + 'ExtUtils::MM_Cygwin' => '1.08', + 'ExtUtils::MM_MacOS' => '1.08', + 'ExtUtils::MM_NW5' => '2.08', + 'ExtUtils::MM_OS2' => '1.05', + 'ExtUtils::MM_QNX' => '0.02', + 'ExtUtils::MM_Unix' => '1.50', + 'ExtUtils::MM_VMS' => '5.73', + 'ExtUtils::MM_VOS' => '0.02', + 'ExtUtils::MM_Win32' => '1.12', + 'ExtUtils::MM_Win95' => '0.04', + 'ExtUtils::MakeMaker' => '6.30', + 'ExtUtils::MakeMaker::Config'=> '0.02', + 'ExtUtils::Manifest' => '1.46', + 'File::Basename' => '2.74', + 'File::Copy' => '2.09', + 'File::Find' => '1.10', + 'File::Glob' => '1.05', + 'File::Path' => '1.08', + 'File::Spec' => '3.12', + 'File::Spec::Win32' => '1.6', + 'FileCache' => '1.06', + 'Filter::Simple' => '0.82', + 'FindBin' => '1.47', + 'GDBM_File' => '1.08', + 'Getopt::Long' => '2.35', + 'IO' => '1.22', + 'IO::Dir' => '1.05', + 'IO::File' => '1.13', + 'IO::Handle' => '1.25', + 'IO::Pipe' => '1.13', + 'IO::Poll' => '0.07', + 'IO::Seekable' => '1.10', + 'IO::Select' => '1.17', + 'IO::Socket' => '1.29', + 'IO::Socket::INET' => '1.29', + 'IO::Socket::UNIX' => '1.22', + 'IPC::Open2' => '1.02', + 'IPC::Open3' => '1.02', + 'List::Util' => '1.18', + 'MIME::Base64' => '3.07', + 'MIME::QuotedPrint' => '3.07', + 'Math::Complex' => '1.35', + 'Math::Trig' => '1.03', + 'NDBM_File' => '1.06', + 'ODBM_File' => '1.06', + 'OS2::PrfDB' => '0.04', + 'OS2::Process' => '1.02', + 'OS2::REXX' => '1.03', + 'Opcode' => '1.06', + 'POSIX' => '1.09', + 'PerlIO' => '1.04', + 'PerlIO::encoding' => '0.09', + 'PerlIO::scalar' => '0.04', + 'PerlIO::via' => '0.03', + 'Pod::Checker' => '1.43', + 'Pod::Find' => '1.34', + 'Pod::Functions' => '1.03', + 'Pod::Html' => '1.0504', + 'Pod::ParseUtils' => '1.33', + 'Pod::Parser' => '1.32', + 'Pod::Usage' => '1.33', + 'SDBM_File' => '1.05', + 'Safe' => '2.12', + 'Scalar::Util' => '1.18', + 'Socket' => '1.78', + 'Storable' => '2.15', + 'Switch' => '2.10_01', + 'Sys::Syslog' => '0.13', + 'Term::ANSIColor' => '1.10', + 'Term::ReadLine' => '1.02', + 'Test::Builder' => '0.32', + 'Test::Builder::Module' => '0.02', + 'Test::Builder::Tester' => '1.02', + 'Test::Builder::Tester::Color'=> undef, + 'Test::Harness' => '2.56', + 'Test::Harness::Straps' => '0.26', + 'Test::More' => '0.62', + 'Test::Simple' => '0.62', + 'Text::Tabs' => '2005.0824', + 'Text::Wrap' => '2005.082401', + 'Tie::Hash' => '1.02', + 'Time::HiRes' => '1.86', + 'Unicode::Collate' => '0.52', + 'Unicode::UCD' => '0.24', + 'User::grent' => '1.01', + 'Win32' => '0.2601', + 'XS::APItest' => '0.08', + 'XS::Typemap' => '0.02', + 'XSLoader' => '0.06', + 'attrs' => '1.02', + 'autouse' => '1.05', + 'blib' => '1.03', + 'charnames' => '1.05', + 'diagnostics' => '1.15', + 'encoding' => '2.02', + 'if' => '0.05', + 'open' => '1.05', + 'ops' => '1.01', + 'overload' => '1.04', + 're' => '0.05', + 'threads' => '1.07', + 'threads::shared' => '0.94', + 'utf8' => '1.06', + 'vmsish' => '1.02', + 'warnings' => '1.05', + 'warnings::register' => '1.01', + }, + removed => { + } + }, + 5.008009 => { + delta_from => 5.008008, + changed => { + 'Attribute::Handlers' => '0.78_03', + 'AutoLoader' => '5.67', + 'AutoSplit' => '1.06', + 'B' => '1.19', + 'B::Asmdata' => '1.02', + 'B::Assembler' => '0.08', + 'B::C' => '1.05', + 'B::Concise' => '0.76', + 'B::Debug' => '1.05', + 'B::Deparse' => '0.87', + 'B::Lint' => '1.11', + 'B::Lint::Debug' => undef, + 'B::Terse' => '1.05', + 'Benchmark' => '1.1', + 'CGI' => '3.42', + 'CGI::Carp' => '1.30_01', + 'CGI::Cookie' => '1.29', + 'CGI::Fast' => '1.07', + 'CGI::Util' => '1.5_01', + 'CPAN' => '1.9301', + 'CPAN::Debug' => '5.5', + 'CPAN::DeferedCode' => '5.50', + 'CPAN::Distroprefs' => '6', + 'CPAN::FirstTime' => '5.5_01', + 'CPAN::HandleConfig' => '5.5', + 'CPAN::Kwalify' => '5.50', + 'CPAN::Nox' => '5.50', + 'CPAN::Queue' => '5.5', + 'CPAN::Tarzip' => '5.5', + 'CPAN::Version' => '5.5', + 'Carp' => '1.10', + 'Carp::Heavy' => '1.10', + 'Cwd' => '3.29', + 'DBM_Filter' => '0.02', + 'DBM_Filter::compress' => '0.02', + 'DBM_Filter::encode' => '0.02', + 'DBM_Filter::int32' => '0.02', + 'DBM_Filter::null' => '0.02', + 'DBM_Filter::utf8' => '0.02', + 'DB_File' => '1.817', + 'Data::Dumper' => '2.121_17', + 'Devel::DProf' => '20080331.00', + 'Devel::InnerPackage' => '0.3', + 'Devel::PPPort' => '3.14', + 'Devel::Peek' => '1.04', + 'Digest' => '1.15', + 'Digest::MD5' => '2.37', + 'DirHandle' => '1.02', + 'DynaLoader' => '1.09', + 'Encode' => '2.26', + 'Encode::Alias' => '2.10', + 'Encode::Byte' => '2.03', + 'Encode::CJKConstants' => '2.02', + 'Encode::CN' => '2.02', + 'Encode::CN::HZ' => '2.05', + 'Encode::Config' => '2.05', + 'Encode::EBCDIC' => '2.02', + 'Encode::Encoder' => '2.01', + 'Encode::Encoding' => '2.05', + 'Encode::GSM0338' => '2.01', + 'Encode::Guess' => '2.02', + 'Encode::JP' => '2.03', + 'Encode::JP::H2Z' => '2.02', + 'Encode::JP::JIS7' => '2.04', + 'Encode::KR' => '2.02', + 'Encode::KR::2022_KR' => '2.02', + 'Encode::MIME::Header' => '2.05', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.03', + 'Encode::MIME::Name' => '1.01', + 'Encode::Symbol' => '2.02', + 'Encode::TW' => '2.02', + 'Encode::Unicode' => '2.05', + 'Encode::Unicode::UTF7' => '2.04', + 'English' => '1.03', + 'Errno' => '1.10', + 'Exporter' => '5.63', + 'Exporter::Heavy' => '5.63', + 'ExtUtils::Command' => '1.15', + 'ExtUtils::Command::MM' => '6.48', + 'ExtUtils::Constant' => '0.21', + 'ExtUtils::Constant::Base'=> '0.04', + 'ExtUtils::Constant::ProxySubs'=> '0.06', + 'ExtUtils::Constant::Utils'=> '0.02', + 'ExtUtils::Constant::XS'=> '0.02', + 'ExtUtils::Embed' => '1.28', + 'ExtUtils::Install' => '1.50_01', + 'ExtUtils::Installed' => '1.43', + 'ExtUtils::Liblist' => '6.48', + 'ExtUtils::Liblist::Kid'=> '6.48', + 'ExtUtils::MM' => '6.48', + 'ExtUtils::MM_AIX' => '6.48', + 'ExtUtils::MM_Any' => '6.48', + 'ExtUtils::MM_BeOS' => '6.48', + 'ExtUtils::MM_Cygwin' => '6.48', + 'ExtUtils::MM_DOS' => '6.48', + 'ExtUtils::MM_Darwin' => '6.48', + 'ExtUtils::MM_MacOS' => '6.48', + 'ExtUtils::MM_NW5' => '6.48', + 'ExtUtils::MM_OS2' => '6.48', + 'ExtUtils::MM_QNX' => '6.48', + 'ExtUtils::MM_UWIN' => '6.48', + 'ExtUtils::MM_Unix' => '6.48', + 'ExtUtils::MM_VMS' => '6.48', + 'ExtUtils::MM_VOS' => '6.48', + 'ExtUtils::MM_Win32' => '6.48', + 'ExtUtils::MM_Win95' => '6.48', + 'ExtUtils::MY' => '6.48', + 'ExtUtils::MakeMaker' => '6.48', + 'ExtUtils::MakeMaker::Config'=> '6.48', + 'ExtUtils::MakeMaker::bytes'=> '6.48', + 'ExtUtils::MakeMaker::vmsish'=> '6.48', + 'ExtUtils::Manifest' => '1.55', + 'ExtUtils::Mkbootstrap' => '6.48', + 'ExtUtils::Mksymlists' => '6.48', + 'ExtUtils::Packlist' => '1.43', + 'ExtUtils::ParseXS' => '2.19', + 'ExtUtils::XSSymSet' => '1.1', + 'ExtUtils::testlib' => '6.48', + 'Fatal' => '1.06', + 'Fcntl' => '1.06', + 'File::Basename' => '2.77', + 'File::CheckTree' => '4.4', + 'File::Compare' => '1.1005', + 'File::Copy' => '2.13', + 'File::DosGlob' => '1.01', + 'File::Find' => '1.13', + 'File::Glob' => '1.06', + 'File::Path' => '2.07_02', + 'File::Spec' => '3.29', + 'File::Spec::Cygwin' => '3.29', + 'File::Spec::Epoc' => '3.29', + 'File::Spec::Functions' => '3.29', + 'File::Spec::Mac' => '3.29', + 'File::Spec::OS2' => '3.29', + 'File::Spec::Unix' => '3.29', + 'File::Spec::VMS' => '3.29', + 'File::Spec::Win32' => '3.29', + 'File::Temp' => '0.20', + 'File::stat' => '1.01', + 'FileCache' => '1.07', + 'Filter::Simple' => '0.83', + 'Filter::Util::Call' => '1.07', + 'FindBin' => '1.49', + 'GDBM_File' => '1.09', + 'Getopt::Long' => '2.37', + 'Getopt::Std' => '1.06', + 'Hash::Util' => '0.06', + 'IO' => '1.23', + 'IO::Dir' => '1.06', + 'IO::File' => '1.14', + 'IO::Handle' => '1.27', + 'IO::Socket' => '1.30', + 'IO::Socket::INET' => '1.31', + 'IO::Socket::UNIX' => '1.23', + 'IPC::Msg' => '2.00', + 'IPC::Open2' => '1.03', + 'IPC::Open3' => '1.03', + 'IPC::Semaphore' => '2.00', + 'IPC::SharedMem' => '2.00', + 'IPC::SysV' => '2.00', + 'List::Util' => '1.19', + 'Locale::Maketext' => '1.13', + 'Locale::Maketext::Guts'=> '1.13', + 'Locale::Maketext::GutsLoader'=> '1.13', + 'Math::BigFloat' => '1.60', + 'Math::BigInt' => '1.89', + 'Math::BigInt::Calc' => '0.52', + 'Math::BigRat' => '0.22', + 'Math::Complex' => '1.54', + 'Math::Trig' => '1.18', + 'Module::CoreList' => '2.17', + 'Module::Pluggable' => '3.8', + 'Module::Pluggable::Object'=> '3.6', + 'NDBM_File' => '1.07', + 'NEXT' => '0.61', + 'Net::Cmd' => '2.29', + 'Net::Config' => '1.11', + 'Net::Domain' => '2.20', + 'Net::FTP' => '2.77', + 'Net::FTP::A' => '1.18', + 'Net::NNTP' => '2.24', + 'Net::POP3' => '2.29', + 'Net::Ping' => '2.35', + 'Net::SMTP' => '2.31', + 'O' => '1.01', + 'ODBM_File' => '1.07', + 'OS2::DLL' => '1.03', + 'OS2::Process' => '1.03', + 'Opcode' => '1.0601', + 'POSIX' => '1.15', + 'PerlIO' => '1.05', + 'PerlIO::encoding' => '0.11', + 'PerlIO::scalar' => '0.06', + 'PerlIO::via' => '0.05', + 'Pod::Html' => '1.09', + 'Pod::ParseUtils' => '1.35', + 'Pod::Parser' => '1.35', + 'Pod::Select' => '1.35', + 'Pod::Usage' => '1.35', + 'SDBM_File' => '1.06', + 'Safe' => '2.16', + 'Scalar::Util' => '1.19', + 'SelfLoader' => '1.17', + 'Shell' => '0.72', + 'Socket' => '1.81', + 'Storable' => '2.19', + 'Switch' => '2.13', + 'Sys::Syslog' => '0.27', + 'Sys::Syslog::win32::Win32'=> undef, + 'Term::ANSIColor' => '1.12', + 'Term::Cap' => '1.12', + 'Term::ReadLine' => '1.03', + 'Test::Builder' => '0.80', + 'Test::Builder::Module' => '0.80', + 'Test::Builder::Tester' => '1.13', + 'Test::Harness' => '2.64', + 'Test::Harness::Results'=> '0.01_01', + 'Test::Harness::Straps' => '0.26_01', + 'Test::Harness::Util' => '0.01', + 'Test::More' => '0.80', + 'Test::Simple' => '0.80', + 'Text::Balanced' => '1.98', + 'Text::ParseWords' => '3.27', + 'Text::Soundex' => '3.03', + 'Text::Tabs' => '2007.1117', + 'Text::Wrap' => '2006.1117', + 'Thread' => '2.01', + 'Thread::Queue' => '2.11', + 'Thread::Semaphore' => '2.09', + 'Tie::Handle' => '4.2', + 'Tie::Hash' => '1.03', + 'Tie::Memoize' => '1.1', + 'Tie::RefHash' => '1.38', + 'Tie::Scalar' => '1.01', + 'Tie::StdHandle' => '4.2', + 'Time::HiRes' => '1.9715', + 'Time::Local' => '1.1901', + 'Time::gmtime' => '1.03', + 'Unicode' => '5.1.0', + 'Unicode::Normalize' => '1.02', + 'Unicode::UCD' => '0.25', + 'VMS::DCLsym' => '1.03', + 'VMS::Stdio' => '2.4', + 'Win32' => '0.38', + 'Win32API::File' => '0.1001_01', + 'Win32API::File::ExtUtils::Myconst2perl'=> '1', + 'Win32CORE' => '0.02', + 'XS::APItest' => '0.15', + 'XS::Typemap' => '0.03', + 'XSLoader' => '0.10', + 'attributes' => '0.09', + 'autouse' => '1.06', + 'base' => '2.13', + 'bigint' => '0.23', + 'bignum' => '0.23', + 'bigrat' => '0.23', + 'blib' => '1.04', + 'charnames' => '1.06', + 'constant' => '1.17', + 'diagnostics' => '1.16', + 'encoding' => '2.6_01', + 'fields' => '2.12', + 'filetest' => '1.02', + 'lib' => '0.61', + 'open' => '1.06', + 'ops' => '1.02', + 'overload' => '1.06', + 're' => '0.0601', + 'sigtrap' => '1.04', + 'threads' => '1.71', + 'threads::shared' => '1.27', + 'utf8' => '1.07', + 'warnings' => '1.05_01', + }, + removed => { + } + }, + 5.009 => { + delta_from => 5.008002, + changed => { + 'B' => '1.03', + 'B::C' => '1.03', + 'B::Concise' => '0.57', + 'B::Deparse' => '0.65', + 'DB_File' => '1.806', + 'Devel::PPPort' => '2.008', + 'English' => '1.02', + 'Fatal' => '1.04', + 'OS2::DLL' => '1.02', + 'Opcode' => '1.06', + 'Time::HiRes' => '1.51', + 'Unicode::Collate' => '0.28', + 'Unicode::Normalize' => '0.23', + 'XSLoader' => '0.03', + 'assertions' => '0.01', + 'assertions::activate' => '0.01', + 'overload' => '1.02', + 'version' => '0.29', + }, + removed => { + } + }, + 5.009001 => { + delta_from => 5.008004, + changed => { + 'B' => '1.05', + 'B::Assembler' => '0.06', + 'B::C' => '1.04', + 'B::Concise' => '0.59', + 'B::Debug' => '1.02', + 'B::Deparse' => '0.65', + 'DB_File' => '1.808_01', + 'Devel::PPPort' => '2.011_01', + 'Digest' => '1.05', + 'DynaLoader' => '1.04', + 'English' => '1.02', + 'Exporter::Heavy' => '5.567', + 'ExtUtils::Command' => '1.07', + 'ExtUtils::Liblist::Kid'=> '1.3', + 'ExtUtils::MM_Any' => '0.0901', + 'ExtUtils::MM_Cygwin' => '1.07', + 'ExtUtils::MM_NW5' => '2.07_01', + 'ExtUtils::MM_Unix' => '1.45_01', + 'ExtUtils::MM_VMS' => '5.71_01', + 'ExtUtils::MM_Win32' => '1.10_01', + 'ExtUtils::MM_Win95' => '0.03', + 'ExtUtils::MakeMaker' => '6.21_02', + 'ExtUtils::Manifest' => '1.43', + 'Fatal' => '1.04', + 'Getopt::Long' => '2.3401', + 'IO::Handle' => '1.23', + 'IO::Pipe' => '1.122', + 'IPC::Open3' => '1.0105', + 'MIME::Base64' => '3.00_01', + 'MIME::QuotedPrint' => '3.00', + 'Memoize' => '1.01_01', + 'ODBM_File' => '1.04', + 'Opcode' => '1.06', + 'POSIX' => '1.07', + 'Storable' => '2.11', + 'Time::HiRes' => '1.56', + 'Time::Local' => '1.07_94', + 'UNIVERSAL' => '1.02', + 'Unicode' => '4.0.0', + 'Unicode::UCD' => '0.21', + 'XSLoader' => '0.03', + 'assertions' => '0.01', + 'assertions::activate' => '0.01', + 'base' => '2.04', + 'if' => '0.0401', + 'open' => '1.02', + 'overload' => '1.02', + 'threads' => '1.02', + 'utf8' => '1.02', + 'version' => '0.36', + }, + removed => { + } + }, + 5.009002 => { + delta_from => 5.008007, + changed => { + 'B' => '1.07', + 'B::Concise' => '0.64', + 'B::Deparse' => '0.69', + 'B::Disassembler' => '1.03', + 'B::Terse' => '1.02', + 'CGI' => '3.07', + 'Config::Extensions' => '0.01', + 'Devel::DProf' => '20030813.00', + 'DynaLoader' => '1.07', + 'Encode' => '2.09', + 'Encode::Alias' => '2.02', + 'English' => '1.03', + 'Exporter' => '5.59', + 'Exporter::Heavy' => '5.59', + 'ExtUtils::Command' => '1.07', + 'ExtUtils::Command::MM' => '0.03_01', + 'ExtUtils::Embed' => '1.26', + 'ExtUtils::Liblist::Kid'=> '1.3', + 'ExtUtils::MM_Any' => '0.10', + 'ExtUtils::MM_Cygwin' => '1.07', + 'ExtUtils::MM_MacOS' => '1.08', + 'ExtUtils::MM_NW5' => '2.07', + 'ExtUtils::MM_Unix' => '1.46_01', + 'ExtUtils::MM_VMS' => '5.71', + 'ExtUtils::MM_Win32' => '1.10', + 'ExtUtils::MM_Win95' => '0.03', + 'ExtUtils::MakeMaker' => '6.25', + 'ExtUtils::Manifest' => '1.44', + 'Fatal' => '1.04', + 'File::Path' => '1.06', + 'FileCache' => '1.04_01', + 'Getopt::Long' => '2.3401', + 'IO::File' => '1.10', + 'IO::Socket::INET' => '1.27', + 'Math::BigFloat' => '1.49', + 'Math::BigInt' => '1.75', + 'Math::BigInt::Calc' => '0.45', + 'Math::BigRat' => '0.14', + 'Memoize' => '1.01_01', + 'Module::CoreList' => '1.99', + 'NEXT' => '0.60_01', + 'Opcode' => '1.06', + 'Pod::Html' => '1.0502', + 'Scalar::Util' => '1.14_1', + 'Storable' => '2.14', + 'Symbol' => '1.05', + 'Test::Harness' => '2.46', + 'Test::Harness::Straps' => '0.20_01', + 'Text::Balanced' => '1.95_01', + 'Text::Wrap' => '2001.09292', + 'UNIVERSAL' => '1.02', + 'Unicode' => '4.0.1', + 'Unicode::Normalize' => '0.30', + 'Unicode::UCD' => '0.22', + 'Win32' => '0.23', + 'XS::APItest' => '0.05', + 'XSLoader' => '0.03', + 'assertions' => '0.01', + 'assertions::activate' => '0.01', + 'base' => '2.06', + 'bigint' => '0.06', + 'bignum' => '0.16', + 'bigrat' => '0.07', + 'bytes' => '1.01', + 'encoding::warnings' => '0.05', + 'if' => '0.0401', + 're' => '0.05', + 'threads::shared' => '0.92', + 'utf8' => '1.04', + 'version' => '0.42', + 'warnings' => '1.04', + }, + removed => { + 'Test::Harness::Point' => 1, + } + }, + 5.009003 => { + delta_from => 5.008008, + changed => { + 'Archive::Tar' => '1.26_01', + 'Archive::Tar::Constant'=> '0.02', + 'Archive::Tar::File' => '0.02', + 'AutoSplit' => '1.04_01', + 'B' => '1.10', + 'B::Bblock' => '1.02', + 'B::Bytecode' => '1.01', + 'B::C' => '1.04', + 'B::CC' => '1.00', + 'B::Concise' => '0.67', + 'B::Debug' => '1.02', + 'B::Deparse' => '0.73', + 'B::Lint' => '1.04', + 'B::Terse' => '1.03', + 'CGI' => '3.15_01', + 'CPAN' => '1.83_58', + 'CPAN::Debug' => '4.44', + 'CPAN::FirstTime' => '4.50', + 'CPAN::HandleConfig' => '4.31', + 'CPAN::Nox' => '2.31', + 'CPAN::Tarzip' => '3.36', + 'CPAN::Version' => '2.55', + 'Carp' => '1.05', + 'Carp::Heavy' => '1.05', + 'Compress::Zlib' => '2.000_07', + 'Compress::Zlib::Common'=> '2.000_07', + 'Compress::Zlib::Compress::Gzip::Constants'=> '2.000_07', + 'Compress::Zlib::Compress::Zip::Constants'=> '1.00', + 'Compress::Zlib::CompressPlugin::Deflate'=> '2.000_05', + 'Compress::Zlib::CompressPlugin::Identity'=> '2.000_05', + 'Compress::Zlib::File::GlobMapper'=> '0.000_02', + 'Compress::Zlib::FileConstants'=> '2.000_07', + 'Compress::Zlib::IO::Compress::Base'=> '2.000_05', + 'Compress::Zlib::IO::Compress::Deflate'=> '2.000_07', + 'Compress::Zlib::IO::Compress::Gzip'=> '2.000_07', + 'Compress::Zlib::IO::Compress::RawDeflate'=> '2.000_07', + 'Compress::Zlib::IO::Compress::Zip'=> '2.000_04', + 'Compress::Zlib::IO::Uncompress::AnyInflate'=> '2.000_07', + 'Compress::Zlib::IO::Uncompress::AnyUncompress'=> '2.000_05', + 'Compress::Zlib::IO::Uncompress::Base'=> '2.000_05', + 'Compress::Zlib::IO::Uncompress::Gunzip'=> '2.000_07', + 'Compress::Zlib::IO::Uncompress::Inflate'=> '2.000_07', + 'Compress::Zlib::IO::Uncompress::RawInflate'=> '2.000_07', + 'Compress::Zlib::IO::Uncompress::Unzip'=> '2.000_05', + 'Compress::Zlib::ParseParameters'=> '2.000_07', + 'Compress::Zlib::UncompressPlugin::Identity'=> '2.000_05', + 'Compress::Zlib::UncompressPlugin::Inflate'=> '2.000_05', + 'Config::Extensions' => '0.01', + 'Cwd' => '3.15', + 'Devel::PPPort' => '3.08', + 'Digest::SHA' => '5.32', + 'DirHandle' => '1.01', + 'DynaLoader' => '1.07', + 'Encode' => '2.14', + 'Encode::CN::HZ' => '2.02', + 'Encode::MIME::Header' => '2.02', + 'English' => '1.04', + 'Exporter' => '5.59', + 'Exporter::Heavy' => '5.59', + 'ExtUtils::CBuilder' => '0.15', + 'ExtUtils::CBuilder::Base'=> '0.12', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.12', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.12', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.12', + 'ExtUtils::CBuilder::Platform::aix'=> '0.12', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.12', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.12', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.01', + 'ExtUtils::CBuilder::Platform::os2'=> '0.13', + 'ExtUtils::Command::MM' => '0.05_01', + 'ExtUtils::Constant' => '0.2', + 'ExtUtils::Constant::Base'=> '0.02', + 'ExtUtils::Constant::ProxySubs'=> '0.01', + 'ExtUtils::Constant::XS'=> '0.02', + 'ExtUtils::MM_Any' => '0.13_01', + 'ExtUtils::MM_Unix' => '1.50_01', + 'ExtUtils::MakeMaker' => '6.30_01', + 'ExtUtils::ParseXS' => '2.15_02', + 'Fatal' => '1.04', + 'File::Compare' => '1.1005', + 'File::Spec' => '3.15', + 'File::Temp' => '0.16_01', + 'IO::File' => '1.13_01', + 'IO::Handle' => '1.26', + 'IO::Socket' => '1.29_01', + 'IO::Socket::INET' => '1.29_02', + 'IO::Socket::UNIX' => '1.22_01', + 'IO::Zlib' => '1.04_02', + 'Locale::Maketext' => '1.10_01', + 'Math::BigInt::FastCalc'=> '0.10', + 'Memoize' => '1.01_01', + 'Module::CoreList' => '2.02', + 'Moped::Msg' => '0.01', + 'NEXT' => '0.60_01', + 'Net::Cmd' => '2.26_01', + 'Net::Domain' => '2.19_01', + 'Net::Ping' => '2.31_04', + 'Opcode' => '1.08', + 'POSIX' => '1.10', + 'Pod::Escapes' => '1.04', + 'Pod::Man' => '2.04', + 'Pod::Perldoc' => '3.14_01', + 'Pod::Simple' => '3.04', + 'Pod::Simple::BlackBox' => undef, + 'Pod::Simple::Checker' => '2.02', + 'Pod::Simple::Debug' => undef, + 'Pod::Simple::DumpAsText'=> '2.02', + 'Pod::Simple::DumpAsXML'=> '2.02', + 'Pod::Simple::HTML' => '3.03', + 'Pod::Simple::HTMLBatch'=> '3.02', + 'Pod::Simple::HTMLLegacy'=> '5.01', + 'Pod::Simple::LinkSection'=> undef, + 'Pod::Simple::Methody' => '2.02', + 'Pod::Simple::Progress' => '1.01', + 'Pod::Simple::PullParser'=> '2.02', + 'Pod::Simple::PullParserEndToken'=> undef, + 'Pod::Simple::PullParserStartToken'=> undef, + 'Pod::Simple::PullParserTextToken'=> undef, + 'Pod::Simple::PullParserToken'=> '2.02', + 'Pod::Simple::RTF' => '2.02', + 'Pod::Simple::Search' => '3.04', + 'Pod::Simple::SimpleTree'=> '2.02', + 'Pod::Simple::Text' => '2.02', + 'Pod::Simple::TextContent'=> '2.02', + 'Pod::Simple::TiedOutFH'=> undef, + 'Pod::Simple::Transcode'=> undef, + 'Pod::Simple::TranscodeDumb'=> '2.02', + 'Pod::Simple::TranscodeSmart'=> undef, + 'Pod::Simple::XMLOutStream'=> '2.02', + 'Pod::Text' => '3.01', + 'Pod::Text::Color' => '2.01', + 'Pod::Text::Overstrike' => '2', + 'Pod::Text::Termcap' => '2.01', + 'Pod::Usage' => '1.33_01', + 'SelfLoader' => '1.0905', + 'Storable' => '2.15_02', + 'Test::Builder::Module' => '0.03', + 'Text::Balanced' => '1.95_01', + 'Tie::File' => '0.97_01', + 'UNIVERSAL' => '1.03', + 'XS::APItest' => '0.09', + 'assertions' => '0.02', + 'assertions::activate' => '0.02', + 'assertions::compat' => undef, + 'constant' => '1.07', + 'encoding::warnings' => '0.05', + 'feature' => '1.00', + 're' => '0.06', + 'sort' => '2.00', + 'version' => '0.53', + }, + removed => { + } + }, + 5.009004 => { + delta_from => 5.009003, + changed => { + 'Archive::Tar' => '1.30_01', + 'AutoLoader' => '5.61', + 'B' => '1.11', + 'B::Bytecode' => '1.02', + 'B::C' => '1.05', + 'B::Concise' => '0.69', + 'B::Deparse' => '0.76', + 'B::Lint' => '1.08', + 'Benchmark' => '1.08', + 'CGI' => '3.20', + 'CGI::Cookie' => '1.27', + 'CGI::Fast' => '1.07', + 'CPAN' => '1.87_55', + 'CPAN::Debug' => '5.400561', + 'CPAN::FirstTime' => '5.400742', + 'CPAN::HandleConfig' => '5.400740', + 'CPAN::Nox' => '5.400561', + 'CPAN::Tarzip' => '5.400714', + 'CPAN::Version' => '5.400561', + 'Compress::Raw::Zlib' => '2.000_13', + 'Compress::Zlib' => '2.000_13', + 'Cwd' => '3.19', + 'Devel::PPPort' => '3.10', + 'Digest' => '1.15', + 'Digest::SHA' => '5.43', + 'Encode' => '2.18_01', + 'Encode::Alias' => '2.06', + 'Encode::Byte' => '2.02', + 'Encode::CJKConstants' => '2.02', + 'Encode::CN' => '2.02', + 'Encode::CN::HZ' => '2.04', + 'Encode::Config' => '2.03', + 'Encode::EBCDIC' => '2.02', + 'Encode::Encoder' => '2.01', + 'Encode::Encoding' => '2.04', + 'Encode::Guess' => '2.02', + 'Encode::JP' => '2.03', + 'Encode::JP::H2Z' => '2.02', + 'Encode::JP::JIS7' => '2.02', + 'Encode::KR' => '2.02', + 'Encode::KR::2022_KR' => '2.02', + 'Encode::MIME::Header' => '2.04', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.03', + 'Encode::Symbol' => '2.02', + 'Encode::TW' => '2.02', + 'Encode::Unicode' => '2.03', + 'Encode::Unicode::UTF7' => '2.04', + 'ExtUtils::CBuilder' => '0.18', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.12_01', + 'ExtUtils::Constant::Base'=> '0.03', + 'ExtUtils::Constant::ProxySubs'=> '0.03', + 'ExtUtils::Install' => '1.41', + 'ExtUtils::Installed' => '1.41', + 'ExtUtils::MM_Any' => '0.13_02', + 'ExtUtils::MM_NW5' => '2.08_01', + 'ExtUtils::MM_Unix' => '1.5003', + 'ExtUtils::MM_VMS' => '5.73_03', + 'ExtUtils::MM_Win32' => '1.12_02', + 'ExtUtils::MM_Win95' => '0.04_01', + 'ExtUtils::MakeMaker' => '6.30_02', + 'ExtUtils::Manifest' => '1.46_01', + 'ExtUtils::Mkbootstrap' => '1.15_01', + 'ExtUtils::Mksymlists' => '1.19_01', + 'ExtUtils::Packlist' => '1.41', + 'File::Basename' => '2.75', + 'File::Find' => '1.11', + 'File::GlobMapper' => '0.000_02', + 'File::Spec' => '3.19', + 'FileCache' => '1.07', + 'Getopt::Long' => '2.3501', + 'Hash::Util' => '0.07', + 'Hash::Util::FieldHash' => '0.01', + 'IO' => '1.23_01', + 'IO::Compress::Adapter::Deflate'=> '2.000_13', + 'IO::Compress::Adapter::Identity'=> '2.000_13', + 'IO::Compress::Base' => '2.000_13', + 'IO::Compress::Base::Common'=> '2.000_13', + 'IO::Compress::Deflate' => '2.000_13', + 'IO::Compress::Gzip' => '2.000_13', + 'IO::Compress::Gzip::Constants'=> '2.000_13', + 'IO::Compress::RawDeflate'=> '2.000_13', + 'IO::Compress::Zip' => '2.000_13', + 'IO::Compress::Zip::Constants'=> '2.000_13', + 'IO::Compress::Zlib::Constants'=> '2.000_13', + 'IO::Compress::Zlib::Extra'=> '2.000_13', + 'IO::Dir' => '1.06', + 'IO::File' => '1.14', + 'IO::Handle' => '1.27', + 'IO::Socket' => '1.30_01', + 'IO::Socket::INET' => '1.31', + 'IO::Socket::UNIX' => '1.23', + 'IO::Uncompress::Adapter::Identity'=> '2.000_13', + 'IO::Uncompress::Adapter::Inflate'=> '2.000_13', + 'IO::Uncompress::AnyInflate'=> '2.000_13', + 'IO::Uncompress::AnyUncompress'=> '2.000_13', + 'IO::Uncompress::Base' => '2.000_13', + 'IO::Uncompress::Gunzip'=> '2.000_13', + 'IO::Uncompress::Inflate'=> '2.000_13', + 'IO::Uncompress::RawInflate'=> '2.000_13', + 'IO::Uncompress::Unzip' => '2.000_13', + 'MIME::Base64' => '3.07_01', + 'Math::Complex' => '1.36', + 'Math::Trig' => '1.04', + 'Module::Build' => '0.2805', + 'Module::Build::Base' => undef, + 'Module::Build::Compat' => '0.03', + 'Module::Build::ConfigData'=> undef, + 'Module::Build::Cookbook'=> undef, + 'Module::Build::ModuleInfo'=> undef, + 'Module::Build::Notes' => undef, + 'Module::Build::PPMMaker'=> undef, + 'Module::Build::Platform::Amiga'=> undef, + 'Module::Build::Platform::Default'=> undef, + 'Module::Build::Platform::EBCDIC'=> undef, + 'Module::Build::Platform::MPEiX'=> undef, + 'Module::Build::Platform::MacOS'=> undef, + 'Module::Build::Platform::RiscOS'=> undef, + 'Module::Build::Platform::Unix'=> undef, + 'Module::Build::Platform::VMS'=> undef, + 'Module::Build::Platform::VOS'=> undef, + 'Module::Build::Platform::Windows'=> undef, + 'Module::Build::Platform::aix'=> undef, + 'Module::Build::Platform::cygwin'=> undef, + 'Module::Build::Platform::darwin'=> undef, + 'Module::Build::Platform::os2'=> undef, + 'Module::Build::PodParser'=> undef, + 'Module::Build::Version'=> '0', + 'Module::Build::YAML' => '0.50', + 'Module::CoreList' => '2.08', + 'Module::Load' => '0.10', + 'Module::Loaded' => '0.01', + 'Package::Constants' => '0.01', + 'Pod::Html' => '1.07', + 'Pod::Man' => '2.09', + 'Pod::Text' => '3.07', + 'Pod::Text::Color' => '2.03', + 'Pod::Text::Termcap' => '2.03', + 'SDBM_File' => '1.06', + 'Shell' => '0.7', + 'Sys::Syslog' => '0.17', + 'Term::ANSIColor' => '1.11', + 'Test::Builder' => '0.33', + 'Test::Builder::Tester' => '1.04', + 'Test::Harness' => '2.62', + 'Test::Harness::Util' => '0.01', + 'Test::More' => '0.64', + 'Test::Simple' => '0.64', + 'Text::Balanced' => '1.98_01', + 'Text::ParseWords' => '3.25', + 'Text::Tabs' => '2007.071101', + 'Text::Wrap' => '2006.0711', + 'Tie::RefHash' => '1.34_01', + 'Time::HiRes' => '1.87', + 'Time::Local' => '1.13', + 'Time::gmtime' => '1.03', + 'UNIVERSAL' => '1.04', + 'Unicode::Normalize' => '1.01', + 'Win32API::File' => '0.1001', + 'Win32API::File::ExtUtils::Myconst2perl'=> '1', + 'assertions' => '0.03', + 'assertions::compat' => '0.02', + 'autouse' => '1.06', + 'diagnostics' => '1.16', + 'encoding' => '2.04', + 'encoding::warnings' => '0.10', + 'feature' => '1.01', + 're' => '0.0601', + 'threads' => '1.38', + 'threads::shared' => '0.94_01', + 'version' => '0.67', + }, + removed => { + 'Compress::Zlib::Common'=> 1, + 'Compress::Zlib::Compress::Gzip::Constants'=> 1, + 'Compress::Zlib::Compress::Zip::Constants'=> 1, + 'Compress::Zlib::CompressPlugin::Deflate'=> 1, + 'Compress::Zlib::CompressPlugin::Identity'=> 1, + 'Compress::Zlib::File::GlobMapper'=> 1, + 'Compress::Zlib::FileConstants'=> 1, + 'Compress::Zlib::IO::Compress::Base'=> 1, + 'Compress::Zlib::IO::Compress::Deflate'=> 1, + 'Compress::Zlib::IO::Compress::Gzip'=> 1, + 'Compress::Zlib::IO::Compress::RawDeflate'=> 1, + 'Compress::Zlib::IO::Compress::Zip'=> 1, + 'Compress::Zlib::IO::Uncompress::AnyInflate'=> 1, + 'Compress::Zlib::IO::Uncompress::AnyUncompress'=> 1, + 'Compress::Zlib::IO::Uncompress::Base'=> 1, + 'Compress::Zlib::IO::Uncompress::Gunzip'=> 1, + 'Compress::Zlib::IO::Uncompress::Inflate'=> 1, + 'Compress::Zlib::IO::Uncompress::RawInflate'=> 1, + 'Compress::Zlib::IO::Uncompress::Unzip'=> 1, + 'Compress::Zlib::ParseParameters'=> 1, + 'Compress::Zlib::UncompressPlugin::Identity'=> 1, + 'Compress::Zlib::UncompressPlugin::Inflate'=> 1, + } + }, + 5.009005 => { + delta_from => 5.009004, + changed => { + 'Archive::Extract' => '0.22_01', + 'Archive::Tar' => '1.32', + 'Attribute::Handlers' => '0.78_06', + 'AutoLoader' => '5.63', + 'AutoSplit' => '1.05', + 'B' => '1.16', + 'B::Concise' => '0.72', + 'B::Debug' => '1.05', + 'B::Deparse' => '0.82', + 'B::Lint' => '1.09', + 'B::Terse' => '1.05', + 'Benchmark' => '1.1', + 'CGI' => '3.29', + 'CGI::Cookie' => '1.28', + 'CGI::Util' => '1.5_01', + 'CPAN' => '1.9102', + 'CPAN::Debug' => '5.400955', + 'CPAN::FirstTime' => '5.401669', + 'CPAN::HandleConfig' => '5.401744', + 'CPAN::Kwalify' => '5.401418', + 'CPAN::Nox' => '5.400844', + 'CPAN::Queue' => '5.401704', + 'CPAN::Tarzip' => '5.401717', + 'CPAN::Version' => '5.401387', + 'CPANPLUS' => '0.81_01', + 'CPANPLUS::Backend' => undef, + 'CPANPLUS::Backend::RV' => undef, + 'CPANPLUS::Config' => undef, + 'CPANPLUS::Configure' => undef, + 'CPANPLUS::Configure::Setup'=> undef, + 'CPANPLUS::Dist' => undef, + 'CPANPLUS::Dist::Base' => '0.01', + 'CPANPLUS::Dist::Build' => '0.06_01', + 'CPANPLUS::Dist::Build::Constants'=> '0.01', + 'CPANPLUS::Dist::MM' => undef, + 'CPANPLUS::Dist::Sample'=> undef, + 'CPANPLUS::Error' => undef, + 'CPANPLUS::Internals' => '0.81_01', + 'CPANPLUS::Internals::Constants'=> '0.01', + 'CPANPLUS::Internals::Constants::Report'=> '0.01', + 'CPANPLUS::Internals::Extract'=> undef, + 'CPANPLUS::Internals::Fetch'=> undef, + 'CPANPLUS::Internals::Report'=> undef, + 'CPANPLUS::Internals::Search'=> undef, + 'CPANPLUS::Internals::Source'=> undef, + 'CPANPLUS::Internals::Utils'=> undef, + 'CPANPLUS::Internals::Utils::Autoflush'=> undef, + 'CPANPLUS::Module' => undef, + 'CPANPLUS::Module::Author'=> undef, + 'CPANPLUS::Module::Author::Fake'=> undef, + 'CPANPLUS::Module::Checksums'=> undef, + 'CPANPLUS::Module::Fake'=> undef, + 'CPANPLUS::Module::Signature'=> undef, + 'CPANPLUS::Selfupdate' => undef, + 'CPANPLUS::Shell' => undef, + 'CPANPLUS::Shell::Classic'=> '0.0562', + 'CPANPLUS::Shell::Default'=> '0.81_01', + 'CPANPLUS::Shell::Default::Plugins::Remote'=> undef, + 'CPANPLUS::Shell::Default::Plugins::Source'=> undef, + 'CPANPLUS::inc' => undef, + 'Carp' => '1.07', + 'Carp::Heavy' => '1.07', + 'Compress::Raw::Zlib' => '2.005', + 'Compress::Zlib' => '2.005', + 'Cwd' => '3.25', + 'DBM_Filter' => '0.02', + 'DB_File' => '1.815', + 'Data::Dumper' => '2.121_13', + 'Devel::InnerPackage' => '0.3', + 'Devel::PPPort' => '3.11_01', + 'Digest::MD5' => '2.36_01', + 'Digest::SHA' => '5.44', + 'DynaLoader' => '1.08', + 'Encode' => '2.23', + 'Encode::Alias' => '2.07', + 'Encode::Byte' => '2.03', + 'Encode::Config' => '2.04', + 'Encode::Encoding' => '2.05', + 'Encode::GSM0338' => '2.00', + 'Encode::JP::JIS7' => '2.03', + 'Encode::MIME::Header' => '2.05', + 'Encode::MIME::Name' => '1.01', + 'Encode::Unicode' => '2.05', + 'Errno' => '1.10', + 'Exporter' => '5.60', + 'Exporter::Heavy' => '5.60', + 'ExtUtils::CBuilder' => '0.19', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.13', + 'ExtUtils::Command' => '1.13', + 'ExtUtils::Command::MM' => '0.07', + 'ExtUtils::Constant::Base'=> '0.04', + 'ExtUtils::Install' => '1.41_01', + 'ExtUtils::Liblist' => '1.03', + 'ExtUtils::Liblist::Kid'=> '1.33', + 'ExtUtils::MM' => '0.07', + 'ExtUtils::MM_AIX' => '0.05', + 'ExtUtils::MM_Any' => '0.15', + 'ExtUtils::MM_BeOS' => '1.07', + 'ExtUtils::MM_Cygwin' => '1.1', + 'ExtUtils::MM_DOS' => '0.04', + 'ExtUtils::MM_MacOS' => '1.1', + 'ExtUtils::MM_NW5' => '2.1', + 'ExtUtils::MM_OS2' => '1.07', + 'ExtUtils::MM_QNX' => '0.04', + 'ExtUtils::MM_UWIN' => '0.04', + 'ExtUtils::MM_Unix' => '1.54_01', + 'ExtUtils::MM_VMS' => '5.76', + 'ExtUtils::MM_VOS' => '0.04', + 'ExtUtils::MM_Win32' => '1.15', + 'ExtUtils::MM_Win95' => '0.06', + 'ExtUtils::MY' => '0.03', + 'ExtUtils::MakeMaker' => '6.36', + 'ExtUtils::MakeMaker::Config'=> '0.04', + 'ExtUtils::MakeMaker::bytes'=> '0.03', + 'ExtUtils::MakeMaker::vmsish'=> '0.03', + 'ExtUtils::Manifest' => '1.51_01', + 'ExtUtils::Mkbootstrap' => '1.17', + 'ExtUtils::Mksymlists' => '1.21', + 'ExtUtils::ParseXS' => '2.18', + 'ExtUtils::XSSymSet' => '1.1', + 'ExtUtils::testlib' => '1.17', + 'Fatal' => '1.05', + 'Fcntl' => '1.06', + 'File::Basename' => '2.76', + 'File::Copy' => '2.10', + 'File::Fetch' => '0.10', + 'File::Glob' => '1.06', + 'File::Path' => '2.01', + 'File::Spec' => '3.25', + 'File::Spec::Cygwin' => '1.1_01', + 'File::Spec::VMS' => '1.4_01', + 'File::Temp' => '0.18', + 'Filter::Util::Call' => '1.0602', + 'FindBin' => '1.49', + 'Getopt::Long' => '2.36', + 'Hash::Util::FieldHash' => '1.01', + 'IO::Compress::Adapter::Deflate'=> '2.005', + 'IO::Compress::Adapter::Identity'=> '2.005', + 'IO::Compress::Base' => '2.005', + 'IO::Compress::Base::Common'=> '2.005', + 'IO::Compress::Deflate' => '2.005', + 'IO::Compress::Gzip' => '2.005', + 'IO::Compress::Gzip::Constants'=> '2.005', + 'IO::Compress::RawDeflate'=> '2.005', + 'IO::Compress::Zip' => '2.005', + 'IO::Compress::Zip::Constants'=> '2.005', + 'IO::Compress::Zlib::Constants'=> '2.005', + 'IO::Compress::Zlib::Extra'=> '2.005', + 'IO::Uncompress::Adapter::Identity'=> '2.005', + 'IO::Uncompress::Adapter::Inflate'=> '2.005', + 'IO::Uncompress::AnyInflate'=> '2.005', + 'IO::Uncompress::AnyUncompress'=> '2.005', + 'IO::Uncompress::Base' => '2.005', + 'IO::Uncompress::Gunzip'=> '2.005', + 'IO::Uncompress::Inflate'=> '2.005', + 'IO::Uncompress::RawInflate'=> '2.005', + 'IO::Uncompress::Unzip' => '2.005', + 'IO::Zlib' => '1.05_01', + 'IPC::Cmd' => '0.36_01', + 'List::Util' => '1.19', + 'Locale::Maketext::Simple'=> '0.18', + 'Log::Message' => '0.01', + 'Log::Message::Config' => '0.01', + 'Log::Message::Handlers'=> undef, + 'Log::Message::Item' => undef, + 'Log::Message::Simple' => '0.0201', + 'Math::BigFloat' => '1.58', + 'Math::BigInt' => '1.87', + 'Math::BigInt::Calc' => '0.51', + 'Math::BigInt::FastCalc'=> '0.15_01', + 'Math::BigRat' => '0.19', + 'Math::Complex' => '1.37', + 'Memoize' => '1.01_02', + 'Module::Build' => '0.2808', + 'Module::Build::Config' => undef, + 'Module::Build::Version'=> '0.7203', + 'Module::CoreList' => '2.12', + 'Module::Load::Conditional'=> '0.16', + 'Module::Pluggable' => '3.6', + 'Module::Pluggable::Object'=> '3.6', + 'NDBM_File' => '1.07', + 'Net::Cmd' => '2.28', + 'Net::Config' => '1.11', + 'Net::Domain' => '2.20', + 'Net::FTP' => '2.77', + 'Net::FTP::A' => '1.18', + 'Net::NNTP' => '2.24', + 'Net::POP3' => '2.29', + 'Net::SMTP' => '2.31', + 'ODBM_File' => '1.07', + 'OS2::DLL' => '1.03', + 'Object::Accessor' => '0.32', + 'Opcode' => '1.09', + 'POSIX' => '1.13', + 'Params::Check' => '0.26', + 'PerlIO::encoding' => '0.10', + 'PerlIO::scalar' => '0.05', + 'PerlIO::via' => '0.04', + 'Pod::Html' => '1.08', + 'Pod::Man' => '2.12', + 'Pod::ParseUtils' => '1.35', + 'Pod::Parser' => '1.35', + 'Pod::Select' => '1.35', + 'Pod::Simple' => '3.05', + 'Pod::Text' => '3.08', + 'Pod::Usage' => '1.35', + 'Scalar::Util' => '1.19', + 'SelfLoader' => '1.11', + 'Shell' => '0.72_01', + 'Socket' => '1.79', + 'Storable' => '2.16', + 'Switch' => '2.13', + 'Sys::Syslog' => '0.18_01', + 'Term::ANSIColor' => '1.12', + 'Term::UI' => '0.14_01', + 'Term::UI::History' => undef, + 'Test::Builder' => '0.70', + 'Test::Builder::Module' => '0.68', + 'Test::Builder::Tester' => '1.07', + 'Test::Harness' => '2.64', + 'Test::Harness::Results'=> '0.01', + 'Test::More' => '0.70', + 'Test::Simple' => '0.70', + 'Text::Balanced' => '2.0.0', + 'Text::Soundex' => '3.02', + 'Text::Tabs' => '2007.1117', + 'Text::Wrap' => '2006.1117', + 'Thread' => '3.02', + 'Tie::File' => '0.97_02', + 'Tie::Hash::NamedCapture'=> '0.06', + 'Tie::Memoize' => '1.1', + 'Tie::RefHash' => '1.37', + 'Time::HiRes' => '1.9707', + 'Time::Local' => '1.17', + 'Time::Piece' => '1.11_02', + 'Time::Seconds' => undef, + 'Unicode' => '5.0.0', + 'Unicode::Normalize' => '1.02', + 'Unicode::UCD' => '0.25', + 'VMS::DCLsym' => '1.03', + 'Win32' => '0.30', + 'Win32API::File' => '0.1001_01', + 'Win32CORE' => '0.02', + 'XS::APItest' => '0.12', + 'XSLoader' => '0.08', + 'attributes' => '0.08', + 'base' => '2.12', + 'bigint' => '0.22', + 'bignum' => '0.22', + 'bigrat' => '0.22', + 'bytes' => '1.03', + 'charnames' => '1.06', + 'constant' => '1.10', + 'diagnostics' => '1.17', + 'encoding' => '2.06', + 'encoding::warnings' => '0.11', + 'feature' => '1.10', + 'fields' => '2.12', + 'less' => '0.02', + 'mro' => '1.00', + 'overload' => '1.06', + 're' => '0.08', + 'sigtrap' => '1.04', + 'sort' => '2.01', + 'strict' => '1.04', + 'threads' => '1.63', + 'threads::shared' => '1.12', + 'utf8' => '1.07', + 'version' => '0.7203', + 'warnings' => '1.06', + }, + removed => { + 'B::Asmdata' => 1, + 'B::Assembler' => 1, + 'B::Bblock' => 1, + 'B::Bytecode' => 1, + 'B::C' => 1, + 'B::CC' => 1, + 'B::Disassembler' => 1, + 'B::Stackobj' => 1, + 'B::Stash' => 1, + 'ByteLoader' => 1, + 'Thread::Signal' => 1, + 'Thread::Specific' => 1, + 'assertions' => 1, + 'assertions::activate' => 1, + 'assertions::compat' => 1, + } + }, + 5.01 => { + delta_from => 5.009005, + changed => { + 'Archive::Extract' => '0.24', + 'Archive::Tar' => '1.38', + 'Attribute::Handlers' => '0.79', + 'B' => '1.17', + 'B::Concise' => '0.74', + 'B::Deparse' => '0.83', + 'CPAN' => '1.9205', + 'CPAN::API::HOWTO' => undef, + 'CPAN::Debug' => '5.402212', + 'CPAN::DeferedCode' => '5.50', + 'CPAN::FirstTime' => '5.402229', + 'CPAN::HandleConfig' => '5.402212', + 'CPAN::Nox' => '5.402411', + 'CPAN::Queue' => '5.402212', + 'CPAN::Tarzip' => '5.402213', + 'CPAN::Version' => '5.5', + 'CPANPLUS' => '0.84', + 'CPANPLUS::Dist::Build' => '0.06_02', + 'CPANPLUS::Internals' => '0.84', + 'CPANPLUS::Shell::Default'=> '0.84', + 'CPANPLUS::Shell::Default::Plugins::CustomSource'=> undef, + 'Carp' => '1.08', + 'Carp::Heavy' => '1.08', + 'Compress::Raw::Zlib' => '2.008', + 'Compress::Zlib' => '2.008', + 'Cwd' => '3.2501', + 'DB_File' => '1.816_1', + 'Data::Dumper' => '2.121_14', + 'Devel::PPPort' => '3.13', + 'Digest::SHA' => '5.45', + 'Exporter' => '5.62', + 'Exporter::Heavy' => '5.62', + 'ExtUtils::CBuilder' => '0.21', + 'ExtUtils::CBuilder::Base'=> '0.21', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.21', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.22', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.21', + 'ExtUtils::CBuilder::Platform::aix'=> '0.21', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.21', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.21', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.21', + 'ExtUtils::CBuilder::Platform::os2'=> '0.21', + 'ExtUtils::Command::MM' => '6.42', + 'ExtUtils::Constant::ProxySubs'=> '0.05', + 'ExtUtils::Embed' => '1.27', + 'ExtUtils::Install' => '1.44', + 'ExtUtils::Installed' => '1.43', + 'ExtUtils::Liblist' => '6.42', + 'ExtUtils::Liblist::Kid'=> '6.42', + 'ExtUtils::MM' => '6.42', + 'ExtUtils::MM_AIX' => '6.42', + 'ExtUtils::MM_Any' => '6.42', + 'ExtUtils::MM_BeOS' => '6.42', + 'ExtUtils::MM_Cygwin' => '6.42', + 'ExtUtils::MM_DOS' => '6.42', + 'ExtUtils::MM_MacOS' => '6.42', + 'ExtUtils::MM_NW5' => '6.42', + 'ExtUtils::MM_OS2' => '6.42', + 'ExtUtils::MM_QNX' => '6.42', + 'ExtUtils::MM_UWIN' => '6.42', + 'ExtUtils::MM_Unix' => '6.42', + 'ExtUtils::MM_VMS' => '6.42', + 'ExtUtils::MM_VOS' => '6.42', + 'ExtUtils::MM_Win32' => '6.42', + 'ExtUtils::MM_Win95' => '6.42', + 'ExtUtils::MY' => '6.42', + 'ExtUtils::MakeMaker' => '6.42', + 'ExtUtils::MakeMaker::Config'=> '6.42', + 'ExtUtils::MakeMaker::bytes'=> '6.42', + 'ExtUtils::MakeMaker::vmsish'=> '6.42', + 'ExtUtils::Mkbootstrap' => '6.42', + 'ExtUtils::Mksymlists' => '6.42', + 'ExtUtils::Packlist' => '1.43', + 'ExtUtils::ParseXS' => '2.18_02', + 'ExtUtils::testlib' => '6.42', + 'File::Copy' => '2.11', + 'File::Fetch' => '0.14', + 'File::Find' => '1.12', + 'File::Path' => '2.04', + 'File::Spec' => '3.2501', + 'File::Spec::Cygwin' => '3.2501', + 'File::Spec::Epoc' => '3.2501', + 'File::Spec::Functions' => '3.2501', + 'File::Spec::Mac' => '3.2501', + 'File::Spec::OS2' => '3.2501', + 'File::Spec::Unix' => '3.2501', + 'File::Spec::VMS' => '3.2501', + 'File::Spec::Win32' => '3.2501', + 'Filter::Util::Call' => '1.07', + 'Getopt::Long' => '2.37', + 'Hash::Util::FieldHash' => '1.03', + 'IO::Compress::Adapter::Deflate'=> '2.008', + 'IO::Compress::Adapter::Identity'=> '2.008', + 'IO::Compress::Base' => '2.008', + 'IO::Compress::Base::Common'=> '2.008', + 'IO::Compress::Deflate' => '2.008', + 'IO::Compress::Gzip' => '2.008', + 'IO::Compress::Gzip::Constants'=> '2.008', + 'IO::Compress::RawDeflate'=> '2.008', + 'IO::Compress::Zip' => '2.008', + 'IO::Compress::Zip::Constants'=> '2.008', + 'IO::Compress::Zlib::Constants'=> '2.008', + 'IO::Compress::Zlib::Extra'=> '2.008', + 'IO::Uncompress::Adapter::Identity'=> '2.008', + 'IO::Uncompress::Adapter::Inflate'=> '2.008', + 'IO::Uncompress::AnyInflate'=> '2.008', + 'IO::Uncompress::AnyUncompress'=> '2.008', + 'IO::Uncompress::Base' => '2.008', + 'IO::Uncompress::Gunzip'=> '2.008', + 'IO::Uncompress::Inflate'=> '2.008', + 'IO::Uncompress::RawInflate'=> '2.008', + 'IO::Uncompress::Unzip' => '2.008', + 'IO::Zlib' => '1.07', + 'IPC::Cmd' => '0.40_1', + 'IPC::SysV' => '1.05', + 'Locale::Maketext' => '1.12', + 'Log::Message::Simple' => '0.04', + 'Math::BigFloat' => '1.59', + 'Math::BigInt' => '1.88', + 'Math::BigInt::Calc' => '0.52', + 'Math::BigInt::FastCalc'=> '0.16', + 'Math::BigRat' => '0.21', + 'Module::Build' => '0.2808_01', + 'Module::Build::Base' => '0.2808_01', + 'Module::Build::Compat' => '0.2808_01', + 'Module::Build::Config' => '0.2808_01', + 'Module::Build::Dumper' => undef, + 'Module::Build::ModuleInfo'=> '0.2808_01', + 'Module::Build::Notes' => '0.2808_01', + 'Module::Build::PPMMaker'=> '0.2808_01', + 'Module::Build::Platform::Amiga'=> '0.2808_01', + 'Module::Build::Platform::Default'=> '0.2808_01', + 'Module::Build::Platform::EBCDIC'=> '0.2808_01', + 'Module::Build::Platform::MPEiX'=> '0.2808_01', + 'Module::Build::Platform::MacOS'=> '0.2808_01', + 'Module::Build::Platform::RiscOS'=> '0.2808_01', + 'Module::Build::Platform::Unix'=> '0.2808_01', + 'Module::Build::Platform::VMS'=> '0.2808_01', + 'Module::Build::Platform::VOS'=> '0.2808_01', + 'Module::Build::Platform::Windows'=> '0.2808_01', + 'Module::Build::Platform::aix'=> '0.2808_01', + 'Module::Build::Platform::cygwin'=> '0.2808_01', + 'Module::Build::Platform::darwin'=> '0.2808_01', + 'Module::Build::Platform::os2'=> '0.2808_01', + 'Module::Build::PodParser'=> '0.2808_01', + 'Module::CoreList' => '2.13', + 'Module::Load' => '0.12', + 'Module::Load::Conditional'=> '0.22', + 'Net::Cmd' => '2.29', + 'Net::Ping' => '2.33', + 'Opcode' => '1.11', + 'Pod::Checker' => '1.43_01', + 'Pod::Man' => '2.16', + 'Pod::Perldoc' => '3.14_02', + 'Socket' => '1.80', + 'Storable' => '2.18', + 'Sys::Syslog' => '0.22', + 'Sys::Syslog::win32::Win32'=> undef, + 'Term::Cap' => '1.12', + 'Term::ReadLine' => '1.03', + 'Term::UI' => '0.18', + 'Test::Builder' => '0.72', + 'Test::Builder::Module' => '0.72', + 'Test::Builder::Tester' => '1.09', + 'Test::Harness::Straps' => '0.26_01', + 'Test::More' => '0.72', + 'Test::Simple' => '0.72', + 'Text::ParseWords' => '3.26', + 'Text::Soundex' => '3.03', + 'Tie::StdHandle' => undef, + 'Time::HiRes' => '1.9711', + 'Time::Local' => '1.18', + 'Time::Piece' => '1.12', + 'VMS::Filespec' => '1.12', + 'Win32' => '0.34', + 'base' => '2.13', + 'constant' => '1.13', + 'feature' => '1.11', + 'fields' => '2.13', + 'filetest' => '1.02', + 'open' => '1.06', + 'threads' => '1.67', + 'threads::shared' => '1.14', + 'version' => '0.74', + }, + removed => { + } + }, + 5.010001 => { + delta_from => 5.01, + changed => { + 'App::Prove' => '3.17', + 'App::Prove::State' => '3.17', + 'App::Prove::State::Result'=> '3.17', + 'App::Prove::State::Result::Test'=> '3.17', + 'Archive::Extract' => '0.34', + 'Archive::Tar' => '1.52', + 'Attribute::Handlers' => '0.85', + 'AutoLoader' => '5.68', + 'AutoSplit' => '1.06', + 'B' => '1.22', + 'B::Concise' => '0.76', + 'B::Debug' => '1.11', + 'B::Deparse' => '0.89', + 'B::Lint' => '1.11', + 'B::Lint::Debug' => undef, + 'B::Xref' => '1.02', + 'Benchmark' => '1.11', + 'CGI' => '3.43', + 'CGI::Carp' => '1.30_01', + 'CGI::Cookie' => '1.29', + 'CPAN' => '1.9402', + 'CPAN::Author' => '5.5', + 'CPAN::Bundle' => '5.5', + 'CPAN::CacheMgr' => '5.5', + 'CPAN::Complete' => '5.5', + 'CPAN::Debug' => '5.5', + 'CPAN::DeferredCode' => '5.50', + 'CPAN::Distribution' => '1.93', + 'CPAN::Distroprefs' => '6', + 'CPAN::Distrostatus' => '5.5', + 'CPAN::Exception::RecursiveDependency'=> '5.5', + 'CPAN::Exception::blocked_urllist'=> '1.0', + 'CPAN::Exception::yaml_not_installed'=> '5.5', + 'CPAN::FTP' => '5.5001', + 'CPAN::FTP::netrc' => '1.00', + 'CPAN::FirstTime' => '5.53', + 'CPAN::HandleConfig' => '5.5', + 'CPAN::Index' => '1.93', + 'CPAN::InfoObj' => '5.5', + 'CPAN::Kwalify' => '5.50', + 'CPAN::LWP::UserAgent' => '1.00', + 'CPAN::Module' => '5.5', + 'CPAN::Nox' => '5.50', + 'CPAN::Prompt' => '5.5', + 'CPAN::Queue' => '5.5', + 'CPAN::Shell' => '5.5', + 'CPAN::Tarzip' => '5.501', + 'CPAN::URL' => '5.5', + 'CPANPLUS' => '0.88', + 'CPANPLUS::Dist::Autobundle'=> undef, + 'CPANPLUS::Dist::Base' => undef, + 'CPANPLUS::Dist::Build' => '0.36', + 'CPANPLUS::Dist::Build::Constants'=> '0.36', + 'CPANPLUS::Internals' => '0.88', + 'CPANPLUS::Internals::Constants'=> undef, + 'CPANPLUS::Internals::Constants::Report'=> undef, + 'CPANPLUS::Internals::Source::Memory'=> undef, + 'CPANPLUS::Internals::Source::SQLite'=> undef, + 'CPANPLUS::Internals::Source::SQLite::Tie'=> undef, + 'CPANPLUS::Shell::Default'=> '0.88', + 'Carp' => '1.11', + 'Carp::Heavy' => '1.11', + 'Compress::Raw::Bzip2' => '2.020', + 'Compress::Raw::Zlib' => '2.020', + 'Compress::Zlib' => '2.020', + 'Cwd' => '3.30', + 'DB' => '1.02', + 'DBM_Filter::compress' => '0.02', + 'DBM_Filter::encode' => '0.02', + 'DBM_Filter::int32' => '0.02', + 'DBM_Filter::null' => '0.02', + 'DBM_Filter::utf8' => '0.02', + 'DB_File' => '1.820', + 'Data::Dumper' => '2.124', + 'Devel::DProf' => '20080331.00', + 'Devel::PPPort' => '3.19', + 'Devel::Peek' => '1.04', + 'Digest' => '1.16', + 'Digest::MD5' => '2.39', + 'Digest::SHA' => '5.47', + 'Digest::base' => '1.16', + 'Digest::file' => '1.16', + 'DirHandle' => '1.03', + 'Dumpvalue' => '1.13', + 'DynaLoader' => '1.10', + 'Encode' => '2.35', + 'Encode::Alias' => '2.12', + 'Encode::CN::HZ' => '2.05', + 'Encode::Config' => '2.05', + 'Encode::GSM0338' => '2.01', + 'Encode::Guess' => '2.03', + 'Encode::JP::JIS7' => '2.04', + 'Encode::MIME::Header' => '2.11', + 'Encode::Unicode' => '2.06', + 'Errno' => '1.11', + 'Exporter' => '5.63', + 'Exporter::Heavy' => '5.63', + 'ExtUtils::CBuilder' => '0.2602', + 'ExtUtils::CBuilder::Base'=> '0.2602', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.2602', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.2602', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.2602', + 'ExtUtils::CBuilder::Platform::aix'=> '0.2602', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.2602', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.2602', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.2602', + 'ExtUtils::CBuilder::Platform::os2'=> '0.2602', + 'ExtUtils::Command' => '1.16', + 'ExtUtils::Command::MM' => '6.55_02', + 'ExtUtils::Constant' => '0.22', + 'ExtUtils::Constant::ProxySubs'=> '0.06', + 'ExtUtils::Constant::Utils'=> '0.02', + 'ExtUtils::Constant::XS'=> '0.03', + 'ExtUtils::Embed' => '1.28', + 'ExtUtils::Install' => '1.54', + 'ExtUtils::Installed' => '1.999_001', + 'ExtUtils::Liblist' => '6.55_02', + 'ExtUtils::Liblist::Kid'=> '6.5502', + 'ExtUtils::MM' => '6.55_02', + 'ExtUtils::MM_AIX' => '6.55_02', + 'ExtUtils::MM_Any' => '6.55_02', + 'ExtUtils::MM_BeOS' => '6.55_02', + 'ExtUtils::MM_Cygwin' => '6.55_02', + 'ExtUtils::MM_DOS' => '6.5502', + 'ExtUtils::MM_Darwin' => '6.55_02', + 'ExtUtils::MM_MacOS' => '6.5502', + 'ExtUtils::MM_NW5' => '6.55_02', + 'ExtUtils::MM_OS2' => '6.55_02', + 'ExtUtils::MM_QNX' => '6.55_02', + 'ExtUtils::MM_UWIN' => '6.5502', + 'ExtUtils::MM_Unix' => '6.55_02', + 'ExtUtils::MM_VMS' => '6.55_02', + 'ExtUtils::MM_VOS' => '6.55_02', + 'ExtUtils::MM_Win32' => '6.55_02', + 'ExtUtils::MM_Win95' => '6.55_02', + 'ExtUtils::MY' => '6.5502', + 'ExtUtils::MakeMaker' => '6.55_02', + 'ExtUtils::MakeMaker::Config'=> '6.55_02', + 'ExtUtils::Manifest' => '1.56', + 'ExtUtils::Mkbootstrap' => '6.55_02', + 'ExtUtils::Mksymlists' => '6.55_02', + 'ExtUtils::ParseXS' => '2.2002', + 'ExtUtils::testlib' => '6.5502', + 'Fatal' => '2.06_01', + 'File::Basename' => '2.77', + 'File::CheckTree' => '4.4', + 'File::Compare' => '1.1006', + 'File::Copy' => '2.14', + 'File::DosGlob' => '1.01', + 'File::Fetch' => '0.20', + 'File::Find' => '1.14', + 'File::GlobMapper' => '1.000', + 'File::Path' => '2.07_03', + 'File::Spec' => '3.30', + 'File::Spec::Cygwin' => '3.30', + 'File::Spec::Epoc' => '3.30', + 'File::Spec::Functions' => '3.30', + 'File::Spec::Mac' => '3.30', + 'File::Spec::OS2' => '3.30', + 'File::Spec::Unix' => '3.30', + 'File::Spec::VMS' => '3.30', + 'File::Spec::Win32' => '3.30', + 'File::Temp' => '0.22', + 'File::stat' => '1.01', + 'FileCache' => '1.08', + 'FileHandle' => '2.02', + 'Filter::Simple' => '0.84', + 'Filter::Util::Call' => '1.08', + 'FindBin' => '1.50', + 'GDBM_File' => '1.09', + 'Getopt::Long' => '2.38', + 'Getopt::Std' => '1.06', + 'Hash::Util::FieldHash' => '1.04', + 'I18N::Collate' => '1.01', + 'IO' => '1.25', + 'IO::Compress::Adapter::Bzip2'=> '2.020', + 'IO::Compress::Adapter::Deflate'=> '2.020', + 'IO::Compress::Adapter::Identity'=> '2.020', + 'IO::Compress::Base' => '2.020', + 'IO::Compress::Base::Common'=> '2.020', + 'IO::Compress::Bzip2' => '2.020', + 'IO::Compress::Deflate' => '2.020', + 'IO::Compress::Gzip' => '2.020', + 'IO::Compress::Gzip::Constants'=> '2.020', + 'IO::Compress::RawDeflate'=> '2.020', + 'IO::Compress::Zip' => '2.020', + 'IO::Compress::Zip::Constants'=> '2.020', + 'IO::Compress::Zlib::Constants'=> '2.020', + 'IO::Compress::Zlib::Extra'=> '2.020', + 'IO::Dir' => '1.07', + 'IO::Handle' => '1.28', + 'IO::Socket' => '1.31', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.020', + 'IO::Uncompress::Adapter::Identity'=> '2.020', + 'IO::Uncompress::Adapter::Inflate'=> '2.020', + 'IO::Uncompress::AnyInflate'=> '2.020', + 'IO::Uncompress::AnyUncompress'=> '2.020', + 'IO::Uncompress::Base' => '2.020', + 'IO::Uncompress::Bunzip2'=> '2.020', + 'IO::Uncompress::Gunzip'=> '2.020', + 'IO::Uncompress::Inflate'=> '2.020', + 'IO::Uncompress::RawInflate'=> '2.020', + 'IO::Uncompress::Unzip' => '2.020', + 'IO::Zlib' => '1.09', + 'IPC::Cmd' => '0.46', + 'IPC::Msg' => '2.01', + 'IPC::Open2' => '1.03', + 'IPC::Open3' => '1.04', + 'IPC::Semaphore' => '2.01', + 'IPC::SharedMem' => '2.01', + 'IPC::SysV' => '2.01', + 'List::Util' => '1.21', + 'List::Util::PP' => '1.21', + 'List::Util::XS' => '1.21', + 'Locale::Maketext' => '1.13', + 'Locale::Maketext::Guts'=> '1.13', + 'Locale::Maketext::GutsLoader'=> '1.13', + 'Log::Message' => '0.02', + 'MIME::Base64' => '3.08', + 'MIME::QuotedPrint' => '3.08', + 'Math::BigFloat' => '1.60', + 'Math::BigInt' => '1.89', + 'Math::BigInt::FastCalc'=> '0.19', + 'Math::BigRat' => '0.22', + 'Math::Complex' => '1.56', + 'Math::Trig' => '1.2', + 'Memoize' => '1.01_03', + 'Module::Build' => '0.340201', + 'Module::Build::Base' => '0.340201', + 'Module::Build::Compat' => '0.340201', + 'Module::Build::Config' => '0.340201', + 'Module::Build::Cookbook'=> '0.340201', + 'Module::Build::Dumper' => '0.340201', + 'Module::Build::ModuleInfo'=> '0.340201', + 'Module::Build::Notes' => '0.340201', + 'Module::Build::PPMMaker'=> '0.340201', + 'Module::Build::Platform::Amiga'=> '0.340201', + 'Module::Build::Platform::Default'=> '0.340201', + 'Module::Build::Platform::EBCDIC'=> '0.340201', + 'Module::Build::Platform::MPEiX'=> '0.340201', + 'Module::Build::Platform::MacOS'=> '0.340201', + 'Module::Build::Platform::RiscOS'=> '0.340201', + 'Module::Build::Platform::Unix'=> '0.340201', + 'Module::Build::Platform::VMS'=> '0.340201', + 'Module::Build::Platform::VOS'=> '0.340201', + 'Module::Build::Platform::Windows'=> '0.340201', + 'Module::Build::Platform::aix'=> '0.340201', + 'Module::Build::Platform::cygwin'=> '0.340201', + 'Module::Build::Platform::darwin'=> '0.340201', + 'Module::Build::Platform::os2'=> '0.340201', + 'Module::Build::PodParser'=> '0.340201', + 'Module::Build::Version'=> '0.77', + 'Module::CoreList' => '2.18', + 'Module::Load' => '0.16', + 'Module::Load::Conditional'=> '0.30', + 'Module::Loaded' => '0.02', + 'Module::Pluggable' => '3.9', + 'Module::Pluggable::Object'=> '3.9', + 'NDBM_File' => '1.08', + 'NEXT' => '0.64', + 'Net::Ping' => '2.36', + 'O' => '1.01', + 'OS2::Process' => '1.03', + 'OS2::REXX' => '1.04', + 'Object::Accessor' => '0.34', + 'POSIX' => '1.17', + 'Package::Constants' => '0.02', + 'Parse::CPAN::Meta' => '1.39', + 'PerlIO' => '1.06', + 'PerlIO::encoding' => '0.11', + 'PerlIO::scalar' => '0.07', + 'PerlIO::via' => '0.07', + 'Pod::Checker' => '1.45', + 'Pod::Find' => '1.35', + 'Pod::Html' => '1.09', + 'Pod::InputObjects' => '1.31', + 'Pod::Man' => '2.22', + 'Pod::ParseLink' => '1.09', + 'Pod::ParseUtils' => '1.36', + 'Pod::Parser' => '1.37', + 'Pod::Perldoc' => '3.14_04', + 'Pod::PlainText' => '2.04', + 'Pod::Select' => '1.36', + 'Pod::Simple' => '3.07', + 'Pod::Simple::XHTML' => '3.04', + 'Pod::Text' => '3.13', + 'Pod::Text::Color' => '2.05', + 'Pod::Text::Overstrike' => '2.03', + 'Pod::Text::Termcap' => '2.05', + 'Pod::Usage' => '1.36', + 'Safe' => '2.18', + 'Scalar::Util' => '1.21', + 'Scalar::Util::PP' => '1.21', + 'SelectSaver' => '1.02', + 'SelfLoader' => '1.17', + 'Socket' => '1.82', + 'Storable' => '2.20', + 'Switch' => '2.14', + 'Symbol' => '1.07', + 'Sys::Syslog' => '0.27', + 'TAP::Base' => '3.17', + 'TAP::Formatter::Base' => '3.17', + 'TAP::Formatter::Color' => '3.17', + 'TAP::Formatter::Console'=> '3.17', + 'TAP::Formatter::Console::ParallelSession'=> '3.17', + 'TAP::Formatter::Console::Session'=> '3.17', + 'TAP::Formatter::File' => '3.17', + 'TAP::Formatter::File::Session'=> '3.17', + 'TAP::Formatter::Session'=> '3.17', + 'TAP::Harness' => '3.17', + 'TAP::Object' => '3.17', + 'TAP::Parser' => '3.17', + 'TAP::Parser::Aggregator'=> '3.17', + 'TAP::Parser::Grammar' => '3.17', + 'TAP::Parser::Iterator' => '3.17', + 'TAP::Parser::Iterator::Array'=> '3.17', + 'TAP::Parser::Iterator::Process'=> '3.17', + 'TAP::Parser::Iterator::Stream'=> '3.17', + 'TAP::Parser::IteratorFactory'=> '3.17', + 'TAP::Parser::Multiplexer'=> '3.17', + 'TAP::Parser::Result' => '3.17', + 'TAP::Parser::Result::Bailout'=> '3.17', + 'TAP::Parser::Result::Comment'=> '3.17', + 'TAP::Parser::Result::Plan'=> '3.17', + 'TAP::Parser::Result::Pragma'=> '3.17', + 'TAP::Parser::Result::Test'=> '3.17', + 'TAP::Parser::Result::Unknown'=> '3.17', + 'TAP::Parser::Result::Version'=> '3.17', + 'TAP::Parser::Result::YAML'=> '3.17', + 'TAP::Parser::ResultFactory'=> '3.17', + 'TAP::Parser::Scheduler'=> '3.17', + 'TAP::Parser::Scheduler::Job'=> '3.17', + 'TAP::Parser::Scheduler::Spinner'=> '3.17', + 'TAP::Parser::Source' => '3.17', + 'TAP::Parser::Source::Perl'=> '3.17', + 'TAP::Parser::Utils' => '3.17', + 'TAP::Parser::YAMLish::Reader'=> '3.17', + 'TAP::Parser::YAMLish::Writer'=> '3.17', + 'Term::ANSIColor' => '2.00', + 'Term::ReadLine' => '1.04', + 'Term::UI' => '0.20', + 'Test' => '1.25_02', + 'Test::Builder' => '0.92', + 'Test::Builder::Module' => '0.92', + 'Test::Builder::Tester' => '1.18', + 'Test::Builder::Tester::Color'=> '1.18', + 'Test::Harness' => '3.17', + 'Test::More' => '0.92', + 'Test::Simple' => '0.92', + 'Text::ParseWords' => '3.27', + 'Text::Tabs' => '2009.0305', + 'Text::Wrap' => '2009.0305', + 'Thread::Queue' => '2.11', + 'Thread::Semaphore' => '2.09', + 'Tie::Handle' => '4.2', + 'Tie::Hash' => '1.03', + 'Tie::RefHash' => '1.38', + 'Tie::Scalar' => '1.01', + 'Tie::StdHandle' => '4.2', + 'Time::HiRes' => '1.9719', + 'Time::Local' => '1.1901', + 'Time::Piece' => '1.15', + 'UNIVERSAL' => '1.05', + 'Unicode' => '5.1.0', + 'Unicode::Normalize' => '1.03', + 'Unicode::UCD' => '0.27', + 'VMS::Stdio' => '2.4', + 'Win32' => '0.39', + 'Win32API::File' => '0.1101', + 'XS::APItest' => '0.15', + 'XS::Typemap' => '0.03', + 'XSLoader' => '0.10', + 'attributes' => '0.09', + 'attrs' => '1.03', + 'autodie' => '2.06_01', + 'autodie::exception' => '2.06_01', + 'autodie::exception::system'=> '2.06_01', + 'autodie::hints' => '2.06_01', + 'base' => '2.14', + 'bigint' => '0.23', + 'bignum' => '0.23', + 'bigrat' => '0.23', + 'blib' => '1.04', + 'charnames' => '1.07', + 'constant' => '1.17', + 'encoding' => '2.6_01', + 'feature' => '1.13', + 'fields' => '2.14', + 'lib' => '0.62', + 'mro' => '1.01', + 'open' => '1.07', + 'ops' => '1.02', + 'overload' => '1.07', + 'overload::numbers' => undef, + 'overloading' => '0.01', + 'parent' => '0.221', + 're' => '0.09', + 'threads' => '1.72', + 'threads::shared' => '1.29', + 'version' => '0.77', + }, + removed => { + 'CPAN::API::HOWTO' => 1, + 'CPAN::DeferedCode' => 1, + 'CPANPLUS::inc' => 1, + 'ExtUtils::MakeMaker::bytes'=> 1, + 'ExtUtils::MakeMaker::vmsish'=> 1, + 'Test::Harness::Assert' => 1, + 'Test::Harness::Iterator'=> 1, + 'Test::Harness::Point' => 1, + 'Test::Harness::Results'=> 1, + 'Test::Harness::Straps' => 1, + 'Test::Harness::Util' => 1, + } + }, + 5.011 => { + delta_from => 5.010001, + changed => { + 'Archive::Tar' => '1.54', + 'Attribute::Handlers' => '0.87', + 'AutoLoader' => '5.70', + 'B::Deparse' => '0.91', + 'B::Lint' => '1.11_01', + 'B::Lint::Debug' => '0.01', + 'CGI' => '3.45', + 'CGI::Apache' => '1.01', + 'CGI::Carp' => '3.45', + 'CGI::Pretty' => '3.44', + 'CGI::Switch' => '1.01', + 'CGI::Util' => '3.45', + 'CPAN' => '1.94_51', + 'CPAN::Distribution' => '1.94', + 'CPAN::FTP' => '5.5002', + 'CPAN::Index' => '1.94', + 'CPAN::LWP::UserAgent' => '1.94', + 'CPANPLUS::Dist::Build' => '0.40', + 'CPANPLUS::Dist::Build::Constants'=> '0.40', + 'Carp' => '1.12', + 'Carp::Heavy' => '1.12', + 'Class::ISA' => '0.36', + 'Compress::Raw::Bzip2' => '2.021', + 'Compress::Raw::Zlib' => '2.021', + 'Compress::Zlib' => '2.021', + 'Cwd' => '3.3002', + 'Data::Dumper' => '2.125', + 'Encode' => '2.37', + 'Exporter' => '5.64', + 'Exporter::Heavy' => '5.64', + 'ExtUtils::ParseXS' => '2.200403', + 'File::Basename' => '2.78', + 'File::Copy' => '2.16', + 'File::stat' => '1.02', + 'IO' => '1.25_01', + 'IO::Compress::Adapter::Bzip2'=> '2.021', + 'IO::Compress::Adapter::Deflate'=> '2.021', + 'IO::Compress::Adapter::Identity'=> '2.021', + 'IO::Compress::Base' => '2.021', + 'IO::Compress::Base::Common'=> '2.021', + 'IO::Compress::Bzip2' => '2.021', + 'IO::Compress::Deflate' => '2.021', + 'IO::Compress::Gzip' => '2.021', + 'IO::Compress::Gzip::Constants'=> '2.021', + 'IO::Compress::RawDeflate'=> '2.021', + 'IO::Compress::Zip' => '2.021', + 'IO::Compress::Zip::Constants'=> '2.021', + 'IO::Compress::Zlib::Constants'=> '2.021', + 'IO::Compress::Zlib::Extra'=> '2.021', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.021', + 'IO::Uncompress::Adapter::Identity'=> '2.021', + 'IO::Uncompress::Adapter::Inflate'=> '2.021', + 'IO::Uncompress::AnyInflate'=> '2.021', + 'IO::Uncompress::AnyUncompress'=> '2.021', + 'IO::Uncompress::Base' => '2.021', + 'IO::Uncompress::Bunzip2'=> '2.021', + 'IO::Uncompress::Gunzip'=> '2.021', + 'IO::Uncompress::Inflate'=> '2.021', + 'IO::Uncompress::RawInflate'=> '2.021', + 'IO::Uncompress::Unzip' => '2.021', + 'IO::Zlib' => '1.10', + 'IPC::Cmd' => '0.50', + 'IPC::Open3' => '1.05', + 'Locale::Maketext::Simple'=> '0.21', + 'Log::Message::Simple' => '0.06', + 'Math::BigInt' => '1.89_01', + 'Math::BigRat' => '0.24', + 'Module::Build' => '0.35', + 'Module::Build::Base' => '0.35', + 'Module::Build::Compat' => '0.35', + 'Module::Build::Config' => '0.35', + 'Module::Build::Cookbook'=> '0.35', + 'Module::Build::Dumper' => '0.35', + 'Module::Build::ModuleInfo'=> '0.35', + 'Module::Build::Notes' => '0.35', + 'Module::Build::PPMMaker'=> '0.35', + 'Module::Build::Platform::Amiga'=> '0.35', + 'Module::Build::Platform::Default'=> '0.35', + 'Module::Build::Platform::EBCDIC'=> '0.35', + 'Module::Build::Platform::MPEiX'=> '0.35', + 'Module::Build::Platform::MacOS'=> '0.35', + 'Module::Build::Platform::RiscOS'=> '0.35', + 'Module::Build::Platform::Unix'=> '0.35', + 'Module::Build::Platform::VMS'=> '0.35', + 'Module::Build::Platform::VOS'=> '0.35', + 'Module::Build::Platform::Windows'=> '0.35', + 'Module::Build::Platform::aix'=> '0.35', + 'Module::Build::Platform::cygwin'=> '0.35', + 'Module::Build::Platform::darwin'=> '0.35', + 'Module::Build::Platform::os2'=> '0.35', + 'Module::Build::PodParser'=> '0.35', + 'Module::CoreList' => '2.19', + 'Module::Loaded' => '0.06', + 'Opcode' => '1.13', + 'PerlIO::via' => '0.08', + 'Pod::Perldoc' => '3.15_01', + 'Pod::Plainer' => '1.01', + 'Safe' => '2.19', + 'Socket' => '1.84', + 'Switch' => '2.14_01', + 'Term::ANSIColor' => '2.02', + 'Term::ReadLine' => '1.05', + 'Text::Balanced' => '2.02', + 'Text::Soundex' => '3.03_01', + 'Time::Local' => '1.1901_01', + 'Unicode::Collate' => '0.52_01', + 'attributes' => '0.12', + 'constant' => '1.19', + 'deprecate' => '0.01', + 'overload' => '1.08', + 'parent' => '0.223', + 're' => '0.10', + 'threads' => '1.74', + 'threads::shared' => '1.31', + 'warnings' => '1.07', + }, + removed => { + 'attrs' => 1, + } + }, + 5.011001 => { + delta_from => 5.011, + changed => { + 'B' => '1.23', + 'B::Concise' => '0.77', + 'B::Deparse' => '0.92', + 'CGI' => '3.48', + 'CGI::Pretty' => '3.46', + 'CGI::Util' => '3.48', + 'CPANPLUS' => '0.89_03', + 'CPANPLUS::Internals' => '0.89_03', + 'CPANPLUS::Shell::Default'=> '0.89_03', + 'Carp' => '1.13', + 'Carp::Heavy' => '1.13', + 'ExtUtils::CBuilder' => '0.260301', + 'ExtUtils::CBuilder::Base'=> '0.260301', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.260301', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.260301', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.260301', + 'ExtUtils::CBuilder::Platform::aix'=> '0.260301', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.260301', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.260301', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.260301', + 'ExtUtils::CBuilder::Platform::os2'=> '0.260301', + 'ExtUtils::Install' => '1.55', + 'ExtUtils::Manifest' => '1.57', + 'ExtUtils::Packlist' => '1.44', + 'ExtUtils::ParseXS' => '2.21', + 'File::Glob' => '1.07', + 'File::Path' => '2.08', + 'IO' => '1.25_02', + 'Module::CoreList' => '2.21', + 'OS2::DLL' => '1.04', + 'OS2::Process' => '1.04', + 'Object::Accessor' => '0.36', + 'Opcode' => '1.15', + 'POSIX' => '1.18', + 'Parse::CPAN::Meta' => '1.40', + 'PerlIO::via' => '0.09', + 'Pod::Simple' => '3.08', + 'Socket' => '1.85', + 'Storable' => '2.22', + 'Switch' => '2.15', + 'Test::Builder' => '0.94', + 'Test::Builder::Module' => '0.94', + 'Test::More' => '0.94', + 'Test::Simple' => '0.94', + 'XS::APItest' => '0.16', + 'mro' => '1.02', + 'overload' => '1.09', + 'threads::shared' => '1.32', + }, + removed => { + } + }, + 5.011002 => { + delta_from => 5.011001, + changed => { + 'B::Concise' => '0.78', + 'B::Deparse' => '0.93', + 'CPANPLUS' => '0.89_09', + 'CPANPLUS::Dist::Build' => '0.44', + 'CPANPLUS::Dist::Build::Constants'=> '0.44', + 'CPANPLUS::Internals' => '0.89_09', + 'CPANPLUS::Shell::Default'=> '0.89_09', + 'Carp' => '1.14', + 'Carp::Heavy' => '1.14', + 'Compress::Zlib' => '2.022', + 'DBM_Filter' => '0.03', + 'Encode' => '2.38', + 'Encode::Byte' => '2.04', + 'Encode::CN' => '2.03', + 'Encode::JP' => '2.04', + 'Encode::KR' => '2.03', + 'Encode::TW' => '2.03', + 'Encode::Unicode' => '2.07', + 'Env' => '1.01', + 'Exporter' => '5.64_01', + 'Exporter::Heavy' => '5.64_01', + 'ExtUtils::CBuilder' => '0.27', + 'ExtUtils::CBuilder::Base'=> '0.27', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.27', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.27', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.27', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.27', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.27', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.27', + 'ExtUtils::CBuilder::Platform::aix'=> '0.27', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.27', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.27', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.27', + 'ExtUtils::CBuilder::Platform::os2'=> '0.27', + 'File::Fetch' => '0.22', + 'I18N::LangTags::Detect'=> '1.04', + 'I18N::Langinfo' => '0.03', + 'IO::Compress::Adapter::Bzip2'=> '2.022', + 'IO::Compress::Adapter::Deflate'=> '2.022', + 'IO::Compress::Adapter::Identity'=> '2.022', + 'IO::Compress::Base' => '2.022', + 'IO::Compress::Base::Common'=> '2.022', + 'IO::Compress::Bzip2' => '2.022', + 'IO::Compress::Deflate' => '2.022', + 'IO::Compress::Gzip' => '2.022', + 'IO::Compress::Gzip::Constants'=> '2.022', + 'IO::Compress::RawDeflate'=> '2.022', + 'IO::Compress::Zip' => '2.022', + 'IO::Compress::Zip::Constants'=> '2.022', + 'IO::Compress::Zlib::Constants'=> '2.022', + 'IO::Compress::Zlib::Extra'=> '2.022', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.022', + 'IO::Uncompress::Adapter::Identity'=> '2.022', + 'IO::Uncompress::Adapter::Inflate'=> '2.022', + 'IO::Uncompress::AnyInflate'=> '2.022', + 'IO::Uncompress::AnyUncompress'=> '2.022', + 'IO::Uncompress::Base' => '2.022', + 'IO::Uncompress::Bunzip2'=> '2.022', + 'IO::Uncompress::Gunzip'=> '2.022', + 'IO::Uncompress::Inflate'=> '2.022', + 'IO::Uncompress::RawInflate'=> '2.022', + 'IO::Uncompress::Unzip' => '2.022', + 'IPC::Cmd' => '0.54', + 'List::Util' => '1.22', + 'List::Util::PP' => '1.22', + 'List::Util::XS' => '1.22', + 'Locale::Maketext' => '1.14', + 'Module::Build' => '0.35_09', + 'Module::Build::Base' => '0.35_09', + 'Module::Build::Compat' => '0.35_09', + 'Module::Build::Config' => '0.35_09', + 'Module::Build::Cookbook'=> '0.35_09', + 'Module::Build::Dumper' => '0.35_09', + 'Module::Build::ModuleInfo'=> '0.35_09', + 'Module::Build::Notes' => '0.35_09', + 'Module::Build::PPMMaker'=> '0.35_09', + 'Module::Build::Platform::Amiga'=> '0.35_09', + 'Module::Build::Platform::Default'=> '0.35_09', + 'Module::Build::Platform::EBCDIC'=> '0.35_09', + 'Module::Build::Platform::MPEiX'=> '0.35_09', + 'Module::Build::Platform::MacOS'=> '0.35_09', + 'Module::Build::Platform::RiscOS'=> '0.35_09', + 'Module::Build::Platform::Unix'=> '0.35_09', + 'Module::Build::Platform::VMS'=> '0.35_09', + 'Module::Build::Platform::VOS'=> '0.35_09', + 'Module::Build::Platform::Windows'=> '0.35_09', + 'Module::Build::Platform::aix'=> '0.35_09', + 'Module::Build::Platform::cygwin'=> '0.35_09', + 'Module::Build::Platform::darwin'=> '0.35_09', + 'Module::Build::Platform::os2'=> '0.35_09', + 'Module::Build::PodParser'=> '0.35_09', + 'Module::Build::YAML' => '1.40', + 'Module::CoreList' => '2.23', + 'Module::Load::Conditional'=> '0.34', + 'Pod::Simple' => '3.10', + 'Pod::Simple::XHTML' => '3.10', + 'Scalar::Util' => '1.22', + 'Scalar::Util::PP' => '1.22', + 'Switch' => '2.16', + 'XS::APItest' => '0.17', + 'XS::APItest::KeywordRPN'=> '0.003', + 'base' => '2.15', + 'diagnostics' => '1.18', + 'fields' => '2.15', + 'inc::latest' => '0.35_09', + 'legacy' => '1.00', + 'overload' => '1.10', + }, + removed => { + } + }, + 5.011003 => { + delta_from => 5.011002, + changed => { + 'App::Cpan' => '1.570001', + 'Archive::Extract' => '0.36', + 'CPAN' => '1.94_5301', + 'CPAN::FTP' => '5.5004', + 'CPAN::FirstTime' => '5.530001', + 'CPAN::Mirrors' => '1.770001', + 'CPANPLUS' => '0.90', + 'CPANPLUS::Internals' => '0.90', + 'CPANPLUS::Shell::Default'=> '0.90', + 'Cwd' => '3.31', + 'Encode' => '2.39', + 'ExtUtils::Command::MM' => '6.56', + 'ExtUtils::Liblist' => '6.56', + 'ExtUtils::Liblist::Kid'=> '6.56', + 'ExtUtils::MM' => '6.56', + 'ExtUtils::MM_AIX' => '6.56', + 'ExtUtils::MM_Any' => '6.56', + 'ExtUtils::MM_BeOS' => '6.56', + 'ExtUtils::MM_Cygwin' => '6.56', + 'ExtUtils::MM_DOS' => '6.56', + 'ExtUtils::MM_Darwin' => '6.56', + 'ExtUtils::MM_MacOS' => '6.56', + 'ExtUtils::MM_NW5' => '6.56', + 'ExtUtils::MM_OS2' => '6.56', + 'ExtUtils::MM_QNX' => '6.56', + 'ExtUtils::MM_UWIN' => '6.56', + 'ExtUtils::MM_Unix' => '6.56', + 'ExtUtils::MM_VMS' => '6.56', + 'ExtUtils::MM_VOS' => '6.56', + 'ExtUtils::MM_Win32' => '6.56', + 'ExtUtils::MM_Win95' => '6.56', + 'ExtUtils::MY' => '6.56', + 'ExtUtils::MakeMaker' => '6.56', + 'ExtUtils::MakeMaker::Config'=> '6.56', + 'ExtUtils::Mkbootstrap' => '6.56', + 'ExtUtils::Mksymlists' => '6.56', + 'ExtUtils::testlib' => '6.56', + 'File::Find' => '1.15', + 'File::Path' => '2.08_01', + 'File::Spec' => '3.31', + 'Module::Build' => '0.36', + 'Module::Build::Base' => '0.36', + 'Module::Build::Compat' => '0.36', + 'Module::Build::Config' => '0.36', + 'Module::Build::Cookbook'=> '0.36', + 'Module::Build::Dumper' => '0.36', + 'Module::Build::ModuleInfo'=> '0.36', + 'Module::Build::Notes' => '0.36', + 'Module::Build::PPMMaker'=> '0.36', + 'Module::Build::Platform::Amiga'=> '0.36', + 'Module::Build::Platform::Default'=> '0.36', + 'Module::Build::Platform::EBCDIC'=> '0.36', + 'Module::Build::Platform::MPEiX'=> '0.36', + 'Module::Build::Platform::MacOS'=> '0.36', + 'Module::Build::Platform::RiscOS'=> '0.36', + 'Module::Build::Platform::Unix'=> '0.36', + 'Module::Build::Platform::VMS'=> '0.36', + 'Module::Build::Platform::VOS'=> '0.36', + 'Module::Build::Platform::Windows'=> '0.36', + 'Module::Build::Platform::aix'=> '0.36', + 'Module::Build::Platform::cygwin'=> '0.36', + 'Module::Build::Platform::darwin'=> '0.36', + 'Module::Build::Platform::os2'=> '0.36', + 'Module::Build::PodParser'=> '0.36', + 'Module::CoreList' => '2.24', + 'POSIX' => '1.19', + 'Pod::Simple' => '3.13', + 'Pod::Simple::BlackBox' => '3.13', + 'Pod::Simple::Checker' => '3.13', + 'Pod::Simple::Debug' => '3.13', + 'Pod::Simple::DumpAsText'=> '3.13', + 'Pod::Simple::DumpAsXML'=> '3.13', + 'Pod::Simple::HTML' => '3.13', + 'Pod::Simple::HTMLBatch'=> '3.13', + 'Pod::Simple::LinkSection'=> '3.13', + 'Pod::Simple::Methody' => '3.13', + 'Pod::Simple::Progress' => '3.13', + 'Pod::Simple::PullParser'=> '3.13', + 'Pod::Simple::PullParserEndToken'=> '3.13', + 'Pod::Simple::PullParserStartToken'=> '3.13', + 'Pod::Simple::PullParserTextToken'=> '3.13', + 'Pod::Simple::PullParserToken'=> '3.13', + 'Pod::Simple::RTF' => '3.13', + 'Pod::Simple::Search' => '3.13', + 'Pod::Simple::SimpleTree'=> '3.13', + 'Pod::Simple::Text' => '3.13', + 'Pod::Simple::TextContent'=> '3.13', + 'Pod::Simple::TiedOutFH'=> '3.13', + 'Pod::Simple::Transcode'=> '3.13', + 'Pod::Simple::TranscodeDumb'=> '3.13', + 'Pod::Simple::TranscodeSmart'=> '3.13', + 'Pod::Simple::XHTML' => '3.13', + 'Pod::Simple::XMLOutStream'=> '3.13', + 'Safe' => '2.20', + 'Unicode' => '5.2.0', + 'constant' => '1.20', + 'diagnostics' => '1.19', + 'feature' => '1.14', + 'inc::latest' => '0.36', + 'threads' => '1.75', + 'warnings' => '1.08', + }, + removed => { + 'legacy' => 1, + } + }, + 5.011004 => { + delta_from => 5.011003, + changed => { + 'App::Cpan' => '1.5701', + 'Archive::Extract' => '0.38', + 'B::Deparse' => '0.94', + 'CPAN' => '1.94_54', + 'CPAN::FirstTime' => '5.53', + 'CPAN::Mirrors' => '1.77', + 'Carp' => '1.15', + 'Carp::Heavy' => '1.15', + 'Compress::Raw::Bzip2' => '2.024', + 'Compress::Raw::Zlib' => '2.024', + 'Compress::Zlib' => '2.024', + 'File::Copy' => '2.17', + 'File::Fetch' => '0.24', + 'GDBM_File' => '1.10', + 'IO::Compress::Adapter::Bzip2'=> '2.024', + 'IO::Compress::Adapter::Deflate'=> '2.024', + 'IO::Compress::Adapter::Identity'=> '2.024', + 'IO::Compress::Base' => '2.024', + 'IO::Compress::Base::Common'=> '2.024', + 'IO::Compress::Bzip2' => '2.024', + 'IO::Compress::Deflate' => '2.024', + 'IO::Compress::Gzip' => '2.024', + 'IO::Compress::Gzip::Constants'=> '2.024', + 'IO::Compress::RawDeflate'=> '2.024', + 'IO::Compress::Zip' => '2.024', + 'IO::Compress::Zip::Constants'=> '2.024', + 'IO::Compress::Zlib::Constants'=> '2.024', + 'IO::Compress::Zlib::Extra'=> '2.024', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.024', + 'IO::Uncompress::Adapter::Identity'=> '2.024', + 'IO::Uncompress::Adapter::Inflate'=> '2.024', + 'IO::Uncompress::AnyInflate'=> '2.024', + 'IO::Uncompress::AnyUncompress'=> '2.024', + 'IO::Uncompress::Base' => '2.024', + 'IO::Uncompress::Bunzip2'=> '2.024', + 'IO::Uncompress::Gunzip'=> '2.024', + 'IO::Uncompress::Inflate'=> '2.024', + 'IO::Uncompress::RawInflate'=> '2.024', + 'IO::Uncompress::Unzip' => '2.024', + 'Module::Build' => '0.3603', + 'Module::Build::Base' => '0.3603', + 'Module::Build::Compat' => '0.3603', + 'Module::Build::Config' => '0.3603', + 'Module::Build::Cookbook'=> '0.3603', + 'Module::Build::Dumper' => '0.3603', + 'Module::Build::ModuleInfo'=> '0.3603', + 'Module::Build::Notes' => '0.3603', + 'Module::Build::PPMMaker'=> '0.3603', + 'Module::Build::Platform::Amiga'=> '0.3603', + 'Module::Build::Platform::Default'=> '0.3603', + 'Module::Build::Platform::EBCDIC'=> '0.3603', + 'Module::Build::Platform::MPEiX'=> '0.3603', + 'Module::Build::Platform::MacOS'=> '0.3603', + 'Module::Build::Platform::RiscOS'=> '0.3603', + 'Module::Build::Platform::Unix'=> '0.3603', + 'Module::Build::Platform::VMS'=> '0.3603', + 'Module::Build::Platform::VOS'=> '0.3603', + 'Module::Build::Platform::Windows'=> '0.3603', + 'Module::Build::Platform::aix'=> '0.3603', + 'Module::Build::Platform::cygwin'=> '0.3603', + 'Module::Build::Platform::darwin'=> '0.3603', + 'Module::Build::Platform::os2'=> '0.3603', + 'Module::Build::PodParser'=> '0.3603', + 'Module::CoreList' => '2.25', + 'PerlIO::encoding' => '0.12', + 'Safe' => '2.21', + 'UNIVERSAL' => '1.06', + 'feature' => '1.15', + 'inc::latest' => '0.3603', + 'less' => '0.03', + 're' => '0.11', + 'version' => '0.81', + 'warnings' => '1.09', + }, + removed => { + } + }, + 5.011005 => { + delta_from => 5.011004, + changed => { + 'B::Debug' => '1.12', + 'CPAN' => '1.94_56', + 'CPAN::Debug' => '5.5001', + 'CPAN::Distribution' => '1.9456', + 'CPAN::FirstTime' => '5.5301', + 'CPAN::HandleConfig' => '5.5001', + 'CPAN::Shell' => '5.5001', + 'CPAN::Tarzip' => '5.5011', + 'CPANPLUS::Dist::Build' => '0.46', + 'CPANPLUS::Dist::Build::Constants'=> '0.46', + 'Module::CoreList' => '2.26', + 'Pod::Man' => '2.23', + 'Pod::ParseLink' => '1.10', + 'Pod::Perldoc' => '3.15_02', + 'Pod::Plainer' => '1.02', + 'Pod::Text' => '3.14', + 'Pod::Text::Color' => '2.06', + 'Pod::Text::Overstrike' => '2.04', + 'Pod::Text::Termcap' => '2.06', + 'Safe' => '2.22', + 'Socket' => '1.86', + 'version' => '0.82', + }, + removed => { + } + }, + 5.012 => { + delta_from => 5.011005, + changed => { + 'B::Deparse' => '0.96', + 'CPAN::Distribution' => '1.9456_01', + 'Module::CoreList' => '2.29', + 'Safe' => '2.25', + 'Socket' => '1.87', + 'Tie::Scalar' => '1.02', + 'Time::Piece' => '1.15_01', + 'bytes' => '1.04', + 'feature' => '1.16', + 'utf8' => '1.08', + }, + removed => { + } + }, + 5.012001 => { + delta_from => 5.012, + changed => { + 'B::Deparse' => '0.97', + 'CGI' => '3.49', + 'CGI::Fast' => '1.08', + 'Carp' => '1.16', + 'Carp::Heavy' => '1.16', + 'File::Copy' => '2.18', + 'Module::CoreList' => '2.32', + 'Pod::Functions' => '1.04', + 'Pod::Simple' => '3.14', + 'Pod::Simple::BlackBox' => '3.14', + 'Pod::Simple::Checker' => '3.14', + 'Pod::Simple::Debug' => '3.14', + 'Pod::Simple::DumpAsText'=> '3.14', + 'Pod::Simple::DumpAsXML'=> '3.14', + 'Pod::Simple::HTML' => '3.14', + 'Pod::Simple::HTMLBatch'=> '3.14', + 'Pod::Simple::LinkSection'=> '3.14', + 'Pod::Simple::Methody' => '3.14', + 'Pod::Simple::Progress' => '3.14', + 'Pod::Simple::PullParser'=> '3.14', + 'Pod::Simple::PullParserEndToken'=> '3.14', + 'Pod::Simple::PullParserStartToken'=> '3.14', + 'Pod::Simple::PullParserTextToken'=> '3.14', + 'Pod::Simple::PullParserToken'=> '3.14', + 'Pod::Simple::RTF' => '3.14', + 'Pod::Simple::Search' => '3.14', + 'Pod::Simple::SimpleTree'=> '3.14', + 'Pod::Simple::Text' => '3.14', + 'Pod::Simple::TextContent'=> '3.14', + 'Pod::Simple::TiedOutFH'=> '3.14', + 'Pod::Simple::Transcode'=> '3.14', + 'Pod::Simple::TranscodeDumb'=> '3.14', + 'Pod::Simple::TranscodeSmart'=> '3.14', + 'Pod::Simple::XHTML' => '3.14', + 'Pod::Simple::XMLOutStream'=> '3.14', + 'Safe' => '2.27', + }, + removed => { + } + }, + 5.012002 => { + delta_from => 5.012001, + changed => { + 'Carp' => '1.17', + 'Carp::Heavy' => '1.17', + 'File::Spec' => '3.31_01', + 'Module::CoreList' => '2.38', + 'Module::Load::Conditional'=> '0.38', + 'PerlIO::scalar' => '0.08', + }, + removed => { + } + }, + 5.012003 => { + delta_from => 5.012002, + changed => { + 'B::Deparse' => '0.9701', + 'Module::Build::Platform::cygwin'=> '0.360301', + 'Module::CoreList' => '2.43', + 'Socket' => '1.87_01', + }, + removed => { + } + }, + 5.012004 => { + delta_from => 5.012003, + changed => { + 'Module::CoreList' => '2.50', + }, + removed => { + } + }, + 5.012005 => { + delta_from => 5.012004, + changed => { + 'B::Concise' => '0.78_01', + 'Encode' => '2.39_01', + 'File::Glob' => '1.07_01', + 'Module::CoreList' => '2.50_02', + 'Unicode::UCD' => '0.29', + 'charnames' => '1.07_01', + }, + removed => { + } + }, + 5.013 => { + delta_from => 5.012, + changed => { + 'CGI' => '3.49', + 'CGI::Fast' => '1.08', + 'Data::Dumper' => '2.126', + 'ExtUtils::MM_Unix' => '6.5601', + 'ExtUtils::MakeMaker' => '6.5601', + 'File::Copy' => '2.18', + 'IPC::Open3' => '1.06', + 'MIME::Base64' => '3.09', + 'MIME::QuotedPrint' => '3.09', + 'Module::CoreList' => '2.31', + 'Pod::Functions' => '1.04', + 'XS::APItest' => '0.18', + 'XS::APItest::KeywordRPN'=> '0.004', + 'feature' => '1.17', + 'threads' => '1.77_01', + 'threads::shared' => '1.33', + }, + removed => { + } + }, + 5.013001 => { + delta_from => 5.012001, + changed => { + 'Data::Dumper' => '2.126', + 'Dumpvalue' => '1.14', + 'Errno' => '1.12', + 'ExtUtils::MM_Unix' => '6.5601', + 'ExtUtils::MakeMaker' => '6.5601', + 'ExtUtils::ParseXS' => '2.2205', + 'File::Find' => '1.16', + 'IPC::Cmd' => '0.58', + 'IPC::Open3' => '1.06', + 'List::Util' => '1.23', + 'List::Util::PP' => '1.23', + 'List::Util::XS' => '1.23', + 'Locale::Codes' => '3.12', + 'Locale::Codes::Country'=> '3.12', + 'Locale::Codes::Currency'=> '3.12', + 'Locale::Codes::Language'=> '3.12', + 'Locale::Codes::Script' => '3.12', + 'Locale::Constants' => '3.12', + 'Locale::Country' => '3.12', + 'Locale::Currency' => '3.12', + 'Locale::Language' => '3.12', + 'Locale::Script' => '3.12', + 'MIME::Base64' => '3.09', + 'MIME::QuotedPrint' => '3.09', + 'Module::Build::Platform::cygwin'=> '0.360301', + 'Module::CoreList' => '2.34', + 'Module::Load::Conditional'=> '0.38', + 'PerlIO::scalar' => '0.08', + 'Scalar::Util' => '1.23', + 'Scalar::Util::PP' => '1.23', + 'Socket' => '1.88', + 'Term::ReadLine' => '1.06', + 'Unicode::UCD' => '0.28', + 'XS::APItest' => '0.19', + 'XS::APItest::KeywordRPN'=> '0.004', + 'charnames' => '1.08', + 'feature' => '1.17', + 'threads' => '1.77_01', + 'threads::shared' => '1.33', + }, + removed => { + 'Class::ISA' => 1, + 'Pod::Plainer' => 1, + 'Switch' => 1, + } + }, + 5.013002 => { + delta_from => 5.013001, + changed => { + 'B::Concise' => '0.79', + 'B::Deparse' => '0.98', + 'CPAN' => '1.94_57', + 'CPAN::Distribution' => '1.9600', + 'Exporter' => '5.64_02', + 'Exporter::Heavy' => '5.64_02', + 'File::Copy' => '2.19', + 'Hash::Util' => '0.08', + 'IO::Socket' => '1.32', + 'Locale::Codes' => '3.13', + 'Locale::Codes::Country'=> '3.13', + 'Locale::Codes::Currency'=> '3.13', + 'Locale::Codes::Language'=> '3.13', + 'Locale::Codes::Script' => '3.13', + 'Locale::Constants' => '3.13', + 'Locale::Country' => '3.13', + 'Locale::Currency' => '3.13', + 'Locale::Language' => '3.13', + 'Locale::Script' => '3.13', + 'Search::Dict' => '1.03', + 'Socket' => '1.89', + 'Thread::Semaphore' => '2.11', + 'UNIVERSAL' => '1.07', + 'VMS::DCLsym' => '1.04', + 'mro' => '1.03', + 'threads' => '1.77_02', + 'threads::shared' => '1.33_01', + }, + removed => { + } + }, + 5.013003 => { + delta_from => 5.013002, + changed => { + 'App::Prove' => '3.21', + 'App::Prove::State' => '3.21', + 'App::Prove::State::Result'=> '3.21', + 'App::Prove::State::Result::Test'=> '3.21', + 'Archive::Extract' => '0.42', + 'Archive::Tar' => '1.64', + 'Archive::Tar::Constant'=> '1.64', + 'Archive::Tar::File' => '1.64', + 'Attribute::Handlers' => '0.88', + 'CPANPLUS' => '0.9007', + 'CPANPLUS::Internals' => '0.9007', + 'CPANPLUS::Shell::Default'=> '0.9007', + 'Compress::Raw::Bzip2' => '2.027', + 'Compress::Raw::Zlib' => '2.027_01', + 'Compress::Zlib' => '2.027', + 'DB' => '1.03', + 'Digest::MD5' => '2.40', + 'Digest::SHA' => '5.48', + 'Exporter' => '5.64_03', + 'Exporter::Heavy' => '5.64_03', + 'ExtUtils::CBuilder' => '0.2703', + 'ExtUtils::CBuilder::Base'=> '0.2703_01', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.2703', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.2703', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.2703', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.2703', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.2703', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.2703', + 'ExtUtils::CBuilder::Platform::aix'=> '0.2703', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.2703', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.2703', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.2703', + 'ExtUtils::CBuilder::Platform::os2'=> '0.2703', + 'ExtUtils::Manifest' => '1.58', + 'ExtUtils::ParseXS' => '2.2206', + 'Fatal' => '2.10', + 'File::Basename' => '2.79', + 'File::Copy' => '2.20', + 'File::DosGlob' => '1.02', + 'File::Find' => '1.17', + 'File::Glob' => '1.08', + 'File::stat' => '1.03', + 'I18N::LangTags' => '0.35_01', + 'I18N::LangTags::List' => '0.35_01', + 'IO::Compress::Adapter::Bzip2'=> '2.027', + 'IO::Compress::Adapter::Deflate'=> '2.027', + 'IO::Compress::Adapter::Identity'=> '2.027', + 'IO::Compress::Base' => '2.027', + 'IO::Compress::Base::Common'=> '2.027', + 'IO::Compress::Bzip2' => '2.027', + 'IO::Compress::Deflate' => '2.027', + 'IO::Compress::Gzip' => '2.027', + 'IO::Compress::Gzip::Constants'=> '2.027', + 'IO::Compress::RawDeflate'=> '2.027', + 'IO::Compress::Zip' => '2.027', + 'IO::Compress::Zip::Constants'=> '2.027', + 'IO::Compress::Zlib::Constants'=> '2.027', + 'IO::Compress::Zlib::Extra'=> '2.027', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.027', + 'IO::Uncompress::Adapter::Identity'=> '2.027', + 'IO::Uncompress::Adapter::Inflate'=> '2.027', + 'IO::Uncompress::AnyInflate'=> '2.027', + 'IO::Uncompress::AnyUncompress'=> '2.027', + 'IO::Uncompress::Base' => '2.027', + 'IO::Uncompress::Bunzip2'=> '2.027', + 'IO::Uncompress::Gunzip'=> '2.027', + 'IO::Uncompress::Inflate'=> '2.027', + 'IO::Uncompress::RawInflate'=> '2.027', + 'IO::Uncompress::Unzip' => '2.027', + 'IPC::Cmd' => '0.60', + 'IPC::Msg' => '2.03', + 'IPC::Semaphore' => '2.03', + 'IPC::SharedMem' => '2.03', + 'IPC::SysV' => '2.03', + 'Locale::Maketext' => '1.15', + 'Locale::Maketext::Guts'=> undef, + 'Locale::Maketext::GutsLoader'=> undef, + 'Module::Build' => '0.3607', + 'Module::Build::Base' => '0.3607', + 'Module::Build::Compat' => '0.3607', + 'Module::Build::Config' => '0.3607', + 'Module::Build::Cookbook'=> '0.3607', + 'Module::Build::Dumper' => '0.3607', + 'Module::Build::ModuleInfo'=> '0.3607', + 'Module::Build::Notes' => '0.3607', + 'Module::Build::PPMMaker'=> '0.3607', + 'Module::Build::Platform::Amiga'=> '0.3607', + 'Module::Build::Platform::Default'=> '0.3607', + 'Module::Build::Platform::EBCDIC'=> '0.3607', + 'Module::Build::Platform::MPEiX'=> '0.3607', + 'Module::Build::Platform::MacOS'=> '0.3607', + 'Module::Build::Platform::RiscOS'=> '0.3607', + 'Module::Build::Platform::Unix'=> '0.3607', + 'Module::Build::Platform::VMS'=> '0.3607', + 'Module::Build::Platform::VOS'=> '0.3607', + 'Module::Build::Platform::Windows'=> '0.3607', + 'Module::Build::Platform::aix'=> '0.3607', + 'Module::Build::Platform::cygwin'=> '0.3607', + 'Module::Build::Platform::darwin'=> '0.3607', + 'Module::Build::Platform::os2'=> '0.3607', + 'Module::Build::PodParser'=> '0.3607', + 'Module::CoreList' => '2.36', + 'Module::Load' => '0.18', + 'TAP::Base' => '3.21', + 'TAP::Formatter::Base' => '3.21', + 'TAP::Formatter::Color' => '3.21', + 'TAP::Formatter::Console'=> '3.21', + 'TAP::Formatter::Console::ParallelSession'=> '3.21', + 'TAP::Formatter::Console::Session'=> '3.21', + 'TAP::Formatter::File' => '3.21', + 'TAP::Formatter::File::Session'=> '3.21', + 'TAP::Formatter::Session'=> '3.21', + 'TAP::Harness' => '3.21', + 'TAP::Object' => '3.21', + 'TAP::Parser' => '3.21', + 'TAP::Parser::Aggregator'=> '3.21', + 'TAP::Parser::Grammar' => '3.21', + 'TAP::Parser::Iterator' => '3.21', + 'TAP::Parser::Iterator::Array'=> '3.21', + 'TAP::Parser::Iterator::Process'=> '3.21', + 'TAP::Parser::Iterator::Stream'=> '3.21', + 'TAP::Parser::IteratorFactory'=> '3.21', + 'TAP::Parser::Multiplexer'=> '3.21', + 'TAP::Parser::Result' => '3.21', + 'TAP::Parser::Result::Bailout'=> '3.21', + 'TAP::Parser::Result::Comment'=> '3.21', + 'TAP::Parser::Result::Plan'=> '3.21', + 'TAP::Parser::Result::Pragma'=> '3.21', + 'TAP::Parser::Result::Test'=> '3.21', + 'TAP::Parser::Result::Unknown'=> '3.21', + 'TAP::Parser::Result::Version'=> '3.21', + 'TAP::Parser::Result::YAML'=> '3.21', + 'TAP::Parser::ResultFactory'=> '3.21', + 'TAP::Parser::Scheduler'=> '3.21', + 'TAP::Parser::Scheduler::Job'=> '3.21', + 'TAP::Parser::Scheduler::Spinner'=> '3.21', + 'TAP::Parser::Source' => '3.21', + 'TAP::Parser::SourceHandler'=> '3.21', + 'TAP::Parser::SourceHandler::Executable'=> '3.21', + 'TAP::Parser::SourceHandler::File'=> '3.21', + 'TAP::Parser::SourceHandler::Handle'=> '3.21', + 'TAP::Parser::SourceHandler::Perl'=> '3.21', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.21', + 'TAP::Parser::SourceHandler::pgTAP'=> '3.21', + 'TAP::Parser::Utils' => '3.21', + 'TAP::Parser::YAMLish::Reader'=> '3.21', + 'TAP::Parser::YAMLish::Writer'=> '3.21', + 'Term::ANSIColor' => '3.00', + 'Term::ReadLine' => '1.07', + 'Test::Harness' => '3.21', + 'Tie::Array' => '1.04', + 'Time::HiRes' => '1.9721', + 'Time::Piece' => '1.20_01', + 'Unicode::Collate' => '0.53', + 'Unicode::Normalize' => '1.06', + 'Unicode::UCD' => '0.29', + 'autodie' => '2.10', + 'autodie::exception' => '2.10', + 'autodie::exception::system'=> '2.10', + 'autodie::hints' => '2.10', + 'blib' => '1.05', + 'charnames' => '1.11', + 'diagnostics' => '1.20', + 'inc::latest' => '0.3607', + 'lib' => '0.63', + 're' => '0.12', + 'threads' => '1.77_03', + 'threads::shared' => '1.33_02', + 'vars' => '1.02', + 'warnings' => '1.10', + }, + removed => { + 'TAP::Parser::Source::Perl'=> 1, + } + }, + 5.013004 => { + delta_from => 5.013003, + changed => { + 'App::Prove' => '3.22', + 'App::Prove::State' => '3.22', + 'App::Prove::State::Result'=> '3.22', + 'App::Prove::State::Result::Test'=> '3.22', + 'Archive::Tar' => '1.68', + 'Archive::Tar::Constant'=> '1.68', + 'Archive::Tar::File' => '1.68', + 'B::Lint' => '1.12', + 'B::Lint::Debug' => '1.12', + 'Carp' => '1.18', + 'Carp::Heavy' => '1.18', + 'Compress::Raw::Bzip2' => '2.030', + 'Compress::Raw::Zlib' => '2.030', + 'Compress::Zlib' => '2.030', + 'ExtUtils::ParseXS' => '2.2207', + 'File::Spec' => '3.31_01', + 'I18N::Langinfo' => '0.04', + 'IO::Compress::Adapter::Bzip2'=> '2.030', + 'IO::Compress::Adapter::Deflate'=> '2.030', + 'IO::Compress::Adapter::Identity'=> '2.030', + 'IO::Compress::Base' => '2.030', + 'IO::Compress::Base::Common'=> '2.030', + 'IO::Compress::Bzip2' => '2.030', + 'IO::Compress::Deflate' => '2.030', + 'IO::Compress::Gzip' => '2.030', + 'IO::Compress::Gzip::Constants'=> '2.030', + 'IO::Compress::RawDeflate'=> '2.030', + 'IO::Compress::Zip' => '2.030', + 'IO::Compress::Zip::Constants'=> '2.030', + 'IO::Compress::Zlib::Constants'=> '2.030', + 'IO::Compress::Zlib::Extra'=> '2.030', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.030', + 'IO::Uncompress::Adapter::Identity'=> '2.030', + 'IO::Uncompress::Adapter::Inflate'=> '2.030', + 'IO::Uncompress::AnyInflate'=> '2.030', + 'IO::Uncompress::AnyUncompress'=> '2.030', + 'IO::Uncompress::Base' => '2.030', + 'IO::Uncompress::Bunzip2'=> '2.030', + 'IO::Uncompress::Gunzip'=> '2.030', + 'IO::Uncompress::Inflate'=> '2.030', + 'IO::Uncompress::RawInflate'=> '2.030', + 'IO::Uncompress::Unzip' => '2.030', + 'Module::CoreList' => '2.37', + 'TAP::Base' => '3.22', + 'TAP::Formatter::Base' => '3.22', + 'TAP::Formatter::Color' => '3.22', + 'TAP::Formatter::Console'=> '3.22', + 'TAP::Formatter::Console::ParallelSession'=> '3.22', + 'TAP::Formatter::Console::Session'=> '3.22', + 'TAP::Formatter::File' => '3.22', + 'TAP::Formatter::File::Session'=> '3.22', + 'TAP::Formatter::Session'=> '3.22', + 'TAP::Harness' => '3.22', + 'TAP::Object' => '3.22', + 'TAP::Parser' => '3.22', + 'TAP::Parser::Aggregator'=> '3.22', + 'TAP::Parser::Grammar' => '3.22', + 'TAP::Parser::Iterator' => '3.22', + 'TAP::Parser::Iterator::Array'=> '3.22', + 'TAP::Parser::Iterator::Process'=> '3.22', + 'TAP::Parser::Iterator::Stream'=> '3.22', + 'TAP::Parser::IteratorFactory'=> '3.22', + 'TAP::Parser::Multiplexer'=> '3.22', + 'TAP::Parser::Result' => '3.22', + 'TAP::Parser::Result::Bailout'=> '3.22', + 'TAP::Parser::Result::Comment'=> '3.22', + 'TAP::Parser::Result::Plan'=> '3.22', + 'TAP::Parser::Result::Pragma'=> '3.22', + 'TAP::Parser::Result::Test'=> '3.22', + 'TAP::Parser::Result::Unknown'=> '3.22', + 'TAP::Parser::Result::Version'=> '3.22', + 'TAP::Parser::Result::YAML'=> '3.22', + 'TAP::Parser::ResultFactory'=> '3.22', + 'TAP::Parser::Scheduler'=> '3.22', + 'TAP::Parser::Scheduler::Job'=> '3.22', + 'TAP::Parser::Scheduler::Spinner'=> '3.22', + 'TAP::Parser::Source' => '3.22', + 'TAP::Parser::SourceHandler'=> '3.22', + 'TAP::Parser::SourceHandler::Executable'=> '3.22', + 'TAP::Parser::SourceHandler::File'=> '3.22', + 'TAP::Parser::SourceHandler::Handle'=> '3.22', + 'TAP::Parser::SourceHandler::Perl'=> '3.22', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.22', + 'TAP::Parser::Utils' => '3.22', + 'TAP::Parser::YAMLish::Reader'=> '3.22', + 'TAP::Parser::YAMLish::Writer'=> '3.22', + 'Test::Builder' => '0.96', + 'Test::Builder::Module' => '0.96', + 'Test::Builder::Tester' => '1.20', + 'Test::Builder::Tester::Color'=> '1.20', + 'Test::Harness' => '3.22', + 'Test::More' => '0.96', + 'Test::Simple' => '0.96', + 'Unicode::Collate' => '0.56', + 'Unicode::Collate::Locale'=> '0.56', + 'XS::APItest' => '0.20', + 'charnames' => '1.15', + 'feature' => '1.18', + }, + removed => { + 'TAP::Parser::SourceHandler::pgTAP'=> 1, + } + }, + 5.013005 => { + delta_from => 5.013004, + changed => { + 'B::Debug' => '1.16', + 'CPANPLUS::Dist::Build' => '0.48', + 'CPANPLUS::Dist::Build::Constants'=> '0.48', + 'Data::Dumper' => '2.128', + 'Encode' => '2.40', + 'Encode::Guess' => '2.04', + 'Encode::MIME::Header' => '2.12', + 'Encode::Unicode::UTF7' => '2.05', + 'Errno' => '1.13', + 'ExtUtils::Command::MM' => '6.57_05', + 'ExtUtils::Liblist' => '6.57_05', + 'ExtUtils::Liblist::Kid'=> '6.5705', + 'ExtUtils::MM' => '6.57_05', + 'ExtUtils::MM_AIX' => '6.57_05', + 'ExtUtils::MM_Any' => '6.57_05', + 'ExtUtils::MM_BeOS' => '6.57_05', + 'ExtUtils::MM_Cygwin' => '6.57_05', + 'ExtUtils::MM_DOS' => '6.5705', + 'ExtUtils::MM_Darwin' => '6.57_05', + 'ExtUtils::MM_MacOS' => '6.5705', + 'ExtUtils::MM_NW5' => '6.57_05', + 'ExtUtils::MM_OS2' => '6.57_05', + 'ExtUtils::MM_QNX' => '6.57_05', + 'ExtUtils::MM_UWIN' => '6.5705', + 'ExtUtils::MM_Unix' => '6.57_05', + 'ExtUtils::MM_VMS' => '6.57_05', + 'ExtUtils::MM_VOS' => '6.57_05', + 'ExtUtils::MM_Win32' => '6.57_05', + 'ExtUtils::MM_Win95' => '6.57_05', + 'ExtUtils::MY' => '6.5705', + 'ExtUtils::MakeMaker' => '6.57_05', + 'ExtUtils::MakeMaker::Config'=> '6.57_05', + 'ExtUtils::MakeMaker::YAML'=> '1.44', + 'ExtUtils::Mkbootstrap' => '6.57_05', + 'ExtUtils::Mksymlists' => '6.57_05', + 'ExtUtils::testlib' => '6.5705', + 'Filter::Simple' => '0.85', + 'Hash::Util' => '0.09', + 'Math::BigFloat' => '1.62', + 'Math::BigInt' => '1.95', + 'Math::BigInt::Calc' => '0.54', + 'Math::BigInt::CalcEmu' => '0.06', + 'Math::BigInt::FastCalc'=> '0.22', + 'Math::BigRat' => '0.26', + 'Module::CoreList' => '2.39', + 'POSIX' => '1.20', + 'PerlIO::scalar' => '0.09', + 'Safe' => '2.28', + 'Test::Builder' => '0.97_01', + 'Test::Builder::Module' => '0.97_01', + 'Test::Builder::Tester' => '1.21_01', + 'Test::Builder::Tester::Color'=> '1.21_01', + 'Test::More' => '0.97_01', + 'Test::Simple' => '0.97_01', + 'Tie::Hash' => '1.04', + 'Unicode::Collate' => '0.59', + 'Unicode::Collate::Locale'=> '0.59', + 'XS::APItest' => '0.21', + 'XS::APItest::KeywordRPN'=> '0.005', + 'XSLoader' => '0.11', + 'bigint' => '0.25', + 'bignum' => '0.25', + 'bigrat' => '0.25', + 'blib' => '1.06', + 'open' => '1.08', + 'threads::shared' => '1.33_03', + 'warnings' => '1.11', + 'warnings::register' => '1.02', + }, + removed => { + } + }, + 5.013006 => { + delta_from => 5.013005, + changed => { + 'Archive::Extract' => '0.44', + 'B' => '1.24', + 'B::Deparse' => '0.99', + 'CPAN' => '1.94_61', + 'CPAN::FTP' => '5.5005', + 'CPAN::Queue' => '5.5001', + 'CPAN::Version' => '5.5001', + 'Carp' => '1.19', + 'Carp::Heavy' => '1.19', + 'Compress::Raw::Bzip2' => '2.031', + 'Cwd' => '3.34', + 'Data::Dumper' => '2.129', + 'Devel::Peek' => '1.05', + 'Digest::MD5' => '2.51', + 'ExtUtils::Constant::Base'=> '0.05', + 'ExtUtils::Constant::ProxySubs'=> '0.07', + 'ExtUtils::Embed' => '1.29', + 'ExtUtils::XSSymSet' => '1.2', + 'Fcntl' => '1.09', + 'File::DosGlob' => '1.03', + 'File::Find' => '1.18', + 'File::Glob' => '1.09', + 'File::Spec' => '3.33', + 'File::Spec::Cygwin' => '3.33', + 'File::Spec::Epoc' => '3.33', + 'File::Spec::Functions' => '3.33', + 'File::Spec::Mac' => '3.33', + 'File::Spec::OS2' => '3.33', + 'File::Spec::Unix' => '3.33', + 'File::Spec::VMS' => '3.33', + 'File::Spec::Win32' => '3.33', + 'GDBM_File' => '1.11', + 'Hash::Util::FieldHash' => '1.05', + 'I18N::Langinfo' => '0.06', + 'IPC::Cmd' => '0.64', + 'IPC::Open3' => '1.07', + 'Locale::Codes' => '3.14', + 'Locale::Codes::Country'=> '3.14', + 'Locale::Codes::Currency'=> '3.14', + 'Locale::Codes::Language'=> '3.14', + 'Locale::Codes::Script' => '3.14', + 'Locale::Constants' => '3.14', + 'Locale::Country' => '3.14', + 'Locale::Currency' => '3.14', + 'Locale::Language' => '3.14', + 'Locale::Maketext' => '1.16', + 'Locale::Script' => '3.14', + 'Math::BigFloat' => '1.63', + 'Math::BigInt' => '1.97', + 'Math::BigInt::Calc' => '0.55', + 'Math::BigInt::CalcEmu' => '0.07', + 'Module::CoreList' => '2.40', + 'NDBM_File' => '1.09', + 'NEXT' => '0.65', + 'ODBM_File' => '1.08', + 'Opcode' => '1.16', + 'POSIX' => '1.21', + 'PerlIO::encoding' => '0.13', + 'PerlIO::scalar' => '0.10', + 'PerlIO::via' => '0.10', + 'Pod::Man' => '2.25', + 'Pod::Text' => '3.15', + 'SDBM_File' => '1.07', + 'Socket' => '1.90', + 'Sys::Hostname' => '1.13', + 'Tie::Hash::NamedCapture'=> '0.07', + 'Unicode::Collate' => '0.63', + 'Unicode::Collate::Locale'=> '0.63', + 'Unicode::Normalize' => '1.07', + 'XS::APItest' => '0.23', + 'XSLoader' => '0.13', + 'attributes' => '0.13', + 'charnames' => '1.16', + 'if' => '0.06', + 'mro' => '1.04', + 'overload' => '1.11', + 're' => '0.13', + 'sigtrap' => '1.05', + 'threads' => '1.81_01', + 'threads::shared' => '1.34', + }, + removed => { + 'XS::APItest::KeywordRPN'=> 1, + } + }, + 5.013007 => { + delta_from => 5.013006, + changed => { + 'Archive::Extract' => '0.46', + 'Archive::Tar' => '1.72', + 'Archive::Tar::Constant'=> '1.72', + 'Archive::Tar::File' => '1.72', + 'AutoLoader' => '5.71', + 'B' => '1.26', + 'B::Concise' => '0.81', + 'B::Deparse' => '1.01', + 'CGI' => '3.50', + 'CPAN' => '1.94_62', + 'CPANPLUS' => '0.9010', + 'CPANPLUS::Dist::Build' => '0.50', + 'CPANPLUS::Dist::Build::Constants'=> '0.50', + 'CPANPLUS::Internals' => '0.9010', + 'CPANPLUS::Shell::Default'=> '0.9010', + 'Data::Dumper' => '2.130_01', + 'DynaLoader' => '1.11', + 'ExtUtils::Constant' => '0.23', + 'ExtUtils::Constant::ProxySubs'=> '0.08', + 'Fcntl' => '1.10', + 'File::Fetch' => '0.28', + 'File::Glob' => '1.10', + 'File::stat' => '1.04', + 'GDBM_File' => '1.12', + 'Hash::Util' => '0.10', + 'Hash::Util::FieldHash' => '1.06', + 'I18N::Langinfo' => '0.07', + 'Locale::Maketext' => '1.17', + 'Locale::Maketext::Guts'=> '1.17', + 'Locale::Maketext::GutsLoader'=> '1.17', + 'MIME::Base64' => '3.10', + 'MIME::QuotedPrint' => '3.10', + 'Math::BigFloat' => '1.99_01', + 'Math::BigInt' => '1.99_01', + 'Math::BigInt::Calc' => '1.99_01', + 'Math::BigInt::CalcEmu' => '1.99_01', + 'Math::BigInt::FastCalc'=> '0.24_01', + 'Math::BigRat' => '0.26_01', + 'Module::CoreList' => '2.41', + 'NDBM_File' => '1.10', + 'ODBM_File' => '1.09', + 'Opcode' => '1.17', + 'POSIX' => '1.22', + 'Pod::Simple' => '3.15', + 'Pod::Simple::BlackBox' => '3.15', + 'Pod::Simple::Checker' => '3.15', + 'Pod::Simple::Debug' => '3.15', + 'Pod::Simple::DumpAsText'=> '3.15', + 'Pod::Simple::DumpAsXML'=> '3.15', + 'Pod::Simple::HTML' => '3.15', + 'Pod::Simple::HTMLBatch'=> '3.15', + 'Pod::Simple::LinkSection'=> '3.15', + 'Pod::Simple::Methody' => '3.15', + 'Pod::Simple::Progress' => '3.15', + 'Pod::Simple::PullParser'=> '3.15', + 'Pod::Simple::PullParserEndToken'=> '3.15', + 'Pod::Simple::PullParserStartToken'=> '3.15', + 'Pod::Simple::PullParserTextToken'=> '3.15', + 'Pod::Simple::PullParserToken'=> '3.15', + 'Pod::Simple::RTF' => '3.15', + 'Pod::Simple::Search' => '3.15', + 'Pod::Simple::SimpleTree'=> '3.15', + 'Pod::Simple::Text' => '3.15', + 'Pod::Simple::TextContent'=> '3.15', + 'Pod::Simple::TiedOutFH'=> '3.15', + 'Pod::Simple::Transcode'=> '3.15', + 'Pod::Simple::TranscodeDumb'=> '3.15', + 'Pod::Simple::TranscodeSmart'=> '3.15', + 'Pod::Simple::XHTML' => '3.15', + 'Pod::Simple::XMLOutStream'=> '3.15', + 'SDBM_File' => '1.08', + 'Safe' => '2.29', + 'SelfLoader' => '1.18', + 'Socket' => '1.91', + 'Storable' => '2.24', + 'Sys::Hostname' => '1.14', + 'Unicode' => '6.0.0', + 'Unicode::Collate' => '0.67', + 'Unicode::Collate::CJK::Big5'=> '0.65', + 'Unicode::Collate::CJK::GB2312'=> '0.65', + 'Unicode::Collate::CJK::JISX0208'=> '0.64', + 'Unicode::Collate::CJK::Korean'=> '0.66', + 'Unicode::Collate::CJK::Pinyin'=> '0.65', + 'Unicode::Collate::CJK::Stroke'=> '0.65', + 'Unicode::Collate::Locale'=> '0.67', + 'XS::APItest' => '0.26', + 'XS::Typemap' => '0.04', + 'charnames' => '1.17', + 'mro' => '1.05', + 'parent' => '0.224', + 're' => '0.14', + 'threads' => '1.81_02', + }, + removed => { + } + }, + 5.013008 => { + delta_from => 5.013007, + changed => { + 'Archive::Tar' => '1.74', + 'Archive::Tar::Constant'=> '1.74', + 'Archive::Tar::File' => '1.74', + 'B' => '1.27', + 'B::Concise' => '0.82', + 'B::Deparse' => '1.02', + 'Carp::Heavy' => '1.17', + 'Cwd' => '3.35', + 'Data::Dumper' => '2.130_02', + 'Devel::Peek' => '1.06', + 'Devel::SelfStubber' => '1.05', + 'Digest::SHA' => '5.50', + 'Dumpvalue' => '1.15', + 'DynaLoader' => '1.12', + 'Env' => '1.02', + 'Exporter::Heavy' => '5.64_01', + 'ExtUtils::CBuilder' => '0.280201', + 'ExtUtils::CBuilder::Base'=> '0.280201', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280201', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280201', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280201', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280201', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280201', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280201', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280201', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280201', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280201', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280201', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280201', + 'ExtUtils::Constant::Utils'=> '0.03', + 'ExtUtils::Embed' => '1.30', + 'ExtUtils::ParseXS' => '2.2208', + 'Fatal' => '2.1001', + 'Fcntl' => '1.11', + 'File::CheckTree' => '4.41', + 'File::Glob' => '1.11', + 'GDBM_File' => '1.13', + 'Hash::Util::FieldHash' => '1.07', + 'I18N::Collate' => '1.02', + 'IO' => '1.25_03', + 'IPC::Cmd' => '0.66', + 'IPC::Open3' => '1.08', + 'Locale::Codes' => '3.15', + 'Locale::Codes::Country'=> '3.15', + 'Locale::Codes::Currency'=> '3.15', + 'Locale::Codes::Language'=> '3.15', + 'Locale::Codes::Script' => '3.15', + 'Locale::Constants' => '3.15', + 'Locale::Country' => '3.15', + 'Locale::Currency' => '3.15', + 'Locale::Language' => '3.15', + 'Locale::Script' => '3.15', + 'MIME::Base64' => '3.13', + 'MIME::QuotedPrint' => '3.13', + 'Math::BigFloat' => '1.99_02', + 'Math::BigInt' => '1.99_02', + 'Math::BigInt::Calc' => '1.99_02', + 'Math::BigInt::CalcEmu' => '1.99_02', + 'Memoize' => '1.02', + 'Memoize::AnyDBM_File' => '1.02', + 'Memoize::Expire' => '1.02', + 'Memoize::ExpireFile' => '1.02', + 'Memoize::ExpireTest' => '1.02', + 'Memoize::NDBM_File' => '1.02', + 'Memoize::SDBM_File' => '1.02', + 'Memoize::Storable' => '1.02', + 'Module::CoreList' => '2.43', + 'NDBM_File' => '1.11', + 'Net::Ping' => '2.37', + 'ODBM_File' => '1.10', + 'Opcode' => '1.18', + 'POSIX' => '1.23', + 'PerlIO::encoding' => '0.14', + 'PerlIO::scalar' => '0.11', + 'PerlIO::via' => '0.11', + 'SDBM_File' => '1.09', + 'Socket' => '1.92', + 'Storable' => '2.25', + 'Time::HiRes' => '1.9721_01', + 'Unicode::Collate' => '0.6801', + 'Unicode::Collate::Locale'=> '0.68', + 'Unicode::Normalize' => '1.08', + 'Unicode::UCD' => '0.30', + 'Win32' => '0.41', + 'XS::APItest' => '0.27', + 'autodie' => '2.1001', + 'autodie::exception' => '2.1001', + 'autodie::exception::system'=> '2.1001', + 'autodie::hints' => '2.1001', + 'feature' => '1.19', + 'if' => '0.0601', + 'mro' => '1.06', + 'overload' => '1.12', + 're' => '0.15', + 'threads' => '1.81_03', + 'threads::shared' => '1.35', + 'version' => '0.86', + }, + removed => { + } + }, + 5.013009 => { + delta_from => 5.013008, + changed => { + 'Archive::Extract' => '0.48', + 'Archive::Tar' => '1.76', + 'Archive::Tar::Constant'=> '1.76', + 'Archive::Tar::File' => '1.76', + 'B::Concise' => '0.83', + 'B::Deparse' => '1.03', + 'B::Lint' => '1.13', + 'Benchmark' => '1.12', + 'CGI' => '3.51', + 'CGI::Carp' => '3.51', + 'CGI::Cookie' => '1.30', + 'CGI::Push' => '1.05', + 'CGI::Util' => '3.51', + 'CPAN' => '1.94_63', + 'CPAN::HTTP::Client' => '1.94', + 'CPAN::HTTP::Credentials'=> '1.94', + 'CPAN::Meta::YAML' => '0.003', + 'CPANPLUS' => '0.9011', + 'CPANPLUS::Dist::Build' => '0.52', + 'CPANPLUS::Dist::Build::Constants'=> '0.52', + 'CPANPLUS::Internals' => '0.9011', + 'CPANPLUS::Shell::Default'=> '0.9011', + 'Carp::Heavy' => '1.19', + 'Compress::Raw::Bzip2' => '2.033', + 'Compress::Raw::Zlib' => '2.033', + 'Compress::Zlib' => '2.033', + 'Cwd' => '3.36', + 'DBM_Filter' => '0.04', + 'DB_File' => '1.821', + 'Devel::Peek' => '1.07', + 'DirHandle' => '1.04', + 'Dumpvalue' => '1.16', + 'Encode' => '2.42', + 'Encode::Alias' => '2.13', + 'Encode::MIME::Header' => '2.13', + 'Exporter::Heavy' => '5.64_03', + 'ExtUtils::Install' => '1.56', + 'ExtUtils::ParseXS' => '2.2209', + 'File::Basename' => '2.80', + 'File::Copy' => '2.21', + 'File::DosGlob' => '1.04', + 'File::Fetch' => '0.32', + 'File::Find' => '1.19', + 'File::Spec::Mac' => '3.34', + 'File::Spec::VMS' => '3.34', + 'File::stat' => '1.05', + 'HTTP::Tiny' => '0.009', + 'Hash::Util::FieldHash' => '1.08', + 'IO::Compress::Adapter::Bzip2'=> '2.033', + 'IO::Compress::Adapter::Deflate'=> '2.033', + 'IO::Compress::Adapter::Identity'=> '2.033', + 'IO::Compress::Base' => '2.033', + 'IO::Compress::Base::Common'=> '2.033', + 'IO::Compress::Bzip2' => '2.033', + 'IO::Compress::Deflate' => '2.033', + 'IO::Compress::Gzip' => '2.033', + 'IO::Compress::Gzip::Constants'=> '2.033', + 'IO::Compress::RawDeflate'=> '2.033', + 'IO::Compress::Zip' => '2.033', + 'IO::Compress::Zip::Constants'=> '2.033', + 'IO::Compress::Zlib::Constants'=> '2.033', + 'IO::Compress::Zlib::Extra'=> '2.033', + 'IO::Handle' => '1.29', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.033', + 'IO::Uncompress::Adapter::Identity'=> '2.033', + 'IO::Uncompress::Adapter::Inflate'=> '2.033', + 'IO::Uncompress::AnyInflate'=> '2.033', + 'IO::Uncompress::AnyUncompress'=> '2.033', + 'IO::Uncompress::Base' => '2.033', + 'IO::Uncompress::Bunzip2'=> '2.033', + 'IO::Uncompress::Gunzip'=> '2.033', + 'IO::Uncompress::Inflate'=> '2.033', + 'IO::Uncompress::RawInflate'=> '2.033', + 'IO::Uncompress::Unzip' => '2.033', + 'IPC::Cmd' => '0.68', + 'IPC::Open3' => '1.09', + 'JSON::PP' => '2.27103', + 'JSON::PP::Boolean' => undef, + 'Locale::Maketext' => '1.18', + 'Log::Message' => '0.04', + 'Log::Message::Config' => '0.04', + 'Log::Message::Handlers'=> '0.04', + 'Log::Message::Item' => '0.04', + 'Log::Message::Simple' => '0.08', + 'Math::BigFloat' => '1.99_03', + 'Math::BigInt' => '1.99_03', + 'Math::BigInt::Calc' => '1.99_03', + 'Math::BigInt::FastCalc'=> '0.24_02', + 'Math::BigRat' => '0.26_02', + 'Module::CoreList' => '2.42_01', + 'Module::Load::Conditional'=> '0.40', + 'Module::Metadata' => '1.000003', + 'Net::Ping' => '2.38', + 'OS2::Process' => '1.05', + 'Object::Accessor' => '0.38', + 'POSIX' => '1.24', + 'Params::Check' => '0.28', + 'Perl::OSType' => '1.002', + 'Pod::LaTeX' => '0.59', + 'Pod::Perldoc' => '3.15_03', + 'Socket' => '1.93', + 'Storable' => '2.26', + 'Sys::Hostname' => '1.15', + 'Term::UI' => '0.24', + 'Thread::Queue' => '2.12', + 'Thread::Semaphore' => '2.12', + 'Time::Local' => '1.2000', + 'UNIVERSAL' => '1.08', + 'Unicode::Normalize' => '1.10', + 'Win32' => '0.44', + 'bigint' => '0.26', + 'bignum' => '0.26', + 'bigrat' => '0.26', + 'charnames' => '1.18', + 'diagnostics' => '1.21', + 're' => '0.16', + 'threads' => '1.83', + 'threads::shared' => '1.36', + 'version' => '0.88', + }, + removed => { + } + }, + 5.01301 => { + delta_from => 5.013009, + changed => { + 'Attribute::Handlers' => '0.89', + 'B' => '1.28', + 'B::Showlex' => '1.03', + 'CGI' => '3.52', + 'CPAN' => '1.94_65', + 'CPAN::Distribution' => '1.9601', + 'CPAN::FTP::netrc' => '1.01', + 'CPAN::FirstTime' => '5.5303', + 'CPAN::HandleConfig' => '5.5003', + 'CPAN::Meta' => '2.110440', + 'CPAN::Meta::Converter' => '2.110440', + 'CPAN::Meta::Feature' => '2.110440', + 'CPAN::Meta::History' => '2.110440', + 'CPAN::Meta::Prereqs' => '2.110440', + 'CPAN::Meta::Spec' => '2.110440', + 'CPAN::Meta::Validator' => '2.110440', + 'CPAN::Shell' => '5.5002', + 'CPANPLUS' => '0.9101', + 'CPANPLUS::Internals' => '0.9101', + 'CPANPLUS::Shell::Default'=> '0.9101', + 'Carp' => '1.20', + 'Carp::Heavy' => '1.20', + 'Cwd' => '3.37', + 'Devel::DProf' => '20110217.00', + 'DynaLoader' => '1.13', + 'ExtUtils::CBuilder' => '0.280202', + 'ExtUtils::CBuilder::Base'=> '0.280202', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280202', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280202', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280202', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280202', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280202', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280202', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280202', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280202', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280202', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280202', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280202', + 'File::Copy' => '2.22', + 'Filter::Simple' => '0.86', + 'HTTP::Tiny' => '0.010', + 'I18N::LangTags::Detect'=> '1.05', + 'IO::Select' => '1.18', + 'IPC::Cmd' => '0.70', + 'Locale::Maketext' => '1.19', + 'Math::BigFloat' => '1.992', + 'Math::BigInt' => '1.992', + 'Math::BigInt::Calc' => '1.992', + 'Math::BigInt::CalcEmu' => '1.992', + 'Module::Build' => '0.37_05', + 'Module::Build::Base' => '0.37_05', + 'Module::Build::Compat' => '0.37_05', + 'Module::Build::Config' => '0.37_05', + 'Module::Build::Cookbook'=> '0.37_05', + 'Module::Build::Dumper' => '0.37_05', + 'Module::Build::ModuleInfo'=> '0.37_05', + 'Module::Build::Notes' => '0.37_05', + 'Module::Build::PPMMaker'=> '0.37_05', + 'Module::Build::Platform::Amiga'=> '0.37_05', + 'Module::Build::Platform::Default'=> '0.37_05', + 'Module::Build::Platform::EBCDIC'=> '0.37_05', + 'Module::Build::Platform::MPEiX'=> '0.37_05', + 'Module::Build::Platform::MacOS'=> '0.37_05', + 'Module::Build::Platform::RiscOS'=> '0.37_05', + 'Module::Build::Platform::Unix'=> '0.37_05', + 'Module::Build::Platform::VMS'=> '0.37_05', + 'Module::Build::Platform::VOS'=> '0.37_05', + 'Module::Build::Platform::Windows'=> '0.37_05', + 'Module::Build::Platform::aix'=> '0.37_05', + 'Module::Build::Platform::cygwin'=> '0.37_05', + 'Module::Build::Platform::darwin'=> '0.37_05', + 'Module::Build::Platform::os2'=> '0.37_05', + 'Module::Build::PodParser'=> '0.37_05', + 'Module::Build::Version'=> '0.87', + 'Module::Build::YAML' => '1.41', + 'Module::CoreList' => '2.45', + 'Module::Load::Conditional'=> '0.44', + 'Module::Metadata' => '1.000004', + 'OS2::Process' => '1.06', + 'Parse::CPAN::Meta' => '1.4401', + 'Pod::Html' => '1.1', + 'Socket' => '1.94', + 'Term::UI' => '0.26', + 'Unicode::Collate' => '0.72', + 'Unicode::Collate::Locale'=> '0.71', + 'Unicode::UCD' => '0.31', + 'VMS::DCLsym' => '1.05', + 'Version::Requirements' => '0.101020', + 'bigrat' => '0.27', + 'deprecate' => '0.02', + 'diagnostics' => '1.22', + 'inc::latest' => '0.37_05', + 'overload' => '1.13', + 're' => '0.17', + 'utf8' => '1.09', + 'warnings' => '1.12', + }, + removed => { + } + }, + 5.013011 => { + delta_from => 5.01301, + changed => { + 'App::Prove' => '3.23', + 'App::Prove::State' => '3.23', + 'App::Prove::State::Result'=> '3.23', + 'App::Prove::State::Result::Test'=> '3.23', + 'B' => '1.29', + 'CPAN' => '1.9600', + 'CPAN::Author' => '5.5001', + 'CPAN::CacheMgr' => '5.5001', + 'CPAN::Distribution' => '1.9602', + 'CPAN::Exception::blocked_urllist'=> '1.001', + 'CPAN::HTTP::Client' => '1.9600', + 'CPAN::HTTP::Credentials'=> '1.9600', + 'CPAN::Index' => '1.9600', + 'CPAN::LWP::UserAgent' => '1.9600', + 'CPAN::Mirrors' => '1.9600', + 'CPAN::Module' => '5.5001', + 'CPANPLUS' => '0.9103', + 'CPANPLUS::Dist::Build' => '0.54', + 'CPANPLUS::Dist::Build::Constants'=> '0.54', + 'CPANPLUS::Internals' => '0.9103', + 'CPANPLUS::Shell::Default'=> '0.9103', + 'Cwd' => '3.36', + 'Devel::DProf' => '20110228.00', + 'Digest::SHA' => '5.61', + 'ExtUtils::Command' => '1.17', + 'File::Basename' => '2.81', + 'File::Copy' => '2.21', + 'File::Glob' => '1.12', + 'GDBM_File' => '1.14', + 'HTTP::Tiny' => '0.011', + 'Hash::Util' => '0.11', + 'Hash::Util::FieldHash' => '1.09', + 'I18N::Langinfo' => '0.08', + 'IO' => '1.25_04', + 'IO::Dir' => '1.08', + 'IO::File' => '1.15', + 'IO::Handle' => '1.30', + 'IO::Pipe' => '1.14', + 'IO::Poll' => '0.08', + 'IO::Select' => '1.20', + 'JSON::PP' => '2.27105', + 'Locale::Codes' => '3.16', + 'Locale::Codes::Country'=> '3.16', + 'Locale::Codes::Currency'=> '3.16', + 'Locale::Codes::Language'=> '3.16', + 'Locale::Codes::Script' => '3.16', + 'Locale::Constants' => '3.16', + 'Locale::Country' => '3.16', + 'Locale::Currency' => '3.16', + 'Locale::Language' => '3.16', + 'Locale::Script' => '3.16', + 'Math::BigFloat' => '1.993', + 'Math::BigInt' => '1.994', + 'Math::BigInt::Calc' => '1.993', + 'Math::BigInt::CalcEmu' => '1.993', + 'Math::BigInt::FastCalc'=> '0.28', + 'Module::Build' => '0.3800', + 'Module::Build::Base' => '0.3800', + 'Module::Build::Compat' => '0.3800', + 'Module::Build::Config' => '0.3800', + 'Module::Build::Cookbook'=> '0.3800', + 'Module::Build::Dumper' => '0.3800', + 'Module::Build::ModuleInfo'=> '0.3800', + 'Module::Build::Notes' => '0.3800', + 'Module::Build::PPMMaker'=> '0.3800', + 'Module::Build::Platform::Amiga'=> '0.3800', + 'Module::Build::Platform::Default'=> '0.3800', + 'Module::Build::Platform::EBCDIC'=> '0.3800', + 'Module::Build::Platform::MPEiX'=> '0.3800', + 'Module::Build::Platform::MacOS'=> '0.3800', + 'Module::Build::Platform::RiscOS'=> '0.3800', + 'Module::Build::Platform::Unix'=> '0.3800', + 'Module::Build::Platform::VMS'=> '0.3800', + 'Module::Build::Platform::VOS'=> '0.3800', + 'Module::Build::Platform::Windows'=> '0.3800', + 'Module::Build::Platform::aix'=> '0.3800', + 'Module::Build::Platform::cygwin'=> '0.3800', + 'Module::Build::Platform::darwin'=> '0.3800', + 'Module::Build::Platform::os2'=> '0.3800', + 'Module::Build::PodParser'=> '0.3800', + 'Module::CoreList' => '2.46', + 'NDBM_File' => '1.12', + 'Pod::Simple' => '3.16', + 'Pod::Simple::BlackBox' => '3.16', + 'Pod::Simple::Checker' => '3.16', + 'Pod::Simple::Debug' => '3.16', + 'Pod::Simple::DumpAsText'=> '3.16', + 'Pod::Simple::DumpAsXML'=> '3.16', + 'Pod::Simple::HTML' => '3.16', + 'Pod::Simple::HTMLBatch'=> '3.16', + 'Pod::Simple::LinkSection'=> '3.16', + 'Pod::Simple::Methody' => '3.16', + 'Pod::Simple::Progress' => '3.16', + 'Pod::Simple::PullParser'=> '3.16', + 'Pod::Simple::PullParserEndToken'=> '3.16', + 'Pod::Simple::PullParserStartToken'=> '3.16', + 'Pod::Simple::PullParserTextToken'=> '3.16', + 'Pod::Simple::PullParserToken'=> '3.16', + 'Pod::Simple::RTF' => '3.16', + 'Pod::Simple::Search' => '3.16', + 'Pod::Simple::SimpleTree'=> '3.16', + 'Pod::Simple::Text' => '3.16', + 'Pod::Simple::TextContent'=> '3.16', + 'Pod::Simple::TiedOutFH'=> '3.16', + 'Pod::Simple::Transcode'=> '3.16', + 'Pod::Simple::TranscodeDumb'=> '3.16', + 'Pod::Simple::TranscodeSmart'=> '3.16', + 'Pod::Simple::XHTML' => '3.16', + 'Pod::Simple::XMLOutStream'=> '3.16', + 'Storable' => '2.27', + 'Sys::Hostname' => '1.16', + 'TAP::Base' => '3.23', + 'TAP::Formatter::Base' => '3.23', + 'TAP::Formatter::Color' => '3.23', + 'TAP::Formatter::Console'=> '3.23', + 'TAP::Formatter::Console::ParallelSession'=> '3.23', + 'TAP::Formatter::Console::Session'=> '3.23', + 'TAP::Formatter::File' => '3.23', + 'TAP::Formatter::File::Session'=> '3.23', + 'TAP::Formatter::Session'=> '3.23', + 'TAP::Harness' => '3.23', + 'TAP::Object' => '3.23', + 'TAP::Parser' => '3.23', + 'TAP::Parser::Aggregator'=> '3.23', + 'TAP::Parser::Grammar' => '3.23', + 'TAP::Parser::Iterator' => '3.23', + 'TAP::Parser::Iterator::Array'=> '3.23', + 'TAP::Parser::Iterator::Process'=> '3.23', + 'TAP::Parser::Iterator::Stream'=> '3.23', + 'TAP::Parser::IteratorFactory'=> '3.23', + 'TAP::Parser::Multiplexer'=> '3.23', + 'TAP::Parser::Result' => '3.23', + 'TAP::Parser::Result::Bailout'=> '3.23', + 'TAP::Parser::Result::Comment'=> '3.23', + 'TAP::Parser::Result::Plan'=> '3.23', + 'TAP::Parser::Result::Pragma'=> '3.23', + 'TAP::Parser::Result::Test'=> '3.23', + 'TAP::Parser::Result::Unknown'=> '3.23', + 'TAP::Parser::Result::Version'=> '3.23', + 'TAP::Parser::Result::YAML'=> '3.23', + 'TAP::Parser::ResultFactory'=> '3.23', + 'TAP::Parser::Scheduler'=> '3.23', + 'TAP::Parser::Scheduler::Job'=> '3.23', + 'TAP::Parser::Scheduler::Spinner'=> '3.23', + 'TAP::Parser::Source' => '3.23', + 'TAP::Parser::SourceHandler'=> '3.23', + 'TAP::Parser::SourceHandler::Executable'=> '3.23', + 'TAP::Parser::SourceHandler::File'=> '3.23', + 'TAP::Parser::SourceHandler::Handle'=> '3.23', + 'TAP::Parser::SourceHandler::Perl'=> '3.23', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.23', + 'TAP::Parser::Utils' => '3.23', + 'TAP::Parser::YAMLish::Reader'=> '3.23', + 'TAP::Parser::YAMLish::Writer'=> '3.23', + 'Test::Builder' => '0.98', + 'Test::Builder::Module' => '0.98', + 'Test::Builder::Tester' => '1.22', + 'Test::Builder::Tester::Color'=> '1.22', + 'Test::Harness' => '3.23', + 'Test::More' => '0.98', + 'Test::Simple' => '0.98', + 'Tie::Hash::NamedCapture'=> '0.08', + 'Tie::RefHash' => '1.39', + 'Unicode::Collate' => '0.73', + 'Unicode::Collate::Locale'=> '0.73', + 'Unicode::UCD' => '0.32', + 'XS::Typemap' => '0.05', + 'attributes' => '0.14', + 'base' => '2.16', + 'inc::latest' => '0.3800', + 'mro' => '1.07', + 'parent' => '0.225', + }, + removed => { + } + }, + 5.014 => { + delta_from => 5.013011, + changed => { + 'ExtUtils::CBuilder' => '0.280203', + 'ExtUtils::CBuilder::Base'=> '0.280203', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280203', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280203', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280203', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280203', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280203', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280203', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280203', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280203', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280203', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280203', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280203', + 'ExtUtils::ParseXS' => '2.2210', + 'File::Basename' => '2.82', + 'HTTP::Tiny' => '0.012', + 'IO::Handle' => '1.31', + 'Module::CoreList' => '2.49', + 'PerlIO' => '1.07', + 'Pod::Html' => '1.11', + 'XS::APItest' => '0.28', + 'bigint' => '0.27', + 'bignum' => '0.27', + 'bigrat' => '0.28', + 'constant' => '1.21', + 'feature' => '1.20', + 're' => '0.18', + 'threads::shared' => '1.37', + }, + removed => { + } + }, + 5.014001 => { + delta_from => 5.014, + changed => { + 'B::Deparse' => '1.04', + 'Module::CoreList' => '2.49_01', + 'Pod::Perldoc' => '3.15_04', + }, + removed => { + } + }, + 5.014002 => { + delta_from => 5.014001, + changed => { + 'CPAN' => '1.9600_01', + 'CPAN::Distribution' => '1.9602_01', + 'Devel::DProf::dprof::V'=> undef, + 'Encode' => '2.42_01', + 'File::Glob' => '1.13', + 'Module::CoreList' => '2.49_02', + 'PerlIO::scalar' => '0.11_01', + 'Time::Piece::Seconds' => undef, + }, + removed => { + } + }, + 5.014003 => { + delta_from => 5.014002, + changed => { + 'Digest' => '1.16_01', + 'IPC::Open3' => '1.09_01', + 'Module::CoreList' => '2.49_04', + }, + removed => { + } + }, + 5.014004 => { + delta_from => 5.014003, + changed => { + 'Encode' => '2.42_02', + 'IPC::Open3' => '1.0901', + 'Module::CoreList' => '2.49_06', + }, + removed => { + } + }, + 5.015 => { + delta_from => 5.014001, + changed => { + 'Archive::Extract' => '0.52', + 'Attribute::Handlers' => '0.91', + 'B' => '1.30', + 'B::Concise' => '0.84', + 'B::Deparse' => '1.05', + 'Benchmark' => '1.13', + 'CGI' => '3.54', + 'CGI::Util' => '3.53', + 'CPAN::Meta' => '2.110930', + 'CPAN::Meta::Converter' => '2.110930', + 'CPAN::Meta::Feature' => '2.110930', + 'CPAN::Meta::History' => '2.110930', + 'CPAN::Meta::Prereqs' => '2.110930', + 'CPAN::Meta::Spec' => '2.110930', + 'CPAN::Meta::Validator' => '2.110930', + 'CPANPLUS' => '0.9105', + 'CPANPLUS::Dist::Build' => '0.56', + 'CPANPLUS::Dist::Build::Constants'=> '0.56', + 'CPANPLUS::Internals' => '0.9105', + 'CPANPLUS::Shell::Default'=> '0.9105', + 'Compress::Raw::Bzip2' => '2.035', + 'Compress::Raw::Zlib' => '2.035', + 'Compress::Zlib' => '2.035', + 'DB_File' => '1.822', + 'Data::Dumper' => '2.131', + 'Devel::Peek' => '1.08', + 'Digest::SHA' => '5.62', + 'Encode' => '2.43', + 'Encode::Alias' => '2.14', + 'ExtUtils::CBuilder' => '0.280204', + 'ExtUtils::CBuilder::Base'=> '0.280204', + 'Fatal' => '2.10', + 'File::Spec::Win32' => '3.34', + 'Filter::Simple' => '0.87', + 'Filter::Util::Call' => '1.39', + 'FindBin' => '1.51', + 'Hash::Util::FieldHash' => '1.10', + 'I18N::LangTags' => '0.36', + 'IO::Compress::Adapter::Bzip2'=> '2.035', + 'IO::Compress::Adapter::Deflate'=> '2.035', + 'IO::Compress::Adapter::Identity'=> '2.035', + 'IO::Compress::Base' => '2.035', + 'IO::Compress::Base::Common'=> '2.035', + 'IO::Compress::Bzip2' => '2.035', + 'IO::Compress::Deflate' => '2.035', + 'IO::Compress::Gzip' => '2.035', + 'IO::Compress::Gzip::Constants'=> '2.035', + 'IO::Compress::RawDeflate'=> '2.035', + 'IO::Compress::Zip' => '2.035', + 'IO::Compress::Zip::Constants'=> '2.035', + 'IO::Compress::Zlib::Constants'=> '2.035', + 'IO::Compress::Zlib::Extra'=> '2.035', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.035', + 'IO::Uncompress::Adapter::Identity'=> '2.035', + 'IO::Uncompress::Adapter::Inflate'=> '2.035', + 'IO::Uncompress::AnyInflate'=> '2.035', + 'IO::Uncompress::AnyUncompress'=> '2.035', + 'IO::Uncompress::Base' => '2.035', + 'IO::Uncompress::Bunzip2'=> '2.035', + 'IO::Uncompress::Gunzip'=> '2.035', + 'IO::Uncompress::Inflate'=> '2.035', + 'IO::Uncompress::RawInflate'=> '2.035', + 'IO::Uncompress::Unzip' => '2.035', + 'IPC::Open2' => '1.04', + 'IPC::Open3' => '1.11', + 'JSON::PP' => '2.27200', + 'Math::BigFloat' => '1.994', + 'Math::BigInt' => '1.995', + 'Math::Complex' => '1.57', + 'Math::Trig' => '1.21', + 'Module::CoreList' => '2.51', + 'ODBM_File' => '1.11', + 'Object::Accessor' => '0.42', + 'Opcode' => '1.19', + 'PerlIO::encoding' => '0.15', + 'PerlIO::scalar' => '0.12', + 'Pod::Perldoc' => '3.15_05', + 'Storable' => '2.28', + 'Sys::Syslog' => '0.29', + 'Time::HiRes' => '1.9722', + 'Unicode::Collate' => '0.76', + 'Unicode::Collate::CJK::Pinyin'=> '0.76', + 'Unicode::Collate::CJK::Stroke'=> '0.76', + 'Unicode::Collate::Locale'=> '0.76', + 'Unicode::Normalize' => '1.12', + 'XS::APItest' => '0.29', + 'XSLoader' => '0.15', + 'autodie' => '2.10', + 'autodie::exception' => '2.10', + 'autodie::exception::system'=> '2.10', + 'autodie::hints' => '2.10', + 'base' => '2.17', + 'charnames' => '1.22', + 'constant' => '1.22', + 'feature' => '1.21', + 'mro' => '1.08', + 'overload' => '1.14', + 'threads::shared' => '1.38', + 'vmsish' => '1.03', + }, + removed => { + 'Devel::DProf' => 1, + 'Shell' => 1, + } + }, + 5.015001 => { + delta_from => 5.015, + changed => { + 'B::Deparse' => '1.06', + 'CGI' => '3.55', + 'CPAN::Meta' => '2.110930001', + 'CPAN::Meta::Converter' => '2.110930001', + 'CPANPLUS' => '0.9108', + 'CPANPLUS::Internals' => '0.9108', + 'CPANPLUS::Shell::Default'=> '0.9108', + 'Carp' => '1.21', + 'Carp::Heavy' => '1.21', + 'Compress::Raw::Bzip2' => '2.037', + 'Compress::Raw::Zlib' => '2.037', + 'Compress::Zlib' => '2.037', + 'Cwd' => '3.37', + 'Env' => '1.03', + 'ExtUtils::Command::MM' => '6.58', + 'ExtUtils::Liblist' => '6.58', + 'ExtUtils::Liblist::Kid'=> '6.58', + 'ExtUtils::MM' => '6.58', + 'ExtUtils::MM_AIX' => '6.58', + 'ExtUtils::MM_Any' => '6.58', + 'ExtUtils::MM_BeOS' => '6.58', + 'ExtUtils::MM_Cygwin' => '6.58', + 'ExtUtils::MM_DOS' => '6.58', + 'ExtUtils::MM_Darwin' => '6.58', + 'ExtUtils::MM_MacOS' => '6.58', + 'ExtUtils::MM_NW5' => '6.58', + 'ExtUtils::MM_OS2' => '6.58', + 'ExtUtils::MM_QNX' => '6.58', + 'ExtUtils::MM_UWIN' => '6.58', + 'ExtUtils::MM_Unix' => '6.58', + 'ExtUtils::MM_VMS' => '6.58', + 'ExtUtils::MM_VOS' => '6.58', + 'ExtUtils::MM_Win32' => '6.58', + 'ExtUtils::MM_Win95' => '6.58', + 'ExtUtils::MY' => '6.58', + 'ExtUtils::MakeMaker' => '6.58', + 'ExtUtils::MakeMaker::Config'=> '6.58', + 'ExtUtils::Mkbootstrap' => '6.58', + 'ExtUtils::Mksymlists' => '6.58', + 'ExtUtils::ParseXS' => '3.00_01', + 'ExtUtils::ParseXS::Constants'=> undef, + 'ExtUtils::ParseXS::CountLines'=> undef, + 'ExtUtils::ParseXS::Utilities'=> undef, + 'ExtUtils::Typemaps' => '1.00', + 'ExtUtils::Typemaps::InputMap'=> undef, + 'ExtUtils::Typemaps::OutputMap'=> undef, + 'ExtUtils::Typemaps::Type'=> '0.05', + 'ExtUtils::testlib' => '6.58', + 'File::Basename' => '2.83', + 'File::Find' => '1.20', + 'HTTP::Tiny' => '0.013', + 'I18N::Langinfo' => '0.08_02', + 'IO::Compress::Adapter::Bzip2'=> '2.037', + 'IO::Compress::Adapter::Deflate'=> '2.037', + 'IO::Compress::Adapter::Identity'=> '2.037', + 'IO::Compress::Base' => '2.037', + 'IO::Compress::Base::Common'=> '2.037', + 'IO::Compress::Bzip2' => '2.037', + 'IO::Compress::Deflate' => '2.037', + 'IO::Compress::Gzip' => '2.037', + 'IO::Compress::Gzip::Constants'=> '2.037', + 'IO::Compress::RawDeflate'=> '2.037', + 'IO::Compress::Zip' => '2.037', + 'IO::Compress::Zip::Constants'=> '2.037', + 'IO::Compress::Zlib::Constants'=> '2.037', + 'IO::Compress::Zlib::Extra'=> '2.037', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.037', + 'IO::Uncompress::Adapter::Identity'=> '2.037', + 'IO::Uncompress::Adapter::Inflate'=> '2.037', + 'IO::Uncompress::AnyInflate'=> '2.037', + 'IO::Uncompress::AnyUncompress'=> '2.037', + 'IO::Uncompress::Base' => '2.037', + 'IO::Uncompress::Bunzip2'=> '2.037', + 'IO::Uncompress::Gunzip'=> '2.037', + 'IO::Uncompress::Inflate'=> '2.037', + 'IO::Uncompress::RawInflate'=> '2.037', + 'IO::Uncompress::Unzip' => '2.037', + 'IPC::Cmd' => '0.72', + 'Locale::Codes' => '3.17', + 'Locale::Codes::Constants'=> '3.17', + 'Locale::Codes::Country'=> '3.17', + 'Locale::Codes::Country_Codes'=> '3.17', + 'Locale::Codes::Currency'=> '3.17', + 'Locale::Codes::Currency_Codes'=> '3.17', + 'Locale::Codes::LangExt'=> '3.17', + 'Locale::Codes::LangExt_Codes'=> '3.17', + 'Locale::Codes::LangVar'=> '3.17', + 'Locale::Codes::LangVar_Codes'=> '3.17', + 'Locale::Codes::Language'=> '3.17', + 'Locale::Codes::Language_Codes'=> '3.17', + 'Locale::Codes::Script' => '3.17', + 'Locale::Codes::Script_Codes'=> '3.17', + 'Locale::Country' => '3.17', + 'Locale::Currency' => '3.17', + 'Locale::Language' => '3.17', + 'Locale::Script' => '3.17', + 'Math::BigFloat::Trace' => '0.28', + 'Math::BigInt::FastCalc'=> '0.29', + 'Math::BigInt::Trace' => '0.28', + 'Math::BigRat' => '0.2602', + 'Math::Complex' => '1.58', + 'Math::Trig' => '1.22', + 'Module::CoreList' => '2.54', + 'OS2::Process' => '1.07', + 'Pod::Perldoc' => '3.15_06', + 'Pod::Simple' => '3.18', + 'Pod::Simple::BlackBox' => '3.18', + 'Pod::Simple::Checker' => '3.18', + 'Pod::Simple::Debug' => '3.18', + 'Pod::Simple::DumpAsText'=> '3.18', + 'Pod::Simple::DumpAsXML'=> '3.18', + 'Pod::Simple::HTML' => '3.18', + 'Pod::Simple::HTMLBatch'=> '3.18', + 'Pod::Simple::LinkSection'=> '3.18', + 'Pod::Simple::Methody' => '3.18', + 'Pod::Simple::Progress' => '3.18', + 'Pod::Simple::PullParser'=> '3.18', + 'Pod::Simple::PullParserEndToken'=> '3.18', + 'Pod::Simple::PullParserStartToken'=> '3.18', + 'Pod::Simple::PullParserTextToken'=> '3.18', + 'Pod::Simple::PullParserToken'=> '3.18', + 'Pod::Simple::RTF' => '3.18', + 'Pod::Simple::Search' => '3.18', + 'Pod::Simple::SimpleTree'=> '3.18', + 'Pod::Simple::Text' => '3.18', + 'Pod::Simple::TextContent'=> '3.18', + 'Pod::Simple::TiedOutFH'=> '3.18', + 'Pod::Simple::Transcode'=> '3.18', + 'Pod::Simple::TranscodeDumb'=> '3.18', + 'Pod::Simple::TranscodeSmart'=> '3.18', + 'Pod::Simple::XHTML' => '3.18', + 'Pod::Simple::XMLOutStream'=> '3.18', + 'Storable' => '2.31', + 'Sys::Syslog::Win32' => undef, + 'Time::HiRes' => '1.9724', + 'Unicode::Collate' => '0.77', + 'Unicode::UCD' => '0.33', + 'Win32API::File' => '0.1200', + 'XS::APItest' => '0.30', + 'attributes' => '0.15', + 'bigint' => '0.28', + 'bignum' => '0.28', + 'charnames' => '1.23', + 'diagnostics' => '1.23', + 'feature' => '1.22', + 'overload' => '1.15', + 'perlfaq' => '5.015000', + 'threads' => '1.84', + 'version' => '0.93', + }, + removed => { + 'ExtUtils::MakeMaker::YAML'=> 1, + 'Locale::Constants' => 1, + 'Sys::Syslog::win32::Win32'=> 1, + } + }, + 5.015002 => { + delta_from => 5.015001, + changed => { + 'Attribute::Handlers' => '0.92', + 'B' => '1.31', + 'B::Concise' => '0.85', + 'B::Deparse' => '1.07', + 'B::Terse' => '1.06', + 'B::Xref' => '1.03', + 'CPAN' => '1.9800', + 'CPAN::Exception::yaml_process_error'=> '5.5', + 'CPAN::Meta' => '2.112150', + 'CPAN::Meta::Converter' => '2.112150', + 'CPAN::Meta::Feature' => '2.112150', + 'CPAN::Meta::History' => '2.112150', + 'CPAN::Meta::Prereqs' => '2.112150', + 'CPAN::Meta::Spec' => '2.112150', + 'CPAN::Meta::Validator' => '2.112150', + 'CPANPLUS' => '0.9109', + 'CPANPLUS::Internals' => '0.9109', + 'CPANPLUS::Shell::Default'=> '0.9109', + 'DB_File' => '1.824', + 'Data::Dumper' => '2.132', + 'Encode' => '2.44', + 'Encode::Alias' => '2.15', + 'Encode::Encoder' => '2.02', + 'Encode::Guess' => '2.05', + 'ExtUtils::Command::MM' => '6.59', + 'ExtUtils::Install' => '1.57', + 'ExtUtils::Installed' => '1.999002', + 'ExtUtils::Liblist' => '6.59', + 'ExtUtils::Liblist::Kid'=> '6.59', + 'ExtUtils::MM' => '6.59', + 'ExtUtils::MM_AIX' => '6.59', + 'ExtUtils::MM_Any' => '6.59', + 'ExtUtils::MM_BeOS' => '6.59', + 'ExtUtils::MM_Cygwin' => '6.59', + 'ExtUtils::MM_DOS' => '6.59', + 'ExtUtils::MM_Darwin' => '6.59', + 'ExtUtils::MM_MacOS' => '6.59', + 'ExtUtils::MM_NW5' => '6.59', + 'ExtUtils::MM_OS2' => '6.59', + 'ExtUtils::MM_QNX' => '6.59', + 'ExtUtils::MM_UWIN' => '6.59', + 'ExtUtils::MM_Unix' => '6.59', + 'ExtUtils::MM_VMS' => '6.59', + 'ExtUtils::MM_VOS' => '6.59', + 'ExtUtils::MM_Win32' => '6.59', + 'ExtUtils::MM_Win95' => '6.59', + 'ExtUtils::MY' => '6.59', + 'ExtUtils::MakeMaker' => '6.59', + 'ExtUtils::MakeMaker::Config'=> '6.59', + 'ExtUtils::Manifest' => '1.60', + 'ExtUtils::Mkbootstrap' => '6.59', + 'ExtUtils::Mksymlists' => '6.59', + 'ExtUtils::ParseXS' => '3.03_01', + 'ExtUtils::Typemaps' => '1.01', + 'ExtUtils::testlib' => '6.59', + 'File::Spec' => '3.34', + 'File::Spec::Mac' => '3.35', + 'File::Spec::Unix' => '3.34', + 'File::Spec::VMS' => '3.35', + 'File::Spec::Win32' => '3.35', + 'I18N::LangTags' => '0.37', + 'IO' => '1.25_05', + 'IO::Handle' => '1.32', + 'IO::Socket' => '1.33', + 'IO::Socket::INET' => '1.32', + 'IPC::Open3' => '1.12', + 'Math::BigFloat' => '1.995', + 'Math::BigFloat::Trace' => '0.29', + 'Math::BigInt' => '1.996', + 'Math::BigInt::Trace' => '0.29', + 'Module::Build' => '0.39_01', + 'Module::Build::Base' => '0.39_01', + 'Module::Build::Compat' => '0.39_01', + 'Module::Build::Config' => '0.39_01', + 'Module::Build::Cookbook'=> '0.39_01', + 'Module::Build::Dumper' => '0.39_01', + 'Module::Build::ModuleInfo'=> '0.39_01', + 'Module::Build::Notes' => '0.39_01', + 'Module::Build::PPMMaker'=> '0.39_01', + 'Module::Build::Platform::Amiga'=> '0.39_01', + 'Module::Build::Platform::Default'=> '0.39_01', + 'Module::Build::Platform::EBCDIC'=> '0.39_01', + 'Module::Build::Platform::MPEiX'=> '0.39_01', + 'Module::Build::Platform::MacOS'=> '0.39_01', + 'Module::Build::Platform::RiscOS'=> '0.39_01', + 'Module::Build::Platform::Unix'=> '0.39_01', + 'Module::Build::Platform::VMS'=> '0.39_01', + 'Module::Build::Platform::VOS'=> '0.39_01', + 'Module::Build::Platform::Windows'=> '0.39_01', + 'Module::Build::Platform::aix'=> '0.39_01', + 'Module::Build::Platform::cygwin'=> '0.39_01', + 'Module::Build::Platform::darwin'=> '0.39_01', + 'Module::Build::Platform::os2'=> '0.39_01', + 'Module::Build::PodParser'=> '0.39_01', + 'Module::CoreList' => '2.55', + 'Module::Load' => '0.20', + 'Module::Metadata' => '1.000005_01', + 'Opcode' => '1.20', + 'Params::Check' => '0.32', + 'PerlIO::via' => '0.12', + 'Term::ANSIColor' => '3.01', + 'Unicode::Collate' => '0.78', + 'Unicode::Normalize' => '1.13', + 'Unicode::UCD' => '0.34', + 'bigint' => '0.29', + 'bignum' => '0.29', + 'bigrat' => '0.29', + 'diagnostics' => '1.24', + 'fields' => '2.16', + 'inc::latest' => '0.39_01', + }, + removed => { + } + }, + 5.015003 => { + delta_from => 5.015002, + changed => { + 'AnyDBM_File' => '1.01', + 'Archive::Extract' => '0.56', + 'Archive::Tar' => '1.78', + 'Archive::Tar::Constant'=> '1.78', + 'Archive::Tar::File' => '1.78', + 'Attribute::Handlers' => '0.93', + 'B' => '1.32', + 'B::Concise' => '0.86', + 'B::Deparse' => '1.08', + 'CPAN::Meta' => '2.112621', + 'CPAN::Meta::Converter' => '2.112621', + 'CPAN::Meta::Feature' => '2.112621', + 'CPAN::Meta::History' => '2.112621', + 'CPAN::Meta::Prereqs' => '2.112621', + 'CPAN::Meta::Spec' => '2.112621', + 'CPAN::Meta::Validator' => '2.112621', + 'CPAN::Meta::YAML' => '0.004', + 'CPANPLUS' => '0.9111', + 'CPANPLUS::Dist::Build' => '0.58', + 'CPANPLUS::Dist::Build::Constants'=> '0.58', + 'CPANPLUS::Internals' => '0.9111', + 'CPANPLUS::Shell::Default'=> '0.9111', + 'Carp' => '1.23', + 'Carp::Heavy' => '1.23', + 'Data::Dumper' => '2.134', + 'Devel::PPPort' => '3.20', + 'Errno' => '1.14', + 'Exporter' => '5.65', + 'Exporter::Heavy' => '5.65', + 'ExtUtils::ParseXS' => '3.04_04', + 'ExtUtils::ParseXS::Constants'=> '3.04_04', + 'ExtUtils::ParseXS::CountLines'=> '3.04_04', + 'ExtUtils::ParseXS::Utilities'=> '3.04_04', + 'ExtUtils::Typemaps' => '1.02', + 'File::Glob' => '1.13', + 'Filter::Simple' => '0.88', + 'IO' => '1.25_06', + 'IO::Handle' => '1.33', + 'Locale::Codes' => '3.18', + 'Locale::Codes::Constants'=> '3.18', + 'Locale::Codes::Country'=> '3.18', + 'Locale::Codes::Country_Codes'=> '3.18', + 'Locale::Codes::Currency'=> '3.18', + 'Locale::Codes::Currency_Codes'=> '3.18', + 'Locale::Codes::LangExt'=> '3.18', + 'Locale::Codes::LangExt_Codes'=> '3.18', + 'Locale::Codes::LangVar'=> '3.18', + 'Locale::Codes::LangVar_Codes'=> '3.18', + 'Locale::Codes::Language'=> '3.18', + 'Locale::Codes::Language_Codes'=> '3.18', + 'Locale::Codes::Script' => '3.18', + 'Locale::Codes::Script_Codes'=> '3.18', + 'Locale::Country' => '3.18', + 'Locale::Currency' => '3.18', + 'Locale::Language' => '3.18', + 'Locale::Script' => '3.18', + 'Math::BigFloat' => '1.997', + 'Math::BigInt' => '1.997', + 'Math::BigInt::Calc' => '1.997', + 'Math::BigInt::CalcEmu' => '1.997', + 'Math::BigInt::FastCalc'=> '0.30', + 'Math::BigRat' => '0.2603', + 'Module::CoreList' => '2.56', + 'Module::Load::Conditional'=> '0.46', + 'Module::Metadata' => '1.000007', + 'ODBM_File' => '1.12', + 'POSIX' => '1.26', + 'Pod::Perldoc' => '3.15_07', + 'Pod::Simple' => '3.19', + 'Pod::Simple::BlackBox' => '3.19', + 'Pod::Simple::Checker' => '3.19', + 'Pod::Simple::Debug' => '3.19', + 'Pod::Simple::DumpAsText'=> '3.19', + 'Pod::Simple::DumpAsXML'=> '3.19', + 'Pod::Simple::HTML' => '3.19', + 'Pod::Simple::HTMLBatch'=> '3.19', + 'Pod::Simple::LinkSection'=> '3.19', + 'Pod::Simple::Methody' => '3.19', + 'Pod::Simple::Progress' => '3.19', + 'Pod::Simple::PullParser'=> '3.19', + 'Pod::Simple::PullParserEndToken'=> '3.19', + 'Pod::Simple::PullParserStartToken'=> '3.19', + 'Pod::Simple::PullParserTextToken'=> '3.19', + 'Pod::Simple::PullParserToken'=> '3.19', + 'Pod::Simple::RTF' => '3.19', + 'Pod::Simple::Search' => '3.19', + 'Pod::Simple::SimpleTree'=> '3.19', + 'Pod::Simple::Text' => '3.19', + 'Pod::Simple::TextContent'=> '3.19', + 'Pod::Simple::TiedOutFH'=> '3.19', + 'Pod::Simple::Transcode'=> '3.19', + 'Pod::Simple::TranscodeDumb'=> '3.19', + 'Pod::Simple::TranscodeSmart'=> '3.19', + 'Pod::Simple::XHTML' => '3.19', + 'Pod::Simple::XMLOutStream'=> '3.19', + 'Search::Dict' => '1.04', + 'Socket' => '1.94_01', + 'Storable' => '2.32', + 'Text::Abbrev' => '1.02', + 'Tie::Array' => '1.05', + 'UNIVERSAL' => '1.09', + 'Unicode::UCD' => '0.35', + 'XS::APItest' => '0.31', + 'XSLoader' => '0.16', + 'attributes' => '0.16', + 'diagnostics' => '1.25', + 'open' => '1.09', + 'perlfaq' => '5.0150034', + 'threads' => '1.85', + 'threads::shared' => '1.40', + }, + removed => { + } + }, + 5.015004 => { + delta_from => 5.015003, + changed => { + 'Archive::Tar' => '1.80', + 'Archive::Tar::Constant'=> '1.80', + 'Archive::Tar::File' => '1.80', + 'Digest' => '1.17', + 'DynaLoader' => '1.14', + 'ExtUtils::Command::MM' => '6.61_01', + 'ExtUtils::Liblist' => '6.61_01', + 'ExtUtils::Liblist::Kid'=> '6.61_01', + 'ExtUtils::MM' => '6.61_01', + 'ExtUtils::MM_AIX' => '6.61_01', + 'ExtUtils::MM_Any' => '6.61_01', + 'ExtUtils::MM_BeOS' => '6.61_01', + 'ExtUtils::MM_Cygwin' => '6.61_01', + 'ExtUtils::MM_DOS' => '6.61_01', + 'ExtUtils::MM_Darwin' => '6.61_01', + 'ExtUtils::MM_MacOS' => '6.61_01', + 'ExtUtils::MM_NW5' => '6.61_01', + 'ExtUtils::MM_OS2' => '6.61_01', + 'ExtUtils::MM_QNX' => '6.61_01', + 'ExtUtils::MM_UWIN' => '6.61_01', + 'ExtUtils::MM_Unix' => '6.61_01', + 'ExtUtils::MM_VMS' => '6.61_01', + 'ExtUtils::MM_VOS' => '6.61_01', + 'ExtUtils::MM_Win32' => '6.61_01', + 'ExtUtils::MM_Win95' => '6.61_01', + 'ExtUtils::MY' => '6.61_01', + 'ExtUtils::MakeMaker' => '6.61_01', + 'ExtUtils::MakeMaker::Config'=> '6.61_01', + 'ExtUtils::Mkbootstrap' => '6.61_01', + 'ExtUtils::Mksymlists' => '6.61_01', + 'ExtUtils::ParseXS' => '3.05', + 'ExtUtils::ParseXS::Constants'=> '3.05', + 'ExtUtils::ParseXS::CountLines'=> '3.05', + 'ExtUtils::ParseXS::Utilities'=> '3.05', + 'ExtUtils::testlib' => '6.61_01', + 'File::DosGlob' => '1.05', + 'Module::CoreList' => '2.57', + 'Module::Load' => '0.22', + 'Unicode::Collate' => '0.80', + 'Unicode::Collate::Locale'=> '0.80', + 'Unicode::UCD' => '0.36', + 'XS::APItest' => '0.32', + 'XS::Typemap' => '0.07', + 'attributes' => '0.17', + 'base' => '2.18', + 'constant' => '1.23', + 'mro' => '1.09', + 'open' => '1.10', + 'perlfaq' => '5.0150035', + }, + removed => { + } + }, + 5.015005 => { + delta_from => 5.015004, + changed => { + 'Archive::Extract' => '0.58', + 'B::Concise' => '0.87', + 'B::Deparse' => '1.09', + 'CGI' => '3.58', + 'CGI::Fast' => '1.09', + 'CPANPLUS' => '0.9112', + 'CPANPLUS::Dist::Build' => '0.60', + 'CPANPLUS::Dist::Build::Constants'=> '0.60', + 'CPANPLUS::Internals' => '0.9112', + 'CPANPLUS::Shell::Default'=> '0.9112', + 'Compress::Raw::Bzip2' => '2.042', + 'Compress::Raw::Zlib' => '2.042', + 'Compress::Zlib' => '2.042', + 'Digest::SHA' => '5.63', + 'Errno' => '1.15', + 'ExtUtils::Command::MM' => '6.63_02', + 'ExtUtils::Liblist' => '6.63_02', + 'ExtUtils::Liblist::Kid'=> '6.63_02', + 'ExtUtils::MM' => '6.63_02', + 'ExtUtils::MM_AIX' => '6.63_02', + 'ExtUtils::MM_Any' => '6.63_02', + 'ExtUtils::MM_BeOS' => '6.63_02', + 'ExtUtils::MM_Cygwin' => '6.63_02', + 'ExtUtils::MM_DOS' => '6.63_02', + 'ExtUtils::MM_Darwin' => '6.63_02', + 'ExtUtils::MM_MacOS' => '6.63_02', + 'ExtUtils::MM_NW5' => '6.63_02', + 'ExtUtils::MM_OS2' => '6.63_02', + 'ExtUtils::MM_QNX' => '6.63_02', + 'ExtUtils::MM_UWIN' => '6.63_02', + 'ExtUtils::MM_Unix' => '6.63_02', + 'ExtUtils::MM_VMS' => '6.63_02', + 'ExtUtils::MM_VOS' => '6.63_02', + 'ExtUtils::MM_Win32' => '6.63_02', + 'ExtUtils::MM_Win95' => '6.63_02', + 'ExtUtils::MY' => '6.63_02', + 'ExtUtils::MakeMaker' => '6.63_02', + 'ExtUtils::MakeMaker::Config'=> '6.63_02', + 'ExtUtils::Mkbootstrap' => '6.63_02', + 'ExtUtils::Mksymlists' => '6.63_02', + 'ExtUtils::testlib' => '6.63_02', + 'File::DosGlob' => '1.06', + 'File::Glob' => '1.14', + 'HTTP::Tiny' => '0.016', + 'IO::Compress::Adapter::Bzip2'=> '2.042', + 'IO::Compress::Adapter::Deflate'=> '2.042', + 'IO::Compress::Adapter::Identity'=> '2.042', + 'IO::Compress::Base' => '2.042', + 'IO::Compress::Base::Common'=> '2.042', + 'IO::Compress::Bzip2' => '2.042', + 'IO::Compress::Deflate' => '2.042', + 'IO::Compress::Gzip' => '2.042', + 'IO::Compress::Gzip::Constants'=> '2.042', + 'IO::Compress::RawDeflate'=> '2.042', + 'IO::Compress::Zip' => '2.042', + 'IO::Compress::Zip::Constants'=> '2.042', + 'IO::Compress::Zlib::Constants'=> '2.042', + 'IO::Compress::Zlib::Extra'=> '2.042', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.042', + 'IO::Uncompress::Adapter::Identity'=> '2.042', + 'IO::Uncompress::Adapter::Inflate'=> '2.042', + 'IO::Uncompress::AnyInflate'=> '2.042', + 'IO::Uncompress::AnyUncompress'=> '2.042', + 'IO::Uncompress::Base' => '2.042', + 'IO::Uncompress::Bunzip2'=> '2.042', + 'IO::Uncompress::Gunzip'=> '2.042', + 'IO::Uncompress::Inflate'=> '2.042', + 'IO::Uncompress::RawInflate'=> '2.042', + 'IO::Uncompress::Unzip' => '2.042', + 'Locale::Maketext' => '1.20', + 'Locale::Maketext::Guts'=> '1.20', + 'Locale::Maketext::GutsLoader'=> '1.20', + 'Module::CoreList' => '2.58', + 'Opcode' => '1.21', + 'Socket' => '1.94_02', + 'Storable' => '2.33', + 'UNIVERSAL' => '1.10', + 'Unicode::Collate' => '0.85', + 'Unicode::Collate::CJK::Pinyin'=> '0.85', + 'Unicode::Collate::CJK::Stroke'=> '0.85', + 'Unicode::Collate::Locale'=> '0.85', + 'Unicode::UCD' => '0.37', + 'XS::APItest' => '0.33', + 'arybase' => '0.01', + 'charnames' => '1.24', + 'feature' => '1.23', + 'perlfaq' => '5.0150036', + 'strict' => '1.05', + 'unicore::Name' => undef, + }, + removed => { + } + }, + 5.015006 => { + delta_from => 5.015005, + changed => { + 'Archive::Tar' => '1.82', + 'Archive::Tar::Constant'=> '1.82', + 'Archive::Tar::File' => '1.82', + 'AutoLoader' => '5.72', + 'B::Concise' => '0.88', + 'B::Debug' => '1.17', + 'B::Deparse' => '1.10', + 'CPAN::Meta::YAML' => '0.005', + 'CPANPLUS' => '0.9113', + 'CPANPLUS::Internals' => '0.9113', + 'CPANPLUS::Shell::Default'=> '0.9113', + 'Carp' => '1.24', + 'Compress::Raw::Bzip2' => '2.045', + 'Compress::Raw::Zlib' => '2.045', + 'Compress::Zlib' => '2.045', + 'Cwd' => '3.38', + 'DB' => '1.04', + 'Data::Dumper' => '2.135_01', + 'Digest::SHA' => '5.70', + 'Dumpvalue' => '1.17', + 'Exporter' => '5.66', + 'Exporter::Heavy' => '5.66', + 'ExtUtils::CBuilder' => '0.280205', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280204', + 'ExtUtils::Packlist' => '1.45', + 'ExtUtils::ParseXS' => '3.08', + 'ExtUtils::ParseXS::Constants'=> '3.08', + 'ExtUtils::ParseXS::CountLines'=> '3.08', + 'ExtUtils::ParseXS::Utilities'=> '3.08', + 'File::Basename' => '2.84', + 'File::Glob' => '1.15', + 'File::Spec::Unix' => '3.35', + 'Getopt::Std' => '1.07', + 'I18N::LangTags' => '0.38', + 'IO::Compress::Adapter::Bzip2'=> '2.045', + 'IO::Compress::Adapter::Deflate'=> '2.045', + 'IO::Compress::Adapter::Identity'=> '2.045', + 'IO::Compress::Base' => '2.046', + 'IO::Compress::Base::Common'=> '2.045', + 'IO::Compress::Bzip2' => '2.045', + 'IO::Compress::Deflate' => '2.045', + 'IO::Compress::Gzip' => '2.045', + 'IO::Compress::Gzip::Constants'=> '2.045', + 'IO::Compress::RawDeflate'=> '2.045', + 'IO::Compress::Zip' => '2.046', + 'IO::Compress::Zip::Constants'=> '2.045', + 'IO::Compress::Zlib::Constants'=> '2.045', + 'IO::Compress::Zlib::Extra'=> '2.045', + 'IO::Dir' => '1.09', + 'IO::File' => '1.16', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.045', + 'IO::Uncompress::Adapter::Identity'=> '2.045', + 'IO::Uncompress::Adapter::Inflate'=> '2.045', + 'IO::Uncompress::AnyInflate'=> '2.045', + 'IO::Uncompress::AnyUncompress'=> '2.045', + 'IO::Uncompress::Base' => '2.046', + 'IO::Uncompress::Bunzip2'=> '2.045', + 'IO::Uncompress::Gunzip'=> '2.045', + 'IO::Uncompress::Inflate'=> '2.045', + 'IO::Uncompress::RawInflate'=> '2.045', + 'IO::Uncompress::Unzip' => '2.046', + 'Locale::Codes' => '3.20', + 'Locale::Codes::Constants'=> '3.20', + 'Locale::Codes::Country'=> '3.20', + 'Locale::Codes::Country_Codes'=> '3.20', + 'Locale::Codes::Country_Retired'=> '3.20', + 'Locale::Codes::Currency'=> '3.20', + 'Locale::Codes::Currency_Codes'=> '3.20', + 'Locale::Codes::Currency_Retired'=> '3.20', + 'Locale::Codes::LangExt'=> '3.20', + 'Locale::Codes::LangExt_Codes'=> '3.20', + 'Locale::Codes::LangExt_Retired'=> '3.20', + 'Locale::Codes::LangFam'=> '3.20', + 'Locale::Codes::LangFam_Codes'=> '3.20', + 'Locale::Codes::LangFam_Retired'=> '3.20', + 'Locale::Codes::LangVar'=> '3.20', + 'Locale::Codes::LangVar_Codes'=> '3.20', + 'Locale::Codes::LangVar_Retired'=> '3.20', + 'Locale::Codes::Language'=> '3.20', + 'Locale::Codes::Language_Codes'=> '3.20', + 'Locale::Codes::Language_Retired'=> '3.20', + 'Locale::Codes::Script' => '3.20', + 'Locale::Codes::Script_Codes'=> '3.20', + 'Locale::Codes::Script_Retired'=> '3.20', + 'Locale::Country' => '3.20', + 'Locale::Currency' => '3.20', + 'Locale::Language' => '3.20', + 'Locale::Maketext' => '1.21', + 'Locale::Script' => '3.20', + 'Module::CoreList' => '2.59', + 'Module::Loaded' => '0.08', + 'Opcode' => '1.22', + 'POSIX' => '1.27', + 'Pod::Html' => '1.12', + 'Pod::LaTeX' => '0.60', + 'Pod::Perldoc' => '3.15_08', + 'Safe' => '2.30', + 'SelfLoader' => '1.20', + 'Socket' => '1.97', + 'Storable' => '2.34', + 'UNIVERSAL' => '1.11', + 'Unicode::Collate' => '0.87', + 'Unicode::Collate::Locale'=> '0.87', + 'XS::APItest' => '0.34', + 'arybase' => '0.02', + 'charnames' => '1.27', + 'diagnostics' => '1.26', + 'feature' => '1.24', + 'if' => '0.0602', + 'overload' => '1.16', + 'sigtrap' => '1.06', + 'strict' => '1.06', + 'threads' => '1.86', + 'version' => '0.96', + }, + removed => { + } + }, + 5.015007 => { + delta_from => 5.015006, + changed => { + 'B' => '1.33', + 'B::Deparse' => '1.11', + 'CGI' => '3.59', + 'CPAN::Meta' => '2.113640', + 'CPAN::Meta::Converter' => '2.113640', + 'CPAN::Meta::Feature' => '2.113640', + 'CPAN::Meta::History' => '2.113640', + 'CPAN::Meta::Prereqs' => '2.113640', + 'CPAN::Meta::Requirements'=> '2.113640', + 'CPAN::Meta::Spec' => '2.113640', + 'CPAN::Meta::Validator' => '2.113640', + 'CPANPLUS' => '0.9116', + 'CPANPLUS::Internals' => '0.9116', + 'CPANPLUS::Shell::Default'=> '0.9116', + 'Cwd' => '3.39_01', + 'Data::Dumper' => '2.135_03', + 'Devel::InnerPackage' => '0.4', + 'ExtUtils::CBuilder::Base'=> '0.280205', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280205', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280205', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280205', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280205', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280205', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280205', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280205', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280205', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280205', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280205', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280205', + 'ExtUtils::Manifest' => '1.61', + 'ExtUtils::Packlist' => '1.46', + 'ExtUtils::ParseXS' => '3.12', + 'ExtUtils::ParseXS::Constants'=> '3.12', + 'ExtUtils::ParseXS::CountLines'=> '3.12', + 'ExtUtils::ParseXS::Utilities'=> '3.12', + 'ExtUtils::Typemaps' => '1.03', + 'ExtUtils::Typemaps::Cmd'=> undef, + 'ExtUtils::Typemaps::Type'=> '0.06', + 'File::Glob' => '1.16', + 'File::Spec' => '3.39_01', + 'File::Spec::Cygwin' => '3.39_01', + 'File::Spec::Epoc' => '3.39_01', + 'File::Spec::Functions' => '3.39_01', + 'File::Spec::Mac' => '3.39_01', + 'File::Spec::OS2' => '3.39_01', + 'File::Spec::Unix' => '3.39_01', + 'File::Spec::VMS' => '3.39_01', + 'File::Spec::Win32' => '3.39_01', + 'IO::Dir' => '1.10', + 'IO::Pipe' => '1.15', + 'IO::Poll' => '0.09', + 'IO::Select' => '1.21', + 'IO::Socket' => '1.34', + 'IO::Socket::INET' => '1.33', + 'IO::Socket::UNIX' => '1.24', + 'Locale::Maketext' => '1.22', + 'Math::BigInt' => '1.998', + 'Module::CoreList' => '2.60', + 'Module::Pluggable' => '4.0', + 'POSIX' => '1.28', + 'PerlIO::scalar' => '0.13', + 'Pod::Html' => '1.13', + 'Pod::Perldoc' => '3.15_15', + 'Pod::Perldoc::BaseTo' => '3.15_15', + 'Pod::Perldoc::GetOptsOO'=> '3.15_15', + 'Pod::Perldoc::ToANSI' => '3.15_15', + 'Pod::Perldoc::ToChecker'=> '3.15_15', + 'Pod::Perldoc::ToMan' => '3.15_15', + 'Pod::Perldoc::ToNroff' => '3.15_15', + 'Pod::Perldoc::ToPod' => '3.15_15', + 'Pod::Perldoc::ToRtf' => '3.15_15', + 'Pod::Perldoc::ToTerm' => '3.15_15', + 'Pod::Perldoc::ToText' => '3.15_15', + 'Pod::Perldoc::ToTk' => '3.15_15', + 'Pod::Perldoc::ToXml' => '3.15_15', + 'Term::UI' => '0.30', + 'Tie::File' => '0.98', + 'Unicode::UCD' => '0.39', + 'Version::Requirements' => '0.101021', + 'XS::APItest' => '0.35', + '_charnames' => '1.28', + 'arybase' => '0.03', + 'autouse' => '1.07', + 'charnames' => '1.28', + 'diagnostics' => '1.27', + 'feature' => '1.25', + 'overload' => '1.17', + 'overloading' => '0.02', + 'perlfaq' => '5.0150038', + }, + removed => { + } + }, + 5.015008 => { + delta_from => 5.015007, + changed => { + 'B' => '1.34', + 'B::Deparse' => '1.12', + 'CPAN::Meta' => '2.120351', + 'CPAN::Meta::Converter' => '2.120351', + 'CPAN::Meta::Feature' => '2.120351', + 'CPAN::Meta::History' => '2.120351', + 'CPAN::Meta::Prereqs' => '2.120351', + 'CPAN::Meta::Requirements'=> '2.120351', + 'CPAN::Meta::Spec' => '2.120351', + 'CPAN::Meta::Validator' => '2.120351', + 'CPAN::Meta::YAML' => '0.007', + 'CPANPLUS' => '0.9118', + 'CPANPLUS::Dist::Build' => '0.62', + 'CPANPLUS::Dist::Build::Constants'=> '0.62', + 'CPANPLUS::Internals' => '0.9118', + 'CPANPLUS::Shell::Default'=> '0.9118', + 'Carp' => '1.25', + 'Carp::Heavy' => '1.25', + 'Compress::Raw::Bzip2' => '2.048', + 'Compress::Raw::Zlib' => '2.048', + 'Compress::Zlib' => '2.048', + 'Cwd' => '3.39_02', + 'DB_File' => '1.826', + 'Data::Dumper' => '2.135_05', + 'English' => '1.05', + 'ExtUtils::Install' => '1.58', + 'ExtUtils::ParseXS' => '3.16', + 'ExtUtils::ParseXS::Constants'=> '3.16', + 'ExtUtils::ParseXS::CountLines'=> '3.16', + 'ExtUtils::ParseXS::Utilities'=> '3.16', + 'ExtUtils::Typemaps' => '3.16', + 'ExtUtils::Typemaps::Cmd'=> '3.16', + 'ExtUtils::Typemaps::InputMap'=> '3.16', + 'ExtUtils::Typemaps::OutputMap'=> '3.16', + 'ExtUtils::Typemaps::Type'=> '3.16', + 'File::Copy' => '2.23', + 'File::Glob' => '1.17', + 'File::Spec' => '3.39_02', + 'File::Spec::Cygwin' => '3.39_02', + 'File::Spec::Epoc' => '3.39_02', + 'File::Spec::Functions' => '3.39_02', + 'File::Spec::Mac' => '3.39_02', + 'File::Spec::OS2' => '3.39_02', + 'File::Spec::Unix' => '3.39_02', + 'File::Spec::VMS' => '3.39_02', + 'File::Spec::Win32' => '3.39_02', + 'Filter::Util::Call' => '1.40', + 'IO::Compress::Adapter::Bzip2'=> '2.048', + 'IO::Compress::Adapter::Deflate'=> '2.048', + 'IO::Compress::Adapter::Identity'=> '2.048', + 'IO::Compress::Base' => '2.048', + 'IO::Compress::Base::Common'=> '2.048', + 'IO::Compress::Bzip2' => '2.048', + 'IO::Compress::Deflate' => '2.048', + 'IO::Compress::Gzip' => '2.048', + 'IO::Compress::Gzip::Constants'=> '2.048', + 'IO::Compress::RawDeflate'=> '2.048', + 'IO::Compress::Zip' => '2.048', + 'IO::Compress::Zip::Constants'=> '2.048', + 'IO::Compress::Zlib::Constants'=> '2.048', + 'IO::Compress::Zlib::Extra'=> '2.048', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.048', + 'IO::Uncompress::Adapter::Identity'=> '2.048', + 'IO::Uncompress::Adapter::Inflate'=> '2.048', + 'IO::Uncompress::AnyInflate'=> '2.048', + 'IO::Uncompress::AnyUncompress'=> '2.048', + 'IO::Uncompress::Base' => '2.048', + 'IO::Uncompress::Bunzip2'=> '2.048', + 'IO::Uncompress::Gunzip'=> '2.048', + 'IO::Uncompress::Inflate'=> '2.048', + 'IO::Uncompress::RawInflate'=> '2.048', + 'IO::Uncompress::Unzip' => '2.048', + 'IPC::Cmd' => '0.76', + 'Math::Complex' => '1.59', + 'Math::Trig' => '1.23', + 'Module::Metadata' => '1.000009', + 'Opcode' => '1.23', + 'POSIX' => '1.30', + 'Parse::CPAN::Meta' => '1.4402', + 'PerlIO::mmap' => '0.010', + 'Pod::Checker' => '1.51', + 'Pod::Find' => '1.51', + 'Pod::Functions' => '1.05', + 'Pod::Html' => '1.14', + 'Pod::InputObjects' => '1.51', + 'Pod::ParseUtils' => '1.51', + 'Pod::Parser' => '1.51', + 'Pod::PlainText' => '2.05', + 'Pod::Select' => '1.51', + 'Pod::Usage' => '1.51', + 'Safe' => '2.31', + 'Socket' => '1.98', + 'Term::Cap' => '1.13', + 'Term::ReadLine' => '1.08', + 'Time::HiRes' => '1.9725', + 'Unicode' => '6.1.0', + 'Unicode::UCD' => '0.41', + 'Version::Requirements' => '0.101022', + 'XS::APItest' => '0.36', + 'XS::Typemap' => '0.08', + '_charnames' => '1.29', + 'arybase' => '0.04', + 'charnames' => '1.29', + 'diagnostics' => '1.28', + 'feature' => '1.26', + 'locale' => '1.01', + 'overload' => '1.18', + 'perlfaq' => '5.0150039', + 're' => '0.19', + 'subs' => '1.01', + 'warnings' => '1.13', + }, + removed => { + } + }, + 5.015009 => { + delta_from => 5.015008, + changed => { + 'B::Deparse' => '1.13', + 'B::Lint' => '1.14', + 'B::Lint::Debug' => '1.14', + 'CPAN::Meta' => '2.120630', + 'CPAN::Meta::Converter' => '2.120630', + 'CPAN::Meta::Feature' => '2.120630', + 'CPAN::Meta::History' => '2.120630', + 'CPAN::Meta::Prereqs' => '2.120630', + 'CPAN::Meta::Requirements'=> '2.120630', + 'CPAN::Meta::Spec' => '2.120630', + 'CPAN::Meta::Validator' => '2.120630', + 'CPANPLUS' => '0.9121', + 'CPANPLUS::Internals' => '0.9121', + 'CPANPLUS::Shell::Default'=> '0.9121', + 'Data::Dumper' => '2.135_06', + 'Digest::SHA' => '5.71', + 'ExtUtils::CBuilder' => '0.280206', + 'ExtUtils::CBuilder::Base'=> '0.280206', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280206', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280206', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280206', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280206', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280206', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280206', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280206', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280206', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280206', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280206', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280206', + 'HTTP::Tiny' => '0.017', + 'Locale::Codes' => '3.21', + 'Locale::Codes::Constants'=> '3.21', + 'Locale::Codes::Country'=> '3.21', + 'Locale::Codes::Country_Codes'=> '3.21', + 'Locale::Codes::Country_Retired'=> '3.21', + 'Locale::Codes::Currency'=> '3.21', + 'Locale::Codes::Currency_Codes'=> '3.21', + 'Locale::Codes::Currency_Retired'=> '3.21', + 'Locale::Codes::LangExt'=> '3.21', + 'Locale::Codes::LangExt_Codes'=> '3.21', + 'Locale::Codes::LangExt_Retired'=> '3.21', + 'Locale::Codes::LangFam'=> '3.21', + 'Locale::Codes::LangFam_Codes'=> '3.21', + 'Locale::Codes::LangFam_Retired'=> '3.21', + 'Locale::Codes::LangVar'=> '3.21', + 'Locale::Codes::LangVar_Codes'=> '3.21', + 'Locale::Codes::LangVar_Retired'=> '3.21', + 'Locale::Codes::Language'=> '3.21', + 'Locale::Codes::Language_Codes'=> '3.21', + 'Locale::Codes::Language_Retired'=> '3.21', + 'Locale::Codes::Script' => '3.21', + 'Locale::Codes::Script_Codes'=> '3.21', + 'Locale::Codes::Script_Retired'=> '3.21', + 'Locale::Country' => '3.21', + 'Locale::Currency' => '3.21', + 'Locale::Language' => '3.21', + 'Locale::Script' => '3.21', + 'Module::CoreList' => '2.65', + 'Pod::Html' => '1.1501', + 'Pod::Perldoc' => '3.17', + 'Pod::Perldoc::BaseTo' => '3.17', + 'Pod::Perldoc::GetOptsOO'=> '3.17', + 'Pod::Perldoc::ToANSI' => '3.17', + 'Pod::Perldoc::ToChecker'=> '3.17', + 'Pod::Perldoc::ToMan' => '3.17', + 'Pod::Perldoc::ToNroff' => '3.17', + 'Pod::Perldoc::ToPod' => '3.17', + 'Pod::Perldoc::ToRtf' => '3.17', + 'Pod::Perldoc::ToTerm' => '3.17', + 'Pod::Perldoc::ToText' => '3.17', + 'Pod::Perldoc::ToTk' => '3.17', + 'Pod::Perldoc::ToXml' => '3.17', + 'Pod::Simple' => '3.20', + 'Pod::Simple::BlackBox' => '3.20', + 'Pod::Simple::Checker' => '3.20', + 'Pod::Simple::Debug' => '3.20', + 'Pod::Simple::DumpAsText'=> '3.20', + 'Pod::Simple::DumpAsXML'=> '3.20', + 'Pod::Simple::HTML' => '3.20', + 'Pod::Simple::HTMLBatch'=> '3.20', + 'Pod::Simple::LinkSection'=> '3.20', + 'Pod::Simple::Methody' => '3.20', + 'Pod::Simple::Progress' => '3.20', + 'Pod::Simple::PullParser'=> '3.20', + 'Pod::Simple::PullParserEndToken'=> '3.20', + 'Pod::Simple::PullParserStartToken'=> '3.20', + 'Pod::Simple::PullParserTextToken'=> '3.20', + 'Pod::Simple::PullParserToken'=> '3.20', + 'Pod::Simple::RTF' => '3.20', + 'Pod::Simple::Search' => '3.20', + 'Pod::Simple::SimpleTree'=> '3.20', + 'Pod::Simple::Text' => '3.20', + 'Pod::Simple::TextContent'=> '3.20', + 'Pod::Simple::TiedOutFH'=> '3.20', + 'Pod::Simple::Transcode'=> '3.20', + 'Pod::Simple::TranscodeDumb'=> '3.20', + 'Pod::Simple::TranscodeSmart'=> '3.20', + 'Pod::Simple::XHTML' => '3.20', + 'Pod::Simple::XMLOutStream'=> '3.20', + 'Socket' => '2.000', + 'Term::ReadLine' => '1.09', + 'Unicode::Collate' => '0.89', + 'Unicode::Collate::CJK::Korean'=> '0.88', + 'Unicode::Collate::Locale'=> '0.89', + 'Unicode::Normalize' => '1.14', + 'Unicode::UCD' => '0.42', + 'XS::APItest' => '0.37', + 'arybase' => '0.05', + 'attributes' => '0.18', + 'charnames' => '1.30', + 'feature' => '1.27', + }, + removed => { + } + }, + 5.016 => { + delta_from => 5.015009, + changed => { + 'B::Concise' => '0.89', + 'B::Deparse' => '1.14', + 'Carp' => '1.26', + 'Carp::Heavy' => '1.26', + 'IO::Socket' => '1.35', + 'Module::CoreList' => '2.66', + 'PerlIO::scalar' => '0.14', + 'Pod::Html' => '1.1502', + 'Safe' => '2.31_01', + 'Socket' => '2.001', + 'Unicode::UCD' => '0.43', + 'XS::APItest' => '0.38', + '_charnames' => '1.31', + 'attributes' => '0.19', + 'strict' => '1.07', + 'version' => '0.99', + }, + removed => { + } + }, + 5.016001 => { + delta_from => 5.016, + changed => { + 'B' => '1.35', + 'B::Deparse' => '1.14_01', + 'List::Util' => '1.25', + 'List::Util::PP' => '1.25', + 'List::Util::XS' => '1.25', + 'Module::CoreList' => '2.70', + 'PerlIO::scalar' => '0.14_01', + 'Scalar::Util' => '1.25', + 'Scalar::Util::PP' => '1.25', + 're' => '0.19_01', + }, + removed => { + } + }, + 5.016002 => { + delta_from => 5.016001, + changed => { + 'Module::CoreList' => '2.76', + }, + removed => { + } + }, + 5.016003 => { + delta_from => 5.016002, + changed => { + 'Encode' => '2.44_01', + 'Module::CoreList' => '2.76_02', + 'XS::APItest' => '0.39', + }, + removed => { + } + }, + 5.017 => { + delta_from => 5.016, + changed => { + 'B' => '1.35', + 'B::Concise' => '0.90', + 'ExtUtils::ParseXS' => '3.17', + 'ExtUtils::ParseXS::Utilities'=> '3.17', + 'File::DosGlob' => '1.07', + 'File::Find' => '1.21', + 'File::stat' => '1.06', + 'Hash::Util' => '0.12', + 'IO::Socket' => '1.34', + 'Module::CoreList' => '2.67', + 'Pod::Functions' => '1.06', + 'Storable' => '2.35', + 'XS::APItest' => '0.39', + 'diagnostics' => '1.29', + 'feature' => '1.28', + 'overload' => '1.19', + 'utf8' => '1.10', + }, + removed => { + 'Version::Requirements' => 1, + } + }, + 5.017001 => { + delta_from => 5.017, + changed => { + 'App::Prove' => '3.25', + 'App::Prove::State' => '3.25', + 'App::Prove::State::Result'=> '3.25', + 'App::Prove::State::Result::Test'=> '3.25', + 'Archive::Extract' => '0.60', + 'Archive::Tar' => '1.88', + 'Archive::Tar::Constant'=> '1.88', + 'Archive::Tar::File' => '1.88', + 'B' => '1.36', + 'B::Deparse' => '1.15', + 'CPAN::Meta' => '2.120921', + 'CPAN::Meta::Converter' => '2.120921', + 'CPAN::Meta::Feature' => '2.120921', + 'CPAN::Meta::History' => '2.120921', + 'CPAN::Meta::Prereqs' => '2.120921', + 'CPAN::Meta::Requirements'=> '2.122', + 'CPAN::Meta::Spec' => '2.120921', + 'CPAN::Meta::Validator' => '2.120921', + 'CPAN::Meta::YAML' => '0.008', + 'CPANPLUS' => '0.9130', + 'CPANPLUS::Config::HomeEnv'=> '0.04', + 'CPANPLUS::Internals' => '0.9130', + 'CPANPLUS::Shell::Default'=> '0.9130', + 'Class::Struct' => '0.64', + 'Compress::Raw::Bzip2' => '2.052', + 'Compress::Raw::Zlib' => '2.054', + 'Compress::Zlib' => '2.052', + 'Digest::MD5' => '2.52', + 'DynaLoader' => '1.15', + 'ExtUtils::CBuilder' => '0.280208', + 'ExtUtils::CBuilder::Base'=> '0.280208', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280208', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280208', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280208', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280208', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280208', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280208', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280208', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280208', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280208', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280208', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280208', + 'Fatal' => '2.11', + 'File::DosGlob' => '1.08', + 'File::Fetch' => '0.34', + 'File::Spec::Unix' => '3.39_03', + 'Filter::Util::Call' => '1.45', + 'HTTP::Tiny' => '0.022', + 'IO' => '1.25_07', + 'IO::Compress::Adapter::Bzip2'=> '2.052', + 'IO::Compress::Adapter::Deflate'=> '2.052', + 'IO::Compress::Adapter::Identity'=> '2.052', + 'IO::Compress::Base' => '2.052', + 'IO::Compress::Base::Common'=> '2.052', + 'IO::Compress::Bzip2' => '2.052', + 'IO::Compress::Deflate' => '2.052', + 'IO::Compress::Gzip' => '2.052', + 'IO::Compress::Gzip::Constants'=> '2.052', + 'IO::Compress::RawDeflate'=> '2.052', + 'IO::Compress::Zip' => '2.052', + 'IO::Compress::Zip::Constants'=> '2.052', + 'IO::Compress::Zlib::Constants'=> '2.052', + 'IO::Compress::Zlib::Extra'=> '2.052', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.052', + 'IO::Uncompress::Adapter::Identity'=> '2.052', + 'IO::Uncompress::Adapter::Inflate'=> '2.052', + 'IO::Uncompress::AnyInflate'=> '2.052', + 'IO::Uncompress::AnyUncompress'=> '2.052', + 'IO::Uncompress::Base' => '2.052', + 'IO::Uncompress::Bunzip2'=> '2.052', + 'IO::Uncompress::Gunzip'=> '2.052', + 'IO::Uncompress::Inflate'=> '2.052', + 'IO::Uncompress::RawInflate'=> '2.052', + 'IO::Uncompress::Unzip' => '2.052', + 'IPC::Cmd' => '0.78', + 'List::Util' => '1.25', + 'List::Util::XS' => '1.25', + 'Locale::Codes' => '3.22', + 'Locale::Codes::Constants'=> '3.22', + 'Locale::Codes::Country'=> '3.22', + 'Locale::Codes::Country_Codes'=> '3.22', + 'Locale::Codes::Country_Retired'=> '3.22', + 'Locale::Codes::Currency'=> '3.22', + 'Locale::Codes::Currency_Codes'=> '3.22', + 'Locale::Codes::Currency_Retired'=> '3.22', + 'Locale::Codes::LangExt'=> '3.22', + 'Locale::Codes::LangExt_Codes'=> '3.22', + 'Locale::Codes::LangExt_Retired'=> '3.22', + 'Locale::Codes::LangFam'=> '3.22', + 'Locale::Codes::LangFam_Codes'=> '3.22', + 'Locale::Codes::LangFam_Retired'=> '3.22', + 'Locale::Codes::LangVar'=> '3.22', + 'Locale::Codes::LangVar_Codes'=> '3.22', + 'Locale::Codes::LangVar_Retired'=> '3.22', + 'Locale::Codes::Language'=> '3.22', + 'Locale::Codes::Language_Codes'=> '3.22', + 'Locale::Codes::Language_Retired'=> '3.22', + 'Locale::Codes::Script' => '3.22', + 'Locale::Codes::Script_Codes'=> '3.22', + 'Locale::Codes::Script_Retired'=> '3.22', + 'Locale::Country' => '3.22', + 'Locale::Currency' => '3.22', + 'Locale::Language' => '3.22', + 'Locale::Script' => '3.22', + 'Memoize' => '1.03', + 'Memoize::AnyDBM_File' => '1.03', + 'Memoize::Expire' => '1.03', + 'Memoize::ExpireFile' => '1.03', + 'Memoize::ExpireTest' => '1.03', + 'Memoize::NDBM_File' => '1.03', + 'Memoize::SDBM_File' => '1.03', + 'Memoize::Storable' => '1.03', + 'Module::Build' => '0.40', + 'Module::Build::Base' => '0.40', + 'Module::Build::Compat' => '0.40', + 'Module::Build::Config' => '0.40', + 'Module::Build::Cookbook'=> '0.40', + 'Module::Build::Dumper' => '0.40', + 'Module::Build::ModuleInfo'=> '0.40', + 'Module::Build::Notes' => '0.40', + 'Module::Build::PPMMaker'=> '0.40', + 'Module::Build::Platform::Amiga'=> '0.40', + 'Module::Build::Platform::Default'=> '0.40', + 'Module::Build::Platform::EBCDIC'=> '0.40', + 'Module::Build::Platform::MPEiX'=> '0.40', + 'Module::Build::Platform::MacOS'=> '0.40', + 'Module::Build::Platform::RiscOS'=> '0.40', + 'Module::Build::Platform::Unix'=> '0.40', + 'Module::Build::Platform::VMS'=> '0.40', + 'Module::Build::Platform::VOS'=> '0.40', + 'Module::Build::Platform::Windows'=> '0.40', + 'Module::Build::Platform::aix'=> '0.40', + 'Module::Build::Platform::cygwin'=> '0.40', + 'Module::Build::Platform::darwin'=> '0.40', + 'Module::Build::Platform::os2'=> '0.40', + 'Module::Build::PodParser'=> '0.40', + 'Module::CoreList' => '2.68', + 'Module::Load::Conditional'=> '0.50', + 'Object::Accessor' => '0.44', + 'POSIX' => '1.31', + 'Params::Check' => '0.36', + 'Parse::CPAN::Meta' => '1.4404', + 'PerlIO::mmap' => '0.011', + 'PerlIO::via::QuotedPrint'=> '0.07', + 'Pod::Html' => '1.16', + 'Pod::Man' => '2.26', + 'Pod::Text' => '3.16', + 'Safe' => '2.33_01', + 'Scalar::Util' => '1.25', + 'Search::Dict' => '1.07', + 'Storable' => '2.36', + 'TAP::Base' => '3.25', + 'TAP::Formatter::Base' => '3.25', + 'TAP::Formatter::Color' => '3.25', + 'TAP::Formatter::Console'=> '3.25', + 'TAP::Formatter::Console::ParallelSession'=> '3.25', + 'TAP::Formatter::Console::Session'=> '3.25', + 'TAP::Formatter::File' => '3.25', + 'TAP::Formatter::File::Session'=> '3.25', + 'TAP::Formatter::Session'=> '3.25', + 'TAP::Harness' => '3.25', + 'TAP::Object' => '3.25', + 'TAP::Parser' => '3.25', + 'TAP::Parser::Aggregator'=> '3.25', + 'TAP::Parser::Grammar' => '3.25', + 'TAP::Parser::Iterator' => '3.25', + 'TAP::Parser::Iterator::Array'=> '3.25', + 'TAP::Parser::Iterator::Process'=> '3.25', + 'TAP::Parser::Iterator::Stream'=> '3.25', + 'TAP::Parser::IteratorFactory'=> '3.25', + 'TAP::Parser::Multiplexer'=> '3.25', + 'TAP::Parser::Result' => '3.25', + 'TAP::Parser::Result::Bailout'=> '3.25', + 'TAP::Parser::Result::Comment'=> '3.25', + 'TAP::Parser::Result::Plan'=> '3.25', + 'TAP::Parser::Result::Pragma'=> '3.25', + 'TAP::Parser::Result::Test'=> '3.25', + 'TAP::Parser::Result::Unknown'=> '3.25', + 'TAP::Parser::Result::Version'=> '3.25', + 'TAP::Parser::Result::YAML'=> '3.25', + 'TAP::Parser::ResultFactory'=> '3.25', + 'TAP::Parser::Scheduler'=> '3.25', + 'TAP::Parser::Scheduler::Job'=> '3.25', + 'TAP::Parser::Scheduler::Spinner'=> '3.25', + 'TAP::Parser::Source' => '3.25', + 'TAP::Parser::SourceHandler'=> '3.25', + 'TAP::Parser::SourceHandler::Executable'=> '3.25', + 'TAP::Parser::SourceHandler::File'=> '3.25', + 'TAP::Parser::SourceHandler::Handle'=> '3.25', + 'TAP::Parser::SourceHandler::Perl'=> '3.25', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.25', + 'TAP::Parser::Utils' => '3.25', + 'TAP::Parser::YAMLish::Reader'=> '3.25', + 'TAP::Parser::YAMLish::Writer'=> '3.25', + 'Term::ANSIColor' => '3.02', + 'Test::Harness' => '3.25', + 'Unicode' => '6.2.0', + 'Unicode::UCD' => '0.44', + 'XS::APItest' => '0.40', + '_charnames' => '1.32', + 'attributes' => '0.2', + 'autodie' => '2.11', + 'autodie::exception' => '2.11', + 'autodie::exception::system'=> '2.11', + 'autodie::hints' => '2.11', + 'bigint' => '0.30', + 'charnames' => '1.32', + 'feature' => '1.29', + 'inc::latest' => '0.40', + 'perlfaq' => '5.0150040', + 're' => '0.20', + }, + removed => { + 'List::Util::PP' => 1, + 'Scalar::Util::PP' => 1, + } + }, + 5.017002 => { + delta_from => 5.017001, + changed => { + 'App::Prove' => '3.25_01', + 'App::Prove::State' => '3.25_01', + 'App::Prove::State::Result'=> '3.25_01', + 'App::Prove::State::Result::Test'=> '3.25_01', + 'B::Concise' => '0.91', + 'Compress::Raw::Bzip2' => '2.05201', + 'Compress::Raw::Zlib' => '2.05401', + 'Exporter' => '5.67', + 'Exporter::Heavy' => '5.67', + 'Fatal' => '2.12', + 'File::Fetch' => '0.36', + 'File::stat' => '1.07', + 'IO' => '1.25_08', + 'IO::Socket' => '1.35', + 'Module::CoreList' => '2.69', + 'PerlIO::scalar' => '0.15', + 'Socket' => '2.002', + 'Storable' => '2.37', + 'TAP::Base' => '3.25_01', + 'TAP::Formatter::Base' => '3.25_01', + 'TAP::Formatter::Color' => '3.25_01', + 'TAP::Formatter::Console'=> '3.25_01', + 'TAP::Formatter::Console::ParallelSession'=> '3.25_01', + 'TAP::Formatter::Console::Session'=> '3.25_01', + 'TAP::Formatter::File' => '3.25_01', + 'TAP::Formatter::File::Session'=> '3.25_01', + 'TAP::Formatter::Session'=> '3.25_01', + 'TAP::Harness' => '3.25_01', + 'TAP::Object' => '3.25_01', + 'TAP::Parser' => '3.25_01', + 'TAP::Parser::Aggregator'=> '3.25_01', + 'TAP::Parser::Grammar' => '3.25_01', + 'TAP::Parser::Iterator' => '3.25_01', + 'TAP::Parser::Iterator::Array'=> '3.25_01', + 'TAP::Parser::Iterator::Process'=> '3.25_01', + 'TAP::Parser::Iterator::Stream'=> '3.25_01', + 'TAP::Parser::IteratorFactory'=> '3.25_01', + 'TAP::Parser::Multiplexer'=> '3.25_01', + 'TAP::Parser::Result' => '3.25_01', + 'TAP::Parser::Result::Bailout'=> '3.25_01', + 'TAP::Parser::Result::Comment'=> '3.25_01', + 'TAP::Parser::Result::Plan'=> '3.25_01', + 'TAP::Parser::Result::Pragma'=> '3.25_01', + 'TAP::Parser::Result::Test'=> '3.25_01', + 'TAP::Parser::Result::Unknown'=> '3.25_01', + 'TAP::Parser::Result::Version'=> '3.25_01', + 'TAP::Parser::Result::YAML'=> '3.25_01', + 'TAP::Parser::ResultFactory'=> '3.25_01', + 'TAP::Parser::Scheduler'=> '3.25_01', + 'TAP::Parser::Scheduler::Job'=> '3.25_01', + 'TAP::Parser::Scheduler::Spinner'=> '3.25_01', + 'TAP::Parser::Source' => '3.25_01', + 'TAP::Parser::SourceHandler'=> '3.25_01', + 'TAP::Parser::SourceHandler::Executable'=> '3.25_01', + 'TAP::Parser::SourceHandler::File'=> '3.25_01', + 'TAP::Parser::SourceHandler::Handle'=> '3.25_01', + 'TAP::Parser::SourceHandler::Perl'=> '3.25_01', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.25_01', + 'TAP::Parser::Utils' => '3.25_01', + 'TAP::Parser::YAMLish::Reader'=> '3.25_01', + 'TAP::Parser::YAMLish::Writer'=> '3.25_01', + 'Test::Harness' => '3.25_01', + 'Tie::StdHandle' => '4.3', + 'XS::APItest' => '0.41', + 'autodie' => '2.12', + 'autodie::exception' => '2.12', + 'autodie::exception::system'=> '2.12', + 'autodie::hints' => '2.12', + 'diagnostics' => '1.30', + 'overload' => '1.20', + 're' => '0.21', + 'vars' => '1.03', + }, + removed => { + } + }, + 5.017003 => { + delta_from => 5.017002, + changed => { + 'B' => '1.37', + 'B::Concise' => '0.92', + 'B::Debug' => '1.18', + 'B::Deparse' => '1.16', + 'CGI' => '3.60', + 'Compress::Raw::Bzip2' => '2.055', + 'Compress::Raw::Zlib' => '2.056', + 'Compress::Zlib' => '2.055', + 'Data::Dumper' => '2.135_07', + 'Devel::Peek' => '1.09', + 'Encode' => '2.47', + 'Encode::Alias' => '2.16', + 'Encode::GSM0338' => '2.02', + 'Encode::Unicode::UTF7' => '2.06', + 'IO::Compress::Adapter::Bzip2'=> '2.055', + 'IO::Compress::Adapter::Deflate'=> '2.055', + 'IO::Compress::Adapter::Identity'=> '2.055', + 'IO::Compress::Base' => '2.055', + 'IO::Compress::Base::Common'=> '2.055', + 'IO::Compress::Bzip2' => '2.055', + 'IO::Compress::Deflate' => '2.055', + 'IO::Compress::Gzip' => '2.055', + 'IO::Compress::Gzip::Constants'=> '2.055', + 'IO::Compress::RawDeflate'=> '2.055', + 'IO::Compress::Zip' => '2.055', + 'IO::Compress::Zip::Constants'=> '2.055', + 'IO::Compress::Zlib::Constants'=> '2.055', + 'IO::Compress::Zlib::Extra'=> '2.055', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.055', + 'IO::Uncompress::Adapter::Identity'=> '2.055', + 'IO::Uncompress::Adapter::Inflate'=> '2.055', + 'IO::Uncompress::AnyInflate'=> '2.055', + 'IO::Uncompress::AnyUncompress'=> '2.055', + 'IO::Uncompress::Base' => '2.055', + 'IO::Uncompress::Bunzip2'=> '2.055', + 'IO::Uncompress::Gunzip'=> '2.055', + 'IO::Uncompress::Inflate'=> '2.055', + 'IO::Uncompress::RawInflate'=> '2.055', + 'IO::Uncompress::Unzip' => '2.055', + 'Module::Build' => '0.4003', + 'Module::Build::Base' => '0.4003', + 'Module::Build::Compat' => '0.4003', + 'Module::Build::Config' => '0.4003', + 'Module::Build::Cookbook'=> '0.4003', + 'Module::Build::Dumper' => '0.4003', + 'Module::Build::ModuleInfo'=> '0.4003', + 'Module::Build::Notes' => '0.4003', + 'Module::Build::PPMMaker'=> '0.4003', + 'Module::Build::Platform::Amiga'=> '0.4003', + 'Module::Build::Platform::Default'=> '0.4003', + 'Module::Build::Platform::EBCDIC'=> '0.4003', + 'Module::Build::Platform::MPEiX'=> '0.4003', + 'Module::Build::Platform::MacOS'=> '0.4003', + 'Module::Build::Platform::RiscOS'=> '0.4003', + 'Module::Build::Platform::Unix'=> '0.4003', + 'Module::Build::Platform::VMS'=> '0.4003', + 'Module::Build::Platform::VOS'=> '0.4003', + 'Module::Build::Platform::Windows'=> '0.4003', + 'Module::Build::Platform::aix'=> '0.4003', + 'Module::Build::Platform::cygwin'=> '0.4003', + 'Module::Build::Platform::darwin'=> '0.4003', + 'Module::Build::Platform::os2'=> '0.4003', + 'Module::Build::PodParser'=> '0.4003', + 'Module::CoreList' => '2.71', + 'Module::CoreList::TieHashDelta'=> '2.71', + 'Module::Load::Conditional'=> '0.54', + 'Module::Metadata' => '1.000011', + 'Module::Pluggable' => '4.3', + 'Module::Pluggable::Object'=> '4.3', + 'Pod::Simple' => '3.23', + 'Pod::Simple::BlackBox' => '3.23', + 'Pod::Simple::Checker' => '3.23', + 'Pod::Simple::Debug' => '3.23', + 'Pod::Simple::DumpAsText'=> '3.23', + 'Pod::Simple::DumpAsXML'=> '3.23', + 'Pod::Simple::HTML' => '3.23', + 'Pod::Simple::HTMLBatch'=> '3.23', + 'Pod::Simple::LinkSection'=> '3.23', + 'Pod::Simple::Methody' => '3.23', + 'Pod::Simple::Progress' => '3.23', + 'Pod::Simple::PullParser'=> '3.23', + 'Pod::Simple::PullParserEndToken'=> '3.23', + 'Pod::Simple::PullParserStartToken'=> '3.23', + 'Pod::Simple::PullParserTextToken'=> '3.23', + 'Pod::Simple::PullParserToken'=> '3.23', + 'Pod::Simple::RTF' => '3.23', + 'Pod::Simple::Search' => '3.23', + 'Pod::Simple::SimpleTree'=> '3.23', + 'Pod::Simple::Text' => '3.23', + 'Pod::Simple::TextContent'=> '3.23', + 'Pod::Simple::TiedOutFH'=> '3.23', + 'Pod::Simple::Transcode'=> '3.23', + 'Pod::Simple::TranscodeDumb'=> '3.23', + 'Pod::Simple::TranscodeSmart'=> '3.23', + 'Pod::Simple::XHTML' => '3.23', + 'Pod::Simple::XMLOutStream'=> '3.23', + 'Socket' => '2.004', + 'Storable' => '2.38', + 'Sys::Syslog' => '0.31', + 'Term::ReadLine' => '1.10', + 'Text::Tabs' => '2012.0818', + 'Text::Wrap' => '2012.0818', + 'Time::Local' => '1.2300', + 'Unicode::UCD' => '0.45', + 'Win32' => '0.45', + 'Win32CORE' => '0.03', + 'XS::APItest' => '0.42', + 'inc::latest' => '0.4003', + 'perlfaq' => '5.0150041', + 're' => '0.22', + }, + removed => { + } + }, + 5.017004 => { + delta_from => 5.017003, + changed => { + 'Archive::Tar' => '1.90', + 'Archive::Tar::Constant'=> '1.90', + 'Archive::Tar::File' => '1.90', + 'B' => '1.38', + 'B::Concise' => '0.93', + 'B::Deparse' => '1.17', + 'B::Xref' => '1.04', + 'CPANPLUS' => '0.9131', + 'CPANPLUS::Internals' => '0.9131', + 'CPANPLUS::Shell::Default'=> '0.9131', + 'DB_File' => '1.827', + 'Devel::Peek' => '1.10', + 'DynaLoader' => '1.16', + 'Errno' => '1.16', + 'ExtUtils::ParseXS' => '3.18', + 'ExtUtils::ParseXS::Constants'=> '3.18', + 'ExtUtils::ParseXS::CountLines'=> '3.18', + 'ExtUtils::ParseXS::Utilities'=> '3.18', + 'File::Copy' => '2.24', + 'File::Find' => '1.22', + 'IPC::Open3' => '1.13', + 'Locale::Codes' => '3.23', + 'Locale::Codes::Constants'=> '3.23', + 'Locale::Codes::Country'=> '3.23', + 'Locale::Codes::Country_Codes'=> '3.23', + 'Locale::Codes::Country_Retired'=> '3.23', + 'Locale::Codes::Currency'=> '3.23', + 'Locale::Codes::Currency_Codes'=> '3.23', + 'Locale::Codes::Currency_Retired'=> '3.23', + 'Locale::Codes::LangExt'=> '3.23', + 'Locale::Codes::LangExt_Codes'=> '3.23', + 'Locale::Codes::LangExt_Retired'=> '3.23', + 'Locale::Codes::LangFam'=> '3.23', + 'Locale::Codes::LangFam_Codes'=> '3.23', + 'Locale::Codes::LangFam_Retired'=> '3.23', + 'Locale::Codes::LangVar'=> '3.23', + 'Locale::Codes::LangVar_Codes'=> '3.23', + 'Locale::Codes::LangVar_Retired'=> '3.23', + 'Locale::Codes::Language'=> '3.23', + 'Locale::Codes::Language_Codes'=> '3.23', + 'Locale::Codes::Language_Retired'=> '3.23', + 'Locale::Codes::Script' => '3.23', + 'Locale::Codes::Script_Codes'=> '3.23', + 'Locale::Codes::Script_Retired'=> '3.23', + 'Locale::Country' => '3.23', + 'Locale::Currency' => '3.23', + 'Locale::Language' => '3.23', + 'Locale::Script' => '3.23', + 'Math::BigFloat::Trace' => '0.30', + 'Math::BigInt::Trace' => '0.30', + 'Module::CoreList' => '2.73', + 'Module::CoreList::TieHashDelta'=> '2.73', + 'Opcode' => '1.24', + 'Socket' => '2.006', + 'Storable' => '2.39', + 'Sys::Syslog' => '0.32', + 'Unicode::UCD' => '0.46', + 'XS::APItest' => '0.43', + 'bignum' => '0.30', + 'bigrat' => '0.30', + 'constant' => '1.24', + 'feature' => '1.30', + 'threads::shared' => '1.41', + 'version' => '0.9901', + 'warnings' => '1.14', + }, + removed => { + } + }, + 5.017005 => { + delta_from => 5.017004, + changed => { + 'AutoLoader' => '5.73', + 'B' => '1.39', + 'B::Deparse' => '1.18', + 'CPANPLUS' => '0.9133', + 'CPANPLUS::Internals' => '0.9133', + 'CPANPLUS::Shell::Default'=> '0.9133', + 'Carp' => '1.27', + 'Carp::Heavy' => '1.27', + 'Data::Dumper' => '2.136', + 'Digest::SHA' => '5.72', + 'ExtUtils::CBuilder' => '0.280209', + 'ExtUtils::CBuilder::Base'=> '0.280209', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280209', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280209', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280209', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280209', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280209', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280209', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280209', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280209', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280209', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280209', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280209', + 'File::Copy' => '2.25', + 'File::Glob' => '1.18', + 'HTTP::Tiny' => '0.024', + 'Module::CoreList' => '2.75', + 'Module::CoreList::TieHashDelta'=> '2.75', + 'PerlIO::encoding' => '0.16', + 'Unicode::Collate' => '0.90', + 'Unicode::Collate::Locale'=> '0.90', + 'Unicode::Normalize' => '1.15', + 'Win32CORE' => '0.04', + 'XS::APItest' => '0.44', + 'attributes' => '0.21', + 'bigint' => '0.31', + 'bignum' => '0.31', + 'bigrat' => '0.31', + 'feature' => '1.31', + 'threads::shared' => '1.42', + 'warnings' => '1.15', + }, + removed => { + } + }, + 5.017006 => { + delta_from => 5.017005, + changed => { + 'B' => '1.40', + 'B::Concise' => '0.94', + 'B::Deparse' => '1.19', + 'B::Xref' => '1.05', + 'CGI' => '3.63', + 'CGI::Util' => '3.62', + 'CPAN' => '1.99_51', + 'CPANPLUS::Dist::Build' => '0.64', + 'CPANPLUS::Dist::Build::Constants'=> '0.64', + 'Carp' => '1.28', + 'Carp::Heavy' => '1.28', + 'Compress::Raw::Bzip2' => '2.058', + 'Compress::Raw::Zlib' => '2.058', + 'Compress::Zlib' => '2.058', + 'Data::Dumper' => '2.137', + 'Digest::SHA' => '5.73', + 'DynaLoader' => '1.17', + 'Env' => '1.04', + 'Errno' => '1.17', + 'ExtUtils::Manifest' => '1.62', + 'ExtUtils::Typemaps' => '3.18', + 'ExtUtils::Typemaps::Cmd'=> '3.18', + 'ExtUtils::Typemaps::InputMap'=> '3.18', + 'ExtUtils::Typemaps::OutputMap'=> '3.18', + 'ExtUtils::Typemaps::Type'=> '3.18', + 'Fatal' => '2.13', + 'File::Find' => '1.23', + 'Hash::Util' => '0.13', + 'IO::Compress::Adapter::Bzip2'=> '2.058', + 'IO::Compress::Adapter::Deflate'=> '2.058', + 'IO::Compress::Adapter::Identity'=> '2.058', + 'IO::Compress::Base' => '2.058', + 'IO::Compress::Base::Common'=> '2.058', + 'IO::Compress::Bzip2' => '2.058', + 'IO::Compress::Deflate' => '2.058', + 'IO::Compress::Gzip' => '2.058', + 'IO::Compress::Gzip::Constants'=> '2.058', + 'IO::Compress::RawDeflate'=> '2.058', + 'IO::Compress::Zip' => '2.058', + 'IO::Compress::Zip::Constants'=> '2.058', + 'IO::Compress::Zlib::Constants'=> '2.058', + 'IO::Compress::Zlib::Extra'=> '2.058', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.058', + 'IO::Uncompress::Adapter::Identity'=> '2.058', + 'IO::Uncompress::Adapter::Inflate'=> '2.058', + 'IO::Uncompress::AnyInflate'=> '2.058', + 'IO::Uncompress::AnyUncompress'=> '2.058', + 'IO::Uncompress::Base' => '2.058', + 'IO::Uncompress::Bunzip2'=> '2.058', + 'IO::Uncompress::Gunzip'=> '2.058', + 'IO::Uncompress::Inflate'=> '2.058', + 'IO::Uncompress::RawInflate'=> '2.058', + 'IO::Uncompress::Unzip' => '2.058', + 'Module::CoreList' => '2.78', + 'Module::CoreList::TieHashDelta'=> '2.77', + 'Module::Pluggable' => '4.5', + 'Module::Pluggable::Object'=> '4.5', + 'Opcode' => '1.25', + 'Sys::Hostname' => '1.17', + 'Term::UI' => '0.32', + 'Thread::Queue' => '3.01', + 'Tie::Hash::NamedCapture'=> '0.09', + 'Unicode::Collate' => '0.93', + 'Unicode::Collate::CJK::Korean'=> '0.93', + 'Unicode::Collate::Locale'=> '0.93', + 'Unicode::Normalize' => '1.16', + 'Unicode::UCD' => '0.47', + 'XS::APItest' => '0.46', + '_charnames' => '1.33', + 'autodie' => '2.13', + 'autodie::exception' => '2.13', + 'autodie::exception::system'=> '2.13', + 'autodie::hints' => '2.13', + 'charnames' => '1.33', + 're' => '0.23', + }, + removed => { + } + }, + 5.017007 => { + delta_from => 5.017006, + changed => { + 'B' => '1.41', + 'CPANPLUS::Dist::Build' => '0.68', + 'CPANPLUS::Dist::Build::Constants'=> '0.68', + 'Compress::Raw::Bzip2' => '2.059', + 'Compress::Raw::Zlib' => '2.059', + 'Compress::Zlib' => '2.059', + 'Cwd' => '3.39_03', + 'Data::Dumper' => '2.139', + 'Devel::Peek' => '1.11', + 'Digest::SHA' => '5.80', + 'DynaLoader' => '1.18', + 'English' => '1.06', + 'Errno' => '1.18', + 'ExtUtils::Command::MM' => '6.64', + 'ExtUtils::Liblist' => '6.64', + 'ExtUtils::Liblist::Kid'=> '6.64', + 'ExtUtils::MM' => '6.64', + 'ExtUtils::MM_AIX' => '6.64', + 'ExtUtils::MM_Any' => '6.64', + 'ExtUtils::MM_BeOS' => '6.64', + 'ExtUtils::MM_Cygwin' => '6.64', + 'ExtUtils::MM_DOS' => '6.64', + 'ExtUtils::MM_Darwin' => '6.64', + 'ExtUtils::MM_MacOS' => '6.64', + 'ExtUtils::MM_NW5' => '6.64', + 'ExtUtils::MM_OS2' => '6.64', + 'ExtUtils::MM_QNX' => '6.64', + 'ExtUtils::MM_UWIN' => '6.64', + 'ExtUtils::MM_Unix' => '6.64', + 'ExtUtils::MM_VMS' => '6.64', + 'ExtUtils::MM_VOS' => '6.64', + 'ExtUtils::MM_Win32' => '6.64', + 'ExtUtils::MM_Win95' => '6.64', + 'ExtUtils::MY' => '6.64', + 'ExtUtils::MakeMaker' => '6.64', + 'ExtUtils::MakeMaker::Config'=> '6.64', + 'ExtUtils::Mkbootstrap' => '6.64', + 'ExtUtils::Mksymlists' => '6.64', + 'ExtUtils::testlib' => '6.64', + 'File::DosGlob' => '1.09', + 'File::Glob' => '1.19', + 'GDBM_File' => '1.15', + 'IO::Compress::Adapter::Bzip2'=> '2.059', + 'IO::Compress::Adapter::Deflate'=> '2.059', + 'IO::Compress::Adapter::Identity'=> '2.059', + 'IO::Compress::Base' => '2.059', + 'IO::Compress::Base::Common'=> '2.059', + 'IO::Compress::Bzip2' => '2.059', + 'IO::Compress::Deflate' => '2.059', + 'IO::Compress::Gzip' => '2.059', + 'IO::Compress::Gzip::Constants'=> '2.059', + 'IO::Compress::RawDeflate'=> '2.059', + 'IO::Compress::Zip' => '2.059', + 'IO::Compress::Zip::Constants'=> '2.059', + 'IO::Compress::Zlib::Constants'=> '2.059', + 'IO::Compress::Zlib::Extra'=> '2.059', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.059', + 'IO::Uncompress::Adapter::Identity'=> '2.059', + 'IO::Uncompress::Adapter::Inflate'=> '2.059', + 'IO::Uncompress::AnyInflate'=> '2.059', + 'IO::Uncompress::AnyUncompress'=> '2.059', + 'IO::Uncompress::Base' => '2.059', + 'IO::Uncompress::Bunzip2'=> '2.059', + 'IO::Uncompress::Gunzip'=> '2.059', + 'IO::Uncompress::Inflate'=> '2.059', + 'IO::Uncompress::RawInflate'=> '2.059', + 'IO::Uncompress::Unzip' => '2.059', + 'List::Util' => '1.26', + 'List::Util::XS' => '1.26', + 'Locale::Codes' => '3.24', + 'Locale::Codes::Constants'=> '3.24', + 'Locale::Codes::Country'=> '3.24', + 'Locale::Codes::Country_Codes'=> '3.24', + 'Locale::Codes::Country_Retired'=> '3.24', + 'Locale::Codes::Currency'=> '3.24', + 'Locale::Codes::Currency_Codes'=> '3.24', + 'Locale::Codes::Currency_Retired'=> '3.24', + 'Locale::Codes::LangExt'=> '3.24', + 'Locale::Codes::LangExt_Codes'=> '3.24', + 'Locale::Codes::LangExt_Retired'=> '3.24', + 'Locale::Codes::LangFam'=> '3.24', + 'Locale::Codes::LangFam_Codes'=> '3.24', + 'Locale::Codes::LangFam_Retired'=> '3.24', + 'Locale::Codes::LangVar'=> '3.24', + 'Locale::Codes::LangVar_Codes'=> '3.24', + 'Locale::Codes::LangVar_Retired'=> '3.24', + 'Locale::Codes::Language'=> '3.24', + 'Locale::Codes::Language_Codes'=> '3.24', + 'Locale::Codes::Language_Retired'=> '3.24', + 'Locale::Codes::Script' => '3.24', + 'Locale::Codes::Script_Codes'=> '3.24', + 'Locale::Codes::Script_Retired'=> '3.24', + 'Locale::Country' => '3.24', + 'Locale::Currency' => '3.24', + 'Locale::Language' => '3.24', + 'Locale::Maketext' => '1.23', + 'Locale::Script' => '3.24', + 'Module::CoreList' => '2.79', + 'Module::CoreList::TieHashDelta'=> '2.79', + 'POSIX' => '1.32', + 'Scalar::Util' => '1.26', + 'Socket' => '2.006_001', + 'Storable' => '2.40', + 'Term::ReadLine' => '1.11', + 'Unicode::Collate' => '0.96', + 'Unicode::Collate::CJK::Stroke'=> '0.94', + 'Unicode::Collate::CJK::Zhuyin'=> '0.94', + 'Unicode::Collate::Locale'=> '0.96', + 'XS::APItest' => '0.48', + 'XS::Typemap' => '0.09', + '_charnames' => '1.34', + 'charnames' => '1.34', + 'feature' => '1.32', + 'mro' => '1.10', + 'sigtrap' => '1.07', + 'sort' => '2.02', + }, + removed => { + } + }, + 5.017008 => { + delta_from => 5.017007, + changed => { + 'Archive::Extract' => '0.62', + 'B' => '1.42', + 'B::Concise' => '0.95', + 'Compress::Raw::Bzip2' => '2.060', + 'Compress::Raw::Zlib' => '2.060', + 'Compress::Zlib' => '2.060', + 'Cwd' => '3.40', + 'Data::Dumper' => '2.141', + 'Digest::SHA' => '5.81', + 'ExtUtils::Install' => '1.59', + 'File::Fetch' => '0.38', + 'File::Path' => '2.09', + 'File::Spec' => '3.40', + 'File::Spec::Cygwin' => '3.40', + 'File::Spec::Epoc' => '3.40', + 'File::Spec::Functions' => '3.40', + 'File::Spec::Mac' => '3.40', + 'File::Spec::OS2' => '3.40', + 'File::Spec::Unix' => '3.40', + 'File::Spec::VMS' => '3.40', + 'File::Spec::Win32' => '3.40', + 'HTTP::Tiny' => '0.025', + 'Hash::Util' => '0.14', + 'I18N::LangTags' => '0.39', + 'I18N::LangTags::List' => '0.39', + 'I18N::Langinfo' => '0.09', + 'IO' => '1.26', + 'IO::Compress::Adapter::Bzip2'=> '2.060', + 'IO::Compress::Adapter::Deflate'=> '2.060', + 'IO::Compress::Adapter::Identity'=> '2.060', + 'IO::Compress::Base' => '2.060', + 'IO::Compress::Base::Common'=> '2.060', + 'IO::Compress::Bzip2' => '2.060', + 'IO::Compress::Deflate' => '2.060', + 'IO::Compress::Gzip' => '2.060', + 'IO::Compress::Gzip::Constants'=> '2.060', + 'IO::Compress::RawDeflate'=> '2.060', + 'IO::Compress::Zip' => '2.060', + 'IO::Compress::Zip::Constants'=> '2.060', + 'IO::Compress::Zlib::Constants'=> '2.060', + 'IO::Compress::Zlib::Extra'=> '2.060', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.060', + 'IO::Uncompress::Adapter::Identity'=> '2.060', + 'IO::Uncompress::Adapter::Inflate'=> '2.060', + 'IO::Uncompress::AnyInflate'=> '2.060', + 'IO::Uncompress::AnyUncompress'=> '2.060', + 'IO::Uncompress::Base' => '2.060', + 'IO::Uncompress::Bunzip2'=> '2.060', + 'IO::Uncompress::Gunzip'=> '2.060', + 'IO::Uncompress::Inflate'=> '2.060', + 'IO::Uncompress::RawInflate'=> '2.060', + 'IO::Uncompress::Unzip' => '2.060', + 'List::Util' => '1.27', + 'List::Util::XS' => '1.27', + 'Module::CoreList' => '2.80', + 'Module::CoreList::TieHashDelta'=> '2.80', + 'Pod::Html' => '1.17', + 'Pod::LaTeX' => '0.61', + 'Pod::Man' => '2.27', + 'Pod::Text' => '3.17', + 'Pod::Text::Color' => '2.07', + 'Pod::Text::Overstrike' => '2.05', + 'Pod::Text::Termcap' => '2.07', + 'Safe' => '2.34', + 'Scalar::Util' => '1.27', + 'Socket' => '2.009', + 'Term::ANSIColor' => '4.02', + 'Test' => '1.26', + 'Unicode::Collate' => '0.97', + 'XS::APItest' => '0.51', + 'XS::Typemap' => '0.10', + '_charnames' => '1.35', + 'charnames' => '1.35', + 'constant' => '1.25', + 'diagnostics' => '1.31', + 'threads::shared' => '1.43', + 'warnings' => '1.16', + }, + removed => { + } + }, + 5.017009 => { + delta_from => 5.017008, + changed => { + 'App::Cpan' => '1.60_02', + 'App::Prove' => '3.26', + 'App::Prove::State' => '3.26', + 'App::Prove::State::Result'=> '3.26', + 'App::Prove::State::Result::Test'=> '3.26', + 'Archive::Extract' => '0.68', + 'Attribute::Handlers' => '0.94', + 'B::Lint' => '1.17', + 'B::Lint::Debug' => '1.17', + 'Benchmark' => '1.14', + 'CPAN' => '2.00', + 'CPAN::Distribution' => '2.00', + 'CPAN::FirstTime' => '5.5304', + 'CPAN::Nox' => '5.5001', + 'CPANPLUS' => '0.9135', + 'CPANPLUS::Backend' => '0.9135', + 'CPANPLUS::Backend::RV' => '0.9135', + 'CPANPLUS::Config' => '0.9135', + 'CPANPLUS::Config::HomeEnv'=> '0.9135', + 'CPANPLUS::Configure' => '0.9135', + 'CPANPLUS::Configure::Setup'=> '0.9135', + 'CPANPLUS::Dist' => '0.9135', + 'CPANPLUS::Dist::Autobundle'=> '0.9135', + 'CPANPLUS::Dist::Base' => '0.9135', + 'CPANPLUS::Dist::Build' => '0.70', + 'CPANPLUS::Dist::Build::Constants'=> '0.70', + 'CPANPLUS::Dist::MM' => '0.9135', + 'CPANPLUS::Dist::Sample'=> '0.9135', + 'CPANPLUS::Error' => '0.9135', + 'CPANPLUS::Internals' => '0.9135', + 'CPANPLUS::Internals::Constants'=> '0.9135', + 'CPANPLUS::Internals::Constants::Report'=> '0.9135', + 'CPANPLUS::Internals::Extract'=> '0.9135', + 'CPANPLUS::Internals::Fetch'=> '0.9135', + 'CPANPLUS::Internals::Report'=> '0.9135', + 'CPANPLUS::Internals::Search'=> '0.9135', + 'CPANPLUS::Internals::Source'=> '0.9135', + 'CPANPLUS::Internals::Source::Memory'=> '0.9135', + 'CPANPLUS::Internals::Source::SQLite'=> '0.9135', + 'CPANPLUS::Internals::Source::SQLite::Tie'=> '0.9135', + 'CPANPLUS::Internals::Utils'=> '0.9135', + 'CPANPLUS::Internals::Utils::Autoflush'=> '0.9135', + 'CPANPLUS::Module' => '0.9135', + 'CPANPLUS::Module::Author'=> '0.9135', + 'CPANPLUS::Module::Author::Fake'=> '0.9135', + 'CPANPLUS::Module::Checksums'=> '0.9135', + 'CPANPLUS::Module::Fake'=> '0.9135', + 'CPANPLUS::Module::Signature'=> '0.9135', + 'CPANPLUS::Selfupdate' => '0.9135', + 'CPANPLUS::Shell' => '0.9135', + 'CPANPLUS::Shell::Classic'=> '0.9135', + 'CPANPLUS::Shell::Default'=> '0.9135', + 'CPANPLUS::Shell::Default::Plugins::CustomSource'=> '0.9135', + 'CPANPLUS::Shell::Default::Plugins::Remote'=> '0.9135', + 'CPANPLUS::Shell::Default::Plugins::Source'=> '0.9135', + 'Config' => '5.017009', + 'Config::Perl::V' => '0.17', + 'DBM_Filter' => '0.05', + 'Data::Dumper' => '2.142', + 'Digest::SHA' => '5.82', + 'Encode' => '2.48', + 'ExtUtils::Installed' => '1.999003', + 'ExtUtils::Manifest' => '1.63', + 'ExtUtils::ParseXS::Utilities'=> '3.19', + 'ExtUtils::Typemaps' => '3.19', + 'File::CheckTree' => '4.42', + 'File::DosGlob' => '1.10', + 'File::Temp' => '0.22_90', + 'Filter::Simple' => '0.89', + 'IO' => '1.27', + 'Log::Message' => '0.06', + 'Log::Message::Config' => '0.06', + 'Log::Message::Handlers'=> '0.06', + 'Log::Message::Item' => '0.06', + 'Log::Message::Simple' => '0.10', + 'Math::BigInt' => '1.999', + 'Module::CoreList' => '2.82', + 'Module::CoreList::TieHashDelta'=> '2.82', + 'Module::Load' => '0.24', + 'Module::Pluggable' => '4.6', + 'Module::Pluggable::Object'=> '4.6', + 'OS2::DLL' => '1.05', + 'OS2::ExtAttr' => '0.03', + 'OS2::Process' => '1.08', + 'Object::Accessor' => '0.46', + 'PerlIO::scalar' => '0.16', + 'Pod::Checker' => '1.60', + 'Pod::Find' => '1.60', + 'Pod::Html' => '1.18', + 'Pod::InputObjects' => '1.60', + 'Pod::ParseUtils' => '1.60', + 'Pod::Parser' => '1.60', + 'Pod::Perldoc' => '3.19', + 'Pod::Perldoc::BaseTo' => '3.19', + 'Pod::Perldoc::GetOptsOO'=> '3.19', + 'Pod::Perldoc::ToANSI' => '3.19', + 'Pod::Perldoc::ToChecker'=> '3.19', + 'Pod::Perldoc::ToMan' => '3.19', + 'Pod::Perldoc::ToNroff' => '3.19', + 'Pod::Perldoc::ToPod' => '3.19', + 'Pod::Perldoc::ToRtf' => '3.19', + 'Pod::Perldoc::ToTerm' => '3.19', + 'Pod::Perldoc::ToText' => '3.19', + 'Pod::Perldoc::ToTk' => '3.19', + 'Pod::Perldoc::ToXml' => '3.19', + 'Pod::PlainText' => '2.06', + 'Pod::Select' => '1.60', + 'Pod::Usage' => '1.61', + 'SelfLoader' => '1.21', + 'TAP::Base' => '3.26', + 'TAP::Formatter::Base' => '3.26', + 'TAP::Formatter::Color' => '3.26', + 'TAP::Formatter::Console'=> '3.26', + 'TAP::Formatter::Console::ParallelSession'=> '3.26', + 'TAP::Formatter::Console::Session'=> '3.26', + 'TAP::Formatter::File' => '3.26', + 'TAP::Formatter::File::Session'=> '3.26', + 'TAP::Formatter::Session'=> '3.26', + 'TAP::Harness' => '3.26', + 'TAP::Object' => '3.26', + 'TAP::Parser' => '3.26', + 'TAP::Parser::Aggregator'=> '3.26', + 'TAP::Parser::Grammar' => '3.26', + 'TAP::Parser::Iterator' => '3.26', + 'TAP::Parser::Iterator::Array'=> '3.26', + 'TAP::Parser::Iterator::Process'=> '3.26', + 'TAP::Parser::Iterator::Stream'=> '3.26', + 'TAP::Parser::IteratorFactory'=> '3.26', + 'TAP::Parser::Multiplexer'=> '3.26', + 'TAP::Parser::Result' => '3.26', + 'TAP::Parser::Result::Bailout'=> '3.26', + 'TAP::Parser::Result::Comment'=> '3.26', + 'TAP::Parser::Result::Plan'=> '3.26', + 'TAP::Parser::Result::Pragma'=> '3.26', + 'TAP::Parser::Result::Test'=> '3.26', + 'TAP::Parser::Result::Unknown'=> '3.26', + 'TAP::Parser::Result::Version'=> '3.26', + 'TAP::Parser::Result::YAML'=> '3.26', + 'TAP::Parser::ResultFactory'=> '3.26', + 'TAP::Parser::Scheduler'=> '3.26', + 'TAP::Parser::Scheduler::Job'=> '3.26', + 'TAP::Parser::Scheduler::Spinner'=> '3.26', + 'TAP::Parser::Source' => '3.26', + 'TAP::Parser::SourceHandler'=> '3.26', + 'TAP::Parser::SourceHandler::Executable'=> '3.26', + 'TAP::Parser::SourceHandler::File'=> '3.26', + 'TAP::Parser::SourceHandler::Handle'=> '3.26', + 'TAP::Parser::SourceHandler::Perl'=> '3.26', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.26', + 'TAP::Parser::Utils' => '3.26', + 'TAP::Parser::YAMLish::Reader'=> '3.26', + 'TAP::Parser::YAMLish::Writer'=> '3.26', + 'Term::UI' => '0.34', + 'Test::Harness' => '3.26', + 'Text::Soundex' => '3.04', + 'Thread::Queue' => '3.02', + 'Unicode::UCD' => '0.50', + 'Win32' => '0.46', + 'Win32API::File' => '0.1201', + '_charnames' => '1.36', + 'arybase' => '0.06', + 'bigint' => '0.32', + 'bignum' => '0.32', + 'charnames' => '1.36', + 'filetest' => '1.03', + 'locale' => '1.02', + 'overload' => '1.21', + 'warnings' => '1.17', + }, + removed => { + } + }, + 5.017010 => { + delta_from => 5.017009, + changed => { + 'Benchmark' => '1.15', + 'Config' => '5.017009', + 'Data::Dumper' => '2.145', + 'Digest::SHA' => '5.84', + 'Encode' => '2.49', + 'ExtUtils::Command::MM' => '6.65_01', + 'ExtUtils::Liblist' => '6.65_01', + 'ExtUtils::Liblist::Kid'=> '6.65_01', + 'ExtUtils::MM' => '6.65_01', + 'ExtUtils::MM_AIX' => '6.65_01', + 'ExtUtils::MM_Any' => '6.65_01', + 'ExtUtils::MM_BeOS' => '6.65_01', + 'ExtUtils::MM_Cygwin' => '6.65_01', + 'ExtUtils::MM_DOS' => '6.65_01', + 'ExtUtils::MM_Darwin' => '6.65_01', + 'ExtUtils::MM_MacOS' => '6.65_01', + 'ExtUtils::MM_NW5' => '6.65_01', + 'ExtUtils::MM_OS2' => '6.65_01', + 'ExtUtils::MM_QNX' => '6.65_01', + 'ExtUtils::MM_UWIN' => '6.65_01', + 'ExtUtils::MM_Unix' => '6.65_01', + 'ExtUtils::MM_VMS' => '6.65_01', + 'ExtUtils::MM_VOS' => '6.65_01', + 'ExtUtils::MM_Win32' => '6.65_01', + 'ExtUtils::MM_Win95' => '6.65_01', + 'ExtUtils::MY' => '6.65_01', + 'ExtUtils::MakeMaker' => '6.65_01', + 'ExtUtils::MakeMaker::Config'=> '6.65_01', + 'ExtUtils::Mkbootstrap' => '6.65_01', + 'ExtUtils::Mksymlists' => '6.65_01', + 'ExtUtils::testlib' => '6.65_01', + 'File::Copy' => '2.26', + 'File::Temp' => '0.23', + 'Getopt::Long' => '2.39', + 'Hash::Util' => '0.15', + 'I18N::Langinfo' => '0.10', + 'IPC::Cmd' => '0.80', + 'JSON::PP' => '2.27202', + 'Locale::Codes' => '3.25', + 'Locale::Codes::Constants'=> '3.25', + 'Locale::Codes::Country'=> '3.25', + 'Locale::Codes::Country_Codes'=> '3.25', + 'Locale::Codes::Country_Retired'=> '3.25', + 'Locale::Codes::Currency'=> '3.25', + 'Locale::Codes::Currency_Codes'=> '3.25', + 'Locale::Codes::Currency_Retired'=> '3.25', + 'Locale::Codes::LangExt'=> '3.25', + 'Locale::Codes::LangExt_Codes'=> '3.25', + 'Locale::Codes::LangExt_Retired'=> '3.25', + 'Locale::Codes::LangFam'=> '3.25', + 'Locale::Codes::LangFam_Codes'=> '3.25', + 'Locale::Codes::LangFam_Retired'=> '3.25', + 'Locale::Codes::LangVar'=> '3.25', + 'Locale::Codes::LangVar_Codes'=> '3.25', + 'Locale::Codes::LangVar_Retired'=> '3.25', + 'Locale::Codes::Language'=> '3.25', + 'Locale::Codes::Language_Codes'=> '3.25', + 'Locale::Codes::Language_Retired'=> '3.25', + 'Locale::Codes::Script' => '3.25', + 'Locale::Codes::Script_Codes'=> '3.25', + 'Locale::Codes::Script_Retired'=> '3.25', + 'Locale::Country' => '3.25', + 'Locale::Currency' => '3.25', + 'Locale::Language' => '3.25', + 'Locale::Script' => '3.25', + 'Math::BigFloat' => '1.998', + 'Math::BigFloat::Trace' => '0.32', + 'Math::BigInt' => '1.9991', + 'Math::BigInt::CalcEmu' => '1.998', + 'Math::BigInt::Trace' => '0.32', + 'Math::BigRat' => '0.2604', + 'Module::CoreList' => '2.84', + 'Module::CoreList::TieHashDelta'=> '2.84', + 'Module::Pluggable' => '4.7', + 'Net::Ping' => '2.41', + 'Perl::OSType' => '1.003', + 'Pod::Simple' => '3.26', + 'Pod::Simple::BlackBox' => '3.26', + 'Pod::Simple::Checker' => '3.26', + 'Pod::Simple::Debug' => '3.26', + 'Pod::Simple::DumpAsText'=> '3.26', + 'Pod::Simple::DumpAsXML'=> '3.26', + 'Pod::Simple::HTML' => '3.26', + 'Pod::Simple::HTMLBatch'=> '3.26', + 'Pod::Simple::LinkSection'=> '3.26', + 'Pod::Simple::Methody' => '3.26', + 'Pod::Simple::Progress' => '3.26', + 'Pod::Simple::PullParser'=> '3.26', + 'Pod::Simple::PullParserEndToken'=> '3.26', + 'Pod::Simple::PullParserStartToken'=> '3.26', + 'Pod::Simple::PullParserTextToken'=> '3.26', + 'Pod::Simple::PullParserToken'=> '3.26', + 'Pod::Simple::RTF' => '3.26', + 'Pod::Simple::Search' => '3.26', + 'Pod::Simple::SimpleTree'=> '3.26', + 'Pod::Simple::Text' => '3.26', + 'Pod::Simple::TextContent'=> '3.26', + 'Pod::Simple::TiedOutFH'=> '3.26', + 'Pod::Simple::Transcode'=> '3.26', + 'Pod::Simple::TranscodeDumb'=> '3.26', + 'Pod::Simple::TranscodeSmart'=> '3.26', + 'Pod::Simple::XHTML' => '3.26', + 'Pod::Simple::XMLOutStream'=> '3.26', + 'Safe' => '2.35', + 'Term::ReadLine' => '1.12', + 'Text::ParseWords' => '3.28', + 'Tie::File' => '0.99', + 'Unicode::UCD' => '0.51', + 'Win32' => '0.47', + 'bigint' => '0.33', + 'bignum' => '0.33', + 'bigrat' => '0.33', + 'constant' => '1.27', + 'perlfaq' => '5.0150042', + 'version' => '0.9902', + }, + removed => { + } + }, + 5.017011 => { + delta_from => 5.017010, + changed => { + 'App::Cpan' => '1.61', + 'B::Deparse' => '1.20', + 'Config' => '5.017009', + 'Exporter' => '5.68', + 'Exporter::Heavy' => '5.68', + 'ExtUtils::CBuilder' => '0.280210', + 'ExtUtils::Command::MM' => '6.66', + 'ExtUtils::Liblist' => '6.66', + 'ExtUtils::Liblist::Kid'=> '6.66', + 'ExtUtils::MM' => '6.66', + 'ExtUtils::MM_AIX' => '6.66', + 'ExtUtils::MM_Any' => '6.66', + 'ExtUtils::MM_BeOS' => '6.66', + 'ExtUtils::MM_Cygwin' => '6.66', + 'ExtUtils::MM_DOS' => '6.66', + 'ExtUtils::MM_Darwin' => '6.66', + 'ExtUtils::MM_MacOS' => '6.66', + 'ExtUtils::MM_NW5' => '6.66', + 'ExtUtils::MM_OS2' => '6.66', + 'ExtUtils::MM_QNX' => '6.66', + 'ExtUtils::MM_UWIN' => '6.66', + 'ExtUtils::MM_Unix' => '6.66', + 'ExtUtils::MM_VMS' => '6.66', + 'ExtUtils::MM_VOS' => '6.66', + 'ExtUtils::MM_Win32' => '6.66', + 'ExtUtils::MM_Win95' => '6.66', + 'ExtUtils::MY' => '6.66', + 'ExtUtils::MakeMaker' => '6.66', + 'ExtUtils::MakeMaker::Config'=> '6.66', + 'ExtUtils::Mkbootstrap' => '6.66', + 'ExtUtils::Mksymlists' => '6.66', + 'ExtUtils::testlib' => '6.66', + 'File::Glob' => '1.20', + 'IO' => '1.28', + 'Module::CoreList' => '2.87', + 'Module::CoreList::TieHashDelta'=> '2.87', + 'Storable' => '2.41', + 'bigint' => '0.34', + 'mro' => '1.11', + 'overload' => '1.22', + 'warnings' => '1.18', + }, + removed => { + } + }, + 5.018000 => { + delta_from => 5.017011, + changed => { + 'Carp' => '1.29', + 'Carp::Heavy' => '1.29', + 'Config' => '5.018000', + 'Hash::Util' => '0.16', + 'IO::Handle' => '1.34', + 'IO::Socket' => '1.36', + 'Module::CoreList' => '2.89', + 'Module::CoreList::TieHashDelta'=> '2.89', + 'Pod::Simple' => '3.28', + 'Pod::Simple::BlackBox' => '3.28', + 'Pod::Simple::Checker' => '3.28', + 'Pod::Simple::Debug' => '3.28', + 'Pod::Simple::DumpAsText'=> '3.28', + 'Pod::Simple::DumpAsXML'=> '3.28', + 'Pod::Simple::HTML' => '3.28', + 'Pod::Simple::HTMLBatch'=> '3.28', + 'Pod::Simple::LinkSection'=> '3.28', + 'Pod::Simple::Methody' => '3.28', + 'Pod::Simple::Progress' => '3.28', + 'Pod::Simple::PullParser'=> '3.28', + 'Pod::Simple::PullParserEndToken'=> '3.28', + 'Pod::Simple::PullParserStartToken'=> '3.28', + 'Pod::Simple::PullParserTextToken'=> '3.28', + 'Pod::Simple::PullParserToken'=> '3.28', + 'Pod::Simple::RTF' => '3.28', + 'Pod::Simple::Search' => '3.28', + 'Pod::Simple::SimpleTree'=> '3.28', + 'Pod::Simple::Text' => '3.28', + 'Pod::Simple::TextContent'=> '3.28', + 'Pod::Simple::TiedOutFH'=> '3.28', + 'Pod::Simple::Transcode'=> '3.28', + 'Pod::Simple::TranscodeDumb'=> '3.28', + 'Pod::Simple::TranscodeSmart'=> '3.28', + 'Pod::Simple::XHTML' => '3.28', + 'Pod::Simple::XMLOutStream'=> '3.28', + }, + removed => { + } + }, + 5.018001 => { + delta_from => 5.018000, + changed => { + 'B' => '1.42_01', + 'Config' => '5.018001', + 'Digest::SHA' => '5.84_01', + 'Module::CoreList' => '2.96', + 'Module::CoreList::TieHashDelta'=> '2.96', + 'Module::CoreList::Utils'=> '2.96', + }, + removed => { + 'VMS::Filespec' => 1, + } + }, + 5.018002 => { + delta_from => 5.018001, + changed => { + 'B' => '1.42_02', + 'B::Concise' => '0.95_01', + 'Config' => '5.018002', + 'File::Glob' => '1.20_01', + 'Module::CoreList' => '3.03', + 'Module::CoreList::TieHashDelta'=> '3.03', + 'Module::CoreList::Utils'=> '3.03', + }, + }, + 5.018003 => { + delta_from => 5.018002, + changed => { + 'Config' => '5.018003', + 'Digest::SHA' => '5.84_02', + 'Module::CoreList' => '3.12', + 'Module::CoreList::TieHashDelta'=> '3.12', + 'Module::CoreList::Utils'=> '3.12', + }, + }, + 5.018004 => { + delta_from => 5.018003, + changed => { + 'Config' => '5.018004', + 'Module::CoreList' => '3.13', + 'Module::CoreList::TieHashDelta'=> '3.13', + 'Module::CoreList::Utils'=> '3.13', + }, + }, + 5.019000 => { + delta_from => 5.018000, + changed => { + 'Config' => '5.019000', + 'Getopt::Std' => '1.08', + 'Module::CoreList' => '2.91', + 'Module::CoreList::TieHashDelta'=> '2.91', + 'Storable' => '2.42', + 'feature' => '1.33', + 'utf8' => '1.11', + }, + removed => { + 'Archive::Extract' => 1, + 'B::Lint' => 1, + 'B::Lint::Debug' => 1, + 'CPANPLUS' => 1, + 'CPANPLUS::Backend' => 1, + 'CPANPLUS::Backend::RV' => 1, + 'CPANPLUS::Config' => 1, + 'CPANPLUS::Config::HomeEnv'=> 1, + 'CPANPLUS::Configure' => 1, + 'CPANPLUS::Configure::Setup'=> 1, + 'CPANPLUS::Dist' => 1, + 'CPANPLUS::Dist::Autobundle'=> 1, + 'CPANPLUS::Dist::Base' => 1, + 'CPANPLUS::Dist::Build' => 1, + 'CPANPLUS::Dist::Build::Constants'=> 1, + 'CPANPLUS::Dist::MM' => 1, + 'CPANPLUS::Dist::Sample'=> 1, + 'CPANPLUS::Error' => 1, + 'CPANPLUS::Internals' => 1, + 'CPANPLUS::Internals::Constants'=> 1, + 'CPANPLUS::Internals::Constants::Report'=> 1, + 'CPANPLUS::Internals::Extract'=> 1, + 'CPANPLUS::Internals::Fetch'=> 1, + 'CPANPLUS::Internals::Report'=> 1, + 'CPANPLUS::Internals::Search'=> 1, + 'CPANPLUS::Internals::Source'=> 1, + 'CPANPLUS::Internals::Source::Memory'=> 1, + 'CPANPLUS::Internals::Source::SQLite'=> 1, + 'CPANPLUS::Internals::Source::SQLite::Tie'=> 1, + 'CPANPLUS::Internals::Utils'=> 1, + 'CPANPLUS::Internals::Utils::Autoflush'=> 1, + 'CPANPLUS::Module' => 1, + 'CPANPLUS::Module::Author'=> 1, + 'CPANPLUS::Module::Author::Fake'=> 1, + 'CPANPLUS::Module::Checksums'=> 1, + 'CPANPLUS::Module::Fake'=> 1, + 'CPANPLUS::Module::Signature'=> 1, + 'CPANPLUS::Selfupdate' => 1, + 'CPANPLUS::Shell' => 1, + 'CPANPLUS::Shell::Classic'=> 1, + 'CPANPLUS::Shell::Default'=> 1, + 'CPANPLUS::Shell::Default::Plugins::CustomSource'=> 1, + 'CPANPLUS::Shell::Default::Plugins::Remote'=> 1, + 'CPANPLUS::Shell::Default::Plugins::Source'=> 1, + 'Devel::InnerPackage' => 1, + 'File::CheckTree' => 1, + 'Log::Message' => 1, + 'Log::Message::Config' => 1, + 'Log::Message::Handlers'=> 1, + 'Log::Message::Item' => 1, + 'Log::Message::Simple' => 1, + 'Module::Pluggable' => 1, + 'Module::Pluggable::Object'=> 1, + 'Object::Accessor' => 1, + 'Pod::LaTeX' => 1, + 'Term::UI' => 1, + 'Term::UI::History' => 1, + 'Text::Soundex' => 1, + } + }, + 5.019001 => { + delta_from => 5.019000, + changed => { + 'App::Prove' => '3.28', + 'App::Prove::State' => '3.28', + 'App::Prove::State::Result'=> '3.28', + 'App::Prove::State::Result::Test'=> '3.28', + 'Archive::Tar' => '1.92', + 'Archive::Tar::Constant'=> '1.92', + 'Archive::Tar::File' => '1.92', + 'Attribute::Handlers' => '0.95', + 'B' => '1.43', + 'B::Concise' => '0.96', + 'B::Deparse' => '1.21', + 'B::Showlex' => '1.04', + 'Benchmark' => '1.16', + 'CPAN::Meta' => '2.131560', + 'CPAN::Meta::Converter' => '2.131560', + 'CPAN::Meta::Feature' => '2.131560', + 'CPAN::Meta::History' => '2.131560', + 'CPAN::Meta::Prereqs' => '2.131560', + 'CPAN::Meta::Spec' => '2.131560', + 'CPAN::Meta::Validator' => '2.131560', + 'Carp' => '1.30', + 'Carp::Heavy' => '1.30', + 'Compress::Raw::Bzip2' => '2.061', + 'Compress::Raw::Zlib' => '2.061', + 'Compress::Zlib' => '2.061', + 'Config' => '5.019001', + 'Config::Perl::V' => '0.18', + 'Cwd' => '3.41', + 'DB' => '1.06', + 'DB_File' => '1.828', + 'Data::Dumper' => '2.146', + 'Encode' => '2.51', + 'Encode::CN::HZ' => '2.06', + 'Encode::GSM0338' => '2.03', + 'Encode::Unicode::UTF7' => '2.07', + 'ExtUtils::CBuilder::Base'=> '0.280210', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280210', + 'ExtUtils::Command::MM' => '6.68', + 'ExtUtils::Install' => '1.60', + 'ExtUtils::Liblist' => '6.68', + 'ExtUtils::Liblist::Kid'=> '6.68', + 'ExtUtils::MM' => '6.68', + 'ExtUtils::MM_AIX' => '6.68', + 'ExtUtils::MM_Any' => '6.68', + 'ExtUtils::MM_BeOS' => '6.68', + 'ExtUtils::MM_Cygwin' => '6.68', + 'ExtUtils::MM_DOS' => '6.68', + 'ExtUtils::MM_Darwin' => '6.68', + 'ExtUtils::MM_MacOS' => '6.68', + 'ExtUtils::MM_NW5' => '6.68', + 'ExtUtils::MM_OS2' => '6.68', + 'ExtUtils::MM_QNX' => '6.68', + 'ExtUtils::MM_UWIN' => '6.68', + 'ExtUtils::MM_Unix' => '6.68', + 'ExtUtils::MM_VMS' => '6.68', + 'ExtUtils::MM_VOS' => '6.68', + 'ExtUtils::MM_Win32' => '6.68', + 'ExtUtils::MM_Win95' => '6.68', + 'ExtUtils::MY' => '6.68', + 'ExtUtils::MakeMaker' => '6.68', + 'ExtUtils::MakeMaker::Config'=> '6.68', + 'ExtUtils::Mkbootstrap' => '6.68', + 'ExtUtils::Mksymlists' => '6.68', + 'ExtUtils::ParseXS' => '3.19', + 'ExtUtils::testlib' => '6.68', + 'Fatal' => '2.19', + 'File::Copy' => '2.27', + 'File::DosGlob' => '1.11', + 'File::Fetch' => '0.42', + 'File::Find' => '1.24', + 'File::Spec' => '3.41', + 'File::Spec::Cygwin' => '3.41', + 'File::Spec::Epoc' => '3.41', + 'File::Spec::Mac' => '3.41', + 'File::Spec::OS2' => '3.41', + 'File::Spec::Unix' => '3.41', + 'File::Spec::VMS' => '3.41', + 'File::Spec::Win32' => '3.41', + 'File::Temp' => '0.2301', + 'Filter::Simple' => '0.90', + 'Filter::Util::Call' => '1.49', + 'Getopt::Long' => '2.4', + 'HTTP::Tiny' => '0.031', + 'Hash::Util::FieldHash' => '1.11', + 'IO::Compress::Adapter::Bzip2'=> '2.061', + 'IO::Compress::Adapter::Deflate'=> '2.061', + 'IO::Compress::Adapter::Identity'=> '2.061', + 'IO::Compress::Base' => '2.061', + 'IO::Compress::Base::Common'=> '2.061', + 'IO::Compress::Bzip2' => '2.061', + 'IO::Compress::Deflate' => '2.061', + 'IO::Compress::Gzip' => '2.061', + 'IO::Compress::Gzip::Constants'=> '2.061', + 'IO::Compress::RawDeflate'=> '2.061', + 'IO::Compress::Zip' => '2.061', + 'IO::Compress::Zip::Constants'=> '2.061', + 'IO::Compress::Zlib::Constants'=> '2.061', + 'IO::Compress::Zlib::Extra'=> '2.061', + 'IO::Handle' => '1.35', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.061', + 'IO::Uncompress::Adapter::Identity'=> '2.061', + 'IO::Uncompress::Adapter::Inflate'=> '2.061', + 'IO::Uncompress::AnyInflate'=> '2.061', + 'IO::Uncompress::AnyUncompress'=> '2.061', + 'IO::Uncompress::Base' => '2.061', + 'IO::Uncompress::Bunzip2'=> '2.061', + 'IO::Uncompress::Gunzip'=> '2.061', + 'IO::Uncompress::Inflate'=> '2.061', + 'IO::Uncompress::RawInflate'=> '2.061', + 'IO::Uncompress::Unzip' => '2.061', + 'IPC::Open3' => '1.14', + 'Locale::Codes' => '3.26', + 'Locale::Codes::Constants'=> '3.26', + 'Locale::Codes::Country'=> '3.26', + 'Locale::Codes::Country_Codes'=> '3.26', + 'Locale::Codes::Country_Retired'=> '3.26', + 'Locale::Codes::Currency'=> '3.26', + 'Locale::Codes::Currency_Codes'=> '3.26', + 'Locale::Codes::Currency_Retired'=> '3.26', + 'Locale::Codes::LangExt'=> '3.26', + 'Locale::Codes::LangExt_Codes'=> '3.26', + 'Locale::Codes::LangExt_Retired'=> '3.26', + 'Locale::Codes::LangFam'=> '3.26', + 'Locale::Codes::LangFam_Codes'=> '3.26', + 'Locale::Codes::LangFam_Retired'=> '3.26', + 'Locale::Codes::LangVar'=> '3.26', + 'Locale::Codes::LangVar_Codes'=> '3.26', + 'Locale::Codes::LangVar_Retired'=> '3.26', + 'Locale::Codes::Language'=> '3.26', + 'Locale::Codes::Language_Codes'=> '3.26', + 'Locale::Codes::Language_Retired'=> '3.26', + 'Locale::Codes::Script' => '3.26', + 'Locale::Codes::Script_Codes'=> '3.26', + 'Locale::Codes::Script_Retired'=> '3.26', + 'Locale::Country' => '3.26', + 'Locale::Currency' => '3.26', + 'Locale::Language' => '3.26', + 'Locale::Maketext' => '1.24', + 'Locale::Script' => '3.26', + 'Math::BigFloat' => '1.999', + 'Math::BigInt' => '1.9992', + 'Math::BigInt::Calc' => '1.998', + 'Math::BigInt::CalcEmu' => '1.9991', + 'Math::BigRat' => '0.2606', + 'Module::Build' => '0.4005', + 'Module::Build::Base' => '0.4005', + 'Module::Build::Compat' => '0.4005', + 'Module::Build::Config' => '0.4005', + 'Module::Build::Cookbook'=> '0.4005', + 'Module::Build::Dumper' => '0.4005', + 'Module::Build::ModuleInfo'=> '0.4005', + 'Module::Build::Notes' => '0.4005', + 'Module::Build::PPMMaker'=> '0.4005', + 'Module::Build::Platform::Amiga'=> '0.4005', + 'Module::Build::Platform::Default'=> '0.4005', + 'Module::Build::Platform::EBCDIC'=> '0.4005', + 'Module::Build::Platform::MPEiX'=> '0.4005', + 'Module::Build::Platform::MacOS'=> '0.4005', + 'Module::Build::Platform::RiscOS'=> '0.4005', + 'Module::Build::Platform::Unix'=> '0.4005', + 'Module::Build::Platform::VMS'=> '0.4005', + 'Module::Build::Platform::VOS'=> '0.4005', + 'Module::Build::Platform::Windows'=> '0.4005', + 'Module::Build::Platform::aix'=> '0.4005', + 'Module::Build::Platform::cygwin'=> '0.4005', + 'Module::Build::Platform::darwin'=> '0.4005', + 'Module::Build::Platform::os2'=> '0.4005', + 'Module::Build::PodParser'=> '0.4005', + 'Module::CoreList' => '2.92', + 'Module::CoreList::TieHashDelta'=> '2.92', + 'Module::CoreList::Utils'=> '2.92', + 'Module::Metadata' => '1.000014', + 'Net::Ping' => '2.42', + 'OS2::Process' => '1.09', + 'POSIX' => '1.33', + 'Pod::Find' => '1.61', + 'Pod::Html' => '1.19', + 'Pod::InputObjects' => '1.61', + 'Pod::ParseUtils' => '1.61', + 'Pod::Parser' => '1.61', + 'Pod::Perldoc' => '3.20', + 'Pod::Perldoc::BaseTo' => '3.20', + 'Pod::Perldoc::GetOptsOO'=> '3.20', + 'Pod::Perldoc::ToANSI' => '3.20', + 'Pod::Perldoc::ToChecker'=> '3.20', + 'Pod::Perldoc::ToMan' => '3.20', + 'Pod::Perldoc::ToNroff' => '3.20', + 'Pod::Perldoc::ToPod' => '3.20', + 'Pod::Perldoc::ToRtf' => '3.20', + 'Pod::Perldoc::ToTerm' => '3.20', + 'Pod::Perldoc::ToText' => '3.20', + 'Pod::Perldoc::ToTk' => '3.20', + 'Pod::Perldoc::ToXml' => '3.20', + 'Pod::Select' => '1.61', + 'Pod::Usage' => '1.63', + 'Safe' => '2.36', + 'Storable' => '2.43', + 'Sys::Hostname' => '1.18', + 'Sys::Syslog' => '0.33', + 'TAP::Base' => '3.28', + 'TAP::Formatter::Base' => '3.28', + 'TAP::Formatter::Color' => '3.28', + 'TAP::Formatter::Console'=> '3.28', + 'TAP::Formatter::Console::ParallelSession'=> '3.28', + 'TAP::Formatter::Console::Session'=> '3.28', + 'TAP::Formatter::File' => '3.28', + 'TAP::Formatter::File::Session'=> '3.28', + 'TAP::Formatter::Session'=> '3.28', + 'TAP::Harness' => '3.28', + 'TAP::Object' => '3.28', + 'TAP::Parser' => '3.28', + 'TAP::Parser::Aggregator'=> '3.28', + 'TAP::Parser::Grammar' => '3.28', + 'TAP::Parser::Iterator' => '3.28', + 'TAP::Parser::Iterator::Array'=> '3.28', + 'TAP::Parser::Iterator::Process'=> '3.28', + 'TAP::Parser::Iterator::Stream'=> '3.28', + 'TAP::Parser::IteratorFactory'=> '3.28', + 'TAP::Parser::Multiplexer'=> '3.28', + 'TAP::Parser::Result' => '3.28', + 'TAP::Parser::Result::Bailout'=> '3.28', + 'TAP::Parser::Result::Comment'=> '3.28', + 'TAP::Parser::Result::Plan'=> '3.28', + 'TAP::Parser::Result::Pragma'=> '3.28', + 'TAP::Parser::Result::Test'=> '3.28', + 'TAP::Parser::Result::Unknown'=> '3.28', + 'TAP::Parser::Result::Version'=> '3.28', + 'TAP::Parser::Result::YAML'=> '3.28', + 'TAP::Parser::ResultFactory'=> '3.28', + 'TAP::Parser::Scheduler'=> '3.28', + 'TAP::Parser::Scheduler::Job'=> '3.28', + 'TAP::Parser::Scheduler::Spinner'=> '3.28', + 'TAP::Parser::Source' => '3.28', + 'TAP::Parser::SourceHandler'=> '3.28', + 'TAP::Parser::SourceHandler::Executable'=> '3.28', + 'TAP::Parser::SourceHandler::File'=> '3.28', + 'TAP::Parser::SourceHandler::Handle'=> '3.28', + 'TAP::Parser::SourceHandler::Perl'=> '3.28', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.28', + 'TAP::Parser::Utils' => '3.28', + 'TAP::Parser::YAMLish::Reader'=> '3.28', + 'TAP::Parser::YAMLish::Writer'=> '3.28', + 'Term::ReadLine' => '1.13', + 'Test::Harness' => '3.28', + 'Text::Tabs' => '2013.0523', + 'Text::Wrap' => '2013.0523', + 'Thread' => '3.04', + 'Tie::File' => '1.00', + 'Time::Piece' => '1.2002', + 'Unicode::Collate' => '0.98', + 'Unicode::UCD' => '0.53', + 'XS::APItest' => '0.53', + '_charnames' => '1.37', + 'autodie' => '2.19', + 'autodie::exception' => '2.19', + 'autodie::exception::system'=> '2.19', + 'autodie::hints' => '2.19', + 'autodie::skip' => '2.19', + 'bigint' => '0.35', + 'charnames' => '1.38', + 'encoding' => '2.12', + 'inc::latest' => '0.4005', + 'mro' => '1.12', + 'perlfaq' => '5.0150043', + 're' => '0.25', + 'threads' => '1.87', + 'threads::shared' => '1.44', + 'utf8' => '1.12', + }, + removed => { + } + }, + 5.019002 => { + delta_from => 5.019001, + changed => { + 'B' => '1.44', + 'B::Concise' => '0.98', + 'B::Deparse' => '1.22', + 'Benchmark' => '1.17', + 'Class::Struct' => '0.65', + 'Config' => '5.019002', + 'DB' => '1.07', + 'DBM_Filter' => '0.06', + 'DBM_Filter::compress' => '0.03', + 'DBM_Filter::encode' => '0.03', + 'DBM_Filter::int32' => '0.03', + 'DBM_Filter::null' => '0.03', + 'DBM_Filter::utf8' => '0.03', + 'DB_File' => '1.829', + 'Data::Dumper' => '2.147', + 'Devel::Peek' => '1.12', + 'Digest::MD5' => '2.53', + 'Digest::SHA' => '5.85', + 'English' => '1.07', + 'Errno' => '1.19', + 'ExtUtils::Embed' => '1.31', + 'ExtUtils::Miniperl' => '1', + 'ExtUtils::ParseXS' => '3.21', + 'ExtUtils::ParseXS::Constants'=> '3.21', + 'ExtUtils::ParseXS::CountLines'=> '3.21', + 'ExtUtils::ParseXS::Eval'=> '3.19', + 'ExtUtils::ParseXS::Utilities'=> '3.21', + 'ExtUtils::Typemaps' => '3.21', + 'ExtUtils::Typemaps::Cmd'=> '3.21', + 'ExtUtils::Typemaps::InputMap'=> '3.21', + 'ExtUtils::Typemaps::OutputMap'=> '3.21', + 'ExtUtils::Typemaps::Type'=> '3.21', + 'ExtUtils::XSSymSet' => '1.3', + 'Fatal' => '2.20', + 'File::Basename' => '2.85', + 'File::Spec::VMS' => '3.43', + 'File::Spec::Win32' => '3.42', + 'Getopt::Long' => '2.41', + 'Getopt::Std' => '1.09', + 'HTTP::Tiny' => '0.034', + 'Hash::Util::FieldHash' => '1.12', + 'I18N::Langinfo' => '0.11', + 'IO::Socket::INET' => '1.34', + 'IO::Socket::UNIX' => '1.25', + 'IPC::Cmd' => '0.82', + 'MIME::Base64' => '3.14', + 'Module::CoreList' => '2.94', + 'Module::CoreList::TieHashDelta'=> '2.94', + 'Module::CoreList::Utils'=> '2.94', + 'POSIX' => '1.34', + 'Params::Check' => '0.38', + 'Parse::CPAN::Meta' => '1.4405', + 'Pod::Functions' => '1.07', + 'Pod::Html' => '1.2', + 'Safe' => '2.37', + 'Socket' => '2.010', + 'Storable' => '2.45', + 'Text::ParseWords' => '3.29', + 'Tie::Array' => '1.06', + 'Tie::Hash' => '1.05', + 'Tie::Scalar' => '1.03', + 'Time::Piece' => '1.21', + 'Time::Seconds' => '1.21', + 'XS::APItest' => '0.54', + 'autodie' => '2.20', + 'autodie::exception' => '2.20', + 'autodie::exception::system'=> '2.20', + 'autodie::hints' => '2.20', + 'autodie::skip' => '2.20', + 'base' => '2.19', + 'deprecate' => '0.03', + 'if' => '0.0603', + 'integer' => '1.01', + 'strict' => '1.08', + 'subs' => '1.02', + 'vmsish' => '1.04', + }, + removed => { + } + }, + 5.019003 => { + delta_from => 5.019002, + changed => { + 'B' => '1.45', + 'CPAN::Meta' => '2.132140', + 'CPAN::Meta::Converter' => '2.132140', + 'CPAN::Meta::Feature' => '2.132140', + 'CPAN::Meta::History' => '2.132140', + 'CPAN::Meta::Prereqs' => '2.132140', + 'CPAN::Meta::Spec' => '2.132140', + 'CPAN::Meta::Validator' => '2.132140', + 'Carp' => '1.31', + 'Carp::Heavy' => '1.31', + 'Compress::Raw::Bzip2' => '2.062', + 'Compress::Raw::Zlib' => '2.062', + 'Compress::Zlib' => '2.062', + 'Config' => '5.019003', + 'Config::Perl::V' => '0.19', + 'Cwd' => '3.44', + 'Data::Dumper' => '2.148', + 'Devel::PPPort' => '3.21', + 'Devel::Peek' => '1.13', + 'DynaLoader' => '1.19', + 'Encode' => '2.52', + 'Encode::Alias' => '2.17', + 'Encode::Encoding' => '2.06', + 'Encode::GSM0338' => '2.04', + 'Encode::MIME::Header' => '2.14', + 'Encode::Unicode' => '2.08', + 'English' => '1.08', + 'Exporter' => '5.69', + 'Exporter::Heavy' => '5.69', + 'ExtUtils::Command::MM' => '6.72', + 'ExtUtils::Liblist' => '6.72', + 'ExtUtils::Liblist::Kid'=> '6.72', + 'ExtUtils::MM' => '6.72', + 'ExtUtils::MM_AIX' => '6.72', + 'ExtUtils::MM_Any' => '6.72', + 'ExtUtils::MM_BeOS' => '6.72', + 'ExtUtils::MM_Cygwin' => '6.72', + 'ExtUtils::MM_DOS' => '6.72', + 'ExtUtils::MM_Darwin' => '6.72', + 'ExtUtils::MM_MacOS' => '6.72', + 'ExtUtils::MM_NW5' => '6.72', + 'ExtUtils::MM_OS2' => '6.72', + 'ExtUtils::MM_QNX' => '6.72', + 'ExtUtils::MM_UWIN' => '6.72', + 'ExtUtils::MM_Unix' => '6.72', + 'ExtUtils::MM_VMS' => '6.72', + 'ExtUtils::MM_VOS' => '6.72', + 'ExtUtils::MM_Win32' => '6.72', + 'ExtUtils::MM_Win95' => '6.72', + 'ExtUtils::MY' => '6.72', + 'ExtUtils::MakeMaker' => '6.72', + 'ExtUtils::MakeMaker::Config'=> '6.72', + 'ExtUtils::Mkbootstrap' => '6.72', + 'ExtUtils::Mksymlists' => '6.72', + 'ExtUtils::ParseXS::Eval'=> '3.21', + 'ExtUtils::testlib' => '6.72', + 'File::Spec' => '3.44', + 'File::Spec::Cygwin' => '3.44', + 'File::Spec::Epoc' => '3.44', + 'File::Spec::Functions' => '3.44', + 'File::Spec::Mac' => '3.44', + 'File::Spec::OS2' => '3.44', + 'File::Spec::Unix' => '3.44', + 'File::Spec::VMS' => '3.44', + 'File::Spec::Win32' => '3.44', + 'Getopt::Std' => '1.10', + 'IO::Compress::Adapter::Bzip2'=> '2.062', + 'IO::Compress::Adapter::Deflate'=> '2.062', + 'IO::Compress::Adapter::Identity'=> '2.062', + 'IO::Compress::Base' => '2.062', + 'IO::Compress::Base::Common'=> '2.062', + 'IO::Compress::Bzip2' => '2.062', + 'IO::Compress::Deflate' => '2.062', + 'IO::Compress::Gzip' => '2.062', + 'IO::Compress::Gzip::Constants'=> '2.062', + 'IO::Compress::RawDeflate'=> '2.062', + 'IO::Compress::Zip' => '2.062', + 'IO::Compress::Zip::Constants'=> '2.062', + 'IO::Compress::Zlib::Constants'=> '2.062', + 'IO::Compress::Zlib::Extra'=> '2.062', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.062', + 'IO::Uncompress::Adapter::Identity'=> '2.062', + 'IO::Uncompress::Adapter::Inflate'=> '2.062', + 'IO::Uncompress::AnyInflate'=> '2.062', + 'IO::Uncompress::AnyUncompress'=> '2.062', + 'IO::Uncompress::Base' => '2.062', + 'IO::Uncompress::Bunzip2'=> '2.062', + 'IO::Uncompress::Gunzip'=> '2.062', + 'IO::Uncompress::Inflate'=> '2.062', + 'IO::Uncompress::RawInflate'=> '2.062', + 'IO::Uncompress::Unzip' => '2.062', + 'IPC::Cmd' => '0.84', + 'IPC::Msg' => '2.04', + 'IPC::Open3' => '1.15', + 'IPC::Semaphore' => '2.04', + 'IPC::SharedMem' => '2.04', + 'IPC::SysV' => '2.04', + 'List::Util' => '1.31', + 'List::Util::XS' => '1.31', + 'Math::BigFloat::Trace' => '0.36', + 'Math::BigInt::Trace' => '0.36', + 'Module::Build' => '0.4007', + 'Module::Build::Base' => '0.4007', + 'Module::Build::Compat' => '0.4007', + 'Module::Build::Config' => '0.4007', + 'Module::Build::Cookbook'=> '0.4007', + 'Module::Build::Dumper' => '0.4007', + 'Module::Build::ModuleInfo'=> '0.4007', + 'Module::Build::Notes' => '0.4007', + 'Module::Build::PPMMaker'=> '0.4007', + 'Module::Build::Platform::Default'=> '0.4007', + 'Module::Build::Platform::MacOS'=> '0.4007', + 'Module::Build::Platform::Unix'=> '0.4007', + 'Module::Build::Platform::VMS'=> '0.4007', + 'Module::Build::Platform::VOS'=> '0.4007', + 'Module::Build::Platform::Windows'=> '0.4007', + 'Module::Build::Platform::aix'=> '0.4007', + 'Module::Build::Platform::cygwin'=> '0.4007', + 'Module::Build::Platform::darwin'=> '0.4007', + 'Module::Build::Platform::os2'=> '0.4007', + 'Module::Build::PodParser'=> '0.4007', + 'Module::CoreList' => '2.97', + 'Module::CoreList::TieHashDelta'=> '2.97', + 'Module::CoreList::Utils'=> '2.97', + 'Net::Cmd' => '2.30', + 'Net::Config' => '1.12', + 'Net::Domain' => '2.22', + 'Net::FTP' => '2.78', + 'Net::FTP::dataconn' => '0.12', + 'Net::NNTP' => '2.25', + 'Net::Netrc' => '2.14', + 'Net::POP3' => '2.30', + 'Net::SMTP' => '2.32', + 'PerlIO' => '1.08', + 'Pod::Functions' => '1.08', + 'Scalar::Util' => '1.31', + 'Socket' => '2.011', + 'Storable' => '2.46', + 'Time::HiRes' => '1.9726', + 'Time::Piece' => '1.22', + 'Time::Seconds' => '1.22', + 'XS::APItest' => '0.55', + 'bigint' => '0.36', + 'bignum' => '0.36', + 'bigrat' => '0.36', + 'constant' => '1.28', + 'diagnostics' => '1.32', + 'inc::latest' => '0.4007', + 'mro' => '1.13', + 'parent' => '0.226', + 'utf8' => '1.13', + 'version' => '0.9903', + }, + removed => { + 'Module::Build::Platform::Amiga'=> 1, + 'Module::Build::Platform::EBCDIC'=> 1, + 'Module::Build::Platform::MPEiX'=> 1, + 'Module::Build::Platform::RiscOS'=> 1, + } + }, + 5.019004 => { + delta_from => 5.019003, + changed => { + 'B' => '1.46', + 'B::Concise' => '0.99', + 'B::Deparse' => '1.23', + 'CPAN' => '2.03', + 'CPAN::Meta' => '2.132620', + 'CPAN::Meta::Converter' => '2.132620', + 'CPAN::Meta::Feature' => '2.132620', + 'CPAN::Meta::History' => '2.132620', + 'CPAN::Meta::Prereqs' => '2.132620', + 'CPAN::Meta::Requirements'=> '2.123', + 'CPAN::Meta::Spec' => '2.132620', + 'CPAN::Meta::Validator' => '2.132620', + 'Carp' => '1.32', + 'Carp::Heavy' => '1.32', + 'Config' => '5.019004', + 'Data::Dumper' => '2.149', + 'Devel::Peek' => '1.14', + 'DynaLoader' => '1.20', + 'Encode' => '2.55', + 'Encode::Alias' => '2.18', + 'Encode::CN::HZ' => '2.07', + 'Encode::Encoder' => '2.03', + 'Encode::Encoding' => '2.07', + 'Encode::GSM0338' => '2.05', + 'Encode::Guess' => '2.06', + 'Encode::JP::JIS7' => '2.05', + 'Encode::KR::2022_KR' => '2.03', + 'Encode::MIME::Header' => '2.15', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.04', + 'Encode::Unicode' => '2.09', + 'Encode::Unicode::UTF7' => '2.08', + 'Errno' => '1.20', + 'Exporter' => '5.70', + 'Exporter::Heavy' => '5.70', + 'ExtUtils::CBuilder' => '0.280212', + 'ExtUtils::CBuilder::Base'=> '0.280212', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280212', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280212', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280212', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280212', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280212', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280212', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280212', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280212', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280212', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280212', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280212', + 'ExtUtils::Command' => '1.18', + 'ExtUtils::Command::MM' => '6.76', + 'ExtUtils::Liblist' => '6.76', + 'ExtUtils::Liblist::Kid'=> '6.76', + 'ExtUtils::MM' => '6.76', + 'ExtUtils::MM_AIX' => '6.76', + 'ExtUtils::MM_Any' => '6.76', + 'ExtUtils::MM_BeOS' => '6.76', + 'ExtUtils::MM_Cygwin' => '6.76', + 'ExtUtils::MM_DOS' => '6.76', + 'ExtUtils::MM_Darwin' => '6.76', + 'ExtUtils::MM_MacOS' => '6.76', + 'ExtUtils::MM_NW5' => '6.76', + 'ExtUtils::MM_OS2' => '6.76', + 'ExtUtils::MM_QNX' => '6.76', + 'ExtUtils::MM_UWIN' => '6.76', + 'ExtUtils::MM_Unix' => '6.76', + 'ExtUtils::MM_VMS' => '6.76', + 'ExtUtils::MM_VOS' => '6.76', + 'ExtUtils::MM_Win32' => '6.76', + 'ExtUtils::MM_Win95' => '6.76', + 'ExtUtils::MY' => '6.76', + 'ExtUtils::MakeMaker' => '6.76', + 'ExtUtils::MakeMaker::Config'=> '6.76', + 'ExtUtils::Mkbootstrap' => '6.76', + 'ExtUtils::Mksymlists' => '6.76', + 'ExtUtils::ParseXS' => '3.23', + 'ExtUtils::ParseXS::Constants'=> '3.23', + 'ExtUtils::ParseXS::CountLines'=> '3.23', + 'ExtUtils::ParseXS::Eval'=> '3.23', + 'ExtUtils::ParseXS::Utilities'=> '3.23', + 'ExtUtils::Typemaps' => '3.23', + 'ExtUtils::Typemaps::Cmd'=> '3.23', + 'ExtUtils::Typemaps::InputMap'=> '3.23', + 'ExtUtils::Typemaps::OutputMap'=> '3.23', + 'ExtUtils::Typemaps::Type'=> '3.23', + 'ExtUtils::testlib' => '6.76', + 'Fatal' => '2.21', + 'File::Copy' => '2.28', + 'File::Find' => '1.25', + 'File::Glob' => '1.21', + 'FileCache' => '1.09', + 'HTTP::Tiny' => '0.035', + 'Hash::Util::FieldHash' => '1.13', + 'I18N::LangTags' => '0.40', + 'IO' => '1.29', + 'IO::Socket' => '1.37', + 'IPC::Open3' => '1.16', + 'JSON::PP' => '2.27202_01', + 'List::Util' => '1.32', + 'List::Util::XS' => '1.32', + 'Locale::Codes' => '3.27', + 'Locale::Codes::Constants'=> '3.27', + 'Locale::Codes::Country'=> '3.27', + 'Locale::Codes::Country_Codes'=> '3.27', + 'Locale::Codes::Country_Retired'=> '3.27', + 'Locale::Codes::Currency'=> '3.27', + 'Locale::Codes::Currency_Codes'=> '3.27', + 'Locale::Codes::Currency_Retired'=> '3.27', + 'Locale::Codes::LangExt'=> '3.27', + 'Locale::Codes::LangExt_Codes'=> '3.27', + 'Locale::Codes::LangExt_Retired'=> '3.27', + 'Locale::Codes::LangFam'=> '3.27', + 'Locale::Codes::LangFam_Codes'=> '3.27', + 'Locale::Codes::LangFam_Retired'=> '3.27', + 'Locale::Codes::LangVar'=> '3.27', + 'Locale::Codes::LangVar_Codes'=> '3.27', + 'Locale::Codes::LangVar_Retired'=> '3.27', + 'Locale::Codes::Language'=> '3.27', + 'Locale::Codes::Language_Codes'=> '3.27', + 'Locale::Codes::Language_Retired'=> '3.27', + 'Locale::Codes::Script' => '3.27', + 'Locale::Codes::Script_Codes'=> '3.27', + 'Locale::Codes::Script_Retired'=> '3.27', + 'Locale::Country' => '3.27', + 'Locale::Currency' => '3.27', + 'Locale::Language' => '3.27', + 'Locale::Script' => '3.27', + 'Math::BigFloat' => '1.9991', + 'Math::BigInt' => '1.9993', + 'Math::BigInt::FastCalc'=> '0.31', + 'Module::CoreList' => '2.99', + 'Module::CoreList::TieHashDelta'=> '2.99', + 'Module::CoreList::Utils'=> '2.99', + 'Module::Load::Conditional'=> '0.58', + 'Module::Metadata' => '1.000018', + 'Opcode' => '1.26', + 'POSIX' => '1.35', + 'Parse::CPAN::Meta' => '1.4407', + 'Perl::OSType' => '1.005', + 'Pod::Html' => '1.21', + 'Scalar::Util' => '1.32', + 'Socket' => '2.012', + 'Storable' => '2.47', + 'Term::ReadLine' => '1.14', + 'Test::Builder' => '0.98_06', + 'Test::Builder::Module' => '0.98_06', + 'Test::More' => '0.98_06', + 'Test::Simple' => '0.98_06', + 'Time::Piece' => '1.23', + 'Time::Seconds' => '1.23', + 'Unicode::Collate' => '0.99', + 'Unicode::UCD' => '0.54', + 'XS::APItest' => '0.56', + 'XS::Typemap' => '0.11', + '_charnames' => '1.39', + 'autodie' => '2.21', + 'autodie::exception' => '2.21', + 'autodie::exception::system'=> '2.21', + 'autodie::hints' => '2.21', + 'autodie::skip' => '2.21', + 'charnames' => '1.39', + 'diagnostics' => '1.33', + 'mro' => '1.14', + 'parent' => '0.228', + 'perlfaq' => '5.0150044', + 're' => '0.26', + 'version' => '0.9904', + 'warnings' => '1.19', + }, + removed => { + } + }, + 5.019005 => { + delta_from => 5.019004, + changed => { + 'App::Prove' => '3.29', + 'App::Prove::State' => '3.29', + 'App::Prove::State::Result'=> '3.29', + 'App::Prove::State::Result::Test'=> '3.29', + 'CPAN::Meta' => '2.132830', + 'CPAN::Meta::Converter' => '2.132830', + 'CPAN::Meta::Feature' => '2.132830', + 'CPAN::Meta::History' => '2.132830', + 'CPAN::Meta::Prereqs' => '2.132830', + 'CPAN::Meta::Requirements'=> '2.125', + 'CPAN::Meta::Spec' => '2.132830', + 'CPAN::Meta::Validator' => '2.132830', + 'CPAN::Meta::YAML' => '0.010', + 'Config' => '5.019005', + 'Cwd' => '3.45', + 'ExtUtils::Command::MM' => '6.80', + 'ExtUtils::Install' => '1.61', + 'ExtUtils::Liblist' => '6.80', + 'ExtUtils::Liblist::Kid'=> '6.80', + 'ExtUtils::MM' => '6.80', + 'ExtUtils::MM_AIX' => '6.80', + 'ExtUtils::MM_Any' => '6.80', + 'ExtUtils::MM_BeOS' => '6.80', + 'ExtUtils::MM_Cygwin' => '6.80', + 'ExtUtils::MM_DOS' => '6.80', + 'ExtUtils::MM_Darwin' => '6.80', + 'ExtUtils::MM_MacOS' => '6.80', + 'ExtUtils::MM_NW5' => '6.80', + 'ExtUtils::MM_OS2' => '6.80', + 'ExtUtils::MM_QNX' => '6.80', + 'ExtUtils::MM_UWIN' => '6.80', + 'ExtUtils::MM_Unix' => '6.80', + 'ExtUtils::MM_VMS' => '6.80', + 'ExtUtils::MM_VOS' => '6.80', + 'ExtUtils::MM_Win32' => '6.80', + 'ExtUtils::MM_Win95' => '6.80', + 'ExtUtils::MY' => '6.80', + 'ExtUtils::MakeMaker' => '6.80', + 'ExtUtils::MakeMaker::Config'=> '6.80', + 'ExtUtils::Mkbootstrap' => '6.80', + 'ExtUtils::Mksymlists' => '6.80', + 'ExtUtils::testlib' => '6.80', + 'Fatal' => '2.22', + 'File::Fetch' => '0.44', + 'File::Glob' => '1.22', + 'File::Spec' => '3.45', + 'File::Spec::Cygwin' => '3.45', + 'File::Spec::Epoc' => '3.45', + 'File::Spec::Functions' => '3.45', + 'File::Spec::Mac' => '3.45', + 'File::Spec::OS2' => '3.45', + 'File::Spec::Unix' => '3.45', + 'File::Spec::VMS' => '3.45', + 'File::Spec::Win32' => '3.45', + 'File::Temp' => '0.2304', + 'Getopt::Long' => '2.42', + 'HTTP::Tiny' => '0.036', + 'IPC::Cmd' => '0.84_01', + 'JSON::PP' => '2.27203', + 'List::Util' => '1.35', + 'List::Util::XS' => '1.35', + 'Module::CoreList' => '3.00', + 'Module::CoreList::TieHashDelta'=> '3.00', + 'Module::CoreList::Utils'=> '3.00', + 'Module::Metadata' => '1.000019', + 'Parse::CPAN::Meta' => '1.4409', + 'Perl::OSType' => '1.006', + 'PerlIO::scalar' => '0.17', + 'Pod::Man' => '2.28', + 'Pod::Text' => '3.18', + 'Pod::Text::Termcap' => '2.08', + 'Scalar::Util' => '1.35', + 'TAP::Base' => '3.29', + 'TAP::Formatter::Base' => '3.29', + 'TAP::Formatter::Color' => '3.29', + 'TAP::Formatter::Console'=> '3.29', + 'TAP::Formatter::Console::ParallelSession'=> '3.29', + 'TAP::Formatter::Console::Session'=> '3.29', + 'TAP::Formatter::File' => '3.29', + 'TAP::Formatter::File::Session'=> '3.29', + 'TAP::Formatter::Session'=> '3.29', + 'TAP::Harness' => '3.29', + 'TAP::Harness::Env' => '3.29', + 'TAP::Object' => '3.29', + 'TAP::Parser' => '3.29', + 'TAP::Parser::Aggregator'=> '3.29', + 'TAP::Parser::Grammar' => '3.29', + 'TAP::Parser::Iterator' => '3.29', + 'TAP::Parser::Iterator::Array'=> '3.29', + 'TAP::Parser::Iterator::Process'=> '3.29', + 'TAP::Parser::Iterator::Stream'=> '3.29', + 'TAP::Parser::IteratorFactory'=> '3.29', + 'TAP::Parser::Multiplexer'=> '3.29', + 'TAP::Parser::Result' => '3.29', + 'TAP::Parser::Result::Bailout'=> '3.29', + 'TAP::Parser::Result::Comment'=> '3.29', + 'TAP::Parser::Result::Plan'=> '3.29', + 'TAP::Parser::Result::Pragma'=> '3.29', + 'TAP::Parser::Result::Test'=> '3.29', + 'TAP::Parser::Result::Unknown'=> '3.29', + 'TAP::Parser::Result::Version'=> '3.29', + 'TAP::Parser::Result::YAML'=> '3.29', + 'TAP::Parser::ResultFactory'=> '3.29', + 'TAP::Parser::Scheduler'=> '3.29', + 'TAP::Parser::Scheduler::Job'=> '3.29', + 'TAP::Parser::Scheduler::Spinner'=> '3.29', + 'TAP::Parser::Source' => '3.29', + 'TAP::Parser::SourceHandler'=> '3.29', + 'TAP::Parser::SourceHandler::Executable'=> '3.29', + 'TAP::Parser::SourceHandler::File'=> '3.29', + 'TAP::Parser::SourceHandler::Handle'=> '3.29', + 'TAP::Parser::SourceHandler::Perl'=> '3.29', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.29', + 'TAP::Parser::YAMLish::Reader'=> '3.29', + 'TAP::Parser::YAMLish::Writer'=> '3.29', + 'Test::Builder' => '0.99', + 'Test::Builder::Module' => '0.99', + 'Test::Builder::Tester' => '1.23_002', + 'Test::Builder::Tester::Color'=> '1.23_002', + 'Test::Harness' => '3.29', + 'Test::More' => '0.99', + 'Test::Simple' => '0.99', + 'Unicode' => '6.3.0', + 'Unicode::Normalize' => '1.17', + 'Unicode::UCD' => '0.55', + 'attributes' => '0.22', + 'autodie' => '2.22', + 'autodie::exception' => '2.22', + 'autodie::exception::system'=> '2.22', + 'autodie::hints' => '2.22', + 'autodie::skip' => '2.22', + 'feature' => '1.34', + 'threads' => '1.89', + 'warnings' => '1.20', + }, + removed => { + 'TAP::Parser::Utils' => 1, + } + }, + 5.019006 => { + delta_from => 5.019005, + changed => { + 'App::Prove' => '3.30', + 'App::Prove::State' => '3.30', + 'App::Prove::State::Result'=> '3.30', + 'App::Prove::State::Result::Test'=> '3.30', + 'Archive::Tar' => '1.96', + 'Archive::Tar::Constant'=> '1.96', + 'Archive::Tar::File' => '1.96', + 'AutoLoader' => '5.74', + 'B' => '1.47', + 'B::Concise' => '0.991', + 'B::Debug' => '1.19', + 'B::Deparse' => '1.24', + 'Benchmark' => '1.18', + 'Compress::Raw::Bzip2' => '2.063', + 'Compress::Raw::Zlib' => '2.063', + 'Compress::Zlib' => '2.063', + 'Config' => '5.019006', + 'DB_File' => '1.831', + 'Devel::Peek' => '1.15', + 'DynaLoader' => '1.21', + 'Errno' => '1.20_01', + 'ExtUtils::Command::MM' => '6.82', + 'ExtUtils::Liblist' => '6.82', + 'ExtUtils::Liblist::Kid'=> '6.82', + 'ExtUtils::MM' => '6.82', + 'ExtUtils::MM_AIX' => '6.82', + 'ExtUtils::MM_Any' => '6.82', + 'ExtUtils::MM_BeOS' => '6.82', + 'ExtUtils::MM_Cygwin' => '6.82', + 'ExtUtils::MM_DOS' => '6.82', + 'ExtUtils::MM_Darwin' => '6.82', + 'ExtUtils::MM_MacOS' => '6.82', + 'ExtUtils::MM_NW5' => '6.82', + 'ExtUtils::MM_OS2' => '6.82', + 'ExtUtils::MM_QNX' => '6.82', + 'ExtUtils::MM_UWIN' => '6.82', + 'ExtUtils::MM_Unix' => '6.82', + 'ExtUtils::MM_VMS' => '6.82', + 'ExtUtils::MM_VOS' => '6.82', + 'ExtUtils::MM_Win32' => '6.82', + 'ExtUtils::MM_Win95' => '6.82', + 'ExtUtils::MY' => '6.82', + 'ExtUtils::MakeMaker' => '6.82', + 'ExtUtils::MakeMaker::Config'=> '6.82', + 'ExtUtils::Mkbootstrap' => '6.82', + 'ExtUtils::Mksymlists' => '6.82', + 'ExtUtils::testlib' => '6.82', + 'File::DosGlob' => '1.12', + 'File::Find' => '1.26', + 'File::Glob' => '1.23', + 'HTTP::Tiny' => '0.038', + 'IO' => '1.30', + 'IO::Compress::Adapter::Bzip2'=> '2.063', + 'IO::Compress::Adapter::Deflate'=> '2.063', + 'IO::Compress::Adapter::Identity'=> '2.063', + 'IO::Compress::Base' => '2.063', + 'IO::Compress::Base::Common'=> '2.063', + 'IO::Compress::Bzip2' => '2.063', + 'IO::Compress::Deflate' => '2.063', + 'IO::Compress::Gzip' => '2.063', + 'IO::Compress::Gzip::Constants'=> '2.063', + 'IO::Compress::RawDeflate'=> '2.063', + 'IO::Compress::Zip' => '2.063', + 'IO::Compress::Zip::Constants'=> '2.063', + 'IO::Compress::Zlib::Constants'=> '2.063', + 'IO::Compress::Zlib::Extra'=> '2.063', + 'IO::Select' => '1.22', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.063', + 'IO::Uncompress::Adapter::Identity'=> '2.063', + 'IO::Uncompress::Adapter::Inflate'=> '2.063', + 'IO::Uncompress::AnyInflate'=> '2.063', + 'IO::Uncompress::AnyUncompress'=> '2.063', + 'IO::Uncompress::Base' => '2.063', + 'IO::Uncompress::Bunzip2'=> '2.063', + 'IO::Uncompress::Gunzip'=> '2.063', + 'IO::Uncompress::Inflate'=> '2.063', + 'IO::Uncompress::RawInflate'=> '2.063', + 'IO::Uncompress::Unzip' => '2.063', + 'IPC::Cmd' => '0.90', + 'Locale::Maketext' => '1.25', + 'Module::Build' => '0.4202', + 'Module::Build::Base' => '0.4202', + 'Module::Build::Compat' => '0.4202', + 'Module::Build::Config' => '0.4202', + 'Module::Build::Cookbook'=> '0.4202', + 'Module::Build::Dumper' => '0.4202', + 'Module::Build::ModuleInfo'=> '0.4202', + 'Module::Build::Notes' => '0.4202', + 'Module::Build::PPMMaker'=> '0.4202', + 'Module::Build::Platform::Default'=> '0.4202', + 'Module::Build::Platform::MacOS'=> '0.4202', + 'Module::Build::Platform::Unix'=> '0.4202', + 'Module::Build::Platform::VMS'=> '0.4202', + 'Module::Build::Platform::VOS'=> '0.4202', + 'Module::Build::Platform::Windows'=> '0.4202', + 'Module::Build::Platform::aix'=> '0.4202', + 'Module::Build::Platform::cygwin'=> '0.4202', + 'Module::Build::Platform::darwin'=> '0.4202', + 'Module::Build::Platform::os2'=> '0.4202', + 'Module::Build::PodParser'=> '0.4202', + 'Module::CoreList' => '3.01', + 'Module::CoreList::TieHashDelta'=> '3.01', + 'Module::CoreList::Utils'=> '3.01', + 'Opcode' => '1.27', + 'POSIX' => '1.36', + 'Package::Constants' => '0.04', + 'PerlIO::scalar' => '0.18', + 'PerlIO::via' => '0.13', + 'SDBM_File' => '1.10', + 'Socket' => '2.013', + 'TAP::Base' => '3.30', + 'TAP::Formatter::Base' => '3.30', + 'TAP::Formatter::Color' => '3.30', + 'TAP::Formatter::Console'=> '3.30', + 'TAP::Formatter::Console::ParallelSession'=> '3.30', + 'TAP::Formatter::Console::Session'=> '3.30', + 'TAP::Formatter::File' => '3.30', + 'TAP::Formatter::File::Session'=> '3.30', + 'TAP::Formatter::Session'=> '3.30', + 'TAP::Harness' => '3.30', + 'TAP::Harness::Env' => '3.30', + 'TAP::Object' => '3.30', + 'TAP::Parser' => '3.30', + 'TAP::Parser::Aggregator'=> '3.30', + 'TAP::Parser::Grammar' => '3.30', + 'TAP::Parser::Iterator' => '3.30', + 'TAP::Parser::Iterator::Array'=> '3.30', + 'TAP::Parser::Iterator::Process'=> '3.30', + 'TAP::Parser::Iterator::Stream'=> '3.30', + 'TAP::Parser::IteratorFactory'=> '3.30', + 'TAP::Parser::Multiplexer'=> '3.30', + 'TAP::Parser::Result' => '3.30', + 'TAP::Parser::Result::Bailout'=> '3.30', + 'TAP::Parser::Result::Comment'=> '3.30', + 'TAP::Parser::Result::Plan'=> '3.30', + 'TAP::Parser::Result::Pragma'=> '3.30', + 'TAP::Parser::Result::Test'=> '3.30', + 'TAP::Parser::Result::Unknown'=> '3.30', + 'TAP::Parser::Result::Version'=> '3.30', + 'TAP::Parser::Result::YAML'=> '3.30', + 'TAP::Parser::ResultFactory'=> '3.30', + 'TAP::Parser::Scheduler'=> '3.30', + 'TAP::Parser::Scheduler::Job'=> '3.30', + 'TAP::Parser::Scheduler::Spinner'=> '3.30', + 'TAP::Parser::Source' => '3.30', + 'TAP::Parser::SourceHandler'=> '3.30', + 'TAP::Parser::SourceHandler::Executable'=> '3.30', + 'TAP::Parser::SourceHandler::File'=> '3.30', + 'TAP::Parser::SourceHandler::Handle'=> '3.30', + 'TAP::Parser::SourceHandler::Perl'=> '3.30', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.30', + 'TAP::Parser::YAMLish::Reader'=> '3.30', + 'TAP::Parser::YAMLish::Writer'=> '3.30', + 'Term::Cap' => '1.15', + 'Test::Builder' => '1.001002', + 'Test::Builder::Module' => '1.001002', + 'Test::Harness' => '3.30', + 'Test::More' => '1.001002', + 'Test::Simple' => '1.001002', + 'Tie::StdHandle' => '4.4', + 'Unicode::Collate' => '1.02', + 'Unicode::Collate::CJK::Korean'=> '1.02', + 'Unicode::Collate::Locale'=> '1.02', + 'XS::APItest' => '0.57', + 'XS::Typemap' => '0.12', + 'arybase' => '0.07', + 'bignum' => '0.37', + 'constant' => '1.29', + 'fields' => '2.17', + 'inc::latest' => '0.4202', + 'threads' => '1.90', + 'threads::shared' => '1.45', + }, + removed => { + } + }, + 5.019007 => { + delta_from => 5.019006, + changed => { + 'CGI' => '3.64', + 'CGI::Apache' => '1.02', + 'CGI::Carp' => '3.64', + 'CGI::Cookie' => '1.31', + 'CGI::Fast' => '1.10', + 'CGI::Pretty' => '3.64', + 'CGI::Push' => '1.06', + 'CGI::Switch' => '1.02', + 'CGI::Util' => '3.64', + 'CPAN::Meta' => '2.133380', + 'CPAN::Meta::Converter' => '2.133380', + 'CPAN::Meta::Feature' => '2.133380', + 'CPAN::Meta::History' => '2.133380', + 'CPAN::Meta::Prereqs' => '2.133380', + 'CPAN::Meta::Spec' => '2.133380', + 'CPAN::Meta::Validator' => '2.133380', + 'Config' => '5.019007', + 'Data::Dumper' => '2.150', + 'DynaLoader' => '1.22', + 'ExtUtils::Command::MM' => '6.84', + 'ExtUtils::Liblist' => '6.84', + 'ExtUtils::Liblist::Kid'=> '6.84', + 'ExtUtils::MM' => '6.84', + 'ExtUtils::MM_AIX' => '6.84', + 'ExtUtils::MM_Any' => '6.84', + 'ExtUtils::MM_BeOS' => '6.84', + 'ExtUtils::MM_Cygwin' => '6.84', + 'ExtUtils::MM_DOS' => '6.84', + 'ExtUtils::MM_Darwin' => '6.84', + 'ExtUtils::MM_MacOS' => '6.84', + 'ExtUtils::MM_NW5' => '6.84', + 'ExtUtils::MM_OS2' => '6.84', + 'ExtUtils::MM_QNX' => '6.84', + 'ExtUtils::MM_UWIN' => '6.84', + 'ExtUtils::MM_Unix' => '6.84', + 'ExtUtils::MM_VMS' => '6.84', + 'ExtUtils::MM_VOS' => '6.84', + 'ExtUtils::MM_Win32' => '6.84', + 'ExtUtils::MM_Win95' => '6.84', + 'ExtUtils::MY' => '6.84', + 'ExtUtils::MakeMaker' => '6.84', + 'ExtUtils::MakeMaker::Config'=> '6.84', + 'ExtUtils::Mkbootstrap' => '6.84', + 'ExtUtils::Mksymlists' => '6.84', + 'ExtUtils::testlib' => '6.84', + 'File::Fetch' => '0.46', + 'HTTP::Tiny' => '0.039', + 'Locale::Codes' => '3.28', + 'Locale::Codes::Constants'=> '3.28', + 'Locale::Codes::Country'=> '3.28', + 'Locale::Codes::Country_Codes'=> '3.28', + 'Locale::Codes::Country_Retired'=> '3.28', + 'Locale::Codes::Currency'=> '3.28', + 'Locale::Codes::Currency_Codes'=> '3.28', + 'Locale::Codes::Currency_Retired'=> '3.28', + 'Locale::Codes::LangExt'=> '3.28', + 'Locale::Codes::LangExt_Codes'=> '3.28', + 'Locale::Codes::LangExt_Retired'=> '3.28', + 'Locale::Codes::LangFam'=> '3.28', + 'Locale::Codes::LangFam_Codes'=> '3.28', + 'Locale::Codes::LangFam_Retired'=> '3.28', + 'Locale::Codes::LangVar'=> '3.28', + 'Locale::Codes::LangVar_Codes'=> '3.28', + 'Locale::Codes::LangVar_Retired'=> '3.28', + 'Locale::Codes::Language'=> '3.28', + 'Locale::Codes::Language_Codes'=> '3.28', + 'Locale::Codes::Language_Retired'=> '3.28', + 'Locale::Codes::Script' => '3.28', + 'Locale::Codes::Script_Codes'=> '3.28', + 'Locale::Codes::Script_Retired'=> '3.28', + 'Locale::Country' => '3.28', + 'Locale::Currency' => '3.28', + 'Locale::Language' => '3.28', + 'Locale::Script' => '3.28', + 'Module::Build' => '0.4203', + 'Module::Build::Base' => '0.4203', + 'Module::Build::Compat' => '0.4203', + 'Module::Build::Config' => '0.4203', + 'Module::Build::Cookbook'=> '0.4203', + 'Module::Build::Dumper' => '0.4203', + 'Module::Build::ModuleInfo'=> '0.4203', + 'Module::Build::Notes' => '0.4203', + 'Module::Build::PPMMaker'=> '0.4203', + 'Module::Build::Platform::Default'=> '0.4203', + 'Module::Build::Platform::MacOS'=> '0.4203', + 'Module::Build::Platform::Unix'=> '0.4203', + 'Module::Build::Platform::VMS'=> '0.4203', + 'Module::Build::Platform::VOS'=> '0.4203', + 'Module::Build::Platform::Windows'=> '0.4203', + 'Module::Build::Platform::aix'=> '0.4203', + 'Module::Build::Platform::cygwin'=> '0.4203', + 'Module::Build::Platform::darwin'=> '0.4203', + 'Module::Build::Platform::os2'=> '0.4203', + 'Module::Build::PodParser'=> '0.4203', + 'Module::CoreList' => '3.02', + 'Module::CoreList::TieHashDelta'=> '3.02', + 'Module::CoreList::Utils'=> '3.02', + 'POSIX' => '1.37', + 'PerlIO::encoding' => '0.17', + 'PerlIO::via' => '0.14', + 'SDBM_File' => '1.11', + 'Storable' => '2.48', + 'Time::Piece' => '1.24', + 'Time::Seconds' => '1.24', + 'Unicode::Collate' => '1.04', + 'Win32' => '0.48', + 'XS::APItest' => '0.58', + 'base' => '2.20', + 'constant' => '1.30', + 'inc::latest' => '0.4203', + 'threads' => '1.91', + }, + removed => { + } + }, + 5.019008 => { + delta_from => 5.019007, + changed => { + 'Config' => '5.019008', + 'DynaLoader' => '1.24', + 'Encode' => '2.57', + 'Errno' => '1.20_02', + 'ExtUtils::CBuilder' => '0.280213', + 'ExtUtils::CBuilder::Base'=> '0.280213', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280213', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280213', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280213', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280213', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280213', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280213', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280213', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280213', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280213', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280213', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280213', + 'ExtUtils::Command::MM' => '6.86', + 'ExtUtils::Liblist' => '6.86', + 'ExtUtils::Liblist::Kid'=> '6.86', + 'ExtUtils::MM' => '6.86', + 'ExtUtils::MM_AIX' => '6.86', + 'ExtUtils::MM_Any' => '6.86', + 'ExtUtils::MM_BeOS' => '6.86', + 'ExtUtils::MM_Cygwin' => '6.86', + 'ExtUtils::MM_DOS' => '6.86', + 'ExtUtils::MM_Darwin' => '6.86', + 'ExtUtils::MM_MacOS' => '6.86', + 'ExtUtils::MM_NW5' => '6.86', + 'ExtUtils::MM_OS2' => '6.86', + 'ExtUtils::MM_QNX' => '6.86', + 'ExtUtils::MM_UWIN' => '6.86', + 'ExtUtils::MM_Unix' => '6.86', + 'ExtUtils::MM_VMS' => '6.86', + 'ExtUtils::MM_VOS' => '6.86', + 'ExtUtils::MM_Win32' => '6.86', + 'ExtUtils::MM_Win95' => '6.86', + 'ExtUtils::MY' => '6.86', + 'ExtUtils::MakeMaker' => '6.86', + 'ExtUtils::MakeMaker::Config'=> '6.86', + 'ExtUtils::Mkbootstrap' => '6.86', + 'ExtUtils::Mksymlists' => '6.86', + 'ExtUtils::testlib' => '6.86', + 'File::Copy' => '2.29', + 'Hash::Util::FieldHash' => '1.14', + 'IO::Socket::IP' => '0.26', + 'IO::Socket::UNIX' => '1.26', + 'List::Util' => '1.36', + 'List::Util::XS' => '1.36', + 'Module::Build' => '0.4204', + 'Module::Build::Base' => '0.4204', + 'Module::Build::Compat' => '0.4204', + 'Module::Build::Config' => '0.4204', + 'Module::Build::Cookbook'=> '0.4204', + 'Module::Build::Dumper' => '0.4204', + 'Module::Build::ModuleInfo'=> '0.4204', + 'Module::Build::Notes' => '0.4204', + 'Module::Build::PPMMaker'=> '0.4204', + 'Module::Build::Platform::Default'=> '0.4204', + 'Module::Build::Platform::MacOS'=> '0.4204', + 'Module::Build::Platform::Unix'=> '0.4204', + 'Module::Build::Platform::VMS'=> '0.4204', + 'Module::Build::Platform::VOS'=> '0.4204', + 'Module::Build::Platform::Windows'=> '0.4204', + 'Module::Build::Platform::aix'=> '0.4204', + 'Module::Build::Platform::cygwin'=> '0.4204', + 'Module::Build::Platform::darwin'=> '0.4204', + 'Module::Build::Platform::os2'=> '0.4204', + 'Module::Build::PodParser'=> '0.4204', + 'Module::CoreList' => '3.04', + 'Module::CoreList::TieHashDelta'=> '3.04', + 'Module::CoreList::Utils'=> '3.04', + 'Module::Load' => '0.28', + 'Module::Load::Conditional'=> '0.60', + 'Net::Config' => '1.13', + 'Net::FTP::A' => '1.19', + 'POSIX' => '1.38_01', + 'Perl::OSType' => '1.007', + 'PerlIO::encoding' => '0.18', + 'Pod::Perldoc' => '3.21', + 'Pod::Perldoc::BaseTo' => '3.21', + 'Pod::Perldoc::GetOptsOO'=> '3.21', + 'Pod::Perldoc::ToANSI' => '3.21', + 'Pod::Perldoc::ToChecker'=> '3.21', + 'Pod::Perldoc::ToMan' => '3.21', + 'Pod::Perldoc::ToNroff' => '3.21', + 'Pod::Perldoc::ToPod' => '3.21', + 'Pod::Perldoc::ToRtf' => '3.21', + 'Pod::Perldoc::ToTerm' => '3.21', + 'Pod::Perldoc::ToText' => '3.21', + 'Pod::Perldoc::ToTk' => '3.21', + 'Pod::Perldoc::ToXml' => '3.21', + 'Scalar::Util' => '1.36', + 'Time::Piece' => '1.27', + 'Time::Seconds' => '1.27', + 'Unicode::UCD' => '0.57', + 'XS::APItest' => '0.59', + 'XSLoader' => '0.17', + 'base' => '2.21', + 'constant' => '1.31', + 'inc::latest' => '0.4204', + 'threads::shared' => '1.46', + 'version' => '0.9907', + 'version::regex' => '0.9907', + 'version::vpp' => '0.9907', + 'warnings' => '1.21', + }, + removed => { + } + }, + 5.019009 => { + delta_from => 5.019008, + changed => { + 'B' => '1.48', + 'B::Concise' => '0.992', + 'B::Deparse' => '1.25', + 'CGI' => '3.65', + 'CPAN::Meta::YAML' => '0.011', + 'Compress::Raw::Bzip2' => '2.064', + 'Compress::Raw::Zlib' => '2.065', + 'Compress::Zlib' => '2.064', + 'Config' => '5.019009', + 'Config::Perl::V' => '0.20', + 'Cwd' => '3.47', + 'Devel::Peek' => '1.16', + 'Digest::SHA' => '5.87', + 'DynaLoader' => '1.25', + 'English' => '1.09', + 'ExtUtils::CBuilder' => '0.280216', + 'ExtUtils::CBuilder::Base'=> '0.280216', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280216', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280216', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280216', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280216', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280216', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280216', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280216', + 'ExtUtils::CBuilder::Platform::android'=> '0.280216', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280216', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280216', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280216', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280216', + 'ExtUtils::Command::MM' => '6.88', + 'ExtUtils::Embed' => '1.32', + 'ExtUtils::Install' => '1.62', + 'ExtUtils::Installed' => '1.999004', + 'ExtUtils::Liblist' => '6.88', + 'ExtUtils::Liblist::Kid'=> '6.88', + 'ExtUtils::MM' => '6.88', + 'ExtUtils::MM_AIX' => '6.88', + 'ExtUtils::MM_Any' => '6.88', + 'ExtUtils::MM_BeOS' => '6.88', + 'ExtUtils::MM_Cygwin' => '6.88', + 'ExtUtils::MM_DOS' => '6.88', + 'ExtUtils::MM_Darwin' => '6.88', + 'ExtUtils::MM_MacOS' => '6.88', + 'ExtUtils::MM_NW5' => '6.88', + 'ExtUtils::MM_OS2' => '6.88', + 'ExtUtils::MM_QNX' => '6.88', + 'ExtUtils::MM_UWIN' => '6.88', + 'ExtUtils::MM_Unix' => '6.88', + 'ExtUtils::MM_VMS' => '6.88', + 'ExtUtils::MM_VOS' => '6.88', + 'ExtUtils::MM_Win32' => '6.88', + 'ExtUtils::MM_Win95' => '6.88', + 'ExtUtils::MY' => '6.88', + 'ExtUtils::MakeMaker' => '6.88', + 'ExtUtils::MakeMaker::Config'=> '6.88', + 'ExtUtils::Mkbootstrap' => '6.88', + 'ExtUtils::Mksymlists' => '6.88', + 'ExtUtils::Packlist' => '1.47', + 'ExtUtils::testlib' => '6.88', + 'Fatal' => '2.23', + 'File::Fetch' => '0.48', + 'File::Spec' => '3.47', + 'File::Spec::Cygwin' => '3.47', + 'File::Spec::Epoc' => '3.47', + 'File::Spec::Functions' => '3.47', + 'File::Spec::Mac' => '3.47', + 'File::Spec::OS2' => '3.47', + 'File::Spec::Unix' => '3.47', + 'File::Spec::VMS' => '3.47', + 'File::Spec::Win32' => '3.47', + 'HTTP::Tiny' => '0.042', + 'IO::Compress::Adapter::Bzip2'=> '2.064', + 'IO::Compress::Adapter::Deflate'=> '2.064', + 'IO::Compress::Adapter::Identity'=> '2.064', + 'IO::Compress::Base' => '2.064', + 'IO::Compress::Base::Common'=> '2.064', + 'IO::Compress::Bzip2' => '2.064', + 'IO::Compress::Deflate' => '2.064', + 'IO::Compress::Gzip' => '2.064', + 'IO::Compress::Gzip::Constants'=> '2.064', + 'IO::Compress::RawDeflate'=> '2.064', + 'IO::Compress::Zip' => '2.064', + 'IO::Compress::Zip::Constants'=> '2.064', + 'IO::Compress::Zlib::Constants'=> '2.064', + 'IO::Compress::Zlib::Extra'=> '2.064', + 'IO::Socket::INET' => '1.35', + 'IO::Socket::IP' => '0.28', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.064', + 'IO::Uncompress::Adapter::Identity'=> '2.064', + 'IO::Uncompress::Adapter::Inflate'=> '2.064', + 'IO::Uncompress::AnyInflate'=> '2.064', + 'IO::Uncompress::AnyUncompress'=> '2.064', + 'IO::Uncompress::Base' => '2.064', + 'IO::Uncompress::Bunzip2'=> '2.064', + 'IO::Uncompress::Gunzip'=> '2.064', + 'IO::Uncompress::Inflate'=> '2.064', + 'IO::Uncompress::RawInflate'=> '2.064', + 'IO::Uncompress::Unzip' => '2.064', + 'IPC::Cmd' => '0.92', + 'List::Util' => '1.38', + 'List::Util::XS' => '1.38', + 'Locale::Codes' => '3.29', + 'Locale::Codes::Constants'=> '3.29', + 'Locale::Codes::Country'=> '3.29', + 'Locale::Codes::Country_Codes'=> '3.29', + 'Locale::Codes::Country_Retired'=> '3.29', + 'Locale::Codes::Currency'=> '3.29', + 'Locale::Codes::Currency_Codes'=> '3.29', + 'Locale::Codes::Currency_Retired'=> '3.29', + 'Locale::Codes::LangExt'=> '3.29', + 'Locale::Codes::LangExt_Codes'=> '3.29', + 'Locale::Codes::LangExt_Retired'=> '3.29', + 'Locale::Codes::LangFam'=> '3.29', + 'Locale::Codes::LangFam_Codes'=> '3.29', + 'Locale::Codes::LangFam_Retired'=> '3.29', + 'Locale::Codes::LangVar'=> '3.29', + 'Locale::Codes::LangVar_Codes'=> '3.29', + 'Locale::Codes::LangVar_Retired'=> '3.29', + 'Locale::Codes::Language'=> '3.29', + 'Locale::Codes::Language_Codes'=> '3.29', + 'Locale::Codes::Language_Retired'=> '3.29', + 'Locale::Codes::Script' => '3.29', + 'Locale::Codes::Script_Codes'=> '3.29', + 'Locale::Codes::Script_Retired'=> '3.29', + 'Locale::Country' => '3.29', + 'Locale::Currency' => '3.29', + 'Locale::Language' => '3.29', + 'Locale::Script' => '3.29', + 'Module::Build' => '0.4205', + 'Module::Build::Base' => '0.4205', + 'Module::Build::Compat' => '0.4205', + 'Module::Build::Config' => '0.4205', + 'Module::Build::Cookbook'=> '0.4205', + 'Module::Build::Dumper' => '0.4205', + 'Module::Build::ModuleInfo'=> '0.4205', + 'Module::Build::Notes' => '0.4205', + 'Module::Build::PPMMaker'=> '0.4205', + 'Module::Build::Platform::Default'=> '0.4205', + 'Module::Build::Platform::MacOS'=> '0.4205', + 'Module::Build::Platform::Unix'=> '0.4205', + 'Module::Build::Platform::VMS'=> '0.4205', + 'Module::Build::Platform::VOS'=> '0.4205', + 'Module::Build::Platform::Windows'=> '0.4205', + 'Module::Build::Platform::aix'=> '0.4205', + 'Module::Build::Platform::cygwin'=> '0.4205', + 'Module::Build::Platform::darwin'=> '0.4205', + 'Module::Build::Platform::os2'=> '0.4205', + 'Module::Build::PodParser'=> '0.4205', + 'Module::CoreList' => '3.06', + 'Module::CoreList::TieHashDelta'=> '3.06', + 'Module::CoreList::Utils'=> '3.06', + 'Module::Load' => '0.30', + 'Module::Load::Conditional'=> '0.62', + 'Net::Domain' => '2.23', + 'Net::FTP' => '2.79', + 'Net::NNTP' => '2.26', + 'Net::POP3' => '2.31', + 'Net::Ping' => '2.43', + 'Net::SMTP' => '2.33', + 'POSIX' => '1.38_02', + 'Parse::CPAN::Meta' => '1.4413', + 'Pod::Escapes' => '1.06', + 'Pod::Find' => '1.62', + 'Pod::InputObjects' => '1.62', + 'Pod::ParseUtils' => '1.62', + 'Pod::Parser' => '1.62', + 'Pod::Select' => '1.62', + 'Scalar::Util' => '1.38', + 'autodie' => '2.23', + 'autodie::exception' => '2.23', + 'autodie::exception::system'=> '2.23', + 'autodie::hints' => '2.23', + 'autodie::skip' => '2.23', + 'diagnostics' => '1.34', + 'feature' => '1.35', + 'inc::latest' => '0.4205', + 'locale' => '1.03', + 'mro' => '1.15', + 'threads' => '1.92', + 'version' => '0.9908', + 'version::regex' => '0.9908', + 'version::vpp' => '0.9908', + 'warnings' => '1.22', + }, + removed => { + } + }, + 5.01901 => { + delta_from => 5.019009, + changed => { + 'App::Cpan' => '1.62', + 'Attribute::Handlers' => '0.96', + 'B::Deparse' => '1.26', + 'CPAN' => '2.04', + 'CPAN::Bundle' => '5.5001', + 'CPAN::Complete' => '5.5001', + 'CPAN::Distribution' => '2.01', + 'CPAN::Distroprefs' => '6.0001', + 'CPAN::FirstTime' => '5.5305', + 'CPAN::Meta' => '2.140640', + 'CPAN::Meta::Converter' => '2.140640', + 'CPAN::Meta::Feature' => '2.140640', + 'CPAN::Meta::History' => '2.140640', + 'CPAN::Meta::Prereqs' => '2.140640', + 'CPAN::Meta::Spec' => '2.140640', + 'CPAN::Meta::Validator' => '2.140640', + 'CPAN::Meta::YAML' => '0.012', + 'CPAN::Queue' => '5.5002', + 'CPAN::Shell' => '5.5003', + 'CPAN::Tarzip' => '5.5012', + 'CPAN::Version' => '5.5003', + 'Carp' => '1.33', + 'Carp::Heavy' => '1.33', + 'Config' => '5.019010', + 'Data::Dumper' => '2.151', + 'Devel::PPPort' => '3.22', + 'Digest::SHA' => '5.88', + 'ExtUtils::Command::MM' => '6.92', + 'ExtUtils::Install' => '1.63', + 'ExtUtils::Installed' => '1.999005', + 'ExtUtils::Liblist' => '6.92', + 'ExtUtils::Liblist::Kid'=> '6.92', + 'ExtUtils::MM' => '6.92', + 'ExtUtils::MM_AIX' => '6.92', + 'ExtUtils::MM_Any' => '6.92', + 'ExtUtils::MM_BeOS' => '6.92', + 'ExtUtils::MM_Cygwin' => '6.92', + 'ExtUtils::MM_DOS' => '6.92', + 'ExtUtils::MM_Darwin' => '6.92', + 'ExtUtils::MM_MacOS' => '6.92', + 'ExtUtils::MM_NW5' => '6.92', + 'ExtUtils::MM_OS2' => '6.92', + 'ExtUtils::MM_QNX' => '6.92', + 'ExtUtils::MM_UWIN' => '6.92', + 'ExtUtils::MM_Unix' => '6.92', + 'ExtUtils::MM_VMS' => '6.92', + 'ExtUtils::MM_VOS' => '6.92', + 'ExtUtils::MM_Win32' => '6.92', + 'ExtUtils::MM_Win95' => '6.92', + 'ExtUtils::MY' => '6.92', + 'ExtUtils::MakeMaker' => '6.92', + 'ExtUtils::MakeMaker::Config'=> '6.92', + 'ExtUtils::Mkbootstrap' => '6.92', + 'ExtUtils::Mksymlists' => '6.92', + 'ExtUtils::Packlist' => '1.48', + 'ExtUtils::ParseXS' => '3.24', + 'ExtUtils::ParseXS::Constants'=> '3.24', + 'ExtUtils::ParseXS::CountLines'=> '3.24', + 'ExtUtils::ParseXS::Eval'=> '3.24', + 'ExtUtils::ParseXS::Utilities'=> '3.24', + 'ExtUtils::Typemaps' => '3.24', + 'ExtUtils::Typemaps::Cmd'=> '3.24', + 'ExtUtils::Typemaps::InputMap'=> '3.24', + 'ExtUtils::Typemaps::OutputMap'=> '3.24', + 'ExtUtils::Typemaps::Type'=> '3.24', + 'ExtUtils::testlib' => '6.92', + 'File::Find' => '1.27', + 'Filter::Simple' => '0.91', + 'HTTP::Tiny' => '0.043', + 'Hash::Util::FieldHash' => '1.15', + 'IO' => '1.31', + 'IO::Socket::IP' => '0.29', + 'Locale::Codes' => '3.30', + 'Locale::Codes::Constants'=> '3.30', + 'Locale::Codes::Country'=> '3.30', + 'Locale::Codes::Country_Codes'=> '3.30', + 'Locale::Codes::Country_Retired'=> '3.30', + 'Locale::Codes::Currency'=> '3.30', + 'Locale::Codes::Currency_Codes'=> '3.30', + 'Locale::Codes::Currency_Retired'=> '3.30', + 'Locale::Codes::LangExt'=> '3.30', + 'Locale::Codes::LangExt_Codes'=> '3.30', + 'Locale::Codes::LangExt_Retired'=> '3.30', + 'Locale::Codes::LangFam'=> '3.30', + 'Locale::Codes::LangFam_Codes'=> '3.30', + 'Locale::Codes::LangFam_Retired'=> '3.30', + 'Locale::Codes::LangVar'=> '3.30', + 'Locale::Codes::LangVar_Codes'=> '3.30', + 'Locale::Codes::LangVar_Retired'=> '3.30', + 'Locale::Codes::Language'=> '3.30', + 'Locale::Codes::Language_Codes'=> '3.30', + 'Locale::Codes::Language_Retired'=> '3.30', + 'Locale::Codes::Script' => '3.30', + 'Locale::Codes::Script_Codes'=> '3.30', + 'Locale::Codes::Script_Retired'=> '3.30', + 'Locale::Country' => '3.30', + 'Locale::Currency' => '3.30', + 'Locale::Language' => '3.30', + 'Locale::Script' => '3.30', + 'Module::CoreList' => '3.09', + 'Module::CoreList::TieHashDelta'=> '3.09', + 'Module::CoreList::Utils'=> '3.09', + 'Module::Load' => '0.32', + 'POSIX' => '1.38_03', + 'Parse::CPAN::Meta' => '1.4414', + 'Pod::Perldoc' => '3.23', + 'Pod::Perldoc::BaseTo' => '3.23', + 'Pod::Perldoc::GetOptsOO'=> '3.23', + 'Pod::Perldoc::ToANSI' => '3.23', + 'Pod::Perldoc::ToChecker'=> '3.23', + 'Pod::Perldoc::ToMan' => '3.23', + 'Pod::Perldoc::ToNroff' => '3.23', + 'Pod::Perldoc::ToPod' => '3.23', + 'Pod::Perldoc::ToRtf' => '3.23', + 'Pod::Perldoc::ToTerm' => '3.23', + 'Pod::Perldoc::ToText' => '3.23', + 'Pod::Perldoc::ToTk' => '3.23', + 'Pod::Perldoc::ToXml' => '3.23', + 'Thread::Queue' => '3.05', + 'XS::APItest' => '0.60', + 'XS::Typemap' => '0.13', + 'autouse' => '1.08', + 'base' => '2.22', + 'charnames' => '1.40', + 'feature' => '1.36', + 'mro' => '1.16', + 'threads' => '1.93', + 'warnings' => '1.23', + 'warnings::register' => '1.03', + }, + removed => { + } + }, + 5.019011 => { + delta_from => 5.01901, + changed => { + 'CPAN' => '2.05', + 'CPAN::Distribution' => '2.02', + 'CPAN::FirstTime' => '5.5306', + 'CPAN::Shell' => '5.5004', + 'Carp' => '1.3301', + 'Carp::Heavy' => '1.3301', + 'Config' => '5.019011', + 'ExtUtils::Command::MM' => '6.94', + 'ExtUtils::Install' => '1.67', + 'ExtUtils::Liblist' => '6.94', + 'ExtUtils::Liblist::Kid'=> '6.94', + 'ExtUtils::MM' => '6.94', + 'ExtUtils::MM_AIX' => '6.94', + 'ExtUtils::MM_Any' => '6.94', + 'ExtUtils::MM_BeOS' => '6.94', + 'ExtUtils::MM_Cygwin' => '6.94', + 'ExtUtils::MM_DOS' => '6.94', + 'ExtUtils::MM_Darwin' => '6.94', + 'ExtUtils::MM_MacOS' => '6.94', + 'ExtUtils::MM_NW5' => '6.94', + 'ExtUtils::MM_OS2' => '6.94', + 'ExtUtils::MM_QNX' => '6.94', + 'ExtUtils::MM_UWIN' => '6.94', + 'ExtUtils::MM_Unix' => '6.94', + 'ExtUtils::MM_VMS' => '6.94', + 'ExtUtils::MM_VOS' => '6.94', + 'ExtUtils::MM_Win32' => '6.94', + 'ExtUtils::MM_Win95' => '6.94', + 'ExtUtils::MY' => '6.94', + 'ExtUtils::MakeMaker' => '6.94', + 'ExtUtils::MakeMaker::Config'=> '6.94', + 'ExtUtils::Mkbootstrap' => '6.94', + 'ExtUtils::Mksymlists' => '6.94', + 'ExtUtils::testlib' => '6.94', + 'Module::CoreList' => '3.10', + 'Module::CoreList::TieHashDelta'=> '3.10', + 'Module::CoreList::Utils'=> '3.10', + 'PerlIO' => '1.09', + 'Storable' => '2.49', + 'Win32' => '0.49', + 'experimental' => '0.007', + }, + removed => { + } + }, + 5.020000 => { + delta_from => 5.019011, + changed => { + 'Config' => '5.02', + 'Devel::PPPort' => '3.21', + 'Encode' => '2.60', + 'Errno' => '1.20_03', + 'ExtUtils::Command::MM' => '6.98', + 'ExtUtils::Liblist' => '6.98', + 'ExtUtils::Liblist::Kid'=> '6.98', + 'ExtUtils::MM' => '6.98', + 'ExtUtils::MM_AIX' => '6.98', + 'ExtUtils::MM_Any' => '6.98', + 'ExtUtils::MM_BeOS' => '6.98', + 'ExtUtils::MM_Cygwin' => '6.98', + 'ExtUtils::MM_DOS' => '6.98', + 'ExtUtils::MM_Darwin' => '6.98', + 'ExtUtils::MM_MacOS' => '6.98', + 'ExtUtils::MM_NW5' => '6.98', + 'ExtUtils::MM_OS2' => '6.98', + 'ExtUtils::MM_QNX' => '6.98', + 'ExtUtils::MM_UWIN' => '6.98', + 'ExtUtils::MM_Unix' => '6.98', + 'ExtUtils::MM_VMS' => '6.98', + 'ExtUtils::MM_VOS' => '6.98', + 'ExtUtils::MM_Win32' => '6.98', + 'ExtUtils::MM_Win95' => '6.98', + 'ExtUtils::MY' => '6.98', + 'ExtUtils::MakeMaker' => '6.98', + 'ExtUtils::MakeMaker::Config'=> '6.98', + 'ExtUtils::Miniperl' => '1.01', + 'ExtUtils::Mkbootstrap' => '6.98', + 'ExtUtils::Mksymlists' => '6.98', + 'ExtUtils::testlib' => '6.98', + 'Pod::Functions::Functions'=> '1.08', + }, + removed => { + } + }, + 5.021000 => { + delta_from => 5.020000, + changed => { + 'Module::CoreList' => '5.021001', + 'Module::CoreList::TieHashDelta'=> '5.021001', + 'Module::CoreList::Utils'=> '5.021001', + 'feature' => '1.37', + }, + removed => { + 'CGI' => 1, + 'CGI::Apache' => 1, + 'CGI::Carp' => 1, + 'CGI::Cookie' => 1, + 'CGI::Fast' => 1, + 'CGI::Pretty' => 1, + 'CGI::Push' => 1, + 'CGI::Switch' => 1, + 'CGI::Util' => 1, + 'Module::Build' => 1, + 'Module::Build::Base' => 1, + 'Module::Build::Compat' => 1, + 'Module::Build::Config' => 1, + 'Module::Build::ConfigData'=> 1, + 'Module::Build::Cookbook'=> 1, + 'Module::Build::Dumper' => 1, + 'Module::Build::ModuleInfo'=> 1, + 'Module::Build::Notes' => 1, + 'Module::Build::PPMMaker'=> 1, + 'Module::Build::Platform::Default'=> 1, + 'Module::Build::Platform::MacOS'=> 1, + 'Module::Build::Platform::Unix'=> 1, + 'Module::Build::Platform::VMS'=> 1, + 'Module::Build::Platform::VOS'=> 1, + 'Module::Build::Platform::Windows'=> 1, + 'Module::Build::Platform::aix'=> 1, + 'Module::Build::Platform::cygwin'=> 1, + 'Module::Build::Platform::darwin'=> 1, + 'Module::Build::Platform::os2'=> 1, + 'Module::Build::PodParser'=> 1, + 'Module::Build::Version'=> 1, + 'Module::Build::YAML' => 1, + 'Package::Constants' => 1, + 'inc::latest' => 1, + } + }, + 5.021001 => { + delta_from => 5.021000, + changed => { + 'App::Prove' => '3.32', + 'App::Prove::State' => '3.32', + 'App::Prove::State::Result'=> '3.32', + 'App::Prove::State::Result::Test'=> '3.32', + 'Archive::Tar' => '2.00', + 'Archive::Tar::Constant'=> '2.00', + 'Archive::Tar::File' => '2.00', + 'B' => '1.49', + 'B::Deparse' => '1.27', + 'Benchmark' => '1.19', + 'CPAN::Meta' => '2.141520', + 'CPAN::Meta::Converter' => '2.141520', + 'CPAN::Meta::Feature' => '2.141520', + 'CPAN::Meta::History' => '2.141520', + 'CPAN::Meta::Prereqs' => '2.141520', + 'CPAN::Meta::Spec' => '2.141520', + 'CPAN::Meta::Validator' => '2.141520', + 'Carp' => '1.34', + 'Carp::Heavy' => '1.34', + 'Config' => '5.021001', + 'Cwd' => '3.48', + 'Data::Dumper' => '2.152', + 'Devel::PPPort' => '3.24', + 'Devel::Peek' => '1.17', + 'Digest::SHA' => '5.92', + 'DynaLoader' => '1.26', + 'Encode' => '2.62', + 'Errno' => '1.20_04', + 'Exporter' => '5.71', + 'Exporter::Heavy' => '5.71', + 'ExtUtils::Install' => '1.68', + 'ExtUtils::Miniperl' => '1.02', + 'ExtUtils::ParseXS' => '3.25', + 'ExtUtils::ParseXS::Constants'=> '3.25', + 'ExtUtils::ParseXS::CountLines'=> '3.25', + 'ExtUtils::ParseXS::Eval'=> '3.25', + 'ExtUtils::ParseXS::Utilities'=> '3.25', + 'ExtUtils::Typemaps' => '3.25', + 'ExtUtils::Typemaps::Cmd'=> '3.25', + 'ExtUtils::Typemaps::InputMap'=> '3.25', + 'ExtUtils::Typemaps::OutputMap'=> '3.25', + 'ExtUtils::Typemaps::Type'=> '3.25', + 'Fatal' => '2.25', + 'File::Spec' => '3.48', + 'File::Spec::Cygwin' => '3.48', + 'File::Spec::Epoc' => '3.48', + 'File::Spec::Functions' => '3.48', + 'File::Spec::Mac' => '3.48', + 'File::Spec::OS2' => '3.48', + 'File::Spec::Unix' => '3.48', + 'File::Spec::VMS' => '3.48', + 'File::Spec::Win32' => '3.48', + 'Hash::Util' => '0.17', + 'IO' => '1.32', + 'List::Util' => '1.39', + 'List::Util::XS' => '1.39', + 'Locale::Codes' => '3.31', + 'Locale::Codes::Constants'=> '3.31', + 'Locale::Codes::Country'=> '3.31', + 'Locale::Codes::Country_Codes'=> '3.31', + 'Locale::Codes::Country_Retired'=> '3.31', + 'Locale::Codes::Currency'=> '3.31', + 'Locale::Codes::Currency_Codes'=> '3.31', + 'Locale::Codes::Currency_Retired'=> '3.31', + 'Locale::Codes::LangExt'=> '3.31', + 'Locale::Codes::LangExt_Codes'=> '3.31', + 'Locale::Codes::LangExt_Retired'=> '3.31', + 'Locale::Codes::LangFam'=> '3.31', + 'Locale::Codes::LangFam_Codes'=> '3.31', + 'Locale::Codes::LangFam_Retired'=> '3.31', + 'Locale::Codes::LangVar'=> '3.31', + 'Locale::Codes::LangVar_Codes'=> '3.31', + 'Locale::Codes::LangVar_Retired'=> '3.31', + 'Locale::Codes::Language'=> '3.31', + 'Locale::Codes::Language_Codes'=> '3.31', + 'Locale::Codes::Language_Retired'=> '3.31', + 'Locale::Codes::Script' => '3.31', + 'Locale::Codes::Script_Codes'=> '3.31', + 'Locale::Codes::Script_Retired'=> '3.31', + 'Locale::Country' => '3.31', + 'Locale::Currency' => '3.31', + 'Locale::Language' => '3.31', + 'Locale::Script' => '3.31', + 'Math::BigFloat' => '1.9994', + 'Math::BigInt' => '1.9995', + 'Math::BigInt::Calc' => '1.9994', + 'Math::BigInt::CalcEmu' => '1.9994', + 'Math::BigRat' => '0.2608', + 'Module::CoreList' => '5.021001_01', + 'Module::CoreList::TieHashDelta'=> '5.021001_01', + 'Module::CoreList::Utils'=> '5.021001_01', + 'Module::Metadata' => '1.000024', + 'NDBM_File' => '1.13', + 'Net::Config' => '1.14', + 'Net::SMTP' => '2.34', + 'Net::Time' => '2.11', + 'OS2::Process' => '1.10', + 'POSIX' => '1.40', + 'PerlIO::encoding' => '0.19', + 'PerlIO::mmap' => '0.013', + 'PerlIO::scalar' => '0.19', + 'PerlIO::via' => '0.15', + 'Pod::Html' => '1.22', + 'Scalar::Util' => '1.39', + 'SelfLoader' => '1.22', + 'Socket' => '2.014', + 'Storable' => '2.51', + 'TAP::Base' => '3.32', + 'TAP::Formatter::Base' => '3.32', + 'TAP::Formatter::Color' => '3.32', + 'TAP::Formatter::Console'=> '3.32', + 'TAP::Formatter::Console::ParallelSession'=> '3.32', + 'TAP::Formatter::Console::Session'=> '3.32', + 'TAP::Formatter::File' => '3.32', + 'TAP::Formatter::File::Session'=> '3.32', + 'TAP::Formatter::Session'=> '3.32', + 'TAP::Harness' => '3.32', + 'TAP::Harness::Env' => '3.32', + 'TAP::Object' => '3.32', + 'TAP::Parser' => '3.32', + 'TAP::Parser::Aggregator'=> '3.32', + 'TAP::Parser::Grammar' => '3.32', + 'TAP::Parser::Iterator' => '3.32', + 'TAP::Parser::Iterator::Array'=> '3.32', + 'TAP::Parser::Iterator::Process'=> '3.32', + 'TAP::Parser::Iterator::Stream'=> '3.32', + 'TAP::Parser::IteratorFactory'=> '3.32', + 'TAP::Parser::Multiplexer'=> '3.32', + 'TAP::Parser::Result' => '3.32', + 'TAP::Parser::Result::Bailout'=> '3.32', + 'TAP::Parser::Result::Comment'=> '3.32', + 'TAP::Parser::Result::Plan'=> '3.32', + 'TAP::Parser::Result::Pragma'=> '3.32', + 'TAP::Parser::Result::Test'=> '3.32', + 'TAP::Parser::Result::Unknown'=> '3.32', + 'TAP::Parser::Result::Version'=> '3.32', + 'TAP::Parser::Result::YAML'=> '3.32', + 'TAP::Parser::ResultFactory'=> '3.32', + 'TAP::Parser::Scheduler'=> '3.32', + 'TAP::Parser::Scheduler::Job'=> '3.32', + 'TAP::Parser::Scheduler::Spinner'=> '3.32', + 'TAP::Parser::Source' => '3.32', + 'TAP::Parser::SourceHandler'=> '3.32', + 'TAP::Parser::SourceHandler::Executable'=> '3.32', + 'TAP::Parser::SourceHandler::File'=> '3.32', + 'TAP::Parser::SourceHandler::Handle'=> '3.32', + 'TAP::Parser::SourceHandler::Perl'=> '3.32', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.32', + 'TAP::Parser::YAMLish::Reader'=> '3.32', + 'TAP::Parser::YAMLish::Writer'=> '3.32', + 'Term::ANSIColor' => '4.03', + 'Test::Builder' => '1.001003', + 'Test::Builder::Module' => '1.001003', + 'Test::Builder::Tester' => '1.23_003', + 'Test::Harness' => '3.32', + 'Test::More' => '1.001003', + 'Test::Simple' => '1.001003', + 'Tie::File' => '1.01', + 'Unicode' => '7.0.0', + 'Unicode::Collate' => '1.07', + 'Unicode::Normalize' => '1.18', + 'Unicode::UCD' => '0.58', + 'XS::APItest' => '0.61', + '_charnames' => '1.41', + 'autodie' => '2.25', + 'autodie::Scope::Guard' => '2.25', + 'autodie::Scope::GuardStack'=> '2.25', + 'autodie::ScopeUtil' => '2.25', + 'autodie::exception' => '2.25', + 'autodie::exception::system'=> '2.25', + 'autodie::hints' => '2.25', + 'autodie::skip' => '2.25', + 'charnames' => '1.41', + 'locale' => '1.04', + 'threads' => '1.94', + 'utf8' => '1.14', + 'warnings' => '1.24', + }, + removed => { + } + }, + 5.021002 => { + delta_from => 5.021001, + changed => { + 'B' => '1.50', + 'Config' => '5.021002', + 'Cwd' => '3.49', + 'Devel::Peek' => '1.18', + 'ExtUtils::Manifest' => '1.64', + 'File::Copy' => '2.30', + 'File::Spec' => '3.49', + 'File::Spec::Cygwin' => '3.49', + 'File::Spec::Epoc' => '3.49', + 'File::Spec::Functions' => '3.49', + 'File::Spec::Mac' => '3.49', + 'File::Spec::OS2' => '3.49', + 'File::Spec::Unix' => '3.49', + 'File::Spec::VMS' => '3.49', + 'File::Spec::Win32' => '3.49', + 'Filter::Simple' => '0.92', + 'Hash::Util' => '0.18', + 'IO' => '1.33', + 'IO::Socket::IP' => '0.31', + 'IPC::Open3' => '1.17', + 'Math::BigFloat' => '1.9996', + 'Math::BigInt' => '1.9996', + 'Math::BigInt::Calc' => '1.9996', + 'Math::BigInt::CalcEmu' => '1.9996', + 'Module::CoreList' => '5.021002', + 'Module::CoreList::TieHashDelta'=> '5.021002', + 'Module::CoreList::Utils'=> '5.021002', + 'POSIX' => '1.41', + 'Pod::Usage' => '1.64', + 'XS::APItest' => '0.62', + 'arybase' => '0.08', + 'experimental' => '0.008', + 'threads' => '1.95', + 'warnings' => '1.26', + }, + removed => { + } + }, + 5.021003 => { + delta_from => 5.021002, + changed => { + 'B::Debug' => '1.21', + 'CPAN::Meta' => '2.142060', + 'CPAN::Meta::Converter' => '2.142060', + 'CPAN::Meta::Feature' => '2.142060', + 'CPAN::Meta::History' => '2.142060', + 'CPAN::Meta::Merge' => '2.142060', + 'CPAN::Meta::Prereqs' => '2.142060', + 'CPAN::Meta::Requirements'=> '2.126', + 'CPAN::Meta::Spec' => '2.142060', + 'CPAN::Meta::Validator' => '2.142060', + 'Config' => '5.021003', + 'Config::Perl::V' => '0.22', + 'ExtUtils::CBuilder' => '0.280217', + 'ExtUtils::CBuilder::Base'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280217', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280217', + 'ExtUtils::CBuilder::Platform::android'=> '0.280217', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280217', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280217', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280217', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280217', + 'ExtUtils::Manifest' => '1.65', + 'HTTP::Tiny' => '0.047', + 'IPC::Open3' => '1.18', + 'Module::CoreList' => '5.021003', + 'Module::CoreList::TieHashDelta'=> '5.021003', + 'Module::CoreList::Utils'=> '5.021003', + 'Opcode' => '1.28', + 'POSIX' => '1.42', + 'Safe' => '2.38', + 'Socket' => '2.015', + 'Sys::Hostname' => '1.19', + 'UNIVERSAL' => '1.12', + 'XS::APItest' => '0.63', + 'perlfaq' => '5.0150045', + }, + removed => { + } + }, + 5.020001 => { + delta_from => 5.020000, + changed => { + 'Config' => '5.020001', + 'Config::Perl::V' => '0.22', + 'Cwd' => '3.48', + 'Exporter' => '5.71', + 'Exporter::Heavy' => '5.71', + 'ExtUtils::CBuilder' => '0.280217', + 'ExtUtils::CBuilder::Base'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280217', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280217', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280217', + 'ExtUtils::CBuilder::Platform::android'=> '0.280217', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280217', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280217', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280217', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280217', + 'File::Copy' => '2.30', + 'File::Spec' => '3.48', + 'File::Spec::Cygwin' => '3.48', + 'File::Spec::Epoc' => '3.48', + 'File::Spec::Functions' => '3.48', + 'File::Spec::Mac' => '3.48', + 'File::Spec::OS2' => '3.48', + 'File::Spec::Unix' => '3.48', + 'File::Spec::VMS' => '3.48', + 'File::Spec::Win32' => '3.48', + 'Module::CoreList' => '5.020001', + 'Module::CoreList::TieHashDelta'=> '5.020001', + 'Module::CoreList::Utils'=> '5.020001', + 'PerlIO::via' => '0.15', + 'Unicode::UCD' => '0.58', + 'XS::APItest' => '0.60_01', + 'utf8' => '1.13_01', + 'version' => '0.9909', + 'version::regex' => '0.9909', + 'version::vpp' => '0.9909', + }, + removed => { + } + }, + 5.021004 => { + delta_from => 5.021003, + changed => { + 'App::Prove' => '3.33', + 'App::Prove::State' => '3.33', + 'App::Prove::State::Result'=> '3.33', + 'App::Prove::State::Result::Test'=> '3.33', + 'Archive::Tar' => '2.02', + 'Archive::Tar::Constant'=> '2.02', + 'Archive::Tar::File' => '2.02', + 'Attribute::Handlers' => '0.97', + 'B' => '1.51', + 'B::Concise' => '0.993', + 'B::Deparse' => '1.28', + 'B::Op_private' => '5.021004', + 'CPAN::Meta::Requirements'=> '2.128', + 'Config' => '5.021004', + 'Cwd' => '3.50', + 'Data::Dumper' => '2.154', + 'ExtUtils::CBuilder' => '0.280219', + 'ExtUtils::CBuilder::Base'=> '0.280219', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280219', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280219', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280219', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280219', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280219', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280219', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280219', + 'ExtUtils::CBuilder::Platform::android'=> '0.280219', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280219', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280219', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280219', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280219', + 'ExtUtils::Install' => '2.04', + 'ExtUtils::Installed' => '2.04', + 'ExtUtils::Liblist::Kid'=> '6.98_01', + 'ExtUtils::Manifest' => '1.68', + 'ExtUtils::Packlist' => '2.04', + 'File::Find' => '1.28', + 'File::Spec' => '3.50', + 'File::Spec::Cygwin' => '3.50', + 'File::Spec::Epoc' => '3.50', + 'File::Spec::Functions' => '3.50', + 'File::Spec::Mac' => '3.50', + 'File::Spec::OS2' => '3.50', + 'File::Spec::Unix' => '3.50', + 'File::Spec::VMS' => '3.50', + 'File::Spec::Win32' => '3.50', + 'Getopt::Std' => '1.11', + 'HTTP::Tiny' => '0.049', + 'IO' => '1.34', + 'IO::Socket::IP' => '0.32', + 'List::Util' => '1.41', + 'List::Util::XS' => '1.41', + 'Locale::Codes' => '3.32', + 'Locale::Codes::Constants'=> '3.32', + 'Locale::Codes::Country'=> '3.32', + 'Locale::Codes::Country_Codes'=> '3.32', + 'Locale::Codes::Country_Retired'=> '3.32', + 'Locale::Codes::Currency'=> '3.32', + 'Locale::Codes::Currency_Codes'=> '3.32', + 'Locale::Codes::Currency_Retired'=> '3.32', + 'Locale::Codes::LangExt'=> '3.32', + 'Locale::Codes::LangExt_Codes'=> '3.32', + 'Locale::Codes::LangExt_Retired'=> '3.32', + 'Locale::Codes::LangFam'=> '3.32', + 'Locale::Codes::LangFam_Codes'=> '3.32', + 'Locale::Codes::LangFam_Retired'=> '3.32', + 'Locale::Codes::LangVar'=> '3.32', + 'Locale::Codes::LangVar_Codes'=> '3.32', + 'Locale::Codes::LangVar_Retired'=> '3.32', + 'Locale::Codes::Language'=> '3.32', + 'Locale::Codes::Language_Codes'=> '3.32', + 'Locale::Codes::Language_Retired'=> '3.32', + 'Locale::Codes::Script' => '3.32', + 'Locale::Codes::Script_Codes'=> '3.32', + 'Locale::Codes::Script_Retired'=> '3.32', + 'Locale::Country' => '3.32', + 'Locale::Currency' => '3.32', + 'Locale::Language' => '3.32', + 'Locale::Script' => '3.32', + 'Math::BigFloat' => '1.9997', + 'Math::BigInt' => '1.9997', + 'Math::BigInt::Calc' => '1.9997', + 'Math::BigInt::CalcEmu' => '1.9997', + 'Module::CoreList' => '5.20140920', + 'Module::CoreList::TieHashDelta'=> '5.20140920', + 'Module::CoreList::Utils'=> '5.20140920', + 'POSIX' => '1.43', + 'Pod::Perldoc' => '3.24', + 'Pod::Perldoc::BaseTo' => '3.24', + 'Pod::Perldoc::GetOptsOO'=> '3.24', + 'Pod::Perldoc::ToANSI' => '3.24', + 'Pod::Perldoc::ToChecker'=> '3.24', + 'Pod::Perldoc::ToMan' => '3.24', + 'Pod::Perldoc::ToNroff' => '3.24', + 'Pod::Perldoc::ToPod' => '3.24', + 'Pod::Perldoc::ToRtf' => '3.24', + 'Pod::Perldoc::ToTerm' => '3.24', + 'Pod::Perldoc::ToText' => '3.24', + 'Pod::Perldoc::ToTk' => '3.24', + 'Pod::Perldoc::ToXml' => '3.24', + 'Scalar::Util' => '1.41', + 'Sub::Util' => '1.41', + 'TAP::Base' => '3.33', + 'TAP::Formatter::Base' => '3.33', + 'TAP::Formatter::Color' => '3.33', + 'TAP::Formatter::Console'=> '3.33', + 'TAP::Formatter::Console::ParallelSession'=> '3.33', + 'TAP::Formatter::Console::Session'=> '3.33', + 'TAP::Formatter::File' => '3.33', + 'TAP::Formatter::File::Session'=> '3.33', + 'TAP::Formatter::Session'=> '3.33', + 'TAP::Harness' => '3.33', + 'TAP::Harness::Env' => '3.33', + 'TAP::Object' => '3.33', + 'TAP::Parser' => '3.33', + 'TAP::Parser::Aggregator'=> '3.33', + 'TAP::Parser::Grammar' => '3.33', + 'TAP::Parser::Iterator' => '3.33', + 'TAP::Parser::Iterator::Array'=> '3.33', + 'TAP::Parser::Iterator::Process'=> '3.33', + 'TAP::Parser::Iterator::Stream'=> '3.33', + 'TAP::Parser::IteratorFactory'=> '3.33', + 'TAP::Parser::Multiplexer'=> '3.33', + 'TAP::Parser::Result' => '3.33', + 'TAP::Parser::Result::Bailout'=> '3.33', + 'TAP::Parser::Result::Comment'=> '3.33', + 'TAP::Parser::Result::Plan'=> '3.33', + 'TAP::Parser::Result::Pragma'=> '3.33', + 'TAP::Parser::Result::Test'=> '3.33', + 'TAP::Parser::Result::Unknown'=> '3.33', + 'TAP::Parser::Result::Version'=> '3.33', + 'TAP::Parser::Result::YAML'=> '3.33', + 'TAP::Parser::ResultFactory'=> '3.33', + 'TAP::Parser::Scheduler'=> '3.33', + 'TAP::Parser::Scheduler::Job'=> '3.33', + 'TAP::Parser::Scheduler::Spinner'=> '3.33', + 'TAP::Parser::Source' => '3.33', + 'TAP::Parser::SourceHandler'=> '3.33', + 'TAP::Parser::SourceHandler::Executable'=> '3.33', + 'TAP::Parser::SourceHandler::File'=> '3.33', + 'TAP::Parser::SourceHandler::Handle'=> '3.33', + 'TAP::Parser::SourceHandler::Perl'=> '3.33', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.33', + 'TAP::Parser::YAMLish::Reader'=> '3.33', + 'TAP::Parser::YAMLish::Writer'=> '3.33', + 'Term::ReadLine' => '1.15', + 'Test::Builder' => '1.001006', + 'Test::Builder::Module' => '1.001006', + 'Test::Builder::Tester' => '1.24', + 'Test::Builder::Tester::Color'=> '1.24', + 'Test::Harness' => '3.33', + 'Test::More' => '1.001006', + 'Test::Simple' => '1.001006', + 'Time::Piece' => '1.29', + 'Time::Seconds' => '1.29', + 'XS::APItest' => '0.64', + '_charnames' => '1.42', + 'attributes' => '0.23', + 'bigint' => '0.37', + 'bignum' => '0.38', + 'bigrat' => '0.37', + 'constant' => '1.32', + 'experimental' => '0.010', + 'overload' => '1.23', + 'threads' => '1.96', + 'version' => '0.9909', + 'version::regex' => '0.9909', + 'version::vpp' => '0.9909', + }, + removed => { + } + }, + 5.021005 => { + delta_from => 5.021004, + changed => { + 'B' => '1.52', + 'B::Concise' => '0.994', + 'B::Debug' => '1.22', + 'B::Deparse' => '1.29', + 'B::Op_private' => '5.021005', + 'CPAN::Meta' => '2.142690', + 'CPAN::Meta::Converter' => '2.142690', + 'CPAN::Meta::Feature' => '2.142690', + 'CPAN::Meta::History' => '2.142690', + 'CPAN::Meta::Merge' => '2.142690', + 'CPAN::Meta::Prereqs' => '2.142690', + 'CPAN::Meta::Spec' => '2.142690', + 'CPAN::Meta::Validator' => '2.142690', + 'Compress::Raw::Bzip2' => '2.066', + 'Compress::Raw::Zlib' => '2.066', + 'Compress::Zlib' => '2.066', + 'Config' => '5.021005', + 'Cwd' => '3.51', + 'DynaLoader' => '1.27', + 'Errno' => '1.21', + 'ExtUtils::CBuilder' => '0.280220', + 'ExtUtils::CBuilder::Base'=> '0.280220', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280220', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280220', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280220', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280220', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280220', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280220', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280220', + 'ExtUtils::CBuilder::Platform::android'=> '0.280220', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280220', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280220', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280220', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280220', + 'ExtUtils::Miniperl' => '1.03', + 'Fcntl' => '1.13', + 'File::Find' => '1.29', + 'File::Spec' => '3.51', + 'File::Spec::Cygwin' => '3.51', + 'File::Spec::Epoc' => '3.51', + 'File::Spec::Functions' => '3.51', + 'File::Spec::Mac' => '3.51', + 'File::Spec::OS2' => '3.51', + 'File::Spec::Unix' => '3.51', + 'File::Spec::VMS' => '3.51', + 'File::Spec::Win32' => '3.51', + 'HTTP::Tiny' => '0.050', + 'IO::Compress::Adapter::Bzip2'=> '2.066', + 'IO::Compress::Adapter::Deflate'=> '2.066', + 'IO::Compress::Adapter::Identity'=> '2.066', + 'IO::Compress::Base' => '2.066', + 'IO::Compress::Base::Common'=> '2.066', + 'IO::Compress::Bzip2' => '2.066', + 'IO::Compress::Deflate' => '2.066', + 'IO::Compress::Gzip' => '2.066', + 'IO::Compress::Gzip::Constants'=> '2.066', + 'IO::Compress::RawDeflate'=> '2.066', + 'IO::Compress::Zip' => '2.066', + 'IO::Compress::Zip::Constants'=> '2.066', + 'IO::Compress::Zlib::Constants'=> '2.066', + 'IO::Compress::Zlib::Extra'=> '2.066', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.066', + 'IO::Uncompress::Adapter::Identity'=> '2.066', + 'IO::Uncompress::Adapter::Inflate'=> '2.066', + 'IO::Uncompress::AnyInflate'=> '2.066', + 'IO::Uncompress::AnyUncompress'=> '2.066', + 'IO::Uncompress::Base' => '2.066', + 'IO::Uncompress::Bunzip2'=> '2.066', + 'IO::Uncompress::Gunzip'=> '2.066', + 'IO::Uncompress::Inflate'=> '2.066', + 'IO::Uncompress::RawInflate'=> '2.066', + 'IO::Uncompress::Unzip' => '2.066', + 'JSON::PP' => '2.27300', + 'Module::CoreList' => '5.20141020', + 'Module::CoreList::TieHashDelta'=> '5.20141020', + 'Module::CoreList::Utils'=> '5.20141020', + 'Net::Cmd' => '3.02', + 'Net::Config' => '3.02', + 'Net::Domain' => '3.02', + 'Net::FTP' => '3.02', + 'Net::FTP::A' => '3.02', + 'Net::FTP::E' => '3.02', + 'Net::FTP::I' => '3.02', + 'Net::FTP::L' => '3.02', + 'Net::FTP::dataconn' => '3.02', + 'Net::NNTP' => '3.02', + 'Net::Netrc' => '3.02', + 'Net::POP3' => '3.02', + 'Net::SMTP' => '3.02', + 'Net::Time' => '3.02', + 'Opcode' => '1.29', + 'POSIX' => '1.45', + 'Socket' => '2.016', + 'Test::Builder' => '1.001008', + 'Test::Builder::Module' => '1.001008', + 'Test::More' => '1.001008', + 'Test::Simple' => '1.001008', + 'XS::APItest' => '0.65', + 'XSLoader' => '0.18', + 'attributes' => '0.24', + 'experimental' => '0.012', + 'feature' => '1.38', + 'perlfaq' => '5.0150046', + 're' => '0.27', + 'threads::shared' => '1.47', + 'warnings' => '1.28', + 'warnings::register' => '1.04', + }, + removed => { + } + }, + 5.021006 => { + delta_from => 5.021005, + changed => { + 'App::Prove' => '3.34', + 'App::Prove::State' => '3.34', + 'App::Prove::State::Result'=> '3.34', + 'App::Prove::State::Result::Test'=> '3.34', + 'B' => '1.53', + 'B::Concise' => '0.995', + 'B::Deparse' => '1.30', + 'B::Op_private' => '5.021006', + 'CPAN::Meta' => '2.143240', + 'CPAN::Meta::Converter' => '2.143240', + 'CPAN::Meta::Feature' => '2.143240', + 'CPAN::Meta::History' => '2.143240', + 'CPAN::Meta::Merge' => '2.143240', + 'CPAN::Meta::Prereqs' => '2.143240', + 'CPAN::Meta::Requirements'=> '2.130', + 'CPAN::Meta::Spec' => '2.143240', + 'CPAN::Meta::Validator' => '2.143240', + 'Config' => '5.021006', + 'Devel::Peek' => '1.19', + 'Digest::SHA' => '5.93', + 'DynaLoader' => '1.28', + 'Encode' => '2.64', + 'Exporter' => '5.72', + 'Exporter::Heavy' => '5.72', + 'ExtUtils::Command::MM' => '7.02', + 'ExtUtils::Liblist' => '7.02', + 'ExtUtils::Liblist::Kid'=> '7.02', + 'ExtUtils::MM' => '7.02', + 'ExtUtils::MM_AIX' => '7.02', + 'ExtUtils::MM_Any' => '7.02', + 'ExtUtils::MM_BeOS' => '7.02', + 'ExtUtils::MM_Cygwin' => '7.02', + 'ExtUtils::MM_DOS' => '7.02', + 'ExtUtils::MM_Darwin' => '7.02', + 'ExtUtils::MM_MacOS' => '7.02', + 'ExtUtils::MM_NW5' => '7.02', + 'ExtUtils::MM_OS2' => '7.02', + 'ExtUtils::MM_QNX' => '7.02', + 'ExtUtils::MM_UWIN' => '7.02', + 'ExtUtils::MM_Unix' => '7.02', + 'ExtUtils::MM_VMS' => '7.02', + 'ExtUtils::MM_VOS' => '7.02', + 'ExtUtils::MM_Win32' => '7.02', + 'ExtUtils::MM_Win95' => '7.02', + 'ExtUtils::MY' => '7.02', + 'ExtUtils::MakeMaker' => '7.02', + 'ExtUtils::MakeMaker::Config'=> '7.02', + 'ExtUtils::MakeMaker::Locale'=> '7.02', + 'ExtUtils::MakeMaker::version'=> '7.02', + 'ExtUtils::MakeMaker::version::regex'=> '7.02', + 'ExtUtils::MakeMaker::version::vpp'=> '7.02', + 'ExtUtils::Manifest' => '1.69', + 'ExtUtils::Mkbootstrap' => '7.02', + 'ExtUtils::Mksymlists' => '7.02', + 'ExtUtils::ParseXS' => '3.26', + 'ExtUtils::ParseXS::Constants'=> '3.26', + 'ExtUtils::ParseXS::CountLines'=> '3.26', + 'ExtUtils::ParseXS::Eval'=> '3.26', + 'ExtUtils::ParseXS::Utilities'=> '3.26', + 'ExtUtils::testlib' => '7.02', + 'File::Spec::VMS' => '3.52', + 'HTTP::Tiny' => '0.051', + 'I18N::Langinfo' => '0.12', + 'IO::Socket' => '1.38', + 'Module::CoreList' => '5.20141120', + 'Module::CoreList::TieHashDelta'=> '5.20141120', + 'Module::CoreList::Utils'=> '5.20141120', + 'POSIX' => '1.46', + 'PerlIO::encoding' => '0.20', + 'PerlIO::scalar' => '0.20', + 'TAP::Base' => '3.34', + 'TAP::Formatter::Base' => '3.34', + 'TAP::Formatter::Color' => '3.34', + 'TAP::Formatter::Console'=> '3.34', + 'TAP::Formatter::Console::ParallelSession'=> '3.34', + 'TAP::Formatter::Console::Session'=> '3.34', + 'TAP::Formatter::File' => '3.34', + 'TAP::Formatter::File::Session'=> '3.34', + 'TAP::Formatter::Session'=> '3.34', + 'TAP::Harness' => '3.34', + 'TAP::Harness::Env' => '3.34', + 'TAP::Object' => '3.34', + 'TAP::Parser' => '3.34', + 'TAP::Parser::Aggregator'=> '3.34', + 'TAP::Parser::Grammar' => '3.34', + 'TAP::Parser::Iterator' => '3.34', + 'TAP::Parser::Iterator::Array'=> '3.34', + 'TAP::Parser::Iterator::Process'=> '3.34', + 'TAP::Parser::Iterator::Stream'=> '3.34', + 'TAP::Parser::IteratorFactory'=> '3.34', + 'TAP::Parser::Multiplexer'=> '3.34', + 'TAP::Parser::Result' => '3.34', + 'TAP::Parser::Result::Bailout'=> '3.34', + 'TAP::Parser::Result::Comment'=> '3.34', + 'TAP::Parser::Result::Plan'=> '3.34', + 'TAP::Parser::Result::Pragma'=> '3.34', + 'TAP::Parser::Result::Test'=> '3.34', + 'TAP::Parser::Result::Unknown'=> '3.34', + 'TAP::Parser::Result::Version'=> '3.34', + 'TAP::Parser::Result::YAML'=> '3.34', + 'TAP::Parser::ResultFactory'=> '3.34', + 'TAP::Parser::Scheduler'=> '3.34', + 'TAP::Parser::Scheduler::Job'=> '3.34', + 'TAP::Parser::Scheduler::Spinner'=> '3.34', + 'TAP::Parser::Source' => '3.34', + 'TAP::Parser::SourceHandler'=> '3.34', + 'TAP::Parser::SourceHandler::Executable'=> '3.34', + 'TAP::Parser::SourceHandler::File'=> '3.34', + 'TAP::Parser::SourceHandler::Handle'=> '3.34', + 'TAP::Parser::SourceHandler::Perl'=> '3.34', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.34', + 'TAP::Parser::YAMLish::Reader'=> '3.34', + 'TAP::Parser::YAMLish::Writer'=> '3.34', + 'Test::Builder' => '1.301001_075', + 'Test::Builder::Module' => '1.301001_075', + 'Test::Builder::Tester' => '1.301001_075', + 'Test::Builder::Tester::Color'=> '1.301001_075', + 'Test::Harness' => '3.34', + 'Test::More' => '1.301001_075', + 'Test::More::DeepCheck' => undef, + 'Test::More::DeepCheck::Strict'=> undef, + 'Test::More::DeepCheck::Tolerant'=> undef, + 'Test::More::Tools' => undef, + 'Test::MostlyLike' => undef, + 'Test::Simple' => '1.301001_075', + 'Test::Stream' => '1.301001_075', + 'Test::Stream::ArrayBase'=> undef, + 'Test::Stream::ArrayBase::Meta'=> undef, + 'Test::Stream::Carp' => undef, + 'Test::Stream::Context' => undef, + 'Test::Stream::Event' => undef, + 'Test::Stream::Event::Bail'=> undef, + 'Test::Stream::Event::Child'=> undef, + 'Test::Stream::Event::Diag'=> undef, + 'Test::Stream::Event::Finish'=> undef, + 'Test::Stream::Event::Note'=> undef, + 'Test::Stream::Event::Ok'=> undef, + 'Test::Stream::Event::Plan'=> undef, + 'Test::Stream::Event::Subtest'=> undef, + 'Test::Stream::ExitMagic'=> undef, + 'Test::Stream::ExitMagic::Context'=> undef, + 'Test::Stream::Exporter'=> undef, + 'Test::Stream::Exporter::Meta'=> undef, + 'Test::Stream::IOSets' => undef, + 'Test::Stream::Meta' => undef, + 'Test::Stream::PackageUtil'=> undef, + 'Test::Stream::Tester' => undef, + 'Test::Stream::Tester::Checks'=> undef, + 'Test::Stream::Tester::Checks::Event'=> undef, + 'Test::Stream::Tester::Events'=> undef, + 'Test::Stream::Tester::Events::Event'=> undef, + 'Test::Stream::Tester::Grab'=> undef, + 'Test::Stream::Threads' => undef, + 'Test::Stream::Toolset' => undef, + 'Test::Stream::Util' => undef, + 'Test::Tester' => '1.301001_075', + 'Test::Tester::Capture' => undef, + 'Test::use::ok' => '1.301001_075', + 'Unicode::UCD' => '0.59', + 'XS::APItest' => '0.68', + 'XSLoader' => '0.19', + 'experimental' => '0.013', + 'locale' => '1.05', + 'ok' => '1.301001_075', + 'overload' => '1.24', + 're' => '0.28', + 'warnings' => '1.29', + }, + removed => { + } + }, + 5.021007 => { + delta_from => 5.021006, + changed => { + 'Archive::Tar' => '2.04', + 'Archive::Tar::Constant'=> '2.04', + 'Archive::Tar::File' => '2.04', + 'B' => '1.54', + 'B::Concise' => '0.996', + 'B::Deparse' => '1.31', + 'B::Op_private' => '5.021007', + 'B::Showlex' => '1.05', + 'Compress::Raw::Bzip2' => '2.067', + 'Compress::Raw::Zlib' => '2.067', + 'Compress::Zlib' => '2.067', + 'Config' => '5.021007', + 'Cwd' => '3.54', + 'DB_File' => '1.834', + 'Data::Dumper' => '2.155', + 'Devel::PPPort' => '3.25', + 'Devel::Peek' => '1.20', + 'DynaLoader' => '1.29', + 'Encode' => '2.67', + 'Errno' => '1.22', + 'ExtUtils::CBuilder' => '0.280221', + 'ExtUtils::CBuilder::Base'=> '0.280221', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280221', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280221', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280221', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280221', + 'ExtUtils::CBuilder::Platform::android'=> '0.280221', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280221', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280221', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280221', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280221', + 'ExtUtils::Command::MM' => '7.04', + 'ExtUtils::Liblist' => '7.04', + 'ExtUtils::Liblist::Kid'=> '7.04', + 'ExtUtils::MM' => '7.04', + 'ExtUtils::MM_AIX' => '7.04', + 'ExtUtils::MM_Any' => '7.04', + 'ExtUtils::MM_BeOS' => '7.04', + 'ExtUtils::MM_Cygwin' => '7.04', + 'ExtUtils::MM_DOS' => '7.04', + 'ExtUtils::MM_Darwin' => '7.04', + 'ExtUtils::MM_MacOS' => '7.04', + 'ExtUtils::MM_NW5' => '7.04', + 'ExtUtils::MM_OS2' => '7.04', + 'ExtUtils::MM_QNX' => '7.04', + 'ExtUtils::MM_UWIN' => '7.04', + 'ExtUtils::MM_Unix' => '7.04', + 'ExtUtils::MM_VMS' => '7.04', + 'ExtUtils::MM_VOS' => '7.04', + 'ExtUtils::MM_Win32' => '7.04', + 'ExtUtils::MM_Win95' => '7.04', + 'ExtUtils::MY' => '7.04', + 'ExtUtils::MakeMaker' => '7.04', + 'ExtUtils::MakeMaker::Config'=> '7.04', + 'ExtUtils::MakeMaker::Locale'=> '7.04', + 'ExtUtils::MakeMaker::version'=> '7.04', + 'ExtUtils::MakeMaker::version::regex'=> '7.04', + 'ExtUtils::MakeMaker::version::vpp'=> '7.04', + 'ExtUtils::Mkbootstrap' => '7.04', + 'ExtUtils::Mksymlists' => '7.04', + 'ExtUtils::ParseXS' => '3.27', + 'ExtUtils::ParseXS::Constants'=> '3.27', + 'ExtUtils::ParseXS::CountLines'=> '3.27', + 'ExtUtils::ParseXS::Eval'=> '3.27', + 'ExtUtils::ParseXS::Utilities'=> '3.27', + 'ExtUtils::testlib' => '7.04', + 'File::Spec' => '3.53', + 'File::Spec::Cygwin' => '3.54', + 'File::Spec::Epoc' => '3.54', + 'File::Spec::Functions' => '3.54', + 'File::Spec::Mac' => '3.54', + 'File::Spec::OS2' => '3.54', + 'File::Spec::Unix' => '3.54', + 'File::Spec::VMS' => '3.54', + 'File::Spec::Win32' => '3.54', + 'Filter::Util::Call' => '1.51', + 'HTTP::Tiny' => '0.053', + 'IO' => '1.35', + 'IO::Compress::Adapter::Bzip2'=> '2.067', + 'IO::Compress::Adapter::Deflate'=> '2.067', + 'IO::Compress::Adapter::Identity'=> '2.067', + 'IO::Compress::Base' => '2.067', + 'IO::Compress::Base::Common'=> '2.067', + 'IO::Compress::Bzip2' => '2.067', + 'IO::Compress::Deflate' => '2.067', + 'IO::Compress::Gzip' => '2.067', + 'IO::Compress::Gzip::Constants'=> '2.067', + 'IO::Compress::RawDeflate'=> '2.067', + 'IO::Compress::Zip' => '2.067', + 'IO::Compress::Zip::Constants'=> '2.067', + 'IO::Compress::Zlib::Constants'=> '2.067', + 'IO::Compress::Zlib::Extra'=> '2.067', + 'IO::Socket::IP' => '0.34', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.067', + 'IO::Uncompress::Adapter::Identity'=> '2.067', + 'IO::Uncompress::Adapter::Inflate'=> '2.067', + 'IO::Uncompress::AnyInflate'=> '2.067', + 'IO::Uncompress::AnyUncompress'=> '2.067', + 'IO::Uncompress::Base' => '2.067', + 'IO::Uncompress::Bunzip2'=> '2.067', + 'IO::Uncompress::Gunzip'=> '2.067', + 'IO::Uncompress::Inflate'=> '2.067', + 'IO::Uncompress::RawInflate'=> '2.067', + 'IO::Uncompress::Unzip' => '2.067', + 'Locale::Codes' => '3.33', + 'Locale::Codes::Constants'=> '3.33', + 'Locale::Codes::Country'=> '3.33', + 'Locale::Codes::Country_Codes'=> '3.33', + 'Locale::Codes::Country_Retired'=> '3.33', + 'Locale::Codes::Currency'=> '3.33', + 'Locale::Codes::Currency_Codes'=> '3.33', + 'Locale::Codes::Currency_Retired'=> '3.33', + 'Locale::Codes::LangExt'=> '3.33', + 'Locale::Codes::LangExt_Codes'=> '3.33', + 'Locale::Codes::LangExt_Retired'=> '3.33', + 'Locale::Codes::LangFam'=> '3.33', + 'Locale::Codes::LangFam_Codes'=> '3.33', + 'Locale::Codes::LangFam_Retired'=> '3.33', + 'Locale::Codes::LangVar'=> '3.33', + 'Locale::Codes::LangVar_Codes'=> '3.33', + 'Locale::Codes::LangVar_Retired'=> '3.33', + 'Locale::Codes::Language'=> '3.33', + 'Locale::Codes::Language_Codes'=> '3.33', + 'Locale::Codes::Language_Retired'=> '3.33', + 'Locale::Codes::Script' => '3.33', + 'Locale::Codes::Script_Codes'=> '3.33', + 'Locale::Codes::Script_Retired'=> '3.33', + 'Locale::Country' => '3.33', + 'Locale::Currency' => '3.33', + 'Locale::Language' => '3.33', + 'Locale::Maketext' => '1.26', + 'Locale::Script' => '3.33', + 'Module::CoreList' => '5.20141220', + 'Module::CoreList::TieHashDelta'=> '5.20141220', + 'Module::CoreList::Utils'=> '5.20141220', + 'NDBM_File' => '1.14', + 'Net::Cmd' => '3.04', + 'Net::Config' => '3.04', + 'Net::Domain' => '3.04', + 'Net::FTP' => '3.04', + 'Net::FTP::A' => '3.04', + 'Net::FTP::E' => '3.04', + 'Net::FTP::I' => '3.04', + 'Net::FTP::L' => '3.04', + 'Net::FTP::dataconn' => '3.04', + 'Net::NNTP' => '3.04', + 'Net::Netrc' => '3.04', + 'Net::POP3' => '3.04', + 'Net::SMTP' => '3.04', + 'Net::Time' => '3.04', + 'Opcode' => '1.30', + 'POSIX' => '1.48', + 'PerlIO::scalar' => '0.21', + 'Pod::Escapes' => '1.07', + 'SDBM_File' => '1.12', + 'Storable' => '2.52', + 'Sys::Hostname' => '1.20', + 'Test::Builder' => '1.301001_090', + 'Test::Builder::Module' => '1.301001_090', + 'Test::Builder::Tester' => '1.301001_090', + 'Test::Builder::Tester::Color'=> '1.301001_090', + 'Test::CanFork' => undef, + 'Test::CanThread' => undef, + 'Test::More' => '1.301001_090', + 'Test::Simple' => '1.301001_090', + 'Test::Stream' => '1.301001_090', + 'Test::Stream::API' => undef, + 'Test::Stream::ForceExit'=> undef, + 'Test::Stream::Subtest' => undef, + 'Test::Tester' => '1.301001_090', + 'Test::use::ok' => '1.301001_090', + 'Unicode::Collate' => '1.09', + 'Unicode::Collate::CJK::Big5'=> '1.09', + 'Unicode::Collate::CJK::GB2312'=> '1.09', + 'Unicode::Collate::CJK::JISX0208'=> '1.09', + 'Unicode::Collate::CJK::Korean'=> '1.09', + 'Unicode::Collate::CJK::Pinyin'=> '1.09', + 'Unicode::Collate::CJK::Stroke'=> '1.09', + 'Unicode::Collate::CJK::Zhuyin'=> '1.09', + 'Unicode::Collate::Locale'=> '1.09', + 'XS::APItest' => '0.69', + 'XSLoader' => '0.20', + '_charnames' => '1.43', + 'arybase' => '0.09', + 'charnames' => '1.43', + 'feature' => '1.39', + 'mro' => '1.17', + 'ok' => '1.301001_090', + 'strict' => '1.09', + 'threads' => '1.96_001', + }, + removed => { + } + }, + 5.021008 => { + delta_from => 5.021007, + changed => { + 'App::Prove' => '3.35', + 'App::Prove::State' => '3.35', + 'App::Prove::State::Result'=> '3.35', + 'App::Prove::State::Result::Test'=> '3.35', + 'B' => '1.55', + 'B::Deparse' => '1.32', + 'B::Op_private' => '5.021008', + 'CPAN::Meta::Requirements'=> '2.131', + 'Compress::Raw::Bzip2' => '2.068', + 'Compress::Raw::Zlib' => '2.068', + 'Compress::Zlib' => '2.068', + 'Config' => '5.021008', + 'DB_File' => '1.835', + 'Data::Dumper' => '2.156', + 'Devel::PPPort' => '3.28', + 'Devel::Peek' => '1.21', + 'Digest::MD5' => '2.54', + 'Digest::SHA' => '5.95', + 'DynaLoader' => '1.30', + 'ExtUtils::Command' => '1.20', + 'ExtUtils::Manifest' => '1.70', + 'Fatal' => '2.26', + 'File::Glob' => '1.24', + 'Filter::Util::Call' => '1.54', + 'Getopt::Long' => '2.43', + 'IO::Compress::Adapter::Bzip2'=> '2.068', + 'IO::Compress::Adapter::Deflate'=> '2.068', + 'IO::Compress::Adapter::Identity'=> '2.068', + 'IO::Compress::Base' => '2.068', + 'IO::Compress::Base::Common'=> '2.068', + 'IO::Compress::Bzip2' => '2.068', + 'IO::Compress::Deflate' => '2.068', + 'IO::Compress::Gzip' => '2.068', + 'IO::Compress::Gzip::Constants'=> '2.068', + 'IO::Compress::RawDeflate'=> '2.068', + 'IO::Compress::Zip' => '2.068', + 'IO::Compress::Zip::Constants'=> '2.068', + 'IO::Compress::Zlib::Constants'=> '2.068', + 'IO::Compress::Zlib::Extra'=> '2.068', + 'IO::Socket::IP' => '0.36', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.068', + 'IO::Uncompress::Adapter::Identity'=> '2.068', + 'IO::Uncompress::Adapter::Inflate'=> '2.068', + 'IO::Uncompress::AnyInflate'=> '2.068', + 'IO::Uncompress::AnyUncompress'=> '2.068', + 'IO::Uncompress::Base' => '2.068', + 'IO::Uncompress::Bunzip2'=> '2.068', + 'IO::Uncompress::Gunzip'=> '2.068', + 'IO::Uncompress::Inflate'=> '2.068', + 'IO::Uncompress::RawInflate'=> '2.068', + 'IO::Uncompress::Unzip' => '2.068', + 'MIME::Base64' => '3.15', + 'Module::CoreList' => '5.20150220', + 'Module::CoreList::TieHashDelta'=> '5.20150220', + 'Module::CoreList::Utils'=> '5.20150220', + 'Module::Load::Conditional'=> '0.64', + 'Module::Metadata' => '1.000026', + 'Net::Cmd' => '3.05', + 'Net::Config' => '3.05', + 'Net::Domain' => '3.05', + 'Net::FTP' => '3.05', + 'Net::FTP::A' => '3.05', + 'Net::FTP::E' => '3.05', + 'Net::FTP::I' => '3.05', + 'Net::FTP::L' => '3.05', + 'Net::FTP::dataconn' => '3.05', + 'Net::NNTP' => '3.05', + 'Net::Netrc' => '3.05', + 'Net::POP3' => '3.05', + 'Net::SMTP' => '3.05', + 'Net::Time' => '3.05', + 'Opcode' => '1.31', + 'POSIX' => '1.49', + 'PerlIO::encoding' => '0.21', + 'Pod::Simple' => '3.29', + 'Pod::Simple::BlackBox' => '3.29', + 'Pod::Simple::Checker' => '3.29', + 'Pod::Simple::Debug' => '3.29', + 'Pod::Simple::DumpAsText'=> '3.29', + 'Pod::Simple::DumpAsXML'=> '3.29', + 'Pod::Simple::HTML' => '3.29', + 'Pod::Simple::HTMLBatch'=> '3.29', + 'Pod::Simple::LinkSection'=> '3.29', + 'Pod::Simple::Methody' => '3.29', + 'Pod::Simple::Progress' => '3.29', + 'Pod::Simple::PullParser'=> '3.29', + 'Pod::Simple::PullParserEndToken'=> '3.29', + 'Pod::Simple::PullParserStartToken'=> '3.29', + 'Pod::Simple::PullParserTextToken'=> '3.29', + 'Pod::Simple::PullParserToken'=> '3.29', + 'Pod::Simple::RTF' => '3.29', + 'Pod::Simple::Search' => '3.29', + 'Pod::Simple::SimpleTree'=> '3.29', + 'Pod::Simple::Text' => '3.29', + 'Pod::Simple::TextContent'=> '3.29', + 'Pod::Simple::TiedOutFH'=> '3.29', + 'Pod::Simple::Transcode'=> '3.29', + 'Pod::Simple::TranscodeDumb'=> '3.29', + 'Pod::Simple::TranscodeSmart'=> '3.29', + 'Pod::Simple::XHTML' => '3.29', + 'Pod::Simple::XMLOutStream'=> '3.29', + 'SDBM_File' => '1.13', + 'Safe' => '2.39', + 'TAP::Base' => '3.35', + 'TAP::Formatter::Base' => '3.35', + 'TAP::Formatter::Color' => '3.35', + 'TAP::Formatter::Console'=> '3.35', + 'TAP::Formatter::Console::ParallelSession'=> '3.35', + 'TAP::Formatter::Console::Session'=> '3.35', + 'TAP::Formatter::File' => '3.35', + 'TAP::Formatter::File::Session'=> '3.35', + 'TAP::Formatter::Session'=> '3.35', + 'TAP::Harness' => '3.35', + 'TAP::Harness::Env' => '3.35', + 'TAP::Object' => '3.35', + 'TAP::Parser' => '3.35', + 'TAP::Parser::Aggregator'=> '3.35', + 'TAP::Parser::Grammar' => '3.35', + 'TAP::Parser::Iterator' => '3.35', + 'TAP::Parser::Iterator::Array'=> '3.35', + 'TAP::Parser::Iterator::Process'=> '3.35', + 'TAP::Parser::Iterator::Stream'=> '3.35', + 'TAP::Parser::IteratorFactory'=> '3.35', + 'TAP::Parser::Multiplexer'=> '3.35', + 'TAP::Parser::Result' => '3.35', + 'TAP::Parser::Result::Bailout'=> '3.35', + 'TAP::Parser::Result::Comment'=> '3.35', + 'TAP::Parser::Result::Plan'=> '3.35', + 'TAP::Parser::Result::Pragma'=> '3.35', + 'TAP::Parser::Result::Test'=> '3.35', + 'TAP::Parser::Result::Unknown'=> '3.35', + 'TAP::Parser::Result::Version'=> '3.35', + 'TAP::Parser::Result::YAML'=> '3.35', + 'TAP::Parser::ResultFactory'=> '3.35', + 'TAP::Parser::Scheduler'=> '3.35', + 'TAP::Parser::Scheduler::Job'=> '3.35', + 'TAP::Parser::Scheduler::Spinner'=> '3.35', + 'TAP::Parser::Source' => '3.35', + 'TAP::Parser::SourceHandler'=> '3.35', + 'TAP::Parser::SourceHandler::Executable'=> '3.35', + 'TAP::Parser::SourceHandler::File'=> '3.35', + 'TAP::Parser::SourceHandler::Handle'=> '3.35', + 'TAP::Parser::SourceHandler::Perl'=> '3.35', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.35', + 'TAP::Parser::YAMLish::Reader'=> '3.35', + 'TAP::Parser::YAMLish::Writer'=> '3.35', + 'Test::Builder' => '1.301001_097', + 'Test::Builder::Module' => '1.301001_097', + 'Test::Builder::Tester' => '1.301001_097', + 'Test::Builder::Tester::Color'=> '1.301001_097', + 'Test::Harness' => '3.35', + 'Test::More' => '1.301001_097', + 'Test::Simple' => '1.301001_097', + 'Test::Stream' => '1.301001_097', + 'Test::Stream::Block' => undef, + 'Test::Tester' => '1.301001_097', + 'Test::Tester::CaptureRunner'=> undef, + 'Test::Tester::Delegate'=> undef, + 'Test::use::ok' => '1.301001_097', + 'Unicode::Collate' => '1.10', + 'Unicode::Collate::CJK::Big5'=> '1.10', + 'Unicode::Collate::CJK::GB2312'=> '1.10', + 'Unicode::Collate::CJK::JISX0208'=> '1.10', + 'Unicode::Collate::CJK::Korean'=> '1.10', + 'Unicode::Collate::CJK::Pinyin'=> '1.10', + 'Unicode::Collate::CJK::Stroke'=> '1.10', + 'Unicode::Collate::CJK::Zhuyin'=> '1.10', + 'Unicode::Collate::Locale'=> '1.10', + 'VMS::DCLsym' => '1.06', + 'XS::APItest' => '0.70', + 'arybase' => '0.10', + 'attributes' => '0.25', + 'autodie' => '2.26', + 'autodie::Scope::Guard' => '2.26', + 'autodie::Scope::GuardStack'=> '2.26', + 'autodie::ScopeUtil' => '2.26', + 'autodie::exception' => '2.26', + 'autodie::exception::system'=> '2.26', + 'autodie::hints' => '2.26', + 'autodie::skip' => '2.26', + 'ok' => '1.301001_097', + 're' => '0.30', + 'warnings' => '1.30', + }, + removed => { + } + }, + 5.020002 => { + delta_from => 5.020001, + changed => { + 'CPAN::Author' => '5.5002', + 'CPAN::CacheMgr' => '5.5002', + 'CPAN::FTP' => '5.5006', + 'CPAN::HTTP::Client' => '1.9601', + 'CPAN::HandleConfig' => '5.5005', + 'CPAN::Index' => '1.9601', + 'CPAN::LWP::UserAgent' => '1.9601', + 'CPAN::Mirrors' => '1.9601', + 'Config' => '5.020002', + 'Cwd' => '3.48_01', + 'Data::Dumper' => '2.151_01', + 'Errno' => '1.20_05', + 'File::Spec' => '3.48_01', + 'File::Spec::Cygwin' => '3.48_01', + 'File::Spec::Epoc' => '3.48_01', + 'File::Spec::Functions' => '3.48_01', + 'File::Spec::Mac' => '3.48_01', + 'File::Spec::OS2' => '3.48_01', + 'File::Spec::Unix' => '3.48_01', + 'File::Spec::VMS' => '3.48_01', + 'File::Spec::Win32' => '3.48_01', + 'IO::Socket' => '1.38', + 'Module::CoreList' => '5.20150214', + 'Module::CoreList::TieHashDelta'=> '5.20150214', + 'Module::CoreList::Utils'=> '5.20150214', + 'PerlIO::scalar' => '0.18_01', + 'Pod::PlainText' => '2.07', + 'Storable' => '2.49_01', + 'VMS::DCLsym' => '1.05_01', + 'VMS::Stdio' => '2.41', + 'attributes' => '0.23', + 'feature' => '1.36_01', + }, + removed => { + } + }, + 5.021009 => { + delta_from => 5.021008, + changed => { + 'B' => '1.56', + 'B::Debug' => '1.23', + 'B::Deparse' => '1.33', + 'B::Op_private' => '5.021009', + 'Benchmark' => '1.20', + 'CPAN::Author' => '5.5002', + 'CPAN::CacheMgr' => '5.5002', + 'CPAN::FTP' => '5.5006', + 'CPAN::HTTP::Client' => '1.9601', + 'CPAN::HandleConfig' => '5.5005', + 'CPAN::Index' => '1.9601', + 'CPAN::LWP::UserAgent' => '1.9601', + 'CPAN::Meta::Requirements'=> '2.132', + 'CPAN::Mirrors' => '1.9601', + 'Carp' => '1.35', + 'Carp::Heavy' => '1.35', + 'Config' => '5.021009', + 'Config::Perl::V' => '0.23', + 'Data::Dumper' => '2.157', + 'Devel::Peek' => '1.22', + 'DynaLoader' => '1.31', + 'Encode' => '2.70', + 'Encode::MIME::Header' => '2.16', + 'Errno' => '1.23', + 'ExtUtils::Miniperl' => '1.04', + 'HTTP::Tiny' => '0.054', + 'Module::CoreList' => '5.20150220', + 'Module::CoreList::TieHashDelta'=> '5.20150220', + 'Module::CoreList::Utils'=> '5.20150220', + 'Opcode' => '1.32', + 'POSIX' => '1.51', + 'Perl::OSType' => '1.008', + 'PerlIO::scalar' => '0.22', + 'Pod::Find' => '1.63', + 'Pod::InputObjects' => '1.63', + 'Pod::ParseUtils' => '1.63', + 'Pod::Parser' => '1.63', + 'Pod::Perldoc' => '3.25', + 'Pod::Perldoc::BaseTo' => '3.25', + 'Pod::Perldoc::GetOptsOO'=> '3.25', + 'Pod::Perldoc::ToANSI' => '3.25', + 'Pod::Perldoc::ToChecker'=> '3.25', + 'Pod::Perldoc::ToMan' => '3.25', + 'Pod::Perldoc::ToNroff' => '3.25', + 'Pod::Perldoc::ToPod' => '3.25', + 'Pod::Perldoc::ToRtf' => '3.25', + 'Pod::Perldoc::ToTerm' => '3.25', + 'Pod::Perldoc::ToText' => '3.25', + 'Pod::Perldoc::ToTk' => '3.25', + 'Pod::Perldoc::ToXml' => '3.25', + 'Pod::PlainText' => '2.07', + 'Pod::Select' => '1.63', + 'Socket' => '2.018', + 'Storable' => '2.53', + 'Test::Builder' => '1.301001_098', + 'Test::Builder::Module' => '1.301001_098', + 'Test::Builder::Tester' => '1.301001_098', + 'Test::Builder::Tester::Color'=> '1.301001_098', + 'Test::More' => '1.301001_098', + 'Test::Simple' => '1.301001_098', + 'Test::Stream' => '1.301001_098', + 'Test::Tester' => '1.301001_098', + 'Test::use::ok' => '1.301001_098', + 'Unicode::Collate' => '1.11', + 'Unicode::Collate::CJK::Big5'=> '1.11', + 'Unicode::Collate::CJK::GB2312'=> '1.11', + 'Unicode::Collate::CJK::JISX0208'=> '1.11', + 'Unicode::Collate::CJK::Korean'=> '1.11', + 'Unicode::Collate::CJK::Pinyin'=> '1.11', + 'Unicode::Collate::CJK::Stroke'=> '1.11', + 'Unicode::Collate::CJK::Zhuyin'=> '1.11', + 'Unicode::Collate::Locale'=> '1.11', + 'Unicode::UCD' => '0.61', + 'VMS::Stdio' => '2.41', + 'Win32' => '0.51', + 'Win32API::File' => '0.1202', + 'attributes' => '0.26', + 'bigint' => '0.39', + 'bignum' => '0.39', + 'bigrat' => '0.39', + 'constant' => '1.33', + 'encoding' => '2.13', + 'feature' => '1.40', + 'ok' => '1.301001_098', + 'overload' => '1.25', + 'perlfaq' => '5.021009', + 're' => '0.31', + 'threads::shared' => '1.48', + 'warnings' => '1.31', + }, + removed => { + } + }, + 5.021010 => { + delta_from => 5.021009, + changed => { + 'App::Cpan' => '1.63', + 'B' => '1.57', + 'B::Deparse' => '1.34', + 'B::Op_private' => '5.021010', + 'Benchmark' => '1.2', + 'CPAN' => '2.10', + 'CPAN::Distribution' => '2.04', + 'CPAN::FirstTime' => '5.5307', + 'CPAN::HTTP::Credentials'=> '1.9601', + 'CPAN::HandleConfig' => '5.5006', + 'CPAN::Meta' => '2.150001', + 'CPAN::Meta::Converter' => '2.150001', + 'CPAN::Meta::Feature' => '2.150001', + 'CPAN::Meta::History' => '2.150001', + 'CPAN::Meta::Merge' => '2.150001', + 'CPAN::Meta::Prereqs' => '2.150001', + 'CPAN::Meta::Spec' => '2.150001', + 'CPAN::Meta::Validator' => '2.150001', + 'CPAN::Module' => '5.5002', + 'CPAN::Plugin' => '0.95', + 'CPAN::Plugin::Specfile'=> '0.01', + 'CPAN::Shell' => '5.5005', + 'Carp' => '1.36', + 'Carp::Heavy' => '1.36', + 'Config' => '5.02101', + 'Cwd' => '3.55', + 'DB' => '1.08', + 'Data::Dumper' => '2.158', + 'Devel::PPPort' => '3.31', + 'DynaLoader' => '1.32', + 'Encode' => '2.72', + 'Encode::Alias' => '2.19', + 'File::Spec' => '3.55', + 'File::Spec::Cygwin' => '3.55', + 'File::Spec::Epoc' => '3.55', + 'File::Spec::Functions' => '3.55', + 'File::Spec::Mac' => '3.55', + 'File::Spec::OS2' => '3.55', + 'File::Spec::Unix' => '3.55', + 'File::Spec::VMS' => '3.55', + 'File::Spec::Win32' => '3.55', + 'Getopt::Long' => '2.45', + 'Locale::Codes' => '3.34', + 'Locale::Codes::Constants'=> '3.34', + 'Locale::Codes::Country'=> '3.34', + 'Locale::Codes::Country_Codes'=> '3.34', + 'Locale::Codes::Country_Retired'=> '3.34', + 'Locale::Codes::Currency'=> '3.34', + 'Locale::Codes::Currency_Codes'=> '3.34', + 'Locale::Codes::Currency_Retired'=> '3.34', + 'Locale::Codes::LangExt'=> '3.34', + 'Locale::Codes::LangExt_Codes'=> '3.34', + 'Locale::Codes::LangExt_Retired'=> '3.34', + 'Locale::Codes::LangFam'=> '3.34', + 'Locale::Codes::LangFam_Codes'=> '3.34', + 'Locale::Codes::LangFam_Retired'=> '3.34', + 'Locale::Codes::LangVar'=> '3.34', + 'Locale::Codes::LangVar_Codes'=> '3.34', + 'Locale::Codes::LangVar_Retired'=> '3.34', + 'Locale::Codes::Language'=> '3.34', + 'Locale::Codes::Language_Codes'=> '3.34', + 'Locale::Codes::Language_Retired'=> '3.34', + 'Locale::Codes::Script' => '3.34', + 'Locale::Codes::Script_Codes'=> '3.34', + 'Locale::Codes::Script_Retired'=> '3.34', + 'Locale::Country' => '3.34', + 'Locale::Currency' => '3.34', + 'Locale::Language' => '3.34', + 'Locale::Script' => '3.34', + 'Module::CoreList' => '5.20150320', + 'Module::CoreList::TieHashDelta'=> '5.20150320', + 'Module::CoreList::Utils'=> '5.20150320', + 'POSIX' => '1.52', + 'Pod::Functions' => '1.09', + 'Pod::Functions::Functions'=> '1.09', + 'Term::Complete' => '1.403', + 'Test::Builder' => '1.001014', + 'Test::Builder::IO::Scalar'=> '2.113', + 'Test::Builder::Module' => '1.001014', + 'Test::Builder::Tester' => '1.28', + 'Test::Builder::Tester::Color'=> '1.290001', + 'Test::More' => '1.001014', + 'Test::Simple' => '1.001014', + 'Test::Tester' => '0.114', + 'Test::use::ok' => '0.16', + 'Text::Balanced' => '2.03', + 'Text::ParseWords' => '3.30', + 'Unicode::Collate' => '1.12', + 'Unicode::Collate::CJK::Big5'=> '1.12', + 'Unicode::Collate::CJK::GB2312'=> '1.12', + 'Unicode::Collate::CJK::JISX0208'=> '1.12', + 'Unicode::Collate::CJK::Korean'=> '1.12', + 'Unicode::Collate::CJK::Pinyin'=> '1.12', + 'Unicode::Collate::CJK::Stroke'=> '1.12', + 'Unicode::Collate::CJK::Zhuyin'=> '1.12', + 'Unicode::Collate::Locale'=> '1.12', + 'XS::APItest' => '0.71', + 'encoding' => '2.14', + 'locale' => '1.06', + 'meta_notation' => undef, + 'ok' => '0.16', + 'parent' => '0.232', + 're' => '0.32', + 'sigtrap' => '1.08', + 'threads' => '2.01', + 'utf8' => '1.15', + }, + removed => { + 'Test::CanFork' => 1, + 'Test::CanThread' => 1, + 'Test::More::DeepCheck' => 1, + 'Test::More::DeepCheck::Strict'=> 1, + 'Test::More::DeepCheck::Tolerant'=> 1, + 'Test::More::Tools' => 1, + 'Test::MostlyLike' => 1, + 'Test::Stream' => 1, + 'Test::Stream::API' => 1, + 'Test::Stream::ArrayBase'=> 1, + 'Test::Stream::ArrayBase::Meta'=> 1, + 'Test::Stream::Block' => 1, + 'Test::Stream::Carp' => 1, + 'Test::Stream::Context' => 1, + 'Test::Stream::Event' => 1, + 'Test::Stream::Event::Bail'=> 1, + 'Test::Stream::Event::Child'=> 1, + 'Test::Stream::Event::Diag'=> 1, + 'Test::Stream::Event::Finish'=> 1, + 'Test::Stream::Event::Note'=> 1, + 'Test::Stream::Event::Ok'=> 1, + 'Test::Stream::Event::Plan'=> 1, + 'Test::Stream::Event::Subtest'=> 1, + 'Test::Stream::ExitMagic'=> 1, + 'Test::Stream::ExitMagic::Context'=> 1, + 'Test::Stream::Exporter'=> 1, + 'Test::Stream::Exporter::Meta'=> 1, + 'Test::Stream::ForceExit'=> 1, + 'Test::Stream::IOSets' => 1, + 'Test::Stream::Meta' => 1, + 'Test::Stream::PackageUtil'=> 1, + 'Test::Stream::Subtest' => 1, + 'Test::Stream::Tester' => 1, + 'Test::Stream::Tester::Checks'=> 1, + 'Test::Stream::Tester::Checks::Event'=> 1, + 'Test::Stream::Tester::Events'=> 1, + 'Test::Stream::Tester::Events::Event'=> 1, + 'Test::Stream::Tester::Grab'=> 1, + 'Test::Stream::Threads' => 1, + 'Test::Stream::Toolset' => 1, + 'Test::Stream::Util' => 1, + } + }, + 5.021011 => { + delta_from => 5.021010, + changed => { + 'B' => '1.58', + 'B::Deparse' => '1.35', + 'B::Op_private' => '5.021011', + 'CPAN' => '2.11', + 'Config' => '5.021011', + 'Config::Perl::V' => '0.24', + 'Cwd' => '3.56', + 'ExtUtils::Miniperl' => '1.05', + 'ExtUtils::ParseXS' => '3.28', + 'ExtUtils::ParseXS::Constants'=> '3.28', + 'ExtUtils::ParseXS::CountLines'=> '3.28', + 'ExtUtils::ParseXS::Eval'=> '3.28', + 'ExtUtils::ParseXS::Utilities'=> '3.28', + 'ExtUtils::Typemaps' => '3.28', + 'ExtUtils::Typemaps::Cmd'=> '3.28', + 'ExtUtils::Typemaps::InputMap'=> '3.28', + 'ExtUtils::Typemaps::OutputMap'=> '3.28', + 'ExtUtils::Typemaps::Type'=> '3.28', + 'File::Spec' => '3.56', + 'File::Spec::Cygwin' => '3.56', + 'File::Spec::Epoc' => '3.56', + 'File::Spec::Functions' => '3.56', + 'File::Spec::Mac' => '3.56', + 'File::Spec::OS2' => '3.56', + 'File::Spec::Unix' => '3.56', + 'File::Spec::VMS' => '3.56', + 'File::Spec::Win32' => '3.56', + 'IO::Socket::IP' => '0.37', + 'Module::CoreList' => '5.20150420', + 'Module::CoreList::TieHashDelta'=> '5.20150420', + 'Module::CoreList::Utils'=> '5.20150420', + 'PerlIO::mmap' => '0.014', + 'XS::APItest' => '0.72', + 'attributes' => '0.27', + 'if' => '0.0604', + 'utf8' => '1.16', + 'warnings' => '1.32', + }, + removed => { + } + }, + 5.022000 => { + delta_from => 5.021011, + changed => { + 'B::Op_private' => '5.022000', + 'Config' => '5.022', + 'ExtUtils::Command::MM' => '7.04_01', + 'ExtUtils::Liblist' => '7.04_01', + 'ExtUtils::Liblist::Kid'=> '7.04_01', + 'ExtUtils::MM' => '7.04_01', + 'ExtUtils::MM_AIX' => '7.04_01', + 'ExtUtils::MM_Any' => '7.04_01', + 'ExtUtils::MM_BeOS' => '7.04_01', + 'ExtUtils::MM_Cygwin' => '7.04_01', + 'ExtUtils::MM_DOS' => '7.04_01', + 'ExtUtils::MM_Darwin' => '7.04_01', + 'ExtUtils::MM_MacOS' => '7.04_01', + 'ExtUtils::MM_NW5' => '7.04_01', + 'ExtUtils::MM_OS2' => '7.04_01', + 'ExtUtils::MM_QNX' => '7.04_01', + 'ExtUtils::MM_UWIN' => '7.04_01', + 'ExtUtils::MM_Unix' => '7.04_01', + 'ExtUtils::MM_VMS' => '7.04_01', + 'ExtUtils::MM_VOS' => '7.04_01', + 'ExtUtils::MM_Win32' => '7.04_01', + 'ExtUtils::MM_Win95' => '7.04_01', + 'ExtUtils::MY' => '7.04_01', + 'ExtUtils::MakeMaker' => '7.04_01', + 'ExtUtils::MakeMaker::Config'=> '7.04_01', + 'ExtUtils::MakeMaker::Locale'=> '7.04_01', + 'ExtUtils::MakeMaker::version'=> '7.04_01', + 'ExtUtils::MakeMaker::version::regex'=> '7.04_01', + 'ExtUtils::MakeMaker::version::vpp'=> '7.04_01', + 'ExtUtils::Mkbootstrap' => '7.04_01', + 'ExtUtils::Mksymlists' => '7.04_01', + 'ExtUtils::testlib' => '7.04_01', + 'Module::CoreList' => '5.20150520', + 'Module::CoreList::TieHashDelta'=> '5.20150520', + 'Module::CoreList::Utils'=> '5.20150520', + 'POSIX' => '1.53', + 'PerlIO::via::QuotedPrint'=> '0.08', + 'overload' => '1.26', + 'utf8' => '1.17', + }, + removed => { + } + }, + 5.023000 => { + delta_from => 5.022000, + changed => { + 'B::Op_private' => '5.023000', + 'CPAN::Meta' => '2.150005', + 'CPAN::Meta::Converter' => '2.150005', + 'CPAN::Meta::Feature' => '2.150005', + 'CPAN::Meta::History' => '2.150005', + 'CPAN::Meta::Merge' => '2.150005', + 'CPAN::Meta::Prereqs' => '2.150005', + 'CPAN::Meta::Requirements'=> '2.133', + 'CPAN::Meta::Spec' => '2.150005', + 'CPAN::Meta::Validator' => '2.150005', + 'CPAN::Meta::YAML' => '0.016', + 'Config' => '5.023', + 'Encode' => '2.73', + 'ExtUtils::CBuilder' => '0.280223', + 'ExtUtils::CBuilder::Base'=> '0.280223', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280223', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280223', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280223', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280223', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280223', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280223', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280223', + 'ExtUtils::CBuilder::Platform::android'=> '0.280223', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280223', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280223', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280223', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280223', + 'Fatal' => '2.27', + 'Getopt::Long' => '2.46', + 'HTTP::Tiny' => '0.056', + 'List::Util' => '1.42_01', + 'List::Util::XS' => '1.42_01', + 'Locale::Codes' => '3.35', + 'Locale::Codes::Constants'=> '3.35', + 'Locale::Codes::Country'=> '3.35', + 'Locale::Codes::Country_Codes'=> '3.35', + 'Locale::Codes::Country_Retired'=> '3.35', + 'Locale::Codes::Currency'=> '3.35', + 'Locale::Codes::Currency_Codes'=> '3.35', + 'Locale::Codes::Currency_Retired'=> '3.35', + 'Locale::Codes::LangExt'=> '3.35', + 'Locale::Codes::LangExt_Codes'=> '3.35', + 'Locale::Codes::LangExt_Retired'=> '3.35', + 'Locale::Codes::LangFam'=> '3.35', + 'Locale::Codes::LangFam_Codes'=> '3.35', + 'Locale::Codes::LangFam_Retired'=> '3.35', + 'Locale::Codes::LangVar'=> '3.35', + 'Locale::Codes::LangVar_Codes'=> '3.35', + 'Locale::Codes::LangVar_Retired'=> '3.35', + 'Locale::Codes::Language'=> '3.35', + 'Locale::Codes::Language_Codes'=> '3.35', + 'Locale::Codes::Language_Retired'=> '3.35', + 'Locale::Codes::Script' => '3.35', + 'Locale::Codes::Script_Codes'=> '3.35', + 'Locale::Codes::Script_Retired'=> '3.35', + 'Locale::Country' => '3.35', + 'Locale::Currency' => '3.35', + 'Locale::Language' => '3.35', + 'Locale::Script' => '3.35', + 'Math::BigFloat' => '1.999701', + 'Math::BigInt' => '1.999701', + 'Math::BigInt::Calc' => '1.999701', + 'Math::BigInt::CalcEmu' => '1.999701', + 'Math::BigRat' => '0.260801', + 'Module::CoreList' => '5.20150620', + 'Module::CoreList::TieHashDelta'=> '5.20150620', + 'Module::CoreList::Utils'=> '5.20150620', + 'Module::Metadata' => '1.000027', + 'Net::Cmd' => '3.06', + 'Net::Config' => '3.06', + 'Net::Domain' => '3.06', + 'Net::FTP' => '3.06', + 'Net::FTP::A' => '3.06', + 'Net::FTP::E' => '3.06', + 'Net::FTP::I' => '3.06', + 'Net::FTP::L' => '3.06', + 'Net::FTP::dataconn' => '3.06', + 'Net::NNTP' => '3.06', + 'Net::Netrc' => '3.06', + 'Net::POP3' => '3.06', + 'Net::SMTP' => '3.06', + 'Net::Time' => '3.06', + 'POSIX' => '1.54', + 'Parse::CPAN::Meta' => '1.4417', + 'Pod::Simple' => '3.30', + 'Pod::Simple::BlackBox' => '3.30', + 'Pod::Simple::Checker' => '3.30', + 'Pod::Simple::Debug' => '3.30', + 'Pod::Simple::DumpAsText'=> '3.30', + 'Pod::Simple::DumpAsXML'=> '3.30', + 'Pod::Simple::HTML' => '3.30', + 'Pod::Simple::HTMLBatch'=> '3.30', + 'Pod::Simple::LinkSection'=> '3.30', + 'Pod::Simple::Methody' => '3.30', + 'Pod::Simple::Progress' => '3.30', + 'Pod::Simple::PullParser'=> '3.30', + 'Pod::Simple::PullParserEndToken'=> '3.30', + 'Pod::Simple::PullParserStartToken'=> '3.30', + 'Pod::Simple::PullParserTextToken'=> '3.30', + 'Pod::Simple::PullParserToken'=> '3.30', + 'Pod::Simple::RTF' => '3.30', + 'Pod::Simple::Search' => '3.30', + 'Pod::Simple::SimpleTree'=> '3.30', + 'Pod::Simple::Text' => '3.30', + 'Pod::Simple::TextContent'=> '3.30', + 'Pod::Simple::TiedOutFH'=> '3.30', + 'Pod::Simple::Transcode'=> '3.30', + 'Pod::Simple::TranscodeDumb'=> '3.30', + 'Pod::Simple::TranscodeSmart'=> '3.30', + 'Pod::Simple::XHTML' => '3.30', + 'Pod::Simple::XMLOutStream'=> '3.30', + 'Pod::Usage' => '1.67', + 'Scalar::Util' => '1.42_01', + 'Socket' => '2.019', + 'Sub::Util' => '1.42_01', + 'Time::Piece' => '1.30', + 'Time::Seconds' => '1.30', + 'UNIVERSAL' => '1.13', + 'Unicode' => '8.0.0', + 'XS::APItest' => '0.73', + 'autodie' => '2.27', + 'autodie::Scope::Guard' => '2.27', + 'autodie::Scope::GuardStack'=> '2.27', + 'autodie::Util' => '2.27', + 'autodie::exception' => '2.27', + 'autodie::exception::system'=> '2.27', + 'autodie::hints' => '2.27', + 'autodie::skip' => '2.27', + 'encoding' => '2.15', + 'feature' => '1.41', + 'parent' => '0.234', + 'threads' => '2.02', + }, + removed => { + } + }, + 5.023001 => { + delta_from => 5.023000, + changed => { + 'B::Op_private' => '5.023001', + 'Config' => '5.023001', + 'DynaLoader' => '1.33', + 'Encode' => '2.75', + 'Encode::MIME::Header' => '2.17', + 'Encode::Unicode' => '2.13', + 'Fatal' => '2.29', + 'File::Path' => '2.11', + 'Getopt::Long' => '2.47', + 'I18N::Langinfo' => '0.13', + 'IPC::Open3' => '1.19', + 'Module::CoreList' => '5.20150720', + 'Module::CoreList::TieHashDelta'=> '5.20150720', + 'Module::CoreList::Utils'=> '5.20150720', + 'Net::Cmd' => '3.07', + 'Net::Config' => '3.07', + 'Net::Domain' => '3.07', + 'Net::FTP' => '3.07', + 'Net::FTP::A' => '3.07', + 'Net::FTP::E' => '3.07', + 'Net::FTP::I' => '3.07', + 'Net::FTP::L' => '3.07', + 'Net::FTP::dataconn' => '3.07', + 'Net::NNTP' => '3.07', + 'Net::Netrc' => '3.07', + 'Net::POP3' => '3.07', + 'Net::SMTP' => '3.07', + 'Net::Time' => '3.07', + 'Opcode' => '1.33', + 'POSIX' => '1.55', + 'PerlIO::scalar' => '0.23', + 'Socket' => '2.020', + 'Storable' => '2.54', + 'Unicode::Collate' => '1.14', + 'Unicode::Collate::CJK::Big5'=> '1.14', + 'Unicode::Collate::CJK::GB2312'=> '1.14', + 'Unicode::Collate::CJK::JISX0208'=> '1.14', + 'Unicode::Collate::CJK::Korean'=> '1.14', + 'Unicode::Collate::CJK::Pinyin'=> '1.14', + 'Unicode::Collate::CJK::Stroke'=> '1.14', + 'Unicode::Collate::CJK::Zhuyin'=> '1.14', + 'Unicode::Collate::Locale'=> '1.14', + 'Unicode::Normalize' => '1.19', + 'XS::APItest' => '0.74', + 'XS::Typemap' => '0.14', + 'autodie' => '2.29', + 'autodie::Scope::Guard' => '2.29', + 'autodie::Scope::GuardStack'=> '2.29', + 'autodie::Util' => '2.29', + 'autodie::exception' => '2.29', + 'autodie::exception::system'=> '2.29', + 'autodie::hints' => '2.29', + 'autodie::skip' => '2.29', + 'encoding' => '2.16', + 'feature' => '1.42', + 'warnings' => '1.33', + }, + removed => { + 'autodie::ScopeUtil' => 1, + } + }, + 5.023002 => { + delta_from => 5.023001, + changed => { + 'Attribute::Handlers' => '0.99', + 'B::Op_private' => '5.023002', + 'CPAN::Meta::YAML' => '0.017', + 'Config' => '5.023002', + 'Cwd' => '3.57', + 'Encode' => '2.76', + 'ExtUtils::ParseXS' => '3.29', + 'ExtUtils::ParseXS::Constants'=> '3.29', + 'ExtUtils::ParseXS::CountLines'=> '3.29', + 'ExtUtils::ParseXS::Eval'=> '3.29', + 'ExtUtils::ParseXS::Utilities'=> '3.29', + 'ExtUtils::Typemaps' => '3.29', + 'File::Find' => '1.30', + 'File::Spec' => '3.57', + 'File::Spec::Cygwin' => '3.57', + 'File::Spec::Epoc' => '3.57', + 'File::Spec::Functions' => '3.57', + 'File::Spec::Mac' => '3.57', + 'File::Spec::OS2' => '3.57', + 'File::Spec::Unix' => '3.57', + 'File::Spec::VMS' => '3.57', + 'File::Spec::Win32' => '3.57', + 'Filter::Util::Call' => '1.55', + 'Hash::Util' => '0.19', + 'Module::CoreList' => '5.20150820', + 'Module::CoreList::TieHashDelta'=> '5.20150820', + 'Module::CoreList::Utils'=> '5.20150820', + 'POSIX' => '1.56', + 'Term::Cap' => '1.17', + 'Unicode::UCD' => '0.62', + 'perlfaq' => '5.021010', + }, + removed => { + } + }, + 5.020003 => { + delta_from => 5.020002, + changed => { + 'Config' => '5.020003', + 'Errno' => '1.20_06', + 'Module::CoreList' => '5.20150912', + 'Module::CoreList::TieHashDelta'=> '5.20150912', + 'Module::CoreList::Utils'=> '5.20150912', + }, + removed => { + } + }, + 5.023003 => { + delta_from => 5.023002, + changed => { + 'Amiga::ARexx' => '0.02', + 'Amiga::Exec' => '0.01', + 'B' => '1.59', + 'B::Op_private' => '5.023003', + 'Carp' => '1.37', + 'Carp::Heavy' => '1.37', + 'Compress::Raw::Zlib' => '2.068_01', + 'Config' => '5.023003', + 'Cwd' => '3.58', + 'DynaLoader' => '1.34', + 'Encode' => '2.77', + 'Encode::Unicode' => '2.14', + 'English' => '1.10', + 'Errno' => '1.24', + 'ExtUtils::Command' => '7.10', + 'ExtUtils::Command::MM' => '7.10', + 'ExtUtils::Liblist' => '7.10', + 'ExtUtils::Liblist::Kid'=> '7.10', + 'ExtUtils::MM' => '7.10', + 'ExtUtils::MM_AIX' => '7.10', + 'ExtUtils::MM_Any' => '7.10', + 'ExtUtils::MM_BeOS' => '7.10', + 'ExtUtils::MM_Cygwin' => '7.10', + 'ExtUtils::MM_DOS' => '7.10', + 'ExtUtils::MM_Darwin' => '7.10', + 'ExtUtils::MM_MacOS' => '7.10', + 'ExtUtils::MM_NW5' => '7.10', + 'ExtUtils::MM_OS2' => '7.10', + 'ExtUtils::MM_QNX' => '7.10', + 'ExtUtils::MM_UWIN' => '7.10', + 'ExtUtils::MM_Unix' => '7.10', + 'ExtUtils::MM_VMS' => '7.10', + 'ExtUtils::MM_VOS' => '7.10', + 'ExtUtils::MM_Win32' => '7.10', + 'ExtUtils::MM_Win95' => '7.10', + 'ExtUtils::MY' => '7.10', + 'ExtUtils::MakeMaker' => '7.10', + 'ExtUtils::MakeMaker::Config'=> '7.10', + 'ExtUtils::MakeMaker::Locale'=> '7.10', + 'ExtUtils::MakeMaker::version'=> '7.10', + 'ExtUtils::MakeMaker::version::regex'=> '7.10', + 'ExtUtils::MakeMaker::version::vpp'=> '7.10', + 'ExtUtils::Mkbootstrap' => '7.10', + 'ExtUtils::Mksymlists' => '7.10', + 'ExtUtils::ParseXS' => '3.30', + 'ExtUtils::ParseXS::Constants'=> '3.30', + 'ExtUtils::ParseXS::CountLines'=> '3.30', + 'ExtUtils::ParseXS::Eval'=> '3.30', + 'ExtUtils::ParseXS::Utilities'=> '3.30', + 'ExtUtils::Typemaps' => '3.30', + 'ExtUtils::Typemaps::Cmd'=> '3.30', + 'ExtUtils::Typemaps::InputMap'=> '3.30', + 'ExtUtils::Typemaps::OutputMap'=> '3.30', + 'ExtUtils::Typemaps::Type'=> '3.30', + 'ExtUtils::testlib' => '7.10', + 'File::Find' => '1.31', + 'File::Glob' => '1.25', + 'File::Spec' => '3.58', + 'File::Spec::AmigaOS' => '3.58', + 'File::Spec::Cygwin' => '3.58', + 'File::Spec::Epoc' => '3.58', + 'File::Spec::Functions' => '3.58', + 'File::Spec::Mac' => '3.58', + 'File::Spec::OS2' => '3.58', + 'File::Spec::Unix' => '3.58', + 'File::Spec::VMS' => '3.58', + 'File::Spec::Win32' => '3.58', + 'Hash::Util::FieldHash' => '1.17', + 'Locale::Codes' => '3.36', + 'Locale::Codes::Constants'=> '3.36', + 'Locale::Codes::Country'=> '3.36', + 'Locale::Codes::Country_Codes'=> '3.36', + 'Locale::Codes::Country_Retired'=> '3.36', + 'Locale::Codes::Currency'=> '3.36', + 'Locale::Codes::Currency_Codes'=> '3.36', + 'Locale::Codes::Currency_Retired'=> '3.36', + 'Locale::Codes::LangExt'=> '3.36', + 'Locale::Codes::LangExt_Codes'=> '3.36', + 'Locale::Codes::LangExt_Retired'=> '3.36', + 'Locale::Codes::LangFam'=> '3.36', + 'Locale::Codes::LangFam_Codes'=> '3.36', + 'Locale::Codes::LangFam_Retired'=> '3.36', + 'Locale::Codes::LangVar'=> '3.36', + 'Locale::Codes::LangVar_Codes'=> '3.36', + 'Locale::Codes::LangVar_Retired'=> '3.36', + 'Locale::Codes::Language'=> '3.36', + 'Locale::Codes::Language_Codes'=> '3.36', + 'Locale::Codes::Language_Retired'=> '3.36', + 'Locale::Codes::Script' => '3.36', + 'Locale::Codes::Script_Codes'=> '3.36', + 'Locale::Codes::Script_Retired'=> '3.36', + 'Locale::Country' => '3.36', + 'Locale::Currency' => '3.36', + 'Locale::Language' => '3.36', + 'Locale::Script' => '3.36', + 'Math::BigFloat::Trace' => '0.40', + 'Math::BigInt::Trace' => '0.40', + 'Module::CoreList' => '5.20150920', + 'Module::CoreList::TieHashDelta'=> '5.20150920', + 'Module::CoreList::Utils'=> '5.20150920', + 'OS2::DLL' => '1.06', + 'OS2::ExtAttr' => '0.04', + 'OS2::Process' => '1.11', + 'OS2::REXX' => '1.05', + 'POSIX' => '1.57', + 'Pod::Perldoc' => '3.25_01', + 'Socket' => '2.020_01', + 'Test' => '1.27', + 'Thread::Queue' => '3.06', + 'Time::HiRes' => '1.9727_02', + 'Unicode::UCD' => '0.63', + 'Win32' => '0.52', + 'XS::APItest' => '0.75', + 'bigint' => '0.40', + 'bignum' => '0.40', + 'bigrat' => '0.40', + 'encoding' => '2.17', + 'experimental' => '0.014', + 'if' => '0.0605', + 'locale' => '1.07', + 'mro' => '1.18', + 'threads' => '2.03', + }, + removed => { + } + }, + 5.023004 => { + delta_from => 5.023003, + changed => { + 'B' => '1.60', + 'B::Op_private' => '5.023004', + 'Compress::Raw::Bzip2' => '2.069', + 'Compress::Raw::Zlib' => '2.069', + 'Compress::Zlib' => '2.069', + 'Config' => '5.023004', + 'Devel::PPPort' => '3.32', + 'DynaLoader' => '1.35', + 'Encode' => '2.78', + 'ExtUtils::CBuilder' => '0.280224', + 'ExtUtils::CBuilder::Base'=> '0.280224', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280224', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280224', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280224', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280224', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280224', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280224', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280224', + 'ExtUtils::CBuilder::Platform::android'=> '0.280224', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280224', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280224', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280224', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280224', + 'File::Path' => '2.12', + 'IO' => '1.36', + 'IO::Compress::Adapter::Bzip2'=> '2.069', + 'IO::Compress::Adapter::Deflate'=> '2.069', + 'IO::Compress::Adapter::Identity'=> '2.069', + 'IO::Compress::Base' => '2.069', + 'IO::Compress::Base::Common'=> '2.069', + 'IO::Compress::Bzip2' => '2.069', + 'IO::Compress::Deflate' => '2.069', + 'IO::Compress::Gzip' => '2.069', + 'IO::Compress::Gzip::Constants'=> '2.069', + 'IO::Compress::RawDeflate'=> '2.069', + 'IO::Compress::Zip' => '2.069', + 'IO::Compress::Zip::Constants'=> '2.069', + 'IO::Compress::Zlib::Constants'=> '2.069', + 'IO::Compress::Zlib::Extra'=> '2.069', + 'IO::Poll' => '0.10', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.069', + 'IO::Uncompress::Adapter::Identity'=> '2.069', + 'IO::Uncompress::Adapter::Inflate'=> '2.069', + 'IO::Uncompress::AnyInflate'=> '2.069', + 'IO::Uncompress::AnyUncompress'=> '2.069', + 'IO::Uncompress::Base' => '2.069', + 'IO::Uncompress::Bunzip2'=> '2.069', + 'IO::Uncompress::Gunzip'=> '2.069', + 'IO::Uncompress::Inflate'=> '2.069', + 'IO::Uncompress::RawInflate'=> '2.069', + 'IO::Uncompress::Unzip' => '2.069', + 'Math::BigFloat' => '1.999704', + 'Math::BigFloat::Trace' => '0.41', + 'Math::BigInt' => '1.999704', + 'Math::BigInt::Calc' => '1.999704', + 'Math::BigInt::CalcEmu' => '1.999704', + 'Math::BigInt::FastCalc'=> '0.34', + 'Math::BigInt::Trace' => '0.41', + 'Module::CoreList' => '5.20151020', + 'Module::CoreList::TieHashDelta'=> '5.20151020', + 'Module::CoreList::Utils'=> '5.20151020', + 'Module::Metadata' => '1.000029', + 'POSIX' => '1.58', + 'Perl::OSType' => '1.009', + 'PerlIO::encoding' => '0.22', + 'Socket' => '2.020_02', + 'Unicode::Normalize' => '1.21', + 'XS::APItest' => '0.76', + 'bigint' => '0.41', + 'bignum' => '0.41', + 'bigrat' => '0.41', + 'experimental' => '0.016', + 'if' => '0.0606', + 'warnings' => '1.35', + }, + removed => { + } + }, + 5.023005 => { + delta_from => 5.023004, + changed => { + 'B' => '1.61', + 'B::Op_private' => '5.023005', + 'Carp' => '1.38', + 'Carp::Heavy' => '1.38', + 'Config' => '5.023005', + 'Config::Perl::V' => '0.25', + 'Cwd' => '3.59', + 'Devel::Peek' => '1.23', + 'Dumpvalue' => '1.18', + 'DynaLoader' => '1.36', + 'File::Find' => '1.32', + 'File::Spec' => '3.59', + 'File::Spec::AmigaOS' => '3.59', + 'File::Spec::Cygwin' => '3.59', + 'File::Spec::Epoc' => '3.59', + 'File::Spec::Functions' => '3.59', + 'File::Spec::Mac' => '3.59', + 'File::Spec::OS2' => '3.59', + 'File::Spec::Unix' => '3.59', + 'File::Spec::VMS' => '3.59', + 'File::Spec::Win32' => '3.59', + 'Getopt::Long' => '2.48', + 'Hash::Util::FieldHash' => '1.18', + 'IPC::Open3' => '1.20', + 'Math::BigFloat' => '1.999710', + 'Math::BigInt' => '1.999710', + 'Math::BigInt::Calc' => '1.999710', + 'Math::BigInt::CalcEmu' => '1.999710', + 'Math::BigInt::FastCalc'=> '0.37', + 'Module::CoreList' => '5.20151120', + 'Module::CoreList::TieHashDelta'=> '5.20151120', + 'Module::CoreList::Utils'=> '5.20151120', + 'Module::Metadata' => '1.000030', + 'POSIX' => '1.59', + 'PerlIO::encoding' => '0.23', + 'PerlIO::mmap' => '0.015', + 'PerlIO::scalar' => '0.24', + 'PerlIO::via' => '0.16', + 'Pod::Simple' => '3.32', + 'Pod::Simple::BlackBox' => '3.32', + 'Pod::Simple::Checker' => '3.32', + 'Pod::Simple::Debug' => '3.32', + 'Pod::Simple::DumpAsText'=> '3.32', + 'Pod::Simple::DumpAsXML'=> '3.32', + 'Pod::Simple::HTML' => '3.32', + 'Pod::Simple::HTMLBatch'=> '3.32', + 'Pod::Simple::LinkSection'=> '3.32', + 'Pod::Simple::Methody' => '3.32', + 'Pod::Simple::Progress' => '3.32', + 'Pod::Simple::PullParser'=> '3.32', + 'Pod::Simple::PullParserEndToken'=> '3.32', + 'Pod::Simple::PullParserStartToken'=> '3.32', + 'Pod::Simple::PullParserTextToken'=> '3.32', + 'Pod::Simple::PullParserToken'=> '3.32', + 'Pod::Simple::RTF' => '3.32', + 'Pod::Simple::Search' => '3.32', + 'Pod::Simple::SimpleTree'=> '3.32', + 'Pod::Simple::Text' => '3.32', + 'Pod::Simple::TextContent'=> '3.32', + 'Pod::Simple::TiedOutFH'=> '3.32', + 'Pod::Simple::Transcode'=> '3.32', + 'Pod::Simple::TranscodeDumb'=> '3.32', + 'Pod::Simple::TranscodeSmart'=> '3.32', + 'Pod::Simple::XHTML' => '3.32', + 'Pod::Simple::XMLOutStream'=> '3.32', + 'Thread::Queue' => '3.07', + 'Tie::Scalar' => '1.04', + 'Time::HiRes' => '1.9728', + 'Time::Piece' => '1.31', + 'Time::Seconds' => '1.31', + 'Unicode::Normalize' => '1.23', + 'XSLoader' => '0.21', + 'arybase' => '0.11', + 'base' => '2.22_01', + 'fields' => '2.22_01', + 'threads' => '2.04', + 'threads::shared' => '1.49', + }, + removed => { + 'ExtUtils::MakeMaker::version::vpp'=> 1, + 'version::vpp' => 1, + } + }, + 5.022001 => { + delta_from => 5.022, + changed => { + 'B::Op_private' => '5.022001', + 'Config' => '5.022001', + 'Module::CoreList' => '5.20151213', + 'Module::CoreList::TieHashDelta'=> '5.20151213', + 'Module::CoreList::Utils'=> '5.20151213', + 'POSIX' => '1.53_01', + 'PerlIO::scalar' => '0.23', + 'Storable' => '2.53_01', + 'Win32' => '0.52', + 'warnings' => '1.34', + }, + removed => { + } + }, + 5.023006 => { + delta_from => 5.023005, + changed => { + 'B::Deparse' => '1.36', + 'B::Op_private' => '5.023006', + 'Benchmark' => '1.21', + 'CPAN::Meta::Requirements'=> '2.140', + 'CPAN::Meta::YAML' => '0.018', + 'Config' => '5.023006', + 'Cwd' => '3.60', + 'Data::Dumper' => '2.159', + 'DynaLoader' => '1.37', + 'File::Spec' => '3.60', + 'File::Spec::AmigaOS' => '3.60', + 'File::Spec::Cygwin' => '3.60', + 'File::Spec::Epoc' => '3.60', + 'File::Spec::Functions' => '3.60', + 'File::Spec::Mac' => '3.60', + 'File::Spec::OS2' => '3.60', + 'File::Spec::Unix' => '3.60', + 'File::Spec::VMS' => '3.60', + 'File::Spec::Win32' => '3.60', + 'Hash::Util::FieldHash' => '1.19', + 'Locale::Codes' => '3.37', + 'Locale::Codes::Constants'=> '3.37', + 'Locale::Codes::Country'=> '3.37', + 'Locale::Codes::Country_Codes'=> '3.37', + 'Locale::Codes::Country_Retired'=> '3.37', + 'Locale::Codes::Currency'=> '3.37', + 'Locale::Codes::Currency_Codes'=> '3.37', + 'Locale::Codes::Currency_Retired'=> '3.37', + 'Locale::Codes::LangExt'=> '3.37', + 'Locale::Codes::LangExt_Codes'=> '3.37', + 'Locale::Codes::LangExt_Retired'=> '3.37', + 'Locale::Codes::LangFam'=> '3.37', + 'Locale::Codes::LangFam_Codes'=> '3.37', + 'Locale::Codes::LangFam_Retired'=> '3.37', + 'Locale::Codes::LangVar'=> '3.37', + 'Locale::Codes::LangVar_Codes'=> '3.37', + 'Locale::Codes::LangVar_Retired'=> '3.37', + 'Locale::Codes::Language'=> '3.37', + 'Locale::Codes::Language_Codes'=> '3.37', + 'Locale::Codes::Language_Retired'=> '3.37', + 'Locale::Codes::Script' => '3.37', + 'Locale::Codes::Script_Codes'=> '3.37', + 'Locale::Codes::Script_Retired'=> '3.37', + 'Locale::Country' => '3.37', + 'Locale::Currency' => '3.37', + 'Locale::Language' => '3.37', + 'Locale::Script' => '3.37', + 'Math::BigInt::FastCalc'=> '0.38', + 'Module::CoreList' => '5.20151220', + 'Module::CoreList::TieHashDelta'=> '5.20151220', + 'Module::CoreList::Utils'=> '5.20151220', + 'Module::Metadata' => '1.000031', + 'Opcode' => '1.34', + 'PerlIO::mmap' => '0.016', + 'Pod::Perldoc' => '3.25_02', + 'SDBM_File' => '1.14', + 'Term::ANSIColor' => '4.04', + 'Test' => '1.28', + 'Unicode::Normalize' => '1.24', + 'XS::APItest' => '0.77', + 'base' => '2.23', + 'encoding::warnings' => '0.12', + 'fields' => '2.23', + 'locale' => '1.08', + 'strict' => '1.10', + 'threads' => '2.05', + 'threads::shared' => '1.50', + 'utf8' => '1.18', + }, + removed => { + } + }, + 5.023007 => { + delta_from => 5.023006, + changed => { + 'App::Prove' => '3.36', + 'App::Prove::State' => '3.36', + 'App::Prove::State::Result'=> '3.36', + 'App::Prove::State::Result::Test'=> '3.36', + 'B' => '1.62', + 'B::Deparse' => '1.37', + 'B::Op_private' => '5.023007', + 'Benchmark' => '1.22', + 'Config' => '5.023007', + 'Cwd' => '3.62', + 'Data::Dumper' => '2.160', + 'ExtUtils::ParseXS' => '3.31', + 'ExtUtils::ParseXS::Constants'=> '3.31', + 'ExtUtils::ParseXS::CountLines'=> '3.31', + 'ExtUtils::ParseXS::Eval'=> '3.31', + 'ExtUtils::ParseXS::Utilities'=> '3.31', + 'ExtUtils::Typemaps' => '3.31', + 'ExtUtils::Typemaps::Cmd'=> '3.31', + 'ExtUtils::Typemaps::InputMap'=> '3.31', + 'ExtUtils::Typemaps::OutputMap'=> '3.31', + 'ExtUtils::Typemaps::Type'=> '3.31', + 'File::Find' => '1.33', + 'File::Spec' => '3.62', + 'File::Spec::AmigaOS' => '3.62', + 'File::Spec::Cygwin' => '3.62', + 'File::Spec::Epoc' => '3.62', + 'File::Spec::Functions' => '3.62', + 'File::Spec::Mac' => '3.62', + 'File::Spec::OS2' => '3.62', + 'File::Spec::Unix' => '3.62', + 'File::Spec::VMS' => '3.62', + 'File::Spec::Win32' => '3.62', + 'Math::BigFloat' => '1.999715', + 'Math::BigFloat::Trace' => '0.42', + 'Math::BigInt' => '1.999715', + 'Math::BigInt::Calc' => '1.999715', + 'Math::BigInt::CalcEmu' => '1.999715', + 'Math::BigInt::FastCalc'=> '0.40', + 'Math::BigInt::Trace' => '0.42', + 'Math::BigRat' => '0.260802', + 'Module::CoreList' => '5.20160120', + 'Module::CoreList::TieHashDelta'=> '5.20160120', + 'Module::CoreList::Utils'=> '5.20160120', + 'Net::Cmd' => '3.08', + 'Net::Config' => '3.08', + 'Net::Domain' => '3.08', + 'Net::FTP' => '3.08', + 'Net::FTP::A' => '3.08', + 'Net::FTP::E' => '3.08', + 'Net::FTP::I' => '3.08', + 'Net::FTP::L' => '3.08', + 'Net::FTP::dataconn' => '3.08', + 'Net::NNTP' => '3.08', + 'Net::Netrc' => '3.08', + 'Net::POP3' => '3.08', + 'Net::SMTP' => '3.08', + 'Net::Time' => '3.08', + 'Pod::Man' => '4.04', + 'Pod::ParseLink' => '4.04', + 'Pod::Text' => '4.04', + 'Pod::Text::Color' => '4.04', + 'Pod::Text::Overstrike' => '4.04', + 'Pod::Text::Termcap' => '4.04', + 'Pod::Usage' => '1.68', + 'TAP::Base' => '3.36', + 'TAP::Formatter::Base' => '3.36', + 'TAP::Formatter::Color' => '3.36', + 'TAP::Formatter::Console'=> '3.36', + 'TAP::Formatter::Console::ParallelSession'=> '3.36', + 'TAP::Formatter::Console::Session'=> '3.36', + 'TAP::Formatter::File' => '3.36', + 'TAP::Formatter::File::Session'=> '3.36', + 'TAP::Formatter::Session'=> '3.36', + 'TAP::Harness' => '3.36', + 'TAP::Harness::Env' => '3.36', + 'TAP::Object' => '3.36', + 'TAP::Parser' => '3.36', + 'TAP::Parser::Aggregator'=> '3.36', + 'TAP::Parser::Grammar' => '3.36', + 'TAP::Parser::Iterator' => '3.36', + 'TAP::Parser::Iterator::Array'=> '3.36', + 'TAP::Parser::Iterator::Process'=> '3.36', + 'TAP::Parser::Iterator::Stream'=> '3.36', + 'TAP::Parser::IteratorFactory'=> '3.36', + 'TAP::Parser::Multiplexer'=> '3.36', + 'TAP::Parser::Result' => '3.36', + 'TAP::Parser::Result::Bailout'=> '3.36', + 'TAP::Parser::Result::Comment'=> '3.36', + 'TAP::Parser::Result::Plan'=> '3.36', + 'TAP::Parser::Result::Pragma'=> '3.36', + 'TAP::Parser::Result::Test'=> '3.36', + 'TAP::Parser::Result::Unknown'=> '3.36', + 'TAP::Parser::Result::Version'=> '3.36', + 'TAP::Parser::Result::YAML'=> '3.36', + 'TAP::Parser::ResultFactory'=> '3.36', + 'TAP::Parser::Scheduler'=> '3.36', + 'TAP::Parser::Scheduler::Job'=> '3.36', + 'TAP::Parser::Scheduler::Spinner'=> '3.36', + 'TAP::Parser::Source' => '3.36', + 'TAP::Parser::SourceHandler'=> '3.36', + 'TAP::Parser::SourceHandler::Executable'=> '3.36', + 'TAP::Parser::SourceHandler::File'=> '3.36', + 'TAP::Parser::SourceHandler::Handle'=> '3.36', + 'TAP::Parser::SourceHandler::Perl'=> '3.36', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.36', + 'TAP::Parser::YAMLish::Reader'=> '3.36', + 'TAP::Parser::YAMLish::Writer'=> '3.36', + 'Test::Harness' => '3.36', + 'Unicode::Normalize' => '1.25', + 'Unicode::UCD' => '0.64', + 'XS::APItest' => '0.78', + 'bigint' => '0.42', + 'bignum' => '0.42', + 'bigrat' => '0.42', + 'utf8' => '1.19', + }, + removed => { + } + }, + 5.023008 => { + delta_from => 5.023007, + changed => { + 'B::Op_private' => '5.023008', + 'Config' => '5.023008', + 'Cwd' => '3.63', + 'DynaLoader' => '1.38', + 'Encode' => '2.80', + 'Encode::Alias' => '2.20', + 'Encode::MIME::Header' => '2.19', + 'Encode::Unicode' => '2.15', + 'ExtUtils::CBuilder' => '0.280225', + 'ExtUtils::CBuilder::Base'=> '0.280225', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280225', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280225', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280225', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280225', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280225', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280225', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280225', + 'ExtUtils::CBuilder::Platform::android'=> '0.280225', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280225', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280225', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280225', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280225', + 'ExtUtils::Command::MM' => '7.10_01', + 'ExtUtils::Liblist' => '7.10_01', + 'ExtUtils::Liblist::Kid'=> '7.10_01', + 'ExtUtils::MM' => '7.10_01', + 'ExtUtils::MM_AIX' => '7.10_01', + 'ExtUtils::MM_Any' => '7.10_01', + 'ExtUtils::MM_BeOS' => '7.10_01', + 'ExtUtils::MM_Cygwin' => '7.10_01', + 'ExtUtils::MM_DOS' => '7.10_01', + 'ExtUtils::MM_Darwin' => '7.10_01', + 'ExtUtils::MM_MacOS' => '7.10_01', + 'ExtUtils::MM_NW5' => '7.10_01', + 'ExtUtils::MM_OS2' => '7.10_01', + 'ExtUtils::MM_QNX' => '7.10_01', + 'ExtUtils::MM_UWIN' => '7.10_01', + 'ExtUtils::MM_Unix' => '7.10_01', + 'ExtUtils::MM_VMS' => '7.10_01', + 'ExtUtils::MM_VOS' => '7.10_01', + 'ExtUtils::MM_Win32' => '7.10_01', + 'ExtUtils::MM_Win95' => '7.10_01', + 'ExtUtils::MY' => '7.10_01', + 'ExtUtils::MakeMaker' => '7.10_01', + 'ExtUtils::MakeMaker::Config'=> '7.10_01', + 'ExtUtils::MakeMaker::version'=> '7.10_01', + 'ExtUtils::MakeMaker::version::regex'=> '7.10_01', + 'ExtUtils::Mkbootstrap' => '7.10_01', + 'ExtUtils::Mksymlists' => '7.10_01', + 'ExtUtils::testlib' => '7.10_01', + 'File::Spec' => '3.63', + 'File::Spec::AmigaOS' => '3.63', + 'File::Spec::Cygwin' => '3.63', + 'File::Spec::Epoc' => '3.63', + 'File::Spec::Functions' => '3.63', + 'File::Spec::Mac' => '3.63', + 'File::Spec::OS2' => '3.63', + 'File::Spec::Unix' => '3.63', + 'File::Spec::VMS' => '3.63', + 'File::Spec::Win32' => '3.63', + 'IPC::Msg' => '2.05', + 'IPC::Semaphore' => '2.05', + 'IPC::SharedMem' => '2.05', + 'IPC::SysV' => '2.05', + 'Module::CoreList' => '5.20160121', + 'Module::CoreList::TieHashDelta'=> '5.20160121', + 'Module::CoreList::Utils'=> '5.20160121', + 'ODBM_File' => '1.13', + 'POSIX' => '1.63', + 'PerlIO::encoding' => '0.24', + 'Pod::Man' => '4.06', + 'Pod::ParseLink' => '4.06', + 'Pod::Text' => '4.06', + 'Pod::Text::Color' => '4.06', + 'Pod::Text::Overstrike' => '4.06', + 'Pod::Text::Termcap' => '4.06', + 'Storable' => '2.55', + 'Time::HiRes' => '1.9730', + 'XS::APItest' => '0.79', + }, + removed => { + } + }, + 5.023009 => { + delta_from => 5.023008, + changed => { + 'Amiga::ARexx' => '0.04', + 'Amiga::Exec' => '0.02', + 'B::Op_private' => '5.023009', + 'Carp' => '1.40', + 'Carp::Heavy' => '1.40', + 'Config' => '5.023009', + 'Errno' => '1.25', + 'ExtUtils::Embed' => '1.33', + 'File::Find' => '1.34', + 'File::Glob' => '1.26', + 'File::Spec::AmigaOS' => ';.64', + 'IPC::Msg' => '2.06_01', + 'IPC::Semaphore' => '2.06_01', + 'IPC::SharedMem' => '2.06_01', + 'IPC::SysV' => '2.06_01', + 'List::Util' => '1.42_02', + 'List::Util::XS' => '1.42_02', + 'Module::CoreList' => '5.20160320', + 'Module::CoreList::TieHashDelta'=> '5.20160320', + 'Module::CoreList::Utils'=> '5.20160320', + 'POSIX' => '1.64', + 'Pod::Functions' => '1.10', + 'Pod::Functions::Functions'=> '1.10', + 'Scalar::Util' => '1.42_02', + 'SelfLoader' => '1.23', + 'Socket' => '2.020_03', + 'Storable' => '2.56', + 'Sub::Util' => '1.42_02', + 'Thread::Queue' => '3.08', + 'Tie::File' => '1.02', + 'Time::HiRes' => '1.9732', + 'Win32API::File' => '0.1203', + 'XS::APItest' => '0.80', + 'autouse' => '1.11', + 'bytes' => '1.05', + 'strict' => '1.11', + 'threads' => '2.06', + 'version' => '0.9916', + 'version::regex' => '0.9916', + 'warnings' => '1.36', + }, + removed => { + 'Win32API::File::ExtUtils::Myconst2perl'=> 1, + } + }, + 5.022002 => { + delta_from => 5.022001, + changed => { + 'B::Op_private' => '5.022002', + 'Config' => '5.022002', + 'Cwd' => '3.56_01', + 'File::Spec' => '3.56_01', + 'File::Spec::Cygwin' => '3.56_01', + 'File::Spec::Epoc' => '3.56_01', + 'File::Spec::Functions' => '3.56_01', + 'File::Spec::Mac' => '3.56_01', + 'File::Spec::OS2' => '3.56_01', + 'File::Spec::Unix' => '3.56_01', + 'File::Spec::VMS' => '3.56_01', + 'File::Spec::Win32' => '3.56_01', + 'Module::CoreList' => '5.20160429', + 'Module::CoreList::TieHashDelta'=> '5.20160429', + 'Module::CoreList::Utils'=> '5.20160429', + 'XS::APItest' => '0.72_01', + }, + removed => { + } + }, + 5.024000 => { + delta_from => 5.023009, + changed => { + 'B::Op_private' => '5.024000', + 'Config' => '5.024', + 'File::Copy' => '2.31', + 'File::Path' => '2.12_01', + 'File::Spec::AmigaOS' => '3.64', + 'IO::Handle' => '1.36', + 'Module::CoreList' => '5.20160506', + 'Module::CoreList::TieHashDelta'=> '5.20160506', + 'Module::CoreList::Utils'=> '5.20160506', + 'ODBM_File' => '1.14', + 'POSIX' => '1.65', + 'Pod::Man' => '4.07', + 'Pod::ParseLink' => '4.07', + 'Pod::Text' => '4.07', + 'Pod::Text::Color' => '4.07', + 'Pod::Text::Overstrike' => '4.07', + 'Pod::Text::Termcap' => '4.07', + 'Thread::Queue' => '3.09', + 'Time::HiRes' => '1.9733', + 'threads' => '2.07', + 'threads::shared' => '1.51', + 'locale' => '1.09', + }, + removed => { + } + }, + 5.025000 => { + delta_from => 5.024, + changed => { + 'B::Op_private' => '5.025000', + 'Config' => '5.025', + 'Module::CoreList' => '5.20160507', + 'Module::CoreList::TieHashDelta'=> '5.20160507', + 'Module::CoreList::Utils'=> '5.20160507', + 'feature' => '1.43', + }, + removed => { + } + }, + 5.025001 => { + delta_from => 5.025, + changed => { + 'Archive::Tar' => '2.08', + 'Archive::Tar::Constant'=> '2.08', + 'Archive::Tar::File' => '2.08', + 'B::Op_private' => '5.025001', + 'Carp' => '1.41', + 'Carp::Heavy' => '1.41', + 'Config' => '5.025001', + 'Config::Perl::V' => '0.26', + 'DB_File' => '1.838', + 'Digest::MD5' => '2.55', + 'IPC::Cmd' => '0.94', + 'IPC::Msg' => '2.07', + 'IPC::Semaphore' => '2.07', + 'IPC::SharedMem' => '2.07', + 'IPC::SysV' => '2.07', + 'List::Util' => '1.45_01', + 'List::Util::XS' => '1.45_01', + 'Locale::Codes' => '3.38', + 'Locale::Codes::Constants'=> '3.38', + 'Locale::Codes::Country'=> '3.38', + 'Locale::Codes::Country_Codes'=> '3.38', + 'Locale::Codes::Country_Retired'=> '3.38', + 'Locale::Codes::Currency'=> '3.38', + 'Locale::Codes::Currency_Codes'=> '3.38', + 'Locale::Codes::Currency_Retired'=> '3.38', + 'Locale::Codes::LangExt'=> '3.38', + 'Locale::Codes::LangExt_Codes'=> '3.38', + 'Locale::Codes::LangExt_Retired'=> '3.38', + 'Locale::Codes::LangFam'=> '3.38', + 'Locale::Codes::LangFam_Codes'=> '3.38', + 'Locale::Codes::LangFam_Retired'=> '3.38', + 'Locale::Codes::LangVar'=> '3.38', + 'Locale::Codes::LangVar_Codes'=> '3.38', + 'Locale::Codes::LangVar_Retired'=> '3.38', + 'Locale::Codes::Language'=> '3.38', + 'Locale::Codes::Language_Codes'=> '3.38', + 'Locale::Codes::Language_Retired'=> '3.38', + 'Locale::Codes::Script' => '3.38', + 'Locale::Codes::Script_Codes'=> '3.38', + 'Locale::Codes::Script_Retired'=> '3.38', + 'Locale::Country' => '3.38', + 'Locale::Currency' => '3.38', + 'Locale::Language' => '3.38', + 'Locale::Maketext' => '1.27', + 'Locale::Script' => '3.38', + 'Module::CoreList' => '5.20160520', + 'Module::CoreList::TieHashDelta'=> '5.20160520', + 'Module::CoreList::Utils'=> '5.20160520', + 'Module::Metadata' => '1.000032', + 'POSIX' => '1.69', + 'Scalar::Util' => '1.45_01', + 'Sub::Util' => '1.45_01', + 'Sys::Syslog' => '0.34', + 'Term::ANSIColor' => '4.05', + 'Test2' => '1.302015', + 'Test2::API' => '1.302015', + 'Test2::API::Breakage' => '1.302015', + 'Test2::API::Context' => '1.302015', + 'Test2::API::Instance' => '1.302015', + 'Test2::API::Stack' => '1.302015', + 'Test2::Event' => '1.302015', + 'Test2::Event::Bail' => '1.302015', + 'Test2::Event::Diag' => '1.302015', + 'Test2::Event::Exception'=> '1.302015', + 'Test2::Event::Note' => '1.302015', + 'Test2::Event::Ok' => '1.302015', + 'Test2::Event::Plan' => '1.302015', + 'Test2::Event::Skip' => '1.302015', + 'Test2::Event::Subtest' => '1.302015', + 'Test2::Event::Waiting' => '1.302015', + 'Test2::Formatter' => '1.302015', + 'Test2::Formatter::TAP' => '1.302015', + 'Test2::Hub' => '1.302015', + 'Test2::Hub::Interceptor'=> '1.302015', + 'Test2::Hub::Interceptor::Terminator'=> '1.302015', + 'Test2::Hub::Subtest' => '1.302015', + 'Test2::IPC' => '1.302015', + 'Test2::IPC::Driver' => '1.302015', + 'Test2::IPC::Driver::Files'=> '1.302015', + 'Test2::Util' => '1.302015', + 'Test2::Util::ExternalMeta'=> '1.302015', + 'Test2::Util::HashBase' => '1.302015', + 'Test2::Util::Trace' => '1.302015', + 'Test::Builder' => '1.302015', + 'Test::Builder::Formatter'=> '1.302015', + 'Test::Builder::Module' => '1.302015', + 'Test::Builder::Tester' => '1.302015', + 'Test::Builder::Tester::Color'=> '1.302015', + 'Test::Builder::TodoDiag'=> '1.302015', + 'Test::More' => '1.302015', + 'Test::Simple' => '1.302015', + 'Test::Tester' => '1.302015', + 'Test::Tester::Capture' => '1.302015', + 'Test::Tester::CaptureRunner'=> '1.302015', + 'Test::Tester::Delegate'=> '1.302015', + 'Test::use::ok' => '1.302015', + 'XS::APItest' => '0.81', + '_charnames' => '1.44', + 'charnames' => '1.44', + 'ok' => '1.302015', + 'perlfaq' => '5.021011', + 're' => '0.33', + 'threads' => '2.08', + 'threads::shared' => '1.52', + }, + removed => { + } + }, + 5.025002 => { + delta_from => 5.025001, + changed => { + 'App::Cpan' => '1.64', + 'B::Op_private' => '5.025002', + 'CPAN' => '2.14', + 'CPAN::Distribution' => '2.12', + 'CPAN::FTP' => '5.5007', + 'CPAN::FirstTime' => '5.5309', + 'CPAN::HandleConfig' => '5.5007', + 'CPAN::Index' => '2.12', + 'CPAN::Mirrors' => '2.12', + 'CPAN::Plugin' => '0.96', + 'CPAN::Shell' => '5.5006', + 'Config' => '5.025002', + 'Cwd' => '3.64', + 'Devel::Peek' => '1.24', + 'DynaLoader' => '1.39', + 'ExtUtils::Command' => '7.18', + 'ExtUtils::Command::MM' => '7.18', + 'ExtUtils::Liblist' => '7.18', + 'ExtUtils::Liblist::Kid'=> '7.18', + 'ExtUtils::MM' => '7.18', + 'ExtUtils::MM_AIX' => '7.18', + 'ExtUtils::MM_Any' => '7.18', + 'ExtUtils::MM_BeOS' => '7.18', + 'ExtUtils::MM_Cygwin' => '7.18', + 'ExtUtils::MM_DOS' => '7.18', + 'ExtUtils::MM_Darwin' => '7.18', + 'ExtUtils::MM_MacOS' => '7.18', + 'ExtUtils::MM_NW5' => '7.18', + 'ExtUtils::MM_OS2' => '7.18', + 'ExtUtils::MM_QNX' => '7.18', + 'ExtUtils::MM_UWIN' => '7.18', + 'ExtUtils::MM_Unix' => '7.18', + 'ExtUtils::MM_VMS' => '7.18', + 'ExtUtils::MM_VOS' => '7.18', + 'ExtUtils::MM_Win32' => '7.18', + 'ExtUtils::MM_Win95' => '7.18', + 'ExtUtils::MY' => '7.18', + 'ExtUtils::MakeMaker' => '7.18', + 'ExtUtils::MakeMaker::Config'=> '7.18', + 'ExtUtils::MakeMaker::Locale'=> '7.18', + 'ExtUtils::MakeMaker::version'=> '7.18', + 'ExtUtils::MakeMaker::version::regex'=> '7.18', + 'ExtUtils::Miniperl' => '1.06', + 'ExtUtils::Mkbootstrap' => '7.18', + 'ExtUtils::Mksymlists' => '7.18', + 'ExtUtils::ParseXS' => '3.32', + 'ExtUtils::ParseXS::Constants'=> '3.32', + 'ExtUtils::ParseXS::CountLines'=> '3.32', + 'ExtUtils::ParseXS::Eval'=> '3.32', + 'ExtUtils::ParseXS::Utilities'=> '3.32', + 'ExtUtils::Typemaps' => '3.32', + 'ExtUtils::Typemaps::Cmd'=> '3.32', + 'ExtUtils::Typemaps::InputMap'=> '3.32', + 'ExtUtils::Typemaps::OutputMap'=> '3.32', + 'ExtUtils::Typemaps::Type'=> '3.32', + 'ExtUtils::testlib' => '7.18', + 'File::Copy' => '2.32', + 'File::Glob' => '1.27', + 'File::Spec' => '3.64', + 'File::Spec::Cygwin' => '3.64', + 'File::Spec::Epoc' => '3.64', + 'File::Spec::Functions' => '3.64', + 'File::Spec::Mac' => '3.64', + 'File::Spec::OS2' => '3.64', + 'File::Spec::Unix' => '3.64', + 'File::Spec::VMS' => '3.64', + 'File::Spec::Win32' => '3.64', + 'FileHandle' => '2.03', + 'Getopt::Long' => '2.49', + 'HTTP::Tiny' => '0.058', + 'JSON::PP' => '2.27400', + 'Locale::Codes' => '3.39', + 'Locale::Codes::Constants'=> '3.39', + 'Locale::Codes::Country'=> '3.39', + 'Locale::Codes::Country_Codes'=> '3.39', + 'Locale::Codes::Country_Retired'=> '3.39', + 'Locale::Codes::Currency'=> '3.39', + 'Locale::Codes::Currency_Codes'=> '3.39', + 'Locale::Codes::Currency_Retired'=> '3.39', + 'Locale::Codes::LangExt'=> '3.39', + 'Locale::Codes::LangExt_Codes'=> '3.39', + 'Locale::Codes::LangExt_Retired'=> '3.39', + 'Locale::Codes::LangFam'=> '3.39', + 'Locale::Codes::LangFam_Codes'=> '3.39', + 'Locale::Codes::LangFam_Retired'=> '3.39', + 'Locale::Codes::LangVar'=> '3.39', + 'Locale::Codes::LangVar_Codes'=> '3.39', + 'Locale::Codes::LangVar_Retired'=> '3.39', + 'Locale::Codes::Language'=> '3.39', + 'Locale::Codes::Language_Codes'=> '3.39', + 'Locale::Codes::Language_Retired'=> '3.39', + 'Locale::Codes::Script' => '3.39', + 'Locale::Codes::Script_Codes'=> '3.39', + 'Locale::Codes::Script_Retired'=> '3.39', + 'Locale::Country' => '3.39', + 'Locale::Currency' => '3.39', + 'Locale::Language' => '3.39', + 'Locale::Script' => '3.39', + 'Module::CoreList' => '5.20160620', + 'Module::CoreList::TieHashDelta'=> '5.20160620', + 'Module::CoreList::Utils'=> '5.20160620', + 'Opcode' => '1.35', + 'POSIX' => '1.70', + 'Pod::Checker' => '1.73', + 'Pod::Functions' => '1.11', + 'Pod::Functions::Functions'=> '1.11', + 'Pod::Usage' => '1.69', + 'Test2' => '1.302026', + 'Test2::API' => '1.302026', + 'Test2::API::Breakage' => '1.302026', + 'Test2::API::Context' => '1.302026', + 'Test2::API::Instance' => '1.302026', + 'Test2::API::Stack' => '1.302026', + 'Test2::Event' => '1.302026', + 'Test2::Event::Bail' => '1.302026', + 'Test2::Event::Diag' => '1.302026', + 'Test2::Event::Exception'=> '1.302026', + 'Test2::Event::Generic' => '1.302026', + 'Test2::Event::Note' => '1.302026', + 'Test2::Event::Ok' => '1.302026', + 'Test2::Event::Plan' => '1.302026', + 'Test2::Event::Skip' => '1.302026', + 'Test2::Event::Subtest' => '1.302026', + 'Test2::Event::Waiting' => '1.302026', + 'Test2::Formatter' => '1.302026', + 'Test2::Formatter::TAP' => '1.302026', + 'Test2::Hub' => '1.302026', + 'Test2::Hub::Interceptor'=> '1.302026', + 'Test2::Hub::Interceptor::Terminator'=> '1.302026', + 'Test2::Hub::Subtest' => '1.302026', + 'Test2::IPC' => '1.302026', + 'Test2::IPC::Driver' => '1.302026', + 'Test2::IPC::Driver::Files'=> '1.302026', + 'Test2::Util' => '1.302026', + 'Test2::Util::ExternalMeta'=> '1.302026', + 'Test2::Util::HashBase' => '1.302026', + 'Test2::Util::Trace' => '1.302026', + 'Test::Builder' => '1.302026', + 'Test::Builder::Formatter'=> '1.302026', + 'Test::Builder::Module' => '1.302026', + 'Test::Builder::Tester' => '1.302026', + 'Test::Builder::Tester::Color'=> '1.302026', + 'Test::Builder::TodoDiag'=> '1.302026', + 'Test::More' => '1.302026', + 'Test::Simple' => '1.302026', + 'Test::Tester' => '1.302026', + 'Test::Tester::Capture' => '1.302026', + 'Test::Tester::CaptureRunner'=> '1.302026', + 'Test::Tester::Delegate'=> '1.302026', + 'Test::use::ok' => '1.302026', + 'Thread::Queue' => '3.11', + 'Time::HiRes' => '1.9734', + 'Unicode::UCD' => '0.65', + 'VMS::DCLsym' => '1.07', + 'XS::APItest' => '0.82', + 'diagnostics' => '1.35', + 'feature' => '1.44', + 'ok' => '1.302026', + 'threads' => '2.09', + }, + removed => { + } + }, + 5.025003 => { + delta_from => 5.025002, + changed => { + 'B::Op_private' => '5.025003', + 'Config' => '5.025003', + 'Data::Dumper' => '2.161', + 'Devel::PPPort' => '3.35', + 'Encode' => '2.84', + 'Encode::MIME::Header' => '2.23', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.07', + 'ExtUtils::ParseXS' => '3.33', + 'ExtUtils::ParseXS::Constants'=> '3.33', + 'ExtUtils::ParseXS::CountLines'=> '3.33', + 'ExtUtils::ParseXS::Eval'=> '3.33', + 'ExtUtils::ParseXS::Utilities'=> '3.33', + 'ExtUtils::Typemaps' => '3.33', + 'ExtUtils::Typemaps::Cmd'=> '3.33', + 'ExtUtils::Typemaps::InputMap'=> '3.33', + 'ExtUtils::Typemaps::OutputMap'=> '3.33', + 'ExtUtils::Typemaps::Type'=> '3.33', + 'Hash::Util' => '0.20', + 'Math::BigFloat' => '1.999726', + 'Math::BigFloat::Trace' => '0.43', + 'Math::BigInt' => '1.999726', + 'Math::BigInt::Calc' => '1.999726', + 'Math::BigInt::CalcEmu' => '1.999726', + 'Math::BigInt::FastCalc'=> '0.42', + 'Math::BigInt::Trace' => '0.43', + 'Math::BigRat' => '0.260804', + 'Module::CoreList' => '5.20160720', + 'Module::CoreList::TieHashDelta'=> '5.20160720', + 'Module::CoreList::Utils'=> '5.20160720', + 'Net::Cmd' => '3.09', + 'Net::Config' => '3.09', + 'Net::Domain' => '3.09', + 'Net::FTP' => '3.09', + 'Net::FTP::A' => '3.09', + 'Net::FTP::E' => '3.09', + 'Net::FTP::I' => '3.09', + 'Net::FTP::L' => '3.09', + 'Net::FTP::dataconn' => '3.09', + 'Net::NNTP' => '3.09', + 'Net::Netrc' => '3.09', + 'Net::POP3' => '3.09', + 'Net::SMTP' => '3.09', + 'Net::Time' => '3.09', + 'Parse::CPAN::Meta' => '1.4422', + 'Perl::OSType' => '1.010', + 'Test2' => '1.302045', + 'Test2::API' => '1.302045', + 'Test2::API::Breakage' => '1.302045', + 'Test2::API::Context' => '1.302045', + 'Test2::API::Instance' => '1.302045', + 'Test2::API::Stack' => '1.302045', + 'Test2::Event' => '1.302045', + 'Test2::Event::Bail' => '1.302045', + 'Test2::Event::Diag' => '1.302045', + 'Test2::Event::Exception'=> '1.302045', + 'Test2::Event::Generic' => '1.302045', + 'Test2::Event::Info' => '1.302045', + 'Test2::Event::Note' => '1.302045', + 'Test2::Event::Ok' => '1.302045', + 'Test2::Event::Plan' => '1.302045', + 'Test2::Event::Skip' => '1.302045', + 'Test2::Event::Subtest' => '1.302045', + 'Test2::Event::Waiting' => '1.302045', + 'Test2::Formatter' => '1.302045', + 'Test2::Formatter::TAP' => '1.302045', + 'Test2::Hub' => '1.302045', + 'Test2::Hub::Interceptor'=> '1.302045', + 'Test2::Hub::Interceptor::Terminator'=> '1.302045', + 'Test2::Hub::Subtest' => '1.302045', + 'Test2::IPC' => '1.302045', + 'Test2::IPC::Driver' => '1.302045', + 'Test2::IPC::Driver::Files'=> '1.302045', + 'Test2::Util' => '1.302045', + 'Test2::Util::ExternalMeta'=> '1.302045', + 'Test2::Util::HashBase' => '1.302045', + 'Test2::Util::Trace' => '1.302045', + 'Test::Builder' => '1.302045', + 'Test::Builder::Formatter'=> '1.302045', + 'Test::Builder::Module' => '1.302045', + 'Test::Builder::Tester' => '1.302045', + 'Test::Builder::Tester::Color'=> '1.302045', + 'Test::Builder::TodoDiag'=> '1.302045', + 'Test::More' => '1.302045', + 'Test::Simple' => '1.302045', + 'Test::Tester' => '1.302045', + 'Test::Tester::Capture' => '1.302045', + 'Test::Tester::CaptureRunner'=> '1.302045', + 'Test::Tester::Delegate'=> '1.302045', + 'Test::use::ok' => '1.302045', + 'Time::HiRes' => '1.9739', + 'Unicode' => '9.0.0', + 'Unicode::UCD' => '0.66', + 'XSLoader' => '0.22', + 'bigint' => '0.43', + 'bignum' => '0.43', + 'bigrat' => '0.43', + 'encoding' => '2.17_01', + 'encoding::warnings' => '0.13', + 'feature' => '1.45', + 'ok' => '1.302045', + 'version' => '0.9917', + 'version::regex' => '0.9917', + 'warnings' => '1.37', + }, + removed => { + } + }, + 5.025004 => { + delta_from => 5.025003, + changed => { + 'App::Cpan' => '1.64_01', + 'App::Prove' => '3.36_01', + 'App::Prove::State' => '3.36_01', + 'App::Prove::State::Result'=> '3.36_01', + 'App::Prove::State::Result::Test'=> '3.36_01', + 'Archive::Tar' => '2.10', + 'Archive::Tar::Constant'=> '2.10', + 'Archive::Tar::File' => '2.10', + 'B' => '1.63', + 'B::Concise' => '0.998', + 'B::Deparse' => '1.38', + 'B::Op_private' => '5.025004', + 'CPAN' => '2.14_01', + 'CPAN::Meta' => '2.150010', + 'CPAN::Meta::Converter' => '2.150010', + 'CPAN::Meta::Feature' => '2.150010', + 'CPAN::Meta::History' => '2.150010', + 'CPAN::Meta::Merge' => '2.150010', + 'CPAN::Meta::Prereqs' => '2.150010', + 'CPAN::Meta::Spec' => '2.150010', + 'CPAN::Meta::Validator' => '2.150010', + 'Carp' => '1.42', + 'Carp::Heavy' => '1.42', + 'Compress::Zlib' => '2.069_01', + 'Config' => '5.025004', + 'Config::Perl::V' => '0.27', + 'Cwd' => '3.65', + 'Digest' => '1.17_01', + 'Digest::SHA' => '5.96', + 'Encode' => '2.86', + 'Errno' => '1.26', + 'ExtUtils::Command' => '7.24', + 'ExtUtils::Command::MM' => '7.24', + 'ExtUtils::Liblist' => '7.24', + 'ExtUtils::Liblist::Kid'=> '7.24', + 'ExtUtils::MM' => '7.24', + 'ExtUtils::MM_AIX' => '7.24', + 'ExtUtils::MM_Any' => '7.24', + 'ExtUtils::MM_BeOS' => '7.24', + 'ExtUtils::MM_Cygwin' => '7.24', + 'ExtUtils::MM_DOS' => '7.24', + 'ExtUtils::MM_Darwin' => '7.24', + 'ExtUtils::MM_MacOS' => '7.24', + 'ExtUtils::MM_NW5' => '7.24', + 'ExtUtils::MM_OS2' => '7.24', + 'ExtUtils::MM_QNX' => '7.24', + 'ExtUtils::MM_UWIN' => '7.24', + 'ExtUtils::MM_Unix' => '7.24', + 'ExtUtils::MM_VMS' => '7.24', + 'ExtUtils::MM_VOS' => '7.24', + 'ExtUtils::MM_Win32' => '7.24', + 'ExtUtils::MM_Win95' => '7.24', + 'ExtUtils::MY' => '7.24', + 'ExtUtils::MakeMaker' => '7.24', + 'ExtUtils::MakeMaker::Config'=> '7.24', + 'ExtUtils::MakeMaker::Locale'=> '7.24', + 'ExtUtils::MakeMaker::version'=> '7.24', + 'ExtUtils::MakeMaker::version::regex'=> '7.24', + 'ExtUtils::Mkbootstrap' => '7.24', + 'ExtUtils::Mksymlists' => '7.24', + 'ExtUtils::testlib' => '7.24', + 'File::Fetch' => '0.52', + 'File::Spec' => '3.65', + 'File::Spec::AmigaOS' => '3.65', + 'File::Spec::Cygwin' => '3.65', + 'File::Spec::Epoc' => '3.65', + 'File::Spec::Functions' => '3.65', + 'File::Spec::Mac' => '3.65', + 'File::Spec::OS2' => '3.65', + 'File::Spec::Unix' => '3.65', + 'File::Spec::VMS' => '3.65', + 'File::Spec::Win32' => '3.65', + 'HTTP::Tiny' => '0.064', + 'Hash::Util' => '0.21', + 'I18N::LangTags' => '0.41', + 'I18N::LangTags::Detect'=> '1.06', + 'IO' => '1.37', + 'IO::Compress::Adapter::Bzip2'=> '2.069_01', + 'IO::Compress::Adapter::Deflate'=> '2.069_01', + 'IO::Compress::Adapter::Identity'=> '2.069_01', + 'IO::Compress::Base' => '2.069_01', + 'IO::Compress::Base::Common'=> '2.069_01', + 'IO::Compress::Bzip2' => '2.069_01', + 'IO::Compress::Deflate' => '2.069_01', + 'IO::Compress::Gzip' => '2.069_01', + 'IO::Compress::Gzip::Constants'=> '2.069_01', + 'IO::Compress::RawDeflate'=> '2.069_01', + 'IO::Compress::Zip' => '2.069_01', + 'IO::Compress::Zip::Constants'=> '2.069_01', + 'IO::Compress::Zlib::Constants'=> '2.069_01', + 'IO::Compress::Zlib::Extra'=> '2.069_01', + 'IO::Socket::IP' => '0.38', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.069_01', + 'IO::Uncompress::Adapter::Identity'=> '2.069_01', + 'IO::Uncompress::Adapter::Inflate'=> '2.069_01', + 'IO::Uncompress::AnyInflate'=> '2.069_01', + 'IO::Uncompress::AnyUncompress'=> '2.069_01', + 'IO::Uncompress::Base' => '2.069_01', + 'IO::Uncompress::Bunzip2'=> '2.069_01', + 'IO::Uncompress::Gunzip'=> '2.069_01', + 'IO::Uncompress::Inflate'=> '2.069_01', + 'IO::Uncompress::RawInflate'=> '2.069_01', + 'IO::Uncompress::Unzip' => '2.069_01', + 'IPC::Cmd' => '0.96', + 'JSON::PP' => '2.27400_01', + 'Locale::Maketext' => '1.28', + 'Locale::Maketext::Simple'=> '0.21_01', + 'Math::BigFloat::Trace' => '0.43_01', + 'Math::BigInt::Trace' => '0.43_01', + 'Memoize' => '1.03_01', + 'Module::CoreList' => '5.20160820', + 'Module::CoreList::TieHashDelta'=> '5.20160820', + 'Module::CoreList::Utils'=> '5.20160820', + 'Module::Load::Conditional'=> '0.68', + 'Module::Metadata' => '1.000033', + 'NEXT' => '0.67', + 'Net::Cmd' => '3.10', + 'Net::Config' => '3.10', + 'Net::Domain' => '3.10', + 'Net::FTP' => '3.10', + 'Net::FTP::A' => '3.10', + 'Net::FTP::E' => '3.10', + 'Net::FTP::I' => '3.10', + 'Net::FTP::L' => '3.10', + 'Net::FTP::dataconn' => '3.10', + 'Net::NNTP' => '3.10', + 'Net::Netrc' => '3.10', + 'Net::POP3' => '3.10', + 'Net::Ping' => '2.44', + 'Net::SMTP' => '3.10', + 'Net::Time' => '3.10', + 'Opcode' => '1.37', + 'POSIX' => '1.71', + 'Parse::CPAN::Meta' => '2.150010', + 'Pod::Html' => '1.2201', + 'Pod::Perldoc' => '3.27', + 'Pod::Perldoc::BaseTo' => '3.27', + 'Pod::Perldoc::GetOptsOO'=> '3.27', + 'Pod::Perldoc::ToANSI' => '3.27', + 'Pod::Perldoc::ToChecker'=> '3.27', + 'Pod::Perldoc::ToMan' => '3.27', + 'Pod::Perldoc::ToNroff' => '3.27', + 'Pod::Perldoc::ToPod' => '3.27', + 'Pod::Perldoc::ToRtf' => '3.27', + 'Pod::Perldoc::ToTerm' => '3.27', + 'Pod::Perldoc::ToText' => '3.27', + 'Pod::Perldoc::ToTk' => '3.27', + 'Pod::Perldoc::ToXml' => '3.27', + 'Storable' => '2.57', + 'Sys::Syslog' => '0.34_01', + 'TAP::Base' => '3.36_01', + 'TAP::Formatter::Base' => '3.36_01', + 'TAP::Formatter::Color' => '3.36_01', + 'TAP::Formatter::Console'=> '3.36_01', + 'TAP::Formatter::Console::ParallelSession'=> '3.36_01', + 'TAP::Formatter::Console::Session'=> '3.36_01', + 'TAP::Formatter::File' => '3.36_01', + 'TAP::Formatter::File::Session'=> '3.36_01', + 'TAP::Formatter::Session'=> '3.36_01', + 'TAP::Harness' => '3.36_01', + 'TAP::Harness::Env' => '3.36_01', + 'TAP::Object' => '3.36_01', + 'TAP::Parser' => '3.36_01', + 'TAP::Parser::Aggregator'=> '3.36_01', + 'TAP::Parser::Grammar' => '3.36_01', + 'TAP::Parser::Iterator' => '3.36_01', + 'TAP::Parser::Iterator::Array'=> '3.36_01', + 'TAP::Parser::Iterator::Process'=> '3.36_01', + 'TAP::Parser::Iterator::Stream'=> '3.36_01', + 'TAP::Parser::IteratorFactory'=> '3.36_01', + 'TAP::Parser::Multiplexer'=> '3.36_01', + 'TAP::Parser::Result' => '3.36_01', + 'TAP::Parser::Result::Bailout'=> '3.36_01', + 'TAP::Parser::Result::Comment'=> '3.36_01', + 'TAP::Parser::Result::Plan'=> '3.36_01', + 'TAP::Parser::Result::Pragma'=> '3.36_01', + 'TAP::Parser::Result::Test'=> '3.36_01', + 'TAP::Parser::Result::Unknown'=> '3.36_01', + 'TAP::Parser::Result::Version'=> '3.36_01', + 'TAP::Parser::Result::YAML'=> '3.36_01', + 'TAP::Parser::ResultFactory'=> '3.36_01', + 'TAP::Parser::Scheduler'=> '3.36_01', + 'TAP::Parser::Scheduler::Job'=> '3.36_01', + 'TAP::Parser::Scheduler::Spinner'=> '3.36_01', + 'TAP::Parser::Source' => '3.36_01', + 'TAP::Parser::SourceHandler'=> '3.36_01', + 'TAP::Parser::SourceHandler::Executable'=> '3.36_01', + 'TAP::Parser::SourceHandler::File'=> '3.36_01', + 'TAP::Parser::SourceHandler::Handle'=> '3.36_01', + 'TAP::Parser::SourceHandler::Perl'=> '3.36_01', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.36_01', + 'TAP::Parser::YAMLish::Reader'=> '3.36_01', + 'TAP::Parser::YAMLish::Writer'=> '3.36_01', + 'Test' => '1.29', + 'Test2' => '1.302052', + 'Test2::API' => '1.302052', + 'Test2::API::Breakage' => '1.302052', + 'Test2::API::Context' => '1.302052', + 'Test2::API::Instance' => '1.302052', + 'Test2::API::Stack' => '1.302052', + 'Test2::Event' => '1.302052', + 'Test2::Event::Bail' => '1.302052', + 'Test2::Event::Diag' => '1.302052', + 'Test2::Event::Exception'=> '1.302052', + 'Test2::Event::Generic' => '1.302052', + 'Test2::Event::Info' => '1.302052', + 'Test2::Event::Note' => '1.302052', + 'Test2::Event::Ok' => '1.302052', + 'Test2::Event::Plan' => '1.302052', + 'Test2::Event::Skip' => '1.302052', + 'Test2::Event::Subtest' => '1.302052', + 'Test2::Event::Waiting' => '1.302052', + 'Test2::Formatter' => '1.302052', + 'Test2::Formatter::TAP' => '1.302052', + 'Test2::Hub' => '1.302052', + 'Test2::Hub::Interceptor'=> '1.302052', + 'Test2::Hub::Interceptor::Terminator'=> '1.302052', + 'Test2::Hub::Subtest' => '1.302052', + 'Test2::IPC' => '1.302052', + 'Test2::IPC::Driver' => '1.302052', + 'Test2::IPC::Driver::Files'=> '1.302052', + 'Test2::Util' => '1.302052', + 'Test2::Util::ExternalMeta'=> '1.302052', + 'Test2::Util::HashBase' => '1.302052', + 'Test2::Util::Trace' => '1.302052', + 'Test::Builder' => '1.302052', + 'Test::Builder::Formatter'=> '1.302052', + 'Test::Builder::Module' => '1.302052', + 'Test::Builder::Tester' => '1.302052', + 'Test::Builder::Tester::Color'=> '1.302052', + 'Test::Builder::TodoDiag'=> '1.302052', + 'Test::Harness' => '3.36_01', + 'Test::More' => '1.302052', + 'Test::Simple' => '1.302052', + 'Test::Tester' => '1.302052', + 'Test::Tester::Capture' => '1.302052', + 'Test::Tester::CaptureRunner'=> '1.302052', + 'Test::Tester::Delegate'=> '1.302052', + 'Test::use::ok' => '1.302052', + 'Tie::Hash::NamedCapture'=> '0.10', + 'Time::Local' => '1.24', + 'XS::APItest' => '0.83', + 'arybase' => '0.12', + 'base' => '2.24', + 'bigint' => '0.43_01', + 'bignum' => '0.43_01', + 'bigrat' => '0.43_01', + 'encoding' => '2.18', + 'ok' => '1.302052', + }, + removed => { + } + }, + 5.025005 => { + delta_from => 5.025004, + changed => { + 'B::Op_private' => '5.025005', + 'Config' => '5.025005', + 'Filter::Simple' => '0.93', + 'Locale::Codes' => '3.40', + 'Locale::Codes::Constants'=> '3.40', + 'Locale::Codes::Country'=> '3.40', + 'Locale::Codes::Country_Codes'=> '3.40', + 'Locale::Codes::Country_Retired'=> '3.40', + 'Locale::Codes::Currency'=> '3.40', + 'Locale::Codes::Currency_Codes'=> '3.40', + 'Locale::Codes::Currency_Retired'=> '3.40', + 'Locale::Codes::LangExt'=> '3.40', + 'Locale::Codes::LangExt_Codes'=> '3.40', + 'Locale::Codes::LangExt_Retired'=> '3.40', + 'Locale::Codes::LangFam'=> '3.40', + 'Locale::Codes::LangFam_Codes'=> '3.40', + 'Locale::Codes::LangFam_Retired'=> '3.40', + 'Locale::Codes::LangVar'=> '3.40', + 'Locale::Codes::LangVar_Codes'=> '3.40', + 'Locale::Codes::LangVar_Retired'=> '3.40', + 'Locale::Codes::Language'=> '3.40', + 'Locale::Codes::Language_Codes'=> '3.40', + 'Locale::Codes::Language_Retired'=> '3.40', + 'Locale::Codes::Script' => '3.40', + 'Locale::Codes::Script_Codes'=> '3.40', + 'Locale::Codes::Script_Retired'=> '3.40', + 'Locale::Country' => '3.40', + 'Locale::Currency' => '3.40', + 'Locale::Language' => '3.40', + 'Locale::Script' => '3.40', + 'Module::CoreList' => '5.20160920', + 'Module::CoreList::TieHashDelta'=> '5.20160920', + 'Module::CoreList::Utils'=> '5.20160920', + 'POSIX' => '1.72', + 'Sys::Syslog' => '0.35', + 'Test2' => '1.302056', + 'Test2::API' => '1.302056', + 'Test2::API::Breakage' => '1.302056', + 'Test2::API::Context' => '1.302056', + 'Test2::API::Instance' => '1.302056', + 'Test2::API::Stack' => '1.302056', + 'Test2::Event' => '1.302056', + 'Test2::Event::Bail' => '1.302056', + 'Test2::Event::Diag' => '1.302056', + 'Test2::Event::Exception'=> '1.302056', + 'Test2::Event::Generic' => '1.302056', + 'Test2::Event::Info' => '1.302056', + 'Test2::Event::Note' => '1.302056', + 'Test2::Event::Ok' => '1.302056', + 'Test2::Event::Plan' => '1.302056', + 'Test2::Event::Skip' => '1.302056', + 'Test2::Event::Subtest' => '1.302056', + 'Test2::Event::Waiting' => '1.302056', + 'Test2::Formatter' => '1.302056', + 'Test2::Formatter::TAP' => '1.302056', + 'Test2::Hub' => '1.302056', + 'Test2::Hub::Interceptor'=> '1.302056', + 'Test2::Hub::Interceptor::Terminator'=> '1.302056', + 'Test2::Hub::Subtest' => '1.302056', + 'Test2::IPC' => '1.302056', + 'Test2::IPC::Driver' => '1.302056', + 'Test2::IPC::Driver::Files'=> '1.302056', + 'Test2::Util' => '1.302056', + 'Test2::Util::ExternalMeta'=> '1.302056', + 'Test2::Util::HashBase' => '1.302056', + 'Test2::Util::Trace' => '1.302056', + 'Test::Builder' => '1.302056', + 'Test::Builder::Formatter'=> '1.302056', + 'Test::Builder::Module' => '1.302056', + 'Test::Builder::Tester' => '1.302056', + 'Test::Builder::Tester::Color'=> '1.302056', + 'Test::Builder::TodoDiag'=> '1.302056', + 'Test::More' => '1.302056', + 'Test::Simple' => '1.302056', + 'Test::Tester' => '1.302056', + 'Test::Tester::Capture' => '1.302056', + 'Test::Tester::CaptureRunner'=> '1.302056', + 'Test::Tester::Delegate'=> '1.302056', + 'Test::use::ok' => '1.302056', + 'Thread::Semaphore' => '2.13', + 'XS::APItest' => '0.84', + 'XSLoader' => '0.24', + 'ok' => '1.302056', + }, + removed => { + } + }, + 5.025006 => { + delta_from => 5.025005, + changed => { + 'Archive::Tar' => '2.14', + 'Archive::Tar::Constant'=> '2.14', + 'Archive::Tar::File' => '2.14', + 'B' => '1.64', + 'B::Concise' => '0.999', + 'B::Deparse' => '1.39', + 'B::Op_private' => '5.025006', + 'Config' => '5.025006', + 'Data::Dumper' => '2.162', + 'Devel::Peek' => '1.25', + 'HTTP::Tiny' => '0.070', + 'List::Util' => '1.46', + 'List::Util::XS' => '1.46', + 'Module::CoreList' => '5.20161020', + 'Module::CoreList::TieHashDelta'=> '5.20161020', + 'Module::CoreList::Utils'=> '5.20161020', + 'Net::Ping' => '2.51', + 'OS2::DLL' => '1.07', + 'Opcode' => '1.38', + 'POSIX' => '1.73', + 'PerlIO::encoding' => '0.25', + 'Pod::Man' => '4.08', + 'Pod::ParseLink' => '4.08', + 'Pod::Text' => '4.08', + 'Pod::Text::Color' => '4.08', + 'Pod::Text::Overstrike' => '4.08', + 'Pod::Text::Termcap' => '4.08', + 'Scalar::Util' => '1.46', + 'Storable' => '2.58', + 'Sub::Util' => '1.46', + 'Test2' => '1.302059', + 'Test2::API' => '1.302059', + 'Test2::API::Breakage' => '1.302059', + 'Test2::API::Context' => '1.302059', + 'Test2::API::Instance' => '1.302059', + 'Test2::API::Stack' => '1.302059', + 'Test2::Event' => '1.302059', + 'Test2::Event::Bail' => '1.302059', + 'Test2::Event::Diag' => '1.302059', + 'Test2::Event::Exception'=> '1.302059', + 'Test2::Event::Generic' => '1.302059', + 'Test2::Event::Info' => '1.302059', + 'Test2::Event::Note' => '1.302059', + 'Test2::Event::Ok' => '1.302059', + 'Test2::Event::Plan' => '1.302059', + 'Test2::Event::Skip' => '1.302059', + 'Test2::Event::Subtest' => '1.302059', + 'Test2::Event::Waiting' => '1.302059', + 'Test2::Formatter' => '1.302059', + 'Test2::Formatter::TAP' => '1.302059', + 'Test2::Hub' => '1.302059', + 'Test2::Hub::Interceptor'=> '1.302059', + 'Test2::Hub::Interceptor::Terminator'=> '1.302059', + 'Test2::Hub::Subtest' => '1.302059', + 'Test2::IPC' => '1.302059', + 'Test2::IPC::Driver' => '1.302059', + 'Test2::IPC::Driver::Files'=> '1.302059', + 'Test2::Util' => '1.302059', + 'Test2::Util::ExternalMeta'=> '1.302059', + 'Test2::Util::HashBase' => '1.302059', + 'Test2::Util::Trace' => '1.302059', + 'Test::Builder' => '1.302059', + 'Test::Builder::Formatter'=> '1.302059', + 'Test::Builder::Module' => '1.302059', + 'Test::Builder::Tester' => '1.302059', + 'Test::Builder::Tester::Color'=> '1.302059', + 'Test::Builder::TodoDiag'=> '1.302059', + 'Test::More' => '1.302059', + 'Test::Simple' => '1.302059', + 'Test::Tester' => '1.302059', + 'Test::Tester::Capture' => '1.302059', + 'Test::Tester::CaptureRunner'=> '1.302059', + 'Test::Tester::Delegate'=> '1.302059', + 'Test::use::ok' => '1.302059', + 'Time::HiRes' => '1.9740_01', + 'VMS::Stdio' => '2.42', + 'XS::APItest' => '0.86', + 'attributes' => '0.28', + 'mro' => '1.19', + 'ok' => '1.302059', + 'overload' => '1.27', + 'parent' => '0.236', + }, + removed => { + } + }, + 5.025007 => { + delta_from => 5.025006, + changed => { + 'Archive::Tar' => '2.18', + 'Archive::Tar::Constant'=> '2.18', + 'Archive::Tar::File' => '2.18', + 'B' => '1.65', + 'B::Op_private' => '5.025007', + 'Config' => '5.025007', + 'Cwd' => '3.66', + 'Data::Dumper' => '2.165', + 'Devel::Peek' => '1.26', + 'DynaLoader' => '1.40', + 'Errno' => '1.27', + 'ExtUtils::ParseXS::Utilities'=> '3.34', + 'File::Spec' => '3.66', + 'File::Spec::AmigaOS' => '3.66', + 'File::Spec::Cygwin' => '3.66', + 'File::Spec::Epoc' => '3.66', + 'File::Spec::Functions' => '3.66', + 'File::Spec::Mac' => '3.66', + 'File::Spec::OS2' => '3.66', + 'File::Spec::Unix' => '3.66', + 'File::Spec::VMS' => '3.66', + 'File::Spec::Win32' => '3.66', + 'Hash::Util' => '0.22', + 'JSON::PP' => '2.27400_02', + 'List::Util' => '1.46_02', + 'List::Util::XS' => '1.46_02', + 'Math::BigFloat' => '1.999727', + 'Math::BigInt' => '1.999727', + 'Math::BigInt::Calc' => '1.999727', + 'Math::BigInt::CalcEmu' => '1.999727', + 'Math::Complex' => '1.5901', + 'Module::CoreList' => '5.20161120', + 'Module::CoreList::TieHashDelta'=> '5.20161120', + 'Module::CoreList::Utils'=> '5.20161120', + 'Net::Ping' => '2.55', + 'Opcode' => '1.39', + 'POSIX' => '1.75', + 'Pod::Man' => '4.09', + 'Pod::ParseLink' => '4.09', + 'Pod::Text' => '4.09', + 'Pod::Text::Color' => '4.09', + 'Pod::Text::Overstrike' => '4.09', + 'Pod::Text::Termcap' => '4.09', + 'Scalar::Util' => '1.46_02', + 'Storable' => '2.59', + 'Sub::Util' => '1.46_02', + 'Term::ANSIColor' => '4.06', + 'Test2' => '1.302062', + 'Test2::API' => '1.302062', + 'Test2::API::Breakage' => '1.302062', + 'Test2::API::Context' => '1.302062', + 'Test2::API::Instance' => '1.302062', + 'Test2::API::Stack' => '1.302062', + 'Test2::Event' => '1.302062', + 'Test2::Event::Bail' => '1.302062', + 'Test2::Event::Diag' => '1.302062', + 'Test2::Event::Exception'=> '1.302062', + 'Test2::Event::Generic' => '1.302062', + 'Test2::Event::Info' => '1.302062', + 'Test2::Event::Note' => '1.302062', + 'Test2::Event::Ok' => '1.302062', + 'Test2::Event::Plan' => '1.302062', + 'Test2::Event::Skip' => '1.302062', + 'Test2::Event::Subtest' => '1.302062', + 'Test2::Event::Waiting' => '1.302062', + 'Test2::Formatter' => '1.302062', + 'Test2::Formatter::TAP' => '1.302062', + 'Test2::Hub' => '1.302062', + 'Test2::Hub::Interceptor'=> '1.302062', + 'Test2::Hub::Interceptor::Terminator'=> '1.302062', + 'Test2::Hub::Subtest' => '1.302062', + 'Test2::IPC' => '1.302062', + 'Test2::IPC::Driver' => '1.302062', + 'Test2::IPC::Driver::Files'=> '1.302062', + 'Test2::Util' => '1.302062', + 'Test2::Util::ExternalMeta'=> '1.302062', + 'Test2::Util::HashBase' => '1.302062', + 'Test2::Util::Trace' => '1.302062', + 'Test::Builder' => '1.302062', + 'Test::Builder::Formatter'=> '1.302062', + 'Test::Builder::Module' => '1.302062', + 'Test::Builder::Tester' => '1.302062', + 'Test::Builder::Tester::Color'=> '1.302062', + 'Test::Builder::TodoDiag'=> '1.302062', + 'Test::More' => '1.302062', + 'Test::Simple' => '1.302062', + 'Test::Tester' => '1.302062', + 'Test::Tester::Capture' => '1.302062', + 'Test::Tester::CaptureRunner'=> '1.302062', + 'Test::Tester::Delegate'=> '1.302062', + 'Test::use::ok' => '1.302062', + 'Time::HiRes' => '1.9740_03', + 'Unicode::Collate' => '1.18', + 'Unicode::Collate::CJK::Big5'=> '1.18', + 'Unicode::Collate::CJK::GB2312'=> '1.18', + 'Unicode::Collate::CJK::JISX0208'=> '1.18', + 'Unicode::Collate::CJK::Korean'=> '1.18', + 'Unicode::Collate::CJK::Pinyin'=> '1.18', + 'Unicode::Collate::CJK::Stroke'=> '1.18', + 'Unicode::Collate::CJK::Zhuyin'=> '1.18', + 'Unicode::Collate::Locale'=> '1.18', + 'Unicode::UCD' => '0.67', + 'XS::APItest' => '0.87', + 'XS::Typemap' => '0.15', + 'mro' => '1.20', + 'ok' => '1.302062', + 'threads' => '2.10', + }, + removed => { + } + }, + 5.025008 => { + delta_from => 5.025007, + changed => { + 'Archive::Tar' => '2.24', + 'Archive::Tar::Constant'=> '2.24', + 'Archive::Tar::File' => '2.24', + 'B::Debug' => '1.24', + 'B::Op_private' => '5.025008', + 'Config' => '5.025008', + 'Data::Dumper' => '2.166', + 'Encode' => '2.88', + 'Encode::Alias' => '2.21', + 'Encode::CN::HZ' => '2.08', + 'Encode::MIME::Header' => '2.24', + 'Encode::MIME::Name' => '1.02', + 'Encode::Unicode' => '2.1501', + 'IO' => '1.38', + 'Locale::Codes' => '3.42', + 'Locale::Codes::Constants'=> '3.42', + 'Locale::Codes::Country'=> '3.42', + 'Locale::Codes::Country_Codes'=> '3.42', + 'Locale::Codes::Country_Retired'=> '3.42', + 'Locale::Codes::Currency'=> '3.42', + 'Locale::Codes::Currency_Codes'=> '3.42', + 'Locale::Codes::Currency_Retired'=> '3.42', + 'Locale::Codes::LangExt'=> '3.42', + 'Locale::Codes::LangExt_Codes'=> '3.42', + 'Locale::Codes::LangExt_Retired'=> '3.42', + 'Locale::Codes::LangFam'=> '3.42', + 'Locale::Codes::LangFam_Codes'=> '3.42', + 'Locale::Codes::LangFam_Retired'=> '3.42', + 'Locale::Codes::LangVar'=> '3.42', + 'Locale::Codes::LangVar_Codes'=> '3.42', + 'Locale::Codes::LangVar_Retired'=> '3.42', + 'Locale::Codes::Language'=> '3.42', + 'Locale::Codes::Language_Codes'=> '3.42', + 'Locale::Codes::Language_Retired'=> '3.42', + 'Locale::Codes::Script' => '3.42', + 'Locale::Codes::Script_Codes'=> '3.42', + 'Locale::Codes::Script_Retired'=> '3.42', + 'Locale::Country' => '3.42', + 'Locale::Currency' => '3.42', + 'Locale::Language' => '3.42', + 'Locale::Script' => '3.42', + 'Math::BigFloat' => '1.999806', + 'Math::BigFloat::Trace' => '0.47', + 'Math::BigInt' => '1.999806', + 'Math::BigInt::Calc' => '1.999806', + 'Math::BigInt::CalcEmu' => '1.999806', + 'Math::BigInt::FastCalc'=> '0.5005', + 'Math::BigInt::Lib' => '1.999806', + 'Math::BigInt::Trace' => '0.47', + 'Math::BigRat' => '0.2611', + 'Module::CoreList' => '5.20161220', + 'Module::CoreList::TieHashDelta'=> '5.20161220', + 'Module::CoreList::Utils'=> '5.20161220', + 'POSIX' => '1.76', + 'PerlIO::scalar' => '0.25', + 'Pod::Simple' => '3.35', + 'Pod::Simple::BlackBox' => '3.35', + 'Pod::Simple::Checker' => '3.35', + 'Pod::Simple::Debug' => '3.35', + 'Pod::Simple::DumpAsText'=> '3.35', + 'Pod::Simple::DumpAsXML'=> '3.35', + 'Pod::Simple::HTML' => '3.35', + 'Pod::Simple::HTMLBatch'=> '3.35', + 'Pod::Simple::LinkSection'=> '3.35', + 'Pod::Simple::Methody' => '3.35', + 'Pod::Simple::Progress' => '3.35', + 'Pod::Simple::PullParser'=> '3.35', + 'Pod::Simple::PullParserEndToken'=> '3.35', + 'Pod::Simple::PullParserStartToken'=> '3.35', + 'Pod::Simple::PullParserTextToken'=> '3.35', + 'Pod::Simple::PullParserToken'=> '3.35', + 'Pod::Simple::RTF' => '3.35', + 'Pod::Simple::Search' => '3.35', + 'Pod::Simple::SimpleTree'=> '3.35', + 'Pod::Simple::Text' => '3.35', + 'Pod::Simple::TextContent'=> '3.35', + 'Pod::Simple::TiedOutFH'=> '3.35', + 'Pod::Simple::Transcode'=> '3.35', + 'Pod::Simple::TranscodeDumb'=> '3.35', + 'Pod::Simple::TranscodeSmart'=> '3.35', + 'Pod::Simple::XHTML' => '3.35', + 'Pod::Simple::XMLOutStream'=> '3.35', + 'Test2' => '1.302073', + 'Test2::API' => '1.302073', + 'Test2::API::Breakage' => '1.302073', + 'Test2::API::Context' => '1.302073', + 'Test2::API::Instance' => '1.302073', + 'Test2::API::Stack' => '1.302073', + 'Test2::Event' => '1.302073', + 'Test2::Event::Bail' => '1.302073', + 'Test2::Event::Diag' => '1.302073', + 'Test2::Event::Encoding'=> '1.302073', + 'Test2::Event::Exception'=> '1.302073', + 'Test2::Event::Generic' => '1.302073', + 'Test2::Event::Info' => '1.302073', + 'Test2::Event::Note' => '1.302073', + 'Test2::Event::Ok' => '1.302073', + 'Test2::Event::Plan' => '1.302073', + 'Test2::Event::Skip' => '1.302073', + 'Test2::Event::Subtest' => '1.302073', + 'Test2::Event::TAP::Version'=> '1.302073', + 'Test2::Event::Waiting' => '1.302073', + 'Test2::Formatter' => '1.302073', + 'Test2::Formatter::TAP' => '1.302073', + 'Test2::Hub' => '1.302073', + 'Test2::Hub::Interceptor'=> '1.302073', + 'Test2::Hub::Interceptor::Terminator'=> '1.302073', + 'Test2::Hub::Subtest' => '1.302073', + 'Test2::IPC' => '1.302073', + 'Test2::IPC::Driver' => '1.302073', + 'Test2::IPC::Driver::Files'=> '1.302073', + 'Test2::Tools::Tiny' => '1.302073', + 'Test2::Util' => '1.302073', + 'Test2::Util::ExternalMeta'=> '1.302073', + 'Test2::Util::HashBase' => '0.002', + 'Test2::Util::Trace' => '1.302073', + 'Test::Builder' => '1.302073', + 'Test::Builder::Formatter'=> '1.302073', + 'Test::Builder::Module' => '1.302073', + 'Test::Builder::Tester' => '1.302073', + 'Test::Builder::Tester::Color'=> '1.302073', + 'Test::Builder::TodoDiag'=> '1.302073', + 'Test::More' => '1.302073', + 'Test::Simple' => '1.302073', + 'Test::Tester' => '1.302073', + 'Test::Tester::Capture' => '1.302073', + 'Test::Tester::CaptureRunner'=> '1.302073', + 'Test::Tester::Delegate'=> '1.302073', + 'Test::use::ok' => '1.302073', + 'Time::HiRes' => '1.9741', + 'Time::Local' => '1.25', + 'Unicode::Collate' => '1.19', + 'Unicode::Collate::CJK::Big5'=> '1.19', + 'Unicode::Collate::CJK::GB2312'=> '1.19', + 'Unicode::Collate::CJK::JISX0208'=> '1.19', + 'Unicode::Collate::CJK::Korean'=> '1.19', + 'Unicode::Collate::CJK::Pinyin'=> '1.19', + 'Unicode::Collate::CJK::Stroke'=> '1.19', + 'Unicode::Collate::CJK::Zhuyin'=> '1.19', + 'Unicode::Collate::Locale'=> '1.19', + 'bigint' => '0.47', + 'bignum' => '0.47', + 'bigrat' => '0.47', + 'encoding' => '2.19', + 'ok' => '1.302073', + }, + removed => { + } + }, + 5.022003 => { + delta_from => 5.022002, + changed => { + 'App::Cpan' => '1.63_01', + 'App::Prove' => '3.35_01', + 'App::Prove::State' => '3.35_01', + 'App::Prove::State::Result'=> '3.35_01', + 'App::Prove::State::Result::Test'=> '3.35_01', + 'Archive::Tar' => '2.04_01', + 'Archive::Tar::Constant'=> '2.04_01', + 'Archive::Tar::File' => '2.04_01', + 'B::Op_private' => '5.022003', + 'CPAN' => '2.11_01', + 'Compress::Zlib' => '2.068_001', + 'Config' => '5.022003', + 'Cwd' => '3.56_02', + 'Digest' => '1.17_01', + 'Digest::SHA' => '5.95_01', + 'Encode' => '2.72_01', + 'ExtUtils::Command' => '1.20_01', + 'ExtUtils::Command::MM' => '7.04_02', + 'ExtUtils::Liblist' => '7.04_02', + 'ExtUtils::Liblist::Kid'=> '7.04_02', + 'ExtUtils::MM' => '7.04_02', + 'ExtUtils::MM_AIX' => '7.04_02', + 'ExtUtils::MM_Any' => '7.04_02', + 'ExtUtils::MM_BeOS' => '7.04_02', + 'ExtUtils::MM_Cygwin' => '7.04_02', + 'ExtUtils::MM_DOS' => '7.04_02', + 'ExtUtils::MM_Darwin' => '7.04_02', + 'ExtUtils::MM_MacOS' => '7.04_02', + 'ExtUtils::MM_NW5' => '7.04_02', + 'ExtUtils::MM_OS2' => '7.04_02', + 'ExtUtils::MM_QNX' => '7.04_02', + 'ExtUtils::MM_UWIN' => '7.04_02', + 'ExtUtils::MM_Unix' => '7.04_02', + 'ExtUtils::MM_VMS' => '7.04_02', + 'ExtUtils::MM_VOS' => '7.04_02', + 'ExtUtils::MM_Win32' => '7.04_02', + 'ExtUtils::MM_Win95' => '7.04_02', + 'ExtUtils::MY' => '7.04_02', + 'ExtUtils::MakeMaker' => '7.04_02', + 'ExtUtils::MakeMaker::Config'=> '7.04_02', + 'ExtUtils::Mkbootstrap' => '7.04_02', + 'ExtUtils::Mksymlists' => '7.04_02', + 'ExtUtils::testlib' => '7.04_02', + 'File::Fetch' => '0.48_01', + 'File::Spec' => '3.56_02', + 'File::Spec::Cygwin' => '3.56_02', + 'File::Spec::Epoc' => '3.56_02', + 'File::Spec::Functions' => '3.56_02', + 'File::Spec::Mac' => '3.56_02', + 'File::Spec::OS2' => '3.56_02', + 'File::Spec::Unix' => '3.56_02', + 'File::Spec::VMS' => '3.56_02', + 'File::Spec::Win32' => '3.56_02', + 'HTTP::Tiny' => '0.054_01', + 'I18N::LangTags::Detect'=> '1.05_01', + 'IO' => '1.35_01', + 'IO::Compress::Adapter::Bzip2'=> '2.068_001', + 'IO::Compress::Adapter::Deflate'=> '2.068_001', + 'IO::Compress::Adapter::Identity'=> '2.068_001', + 'IO::Compress::Base' => '2.068_001', + 'IO::Compress::Base::Common'=> '2.068_001', + 'IO::Compress::Bzip2' => '2.068_001', + 'IO::Compress::Deflate' => '2.068_001', + 'IO::Compress::Gzip' => '2.068_001', + 'IO::Compress::Gzip::Constants'=> '2.068_001', + 'IO::Compress::RawDeflate'=> '2.068_001', + 'IO::Compress::Zip' => '2.068_001', + 'IO::Compress::Zip::Constants'=> '2.068_001', + 'IO::Compress::Zlib::Constants'=> '2.068_001', + 'IO::Compress::Zlib::Extra'=> '2.068_001', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.068_001', + 'IO::Uncompress::Adapter::Identity'=> '2.068_001', + 'IO::Uncompress::Adapter::Inflate'=> '2.068_001', + 'IO::Uncompress::AnyInflate'=> '2.068_001', + 'IO::Uncompress::AnyUncompress'=> '2.068_001', + 'IO::Uncompress::Base' => '2.068_001', + 'IO::Uncompress::Bunzip2'=> '2.068_001', + 'IO::Uncompress::Gunzip'=> '2.068_001', + 'IO::Uncompress::Inflate'=> '2.068_001', + 'IO::Uncompress::RawInflate'=> '2.068_001', + 'IO::Uncompress::Unzip' => '2.068_001', + 'IPC::Cmd' => '0.92_01', + 'JSON::PP' => '2.27300_01', + 'Locale::Maketext' => '1.26_01', + 'Locale::Maketext::Simple'=> '0.21_01', + 'Memoize' => '1.03_01', + 'Module::CoreList' => '5.20170114_22', + 'Module::CoreList::TieHashDelta'=> '5.20170114_22', + 'Module::CoreList::Utils'=> '5.20170114_22', + 'Module::Metadata::corpus::BOMTest::UTF16BE'=> undef, + 'Module::Metadata::corpus::BOMTest::UTF16LE'=> undef, + 'Module::Metadata::corpus::BOMTest::UTF8'=> '1', + 'Net::Cmd' => '3.05_01', + 'Net::Config' => '3.05_01', + 'Net::Domain' => '3.05_01', + 'Net::FTP' => '3.05_01', + 'Net::FTP::A' => '3.05_01', + 'Net::FTP::E' => '3.05_01', + 'Net::FTP::I' => '3.05_01', + 'Net::FTP::L' => '3.05_01', + 'Net::FTP::dataconn' => '3.05_01', + 'Net::NNTP' => '3.05_01', + 'Net::Netrc' => '3.05_01', + 'Net::POP3' => '3.05_01', + 'Net::Ping' => '2.43_01', + 'Net::SMTP' => '3.05_01', + 'Net::Time' => '3.05_01', + 'Parse::CPAN::Meta' => '1.4414_001', + 'Pod::Html' => '1.2201', + 'Pod::Perldoc' => '3.25_01', + 'Storable' => '2.53_02', + 'Sys::Syslog' => '0.33_01', + 'TAP::Base' => '3.35_01', + 'TAP::Formatter::Base' => '3.35_01', + 'TAP::Formatter::Color' => '3.35_01', + 'TAP::Formatter::Console'=> '3.35_01', + 'TAP::Formatter::Console::ParallelSession'=> '3.35_01', + 'TAP::Formatter::Console::Session'=> '3.35_01', + 'TAP::Formatter::File' => '3.35_01', + 'TAP::Formatter::File::Session'=> '3.35_01', + 'TAP::Formatter::Session'=> '3.35_01', + 'TAP::Harness' => '3.35_01', + 'TAP::Harness::Env' => '3.35_01', + 'TAP::Object' => '3.35_01', + 'TAP::Parser' => '3.35_01', + 'TAP::Parser::Aggregator'=> '3.35_01', + 'TAP::Parser::Grammar' => '3.35_01', + 'TAP::Parser::Iterator' => '3.35_01', + 'TAP::Parser::Iterator::Array'=> '3.35_01', + 'TAP::Parser::Iterator::Process'=> '3.35_01', + 'TAP::Parser::Iterator::Stream'=> '3.35_01', + 'TAP::Parser::IteratorFactory'=> '3.35_01', + 'TAP::Parser::Multiplexer'=> '3.35_01', + 'TAP::Parser::Result' => '3.35_01', + 'TAP::Parser::Result::Bailout'=> '3.35_01', + 'TAP::Parser::Result::Comment'=> '3.35_01', + 'TAP::Parser::Result::Plan'=> '3.35_01', + 'TAP::Parser::Result::Pragma'=> '3.35_01', + 'TAP::Parser::Result::Test'=> '3.35_01', + 'TAP::Parser::Result::Unknown'=> '3.35_01', + 'TAP::Parser::Result::Version'=> '3.35_01', + 'TAP::Parser::Result::YAML'=> '3.35_01', + 'TAP::Parser::ResultFactory'=> '3.35_01', + 'TAP::Parser::Scheduler'=> '3.35_01', + 'TAP::Parser::Scheduler::Job'=> '3.35_01', + 'TAP::Parser::Scheduler::Spinner'=> '3.35_01', + 'TAP::Parser::Source' => '3.35_01', + 'TAP::Parser::SourceHandler'=> '3.35_01', + 'TAP::Parser::SourceHandler::Executable'=> '3.35_01', + 'TAP::Parser::SourceHandler::File'=> '3.35_01', + 'TAP::Parser::SourceHandler::Handle'=> '3.35_01', + 'TAP::Parser::SourceHandler::Perl'=> '3.35_01', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.35_01', + 'TAP::Parser::YAMLish::Reader'=> '3.35_01', + 'TAP::Parser::YAMLish::Writer'=> '3.35_01', + 'Test' => '1.26_01', + 'Test::Harness' => '3.35_01', + 'XSLoader' => '0.20_01', + 'bigint' => '0.39_01', + 'bignum' => '0.39_01', + 'bigrat' => '0.39_01', + }, + removed => { + } + }, + 5.024001 => { + delta_from => 5.024000, + changed => { + 'App::Cpan' => '1.63_01', + 'App::Prove' => '3.36_01', + 'App::Prove::State' => '3.36_01', + 'App::Prove::State::Result'=> '3.36_01', + 'App::Prove::State::Result::Test'=> '3.36_01', + 'Archive::Tar' => '2.04_01', + 'Archive::Tar::Constant'=> '2.04_01', + 'Archive::Tar::File' => '2.04_01', + 'B::Op_private' => '5.024001', + 'CPAN' => '2.11_01', + 'Compress::Zlib' => '2.069_001', + 'Config' => '5.024001', + 'Cwd' => '3.63_01', + 'Digest' => '1.17_01', + 'Digest::SHA' => '5.95_01', + 'Encode' => '2.80_01', + 'ExtUtils::Command' => '7.10_02', + 'ExtUtils::Command::MM' => '7.10_02', + 'ExtUtils::Liblist' => '7.10_02', + 'ExtUtils::Liblist::Kid'=> '7.10_02', + 'ExtUtils::MM' => '7.10_02', + 'ExtUtils::MM_AIX' => '7.10_02', + 'ExtUtils::MM_Any' => '7.10_02', + 'ExtUtils::MM_BeOS' => '7.10_02', + 'ExtUtils::MM_Cygwin' => '7.10_02', + 'ExtUtils::MM_DOS' => '7.10_02', + 'ExtUtils::MM_Darwin' => '7.10_02', + 'ExtUtils::MM_MacOS' => '7.10_02', + 'ExtUtils::MM_NW5' => '7.10_02', + 'ExtUtils::MM_OS2' => '7.10_02', + 'ExtUtils::MM_QNX' => '7.10_02', + 'ExtUtils::MM_UWIN' => '7.10_02', + 'ExtUtils::MM_Unix' => '7.10_02', + 'ExtUtils::MM_VMS' => '7.10_02', + 'ExtUtils::MM_VOS' => '7.10_02', + 'ExtUtils::MM_Win32' => '7.10_02', + 'ExtUtils::MM_Win95' => '7.10_02', + 'ExtUtils::MY' => '7.10_02', + 'ExtUtils::MakeMaker' => '7.10_02', + 'ExtUtils::MakeMaker::Config'=> '7.10_02', + 'ExtUtils::Mkbootstrap' => '7.10_02', + 'ExtUtils::Mksymlists' => '7.10_02', + 'ExtUtils::testlib' => '7.10_02', + 'File::Fetch' => '0.48_01', + 'File::Spec' => '3.63_01', + 'File::Spec::Cygwin' => '3.63_01', + 'File::Spec::Epoc' => '3.63_01', + 'File::Spec::Functions' => '3.63_01', + 'File::Spec::Mac' => '3.63_01', + 'File::Spec::OS2' => '3.63_01', + 'File::Spec::Unix' => '3.63_01', + 'File::Spec::VMS' => '3.63_01', + 'File::Spec::Win32' => '3.63_01', + 'HTTP::Tiny' => '0.056_001', + 'I18N::LangTags::Detect'=> '1.05_01', + 'IO' => '1.36_01', + 'IO::Compress::Adapter::Bzip2'=> '2.069_001', + 'IO::Compress::Adapter::Deflate'=> '2.069_001', + 'IO::Compress::Adapter::Identity'=> '2.069_001', + 'IO::Compress::Base' => '2.069_001', + 'IO::Compress::Base::Common'=> '2.069_001', + 'IO::Compress::Bzip2' => '2.069_001', + 'IO::Compress::Deflate' => '2.069_001', + 'IO::Compress::Gzip' => '2.069_001', + 'IO::Compress::Gzip::Constants'=> '2.069_001', + 'IO::Compress::RawDeflate'=> '2.069_001', + 'IO::Compress::Zip' => '2.069_001', + 'IO::Compress::Zip::Constants'=> '2.069_001', + 'IO::Compress::Zlib::Constants'=> '2.069_001', + 'IO::Compress::Zlib::Extra'=> '2.069_001', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.069_001', + 'IO::Uncompress::Adapter::Identity'=> '2.069_001', + 'IO::Uncompress::Adapter::Inflate'=> '2.069_001', + 'IO::Uncompress::AnyInflate'=> '2.069_001', + 'IO::Uncompress::AnyUncompress'=> '2.069_001', + 'IO::Uncompress::Base' => '2.069_001', + 'IO::Uncompress::Bunzip2'=> '2.069_001', + 'IO::Uncompress::Gunzip'=> '2.069_001', + 'IO::Uncompress::Inflate'=> '2.069_001', + 'IO::Uncompress::RawInflate'=> '2.069_001', + 'IO::Uncompress::Unzip' => '2.069_001', + 'IPC::Cmd' => '0.92_01', + 'JSON::PP' => '2.27300_01', + 'Locale::Maketext' => '1.26_01', + 'Locale::Maketext::Simple'=> '0.21_01', + 'Math::BigFloat::Trace' => '0.42_01', + 'Math::BigInt::Trace' => '0.42_01', + 'Memoize' => '1.03_01', + 'Module::CoreList' => '5.20170114_24', + 'Module::CoreList::TieHashDelta'=> '5.20170114_24', + 'Module::CoreList::Utils'=> '5.20170114_24', + 'Module::Metadata::corpus::BOMTest::UTF16BE'=> undef, + 'Module::Metadata::corpus::BOMTest::UTF16LE'=> undef, + 'Module::Metadata::corpus::BOMTest::UTF8'=> '1', + 'Net::Cmd' => '3.08_01', + 'Net::Config' => '3.08_01', + 'Net::Domain' => '3.08_01', + 'Net::FTP' => '3.08_01', + 'Net::FTP::A' => '3.08_01', + 'Net::FTP::E' => '3.08_01', + 'Net::FTP::I' => '3.08_01', + 'Net::FTP::L' => '3.08_01', + 'Net::FTP::dataconn' => '3.08_01', + 'Net::NNTP' => '3.08_01', + 'Net::Netrc' => '3.08_01', + 'Net::POP3' => '3.08_01', + 'Net::Ping' => '2.43_01', + 'Net::SMTP' => '3.08_01', + 'Net::Time' => '3.08_01', + 'Parse::CPAN::Meta' => '1.4417_001', + 'Pod::Html' => '1.2201', + 'Pod::Perldoc' => '3.25_03', + 'Storable' => '2.56_01', + 'Sys::Syslog' => '0.33_01', + 'TAP::Base' => '3.36_01', + 'TAP::Formatter::Base' => '3.36_01', + 'TAP::Formatter::Color' => '3.36_01', + 'TAP::Formatter::Console'=> '3.36_01', + 'TAP::Formatter::Console::ParallelSession'=> '3.36_01', + 'TAP::Formatter::Console::Session'=> '3.36_01', + 'TAP::Formatter::File' => '3.36_01', + 'TAP::Formatter::File::Session'=> '3.36_01', + 'TAP::Formatter::Session'=> '3.36_01', + 'TAP::Harness' => '3.36_01', + 'TAP::Harness::Env' => '3.36_01', + 'TAP::Object' => '3.36_01', + 'TAP::Parser' => '3.36_01', + 'TAP::Parser::Aggregator'=> '3.36_01', + 'TAP::Parser::Grammar' => '3.36_01', + 'TAP::Parser::Iterator' => '3.36_01', + 'TAP::Parser::Iterator::Array'=> '3.36_01', + 'TAP::Parser::Iterator::Process'=> '3.36_01', + 'TAP::Parser::Iterator::Stream'=> '3.36_01', + 'TAP::Parser::IteratorFactory'=> '3.36_01', + 'TAP::Parser::Multiplexer'=> '3.36_01', + 'TAP::Parser::Result' => '3.36_01', + 'TAP::Parser::Result::Bailout'=> '3.36_01', + 'TAP::Parser::Result::Comment'=> '3.36_01', + 'TAP::Parser::Result::Plan'=> '3.36_01', + 'TAP::Parser::Result::Pragma'=> '3.36_01', + 'TAP::Parser::Result::Test'=> '3.36_01', + 'TAP::Parser::Result::Unknown'=> '3.36_01', + 'TAP::Parser::Result::Version'=> '3.36_01', + 'TAP::Parser::Result::YAML'=> '3.36_01', + 'TAP::Parser::ResultFactory'=> '3.36_01', + 'TAP::Parser::Scheduler'=> '3.36_01', + 'TAP::Parser::Scheduler::Job'=> '3.36_01', + 'TAP::Parser::Scheduler::Spinner'=> '3.36_01', + 'TAP::Parser::Source' => '3.36_01', + 'TAP::Parser::SourceHandler'=> '3.36_01', + 'TAP::Parser::SourceHandler::Executable'=> '3.36_01', + 'TAP::Parser::SourceHandler::File'=> '3.36_01', + 'TAP::Parser::SourceHandler::Handle'=> '3.36_01', + 'TAP::Parser::SourceHandler::Perl'=> '3.36_01', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.36_01', + 'TAP::Parser::YAMLish::Reader'=> '3.36_01', + 'TAP::Parser::YAMLish::Writer'=> '3.36_01', + 'Test' => '1.28_01', + 'Test::Harness' => '3.36_01', + 'XSLoader' => '0.22', + 'bigint' => '0.42_01', + 'bignum' => '0.42_01', + 'bigrat' => '0.42_01', + }, + removed => { + } + }, + 5.025009 => { + delta_from => 5.025008, + changed => { + 'App::Cpan' => '1.66', + 'B::Deparse' => '1.40', + 'B::Op_private' => '5.025009', + 'B::Terse' => '1.07', + 'B::Xref' => '1.06', + 'CPAN' => '2.16', + 'CPAN::Bundle' => '5.5002', + 'CPAN::Distribution' => '2.16', + 'CPAN::Exception::RecursiveDependency'=> '5.5001', + 'CPAN::FTP' => '5.5008', + 'CPAN::FirstTime' => '5.5310', + 'CPAN::HandleConfig' => '5.5008', + 'CPAN::Module' => '5.5003', + 'Compress::Raw::Bzip2' => '2.070', + 'Compress::Raw::Zlib' => '2.070', + 'Config' => '5.025009', + 'DB_File' => '1.840', + 'Data::Dumper' => '2.167', + 'Devel::SelfStubber' => '1.06', + 'DynaLoader' => '1.41', + 'Errno' => '1.28', + 'ExtUtils::Embed' => '1.34', + 'File::Glob' => '1.28', + 'I18N::LangTags' => '0.42', + 'Module::CoreList' => '5.20170120', + 'Module::CoreList::TieHashDelta'=> '5.20170120', + 'Module::CoreList::Utils'=> '5.20170120', + 'OS2::Process' => '1.12', + 'PerlIO::scalar' => '0.26', + 'Pod::Html' => '1.2202', + 'Storable' => '2.61', + 'Symbol' => '1.08', + 'Term::ReadLine' => '1.16', + 'Test' => '1.30', + 'Unicode::UCD' => '0.68', + 'VMS::DCLsym' => '1.08', + 'XS::APItest' => '0.88', + 'XSLoader' => '0.26', + 'attributes' => '0.29', + 'diagnostics' => '1.36', + 'feature' => '1.46', + 'lib' => '0.64', + 'overload' => '1.28', + 're' => '0.34', + 'threads' => '2.12', + 'threads::shared' => '1.54', + }, + removed => { + } + }, + 5.025010 => { + delta_from => 5.025009, + changed => { + 'B' => '1.68', + 'B::Op_private' => '5.025010', + 'CPAN' => '2.17', + 'CPAN::Distribution' => '2.17', + 'Config' => '5.02501', + 'Getopt::Std' => '1.12', + 'Module::CoreList' => '5.20170220', + 'Module::CoreList::TieHashDelta'=> '5.20170220', + 'Module::CoreList::Utils'=> '5.20170220', + 'PerlIO' => '1.10', + 'Storable' => '2.62', + 'Thread::Queue' => '3.12', + 'feature' => '1.47', + 'open' => '1.11', + 'threads' => '2.13', + }, + removed => { + } + }, + 5.025011 => { + delta_from => 5.025010, + changed => { + 'App::Prove' => '3.38', + 'App::Prove::State' => '3.38', + 'App::Prove::State::Result'=> '3.38', + 'App::Prove::State::Result::Test'=> '3.38', + 'B::Op_private' => '5.025011', + 'Compress::Raw::Bzip2' => '2.074', + 'Compress::Raw::Zlib' => '2.074', + 'Compress::Zlib' => '2.074', + 'Config' => '5.025011', + 'Config::Perl::V' => '0.28', + 'Cwd' => '3.67', + 'ExtUtils::ParseXS' => '3.34', + 'ExtUtils::ParseXS::Constants'=> '3.34', + 'ExtUtils::ParseXS::CountLines'=> '3.34', + 'ExtUtils::ParseXS::Eval'=> '3.34', + 'ExtUtils::Typemaps' => '3.34', + 'ExtUtils::Typemaps::Cmd'=> '3.34', + 'ExtUtils::Typemaps::InputMap'=> '3.34', + 'ExtUtils::Typemaps::OutputMap'=> '3.34', + 'ExtUtils::Typemaps::Type'=> '3.34', + 'File::Spec' => '3.67', + 'File::Spec::AmigaOS' => '3.67', + 'File::Spec::Cygwin' => '3.67', + 'File::Spec::Epoc' => '3.67', + 'File::Spec::Functions' => '3.67', + 'File::Spec::Mac' => '3.67', + 'File::Spec::OS2' => '3.67', + 'File::Spec::Unix' => '3.67', + 'File::Spec::VMS' => '3.67', + 'File::Spec::Win32' => '3.67', + 'IO::Compress::Adapter::Bzip2'=> '2.074', + 'IO::Compress::Adapter::Deflate'=> '2.074', + 'IO::Compress::Adapter::Identity'=> '2.074', + 'IO::Compress::Base' => '2.074', + 'IO::Compress::Base::Common'=> '2.074', + 'IO::Compress::Bzip2' => '2.074', + 'IO::Compress::Deflate' => '2.074', + 'IO::Compress::Gzip' => '2.074', + 'IO::Compress::Gzip::Constants'=> '2.074', + 'IO::Compress::RawDeflate'=> '2.074', + 'IO::Compress::Zip' => '2.074', + 'IO::Compress::Zip::Constants'=> '2.074', + 'IO::Compress::Zlib::Constants'=> '2.074', + 'IO::Compress::Zlib::Extra'=> '2.074', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.074', + 'IO::Uncompress::Adapter::Identity'=> '2.074', + 'IO::Uncompress::Adapter::Inflate'=> '2.074', + 'IO::Uncompress::AnyInflate'=> '2.074', + 'IO::Uncompress::AnyUncompress'=> '2.074', + 'IO::Uncompress::Base' => '2.074', + 'IO::Uncompress::Bunzip2'=> '2.074', + 'IO::Uncompress::Gunzip'=> '2.074', + 'IO::Uncompress::Inflate'=> '2.074', + 'IO::Uncompress::RawInflate'=> '2.074', + 'IO::Uncompress::Unzip' => '2.074', + 'Module::CoreList' => '5.20170320', + 'Module::CoreList::TieHashDelta'=> '5.20170230', + 'Module::CoreList::Utils'=> '5.20170320', + 'Pod::Perldoc' => '3.28', + 'Pod::Perldoc::BaseTo' => '3.28', + 'Pod::Perldoc::GetOptsOO'=> '3.28', + 'Pod::Perldoc::ToANSI' => '3.28', + 'Pod::Perldoc::ToChecker'=> '3.28', + 'Pod::Perldoc::ToMan' => '3.28', + 'Pod::Perldoc::ToNroff' => '3.28', + 'Pod::Perldoc::ToPod' => '3.28', + 'Pod::Perldoc::ToRtf' => '3.28', + 'Pod::Perldoc::ToTerm' => '3.28', + 'Pod::Perldoc::ToText' => '3.28', + 'Pod::Perldoc::ToTk' => '3.28', + 'Pod::Perldoc::ToXml' => '3.28', + 'TAP::Base' => '3.38', + 'TAP::Formatter::Base' => '3.38', + 'TAP::Formatter::Color' => '3.38', + 'TAP::Formatter::Console'=> '3.38', + 'TAP::Formatter::Console::ParallelSession'=> '3.38', + 'TAP::Formatter::Console::Session'=> '3.38', + 'TAP::Formatter::File' => '3.38', + 'TAP::Formatter::File::Session'=> '3.38', + 'TAP::Formatter::Session'=> '3.38', + 'TAP::Harness' => '3.38', + 'TAP::Harness::Env' => '3.38', + 'TAP::Object' => '3.38', + 'TAP::Parser' => '3.38', + 'TAP::Parser::Aggregator'=> '3.38', + 'TAP::Parser::Grammar' => '3.38', + 'TAP::Parser::Iterator' => '3.38', + 'TAP::Parser::Iterator::Array'=> '3.38', + 'TAP::Parser::Iterator::Process'=> '3.38', + 'TAP::Parser::Iterator::Stream'=> '3.38', + 'TAP::Parser::IteratorFactory'=> '3.38', + 'TAP::Parser::Multiplexer'=> '3.38', + 'TAP::Parser::Result' => '3.38', + 'TAP::Parser::Result::Bailout'=> '3.38', + 'TAP::Parser::Result::Comment'=> '3.38', + 'TAP::Parser::Result::Plan'=> '3.38', + 'TAP::Parser::Result::Pragma'=> '3.38', + 'TAP::Parser::Result::Test'=> '3.38', + 'TAP::Parser::Result::Unknown'=> '3.38', + 'TAP::Parser::Result::Version'=> '3.38', + 'TAP::Parser::Result::YAML'=> '3.38', + 'TAP::Parser::ResultFactory'=> '3.38', + 'TAP::Parser::Scheduler'=> '3.38', + 'TAP::Parser::Scheduler::Job'=> '3.38', + 'TAP::Parser::Scheduler::Spinner'=> '3.38', + 'TAP::Parser::Source' => '3.38', + 'TAP::Parser::SourceHandler'=> '3.38', + 'TAP::Parser::SourceHandler::Executable'=> '3.38', + 'TAP::Parser::SourceHandler::File'=> '3.38', + 'TAP::Parser::SourceHandler::Handle'=> '3.38', + 'TAP::Parser::SourceHandler::Perl'=> '3.38', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.38', + 'TAP::Parser::YAMLish::Reader'=> '3.38', + 'TAP::Parser::YAMLish::Writer'=> '3.38', + 'Test::Harness' => '3.38', + 'VMS::Stdio' => '2.41', + 'threads' => '2.15', + 'threads::shared' => '1.55', + }, + removed => { + } + }, + 5.025012 => { + delta_from => 5.025011, + changed => { + 'B::Op_private' => '5.025012', + 'CPAN' => '2.18', + 'CPAN::Bundle' => '5.5003', + 'CPAN::Distribution' => '2.18', + 'Config' => '5.025012', + 'DynaLoader' => '1.42', + 'Module::CoreList' => '5.20170420', + 'Module::CoreList::TieHashDelta'=> '5.20170420', + 'Module::CoreList::Utils'=> '5.20170420', + 'Safe' => '2.40', + 'XSLoader' => '0.27', + 'base' => '2.25', + 'threads::shared' => '1.56', + }, + removed => { + } + }, + 5.026000 => { + delta_from => 5.025012, + changed => { + 'B::Op_private' => '5.026000', + 'Config' => '5.026', + 'Module::CoreList' => '5.20170530', + 'Module::CoreList::TieHashDelta'=> '5.20170530', + 'Module::CoreList::Utils'=> '5.20170530', + }, + removed => { + } + }, + 5.027000 => { + delta_from => 5.026000, + changed => { + 'Attribute::Handlers' => '1.00', + 'B::Concise' => '1.000', + 'B::Deparse' => '1.41', + 'B::Op_private' => '5.027000', + 'Config' => '5.027', + 'Module::CoreList' => '5.20170531', + 'Module::CoreList::TieHashDelta'=> '5.20170531', + 'Module::CoreList::Utils'=> '5.20170531', + 'O' => '1.02', + 'attributes' => '0.3', + 'feature' => '1.48', + }, + removed => { + } + }, + 5.027001 => { + delta_from => 5.027, + changed => { + 'App::Prove' => '3.39', + 'App::Prove::State' => '3.39', + 'App::Prove::State::Result'=> '3.39', + 'App::Prove::State::Result::Test'=> '3.39', + 'Archive::Tar' => '2.26', + 'Archive::Tar::Constant'=> '2.26', + 'Archive::Tar::File' => '2.26', + 'B::Op_private' => '5.027001', + 'B::Terse' => '1.08', + 'Config' => '5.027001', + 'Devel::PPPort' => '3.36', + 'DirHandle' => '1.05', + 'ExtUtils::Command' => '7.30', + 'ExtUtils::Command::MM' => '7.30', + 'ExtUtils::Install' => '2.14', + 'ExtUtils::Installed' => '2.14', + 'ExtUtils::Liblist' => '7.30', + 'ExtUtils::Liblist::Kid'=> '7.30', + 'ExtUtils::MM' => '7.30', + 'ExtUtils::MM_AIX' => '7.30', + 'ExtUtils::MM_Any' => '7.30', + 'ExtUtils::MM_BeOS' => '7.30', + 'ExtUtils::MM_Cygwin' => '7.30', + 'ExtUtils::MM_DOS' => '7.30', + 'ExtUtils::MM_Darwin' => '7.30', + 'ExtUtils::MM_MacOS' => '7.30', + 'ExtUtils::MM_NW5' => '7.30', + 'ExtUtils::MM_OS2' => '7.30', + 'ExtUtils::MM_QNX' => '7.30', + 'ExtUtils::MM_UWIN' => '7.30', + 'ExtUtils::MM_Unix' => '7.30', + 'ExtUtils::MM_VMS' => '7.30', + 'ExtUtils::MM_VOS' => '7.30', + 'ExtUtils::MM_Win32' => '7.30', + 'ExtUtils::MM_Win95' => '7.30', + 'ExtUtils::MY' => '7.30', + 'ExtUtils::MakeMaker' => '7.30', + 'ExtUtils::MakeMaker::Config'=> '7.30', + 'ExtUtils::MakeMaker::Locale'=> '7.30', + 'ExtUtils::MakeMaker::version'=> '7.30', + 'ExtUtils::MakeMaker::version::regex'=> '7.30', + 'ExtUtils::Mkbootstrap' => '7.30', + 'ExtUtils::Mksymlists' => '7.30', + 'ExtUtils::Packlist' => '2.14', + 'ExtUtils::testlib' => '7.30', + 'File::Path' => '2.14', + 'Filter::Util::Call' => '1.57', + 'GDBM_File' => '1.16', + 'Getopt::Long' => '2.5', + 'IO::Socket::IP' => '0.39', + 'IPC::Cmd' => '0.98', + 'JSON::PP' => '2.94', + 'JSON::PP::Boolean' => '2.94', + 'Locale::Codes' => '3.52', + 'Locale::Codes::Constants'=> '3.52', + 'Locale::Codes::Country'=> '3.52', + 'Locale::Codes::Country_Codes'=> '3.52', + 'Locale::Codes::Country_Retired'=> '3.52', + 'Locale::Codes::Currency'=> '3.52', + 'Locale::Codes::Currency_Codes'=> '3.52', + 'Locale::Codes::Currency_Retired'=> '3.52', + 'Locale::Codes::LangExt'=> '3.52', + 'Locale::Codes::LangExt_Codes'=> '3.52', + 'Locale::Codes::LangExt_Retired'=> '3.52', + 'Locale::Codes::LangFam'=> '3.52', + 'Locale::Codes::LangFam_Codes'=> '3.52', + 'Locale::Codes::LangFam_Retired'=> '3.52', + 'Locale::Codes::LangVar'=> '3.52', + 'Locale::Codes::LangVar_Codes'=> '3.52', + 'Locale::Codes::LangVar_Retired'=> '3.52', + 'Locale::Codes::Language'=> '3.52', + 'Locale::Codes::Language_Codes'=> '3.52', + 'Locale::Codes::Language_Retired'=> '3.52', + 'Locale::Codes::Script' => '3.52', + 'Locale::Codes::Script_Codes'=> '3.52', + 'Locale::Codes::Script_Retired'=> '3.52', + 'Locale::Country' => '3.52', + 'Locale::Currency' => '3.52', + 'Locale::Language' => '3.52', + 'Locale::Script' => '3.52', + 'Module::CoreList' => '5.20170621', + 'Module::CoreList::TieHashDelta'=> '5.20170621', + 'Module::CoreList::Utils'=> '5.20170621', + 'PerlIO::scalar' => '0.27', + 'PerlIO::via' => '0.17', + 'Storable' => '2.63', + 'TAP::Base' => '3.39', + 'TAP::Formatter::Base' => '3.39', + 'TAP::Formatter::Color' => '3.39', + 'TAP::Formatter::Console'=> '3.39', + 'TAP::Formatter::Console::ParallelSession'=> '3.39', + 'TAP::Formatter::Console::Session'=> '3.39', + 'TAP::Formatter::File' => '3.39', + 'TAP::Formatter::File::Session'=> '3.39', + 'TAP::Formatter::Session'=> '3.39', + 'TAP::Harness' => '3.39', + 'TAP::Harness::Env' => '3.39', + 'TAP::Object' => '3.39', + 'TAP::Parser' => '3.39', + 'TAP::Parser::Aggregator'=> '3.39', + 'TAP::Parser::Grammar' => '3.39', + 'TAP::Parser::Iterator' => '3.39', + 'TAP::Parser::Iterator::Array'=> '3.39', + 'TAP::Parser::Iterator::Process'=> '3.39', + 'TAP::Parser::Iterator::Stream'=> '3.39', + 'TAP::Parser::IteratorFactory'=> '3.39', + 'TAP::Parser::Multiplexer'=> '3.39', + 'TAP::Parser::Result' => '3.39', + 'TAP::Parser::Result::Bailout'=> '3.39', + 'TAP::Parser::Result::Comment'=> '3.39', + 'TAP::Parser::Result::Plan'=> '3.39', + 'TAP::Parser::Result::Pragma'=> '3.39', + 'TAP::Parser::Result::Test'=> '3.39', + 'TAP::Parser::Result::Unknown'=> '3.39', + 'TAP::Parser::Result::Version'=> '3.39', + 'TAP::Parser::Result::YAML'=> '3.39', + 'TAP::Parser::ResultFactory'=> '3.39', + 'TAP::Parser::Scheduler'=> '3.39', + 'TAP::Parser::Scheduler::Job'=> '3.39', + 'TAP::Parser::Scheduler::Spinner'=> '3.39', + 'TAP::Parser::Source' => '3.39', + 'TAP::Parser::SourceHandler'=> '3.39', + 'TAP::Parser::SourceHandler::Executable'=> '3.39', + 'TAP::Parser::SourceHandler::File'=> '3.39', + 'TAP::Parser::SourceHandler::Handle'=> '3.39', + 'TAP::Parser::SourceHandler::Perl'=> '3.39', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.39', + 'TAP::Parser::YAMLish::Reader'=> '3.39', + 'TAP::Parser::YAMLish::Writer'=> '3.39', + 'Test::Harness' => '3.39', + 'XS::APItest' => '0.89', + '_charnames' => '1.45', + 'charnames' => '1.45', + 'if' => '0.0607', + 'mro' => '1.21', + 'threads' => '2.16', + 'threads::shared' => '1.57', + 'version' => '0.9918', + 'version::regex' => '0.9918', + }, + removed => { + } + }, + 5.022004 => { + delta_from => 5.022003, + changed => { + 'B::Op_private' => '5.022004', + 'Config' => '5.022004', + 'Module::CoreList' => '5.20170715_22', + 'Module::CoreList::TieHashDelta'=> '5.20170715_22', + 'Module::CoreList::Utils'=> '5.20170715_22', + 'base' => '2.22_01', + }, + removed => { + } + }, + 5.024002 => { + delta_from => 5.024001, + changed => { + 'B::Op_private' => '5.024002', + 'Config' => '5.024002', + 'Module::CoreList' => '5.20170715_24', + 'Module::CoreList::TieHashDelta'=> '5.20170715_24', + 'Module::CoreList::Utils'=> '5.20170715_24', + 'base' => '2.23_01', + }, + removed => { + } + }, + 5.027002 => { + delta_from => 5.027001, + changed => { + 'B::Op_private' => '5.027002', + 'Carp' => '1.43', + 'Carp::Heavy' => '1.43', + 'Config' => '5.027002', + 'Cwd' => '3.68', + 'Encode' => '2.92', + 'Encode::Alias' => '2.23', + 'Encode::CN::HZ' => '2.09', + 'Encode::Encoding' => '2.08', + 'Encode::GSM0338' => '2.07', + 'Encode::Guess' => '2.07', + 'Encode::JP::JIS7' => '2.07', + 'Encode::KR::2022_KR' => '2.04', + 'Encode::MIME::Header' => '2.27', + 'Encode::MIME::Header::ISO_2022_JP'=> '1.09', + 'Encode::Unicode' => '2.16', + 'Encode::Unicode::UTF7' => '2.10', + 'ExtUtils::CBuilder' => '0.280228', + 'ExtUtils::CBuilder::Base'=> '0.280228', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280228', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280228', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280228', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280228', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280228', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280228', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280228', + 'ExtUtils::CBuilder::Platform::android'=> '0.280228', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280228', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280228', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280228', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280228', + 'File::Glob' => '1.29', + 'File::Spec' => '3.68', + 'File::Spec::AmigaOS' => '3.68', + 'File::Spec::Cygwin' => '3.68', + 'File::Spec::Epoc' => '3.68', + 'File::Spec::Functions' => '3.68', + 'File::Spec::Mac' => '3.68', + 'File::Spec::OS2' => '3.68', + 'File::Spec::Unix' => '3.68', + 'File::Spec::VMS' => '3.68', + 'File::Spec::Win32' => '3.68', + 'List::Util' => '1.48', + 'List::Util::XS' => '1.48', + 'Math::BigRat' => '0.2613', + 'Module::CoreList' => '5.20170720', + 'Module::CoreList::TieHashDelta'=> '5.20170720', + 'Module::CoreList::Utils'=> '5.20170720', + 'Opcode' => '1.40', + 'POSIX' => '1.77', + 'PerlIO::scalar' => '0.29', + 'Scalar::Util' => '1.48', + 'Sub::Util' => '1.48', + 'Time::HiRes' => '1.9743', + 'Time::Piece' => '1.3201', + 'Time::Seconds' => '1.3201', + 'Unicode' => '10.0.0', + 'XS::APItest' => '0.90', + 'arybase' => '0.13', + 'encoding' => '2.20', + 'feature' => '1.49', + 're' => '0.35', + }, + removed => { + } + }, + 5.027003 => { + delta_from => 5.027002, + changed => { + 'B' => '1.69', + 'B::Concise' => '1.001', + 'B::Debug' => '1.25', + 'B::Deparse' => '1.42', + 'B::Op_private' => '5.027003', + 'Config' => '5.027003', + 'Data::Dumper' => '2.167_02', + 'Devel::Peek' => '1.27', + 'ExtUtils::Constant' => '0.24', + 'ExtUtils::Constant::Base'=> '0.06', + 'ExtUtils::Constant::ProxySubs'=> '0.09', + 'ExtUtils::Constant::Utils'=> '0.04', + 'ExtUtils::ParseXS' => '3.35', + 'ExtUtils::ParseXS::Constants'=> '3.35', + 'ExtUtils::ParseXS::CountLines'=> '3.35', + 'ExtUtils::ParseXS::Eval'=> '3.35', + 'ExtUtils::ParseXS::Utilities'=> '3.35', + 'ExtUtils::Typemaps' => '3.35', + 'ExtUtils::Typemaps::Cmd'=> '3.35', + 'ExtUtils::Typemaps::InputMap'=> '3.35', + 'ExtUtils::Typemaps::OutputMap'=> '3.35', + 'ExtUtils::Typemaps::Type'=> '3.35', + 'Filter::Simple' => '0.94', + 'Module::CoreList' => '5.20170821', + 'Module::CoreList::TieHashDelta'=> '5.20170821', + 'Module::CoreList::Utils'=> '5.20170821', + 'SelfLoader' => '1.24', + 'Storable' => '2.64', + 'XS::APItest' => '0.91', + 'base' => '2.26', + 'threads' => '2.17', + 'utf8' => '1.20', + }, + removed => { + } + }, + 5.027004 => { + delta_from => 5.027003, + changed => { + 'B::Op_private' => '5.027004', + 'Config' => '5.027004', + 'File::Glob' => '1.30', + 'I18N::Langinfo' => '0.14', + 'Module::CoreList' => '5.20170920', + 'Module::CoreList::TieHashDelta'=> '5.20170920', + 'Module::CoreList::Utils'=> '5.20170920', + 'Term::ReadLine' => '1.17', + 'VMS::Stdio' => '2.42', + 'XS::APItest' => '0.92', + 'attributes' => '0.31', + 'sort' => '2.03', + 'threads' => '2.18', + }, + removed => { + } + }, + 5.024003 => { + delta_from => 5.024002, + changed => { + 'B::Op_private' => '5.024003', + 'Config' => '5.024003', + 'Module::CoreList' => '5.20170922_24', + 'Module::CoreList::TieHashDelta'=> '5.20170922_24', + 'Module::CoreList::Utils'=> '5.20170922_24', + 'POSIX' => '1.65_01', + 'Time::HiRes' => '1.9741', + }, + removed => { + } + }, + 5.026001 => { + delta_from => 5.026000, + changed => { + 'B::Op_private' => '5.026001', + 'Config' => '5.026001', + 'Module::CoreList' => '5.20170922_26', + 'Module::CoreList::TieHashDelta'=> '5.20170922_26', + 'Module::CoreList::Utils'=> '5.20170922_26', + '_charnames' => '1.45', + 'base' => '2.26', + 'charnames' => '1.45', + }, + removed => { + } + }, + 5.027005 => { + delta_from => 5.027004, + changed => { + 'B' => '1.70', + 'B::Concise' => '1.002', + 'B::Deparse' => '1.43', + 'B::Op_private' => '5.027005', + 'B::Xref' => '1.07', + 'Config' => '5.027005', + 'Config::Perl::V' => '0.29', + 'Digest::SHA' => '5.98', + 'Encode' => '2.93', + 'Encode::CN::HZ' => '2.10', + 'Encode::JP::JIS7' => '2.08', + 'Encode::MIME::Header' => '2.28', + 'Encode::MIME::Name' => '1.03', + 'File::Fetch' => '0.54', + 'File::Path' => '2.15', + 'List::Util' => '1.49', + 'List::Util::XS' => '1.49', + 'Locale::Codes' => '3.54', + 'Locale::Codes::Constants'=> '3.54', + 'Locale::Codes::Country'=> '3.54', + 'Locale::Codes::Country_Codes'=> '3.54', + 'Locale::Codes::Country_Retired'=> '3.54', + 'Locale::Codes::Currency'=> '3.54', + 'Locale::Codes::Currency_Codes'=> '3.54', + 'Locale::Codes::Currency_Retired'=> '3.54', + 'Locale::Codes::LangExt'=> '3.54', + 'Locale::Codes::LangExt_Codes'=> '3.54', + 'Locale::Codes::LangExt_Retired'=> '3.54', + 'Locale::Codes::LangFam'=> '3.54', + 'Locale::Codes::LangFam_Codes'=> '3.54', + 'Locale::Codes::LangFam_Retired'=> '3.54', + 'Locale::Codes::LangVar'=> '3.54', + 'Locale::Codes::LangVar_Codes'=> '3.54', + 'Locale::Codes::LangVar_Retired'=> '3.54', + 'Locale::Codes::Language'=> '3.54', + 'Locale::Codes::Language_Codes'=> '3.54', + 'Locale::Codes::Language_Retired'=> '3.54', + 'Locale::Codes::Script' => '3.54', + 'Locale::Codes::Script_Codes'=> '3.54', + 'Locale::Codes::Script_Retired'=> '3.54', + 'Locale::Country' => '3.54', + 'Locale::Currency' => '3.54', + 'Locale::Language' => '3.54', + 'Locale::Script' => '3.54', + 'Math::BigFloat' => '1.999811', + 'Math::BigInt' => '1.999811', + 'Math::BigInt::Calc' => '1.999811', + 'Math::BigInt::CalcEmu' => '1.999811', + 'Math::BigInt::FastCalc'=> '0.5006', + 'Math::BigInt::Lib' => '1.999811', + 'Module::CoreList' => '5.20171020', + 'Module::CoreList::TieHashDelta'=> '5.20171020', + 'Module::CoreList::Utils'=> '5.20171020', + 'NEXT' => '0.67_01', + 'POSIX' => '1.78', + 'Pod::Perldoc' => '3.2801', + 'Scalar::Util' => '1.49', + 'Sub::Util' => '1.49', + 'Sys::Hostname' => '1.21', + 'Test2' => '1.302103', + 'Test2::API' => '1.302103', + 'Test2::API::Breakage' => '1.302103', + 'Test2::API::Context' => '1.302103', + 'Test2::API::Instance' => '1.302103', + 'Test2::API::Stack' => '1.302103', + 'Test2::Event' => '1.302103', + 'Test2::Event::Bail' => '1.302103', + 'Test2::Event::Diag' => '1.302103', + 'Test2::Event::Encoding'=> '1.302103', + 'Test2::Event::Exception'=> '1.302103', + 'Test2::Event::Fail' => '1.302103', + 'Test2::Event::Generic' => '1.302103', + 'Test2::Event::Note' => '1.302103', + 'Test2::Event::Ok' => '1.302103', + 'Test2::Event::Pass' => '1.302103', + 'Test2::Event::Plan' => '1.302103', + 'Test2::Event::Skip' => '1.302103', + 'Test2::Event::Subtest' => '1.302103', + 'Test2::Event::TAP::Version'=> '1.302103', + 'Test2::Event::Waiting' => '1.302103', + 'Test2::EventFacet' => '1.302103', + 'Test2::EventFacet::About'=> '1.302103', + 'Test2::EventFacet::Amnesty'=> '1.302103', + 'Test2::EventFacet::Assert'=> '1.302103', + 'Test2::EventFacet::Control'=> '1.302103', + 'Test2::EventFacet::Error'=> '1.302103', + 'Test2::EventFacet::Info'=> '1.302103', + 'Test2::EventFacet::Meta'=> '1.302103', + 'Test2::EventFacet::Parent'=> '1.302103', + 'Test2::EventFacet::Plan'=> '1.302103', + 'Test2::EventFacet::Trace'=> '1.302103', + 'Test2::Formatter' => '1.302103', + 'Test2::Formatter::TAP' => '1.302103', + 'Test2::Hub' => '1.302103', + 'Test2::Hub::Interceptor'=> '1.302103', + 'Test2::Hub::Interceptor::Terminator'=> '1.302103', + 'Test2::Hub::Subtest' => '1.302103', + 'Test2::IPC' => '1.302103', + 'Test2::IPC::Driver' => '1.302103', + 'Test2::IPC::Driver::Files'=> '1.302103', + 'Test2::Tools::Tiny' => '1.302103', + 'Test2::Util' => '1.302103', + 'Test2::Util::ExternalMeta'=> '1.302103', + 'Test2::Util::Facets2Legacy'=> '1.302103', + 'Test2::Util::HashBase' => '0.005', + 'Test2::Util::Trace' => '1.302103', + 'Test::Builder' => '1.302103', + 'Test::Builder::Formatter'=> '1.302103', + 'Test::Builder::IO::Scalar'=> '2.114', + 'Test::Builder::Module' => '1.302103', + 'Test::Builder::Tester' => '1.302103', + 'Test::Builder::Tester::Color'=> '1.302103', + 'Test::Builder::TodoDiag'=> '1.302103', + 'Test::More' => '1.302103', + 'Test::Simple' => '1.302103', + 'Test::Tester' => '1.302103', + 'Test::Tester::Capture' => '1.302103', + 'Test::Tester::CaptureRunner'=> '1.302103', + 'Test::Tester::Delegate'=> '1.302103', + 'Test::use::ok' => '1.302103', + 'Time::HiRes' => '1.9746', + 'Time::Piece' => '1.3202', + 'Time::Seconds' => '1.3202', + 'arybase' => '0.14', + 'encoding' => '2.21', + 'ok' => '1.302103', + }, + removed => { + 'Test2::Event::Info' => 1, + } + }, + 5.027006 => { + delta_from => 5.027005, + changed => { + 'Attribute::Handlers' => '1.01', + 'B' => '1.72', + 'B::Concise' => '1.003', + 'B::Deparse' => '1.45', + 'B::Op_private' => '5.027006', + 'Carp' => '1.44', + 'Carp::Heavy' => '1.44', + 'Compress::Raw::Zlib' => '2.075', + 'Config' => '5.027006', + 'Config::Extensions' => '0.02', + 'Cwd' => '3.70', + 'DynaLoader' => '1.44', + 'ExtUtils::CBuilder' => '0.280229', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280229', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280229', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280229', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280229', + 'ExtUtils::CBuilder::Platform::android'=> '0.280229', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280229', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280229', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280229', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280229', + 'ExtUtils::Embed' => '1.35', + 'ExtUtils::Miniperl' => '1.07', + 'ExtUtils::ParseXS' => '3.36', + 'ExtUtils::ParseXS::Constants'=> '3.36', + 'ExtUtils::ParseXS::CountLines'=> '3.36', + 'ExtUtils::ParseXS::Eval'=> '3.36', + 'ExtUtils::ParseXS::Utilities'=> '3.36', + 'ExtUtils::Typemaps' => '3.36', + 'ExtUtils::Typemaps::Cmd'=> '3.36', + 'ExtUtils::Typemaps::InputMap'=> '3.36', + 'ExtUtils::Typemaps::OutputMap'=> '3.36', + 'ExtUtils::Typemaps::Type'=> '3.36', + 'ExtUtils::XSSymSet' => '1.4', + 'File::Copy' => '2.33', + 'File::Spec' => '3.69', + 'File::Spec::AmigaOS' => '3.69', + 'File::Spec::Cygwin' => '3.69', + 'File::Spec::Epoc' => '3.69', + 'File::Spec::Functions' => '3.69', + 'File::Spec::Mac' => '3.69', + 'File::Spec::OS2' => '3.69', + 'File::Spec::Unix' => '3.69', + 'File::Spec::VMS' => '3.69', + 'File::Spec::Win32' => '3.69', + 'File::stat' => '1.08', + 'FileCache' => '1.10', + 'Filter::Simple' => '0.95', + 'Hash::Util::FieldHash' => '1.20', + 'I18N::LangTags' => '0.43', + 'I18N::LangTags::Detect'=> '1.07', + 'I18N::LangTags::List' => '0.40', + 'I18N::Langinfo' => '0.15', + 'IO::Handle' => '1.37', + 'IO::Select' => '1.23', + 'Locale::Maketext' => '1.29', + 'Module::CoreList' => '5.20171120', + 'Module::CoreList::TieHashDelta'=> '5.20171120', + 'Module::CoreList::Utils'=> '5.20171120', + 'Net::Cmd' => '3.11', + 'Net::Config' => '3.11', + 'Net::Domain' => '3.11', + 'Net::FTP' => '3.11', + 'Net::FTP::A' => '3.11', + 'Net::FTP::E' => '3.11', + 'Net::FTP::I' => '3.11', + 'Net::FTP::L' => '3.11', + 'Net::FTP::dataconn' => '3.11', + 'Net::NNTP' => '3.11', + 'Net::Netrc' => '3.11', + 'Net::POP3' => '3.11', + 'Net::Ping' => '2.62', + 'Net::SMTP' => '3.11', + 'Net::Time' => '3.11', + 'Net::hostent' => '1.02', + 'Net::netent' => '1.01', + 'Net::protoent' => '1.01', + 'Net::servent' => '1.02', + 'O' => '1.03', + 'ODBM_File' => '1.15', + 'Opcode' => '1.41', + 'POSIX' => '1.80', + 'Pod::Html' => '1.2203', + 'SelfLoader' => '1.25', + 'Socket' => '2.020_04', + 'Storable' => '2.65', + 'Test' => '1.31', + 'Test2' => '1.302111', + 'Test2::API' => '1.302111', + 'Test2::API::Breakage' => '1.302111', + 'Test2::API::Context' => '1.302111', + 'Test2::API::Instance' => '1.302111', + 'Test2::API::Stack' => '1.302111', + 'Test2::Event' => '1.302111', + 'Test2::Event::Bail' => '1.302111', + 'Test2::Event::Diag' => '1.302111', + 'Test2::Event::Encoding'=> '1.302111', + 'Test2::Event::Exception'=> '1.302111', + 'Test2::Event::Fail' => '1.302111', + 'Test2::Event::Generic' => '1.302111', + 'Test2::Event::Note' => '1.302111', + 'Test2::Event::Ok' => '1.302111', + 'Test2::Event::Pass' => '1.302111', + 'Test2::Event::Plan' => '1.302111', + 'Test2::Event::Skip' => '1.302111', + 'Test2::Event::Subtest' => '1.302111', + 'Test2::Event::TAP::Version'=> '1.302111', + 'Test2::Event::Waiting' => '1.302111', + 'Test2::EventFacet' => '1.302111', + 'Test2::EventFacet::About'=> '1.302111', + 'Test2::EventFacet::Amnesty'=> '1.302111', + 'Test2::EventFacet::Assert'=> '1.302111', + 'Test2::EventFacet::Control'=> '1.302111', + 'Test2::EventFacet::Error'=> '1.302111', + 'Test2::EventFacet::Info'=> '1.302111', + 'Test2::EventFacet::Meta'=> '1.302111', + 'Test2::EventFacet::Parent'=> '1.302111', + 'Test2::EventFacet::Plan'=> '1.302111', + 'Test2::EventFacet::Trace'=> '1.302111', + 'Test2::Formatter' => '1.302111', + 'Test2::Formatter::TAP' => '1.302111', + 'Test2::Hub' => '1.302111', + 'Test2::Hub::Interceptor'=> '1.302111', + 'Test2::Hub::Interceptor::Terminator'=> '1.302111', + 'Test2::Hub::Subtest' => '1.302111', + 'Test2::IPC' => '1.302111', + 'Test2::IPC::Driver' => '1.302111', + 'Test2::IPC::Driver::Files'=> '1.302111', + 'Test2::Tools::Tiny' => '1.302111', + 'Test2::Util' => '1.302111', + 'Test2::Util::ExternalMeta'=> '1.302111', + 'Test2::Util::Facets2Legacy'=> '1.302111', + 'Test2::Util::HashBase' => '1.302111', + 'Test2::Util::Trace' => '1.302111', + 'Test::Builder' => '1.302111', + 'Test::Builder::Formatter'=> '1.302111', + 'Test::Builder::Module' => '1.302111', + 'Test::Builder::Tester' => '1.302111', + 'Test::Builder::Tester::Color'=> '1.302111', + 'Test::Builder::TodoDiag'=> '1.302111', + 'Test::More' => '1.302111', + 'Test::Simple' => '1.302111', + 'Test::Tester' => '1.302111', + 'Test::Tester::Capture' => '1.302111', + 'Test::Tester::CaptureRunner'=> '1.302111', + 'Test::Tester::Delegate'=> '1.302111', + 'Test::use::ok' => '1.302111', + 'Tie::Array' => '1.07', + 'Tie::StdHandle' => '4.5', + 'Time::HiRes' => '1.9747', + 'Time::gmtime' => '1.04', + 'Time::localtime' => '1.03', + 'Unicode::Collate' => '1.23', + 'Unicode::Collate::CJK::Big5'=> '1.23', + 'Unicode::Collate::CJK::GB2312'=> '1.23', + 'Unicode::Collate::CJK::JISX0208'=> '1.23', + 'Unicode::Collate::CJK::Korean'=> '1.23', + 'Unicode::Collate::CJK::Pinyin'=> '1.23', + 'Unicode::Collate::CJK::Stroke'=> '1.23', + 'Unicode::Collate::CJK::Zhuyin'=> '1.23', + 'Unicode::Collate::Locale'=> '1.23', + 'Unicode::Normalize' => '1.26', + 'User::grent' => '1.02', + 'User::pwent' => '1.01', + 'VMS::DCLsym' => '1.09', + 'VMS::Stdio' => '2.44', + 'XS::APItest' => '0.93', + 'XS::Typemap' => '0.16', + 'XSLoader' => '0.28', + 'attributes' => '0.32', + 'base' => '2.27', + 'blib' => '1.07', + 'experimental' => '0.017', + 'fields' => '2.24', + 'ok' => '1.302111', + 're' => '0.36', + 'sort' => '2.04', + 'threads' => '2.19', + 'warnings' => '1.38', + }, + removed => { + } + }, + 5.027007 => { + delta_from => 5.027006, + changed => { + 'App::Cpan' => '1.67', + 'B' => '1.73', + 'B::Debug' => '1.26', + 'B::Deparse' => '1.46', + 'B::Op_private' => '5.027007', + 'CPAN' => '2.20', + 'CPAN::Distribution' => '2.19', + 'CPAN::FTP' => '5.5011', + 'CPAN::FirstTime' => '5.5311', + 'CPAN::Shell' => '5.5007', + 'Carp' => '1.45', + 'Carp::Heavy' => '1.45', + 'Compress::Raw::Zlib' => '2.076', + 'Config' => '5.027007', + 'Cwd' => '3.71', + 'Data::Dumper' => '2.169', + 'Devel::PPPort' => '3.37', + 'Digest::SHA' => '6.00', + 'DynaLoader' => '1.45', + 'ExtUtils::CBuilder' => '0.280230', + 'ExtUtils::CBuilder::Base'=> '0.280230', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280230', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280230', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280230', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280230', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280230', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280230', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280230', + 'ExtUtils::CBuilder::Platform::android'=> '0.280230', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280230', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280230', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280230', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280230', + 'ExtUtils::Typemaps' => '3.37', + 'File::Fetch' => '0.56', + 'File::Spec' => '3.71', + 'File::Spec::AmigaOS' => '3.71', + 'File::Spec::Cygwin' => '3.71', + 'File::Spec::Epoc' => '3.71', + 'File::Spec::Functions' => '3.71', + 'File::Spec::Mac' => '3.71', + 'File::Spec::OS2' => '3.71', + 'File::Spec::Unix' => '3.71', + 'File::Spec::VMS' => '3.71', + 'File::Spec::Win32' => '3.71', + 'Filter::Util::Call' => '1.58', + 'GDBM_File' => '1.17', + 'JSON::PP' => '2.97000', + 'JSON::PP::Boolean' => '2.97000', + 'Locale::Codes' => '3.55', + 'Locale::Codes::Constants'=> '3.55', + 'Locale::Codes::Country'=> '3.55', + 'Locale::Codes::Country_Codes'=> '3.55', + 'Locale::Codes::Country_Retired'=> '3.55', + 'Locale::Codes::Currency'=> '3.55', + 'Locale::Codes::Currency_Codes'=> '3.55', + 'Locale::Codes::Currency_Retired'=> '3.55', + 'Locale::Codes::LangExt'=> '3.55', + 'Locale::Codes::LangExt_Codes'=> '3.55', + 'Locale::Codes::LangExt_Retired'=> '3.55', + 'Locale::Codes::LangFam'=> '3.55', + 'Locale::Codes::LangFam_Codes'=> '3.55', + 'Locale::Codes::LangFam_Retired'=> '3.55', + 'Locale::Codes::LangVar'=> '3.55', + 'Locale::Codes::LangVar_Codes'=> '3.55', + 'Locale::Codes::LangVar_Retired'=> '3.55', + 'Locale::Codes::Language'=> '3.55', + 'Locale::Codes::Language_Codes'=> '3.55', + 'Locale::Codes::Language_Retired'=> '3.55', + 'Locale::Codes::Script' => '3.55', + 'Locale::Codes::Script_Codes'=> '3.55', + 'Locale::Codes::Script_Retired'=> '3.55', + 'Locale::Country' => '3.55', + 'Locale::Currency' => '3.55', + 'Locale::Language' => '3.55', + 'Locale::Script' => '3.55', + 'Module::CoreList' => '5.20171220', + 'Module::CoreList::TieHashDelta'=> '5.20171220', + 'Module::CoreList::Utils'=> '5.20171220', + 'Opcode' => '1.42', + 'POSIX' => '1.81', + 'Pod::Functions' => '1.12', + 'Pod::Functions::Functions'=> '1.12', + 'Pod::Html' => '1.23', + 'Sys::Hostname' => '1.22', + 'Test2' => '1.302120', + 'Test2::API' => '1.302120', + 'Test2::API::Breakage' => '1.302120', + 'Test2::API::Context' => '1.302120', + 'Test2::API::Instance' => '1.302120', + 'Test2::API::Stack' => '1.302120', + 'Test2::Event' => '1.302120', + 'Test2::Event::Bail' => '1.302120', + 'Test2::Event::Diag' => '1.302120', + 'Test2::Event::Encoding'=> '1.302120', + 'Test2::Event::Exception'=> '1.302120', + 'Test2::Event::Fail' => '1.302120', + 'Test2::Event::Generic' => '1.302120', + 'Test2::Event::Note' => '1.302120', + 'Test2::Event::Ok' => '1.302120', + 'Test2::Event::Pass' => '1.302120', + 'Test2::Event::Plan' => '1.302120', + 'Test2::Event::Skip' => '1.302120', + 'Test2::Event::Subtest' => '1.302120', + 'Test2::Event::TAP::Version'=> '1.302120', + 'Test2::Event::Waiting' => '1.302120', + 'Test2::EventFacet' => '1.302120', + 'Test2::EventFacet::About'=> '1.302120', + 'Test2::EventFacet::Amnesty'=> '1.302120', + 'Test2::EventFacet::Assert'=> '1.302120', + 'Test2::EventFacet::Control'=> '1.302120', + 'Test2::EventFacet::Error'=> '1.302120', + 'Test2::EventFacet::Info'=> '1.302120', + 'Test2::EventFacet::Meta'=> '1.302120', + 'Test2::EventFacet::Parent'=> '1.302120', + 'Test2::EventFacet::Plan'=> '1.302120', + 'Test2::EventFacet::Trace'=> '1.302120', + 'Test2::Formatter' => '1.302120', + 'Test2::Formatter::TAP' => '1.302120', + 'Test2::Hub' => '1.302120', + 'Test2::Hub::Interceptor'=> '1.302120', + 'Test2::Hub::Interceptor::Terminator'=> '1.302120', + 'Test2::Hub::Subtest' => '1.302120', + 'Test2::IPC' => '1.302120', + 'Test2::IPC::Driver' => '1.302120', + 'Test2::IPC::Driver::Files'=> '1.302120', + 'Test2::Tools::Tiny' => '1.302120', + 'Test2::Util' => '1.302120', + 'Test2::Util::ExternalMeta'=> '1.302120', + 'Test2::Util::Facets2Legacy'=> '1.302120', + 'Test2::Util::HashBase' => '1.302120', + 'Test2::Util::Trace' => '1.302120', + 'Test::Builder' => '1.302120', + 'Test::Builder::Formatter'=> '1.302120', + 'Test::Builder::Module' => '1.302120', + 'Test::Builder::Tester' => '1.302120', + 'Test::Builder::Tester::Color'=> '1.302120', + 'Test::Builder::TodoDiag'=> '1.302120', + 'Test::More' => '1.302120', + 'Test::Simple' => '1.302120', + 'Test::Tester' => '1.302120', + 'Test::Tester::Capture' => '1.302120', + 'Test::Tester::CaptureRunner'=> '1.302120', + 'Test::Tester::Delegate'=> '1.302120', + 'Test::use::ok' => '1.302120', + 'Time::HiRes' => '1.9748', + 'Time::Piece' => '1.3203', + 'Time::Seconds' => '1.3203', + 'Unicode::Collate' => '1.25', + 'Unicode::Collate::CJK::Big5'=> '1.25', + 'Unicode::Collate::CJK::GB2312'=> '1.25', + 'Unicode::Collate::CJK::JISX0208'=> '1.25', + 'Unicode::Collate::CJK::Korean'=> '1.25', + 'Unicode::Collate::CJK::Pinyin'=> '1.25', + 'Unicode::Collate::CJK::Stroke'=> '1.25', + 'Unicode::Collate::CJK::Zhuyin'=> '1.25', + 'Unicode::Collate::Locale'=> '1.25', + 'Unicode::UCD' => '0.69', + 'XS::APItest' => '0.94', + 'XSLoader' => '0.29', + 'arybase' => '0.15', + 'autodie::exception' => '2.29001', + 'autodie::hints' => '2.29001', + 'experimental' => '0.019', + 'feature' => '1.50', + 'ok' => '1.302120', + 'overload' => '1.29', + 'threads' => '2.21', + 'threads::shared' => '1.58', + 'warnings' => '1.39', + }, + removed => { + } + }, + 5.027008 => { + delta_from => 5.027007, + changed => { + 'B' => '1.74', + 'B::Deparse' => '1.47', + 'B::Op_private' => '5.027008', + 'Config' => '5.027008', + 'Cwd' => '3.72', + 'Data::Dumper' => '2.170', + 'Devel::PPPort' => '3.38', + 'Digest::SHA' => '6.01', + 'Encode' => '2.94', + 'Encode::Alias' => '2.24', + 'ExtUtils::Miniperl' => '1.08', + 'File::Spec' => '3.72', + 'File::Spec::AmigaOS' => '3.72', + 'File::Spec::Cygwin' => '3.72', + 'File::Spec::Epoc' => '3.72', + 'File::Spec::Functions' => '3.72', + 'File::Spec::Mac' => '3.72', + 'File::Spec::OS2' => '3.72', + 'File::Spec::Unix' => '3.72', + 'File::Spec::VMS' => '3.72', + 'File::Spec::Win32' => '3.72', + 'JSON::PP' => '2.97001', + 'JSON::PP::Boolean' => '2.97001', + 'Module::CoreList' => '5.20180120', + 'Module::CoreList::TieHashDelta'=> '5.20180120', + 'Module::CoreList::Utils'=> '5.20180120', + 'Opcode' => '1.43', + 'Pod::Functions' => '1.13', + 'Pod::Functions::Functions'=> '1.13', + 'Pod::Html' => '1.24', + 'Pod::Man' => '4.10', + 'Pod::ParseLink' => '4.10', + 'Pod::Text' => '4.10', + 'Pod::Text::Color' => '4.10', + 'Pod::Text::Overstrike' => '4.10', + 'Pod::Text::Termcap' => '4.10', + 'Socket' => '2.027', + 'Time::HiRes' => '1.9752', + 'Unicode::UCD' => '0.70', + 'XS::APItest' => '0.95', + 'XSLoader' => '0.30', + 'autodie::exception' => '2.29002', + 'feature' => '1.51', + 'overload' => '1.30', + 'utf8' => '1.21', + 'warnings' => '1.40', + }, + removed => { + } + }, + 5.027009 => { + delta_from => 5.027008, + changed => { + 'B::Op_private' => '5.027009', + 'Carp' => '1.46', + 'Carp::Heavy' => '1.46', + 'Config' => '5.027009', + 'Cwd' => '3.74', + 'Devel::PPPort' => '3.39', + 'Encode' => '2.96', + 'Encode::Unicode' => '2.17', + 'Errno' => '1.29', + 'ExtUtils::Command' => '7.32', + 'ExtUtils::Command::MM' => '7.32', + 'ExtUtils::Liblist' => '7.32', + 'ExtUtils::Liblist::Kid'=> '7.32', + 'ExtUtils::MM' => '7.32', + 'ExtUtils::MM_AIX' => '7.32', + 'ExtUtils::MM_Any' => '7.32', + 'ExtUtils::MM_BeOS' => '7.32', + 'ExtUtils::MM_Cygwin' => '7.32', + 'ExtUtils::MM_DOS' => '7.32', + 'ExtUtils::MM_Darwin' => '7.32', + 'ExtUtils::MM_MacOS' => '7.32', + 'ExtUtils::MM_NW5' => '7.32', + 'ExtUtils::MM_OS2' => '7.32', + 'ExtUtils::MM_QNX' => '7.32', + 'ExtUtils::MM_UWIN' => '7.32', + 'ExtUtils::MM_Unix' => '7.32', + 'ExtUtils::MM_VMS' => '7.32', + 'ExtUtils::MM_VOS' => '7.32', + 'ExtUtils::MM_Win32' => '7.32', + 'ExtUtils::MM_Win95' => '7.32', + 'ExtUtils::MY' => '7.32', + 'ExtUtils::MakeMaker' => '7.32', + 'ExtUtils::MakeMaker::Config'=> '7.32', + 'ExtUtils::MakeMaker::Locale'=> '7.32', + 'ExtUtils::MakeMaker::version'=> '7.32', + 'ExtUtils::MakeMaker::version::regex'=> '7.32', + 'ExtUtils::Mkbootstrap' => '7.32', + 'ExtUtils::Mksymlists' => '7.32', + 'ExtUtils::ParseXS' => '3.38', + 'ExtUtils::ParseXS::Constants'=> '3.38', + 'ExtUtils::ParseXS::CountLines'=> '3.38', + 'ExtUtils::ParseXS::Eval'=> '3.38', + 'ExtUtils::ParseXS::Utilities'=> '3.38', + 'ExtUtils::Typemaps' => '3.38', + 'ExtUtils::Typemaps::Cmd'=> '3.38', + 'ExtUtils::Typemaps::InputMap'=> '3.38', + 'ExtUtils::Typemaps::OutputMap'=> '3.38', + 'ExtUtils::Typemaps::Type'=> '3.38', + 'ExtUtils::testlib' => '7.32', + 'File::Spec' => '3.74', + 'File::Spec::AmigaOS' => '3.74', + 'File::Spec::Cygwin' => '3.74', + 'File::Spec::Epoc' => '3.74', + 'File::Spec::Functions' => '3.74', + 'File::Spec::Mac' => '3.74', + 'File::Spec::OS2' => '3.74', + 'File::Spec::Unix' => '3.74', + 'File::Spec::VMS' => '3.74', + 'File::Spec::Win32' => '3.74', + 'IPC::Cmd' => '1.00', + 'Math::BigFloat::Trace' => '0.49', + 'Math::BigInt::Trace' => '0.49', + 'Module::CoreList' => '5.20180220', + 'Module::CoreList::Utils'=> '5.20180220', + 'POSIX' => '1.82', + 'PerlIO::encoding' => '0.26', + 'Storable' => '3.06', + 'Storable::Limit' => undef, + 'Test2' => '1.302122', + 'Test2::API' => '1.302122', + 'Test2::API::Breakage' => '1.302122', + 'Test2::API::Context' => '1.302122', + 'Test2::API::Instance' => '1.302122', + 'Test2::API::Stack' => '1.302122', + 'Test2::Event' => '1.302122', + 'Test2::Event::Bail' => '1.302122', + 'Test2::Event::Diag' => '1.302122', + 'Test2::Event::Encoding'=> '1.302122', + 'Test2::Event::Exception'=> '1.302122', + 'Test2::Event::Fail' => '1.302122', + 'Test2::Event::Generic' => '1.302122', + 'Test2::Event::Note' => '1.302122', + 'Test2::Event::Ok' => '1.302122', + 'Test2::Event::Pass' => '1.302122', + 'Test2::Event::Plan' => '1.302122', + 'Test2::Event::Skip' => '1.302122', + 'Test2::Event::Subtest' => '1.302122', + 'Test2::Event::TAP::Version'=> '1.302122', + 'Test2::Event::Waiting' => '1.302122', + 'Test2::EventFacet' => '1.302122', + 'Test2::EventFacet::About'=> '1.302122', + 'Test2::EventFacet::Amnesty'=> '1.302122', + 'Test2::EventFacet::Assert'=> '1.302122', + 'Test2::EventFacet::Control'=> '1.302122', + 'Test2::EventFacet::Error'=> '1.302122', + 'Test2::EventFacet::Info'=> '1.302122', + 'Test2::EventFacet::Meta'=> '1.302122', + 'Test2::EventFacet::Parent'=> '1.302122', + 'Test2::EventFacet::Plan'=> '1.302122', + 'Test2::EventFacet::Render'=> '1.302122', + 'Test2::EventFacet::Trace'=> '1.302122', + 'Test2::Formatter' => '1.302122', + 'Test2::Formatter::TAP' => '1.302122', + 'Test2::Hub' => '1.302122', + 'Test2::Hub::Interceptor'=> '1.302122', + 'Test2::Hub::Interceptor::Terminator'=> '1.302122', + 'Test2::Hub::Subtest' => '1.302122', + 'Test2::IPC' => '1.302122', + 'Test2::IPC::Driver' => '1.302122', + 'Test2::IPC::Driver::Files'=> '1.302122', + 'Test2::Tools::Tiny' => '1.302122', + 'Test2::Util' => '1.302122', + 'Test2::Util::ExternalMeta'=> '1.302122', + 'Test2::Util::Facets2Legacy'=> '1.302122', + 'Test2::Util::HashBase' => '1.302122', + 'Test2::Util::Trace' => '1.302122', + 'Test::Builder' => '1.302122', + 'Test::Builder::Formatter'=> '1.302122', + 'Test::Builder::Module' => '1.302122', + 'Test::Builder::Tester' => '1.302122', + 'Test::Builder::Tester::Color'=> '1.302122', + 'Test::Builder::TodoDiag'=> '1.302122', + 'Test::More' => '1.302122', + 'Test::Simple' => '1.302122', + 'Test::Tester' => '1.302122', + 'Test::Tester::Capture' => '1.302122', + 'Test::Tester::CaptureRunner'=> '1.302122', + 'Test::Tester::Delegate'=> '1.302122', + 'Test::use::ok' => '1.302122', + 'Time::HiRes' => '1.9753', + 'XS::APItest' => '0.96', + 'bigint' => '0.49', + 'bignum' => '0.49', + 'bigrat' => '0.49', + 'encoding' => '2.22', + 'if' => '0.0608', + 'mro' => '1.22', + 'ok' => '1.302122', + 'threads' => '2.22', + 'warnings' => '1.41', + }, + removed => { + 'Module::CoreList::TieHashDelta'=> 1, + } + }, + 5.027010 => { + delta_from => 5.027009, + changed => { + 'App::Prove' => '3.42', + 'App::Prove::State' => '3.42', + 'App::Prove::State::Result'=> '3.42', + 'App::Prove::State::Result::Test'=> '3.42', + 'B::Deparse' => '1.48', + 'B::Op_private' => '5.027010', + 'Carp' => '1.49', + 'Carp::Heavy' => '1.49', + 'Config' => '5.02701', + 'Encode' => '2.97', + 'ExtUtils::Command' => '7.34', + 'ExtUtils::Command::MM' => '7.34', + 'ExtUtils::Liblist' => '7.34', + 'ExtUtils::Liblist::Kid'=> '7.34', + 'ExtUtils::MM' => '7.34', + 'ExtUtils::MM_AIX' => '7.34', + 'ExtUtils::MM_Any' => '7.34', + 'ExtUtils::MM_BeOS' => '7.34', + 'ExtUtils::MM_Cygwin' => '7.34', + 'ExtUtils::MM_DOS' => '7.34', + 'ExtUtils::MM_Darwin' => '7.34', + 'ExtUtils::MM_MacOS' => '7.34', + 'ExtUtils::MM_NW5' => '7.34', + 'ExtUtils::MM_OS2' => '7.34', + 'ExtUtils::MM_QNX' => '7.34', + 'ExtUtils::MM_UWIN' => '7.34', + 'ExtUtils::MM_Unix' => '7.34', + 'ExtUtils::MM_VMS' => '7.34', + 'ExtUtils::MM_VOS' => '7.34', + 'ExtUtils::MM_Win32' => '7.34', + 'ExtUtils::MM_Win95' => '7.34', + 'ExtUtils::MY' => '7.34', + 'ExtUtils::MakeMaker' => '7.34', + 'ExtUtils::MakeMaker::Config'=> '7.34', + 'ExtUtils::MakeMaker::Locale'=> '7.34', + 'ExtUtils::MakeMaker::version'=> '7.34', + 'ExtUtils::MakeMaker::version::regex'=> '7.34', + 'ExtUtils::Mkbootstrap' => '7.34', + 'ExtUtils::Mksymlists' => '7.34', + 'ExtUtils::ParseXS' => '3.39', + 'ExtUtils::ParseXS::Constants'=> '3.39', + 'ExtUtils::ParseXS::CountLines'=> '3.39', + 'ExtUtils::ParseXS::Eval'=> '3.39', + 'ExtUtils::ParseXS::Utilities'=> '3.39', + 'ExtUtils::testlib' => '7.34', + 'File::Glob' => '1.31', + 'I18N::Langinfo' => '0.16', + 'List::Util' => '1.50', + 'List::Util::XS' => '1.50', + 'Locale::Codes' => '3.56', + 'Locale::Codes::Constants'=> '3.56', + 'Locale::Codes::Country'=> '3.56', + 'Locale::Codes::Country_Codes'=> '3.56', + 'Locale::Codes::Country_Retired'=> '3.56', + 'Locale::Codes::Currency'=> '3.56', + 'Locale::Codes::Currency_Codes'=> '3.56', + 'Locale::Codes::Currency_Retired'=> '3.56', + 'Locale::Codes::LangExt'=> '3.56', + 'Locale::Codes::LangExt_Codes'=> '3.56', + 'Locale::Codes::LangExt_Retired'=> '3.56', + 'Locale::Codes::LangFam'=> '3.56', + 'Locale::Codes::LangFam_Codes'=> '3.56', + 'Locale::Codes::LangFam_Retired'=> '3.56', + 'Locale::Codes::LangVar'=> '3.56', + 'Locale::Codes::LangVar_Codes'=> '3.56', + 'Locale::Codes::LangVar_Retired'=> '3.56', + 'Locale::Codes::Language'=> '3.56', + 'Locale::Codes::Language_Codes'=> '3.56', + 'Locale::Codes::Language_Retired'=> '3.56', + 'Locale::Codes::Script' => '3.56', + 'Locale::Codes::Script_Codes'=> '3.56', + 'Locale::Codes::Script_Retired'=> '3.56', + 'Locale::Country' => '3.56', + 'Locale::Currency' => '3.56', + 'Locale::Language' => '3.56', + 'Locale::Script' => '3.56', + 'Module::CoreList' => '5.20180221', + 'Module::CoreList::Utils'=> '5.20180221', + 'POSIX' => '1.83', + 'Scalar::Util' => '1.50', + 'Sub::Util' => '1.50', + 'TAP::Base' => '3.42', + 'TAP::Formatter::Base' => '3.42', + 'TAP::Formatter::Color' => '3.42', + 'TAP::Formatter::Console'=> '3.42', + 'TAP::Formatter::Console::ParallelSession'=> '3.42', + 'TAP::Formatter::Console::Session'=> '3.42', + 'TAP::Formatter::File' => '3.42', + 'TAP::Formatter::File::Session'=> '3.42', + 'TAP::Formatter::Session'=> '3.42', + 'TAP::Harness' => '3.42', + 'TAP::Harness::Env' => '3.42', + 'TAP::Object' => '3.42', + 'TAP::Parser' => '3.42', + 'TAP::Parser::Aggregator'=> '3.42', + 'TAP::Parser::Grammar' => '3.42', + 'TAP::Parser::Iterator' => '3.42', + 'TAP::Parser::Iterator::Array'=> '3.42', + 'TAP::Parser::Iterator::Process'=> '3.42', + 'TAP::Parser::Iterator::Stream'=> '3.42', + 'TAP::Parser::IteratorFactory'=> '3.42', + 'TAP::Parser::Multiplexer'=> '3.42', + 'TAP::Parser::Result' => '3.42', + 'TAP::Parser::Result::Bailout'=> '3.42', + 'TAP::Parser::Result::Comment'=> '3.42', + 'TAP::Parser::Result::Plan'=> '3.42', + 'TAP::Parser::Result::Pragma'=> '3.42', + 'TAP::Parser::Result::Test'=> '3.42', + 'TAP::Parser::Result::Unknown'=> '3.42', + 'TAP::Parser::Result::Version'=> '3.42', + 'TAP::Parser::Result::YAML'=> '3.42', + 'TAP::Parser::ResultFactory'=> '3.42', + 'TAP::Parser::Scheduler'=> '3.42', + 'TAP::Parser::Scheduler::Job'=> '3.42', + 'TAP::Parser::Scheduler::Spinner'=> '3.42', + 'TAP::Parser::Source' => '3.42', + 'TAP::Parser::SourceHandler'=> '3.42', + 'TAP::Parser::SourceHandler::Executable'=> '3.42', + 'TAP::Parser::SourceHandler::File'=> '3.42', + 'TAP::Parser::SourceHandler::Handle'=> '3.42', + 'TAP::Parser::SourceHandler::Perl'=> '3.42', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.42', + 'TAP::Parser::YAMLish::Reader'=> '3.42', + 'TAP::Parser::YAMLish::Writer'=> '3.42', + 'Test2' => '1.302133', + 'Test2::API' => '1.302133', + 'Test2::API::Breakage' => '1.302133', + 'Test2::API::Context' => '1.302133', + 'Test2::API::Instance' => '1.302133', + 'Test2::API::Stack' => '1.302133', + 'Test2::Event' => '1.302133', + 'Test2::Event::Bail' => '1.302133', + 'Test2::Event::Diag' => '1.302133', + 'Test2::Event::Encoding'=> '1.302133', + 'Test2::Event::Exception'=> '1.302133', + 'Test2::Event::Fail' => '1.302133', + 'Test2::Event::Generic' => '1.302133', + 'Test2::Event::Note' => '1.302133', + 'Test2::Event::Ok' => '1.302133', + 'Test2::Event::Pass' => '1.302133', + 'Test2::Event::Plan' => '1.302133', + 'Test2::Event::Skip' => '1.302133', + 'Test2::Event::Subtest' => '1.302133', + 'Test2::Event::TAP::Version'=> '1.302133', + 'Test2::Event::V2' => '1.302133', + 'Test2::Event::Waiting' => '1.302133', + 'Test2::EventFacet' => '1.302133', + 'Test2::EventFacet::About'=> '1.302133', + 'Test2::EventFacet::Amnesty'=> '1.302133', + 'Test2::EventFacet::Assert'=> '1.302133', + 'Test2::EventFacet::Control'=> '1.302133', + 'Test2::EventFacet::Error'=> '1.302133', + 'Test2::EventFacet::Hub'=> '1.302133', + 'Test2::EventFacet::Info'=> '1.302133', + 'Test2::EventFacet::Meta'=> '1.302133', + 'Test2::EventFacet::Parent'=> '1.302133', + 'Test2::EventFacet::Plan'=> '1.302133', + 'Test2::EventFacet::Render'=> '1.302133', + 'Test2::EventFacet::Trace'=> '1.302133', + 'Test2::Formatter' => '1.302133', + 'Test2::Formatter::TAP' => '1.302133', + 'Test2::Hub' => '1.302133', + 'Test2::Hub::Interceptor'=> '1.302133', + 'Test2::Hub::Interceptor::Terminator'=> '1.302133', + 'Test2::Hub::Subtest' => '1.302133', + 'Test2::IPC' => '1.302133', + 'Test2::IPC::Driver' => '1.302133', + 'Test2::IPC::Driver::Files'=> '1.302133', + 'Test2::Tools::Tiny' => '1.302133', + 'Test2::Util' => '1.302133', + 'Test2::Util::ExternalMeta'=> '1.302133', + 'Test2::Util::Facets2Legacy'=> '1.302133', + 'Test2::Util::HashBase' => '1.302133', + 'Test2::Util::Trace' => '1.302133', + 'Test::Builder' => '1.302133', + 'Test::Builder::Formatter'=> '1.302133', + 'Test::Builder::Module' => '1.302133', + 'Test::Builder::Tester' => '1.302133', + 'Test::Builder::Tester::Color'=> '1.302133', + 'Test::Builder::TodoDiag'=> '1.302133', + 'Test::Harness' => '3.42', + 'Test::More' => '1.302133', + 'Test::Simple' => '1.302133', + 'Test::Tester' => '1.302133', + 'Test::Tester::Capture' => '1.302133', + 'Test::Tester::CaptureRunner'=> '1.302133', + 'Test::Tester::Delegate'=> '1.302133', + 'Test::use::ok' => '1.302133', + 'Time::HiRes' => '1.9757', + 'Time::Piece' => '1.3204', + 'Time::Seconds' => '1.3204', + 'attributes' => '0.33', + 'ok' => '1.302133', + 'warnings' => '1.42', + }, + removed => { + } + }, + 5.024004 => { + delta_from => 5.024003, + changed => { + 'B::Op_private' => '5.024004', + 'Config' => '5.024004', + 'Module::CoreList' => '5.20180414_24', + 'Module::CoreList::TieHashDelta'=> '5.20180414_24', + 'Module::CoreList::Utils'=> '5.20180414_24', + }, + removed => { + } + }, + 5.026002 => { + delta_from => 5.026001, + changed => { + 'B::Op_private' => '5.026002', + 'Config' => '5.026002', + 'Module::CoreList' => '5.20180414_26', + 'Module::CoreList::TieHashDelta'=> '5.20180414_26', + 'Module::CoreList::Utils'=> '5.20180414_26', + 'PerlIO::via' => '0.17', + 'Term::ReadLine' => '1.17', + 'Unicode::UCD' => '0.69', + }, + removed => { + } + }, + 5.027011 => { + delta_from => 5.027010, + changed => { + 'B::Op_private' => '5.027011', + 'Carp' => '1.50', + 'Carp::Heavy' => '1.50', + 'Config' => '5.027011', + 'Devel::PPPort' => '3.40', + 'Exporter' => '5.73', + 'Exporter::Heavy' => '5.73', + 'ExtUtils::Constant' => '0.25', + 'I18N::Langinfo' => '0.17', + 'IO' => '1.39', + 'IO::Dir' => '1.39', + 'IO::File' => '1.39', + 'IO::Handle' => '1.39', + 'IO::Pipe' => '1.39', + 'IO::Poll' => '1.39', + 'IO::Seekable' => '1.39', + 'IO::Select' => '1.39', + 'IO::Socket' => '1.39', + 'IO::Socket::INET' => '1.39', + 'IO::Socket::UNIX' => '1.39', + 'Module::CoreList' => '5.20180420', + 'Module::CoreList::Utils'=> '5.20180420', + 'POSIX' => '1.84', + 'Time::HiRes' => '1.9759', + 'XS::APItest' => '0.97', + 'bytes' => '1.06', + 'subs' => '1.03', + 'vars' => '1.04', + 'version' => '0.9923', + 'version::regex' => '0.9923', + }, + removed => { + } + }, + 5.028000 => { + delta_from => 5.027011, + changed => { + 'Archive::Tar' => '2.30', + 'Archive::Tar::Constant'=> '2.30', + 'Archive::Tar::File' => '2.30', + 'B::Op_private' => '5.028000', + 'Config' => '5.028', + 'Module::CoreList' => '5.20180622', + 'Module::CoreList::Utils'=> '5.20180622', + 'Storable' => '3.08', + 'XS::APItest' => '0.98', + 'feature' => '1.52', + }, + removed => { + } + }, + 5.029000 => { + delta_from => 5.028, + changed => { + 'B::Op_private' => '5.029000', + 'Config' => '5.029', + 'Module::CoreList' => '5.20180626', + 'Module::CoreList::Utils'=> '5.20180626', + 'Unicode::UCD' => '0.71', + 'XS::APItest' => '0.99', + 'feature' => '1.53', + }, + removed => { + } + }, + 5.029001 => { + delta_from => 5.029000, + changed => { + 'B::Op_private' => '5.029001', + 'Compress::Raw::Bzip2' => '2.081', + 'Compress::Raw::Zlib' => '2.081', + 'Compress::Zlib' => '2.081', + 'Config' => '5.029001', + 'Config::Perl::V' => '0.30', + 'DB_File' => '1.842', + 'Devel::PPPort' => '3.42', + 'Digest::SHA' => '6.02', + 'ExtUtils::Manifest' => '1.71', + 'File::GlobMapper' => '1.001', + 'File::Temp' => '0.2308', + 'IO::Compress::Adapter::Bzip2'=> '2.081', + 'IO::Compress::Adapter::Deflate'=> '2.081', + 'IO::Compress::Adapter::Identity'=> '2.081', + 'IO::Compress::Base' => '2.081', + 'IO::Compress::Base::Common'=> '2.081', + 'IO::Compress::Bzip2' => '2.081', + 'IO::Compress::Deflate' => '2.081', + 'IO::Compress::Gzip' => '2.081', + 'IO::Compress::Gzip::Constants'=> '2.081', + 'IO::Compress::RawDeflate'=> '2.081', + 'IO::Compress::Zip' => '2.081', + 'IO::Compress::Zip::Constants'=> '2.081', + 'IO::Compress::Zlib::Constants'=> '2.081', + 'IO::Compress::Zlib::Extra'=> '2.081', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.081', + 'IO::Uncompress::Adapter::Identity'=> '2.081', + 'IO::Uncompress::Adapter::Inflate'=> '2.081', + 'IO::Uncompress::AnyInflate'=> '2.081', + 'IO::Uncompress::AnyUncompress'=> '2.081', + 'IO::Uncompress::Base' => '2.081', + 'IO::Uncompress::Bunzip2'=> '2.081', + 'IO::Uncompress::Gunzip'=> '2.081', + 'IO::Uncompress::Inflate'=> '2.081', + 'IO::Uncompress::RawInflate'=> '2.081', + 'IO::Uncompress::Unzip' => '2.081', + 'IPC::Cmd' => '1.02', + 'Locale::Codes' => '3.57', + 'Locale::Codes::Constants'=> '3.57', + 'Locale::Codes::Country'=> '3.57', + 'Locale::Codes::Country_Codes'=> '3.57', + 'Locale::Codes::Country_Retired'=> '3.57', + 'Locale::Codes::Currency'=> '3.57', + 'Locale::Codes::Currency_Codes'=> '3.57', + 'Locale::Codes::Currency_Retired'=> '3.57', + 'Locale::Codes::LangExt'=> '3.57', + 'Locale::Codes::LangExt_Codes'=> '3.57', + 'Locale::Codes::LangExt_Retired'=> '3.57', + 'Locale::Codes::LangFam'=> '3.57', + 'Locale::Codes::LangFam_Codes'=> '3.57', + 'Locale::Codes::LangFam_Retired'=> '3.57', + 'Locale::Codes::LangVar'=> '3.57', + 'Locale::Codes::LangVar_Codes'=> '3.57', + 'Locale::Codes::LangVar_Retired'=> '3.57', + 'Locale::Codes::Language'=> '3.57', + 'Locale::Codes::Language_Codes'=> '3.57', + 'Locale::Codes::Language_Retired'=> '3.57', + 'Locale::Codes::Script' => '3.57', + 'Locale::Codes::Script_Codes'=> '3.57', + 'Locale::Codes::Script_Retired'=> '3.57', + 'Locale::Country' => '3.57', + 'Locale::Currency' => '3.57', + 'Locale::Language' => '3.57', + 'Locale::Script' => '3.57', + 'Math::BigFloat' => '1.999813', + 'Math::BigFloat::Trace' => '0.50', + 'Math::BigInt' => '1.999813', + 'Math::BigInt::Calc' => '1.999813', + 'Math::BigInt::CalcEmu' => '1.999813', + 'Math::BigInt::FastCalc'=> '0.5007', + 'Math::BigInt::Lib' => '1.999813', + 'Math::BigInt::Trace' => '0.50', + 'Math::BigRat' => '0.2614', + 'Module::CoreList' => '5.20180720', + 'Module::CoreList::Utils'=> '5.20180720', + 'Pod::Man' => '4.11', + 'Pod::ParseLink' => '4.11', + 'Pod::Text' => '4.11', + 'Pod::Text::Color' => '4.11', + 'Pod::Text::Overstrike' => '4.11', + 'Pod::Text::Termcap' => '4.11', + 'Storable' => '3.11', + 'Test2' => '1.302138', + 'Test2::API' => '1.302138', + 'Test2::API::Breakage' => '1.302138', + 'Test2::API::Context' => '1.302138', + 'Test2::API::Instance' => '1.302138', + 'Test2::API::Stack' => '1.302138', + 'Test2::Event' => '1.302138', + 'Test2::Event::Bail' => '1.302138', + 'Test2::Event::Diag' => '1.302138', + 'Test2::Event::Encoding'=> '1.302138', + 'Test2::Event::Exception'=> '1.302138', + 'Test2::Event::Fail' => '1.302138', + 'Test2::Event::Generic' => '1.302138', + 'Test2::Event::Note' => '1.302138', + 'Test2::Event::Ok' => '1.302138', + 'Test2::Event::Pass' => '1.302138', + 'Test2::Event::Plan' => '1.302138', + 'Test2::Event::Skip' => '1.302138', + 'Test2::Event::Subtest' => '1.302138', + 'Test2::Event::TAP::Version'=> '1.302138', + 'Test2::Event::V2' => '1.302138', + 'Test2::Event::Waiting' => '1.302138', + 'Test2::EventFacet' => '1.302138', + 'Test2::EventFacet::About'=> '1.302138', + 'Test2::EventFacet::Amnesty'=> '1.302138', + 'Test2::EventFacet::Assert'=> '1.302138', + 'Test2::EventFacet::Control'=> '1.302138', + 'Test2::EventFacet::Error'=> '1.302138', + 'Test2::EventFacet::Hub'=> '1.302138', + 'Test2::EventFacet::Info'=> '1.302138', + 'Test2::EventFacet::Meta'=> '1.302138', + 'Test2::EventFacet::Parent'=> '1.302138', + 'Test2::EventFacet::Plan'=> '1.302138', + 'Test2::EventFacet::Render'=> '1.302138', + 'Test2::EventFacet::Trace'=> '1.302138', + 'Test2::Formatter' => '1.302138', + 'Test2::Formatter::TAP' => '1.302138', + 'Test2::Hub' => '1.302138', + 'Test2::Hub::Interceptor'=> '1.302138', + 'Test2::Hub::Interceptor::Terminator'=> '1.302138', + 'Test2::Hub::Subtest' => '1.302138', + 'Test2::IPC' => '1.302138', + 'Test2::IPC::Driver' => '1.302138', + 'Test2::IPC::Driver::Files'=> '1.302138', + 'Test2::Tools::Tiny' => '1.302138', + 'Test2::Util' => '1.302138', + 'Test2::Util::ExternalMeta'=> '1.302138', + 'Test2::Util::Facets2Legacy'=> '1.302138', + 'Test2::Util::HashBase' => '1.302138', + 'Test2::Util::Trace' => '1.302138', + 'Test::Builder' => '1.302138', + 'Test::Builder::Formatter'=> '1.302138', + 'Test::Builder::Module' => '1.302138', + 'Test::Builder::Tester' => '1.302138', + 'Test::Builder::Tester::Color'=> '1.302138', + 'Test::Builder::TodoDiag'=> '1.302138', + 'Test::More' => '1.302138', + 'Test::Simple' => '1.302138', + 'Test::Tester' => '1.302138', + 'Test::Tester::Capture' => '1.302138', + 'Test::Tester::CaptureRunner'=> '1.302138', + 'Test::Tester::Delegate'=> '1.302138', + 'Test::use::ok' => '1.302138', + 'Thread::Queue' => '3.13', + 'Time::Local' => '1.28', + 'bigint' => '0.50', + 'bignum' => '0.50', + 'bigrat' => '0.50', + 'experimental' => '0.020', + 'ok' => '1.302138', + 'parent' => '0.237', + 'perlfaq' => '5.20180605', + 'version' => '0.9924', + 'version::regex' => '0.9924', + }, + removed => { + } + }, + 5.029002 => { + delta_from => 5.029001, + changed => { + 'B::Op_private' => '5.029002', + 'Config' => '5.029002', + 'Config::Extensions' => '0.03', + 'Cwd' => '3.75', + 'Data::Dumper' => '2.171', + 'Filter::Util::Call' => '1.59', + 'HTTP::Tiny' => '0.076', + 'Module::CoreList' => '5.20180820', + 'Module::CoreList::Utils'=> '5.20180820', + 'PerlIO::scalar' => '0.30', + 'Storable' => '3.12', + 'Test2' => '1.302140', + 'Test2::API' => '1.302140', + 'Test2::API::Breakage' => '1.302140', + 'Test2::API::Context' => '1.302140', + 'Test2::API::Instance' => '1.302140', + 'Test2::API::Stack' => '1.302140', + 'Test2::Event' => '1.302140', + 'Test2::Event::Bail' => '1.302140', + 'Test2::Event::Diag' => '1.302140', + 'Test2::Event::Encoding'=> '1.302140', + 'Test2::Event::Exception'=> '1.302140', + 'Test2::Event::Fail' => '1.302140', + 'Test2::Event::Generic' => '1.302140', + 'Test2::Event::Note' => '1.302140', + 'Test2::Event::Ok' => '1.302140', + 'Test2::Event::Pass' => '1.302140', + 'Test2::Event::Plan' => '1.302140', + 'Test2::Event::Skip' => '1.302140', + 'Test2::Event::Subtest' => '1.302140', + 'Test2::Event::TAP::Version'=> '1.302140', + 'Test2::Event::V2' => '1.302140', + 'Test2::Event::Waiting' => '1.302140', + 'Test2::EventFacet' => '1.302140', + 'Test2::EventFacet::About'=> '1.302140', + 'Test2::EventFacet::Amnesty'=> '1.302140', + 'Test2::EventFacet::Assert'=> '1.302140', + 'Test2::EventFacet::Control'=> '1.302140', + 'Test2::EventFacet::Error'=> '1.302140', + 'Test2::EventFacet::Hub'=> '1.302140', + 'Test2::EventFacet::Info'=> '1.302140', + 'Test2::EventFacet::Meta'=> '1.302140', + 'Test2::EventFacet::Parent'=> '1.302140', + 'Test2::EventFacet::Plan'=> '1.302140', + 'Test2::EventFacet::Render'=> '1.302140', + 'Test2::EventFacet::Trace'=> '1.302140', + 'Test2::Formatter' => '1.302140', + 'Test2::Formatter::TAP' => '1.302140', + 'Test2::Hub' => '1.302140', + 'Test2::Hub::Interceptor'=> '1.302140', + 'Test2::Hub::Interceptor::Terminator'=> '1.302140', + 'Test2::Hub::Subtest' => '1.302140', + 'Test2::IPC' => '1.302140', + 'Test2::IPC::Driver' => '1.302140', + 'Test2::IPC::Driver::Files'=> '1.302140', + 'Test2::Tools::Tiny' => '1.302140', + 'Test2::Util' => '1.302140', + 'Test2::Util::ExternalMeta'=> '1.302140', + 'Test2::Util::Facets2Legacy'=> '1.302140', + 'Test2::Util::HashBase' => '1.302140', + 'Test2::Util::Trace' => '1.302140', + 'Test::Builder' => '1.302140', + 'Test::Builder::Formatter'=> '1.302140', + 'Test::Builder::Module' => '1.302140', + 'Test::Builder::Tester' => '1.302140', + 'Test::Builder::Tester::Color'=> '1.302140', + 'Test::Builder::TodoDiag'=> '1.302140', + 'Test::More' => '1.302140', + 'Test::Simple' => '1.302140', + 'Test::Tester' => '1.302140', + 'Test::Tester::Capture' => '1.302140', + 'Test::Tester::CaptureRunner'=> '1.302140', + 'Test::Tester::Delegate'=> '1.302140', + 'Test::use::ok' => '1.302140', + 'Time::HiRes' => '1.9760', + 'Time::Piece' => '1.33', + 'Time::Seconds' => '1.33', + 'Unicode' => '11.0.0', + 'ok' => '1.302140', + 'warnings' => '1.43', + }, + removed => { + } + }, + 5.029003 => { + delta_from => 5.029002, + changed => { + 'Archive::Tar' => '2.32', + 'Archive::Tar::Constant'=> '2.32', + 'Archive::Tar::File' => '2.32', + 'B::Op_private' => '5.029003', + 'Config' => '5.029003', + 'Data::Dumper' => '2.172', + 'Devel::PPPort' => '3.43', + 'File::Path' => '2.16', + 'File::Spec' => '3.75', + 'File::Spec::AmigaOS' => '3.75', + 'File::Spec::Cygwin' => '3.75', + 'File::Spec::Epoc' => '3.75', + 'File::Spec::Functions' => '3.75', + 'File::Spec::Mac' => '3.75', + 'File::Spec::OS2' => '3.75', + 'File::Spec::Unix' => '3.75', + 'File::Spec::VMS' => '3.75', + 'File::Spec::Win32' => '3.75', + 'Module::CoreList' => '5.20180920', + 'Module::CoreList::Utils'=> '5.20180920', + 'POSIX' => '1.85', + 'Storable' => '3.13', + 'User::grent' => '1.03', + 'perlfaq' => '5.20180915', + }, + removed => { + 'Locale::Codes' => 1, + 'Locale::Codes::Constants'=> 1, + 'Locale::Codes::Country'=> 1, + 'Locale::Codes::Country_Codes'=> 1, + 'Locale::Codes::Country_Retired'=> 1, + 'Locale::Codes::Currency'=> 1, + 'Locale::Codes::Currency_Codes'=> 1, + 'Locale::Codes::Currency_Retired'=> 1, + 'Locale::Codes::LangExt'=> 1, + 'Locale::Codes::LangExt_Codes'=> 1, + 'Locale::Codes::LangExt_Retired'=> 1, + 'Locale::Codes::LangFam'=> 1, + 'Locale::Codes::LangFam_Codes'=> 1, + 'Locale::Codes::LangFam_Retired'=> 1, + 'Locale::Codes::LangVar'=> 1, + 'Locale::Codes::LangVar_Codes'=> 1, + 'Locale::Codes::LangVar_Retired'=> 1, + 'Locale::Codes::Language'=> 1, + 'Locale::Codes::Language_Codes'=> 1, + 'Locale::Codes::Language_Retired'=> 1, + 'Locale::Codes::Script' => 1, + 'Locale::Codes::Script_Codes'=> 1, + 'Locale::Codes::Script_Retired'=> 1, + 'Locale::Country' => 1, + 'Locale::Currency' => 1, + 'Locale::Language' => 1, + 'Locale::Script' => 1, + } + }, + 5.029004 => { + delta_from => 5.029003, + changed => { + 'App::Cpan' => '1.671', + 'B' => '1.75', + 'B::Concise' => '1.004', + 'B::Deparse' => '1.49', + 'B::Op_private' => '5.029004', + 'B::Terse' => '1.09', + 'CPAN' => '2.21', + 'CPAN::Distribution' => '2.21', + 'CPAN::Mirrors' => '2.21', + 'CPAN::Plugin' => '0.97', + 'CPAN::Shell' => '5.5008', + 'Config' => '5.029004', + 'Devel::Peek' => '1.28', + 'File::Copy' => '2.34', + 'File::Glob' => '1.32', + 'Math::BigFloat::Trace' => '0.51', + 'Math::BigInt::Trace' => '0.51', + 'Module::CoreList' => '5.20181020', + 'Module::CoreList::Utils'=> '5.20181020', + 'Unicode::UCD' => '0.72', + 'bigint' => '0.51', + 'bignum' => '0.51', + 'bigrat' => '0.51', + 'bytes' => '1.07', + 'feature' => '1.54', + 'sigtrap' => '1.09', + 'vars' => '1.05', + }, + removed => { + 'B::Debug' => 1, + 'arybase' => 1, + } + }, + 5.029005 => { + delta_from => 5.029004, + changed => { + 'B::Op_private' => '5.029005', + 'Config' => '5.029005', + 'Cwd' => '3.76', + 'Data::Dumper' => '2.173', + 'Errno' => '1.30', + 'File::Spec' => '3.76', + 'File::Spec::AmigaOS' => '3.76', + 'File::Spec::Cygwin' => '3.76', + 'File::Spec::Epoc' => '3.76', + 'File::Spec::Functions' => '3.76', + 'File::Spec::Mac' => '3.76', + 'File::Spec::OS2' => '3.76', + 'File::Spec::Unix' => '3.76', + 'File::Spec::VMS' => '3.76', + 'File::Spec::Win32' => '3.76', + 'GDBM_File' => '1.18', + 'Module::CoreList' => '5.20181120', + 'Module::CoreList::Utils'=> '5.20181120', + 'NDBM_File' => '1.15', + 'ODBM_File' => '1.16', + 'SDBM_File' => '1.15', + 're' => '0.37', + }, + removed => { + } + }, + 5.026003 => { + delta_from => 5.026002, + changed => { + 'Archive::Tar' => '2.24_01', + 'B::Op_private' => '5.026003', + 'Config' => '5.026003', + 'Module::CoreList' => '5.20181129_26', + 'Module::CoreList::TieHashDelta'=> '5.20181129_26', + 'Module::CoreList::Utils'=> '5.20181129_26', + }, + removed => { + } + }, + 5.028001 => { + delta_from => 5.028, + changed => { + 'B::Op_private' => '5.028001', + 'Config' => '5.028001', + 'Module::CoreList' => '5.20181129_28', + 'Module::CoreList::Utils'=> '5.20181129_28', + }, + removed => { + } + }, + 5.029006 => { + delta_from => 5.029005, + changed => { + 'B::Op_private' => '5.029006', + 'Config' => '5.029006', + 'Config::Perl::V' => '0.32', + 'ExtUtils::ParseXS' => '3.40', + 'ExtUtils::ParseXS::Constants'=> '3.40', + 'ExtUtils::ParseXS::CountLines'=> '3.40', + 'ExtUtils::ParseXS::Eval'=> '3.40', + 'ExtUtils::ParseXS::Utilities'=> '3.40', + 'File::Find' => '1.35', + 'Module::CoreList' => '5.20181218', + 'Module::CoreList::Utils'=> '5.20181218', + 'POSIX' => '1.86', + 'Storable' => '3.14', + 'Test2' => '1.302141', + 'Test2::API' => '1.302141', + 'Test2::API::Breakage' => '1.302141', + 'Test2::API::Context' => '1.302141', + 'Test2::API::Instance' => '1.302141', + 'Test2::API::Stack' => '1.302141', + 'Test2::Event' => '1.302141', + 'Test2::Event::Bail' => '1.302141', + 'Test2::Event::Diag' => '1.302141', + 'Test2::Event::Encoding'=> '1.302141', + 'Test2::Event::Exception'=> '1.302141', + 'Test2::Event::Fail' => '1.302141', + 'Test2::Event::Generic' => '1.302141', + 'Test2::Event::Note' => '1.302141', + 'Test2::Event::Ok' => '1.302141', + 'Test2::Event::Pass' => '1.302141', + 'Test2::Event::Plan' => '1.302141', + 'Test2::Event::Skip' => '1.302141', + 'Test2::Event::Subtest' => '1.302141', + 'Test2::Event::TAP::Version'=> '1.302141', + 'Test2::Event::V2' => '1.302141', + 'Test2::Event::Waiting' => '1.302141', + 'Test2::EventFacet' => '1.302141', + 'Test2::EventFacet::About'=> '1.302141', + 'Test2::EventFacet::Amnesty'=> '1.302141', + 'Test2::EventFacet::Assert'=> '1.302141', + 'Test2::EventFacet::Control'=> '1.302141', + 'Test2::EventFacet::Error'=> '1.302141', + 'Test2::EventFacet::Hub'=> '1.302141', + 'Test2::EventFacet::Info'=> '1.302141', + 'Test2::EventFacet::Meta'=> '1.302141', + 'Test2::EventFacet::Parent'=> '1.302141', + 'Test2::EventFacet::Plan'=> '1.302141', + 'Test2::EventFacet::Render'=> '1.302141', + 'Test2::EventFacet::Trace'=> '1.302141', + 'Test2::Formatter' => '1.302141', + 'Test2::Formatter::TAP' => '1.302141', + 'Test2::Hub' => '1.302141', + 'Test2::Hub::Interceptor'=> '1.302141', + 'Test2::Hub::Interceptor::Terminator'=> '1.302141', + 'Test2::Hub::Subtest' => '1.302141', + 'Test2::IPC' => '1.302141', + 'Test2::IPC::Driver' => '1.302141', + 'Test2::IPC::Driver::Files'=> '1.302141', + 'Test2::Tools::Tiny' => '1.302141', + 'Test2::Util' => '1.302141', + 'Test2::Util::ExternalMeta'=> '1.302141', + 'Test2::Util::Facets2Legacy'=> '1.302141', + 'Test2::Util::HashBase' => '1.302141', + 'Test2::Util::Trace' => '1.302141', + 'Test::Builder' => '1.302141', + 'Test::Builder::Formatter'=> '1.302141', + 'Test::Builder::Module' => '1.302141', + 'Test::Builder::Tester' => '1.302141', + 'Test::Builder::Tester::Color'=> '1.302141', + 'Test::Builder::TodoDiag'=> '1.302141', + 'Test::More' => '1.302141', + 'Test::Simple' => '1.302141', + 'Test::Tester' => '1.302141', + 'Test::Tester::Capture' => '1.302141', + 'Test::Tester::CaptureRunner'=> '1.302141', + 'Test::Tester::Delegate'=> '1.302141', + 'Test::use::ok' => '1.302141', + 'ok' => '1.302141', + 'threads::shared' => '1.59', + }, + removed => { + 'Storable::Limit' => 1, + } + }, + 5.029007 => { + delta_from => 5.029006, + changed => { + 'App::Cpan' => '1.672', + 'B::Op_private' => '5.029007', + 'CPAN' => '2.22', + 'CPAN::Distribution' => '2.22', + 'CPAN::Plugin::Specfile'=> '0.02', + 'Compress::Raw::Bzip2' => '2.084', + 'Compress::Raw::Zlib' => '2.084', + 'Compress::Zlib' => '2.084', + 'Config' => '5.029007', + 'Cwd' => '3.77', + 'DB_File' => '1.843', + 'File::Find' => '1.36', + 'File::Spec' => '3.77', + 'File::Spec::AmigaOS' => '3.77', + 'File::Spec::Cygwin' => '3.77', + 'File::Spec::Epoc' => '3.77', + 'File::Spec::Functions' => '3.77', + 'File::Spec::Mac' => '3.77', + 'File::Spec::OS2' => '3.77', + 'File::Spec::Unix' => '3.77', + 'File::Spec::VMS' => '3.77', + 'File::Spec::Win32' => '3.77', + 'File::Temp' => '0.2309', + 'IO::Compress::Adapter::Bzip2'=> '2.084', + 'IO::Compress::Adapter::Deflate'=> '2.084', + 'IO::Compress::Adapter::Identity'=> '2.084', + 'IO::Compress::Base' => '2.084', + 'IO::Compress::Base::Common'=> '2.084', + 'IO::Compress::Bzip2' => '2.084', + 'IO::Compress::Deflate' => '2.084', + 'IO::Compress::Gzip' => '2.084', + 'IO::Compress::Gzip::Constants'=> '2.084', + 'IO::Compress::RawDeflate'=> '2.084', + 'IO::Compress::Zip' => '2.084', + 'IO::Compress::Zip::Constants'=> '2.084', + 'IO::Compress::Zlib::Constants'=> '2.084', + 'IO::Compress::Zlib::Extra'=> '2.084', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.084', + 'IO::Uncompress::Adapter::Identity'=> '2.084', + 'IO::Uncompress::Adapter::Inflate'=> '2.084', + 'IO::Uncompress::AnyInflate'=> '2.084', + 'IO::Uncompress::AnyUncompress'=> '2.084', + 'IO::Uncompress::Base' => '2.084', + 'IO::Uncompress::Bunzip2'=> '2.084', + 'IO::Uncompress::Gunzip'=> '2.084', + 'IO::Uncompress::Inflate'=> '2.084', + 'IO::Uncompress::RawInflate'=> '2.084', + 'IO::Uncompress::Unzip' => '2.084', + 'Math::BigFloat' => '1.999816', + 'Math::BigInt' => '1.999816', + 'Math::BigInt::Calc' => '1.999816', + 'Math::BigInt::FastCalc'=> '0.5008', + 'Math::BigInt::Lib' => '1.999816', + 'Module::CoreList' => '5.20190120', + 'Module::CoreList::Utils'=> '5.20190120', + 'Test2' => '1.302160', + 'Test2::API' => '1.302160', + 'Test2::API::Breakage' => '1.302160', + 'Test2::API::Context' => '1.302160', + 'Test2::API::Instance' => '1.302160', + 'Test2::API::Stack' => '1.302160', + 'Test2::Event' => '1.302160', + 'Test2::Event::Bail' => '1.302160', + 'Test2::Event::Diag' => '1.302160', + 'Test2::Event::Encoding'=> '1.302160', + 'Test2::Event::Exception'=> '1.302160', + 'Test2::Event::Fail' => '1.302160', + 'Test2::Event::Generic' => '1.302160', + 'Test2::Event::Note' => '1.302160', + 'Test2::Event::Ok' => '1.302160', + 'Test2::Event::Pass' => '1.302160', + 'Test2::Event::Plan' => '1.302160', + 'Test2::Event::Skip' => '1.302160', + 'Test2::Event::Subtest' => '1.302160', + 'Test2::Event::TAP::Version'=> '1.302160', + 'Test2::Event::V2' => '1.302160', + 'Test2::Event::Waiting' => '1.302160', + 'Test2::EventFacet' => '1.302160', + 'Test2::EventFacet::About'=> '1.302160', + 'Test2::EventFacet::Amnesty'=> '1.302160', + 'Test2::EventFacet::Assert'=> '1.302160', + 'Test2::EventFacet::Control'=> '1.302160', + 'Test2::EventFacet::Error'=> '1.302160', + 'Test2::EventFacet::Hub'=> '1.302160', + 'Test2::EventFacet::Info'=> '1.302160', + 'Test2::EventFacet::Info::Table'=> undef, + 'Test2::EventFacet::Meta'=> '1.302160', + 'Test2::EventFacet::Parent'=> '1.302160', + 'Test2::EventFacet::Plan'=> '1.302160', + 'Test2::EventFacet::Render'=> '1.302160', + 'Test2::EventFacet::Trace'=> '1.302160', + 'Test2::Formatter' => '1.302160', + 'Test2::Formatter::TAP' => '1.302160', + 'Test2::Hub' => '1.302160', + 'Test2::Hub::Interceptor'=> '1.302160', + 'Test2::Hub::Interceptor::Terminator'=> '1.302160', + 'Test2::Hub::Subtest' => '1.302160', + 'Test2::IPC' => '1.302160', + 'Test2::IPC::Driver' => '1.302160', + 'Test2::IPC::Driver::Files'=> '1.302160', + 'Test2::Tools::Tiny' => '1.302160', + 'Test2::Util' => '1.302160', + 'Test2::Util::ExternalMeta'=> '1.302160', + 'Test2::Util::Facets2Legacy'=> '1.302160', + 'Test2::Util::HashBase' => '1.302160', + 'Test2::Util::Trace' => '1.302160', + 'Test::Builder' => '1.302160', + 'Test::Builder::Formatter'=> '1.302160', + 'Test::Builder::Module' => '1.302160', + 'Test::Builder::Tester' => '1.302160', + 'Test::Builder::Tester::Color'=> '1.302160', + 'Test::Builder::TodoDiag'=> '1.302160', + 'Test::More' => '1.302160', + 'Test::Simple' => '1.302160', + 'Test::Tester' => '1.302160', + 'Test::Tester::Capture' => '1.302160', + 'Test::Tester::CaptureRunner'=> '1.302160', + 'Test::Tester::Delegate'=> '1.302160', + 'Test::use::ok' => '1.302160', + 'Unicode::Collate' => '1.27', + 'Unicode::Collate::CJK::Big5'=> '1.27', + 'Unicode::Collate::CJK::GB2312'=> '1.27', + 'Unicode::Collate::CJK::JISX0208'=> '1.27', + 'Unicode::Collate::CJK::Korean'=> '1.27', + 'Unicode::Collate::CJK::Pinyin'=> '1.27', + 'Unicode::Collate::CJK::Stroke'=> '1.27', + 'Unicode::Collate::CJK::Zhuyin'=> '1.27', + 'Unicode::Collate::Locale'=> '1.27', + 'lib' => '0.65', + 'ok' => '1.302160', + }, + removed => { + 'Math::BigInt::CalcEmu' => 1, + } + }, + 5.029008 => { + delta_from => 5.029007, + changed => { + 'B' => '1.76', + 'B::Op_private' => '5.029008', + 'Config' => '5.029008', + 'Devel::PPPort' => '3.44', + 'Encode' => '3.00', + 'Encode::Unicode' => '2.18', + 'ExtUtils::Miniperl' => '1.09', + 'IO' => '1.40', + 'IO::Dir' => '1.40', + 'IO::File' => '1.40', + 'IO::Handle' => '1.40', + 'IO::Pipe' => '1.40', + 'IO::Poll' => '1.40', + 'IO::Seekable' => '1.40', + 'IO::Select' => '1.40', + 'IO::Socket' => '1.40', + 'IO::Socket::INET' => '1.40', + 'IO::Socket::UNIX' => '1.40', + 'JSON::PP' => '4.00', + 'JSON::PP::Boolean' => '4.00', + 'Module::CoreList' => '5.20190220', + 'Module::CoreList::Utils'=> '5.20190220', + 'Module::Load' => '0.34', + 'Net::Ping' => '2.71', + 'POSIX' => '1.87', + 'Test2' => '1.302162', + 'Test2::API' => '1.302162', + 'Test2::API::Breakage' => '1.302162', + 'Test2::API::Context' => '1.302162', + 'Test2::API::Instance' => '1.302162', + 'Test2::API::Stack' => '1.302162', + 'Test2::Event' => '1.302162', + 'Test2::Event::Bail' => '1.302162', + 'Test2::Event::Diag' => '1.302162', + 'Test2::Event::Encoding'=> '1.302162', + 'Test2::Event::Exception'=> '1.302162', + 'Test2::Event::Fail' => '1.302162', + 'Test2::Event::Generic' => '1.302162', + 'Test2::Event::Note' => '1.302162', + 'Test2::Event::Ok' => '1.302162', + 'Test2::Event::Pass' => '1.302162', + 'Test2::Event::Plan' => '1.302162', + 'Test2::Event::Skip' => '1.302162', + 'Test2::Event::Subtest' => '1.302162', + 'Test2::Event::TAP::Version'=> '1.302162', + 'Test2::Event::V2' => '1.302162', + 'Test2::Event::Waiting' => '1.302162', + 'Test2::EventFacet' => '1.302162', + 'Test2::EventFacet::About'=> '1.302162', + 'Test2::EventFacet::Amnesty'=> '1.302162', + 'Test2::EventFacet::Assert'=> '1.302162', + 'Test2::EventFacet::Control'=> '1.302162', + 'Test2::EventFacet::Error'=> '1.302162', + 'Test2::EventFacet::Hub'=> '1.302162', + 'Test2::EventFacet::Info'=> '1.302162', + 'Test2::EventFacet::Meta'=> '1.302162', + 'Test2::EventFacet::Parent'=> '1.302162', + 'Test2::EventFacet::Plan'=> '1.302162', + 'Test2::EventFacet::Render'=> '1.302162', + 'Test2::EventFacet::Trace'=> '1.302162', + 'Test2::Formatter' => '1.302162', + 'Test2::Formatter::TAP' => '1.302162', + 'Test2::Hub' => '1.302162', + 'Test2::Hub::Interceptor'=> '1.302162', + 'Test2::Hub::Interceptor::Terminator'=> '1.302162', + 'Test2::Hub::Subtest' => '1.302162', + 'Test2::IPC' => '1.302162', + 'Test2::IPC::Driver' => '1.302162', + 'Test2::IPC::Driver::Files'=> '1.302162', + 'Test2::Tools::Tiny' => '1.302162', + 'Test2::Util' => '1.302162', + 'Test2::Util::ExternalMeta'=> '1.302162', + 'Test2::Util::Facets2Legacy'=> '1.302162', + 'Test2::Util::HashBase' => '1.302162', + 'Test2::Util::Trace' => '1.302162', + 'Test::Builder' => '1.302162', + 'Test::Builder::Formatter'=> '1.302162', + 'Test::Builder::Module' => '1.302162', + 'Test::Builder::Tester' => '1.302162', + 'Test::Builder::Tester::Color'=> '1.302162', + 'Test::Builder::TodoDiag'=> '1.302162', + 'Test::More' => '1.302162', + 'Test::Simple' => '1.302162', + 'Test::Tester' => '1.302162', + 'Test::Tester::Capture' => '1.302162', + 'Test::Tester::CaptureRunner'=> '1.302162', + 'Test::Tester::Delegate'=> '1.302162', + 'Test::use::ok' => '1.302162', + 'XS::APItest' => '1.00', + 'deprecate' => '0.04', + 'ok' => '1.302162', + 'perlfaq' => '5.20190126', + }, + removed => { + } + }, + 5.029009 => { + delta_from => 5.029008, + changed => { + 'B::Op_private' => '5.029009', + 'Config' => '5.029009', + 'Devel::PPPort' => '3.45', + 'Encode' => '3.01', + 'ExtUtils::Manifest' => '1.72', + 'JSON::PP' => '4.02', + 'JSON::PP::Boolean' => '4.02', + 'Module::CoreList' => '5.20190320', + 'Module::CoreList::Utils'=> '5.20190320', + 'PerlIO::encoding' => '0.27', + 'Unicode' => '12.0.0', + 'threads::shared' => '1.60', + 'utf8' => '1.22', + 'warnings' => '1.44', + }, + removed => { + } + }, + 5.028002 => { + delta_from => 5.028001, + changed => { + 'B::Op_private' => '5.028002', + 'Config' => '5.028002', + 'Module::CoreList' => '5.20190419', + 'Module::CoreList::Utils'=> '5.20190419', + 'PerlIO::scalar' => '0.30', + 'Storable' => '3.08_01', + }, + removed => { + } + }, + 5.029010 => { + delta_from => 5.029009, + changed => { + 'B::Op_private' => '5.029010', + 'Config' => '5.02901', + 'Cwd' => '3.78', + 'Data::Dumper' => '2.174', + 'ExtUtils::CBuilder' => '0.280231', + 'ExtUtils::CBuilder::Base'=> '0.280231', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280231', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280231', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280231', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280231', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280231', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280231', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280231', + 'ExtUtils::CBuilder::Platform::android'=> '0.280231', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280231', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280231', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280231', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280231', + 'File::Spec' => '3.78', + 'File::Spec::AmigaOS' => '3.78', + 'File::Spec::Cygwin' => '3.78', + 'File::Spec::Epoc' => '3.78', + 'File::Spec::Functions' => '3.78', + 'File::Spec::Mac' => '3.78', + 'File::Spec::OS2' => '3.78', + 'File::Spec::Unix' => '3.78', + 'File::Spec::VMS' => '3.78', + 'File::Spec::Win32' => '3.78', + 'I18N::Langinfo' => '0.18', + 'Module::CoreList' => '5.20190420', + 'Module::CoreList::Utils'=> '5.20190420', + 'Module::Metadata' => '1.000036', + 'POSIX' => '1.88', + 'Storable' => '3.15', + 'Unicode' => '12.1.0', + }, + removed => { + } + }, + 5.030000 => { + delta_from => 5.02901, + changed => { + 'B::Op_private' => '5.030000', + 'Config' => '5.03', + 'Devel::PPPort' => '3.52', + 'Module::CoreList' => '5.20190522', + 'Module::CoreList::Utils'=> '5.20190522', + 'XS::Typemap' => '0.17', + }, + removed => { + } + }, + 5.031000 => { + delta_from => 5.03, + changed => { + 'B::Op_private' => '5.031000', + 'Config' => '5.031', + 'Module::CoreList' => '5.20190524', + 'Module::CoreList::Utils'=> '5.20190524', + 'Pod::Simple' => '3.36', + 'Pod::Simple::BlackBox' => '3.36', + 'Pod::Simple::Checker' => '3.36', + 'Pod::Simple::Debug' => '3.36', + 'Pod::Simple::DumpAsText'=> '3.36', + 'Pod::Simple::DumpAsXML'=> '3.36', + 'Pod::Simple::HTML' => '3.36', + 'Pod::Simple::HTMLBatch'=> '3.36', + 'Pod::Simple::JustPod' => undef, + 'Pod::Simple::LinkSection'=> '3.36', + 'Pod::Simple::Methody' => '3.36', + 'Pod::Simple::Progress' => '3.36', + 'Pod::Simple::PullParser'=> '3.36', + 'Pod::Simple::PullParserEndToken'=> '3.36', + 'Pod::Simple::PullParserStartToken'=> '3.36', + 'Pod::Simple::PullParserTextToken'=> '3.36', + 'Pod::Simple::PullParserToken'=> '3.36', + 'Pod::Simple::RTF' => '3.36', + 'Pod::Simple::Search' => '3.36', + 'Pod::Simple::SimpleTree'=> '3.36', + 'Pod::Simple::Text' => '3.36', + 'Pod::Simple::TextContent'=> '3.36', + 'Pod::Simple::TiedOutFH'=> '3.36', + 'Pod::Simple::Transcode'=> '3.36', + 'Pod::Simple::TranscodeDumb'=> '3.36', + 'Pod::Simple::TranscodeSmart'=> '3.36', + 'Pod::Simple::XHTML' => '3.36', + 'Pod::Simple::XMLOutStream'=> '3.36', + 'Socket' => '2.029', + 'feature' => '1.55', + }, + removed => { + } + }, + 5.031001 => { + delta_from => 5.031000, + changed => { + 'App::Cpan' => '1.675', + 'B::Op_private' => '5.031001', + 'CPAN' => '2.27', + 'CPAN::Bundle' => '5.5005', + 'CPAN::Distribution' => '2.27', + 'CPAN::FTP' => '5.5012', + 'CPAN::FirstTime' => '5.5314', + 'CPAN::HandleConfig' => '5.5011', + 'CPAN::Mirrors' => '2.27', + 'CPAN::Queue' => '5.5003', + 'CPAN::Shell' => '5.5009', + 'CPAN::Tarzip' => '5.5013', + 'Class::Struct' => '0.66', + 'Compress::Raw::Bzip2' => '2.086', + 'Compress::Raw::Zlib' => '2.086', + 'Compress::Zlib' => '2.086', + 'Config' => '5.031001', + 'DB_File' => '1.852', + 'Devel::PPPort' => '3.53', + 'ExtUtils::CBuilder' => '0.280232', + 'ExtUtils::Command' => '7.36', + 'ExtUtils::Command::MM' => '7.36', + 'ExtUtils::Liblist' => '7.36', + 'ExtUtils::Liblist::Kid'=> '7.36', + 'ExtUtils::MM' => '7.36', + 'ExtUtils::MM_AIX' => '7.36', + 'ExtUtils::MM_Any' => '7.36', + 'ExtUtils::MM_BeOS' => '7.36', + 'ExtUtils::MM_Cygwin' => '7.36', + 'ExtUtils::MM_DOS' => '7.36', + 'ExtUtils::MM_Darwin' => '7.36', + 'ExtUtils::MM_MacOS' => '7.36', + 'ExtUtils::MM_NW5' => '7.36', + 'ExtUtils::MM_OS2' => '7.36', + 'ExtUtils::MM_QNX' => '7.36', + 'ExtUtils::MM_UWIN' => '7.36', + 'ExtUtils::MM_Unix' => '7.36', + 'ExtUtils::MM_VMS' => '7.36', + 'ExtUtils::MM_VOS' => '7.36', + 'ExtUtils::MM_Win32' => '7.36', + 'ExtUtils::MM_Win95' => '7.36', + 'ExtUtils::MY' => '7.36', + 'ExtUtils::MakeMaker' => '7.36', + 'ExtUtils::MakeMaker::Config'=> '7.36', + 'ExtUtils::MakeMaker::Locale'=> '7.36', + 'ExtUtils::MakeMaker::version'=> '7.36', + 'ExtUtils::MakeMaker::version::regex'=> '7.36', + 'ExtUtils::Mkbootstrap' => '7.36', + 'ExtUtils::Mksymlists' => '7.36', + 'ExtUtils::testlib' => '7.36', + 'File::Spec::Win32' => '3.79', + 'I18N::LangTags' => '0.44', + 'IO' => '1.41', + 'IO::Compress::Adapter::Bzip2'=> '2.086', + 'IO::Compress::Adapter::Deflate'=> '2.086', + 'IO::Compress::Adapter::Identity'=> '2.086', + 'IO::Compress::Base' => '2.086', + 'IO::Compress::Base::Common'=> '2.086', + 'IO::Compress::Bzip2' => '2.086', + 'IO::Compress::Deflate' => '2.086', + 'IO::Compress::Gzip' => '2.086', + 'IO::Compress::Gzip::Constants'=> '2.086', + 'IO::Compress::RawDeflate'=> '2.086', + 'IO::Compress::Zip' => '2.086', + 'IO::Compress::Zip::Constants'=> '2.086', + 'IO::Compress::Zlib::Constants'=> '2.086', + 'IO::Compress::Zlib::Extra'=> '2.086', + 'IO::Dir' => '1.41', + 'IO::File' => '1.41', + 'IO::Handle' => '1.41', + 'IO::Pipe' => '1.41', + 'IO::Poll' => '1.41', + 'IO::Seekable' => '1.41', + 'IO::Select' => '1.41', + 'IO::Socket' => '1.41', + 'IO::Socket::INET' => '1.41', + 'IO::Socket::UNIX' => '1.41', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.086', + 'IO::Uncompress::Adapter::Identity'=> '2.086', + 'IO::Uncompress::Adapter::Inflate'=> '2.086', + 'IO::Uncompress::AnyInflate'=> '2.086', + 'IO::Uncompress::AnyUncompress'=> '2.086', + 'IO::Uncompress::Base' => '2.086', + 'IO::Uncompress::Bunzip2'=> '2.086', + 'IO::Uncompress::Gunzip'=> '2.086', + 'IO::Uncompress::Inflate'=> '2.086', + 'IO::Uncompress::RawInflate'=> '2.086', + 'IO::Uncompress::Unzip' => '2.086', + 'Module::CoreList' => '5.20190620', + 'Module::CoreList::Utils'=> '5.20190620', + 'POSIX' => '1.89', + 'Pod::Man' => '4.12', + 'Pod::ParseLink' => '4.12', + 'Pod::Simple' => '3.38', + 'Pod::Simple::BlackBox' => '3.38', + 'Pod::Simple::Checker' => '3.38', + 'Pod::Simple::Debug' => '3.38', + 'Pod::Simple::DumpAsText'=> '3.38', + 'Pod::Simple::DumpAsXML'=> '3.38', + 'Pod::Simple::HTML' => '3.38', + 'Pod::Simple::HTMLBatch'=> '3.38', + 'Pod::Simple::LinkSection'=> '3.38', + 'Pod::Simple::Methody' => '3.38', + 'Pod::Simple::Progress' => '3.38', + 'Pod::Simple::PullParser'=> '3.38', + 'Pod::Simple::PullParserEndToken'=> '3.38', + 'Pod::Simple::PullParserStartToken'=> '3.38', + 'Pod::Simple::PullParserTextToken'=> '3.38', + 'Pod::Simple::PullParserToken'=> '3.38', + 'Pod::Simple::RTF' => '3.38', + 'Pod::Simple::Search' => '3.38', + 'Pod::Simple::SimpleTree'=> '3.38', + 'Pod::Simple::Text' => '3.38', + 'Pod::Simple::TextContent'=> '3.38', + 'Pod::Simple::TiedOutFH'=> '3.38', + 'Pod::Simple::Transcode'=> '3.38', + 'Pod::Simple::TranscodeDumb'=> '3.38', + 'Pod::Simple::TranscodeSmart'=> '3.38', + 'Pod::Simple::XHTML' => '3.38', + 'Pod::Simple::XMLOutStream'=> '3.38', + 'Pod::Text' => '4.12', + 'Pod::Text::Color' => '4.12', + 'Pod::Text::Overstrike' => '4.12', + 'Pod::Text::Termcap' => '4.12', + 'SelfLoader' => '1.26', + 'Storable' => '3.16', + 'Sys::Hostname' => '1.23', + 'Test2' => '1.302164', + 'Test2::API' => '1.302164', + 'Test2::API::Breakage' => '1.302164', + 'Test2::API::Context' => '1.302164', + 'Test2::API::Instance' => '1.302164', + 'Test2::API::Stack' => '1.302164', + 'Test2::Event' => '1.302164', + 'Test2::Event::Bail' => '1.302164', + 'Test2::Event::Diag' => '1.302164', + 'Test2::Event::Encoding'=> '1.302164', + 'Test2::Event::Exception'=> '1.302164', + 'Test2::Event::Fail' => '1.302164', + 'Test2::Event::Generic' => '1.302164', + 'Test2::Event::Note' => '1.302164', + 'Test2::Event::Ok' => '1.302164', + 'Test2::Event::Pass' => '1.302164', + 'Test2::Event::Plan' => '1.302164', + 'Test2::Event::Skip' => '1.302164', + 'Test2::Event::Subtest' => '1.302164', + 'Test2::Event::TAP::Version'=> '1.302164', + 'Test2::Event::V2' => '1.302164', + 'Test2::Event::Waiting' => '1.302164', + 'Test2::EventFacet' => '1.302164', + 'Test2::EventFacet::About'=> '1.302164', + 'Test2::EventFacet::Amnesty'=> '1.302164', + 'Test2::EventFacet::Assert'=> '1.302164', + 'Test2::EventFacet::Control'=> '1.302164', + 'Test2::EventFacet::Error'=> '1.302164', + 'Test2::EventFacet::Hub'=> '1.302164', + 'Test2::EventFacet::Info'=> '1.302164', + 'Test2::EventFacet::Info::Table'=> '1.302164', + 'Test2::EventFacet::Meta'=> '1.302164', + 'Test2::EventFacet::Parent'=> '1.302164', + 'Test2::EventFacet::Plan'=> '1.302164', + 'Test2::EventFacet::Render'=> '1.302164', + 'Test2::EventFacet::Trace'=> '1.302164', + 'Test2::Formatter' => '1.302164', + 'Test2::Formatter::TAP' => '1.302164', + 'Test2::Hub' => '1.302164', + 'Test2::Hub::Interceptor'=> '1.302164', + 'Test2::Hub::Interceptor::Terminator'=> '1.302164', + 'Test2::Hub::Subtest' => '1.302164', + 'Test2::IPC' => '1.302164', + 'Test2::IPC::Driver' => '1.302164', + 'Test2::IPC::Driver::Files'=> '1.302164', + 'Test2::Tools::Tiny' => '1.302164', + 'Test2::Util' => '1.302164', + 'Test2::Util::ExternalMeta'=> '1.302164', + 'Test2::Util::Facets2Legacy'=> '1.302164', + 'Test2::Util::HashBase' => '1.302164', + 'Test2::Util::Trace' => '1.302164', + 'Test::Builder' => '1.302164', + 'Test::Builder::Formatter'=> '1.302164', + 'Test::Builder::Module' => '1.302164', + 'Test::Builder::Tester' => '1.302164', + 'Test::Builder::Tester::Color'=> '1.302164', + 'Test::Builder::TodoDiag'=> '1.302164', + 'Test::More' => '1.302164', + 'Test::Simple' => '1.302164', + 'Test::Tester' => '1.302164', + 'Test::Tester::Capture' => '1.302164', + 'Test::Tester::CaptureRunner'=> '1.302164', + 'Test::Tester::Delegate'=> '1.302164', + 'Test::use::ok' => '1.302164', + 'Tie::File' => '1.03', + 'Tie::Hash::NamedCapture'=> '0.11', + 'Time::HiRes' => '1.9761', + 'Unicode::Normalize' => '1.27', + 'Unicode::UCD' => '0.73', + 'XS::APItest' => '1.01', + 'ok' => '1.302164', + 'overload' => '1.31', + 'warnings' => '1.45', + }, + removed => { + 'Pod::Find' => 1, + 'Pod::InputObjects' => 1, + 'Pod::ParseUtils' => 1, + 'Pod::Parser' => 1, + 'Pod::PlainText' => 1, + 'Pod::Select' => 1, + } + }, + 5.031002 => { + delta_from => 5.031001, + changed => { + 'B::Op_private' => '5.031002', + 'Config' => '5.031002', + 'Devel::PPPort' => '3.54', + 'Exporter' => '5.74', + 'Exporter::Heavy' => '5.74', + 'IPC::Cmd' => '1.04', + 'JSON::PP' => '4.04', + 'JSON::PP::Boolean' => '4.04', + 'Module::CoreList' => '5.20190720', + 'Module::CoreList::Utils'=> '5.20190720', + 'Opcode' => '1.44', + 'PerlIO::encoding' => '0.28', + 'Pod::Simple' => '3.39', + 'Pod::Simple::BlackBox' => '3.39', + 'Pod::Simple::Checker' => '3.39', + 'Pod::Simple::Debug' => '3.39', + 'Pod::Simple::DumpAsText'=> '3.39', + 'Pod::Simple::DumpAsXML'=> '3.39', + 'Pod::Simple::HTML' => '3.39', + 'Pod::Simple::HTMLBatch'=> '3.39', + 'Pod::Simple::LinkSection'=> '3.39', + 'Pod::Simple::Methody' => '3.39', + 'Pod::Simple::Progress' => '3.39', + 'Pod::Simple::PullParser'=> '3.39', + 'Pod::Simple::PullParserEndToken'=> '3.39', + 'Pod::Simple::PullParserStartToken'=> '3.39', + 'Pod::Simple::PullParserTextToken'=> '3.39', + 'Pod::Simple::PullParserToken'=> '3.39', + 'Pod::Simple::RTF' => '3.39', + 'Pod::Simple::Search' => '3.39', + 'Pod::Simple::SimpleTree'=> '3.39', + 'Pod::Simple::Text' => '3.39', + 'Pod::Simple::TextContent'=> '3.39', + 'Pod::Simple::TiedOutFH'=> '3.39', + 'Pod::Simple::Transcode'=> '3.39', + 'Pod::Simple::TranscodeDumb'=> '3.39', + 'Pod::Simple::TranscodeSmart'=> '3.39', + 'Pod::Simple::XHTML' => '3.39', + 'Pod::Simple::XMLOutStream'=> '3.39', + 'threads::shared' => '1.61', + }, + removed => { + } + }, + 5.031003 => { + delta_from => 5.031002, + changed => { + 'B::Op_private' => '5.031003', + 'Compress::Raw::Bzip2' => '2.087', + 'Compress::Raw::Zlib' => '2.087', + 'Compress::Zlib' => '2.087', + 'Config' => '5.031003', + 'Devel::PPPort' => '3.55', + 'File::Find' => '1.37', + 'Getopt::Long' => '2.51', + 'I18N::LangTags::Detect'=> '1.08', + 'IO::Compress::Adapter::Bzip2'=> '2.087', + 'IO::Compress::Adapter::Deflate'=> '2.087', + 'IO::Compress::Adapter::Identity'=> '2.087', + 'IO::Compress::Base' => '2.087', + 'IO::Compress::Base::Common'=> '2.087', + 'IO::Compress::Bzip2' => '2.087', + 'IO::Compress::Deflate' => '2.087', + 'IO::Compress::Gzip' => '2.087', + 'IO::Compress::Gzip::Constants'=> '2.087', + 'IO::Compress::RawDeflate'=> '2.087', + 'IO::Compress::Zip' => '2.087', + 'IO::Compress::Zip::Constants'=> '2.087', + 'IO::Compress::Zlib::Constants'=> '2.087', + 'IO::Compress::Zlib::Extra'=> '2.087', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.087', + 'IO::Uncompress::Adapter::Identity'=> '2.087', + 'IO::Uncompress::Adapter::Inflate'=> '2.087', + 'IO::Uncompress::AnyInflate'=> '2.087', + 'IO::Uncompress::AnyUncompress'=> '2.087', + 'IO::Uncompress::Base' => '2.087', + 'IO::Uncompress::Bunzip2'=> '2.087', + 'IO::Uncompress::Gunzip'=> '2.087', + 'IO::Uncompress::Inflate'=> '2.087', + 'IO::Uncompress::RawInflate'=> '2.087', + 'IO::Uncompress::Unzip' => '2.087', + 'Module::CoreList' => '5.20190820', + 'Module::CoreList::Utils'=> '5.20190820', + 'PerlIO::via' => '0.18', + 'Storable' => '3.17', + 'Test2' => '1.302166', + 'Test2::API' => '1.302166', + 'Test2::API::Breakage' => '1.302166', + 'Test2::API::Context' => '1.302166', + 'Test2::API::Instance' => '1.302166', + 'Test2::API::Stack' => '1.302166', + 'Test2::Event' => '1.302166', + 'Test2::Event::Bail' => '1.302166', + 'Test2::Event::Diag' => '1.302166', + 'Test2::Event::Encoding'=> '1.302166', + 'Test2::Event::Exception'=> '1.302166', + 'Test2::Event::Fail' => '1.302166', + 'Test2::Event::Generic' => '1.302166', + 'Test2::Event::Note' => '1.302166', + 'Test2::Event::Ok' => '1.302166', + 'Test2::Event::Pass' => '1.302166', + 'Test2::Event::Plan' => '1.302166', + 'Test2::Event::Skip' => '1.302166', + 'Test2::Event::Subtest' => '1.302166', + 'Test2::Event::TAP::Version'=> '1.302166', + 'Test2::Event::V2' => '1.302166', + 'Test2::Event::Waiting' => '1.302166', + 'Test2::EventFacet' => '1.302166', + 'Test2::EventFacet::About'=> '1.302166', + 'Test2::EventFacet::Amnesty'=> '1.302166', + 'Test2::EventFacet::Assert'=> '1.302166', + 'Test2::EventFacet::Control'=> '1.302166', + 'Test2::EventFacet::Error'=> '1.302166', + 'Test2::EventFacet::Hub'=> '1.302166', + 'Test2::EventFacet::Info'=> '1.302166', + 'Test2::EventFacet::Info::Table'=> '1.302166', + 'Test2::EventFacet::Meta'=> '1.302166', + 'Test2::EventFacet::Parent'=> '1.302166', + 'Test2::EventFacet::Plan'=> '1.302166', + 'Test2::EventFacet::Render'=> '1.302166', + 'Test2::EventFacet::Trace'=> '1.302166', + 'Test2::Formatter' => '1.302166', + 'Test2::Formatter::TAP' => '1.302166', + 'Test2::Hub' => '1.302166', + 'Test2::Hub::Interceptor'=> '1.302166', + 'Test2::Hub::Interceptor::Terminator'=> '1.302166', + 'Test2::Hub::Subtest' => '1.302166', + 'Test2::IPC' => '1.302166', + 'Test2::IPC::Driver' => '1.302166', + 'Test2::IPC::Driver::Files'=> '1.302166', + 'Test2::Tools::Tiny' => '1.302166', + 'Test2::Util' => '1.302166', + 'Test2::Util::ExternalMeta'=> '1.302166', + 'Test2::Util::Facets2Legacy'=> '1.302166', + 'Test2::Util::HashBase' => '1.302166', + 'Test2::Util::Trace' => '1.302166', + 'Test::Builder' => '1.302166', + 'Test::Builder::Formatter'=> '1.302166', + 'Test::Builder::Module' => '1.302166', + 'Test::Builder::Tester' => '1.302166', + 'Test::Builder::Tester::Color'=> '1.302166', + 'Test::Builder::TodoDiag'=> '1.302166', + 'Test::More' => '1.302166', + 'Test::Simple' => '1.302166', + 'Test::Tester' => '1.302166', + 'Test::Tester::Capture' => '1.302166', + 'Test::Tester::CaptureRunner'=> '1.302166', + 'Test::Tester::Delegate'=> '1.302166', + 'Test::use::ok' => '1.302166', + 'Thread' => '3.05', + 'Time::HiRes' => '1.9762', + 'Win32' => '0.53', + 'XS::APItest' => '1.02', + 'ok' => '1.302166', + }, + removed => { + } + }, + 5.031004 => { + delta_from => 5.031003, + changed => { + 'B::Op_private' => '5.031004', + 'Config' => '5.031004', + 'ExtUtils::Command' => '7.38', + 'ExtUtils::Command::MM' => '7.38', + 'ExtUtils::Liblist' => '7.38', + 'ExtUtils::Liblist::Kid'=> '7.38', + 'ExtUtils::MM' => '7.38', + 'ExtUtils::MM_AIX' => '7.38', + 'ExtUtils::MM_Any' => '7.38', + 'ExtUtils::MM_BeOS' => '7.38', + 'ExtUtils::MM_Cygwin' => '7.38', + 'ExtUtils::MM_DOS' => '7.38', + 'ExtUtils::MM_Darwin' => '7.38', + 'ExtUtils::MM_MacOS' => '7.38', + 'ExtUtils::MM_NW5' => '7.38', + 'ExtUtils::MM_OS2' => '7.38', + 'ExtUtils::MM_QNX' => '7.38', + 'ExtUtils::MM_UWIN' => '7.38', + 'ExtUtils::MM_Unix' => '7.38', + 'ExtUtils::MM_VMS' => '7.38', + 'ExtUtils::MM_VOS' => '7.38', + 'ExtUtils::MM_Win32' => '7.38', + 'ExtUtils::MM_Win95' => '7.38', + 'ExtUtils::MY' => '7.38', + 'ExtUtils::MakeMaker' => '7.38', + 'ExtUtils::MakeMaker::Config'=> '7.38', + 'ExtUtils::MakeMaker::Locale'=> '7.38', + 'ExtUtils::MakeMaker::version'=> '7.38', + 'ExtUtils::MakeMaker::version::regex'=> '7.38', + 'ExtUtils::Mkbootstrap' => '7.38', + 'ExtUtils::Mksymlists' => '7.38', + 'ExtUtils::testlib' => '7.38', + 'I18N::Langinfo' => '0.19', + 'List::Util' => '1.52', + 'List::Util::XS' => '1.52', + 'Module::CoreList' => '5.20190920', + 'Module::CoreList::Utils'=> '5.20190920', + 'Module::Metadata' => '1.000037', + 'Scalar::Util' => '1.52', + 'Sub::Util' => '1.52', + 'Test2' => '1.302168', + 'Test2::API' => '1.302168', + 'Test2::API::Breakage' => '1.302168', + 'Test2::API::Context' => '1.302168', + 'Test2::API::Instance' => '1.302168', + 'Test2::API::Stack' => '1.302168', + 'Test2::Event' => '1.302168', + 'Test2::Event::Bail' => '1.302168', + 'Test2::Event::Diag' => '1.302168', + 'Test2::Event::Encoding'=> '1.302168', + 'Test2::Event::Exception'=> '1.302168', + 'Test2::Event::Fail' => '1.302168', + 'Test2::Event::Generic' => '1.302168', + 'Test2::Event::Note' => '1.302168', + 'Test2::Event::Ok' => '1.302168', + 'Test2::Event::Pass' => '1.302168', + 'Test2::Event::Plan' => '1.302168', + 'Test2::Event::Skip' => '1.302168', + 'Test2::Event::Subtest' => '1.302168', + 'Test2::Event::TAP::Version'=> '1.302168', + 'Test2::Event::V2' => '1.302168', + 'Test2::Event::Waiting' => '1.302168', + 'Test2::EventFacet' => '1.302168', + 'Test2::EventFacet::About'=> '1.302168', + 'Test2::EventFacet::Amnesty'=> '1.302168', + 'Test2::EventFacet::Assert'=> '1.302168', + 'Test2::EventFacet::Control'=> '1.302168', + 'Test2::EventFacet::Error'=> '1.302168', + 'Test2::EventFacet::Hub'=> '1.302168', + 'Test2::EventFacet::Info'=> '1.302168', + 'Test2::EventFacet::Info::Table'=> '1.302168', + 'Test2::EventFacet::Meta'=> '1.302168', + 'Test2::EventFacet::Parent'=> '1.302168', + 'Test2::EventFacet::Plan'=> '1.302168', + 'Test2::EventFacet::Render'=> '1.302168', + 'Test2::EventFacet::Trace'=> '1.302168', + 'Test2::Formatter' => '1.302168', + 'Test2::Formatter::TAP' => '1.302168', + 'Test2::Hub' => '1.302168', + 'Test2::Hub::Interceptor'=> '1.302168', + 'Test2::Hub::Interceptor::Terminator'=> '1.302168', + 'Test2::Hub::Subtest' => '1.302168', + 'Test2::IPC' => '1.302168', + 'Test2::IPC::Driver' => '1.302168', + 'Test2::IPC::Driver::Files'=> '1.302168', + 'Test2::Tools::Tiny' => '1.302168', + 'Test2::Util' => '1.302168', + 'Test2::Util::ExternalMeta'=> '1.302168', + 'Test2::Util::Facets2Legacy'=> '1.302168', + 'Test2::Util::HashBase' => '1.302168', + 'Test2::Util::Trace' => '1.302168', + 'Test::Builder' => '1.302168', + 'Test::Builder::Formatter'=> '1.302168', + 'Test::Builder::Module' => '1.302168', + 'Test::Builder::Tester' => '1.302168', + 'Test::Builder::Tester::Color'=> '1.302168', + 'Test::Builder::TodoDiag'=> '1.302168', + 'Test::More' => '1.302168', + 'Test::Simple' => '1.302168', + 'Test::Tester' => '1.302168', + 'Test::Tester::Capture' => '1.302168', + 'Test::Tester::CaptureRunner'=> '1.302168', + 'Test::Tester::Delegate'=> '1.302168', + 'Test::use::ok' => '1.302168', + 'Time::HiRes' => '1.9763', + 'XS::APItest' => '1.03', + 'ok' => '1.302168', + 're' => '0.38', + }, + removed => { + } + }, + 5.031005 => { + delta_from => 5.031004, + changed => { + 'B' => '1.77', + 'B::Deparse' => '1.50', + 'B::Op_private' => '5.031005', + 'Config' => '5.031005', + 'Devel::PPPort' => '3.54', + 'Digest::MD5' => '2.55_01', + 'Dumpvalue' => '1.21', + 'ExtUtils::CBuilder' => '0.280233', + 'Math::BigFloat' => '1.999817_01', + 'Math::BigInt' => '1.999817_01', + 'Math::BigInt::Calc' => '1.999817_01', + 'Math::BigInt::FastCalc'=> '0.5009', + 'Math::BigInt::Lib' => '1.999817_01', + 'Module::CoreList' => '5.20191020', + 'Module::CoreList::Utils'=> '5.20191020', + 'Safe' => '2.41', + 'Time::HiRes' => '1.9764', + 'XS::APItest' => '1.04', + 'threads' => '2.23', + }, + removed => { + } + }, + 5.030001 => { + delta_from => 5.030000, + changed => { + 'B::Op_private' => '5.030001', + 'Config' => '5.030001', + 'Module::CoreList' => '5.20191110', + 'Module::CoreList::Utils'=> '5.20191110', + }, + removed => { + } + }, + 5.031006 => { + delta_from => 5.031005, + changed => { + 'B::Deparse' => '1.51', + 'B::Op_private' => '5.031006', + 'Compress::Raw::Bzip2' => '2.090', + 'Compress::Raw::Zlib' => '2.090', + 'Compress::Zlib' => '2.090', + 'Config' => '5.031006', + 'Devel::PPPort' => '3.55', + 'DynaLoader' => '1.46', + 'IO::Compress::Adapter::Bzip2'=> '2.090', + 'IO::Compress::Adapter::Deflate'=> '2.090', + 'IO::Compress::Adapter::Identity'=> '2.090', + 'IO::Compress::Base' => '2.090', + 'IO::Compress::Base::Common'=> '2.090', + 'IO::Compress::Bzip2' => '2.090', + 'IO::Compress::Deflate' => '2.090', + 'IO::Compress::Gzip' => '2.090', + 'IO::Compress::Gzip::Constants'=> '2.090', + 'IO::Compress::RawDeflate'=> '2.090', + 'IO::Compress::Zip' => '2.090', + 'IO::Compress::Zip::Constants'=> '2.090', + 'IO::Compress::Zlib::Constants'=> '2.090', + 'IO::Compress::Zlib::Extra'=> '2.090', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.090', + 'IO::Uncompress::Adapter::Identity'=> '2.090', + 'IO::Uncompress::Adapter::Inflate'=> '2.090', + 'IO::Uncompress::AnyInflate'=> '2.090', + 'IO::Uncompress::AnyUncompress'=> '2.090', + 'IO::Uncompress::Base' => '2.090', + 'IO::Uncompress::Bunzip2'=> '2.090', + 'IO::Uncompress::Gunzip'=> '2.090', + 'IO::Uncompress::Inflate'=> '2.090', + 'IO::Uncompress::RawInflate'=> '2.090', + 'IO::Uncompress::Unzip' => '2.090', + 'List::Util' => '1.53', + 'List::Util::XS' => '1.53', + 'Math::BigFloat' => '1.999818', + 'Math::BigInt' => '1.999818', + 'Math::BigInt::Calc' => '1.999818', + 'Math::BigInt::Lib' => '1.999818', + 'Module::CoreList' => '5.20191120', + 'Module::CoreList::Utils'=> '5.20191120', + 'Module::Load::Conditional'=> '0.70', + 'POSIX' => '1.90', + 'Pod::Simple' => '3.40', + 'Pod::Simple::BlackBox' => '3.40', + 'Pod::Simple::Checker' => '3.40', + 'Pod::Simple::Debug' => '3.40', + 'Pod::Simple::DumpAsText'=> '3.40', + 'Pod::Simple::DumpAsXML'=> '3.40', + 'Pod::Simple::HTML' => '3.40', + 'Pod::Simple::HTMLBatch'=> '3.40', + 'Pod::Simple::LinkSection'=> '3.40', + 'Pod::Simple::Methody' => '3.40', + 'Pod::Simple::Progress' => '3.40', + 'Pod::Simple::PullParser'=> '3.40', + 'Pod::Simple::PullParserEndToken'=> '3.40', + 'Pod::Simple::PullParserStartToken'=> '3.40', + 'Pod::Simple::PullParserTextToken'=> '3.40', + 'Pod::Simple::PullParserToken'=> '3.40', + 'Pod::Simple::RTF' => '3.40', + 'Pod::Simple::Search' => '3.40', + 'Pod::Simple::SimpleTree'=> '3.40', + 'Pod::Simple::Text' => '3.40', + 'Pod::Simple::TextContent'=> '3.40', + 'Pod::Simple::TiedOutFH'=> '3.40', + 'Pod::Simple::Transcode'=> '3.40', + 'Pod::Simple::TranscodeDumb'=> '3.40', + 'Pod::Simple::TranscodeSmart'=> '3.40', + 'Pod::Simple::XHTML' => '3.40', + 'Pod::Simple::XMLOutStream'=> '3.40', + 'Scalar::Util' => '1.53', + 'Sub::Util' => '1.53', + 'Sys::Syslog' => '0.36', + 'Test2' => '1.302169', + 'Test2::API' => '1.302169', + 'Test2::API::Breakage' => '1.302169', + 'Test2::API::Context' => '1.302169', + 'Test2::API::Instance' => '1.302169', + 'Test2::API::Stack' => '1.302169', + 'Test2::Event' => '1.302169', + 'Test2::Event::Bail' => '1.302169', + 'Test2::Event::Diag' => '1.302169', + 'Test2::Event::Encoding'=> '1.302169', + 'Test2::Event::Exception'=> '1.302169', + 'Test2::Event::Fail' => '1.302169', + 'Test2::Event::Generic' => '1.302169', + 'Test2::Event::Note' => '1.302169', + 'Test2::Event::Ok' => '1.302169', + 'Test2::Event::Pass' => '1.302169', + 'Test2::Event::Plan' => '1.302169', + 'Test2::Event::Skip' => '1.302169', + 'Test2::Event::Subtest' => '1.302169', + 'Test2::Event::TAP::Version'=> '1.302169', + 'Test2::Event::V2' => '1.302169', + 'Test2::Event::Waiting' => '1.302169', + 'Test2::EventFacet' => '1.302169', + 'Test2::EventFacet::About'=> '1.302169', + 'Test2::EventFacet::Amnesty'=> '1.302169', + 'Test2::EventFacet::Assert'=> '1.302169', + 'Test2::EventFacet::Control'=> '1.302169', + 'Test2::EventFacet::Error'=> '1.302169', + 'Test2::EventFacet::Hub'=> '1.302169', + 'Test2::EventFacet::Info'=> '1.302169', + 'Test2::EventFacet::Info::Table'=> '1.302169', + 'Test2::EventFacet::Meta'=> '1.302169', + 'Test2::EventFacet::Parent'=> '1.302169', + 'Test2::EventFacet::Plan'=> '1.302169', + 'Test2::EventFacet::Render'=> '1.302169', + 'Test2::EventFacet::Trace'=> '1.302169', + 'Test2::Formatter' => '1.302169', + 'Test2::Formatter::TAP' => '1.302169', + 'Test2::Hub' => '1.302169', + 'Test2::Hub::Interceptor'=> '1.302169', + 'Test2::Hub::Interceptor::Terminator'=> '1.302169', + 'Test2::Hub::Subtest' => '1.302169', + 'Test2::IPC' => '1.302169', + 'Test2::IPC::Driver' => '1.302169', + 'Test2::IPC::Driver::Files'=> '1.302169', + 'Test2::Tools::Tiny' => '1.302169', + 'Test2::Util' => '1.302169', + 'Test2::Util::ExternalMeta'=> '1.302169', + 'Test2::Util::Facets2Legacy'=> '1.302169', + 'Test2::Util::HashBase' => '1.302169', + 'Test2::Util::Trace' => '1.302169', + 'Test::Builder' => '1.302169', + 'Test::Builder::Formatter'=> '1.302169', + 'Test::Builder::Module' => '1.302169', + 'Test::Builder::Tester' => '1.302169', + 'Test::Builder::Tester::Color'=> '1.302169', + 'Test::Builder::TodoDiag'=> '1.302169', + 'Test::More' => '1.302169', + 'Test::Simple' => '1.302169', + 'Test::Tester' => '1.302169', + 'Test::Tester::Capture' => '1.302169', + 'Test::Tester::CaptureRunner'=> '1.302169', + 'Test::Tester::Delegate'=> '1.302169', + 'Test::use::ok' => '1.302169', + 'Tie::StdHandle' => '4.6', + 'Unicode::UCD' => '0.74', + 'Win32API::File' => '0.1203_01', + 'feature' => '1.56', + 'mro' => '1.23', + 'ok' => '1.302169', + 'perlfaq' => '5.20191102', + }, + removed => { + } + }, + 5.031007 => { + delta_from => 5.031006, + changed => { + 'B' => '1.78', + 'B::Deparse' => '1.52', + 'B::Op_private' => '5.031007', + 'Compress::Raw::Bzip2' => '2.093', + 'Compress::Raw::Zlib' => '2.093', + 'Compress::Zlib' => '2.093', + 'Config' => '5.031007', + 'Devel::PPPort' => '3.56', + 'English' => '1.11', + 'ExtUtils::Command' => '7.42', + 'ExtUtils::Command::MM' => '7.42', + 'ExtUtils::Liblist' => '7.42', + 'ExtUtils::Liblist::Kid'=> '7.42', + 'ExtUtils::MM' => '7.42', + 'ExtUtils::MM_AIX' => '7.42', + 'ExtUtils::MM_Any' => '7.42', + 'ExtUtils::MM_BeOS' => '7.42', + 'ExtUtils::MM_Cygwin' => '7.42', + 'ExtUtils::MM_DOS' => '7.42', + 'ExtUtils::MM_Darwin' => '7.42', + 'ExtUtils::MM_MacOS' => '7.42', + 'ExtUtils::MM_NW5' => '7.42', + 'ExtUtils::MM_OS2' => '7.42', + 'ExtUtils::MM_QNX' => '7.42', + 'ExtUtils::MM_UWIN' => '7.42', + 'ExtUtils::MM_Unix' => '7.42', + 'ExtUtils::MM_VMS' => '7.42', + 'ExtUtils::MM_VOS' => '7.42', + 'ExtUtils::MM_Win32' => '7.42', + 'ExtUtils::MM_Win95' => '7.42', + 'ExtUtils::MY' => '7.42', + 'ExtUtils::MakeMaker' => '7.42', + 'ExtUtils::MakeMaker::Config'=> '7.42', + 'ExtUtils::MakeMaker::Locale'=> '7.42', + 'ExtUtils::MakeMaker::version'=> '7.42', + 'ExtUtils::MakeMaker::version::regex'=> '7.42', + 'ExtUtils::Mkbootstrap' => '7.42', + 'ExtUtils::Mksymlists' => '7.42', + 'ExtUtils::testlib' => '7.42', + 'File::stat' => '1.09', + 'Filter::Simple' => '0.96', + 'IO::Compress::Adapter::Bzip2'=> '2.093', + 'IO::Compress::Adapter::Deflate'=> '2.093', + 'IO::Compress::Adapter::Identity'=> '2.093', + 'IO::Compress::Base' => '2.093', + 'IO::Compress::Base::Common'=> '2.093', + 'IO::Compress::Bzip2' => '2.093', + 'IO::Compress::Deflate' => '2.093', + 'IO::Compress::Gzip' => '2.093', + 'IO::Compress::Gzip::Constants'=> '2.093', + 'IO::Compress::RawDeflate'=> '2.093', + 'IO::Compress::Zip' => '2.093', + 'IO::Compress::Zip::Constants'=> '2.093', + 'IO::Compress::Zlib::Constants'=> '2.093', + 'IO::Compress::Zlib::Extra'=> '2.093', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.093', + 'IO::Uncompress::Adapter::Identity'=> '2.093', + 'IO::Uncompress::Adapter::Inflate'=> '2.093', + 'IO::Uncompress::AnyInflate'=> '2.093', + 'IO::Uncompress::AnyUncompress'=> '2.093', + 'IO::Uncompress::Base' => '2.093', + 'IO::Uncompress::Bunzip2'=> '2.093', + 'IO::Uncompress::Gunzip'=> '2.093', + 'IO::Uncompress::Inflate'=> '2.093', + 'IO::Uncompress::RawInflate'=> '2.093', + 'IO::Uncompress::Unzip' => '2.093', + 'Module::CoreList' => '5.20191220', + 'Module::CoreList::Utils'=> '5.20191220', + 'Net::Ping' => '2.72', + 'Opcode' => '1.45', + 'Storable' => '3.18', + 'Test2' => '1.302170', + 'Test2::API' => '1.302170', + 'Test2::API::Breakage' => '1.302170', + 'Test2::API::Context' => '1.302170', + 'Test2::API::Instance' => '1.302170', + 'Test2::API::Stack' => '1.302170', + 'Test2::Event' => '1.302170', + 'Test2::Event::Bail' => '1.302170', + 'Test2::Event::Diag' => '1.302170', + 'Test2::Event::Encoding'=> '1.302170', + 'Test2::Event::Exception'=> '1.302170', + 'Test2::Event::Fail' => '1.302170', + 'Test2::Event::Generic' => '1.302170', + 'Test2::Event::Note' => '1.302170', + 'Test2::Event::Ok' => '1.302170', + 'Test2::Event::Pass' => '1.302170', + 'Test2::Event::Plan' => '1.302170', + 'Test2::Event::Skip' => '1.302170', + 'Test2::Event::Subtest' => '1.302170', + 'Test2::Event::TAP::Version'=> '1.302170', + 'Test2::Event::V2' => '1.302170', + 'Test2::Event::Waiting' => '1.302170', + 'Test2::EventFacet' => '1.302170', + 'Test2::EventFacet::About'=> '1.302170', + 'Test2::EventFacet::Amnesty'=> '1.302170', + 'Test2::EventFacet::Assert'=> '1.302170', + 'Test2::EventFacet::Control'=> '1.302170', + 'Test2::EventFacet::Error'=> '1.302170', + 'Test2::EventFacet::Hub'=> '1.302170', + 'Test2::EventFacet::Info'=> '1.302170', + 'Test2::EventFacet::Info::Table'=> '1.302170', + 'Test2::EventFacet::Meta'=> '1.302170', + 'Test2::EventFacet::Parent'=> '1.302170', + 'Test2::EventFacet::Plan'=> '1.302170', + 'Test2::EventFacet::Render'=> '1.302170', + 'Test2::EventFacet::Trace'=> '1.302170', + 'Test2::Formatter' => '1.302170', + 'Test2::Formatter::TAP' => '1.302170', + 'Test2::Hub' => '1.302170', + 'Test2::Hub::Interceptor'=> '1.302170', + 'Test2::Hub::Interceptor::Terminator'=> '1.302170', + 'Test2::Hub::Subtest' => '1.302170', + 'Test2::IPC' => '1.302170', + 'Test2::IPC::Driver' => '1.302170', + 'Test2::IPC::Driver::Files'=> '1.302170', + 'Test2::Tools::Tiny' => '1.302170', + 'Test2::Util' => '1.302170', + 'Test2::Util::ExternalMeta'=> '1.302170', + 'Test2::Util::Facets2Legacy'=> '1.302170', + 'Test2::Util::HashBase' => '1.302170', + 'Test2::Util::Trace' => '1.302170', + 'Test::Builder' => '1.302170', + 'Test::Builder::Formatter'=> '1.302170', + 'Test::Builder::Module' => '1.302170', + 'Test::Builder::Tester' => '1.302170', + 'Test::Builder::Tester::Color'=> '1.302170', + 'Test::Builder::TodoDiag'=> '1.302170', + 'Test::More' => '1.302170', + 'Test::Simple' => '1.302170', + 'Test::Tester' => '1.302170', + 'Test::Tester::Capture' => '1.302170', + 'Test::Tester::CaptureRunner'=> '1.302170', + 'Test::Tester::Delegate'=> '1.302170', + 'Test::use::ok' => '1.302170', + 'Tie::Hash::NamedCapture'=> '0.13', + 'VMS::Stdio' => '2.45', + 'XS::APItest' => '1.05', + 'feature' => '1.57', + 'ok' => '1.302170', + 'warnings' => '1.46', + }, + removed => { + } + }, + 5.031008 => { + delta_from => 5.031007, + changed => { + 'B::Op_private' => '5.031008', + 'Config' => '5.031008', + 'DB_File' => '1.853', + 'Encode' => '3.02', + 'ExtUtils::Command' => '7.44', + 'ExtUtils::Command::MM' => '7.44', + 'ExtUtils::Liblist' => '7.44', + 'ExtUtils::Liblist::Kid'=> '7.44', + 'ExtUtils::MM' => '7.44', + 'ExtUtils::MM_AIX' => '7.44', + 'ExtUtils::MM_Any' => '7.44', + 'ExtUtils::MM_BeOS' => '7.44', + 'ExtUtils::MM_Cygwin' => '7.44', + 'ExtUtils::MM_DOS' => '7.44', + 'ExtUtils::MM_Darwin' => '7.44', + 'ExtUtils::MM_MacOS' => '7.44', + 'ExtUtils::MM_NW5' => '7.44', + 'ExtUtils::MM_OS2' => '7.44', + 'ExtUtils::MM_QNX' => '7.44', + 'ExtUtils::MM_UWIN' => '7.44', + 'ExtUtils::MM_Unix' => '7.44', + 'ExtUtils::MM_VMS' => '7.44', + 'ExtUtils::MM_VOS' => '7.44', + 'ExtUtils::MM_Win32' => '7.44', + 'ExtUtils::MM_Win95' => '7.44', + 'ExtUtils::MY' => '7.44', + 'ExtUtils::MakeMaker' => '7.44', + 'ExtUtils::MakeMaker::Config'=> '7.44', + 'ExtUtils::MakeMaker::Locale'=> '7.44', + 'ExtUtils::MakeMaker::version'=> '7.44', + 'ExtUtils::MakeMaker::version::regex'=> '7.44', + 'ExtUtils::Mkbootstrap' => '7.44', + 'ExtUtils::Mksymlists' => '7.44', + 'ExtUtils::testlib' => '7.44', + 'Fatal' => '2.32', + 'Hash::Util' => '0.23', + 'IO' => '1.42', + 'IO::Handle' => '1.42', + 'IO::Socket' => '1.42', + 'Module::CoreList' => '5.20200120', + 'Module::CoreList::Utils'=> '5.20200120', + 'POSIX' => '1.91', + 'Pod::Man' => '4.14', + 'Pod::ParseLink' => '4.14', + 'Pod::Text' => '4.14', + 'Pod::Text::Color' => '4.14', + 'Pod::Text::Overstrike' => '4.14', + 'Pod::Text::Termcap' => '4.14', + 'Term::ANSIColor' => '5.01', + 'Test2' => '1.302171', + 'Test2::API' => '1.302171', + 'Test2::API::Breakage' => '1.302171', + 'Test2::API::Context' => '1.302171', + 'Test2::API::Instance' => '1.302171', + 'Test2::API::Stack' => '1.302171', + 'Test2::Event' => '1.302171', + 'Test2::Event::Bail' => '1.302171', + 'Test2::Event::Diag' => '1.302171', + 'Test2::Event::Encoding'=> '1.302171', + 'Test2::Event::Exception'=> '1.302171', + 'Test2::Event::Fail' => '1.302171', + 'Test2::Event::Generic' => '1.302171', + 'Test2::Event::Note' => '1.302171', + 'Test2::Event::Ok' => '1.302171', + 'Test2::Event::Pass' => '1.302171', + 'Test2::Event::Plan' => '1.302171', + 'Test2::Event::Skip' => '1.302171', + 'Test2::Event::Subtest' => '1.302171', + 'Test2::Event::TAP::Version'=> '1.302171', + 'Test2::Event::V2' => '1.302171', + 'Test2::Event::Waiting' => '1.302171', + 'Test2::EventFacet' => '1.302171', + 'Test2::EventFacet::About'=> '1.302171', + 'Test2::EventFacet::Amnesty'=> '1.302171', + 'Test2::EventFacet::Assert'=> '1.302171', + 'Test2::EventFacet::Control'=> '1.302171', + 'Test2::EventFacet::Error'=> '1.302171', + 'Test2::EventFacet::Hub'=> '1.302171', + 'Test2::EventFacet::Info'=> '1.302171', + 'Test2::EventFacet::Info::Table'=> '1.302171', + 'Test2::EventFacet::Meta'=> '1.302171', + 'Test2::EventFacet::Parent'=> '1.302171', + 'Test2::EventFacet::Plan'=> '1.302171', + 'Test2::EventFacet::Render'=> '1.302171', + 'Test2::EventFacet::Trace'=> '1.302171', + 'Test2::Formatter' => '1.302171', + 'Test2::Formatter::TAP' => '1.302171', + 'Test2::Hub' => '1.302171', + 'Test2::Hub::Interceptor'=> '1.302171', + 'Test2::Hub::Interceptor::Terminator'=> '1.302171', + 'Test2::Hub::Subtest' => '1.302171', + 'Test2::IPC' => '1.302171', + 'Test2::IPC::Driver' => '1.302171', + 'Test2::IPC::Driver::Files'=> '1.302171', + 'Test2::Tools::Tiny' => '1.302171', + 'Test2::Util' => '1.302171', + 'Test2::Util::ExternalMeta'=> '1.302171', + 'Test2::Util::Facets2Legacy'=> '1.302171', + 'Test2::Util::HashBase' => '1.302171', + 'Test2::Util::Trace' => '1.302171', + 'Test::Builder' => '1.302171', + 'Test::Builder::Formatter'=> '1.302171', + 'Test::Builder::Module' => '1.302171', + 'Test::Builder::Tester' => '1.302171', + 'Test::Builder::Tester::Color'=> '1.302171', + 'Test::Builder::TodoDiag'=> '1.302171', + 'Test::More' => '1.302171', + 'Test::Simple' => '1.302171', + 'Test::Tester' => '1.302171', + 'Test::Tester::Capture' => '1.302171', + 'Test::Tester::CaptureRunner'=> '1.302171', + 'Test::Tester::Delegate'=> '1.302171', + 'Test::use::ok' => '1.302171', + 'XS::APItest' => '1.06', + 'autodie' => '2.32', + 'autodie::Scope::Guard' => '2.32', + 'autodie::Scope::GuardStack'=> '2.32', + 'autodie::Util' => '2.32', + 'autodie::exception' => '2.32', + 'autodie::exception::system'=> '2.32', + 'autodie::hints' => '2.32', + 'autodie::skip' => '2.32', + 'ok' => '1.302171', + }, + removed => { + } + }, + 5.031009 => { + delta_from => 5.031008, + changed => { + 'Archive::Tar' => '2.36', + 'Archive::Tar::Constant'=> '2.36', + 'Archive::Tar::File' => '2.36', + 'B' => '1.80', + 'B::Op_private' => '5.031009', + 'Config' => '5.031009', + 'Devel::PPPort' => '3.57', + 'Encode' => '3.03', + 'ExtUtils::CBuilder' => '0.280234', + 'ExtUtils::CBuilder::Base'=> '0.280234', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280234', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280234', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280234', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280234', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280234', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280234', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280234', + 'ExtUtils::CBuilder::Platform::android'=> '0.280234', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280234', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280234', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280234', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280234', + 'IO' => '1.43', + 'IO::Select' => '1.42', + 'IO::Socket' => '1.43', + 'Module::CoreList' => '5.20200220', + 'Module::CoreList::Utils'=> '5.20200220', + 'POSIX' => '1.92', + 'Pod::Html' => '1.25', + 'Storable' => '3.19', + 'Tie::File' => '1.06', + 'Unicode' => '13.0.0', + 'XS::APItest' => '1.07', + '_charnames' => '1.46', + 'charnames' => '1.46', + 'diagnostics' => '1.37', + 'feature' => '1.58', + 'parent' => '0.238', + 'perlfaq' => '5.20200125', + 'threads' => '2.24', + }, + removed => { + } + }, + 5.030002 => { + delta_from => 5.030001, + changed => { + 'B::Op_private' => '5.030002', + 'Compress::Raw::Bzip2' => '2.089', + 'Config' => '5.030002', + 'Module::CoreList' => '5.20200314', + 'Module::CoreList::Utils'=> '5.20200314', + }, + removed => { + } + }, + 5.031010 => { + delta_from => 5.031009, + changed => { + 'B::Op_private' => '5.031010', + 'Config' => '5.03101', + }, + removed => { + } + }, + 5.031011 => { + delta_from => 5.031010, + changed => { + 'B::Deparse' => '1.53', + 'B::Op_private' => '5.031011', + 'Config' => '5.031011', + 'DynaLoader' => '1.47', + 'Encode' => '3.04', + 'IPC::Open2' => '1.05', + 'IPC::Open3' => '1.21', + 'Module::CoreList' => '5.20200428', + 'Module::CoreList::Utils'=> '5.20200428', + 'Opcode' => '1.47', + 'POSIX' => '1.93', + 'PerlIO' => '1.11', + 'Storable' => '3.20', + 'Test2' => '1.302175', + 'Test2::API' => '1.302175', + 'Test2::API::Breakage' => '1.302175', + 'Test2::API::Context' => '1.302175', + 'Test2::API::Instance' => '1.302175', + 'Test2::API::Stack' => '1.302175', + 'Test2::Event' => '1.302175', + 'Test2::Event::Bail' => '1.302175', + 'Test2::Event::Diag' => '1.302175', + 'Test2::Event::Encoding'=> '1.302175', + 'Test2::Event::Exception'=> '1.302175', + 'Test2::Event::Fail' => '1.302175', + 'Test2::Event::Generic' => '1.302175', + 'Test2::Event::Note' => '1.302175', + 'Test2::Event::Ok' => '1.302175', + 'Test2::Event::Pass' => '1.302175', + 'Test2::Event::Plan' => '1.302175', + 'Test2::Event::Skip' => '1.302175', + 'Test2::Event::Subtest' => '1.302175', + 'Test2::Event::TAP::Version'=> '1.302175', + 'Test2::Event::V2' => '1.302175', + 'Test2::Event::Waiting' => '1.302175', + 'Test2::EventFacet' => '1.302175', + 'Test2::EventFacet::About'=> '1.302175', + 'Test2::EventFacet::Amnesty'=> '1.302175', + 'Test2::EventFacet::Assert'=> '1.302175', + 'Test2::EventFacet::Control'=> '1.302175', + 'Test2::EventFacet::Error'=> '1.302175', + 'Test2::EventFacet::Hub'=> '1.302175', + 'Test2::EventFacet::Info'=> '1.302175', + 'Test2::EventFacet::Info::Table'=> '1.302175', + 'Test2::EventFacet::Meta'=> '1.302175', + 'Test2::EventFacet::Parent'=> '1.302175', + 'Test2::EventFacet::Plan'=> '1.302175', + 'Test2::EventFacet::Render'=> '1.302175', + 'Test2::EventFacet::Trace'=> '1.302175', + 'Test2::Formatter' => '1.302175', + 'Test2::Formatter::TAP' => '1.302175', + 'Test2::Hub' => '1.302175', + 'Test2::Hub::Interceptor'=> '1.302175', + 'Test2::Hub::Interceptor::Terminator'=> '1.302175', + 'Test2::Hub::Subtest' => '1.302175', + 'Test2::IPC' => '1.302175', + 'Test2::IPC::Driver' => '1.302175', + 'Test2::IPC::Driver::Files'=> '1.302175', + 'Test2::Tools::Tiny' => '1.302175', + 'Test2::Util' => '1.302175', + 'Test2::Util::ExternalMeta'=> '1.302175', + 'Test2::Util::Facets2Legacy'=> '1.302175', + 'Test2::Util::HashBase' => '1.302175', + 'Test2::Util::Trace' => '1.302175', + 'Test::Builder' => '1.302175', + 'Test::Builder::Formatter'=> '1.302175', + 'Test::Builder::Module' => '1.302175', + 'Test::Builder::Tester' => '1.302175', + 'Test::Builder::Tester::Color'=> '1.302175', + 'Test::Builder::TodoDiag'=> '1.302175', + 'Test::More' => '1.302175', + 'Test::Simple' => '1.302175', + 'Test::Tester' => '1.302175', + 'Test::Tester::Capture' => '1.302175', + 'Test::Tester::CaptureRunner'=> '1.302175', + 'Test::Tester::Delegate'=> '1.302175', + 'Test::use::ok' => '1.302175', + 'Time::Piece' => '1.3401', + 'Time::Seconds' => '1.3401', + 'Unicode::UCD' => '0.75', + 'XS::APItest' => '1.09', + '_charnames' => '1.47', + 'charnames' => '1.47', + 'ok' => '1.302175', + 'open' => '1.12', + 're' => '0.39', + 'warnings' => '1.47', + }, + removed => { + } + }, + 5.028003 => { + delta_from => 5.028002, + changed => { + 'B::Op_private' => '5.028003', + 'Config' => '5.028003', + 'Module::CoreList' => '5.20200601_28', + 'Module::CoreList::Utils'=> '5.20200601_28', + }, + removed => { + } + }, + 5.030003 => { + delta_from => 5.030002, + changed => { + 'B::Op_private' => '5.030003', + 'Config' => '5.030003', + 'Module::CoreList' => '5.20200601_30', + 'Module::CoreList::Utils'=> '5.20200601_30', + }, + removed => { + } + }, + 5.032000 => { + delta_from => 5.031011, + changed => { + 'B::Deparse' => '1.54', + 'B::Op_private' => '5.032000', + 'Benchmark' => '1.23', + 'Config' => '5.032', + 'Encode' => '3.06', + 'Encode::Guess' => '2.08', + 'File::Glob' => '1.33', + 'List::Util' => '1.55', + 'List::Util::XS' => '1.55', + 'Module::CoreList' => '5.20200620', + 'Module::CoreList::Utils'=> '5.20200620', + 'POSIX' => '1.94', + 'Scalar::Util' => '1.55', + 'Storable' => '3.21', + 'Sub::Util' => '1.55', + 'Thread::Queue' => '3.14', + 'Tie::Scalar' => '1.05', + '_charnames' => '1.48', + 'charnames' => '1.48', + 'encoding' => '3.00', + 'perlfaq' => '5.20200523', + 're' => '0.40', + 'threads' => '2.25', + }, + removed => { + } + }, + 5.033000 => { + delta_from => 5.032000, + changed => { + 'B::Op_private' => '5.033000', + 'Config' => '5.033', + 'Module::CoreList' => '5.20200717', + 'Module::CoreList::Utils'=> '5.20200717', + 'feature' => '1.59', + }, + removed => { + } + }, + 5.033001 => { + delta_from => 5.033, + changed => { + 'B' => '1.81', + 'B::Deparse' => '1.55', + 'B::Op_private' => '5.033001', + 'Config' => '5.033001', + 'Data::Dumper' => '2.175', + 'Devel::PPPort' => '3.60', + 'Devel::Peek' => '1.29', + 'DynaLoader' => '1.48', + 'Errno' => '1.31', + 'Exporter' => '5.75', + 'Exporter::Heavy' => '5.75', + 'ExtUtils::Miniperl' => '1.10', + 'ExtUtils::PL2Bat' => '0.002', + 'ExtUtils::ParseXS' => '3.41', + 'ExtUtils::ParseXS::Constants'=> '3.41', + 'ExtUtils::ParseXS::CountLines'=> '3.41', + 'ExtUtils::ParseXS::Eval'=> '3.41', + 'ExtUtils::ParseXS::Utilities'=> '3.41', + 'Fcntl' => '1.14', + 'File::Path' => '2.17', + 'Hash::Util' => '0.24', + 'Hash::Util::FieldHash' => '1.21', + 'IO' => '1.44', + 'IO::Socket' => '1.44', + 'IO::Socket::UNIX' => '1.42', + 'IPC::Msg' => '2.08', + 'IPC::Semaphore' => '2.08', + 'IPC::SharedMem' => '2.08', + 'IPC::SysV' => '2.08', + 'JSON::PP' => '4.05', + 'JSON::PP::Boolean' => '4.05', + 'Math::Complex' => '1.5902', + 'Module::CoreList' => '5.20200820', + 'Module::CoreList::Utils'=> '5.20200820', + 'Net::Ping' => '2.73_01', + 'POSIX' => '1.95', + 'PerlIO::mmap' => '0.017', + 'Pod::Usage' => '1.70', + 'Safe' => '2.42', + 'Socket' => '2.030', + 'Storable' => '3.22', + 'Time::HiRes' => '1.9765', + 'Unicode::Normalize' => '1.28', + 'XS::APItest' => '1.11', + 'XS::Typemap' => '0.18', + 'feature' => '1.60', + 'mro' => '1.24', + 'strict' => '1.12', + 'threads' => '2.26', + 'threads::shared' => '1.62', + 'warnings' => '1.48', + }, + removed => { + 'Moped::Msg' => 1, + } + }, + 5.033002 => { + delta_from => 5.033001, + changed => { + 'Archive::Tar' => '2.38', + 'Archive::Tar::Constant'=> '2.38', + 'Archive::Tar::File' => '2.38', + 'B::Op_private' => '5.033002', + 'Compress::Raw::Bzip2' => '2.096', + 'Compress::Raw::Zlib' => '2.096', + 'Compress::Zlib' => '2.096', + 'Config' => '5.033002', + 'DB_File' => '1.854', + 'Env' => '1.05', + 'Errno' => '1.32', + 'ExtUtils::Install' => '2.18', + 'ExtUtils::Installed' => '2.18', + 'ExtUtils::Packlist' => '2.18', + 'Filter::Util::Call' => '1.60', + 'IO::Compress::Adapter::Bzip2'=> '2.096', + 'IO::Compress::Adapter::Deflate'=> '2.096', + 'IO::Compress::Adapter::Identity'=> '2.096', + 'IO::Compress::Base' => '2.096', + 'IO::Compress::Base::Common'=> '2.096', + 'IO::Compress::Bzip2' => '2.096', + 'IO::Compress::Deflate' => '2.096', + 'IO::Compress::Gzip' => '2.096', + 'IO::Compress::Gzip::Constants'=> '2.096', + 'IO::Compress::RawDeflate'=> '2.096', + 'IO::Compress::Zip' => '2.096', + 'IO::Compress::Zip::Constants'=> '2.096', + 'IO::Compress::Zlib::Constants'=> '2.096', + 'IO::Compress::Zlib::Extra'=> '2.096', + 'IO::Socket::IP' => '0.41', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.096', + 'IO::Uncompress::Adapter::Identity'=> '2.096', + 'IO::Uncompress::Adapter::Inflate'=> '2.096', + 'IO::Uncompress::AnyInflate'=> '2.096', + 'IO::Uncompress::AnyUncompress'=> '2.096', + 'IO::Uncompress::Base' => '2.096', + 'IO::Uncompress::Bunzip2'=> '2.096', + 'IO::Uncompress::Gunzip'=> '2.096', + 'IO::Uncompress::Inflate'=> '2.096', + 'IO::Uncompress::RawInflate'=> '2.096', + 'IO::Uncompress::Unzip' => '2.096', + 'IO::Zlib' => '1.11', + 'Module::CoreList' => '5.20200920', + 'Module::CoreList::Utils'=> '5.20200920', + 'Module::Load::Conditional'=> '0.74', + 'Opcode' => '1.48', + 'PerlIO::scalar' => '0.31', + 'Safe' => '2.43', + 'Test2' => '1.302181', + 'Test2::API' => '1.302181', + 'Test2::API::Breakage' => '1.302181', + 'Test2::API::Context' => '1.302181', + 'Test2::API::Instance' => '1.302181', + 'Test2::API::InterceptResult'=> '1.302181', + 'Test2::API::InterceptResult::Event'=> '1.302181', + 'Test2::API::InterceptResult::Facet'=> '1.302181', + 'Test2::API::InterceptResult::Hub'=> '1.302181', + 'Test2::API::InterceptResult::Squasher'=> '1.302181', + 'Test2::API::Stack' => '1.302181', + 'Test2::Event' => '1.302181', + 'Test2::Event::Bail' => '1.302181', + 'Test2::Event::Diag' => '1.302181', + 'Test2::Event::Encoding'=> '1.302181', + 'Test2::Event::Exception'=> '1.302181', + 'Test2::Event::Fail' => '1.302181', + 'Test2::Event::Generic' => '1.302181', + 'Test2::Event::Note' => '1.302181', + 'Test2::Event::Ok' => '1.302181', + 'Test2::Event::Pass' => '1.302181', + 'Test2::Event::Plan' => '1.302181', + 'Test2::Event::Skip' => '1.302181', + 'Test2::Event::Subtest' => '1.302181', + 'Test2::Event::TAP::Version'=> '1.302181', + 'Test2::Event::V2' => '1.302181', + 'Test2::Event::Waiting' => '1.302181', + 'Test2::EventFacet' => '1.302181', + 'Test2::EventFacet::About'=> '1.302181', + 'Test2::EventFacet::Amnesty'=> '1.302181', + 'Test2::EventFacet::Assert'=> '1.302181', + 'Test2::EventFacet::Control'=> '1.302181', + 'Test2::EventFacet::Error'=> '1.302181', + 'Test2::EventFacet::Hub'=> '1.302181', + 'Test2::EventFacet::Info'=> '1.302181', + 'Test2::EventFacet::Info::Table'=> '1.302181', + 'Test2::EventFacet::Meta'=> '1.302181', + 'Test2::EventFacet::Parent'=> '1.302181', + 'Test2::EventFacet::Plan'=> '1.302181', + 'Test2::EventFacet::Render'=> '1.302181', + 'Test2::EventFacet::Trace'=> '1.302181', + 'Test2::Formatter' => '1.302181', + 'Test2::Formatter::TAP' => '1.302181', + 'Test2::Hub' => '1.302181', + 'Test2::Hub::Interceptor'=> '1.302181', + 'Test2::Hub::Interceptor::Terminator'=> '1.302181', + 'Test2::Hub::Subtest' => '1.302181', + 'Test2::IPC' => '1.302181', + 'Test2::IPC::Driver' => '1.302181', + 'Test2::IPC::Driver::Files'=> '1.302181', + 'Test2::Tools::Tiny' => '1.302181', + 'Test2::Util' => '1.302181', + 'Test2::Util::ExternalMeta'=> '1.302181', + 'Test2::Util::Facets2Legacy'=> '1.302181', + 'Test2::Util::HashBase' => '1.302181', + 'Test2::Util::Trace' => '1.302181', + 'Test::Builder' => '1.302181', + 'Test::Builder::Formatter'=> '1.302181', + 'Test::Builder::Module' => '1.302181', + 'Test::Builder::Tester' => '1.302181', + 'Test::Builder::Tester::Color'=> '1.302181', + 'Test::Builder::TodoDiag'=> '1.302181', + 'Test::More' => '1.302181', + 'Test::Simple' => '1.302181', + 'Test::Tester' => '1.302181', + 'Test::Tester::Capture' => '1.302181', + 'Test::Tester::CaptureRunner'=> '1.302181', + 'Test::Tester::Delegate'=> '1.302181', + 'Test::use::ok' => '1.302181', + 'ok' => '1.302181', + 'overload' => '1.32', + }, + removed => { + } + }, + 5.033003 => { + delta_from => 5.033002, + changed => { + 'Amiga::ARexx' => '0.05', + 'App::Cpan' => '1.676', + 'B::Op_private' => '5.033003', + 'CPAN' => '2.28', + 'CPAN::FTP' => '5.5013', + 'CPAN::FirstTime' => '5.5315', + 'Config' => '5.033003', + 'DB_File' => '1.855', + 'Data::Dumper' => '2.176', + 'Devel::PPPort' => '3.62', + 'Devel::Peek' => '1.30', + 'Digest' => '1.19', + 'Digest::MD5' => '2.58', + 'Digest::base' => '1.19', + 'Digest::file' => '1.19', + 'Encode' => '3.07', + 'Encode::GSM0338' => '2.08', + 'Errno' => '1.33', + 'Exporter' => '5.76', + 'Exporter::Heavy' => '5.76', + 'ExtUtils::Command' => '7.48', + 'ExtUtils::Command::MM' => '7.48', + 'ExtUtils::Liblist' => '7.48', + 'ExtUtils::Liblist::Kid'=> '7.48', + 'ExtUtils::MM' => '7.48', + 'ExtUtils::MM_AIX' => '7.48', + 'ExtUtils::MM_Any' => '7.48', + 'ExtUtils::MM_BeOS' => '7.48', + 'ExtUtils::MM_Cygwin' => '7.48', + 'ExtUtils::MM_DOS' => '7.48', + 'ExtUtils::MM_Darwin' => '7.48', + 'ExtUtils::MM_MacOS' => '7.48', + 'ExtUtils::MM_NW5' => '7.48', + 'ExtUtils::MM_OS2' => '7.48', + 'ExtUtils::MM_OS390' => '7.48', + 'ExtUtils::MM_QNX' => '7.48', + 'ExtUtils::MM_UWIN' => '7.48', + 'ExtUtils::MM_Unix' => '7.48', + 'ExtUtils::MM_VMS' => '7.48', + 'ExtUtils::MM_VOS' => '7.48', + 'ExtUtils::MM_Win32' => '7.48', + 'ExtUtils::MM_Win95' => '7.48', + 'ExtUtils::MY' => '7.48', + 'ExtUtils::MakeMaker' => '7.48', + 'ExtUtils::MakeMaker::Config'=> '7.48', + 'ExtUtils::MakeMaker::Locale'=> '7.48', + 'ExtUtils::MakeMaker::version'=> '7.48', + 'ExtUtils::MakeMaker::version::regex'=> '7.48', + 'ExtUtils::Mkbootstrap' => '7.48', + 'ExtUtils::Mksymlists' => '7.48', + 'ExtUtils::PL2Bat' => '0.003', + 'ExtUtils::testlib' => '7.48', + 'File::Temp' => '0.2311', + 'FindBin' => '1.52', + 'Getopt::Long' => '2.52', + 'Getopt::Std' => '1.13', + 'I18N::LangTags' => '0.45', + 'MIME::Base64' => '3.16', + 'MIME::QuotedPrint' => '3.16', + 'Module::CoreList' => '5.20201020', + 'Module::CoreList::Utils'=> '5.20201020', + 'Module::Load' => '0.36', + 'Pod::Checker' => '1.74', + 'Pod::Simple' => '3.41', + 'Pod::Simple::BlackBox' => '3.41', + 'Pod::Simple::Checker' => '3.41', + 'Pod::Simple::Debug' => '3.41', + 'Pod::Simple::DumpAsText'=> '3.41', + 'Pod::Simple::DumpAsXML'=> '3.41', + 'Pod::Simple::HTML' => '3.41', + 'Pod::Simple::HTMLBatch'=> '3.41', + 'Pod::Simple::LinkSection'=> '3.41', + 'Pod::Simple::Methody' => '3.41', + 'Pod::Simple::Progress' => '3.41', + 'Pod::Simple::PullParser'=> '3.41', + 'Pod::Simple::PullParserEndToken'=> '3.41', + 'Pod::Simple::PullParserStartToken'=> '3.41', + 'Pod::Simple::PullParserTextToken'=> '3.41', + 'Pod::Simple::PullParserToken'=> '3.41', + 'Pod::Simple::RTF' => '3.41', + 'Pod::Simple::Search' => '3.41', + 'Pod::Simple::SimpleTree'=> '3.41', + 'Pod::Simple::Text' => '3.41', + 'Pod::Simple::TextContent'=> '3.41', + 'Pod::Simple::TiedOutFH'=> '3.41', + 'Pod::Simple::Transcode'=> '3.41', + 'Pod::Simple::TranscodeDumb'=> '3.41', + 'Pod::Simple::TranscodeSmart'=> '3.41', + 'Pod::Simple::XHTML' => '3.41', + 'Pod::Simple::XMLOutStream'=> '3.41', + 'Pod::Usage' => '2.01', + 'Storable' => '3.23', + 'Symbol' => '1.09', + 'Test2' => '1.302182', + 'Test2::API' => '1.302182', + 'Test2::API::Breakage' => '1.302182', + 'Test2::API::Context' => '1.302182', + 'Test2::API::Instance' => '1.302182', + 'Test2::API::InterceptResult'=> '1.302182', + 'Test2::API::InterceptResult::Event'=> '1.302182', + 'Test2::API::InterceptResult::Facet'=> '1.302182', + 'Test2::API::InterceptResult::Hub'=> '1.302182', + 'Test2::API::InterceptResult::Squasher'=> '1.302182', + 'Test2::API::Stack' => '1.302182', + 'Test2::Event' => '1.302182', + 'Test2::Event::Bail' => '1.302182', + 'Test2::Event::Diag' => '1.302182', + 'Test2::Event::Encoding'=> '1.302182', + 'Test2::Event::Exception'=> '1.302182', + 'Test2::Event::Fail' => '1.302182', + 'Test2::Event::Generic' => '1.302182', + 'Test2::Event::Note' => '1.302182', + 'Test2::Event::Ok' => '1.302182', + 'Test2::Event::Pass' => '1.302182', + 'Test2::Event::Plan' => '1.302182', + 'Test2::Event::Skip' => '1.302182', + 'Test2::Event::Subtest' => '1.302182', + 'Test2::Event::TAP::Version'=> '1.302182', + 'Test2::Event::V2' => '1.302182', + 'Test2::Event::Waiting' => '1.302182', + 'Test2::EventFacet' => '1.302182', + 'Test2::EventFacet::About'=> '1.302182', + 'Test2::EventFacet::Amnesty'=> '1.302182', + 'Test2::EventFacet::Assert'=> '1.302182', + 'Test2::EventFacet::Control'=> '1.302182', + 'Test2::EventFacet::Error'=> '1.302182', + 'Test2::EventFacet::Hub'=> '1.302182', + 'Test2::EventFacet::Info'=> '1.302182', + 'Test2::EventFacet::Info::Table'=> '1.302182', + 'Test2::EventFacet::Meta'=> '1.302182', + 'Test2::EventFacet::Parent'=> '1.302182', + 'Test2::EventFacet::Plan'=> '1.302182', + 'Test2::EventFacet::Render'=> '1.302182', + 'Test2::EventFacet::Trace'=> '1.302182', + 'Test2::Formatter' => '1.302182', + 'Test2::Formatter::TAP' => '1.302182', + 'Test2::Hub' => '1.302182', + 'Test2::Hub::Interceptor'=> '1.302182', + 'Test2::Hub::Interceptor::Terminator'=> '1.302182', + 'Test2::Hub::Subtest' => '1.302182', + 'Test2::IPC' => '1.302182', + 'Test2::IPC::Driver' => '1.302182', + 'Test2::IPC::Driver::Files'=> '1.302182', + 'Test2::Tools::Tiny' => '1.302182', + 'Test2::Util' => '1.302182', + 'Test2::Util::ExternalMeta'=> '1.302182', + 'Test2::Util::Facets2Legacy'=> '1.302182', + 'Test2::Util::HashBase' => '1.302182', + 'Test2::Util::Trace' => '1.302182', + 'Test::Builder' => '1.302182', + 'Test::Builder::Formatter'=> '1.302182', + 'Test::Builder::Module' => '1.302182', + 'Test::Builder::Tester' => '1.302182', + 'Test::Builder::Tester::Color'=> '1.302182', + 'Test::Builder::TodoDiag'=> '1.302182', + 'Test::More' => '1.302182', + 'Test::Simple' => '1.302182', + 'Test::Tester' => '1.302182', + 'Test::Tester::Capture' => '1.302182', + 'Test::Tester::CaptureRunner'=> '1.302182', + 'Test::Tester::Delegate'=> '1.302182', + 'Test::use::ok' => '1.302182', + 'Tie::RefHash' => '1.40', + 'Time::Local' => '1.30', + 'Unicode::Collate' => '1.29', + 'Unicode::Collate::CJK::Big5'=> '1.29', + 'Unicode::Collate::CJK::GB2312'=> '1.29', + 'Unicode::Collate::CJK::JISX0208'=> '1.29', + 'Unicode::Collate::CJK::Korean'=> '1.29', + 'Unicode::Collate::CJK::Pinyin'=> '1.29', + 'Unicode::Collate::CJK::Stroke'=> '1.29', + 'Unicode::Collate::CJK::Zhuyin'=> '1.29', + 'Unicode::Collate::Locale'=> '1.29', + 'Win32' => '0.54', + 'XS::APItest' => '1.12', + 'bytes' => '1.08', + 'experimental' => '0.022', + 'feature' => '1.61', + 'if' => '0.0609', + 'locale' => '1.10', + 'mro' => '1.25', + 'ok' => '1.302182', + 'overload' => '1.33', + 're' => '0.41', + 'subs' => '1.04', + 'utf8' => '1.24', + 'version' => '0.9928', + 'version::regex' => '0.9928', + }, + removed => { + } + }, + 5.033004 => { + delta_from => 5.033003, + changed => { + 'B' => '1.82', + 'B::Op_private' => '5.033004', + 'Config' => '5.033004', + 'Cwd' => '3.79', + 'ExtUtils::CBuilder' => '0.280235', + 'ExtUtils::CBuilder::Base'=> '0.280235', + 'ExtUtils::CBuilder::Platform::Unix'=> '0.280235', + 'ExtUtils::CBuilder::Platform::VMS'=> '0.280235', + 'ExtUtils::CBuilder::Platform::Windows'=> '0.280235', + 'ExtUtils::CBuilder::Platform::Windows::BCC'=> '0.280235', + 'ExtUtils::CBuilder::Platform::Windows::GCC'=> '0.280235', + 'ExtUtils::CBuilder::Platform::Windows::MSVC'=> '0.280235', + 'ExtUtils::CBuilder::Platform::aix'=> '0.280235', + 'ExtUtils::CBuilder::Platform::android'=> '0.280235', + 'ExtUtils::CBuilder::Platform::cygwin'=> '0.280235', + 'ExtUtils::CBuilder::Platform::darwin'=> '0.280235', + 'ExtUtils::CBuilder::Platform::dec_osf'=> '0.280235', + 'ExtUtils::CBuilder::Platform::os2'=> '0.280235', + 'ExtUtils::Command' => '7.56', + 'ExtUtils::Command::MM' => '7.56', + 'ExtUtils::Liblist' => '7.56', + 'ExtUtils::Liblist::Kid'=> '7.56', + 'ExtUtils::MM' => '7.56', + 'ExtUtils::MM_AIX' => '7.56', + 'ExtUtils::MM_Any' => '7.56', + 'ExtUtils::MM_BeOS' => '7.56', + 'ExtUtils::MM_Cygwin' => '7.56', + 'ExtUtils::MM_DOS' => '7.56', + 'ExtUtils::MM_Darwin' => '7.56', + 'ExtUtils::MM_MacOS' => '7.56', + 'ExtUtils::MM_NW5' => '7.56', + 'ExtUtils::MM_OS2' => '7.56', + 'ExtUtils::MM_OS390' => '7.56', + 'ExtUtils::MM_QNX' => '7.56', + 'ExtUtils::MM_UWIN' => '7.56', + 'ExtUtils::MM_Unix' => '7.56', + 'ExtUtils::MM_VMS' => '7.56', + 'ExtUtils::MM_VOS' => '7.56', + 'ExtUtils::MM_Win32' => '7.56', + 'ExtUtils::MM_Win95' => '7.56', + 'ExtUtils::MY' => '7.56', + 'ExtUtils::MakeMaker' => '7.56', + 'ExtUtils::MakeMaker::Config'=> '7.56', + 'ExtUtils::MakeMaker::Locale'=> '7.56', + 'ExtUtils::MakeMaker::version'=> '7.56', + 'ExtUtils::MakeMaker::version::regex'=> '7.56', + 'ExtUtils::Mkbootstrap' => '7.56', + 'ExtUtils::Mksymlists' => '7.56', + 'ExtUtils::testlib' => '7.56', + 'File::Fetch' => '1.00', + 'File::Path' => '2.18', + 'File::Spec' => '3.79', + 'File::Spec::AmigaOS' => '3.79', + 'File::Spec::Cygwin' => '3.79', + 'File::Spec::Epoc' => '3.79', + 'File::Spec::Functions' => '3.79', + 'File::Spec::Mac' => '3.79', + 'File::Spec::OS2' => '3.79', + 'File::Spec::Unix' => '3.79', + 'File::Spec::VMS' => '3.79', + 'IPC::Msg' => '2.09', + 'IPC::Semaphore' => '2.09', + 'IPC::SharedMem' => '2.09', + 'IPC::SysV' => '2.09', + 'Module::CoreList' => '5.20201120', + 'Module::CoreList::Utils'=> '5.20201120', + 'Net::Ping' => '2.74', + 'Pod::Html' => '1.26', + 'Pod::Simple' => '3.42', + 'Pod::Simple::BlackBox' => '3.42', + 'Pod::Simple::Checker' => '3.42', + 'Pod::Simple::Debug' => '3.42', + 'Pod::Simple::DumpAsText'=> '3.42', + 'Pod::Simple::DumpAsXML'=> '3.42', + 'Pod::Simple::HTML' => '3.42', + 'Pod::Simple::HTMLBatch'=> '3.42', + 'Pod::Simple::LinkSection'=> '3.42', + 'Pod::Simple::Methody' => '3.42', + 'Pod::Simple::Progress' => '3.42', + 'Pod::Simple::PullParser'=> '3.42', + 'Pod::Simple::PullParserEndToken'=> '3.42', + 'Pod::Simple::PullParserStartToken'=> '3.42', + 'Pod::Simple::PullParserTextToken'=> '3.42', + 'Pod::Simple::PullParserToken'=> '3.42', + 'Pod::Simple::RTF' => '3.42', + 'Pod::Simple::Search' => '3.42', + 'Pod::Simple::SimpleTree'=> '3.42', + 'Pod::Simple::Text' => '3.42', + 'Pod::Simple::TextContent'=> '3.42', + 'Pod::Simple::TiedOutFH'=> '3.42', + 'Pod::Simple::Transcode'=> '3.42', + 'Pod::Simple::TranscodeDumb'=> '3.42', + 'Pod::Simple::TranscodeSmart'=> '3.42', + 'Pod::Simple::XHTML' => '3.42', + 'Pod::Simple::XMLOutStream'=> '3.42', + 'Test2' => '1.302183', + 'Test2::API' => '1.302183', + 'Test2::API::Breakage' => '1.302183', + 'Test2::API::Context' => '1.302183', + 'Test2::API::Instance' => '1.302183', + 'Test2::API::InterceptResult'=> '1.302183', + 'Test2::API::InterceptResult::Event'=> '1.302183', + 'Test2::API::InterceptResult::Facet'=> '1.302183', + 'Test2::API::InterceptResult::Hub'=> '1.302183', + 'Test2::API::InterceptResult::Squasher'=> '1.302183', + 'Test2::API::Stack' => '1.302183', + 'Test2::Event' => '1.302183', + 'Test2::Event::Bail' => '1.302183', + 'Test2::Event::Diag' => '1.302183', + 'Test2::Event::Encoding'=> '1.302183', + 'Test2::Event::Exception'=> '1.302183', + 'Test2::Event::Fail' => '1.302183', + 'Test2::Event::Generic' => '1.302183', + 'Test2::Event::Note' => '1.302183', + 'Test2::Event::Ok' => '1.302183', + 'Test2::Event::Pass' => '1.302183', + 'Test2::Event::Plan' => '1.302183', + 'Test2::Event::Skip' => '1.302183', + 'Test2::Event::Subtest' => '1.302183', + 'Test2::Event::TAP::Version'=> '1.302183', + 'Test2::Event::V2' => '1.302183', + 'Test2::Event::Waiting' => '1.302183', + 'Test2::EventFacet' => '1.302183', + 'Test2::EventFacet::About'=> '1.302183', + 'Test2::EventFacet::Amnesty'=> '1.302183', + 'Test2::EventFacet::Assert'=> '1.302183', + 'Test2::EventFacet::Control'=> '1.302183', + 'Test2::EventFacet::Error'=> '1.302183', + 'Test2::EventFacet::Hub'=> '1.302183', + 'Test2::EventFacet::Info'=> '1.302183', + 'Test2::EventFacet::Info::Table'=> '1.302183', + 'Test2::EventFacet::Meta'=> '1.302183', + 'Test2::EventFacet::Parent'=> '1.302183', + 'Test2::EventFacet::Plan'=> '1.302183', + 'Test2::EventFacet::Render'=> '1.302183', + 'Test2::EventFacet::Trace'=> '1.302183', + 'Test2::Formatter' => '1.302183', + 'Test2::Formatter::TAP' => '1.302183', + 'Test2::Hub' => '1.302183', + 'Test2::Hub::Interceptor'=> '1.302183', + 'Test2::Hub::Interceptor::Terminator'=> '1.302183', + 'Test2::Hub::Subtest' => '1.302183', + 'Test2::IPC' => '1.302183', + 'Test2::IPC::Driver' => '1.302183', + 'Test2::IPC::Driver::Files'=> '1.302183', + 'Test2::Tools::Tiny' => '1.302183', + 'Test2::Util' => '1.302183', + 'Test2::Util::ExternalMeta'=> '1.302183', + 'Test2::Util::Facets2Legacy'=> '1.302183', + 'Test2::Util::HashBase' => '1.302183', + 'Test2::Util::Trace' => '1.302183', + 'Test::Builder' => '1.302183', + 'Test::Builder::Formatter'=> '1.302183', + 'Test::Builder::Module' => '1.302183', + 'Test::Builder::Tester' => '1.302183', + 'Test::Builder::Tester::Color'=> '1.302183', + 'Test::Builder::TodoDiag'=> '1.302183', + 'Test::More' => '1.302183', + 'Test::Simple' => '1.302183', + 'Test::Tester' => '1.302183', + 'Test::Tester::Capture' => '1.302183', + 'Test::Tester::CaptureRunner'=> '1.302183', + 'Test::Tester::Delegate'=> '1.302183', + 'Test::use::ok' => '1.302183', + 'XS::APItest' => '1.13', + 'ok' => '1.302183', + 'perlfaq' => '5.20201107', + }, + removed => { + } + }, + 5.033005 => { + delta_from => 5.033004, + changed => { + 'App::Prove' => '3.43', + 'App::Prove::State' => '3.43', + 'App::Prove::State::Result'=> '3.43', + 'App::Prove::State::Result::Test'=> '3.43', + 'B::Op_private' => '5.033005', + 'Carp' => '1.51', + 'Carp::Heavy' => '1.51', + 'Config' => '5.033005', + 'Config::Perl::V' => '0.33', + 'Cwd' => '3.80', + 'DynaLoader' => '1.49', + 'Encode' => '3.08', + 'Encode::GSM0338' => '2.09', + 'ExtUtils::Install' => '2.20', + 'ExtUtils::Installed' => '2.20', + 'ExtUtils::Packlist' => '2.20', + 'ExtUtils::ParseXS' => '3.42', + 'ExtUtils::ParseXS::Constants'=> '3.42', + 'ExtUtils::ParseXS::CountLines'=> '3.42', + 'ExtUtils::ParseXS::Eval'=> '3.42', + 'ExtUtils::ParseXS::Utilities'=> '3.42', + 'File::Copy' => '2.35', + 'File::Find' => '1.38', + 'File::Spec' => '3.80', + 'File::Spec::AmigaOS' => '3.80', + 'File::Spec::Cygwin' => '3.80', + 'File::Spec::Epoc' => '3.80', + 'File::Spec::Functions' => '3.80', + 'File::Spec::Mac' => '3.80', + 'File::Spec::OS2' => '3.80', + 'File::Spec::Unix' => '3.80', + 'File::Spec::VMS' => '3.80', + 'File::Spec::Win32' => '3.80', + 'Module::CoreList' => '5.20201220', + 'Module::CoreList::Utils'=> '5.20201220', + 'Net::Cmd' => '3.12', + 'Net::Config' => '3.12', + 'Net::Domain' => '3.12', + 'Net::FTP' => '3.12', + 'Net::FTP::A' => '3.12', + 'Net::FTP::E' => '3.12', + 'Net::FTP::I' => '3.12', + 'Net::FTP::L' => '3.12', + 'Net::FTP::dataconn' => '3.12', + 'Net::NNTP' => '3.12', + 'Net::Netrc' => '3.12', + 'Net::POP3' => '3.12', + 'Net::SMTP' => '3.12', + 'Net::Time' => '3.12', + 'ODBM_File' => '1.17', + 'Opcode' => '1.49', + 'POSIX' => '1.96', + 'PerlIO::via::QuotedPrint'=> '0.09', + 'TAP::Base' => '3.43', + 'TAP::Formatter::Base' => '3.43', + 'TAP::Formatter::Color' => '3.43', + 'TAP::Formatter::Console'=> '3.43', + 'TAP::Formatter::Console::ParallelSession'=> '3.43', + 'TAP::Formatter::Console::Session'=> '3.43', + 'TAP::Formatter::File' => '3.43', + 'TAP::Formatter::File::Session'=> '3.43', + 'TAP::Formatter::Session'=> '3.43', + 'TAP::Harness' => '3.43', + 'TAP::Harness::Env' => '3.43', + 'TAP::Object' => '3.43', + 'TAP::Parser' => '3.43', + 'TAP::Parser::Aggregator'=> '3.43', + 'TAP::Parser::Grammar' => '3.43', + 'TAP::Parser::Iterator' => '3.43', + 'TAP::Parser::Iterator::Array'=> '3.43', + 'TAP::Parser::Iterator::Process'=> '3.43', + 'TAP::Parser::Iterator::Stream'=> '3.43', + 'TAP::Parser::IteratorFactory'=> '3.43', + 'TAP::Parser::Multiplexer'=> '3.43', + 'TAP::Parser::Result' => '3.43', + 'TAP::Parser::Result::Bailout'=> '3.43', + 'TAP::Parser::Result::Comment'=> '3.43', + 'TAP::Parser::Result::Plan'=> '3.43', + 'TAP::Parser::Result::Pragma'=> '3.43', + 'TAP::Parser::Result::Test'=> '3.43', + 'TAP::Parser::Result::Unknown'=> '3.43', + 'TAP::Parser::Result::Version'=> '3.43', + 'TAP::Parser::Result::YAML'=> '3.43', + 'TAP::Parser::ResultFactory'=> '3.43', + 'TAP::Parser::Scheduler'=> '3.43', + 'TAP::Parser::Scheduler::Job'=> '3.43', + 'TAP::Parser::Scheduler::Spinner'=> '3.43', + 'TAP::Parser::Source' => '3.43', + 'TAP::Parser::SourceHandler'=> '3.43', + 'TAP::Parser::SourceHandler::Executable'=> '3.43', + 'TAP::Parser::SourceHandler::File'=> '3.43', + 'TAP::Parser::SourceHandler::Handle'=> '3.43', + 'TAP::Parser::SourceHandler::Perl'=> '3.43', + 'TAP::Parser::SourceHandler::RawTAP'=> '3.43', + 'TAP::Parser::YAMLish::Reader'=> '3.43', + 'TAP::Parser::YAMLish::Writer'=> '3.43', + 'Test::Harness' => '3.43', + 'Text::Balanced' => '2.04', + 'Time::HiRes' => '1.9766', + 'XS::APItest' => '1.14', + 'warnings' => '1.49', + }, + removed => { + } + }, + 5.033006 => { + delta_from => 5.033005, + changed => { + 'B::Op_private' => '5.033006', + 'Carp' => '1.52', + 'Carp::Heavy' => '1.52', + 'Compress::Raw::Bzip2' => '2.100', + 'Compress::Raw::Zlib' => '2.100', + 'Compress::Zlib' => '2.100', + 'Config' => '5.033006', + 'DynaLoader' => '1.50', + 'ExtUtils::Command' => '7.58', + 'ExtUtils::Command::MM' => '7.58', + 'ExtUtils::Liblist' => '7.58', + 'ExtUtils::Liblist::Kid'=> '7.58', + 'ExtUtils::MM' => '7.58', + 'ExtUtils::MM_AIX' => '7.58', + 'ExtUtils::MM_Any' => '7.58', + 'ExtUtils::MM_BeOS' => '7.58', + 'ExtUtils::MM_Cygwin' => '7.58', + 'ExtUtils::MM_DOS' => '7.58', + 'ExtUtils::MM_Darwin' => '7.58', + 'ExtUtils::MM_MacOS' => '7.58', + 'ExtUtils::MM_NW5' => '7.58', + 'ExtUtils::MM_OS2' => '7.58', + 'ExtUtils::MM_OS390' => '7.58', + 'ExtUtils::MM_QNX' => '7.58', + 'ExtUtils::MM_UWIN' => '7.58', + 'ExtUtils::MM_Unix' => '7.58', + 'ExtUtils::MM_VMS' => '7.58', + 'ExtUtils::MM_VOS' => '7.58', + 'ExtUtils::MM_Win32' => '7.58', + 'ExtUtils::MM_Win95' => '7.58', + 'ExtUtils::MY' => '7.58', + 'ExtUtils::MakeMaker' => '7.58', + 'ExtUtils::MakeMaker::Config'=> '7.58', + 'ExtUtils::MakeMaker::Locale'=> '7.58', + 'ExtUtils::MakeMaker::version'=> '7.58', + 'ExtUtils::MakeMaker::version::regex'=> '7.58', + 'ExtUtils::Manifest' => '1.73', + 'ExtUtils::Mkbootstrap' => '7.58', + 'ExtUtils::Mksymlists' => '7.58', + 'ExtUtils::testlib' => '7.58', + 'GDBM_File' => '1.19', + 'IO' => '1.45', + 'IO::Compress::Adapter::Bzip2'=> '2.100', + 'IO::Compress::Adapter::Deflate'=> '2.100', + 'IO::Compress::Adapter::Identity'=> '2.100', + 'IO::Compress::Base' => '2.100', + 'IO::Compress::Base::Common'=> '2.100', + 'IO::Compress::Bzip2' => '2.100', + 'IO::Compress::Deflate' => '2.100', + 'IO::Compress::Gzip' => '2.100', + 'IO::Compress::Gzip::Constants'=> '2.100', + 'IO::Compress::RawDeflate'=> '2.100', + 'IO::Compress::Zip' => '2.100', + 'IO::Compress::Zip::Constants'=> '2.100', + 'IO::Compress::Zlib::Constants'=> '2.100', + 'IO::Compress::Zlib::Extra'=> '2.100', + 'IO::Dir' => '1.45', + 'IO::File' => '1.45', + 'IO::Handle' => '1.45', + 'IO::Pipe' => '1.45', + 'IO::Poll' => '1.45', + 'IO::Seekable' => '1.45', + 'IO::Select' => '1.45', + 'IO::Socket' => '1.45', + 'IO::Socket::INET' => '1.45', + 'IO::Socket::UNIX' => '1.45', + 'IO::Uncompress::Adapter::Bunzip2'=> '2.100', + 'IO::Uncompress::Adapter::Identity'=> '2.100', + 'IO::Uncompress::Adapter::Inflate'=> '2.100', + 'IO::Uncompress::AnyInflate'=> '2.100', + 'IO::Uncompress::AnyUncompress'=> '2.100', + 'IO::Uncompress::Base' => '2.100', + 'IO::Uncompress::Bunzip2'=> '2.100', + 'IO::Uncompress::Gunzip'=> '2.100', + 'IO::Uncompress::Inflate'=> '2.100', + 'IO::Uncompress::RawInflate'=> '2.100', + 'IO::Uncompress::Unzip' => '2.100', + 'Module::CoreList' => '5.20210120', + 'Module::CoreList::Utils'=> '5.20210120', + 'Net::Cmd' => '3.13', + 'Net::Config' => '3.13', + 'Net::Domain' => '3.13', + 'Net::FTP' => '3.13', + 'Net::FTP::A' => '3.13', + 'Net::FTP::E' => '3.13', + 'Net::FTP::I' => '3.13', + 'Net::FTP::L' => '3.13', + 'Net::FTP::dataconn' => '3.13', + 'Net::NNTP' => '3.13', + 'Net::Netrc' => '3.13', + 'Net::POP3' => '3.13', + 'Net::SMTP' => '3.13', + 'Net::Time' => '3.13', + 'POSIX' => '1.97', + 'Socket' => '2.031', + 'XS::APItest' => '1.15', + 'feature' => '1.62', + 'warnings' => '1.50', + }, + removed => { + } + }, + 5.032001 => { + delta_from => 5.032000, + changed => { + 'B::Op_private' => '5.032001', + 'Config' => '5.032001', + 'Data::Dumper' => '2.174_01', + 'DynaLoader' => '1.47_01', + 'ExtUtils::Liblist::Kid'=> '7.44_01', + 'Module::CoreList' => '5.20210123', + 'Module::CoreList::Utils'=> '5.20210123', + 'Opcode' => '1.48', + 'Safe' => '2.41_01', + 'Win32API::File::inc::ExtUtils::Myconst2perl'=> '1', + }, + removed => { + } + }, +); + +sub is_core +{ + shift if defined $_[1] and $_[1] =~ /^\w/ and _looks_like_invocant $_[0]; + my $module = shift; + my $module_version = @_ > 0 ? shift : undef; + my $perl_version = @_ > 0 ? shift : $]; + + my $first_release = first_release($module); + + return 0 if !defined($first_release) || $first_release > $perl_version; + + my $final_release = removed_from($module); + + return 0 if defined($final_release) && $perl_version >= $final_release; + + # If a minimum version of the module was specified: + # Step through all perl releases ($prn) + # so we can find what version of the module + # was included in the specified version of perl. + # On the way if we pass the required module version, we can + # short-circuit and return true + if (defined($module_version)) { + my $module_version_object = eval { version->parse($module_version) }; + if (!defined($module_version_object)) { + (my $err = $@) =~ s/^Invalid version format\b/Invalid version '$module_version' specified/; + die $err; + } + # The Perl releases aren't a linear sequence, but a tree. We need to build the path + # of releases from 5 to the specified release, and follow the module's version(s) + # along that path. + my @releases = ($perl_version); + my $rel = $perl_version; + while (defined($rel)) { + # XXX: This line is a sign of failure. -- rjbs, 2015-04-15 + my $this_delta = $delta{$rel} || $delta{ sprintf '%0.6f', $rel }; + $rel = $this_delta->{delta_from}; + unshift(@releases, $rel) if defined($rel); + } + RELEASE: + foreach my $prn (@releases) { + next RELEASE if $prn < $first_release; + last RELEASE if $prn > $perl_version; + next unless defined(my $next_module_version + = $delta{$prn}->{changed}->{$module}); + return 1 if eval { version->parse($next_module_version) >= $module_version_object }; + } + return 0; + } + + return 1 if !defined($final_release); + + return $perl_version <= $final_release; +} + +%version = _undelta(\%delta); + +%deprecated = ( + 5.011 => { + changed => { map { $_ => 1 } qw/ + Class::ISA + Pod::Plainer + Shell + Switch + /}, + }, + 5.011001 => { delta_from => 5.011 }, + 5.011002 => { delta_from => 5.011001 }, + 5.011003 => { delta_from => 5.011002 }, + 5.011004 => { delta_from => 5.011003 }, + 5.011005 => { delta_from => 5.011004 }, + + 5.012 => { delta_from => 5.011005 }, + 5.012001 => { delta_from => 5.012 }, + 5.012002 => { delta_from => 5.012001 }, + 5.012003 => { delta_from => 5.012002 }, + 5.012004 => { delta_from => 5.012003 }, + 5.012005 => { delta_from => 5.012004 }, + + 5.013 => { delta_from => 5.012005 }, + 5.013001 => { + delta_from => 5.013, + removed => { map { $_ => 1 } qw/ + Class::ISA + Pod::Plainer + Switch + /}, + }, + 5.013002 => { delta_from => 5.013001 }, + 5.013003 => { delta_from => 5.013002 }, + 5.013004 => { delta_from => 5.013003 }, + 5.013005 => { delta_from => 5.013004 }, + 5.013006 => { delta_from => 5.013005 }, + 5.013007 => { delta_from => 5.013006 }, + 5.013008 => { delta_from => 5.013007 }, + 5.013009 => { delta_from => 5.013008 }, + 5.01301 => { delta_from => 5.013009 }, + 5.013011 => { delta_from => 5.01301 }, + + 5.014 => { delta_from => 5.013011 }, + 5.014001 => { delta_from => 5.014 }, + 5.014002 => { delta_from => 5.014001 }, + 5.014003 => { delta_from => 5.014002 }, + 5.014004 => { delta_from => 5.014003 }, + + 5.015 => { + delta_from => 5.014004, + removed => { Shell => 1 }, + }, + 5.015001 => { delta_from => 5.015 }, + 5.015002 => { delta_from => 5.015001 }, + 5.015003 => { delta_from => 5.015002 }, + 5.015004 => { delta_from => 5.015003 }, + 5.015005 => { delta_from => 5.015004 }, + 5.015006 => { delta_from => 5.015005 }, + 5.015007 => { delta_from => 5.015006 }, + 5.015008 => { delta_from => 5.015007 }, + 5.015009 => { delta_from => 5.015008 }, + + 5.016 => { delta_from => 5.015009 }, + 5.016001 => { delta_from => 5.016 }, + 5.016002 => { delta_from => 5.016001 }, + 5.016003 => { delta_from => 5.016002 }, + + 5.017 => { delta_from => 5.016003 }, + 5.017001 => { delta_from => 5.017 }, + 5.017002 => { delta_from => 5.017001 }, + 5.017003 => { delta_from => 5.017002 }, + 5.017004 => { delta_from => 5.017003 }, + 5.017005 => { delta_from => 5.017004 }, + 5.017006 => { delta_from => 5.017005 }, + 5.017007 => { delta_from => 5.017006 }, + 5.017008 => { + delta_from => 5.017007, + changed => { 'Pod::LaTeX' => 1 }, + }, + 5.017009 => { + delta_from => 5.017008, + changed => { map { $_ => 1 } qw/ + Archive::Extract + B::Lint + B::Lint::Debug + CPANPLUS + CPANPLUS::Backend + CPANPLUS::Backend::RV + CPANPLUS::Config + CPANPLUS::Config::HomeEnv + CPANPLUS::Configure + CPANPLUS::Configure::Setup + CPANPLUS::Dist + CPANPLUS::Dist::Autobundle + CPANPLUS::Dist::Base + CPANPLUS::Dist::Build + CPANPLUS::Dist::Build::Constants + CPANPLUS::Dist::MM + CPANPLUS::Dist::Sample + CPANPLUS::Error + CPANPLUS::Internals + CPANPLUS::Internals::Constants + CPANPLUS::Internals::Constants::Report + CPANPLUS::Internals::Extract + CPANPLUS::Internals::Fetch + CPANPLUS::Internals::Report + CPANPLUS::Internals::Search + CPANPLUS::Internals::Source + CPANPLUS::Internals::Source::Memory + CPANPLUS::Internals::Source::SQLite + CPANPLUS::Internals::Source::SQLite::Tie + CPANPLUS::Internals::Utils + CPANPLUS::Internals::Utils::Autoflush + CPANPLUS::Module + CPANPLUS::Module::Author + CPANPLUS::Module::Author::Fake + CPANPLUS::Module::Checksums + CPANPLUS::Module::Fake + CPANPLUS::Module::Signature + CPANPLUS::Selfupdate + CPANPLUS::Shell + CPANPLUS::Shell::Classic + CPANPLUS::Shell::Default + CPANPLUS::Shell::Default::Plugins::CustomSource + CPANPLUS::Shell::Default::Plugins::Remote + CPANPLUS::Shell::Default::Plugins::Source + Devel::InnerPackage + File::CheckTree + Log::Message + Log::Message::Config + Log::Message::Handlers + Log::Message::Item + Log::Message::Simple + Module::Pluggable + Module::Pluggable::Object + Object::Accessor + Term::UI + Term::UI::History + Text::Soundex + /}, + }, + 5.01701 => { delta_from => 5.017009 }, + 5.017011 => { delta_from => 5.01701 }, + + 5.018 => { delta_from => 5.017011 }, + 5.018001 => { + delta_from => 5.018, + changed => { + }, + removed => { + } + }, + 5.018002 => { + delta_from => 5.018001, + changed => { + }, + removed => { + } + }, + 5.018003 => { + delta_from => 5.018, + changed => { + }, + removed => { + } + }, + 5.018004 => { + delta_from => 5.018, + changed => { + }, + removed => { + } + }, + + 5.019 => { + delta_from => 5.018, + changed => { 'Module::Build' => 1 }, + removed => { map { $_ => 1 } qw/ + Archive::Extract + B::Lint + B::Lint::Debug + CPANPLUS + CPANPLUS::Backend + CPANPLUS::Backend::RV + CPANPLUS::Config + CPANPLUS::Config::HomeEnv + CPANPLUS::Configure + CPANPLUS::Configure::Setup + CPANPLUS::Dist + CPANPLUS::Dist::Autobundle + CPANPLUS::Dist::Base + CPANPLUS::Dist::Build + CPANPLUS::Dist::Build::Constants + CPANPLUS::Dist::MM + CPANPLUS::Dist::Sample + CPANPLUS::Error + CPANPLUS::Internals + CPANPLUS::Internals::Constants + CPANPLUS::Internals::Constants::Report + CPANPLUS::Internals::Extract + CPANPLUS::Internals::Fetch + CPANPLUS::Internals::Report + CPANPLUS::Internals::Search + CPANPLUS::Internals::Source + CPANPLUS::Internals::Source::Memory + CPANPLUS::Internals::Source::SQLite + CPANPLUS::Internals::Source::SQLite::Tie + CPANPLUS::Internals::Utils + CPANPLUS::Internals::Utils::Autoflush + CPANPLUS::Module + CPANPLUS::Module::Author + CPANPLUS::Module::Author::Fake + CPANPLUS::Module::Checksums + CPANPLUS::Module::Fake + CPANPLUS::Module::Signature + CPANPLUS::Selfupdate + CPANPLUS::Shell + CPANPLUS::Shell::Classic + CPANPLUS::Shell::Default + CPANPLUS::Shell::Default::Plugins::CustomSource + CPANPLUS::Shell::Default::Plugins::Remote + CPANPLUS::Shell::Default::Plugins::Source + Devel::InnerPackage + File::CheckTree + Log::Message + Log::Message::Config + Log::Message::Handlers + Log::Message::Item + Log::Message::Simple + Module::Pluggable + Module::Pluggable::Object + Object::Accessor + Pod::LaTeX + Term::UI + Term::UI::History + Text::Soundex + /} + }, + 5.019001 => { + delta_from => 5.019, + changed => { + }, + removed => { + } + }, + 5.019002 => { + delta_from => 5.019001, + changed => { + }, + removed => { + } + }, + 5.019003 => { + delta_from => 5.019002, + changed => { + }, + removed => { + } + }, + 5.019004 => { + delta_from => 5.019003, + changed => { + 'Module::Build::Base' => '1', + 'Module::Build::Compat' => '1', + 'Module::Build::Config' => '1', + 'Module::Build::ConfigData'=> '1', + 'Module::Build::Cookbook'=> '1', + 'Module::Build::Dumper' => '1', + 'Module::Build::ModuleInfo'=> '1', + 'Module::Build::Notes' => '1', + 'Module::Build::PPMMaker'=> '1', + 'Module::Build::Platform::Default'=> '1', + 'Module::Build::Platform::MacOS'=> '1', + 'Module::Build::Platform::Unix'=> '1', + 'Module::Build::Platform::VMS'=> '1', + 'Module::Build::Platform::VOS'=> '1', + 'Module::Build::Platform::Windows'=> '1', + 'Module::Build::Platform::aix'=> '1', + 'Module::Build::Platform::cygwin'=> '1', + 'Module::Build::Platform::darwin'=> '1', + 'Module::Build::Platform::os2'=> '1', + 'Module::Build::PodParser'=> '1', + 'Module::Build::Version'=> '1', + 'Module::Build::YAML' => '1', + 'inc::latest' => '1', + }, + removed => { + } + }, + 5.019005 => { + delta_from => 5.019004, + changed => { + }, + removed => { + } + }, + 5.019006 => { + delta_from => 5.019005, + changed => { + 'Package::Constants' => '1', + }, + removed => { + } + }, + 5.019007 => { + delta_from => 5.019006, + changed => { + 'CGI' => '1', + 'CGI::Apache' => '1', + 'CGI::Carp' => '1', + 'CGI::Cookie' => '1', + 'CGI::Fast' => '1', + 'CGI::Pretty' => '1', + 'CGI::Push' => '1', + 'CGI::Switch' => '1', + 'CGI::Util' => '1', + }, + removed => { + } + }, + 5.019008 => { + delta_from => 5.019007, + changed => { + }, + removed => { + } + }, + 5.019009 => { + delta_from => 5.019008, + changed => { + }, + removed => { + } + }, + 5.01901 => { + delta_from => 5.019009, + changed => { + }, + removed => { + } + }, + 5.019011 => { + delta_from => 5.019010, + changed => { + }, + removed => { + } + }, + 5.020000 => { + delta_from => 5.019011, + changed => { + }, + removed => { + } + }, + 5.021000 => { + delta_from => 5.020000, + changed => { + }, + removed => { + 'CGI' => 1, + 'CGI::Apache' => 1, + 'CGI::Carp' => 1, + 'CGI::Cookie' => 1, + 'CGI::Fast' => 1, + 'CGI::Pretty' => 1, + 'CGI::Push' => 1, + 'CGI::Switch' => 1, + 'CGI::Util' => 1, + 'Module::Build' => 1, + 'Module::Build::Base' => 1, + 'Module::Build::Compat' => 1, + 'Module::Build::Config' => 1, + 'Module::Build::ConfigData'=> 1, + 'Module::Build::Cookbook'=> 1, + 'Module::Build::Dumper' => 1, + 'Module::Build::ModuleInfo'=> 1, + 'Module::Build::Notes' => 1, + 'Module::Build::PPMMaker'=> 1, + 'Module::Build::Platform::Default'=> 1, + 'Module::Build::Platform::MacOS'=> 1, + 'Module::Build::Platform::Unix'=> 1, + 'Module::Build::Platform::VMS'=> 1, + 'Module::Build::Platform::VOS'=> 1, + 'Module::Build::Platform::Windows'=> 1, + 'Module::Build::Platform::aix'=> 1, + 'Module::Build::Platform::cygwin'=> 1, + 'Module::Build::Platform::darwin'=> 1, + 'Module::Build::Platform::os2'=> 1, + 'Module::Build::PodParser'=> 1, + 'Module::Build::Version'=> 1, + 'Module::Build::YAML' => 1, + 'Package::Constants' => 1, + 'inc::latest' => 1, + } + }, + 5.021001 => { + delta_from => 5.021000, + changed => { + }, + removed => { + } + }, + 5.021002 => { + delta_from => 5.021001, + changed => { + }, + removed => { + } + }, + 5.021003 => { + delta_from => 5.021002, + changed => { + }, + removed => { + } + }, + 5.020001 => { + delta_from => 5.020000, + changed => { + }, + removed => { + } + }, + 5.021004 => { + delta_from => 5.021003, + changed => { + }, + removed => { + } + }, + 5.021005 => { + delta_from => 5.021004, + changed => { + }, + removed => { + } + }, + 5.021006 => { + delta_from => 5.021005, + changed => { + }, + removed => { + } + }, + 5.021007 => { + delta_from => 5.021006, + changed => { + }, + removed => { + } + }, + 5.021008 => { + delta_from => 5.021007, + changed => { + }, + removed => { + } + }, + 5.020002 => { + delta_from => 5.020001, + changed => { + }, + removed => { + } + }, + 5.021009 => { + delta_from => 5.021008, + changed => { + }, + removed => { + } + }, + 5.021010 => { + delta_from => 5.021009, + changed => { + }, + removed => { + } + }, + 5.021011 => { + delta_from => 5.02101, + changed => { + }, + removed => { + } + }, + 5.022000 => { + delta_from => 5.021011, + changed => { + }, + removed => { + } + }, + 5.023000 => { + delta_from => 5.022000, + changed => { + }, + removed => { + } + }, + 5.023001 => { + delta_from => 5.023000, + changed => { + }, + removed => { + } + }, + 5.023002 => { + delta_from => 5.023001, + changed => { + }, + removed => { + } + }, + 5.020003 => { + delta_from => 5.020002, + changed => { + }, + removed => { + } + }, + 5.023003 => { + delta_from => 5.023002, + changed => { + }, + removed => { + } + }, + 5.023004 => { + delta_from => 5.023003, + changed => { + }, + removed => { + } + }, + 5.023005 => { + delta_from => 5.023004, + changed => { + }, + removed => { + } + }, + 5.022001 => { + delta_from => 5.022, + changed => { + }, + removed => { + } + }, + 5.023006 => { + delta_from => 5.023005, + changed => { + }, + removed => { + } + }, + 5.023007 => { + delta_from => 5.023006, + changed => { + }, + removed => { + } + }, + 5.023008 => { + delta_from => 5.023007, + changed => { + }, + removed => { + } + }, + 5.023009 => { + delta_from => 5.023008, + changed => { + }, + removed => { + } + }, + 5.022002 => { + delta_from => 5.022001, + changed => { + }, + removed => { + } + }, + 5.024000 => { + delta_from => 5.023009, + changed => { + }, + removed => { + } + }, + 5.025000 => { + delta_from => 5.024, + changed => { + }, + removed => { + } + }, + 5.025001 => { + delta_from => 5.025, + changed => { + }, + removed => { + } + }, + 5.025002 => { + delta_from => 5.025001, + changed => { + }, + removed => { + } + }, + 5.025003 => { + delta_from => 5.025002, + changed => { + }, + removed => { + } + }, + 5.025004 => { + delta_from => 5.025003, + changed => { + }, + removed => { + } + }, + 5.025005 => { + delta_from => 5.025004, + changed => { + }, + removed => { + } + }, + 5.025006 => { + delta_from => 5.025005, + changed => { + }, + removed => { + } + }, + 5.025007 => { + delta_from => 5.025006, + changed => { + }, + removed => { + } + }, + 5.025008 => { + delta_from => 5.025007, + changed => { + }, + removed => { + } + }, + 5.022003 => { + delta_from => 5.022002, + changed => { + }, + removed => { + } + }, + 5.024001 => { + delta_from => 5.024000, + changed => { + }, + removed => { + } + }, + 5.025009 => { + delta_from => 5.025008, + changed => { + }, + removed => { + } + }, + 5.025010 => { + delta_from => 5.025009, + changed => { + }, + removed => { + } + }, + 5.025011 => { + delta_from => 5.025010, + changed => { + }, + removed => { + } + }, + 5.025012 => { + delta_from => 5.025011, + changed => { + }, + removed => { + } + }, + 5.026000 => { + delta_from => 5.025012, + changed => { + }, + removed => { + } + }, + 5.027000 => { + delta_from => 5.026, + changed => { + }, + removed => { + } + }, + 5.027001 => { + delta_from => 5.027, + changed => { + }, + removed => { + } + }, + 5.022004 => { + delta_from => 5.022003, + changed => { + }, + removed => { + } + }, + 5.024002 => { + delta_from => 5.024001, + changed => { + }, + removed => { + } + }, + 5.027002 => { + delta_from => 5.027001, + changed => { + }, + removed => { + } + }, + 5.027003 => { + delta_from => 5.027002, + changed => { + 'B::Debug' => '1', + }, + removed => { + } + }, + 5.027004 => { + delta_from => 5.027003, + changed => { + }, + removed => { + } + }, + 5.024003 => { + delta_from => 5.024002, + changed => { + }, + removed => { + } + }, + 5.026001 => { + delta_from => 5.026000, + changed => { + }, + removed => { + } + }, + 5.027005 => { + delta_from => 5.027004, + changed => { + }, + removed => { + } + }, + 5.027006 => { + delta_from => 5.027005, + changed => { + }, + removed => { + } + }, + 5.027007 => { + delta_from => 5.027006, + changed => { + }, + removed => { + } + }, + 5.027008 => { + delta_from => 5.027007, + changed => { + }, + removed => { + } + }, + 5.027009 => { + delta_from => 5.027008, + changed => { + }, + removed => { + } + }, + 5.027010 => { + delta_from => 5.027009, + changed => { + }, + removed => { + } + }, + 5.024004 => { + delta_from => 5.024003, + changed => { + }, + removed => { + } + }, + 5.026002 => { + delta_from => 5.026001, + changed => { + }, + removed => { + } + }, + 5.027011 => { + delta_from => 5.02701, + changed => { + }, + removed => { + } + }, + 5.028000 => { + delta_from => 5.027011, + changed => { + }, + removed => { + } + }, + 5.029000 => { + delta_from => 5.028, + changed => { + }, + removed => { + } + }, + 5.029001 => { + delta_from => 5.029, + changed => { + }, + removed => { + } + }, + 5.029002 => { + delta_from => 5.029001, + changed => { + }, + removed => { + } + }, + 5.029003 => { + delta_from => 5.029002, + changed => { + }, + removed => { + } + }, + 5.029004 => { + delta_from => 5.029003, + changed => { + }, + removed => { + arybase => '1', + } + }, + 5.029005 => { + delta_from => 5.027002, + changed => { + }, + removed => { + } + }, + 5.026003 => { + delta_from => 5.026002, + changed => { + }, + removed => { + } + }, + 5.028001 => { + delta_from => 5.028000, + changed => { + }, + removed => { + } + }, + 5.029006 => { + delta_from => 5.029005, + changed => { + }, + removed => { + } + }, + 5.029007 => { + delta_from => 5.029006, + changed => { + }, + removed => { + } + }, + 5.029008 => { + delta_from => 5.029007, + changed => { + }, + removed => { + } + }, + 5.029009 => { + delta_from => 5.029008, + changed => { + }, + removed => { + } + }, + 5.028002 => { + delta_from => 5.028001, + changed => { + }, + removed => { + } + }, + 5.029010 => { + delta_from => 5.029009, + changed => { + }, + removed => { + } + }, + 5.030000 => { + delta_from => 5.02901, + changed => { + }, + removed => { + } + }, + 5.031000 => { + delta_from => 5.030000, + changed => { + }, + removed => { + } + }, + 5.031001 => { + delta_from => 5.031000, + changed => { + }, + removed => { + } + }, + 5.031002 => { + delta_from => 5.031001, + changed => { + }, + removed => { + } + }, + 5.031003 => { + delta_from => 5.031002, + changed => { + }, + removed => { + } + }, + 5.031004 => { + delta_from => 5.031003, + changed => { + }, + removed => { + } + }, + 5.031005 => { + delta_from => 5.031004, + changed => { + }, + removed => { + } + }, + 5.030001 => { + delta_from => 5.030000, + changed => { + }, + removed => { + } + }, + 5.031006 => { + delta_from => 5.031005, + changed => { + }, + removed => { + } + }, + 5.031007 => { + delta_from => 5.031006, + changed => { + }, + removed => { + } + }, + 5.031008 => { + delta_from => 5.031007, + changed => { + }, + removed => { + } + }, + 5.031009 => { + delta_from => 5.031008, + changed => { + }, + removed => { + } + }, + 5.030002 => { + delta_from => 5.030001, + changed => { + }, + removed => { + } + }, + 5.031010 => { + delta_from => 5.031009, + changed => { + }, + removed => { + } + }, + 5.031011 => { + delta_from => 5.03101, + changed => { + }, + removed => { + } + }, + 5.028003 => { + delta_from => 5.028002, + changed => { + }, + removed => { + } + }, + 5.030003 => { + delta_from => 5.030002, + changed => { + }, + removed => { + } + }, + 5.032000 => { + delta_from => 5.031011, + changed => { + }, + removed => { + } + }, + 5.033000 => { + delta_from => 5.032, + changed => { + }, + removed => { + } + }, + 5.033001 => { + delta_from => 5.033000, + changed => { + }, + removed => { + } + }, + 5.033002 => { + delta_from => 5.033001, + changed => { + }, + removed => { + } + }, + 5.033003 => { + delta_from => 5.033002, + changed => { + }, + removed => { + } + }, + 5.033004 => { + delta_from => 5.033003, + changed => { + }, + removed => { + } + }, + 5.033005 => { + delta_from => 5.033004, + changed => { + }, + removed => { + } + }, + 5.033006 => { + delta_from => 5.033005, + changed => { + }, + removed => { + } + }, + 5.032001 => { + delta_from => 5.032, + changed => { + }, + removed => { + } + }, +); + +%deprecated = _undelta(\%deprecated); + +%upstream = ( + 'App::Cpan' => 'cpan', + 'App::Prove' => 'cpan', + 'App::Prove::State' => 'cpan', + 'App::Prove::State::Result'=> 'cpan', + 'App::Prove::State::Result::Test'=> 'cpan', + 'Archive::Tar' => 'cpan', + 'Archive::Tar::Constant'=> 'cpan', + 'Archive::Tar::File' => 'cpan', + 'AutoLoader' => 'cpan', + 'AutoSplit' => 'cpan', + 'CPAN' => 'cpan', + 'CPAN::Author' => 'cpan', + 'CPAN::Bundle' => 'cpan', + 'CPAN::CacheMgr' => 'cpan', + 'CPAN::Complete' => 'cpan', + 'CPAN::Debug' => 'cpan', + 'CPAN::DeferredCode' => 'cpan', + 'CPAN::Distribution' => 'cpan', + 'CPAN::Distroprefs' => 'cpan', + 'CPAN::Distrostatus' => 'cpan', + 'CPAN::Exception::RecursiveDependency'=> 'cpan', + 'CPAN::Exception::blocked_urllist'=> 'cpan', + 'CPAN::Exception::yaml_not_installed'=> 'cpan', + 'CPAN::Exception::yaml_process_error'=> 'cpan', + 'CPAN::FTP' => 'cpan', + 'CPAN::FTP::netrc' => 'cpan', + 'CPAN::FirstTime' => 'cpan', + 'CPAN::HTTP::Client' => 'cpan', + 'CPAN::HTTP::Credentials'=> 'cpan', + 'CPAN::HandleConfig' => 'cpan', + 'CPAN::Index' => 'cpan', + 'CPAN::InfoObj' => 'cpan', + 'CPAN::Kwalify' => 'cpan', + 'CPAN::LWP::UserAgent' => 'cpan', + 'CPAN::Meta' => 'cpan', + 'CPAN::Meta::Converter' => 'cpan', + 'CPAN::Meta::Feature' => 'cpan', + 'CPAN::Meta::History' => 'cpan', + 'CPAN::Meta::Merge' => 'cpan', + 'CPAN::Meta::Prereqs' => 'cpan', + 'CPAN::Meta::Requirements'=> 'cpan', + 'CPAN::Meta::Spec' => 'cpan', + 'CPAN::Meta::Validator' => 'cpan', + 'CPAN::Meta::YAML' => 'cpan', + 'CPAN::Mirrors' => 'cpan', + 'CPAN::Module' => 'cpan', + 'CPAN::Nox' => 'cpan', + 'CPAN::Plugin' => 'cpan', + 'CPAN::Plugin::Specfile'=> 'cpan', + 'CPAN::Prompt' => 'cpan', + 'CPAN::Queue' => 'cpan', + 'CPAN::Shell' => 'cpan', + 'CPAN::Tarzip' => 'cpan', + 'CPAN::URL' => 'cpan', + 'CPAN::Version' => 'cpan', + 'Compress::Raw::Bzip2' => 'cpan', + 'Compress::Raw::Zlib' => 'cpan', + 'Compress::Zlib' => 'cpan', + 'Config::Perl::V' => 'cpan', + 'DB_File' => 'cpan', + 'Digest' => 'cpan', + 'Digest::MD5' => 'cpan', + 'Digest::SHA' => 'cpan', + 'Digest::base' => 'cpan', + 'Digest::file' => 'cpan', + 'Encode' => 'cpan', + 'Encode::Alias' => 'cpan', + 'Encode::Byte' => 'cpan', + 'Encode::CJKConstants' => 'cpan', + 'Encode::CN' => 'cpan', + 'Encode::CN::HZ' => 'cpan', + 'Encode::Config' => 'cpan', + 'Encode::EBCDIC' => 'cpan', + 'Encode::Encoder' => 'cpan', + 'Encode::Encoding' => 'cpan', + 'Encode::GSM0338' => 'cpan', + 'Encode::Guess' => 'cpan', + 'Encode::JP' => 'cpan', + 'Encode::JP::H2Z' => 'cpan', + 'Encode::JP::JIS7' => 'cpan', + 'Encode::KR' => 'cpan', + 'Encode::KR::2022_KR' => 'cpan', + 'Encode::MIME::Header' => 'cpan', + 'Encode::MIME::Header::ISO_2022_JP'=> 'cpan', + 'Encode::MIME::Name' => 'cpan', + 'Encode::Symbol' => 'cpan', + 'Encode::TW' => 'cpan', + 'Encode::Unicode' => 'cpan', + 'Encode::Unicode::UTF7' => 'cpan', + 'ExtUtils::Command' => 'cpan', + 'ExtUtils::Command::MM' => 'cpan', + 'ExtUtils::Constant' => 'cpan', + 'ExtUtils::Constant::Base'=> 'cpan', + 'ExtUtils::Constant::ProxySubs'=> 'cpan', + 'ExtUtils::Constant::Utils'=> 'cpan', + 'ExtUtils::Constant::XS'=> 'cpan', + 'ExtUtils::Install' => 'cpan', + 'ExtUtils::Installed' => 'cpan', + 'ExtUtils::Liblist' => 'cpan', + 'ExtUtils::Liblist::Kid'=> 'cpan', + 'ExtUtils::MM' => 'cpan', + 'ExtUtils::MM_AIX' => 'cpan', + 'ExtUtils::MM_Any' => 'cpan', + 'ExtUtils::MM_BeOS' => 'cpan', + 'ExtUtils::MM_Cygwin' => 'cpan', + 'ExtUtils::MM_DOS' => 'cpan', + 'ExtUtils::MM_Darwin' => 'cpan', + 'ExtUtils::MM_MacOS' => 'cpan', + 'ExtUtils::MM_NW5' => 'cpan', + 'ExtUtils::MM_OS2' => 'cpan', + 'ExtUtils::MM_QNX' => 'cpan', + 'ExtUtils::MM_UWIN' => 'cpan', + 'ExtUtils::MM_Unix' => 'cpan', + 'ExtUtils::MM_VMS' => 'cpan', + 'ExtUtils::MM_VOS' => 'cpan', + 'ExtUtils::MM_Win32' => 'cpan', + 'ExtUtils::MM_Win95' => 'cpan', + 'ExtUtils::MY' => 'cpan', + 'ExtUtils::MakeMaker' => 'cpan', + 'ExtUtils::MakeMaker::Config'=> 'cpan', + 'ExtUtils::MakeMaker::Locale'=> 'cpan', + 'ExtUtils::MakeMaker::version'=> 'cpan', + 'ExtUtils::MakeMaker::version::regex'=> 'cpan', + 'ExtUtils::Manifest' => 'cpan', + 'ExtUtils::Mkbootstrap' => 'cpan', + 'ExtUtils::Mksymlists' => 'cpan', + 'ExtUtils::Packlist' => 'cpan', + 'ExtUtils::testlib' => 'cpan', + 'Fatal' => 'cpan', + 'File::Fetch' => 'cpan', + 'File::GlobMapper' => 'cpan', + 'File::Path' => 'cpan', + 'File::Temp' => 'cpan', + 'Filter::Util::Call' => 'cpan', + 'Getopt::Long' => 'cpan', + 'HTTP::Tiny' => 'cpan', + 'IO::Compress::Adapter::Bzip2'=> 'cpan', + 'IO::Compress::Adapter::Deflate'=> 'cpan', + 'IO::Compress::Adapter::Identity'=> 'cpan', + 'IO::Compress::Base' => 'cpan', + 'IO::Compress::Base::Common'=> 'cpan', + 'IO::Compress::Bzip2' => 'cpan', + 'IO::Compress::Deflate' => 'cpan', + 'IO::Compress::Gzip' => 'cpan', + 'IO::Compress::Gzip::Constants'=> 'cpan', + 'IO::Compress::RawDeflate'=> 'cpan', + 'IO::Compress::Zip' => 'cpan', + 'IO::Compress::Zip::Constants'=> 'cpan', + 'IO::Compress::Zlib::Constants'=> 'cpan', + 'IO::Compress::Zlib::Extra'=> 'cpan', + 'IO::Socket::IP' => 'cpan', + 'IO::Uncompress::Adapter::Bunzip2'=> 'cpan', + 'IO::Uncompress::Adapter::Identity'=> 'cpan', + 'IO::Uncompress::Adapter::Inflate'=> 'cpan', + 'IO::Uncompress::AnyInflate'=> 'cpan', + 'IO::Uncompress::AnyUncompress'=> 'cpan', + 'IO::Uncompress::Base' => 'cpan', + 'IO::Uncompress::Bunzip2'=> 'cpan', + 'IO::Uncompress::Gunzip'=> 'cpan', + 'IO::Uncompress::Inflate'=> 'cpan', + 'IO::Uncompress::RawInflate'=> 'cpan', + 'IO::Uncompress::Unzip' => 'cpan', + 'IO::Zlib' => 'cpan', + 'IPC::Cmd' => 'cpan', + 'IPC::Msg' => 'cpan', + 'IPC::Semaphore' => 'cpan', + 'IPC::SharedMem' => 'cpan', + 'IPC::SysV' => 'cpan', + 'JSON::PP' => 'cpan', + 'JSON::PP::Boolean' => 'cpan', + 'List::Util' => 'cpan', + 'List::Util::XS' => 'cpan', + 'Locale::Maketext::Simple'=> 'cpan', + 'MIME::Base64' => 'cpan', + 'MIME::QuotedPrint' => 'cpan', + 'Math::BigFloat' => 'cpan', + 'Math::BigFloat::Trace' => 'cpan', + 'Math::BigInt' => 'cpan', + 'Math::BigInt::Calc' => 'cpan', + 'Math::BigInt::FastCalc'=> 'cpan', + 'Math::BigInt::Lib' => 'cpan', + 'Math::BigInt::Trace' => 'cpan', + 'Math::BigRat' => 'cpan', + 'Math::Complex' => 'cpan', + 'Math::Trig' => 'cpan', + 'Memoize' => 'cpan', + 'Memoize::AnyDBM_File' => 'cpan', + 'Memoize::Expire' => 'cpan', + 'Memoize::ExpireFile' => 'cpan', + 'Memoize::ExpireTest' => 'cpan', + 'Memoize::NDBM_File' => 'cpan', + 'Memoize::SDBM_File' => 'cpan', + 'Memoize::Storable' => 'cpan', + 'Module::Load' => 'cpan', + 'Module::Load::Conditional'=> 'cpan', + 'Module::Loaded' => 'cpan', + 'Module::Metadata' => 'cpan', + 'NEXT' => 'cpan', + 'Net::Cmd' => 'cpan', + 'Net::Config' => 'cpan', + 'Net::Domain' => 'cpan', + 'Net::FTP' => 'cpan', + 'Net::FTP::A' => 'cpan', + 'Net::FTP::E' => 'cpan', + 'Net::FTP::I' => 'cpan', + 'Net::FTP::L' => 'cpan', + 'Net::FTP::dataconn' => 'cpan', + 'Net::NNTP' => 'cpan', + 'Net::Netrc' => 'cpan', + 'Net::POP3' => 'cpan', + 'Net::SMTP' => 'cpan', + 'Net::Time' => 'cpan', + 'Params::Check' => 'cpan', + 'Parse::CPAN::Meta' => 'cpan', + 'Perl::OSType' => 'cpan', + 'PerlIO::via::QuotedPrint'=> 'cpan', + 'Pod::Checker' => 'cpan', + 'Pod::Escapes' => 'cpan', + 'Pod::Man' => 'cpan', + 'Pod::ParseLink' => 'cpan', + 'Pod::Perldoc' => 'cpan', + 'Pod::Perldoc::BaseTo' => 'cpan', + 'Pod::Perldoc::GetOptsOO'=> 'cpan', + 'Pod::Perldoc::ToANSI' => 'cpan', + 'Pod::Perldoc::ToChecker'=> 'cpan', + 'Pod::Perldoc::ToMan' => 'cpan', + 'Pod::Perldoc::ToNroff' => 'cpan', + 'Pod::Perldoc::ToPod' => 'cpan', + 'Pod::Perldoc::ToRtf' => 'cpan', + 'Pod::Perldoc::ToTerm' => 'cpan', + 'Pod::Perldoc::ToText' => 'cpan', + 'Pod::Perldoc::ToTk' => 'cpan', + 'Pod::Perldoc::ToXml' => 'cpan', + 'Pod::Simple' => 'cpan', + 'Pod::Simple::BlackBox' => 'cpan', + 'Pod::Simple::Checker' => 'cpan', + 'Pod::Simple::Debug' => 'cpan', + 'Pod::Simple::DumpAsText'=> 'cpan', + 'Pod::Simple::DumpAsXML'=> 'cpan', + 'Pod::Simple::HTML' => 'cpan', + 'Pod::Simple::HTMLBatch'=> 'cpan', + 'Pod::Simple::HTMLLegacy'=> 'cpan', + 'Pod::Simple::JustPod' => 'cpan', + 'Pod::Simple::LinkSection'=> 'cpan', + 'Pod::Simple::Methody' => 'cpan', + 'Pod::Simple::Progress' => 'cpan', + 'Pod::Simple::PullParser'=> 'cpan', + 'Pod::Simple::PullParserEndToken'=> 'cpan', + 'Pod::Simple::PullParserStartToken'=> 'cpan', + 'Pod::Simple::PullParserTextToken'=> 'cpan', + 'Pod::Simple::PullParserToken'=> 'cpan', + 'Pod::Simple::RTF' => 'cpan', + 'Pod::Simple::Search' => 'cpan', + 'Pod::Simple::SimpleTree'=> 'cpan', + 'Pod::Simple::Text' => 'cpan', + 'Pod::Simple::TextContent'=> 'cpan', + 'Pod::Simple::TiedOutFH'=> 'cpan', + 'Pod::Simple::Transcode'=> 'cpan', + 'Pod::Simple::TranscodeDumb'=> 'cpan', + 'Pod::Simple::TranscodeSmart'=> 'cpan', + 'Pod::Simple::XHTML' => 'cpan', + 'Pod::Simple::XMLOutStream'=> 'cpan', + 'Pod::Text' => 'cpan', + 'Pod::Text::Color' => 'cpan', + 'Pod::Text::Overstrike' => 'cpan', + 'Pod::Text::Termcap' => 'cpan', + 'Pod::Usage' => 'cpan', + 'Scalar::Util' => 'cpan', + 'Socket' => 'cpan', + 'Sub::Util' => 'cpan', + 'Sys::Syslog' => 'cpan', + 'Sys::Syslog::Win32' => 'cpan', + 'TAP::Base' => 'cpan', + 'TAP::Formatter::Base' => 'cpan', + 'TAP::Formatter::Color' => 'cpan', + 'TAP::Formatter::Console'=> 'cpan', + 'TAP::Formatter::Console::ParallelSession'=> 'cpan', + 'TAP::Formatter::Console::Session'=> 'cpan', + 'TAP::Formatter::File' => 'cpan', + 'TAP::Formatter::File::Session'=> 'cpan', + 'TAP::Formatter::Session'=> 'cpan', + 'TAP::Harness' => 'cpan', + 'TAP::Harness::Env' => 'cpan', + 'TAP::Object' => 'cpan', + 'TAP::Parser' => 'cpan', + 'TAP::Parser::Aggregator'=> 'cpan', + 'TAP::Parser::Grammar' => 'cpan', + 'TAP::Parser::Iterator' => 'cpan', + 'TAP::Parser::Iterator::Array'=> 'cpan', + 'TAP::Parser::Iterator::Process'=> 'cpan', + 'TAP::Parser::Iterator::Stream'=> 'cpan', + 'TAP::Parser::IteratorFactory'=> 'cpan', + 'TAP::Parser::Multiplexer'=> 'cpan', + 'TAP::Parser::Result' => 'cpan', + 'TAP::Parser::Result::Bailout'=> 'cpan', + 'TAP::Parser::Result::Comment'=> 'cpan', + 'TAP::Parser::Result::Plan'=> 'cpan', + 'TAP::Parser::Result::Pragma'=> 'cpan', + 'TAP::Parser::Result::Test'=> 'cpan', + 'TAP::Parser::Result::Unknown'=> 'cpan', + 'TAP::Parser::Result::Version'=> 'cpan', + 'TAP::Parser::Result::YAML'=> 'cpan', + 'TAP::Parser::ResultFactory'=> 'cpan', + 'TAP::Parser::Scheduler'=> 'cpan', + 'TAP::Parser::Scheduler::Job'=> 'cpan', + 'TAP::Parser::Scheduler::Spinner'=> 'cpan', + 'TAP::Parser::Source' => 'cpan', + 'TAP::Parser::SourceHandler'=> 'cpan', + 'TAP::Parser::SourceHandler::Executable'=> 'cpan', + 'TAP::Parser::SourceHandler::File'=> 'cpan', + 'TAP::Parser::SourceHandler::Handle'=> 'cpan', + 'TAP::Parser::SourceHandler::Perl'=> 'cpan', + 'TAP::Parser::SourceHandler::RawTAP'=> 'cpan', + 'TAP::Parser::YAMLish::Reader'=> 'cpan', + 'TAP::Parser::YAMLish::Writer'=> 'cpan', + 'Term::ANSIColor' => 'cpan', + 'Term::Cap' => 'cpan', + 'Test2' => 'cpan', + 'Test2::API' => 'cpan', + 'Test2::API::Breakage' => 'cpan', + 'Test2::API::Context' => 'cpan', + 'Test2::API::Instance' => 'cpan', + 'Test2::API::Stack' => 'cpan', + 'Test2::Event' => 'cpan', + 'Test2::Event::Bail' => 'cpan', + 'Test2::Event::Diag' => 'cpan', + 'Test2::Event::Encoding'=> 'cpan', + 'Test2::Event::Exception'=> 'cpan', + 'Test2::Event::Fail' => 'cpan', + 'Test2::Event::Generic' => 'cpan', + 'Test2::Event::Note' => 'cpan', + 'Test2::Event::Ok' => 'cpan', + 'Test2::Event::Pass' => 'cpan', + 'Test2::Event::Plan' => 'cpan', + 'Test2::Event::Skip' => 'cpan', + 'Test2::Event::Subtest' => 'cpan', + 'Test2::Event::TAP::Version'=> 'cpan', + 'Test2::Event::V2' => 'cpan', + 'Test2::Event::Waiting' => 'cpan', + 'Test2::EventFacet' => 'cpan', + 'Test2::EventFacet::About'=> 'cpan', + 'Test2::EventFacet::Amnesty'=> 'cpan', + 'Test2::EventFacet::Assert'=> 'cpan', + 'Test2::EventFacet::Control'=> 'cpan', + 'Test2::EventFacet::Error'=> 'cpan', + 'Test2::EventFacet::Hub'=> 'cpan', + 'Test2::EventFacet::Info'=> 'cpan', + 'Test2::EventFacet::Info::Table'=> 'cpan', + 'Test2::EventFacet::Meta'=> 'cpan', + 'Test2::EventFacet::Parent'=> 'cpan', + 'Test2::EventFacet::Plan'=> 'cpan', + 'Test2::EventFacet::Render'=> 'cpan', + 'Test2::EventFacet::Trace'=> 'cpan', + 'Test2::Formatter' => 'cpan', + 'Test2::Formatter::TAP' => 'cpan', + 'Test2::Hub' => 'cpan', + 'Test2::Hub::Interceptor'=> 'cpan', + 'Test2::Hub::Interceptor::Terminator'=> 'cpan', + 'Test2::Hub::Subtest' => 'cpan', + 'Test2::IPC' => 'cpan', + 'Test2::IPC::Driver' => 'cpan', + 'Test2::IPC::Driver::Files'=> 'cpan', + 'Test2::Tools::Tiny' => 'cpan', + 'Test2::Util' => 'cpan', + 'Test2::Util::ExternalMeta'=> 'cpan', + 'Test2::Util::Facets2Legacy'=> 'cpan', + 'Test2::Util::HashBase' => 'cpan', + 'Test2::Util::Trace' => 'cpan', + 'Test::Builder' => 'cpan', + 'Test::Builder::Formatter'=> 'cpan', + 'Test::Builder::IO::Scalar'=> 'cpan', + 'Test::Builder::Module' => 'cpan', + 'Test::Builder::Tester' => 'cpan', + 'Test::Builder::Tester::Color'=> 'cpan', + 'Test::Builder::TodoDiag'=> 'cpan', + 'Test::Harness' => 'cpan', + 'Test::More' => 'cpan', + 'Test::Simple' => 'cpan', + 'Test::Tester' => 'cpan', + 'Test::Tester::Capture' => 'cpan', + 'Test::Tester::CaptureRunner'=> 'cpan', + 'Test::Tester::Delegate'=> 'cpan', + 'Test::use::ok' => 'cpan', + 'Text::Balanced' => 'cpan', + 'Text::ParseWords' => 'cpan', + 'Text::Tabs' => 'cpan', + 'Text::Wrap' => 'cpan', + 'Tie::RefHash' => 'cpan', + 'Time::Local' => 'cpan', + 'Time::Piece' => 'cpan', + 'Time::Seconds' => 'cpan', + 'Unicode::Collate' => 'cpan', + 'Unicode::Collate::CJK::Big5'=> 'cpan', + 'Unicode::Collate::CJK::GB2312'=> 'cpan', + 'Unicode::Collate::CJK::JISX0208'=> 'cpan', + 'Unicode::Collate::CJK::Korean'=> 'cpan', + 'Unicode::Collate::CJK::Pinyin'=> 'cpan', + 'Unicode::Collate::CJK::Stroke'=> 'cpan', + 'Unicode::Collate::CJK::Zhuyin'=> 'cpan', + 'Unicode::Collate::Locale'=> 'cpan', + 'Win32' => 'cpan', + 'Win32API::File' => 'cpan', + 'autodie' => 'cpan', + 'autodie::Scope::Guard' => 'cpan', + 'autodie::Scope::GuardStack'=> 'cpan', + 'autodie::Util' => 'cpan', + 'autodie::exception' => 'cpan', + 'autodie::exception::system'=> 'cpan', + 'autodie::hints' => 'cpan', + 'autodie::skip' => 'cpan', + 'bigint' => 'cpan', + 'bignum' => 'cpan', + 'bigrat' => 'cpan', + 'encoding' => 'cpan', + 'experimental' => 'cpan', + 'ok' => 'cpan', + 'parent' => 'cpan', + 'perlfaq' => 'cpan', + 'version' => 'cpan', + 'version::regex' => 'cpan', +); + +%bug_tracker = ( + 'App::Cpan' => undef, + 'App::Prove' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'App::Prove::State' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'App::Prove::State::Result'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'App::Prove::State::Result::Test'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'Archive::Tar' => undef, + 'Archive::Tar::Constant'=> undef, + 'Archive::Tar::File' => undef, + 'CPAN' => undef, + 'CPAN::Author' => undef, + 'CPAN::Bundle' => undef, + 'CPAN::CacheMgr' => undef, + 'CPAN::Complete' => undef, + 'CPAN::Debug' => undef, + 'CPAN::DeferredCode' => undef, + 'CPAN::Distribution' => undef, + 'CPAN::Distroprefs' => undef, + 'CPAN::Distrostatus' => undef, + 'CPAN::Exception::RecursiveDependency'=> undef, + 'CPAN::Exception::blocked_urllist'=> undef, + 'CPAN::Exception::yaml_not_installed'=> undef, + 'CPAN::Exception::yaml_process_error'=> undef, + 'CPAN::FTP' => undef, + 'CPAN::FTP::netrc' => undef, + 'CPAN::FirstTime' => undef, + 'CPAN::HTTP::Client' => undef, + 'CPAN::HTTP::Credentials'=> undef, + 'CPAN::HandleConfig' => undef, + 'CPAN::Index' => undef, + 'CPAN::InfoObj' => undef, + 'CPAN::Kwalify' => undef, + 'CPAN::LWP::UserAgent' => undef, + 'CPAN::Meta' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Converter' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Feature' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::History' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Merge' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Prereqs' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Requirements'=> 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues', + 'CPAN::Meta::Spec' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::Validator' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'CPAN::Meta::YAML' => 'https://github.com/Perl-Toolchain-Gang/YAML-Tiny/issues', + 'CPAN::Mirrors' => undef, + 'CPAN::Module' => undef, + 'CPAN::Nox' => undef, + 'CPAN::Plugin' => undef, + 'CPAN::Plugin::Specfile'=> undef, + 'CPAN::Prompt' => undef, + 'CPAN::Queue' => undef, + 'CPAN::Shell' => undef, + 'CPAN::Tarzip' => undef, + 'CPAN::URL' => undef, + 'CPAN::Version' => undef, + 'Compress::Raw::Bzip2' => 'https://github.com/pmqs/Compress-Raw-Bzip2/issues', + 'Compress::Raw::Zlib' => 'https://github.com/pmqs/Compress-Raw-Zlib/issues', + 'Compress::Zlib' => 'https://github.com/pmqs/IO-Compress/issues', + 'Config::Perl::V' => 'https://github.com/Tux/Config-Perl-V/issues', + 'DB_File' => 'https://github.com/pmqs/DB_File/issues', + 'Digest' => 'https://github.com/Dual-Life/digest/issues', + 'Digest::MD5' => 'https://github.com/Dual-Life/digest-md5/issues', + 'Digest::SHA' => undef, + 'Digest::base' => 'https://github.com/Dual-Life/digest/issues', + 'Digest::file' => 'https://github.com/Dual-Life/digest/issues', + 'Encode' => undef, + 'Encode::Alias' => undef, + 'Encode::Byte' => undef, + 'Encode::CJKConstants' => undef, + 'Encode::CN' => undef, + 'Encode::CN::HZ' => undef, + 'Encode::Config' => undef, + 'Encode::EBCDIC' => undef, + 'Encode::Encoder' => undef, + 'Encode::Encoding' => undef, + 'Encode::GSM0338' => undef, + 'Encode::Guess' => undef, + 'Encode::JP' => undef, + 'Encode::JP::H2Z' => undef, + 'Encode::JP::JIS7' => undef, + 'Encode::KR' => undef, + 'Encode::KR::2022_KR' => undef, + 'Encode::MIME::Header' => undef, + 'Encode::MIME::Header::ISO_2022_JP'=> undef, + 'Encode::MIME::Name' => undef, + 'Encode::Symbol' => undef, + 'Encode::TW' => undef, + 'Encode::Unicode' => undef, + 'Encode::Unicode::UTF7' => undef, + 'ExtUtils::Command' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Command::MM' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Constant' => undef, + 'ExtUtils::Constant::Base'=> undef, + 'ExtUtils::Constant::ProxySubs'=> undef, + 'ExtUtils::Constant::Utils'=> undef, + 'ExtUtils::Constant::XS'=> undef, + 'ExtUtils::Install' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-Install', + 'ExtUtils::Installed' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-Install', + 'ExtUtils::Liblist' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Liblist::Kid'=> 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_AIX' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Any' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_BeOS' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Cygwin' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_DOS' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Darwin' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_MacOS' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_NW5' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_OS2' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_QNX' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_UWIN' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Unix' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_VMS' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_VOS' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Win32' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MM_Win95' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MY' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MakeMaker' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MakeMaker::Config'=> 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MakeMaker::Locale'=> 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MakeMaker::version'=> 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::MakeMaker::version::regex'=> 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Manifest' => 'http://github.com/Perl-Toolchain-Gang/ExtUtils-Manifest/issues', + 'ExtUtils::Mkbootstrap' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Mksymlists' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'ExtUtils::Packlist' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-Install', + 'ExtUtils::testlib' => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + 'Fatal' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'File::Fetch' => undef, + 'File::GlobMapper' => 'https://github.com/pmqs/IO-Compress/issues', + 'File::Path' => undef, + 'File::Temp' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=File-Temp', + 'Filter::Util::Call' => undef, + 'Getopt::Long' => undef, + 'HTTP::Tiny' => 'https://github.com/chansen/p5-http-tiny/issues', + 'IO::Compress::Adapter::Bzip2'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Adapter::Deflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Adapter::Identity'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Base' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Base::Common'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Bzip2' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Deflate' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Gzip' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Gzip::Constants'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::RawDeflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Zip' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Zip::Constants'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Zlib::Constants'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Compress::Zlib::Extra'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Socket::IP' => undef, + 'IO::Uncompress::Adapter::Bunzip2'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Adapter::Identity'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Adapter::Inflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::AnyInflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::AnyUncompress'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Base' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Bunzip2'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Gunzip'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Inflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::RawInflate'=> 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Uncompress::Unzip' => 'https://github.com/pmqs/IO-Compress/issues', + 'IO::Zlib' => 'https://github.com/tomhughes/IO-Zlib/issues', + 'IPC::Cmd' => undef, + 'IPC::Msg' => undef, + 'IPC::Semaphore' => undef, + 'IPC::SharedMem' => undef, + 'IPC::SysV' => undef, + 'JSON::PP' => 'https://github.com/makamaka/JSON-PP/issues', + 'JSON::PP::Boolean' => 'https://github.com/makamaka/JSON-PP/issues', + 'List::Util' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', + 'List::Util::XS' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', + 'Locale::Maketext::Simple'=> undef, + 'MIME::Base64' => 'https://github.com/Dual-Life/mime-base64/issues', + 'MIME::QuotedPrint' => 'https://github.com/Dual-Life/mime-base64/issues', + 'Math::BigFloat' => undef, + 'Math::BigFloat::Trace' => undef, + 'Math::BigInt' => undef, + 'Math::BigInt::Calc' => undef, + 'Math::BigInt::FastCalc'=> undef, + 'Math::BigInt::Lib' => undef, + 'Math::BigInt::Trace' => undef, + 'Math::BigRat' => undef, + 'Math::Complex' => undef, + 'Math::Trig' => undef, + 'Memoize' => undef, + 'Memoize::AnyDBM_File' => undef, + 'Memoize::Expire' => undef, + 'Memoize::ExpireFile' => undef, + 'Memoize::ExpireTest' => undef, + 'Memoize::NDBM_File' => undef, + 'Memoize::SDBM_File' => undef, + 'Memoize::Storable' => undef, + 'Module::Load' => undef, + 'Module::Load::Conditional'=> undef, + 'Module::Loaded' => undef, + 'Module::Metadata' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Metadata', + 'NEXT' => undef, + 'Net::Cmd' => undef, + 'Net::Config' => undef, + 'Net::Domain' => undef, + 'Net::FTP' => undef, + 'Net::FTP::A' => undef, + 'Net::FTP::E' => undef, + 'Net::FTP::I' => undef, + 'Net::FTP::L' => undef, + 'Net::FTP::dataconn' => undef, + 'Net::NNTP' => undef, + 'Net::Netrc' => undef, + 'Net::POP3' => undef, + 'Net::SMTP' => undef, + 'Net::Time' => undef, + 'Params::Check' => undef, + 'Parse::CPAN::Meta' => 'https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues', + 'Perl::OSType' => 'https://github.com/Perl-Toolchain-Gang/Perl-OSType/issues', + 'PerlIO::via::QuotedPrint'=> undef, + 'Pod::Checker' => undef, + 'Pod::Escapes' => undef, + 'Pod::Man' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::ParseLink' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Perldoc' => undef, + 'Pod::Perldoc::BaseTo' => undef, + 'Pod::Perldoc::GetOptsOO'=> undef, + 'Pod::Perldoc::ToANSI' => undef, + 'Pod::Perldoc::ToChecker'=> undef, + 'Pod::Perldoc::ToMan' => undef, + 'Pod::Perldoc::ToNroff' => undef, + 'Pod::Perldoc::ToPod' => undef, + 'Pod::Perldoc::ToRtf' => undef, + 'Pod::Perldoc::ToTerm' => undef, + 'Pod::Perldoc::ToText' => undef, + 'Pod::Perldoc::ToTk' => undef, + 'Pod::Perldoc::ToXml' => undef, + 'Pod::Simple' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::BlackBox' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Checker' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Debug' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::DumpAsText'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::DumpAsXML'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::HTML' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::HTMLBatch'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::HTMLLegacy'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::JustPod' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::LinkSection'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Methody' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Progress' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::PullParser'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::PullParserEndToken'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::PullParserStartToken'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::PullParserTextToken'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::PullParserToken'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::RTF' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Search' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::SimpleTree'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Text' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::TextContent'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::TiedOutFH'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::Transcode'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::TranscodeDumb'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::TranscodeSmart'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::XHTML' => 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Simple::XMLOutStream'=> 'https://github.com/perl-pod/pod-simple/issues', + 'Pod::Text' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Text::Color' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Text::Overstrike' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Text::Termcap' => 'https://rt.cpan.org/Dist/Display.html?Name=podlators', + 'Pod::Usage' => 'https://github.com/Dual-Life/Pod-Usage/issues', + 'Scalar::Util' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', + 'Socket' => undef, + 'Sub::Util' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Scalar-List-Utils', + 'Sys::Syslog' => undef, + 'Sys::Syslog::Win32' => undef, + 'TAP::Base' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Base' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Color' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Console'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Console::ParallelSession'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Console::Session'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::File' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::File::Session'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Formatter::Session'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Harness' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Harness::Env' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Object' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Aggregator'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Grammar' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Iterator' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Iterator::Array'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Iterator::Process'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Iterator::Stream'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::IteratorFactory'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Multiplexer'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Bailout'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Comment'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Plan'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Pragma'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Test'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Unknown'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::Version'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Result::YAML'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::ResultFactory'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Scheduler'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Scheduler::Job'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Scheduler::Spinner'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::Source' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler::Executable'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler::File'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler::Handle'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler::Perl'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::SourceHandler::RawTAP'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::YAMLish::Reader'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'TAP::Parser::YAMLish::Writer'=> 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'Term::ANSIColor' => 'https://rt.cpan.org/Dist/Display.html?Name=Term-ANSIColor', + 'Term::Cap' => undef, + 'Test2' => 'http://github.com/Test-More/test-more/issues', + 'Test2::API' => 'http://github.com/Test-More/test-more/issues', + 'Test2::API::Breakage' => 'http://github.com/Test-More/test-more/issues', + 'Test2::API::Context' => 'http://github.com/Test-More/test-more/issues', + 'Test2::API::Instance' => 'http://github.com/Test-More/test-more/issues', + 'Test2::API::Stack' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Bail' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Diag' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Encoding'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Exception'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Fail' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Generic' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Note' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Ok' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Pass' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Plan' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Skip' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Subtest' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::TAP::Version'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::V2' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Event::Waiting' => 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet' => 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::About'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Amnesty'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Assert'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Control'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Error'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Hub'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Info'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Info::Table'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Meta'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Parent'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Plan'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Render'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::EventFacet::Trace'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Formatter' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Formatter::TAP' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Hub' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Hub::Interceptor'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Hub::Interceptor::Terminator'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Hub::Subtest' => 'http://github.com/Test-More/test-more/issues', + 'Test2::IPC' => 'http://github.com/Test-More/test-more/issues', + 'Test2::IPC::Driver' => 'http://github.com/Test-More/test-more/issues', + 'Test2::IPC::Driver::Files'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Tools::Tiny' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Util' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Util::ExternalMeta'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Util::Facets2Legacy'=> 'http://github.com/Test-More/test-more/issues', + 'Test2::Util::HashBase' => 'http://github.com/Test-More/test-more/issues', + 'Test2::Util::Trace' => 'http://github.com/Test-More/test-more/issues', + 'Test::Builder' => 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::Formatter'=> 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::IO::Scalar'=> 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::Module' => 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::Tester' => 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::Tester::Color'=> 'http://github.com/Test-More/test-more/issues', + 'Test::Builder::TodoDiag'=> 'http://github.com/Test-More/test-more/issues', + 'Test::Harness' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Test-Harness', + 'Test::More' => 'http://github.com/Test-More/test-more/issues', + 'Test::Simple' => 'http://github.com/Test-More/test-more/issues', + 'Test::Tester' => 'http://github.com/Test-More/test-more/issues', + 'Test::Tester::Capture' => 'http://github.com/Test-More/test-more/issues', + 'Test::Tester::CaptureRunner'=> 'http://github.com/Test-More/test-more/issues', + 'Test::Tester::Delegate'=> 'http://github.com/Test-More/test-more/issues', + 'Test::use::ok' => 'http://github.com/Test-More/test-more/issues', + 'Text::Balanced' => undef, + 'Text::ParseWords' => undef, + 'Text::Tabs' => undef, + 'Text::Wrap' => undef, + 'Tie::RefHash' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Tie-RefHash', + 'Time::Local' => 'https://github.com/houseabsolute/Time-Local/issues', + 'Time::Piece' => undef, + 'Time::Seconds' => undef, + 'Unicode::Collate' => undef, + 'Unicode::Collate::CJK::Big5'=> undef, + 'Unicode::Collate::CJK::GB2312'=> undef, + 'Unicode::Collate::CJK::JISX0208'=> undef, + 'Unicode::Collate::CJK::Korean'=> undef, + 'Unicode::Collate::CJK::Pinyin'=> undef, + 'Unicode::Collate::CJK::Stroke'=> undef, + 'Unicode::Collate::CJK::Zhuyin'=> undef, + 'Unicode::Collate::Locale'=> undef, + 'Win32' => 'https://github.com/perl-libwin32/win32/issues', + 'Win32API::File' => undef, + 'autodie' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::Scope::Guard' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::Scope::GuardStack'=> 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::Util' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::exception' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::exception::system'=> 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::hints' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'autodie::skip' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie', + 'bigint' => undef, + 'bignum' => undef, + 'bigrat' => undef, + 'encoding' => undef, + 'experimental' => 'http://rt.cpan.org/Public/Dist/Display.html?Name=experimental', + 'ok' => 'http://github.com/Test-More/test-more/issues', + 'parent' => undef, + 'perlfaq' => 'https://github.com/perl-doc-cats/perlfaq/issues', + 'version' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=version', + 'version::regex' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=version', +); + +# Create aliases with trailing zeros for $] use + +$released{'5.000'} = $released{5}; +$version{'5.000'} = $version{5}; + +_create_aliases(\%delta); +_create_aliases(\%released); +_create_aliases(\%version); +_create_aliases(\%deprecated); + +sub _create_aliases { + my ($hash) = @_; + + for my $version (keys %$hash) { + next unless $version >= 5.006; + + my $padded = sprintf "%0.6f", $version; + + # If the version in string form isn't the same as the numeric version, + # alias it. + if ($padded ne $version && $version == $padded) { + $hash->{$padded} = $hash->{$version}; + } + } +} + +1; +__END__ diff --git a/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pod b/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pod new file mode 100644 index 0000000000000000000000000000000000000000..102383e095ddda6380b06dcb6e5dbde5a4ff7f81 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Module/CoreList.pod @@ -0,0 +1,256 @@ +=head1 NAME + +Module::CoreList - what modules shipped with versions of perl + +=head1 SYNOPSIS + + use Module::CoreList; + + print $Module::CoreList::version{5.00503}{CPAN}; # prints 1.48 + + print Module::CoreList->first_release('File::Spec'); + # prints 5.00405 + + print Module::CoreList->first_release_by_date('File::Spec'); + # prints 5.005 + + print Module::CoreList->first_release('File::Spec', 0.82); + # prints 5.006001 + + if (Module::CoreList::is_core('File::Spec')) { + print "File::Spec is a core module\n"; + } + + print join ', ', Module::CoreList->find_modules(qr/Data/); + # prints 'Data::Dumper' + print join ', ', + Module::CoreList->find_modules(qr/test::h.*::.*s/i, 5.008008); + # prints 'Test::Harness::Assert, Test::Harness::Straps' + + print join ", ", @{ $Module::CoreList::families{5.005} }; + # prints "5.005, 5.00503, 5.00504" + +=head1 DESCRIPTION + +Module::CoreList provides information on which core and dual-life modules shipped +with each version of L<perl>. + +It provides a number of mechanisms for querying this information. + +There is a utility called L<corelist> provided with this module +which is a convenient way of querying from the command-line. + +There is a functional programming API available for programmers to query +information. + +Programmers may also query the contained hash structures to find relevant +information. + +=head1 FUNCTIONS API + +These are the functions that are available, they may either be called as functions or class methods: + + Module::CoreList::first_release('File::Spec'); # as a function + + Module::CoreList->first_release('File::Spec'); # class method + +=over + +=item C<first_release( MODULE )> + +Behaviour since version 2.11 + +Requires a MODULE name as an argument, returns the perl version when that module first +appeared in core as ordered by perl version number or undef ( in scalar context ) +or an empty list ( in list context ) if that module is not in core. + +=item C<first_release_by_date( MODULE )> + +Requires a MODULE name as an argument, returns the perl version when that module first +appeared in core as ordered by release date or undef ( in scalar context ) +or an empty list ( in list context ) if that module is not in core. + +=item C<find_modules( REGEX, [ LIST OF PERLS ] )> + +Takes a regex as an argument, returns a list of modules that match the regex given. +If only a regex is provided applies to all modules in all perl versions. Optionally +you may provide a list of perl versions to limit the regex search. + +=item C<find_version( PERL_VERSION )> + +Takes a perl version as an argument. Upon successful completion, returns a +reference to a hash. Each element of that hash has a key which is the name of +a module (I<e.g.,> 'File::Path') shipped with that version of perl and a value +which is the version number (I<e.g.,> '2.09') of that module which shipped +with that version of perl . Returns C<undef> otherwise. + +=item C<is_core( MODULE, [ MODULE_VERSION, [ PERL_VERSION ] ] )> + +Available in version 2.99 and above. + +Returns true if MODULE was bundled with the specified version of Perl. +You can optionally specify a minimum version of the module, +and can also specify a version of Perl. +If a version of Perl isn't specified, +C<is_core()> will use the numeric version of Perl that is running (ie C<$]>). + +If you want to specify the version of Perl, but don't care about +the version of the module, pass C<undef> for the module version: + +=item C<is_deprecated( MODULE, PERL_VERSION )> + +Available in version 2.22 and above. + +Returns true if MODULE is marked as deprecated in PERL_VERSION. If PERL_VERSION is +omitted, it defaults to the current version of Perl. + +=item C<deprecated_in( MODULE )> + +Available in version 2.77 and above. + +Returns the first perl version where the MODULE was marked as deprecated. Returns C<undef> +if the MODULE has not been marked as deprecated. + +=item C<removed_from( MODULE )> + +Available in version 2.32 and above + +Takes a module name as an argument, returns the first perl version where that module +was removed from core. Returns undef if the given module was never in core or remains +in core. + +=item C<removed_from_by_date( MODULE )> + +Available in version 2.32 and above + +Takes a module name as an argument, returns the first perl version by release date where that module +was removed from core. Returns undef if the given module was never in core or remains +in core. + +=item C<changes_between( PERL_VERSION, PERL_VERSION )> + +Available in version 2.66 and above. + +Given two perl versions, this returns a list of pairs describing the changes in +core module content between them. The list is suitable for storing in a hash. +The keys are library names and the values are hashrefs. Each hashref has an +entry for one or both of C<left> and C<right>, giving the versions of the +library in each of the left and right perl distributions. + +For example, it might return these data (among others) for the difference +between 5.008000 and 5.008001: + + 'Pod::ParseLink' => { left => '1.05', right => '1.06' }, + 'Pod::ParseUtils' => { left => '0.22', right => '0.3' }, + 'Pod::Perldoc' => { right => '3.10' }, + 'Pod::Perldoc::BaseTo' => { right => undef }, + +This shows us two libraries being updated and two being added, one of which has +an undefined version in the right-hand side version. + +=back + +=head1 DATA STRUCTURES + +These are the hash data structures that are available: + +=over + +=item C<%Module::CoreList::version> + +A hash of hashes that is keyed on perl version as indicated +in $]. The second level hash is module => version pairs. + +Note, it is possible for the version of a module to be unspecified, +whereby the value is C<undef>, so use C<exists $version{$foo}{$bar}> if +that's what you're testing for. + +Starting with 2.10, the special module name C<Unicode> refers to the version of +the Unicode Character Database bundled with Perl. + +=item C<%Module::CoreList::delta> + +Available in version 3.00 and above. + +It is a hash of hashes that is keyed on perl version. Each keyed hash will have the +following keys: + + delta_from - a previous perl version that the changes are based on + changed - a hash of module/versions that have changed + removed - a hash of modules that have been removed + +=item C<%Module::CoreList::released> + +Keyed on perl version this contains ISO +formatted versions of the release dates, as gleaned from L<perlhist>. + +=item C<%Module::CoreList::families> + +New, in 1.96, a hash that +clusters known perl releases by their major versions. + +=item C<%Module::CoreList::deprecated> + +A hash of hashes keyed on perl version and on module name. +If a module is defined it indicates that that module is +deprecated in that perl version and is scheduled for removal +from core at some future point. + +=item C<%Module::CoreList::upstream> + +A hash that contains information on where patches should be directed +for each core module. + +UPSTREAM indicates where patches should go. C<undef> implies +that this hasn't been discussed for the module at hand. +C<blead> indicates that the copy of the module in the blead +sources is to be considered canonical, C<cpan> means that the +module on CPAN is to be patched first. C<first-come> means +that blead can be patched freely if it is in sync with the +latest release on CPAN. + +=item C<%Module::CoreList::bug_tracker> + +A hash that contains information on the appropriate bug tracker +for each core module. + +BUGS is an email or url to post bug reports. For modules with +UPSTREAM => 'blead', use L<mailto:perl5-porters@perl.org>. rt.cpan.org +appears to automatically provide a URL for CPAN modules; any value +given here overrides the default: +L<http://rt.cpan.org/Public/Dist/Display.html?Name=$ModuleName> + +=back + +=head1 CAVEATS + +Module::CoreList currently covers the 5.000, 5.001, 5.002, 5.003_07, +5.004, 5.004_05, 5.005, 5.005_03, 5.005_04 and 5.7.3 releases of perl. + +All stable releases of perl since 5.6.0 are covered. + +All development releases of perl since 5.9.0 are covered. + + +=head1 HISTORY + +Moved to Changes file. + +=head1 AUTHOR + +Richard Clamp E<lt>richardc@unixbeard.netE<gt> + +Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>. + +=head1 LICENSE + +Copyright (C) 2002-2009 Richard Clamp. All Rights Reserved. + +This module is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=head1 SEE ALSO + +L<corelist>, L<Module::Info>, L<perl>, L<http://perlpunks.de/corelist> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Module/Load.pm b/data/miniconda3/lib/perl5/core_perl/Module/Load.pm new file mode 100644 index 0000000000000000000000000000000000000000..0c403d41b79eded5b6a1dfed056ce51debcdfb82 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Module/Load.pm @@ -0,0 +1,372 @@ +package Module::Load; + +$VERSION = '0.34'; + +use strict; +use warnings; +use File::Spec (); + +sub import { + my $who = _who(); + my $h; shift; + + { no strict 'refs'; + + @_ or ( + *{"${who}::load"} = \&load, # compat to prev version + *{"${who}::autoload"} = \&autoload, + return + ); + + map { $h->{$_} = () if defined $_ } @_; + + (exists $h->{none} or exists $h->{''}) + and shift, last; + + ((exists $h->{autoload} and shift,1) or (exists $h->{all} and shift)) + and *{"${who}::autoload"} = \&autoload; + + ((exists $h->{load} and shift,1) or exists $h->{all}) + and *{"${who}::load"} = \&load; + + ((exists $h->{load_remote} and shift,1) or exists $h->{all}) + and *{"${who}::load_remote"} = \&load_remote; + + ((exists $h->{autoload_remote} and shift,1) or exists $h->{all}) + and *{"${who}::autoload_remote"} = \&autoload_remote; + + } + +} + +sub load(*;@){ + goto &_load; +} + +sub autoload(*;@){ + unshift @_, 'autoimport'; + goto &_load; +} + +sub load_remote($$;@){ + my ($dst, $src, @exp) = @_; + + eval "package $dst;Module::Load::load('$src', qw/@exp/);"; + $@ && die "$@"; +} + +sub autoload_remote($$;@){ + my ($dst, $src, @exp) = @_; + + eval "package $dst;Module::Load::autoload('$src', qw/@exp/);"; + $@ && die "$@"; +} + +sub _load{ + my $autoimport = $_[0] eq 'autoimport' and shift; + my $mod = shift or return; + my $who = _who(); + + if( _is_file( $mod ) ) { + require $mod; + } else { + LOAD: { + my $err; + for my $flag ( qw[1 0] ) { + my $file = _to_file( $mod, $flag); + eval { require $file }; + $@ ? $err .= $@ : last LOAD; + } + die $err if $err; + } + } + + ### This addresses #41883: Module::Load cannot import + ### non-Exporter module. ->import() routines weren't + ### properly called when load() was used. + + { no strict 'refs'; + my $import; + + ((@_ or $autoimport) and ( + $import = $mod->can('import') + ) and ( + unshift(@_, $mod), + goto &$import + ) + ); + } + +} + +sub _to_file{ + local $_ = shift; + my $pm = shift || ''; + + ## trailing blanks ignored by default. [rt #69886] + my @parts = split /::|'/, $_, -1; + ## make sure that we can't hop out of @INC + shift @parts if @parts && !$parts[0]; + + ### because of [perl #19213], see caveats ### + my $file = $^O eq 'MSWin32' + ? join "/", @parts + : File::Spec->catfile( @parts ); + + $file .= '.pm' if $pm; + + ### on perl's before 5.10 (5.9.5@31746) if you require + ### a file in VMS format, it's stored in %INC in VMS + ### format. Therefor, better unixify it first + ### Patch in reply to John Malmbergs patch (as mentioned + ### above) on p5p Tue 21 Aug 2007 04:55:07 + $file = VMS::Filespec::unixify($file) if $^O eq 'VMS'; + + return $file; +} + +sub _who { (caller(1))[0] } + +sub _is_file { + local $_ = shift; + return /^\./ ? 1 : + /[^\w:']/ ? 1 : + undef + #' silly bbedit.. +} + + +1; + +__END__ + +=pod + +=head1 NAME + +Module::Load - runtime require of both modules and files + +=head1 SYNOPSIS + + use Module::Load; + + my $module = 'Data::Dumper'; + + load Data::Dumper; # loads that module, but not import any functions + # -> cannot use 'Dumper' function + + load 'Data::Dumper'; # ditto + load $module # tritto + + autoload Data::Dumper; # loads that module and imports the default functions + # -> can use 'Dumper' function + + my $script = 'some/script.pl' + load $script; + load 'some/script.pl'; # use quotes because of punctuations + + load thing; # try 'thing' first, then 'thing.pm' + + load CGI, ':all'; # like 'use CGI qw[:standard]' + +=head1 DESCRIPTION + +C<Module::Load> eliminates the need to know whether you are trying +to require either a file or a module. + +If you consult C<perldoc -f require> you will see that C<require> will +behave differently when given a bareword or a string. + +In the case of a string, C<require> assumes you are wanting to load a +file. But in the case of a bareword, it assumes you mean a module. + +This gives nasty overhead when you are trying to dynamically require +modules at runtime, since you will need to change the module notation +(C<Acme::Comment>) to a file notation fitting the particular platform +you are on. + +C<Module::Load> eliminates the need for this overhead and will +just DWYM. + +=head2 Difference between C<load> and C<autoload> + +C<Module::Load> imports the two functions - C<load> and C<autoload> + +C<autoload> imports the default functions automatically, +but C<load> do not import any functions. + +C<autoload> is usable under C<BEGIN{};>. + +Both the functions can import the functions that are specified. + +Following codes are same. + + load File::Spec::Functions, qw/splitpath/; + + autoload File::Spec::Functions, qw/splitpath/; + +=head1 FUNCTIONS + +=over 4 + +=item load + +Loads a specified module. + +See L</Rules> for detailed loading rule. + +=item autoload + +Loads a specified module and imports the default functions. + +Except importing the functions, 'autoload' is same as 'load'. + +=item load_remote + +Loads a specified module to the specified package. + + use Module::Load 'load_remote'; + + my $pkg = 'Other::Package'; + + load_remote $pkg, 'Data::Dumper'; # load a module to 'Other::Package' + # but do not import 'Dumper' function + +A module for loading must be quoted. + +Except specifing the package and quoting module name, +'load_remote' is same as 'load'. + +=item autoload_remote + +Loads a specified module and imports the default functions to the specified package. + + use Module::Load 'autoload_remote'; + + my $pkg = 'Other::Package'; + + autoload_remote $pkg, 'Data::Dumper'; # load a module to 'Other::Package' + # and imports 'Dumper' function + +A module for loading must be quoted. + +Except specifing the package and quoting module name, +'autoload_remote' is same as 'load_remote'. + +=back + +=head1 Rules + +All functions have the following rules to decide what it thinks +you want: + +=over 4 + +=item * + +If the argument has any characters in it other than those matching +C<\w>, C<:> or C<'>, it must be a file + +=item * + +If the argument matches only C<[\w:']>, it must be a module + +=item * + +If the argument matches only C<\w>, it could either be a module or a +file. We will try to find C<file.pm> first in C<@INC> and if that +fails, we will try to find C<file> in @INC. If both fail, we die with +the respective error messages. + +=back + +=head1 IMPORTS THE FUNCTIONS + +'load' and 'autoload' are imported by default, but 'load_remote' and +'autoload_remote' are not imported. + +To use 'load_remote' or 'autoload_remote', specify at 'use'. + +=over 4 + +=item "load","autoload","load_remote","autoload_remote" + +Imports the selected functions. + + # imports 'load' and 'autoload' (default) + use Module::Load; + + # imports 'autoload' only + use Module::Load 'autoload'; + + # imports 'autoload' and 'autoload_remote', but don't import 'load'; + use Module::Load qw/autoload autoload_remote/; + +=item 'all' + +Imports all the functions. + + use Module::Load 'all'; # imports load, autoload, load_remote, autoload_remote + +=item '','none',undef + +Not import any functions (C<load> and C<autoload> are not imported). + + use Module::Load ''; + + use Module::Load 'none'; + + use Module::Load undef; + +=back + +=head1 Caveats + +Because of a bug in perl (#19213), at least in version 5.6.1, we have +to hardcode the path separator for a require on Win32 to be C</>, like +on Unix rather than the Win32 C<\>. Otherwise perl will not read its +own %INC accurately double load files if they are required again, or +in the worst case, core dump. + +C<Module::Load> cannot do implicit imports, only explicit imports. +(in other words, you always have to specify explicitly what you wish +to import from a module, even if the functions are in that modules' +C<@EXPORT>) + +=head1 SEE ALSO + +L<Module::Runtime> provides functions for loading modules, +checking the validity of a module name, +converting a module name to partial C<.pm> path, +and related utility functions. + +L<"require" in perlfunc|https://metacpan.org/pod/perlfunc#require> +and +L<"use" in perlfunc|https://metacpan.org/pod/perlfunc#use>. + +L<Mojo::Loader> is a "class loader and plugin framework", +and is included in the +L<Mojolicious|https://metacpan.org/release/Mojolicious> distribution. + +L<Module::Loader> is a module for finding and loading modules +in a given namespace, inspired by C<Mojo::Loader>. + + +=head1 ACKNOWLEDGEMENTS + +Thanks to Jonas B. Nielsen for making explicit imports work. + +=head1 BUG REPORTS + +Please report bugs or other issues to E<lt>bug-module-load@rt.cpan.org<gt>. + +=head1 AUTHOR + +This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. + +=head1 COPYRIGHT + +This library is free software; you may redistribute and/or modify it +under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Module/Loaded.pm b/data/miniconda3/lib/perl5/core_perl/Module/Loaded.pm new file mode 100644 index 0000000000000000000000000000000000000000..6da625ab49fac0016061a1c869862be6cac942f7 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Module/Loaded.pm @@ -0,0 +1,142 @@ +package Module::Loaded; + +use strict; +use Carp qw[carp]; + +BEGIN { use base 'Exporter'; + use vars qw[@EXPORT $VERSION]; + + $VERSION = '0.08'; + @EXPORT = qw[mark_as_loaded mark_as_unloaded is_loaded]; +} + +=head1 NAME + +Module::Loaded - mark modules as loaded or unloaded + +=head1 SYNOPSIS + + use Module::Loaded; + + $bool = mark_as_loaded('Foo'); # Foo.pm is now marked as loaded + $loc = is_loaded('Foo'); # location of Foo.pm set to the + # loaders location + eval "require 'Foo'"; # is now a no-op + + $bool = mark_as_unloaded('Foo'); # Foo.pm no longer marked as loaded + eval "require 'Foo'"; # Will try to find Foo.pm in @INC + +=head1 DESCRIPTION + +When testing applications, often you find yourself needing to provide +functionality in your test environment that would usually be provided +by external modules. Rather than munging the C<%INC> by hand to mark +these external modules as loaded, so they are not attempted to be loaded +by perl, this module offers you a very simple way to mark modules as +loaded and/or unloaded. + +=head1 FUNCTIONS + +=head2 $bool = mark_as_loaded( PACKAGE ); + +Marks the package as loaded to perl. C<PACKAGE> can be a bareword or +string. + +If the module is already loaded, C<mark_as_loaded> will carp about +this and tell you from where the C<PACKAGE> has been loaded already. + +=cut + +sub mark_as_loaded (*) { + my $pm = shift; + my $file = __PACKAGE__->_pm_to_file( $pm ) or return; + my $who = [caller]->[1]; + + my $where = is_loaded( $pm ); + if ( defined $where ) { + carp "'$pm' already marked as loaded ('$where')"; + + } else { + $INC{$file} = $who; + } + + return 1; +} + +=head2 $bool = mark_as_unloaded( PACKAGE ); + +Marks the package as unloaded to perl, which is the exact opposite +of C<mark_as_loaded>. C<PACKAGE> can be a bareword or string. + +If the module is already unloaded, C<mark_as_unloaded> will carp about +this and tell you the C<PACKAGE> has been unloaded already. + +=cut + +sub mark_as_unloaded (*) { + my $pm = shift; + my $file = __PACKAGE__->_pm_to_file( $pm ) or return; + + unless( defined is_loaded( $pm ) ) { + carp "'$pm' already marked as unloaded"; + + } else { + delete $INC{ $file }; + } + + return 1; +} + +=head2 $loc = is_loaded( PACKAGE ); + +C<is_loaded> tells you if C<PACKAGE> has been marked as loaded yet. +C<PACKAGE> can be a bareword or string. + +It returns falls if C<PACKAGE> has not been loaded yet and the location +from where it is said to be loaded on success. + +=cut + +sub is_loaded (*) { + my $pm = shift; + my $file = __PACKAGE__->_pm_to_file( $pm ) or return; + + return $INC{$file} if exists $INC{$file}; + + return; +} + + +sub _pm_to_file { + my $pkg = shift; + my $pm = shift or return; + + my $file = join '/', split '::', $pm; + $file .= '.pm'; + + return $file; +} + +=head1 BUG REPORTS + +Please report bugs or other issues to E<lt>bug-module-loaded@rt.cpan.org<gt>. + +=head1 AUTHOR + +This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. + +=head1 COPYRIGHT + +This library is free software; you may redistribute and/or modify it +under the same terms as Perl itself. + +=cut + +# Local variables: +# c-indentation-style: bsd +# c-basic-offset: 4 +# indent-tabs-mode: nil +# End: +# vim: expandtab shiftwidth=4: + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Module/Metadata.pm b/data/miniconda3/lib/perl5/core_perl/Module/Metadata.pm new file mode 100644 index 0000000000000000000000000000000000000000..0309d768ae80b0d5d385cd99f9f23743c0c0bc20 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Module/Metadata.pm @@ -0,0 +1,1200 @@ +# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*- +# vim:ts=8:sw=2:et:sta:sts=2:tw=78 +package Module::Metadata; # git description: v1.000036-4-g435a294 +# ABSTRACT: Gather package and POD information from perl module files + +# Adapted from Perl-licensed code originally distributed with +# Module-Build by Ken Williams + +# This module provides routines to gather information about +# perl modules (assuming this may be expanded in the distant +# parrot future to look at other types of modules). + +sub __clean_eval { eval $_[0] } +use strict; +use warnings; + +our $VERSION = '1.000037'; + +use Carp qw/croak/; +use File::Spec; +BEGIN { + # Try really hard to not depend ony any DynaLoaded module, such as IO::File or Fcntl + eval { + require Fcntl; Fcntl->import('SEEK_SET'); 1; + } or *SEEK_SET = sub { 0 } +} +use version 0.87; +BEGIN { + if ($INC{'Log/Contextual.pm'}) { + require "Log/Contextual/WarnLogger.pm"; # Hide from AutoPrereqs + Log::Contextual->import('log_info', + '-default_logger' => Log::Contextual::WarnLogger->new({ env_prefix => 'MODULE_METADATA', }), + ); + } + else { + *log_info = sub (&) { warn $_[0]->() }; + } +} +use File::Find qw(find); + +my $V_NUM_REGEXP = qr{v?[0-9._]+}; # crudely, a v-string or decimal + +my $PKG_FIRST_WORD_REGEXP = qr{ # the FIRST word in a package name + [a-zA-Z_] # the first word CANNOT start with a digit + (?: + [\w']? # can contain letters, digits, _, or ticks + \w # But, NO multi-ticks or trailing ticks + )* +}x; + +my $PKG_ADDL_WORD_REGEXP = qr{ # the 2nd+ word in a package name + \w # the 2nd+ word CAN start with digits + (?: + [\w']? # and can contain letters or ticks + \w # But, NO multi-ticks or trailing ticks + )* +}x; + +my $PKG_NAME_REGEXP = qr{ # match a package name + (?: :: )? # a pkg name can start with arisdottle + $PKG_FIRST_WORD_REGEXP # a package word + (?: + (?: :: )+ ### arisdottle (allow one or many times) + $PKG_ADDL_WORD_REGEXP ### a package word + )* # ^ zero, one or many times + (?: + :: # allow trailing arisdottle + )? +}x; + +my $PKG_REGEXP = qr{ # match a package declaration + ^[\s\{;]* # intro chars on a line + package # the word 'package' + \s+ # whitespace + ($PKG_NAME_REGEXP) # a package name + \s* # optional whitespace + ($V_NUM_REGEXP)? # optional version number + \s* # optional whitesapce + [;\{] # semicolon line terminator or block start (since 5.16) +}x; + +my $VARNAME_REGEXP = qr{ # match fully-qualified VERSION name + ([\$*]) # sigil - $ or * + ( + ( # optional leading package name + (?:::|\')? # possibly starting like just :: (a la $::VERSION) + (?:\w+(?:::|\'))* # Foo::Bar:: ... + )? + VERSION + )\b +}x; + +my $VERS_REGEXP = qr{ # match a VERSION definition + (?: + \(\s*$VARNAME_REGEXP\s*\) # with parens + | + $VARNAME_REGEXP # without parens + ) + \s* + =[^=~>] # = but not ==, nor =~, nor => +}x; + +sub new_from_file { + my $class = shift; + my $filename = File::Spec->rel2abs( shift ); + + return undef unless defined( $filename ) && -f $filename; + return $class->_init(undef, $filename, @_); +} + +sub new_from_handle { + my $class = shift; + my $handle = shift; + my $filename = shift; + return undef unless defined($handle) && defined($filename); + $filename = File::Spec->rel2abs( $filename ); + + return $class->_init(undef, $filename, @_, handle => $handle); + +} + + +sub new_from_module { + my $class = shift; + my $module = shift; + my %props = @_; + + $props{inc} ||= \@INC; + my $filename = $class->find_module_by_name( $module, $props{inc} ); + return undef unless defined( $filename ) && -f $filename; + return $class->_init($module, $filename, %props); +} + +{ + + my $compare_versions = sub { + my ($v1, $op, $v2) = @_; + $v1 = version->new($v1) + unless UNIVERSAL::isa($v1,'version'); + + my $eval_str = "\$v1 $op \$v2"; + my $result = eval $eval_str; + log_info { "error comparing versions: '$eval_str' $@" } if $@; + + return $result; + }; + + my $normalize_version = sub { + my ($version) = @_; + if ( $version =~ /[=<>!,]/ ) { # logic, not just version + # take as is without modification + } + elsif ( ref $version eq 'version' ) { # version objects + $version = $version->is_qv ? $version->normal : $version->stringify; + } + elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots + # normalize string tuples without "v": "1.2.3" -> "v1.2.3" + $version = "v$version"; + } + else { + # leave alone + } + return $version; + }; + + # separate out some of the conflict resolution logic + + my $resolve_module_versions = sub { + my $packages = shift; + + my( $file, $version ); + my $err = ''; + foreach my $p ( @$packages ) { + if ( defined( $p->{version} ) ) { + if ( defined( $version ) ) { + if ( $compare_versions->( $version, '!=', $p->{version} ) ) { + $err .= " $p->{file} ($p->{version})\n"; + } + else { + # same version declared multiple times, ignore + } + } + else { + $file = $p->{file}; + $version = $p->{version}; + } + } + $file ||= $p->{file} if defined( $p->{file} ); + } + + if ( $err ) { + $err = " $file ($version)\n" . $err; + } + + my %result = ( + file => $file, + version => $version, + err => $err + ); + + return \%result; + }; + + sub provides { + my $class = shift; + + croak "provides() requires key/value pairs \n" if @_ % 2; + my %args = @_; + + croak "provides() takes only one of 'dir' or 'files'\n" + if $args{dir} && $args{files}; + + croak "provides() requires a 'version' argument" + unless defined $args{version}; + + croak "provides() does not support version '$args{version}' metadata" + unless grep $args{version} eq $_, qw/1.4 2/; + + $args{prefix} = 'lib' unless defined $args{prefix}; + + my $p; + if ( $args{dir} ) { + $p = $class->package_versions_from_directory($args{dir}); + } + else { + croak "provides() requires 'files' to be an array reference\n" + unless ref $args{files} eq 'ARRAY'; + $p = $class->package_versions_from_directory($args{files}); + } + + # Now, fix up files with prefix + if ( length $args{prefix} ) { # check in case disabled with q{} + $args{prefix} =~ s{/$}{}; + for my $v ( values %$p ) { + $v->{file} = "$args{prefix}/$v->{file}"; + } + } + + return $p + } + + sub package_versions_from_directory { + my ( $class, $dir, $files ) = @_; + + my @files; + + if ( $files ) { + @files = @$files; + } + else { + find( { + wanted => sub { + push @files, $_ if -f $_ && /\.pm$/; + }, + no_chdir => 1, + }, $dir ); + } + + # First, we enumerate all packages & versions, + # separating into primary & alternative candidates + my( %prime, %alt ); + foreach my $file (@files) { + my $mapped_filename = File::Spec->abs2rel( $file, $dir ); + my @path = File::Spec->splitdir( $mapped_filename ); + (my $prime_package = join( '::', @path )) =~ s/\.pm$//; + + my $pm_info = $class->new_from_file( $file ); + + foreach my $package ( $pm_info->packages_inside ) { + next if $package eq 'main'; # main can appear numerous times, ignore + next if $package eq 'DB'; # special debugging package, ignore + next if grep /^_/, split( /::/, $package ); # private package, ignore + + my $version = $pm_info->version( $package ); + + $prime_package = $package if lc($prime_package) eq lc($package); + if ( $package eq $prime_package ) { + if ( exists( $prime{$package} ) ) { + croak "Unexpected conflict in '$package'; multiple versions found.\n"; + } + else { + $mapped_filename = "$package.pm" if lc("$package.pm") eq lc($mapped_filename); + $prime{$package}{file} = $mapped_filename; + $prime{$package}{version} = $version if defined( $version ); + } + } + else { + push( @{$alt{$package}}, { + file => $mapped_filename, + version => $version, + } ); + } + } + } + + # Then we iterate over all the packages found above, identifying conflicts + # and selecting the "best" candidate for recording the file & version + # for each package. + foreach my $package ( keys( %alt ) ) { + my $result = $resolve_module_versions->( $alt{$package} ); + + if ( exists( $prime{$package} ) ) { # primary package selected + + if ( $result->{err} ) { + # Use the selected primary package, but there are conflicting + # errors among multiple alternative packages that need to be + # reported + log_info { + "Found conflicting versions for package '$package'\n" . + " $prime{$package}{file} ($prime{$package}{version})\n" . + $result->{err} + }; + + } + elsif ( defined( $result->{version} ) ) { + # There is a primary package selected, and exactly one + # alternative package + + if ( exists( $prime{$package}{version} ) && + defined( $prime{$package}{version} ) ) { + # Unless the version of the primary package agrees with the + # version of the alternative package, report a conflict + if ( $compare_versions->( + $prime{$package}{version}, '!=', $result->{version} + ) + ) { + + log_info { + "Found conflicting versions for package '$package'\n" . + " $prime{$package}{file} ($prime{$package}{version})\n" . + " $result->{file} ($result->{version})\n" + }; + } + + } + else { + # The prime package selected has no version so, we choose to + # use any alternative package that does have a version + $prime{$package}{file} = $result->{file}; + $prime{$package}{version} = $result->{version}; + } + + } + else { + # no alt package found with a version, but we have a prime + # package so we use it whether it has a version or not + } + + } + else { # No primary package was selected, use the best alternative + + if ( $result->{err} ) { + log_info { + "Found conflicting versions for package '$package'\n" . + $result->{err} + }; + } + + # Despite possible conflicting versions, we choose to record + # something rather than nothing + $prime{$package}{file} = $result->{file}; + $prime{$package}{version} = $result->{version} + if defined( $result->{version} ); + } + } + + # Normalize versions. Can't use exists() here because of bug in YAML::Node. + # XXX "bug in YAML::Node" comment seems irrelevant -- dagolden, 2009-05-18 + for (grep defined $_->{version}, values %prime) { + $_->{version} = $normalize_version->( $_->{version} ); + } + + return \%prime; + } +} + + +sub _init { + my $class = shift; + my $module = shift; + my $filename = shift; + my %props = @_; + + my $handle = delete $props{handle}; + my( %valid_props, @valid_props ); + @valid_props = qw( collect_pod inc decode_pod ); + @valid_props{@valid_props} = delete( @props{@valid_props} ); + warn "Unknown properties: @{[keys %props]}\n" if scalar( %props ); + + my %data = ( + module => $module, + filename => $filename, + version => undef, + packages => [], + versions => {}, + pod => {}, + pod_headings => [], + collect_pod => 0, + + %valid_props, + ); + + my $self = bless(\%data, $class); + + if ( not $handle ) { + my $filename = $self->{filename}; + open $handle, '<', $filename + or croak( "Can't open '$filename': $!" ); + + $self->_handle_bom($handle, $filename); + } + $self->_parse_fh($handle); + + @{$self->{packages}} = __uniq(@{$self->{packages}}); + + unless($self->{module} and length($self->{module})) { + # CAVEAT (possible TODO): .pmc files not treated the same as .pm + if ($self->{filename} =~ /\.pm$/) { + my ($v, $d, $f) = File::Spec->splitpath($self->{filename}); + $f =~ s/\..+$//; + my @candidates = grep /(^|::)$f$/, @{$self->{packages}}; + $self->{module} = shift(@candidates); # this may be undef + } + else { + # this seems like an atrocious heuristic, albeit marginally better than + # what was here before. It should be rewritten entirely to be more like + # "if it's not a .pm file, it's not require()able as a name, therefore + # name() should be undef." + if ((grep /main/, @{$self->{packages}}) + or (grep /main/, keys %{$self->{versions}})) { + $self->{module} = 'main'; + } + else { + # TODO: this should maybe default to undef instead + $self->{module} = $self->{packages}[0] || ''; + } + } + } + + $self->{version} = $self->{versions}{$self->{module}} + if defined( $self->{module} ); + + return $self; +} + +# class method +sub _do_find_module { + my $class = shift; + my $module = shift || croak 'find_module_by_name() requires a package name'; + my $dirs = shift || \@INC; + + my $file = File::Spec->catfile(split( /::/, $module)); + foreach my $dir ( @$dirs ) { + my $testfile = File::Spec->catfile($dir, $file); + return [ File::Spec->rel2abs( $testfile ), $dir ] + if -e $testfile and !-d _; # For stuff like ExtUtils::xsubpp + # CAVEAT (possible TODO): .pmc files are not discoverable here + $testfile .= '.pm'; + return [ File::Spec->rel2abs( $testfile ), $dir ] + if -e $testfile; + } + return; +} + +# class method +sub find_module_by_name { + my $found = shift()->_do_find_module(@_) or return; + return $found->[0]; +} + +# class method +sub find_module_dir_by_name { + my $found = shift()->_do_find_module(@_) or return; + return $found->[1]; +} + + +# given a line of perl code, attempt to parse it if it looks like a +# $VERSION assignment, returning sigil, full name, & package name +sub _parse_version_expression { + my $self = shift; + my $line = shift; + + my( $sigil, $variable_name, $package); + if ( $line =~ /$VERS_REGEXP/o ) { + ( $sigil, $variable_name, $package) = $2 ? ( $1, $2, $3 ) : ( $4, $5, $6 ); + if ( $package ) { + $package = ($package eq '::') ? 'main' : $package; + $package =~ s/::$//; + } + } + + return ( $sigil, $variable_name, $package ); +} + +# Look for a UTF-8/UTF-16BE/UTF-16LE BOM at the beginning of the stream. +# If there's one, then skip it and set the :encoding layer appropriately. +sub _handle_bom { + my ($self, $fh, $filename) = @_; + + my $pos = tell $fh; + return unless defined $pos; + + my $buf = ' ' x 2; + my $count = read $fh, $buf, length $buf; + return unless defined $count and $count >= 2; + + my $encoding; + if ( $buf eq "\x{FE}\x{FF}" ) { + $encoding = 'UTF-16BE'; + } + elsif ( $buf eq "\x{FF}\x{FE}" ) { + $encoding = 'UTF-16LE'; + } + elsif ( $buf eq "\x{EF}\x{BB}" ) { + $buf = ' '; + $count = read $fh, $buf, length $buf; + if ( defined $count and $count >= 1 and $buf eq "\x{BF}" ) { + $encoding = 'UTF-8'; + } + } + + if ( defined $encoding ) { + if ( "$]" >= 5.008 ) { + binmode( $fh, ":encoding($encoding)" ); + } + } + else { + seek $fh, $pos, SEEK_SET + or croak( sprintf "Can't reset position to the top of '$filename'" ); + } + + return $encoding; +} + +sub _parse_fh { + my ($self, $fh) = @_; + + my( $in_pod, $seen_end, $need_vers ) = ( 0, 0, 0 ); + my( @packages, %vers, %pod, @pod ); + my $package = 'main'; + my $pod_sect = ''; + my $pod_data = ''; + my $in_end = 0; + my $encoding = ''; + + while (defined( my $line = <$fh> )) { + my $line_num = $.; + + chomp( $line ); + + # From toke.c : any line that begins by "=X", where X is an alphabetic + # character, introduces a POD segment. + my $is_cut; + if ( $line =~ /^=([a-zA-Z].*)/ ) { + my $cmd = $1; + # Then it goes back to Perl code for "=cutX" where X is a non-alphabetic + # character (which includes the newline, but here we chomped it away). + $is_cut = $cmd =~ /^cut(?:[^a-zA-Z]|$)/; + $in_pod = !$is_cut; + } + + if ( $in_pod ) { + + if ( $line =~ /^=head[1-4]\s+(.+)\s*$/ ) { + push( @pod, $1 ); + if ( $self->{collect_pod} && length( $pod_data ) ) { + $pod{$pod_sect} = $pod_data; + $pod_data = ''; + } + $pod_sect = $1; + } + elsif ( $self->{collect_pod} ) { + if ( $self->{decode_pod} && $line =~ /^=encoding ([\w-]+)/ ) { + $encoding = $1; + } + $pod_data .= "$line\n"; + } + next; + } + elsif ( $is_cut ) { + if ( $self->{collect_pod} && length( $pod_data ) ) { + $pod{$pod_sect} = $pod_data; + $pod_data = ''; + } + $pod_sect = ''; + next; + } + + # Skip after __END__ + next if $in_end; + + # Skip comments in code + next if $line =~ /^\s*#/; + + # Would be nice if we could also check $in_string or something too + if ($line eq '__END__') { + $in_end++; + next; + } + + last if $line eq '__DATA__'; + + # parse $line to see if it's a $VERSION declaration + my( $version_sigil, $version_fullname, $version_package ) = + index($line, 'VERSION') >= 1 + ? $self->_parse_version_expression( $line ) + : (); + + if ( $line =~ /$PKG_REGEXP/o ) { + $package = $1; + my $version = $2; + push( @packages, $package ) unless grep( $package eq $_, @packages ); + $need_vers = defined $version ? 0 : 1; + + if ( not exists $vers{$package} and defined $version ){ + # Upgrade to a version object. + my $dwim_version = eval { _dwim_version($version) }; + croak "Version '$version' from $self->{filename} does not appear to be valid:\n$line\n\nThe fatal error was: $@\n" + unless defined $dwim_version; # "0" is OK! + $vers{$package} = $dwim_version; + } + } + + # VERSION defined with full package spec, i.e. $Module::VERSION + elsif ( $version_fullname && $version_package ) { + # we do NOT save this package in found @packages + $need_vers = 0 if $version_package eq $package; + + unless ( defined $vers{$version_package} && length $vers{$version_package} ) { + $vers{$version_package} = $self->_evaluate_version_line( $version_sigil, $version_fullname, $line ); + } + } + + # first non-comment line in undeclared package main is VERSION + elsif ( $package eq 'main' && $version_fullname && !exists($vers{main}) ) { + $need_vers = 0; + my $v = $self->_evaluate_version_line( $version_sigil, $version_fullname, $line ); + $vers{$package} = $v; + push( @packages, 'main' ); + } + + # first non-comment line in undeclared package defines package main + elsif ( $package eq 'main' && !exists($vers{main}) && $line =~ /\w/ ) { + $need_vers = 1; + $vers{main} = ''; + push( @packages, 'main' ); + } + + # only keep if this is the first $VERSION seen + elsif ( $version_fullname && $need_vers ) { + $need_vers = 0; + my $v = $self->_evaluate_version_line( $version_sigil, $version_fullname, $line ); + + unless ( defined $vers{$package} && length $vers{$package} ) { + $vers{$package} = $v; + } + } + } # end loop over each line + + if ( $self->{collect_pod} && length($pod_data) ) { + $pod{$pod_sect} = $pod_data; + } + + if ( $self->{decode_pod} && $encoding ) { + require Encode; + $_ = Encode::decode( $encoding, $_ ) for values %pod; + } + + $self->{versions} = \%vers; + $self->{packages} = \@packages; + $self->{pod} = \%pod; + $self->{pod_headings} = \@pod; +} + +sub __uniq (@) +{ + my (%seen, $key); + grep !$seen{ $key = $_ }++, @_; +} + +{ +my $pn = 0; +sub _evaluate_version_line { + my $self = shift; + my( $sigil, $variable_name, $line ) = @_; + + # We compile into a local sub because 'use version' would cause + # compiletime/runtime issues with local() + $pn++; # everybody gets their own package + my $eval = qq{ my \$dummy = q# Hide from _packages_inside() + #; package Module::Metadata::_version::p${pn}; + use version; + sub { + local $sigil$variable_name; + $line; + return \$$variable_name if defined \$$variable_name; + return \$Module::Metadata::_version::p${pn}::$variable_name; + }; + }; + + $eval = $1 if $eval =~ m{^(.+)}s; + + local $^W; + # Try to get the $VERSION + my $vsub = __clean_eval($eval); + # some modules say $VERSION <equal sign> $Foo::Bar::VERSION, but Foo::Bar isn't + # installed, so we need to hunt in ./lib for it + if ( $@ =~ /Can't locate/ && -d 'lib' ) { + local @INC = ('lib',@INC); + $vsub = __clean_eval($eval); + } + warn "Error evaling version line '$eval' in $self->{filename}: $@\n" + if $@; + + (ref($vsub) eq 'CODE') or + croak "failed to build version sub for $self->{filename}"; + + my $result = eval { $vsub->() }; + # FIXME: $eval is not the right thing to print here + croak "Could not get version from $self->{filename} by executing:\n$eval\n\nThe fatal error was: $@\n" + if $@; + + # Upgrade it into a version object + my $version = eval { _dwim_version($result) }; + + # FIXME: $eval is not the right thing to print here + croak "Version '$result' from $self->{filename} does not appear to be valid:\n$eval\n\nThe fatal error was: $@\n" + unless defined $version; # "0" is OK! + + return $version; +} +} + +# Try to DWIM when things fail the lax version test in obvious ways +{ + my @version_prep = ( + # Best case, it just works + sub { return shift }, + + # If we still don't have a version, try stripping any + # trailing junk that is prohibited by lax rules + sub { + my $v = shift; + $v =~ s{([0-9])[a-z-].*$}{$1}i; # 1.23-alpha or 1.23b + return $v; + }, + + # Activestate apparently creates custom versions like '1.23_45_01', which + # cause version.pm to think it's an invalid alpha. So check for that + # and strip them + sub { + my $v = shift; + my $num_dots = () = $v =~ m{(\.)}g; + my $num_unders = () = $v =~ m{(_)}g; + my $leading_v = substr($v,0,1) eq 'v'; + if ( ! $leading_v && $num_dots < 2 && $num_unders > 1 ) { + $v =~ s{_}{}g; + $num_unders = () = $v =~ m{(_)}g; + } + return $v; + }, + + # Worst case, try numifying it like we would have before version objects + sub { + my $v = shift; + no warnings 'numeric'; + return 0 + $v; + }, + + ); + + sub _dwim_version { + my ($result) = shift; + + return $result if ref($result) eq 'version'; + + my ($version, $error); + for my $f (@version_prep) { + $result = $f->($result); + $version = eval { version->new($result) }; + $error ||= $@ if $@; # capture first failure + last if defined $version; + } + + croak $error unless defined $version; + + return $version; + } +} + +############################################################ + +# accessors +sub name { $_[0]->{module} } + +sub filename { $_[0]->{filename} } +sub packages_inside { @{$_[0]->{packages}} } +sub pod_inside { @{$_[0]->{pod_headings}} } +sub contains_pod { 0+@{$_[0]->{pod_headings}} } + +sub version { + my $self = shift; + my $mod = shift || $self->{module}; + my $vers; + if ( defined( $mod ) && length( $mod ) && + exists( $self->{versions}{$mod} ) ) { + return $self->{versions}{$mod}; + } + else { + return undef; + } +} + +sub pod { + my $self = shift; + my $sect = shift; + if ( defined( $sect ) && length( $sect ) && + exists( $self->{pod}{$sect} ) ) { + return $self->{pod}{$sect}; + } + else { + return undef; + } +} + +sub is_indexable { + my ($self, $package) = @_; + + my @indexable_packages = grep $_ ne 'main', $self->packages_inside; + + # check for specific package, if provided + return !! grep $_ eq $package, @indexable_packages if $package; + + # otherwise, check for any indexable packages at all + return !! @indexable_packages; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Module::Metadata - Gather package and POD information from perl module files + +=head1 VERSION + +version 1.000037 + +=head1 SYNOPSIS + + use Module::Metadata; + + # information about a .pm file + my $info = Module::Metadata->new_from_file( $file ); + my $version = $info->version; + + # CPAN META 'provides' field for .pm files in a directory + my $provides = Module::Metadata->provides( + dir => 'lib', version => 2 + ); + +=head1 DESCRIPTION + +This module provides a standard way to gather metadata about a .pm file through +(mostly) static analysis and (some) code execution. When determining the +version of a module, the C<$VERSION> assignment is C<eval>ed, as is traditional +in the CPAN toolchain. + +=head1 CLASS METHODS + +=head2 C<< new_from_file($filename, collect_pod => 1, decode_pod => 1) >> + +Constructs a C<Module::Metadata> object given the path to a file. Returns +undef if the filename does not exist. + +C<collect_pod> is a optional boolean argument that determines whether POD +data is collected and stored for reference. POD data is not collected by +default. POD headings are always collected. + +If the file begins by an UTF-8, UTF-16BE or UTF-16LE byte-order mark, then +it is skipped before processing, and the content of the file is also decoded +appropriately starting from perl 5.8. + +Alternatively, if C<decode_pod> is set, it will decode the collected pod +sections according to the C<=encoding> declaration. + +=head2 C<< new_from_handle($handle, $filename, collect_pod => 1, decode_pod => 1) >> + +This works just like C<new_from_file>, except that a handle can be provided +as the first argument. + +Note that there is no validation to confirm that the handle is a handle or +something that can act like one. Passing something that isn't a handle will +cause a exception when trying to read from it. The C<filename> argument is +mandatory or undef will be returned. + +You are responsible for setting the decoding layers on C<$handle> if +required. + +=head2 C<< new_from_module($module, collect_pod => 1, inc => \@dirs, decode_pod => 1) >> + +Constructs a C<Module::Metadata> object given a module or package name. +Returns undef if the module cannot be found. + +In addition to accepting the C<collect_pod> and C<decode_pod> arguments as +described above, this method accepts a C<inc> argument which is a reference to +an array of directories to search for the module. If none are given, the +default is @INC. + +If the file that contains the module begins by an UTF-8, UTF-16BE or +UTF-16LE byte-order mark, then it is skipped before processing, and the +content of the file is also decoded appropriately starting from perl 5.8. + +=head2 C<< find_module_by_name($module, \@dirs) >> + +Returns the path to a module given the module or package name. A list +of directories can be passed in as an optional parameter, otherwise +@INC is searched. + +Can be called as either an object or a class method. + +=head2 C<< find_module_dir_by_name($module, \@dirs) >> + +Returns the entry in C<@dirs> (or C<@INC> by default) that contains +the module C<$module>. A list of directories can be passed in as an +optional parameter, otherwise @INC is searched. + +Can be called as either an object or a class method. + +=head2 C<< provides( %options ) >> + +This is a convenience wrapper around C<package_versions_from_directory> +to generate a CPAN META C<provides> data structure. It takes key/value +pairs. Valid option keys include: + +=over + +=item version B<(required)> + +Specifies which version of the L<CPAN::Meta::Spec> should be used as +the format of the C<provides> output. Currently only '1.4' and '2' +are supported (and their format is identical). This may change in +the future as the definition of C<provides> changes. + +The C<version> option is required. If it is omitted or if +an unsupported version is given, then C<provides> will throw an error. + +=item dir + +Directory to search recursively for F<.pm> files. May not be specified with +C<files>. + +=item files + +Array reference of files to examine. May not be specified with C<dir>. + +=item prefix + +String to prepend to the C<file> field of the resulting output. This defaults +to F<lib>, which is the common case for most CPAN distributions with their +F<.pm> files in F<lib>. This option ensures the META information has the +correct relative path even when the C<dir> or C<files> arguments are +absolute or have relative paths from a location other than the distribution +root. + +=back + +For example, given C<dir> of 'lib' and C<prefix> of 'lib', the return value +is a hashref of the form: + + { + 'Package::Name' => { + version => '0.123', + file => 'lib/Package/Name.pm' + }, + 'OtherPackage::Name' => ... + } + +=head2 C<< package_versions_from_directory($dir, \@files?) >> + +Scans C<$dir> for .pm files (unless C<@files> is given, in which case looks +for those files in C<$dir> - and reads each file for packages and versions, +returning a hashref of the form: + + { + 'Package::Name' => { + version => '0.123', + file => 'Package/Name.pm' + }, + 'OtherPackage::Name' => ... + } + +The C<DB> and C<main> packages are always omitted, as are any "private" +packages that have leading underscores in the namespace (e.g. +C<Foo::_private>) + +Note that the file path is relative to C<$dir> if that is specified. +This B<must not> be used directly for CPAN META C<provides>. See +the C<provides> method instead. + +=head2 C<< log_info (internal) >> + +Used internally to perform logging; imported from Log::Contextual if +Log::Contextual has already been loaded, otherwise simply calls warn. + +=head1 OBJECT METHODS + +=head2 C<< name() >> + +Returns the name of the package represented by this module. If there +is more than one package, it makes a best guess based on the +filename. If it's a script (i.e. not a *.pm) the package name is +'main'. + +=head2 C<< version($package) >> + +Returns the version as defined by the $VERSION variable for the +package as returned by the C<name> method if no arguments are +given. If given the name of a package it will attempt to return the +version of that package if it is specified in the file. + +=head2 C<< filename() >> + +Returns the absolute path to the file. +Note that this file may not actually exist on disk yet, e.g. if the module was read from an in-memory filehandle. + +=head2 C<< packages_inside() >> + +Returns a list of packages. Note: this is a raw list of packages +discovered (or assumed, in the case of C<main>). It is not +filtered for C<DB>, C<main> or private packages the way the +C<provides> method does. Invalid package names are not returned, +for example "Foo:Bar". Strange but valid package names are +returned, for example "Foo::Bar::", and are left up to the caller +on how to handle. + +=head2 C<< pod_inside() >> + +Returns a list of POD sections. + +=head2 C<< contains_pod() >> + +Returns true if there is any POD in the file. + +=head2 C<< pod($section) >> + +Returns the POD data in the given section. + +=head2 C<< is_indexable($package) >> or C<< is_indexable() >> + +Available since version 1.000020. + +Returns a boolean indicating whether the package (if provided) or any package +(otherwise) is eligible for indexing by PAUSE, the Perl Authors Upload Server. +Note This only checks for valid C<package> declarations, and does not take any +ownership information into account. + +=head1 SUPPORT + +Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Metadata> +(or L<bug-Module-Metadata@rt.cpan.org|mailto:bug-Module-Metadata@rt.cpan.org>). + +There is also a mailing list available for users of this distribution, at +L<http://lists.perl.org/list/cpan-workers.html>. + +There is also an irc channel available for users of this distribution, at +L<C<#toolchain> on C<irc.perl.org>|irc://irc.perl.org/#toolchain>. + +=head1 AUTHOR + +Original code from Module::Build::ModuleInfo by Ken Williams +<kwilliams@cpan.org>, Randy W. Sims <RandyS@ThePierianSpring.org> + +Released as Module::Metadata by Matt S Trout (mst) <mst@shadowcat.co.uk> with +assistance from David Golden (xdg) <dagolden@cpan.org>. + +=head1 CONTRIBUTORS + +=for stopwords Karen Etheridge David Golden Vincent Pit Matt S Trout Chris Nehren Tomas Doran Olivier Mengué Graham Knop tokuhirom Tatsuhiko Miyagawa Christian Walde Leon Timmermans Peter Rabbitson Steve Hay Jerry D. Hedden Craig A. Berry Mitchell Steinbrunner Edward Zborowski Gareth Harper James Raspass 'BinGOs' Williams Josh Jore Kent Fredric + +=over 4 + +=item * + +Karen Etheridge <ether@cpan.org> + +=item * + +David Golden <dagolden@cpan.org> + +=item * + +Vincent Pit <perl@profvince.com> + +=item * + +Matt S Trout <mst@shadowcat.co.uk> + +=item * + +Chris Nehren <apeiron@cpan.org> + +=item * + +Tomas Doran <bobtfish@bobtfish.net> + +=item * + +Olivier Mengué <dolmen@cpan.org> + +=item * + +Graham Knop <haarg@haarg.org> + +=item * + +tokuhirom <tokuhirom@gmail.com> + +=item * + +Tatsuhiko Miyagawa <miyagawa@bulknews.net> + +=item * + +Christian Walde <walde.christian@googlemail.com> + +=item * + +Leon Timmermans <fawaka@gmail.com> + +=item * + +Peter Rabbitson <ribasushi@cpan.org> + +=item * + +Steve Hay <steve.m.hay@googlemail.com> + +=item * + +Jerry D. Hedden <jdhedden@cpan.org> + +=item * + +Craig A. Berry <cberry@cpan.org> + +=item * + +Craig A. Berry <craigberry@mac.com> + +=item * + +David Mitchell <davem@iabyn.com> + +=item * + +David Steinbrunner <dsteinbrunner@pobox.com> + +=item * + +Edward Zborowski <ed@rubensteintech.com> + +=item * + +Gareth Harper <gareth@broadbean.com> + +=item * + +James Raspass <jraspass@gmail.com> + +=item * + +Chris 'BinGOs' Williams <chris@bingosnet.co.uk> + +=item * + +Josh Jore <jjore@cpan.org> + +=item * + +Kent Fredric <kentnl@cpan.org> + +=back + +=head1 COPYRIGHT & LICENSE + +Original code Copyright (c) 2001-2011 Ken Williams. +Additional code Copyright (c) 2010-2011 Matt Trout and David Golden. +All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/NEXT.pm b/data/miniconda3/lib/perl5/core_perl/NEXT.pm new file mode 100644 index 0000000000000000000000000000000000000000..a2ad070f6512c2296f544dbfded252cf485ce536 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/NEXT.pm @@ -0,0 +1,579 @@ +package NEXT; + +use Carp; +use strict; +use warnings; +use overload (); + +our $VERSION = '0.67_01'; + +sub NEXT::ELSEWHERE::ancestors +{ + my @inlist = shift; + my @outlist = (); + while (my $next = shift @inlist) { + push @outlist, $next; + no strict 'refs'; + unshift @inlist, @{"$outlist[-1]::ISA"}; + } + return @outlist; +} + +sub NEXT::ELSEWHERE::ordered_ancestors +{ + my @inlist = shift; + my @outlist = (); + while (my $next = shift @inlist) { + push @outlist, $next; + no strict 'refs'; + push @inlist, @{"$outlist[-1]::ISA"}; + } + return sort { $a->isa($b) ? -1 + : $b->isa($a) ? +1 + : 0 } @outlist; +} + +sub NEXT::ELSEWHERE::buildAUTOLOAD +{ + my $autoload_name = caller() . '::AUTOLOAD'; + + no strict 'refs'; + *{$autoload_name} = sub { + my ($self) = @_; + my $depth = 1; + until (((caller($depth))[3]||q{}) !~ /^\(eval\)$/) { $depth++ } + my $caller = (caller($depth))[3]; + my $wanted = $NEXT::AUTOLOAD || $autoload_name; + undef $NEXT::AUTOLOAD; + my ($caller_class, $caller_method) = do { $caller =~ m{(.*)::(.*)}g }; + my ($wanted_class, $wanted_method) = do { $wanted =~ m{(.*)::(.*)}g }; + croak "Can't call $wanted from $caller" + unless $caller_method eq $wanted_method; + + my $key = ref $self && overload::Overloaded($self) + ? overload::StrVal($self) : $self; + + local ($NEXT::NEXT{$key,$wanted_method}, $NEXT::SEEN) = + ($NEXT::NEXT{$key,$wanted_method}, $NEXT::SEEN); + + unless ($NEXT::NEXT{$key,$wanted_method}) { + my @forebears = + NEXT::ELSEWHERE::ancestors ref $self || $self, + $wanted_class; + while (@forebears) { + last if shift @forebears eq $caller_class + } + no strict 'refs'; + # Use *{"..."} when first accessing the CODE slot, to make sure + # any typeglob stub is upgraded to a full typeglob. + @{$NEXT::NEXT{$key,$wanted_method}} = + map { + my $stash = \%{"${_}::"}; + ($stash->{$caller_method} && (*{"${_}::$caller_method"}{CODE})) + ? *{$stash->{$caller_method}}{CODE} + : () } @forebears + unless $wanted_method eq 'AUTOLOAD'; + @{$NEXT::NEXT{$key,$wanted_method}} = + map { + my $stash = \%{"${_}::"}; + ($stash->{AUTOLOAD} && (*{"${_}::AUTOLOAD"}{CODE})) + ? "${_}::AUTOLOAD" + : () } @forebears + unless @{$NEXT::NEXT{$key,$wanted_method}||[]}; + $NEXT::SEEN->{$key,*{$caller}{CODE}}++; + } + my $call_method = shift @{$NEXT::NEXT{$key,$wanted_method}}; + while (do { $wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/ } + && defined $call_method + && $NEXT::SEEN->{$key,$call_method}++) { + $call_method = shift @{$NEXT::NEXT{$key,$wanted_method}}; + } + unless (defined $call_method) { + return unless do { $wanted_class =~ /^NEXT:.*:ACTUAL/ }; + (local $Carp::CarpLevel)++; + croak qq(Can't locate object method "$wanted_method" ), + qq(via package "$caller_class"); + }; + return $self->$call_method(@_[1..$#_]) if ref $call_method eq 'CODE'; + no strict 'refs'; + do { ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*::// } + if $wanted_method eq 'AUTOLOAD'; + $$call_method = $caller_class."::NEXT::".$wanted_method; + return $call_method->(@_); + }; +} + +no strict 'vars'; +package NEXT; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::UNSEEN; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::DISTINCT; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::ACTUAL::UNSEEN; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::ACTUAL::DISTINCT; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::UNSEEN::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); +package NEXT::DISTINCT::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); + +package + EVERY; + +sub EVERY::ELSEWHERE::buildAUTOLOAD { + my $autoload_name = caller() . '::AUTOLOAD'; + + no strict 'refs'; + *{$autoload_name} = sub { + my ($self) = @_; + my $depth = 1; + until (((caller($depth))[3]||q{}) !~ /^\(eval\)$/) { $depth++ } + my $caller = (caller($depth))[3]; + my $wanted = $EVERY::AUTOLOAD || $autoload_name; + undef $EVERY::AUTOLOAD; + my ($wanted_class, $wanted_method) = do { $wanted =~ m{(.*)::(.*)}g }; + + my $key = ref($self) && overload::Overloaded($self) + ? overload::StrVal($self) : $self; + + local $NEXT::ALREADY_IN_EVERY{$key,$wanted_method} = + $NEXT::ALREADY_IN_EVERY{$key,$wanted_method}; + + return if $NEXT::ALREADY_IN_EVERY{$key,$wanted_method}++; + + my @forebears = NEXT::ELSEWHERE::ordered_ancestors ref $self || $self, + $wanted_class; + @forebears = reverse @forebears if do { $wanted_class =~ /\bLAST\b/ }; + no strict 'refs'; + my %seen; + my @every = map { my $sub = "${_}::$wanted_method"; + !*{$sub}{CODE} || $seen{$sub}++ ? () : $sub + } @forebears + unless $wanted_method eq 'AUTOLOAD'; + + my $want = wantarray; + if (@every) { + if ($want) { + return map {($_, [$self->$_(@_[1..$#_])])} @every; + } + elsif (defined $want) { + return { map {($_, scalar($self->$_(@_[1..$#_])))} + @every + }; + } + else { + $self->$_(@_[1..$#_]) for @every; + return; + } + } + + @every = map { my $sub = "${_}::AUTOLOAD"; + !*{$sub}{CODE} || $seen{$sub}++ ? () : "${_}::AUTOLOAD" + } @forebears; + if ($want) { + return map { $$_ = ref($self)."::EVERY::".$wanted_method; + ($_, [$self->$_(@_[1..$#_])]); + } @every; + } + elsif (defined $want) { + return { map { $$_ = ref($self)."::EVERY::".$wanted_method; + ($_, scalar($self->$_(@_[1..$#_]))) + } @every + }; + } + else { + for (@every) { + $$_ = ref($self)."::EVERY::".$wanted_method; + $self->$_(@_[1..$#_]); + } + return; + } + }; +} + +package EVERY::LAST; @ISA = 'EVERY'; EVERY::ELSEWHERE::buildAUTOLOAD(); +package + EVERY; @ISA = 'NEXT'; EVERY::ELSEWHERE::buildAUTOLOAD(); + +1; + +__END__ + +=head1 NAME + +NEXT - Provide a pseudo-class NEXT (et al) that allows method redispatch + +=head1 SYNOPSIS + + use NEXT; + + package P; + sub P::method { print "$_[0]: P method\n"; $_[0]->NEXT::method() } + sub P::DESTROY { print "$_[0]: P dtor\n"; $_[0]->NEXT::DESTROY() } + + package Q; + use base qw( P ); + sub Q::AUTOLOAD { print "$_[0]: Q AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub Q::DESTROY { print "$_[0]: Q dtor\n"; $_[0]->NEXT::DESTROY() } + + package R; + sub R::method { print "$_[0]: R method\n"; $_[0]->NEXT::method() } + sub R::AUTOLOAD { print "$_[0]: R AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub R::DESTROY { print "$_[0]: R dtor\n"; $_[0]->NEXT::DESTROY() } + + package S; + use base qw( Q R ); + sub S::method { print "$_[0]: S method\n"; $_[0]->NEXT::method() } + sub S::AUTOLOAD { print "$_[0]: S AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub S::DESTROY { print "$_[0]: S dtor\n"; $_[0]->NEXT::DESTROY() } + + package main; + + my $obj = bless {}, "S"; + + $obj->method(); # Calls S::method, P::method, R::method + $obj->missing_method(); # Calls S::AUTOLOAD, Q::AUTOLOAD, R::AUTOLOAD + + # Clean-up calls S::DESTROY, Q::DESTROY, P::DESTROY, R::DESTROY + + + +=head1 DESCRIPTION + +The C<NEXT> module adds a pseudoclass named C<NEXT> to any program +that uses it. If a method C<m> calls C<$self-E<gt>NEXT::m()>, the call to +C<m> is redispatched as if the calling method had not originally been found. + +B<Note:> before using this module, +you should look at L<next::method|https://metacpan.org/pod/mro#next::method> +in the core L<mro> module. +C<mro> has been a core module since Perl 5.9.5. + +In other words, a call to C<$self-E<gt>NEXT::m()> resumes the depth-first, +left-to-right search of C<$self>'s class hierarchy that resulted in the +original call to C<m>. + +Note that this is not the same thing as C<$self-E<gt>SUPER::m()>, which +begins a new dispatch that is restricted to searching the ancestors +of the current class. C<$self-E<gt>NEXT::m()> can backtrack +past the current class -- to look for a suitable method in other +ancestors of C<$self> -- whereas C<$self-E<gt>SUPER::m()> cannot. + +A typical use would be in the destructors of a class hierarchy, +as illustrated in the SYNOPSIS above. Each class in the hierarchy +has a DESTROY method that performs some class-specific action +and then redispatches the call up the hierarchy. As a result, +when an object of class S is destroyed, the destructors of I<all> +its parent classes are called (in depth-first, left-to-right order). + +Another typical use of redispatch would be in C<AUTOLOAD>'ed methods. +If such a method determined that it was not able to handle a +particular call, it might choose to redispatch that call, in the +hope that some other C<AUTOLOAD> (above it, or to its left) might +do better. + +By default, if a redispatch attempt fails to find another method +elsewhere in the objects class hierarchy, it quietly gives up and does +nothing (but see L<"Enforcing redispatch">). This gracious acquiescence +is also unlike the (generally annoying) behaviour of C<SUPER>, which +throws an exception if it cannot redispatch. + +Note that it is a fatal error for any method (including C<AUTOLOAD>) +to attempt to redispatch any method that does not have the +same name. For example: + + sub S::oops { print "oops!\n"; $_[0]->NEXT::other_method() } + + +=head2 Enforcing redispatch + +It is possible to make C<NEXT> redispatch more demandingly (i.e. like +C<SUPER> does), so that the redispatch throws an exception if it cannot +find a "next" method to call. + +To do this, simple invoke the redispatch as: + + $self->NEXT::ACTUAL::method(); + +rather than: + + $self->NEXT::method(); + +The C<ACTUAL> tells C<NEXT> that there must actually be a next method to call, +or it should throw an exception. + +C<NEXT::ACTUAL> is most commonly used in C<AUTOLOAD> methods, as a means to +decline an C<AUTOLOAD> request, but preserve the normal exception-on-failure +semantics: + + sub AUTOLOAD { + if ($AUTOLOAD =~ /foo|bar/) { + # handle here + } + else { # try elsewhere + shift()->NEXT::ACTUAL::AUTOLOAD(@_); + } + } + +By using C<NEXT::ACTUAL>, if there is no other C<AUTOLOAD> to handle the +method call, an exception will be thrown (as usually happens in the absence of +a suitable C<AUTOLOAD>). + + +=head2 Avoiding repetitions + +If C<NEXT> redispatching is used in the methods of a "diamond" class hierarchy: + + # A B + # / \ / + # C D + # \ / + # E + + use NEXT; + + package A; + sub foo { print "called A::foo\n"; shift->NEXT::foo() } + + package B; + sub foo { print "called B::foo\n"; shift->NEXT::foo() } + + package C; @ISA = qw( A ); + sub foo { print "called C::foo\n"; shift->NEXT::foo() } + + package D; @ISA = qw(A B); + sub foo { print "called D::foo\n"; shift->NEXT::foo() } + + package E; @ISA = qw(C D); + sub foo { print "called E::foo\n"; shift->NEXT::foo() } + + E->foo(); + +then derived classes may (re-)inherit base-class methods through two or +more distinct paths (e.g. in the way C<E> inherits C<A::foo> twice -- +through C<C> and C<D>). In such cases, a sequence of C<NEXT> redispatches +will invoke the multiply inherited method as many times as it is +inherited. For example, the above code prints: + + called E::foo + called C::foo + called A::foo + called D::foo + called A::foo + called B::foo + +(i.e. C<A::foo> is called twice). + +In some cases this I<may> be the desired effect within a diamond hierarchy, +but in others (e.g. for destructors) it may be more appropriate to +call each method only once during a sequence of redispatches. + +To cover such cases, you can redispatch methods via: + + $self->NEXT::DISTINCT::method(); + +rather than: + + $self->NEXT::method(); + +This causes the redispatcher to only visit each distinct C<method> method +once. That is, to skip any classes in the hierarchy that it has +already visited during redispatch. So, for example, if the +previous example were rewritten: + + package A; + sub foo { print "called A::foo\n"; shift->NEXT::DISTINCT::foo() } + + package B; + sub foo { print "called B::foo\n"; shift->NEXT::DISTINCT::foo() } + + package C; @ISA = qw( A ); + sub foo { print "called C::foo\n"; shift->NEXT::DISTINCT::foo() } + + package D; @ISA = qw(A B); + sub foo { print "called D::foo\n"; shift->NEXT::DISTINCT::foo() } + + package E; @ISA = qw(C D); + sub foo { print "called E::foo\n"; shift->NEXT::DISTINCT::foo() } + + E->foo(); + +then it would print: + + called E::foo + called C::foo + called A::foo + called D::foo + called B::foo + +and omit the second call to C<A::foo> (since it would not be distinct +from the first call to C<A::foo>). + +Note that you can also use: + + $self->NEXT::DISTINCT::ACTUAL::method(); + +or: + + $self->NEXT::ACTUAL::DISTINCT::method(); + +to get both unique invocation I<and> exception-on-failure. + +Note that, for historical compatibility, you can also use +C<NEXT::UNSEEN> instead of C<NEXT::DISTINCT>. + + +=head2 Invoking all versions of a method with a single call + +Yet another pseudo-class that C<NEXT> provides is C<EVERY>. +Its behaviour is considerably simpler than that of the C<NEXT> family. +A call to: + + $obj->EVERY::foo(); + +calls I<every> method named C<foo> that the object in C<$obj> has inherited. +That is: + + use NEXT; + + package A; @ISA = qw(B D X); + sub foo { print "A::foo " } + + package B; @ISA = qw(D X); + sub foo { print "B::foo " } + + package X; @ISA = qw(D); + sub foo { print "X::foo " } + + package D; + sub foo { print "D::foo " } + + package main; + + my $obj = bless {}, 'A'; + $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo + +Prefixing a method call with C<EVERY::> causes every method in the +object's hierarchy with that name to be invoked. As the above example +illustrates, they are not called in Perl's usual "left-most-depth-first" +order. Instead, they are called "breadth-first-dependency-wise". + +That means that the inheritance tree of the object is traversed breadth-first +and the resulting order of classes is used as the sequence in which methods +are called. However, that sequence is modified by imposing a rule that the +appropriate method of a derived class must be called before the same method of +any ancestral class. That's why, in the above example, C<X::foo> is called +before C<D::foo>, even though C<D> comes before C<X> in C<@B::ISA>. + +In general, there's no need to worry about the order of calls. They will be +left-to-right, breadth-first, most-derived-first. This works perfectly for +most inherited methods (including destructors), but is inappropriate for +some kinds of methods (such as constructors, cloners, debuggers, and +initializers) where it's more appropriate that the least-derived methods be +called first (as more-derived methods may rely on the behaviour of their +"ancestors"). In that case, instead of using the C<EVERY> pseudo-class: + + $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo + +you can use the C<EVERY::LAST> pseudo-class: + + $obj->EVERY::LAST::foo(); # prints" D::foo X::foo B::foo A::foo + +which reverses the order of method call. + +Whichever version is used, the actual methods are called in the same +context (list, scalar, or void) as the original call via C<EVERY>, and return: + +=over + +=item * + +A hash of array references in list context. Each entry of the hash has the +fully qualified method name as its key and a reference to an array containing +the method's list-context return values as its value. + +=item * + +A reference to a hash of scalar values in scalar context. Each entry of the hash has the +fully qualified method name as its key and the method's scalar-context return values as its value. + +=item * + +Nothing in void context (obviously). + +=back + +=head2 Using C<EVERY> methods + +The typical way to use an C<EVERY> call is to wrap it in another base +method, that all classes inherit. For example, to ensure that every +destructor an object inherits is actually called (as opposed to just the +left-most-depth-first-est one): + + package Base; + sub DESTROY { $_[0]->EVERY::Destroy } + + package Derived1; + use base 'Base'; + sub Destroy {...} + + package Derived2; + use base 'Base', 'Derived1'; + sub Destroy {...} + +et cetera. Every derived class than needs its own clean-up +behaviour simply adds its own C<Destroy> method (I<not> a C<DESTROY> method), +which the call to C<EVERY::LAST::Destroy> in the inherited destructor +then correctly picks up. + +Likewise, to create a class hierarchy in which every initializer inherited by +a new object is invoked: + + package Base; + sub new { + my ($class, %args) = @_; + my $obj = bless {}, $class; + $obj->EVERY::LAST::Init(\%args); + } + + package Derived1; + use base 'Base'; + sub Init { + my ($argsref) = @_; + ... + } + + package Derived2; + use base 'Base', 'Derived1'; + sub Init { + my ($argsref) = @_; + ... + } + +et cetera. Every derived class than needs some additional initialization +behaviour simply adds its own C<Init> method (I<not> a C<new> method), +which the call to C<EVERY::LAST::Init> in the inherited constructor +then correctly picks up. + +=head1 SEE ALSO + +L<mro> +(in particular L<next::method|https://metacpan.org/pod/mro#next::method>), +which has been a core module since Perl 5.9.5. + +=head1 AUTHOR + +Damian Conway (damian@conway.org) + +=head1 BUGS AND IRRITATIONS + +Because it's a module, not an integral part of the interpreter, C<NEXT> +has to guess where the surrounding call was found in the method +look-up sequence. In the presence of diamond inheritance patterns +it occasionally guesses wrong. + +It's also too slow (despite caching). + +Comment, suggestions, and patches welcome. + +=head1 COPYRIGHT + + Copyright (c) 2000-2001, Damian Conway. All Rights Reserved. + This module is free software. It may be used, redistributed + and/or modified under the same terms as Perl itself. diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Cmd.pm b/data/miniconda3/lib/perl5/core_perl/Net/Cmd.pm new file mode 100644 index 0000000000000000000000000000000000000000..b695f64dd0563929dc6619c4ea716f62eb1eb279 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Cmd.pm @@ -0,0 +1,873 @@ +# Net::Cmd.pm +# +# Copyright (C) 1995-2006 Graham Barr. All rights reserved. +# Copyright (C) 2013-2016 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::Cmd; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use Exporter; +use Symbol 'gensym'; +use Errno 'EINTR'; + +BEGIN { + if ($^O eq 'os390') { + require Convert::EBCDIC; + + # Convert::EBCDIC->import; + } +} + +our $VERSION = "3.11"; +our @ISA = qw(Exporter); +our @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); + +use constant CMD_INFO => 1; +use constant CMD_OK => 2; +use constant CMD_MORE => 3; +use constant CMD_REJECT => 4; +use constant CMD_ERROR => 5; +use constant CMD_PENDING => 0; + +use constant DEF_REPLY_CODE => 421; + +my %debug = (); + +my $tr = $^O eq 'os390' ? Convert::EBCDIC->new() : undef; + +sub toebcdic { + my $cmd = shift; + + unless (exists ${*$cmd}{'net_cmd_asciipeer'}) { + my $string = $_[0]; + my $ebcdicstr = $tr->toebcdic($string); + ${*$cmd}{'net_cmd_asciipeer'} = $string !~ /^\d+/ && $ebcdicstr =~ /^\d+/; + } + + ${*$cmd}{'net_cmd_asciipeer'} + ? $tr->toebcdic($_[0]) + : $_[0]; +} + + +sub toascii { + my $cmd = shift; + ${*$cmd}{'net_cmd_asciipeer'} + ? $tr->toascii($_[0]) + : $_[0]; +} + + +sub _print_isa { + no strict 'refs'; ## no critic (TestingAndDebugging::ProhibitNoStrict) + + my $pkg = shift; + my $cmd = $pkg; + + $debug{$pkg} ||= 0; + + my %done = (); + my @do = ($pkg); + my %spc = ($pkg, ""); + + while ($pkg = shift @do) { + next if defined $done{$pkg}; + + $done{$pkg} = 1; + + my $v = + defined ${"${pkg}::VERSION"} + ? "(" . ${"${pkg}::VERSION"} . ")" + : ""; + + my $spc = $spc{$pkg}; + $cmd->debug_print(1, "${spc}${pkg}${v}\n"); + + if (@{"${pkg}::ISA"}) { + @spc{@{"${pkg}::ISA"}} = (" " . $spc{$pkg}) x @{"${pkg}::ISA"}; + unshift(@do, @{"${pkg}::ISA"}); + } + } +} + + +sub debug { + @_ == 1 or @_ == 2 or croak 'usage: $obj->debug([LEVEL])'; + + my ($cmd, $level) = @_; + my $pkg = ref($cmd) || $cmd; + my $oldval = 0; + + if (ref($cmd)) { + $oldval = ${*$cmd}{'net_cmd_debug'} || 0; + } + else { + $oldval = $debug{$pkg} || 0; + } + + return $oldval + unless @_ == 2; + + $level = $debug{$pkg} || 0 + unless defined $level; + + _print_isa($pkg) + if ($level && !exists $debug{$pkg}); + + if (ref($cmd)) { + ${*$cmd}{'net_cmd_debug'} = $level; + } + else { + $debug{$pkg} = $level; + } + + $oldval; +} + + +sub message { + @_ == 1 or croak 'usage: $obj->message()'; + + my $cmd = shift; + + wantarray + ? @{${*$cmd}{'net_cmd_resp'}} + : join("", @{${*$cmd}{'net_cmd_resp'}}); +} + + +sub debug_text { $_[2] } + + +sub debug_print { + my ($cmd, $out, $text) = @_; + print STDERR $cmd, ($out ? '>>> ' : '<<< '), $cmd->debug_text($out, $text); +} + + +sub code { + @_ == 1 or croak 'usage: $obj->code()'; + + my $cmd = shift; + + ${*$cmd}{'net_cmd_code'} = $cmd->DEF_REPLY_CODE + unless exists ${*$cmd}{'net_cmd_code'}; + + ${*$cmd}{'net_cmd_code'}; +} + + +sub status { + @_ == 1 or croak 'usage: $obj->status()'; + + my $cmd = shift; + + substr(${*$cmd}{'net_cmd_code'}, 0, 1); +} + + +sub set_status { + @_ == 3 or croak 'usage: $obj->set_status(CODE, MESSAGE)'; + + my $cmd = shift; + my ($code, $resp) = @_; + + $resp = defined $resp ? [$resp] : [] + unless ref($resp); + + (${*$cmd}{'net_cmd_code'}, ${*$cmd}{'net_cmd_resp'}) = ($code, $resp); + + 1; +} + +sub _syswrite_with_timeout { + my $cmd = shift; + my $line = shift; + + my $len = length($line); + my $offset = 0; + my $win = ""; + vec($win, fileno($cmd), 1) = 1; + my $timeout = $cmd->timeout || undef; + my $initial = time; + my $pending = $timeout; + + local $SIG{PIPE} = 'IGNORE' unless $^O eq 'MacOS'; + + while ($len) { + my $wout; + my $nfound = select(undef, $wout = $win, undef, $pending); + if ((defined $nfound and $nfound > 0) or -f $cmd) # -f for testing on win32 + { + my $w = syswrite($cmd, $line, $len, $offset); + if (! defined($w) ) { + my $err = $!; + $cmd->close; + $cmd->_set_status_closed($err); + return; + } + $len -= $w; + $offset += $w; + } + elsif ($nfound == -1) { + if ( $! == EINTR ) { + if ( defined($timeout) ) { + redo if ($pending = $timeout - ( time - $initial ) ) > 0; + $cmd->_set_status_timeout; + return; + } + redo; + } + my $err = $!; + $cmd->close; + $cmd->_set_status_closed($err); + return; + } + else { + $cmd->_set_status_timeout; + return; + } + } + + return 1; +} + +sub _set_status_timeout { + my $cmd = shift; + my $pkg = ref($cmd) || $cmd; + + $cmd->set_status($cmd->DEF_REPLY_CODE, "[$pkg] Timeout"); + carp(ref($cmd) . ": " . (caller(1))[3] . "(): timeout") if $cmd->debug; +} + +sub _set_status_closed { + my $cmd = shift; + my $err = shift; + my $pkg = ref($cmd) || $cmd; + + $cmd->set_status($cmd->DEF_REPLY_CODE, "[$pkg] Connection closed"); + carp(ref($cmd) . ": " . (caller(1))[3] + . "(): unexpected EOF on command channel: $err") if $cmd->debug; +} + +sub _is_closed { + my $cmd = shift; + if (!defined fileno($cmd)) { + $cmd->_set_status_closed($!); + return 1; + } + return 0; +} + +sub command { + my $cmd = shift; + + return $cmd + if $cmd->_is_closed; + + $cmd->dataend() + if (exists ${*$cmd}{'net_cmd_last_ch'}); + + if (scalar(@_)) { + my $str = join( + " ", + map { + /\n/ + ? do { my $n = $_; $n =~ tr/\n/ /; $n } + : $_; + } @_ + ); + $str = $cmd->toascii($str) if $tr; + $str .= "\015\012"; + + $cmd->debug_print(1, $str) + if ($cmd->debug); + + # though documented to return undef on failure, the legacy behavior + # was to return $cmd even on failure, so this odd construct does that + $cmd->_syswrite_with_timeout($str) + or return $cmd; + } + + $cmd; +} + + +sub ok { + @_ == 1 or croak 'usage: $obj->ok()'; + + my $code = $_[0]->code; + 0 < $code && $code < 400; +} + + +sub unsupported { + my $cmd = shift; + + $cmd->set_status(580, 'Unsupported command'); + + 0; +} + + +sub getline { + my $cmd = shift; + + ${*$cmd}{'net_cmd_lines'} ||= []; + + return shift @{${*$cmd}{'net_cmd_lines'}} + if scalar(@{${*$cmd}{'net_cmd_lines'}}); + + my $partial = defined(${*$cmd}{'net_cmd_partial'}) ? ${*$cmd}{'net_cmd_partial'} : ""; + + return + if $cmd->_is_closed; + + my $fd = fileno($cmd); + my $rin = ""; + vec($rin, $fd, 1) = 1; + + my $buf; + + until (scalar(@{${*$cmd}{'net_cmd_lines'}})) { + my $timeout = $cmd->timeout || undef; + my $rout; + + my $select_ret = select($rout = $rin, undef, undef, $timeout); + if ($select_ret > 0) { + unless (sysread($cmd, $buf = "", 1024)) { + my $err = $!; + $cmd->close; + $cmd->_set_status_closed($err); + return; + } + + substr($buf, 0, 0) = $partial; ## prepend from last sysread + + my @buf = split(/\015?\012/, $buf, -1); ## break into lines + + $partial = pop @buf; + + push(@{${*$cmd}{'net_cmd_lines'}}, map {"$_\n"} @buf); + + } + else { + $cmd->_set_status_timeout; + return; + } + } + + ${*$cmd}{'net_cmd_partial'} = $partial; + + if ($tr) { + foreach my $ln (@{${*$cmd}{'net_cmd_lines'}}) { + $ln = $cmd->toebcdic($ln); + } + } + + shift @{${*$cmd}{'net_cmd_lines'}}; +} + + +sub ungetline { + my ($cmd, $str) = @_; + + ${*$cmd}{'net_cmd_lines'} ||= []; + unshift(@{${*$cmd}{'net_cmd_lines'}}, $str); +} + + +sub parse_response { + return () + unless $_[1] =~ s/^(\d\d\d)(.?)//o; + ($1, $2 eq "-"); +} + + +sub response { + my $cmd = shift; + my ($code, $more) = (undef) x 2; + + $cmd->set_status($cmd->DEF_REPLY_CODE, undef); # initialize the response + + while (1) { + my $str = $cmd->getline(); + + return CMD_ERROR + unless defined($str); + + $cmd->debug_print(0, $str) + if ($cmd->debug); + + ($code, $more) = $cmd->parse_response($str); + unless (defined $code) { + carp("$cmd: response(): parse error in '$str'") if ($cmd->debug); + $cmd->ungetline($str); + $@ = $str; # $@ used as tunneling hack + return CMD_ERROR; + } + + ${*$cmd}{'net_cmd_code'} = $code; + + push(@{${*$cmd}{'net_cmd_resp'}}, $str); + + last unless ($more); + } + + return unless defined $code; + substr($code, 0, 1); +} + + +sub read_until_dot { + my $cmd = shift; + my $fh = shift; + my $arr = []; + + while (1) { + my $str = $cmd->getline() or return; + + $cmd->debug_print(0, $str) + if ($cmd->debug & 4); + + last if ($str =~ /^\.\r?\n/o); + + $str =~ s/^\.\././o; + + if (defined $fh) { + print $fh $str; + } + else { + push(@$arr, $str); + } + } + + $arr; +} + + +sub datasend { + my $cmd = shift; + my $arr = @_ == 1 && ref($_[0]) ? $_[0] : \@_; + my $line = join("", @$arr); + + # Perls < 5.10.1 (with the exception of 5.8.9) have a performance problem with + # the substitutions below when dealing with strings stored internally in + # UTF-8, so downgrade them (if possible). + # Data passed to datasend() should be encoded to octets upstream already so + # shouldn't even have the UTF-8 flag on to start with, but if it so happens + # that the octets are stored in an upgraded string (as can sometimes occur) + # then they would still downgrade without fail anyway. + # Only Unicode codepoints > 0xFF stored in an upgraded string will fail to + # downgrade. We fail silently in that case, and a "Wide character in print" + # warning will be emitted later by syswrite(). + utf8::downgrade($line, 1) if $] < 5.010001 && $] != 5.008009; + + return 0 + if $cmd->_is_closed; + + my $last_ch = ${*$cmd}{'net_cmd_last_ch'}; + + # We have not send anything yet, so last_ch = "\012" means we are at the start of a line + $last_ch = ${*$cmd}{'net_cmd_last_ch'} = "\012" unless defined $last_ch; + + return 1 unless length $line; + + if ($cmd->debug) { + foreach my $b (split(/\n/, $line)) { + $cmd->debug_print(1, "$b\n"); + } + } + + $line =~ tr/\r\n/\015\012/ unless "\r" eq "\015"; + + my $first_ch = ''; + + if ($last_ch eq "\015") { + # Remove \012 so it does not get prefixed with another \015 below + # and escape the . if there is one following it because the fixup + # below will not find it + $first_ch = "\012" if $line =~ s/^\012(\.?)/$1$1/; + } + elsif ($last_ch eq "\012") { + # Fixup below will not find the . as the first character of the buffer + $first_ch = "." if $line =~ /^\./; + } + + $line =~ s/\015?\012(\.?)/\015\012$1$1/sg; + + substr($line, 0, 0) = $first_ch; + + ${*$cmd}{'net_cmd_last_ch'} = substr($line, -1, 1); + + $cmd->_syswrite_with_timeout($line) + or return; + + 1; +} + + +sub rawdatasend { + my $cmd = shift; + my $arr = @_ == 1 && ref($_[0]) ? $_[0] : \@_; + my $line = join("", @$arr); + + return 0 + if $cmd->_is_closed; + + return 1 + unless length($line); + + if ($cmd->debug) { + my $b = "$cmd>>> "; + print STDERR $b, join("\n$b", split(/\n/, $line)), "\n"; + } + + $cmd->_syswrite_with_timeout($line) + or return; + + 1; +} + + +sub dataend { + my $cmd = shift; + + return 0 + if $cmd->_is_closed; + + my $ch = ${*$cmd}{'net_cmd_last_ch'}; + my $tosend; + + if (!defined $ch) { + return 1; + } + elsif ($ch ne "\012") { + $tosend = "\015\012"; + } + + $tosend .= ".\015\012"; + + $cmd->debug_print(1, ".\n") + if ($cmd->debug); + + $cmd->_syswrite_with_timeout($tosend) + or return 0; + + delete ${*$cmd}{'net_cmd_last_ch'}; + + $cmd->response() == CMD_OK; +} + +# read and write to tied filehandle +sub tied_fh { + my $cmd = shift; + ${*$cmd}{'net_cmd_readbuf'} = ''; + my $fh = gensym(); + tie *$fh, ref($cmd), $cmd; + return $fh; +} + +# tie to myself +sub TIEHANDLE { + my $class = shift; + my $cmd = shift; + return $cmd; +} + +# Tied filehandle read. Reads requested data length, returning +# end-of-file when the dot is encountered. +sub READ { + my $cmd = shift; + my ($len, $offset) = @_[1, 2]; + return unless exists ${*$cmd}{'net_cmd_readbuf'}; + my $done = 0; + while (!$done and length(${*$cmd}{'net_cmd_readbuf'}) < $len) { + ${*$cmd}{'net_cmd_readbuf'} .= $cmd->getline() or return; + $done++ if ${*$cmd}{'net_cmd_readbuf'} =~ s/^\.\r?\n\Z//m; + } + + $_[0] = ''; + substr($_[0], $offset + 0) = substr(${*$cmd}{'net_cmd_readbuf'}, 0, $len); + substr(${*$cmd}{'net_cmd_readbuf'}, 0, $len) = ''; + delete ${*$cmd}{'net_cmd_readbuf'} if $done; + + return length $_[0]; +} + + +sub READLINE { + my $cmd = shift; + + # in this context, we use the presence of readbuf to + # indicate that we have not yet reached the eof + return unless exists ${*$cmd}{'net_cmd_readbuf'}; + my $line = $cmd->getline; + return if $line =~ /^\.\r?\n/; + $line; +} + + +sub PRINT { + my $cmd = shift; + my ($buf, $len, $offset) = @_; + $len ||= length($buf); + $offset += 0; + return unless $cmd->datasend(substr($buf, $offset, $len)); + ${*$cmd}{'net_cmd_sending'}++; # flag that we should call dataend() + return $len; +} + + +sub CLOSE { + my $cmd = shift; + my $r = exists(${*$cmd}{'net_cmd_sending'}) ? $cmd->dataend : 1; + delete ${*$cmd}{'net_cmd_readbuf'}; + delete ${*$cmd}{'net_cmd_sending'}; + $r; +} + +1; + +__END__ + + +=head1 NAME + +Net::Cmd - Network Command class (as used by FTP, SMTP etc) + +=head1 SYNOPSIS + + use Net::Cmd; + + @ISA = qw(Net::Cmd); + +=head1 DESCRIPTION + +C<Net::Cmd> is a collection of methods that can be inherited by a sub-class +of C<IO::Socket::INET>. These methods implement the functionality required for a +command based protocol, for example FTP and SMTP. + +If your sub-class does not also derive from C<IO::Socket::INET> or similar (e.g. +C<IO::Socket::IP>, C<IO::Socket::INET6> or C<IO::Socket::SSL>) then you must +provide the following methods by other means yourself: C<close()> and +C<timeout()>. + +=head1 USER METHODS + +These methods provide a user interface to the C<Net::Cmd> object. + +=over 4 + +=item debug ( VALUE ) + +Set the level of debug information for this object. If C<VALUE> is not given +then the current state is returned. Otherwise the state is changed to +C<VALUE> and the previous state returned. + +Different packages +may implement different levels of debug but a non-zero value results in +copies of all commands and responses also being sent to STDERR. + +If C<VALUE> is C<undef> then the debug level will be set to the default +debug level for the class. + +This method can also be called as a I<static> method to set/get the default +debug level for a given class. + +=item message () + +Returns the text message returned from the last command. In a scalar +context it returns a single string, in a list context it will return +each line as a separate element. (See L<PSEUDO RESPONSES> below.) + +=item code () + +Returns the 3-digit code from the last command. If a command is pending +then the value 0 is returned. (See L<PSEUDO RESPONSES> below.) + +=item ok () + +Returns non-zero if the last code value was greater than zero and +less than 400. This holds true for most command servers. Servers +where this does not hold may override this method. + +=item status () + +Returns the most significant digit of the current status code. If a command +is pending then C<CMD_PENDING> is returned. + +=item datasend ( DATA ) + +Send data to the remote server, converting LF to CRLF. Any line starting +with a '.' will be prefixed with another '.'. +C<DATA> may be an array or a reference to an array. +The C<DATA> passed in must be encoded by the caller to octets of whatever +encoding is required, e.g. by using the Encode module's C<encode()> function. + +=item dataend () + +End the sending of data to the remote server. This is done by ensuring that +the data already sent ends with CRLF then sending '.CRLF' to end the +transmission. Once this data has been sent C<dataend> calls C<response> and +returns true if C<response> returns CMD_OK. + +=back + +=head1 CLASS METHODS + +These methods are not intended to be called by the user, but used or +over-ridden by a sub-class of C<Net::Cmd> + +=over 4 + +=item debug_print ( DIR, TEXT ) + +Print debugging information. C<DIR> denotes the direction I<true> being +data being sent to the server. Calls C<debug_text> before printing to +STDERR. + +=item debug_text ( DIR, TEXT ) + +This method is called to print debugging information. TEXT is +the text being sent. The method should return the text to be printed. + +This is primarily meant for the use of modules such as FTP where passwords +are sent, but we do not want to display them in the debugging information. + +=item command ( CMD [, ARGS, ... ]) + +Send a command to the command server. All arguments are first joined with +a space character and CRLF is appended, this string is then sent to the +command server. + +Returns undef upon failure. + +=item unsupported () + +Sets the status code to 580 and the response text to 'Unsupported command'. +Returns zero. + +=item response () + +Obtain a response from the server. Upon success the most significant digit +of the status code is returned. Upon failure, timeout etc., I<CMD_ERROR> is +returned. + +=item parse_response ( TEXT ) + +This method is called by C<response> as a method with one argument. It should +return an array of 2 values, the 3-digit status code and a flag which is true +when this is part of a multi-line response and this line is not the last. + +=item getline () + +Retrieve one line, delimited by CRLF, from the remote server. Returns I<undef> +upon failure. + +B<NOTE>: If you do use this method for any reason, please remember to add +some C<debug_print> calls into your method. + +=item ungetline ( TEXT ) + +Unget a line of text from the server. + +=item rawdatasend ( DATA ) + +Send data to the remote server without performing any conversions. C<DATA> +is a scalar. +As with C<datasend()>, the C<DATA> passed in must be encoded by the caller +to octets of whatever encoding is required, e.g. by using the Encode module's +C<encode()> function. + +=item read_until_dot () + +Read data from the remote server until a line consisting of a single '.'. +Any lines starting with '..' will have one of the '.'s removed. + +Returns a reference to a list containing the lines, or I<undef> upon failure. + +=item tied_fh () + +Returns a filehandle tied to the Net::Cmd object. After issuing a +command, you may read from this filehandle using read() or <>. The +filehandle will return EOF when the final dot is encountered. +Similarly, you may write to the filehandle in order to send data to +the server after issuing a command that expects data to be written. + +See the Net::POP3 and Net::SMTP modules for examples of this. + +=back + +=head1 PSEUDO RESPONSES + +Normally the values returned by C<message()> and C<code()> are +obtained from the remote server, but in a few circumstances, as +detailed below, C<Net::Cmd> will return values that it sets. You +can alter this behavior by overriding DEF_REPLY_CODE() to specify +a different default reply code, or overriding one of the specific +error handling methods below. + +=over 4 + +=item Initial value + +Before any command has executed or if an unexpected error occurs +C<code()> will return "421" (temporary connection failure) and +C<message()> will return undef. + +=item Connection closed + +If the underlying C<IO::Handle> is closed, or if there are +any read or write failures, the file handle will be forced closed, +and C<code()> will return "421" (temporary connection failure) +and C<message()> will return "[$pkg] Connection closed" +(where $pkg is the name of the class that subclassed C<Net::Cmd>). +The _set_status_closed() method can be overridden to set a different +message (by calling set_status()) or otherwise trap this error. + +=item Timeout + +If there is a read or write timeout C<code()> will return "421" +(temporary connection failure) and C<message()> will return +"[$pkg] Timeout" (where $pkg is the name of the class +that subclassed C<Net::Cmd>). The _set_status_timeout() method +can be overridden to set a different message (by calling set_status()) +or otherwise trap this error. + +=back + +=head1 EXPORTS + +C<Net::Cmd> exports six subroutines, five of these, C<CMD_INFO>, C<CMD_OK>, +C<CMD_MORE>, C<CMD_REJECT> and C<CMD_ERROR>, correspond to possible results +of C<response> and C<status>. The sixth is C<CMD_PENDING>. + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-2006 Graham Barr. All rights reserved. + +Copyright (C) 2013-2016 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Config.pm b/data/miniconda3/lib/perl5/core_perl/Net/Config.pm new file mode 100644 index 0000000000000000000000000000000000000000..4f822a40a45e6232359dbc2b5381142fc1aa09e1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Config.pm @@ -0,0 +1,345 @@ +# Net::Config.pm +# +# Copyright (C) 2000 Graham Barr. All rights reserved. +# Copyright (C) 2013-2014, 2016 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::Config; + +use 5.008001; + +use strict; +use warnings; + +use Exporter; +use Socket qw(inet_aton inet_ntoa); + +our @EXPORT = qw(%NetConfig); +our @ISA = qw(Net::LocalCfg Exporter); +our $VERSION = "3.11"; + +our($CONFIGURE, $LIBNET_CFG); + +eval { + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + local $SIG{__DIE__}; + require Net::LocalCfg; +}; + +our %NetConfig = ( + nntp_hosts => [], + snpp_hosts => [], + pop3_hosts => [], + smtp_hosts => [], + ph_hosts => [], + daytime_hosts => [], + time_hosts => [], + inet_domain => undef, + ftp_firewall => undef, + ftp_ext_passive => 1, + ftp_int_passive => 1, + test_hosts => 1, + test_exist => 1, +); + +# +# Try to get as much configuration info as possible from InternetConfig +# +{ +## no critic (BuiltinFunctions::ProhibitStringyEval) +$^O eq 'MacOS' and eval <<TRY_INTERNET_CONFIG; +use Mac::InternetConfig; + +{ +my %nc = ( + nntp_hosts => [ \$InternetConfig{ kICNNTPHost() } ], + pop3_hosts => [ \$InternetConfig{ kICMailAccount() } =~ /\@(.*)/ ], + smtp_hosts => [ \$InternetConfig{ kICSMTPHost() } ], + ftp_testhost => \$InternetConfig{ kICFTPHost() } ? \$InternetConfig{ kICFTPHost()} : undef, + ph_hosts => [ \$InternetConfig{ kICPhHost() } ], + ftp_ext_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, + ftp_int_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, + socks_hosts => + \$InternetConfig{ kICUseSocks() } ? [ \$InternetConfig{ kICSocksHost() } ] : [], + ftp_firewall => + \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [], +); +\@NetConfig{keys %nc} = values %nc; +} +TRY_INTERNET_CONFIG +} + +my $file = __FILE__; +my $ref; +$file =~ s/Config.pm/libnet.cfg/; +if (-f $file) { + $ref = eval { local $SIG{__DIE__}; do $file }; + if (ref($ref) eq 'HASH') { + %NetConfig = (%NetConfig, %{$ref}); + $LIBNET_CFG = $file; + } +} +if ($< == $> and !$CONFIGURE) { + my $home = eval { local $SIG{__DIE__}; (getpwuid($>))[7] } || $ENV{HOME}; + $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH} || '') if defined $ENV{HOMEDRIVE}; + if (defined $home) { + $file = $home . "/.libnetrc"; + $ref = eval { local $SIG{__DIE__}; do $file } if -f $file; + %NetConfig = (%NetConfig, %{$ref}) + if ref($ref) eq 'HASH'; + } +} +my ($k, $v); +while (($k, $v) = each %NetConfig) { + $NetConfig{$k} = [$v] + if ($k =~ /_hosts$/ and $k ne "test_hosts" and defined($v) and !ref($v)); +} + +# Take a hostname and determine if it is inside the firewall + + +sub requires_firewall { + shift; # ignore package + my $host = shift; + + return 0 unless defined $NetConfig{'ftp_firewall'}; + + $host = inet_aton($host) or return -1; + $host = inet_ntoa($host); + + if (exists $NetConfig{'local_netmask'}) { + my $quad = unpack("N", pack("C*", split(/\./, $host))); + my $list = $NetConfig{'local_netmask'}; + $list = [$list] unless ref($list); + foreach (@$list) { + my ($net, $bits) = (m#^(\d+\.\d+\.\d+\.\d+)/(\d+)$#) or next; + my $mask = ~0 << (32 - $bits); + my $addr = unpack("N", pack("C*", split(/\./, $net))); + + return 0 if (($addr & $mask) == ($quad & $mask)); + } + return 1; + } + + return 0; +} + +*is_external = \&requires_firewall; + +1; + +__END__ + +=head1 NAME + +Net::Config - Local configuration data for libnet + +=head1 SYNOPSIS + + use Net::Config qw(%NetConfig); + +=head1 DESCRIPTION + +C<Net::Config> holds configuration data for the modules in the libnet +distribution. During installation you will be asked for these values. + +The configuration data is held globally in a file in the perl installation +tree, but a user may override any of these values by providing their own. This +can be done by having a C<.libnetrc> file in their home directory. This file +should return a reference to a HASH containing the keys described below. +For example + + # .libnetrc + { + nntp_hosts => [ "my_preferred_host" ], + ph_hosts => [ "my_ph_server" ], + } + __END__ + +=head1 METHODS + +C<Net::Config> defines the following methods. They are methods as they are +invoked as class methods. This is because C<Net::Config> inherits from +C<Net::LocalCfg> so you can override these methods if you want. + +=over 4 + +=item requires_firewall ( HOST ) + +Attempts to determine if a given host is outside your firewall. Possible +return values are. + + -1 Cannot lookup hostname + 0 Host is inside firewall (or there is no ftp_firewall entry) + 1 Host is outside the firewall + +This is done by using hostname lookup and the C<local_netmask> entry in +the configuration data. + +=back + +=head1 NetConfig VALUES + +=over 4 + +=item nntp_hosts + +=item snpp_hosts + +=item pop3_hosts + +=item smtp_hosts + +=item ph_hosts + +=item daytime_hosts + +=item time_hosts + +Each is a reference to an array of hostnames (in order of preference), +which should be used for the given protocol + +=item inet_domain + +Your internet domain name + +=item ftp_firewall + +If you have an FTP proxy firewall (B<NOT> an HTTP or SOCKS firewall) +then this value should be set to the firewall hostname. If your firewall +does not listen to port 21, then this value should be set to +C<"hostname:port"> (eg C<"hostname:99">) + +=item ftp_firewall_type + +There are many different ftp firewall products available. But unfortunately +there is no standard for how to traverse a firewall. The list below shows the +sequence of commands that Net::FTP will use + + user Username for remote host + pass Password for remote host + fwuser Username for firewall + fwpass Password for firewall + remote.host The hostname of the remote ftp server + +=over 4 + +=item 0Z<> + +There is no firewall + +=item 1Z<> + + USER user@remote.host + PASS pass + +=item 2Z<> + + USER fwuser + PASS fwpass + USER user@remote.host + PASS pass + +=item 3Z<> + + USER fwuser + PASS fwpass + SITE remote.site + USER user + PASS pass + +=item 4Z<> + + USER fwuser + PASS fwpass + OPEN remote.site + USER user + PASS pass + +=item 5Z<> + + USER user@fwuser@remote.site + PASS pass@fwpass + +=item 6Z<> + + USER fwuser@remote.site + PASS fwpass + USER user + PASS pass + +=item 7Z<> + + USER user@remote.host + PASS pass + AUTH fwuser + RESP fwpass + +=back + +=item ftp_ext_passive + +=item ftp_int_passive + +FTP servers can work in passive or active mode. Active mode is when +you want to transfer data you have to tell the server the address and +port to connect to. Passive mode is when the server provide the +address and port and you establish the connection. + +With some firewalls active mode does not work as the server cannot +connect to your machine (because you are behind a firewall) and the firewall +does not re-write the command. In this case you should set C<ftp_ext_passive> +to a I<true> value. + +Some servers are configured to only work in passive mode. If you have +one of these you can force C<Net::FTP> to always transfer in passive +mode; when not going via a firewall, by setting C<ftp_int_passive> to +a I<true> value. + +=item local_netmask + +A reference to a list of netmask strings in the form C<"134.99.4.0/24">. +These are used by the C<requires_firewall> function to determine if a given +host is inside or outside your firewall. + +=back + +The following entries are used during installation & testing on the +libnet package + +=over 4 + +=item test_hosts + +If true then C<make test> may attempt to connect to hosts given in the +configuration. + +=item test_exists + +If true then C<Configure> will check each hostname given that it exists + +=back + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1998-2011 Graham Barr. All rights reserved. + +Copyright (C) 2013-2014, 2016 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Domain.pm b/data/miniconda3/lib/perl5/core_perl/Net/Domain.pm new file mode 100644 index 0000000000000000000000000000000000000000..556cc1598075d8b61ba7b70a73332a2e126b13e1 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Domain.pm @@ -0,0 +1,365 @@ +# Net::Domain.pm +# +# Copyright (C) 1995-1998 Graham Barr. All rights reserved. +# Copyright (C) 2013-2014 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::Domain; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use Exporter; +use Net::Config; + +our @ISA = qw(Exporter); +our @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname); +our $VERSION = "3.11"; + +my ($host, $domain, $fqdn) = (undef, undef, undef); + +# Try every conceivable way to get hostname. + + +sub _hostname { + + # we already know it + return $host + if (defined $host); + + if ($^O eq 'MSWin32') { + require Socket; + my ($name, $alias, $type, $len, @addr) = gethostbyname($ENV{'COMPUTERNAME'} || 'localhost'); + while (@addr) { + my $a = shift(@addr); + $host = gethostbyaddr($a, Socket::AF_INET()); + last if defined $host; + } + if (defined($host) && index($host, '.') > 0) { + $fqdn = $host; + ($host, $domain) = $fqdn =~ /^([^.]+)\.(.*)$/; + } + return $host; + } + elsif ($^O eq 'MacOS') { + chomp($host = `hostname`); + } + elsif ($^O eq 'VMS') { ## multiple varieties of net s/w makes this hard + $host = $ENV{'UCX$INET_HOST'} if defined($ENV{'UCX$INET_HOST'}); + $host = $ENV{'MULTINET_HOST_NAME'} if defined($ENV{'MULTINET_HOST_NAME'}); + if (index($host, '.') > 0) { + $fqdn = $host; + ($host, $domain) = $fqdn =~ /^([^.]+)\.(.*)$/; + } + return $host; + } + else { + local $SIG{'__DIE__'}; + + # syscall is preferred since it avoids tainting problems + eval { + my $tmp = "\0" x 256; ## preload scalar + eval { + package main; + require "syscall.ph"; ## no critic (Modules::RequireBarewordIncludes) + defined(&main::SYS_gethostname); + } + || eval { + package main; + require "sys/syscall.ph"; ## no critic (Modules::RequireBarewordIncludes) + defined(&main::SYS_gethostname); + } + and $host = + (syscall(&main::SYS_gethostname, $tmp, 256) == 0) + ? $tmp + : undef; + } + + # POSIX + || eval { + require POSIX; + $host = (POSIX::uname())[1]; + } + + # trusty old hostname command + || eval { + chop($host = `(hostname) 2>/dev/null`); # BSD'ish + } + + # sysV/POSIX uname command (may truncate) + || eval { + chop($host = `uname -n 2>/dev/null`); ## SYSV'ish && POSIX'ish + } + + # Apollo pre-SR10 + || eval { $host = (split(/[:. ]/, `/com/host`, 6))[0]; } + + || eval { $host = ""; }; + } + + # remove garbage + $host =~ s/[\0\r\n]+//go; + $host =~ s/(\A\.+|\.+\Z)//go; + $host =~ s/\.\.+/\./go; + + $host; +} + + +sub _hostdomain { + + # we already know it + return $domain + if (defined $domain); + + local $SIG{'__DIE__'}; + + return $domain = $NetConfig{'inet_domain'} + if defined $NetConfig{'inet_domain'}; + + # try looking in /etc/resolv.conf + # putting this here and assuming that it is correct, eliminates + # calls to gethostbyname, and therefore DNS lookups. This helps + # those on dialup systems. + + local ($_); + + if (open(my $res, '<', "/etc/resolv.conf")) { + while (<$res>) { + $domain = $1 + if (/\A\s*(?:domain|search)\s+(\S+)/); + } + close($res); + + return $domain + if (defined $domain); + } + + # just try hostname and system calls + + my $host = _hostname(); + my (@hosts); + + @hosts = ($host, "localhost"); + + unless (defined($host) && $host =~ /\./) { + my $dom = undef; + eval { + my $tmp = "\0" x 256; ## preload scalar + eval { + package main; + require "syscall.ph"; ## no critic (Modules::RequireBarewordIncludes) + } + || eval { + package main; + require "sys/syscall.ph"; ## no critic (Modules::RequireBarewordIncludes) + } + and $dom = + (syscall(&main::SYS_getdomainname, $tmp, 256) == 0) + ? $tmp + : undef; + }; + + if ($^O eq 'VMS') { + $dom ||= $ENV{'TCPIP$INET_DOMAIN'} + || $ENV{'UCX$INET_DOMAIN'}; + } + + chop($dom = `domainname 2>/dev/null`) + unless (defined $dom || $^O =~ /^(?:cygwin|MSWin32|android)/); + + if (defined $dom) { + my @h = (); + $dom =~ s/^\.+//; + while (length($dom)) { + push(@h, "$host.$dom"); + $dom =~ s/^[^.]+.+// or last; + } + unshift(@hosts, @h); + } + } + + # Attempt to locate FQDN + + foreach (grep { defined $_ } @hosts) { + my @info = gethostbyname($_); + + next unless @info; + + # look at real name & aliases + foreach my $site ($info[0], split(/ /, $info[1])) { + if (rindex($site, ".") > 0) { + + # Extract domain from FQDN + + ($domain = $site) =~ s/\A[^.]+\.//; + return $domain; + } + } + } + + # Look for environment variable + + $domain ||= $ENV{LOCALDOMAIN} || $ENV{DOMAIN}; + + if (defined $domain) { + $domain =~ s/[\r\n\0]+//g; + $domain =~ s/(\A\.+|\.+\Z)//g; + $domain =~ s/\.\.+/\./g; + } + + $domain; +} + + +sub domainname { + + return $fqdn + if (defined $fqdn); + + _hostname(); + + # *.local names are special on darwin. If we call gethostbyname below, it + # may hang while waiting for another, non-existent computer to respond. + if($^O eq 'darwin' && $host =~ /\.local$/) { + return $host; + } + + _hostdomain(); + + # Assumption: If the host name does not contain a period + # and the domain name does, then assume that they are correct + # this helps to eliminate calls to gethostbyname, and therefore + # eliminate DNS lookups + + return $fqdn = $host . "." . $domain + if (defined $host + and defined $domain + and $host !~ /\./ + and $domain =~ /\./); + + # For hosts that have no name, just an IP address + return $fqdn = $host if defined $host and $host =~ /^\d+(\.\d+){3}$/; + + my @host = defined $host ? split(/\./, $host) : ('localhost'); + my @domain = defined $domain ? split(/\./, $domain) : (); + my @fqdn = (); + + # Determine from @host & @domain the FQDN + + my @d = @domain; + +LOOP: + while (1) { + my @h = @host; + while (@h) { + my $tmp = join(".", @h, @d); + if ((gethostbyname($tmp))[0]) { + @fqdn = (@h, @d); + $fqdn = $tmp; + last LOOP; + } + pop @h; + } + last unless shift @d; + } + + if (@fqdn) { + $host = shift @fqdn; + until ((gethostbyname($host))[0]) { + $host .= "." . shift @fqdn; + } + $domain = join(".", @fqdn); + } + else { + undef $host; + undef $domain; + undef $fqdn; + } + + $fqdn; +} + + +sub hostfqdn { domainname() } + + +sub hostname { + domainname() + unless (defined $host); + return $host; +} + + +sub hostdomain { + domainname() + unless (defined $domain); + return $domain; +} + +1; # Keep require happy + +__END__ + +=head1 NAME + +Net::Domain - Attempt to evaluate the current host's internet name and domain + +=head1 SYNOPSIS + + use Net::Domain qw(hostname hostfqdn hostdomain domainname); + +=head1 DESCRIPTION + +Using various methods B<attempt> to find the Fully Qualified Domain Name (FQDN) +of the current host. From this determine the host-name and the host-domain. + +Each of the functions will return I<undef> if the FQDN cannot be determined. + +=over 4 + +=item hostfqdn () + +Identify and return the FQDN of the current host. + +=item domainname () + +An alias for hostfqdn (). + +=item hostname () + +Returns the smallest part of the FQDN which can be used to identify the host. + +=item hostdomain () + +Returns the remainder of the FQDN after the I<hostname> has been removed. + +=back + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Adapted from Sys::Hostname by David Sundstrom E<lt>F<sunds@asictest.sc.ti.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-1998 Graham Barr. All rights reserved. + +Copyright (C) 2013-2014 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/FTP.pm b/data/miniconda3/lib/perl5/core_perl/Net/FTP.pm new file mode 100644 index 0000000000000000000000000000000000000000..14153be0d0c000cacc0d3552bb3722e8db1cbe77 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/FTP.pm @@ -0,0 +1,2049 @@ +# Net::FTP.pm +# +# Copyright (C) 1995-2004 Graham Barr. All rights reserved. +# Copyright (C) 2013-2017 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. +# +# Documentation (at end) improved 1996 by Nathan Torkington <gnat@frii.com>. + +package Net::FTP; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); +use IO::Socket; +use Net::Cmd; +use Net::Config; +use Socket; +use Time::Local; + +our $VERSION = '3.11'; + +our $IOCLASS; +my $family_key; +BEGIN { + # Code for detecting if we can use SSL + my $ssl_class = eval { + require IO::Socket::SSL; + # first version with default CA on most platforms + no warnings 'numeric'; + IO::Socket::SSL->VERSION(2.007); + } && 'IO::Socket::SSL'; + + my $nossl_warn = !$ssl_class && + 'To use SSL please install IO::Socket::SSL with version>=2.007'; + + # Code for detecting if we can use IPv6 + my $inet6_class = eval { + require IO::Socket::IP; + no warnings 'numeric'; + IO::Socket::IP->VERSION(0.25); + } && 'IO::Socket::IP' || eval { + require IO::Socket::INET6; + no warnings 'numeric'; + IO::Socket::INET6->VERSION(2.62); + } && 'IO::Socket::INET6'; + + sub can_ssl { $ssl_class }; + sub can_inet6 { $inet6_class }; + + $IOCLASS = $ssl_class || $inet6_class || 'IO::Socket::INET'; + $family_key = + ( $ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '' ) + eq 'IO::Socket::IP' + ? 'Family' : 'Domain'; +} + +our @ISA = ('Exporter','Net::Cmd',$IOCLASS); + +use constant TELNET_IAC => 255; +use constant TELNET_IP => 244; +use constant TELNET_DM => 242; + +use constant EBCDIC => $^O eq 'os390'; + +sub new { + my $pkg = shift; + my ($peer, %arg); + if (@_ % 2) { + $peer = shift; + %arg = @_; + } + else { + %arg = @_; + $peer = delete $arg{Host}; + } + + my $host = $peer; + my $fire = undef; + my $fire_type = undef; + + if (exists($arg{Firewall}) || Net::Config->requires_firewall($peer)) { + $fire = $arg{Firewall} + || $ENV{FTP_FIREWALL} + || $NetConfig{ftp_firewall} + || undef; + + if (defined $fire) { + $peer = $fire; + delete $arg{Port}; + $fire_type = $arg{FirewallType} + || $ENV{FTP_FIREWALL_TYPE} + || $NetConfig{firewall_type} + || undef; + } + } + + my %tlsargs; + if (can_ssl()) { + # for name verification strip port from domain:port, ipv4:port, [ipv6]:port + (my $hostname = $host) =~s{(?<!:):\d+$}{}; + %tlsargs = ( + SSL_verifycn_scheme => 'ftp', + SSL_verifycn_name => $hostname, + # use SNI if supported by IO::Socket::SSL + $pkg->can_client_sni ? (SSL_hostname => $hostname):(), + # reuse SSL session of control connection in data connections + SSL_session_cache => Net::FTP::_SSL_SingleSessionCache->new, + ); + # user defined SSL arg + $tlsargs{$_} = $arg{$_} for(grep { m{^SSL_} } keys %arg); + + } elsif ($arg{SSL}) { + croak("IO::Socket::SSL >= 2.007 needed for SSL support"); + } + + my $ftp = $pkg->SUPER::new( + PeerAddr => $peer, + PeerPort => $arg{Port} || ($arg{SSL} ? 'ftps(990)' : 'ftp(21)'), + LocalAddr => $arg{'LocalAddr'}, + $family_key => $arg{Domain} || $arg{Family}, + Proto => 'tcp', + Timeout => defined $arg{Timeout} ? $arg{Timeout} : 120, + %tlsargs, + $arg{SSL} ? ():( SSL_startHandshake => 0 ), + ) or return; + + ${*$ftp}{'net_ftp_host'} = $host; # Remote hostname + ${*$ftp}{'net_ftp_type'} = 'A'; # ASCII/binary/etc mode + ${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240); + + ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'}; + ${*$ftp}{'net_ftp_domain'} = $arg{Domain} || $arg{Family}; + + ${*$ftp}{'net_ftp_firewall'} = $fire + if (defined $fire); + ${*$ftp}{'net_ftp_firewall_type'} = $fire_type + if (defined $fire_type); + + ${*$ftp}{'net_ftp_passive'} = + int exists $arg{Passive} ? $arg{Passive} + : exists $ENV{FTP_PASSIVE} ? $ENV{FTP_PASSIVE} + : defined $fire ? $NetConfig{ftp_ext_passive} + : $NetConfig{ftp_int_passive}; # Whew! :-) + + ${*$ftp}{net_ftp_tlsargs} = \%tlsargs if %tlsargs; + if ($arg{SSL}) { + ${*$ftp}{net_ftp_tlsprot} = 'P'; + ${*$ftp}{net_ftp_tlsdirect} = 1; + } + + $ftp->hash(exists $arg{Hash} ? $arg{Hash} : 0, 1024); + + $ftp->autoflush(1); + + $ftp->debug(exists $arg{Debug} ? $arg{Debug} : undef); + + unless ($ftp->response() == CMD_OK) { + $ftp->close(); + # keep @$ if no message. Happens, when response did not start with a code. + $@ = $ftp->message || $@; + undef $ftp; + } + + $ftp; +} + +## +## User interface methods +## + + +sub host { + my $me = shift; + ${*$me}{'net_ftp_host'}; +} + +sub passive { + my $ftp = shift; + return ${*$ftp}{'net_ftp_passive'} unless @_; + ${*$ftp}{'net_ftp_passive'} = shift; +} + + +sub hash { + my $ftp = shift; # self + + my ($h, $b) = @_; + unless ($h) { + delete ${*$ftp}{'net_ftp_hash'}; + return [\*STDERR, 0]; + } + ($h, $b) = (ref($h) ? $h : \*STDERR, $b || 1024); + select((select($h), $| = 1)[0]); + $b = 512 if $b < 512; + ${*$ftp}{'net_ftp_hash'} = [$h, $b]; +} + + +sub quit { + my $ftp = shift; + + $ftp->_QUIT; + $ftp->close; +} + + +sub DESTROY { } + + +sub ascii { shift->type('A', @_); } +sub binary { shift->type('I', @_); } + + +sub ebcdic { + carp "TYPE E is unsupported, shall default to I"; + shift->type('E', @_); +} + + +sub byte { + carp "TYPE L is unsupported, shall default to I"; + shift->type('L', @_); +} + +# Allow the user to send a command directly, BE CAREFUL !! + + +sub quot { + my $ftp = shift; + my $cmd = shift; + + $ftp->command(uc $cmd, @_); + $ftp->response(); +} + + +sub site { + my $ftp = shift; + + $ftp->command("SITE", @_); + $ftp->response(); +} + + +sub mdtm { + my $ftp = shift; + my $file = shift; + + # Server Y2K bug workaround + # + # sigh; some idiotic FTP servers use ("19%d",tm.tm_year) instead of + # ("%d",tm.tm_year+1900). This results in an extra digit in the + # string returned. To account for this we allow an optional extra + # digit in the year. Then if the first two digits are 19 we use the + # remainder, otherwise we subtract 1900 from the whole year. + + $ftp->_MDTM($file) + && $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ + ? timegm($8, $7, $6, $5, $4 - 1, $2 eq '19' ? $3 : ($1 - 1900)) + : undef; +} + + +sub size { + my $ftp = shift; + my $file = shift; + my $io; + if ($ftp->supported("SIZE")) { + return $ftp->_SIZE($file) + ? ($ftp->message =~ /(\d+)\s*(bytes?\s*)?$/)[0] + : undef; + } + elsif ($ftp->supported("STAT")) { + my @msg; + return + unless $ftp->_STAT($file) && (@msg = $ftp->message) == 3; + foreach my $line (@msg) { + return (split(/\s+/, $line))[4] + if $line =~ /^[-rwxSsTt]{10}/; + } + } + else { + my @files = $ftp->dir($file); + if (@files) { + return (split(/\s+/, $1))[4] + if $files[0] =~ /^([-rwxSsTt]{10}.*)$/; + } + } + undef; +} + + +sub starttls { + my $ftp = shift; + can_ssl() or croak("IO::Socket::SSL >= 2.007 needed for SSL support"); + $ftp->is_SSL and croak("called starttls within SSL session"); + $ftp->_AUTH('TLS') == CMD_OK or return; + + $ftp->connect_SSL or return; + $ftp->prot('P'); + return 1; +} + +sub prot { + my ($ftp,$prot) = @_; + $prot eq 'C' or $prot eq 'P' or croak("prot must by C or P"); + $ftp->_PBSZ(0) or return; + $ftp->_PROT($prot) or return; + ${*$ftp}{net_ftp_tlsprot} = $prot; + return 1; +} + +sub stoptls { + my $ftp = shift; + $ftp->is_SSL or croak("called stoptls outside SSL session"); + ${*$ftp}{net_ftp_tlsdirect} and croak("cannot stoptls direct SSL session"); + $ftp->_CCC() or return; + $ftp->stop_SSL(); + return 1; +} + +sub login { + my ($ftp, $user, $pass, $acct) = @_; + my ($ok, $ruser, $fwtype); + + unless (defined $user) { + require Net::Netrc; + + my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_host'}); + + ($user, $pass, $acct) = $rc->lpa() + if ($rc); + } + + $user ||= "anonymous"; + $ruser = $user; + + $fwtype = ${*$ftp}{'net_ftp_firewall_type'} + || $NetConfig{'ftp_firewall_type'} + || 0; + + if ($fwtype && defined ${*$ftp}{'net_ftp_firewall'}) { + if ($fwtype == 1 || $fwtype == 7) { + $user .= '@' . ${*$ftp}{'net_ftp_host'}; + } + else { + require Net::Netrc; + + my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'}); + + my ($fwuser, $fwpass, $fwacct) = $rc ? $rc->lpa() : (); + + if ($fwtype == 5) { + $user = join('@', $user, $fwuser, ${*$ftp}{'net_ftp_host'}); + $pass = $pass . '@' . $fwpass; + } + else { + if ($fwtype == 2) { + $user .= '@' . ${*$ftp}{'net_ftp_host'}; + } + elsif ($fwtype == 6) { + $fwuser .= '@' . ${*$ftp}{'net_ftp_host'}; + } + + $ok = $ftp->_USER($fwuser); + + return 0 unless $ok == CMD_OK || $ok == CMD_MORE; + + $ok = $ftp->_PASS($fwpass || ""); + + return 0 unless $ok == CMD_OK || $ok == CMD_MORE; + + $ok = $ftp->_ACCT($fwacct) + if defined($fwacct); + + if ($fwtype == 3) { + $ok = $ftp->command("SITE", ${*$ftp}{'net_ftp_host'})->response; + } + elsif ($fwtype == 4) { + $ok = $ftp->command("OPEN", ${*$ftp}{'net_ftp_host'})->response; + } + + return 0 unless $ok == CMD_OK || $ok == CMD_MORE; + } + } + } + + $ok = $ftp->_USER($user); + + # Some dumb firewalls don't prefix the connection messages + $ok = $ftp->response() + if ($ok == CMD_OK && $ftp->code == 220 && $user =~ /\@/); + + if ($ok == CMD_MORE) { + unless (defined $pass) { + require Net::Netrc; + + my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_host'}, $ruser); + + ($ruser, $pass, $acct) = $rc->lpa() + if ($rc); + + $pass = '-anonymous@' + if (!defined $pass && (!defined($ruser) || $ruser =~ /^anonymous/o)); + } + + $ok = $ftp->_PASS($pass || ""); + } + + $ok = $ftp->_ACCT($acct) + if (defined($acct) && ($ok == CMD_MORE || $ok == CMD_OK)); + + if ($fwtype == 7 && $ok == CMD_OK && defined ${*$ftp}{'net_ftp_firewall'}) { + my ($f, $auth, $resp) = _auth_id($ftp); + $ftp->authorize($auth, $resp) if defined($resp); + } + + $ok == CMD_OK; +} + + +sub account { + @_ == 2 or croak 'usage: $ftp->account( ACCT )'; + my $ftp = shift; + my $acct = shift; + $ftp->_ACCT($acct) == CMD_OK; +} + + +sub _auth_id { + my ($ftp, $auth, $resp) = @_; + + unless (defined $resp) { + require Net::Netrc; + + $auth ||= eval { (getpwuid($>))[0] } || $ENV{NAME}; + + my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'}, $auth) + || Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'}); + + ($auth, $resp) = $rc->lpa() + if ($rc); + } + ($ftp, $auth, $resp); +} + + +sub authorize { + @_ >= 1 || @_ <= 3 or croak 'usage: $ftp->authorize( [AUTH [, RESP]])'; + + my ($ftp, $auth, $resp) = &_auth_id; + + my $ok = $ftp->_AUTH($auth || ""); + + return $ftp->_RESP($resp || "") + if ($ok == CMD_MORE); + + $ok == CMD_OK; +} + + +sub rename { + @_ == 3 or croak 'usage: $ftp->rename(FROM, TO)'; + + my ($ftp, $from, $to) = @_; + + $ftp->_RNFR($from) + && $ftp->_RNTO($to); +} + + +sub type { + my $ftp = shift; + my $type = shift; + my $oldval = ${*$ftp}{'net_ftp_type'}; + + return $oldval + unless (defined $type); + + return + unless ($ftp->_TYPE($type, @_)); + + ${*$ftp}{'net_ftp_type'} = join(" ", $type, @_); + + $oldval; +} + + +sub alloc { + my $ftp = shift; + my $size = shift; + my $oldval = ${*$ftp}{'net_ftp_allo'}; + + return $oldval + unless (defined $size); + + return + unless ($ftp->supported("ALLO") and $ftp->_ALLO($size, @_)); + + ${*$ftp}{'net_ftp_allo'} = join(" ", $size, @_); + + $oldval; +} + + +sub abort { + my $ftp = shift; + + send($ftp, pack("CCC", TELNET_IAC, TELNET_IP, TELNET_IAC), MSG_OOB); + + $ftp->command(pack("C", TELNET_DM) . "ABOR"); + + ${*$ftp}{'net_ftp_dataconn'}->close() + if defined ${*$ftp}{'net_ftp_dataconn'}; + + $ftp->response(); + + $ftp->status == CMD_OK; +} + + +sub get { + my ($ftp, $remote, $local, $where) = @_; + + my ($loc, $len, $buf, $resp, $data); + local *FD; + + my $localfd = ref($local) || ref(\$local) eq "GLOB"; + + ($local = $remote) =~ s#^.*/## + unless (defined $local); + + croak("Bad remote filename '$remote'\n") + if $remote =~ /[\r\n]/s; + + ${*$ftp}{'net_ftp_rest'} = $where if defined $where; + my $rest = ${*$ftp}{'net_ftp_rest'}; + + delete ${*$ftp}{'net_ftp_port'}; + delete ${*$ftp}{'net_ftp_pasv'}; + + $data = $ftp->retr($remote) + or return; + + if ($localfd) { + $loc = $local; + } + else { + $loc = \*FD; + + unless (sysopen($loc, $local, O_CREAT | O_WRONLY | ($rest ? O_APPEND: O_TRUNC))) { + carp "Cannot open Local file $local: $!\n"; + $data->abort; + return; + } + } + + if ($ftp->type eq 'I' && !binmode($loc)) { + carp "Cannot binmode Local file $local: $!\n"; + $data->abort; + close($loc) unless $localfd; + return; + } + + $buf = ''; + my ($count, $hashh, $hashb, $ref) = (0); + + ($hashh, $hashb) = @$ref + if ($ref = ${*$ftp}{'net_ftp_hash'}); + + my $blksize = ${*$ftp}{'net_ftp_blksize'}; + local $\; # Just in case + + while (1) { + last unless $len = $data->read($buf, $blksize); + + if (EBCDIC && $ftp->type ne 'I') { + $buf = $ftp->toebcdic($buf); + $len = length($buf); + } + + if ($hashh) { + $count += $len; + print $hashh "#" x (int($count / $hashb)); + $count %= $hashb; + } + unless (print $loc $buf) { + carp "Cannot write to Local file $local: $!\n"; + $data->abort; + close($loc) + unless $localfd; + return; + } + } + + print $hashh "\n" if $hashh; + + unless ($localfd) { + unless (close($loc)) { + carp "Cannot close file $local (perhaps disk space) $!\n"; + return; + } + } + + unless ($data->close()) # implied $ftp->response + { + carp "Unable to close datastream"; + return; + } + + return $local; +} + + +sub cwd { + @_ == 1 || @_ == 2 or croak 'usage: $ftp->cwd( [ DIR ] )'; + + my ($ftp, $dir) = @_; + + $dir = "/" unless defined($dir) && $dir =~ /\S/; + + $dir eq ".." + ? $ftp->_CDUP() + : $ftp->_CWD($dir); +} + + +sub cdup { + @_ == 1 or croak 'usage: $ftp->cdup()'; + $_[0]->_CDUP; +} + + +sub pwd { + @_ == 1 || croak 'usage: $ftp->pwd()'; + my $ftp = shift; + + $ftp->_PWD(); + $ftp->_extract_path; +} + +# rmdir( $ftp, $dir, [ $recurse ] ) +# +# Removes $dir on remote host via FTP. +# $ftp is handle for remote host +# +# If $recurse is TRUE, the directory and deleted recursively. +# This means all of its contents and subdirectories. +# +# Initial version contributed by Dinkum Software +# +sub rmdir { + @_ == 2 || @_ == 3 or croak('usage: $ftp->rmdir( DIR [, RECURSE ] )'); + + # Pick off the args + my ($ftp, $dir, $recurse) = @_; + my $ok; + + return $ok + if $ok = $ftp->_RMD($dir) + or !$recurse; + + # Try to delete the contents + # Get a list of all the files in the directory, excluding the current and parent directories + my @filelist = map { /^(?:\S+;)+ (.+)$/ ? ($1) : () } grep { !/^(?:\S+;)*type=[cp]dir;/i } $ftp->_list_cmd("MLSD", $dir); + + # Fallback to using the less well-defined NLST command if MLSD fails + @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir) + unless @filelist; + + return + unless @filelist; # failed, it is probably not a directory + + return $ftp->delete($dir) + if @filelist == 1 and $dir eq $filelist[0]; + + # Go thru and delete each file or the directory + foreach my $file (map { m,/, ? $_ : "$dir/$_" } @filelist) { + next # successfully deleted the file + if $ftp->delete($file); + + # Failed to delete it, assume its a directory + # Recurse and ignore errors, the final rmdir() will + # fail on any errors here + return $ok + unless $ok = $ftp->rmdir($file, 1); + } + + # Directory should be empty + # Try to remove the directory again + # Pass results directly to caller + # If any of the prior deletes failed, this + # rmdir() will fail because directory is not empty + return $ftp->_RMD($dir); +} + + +sub restart { + @_ == 2 || croak 'usage: $ftp->restart( BYTE_OFFSET )'; + + my ($ftp, $where) = @_; + + ${*$ftp}{'net_ftp_rest'} = $where; + + return; +} + + +sub mkdir { + @_ == 2 || @_ == 3 or croak 'usage: $ftp->mkdir( DIR [, RECURSE ] )'; + + my ($ftp, $dir, $recurse) = @_; + + $ftp->_MKD($dir) || $recurse + or return; + + my $path = $dir; + + unless ($ftp->ok) { + my @path = split(m#(?=/+)#, $dir); + + $path = ""; + + while (@path) { + $path .= shift @path; + + $ftp->_MKD($path); + + $path = $ftp->_extract_path($path); + } + + # If the creation of the last element was not successful, see if we + # can cd to it, if so then return path + + unless ($ftp->ok) { + my ($status, $message) = ($ftp->status, $ftp->message); + my $pwd = $ftp->pwd; + + if ($pwd && $ftp->cwd($dir)) { + $path = $dir; + $ftp->cwd($pwd); + } + else { + undef $path; + } + $ftp->set_status($status, $message); + } + } + + $path; +} + + +sub delete { + @_ == 2 || croak 'usage: $ftp->delete( FILENAME )'; + + $_[0]->_DELE($_[1]); +} + + +sub put { shift->_store_cmd("stor", @_) } +sub put_unique { shift->_store_cmd("stou", @_) } +sub append { shift->_store_cmd("appe", @_) } + + +sub nlst { shift->_data_cmd("NLST", @_) } +sub list { shift->_data_cmd("LIST", @_) } +sub retr { shift->_data_cmd("RETR", @_) } +sub stor { shift->_data_cmd("STOR", @_) } +sub stou { shift->_data_cmd("STOU", @_) } +sub appe { shift->_data_cmd("APPE", @_) } + + +sub _store_cmd { + my ($ftp, $cmd, $local, $remote) = @_; + my ($loc, $sock, $len, $buf); + local *FD; + + my $localfd = ref($local) || ref(\$local) eq "GLOB"; + + if (!defined($remote) and 'STOU' ne uc($cmd)) { + croak 'Must specify remote filename with stream input' + if $localfd; + + require File::Basename; + $remote = File::Basename::basename($local); + } + if (defined ${*$ftp}{'net_ftp_allo'}) { + delete ${*$ftp}{'net_ftp_allo'}; + } + else { + + # if the user hasn't already invoked the alloc method since the last + # _store_cmd call, figure out if the local file is a regular file(not + # a pipe, or device) and if so get the file size from stat, and send + # an ALLO command before sending the STOR, STOU, or APPE command. + my $size = do { local $^W; -f $local && -s _ }; # no ALLO if sending data from a pipe + ${*$ftp}{'net_ftp_allo'} = $size if $size; + } + croak("Bad remote filename '$remote'\n") + if defined($remote) and $remote =~ /[\r\n]/s; + + if ($localfd) { + $loc = $local; + } + else { + $loc = \*FD; + + unless (sysopen($loc, $local, O_RDONLY)) { + carp "Cannot open Local file $local: $!\n"; + return; + } + } + + if ($ftp->type eq 'I' && !binmode($loc)) { + carp "Cannot binmode Local file $local: $!\n"; + return; + } + + delete ${*$ftp}{'net_ftp_port'}; + delete ${*$ftp}{'net_ftp_pasv'}; + + $sock = $ftp->_data_cmd($cmd, grep { defined } $remote) + or return; + + $remote = ($ftp->message =~ /\w+\s*:\s*(.*)/)[0] + if 'STOU' eq uc $cmd; + + my $blksize = ${*$ftp}{'net_ftp_blksize'}; + + my ($count, $hashh, $hashb, $ref) = (0); + + ($hashh, $hashb) = @$ref + if ($ref = ${*$ftp}{'net_ftp_hash'}); + + while (1) { + last unless $len = read($loc, $buf = "", $blksize); + + if (EBCDIC && $ftp->type ne 'I') { + $buf = $ftp->toascii($buf); + $len = length($buf); + } + + if ($hashh) { + $count += $len; + print $hashh "#" x (int($count / $hashb)); + $count %= $hashb; + } + + my $wlen; + unless (defined($wlen = $sock->write($buf, $len)) && $wlen == $len) { + $sock->abort; + close($loc) + unless $localfd; + print $hashh "\n" if $hashh; + return; + } + } + + print $hashh "\n" if $hashh; + + close($loc) + unless $localfd; + + $sock->close() + or return; + + if ('STOU' eq uc $cmd and $ftp->message =~ m/unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/) { + require File::Basename; + $remote = File::Basename::basename($+); + } + + return $remote; +} + + +sub port { + @_ == 1 || @_ == 2 or croak 'usage: $self->port([PORT])'; + return _eprt('PORT',@_); +} + +sub eprt { + @_ == 1 || @_ == 2 or croak 'usage: $self->eprt([PORT])'; + return _eprt('EPRT',@_); +} + +sub _eprt { + my ($cmd,$ftp,$port) = @_; + delete ${*$ftp}{net_ftp_intern_port}; + unless ($port) { + my $listen = ${*$ftp}{net_ftp_listen} ||= $IOCLASS->new( + Listen => 1, + Timeout => $ftp->timeout, + LocalAddr => $ftp->sockhost, + $family_key => $ftp->sockdomain, + can_ssl() ? ( + %{ ${*$ftp}{net_ftp_tlsargs} }, + SSL_startHandshake => 0, + ):(), + ); + ${*$ftp}{net_ftp_intern_port} = 1; + my $fam = ($listen->sockdomain == AF_INET) ? 1:2; + if ( $cmd eq 'EPRT' || $fam == 2 ) { + $port = "|$fam|".$listen->sockhost."|".$listen->sockport."|"; + $cmd = 'EPRT'; + } else { + my $p = $listen->sockport; + $port = join(',',split(m{\.},$listen->sockhost),$p >> 8,$p & 0xff); + } + } elsif (ref($port) eq 'ARRAY') { + $port = join(',',split(m{\.},@$port[0]),@$port[1] >> 8,@$port[1] & 0xff); + } + my $ok = $cmd eq 'EPRT' ? $ftp->_EPRT($port) : $ftp->_PORT($port); + ${*$ftp}{net_ftp_port} = $port if $ok; + return $ok; +} + + +sub ls { shift->_list_cmd("NLST", @_); } +sub dir { shift->_list_cmd("LIST", @_); } + + +sub pasv { + my $ftp = shift; + @_ and croak 'usage: $ftp->port()'; + return $ftp->epsv if $ftp->sockdomain != AF_INET; + delete ${*$ftp}{net_ftp_intern_port}; + + if ( $ftp->_PASV && + $ftp->message =~ m{(\d+,\d+,\d+,\d+),(\d+),(\d+)} ) { + my $port = 256 * $2 + $3; + ( my $ip = $1 ) =~s{,}{.}g; + return ${*$ftp}{net_ftp_pasv} = [ $ip,$port ]; + } + return; +} + +sub epsv { + my $ftp = shift; + @_ and croak 'usage: $ftp->epsv()'; + delete ${*$ftp}{net_ftp_intern_port}; + + $ftp->_EPSV && $ftp->message =~ m{\(([\x33-\x7e])\1\1(\d+)\1\)} + ? ${*$ftp}{net_ftp_pasv} = [ $ftp->peerhost, $2 ] + : undef; +} + + +sub unique_name { + my $ftp = shift; + ${*$ftp}{'net_ftp_unique'} || undef; +} + + +sub supported { + @_ == 2 or croak 'usage: $ftp->supported( CMD )'; + my $ftp = shift; + my $cmd = uc shift; + my $hash = ${*$ftp}{'net_ftp_supported'} ||= {}; + + return $hash->{$cmd} + if exists $hash->{$cmd}; + + return $hash->{$cmd} = 1 + if $ftp->feature($cmd); + + return $hash->{$cmd} = 0 + unless $ftp->_HELP($cmd); + + my $text = $ftp->message; + if ($text =~ /following.+commands/i) { + $text =~ s/^.*\n//; + while ($text =~ /(\*?)(\w+)(\*?)/sg) { + $hash->{"\U$2"} = !length("$1$3"); + } + } + else { + $hash->{$cmd} = $text !~ /unimplemented/i; + } + + $hash->{$cmd} ||= 0; +} + +## +## Deprecated methods +## + + +sub lsl { + carp "Use of Net::FTP::lsl deprecated, use 'dir'" + if $^W; + goto &dir; +} + + +sub authorise { + carp "Use of Net::FTP::authorise deprecated, use 'authorize'" + if $^W; + goto &authorize; +} + + +## +## Private methods +## + + +sub _extract_path { + my ($ftp, $path) = @_; + + # This tries to work both with and without the quote doubling + # convention (RFC 959 requires it, but the first 3 servers I checked + # didn't implement it). It will fail on a server which uses a quote in + # the message which isn't a part of or surrounding the path. + $ftp->ok + && $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/ + && ($path = $1) =~ s/\"\"/\"/g; + + $path; +} + +## +## Communication methods +## + + +sub _dataconn { + my $ftp = shift; + my $pkg = "Net::FTP::" . $ftp->type; + eval "require " . $pkg ## no critic (BuiltinFunctions::ProhibitStringyEval) + or croak("cannot load $pkg required for type ".$ftp->type); + $pkg =~ s/ /_/g; + delete ${*$ftp}{net_ftp_dataconn}; + + my $conn; + my $pasv = ${*$ftp}{net_ftp_pasv}; + if ($pasv) { + $conn = $pkg->new( + PeerAddr => $pasv->[0], + PeerPort => $pasv->[1], + LocalAddr => ${*$ftp}{net_ftp_localaddr}, + $family_key => ${*$ftp}{net_ftp_domain}, + Timeout => $ftp->timeout, + can_ssl() ? ( + SSL_startHandshake => 0, + $ftp->is_SSL ? ( + SSL_reuse_ctx => $ftp, + SSL_verifycn_name => ${*$ftp}{net_ftp_tlsargs}{SSL_verifycn_name}, + # This will cause the use of SNI if supported by IO::Socket::SSL. + $ftp->can_client_sni ? ( + SSL_hostname => ${*$ftp}{net_ftp_tlsargs}{SSL_hostname} + ):(), + ) :( %{${*$ftp}{net_ftp_tlsargs}} ), + ):(), + ) or return; + } elsif (my $listen = delete ${*$ftp}{net_ftp_listen}) { + $conn = $listen->accept($pkg) or return; + $conn->timeout($ftp->timeout); + close($listen); + } else { + croak("no listener in active mode"); + } + + if (( ${*$ftp}{net_ftp_tlsprot} || '') eq 'P') { + if ($conn->connect_SSL) { + # SSL handshake ok + } else { + carp("failed to ssl upgrade dataconn: $IO::Socket::SSL::SSL_ERROR"); + return; + } + } + + ${*$ftp}{net_ftp_dataconn} = $conn; + ${*$conn} = ""; + ${*$conn}{net_ftp_cmd} = $ftp; + ${*$conn}{net_ftp_blksize} = ${*$ftp}{net_ftp_blksize}; + return $conn; +} + + +sub _list_cmd { + my $ftp = shift; + my $cmd = uc shift; + + delete ${*$ftp}{'net_ftp_port'}; + delete ${*$ftp}{'net_ftp_pasv'}; + + my $data = $ftp->_data_cmd($cmd, @_); + + return + unless (defined $data); + + require Net::FTP::A; + bless $data, "Net::FTP::A"; # Force ASCII mode + + my $databuf = ''; + my $buf = ''; + my $blksize = ${*$ftp}{'net_ftp_blksize'}; + + while ($data->read($databuf, $blksize)) { + $buf .= $databuf; + } + + my $list = [split(/\n/, $buf)]; + + $data->close(); + + if (EBCDIC) { + for (@$list) { $_ = $ftp->toebcdic($_) } + } + + wantarray + ? @{$list} + : $list; +} + + +sub _data_cmd { + my $ftp = shift; + my $cmd = uc shift; + my $ok = 1; + my $where = delete ${*$ftp}{'net_ftp_rest'} || 0; + my $arg; + + for my $arg (@_) { + croak("Bad argument '$arg'\n") + if $arg =~ /[\r\n]/s; + } + + if ( ${*$ftp}{'net_ftp_passive'} + && !defined ${*$ftp}{'net_ftp_pasv'} + && !defined ${*$ftp}{'net_ftp_port'}) + { + return unless defined $ftp->pasv; + + if ($where and !$ftp->_REST($where)) { + my ($status, $message) = ($ftp->status, $ftp->message); + $ftp->abort; + $ftp->set_status($status, $message); + return; + } + + # first send command, then open data connection + # otherwise the peer might not do a full accept (with SSL + # handshake if PROT P) + $ftp->command($cmd, @_); + my $data = $ftp->_dataconn(); + if (CMD_INFO == $ftp->response()) { + $data->reading + if $data && $cmd =~ /RETR|LIST|NLST|MLSD/; + return $data; + } + $data->_close if $data; + + return; + } + + $ok = $ftp->port + unless (defined ${*$ftp}{'net_ftp_port'} + || defined ${*$ftp}{'net_ftp_pasv'}); + + $ok = $ftp->_REST($where) + if $ok && $where; + + return + unless $ok; + + if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo} and + $ftp->supported("ALLO")) + { + $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo}) + or return; + } + + $ftp->command($cmd, @_); + + return 1 + if (defined ${*$ftp}{'net_ftp_pasv'}); + + $ok = CMD_INFO == $ftp->response(); + + return $ok + unless exists ${*$ftp}{'net_ftp_intern_port'}; + + if ($ok) { + my $data = $ftp->_dataconn(); + + $data->reading + if $data && $cmd =~ /RETR|LIST|NLST|MLSD/; + + return $data; + } + + + close(delete ${*$ftp}{'net_ftp_listen'}); + + return; +} + +## +## Over-ride methods (Net::Cmd) +## + + +sub debug_text { $_[2] =~ /^(pass|resp|acct)/i ? "$1 ....\n" : $_[2]; } + + +sub command { + my $ftp = shift; + + delete ${*$ftp}{'net_ftp_port'}; + $ftp->SUPER::command(@_); +} + + +sub response { + my $ftp = shift; + my $code = $ftp->SUPER::response() || 5; # assume 500 if undef + + delete ${*$ftp}{'net_ftp_pasv'} + if ($code != CMD_MORE && $code != CMD_INFO); + + $code; +} + + +sub parse_response { + return ($1, $2 eq "-") + if $_[1] =~ s/^(\d\d\d)([- ]?)//o; + + my $ftp = shift; + + # Darn MS FTP server is a load of CRAP !!!! + # Expect to see undef here. + return () + unless 0 + (${*$ftp}{'net_cmd_code'} || 0); + + (${*$ftp}{'net_cmd_code'}, 1); +} + +## +## Allow 2 servers to talk directly +## + + +sub pasv_xfer_unique { + my ($sftp, $sfile, $dftp, $dfile) = @_; + $sftp->pasv_xfer($sfile, $dftp, $dfile, 1); +} + + +sub pasv_xfer { + my ($sftp, $sfile, $dftp, $dfile, $unique) = @_; + + ($dfile = $sfile) =~ s#.*/## + unless (defined $dfile); + + my $port = $sftp->pasv + or return; + + $dftp->port($port) + or return; + + return + unless ($unique ? $dftp->stou($dfile) : $dftp->stor($dfile)); + + unless ($sftp->retr($sfile) && $sftp->response == CMD_INFO) { + $sftp->retr($sfile); + $dftp->abort; + $dftp->response(); + return; + } + + $dftp->pasv_wait($sftp); +} + + +sub pasv_wait { + @_ == 2 or croak 'usage: $ftp->pasv_wait(NON_PASV_FTP)'; + + my ($ftp, $non_pasv) = @_; + my ($file, $rin, $rout); + + vec($rin = '', fileno($ftp), 1) = 1; + select($rout = $rin, undef, undef, undef); + + my $dres = $ftp->response(); + my $sres = $non_pasv->response(); + + return + unless $dres == CMD_OK && $sres == CMD_OK; + + return + unless $ftp->ok() && $non_pasv->ok(); + + return $1 + if $ftp->message =~ /unique file name:\s*(\S*)\s*\)/; + + return $1 + if $non_pasv->message =~ /unique file name:\s*(\S*)\s*\)/; + + return 1; +} + + +sub feature { + @_ == 2 or croak 'usage: $ftp->feature( NAME )'; + my ($ftp, $feat) = @_; + + my $feature = ${*$ftp}{net_ftp_feature} ||= do { + my @feat; + + # Example response + # 211-Features: + # MDTM + # REST STREAM + # SIZE + # 211 End + + @feat = map { /^\s+(.*\S)/ } $ftp->message + if $ftp->_FEAT; + + \@feat; + }; + + return grep { /^\Q$feat\E\b/i } @$feature; +} + + +sub cmd { shift->command(@_)->response() } + +######################################## +# +# RFC959 + RFC2428 + RFC4217 commands +# + + +sub _ABOR { shift->command("ABOR")->response() == CMD_OK } +sub _ALLO { shift->command("ALLO", @_)->response() == CMD_OK } +sub _CDUP { shift->command("CDUP")->response() == CMD_OK } +sub _NOOP { shift->command("NOOP")->response() == CMD_OK } +sub _PASV { shift->command("PASV")->response() == CMD_OK } +sub _QUIT { shift->command("QUIT")->response() == CMD_OK } +sub _DELE { shift->command("DELE", @_)->response() == CMD_OK } +sub _CWD { shift->command("CWD", @_)->response() == CMD_OK } +sub _PORT { shift->command("PORT", @_)->response() == CMD_OK } +sub _RMD { shift->command("RMD", @_)->response() == CMD_OK } +sub _MKD { shift->command("MKD", @_)->response() == CMD_OK } +sub _PWD { shift->command("PWD", @_)->response() == CMD_OK } +sub _TYPE { shift->command("TYPE", @_)->response() == CMD_OK } +sub _RNTO { shift->command("RNTO", @_)->response() == CMD_OK } +sub _RESP { shift->command("RESP", @_)->response() == CMD_OK } +sub _MDTM { shift->command("MDTM", @_)->response() == CMD_OK } +sub _SIZE { shift->command("SIZE", @_)->response() == CMD_OK } +sub _HELP { shift->command("HELP", @_)->response() == CMD_OK } +sub _STAT { shift->command("STAT", @_)->response() == CMD_OK } +sub _FEAT { shift->command("FEAT", @_)->response() == CMD_OK } +sub _PBSZ { shift->command("PBSZ", @_)->response() == CMD_OK } +sub _PROT { shift->command("PROT", @_)->response() == CMD_OK } +sub _CCC { shift->command("CCC", @_)->response() == CMD_OK } +sub _EPRT { shift->command("EPRT", @_)->response() == CMD_OK } +sub _EPSV { shift->command("EPSV", @_)->response() == CMD_OK } +sub _APPE { shift->command("APPE", @_)->response() == CMD_INFO } +sub _LIST { shift->command("LIST", @_)->response() == CMD_INFO } +sub _NLST { shift->command("NLST", @_)->response() == CMD_INFO } +sub _RETR { shift->command("RETR", @_)->response() == CMD_INFO } +sub _STOR { shift->command("STOR", @_)->response() == CMD_INFO } +sub _STOU { shift->command("STOU", @_)->response() == CMD_INFO } +sub _RNFR { shift->command("RNFR", @_)->response() == CMD_MORE } +sub _REST { shift->command("REST", @_)->response() == CMD_MORE } +sub _PASS { shift->command("PASS", @_)->response() } +sub _ACCT { shift->command("ACCT", @_)->response() } +sub _AUTH { shift->command("AUTH", @_)->response() } + + +sub _USER { + my $ftp = shift; + my $ok = $ftp->command("USER", @_)->response(); + + # A certain brain dead firewall :-) + $ok = $ftp->command("user", @_)->response() + unless $ok == CMD_MORE or $ok == CMD_OK; + + $ok; +} + + +sub _SMNT { shift->unsupported(@_) } +sub _MODE { shift->unsupported(@_) } +sub _SYST { shift->unsupported(@_) } +sub _STRU { shift->unsupported(@_) } +sub _REIN { shift->unsupported(@_) } + +{ + # Session Cache with single entry + # used to make sure that we reuse same session for control and data channels + package Net::FTP::_SSL_SingleSessionCache; + sub new { my $x; return bless \$x,shift } + sub add_session { + my ($cache,$key,$session) = @_; + Net::SSLeay::SESSION_free($$cache) if $$cache; + $$cache = $session; + } + sub get_session { + my $cache = shift; + return $$cache + } + sub DESTROY { + my $cache = shift; + Net::SSLeay::SESSION_free($$cache) if $$cache; + } +} + +1; + +__END__ + +=head1 NAME + +Net::FTP - FTP Client class + +=head1 SYNOPSIS + + use Net::FTP; + + $ftp = Net::FTP->new("some.host.name", Debug => 0) + or die "Cannot connect to some.host.name: $@"; + + $ftp->login("anonymous",'-anonymous@') + or die "Cannot login ", $ftp->message; + + $ftp->cwd("/pub") + or die "Cannot change working directory ", $ftp->message; + + $ftp->get("that.file") + or die "get failed ", $ftp->message; + + $ftp->quit; + +=head1 DESCRIPTION + +C<Net::FTP> is a class implementing a simple FTP client in Perl as +described in RFC959. It provides wrappers for the commonly used subset of the +RFC959 commands. +If L<IO::Socket::IP> or L<IO::Socket::INET6> is installed it also provides +support for IPv6 as defined in RFC2428. +And with L<IO::Socket::SSL> installed it provides support for implicit FTPS +and explicit FTPS as defined in RFC4217. + +The Net::FTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + +=head1 OVERVIEW + +FTP stands for File Transfer Protocol. It is a way of transferring +files between networked machines. The protocol defines a client +(whose commands are provided by this module) and a server (not +implemented in this module). Communication is always initiated by the +client, and the server responds with a message and a status code (and +sometimes with data). + +The FTP protocol allows files to be sent to or fetched from the +server. Each transfer involves a B<local file> (on the client) and a +B<remote file> (on the server). In this module, the same file name +will be used for both local and remote if only one is specified. This +means that transferring remote file C</path/to/file> will try to put +that file in C</path/to/file> locally, unless you specify a local file +name. + +The protocol also defines several standard B<translations> which the +file can undergo during transfer. These are ASCII, EBCDIC, binary, +and byte. ASCII is the default type, and indicates that the sender of +files will translate the ends of lines to a standard representation +which the receiver will then translate back into their local +representation. EBCDIC indicates the file being transferred is in +EBCDIC format. Binary (also known as image) format sends the data as +a contiguous bit stream. Byte format transfers the data as bytes, the +values of which remain the same regardless of differences in byte size +between the two machines (in theory - in practice you should only use +this if you really know what you're doing). This class does not support +the EBCDIC or byte formats, and will default to binary instead if they +are attempted. + +=head1 CONSTRUCTOR + +=over 4 + +=item new ([ HOST ] [, OPTIONS ]) + +This is the constructor for a new Net::FTP object. C<HOST> is the +name of the remote host to which an FTP connection is required. + +C<HOST> is optional. If C<HOST> is not given then it may instead be +passed as the C<Host> option described below. + +C<OPTIONS> are passed in a hash like fashion, using key and value pairs. +Possible options are: + +B<Host> - FTP host to connect to. It may be a single scalar, as defined for +the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +an array with hosts to try in turn. The L</host> method will return the value +which was used to connect to the host. + +B<Firewall> - The name of a machine which acts as an FTP firewall. This can be +overridden by an environment variable C<FTP_FIREWALL>. If specified, and the +given host cannot be directly connected to, then the +connection is made to the firewall machine and the string C<@hostname> is +appended to the login identifier. This kind of setup is also referred to +as an ftp proxy. + +B<FirewallType> - The type of firewall running on the machine indicated by +B<Firewall>. This can be overridden by an environment variable +C<FTP_FIREWALL_TYPE>. For a list of permissible types, see the description of +ftp_firewall_type in L<Net::Config>. + +B<BlockSize> - This is the block size that Net::FTP will use when doing +transfers. (defaults to 10240) + +B<Port> - The port number to connect to on the remote machine for the +FTP connection + +B<SSL> - If the connection should be done from start with SSL, contrary to later +upgrade with C<starttls>. + +B<SSL_*> - SSL arguments which will be applied when upgrading the control or +data connection to SSL. You can use SSL arguments as documented in +L<IO::Socket::SSL>, but it will usually use the right arguments already. + +B<Timeout> - Set a timeout value in seconds (defaults to 120) + +B<Debug> - debug level (see the debug method in L<Net::Cmd>) + +B<Passive> - If set to a non-zero value then all data transfers will +be done using passive mode. If set to zero then data transfers will be +done using active mode. If the machine is connected to the Internet +directly, both passive and active mode should work equally well. +Behind most firewall and NAT configurations passive mode has a better +chance of working. However, in some rare firewall configurations, +active mode actually works when passive mode doesn't. Some really old +FTP servers might not implement passive transfers. If not specified, +then the transfer mode is set by the environment variable +C<FTP_PASSIVE> or if that one is not set by the settings done by the +F<libnetcfg> utility. If none of these apply then passive mode is +used. + +B<Hash> - If given a reference to a file handle (e.g., C<\*STDERR>), +print hash marks (#) on that filehandle every 1024 bytes. This +simply invokes the C<hash()> method for you, so that hash marks +are displayed for all transfers. You can, of course, call C<hash()> +explicitly whenever you'd like. + +B<LocalAddr> - Local address to use for all socket connections. This +argument will be passed to the super class, i.e. L<IO::Socket::INET> +or L<IO::Socket::IP>. + +B<Domain> - Domain to use, i.e. AF_INET or AF_INET6. This +argument will be passed to the IO::Socket super class. +This can be used to enforce IPv4 even with L<IO::Socket::IP> +which would default to IPv6. +B<Family> is accepted as alternative name for B<Domain>. + +If the constructor fails undef will be returned and an error message will +be in $@ + +=back + +=head1 METHODS + +Unless otherwise stated all methods return either a I<true> or I<false> +value, with I<true> meaning that the operation was a success. When a method +states that it returns a value, failure will be returned as I<undef> or an +empty list. + +C<Net::FTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote FTP server in addition to the methods +documented here. + +=over 4 + +=item login ([LOGIN [,PASSWORD [, ACCOUNT] ] ]) + +Log into the remote FTP server with the given login information. If +no arguments are given then the C<Net::FTP> uses the C<Net::Netrc> +package to lookup the login information for the connected host. +If no information is found then a login of I<anonymous> is used. +If no password is given and the login is I<anonymous> then I<anonymous@> +will be used for password. + +If the connection is via a firewall then the C<authorize> method will +be called with no arguments. + +=item starttls () + +Upgrade existing plain connection to SSL. +The SSL arguments have to be given in C<new> already because they are needed for +data connections too. + +=item stoptls () + +Downgrade existing SSL connection back to plain. +This is needed to work with some FTP helpers at firewalls, which need to see the +PORT and PASV commands and responses to dynamically open the necessary ports. +In this case C<starttls> is usually only done to protect the authorization. + +=item prot ( LEVEL ) + +Set what type of data channel protection the client and server will be using. +Only C<LEVEL>s "C" (clear) and "P" (private) are supported. + +=item host () + +Returns the value used by the constructor, and passed to the IO::Socket super +class to connect to the host. + +=item account( ACCT ) + +Set a string identifying the user's account. + +=item authorize ( [AUTH [, RESP]]) + +This is a protocol used by some firewall ftp proxies. It is used +to authorise the user to send data out. If both arguments are not specified +then C<authorize> uses C<Net::Netrc> to do a lookup. + +=item site (ARGS) + +Send a SITE command to the remote server and wait for a response. + +Returns most significant digit of the response code. + +=item ascii () + +Transfer file in ASCII. CRLF translation will be done if required + +=item binary () + +Transfer file in binary mode. No transformation will be done. + +B<Hint>: If both server and client machines use the same line ending for +text files, then it will be faster to transfer all files in binary mode. + +=item type ( [ TYPE ] ) + +Set or get if files will be transferred in ASCII or binary mode. + +=item rename ( OLDNAME, NEWNAME ) + +Rename a file on the remote FTP server from C<OLDNAME> to C<NEWNAME>. This +is done by sending the RNFR and RNTO commands. + +=item delete ( FILENAME ) + +Send a request to the server to delete C<FILENAME>. + +=item cwd ( [ DIR ] ) + +Attempt to change directory to the directory given in C<$dir>. If +C<$dir> is C<"..">, the FTP C<CDUP> command is used to attempt to +move up one directory. If no directory is given then an attempt is made +to change the directory to the root directory. + +=item cdup () + +Change directory to the parent of the current directory. + +=item passive ( [ PASSIVE ] ) + +Set or get if data connections will be initiated in passive mode. + +=item pwd () + +Returns the full pathname of the current directory. + +=item restart ( WHERE ) + +Set the byte offset at which to begin the next data transfer. Net::FTP simply +records this value and uses it when during the next data transfer. For this +reason this method will not return an error, but setting it may cause +a subsequent data transfer to fail. + +=item rmdir ( DIR [, RECURSE ]) + +Remove the directory with the name C<DIR>. If C<RECURSE> is I<true> then +C<rmdir> will attempt to delete everything inside the directory. + +=item mkdir ( DIR [, RECURSE ]) + +Create a new directory with the name C<DIR>. If C<RECURSE> is I<true> then +C<mkdir> will attempt to create all the directories in the given path. + +Returns the full pathname to the new directory. + +=item alloc ( SIZE [, RECORD_SIZE] ) + +The alloc command allows you to give the ftp server a hint about the size +of the file about to be transferred using the ALLO ftp command. Some storage +systems use this to make intelligent decisions about how to store the file. +The C<SIZE> argument represents the size of the file in bytes. The +C<RECORD_SIZE> argument indicates a maximum record or page size for files +sent with a record or page structure. + +The size of the file will be determined, and sent to the server +automatically for normal files so that this method need only be called if +you are transferring data from a socket, named pipe, or other stream not +associated with a normal file. + +=item ls ( [ DIR ] ) + +Get a directory listing of C<DIR>, or the current directory. + +In an array context, returns a list of lines returned from the server. In +a scalar context, returns a reference to a list. + +=item dir ( [ DIR ] ) + +Get a directory listing of C<DIR>, or the current directory in long format. + +In an array context, returns a list of lines returned from the server. In +a scalar context, returns a reference to a list. + +=item get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] ) + +Get C<REMOTE_FILE> from the server and store locally. C<LOCAL_FILE> may be +a filename or a filehandle. If not specified, the file will be stored in +the current directory with the same leafname as the remote file. + +If C<WHERE> is given then the first C<WHERE> bytes of the file will +not be transferred, and the remaining bytes will be appended to +the local file if it already exists. + +Returns C<LOCAL_FILE>, or the generated local file name if C<LOCAL_FILE> +is not given. If an error was encountered undef is returned. + +=item put ( LOCAL_FILE [, REMOTE_FILE ] ) + +Put a file on the remote server. C<LOCAL_FILE> may be a name or a filehandle. +If C<LOCAL_FILE> is a filehandle then C<REMOTE_FILE> must be specified. If +C<REMOTE_FILE> is not specified then the file will be stored in the current +directory with the same leafname as C<LOCAL_FILE>. + +Returns C<REMOTE_FILE>, or the generated remote filename if C<REMOTE_FILE> +is not given. + +B<NOTE>: If for some reason the transfer does not complete and an error is +returned then the contents that had been transferred will not be remove +automatically. + +=item put_unique ( LOCAL_FILE [, REMOTE_FILE ] ) + +Same as put but uses the C<STOU> command. + +Returns the name of the file on the server. + +=item append ( LOCAL_FILE [, REMOTE_FILE ] ) + +Same as put but appends to the file on the remote server. + +Returns C<REMOTE_FILE>, or the generated remote filename if C<REMOTE_FILE> +is not given. + +=item unique_name () + +Returns the name of the last file stored on the server using the +C<STOU> command. + +=item mdtm ( FILE ) + +Returns the I<modification time> of the given file + +=item size ( FILE ) + +Returns the size in bytes for the given file as stored on the remote server. + +B<NOTE>: The size reported is the size of the stored file on the remote server. +If the file is subsequently transferred from the server in ASCII mode +and the remote server and local machine have different ideas about +"End Of Line" then the size of file on the local machine after transfer +may be different. + +=item supported ( CMD ) + +Returns TRUE if the remote server supports the given command. + +=item hash ( [FILEHANDLE_GLOB_REF],[ BYTES_PER_HASH_MARK] ) + +Called without parameters, or with the first argument false, hash marks +are suppressed. If the first argument is true but not a reference to a +file handle glob, then \*STDERR is used. The second argument is the number +of bytes per hash mark printed, and defaults to 1024. In all cases the +return value is a reference to an array of two: the filehandle glob reference +and the bytes per hash mark. + +=item feature ( NAME ) + +Determine if the server supports the specified feature. The return +value is a list of lines the server responded with to describe the +options that it supports for the given feature. If the feature is +unsupported then the empty list is returned. + + if ($ftp->feature( 'MDTM' )) { + # Do something + } + + if (grep { /\bTLS\b/ } $ftp->feature('AUTH')) { + # Server supports TLS + } + +=back + +The following methods can return different results depending on +how they are called. If the user explicitly calls either +of the C<pasv> or C<port> methods then these methods will +return a I<true> or I<false> value. If the user does not +call either of these methods then the result will be a +reference to a C<Net::FTP::dataconn> based object. + +=over 4 + +=item nlst ( [ DIR ] ) + +Send an C<NLST> command to the server, with an optional parameter. + +=item list ( [ DIR ] ) + +Same as C<nlst> but using the C<LIST> command + +=item retr ( FILE ) + +Begin the retrieval of a file called C<FILE> from the remote server. + +=item stor ( FILE ) + +Tell the server that you wish to store a file. C<FILE> is the +name of the new file that should be created. + +=item stou ( FILE ) + +Same as C<stor> but using the C<STOU> command. The name of the unique +file which was created on the server will be available via the C<unique_name> +method after the data connection has been closed. + +=item appe ( FILE ) + +Tell the server that we want to append some data to the end of a file +called C<FILE>. If this file does not exist then create it. + +=back + +If for some reason you want to have complete control over the data connection, +this includes generating it and calling the C<response> method when required, +then the user can use these methods to do so. + +However calling these methods only affects the use of the methods above that +can return a data connection. They have no effect on methods C<get>, C<put>, +C<put_unique> and those that do not require data connections. + +=over 4 + +=item port ( [ PORT ] ) + +=item eprt ( [ PORT ] ) + +Send a C<PORT> (IPv4) or C<EPRT> (IPv6) command to the server. If C<PORT> is +specified then it is sent to the server. If not, then a listen socket is created +and the correct information sent to the server. + +=item pasv () + +=item epsv () + +Tell the server to go into passive mode (C<pasv> for IPv4, C<epsv> for IPv6). +Returns the text that represents the port on which the server is listening, this +text is in a suitable form to send to another ftp server using the C<port> or +C<eprt> method. + +=back + +The following methods can be used to transfer files between two remote +servers, providing that these two servers can connect directly to each other. + +=over 4 + +=item pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] ) + +This method will do a file transfer between two remote ftp servers. If +C<DEST_FILE> is omitted then the leaf name of C<SRC_FILE> will be used. + +=item pasv_xfer_unique ( SRC_FILE, DEST_SERVER [, DEST_FILE ] ) + +Like C<pasv_xfer> but the file is stored on the remote server using +the STOU command. + +=item pasv_wait ( NON_PASV_SERVER ) + +This method can be used to wait for a transfer to complete between a passive +server and a non-passive server. The method should be called on the passive +server with the C<Net::FTP> object for the non-passive server passed as an +argument. + +=item abort () + +Abort the current data transfer. + +=item quit () + +Send the QUIT command to the remote FTP server and close the socket connection. + +=back + +=head2 Methods for the adventurous + +=over 4 + +=item quot (CMD [,ARGS]) + +Send a command, that Net::FTP does not directly support, to the remote +server and wait for a response. + +Returns most significant digit of the response code. + +B<WARNING> This call should only be used on commands that do not require +data connections. Misuse of this method can hang the connection. + +=item can_inet6 () + +Returns whether we can use IPv6. + +=item can_ssl () + +Returns whether we can use SSL. + +=back + +=head1 THE dataconn CLASS + +Some of the methods defined in C<Net::FTP> return an object which will +be derived from the C<Net::FTP::dataconn> class. See L<Net::FTP::dataconn> for +more details. + +=head1 UNIMPLEMENTED + +The following RFC959 commands have not been implemented: + +=over 4 + +=item B<SMNT> + +Mount a different file system structure without changing login or +accounting information. + +=item B<HELP> + +Ask the server for "helpful information" (that's what the RFC says) on +the commands it accepts. + +=item B<MODE> + +Specifies transfer mode (stream, block or compressed) for file to be +transferred. + +=item B<SYST> + +Request remote server system identification. + +=item B<STAT> + +Request remote server status. + +=item B<STRU> + +Specifies file structure for file to be transferred. + +=item B<REIN> + +Reinitialize the connection, flushing all I/O and account information. + +=back + +=head1 REPORTING BUGS + +When reporting bugs/problems please include as much information as possible. +It may be difficult for me to reproduce the problem as almost every setup +is different. + +A small script which yields the problem will probably be of help. It would +also be useful if this script was run with the extra options C<< Debug => 1 >> +passed to the constructor, and the output sent with the bug report. If you +cannot include a small script then please include a Debug trace from a +run of your program which does yield the problem. + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 SEE ALSO + +L<Net::Netrc>, +L<Net::Cmd>, +L<IO::Socket::SSL> + +ftp(1), ftpd(8), RFC 959, RFC 2428, RFC 4217 +http://www.ietf.org/rfc/rfc959.txt +http://www.ietf.org/rfc/rfc2428.txt +http://www.ietf.org/rfc/rfc4217.txt + +=head1 USE EXAMPLES + +For an example of the use of Net::FTP see + +=over 4 + +=item http://www.csh.rit.edu/~adam/Progs/ + +C<autoftp> is a program that can retrieve, send, or list files via +the FTP protocol in a non-interactive manner. + +=back + +=head1 CREDITS + +Henry Gabryjelski <henryg@WPI.EDU> - for the suggestion of creating directories +recursively. + +Nathan Torkington <gnat@frii.com> - for some input on the documentation. + +Roderick Schertler <roderick@gate.net> - for various inputs + +=head1 COPYRIGHT + +Copyright (C) 1995-2004 Graham Barr. All rights reserved. + +Copyright (C) 2013-2017 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/NNTP.pm b/data/miniconda3/lib/perl5/core_perl/Net/NNTP.pm new file mode 100644 index 0000000000000000000000000000000000000000..0c22930148a56adce768b031456a0bd4bce6d50f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/NNTP.pm @@ -0,0 +1,1302 @@ +# Net::NNTP.pm +# +# Copyright (C) 1995-1997 Graham Barr. All rights reserved. +# Copyright (C) 2013-2016 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::NNTP; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use IO::Socket; +use Net::Cmd; +use Net::Config; +use Time::Local; + +our $VERSION = "3.11"; + +# Code for detecting if we can use SSL +my $ssl_class = eval { + require IO::Socket::SSL; + # first version with default CA on most platforms + no warnings 'numeric'; + IO::Socket::SSL->VERSION(2.007); +} && 'IO::Socket::SSL'; + +my $nossl_warn = !$ssl_class && + 'To use SSL please install IO::Socket::SSL with version>=2.007'; + +# Code for detecting if we can use IPv6 +my $family_key = 'Domain'; +my $inet6_class = eval { + require IO::Socket::IP; + no warnings 'numeric'; + IO::Socket::IP->VERSION(0.25) || die; + $family_key = 'Family'; +} && 'IO::Socket::IP' || eval { + require IO::Socket::INET6; + no warnings 'numeric'; + IO::Socket::INET6->VERSION(2.62); +} && 'IO::Socket::INET6'; + + +sub can_ssl { $ssl_class }; +sub can_inet6 { $inet6_class }; + +our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET'); + + +sub new { + my $self = shift; + my $type = ref($self) || $self; + my ($host, %arg); + if (@_ % 2) { + $host = shift; + %arg = @_; + } + else { + %arg = @_; + $host = delete $arg{Host}; + } + my $obj; + + $host ||= $ENV{NNTPSERVER} || $ENV{NEWSHOST}; + + my $hosts = defined $host ? [$host] : $NetConfig{nntp_hosts}; + + @{$hosts} = qw(news) + unless @{$hosts}; + + my %connect = ( Proto => 'tcp'); + + if ($arg{SSL}) { + # SSL from start + die $nossl_warn if ! $ssl_class; + $arg{Port} ||= 563; + $connect{$_} = $arg{$_} for(grep { m{^SSL_} } keys %arg); + } + + foreach my $o (qw(LocalAddr LocalPort Timeout)) { + $connect{$o} = $arg{$o} if exists $arg{$o}; + } + $connect{$family_key} = $arg{Domain} || $arg{Family}; + $connect{Timeout} = 120 unless defined $connect{Timeout}; + $connect{PeerPort} = $arg{Port} || 'nntp(119)'; + foreach my $h (@{$hosts}) { + $connect{PeerAddr} = $h; + $obj = $type->SUPER::new(%connect) or next; + ${*$obj}{'net_nntp_host'} = $h; + ${*$obj}{'net_nntp_arg'} = \%arg; + if ($arg{SSL}) { + Net::NNTP::_SSL->start_SSL($obj,%arg) or next; + } + last: + } + + return + unless defined $obj; + + $obj->autoflush(1); + $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); + + unless ($obj->response() == CMD_OK) { + $obj->close; + return; + } + + my $c = $obj->code; + my @m = $obj->message; + + unless (exists $arg{Reader} && $arg{Reader} == 0) { + + # if server is INN and we have transfer rights the we are currently + # talking to innd not nnrpd + if ($obj->reader) { + + # If reader succeeds the we need to consider this code to determine postok + $c = $obj->code; + } + else { + + # I want to ignore this failure, so restore the previous status. + $obj->set_status($c, \@m); + } + } + + ${*$obj}{'net_nntp_post'} = $c == 200 ? 1 : 0; + + $obj; +} + + +sub host { + my $me = shift; + ${*$me}{'net_nntp_host'}; +} + + +sub debug_text { + my $nntp = shift; + my $inout = shift; + my $text = shift; + + if ( (ref($nntp) and $nntp->code == 350 and $text =~ /^(\S+)/) + || ($text =~ /^(authinfo\s+pass)/io)) + { + $text = "$1 ....\n"; + } + + $text; +} + + +sub postok { + @_ == 1 or croak 'usage: $nntp->postok()'; + my $nntp = shift; + ${*$nntp}{'net_nntp_post'} || 0; +} + + +sub starttls { + my $self = shift; + $ssl_class or die $nossl_warn; + $self->_STARTTLS or return; + Net::NNTP::_SSL->start_SSL($self, + %{ ${*$self}{'net_nntp_arg'} }, # (ssl) args given in new + @_ # more (ssl) args + ) or return; + return 1; +} + + +sub article { + @_ >= 1 && @_ <= 3 or croak 'usage: $nntp->article( [ MSGID ], [ FH ] )'; + my $nntp = shift; + my @fh; + + @fh = (pop) if @_ == 2 || (@_ && (ref($_[0]) || ref(\$_[0]) eq 'GLOB')); + + $nntp->_ARTICLE(@_) + ? $nntp->read_until_dot(@fh) + : undef; +} + + +sub articlefh { + @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->articlefh( [ MSGID ] )'; + my $nntp = shift; + + return unless $nntp->_ARTICLE(@_); + return $nntp->tied_fh; +} + + +sub authinfo { + @_ == 3 or croak 'usage: $nntp->authinfo( USER, PASS )'; + my ($nntp, $user, $pass) = @_; + + $nntp->_AUTHINFO("USER", $user) == CMD_MORE + && $nntp->_AUTHINFO("PASS", $pass) == CMD_OK; +} + + +sub authinfo_simple { + @_ == 3 or croak 'usage: $nntp->authinfo( USER, PASS )'; + my ($nntp, $user, $pass) = @_; + + $nntp->_AUTHINFO('SIMPLE') == CMD_MORE + && $nntp->command($user, $pass)->response == CMD_OK; +} + + +sub body { + @_ >= 1 && @_ <= 3 or croak 'usage: $nntp->body( [ MSGID ], [ FH ] )'; + my $nntp = shift; + my @fh; + + @fh = (pop) if @_ == 2 || (@_ && ref($_[0]) || ref(\$_[0]) eq 'GLOB'); + + $nntp->_BODY(@_) + ? $nntp->read_until_dot(@fh) + : undef; +} + + +sub bodyfh { + @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->bodyfh( [ MSGID ] )'; + my $nntp = shift; + return unless $nntp->_BODY(@_); + return $nntp->tied_fh; +} + + +sub head { + @_ >= 1 && @_ <= 3 or croak 'usage: $nntp->head( [ MSGID ], [ FH ] )'; + my $nntp = shift; + my @fh; + + @fh = (pop) if @_ == 2 || (@_ && ref($_[0]) || ref(\$_[0]) eq 'GLOB'); + + $nntp->_HEAD(@_) + ? $nntp->read_until_dot(@fh) + : undef; +} + + +sub headfh { + @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->headfh( [ MSGID ] )'; + my $nntp = shift; + return unless $nntp->_HEAD(@_); + return $nntp->tied_fh; +} + + +sub nntpstat { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->nntpstat( [ MSGID ] )'; + my $nntp = shift; + + $nntp->_STAT(@_) && $nntp->message =~ /(<[^>]+>)/o + ? $1 + : undef; +} + + +sub group { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->group( [ GROUP ] )'; + my $nntp = shift; + my $grp = ${*$nntp}{'net_nntp_group'}; + + return $grp + unless (@_ || wantarray); + + my $newgrp = shift; + + $newgrp = (defined($grp) and length($grp)) ? $grp : "" + unless defined($newgrp) and length($newgrp); + + return + unless $nntp->_GROUP($newgrp) and $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/; + + my ($count, $first, $last, $group) = ($1, $2, $3, $4); + + # group may be replied as '(current group)' + $group = ${*$nntp}{'net_nntp_group'} + if $group =~ /\(/; + + ${*$nntp}{'net_nntp_group'} = $group; + + wantarray + ? ($count, $first, $last, $group) + : $group; +} + + +sub help { + @_ == 1 or croak 'usage: $nntp->help()'; + my $nntp = shift; + + $nntp->_HELP + ? $nntp->read_until_dot + : undef; +} + + +sub ihave { + @_ >= 2 or croak 'usage: $nntp->ihave( MESSAGE-ID [, MESSAGE ])'; + my $nntp = shift; + my $mid = shift; + + $nntp->_IHAVE($mid) && $nntp->datasend(@_) + ? @_ == 0 || $nntp->dataend + : undef; +} + + +sub last { + @_ == 1 or croak 'usage: $nntp->last()'; + my $nntp = shift; + + $nntp->_LAST && $nntp->message =~ /(<[^>]+>)/o + ? $1 + : undef; +} + + +sub list { + @_ == 1 or croak 'usage: $nntp->list()'; + my $nntp = shift; + + $nntp->_LIST + ? $nntp->_grouplist + : undef; +} + + +sub newgroups { + @_ >= 2 or croak 'usage: $nntp->newgroups( SINCE [, DISTRIBUTIONS ])'; + my $nntp = shift; + my $time = _timestr(shift); + my $dist = shift || ""; + + $dist = join(",", @{$dist}) + if ref($dist); + + $nntp->_NEWGROUPS($time, $dist) + ? $nntp->_grouplist + : undef; +} + + +sub newnews { + @_ >= 2 && @_ <= 4 + or croak 'usage: $nntp->newnews( SINCE [, GROUPS [, DISTRIBUTIONS ]])'; + my $nntp = shift; + my $time = _timestr(shift); + my $grp = @_ ? shift: $nntp->group; + my $dist = shift || ""; + + $grp ||= "*"; + $grp = join(",", @{$grp}) + if ref($grp); + + $dist = join(",", @{$dist}) + if ref($dist); + + $nntp->_NEWNEWS($grp, $time, $dist) + ? $nntp->_articlelist + : undef; +} + + +sub next { + @_ == 1 or croak 'usage: $nntp->next()'; + my $nntp = shift; + + $nntp->_NEXT && $nntp->message =~ /(<[^>]+>)/o + ? $1 + : undef; +} + + +sub post { + @_ >= 1 or croak 'usage: $nntp->post( [ MESSAGE ] )'; + my $nntp = shift; + + $nntp->_POST() && $nntp->datasend(@_) + ? @_ == 0 || $nntp->dataend + : undef; +} + + +sub postfh { + my $nntp = shift; + return unless $nntp->_POST(); + return $nntp->tied_fh; +} + + +sub quit { + @_ == 1 or croak 'usage: $nntp->quit()'; + my $nntp = shift; + + $nntp->_QUIT; + $nntp->close; +} + + +sub slave { + @_ == 1 or croak 'usage: $nntp->slave()'; + my $nntp = shift; + + $nntp->_SLAVE; +} + +## +## The following methods are not implemented by all servers +## + + +sub active { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->active( [ PATTERN ] )'; + my $nntp = shift; + + $nntp->_LIST('ACTIVE', @_) + ? $nntp->_grouplist + : undef; +} + + +sub active_times { + @_ == 1 or croak 'usage: $nntp->active_times()'; + my $nntp = shift; + + $nntp->_LIST('ACTIVE.TIMES') + ? $nntp->_grouplist + : undef; +} + + +sub distributions { + @_ == 1 or croak 'usage: $nntp->distributions()'; + my $nntp = shift; + + $nntp->_LIST('DISTRIBUTIONS') + ? $nntp->_description + : undef; +} + + +sub distribution_patterns { + @_ == 1 or croak 'usage: $nntp->distributions()'; + my $nntp = shift; + + my $arr; + local $_; + + ## no critic (ControlStructures::ProhibitMutatingListFunctions) + $nntp->_LIST('DISTRIB.PATS') + && ($arr = $nntp->read_until_dot) + ? [grep { /^\d/ && (chomp, $_ = [split /:/]) } @$arr] + : undef; +} + + +sub newsgroups { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->newsgroups( [ PATTERN ] )'; + my $nntp = shift; + + $nntp->_LIST('NEWSGROUPS', @_) + ? $nntp->_description + : undef; +} + + +sub overview_fmt { + @_ == 1 or croak 'usage: $nntp->overview_fmt()'; + my $nntp = shift; + + $nntp->_LIST('OVERVIEW.FMT') + ? $nntp->_articlelist + : undef; +} + + +sub subscriptions { + @_ == 1 or croak 'usage: $nntp->subscriptions()'; + my $nntp = shift; + + $nntp->_LIST('SUBSCRIPTIONS') + ? $nntp->_articlelist + : undef; +} + + +sub listgroup { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->listgroup( [ GROUP ] )'; + my $nntp = shift; + + $nntp->_LISTGROUP(@_) + ? $nntp->_articlelist + : undef; +} + + +sub reader { + @_ == 1 or croak 'usage: $nntp->reader()'; + my $nntp = shift; + + $nntp->_MODE('READER'); +} + + +sub xgtitle { + @_ == 1 || @_ == 2 or croak 'usage: $nntp->xgtitle( [ PATTERN ] )'; + my $nntp = shift; + + $nntp->_XGTITLE(@_) + ? $nntp->_description + : undef; +} + + +sub xhdr { + @_ >= 2 && @_ <= 4 or croak 'usage: $nntp->xhdr( HEADER, [ MESSAGE-SPEC ] )'; + my $nntp = shift; + my $hdr = shift; + my $arg = _msg_arg(@_); + + $nntp->_XHDR($hdr, $arg) + ? $nntp->_description + : undef; +} + + +sub xover { + @_ == 2 || @_ == 3 or croak 'usage: $nntp->xover( MESSAGE-SPEC )'; + my $nntp = shift; + my $arg = _msg_arg(@_); + + $nntp->_XOVER($arg) + ? $nntp->_fieldlist + : undef; +} + + +sub xpat { + @_ == 4 || @_ == 5 or croak '$nntp->xpat( HEADER, PATTERN, MESSAGE-SPEC )'; + my $nntp = shift; + my $hdr = shift; + my $pat = shift; + my $arg = _msg_arg(@_); + + $pat = join(" ", @$pat) + if ref($pat); + + $nntp->_XPAT($hdr, $arg, $pat) + ? $nntp->_description + : undef; +} + + +sub xpath { + @_ == 2 or croak 'usage: $nntp->xpath( MESSAGE-ID )'; + my ($nntp, $mid) = @_; + + return + unless $nntp->_XPATH($mid); + + my $m; + ($m = $nntp->message) =~ s/^\d+\s+//o; + my @p = split /\s+/, $m; + + wantarray ? @p : $p[0]; +} + + +sub xrover { + @_ == 2 || @_ == 3 or croak 'usage: $nntp->xrover( MESSAGE-SPEC )'; + my $nntp = shift; + my $arg = _msg_arg(@_); + + $nntp->_XROVER($arg) + ? $nntp->_description + : undef; +} + + +sub date { + @_ == 1 or croak 'usage: $nntp->date()'; + my $nntp = shift; + + $nntp->_DATE + && $nntp->message =~ /(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ + ? timegm($6, $5, $4, $3, $2 - 1, $1 - 1900) + : undef; +} + + +## +## Private subroutines +## + + +sub _msg_arg { + my $spec = shift; + my $arg = ""; + + if (@_) { + carp "Depriciated passing of two message numbers, " . "pass a reference" + if $^W; + $spec = [$spec, $_[0]]; + } + + if (defined $spec) { + if (ref($spec)) { + $arg = $spec->[0]; + if (defined $spec->[1]) { + $arg .= "-" + if $spec->[1] != $spec->[0]; + $arg .= $spec->[1] + if $spec->[1] > $spec->[0]; + } + } + else { + $arg = $spec; + } + } + + $arg; +} + + +sub _timestr { + my $time = shift; + my @g = reverse((gmtime($time))[0 .. 5]); + $g[1] += 1; + $g[0] %= 100; + sprintf "%02d%02d%02d %02d%02d%02d GMT", @g; +} + + +sub _grouplist { + my $nntp = shift; + my $arr = $nntp->read_until_dot + or return; + + my $hash = {}; + + foreach my $ln (@$arr) { + my @a = split(/[\s\n]+/, $ln); + $hash->{$a[0]} = [@a[1, 2, 3]]; + } + + $hash; +} + + +sub _fieldlist { + my $nntp = shift; + my $arr = $nntp->read_until_dot + or return; + + my $hash = {}; + + foreach my $ln (@$arr) { + my @a = split(/[\t\n]/, $ln); + my $m = shift @a; + $hash->{$m} = [@a]; + } + + $hash; +} + + +sub _articlelist { + my $nntp = shift; + my $arr = $nntp->read_until_dot; + + chomp(@$arr) + if $arr; + + $arr; +} + + +sub _description { + my $nntp = shift; + my $arr = $nntp->read_until_dot + or return; + + my $hash = {}; + + foreach my $ln (@$arr) { + chomp($ln); + + $hash->{$1} = $ln + if $ln =~ s/^\s*(\S+)\s*//o; + } + + $hash; + +} + +## +## The commands +## + + +sub _ARTICLE { shift->command('ARTICLE', @_)->response == CMD_OK } +sub _AUTHINFO { shift->command('AUTHINFO', @_)->response } +sub _BODY { shift->command('BODY', @_)->response == CMD_OK } +sub _DATE { shift->command('DATE')->response == CMD_INFO } +sub _GROUP { shift->command('GROUP', @_)->response == CMD_OK } +sub _HEAD { shift->command('HEAD', @_)->response == CMD_OK } +sub _HELP { shift->command('HELP', @_)->response == CMD_INFO } +sub _IHAVE { shift->command('IHAVE', @_)->response == CMD_MORE } +sub _LAST { shift->command('LAST')->response == CMD_OK } +sub _LIST { shift->command('LIST', @_)->response == CMD_OK } +sub _LISTGROUP { shift->command('LISTGROUP', @_)->response == CMD_OK } +sub _NEWGROUPS { shift->command('NEWGROUPS', @_)->response == CMD_OK } +sub _NEWNEWS { shift->command('NEWNEWS', @_)->response == CMD_OK } +sub _NEXT { shift->command('NEXT')->response == CMD_OK } +sub _POST { shift->command('POST', @_)->response == CMD_MORE } +sub _QUIT { shift->command('QUIT', @_)->response == CMD_OK } +sub _SLAVE { shift->command('SLAVE', @_)->response == CMD_OK } +sub _STARTTLS { shift->command("STARTTLS")->response() == CMD_MORE } +sub _STAT { shift->command('STAT', @_)->response == CMD_OK } +sub _MODE { shift->command('MODE', @_)->response == CMD_OK } +sub _XGTITLE { shift->command('XGTITLE', @_)->response == CMD_OK } +sub _XHDR { shift->command('XHDR', @_)->response == CMD_OK } +sub _XPAT { shift->command('XPAT', @_)->response == CMD_OK } +sub _XPATH { shift->command('XPATH', @_)->response == CMD_OK } +sub _XOVER { shift->command('XOVER', @_)->response == CMD_OK } +sub _XROVER { shift->command('XROVER', @_)->response == CMD_OK } +sub _XTHREAD { shift->unsupported } +sub _XSEARCH { shift->unsupported } +sub _XINDEX { shift->unsupported } + +## +## IO/perl methods +## + + +sub DESTROY { + my $nntp = shift; + defined(fileno($nntp)) && $nntp->quit; +} + +{ + package Net::NNTP::_SSL; + our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::NNTP' ); + sub starttls { die "NNTP connection is already in SSL mode" } + sub start_SSL { + my ($class,$nntp,%arg) = @_; + delete @arg{ grep { !m{^SSL_} } keys %arg }; + ( $arg{SSL_verifycn_name} ||= $nntp->host ) + =~s{(?<!:):[\w()]+$}{}; # strip port + $arg{SSL_hostname} = $arg{SSL_verifycn_name} + if ! defined $arg{SSL_hostname} && $class->can_client_sni; + my $ok = $class->SUPER::start_SSL($nntp, + SSL_verifycn_scheme => 'nntp', + %arg + ); + $@ = $ssl_class->errstr if !$ok; + return $ok; + } +} + + + + +1; + +__END__ + +=head1 NAME + +Net::NNTP - NNTP Client class + +=head1 SYNOPSIS + + use Net::NNTP; + + $nntp = Net::NNTP->new("some.host.name"); + $nntp->quit; + + # start with SSL, e.g. nntps + $nntp = Net::NNTP->new("some.host.name", SSL => 1); + + # start with plain and upgrade to SSL + $nntp = Net::NNTP->new("some.host.name"); + $nntp->starttls; + + +=head1 DESCRIPTION + +C<Net::NNTP> is a class implementing a simple NNTP client in Perl as described +in RFC977 and RFC4642. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. NNTPS or NNTP+STARTTLS. + +The Net::NNTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + +=head1 CONSTRUCTOR + +=over 4 + +=item new ( [ HOST ] [, OPTIONS ]) + +This is the constructor for a new Net::NNTP object. C<HOST> is the +name of the remote host to which a NNTP connection is required. If not +given then it may be passed as the C<Host> option described below. If no host is passed +then two environment variables are checked, first C<NNTPSERVER> then +C<NEWSHOST>, then C<Net::Config> is checked, and if a host is not found +then C<news> is used. + +C<OPTIONS> are passed in a hash like fashion, using key and value pairs. +Possible options are: + +B<Host> - NNTP host to connect to. It may be a single scalar, as defined for +the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +an array with hosts to try in turn. The L</host> method will return the value +which was used to connect to the host. + +B<Port> - port to connect to. +Default - 119 for plain NNTP and 563 for immediate SSL (nntps). + +B<SSL> - If the connection should be done from start with SSL, contrary to later +upgrade with C<starttls>. +You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will +usually use the right arguments already. + +B<Timeout> - Maximum time, in seconds, to wait for a response from the +NNTP server, a value of zero will cause all IO operations to block. +(default: 120) + +B<Debug> - Enable the printing of debugging information to STDERR + +B<Reader> - If the remote server is INN then initially the connection +will be to innd, by default C<Net::NNTP> will issue a C<MODE READER> command +so that the remote server becomes nnrpd. If the C<Reader> option is given +with a value of zero, then this command will not be sent and the +connection will be left talking to innd. + +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a specific local address and port. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. + +=back + +=head1 METHODS + +Unless otherwise stated all methods return either a I<true> or I<false> +value, with I<true> meaning that the operation was a success. When a method +states that it returns a value, failure will be returned as I<undef> or an +empty list. + +C<Net::NNTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote NNTP server in addition to the methods +documented here. + +=over 4 + +=item host () + +Returns the value used by the constructor, and passed to IO::Socket::INET, +to connect to the host. + +=item starttls () + +Upgrade existing plain connection to SSL. +Any arguments necessary for SSL must be given in C<new> already. + +=item article ( [ MSGID|MSGNUM ], [FH] ) + +Retrieve the header, a blank line, then the body (text) of the +specified article. + +If C<FH> is specified then it is expected to be a valid filehandle +and the result will be printed to it, on success a true value will be +returned. If C<FH> is not specified then the return value, on success, +will be a reference to an array containing the article requested, each +entry in the array will contain one line of the article. + +If no arguments are passed then the current article in the currently +selected newsgroup is fetched. + +C<MSGNUM> is a numeric id of an article in the current newsgroup, and +will change the current article pointer. C<MSGID> is the message id of +an article as shown in that article's header. It is anticipated that the +client will obtain the C<MSGID> from a list provided by the C<newnews> +command, from references contained within another article, or from the +message-id provided in the response to some other commands. + +If there is an error then C<undef> will be returned. + +=item body ( [ MSGID|MSGNUM ], [FH] ) + +Like C<article> but only fetches the body of the article. + +=item head ( [ MSGID|MSGNUM ], [FH] ) + +Like C<article> but only fetches the headers for the article. + +=item articlefh ( [ MSGID|MSGNUM ] ) + +=item bodyfh ( [ MSGID|MSGNUM ] ) + +=item headfh ( [ MSGID|MSGNUM ] ) + +These are similar to article(), body() and head(), but rather than +returning the requested data directly, they return a tied filehandle +from which to read the article. + +=item nntpstat ( [ MSGID|MSGNUM ] ) + +The C<nntpstat> command is similar to the C<article> command except that no +text is returned. When selecting by message number within a group, +the C<nntpstat> command serves to set the "current article pointer" without +sending text. + +Using the C<nntpstat> command to +select by message-id is valid but of questionable value, since a +selection by message-id does B<not> alter the "current article pointer". + +Returns the message-id of the "current article". + +=item group ( [ GROUP ] ) + +Set and/or get the current group. If C<GROUP> is not given then information +is returned on the current group. + +In a scalar context it returns the group name. + +In an array context the return value is a list containing, the number +of articles in the group, the number of the first article, the number +of the last article and the group name. + +=item help ( ) + +Request help text (a short summary of commands that are understood by this +implementation) from the server. Returns the text or undef upon failure. + +=item ihave ( MSGID [, MESSAGE ]) + +The C<ihave> command informs the server that the client has an article +whose id is C<MSGID>. If the server desires a copy of that +article and C<MESSAGE> has been given then it will be sent. + +Returns I<true> if the server desires the article and C<MESSAGE> was +successfully sent, if specified. + +If C<MESSAGE> is not specified then the message must be sent using the +C<datasend> and C<dataend> methods from L<Net::Cmd> + +C<MESSAGE> can be either an array of lines or a reference to an array +and must be encoded by the caller to octets of whatever encoding is required, +e.g. by using the Encode module's C<encode()> function. + +=item last () + +Set the "current article pointer" to the previous article in the current +newsgroup. + +Returns the message-id of the article. + +=item date () + +Returns the date on the remote server. This date will be in a UNIX time +format (seconds since 1970) + +=item postok () + +C<postok> will return I<true> if the servers initial response indicated +that it will allow posting. + +=item authinfo ( USER, PASS ) + +Authenticates to the server (using the original AUTHINFO USER / AUTHINFO PASS +form, defined in RFC2980) using the supplied username and password. Please +note that the password is sent in clear text to the server. This command +should not be used with valuable passwords unless the connection to the server +is somehow protected. + +=item authinfo_simple ( USER, PASS ) + +Authenticates to the server (using the proposed NNTP V2 AUTHINFO SIMPLE form, +defined and deprecated in RFC2980) using the supplied username and password. +As with L</authinfo> the password is sent in clear text. + +=item list () + +Obtain information about all the active newsgroups. The results is a reference +to a hash where the key is a group name and each value is a reference to an +array. The elements in this array are:- the last article number in the group, +the first article number in the group and any information flags about the group. + +=item newgroups ( SINCE [, DISTRIBUTIONS ]) + +C<SINCE> is a time value and C<DISTRIBUTIONS> is either a distribution +pattern or a reference to a list of distribution patterns. +The result is the same as C<list>, but the +groups return will be limited to those created after C<SINCE> and, if +specified, in one of the distribution areas in C<DISTRIBUTIONS>. + +=item newnews ( SINCE [, GROUPS [, DISTRIBUTIONS ]]) + +C<SINCE> is a time value. C<GROUPS> is either a group pattern or a reference +to a list of group patterns. C<DISTRIBUTIONS> is either a distribution +pattern or a reference to a list of distribution patterns. + +Returns a reference to a list which contains the message-ids of all news posted +after C<SINCE>, that are in a groups which matched C<GROUPS> and a +distribution which matches C<DISTRIBUTIONS>. + +=item next () + +Set the "current article pointer" to the next article in the current +newsgroup. + +Returns the message-id of the article. + +=item post ( [ MESSAGE ] ) + +Post a new article to the news server. If C<MESSAGE> is specified and posting +is allowed then the message will be sent. + +If C<MESSAGE> is not specified then the message must be sent using the +C<datasend> and C<dataend> methods from L<Net::Cmd> + +C<MESSAGE> can be either an array of lines or a reference to an array +and must be encoded by the caller to octets of whatever encoding is required, +e.g. by using the Encode module's C<encode()> function. + +The message, either sent via C<datasend> or as the C<MESSAGE> +parameter, must be in the format as described by RFC822 and must +contain From:, Newsgroups: and Subject: headers. + +=item postfh () + +Post a new article to the news server using a tied filehandle. If +posting is allowed, this method will return a tied filehandle that you +can print() the contents of the article to be posted. You must +explicitly close() the filehandle when you are finished posting the +article, and the return value from the close() call will indicate +whether the message was successfully posted. + +=item slave () + +Tell the remote server that I am not a user client, but probably another +news server. + +=item quit () + +Quit the remote server and close the socket connection. + +=item can_inet6 () + +Returns whether we can use IPv6. + +=item can_ssl () + +Returns whether we can use SSL. + +=back + +=head2 Extension methods + +These methods use commands that are not part of the RFC977 documentation. Some +servers may not support all of them. + +=over 4 + +=item newsgroups ( [ PATTERN ] ) + +Returns a reference to a hash where the keys are all the group names which +match C<PATTERN>, or all of the groups if no pattern is specified, and +each value contains the description text for the group. + +=item distributions () + +Returns a reference to a hash where the keys are all the possible +distribution names and the values are the distribution descriptions. + +=item distribution_patterns () + +Returns a reference to an array where each element, itself an array +reference, consists of the three fields of a line of the distrib.pats list +maintained by some NNTP servers, namely: a weight, a wildmat and a value +which the client may use to construct a Distribution header. + +=item subscriptions () + +Returns a reference to a list which contains a list of groups which +are recommended for a new user to subscribe to. + +=item overview_fmt () + +Returns a reference to an array which contain the names of the fields returned +by C<xover>. + +=item active_times () + +Returns a reference to a hash where the keys are the group names and each +value is a reference to an array containing the time the groups was created +and an identifier, possibly an Email address, of the creator. + +=item active ( [ PATTERN ] ) + +Similar to C<list> but only active groups that match the pattern are returned. +C<PATTERN> can be a group pattern. + +=item xgtitle ( PATTERN ) + +Returns a reference to a hash where the keys are all the group names which +match C<PATTERN> and each value is the description text for the group. + +=item xhdr ( HEADER, MESSAGE-SPEC ) + +Obtain the header field C<HEADER> for all the messages specified. + +The return value will be a reference +to a hash where the keys are the message numbers and each value contains +the text of the requested header for that message. + +=item xover ( MESSAGE-SPEC ) + +The return value will be a reference +to a hash where the keys are the message numbers and each value contains +a reference to an array which contains the overview fields for that +message. + +The names of the fields can be obtained by calling C<overview_fmt>. + +=item xpath ( MESSAGE-ID ) + +Returns the path name to the file on the server which contains the specified +message. + +=item xpat ( HEADER, PATTERN, MESSAGE-SPEC) + +The result is the same as C<xhdr> except the is will be restricted to +headers where the text of the header matches C<PATTERN> + +=item xrover () + +The XROVER command returns reference information for the article(s) +specified. + +Returns a reference to a HASH where the keys are the message numbers and the +values are the References: lines from the articles + +=item listgroup ( [ GROUP ] ) + +Returns a reference to a list of all the active messages in C<GROUP>, or +the current group if C<GROUP> is not specified. + +=item reader () + +Tell the server that you are a reader and not another server. + +This is required by some servers. For example if you are connecting to +an INN server and you have transfer permission your connection will +be connected to the transfer daemon, not the NNTP daemon. Issuing +this command will cause the transfer daemon to hand over control +to the NNTP daemon. + +Some servers do not understand this command, but issuing it and ignoring +the response is harmless. + +=back + +=head1 UNSUPPORTED + +The following NNTP command are unsupported by the package, and there are +no plans to do so. + + AUTHINFO GENERIC + XTHREAD + XSEARCH + XINDEX + +=head1 DEFINITIONS + +=over 4 + +=item MESSAGE-SPEC + +C<MESSAGE-SPEC> is either a single message-id, a single message number, or +a reference to a list of two message numbers. + +If C<MESSAGE-SPEC> is a reference to a list of two message numbers and the +second number in a range is less than or equal to the first then the range +represents all messages in the group after the first message number. + +B<NOTE> For compatibility reasons only with earlier versions of Net::NNTP +a message spec can be passed as a list of two numbers, this is deprecated +and a reference to the list should now be passed + +=item PATTERN + +The C<NNTP> protocol uses the C<WILDMAT> format for patterns. +The WILDMAT format was first developed by Rich Salz based on +the format used in the UNIX "find" command to articulate +file names. It was developed to provide a uniform mechanism +for matching patterns in the same manner that the UNIX shell +matches filenames. + +Patterns are implicitly anchored at the +beginning and end of each string when testing for a match. + +There are five pattern matching operations other than a strict +one-to-one match between the pattern and the source to be +checked for a match. + +The first is an asterisk C<*> to match any sequence of zero or more +characters. + +The second is a question mark C<?> to match any single character. The +third specifies a specific set of characters. + +The set is specified as a list of characters, or as a range of characters +where the beginning and end of the range are separated by a minus (or dash) +character, or as any combination of lists and ranges. The dash can +also be included in the set as a character it if is the beginning +or end of the set. This set is enclosed in square brackets. The +close square bracket C<]> may be used in a set if it is the first +character in the set. + +The fourth operation is the same as the +logical not of the third operation and is specified the same +way as the third with the addition of a caret character C<^> at +the beginning of the test string just inside the open square +bracket. + +The final operation uses the backslash character to +invalidate the special meaning of an open square bracket C<[>, +the asterisk, backslash or the question mark. Two backslashes in +sequence will result in the evaluation of the backslash as a +character with no special meaning. + +=over 4 + +=item Examples + +=item C<[^]-]> + +matches any single character other than a close square +bracket or a minus sign/dash. + +=item C<*bdc> + +matches any string that ends with the string "bdc" +including the string "bdc" (without quotes). + +=item C<[0-9a-zA-Z]> + +matches any single printable alphanumeric ASCII character. + +=item C<a??d> + +matches any four character string which begins +with a and ends with d. + +=back + +=back + +=head1 SEE ALSO + +L<Net::Cmd>, +L<IO::Socket::SSL> + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-1997 Graham Barr. All rights reserved. + +Copyright (C) 2013-2016 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Netrc.pm b/data/miniconda3/lib/perl5/core_perl/Net/Netrc.pm new file mode 100644 index 0000000000000000000000000000000000000000..46fba2787c36ff8c17533d36b346332e9979d8eb --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Netrc.pm @@ -0,0 +1,347 @@ +# Net::Netrc.pm +# +# Copyright (C) 1995-1998 Graham Barr. All rights reserved. +# Copyright (C) 2013-2014 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::Netrc; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use FileHandle; + +our $VERSION = "3.11"; + +our $TESTING; + +my %netrc = (); + +sub _readrc { + my($class, $host) = @_; + my ($home, $file); + + if ($^O eq "MacOS") { + $home = $ENV{HOME} || `pwd`; + chomp($home); + $file = ($home =~ /:$/ ? $home . "netrc" : $home . ":netrc"); + } + else { + + # Some OS's don't have "getpwuid", so we default to $ENV{HOME} + $home = eval { (getpwuid($>))[7] } || $ENV{HOME}; + $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH} || '') if defined $ENV{HOMEDRIVE}; + if (-e $home . "/.netrc") { + $file = $home . "/.netrc"; + } + elsif (-e $home . "/_netrc") { + $file = $home . "/_netrc"; + } + else { + return unless $TESTING; + } + } + + my ($login, $pass, $acct) = (undef, undef, undef); + my $fh; + local $_; + + $netrc{default} = undef; + + # OS/2 and Win32 do not handle stat in a way compatible with this check :-( + unless ($^O eq 'os2' + || $^O eq 'MSWin32' + || $^O eq 'MacOS' + || $^O =~ /^cygwin/) + { + my @stat = stat($file); + + if (@stat) { + if ($stat[2] & 077) { ## no critic (ValuesAndExpressions::ProhibitLeadingZeros) + carp "Bad permissions: $file"; + return; + } + if ($stat[4] != $<) { + carp "Not owner: $file"; + return; + } + } + } + + if ($fh = FileHandle->new($file, "r")) { + my ($mach, $macdef, $tok, @tok) = (0, 0); + + while (<$fh>) { + undef $macdef if /\A\n\Z/; + + if ($macdef) { + push(@$macdef, $_); + next; + } + + s/^\s*//; + chomp; + + while (length && s/^("((?:[^"]+|\\.)*)"|((?:[^\\\s]+|\\.)*))\s*//) { + (my $tok = $+) =~ s/\\(.)/$1/g; + push(@tok, $tok); + } + + TOKEN: + while (@tok) { + if ($tok[0] eq "default") { + shift(@tok); + $mach = bless {}, $class; + $netrc{default} = [$mach]; + + next TOKEN; + } + + last TOKEN + unless @tok > 1; + + $tok = shift(@tok); + + if ($tok eq "machine") { + my $host = shift @tok; + $mach = bless {machine => $host}, $class; + + $netrc{$host} = [] + unless exists($netrc{$host}); + push(@{$netrc{$host}}, $mach); + } + elsif ($tok =~ /^(login|password|account)$/) { + next TOKEN unless $mach; + my $value = shift @tok; + + # Following line added by rmerrell to remove '/' escape char in .netrc + $value =~ s/\/\\/\\/g; + $mach->{$1} = $value; + } + elsif ($tok eq "macdef") { + next TOKEN unless $mach; + my $value = shift @tok; + $mach->{macdef} = {} + unless exists $mach->{macdef}; + $macdef = $mach->{machdef}{$value} = []; + } + } + } + $fh->close(); + } +} + + +sub lookup { + my ($class, $mach, $login) = @_; + + $class->_readrc() + unless exists $netrc{default}; + + $mach ||= 'default'; + undef $login + if $mach eq 'default'; + + if (exists $netrc{$mach}) { + if (defined $login) { + foreach my $m (@{$netrc{$mach}}) { + return $m + if (exists $m->{login} && $m->{login} eq $login); + } + return; + } + return $netrc{$mach}->[0]; + } + + return $netrc{default}->[0] + if defined $netrc{default}; + + return; +} + + +sub login { + my $me = shift; + + exists $me->{login} + ? $me->{login} + : undef; +} + + +sub account { + my $me = shift; + + exists $me->{account} + ? $me->{account} + : undef; +} + + +sub password { + my $me = shift; + + exists $me->{password} + ? $me->{password} + : undef; +} + + +sub lpa { + my $me = shift; + ($me->login, $me->password, $me->account); +} + +1; + +__END__ + +=head1 NAME + +Net::Netrc - OO interface to users netrc file + +=head1 SYNOPSIS + + use Net::Netrc; + + $mach = Net::Netrc->lookup('some.machine'); + $login = $mach->login; + ($login, $password, $account) = $mach->lpa; + +=head1 DESCRIPTION + +C<Net::Netrc> is a class implementing a simple interface to the .netrc file +used as by the ftp program. + +C<Net::Netrc> also implements security checks just like the ftp program, +these checks are, first that the .netrc file must be owned by the user and +second the ownership permissions should be such that only the owner has +read and write access. If these conditions are not met then a warning is +output and the .netrc file is not read. + +=head1 THE .netrc FILE + +The .netrc file contains login and initialization information used by the +auto-login process. It resides in the user's home directory. The following +tokens are recognized; they may be separated by spaces, tabs, or new-lines: + +=over 4 + +=item machine name + +Identify a remote machine name. The auto-login process searches +the .netrc file for a machine token that matches the remote machine +specified. Once a match is made, the subsequent .netrc tokens +are processed, stopping when the end of file is reached or an- +other machine or a default token is encountered. + +=item default + +This is the same as machine name except that default matches +any name. There can be only one default token, and it must be +after all machine tokens. This is normally used as: + + default login anonymous password user@site + +thereby giving the user automatic anonymous login to machines +not specified in .netrc. + +=item login name + +Identify a user on the remote machine. If this token is present, +the auto-login process will initiate a login using the +specified name. + +=item password string + +Supply a password. If this token is present, the auto-login +process will supply the specified string if the remote server +requires a password as part of the login process. + +=item account string + +Supply an additional account password. If this token is present, +the auto-login process will supply the specified string +if the remote server requires an additional account password. + +=item macdef name + +Define a macro. C<Net::Netrc> only parses this field to be compatible +with I<ftp>. + +=back + +=head1 CONSTRUCTOR + +The constructor for a C<Net::Netrc> object is not called new as it does not +really create a new object. But instead is called C<lookup> as this is +essentially what it does. + +=over 4 + +=item lookup ( MACHINE [, LOGIN ]) + +Lookup and return a reference to the entry for C<MACHINE>. If C<LOGIN> is given +then the entry returned will have the given login. If C<LOGIN> is not given then +the first entry in the .netrc file for C<MACHINE> will be returned. + +If a matching entry cannot be found, and a default entry exists, then a +reference to the default entry is returned. + +If there is no matching entry found and there is no default defined, or +no .netrc file is found, then C<undef> is returned. + +=back + +=head1 METHODS + +=over 4 + +=item login () + +Return the login id for the netrc entry + +=item password () + +Return the password for the netrc entry + +=item account () + +Return the account information for the netrc entry + +=item lpa () + +Return a list of login, password and account information for the netrc entry + +=back + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 SEE ALSO + +L<Net::Netrc>, +L<Net::Cmd> + +=head1 COPYRIGHT + +Copyright (C) 1995-1998 Graham Barr. All rights reserved. + +Copyright (C) 2013-2014 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/POP3.pm b/data/miniconda3/lib/perl5/core_perl/Net/POP3.pm new file mode 100644 index 0000000000000000000000000000000000000000..0811025b0a2611a64141468e7f9ed2b4050a728e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/POP3.pm @@ -0,0 +1,863 @@ +# Net::POP3.pm +# +# Copyright (C) 1995-2004 Graham Barr. All rights reserved. +# Copyright (C) 2013-2016 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::POP3; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use IO::Socket; +use Net::Cmd; +use Net::Config; + +our $VERSION = "3.11"; + +# Code for detecting if we can use SSL +my $ssl_class = eval { + require IO::Socket::SSL; + # first version with default CA on most platforms + no warnings 'numeric'; + IO::Socket::SSL->VERSION(2.007); +} && 'IO::Socket::SSL'; + +my $nossl_warn = !$ssl_class && + 'To use SSL please install IO::Socket::SSL with version>=2.007'; + +# Code for detecting if we can use IPv6 +my $family_key = 'Domain'; +my $inet6_class = eval { + require IO::Socket::IP; + no warnings 'numeric'; + IO::Socket::IP->VERSION(0.25) || die; + $family_key = 'Family'; +} && 'IO::Socket::IP' || eval { + require IO::Socket::INET6; + no warnings 'numeric'; + IO::Socket::INET6->VERSION(2.62); +} && 'IO::Socket::INET6'; + + +sub can_ssl { $ssl_class }; +sub can_inet6 { $inet6_class }; + +our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET'); + +sub new { + my $self = shift; + my $type = ref($self) || $self; + my ($host, %arg); + if (@_ % 2) { + $host = shift; + %arg = @_; + } + else { + %arg = @_; + $host = delete $arg{Host}; + } + my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts}; + my $obj; + + if ($arg{SSL}) { + # SSL from start + die $nossl_warn if !$ssl_class; + $arg{Port} ||= 995; + } + + $arg{Timeout} = 120 if ! defined $arg{Timeout}; + + foreach my $h (@{$hosts}) { + $obj = $type->SUPER::new( + PeerAddr => ($host = $h), + PeerPort => $arg{Port} || 'pop3(110)', + Proto => 'tcp', + $family_key => $arg{Domain} || $arg{Family}, + LocalAddr => $arg{LocalAddr}, + LocalPort => exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort}, + Timeout => $arg{Timeout}, + ) + and last; + } + + return + unless defined $obj; + + ${*$obj}{'net_pop3_arg'} = \%arg; + ${*$obj}{'net_pop3_host'} = $host; + if ($arg{SSL}) { + Net::POP3::_SSL->start_SSL($obj,%arg) or return; + } + + $obj->autoflush(1); + $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); + + unless ($obj->response() == CMD_OK) { + $obj->close(); + return; + } + + ${*$obj}{'net_pop3_banner'} = $obj->message; + + $obj; +} + + +sub host { + my $me = shift; + ${*$me}{'net_pop3_host'}; +} + +## +## We don't want people sending me their passwords when they report problems +## now do we :-) +## + + +sub debug_text { $_[2] =~ /^(pass|rpop)/i ? "$1 ....\n" : $_[2]; } + + +sub login { + @_ >= 1 && @_ <= 3 or croak 'usage: $pop3->login( USER, PASS )'; + my ($me, $user, $pass) = @_; + + if (@_ <= 2) { + ($user, $pass) = $me->_lookup_credentials($user); + } + + $me->user($user) + and $me->pass($pass); +} + +sub starttls { + my $self = shift; + $ssl_class or die $nossl_warn; + $self->_STLS or return; + Net::POP3::_SSL->start_SSL($self, + %{ ${*$self}{'net_pop3_arg'} }, # (ssl) args given in new + @_ # more (ssl) args + ) or return; + return 1; +} + +sub apop { + @_ >= 1 && @_ <= 3 or croak 'usage: $pop3->apop( USER, PASS )'; + my ($me, $user, $pass) = @_; + my $banner; + my $md; + + if (eval { local $SIG{__DIE__}; require Digest::MD5 }) { + $md = Digest::MD5->new(); + } + elsif (eval { local $SIG{__DIE__}; require MD5 }) { + $md = MD5->new(); + } + else { + carp "You need to install Digest::MD5 or MD5 to use the APOP command"; + return; + } + + return + unless ($banner = (${*$me}{'net_pop3_banner'} =~ /(<.*>)/)[0]); + + if (@_ <= 2) { + ($user, $pass) = $me->_lookup_credentials($user); + } + + $md->add($banner, $pass); + + return + unless ($me->_APOP($user, $md->hexdigest)); + + $me->_get_mailbox_count(); +} + + +sub user { + @_ == 2 or croak 'usage: $pop3->user( USER )'; + $_[0]->_USER($_[1]) ? 1 : undef; +} + + +sub pass { + @_ == 2 or croak 'usage: $pop3->pass( PASS )'; + + my ($me, $pass) = @_; + + return + unless ($me->_PASS($pass)); + + $me->_get_mailbox_count(); +} + + +sub reset { + @_ == 1 or croak 'usage: $obj->reset()'; + + my $me = shift; + + return 0 + unless ($me->_RSET); + + if (defined ${*$me}{'net_pop3_mail'}) { + local $_; + foreach (@{${*$me}{'net_pop3_mail'}}) { + delete $_->{'net_pop3_deleted'}; + } + } +} + + +sub last { + @_ == 1 or croak 'usage: $obj->last()'; + + return + unless $_[0]->_LAST && $_[0]->message =~ /(\d+)/; + + return $1; +} + + +sub top { + @_ == 2 || @_ == 3 or croak 'usage: $pop3->top( MSGNUM [, NUMLINES ])'; + my $me = shift; + + return + unless $me->_TOP($_[0], $_[1] || 0); + + $me->read_until_dot; +} + + +sub popstat { + @_ == 1 or croak 'usage: $pop3->popstat()'; + my $me = shift; + + return () + unless $me->_STAT && $me->message =~ /(\d+)\D+(\d+)/; + + ($1 || 0, $2 || 0); +} + + +sub list { + @_ == 1 || @_ == 2 or croak 'usage: $pop3->list( [ MSGNUM ] )'; + my $me = shift; + + return + unless $me->_LIST(@_); + + if (@_) { + $me->message =~ /\d+\D+(\d+)/; + return $1 || undef; + } + + my $info = $me->read_until_dot + or return; + + my %hash = map { (/(\d+)\D+(\d+)/) } @$info; + + return \%hash; +} + + +sub get { + @_ == 2 or @_ == 3 or croak 'usage: $pop3->get( MSGNUM [, FH ])'; + my $me = shift; + + return + unless $me->_RETR(shift); + + $me->read_until_dot(@_); +} + + +sub getfh { + @_ == 2 or croak 'usage: $pop3->getfh( MSGNUM )'; + my $me = shift; + + return unless $me->_RETR(shift); + return $me->tied_fh; +} + + +sub delete { + @_ == 2 or croak 'usage: $pop3->delete( MSGNUM )'; + my $me = shift; + return 0 unless $me->_DELE(@_); + ${*$me}{'net_pop3_deleted'} = 1; +} + + +sub uidl { + @_ == 1 || @_ == 2 or croak 'usage: $pop3->uidl( [ MSGNUM ] )'; + my $me = shift; + my $uidl; + + $me->_UIDL(@_) + or return; + if (@_) { + $uidl = ($me->message =~ /\d+\s+([\041-\176]+)/)[0]; + } + else { + my $ref = $me->read_until_dot + or return; + $uidl = {}; + foreach my $ln (@$ref) { + my ($msg, $uid) = $ln =~ /^\s*(\d+)\s+([\041-\176]+)/; + $uidl->{$msg} = $uid; + } + } + return $uidl; +} + + +sub ping { + @_ == 2 or croak 'usage: $pop3->ping( USER )'; + my $me = shift; + + return () unless $me->_PING(@_) && $me->message =~ /(\d+)\D+(\d+)/; + + ($1 || 0, $2 || 0); +} + + +sub _lookup_credentials { + my ($me, $user) = @_; + + require Net::Netrc; + + $user ||= eval { local $SIG{__DIE__}; (getpwuid($>))[0] } + || $ENV{NAME} + || $ENV{USER} + || $ENV{LOGNAME}; + + my $m = Net::Netrc->lookup(${*$me}{'net_pop3_host'}, $user); + $m ||= Net::Netrc->lookup(${*$me}{'net_pop3_host'}); + + my $pass = $m + ? $m->password || "" + : ""; + + ($user, $pass); +} + + +sub _get_mailbox_count { + my ($me) = @_; + my $ret = ${*$me}{'net_pop3_count'} = + ($me->message =~ /(\d+)\s+message/io) ? $1 : ($me->popstat)[0]; + + $ret ? $ret : "0E0"; +} + + +sub _STAT { shift->command('STAT' )->response() == CMD_OK } +sub _LIST { shift->command('LIST', @_)->response() == CMD_OK } +sub _RETR { shift->command('RETR', $_[0])->response() == CMD_OK } +sub _DELE { shift->command('DELE', $_[0])->response() == CMD_OK } +sub _NOOP { shift->command('NOOP' )->response() == CMD_OK } +sub _RSET { shift->command('RSET' )->response() == CMD_OK } +sub _QUIT { shift->command('QUIT' )->response() == CMD_OK } +sub _TOP { shift->command( 'TOP', @_)->response() == CMD_OK } +sub _UIDL { shift->command('UIDL', @_)->response() == CMD_OK } +sub _USER { shift->command('USER', $_[0])->response() == CMD_OK } +sub _PASS { shift->command('PASS', $_[0])->response() == CMD_OK } +sub _APOP { shift->command('APOP', @_)->response() == CMD_OK } +sub _PING { shift->command('PING', $_[0])->response() == CMD_OK } +sub _RPOP { shift->command('RPOP', $_[0])->response() == CMD_OK } +sub _LAST { shift->command('LAST' )->response() == CMD_OK } +sub _CAPA { shift->command('CAPA' )->response() == CMD_OK } +sub _STLS { shift->command("STLS", )->response() == CMD_OK } + + +sub quit { + my $me = shift; + + $me->_QUIT; + $me->close; +} + + +sub DESTROY { + my $me = shift; + + if (defined fileno($me) and ${*$me}{'net_pop3_deleted'}) { + $me->reset; + $me->quit; + } +} + +## +## POP3 has weird responses, so we emulate them to look the same :-) +## + + +sub response { + my $cmd = shift; + my $str = $cmd->getline() or return; + my $code = "500"; + + $cmd->debug_print(0, $str) + if ($cmd->debug); + + if ($str =~ s/^\+OK\s*//io) { + $code = "200"; + } + elsif ($str =~ s/^\+\s*//io) { + $code = "300"; + } + else { + $str =~ s/^-ERR\s*//io; + } + + ${*$cmd}{'net_cmd_resp'} = [$str]; + ${*$cmd}{'net_cmd_code'} = $code; + + substr($code, 0, 1); +} + + +sub capa { + my $this = shift; + my ($capa, %capabilities); + + # Fake a capability here + $capabilities{APOP} = '' if ($this->banner() =~ /<.*>/); + + if ($this->_CAPA()) { + $capabilities{CAPA} = 1; + $capa = $this->read_until_dot(); + %capabilities = (%capabilities, map {/^\s*(\S+)\s*(.*)/} @$capa); + } + else { + + # Check AUTH for SASL capabilities + if ($this->command('AUTH')->response() == CMD_OK) { + my $mechanism = $this->read_until_dot(); + $capabilities{SASL} = join " ", map {m/([A-Z0-9_-]+)/} @{$mechanism}; + } + } + + return ${*$this}{'net_pop3e_capabilities'} = \%capabilities; +} + + +sub capabilities { + my $this = shift; + + ${*$this}{'net_pop3e_capabilities'} || $this->capa; +} + + +sub auth { + my ($self, $username, $password) = @_; + + eval { + require MIME::Base64; + require Authen::SASL; + } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0; + + my $capa = $self->capa; + my $mechanisms = $capa->{SASL} || 'CRAM-MD5'; + + my $sasl; + + if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) { + $sasl = $username; + my $user_mech = $sasl->mechanism || ''; + my @user_mech = split(/\s+/, $user_mech); + my %user_mech; + @user_mech{@user_mech} = (); + + my @server_mech = split(/\s+/, $mechanisms); + my @mech = @user_mech + ? grep { exists $user_mech{$_} } @server_mech + : @server_mech; + unless (@mech) { + $self->set_status( + 500, + [ 'Client SASL mechanisms (', + join(', ', @user_mech), + ') do not match the SASL mechnism the server announces (', + join(', ', @server_mech), ')', + ] + ); + return 0; + } + + $sasl->mechanism(join(" ", @mech)); + } + else { + die "auth(username, password)" if not length $username; + $sasl = Authen::SASL->new( + mechanism => $mechanisms, + callback => { + user => $username, + pass => $password, + authname => $username, + } + ); + } + + # We should probably allow the user to pass the host, but I don't + # currently know and SASL mechanisms that are used by smtp that need it + my ($hostname) = split /:/, ${*$self}{'net_pop3_host'}; + my $client = eval { $sasl->client_new('pop', $hostname, 0) }; + + unless ($client) { + my $mech = $sasl->mechanism; + $self->set_status( + 500, + [ " Authen::SASL failure: $@", + '(please check if your local Authen::SASL installation', + "supports mechanism '$mech'" + ] + ); + return 0; + } + + my ($token) = $client->client_start + or do { + my $mech = $client->mechanism; + $self->set_status( + 500, + [ ' Authen::SASL failure: $client->client_start ', + "mechanism '$mech' hostname #$hostname#", + $client->error + ] + ); + return 0; + }; + + # We don't support sasl mechanisms that encrypt the socket traffic. + # todo that we would really need to change the ISA hierarchy + # so we don't inherit from IO::Socket, but instead hold it in an attribute + + my @cmd = ("AUTH", $client->mechanism); + my $code; + + push @cmd, MIME::Base64::encode_base64($token, '') + if defined $token and length $token; + + while (($code = $self->command(@cmd)->response()) == CMD_MORE) { + + my ($token) = $client->client_step(MIME::Base64::decode_base64(($self->message)[0])) or do { + $self->set_status( + 500, + [ ' Authen::SASL failure: $client->client_step ', + "mechanism '", $client->mechanism, " hostname #$hostname#, ", + $client->error + ] + ); + return 0; + }; + + @cmd = (MIME::Base64::encode_base64(defined $token ? $token : '', '')); + } + + $code == CMD_OK; +} + + +sub banner { + my $this = shift; + + return ${*$this}{'net_pop3_banner'}; +} + +{ + package Net::POP3::_SSL; + our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::POP3' ); + sub starttls { die "POP3 connection is already in SSL mode" } + sub start_SSL { + my ($class,$pop3,%arg) = @_; + delete @arg{ grep { !m{^SSL_} } keys %arg }; + ( $arg{SSL_verifycn_name} ||= $pop3->host ) + =~s{(?<!:):[\w()]+$}{}; # strip port + $arg{SSL_hostname} = $arg{SSL_verifycn_name} + if ! defined $arg{SSL_hostname} && $class->can_client_sni; + $arg{SSL_verifycn_scheme} ||= 'pop3'; + my $ok = $class->SUPER::start_SSL($pop3,%arg); + $@ = $ssl_class->errstr if !$ok; + return $ok; + } +} + + + +1; + +__END__ + +=head1 NAME + +Net::POP3 - Post Office Protocol 3 Client class (RFC1939) + +=head1 SYNOPSIS + + use Net::POP3; + + # Constructors + $pop = Net::POP3->new('pop3host'); + $pop = Net::POP3->new('pop3host', Timeout => 60); + $pop = Net::POP3->new('pop3host', SSL => 1, Timeout => 60); + + if ($pop->login($username, $password) > 0) { + my $msgnums = $pop->list; # hashref of msgnum => size + foreach my $msgnum (keys %$msgnums) { + my $msg = $pop->get($msgnum); + print @$msg; + $pop->delete($msgnum); + } + } + + $pop->quit; + +=head1 DESCRIPTION + +This module implements a client interface to the POP3 protocol, enabling +a perl5 application to talk to POP3 servers. This documentation assumes +that you are familiar with the POP3 protocol described in RFC1939. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. POP3S or POP3+STARTTLS. + +A new Net::POP3 object must be created with the I<new> method. Once +this has been done, all POP3 commands are accessed via method calls +on the object. + +The Net::POP3 class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + + +=head1 CONSTRUCTOR + +=over 4 + +=item new ( [ HOST ] [, OPTIONS ] ) + +This is the constructor for a new Net::POP3 object. C<HOST> is the +name of the remote host to which an POP3 connection is required. + +C<HOST> is optional. If C<HOST> is not given then it may instead be +passed as the C<Host> option described below. If neither is given then +the C<POP3_Hosts> specified in C<Net::Config> will be used. + +C<OPTIONS> are passed in a hash like fashion, using key and value pairs. +Possible options are: + +B<Host> - POP3 host to connect to. It may be a single scalar, as defined for +the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +an array with hosts to try in turn. The L</host> method will return the value +which was used to connect to the host. + +B<Port> - port to connect to. +Default - 110 for plain POP3 and 995 for POP3s (direct SSL). + +B<SSL> - If the connection should be done from start with SSL, contrary to later +upgrade with C<starttls>. +You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will +usually use the right arguments already. + +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a specific local address and port. +For compatibility with older versions B<ResvPort> can be used instead of +B<LocalPort>. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. + +B<Timeout> - Maximum time, in seconds, to wait for a response from the +POP3 server (default: 120) + +B<Debug> - Enable debugging information + +=back + +=head1 METHODS + +Unless otherwise stated all methods return either a I<true> or I<false> +value, with I<true> meaning that the operation was a success. When a method +states that it returns a value, failure will be returned as I<undef> or an +empty list. + +C<Net::POP3> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote POP3 server in addition to the methods +documented here. + +=over 4 + +=item host () + +Returns the value used by the constructor, and passed to IO::Socket::INET, +to connect to the host. + +=item auth ( USERNAME, PASSWORD ) + +Attempt SASL authentication. + +=item user ( USER ) + +Send the USER command. + +=item pass ( PASS ) + +Send the PASS command. Returns the number of messages in the mailbox. + +=item login ( [ USER [, PASS ]] ) + +Send both the USER and PASS commands. If C<PASS> is not given the +C<Net::POP3> uses C<Net::Netrc> to lookup the password using the host +and username. If the username is not specified then the current user name +will be used. + +Returns the number of messages in the mailbox. However if there are no +messages on the server the string C<"0E0"> will be returned. This is +will give a true value in a boolean context, but zero in a numeric context. + +If there was an error authenticating the user then I<undef> will be returned. + +=item starttls ( SSLARGS ) + +Upgrade existing plain connection to SSL. +You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will +usually use the right arguments already. + +=item apop ( [ USER [, PASS ]] ) + +Authenticate with the server identifying as C<USER> with password C<PASS>. +Similar to L</login>, but the password is not sent in clear text. + +To use this method you must have the Digest::MD5 or the MD5 module installed, +otherwise this method will return I<undef>. + +=item banner () + +Return the sever's connection banner + +=item capa () + +Return a reference to a hash of the capabilities of the server. APOP +is added as a pseudo capability. Note that I've been unable to +find a list of the standard capability values, and some appear to +be multi-word and some are not. We make an attempt at intelligently +parsing them, but it may not be correct. + +=item capabilities () + +Just like capa, but only uses a cache from the last time we asked +the server, so as to avoid asking more than once. + +=item top ( MSGNUM [, NUMLINES ] ) + +Get the header and the first C<NUMLINES> of the body for the message +C<MSGNUM>. Returns a reference to an array which contains the lines of text +read from the server. + +=item list ( [ MSGNUM ] ) + +If called with an argument the C<list> returns the size of the message +in octets. + +If called without arguments a reference to a hash is returned. The +keys will be the C<MSGNUM>'s of all undeleted messages and the values will +be their size in octets. + +=item get ( MSGNUM [, FH ] ) + +Get the message C<MSGNUM> from the remote mailbox. If C<FH> is not given +then get returns a reference to an array which contains the lines of +text read from the server. If C<FH> is given then the lines returned +from the server are printed to the filehandle C<FH>. + +=item getfh ( MSGNUM ) + +As per get(), but returns a tied filehandle. Reading from this +filehandle returns the requested message. The filehandle will return +EOF at the end of the message and should not be reused. + +=item last () + +Returns the highest C<MSGNUM> of all the messages accessed. + +=item popstat () + +Returns a list of two elements. These are the number of undeleted +elements and the size of the mbox in octets. + +=item ping ( USER ) + +Returns a list of two elements. These are the number of new messages +and the total number of messages for C<USER>. + +=item uidl ( [ MSGNUM ] ) + +Returns a unique identifier for C<MSGNUM> if given. If C<MSGNUM> is not +given C<uidl> returns a reference to a hash where the keys are the +message numbers and the values are the unique identifiers. + +=item delete ( MSGNUM ) + +Mark message C<MSGNUM> to be deleted from the remote mailbox. All messages +that are marked to be deleted will be removed from the remote mailbox +when the server connection closed. + +=item reset () + +Reset the status of the remote POP3 server. This includes resetting the +status of all messages to not be deleted. + +=item quit () + +Quit and close the connection to the remote POP3 server. Any messages marked +as deleted will be deleted from the remote mailbox. + +=item can_inet6 () + +Returns whether we can use IPv6. + +=item can_ssl () + +Returns whether we can use SSL. + +=back + +=head1 NOTES + +If a C<Net::POP3> object goes out of scope before C<quit> method is called +then the C<reset> method will called before the connection is closed. This +means that any messages marked to be deleted will not be. + +=head1 SEE ALSO + +L<Net::Netrc>, +L<Net::Cmd>, +L<IO::Socket::SSL> + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-2004 Graham Barr. All rights reserved. + +Copyright (C) 2013-2016 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Ping.pm b/data/miniconda3/lib/perl5/core_perl/Net/Ping.pm new file mode 100644 index 0000000000000000000000000000000000000000..932fde5136322ae31444c86bd15437be79f374f2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Ping.pm @@ -0,0 +1,2579 @@ +package Net::Ping; + +require 5.002; +require Exporter; + +use strict; +our $hires; +use Fcntl qw( F_GETFL F_SETFL O_NONBLOCK ); +use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW AF_INET PF_INET IPPROTO_TCP + SOL_SOCKET SO_ERROR SO_BROADCAST + IPPROTO_IP IP_TOS IP_TTL + inet_ntoa inet_aton getnameinfo sockaddr_in ); +use POSIX qw( ENOTCONN ECONNREFUSED ECONNRESET EINPROGRESS EWOULDBLOCK EAGAIN + WNOHANG ); +use FileHandle; +use Carp; +use Time::HiRes; + +our @ISA = qw(Exporter); +our @EXPORT = qw(pingecho); +our @EXPORT_OK = qw(wakeonlan); +our $VERSION = "2.72"; + +# Globals + +our $def_timeout = 5; # Default timeout to wait for a reply +our $def_proto = "tcp"; # Default protocol to use for pinging +our $def_factor = 1.2; # Default exponential backoff rate. +our $def_family = AF_INET; # Default family. +our $max_datasize = 65535; # Maximum data bytes. recommended: 1472 (Ethernet MTU: 1500) +# The data we exchange with the server for the stream protocol +our $pingstring = "pingschwingping!\n"; +our $source_verify = 1; # Default is to verify source endpoint +our $syn_forking = 0; + +# Constants + +my $AF_INET6 = eval { Socket::AF_INET6() } || 30; +my $AF_UNSPEC = eval { Socket::AF_UNSPEC() }; +my $AI_NUMERICHOST = eval { Socket::AI_NUMERICHOST() } || 4; +my $NI_NUMERICHOST = eval { Socket::NI_NUMERICHOST() } || 2; +my $IPPROTO_IPV6 = eval { Socket::IPPROTO_IPV6() } || 41; +my $NIx_NOSERV = eval { Socket::NIx_NOSERV() } || 2; +#my $IPV6_HOPLIMIT = eval { Socket::IPV6_HOPLIMIT() }; # ping6 -h 0-255 +my $qr_family = qr/^(?:(?:(:?ip)?v?(?:4|6))|${\AF_INET}|$AF_INET6)$/; +my $qr_family4 = qr/^(?:(?:(:?ip)?v?4)|${\AF_INET})$/; +my $Socket_VERSION = eval { $Socket::VERSION }; + +if ($^O =~ /Win32/i) { + # Hack to avoid this Win32 spewage: + # Your vendor has not defined POSIX macro ECONNREFUSED + my @pairs = (ECONNREFUSED => 10061, # "Unknown Error" Special Win32 Response? + ENOTCONN => 10057, + ECONNRESET => 10054, + EINPROGRESS => 10036, + EWOULDBLOCK => 10035, + ); + while (my $name = shift @pairs) { + my $value = shift @pairs; + # When defined, these all are non-zero + unless (eval $name) { + no strict 'refs'; + *{$name} = defined prototype \&{$name} ? sub () {$value} : sub {$value}; + } + } +# $syn_forking = 1; # XXX possibly useful in < Win2K ? +}; + +# Description: The pingecho() subroutine is provided for backward +# compatibility with the original Net::Ping. It accepts a host +# name/IP and an optional timeout in seconds. Create a tcp ping +# object and try pinging the host. The result of the ping is returned. + +sub pingecho +{ + my ($host, # Name or IP number of host to ping + $timeout # Optional timeout in seconds + ) = @_; + my ($p); # A ping object + + $p = Net::Ping->new("tcp", $timeout); + $p->ping($host); # Going out of scope closes the connection +} + +# Description: The new() method creates a new ping object. Optional +# parameters may be specified for the protocol to use, the timeout in +# seconds and the size in bytes of additional data which should be +# included in the packet. +# After the optional parameters are checked, the data is constructed +# and a socket is opened if appropriate. The object is returned. + +sub new +{ + my ($this, + $proto, # Optional protocol to use for pinging + $timeout, # Optional timeout in seconds + $data_size, # Optional additional bytes of data + $device, # Optional device to use + $tos, # Optional ToS to set + $ttl, # Optional TTL to set + $family, # Optional address family (AF_INET) + ) = @_; + my $class = ref($this) || $this; + my $self = {}; + my ($cnt, # Count through data bytes + $min_datasize # Minimum data bytes required + ); + + bless($self, $class); + if (ref $proto eq 'HASH') { # support named args + for my $k (qw(proto timeout data_size device tos ttl family + gateway host port bind retrans pingstring source_verify + econnrefused dontfrag + IPV6_USE_MIN_MTU IPV6_RECVPATHMTU IPV6_HOPLIMIT)) + { + if (exists $proto->{$k}) { + $self->{$k} = $proto->{$k}; + # some are still globals + if ($k eq 'pingstring') { $pingstring = $proto->{$k} } + if ($k eq 'source_verify') { $source_verify = $proto->{$k} } + delete $proto->{$k}; + } + } + if (%$proto) { + croak("Invalid named argument: ",join(" ",keys (%$proto))); + } + $proto = $self->{'proto'}; + } + + $proto = $def_proto unless $proto; # Determine the protocol + croak('Protocol for ping must be "icmp", "icmpv6", "udp", "tcp", "syn", "stream" or "external"') + unless $proto =~ m/^(icmp|icmpv6|udp|tcp|syn|stream|external)$/; + $self->{proto} = $proto; + + $timeout = $def_timeout unless defined $timeout; # Determine the timeout + croak("Default timeout for ping must be greater than 0 seconds") + if $timeout <= 0; + $self->{timeout} = $timeout; + + $self->{device} = $device; + + $self->{tos} = $tos; + + if ($self->{'host'}) { + my $host = $self->{'host'}; + my $ip = _resolv($host) or + carp("could not resolve host $host"); + $self->{host} = $ip; + $self->{family} = $ip->{family}; + } + + if ($self->{bind}) { + my $addr = $self->{bind}; + my $ip = _resolv($addr) + or carp("could not resolve local addr $addr"); + $self->{local_addr} = $ip; + } else { + $self->{local_addr} = undef; # Don't bind by default + } + + if ($self->{proto} eq 'icmp') { + croak('TTL must be from 0 to 255') + if ($ttl && ($ttl < 0 || $ttl > 255)); + $self->{ttl} = $ttl; + } + + if ($family) { + if ($family =~ $qr_family) { + if ($family =~ $qr_family4) { + $self->{family} = AF_INET; + } else { + $self->{family} = $AF_INET6; + } + } else { + croak('Family must be "ipv4" or "ipv6"') + } + } else { + if ($self->{proto} eq 'icmpv6') { + $self->{family} = $AF_INET6; + } else { + $self->{family} = $def_family; + } + } + + $min_datasize = ($proto eq "udp") ? 1 : 0; # Determine data size + $data_size = $min_datasize unless defined($data_size) && $proto ne "tcp"; + # allow for fragmented packets if data_size>1472 (MTU 1500) + croak("Data for ping must be from $min_datasize to $max_datasize bytes") + if ($data_size < $min_datasize) || ($data_size > $max_datasize); + $data_size-- if $self->{proto} eq "udp"; # We provide the first byte + $self->{data_size} = $data_size; + + $self->{data} = ""; # Construct data bytes + for ($cnt = 0; $cnt < $self->{data_size}; $cnt++) + { + $self->{data} .= chr($cnt % 256); + } + + # Default exponential backoff rate + $self->{retrans} = $def_factor unless exists $self->{retrans}; + # Default Connection refused behavior + $self->{econnrefused} = undef unless exists $self->{econnrefused}; + + $self->{seq} = 0; # For counting packets + if ($self->{proto} eq "udp") # Open a socket + { + $self->{proto_num} = eval { (getprotobyname('udp'))[2] } || + croak("Can't udp protocol by name"); + $self->{port_num} = $self->{port} + || (getservbyname('echo', 'udp'))[2] + || croak("Can't get udp echo port by name"); + $self->{fh} = FileHandle->new(); + socket($self->{fh}, PF_INET, SOCK_DGRAM, + $self->{proto_num}) || + croak("udp socket error - $!"); + $self->_setopts(); + } + elsif ($self->{proto} eq "icmp") + { + croak("icmp ping requires root privilege") if !_isroot(); + $self->{proto_num} = eval { (getprotobyname('icmp'))[2] } || + croak("Can't get icmp protocol by name"); + $self->{pid} = $$ & 0xffff; # Save lower 16 bits of pid + $self->{fh} = FileHandle->new(); + socket($self->{fh}, PF_INET, SOCK_RAW, $self->{proto_num}) || + croak("icmp socket error - $!"); + $self->_setopts(); + if ($self->{'ttl'}) { + setsockopt($self->{fh}, IPPROTO_IP, IP_TTL, pack("I*", $self->{'ttl'})) + or croak "error configuring ttl to $self->{'ttl'} $!"; + } + } + elsif ($self->{proto} eq "icmpv6") + { + #croak("icmpv6 ping requires root privilege") if !_isroot(); + croak("Wrong family $self->{family} for icmpv6 protocol") + if $self->{family} and $self->{family} != $AF_INET6; + $self->{family} = $AF_INET6; + $self->{proto_num} = eval { (getprotobyname('ipv6-icmp'))[2] } || + croak("Can't get ipv6-icmp protocol by name"); # 58 + $self->{pid} = $$ & 0xffff; # Save lower 16 bits of pid + $self->{fh} = FileHandle->new(); + socket($self->{fh}, $AF_INET6, SOCK_RAW, $self->{proto_num}) || + croak("icmp socket error - $!"); + $self->_setopts(); + if ($self->{'gateway'}) { + my $g = $self->{gateway}; + my $ip = _resolv($g) + or croak("nonexistent gateway $g"); + $self->{family} eq $AF_INET6 + or croak("gateway requires the AF_INET6 family"); + $ip->{family} eq $AF_INET6 + or croak("gateway address needs to be IPv6"); + my $IPV6_NEXTHOP = eval { Socket::IPV6_NEXTHOP() } || 48; # IPV6_3542NEXTHOP, or 21 + setsockopt($self->{fh}, $IPPROTO_IPV6, $IPV6_NEXTHOP, _pack_sockaddr_in($ip)) + or croak "error configuring gateway to $g NEXTHOP $!"; + } + if (exists $self->{IPV6_USE_MIN_MTU}) { + my $IPV6_USE_MIN_MTU = eval { Socket::IPV6_USE_MIN_MTU() } || 42; + setsockopt($self->{fh}, $IPPROTO_IPV6, $IPV6_USE_MIN_MTU, + pack("I*", $self->{'IPV6_USE_MIN_MT'})) + or croak "error configuring IPV6_USE_MIN_MT} $!"; + } + if (exists $self->{IPV6_RECVPATHMTU}) { + my $IPV6_RECVPATHMTU = eval { Socket::IPV6_RECVPATHMTU() } || 43; + setsockopt($self->{fh}, $IPPROTO_IPV6, $IPV6_RECVPATHMTU, + pack("I*", $self->{'RECVPATHMTU'})) + or croak "error configuring IPV6_RECVPATHMTU $!"; + } + if ($self->{'tos'}) { + my $proto = $self->{family} == AF_INET ? IPPROTO_IP : $IPPROTO_IPV6; + setsockopt($self->{fh}, $proto, IP_TOS, pack("I*", $self->{'tos'})) + or croak "error configuring tos to $self->{'tos'} $!"; + } + if ($self->{'ttl'}) { + my $proto = $self->{family} == AF_INET ? IPPROTO_IP : $IPPROTO_IPV6; + setsockopt($self->{fh}, $proto, IP_TTL, pack("I*", $self->{'ttl'})) + or croak "error configuring ttl to $self->{'ttl'} $!"; + } + } + elsif ($self->{proto} eq "tcp" || $self->{proto} eq "stream") + { + $self->{proto_num} = eval { (getprotobyname('tcp'))[2] } || + croak("Can't get tcp protocol by name"); + $self->{port_num} = $self->{port} + || (getservbyname('echo', 'tcp'))[2] + || croak("Can't get tcp echo port by name"); + $self->{fh} = FileHandle->new(); + } + elsif ($self->{proto} eq "syn") + { + $self->{proto_num} = eval { (getprotobyname('tcp'))[2] } || + croak("Can't get tcp protocol by name"); + $self->{port_num} = (getservbyname('echo', 'tcp'))[2] || + croak("Can't get tcp echo port by name"); + if ($syn_forking) { + $self->{fork_rd} = FileHandle->new(); + $self->{fork_wr} = FileHandle->new(); + pipe($self->{fork_rd}, $self->{fork_wr}); + $self->{fh} = FileHandle->new(); + $self->{good} = {}; + $self->{bad} = {}; + } else { + $self->{wbits} = ""; + $self->{bad} = {}; + } + $self->{syn} = {}; + $self->{stop_time} = 0; + } + + return($self); +} + +# Description: Set the local IP address from which pings will be sent. +# For ICMP, UDP and TCP pings, just saves the address to be used when +# the socket is opened. Returns non-zero if successful; croaks on error. +sub bind +{ + my ($self, + $local_addr # Name or IP number of local interface + ) = @_; + my ($ip, # Hash of addr (string), addr_in (packed), family + $h # resolved hash + ); + + croak("Usage: \$p->bind(\$local_addr)") unless @_ == 2; + croak("already bound") if defined($self->{local_addr}) && + ($self->{proto} eq "udp" || $self->{proto} eq "icmp"); + + $ip = $self->_resolv($local_addr); + carp("nonexistent local address $local_addr") unless defined($ip); + $self->{local_addr} = $ip; + + if (($self->{proto} ne "udp") && + ($self->{proto} ne "icmp") && + ($self->{proto} ne "tcp") && + ($self->{proto} ne "syn")) + { + croak("Unknown protocol \"$self->{proto}\" in bind()"); + } + + return 1; +} + +# Description: A select() wrapper that compensates for platform +# peculiarities. +sub mselect +{ + if ($_[3] > 0 and $^O eq 'MSWin32') { + # On windows, select() doesn't process the message loop, + # but sleep() will, allowing alarm() to interrupt the latter. + # So we chop up the timeout into smaller pieces and interleave + # select() and sleep() calls. + my $t = $_[3]; + my $gran = 0.5; # polling granularity in seconds + my @args = @_; + while (1) { + $gran = $t if $gran > $t; + my $nfound = select($_[0], $_[1], $_[2], $gran); + undef $nfound if $nfound == -1; + $t -= $gran; + return $nfound if $nfound or !defined($nfound) or $t <= 0; + + sleep(0); + ($_[0], $_[1], $_[2]) = @args; + } + } + else { + my $nfound = select($_[0], $_[1], $_[2], $_[3]); + undef $nfound if $nfound == -1; + return $nfound; + } +} + +# Description: Allow UDP source endpoint comparison to be +# skipped for those remote interfaces that do +# not response from the same endpoint. + +sub source_verify +{ + my $self = shift; + $source_verify = 1 unless defined + ($source_verify = ((defined $self) && (ref $self)) ? shift() : $self); +} + +# Description: Set whether or not the connect +# behavior should enforce remote service +# availability as well as reachability. + +sub service_check +{ + my $self = shift; + $self->{econnrefused} = 1 unless defined + ($self->{econnrefused} = shift()); +} + +sub tcp_service_check +{ + service_check(@_); +} + +# Description: Set exponential backoff for retransmission. +# Should be > 1 to retain exponential properties. +# If set to 0, retransmissions are disabled. + +sub retrans +{ + my $self = shift; + $self->{retrans} = shift; +} + +sub _IsAdminUser { + return unless $^O eq 'MSWin32' or $^O eq "cygwin"; + return unless eval { require Win32 }; + return unless defined &Win32::IsAdminUser; + return Win32::IsAdminUser(); +} + +sub _isroot { + if (($> and $^O ne 'VMS' and $^O ne 'cygwin') + or (($^O eq 'MSWin32' or $^O eq 'cygwin') + and !_IsAdminUser()) + or ($^O eq 'VMS' + and (`write sys\$output f\$privilege("SYSPRV")` =~ m/FALSE/))) { + return 0; + } + else { + return 1; + } +} + +# Description: Sets ipv6 reachability +# REACHCONF was removed in RFC3542, ping6 -R supports it. requires root. + +sub IPV6_REACHCONF +{ + my $self = shift; + my $on = shift; + if ($on) { + my $reachconf = eval { Socket::IPV6_REACHCONF() }; + if (!$reachconf) { + carp "IPV6_REACHCONF not supported on this platform"; + return 0; + } + if (!_isroot()) { + carp "IPV6_REACHCONF requires root permissions"; + return 0; + } + $self->{IPV6_REACHCONF} = 1; + } + else { + return $self->{IPV6_REACHCONF}; + } +} + +# Description: set it on or off. + +sub IPV6_USE_MIN_MTU +{ + my $self = shift; + my $on = shift; + if (defined $on) { + my $IPV6_USE_MIN_MTU = eval { Socket::IPV6_USE_MIN_MTU() } || 43; + #if (!$IPV6_USE_MIN_MTU) { + # carp "IPV6_USE_MIN_MTU not supported on this platform"; + # return 0; + #} + $self->{IPV6_USE_MIN_MTU} = $on ? 1 : 0; + setsockopt($self->{fh}, $IPPROTO_IPV6, $IPV6_USE_MIN_MTU, + pack("I*", $self->{'IPV6_USE_MIN_MT'})) + or croak "error configuring IPV6_USE_MIN_MT} $!"; + } + else { + return $self->{IPV6_USE_MIN_MTU}; + } +} + +# Description: notify an according MTU + +sub IPV6_RECVPATHMTU +{ + my $self = shift; + my $on = shift; + if ($on) { + my $IPV6_RECVPATHMTU = eval { Socket::IPV6_RECVPATHMTU() } || 43; + #if (!$RECVPATHMTU) { + # carp "IPV6_RECVPATHMTU not supported on this platform"; + # return 0; + #} + $self->{IPV6_RECVPATHMTU} = 1; + setsockopt($self->{fh}, $IPPROTO_IPV6, $IPV6_RECVPATHMTU, + pack("I*", $self->{'IPV6_RECVPATHMTU'})) + or croak "error configuring IPV6_RECVPATHMTU} $!"; + } + else { + return $self->{IPV6_RECVPATHMTU}; + } +} + +# Description: allows the module to use milliseconds as returned by +# the Time::HiRes module + +$hires = 1; +sub hires +{ + my $self = shift; + $hires = 1 unless defined + ($hires = ((defined $self) && (ref $self)) ? shift() : $self); +} + +sub time +{ + return $hires ? Time::HiRes::time() : CORE::time(); +} + +# Description: Sets or clears the O_NONBLOCK flag on a file handle. +sub socket_blocking_mode +{ + my ($self, + $fh, # the file handle whose flags are to be modified + $block) = @_; # if true then set the blocking + # mode (clear O_NONBLOCK), otherwise + # set the non-blocking mode (set O_NONBLOCK) + + my $flags; + if ($^O eq 'MSWin32' || $^O eq 'VMS') { + # FIONBIO enables non-blocking sockets on windows and vms. + # FIONBIO is (0x80000000|(4<<16)|(ord('f')<<8)|126), as per winsock.h, ioctl.h + my $f = 0x8004667e; + my $v = pack("L", $block ? 0 : 1); + ioctl($fh, $f, $v) or croak("ioctl failed: $!"); + return; + } + if ($flags = fcntl($fh, F_GETFL, 0)) { + $flags = $block ? ($flags & ~O_NONBLOCK) : ($flags | O_NONBLOCK); + if (!fcntl($fh, F_SETFL, $flags)) { + croak("fcntl F_SETFL: $!"); + } + } else { + croak("fcntl F_GETFL: $!"); + } +} + +# Description: Ping a host name or IP number with an optional timeout. +# First lookup the host, and return undef if it is not found. Otherwise +# perform the specific ping method based on the protocol. Return the +# result of the ping. + +sub ping +{ + my ($self, + $host, # Name or IP number of host to ping + $timeout, # Seconds after which ping times out + $family, # Address family + ) = @_; + my ($ip, # Hash of addr (string), addr_in (packed), family + $ret, # The return value + $ping_time, # When ping began + ); + + $host = $self->{host} if !defined $host and $self->{host}; + croak("Usage: \$p->ping([ \$host [, \$timeout [, \$family]]])") if @_ > 4 or !$host; + $timeout = $self->{timeout} unless $timeout; + croak("Timeout must be greater than 0 seconds") if $timeout <= 0; + + if ($family) { + if ($family =~ $qr_family) { + if ($family =~ $qr_family4) { + $self->{family_local} = AF_INET; + } else { + $self->{family_local} = $AF_INET6; + } + } else { + croak('Family must be "ipv4" or "ipv6"') + } + } else { + $self->{family_local} = $self->{family}; + } + + $ip = $self->_resolv($host); + return () unless defined($ip); # Does host exist? + + # Dispatch to the appropriate routine. + $ping_time = &time(); + if ($self->{proto} eq "external") { + $ret = $self->ping_external($ip, $timeout); + } + elsif ($self->{proto} eq "udp") { + $ret = $self->ping_udp($ip, $timeout); + } + elsif ($self->{proto} eq "icmp") { + $ret = $self->ping_icmp($ip, $timeout); + } + elsif ($self->{proto} eq "icmpv6") { + $ret = $self->ping_icmpv6($ip, $timeout); + } + elsif ($self->{proto} eq "tcp") { + $ret = $self->ping_tcp($ip, $timeout); + } + elsif ($self->{proto} eq "stream") { + $ret = $self->ping_stream($ip, $timeout); + } + elsif ($self->{proto} eq "syn") { + $ret = $self->ping_syn($host, $ip, $ping_time, $ping_time+$timeout); + } else { + croak("Unknown protocol \"$self->{proto}\" in ping()"); + } + + return wantarray ? ($ret, &time() - $ping_time, $self->ntop($ip)) : $ret; +} + +# Uses Net::Ping::External to do an external ping. +sub ping_external { + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout, # Seconds after which ping times out + $family + ) = @_; + + $ip = $self->{host} if !defined $ip and $self->{host}; + $timeout = $self->{timeout} if !defined $timeout and $self->{timeout}; + my @addr = exists $ip->{addr_in} + ? ('ip' => $ip->{addr_in}) + : ('host' => $ip->{host}); + + eval { + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + require Net::Ping::External; + } or croak('Protocol "external" not supported on your system: Net::Ping::External not found'); + return Net::Ping::External::ping(@addr, timeout => $timeout, + family => $family); +} + +# h2ph "asm/socket.h" +# require "asm/socket.ph"; +use constant SO_BINDTODEVICE => 25; +use constant ICMP_ECHOREPLY => 0; # ICMP packet types +use constant ICMPv6_ECHOREPLY => 129; # ICMP packet types +use constant ICMP_UNREACHABLE => 3; # ICMP packet types +use constant ICMPv6_UNREACHABLE => 1; # ICMP packet types +use constant ICMP_ECHO => 8; +use constant ICMPv6_ECHO => 128; +use constant ICMP_TIME_EXCEEDED => 11; # ICMP packet types +use constant ICMP_PARAMETER_PROBLEM => 12; # ICMP packet types +use constant ICMP_TIMESTAMP => 13; +use constant ICMP_TIMESTAMP_REPLY => 14; +use constant ICMP_STRUCT => "C2 n3 A"; # Structure of a minimal ICMP packet +use constant ICMP_TIMESTAMP_STRUCT => "C2 n3 N3"; # Structure of a minimal timestamp ICMP packet +use constant SUBCODE => 0; # No ICMP subcode for ECHO and ECHOREPLY +use constant ICMP_FLAGS => 0; # No special flags for send or recv +use constant ICMP_PORT => 0; # No port with ICMP +use constant IP_MTU_DISCOVER => 10; # linux only + +sub message_type +{ + my ($self, + $type + ) = @_; + + croak "Setting message type only supported on 'icmp' protocol" + unless $self->{proto} eq 'icmp'; + + return $self->{message_type} || 'echo' + unless defined($type); + + croak "Supported icmp message type are limited to 'echo' and 'timestamp': '$type' not supported" + unless $type =~ /^echo|timestamp$/i; + + $self->{message_type} = lc($type); +} + +sub ping_icmp +{ + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout # Seconds after which ping times out + ) = @_; + + my ($saddr, # sockaddr_in with port and ip + $checksum, # Checksum of ICMP packet + $msg, # ICMP packet to send + $len_msg, # Length of $msg + $rbits, # Read bits, filehandles for reading + $nfound, # Number of ready filehandles found + $finish_time, # Time ping should be finished + $done, # set to 1 when we are done + $ret, # Return value + $recv_msg, # Received message including IP header + $from_saddr, # sockaddr_in of sender + $from_port, # Port packet was sent from + $from_ip, # Packed IP of sender + $timestamp_msg, # ICMP timestamp message type + $from_type, # ICMP type + $from_subcode, # ICMP subcode + $from_chk, # ICMP packet checksum + $from_pid, # ICMP packet id + $from_seq, # ICMP packet sequence + $from_msg # ICMP message + ); + + $ip = $self->{host} if !defined $ip and $self->{host}; + $timeout = $self->{timeout} if !defined $timeout and $self->{timeout}; + $timestamp_msg = $self->{message_type} && $self->{message_type} eq 'timestamp' ? 1 : 0; + + socket($self->{fh}, $ip->{family}, SOCK_RAW, $self->{proto_num}) || + croak("icmp socket error - $!"); + + if (defined $self->{local_addr} && + !CORE::bind($self->{fh}, _pack_sockaddr_in(0, $self->{local_addr}))) { + croak("icmp bind error - $!"); + } + $self->_setopts(); + + $self->{seq} = ($self->{seq} + 1) % 65536; # Increment sequence + $checksum = 0; # No checksum for starters + if ($ip->{family} == AF_INET) { + if ($timestamp_msg) { + $msg = pack(ICMP_TIMESTAMP_STRUCT, ICMP_TIMESTAMP, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, 0, 0, 0); + } else { + $msg = pack(ICMP_STRUCT . $self->{data_size}, ICMP_ECHO, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, $self->{data}); + } + } else { + # how to get SRC + my $pseudo_header = pack('a16a16Nnn', $ip->{addr_in}, $ip->{addr_in}, 8+length($self->{data}), 0, 0x003a); + $msg = pack(ICMP_STRUCT . $self->{data_size}, ICMPv6_ECHO, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, $self->{data}); + $msg = $pseudo_header.$msg + } + $checksum = Net::Ping->checksum($msg); + if ($ip->{family} == AF_INET) { + if ($timestamp_msg) { + $msg = pack(ICMP_TIMESTAMP_STRUCT, ICMP_TIMESTAMP, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, 0, 0, 0); + } else { + $msg = pack(ICMP_STRUCT . $self->{data_size}, ICMP_ECHO, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, $self->{data}); + } + } else { + $msg = pack(ICMP_STRUCT . $self->{data_size}, ICMPv6_ECHO, SUBCODE, + $checksum, $self->{pid}, $self->{seq}, $self->{data}); + } + $len_msg = length($msg); + $saddr = _pack_sockaddr_in(ICMP_PORT, $ip); + $self->{from_ip} = undef; + $self->{from_type} = undef; + $self->{from_subcode} = undef; + send($self->{fh}, $msg, ICMP_FLAGS, $saddr); # Send the message + + $rbits = ""; + vec($rbits, $self->{fh}->fileno(), 1) = 1; + $ret = 0; + $done = 0; + $finish_time = &time() + $timeout; # Must be done by this time + while (!$done && $timeout > 0) # Keep trying if we have time + { + $nfound = mselect((my $rout=$rbits), undef, undef, $timeout); # Wait for packet + $timeout = $finish_time - &time(); # Get remaining time + if (!defined($nfound)) # Hmm, a strange error + { + $ret = undef; + $done = 1; + } + elsif ($nfound) # Got a packet from somewhere + { + $recv_msg = ""; + $from_pid = -1; + $from_seq = -1; + $from_saddr = recv($self->{fh}, $recv_msg, 1500, ICMP_FLAGS); + ($from_port, $from_ip) = _unpack_sockaddr_in($from_saddr, $ip->{family}); + ($from_type, $from_subcode) = unpack("C2", substr($recv_msg, 20, 2)); + if ($from_type == ICMP_TIMESTAMP_REPLY) { + ($from_pid, $from_seq) = unpack("n3", substr($recv_msg, 24, 4)) + if length $recv_msg >= 28; + } elsif ($from_type == ICMP_ECHOREPLY) { + #warn "ICMP_ECHOREPLY: ", $ip->{family}, " ",$recv_msg, ":", length($recv_msg); + ($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 24, 4)) + if ($ip->{family} == AF_INET && length $recv_msg == 28); + ($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 4, 4)) + if ($ip->{family} == $AF_INET6 && length $recv_msg == 8); + } elsif ($from_type == ICMPv6_ECHOREPLY) { + #($from_pid, $from_seq) = unpack("n3", substr($recv_msg, 24, 4)) + # if length $recv_msg >= 28; + #($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 24, 4)) + # if ($ip->{family} == AF_INET && length $recv_msg == 28); + #warn "ICMPv6_ECHOREPLY: ", $ip->{family}, " ",$recv_msg, ":", length($recv_msg); + ($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 4, 4)) + if ($ip->{family} == $AF_INET6 && length $recv_msg == 8); + #} elsif ($from_type == ICMPv6_NI_REPLY) { + # ($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 4, 4)) + # if ($ip->{family} == $AF_INET6 && length $recv_msg == 8); + } else { + #warn "ICMP: ", $from_type, " ",$ip->{family}, " ",$recv_msg, ":", length($recv_msg); + ($from_pid, $from_seq) = unpack("n2", substr($recv_msg, 52, 4)) + if length $recv_msg >= 56; + } + $self->{from_ip} = $from_ip; + $self->{from_type} = $from_type; + $self->{from_subcode} = $from_subcode; + next if ($from_pid != $self->{pid}); + next if ($from_seq != $self->{seq}); + if (! $source_verify || ($self->ntop($from_ip) eq $self->ntop($ip))) { # Does the packet check out? + if (!$timestamp_msg && (($from_type == ICMP_ECHOREPLY) || ($from_type == ICMPv6_ECHOREPLY))) { + $ret = 1; + $done = 1; + } elsif ($timestamp_msg && $from_type == ICMP_TIMESTAMP_REPLY) { + $ret = 1; + $done = 1; + } elsif (($from_type == ICMP_UNREACHABLE) || ($from_type == ICMPv6_UNREACHABLE)) { + $done = 1; + } elsif ($from_type == ICMP_TIME_EXCEEDED) { + $ret = 0; + $done = 1; + } + } + } else { # Oops, timed out + $done = 1; + } + } + return $ret; +} + +sub ping_icmpv6 +{ + shift->ping_icmp(@_); +} + +sub icmp_result { + my ($self) = @_; + my $addr = $self->{from_ip} || ""; + $addr = "\0\0\0\0" unless 4 == length $addr; + return ($self->ntop($addr),($self->{from_type} || 0), ($self->{from_subcode} || 0)); +} + +# Description: Do a checksum on the message. Basically sum all of +# the short words and fold the high order bits into the low order bits. + +sub checksum +{ + my ($class, + $msg # The message to checksum + ) = @_; + my ($len_msg, # Length of the message + $num_short, # The number of short words in the message + $short, # One short word + $chk # The checksum + ); + + $len_msg = length($msg); + $num_short = int($len_msg / 2); + $chk = 0; + foreach $short (unpack("n$num_short", $msg)) + { + $chk += $short; + } # Add the odd byte in + $chk += (unpack("C", substr($msg, $len_msg - 1, 1)) << 8) if $len_msg % 2; + $chk = ($chk >> 16) + ($chk & 0xffff); # Fold high into low + return(~(($chk >> 16) + $chk) & 0xffff); # Again and complement +} + + +# Description: Perform a tcp echo ping. Since a tcp connection is +# host specific, we have to open and close each connection here. We +# can't just leave a socket open. Because of the robust nature of +# tcp, it will take a while before it gives up trying to establish a +# connection. Therefore, we use select() on a non-blocking socket to +# check against our timeout. No data bytes are actually +# sent since the successful establishment of a connection is proof +# enough of the reachability of the remote host. Also, tcp is +# expensive and doesn't need our help to add to the overhead. + +sub ping_tcp +{ + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout # Seconds after which ping times out + ) = @_; + my ($ret # The return value + ); + + $ip = $self->{host} if !defined $ip and $self->{host}; + $timeout = $self->{timeout} if !defined $timeout and $self->{timeout}; + + $! = 0; + $ret = $self -> tcp_connect( $ip, $timeout); + if (!$self->{econnrefused} && + $! == ECONNREFUSED) { + $ret = 1; # "Connection refused" means reachable + } + $self->{fh}->close(); + return $ret; +} + +sub tcp_connect +{ + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout # Seconds after which connect times out + ) = @_; + my ($saddr); # Packed IP and Port + + $ip = $self->{host} if !defined $ip and $self->{host}; + $timeout = $self->{timeout} if !defined $timeout and $self->{timeout}; + + $saddr = _pack_sockaddr_in($self->{port_num}, $ip); + + my $ret = 0; # Default to unreachable + + my $do_socket = sub { + socket($self->{fh}, $ip->{family}, SOCK_STREAM, $self->{proto_num}) || + croak("tcp socket error - $!"); + if (defined $self->{local_addr} && + !CORE::bind($self->{fh}, _pack_sockaddr_in(0, $self->{local_addr}))) { + croak("tcp bind error - $!"); + } + $self->_setopts(); + }; + my $do_connect = sub { + $self->{ip} = $ip->{addr_in}; + # ECONNREFUSED is 10061 on MSWin32. If we pass it as child error through $?, + # we'll get (10061 & 255) = 77, so we cannot check it in the parent process. + return ($ret = connect($self->{fh}, $saddr) || ($! == ECONNREFUSED && !$self->{econnrefused})); + }; + my $do_connect_nb = sub { + # Set O_NONBLOCK property on filehandle + $self->socket_blocking_mode($self->{fh}, 0); + + # start the connection attempt + if (!connect($self->{fh}, $saddr)) { + if ($! == ECONNREFUSED) { + $ret = 1 unless $self->{econnrefused}; + } elsif ($! != EINPROGRESS && ($^O ne 'MSWin32' || $! != EWOULDBLOCK)) { + # EINPROGRESS is the expected error code after a connect() + # on a non-blocking socket. But if the kernel immediately + # determined that this connect() will never work, + # Simply respond with "unreachable" status. + # (This can occur on some platforms with errno + # EHOSTUNREACH or ENETUNREACH.) + return 0; + } else { + # Got the expected EINPROGRESS. + # Just wait for connection completion... + my ($wbits, $wout, $wexc); + $wout = $wexc = $wbits = ""; + vec($wbits, $self->{fh}->fileno, 1) = 1; + + my $nfound = mselect(undef, + ($wout = $wbits), + ($^O eq 'MSWin32' ? ($wexc = $wbits) : undef), + $timeout); + warn("select: $!") unless defined $nfound; + + if ($nfound && vec($wout, $self->{fh}->fileno, 1)) { + # the socket is ready for writing so the connection + # attempt completed. test whether the connection + # attempt was successful or not + + if (getpeername($self->{fh})) { + # Connection established to remote host + $ret = 1; + } else { + # TCP ACK will never come from this host + # because there was an error connecting. + + # This should set $! to the correct error. + my $char; + sysread($self->{fh},$char,1); + $! = ECONNREFUSED if ($! == EAGAIN && $^O =~ /cygwin/i); + + $ret = 1 if (!$self->{econnrefused} + && $! == ECONNREFUSED); + } + } else { + # the connection attempt timed out (or there were connect + # errors on Windows) + if ($^O =~ 'MSWin32') { + # If the connect will fail on a non-blocking socket, + # winsock reports ECONNREFUSED as an exception, and we + # need to fetch the socket-level error code via getsockopt() + # instead of using the thread-level error code that is in $!. + if ($nfound && vec($wexc, $self->{fh}->fileno, 1)) { + $! = unpack("i", getsockopt($self->{fh}, SOL_SOCKET, + SO_ERROR)); + } + } + } + } + } else { + # Connection established to remote host + $ret = 1; + } + + # Unset O_NONBLOCK property on filehandle + $self->socket_blocking_mode($self->{fh}, 1); + $self->{ip} = $ip->{addr_in}; + return $ret; + }; + + if ($syn_forking) { + # Buggy Winsock API doesn't allow nonblocking connect. + # Hence, if our OS is Windows, we need to create a separate + # process to do the blocking connect attempt. + # XXX Above comments are not true at least for Win2K, where + # nonblocking connect works. + + $| = 1; # Clear buffer prior to fork to prevent duplicate flushing. + $self->{'tcp_chld'} = fork; + if (!$self->{'tcp_chld'}) { + if (!defined $self->{'tcp_chld'}) { + # Fork did not work + warn "Fork error: $!"; + return 0; + } + &{ $do_socket }(); + + # Try a slow blocking connect() call + # and report the status to the parent. + if ( &{ $do_connect }() ) { + $self->{fh}->close(); + # No error + exit 0; + } else { + # Pass the error status to the parent + # Make sure that $! <= 255 + exit($! <= 255 ? $! : 255); + } + } + + &{ $do_socket }(); + + my $patience = &time() + $timeout; + + my ($child, $child_errno); + $? = 0; $child_errno = 0; + # Wait up to the timeout + # And clean off the zombie + do { + $child = waitpid($self->{'tcp_chld'}, &WNOHANG()); + $child_errno = $? >> 8; + select(undef, undef, undef, 0.1); + } while &time() < $patience && $child != $self->{'tcp_chld'}; + + if ($child == $self->{'tcp_chld'}) { + if ($self->{proto} eq "stream") { + # We need the socket connected here, in parent + # Should be safe to connect because the child finished + # within the timeout + &{ $do_connect }(); + } + # $ret cannot be set by the child process + $ret = !$child_errno; + } else { + # Time must have run out. + # Put that choking client out of its misery + kill "KILL", $self->{'tcp_chld'}; + # Clean off the zombie + waitpid($self->{'tcp_chld'}, 0); + $ret = 0; + } + delete $self->{'tcp_chld'}; + $! = $child_errno; + } else { + # Otherwise don't waste the resources to fork + + &{ $do_socket }(); + + &{ $do_connect_nb }(); + } + + return $ret; +} + +sub DESTROY { + my $self = shift; + if ($self->{'proto'} eq 'tcp' && + $self->{'tcp_chld'}) { + # Put that choking client out of its misery + kill "KILL", $self->{'tcp_chld'}; + # Clean off the zombie + waitpid($self->{'tcp_chld'}, 0); + } +} + +# This writes the given string to the socket and then reads it +# back. It returns 1 on success, 0 on failure. +sub tcp_echo +{ + my ($self, $timeout, $pingstring) = @_; + + $timeout = $self->{timeout} if !defined $timeout and $self->{timeout}; + $pingstring = $self->{pingstring} if !defined $pingstring and $self->{pingstring}; + + my $ret = undef; + my $time = &time(); + my $wrstr = $pingstring; + my $rdstr = ""; + + eval <<'EOM'; + do { + my $rin = ""; + vec($rin, $self->{fh}->fileno(), 1) = 1; + + my $rout = undef; + if($wrstr) { + $rout = ""; + vec($rout, $self->{fh}->fileno(), 1) = 1; + } + + if(mselect($rin, $rout, undef, ($time + $timeout) - &time())) { + + if($rout && vec($rout,$self->{fh}->fileno(),1)) { + my $num = syswrite($self->{fh}, $wrstr, length $wrstr); + if($num) { + # If it was a partial write, update and try again. + $wrstr = substr($wrstr,$num); + } else { + # There was an error. + $ret = 0; + } + } + + if(vec($rin,$self->{fh}->fileno(),1)) { + my $reply; + if(sysread($self->{fh},$reply,length($pingstring)-length($rdstr))) { + $rdstr .= $reply; + $ret = 1 if $rdstr eq $pingstring; + } else { + # There was an error. + $ret = 0; + } + } + + } + } until &time() > ($time + $timeout) || defined($ret); +EOM + + return $ret; +} + +# Description: Perform a stream ping. If the tcp connection isn't +# already open, it opens it. It then sends some data and waits for +# a reply. It leaves the stream open on exit. + +sub ping_stream +{ + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout # Seconds after which ping times out + ) = @_; + + # Open the stream if it's not already open + if(!defined $self->{fh}->fileno()) { + $self->tcp_connect($ip, $timeout) or return 0; + } + + croak "tried to switch servers while stream pinging" + if $self->{ip} ne $ip->{addr_in}; + + return $self->tcp_echo($timeout, $pingstring); +} + +# Description: opens the stream. You would do this if you want to +# separate the overhead of opening the stream from the first ping. + +sub open +{ + my ($self, + $host, # Host or IP address + $timeout, # Seconds after which open times out + $family + ) = @_; + my $ip; # Hash of addr (string), addr_in (packed), family + $host = $self->{host} unless defined $host; + + if ($family) { + if ($family =~ $qr_family) { + if ($family =~ $qr_family4) { + $self->{family_local} = AF_INET; + } else { + $self->{family_local} = $AF_INET6; + } + } else { + croak('Family must be "ipv4" or "ipv6"') + } + } else { + $self->{family_local} = $self->{family}; + } + + $timeout = $self->{timeout} unless $timeout; + $ip = $self->_resolv($host); + + if ($self->{proto} eq "stream") { + if (defined($self->{fh}->fileno())) { + croak("socket is already open"); + } else { + return () unless $ip; + $self->tcp_connect($ip, $timeout); + } + } +} + +sub _dontfrag { + my $self = shift; + # bsd solaris + my $IP_DONTFRAG = eval { Socket::IP_DONTFRAG() }; + if ($IP_DONTFRAG) { + my $i = 1; + setsockopt($self->{fh}, IPPROTO_IP, $IP_DONTFRAG, pack("I*", $i)) + or croak "error configuring IP_DONTFRAG $!"; + # Linux needs more: Path MTU Discovery as defined in RFC 1191 + # For non SOCK_STREAM sockets it is the user's responsibility to packetize + # the data in MTU sized chunks and to do the retransmits if necessary. + # The kernel will reject packets that are bigger than the known path + # MTU if this flag is set (with EMSGSIZE). + if ($^O eq 'linux') { + my $i = 2; # IP_PMTUDISC_DO + setsockopt($self->{fh}, IPPROTO_IP, IP_MTU_DISCOVER, pack("I*", $i)) + or croak "error configuring IP_MTU_DISCOVER $!"; + } + } +} + +# SO_BINDTODEVICE + IP_TOS +sub _setopts { + my $self = shift; + if ($self->{'device'}) { + setsockopt($self->{fh}, SOL_SOCKET, SO_BINDTODEVICE, pack("Z*", $self->{'device'})) + or croak "error binding to device $self->{'device'} $!"; + } + if ($self->{'tos'}) { # need to re-apply ToS (RT #6706) + setsockopt($self->{fh}, IPPROTO_IP, IP_TOS, pack("I*", $self->{'tos'})) + or croak "error applying tos to $self->{'tos'} $!"; + } + if ($self->{'dontfrag'}) { + $self->_dontfrag; + } +} + + +# Description: Perform a udp echo ping. Construct a message of +# at least the one-byte sequence number and any additional data bytes. +# Send the message out and wait for a message to come back. If we +# get a message, make sure all of its parts match. If they do, we are +# done. Otherwise go back and wait for the message until we run out +# of time. Return the result of our efforts. + +use constant UDP_FLAGS => 0; # Nothing special on send or recv +sub ping_udp +{ + my ($self, + $ip, # Hash of addr (string), addr_in (packed), family + $timeout # Seconds after which ping times out + ) = @_; + + my ($saddr, # sockaddr_in with port and ip + $ret, # The return value + $msg, # Message to be echoed + $finish_time, # Time ping should be finished + $flush, # Whether socket needs to be disconnected + $connect, # Whether socket needs to be connected + $done, # Set to 1 when we are done pinging + $rbits, # Read bits, filehandles for reading + $nfound, # Number of ready filehandles found + $from_saddr, # sockaddr_in of sender + $from_msg, # Characters echoed by $host + $from_port, # Port message was echoed from + $from_ip # Packed IP number of sender + ); + + $saddr = _pack_sockaddr_in($self->{port_num}, $ip); + $self->{seq} = ($self->{seq} + 1) % 256; # Increment sequence + $msg = chr($self->{seq}) . $self->{data}; # Add data if any + + socket($self->{fh}, $ip->{family}, SOCK_DGRAM, + $self->{proto_num}) || + croak("udp socket error - $!"); + + if (defined $self->{local_addr} && + !CORE::bind($self->{fh}, _pack_sockaddr_in(0, $self->{local_addr}))) { + croak("udp bind error - $!"); + } + + $self->_setopts(); + + if ($self->{connected}) { + if ($self->{connected} ne $saddr) { + # Still connected to wrong destination. + # Need to flush out the old one. + $flush = 1; + } + } else { + # Not connected yet. + # Need to connect() before send() + $connect = 1; + } + + # Have to connect() and send() instead of sendto() + # in order to pick up on the ECONNREFUSED setting + # from recv() or double send() errno as utilized in + # the concept by rdw @ perlmonks. See: + # http://perlmonks.thepen.com/42898.html + if ($flush) { + # Need to socket() again to flush the descriptor + # This will disconnect from the old saddr. + socket($self->{fh}, $ip->{family}, SOCK_DGRAM, + $self->{proto_num}); + $self->_setopts(); + } + # Connect the socket if it isn't already connected + # to the right destination. + if ($flush || $connect) { + connect($self->{fh}, $saddr); # Tie destination to socket + $self->{connected} = $saddr; + } + send($self->{fh}, $msg, UDP_FLAGS); # Send it + + $rbits = ""; + vec($rbits, $self->{fh}->fileno(), 1) = 1; + $ret = 0; # Default to unreachable + $done = 0; + my $retrans = 0.01; + my $factor = $self->{retrans}; + $finish_time = &time() + $timeout; # Ping needs to be done by then + while (!$done && $timeout > 0) + { + if ($factor > 1) + { + $timeout = $retrans if $timeout > $retrans; + $retrans*= $factor; # Exponential backoff + } + $nfound = mselect((my $rout=$rbits), undef, undef, $timeout); # Wait for response + my $why = $!; + $timeout = $finish_time - &time(); # Get remaining time + + if (!defined($nfound)) # Hmm, a strange error + { + $ret = undef; + $done = 1; + } + elsif ($nfound) # A packet is waiting + { + $from_msg = ""; + $from_saddr = recv($self->{fh}, $from_msg, 1500, UDP_FLAGS); + if (!$from_saddr) { + # For example an unreachable host will make recv() fail. + if (!$self->{econnrefused} && + ($! == ECONNREFUSED || + $! == ECONNRESET)) { + # "Connection refused" means reachable + # Good, continue + $ret = 1; + } + $done = 1; + } else { + ($from_port, $from_ip) = _unpack_sockaddr_in($from_saddr, $ip->{family}); + my $addr_in = ref($ip) eq "HASH" ? $ip->{addr_in} : $ip; + if (!$source_verify || + (($from_ip eq $addr_in) && # Does the packet check out? + ($from_port == $self->{port_num}) && + ($from_msg eq $msg))) + { + $ret = 1; # It's a winner + $done = 1; + } + } + } + elsif ($timeout <= 0) # Oops, timed out + { + $done = 1; + } + else + { + # Send another in case the last one dropped + if (send($self->{fh}, $msg, UDP_FLAGS)) { + # Another send worked? The previous udp packet + # must have gotten lost or is still in transit. + # Hopefully this new packet will arrive safely. + } else { + if (!$self->{econnrefused} && + $! == ECONNREFUSED) { + # "Connection refused" means reachable + # Good, continue + $ret = 1; + } + $done = 1; + } + } + } + return $ret; +} + +# Description: Send a TCP SYN packet to host specified. +sub ping_syn +{ + my $self = shift; + my $host = shift; + my $ip = shift; + my $start_time = shift; + my $stop_time = shift; + + if ($syn_forking) { + return $self->ping_syn_fork($host, $ip, $start_time, $stop_time); + } + + my $fh = FileHandle->new(); + my $saddr = _pack_sockaddr_in($self->{port_num}, $ip); + + # Create TCP socket + if (!socket ($fh, $ip->{family}, SOCK_STREAM, $self->{proto_num})) { + croak("tcp socket error - $!"); + } + + if (defined $self->{local_addr} && + !CORE::bind($fh, _pack_sockaddr_in(0, $self->{local_addr}))) { + croak("tcp bind error - $!"); + } + + $self->_setopts(); + # Set O_NONBLOCK property on filehandle + $self->socket_blocking_mode($fh, 0); + + # Attempt the non-blocking connect + # by just sending the TCP SYN packet + if (connect($fh, $saddr)) { + # Non-blocking, yet still connected? + # Must have connected very quickly, + # or else it wasn't very non-blocking. + #warn "WARNING: Nonblocking connect connected anyway? ($^O)"; + } else { + # Error occurred connecting. + if ($! == EINPROGRESS || ($^O eq 'MSWin32' && $! == EWOULDBLOCK)) { + # The connection is just still in progress. + # This is the expected condition. + } else { + # Just save the error and continue on. + # The ack() can check the status later. + $self->{bad}->{$host} = $!; + } + } + + my $entry = [ $host, $ip, $fh, $start_time, $stop_time, $self->{port_num} ]; + $self->{syn}->{$fh->fileno} = $entry; + if ($self->{stop_time} < $stop_time) { + $self->{stop_time} = $stop_time; + } + vec($self->{wbits}, $fh->fileno, 1) = 1; + + return 1; +} + +sub ping_syn_fork { + my ($self, $host, $ip, $start_time, $stop_time) = @_; + + # Buggy Winsock API doesn't allow nonblocking connect. + # Hence, if our OS is Windows, we need to create a separate + # process to do the blocking connect attempt. + my $pid = fork(); + if (defined $pid) { + if ($pid) { + # Parent process + my $entry = [ $host, $ip, $pid, $start_time, $stop_time ]; + $self->{syn}->{$pid} = $entry; + if ($self->{stop_time} < $stop_time) { + $self->{stop_time} = $stop_time; + } + } else { + # Child process + my $saddr = _pack_sockaddr_in($self->{port_num}, $ip); + + # Create TCP socket + if (!socket ($self->{fh}, $ip->{family}, SOCK_STREAM, $self->{proto_num})) { + croak("tcp socket error - $!"); + } + + if (defined $self->{local_addr} && + !CORE::bind($self->{fh}, _pack_sockaddr_in(0, $self->{local_addr}))) { + croak("tcp bind error - $!"); + } + + $self->_setopts(); + + $!=0; + # Try to connect (could take a long time) + connect($self->{fh}, $saddr); + # Notify parent of connect error status + my $err = $!+0; + my $wrstr = "$$ $err"; + # Force to 16 chars including \n + $wrstr .= " "x(15 - length $wrstr). "\n"; + syswrite($self->{fork_wr}, $wrstr, length $wrstr); + exit; + } + } else { + # fork() failed? + die "fork: $!"; + } + return 1; +} + +# Description: Wait for TCP ACK from host specified +# from ping_syn above. If no host is specified, wait +# for TCP ACK from any of the hosts in the SYN queue. +sub ack +{ + my $self = shift; + + if ($self->{proto} eq "syn") { + if ($syn_forking) { + my @answer = $self->ack_unfork(shift); + return wantarray ? @answer : $answer[0]; + } + my $wbits = ""; + my $stop_time = 0; + if (my $host = shift or $self->{host}) { + # Host passed as arg or as option to new + $host = $self->{host} unless defined $host; + if (exists $self->{bad}->{$host}) { + if (!$self->{econnrefused} && + $self->{bad}->{ $host } && + (($! = ECONNREFUSED)>0) && + $self->{bad}->{ $host } eq "$!") { + # "Connection refused" means reachable + # Good, continue + } else { + # ECONNREFUSED means no good + return (); + } + } + my $host_fd = undef; + foreach my $fd (keys %{ $self->{syn} }) { + my $entry = $self->{syn}->{$fd}; + if ($entry->[0] eq $host) { + $host_fd = $fd; + $stop_time = $entry->[4] + || croak("Corrupted SYN entry for [$host]"); + last; + } + } + croak("ack called on [$host] without calling ping first!") + unless defined $host_fd; + vec($wbits, $host_fd, 1) = 1; + } else { + # No $host passed so scan all hosts + # Use the latest stop_time + $stop_time = $self->{stop_time}; + # Use all the bits + $wbits = $self->{wbits}; + } + + while ($wbits !~ /^\0*\z/) { + my $timeout = $stop_time - &time(); + # Force a minimum of 10 ms timeout. + $timeout = 0.01 if $timeout <= 0.01; + + my $winner_fd = undef; + my $wout = $wbits; + my $fd = 0; + # Do "bad" fds from $wbits first + while ($wout !~ /^\0*\z/) { + if (vec($wout, $fd, 1)) { + # Wipe it from future scanning. + vec($wout, $fd, 1) = 0; + if (my $entry = $self->{syn}->{$fd}) { + if ($self->{bad}->{ $entry->[0] }) { + $winner_fd = $fd; + last; + } + } + } + $fd++; + } + + if (defined($winner_fd) or my $nfound = mselect(undef, ($wout=$wbits), undef, $timeout)) { + if (defined $winner_fd) { + $fd = $winner_fd; + } else { + # Done waiting for one of the ACKs + $fd = 0; + # Determine which one + while ($wout !~ /^\0*\z/ && + !vec($wout, $fd, 1)) { + $fd++; + } + } + if (my $entry = $self->{syn}->{$fd}) { + # Wipe it from future scanning. + delete $self->{syn}->{$fd}; + vec($self->{wbits}, $fd, 1) = 0; + vec($wbits, $fd, 1) = 0; + if (!$self->{econnrefused} && + $self->{bad}->{ $entry->[0] } && + (($! = ECONNREFUSED)>0) && + $self->{bad}->{ $entry->[0] } eq "$!") { + # "Connection refused" means reachable + # Good, continue + } elsif (getpeername($entry->[2])) { + # Connection established to remote host + # Good, continue + } else { + # TCP ACK will never come from this host + # because there was an error connecting. + + # This should set $! to the correct error. + my $char; + sysread($entry->[2],$char,1); + # Store the excuse why the connection failed. + $self->{bad}->{$entry->[0]} = $!; + if (!$self->{econnrefused} && + (($! == ECONNREFUSED) || + ($! == EAGAIN && $^O =~ /cygwin/i))) { + # "Connection refused" means reachable + # Good, continue + } else { + # No good, try the next socket... + next; + } + } + # Everything passed okay, return the answer + return wantarray ? + ($entry->[0], &time() - $entry->[3], $self->ntop($entry->[1]), $entry->[5]) + : $entry->[0]; + } else { + warn "Corrupted SYN entry: unknown fd [$fd] ready!"; + vec($wbits, $fd, 1) = 0; + vec($self->{wbits}, $fd, 1) = 0; + } + } elsif (defined $nfound) { + # Timed out waiting for ACK + foreach my $fd (keys %{ $self->{syn} }) { + if (vec($wbits, $fd, 1)) { + my $entry = $self->{syn}->{$fd}; + $self->{bad}->{$entry->[0]} = "Timed out"; + vec($wbits, $fd, 1) = 0; + vec($self->{wbits}, $fd, 1) = 0; + delete $self->{syn}->{$fd}; + } + } + } else { + # Weird error occurred with select() + warn("select: $!"); + $self->{syn} = {}; + $wbits = ""; + } + } + } + return (); +} + +sub ack_unfork { + my ($self,$host) = @_; + my $stop_time = $self->{stop_time}; + if ($host) { + # Host passed as arg + if (my $entry = $self->{good}->{$host}) { + delete $self->{good}->{$host}; + return ($entry->[0], &time() - $entry->[3], $self->ntop($entry->[1])); + } + } + + my $rbits = ""; + my $timeout; + + if (keys %{ $self->{syn} }) { + # Scan all hosts that are left + vec($rbits, fileno($self->{fork_rd}), 1) = 1; + $timeout = $stop_time - &time(); + # Force a minimum of 10 ms timeout. + $timeout = 0.01 if $timeout < 0.01; + } else { + # No hosts left to wait for + $timeout = 0; + } + + if ($timeout > 0) { + my $nfound; + while ( keys %{ $self->{syn} } and + $nfound = mselect((my $rout=$rbits), undef, undef, $timeout)) { + # Done waiting for one of the ACKs + if (!sysread($self->{fork_rd}, $_, 16)) { + # Socket closed, which means all children are done. + return (); + } + my ($pid, $how) = split; + if ($pid) { + # Flush the zombie + waitpid($pid, 0); + if (my $entry = $self->{syn}->{$pid}) { + # Connection attempt to remote host is done + delete $self->{syn}->{$pid}; + if (!$how || # If there was no error connecting + (!$self->{econnrefused} && + $how == ECONNREFUSED)) { # "Connection refused" means reachable + if ($host && $entry->[0] ne $host) { + # A good connection, but not the host we need. + # Move it from the "syn" hash to the "good" hash. + $self->{good}->{$entry->[0]} = $entry; + # And wait for the next winner + next; + } + return ($entry->[0], &time() - $entry->[3], $self->ntop($entry->[1])); + } + } else { + # Should never happen + die "Unknown ping from pid [$pid]"; + } + } else { + die "Empty response from status socket?"; + } + } + if (defined $nfound) { + # Timed out waiting for ACK status + } else { + # Weird error occurred with select() + warn("select: $!"); + } + } + if (my @synners = keys %{ $self->{syn} }) { + # Kill all the synners + kill 9, @synners; + foreach my $pid (@synners) { + # Wait for the deaths to finish + # Then flush off the zombie + waitpid($pid, 0); + } + } + $self->{syn} = {}; + return (); +} + +# Description: Tell why the ack() failed +sub nack { + my $self = shift; + my $host = shift || croak('Usage> nack($failed_ack_host)'); + return $self->{bad}->{$host} || undef; +} + +# Description: Close the connection. + +sub close +{ + my ($self) = @_; + + if ($self->{proto} eq "syn") { + delete $self->{syn}; + } elsif ($self->{proto} eq "tcp") { + # The connection will already be closed + } elsif ($self->{proto} eq "external") { + # Nothing to close + } else { + $self->{fh}->close(); + } +} + +sub port_number { + my $self = shift; + if(@_) { + $self->{port_num} = shift @_; + $self->service_check(1); + } + return $self->{port_num}; +} + +sub ntop { + my($self, $ip) = @_; + + # Vista doesn't define a inet_ntop. It has InetNtop instead. + # Not following ANSI... priceless. getnameinfo() is defined + # for Windows 2000 and later, so that may be the choice. + + # Any port will work, even undef, but this will work for now. + # Socket warns when undef is passed in, but it still works. + my $port = getservbyname('echo', 'udp'); + my $sockaddr = _pack_sockaddr_in($port, $ip); + my ($error, $address) = getnameinfo($sockaddr, $NI_NUMERICHOST); + croak $error if $error; + return $address; +} + +sub wakeonlan { + my ($mac_addr, $host, $port) = @_; + + # use the discard service if $port not passed in + if (! defined $host) { $host = '255.255.255.255' } + if (! defined $port || $port !~ /^\d+$/ ) { $port = 9 } + + require IO::Socket::INET; + my $sock = IO::Socket::INET->new(Proto=>'udp') || return undef; + + my $ip_addr = inet_aton($host); + my $sock_addr = sockaddr_in($port, $ip_addr); + $mac_addr =~ s/://g; + my $packet = pack('C6H*', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, $mac_addr x 16); + + setsockopt($sock, SOL_SOCKET, SO_BROADCAST, 1); + send($sock, $packet, 0, $sock_addr); + $sock->close; + + return 1; +} + +######################################################## +# DNS hostname resolution +# return: +# $h->{name} = host - as passed in +# $h->{host} = host - as passed in without :port +# $h->{port} = OPTIONAL - if :port, then value of port +# $h->{addr} = resolved numeric address +# $h->{addr_in} = aton/pton result +# $h->{family} = AF_INET/6 +############################ +sub _resolv { + my ($self, + $name, + ) = @_; + + my %h; + $h{name} = $name; + my $family = $self->{family}; + + if (defined($self->{family_local})) { + $family = $self->{family_local} + } + +# START - host:port + my $cnt = 0; + + # Count ":" + $cnt++ while ($name =~ m/:/g); + + # 0 = hostname or IPv4 address + if ($cnt == 0) { + $h{host} = $name + # 1 = IPv4 address with port + } elsif ($cnt == 1) { + ($h{host}, $h{port}) = split /:/, $name + # >=2 = IPv6 address + } elsif ($cnt >= 2) { + #IPv6 with port - [2001::1]:port + if ($name =~ /^\[.*\]:\d{1,5}$/) { + ($h{host}, $h{port}) = split /:([^:]+)$/, $name # split after last : + # IPv6 without port + } else { + $h{host} = $name + } + } + + # Clean up host + $h{host} =~ s/\[//g; + $h{host} =~ s/\]//g; + # Clean up port + if (defined($h{port}) && (($h{port} !~ /^\d{1,5}$/) || ($h{port} < 1) || ($h{port} > 65535))) { + croak("Invalid port `$h{port}' in `$name'"); + return undef; + } +# END - host:port + + # address check + # new way + if ($Socket_VERSION > 1.94) { + my %hints = ( + family => $AF_UNSPEC, + protocol => IPPROTO_TCP, + flags => $AI_NUMERICHOST + ); + + # numeric address, return + my ($err, @getaddr) = Socket::getaddrinfo($h{host}, undef, \%hints); + if (defined($getaddr[0])) { + $h{addr} = $h{host}; + $h{family} = $getaddr[0]->{family}; + if ($h{family} == AF_INET) { + (undef, $h{addr_in}, undef, undef) = Socket::unpack_sockaddr_in $getaddr[0]->{addr}; + } else { + (undef, $h{addr_in}, undef, undef) = Socket::unpack_sockaddr_in6 $getaddr[0]->{addr}; + } + return \%h + } + # old way + } else { + # numeric address, return + my $ret = gethostbyname($h{host}); + if (defined($ret) && (_inet_ntoa($ret) eq $h{host})) { + $h{addr} = $h{host}; + $h{addr_in} = $ret; + $h{family} = AF_INET; + return \%h + } + } + + # resolve + # new way + if ($Socket_VERSION >= 1.94) { + my %hints = ( + family => $family, + protocol => IPPROTO_TCP + ); + + my ($err, @getaddr) = Socket::getaddrinfo($h{host}, undef, \%hints); + if (defined($getaddr[0])) { + my ($err, $address) = Socket::getnameinfo($getaddr[0]->{addr}, $NI_NUMERICHOST, $NIx_NOSERV); + if (defined($address)) { + $h{addr} = $address; + $h{addr} =~ s/\%(.)*$//; # remove %ifID if IPv6 + $h{family} = $getaddr[0]->{family}; + if ($h{family} == AF_INET) { + (undef, $h{addr_in}, undef, undef) = Socket::unpack_sockaddr_in $getaddr[0]->{addr}; + } else { + (undef, $h{addr_in}, undef, undef) = Socket::unpack_sockaddr_in6 $getaddr[0]->{addr}; + } + return \%h; + } else { + carp("getnameinfo($getaddr[0]->{addr}) failed - $err"); + return undef; + } + } else { + warn(sprintf("getaddrinfo($h{host},,%s) failed - $err", + $family == AF_INET ? "AF_INET" : "AF_INET6")); + return undef; + } + # old way + } else { + if ($family == $AF_INET6) { + croak("Socket >= 1.94 required for IPv6 - found Socket $Socket::VERSION"); + return undef; + } + + my @gethost = gethostbyname($h{host}); + if (defined($gethost[4])) { + $h{addr} = inet_ntoa($gethost[4]); + $h{addr_in} = $gethost[4]; + $h{family} = AF_INET; + return \%h + } else { + carp("gethostbyname($h{host}) failed - $^E"); + return undef; + } + } + return undef; +} + +sub _pack_sockaddr_in($$) { + my ($port, + $ip, + ) = @_; + + my $addr = ref($ip) eq "HASH" ? $ip->{addr_in} : $ip; + if (length($addr) <= 4 ) { + return Socket::pack_sockaddr_in($port, $addr); + } else { + return Socket::pack_sockaddr_in6($port, $addr); + } +} + +sub _unpack_sockaddr_in($;$) { + my ($addr, + $family, + ) = @_; + + my ($port, $host); + if ($family == AF_INET || (!defined($family) and length($addr) <= 16 )) { + ($port, $host) = Socket::unpack_sockaddr_in($addr); + } else { + ($port, $host) = Socket::unpack_sockaddr_in6($addr); + } + return $port, $host +} + +sub _inet_ntoa { + my ($addr + ) = @_; + + my $ret; + if ($Socket_VERSION >= 1.94) { + my ($err, $address) = Socket::getnameinfo($addr, $NI_NUMERICHOST); + if (defined($address)) { + $ret = $address; + } else { + carp("getnameinfo($addr) failed - $err"); + } + } else { + $ret = inet_ntoa($addr) + } + + return $ret +} + +1; +__END__ + +=head1 NAME + +Net::Ping - check a remote host for reachability + +=head1 SYNOPSIS + + use Net::Ping; + + $p = Net::Ping->new(); + print "$host is alive.\n" if $p->ping($host); + $p->close(); + + $p = Net::Ping->new("icmp"); + $p->bind($my_addr); # Specify source interface of pings + foreach $host (@host_array) + { + print "$host is "; + print "NOT " unless $p->ping($host, 2); + print "reachable.\n"; + sleep(1); + } + $p->close(); + + $p = Net::Ping->new("tcp", 2); + # Try connecting to the www port instead of the echo port + $p->port_number(scalar(getservbyname("http", "tcp"))); + while ($stop_time > time()) + { + print "$host not reachable ", scalar(localtime()), "\n" + unless $p->ping($host); + sleep(300); + } + undef($p); + + # Like tcp protocol, but with many hosts + $p = Net::Ping->new("syn"); + $p->port_number(getservbyname("http", "tcp")); + foreach $host (@host_array) { + $p->ping($host); + } + while (($host,$rtt,$ip) = $p->ack) { + print "HOST: $host [$ip] ACKed in $rtt seconds.\n"; + } + + # High precision syntax (requires Time::HiRes) + $p = Net::Ping->new(); + $p->hires(); + ($ret, $duration, $ip) = $p->ping($host, 5.5); + printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n", + 1000 * $duration) + if $ret; + $p->close(); + + # For backward compatibility + print "$host is alive.\n" if pingecho($host); + +=head1 DESCRIPTION + +This module contains methods to test the reachability of remote +hosts on a network. A ping object is first created with optional +parameters, a variable number of hosts may be pinged multiple +times and then the connection is closed. + +You may choose one of six different protocols to use for the +ping. The "tcp" protocol is the default. Note that a live remote host +may still fail to be pingable by one or more of these protocols. For +example, www.microsoft.com is generally alive but not "icmp" pingable. + +With the "tcp" protocol the ping() method attempts to establish a +connection to the remote host's echo port. If the connection is +successfully established, the remote host is considered reachable. No +data is actually echoed. This protocol does not require any special +privileges but has higher overhead than the "udp" and "icmp" protocols. + +Specifying the "udp" protocol causes the ping() method to send a udp +packet to the remote host's echo port. If the echoed packet is +received from the remote host and the received packet contains the +same data as the packet that was sent, the remote host is considered +reachable. This protocol does not require any special privileges. +It should be borne in mind that, for a udp ping, a host +will be reported as unreachable if it is not running the +appropriate echo service. For Unix-like systems see L<inetd(8)> +for more information. + +If the "icmp" protocol is specified, the ping() method sends an icmp +echo message to the remote host, which is what the UNIX ping program +does. If the echoed message is received from the remote host and +the echoed information is correct, the remote host is considered +reachable. Specifying the "icmp" protocol requires that the program +be run as root or that the program be setuid to root. + +If the "external" protocol is specified, the ping() method attempts to +use the C<Net::Ping::External> module to ping the remote host. +C<Net::Ping::External> interfaces with your system's default C<ping> +utility to perform the ping, and generally produces relatively +accurate results. If C<Net::Ping::External> if not installed on your +system, specifying the "external" protocol will result in an error. + +If the "syn" protocol is specified, the L</ping> method will only +send a TCP SYN packet to the remote host then immediately return. +If the syn packet was sent successfully, it will return a true value, +otherwise it will return false. NOTE: Unlike the other protocols, +the return value does NOT determine if the remote host is alive or +not since the full TCP three-way handshake may not have completed +yet. The remote host is only considered reachable if it receives +a TCP ACK within the timeout specified. To begin waiting for the +ACK packets, use the L</ack> method as explained below. Use the +"syn" protocol instead the "tcp" protocol to determine reachability +of multiple destinations simultaneously by sending parallel TCP +SYN packets. It will not block while testing each remote host. +This protocol does not require any special privileges. + +=head2 Functions + +=over 4 + +=item Net::Ping->new([proto, timeout, bytes, device, tos, ttl, family, + host, port, bind, gateway, retrans, pingstring, + source_verify econnrefused dontfrag + IPV6_USE_MIN_MTU IPV6_RECVPATHMTU]) +X<new> + +Create a new ping object. All of the parameters are optional and can +be passed as hash ref. All options besides the first 7 must be passed +as hash ref. + +C<proto> specifies the protocol to use when doing a ping. The current +choices are "tcp", "udp", "icmp", "icmpv6", "stream", "syn", or +"external". The default is "tcp". + +If a C<timeout> in seconds is provided, it is used +when a timeout is not given to the ping() method (below). The timeout +must be greater than 0 and the default, if not specified, is 5 seconds. + +If the number of data bytes (C<bytes>) is given, that many data bytes +are included in the ping packet sent to the remote host. The number of +data bytes is ignored if the protocol is "tcp". The minimum (and +default) number of data bytes is 1 if the protocol is "udp" and 0 +otherwise. The maximum number of data bytes that can be specified is +65535, but staying below the MTU (1472 bytes for ICMP) is recommended. +Many small devices cannot deal with fragmented ICMP packets. + +If C<device> is given, this device is used to bind the source endpoint +before sending the ping packet. I believe this only works with +superuser privileges and with udp and icmp protocols at this time. + +If <tos> is given, this ToS is configured into the socket. + +For icmp, C<ttl> can be specified to set the TTL of the outgoing packet. + +Valid C<family> values for IPv4: + + 4, v4, ip4, ipv4, AF_INET (constant) + +Valid C<family> values for IPv6: + + 6, v6, ip6, ipv6, AF_INET6 (constant) + +The C<host> argument implicitly specifies the family if the family +argument is not given. + +The C<port> argument is only valid for a udp, tcp or stream ping, and will not +do what you think it does. ping returns true when we get a "Connection refused"! +The default is the echo port. + +The C<bind> argument specifies the local_addr to bind to. +By specifying a bind argument you don't need the bind method. + +The C<gateway> argument is only valid for IPv6, and requires a IPv6 +address. + +The C<retrans> argument the exponential backoff rate, default 1.2. +It matches the $def_factor global. + +The C<dontfrag> argument sets the IP_DONTFRAG bit, but note that +IP_DONTFRAG is not yet defined by Socket, and not available on many +systems. Then it is ignored. On linux it also sets IP_MTU_DISCOVER to +IP_PMTUDISC_DO but need we don't chunk oversized packets. You need to +set $data_size manually. + +=item $p->ping($host [, $timeout [, $family]]); +X<ping> + +Ping the remote host and wait for a response. $host can be either the +hostname or the IP number of the remote host. The optional timeout +must be greater than 0 seconds and defaults to whatever was specified +when the ping object was created. Returns a success flag. If the +hostname cannot be found or there is a problem with the IP number, the +success flag returned will be undef. Otherwise, the success flag will +be 1 if the host is reachable and 0 if it is not. For most practical +purposes, undef and 0 and can be treated as the same case. In array +context, the elapsed time as well as the string form of the ip the +host resolved to are also returned. The elapsed time value will +be a float, as returned by the Time::HiRes::time() function, if hires() +has been previously called, otherwise it is returned as an integer. + +=item $p->source_verify( { 0 | 1 } ); +X<source_verify> + +Allows source endpoint verification to be enabled or disabled. +This is useful for those remote destinations with multiples +interfaces where the response may not originate from the same +endpoint that the original destination endpoint was sent to. +This only affects udp and icmp protocol pings. + +This is enabled by default. + +=item $p->service_check( { 0 | 1 } ); +X<service_check> + +Set whether or not the connect behavior should enforce +remote service availability as well as reachability. Normally, +if the remote server reported ECONNREFUSED, it must have been +reachable because of the status packet that it reported. +With this option enabled, the full three-way tcp handshake +must have been established successfully before it will +claim it is reachable. NOTE: It still does nothing more +than connect and disconnect. It does not speak any protocol +(i.e., HTTP or FTP) to ensure the remote server is sane in +any way. The remote server CPU could be grinding to a halt +and unresponsive to any clients connecting, but if the kernel +throws the ACK packet, it is considered alive anyway. To +really determine if the server is responding well would be +application specific and is beyond the scope of Net::Ping. +For udp protocol, enabling this option demands that the +remote server replies with the same udp data that it was sent +as defined by the udp echo service. + +This affects the "udp", "tcp", and "syn" protocols. + +This is disabled by default. + +=item $p->tcp_service_check( { 0 | 1 } ); +X<tcp_service_check> + +Deprecated method, but does the same as service_check() method. + +=item $p->hires( { 0 | 1 } ); +X<hires> + +With 1 causes this module to use Time::HiRes module, allowing milliseconds +to be returned by subsequent calls to ping(). + +=item $p->time +X<time> + +The current time, hires or not. + +=item $p->socket_blocking_mode( $fh, $mode ); +X<socket_blocking_mode> + +Sets or clears the O_NONBLOCK flag on a file handle. + +=item $p->IPV6_USE_MIN_MTU +X<IPV6_USE_MIN_MTU> + +With argument sets the option. +Without returns the option value. + +=item $p->IPV6_RECVPATHMTU +X<IPV6_RECVPATHMTU> + +Notify an according IPv6 MTU. + +With argument sets the option. +Without returns the option value. + +=item $p->IPV6_HOPLIMIT +X<IPV6_HOPLIMIT> + +With argument sets the option. +Without returns the option value. + +=item $p->IPV6_REACHCONF I<NYI> +X<IPV6_REACHCONF> + +Sets ipv6 reachability +IPV6_REACHCONF was removed in RFC3542. ping6 -R supports it. +IPV6_REACHCONF requires root/admin permissions. + +With argument sets the option. +Without returns the option value. + +Not yet implemented. + +=item $p->bind($local_addr); +X<bind> + +Sets the source address from which pings will be sent. This must be +the address of one of the interfaces on the local host. $local_addr +may be specified as a hostname or as a text IP address such as +"192.168.1.1". + +If the protocol is set to "tcp", this method may be called any +number of times, and each call to the ping() method (below) will use +the most recent $local_addr. If the protocol is "icmp" or "udp", +then bind() must be called at most once per object, and (if it is +called at all) must be called before the first call to ping() for that +object. + +The bind() call can be omitted when specifying the C<bind> option to +new(). + +=item $p->message_type([$ping_type]); +X<message_type> + +When you are using the "icmp" protocol, this call permit to change the +message type to 'echo' or 'timestamp' (only for IPv4, see RFC 792). + +Without argument, it returns the currently used icmp protocol message type. +By default, it returns 'echo'. + +=item $p->open($host); +X<open> + +When you are using the "stream" protocol, this call pre-opens the +tcp socket. It's only necessary to do this if you want to +provide a different timeout when creating the connection, or +remove the overhead of establishing the connection from the +first ping. If you don't call C<open()>, the connection is +automatically opened the first time C<ping()> is called. +This call simply does nothing if you are using any protocol other +than stream. + +The $host argument can be omitted when specifying the C<host> option to +new(). + +=item $p->ack( [ $host ] ); +X<ack> + +When using the "syn" protocol, use this method to determine +the reachability of the remote host. This method is meant +to be called up to as many times as ping() was called. Each +call returns the host (as passed to ping()) that came back +with the TCP ACK. The order in which the hosts are returned +may not necessarily be the same order in which they were +SYN queued using the ping() method. If the timeout is +reached before the TCP ACK is received, or if the remote +host is not listening on the port attempted, then the TCP +connection will not be established and ack() will return +undef. In list context, the host, the ack time, the dotted ip +string, and the port number will be returned instead of just the host. +If the optional C<$host> argument is specified, the return +value will be pertaining to that host only. +This call simply does nothing if you are using any protocol +other than "syn". + +When L</new> had a host option, this host will be used. +Without C<$host> argument, all hosts are scanned. + +=item $p->nack( $failed_ack_host ); +X<nack> + +The reason that C<host $failed_ack_host> did not receive a +valid ACK. Useful to find out why when C<ack($fail_ack_host)> +returns a false value. + +=item $p->ack_unfork($host) +X<ack_unfork> + +The variant called by L</ack> with the "syn" protocol and C<$syn_forking> +enabled. + +=item $p->ping_icmp([$host, $timeout, $family]) +X<ping_icmp> + +The L</ping> method used with the icmp protocol. + +=item $p->ping_icmpv6([$host, $timeout, $family]) I<NYI> +X<ping_icmpv6> + +The L</ping> method used with the icmpv6 protocol. + +=item $p->ping_stream([$host, $timeout, $family]) +X<ping_stream> + +The L</ping> method used with the stream protocol. + +Perform a stream ping. If the tcp connection isn't +already open, it opens it. It then sends some data and waits for +a reply. It leaves the stream open on exit. + +=item $p->ping_syn([$host, $ip, $start_time, $stop_time]) +X<ping_syn> + +The L</ping> method used with the syn protocol. +Sends a TCP SYN packet to host specified. + +=item $p->ping_syn_fork([$host, $timeout, $family]) +X<ping_syn_fork> + +The L</ping> method used with the forking syn protocol. + +=item $p->ping_tcp([$host, $timeout, $family]) +X<ping_tcp> + +The L</ping> method used with the tcp protocol. + +=item $p->ping_udp([$host, $timeout, $family]) +X<ping_udp> + +The L</ping> method used with the udp protocol. + +Perform a udp echo ping. Construct a message of +at least the one-byte sequence number and any additional data bytes. +Send the message out and wait for a message to come back. If we +get a message, make sure all of its parts match. If they do, we are +done. Otherwise go back and wait for the message until we run out +of time. Return the result of our efforts. + +=item $p->ping_external([$host, $timeout, $family]) +X<ping_external> + +The L</ping> method used with the external protocol. +Uses L<Net::Ping::External> to do an external ping. + +=item $p->tcp_connect([$ip, $timeout]) +X<tcp_connect> + +Initiates a TCP connection, for a tcp ping. + +=item $p->tcp_echo([$ip, $timeout, $pingstring]) +X<tcp_echo> + +Performs a TCP echo. +It writes the given string to the socket and then reads it +back. It returns 1 on success, 0 on failure. + +=item $p->close(); +X<close> + +Close the network connection for this ping object. The network +connection is also closed by "undef $p". The network connection is +automatically closed if the ping object goes out of scope (e.g. $p is +local to a subroutine and you leave the subroutine). + +=item $p->port_number([$port_number]) +X<port_number> + +When called with a port number, the port number used to ping is set to +C<$port_number> rather than using the echo port. It also has the effect +of calling C<$p-E<gt>service_check(1)> causing a ping to return a successful +response only if that specific port is accessible. This function returns +the value of the port that L</ping> will connect to. + +=item $p->mselect +X<mselect> + +A C<select()> wrapper that compensates for platform +peculiarities. + +=item $p->ntop +X<ntop> + +Platform abstraction over C<inet_ntop()> + +=item $p->checksum($msg) +X<checksum> + +Do a checksum on the message. Basically sum all of +the short words and fold the high order bits into the low order bits. + +=item $p->icmp_result +X<icmp_result> + +Returns a list of addr, type, subcode. + +=item pingecho($host [, $timeout]); +X<pingecho> + +To provide backward compatibility with the previous version of +L<Net::Ping>, a C<pingecho()> subroutine is available with the same +functionality as before. C<pingecho()> uses the tcp protocol. The +return values and parameters are the same as described for the L</ping> +method. This subroutine is obsolete and may be removed in a future +version of L<Net::Ping>. + +=item wakeonlan($mac, [$host, [$port]]) +X<wakeonlan> + +Emit the popular wake-on-lan magic udp packet to wake up a local +device. See also L<Net::Wake>, but this has the mac address as 1st arg. +C<$host> should be the local gateway. Without it will broadcast. + +Default host: '255.255.255.255' +Default port: 9 + + perl -MNet::Ping=wakeonlan -e'wakeonlan "e0:69:95:35:68:d2"' + +=back + +=head1 NOTES + +There will be less network overhead (and some efficiency in your +program) if you specify either the udp or the icmp protocol. The tcp +protocol will generate 2.5 times or more traffic for each ping than +either udp or icmp. If many hosts are pinged frequently, you may wish +to implement a small wait (e.g. 25ms or more) between each ping to +avoid flooding your network with packets. + +The icmp and icmpv6 protocols requires that the program be run as root +or that it be setuid to root. The other protocols do not require +special privileges, but not all network devices implement tcp or udp +echo. + +Local hosts should normally respond to pings within milliseconds. +However, on a very congested network it may take up to 3 seconds or +longer to receive an echo packet from the remote host. If the timeout +is set too low under these conditions, it will appear that the remote +host is not reachable (which is almost the truth). + +Reachability doesn't necessarily mean that the remote host is actually +functioning beyond its ability to echo packets. tcp is slightly better +at indicating the health of a system than icmp because it uses more +of the networking stack to respond. + +Because of a lack of anything better, this module uses its own +routines to pack and unpack ICMP packets. It would be better for a +separate module to be written which understands all of the different +kinds of ICMP packets. + +=head1 INSTALL + +The latest source tree is available via git: + + git clone https://github.com/rurban/Net-Ping.git + cd Net-Ping + +The tarball can be created as follows: + + perl Makefile.PL ; make ; make dist + +The latest Net::Ping releases are included in cperl and perl5. + +=head1 BUGS + +For a list of known issues, visit: + +L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Ping> +and +L<https://github.com/rurban/Net-Ping/issues> + +To report a new bug, visit: + +L<https://github.com/rurban/Net-Ping/issues> + +=head1 AUTHORS + + Current maintainers: + perl11 (for cperl, with IPv6 support and more) + p5p (for perl5) + + Previous maintainers: + bbb@cpan.org (Rob Brown) + Steve Peters + + External protocol: + colinm@cpan.org (Colin McMillen) + + Stream protocol: + bronson@trestle.com (Scott Bronson) + + Wake-on-lan: + 1999-2003 Clinton Wong + + Original pingecho(): + karrer@bernina.ethz.ch (Andreas Karrer) + pmarquess@bfsec.bt.co.uk (Paul Marquess) + + Original Net::Ping author: + mose@ns.ccsn.edu (Russell Mosemann) + +=head1 COPYRIGHT + +Copyright (c) 2017-2018, Reini Urban. All rights reserved. + +Copyright (c) 2016, cPanel Inc. All rights reserved. + +Copyright (c) 2012, Steve Peters. All rights reserved. + +Copyright (c) 2002-2003, Rob Brown. All rights reserved. + +Copyright (c) 2001, Colin McMillen. All rights reserved. + +This program is free software; you may redistribute it and/or +modify it under the same terms as Perl itself. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/SMTP.pm b/data/miniconda3/lib/perl5/core_perl/Net/SMTP.pm new file mode 100644 index 0000000000000000000000000000000000000000..5eaf4220b62b12772ed530ebdf9c59654c87ce5c --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/SMTP.pm @@ -0,0 +1,1046 @@ +# Net::SMTP.pm +# +# Copyright (C) 1995-2004 Graham Barr. All rights reserved. +# Copyright (C) 2013-2016 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::SMTP; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use IO::Socket; +use Net::Cmd; +use Net::Config; +use Socket; + +our $VERSION = "3.11"; + +# Code for detecting if we can use SSL +my $ssl_class = eval { + require IO::Socket::SSL; + # first version with default CA on most platforms + no warnings 'numeric'; + IO::Socket::SSL->VERSION(2.007); +} && 'IO::Socket::SSL'; + +my $nossl_warn = !$ssl_class && + 'To use SSL please install IO::Socket::SSL with version>=2.007'; + +# Code for detecting if we can use IPv6 +my $family_key = 'Domain'; +my $inet6_class = eval { + require IO::Socket::IP; + no warnings 'numeric'; + IO::Socket::IP->VERSION(0.25) || die; + $family_key = 'Family'; +} && 'IO::Socket::IP' || eval { + require IO::Socket::INET6; + no warnings 'numeric'; + IO::Socket::INET6->VERSION(2.62); +} && 'IO::Socket::INET6'; + +sub can_ssl { $ssl_class }; +sub can_inet6 { $inet6_class }; + +our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET'); + +sub new { + my $self = shift; + my $type = ref($self) || $self; + my ($host, %arg); + if (@_ % 2) { + $host = shift; + %arg = @_; + } + else { + %arg = @_; + $host = delete $arg{Host}; + } + + if ($arg{SSL}) { + # SSL from start + die $nossl_warn if !$ssl_class; + $arg{Port} ||= 465; + } + + my $hosts = defined $host ? $host : $NetConfig{smtp_hosts}; + my $obj; + + $arg{Timeout} = 120 if ! defined $arg{Timeout}; + + foreach my $h (@{ref($hosts) ? $hosts : [$hosts]}) { + $obj = $type->SUPER::new( + PeerAddr => ($host = $h), + PeerPort => $arg{Port} || 'smtp(25)', + LocalAddr => $arg{LocalAddr}, + LocalPort => $arg{LocalPort}, + $family_key => $arg{Domain} || $arg{Family}, + Proto => 'tcp', + Timeout => $arg{Timeout} + ) + and last; + } + + return + unless defined $obj; + + ${*$obj}{'net_smtp_arg'} = \%arg; + ${*$obj}{'net_smtp_host'} = $host; + + if ($arg{SSL}) { + Net::SMTP::_SSL->start_SSL($obj,%arg) + or return; + } + + $obj->autoflush(1); + + $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); + + unless ($obj->response() == CMD_OK) { + my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; + $obj->close(); + $@ = $err; + return; + } + + ${*$obj}{'net_smtp_exact_addr'} = $arg{ExactAddresses}; + + (${*$obj}{'net_smtp_banner'}) = $obj->message; + (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/; + + if (!exists $arg{SendHello} || $arg{SendHello}) { + unless ($obj->hello($arg{Hello} || "")) { + my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; + $obj->close(); + $@ = $err; + return; + } + } + + $obj; +} + + +sub host { + my $me = shift; + ${*$me}{'net_smtp_host'}; +} + +## +## User interface methods +## + + +sub banner { + my $me = shift; + + return ${*$me}{'net_smtp_banner'} || undef; +} + + +sub domain { + my $me = shift; + + return ${*$me}{'net_smtp_domain'} || undef; +} + + +sub etrn { + my $self = shift; + defined($self->supports('ETRN', 500, ["Command unknown: 'ETRN'"])) + && $self->_ETRN(@_); +} + + +sub auth { + my ($self, $username, $password) = @_; + + eval { + require MIME::Base64; + require Authen::SASL; + } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0; + + my $mechanisms = $self->supports('AUTH', 500, ["Command unknown: 'AUTH'"]); + return unless defined $mechanisms; + + my $sasl; + + if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) { + $sasl = $username; + my $requested_mechanisms = $sasl->mechanism(); + if (! defined($requested_mechanisms) || $requested_mechanisms eq '') { + $sasl->mechanism($mechanisms); + } + } + else { + die "auth(username, password)" if not length $username; + $sasl = Authen::SASL->new( + mechanism => $mechanisms, + callback => { + user => $username, + pass => $password, + authname => $username, + }, + debug => $self->debug + ); + } + + my $client; + my $str; + do { + if ($client) { + # $client mechanism failed, so we need to exclude this mechanism from list + my $failed_mechanism = $client->mechanism; + return unless defined $failed_mechanism; + $self->debug_text("Auth mechanism failed: $failed_mechanism") + if $self->debug; + $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; + return unless $mechanisms =~ /\S/; + $sasl->mechanism($mechanisms); + } + + # We should probably allow the user to pass the host, but I don't + # currently know and SASL mechanisms that are used by smtp that need it + + $client = $sasl->client_new('smtp', ${*$self}{'net_smtp_host'}, 0); + $str = $client->client_start; + } while (!defined $str); + + # We don't support sasl mechanisms that encrypt the socket traffic. + # todo that we would really need to change the ISA hierarchy + # so we don't inherit from IO::Socket, but instead hold it in an attribute + + my @cmd = ("AUTH", $client->mechanism); + my $code; + + push @cmd, MIME::Base64::encode_base64($str, '') + if defined $str and length $str; + + while (($code = $self->command(@cmd)->response()) == CMD_MORE) { + my $str2 = MIME::Base64::decode_base64(($self->message)[0]); + $self->debug_print(0, "(decoded) " . $str2 . "\n") if $self->debug; + + $str = $client->client_step($str2); + @cmd = ( + MIME::Base64::encode_base64($str, '') + ); + + $self->debug_print(1, "(decoded) " . $str . "\n") if $self->debug; + } + + $code == CMD_OK; +} + + +sub hello { + my $me = shift; + my $domain = shift || "localhost.localdomain"; + my $ok = $me->_EHLO($domain); + my @msg = $me->message; + + if ($ok) { + my $h = ${*$me}{'net_smtp_esmtp'} = {}; + foreach my $ln (@msg) { + $h->{uc $1} = $2 + if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/; + } + } + elsif ($me->status == CMD_ERROR) { + @msg = $me->message + if $ok = $me->_HELO($domain); + } + + return unless $ok; + ${*$me}{net_smtp_hello_domain} = $domain; + + $msg[0] =~ /\A\s*(\S+)/; + return ($1 || " "); +} + +sub starttls { + my $self = shift; + $ssl_class or die $nossl_warn; + $self->_STARTTLS or return; + Net::SMTP::_SSL->start_SSL($self, + %{ ${*$self}{'net_smtp_arg'} }, # (ssl) args given in new + @_ # more (ssl) args + ) or return; + + # another hello after starttls to read new ESMTP capabilities + return $self->hello(${*$self}{net_smtp_hello_domain}); +} + + +sub supports { + my $self = shift; + my $cmd = uc shift; + return ${*$self}{'net_smtp_esmtp'}->{$cmd} + if exists ${*$self}{'net_smtp_esmtp'}->{$cmd}; + $self->set_status(@_) + if @_; + return; +} + + +sub _addr { + my $self = shift; + my $addr = shift; + $addr = "" unless defined $addr; + + if (${*$self}{'net_smtp_exact_addr'}) { + return $1 if $addr =~ /^\s*(<.*>)\s*$/s; + } + else { + return $1 if $addr =~ /(<[^>]*>)/; + $addr =~ s/^\s+|\s+$//sg; + } + + "<$addr>"; +} + + +sub mail { + my $me = shift; + my $addr = _addr($me, shift); + my $opts = ""; + + if (@_) { + my %opt = @_; + my ($k, $v); + + if (exists ${*$me}{'net_smtp_esmtp'}) { + my $esmtp = ${*$me}{'net_smtp_esmtp'}; + + if (defined($v = delete $opt{Size})) { + if (exists $esmtp->{SIZE}) { + $opts .= sprintf " SIZE=%d", $v + 0; + } + else { + carp 'Net::SMTP::mail: SIZE option not supported by host'; + } + } + + if (defined($v = delete $opt{Return})) { + if (exists $esmtp->{DSN}) { + $opts .= " RET=" . ((uc($v) eq "FULL") ? "FULL" : "HDRS"); + } + else { + carp 'Net::SMTP::mail: DSN option not supported by host'; + } + } + + if (defined($v = delete $opt{Bits})) { + if ($v eq "8") { + if (exists $esmtp->{'8BITMIME'}) { + $opts .= " BODY=8BITMIME"; + } + else { + carp 'Net::SMTP::mail: 8BITMIME option not supported by host'; + } + } + elsif ($v eq "binary") { + if (exists $esmtp->{'BINARYMIME'} && exists $esmtp->{'CHUNKING'}) { + $opts .= " BODY=BINARYMIME"; + ${*$me}{'net_smtp_chunking'} = 1; + } + else { + carp 'Net::SMTP::mail: BINARYMIME option not supported by host'; + } + } + elsif (exists $esmtp->{'8BITMIME'} or exists $esmtp->{'BINARYMIME'}) { + $opts .= " BODY=7BIT"; + } + else { + carp 'Net::SMTP::mail: 8BITMIME and BINARYMIME options not supported by host'; + } + } + + if (defined($v = delete $opt{Transaction})) { + if (exists $esmtp->{CHECKPOINT}) { + $opts .= " TRANSID=" . _addr($me, $v); + } + else { + carp 'Net::SMTP::mail: CHECKPOINT option not supported by host'; + } + } + + if (defined($v = delete $opt{Envelope})) { + if (exists $esmtp->{DSN}) { + $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02X", ord($1)/sge; + $opts .= " ENVID=$v"; + } + else { + carp 'Net::SMTP::mail: DSN option not supported by host'; + } + } + + if (defined($v = delete $opt{ENVID})) { + + # expected to be in a format as required by RFC 3461, xtext-encoded + if (exists $esmtp->{DSN}) { + $opts .= " ENVID=$v"; + } + else { + carp 'Net::SMTP::mail: DSN option not supported by host'; + } + } + + if (defined($v = delete $opt{AUTH})) { + + # expected to be in a format as required by RFC 2554, + # rfc2821-quoted and xtext-encoded, or <> + if (exists $esmtp->{AUTH}) { + $v = '<>' if !defined($v) || $v eq ''; + $opts .= " AUTH=$v"; + } + else { + carp 'Net::SMTP::mail: AUTH option not supported by host'; + } + } + + if (defined($v = delete $opt{XVERP})) { + if (exists $esmtp->{'XVERP'}) { + $opts .= " XVERP"; + } + else { + carp 'Net::SMTP::mail: XVERP option not supported by host'; + } + } + + carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored' + if scalar keys %opt; + } + else { + carp 'Net::SMTP::mail: ESMTP not supported by host - options discarded :-('; + } + } + + $me->_MAIL("FROM:" . $addr . $opts); +} + + +sub send { my $me = shift; $me->_SEND("FROM:" . _addr($me, $_[0])) } +sub send_or_mail { my $me = shift; $me->_SOML("FROM:" . _addr($me, $_[0])) } +sub send_and_mail { my $me = shift; $me->_SAML("FROM:" . _addr($me, $_[0])) } + + +sub reset { + my $me = shift; + + $me->dataend() + if (exists ${*$me}{'net_smtp_lastch'}); + + $me->_RSET(); +} + + +sub recipient { + my $smtp = shift; + my $opts = ""; + my $skip_bad = 0; + + if (@_ && ref($_[-1])) { + my %opt = %{pop(@_)}; + my $v; + + $skip_bad = delete $opt{'SkipBad'}; + + if (exists ${*$smtp}{'net_smtp_esmtp'}) { + my $esmtp = ${*$smtp}{'net_smtp_esmtp'}; + + if (defined($v = delete $opt{Notify})) { + if (exists $esmtp->{DSN}) { + $opts .= " NOTIFY=" . join(",", map { uc $_ } @$v); + } + else { + carp 'Net::SMTP::recipient: DSN option not supported by host'; + } + } + + if (defined($v = delete $opt{ORcpt})) { + if (exists $esmtp->{DSN}) { + $opts .= " ORCPT=" . $v; + } + else { + carp 'Net::SMTP::recipient: DSN option not supported by host'; + } + } + + carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored' + if scalar keys %opt; + } + elsif (%opt) { + carp 'Net::SMTP::recipient: ESMTP not supported by host - options discarded :-('; + } + } + + my @ok; + foreach my $addr (@_) { + if ($smtp->_RCPT("TO:" . _addr($smtp, $addr) . $opts)) { + push(@ok, $addr) if $skip_bad; + } + elsif (!$skip_bad) { + return 0; + } + } + + return $skip_bad ? @ok : 1; +} + +BEGIN { + *to = \&recipient; + *cc = \&recipient; + *bcc = \&recipient; +} + + +sub data { + my $me = shift; + + if (exists ${*$me}{'net_smtp_chunking'}) { + carp 'Net::SMTP::data: CHUNKING extension in use, must call bdat instead'; + } + else { + my $ok = $me->_DATA() && $me->datasend(@_); + + $ok && @_ + ? $me->dataend + : $ok; + } +} + + +sub bdat { + my $me = shift; + + if (exists ${*$me}{'net_smtp_chunking'}) { + my $data = shift; + + $me->_BDAT(length $data) + && $me->rawdatasend($data) + && $me->response() == CMD_OK; + } + else { + carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead'; + } +} + + +sub bdatlast { + my $me = shift; + + if (exists ${*$me}{'net_smtp_chunking'}) { + my $data = shift; + + $me->_BDAT(length $data, "LAST") + && $me->rawdatasend($data) + && $me->response() == CMD_OK; + } + else { + carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead'; + } +} + + +sub datafh { + my $me = shift; + return unless $me->_DATA(); + return $me->tied_fh; +} + + +sub expand { + my $me = shift; + + $me->_EXPN(@_) + ? ($me->message) + : (); +} + + +sub verify { shift->_VRFY(@_) } + + +sub help { + my $me = shift; + + $me->_HELP(@_) + ? scalar $me->message + : undef; +} + + +sub quit { + my $me = shift; + + $me->_QUIT; + $me->close; +} + + +sub DESTROY { + + # ignore +} + +## +## RFC821 commands +## + + +sub _EHLO { shift->command("EHLO", @_)->response() == CMD_OK } +sub _HELO { shift->command("HELO", @_)->response() == CMD_OK } +sub _MAIL { shift->command("MAIL", @_)->response() == CMD_OK } +sub _RCPT { shift->command("RCPT", @_)->response() == CMD_OK } +sub _SEND { shift->command("SEND", @_)->response() == CMD_OK } +sub _SAML { shift->command("SAML", @_)->response() == CMD_OK } +sub _SOML { shift->command("SOML", @_)->response() == CMD_OK } +sub _VRFY { shift->command("VRFY", @_)->response() == CMD_OK } +sub _EXPN { shift->command("EXPN", @_)->response() == CMD_OK } +sub _HELP { shift->command("HELP", @_)->response() == CMD_OK } +sub _RSET { shift->command("RSET")->response() == CMD_OK } +sub _NOOP { shift->command("NOOP")->response() == CMD_OK } +sub _QUIT { shift->command("QUIT")->response() == CMD_OK } +sub _DATA { shift->command("DATA")->response() == CMD_MORE } +sub _BDAT { shift->command("BDAT", @_) } +sub _TURN { shift->unsupported(@_); } +sub _ETRN { shift->command("ETRN", @_)->response() == CMD_OK } +sub _AUTH { shift->command("AUTH", @_)->response() == CMD_OK } +sub _STARTTLS { shift->command("STARTTLS")->response() == CMD_OK } + + +{ + package Net::SMTP::_SSL; + our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::SMTP' ); + sub starttls { die "SMTP connection is already in SSL mode" } + sub start_SSL { + my ($class,$smtp,%arg) = @_; + delete @arg{ grep { !m{^SSL_} } keys %arg }; + ( $arg{SSL_verifycn_name} ||= $smtp->host ) + =~s{(?<!:):[\w()]+$}{}; # strip port + $arg{SSL_hostname} = $arg{SSL_verifycn_name} + if ! defined $arg{SSL_hostname} && $class->can_client_sni; + $arg{SSL_verifycn_scheme} ||= 'smtp'; + my $ok = $class->SUPER::start_SSL($smtp,%arg); + $@ = $ssl_class->errstr if !$ok; + return $ok; + } +} + + + +1; + +__END__ + +=head1 NAME + +Net::SMTP - Simple Mail Transfer Protocol Client + +=head1 SYNOPSIS + + use Net::SMTP; + + # Constructors + $smtp = Net::SMTP->new('mailhost'); + $smtp = Net::SMTP->new('mailhost', Timeout => 60); + +=head1 DESCRIPTION + +This module implements a client interface to the SMTP and ESMTP +protocol, enabling a perl5 application to talk to SMTP servers. This +documentation assumes that you are familiar with the concepts of the +SMTP protocol described in RFC2821. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. SMTPS or SMTP+STARTTLS. + +The Net::SMTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + +=head1 EXAMPLES + +This example prints the mail domain name of the SMTP server known as mailhost: + + #!/usr/local/bin/perl -w + + use Net::SMTP; + + $smtp = Net::SMTP->new('mailhost'); + print $smtp->domain,"\n"; + $smtp->quit; + +This example sends a small message to the postmaster at the SMTP server +known as mailhost: + + #!/usr/local/bin/perl -w + + use Net::SMTP; + + my $smtp = Net::SMTP->new('mailhost'); + + $smtp->mail($ENV{USER}); + if ($smtp->to('postmaster')) { + $smtp->data(); + $smtp->datasend("To: postmaster\n"); + $smtp->datasend("\n"); + $smtp->datasend("A simple test message\n"); + $smtp->dataend(); + } else { + print "Error: ", $smtp->message(); + } + + $smtp->quit; + +=head1 CONSTRUCTOR + +=over 4 + +=item new ( [ HOST ] [, OPTIONS ] ) + +This is the constructor for a new Net::SMTP object. C<HOST> is the +name of the remote host to which an SMTP connection is required. + +On failure C<undef> will be returned and C<$@> will contain the reason +for the failure. + +C<HOST> is optional. If C<HOST> is not given then it may instead be +passed as the C<Host> option described below. If neither is given then +the C<SMTP_Hosts> specified in C<Net::Config> will be used. + +C<OPTIONS> are passed in a hash like fashion, using key and value pairs. +Possible options are: + +B<Hello> - SMTP requires that you identify yourself. This option +specifies a string to pass as your mail domain. If not given localhost.localdomain +will be used. + +B<SendHello> - If false then the EHLO (or HELO) command that is normally sent +when constructing the object will not be sent. In that case the command will +have to be sent manually by calling C<hello()> instead. + +B<Host> - SMTP host to connect to. It may be a single scalar (hostname[:port]), +as defined for the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +an array with hosts to try in turn. The L</host> method will return the value +which was used to connect to the host. +Format - C<PeerHost> from L<IO::Socket::INET> new method. + +B<Port> - port to connect to. +Default - 25 for plain SMTP and 465 for immediate SSL. + +B<SSL> - If the connection should be done from start with SSL, contrary to later +upgrade with C<starttls>. +You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will +usually use the right arguments already. + +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a specific local address and port. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. + +B<Timeout> - Maximum time, in seconds, to wait for a response from the +SMTP server (default: 120) + +B<ExactAddresses> - If true the all ADDRESS arguments must be as +defined by C<addr-spec> in RFC2822. If not given, or false, then +Net::SMTP will attempt to extract the address from the value passed. + +B<Debug> - Enable debugging information + + +Example: + + + $smtp = Net::SMTP->new('mailhost', + Hello => 'my.mail.domain', + Timeout => 30, + Debug => 1, + ); + + # the same + $smtp = Net::SMTP->new( + Host => 'mailhost', + Hello => 'my.mail.domain', + Timeout => 30, + Debug => 1, + ); + + # the same with direct SSL + $smtp = Net::SMTP->new('mailhost', + Hello => 'my.mail.domain', + Timeout => 30, + Debug => 1, + SSL => 1, + ); + + # Connect to the default server from Net::config + $smtp = Net::SMTP->new( + Hello => 'my.mail.domain', + Timeout => 30, + ); + +=back + +=head1 METHODS + +Unless otherwise stated all methods return either a I<true> or I<false> +value, with I<true> meaning that the operation was a success. When a method +states that it returns a value, failure will be returned as I<undef> or an +empty list. + +C<Net::SMTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote SMTP server in addition to the methods +documented here. + +=over 4 + +=item banner () + +Returns the banner message which the server replied with when the +initial connection was made. + +=item domain () + +Returns the domain that the remote SMTP server identified itself as during +connection. + +=item hello ( DOMAIN ) + +Tell the remote server the mail domain which you are in using the EHLO +command (or HELO if EHLO fails). Since this method is invoked +automatically when the Net::SMTP object is constructed the user should +normally not have to call it manually. + +=item host () + +Returns the value used by the constructor, and passed to IO::Socket::INET, +to connect to the host. + +=item etrn ( DOMAIN ) + +Request a queue run for the DOMAIN given. + +=item starttls ( SSLARGS ) + +Upgrade existing plain connection to SSL. +You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will +usually use the right arguments already. + +=item auth ( USERNAME, PASSWORD ) + +=item auth ( SASL ) + +Attempt SASL authentication. Requires Authen::SASL module. The first form +constructs a new Authen::SASL object using the given username and password; +the second form uses the given Authen::SASL object. + +=item mail ( ADDRESS [, OPTIONS] ) + +=item send ( ADDRESS ) + +=item send_or_mail ( ADDRESS ) + +=item send_and_mail ( ADDRESS ) + +Send the appropriate command to the server MAIL, SEND, SOML or SAML. C<ADDRESS> +is the address of the sender. This initiates the sending of a message. The +method C<recipient> should be called for each address that the message is to +be sent to. + +The C<mail> method can some additional ESMTP OPTIONS which is passed +in hash like fashion, using key and value pairs. Possible options are: + + Size => <bytes> + Return => "FULL" | "HDRS" + Bits => "7" | "8" | "binary" + Transaction => <ADDRESS> + Envelope => <ENVID> # xtext-encodes its argument + ENVID => <ENVID> # similar to Envelope, but expects argument encoded + XVERP => 1 + AUTH => <submitter> # encoded address according to RFC 2554 + +The C<Return> and C<Envelope> parameters are used for DSN (Delivery +Status Notification). + +The submitter address in C<AUTH> option is expected to be in a format as +required by RFC 2554, in an RFC2821-quoted form and xtext-encoded, or <> . + +=item reset () + +Reset the status of the server. This may be called after a message has been +initiated, but before any data has been sent, to cancel the sending of the +message. + +=item recipient ( ADDRESS [, ADDRESS, [...]] [, OPTIONS ] ) + +Notify the server that the current message should be sent to all of the +addresses given. Each address is sent as a separate command to the server. +Should the sending of any address result in a failure then the process is +aborted and a I<false> value is returned. It is up to the user to call +C<reset> if they so desire. + +The C<recipient> method can also pass additional case-sensitive OPTIONS as an +anonymous hash using key and value pairs. Possible options are: + + Notify => ['NEVER'] or ['SUCCESS','FAILURE','DELAY'] (see below) + ORcpt => <ORCPT> + SkipBad => 1 (to ignore bad addresses) + +If C<SkipBad> is true the C<recipient> will not return an error when a bad +address is encountered and it will return an array of addresses that did +succeed. + + $smtp->recipient($recipient1,$recipient2); # Good + $smtp->recipient($recipient1,$recipient2, { SkipBad => 1 }); # Good + $smtp->recipient($recipient1,$recipient2, { Notify => ['FAILURE','DELAY'], SkipBad => 1 }); # Good + @goodrecips=$smtp->recipient(@recipients, { Notify => ['FAILURE'], SkipBad => 1 }); # Good + $smtp->recipient("$recipient,$recipient2"); # BAD + +Notify is used to request Delivery Status Notifications (DSNs), but your +SMTP/ESMTP service may not respect this request depending upon its version and +your site's SMTP configuration. + +Leaving out the Notify option usually defaults an SMTP service to its default +behavior equivalent to ['FAILURE'] notifications only, but again this may be +dependent upon your site's SMTP configuration. + +The NEVER keyword must appear by itself if used within the Notify option and "requests +that a DSN not be returned to the sender under any conditions." + + {Notify => ['NEVER']} + + $smtp->recipient(@recipients, { Notify => ['NEVER'], SkipBad => 1 }); # Good + +You may use any combination of these three values 'SUCCESS','FAILURE','DELAY' in +the anonymous array reference as defined by RFC3461 (see http://www.ietf.org/rfc/rfc3461.txt +for more information. Note: quotations in this topic from same.). + +A Notify parameter of 'SUCCESS' or 'FAILURE' "requests that a DSN be issued on +successful delivery or delivery failure, respectively." + +A Notify parameter of 'DELAY' "indicates the sender's willingness to receive +delayed DSNs. Delayed DSNs may be issued if delivery of a message has been +delayed for an unusual amount of time (as determined by the Message Transfer +Agent (MTA) at which the message is delayed), but the final delivery status +(whether successful or failure) cannot be determined. The absence of the DELAY +keyword in a NOTIFY parameter requests that a "delayed" DSN NOT be issued under +any conditions." + + {Notify => ['SUCCESS','FAILURE','DELAY']} + + $smtp->recipient(@recipients, { Notify => ['FAILURE','DELAY'], SkipBad => 1 }); # Good + +ORcpt is also part of the SMTP DSN extension according to RFC3461. +It is used to pass along the original recipient that the mail was first +sent to. The machine that generates a DSN will use this address to inform +the sender, because he can't know if recipients get rewritten by mail servers. +It is expected to be in a format as required by RFC3461, xtext-encoded. + +=item to ( ADDRESS [, ADDRESS [...]] ) + +=item cc ( ADDRESS [, ADDRESS [...]] ) + +=item bcc ( ADDRESS [, ADDRESS [...]] ) + +Synonyms for C<recipient>. + +=item data ( [ DATA ] ) + +Initiate the sending of the data from the current message. + +C<DATA> may be a reference to a list or a list and must be encoded by the +caller to octets of whatever encoding is required, e.g. by using the Encode +module's C<encode()> function. + +If specified the contents of C<DATA> and a termination string C<".\r\n"> is +sent to the server. The result will be true if the data was accepted. + +If C<DATA> is not specified then the result will indicate that the server +wishes the data to be sent. The data must then be sent using the C<datasend> +and C<dataend> methods described in L<Net::Cmd>. + +=item bdat ( DATA ) + +=item bdatlast ( DATA ) + +Use the alternate DATA command "BDAT" of the data chunking service extension +defined in RFC1830 for efficiently sending large MIME messages. + +=item expand ( ADDRESS ) + +Request the server to expand the given address Returns an array +which contains the text read from the server. + +=item verify ( ADDRESS ) + +Verify that C<ADDRESS> is a legitimate mailing address. + +Most sites usually disable this feature in their SMTP service configuration. +Use "Debug => 1" option under new() to see if disabled. + +=item help ( [ $subject ] ) + +Request help text from the server. Returns the text or undef upon failure + +=item quit () + +Send the QUIT command to the remote SMTP server and close the socket connection. + +=item can_inet6 () + +Returns whether we can use IPv6. + +=item can_ssl () + +Returns whether we can use SSL. + +=back + +=head1 ADDRESSES + +Net::SMTP attempts to DWIM with addresses that are passed. For +example an application might extract The From: line from an email +and pass that to mail(). While this may work, it is not recommended. +The application should really use a module like L<Mail::Address> +to extract the mail address and pass that. + +If C<ExactAddresses> is passed to the constructor, then addresses +should be a valid rfc2821-quoted address, although Net::SMTP will +accept the address surrounded by angle brackets. + + funny user@domain WRONG + "funny user"@domain RIGHT, recommended + <"funny user"@domain> OK + +=head1 SEE ALSO + +L<Net::Cmd>, +L<IO::Socket::SSL> + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-2004 Graham Barr. All rights reserved. + +Copyright (C) 2013-2016 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/Time.pm b/data/miniconda3/lib/perl5/core_perl/Net/Time.pm new file mode 100644 index 0000000000000000000000000000000000000000..d049408538fdc8eb0ff38ab3793071ed9c3d03f8 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/Time.pm @@ -0,0 +1,164 @@ +# Net::Time.pm +# +# Copyright (C) 1995-2004 Graham Barr. All rights reserved. +# Copyright (C) 2014 Steve Hay. All rights reserved. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. + +package Net::Time; + +use 5.008001; + +use strict; +use warnings; + +use Carp; +use Exporter; +use IO::Select; +use IO::Socket; +use Net::Config; + +our @ISA = qw(Exporter); +our @EXPORT_OK = qw(inet_time inet_daytime); + +our $VERSION = "3.11"; + +our $TIMEOUT = 120; + +sub _socket { + my ($pname, $pnum, $host, $proto, $timeout) = @_; + + $proto ||= 'udp'; + + my $port = (getservbyname($pname, $proto))[2] || $pnum; + + my $hosts = defined $host ? [$host] : $NetConfig{$pname . '_hosts'}; + + my $me; + + foreach my $addr (@$hosts) { + $me = IO::Socket::INET->new( + PeerAddr => $addr, + PeerPort => $port, + Proto => $proto + ) + and last; + } + + return unless $me; + + $me->send("\n") + if $proto eq 'udp'; + + $timeout = $TIMEOUT + unless defined $timeout; + + IO::Select->new($me)->can_read($timeout) + ? $me + : undef; +} + + +sub inet_time { + my $s = _socket('time', 37, @_) || return; + my $buf = ''; + my $offset = 0 | 0; + + return + unless defined $s->recv($buf, length(pack("N", 0))); + + # unpack, we | 0 to ensure we have an unsigned + my $time = (unpack("N", $buf))[0] | 0; + + # the time protocol return time in seconds since 1900, convert + # it to a the required format + + if ($^O eq "MacOS") { + + # MacOS return seconds since 1904, 1900 was not a leap year. + $offset = (4 * 31536000) | 0; + } + else { + + # otherwise return seconds since 1972, there were 17 leap years between + # 1900 and 1972 + $offset = (70 * 31536000 + 17 * 86400) | 0; + } + + $time - $offset; +} + + +sub inet_daytime { + my $s = _socket('daytime', 13, @_) || return; + my $buf = ''; + + defined($s->recv($buf, 1024)) + ? $buf + : undef; +} + +1; + +__END__ + +=head1 NAME + +Net::Time - time and daytime network client interface + +=head1 SYNOPSIS + + use Net::Time qw(inet_time inet_daytime); + + print inet_time(); # use default host from Net::Config + print inet_time('localhost'); + print inet_time('localhost', 'tcp'); + + print inet_daytime(); # use default host from Net::Config + print inet_daytime('localhost'); + print inet_daytime('localhost', 'tcp'); + +=head1 DESCRIPTION + +C<Net::Time> provides subroutines that obtain the time on a remote machine. + +=over 4 + +=item inet_time ( [HOST [, PROTOCOL [, TIMEOUT]]]) + +Obtain the time on C<HOST>, or some default host if C<HOST> is not given +or not defined, using the protocol as defined in RFC868. The optional +argument C<PROTOCOL> should define the protocol to use, either C<tcp> or +C<udp>. The result will be a time value in the same units as returned +by time() or I<undef> upon failure. + +=item inet_daytime ( [HOST [, PROTOCOL [, TIMEOUT]]]) + +Obtain the time on C<HOST>, or some default host if C<HOST> is not given +or not defined, using the protocol as defined in RFC867. The optional +argument C<PROTOCOL> should define the protocol to use, either C<tcp> or +C<udp>. The result will be an ASCII string or I<undef> upon failure. + +=back + +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt>. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head1 COPYRIGHT + +Copyright (C) 1995-2004 Graham Barr. All rights reserved. + +Copyright (C) 2014 Steve Hay. All rights reserved. + +=head1 LICENCE + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Net/hostent.pm b/data/miniconda3/lib/perl5/core_perl/Net/hostent.pm new file mode 100644 index 0000000000000000000000000000000000000000..8831919fb439c2bef6c91faa7764528de9362efa --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/hostent.pm @@ -0,0 +1,156 @@ +package Net::hostent; +use strict; + +use 5.006_001; +our $VERSION = '1.02'; +our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS); +our ( + $h_name, @h_aliases, + $h_addrtype, $h_length, + @h_addr_list, $h_addr +); + +BEGIN { + use Exporter (); + @EXPORT = qw(gethostbyname gethostbyaddr gethost); + @EXPORT_OK = qw( + $h_name @h_aliases + $h_addrtype $h_length + @h_addr_list $h_addr + ); + %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] ); +} + +# Class::Struct forbids use of @ISA +sub import { goto &Exporter::import } + +use Class::Struct qw(struct); +struct 'Net::hostent' => [ + name => '$', + aliases => '@', + addrtype => '$', + 'length' => '$', + addr_list => '@', +]; + +sub addr { shift->addr_list->[0] } + +sub populate (@) { + return unless @_; + my $hob = new(); + $h_name = $hob->[0] = $_[0]; + @h_aliases = @{ $hob->[1] } = split ' ', $_[1]; + $h_addrtype = $hob->[2] = $_[2]; + $h_length = $hob->[3] = $_[3]; + $h_addr = $_[4]; + @h_addr_list = @{ $hob->[4] } = @_[ (4 .. $#_) ]; + return $hob; +} + +sub gethostbyname ($) { populate(CORE::gethostbyname(shift)) } + +sub gethostbyaddr ($;$) { + my ($addr, $addrtype); + $addr = shift; + require Socket unless @_; + $addrtype = @_ ? shift : Socket::AF_INET(); + populate(CORE::gethostbyaddr($addr, $addrtype)) +} + +sub gethost($) { + if ($_[0] =~ /^\d+(?:\.\d+(?:\.\d+(?:\.\d+)?)?)?$/) { + require Socket; + &gethostbyaddr(Socket::inet_aton(shift)); + } else { + &gethostbyname; + } +} + +1; +__END__ + +=head1 NAME + +Net::hostent - by-name interface to Perl's built-in gethost*() functions + +=head1 SYNOPSIS + + use Net::hostent; + +=head1 DESCRIPTION + +This module's default exports override the core gethostbyname() and +gethostbyaddr() functions, replacing them with versions that return +"Net::hostent" objects. This object has methods that return the similarly +named structure field name from the C's hostent structure from F<netdb.h>; +namely name, aliases, addrtype, length, and addr_list. The aliases and +addr_list methods return array reference, the rest scalars. The addr +method is equivalent to the zeroth element in the addr_list array +reference. + +You may also import all the structure fields directly into your namespace +as regular variables using the :FIELDS import tag. (Note that this still +overrides your core functions.) Access these fields as variables named +with a preceding C<h_>. Thus, C<$host_obj-E<gt>name()> corresponds to +$h_name if you import the fields. Array references are available as +regular array variables, so for example C<@{ $host_obj-E<gt>aliases() +}> would be simply @h_aliases. + +The gethost() function is a simple front-end that forwards a numeric +argument to gethostbyaddr() by way of Socket::inet_aton, and the rest +to gethostbyname(). + +To access this functionality without the core overrides, +pass the C<use> an empty import list, and then access +function functions with their full qualified names. +On the other hand, the built-ins are still available +via the C<CORE::> pseudo-package. + +=head1 EXAMPLES + + use Net::hostent; + use Socket; + + @ARGV = ('netscape.com') unless @ARGV; + + for $host ( @ARGV ) { + + unless ($h = gethost($host)) { + warn "$0: no such host: $host\n"; + next; + } + + printf "\n%s is %s%s\n", + $host, + lc($h->name) eq lc($host) ? "" : "*really* ", + $h->name; + + print "\taliases are ", join(", ", @{$h->aliases}), "\n" + if @{$h->aliases}; + + if ( @{$h->addr_list} > 1 ) { + my $i; + for $addr ( @{$h->addr_list} ) { + printf "\taddr #%d is [%s]\n", $i++, inet_ntoa($addr); + } + } else { + printf "\taddress is [%s]\n", inet_ntoa($h->addr); + } + + if ($h = gethostbyaddr($h->addr)) { + if (lc($h->name) ne lc($host)) { + printf "\tThat addr reverses to host %s!\n", $h->name; + $host = $h->name; + redo; + } + } + } + +=head1 NOTE + +While this class is currently implemented using the Class::Struct +module to build a struct-like class, you shouldn't rely upon this. + +=head1 AUTHOR + +Tom Christiansen diff --git a/data/miniconda3/lib/perl5/core_perl/Net/libnetFAQ.pod b/data/miniconda3/lib/perl5/core_perl/Net/libnetFAQ.pod new file mode 100644 index 0000000000000000000000000000000000000000..bcc53479ba9b1d24c81d3561324994bc65c734a9 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/libnetFAQ.pod @@ -0,0 +1,301 @@ +=head1 NAME + +libnetFAQ - libnet Frequently Asked Questions + +=head1 DESCRIPTION + +=head2 Where to get this document + +This document is distributed with the libnet distribution, and is also +available on the libnet web page at + + http://search.cpan.org/dist/libnet/ + +=head2 How to contribute to this document + +You may report corrections, additions, and suggestions on the +CPAN Request Tracker at + + http://rt.cpan.org/Public/Bug/Report.html?Queue=libnet + +=head1 Author and Copyright Information + +Copyright (C) 1997-1998 Graham Barr. All rights reserved. +This document is free; you can redistribute it and/or modify it +under the terms of the Artistic License. + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02. + +=head2 Disclaimer + +This information is offered in good faith and in the hope that it may +be of use, but is not guaranteed to be correct, up to date, or suitable +for any particular purpose whatsoever. The authors accept no liability +in respect of this information or its use. + + +=head1 Obtaining and installing libnet + +=head2 What is libnet ? + +libnet is a collection of perl5 modules which all related to network +programming. The majority of the modules available provided the +client side of popular server-client protocols that are used in +the internet community. + +=head2 Which version of perl do I need ? + +This version of libnet requires Perl 5.8.1 or higher. + +=head2 What other modules do I need ? + +No non-core modules are required for normal use, except on os390, +which requires Convert::EBCDIC. + +Authen::SASL is required for AUTH support. + +IO::Socket::SSL version 2.007 or higher is required for SSL support. + +IO::Socket::IP version 0.25 or IO::Socket::INET6 version 2.62 is +required for IPv6 support. + +=head2 What machines support libnet ? + +libnet itself is an entirely perl-code distribution so it should work +on any machine that perl runs on. + +=head2 Where can I get the latest libnet release + +The latest libnet release is always on CPAN, you will find it +in + + http://search.cpan.org/dist/libnet/ + +=head1 Using Net::FTP + +=head2 How do I download files from an FTP server ? + +An example taken from an article posted to comp.lang.perl.misc + + #!/your/path/to/perl + + # a module making life easier + + use Net::FTP; + + # for debugging: $ftp = Net::FTP->new('site','Debug',10); + # open a connection and log in! + + $ftp = Net::FTP->new('target_site.somewhere.xxx'); + $ftp->login('username','password'); + + # set transfer mode to binary + + $ftp->binary(); + + # change the directory on the ftp site + + $ftp->cwd('/some/path/to/somewhere/'); + + foreach $name ('file1', 'file2', 'file3') { + + # get's arguments are in the following order: + # ftp server's filename + # filename to save the transfer to on the local machine + # can be simply used as get($name) if you want the same name + + $ftp->get($name,$name); + } + + # ftp done! + + $ftp->quit; + +=head2 How do I transfer files in binary mode ? + +To transfer files without <LF><CR> translation Net::FTP provides +the C<binary> method + + $ftp->binary; + +=head2 How can I get the size of a file on a remote FTP server ? + +=head2 How can I get the modification time of a file on a remote FTP server ? + +=head2 How can I change the permissions of a file on a remote server ? + +The FTP protocol does not have a command for changing the permissions +of a file on the remote server. But some ftp servers may allow a chmod +command to be issued via a SITE command, eg + + $ftp->quot('site chmod 0777',$filename); + +But this is not guaranteed to work. + +=head2 Can I do a reget operation like the ftp command ? + +=head2 How do I get a directory listing from an FTP server ? + +=head2 Changing directory to "" does not fail ? + +Passing an argument of "" to ->cwd() has the same affect of calling ->cwd() +without any arguments. Turn on Debug (I<See below>) and you will see what is +happening + + $ftp = Net::FTP->new($host, Debug => 1); + $ftp->login; + $ftp->cwd(""); + +gives + + Net::FTP=GLOB(0x82196d8)>>> CWD / + Net::FTP=GLOB(0x82196d8)<<< 250 CWD command successful. + +=head2 I am behind a SOCKS firewall, but the Firewall option does not work ? + +The Firewall option is only for support of one type of firewall. The type +supported is an ftp proxy. + +To use Net::FTP, or any other module in the libnet distribution, +through a SOCKS firewall you must create a socks-ified perl executable +by compiling perl with the socks library. + +=head2 I am behind an FTP proxy firewall, but cannot access machines outside ? + +Net::FTP implements the most popular ftp proxy firewall approach. The scheme +implemented is that where you log in to the firewall with C<user@hostname> + +I have heard of one other type of firewall which requires a login to the +firewall with an account, then a second login with C<user@hostname>. You can +still use Net::FTP to traverse these firewalls, but a more manual approach +must be taken, eg + + $ftp = Net::FTP->new($firewall) or die $@; + $ftp->login($firewall_user, $firewall_passwd) or die $ftp->message; + $ftp->login($ext_user . '@' . $ext_host, $ext_passwd) or die $ftp->message. + +=head2 My ftp proxy firewall does not listen on port 21 + +FTP servers usually listen on the same port number, port 21, as any other +FTP server. But there is no reason why this has to be the case. + +If you pass a port number to Net::FTP then it assumes this is the port +number of the final destination. By default Net::FTP will always try +to connect to the firewall on port 21. + +Net::FTP uses IO::Socket to open the connection and IO::Socket allows +the port number to be specified as part of the hostname. So this problem +can be resolved by either passing a Firewall option like C<"hostname:1234"> +or by setting the C<ftp_firewall> option in Net::Config to be a string +in the same form. + +=head2 Is it possible to change the file permissions of a file on an FTP server ? + +The answer to this is "maybe". The FTP protocol does not specify a command to change +file permissions on a remote host. However many servers do allow you to run the +chmod command via the C<SITE> command. This can be done with + + $ftp->site('chmod','0775',$file); + +=head2 I have seen scripts call a method message, but cannot find it documented ? + +Net::FTP, like several other packages in libnet, inherits from Net::Cmd, so +all the methods described in Net::Cmd are also available on Net::FTP +objects. + +=head2 Why does Net::FTP not implement mput and mget methods + +The quick answer is because they are easy to implement yourself. The long +answer is that to write these in such a way that multiple platforms are +supported correctly would just require too much code. Below are +some examples how you can implement these yourself. + +sub mput { + my($ftp,$pattern) = @_; + foreach my $file (glob($pattern)) { + $ftp->put($file) or warn $ftp->message; + } +} + +sub mget { + my($ftp,$pattern) = @_; + foreach my $file ($ftp->ls($pattern)) { + $ftp->get($file) or warn $ftp->message; + } +} + + +=head1 Using Net::SMTP + +=head2 Why can't the part of an Email address after the @ be used as the hostname ? + +The part of an Email address which follows the @ is not necessarily a hostname, +it is a mail domain. To find the name of a host to connect for a mail domain +you need to do a DNS MX lookup + +=head2 Why does Net::SMTP not do DNS MX lookups ? + +Net::SMTP implements the SMTP protocol. The DNS MX lookup is not part +of this protocol. + +=head2 The verify method always returns true ? + +Well it may seem that way, but it does not. The verify method returns true +if the command succeeded. If you pass verify an address which the +server would normally have to forward to another machine, the command +will succeed with something like + + 252 Couldn't verify <someone@there> but will attempt delivery anyway + +This command will fail only if you pass it an address in a domain +the server directly delivers for, and that address does not exist. + +=head1 Debugging scripts + +=head2 How can I debug my scripts that use Net::* modules ? + +Most of the libnet client classes allow options to be passed to the +constructor, in most cases one option is called C<Debug>. Passing +this option with a non-zero value will turn on a protocol trace, which +will be sent to STDERR. This trace can be useful to see what commands +are being sent to the remote server and what responses are being +received back. + + #!/your/path/to/perl + + use Net::FTP; + + my $ftp = new Net::FTP($host, Debug => 1); + $ftp->login('gbarr','password'); + $ftp->quit; + +this script would output something like + + Net::FTP: Net::FTP(2.22) + Net::FTP: Exporter + Net::FTP: Net::Cmd(2.0801) + Net::FTP: IO::Socket::INET + Net::FTP: IO::Socket(1.1603) + Net::FTP: IO::Handle(1.1504) + + Net::FTP=GLOB(0x8152974)<<< 220 imagine FTP server (Version wu-2.4(5) Tue Jul 29 11:17:18 CDT 1997) ready. + Net::FTP=GLOB(0x8152974)>>> user gbarr + Net::FTP=GLOB(0x8152974)<<< 331 Password required for gbarr. + Net::FTP=GLOB(0x8152974)>>> PASS .... + Net::FTP=GLOB(0x8152974)<<< 230 User gbarr logged in. Access restrictions apply. + Net::FTP=GLOB(0x8152974)>>> QUIT + Net::FTP=GLOB(0x8152974)<<< 221 Goodbye. + +The first few lines tell you the modules that Net::FTP uses and their versions, +this is useful data to me when a user reports a bug. The last seven lines +show the communication with the server. Each line has three parts. The first +part is the object itself, this is useful for separating the output +if you are using multiple objects. The second part is either C<<<<<> to +show data coming from the server or C<>>>>> to show data +going to the server. The remainder of the line is the command +being sent or response being received. + +=head1 AUTHOR AND COPYRIGHT + +Copyright (C) 1997-1998 Graham Barr. All rights reserved. diff --git a/data/miniconda3/lib/perl5/core_perl/Net/netent.pm b/data/miniconda3/lib/perl5/core_perl/Net/netent.pm new file mode 100644 index 0000000000000000000000000000000000000000..b21c5d11b8603ad720652fc1e60e9907782d45d4 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/netent.pm @@ -0,0 +1,173 @@ +package Net::netent; +use strict; + +use 5.006_001; +our $VERSION = '1.01'; +our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS); +our ( + $n_name, @n_aliases, + $n_addrtype, $n_net +); + +BEGIN { + use Exporter (); + @EXPORT = qw(getnetbyname getnetbyaddr getnet); + @EXPORT_OK = qw( + $n_name @n_aliases + $n_addrtype $n_net + ); + %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] ); +} + +# Class::Struct forbids use of @ISA +sub import { goto &Exporter::import } + +use Class::Struct qw(struct); +struct 'Net::netent' => [ + name => '$', + aliases => '@', + addrtype => '$', + net => '$', +]; + +sub populate (@) { + return unless @_; + my $nob = new(); + $n_name = $nob->[0] = $_[0]; + @n_aliases = @{ $nob->[1] } = split ' ', $_[1]; + $n_addrtype = $nob->[2] = $_[2]; + $n_net = $nob->[3] = $_[3]; + return $nob; +} + +sub getnetbyname ($) { populate(CORE::getnetbyname(shift)) } + +sub getnetbyaddr ($;$) { + my ($net, $addrtype); + $net = shift; + require Socket if @_; + $addrtype = @_ ? shift : Socket::AF_INET(); + populate(CORE::getnetbyaddr($net, $addrtype)) +} + +sub getnet($) { + if ($_[0] =~ /^\d+(?:\.\d+(?:\.\d+(?:\.\d+)?)?)?$/) { + require Socket; + &getnetbyaddr(Socket::inet_aton(shift)); + } else { + &getnetbyname; + } +} + +1; +__END__ + +=head1 NAME + +Net::netent - by-name interface to Perl's built-in getnet*() functions + +=head1 SYNOPSIS + + use Net::netent qw(:FIELDS); + getnetbyname("loopback") or die "bad net"; + printf "%s is %08X\n", $n_name, $n_net; + + use Net::netent; + + $n = getnetbyname("loopback") or die "bad net"; + { # there's gotta be a better way, eh? + @bytes = unpack("C4", pack("N", $n->net)); + shift @bytes while @bytes && $bytes[0] == 0; + } + printf "%s is %08X [%d.%d.%d.%d]\n", $n->name, $n->net, @bytes; + +=head1 DESCRIPTION + +This module's default exports override the core getnetbyname() and +getnetbyaddr() functions, replacing them with versions that return +"Net::netent" objects. This object has methods that return the similarly +named structure field name from the C's netent structure from F<netdb.h>; +namely name, aliases, addrtype, and net. The aliases +method returns an array reference, the rest scalars. + +You may also import all the structure fields directly into your namespace +as regular variables using the :FIELDS import tag. (Note that this still +overrides your core functions.) Access these fields as variables named +with a preceding C<n_>. Thus, C<$net_obj-E<gt>name()> corresponds to +$n_name if you import the fields. Array references are available as +regular array variables, so for example C<@{ $net_obj-E<gt>aliases() +}> would be simply @n_aliases. + +The getnet() function is a simple front-end that forwards a numeric +argument to getnetbyaddr(), and the rest +to getnetbyname(). + +To access this functionality without the core overrides, +pass the C<use> an empty import list, and then access +function functions with their full qualified names. +On the other hand, the built-ins are still available +via the C<CORE::> pseudo-package. + +=head1 EXAMPLES + +The getnet() functions do this in the Perl core: + + sv_setiv(sv, (I32)nent->n_net); + +The gethost() functions do this in the Perl core: + + sv_setpvn(sv, hent->h_addr, len); + +That means that the address comes back in binary for the +host functions, and as a regular perl integer for the net ones. +This seems a bug, but here's how to deal with it: + + use strict; + use Socket; + use Net::netent; + + @ARGV = ('loopback') unless @ARGV; + + my($n, $net); + + for $net ( @ARGV ) { + + unless ($n = getnetbyname($net)) { + warn "$0: no such net: $net\n"; + next; + } + + printf "\n%s is %s%s\n", + $net, + lc($n->name) eq lc($net) ? "" : "*really* ", + $n->name; + + print "\taliases are ", join(", ", @{$n->aliases}), "\n" + if @{$n->aliases}; + + # this is stupid; first, why is this not in binary? + # second, why am i going through these convolutions + # to make it looks right + { + my @a = unpack("C4", pack("N", $n->net)); + shift @a while @a && $a[0] == 0; + printf "\taddr is %s [%d.%d.%d.%d]\n", $n->net, @a; + } + + if ($n = getnetbyaddr($n->net)) { + if (lc($n->name) ne lc($net)) { + printf "\tThat addr reverses to net %s!\n", $n->name; + $net = $n->name; + redo; + } + } + } + +=head1 NOTE + +While this class is currently implemented using the Class::Struct +module to build a struct-like class, you shouldn't rely upon this. + +=head1 AUTHOR + +Tom Christiansen diff --git a/data/miniconda3/lib/perl5/core_perl/Net/protoent.pm b/data/miniconda3/lib/perl5/core_perl/Net/protoent.pm new file mode 100644 index 0000000000000000000000000000000000000000..cef20fbd0b0a2d765732fb743ae0566538a79dbf --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/protoent.pm @@ -0,0 +1,96 @@ +package Net::protoent; +use strict; + +use 5.006_001; +our $VERSION = '1.01'; +our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS); +our ( $p_name, @p_aliases, $p_proto ); +BEGIN { + use Exporter (); + @EXPORT = qw(getprotobyname getprotobynumber getprotoent getproto); + @EXPORT_OK = qw( $p_name @p_aliases $p_proto ); + %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] ); +} + +# Class::Struct forbids use of @ISA +sub import { goto &Exporter::import } + +use Class::Struct qw(struct); +struct 'Net::protoent' => [ + name => '$', + aliases => '@', + proto => '$', +]; + +sub populate (@) { + return unless @_; + my $pob = new(); + $p_name = $pob->[0] = $_[0]; + @p_aliases = @{ $pob->[1] } = split ' ', $_[1]; + $p_proto = $pob->[2] = $_[2]; + return $pob; +} + +sub getprotoent ( ) { populate(CORE::getprotoent()) } +sub getprotobyname ($) { populate(CORE::getprotobyname(shift)) } +sub getprotobynumber ($) { populate(CORE::getprotobynumber(shift)) } + +sub getproto ($;$) { + no strict 'refs'; + return &{'getprotoby' . ($_[0]=~/^\d+$/ ? 'number' : 'name')}(@_); +} + +1; + +__END__ + +=head1 NAME + +Net::protoent - by-name interface to Perl's built-in getproto*() functions + +=head1 SYNOPSIS + + use Net::protoent; + $p = getprotobyname(shift || 'tcp') || die "no proto"; + printf "proto for %s is %d, aliases are %s\n", + $p->name, $p->proto, "@{$p->aliases}"; + + use Net::protoent qw(:FIELDS); + getprotobyname(shift || 'tcp') || die "no proto"; + print "proto for $p_name is $p_proto, aliases are @p_aliases\n"; + +=head1 DESCRIPTION + +This module's default exports override the core getprotoent(), +getprotobyname(), and getnetbyport() functions, replacing them with +versions that return "Net::protoent" objects. They take default +second arguments of "tcp". This object has methods that return the +similarly named structure field name from the C's protoent structure +from F<netdb.h>; namely name, aliases, and proto. The aliases method +returns an array reference, the rest scalars. + +You may also import all the structure fields directly into your namespace +as regular variables using the :FIELDS import tag. (Note that this still +overrides your core functions.) Access these fields as variables named +with a preceding C<p_>. Thus, C<$proto_obj-E<gt>name()> corresponds to +$p_name if you import the fields. Array references are available as +regular array variables, so for example C<@{ $proto_obj-E<gt>aliases() +}> would be simply @p_aliases. + +The getproto() function is a simple front-end that forwards a numeric +argument to getprotobyport(), and the rest to getprotobyname(). + +To access this functionality without the core overrides, +pass the C<use> an empty import list, and then access +function functions with their full qualified names. +On the other hand, the built-ins are still available +via the C<CORE::> pseudo-package. + +=head1 NOTE + +While this class is currently implemented using the Class::Struct +module to build a struct-like class, you shouldn't rely upon this. + +=head1 AUTHOR + +Tom Christiansen diff --git a/data/miniconda3/lib/perl5/core_perl/Net/servent.pm b/data/miniconda3/lib/perl5/core_perl/Net/servent.pm new file mode 100644 index 0000000000000000000000000000000000000000..a3b2bad2c2b18301d6dbbbd59494d56254081848 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Net/servent.pm @@ -0,0 +1,113 @@ +package Net::servent; +use strict; + +use 5.006_001; +our $VERSION = '1.02'; +our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS); +our ( $s_name, @s_aliases, $s_port, $s_proto ); +BEGIN { + use Exporter (); + @EXPORT = qw(getservbyname getservbyport getservent getserv); + @EXPORT_OK = qw( $s_name @s_aliases $s_port $s_proto ); + %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] ); +} + +# Class::Struct forbids use of @ISA +sub import { goto &Exporter::import } + +use Class::Struct qw(struct); +struct 'Net::servent' => [ + name => '$', + aliases => '@', + port => '$', + proto => '$', +]; + +sub populate (@) { + return unless @_; + my $sob = new(); + $s_name = $sob->[0] = $_[0]; + @s_aliases = @{ $sob->[1] } = split ' ', $_[1]; + $s_port = $sob->[2] = $_[2]; + $s_proto = $sob->[3] = $_[3]; + return $sob; +} + +sub getservent ( ) { populate(CORE::getservent()) } +sub getservbyname ($;$) { populate(CORE::getservbyname(shift,shift||'tcp')) } +sub getservbyport ($;$) { populate(CORE::getservbyport(shift,shift||'tcp')) } + +sub getserv ($;$) { + no strict 'refs'; + return &{'getservby' . ($_[0]=~/^\d+$/ ? 'port' : 'name')}(@_); +} + +1; + +__END__ + +=head1 NAME + +Net::servent - by-name interface to Perl's built-in getserv*() functions + +=head1 SYNOPSIS + + use Net::servent; + $s = getservbyname(shift || 'ftp') || die "no service"; + printf "port for %s is %s, aliases are %s\n", + $s->name, $s->port, "@{$s->aliases}"; + + use Net::servent qw(:FIELDS); + getservbyname(shift || 'ftp') || die "no service"; + print "port for $s_name is $s_port, aliases are @s_aliases\n"; + +=head1 DESCRIPTION + +This module's default exports override the core getservent(), +getservbyname(), and +getnetbyport() functions, replacing them with versions that return +"Net::servent" objects. They take default second arguments of "tcp". This object has methods that return the similarly +named structure field name from the C's servent structure from F<netdb.h>; +namely name, aliases, port, and proto. The aliases +method returns an array reference, the rest scalars. + +You may also import all the structure fields directly into your namespace +as regular variables using the :FIELDS import tag. (Note that this still +overrides your core functions.) Access these fields as variables named +with a preceding C<s_>. Thus, C<$serv_obj-E<gt>name()> corresponds to +$s_name if you import the fields. Array references are available as +regular array variables, so for example C<@{ $serv_obj-E<gt>aliases()}> +would be simply @s_aliases. + +The getserv() function is a simple front-end that forwards a numeric +argument to getservbyport(), and the rest to getservbyname(). + +To access this functionality without the core overrides, +pass the C<use> an empty import list, and then access +function functions with their full qualified names. +On the other hand, the built-ins are still available +via the C<CORE::> pseudo-package. + +=head1 EXAMPLES + + use Net::servent qw(:FIELDS); + + while (@ARGV) { + my ($service, $proto) = ((split m!/!, shift), 'tcp'); + my $valet = getserv($service, $proto); + unless ($valet) { + warn "$0: No service: $service/$proto\n" + next; + } + printf "service $service/$proto is port %d\n", $valet->port; + print "alias are @s_aliases\n" if @s_aliases; + } + +=head1 NOTE + +While this class is currently implemented using the Class::Struct +module to build a struct-like class, you shouldn't rely upon this. + +=head1 AUTHOR + +Tom Christiansen diff --git a/data/miniconda3/lib/perl5/core_perl/Params/Check.pm b/data/miniconda3/lib/perl5/core_perl/Params/Check.pm new file mode 100644 index 0000000000000000000000000000000000000000..12394421d641fd41948407efc799a1afdd9d26d2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Params/Check.pm @@ -0,0 +1,695 @@ +package Params::Check; + +use strict; + +use Carp qw[carp croak]; +use Locale::Maketext::Simple Style => 'gettext'; + +BEGIN { + use Exporter (); + use vars qw[ @ISA $VERSION @EXPORT_OK $VERBOSE $ALLOW_UNKNOWN + $STRICT_TYPE $STRIP_LEADING_DASHES $NO_DUPLICATES + $PRESERVE_CASE $ONLY_ALLOW_DEFINED $WARNINGS_FATAL + $SANITY_CHECK_TEMPLATE $CALLER_DEPTH $_ERROR_STRING + ]; + + @ISA = qw[ Exporter ]; + @EXPORT_OK = qw[check allow last_error]; + + $VERSION = '0.38'; + $VERBOSE = $^W ? 1 : 0; + $NO_DUPLICATES = 0; + $STRIP_LEADING_DASHES = 0; + $STRICT_TYPE = 0; + $ALLOW_UNKNOWN = 0; + $PRESERVE_CASE = 0; + $ONLY_ALLOW_DEFINED = 0; + $SANITY_CHECK_TEMPLATE = 1; + $WARNINGS_FATAL = 0; + $CALLER_DEPTH = 0; +} + +my %known_keys = map { $_ => 1 } + qw| required allow default strict_type no_override + store defined |; + +=pod + +=head1 NAME + +Params::Check - A generic input parsing/checking mechanism. + +=head1 SYNOPSIS + + use Params::Check qw[check allow last_error]; + + sub fill_personal_info { + my %hash = @_; + my $x; + + my $tmpl = { + firstname => { required => 1, defined => 1 }, + lastname => { required => 1, store => \$x }, + gender => { required => 1, + allow => [qr/M/i, qr/F/i], + }, + married => { allow => [0,1] }, + age => { default => 21, + allow => qr/^\d+$/, + }, + + phone => { allow => [ sub { return 1 if /$valid_re/ }, + '1-800-PERL' ] + }, + id_list => { default => [], + strict_type => 1 + }, + employer => { default => 'NSA', no_override => 1 }, + }; + + ### check() returns a hashref of parsed args on success ### + my $parsed_args = check( $tmpl, \%hash, $VERBOSE ) + or die qw[Could not parse arguments!]; + + ... other code here ... + } + + my $ok = allow( $colour, [qw|blue green yellow|] ); + + my $error = Params::Check::last_error(); + + +=head1 DESCRIPTION + +Params::Check is a generic input parsing/checking mechanism. + +It allows you to validate input via a template. The only requirement +is that the arguments must be named. + +Params::Check can do the following things for you: + +=over 4 + +=item * + +Convert all keys to lowercase + +=item * + +Check if all required arguments have been provided + +=item * + +Set arguments that have not been provided to the default + +=item * + +Weed out arguments that are not supported and warn about them to the +user + +=item * + +Validate the arguments given by the user based on strings, regexes, +lists or even subroutines + +=item * + +Enforce type integrity if required + +=back + +Most of Params::Check's power comes from its template, which we'll +discuss below: + +=head1 Template + +As you can see in the synopsis, based on your template, the arguments +provided will be validated. + +The template can take a different set of rules per key that is used. + +The following rules are available: + +=over 4 + +=item default + +This is the default value if none was provided by the user. +This is also the type C<strict_type> will look at when checking type +integrity (see below). + +=item required + +A boolean flag that indicates if this argument was a required +argument. If marked as required and not provided, check() will fail. + +=item strict_type + +This does a C<ref()> check on the argument provided. The C<ref> of the +argument must be the same as the C<ref> of the default value for this +check to pass. + +This is very useful if you insist on taking an array reference as +argument for example. + +=item defined + +If this template key is true, enforces that if this key is provided by +user input, its value is C<defined>. This just means that the user is +not allowed to pass C<undef> as a value for this key and is equivalent +to: + allow => sub { defined $_[0] && OTHER TESTS } + +=item no_override + +This allows you to specify C<constants> in your template. ie, they +keys that are not allowed to be altered by the user. It pretty much +allows you to keep all your C<configurable> data in one place; the +C<Params::Check> template. + +=item store + +This allows you to pass a reference to a scalar, in which the data +will be stored: + + my $x; + my $args = check(foo => { default => 1, store => \$x }, $input); + +This is basically shorthand for saying: + + my $args = check( { foo => { default => 1 }, $input ); + my $x = $args->{foo}; + +You can alter the global variable $Params::Check::NO_DUPLICATES to +control whether the C<store>'d key will still be present in your +result set. See the L<Global Variables> section below. + +=item allow + +A set of criteria used to validate a particular piece of data if it +has to adhere to particular rules. + +See the C<allow()> function for details. + +=back + +=head1 Functions + +=head2 check( \%tmpl, \%args, [$verbose] ); + +This function is not exported by default, so you'll have to ask for it +via: + + use Params::Check qw[check]; + +or use its fully qualified name instead. + +C<check> takes a list of arguments, as follows: + +=over 4 + +=item Template + +This is a hash reference which contains a template as explained in the +C<SYNOPSIS> and C<Template> section. + +=item Arguments + +This is a reference to a hash of named arguments which need checking. + +=item Verbose + +A boolean to indicate whether C<check> should be verbose and warn +about what went wrong in a check or not. + +You can enable this program wide by setting the package variable +C<$Params::Check::VERBOSE> to a true value. For details, see the +section on C<Global Variables> below. + +=back + +C<check> will return when it fails, or a hashref with lowercase +keys of parsed arguments when it succeeds. + +So a typical call to check would look like this: + + my $parsed = check( \%template, \%arguments, $VERBOSE ) + or warn q[Arguments could not be parsed!]; + +A lot of the behaviour of C<check()> can be altered by setting +package variables. See the section on C<Global Variables> for details +on this. + +=cut + +sub check { + my ($utmpl, $href, $verbose) = @_; + + ### clear the current error string ### + _clear_error(); + + ### did we get the arguments we need? ### + if ( !$utmpl or !$href ) { + _store_error(loc('check() expects two arguments')); + return unless $WARNINGS_FATAL; + croak(__PACKAGE__->last_error); + } + + ### sensible defaults ### + $verbose ||= $VERBOSE || 0; + + ### XXX what type of template is it? ### + ### { key => { } } ? + #if (ref $args eq 'HASH') { + # 1; + #} + + ### clean up the template ### + my $args; + + ### don't even bother to loop, if there's nothing to clean up ### + if( $PRESERVE_CASE and !$STRIP_LEADING_DASHES ) { + $args = $href; + } else { + ### keys are not aliased ### + for my $key (keys %$href) { + my $org = $key; + $key = lc $key unless $PRESERVE_CASE; + $key =~ s/^-// if $STRIP_LEADING_DASHES; + $args->{$key} = $href->{$org}; + } + } + + my %defs; + + ### which template entries have a 'store' member + my @want_store; + + ### sanity check + defaults + required keys set? ### + my $fail; + for my $key (keys %$utmpl) { + my $tmpl = $utmpl->{$key}; + + ### check if required keys are provided + ### keys are now lower cased, unless preserve case was enabled + ### at which point, the utmpl keys must match, but that's the users + ### problem. + if( $tmpl->{'required'} and not exists $args->{$key} ) { + _store_error( + loc(q|Required option '%1' is not provided for %2 by %3|, + $key, _who_was_it(), _who_was_it(1)), $verbose ); + + ### mark the error ### + $fail++; + next; + } + + ### next, set the default, make sure the key exists in %defs ### + $defs{$key} = $tmpl->{'default'} + if exists $tmpl->{'default'}; + + if( $SANITY_CHECK_TEMPLATE ) { + ### last, check if they provided any weird template keys + ### -- do this last so we don't always execute this code. + ### just a small optimization. + map { _store_error( + loc(q|Template type '%1' not supported [at key '%2']|, + $_, $key), 1, 0 ); + } grep { + not $known_keys{$_} + } keys %$tmpl; + + ### make sure you passed a ref, otherwise, complain about it! + if ( exists $tmpl->{'store'} ) { + _store_error( loc( + q|Store variable for '%1' is not a reference!|, $key + ), 1, 0 ) unless ref $tmpl->{'store'}; + } + } + + push @want_store, $key if $tmpl->{'store'}; + } + + ### errors found ### + return if $fail; + + ### flag to see if anything went wrong ### + my $wrong; + + ### flag to see if we warned for anything, needed for warnings_fatal + my $warned; + + for my $key (keys %$args) { + my $arg = $args->{$key}; + + ### you gave us this key, but it's not in the template ### + unless( $utmpl->{$key} ) { + + ### but we'll allow it anyway ### + if( $ALLOW_UNKNOWN ) { + $defs{$key} = $arg; + + ### warn about the error ### + } else { + _store_error( + loc("Key '%1' is not a valid key for %2 provided by %3", + $key, _who_was_it(), _who_was_it(1)), $verbose); + $warned ||= 1; + } + next; + } + + ### copy of this keys template instructions, to save derefs ### + my %tmpl = %{$utmpl->{$key}}; + + ### check if you're even allowed to override this key ### + if( $tmpl{'no_override'} ) { + _store_error( + loc(q[You are not allowed to override key '%1']. + q[for %2 from %3], $key, _who_was_it(), _who_was_it(1)), + $verbose + ); + $warned ||= 1; + next; + } + + ### check if you were supposed to provide defined() values ### + if( ($tmpl{'defined'} || $ONLY_ALLOW_DEFINED) and not defined $arg ) { + _store_error(loc(q|Key '%1' must be defined when passed|, $key), + $verbose ); + $wrong ||= 1; + next; + } + + ### check if they should be of a strict type, and if it is ### + if( ($tmpl{'strict_type'} || $STRICT_TYPE) and + (ref $arg ne ref $tmpl{'default'}) + ) { + _store_error(loc(q|Key '%1' needs to be of type '%2'|, + $key, ref $tmpl{'default'} || 'SCALAR'), $verbose ); + $wrong ||= 1; + next; + } + + ### check if we have an allow handler, to validate against ### + ### allow() will report its own errors ### + if( exists $tmpl{'allow'} and not do { + local $_ERROR_STRING; + allow( $arg, $tmpl{'allow'} ) + } + ) { + ### stringify the value in the error report -- we don't want dumps + ### of objects, but we do want to see *roughly* what we passed + _store_error(loc(q|Key '%1' (%2) is of invalid type for '%3' |. + q|provided by %4|, + $key, "$arg", _who_was_it(), + _who_was_it(1)), $verbose); + $wrong ||= 1; + next; + } + + ### we got here, then all must be OK ### + $defs{$key} = $arg; + + } + + ### croak with the collected errors if there were errors and + ### we have the fatal flag toggled. + croak(__PACKAGE__->last_error) if ($wrong || $warned) && $WARNINGS_FATAL; + + ### done with our loop... if $wrong is set, something went wrong + ### and the user is already informed, just return... + return if $wrong; + + ### check if we need to store any of the keys ### + ### can't do it before, because something may go wrong later, + ### leaving the user with a few set variables + for my $key (@want_store) { + next unless exists $defs{$key}; + my $ref = $utmpl->{$key}{'store'}; + $$ref = $NO_DUPLICATES ? delete $defs{$key} : $defs{$key}; + } + + return \%defs; +} + +=head2 allow( $test_me, \@criteria ); + +The function that handles the C<allow> key in the template is also +available for independent use. + +The function takes as first argument a key to test against, and +as second argument any form of criteria that are also allowed by +the C<allow> key in the template. + +You can use the following types of values for allow: + +=over 4 + +=item string + +The provided argument MUST be equal to the string for the validation +to pass. + +=item regexp + +The provided argument MUST match the regular expression for the +validation to pass. + +=item subroutine + +The provided subroutine MUST return true in order for the validation +to pass and the argument accepted. + +(This is particularly useful for more complicated data). + +=item array ref + +The provided argument MUST equal one of the elements of the array +ref for the validation to pass. An array ref can hold all the above +values. + +=back + +It returns true if the key matched the criteria, or false otherwise. + +=cut + +sub allow { + ### use $_[0] and $_[1] since this is hot code... ### + #my ($val, $ref) = @_; + + ### it's a regexp ### + if( ref $_[1] eq 'Regexp' ) { + local $^W; # silence warnings if $val is undef # + return if $_[0] !~ /$_[1]/; + + ### it's a sub ### + } elsif ( ref $_[1] eq 'CODE' ) { + return unless $_[1]->( $_[0] ); + + ### it's an array ### + } elsif ( ref $_[1] eq 'ARRAY' ) { + + ### loop over the elements, see if one of them says the + ### value is OK + ### also, short-circuit when possible + for ( @{$_[1]} ) { + return 1 if allow( $_[0], $_ ); + } + + return; + + ### fall back to a simple, but safe 'eq' ### + } else { + return unless _safe_eq( $_[0], $_[1] ); + } + + ### we got here, no failures ### + return 1; +} + +### helper functions ### + +sub _safe_eq { + ### only do a straight 'eq' if they're both defined ### + return defined($_[0]) && defined($_[1]) + ? $_[0] eq $_[1] + : defined($_[0]) eq defined($_[1]); +} + +sub _who_was_it { + my $level = $_[0] || 0; + + return (caller(2 + $CALLER_DEPTH + $level))[3] || 'ANON' +} + +=head2 last_error() + +Returns a string containing all warnings and errors reported during +the last time C<check> was called. + +This is useful if you want to report then some other way than +C<carp>'ing when the verbose flag is on. + +It is exported upon request. + +=cut + +{ $_ERROR_STRING = ''; + + sub _store_error { + my($err, $verbose, $offset) = @_[0..2]; + $verbose ||= 0; + $offset ||= 0; + my $level = 1 + $offset; + + local $Carp::CarpLevel = $level; + + carp $err if $verbose; + + $_ERROR_STRING .= $err . "\n"; + } + + sub _clear_error { + $_ERROR_STRING = ''; + } + + sub last_error { $_ERROR_STRING } +} + +1; + +=head1 Global Variables + +The behaviour of Params::Check can be altered by changing the +following global variables: + +=head2 $Params::Check::VERBOSE + +This controls whether Params::Check will issue warnings and +explanations as to why certain things may have failed. +If you set it to 0, Params::Check will not output any warnings. + +The default is 1 when L<warnings> are enabled, 0 otherwise; + +=head2 $Params::Check::STRICT_TYPE + +This works like the C<strict_type> option you can pass to C<check>, +which will turn on C<strict_type> globally for all calls to C<check>. + +The default is 0; + +=head2 $Params::Check::ALLOW_UNKNOWN + +If you set this flag, unknown options will still be present in the +return value, rather than filtered out. This is useful if your +subroutine is only interested in a few arguments, and wants to pass +the rest on blindly to perhaps another subroutine. + +The default is 0; + +=head2 $Params::Check::STRIP_LEADING_DASHES + +If you set this flag, all keys passed in the following manner: + + function( -key => 'val' ); + +will have their leading dashes stripped. + +=head2 $Params::Check::NO_DUPLICATES + +If set to true, all keys in the template that are marked as to be +stored in a scalar, will also be removed from the result set. + +Default is false, meaning that when you use C<store> as a template +key, C<check> will put it both in the scalar you supplied, as well as +in the hashref it returns. + +=head2 $Params::Check::PRESERVE_CASE + +If set to true, L<Params::Check> will no longer convert all keys from +the user input to lowercase, but instead expect them to be in the +case the template provided. This is useful when you want to use +similar keys with different casing in your templates. + +Understand that this removes the case-insensitivity feature of this +module. + +Default is 0; + +=head2 $Params::Check::ONLY_ALLOW_DEFINED + +If set to true, L<Params::Check> will require all values passed to be +C<defined>. If you wish to enable this on a 'per key' basis, use the +template option C<defined> instead. + +Default is 0; + +=head2 $Params::Check::SANITY_CHECK_TEMPLATE + +If set to true, L<Params::Check> will sanity check templates, validating +for errors and unknown keys. Although very useful for debugging, this +can be somewhat slow in hot-code and large loops. + +To disable this check, set this variable to C<false>. + +Default is 1; + +=head2 $Params::Check::WARNINGS_FATAL + +If set to true, L<Params::Check> will C<croak> when an error during +template validation occurs, rather than return C<false>. + +Default is 0; + +=head2 $Params::Check::CALLER_DEPTH + +This global modifies the argument given to C<caller()> by +C<Params::Check::check()> and is useful if you have a custom wrapper +function around C<Params::Check::check()>. The value must be an +integer, indicating the number of wrapper functions inserted between +the real function call and C<Params::Check::check()>. + +Example wrapper function, using a custom stacktrace: + + sub check { + my ($template, $args_in) = @_; + + local $Params::Check::WARNINGS_FATAL = 1; + local $Params::Check::CALLER_DEPTH = $Params::Check::CALLER_DEPTH + 1; + my $args_out = Params::Check::check($template, $args_in); + + my_stacktrace(Params::Check::last_error) unless $args_out; + + return $args_out; + } + +Default is 0; + +=head1 Acknowledgements + +Thanks to Richard Soderberg for his performance improvements. + +=head1 BUG REPORTS + +Please report bugs or other issues to E<lt>bug-params-check@rt.cpan.orgE<gt>. + +=head1 AUTHOR + +This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. + +=head1 COPYRIGHT + +This library is free software; you may redistribute and/or modify it +under the same terms as Perl itself. + + +=cut + +# Local variables: +# c-indentation-style: bsd +# c-basic-offset: 4 +# indent-tabs-mode: nil +# End: +# vim: expandtab shiftwidth=4: diff --git a/data/miniconda3/lib/perl5/core_perl/Perl/OSType.pm b/data/miniconda3/lib/perl5/core_perl/Perl/OSType.pm new file mode 100644 index 0000000000000000000000000000000000000000..a72dd024b57fd14d27ef59b36f006c46a63648e2 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Perl/OSType.pm @@ -0,0 +1,225 @@ +use strict; +use warnings; + +package Perl::OSType; +# ABSTRACT: Map Perl operating system names to generic types + +our $VERSION = '1.010'; + +require Exporter; +our @ISA = qw(Exporter); + +our %EXPORT_TAGS = ( all => [qw( os_type is_os_type )] ); + +our @EXPORT_OK = @{ $EXPORT_TAGS{all} }; + +# originally taken from Module::Build by Ken Williams et al. +my %OSTYPES = qw( + aix Unix + bsdos Unix + beos Unix + bitrig Unix + dgux Unix + dragonfly Unix + dynixptx Unix + freebsd Unix + linux Unix + haiku Unix + hpux Unix + iphoneos Unix + irix Unix + darwin Unix + machten Unix + midnightbsd Unix + minix Unix + mirbsd Unix + next Unix + openbsd Unix + netbsd Unix + dec_osf Unix + nto Unix + svr4 Unix + svr5 Unix + sco Unix + sco_sv Unix + unicos Unix + unicosmk Unix + solaris Unix + sunos Unix + cygwin Unix + msys Unix + os2 Unix + interix Unix + gnu Unix + gnukfreebsd Unix + nto Unix + qnx Unix + android Unix + + dos Windows + MSWin32 Windows + + os390 EBCDIC + os400 EBCDIC + posix-bc EBCDIC + vmesa EBCDIC + + MacOS MacOS + VMS VMS + vos VOS + riscos RiscOS + amigaos Amiga + mpeix MPEiX +); + +sub os_type { + my ($os) = @_; + $os = $^O unless defined $os; + return $OSTYPES{$os} || q{}; +} + +sub is_os_type { + my ( $type, $os ) = @_; + return unless $type; + $os = $^O unless defined $os; + return os_type($os) eq $type; +} + +1; + +=pod + +=encoding UTF-8 + +=head1 NAME + +Perl::OSType - Map Perl operating system names to generic types + +=head1 VERSION + +version 1.010 + +=head1 SYNOPSIS + + use Perl::OSType ':all'; + + $current_type = os_type(); + $other_type = os_type('dragonfly'); # gives 'Unix' + +=head1 DESCRIPTION + +Modules that provide OS-specific behaviors often need to know if +the current operating system matches a more generic type of +operating systems. For example, 'linux' is a type of 'Unix' operating system +and so is 'freebsd'. + +This module provides a mapping between an operating system name as given by +C<$^O> and a more generic type. The initial version is based on the OS type +mappings provided in L<Module::Build> and L<ExtUtils::CBuilder>. (Thus, +Microsoft operating systems are given the type 'Windows' rather than 'Win32'.) + +=head1 USAGE + +No functions are exported by default. The export tag ":all" will export +all functions listed below. + +=head2 os_type() + + $os_type = os_type(); + $os_type = os_type('MSWin32'); + +Returns a single, generic OS type for a given operating system name. With no +arguments, returns the OS type for the current value of C<$^O>. If the +operating system is not recognized, the function will return the empty string. + +=head2 is_os_type() + + $is_windows = is_os_type('Windows'); + $is_unix = is_os_type('Unix', 'dragonfly'); + +Given an OS type and OS name, returns true or false if the OS name is of the +given type. As with C<os_type>, it will use the current operating system as a +default if no OS name is provided. + +=head1 SEE ALSO + +=over 4 + +=item * + +L<Devel::CheckOS> + +=back + +=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan + +=head1 SUPPORT + +=head2 Bugs / Feature Requests + +Please report any bugs or feature requests through the issue tracker +at L<https://github.com/Perl-Toolchain-Gang/Perl-OSType/issues>. +You will be notified automatically of any progress on your issue. + +=head2 Source Code + +This is open source software. The code repository is available for +public review and contribution under the terms of the license. + +L<https://github.com/Perl-Toolchain-Gang/Perl-OSType> + + git clone https://github.com/Perl-Toolchain-Gang/Perl-OSType.git + +=head1 AUTHOR + +David Golden <dagolden@cpan.org> + +=head1 CONTRIBUTORS + +=for stopwords Chris 'BinGOs' Williams David Golden Graham Ollis Jonas B. Nielsen Owain G. Ainsworth Paul Green Piotr Roszatycki + +=over 4 + +=item * + +Chris 'BinGOs' Williams <chris@bingosnet.co.uk> + +=item * + +David Golden <xdg@xdg.me> + +=item * + +Graham Ollis <plicease@cpan.org> + +=item * + +Jonas B. Nielsen <jonasbn@hoarfrost.local> + +=item * + +Owain G. Ainsworth <oga@nicotinebsd.org> + +=item * + +Paul Green <Paul.Green@stratus.com> + +=item * + +Piotr Roszatycki <piotr.roszatycki@gmail.com> + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2016 by David Golden. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + +__END__ + + +# vim: ts=4 sts=4 sw=4 et: diff --git a/data/miniconda3/lib/perl5/core_perl/PerlIO.pm b/data/miniconda3/lib/perl5/core_perl/PerlIO.pm new file mode 100644 index 0000000000000000000000000000000000000000..85dd083cc02a05b2d56e9edd00da6ea31fdbfbbf --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/PerlIO.pm @@ -0,0 +1,397 @@ +package PerlIO; + +our $VERSION = '1.11'; + +# Map layer name to package that defines it +our %alias; + +sub import +{ + my $class = shift; + while (@_) + { + my $layer = shift; + if (exists $alias{$layer}) + { + $layer = $alias{$layer} + } + else + { + $layer = "${class}::$layer"; + } + eval { require $layer =~ s{::}{/}gr . '.pm' }; + warn $@ if $@; + } +} + +sub F_UTF8 () { 0x8000 } + +1; +__END__ + +=head1 NAME + +PerlIO - On demand loader for PerlIO layers and root of PerlIO::* name space + +=head1 SYNOPSIS + + # support platform-native and CRLF text files + open(my $fh, "<:crlf", "my.txt") or die "open failed: $!"; + + # append UTF-8 encoded text + open(my $fh, ">>:encoding(UTF-8)", "some.log") + or die "open failed: $!"; + + # portably open a binary file for reading + open(my $fh, "<", "his.jpg") or die "open failed: $!"; + binmode($fh) or die "binmode failed: $!"; + + Shell: + PERLIO=:perlio perl .... + +=head1 DESCRIPTION + +When an undefined layer 'foo' is encountered in an C<open> or +C<binmode> layer specification then C code performs the equivalent of: + + use PerlIO 'foo'; + +The Perl code in PerlIO.pm then attempts to locate a layer by doing + + require PerlIO::foo; + +Otherwise the C<PerlIO> package is a place holder for additional +PerlIO related functions. + +=head2 Layers + +Generally speaking, PerlIO layers (previously sometimes referred to as +"disciplines") are an ordered stack applied to a filehandle (specified as +a space- or colon-separated list, conventionally written with a leading +colon). Each layer performs some operation on any input or output, except +when bypassed such as with C<sysread> or C<syswrite>. Read operations go +through the stack in the order they are set (left to right), and write +operations in the reverse order. + +There are also layers which actually just set flags on lower layers, or +layers that modify the current stack but don't persist on the stack +themselves; these are referred to as pseudo-layers. + +When opening a handle, it will be opened with any layers specified +explicitly in the open() call (or the platform defaults, if specified as +a colon with no following layers). + +If layers are not explicitly specified, the handle will be opened with the +layers specified by the L<${^OPEN}|perlvar/"${^OPEN}"> variable (usually +set by using the L<open> pragma for a lexical scope, or the C<-C> +command-line switch or C<PERL_UNICODE> environment variable for the main +program scope). + +If layers are not specified in the open() call or C<${^OPEN}> variable, +the handle will be opened with the default layer stack configured for that +architecture; see L</"Defaults and how to override them">. + +Some layers will automatically insert required lower level layers if not +present; for example C<:perlio> will insert C<:unix> below itself for low +level IO, and C<:encoding> will insert the platform defaults for buffered +IO. + +The C<binmode> function can be called on an opened handle to push +additional layers onto the stack, which may also modify the existing +layers. C<binmode> called with no layers will remove or unset any +existing layers which transform the byte stream, making the handle +suitable for binary data. + +The following layers are currently defined: + +=over 4 + +=item :unix + +Lowest level layer which provides basic PerlIO operations in terms of +UNIX/POSIX numeric file descriptor calls +(open(), read(), write(), lseek(), close()). +It is used even on non-Unix architectures, and most other layers operate on +top of it. + +=item :stdio + +Layer which calls C<fread>, C<fwrite> and C<fseek>/C<ftell> etc. Note +that as this is "real" stdio it will ignore any layers beneath it and +go straight to the operating system via the C library as usual. +This layer implements both low level IO and buffering, but is rarely used +on modern architectures. + +=item :perlio + +A from scratch implementation of buffering for PerlIO. Provides fast +access to the buffer for C<sv_gets> which implements Perl's readline/E<lt>E<gt> +and in general attempts to minimize data copying. + +C<:perlio> will insert a C<:unix> layer below itself to do low level IO. + +=item :crlf + +A layer that implements DOS/Windows like CRLF line endings. On read +converts pairs of CR,LF to a single "\n" newline character. On write +converts each "\n" to a CR,LF pair. Note that this layer will silently +refuse to be pushed on top of itself. + +It currently does I<not> mimic MS-DOS as far as treating of Control-Z +as being an end-of-file marker. + +On DOS/Windows like architectures where this layer is part of the defaults, +it also acts like the C<:perlio> layer, and removing the CRLF translation +(such as with C<:raw>) will only unset the CRLF translation flag. Since +Perl 5.14, you can also apply another C<:crlf> layer later, such as when +the CRLF translation must occur after an encoding layer. On other +architectures, it is a mundane CRLF translation layer and can be added and +removed normally. + + # translate CRLF after encoding on Perl 5.14 or newer + binmode $fh, ":raw:encoding(UTF-16LE):crlf" + or die "binmode failed: $!"; + +=item :utf8 + +Pseudo-layer that declares that the stream accepts Perl's I<internal> +upgraded encoding of characters, which is approximately UTF-8 on ASCII +machines, but UTF-EBCDIC on EBCDIC machines. This allows any character +Perl can represent to be read from or written to the stream. + +This layer (which actually sets a flag on the preceding layer, and is +implicitly set by any C<:encoding> layer) does not translate or validate +byte sequences. It instead indicates that the byte stream will have been +arranged by other layers to be provided in Perl's internal upgraded +encoding, which Perl code (and correctly written XS code) will interpret +as decoded Unicode characters. + +B<CAUTION>: Do not use this layer to translate from UTF-8 bytes, as +invalid UTF-8 or binary data will result in malformed Perl strings. It is +unlikely to produce invalid UTF-8 when used for output, though it will +instead produce UTF-EBCDIC on EBCDIC systems. The C<:encoding(UTF-8)> +layer (hyphen is significant) is preferred as it will ensure translation +between valid UTF-8 bytes and valid Unicode characters. + +=item :bytes + +This is the inverse of the C<:utf8> pseudo-layer. It turns off the flag +on the layer below so that data read from it is considered to +be Perl's internal downgraded encoding, thus interpreted as the native +single-byte encoding of Latin-1 or EBCDIC. Likewise on output Perl will +warn if a "wide" character (a codepoint not in the range 0..255) is +written to a such a stream. + +This is very dangerous to push on a handle using an C<:encoding> layer, +as such a layer assumes to be working with Perl's internal upgraded +encoding, so you will likely get a mangled result. Instead use C<:raw> or +C<:pop> to remove encoding layers. + +=item :raw + +The C<:raw> pseudo-layer is I<defined> as being identical to calling +C<binmode($fh)> - the stream is made suitable for passing binary data, +i.e. each byte is passed as-is. The stream will still be buffered +(but this was not always true before Perl 5.14). + +In Perl 5.6 and some books the C<:raw> layer is documented as the inverse +of the C<:crlf> layer. That is no longer the case - other layers which +would alter the binary nature of the stream are also disabled. If you +want UNIX line endings on a platform that normally does CRLF translation, +but still want UTF-8 or encoding defaults, the appropriate thing to do is +to add C<:perlio> to the PERLIO environment variable, or open the handle +explicitly with that layer, to replace the platform default of C<:crlf>. + +The implementation of C<:raw> is as a pseudo-layer which when "pushed" +pops itself and then any layers which would modify the binary data stream. +(Undoing C<:utf8> and C<:crlf> may be implemented by clearing flags +rather than popping layers but that is an implementation detail.) + +As a consequence of the fact that C<:raw> normally pops layers, +it usually only makes sense to have it as the only or first element in +a layer specification. When used as the first element it provides +a known base on which to build e.g. + + open(my $fh,">:raw:encoding(UTF-8)",...) + or die "open failed: $!"; + +will construct a "binary" stream regardless of the platform defaults, +but then enable UTF-8 translation. + +=item :pop + +A pseudo-layer that removes the top-most layer. Gives Perl code a +way to manipulate the layer stack. Note that C<:pop> only works on +real layers and will not undo the effects of pseudo-layers or flags +like C<:utf8>. An example of a possible use might be: + + open(my $fh,...) or die "open failed: $!"; + ... + binmode($fh,":encoding(...)") or die "binmode failed: $!"; + # next chunk is encoded + ... + binmode($fh,":pop") or die "binmode failed: $!"; + # back to un-encoded + +A more elegant (and safer) interface is needed. + +=item :win32 + +On Win32 platforms this I<experimental> layer uses the native "handle" IO +rather than the unix-like numeric file descriptor layer. Known to be +buggy as of Perl 5.8.2. + +=back + +=head2 Custom Layers + +It is possible to write custom layers in addition to the above builtin +ones, both in C/XS and Perl, as a module named C<< PerlIO::<layer name> >>. +Some custom layers come with the Perl distribution. + +=over 4 + +=item :encoding + +Use C<:encoding(ENCODING)> to transparently do character set and encoding +transformations, for example from Shift-JIS to Unicode. Note that an +C<:encoding> also enables C<:utf8>. See L<PerlIO::encoding> for more +information. + +=item :mmap + +A layer which implements "reading" of files by using C<mmap()> to +make a (whole) file appear in the process's address space, and then +using that as PerlIO's "buffer". This I<may> be faster in certain +circumstances for large files, and may result in less physical memory +use when multiple processes are reading the same file. + +Files which are not C<mmap()>-able revert to behaving like the C<:perlio> +layer. Writes also behave like the C<:perlio> layer, as C<mmap()> for write +needs extra house-keeping (to extend the file) which negates any advantage. + +The C<:mmap> layer will not exist if the platform does not support C<mmap()>. +See L<PerlIO::mmap> for more information. + +=item :via + +C<:via(MODULE)> allows a transformation to be applied by an arbitrary Perl +module, for example compression / decompression, encryption / decryption. +See L<PerlIO::via> for more information. + +=item :scalar + +A layer implementing "in memory" files using scalar variables, +automatically used in place of the platform defaults for IO when opening +such a handle. As such, the scalar is expected to act like a file, only +containing or storing bytes. See L<PerlIO::scalar> for more information. + +=back + +=head2 Alternatives to raw + +To get a binary stream an alternate method is to use: + + open(my $fh,"<","whatever") or die "open failed: $!"; + binmode($fh) or die "binmode failed: $!"; + +This has the advantage of being backward compatible with older versions +of Perl that did not use PerlIO or where C<:raw> was buggy (as it was +before Perl 5.14). + +To get an unbuffered stream specify an unbuffered layer (e.g. C<:unix>) +in the open call: + + open(my $fh,"<:unix",$path) or die "open failed: $!"; + +=head2 Defaults and how to override them + +If the platform is MS-DOS like and normally does CRLF to "\n" +translation for text files then the default layers are: + + :unix:crlf + +Otherwise if C<Configure> found out how to do "fast" IO using the system's +stdio (not common on modern architectures), then the default layers are: + + :stdio + +Otherwise the default layers are + + :unix:perlio + +Note that the "default stack" depends on the operating system and on the +Perl version, and both the compile-time and runtime configurations of +Perl. The default can be overridden by setting the environment variable +PERLIO to a space or colon separated list of layers, however this cannot +be used to set layers that require loading modules like C<:encoding>. + +This can be used to see the effect of/bugs in the various layers e.g. + + cd .../perl/t + PERLIO=:stdio ./perl harness + PERLIO=:perlio ./perl harness + +For the various values of PERLIO see L<perlrun/PERLIO>. + +The following table summarizes the default layers on UNIX-like and +DOS-like platforms and depending on the setting of C<$ENV{PERLIO}>: + + PERLIO UNIX-like DOS-like + ------ --------- -------- + unset / "" :unix:perlio / :stdio [1] :unix:crlf + :stdio :stdio :stdio + :perlio :unix:perlio :unix:perlio + + # [1] ":stdio" if Configure found out how to do "fast stdio" (depends + # on the stdio implementation) and in Perl 5.8, else ":unix:perlio" + +=head2 Querying the layers of filehandles + +The following returns the B<names> of the PerlIO layers on a filehandle. + + my @layers = PerlIO::get_layers($fh); # Or FH, *FH, "FH". + +The layers are returned in the order an open() or binmode() call would +use them, and without colons. + +By default the layers from the input side of the filehandle are +returned; to get the output side, use the optional C<output> argument: + + my @layers = PerlIO::get_layers($fh, output => 1); + +(Usually the layers are identical on either side of a filehandle but +for example with sockets there may be differences.) + +There is no set_layers(), nor does get_layers() return a tied array +mirroring the stack, or anything fancy like that. This is not +accidental or unintentional. The PerlIO layer stack is a bit more +complicated than just a stack (see for example the behaviour of C<:raw>). +You are supposed to use open() and binmode() to manipulate the stack. + +B<Implementation details follow, please close your eyes.> + +The arguments to layers are by default returned in parentheses after +the name of the layer, and certain layers (like C<:utf8>) are not real +layers but instead flags on real layers; to get all of these returned +separately, use the optional C<details> argument: + + my @layer_and_args_and_flags = PerlIO::get_layers($fh, details => 1); + +The result will be up to be three times the number of layers: +the first element will be a name, the second element the arguments +(unspecified arguments will be C<undef>), the third element the flags, +the fourth element a name again, and so forth. + +B<You may open your eyes now.> + +=head1 AUTHOR + +Nick Ing-Simmons E<lt>nick@ing-simmons.netE<gt> + +=head1 SEE ALSO + +L<perlfunc/"binmode">, L<perlfunc/"open">, L<perlunicode>, L<perliol>, +L<Encode> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Checker.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Checker.pm new file mode 100644 index 0000000000000000000000000000000000000000..0d18aaedb1054da62cee379298abf7883576fc47 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Checker.pm @@ -0,0 +1,1090 @@ +############################################################################# +# Pod/Checker.pm -- check pod documents for syntax errors +# +# Copyright (C) 1994-2000 by Bradford Appleton. All rights reserved. +# This is free software; you can redistribute it and/or modify it under the +# same terms as Perl itself. +############################################################################# + +package Pod::Checker; +use strict; +use warnings; + +our $VERSION = '1.73'; ## Current version of this package + +=head1 NAME + +Pod::Checker - check pod documents for syntax errors + +=head1 SYNOPSIS + + use Pod::Checker; + + $syntax_okay = podchecker($filepath, $outputpath, %options); + + my $checker = Pod::Checker->new(%options); + $checker->parse_from_file($filepath, \*STDERR); + +=head1 OPTIONS/ARGUMENTS + +C<$filepath> is the input POD to read and C<$outputpath> is +where to write POD syntax error messages. Either argument may be a scalar +indicating a file-path, or else a reference to an open filehandle. +If unspecified, the input-file it defaults to C<\*STDIN>, and +the output-file defaults to C<\*STDERR>. + +=head2 podchecker() + +This function can take a hash of options: + +=over 4 + +=item B<-warnings> =E<gt> I<val> + +Turn warnings on/off. I<val> is usually 1 for on, but higher values +trigger additional warnings. See L<"Warnings">. + +=item B<-quiet> =E<gt> I<val> + +If C<val> is true, do not print any errors/warnings. + +=back + +=head1 DESCRIPTION + +B<podchecker> will perform syntax checking of Perl5 POD format documentation. + +Curious/ambitious users are welcome to propose additional features they wish +to see in B<Pod::Checker> and B<podchecker> and verify that the checks are +consistent with L<perlpod>. + +The following checks are currently performed: + +=over 4 + +=item * + +Unknown '=xxxx' commands, unknown 'XE<lt>...E<gt>' interior-sequences, +and unterminated interior sequences. + +=item * + +Check for proper balancing of C<=begin> and C<=end>. The contents of such +a block are generally ignored, i.e. no syntax checks are performed. + +=item * + +Check for proper nesting and balancing of C<=over>, C<=item> and C<=back>. + +=item * + +Check for same nested interior-sequences (e.g. +C<LE<lt>...LE<lt>...E<gt>...E<gt>>). + +=item * + +Check for malformed or non-existing entities C<EE<lt>...E<gt>>. + +=item * + +Check for correct syntax of hyperlinks C<LE<lt>...E<gt>>. See L<perlpod> +for details. + +=item * + +Check for unresolved document-internal links. This check may also reveal +misspelled links that seem to be internal links but should be links +to something else. + +=back + +=head1 DIAGNOSTICS + +=head2 Errors + +=over 4 + +=item * empty =headn + +A heading (C<=head1> or C<=head2>) without any text? That ain't no +heading! + +=item * =over on line I<N> without closing =back + +=item * You forgot a '=back' before '=headI<N>' + +=item * =over is the last thing in the document?! + +The C<=over> command does not have a corresponding C<=back> before the +next heading (C<=head1> or C<=head2>) or the end of the file. + +=item * '=item' outside of any '=over' + +=item * =back without =over + +An C<=item> or C<=back> command has been found outside a +C<=over>/C<=back> block. + +=item * Can't have a 0 in =over I<N> + +You need to indent a strictly positive number of spaces, not 0. + +=item * =over should be: '=over' or '=over positive_number' + +Either have an argumentless =over, or have its argument a strictly positive number. + +=item * =begin I<TARGET> without matching =end I<TARGET> + +A C<=begin> command was found that has no matching =end command. + +=item * =begin without a target? + +A C<=begin> command was found that is not followed by the formatter +specification. + +=item * =end I<TARGET> without matching =begin. + +A standalone C<=end> command was found. + +=item * '=end' without a target? + +'=end' directives need to have a target, just like =begin directives. + +=item * '=end I<TARGET>' is invalid. + +I<TARGET> needs to be one word + +=item * =end I<CONTENT> doesn't match =begin I<TARGET> + +I<CONTENT> needs to match =begin's I<TARGET>. + +=item * =for without a target? + +There is no specification of the formatter after the C<=for> command. + +=item * unresolved internal link I<NAME> + +The given link to I<NAME> does not have a matching node in the current +POD. This also happened when a single word node name is not enclosed in +C<"">. + +=item * Unknown directive: I<CMD> + +An invalid POD command has been found. Valid are C<=head1>, C<=head2>, +C<=head3>, C<=head4>, C<=over>, C<=item>, C<=back>, C<=begin>, C<=end>, +C<=for>, C<=pod>, C<=cut> + +=item * Deleting unknown formatting code I<SEQ> + +An invalid markup command has been encountered. Valid are: +C<BE<lt>E<gt>>, C<CE<lt>E<gt>>, C<EE<lt>E<gt>>, C<FE<lt>E<gt>>, +C<IE<lt>E<gt>>, C<LE<lt>E<gt>>, C<SE<lt>E<gt>>, C<XE<lt>E<gt>>, +C<ZE<lt>E<gt>> + +=item * Unterminated I<SEQ>E<lt>E<gt> sequence + +An unclosed formatting code + +=item * An EE<lt>...E<gt> surrounding strange content + +The I<STRING> found cannot be interpreted as a character entity. + +=item * An empty EE<lt>E<gt> + +=item * An empty C<< LE<lt>E<gt> >> + +=item * An empty XE<lt>E<gt> + +There needs to be content inside E, L, and X formatting codes. + +=item * A non-empty ZE<lt>E<gt> + +The C<ZE<lt>E<gt>> sequence is supposed to be empty. + +=item * Spurious text after =pod / =cut + +The commands C<=pod> and C<=cut> do not take any arguments. + +=item * =back doesn't take any parameters, but you said =back I<ARGUMENT> + +The C<=back> command does not take any arguments. + +=item * =pod directives shouldn't be over one line long! Ignoring all I<N> lines of content + +Self explanatory + +=item * =cut found outside a pod block. + +A '=cut' directive found in the middle of non-POD + +=item * Invalid =encoding syntax: I<CONTENT> + +Syntax error in =encoding directive + +=back + +=head2 Warnings + +These may not necessarily cause trouble, but indicate mediocre style. + +=over 4 + +=item * nested commands I<CMD>E<lt>...I<CMD>E<lt>...E<gt>...E<gt> + +Two nested identical markup commands have been found. Generally this +does not make sense. + +=item * multiple occurrences (I<N>) of link target I<name> + +The POD file has some C<=item> and/or C<=head> commands that have +the same text. Potential hyperlinks to such a text cannot be unique then. +This warning is printed only with warning level greater than one. + +=item * line containing nothing but whitespace in paragraph + +There is some whitespace on a seemingly empty line. POD is very sensitive +to such things, so this is flagged. B<vi> users switch on the B<list> +option to avoid this problem. + +=item * =item has no contents + +There is a list C<=item> that has no text contents. You probably want to delete +empty items. + +=item * You can't have =items (as at line I<N>) unless the first thing after the =over is an =item + +A list introduced by C<=over> starts with a text or verbatim paragraph, +but continues with C<=item>s. Move the non-item paragraph out of the +C<=over>/C<=back> block. + +=item * Expected '=item I<EXPECTED VALUE>' + +=item * Expected '=item *' + +=item * Possible =item type mismatch: 'I<x>' found leading a supposed definition =item + +A list started with e.g. a bullet-like C<=item> and continued with a +numbered one. This is obviously inconsistent. For most translators the +type of the I<first> C<=item> determines the type of the list. + +=item * You have '=item x' instead of the expected '=item I<N>' + +Erroneous numbering of =item numbers; they need to ascend consecutively. + +=item * Unknown E content in EE<lt>I<CONTENT>E<gt> + +A character entity was found that does not belong to the standard +ISO set or the POD specials C<verbar> and C<sol>. I<Currently, this warning +only appears if a character entity was found that does not have a Unicode +character. This should be fixed to adhere to the original warning.> + +=item * empty =over/=back block + +The list opened with C<=over> does not contain anything. + +=item * empty section in previous paragraph + +The previous section (introduced by a C<=head> command) does not contain +any valid content. This usually indicates that something is missing. Note: A +C<=head1> followed immediately by C<=head2> does not trigger this warning. + +=item * Verbatim paragraph in NAME section + +The NAME section (C<=head1 NAME>) should consist of a single paragraph +with the script/module name, followed by a dash `-' and a very short +description of what the thing is good for. + +=item * =headI<n> without preceding higher level + +For example if there is a C<=head2> in the POD file prior to a +C<=head1>. + +=back + +=head2 Hyperlinks + +There are some warnings with respect to malformed hyperlinks: + +=over 4 + +=item * ignoring leading/trailing whitespace in link + +There is whitespace at the beginning or the end of the contents of +LE<lt>...E<gt>. + +=item * alternative text/node '%s' contains non-escaped | or / + +The characters C<|> and C</> are special in the LE<lt>...E<gt> context. +Although the hyperlink parser does its best to determine which "/" is +text and which is a delimiter in case of doubt, one ought to escape +these literal characters like this: + + / E<sol> + | E<verbar> + +=back + +Note that the line number of the error/warning may refer to the line number of +the start of the paragraph in which the error/warning exists, not the line +number that the error/warning is on. This bug is present in errors/warnings +related to formatting codes. I<This should be fixed.> + +=head1 RETURN VALUE + +B<podchecker> returns the number of POD syntax errors found or -1 if +there were no POD commands at all found in the file. + +=head1 EXAMPLES + +See L</SYNOPSIS> + +=head1 SCRIPTS + +The B<podchecker> script that comes with this distribution is a lean wrapper +around this module. See the online manual with + + podchecker -help + podchecker -man + +=head1 INTERFACE + +While checking, this module collects document properties, e.g. the nodes +for hyperlinks (C<=headX>, C<=item>) and index entries (C<XE<lt>E<gt>>). +POD translators can use this feature to syntax-check and get the nodes in +a first pass before actually starting to convert. This is expensive in terms +of execution time, but allows for very robust conversions. + +Since v1.24 the B<Pod::Checker> module uses only the B<poderror> +method to print errors and warnings. The summary output (e.g. +"Pod syntax OK") has been dropped from the module and has been included in +B<podchecker> (the script). This allows users of B<Pod::Checker> to +control completely the output behavior. Users of B<podchecker> (the script) +get the well-known behavior. + +v1.45 inherits from Pod::Simple as opposed to all previous versions +inheriting from Pod::Parser. Do B<not> use Pod::Simple's interface when +using Pod::Checker unless it is documented somewhere on this page. I +repeat, DO B<NOT> USE POD::SIMPLE'S INTERFACE. + +=cut + +############################################################################# + +#use diagnostics; +use Carp qw(croak); +use Exporter 'import'; +use base qw/Pod::Simple::Methody/; + +our @EXPORT = qw(&podchecker); + +##--------------------------------- +## Function definitions begin here +##--------------------------------- + +sub podchecker { + my ($infile, $outfile, %options) = @_; + local $_; + + ## Set defaults + $infile ||= \*STDIN; + $outfile ||= \*STDERR; + + ## Now create a pod checker + my $checker = Pod::Checker->new(%options); + + ## Now check the pod document for errors + $checker->parse_from_file($infile, $outfile); + + ## Return the number of errors found + return $checker->num_errors(); +} + + +##--------------------------------------------------------------------------- + +##------------------------------- +## Method definitions begin here +##------------------------------- + +################################## + +=over 4 + +=item C<Pod::Checker-E<gt>new( %options )> + +Return a reference to a new Pod::Checker object that inherits from +Pod::Simple and is used for calling the required methods later. The +following options are recognized: + +C<-warnings =E<gt> num> + Print warnings if C<num> is true. The higher the value of C<num>, +the more warnings are printed. Currently there are only levels 1 and 2. + +C<-quiet =E<gt> num> + If C<num> is true, do not print any errors/warnings. This is useful +when Pod::Checker is used to munge POD code into plain text from within +POD formatters. + +=cut + +sub new { + my $new = shift->SUPER::new(@_); + $new->{'output_fh'} ||= *STDERR{IO}; + + # Set options + my %opts = @_; + $new->{'-warnings'} = defined $opts{'-warnings'} ? + $opts{'-warnings'} : 1; # default on + $new->{'-quiet'} = $opts{'-quiet'} || 0; # default off + + # Initialize number of errors/warnings + $new->{'_NUM_ERRORS'} = 0; + $new->{'_NUM_WARNINGS'} = 0; + + # 'current' also means 'most recent' in the follow comments + $new->{'_thispara'} = ''; # current POD paragraph + $new->{'_line'} = 0; # current line number + $new->{'_head_num'} = 0; # current =head level (set to 0 to make + # logic easier down the road) + $new->{'_cmds_since_head'} = 0; # num of POD directives since prev. =headN + $new->{'_nodes'} = []; # stack for =head/=item nodes + $new->{'_fcode_stack'} = []; # stack for nested formatting codes + $new->{'_fcode_pos'} = []; # stack for position in paragraph of fcodes + $new->{'_begin_stack'} = []; # stack for =begins: [line #, target] + $new->{'_links'} = []; # stack for hyperlinks to external entities + $new->{'_internal_links'} = []; # set of linked-to internal sections + $new->{'_index'} = []; # stack for text in X<>s + + $new->accept_targets('*'); # check all =begin/=for blocks + $new->cut_handler( \&handle_pod_and_cut ); # warn if text after =cut + $new->pod_handler( \&handle_pod_and_cut ); # warn if text after =pod + $new->whiteline_handler( \&handle_whiteline ); # warn if whiteline + $new->parse_empty_lists(1); # warn if they are empty + + return $new; +} + +################################## + +=item C<$checker-E<gt>poderror( @args )> + +=item C<$checker-E<gt>poderror( {%opts}, @args )> + +Internal method for printing errors and warnings. If no options are given, +simply prints "@_". The following options are recognized and used to form +the output: + + -msg + +A message to print prior to C<@args>. + + -line + +The line number the error occurred in. + + -file + +The file (name) the error occurred in. Defaults to the name of the current +file being processed. + + -severity + +The error level, should be 'WARNING' or 'ERROR'. + +=cut + +# Invoked as $self->poderror( @args ), or $self->poderror( {%opts}, @args ) +sub poderror { + my $self = shift; + my %opts = (ref $_[0]) ? %{shift()} : (); + + ## Retrieve options + chomp( my $msg = ($opts{'-msg'} || '')."@_" ); + my $line = (exists $opts{'-line'}) ? " at line $opts{'-line'}" : ''; + my $file = ' in file ' . ((exists $opts{'-file'}) + ? $opts{'-file'} + : ((defined $self->source_filename) + ? $self->source_filename + : "???")); + unless (exists $opts{'-severity'}) { + ## See if can find severity in message prefix + $opts{'-severity'} = $1 if ( $msg =~ s/^\**\s*([A-Z]{3,}):\s+// ); + } + my $severity = (exists $opts{'-severity'}) ? "*** $opts{-severity}: " : ''; + + ## Increment error count and print message " + ++($self->{'_NUM_ERRORS'}) + if(!%opts || ($opts{-severity} && $opts{'-severity'} eq 'ERROR')); + ++($self->{'_NUM_WARNINGS'}) + if(!%opts || ($opts{-severity} && $opts{'-severity'} eq 'WARNING')); + unless($self->{'-quiet'}) { + my $out_fh = $self->{'output_fh'} || \*STDERR; + print $out_fh ($severity, $msg, $line, $file, "\n") + if($self->{'-warnings'} || !%opts || $opts{'-severity'} ne 'WARNING'); + } +} + +################################## + +=item C<$checker-E<gt>num_errors()> + +Set (if argument specified) and retrieve the number of errors found. + +=cut + +sub num_errors { + return (@_ > 1) ? ($_[0]->{'_NUM_ERRORS'} = $_[1]) : $_[0]->{'_NUM_ERRORS'}; +} + +################################## + +=item C<$checker-E<gt>num_warnings()> + +Set (if argument specified) and retrieve the number of warnings found. + +=cut + +sub num_warnings { + return (@_ > 1) ? ($_[0]->{'_NUM_WARNINGS'} = $_[1]) : + $_[0]->{'_NUM_WARNINGS'}; +} + +################################## + +=item C<$checker-E<gt>name()> + +Set (if argument specified) and retrieve the canonical name of POD as +found in the C<=head1 NAME> section. + +=cut + +sub name { + return (@_ > 1 && $_[1]) ? + ($_[0]->{'_pod_name'} = $_[1]) : $_[0]->{'_pod_name'}; +} + +################################## + +=item C<$checker-E<gt>node()> + +Add (if argument specified) and retrieve the nodes (as defined by C<=headX> +and C<=item>) of the current POD. The nodes are returned in the order of +their occurrence. They consist of plain text, each piece of whitespace is +collapsed to a single blank. + +=cut + +sub node { + my ($self,$text) = @_; + if(defined $text) { + $text =~ s/\s+$//s; # strip trailing whitespace + $text =~ s/\s+/ /gs; # collapse whitespace + # add node, order important! + push(@{$self->{'_nodes'}}, $text); + # keep also a uniqueness counter + $self->{'_unique_nodes'}->{$text}++ if($text !~ /^\s*$/s); + return $text; + } + @{$self->{'_nodes'}}; +} + +################################## + +=item C<$checker-E<gt>idx()> + +Add (if argument specified) and retrieve the index entries (as defined by +C<XE<lt>E<gt>>) of the current POD. They consist of plain text, each piece +of whitespace is collapsed to a single blank. + +=cut + +# set/return index entries of current POD +sub idx { + my ($self,$text) = @_; + if(defined $text) { + $text =~ s/\s+$//s; # strip trailing whitespace + $text =~ s/\s+/ /gs; # collapse whitespace + # add node, order important! + push(@{$self->{'_index'}}, $text); + # keep also a uniqueness counter + $self->{'_unique_nodes'}->{$text}++ if($text !~ /^\s*$/s); + return $text; + } + @{$self->{'_index'}}; +} + +################################## + +# add a hyperlink to the list of those of the current POD; returns current +# list after the addition has been done +sub hyperlink { + my $self = shift; + push(@{$self->{'_links'}}, $_[0]); + return $_[0]; +} + +=item C<$checker-E<gt>hyperlinks()> + +Retrieve an array containing the hyperlinks to things outside +the current POD (as defined by C<LE<lt>E<gt>>). + +Each is an instance of a class with the following methods: + +=cut + +sub hyperlinks { + @{shift->{'_links'}}; +} + +################################## + +# override Pod::Simple's whine() and scream() to use poderror() + +# Note: +# Ignore $self->{'no_whining'} b/c $self->{'quiet'} takes care of it in poderror +# Don't bother incrementing $self->{'errors_seen'} -- it's not used +# Don't bother pushing to $self->{'errata'} b/c poderror() outputs immediately +# We don't need to set $self->no_errata_section(1) b/c of these overrides + + +sub whine { + my ($self, $line, $complaint) = @_; + + my $severity = 'ERROR'; + + if (0) { + # XXX: Let's standardize what's a warning and what's an error. Let's not + # move stuff up and down the severity tree. -- rjbs, 2013-04-12 + # Convert errors in Pod::Simple that are warnings in Pod::Checker + # XXX Do differently so the $complaint can be reworded without this breaking + $severity = 'WARNING' if + $complaint =~ /^Expected '=item .+?'$/ || + $complaint =~ /^You can't have =items \(as at line .+?\) unless the first thing after the =over is an =item$/ || + $complaint =~ /^You have '=item .+?' instead of the expected '=item .+?'$/; + } + + $self->poderror({ -line => $line, + -severity => $severity, + -msg => $complaint }); + + return 1; # assume everything is peachy keen +} + +sub scream { + my ($self, $line, $complaint) = @_; + + $self->poderror({ -line => $line, + -severity => 'ERROR', # consider making severity 'FATAL' + -msg => $complaint }); + + return 1; +} + + +################################## + +# Some helper subroutines + +sub _init_event { # assignments done at the start of most events + $_[0]{'_thispara'} = ''; + $_[0]{'_line'} = $_[1]{'start_line'}; + $_[0]{'_cmds_since_head'}++; +} + +sub _check_fcode { + my ($self, $inner, $outers) = @_; + # Check for an fcode inside another of the same fcode + # XXX line number is the line of the start of the paragraph that the warning + # is in, not the line that the warning is on. Fix this + + # Later versions of Pod::Simple forbid nested L<>'s + return if $inner eq 'L' && $Pod::Simple::VERSION ge '3.33'; + + if (grep { $_ eq $inner } @$outers) { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => "nested commands $inner<...$inner<...>...>"}); + } +} + +################################## + +sub handle_text { $_[0]{'_thispara'} .= $_[1] } + +# whiteline is a seemingly blank line that matches /[^\S\r\n]/ +sub handle_whiteline { + my ($line, $line_n, $self) = @_; + $self->poderror({ + -line => $line_n, + -severity => 'WARNING', + -msg => 'line containing nothing but whitespace in paragraph'}); +} + +######## Directives +sub handle_pod_and_cut { + my ($line, $line_n, $self) = @_; + $self->{'_cmds_since_head'}++; + if ($line =~ /=(pod|cut)\s+\S/) { + $self->poderror({ -line => $line_n, + -severity => 'ERROR', + -msg => "Spurious text after =$1"}); + } +} + +sub start_Para { shift->_init_event(@_); } +sub end_Para { + my $self = shift; + # Get the NAME of the pod document + if ($self->{'_head_num'} == 1 && $self->{'_head_text'} eq 'NAME') { + if ($self->{'_thispara'} =~ /^\s*(\S+?)\s*[,-]/) { + $self->{'_pod_name'} = $1 unless defined $self->{'_pod_name'}; + } + } +} + +sub start_Verbatim { + my $self = shift; + $self->_init_event(@_); + + if ($self->{'_head_num'} == 1 && $self->{'_head_text'} eq 'NAME') { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => 'Verbatim paragraph in NAME section' }); + } +} +# Don't need an end_Verbatim + +# Do I need to do anything else with this? +sub start_Data { shift->_init_event() } + +sub start_head1 { shift->start_head(1, @_) } +sub start_head2 { shift->start_head(2, @_) } +sub start_head3 { shift->start_head(3, @_) } +sub start_head4 { shift->start_head(4, @_) } +sub start_head { + my $self = shift; + my $h = shift; + $self->_init_event(@_); + my $prev_h = $self->{'_head_num'}; + $self->{'_head_num'} = $h; + $self->{"_count_head$h"}++; + + if ($h > 1 && !$self->{'_count_head'.($h-1)}) { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => "=head$h without preceding higher level"}); + } + + # If this is the first =head of the doc, $prev_h is 0, thus less than $h + if ($self->{'_cmds_since_head'} == 1 && $prev_h >= $h) { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => 'empty section in previous paragraph'}); + } +} + +sub end_head1 { shift->end_head(@_) } +sub end_head2 { shift->end_head(@_) } +sub end_head3 { shift->end_head(@_) } +sub end_head4 { shift->end_head(@_) } +sub end_head { + my $self = shift; + my $arg = $self->{'_thispara'}; + $arg =~ s/\s+$//; + $self->{'_head_text'} = $arg; + $self->{'_cmds_since_head'} = 0; + my $h = $self->{'_head_num'}; + $self->node($arg); # remember this node + if ($arg eq '') { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'ERROR', + -msg => "empty =head$h" }); + } +} + +sub start_over_bullet { shift->start_over(@_, 'bullet') } +sub start_over_number { shift->start_over(@_, 'number') } +sub start_over_text { shift->start_over(@_, 'definition') } +sub start_over_block { shift->start_over(@_, 'block') } +sub start_over_empty { + my $self = shift; + $self->start_over(@_, 'empty'); + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => 'empty =over/=back block' }); +} +sub start_over { + my $self = shift; + my $type = pop; + $self->_init_event(@_); +} + +sub start_item_bullet { shift->_init_event(@_) } +sub start_item_number { shift->_init_event(@_) } +sub start_item_text { shift->_init_event(@_) } +sub end_item_bullet { shift->end_item('bullet') } +sub end_item_number { shift->end_item('number') } +sub end_item_text { shift->end_item('definition') } +sub end_item { + my $self = shift; + my $type = shift; + # If there is verbatim text in this item, it will show up as part of + # 'paras', and not part of '_thispara'. If the first para after this is a + # verbatim one, it actually will be (part of) the contents for this item. + if ( $self->{'_thispara'} eq '' + && ( ! @{$self->{'paras'}} + || $self->{'paras'}[0][0] !~ /Verbatim/i)) + { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'WARNING', + -msg => '=item has no contents' }); + } + + $self->node($self->{'_thispara'}); # remember this node +} + +sub start_for { # =for and =begin directives + my ($self, $flags) = @_; + $self->_init_event($flags); + push @{$self->{'_begin_stack'}}, [$self->{'_line'}, $flags->{'target'}]; +} + +sub end_for { + my ($self, $flags) = @_; + my ($line, $target) = @{pop @{$self->{'_begin_stack'}}}; + if ($flags->{'fake-closer'}) { # meaning Pod::Simple generated this =end + $self->poderror({ -line => $line, + -severity => 'ERROR', + -msg => "=begin $target without matching =end $target" + }); + } +} + +sub end_Document { + # Some final error checks + my $self = shift; + + # no POD found here + $self->num_errors(-1) && return unless $self->content_seen; + + my %nodes; + for ($self->node()) { + $nodes{$_} = 1; + if(/^(\S+)\s+\S/) { + # we have more than one word. Use the first as a node, too. + # This is used heavily in perlfunc.pod + $nodes{$1} ||= 2; # derived node + } + } + for ($self->idx()) { + $nodes{$_} = 3; # index node + } + + # XXX update unresolved internal link POD -- single word not enclosed in ""? + # I don't know what I was thinking when I made the above TODO, and I don't + # know what it means... + + for my $link (@{ $self->{'_internal_links'} }) { + my ($name, $line) = @$link; + unless ( $nodes{$name} ) { + $self->poderror({ -line => $line, + -severity => 'ERROR', + -msg => "unresolved internal link '$name'"}); + } + } + + # check the internal nodes for uniqueness. This pertains to + # =headX, =item and X<...> + if ($self->{'-warnings'} > 1 ) { + for my $node (sort keys %{ $self->{'_unique_nodes'} }) { + my $count = $self->{'_unique_nodes'}{$node}; + if ($count > 1) { # not unique + $self->poderror({ + -line => '-', + -severity => 'WARNING', + -msg => "multiple occurrences ($count) of link target ". + "'$node'"}); + } + } + } +} + +######## Formatting codes + +sub start_B { shift->start_fcode('B') } +sub start_C { shift->start_fcode('C') } +sub start_F { shift->start_fcode('F') } +sub start_I { shift->start_fcode('I') } +sub start_S { shift->start_fcode('S') } +sub start_fcode { + my ($self, $fcode) = @_; + unshift @{$self->{'_fcode_stack'}}, $fcode; +} + +sub end_B { shift->end_fcode() } +sub end_C { shift->end_fcode() } +sub end_F { shift->end_fcode() } +sub end_I { shift->end_fcode() } +sub end_S { shift->end_fcode() } +sub end_fcode { + my $self = shift; + $self->_check_fcode(shift @{$self->{'_fcode_stack'}}, # current fcode removed + $self->{'_fcode_stack'}); # previous fcodes +} + +sub start_L { + my ($self, $flags) = @_; + $self->start_fcode('L'); + + my $link = Pod::Checker::Hyperlink->new($flags, $self); + if ($link) { + if ( $link->type eq 'pod' + && $link->node + # It's an internal-to-this-page link if no page is given, or + # if the given one is to our NAME. + && (! $link->page || ( $self->{'_pod_name'} + && $link->page eq $self->{'_pod_name'}))) + { + push @{ $self->{'_internal_links'} }, [ $link->{'-raw_node'}, $link->line ]; + } + else { + $self->hyperlink($link); + } + } +} + +sub end_L { + my $self = shift; + $self->end_fcode(); +} + +sub start_X { + my $self = shift; + $self->start_fcode('X'); + # keep track of where X<> starts in the paragraph + # (this is a stack so nested X<>s are handled correctly) + push @{$self->{'_fcode_pos'}}, length $self->{'_thispara'}; +} +sub end_X { + my $self = shift; + # extract contents of X<> and replace with '' + my $start = pop @{$self->{'_fcode_pos'}}; # start at the beginning of X<> + my $end = length($self->{'_thispara'}) - $start; # end at end of X<> + my $x = substr($self->{'_thispara'}, $start, $end, ''); + if ($x eq "") { + $self->poderror({ -line => $self->{'_line'}, + -severity => 'ERROR', + -msg => "An empty X<>" }); + } + $self->idx($x); # remember this node + $self->end_fcode(); +} + +package Pod::Checker::Hyperlink; + +# This class is used to represent L<> link structures, so that the individual +# elements are easily accessible. It is based on code in Pod::Hyperlink + +sub new { + my ($class, + $simple_link, # The link structure returned by Pod::Simple + $caller # The caller class + ) = @_; + + my $self = +{}; + bless $self, $class; + + $self->{'-line'} ||= $caller->{'_line'}; + $self->{'-type'} ||= $simple_link->{'type'}; + + # Force stringification of page and node. (This expands any E<>.) + $self->{'-page'} = exists $simple_link->{'to'} ? "$simple_link->{'to'}" : ""; + $self->{'-node'} = exists $simple_link->{'section'} ? "$simple_link->{'section'}" : ""; + + # Save the unmodified node text, as the .t files are expecting the message + # for internal link failures to include it (hence this preserves backward + # compatibility). + $self->{'-raw_node'} = $self->{'-node'}; + + # Remove leading/trailing white space. Pod::Simple already warns about + # these, so if the only error is this, and the link is otherwise correct, + # only the Pod::Simple warning will be output, avoiding unnecessary + # confusion. + $self->{'-page'} =~ s/ ^ \s+ //x; + $self->{'-page'} =~ s/ \s+ $ //x; + + $self->{'-node'} =~ s/ ^ \s+ //x; + $self->{'-node'} =~ s/ \s+ $ //x; + + # Pod::Simple warns about L<> and L< >, but not L</> + if ($self->{'-page'} eq "" && $self->{'-node'} eq "") { + $caller->poderror({ -line => $caller->{'_line'}, + -severity => 'WARNING', + -msg => 'empty link'}); + return; + } + + return $self; +} + +=item line() + +Returns the approximate line number in which the link was encountered + +=cut + +sub line { + return $_[0]->{-line}; +} + +=item type() + +Returns the type of the link; one of: +C<"url"> for things like +C<http://www.foo>, C<"man"> for man pages, or C<"pod">. + +=cut + +sub type { + return $_[0]->{-type}; +} + +=item page() + +Returns the linked-to page or url. + +=cut + +sub page { + return $_[0]->{-page}; +} + +=item node() + +Returns the anchor or node within the linked-to page, or an empty string +(C<"">) if none appears in the link. + +=back + +=cut + +sub node { + return $_[0]->{-node}; +} + +=head1 AUTHOR + +Please report bugs using L<http://rt.cpan.org>. + +Brad Appleton E<lt>bradapp@enteract.comE<gt> (initial version), +Marek Rouchal E<lt>marekr@cpan.orgE<gt>, +Marc Green E<lt>marcgreen@cpan.orgE<gt> (port to Pod::Simple) +Ricardo Signes E<lt>rjbs@cpan.orgE<gt> (more porting to Pod::Simple) +Karl Williamson E<lt>khw@cpan.orgE<gt> (more porting to Pod::Simple) + +Based on code for B<Pod::Text::pod2text()> written by +Tom Christiansen E<lt>tchrist@mox.perl.comE<gt> + +=cut + +1 diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Escapes.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Escapes.pm new file mode 100644 index 0000000000000000000000000000000000000000..00501db3e8849eea72cdd17d287b9625c318bf9f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Escapes.pm @@ -0,0 +1,732 @@ +package Pod::Escapes; +use strict; +use warnings; +use 5.006; + +use vars qw( + %Code2USASCII + %Name2character + %Name2character_number + %Latin1Code_to_fallback + %Latin1Char_to_fallback + $FAR_CHAR + $FAR_CHAR_NUMBER + $NOT_ASCII + @ISA $VERSION @EXPORT_OK %EXPORT_TAGS +); + +require Exporter; +@ISA = ('Exporter'); +$VERSION = '1.07'; +@EXPORT_OK = qw( + %Code2USASCII + %Name2character + %Name2character_number + %Latin1Code_to_fallback + %Latin1Char_to_fallback + e2char + e2charnum +); +%EXPORT_TAGS = ('ALL' => \@EXPORT_OK); + +#========================================================================== + +$FAR_CHAR = "?" unless defined $FAR_CHAR; +$FAR_CHAR_NUMBER = ord($FAR_CHAR) unless defined $FAR_CHAR_NUMBER; + +$NOT_ASCII = 'A' ne chr(65) unless defined $NOT_ASCII; + +#-------------------------------------------------------------------------- +sub e2char { + my $in = $_[0]; + return undef unless defined $in and length $in; + + # Convert to decimal: + if($in =~ m/^(0[0-7]*)$/s ) { + $in = oct $in; + } elsif($in =~ m/^0?x([0-9a-fA-F]+)$/s ) { + $in = hex $1; + } # else it's decimal, or named + + if($in =~ m/^\d+$/s) { + if($] < 5.007 and $in > 255) { # can't be trusted with Unicode + return $FAR_CHAR; + } elsif ($] >= 5.007003) { + return chr(utf8::unicode_to_native($in)); + } elsif ($NOT_ASCII) { + return $Code2USASCII{$in} # so "65" => "A" everywhere + || $Latin1Code_to_fallback{$in} # Fallback. + || $FAR_CHAR; # Fall further back + } else { + return chr($in); + } + } else { + return $Name2character{$in}; # returns undef if unknown + } +} + +#-------------------------------------------------------------------------- +sub e2charnum { + my $in = $_[0]; + return undef unless defined $in and length $in; + + # Convert to decimal: + if($in =~ m/^(0[0-7]*)$/s ) { + $in = oct $in; + } elsif($in =~ m/^0?x([0-9a-fA-F]+)$/s ) { + $in = hex $1; + } # else it's decimal, or named + + if($in =~ m/^[0-9]+$/s) { + return 0 + $in; + } else { + return $Name2character_number{$in}; # returns undef if unknown + } +} + +#-------------------------------------------------------------------------- + +%Code2USASCII = ( +# mostly generated by +# perl -e "printf qq{ \x25 3s, '\x25s',\n}, $_, chr($_) foreach (32 .. 126)" + 32, ' ', + 33, '!', + 34, '"', + 35, '#', + 36, '$', + 37, '%', + 38, '&', + 39, "'", #! + 40, '(', + 41, ')', + 42, '*', + 43, '+', + 44, ',', + 45, '-', + 46, '.', + 47, '/', + 48, '0', + 49, '1', + 50, '2', + 51, '3', + 52, '4', + 53, '5', + 54, '6', + 55, '7', + 56, '8', + 57, '9', + 58, ':', + 59, ';', + 60, '<', + 61, '=', + 62, '>', + 63, '?', + 64, '@', + 65, 'A', + 66, 'B', + 67, 'C', + 68, 'D', + 69, 'E', + 70, 'F', + 71, 'G', + 72, 'H', + 73, 'I', + 74, 'J', + 75, 'K', + 76, 'L', + 77, 'M', + 78, 'N', + 79, 'O', + 80, 'P', + 81, 'Q', + 82, 'R', + 83, 'S', + 84, 'T', + 85, 'U', + 86, 'V', + 87, 'W', + 88, 'X', + 89, 'Y', + 90, 'Z', + 91, '[', + 92, "\\", #! + 93, ']', + 94, '^', + 95, '_', + 96, '`', + 97, 'a', + 98, 'b', + 99, 'c', + 100, 'd', + 101, 'e', + 102, 'f', + 103, 'g', + 104, 'h', + 105, 'i', + 106, 'j', + 107, 'k', + 108, 'l', + 109, 'm', + 110, 'n', + 111, 'o', + 112, 'p', + 113, 'q', + 114, 'r', + 115, 's', + 116, 't', + 117, 'u', + 118, 'v', + 119, 'w', + 120, 'x', + 121, 'y', + 122, 'z', + 123, '{', + 124, '|', + 125, '}', + 126, '~', +); + +#-------------------------------------------------------------------------- + +%Latin1Code_to_fallback = (); +@Latin1Code_to_fallback{0xA0 .. 0xFF} = ( +# Copied from Text/Unidecode/x00.pm: + +' ', qq{!}, qq{C/}, 'PS', qq{\$?}, qq{Y=}, qq{|}, 'SS', qq{"}, qq{(c)}, 'a', qq{<<}, qq{!}, "", qq{(r)}, qq{-}, +'deg', qq{+-}, '2', '3', qq{'}, 'u', 'P', qq{*}, qq{,}, '1', 'o', qq{>>}, qq{1/4}, qq{1/2}, qq{3/4}, qq{?}, +'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', +'D', 'N', 'O', 'O', 'O', 'O', 'O', 'x', 'O', 'U', 'U', 'U', 'U', 'U', 'Th', 'ss', +'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', +'d', 'n', 'o', 'o', 'o', 'o', 'o', qq{/}, 'o', 'u', 'u', 'u', 'u', 'y', 'th', 'y', + +); + +{ + # Now stuff %Latin1Char_to_fallback: + %Latin1Char_to_fallback = (); + my($k,$v); + while( ($k,$v) = each %Latin1Code_to_fallback) { + $Latin1Char_to_fallback{chr $k} = $v; + #print chr($k), ' => ', $v, "\n"; + } +} + +#-------------------------------------------------------------------------- + +%Name2character_number = ( + # General XML/XHTML: + 'lt' => 60, + 'gt' => 62, + 'quot' => 34, + 'amp' => 38, + 'apos' => 39, + + # POD-specific: + 'sol' => 47, + 'verbar' => 124, + + 'lchevron' => 171, # legacy for laquo + 'rchevron' => 187, # legacy for raquo + + # Remember, grave looks like \ (as in virtu\) + # acute looks like / (as in re/sume/) + # circumflex looks like ^ (as in papier ma^che/) + # umlaut/dieresis looks like " (as in nai"ve, Chloe") + + # From the XHTML 1 .ent files: + 'nbsp' , 160, + 'iexcl' , 161, + 'cent' , 162, + 'pound' , 163, + 'curren' , 164, + 'yen' , 165, + 'brvbar' , 166, + 'sect' , 167, + 'uml' , 168, + 'copy' , 169, + 'ordf' , 170, + 'laquo' , 171, + 'not' , 172, + 'shy' , 173, + 'reg' , 174, + 'macr' , 175, + 'deg' , 176, + 'plusmn' , 177, + 'sup2' , 178, + 'sup3' , 179, + 'acute' , 180, + 'micro' , 181, + 'para' , 182, + 'middot' , 183, + 'cedil' , 184, + 'sup1' , 185, + 'ordm' , 186, + 'raquo' , 187, + 'frac14' , 188, + 'frac12' , 189, + 'frac34' , 190, + 'iquest' , 191, + 'Agrave' , 192, + 'Aacute' , 193, + 'Acirc' , 194, + 'Atilde' , 195, + 'Auml' , 196, + 'Aring' , 197, + 'AElig' , 198, + 'Ccedil' , 199, + 'Egrave' , 200, + 'Eacute' , 201, + 'Ecirc' , 202, + 'Euml' , 203, + 'Igrave' , 204, + 'Iacute' , 205, + 'Icirc' , 206, + 'Iuml' , 207, + 'ETH' , 208, + 'Ntilde' , 209, + 'Ograve' , 210, + 'Oacute' , 211, + 'Ocirc' , 212, + 'Otilde' , 213, + 'Ouml' , 214, + 'times' , 215, + 'Oslash' , 216, + 'Ugrave' , 217, + 'Uacute' , 218, + 'Ucirc' , 219, + 'Uuml' , 220, + 'Yacute' , 221, + 'THORN' , 222, + 'szlig' , 223, + 'agrave' , 224, + 'aacute' , 225, + 'acirc' , 226, + 'atilde' , 227, + 'auml' , 228, + 'aring' , 229, + 'aelig' , 230, + 'ccedil' , 231, + 'egrave' , 232, + 'eacute' , 233, + 'ecirc' , 234, + 'euml' , 235, + 'igrave' , 236, + 'iacute' , 237, + 'icirc' , 238, + 'iuml' , 239, + 'eth' , 240, + 'ntilde' , 241, + 'ograve' , 242, + 'oacute' , 243, + 'ocirc' , 244, + 'otilde' , 245, + 'ouml' , 246, + 'divide' , 247, + 'oslash' , 248, + 'ugrave' , 249, + 'uacute' , 250, + 'ucirc' , 251, + 'uuml' , 252, + 'yacute' , 253, + 'thorn' , 254, + 'yuml' , 255, + + 'fnof' , 402, + 'Alpha' , 913, + 'Beta' , 914, + 'Gamma' , 915, + 'Delta' , 916, + 'Epsilon' , 917, + 'Zeta' , 918, + 'Eta' , 919, + 'Theta' , 920, + 'Iota' , 921, + 'Kappa' , 922, + 'Lambda' , 923, + 'Mu' , 924, + 'Nu' , 925, + 'Xi' , 926, + 'Omicron' , 927, + 'Pi' , 928, + 'Rho' , 929, + 'Sigma' , 931, + 'Tau' , 932, + 'Upsilon' , 933, + 'Phi' , 934, + 'Chi' , 935, + 'Psi' , 936, + 'Omega' , 937, + 'alpha' , 945, + 'beta' , 946, + 'gamma' , 947, + 'delta' , 948, + 'epsilon' , 949, + 'zeta' , 950, + 'eta' , 951, + 'theta' , 952, + 'iota' , 953, + 'kappa' , 954, + 'lambda' , 955, + 'mu' , 956, + 'nu' , 957, + 'xi' , 958, + 'omicron' , 959, + 'pi' , 960, + 'rho' , 961, + 'sigmaf' , 962, + 'sigma' , 963, + 'tau' , 964, + 'upsilon' , 965, + 'phi' , 966, + 'chi' , 967, + 'psi' , 968, + 'omega' , 969, + 'thetasym' , 977, + 'upsih' , 978, + 'piv' , 982, + 'bull' , 8226, + 'hellip' , 8230, + 'prime' , 8242, + 'Prime' , 8243, + 'oline' , 8254, + 'frasl' , 8260, + 'weierp' , 8472, + 'image' , 8465, + 'real' , 8476, + 'trade' , 8482, + 'alefsym' , 8501, + 'larr' , 8592, + 'uarr' , 8593, + 'rarr' , 8594, + 'darr' , 8595, + 'harr' , 8596, + 'crarr' , 8629, + 'lArr' , 8656, + 'uArr' , 8657, + 'rArr' , 8658, + 'dArr' , 8659, + 'hArr' , 8660, + 'forall' , 8704, + 'part' , 8706, + 'exist' , 8707, + 'empty' , 8709, + 'nabla' , 8711, + 'isin' , 8712, + 'notin' , 8713, + 'ni' , 8715, + 'prod' , 8719, + 'sum' , 8721, + 'minus' , 8722, + 'lowast' , 8727, + 'radic' , 8730, + 'prop' , 8733, + 'infin' , 8734, + 'ang' , 8736, + 'and' , 8743, + 'or' , 8744, + 'cap' , 8745, + 'cup' , 8746, + 'int' , 8747, + 'there4' , 8756, + 'sim' , 8764, + 'cong' , 8773, + 'asymp' , 8776, + 'ne' , 8800, + 'equiv' , 8801, + 'le' , 8804, + 'ge' , 8805, + 'sub' , 8834, + 'sup' , 8835, + 'nsub' , 8836, + 'sube' , 8838, + 'supe' , 8839, + 'oplus' , 8853, + 'otimes' , 8855, + 'perp' , 8869, + 'sdot' , 8901, + 'lceil' , 8968, + 'rceil' , 8969, + 'lfloor' , 8970, + 'rfloor' , 8971, + 'lang' , 9001, + 'rang' , 9002, + 'loz' , 9674, + 'spades' , 9824, + 'clubs' , 9827, + 'hearts' , 9829, + 'diams' , 9830, + 'OElig' , 338, + 'oelig' , 339, + 'Scaron' , 352, + 'scaron' , 353, + 'Yuml' , 376, + 'circ' , 710, + 'tilde' , 732, + 'ensp' , 8194, + 'emsp' , 8195, + 'thinsp' , 8201, + 'zwnj' , 8204, + 'zwj' , 8205, + 'lrm' , 8206, + 'rlm' , 8207, + 'ndash' , 8211, + 'mdash' , 8212, + 'lsquo' , 8216, + 'rsquo' , 8217, + 'sbquo' , 8218, + 'ldquo' , 8220, + 'rdquo' , 8221, + 'bdquo' , 8222, + 'dagger' , 8224, + 'Dagger' , 8225, + 'permil' , 8240, + 'lsaquo' , 8249, + 'rsaquo' , 8250, + 'euro' , 8364, +); + + +# Fill out %Name2character... +{ + %Name2character = (); + my($name, $number); + while( ($name, $number) = each %Name2character_number) { + if($] < 5.007 and $number > 255) { + $Name2character{$name} = $FAR_CHAR; + # substitute for Unicode characters, for perls + # that can't reliably handle them + } elsif ($] >= 5.007003) { + $Name2character{$name} = chr utf8::unicode_to_native($number); + # normal case for more recent Perls where we can translate from Unicode + # to the native character set. + } + elsif (exists $Code2USASCII{$number}) { + $Name2character{$name} = $Code2USASCII{$number}; + # on older Perls, we can use the translations we have hard-coded in this + # file, but these don't include the non-ASCII-range characters + } + elsif ($NOT_ASCII && $number > 127 && $number < 256) { + # this range on old non-ASCII-platform perls is wrong + if (exists $Latin1Code_to_fallback{$number}) { + $Name2character{$name} = $Latin1Code_to_fallback{$number}; + } else { + $Name2character{$name} = $FAR_CHAR; + } + } else { + $Name2character{$name} = chr $number; + } + } +} + +#-------------------------------------------------------------------------- +1; +__END__ + +=head1 NAME + +Pod::Escapes - for resolving Pod EE<lt>...E<gt> sequences + +=head1 SYNOPSIS + + use Pod::Escapes qw(e2char); + ...la la la, parsing POD, la la la... + $text = e2char($e_node->label); + unless(defined $text) { + print "Unknown E sequence \"", $e_node->label, "\"!"; + } + ...else print/interpolate $text... + +=head1 DESCRIPTION + +This module provides things that are useful in decoding +Pod EE<lt>...E<gt> sequences. Presumably, it should be used +only by Pod parsers and/or formatters. + +By default, Pod::Escapes exports none of its symbols. But +you can request any of them to be exported. +Either request them individually, as with +C<use Pod::Escapes qw(symbolname symbolname2...);>, +or you can do C<use Pod::Escapes qw(:ALL);> to get all +exportable symbols. + +=head1 GOODIES + +=over + +=item e2char($e_content) + +Given a name or number that could appear in a +C<EE<lt>name_or_numE<gt>> sequence, this returns the string that +it stands for. For example, C<e2char('sol')>, C<e2char('47')>, +C<e2char('0x2F')>, and C<e2char('057')> all return "/", +because C<EE<lt>solE<gt>>, C<EE<lt>47E<gt>>, C<EE<lt>0x2fE<gt>>, +and C<EE<lt>057E<gt>>, all mean "/". If +the name has no known value (as with a name of "qacute") or is +syntactically invalid (as with a name of "1/4"), this returns undef. + +=item e2charnum($e_content) + +Given a name or number that could appear in a +C<EE<lt>name_or_numE<gt>> sequence, this returns the number of +the Unicode character that this stands for. For example, +C<e2char('sol')>, C<e2char('47')>, +C<e2char('0x2F')>, and C<e2char('057')> all return 47, +because C<EE<lt>solE<gt>>, C<EE<lt>47E<gt>>, C<EE<lt>0x2fE<gt>>, +and C<EE<lt>057E<gt>>, all mean "/", whose Unicode number is 47. If +the name has no known value (as with a name of "qacute") or is +syntactically invalid (as with a name of "1/4"), this returns undef. + +=item $Name2character{I<name>} + +Maps from names (as in C<EE<lt>I<name>E<gt>>) like "eacute" or "sol" +to the string that each stands for. Note that this does not +include numerics (like "64" or "x981c"). Under old Perl versions +(before 5.7) you get a "?" in place of characters whose Unicode +value is over 255. + +=item $Name2character_number{I<name>} + +Maps from names (as in C<EE<lt>I<name>E<gt>>) like "eacute" or "sol" +to the Unicode value that each stands for. For example, +C<$Name2character_number{'eacute'}> is 201, and +C<$Name2character_number{'eacute'}> is 8364. You get the correct +Unicode value, regardless of the version of Perl you're using -- +which differs from C<%Name2character>'s behavior under pre-5.7 Perls. + +Note that this hash does not +include numerics (like "64" or "x981c"). + +=item $Latin1Code_to_fallback{I<integer>} + +For numbers in the range 160 (0x00A0) to 255 (0x00FF), this maps +from the character code for a Latin-1 character (like 233 for +lowercase e-acute) to the US-ASCII character that best aproximates +it (like "e"). You may find this useful if you are rendering +POD in a format that you think deals well only with US-ASCII +characters. + +=item $Latin1Char_to_fallback{I<character>} + +Just as above, but maps from characters (like "\xE9", +lowercase e-acute) to characters (like "e"). + +=item $Code2USASCII{I<integer>} + +This maps from US-ASCII codes (like 32) to the corresponding +character (like space, for 32). Only characters 32 to 126 are +defined. This is meant for use by C<e2char($x)> when it senses +that it's running on a non-ASCII platform (where chr(32) doesn't +get you a space -- but $Code2USASCII{32} will). It's +documented here just in case you might find it useful. + +=back + +=head1 CAVEATS + +On Perl versions before 5.7, Unicode characters with a value +over 255 (like lambda or emdash) can't be conveyed. This +module does work under such early Perl versions, but in the +place of each such character, you get a "?". Latin-1 +characters (characters 160-255) are unaffected. + +Under EBCDIC platforms, C<e2char($n)> may not always be the +same as C<chr(e2charnum($n))>, and ditto for +C<$Name2character{$name}> and +C<chr($Name2character_number{$name})>, because the strings are returned as +native, and the numbers are returned as Unicode. +However, for Perls starting with v5.8, C<e2char($n)> is the same as +C<chr(utf8::unicode_to_native(e2charnum($n)))>, and ditto for +C<$Name2character{$name}> and +C<chr(utf8::unicode_to_native($Name2character_number{$name}))>. + +=head1 SEE ALSO + +L<Pod::Browser> - a pod web server based on L<Catalyst>. + +L<Pod::Checker> - check pod documents for syntax errors. + +L<Pod::Coverage> - check if the documentation for a module is comprehensive. + +L<perlpod> - description of pod format (for people documenting with pod). + +L<perlpodspec> - specification of pod format (for people processing it). + +L<Text::Unidecode> - ASCII transliteration of Unicode text. + +=head1 REPOSITORY + +L<https://github.com/neilbowers/Pod-Escapes> + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2001-2004 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +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. + +Portions of the data tables in this module are derived from the +entity declarations in the W3C XHTML specification. + +Currently (October 2001), that's these three: + + http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent + http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent + http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent + +=head1 AUTHOR + +Sean M. Burke C<sburke@cpan.org> + +Now being maintained by Neil Bowers E<lt>neilb@cpan.orgE<gt> + +=cut + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# What I used for reading the XHTML .ent files: + +my(@norms, @good, @bad); +my $dir = 'c:/sgml/docbook/'; +my %escapes; +foreach my $file (qw( + xhtml-symbol.ent + xhtml-lat1.ent + xhtml-special.ent +)) { + open(IN, "<$dir$file") or die "can't read-open $dir$file: $!"; + print "Reading $file...\n"; + while(<IN>) { + if(m/<!ENTITY\s+(\S+)\s+"&#([^;]+);">/) { + my($name, $value) = ($1,$2); + next if $name eq 'quot' or $name eq 'apos' or $name eq 'gt'; + + $value = hex $1 if $value =~ m/^x([a-fA-F0-9]+)$/s; + print "ILLEGAL VALUE $value" unless $value =~ m/^\d+$/s; + if($value > 255) { + push @good , sprintf " %-10s , chr(%s),\n", "'$name'", $value; + push @bad , sprintf " %-10s , \$bad,\n", "'$name'", $value; + } else { + push @norms, sprintf " %-10s , chr(%s),\n", "'$name'", $value; + } + } elsif(m/<!ENT/) { + print "# Skipping $_"; + } + + } + close(IN); +} + +print @norms; +print "\n ( \$] .= 5.006001 ? (\n"; +print @good; +print " ) : (\n"; +print @bad; +print " )\n);\n"; + +__END__ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Functions.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Functions.pm new file mode 100644 index 0000000000000000000000000000000000000000..f4e2a9464c4540d947517815057389c16fa5fdf0 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Functions.pm @@ -0,0 +1,351 @@ +package Pod::Functions; +use strict; + +=head1 NAME + +Pod::Functions - Group Perl's functions a la perlfunc.pod + +=head1 SYNOPSIS + + use Pod::Functions; + + my @misc_ops = @{ $Kinds{ 'Misc' } }; + my $misc_dsc = $Type_Description{ 'Misc' }; + +or + + perl /path/to/lib/Pod/Functions.pm + +This will print a grouped list of Perl's functions, like the +L<perlfunc/"Perl Functions by Category"> section. + +=head1 DESCRIPTION + +It exports the following variables: + +=over 4 + +=item %Kinds + +This holds a hash-of-lists. Each list contains the functions in the category +the key denotes. + +=item %Type + +In this hash each key represents a function and the value is the category. +The category can be a comma separated list. + +=item %Flavor + +In this hash each key represents a function and the value is a short +description of that function. + +=item %Type_Description + +In this hash each key represents a category of functions and the value is +a short description of that category. + +=item @Type_Order + +This list of categories is used to produce the same order as the +L<perlfunc/"Perl Functions by Category"> section. + +=back + +=cut + +our $VERSION = '1.13'; + +require Exporter; + +our @ISA = qw(Exporter); +our @EXPORT = qw(%Kinds %Type %Flavor %Type_Description @Type_Order); + +our(%Kinds, %Type, %Flavor, %Type_Description, @Type_Order); + +foreach ( + [String => 'Functions for SCALARs or strings'], + [Regexp => 'Regular expressions and pattern matching'], + [Math => 'Numeric functions'], + [ARRAY => 'Functions for real @ARRAYs'], + [LIST => 'Functions for list data'], + [HASH => 'Functions for real %HASHes'], + ['I/O' => 'Input and output functions'], + [Binary => 'Functions for fixed-length data or records'], + [File => 'Functions for filehandles, files, or directories'], + [Flow => 'Keywords related to the control flow of your Perl program'], + [Namespace => 'Keywords related to scoping'], + [Misc => 'Miscellaneous functions'], + [Process => 'Functions for processes and process groups'], + [Modules => 'Keywords related to Perl modules'], + [Objects => 'Keywords related to classes and object-orientation'], + [Socket => 'Low-level socket functions'], + [SysV => 'System V interprocess communication functions'], + [User => 'Fetching user and group info'], + [Network => 'Fetching network info'], + [Time => 'Time-related functions'], + ) { + push @Type_Order, $_->[0]; + $Type_Description{$_->[0]} = $_->[1]; +}; + +while (<DATA>) { + chomp; + s/^#.*//; + next unless $_; + my($name, @data) = split "\t", $_; + $Flavor{$name} = pop @data; + $Type{$name} = join ',', @data; + for my $t (@data) { + push @{$Kinds{$t}}, $name; + } +} + +close DATA; + +my( $typedesc, $list ); +unless (caller) { + foreach my $type ( @Type_Order ) { + $list = join(", ", sort @{$Kinds{$type}}); + $typedesc = $Type_Description{$type} . ":"; + write; + } +} + +format = + +^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + $typedesc +~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + $typedesc + ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + $list +. + +1; + +__DATA__ +-X File a file test (-r, -x, etc) +abs Math absolute value function +accept Socket accept an incoming socket connect +alarm Process schedule a SIGALRM +atan2 Math arctangent of Y/X in the range -PI to PI +bind Socket binds an address to a socket +binmode I/O prepare binary files for I/O +bless Objects create an object +break Flow break out of a C<given> block +caller Flow Namespace get context of the current subroutine call +chdir File change your current working directory +chmod File changes the permissions on a list of files +chomp String remove a trailing record separator from a string +chop String remove the last character from a string +chown File change the ownership on a list of files +chr String get character this number represents +chroot File make directory new root for path lookups +close I/O close file (or pipe or socket) handle +closedir I/O close directory handle +connect Socket connect to a remote socket +continue Flow optional trailing block in a while or foreach +cos Math cosine function +crypt String one-way passwd-style encryption +dbmclose I/O Objects breaks binding on a tied dbm file +dbmopen I/O Objects create binding on a tied dbm file +defined Misc test whether a value, variable, or function is defined +delete HASH deletes a value from a hash +die Flow I/O raise an exception or bail out +do Flow Modules turn a BLOCK into a TERM +dump Flow create an immediate core dump +each ARRAY HASH retrieve the next key/value pair from a hash +endgrent User be done using group file +endhostent User be done using hosts file +endnetent User be done using networks file +endprotoent Network be done using protocols file +endpwent User be done using passwd file +endservent Network be done using services file +eof I/O test a filehandle for its end +eval Flow catch exceptions or compile and run code +evalbytes Flow similar to string eval, but intend to parse a bytestream +exec Process abandon this program to run another +exists HASH test whether a hash key is present +exit Flow terminate this program +exp Math raise I<e> to a power +fc String return casefolded version of a string +fcntl File file control system call +__FILE__ Flow the name of the current source file +fileno I/O return file descriptor from filehandle +flock I/O lock an entire file with an advisory lock +fork Process create a new process just like this one +format I/O declare a picture format with use by the write() function +formline Misc internal function used for formats +getc I/O get the next character from the filehandle +getgrent User get next group record +getgrgid User get group record given group user ID +getgrnam User get group record given group name +gethostbyaddr Network get host record given its address +gethostbyname Network get host record given name +gethostent Network get next hosts record +getlogin User return who logged in at this tty +getnetbyaddr Network get network record given its address +getnetbyname Network get networks record given name +getnetent Network get next networks record +getpeername Socket find the other end of a socket connection +getpgrp Process get process group +getppid Process get parent process ID +getpriority Process get current nice value +getprotobyname Network get protocol record given name +getprotobynumber Network get protocol record numeric protocol +getprotoent Network get next protocols record +getpwent User get next passwd record +getpwnam User get passwd record given user login name +getpwuid User get passwd record given user ID +getservbyname Network get services record given its name +getservbyport Network get services record given numeric port +getservent Network get next services record +getsockname Socket retrieve the sockaddr for a given socket +getsockopt Socket get socket options on a given socket +glob File expand filenames using wildcards +gmtime Time convert UNIX time into record or string using Greenwich time +goto Flow create spaghetti code +grep LIST locate elements in a list test true against a given criterion +hex Math String convert a hexadecimal string to a number +import Modules Namespace patch a module's namespace into your own +index String find a substring within a string +int Math get the integer portion of a number +ioctl File system-dependent device control system call +join LIST join a list into a string using a separator +keys ARRAY HASH retrieve list of indices from a hash +kill Process send a signal to a process or process group +last Flow exit a block prematurely +lc String return lower-case version of a string +lcfirst String return a string with just the next letter in lower case +length String return the number of characters in a string +__LINE__ Flow the current source line number +link File create a hard link in the filesystem +listen Socket register your socket as a server +local Namespace create a temporary value for a global variable (dynamic scoping) +localtime Time convert UNIX time into record or string using local time +lock Misc get a thread lock on a variable, subroutine, or method +log Math retrieve the natural logarithm for a number +lstat File stat a symbolic link +m// Regexp match a string with a regular expression pattern +map LIST apply a change to a list to get back a new list with the changes +mkdir File create a directory +msgctl SysV SysV IPC message control operations +msgget SysV get SysV IPC message queue +msgrcv SysV receive a SysV IPC message from a message queue +msgsnd SysV send a SysV IPC message to a message queue +my Namespace declare and assign a local variable (lexical scoping) +next Flow iterate a block prematurely +no Modules unimport some module symbols or semantics at compile time +oct Math String convert a string to an octal number +open File open a file, pipe, or descriptor +opendir File open a directory +ord String find a character's numeric representation +our Namespace declare and assign a package variable (lexical scoping) +pack Binary String convert a list into a binary representation +package Modules Namespace Objects declare a separate global namespace +__PACKAGE__ Flow the current package +pipe Process open a pair of connected filehandles +pop ARRAY remove the last element from an array and return it +pos Regexp find or set the offset for the last/next m//g search +print I/O output a list to a filehandle +printf I/O output a formatted list to a filehandle +prototype Misc get the prototype (if any) of a subroutine +push ARRAY append one or more elements to an array +q/STRING/ String singly quote a string +qq/STRING/ String doubly quote a string +qr/STRING/ Regexp compile pattern +quotemeta Regexp quote regular expression magic characters +qw/STRING/ LIST quote a list of words +qx/STRING/ Process backquote quote a string +rand Math retrieve the next pseudorandom number +read Binary I/O fixed-length buffered input from a filehandle +readdir I/O get a directory from a directory handle +readline I/O fetch a record from a file +readlink File determine where a symbolic link is pointing +readpipe Process execute a system command and collect standard output +recv Socket receive a message over a Socket +redo Flow start this loop iteration over again +ref Objects find out the type of thing being referenced +rename File change a filename +require Modules load in external functions from a library at runtime +reset Misc clear all variables of a given name +return Flow get out of a function early +reverse LIST String flip a string or a list +rewinddir I/O reset directory handle +rindex String right-to-left substring search +rmdir File remove a directory +s/// Regexp replace a pattern with a string +say I/O output a list to a filehandle, appending a newline +scalar Misc force a scalar context +seek I/O reposition file pointer for random-access I/O +seekdir I/O reposition directory pointer +select File I/O reset default output or do I/O multiplexing +semctl SysV SysV semaphore control operations +semget SysV get set of SysV semaphores +semop SysV SysV semaphore operations +send Socket send a message over a socket +setgrent User prepare group file for use +sethostent Network prepare hosts file for use +setnetent Network prepare networks file for use +setpgrp Process set the process group of a process +setpriority Process set a process's nice value +setprotoent Network prepare protocols file for use +setpwent User prepare passwd file for use +setservent Network prepare services file for use +setsockopt Socket set some socket options +shift ARRAY remove the first element of an array, and return it +shmctl SysV SysV shared memory operations +shmget SysV get SysV shared memory segment identifier +shmread SysV read SysV shared memory +shmwrite SysV write SysV shared memory +shutdown Socket close down just half of a socket connection +sin Math return the sine of a number +sleep Process block for some number of seconds +socket Socket create a socket +socketpair Socket create a pair of sockets +sort LIST sort a list of values +splice ARRAY add or remove elements anywhere in an array +split Regexp split up a string using a regexp delimiter +sprintf String formatted print into a string +sqrt Math square root function +srand Math seed the random number generator +stat File get a file's status information +state Namespace declare and assign a persistent lexical variable +study Regexp no-op, formerly optimized input data for repeated searches +sub Flow declare a subroutine, possibly anonymously +__SUB__ Flow the current subroutine, or C<undef> if not in a subroutine +substr String get or alter a portion of a string +symlink File create a symbolic link to a file +syscall Binary I/O execute an arbitrary system call +sysopen File open a file, pipe, or descriptor +sysread Binary I/O fixed-length unbuffered input from a filehandle +sysseek Binary I/O position I/O pointer on handle used with sysread and syswrite +system Process run a separate program +syswrite Binary I/O fixed-length unbuffered output to a filehandle +tell I/O get current seekpointer on a filehandle +telldir I/O get current seekpointer on a directory handle +tie Objects bind a variable to an object class +tied Objects get a reference to the object underlying a tied variable +time Time return number of seconds since 1970 +times Process Time return elapsed time for self and child processes +tr/// String transliterate a string +truncate I/O shorten a file +uc String return upper-case version of a string +ucfirst String return a string with just the next letter in upper case +umask File set file creation mode mask +undef Misc remove a variable or function definition +unlink File remove one link to a file +unpack Binary LIST convert binary structure into normal perl variables +unshift ARRAY prepend more elements to the beginning of a list +untie Objects break a tie binding to a variable +use Modules Namespace Objects load in a module at compile time and import its namespace +utime File set a file's last access and modify times +values ARRAY HASH return a list of the values in a hash +vec Binary test or set particular bits in a string +wait Process wait for any child process to die +waitpid Process wait for a particular child process to die +wantarray Flow get void vs scalar vs list context of current subroutine call +warn I/O print debugging info +write I/O print a picture record +y/// String transliterate a string diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Html.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Html.pm new file mode 100644 index 0000000000000000000000000000000000000000..71555e723ca98f69ec28727a8175eff6d952798f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Html.pm @@ -0,0 +1,845 @@ +package Pod::Html; +use strict; +require Exporter; + +our $VERSION = 1.25; +our @ISA = qw(Exporter); +our @EXPORT = qw(pod2html htmlify); +our @EXPORT_OK = qw(anchorify relativize_url); + +use Carp; +use Config; +use Cwd; +use File::Basename; +use File::Spec; +use File::Spec::Unix; +use Getopt::Long; +use Pod::Simple::Search; +use Pod::Simple::SimpleTree (); +use locale; # make \w work right in non-ASCII lands + +=head1 NAME + +Pod::Html - module to convert pod files to HTML + +=head1 SYNOPSIS + + use Pod::Html; + pod2html([options]); + +=head1 DESCRIPTION + +Converts files from pod format (see L<perlpod>) to HTML format. It +can automatically generate indexes and cross-references, and it keeps +a cache of things it knows how to cross-reference. + +=head1 FUNCTIONS + +=head2 pod2html + + pod2html("pod2html", + "--podpath=lib:ext:pod:vms", + "--podroot=/usr/src/perl", + "--htmlroot=/perl/nmanual", + "--recurse", + "--infile=foo.pod", + "--outfile=/perl/nmanual/foo.html"); + +pod2html takes the following arguments: + +=over 4 + +=item backlink + + --backlink + +Turns every C<head1> heading into a link back to the top of the page. +By default, no backlinks are generated. + +=item cachedir + + --cachedir=name + +Creates the directory cache in the given directory. + +=item css + + --css=stylesheet + +Specify the URL of a cascading style sheet. Also disables all HTML/CSS +C<style> attributes that are output by default (to avoid conflicts). + +=item flush + + --flush + +Flushes the directory cache. + +=item header + + --header + --noheader + +Creates header and footer blocks containing the text of the C<NAME> +section. By default, no headers are generated. + +=item help + + --help + +Displays the usage message. + +=item htmldir + + --htmldir=name + +Sets the directory to which all cross references in the resulting +html file will be relative. Not passing this causes all links to be +absolute since this is the value that tells Pod::Html the root of the +documentation tree. + +Do not use this and --htmlroot in the same call to pod2html; they are +mutually exclusive. + +=item htmlroot + + --htmlroot=name + +Sets the base URL for the HTML files. When cross-references are made, +the HTML root is prepended to the URL. + +Do not use this if relative links are desired: use --htmldir instead. + +Do not pass both this and --htmldir to pod2html; they are mutually +exclusive. + +=item index + + --index + --noindex + +Generate an index at the top of the HTML file. This is the default +behaviour. + +=item infile + + --infile=name + +Specify the pod file to convert. Input is taken from STDIN if no +infile is specified. + +=item outfile + + --outfile=name + +Specify the HTML file to create. Output goes to STDOUT if no outfile +is specified. + +=item poderrors + + --poderrors + --nopoderrors + +Include a "POD ERRORS" section in the outfile if there were any POD +errors in the infile. This section is included by default. + +=item podpath + + --podpath=name:...:name + +Specify which subdirectories of the podroot contain pod files whose +HTML converted forms can be linked to in cross references. + +=item podroot + + --podroot=name + +Specify the base directory for finding library pods. Default is the +current working directory. + +=item quiet + + --quiet + --noquiet + +Don't display I<mostly harmless> warning messages. These messages +will be displayed by default. But this is not the same as C<verbose> +mode. + +=item recurse + + --recurse + --norecurse + +Recurse into subdirectories specified in podpath (default behaviour). + +=item title + + --title=title + +Specify the title of the resulting HTML file. + +=item verbose + + --verbose + --noverbose + +Display progress messages. By default, they won't be displayed. + +=back + +=head2 htmlify + + htmlify($heading); + +Converts a pod section specification to a suitable section specification +for HTML. Note that we keep spaces and special characters except +C<", ?> (Netscape problem) and the hyphen (writer's problem...). + +=head2 anchorify + + anchorify(@heading); + +Similar to C<htmlify()>, but turns non-alphanumerics into underscores. Note +that C<anchorify()> is not exported by default. + +=head1 ENVIRONMENT + +Uses C<$Config{pod2html}> to setup default options. + +=head1 AUTHOR + +Marc Green, E<lt>marcgreen@cpan.orgE<gt>. + +Original version by Tom Christiansen, E<lt>tchrist@perl.comE<gt>. + +=head1 SEE ALSO + +L<perlpod> + +=head1 COPYRIGHT + +This program is distributed under the Artistic License. + +=cut + +# This sub duplicates the guts of Pod::Simple::FromTree. We could have +# used that module, except that it would have been a non-core dependency. +sub feed_tree_to_parser { + my($parser, $tree) = @_; + if(ref($tree) eq "") { + $parser->_handle_text($tree); + } elsif(!($tree->[0] eq "X" && $parser->nix_X_codes)) { + $parser->_handle_element_start($tree->[0], $tree->[1]); + feed_tree_to_parser($parser, $_) foreach @{$tree}[2..$#$tree]; + $parser->_handle_element_end($tree->[0]); + } +} + +my $Cachedir; +my $Dircache; +my($Htmlroot, $Htmldir, $Htmlfile, $Htmlfileurl); +my($Podfile, @Podpath, $Podroot); +my $Poderrors; +my $Css; + +my $Recurse; +my $Quiet; +my $Verbose; +my $Doindex; + +my $Backlink; + +my($Title, $Header); + +my %Pages = (); # associative array used to find the location + # of pages referenced by L<> links. + +my $Curdir = File::Spec->curdir; + +init_globals(); + +sub init_globals { + $Cachedir = "."; # The directory to which directory caches + # will be written. + + $Dircache = "pod2htmd.tmp"; + + $Htmlroot = "/"; # http-server base directory from which all + # relative paths in $podpath stem. + $Htmldir = ""; # The directory to which the html pages + # will (eventually) be written. + $Htmlfile = ""; # write to stdout by default + $Htmlfileurl = ""; # The url that other files would use to + # refer to this file. This is only used + # to make relative urls that point to + # other files. + + $Poderrors = 1; + $Podfile = ""; # read from stdin by default + @Podpath = (); # list of directories containing library pods. + $Podroot = $Curdir; # filesystem base directory from which all + # relative paths in $podpath stem. + $Css = ''; # Cascading style sheet + $Recurse = 1; # recurse on subdirectories in $podpath. + $Quiet = 0; # not quiet by default + $Verbose = 0; # not verbose by default + $Doindex = 1; # non-zero if we should generate an index + $Backlink = 0; # no backlinks added by default + $Header = 0; # produce block header/footer + $Title = undef; # title to give the pod(s) +} + +sub pod2html { + local(@ARGV) = @_; + local $_; + + init_globals(); + parse_command_line(); + + # prevent '//' in urls + $Htmlroot = "" if $Htmlroot eq "/"; + $Htmldir =~ s#/\z##; + + if ( $Htmlroot eq '' + && defined( $Htmldir ) + && $Htmldir ne '' + && substr( $Htmlfile, 0, length( $Htmldir ) ) eq $Htmldir + ) { + # Set the 'base' url for this file, so that we can use it + # as the location from which to calculate relative links + # to other files. If this is '', then absolute links will + # be used throughout. + #$Htmlfileurl = "$Htmldir/" . substr( $Htmlfile, length( $Htmldir ) + 1); + # Is the above not just "$Htmlfileurl = $Htmlfile"? + $Htmlfileurl = Pod::Html::_unixify($Htmlfile); + + } + + # load or generate/cache %Pages + unless (get_cache($Dircache, \@Podpath, $Podroot, $Recurse)) { + # generate %Pages + my $pwd = getcwd(); + chdir($Podroot) || + die "$0: error changing to directory $Podroot: $!\n"; + + # find all pod modules/pages in podpath, store in %Pages + # - callback used to remove Podroot and extension from each file + # - laborious to allow '.' in dirnames (e.g., /usr/share/perl/5.14.1) + Pod::Simple::Search->new->inc(0)->verbose($Verbose)->laborious(1) + ->callback(\&_save_page)->recurse($Recurse)->survey(@Podpath); + + chdir($pwd) || die "$0: error changing to directory $pwd: $!\n"; + + # cache the directory list for later use + warn "caching directories for later use\n" if $Verbose; + open my $cache, '>', $Dircache + or die "$0: error open $Dircache for writing: $!\n"; + + print $cache join(":", @Podpath) . "\n$Podroot\n"; + my $_updirs_only = ($Podroot =~ /\.\./) && !($Podroot =~ /[^\.\\\/]/); + foreach my $key (keys %Pages) { + if($_updirs_only) { + my $_dirlevel = $Podroot; + while($_dirlevel =~ /\.\./) { + $_dirlevel =~ s/\.\.//; + # Assume $Pages{$key} has '/' separators (html dir separators). + $Pages{$key} =~ s/^[\w\s\-\.]+\///; + } + } + print $cache "$key $Pages{$key}\n"; + } + + close $cache or die "error closing $Dircache: $!"; + } + + my $input; + unless (@ARGV && $ARGV[0]) { + if ($Podfile and $Podfile ne '-') { + $input = $Podfile; + } else { + $input = '-'; # XXX: make a test case for this + } + } else { + $Podfile = $ARGV[0]; + $input = *ARGV; + } + + # set options for input parser + my $parser = Pod::Simple::SimpleTree->new; + $parser->codes_in_verbatim(0); + $parser->accept_targets(qw(html HTML)); + $parser->no_errata_section(!$Poderrors); # note the inverse + + warn "Converting input file $Podfile\n" if $Verbose; + my $podtree = $parser->parse_file($input)->root; + + unless(defined $Title) { + if($podtree->[0] eq "Document" && ref($podtree->[2]) eq "ARRAY" && + $podtree->[2]->[0] eq "head1" && @{$podtree->[2]} == 3 && + ref($podtree->[2]->[2]) eq "" && $podtree->[2]->[2] eq "NAME" && + ref($podtree->[3]) eq "ARRAY" && $podtree->[3]->[0] eq "Para" && + @{$podtree->[3]} >= 3 && + !(grep { ref($_) ne "" } + @{$podtree->[3]}[2..$#{$podtree->[3]}]) && + (@$podtree == 4 || + (ref($podtree->[4]) eq "ARRAY" && + $podtree->[4]->[0] eq "head1"))) { + $Title = join("", @{$podtree->[3]}[2..$#{$podtree->[3]}]); + } + } + + $Title //= ""; + $Title = html_escape($Title); + + # set options for the HTML generator + $parser = Pod::Simple::XHTML::LocalPodLinks->new(); + $parser->codes_in_verbatim(0); + $parser->anchor_items(1); # the old Pod::Html always did + $parser->backlink($Backlink); # linkify =head1 directives + $parser->force_title($Title); + $parser->htmldir($Htmldir); + $parser->htmlfileurl($Htmlfileurl); + $parser->htmlroot($Htmlroot); + $parser->index($Doindex); + $parser->output_string(\my $output); # written to file later + $parser->pages(\%Pages); + $parser->quiet($Quiet); + $parser->verbose($Verbose); + + # We need to add this ourselves because we use our own header, not + # ::XHTML's header. We need to set $parser->backlink to linkify + # the =head1 directives + my $bodyid = $Backlink ? ' id="_podtop_"' : ''; + + my $csslink = ''; + my $tdstyle = ' style="background-color: #cccccc; color: #000"'; + + if ($Css) { + $csslink = qq(\n<link rel="stylesheet" href="$Css" type="text/css" />); + $csslink =~ s,\\,/,g; + $csslink =~ s,(/.):,$1|,; + $tdstyle= ''; + } + + # header/footer block + my $block = $Header ? <<END_OF_BLOCK : ''; +<table border="0" width="100%" cellspacing="0" cellpadding="3"> +<tr><td class="_podblock_"$tdstyle valign="middle"> +<big><strong><span class="_podblock_"> $Title</span></strong></big> +</td></tr> +</table> +END_OF_BLOCK + + # create own header/footer because of --header + $parser->html_header(<<"HTMLHEAD"); +<?xml version="1.0" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>$Title$csslink + + + + + +$block +HTMLHEAD + + $parser->html_footer(<<"HTMLFOOT"); +$block + + + +HTMLFOOT + + feed_tree_to_parser($parser, $podtree); + + # Write output to file + $Htmlfile = "-" unless $Htmlfile; # stdout + my $fhout; + if($Htmlfile and $Htmlfile ne '-') { + open $fhout, ">", $Htmlfile + or die "$0: cannot open $Htmlfile file for output: $!\n"; + } else { + open $fhout, ">-"; + } + binmode $fhout, ":utf8"; + print $fhout $output; + close $fhout or die "Failed to close $Htmlfile: $!"; + chmod 0644, $Htmlfile unless $Htmlfile eq '-'; +} + +############################################################################## + +sub usage { + my $podfile = shift; + warn "$0: $podfile: @_\n" if @_; + die < --htmlroot= + --infile= --outfile= + --podpath=:...: --podroot= + --cachedir= --flush --recurse --norecurse + --quiet --noquiet --verbose --noverbose + --index --noindex --backlink --nobacklink + --header --noheader --poderrors --nopoderrors + --css= --title= + + --[no]backlink - turn =head1 directives into links pointing to the top of + the page (off by default). + --cachedir - directory for the directory cache files. + --css - stylesheet URL + --flush - flushes the directory cache. + --[no]header - produce block header/footer (default is no headers). + --help - prints this message. + --htmldir - directory for resulting HTML files. + --htmlroot - http-server base directory from which all relative paths + in podpath stem (default is /). + --[no]index - generate an index at the top of the resulting html + (default behaviour). + --infile - filename for the pod to convert (input taken from stdin + by default). + --outfile - filename for the resulting html file (output sent to + stdout by default). + --[no]poderrors - include a POD ERRORS section in the output if there were + any POD errors in the input (default behavior). + --podpath - colon-separated list of directories containing library + pods (empty by default). + --podroot - filesystem base directory from which all relative paths + in podpath stem (default is .). + --[no]quiet - suppress some benign warning messages (default is off). + --[no]recurse - recurse on those subdirectories listed in podpath + (default behaviour). + --title - title that will appear in resulting html file. + --[no]verbose - self-explanatory (off by default). + +END_OF_USAGE + +} + +sub parse_command_line { + my ($opt_backlink,$opt_cachedir,$opt_css,$opt_flush,$opt_header, + $opt_help,$opt_htmldir,$opt_htmlroot,$opt_index,$opt_infile, + $opt_outfile,$opt_poderrors,$opt_podpath,$opt_podroot, + $opt_quiet,$opt_recurse,$opt_title,$opt_verbose); + + unshift @ARGV, split ' ', $Config{pod2html} if $Config{pod2html}; + my $result = GetOptions( + 'backlink!' => \$opt_backlink, + 'cachedir=s' => \$opt_cachedir, + 'css=s' => \$opt_css, + 'flush' => \$opt_flush, + 'help' => \$opt_help, + 'header!' => \$opt_header, + 'htmldir=s' => \$opt_htmldir, + 'htmlroot=s' => \$opt_htmlroot, + 'index!' => \$opt_index, + 'infile=s' => \$opt_infile, + 'outfile=s' => \$opt_outfile, + 'poderrors!' => \$opt_poderrors, + 'podpath=s' => \$opt_podpath, + 'podroot=s' => \$opt_podroot, + 'quiet!' => \$opt_quiet, + 'recurse!' => \$opt_recurse, + 'title=s' => \$opt_title, + 'verbose!' => \$opt_verbose, + ); + usage("-", "invalid parameters") if not $result; + + usage("-") if defined $opt_help; # see if the user asked for help + $opt_help = ""; # just to make -w shut-up. + + @Podpath = split(":", $opt_podpath) if defined $opt_podpath; + + $Backlink = $opt_backlink if defined $opt_backlink; + $Cachedir = _unixify($opt_cachedir) if defined $opt_cachedir; + $Css = $opt_css if defined $opt_css; + $Header = $opt_header if defined $opt_header; + $Htmldir = _unixify($opt_htmldir) if defined $opt_htmldir; + $Htmlroot = _unixify($opt_htmlroot) if defined $opt_htmlroot; + $Doindex = $opt_index if defined $opt_index; + $Podfile = _unixify($opt_infile) if defined $opt_infile; + $Htmlfile = _unixify($opt_outfile) if defined $opt_outfile; + $Poderrors = $opt_poderrors if defined $opt_poderrors; + $Podroot = _unixify($opt_podroot) if defined $opt_podroot; + $Quiet = $opt_quiet if defined $opt_quiet; + $Recurse = $opt_recurse if defined $opt_recurse; + $Title = $opt_title if defined $opt_title; + $Verbose = $opt_verbose if defined $opt_verbose; + + warn "Flushing directory caches\n" + if $opt_verbose && defined $opt_flush; + $Dircache = "$Cachedir/pod2htmd.tmp"; + if (defined $opt_flush) { + 1 while unlink($Dircache); + } +} + +my $Saved_Cache_Key; + +sub get_cache { + my($dircache, $podpath, $podroot, $recurse) = @_; + my @cache_key_args = @_; + + # A first-level cache: + # Don't bother reading the cache files if they still apply + # and haven't changed since we last read them. + + my $this_cache_key = cache_key(@cache_key_args); + return 1 if $Saved_Cache_Key and $this_cache_key eq $Saved_Cache_Key; + $Saved_Cache_Key = $this_cache_key; + + # load the cache of %Pages if possible. $tests will be + # non-zero if successful. + my $tests = 0; + if (-f $dircache) { + warn "scanning for directory cache\n" if $Verbose; + $tests = load_cache($dircache, $podpath, $podroot); + } + + return $tests; +} + +sub cache_key { + my($dircache, $podpath, $podroot, $recurse) = @_; + return join('!',$dircache,$recurse,@$podpath,$podroot,stat($dircache)); +} + +# +# load_cache - tries to find if the cache stored in $dircache is a valid +# cache of %Pages. if so, it loads them and returns a non-zero value. +# +sub load_cache { + my($dircache, $podpath, $podroot) = @_; + my $tests = 0; + local $_; + + warn "scanning for directory cache\n" if $Verbose; + open(my $cachefh, '<', $dircache) || + die "$0: error opening $dircache for reading: $!\n"; + $/ = "\n"; + + # is it the same podpath? + $_ = <$cachefh>; + chomp($_); + $tests++ if (join(":", @$podpath) eq $_); + + # is it the same podroot? + $_ = <$cachefh>; + chomp($_); + $tests++ if ($podroot eq $_); + + # load the cache if its good + if ($tests != 2) { + close($cachefh); + return 0; + } + + warn "loading directory cache\n" if $Verbose; + while (<$cachefh>) { + /(.*?) (.*)$/; + $Pages{$1} = $2; + } + + close($cachefh); + return 1; +} + + +# +# html_escape: make text safe for HTML +# +sub html_escape { + my $rest = $_[0]; + $rest =~ s/&/&/g; + $rest =~ s//>/g; + $rest =~ s/"/"/g; + $rest =~ s/([[:^print:]])/sprintf("&#x%x;", ord($1))/aeg; + return $rest; +} + +# +# htmlify - converts a pod section specification to a suitable section +# specification for HTML. We adopt the mechanism used by the formatter +# that we use. +# +sub htmlify { + my( $heading) = @_; + return Pod::Simple::XHTML->can("idify")->(undef, $heading, 1); +} + +# +# similar to htmlify, but turns non-alphanumerics into underscores +# +sub anchorify { + my ($anchor) = @_; + $anchor = htmlify($anchor); + $anchor =~ s/\W/_/g; + return $anchor; +} + +# +# store POD files in %Pages +# +sub _save_page { + my ($modspec, $modname) = @_; + + # Remove Podroot from path + $modspec = $Podroot eq File::Spec->curdir + ? File::Spec->abs2rel($modspec) + : File::Spec->abs2rel($modspec, + File::Spec->canonpath($Podroot)); + + # Convert path to unix style path + $modspec = Pod::Html::_unixify($modspec); + + my ($file, $dir) = fileparse($modspec, qr/\.[^.]*/); # strip .ext + $Pages{$modname} = $dir.$file; +} + +sub _unixify { + my $full_path = shift; + return '' unless $full_path; + return $full_path if $full_path eq '/'; + + my ($vol, $dirs, $file) = File::Spec->splitpath($full_path); + my @dirs = $dirs eq File::Spec->curdir() + ? (File::Spec::Unix->curdir()) + : File::Spec->splitdir($dirs); + if (defined($vol) && $vol) { + $vol =~ s/:$// if $^O eq 'VMS'; + $vol = uc $vol if $^O eq 'MSWin32'; + + if( $dirs[0] ) { + unshift @dirs, $vol; + } + else { + $dirs[0] = $vol; + } + } + unshift @dirs, '' if File::Spec->file_name_is_absolute($full_path); + return $file unless scalar(@dirs); + $full_path = File::Spec::Unix->catfile(File::Spec::Unix->catdir(@dirs), + $file); + $full_path =~ s|^\/|| if $^O eq 'MSWin32'; # C:/foo works, /C:/foo doesn't + $full_path =~ s/\^\././g if $^O eq 'VMS'; # unescape dots + return $full_path; +} + +package Pod::Simple::XHTML::LocalPodLinks; +use strict; +use warnings; +use parent 'Pod::Simple::XHTML'; + +use File::Spec; +use File::Spec::Unix; + +__PACKAGE__->_accessorize( + 'htmldir', + 'htmlfileurl', + 'htmlroot', + 'pages', # Page name => relative/path/to/page from root POD dir + 'quiet', + 'verbose', +); + +sub resolve_pod_page_link { + my ($self, $to, $section) = @_; + + return undef unless defined $to || defined $section; + if (defined $section) { + $section = '#' . $self->idify($section, 1); + return $section unless defined $to; + } else { + $section = ''; + } + + my $path; # path to $to according to %Pages + unless (exists $self->pages->{$to}) { + # Try to find a POD that ends with $to and use that. + # e.g., given L, if there is no $Podpath/XHTML in %Pages, + # look for $Podpath/*/XHTML in %Pages, with * being any path, + # as a substitute (e.g., $Podpath/Pod/Simple/XHTML) + my @matches; + foreach my $modname (keys %{$self->pages}) { + push @matches, $modname if $modname =~ /::\Q$to\E\z/; + } + + # make it look like a path instead of a namespace + my $modloc = File::Spec->catfile(split(/::/, $to)); + + if ($#matches == -1) { + warn "Cannot find file \"$modloc.*\" directly under podpath, " . + "cannot find suitable replacement: link remains unresolved.\n" + if $self->verbose; + return ''; + } elsif ($#matches == 0) { + $path = $self->pages->{$matches[0]}; + my $matchloc = File::Spec->catfile(split(/::/, $path)); + warn "Cannot find file \"$modloc.*\" directly under podpath, but ". + "I did find \"$matchloc.*\", so I'll assume that is what you ". + "meant to link to.\n" + if $self->verbose; + } else { + # Use [-1] so newer (higher numbered) perl PODs are used + # XXX currently, @matches isn't sorted so this is not true + $path = $self->pages->{$matches[-1]}; + my $matchloc = File::Spec->catfile(split(/::/, $path)); + warn "Cannot find file \"$modloc.*\" directly under podpath, but ". + "I did find \"$matchloc.*\" (among others), so I'll use that " . + "to resolve the link.\n" if $self->verbose; + } + } else { + $path = $self->pages->{$to}; + } + + my $url = File::Spec::Unix->catfile(Pod::Html::_unixify($self->htmlroot), + $path); + + if ($self->htmlfileurl ne '') { + # then $self->htmlroot eq '' (by definition of htmlfileurl) so + # $self->htmldir needs to be prepended to link to get the absolute path + # that will be relativized + $url = Pod::Html::relativize_url( + File::Spec::Unix->catdir(Pod::Html::_unixify($self->htmldir), $url), + $self->htmlfileurl # already unixified + ); + } + + return $url . ".html$section"; +} + +package Pod::Html; + +# +# relativize_url - convert an absolute URL to one relative to a base URL. +# Assumes both end in a filename. +# +sub relativize_url { + my ($dest, $source) = @_; + + # Remove each file from its path + my ($dest_volume, $dest_directory, $dest_file) = + File::Spec::Unix->splitpath( $dest ); + $dest = File::Spec::Unix->catpath( $dest_volume, $dest_directory, '' ); + + my ($source_volume, $source_directory, $source_file) = + File::Spec::Unix->splitpath( $source ); + $source = File::Spec::Unix->catpath( $source_volume, $source_directory, '' ); + + my $rel_path = ''; + if ($dest ne '') { + $rel_path = File::Spec::Unix->abs2rel( $dest, $source ); + } + + if ($rel_path ne '' && substr( $rel_path, -1 ) ne '/') { + $rel_path .= "/$dest_file"; + } else { + $rel_path .= "$dest_file"; + } + + return $rel_path; +} + +1; diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Man.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Man.pm new file mode 100644 index 0000000000000000000000000000000000000000..d7c029357a295fc238b3b5502d9fc7eb83d41149 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Man.pm @@ -0,0 +1,2044 @@ +# Convert POD data to formatted *roff input. +# +# This module translates POD documentation into *roff markup using the man +# macro set, and is intended for converting POD documents written as Unix +# manual pages to manual pages that can be read by the man(1) command. It is +# a replacement for the pod2man command distributed with versions of Perl +# prior to 5.6. +# +# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl + +############################################################################## +# Modules and declarations +############################################################################## + +package Pod::Man; + +use 5.008; +use strict; +use warnings; + +use subs qw(makespace); +use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION); + +use Carp qw(carp croak); +use Pod::Simple (); + +# Conditionally import Encode and set $HAS_ENCODE if it is available. This is +# required to support building as part of Perl core, since podlators is built +# before Encode is. +our $HAS_ENCODE; +BEGIN { + $HAS_ENCODE = eval { require Encode }; +} + +@ISA = qw(Pod::Simple); + +$VERSION = '4.14'; + +# Set the debugging level. If someone has inserted a debug function into this +# class already, use that. Otherwise, use any Pod::Simple debug function +# that's defined, and failing that, define a debug level of 10. +BEGIN { + my $parent = defined (&Pod::Simple::DEBUG) ? \&Pod::Simple::DEBUG : undef; + unless (defined &DEBUG) { + *DEBUG = $parent || sub () { 10 }; + } +} + +# Import the ASCII constant from Pod::Simple. This is true iff we're in an +# ASCII-based universe (including such things as ISO 8859-1 and UTF-8), and is +# generally only false for EBCDIC. +BEGIN { *ASCII = \&Pod::Simple::ASCII } + +# Pretty-print a data structure. Only used for debugging. +BEGIN { *pretty = \&Pod::Simple::pretty } + +# Formatting instructions for various types of blocks. cleanup makes hyphens +# hard, adds spaces between consecutive underscores, and escapes backslashes. +# convert translates characters into escapes. guesswork means to apply the +# transformations done by the guesswork sub. literal says to protect literal +# quotes from being turned into UTF-8 quotes. By default, all transformations +# are on except literal, but some elements override. +# +# DEFAULT specifies the default settings. All other elements should list only +# those settings that they are overriding. Data indicates =for roff blocks, +# which should be passed along completely verbatim. +# +# Formatting inherits negatively, in the sense that if the parent has turned +# off guesswork, all child elements should leave it off. +my %FORMATTING = ( + DEFAULT => { cleanup => 1, convert => 1, guesswork => 1, literal => 0 }, + Data => { cleanup => 0, convert => 0, guesswork => 0, literal => 0 }, + Verbatim => { guesswork => 0, literal => 1 }, + C => { guesswork => 0, literal => 1 }, + X => { cleanup => 0, guesswork => 0 }, +); + +############################################################################## +# Object initialization +############################################################################## + +# Initialize the object and set various Pod::Simple options that we need. +# Here, we also process any additional options passed to the constructor or +# set up defaults if none were given. Note that all internal object keys are +# in all-caps, reserving all lower-case object keys for Pod::Simple and user +# arguments. +sub new { + my $class = shift; + my $self = $class->SUPER::new; + + # Tell Pod::Simple not to handle S<> by automatically inserting  . + $self->nbsp_for_S (1); + + # Tell Pod::Simple to keep whitespace whenever possible. + if (my $preserve_whitespace = $self->can ('preserve_whitespace')) { + $self->$preserve_whitespace (1); + } else { + $self->fullstop_space_harden (1); + } + + # The =for and =begin targets that we accept. + $self->accept_targets (qw/man MAN roff ROFF/); + + # Ensure that contiguous blocks of code are merged together. Otherwise, + # some of the guesswork heuristics don't work right. + $self->merge_text (1); + + # Pod::Simple doesn't do anything useful with our arguments, but we want + # to put them in our object as hash keys and values. This could cause + # problems if we ever clash with Pod::Simple's own internal class + # variables. + %$self = (%$self, @_); + + # Send errors to stderr if requested. + if ($$self{stderr} and not $$self{errors}) { + $$self{errors} = 'stderr'; + } + delete $$self{stderr}; + + # Validate the errors parameter and act on it. + if (not defined $$self{errors}) { + $$self{errors} = 'pod'; + } + if ($$self{errors} eq 'stderr' || $$self{errors} eq 'die') { + $self->no_errata_section (1); + $self->complain_stderr (1); + if ($$self{errors} eq 'die') { + $$self{complain_die} = 1; + } + } elsif ($$self{errors} eq 'pod') { + $self->no_errata_section (0); + $self->complain_stderr (0); + } elsif ($$self{errors} eq 'none') { + $self->no_errata_section (1); + $self->no_whining (1); + } else { + croak (qq(Invalid errors setting: "$$self{errors}")); + } + delete $$self{errors}; + + # Degrade back to non-utf8 if Encode is not available. + # + # Suppress the warning message when PERL_CORE is set, indicating this is + # running as part of the core Perl build. Perl builds podlators (and all + # pure Perl modules) before Encode and other XS modules, so Encode won't + # yet be available. Rely on the Perl core build to generate man pages + # later, after all the modules are available, so that UTF-8 handling will + # be correct. + if ($$self{utf8} and !$HAS_ENCODE) { + if (!$ENV{PERL_CORE}) { + carp ('utf8 mode requested but Encode module not available,' + . ' falling back to non-utf8'); + } + delete $$self{utf8}; + } + + # Initialize various other internal constants based on our arguments. + $self->init_fonts; + $self->init_quotes; + $self->init_page; + + # For right now, default to turning on all of the magic. + $$self{MAGIC_CPP} = 1; + $$self{MAGIC_EMDASH} = 1; + $$self{MAGIC_FUNC} = 1; + $$self{MAGIC_MANREF} = 1; + $$self{MAGIC_SMALLCAPS} = 1; + $$self{MAGIC_VARS} = 1; + + return $self; +} + +# Translate a font string into an escape. +sub toescape { (length ($_[0]) > 1 ? '\f(' : '\f') . $_[0] } + +# Determine which fonts the user wishes to use and store them in the object. +# Regular, italic, bold, and bold-italic are constants, but the fixed width +# fonts may be set by the user. Sets the internal hash key FONTS which is +# used to map our internal font escapes to actual *roff sequences later. +sub init_fonts { + my ($self) = @_; + + # Figure out the fixed-width font. If user-supplied, make sure that they + # are the right length. + for (qw/fixed fixedbold fixeditalic fixedbolditalic/) { + my $font = $$self{$_}; + if (defined ($font) && (length ($font) < 1 || length ($font) > 2)) { + croak qq(roff font should be 1 or 2 chars, not "$font"); + } + } + + # Set the default fonts. We can't be sure portably across different + # implementations what fixed bold-italic may be called (if it's even + # available), so default to just bold. + $$self{fixed} ||= 'CW'; + $$self{fixedbold} ||= 'CB'; + $$self{fixeditalic} ||= 'CI'; + $$self{fixedbolditalic} ||= 'CB'; + + # Set up a table of font escapes. First number is fixed-width, second is + # bold, third is italic. + $$self{FONTS} = { '000' => '\fR', '001' => '\fI', + '010' => '\fB', '011' => '\f(BI', + '100' => toescape ($$self{fixed}), + '101' => toescape ($$self{fixeditalic}), + '110' => toescape ($$self{fixedbold}), + '111' => toescape ($$self{fixedbolditalic}) }; +} + +# Initialize the quotes that we'll be using for C<> text. This requires some +# special handling, both to parse the user parameters if given and to make +# sure that the quotes will be safe against *roff. Sets the internal hash +# keys LQUOTE and RQUOTE. +sub init_quotes { + my ($self) = (@_); + + # Handle the quotes option first, which sets both quotes at once. + $$self{quotes} ||= '"'; + if ($$self{quotes} eq 'none') { + $$self{LQUOTE} = $$self{RQUOTE} = ''; + } elsif (length ($$self{quotes}) == 1) { + $$self{LQUOTE} = $$self{RQUOTE} = $$self{quotes}; + } elsif (length ($$self{quotes}) % 2 == 0) { + my $length = length ($$self{quotes}) / 2; + $$self{LQUOTE} = substr ($$self{quotes}, 0, $length); + $$self{RQUOTE} = substr ($$self{quotes}, $length); + } else { + croak(qq(Invalid quote specification "$$self{quotes}")) + } + + # Now handle the lquote and rquote options. + if (defined $$self{lquote}) { + $$self{LQUOTE} = $$self{lquote} eq 'none' ? q{} : $$self{lquote}; + } + if (defined $$self{rquote}) { + $$self{RQUOTE} = $$self{rquote} eq 'none' ? q{} : $$self{rquote}; + } + + # Double the first quote; note that this should not be s///g as two double + # quotes is represented in *roff as three double quotes, not four. Weird, + # I know. + $$self{LQUOTE} =~ s/\"/\"\"/; + $$self{RQUOTE} =~ s/\"/\"\"/; +} + +# Initialize the page title information and indentation from our arguments. +sub init_page { + my ($self) = @_; + + # Get the version from the running Perl. + my @version = ($] =~ /^(\d+)\.(\d{3})(\d+)$/); + for (@version) { $_ += 0 } + my $version = join ('.', @version); + + # Set the defaults for page titles and indentation if the user didn't + # override anything. + $$self{center} = 'User Contributed Perl Documentation' + unless defined $$self{center}; + $$self{release} = 'perl v' . $version + unless defined $$self{release}; + $$self{indent} = 4 + unless defined $$self{indent}; + + # Double quotes in things that will be quoted. + for (qw/center release/) { + $$self{$_} =~ s/\"/\"\"/g if $$self{$_}; + } +} + +############################################################################## +# Core parsing +############################################################################## + +# This is the glue that connects the code below with Pod::Simple itself. The +# goal is to convert the event stream coming from the POD parser into method +# calls to handlers once the complete content of a tag has been seen. Each +# paragraph or POD command will have textual content associated with it, and +# as soon as all of a paragraph or POD command has been seen, that content +# will be passed in to the corresponding method for handling that type of +# object. The exceptions are handlers for lists, which have opening tag +# handlers and closing tag handlers that will be called right away. +# +# The internal hash key PENDING is used to store the contents of a tag until +# all of it has been seen. It holds a stack of open tags, each one +# represented by a tuple of the attributes hash for the tag, formatting +# options for the tag (which are inherited), and the contents of the tag. + +# Add a block of text to the contents of the current node, formatting it +# according to the current formatting instructions as we do. +sub _handle_text { + my ($self, $text) = @_; + DEBUG > 3 and print "== $text\n"; + my $tag = $$self{PENDING}[-1]; + $$tag[2] .= $self->format_text ($$tag[1], $text); +} + +# Given an element name, get the corresponding method name. +sub method_for_element { + my ($self, $element) = @_; + $element =~ tr/A-Z-/a-z_/; + $element =~ tr/_a-z0-9//cd; + return $element; +} + +# Handle the start of a new element. If cmd_element is defined, assume that +# we need to collect the entire tree for this element before passing it to the +# element method, and create a new tree into which we'll collect blocks of +# text and nested elements. Otherwise, if start_element is defined, call it. +sub _handle_element_start { + my ($self, $element, $attrs) = @_; + DEBUG > 3 and print "++ $element (<", join ('> <', %$attrs), ">)\n"; + my $method = $self->method_for_element ($element); + + # If we have a command handler, we need to accumulate the contents of the + # tag before calling it. Turn off IN_NAME for any command other than + # and the formatting codes so that IN_NAME isn't still set for the + # first heading after the NAME heading. + if ($self->can ("cmd_$method")) { + DEBUG > 2 and print "<$element> starts saving a tag\n"; + $$self{IN_NAME} = 0 if ($element ne 'Para' && length ($element) > 1); + + # How we're going to format embedded text blocks depends on the tag + # and also depends on our parent tags. Thankfully, inside tags that + # turn off guesswork and reformatting, nothing else can turn it back + # on, so this can be strictly inherited. + my $formatting = { + %{ $$self{PENDING}[-1][1] || $FORMATTING{DEFAULT} }, + %{ $FORMATTING{$element} || {} }, + }; + push (@{ $$self{PENDING} }, [ $attrs, $formatting, '' ]); + DEBUG > 4 and print "Pending: [", pretty ($$self{PENDING}), "]\n"; + } elsif (my $start_method = $self->can ("start_$method")) { + $self->$start_method ($attrs, ''); + } else { + DEBUG > 2 and print "No $method start method, skipping\n"; + } +} + +# Handle the end of an element. If we had a cmd_ method for this element, +# this is where we pass along the tree that we built. Otherwise, if we have +# an end_ method for the element, call that. +sub _handle_element_end { + my ($self, $element) = @_; + DEBUG > 3 and print "-- $element\n"; + my $method = $self->method_for_element ($element); + + # If we have a command handler, pull off the pending text and pass it to + # the handler along with the saved attribute hash. + if (my $cmd_method = $self->can ("cmd_$method")) { + DEBUG > 2 and print " stops saving a tag\n"; + my $tag = pop @{ $$self{PENDING} }; + DEBUG > 4 and print "Popped: [", pretty ($tag), "]\n"; + DEBUG > 4 and print "Pending: [", pretty ($$self{PENDING}), "]\n"; + my $text = $self->$cmd_method ($$tag[0], $$tag[2]); + if (defined $text) { + if (@{ $$self{PENDING} } > 1) { + $$self{PENDING}[-1][2] .= $text; + } else { + $self->output ($text); + } + } + } elsif (my $end_method = $self->can ("end_$method")) { + $self->$end_method (); + } else { + DEBUG > 2 and print "No $method end method, skipping\n"; + } +} + +############################################################################## +# General formatting +############################################################################## + +# Format a text block. Takes a hash of formatting options and the text to +# format. Currently, the only formatting options are guesswork, cleanup, and +# convert, all of which are boolean. +sub format_text { + my ($self, $options, $text) = @_; + my $guesswork = $$options{guesswork} && !$$self{IN_NAME}; + my $cleanup = $$options{cleanup}; + my $convert = $$options{convert}; + my $literal = $$options{literal}; + + # Cleanup just tidies up a few things, telling *roff that the hyphens are + # hard, putting a bit of space between consecutive underscores, and + # escaping backslashes. Be careful not to mangle our character + # translations by doing this before processing character translation. + if ($cleanup) { + $text =~ s/\\/\\e/g; + $text =~ s/-/\\-/g; + $text =~ s/_(?=_)/_\\|/g; + } + + # Normally we do character translation, but we won't even do that in + # blocks or if UTF-8 output is desired. + if ($convert && !$$self{utf8} && ASCII) { + $text =~ s/([^\x00-\x7F])/$ESCAPES{ord ($1)} || "X"/eg; + } + + # Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes, + # but don't mess up our accept escapes. + if ($literal) { + $text =~ s/(?guesswork ($text); + } + + return $text; +} + +# Handles C<> text, deciding whether to put \*C` around it or not. This is a +# whole bunch of messy heuristics to try to avoid overquoting, originally from +# Barrie Slaymaker. This largely duplicates similar code in Pod::Text. +sub quote_literal { + my $self = shift; + local $_ = shift; + + # A regex that matches the portion of a variable reference that's the + # array or hash index, separated out just because we want to use it in + # several places in the following regex. + my $index = '(?: \[.*\] | \{.*\} )?'; + + # If in NAME section, just return an ASCII quoted string to avoid + # confusing tools like whatis. + return qq{"$_"} if $$self{IN_NAME}; + + # Check for things that we don't want to quote, and if we find any of + # them, return the string with just a font change and no quoting. + m{ + ^\s* + (?: + ( [\'\`\"] ) .* \1 # already quoted + | \\\*\(Aq .* \\\*\(Aq # quoted and escaped + | \\?\` .* ( \' | \\\*\(Aq ) # `quoted' + | \$+ [\#^]? \S $index # special ($^Foo, $") + | [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func + | [\$\@%&*]* [:\'\w]+ (?: -> )? \(\s*[^\s,]\s*\) # 0/1-arg func call + | [-+]? ( \d[\d.]* | \.\d+ ) (?: [eE][-+]?\d+ )? # a number + | 0x [a-fA-F\d]+ # a hex constant + ) + \s*\z + }xso and return '\f(FS' . $_ . '\f(FE'; + + # If we didn't return, go ahead and quote the text. + return '\f(FS\*(C`' . $_ . "\\*(C'\\f(FE"; +} + +# Takes a text block to perform guesswork on. Returns the text block with +# formatting codes added. This is the code that marks up various Perl +# constructs and things commonly used in man pages without requiring the user +# to add any explicit markup, and is applied to all non-literal text. We're +# guaranteed that the text we're applying guesswork to does not contain any +# *roff formatting codes. Note that the inserted font sequences must be +# treated later with mapfonts or textmapfonts. +# +# This method is very fragile, both in the regular expressions it uses and in +# the ordering of those modifications. Care and testing is required when +# modifying it. +sub guesswork { + my $self = shift; + local $_ = shift; + DEBUG > 5 and print " Guesswork called on [$_]\n"; + + # By the time we reach this point, all hyphens will be escaped by adding a + # backslash. We want to undo that escaping if they're part of regular + # words and there's only a single dash, since that's a real hyphen that + # *roff gets to consider a possible break point. Make sure that a dash + # after the first character of a word stays non-breaking, however. + # + # Note that this is not user-controllable; we pretty much have to do this + # transformation or *roff will mangle the output in unacceptable ways. + s{ + ( (?:\G|^|\s) [\(\"]* [a-zA-Z] ) ( \\- )? + ( (?: [a-zA-Z\']+ \\-)+ ) + ( [a-zA-Z\']+ ) (?= [\)\".?!,;:]* (?:\s|\Z|\\\ ) ) + \b + } { + my ($prefix, $hyphen, $main, $suffix) = ($1, $2, $3, $4); + $hyphen ||= ''; + $main =~ s/\\-/-/g; + $prefix . $hyphen . $main . $suffix; + }egx; + + # Translate "--" into a real em-dash if it's used like one. This means + # that it's either surrounded by whitespace, it follows a regular word, or + # it occurs between two regular words. + if ($$self{MAGIC_EMDASH}) { + s{ (\s) \\-\\- (\s) } { $1 . '\*(--' . $2 }egx; + s{ (\b[a-zA-Z]+) \\-\\- (\s|\Z|[a-zA-Z]+\b) } { $1 . '\*(--' . $2 }egx; + } + + # Make words in all-caps a little bit smaller; they look better that way. + # However, we don't want to change Perl code (like @ARGV), nor do we want + # to fix the MIME in MIME-Version since it looks weird with the + # full-height V. + # + # We change only a string of all caps (2) either at the beginning of the + # line or following regular punctuation (like quotes) or whitespace (1), + # and followed by either similar punctuation, an em-dash, or the end of + # the line (3). + # + # Allow the text we're changing to small caps to include double quotes, + # commas, newlines, and periods as long as it doesn't otherwise interrupt + # the string of small caps and still fits the criteria. This lets us turn + # entire warranty disclaimers in man page output into small caps. + if ($$self{MAGIC_SMALLCAPS}) { + s{ + ( ^ | [\s\(\"\'\`\[\{<>] | \\[ ] ) # (1) + ( [A-Z] [A-Z] (?: \s? [/A-Z+:\d_\$&] | \\- | \s? [.,\"] )* ) # (2) + (?= [\s>\}\]\(\)\'\".?!,;] | \\*\(-- | \\[ ] | $ ) # (3) + } { + $1 . '\s-1' . $2 . '\s0' + }egx; + } + + # Note that from this point forward, we have to adjust for \s-1 and \s-0 + # strings inserted around things that we've made small-caps if later + # transforms should work on those strings. + + # Embolden functions in the form func(), including functions that are in + # all capitals, but don't embolden if there's anything between the parens. + # The function must start with an alphabetic character or underscore and + # then consist of word characters or colons. + if ($$self{MAGIC_FUNC}) { + s{ + ( \b | \\s-1 ) + ( [A-Za-z_] ([:\w] | \\s-?[01])+ \(\) ) + } { + $1 . '\f(BS' . $2 . '\f(BE' + }egx; + } + + # Change references to manual pages to put the page name in bold but + # the number in the regular font, with a thin space between the name and + # the number. Only recognize func(n) where func starts with an alphabetic + # character or underscore and contains only word characters, periods (for + # configuration file man pages), or colons, and n is a single digit, + # optionally followed by some number of lowercase letters. Note that this + # does not recognize man page references like perl(l) or socket(3SOCKET). + if ($$self{MAGIC_MANREF}) { + s{ + ( \b | \\s-1 ) + (? 5 and print " Guesswork returning [$_]\n"; + return $_; +} + +############################################################################## +# Output +############################################################################## + +# When building up the *roff code, we don't use real *roff fonts. Instead, we +# embed font codes of the form \f([SE] where is one of B, I, or +# F, S stands for start, and E stands for end. This method turns these into +# the right start and end codes. +# +# We add this level of complexity because the old pod2man didn't get code like +# B else> right; after I<> it switched back to normal text rather +# than bold. We take care of this by using variables that state whether bold, +# italic, or fixed are turned on as a combined pointer to our current font +# sequence, and set each to the number of current nestings of start tags for +# that font. +# +# \fP changes to the previous font, but only one previous font is kept. We +# don't know what the outside level font is; normally it's R, but if we're +# inside a heading it could be something else. So arrange things so that the +# outside font is always the "previous" font and end with \fP instead of \fR. +# Idea from Zack Weinberg. +sub mapfonts { + my ($self, $text) = @_; + my ($fixed, $bold, $italic) = (0, 0, 0); + my %magic = (F => \$fixed, B => \$bold, I => \$italic); + my $last = '\fR'; + $text =~ s< + \\f\((.)(.) + > < + my $sequence = ''; + my $f; + if ($last ne '\fR') { $sequence = '\fP' } + ${ $magic{$1} } += ($2 eq 'S') ? 1 : -1; + $f = $$self{FONTS}{ ($fixed && 1) . ($bold && 1) . ($italic && 1) }; + if ($f eq $last) { + ''; + } else { + if ($f ne '\fR') { $sequence .= $f } + $last = $f; + $sequence; + } + >gxe; + return $text; +} + +# Unfortunately, there is a bug in Solaris 2.6 nroff (not present in GNU +# groff) where the sequence \fB\fP\f(CW\fP leaves the font set to B rather +# than R, presumably because \f(CW doesn't actually do a font change. To work +# around this, use a separate textmapfonts for text blocks where the default +# font is always R and only use the smart mapfonts for headings. +sub textmapfonts { + my ($self, $text) = @_; + my ($fixed, $bold, $italic) = (0, 0, 0); + my %magic = (F => \$fixed, B => \$bold, I => \$italic); + $text =~ s< + \\f\((.)(.) + > < + ${ $magic{$1} } += ($2 eq 'S') ? 1 : -1; + $$self{FONTS}{ ($fixed && 1) . ($bold && 1) . ($italic && 1) }; + >gxe; + return $text; +} + +# Given a command and a single argument that may or may not contain double +# quotes, handle double-quote formatting for it. If there are no double +# quotes, just return the command followed by the argument in double quotes. +# If there are double quotes, use an if statement to test for nroff, and for +# nroff output the command followed by the argument in double quotes with +# embedded double quotes doubled. For other formatters, remap paired double +# quotes to LQUOTE and RQUOTE. +sub switchquotes { + my ($self, $command, $text, $extra) = @_; + $text =~ s/\\\*\([LR]\"/\"/g; + + # We also have to deal with \*C` and \*C', which are used to add the + # quotes around C<> text, since they may expand to " and if they do this + # confuses the .SH macros and the like no end. Expand them ourselves. + # Also separate troff from nroff if there are any fixed-width fonts in use + # to work around problems with Solaris nroff. + my $c_is_quote = ($$self{LQUOTE} =~ /\"/) || ($$self{RQUOTE} =~ /\"/); + my $fixedpat = join '|', @{ $$self{FONTS} }{'100', '101', '110', '111'}; + $fixedpat =~ s/\\/\\\\/g; + $fixedpat =~ s/\(/\\\(/g; + if ($text =~ m/\"/ || $text =~ m/$fixedpat/) { + $text =~ s/\"/\"\"/g; + my $nroff = $text; + my $troff = $text; + $troff =~ s/\"\"([^\"]*)\"\"/\`\`$1\'\'/g; + if ($c_is_quote and $text =~ m/\\\*\(C[\'\`]/) { + $nroff =~ s/\\\*\(C\`/$$self{LQUOTE}/g; + $nroff =~ s/\\\*\(C\'/$$self{RQUOTE}/g; + $troff =~ s/\\\*\(C[\'\`]//g; + } + $nroff = qq("$nroff") . ($extra ? " $extra" : ''); + $troff = qq("$troff") . ($extra ? " $extra" : ''); + + # Work around the Solaris nroff bug where \f(CW\fP leaves the font set + # to Roman rather than the actual previous font when used in headings. + # troff output may still be broken, but at least we can fix nroff by + # just switching the font changes to the non-fixed versions. + my $font_end = "(?:\\f[PR]|\Q$$self{FONTS}{100}\E)"; + $nroff =~ s/\Q$$self{FONTS}{100}\E(.*?)\\f([PR])/$1/g; + $nroff =~ s/\Q$$self{FONTS}{101}\E(.*?)$font_end/\\fI$1\\fP/g; + $nroff =~ s/\Q$$self{FONTS}{110}\E(.*?)$font_end/\\fB$1\\fP/g; + $nroff =~ s/\Q$$self{FONTS}{111}\E(.*?)$font_end/\\f\(BI$1\\fP/g; + + # Now finally output the command. Bother with .ie only if the nroff + # and troff output aren't the same. + if ($nroff ne $troff) { + return ".ie n $command $nroff\n.el $command $troff\n"; + } else { + return "$command $nroff\n"; + } + } else { + $text = qq("$text") . ($extra ? " $extra" : ''); + return "$command $text\n"; + } +} + +# Protect leading quotes and periods against interpretation as commands. Also +# protect anything starting with a backslash, since it could expand or hide +# something that *roff would interpret as a command. This is overkill, but +# it's much simpler than trying to parse *roff here. +sub protect { + my ($self, $text) = @_; + $text =~ s/^([.\'\\])/\\&$1/mg; + return $text; +} + +# Make vertical whitespace if NEEDSPACE is set, appropriate to the indentation +# level the situation. This function is needed since in *roff one has to +# create vertical whitespace after paragraphs and between some things, but +# other macros create their own whitespace. Also close out a sequence of +# repeated =items, since calling makespace means we're about to begin the item +# body. +sub makespace { + my ($self) = @_; + $self->output (".PD\n") if $$self{ITEMS} > 1; + $$self{ITEMS} = 0; + $self->output ($$self{INDENT} > 0 ? ".Sp\n" : ".PP\n") + if $$self{NEEDSPACE}; +} + +# Output any pending index entries, and optionally an index entry given as an +# argument. Support multiple index entries in X<> separated by slashes, and +# strip special escapes from index entries. +sub outindex { + my ($self, $section, $index) = @_; + my @entries = map { split m%\s*/\s*% } @{ $$self{INDEX} }; + return unless ($section || @entries); + + # We're about to output all pending entries, so clear our pending queue. + $$self{INDEX} = []; + + # Build the output. Regular index entries are marked Xref, and headings + # pass in their own section. Undo some *roff formatting on headings. + my @output; + if (@entries) { + push @output, [ 'Xref', join (' ', @entries) ]; + } + if ($section) { + $index =~ s/\\-/-/g; + $index =~ s/\\(?:s-?\d|.\(..|.)//g; + push @output, [ $section, $index ]; + } + + # Print out the .IX commands. + for (@output) { + my ($type, $entry) = @$_; + $entry =~ s/\s+/ /g; + $entry =~ s/\"/\"\"/g; + $entry =~ s/\\/\\\\/g; + $self->output (".IX $type " . '"' . $entry . '"' . "\n"); + } +} + +# Output some text, without any additional changes. +sub output { + my ($self, @text) = @_; + if ($$self{ENCODE}) { + print { $$self{output_fh} } Encode::encode ('UTF-8', join ('', @text)); + } else { + print { $$self{output_fh} } @text; + } +} + +############################################################################## +# Document initialization +############################################################################## + +# Handle the start of the document. Here we handle empty documents, as well +# as setting up our basic macros in a preamble and building the page title. +sub start_document { + my ($self, $attrs) = @_; + if ($$attrs{contentless} && !$$self{ALWAYS_EMIT_SOMETHING}) { + DEBUG and print "Document is contentless\n"; + $$self{CONTENTLESS} = 1; + } else { + delete $$self{CONTENTLESS}; + } + + # When UTF-8 output is set, check whether our output file handle already + # has a PerlIO encoding layer set. If it does not, we'll need to encode + # our output before printing it (handled in the output() sub). Wrap the + # check in an eval to handle versions of Perl without PerlIO. + # + # PerlIO::get_layers still requires its argument be a glob, so coerce the + # file handle to a glob. + $$self{ENCODE} = 0; + if ($$self{utf8}) { + $$self{ENCODE} = 1; + eval { + my @options = (output => 1, details => 1); + my @layers = PerlIO::get_layers (*{$$self{output_fh}}, @options); + if ($layers[-1] && ($layers[-1] & PerlIO::F_UTF8 ())) { + $$self{ENCODE} = 0; + } + } + } + + # Determine information for the preamble and then output it unless the + # document was content-free. + if (!$$self{CONTENTLESS}) { + my ($name, $section); + if (defined $$self{name}) { + $name = $$self{name}; + $section = $$self{section} || 1; + } else { + ($name, $section) = $self->devise_title; + } + my $date = defined($$self{date}) ? $$self{date} : $self->devise_date; + $self->preamble ($name, $section, $date) + unless $self->bare_output or DEBUG > 9; + } + + # Initialize a few per-document variables. + $$self{INDENT} = 0; # Current indentation level. + $$self{INDENTS} = []; # Stack of indentations. + $$self{INDEX} = []; # Index keys waiting to be printed. + $$self{IN_NAME} = 0; # Whether processing the NAME section. + $$self{ITEMS} = 0; # The number of consecutive =items. + $$self{ITEMTYPES} = []; # Stack of =item types, one per list. + $$self{SHIFTWAIT} = 0; # Whether there is a shift waiting. + $$self{SHIFTS} = []; # Stack of .RS shifts. + $$self{PENDING} = [[]]; # Pending output. +} + +# Handle the end of the document. This handles dying on POD errors, since +# Pod::Parser currently doesn't. Otherwise, does nothing but print out a +# final comment at the end of the document under debugging. +sub end_document { + my ($self) = @_; + if ($$self{complain_die} && $self->errors_seen) { + croak ("POD document had syntax errors"); + } + return if $self->bare_output; + return if ($$self{CONTENTLESS} && !$$self{ALWAYS_EMIT_SOMETHING}); + $self->output (q(.\" [End document]) . "\n") if DEBUG; +} + +# Try to figure out the name and section from the file name and return them as +# a list, returning an empty name and section 1 if we can't find any better +# information. Uses File::Basename and File::Spec as necessary. +sub devise_title { + my ($self) = @_; + my $name = $self->source_filename || ''; + my $section = $$self{section} || 1; + $section = 3 if (!$$self{section} && $name =~ /\.pm\z/i); + $name =~ s/\.p(od|[lm])\z//i; + + # If Pod::Parser gave us an IO::File reference as the source file name, + # convert that to the empty string as well. Then, if we don't have a + # valid name, convert it to STDIN. + # + # In podlators 4.00 through 4.07, this also produced a warning, but that + # was surprising to a lot of programs that had expected to be able to pipe + # POD through pod2man without specifying the name. In the name of + # backward compatibility, just quietly set STDIN as the page title. + if ($name =~ /^IO::File(?:=\w+)\(0x[\da-f]+\)$/i) { + $name = ''; + } + if ($name eq '') { + $name = 'STDIN'; + } + + # If the section isn't 3, then the name defaults to just the basename of + # the file. + if ($section !~ /^3/) { + require File::Basename; + $name = uc File::Basename::basename ($name); + } else { + require File::Spec; + my ($volume, $dirs, $file) = File::Spec->splitpath ($name); + + # Otherwise, assume we're dealing with a module. We want to figure + # out the full module name from the path to the file, but we don't + # want to include too much of the path into the module name. Lose + # anything up to the first of: + # + # */lib/*perl*/ standard or site_perl module + # */*perl*/lib/ from -Dprefix=/opt/perl + # */*perl*/ random module hierarchy + # + # Also strip off a leading site, site_perl, or vendor_perl component, + # any OS-specific component, and any version number component, and + # strip off an initial component of "lib" or "blib/lib" since that's + # what ExtUtils::MakeMaker creates. + # + # splitdir requires at least File::Spec 0.8. + my @dirs = File::Spec->splitdir ($dirs); + if (@dirs) { + my $cut = 0; + my $i; + for ($i = 0; $i < @dirs; $i++) { + if ($dirs[$i] =~ /perl/) { + $cut = $i + 1; + $cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib'); + last; + } + } + if ($cut > 0) { + splice (@dirs, 0, $cut); + shift @dirs if ($dirs[0] =~ /^(site|vendor)(_perl)?$/); + shift @dirs if ($dirs[0] =~ /^[\d.]+$/); + shift @dirs if ($dirs[0] =~ /^(.*-$^O|$^O-.*|$^O)$/); + } + shift @dirs if $dirs[0] eq 'lib'; + splice (@dirs, 0, 2) if ($dirs[0] eq 'blib' && $dirs[1] eq 'lib'); + } + + # Remove empty directories when building the module name; they + # occur too easily on Unix by doubling slashes. + $name = join ('::', (grep { $_ ? $_ : () } @dirs), $file); + } + return ($name, $section); +} + +# Determine the modification date and return that, properly formatted in ISO +# format. +# +# If POD_MAN_DATE is set, that overrides anything else. This can be used for +# reproducible generation of the same file even if the input file timestamps +# are unpredictable or the POD comes from standard input. +# +# Otherwise, if SOURCE_DATE_EPOCH is set and can be parsed as seconds since +# the UNIX epoch, base the timestamp on that. See +# +# +# Otherwise, use the modification date of the input if we can stat it. Be +# aware that Pod::Simple returns the stringification of the file handle as +# source_filename for input from a file handle, so we'll stat some random ref +# string in that case. If that fails, instead use the current time. +# +# $self - Pod::Man object, used to get the source file +# +# Returns: YYYY-MM-DD date suitable for the left-hand footer +sub devise_date { + my ($self) = @_; + + # If POD_MAN_DATE is set, always use it. + if (defined($ENV{POD_MAN_DATE})) { + return $ENV{POD_MAN_DATE}; + } + + # If SOURCE_DATE_EPOCH is set and can be parsed, use that. + my $time; + if (defined($ENV{SOURCE_DATE_EPOCH}) && $ENV{SOURCE_DATE_EPOCH} !~ /\D/) { + $time = $ENV{SOURCE_DATE_EPOCH}; + } + + # Otherwise, get the input filename and try to stat it. If that fails, + # use the current time. + if (!defined $time) { + my $input = $self->source_filename; + if ($input) { + $time = (stat($input))[9] || time(); + } else { + $time = time(); + } + } + + # Can't use POSIX::strftime(), which uses Fcntl, because MakeMaker uses + # this and it has to work in the core which can't load dynamic libraries. + # Use gmtime instead of localtime so that the generated man page does not + # depend on the local time zone setting and is more reproducible + my ($year, $month, $day) = (gmtime($time))[5,4,3]; + return sprintf("%04d-%02d-%02d", $year + 1900, $month + 1, $day); +} + +# Print out the preamble and the title. The meaning of the arguments to .TH +# unfortunately vary by system; some systems consider the fourth argument to +# be a "source" and others use it as a version number. Generally it's just +# presented as the left-side footer, though, so it doesn't matter too much if +# a particular system gives it another interpretation. +# +# The order of date and release used to be reversed in older versions of this +# module, but this order is correct for both Solaris and Linux. +sub preamble { + my ($self, $name, $section, $date) = @_; + my $preamble = $self->preamble_template (!$$self{utf8}); + + # Build the index line and make sure that it will be syntactically valid. + my $index = "$name $section"; + $index =~ s/\"/\"\"/g; + + # If name or section contain spaces, quote them (section really never + # should, but we may as well be cautious). + for ($name, $section) { + if (/\s/) { + s/\"/\"\"/g; + $_ = '"' . $_ . '"'; + } + } + + # Double quotes in date, since it will be quoted. + $date =~ s/\"/\"\"/g; + + # Substitute into the preamble the configuration options. + $preamble =~ s/\@CFONT\@/$$self{fixed}/; + $preamble =~ s/\@LQUOTE\@/$$self{LQUOTE}/; + $preamble =~ s/\@RQUOTE\@/$$self{RQUOTE}/; + chomp $preamble; + + # Get the version information. + my $version = $self->version_report; + + # Finally output everything. + $self->output (<<"----END OF HEADER----"); +.\\" Automatically generated by $version +.\\" +.\\" Standard preamble: +.\\" ======================================================================== +$preamble +.\\" ======================================================================== +.\\" +.IX Title "$index" +.TH $name $section "$date" "$$self{release}" "$$self{center}" +.\\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\\" way too many mistakes in technical documents. +.if n .ad l +.nh +----END OF HEADER---- + $self->output (".\\\" [End of preamble]\n") if DEBUG; +} + +############################################################################## +# Text blocks +############################################################################## + +# Handle a basic block of text. The only tricky part of this is if this is +# the first paragraph of text after an =over, in which case we have to change +# indentations for *roff. +sub cmd_para { + my ($self, $attrs, $text) = @_; + my $line = $$attrs{start_line}; + + # Output the paragraph. We also have to handle =over without =item. If + # there's an =over without =item, SHIFTWAIT will be set, and we need to + # handle creation of the indent here. Add the shift to SHIFTS so that it + # will be cleaned up on =back. + $self->makespace; + if ($$self{SHIFTWAIT}) { + $self->output (".RS $$self{INDENT}\n"); + push (@{ $$self{SHIFTS} }, $$self{INDENT}); + $$self{SHIFTWAIT} = 0; + } + + # Add the line number for debugging, but not in the NAME section just in + # case the comment would confuse apropos. + $self->output (".\\\" [At source line $line]\n") + if defined ($line) && DEBUG && !$$self{IN_NAME}; + + # Force exactly one newline at the end and strip unwanted trailing + # whitespace at the end, but leave "\ " backslashed space from an S< > at + # the end of a line. Reverse the text first, to avoid having to scan the + # entire paragraph. + $text = reverse $text; + $text =~ s/\A\s*?(?= \\|\S|\z)/\n/; + $text = reverse $text; + + # Output the paragraph. + $self->output ($self->protect ($self->textmapfonts ($text))); + $self->outindex; + $$self{NEEDSPACE} = 1; + return ''; +} + +# Handle a verbatim paragraph. Put a null token at the beginning of each line +# to protect against commands and wrap in .Vb/.Ve (which we define in our +# prelude). +sub cmd_verbatim { + my ($self, $attrs, $text) = @_; + + # Ignore an empty verbatim paragraph. + return unless $text =~ /\S/; + + # Force exactly one newline at the end and strip unwanted trailing + # whitespace at the end. Reverse the text first, to avoid having to scan + # the entire paragraph. + $text = reverse $text; + $text =~ s/\A\s*/\n/; + $text = reverse $text; + + # Get a count of the number of lines before the first blank line, which + # we'll pass to .Vb as its parameter. This tells *roff to keep that many + # lines together. We don't want to tell *roff to keep huge blocks + # together. + my @lines = split (/\n/, $text); + my $unbroken = 0; + for (@lines) { + last if /^\s*$/; + $unbroken++; + } + $unbroken = 10 if ($unbroken > 12 && !$$self{MAGIC_VNOPAGEBREAK_LIMIT}); + + # Prepend a null token to each line. + $text =~ s/^/\\&/gm; + + # Output the results. + $self->makespace; + $self->output (".Vb $unbroken\n$text.Ve\n"); + $$self{NEEDSPACE} = 1; + return ''; +} + +# Handle literal text (produced by =for and similar constructs). Just output +# it with the minimum of changes. +sub cmd_data { + my ($self, $attrs, $text) = @_; + $text =~ s/^\n+//; + $text =~ s/\n{0,2}$/\n/; + $self->output ($text); + return ''; +} + +############################################################################## +# Headings +############################################################################## + +# Common code for all headings. This is called before the actual heading is +# output. It returns the cleaned up heading text (putting the heading all on +# one line) and may do other things, like closing bad =item blocks. +sub heading_common { + my ($self, $text, $line) = @_; + $text =~ s/\s+$//; + $text =~ s/\s*\n\s*/ /g; + + # This should never happen; it means that we have a heading after =item + # without an intervening =back. But just in case, handle it anyway. + if ($$self{ITEMS} > 1) { + $$self{ITEMS} = 0; + $self->output (".PD\n"); + } + + # Output the current source line. + $self->output ( ".\\\" [At source line $line]\n" ) + if defined ($line) && DEBUG; + return $text; +} + +# First level heading. We can't output .IX in the NAME section due to a bug +# in some versions of catman, so don't output a .IX for that section. .SH +# already uses small caps, so remove \s0 and \s-1. Maintain IN_NAME as +# appropriate. +sub cmd_head1 { + my ($self, $attrs, $text) = @_; + $text =~ s/\\s-?\d//g; + $text = $self->heading_common ($text, $$attrs{start_line}); + my $isname = ($text eq 'NAME' || $text =~ /\(NAME\)/); + $self->output ($self->switchquotes ('.SH', $self->mapfonts ($text))); + $self->outindex ('Header', $text) unless $isname; + $$self{NEEDSPACE} = 0; + $$self{IN_NAME} = $isname; + return ''; +} + +# Second level heading. +sub cmd_head2 { + my ($self, $attrs, $text) = @_; + $text = $self->heading_common ($text, $$attrs{start_line}); + $self->output ($self->switchquotes ('.SS', $self->mapfonts ($text))); + $self->outindex ('Subsection', $text); + $$self{NEEDSPACE} = 0; + return ''; +} + +# Third level heading. *roff doesn't have this concept, so just put the +# heading in italics as a normal paragraph. +sub cmd_head3 { + my ($self, $attrs, $text) = @_; + $text = $self->heading_common ($text, $$attrs{start_line}); + $self->makespace; + $self->output ($self->textmapfonts ('\f(IS' . $text . '\f(IE') . "\n"); + $self->outindex ('Subsection', $text); + $$self{NEEDSPACE} = 1; + return ''; +} + +# Fourth level heading. *roff doesn't have this concept, so just put the +# heading as a normal paragraph. +sub cmd_head4 { + my ($self, $attrs, $text) = @_; + $text = $self->heading_common ($text, $$attrs{start_line}); + $self->makespace; + $self->output ($self->textmapfonts ($text) . "\n"); + $self->outindex ('Subsection', $text); + $$self{NEEDSPACE} = 1; + return ''; +} + +############################################################################## +# Formatting codes +############################################################################## + +# All of the formatting codes that aren't handled internally by the parser, +# other than L<> and X<>. +sub cmd_b { return $_[0]->{IN_NAME} ? $_[2] : '\f(BS' . $_[2] . '\f(BE' } +sub cmd_i { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' } +sub cmd_f { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' } +sub cmd_c { return $_[0]->quote_literal ($_[2]) } + +# Index entries are just added to the pending entries. +sub cmd_x { + my ($self, $attrs, $text) = @_; + push (@{ $$self{INDEX} }, $text); + return ''; +} + +# Links reduce to the text that we're given, wrapped in angle brackets if it's +# a URL, followed by the URL. We take an option to suppress the URL if anchor +# text is given. We need to format the "to" value of the link before +# comparing it to the text since we may escape hyphens. +sub cmd_l { + my ($self, $attrs, $text) = @_; + if ($$attrs{type} eq 'url') { + my $to = $$attrs{to}; + if (defined $to) { + my $tag = $$self{PENDING}[-1]; + $to = $self->format_text ($$tag[1], $to); + } + if (not defined ($to) or $to eq $text) { + return "<$text>"; + } elsif ($$self{nourls}) { + return $text; + } else { + return "$text <$$attrs{to}>"; + } + } else { + return $text; + } +} + +############################################################################## +# List handling +############################################################################## + +# Handle the beginning of an =over block. Takes the type of the block as the +# first argument, and then the attr hash. This is called by the handlers for +# the four different types of lists (bullet, number, text, and block). +sub over_common_start { + my ($self, $type, $attrs) = @_; + my $line = $$attrs{start_line}; + my $indent = $$attrs{indent}; + DEBUG > 3 and print " Starting =over $type (line $line, indent ", + ($indent || '?'), "\n"; + + # Find the indentation level. + unless (defined ($indent) && $indent =~ /^[-+]?\d{1,4}\s*$/) { + $indent = $$self{indent}; + } + + # If we've gotten multiple indentations in a row, we need to emit the + # pending indentation for the last level that we saw and haven't acted on + # yet. SHIFTS is the stack of indentations that we've actually emitted + # code for. + if (@{ $$self{SHIFTS} } < @{ $$self{INDENTS} }) { + $self->output (".RS $$self{INDENT}\n"); + push (@{ $$self{SHIFTS} }, $$self{INDENT}); + } + + # Now, do record-keeping. INDENTS is a stack of indentations that we've + # seen so far, and INDENT is the current level of indentation. ITEMTYPES + # is a stack of list types that we've seen. + push (@{ $$self{INDENTS} }, $$self{INDENT}); + push (@{ $$self{ITEMTYPES} }, $type); + $$self{INDENT} = $indent + 0; + $$self{SHIFTWAIT} = 1; +} + +# End an =over block. Takes no options other than the class pointer. +# Normally, once we close a block and therefore remove something from INDENTS, +# INDENTS will now be longer than SHIFTS, indicating that we also need to emit +# *roff code to close the indent. This isn't *always* true, depending on the +# circumstance. If we're still inside an indentation, we need to emit another +# .RE and then a new .RS to unconfuse *roff. +sub over_common_end { + my ($self) = @_; + DEBUG > 3 and print " Ending =over\n"; + $$self{INDENT} = pop @{ $$self{INDENTS} }; + pop @{ $$self{ITEMTYPES} }; + + # If we emitted code for that indentation, end it. + if (@{ $$self{SHIFTS} } > @{ $$self{INDENTS} }) { + $self->output (".RE\n"); + pop @{ $$self{SHIFTS} }; + } + + # If we're still in an indentation, *roff will have now lost track of the + # right depth of that indentation, so fix that. + if (@{ $$self{INDENTS} } > 0) { + $self->output (".RE\n"); + $self->output (".RS $$self{INDENT}\n"); + } + $$self{NEEDSPACE} = 1; + $$self{SHIFTWAIT} = 0; +} + +# Dispatch the start and end calls as appropriate. +sub start_over_bullet { my $s = shift; $s->over_common_start ('bullet', @_) } +sub start_over_number { my $s = shift; $s->over_common_start ('number', @_) } +sub start_over_text { my $s = shift; $s->over_common_start ('text', @_) } +sub start_over_block { my $s = shift; $s->over_common_start ('block', @_) } +sub end_over_bullet { $_[0]->over_common_end } +sub end_over_number { $_[0]->over_common_end } +sub end_over_text { $_[0]->over_common_end } +sub end_over_block { $_[0]->over_common_end } + +# The common handler for all item commands. Takes the type of the item, the +# attributes, and then the text of the item. +# +# Emit an index entry for anything that's interesting, but don't emit index +# entries for things like bullets and numbers. Newlines in an item title are +# turned into spaces since *roff can't handle them embedded. +sub item_common { + my ($self, $type, $attrs, $text) = @_; + my $line = $$attrs{start_line}; + DEBUG > 3 and print " $type item (line $line): $text\n"; + + # Clean up the text. We want to end up with two variables, one ($text) + # which contains any body text after taking out the item portion, and + # another ($item) which contains the actual item text. + $text =~ s/\s+$//; + my ($item, $index); + if ($type eq 'bullet') { + $item = "\\\(bu"; + $text =~ s/\n*$/\n/; + } elsif ($type eq 'number') { + $item = $$attrs{number} . '.'; + } else { + $item = $text; + $item =~ s/\s*\n\s*/ /g; + $text = ''; + $index = $item if ($item =~ /\w/); + } + + # Take care of the indentation. If shifts and indents are equal, close + # the top shift, since we're about to create an indentation with .IP. + # Also output .PD 0 to turn off spacing between items if this item is + # directly following another one. We only have to do that once for a + # whole chain of items so do it for the second item in the change. Note + # that makespace is what undoes this. + if (@{ $$self{SHIFTS} } == @{ $$self{INDENTS} }) { + $self->output (".RE\n"); + pop @{ $$self{SHIFTS} }; + } + $self->output (".PD 0\n") if ($$self{ITEMS} == 1); + + # Now, output the item tag itself. + $item = $self->textmapfonts ($item); + $self->output ($self->switchquotes ('.IP', $item, $$self{INDENT})); + $$self{NEEDSPACE} = 0; + $$self{ITEMS}++; + $$self{SHIFTWAIT} = 0; + + # If body text for this item was included, go ahead and output that now. + if ($text) { + $text =~ s/\s*$/\n/; + $self->makespace; + $self->output ($self->protect ($self->textmapfonts ($text))); + $$self{NEEDSPACE} = 1; + } + $self->outindex ($index ? ('Item', $index) : ()); +} + +# Dispatch the item commands to the appropriate place. +sub cmd_item_bullet { my $self = shift; $self->item_common ('bullet', @_) } +sub cmd_item_number { my $self = shift; $self->item_common ('number', @_) } +sub cmd_item_text { my $self = shift; $self->item_common ('text', @_) } +sub cmd_item_block { my $self = shift; $self->item_common ('block', @_) } + +############################################################################## +# Backward compatibility +############################################################################## + +# Reset the underlying Pod::Simple object between calls to parse_from_file so +# that the same object can be reused to convert multiple pages. +sub parse_from_file { + my $self = shift; + $self->reinit; + + # Fake the old cutting option to Pod::Parser. This fiddles with internal + # Pod::Simple state and is quite ugly; we need a better approach. + if (ref ($_[0]) eq 'HASH') { + my $opts = shift @_; + if (defined ($$opts{-cutting}) && !$$opts{-cutting}) { + $$self{in_pod} = 1; + $$self{last_was_blank} = 1; + } + } + + # Do the work. + my $retval = $self->SUPER::parse_from_file (@_); + + # Flush output, since Pod::Simple doesn't do this. Ideally we should also + # close the file descriptor if we had to open one, but we can't easily + # figure this out. + my $fh = $self->output_fh (); + my $oldfh = select $fh; + my $oldflush = $|; + $| = 1; + print $fh ''; + $| = $oldflush; + select $oldfh; + return $retval; +} + +# Pod::Simple failed to provide this backward compatibility function, so +# implement it ourselves. File handles are one of the inputs that +# parse_from_file supports. +sub parse_from_filehandle { + my $self = shift; + return $self->parse_from_file (@_); +} + +# Pod::Simple's parse_file doesn't set output_fh. Wrap the call and do so +# ourself unless it was already set by the caller, since our documentation has +# always said that this should work. +sub parse_file { + my ($self, $in) = @_; + unless (defined $$self{output_fh}) { + $self->output_fh (\*STDOUT); + } + return $self->SUPER::parse_file ($in); +} + +# Do the same for parse_lines, just to be polite. Pod::Simple's man page +# implies that the caller is responsible for setting this, but I don't see any +# reason not to set a default. +sub parse_lines { + my ($self, @lines) = @_; + unless (defined $$self{output_fh}) { + $self->output_fh (\*STDOUT); + } + return $self->SUPER::parse_lines (@lines); +} + +# Likewise for parse_string_document. +sub parse_string_document { + my ($self, $doc) = @_; + unless (defined $$self{output_fh}) { + $self->output_fh (\*STDOUT); + } + return $self->SUPER::parse_string_document ($doc); +} + +############################################################################## +# Translation tables +############################################################################## + +# The following table is adapted from Tom Christiansen's pod2man. It assumes +# that the standard preamble has already been printed, since that's what +# defines all of the accent marks. We really want to do something better than +# this when *roff actually supports other character sets itself, since these +# results are pretty poor. +# +# This only works in an ASCII world. What to do in a non-ASCII world is very +# unclear -- hopefully we can assume UTF-8 and just leave well enough alone. +@ESCAPES{0xA0 .. 0xFF} = ( + "\\ ", undef, undef, undef, undef, undef, undef, undef, + undef, undef, undef, undef, undef, "\\%", undef, undef, + + undef, undef, undef, undef, undef, undef, undef, undef, + undef, undef, undef, undef, undef, undef, undef, undef, + + "A\\*`", "A\\*'", "A\\*^", "A\\*~", "A\\*:", "A\\*o", "\\*(Ae", "C\\*,", + "E\\*`", "E\\*'", "E\\*^", "E\\*:", "I\\*`", "I\\*'", "I\\*^", "I\\*:", + + "\\*(D-", "N\\*~", "O\\*`", "O\\*'", "O\\*^", "O\\*~", "O\\*:", undef, + "O\\*/", "U\\*`", "U\\*'", "U\\*^", "U\\*:", "Y\\*'", "\\*(Th", "\\*8", + + "a\\*`", "a\\*'", "a\\*^", "a\\*~", "a\\*:", "a\\*o", "\\*(ae", "c\\*,", + "e\\*`", "e\\*'", "e\\*^", "e\\*:", "i\\*`", "i\\*'", "i\\*^", "i\\*:", + + "\\*(d-", "n\\*~", "o\\*`", "o\\*'", "o\\*^", "o\\*~", "o\\*:", undef, + "o\\*/" , "u\\*`", "u\\*'", "u\\*^", "u\\*:", "y\\*'", "\\*(th", "y\\*:", +) if ASCII; + +############################################################################## +# Premable +############################################################################## + +# The following is the static preamble which starts all *roff output we +# generate. Most is static except for the font to use as a fixed-width font, +# which is designed by @CFONT@, and the left and right quotes to use for C<> +# text, designated by @LQOUTE@ and @RQUOTE@. However, the second part, which +# defines the accent marks, is only used if $escapes is set to true. +sub preamble_template { + my ($self, $accents) = @_; + my $preamble = <<'----END OF PREAMBLE----'; +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft @CFONT@ +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` @LQUOTE@ +. ds C' @RQUOTE@ +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +----END OF PREAMBLE---- +#'# for cperl-mode + + if ($accents) { + $preamble .= <<'----END OF PREAMBLE----' +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +----END OF PREAMBLE---- +#`# for cperl-mode + } + return $preamble; +} + +############################################################################## +# Module return value and documentation +############################################################################## + +1; +__END__ + +=for stopwords +en em ALLCAPS teeny fixedbold fixeditalic fixedbolditalic stderr utf8 UTF-8 +Allbery Sean Burke Ossanna Solaris formatters troff uppercased Christiansen +nourls parsers Kernighan lquote rquote + +=head1 NAME + +Pod::Man - Convert POD data to formatted *roff input + +=head1 SYNOPSIS + + use Pod::Man; + my $parser = Pod::Man->new (release => $VERSION, section => 8); + + # Read POD from STDIN and write to STDOUT. + $parser->parse_file (\*STDIN); + + # Read POD from file.pod and write to file.1. + $parser->parse_from_file ('file.pod', 'file.1'); + +=head1 DESCRIPTION + +Pod::Man is a module to convert documentation in the POD format (the +preferred language for documenting Perl) into *roff input using the man +macro set. The resulting *roff code is suitable for display on a terminal +using L, normally via L, or printing using L. +It is conventionally invoked using the driver script B, but it can +also be used directly. + +As a derived class from Pod::Simple, Pod::Man supports the same methods and +interfaces. See L for all the details. + +new() can take options, in the form of key/value pairs that control the +behavior of the parser. See below for details. + +If no options are given, Pod::Man uses the name of the input file with any +trailing C<.pod>, C<.pm>, or C<.pl> stripped as the man page title, to +section 1 unless the file ended in C<.pm> in which case it defaults to +section 3, to a centered title of "User Contributed Perl Documentation", to +a centered footer of the Perl version it is run with, and to a left-hand +footer of the modification date of its input (or the current date if given +C for input). + +Pod::Man assumes that your *roff formatters have a fixed-width font named +C. If yours is called something else (like C), use the C +option to specify it. This generally only matters for troff output for +printing. Similarly, you can set the fonts used for bold, italic, and +bold italic fixed-width output. + +Besides the obvious pod conversions, Pod::Man also takes care of +formatting func(), func(3), and simple variable references like $foo or +@bar so you don't have to use code escapes for them; complex expressions +like C<$fred{'stuff'}> will still need to be escaped, though. It also +translates dashes that aren't used as hyphens into en dashes, makes long +dashes--like this--into proper em dashes, fixes "paired quotes," makes C++ +look right, puts a little space between double underscores, makes ALLCAPS +a teeny bit smaller in B, and escapes stuff that *roff treats as +special so that you don't have to. + +The recognized options to new() are as follows. All options take a single +argument. + +=over 4 + +=item center + +Sets the centered page header for the C<.TH> macro. The default, if this +option is not specified, is "User Contributed Perl Documentation". + +=item date + +Sets the left-hand footer for the C<.TH> macro. If this option is not set, +the contents of the environment variable POD_MAN_DATE, if set, will be used. +Failing that, the value of SOURCE_DATE_EPOCH, the modification date of the +input file, or the current time if stat() can't find that file (which will be +the case if the input is from C) will be used. If obtained from the +file modification date or the current time, the date will be formatted as +C and will be based on UTC (so that the output will be +reproducible regardless of local time zone). + +=item errors + +How to report errors. C says to throw an exception on any POD +formatting error. C says to report errors on standard error, but +not to throw an exception. C says to include a POD ERRORS section +in the resulting documentation summarizing the errors. C ignores +POD errors entirely, as much as possible. + +The default is C. + +=item fixed + +The fixed-width font to use for verbatim text and code. Defaults to +C. Some systems may want C instead. Only matters for B +output. + +=item fixedbold + +Bold version of the fixed-width font. Defaults to C. Only matters +for B output. + +=item fixeditalic + +Italic version of the fixed-width font (actually, something of a misnomer, +since most fixed-width fonts only have an oblique version, not an italic +version). Defaults to C. Only matters for B output. + +=item fixedbolditalic + +Bold italic (probably actually oblique) version of the fixed-width font. +Pod::Man doesn't assume you have this, and defaults to C. Some +systems (such as Solaris) have this font available as C. Only matters +for B output. + +=item lquote + +=item rquote + +Sets the quote marks used to surround CE> text. C sets the +left quote mark and C sets the right quote mark. Either may also +be set to the special value C, in which case no quote mark is added +on that side of CE> text (but the font is still changed for troff +output). + +Also see the C option, which can be used to set both quotes at once. +If both C and one of the other options is set, C or C +overrides C. + +=item name + +Set the name of the manual page for the C<.TH> macro. Without this +option, the manual name is set to the uppercased base name of the file +being converted unless the manual section is 3, in which case the path is +parsed to see if it is a Perl module path. If it is, a path like +C<.../lib/Pod/Man.pm> is converted into a name like C. This +option, if given, overrides any automatic determination of the name. + +If generating a manual page from standard input, the name will be set to +C if this option is not provided. Providing this option is strongly +recommended to set a meaningful manual page name. + +=item nourls + +Normally, LZ<><> formatting codes with a URL but anchor text are formatted +to show both the anchor text and the URL. In other words: + + L + +is formatted as: + + foo + +This option, if set to a true value, suppresses the URL when anchor text +is given, so this example would be formatted as just C. This can +produce less cluttered output in cases where the URLs are not particularly +important. + +=item quotes + +Sets the quote marks used to surround CE> text. If the value is a +single character, it is used as both the left and right quote. Otherwise, +it is split in half, and the first half of the string is used as the left +quote and the second is used as the right quote. + +This may also be set to the special value C, in which case no quote +marks are added around CE> text (but the font is still changed for troff +output). + +Also see the C and C options, which can be used to set the +left and right quotes independently. If both C and one of the other +options is set, C or C overrides C. + +=item release + +Set the centered footer for the C<.TH> macro. By default, this is set to +the version of Perl you run Pod::Man under. Setting this to the empty +string will cause some *roff implementations to use the system default +value. + +Note that some system C macro sets assume that the centered footer +will be a modification date and will prepend something like "Last +modified: ". If this is the case for your target system, you may want to +set C to the last modified date and C to the version +number. + +=item section + +Set the section for the C<.TH> macro. The standard section numbering +convention is to use 1 for user commands, 2 for system calls, 3 for +functions, 4 for devices, 5 for file formats, 6 for games, 7 for +miscellaneous information, and 8 for administrator commands. There is a lot +of variation here, however; some systems (like Solaris) use 4 for file +formats, 5 for miscellaneous information, and 7 for devices. Still others +use 1m instead of 8, or some mix of both. About the only section numbers +that are reliably consistent are 1, 2, and 3. + +By default, section 1 will be used unless the file ends in C<.pm> in which +case section 3 will be selected. + +=item stderr + +Send error messages about invalid POD to standard error instead of +appending a POD ERRORS section to the generated *roff output. This is +equivalent to setting C to C if C is not already +set. It is supported for backward compatibility. + +=item utf8 + +By default, Pod::Man produces the most conservative possible *roff output +to try to ensure that it will work with as many different *roff +implementations as possible. Many *roff implementations cannot handle +non-ASCII characters, so this means all non-ASCII characters are converted +either to a *roff escape sequence that tries to create a properly accented +character (at least for troff output) or to C. + +If this option is set, Pod::Man will instead output UTF-8. If your *roff +implementation can handle it, this is the best output format to use and +avoids corruption of documents containing non-ASCII characters. However, +be warned that *roff source with literal UTF-8 characters is not supported +by many implementations and may even result in segfaults and other bad +behavior. + +Be aware that, when using this option, the input encoding of your POD +source should be properly declared unless it's US-ASCII. Pod::Simple will +attempt to guess the encoding and may be successful if it's Latin-1 or +UTF-8, but it will produce warnings. Use the C<=encoding> command to +declare the encoding. See L for more information. + +=back + +The standard Pod::Simple method parse_file() takes one argument naming the +POD file to read from. By default, the output is sent to C, but +this can be changed with the output_fh() method. + +The standard Pod::Simple method parse_from_file() takes up to two +arguments, the first being the input file to read POD from and the second +being the file to write the formatted output to. + +You can also call parse_lines() to parse an array of lines or +parse_string_document() to parse a document already in memory. As with +parse_file(), parse_lines() and parse_string_document() default to sending +their output to C unless changed with the output_fh() method. Be +aware that parse_lines() and parse_string_document() both expect raw bytes, +not decoded characters. + +To put the output from any parse method into a string instead of a file +handle, call the output_string() method instead of output_fh(). + +See L for more specific details on the methods available to +all derived parsers. + +=head1 DIAGNOSTICS + +=over 4 + +=item roff font should be 1 or 2 chars, not "%s" + +(F) You specified a *roff font (using C, C, etc.) that +wasn't either one or two characters. Pod::Man doesn't support *roff fonts +longer than two characters, although some *roff extensions do (the +canonical versions of B and B don't either). + +=item Invalid errors setting "%s" + +(F) The C parameter to the constructor was set to an unknown value. + +=item Invalid quote specification "%s" + +(F) The quote specification given (the C option to the +constructor) was invalid. A quote specification must be either one +character long or an even number (greater than one) characters long. + +=item POD document had syntax errors + +(F) The POD document being formatted had syntax errors and the C +option was set to C. + +=back + +=head1 ENVIRONMENT + +=over 4 + +=item PERL_CORE + +If set and Encode is not available, silently fall back to non-UTF-8 mode +without complaining to standard error. This environment variable is set +during Perl core builds, which build Encode after podlators. Encode is +expected to not (yet) be available in that case. + +=item POD_MAN_DATE + +If set, this will be used as the value of the left-hand footer unless the +C option is explicitly set, overriding the timestamp of the input +file or the current time. This is primarily useful to ensure reproducible +builds of the same output file given the same source and Pod::Man version, +even when file timestamps may not be consistent. + +=item SOURCE_DATE_EPOCH + +If set, and POD_MAN_DATE and the C options are not set, this will be +used as the modification time of the source file, overriding the timestamp of +the input file or the current time. It should be set to the desired time in +seconds since UNIX epoch. This is primarily useful to ensure reproducible +builds of the same output file given the same source and Pod::Man version, +even when file timestamps may not be consistent. See +L for the full +specification. + +(Arguably, according to the specification, this variable should be used only +if the timestamp of the input file is not available and Pod::Man uses the +current time. However, for reproducible builds in Debian, results were more +reliable if this variable overrode the timestamp of the input file.) + +=back + +=head1 BUGS + +Encoding handling assumes that PerlIO is available and does not work +properly if it isn't. The C option is therefore not supported +unless Perl is built with PerlIO support. + +There is currently no way to turn off the guesswork that tries to format +unmarked text appropriately, and sometimes it isn't wanted (particularly +when using POD to document something other than Perl). Most of the work +toward fixing this has now been done, however, and all that's still needed +is a user interface. + +The NAME section should be recognized specially and index entries emitted +for everything in that section. This would have to be deferred until the +next section, since extraneous things in NAME tends to confuse various man +page processors. Currently, no index entries are emitted for anything in +NAME. + +Pod::Man doesn't handle font names longer than two characters. Neither do +most B implementations, but GNU troff does as an extension. It would +be nice to support as an option for those who want to use it. + +The preamble added to each output file is rather verbose, and most of it +is only necessary in the presence of non-ASCII characters. It would +ideally be nice if all of those definitions were only output if needed, +perhaps on the fly as the characters are used. + +Pod::Man is excessively slow. + +=head1 CAVEATS + +If Pod::Man is given the C option, the encoding of its output file +handle will be forced to UTF-8 if possible, overriding any existing +encoding. This will be done even if the file handle is not created by +Pod::Man and was passed in from outside. This maintains consistency +regardless of PERL_UNICODE and other settings. + +The handling of hyphens and em dashes is somewhat fragile, and one may get +the wrong one under some circumstances. This should only matter for +B output. + +When and whether to use small caps is somewhat tricky, and Pod::Man doesn't +necessarily get it right. + +Converting neutral double quotes to properly matched double quotes doesn't +work unless there are no formatting codes between the quote marks. This +only matters for troff output. + +=head1 AUTHOR + +Russ Allbery , based I heavily on the original B +by Tom Christiansen . The modifications to work with +Pod::Simple instead of Pod::Parser were originally contributed by Sean Burke + (but I've since hacked them beyond recognition and all bugs +are mine). + +=head1 COPYRIGHT AND LICENSE + +Copyright 1999-2010, 2012-2019 Russ Allbery + +Substantial contributions by Sean Burke . + +This program is free software; you may redistribute it and/or modify it +under the same terms as Perl itself. + +=head1 SEE ALSO + +L, L, L, L, L, +L, L + +Ossanna, Joseph F., and Brian W. Kernighan. "Troff User's Manual," +Computing Science Technical Report No. 54, AT&T Bell Laboratories. This is +the best documentation of standard B and B. At the time of +this writing, it's available at L. + +The man page documenting the man macro set may be L instead of +L on your system. Also, please see L for extensive +documentation on writing manual pages if you've not done it before and +aren't familiar with the conventions. + +The current version of this module is always available from its web site at +L. It is also part of the +Perl core distribution as of 5.6.0. + +=cut + +# Local Variables: +# copyright-at-end-flag: t +# End: diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/ParseLink.pm b/data/miniconda3/lib/perl5/core_perl/Pod/ParseLink.pm new file mode 100644 index 0000000000000000000000000000000000000000..273c95847ac39c12e2cfbd04e862ca47f5340aad --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/ParseLink.pm @@ -0,0 +1,190 @@ +# Parse an L<> formatting code in POD text. +# +# This module implements parsing of the text of an L<> formatting code as +# defined in perlpodspec. It should be suitable for any POD formatter. It +# exports only one function, parselink(), which returns the five-item parse +# defined in perlpodspec. +# +# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl + +############################################################################## +# Modules and declarations +############################################################################## + +package Pod::ParseLink; + +use 5.008; +use strict; +use warnings; + +use vars qw(@EXPORT @ISA $VERSION); + +use Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(parselink); + +$VERSION = '4.14'; + +############################################################################## +# Implementation +############################################################################## + +# Parse the name and section portion of a link into a name and section. +sub _parse_section { + my ($link) = @_; + $link =~ s/^\s+//; + $link =~ s/\s+$//; + + # If the whole link is enclosed in quotes, interpret it all as a section + # even if it contains a slash. + return (undef, $1) if ($link =~ /^"\s*(.*?)\s*"$/); + + # Split into page and section on slash, and then clean up quoting in the + # section. If there is no section and the name contains spaces, also + # guess that it's an old section link. + my ($page, $section) = split (/\s*\/\s*/, $link, 2); + $section =~ s/^"\s*(.*?)\s*"$/$1/ if $section; + if ($page && $page =~ / / && !defined ($section)) { + $section = $page; + $page = undef; + } else { + $page = undef unless $page; + $section = undef unless $section; + } + return ($page, $section); +} + +# Infer link text from the page and section. +sub _infer_text { + my ($page, $section) = @_; + my $inferred; + if ($page && !$section) { + $inferred = $page; + } elsif (!$page && $section) { + $inferred = '"' . $section . '"'; + } elsif ($page && $section) { + $inferred = '"' . $section . '" in ' . $page; + } + return $inferred; +} + +# Given the contents of an L<> formatting code, parse it into the link text, +# the possibly inferred link text, the name or URL, the section, and the type +# of link (pod, man, or url). +sub parselink { + my ($link) = @_; + $link =~ s/\s+/ /g; + my $text; + if ($link =~ /\|/) { + ($text, $link) = split (/\|/, $link, 2); + } + if ($link =~ /\A\w+:[^:\s]\S*\Z/) { + my $inferred; + if (defined ($text) && length ($text) > 0) { + return ($text, $text, $link, undef, 'url'); + } else { + return ($text, $link, $link, undef, 'url'); + } + } else { + my ($name, $section) = _parse_section ($link); + my $inferred; + if (defined ($text) && length ($text) > 0) { + $inferred = $text; + } else { + $inferred = _infer_text ($name, $section); + } + my $type = ($name && $name =~ /\(\S*\)/) ? 'man' : 'pod'; + return ($text, $inferred, $name, $section, $type); + } +} + +############################################################################## +# Module return value and documentation +############################################################################## + +# Ensure we evaluate to true. +1; +__END__ + +=for stopwords +markup Allbery URL + +=head1 NAME + +Pod::ParseLink - Parse an LEE formatting code in POD text + +=head1 SYNOPSIS + + use Pod::ParseLink; + my $link = get_link(); + my ($text, $inferred, $name, $section, $type) = parselink($link); + +=head1 DESCRIPTION + +This module only provides a single function, parselink(), which takes the +text of an LEE formatting code and parses it. It returns the +anchor text for the link (if any was given), the anchor text possibly +inferred from the name and section, the name or URL, the section if any, +and the type of link. The type will be one of C, C, or C, +indicating a URL, a link to a POD page, or a link to a Unix manual page. + +Parsing is implemented per L. For backward compatibility, +links where there is no section and name contains spaces, or links where the +entirety of the link (except for the anchor text if given) is enclosed in +double-quotes are interpreted as links to a section (LE/sectionE). + +The inferred anchor text is implemented per L: + + L => L + L

=> L<"section"|/section> + L => L<"section" in name|name/section> + +The name may contain embedded EEE and ZEE formatting codes, +and the section, anchor text, and inferred anchor text may contain any +formatting codes. Any double quotes around the section are removed as part +of the parsing, as is any leading or trailing whitespace. + +If the text of the LEE escape is entirely enclosed in double +quotes, it's interpreted as a link to a section for backward +compatibility. + +No attempt is made to resolve formatting codes. This must be done after +calling parselink() (since EEE formatting codes can be used to +escape characters that would otherwise be significant to the parser and +resolving them before parsing would result in an incorrect parse of a +formatting code like: + + LbarEslash> + +which should be interpreted as a link to the C POD page +and not as a link to the C section of the C POD page with an +anchor text of C. Note that not only the anchor text will need to +have formatting codes expanded, but so will the target of the link (to deal +with EEE and ZEE formatting codes), and special handling of +the section may be necessary depending on whether the translator wants to +consider markup in sections to be significant when resolving links. See +L for more information. + +=head1 AUTHOR + +Russ Allbery + +=head1 COPYRIGHT AND LICENSE + +Copyright 2001, 2008, 2009, 2014, 2018-2019 Russ Allbery + +This program is free software; you may redistribute it and/or modify it +under the same terms as Perl itself. + +=head1 SEE ALSO + +L + +The current version of this module is always available from its web site at +L. + +=cut + +# Local Variables: +# copyright-at-end-flag: t +# End: diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc.pm new file mode 100644 index 0000000000000000000000000000000000000000..bb6ffc83efb4105bb4435a0a0b7a7356f4475f1e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc.pm @@ -0,0 +1,2140 @@ +use 5.006; # we use some open(X, "<", $y) syntax + +package Pod::Perldoc; +use strict; +use warnings; +use Config '%Config'; + +use Fcntl; # for sysopen +use File::Basename qw(basename); +use File::Spec::Functions qw(catfile catdir splitdir); + +use vars qw($VERSION @Pagers $Bindir $Pod2man + $Temp_Files_Created $Temp_File_Lifetime +); +$VERSION = '3.2801'; + +#.......................................................................... + +BEGIN { # Make a DEBUG constant very first thing... + unless(defined &DEBUG) { + if(($ENV{'PERLDOCDEBUG'} || '') =~ m/^(\d+)/) { # untaint + eval("sub DEBUG () {$1}"); + die "WHAT? Couldn't eval-up a DEBUG constant!? $@" if $@; + } else { + *DEBUG = sub () {0}; + } + } +} + +use Pod::Perldoc::GetOptsOO; # uses the DEBUG. +use Carp qw(croak carp); + +# these are also in BaseTo, which I don't want to inherit +sub debugging { + my $self = shift; + + ( defined(&Pod::Perldoc::DEBUG) and &Pod::Perldoc::DEBUG() ) + } + +sub debug { + my( $self, @messages ) = @_; + return unless $self->debugging; + print STDERR map { "DEBUG : $_" } @messages; + } + +sub warn { + my( $self, @messages ) = @_; + + carp( join "\n", @messages, '' ); + } + +sub die { + my( $self, @messages ) = @_; + + croak( join "\n", @messages, '' ); + } + +#.......................................................................... + +sub TRUE () {1} +sub FALSE () {return} +sub BE_LENIENT () {1} + +BEGIN { + *is_vms = $^O eq 'VMS' ? \&TRUE : \&FALSE unless defined &is_vms; + *is_mswin32 = $^O eq 'MSWin32' ? \&TRUE : \&FALSE unless defined &is_mswin32; + *is_dos = $^O eq 'dos' ? \&TRUE : \&FALSE unless defined &is_dos; + *is_os2 = $^O eq 'os2' ? \&TRUE : \&FALSE unless defined &is_os2; + *is_cygwin = $^O eq 'cygwin' ? \&TRUE : \&FALSE unless defined &is_cygwin; + *is_linux = $^O eq 'linux' ? \&TRUE : \&FALSE unless defined &is_linux; + *is_hpux = $^O =~ m/hpux/ ? \&TRUE : \&FALSE unless defined &is_hpux; + *is_amigaos = $^O eq 'amigaos' ? \&TRUE : \&FALSE unless defined &is_amigaos; +} + +$Temp_File_Lifetime ||= 60 * 60 * 24 * 5; + # If it's older than five days, it's quite unlikely + # that anyone's still looking at it!! + # (Currently used only by the MSWin cleanup routine) + + +#.......................................................................... +{ my $pager = $Config{'pager'}; + push @Pagers, $pager if -x (split /\s+/, $pager)[0] or __PACKAGE__->is_vms; +} +$Bindir = $Config{'scriptdirexp'}; +$Pod2man = "pod2man" . ( $Config{'versiononly'} ? $Config{'version'} : '' ); + +# End of class-init stuff +# +########################################################################### +# +# Option accessors... + +foreach my $subname (map "opt_$_", split '', q{mhlDriFfXqnTdULva}) { + no strict 'refs'; + *$subname = do{ use strict 'refs'; sub () { shift->_elem($subname, @_) } }; +} + +# And these are so that GetOptsOO knows they take options: +sub opt_a_with { shift->_elem('opt_a', @_) } +sub opt_f_with { shift->_elem('opt_f', @_) } +sub opt_q_with { shift->_elem('opt_q', @_) } +sub opt_d_with { shift->_elem('opt_d', @_) } +sub opt_L_with { shift->_elem('opt_L', @_) } +sub opt_v_with { shift->_elem('opt_v', @_) } + +sub opt_w_with { # Specify an option for the formatter subclass + my($self, $value) = @_; + if($value =~ m/^([-_a-zA-Z][-_a-zA-Z0-9]*)(?:[=\:](.*?))?$/s) { + my $option = $1; + my $option_value = defined($2) ? $2 : "TRUE"; + $option =~ tr/\-/_/s; # tolerate "foo-bar" for "foo_bar" + $self->add_formatter_option( $option, $option_value ); + } else { + $self->warn( qq("$value" isn't a good formatter option name. I'm ignoring it!\n ) ); + } + return; +} + +sub opt_M_with { # specify formatter class name(s) + my($self, $classes) = @_; + return unless defined $classes and length $classes; + DEBUG > 4 and print "Considering new formatter classes -M$classes\n"; + my @classes_to_add; + foreach my $classname (split m/[,;]+/s, $classes) { + next unless $classname =~ m/\S/; + if( $classname =~ m/^(\w+(::\w+)+)$/s ) { + # A mildly restrictive concept of what modulenames are valid. + push @classes_to_add, $1; # untaint + } else { + $self->warn( qq("$classname" isn't a valid classname. Ignoring.\n) ); + } + } + + unshift @{ $self->{'formatter_classes'} }, @classes_to_add; + + DEBUG > 3 and print( + "Adding @classes_to_add to the list of formatter classes, " + . "making them @{ $self->{'formatter_classes'} }.\n" + ); + + return; +} + +sub opt_V { # report version and exit + print join '', + "Perldoc v$VERSION, under perl v$] for $^O", + + (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber()) + ? (" (win32 build ", &Win32::BuildNumber(), ")") : (), + + (chr(65) eq 'A') ? () : " (non-ASCII)", + + "\n", + ; + exit; +} + +sub opt_t { # choose plaintext as output format + my $self = shift; + $self->opt_o_with('text') if @_ and $_[0]; + return $self->_elem('opt_t', @_); +} + +sub opt_u { # choose raw pod as output format + my $self = shift; + $self->opt_o_with('pod') if @_ and $_[0]; + return $self->_elem('opt_u', @_); +} + +sub opt_n_with { + # choose man as the output format, and specify the proggy to run + my $self = shift; + $self->opt_o_with('man') if @_ and $_[0]; + $self->_elem('opt_n', @_); +} + +sub opt_o_with { # "o" for output format + my($self, $rest) = @_; + return unless defined $rest and length $rest; + if($rest =~ m/^(\w+)$/s) { + $rest = $1; #untaint + } else { + $self->warn( qq("$rest" isn't a valid output format. Skipping.\n") ); + return; + } + + $self->aside("Noting \"$rest\" as desired output format...\n"); + + # Figure out what class(es) that could actually mean... + + my @classes; + foreach my $prefix ("Pod::Perldoc::To", "Pod::Simple::", "Pod::") { + # Messy but smart: + foreach my $stem ( + $rest, # Yes, try it first with the given capitalization + "\L$rest", "\L\u$rest", "\U$rest" # And then try variations + + ) { + $self->aside("Considering $prefix$stem\n"); + push @classes, $prefix . $stem; + } + + # Tidier, but misses too much: + #push @classes, $prefix . ucfirst(lc($rest)); + } + $self->opt_M_with( join ";", @classes ); + return; +} + +########################################################################### +# % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + +sub run { # to be called by the "perldoc" executable + my $class = shift; + if(DEBUG > 3) { + print "Parameters to $class\->run:\n"; + my @x = @_; + while(@x) { + $x[1] = '' unless defined $x[1]; + $x[1] = "@{$x[1]}" if ref( $x[1] ) eq 'ARRAY'; + print " [$x[0]] => [$x[1]]\n"; + splice @x,0,2; + } + print "\n"; + } + return $class -> new(@_) -> process() || 0; +} + +# % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +########################################################################### + +sub new { # yeah, nothing fancy + my $class = shift; + my $new = bless {@_}, (ref($class) || $class); + DEBUG > 1 and print "New $class object $new\n"; + $new->init(); + $new; +} + +#.......................................................................... + +sub aside { # If we're in -D or DEBUG mode, say this. + my $self = shift; + if( DEBUG or $self->opt_D ) { + my $out = join( '', + DEBUG ? do { + my $callsub = (caller(1))[3]; + my $package = quotemeta(__PACKAGE__ . '::'); + $callsub =~ s/^$package/'/os; + # the o is justified, as $package really won't change. + $callsub . ": "; + } : '', + @_, + ); + if(DEBUG) { print $out } else { print STDERR $out } + } + return; +} + +#.......................................................................... + +sub usage { + my $self = shift; + $self->warn( "@_\n" ) if @_; + + # Erase evidence of previous errors (if any), so exit status is simple. + $! = 0; + + CORE::die( <debug( "The value in $0 is a symbolic link to $link\n" ); + } + + my $basename = basename( $0 ); + + $self->debug( "\$0 is [$0]\nbasename is [$basename]\n" ); + # possible name forms + # perldoc + # perldoc-v5.14 + # perldoc-5.14 + # perldoc-5.14.2 + # perlvar # an alias mentioned in Camel 3 + { + my( $untainted ) = $basename =~ m/( + \A + perl + (?: doc | func | faq | help | op | toc | var # Camel 3 + ) + (?: -? v? \d+ \. \d+ (?:\. \d+)? )? # possible version + (?: \. (?: bat | exe | com ) )? # possible extension + \z + ) + /x; + + $self->debug($untainted); + return $untainted if $untainted; + } + + $self->warn(<<"HERE"); +You called the perldoc command with a name that I didn't recognize. +This might mean that someone is tricking you into running a +program you don't intend to use, but it also might mean that you +created your own link to perldoc. I think your program name is +[$basename]. + +I'll allow this if the filename only has [a-zA-Z0-9._-]. +HERE + + { + my( $untainted ) = $basename =~ m/( + \A [a-zA-Z0-9._-]+ \z + )/x; + + $self->debug($untainted); + return $untainted if $untainted; + } + + $self->die(<<"HERE"); +I think that your name for perldoc is potentially unsafe, so I'm +going to disallow it. I'd rather you be safe than sorry. If you +intended to use the name I'm disallowing, please tell the maintainers +about it. Write to: + + Pod-Perldoc\@rt.cpan.org + +HERE +} + +#.......................................................................... + +sub usage_brief { + my $self = shift; + my $program_name = $self->program_name; + + CORE::die( <<"EOUSAGE" ); +Usage: $program_name [-hVriDtumUFXlT] [-n nroffer_program] + [-d output_filename] [-o output_format] [-M FormatterModule] + [-w formatter_option:option_value] [-L translation_code] + PageName|ModuleName|ProgramName + +Examples: + + $program_name -f PerlFunc + $program_name -q FAQKeywords + $program_name -v PerlVar + $program_name -a PerlAPI + +The -h option prints more help. Also try "$program_name perldoc" to get +acquainted with the system. [Perldoc v$VERSION] +EOUSAGE + +} + +#.......................................................................... + +sub pagers { @{ shift->{'pagers'} } } + +#.......................................................................... + +sub _elem { # handy scalar meta-accessor: shift->_elem("foo", @_) + if(@_ > 2) { return $_[0]{ $_[1] } = $_[2] } + else { return $_[0]{ $_[1] } } +} +#.......................................................................... +########################################################################### +# +# Init formatter switches, and start it off with __bindir and all that +# other stuff that ToMan.pm needs. +# + +sub init { + my $self = shift; + + # Make sure creat()s are neither too much nor too little + eval { umask(0077) }; # doubtless someone has no mask + + if ( $] < 5.008 ) { + $self->aside("Your old perl doesn't have proper unicode support."); + } + else { + # http://www.perl.com/pub/2012/04/perlunicookbook-decode-argv-as-utf8.html + # Decode command line arguments as UTF-8. See RT#98906 for example problem. + use Encode qw(decode_utf8); + @ARGV = map { decode_utf8($_, 1) } @ARGV; + } + + $self->{'args'} ||= \@ARGV; + $self->{'found'} ||= []; + $self->{'temp_file_list'} ||= []; + + + $self->{'target'} = undef; + + $self->init_formatter_class_list; + + $self->{'pagers' } = [@Pagers] unless exists $self->{'pagers'}; + $self->{'bindir' } = $Bindir unless exists $self->{'bindir'}; + $self->{'pod2man'} = $Pod2man unless exists $self->{'pod2man'}; + $self->{'search_path'} = [ ] unless exists $self->{'search_path'}; + + push @{ $self->{'formatter_switches'} = [] }, ( + # Yeah, we could use a hashref, but maybe there's some class where options + # have to be ordered; so we'll use an arrayref. + + [ '__bindir' => $self->{'bindir' } ], + [ '__pod2man' => $self->{'pod2man'} ], + ); + + DEBUG > 3 and printf "Formatter switches now: [%s]\n", + join ' ', map "[@$_]", @{ $self->{'formatter_switches'} }; + + $self->{'translators'} = []; + $self->{'extra_search_dirs'} = []; + + return; +} + +#.......................................................................... + +sub init_formatter_class_list { + my $self = shift; + $self->{'formatter_classes'} ||= []; + + # Remember, no switches have been read yet, when + # we've started this routine. + + $self->opt_M_with('Pod::Perldoc::ToPod'); # the always-there fallthru + $self->opt_o_with('text'); + + return; +} + +#.......................................................................... + +sub process { + # if this ever returns, its retval will be used for exit(RETVAL) + + my $self = shift; + DEBUG > 1 and print " Beginning process.\n"; + DEBUG > 1 and print " Args: @{$self->{'args'}}\n\n"; + if(DEBUG > 3) { + print "Object contents:\n"; + my @x = %$self; + while(@x) { + $x[1] = '' unless defined $x[1]; + $x[1] = "@{$x[1]}" if ref( $x[1] ) eq 'ARRAY'; + print " [$x[0]] => [$x[1]]\n"; + splice @x,0,2; + } + print "\n"; + } + + # TODO: make it deal with being invoked as various different things + # such as perlfaq". + + return $self->usage_brief unless @{ $self->{'args'} }; + $self->options_reading; + $self->pagers_guessing; + $self->aside(sprintf "$0 => %s v%s\n", ref($self), $self->VERSION); + $self->drop_privs_maybe unless ($self->opt_U || $self->opt_F); + $self->options_processing; + + # Hm, we have @pages and @found, but we only really act on one + # file per call, with the exception of the opt_q hack, and with + # -l things + + $self->aside("\n"); + + my @pages; + $self->{'pages'} = \@pages; + if( $self->opt_f) { @pages = qw(perlfunc perlop) } + elsif( $self->opt_q) { @pages = ("perlfaq1" .. "perlfaq9") } + elsif( $self->opt_v) { @pages = ("perlvar") } + elsif( $self->opt_a) { @pages = ("perlapi") } + else { @pages = @{$self->{'args'}}; + # @pages = __FILE__ + # if @pages == 1 and $pages[0] eq 'perldoc'; + } + + return $self->usage_brief unless @pages; + + $self->find_good_formatter_class(); + $self->formatter_sanity_check(); + + $self->maybe_extend_searchpath(); + # for when we're apparently in a module or extension directory + + my @found = $self->grand_search_init(\@pages); + exit ($self->is_vms ? 98962 : 1) unless @found; + + if ($self->opt_l and not $self->opt_q ) { + DEBUG and print "We're in -l mode, so byebye after this:\n"; + print join("\n", @found), "\n"; + return; + } + + $self->tweak_found_pathnames(\@found); + $self->assert_closing_stdout; + return $self->page_module_file(@found) if $self->opt_m; + DEBUG > 2 and print "Found: [@found]\n"; + + return $self->render_and_page(\@found); +} + +#.......................................................................... +{ + +my( %class_seen, %class_loaded ); +sub find_good_formatter_class { + my $self = $_[0]; + my @class_list = @{ $self->{'formatter_classes'} || [] }; + $self->die( "WHAT? Nothing in the formatter class list!?" ) unless @class_list; + + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + + my $good_class_found; + foreach my $c (@class_list) { + DEBUG > 4 and print "Trying to load $c...\n"; + if($class_loaded{$c}) { + DEBUG > 4 and print "OK, the already-loaded $c it is!\n"; + $good_class_found = $c; + last; + } + + if($class_seen{$c}) { + DEBUG > 4 and print + "I've tried $c before, and it's no good. Skipping.\n"; + next; + } + + $class_seen{$c} = 1; + + if( $c->can('parse_from_file') ) { + DEBUG > 4 and print + "Interesting, the formatter class $c is already loaded!\n"; + + } elsif( + ( $self->is_os2 or $self->is_mswin32 or $self->is_dos or $self->is_os2) + # the always case-insensitive filesystems + and $class_seen{lc("~$c")}++ + ) { + DEBUG > 4 and print + "We already used something quite like \"\L$c\E\", so no point using $c\n"; + # This avoids redefining the package. + } else { + DEBUG > 4 and print "Trying to eval 'require $c'...\n"; + + local $^W = $^W; + if(DEBUG() or $self->opt_D) { + # feh, let 'em see it + } else { + $^W = 0; + # The average user just has no reason to be seeing + # $^W-suppressible warnings from the require! + } + + eval "require $c"; + if($@) { + DEBUG > 4 and print "Couldn't load $c: $!\n"; + next; + } + } + + if( $c->can('parse_from_file') ) { + DEBUG > 4 and print "Settling on $c\n"; + my $v = $c->VERSION; + $v = ( defined $v and length $v ) ? " version $v" : ''; + $self->aside("Formatter class $c$v successfully loaded!\n"); + $good_class_found = $c; + last; + } else { + DEBUG > 4 and print "Class $c isn't a formatter?! Skipping.\n"; + } + } + + $self->die( "Can't find any loadable formatter class in @class_list?!\nAborting" ) + unless $good_class_found; + + $self->{'formatter_class'} = $good_class_found; + $self->aside("Will format with the class $good_class_found\n"); + + return; +} + +} +#.......................................................................... + +sub formatter_sanity_check { + my $self = shift; + my $formatter_class = $self->{'formatter_class'} + || $self->die( "NO FORMATTER CLASS YET!?" ); + + if(!$self->opt_T # so -T can FORCE sending to STDOUT + and $formatter_class->can('is_pageable') + and !$formatter_class->is_pageable + and !$formatter_class->can('page_for_perldoc') + ) { + my $ext = + ($formatter_class->can('output_extension') + && $formatter_class->output_extension + ) || ''; + $ext = ".$ext" if length $ext; + + my $me = $self->program_name; + $self->die( + "When using Perldoc to format with $formatter_class, you have to\n" + . "specify -T or -dsomefile$ext\n" + . "See `$me perldoc' for more information on those switches.\n" ) + ; + } +} + +#.......................................................................... + +sub render_and_page { + my($self, $found_list) = @_; + + $self->maybe_generate_dynamic_pod($found_list); + + my($out, $formatter) = $self->render_findings($found_list); + + if($self->opt_d) { + printf "Perldoc (%s) output saved to %s\n", + $self->{'formatter_class'} || ref($self), + $out; + print "But notice that it's 0 bytes long!\n" unless -s $out; + + + } elsif( # Allow the formatter to "page" itself, if it wants. + $formatter->can('page_for_perldoc') + and do { + $self->aside("Going to call $formatter\->page_for_perldoc(\"$out\")\n"); + if( $formatter->page_for_perldoc($out, $self) ) { + $self->aside("page_for_perldoc returned true, so NOT paging with $self.\n"); + 1; + } else { + $self->aside("page_for_perldoc returned false, so paging with $self instead.\n"); + ''; + } + } + ) { + # Do nothing, since the formatter has "paged" it for itself. + + } else { + # Page it normally (internally) + + if( -s $out ) { # Usual case: + $self->page($out, $self->{'output_to_stdout'}, $self->pagers); + + } else { + # Odd case: + $self->aside("Skipping $out (from $$found_list[0] " + . "via $$self{'formatter_class'}) as it is 0-length.\n"); + + push @{ $self->{'temp_file_list'} }, $out; + $self->unlink_if_temp_file($out); + } + } + + $self->after_rendering(); # any extra cleanup or whatever + + return; +} + +#.......................................................................... + +sub options_reading { + my $self = shift; + + if( defined $ENV{"PERLDOC"} and length $ENV{"PERLDOC"} ) { + require Text::ParseWords; + $self->aside("Noting env PERLDOC setting of $ENV{'PERLDOC'}\n"); + # Yes, appends to the beginning + unshift @{ $self->{'args'} }, + Text::ParseWords::shellwords( $ENV{"PERLDOC"} ) + ; + DEBUG > 1 and print " Args now: @{$self->{'args'}}\n\n"; + } else { + DEBUG > 1 and print " Okay, no PERLDOC setting in ENV.\n"; + } + + DEBUG > 1 + and print " Args right before switch processing: @{$self->{'args'}}\n"; + + Pod::Perldoc::GetOptsOO::getopts( $self, $self->{'args'}, 'YES' ) + or return $self->usage; + + DEBUG > 1 + and print " Args after switch processing: @{$self->{'args'}}\n"; + + return $self->usage if $self->opt_h; + + return; +} + +#.......................................................................... + +sub options_processing { + my $self = shift; + + if ($self->opt_X) { + my $podidx = "$Config{'archlib'}/pod.idx"; + $podidx = "" unless -f $podidx && -r _ && -M _ <= 7; + $self->{'podidx'} = $podidx; + } + + $self->{'output_to_stdout'} = 1 if $self->opt_T or ! -t STDOUT; + + $self->options_sanity; + + # This used to set a default, but that's now moved into any + # formatter that cares to have a default. + if( $self->opt_n ) { + $self->add_formatter_option( '__nroffer' => $self->opt_n ); + } + + # Get language from PERLDOC_POD2 environment variable + if ( ! $self->opt_L && $ENV{PERLDOC_POD2} ) { + if ( $ENV{PERLDOC_POD2} eq '1' ) { + $self->_elem('opt_L',(split(/\_/, $ENV{LC_ALL} || $ENV{LC_LANG} || $ENV{LANG}))[0] ); + } + else { + $self->_elem('opt_L', $ENV{PERLDOC_POD2}); + } + }; + + # Adjust for using translation packages + $self->add_translator(split(/\s+/,$self->opt_L)) if $self->opt_L; + + return; +} + +#.......................................................................... + +sub options_sanity { + my $self = shift; + + # The opts-counting stuff interacts quite badly with + # the $ENV{"PERLDOC"} stuff. I.e., if I have $ENV{"PERLDOC"} + # set to -t, and I specify -u on the command line, I don't want + # to be hectored at that -u and -t don't make sense together. + + #my $opts = grep $_ && 1, # yes, the count of the set ones + # $self->opt_t, $self->opt_u, $self->opt_m, $self->opt_l + #; + # + #$self->usage("only one of -t, -u, -m or -l") if $opts > 1; + + + # Any sanity-checking need doing here? + + # But does not make sense to set either -f or -q in $ENV{"PERLDOC"} + if( $self->opt_f or $self->opt_q or $self->opt_a) { + my $count; + $count++ if $self->opt_f; + $count++ if $self->opt_q; + $count++ if $self->opt_a; + $self->usage("Only one of -f or -q or -a") if $count > 1; + $self->warn( + "Perldoc is meant for reading one file at a time.\n", + "So these parameters are being ignored: ", + join(' ', @{$self->{'args'}}), + "\n" ) + if @{$self->{'args'}} + } + return; +} + +#.......................................................................... + +sub grand_search_init { + my($self, $pages, @found) = @_; + + foreach (@$pages) { + if (/^http(s)?:\/\//) { + require HTTP::Tiny; + require File::Temp; + my $response = HTTP::Tiny->new->get($_); + if ($response->{success}) { + my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1); + $fh->print($response->{content}); + push @found, $filename; + ($self->{podnames}{$filename} = + m{.*/([^/#?]+)} ? uc $1 : "UNKNOWN") + =~ s/\.P(?:[ML]|OD)\z//; + } + else { + print STDERR "No " . + ($self->opt_m ? "module" : "documentation") . " found for \"$_\".\n"; + if ( /^https/ ) { + print STDERR "You may need an SSL library (such as IO::Socket::SSL) for that URL.\n"; + } + } + next; + } + if ($self->{'podidx'} && open(PODIDX, $self->{'podidx'})) { + my $searchfor = catfile split '::', $_; + $self->aside( "Searching for '$searchfor' in $self->{'podidx'}\n" ); + local $_; + while () { + chomp; + push(@found, $_) if m,/$searchfor(?:\.(?:pod|pm))?\z,i; + } + close(PODIDX) or $self->die( "Can't close $$self{'podidx'}: $!" ); + next; + } + + $self->aside( "Searching for $_\n" ); + + if ($self->opt_F) { + next unless -r; + push @found, $_ if $self->opt_l or $self->opt_m or $self->containspod($_); + next; + } + + my @searchdirs; + + # prepend extra search directories (including language specific) + push @searchdirs, @{ $self->{'extra_search_dirs'} }; + + # We must look both in @INC for library modules and in $bindir + # for executables, like h2xs or perldoc itself. + push @searchdirs, ($self->{'bindir'}, @{$self->{search_path}}, @INC); + unless ($self->opt_m) { + if ($self->is_vms) { + my($i,$trn); + for ($i = 0; $trn = $ENV{'DCL$PATH;'.$i}; $i++) { + push(@searchdirs,$trn); + } + push(@searchdirs,'perl_root:[lib.pods]') # installed pods + } + else { + push(@searchdirs, grep(-d, split($Config{path_sep}, + $ENV{'PATH'}))); + } + } + my @files = $self->searchfor(0,$_,@searchdirs); + if (@files) { + $self->aside( "Found as @files\n" ); + } + # add "perl" prefix, so "perldoc foo" may find perlfoo.pod + elsif (BE_LENIENT and !/\W/ and @files = $self->searchfor(0, "perl$_", @searchdirs)) { + $self->aside( "Loosely found as @files\n" ); + } + else { + # no match, try recursive search + @searchdirs = grep(!/^\.\z/s,@INC); + @files= $self->searchfor(1,$_,@searchdirs) if $self->opt_r; + if (@files) { + $self->aside( "Loosely found as @files\n" ); + } + else { + print STDERR "No " . + ($self->opt_m ? "module" : "documentation") . " found for \"$_\".\n"; + if ( @{ $self->{'found'} } ) { + print STDERR "However, try\n"; + my $me = $self->program_name; + for my $dir (@{ $self->{'found'} }) { + opendir(DIR, $dir) or $self->die( "opendir $dir: $!" ); + while (my $file = readdir(DIR)) { + next if ($file =~ /^\./s); + $file =~ s/\.(pm|pod)\z//; # XXX: badfs + print STDERR "\t$me $_\::$file\n"; + } + closedir(DIR) or $self->die( "closedir $dir: $!" ); + } + } + } + } + push(@found,@files); + } + return @found; +} + +#.......................................................................... + +sub maybe_generate_dynamic_pod { + my($self, $found_things) = @_; + my @dynamic_pod; + + $self->search_perlapi($found_things, \@dynamic_pod) if $self->opt_a; + + $self->search_perlfunc($found_things, \@dynamic_pod) if $self->opt_f; + + $self->search_perlvar($found_things, \@dynamic_pod) if $self->opt_v; + + $self->search_perlfaqs($found_things, \@dynamic_pod) if $self->opt_q; + + if( ! $self->opt_f and ! $self->opt_q and ! $self->opt_v and ! $self->opt_a) { + DEBUG > 4 and print "That's a non-dynamic pod search.\n"; + } elsif ( @dynamic_pod ) { + $self->aside("Hm, I found some Pod from that search!\n"); + my ($buffd, $buffer) = $self->new_tempfile('pod', 'dyn'); + if ( $] >= 5.008 && $self->opt_L ) { + binmode($buffd, ":encoding(UTF-8)"); + print $buffd "=encoding utf8\n\n"; + } + + push @{ $self->{'temp_file_list'} }, $buffer; + # I.e., it MIGHT be deleted at the end. + + my $in_list = !$self->not_dynamic && $self->opt_f || $self->opt_v || $self->opt_a; + + print $buffd "=over 8\n\n" if $in_list; + print $buffd @dynamic_pod or $self->die( "Can't print $buffer: $!" ); + print $buffd "=back\n" if $in_list; + + close $buffd or $self->die( "Can't close $buffer: $!" ); + + @$found_things = $buffer; + # Yes, so found_things never has more than one thing in + # it, by time we leave here + + $self->add_formatter_option('__filter_nroff' => 1); + + } else { + @$found_things = (); + $self->aside("I found no Pod from that search!\n"); + } + + return; +} + +#.......................................................................... + +sub not_dynamic { + my ($self,$value) = @_; + $self->{__not_dynamic} = $value if @_ == 2; + return $self->{__not_dynamic}; +} + +#.......................................................................... + +sub add_formatter_option { # $self->add_formatter_option('key' => 'value'); + my $self = shift; + push @{ $self->{'formatter_switches'} }, [ @_ ] if @_; + + DEBUG > 3 and printf "Formatter switches now: [%s]\n", + join ' ', map "[@$_]", @{ $self->{'formatter_switches'} }; + + return; +} + +#......................................................................... + +sub new_translator { # $tr = $self->new_translator($lang); + my $self = shift; + my $lang = shift; + + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; + my $pack = 'POD2::' . uc($lang); + eval "require $pack"; + if ( !$@ && $pack->can('new') ) { + return $pack->new(); + } + + eval { require POD2::Base }; + return if $@; + + return POD2::Base->new({ lang => $lang }); +} + +#......................................................................... + +sub add_translator { # $self->add_translator($lang); + my $self = shift; + for my $lang (@_) { + my $tr = $self->new_translator($lang); + if ( defined $tr ) { + push @{ $self->{'translators'} }, $tr; + push @{ $self->{'extra_search_dirs'} }, $tr->pod_dirs; + + $self->aside( "translator for '$lang' loaded\n" ); + } else { + # non-installed or bad translator package + $self->warn( "Perldoc cannot load translator package for '$lang': ignored\n" ); + } + + } + return; +} + +#.......................................................................... + +sub open_fh { + my ($self, $op, $path) = @_; + + open my $fh, $op, $path or $self->die("Couldn't open $path: $!"); + return $fh; +} + +sub set_encoding { + my ($self, $fh, $encoding) = @_; + + if ( $encoding =~ /utf-?8/i ) { + $encoding = ":encoding(UTF-8)"; + } + else { + $encoding = ":encoding($encoding)"; + } + + if ( $] < 5.008 ) { + $self->aside("Your old perl doesn't have proper unicode support."); + } + else { + binmode($fh, $encoding); + } + + return $fh; +} + +sub search_perlvar { + my($self, $found_things, $pod) = @_; + + my $opt = $self->opt_v; + + if ( $opt !~ /^ (?: [\@\%\$]\S+ | [A-Z]\w* ) $/x ) { + CORE::die( "'$opt' does not look like a Perl variable\n" ); + } + + DEBUG > 2 and print "Search: @$found_things\n"; + + my $perlvar = shift @$found_things; + my $fh = $self->open_fh("<", $perlvar); + + if ( $opt ne '$0' && $opt =~ /^\$\d+$/ ) { # handle $1, $2, ... + $opt = '$>'; + } + my $search_re = quotemeta($opt); + + DEBUG > 2 and + print "Going to perlvar-scan for $search_re in $perlvar\n"; + + # Skip introduction + local $_; + my $enc; + while (<$fh>) { + $enc = $1 if /^=encoding\s+(\S+)/; + last if /^=over 8/; + } + + $fh = $self->set_encoding($fh, $enc) if $enc; + + # Look for our variable + my $found = 0; + my $inheader = 1; + my $inlist = 0; + while (<$fh>) { + last if /^=head2 Error Indicators/; + # \b at the end of $` and friends borks things! + if ( m/^=item\s+$search_re\s/ ) { + $found = 1; + } + elsif (/^=item/) { + last if $found && !$inheader && !$inlist; + } + elsif (!/^\s+$/) { # not a blank line + if ( $found ) { + $inheader = 0; # don't accept more =item (unless inlist) + } + else { + @$pod = (); # reset + $inheader = 1; # start over + next; + } + } + + if (/^=over/) { + ++$inlist; + } + elsif (/^=back/) { + last if $found && !$inheader && !$inlist; + --$inlist; + } + push @$pod, $_; +# ++$found if /^\w/; # found descriptive text + } + @$pod = () unless $found; + if (!@$pod) { + CORE::die( "No documentation for perl variable '$opt' found\n" ); + } + close $fh or $self->die( "Can't close $perlvar: $!" ); + + return; +} + +#.......................................................................... + +sub search_perlop { + my ($self,$found_things,$pod) = @_; + + $self->not_dynamic( 1 ); + + my $perlop = shift @$found_things; + # XXX FIXME: getting filehandles should probably be done in a single place + # especially since we need to support UTF8 or other encoding when dealing + # with perlop, perlfunc, perlapi, perlfaq[1-9] + my $fh = $self->open_fh('<', $perlop); + + my $thing = $self->opt_f; + + my $previous_line; + my $push = 0; + my $seen_item = 0; + my $skip = 1; + + while( my $line = <$fh> ) { + $line =~ /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1); + # only start search after we hit the operator section + if ($line =~ m!^X!) { + $skip = 0; + } + + next if $skip; + + # strategy is to capture the previous line until we get a match on X<$thingy> + # if the current line contains X<$thingy>, then we push "=over", the previous line, + # the current line and keep pushing current line until we see a ^X, + # then we chop off final line from @$pod and add =back + # + # At that point, Bob's your uncle. + + if ( $line =~ m!X<+\s*\Q$thing\E\s*>+!) { + if ( $previous_line ) { + push @$pod, "=over 8\n\n", $previous_line; + $previous_line = ""; + } + push @$pod, $line; + $push = 1; + + } + elsif ( $push and $line =~ m!^=item\s*.*$! ) { + $seen_item = 1; + } + elsif ( $push and $seen_item and $line =~ m!^X<+\s*[ a-z,?-]+\s*>+!) { + $push = 0; + $seen_item = 0; + last; + } + elsif ( $push ) { + push @$pod, $line; + } + + else { + $previous_line = $line; + } + + } #end while + + # we overfilled by 1 line, so pop off final array element if we have any + if ( scalar @$pod ) { + pop @$pod; + + # and add the =back + push @$pod, "\n\n=back\n"; + DEBUG > 8 and print "PERLOP POD --->" . (join "", @$pod) . "<---\n"; + } + else { + DEBUG > 4 and print "No pod from perlop\n"; + } + + close $fh; + + return; +} + +#.......................................................................... + +sub search_perlapi { + my($self, $found_things, $pod) = @_; + + DEBUG > 2 and print "Search: @$found_things\n"; + + my $perlapi = shift @$found_things; + my $fh = $self->open_fh('<', $perlapi); + + my $search_re = quotemeta($self->opt_a); + + DEBUG > 2 and + print "Going to perlapi-scan for $search_re in $perlapi\n"; + + local $_; + + # Look for our function + my $found = 0; + my $inlist = 0; + + my @related; + my $related_re; + while (<$fh>) { + /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1); + + if ( m/^=item\s+$search_re\b/ ) { + $found = 1; + } + elsif (@related > 1 and /^=item/) { + $related_re ||= join "|", @related; + if (m/^=item\s+(?:$related_re)\b/) { + $found = 1; + } + else { + last; + } + } + elsif (/^=item/) { + last if $found > 1 and not $inlist; + } + elsif ($found and /^X<[^>]+>/) { + push @related, m/X<([^>]+)>/g; + } + next unless $found; + if (/^=over/) { + ++$inlist; + } + elsif (/^=back/) { + last if $found > 1 and not $inlist; + --$inlist; + } + push @$pod, $_; + ++$found if /^\w/; # found descriptive text + } + + if (!@$pod) { + CORE::die( sprintf + "No documentation for perl api function '%s' found\n", + $self->opt_a ) + ; + } + close $fh or $self->die( "Can't open $perlapi: $!" ); + + return; +} + +#.......................................................................... + +sub search_perlfunc { + my($self, $found_things, $pod) = @_; + + DEBUG > 2 and print "Search: @$found_things\n"; + + my $pfunc = shift @$found_things; + my $fh = $self->open_fh("<", $pfunc); # "Funk is its own reward" + + # Functions like -r, -e, etc. are listed under `-X'. + my $search_re = ($self->opt_f =~ /^-[rwxoRWXOeszfdlpSbctugkTBMAC]$/) + ? '(?:I<)?-X' : quotemeta($self->opt_f) ; + + DEBUG > 2 and + print "Going to perlfunc-scan for $search_re in $pfunc\n"; + + my $re = 'Alphabetical Listing of Perl Functions'; + + # Check available translator or backup to default (english) + if ( $self->opt_L && defined $self->{'translators'}->[0] ) { + my $tr = $self->{'translators'}->[0]; + $re = $tr->search_perlfunc_re if $tr->can('search_perlfunc_re'); + if ( $] < 5.008 ) { + $self->aside("Your old perl doesn't really have proper unicode support."); + } + } + + # Skip introduction + local $_; + while (<$fh>) { + /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1); + last if /^=head2 (?:$re|Alphabetical Listing of Perl Functions)/; + } + + # Look for our function + my $found = 0; + my $inlist = 0; + + my @perlops = qw(m q qq qr qx qw s tr y); + + my @related; + my $related_re; + while (<$fh>) { # "The Mothership Connection is here!" + last if( grep{ $self->opt_f eq $_ }@perlops ); + + if ( /^=over/ and not $found ) { + ++$inlist; + } + elsif ( /^=back/ and not $found and $inlist ) { + --$inlist; + } + + + if ( m/^=item\s+$search_re\b/ and $inlist < 2 ) { + $found = 1; + } + elsif (@related > 1 and /^=item/) { + $related_re ||= join "|", @related; + if (m/^=item\s+(?:$related_re)\b/) { + $found = 1; + } + else { + last if $found > 1 and $inlist < 2; + } + } + elsif (/^=item|^=back/) { + last if $found > 1 and $inlist < 2; + } + elsif ($found and /^X<[^>]+>/) { + push @related, m/X<([^>]+)>/g; + } + next unless $found; + if (/^=over/) { + ++$inlist; + } + elsif (/^=back/) { + --$inlist; + } + push @$pod, $_; + ++$found if /^\w/; # found descriptive text + } + + if( !@$pod ){ + $self->search_perlop( $found_things, $pod ); + } + + if (!@$pod) { + CORE::die( sprintf + "No documentation for perl function '%s' found\n", + $self->opt_f ) + ; + } + close $fh or $self->die( "Can't close $pfunc: $!" ); + + return; +} + +#.......................................................................... + +sub search_perlfaqs { + my( $self, $found_things, $pod) = @_; + + my $found = 0; + my %found_in; + my $search_key = $self->opt_q; + + my $rx = eval { qr/$search_key/ } + or $self->die( <die( "invalid file spec: $!" ) if $file =~ /[<>|]/; + my $fh = $self->open_fh("<", $file); + while (<$fh>) { + /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1); + if ( m/^=head2\s+.*(?:$search_key)/i ) { + $found = 1; + push @$pod, "=head1 Found in $file\n\n" unless $found_in{$file}++; + } + elsif (/^=head[12]/) { + $found = 0; + } + next unless $found; + push @$pod, $_; + } + close($fh); + } + CORE::die("No documentation for perl FAQ keyword '$search_key' found\n") + unless @$pod; + + if ( $self->opt_l ) { + CORE::die((join "\n", keys %found_in) . "\n"); + } + return; +} + + +#.......................................................................... + +sub render_findings { + # Return the filename to open + + my($self, $found_things) = @_; + + my $formatter_class = $self->{'formatter_class'} + || $self->die( "No formatter class set!?" ); + my $formatter = $formatter_class->can('new') + ? $formatter_class->new + : $formatter_class + ; + + if(! @$found_things) { + $self->die( "Nothing found?!" ); + # should have been caught before here + } elsif(@$found_things > 1) { + $self->warn( + "Perldoc is only really meant for reading one document at a time.\n", + "So these parameters are being ignored: ", + join(' ', @$found_things[1 .. $#$found_things] ), + "\n" ); + } + + my $file = $found_things->[0]; + + DEBUG > 3 and printf "Formatter switches now: [%s]\n", + join ' ', map "[@$_]", @{ $self->{'formatter_switches'} }; + + # Set formatter options: + if( ref $formatter ) { + foreach my $f (@{ $self->{'formatter_switches'} || [] }) { + my($switch, $value, $silent_fail) = @$f; + if( $formatter->can($switch) ) { + eval { $formatter->$switch( defined($value) ? $value : () ) }; + $self->warn( "Got an error when setting $formatter_class\->$switch:\n$@\n" ) + if $@; + } else { + if( $silent_fail or $switch =~ m/^__/s ) { + DEBUG > 2 and print "Formatter $formatter_class doesn't support $switch\n"; + } else { + $self->warn( "$formatter_class doesn't recognize the $switch switch.\n" ); + } + } + } + } + + $self->{'output_is_binary'} = + $formatter->can('write_with_binmode') && $formatter->write_with_binmode; + + if( $self->{podnames} and exists $self->{podnames}{$file} and + $formatter->can('name') ) { + $formatter->name($self->{podnames}{$file}); + } + + my ($out_fh, $out) = $self->new_output_file( + ( $formatter->can('output_extension') && $formatter->output_extension ) + || undef, + $self->useful_filename_bit, + ); + + # Now, finally, do the formatting! + { + local $^W = $^W; + if(DEBUG() or $self->opt_D) { + # feh, let 'em see it + } else { + $^W = 0; + # The average user just has no reason to be seeing + # $^W-suppressible warnings from the formatting! + } + + eval { $formatter->parse_from_file( $file, $out_fh ) }; + } + + $self->warn( "Error while formatting with $formatter_class:\n $@\n" ) if $@; + DEBUG > 2 and print "Back from formatting with $formatter_class\n"; + + close $out_fh + or $self->warn( "Can't close $out: $!\n(Did $formatter already close it?)" ); + sleep 0; sleep 0; sleep 0; + # Give the system a few timeslices to meditate on the fact + # that the output file does in fact exist and is closed. + + $self->unlink_if_temp_file($file); + + unless( -s $out ) { + if( $formatter->can( 'if_zero_length' ) ) { + # Basically this is just a hook for Pod::Simple::Checker; since + # what other class could /happily/ format an input file with Pod + # as a 0-length output file? + $formatter->if_zero_length( $file, $out, $out_fh ); + } else { + $self->warn( "Got a 0-length file from $$found_things[0] via $formatter_class!?\n" ); + } + } + + DEBUG and print "Finished writing to $out.\n"; + return($out, $formatter) if wantarray; + return $out; +} + +#.......................................................................... + +sub unlink_if_temp_file { + # Unlink the specified file IFF it's in the list of temp files. + # Really only used in the case of -f / -q things when we can + # throw away the dynamically generated source pod file once + # we've formatted it. + # + my($self, $file) = @_; + return unless defined $file and length $file; + + my $temp_file_list = $self->{'temp_file_list'} || return; + if(grep $_ eq $file, @$temp_file_list) { + $self->aside("Unlinking $file\n"); + unlink($file) or $self->warn( "Odd, couldn't unlink $file: $!" ); + } else { + DEBUG > 1 and print "$file isn't a temp file, so not unlinking.\n"; + } + return; +} + +#.......................................................................... + + +sub after_rendering { + my $self = $_[0]; + $self->after_rendering_VMS if $self->is_vms; + $self->after_rendering_MSWin32 if $self->is_mswin32; + $self->after_rendering_Dos if $self->is_dos; + $self->after_rendering_OS2 if $self->is_os2; + return; +} + +sub after_rendering_VMS { return } +sub after_rendering_Dos { return } +sub after_rendering_OS2 { return } +sub after_rendering_MSWin32 { return } + +#.......................................................................... +# : : : : : : : : : +#.......................................................................... + +sub minus_f_nocase { # i.e., do like -f, but without regard to case + + my($self, $dir, $file) = @_; + my $path = catfile($dir,$file); + return $path if -f $path and -r _; + + if(!$self->opt_i + or $self->is_vms or $self->is_mswin32 + or $self->is_dos or $self->is_os2 + ) { + # On a case-forgiving file system, or if case is important, + # that is it, all we can do. + $self->warn( "Ignored $path: unreadable\n" ) if -f _; + return ''; + } + + local *DIR; + my @p = ($dir); + my($p,$cip); + foreach $p (splitdir $file){ + my $try = catfile @p, $p; + $self->aside("Scrutinizing $try...\n"); + stat $try; + if (-d _) { + push @p, $p; + if ( $p eq $self->{'target'} ) { + my $tmp_path = catfile @p; + my $path_f = 0; + for (@{ $self->{'found'} }) { + $path_f = 1 if $_ eq $tmp_path; + } + push (@{ $self->{'found'} }, $tmp_path) unless $path_f; + $self->aside( "Found as $tmp_path but directory\n" ); + } + } + elsif (-f _ && -r _ && lc($try) eq lc($path)) { + return $try; + } + elsif (-f _) { + $self->warn( "Ignored $try: unreadable or file/dir mismatch\n" ); + } + elsif (-d catdir(@p)) { # at least we see the containing directory! + my $found = 0; + my $lcp = lc $p; + my $p_dirspec = catdir(@p); + opendir DIR, $p_dirspec or $self->die( "opendir $p_dirspec: $!" ); + while(defined( $cip = readdir(DIR) )) { + if (lc $cip eq $lcp){ + $found++; + last; # XXX stop at the first? what if there's others? + } + } + closedir DIR or $self->die( "closedir $p_dirspec: $!" ); + return "" unless $found; + + push @p, $cip; + my $p_filespec = catfile(@p); + return $p_filespec if -f $p_filespec and -r _; + $self->warn( "Ignored $p_filespec: unreadable\n" ) if -f _; + } + } + return ""; +} + +#.......................................................................... + +sub pagers_guessing { + # TODO: This whole subroutine needs to be rewritten. It's semi-insane + # right now. + + my $self = shift; + + my @pagers; + push @pagers, $self->pagers; + $self->{'pagers'} = \@pagers; + + if ($self->is_mswin32) { + push @pagers, qw( more< less notepad ); + unshift @pagers, $ENV{PAGER} if $ENV{PAGER}; + } + elsif ($self->is_vms) { + push @pagers, qw( most more less type/page ); + } + elsif ($self->is_dos) { + push @pagers, qw( less.exe more.com< ); + unshift @pagers, $ENV{PAGER} if $ENV{PAGER}; + } + elsif ( $self->is_amigaos) { + push @pagers, qw( /SYS/Utilities/MultiView /SYS/Utilities/More /C/TYPE ); + unshift @pagers, "$ENV{PAGER}" if $ENV{PAGER}; + } + else { + if ($self->is_os2) { + unshift @pagers, 'less', 'cmd /c more <'; + } + push @pagers, qw( more less pg view cat ); + unshift @pagers, "$ENV{PAGER} <" if $ENV{PAGER}; + } + + if ($self->is_cygwin) { + if (($pagers[0] eq 'less') || ($pagers[0] eq '/usr/bin/less')) { + unshift @pagers, '/usr/bin/less -isrR'; + unshift @pagers, $ENV{PAGER} if $ENV{PAGER}; + } + } + + if ( $self->opt_m ) { + unshift @pagers, "$ENV{PERLDOC_SRC_PAGER}" if $ENV{PERLDOC_SRC_PAGER} + } + else { + unshift @pagers, "$ENV{MANPAGER} <" if $ENV{MANPAGER}; + unshift @pagers, "$ENV{PERLDOC_PAGER} <" if $ENV{PERLDOC_PAGER}; + } + + $self->aside("Pagers: ", (join ", ", @pagers)); + + return; +} + +#.......................................................................... + +sub page_module_file { + my($self, @found) = @_; + + # Security note: + # Don't ever just pass this off to anything like MSWin's "start.exe", + # since we might be calling on a .pl file, and we wouldn't want that + # to actually /execute/ the file that we just want to page thru! + # Also a consideration if one were to use a web browser as a pager; + # doing so could trigger the browser's MIME mapping for whatever + # it thinks .pm/.pl/whatever is. Probably just a (useless and + # annoying) "Save as..." dialog, but potentially executing the file + # in question -- particularly in the case of MSIE and it's, ahem, + # occasionally hazy distinction between OS-local extension + # associations, and browser-specific MIME mappings. + + if(@found > 1) { + $self->warn( + "Perldoc is only really meant for reading one document at a time.\n" . + "So these files are being ignored: " . + join(' ', @found[1 .. $#found] ) . + "\n" ) + } + + return $self->page($found[0], $self->{'output_to_stdout'}, $self->pagers); + +} + +#.......................................................................... + +sub check_file { + my($self, $dir, $file) = @_; + + unless( ref $self ) { + # Should never get called: + $Carp::Verbose = 1; + require Carp; + Carp::croak( join '', + "Crazy ", __PACKAGE__, " error:\n", + "check_file must be an object_method!\n", + "Aborting" + ); + } + + if(length $dir and not -d $dir) { + DEBUG > 3 and print " No dir $dir -- skipping.\n"; + return ""; + } + + my $path = $self->minus_f_nocase($dir,$file); + if( length $path and ($self->opt_m ? $self->isprintable($path) + : $self->containspod($path)) ) { + DEBUG > 3 and print + " The file $path indeed looks promising!\n"; + return $path; + } + DEBUG > 3 and print " No good: $file in $dir\n"; + + return ""; +} + +sub isprintable { + my($self, $file, $readit) = @_; + my $size= 1024; + my $maxunprintfrac= 0.2; # tolerate some unprintables for UTF-8 comments etc. + + return 1 if !$readit && $file =~ /\.(?:pl|pm|pod|cmd|com|bat)\z/i; + + my $data; + local($_); + my $fh = $self->open_fh("<", $file); + read $fh, $data, $size; + close $fh; + $size= length($data); + $data =~ tr/\x09-\x0D\x20-\x7E//d; + return length($data) <= $size*$maxunprintfrac; +} + +#.......................................................................... + +sub containspod { + my($self, $file, $readit) = @_; + return 1 if !$readit && $file =~ /\.pod\z/i; + + + # Under cygwin the /usr/bin/perl is legal executable, but + # you cannot open a file with that name. It must be spelled + # out as "/usr/bin/perl.exe". + # + # The following if-case under cygwin prevents error + # + # $ perldoc perl + # Cannot open /usr/bin/perl: no such file or directory + # + # This would work though + # + # $ perldoc perl.pod + + if ( $self->is_cygwin and -x $file and -f "$file.exe" ) + { + $self->warn( "Cygwin $file.exe search skipped\n" ) if DEBUG or $self->opt_D; + return 0; + } + + local($_); + my $fh = $self->open_fh("<", $file); + while (<$fh>) { + if (/^=head/) { + close($fh) or $self->die( "Can't close $file: $!" ); + return 1; + } + } + close($fh) or $self->die( "Can't close $file: $!" ); + return 0; +} + +#.......................................................................... + +sub maybe_extend_searchpath { + my $self = shift; + + # Does this look like a module or extension directory? + + if (-f "Makefile.PL" || -f "Build.PL") { + + push @{$self->{search_path} }, '.','lib'; + + # don't add if superuser + if ($< && $> && -d "blib") { # don't be looking too hard now! + push @{ $self->{search_path} }, 'blib'; + $self->warn( $@ ) if $@ && $self->opt_D; + } + } + + return; +} + +#.......................................................................... + +sub new_output_file { + my $self = shift; + my $outspec = $self->opt_d; # Yes, -d overrides all else! + # So don't call this twice per format-job! + + return $self->new_tempfile(@_) unless defined $outspec and length $outspec; + + # Otherwise open a write-handle on opt_d!f + + DEBUG > 3 and print "About to try writing to specified output file $outspec\n"; + my $fh = $self->open_fh(">", $outspec); + + DEBUG > 3 and print "Successfully opened $outspec\n"; + binmode($fh) if $self->{'output_is_binary'}; + return($fh, $outspec); +} + +#.......................................................................... + +sub useful_filename_bit { + # This tries to provide a meaningful bit of text to do with the query, + # such as can be used in naming the file -- since if we're going to be + # opening windows on temp files (as a "pager" may well do!) then it's + # better if the temp file's name (which may well be used as the window + # title) isn't ALL just random garbage! + # In other words "perldoc_LWPSimple_2371981429" is a better temp file + # name than "perldoc_2371981429". So this routine is what tries to + # provide the "LWPSimple" bit. + # + my $self = shift; + my $pages = $self->{'pages'} || return undef; + return undef unless @$pages; + + my $chunk = $pages->[0]; + return undef unless defined $chunk; + $chunk =~ s/:://g; + $chunk =~ s/\.\w+$//g; # strip any extension + if( $chunk =~ m/([^\#\\:\/\$]+)$/s ) { # get basename, if it's a file + $chunk = $1; + } else { + return undef; + } + $chunk =~ s/[^a-zA-Z0-9]+//g; # leave ONLY a-zA-Z0-9 things! + $chunk = substr($chunk, -10) if length($chunk) > 10; + return $chunk; +} + +#.......................................................................... + +sub new_tempfile { # $self->new_tempfile( [$suffix, [$infix] ] ) + my $self = shift; + + ++$Temp_Files_Created; + + require File::Temp; + return File::Temp::tempfile(UNLINK => 1); +} + +#.......................................................................... + +sub page { # apply a pager to the output file + my ($self, $output, $output_to_stdout, @pagers) = @_; + if ($output_to_stdout) { + $self->aside("Sending unpaged output to STDOUT.\n"); + my $fh = $self->open_fh("<", $output); + local $_; + while (<$fh>) { + print or $self->die( "Can't print to stdout: $!" ); + } + close $fh or $self->die( "Can't close while $output: $!" ); + $self->unlink_if_temp_file($output); + } else { + # On VMS, quoting prevents logical expansion, and temp files with no + # extension get the wrong default extension (such as .LIS for TYPE) + + $output = VMS::Filespec::rmsexpand($output, '.') if $self->is_vms; + + $output =~ s{/}{\\}g if $self->is_mswin32 || $self->is_dos; + # Altho "/" under MSWin is in theory good as a pathsep, + # many many corners of the OS don't like it. So we + # have to force it to be "\" to make everyone happy. + + # if we are on an amiga convert unix path to an amiga one + $output =~ s/^\/(.*)\/(.*)/$1:$2/ if $self->is_amigaos; + + foreach my $pager (@pagers) { + $self->aside("About to try calling $pager $output\n"); + if ($self->is_vms) { + last if system("$pager $output") == 0; + } elsif($self->is_amigaos) { + last if system($pager, $output) == 0; + } else { + last if system("$pager \"$output\"") == 0; + } + } + } + return; +} + +#.......................................................................... + +sub searchfor { + my($self, $recurse,$s,@dirs) = @_; + $s =~ s!::!/!g; + $s = VMS::Filespec::unixify($s) if $self->is_vms; + return $s if -f $s && $self->containspod($s); + $self->aside( "Looking for $s in @dirs\n" ); + my $ret; + my $i; + my $dir; + $self->{'target'} = (splitdir $s)[-1]; # XXX: why not use File::Basename? + for ($i=0; $i<@dirs; $i++) { + $dir = $dirs[$i]; + next unless -d $dir; + ($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if $self->is_vms; + if ( (! $self->opt_m && ( $ret = $self->check_file($dir,"$s.pod"))) + or ( $ret = $self->check_file($dir,"$s.pm")) + or ( $ret = $self->check_file($dir,$s)) + or ( $self->is_vms and + $ret = $self->check_file($dir,"$s.com")) + or ( $self->is_os2 and + $ret = $self->check_file($dir,"$s.cmd")) + or ( ($self->is_mswin32 or $self->is_dos or $self->is_os2) and + $ret = $self->check_file($dir,"$s.bat")) + or ( $ret = $self->check_file("$dir/pod","$s.pod")) + or ( $ret = $self->check_file("$dir/pod",$s)) + or ( $ret = $self->check_file("$dir/pods","$s.pod")) + or ( $ret = $self->check_file("$dir/pods",$s)) + ) { + DEBUG > 1 and print " Found $ret\n"; + return $ret; + } + + if ($recurse) { + opendir(D,$dir) or $self->die( "Can't opendir $dir: $!" ); + my @newdirs = map catfile($dir, $_), grep { + not /^\.\.?\z/s and + not /^auto\z/s and # save time! don't search auto dirs + -d catfile($dir, $_) + } readdir D; + closedir(D) or $self->die( "Can't closedir $dir: $!" ); + next unless @newdirs; + # what a wicked map! + @newdirs = map((s/\.dir\z//,$_)[1],@newdirs) if $self->is_vms; + $self->aside( "Also looking in @newdirs\n" ); + push(@dirs,@newdirs); + } + } + return (); +} + +#.......................................................................... +{ + my $already_asserted; + sub assert_closing_stdout { + my $self = shift; + + return if $already_asserted; + + eval q~ END { close(STDOUT) || CORE::die "Can't close STDOUT: $!" } ~; + # What for? to let the pager know that nothing more will come? + + $self->die( $@ ) if $@; + $already_asserted = 1; + return; + } +} + +#.......................................................................... + +sub tweak_found_pathnames { + my($self, $found) = @_; + if ($self->is_mswin32) { + foreach (@$found) { s,/,\\,g } + } + foreach (@$found) { s,',\\',g } # RT 37347 + return; +} + +#.......................................................................... +# : : : : : : : : : +#.......................................................................... + +sub am_taint_checking { + my $self = shift; + $self->die( "NO ENVIRONMENT?!?!" ) unless keys %ENV; # reset iterator along the way + my($k,$v) = each %ENV; + return is_tainted($v); +} + +#.......................................................................... + +sub is_tainted { # just a function + my $arg = shift; + my $nada = substr($arg, 0, 0); # zero-length! + local $@; # preserve the caller's version of $@ + eval { eval "# $nada" }; + return length($@) != 0; +} + +#.......................................................................... + +sub drop_privs_maybe { + my $self = shift; + + DEBUG and print "Attempting to drop privs...\n"; + + # Attempt to drop privs if we should be tainting and aren't + if (!( $self->is_vms || $self->is_mswin32 || $self->is_dos + || $self->is_os2 + ) + && ($> == 0 || $< == 0) + && !$self->am_taint_checking() + ) { + my $id = eval { getpwnam("nobody") }; + $id = eval { getpwnam("nouser") } unless defined $id; + $id = -2 unless defined $id; + # + # According to Stevens' APUE and various + # (BSD, Solaris, HP-UX) man pages, setting + # the real uid first and effective uid second + # is the way to go if one wants to drop privileges, + # because if one changes into an effective uid of + # non-zero, one cannot change the real uid any more. + # + # Actually, it gets even messier. There is + # a third uid, called the saved uid, and as + # long as that is zero, one can get back to + # uid of zero. Setting the real-effective *twice* + # helps in *most* systems (FreeBSD and Solaris) + # but apparently in HP-UX even this doesn't help: + # the saved uid stays zero (apparently the only way + # in HP-UX to change saved uid is to call setuid() + # when the effective uid is zero). + # + eval { + $< = $id; # real uid + $> = $id; # effective uid + $< = $id; # real uid + $> = $id; # effective uid + }; + if( !$@ && $< && $> ) { + DEBUG and print "OK, I dropped privileges.\n"; + } elsif( $self->opt_U ) { + DEBUG and print "Couldn't drop privileges, but in -U mode, so feh." + } else { + DEBUG and print "Hm, couldn't drop privileges. Ah well.\n"; + # We used to die here; but that seemed pointless. + } + } + return; +} + +#.......................................................................... + +1; + +__END__ + +=head1 NAME + +Pod::Perldoc - Look up Perl documentation in Pod format. + +=head1 SYNOPSIS + + use Pod::Perldoc (); + + Pod::Perldoc->run(); + +=head1 DESCRIPTION + +The guts of L utility. + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002-2007 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/BaseTo.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/BaseTo.pm new file mode 100644 index 0000000000000000000000000000000000000000..37f651047d63cd7edc0d96280c5f3f595d40f454 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/BaseTo.pm @@ -0,0 +1,154 @@ +package Pod::Perldoc::BaseTo; +use strict; +use warnings; + +use vars qw($VERSION); +$VERSION = '3.28'; + +use Carp qw(croak carp); +use Config qw(%Config); +use File::Spec::Functions qw(catfile); + +sub is_pageable { '' } +sub write_with_binmode { 1 } + +sub output_extension { 'txt' } # override in subclass! + +# sub new { my $self = shift; ... } +# sub parse_from_file( my($class, $in, $out) = ...; ... } + +#sub new { return bless {}, ref($_[0]) || $_[0] } + +# this is also in Perldoc.pm, but why look there when you're a +# subclass of this? +sub TRUE () {1} +sub FALSE () {return} + +BEGIN { + *is_vms = $^O eq 'VMS' ? \&TRUE : \&FALSE unless defined &is_vms; + *is_mswin32 = $^O eq 'MSWin32' ? \&TRUE : \&FALSE unless defined &is_mswin32; + *is_dos = $^O eq 'dos' ? \&TRUE : \&FALSE unless defined &is_dos; + *is_os2 = $^O eq 'os2' ? \&TRUE : \&FALSE unless defined &is_os2; + *is_cygwin = $^O eq 'cygwin' ? \&TRUE : \&FALSE unless defined &is_cygwin; + *is_linux = $^O eq 'linux' ? \&TRUE : \&FALSE unless defined &is_linux; + *is_hpux = $^O =~ m/hpux/ ? \&TRUE : \&FALSE unless defined &is_hpux; + *is_openbsd = $^O =~ m/openbsd/ ? \&TRUE : \&FALSE unless defined &is_openbsd; + *is_freebsd = $^O =~ m/freebsd/ ? \&TRUE : \&FALSE unless defined &is_freebsd; + *is_bitrig = $^O =~ m/bitrig/ ? \&TRUE : \&FALSE unless defined &is_bitrig; +} + +sub _perldoc_elem { + my($self, $name) = splice @_,0,2; + if(@_) { + $self->{$name} = $_[0]; + } else { + $self->{$name}; + } +} + +sub debugging { + my( $self, @messages ) = @_; + + ( defined(&Pod::Perldoc::DEBUG) and &Pod::Perldoc::DEBUG() ) + } + +sub debug { + my( $self, @messages ) = @_; + return unless $self->debugging; + print STDERR map { "DEBUG $_" } @messages; + } + +sub warn { + my( $self, @messages ) = @_; + carp join "\n", @messages, ''; + } + +sub die { + my( $self, @messages ) = @_; + croak join "\n", @messages, ''; + } + +sub _get_path_components { + my( $self ) = @_; + + my @paths = split /\Q$Config{path_sep}/, $ENV{PATH}; + + return @paths; + } + +sub _find_executable_in_path { + my( $self, $program ) = @_; + + my @found = (); + foreach my $dir ( $self->_get_path_components ) { + my $binary = catfile( $dir, $program ); + $self->debug( "Looking for $binary\n" ); + next unless -e $binary; + unless( -x $binary ) { + $self->warn( "Found $binary but it's not executable. Skipping.\n" ); + next; + } + $self->debug( "Found $binary\n" ); + push @found, $binary; + } + + return @found; + } + +1; + +__END__ + +=head1 NAME + +Pod::Perldoc::BaseTo - Base for Pod::Perldoc formatters + +=head1 SYNOPSIS + + package Pod::Perldoc::ToMyFormat; + + use parent qw( Pod::Perldoc::BaseTo ); + ... + +=head1 DESCRIPTION + +This package is meant as a base of Pod::Perldoc formatters, +like L, L, etc. + +It provides default implementations for the methods + + is_pageable + write_with_binmode + output_extension + _perldoc_elem + +The concrete formatter must implement + + new + parse_from_file + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002-2007 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/GetOptsOO.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/GetOptsOO.pm new file mode 100644 index 0000000000000000000000000000000000000000..afa2574ec7e443e10897b0ed9713303ae41f663a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/GetOptsOO.pm @@ -0,0 +1,161 @@ +package Pod::Perldoc::GetOptsOO; +use strict; + +use vars qw($VERSION); +$VERSION = '3.28'; + +BEGIN { # Make a DEBUG constant ASAP + *DEBUG = defined( &Pod::Perldoc::DEBUG ) + ? \&Pod::Perldoc::DEBUG + : sub(){10}; +} + + +sub getopts { + my($target, $args, $truth) = @_; + + $args ||= \@ARGV; + + $target->aside( + "Starting switch processing. Scanning arguments [@$args]\n" + ) if $target->can('aside'); + + return unless @$args; + + $truth = 1 unless @_ > 2; + + DEBUG > 3 and print " Truth is $truth\n"; + + + my $error_count = 0; + + while( @$args and ($_ = $args->[0]) =~ m/^-(.)(.*)/s ) { + my($first,$rest) = ($1,$2); + if ($_ eq '--') { # early exit if "--" + shift @$args; + last; + } + if ($first eq '-' and $rest) { # GNU style long param names + ($first, $rest) = split '=', $rest, 2; + } + my $method = "opt_${first}_with"; + if( $target->can($method) ) { # it's argumental + if($rest eq '') { # like -f bar + shift @$args; + $target->warn( "Option $first needs a following argument!\n" ) unless @$args; + $rest = shift @$args; + } else { # like -fbar (== -f bar) + shift @$args; + } + + DEBUG > 3 and print " $method => $rest\n"; + $target->$method( $rest ); + + # Otherwise, it's not argumental... + } else { + + if( $target->can( $method = "opt_$first" ) ) { + DEBUG > 3 and print " $method is true ($truth)\n"; + $target->$method( $truth ); + + # Otherwise it's an unknown option... + + } elsif( $target->can('handle_unknown_option') ) { + DEBUG > 3 + and print " calling handle_unknown_option('$first')\n"; + + $error_count += ( + $target->handle_unknown_option( $first ) || 0 + ); + + } else { + ++$error_count; + $target->warn( "Unknown option: $first\n" ); + } + + if($rest eq '') { # like -f + shift @$args + } else { # like -fbar (== -f -bar ) + DEBUG > 2 and print " Setting args->[0] to \"-$rest\"\n"; + $args->[0] = "-$rest"; + } + } + } + + + $target->aside( + "Ending switch processing. Args are [@$args] with $error_count errors.\n" + ) if $target->can('aside'); + + $error_count == 0; +} + +1; + +__END__ + +=head1 NAME + +Pod::Perldoc::GetOptsOO - Customized option parser for Pod::Perldoc + +=head1 SYNOPSIS + + use Pod::Perldoc::GetOptsOO (); + + Pod::Perldoc::GetOptsOO::getopts( $obj, \@args, $truth ) + or die "wrong usage"; + + +=head1 DESCRIPTION + +Implements a customized option parser used for +L. + +Rather like Getopt::Std's getopts: + +=over + +=item Call Pod::Perldoc::GetOptsOO::getopts($object, \@ARGV, $truth) + +=item Given -n, if there's a opt_n_with, it'll call $object->opt_n_with( ARGUMENT ) + (e.g., "-n foo" => $object->opt_n_with('foo'). Ditto "-nfoo") + +=item Otherwise (given -n) if there's an opt_n, we'll call it $object->opt_n($truth) + (Truth defaults to 1) + +=item Otherwise we try calling $object->handle_unknown_option('n') + (and we increment the error count by the return value of it) + +=item If there's no handle_unknown_option, then we just warn, and then increment + the error counter + +=back + +The return value of Pod::Perldoc::GetOptsOO::getopts is true if no errors, +otherwise it's false. + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002-2007 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToANSI.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToANSI.pm new file mode 100644 index 0000000000000000000000000000000000000000..8217c7b1bc484afb7b3b1f803a8a15dfcaf5e840 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToANSI.pm @@ -0,0 +1,96 @@ +package Pod::Perldoc::ToANSI; +use strict; +use warnings; +use parent qw(Pod::Perldoc::BaseTo); + +use vars qw($VERSION); +$VERSION = '3.28'; + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } + +use Pod::Text::Color (); + +sub alt { shift->_perldoc_elem('alt' , @_) } +sub indent { shift->_perldoc_elem('indent' , @_) } +sub loose { shift->_perldoc_elem('loose' , @_) } +sub quotes { shift->_perldoc_elem('quotes' , @_) } +sub sentence { shift->_perldoc_elem('sentence', @_) } +sub width { shift->_perldoc_elem('width' , @_) } + +sub new { return bless {}, ref($_[0]) || $_[0] } + +sub parse_from_file { + my $self = shift; + + my @options = + map {; $_, $self->{$_} } + grep !m/^_/s, + keys %$self + ; + + defined(&Pod::Perldoc::DEBUG) + and Pod::Perldoc::DEBUG() + and print "About to call new Pod::Text::Color ", + $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '', + "with options: ", + @options ? "[@options]" : "(nil)", "\n"; + ; + + Pod::Text::Color->new(@options)->parse_from_file(@_); +} + +1; + +=head1 NAME + +Pod::Perldoc::ToANSI - render Pod with ANSI color escapes + +=head1 SYNOPSIS + + perldoc -o ansi Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Text as a formatter class. + +It supports the following options, which are explained in +L: alt, indent, loose, quotes, sentence, width + +For example: + + perldoc -o term -w indent:5 Some::Modulename + +=head1 CAVEAT + +This module may change to use a different text formatter class in the +future, and this may change what options are supported. + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2011 Mark Allen. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToChecker.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToChecker.pm new file mode 100644 index 0000000000000000000000000000000000000000..a6dbbe3f03330f2780687f112407a06d43b784a7 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToChecker.pm @@ -0,0 +1,78 @@ +package Pod::Perldoc::ToChecker; +use strict; +use warnings; +use vars qw(@ISA); + +use vars qw($VERSION); +$VERSION = '3.28'; + +# Pick our superclass... +# +eval 'require Pod::Simple::Checker'; +if($@) { + require Pod::Checker; + @ISA = ('Pod::Checker'); +} else { + @ISA = ('Pod::Simple::Checker'); +} + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } + +sub if_zero_length { + my( $self, $file, $tmp, $tmpfd ) = @_; + print "No Pod errors in $file\n"; +} + + +1; + +__END__ + +=head1 NAME + +Pod::Perldoc::ToChecker - let Perldoc check Pod for errors + +=head1 SYNOPSIS + + % perldoc -o checker SomeFile.pod + No Pod errors in SomeFile.pod + (or an error report) + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Simple::Checker as a "formatter" class (or if that is +not available, then Pod::Checker), to check for errors in a given +Pod file. + +This is actually a Pod::Simple::Checker (or Pod::Checker) subclass, and +inherits all its options. + +=head1 SEE ALSO + +L, L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToMan.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToMan.pm new file mode 100644 index 0000000000000000000000000000000000000000..bfcb5c40ee65665e1830f74b844c42e3f3ad5b2a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToMan.pm @@ -0,0 +1,561 @@ +require 5.006; +package Pod::Perldoc::ToMan; +use strict; +use warnings; +use parent qw(Pod::Perldoc::BaseTo); + +use vars qw($VERSION); +$VERSION = '3.28'; + +use File::Spec::Functions qw(catfile); +use Pod::Man 2.18; +# This class is unlike ToText.pm et al, because we're NOT paging thru +# the output in our particular format -- we make the output and +# then we run nroff (or whatever) on it, and then page thru the +# (plaintext) output of THAT! + +sub SUCCESS () { 1 } +sub FAILED () { 0 } + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } + +sub __filter_nroff { shift->_perldoc_elem('__filter_nroff' , @_) } +sub __nroffer { shift->_perldoc_elem('__nroffer' , @_) } +sub __bindir { shift->_perldoc_elem('__bindir' , @_) } +sub __pod2man { shift->_perldoc_elem('__pod2man' , @_) } +sub __output_file { shift->_perldoc_elem('__output_file' , @_) } + +sub center { shift->_perldoc_elem('center' , @_) } +sub date { shift->_perldoc_elem('date' , @_) } +sub fixed { shift->_perldoc_elem('fixed' , @_) } +sub fixedbold { shift->_perldoc_elem('fixedbold' , @_) } +sub fixeditalic { shift->_perldoc_elem('fixeditalic' , @_) } +sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) } +sub name { shift->_perldoc_elem('name' , @_) } +sub quotes { shift->_perldoc_elem('quotes' , @_) } +sub release { shift->_perldoc_elem('release' , @_) } +sub section { shift->_perldoc_elem('section' , @_) } + +sub new { + my( $either ) = shift; + my $self = bless {}, ref($either) || $either; + $self->init( @_ ); + return $self; + } + +sub init { + my( $self, @args ) = @_; + + unless( $self->__nroffer ) { + my $roffer = $self->_find_roffer( $self->_roffer_candidates ); + $self->debug( "Using $roffer\n" ); + $self->__nroffer( $roffer ); + } + else { + $self->debug( "__nroffer is " . $self->__nroffer() . "\n" ); + } + + $self->_check_nroffer; + } + +sub _roffer_candidates { + my( $self ) = @_; + + if( $self->is_openbsd || $self->is_freebsd || $self->is_bitrig ) { qw( mandoc groff nroff ) } + else { qw( groff nroff mandoc ) } + } + +sub _find_roffer { + my( $self, @candidates ) = @_; + + my @found = (); + foreach my $candidate ( @candidates ) { + push @found, $self->_find_executable_in_path( $candidate ); + } + + return wantarray ? @found : $found[0]; + } + +sub _check_nroffer { + return 1; + # where is it in the PATH? + + # is it executable? + + # what is its real name? + + # what is its version? + + # does it support the flags we need? + + # is it good enough for us? + } + +sub _get_stty { `stty -a` } + +sub _get_columns_from_stty { + my $output = $_[0]->_get_stty; + + if( $output =~ /\bcolumns\s+(\d+)/ ) { return $1 } + elsif( $output =~ /;\s*(\d+)\s+columns;/ ) { return $1 } + else { return 0 } + } + +sub _get_columns_from_manwidth { + my( $self ) = @_; + + return 0 unless defined $ENV{MANWIDTH}; + + unless( $ENV{MANWIDTH} =~ m/\A\d+\z/ ) { + $self->warn( "Ignoring non-numeric MANWIDTH ($ENV{MANWIDTH})\n" ); + return 0; + } + + if( $ENV{MANWIDTH} == 0 ) { + $self->warn( "Ignoring MANWIDTH of 0. Really? Why even run the program? :)\n" ); + return 0; + } + + if( $ENV{MANWIDTH} =~ m/\A(\d+)\z/ ) { return $1 } + + return 0; + } + +sub _get_default_width { + 73 + } + +sub _get_columns { + $_[0]->_get_columns_from_manwidth || + $_[0]->_get_columns_from_stty || + $_[0]->_get_default_width; + } + +sub _get_podman_switches { + my( $self ) = @_; + + my @switches = map { $_, $self->{$_} } grep !m/^_/s, keys %$self; + + # There needs to be a cleaner way to handle setting + # the UTF-8 flag, but for now, comment out this + # line because it often does the wrong thing. + # + # See RT #77465 + # + #push @switches, 'utf8' => 1; + + $self->debug( "Pod::Man switches are [@switches]\n" ); + + return @switches; + } + +sub _parse_with_pod_man { + my( $self, $file ) = @_; + + #->output_fh and ->output_string from Pod::Simple aren't + # working, apparently, so there's this ugly hack: + local *STDOUT; + open STDOUT, '>', $self->{_text_ref}; + my $parser = Pod::Man->new( $self->_get_podman_switches ); + $self->debug( "Parsing $file\n" ); + $parser->parse_from_file( $file ); + $self->debug( "Done parsing $file\n" ); + close STDOUT; + + $self->die( "No output from Pod::Man!\n" ) + unless length $self->{_text_ref}; + + $self->_save_pod_man_output if $self->debugging; + + return SUCCESS; + } + +sub _save_pod_man_output { + my( $self, $fh ) = @_; + + $fh = do { + my $file = "podman.out.$$.txt"; + $self->debug( "Writing $file with Pod::Man output\n" ); + open my $fh2, '>', $file; + $fh2; + } unless $fh; + + print { $fh } ${ $self->{_text_ref} }; + } + +sub _have_groff_with_utf8 { + my( $self ) = @_; + + return 0 unless $self->_is_groff; + my $roffer = $self->__nroffer; + + my $minimum_groff_version = '1.20.1'; + + my $version_string = `$roffer -v`; + my( $version ) = $version_string =~ /\(?groff\)? version (\d+\.\d+(?:\.\d+)?)/; + $self->debug( "Found groff $version\n" ); + + # is a string comparison good enough? + if( $version lt $minimum_groff_version ) { + $self->warn( + "You have an old groff." . + " Update to version $minimum_groff_version for good Unicode support.\n" . + "If you don't upgrade, wide characters may come out oddly.\n" + ); + } + + $version ge $minimum_groff_version; + } + +sub _have_mandoc_with_utf8 { + my( $self ) = @_; + + $self->_is_mandoc and not system 'mandoc -Tlocale -V > /dev/null 2>&1'; + } + +sub _collect_nroff_switches { + my( $self ) = shift; + + my @render_switches = ('-man', $self->_get_device_switches); + + # Thanks to Brendan O'Dea for contributing the following block + if( $self->_is_roff and -t STDOUT and my ($cols) = $self->_get_columns ) { + my $c = $cols * 39 / 40; + $cols = $c > $cols - 2 ? $c : $cols -2; + push @render_switches, '-rLL=' . (int $c) . 'n' if $cols > 80; + } + + # I hear persistent reports that adding a -c switch to $render + # solves many people's problems. But I also hear that some mans + # don't have a -c switch, so that unconditionally adding it here + # would presumably be a Bad Thing -- sburke@cpan.org + push @render_switches, '-c' if( $self->_is_roff and $self->is_cygwin ); + + return @render_switches; + } + +sub _get_device_switches { + my( $self ) = @_; + + if( $self->_is_nroff ) { qw() } + elsif( $self->_have_groff_with_utf8 ) { qw(-Kutf8 -Tutf8) } + elsif( $self->_is_ebcdic ) { qw(-Tcp1047) } + elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tlocale) } + elsif( $self->_is_mandoc ) { qw() } + else { qw(-Tlatin1) } + } + +sub _is_roff { + my( $self ) = @_; + + $self->_is_nroff or $self->_is_groff; + } + +sub _is_nroff { + my( $self ) = @_; + + $self->__nroffer =~ /\bnroff\b/; + } + +sub _is_groff { + my( $self ) = @_; + + $self->__nroffer =~ /\bgroff\b/; + } + +sub _is_mandoc { + my ( $self ) = @_; + + $self->__nroffer =~ /\bmandoc\b/; + } + +sub _is_ebcdic { + my( $self ) = @_; + + return 0; + } + +sub _filter_through_nroff { + my( $self ) = shift; + $self->debug( "Filtering through " . $self->__nroffer() . "\n" ); + + # Maybe someone set rendering switches as part of the opt_n value + # Deal with that here. + + my ($render, $switches) = $self->__nroffer() =~ /\A([\/a-zA-Z0-9_\.-]+)\b(.+)?\z/; + + $self->die("no nroffer!?") unless $render; + my @render_switches = $self->_collect_nroff_switches; + + if ( $switches ) { + # Eliminate whitespace + $switches =~ s/\s//g; + + # Then separate the switches with a zero-width positive + # lookahead on the dash. + # + # See: + # http://www.effectiveperlprogramming.com/blog/1411 + # for a good discussion of this technique + + push @render_switches, split(/(?=-)/, $switches); + } + + $self->debug( "render is $render\n" ); + $self->debug( "render options are @render_switches\n" ); + + require Symbol; + require IPC::Open3; + require IO::Handle; + + my $pid = IPC::Open3::open3( + my $writer, + my $reader, + my $err = Symbol::gensym(), + $render, + @render_switches + ); + + $reader->autoflush(1); + + use IO::Select; + my $selector = IO::Select->new( $reader ); + + $self->debug( "Writing to pipe to $render\n" ); + + my $offset = 0; + my $chunk_size = 4096; + my $length = length( ${ $self->{_text_ref} } ); + my $chunks = $length / $chunk_size; + my $done; + my $buffer; + while( $offset <= $length ) { + $self->debug( "Writing chunk $chunks\n" ); $chunks++; + syswrite $writer, ${ $self->{_text_ref} }, $chunk_size, $offset + or $self->die( $! ); + $offset += $chunk_size; + $self->debug( "Checking read\n" ); + READ: { + last READ unless $selector->can_read( 0.01 ); + $self->debug( "Reading\n" ); + my $bytes = sysread $reader, $buffer, 4096; + $self->debug( "Read $bytes bytes\n" ); + $done .= $buffer; + $self->debug( sprintf "Output is %d bytes\n", + length $done + ); + next READ; + } + } + close $writer; + $self->debug( "Done writing\n" ); + + # read any leftovers + $done .= do { local $/; <$reader> }; + $self->debug( sprintf "Done reading. Output is %d bytes\n", + length $done + ); + + if( $? ) { + $self->warn( "Error from pipe to $render!\n" ); + $self->debug( 'Error: ' . do { local $/; <$err> } ); + } + + + close $reader; + if( my $err = $? ) { + $self->debug( + "Nonzero exit ($?) while running `$render @render_switches`.\n" . + "Falling back to Pod::Perldoc::ToPod\n" + ); + return $self->_fallback_to_pod( @_ ); + } + + $self->debug( "Output:\n----\n$done\n----\n" ); + + ${ $self->{_text_ref} } = $done; + + return length ${ $self->{_text_ref} } ? SUCCESS : FAILED; + } + +sub parse_from_file { + my( $self, $file, $outfh) = @_; + + # We have a pipeline of filters each affecting the reference + # in $self->{_text_ref} + $self->{_text_ref} = \my $output; + + $self->_parse_with_pod_man( $file ); + # so far, nroff is an external command so we ensure it worked + my $result = $self->_filter_through_nroff; + return $self->_fallback_to_pod( @_ ) unless $result == SUCCESS; + + $self->_post_nroff_processing; + + print { $outfh } $output or + $self->die( "Can't print to $$self{__output_file}: $!" ); + + return; + } + +sub _fallback_to_pod { + my( $self, @args ) = @_; + $self->warn( "Falling back to Pod because there was a problem!\n" ); + require Pod::Perldoc::ToPod; + return Pod::Perldoc::ToPod->new->parse_from_file(@_); + } + +# maybe there's a user setting we should check? +sub _get_tab_width { 4 } + +sub _expand_tabs { + my( $self ) = @_; + + my $tab_width = ' ' x $self->_get_tab_width; + + ${ $self->{_text_ref} } =~ s/\t/$tab_width/g; + } + +sub _post_nroff_processing { + my( $self ) = @_; + + if( $self->is_hpux ) { + $self->debug( "On HP-UX, I'm going to expand tabs for you\n" ); + # this used to be a pipe to `col -x` for HP-UX + $self->_expand_tabs; + } + + if( $self->{'__filter_nroff'} ) { + $self->debug( "filter_nroff is set, so filtering\n" ); + $self->_remove_nroff_header; + $self->_remove_nroff_footer; + } + else { + $self->debug( "filter_nroff is not set, so not filtering\n" ); + } + + $self->_handle_unicode; + + return 1; + } + +# I don't think this does anything since there aren't two consecutive +# newlines in the Pod::Man output +sub _remove_nroff_header { + my( $self ) = @_; + $self->debug( "_remove_nroff_header is still a stub!\n" ); + return 1; + +# my @data = split /\n{2,}/, shift; +# shift @data while @data and $data[0] !~ /\S/; # Go to header +# shift @data if @data and $data[0] =~ /Contributed\s+Perl/; # Skip header + } + +# I don't think this does anything since there aren't two consecutive +# newlines in the Pod::Man output +sub _remove_nroff_footer { + my( $self ) = @_; + $self->debug( "_remove_nroff_footer is still a stub!\n" ); + return 1; + ${ $self->{_text_ref} } =~ s/\n\n+.*\w.*\Z//m; + +# my @data = split /\n{2,}/, shift; +# pop @data if @data and $data[-1] =~ /^\w/; # Skip footer, like + # 28/Jan/99 perl 5.005, patch 53 1 + } + +sub _unicode_already_handled { + my( $self ) = @_; + + $self->_have_groff_with_utf8 || + 1 # so, we don't have a case that needs _handle_unicode + ; + } + +sub _handle_unicode { +# this is the job of preconv +# we don't need this with groff 1.20 and later. + my( $self ) = @_; + + return 1 if $self->_unicode_already_handled; + + require Encode; + + # it's UTF-8 here, but we need character data + my $text = Encode::decode( 'UTF-8', ${ $self->{_text_ref} } ) ; + +# http://www.mail-archive.com/groff@gnu.org/msg01378.html +# http://linux.die.net/man/7/groff_char +# http://www.gnu.org/software/groff/manual/html_node/Using-Symbols.html +# http://lists.gnu.org/archive/html/groff/2011-05/msg00007.html +# http://www.simplicidade.org/notes/archives/2009/05/fixing_the_pod.html +# http://lists.freebsd.org/pipermail/freebsd-questions/2011-July/232239.html + $text =~ s/(\P{ASCII})/ + sprintf '\\[u%04X]', ord $1 + /eg; + + # should we encode? + ${ $self->{_text_ref} } = $text; + } + +1; + +__END__ + +=head1 NAME + +Pod::Perldoc::ToMan - let Perldoc render Pod as man pages + +=head1 SYNOPSIS + + perldoc -o man Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Man and C for reading Pod pages. + +The following options are supported: center, date, fixed, fixedbold, +fixeditalic, fixedbolditalic, quotes, release, section + +(Those options are explained in L.) + +For example: + + perldoc -o man -w center:Pod Some::Modulename + +=head1 CAVEAT + +This module may change to use a different pod-to-nroff formatter class +in the future, and this may change what options are supported. + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2011 brian d foy. All rights reserved. + +Copyright (c) 2002,3,4 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToNroff.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToNroff.pm new file mode 100644 index 0000000000000000000000000000000000000000..a52f616019216224f8ae5c793bc3d7aeb0f6b86d --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToNroff.pm @@ -0,0 +1,105 @@ +package Pod::Perldoc::ToNroff; +use strict; +use warnings; +use parent qw(Pod::Perldoc::BaseTo); + +use vars qw($VERSION); +$VERSION = '3.28'; + +# This is unlike ToMan.pm in that it emits the raw nroff source! + +sub is_pageable { 1 } # well, if you ask for it... +sub write_with_binmode { 0 } +sub output_extension { 'man' } + +use Pod::Man (); + +sub center { shift->_perldoc_elem('center' , @_) } +sub date { shift->_perldoc_elem('date' , @_) } +sub fixed { shift->_perldoc_elem('fixed' , @_) } +sub fixedbold { shift->_perldoc_elem('fixedbold' , @_) } +sub fixeditalic { shift->_perldoc_elem('fixeditalic' , @_) } +sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) } +sub quotes { shift->_perldoc_elem('quotes' , @_) } +sub release { shift->_perldoc_elem('release' , @_) } +sub section { shift->_perldoc_elem('section' , @_) } + +sub new { return bless {}, ref($_[0]) || $_[0] } + +sub parse_from_file { + my $self = shift; + my $file = $_[0]; + + my @options = + map {; $_, $self->{$_} } + grep !m/^_/s, + keys %$self + ; + + defined(&Pod::Perldoc::DEBUG) + and Pod::Perldoc::DEBUG() + and print "About to call new Pod::Man ", + $Pod::Man::VERSION ? "(v$Pod::Man::VERSION) " : '', + "with options: ", + @options ? "[@options]" : "(nil)", "\n"; + ; + + Pod::Man->new(@options)->parse_from_file(@_); +} + +1; +__END__ + +=head1 NAME + +Pod::Perldoc::ToNroff - let Perldoc convert Pod to nroff + +=head1 SYNOPSIS + + perldoc -o nroff -d something.3 Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Man as a formatter class. + +The following options are supported: center, date, fixed, fixedbold, +fixeditalic, fixedbolditalic, quotes, release, section + +Those options are explained in L. + +For example: + + perldoc -o nroff -w center:Pod -d something.3 Some::Modulename + +=head1 CAVEAT + +This module may change to use a different pod-to-nroff formatter class +in the future, and this may change what options are supported. + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToPod.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToPod.pm new file mode 100644 index 0000000000000000000000000000000000000000..825a1caaf5bbeed3a18883016b1925ef71acd718 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToPod.pm @@ -0,0 +1,88 @@ +package Pod::Perldoc::ToPod; +use strict; +use warnings; +use parent qw(Pod::Perldoc::BaseTo); + +use vars qw($VERSION); +$VERSION = '3.28'; + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'pod' } + +sub new { return bless {}, ref($_[0]) || $_[0] } + +sub parse_from_file { + my( $self, $in, $outfh ) = @_; + + open(IN, "<", $in) or $self->die( "Can't read-open $in: $!\nAborting" ); + + my $cut_mode = 1; + + # A hack for finding things between =foo and =cut, inclusive + local $_; + while () { + if( m/^=(\w+)/s ) { + if($cut_mode = ($1 eq 'cut')) { + print $outfh "\n=cut\n\n"; + # Pass thru the =cut line with some harmless + # (and occasionally helpful) padding + } + } + next if $cut_mode; + print $outfh $_ or $self->die( "Can't print to $outfh: $!" ); + } + + close IN or $self->die( "Can't close $in: $!" ); + return; +} + +1; +__END__ + +=head1 NAME + +Pod::Perldoc::ToPod - let Perldoc render Pod as ... Pod! + +=head1 SYNOPSIS + + perldoc -opod Some::Modulename + +(That's currently the same as the following:) + + perldoc -u Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to display Pod source as +itself! Pretty Zen, huh? + +Currently this class works by just filtering out the non-Pod stuff from +a given input file. + +=head1 SEE ALSO + +L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToRtf.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToRtf.pm new file mode 100644 index 0000000000000000000000000000000000000000..d084816cab25c9e0dc57cc76ee3e850849fbb465 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToRtf.pm @@ -0,0 +1,83 @@ +package Pod::Perldoc::ToRtf; +use strict; +use warnings; +use parent qw( Pod::Simple::RTF ); + +use vars qw($VERSION); +$VERSION = '3.28'; + +sub is_pageable { 0 } +sub write_with_binmode { 0 } +sub output_extension { 'rtf' } + +sub page_for_perldoc { + my($self, $tempfile, $perldoc) = @_; + return unless $perldoc->IS_MSWin32; + + my $rtf_pager = $ENV{'RTFREADER'} || 'write.exe'; + + $perldoc->aside( "About to launch <\"$rtf_pager\" \"$tempfile\">\n" ); + + return 1 if system( qq{"$rtf_pager"}, qq{"$tempfile"} ) == 0; + return 0; +} + +1; +__END__ + +=head1 NAME + +Pod::Perldoc::ToRtf - let Perldoc render Pod as RTF + +=head1 SYNOPSIS + + perldoc -o rtf Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Simple::RTF as a formatter class. + +This is actually a Pod::Simple::RTF subclass, and inherits +all its options. + +You have to have Pod::Simple::RTF installed (from the Pod::Simple dist), +or this module won't work. + +If Perldoc is running under MSWin and uses this class as a formatter, +the output will be opened with F or whatever program is +specified in the environment variable C. For example, to +specify that RTF files should be opened the same as they are when you +double-click them, you would do C in your +F. + +Handy tip: put C in your F +and that will set this class as the default formatter to run when +you do C. + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTerm.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTerm.pm new file mode 100644 index 0000000000000000000000000000000000000000..9501d6310e7de94a65e5d963f3ea4724e4b1dcdc --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTerm.pm @@ -0,0 +1,169 @@ +package Pod::Perldoc::ToTerm; +use strict; +use warnings; + +use vars qw($VERSION); +$VERSION = '3.28'; + +use parent qw(Pod::Perldoc::BaseTo); + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } + +use Pod::Text::Termcap (); + +sub alt { shift->_perldoc_elem('alt' , @_) } +sub indent { shift->_perldoc_elem('indent' , @_) } +sub loose { shift->_perldoc_elem('loose' , @_) } +sub quotes { shift->_perldoc_elem('quotes' , @_) } +sub sentence { shift->_perldoc_elem('sentence', @_) } +sub width { + my $self = shift; + $self->_perldoc_elem('width' , @_) || + $self->_get_columns_from_manwidth || + $self->_get_columns_from_stty || + $self->_get_default_width; +} + +sub pager_configuration { + my($self, $pager, $perldoc) = @_; + + # do not modify anything on Windows or DOS + return if ( $perldoc->is_mswin32 || $perldoc->is_dos ); + + if ( $pager =~ /less/ ) { + $self->_maybe_modify_environment('LESS'); + } + elsif ( $pager =~ /more/ ) { + $self->_maybe_modify_environment('MORE'); + } + + return; +} + +sub _maybe_modify_environment { + my($self, $name) = @_; + + if ( ! defined $ENV{$name} ) { + $ENV{$name} = "-R"; + } + + # if the environment is set, don't modify + # anything + +} + +sub _get_stty { `stty -a` } + +sub _get_columns_from_stty { + my $output = $_[0]->_get_stty; + + if( $output =~ /\bcolumns\s+(\d+)/ ) { return $1; } + elsif( $output =~ /;\s*(\d+)\s+columns;/ ) { return $1; } + else { return 0 } + } + +sub _get_columns_from_manwidth { + my( $self ) = @_; + + return 0 unless defined $ENV{MANWIDTH}; + + unless( $ENV{MANWIDTH} =~ m/\A\d+\z/ ) { + $self->warn( "Ignoring non-numeric MANWIDTH ($ENV{MANWIDTH})\n" ); + return 0; + } + + if( $ENV{MANWIDTH} == 0 ) { + $self->warn( "Ignoring MANWIDTH of 0. Really? Why even run the program? :)\n" ); + return 0; + } + + if( $ENV{MANWIDTH} =~ m/\A(\d+)\z/ ) { return $1 } + + return 0; + } + +sub _get_default_width { + 76 + } + + +sub new { return bless {}, ref($_[0]) || $_[0] } + +sub parse_from_file { + my $self = shift; + + $self->{width} = $self->width(); + + my @options = + map {; $_, $self->{$_} } + grep !m/^_/s, + keys %$self + ; + + defined(&Pod::Perldoc::DEBUG) + and Pod::Perldoc::DEBUG() + and print "About to call new Pod::Text::Termcap ", + $Pod::Text::VERSION ? "(v$Pod::Text::Termcap::VERSION) " : '', + "with options: ", + @options ? "[@options]" : "(nil)", "\n"; + ; + + Pod::Text::Termcap->new(@options)->parse_from_file(@_); +} + +1; + +=head1 NAME + +Pod::Perldoc::ToTerm - render Pod with terminal escapes + +=head1 SYNOPSIS + + perldoc -o term Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Text as a formatter class. + +It supports the following options, which are explained in +L: alt, indent, loose, quotes, sentence, width + +For example: + + perldoc -o term -w indent:5 Some::Modulename + +=head1 PAGER FORMATTING + +Depending on the platform, and because this class emits terminal escapes it +will attempt to set the C<-R> flag on your pager by injecting the flag into +your environment variable for C or C. + +On Windows and DOS, this class will not modify any environment variables. + +=head1 CAVEAT + +This module may change to use a different text formatter class in the +future, and this may change what options are supported. + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2017 Mark Allen. + +This program is free software; you can redistribute it and/or modify it +under the terms of either: the GNU General Public License as published +by the Free Software Foundation; or the Artistic License. + +See http://dev.perl.org/licenses/ for more information. + +=head1 AUTHOR + +Mark Allen C<< >> + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToText.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToText.pm new file mode 100644 index 0000000000000000000000000000000000000000..99ab66c3048e059ac280bd906e3a2a59d49a1673 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToText.pm @@ -0,0 +1,98 @@ +package Pod::Perldoc::ToText; +use strict; +use warnings; + +use vars qw($VERSION); +$VERSION = '3.28'; + +use parent qw(Pod::Perldoc::BaseTo); + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } + +use Pod::Text (); + +sub alt { shift->_perldoc_elem('alt' , @_) } +sub indent { shift->_perldoc_elem('indent' , @_) } +sub loose { shift->_perldoc_elem('loose' , @_) } +sub quotes { shift->_perldoc_elem('quotes' , @_) } +sub sentence { shift->_perldoc_elem('sentence', @_) } +sub width { shift->_perldoc_elem('width' , @_) } + +sub new { return bless {}, ref($_[0]) || $_[0] } + +sub parse_from_file { + my $self = shift; + + my @options = + map {; $_, $self->{$_} } + grep !m/^_/s, + keys %$self + ; + + defined(&Pod::Perldoc::DEBUG) + and Pod::Perldoc::DEBUG() + and print "About to call new Pod::Text ", + $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '', + "with options: ", + @options ? "[@options]" : "(nil)", "\n"; + ; + + Pod::Text->new(@options)->parse_from_file(@_); +} + +1; + +=head1 NAME + +Pod::Perldoc::ToText - let Perldoc render Pod as plaintext + +=head1 SYNOPSIS + + perldoc -o text Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Text as a formatter class. + +It supports the following options, which are explained in +L: alt, indent, loose, quotes, sentence, width + +For example: + + perldoc -o text -w indent:5 Some::Modulename + +=head1 CAVEAT + +This module may change to use a different text formatter class in the +future, and this may change what options are supported. + +=head1 SEE ALSO + +L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTk.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTk.pm new file mode 100644 index 0000000000000000000000000000000000000000..6ca7542c7afc9e2117f479031de0e3e0f0cd2efc --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToTk.pm @@ -0,0 +1,154 @@ +package Pod::Perldoc::ToTk; +use strict; +use warnings; + +use vars qw($VERSION); +$VERSION = '3.28'; + +use parent qw(Pod::Perldoc::BaseTo); + +sub is_pageable { 1 } +sub write_with_binmode { 0 } +sub output_extension { 'txt' } # doesn't matter +sub if_zero_length { } # because it will be 0-length! +sub new { return bless {}, ref($_[0]) || $_[0] } + +# TODO: document these and their meanings... +sub tree { shift->_perldoc_elem('tree' , @_) } +sub tk_opt { shift->_perldoc_elem('tk_opt' , @_) } +sub forky { shift->_perldoc_elem('forky' , @_) } + +use Pod::Perldoc (); +use File::Spec::Functions qw(catfile); + +BEGIN{ # Tk is not core, but this is + eval { require Tk } || + __PACKAGE__->die( <<"HERE" ); +You must have the Tk module to use Pod::Perldoc::ToTk. +If you have it installed, ensure it's in your Perl library +path. +HERE + + __PACKAGE__->die( + __PACKAGE__, + " doesn't work nice with Tk.pm version $Tk::VERSION" + ) if $Tk::VERSION eq '800.003'; + } + + +BEGIN { eval { require Tk::FcyEntry; }; }; +BEGIN{ # Tk::Pod is not core, but this is + eval { require Tk::Pod } || + __PACKAGE__->die( <<"HERE" ); +You must have the Tk::Pod module to use Pod::Perldoc::ToTk. +If you have it installed, ensure it's in your Perl library +path. +HERE + } + +# The following was adapted from "tkpod" in the Tk-Pod dist. + +sub parse_from_file { + + my($self, $Input_File) = @_; + if($self->{'forky'}) { + return if fork; # i.e., parent process returns + } + + $Input_File =~ s{\\}{/}g + if $self->is_mswin32 or $self->is_dos + # and maybe OS/2 + ; + + my($tk_opt, $tree); + $tree = $self->{'tree' }; + $tk_opt = $self->{'tk_opt'}; + + #require Tk::ErrorDialog; + + # Add 'Tk' subdirectories to search path so, e.g., + # 'Scrolled' will find doc in 'Tk/Scrolled' + + if( $tk_opt ) { + push @INC, grep -d $_, map catfile($_,'Tk'), @INC; + } + + my $mw = MainWindow->new(); + #eval 'use blib "/home/e/eserte/src/perl/Tk-App";require Tk::App::Debug'; + $mw->withdraw; + + # CDE use Font Settings if available + my $ufont = $mw->optionGet('userFont','UserFont'); # fixed width + my $sfont = $mw->optionGet('systemFont','SystemFont'); # proportional + if (defined($ufont) and defined($sfont)) { + foreach ($ufont, $sfont) { s/:$//; }; + $mw->optionAdd('*Font', $sfont); + $mw->optionAdd('*Entry.Font', $ufont); + $mw->optionAdd('*Text.Font', $ufont); + } + + $mw->optionAdd('*Menu.tearOff', $Tk::platform ne 'MSWin32' ? 1 : 0); + + $mw->Pod( + '-file' => $Input_File, + (($Tk::Pod::VERSION >= 4) ? ('-tree' => $tree) : ()) + )->focusNext; + + # xxx dirty but it works. A simple $mw->destroy if $mw->children + # does not work because Tk::ErrorDialogs could be created. + # (they are withdrawn after Ok instead of destory'ed I guess) + + if ($mw->children) { + $mw->repeat(1000, sub { + # ErrorDialog is withdrawn not deleted :-( + foreach ($mw->children) { + return if "$_" =~ /^Tk::Pod/ # ->isa('Tk::Pod') + } + $mw->destroy; + }); + } else { + $mw->destroy; + } + #$mw->WidgetDump; + MainLoop(); + + exit if $self->{'forky'}; # we were the child! so exit now! + return; +} + +1; +__END__ + + +=head1 NAME + +Pod::Perldoc::ToTk - let Perldoc use Tk::Pod to render Pod + +=head1 SYNOPSIS + + perldoc -o tk Some::Modulename & + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Tk::Pod as a formatter class. + +You have to have installed Tk::Pod first, or this class won't load. + +=head1 SEE ALSO + +L, L + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>; +Sean M. Burke C<< >>; +significant portions copied from +F in the Tk::Pod dist, by Nick Ing-Simmons, Slaven Rezic, et al. + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToXml.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToXml.pm new file mode 100644 index 0000000000000000000000000000000000000000..0161c048a9c6f7d20bef8e50e45a250cf9f15b89 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Perldoc/ToXml.pm @@ -0,0 +1,63 @@ +package Pod::Perldoc::ToXml; +use strict; +use warnings; +use vars qw($VERSION); + +use parent qw( Pod::Simple::XMLOutStream ); + +use vars qw($VERSION); +$VERSION = '3.28'; + +sub is_pageable { 0 } +sub write_with_binmode { 0 } +sub output_extension { 'xml' } + +1; +__END__ + +=head1 NAME + +Pod::Perldoc::ToXml - let Perldoc render Pod as XML + +=head1 SYNOPSIS + + perldoc -o xml -d out.xml Some::Modulename + +=head1 DESCRIPTION + +This is a "plug-in" class that allows Perldoc to use +Pod::Simple::XMLOutStream as a formatter class. + +This is actually a Pod::Simple::XMLOutStream subclass, and inherits +all its options. + +You have to have installed Pod::Simple::XMLOutStream (from the Pod::Simple +dist), or this class won't work. + + +=head1 SEE ALSO + +L, L, L + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. All rights reserved. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Current maintainer: Mark Allen C<< >> + +Past contributions from: +brian d foy C<< >> +Adriano R. Ferreira C<< >>, +Sean M. Burke C<< >> + +=cut + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pm new file mode 100644 index 0000000000000000000000000000000000000000..6c91b8ac1fb24a00c5e0b6fd6b483a26ba72fcc9 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pm @@ -0,0 +1,1643 @@ + +require 5; +package Pod::Simple; +use strict; +use Carp (); +BEGIN { *DEBUG = sub () {0} unless defined &DEBUG } +use integer; +use Pod::Escapes 1.04 (); +use Pod::Simple::LinkSection (); +use Pod::Simple::BlackBox (); +#use utf8; + +use vars qw( + $VERSION @ISA + @Known_formatting_codes @Known_directives + %Known_formatting_codes %Known_directives + $NL +); + +@ISA = ('Pod::Simple::BlackBox'); +$VERSION = '3.40'; + +@Known_formatting_codes = qw(I B C L E F S X Z); +%Known_formatting_codes = map(($_=>1), @Known_formatting_codes); +@Known_directives = qw(head1 head2 head3 head4 item over back); +%Known_directives = map(($_=>'Plain'), @Known_directives); +$NL = $/ unless defined $NL; + +#----------------------------------------------------------------------------- +# Set up some constants: + +BEGIN { + if(defined &ASCII) { } + elsif(chr(65) eq 'A') { *ASCII = sub () {1} } + else { *ASCII = sub () {''} } + + unless(defined &MANY_LINES) { *MANY_LINES = sub () {20} } + DEBUG > 4 and print STDERR "MANY_LINES is ", MANY_LINES(), "\n"; + unless(MANY_LINES() >= 1) { + die "MANY_LINES is too small (", MANY_LINES(), ")!\nAborting"; + } + if(defined &UNICODE) { } + elsif($] >= 5.008) { *UNICODE = sub() {1} } + else { *UNICODE = sub() {''} } +} +if(DEBUG > 2) { + print STDERR "# We are ", ASCII ? '' : 'not ', "in ASCII-land\n"; + print STDERR "# We are under a Unicode-safe Perl.\n"; +} + +# The NO BREAK SPACE and SOFT HYHPEN are used in several submodules. +if ($] ge 5.007_003) { # On sufficiently modern Perls we can handle any + # character set + $Pod::Simple::nbsp = chr utf8::unicode_to_native(0xA0); + $Pod::Simple::shy = chr utf8::unicode_to_native(0xAD); +} +elsif (Pod::Simple::ASCII) { # Hard code ASCII early Perl + $Pod::Simple::nbsp = "\xA0"; + $Pod::Simple::shy = "\xAD"; +} +else { # EBCDIC on early Perl. We know what the values are for the code + # pages supported then. + $Pod::Simple::nbsp = "\x41"; + $Pod::Simple::shy = "\xCA"; +} + +# Design note: +# This is a parser for Pod. It is not a parser for the set of Pod-like +# languages which happens to contain Pod -- it is just for Pod, plus possibly +# some extensions. + +# @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ +#@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +__PACKAGE__->_accessorize( + '_output_is_for_JustPod', # For use only by Pod::Simple::JustPod, + # If non-zero, don't expand Z<> E<> S<> L<>, + # and count how many brackets in format codes + 'nbsp_for_S', # Whether to map S<...>'s to \xA0 characters + 'source_filename', # Filename of the source, for use in warnings + 'source_dead', # Whether to consider this parser's source dead + + 'output_fh', # The filehandle we're writing to, if applicable. + # Used only in some derived classes. + + 'hide_line_numbers', # For some dumping subclasses: whether to pointedly + # suppress the start_line attribute + + 'line_count', # the current line number + 'pod_para_count', # count of pod paragraphs seen so far + + 'no_whining', # whether to suppress whining + 'no_errata_section', # whether to suppress the errata section + 'complain_stderr', # whether to complain to stderr + + 'doc_has_started', # whether we've fired the open-Document event yet + + 'bare_output', # For some subclasses: whether to prepend + # header-code and postpend footer-code + + 'keep_encoding_directive', # whether to emit =encoding + 'nix_X_codes', # whether to ignore X<...> codes + 'merge_text', # whether to avoid breaking a single piece of + # text up into several events + + 'preserve_whitespace', # whether to try to keep whitespace as-is + 'strip_verbatim_indent', # What indent to strip from verbatim + 'expand_verbatim_tabs', # 0: preserve tabs in verbatim blocks + # n: expand tabs to stops every n columns + + 'parse_characters', # Whether parser should expect chars rather than octets + + 'content_seen', # whether we've seen any real Pod content + 'errors_seen', # TODO: document. whether we've seen any errors (fatal or not) + + 'codes_in_verbatim', # for PseudoPod extensions + + 'code_handler', # coderef to call when a code (non-pod) line is seen + 'cut_handler', # ... when a =cut line is seen + 'pod_handler', # ... when a =pod line is seen + 'whiteline_handler', # ... when a line with only whitespace is seen + #Called like: + # $code_handler->($line, $self->{'line_count'}, $self) if $code_handler; + # $cut_handler->($line, $self->{'line_count'}, $self) if $cut_handler; + # $pod_handler->($line, $self->{'line_count'}, $self) if $pod_handler; + # $wl_handler->($line, $self->{'line_count'}, $self) if $wl_handler; + 'parse_empty_lists', # whether to acknowledge empty =over/=back blocks + 'raw_mode', # to report entire raw lines instead of Pod elements +); + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub any_errata_seen { # good for using as an exit() value... + return shift->{'errors_seen'} || 0; +} + +sub errata_seen { + return shift->{'all_errata'} || {}; +} + +# Returns the encoding only if it was recognized as being handled and set +sub detected_encoding { + return shift->{'detected_encoding'}; +} + +sub encoding { + my $this = shift; + return $this->{'encoding'} unless @_; # GET. + + $this->_handle_encoding_line("=encoding $_[0]"); + if ($this->{'_processed_encoding'}) { + delete $this->{'_processed_encoding'}; + if(! $this->{'encoding_command_statuses'} ) { + DEBUG > 2 and print STDERR " CRAZY ERROR: encoding wasn't really handled?!\n"; + } elsif( $this->{'encoding_command_statuses'}[-1] ) { + $this->scream( "=encoding $_[0]", + sprintf "Couldn't do %s: %s", + $this->{'encoding_command_reqs' }[-1], + $this->{'encoding_command_statuses'}[-1], + ); + } else { + DEBUG > 2 and print STDERR " (encoding successfully handled.)\n"; + } + return $this->{'encoding'}; + } else { + return undef; + } +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +# Pull in some functions that, for some reason, I expect to see here too: +BEGIN { + *pretty = \&Pod::Simple::BlackBox::pretty; + *stringify_lol = \&Pod::Simple::BlackBox::stringify_lol; + *my_qr = \&Pod::Simple::BlackBox::my_qr; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub version_report { + my $class = ref($_[0]) || $_[0]; + if($class eq __PACKAGE__) { + return "$class $VERSION"; + } else { + my $v = $class->VERSION; + return "$class $v (" . __PACKAGE__ . " $VERSION)"; + } +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#sub curr_open { # read-only list accessor +# return @{ $_[0]{'curr_open'} || return() }; +#} +#sub _curr_open_listref { $_[0]{'curr_open'} ||= [] } + + +sub output_string { + # Works by faking out output_fh. Simplifies our code. + # + my $this = shift; + return $this->{'output_string'} unless @_; # GET. + + require Pod::Simple::TiedOutFH; + my $x = (defined($_[0]) and ref($_[0])) ? $_[0] : \( $_[0] ); + $$x = '' unless defined $$x; + DEBUG > 4 and print STDERR "# Output string set to $x ($$x)\n"; + $this->{'output_fh'} = Pod::Simple::TiedOutFH->handle_on($_[0]); + return + $this->{'output_string'} = $_[0]; + #${ ${ $this->{'output_fh'} } }; +} + +sub abandon_output_string { $_[0]->abandon_output_fh; delete $_[0]{'output_string'} } +sub abandon_output_fh { $_[0]->output_fh(undef) } +# These don't delete the string or close the FH -- they just delete our +# references to it/them. +# TODO: document these + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub new { + # takes no parameters + my $class = ref($_[0]) || $_[0]; + #Carp::croak(__PACKAGE__ . " is a virtual base class -- see perldoc " + # . __PACKAGE__ ); + my $obj = bless { + 'accept_codes' => { map( ($_=>$_), @Known_formatting_codes ) }, + 'accept_directives' => { %Known_directives }, + 'accept_targets' => {}, + }, $class; + + $obj->expand_verbatim_tabs(8); + return $obj; +} + + + +# TODO: an option for whether to interpolate E<...>'s, or just resolve to codes. + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _handle_element_start { # OVERRIDE IN DERIVED CLASS + my($self, $element_name, $attr_hash_r) = @_; + return; +} + +sub _handle_element_end { # OVERRIDE IN DERIVED CLASS + my($self, $element_name) = @_; + return; +} + +sub _handle_text { # OVERRIDE IN DERIVED CLASS + my($self, $text) = @_; + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +# +# And now directives (not targets) + +sub accept_directive_as_verbatim { shift->_accept_directives('Verbatim', @_) } +sub accept_directive_as_data { shift->_accept_directives('Data', @_) } +sub accept_directive_as_processed { shift->_accept_directives('Plain', @_) } + +sub _accept_directives { + my($this, $type) = splice @_,0,2; + foreach my $d (@_) { + next unless defined $d and length $d; + Carp::croak "\"$d\" isn't a valid directive name" + unless $d =~ m/^[a-zA-Z][a-zA-Z0-9]*$/s; + Carp::croak "\"$d\" is already a reserved Pod directive name" + if exists $Known_directives{$d}; + $this->{'accept_directives'}{$d} = $type; + DEBUG > 2 and print STDERR "Learning to accept \"=$d\" as directive of type $type\n"; + } + DEBUG > 6 and print STDERR "$this\'s accept_directives : ", + pretty($this->{'accept_directives'}), "\n"; + + return sort keys %{ $this->{'accept_directives'} } if wantarray; + return; +} + +#-------------------------------------------------------------------------- +# TODO: document these: + +sub unaccept_directive { shift->unaccept_directives(@_) }; + +sub unaccept_directives { + my $this = shift; + foreach my $d (@_) { + next unless defined $d and length $d; + Carp::croak "\"$d\" isn't a valid directive name" + unless $d =~ m/^[a-zA-Z][a-zA-Z0-9]*$/s; + Carp::croak "But you must accept \"$d\" directives -- it's a builtin!" + if exists $Known_directives{$d}; + delete $this->{'accept_directives'}{$d}; + DEBUG > 2 and print STDERR "OK, won't accept \"=$d\" as directive.\n"; + } + return sort keys %{ $this->{'accept_directives'} } if wantarray; + return +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +# +# And now targets (not directives) + +sub accept_target { shift->accept_targets(@_) } # alias +sub accept_target_as_text { shift->accept_targets_as_text(@_) } # alias + + +sub accept_targets { shift->_accept_targets('1', @_) } + +sub accept_targets_as_text { shift->_accept_targets('force_resolve', @_) } + # forces them to be processed, even when there's no ":". + +sub _accept_targets { + my($this, $type) = splice @_,0,2; + foreach my $t (@_) { + next unless defined $t and length $t; + # TODO: enforce some limitations on what a target name can be? + $this->{'accept_targets'}{$t} = $type; + DEBUG > 2 and print STDERR "Learning to accept \"$t\" as target of type $type\n"; + } + return sort keys %{ $this->{'accept_targets'} } if wantarray; + return; +} + +#-------------------------------------------------------------------------- +sub unaccept_target { shift->unaccept_targets(@_) } + +sub unaccept_targets { + my $this = shift; + foreach my $t (@_) { + next unless defined $t and length $t; + # TODO: enforce some limitations on what a target name can be? + delete $this->{'accept_targets'}{$t}; + DEBUG > 2 and print STDERR "OK, won't accept \"$t\" as target.\n"; + } + return sort keys %{ $this->{'accept_targets'} } if wantarray; + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +# +# And now codes (not targets or directives) + +# XXX Probably it is an error that the digit '9' is excluded from these re's. +# Broken for early Perls on EBCDIC +my $xml_name_re = my_qr('[^-.0-8:A-Z_a-z[:^ascii:]]', '9'); +$xml_name_re = qr/[\x00-\x2C\x2F\x39\x3B-\x40\x5B-\x5E\x60\x7B-\x7F]/ + unless $xml_name_re; + +sub accept_code { shift->accept_codes(@_) } # alias + +sub accept_codes { # Add some codes + my $this = shift; + + foreach my $new_code (@_) { + next unless defined $new_code and length $new_code; + # A good-enough check that it's good as an XML Name symbol: + Carp::croak "\"$new_code\" isn't a valid element name" + if $new_code =~ $xml_name_re + # Characters under 0x80 that aren't legal in an XML Name. + or $new_code =~ m/^[-\.0-9]/s + or $new_code =~ m/:[-\.0-9]/s; + # The legal under-0x80 Name characters that + # an XML Name still can't start with. + + $this->{'accept_codes'}{$new_code} = $new_code; + + # Yes, map to itself -- just so that when we + # see "=extend W [whatever] thatelementname", we say that W maps + # to whatever $this->{accept_codes}{thatelementname} is, + # i.e., "thatelementname". Then when we go re-mapping, + # a "W" in the treelet turns into "thatelementname". We only + # remap once. + # If we say we accept "W", then a "W" in the treelet simply turns + # into "W". + } + + return; +} + +#-------------------------------------------------------------------------- +sub unaccept_code { shift->unaccept_codes(@_) } + +sub unaccept_codes { # remove some codes + my $this = shift; + + foreach my $new_code (@_) { + next unless defined $new_code and length $new_code; + # A good-enough check that it's good as an XML Name symbol: + Carp::croak "\"$new_code\" isn't a valid element name" + if $new_code =~ $xml_name_re + # Characters under 0x80 that aren't legal in an XML Name. + or $new_code =~ m/^[-\.0-9]/s + or $new_code =~ m/:[-\.0-9]/s; + # The legal under-0x80 Name characters that + # an XML Name still can't start with. + + Carp::croak "But you must accept \"$new_code\" codes -- it's a builtin!" + if grep $new_code eq $_, @Known_formatting_codes; + + delete $this->{'accept_codes'}{$new_code}; + + DEBUG > 2 and print STDERR "OK, won't accept the code $new_code<...>.\n"; + } + + return; +} + + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub parse_string_document { + my $self = shift; + my @lines; + foreach my $line_group (@_) { + next unless defined $line_group and length $line_group; + pos($line_group) = 0; + while($line_group =~ + m/([^\n\r]*)(\r?\n?)/g # supports \r, \n ,\r\n + #m/([^\n\r]*)((?:\r?\n)?)/g + ) { + #print(">> $1\n"), + $self->parse_lines($1) + if length($1) or length($2) + or pos($line_group) != length($line_group); + # I.e., unless it's a zero-length "empty line" at the very + # end of "foo\nbar\n" (i.e., between the \n and the EOS). + } + } + $self->parse_lines(undef); # to signal EOF + return $self; +} + +sub _init_fh_source { + my($self, $source) = @_; + + #DEBUG > 1 and print STDERR "Declaring $source as :raw for starters\n"; + #$self->_apply_binmode($source, ':raw'); + #binmode($source, ":raw"); + + return; +} + +#:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. +# + +sub parse_file { + my($self, $source) = (@_); + + if(!defined $source) { + Carp::croak("Can't use empty-string as a source for parse_file"); + } elsif(ref(\$source) eq 'GLOB') { + $self->{'source_filename'} = '' . ($source); + } elsif(ref $source) { + $self->{'source_filename'} = '' . ($source); + } elsif(!length $source) { + Carp::croak("Can't use empty-string as a source for parse_file"); + } else { + { + local *PODSOURCE; + open(PODSOURCE, "<$source") || Carp::croak("Can't open $source: $!"); + $self->{'source_filename'} = $source; + $source = *PODSOURCE{IO}; + } + $self->_init_fh_source($source); + } + # By here, $source is a FH. + + $self->{'source_fh'} = $source; + + my($i, @lines); + until( $self->{'source_dead'} ) { + splice @lines; + + for($i = MANY_LINES; $i--;) { # read those many lines at a time + local $/ = $NL; + push @lines, scalar(<$source>); # readline + last unless defined $lines[-1]; + # but pass thru the undef, which will set source_dead to true + } + + my $at_eof = ! $lines[-1]; # keep track of the undef + pop @lines if $at_eof; # silence warnings + + # be eol agnostic + s/\r\n?/\n/g for @lines; + + # make sure there are only one line elements for parse_lines + @lines = split(/(?<=\n)/, join('', @lines)); + + # push the undef back after popping it to set source_dead to true + push @lines, undef if $at_eof; + + $self->parse_lines(@lines); + } + delete($self->{'source_fh'}); # so it can be GC'd + return $self; +} + +#:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. + +sub parse_from_file { + # An emulation of Pod::Parser's interface, for the sake of Perldoc. + # Basically just a wrapper around parse_file. + + my($self, $source, $to) = @_; + $self = $self->new unless ref($self); # so we tolerate being a class method + + if(!defined $source) { $source = *STDIN{IO} + } elsif(ref(\$source) eq 'GLOB') { # stet + } elsif(ref($source) ) { # stet + } elsif(!length $source + or $source eq '-' or $source =~ m/^<&(?:STDIN|0)$/i + ) { + $source = *STDIN{IO}; + } + + if(!defined $to) { $self->output_fh( *STDOUT{IO} ); + } elsif(ref(\$to) eq 'GLOB') { $self->output_fh( $to ); + } elsif(ref($to)) { $self->output_fh( $to ); + } elsif(!length $to + or $to eq '-' or $to =~ m/^>&?(?:STDOUT|1)$/i + ) { + $self->output_fh( *STDOUT{IO} ); + } elsif($to =~ m/^>&(?:STDERR|2)$/i) { + $self->output_fh( *STDERR{IO} ); + } else { + require Symbol; + my $out_fh = Symbol::gensym(); + DEBUG and print STDERR "Write-opening to $to\n"; + open($out_fh, ">$to") or Carp::croak "Can't write-open $to: $!"; + binmode($out_fh) + if $self->can('write_with_binmode') and $self->write_with_binmode; + $self->output_fh($out_fh); + } + + return $self->parse_file($source); +} + +#----------------------------------------------------------------------------- + +sub whine { + #my($self,$line,$complaint) = @_; + my $self = shift(@_); + ++$self->{'errors_seen'}; + if($self->{'no_whining'}) { + DEBUG > 9 and print STDERR "Discarding complaint (at line $_[0]) $_[1]\n because no_whining is on.\n"; + return; + } + push @{$self->{'all_errata'}{$_[0]}}, $_[1]; + return $self->_complain_warn(@_) if $self->{'complain_stderr'}; + return $self->_complain_errata(@_); +} + +sub scream { # like whine, but not suppressible + #my($self,$line,$complaint) = @_; + my $self = shift(@_); + ++$self->{'errors_seen'}; + push @{$self->{'all_errata'}{$_[0]}}, $_[1]; + return $self->_complain_warn(@_) if $self->{'complain_stderr'}; + return $self->_complain_errata(@_); +} + +sub _complain_warn { + my($self,$line,$complaint) = @_; + return printf STDERR "%s around line %s: %s\n", + $self->{'source_filename'} || 'Pod input', $line, $complaint; +} + +sub _complain_errata { + my($self,$line,$complaint) = @_; + if( $self->{'no_errata_section'} ) { + DEBUG > 9 and print STDERR "Discarding erratum (at line $line) $complaint\n because no_errata_section is on.\n"; + } else { + DEBUG > 9 and print STDERR "Queuing erratum (at line $line) $complaint\n"; + push @{$self->{'errata'}{$line}}, $complaint + # for a report to be generated later! + } + return 1; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _get_initial_item_type { + # A hack-wrapper here for when you have like "=over\n\n=item 456\n\n" + my($self, $para) = @_; + return $para->[1]{'~type'} if $para->[1]{'~type'}; + + return $para->[1]{'~type'} = 'text' + if join("\n", @{$para}[2 .. $#$para]) =~ m/^\s*(\d+)\.?\s*$/s and $1 ne '1'; + # Else fall thru to the general case: + return $self->_get_item_type($para); +} + + + +sub _get_item_type { # mutates the item!! + my($self, $para) = @_; + return $para->[1]{'~type'} if $para->[1]{'~type'}; + + + # Otherwise we haven't yet been to this node. Maybe alter it... + + my $content = join "\n", @{$para}[2 .. $#$para]; + + if($content =~ m/^\s*\*\s*$/s or $content =~ m/^\s*$/s) { + # Like: "=item *", "=item * ", "=item" + splice @$para, 2; # so it ends up just being ['=item', { attrhash } ] + $para->[1]{'~orig_content'} = $content; + return $para->[1]{'~type'} = 'bullet'; + + } elsif($content =~ m/^\s*\*\s+(.+)/s) { # tolerance + + # Like: "=item * Foo bar baz"; + $para->[1]{'~orig_content'} = $content; + $para->[1]{'~_freaky_para_hack'} = $1; + DEBUG > 2 and print STDERR " Tolerating $$para[2] as =item *\\n\\n$1\n"; + splice @$para, 2; # so it ends up just being ['=item', { attrhash } ] + return $para->[1]{'~type'} = 'bullet'; + + } elsif($content =~ m/^\s*(\d+)\.?\s*$/s) { + # Like: "=item 1.", "=item 123412" + + $para->[1]{'~orig_content'} = $content; + $para->[1]{'number'} = $1; # Yes, stores the number there! + + splice @$para, 2; # so it ends up just being ['=item', { attrhash } ] + return $para->[1]{'~type'} = 'number'; + + } else { + # It's anything else. + return $para->[1]{'~type'} = 'text'; + + } +} + +#----------------------------------------------------------------------------- + +sub _make_treelet { + my $self = shift; # and ($para, $start_line) + my $treelet; + if(!@_) { + return ['']; + } if(ref $_[0] and ref $_[0][0] and $_[0][0][0] eq '~Top') { + # Hack so we can pass in fake-o pre-cooked paragraphs: + # just have the first line be a reference to a ['~Top', {}, ...] + # We use this feechure in gen_errata and stuff. + + DEBUG and print STDERR "Applying precooked treelet hack to $_[0][0]\n"; + $treelet = $_[0][0]; + splice @$treelet, 0, 2; # lop the top off + return $treelet; + } else { + $treelet = $self->_treelet_from_formatting_codes(@_); + } + + if( ! $self->{'_output_is_for_JustPod'} # Retain these as-is for pod output + && $self->_remap_sequences($treelet) ) + { + $self->_treat_Zs($treelet); # Might as well nix these first + $self->_treat_Ls($treelet); # L has to precede E and S + $self->_treat_Es($treelet); + $self->_treat_Ss($treelet); # S has to come after E + $self->_wrap_up($treelet); # Nix X's and merge texties + + } else { + DEBUG and print STDERR "Formatless treelet gets fast-tracked.\n"; + # Very common case! + } + + splice @$treelet, 0, 2; # lop the top off + + return $treelet; +} + +#:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. + +sub _wrap_up { + my($self, @stack) = @_; + my $nixx = $self->{'nix_X_codes'}; + my $merge = $self->{'merge_text' }; + return unless $nixx or $merge; + + DEBUG > 2 and print STDERR "\nStarting _wrap_up traversal.\n", + $merge ? (" Merge mode on\n") : (), + $nixx ? (" Nix-X mode on\n") : (), + ; + + + my($i, $treelet); + while($treelet = shift @stack) { + DEBUG > 3 and print STDERR " Considering children of this $treelet->[0] node...\n"; + for($i = 2; $i < @$treelet; ++$i) { # iterate over children + DEBUG > 3 and print STDERR " Considering child at $i ", pretty($treelet->[$i]), "\n"; + if($nixx and ref $treelet->[$i] and $treelet->[$i][0] eq 'X') { + DEBUG > 3 and print STDERR " Nixing X node at $i\n"; + splice(@$treelet, $i, 1); # just nix this node (and its descendants) + # no need to back-update the counter just yet + redo; + + } elsif($merge and $i != 2 and # non-initial + !ref $treelet->[$i] and !ref $treelet->[$i - 1] + ) { + DEBUG > 3 and print STDERR " Merging ", $i-1, + ":[$treelet->[$i-1]] and $i\:[$treelet->[$i]]\n"; + $treelet->[$i-1] .= ( splice(@$treelet, $i, 1) )[0]; + DEBUG > 4 and print STDERR " Now: ", $i-1, ":[$treelet->[$i-1]]\n"; + --$i; + next; + # since we just pulled the possibly last node out from under + # ourselves, we can't just redo() + + } elsif( ref $treelet->[$i] ) { + DEBUG > 4 and print STDERR " Enqueuing ", pretty($treelet->[$i]), " for traversal.\n"; + push @stack, $treelet->[$i]; + + if($treelet->[$i][0] eq 'L') { + my $thing; + foreach my $attrname ('section', 'to') { + if(defined($thing = $treelet->[$i][1]{$attrname}) and ref $thing) { + unshift @stack, $thing; + DEBUG > 4 and print STDERR " +Enqueuing ", + pretty( $treelet->[$i][1]{$attrname} ), + " as an attribute value to tweak.\n"; + } + } + } + } + } + } + DEBUG > 2 and print STDERR "End of _wrap_up traversal.\n\n"; + + return; +} + +#:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. + +sub _remap_sequences { + my($self,@stack) = @_; + + if(@stack == 1 and @{ $stack[0] } == 3 and !ref $stack[0][2]) { + # VERY common case: abort it. + DEBUG and print STDERR "Skipping _remap_sequences: formatless treelet.\n"; + return 0; + } + + my $map = ($self->{'accept_codes'} || die "NO accept_codes in $self?!?"); + + my $start_line = $stack[0][1]{'start_line'}; + DEBUG > 2 and printf + "\nAbout to start _remap_sequences on treelet from line %s.\n", + $start_line || '[?]' + ; + DEBUG > 3 and print STDERR " Map: ", + join('; ', map "$_=" . ( + ref($map->{$_}) ? join(",", @{$map->{$_}}) : $map->{$_} + ), + sort keys %$map ), + ("B~C~E~F~I~L~S~X~Z" eq join '~', sort keys %$map) + ? " (all normal)\n" : "\n" + ; + + # A recursive algorithm implemented iteratively! Whee! + + my($is, $was, $i, $treelet); # scratch + while($treelet = shift @stack) { + DEBUG > 3 and print STDERR " Considering children of this $treelet->[0] node...\n"; + for($i = 2; $i < @$treelet; ++$i) { # iterate over children + next unless ref $treelet->[$i]; # text nodes are uninteresting + + DEBUG > 4 and print STDERR " Noting child $i : $treelet->[$i][0]<...>\n"; + + $is = $treelet->[$i][0] = $map->{ $was = $treelet->[$i][0] }; + if( DEBUG > 3 ) { + if(!defined $is) { + print STDERR " Code $was<> is UNKNOWN!\n"; + } elsif($is eq $was) { + DEBUG > 4 and print STDERR " Code $was<> stays the same.\n"; + } else { + print STDERR " Code $was<> maps to ", + ref($is) + ? ( "tags ", map("$_<", @$is), '...', map('>', @$is), "\n" ) + : "tag $is<...>.\n"; + } + } + + if(!defined $is) { + $self->whine($start_line, "Deleting unknown formatting code $was<>"); + $is = $treelet->[$i][0] = '1'; # But saving the children! + # I could also insert a leading "$was<" and tailing ">" as + # children of this node, but something about that seems icky. + } + if(ref $is) { + my @dynasty = @$is; + DEBUG > 4 and print STDERR " Renaming $was node to $dynasty[-1]\n"; + $treelet->[$i][0] = pop @dynasty; + my $nugget; + while(@dynasty) { + DEBUG > 4 and printf + " Grafting a new %s node between %s and %s\n", + $dynasty[-1], $treelet->[0], $treelet->[$i][0], + ; + + #$nugget = ; + splice @$treelet, $i, 1, [pop(@dynasty), {}, $treelet->[$i]]; + # relace node with a new parent + } + } elsif($is eq '0') { + splice(@$treelet, $i, 1); # just nix this node (and its descendants) + --$i; # back-update the counter + } elsif($is eq '1') { + splice(@$treelet, $i, 1 # replace this node with its children! + => splice @{ $treelet->[$i] },2 + # (not catching its first two (non-child) items) + ); + --$i; # back up for new stuff + } else { + # otherwise it's unremarkable + unshift @stack, $treelet->[$i]; # just recurse + } + } + } + + DEBUG > 2 and print STDERR "End of _remap_sequences traversal.\n\n"; + + if(@_ == 2 and @{ $_[1] } == 3 and !ref $_[1][2]) { + DEBUG and print STDERR "Noting that the treelet is now formatless.\n"; + return 0; + } + return 1; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub _ponder_extend { + + # "Go to an extreme, move back to a more comfortable place" + # -- /Oblique Strategies/, Brian Eno and Peter Schmidt + + my($self, $para) = @_; + my $content = join ' ', splice @$para, 2; + $content =~ s/^\s+//s; + $content =~ s/\s+$//s; + + DEBUG > 2 and print STDERR "Ogling extensor: =extend $content\n"; + + if($content =~ + m/^ + (\S+) # 1 : new item + \s+ + (\S+) # 2 : fallback(s) + (?:\s+(\S+))? # 3 : element name(s) + \s* + $ + /xs + ) { + my $new_letter = $1; + my $fallbacks_one = $2; + my $elements_one; + $elements_one = defined($3) ? $3 : $1; + + DEBUG > 2 and print STDERR "Extensor has good syntax.\n"; + + unless($new_letter =~ m/^[A-Z]$/s or $new_letter) { + DEBUG > 2 and print STDERR " $new_letter isn't a valid thing to entend.\n"; + $self->whine( + $para->[1]{'start_line'}, + "You can extend only formatting codes A-Z, not like \"$new_letter\"" + ); + return; + } + + if(grep $new_letter eq $_, @Known_formatting_codes) { + DEBUG > 2 and print STDERR " $new_letter isn't a good thing to extend, because known.\n"; + $self->whine( + $para->[1]{'start_line'}, + "You can't extend an established code like \"$new_letter\"" + ); + + #TODO: or allow if last bit is same? + + return; + } + + unless($fallbacks_one =~ m/^[A-Z](,[A-Z])*$/s # like "B", "M,I", etc. + or $fallbacks_one eq '0' or $fallbacks_one eq '1' + ) { + $self->whine( + $para->[1]{'start_line'}, + "Format for second =extend parameter must be like" + . " M or 1 or 0 or M,N or M,N,O but you have it like " + . $fallbacks_one + ); + return; + } + + unless($elements_one =~ m/^[^ ,]+(,[^ ,]+)*$/s) { # like "B", "M,I", etc. + $self->whine( + $para->[1]{'start_line'}, + "Format for third =extend parameter: like foo or bar,Baz,qu:ux but not like " + . $elements_one + ); + return; + } + + my @fallbacks = split ',', $fallbacks_one, -1; + my @elements = split ',', $elements_one, -1; + + foreach my $f (@fallbacks) { + next if exists $Known_formatting_codes{$f} or $f eq '0' or $f eq '1'; + DEBUG > 2 and print STDERR " Can't fall back on unknown code $f\n"; + $self->whine( + $para->[1]{'start_line'}, + "Can't use unknown formatting code '$f' as a fallback for '$new_letter'" + ); + return; + } + + DEBUG > 3 and printf STDERR "Extensor: Fallbacks <%s> Elements <%s>.\n", + @fallbacks, @elements; + + my $canonical_form; + foreach my $e (@elements) { + if(exists $self->{'accept_codes'}{$e}) { + DEBUG > 1 and print STDERR " Mapping '$new_letter' to known extension '$e'\n"; + $canonical_form = $e; + last; # first acceptable elementname wins! + } else { + DEBUG > 1 and print STDERR " Can't map '$new_letter' to unknown extension '$e'\n"; + } + } + + + if( defined $canonical_form ) { + # We found a good N => elementname mapping + $self->{'accept_codes'}{$new_letter} = $canonical_form; + DEBUG > 2 and print + "Extensor maps $new_letter => known element $canonical_form.\n"; + } else { + # We have to use the fallback(s), which might be '0', or '1'. + $self->{'accept_codes'}{$new_letter} + = (@fallbacks == 1) ? $fallbacks[0] : \@fallbacks; + DEBUG > 2 and print + "Extensor maps $new_letter => fallbacks @fallbacks.\n"; + } + + } else { + DEBUG > 2 and print STDERR "Extensor has bad syntax.\n"; + $self->whine( + $para->[1]{'start_line'}, + "Unknown =extend syntax: $content" + ) + } + return; +} + + +#:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. + +sub _treat_Zs { # Nix Z<...>'s + my($self,@stack) = @_; + + my($i, $treelet); + my $start_line = $stack[0][1]{'start_line'}; + + # A recursive algorithm implemented iteratively! Whee! + + while($treelet = shift @stack) { + for($i = 2; $i < @$treelet; ++$i) { # iterate over children + next unless ref $treelet->[$i]; # text nodes are uninteresting + unless($treelet->[$i][0] eq 'Z') { + unshift @stack, $treelet->[$i]; # recurse + next; + } + + DEBUG > 1 and print STDERR "Nixing Z node @{$treelet->[$i]}\n"; + + # bitch UNLESS it's empty + unless( @{$treelet->[$i]} == 2 + or (@{$treelet->[$i]} == 3 and $treelet->[$i][2] eq '') + ) { + $self->whine( $start_line, "A non-empty Z<>" ); + } # but kill it anyway + + splice(@$treelet, $i, 1); # thereby just nix this node. + --$i; + + } + } + + return; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +# Quoting perlpodspec: + +# In parsing an L<...> code, Pod parsers must distinguish at least four +# attributes: + +############# Not used. Expressed via the element children plus +############# the value of the "content-implicit" flag. +# First: +# The link-text. If there is none, this must be undef. (E.g., in "L", the link-text is "Perl Functions". In +# "L" and even "L<|Time::HiRes>", there is no link text. Note +# that link text may contain formatting.) +# + +############# The element children +# Second: +# The possibly inferred link-text -- i.e., if there was no real link text, +# then this is the text that we'll infer in its place. (E.g., for +# "L", the inferred link text is "Getopt::Std".) +# + +############# The "to" attribute (which might be text, or a treelet) +# Third: +# The name or URL, or undef if none. (E.g., in "L", the name -- also sometimes called the page -- is +# "perlfunc". In "L", the name is undef.) +# + +############# The "section" attribute (which might be next, or a treelet) +# Fourth: +# The section (AKA "item" in older perlpods), or undef if none. E.g., in +# Getopt::Std/DESCRIPTION, "DESCRIPTION" is the section. (Note that this +# is not the same as a manpage section like the "5" in "man 5 crontab". +# "Section Foo" in the Pod sense means the part of the text that's +# introduced by the heading or item whose text is "Foo".) +# +# Pod parsers may also note additional attributes including: +# + +############# The "type" attribute. +# Fifth: +# A flag for whether item 3 (if present) is a URL (like +# "http://lists.perl.org" is), in which case there should be no section +# attribute; a Pod name (like "perldoc" and "Getopt::Std" are); or +# possibly a man page name (like "crontab(5)" is). +# + +############# The "raw" attribute that is already there. +# Sixth: +# The raw original L<...> content, before text is split on "|", "/", etc, +# and before E<...> codes are expanded. + + +# For L<...> codes without a "name|" part, only E<...> and Z<> codes may +# occur -- no other formatting codes. That is, authors should not use +# "L>". +# +# Note, however, that formatting codes and Z<>'s can occur in any and all +# parts of an L<...> (i.e., in name, section, text, and url). + +sub _treat_Ls { # Process our dear dear friends, the L<...> sequences + + # L + # L or L + # L or L or L<"sec"> + # L + # L or L + # L or L or L + # L + # L + + my($self,@stack) = @_; + + my($i, $treelet); + my $start_line = $stack[0][1]{'start_line'}; + + # A recursive algorithm implemented iteratively! Whee! + + while($treelet = shift @stack) { + for(my $i = 2; $i < @$treelet; ++$i) { + # iterate over children of current tree node + next unless ref $treelet->[$i]; # text nodes are uninteresting + unless($treelet->[$i][0] eq 'L') { + unshift @stack, $treelet->[$i]; # recurse + next; + } + + + # By here, $treelet->[$i] is definitely an L node + my $ell = $treelet->[$i]; + DEBUG > 1 and print STDERR "Ogling L node " . pretty($ell) . "\n"; + + # bitch if it's empty or is just '/' + if (@{$ell} == 3 and $ell->[2] =~ m!\A\s*/\s*\z!) { + $self->whine( $start_line, "L<> contains only '/'" ); + $treelet->[$i] = 'L'; # just make it a text node + next; # and move on + } + if( @{$ell} == 2 + or (@{$ell} == 3 and $ell->[2] eq '') + ) { + $self->whine( $start_line, "An empty L<>" ); + $treelet->[$i] = 'L<>'; # just make it a text node + next; # and move on + } + + if( (! ref $ell->[2] && $ell->[2] =~ /\A\s/) + ||(! ref $ell->[-1] && $ell->[-1] =~ /\s\z/) + ) { + $self->whine( $start_line, "L<> starts or ends with whitespace" ); + } + + # Catch URLs: + + # there are a number of possible cases: + # 1) text node containing url: http://foo.com + # -> [ 'http://foo.com' ] + # 2) text node containing url and text: foo|http://foo.com + # -> [ 'foo|http://foo.com' ] + # 3) text node containing url start: mailto:xEfoo.com + # -> [ 'mailto:x', [ E ... ], 'foo.com' ] + # 4) text node containing url start and text: foo|mailto:xEfoo.com + # -> [ 'foo|mailto:x', [ E ... ], 'foo.com' ] + # 5) other nodes containing text and url start: OE<39>Malley|http://foo.com + # -> [ 'O', [ E ... ], 'Malley', '|http://foo.com' ] + # ... etc. + + # anything before the url is part of the text. + # anything after it is part of the url. + # the url text node itself may contain parts of both. + + if (my ($url_index, $text_part, $url_part) = + # grep is no good here; we want to bail out immediately so that we can + # use $1, $2, etc. without having to do the match twice. + sub { + for (2..$#$ell) { + next if ref $ell->[$_]; + next unless $ell->[$_] =~ m/^(?:([^|]*)\|)?(\w+:[^:\s]\S*)$/s; + return ($_, $1, $2); + } + return; + }->() + ) { + $ell->[1]{'type'} = 'url'; + + my @text = @{$ell}[2..$url_index-1]; + push @text, $text_part if defined $text_part; + + my @url = @{$ell}[$url_index+1..$#$ell]; + unshift @url, $url_part; + + unless (@text) { + $ell->[1]{'content-implicit'} = 'yes'; + @text = @url; + } + + $ell->[1]{to} = Pod::Simple::LinkSection->new( + @url == 1 + ? $url[0] + : [ '', {}, @url ], + ); + + splice @$ell, 2, $#$ell, @text; + + next; + } + + # Catch some very simple and/or common cases + if(@{$ell} == 3 and ! ref $ell->[2]) { + my $it = $ell->[2]; + if($it =~ m{^[^/|]+[(][-a-zA-Z0-9]+[)]$}s) { # man sections + # Hopefully neither too broad nor too restrictive a RE + DEBUG > 1 and print STDERR "Catching \"$it\" as manpage link.\n"; + $ell->[1]{'type'} = 'man'; + # This's the only place where man links can get made. + $ell->[1]{'content-implicit'} = 'yes'; + $ell->[1]{'to' } = + Pod::Simple::LinkSection->new( $it ); # treelet! + + next; + } + if($it =~ m/^[^\/\|,\$\%\@\ \"\<\>\:\#\&\*\{\}\[\]\(\)]+(\:\:[^\/\|,\$\%\@\ \"\<\>\:\#\&\*\{\}\[\]\(\)]+)*$/s) { + # Extremely forgiving idea of what constitutes a bare + # modulename link like L or even L + DEBUG > 1 and print STDERR "Catching \"$it\" as ho-hum L link.\n"; + $ell->[1]{'type'} = 'pod'; + $ell->[1]{'content-implicit'} = 'yes'; + $ell->[1]{'to' } = + Pod::Simple::LinkSection->new( $it ); # treelet! + next; + } + # else fall thru... + } + + + + # ...Uhoh, here's the real L<...> parsing stuff... + # "With the ill behavior, with the ill behavior, with the ill behavior..." + + DEBUG > 1 and print STDERR "Running a real parse on this non-trivial L\n"; + + + my $link_text; # set to an arrayref if found + my @ell_content = @$ell; + splice @ell_content,0,2; # Knock off the 'L' and {} bits + + DEBUG > 3 and print STDERR " Ell content to start: ", + pretty(@ell_content), "\n"; + + + # Look for the "|" -- only in CHILDREN (not all underlings!) + # Like L + DEBUG > 3 and + print STDERR " Peering at L content for a '|' ...\n"; + for(my $j = 0; $j < @ell_content; ++$j) { + next if ref $ell_content[$j]; + DEBUG > 3 and + print STDERR " Peering at L-content text bit \"$ell_content[$j]\" for a '|'.\n"; + + if($ell_content[$j] =~ m/^([^\|]*)\|(.*)$/s) { + my @link_text = ($1); # might be 0-length + $ell_content[$j] = $2; # might be 0-length + + DEBUG > 3 and + print STDERR " FOUND a '|' in it. Splitting into [$1] + [$2]\n"; + + if ($link_text[0] =~ m{[|/]}) { + $self->whine( + $start_line, + "alternative text '$link_text[0]' contains non-escaped | or /" + ); + } + + unshift @link_text, splice @ell_content, 0, $j; + # leaving only things at J and after + @ell_content = grep ref($_)||length($_), @ell_content ; + $link_text = [grep ref($_)||length($_), @link_text ]; + DEBUG > 3 and printf + " So link text is %s\n and remaining ell content is %s\n", + pretty($link_text), pretty(@ell_content); + last; + } + } + + + # Now look for the "/" -- only in CHILDREN (not all underlings!) + # And afterward, anything left in @ell_content will be the raw name + # Like L + my $section_name; # set to arrayref if found + DEBUG > 3 and print STDERR " Peering at L-content for a '/' ...\n"; + for(my $j = 0; $j < @ell_content; ++$j) { + next if ref $ell_content[$j]; + DEBUG > 3 and + print STDERR " Peering at L-content text bit \"$ell_content[$j]\" for a '/'.\n"; + + if($ell_content[$j] =~ m/^([^\/]*)\/(.*)$/s) { + my @section_name = ($2); # might be 0-length + $ell_content[$j] = $1; # might be 0-length + + DEBUG > 3 and + print STDERR " FOUND a '/' in it.", + " Splitting to page [...$1] + section [$2...]\n"; + + push @section_name, splice @ell_content, 1+$j; + # leaving only things before and including J + + @ell_content = grep ref($_)||length($_), @ell_content ; + @section_name = grep ref($_)||length($_), @section_name ; + + # Turn L<.../"foo"> into L<.../foo> + if(@section_name + and !ref($section_name[0]) and !ref($section_name[-1]) + and $section_name[ 0] =~ m/^\"/s + and $section_name[-1] =~ m/\"$/s + and !( # catch weird degenerate case of L<"> ! + @section_name == 1 and $section_name[0] eq '"' + ) + ) { + $section_name[ 0] =~ s/^\"//s; + $section_name[-1] =~ s/\"$//s; + DEBUG > 3 and + print STDERR " Quotes removed: ", pretty(@section_name), "\n"; + } else { + DEBUG > 3 and + print STDERR " No need to remove quotes in ", pretty(@section_name), "\n"; + } + + $section_name = \@section_name; + last; + } + } + + # Turn L<"Foo Bar"> into L + if(!$section_name and @ell_content + and !ref($ell_content[0]) and !ref($ell_content[-1]) + and $ell_content[ 0] =~ m/^\"/s + and $ell_content[-1] =~ m/\"$/s + and !( # catch weird degenerate case of L<"> ! + @ell_content == 1 and $ell_content[0] eq '"' + ) + ) { + $section_name = [splice @ell_content]; + $section_name->[ 0] =~ s/^\"//s; + $section_name->[-1] =~ s/\"$//s; + $ell->[1]{'~tolerated'} = 1; + } + + # Turn L into L. + if(!$section_name and !$link_text and @ell_content + and grep !ref($_) && m/ /s, @ell_content + ) { + $section_name = [splice @ell_content]; + $ell->[1]{'~deprecated'} = 1; + # That's support for the now-deprecated syntax. + # Note that it deliberately won't work on L<...|Foo Bar> + } + + + # Now make up the link_text + # L -> L + # L -> L<"Bar"|Bar> + # L -> L<"Bar" in Foo/Foo> + unless($link_text) { + $ell->[1]{'content-implicit'} = 'yes'; + $link_text = []; + push @$link_text, '"', @$section_name, '"' if $section_name; + + if(@ell_content) { + $link_text->[-1] .= ' in ' if $section_name; + push @$link_text, @ell_content; + } + } + + + # And the E resolver will have to deal with all our treeletty things: + + if(@ell_content == 1 and !ref($ell_content[0]) + and $ell_content[0] =~ m{^[^/]+[(][-a-zA-Z0-9]+[)]$}s + ) { + $ell->[1]{'type'} = 'man'; + DEBUG > 3 and print STDERR "Considering this ($ell_content[0]) a man link.\n"; + } else { + $ell->[1]{'type'} = 'pod'; + DEBUG > 3 and print STDERR "Considering this a pod link (not man or url).\n"; + } + + if( defined $section_name ) { + $ell->[1]{'section'} = Pod::Simple::LinkSection->new( + ['', {}, @$section_name] + ); + DEBUG > 3 and print STDERR "L-section content: ", pretty($ell->[1]{'section'}), "\n"; + } + + if( @ell_content ) { + $ell->[1]{'to'} = Pod::Simple::LinkSection->new( + ['', {}, @ell_content] + ); + DEBUG > 3 and print STDERR "L-to content: ", pretty($ell->[1]{'to'}), "\n"; + } + + # And update children to be the link-text: + @$ell = (@$ell[0,1], defined($link_text) ? splice(@$link_text) : ''); + + DEBUG > 2 and print STDERR "End of L-parsing for this node " . pretty($treelet->[$i]) . "\n"; + + unshift @stack, $treelet->[$i]; # might as well recurse + } + } + + return; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub _treat_Es { + my($self,@stack) = @_; + + my($i, $treelet, $content, $replacer, $charnum); + my $start_line = $stack[0][1]{'start_line'}; + + # A recursive algorithm implemented iteratively! Whee! + + + # Has frightening side effects on L nodes' attributes. + + #my @ells_to_tweak; + + while($treelet = shift @stack) { + for(my $i = 2; $i < @$treelet; ++$i) { # iterate over children + next unless ref $treelet->[$i]; # text nodes are uninteresting + if($treelet->[$i][0] eq 'L') { + # SPECIAL STUFF for semi-processed L<>'s + + my $thing; + foreach my $attrname ('section', 'to') { + if(defined($thing = $treelet->[$i][1]{$attrname}) and ref $thing) { + unshift @stack, $thing; + DEBUG > 2 and print STDERR " Enqueuing ", + pretty( $treelet->[$i][1]{$attrname} ), + " as an attribute value to tweak.\n"; + } + } + + unshift @stack, $treelet->[$i]; # recurse + next; + } elsif($treelet->[$i][0] ne 'E') { + unshift @stack, $treelet->[$i]; # recurse + next; + } + + DEBUG > 1 and print STDERR "Ogling E node ", pretty($treelet->[$i]), "\n"; + + # bitch if it's empty + if( @{$treelet->[$i]} == 2 + or (@{$treelet->[$i]} == 3 and $treelet->[$i][2] eq '') + ) { + $self->whine( $start_line, "An empty E<>" ); + $treelet->[$i] = 'E<>'; # splice in a literal + next; + } + + # bitch if content is weird + unless(@{$treelet->[$i]} == 3 and !ref($content = $treelet->[$i][2])) { + $self->whine( $start_line, "An E<...> surrounding strange content" ); + $replacer = $treelet->[$i]; # scratch + splice(@$treelet, $i, 1, # fake out a literal + 'E<', + splice(@$replacer,2), # promote its content + '>' + ); + # Don't need to do --$i, as the 'E<' we just added isn't interesting. + next; + } + + DEBUG > 1 and print STDERR "Ogling E<$content>\n"; + + # XXX E<>'s contents *should* be a valid char in the scope of the current + # =encoding directive. Defaults to iso-8859-1, I believe. Fix this in the + # future sometime. + + $charnum = Pod::Escapes::e2charnum($content); + DEBUG > 1 and print STDERR " Considering E<$content> with char ", + defined($charnum) ? $charnum : "undef", ".\n"; + + if(!defined( $charnum )) { + DEBUG > 1 and print STDERR "I don't know how to deal with E<$content>.\n"; + $self->whine( $start_line, "Unknown E content in E<$content>" ); + $replacer = "E<$content>"; # better than nothing + } elsif($charnum >= 255 and !UNICODE) { + $replacer = ASCII ? "\xA4" : "?"; + DEBUG > 1 and print STDERR "This Perl version can't handle ", + "E<$content> (chr $charnum), so replacing with $replacer\n"; + } else { + $replacer = Pod::Escapes::e2char($content); + DEBUG > 1 and print STDERR " Replacing E<$content> with $replacer\n"; + } + + splice(@$treelet, $i, 1, $replacer); # no need to back up $i, tho + } + } + + return; +} + + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub _treat_Ss { + my($self,$treelet) = @_; + + _change_S_to_nbsp($treelet,0) if $self->{'nbsp_for_S'}; + + # TODO: or a change_nbsp_to_S + # Normalizing nbsp's to S is harder: for each text node, make S content + # out of anything matching m/([^ \xA0]*(?:\xA0+[^ \xA0]*)+)/ + + + return; +} + +sub _change_S_to_nbsp { # a recursive function + # Sanely assumes that the top node in the excursion won't be an S node. + my($treelet, $in_s) = @_; + + my $is_s = ('S' eq $treelet->[0]); + $in_s ||= $is_s; # So in_s is on either by this being an S element, + # or by an ancestor being an S element. + + for(my $i = 2; $i < @$treelet; ++$i) { + if(ref $treelet->[$i]) { + if( _change_S_to_nbsp( $treelet->[$i], $in_s ) ) { + my $to_pull_up = $treelet->[$i]; + splice @$to_pull_up,0,2; # ...leaving just its content + splice @$treelet, $i, 1, @$to_pull_up; # Pull up content + $i += @$to_pull_up - 1; # Make $i skip the pulled-up stuff + } + } else { + $treelet->[$i] =~ s/\s/$Pod::Simple::nbsp/g if $in_s; + + # Note that if you apply nbsp_for_S to text, and so turn + # "foo S quux" into "foo bar faz quux", you + # end up with something that fails to say "and don't hyphenate + # any part of 'bar baz'". However, hyphenation is such a vexing + # problem anyway, that most Pod renderers just don't render it + # at all. But if you do want to implement hyphenation, I guess + # that you'd better have nbsp_for_S off. + } + } + + return $is_s; +} + +#----------------------------------------------------------------------------- + +sub _accessorize { # A simple-minded method-maker + no strict 'refs'; + foreach my $attrname (@_) { + next if $attrname =~ m/::/; # a hack + *{caller() . '::' . $attrname} = sub { + use strict; + $Carp::CarpLevel = 1, Carp::croak( + "Accessor usage: \$obj->$attrname() or \$obj->$attrname(\$new_value)" + ) unless (@_ == 1 or @_ == 2) and ref $_[0]; + + (@_ == 1) ? $_[0]->{$attrname} + : ($_[0]->{$attrname} = $_[1]); + }; + } + # Ya know, they say accessories make the ensemble! + return; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +#============================================================================= + +sub filter { + my($class, $source) = @_; + my $new = $class->new; + $new->output_fh(*STDOUT{IO}); + + if(ref($source || '') eq 'SCALAR') { + $new->parse_string_document( $$source ); + } elsif(ref($source)) { # it's a file handle + $new->parse_file($source); + } else { # it's a filename + $new->parse_file($source); + } + + return $new; +} + + +#----------------------------------------------------------------------------- + +sub _out { + # For use in testing: Class->_out($source) + # returns the transformation of $source + + my $class = shift(@_); + + my $mutor = shift(@_) if @_ and ref($_[0] || '') eq 'CODE'; + + DEBUG and print STDERR "\n\n", '#' x 76, + "\nAbout to parse source: {{\n$_[0]\n}}\n\n"; + + + my $parser = ref $class && $class->isa(__PACKAGE__) ? $class : $class->new; + $parser->hide_line_numbers(1); + + my $out = ''; + $parser->output_string( \$out ); + DEBUG and print STDERR " _out to ", \$out, "\n"; + + $mutor->($parser) if $mutor; + + $parser->parse_string_document( $_[0] ); + # use Data::Dumper; print STDERR Dumper($parser), "\n"; + return $out; +} + + +sub _duo { + # For use in testing: Class->_duo($source1, $source2) + # returns the parse trees of $source1 and $source2. + # Good in things like: &ok( Class->duo(... , ...) ); + + my $class = shift(@_); + + Carp::croak "But $class->_duo is useful only in list context!" + unless wantarray; + + my $mutor = shift(@_) if @_ and ref($_[0] || '') eq 'CODE'; + + Carp::croak "But $class->_duo takes two parameters, not: @_" + unless @_ == 2; + + my(@out); + + while( @_ ) { + my $parser = $class->new; + + push @out, ''; + $parser->output_string( \( $out[-1] ) ); + + DEBUG and print STDERR " _duo out to ", $parser->output_string(), + " = $parser->{'output_string'}\n"; + + $parser->hide_line_numbers(1); + $mutor->($parser) if $mutor; + $parser->parse_string_document( shift( @_ ) ); + # use Data::Dumper; print STDERR Dumper($parser), "\n"; + } + + return @out; +} + + + +#----------------------------------------------------------------------------- +1; +__END__ + +TODO: +A start_formatting_code and end_formatting_code methods, which in the +base class call start_L, end_L, start_C, end_C, etc., if they are +defined. + +have the POD FORMATTING ERRORS section note the localtime, and the +version of Pod::Simple. + +option to delete all Es? +option to scream if under-0x20 literals are found in the input, or +under-E<32> E codes are found in the tree. And ditto \x7f-\x9f + +Option to turn highbit characters into their compromised form? (applies +to E parsing too) + +TODO: BOM/encoding things. + +TODO: ascii-compat things in the XML classes? + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pod b/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pod new file mode 100644 index 0000000000000000000000000000000000000000..c569e979ae9cbca36c2133514f0d0dec07615d90 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple.pod @@ -0,0 +1,455 @@ + +=head1 NAME + +Pod::Simple - framework for parsing Pod + +=head1 SYNOPSIS + + TODO + +=head1 DESCRIPTION + +Pod::Simple is a Perl library for parsing text in the Pod ("plain old +documentation") markup language that is typically used for writing +documentation for Perl and for Perl modules. The Pod format is explained +in L; the most common formatter is called C. + +Be sure to read L if your Pod contains non-ASCII characters. + +Pod formatters can use Pod::Simple to parse Pod documents and render them into +plain text, HTML, or any number of other formats. Typically, such formatters +will be subclasses of Pod::Simple, and so they will inherit its methods, like +C. But note that Pod::Simple doesn't understand and +properly parse Perl itself, so if you have a file which contains a Perl +program that has a multi-line quoted string which has lines that look +like pod, Pod::Simple will treat them as pod. This can be avoided if +the file makes these into indented here documents instead. + +If you're reading this document just because you have a Pod-processing +subclass that you want to use, this document (plus the documentation for the +subclass) is probably all you need to read. + +If you're reading this document because you want to write a formatter +subclass, continue reading it and then read L, and +then possibly even read L (some of which is for parser-writers, +but much of which is notes to formatter-writers). + +=head1 MAIN METHODS + +=over + +=item C<< $parser = I->new(); >> + +This returns a new parser object, where I> is a subclass +of Pod::Simple. + +=item C<< $parser->output_fh( *OUT ); >> + +This sets the filehandle that C<$parser>'s output will be written to. +You can pass C<*STDOUT> or C<*STDERR>, otherwise you should probably do +something like this: + + my $outfile = "output.txt"; + open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!"; + $parser->output_fh(*TXTOUT); + +...before you call one of the C<< $parser->parse_I >> methods. + +=item C<< $parser->output_string( \$somestring ); >> + +This sets the string that C<$parser>'s output will be sent to, +instead of any filehandle. + + +=item C<< $parser->parse_file( I<$some_filename> ); >> + +=item C<< $parser->parse_file( *INPUT_FH ); >> + +This reads the Pod content of the file (or filehandle) that you specify, +and processes it with that C<$parser> object, according to however +C<$parser>'s class works, and according to whatever parser options you +have set up for this C<$parser> object. + +=item C<< $parser->parse_string_document( I<$all_content> ); >> + +This works just like C except that it reads the Pod +content not from a file, but from a string that you have already +in memory. + +=item C<< $parser->parse_lines( I<...@lines...>, undef ); >> + +This processes the lines in C<@lines> (where each list item must be a +defined value, and must contain exactly one line of content -- so no +items like C<"foo\nbar"> are allowed). The final C is used to +indicate the end of document being parsed. + +The other C> methods are meant to be called only once +per C<$parser> object; but C can be called as many times per +C<$parser> object as you want, as long as the last call (and only +the last call) ends with an C value. + + +=item C<< $parser->content_seen >> + +This returns true only if there has been any real content seen for this +document. Returns false in cases where the document contains content, +but does not make use of any Pod markup. + +=item C<< I->filter( I<$filename> ); >> + +=item C<< I->filter( I<*INPUT_FH> ); >> + +=item C<< I->filter( I<\$document_content> ); >> + +This is a shortcut method for creating a new parser object, setting the +output handle to STDOUT, and then processing the specified file (or +filehandle, or in-memory document). This is handy for one-liners like +this: + + perl -MPod::Simple::Text -e "Pod::Simple::Text->filter('thingy.pod')" + +=back + + + +=head1 SECONDARY METHODS + +Some of these methods might be of interest to general users, as +well as of interest to formatter-writers. + +Note that the general pattern here is that the accessor-methods +read the attribute's value with C<< $value = $parser->I >> +and set the attribute's value with +C<< $parser->I(I) >>. For each accessor, I typically +only mention one syntax or another, based on which I think you are actually +most likely to use. + + +=over + +=item C<< $parser->parse_characters( I ) >> + +The Pod parser normally expects to read octets and to convert those octets +to characters based on the C<=encoding> declaration in the Pod source. Set +this option to a true value to indicate that the Pod source is already a Perl +character stream. This tells the parser to ignore any C<=encoding> command +and to skip all the code paths involving decoding octets. + +=item C<< $parser->no_whining( I ) >> + +If you set this attribute to a true value, you will suppress the +parser's complaints about irregularities in the Pod coding. By default, +this attribute's value is false, meaning that irregularities will +be reported. + +Note that turning this attribute to true won't suppress one or two kinds +of complaints about rarely occurring unrecoverable errors. + + +=item C<< $parser->no_errata_section( I ) >> + +If you set this attribute to a true value, you will stop the parser from +generating a "POD ERRORS" section at the end of the document. By +default, this attribute's value is false, meaning that an errata section +will be generated, as necessary. + + +=item C<< $parser->complain_stderr( I ) >> + +If you set this attribute to a true value, it will send reports of +parsing errors to STDERR. By default, this attribute's value is false, +meaning that no output is sent to STDERR. + +Setting C also sets C. + + +=item C<< $parser->source_filename >> + +This returns the filename that this parser object was set to read from. + + +=item C<< $parser->doc_has_started >> + +This returns true if C<$parser> has read from a source, and has seen +Pod content in it. + + +=item C<< $parser->source_dead >> + +This returns true if C<$parser> has read from a source, and come to the +end of that source. + +=item C<< $parser->strip_verbatim_indent( I ) >> + +The perlpod spec for a Verbatim paragraph is "It should be reproduced +exactly...", which means that the whitespace you've used to indent your +verbatim blocks will be preserved in the output. This can be annoying for +outputs such as HTML, where that whitespace will remain in front of every +line. It's an unfortunate case where syntax is turned into semantics. + +If the POD you're parsing adheres to a consistent indentation policy, you can +have such indentation stripped from the beginning of every line of your +verbatim blocks. This method tells Pod::Simple what to strip. For two-space +indents, you'd use: + + $parser->strip_verbatim_indent(' '); + +For tab indents, you'd use a tab character: + + $parser->strip_verbatim_indent("\t"); + +If the POD is inconsistent about the indentation of verbatim blocks, but you +have figured out a heuristic to determine how much a particular verbatim block +is indented, you can pass a code reference instead. The code reference will be +executed with one argument, an array reference of all the lines in the +verbatim block, and should return the value to be stripped from each line. For +example, if you decide that you're fine to use the first line of the verbatim +block to set the standard for indentation of the rest of the block, you can +look at the first line and return the appropriate value, like so: + + $new->strip_verbatim_indent(sub { + my $lines = shift; + (my $indent = $lines->[0]) =~ s/\S.*//; + return $indent; + }); + +If you'd rather treat each line individually, you can do that, too, by just +transforming them in-place in the code reference and returning C. Say +that you don't want I lines indented. You can do something like this: + + $new->strip_verbatim_indent(sub { + my $lines = shift; + sub { s/^\s+// for @{ $lines }, + return undef; + }); + +=item C<< $parser->expand_verbatim_tabs( I ) >> + +Default: 8 + +If after any stripping of indentation in verbatim blocks, there remain +tabs, this method call indicates what to do with them. C<0> +means leave them as tabs, any other number indicates that each tab is to +be translated so as to have tab stops every C columns. + +This is independent of other methods (except that it operates after any +verbatim input stripping is done). + +Like the other methods, the input parameter is not checked for validity. +C or containing non-digits has the same effect as 8. + +=back + +=head1 TERTIARY METHODS + +=over + +=item C<< $parser->abandon_output_fh() >>X + +Cancel output to the file handle. Any POD read by the C<$parser> is not +effected. + +=item C<< $parser->abandon_output_string() >>X + +Cancel output to the output string. Any POD read by the C<$parser> is not +effected. + +=item C<< $parser->accept_code( @codes ) >>X + +Alias for L<< accept_codes >>. + +=item C<< $parser->accept_codes( @codes ) >>X + +Allows C<$parser> to accept a list of L. This can be +used to implement user-defined codes. + +=item C<< $parser->accept_directive_as_data( @directives ) >>X + +Allows C<$parser> to accept a list of directives for data paragraphs. A +directive is the label of a L. A data paragraph is +one delimited by C<< =begin/=for/=end >> directives. This can be used to +implement user-defined directives. + +=item C<< $parser->accept_directive_as_processed( @directives ) >>X + +Allows C<$parser> to accept a list of directives for processed paragraphs. A +directive is the label of a L. A processed +paragraph is also known as L. This can be used to +implement user-defined directives. + +=item C<< $parser->accept_directive_as_verbatim( @directives ) >>X + +Allows C<$parser> to accept a list of directives for L. A directive is the label of a L. This +can be used to implement user-defined directives. + +=item C<< $parser->accept_target( @targets ) >>X + +Alias for L<< accept_targets >>. + +=item C<< $parser->accept_target_as_text( @targets ) >>X + +Alias for L<< accept_targets_as_text >>. + +=item C<< $parser->accept_targets( @targets ) >>X + +Accepts targets for C<< =begin/=for/=end >> sections of the POD. + +=item C<< $parser->accept_targets_as_text( @targets ) >>X + +Accepts targets for C<< =begin/=for/=end >> sections that should be parsed as +POD. For details, see L<< perlpodspec/About Data Paragraphs >>. + +=item C<< $parser->any_errata_seen() >>X + +Used to check if any errata was seen. + +I + + die "too many errors\n" if $parser->any_errata_seen(); + +=item C<< $parser->errata_seen() >>X + +Returns a hash reference of all errata seen, both whines and screams. The hash reference's keys are the line number and the value is an array reference of the errors for that line. + +I + + if ( $parser->any_errata_seen() ) { + $logger->log( $parser->errata_seen() ); + } + +=item C<< $parser->detected_encoding() >>X + +Return the encoding corresponding to C<< =encoding >>, but only if the +encoding was recognized and handled. + +=item C<< $parser->encoding() >>X + +Return encoding of the document, even if the encoding is not correctly +handled. + +=item C<< $parser->parse_from_file( $source, $to ) >>X + +Parses from C<$source> file to C<$to> file. Similar to L<< +Pod::Parser/parse_from_file >>. + +=item C<< $parser->scream( @error_messages ) >>X + +Log an error that can't be ignored. + +=item C<< $parser->unaccept_code( @codes ) >>X + +Alias for L<< unaccept_codes >>. + +=item C<< $parser->unaccept_codes( @codes ) >>X + +Removes C<< @codes >> as valid codes for the parse. + +=item C<< $parser->unaccept_directive( @directives ) >>X + +Alias for L<< unaccept_directives >>. + +=item C<< $parser->unaccept_directives( @directives ) >>X + +Removes C<< @directives >> as valid directives for the parse. + +=item C<< $parser->unaccept_target( @targets ) >>X + +Alias for L<< unaccept_targets >>. + +=item C<< $parser->unaccept_targets( @targets ) >>X + +Removes C<< @targets >> as valid targets for the parse. + +=item C<< $parser->version_report() >>X + +Returns a string describing the version. + +=item C<< $parser->whine( @error_messages ) >>X + +Log an error unless C<< $parser->no_whining( TRUE ); >>. + +=back + +=head1 ENCODING + +The Pod::Simple parser expects to read B. The parser will decode the +octets into Perl's internal character string representation using the value of +the C<=encoding> declaration in the POD source. + +If the POD source does not include an C<=encoding> declaration, the parser will +attempt to guess the encoding (selecting one of UTF-8 or CP 1252) by examining +the first non-ASCII bytes and applying the heuristic described in +L. (If the POD source contains only ASCII bytes, the +encoding is assumed to be ASCII.) + +If you set the C option to a true value the parser will +expect characters rather than octets; will ignore any C<=encoding>; and will +make no attempt to decode the input. + +=head1 SEE ALSO + +L + +L + +L + +L + +L + +=head1 SUPPORT + +Questions or discussion about POD and Pod::Simple should be sent to the +pod-people@perl.org mail list. Send an empty email to +pod-people-subscribe@perl.org to subscribe. + +This module is managed in an open GitHub repository, +L. Feel free to fork and contribute, or +to clone L and send patches! + +Please use L to file a bug +report. + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Pod::Simple was created by Sean M. Burke . +But don't bother him, he's retired. + +Pod::Simple is maintained by: + +=over + +=item * Allison Randal C + +=item * Hans Dieter Pearcey C + +=item * David E. Wheeler C + +=item * Karl Williamson C + +=back + +Documentation has been contributed by: + +=over + +=item * Gabor Szabo C + +=item * Shawn H Corey C + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/BlackBox.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/BlackBox.pm new file mode 100644 index 0000000000000000000000000000000000000000..d115aee7e3e626c55899e187202ef9e979e1bb57 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/BlackBox.pm @@ -0,0 +1,2438 @@ +package Pod::Simple::BlackBox; +# +# "What's in the box?" "Pain." +# +########################################################################### +# +# This is where all the scary things happen: parsing lines into +# paragraphs; and then into directives, verbatims, and then also +# turning formatting sequences into treelets. +# +# Are you really sure you want to read this code? +# +#----------------------------------------------------------------------------- +# +# The basic work of this module Pod::Simple::BlackBox is doing the dirty work +# of parsing Pod into treelets (generally one per non-verbatim paragraph), and +# to call the proper callbacks on the treelets. +# +# Every node in a treelet is a ['name', {attrhash}, ...children...] + +use integer; # vroom! +use strict; +use Carp (); +use vars qw($VERSION ); +$VERSION = '3.40'; +#use constant DEBUG => 7; + +sub my_qr ($$) { + + # $1 is a pattern to compile and return. Older perls compile any + # syntactically valid property, even if it isn't legal. To cope with + # this, return an empty string unless the compiled pattern also + # successfully matches $2, which the caller furnishes. + + my ($input_re, $should_match) = @_; + # XXX could have a third parameter $shouldnt_match for extra safety + + my $use_utf8 = ($] le 5.006002) ? 'use utf8;' : ""; + + my $re = eval "no warnings; $use_utf8 qr/$input_re/"; + #print STDERR __LINE__, ": $input_re: $@\n" if $@; + return "" if $@; + + my $matches = eval "no warnings; $use_utf8 '$should_match' =~ /$re/"; + #print STDERR __LINE__, ": $input_re: $@\n" if $@; + return "" if $@; + + #print STDERR __LINE__, ": SUCCESS: $re\n" if $matches; + return $re if $matches; + + #print STDERR __LINE__, ": $re: didn't match\n"; + return ""; +} + +BEGIN { + require Pod::Simple; + *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG +} + +# Matches a character iff the character will have a different meaning +# if we choose CP1252 vs UTF-8 if there is no =encoding line. +# This is broken for early Perls on non-ASCII platforms. +my $non_ascii_re = my_qr('[[:^ascii:]]', "\xB6"); +$non_ascii_re = qr/[\x80-\xFF]/ unless $non_ascii_re; + +# Use patterns understandable by Perl 5.6, if possible +my $cs_re = my_qr('\p{IsCs}', "\x{D800}"); +my $cn_re = my_qr('\p{IsCn}', "\x{09E4}"); # code point unlikely + # to get assigned +my $rare_blocks_re = my_qr('[\p{InIPAExtensions}\p{InSpacingModifierLetters}]', + "\x{250}"); +$rare_blocks_re = my_qr('[\x{0250}-\x{02FF}]', "\x{250}") unless $rare_blocks_re; + +my $script_run_re = eval 'no warnings "experimental::script_run"; + qr/(*script_run: ^ .* $ )/x'; +my $latin_re = my_qr('[\p{IsLatin}\p{IsInherited}\p{IsCommon}]', "\x{100}"); +unless ($latin_re) { + # This was machine generated to be the ranges of the union of the above + # three properties, with things that were undefined by Unicode 4.1 filling + # gaps. That is the version in use when Perl advanced enough to + # successfully compile and execute the above pattern. + $latin_re = my_qr('[\x00-\x{02E9}\x{02EC}-\x{0374}\x{037E}\x{0385}\x{0387}\x{0485}\x{0486}\x{0589}\x{060C}\x{061B}\x{061F}\x{0640}\x{064B}-\x{0655}\x{0670}\x{06DD}\x{0951}-\x{0954}\x{0964}\x{0965}\x{0E3F}\x{10FB}\x{16EB}-\x{16ED}\x{1735}\x{1736}\x{1802}\x{1803}\x{1805}\x{1D00}-\x{1D25}\x{1D2C}-\x{1D5C}\x{1D62}-\x{1D65}\x{1D6B}-\x{1D77}\x{1D79}-\x{1DBE}\x{1DC0}-\x{1EF9}\x{2000}-\x{2125}\x{2127}-\x{27FF}\x{2900}-\x{2B13}\x{2E00}-\x{2E1D}\x{2FF0}-\x{3004}\x{3006}\x{3008}-\x{3020}\x{302A}-\x{302D}\x{3030}-\x{3037}\x{303C}-\x{303F}\x{3099}-\x{309C}\x{30A0}\x{30FB}\x{30FC}\x{3190}-\x{319F}\x{31C0}-\x{31CF}\x{3220}-\x{325F}\x{327F}-\x{32CF}\x{3358}-\x{33FF}\x{4DC0}-\x{4DFF}\x{A700}-\x{A716}\x{FB00}-\x{FB06}\x{FD3E}\x{FD3F}\x{FE00}-\x{FE6B}\x{FEFF}-\x{FF65}\x{FF70}\x{FF9E}\x{FF9F}\x{FFE0}-\x{FFFD}\x{10100}-\x{1013F}\x{1D000}-\x{1D1DD}\x{1D300}-\x{1D7FF}]', "\x{100}"); +} + +my $every_char_is_latin_re = my_qr("^(?:$latin_re)*\\z", "A"); + +# Latin script code points not in the first release of Unicode +my $later_latin_re = my_qr('[^\P{IsLatin}\p{IsAge=1.1}]', "\x{1F6}"); + +# If this perl doesn't have the Deprecated property, there's only one code +# point in it that we need be concerned with. +my $deprecated_re = my_qr('\p{IsDeprecated}', "\x{149}"); +$deprecated_re = qr/\x{149}/ unless $deprecated_re; + +my $utf8_bom; +if (($] ge 5.007_003)) { + $utf8_bom = "\x{FEFF}"; + utf8::encode($utf8_bom); +} else { + $utf8_bom = "\xEF\xBB\xBF"; # No EBCDIC BOM detection for early Perls. +} + +# This is used so that the 'content_seen' method doesn't return true on a +# file that just happens to have a line that matches /^=[a-zA-z]/. Only if +# there is a valid =foo line will we return that content was seen. +my $seen_legal_directive = 0; + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub parse_line { shift->parse_lines(@_) } # alias + +# - - - Turn back now! Run away! - - - + +sub parse_lines { # Usage: $parser->parse_lines(@lines) + # an undef means end-of-stream + my $self = shift; + + my $code_handler = $self->{'code_handler'}; + my $cut_handler = $self->{'cut_handler'}; + my $wl_handler = $self->{'whiteline_handler'}; + $self->{'line_count'} ||= 0; + + my $scratch; + + DEBUG > 4 and + print STDERR "# Parsing starting at line ", $self->{'line_count'}, ".\n"; + + DEBUG > 5 and + print STDERR "# About to parse lines: ", + join(' ', map defined($_) ? "[$_]" : "EOF", @_), "\n"; + + my $paras = ($self->{'paras'} ||= []); + # paragraph buffer. Because we need to defer processing of =over + # directives and verbatim paragraphs. We call _ponder_paragraph_buffer + # to process this. + + $self->{'pod_para_count'} ||= 0; + + # An attempt to match the pod portions of a line. This is not fool proof, + # but is good enough to serve as part of the heuristic for guessing the pod + # encoding if not specified. + my $format_codes = join "", '[', grep { / ^ [A-Za-z] $/x } + keys %{$self->{accept_codes}}; + $format_codes .= ']'; + my $pod_chars_re = qr/ ^ = [A-Za-z]+ | $format_codes < /x; + + my $line; + foreach my $source_line (@_) { + if( $self->{'source_dead'} ) { + DEBUG > 4 and print STDERR "# Source is dead.\n"; + last; + } + + unless( defined $source_line ) { + DEBUG > 4 and print STDERR "# Undef-line seen.\n"; + + push @$paras, ['~end', {'start_line' => $self->{'line_count'}}]; + push @$paras, $paras->[-1], $paras->[-1]; + # So that it definitely fills the buffer. + $self->{'source_dead'} = 1; + $self->_ponder_paragraph_buffer; + next; + } + + + if( $self->{'line_count'}++ ) { + ($line = $source_line) =~ tr/\n\r//d; + # If we don't have two vars, we'll end up with that there + # tr/// modding the (potentially read-only) original source line! + + } else { + DEBUG > 2 and print STDERR "First line: [$source_line]\n"; + + if( ($line = $source_line) =~ s/^$utf8_bom//s ) { + DEBUG and print STDERR "UTF-8 BOM seen. Faking a '=encoding utf8'.\n"; + $self->_handle_encoding_line( "=encoding utf8" ); + delete $self->{'_processed_encoding'}; + $line =~ tr/\n\r//d; + + } elsif( $line =~ s/^\xFE\xFF//s ) { + DEBUG and print STDERR "Big-endian UTF-16 BOM seen. Aborting parsing.\n"; + $self->scream( + $self->{'line_count'}, + "UTF16-BE Byte Encoding Mark found; but Pod::Simple v$Pod::Simple::VERSION doesn't implement UTF16 yet." + ); + splice @_; + push @_, undef; + next; + + # TODO: implement somehow? + + } elsif( $line =~ s/^\xFF\xFE//s ) { + DEBUG and print STDERR "Little-endian UTF-16 BOM seen. Aborting parsing.\n"; + $self->scream( + $self->{'line_count'}, + "UTF16-LE Byte Encoding Mark found; but Pod::Simple v$Pod::Simple::VERSION doesn't implement UTF16 yet." + ); + splice @_; + push @_, undef; + next; + + # TODO: implement somehow? + + } else { + DEBUG > 2 and print STDERR "First line is BOM-less.\n"; + ($line = $source_line) =~ tr/\n\r//d; + } + } + + if(!$self->{'parse_characters'} && !$self->{'encoding'} + && ($self->{'in_pod'} || $line =~ /^=/s) + && $line =~ /$non_ascii_re/ + ) { + + my $encoding; + + # No =encoding line, and we are at the first pod line in the input that + # contains a non-ascii byte, that is, one whose meaning varies depending + # on whether the file is encoded in UTF-8 or CP1252, which are the two + # possibilities permitted by the pod spec. (ASCII is assumed if the + # file only contains ASCII bytes.) In order to process this line, we + # need to figure out what encoding we will use for the file. + # + # Strictly speaking ISO 8859-1 (Latin 1) refers to the code points + # 160-255, but it is used here, as it often colloquially is, to refer to + # the complete set of code points 0-255, including ASCII (0-127), the C1 + # controls (128-159), and strict Latin 1 (160-255). + # + # CP1252 is effectively a superset of Latin 1, because it differs only + # from colloquial 8859-1 in the C1 controls, which are very unlikely to + # actually be present in 8859-1 files, so can be used for other purposes + # without conflict. CP 1252 uses most of them for graphic characters. + # + # Note that all ASCII-range bytes represent their corresponding code + # points in both CP1252 and UTF-8. In ASCII platform UTF-8, all other + # code points require multiple (non-ASCII) bytes to represent. (A + # separate paragraph for EBCDIC is below.) The multi-byte + # representation is quite structured. If we find an isolated byte that + # would require multiple bytes to represent in UTF-8, we know that the + # encoding is not UTF-8. If we find a sequence of bytes that violates + # the UTF-8 structure, we also can presume the encoding isn't UTF-8, and + # hence must be 1252. + # + # But there are ambiguous cases where we could guess wrong. If so, the + # user will end up having to supply an =encoding line. We use all + # readily available information to improve our chances of guessing + # right. The odds of something not being UTF-8, but still passing a + # UTF-8 validity test go down very rapidly with increasing length of the + # sequence. Therefore we look at all non-ascii sequences on the line. + # If any of the sequences can't be UTF-8, we quit there and choose + # CP1252. If all could be UTF-8, we see if any of the code points + # represented are unlikely to be in pod. If so, we guess CP1252. If + # not, we check if the line is all in the same script; if not guess + # CP1252; otherwise UTF-8. For perls that don't have convenient script + # run testing, see if there is both Latin and non-Latin. If so, CP1252, + # otherwise UTF-8. + # + # On EBCDIC platforms, the situation is somewhat different. In + # UTF-EBCDIC, not only do ASCII-range bytes represent their code points, + # but so do the bytes that are for the C1 controls. Recall that these + # correspond to the unused portion of 8859-1 that 1252 mostly takes + # over. That means that there are fewer code points that are + # represented by multi-bytes. But, note that the these controls are + # very unlikely to be in pod text. So if we encounter one of them, it + # means that it is quite likely CP1252 and not UTF-8. The net result is + # the same code below is used for both platforms. + # + # XXX probably if the line has E that evaluates to illegal CP1252, + # then it is UTF-8. But we haven't processed E<> yet. + + goto set_1252 if $] lt 5.006_000; # No UTF-8 on very early perls + + my $copy; + + no warnings 'utf8'; + + if ($] ge 5.007_003) { + $copy = $line; + + # On perls that have this function, we can use it to easily see if the + # sequence is valid UTF-8 or not; if valid it turns on the UTF-8 flag + # needed below for script run detection + goto set_1252 if ! utf8::decode($copy); + } + elsif (ord("A") != 65) { # Early EBCDIC, assume UTF-8. What's a windows + # code page doing here anyway? + goto set_utf8; + } + else { # ASCII, no decode(): do it ourselves using the fundamental + # characteristics of UTF-8 + use if $] le 5.006002, 'utf8'; + + my $char_ord; + my $needed; # How many continuation bytes to gobble up + + # Initialize the translated line with a dummy character that will be + # deleted after everything else is done. This dummy makes sure that + # $copy will be in UTF-8. Doing it now avoids the bugs in early perls + # with upgrading in the middle + $copy = chr(0x100); + + # Parse through the line + for (my $i = 0; $i < length $line; $i++) { + my $byte = substr($line, $i, 1); + + # ASCII bytes are trivially dealt with + if ($byte !~ $non_ascii_re) { + $copy .= $byte; + next; + } + + my $b_ord = ord $byte; + + # Now figure out what this code point would be if the input is + # actually in UTF-8. If, in the process, we discover that it isn't + # well-formed UTF-8, we guess CP1252. + # + # Start the process. If it is UTF-8, we are at the first, start + # byte, of a multi-byte sequence. We look at this byte to figure + # out how many continuation bytes are needed, and to initialize the + # code point accumulator with the data from this byte. + # + # Normally the minimum continuation byte is 0x80, but in certain + # instances the minimum is a higher number. So the code below + # overrides this for those instances. + my $min_cont = 0x80; + + if ($b_ord < 0xC2) { # A start byte < C2 is malformed + goto set_1252; + } + elsif ($b_ord <= 0xDF) { + $needed = 1; + $char_ord = $b_ord & 0x1F; + } + elsif ($b_ord <= 0xEF) { + $min_cont = 0xA0 if $b_ord == 0xE0; + $needed = 2; + $char_ord = $b_ord & (0x1F >> 1); + } + elsif ($b_ord <= 0xF4) { + $min_cont = 0x90 if $b_ord == 0xF0; + $needed = 3; + $char_ord = $b_ord & (0x1F >> 2); + } + else { # F4 is the highest start byte for legal Unicode; higher is + # unlikely to be in pod. + goto set_1252; + } + + # ? not enough continuation bytes available + goto set_1252 if $i + $needed >= length $line; + + # Accumulate the ordinal of the character from the remaining + # (continuation) bytes. + while ($needed-- > 0) { + my $cont = substr($line, ++$i, 1); + $b_ord = ord $cont; + goto set_1252 if $b_ord < $min_cont || $b_ord > 0xBF; + + # In all cases, any next continuation bytes all have the same + # minimum legal value + $min_cont = 0x80; + + # Accumulate this byte's contribution to the code point + $char_ord <<= 6; + $char_ord |= ($b_ord & 0x3F); + } + + # Here, the sequence that formed this code point was valid UTF-8, + # so add the completed character to the output + $copy .= chr $char_ord; + } # End of loop through line + + # Delete the dummy first character + $copy = substr($copy, 1); + } + + # Here, $copy is legal UTF-8. + + # If it can't be legal CP1252, no need to look further. (These bytes + # aren't valid in CP1252.) This test could have been placed higher in + # the code, but it seemed wrong to set the encoding to UTF-8 without + # making sure that the very first instance is well-formed. But what if + # it isn't legal CP1252 either? We have to choose one or the other, and + # It seems safer to favor the single-byte encoding over the multi-byte. + goto set_utf8 if ord("A") == 65 && $line =~ /[\x81\x8D\x8F\x90\x9D]/; + + # The C1 controls are not likely to appear in pod + goto set_1252 if ord("A") == 65 && $copy =~ /[\x80-\x9F]/; + + # Nor are surrogates nor unassigned, nor deprecated. + DEBUG > 8 and print STDERR __LINE__, ": $copy: surrogate\n" if $copy =~ $cs_re; + goto set_1252 if $cs_re && $copy =~ $cs_re; + DEBUG > 8 and print STDERR __LINE__, ": $copy: unassigned\n" if $cn_re && $copy =~ $cn_re; + goto set_1252 if $cn_re && $copy =~ $cn_re; + DEBUG > 8 and print STDERR __LINE__, ": $copy: deprecated\n" if $copy =~ $deprecated_re; + goto set_1252 if $copy =~ $deprecated_re; + + # Nor are rare code points. But this is hard to determine. khw + # believes that IPA characters and the modifier letters are unlikely to + # be in pod (and certainly very unlikely to be the in the first line in + # the pod containing non-ASCII) + DEBUG > 8 and print STDERR __LINE__, ": $copy: rare\n" if $copy =~ $rare_blocks_re; + goto set_1252 if $rare_blocks_re && $copy =~ $rare_blocks_re; + + # The first Unicode version included essentially every Latin character + # in modern usage. So, a Latin character not in the first release will + # unlikely be in pod. + DEBUG > 8 and print STDERR __LINE__, ": $copy: later_latin\n" if $later_latin_re && $copy =~ $later_latin_re; + goto set_1252 if $later_latin_re && $copy =~ $later_latin_re; + + # On perls that handle script runs, if the UTF-8 interpretation yields + # a single script, we guess UTF-8, otherwise just having a mixture of + # scripts is suspicious, so guess CP1252. We first strip off, as best + # we can, the ASCII characters that look like they are pod directives, + # as these would always show as mixed with non-Latin text. + $copy =~ s/$pod_chars_re//g; + + if ($script_run_re) { + goto set_utf8 if $copy =~ $script_run_re; + DEBUG > 8 and print STDERR __LINE__, ": not script run\n"; + goto set_1252; + } + + # Even without script runs, but on recent enough perls and Unicodes, we + # can check if there is a mixture of both Latin and non-Latin. Again, + # having a mixture of scripts is suspicious, so assume CP1252 + + # If it's all non-Latin, there is no CP1252, as that is Latin + # characters and punct, etc. + DEBUG > 8 and print STDERR __LINE__, ": $copy: not latin\n" if $copy !~ $latin_re; + goto set_utf8 if $copy !~ $latin_re; + + DEBUG > 8 and print STDERR __LINE__, ": $copy: all latin\n" if $copy =~ $every_char_is_latin_re; + goto set_utf8 if $copy =~ $every_char_is_latin_re; + + DEBUG > 8 and print STDERR __LINE__, ": $copy: mixed\n"; + + set_1252: + DEBUG > 9 and print STDERR __LINE__, ": $copy: is 1252\n"; + $encoding = 'CP1252'; + goto done_set; + + set_utf8: + DEBUG > 9 and print STDERR __LINE__, ": $copy: is UTF-8\n"; + $encoding = 'UTF-8'; + + done_set: + $self->_handle_encoding_line( "=encoding $encoding" ); + delete $self->{'_processed_encoding'}; + $self->{'_transcoder'} && $self->{'_transcoder'}->($line); + + my ($word) = $line =~ /(\S*$non_ascii_re\S*)/; + + $self->whine( + $self->{'line_count'}, + "Non-ASCII character seen before =encoding in '$word'. Assuming $encoding" + ); + } + + DEBUG > 5 and print STDERR "# Parsing line: [$line]\n"; + + if(!$self->{'in_pod'}) { + if($line =~ m/^=([a-zA-Z][a-zA-Z0-9]*)(?:\s|$)/s) { + if($1 eq 'cut') { + $self->scream( + $self->{'line_count'}, + "=cut found outside a pod block. Skipping to next block." + ); + + ## Before there were errata sections in the world, it was + ## least-pessimal to abort processing the file. But now we can + ## just barrel on thru (but still not start a pod block). + #splice @_; + #push @_, undef; + + next; + } else { + $self->{'in_pod'} = $self->{'start_of_pod_block'} + = $self->{'last_was_blank'} = 1; + # And fall thru to the pod-mode block further down + } + } else { + DEBUG > 5 and print STDERR "# It's a code-line.\n"; + $code_handler->(map $_, $line, $self->{'line_count'}, $self) + if $code_handler; + # Note: this may cause code to be processed out of order relative + # to pods, but in order relative to cuts. + + # Note also that we haven't yet applied the transcoding to $line + # by time we call $code_handler! + + if( $line =~ m/^#\s*line\s+(\d+)\s*(?:\s"([^"]+)")?\s*$/ ) { + # That RE is from perlsyn, section "Plain Old Comments (Not!)", + #$fname = $2 if defined $2; + #DEBUG > 1 and defined $2 and print STDERR "# Setting fname to \"$fname\"\n"; + DEBUG > 1 and print STDERR "# Setting nextline to $1\n"; + $self->{'line_count'} = $1 - 1; + } + + next; + } + } + + # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + # Else we're in pod mode: + + # Apply any necessary transcoding: + $self->{'_transcoder'} && $self->{'_transcoder'}->($line); + + # HERE WE CATCH =encoding EARLY! + if( $line =~ m/^=encoding\s+\S+\s*$/s ) { + next if $self->parse_characters; # Ignore this line + $line = $self->_handle_encoding_line( $line ); + } + + if($line =~ m/^=cut/s) { + # here ends the pod block, and therefore the previous pod para + DEBUG > 1 and print STDERR "Noting =cut at line ${$self}{'line_count'}\n"; + $self->{'in_pod'} = 0; + # ++$self->{'pod_para_count'}; + $self->_ponder_paragraph_buffer(); + # by now it's safe to consider the previous paragraph as done. + DEBUG > 6 and print STDERR "Processing any cut handler, line ${$self}{'line_count'}\n"; + $cut_handler->(map $_, $line, $self->{'line_count'}, $self) + if $cut_handler; + + # TODO: add to docs: Note: this may cause cuts to be processed out + # of order relative to pods, but in order relative to code. + + } elsif($line =~ m/^(\s*)$/s) { # it's a blank line + if (defined $1 and $1 =~ /[^\S\r\n]/) { # it's a white line + $wl_handler->(map $_, $line, $self->{'line_count'}, $self) + if $wl_handler; + } + + if(!$self->{'start_of_pod_block'} and @$paras and $paras->[-1][0] eq '~Verbatim') { + DEBUG > 1 and print STDERR "Saving blank line at line ${$self}{'line_count'}\n"; + push @{$paras->[-1]}, $line; + } # otherwise it's not interesting + + if(!$self->{'start_of_pod_block'} and !$self->{'last_was_blank'}) { + DEBUG > 1 and print STDERR "Noting para ends with blank line at ${$self}{'line_count'}\n"; + } + + $self->{'last_was_blank'} = 1; + + } elsif($self->{'last_was_blank'}) { # A non-blank line starting a new para... + + if($line =~ m/^(=[a-zA-Z][a-zA-Z0-9]*)(\s+|$)(.*)/s) { + # THIS IS THE ONE PLACE WHERE WE CONSTRUCT NEW DIRECTIVE OBJECTS + my $new = [$1, {'start_line' => $self->{'line_count'}}, $3]; + $new->[1]{'~orig_spacer'} = $2 if $2 && $2 ne " "; + # Note that in "=head1 foo", the WS is lost. + # Example: ['=head1', {'start_line' => 123}, ' foo'] + + ++$self->{'pod_para_count'}; + + $self->_ponder_paragraph_buffer(); + # by now it's safe to consider the previous paragraph as done. + + push @$paras, $new; # the new incipient paragraph + DEBUG > 1 and print STDERR "Starting new ${$paras}[-1][0] para at line ${$self}{'line_count'}\n"; + + } elsif($line =~ m/^\s/s) { + + if(!$self->{'start_of_pod_block'} and @$paras and $paras->[-1][0] eq '~Verbatim') { + DEBUG > 1 and print STDERR "Resuming verbatim para at line ${$self}{'line_count'}\n"; + push @{$paras->[-1]}, $line; + } else { + ++$self->{'pod_para_count'}; + $self->_ponder_paragraph_buffer(); + # by now it's safe to consider the previous paragraph as done. + DEBUG > 1 and print STDERR "Starting verbatim para at line ${$self}{'line_count'}\n"; + push @$paras, ['~Verbatim', {'start_line' => $self->{'line_count'}}, $line]; + } + } else { + ++$self->{'pod_para_count'}; + $self->_ponder_paragraph_buffer(); + # by now it's safe to consider the previous paragraph as done. + push @$paras, ['~Para', {'start_line' => $self->{'line_count'}}, $line]; + DEBUG > 1 and print STDERR "Starting plain para at line ${$self}{'line_count'}\n"; + } + $self->{'last_was_blank'} = $self->{'start_of_pod_block'} = 0; + + } else { + # It's a non-blank line /continuing/ the current para + if(@$paras) { + DEBUG > 2 and print STDERR "Line ${$self}{'line_count'} continues current paragraph\n"; + push @{$paras->[-1]}, $line; + } else { + # Unexpected case! + die "Continuing a paragraph but \@\$paras is empty?"; + } + $self->{'last_was_blank'} = $self->{'start_of_pod_block'} = 0; + } + + } # ends the big while loop + + DEBUG > 1 and print STDERR (pretty(@$paras), "\n"); + return $self; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _handle_encoding_line { + my($self, $line) = @_; + + return if $self->parse_characters; + + # The point of this routine is to set $self->{'_transcoder'} as indicated. + + return $line unless $line =~ m/^=encoding\s+(\S+)\s*$/s; + DEBUG > 1 and print STDERR "Found an encoding line \"=encoding $1\"\n"; + + my $e = $1; + my $orig = $e; + push @{ $self->{'encoding_command_reqs'} }, "=encoding $orig"; + + my $enc_error; + + # Cf. perldoc Encode and perldoc Encode::Supported + + require Pod::Simple::Transcode; + + if( $self->{'encoding'} ) { + my $norm_current = $self->{'encoding'}; + my $norm_e = $e; + foreach my $that ($norm_current, $norm_e) { + $that = lc($that); + $that =~ s/[-_]//g; + } + if($norm_current eq $norm_e) { + DEBUG > 1 and print STDERR "The '=encoding $orig' line is ", + "redundant. ($norm_current eq $norm_e). Ignoring.\n"; + $enc_error = ''; + # But that doesn't necessarily mean that the earlier one went okay + } else { + $enc_error = "Encoding is already set to " . $self->{'encoding'}; + DEBUG > 1 and print STDERR $enc_error; + } + } elsif ( + # OK, let's turn on the encoding + do { + DEBUG > 1 and print STDERR " Setting encoding to $e\n"; + $self->{'encoding'} = $e; + 1; + } + and $e eq 'HACKRAW' + ) { + DEBUG and print STDERR " Putting in HACKRAW (no-op) encoding mode.\n"; + + } elsif( Pod::Simple::Transcode::->encoding_is_available($e) ) { + + die($enc_error = "WHAT? _transcoder is already set?!") + if $self->{'_transcoder'}; # should never happen + require Pod::Simple::Transcode; + $self->{'_transcoder'} = Pod::Simple::Transcode::->make_transcoder($e); + eval { + my @x = ('', "abc", "123"); + $self->{'_transcoder'}->(@x); + }; + $@ && die( $enc_error = + "Really unexpected error setting up encoding $e: $@\nAborting" + ); + $self->{'detected_encoding'} = $e; + + } else { + my @supported = Pod::Simple::Transcode::->all_encodings; + + # Note unsupported, and complain + DEBUG and print STDERR " Encoding [$e] is unsupported.", + "\nSupporteds: @supported\n"; + my $suggestion = ''; + + # Look for a near match: + my $norm = lc($e); + $norm =~ tr[-_][]d; + my $n; + foreach my $enc (@supported) { + $n = lc($enc); + $n =~ tr[-_][]d; + next unless $n eq $norm; + $suggestion = " (Maybe \"$e\" should be \"$enc\"?)"; + last; + } + my $encmodver = Pod::Simple::Transcode::->encmodver; + $enc_error = join '' => + "This document probably does not appear as it should, because its ", + "\"=encoding $e\" line calls for an unsupported encoding.", + $suggestion, " [$encmodver\'s supported encodings are: @supported]" + ; + + $self->scream( $self->{'line_count'}, $enc_error ); + } + push @{ $self->{'encoding_command_statuses'} }, $enc_error; + if (defined($self->{'_processed_encoding'})) { + # Double declaration. + $self->scream( $self->{'line_count'}, 'Cannot have multiple =encoding directives'); + } + $self->{'_processed_encoding'} = $orig; + + return $line; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _handle_encoding_second_level { + # By time this is called, the encoding (if well formed) will already + # have been acted on. + my($self, $para) = @_; + my @x = @$para; + my $content = join ' ', splice @x, 2; + $content =~ s/^\s+//s; + $content =~ s/\s+$//s; + + DEBUG > 2 and print STDERR "Ogling encoding directive: =encoding $content\n"; + + if (defined($self->{'_processed_encoding'})) { + #if($content ne $self->{'_processed_encoding'}) { + # Could it happen? + #} + delete $self->{'_processed_encoding'}; + # It's already been handled. Check for errors. + if(! $self->{'encoding_command_statuses'} ) { + DEBUG > 2 and print STDERR " CRAZY ERROR: It wasn't really handled?!\n"; + } elsif( $self->{'encoding_command_statuses'}[-1] ) { + $self->whine( $para->[1]{'start_line'}, + sprintf "Couldn't do %s: %s", + $self->{'encoding_command_reqs' }[-1], + $self->{'encoding_command_statuses'}[-1], + ); + } else { + DEBUG > 2 and print STDERR " (Yup, it was successfully handled already.)\n"; + } + + } else { + # Otherwise it's a syntax error + $self->whine( $para->[1]{'start_line'}, + "Invalid =encoding syntax: $content" + ); + } + + return; +} + +#~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~` + +{ +my $m = -321; # magic line number + +sub _gen_errata { + my $self = $_[0]; + # Return 0 or more fake-o paragraphs explaining the accumulated + # errors on this document. + + return() unless $self->{'errata'} and keys %{$self->{'errata'}}; + + my @out; + + foreach my $line (sort {$a <=> $b} keys %{$self->{'errata'}}) { + push @out, + ['=item', {'start_line' => $m}, "Around line $line:"], + map( ['~Para', {'start_line' => $m, '~cooked' => 1}, + #['~Top', {'start_line' => $m}, + $_ + #] + ], + @{$self->{'errata'}{$line}} + ) + ; + } + + # TODO: report of unknown entities? unrenderable characters? + + unshift @out, + ['=head1', {'start_line' => $m, 'errata' => 1}, 'POD ERRORS'], + ['~Para', {'start_line' => $m, '~cooked' => 1, 'errata' => 1}, + "Hey! ", + ['B', {}, + 'The above document had some coding errors, which are explained below:' + ] + ], + ['=over', {'start_line' => $m, 'errata' => 1}, ''], + ; + + push @out, + ['=back', {'start_line' => $m, 'errata' => 1}, ''], + ; + + DEBUG and print STDERR "\n<<\n", pretty(\@out), "\n>>\n\n"; + + return @out; +} + +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +############################################################################## +## +## stop reading now stop reading now stop reading now stop reading now stop +## +## HERE IT BECOMES REALLY SCARY +## +## stop reading now stop reading now stop reading now stop reading now stop +## +############################################################################## + +sub _ponder_paragraph_buffer { + + # Para-token types as found in the buffer. + # ~Verbatim, ~Para, ~end, =head1..4, =for, =begin, =end, + # =over, =back, =item + # and the null =pod (to be complained about if over one line) + # + # "~data" paragraphs are something we generate at this level, depending on + # a currently open =over region + + # Events fired: Begin and end for: + # directivename (like head1 .. head4), item, extend, + # for (from =begin...=end, =for), + # over-bullet, over-number, over-text, over-block, + # item-bullet, item-number, item-text, + # Document, + # Data, Para, Verbatim + # B, C, longdirname (TODO -- wha?), etc. for all directives + # + + my $self = $_[0]; + my $paras; + return unless @{$paras = $self->{'paras'}}; + my $curr_open = ($self->{'curr_open'} ||= []); + + my $scratch; + + DEBUG > 10 and print STDERR "# Paragraph buffer: <<", pretty($paras), ">>\n"; + + # We have something in our buffer. So apparently the document has started. + unless($self->{'doc_has_started'}) { + $self->{'doc_has_started'} = 1; + + my $starting_contentless; + $starting_contentless = + ( + !@$curr_open + and @$paras and ! grep $_->[0] ne '~end', @$paras + # i.e., if the paras is all ~ends + ) + ; + DEBUG and print STDERR "# Starting ", + $starting_contentless ? 'contentless' : 'contentful', + " document\n" + ; + + $self->_handle_element_start( + ($scratch = 'Document'), + { + 'start_line' => $paras->[0][1]{'start_line'}, + $starting_contentless ? ( 'contentless' => 1 ) : (), + }, + ); + } + + my($para, $para_type); + while(@$paras) { + + # If a directive, assume it's legal; subtract below if found not to be + $seen_legal_directive++ if $paras->[0][0] =~ /^=/; + + last if @$paras == 1 + and ( $paras->[0][0] eq '=over' + or $paras->[0][0] eq '=item' + or ($paras->[0][0] eq '~Verbatim' and $self->{'in_pod'})); + # Those're the three kinds of paragraphs that require lookahead. + # Actually, an "=item Foo" inside an region + # and any =item inside an region (rare) + # don't require any lookahead, but all others (bullets + # and numbers) do. + # The verbatim is different from the other two, because those might be + # like: + # + # =item + # ... + # =cut + # ... + # =item + # + # The =cut here finishes the paragraph but doesn't terminate the =over + # they should be in. (khw apologizes that he didn't comment at the time + # why the 'in_pod' works, and no longer remembers why, and doesn't think + # it is currently worth the effort to re-figure it out.) + +# TODO: whinge about many kinds of directives in non-resolving =for regions? +# TODO: many? like what? =head1 etc? + + $para = shift @$paras; + $para_type = $para->[0]; + + DEBUG > 1 and print STDERR "Pondering a $para_type paragraph, given the stack: (", + $self->_dump_curr_open(), ")\n"; + + if($para_type eq '=for') { + next if $self->_ponder_for($para,$curr_open,$paras); + + } elsif($para_type eq '=begin') { + next if $self->_ponder_begin($para,$curr_open,$paras); + + } elsif($para_type eq '=end') { + next if $self->_ponder_end($para,$curr_open,$paras); + + } elsif($para_type eq '~end') { # The virtual end-document signal + next if $self->_ponder_doc_end($para,$curr_open,$paras); + } + + + # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + #~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + if(grep $_->[1]{'~ignore'}, @$curr_open) { + DEBUG > 1 and + print STDERR "Skipping $para_type paragraph because in ignore mode.\n"; + next; + } + #~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + + if($para_type eq '=pod') { + $self->_ponder_pod($para,$curr_open,$paras); + + } elsif($para_type eq '=over') { + next if $self->_ponder_over($para,$curr_open,$paras); + + } elsif($para_type eq '=back') { + next if $self->_ponder_back($para,$curr_open,$paras); + + } else { + + # All non-magical codes!!! + + # Here we start using $para_type for our own twisted purposes, to + # mean how it should get treated, not as what the element name + # should be. + + DEBUG > 1 and print STDERR "Pondering non-magical $para_type\n"; + + my $i; + + # Enforce some =headN discipline + if($para_type =~ m/^=head\d$/s + and ! $self->{'accept_heads_anywhere'} + and @$curr_open + and $curr_open->[-1][0] eq '=over' + ) { + DEBUG > 2 and print STDERR "'=$para_type' inside an '=over'!\n"; + $self->whine( + $para->[1]{'start_line'}, + "You forgot a '=back' before '$para_type'" + ); + unshift @$paras, ['=back', {}, ''], $para; # close the =over + next; + } + + + if($para_type eq '=item') { + + my $over; + unless(@$curr_open and + $over = (grep { $_->[0] eq '=over' } @$curr_open)[-1]) { + $self->whine( + $para->[1]{'start_line'}, + "'=item' outside of any '=over'" + ); + unshift @$paras, + ['=over', {'start_line' => $para->[1]{'start_line'}}, ''], + $para + ; + next; + } + + + my $over_type = $over->[1]{'~type'}; + + if(!$over_type) { + # Shouldn't happen1 + die "Typeless over in stack, starting at line " + . $over->[1]{'start_line'}; + + } elsif($over_type eq 'block') { + unless($curr_open->[-1][1]{'~bitched_about'}) { + $curr_open->[-1][1]{'~bitched_about'} = 1; + $self->whine( + $curr_open->[-1][1]{'start_line'}, + "You can't have =items (as at line " + . $para->[1]{'start_line'} + . ") unless the first thing after the =over is an =item" + ); + } + # Just turn it into a paragraph and reconsider it + $para->[0] = '~Para'; + unshift @$paras, $para; + next; + + } elsif($over_type eq 'text') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + if($item_type eq 'text') { + # Nothing special needs doing for 'text' + } elsif($item_type eq 'number' or $item_type eq 'bullet') { + $self->whine( + $para->[1]{'start_line'}, + "Expected text after =item, not a $item_type" + ); + # Undo our clobbering: + push @$para, $para->[1]{'~orig_content'}; + delete $para->[1]{'number'}; + # Only a PROPER item-number element is allowed + # to have a number attribute. + } else { + die "Unhandled item type $item_type"; # should never happen + } + + # =item-text thingies don't need any assimilation, it seems. + + } elsif($over_type eq 'number') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + my $expected_value = ++ $curr_open->[-1][1]{'~counter'}; + + if($item_type eq 'bullet') { + # Hm, it's not numeric. Correct for this. + $para->[1]{'number'} = $expected_value; + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item $expected_value'" + ); + push @$para, $para->[1]{'~orig_content'}; + # restore the bullet, blocking the assimilation of next para + + } elsif($item_type eq 'text') { + # Hm, it's not numeric. Correct for this. + $para->[1]{'number'} = $expected_value; + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item $expected_value'" + ); + # Text content will still be there and will block next ~Para + + } elsif($item_type ne 'number') { + die "Unknown item type $item_type"; # should never happen + + } elsif($expected_value == $para->[1]{'number'}) { + DEBUG > 1 and print STDERR " Numeric item has the expected value of $expected_value\n"; + + } else { + DEBUG > 1 and print STDERR " Numeric item has ", $para->[1]{'number'}, + " instead of the expected value of $expected_value\n"; + $self->whine( + $para->[1]{'start_line'}, + "You have '=item " . $para->[1]{'number'} . + "' instead of the expected '=item $expected_value'" + ); + $para->[1]{'number'} = $expected_value; # correcting!! + } + + if(@$para == 2) { + # For the cases where we /didn't/ push to @$para + if($paras->[0][0] eq '~Para') { + DEBUG and print STDERR "Assimilating following ~Para content into $over_type item\n"; + push @$para, splice @{shift @$paras},2; + } else { + DEBUG and print STDERR "Can't assimilate following ", $paras->[0][0], "\n"; + push @$para, ''; # Just so it's not contentless + } + } + + + } elsif($over_type eq 'bullet') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + if($item_type eq 'bullet') { + # as expected! + + if( $para->[1]{'~_freaky_para_hack'} ) { + DEBUG and print STDERR "Accomodating '=item * Foo' tolerance hack.\n"; + push @$para, $para->[1]{'~_freaky_para_hack'}; + } + + } elsif($item_type eq 'number') { + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item *'" + ); + push @$para, $para->[1]{'~orig_content'}; + # and block assimilation of the next paragraph + delete $para->[1]{'number'}; + # Only a PROPER item-number element is allowed + # to have a number attribute. + } elsif($item_type eq 'text') { + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item *'" + ); + # But doesn't need processing. But it'll block assimilation + # of the next para. + } else { + die "Unhandled item type $item_type"; # should never happen + } + + if(@$para == 2) { + # For the cases where we /didn't/ push to @$para + if($paras->[0][0] eq '~Para') { + DEBUG and print STDERR "Assimilating following ~Para content into $over_type item\n"; + push @$para, splice @{shift @$paras},2; + } else { + DEBUG and print STDERR "Can't assimilate following ", $paras->[0][0], "\n"; + push @$para, ''; # Just so it's not contentless + } + } + + } else { + die "Unhandled =over type \"$over_type\"?"; + # Shouldn't happen! + } + + $para_type = 'Plain'; + $para->[0] .= '-' . $over_type; + # Whew. Now fall thru and process it. + + + } elsif($para_type eq '=extend') { + # Well, might as well implement it here. + $self->_ponder_extend($para); + next; # and skip + } elsif($para_type eq '=encoding') { + # Not actually acted on here, but we catch errors here. + $self->_handle_encoding_second_level($para); + next unless $self->keep_encoding_directive; + $para_type = 'Plain'; + } elsif($para_type eq '~Verbatim') { + $para->[0] = 'Verbatim'; + $para_type = '?Verbatim'; + } elsif($para_type eq '~Para') { + $para->[0] = 'Para'; + $para_type = '?Plain'; + } elsif($para_type eq 'Data') { + $para->[0] = 'Data'; + $para_type = '?Data'; + } elsif( $para_type =~ s/^=//s + and defined( $para_type = $self->{'accept_directives'}{$para_type} ) + ) { + DEBUG > 1 and print STDERR " Pondering known directive ${$para}[0] as $para_type\n"; + } else { + # An unknown directive! + $seen_legal_directive--; + DEBUG > 1 and printf STDERR "Unhandled directive %s (Handled: %s)\n", + $para->[0], join(' ', sort keys %{$self->{'accept_directives'}} ) + ; + $self->whine( + $para->[1]{'start_line'}, + "Unknown directive: $para->[0]" + ); + + # And maybe treat it as text instead of just letting it go? + next; + } + + if($para_type =~ s/^\?//s) { + if(! @$curr_open) { # usual case + DEBUG and print STDERR "Treating $para_type paragraph as such because stack is empty.\n"; + } else { + my @fors = grep $_->[0] eq '=for', @$curr_open; + DEBUG > 1 and print STDERR "Containing fors: ", + join(',', map $_->[1]{'target'}, @fors), "\n"; + + if(! @fors) { + DEBUG and print STDERR "Treating $para_type paragraph as such because stack has no =for's\n"; + + #} elsif(grep $_->[1]{'~resolve'}, @fors) { + #} elsif(not grep !$_->[1]{'~resolve'}, @fors) { + } elsif( $fors[-1][1]{'~resolve'} ) { + # Look to the immediately containing for + + if($para_type eq 'Data') { + DEBUG and print STDERR "Treating Data paragraph as Plain/Verbatim because the containing =for ($fors[-1][1]{'target'}) is a resolver\n"; + $para->[0] = 'Para'; + $para_type = 'Plain'; + } else { + DEBUG and print STDERR "Treating $para_type paragraph as such because the containing =for ($fors[-1][1]{'target'}) is a resolver\n"; + } + } else { + DEBUG and print STDERR "Treating $para_type paragraph as Data because the containing =for ($fors[-1][1]{'target'}) is a non-resolver\n"; + $para->[0] = $para_type = 'Data'; + } + } + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if($para_type eq 'Plain') { + $self->_ponder_Plain($para); + } elsif($para_type eq 'Verbatim') { + $self->_ponder_Verbatim($para); + } elsif($para_type eq 'Data') { + $self->_ponder_Data($para); + } else { + die "\$para type is $para_type -- how did that happen?"; + # Shouldn't happen. + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + $para->[0] =~ s/^[~=]//s; + + DEBUG and print STDERR "\n", pretty($para), "\n"; + + # traverse the treelet (which might well be just one string scalar) + $self->{'content_seen'} ||= 1 if $seen_legal_directive + && ! $self->{'~tried_gen_errata'}; + $self->_traverse_treelet_bit(@$para); + } + } + + return; +} + +########################################################################### +# The sub-ponderers... + + + +sub _ponder_for { + my ($self,$para,$curr_open,$paras) = @_; + + # Fake it out as a begin/end + my $target; + + if(grep $_->[1]{'~ignore'}, @$curr_open) { + DEBUG > 1 and print STDERR "Ignoring ignorable =for\n"; + return 1; + } + + for(my $i = 2; $i < @$para; ++$i) { + if($para->[$i] =~ s/^\s*(\S+)\s*//s) { + $target = $1; + last; + } + } + unless(defined $target) { + $self->whine( + $para->[1]{'start_line'}, + "=for without a target?" + ); + return 1; + } + DEBUG > 1 and + print STDERR "Faking out a =for $target as a =begin $target / =end $target\n"; + + $para->[0] = 'Data'; + + unshift @$paras, + ['=begin', + {'start_line' => $para->[1]{'start_line'}, '~really' => '=for'}, + $target, + ], + $para, + ['=end', + {'start_line' => $para->[1]{'start_line'}, '~really' => '=for'}, + $target, + ], + ; + + return 1; +} + +sub _ponder_begin { + my ($self,$para,$curr_open,$paras) = @_; + my $content = join ' ', splice @$para, 2; + $content =~ s/^\s+//s; + $content =~ s/\s+$//s; + unless(length($content)) { + $self->whine( + $para->[1]{'start_line'}, + "=begin without a target?" + ); + DEBUG and print STDERR "Ignoring targetless =begin\n"; + return 1; + } + + my ($target, $title) = $content =~ m/^(\S+)\s*(.*)$/; + $para->[1]{'title'} = $title if ($title); + $para->[1]{'target'} = $target; # without any ':' + $content = $target; # strip off the title + + $content =~ s/^:!/!:/s; + my $neg; # whether this is a negation-match + $neg = 1 if $content =~ s/^!//s; + my $to_resolve; # whether to process formatting codes + $to_resolve = 1 if $content =~ s/^://s; + + my $dont_ignore; # whether this target matches us + + foreach my $target_name ( + split(',', $content, -1), + $neg ? () : '*' + ) { + DEBUG > 2 and + print STDERR " Considering whether =begin $content matches $target_name\n"; + next unless $self->{'accept_targets'}{$target_name}; + + DEBUG > 2 and + print STDERR " It DOES match the acceptable target $target_name!\n"; + $to_resolve = 1 + if $self->{'accept_targets'}{$target_name} eq 'force_resolve'; + $dont_ignore = 1; + $para->[1]{'target_matching'} = $target_name; + last; # stop looking at other target names + } + + if($neg) { + if( $dont_ignore ) { + $dont_ignore = ''; + delete $para->[1]{'target_matching'}; + DEBUG > 2 and print STDERR " But the leading ! means that this is a NON-match!\n"; + } else { + $dont_ignore = 1; + $para->[1]{'target_matching'} = '!'; + DEBUG > 2 and print STDERR " But the leading ! means that this IS a match!\n"; + } + } + + $para->[0] = '=for'; # Just what we happen to call these, internally + $para->[1]{'~really'} ||= '=begin'; + $para->[1]{'~ignore'} = (! $dont_ignore) || 0; + $para->[1]{'~resolve'} = $to_resolve || 0; + + DEBUG > 1 and print STDERR " Making note to ", $dont_ignore ? 'not ' : '', + "ignore contents of this region\n"; + DEBUG > 1 and $dont_ignore and print STDERR " Making note to treat contents as ", + ($to_resolve ? 'verbatim/plain' : 'data'), " paragraphs\n"; + DEBUG > 1 and print STDERR " (Stack now: ", $self->_dump_curr_open(), ")\n"; + + push @$curr_open, $para; + if(!$dont_ignore or scalar grep $_->[1]{'~ignore'}, @$curr_open) { + DEBUG > 1 and print STDERR "Ignoring ignorable =begin\n"; + } else { + $self->{'content_seen'} ||= 1 unless $self->{'~tried_gen_errata'}; + $self->_handle_element_start((my $scratch='for'), $para->[1]); + } + + return 1; +} + +sub _ponder_end { + my ($self,$para,$curr_open,$paras) = @_; + my $content = join ' ', splice @$para, 2; + $content =~ s/^\s+//s; + $content =~ s/\s+$//s; + DEBUG and print STDERR "Ogling '=end $content' directive\n"; + + unless(length($content)) { + $self->whine( + $para->[1]{'start_line'}, + "'=end' without a target?" . ( + ( @$curr_open and $curr_open->[-1][0] eq '=for' ) + ? ( " (Should be \"=end " . $curr_open->[-1][1]{'target'} . '")' ) + : '' + ) + ); + DEBUG and print STDERR "Ignoring targetless =end\n"; + return 1; + } + + unless($content =~ m/^\S+$/) { # i.e., unless it's one word + $self->whine( + $para->[1]{'start_line'}, + "'=end $content' is invalid. (Stack: " + . $self->_dump_curr_open() . ')' + ); + DEBUG and print STDERR "Ignoring mistargetted =end $content\n"; + return 1; + } + + unless(@$curr_open and $curr_open->[-1][0] eq '=for') { + $self->whine( + $para->[1]{'start_line'}, + "=end $content without matching =begin. (Stack: " + . $self->_dump_curr_open() . ')' + ); + DEBUG and print STDERR "Ignoring mistargetted =end $content\n"; + return 1; + } + + unless($content eq $curr_open->[-1][1]{'target'}) { + $self->whine( + $para->[1]{'start_line'}, + "=end $content doesn't match =begin " + . $curr_open->[-1][1]{'target'} + . ". (Stack: " + . $self->_dump_curr_open() . ')' + ); + DEBUG and print STDERR "Ignoring mistargetted =end $content at line $para->[1]{'start_line'}\n"; + return 1; + } + + # Else it's okay to close... + if(grep $_->[1]{'~ignore'}, @$curr_open) { + DEBUG > 1 and print STDERR "Not firing any event for this =end $content because in an ignored region\n"; + # And that may be because of this to-be-closed =for region, or some + # other one, but it doesn't matter. + } else { + $curr_open->[-1][1]{'start_line'} = $para->[1]{'start_line'}; + # what's that for? + + $self->{'content_seen'} ||= 1 unless $self->{'~tried_gen_errata'}; + $self->_handle_element_end( my $scratch = 'for', $para->[1]); + } + DEBUG > 1 and print STDERR "Popping $curr_open->[-1][0] $curr_open->[-1][1]{'target'} because of =end $content\n"; + pop @$curr_open; + + return 1; +} + +sub _ponder_doc_end { + my ($self,$para,$curr_open,$paras) = @_; + if(@$curr_open) { # Deal with things left open + DEBUG and print STDERR "Stack is nonempty at end-document: (", + $self->_dump_curr_open(), ")\n"; + + DEBUG > 9 and print STDERR "Stack: ", pretty($curr_open), "\n"; + unshift @$paras, $self->_closers_for_all_curr_open; + # Make sure there is exactly one ~end in the parastack, at the end: + @$paras = grep $_->[0] ne '~end', @$paras; + push @$paras, $para, $para; + # We need two -- once for the next cycle where we + # generate errata, and then another to be at the end + # when that loop back around to process the errata. + return 1; + + } else { + DEBUG and print STDERR "Okay, stack is empty now.\n"; + } + + # Try generating errata section, if applicable + unless($self->{'~tried_gen_errata'}) { + $self->{'~tried_gen_errata'} = 1; + my @extras = $self->_gen_errata(); + if(@extras) { + unshift @$paras, @extras; + DEBUG and print STDERR "Generated errata... relooping...\n"; + return 1; # I.e., loop around again to process these fake-o paragraphs + } + } + + splice @$paras; # Well, that's that for this paragraph buffer. + DEBUG and print STDERR "Throwing end-document event.\n"; + + $self->_handle_element_end( my $scratch = 'Document' ); + return 1; # Hasta la byebye +} + +sub _ponder_pod { + my ($self,$para,$curr_open,$paras) = @_; + $self->whine( + $para->[1]{'start_line'}, + "=pod directives shouldn't be over one line long! Ignoring all " + . (@$para - 2) . " lines of content" + ) if @$para > 3; + + # Content ignored unless 'pod_handler' is set + if (my $pod_handler = $self->{'pod_handler'}) { + my ($line_num, $line) = map $_, $para->[1]{'start_line'}, $para->[2]; + $line = $line eq '' ? "=pod" : "=pod $line"; # imitate cut_handler output + $pod_handler->($line, $line_num, $self); + } + + # The surrounding methods set content_seen, so let us remain consistent. + # I do not know why it was not here before -- should it not be here? + # $self->{'content_seen'} ||= 1 unless $self->{'~tried_gen_errata'}; + + return; +} + +sub _ponder_over { + my ($self,$para,$curr_open,$paras) = @_; + return 1 unless @$paras; + my $list_type; + + if($paras->[0][0] eq '=item') { # most common case + $list_type = $self->_get_initial_item_type($paras->[0]); + + } elsif($paras->[0][0] eq '=back') { + # Ignore empty lists by default + if ($self->{'parse_empty_lists'}) { + $list_type = 'empty'; + } else { + shift @$paras; + return 1; + } + } elsif($paras->[0][0] eq '~end') { + $self->whine( + $para->[1]{'start_line'}, + "=over is the last thing in the document?!" + ); + return 1; # But feh, ignore it. + } else { + $list_type = 'block'; + } + $para->[1]{'~type'} = $list_type; + push @$curr_open, $para; + # yes, we reuse the paragraph as a stack item + + my $content = join ' ', splice @$para, 2; + $para->[1]{'~orig_content'} = $content; + my $overness; + if($content =~ m/^\s*$/s) { + $para->[1]{'indent'} = 4; + } elsif($content =~ m/^\s*((?:\d*\.)?\d+)\s*$/s) { + no integer; + $para->[1]{'indent'} = $1; + if($1 == 0) { + $self->whine( + $para->[1]{'start_line'}, + "Can't have a 0 in =over $content" + ); + $para->[1]{'indent'} = 4; + } + } else { + $self->whine( + $para->[1]{'start_line'}, + "=over should be: '=over' or '=over positive_number'" + ); + $para->[1]{'indent'} = 4; + } + DEBUG > 1 and print STDERR "=over found of type $list_type\n"; + + $self->{'content_seen'} ||= 1 unless $self->{'~tried_gen_errata'}; + $self->_handle_element_start((my $scratch = 'over-' . $list_type), $para->[1]); + + return; +} + +sub _ponder_back { + my ($self,$para,$curr_open,$paras) = @_; + # TODO: fire off or or ?? + + my $content = join ' ', splice @$para, 2; + if($content =~ m/\S/) { + $self->whine( + $para->[1]{'start_line'}, + "=back doesn't take any parameters, but you said =back $content" + ); + } + + if(@$curr_open and $curr_open->[-1][0] eq '=over') { + DEBUG > 1 and print STDERR "=back happily closes matching =over\n"; + # Expected case: we're closing the most recently opened thing + #my $over = pop @$curr_open; + $self->{'content_seen'} ||= 1 unless $self->{'~tried_gen_errata'}; + $self->_handle_element_end( my $scratch = + 'over-' . ( (pop @$curr_open)->[1]{'~type'} ), $para->[1] + ); + } else { + DEBUG > 1 and print STDERR "=back found without a matching =over. Stack: (", + join(', ', map $_->[0], @$curr_open), ").\n"; + $self->whine( + $para->[1]{'start_line'}, + '=back without =over' + ); + return 1; # and ignore it + } +} + +sub _ponder_item { + my ($self,$para,$curr_open,$paras) = @_; + my $over; + unless(@$curr_open and + $over = (grep { $_->[0] eq '=over' } @$curr_open)[-1]) { + $self->whine( + $para->[1]{'start_line'}, + "'=item' outside of any '=over'" + ); + unshift @$paras, + ['=over', {'start_line' => $para->[1]{'start_line'}}, ''], + $para + ; + return 1; + } + + + my $over_type = $over->[1]{'~type'}; + + if(!$over_type) { + # Shouldn't happen1 + die "Typeless over in stack, starting at line " + . $over->[1]{'start_line'}; + + } elsif($over_type eq 'block') { + unless($curr_open->[-1][1]{'~bitched_about'}) { + $curr_open->[-1][1]{'~bitched_about'} = 1; + $self->whine( + $curr_open->[-1][1]{'start_line'}, + "You can't have =items (as at line " + . $para->[1]{'start_line'} + . ") unless the first thing after the =over is an =item" + ); + } + # Just turn it into a paragraph and reconsider it + $para->[0] = '~Para'; + unshift @$paras, $para; + return 1; + + } elsif($over_type eq 'text') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + if($item_type eq 'text') { + # Nothing special needs doing for 'text' + } elsif($item_type eq 'number' or $item_type eq 'bullet') { + $self->whine( + $para->[1]{'start_line'}, + "Expected text after =item, not a $item_type" + ); + # Undo our clobbering: + push @$para, $para->[1]{'~orig_content'}; + delete $para->[1]{'number'}; + # Only a PROPER item-number element is allowed + # to have a number attribute. + } else { + die "Unhandled item type $item_type"; # should never happen + } + + # =item-text thingies don't need any assimilation, it seems. + + } elsif($over_type eq 'number') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + my $expected_value = ++ $curr_open->[-1][1]{'~counter'}; + + if($item_type eq 'bullet') { + # Hm, it's not numeric. Correct for this. + $para->[1]{'number'} = $expected_value; + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item $expected_value'" + ); + push @$para, $para->[1]{'~orig_content'}; + # restore the bullet, blocking the assimilation of next para + + } elsif($item_type eq 'text') { + # Hm, it's not numeric. Correct for this. + $para->[1]{'number'} = $expected_value; + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item $expected_value'" + ); + # Text content will still be there and will block next ~Para + + } elsif($item_type ne 'number') { + die "Unknown item type $item_type"; # should never happen + + } elsif($expected_value == $para->[1]{'number'}) { + DEBUG > 1 and print STDERR " Numeric item has the expected value of $expected_value\n"; + + } else { + DEBUG > 1 and print STDERR " Numeric item has ", $para->[1]{'number'}, + " instead of the expected value of $expected_value\n"; + $self->whine( + $para->[1]{'start_line'}, + "You have '=item " . $para->[1]{'number'} . + "' instead of the expected '=item $expected_value'" + ); + $para->[1]{'number'} = $expected_value; # correcting!! + } + + if(@$para == 2) { + # For the cases where we /didn't/ push to @$para + if($paras->[0][0] eq '~Para') { + DEBUG and print STDERR "Assimilating following ~Para content into $over_type item\n"; + push @$para, splice @{shift @$paras},2; + } else { + DEBUG and print STDERR "Can't assimilate following ", $paras->[0][0], "\n"; + push @$para, ''; # Just so it's not contentless + } + } + + + } elsif($over_type eq 'bullet') { + my $item_type = $self->_get_item_type($para); + # That kills the content of the item if it's a number or bullet. + DEBUG and print STDERR " Item is of type ", $para->[0], " under $over_type\n"; + + if($item_type eq 'bullet') { + # as expected! + + if( $para->[1]{'~_freaky_para_hack'} ) { + DEBUG and print STDERR "Accomodating '=item * Foo' tolerance hack.\n"; + push @$para, $para->[1]{'~_freaky_para_hack'}; + } + + } elsif($item_type eq 'number') { + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item *'" + ); + push @$para, $para->[1]{'~orig_content'}; + # and block assimilation of the next paragraph + delete $para->[1]{'number'}; + # Only a PROPER item-number element is allowed + # to have a number attribute. + } elsif($item_type eq 'text') { + $self->whine( + $para->[1]{'start_line'}, + "Expected '=item *'" + ); + # But doesn't need processing. But it'll block assimilation + # of the next para. + } else { + die "Unhandled item type $item_type"; # should never happen + } + + if(@$para == 2) { + # For the cases where we /didn't/ push to @$para + if($paras->[0][0] eq '~Para') { + DEBUG and print STDERR "Assimilating following ~Para content into $over_type item\n"; + push @$para, splice @{shift @$paras},2; + } else { + DEBUG and print STDERR "Can't assimilate following ", $paras->[0][0], "\n"; + push @$para, ''; # Just so it's not contentless + } + } + + } else { + die "Unhandled =over type \"$over_type\"?"; + # Shouldn't happen! + } + $para->[0] .= '-' . $over_type; + + return; +} + +sub _ponder_Plain { + my ($self,$para) = @_; + DEBUG and print STDERR " giving plain treatment...\n"; + unless( @$para == 2 or ( @$para == 3 and $para->[2] eq '' ) + or $para->[1]{'~cooked'} + ) { + push @$para, + @{$self->_make_treelet( + join("\n", splice(@$para, 2)), + $para->[1]{'start_line'} + )}; + } + # Empty paragraphs don't need a treelet for any reason I can see. + # And precooked paragraphs already have a treelet. + return; +} + +sub _ponder_Verbatim { + my ($self,$para) = @_; + DEBUG and print STDERR " giving verbatim treatment...\n"; + + $para->[1]{'xml:space'} = 'preserve'; + + unless ($self->{'_output_is_for_JustPod'}) { + # Fix illegal settings for expand_verbatim_tabs() + # This is because this module doesn't do input error checking, but khw + # doesn't want to add yet another instance of that. + $self->expand_verbatim_tabs(8) + if ! defined $self->expand_verbatim_tabs() + || $self->expand_verbatim_tabs() =~ /\D/; + + my $indent = $self->strip_verbatim_indent; + if ($indent && ref $indent eq 'CODE') { + my @shifted = (shift @{$para}, shift @{$para}); + $indent = $indent->($para); + unshift @{$para}, @shifted; + } + + for(my $i = 2; $i < @$para; $i++) { + foreach my $line ($para->[$i]) { # just for aliasing + # Strip indentation. + $line =~ s/^\Q$indent// if $indent; + next unless $self->expand_verbatim_tabs; + + # This is commented out because of github issue #85, and the + # current maintainers don't know why it was there in the first + # place. + #&& !($self->{accept_codes} && $self->{accept_codes}{VerbatimFormatted}); + while( $line =~ + # Sort of adapted from Text::Tabs. + s/^([^\t]*)(\t+)/$1.(" " x ((length($2) + * $self->expand_verbatim_tabs) + -(length($1)&7)))/e + ) {} + + # TODO: whinge about (or otherwise treat) unindented or overlong lines + + } + } + } + + # Now the VerbatimFormatted hoodoo... + if( $self->{'accept_codes'} and + $self->{'accept_codes'}{'VerbatimFormatted'} + ) { + while(@$para > 3 and $para->[-1] !~ m/\S/) { pop @$para } + # Kill any number of terminal newlines + $self->_verbatim_format($para); + } elsif ($self->{'codes_in_verbatim'}) { + push @$para, + @{$self->_make_treelet( + join("\n", splice(@$para, 2)), + $para->[1]{'start_line'}, $para->[1]{'xml:space'} + )}; + $para->[-1] =~ s/\n+$//s; # Kill any number of terminal newlines + } else { + push @$para, join "\n", splice(@$para, 2) if @$para > 3; + $para->[-1] =~ s/\n+$//s; # Kill any number of terminal newlines + } + return; +} + +sub _ponder_Data { + my ($self,$para) = @_; + DEBUG and print STDERR " giving data treatment...\n"; + $para->[1]{'xml:space'} = 'preserve'; + push @$para, join "\n", splice(@$para, 2) if @$para > 3; + return; +} + + + + +########################################################################### + +sub _traverse_treelet_bit { # for use only by the routine above + my($self, $name) = splice @_,0,2; + + my $scratch; + $self->_handle_element_start(($scratch=$name), shift @_); + + while (@_) { + my $x = shift; + if (ref($x)) { + &_traverse_treelet_bit($self, @$x); + } else { + $x .= shift while @_ && !ref($_[0]); + $self->_handle_text($x); + } + } + + $self->_handle_element_end($scratch=$name); + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _closers_for_all_curr_open { + my $self = $_[0]; + my @closers; + foreach my $still_open (@{ $self->{'curr_open'} || return }) { + my @copy = @$still_open; + $copy[1] = {%{ $copy[1] }}; + #$copy[1]{'start_line'} = -1; + if($copy[0] eq '=for') { + $copy[0] = '=end'; + } elsif($copy[0] eq '=over') { + $self->whine( + $still_open->[1]{start_line} , + "=over without closing =back" + ); + + $copy[0] = '=back'; + } else { + die "I don't know how to auto-close an open $copy[0] region"; + } + + unless( @copy > 2 ) { + push @copy, $copy[1]{'target'}; + $copy[-1] = '' unless defined $copy[-1]; + # since =over's don't have targets + } + + $copy[1]{'fake-closer'} = 1; + + DEBUG and print STDERR "Queuing up fake-o event: ", pretty(\@copy), "\n"; + unshift @closers, \@copy; + } + return @closers; +} + +#-------------------------------------------------------------------------- + +sub _verbatim_format { + my($it, $p) = @_; + + my $formatting; + + for(my $i = 2; $i < @$p; $i++) { # work backwards over the lines + DEBUG and print STDERR "_verbatim_format appends a newline to $i: $p->[$i]\n"; + $p->[$i] .= "\n"; + # Unlike with simple Verbatim blocks, we don't end up just doing + # a join("\n", ...) on the contents, so we have to append a + # newline to every line, and then nix the last one later. + } + + if( DEBUG > 4 ) { + print STDERR "<<\n"; + for(my $i = $#$p; $i >= 2; $i--) { # work backwards over the lines + print STDERR "_verbatim_format $i: $p->[$i]"; + } + print STDERR ">>\n"; + } + + for(my $i = $#$p; $i > 2; $i--) { + # work backwards over the lines, except the first (#2) + + #next unless $p->[$i] =~ m{^#:([ \^\/\%]*)\n?$}s + # and $p->[$i-1] !~ m{^#:[ \^\/\%]*\n?$}s; + # look at a formatty line preceding a nonformatty one + DEBUG > 5 and print STDERR "Scrutinizing line $i: $$p[$i]\n"; + if($p->[$i] =~ m{^#:([ \^\/\%]*)\n?$}s) { + DEBUG > 5 and print STDERR " It's a formatty line. ", + "Peeking at previous line ", $i-1, ": $$p[$i-1]: \n"; + + if( $p->[$i-1] =~ m{^#:[ \^\/\%]*\n?$}s ) { + DEBUG > 5 and print STDERR " Previous line is formatty! Skipping this one.\n"; + next; + } else { + DEBUG > 5 and print STDERR " Previous line is non-formatty! Yay!\n"; + } + } else { + DEBUG > 5 and print STDERR " It's not a formatty line. Ignoring\n"; + next; + } + + # A formatty line has to have #: in the first two columns, and uses + # "^" to mean bold, "/" to mean underline, and "%" to mean bold italic. + # Example: + # What do you want? i like pie. [or whatever] + # #:^^^^^^^^^^^^^^^^^ ///////////// + + + DEBUG > 4 and print STDERR "_verbatim_format considers:\n<$p->[$i-1]>\n<$p->[$i]>\n"; + + $formatting = ' ' . $1; + $formatting =~ s/\s+$//s; # nix trailing whitespace + unless(length $formatting and $p->[$i-1] =~ m/\S/) { # no-op + splice @$p,$i,1; # remove this line + $i--; # don't consider next line + next; + } + + if( length($formatting) >= length($p->[$i-1]) ) { + $formatting = substr($formatting, 0, length($p->[$i-1]) - 1) . ' '; + } else { + $formatting .= ' ' x (length($p->[$i-1]) - length($formatting)); + } + # Make $formatting and the previous line be exactly the same length, + # with $formatting having a " " as the last character. + + DEBUG > 4 and print STDERR "Formatting <$formatting> on <", $p->[$i-1], ">\n"; + + + my @new_line; + while( $formatting =~ m{\G(( +)|(\^+)|(\/+)|(\%+))}g ) { + #print STDERR "Format matches $1\n"; + + if($2) { + #print STDERR "SKIPPING <$2>\n"; + push @new_line, + substr($p->[$i-1], pos($formatting)-length($1), length($1)); + } else { + #print STDERR "SNARING $+\n"; + push @new_line, [ + ( + $3 ? 'VerbatimB' : + $4 ? 'VerbatimI' : + $5 ? 'VerbatimBI' : die("Should never get called") + ), {}, + substr($p->[$i-1], pos($formatting)-length($1), length($1)) + ]; + #print STDERR "Formatting <$new_line[-1][-1]> as $new_line[-1][0]\n"; + } + } + my @nixed = + splice @$p, $i-1, 2, @new_line; # replace myself and the next line + DEBUG > 10 and print STDERR "Nixed count: ", scalar(@nixed), "\n"; + + DEBUG > 6 and print STDERR "New version of the above line is these tokens (", + scalar(@new_line), "):", + map( ref($_)?"<@$_> ":"<$_>", @new_line ), "\n"; + $i--; # So the next line we scrutinize is the line before the one + # that we just went and formatted + } + + $p->[0] = 'VerbatimFormatted'; + + # Collapse adjacent text nodes, just for kicks. + for( my $i = 2; $i > $#$p; $i++ ) { # work forwards over the tokens except for the last + if( !ref($p->[$i]) and !ref($p->[$i + 1]) ) { + DEBUG > 5 and print STDERR "_verbatim_format merges {$p->[$i]} and {$p->[$i+1]}\n"; + $p->[$i] .= splice @$p, $i+1, 1; # merge + --$i; # and back up + } + } + + # Now look for the last text token, and remove the terminal newline + for( my $i = $#$p; $i >= 2; $i-- ) { + # work backwards over the tokens, even the first + if( !ref($p->[$i]) ) { + if($p->[$i] =~ s/\n$//s) { + DEBUG > 5 and print STDERR "_verbatim_format killed the terminal newline on #$i: {$p->[$i]}, after {$p->[$i-1]}\n"; + } else { + DEBUG > 5 and print STDERR + "No terminal newline on #$i: {$p->[$i]}, after {$p->[$i-1]} !?\n"; + } + last; # we only want the next one + } + } + + return; +} + + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + +sub _treelet_from_formatting_codes { + # Given a paragraph, returns a treelet. Full of scary tokenizing code. + # Like [ '~Top', {'start_line' => $start_line}, + # "I like ", + # [ 'B', {}, "pie" ], + # "!" + # ] + # This illustrates the general format of a treelet. It is an array: + # [0] is a scalar indicating its type. In the example above, the + # types are '~Top' and 'B' + # [1] is a hash of various flags about it, possibly empty + # [2] - [N] are an ordered list of the subcomponents of the treelet. + # Scalars are literal text, refs are sub-treelets, to + # arbitrary levels. Stringifying a treelet will recursively + # stringify the sub-treelets, concatentating everything + # together to form the exact text of the treelet. + + my($self, $para, $start_line, $preserve_space) = @_; + + my $treelet = ['~Top', {'start_line' => $start_line},]; + + unless ($preserve_space || $self->{'preserve_whitespace'}) { + $para =~ s/\s+/ /g; # collapse and trim all whitespace first. + $para =~ s/ $//; + $para =~ s/^ //; + } + + # Only apparent problem the above code is that N<< >> turns into + # N<< >>. But then, word wrapping does that too! So don't do that! + + + # As a Start-code is encountered, the number of opening bracket '<' + # characters minus 1 is pushed onto @stack (so 0 means a single bracket, + # etc). When closing brackets are found in the text, at least this number + # (plus the 1) will be required to mean the Start-code is terminated. When + # those are found, @stack is popped. + my @stack; + + my @lineage = ($treelet); + my $raw = ''; # raw content of L<> fcode before splitting/processing + # XXX 'raw' is not 100% accurate: all surrounding whitespace is condensed + # into just 1 ' '. Is this the regex's doing or 'raw's? Answer is it's + # the 'collapse and trim all whitespace first' lines just above. + my $inL = 0; + + DEBUG > 4 and print STDERR "Paragraph:\n$para\n\n"; + + # Here begins our frightening tokenizer RE. The following regex matches + # text in four main parts: + # + # * Start-codes. The first alternative matches C< or C<<, the latter + # followed by some whitespace. $1 will hold the entire start code + # (including any space following a multiple-angle-bracket delimiter), + # and $2 will hold only the additional brackets past the first in a + # multiple-bracket delimiter. length($2) + 1 will be the number of + # closing brackets we have to find. + # + # * Closing brackets. Match some amount of whitespace followed by + # multiple close brackets. The logic to see if this closes anything + # is down below. Note that in order to parse C<< >> correctly, we + # have to use look-behind (?<=\s\s), since the match of the starting + # code will have consumed the whitespace. + # + # * A single closing bracket, to close a simple code like C<>. + # + # * Something that isn't a start or end code. We have to be careful + # about accepting whitespace, since perlpodspec says that any whitespace + # before a multiple-bracket closing delimiter should be ignored. + # + while($para =~ + m/\G + (?: + # Match starting codes, including the whitespace following a + # multiple-delimiter start code. $1 gets the whole start code and + # $2 gets all but one of the >, and all the white-space has been + # gobbled up already, considered to be space after the opening + # bracket. In this case we use look-behind to verify that there are + # at least 2 spaces in a row before the ">".) + (\s+|(?<=\s\s))(>{2,}) + | + (\s?>) # $5: simple end-codes + | + ( # $6: stuff containing no start-codes or end-codes + (?: + [^A-Z\s>] + | + (?: + [A-Z](?!<) + ) + | + # whitespace is ok, but we don't want to eat the whitespace before + # a multiple-bracket end code. + # NOTE: we may still have problems with e.g. S<< >> + (?: + \s(?!\s*>{2,}) + ) + )+ + ) + ) + /xgo + ) { + DEBUG > 4 and print STDERR "\nParagraphic tokenstack = (@stack)\n"; + if(defined $1) { + my $bracket_count; # How many '<<<' in a row this has. Needed for + # Pod::Simple::JustPod + if(defined $2) { + DEBUG > 3 and print STDERR "Found complex start-text code \"$1\"\n"; + $bracket_count = length($2) + 1; + push @stack, $bracket_count; # length of the necessary complex + # end-code string + } else { + DEBUG > 3 and print STDERR "Found simple start-text code \"$1\"\n"; + push @stack, 0; # signal that we're looking for simple + $bracket_count = 1; + } + my $code = substr($1,0,1); + if ('L' eq $code) { + if ($inL) { + $raw .= $1; + $self->scream( $start_line, + 'Nested L<> are illegal. Pretending inner one is ' + . 'X<...> so can continue looking for other errors.'); + $code = "X"; + } + else { + $raw = ""; # reset raw content accumulator + $inL = @stack; + } + } else { + $raw .= $1 if $inL; + } + push @lineage, [ $code, {}, ]; # new node object + + # Tell Pod::Simple::JustPod how many brackets there were, but to save + # space, not in the most usual case of there was just 1. It can be + # inferred by the absence of this element. Similarly, if there is more + # than one bracket, extract the white space between the final bracket + # and the real beginning of the interior. Save that if it isn't just a + # single space + if ($self->{'_output_is_for_JustPod'} && $bracket_count > 1) { + $lineage[-1][1]{'~bracket_count'} = $bracket_count; + my $lspacer = substr($1, 1 + $bracket_count); + $lineage[-1][1]{'~lspacer'} = $lspacer if $lspacer ne " "; + } + push @{ $lineage[-2] }, $lineage[-1]; + } elsif(defined $4) { + DEBUG > 3 and print STDERR "Found apparent complex end-text code \"$3$4\"\n"; + # This is where it gets messy... + if(! @stack) { + # We saw " >>>>" but needed nothing. This is ALL just stuff then. + DEBUG > 4 and print STDERR " But it's really just stuff.\n"; + push @{ $lineage[-1] }, $3, $4; + next; + } elsif(!$stack[-1]) { + # We saw " >>>>" but needed only ">". Back pos up. + DEBUG > 4 and print STDERR " And that's more than we needed to close simple.\n"; + push @{ $lineage[-1] }, $3; # That was a for-real space, too. + pos($para) = pos($para) - length($4) + 1; + } elsif($stack[-1] == length($4)) { + # We found " >>>>", and it was exactly what we needed. Commonest case. + DEBUG > 4 and print STDERR " And that's exactly what we needed to close complex.\n"; + } elsif($stack[-1] < length($4)) { + # We saw " >>>>" but needed only " >>". Back pos up. + DEBUG > 4 and print STDERR " And that's more than we needed to close complex.\n"; + pos($para) = pos($para) - length($4) + $stack[-1]; + } else { + # We saw " >>>>" but needed " >>>>>>". So this is all just stuff! + DEBUG > 4 and print STDERR " But it's really just stuff, because we needed more.\n"; + push @{ $lineage[-1] }, $3, $4; + next; + } + #print STDERR "\nHOOBOY ", scalar(@{$lineage[-1]}), "!!!\n"; + + if ($3 ne " " && $self->{'_output_is_for_JustPod'}) { + if ($3 ne "") { + $lineage[-1][1]{'~rspacer'} = $3; + } + elsif ($lineage[-1][1]{'~lspacer'} eq " ") { + + # Here we had something like C<< >> which was a false positive + delete $lineage[-1][1]{'~lspacer'}; + } + else { + $lineage[-1][1]{'~rspacer'} + = substr($lineage[-1][1]{'~lspacer'}, -1, 1); + chop $lineage[-1][1]{'~lspacer'}; + } + } + + push @{ $lineage[-1] }, '' if 2 == @{ $lineage[-1] }; + # Keep the element from being childless + + if ($inL == @stack) { + $lineage[-1][1]{'raw'} = $raw; + $inL = 0; + } + + pop @stack; + pop @lineage; + + $raw .= $3.$4 if $inL; + + } elsif(defined $5) { + DEBUG > 3 and print STDERR "Found apparent simple end-text code \"$5\"\n"; + + if(@stack and ! $stack[-1]) { + # We're indeed expecting a simple end-code + DEBUG > 4 and print STDERR " It's indeed an end-code.\n"; + + if(length($5) == 2) { # There was a space there: " >" + push @{ $lineage[-1] }, ' '; + } elsif( 2 == @{ $lineage[-1] } ) { # Closing a childless element + push @{ $lineage[-1] }, ''; # keep it from being really childless + } + + if ($inL == @stack) { + $lineage[-1][1]{'raw'} = $raw; + $inL = 0; + } + + pop @stack; + pop @lineage; + } else { + DEBUG > 4 and print STDERR " It's just stuff.\n"; + push @{ $lineage[-1] }, $5; + } + + $raw .= $5 if $inL; + + } elsif(defined $6) { + DEBUG > 3 and print STDERR "Found stuff \"$6\"\n"; + push @{ $lineage[-1] }, $6; + $raw .= $6 if $inL; + # XXX does not capture multiplace whitespaces -- 'raw' ends up with + # at most 1 leading/trailing whitespace, why not all of it? + # Answer, because we deliberately trimmed it above + + } else { + # should never ever ever ever happen + DEBUG and print STDERR "AYYAYAAAAA at line ", __LINE__, "\n"; + die "SPORK 512512!"; + } + } + + if(@stack) { # Uhoh, some sequences weren't closed. + my $x= "..."; + while(@stack) { + push @{ $lineage[-1] }, '' if 2 == @{ $lineage[-1] }; + # Hmmmmm! + + my $code = (pop @lineage)->[0]; + my $ender_length = pop @stack; + if($ender_length) { + --$ender_length; + $x = $code . ("<" x $ender_length) . " $x " . (">" x $ender_length); + } else { + $x = $code . "<$x>"; + } + } + DEBUG > 1 and print STDERR "Unterminated $x sequence\n"; + $self->whine($start_line, + "Unterminated $x sequence", + ); + } + + return $treelet; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub text_content_of_treelet { # method: $parser->text_content_of_treelet($lol) + return stringify_lol($_[1]); +} + +sub stringify_lol { # function: stringify_lol($lol) + my $string_form = ''; + _stringify_lol( $_[0] => \$string_form ); + return $string_form; +} + +sub _stringify_lol { # the real recursor + my($lol, $to) = @_; + for(my $i = 2; $i < @$lol; ++$i) { + if( ref($lol->[$i] || '') and UNIVERSAL::isa($lol->[$i], 'ARRAY') ) { + _stringify_lol( $lol->[$i], $to); # recurse! + } else { + $$to .= $lol->[$i]; + } + } + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _dump_curr_open { # return a string representation of the stack + my $curr_open = $_[0]{'curr_open'}; + + return '[empty]' unless @$curr_open; + return join '; ', + map {; + ($_->[0] eq '=for') + ? ( ($_->[1]{'~really'} || '=over') + . ' ' . $_->[1]{'target'}) + : $_->[0] + } + @$curr_open + ; +} + +########################################################################### +my %pretty_form = ( + "\a" => '\a', # ding! + "\b" => '\b', # BS + "\e" => '\e', # ESC + "\f" => '\f', # FF + "\t" => '\t', # tab + "\cm" => '\cm', + "\cj" => '\cj', + "\n" => '\n', # probably overrides one of either \cm or \cj + '"' => '\"', + '\\' => '\\\\', + '$' => '\\$', + '@' => '\\@', + '%' => '\\%', + '#' => '\\#', +); + +sub pretty { # adopted from Class::Classless + # Not the most brilliant routine, but passable. + # Don't give it a cyclic data structure! + my @stuff = @_; # copy + my $x; + my $out = + # join ",\n" . + join ", ", + map {; + if(!defined($_)) { + "undef"; + } elsif(ref($_) eq 'ARRAY' or ref($_) eq 'Pod::Simple::LinkSection') { + $x = "[ " . pretty(@$_) . " ]" ; + $x; + } elsif(ref($_) eq 'SCALAR') { + $x = "\\" . pretty($$_) ; + $x; + } elsif(ref($_) eq 'HASH') { + my $hr = $_; + $x = "{" . join(", ", + map(pretty($_) . '=>' . pretty($hr->{$_}), + sort keys %$hr ) ) . "}" ; + $x; + } elsif(!length($_)) { q{''} # empty string + } elsif( + $_ eq '0' # very common case + or( + m/^-?(?:[123456789]\d*|0)(?:\.\d+)?$/s + and $_ ne '-0' # the strange case that RE lets thru + ) + ) { $_; + } else { + # Yes, explicitly name every character desired. There are shorcuts one + # could make, but I (Karl Williamson) was afraid that some Perl + # releases would have bugs in some of them. For example [A-Z] works + # even on EBCDIC platforms to match exactly the 26 uppercase English + # letters, but I don't know if it has always worked without bugs. It + # seemed safest just to list the characters. + # s<([^\x20\x21\x23\x27-\x3F\x41-\x5B\x5D-\x7E])> + s<([^ !"#'()*+,\-./0123456789:;\<=\>?ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]^_`abcdefghijklmnopqrstuvwxyz{|}~])> + <$pretty_form{$1} || '\\x{'.sprintf("%x", ord($1)).'}'>eg; + #<$pretty_form{$1} || '\\x'.(unpack("H2",$1))>eg; + qq{"$_"}; + } + } @stuff; + # $out =~ s/\n */ /g if length($out) < 75; + return $out; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +# A rather unsubtle method of blowing away all the state information +# from a parser object so it can be reused. Provided as a utility for +# backward compatibility in Pod::Man, etc. but not recommended for +# general use. + +sub reinit { + my $self = shift; + foreach (qw(source_dead source_filename doc_has_started +start_of_pod_block content_seen last_was_blank paras curr_open +line_count pod_para_count in_pod ~tried_gen_errata all_errata errata errors_seen +Title)) { + + delete $self->{$_}; + } +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +1; + diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Checker.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Checker.pm new file mode 100644 index 0000000000000000000000000000000000000000..2fef0305a5c11576fd9461ca93324a546a81119f --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Checker.pm @@ -0,0 +1,196 @@ + +# A quite dimwitted pod2plaintext that need only know how to format whatever +# text comes out of Pod::BlackBox's _gen_errata + +require 5; +package Pod::Simple::Checker; +use strict; +use Carp (); +use Pod::Simple::Methody (); +use Pod::Simple (); +use vars qw( @ISA $VERSION ); +$VERSION = '3.40'; +@ISA = ('Pod::Simple::Methody'); +BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG) + ? \&Pod::Simple::DEBUG + : sub() {0} + } + +use Text::Wrap 98.112902 (); # was 2001.0131, but I don't think we need that +$Text::Wrap::wrap = 'overflow'; +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub any_errata_seen { # read-only accessor + return $_[1]->{'Errata_seen'}; +} + +sub new { + my $self = shift; + my $new = $self->SUPER::new(@_); + $new->{'output_fh'} ||= *STDOUT{IO}; + $new->nix_X_codes(1); + $new->nbsp_for_S(1); + $new->{'Thispara'} = ''; + $new->{'Indent'} = 0; + $new->{'Indentstring'} = ' '; + $new->{'Errata_seen'} = 0; + return $new; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub handle_text { $_[0]{'Errata_seen'} and $_[0]{'Thispara'} .= $_[1] } + +sub start_Para { $_[0]{'Thispara'} = '' } + +sub start_head1 { + if($_[0]{'Errata_seen'}) { + $_[0]{'Thispara'} = ''; + } else { + if($_[1]{'errata'}) { # start of errata! + $_[0]{'Errata_seen'} = 1; + $_[0]{'Thispara'} = $_[0]{'source_filename'} ? + "$_[0]{'source_filename'} -- " : '' + } + } +} +sub start_head2 { $_[0]{'Thispara'} = '' } +sub start_head3 { $_[0]{'Thispara'} = '' } +sub start_head4 { $_[0]{'Thispara'} = '' } + +sub start_Verbatim { $_[0]{'Thispara'} = '' } +sub start_item_bullet { $_[0]{'Thispara'} = '* ' } +sub start_item_number { $_[0]{'Thispara'} = "$_[1]{'number'}. " } +sub start_item_text { $_[0]{'Thispara'} = '' } + +sub start_over_bullet { ++$_[0]{'Indent'} } +sub start_over_number { ++$_[0]{'Indent'} } +sub start_over_text { ++$_[0]{'Indent'} } +sub start_over_block { ++$_[0]{'Indent'} } + +sub end_over_bullet { --$_[0]{'Indent'} } +sub end_over_number { --$_[0]{'Indent'} } +sub end_over_text { --$_[0]{'Indent'} } +sub end_over_block { --$_[0]{'Indent'} } + + +# . . . . . Now the actual formatters: + +sub end_head1 { $_[0]->emit_par(-4) } +sub end_head2 { $_[0]->emit_par(-3) } +sub end_head3 { $_[0]->emit_par(-2) } +sub end_head4 { $_[0]->emit_par(-1) } +sub end_Para { $_[0]->emit_par( 0) } +sub end_item_bullet { $_[0]->emit_par( 0) } +sub end_item_number { $_[0]->emit_par( 0) } +sub end_item_text { $_[0]->emit_par(-2) } + +sub emit_par { + return unless $_[0]{'Errata_seen'}; + my($self, $tweak_indent) = splice(@_,0,2); + my $length = 2 * $self->{'Indent'} + ($tweak_indent||0); + my $indent = ' ' x ($length > 0 ? $length : 0); + # Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 + # 'Negative repeat count does nothing' since 5.22 + + $self->{'Thispara'} =~ s/$Pod::Simple::shy//g; + my $out = Text::Wrap::wrap($indent, $indent, $self->{'Thispara'} .= "\n"); + $out =~ s/$Pod::Simple::nbsp/ /g; + print {$self->{'output_fh'}} $out, + #"\n" + ; + $self->{'Thispara'} = ''; + + return; +} + +# . . . . . . . . . . And then off by its lonesome: + +sub end_Verbatim { + return unless $_[0]{'Errata_seen'}; + my $self = shift; + $self->{'Thispara'} =~ s/$Pod::Simple::nbsp/ /g; + $self->{'Thispara'} =~ s/$Pod::Simple::shy//g; + + my $i = ' ' x ( 2 * $self->{'Indent'} + 4); + + $self->{'Thispara'} =~ s/^/$i/mg; + + print { $self->{'output_fh'} } '', + $self->{'Thispara'}, + "\n\n" + ; + $self->{'Thispara'} = ''; + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +1; + +__END__ + +=head1 NAME + +Pod::Simple::Checker -- check the Pod syntax of a document + +=head1 SYNOPSIS + + perl -MPod::Simple::Checker -e \ + "exit Pod::Simple::Checker->filter(shift)->any_errata_seen" \ + thingy.pod + +=head1 DESCRIPTION + +This class is for checking the syntactic validity of Pod. +It works by basically acting like a simple-minded version of +L that formats only the "Pod Errors" section +(if Pod::Simple even generates one for the given document). + +This is a subclass of L and inherits all its methods. + +=head1 SEE ALSO + +L, L, L + +=head1 SUPPORT + +Questions or discussion about POD and Pod::Simple should be sent to the +pod-people@perl.org mail list. Send an empty email to +pod-people-subscribe@perl.org to subscribe. + +This module is managed in an open GitHub repository, +L. Feel free to fork and contribute, or +to clone L and send patches! + +Patches against Pod::Simple are welcome. Please send bug reports to +. + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Pod::Simple was created by Sean M. Burke . +But don't bother him, he's retired. + +Pod::Simple is maintained by: + +=over + +=item * Allison Randal C + +=item * Hans Dieter Pearcey C + +=item * David E. Wheeler C + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Debug.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Debug.pm new file mode 100644 index 0000000000000000000000000000000000000000..aaa5a887e6bee52fe87210ffcb97c199d886044a --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/Debug.pm @@ -0,0 +1,177 @@ +require 5; +package Pod::Simple::Debug; +use strict; +use vars qw($VERSION ); +$VERSION = '3.40'; + +sub import { + my($value,$variable); + + if(@_ == 2) { + $value = $_[1]; + } elsif(@_ == 3) { + ($variable, $value) = @_[1,2]; + + ($variable, $value) = ($value, $variable) + if defined $value and ref($value) eq 'SCALAR' + and not(defined $variable and ref($variable) eq 'SCALAR') + ; # tolerate getting it backwards + + unless( defined $variable and ref($variable) eq 'SCALAR') { + require Carp; + Carp::croak("Usage:\n use Pod::Simple::Debug (NUMVAL)\nor" + . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); + } + } else { + require Carp; + Carp::croak("Usage:\n use Pod::Simple::Debug (NUMVAL)\nor" + . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); + } + + if( defined &Pod::Simple::DEBUG ) { + require Carp; + Carp::croak("It's too late to call Pod::Simple::Debug -- " + . "Pod::Simple has already loaded\nAborting"); + } + + $value = 0 unless defined $value; + + unless($value =~ m/^-?\d+$/) { + require Carp; + Carp::croak( "$value isn't a numeric value." + . "\nUsage:\n use Pod::Simple::Debug (NUMVAL)\nor" + . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); + } + + if( defined $variable ) { + # make a not-really-constant + *Pod::Simple::DEBUG = sub () { $$variable } ; + $$variable = $value; + print STDERR "# Starting Pod::Simple::DEBUG = non-constant $variable with val $value\n"; + } else { + *Pod::Simple::DEBUG = eval " sub () { $value } "; + print STDERR "# Starting Pod::Simple::DEBUG = $value\n"; + } + + require Pod::Simple; + return; +} + +1; + + +__END__ + +=head1 NAME + +Pod::Simple::Debug -- put Pod::Simple into trace/debug mode + +=head1 SYNOPSIS + + use Pod::Simple::Debug (5); # or some integer + +Or: + + my $debuglevel; + use Pod::Simple::Debug (\$debuglevel, 0); + ...some stuff that uses Pod::Simple to do stuff, but which + you don't want debug output from... + + $debug_level = 4; + ...some stuff that uses Pod::Simple to do stuff, but which + you DO want debug output from... + + $debug_level = 0; + +=head1 DESCRIPTION + +This is an internal module for controlling the debug level (a.k.a. trace +level) of Pod::Simple. This is of interest only to Pod::Simple +developers. + + +=head1 CAVEATS + +Note that you should load this module I loading Pod::Simple (or +any Pod::Simple-based class). If you try loading Pod::Simple::Debug +after &Pod::Simple::DEBUG is already defined, Pod::Simple::Debug will +throw a fatal error to the effect that +"It's too late to call Pod::Simple::Debug". + +Note that the C)> mode will make +Pod::Simple (et al) run rather slower, since &Pod::Simple::DEBUG won't +be a constant sub anymore, and so Pod::Simple (et al) won't compile with +constant-folding. + + +=head1 GUTS + +Doing this: + + use Pod::Simple::Debug (5); # or some integer + +is basically equivalent to: + + BEGIN { sub Pod::Simple::DEBUG () {5} } # or some integer + use Pod::Simple (); + +And this: + + use Pod::Simple::Debug (\$debug_level,0); # or some integer + +is basically equivalent to this: + + my $debug_level; + BEGIN { $debug_level = 0 } + BEGIN { sub Pod::Simple::DEBUG () { $debug_level } + use Pod::Simple (); + +=head1 SEE ALSO + +L + +The article "Constants in Perl", in I issue +21. See L + +=head1 SUPPORT + +Questions or discussion about POD and Pod::Simple should be sent to the +pod-people@perl.org mail list. Send an empty email to +pod-people-subscribe@perl.org to subscribe. + +This module is managed in an open GitHub repository, +L. Feel free to fork and contribute, or +to clone L and send patches! + +Patches against Pod::Simple are welcome. Please send bug reports to +. + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Pod::Simple was created by Sean M. Burke . +But don't bother him, he's retired. + +Pod::Simple is maintained by: + +=over + +=item * Allison Randal C + +=item * Hans Dieter Pearcey C + +=item * David E. Wheeler C + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsText.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsText.pm new file mode 100644 index 0000000000000000000000000000000000000000..bade6fcc47276cc44468d36daaed65301f0a7eda --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsText.pm @@ -0,0 +1,156 @@ + +require 5; +package Pod::Simple::DumpAsText; +$VERSION = '3.40'; +use Pod::Simple (); +BEGIN {@ISA = ('Pod::Simple')} + +use strict; + +use Carp (); + +BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } + +sub new { + my $self = shift; + my $new = $self->SUPER::new(@_); + $new->{'output_fh'} ||= *STDOUT{IO}; + $new->accept_codes('VerbatimFormatted'); + $new->keep_encoding_directive(1); + return $new; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _handle_element_start { + # ($self, $element_name, $attr_hash_r) + my $fh = $_[0]{'output_fh'}; + my($key, $value); + DEBUG and print STDERR "++ $_[1]\n"; + + print $fh ' ' x ($_[0]{'indent'} || 0), "++", $_[1], "\n"; + $_[0]{'indent'}++; + while(($key,$value) = each %{$_[2]}) { + unless($key =~ m/^~/s) { + next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; + _perly_escape($key); + _perly_escape($value); + printf $fh qq{%s \\ "%s" => "%s"\n}, + ' ' x ($_[0]{'indent'} || 0), $key, $value; + } + } + return; +} + +sub _handle_text { + DEBUG and print STDERR "== \"$_[1]\"\n"; + + if(length $_[1]) { + my $indent = ' ' x $_[0]{'indent'}; + my $text = $_[1]; + _perly_escape($text); + $text =~ # A not-totally-brilliant wrapping algorithm: + s/( + [^\n]{55} # Snare some characters from a line + [^\n\ ]{0,50} # and finish any current word + ) + \ {1,10}(?!\n) # capture some spaces not at line-end + /$1"\n$indent . "/gx # => line-break here + ; + + print {$_[0]{'output_fh'}} $indent, '* "', $text, "\"\n"; + } + return; +} + +sub _handle_element_end { + DEBUG and print STDERR "-- $_[1]\n"; + print {$_[0]{'output_fh'}} + ' ' x --$_[0]{'indent'}, "--", $_[1], "\n"; + return; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub _perly_escape { + foreach my $x (@_) { + $x =~ s/([^\x00-\xFF])/sprintf'\x{%X}',ord($1)/eg; + # Escape things very cautiously: + $x =~ s/([^-\n\t \&\<\>\'!\#\%\(\)\*\+,\.\/\:\;=\?\~\[\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf'\x%02X',ord($1)/eg; + } + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +1; + + +__END__ + +=head1 NAME + +Pod::Simple::DumpAsText -- dump Pod-parsing events as text + +=head1 SYNOPSIS + + perl -MPod::Simple::DumpAsText -e \ + "exit Pod::Simple::DumpAsText->filter(shift)->any_errata_seen" \ + thingy.pod + +=head1 DESCRIPTION + +This class is for dumping, as text, the events gotten from parsing a Pod +document. This class is of interest to people writing Pod formatters +based on Pod::Simple. It is useful for seeing exactly what events you +get out of some Pod that you feed in. + +This is a subclass of L and inherits all its methods. + +=head1 SEE ALSO + +L + +L + +=head1 SUPPORT + +Questions or discussion about POD and Pod::Simple should be sent to the +pod-people@perl.org mail list. Send an empty email to +pod-people-subscribe@perl.org to subscribe. + +This module is managed in an open GitHub repository, +L. Feel free to fork and contribute, or +to clone L and send patches! + +Patches against Pod::Simple are welcome. Please send bug reports to +. + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Pod::Simple was created by Sean M. Burke . +But don't bother him, he's retired. + +Pod::Simple is maintained by: + +=over + +=item * Allison Randal C + +=item * Hans Dieter Pearcey C + +=item * David E. Wheeler C + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsXML.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsXML.pm new file mode 100644 index 0000000000000000000000000000000000000000..6f0b7b186212c7cb536eb862d2ad479c9a081352 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/DumpAsXML.pm @@ -0,0 +1,167 @@ + +require 5; +package Pod::Simple::DumpAsXML; +$VERSION = '3.40'; +use Pod::Simple (); +BEGIN {@ISA = ('Pod::Simple')} + +use strict; + +use Carp (); +use Text::Wrap qw(wrap); + +BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } + +sub new { + my $self = shift; + my $new = $self->SUPER::new(@_); + $new->{'output_fh'} ||= *STDOUT{IO}; + $new->accept_codes('VerbatimFormatted'); + $new->keep_encoding_directive(1); + return $new; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +sub _handle_element_start { + # ($self, $element_name, $attr_hash_r) + my $fh = $_[0]{'output_fh'}; + my($key, $value); + DEBUG and print STDERR "++ $_[1]\n"; + + print $fh ' ' x ($_[0]{'indent'} || 0), "<", $_[1]; + + foreach my $key (sort keys %{$_[2]}) { + unless($key =~ m/^~/s) { + next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; + _xml_escape($value = $_[2]{$key}); + print $fh ' ', $key, '="', $value, '"'; + } + } + + + print $fh ">\n"; + $_[0]{'indent'}++; + return; +} + +sub _handle_text { + DEBUG and print STDERR "== \"$_[1]\"\n"; + if(length $_[1]) { + my $indent = ' ' x $_[0]{'indent'}; + my $text = $_[1]; + _xml_escape($text); + local $Text::Wrap::huge = 'overflow'; + $text = wrap('', $indent, $text); + print {$_[0]{'output_fh'}} $indent, $text, "\n"; + } + return; +} + +sub _handle_element_end { + DEBUG and print STDERR "-- $_[1]\n"; + print {$_[0]{'output_fh'}} + ' ' x --$_[0]{'indent'}, "\n"; + return; +} + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub _xml_escape { + foreach my $x (@_) { + # Escape things very cautiously: + if ($] ge 5.007_003) { + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; + } else { # Is broken for non-ASCII platforms on early perls + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; + } + # Yes, stipulate the list without a range, so that this can work right on + # all charsets that this module happens to run under. + } + return; +} + +#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +1; + +__END__ + +=head1 NAME + +Pod::Simple::DumpAsXML -- turn Pod into XML + +=head1 SYNOPSIS + + perl -MPod::Simple::DumpAsXML -e \ + "exit Pod::Simple::DumpAsXML->filter(shift)->any_errata_seen" \ + thingy.pod + +=head1 DESCRIPTION + +Pod::Simple::DumpAsXML is a subclass of L that parses Pod +and turns it into indented and wrapped XML. This class is of +interest to people writing Pod formatters based on Pod::Simple. + +Pod::Simple::DumpAsXML inherits methods from +L. + + +=head1 SEE ALSO + +L is rather like this class. +Pod::Simple::XMLOutStream's output is space-padded in a way +that's better for sending to an XML processor (that is, it has +no ignorable whitespace). But +Pod::Simple::DumpAsXML's output is much more human-readable, being +(more-or-less) one token per line, with line-wrapping. + +L is rather like this class, +except that it doesn't dump with XML syntax. Try them and see +which one you like best! + +L, L + +The older libraries L, L, L + +=head1 SUPPORT + +Questions or discussion about POD and Pod::Simple should be sent to the +pod-people@perl.org mail list. Send an empty email to +pod-people-subscribe@perl.org to subscribe. + +This module is managed in an open GitHub repository, +L. Feel free to fork and contribute, or +to clone L and send patches! + +Patches against Pod::Simple are welcome. Please send bug reports to +. + +=head1 COPYRIGHT AND DISCLAIMERS + +Copyright (c) 2002 Sean M. Burke. + +This library is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +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. + +=head1 AUTHOR + +Pod::Simple was created by Sean M. Burke . +But don't bother him, he's retired. + +Pod::Simple is maintained by: + +=over + +=item * Allison Randal C + +=item * Hans Dieter Pearcey C + +=item * David E. Wheeler C + +=back + +=cut diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTML.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTML.pm new file mode 100644 index 0000000000000000000000000000000000000000..0219b979100e8c1c3a5d32c14593b199d40109b9 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTML.pm @@ -0,0 +1,1157 @@ +require 5; +package Pod::Simple::HTML; +use strict; +use Pod::Simple::PullParser (); +use vars qw( + @ISA %Tagmap $Computerese $LamePad $Linearization_Limit $VERSION + $Perldoc_URL_Prefix $Perldoc_URL_Postfix $Man_URL_Prefix $Man_URL_Postfix + $Title_Prefix $Title_Postfix $HTML_EXTENSION %ToIndex + $Doctype_decl $Content_decl +); +@ISA = ('Pod::Simple::PullParser'); +$VERSION = '3.40'; +BEGIN { + if(defined &DEBUG) { } # no-op + elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG } + else { *DEBUG = sub () {0}; } +} + +$Doctype_decl ||= ''; # No. Just No. Don't even ask me for it. + # qq{\n}; + +$Content_decl ||= + q{}; + +$HTML_EXTENSION = '.html' unless defined $HTML_EXTENSION; +$Computerese = "" unless defined $Computerese; +$LamePad = '' unless defined $LamePad; + +$Linearization_Limit = 120 unless defined $Linearization_Limit; + # headings/items longer than that won't get an +$Perldoc_URL_Prefix = 'https://metacpan.org/pod/' + unless defined $Perldoc_URL_Prefix; +$Perldoc_URL_Postfix = '' + unless defined $Perldoc_URL_Postfix; + + +$Man_URL_Prefix = 'http://man.he.net/man'; +$Man_URL_Postfix = ''; + +$Title_Prefix = '' unless defined $Title_Prefix; +$Title_Postfix = '' unless defined $Title_Postfix; +%ToIndex = map {; $_ => 1 } qw(head1 head2 head3 head4 ); # item-text + # 'item-text' stuff in the index doesn't quite work, and may + # not be a good idea anyhow. + + +__PACKAGE__->_accessorize( + 'perldoc_url_prefix', + # In turning L into http://whatever/Foo%3a%3aBar, what + # to put before the "Foo%3a%3aBar". + # (for singleton mode only?) + 'perldoc_url_postfix', + # what to put after "Foo%3a%3aBar" in the URL. Normally "". + + 'man_url_prefix', + # In turning L into http://whatever/man/1/crontab, what + # to put before the "1/crontab". + 'man_url_postfix', + # what to put after the "1/crontab" in the URL. Normally "". + + 'batch_mode', # whether we're in batch mode + 'batch_mode_current_level', + # When in batch mode, how deep the current module is: 1 for "LWP", + # 2 for "LWP::Procotol", 3 for "LWP::Protocol::GHTTP", etc + + 'title_prefix', 'title_postfix', + # What to put before and after the title in the head. + # Should already be &-escaped + + 'html_h_level', + + 'html_header_before_title', + 'html_header_after_title', + 'html_footer', + 'top_anchor', + + 'index', # whether to add an index at the top of each page + # (actually it's a table-of-contents, but we'll call it an index, + # out of apparently longstanding habit) + + 'html_css', # URL of CSS file to point to + 'html_javascript', # URL of Javascript file to point to + + 'force_title', # should already be &-escaped + 'default_title', # should already be &-escaped +); + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +my @_to_accept; + +%Tagmap = ( + 'Verbatim' => "\n", + '/Verbatim' => "\n", + 'VerbatimFormatted' => "\n", + '/VerbatimFormatted' => "\n", + 'VerbatimB' => "", + '/VerbatimB' => "", + 'VerbatimI' => "", + '/VerbatimI' => "", + 'VerbatimBI' => "", + '/VerbatimBI' => "", + + + 'Data' => "\n", + '/Data' => "\n", + + 'head1' => "\n

", # And also stick in an + 'head2' => "\n

", # '' + 'head3' => "\n

", # '' + 'head4' => "\n

", # '' + '/head1' => "

\n", + '/head2' => "

\n", + '/head3' => "\n", + '/head4' => "\n", + + 'X' => "", + + changes(qw( + Para=p + B=b I=i + over-bullet=ul + over-number=ol + over-text=dl + over-block=blockquote + item-bullet=li + item-number=li + item-text=dt + )), + changes2( + map {; m/^([-a-z]+)/s && push @_to_accept, $1; $_ } + qw[ + sample=samp + definition=dfn + keyboard=kbd + variable=var + citation=cite + abbreviation=abbr + acronym=acronym + subscript=sub + superscript=sup + big=big + small=small + underline=u + strikethrough=s + preformat=pre + teletype=tt + ] # no point in providing a way to get ..., I think + ), + + '/item-bullet' => "$LamePad\n", + '/item-number' => "$LamePad\n", + '/item-text' => "$LamePad\n", + 'item-body' => "\n
", + '/item-body' => "
\n", + + + 'B' => "", '/B' => "", + 'I' => "", '/I' => "", + 'F' => "", '/F' => "", + 'C' => "", '/C' => "
", + 'L' => "", # ideally never used! + '/L' => "", +); + +sub changes { + return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s + ? ( $1, => "\n<$2>", "/$1", => "\n" ) : die "Funky $_" + } @_; +} +sub changes2 { + return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s + ? ( $1, => "<$2>", "/$1", => "" ) : die "Funky $_" + } @_; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +sub go { Pod::Simple::HTML->parse_from_file(@ARGV); exit 0 } + # Just so we can run from the command line. No options. + # For that, use perldoc! +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub new { + my $new = shift->SUPER::new(@_); + #$new->nix_X_codes(1); + $new->nbsp_for_S(1); + $new->accept_targets( 'html', 'HTML' ); + $new->accept_codes('VerbatimFormatted'); + $new->accept_codes(@_to_accept); + DEBUG > 2 and print STDERR "To accept: ", join(' ',@_to_accept), "\n"; + + $new->perldoc_url_prefix( $Perldoc_URL_Prefix ); + $new->perldoc_url_postfix( $Perldoc_URL_Postfix ); + $new->man_url_prefix( $Man_URL_Prefix ); + $new->man_url_postfix( $Man_URL_Postfix ); + $new->title_prefix( $Title_Prefix ); + $new->title_postfix( $Title_Postfix ); + + $new->html_header_before_title( + qq[$Doctype_decl] + ); + $new->html_header_after_title( join "\n" => + "", + $Content_decl, + "\n", + $new->version_tag_comment, + "\n", + ); + $new->html_footer( qq[\n\n\n\n] ); + $new->top_anchor( "\n" ); + + $new->{'Tagmap'} = {%Tagmap}; + + return $new; +} + +sub __adjust_html_h_levels { + my ($self) = @_; + my $Tagmap = $self->{'Tagmap'}; + + my $add = $self->html_h_level; + return unless defined $add; + return if ($self->{'Adjusted_html_h_levels'}||0) == $add; + + $add -= 1; + for (1 .. 4) { + $Tagmap->{"head$_"} =~ s/$_/$_ + $add/e; + $Tagmap->{"/head$_"} =~ s/$_/$_ + $add/e; + } +} + +sub batch_mode_page_object_init { + my($self, $batchconvobj, $module, $infile, $outfile, $depth) = @_; + DEBUG and print STDERR "Initting $self\n for $module\n", + " in $infile\n out $outfile\n depth $depth\n"; + $self->batch_mode(1); + $self->batch_mode_current_level($depth); + return $self; +} + +sub run { + my $self = $_[0]; + return $self->do_middle if $self->bare_output; + return + $self->do_beginning && $self->do_middle && $self->do_end; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub do_beginning { + my $self = $_[0]; + + my $title; + + if(defined $self->force_title) { + $title = $self->force_title; + DEBUG and print STDERR "Forcing title to be $title\n"; + } else { + # Actually try looking for the title in the document: + $title = $self->get_short_title(); + unless($self->content_seen) { + DEBUG and print STDERR "No content seen in search for title.\n"; + return; + } + $self->{'Title'} = $title; + + if(defined $title and $title =~ m/\S/) { + $title = $self->title_prefix . esc($title) . $self->title_postfix; + } else { + $title = $self->default_title; + $title = '' unless defined $title; + DEBUG and print STDERR "Title defaults to $title\n"; + } + } + + + my $after = $self->html_header_after_title || ''; + if($self->html_css) { + my $link = + $self->html_css =~ m/html_css # It's a big blob of markup, let's drop it in + : sprintf( # It's just a URL, so let's wrap it up + qq[\n], + $self->html_css, + ); + $after =~ s{()}{$link\n$1}i; # otherwise nevermind + } + $self->_add_top_anchor(\$after); + + if($self->html_javascript) { + my $link = + $self->html_javascript =~ m/html_javascript # It's a big blob of markup, let's drop it in + : sprintf( # It's just a URL, so let's wrap it up + qq[\n], + $self->html_javascript, + ); + $after =~ s{()}{$link\n$1}i; # otherwise nevermind + } + + print {$self->{'output_fh'}} + $self->html_header_before_title || '', + $title, # already escaped + $after, + ; + + DEBUG and print STDERR "Returning from do_beginning...\n"; + return 1; +} + +sub _add_top_anchor { + my($self, $text_r) = @_; + unless($$text_r and $$text_r =~ m/name=['"]___top['"]/) { # a hack + $$text_r .= $self->top_anchor || ''; + } + return; +} + +sub version_tag_comment { + my $self = shift; + return sprintf + "\n", + esc( + ref($self), $self->VERSION(), $ISA[0], $ISA[0]->VERSION(), + $], scalar(gmtime), + ), $self->_modnote(), + ; +} + +sub _modnote { + my $class = ref($_[0]) || $_[0]; + return join "\n " => grep m/\S/, split "\n", + +qq{ +If you want to change this HTML document, you probably shouldn't do that +by changing it directly. Instead, see about changing the calling options +to $class, and/or subclassing $class, +then reconverting this document from the Pod source. +When in doubt, email the author of $class for advice. +See 'perldoc $class' for more info. +}; + +} + +sub do_end { + my $self = $_[0]; + print {$self->{'output_fh'}} $self->html_footer || ''; + return 1; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Normally this would just be a call to _do_middle_main_loop -- but we +# have to do some elaborate things to emit all the content and then +# summarize it and output it /before/ the content that it's a summary of. + +sub do_middle { + my $self = $_[0]; + return $self->_do_middle_main_loop unless $self->index; + + if( $self->output_string ) { + # An efficiency hack + my $out = $self->output_string; #it's a reference to it + my $sneakytag = "\f\f\e\e\b\bIndex Here\e\e\b\b\f\f\n"; + $$out .= $sneakytag; + $self->_do_middle_main_loop; + $sneakytag = quotemeta($sneakytag); + my $index = $self->index_as_html(); + if( $$out =~ s/$sneakytag/$index/s ) { + # Expected case + DEBUG and print STDERR "Inserted ", length($index), " bytes of index HTML into $out.\n"; + } else { + DEBUG and print STDERR "Odd, couldn't find where to insert the index in the output!\n"; + # I don't think this should ever happen. + } + return 1; + } + + unless( $self->output_fh ) { + require Carp; + Carp::confess("Parser object \$p doesn't seem to have any output object! I don't know how to deal with that."); + } + + # If we get here, we're outputting to a FH. So we need to do some magic. + # Namely, divert all content to a string, which we output after the index. + my $fh = $self->output_fh; + my $content = ''; + { + # Our horrible bait and switch: + $self->output_string( \$content ); + $self->_do_middle_main_loop; + $self->abandon_output_string(); + $self->output_fh($fh); + } + print $fh $self->index_as_html(); + print $fh $content; + + return 1; +} + +########################################################################### + +sub index_as_html { + my $self = $_[0]; + # This is meant to be called AFTER the input document has been parsed! + + my $points = $self->{'PSHTML_index_points'} || []; + + @$points > 1 or return qq[
\n]; + # There's no point in having a 0-item or 1-item index, I dare say. + + my(@out) = qq{\n
}; + my $level = 0; + + my( $target_level, $previous_tagname, $tagname, $text, $anchorname, $indent); + foreach my $p (@$points, ['head0', '(end)']) { + ($tagname, $text) = @$p; + $anchorname = $self->section_escape($text); + if( $tagname =~ m{^head(\d+)$} ) { + $target_level = 0 + $1; + } else { # must be some kinda list item + if($previous_tagname =~ m{^head\d+$} ) { + $target_level = $level + 1; + } else { + $target_level = $level; # no change needed + } + } + + # Get to target_level by opening or closing ULs + while($level > $target_level) + { --$level; push @out, (" " x $level) . ""; } + while($level < $target_level) + { ++$level; push @out, (" " x ($level-1)) + . "
    "; } + + $previous_tagname = $tagname; + next unless $level; + + $indent = ' ' x $level; + push @out, sprintf + "%s
  • %s", + $indent, $level, esc($anchorname), esc($text) + ; + } + push @out, "
\n"; + return join "\n", @out; +} + +########################################################################### + +sub _do_middle_main_loop { + my $self = $_[0]; + my $fh = $self->{'output_fh'}; + my $tagmap = $self->{'Tagmap'}; + + $self->__adjust_html_h_levels; + + my($token, $type, $tagname, $linkto, $linktype); + my @stack; + my $dont_wrap = 0; + + while($token = $self->get_token) { + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + if( ($type = $token->type) eq 'start' ) { + if(($tagname = $token->tagname) eq 'L') { + $linktype = $token->attr('type') || 'insane'; + + $linkto = $self->do_link($token); + + if(defined $linkto and length $linkto) { + esc($linkto); + # (Yes, SGML-escaping applies on top of %-escaping! + # But it's rarely noticeable in practice.) + print $fh qq{}; + } else { + print $fh ""; # Yes, an 'a' element with no attributes! + } + + } elsif ($tagname eq 'item-text' or $tagname =~ m/^head\d$/s) { + print $fh $tagmap->{$tagname} || next; + + my @to_unget; + while(1) { + push @to_unget, $self->get_token; + last if $to_unget[-1]->is_end + and $to_unget[-1]->tagname eq $tagname; + + # TODO: support for X<...>'s found in here? (maybe hack into linearize_tokens) + } + + my $name = $self->linearize_tokens(@to_unget); + $name = $self->do_section($name, $token) if defined $name; + + print $fh "index + ? " href='#___top' title='click to go to top of document'\n" + : "\n"; + } + + if(defined $name) { + my $esc = esc( $self->section_name_tidy( $name ) ); + print $fh qq[name="$esc"]; + DEBUG and print STDERR "Linearized ", scalar(@to_unget), + " tokens as \"$name\".\n"; + push @{ $self->{'PSHTML_index_points'} }, [$tagname, $name] + if $ToIndex{ $tagname }; + # Obviously, this discards all formatting codes (saving + # just their content), but ahwell. + + } else { # ludicrously long, so nevermind + DEBUG and print STDERR "Linearized ", scalar(@to_unget), + " tokens, but it was too long, so nevermind.\n"; + } + print $fh "\n>"; + $self->unget_token(@to_unget); + + } elsif ($tagname eq 'Data') { + my $next = $self->get_token; + next unless defined $next; + unless( $next->type eq 'text' ) { + $self->unget_token($next); + next; + } + DEBUG and print STDERR " raw text ", $next->text, "\n"; + # The parser sometimes preserves newlines and sometimes doesn't! + (my $text = $next->text) =~ s/\n\z//; + print $fh $text, "\n"; + next; + + } else { + if( $tagname =~ m/^over-/s ) { + push @stack, ''; + } elsif( $tagname =~ m/^item-/s and @stack and $stack[-1] ) { + print $fh $stack[-1]; + $stack[-1] = ''; + } + print $fh $tagmap->{$tagname} || next; + ++$dont_wrap if $tagname eq 'Verbatim' or $tagname eq "VerbatimFormatted" + or $tagname eq 'X'; + } + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } elsif( $type eq 'end' ) { + if( ($tagname = $token->tagname) =~ m/^over-/s ) { + if( my $end = pop @stack ) { + print $fh $end; + } + } elsif( $tagname =~ m/^item-/s and @stack) { + $stack[-1] = $tagmap->{"/$tagname"}; + if( $tagname eq 'item-text' and defined(my $next = $self->get_token) ) { + $self->unget_token($next); + if( $next->type eq 'start' ) { + print $fh $tagmap->{"/item-text"},$tagmap->{"item-body"}; + $stack[-1] = $tagmap->{"/item-body"}; + } + } + next; + } + print $fh $tagmap->{"/$tagname"} || next; + --$dont_wrap if $tagname eq 'Verbatim' or $tagname eq 'X'; + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } elsif( $type eq 'text' ) { + esc($type = $token->text); # reuse $type, why not + $type =~ s/([\?\!\"\'\.\,]) /$1\n/g unless $dont_wrap; + print $fh $type; + } + + } + return 1; +} + +########################################################################### +# + +sub do_section { + my($self, $name, $token) = @_; + return $name; +} + +sub do_link { + my($self, $token) = @_; + my $type = $token->attr('type'); + if(!defined $type) { + $self->whine("Typeless L!?", $token->attr('start_line')); + } elsif( $type eq 'pod') { return $self->do_pod_link($token); + } elsif( $type eq 'url') { return $self->do_url_link($token); + } elsif( $type eq 'man') { return $self->do_man_link($token); + } else { + $self->whine("L of unknown type $type!?", $token->attr('start_line')); + } + return 'FNORG'; # should never get called +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub do_url_link { return $_[1]->attr('to') } + +sub do_man_link { + my ($self, $link) = @_; + my $to = $link->attr('to'); + my $frag = $link->attr('section'); + + return undef unless defined $to and length $to; # should never happen + + $frag = $self->section_escape($frag) + if defined $frag and length($frag .= ''); # (stringify) + + DEBUG and print STDERR "Resolving \"$to/$frag\"\n\n"; + + return $self->resolve_man_page_link($to, $frag); +} + + +sub do_pod_link { + # And now things get really messy... + my($self, $link) = @_; + my $to = $link->attr('to'); + my $section = $link->attr('section'); + return undef unless( # should never happen + (defined $to and length $to) or + (defined $section and length $section) + ); + + $section = $self->section_escape($section) + if defined $section and length($section .= ''); # (stringify) + + DEBUG and printf STDERR "Resolving \"%s\" \"%s\"...\n", + $to || "(nil)", $section || "(nil)"; + + { + # An early hack: + my $complete_url = $self->resolve_pod_link_by_table($to, $section); + if( $complete_url ) { + DEBUG > 1 and print STDERR "resolve_pod_link_by_table(T,S) gives ", + $complete_url, "\n (Returning that.)\n"; + return $complete_url; + } else { + DEBUG > 4 and print STDERR " resolve_pod_link_by_table(T,S)", + " didn't return anything interesting.\n"; + } + } + + if(defined $to and length $to) { + # Give this routine first hack again + my $there = $self->resolve_pod_link_by_table($to); + if(defined $there and length $there) { + DEBUG > 1 + and print STDERR "resolve_pod_link_by_table(T) gives $there\n"; + } else { + $there = + $self->resolve_pod_page_link($to, $section); + # (I pass it the section value, but I don't see a + # particular reason it'd use it.) + DEBUG > 1 and print STDERR "resolve_pod_page_link gives ", $there || "(nil)", "\n"; + unless( defined $there and length $there ) { + DEBUG and print STDERR "Can't resolve $to\n"; + return undef; + } + # resolve_pod_page_link returning undef is how it + # can signal that it gives up on making a link + } + $to = $there; + } + + #DEBUG and print STDERR "So far [", $to||'nil', "] [", $section||'nil', "]\n"; + + my $out = (defined $to and length $to) ? $to : ''; + $out .= "#" . $section if defined $section and length $section; + + unless(length $out) { # sanity check + DEBUG and printf STDERR "Oddly, couldn't resolve \"%s\" \"%s\"...\n", + $to || "(nil)", $section || "(nil)"; + return undef; + } + + DEBUG and print STDERR "Resolved to $out\n"; + return $out; +} + + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + +sub section_escape { + my($self, $section) = @_; + return $self->section_url_escape( + $self->section_name_tidy($section) + ); +} + +sub section_name_tidy { + my($self, $section) = @_; + $section =~ s/^\s+//; + $section =~ s/\s+$//; + $section =~ tr/ /_/; + if ($] ge 5.006) { + $section =~ s/[[:cntrl:][:^ascii:]]//g; # drop crazy characters + } elsif ('A' eq chr(65)) { # But not on early EBCDIC + $section =~ tr/\x00-\x1F\x80-\x9F//d; + } + $section = $self->unicode_escape_url($section); + $section = '_' unless length $section; + return $section; +} + +sub section_url_escape { shift->general_url_escape(@_) } +sub pagepath_url_escape { shift->general_url_escape(@_) } +sub manpage_url_escape { shift->general_url_escape(@_) } + +sub general_url_escape { + my($self, $string) = @_; + + $string =~ s/([^\x00-\xFF])/join '', map sprintf('%%%02X',$_), unpack 'C*', $1/eg; + # express Unicode things as urlencode(utf(orig)). + + # A pretty conservative escaping, behoovey even for query components + # of a URL (see RFC 2396) + + if ($] ge 5.007_003) { + $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',utf8::native_to_unicode(ord($1)))/eg; + } else { # Is broken for non-ASCII platforms on early perls + $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',ord($1))/eg; + } + # Yes, stipulate the list without a range, so that this can work right on + # all charsets that this module happens to run under. + + return $string; +} + +#-------------------------------------------------------------------------- +# +# Oh look, a yawning portal to Hell! Let's play touch football right by it! +# + +sub resolve_pod_page_link { + # resolve_pod_page_link must return a properly escaped URL + my $self = shift; + return $self->batch_mode() + ? $self->resolve_pod_page_link_batch_mode(@_) + : $self->resolve_pod_page_link_singleton_mode(@_) + ; +} + +sub resolve_pod_page_link_singleton_mode { + my($self, $it) = @_; + return undef unless defined $it and length $it; + my $url = $self->pagepath_url_escape($it); + + $url =~ s{::$}{}s; # probably never comes up anyway + $url =~ s{::}{/}g unless $self->perldoc_url_prefix =~ m/\?/s; # sane DWIM? + + return undef unless length $url; + return $self->perldoc_url_prefix . $url . $self->perldoc_url_postfix; +} + +sub resolve_pod_page_link_batch_mode { + my($self, $to) = @_; + DEBUG > 1 and print STDERR " During batch mode, resolving $to ...\n"; + my @path = grep length($_), split m/::/s, $to, -1; + unless( @path ) { # sanity + DEBUG and print STDERR "Very odd! Splitting $to gives (nil)!\n"; + return undef; + } + $self->batch_mode_rectify_path(\@path); + my $out = join('/', map $self->pagepath_url_escape($_), @path) + . $HTML_EXTENSION; + DEBUG > 1 and print STDERR " => $out\n"; + return $out; +} + +sub batch_mode_rectify_path { + my($self, $pathbits) = @_; + my $level = $self->batch_mode_current_level; + $level--; # how many levels up to go to get to the root + if($level < 1) { + unshift @$pathbits, '.'; # just to be pretty + } else { + unshift @$pathbits, ('..') x $level; + } + return; +} + +sub resolve_man_page_link { + my ($self, $to, $frag) = @_; + my ($page, $section) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/; + + return undef unless defined $page and length $page; + $section ||= 1; + + return $self->man_url_prefix . "$section/" + . $self->manpage_url_escape($page) + . $self->man_url_postfix; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub resolve_pod_link_by_table { + # A crazy hack to allow specifying custom L => URL mappings + + return unless $_[0]->{'podhtml_LOT'}; # An optimizy shortcut + + my($self, $to, $section) = @_; + + # TODO: add a method that actually populates podhtml_LOT from a file? + + if(defined $section) { + $to = '' unless defined $to and length $to; + return $self->{'podhtml_LOT'}{"$to#$section"}; # quite possibly undef! + } else { + return $self->{'podhtml_LOT'}{$to}; # quite possibly undef! + } + return; +} + +########################################################################### + +sub linearize_tokens { # self, tokens + my $self = shift; + my $out = ''; + + my $t; + while($t = shift @_) { + if(!ref $t or !UNIVERSAL::can($t, 'is_text')) { + $out .= $t; # a string, or some insane thing + } elsif($t->is_text) { + $out .= $t->text; + } elsif($t->is_start and $t->tag eq 'X') { + # Ignore until the end of this X<...> sequence: + my $x_open = 1; + while($x_open) { + next if( ($t = shift @_)->is_text ); + if( $t->is_start and $t->tag eq 'X') { ++$x_open } + elsif($t->is_end and $t->tag eq 'X') { --$x_open } + } + } + } + return undef if length $out > $Linearization_Limit; + return $out; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +sub unicode_escape_url { + my($self, $string) = @_; + $string =~ s/([^\x00-\xFF])/'('.ord($1).')'/eg; + # Turn char 1234 into "(1234)" + return $string; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +sub esc { # a function. + if(defined wantarray) { + if(wantarray) { + @_ = splice @_; # break aliasing + } else { + my $x = shift; + if ($] ge 5.007_003) { + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; + } else { # Is broken for non-ASCII platforms on early perls + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; + } + return $x; + } + } + foreach my $x (@_) { + # Escape things very cautiously: + if (defined $x) { + if ($] ge 5.007_003) { + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg + } else { # Is broken for non-ASCII platforms on early perls + $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg + } + } + # Leave out "- so that "--" won't make it thru in X-generated comments + # with text in them. + + # Yes, stipulate the list without a range, so that this can work right on + # all charsets that this module happens to run under. + } + return @_; +} + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1; +__END__ + +=head1 NAME + +Pod::Simple::HTML - convert Pod to HTML + +=head1 SYNOPSIS + + perl -MPod::Simple::HTML -e Pod::Simple::HTML::go thingy.pod + + +=head1 DESCRIPTION + +This class is for making an HTML rendering of a Pod document. + +This is a subclass of L and inherits all its +methods (and options). + +Note that if you want to do a batch conversion of a lot of Pod +documents to HTML, you should see the module L. + + + +=head1 CALLING FROM THE COMMAND LINE + +TODO + + perl -MPod::Simple::HTML -e Pod::Simple::HTML::go Thing.pod Thing.html + + + +=head1 CALLING FROM PERL + +=head2 Minimal code + + use Pod::Simple::HTML; + my $p = Pod::Simple::HTML->new; + $p->output_string(\my $html); + $p->parse_file('path/to/Module/Name.pm'); + open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n"; + print $out $html; + +=head2 More detailed example + + use Pod::Simple::HTML; + +Set the content type: + + $Pod::Simple::HTML::Content_decl = q{}; + + my $p = Pod::Simple::HTML->new; + +Include a single javascript source: + + $p->html_javascript('http://abc.com/a.js'); + +Or insert multiple javascript source in the header +(or for that matter include anything, thought this is not recommended) + + $p->html_javascript(' + + '); + +Include a single css source in the header: + + $p->html_css('/style.css'); + +or insert multiple css sources: + + $p->html_css(' + + '); + +Tell the parser where should the output go. In this case it will be placed in the $html variable: + + my $html; + $p->output_string(\$html); + +Parse and process a file with pod in it: + + $p->parse_file('path/to/Module/Name.pm'); + +=head1 METHODS + +TODO +all (most?) accessorized methods + +The following variables need to be set B the call to the ->new constructor. + +Set the string that is included before the opening tag: + + $Pod::Simple::HTML::Doctype_decl = qq{\n}; + +Set the content-type in the HTML head: (defaults to ISO-8859-1) + + $Pod::Simple::HTML::Content_decl = q{}; + +Set the value that will be embedded in the opening tags of F, C tags and verbatim text. +F maps to , C maps to , Verbatim text maps to
 (Computerese defaults to "")
+
+  $Pod::Simple::HTML::Computerese =  ' class="some_class_name';
+
+=head2 html_css
+
+=head2 html_javascript
+
+=head2 title_prefix
+
+=head2 title_postfix
+
+=head2 html_header_before_title
+
+This includes everything before the  opening tag including the Document type
+and including the opening <title> tag. The following call will set it to be a simple HTML
+file:
+
+  $p->html_header_before_title('<html><head><title>');
+
+=head2 top_anchor
+
+By default Pod::Simple::HTML adds a dummy anchor at the top of the HTML.
+You can change it by calling
+
+  $p->top_anchor('<a name="zz" >');
+
+=head2 html_h_level
+
+Normally =head1 will become <h1>, =head2 will become <h2> etc.
+Using the html_h_level method will change these levels setting the h level
+of =head1 tags:
+
+  $p->html_h_level(3);
+
+Will make sure that =head1 will become <h3> and =head2 will become <h4> etc...
+
+
+=head2 index
+
+Set it to some true value if you want to have an index (in reality a table of contents)
+to be added at the top of the generated HTML.
+
+  $p->index(1);
+
+=head2 html_header_after_title
+
+Includes the closing tag of  and through the rest of the head
+till the opening of the body
+
+  $p->html_header_after_title('...');
+
+=head2 html_footer
+
+The very end of the document:
+
+  $p->html_footer( qq[\n\n\n\n] );
+
+=head1 SUBCLASSING
+
+Can use any of the methods described above but for further customization
+one needs to override some of the methods:
+
+  package My::Pod;
+  use strict;
+  use warnings;
+
+  use base 'Pod::Simple::HTML';
+
+  # needs to return a URL string such
+  # http://some.other.com/page.html
+  # #anchor_in_the_same_file
+  # /internal/ref.html
+  sub do_pod_link {
+    # My::Pod object and Pod::Simple::PullParserStartToken object
+    my ($self, $link) = @_;
+
+    say $link->tagname;          # will be L for links
+    say $link->attr('to');       # 
+    say $link->attr('type');     # will be 'pod' always
+    say $link->attr('section');
+
+    # Links local to our web site
+    if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') {
+      my $to = $link->attr('to');
+      if ($to =~ /^Padre::/) {
+          $to =~ s{::}{/}g;
+          return "/docs/Padre/$to.html";
+      }
+    }
+
+    # all other links are generated by the parent class
+    my $ret = $self->SUPER::do_pod_link($link);
+    return $ret;
+  }
+
+  1;
+
+Meanwhile in script.pl:
+
+  use My::Pod;
+
+  my $p = My::Pod->new;
+
+  my $html;
+  $p->output_string(\$html);
+  $p->parse_file('path/to/Module/Name.pm');
+  open my $out, '>', 'out.html' or die;
+  print $out $html;
+
+TODO
+
+maybe override do_beginning do_end
+
+=head1 SEE ALSO
+
+L, L
+
+TODO: a corpus of sample Pod input and HTML output?  Or common
+idioms?
+
+=head1 SUPPORT
+
+Questions or discussion about POD and Pod::Simple should be sent to the
+pod-people@perl.org mail list. Send an empty email to
+pod-people-subscribe@perl.org to subscribe.
+
+This module is managed in an open GitHub repository,
+L. Feel free to fork and contribute, or
+to clone L and send patches!
+
+Patches against Pod::Simple are welcome. Please send bug reports to
+.
+
+=head1 COPYRIGHT AND DISCLAIMERS
+
+Copyright (c) 2002-2004 Sean M. Burke.
+
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+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.
+
+=head1 ACKNOWLEDGEMENTS
+
+Thanks to L for permission to use its
+L site for man page links.
+
+Thanks to L for permission to use the
+site for Perl module links.
+
+=head1 AUTHOR
+
+Pod::Simple was created by Sean M. Burke .
+But don't bother him, he's retired.
+
+Pod::Simple is maintained by:
+
+=over
+
+=item * Allison Randal C
+
+=item * Hans Dieter Pearcey C
+
+=item * David E. Wheeler C
+
+=back
+
+=cut
diff --git a/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTMLBatch.pm b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTMLBatch.pm
new file mode 100644
index 0000000000000000000000000000000000000000..227d6d3af0da72c395055ed7f65e13bb6d0c8684
--- /dev/null
+++ b/data/miniconda3/lib/perl5/core_perl/Pod/Simple/HTMLBatch.pm
@@ -0,0 +1,1360 @@
+
+require 5;
+package Pod::Simple::HTMLBatch;
+use strict;
+use vars qw( $VERSION $HTML_RENDER_CLASS $HTML_EXTENSION
+ $CSS $JAVASCRIPT $SLEEPY $SEARCH_CLASS @ISA
+);
+$VERSION = '3.40';
+@ISA = ();  # Yup, we're NOT a subclass of Pod::Simple::HTML!
+
+# TODO: nocontents stylesheets. Strike some of the color variations?
+
+use Pod::Simple::HTML ();
+BEGIN {*esc = \&Pod::Simple::HTML::esc }
+use File::Spec ();
+
+use Pod::Simple::Search;
+$SEARCH_CLASS ||= 'Pod::Simple::Search';
+
+BEGIN {
+  if(defined &DEBUG) { } # no-op
+  elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG }
+  else { *DEBUG = sub () {0}; }
+}
+
+$SLEEPY = 1 if !defined $SLEEPY and $^O =~ /mswin|mac/i;
+# flag to occasionally sleep for $SLEEPY - 1 seconds.
+
+$HTML_RENDER_CLASS ||= "Pod::Simple::HTML";
+
+#
+# Methods beginning with "_" are particularly internal and possibly ugly.
+#
+
+Pod::Simple::_accessorize( __PACKAGE__,
+ 'verbose', # how verbose to be during batch conversion
+ 'html_render_class', # what class to use to render
+ 'search_class', # what to use to search for POD documents
+ 'contents_file', # If set, should be the name of a file (in current directory)
+                  # to write the list of all modules to
+ 'index', # will set $htmlpage->index(...) to this (true or false)
+ 'progress', # progress object
+ 'contents_page_start',  'contents_page_end',
+
+ 'css_flurry', '_css_wad', 'javascript_flurry', '_javascript_wad',
+ 'no_contents_links', # set to true to suppress automatic adding of << links.
+ '_contents',
+);
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Just so we can run from the command line more easily
+sub go {
+  @ARGV == 2 or die sprintf(
+    "Usage: perl -M%s -e %s:go indirs outdir\n  (or use \"\@INC\" for indirs)\n",
+    __PACKAGE__, __PACKAGE__, 
+  );
+  
+  if(defined($ARGV[1]) and length($ARGV[1])) {
+    my $d = $ARGV[1];
+    -e $d or die "I see no output directory named \"$d\"\nAborting";
+    -d $d or die "But \"$d\" isn't a directory!\nAborting";
+    -w $d or die "Directory \"$d\" isn't writeable!\nAborting";
+  }
+  
+  __PACKAGE__->batch_convert(@ARGV);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+sub new {
+  my $new = bless {}, ref($_[0]) || $_[0];
+  $new->html_render_class($HTML_RENDER_CLASS);
+  $new->search_class($SEARCH_CLASS);
+  $new->verbose(1 + DEBUG);
+  $new->_contents([]);
+  
+  $new->index(1);
+
+  $new->       _css_wad([]);         $new->css_flurry(1);
+  $new->_javascript_wad([]);  $new->javascript_flurry(1);
+  
+  $new->contents_file(
+    'index' . ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION)
+  );
+  
+  $new->contents_page_start( join "\n", grep $_,
+    $Pod::Simple::HTML::Doctype_decl,
+    "",
+    "Perl Documentation",
+    $Pod::Simple::HTML::Content_decl,
+    "",
+    "\n\n

Perl Documentation

\n" + ); # override if you need a different title + + + $new->contents_page_end( sprintf( + "\n\n

Generated by %s v%s under Perl v%s\n
At %s GMT, which is %s local time.

\n\n\n", + esc( + ref($new), + eval {$new->VERSION} || $VERSION, + $], scalar(gmtime), scalar(localtime), + ))); + + return $new; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub muse { + my $self = shift; + if($self->verbose) { + print 'T+', int(time() - $self->{'_batch_start_time'}), "s: ", @_, "\n"; + } + return 1; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub batch_convert { + my($self, $dirs, $outdir) = @_; + $self ||= __PACKAGE__; # tolerate being called as an optionless function + $self = $self->new unless ref $self; # tolerate being used as a class method + + if(!defined($dirs) or $dirs eq '' or $dirs eq '@INC' ) { + $dirs = ''; + } elsif(ref $dirs) { + # OK, it's an explicit set of dirs to scan, specified as an arrayref. + } else { + # OK, it's an explicit set of dirs to scan, specified as a + # string like "/thing:/also:/whatever/perl" (":"-delim, as usual) + # or, under MSWin, like "c:/thing;d:/also;c:/whatever/perl" (";"-delim!) + require Config; + my $ps = quotemeta( $Config::Config{'path_sep'} || ":" ); + $dirs = [ grep length($_), split qr/$ps/, $dirs ]; + } + + $outdir = $self->filespecsys->curdir + unless defined $outdir and length $outdir; + + $self->_batch_convert_main($dirs, $outdir); +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _batch_convert_main { + my($self, $dirs, $outdir) = @_; + # $dirs is either false, or an arrayref. + # $outdir is a pathspec. + + $self->{'_batch_start_time'} ||= time(); + + $self->muse( "= ", scalar(localtime) ); + $self->muse( "Starting batch conversion to \"$outdir\"" ); + + my $progress = $self->progress; + if(!$progress and $self->verbose > 0 and $self->verbose() <= 5) { + require Pod::Simple::Progress; + $progress = Pod::Simple::Progress->new( + ($self->verbose < 2) ? () # Default omission-delay + : ($self->verbose == 2) ? 1 # Reduce the omission-delay + : 0 # Eliminate the omission-delay + ); + $self->progress($progress); + } + + if($dirs) { + $self->muse(scalar(@$dirs), " dirs to scan: @$dirs"); + } else { + $self->muse("Scanning \@INC. This could take a minute or two."); + } + my $mod2path = $self->find_all_pods($dirs ? $dirs : ()); + $self->muse("Done scanning."); + + my $total = keys %$mod2path; + unless($total) { + $self->muse("No pod found. Aborting batch conversion.\n"); + return $self; + } + + $progress and $progress->goal($total); + $self->muse("Now converting pod files to HTML.", + ($total > 25) ? " This will take a while more." : () + ); + + $self->_spray_css( $outdir ); + $self->_spray_javascript( $outdir ); + + $self->_do_all_batch_conversions($mod2path, $outdir); + + $progress and $progress->done(sprintf ( + "Done converting %d files.", $self->{"__batch_conv_page_count"} + )); + return $self->_batch_convert_finish($outdir); + return $self; +} + + +sub _do_all_batch_conversions { + my($self, $mod2path, $outdir) = @_; + $self->{"__batch_conv_page_count"} = 0; + + foreach my $module (sort {lc($a) cmp lc($b)} keys %$mod2path) { + $self->_do_one_batch_conversion($module, $mod2path, $outdir); + sleep($SLEEPY - 1) if $SLEEPY; + } + + return; +} + +sub _batch_convert_finish { + my($self, $outdir) = @_; + $self->write_contents_file($outdir); + $self->muse("Done with batch conversion. $$self{'__batch_conv_page_count'} files done."); + $self->muse( "= ", scalar(localtime) ); + $self->progress and $self->progress->done("All done!"); + return; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _do_one_batch_conversion { + my($self, $module, $mod2path, $outdir, $outfile) = @_; + + my $retval; + my $total = scalar keys %$mod2path; + my $infile = $mod2path->{$module}; + my @namelets = grep m/\S/, split "::", $module; + # this can stick around in the contents LoL + my $depth = scalar @namelets; + die "Contentless thingie?! $module $infile" unless @namelets; #sanity + + $outfile ||= do { + my @n = @namelets; + $n[-1] .= $HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION; + $self->filespecsys->catfile( $outdir, @n ); + }; + + my $progress = $self->progress; + + my $page = $self->html_render_class->new; + if(DEBUG > 5) { + $self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: ", + ref($page), " render ($depth) $module => $outfile"); + } elsif(DEBUG > 2) { + $self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: $module => $outfile") + } + + # Give each class a chance to init the converter: + $page->batch_mode_page_object_init($self, $module, $infile, $outfile, $depth) + if $page->can('batch_mode_page_object_init'); + # Init for the index (TOC), too. + $self->batch_mode_page_object_init($page, $module, $infile, $outfile, $depth) + if $self->can('batch_mode_page_object_init'); + + # Now get busy... + $self->makepath($outdir => \@namelets); + + $progress and $progress->reach($self->{"__batch_conv_page_count"}, "Rendering $module"); + + if( $retval = $page->parse_from_file($infile, $outfile) ) { + ++ $self->{"__batch_conv_page_count"} ; + $self->note_for_contents_file( \@namelets, $infile, $outfile ); + } else { + $self->muse("Odd, parse_from_file(\"$infile\", \"$outfile\") returned false."); + } + + $page->batch_mode_page_object_kill($self, $module, $infile, $outfile, $depth) + if $page->can('batch_mode_page_object_kill'); + # The following isn't a typo. Note that it switches $self and $page. + $self->batch_mode_page_object_kill($page, $module, $infile, $outfile, $depth) + if $self->can('batch_mode_page_object_kill'); + + DEBUG > 4 and printf STDERR "%s %sb < $infile %s %sb\n", + $outfile, -s $outfile, $infile, -s $infile + ; + + undef($page); + return $retval; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub filespecsys { $_[0]{'_filespecsys'} || 'File::Spec' } + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub note_for_contents_file { + my($self, $namelets, $infile, $outfile) = @_; + + # I think the infile and outfile parts are never used. -- SMB + # But it's handy to have them around for debugging. + + if( $self->contents_file ) { + my $c = $self->_contents(); + push @$c, + [ join("::", @$namelets), $infile, $outfile, $namelets ] + # 0 1 2 3 + ; + DEBUG > 3 and print STDERR "Noting @$c[-1]\n"; + } + return; +} + +#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + +sub write_contents_file { + my($self, $outdir) = @_; + my $outfile = $self->_contents_filespec($outdir) || return; + + $self->muse("Preparing list of modules for ToC"); + + my($toplevel, # maps toplevelbit => [all submodules] + $toplevel_form_freq, # ends up being 'foo' => 'Foo' + ) = $self->_prep_contents_breakdown; + + my $Contents = eval { $self->_wopen($outfile) }; + if( $Contents ) { + $self->muse( "Writing contents file $outfile" ); + } else { + warn "Couldn't write-open contents file $outfile: $!\nAbort writing to $outfile at all"; + return; + } + + $self->_write_contents_start( $Contents, $outfile, ); + $self->_write_contents_middle( $Contents, $outfile, $toplevel, $toplevel_form_freq ); + $self->_write_contents_end( $Contents, $outfile, ); + return $outfile; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _write_contents_start { + my($self, $Contents, $outfile) = @_; + my $starter = $self->contents_page_start || ''; + + { + my $css_wad = $self->_css_wad_to_markup(1); + if( $css_wad ) { + $starter =~ s{()}{\n$css_wad\n$1}i; # otherwise nevermind + } + + my $javascript_wad = $self->_javascript_wad_to_markup(1); + if( $javascript_wad ) { + $starter =~ s{()}{\n$javascript_wad\n$1}i; # otherwise nevermind + } + } + + unless(print $Contents $starter, "
\n" ) { + warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; + close($Contents); + return 0; + } + return 1; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _write_contents_middle { + my($self, $Contents, $outfile, $toplevel2submodules, $toplevel_form_freq) = @_; + + foreach my $t (sort keys %$toplevel2submodules) { + my @downlines = sort {$a->[-1] cmp $b->[-1]} + @{ $toplevel2submodules->{$t} }; + + printf $Contents qq[
%s
\n
\n], + esc( $t, $toplevel_form_freq->{$t} ) + ; + + my($path, $name); + foreach my $e (@downlines) { + $name = $e->[0]; + $path = join( "/", '.', esc( @{$e->[3]} ) ) + . ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION); + print $Contents qq{ }, esc($name), "  \n"; + } + print $Contents "
\n\n"; + } + return 1; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _write_contents_end { + my($self, $Contents, $outfile) = @_; + unless( + print $Contents "
\n", + $self->contents_page_end || '', + ) { + warn "Couldn't write to $outfile: $!"; + } + close($Contents) or warn "Couldn't close $outfile: $!"; + return 1; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _prep_contents_breakdown { + my($self) = @_; + my $contents = $self->_contents; + my %toplevel; # maps lctoplevelbit => [all submodules] + my %toplevel_form_freq; # ends up being 'foo' => 'Foo' + # (mapping anycase forms to most freq form) + + foreach my $entry (@$contents) { + my $toplevel = + $entry->[0] =~ m/^perl\w*$/ ? 'perl_core_docs' + # group all the perlwhatever docs together + : $entry->[3][0] # normal case + ; + ++$toplevel_form_freq{ lc $toplevel }{ $toplevel }; + push @{ $toplevel{ lc $toplevel } }, $entry; + push @$entry, lc($entry->[0]); # add a sort-order key to the end + } + + foreach my $toplevel (sort keys %toplevel) { + my $fgroup = $toplevel_form_freq{$toplevel}; + $toplevel_form_freq{$toplevel} = + ( + sort { $fgroup->{$b} <=> $fgroup->{$a} or $a cmp $b } + keys %$fgroup + # This hash is extremely unlikely to have more than 4 members, so this + # sort isn't so very wasteful + )[0]; + } + + return(\%toplevel, \%toplevel_form_freq) if wantarray; + return \%toplevel; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _contents_filespec { + my($self, $outdir) = @_; + my $outfile = $self->contents_file; + return unless $outfile; + return $self->filespecsys->catfile( $outdir, $outfile ); +} + +#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + +sub makepath { + my($self, $outdir, $namelets) = @_; + return unless @$namelets > 1; + for my $i (0 .. ($#$namelets - 1)) { + my $dir = $self->filespecsys->catdir( $outdir, @$namelets[0 .. $i] ); + if(-e $dir) { + die "$dir exists but not as a directory!?" unless -d $dir; + next; + } + DEBUG > 3 and print STDERR " Making $dir\n"; + mkdir $dir, 0777 + or die "Can't mkdir $dir: $!\nAborting" + ; + } + return; +} + +#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + +sub batch_mode_page_object_init { + my $self = shift; + my($page, $module, $infile, $outfile, $depth) = @_; + + # TODO: any further options to percolate onto this new object here? + + $page->default_title($module); + $page->index( $self->index ); + + $page->html_css( $self-> _css_wad_to_markup($depth) ); + $page->html_javascript( $self->_javascript_wad_to_markup($depth) ); + + $self->add_header_backlink($page, $module, $infile, $outfile, $depth); + $self->add_footer_backlink($page, $module, $infile, $outfile, $depth); + + + return $self; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub add_header_backlink { + my $self = shift; + return if $self->no_contents_links; + my($page, $module, $infile, $outfile, $depth) = @_; + $page->html_header_after_title( join '', + $page->html_header_after_title || '', + + qq[

<<

\n], + ) + if $self->contents_file + ; + return; +} + +sub add_footer_backlink { + my $self = shift; + return if $self->no_contents_links; + my($page, $module, $infile, $outfile, $depth) = @_; + $page->html_footer( join '', + qq[

<<

\n], + + $page->html_footer || '', + ) + if $self->contents_file + ; + return; +} + +sub url_up_to_contents { + my($self, $depth) = @_; + --$depth; + return join '/', ('..') x $depth, esc($self->contents_file); +} + +#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + +sub find_all_pods { + my($self, $dirs) = @_; + # You can override find_all_pods in a subclass if you want to + # do extra filtering or whatnot. But for the moment, we just + # pass to modnames2paths: + return $self->modnames2paths($dirs); +} + +#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + +sub modnames2paths { # return a hashref mapping modulenames => paths + my($self, $dirs) = @_; + + my $m2p; + { + my $search = $self->search_class->new; + DEBUG and print STDERR "Searching via $search\n"; + $search->verbose(1) if DEBUG > 10; + $search->progress( $self->progress->copy->goal(0) ) if $self->progress; + $search->shadows(0); # don't bother noting shadowed files + $search->inc( $dirs ? 0 : 1 ); + $search->survey( $dirs ? @$dirs : () ); + $m2p = $search->name2path; + die "What, no name2path?!" unless $m2p; + } + + $self->muse("That's odd... no modules found!") unless keys %$m2p; + if( DEBUG > 4 ) { + print STDERR "Modules found (name => path):\n"; + foreach my $m (sort {lc($a) cmp lc($b)} keys %$m2p) { + print STDERR " $m $$m2p{$m}\n"; + } + print STDERR "(total ", scalar(keys %$m2p), ")\n\n"; + } elsif( DEBUG ) { + print STDERR "Found ", scalar(keys %$m2p), " modules.\n"; + } + $self->muse( "Found ", scalar(keys %$m2p), " modules." ); + + # return the Foo::Bar => /whatever/Foo/Bar.pod|pm hashref + return $m2p; +} + +#=========================================================================== + +sub _wopen { + # this is abstracted out so that the daemon class can override it + my($self, $outpath) = @_; + require Symbol; + my $out_fh = Symbol::gensym(); + DEBUG > 5 and print STDERR "Write-opening to $outpath\n"; + return $out_fh if open($out_fh, "> $outpath"); + require Carp; + Carp::croak("Can't write-open $outpath: $!"); +} + +#========================================================================== + +sub add_css { + my($self, $url, $is_default, $name, $content_type, $media, $_code) = @_; + return unless $url; + unless($name) { + # cook up a reasonable name based on the URL + $name = $url; + if( $name !~ m/\?/ and $name =~ m{([^/]+)$}s ) { + $name = $1; + $name =~ s/\.css//i; + } + } + $media ||= 'all'; + $content_type ||= 'text/css'; + + my $bunch = [$url, $name, $content_type, $media, $_code]; + if($is_default) { unshift @{ $self->_css_wad }, $bunch } + else { push @{ $self->_css_wad }, $bunch } + return; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _spray_css { + my($self, $outdir) = @_; + + return unless $self->css_flurry(); + $self->_gen_css_wad(); + + my $lol = $self->_css_wad; + foreach my $chunk (@$lol) { + my $url = $chunk->[0]; + my $outfile; + if( ref($chunk->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.css$)} ) { + $outfile = $self->filespecsys->catfile( $outdir, "$1" ); + DEBUG > 5 and print STDERR "Noting $$chunk[0] as a file I'll create.\n"; + } else { + DEBUG > 5 and print STDERR "OK, noting $$chunk[0] as an external CSS.\n"; + # Requires no further attention. + next; + } + + #$self->muse( "Writing autogenerated CSS file $outfile" ); + my $Cssout = $self->_wopen($outfile); + print $Cssout ${$chunk->[-1]} + or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; + close($Cssout); + DEBUG > 5 and print STDERR "Wrote $outfile\n"; + } + + return; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +sub _css_wad_to_markup { + my($self, $depth) = @_; + + my @css = @{ $self->_css_wad || return '' }; + return '' unless @css; + + my $rel = 'stylesheet'; + my $out = ''; + + --$depth; + my $uplink = $depth ? ('../' x $depth) : ''; + + foreach my $chunk (@css) { + next unless $chunk and @$chunk; + + my( $url1, $url2, $title, $type, $media) = ( + $self->_maybe_uplink( $chunk->[0], $uplink ), + esc(grep !ref($_), @$chunk) + ); + + $out .= qq{\n}; + + $rel = 'alternate stylesheet'; # alternates = all non-first iterations + } + return $out; +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub _maybe_uplink { + # if the given URL looks relative, return the given uplink string -- + # otherwise return emptystring + my($self, $url, $uplink) = @_; + ($url =~ m{^\./} or $url !~ m{[/\:]} ) + ? $uplink + : '' + # qualify it, if/as needed +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub _gen_css_wad { + my $self = $_[0]; + my $css_template = $self->_css_template; + foreach my $variation ( + + # Commented out for sake of concision: + # + # 011n=black_with_red_on_white + # 001n=black_with_yellow_on_white + # 101n=black_with_green_on_white + # 110=white_with_yellow_on_black + # 010=white_with_green_on_black + # 011=white_with_blue_on_black + # 100=white_with_red_on_black + '110n=blkbluw', # black_with_blue_on_white + '010n=blkmagw', # black_with_magenta_on_white + '100n=blkcynw', # black_with_cyan_on_white + '101=whtprpk', # white_with_purple_on_black + '001=whtnavk', # white_with_navy_blue_on_black + '010a=grygrnk', # grey_with_green_on_black + '010b=whtgrng', # white_with_green_on_grey + '101an=blkgrng', # black_with_green_on_grey + '101bn=grygrnw', # grey_with_green_on_white + ) { + + my $outname = $variation; + my($flipmode, @swap) = ( ($4 || ''), $1,$2,$3) + if $outname =~ s/^([012])([012])([[012])([a-z]*)=?//s; + @swap = () if '010' eq join '', @swap; # 010 is a swop-no-op! + + my $this_css = + "/* This file is autogenerated. Do not edit. $variation */\n\n" + . $css_template; + + # Only look at three-digitty colors, for now at least. + if( $flipmode =~ m/n/ ) { + $this_css =~ s/(#[0-9a-fA-F]{3})\b/_color_negate($1)/eg; + $this_css =~ s/\bthin\b/medium/g; + } + $this_css =~ s<#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b> + < join '', '#', ($1,$2,$3)[@swap] >eg if @swap; + + if( $flipmode =~ m/a/) + { $this_css =~ s/#fff\b/#999/gi } # black -> dark grey + elsif($flipmode =~ m/b/) + { $this_css =~ s/#000\b/#666/gi } # white -> light grey + + my $name = $outname; + $name =~ tr/-_/ /; + $self->add_css( "_$outname.css", 0, $name, 0, 0, \$this_css); + } + + # Now a few indexless variations: + for (my ($outfile, $variation) = each %{{ + blkbluw => 'black_with_blue_on_white', + whtpurk => 'white_with_purple_on_black', + whtgrng => 'white_with_green_on_grey', + grygrnw => 'grey_with_green_on_white', + }}) { + my $this_css = join "\n", + "/* This file is autogenerated. Do not edit. $outfile */\n", + "\@import url(\"./_$variation.css\");", + ".indexgroup { display: none; }", + "\n", + ; + my $name = $outfile; + $name =~ tr/-_/ /; + $self->add_css( "_$outfile.css", 0, $name, 0, 0, \$this_css); + } + + return; +} + +sub _color_negate { + my $x = lc $_[0]; + $x =~ tr[0123456789abcdef] + [fedcba9876543210]; + return $x; +} + +#=========================================================================== + +sub add_javascript { + my($self, $url, $content_type, $_code) = @_; + return unless $url; + push @{ $self->_javascript_wad }, [ + $url, $content_type || 'text/javascript', $_code + ]; + return; +} + +sub _spray_javascript { + my($self, $outdir) = @_; + return unless $self->javascript_flurry(); + $self->_gen_javascript_wad(); + + my $lol = $self->_javascript_wad; + foreach my $script (@$lol) { + my $url = $script->[0]; + my $outfile; + + if( ref($script->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.js$)} ) { + $outfile = $self->filespecsys->catfile( $outdir, "$1" ); + DEBUG > 5 and print STDERR "Noting $$script[0] as a file I'll create.\n"; + } else { + DEBUG > 5 and print STDERR "OK, noting $$script[0] as an external JavaScript.\n"; + next; + } + + #$self->muse( "Writing JavaScript file $outfile" ); + my $Jsout = $self->_wopen($outfile); + + print $Jsout ${$script->[-1]} + or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; + close($Jsout); + DEBUG > 5 and print STDERR "Wrote $outfile\n"; + } + + return; +} + +sub _gen_javascript_wad { + my $self = $_[0]; + my $js_code = $self->_javascript || return; + $self->add_javascript( "_podly.js", 0, \$js_code); + return; +} + +sub _javascript_wad_to_markup { + my($self, $depth) = @_; + + my @scripts = @{ $self->_javascript_wad || return '' }; + return '' unless @scripts; + + my $out = ''; + + --$depth; + my $uplink = $depth ? ('../' x $depth) : ''; + + foreach my $s (@scripts) { + next unless $s and @$s; + + my( $url1, $url2, $type, $media) = ( + $self->_maybe_uplink( $s->[0], $uplink ), + esc(grep !ref($_), @$s) + ); + + $out .= qq{\n}; + } + return $out; +} + +#=========================================================================== + +sub _css_template { return $CSS } +sub _javascript { return $JAVASCRIPT } + +$CSS = <<'EOCSS'; +/* For accessibility reasons, never specify text sizes in px/pt/pc/in/cm/mm */ + +@media all { .hide { display: none; } } + +@media print { + .noprint, div.indexgroup, .backlinktop, .backlinkbottom { display: none } + + * { + border-color: black !important; + color: black !important; + background-color: transparent !important; + background-image: none !important; + } + + dl.superindex > dd { + word-spacing: .6em; + } +} + +@media aural, braille, embossed { + div.indexgroup { display: none; } /* Too noisy, don't you think? */ + dl.superindex > dt:before { content: "Group "; } + dl.superindex > dt:after { content: " contains:"; } + .backlinktop a:before { content: "Back to contents"; } + .backlinkbottom a:before { content: "Back to contents"; } +} + +@media aural { + dl.superindex > dt { pause-before: 600ms; } +} + +@media screen, tty, tv, projection { + .noscreen { display: none; } + + a:link { color: #7070ff; text-decoration: underline; } + a:visited { color: #e030ff; text-decoration: underline; } + a:active { color: #800000; text-decoration: underline; } + body.contentspage a { text-decoration: none; } + a.u { color: #fff !important; text-decoration: none; } + + body.pod { + margin: 0 5px; + color: #fff; + background-color: #000; + } + + body.pod h1, body.pod h2, body.pod h3, body.pod h4 { + font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + margin-top: 1.2em; + margin-bottom: .1em; + border-top: thin solid transparent; + /* margin-left: -5px; border-left: 2px #7070ff solid; padding-left: 3px; */ + } + + body.pod h1 { border-top-color: #0a0; } + body.pod h2 { border-top-color: #080; } + body.pod h3 { border-top-color: #040; } + body.pod h4 { border-top-color: #010; } + + p.backlinktop + h1 { border-top: none; margin-top: 0em; } + p.backlinktop + h2 { border-top: none; margin-top: 0em; } + p.backlinktop + h3 { border-top: none; margin-top: 0em; } + p.backlinktop + h4 { border-top: none; margin-top: 0em; } + + body.pod dt { + font-size: 105%; /* just a wee bit more than normal */ + } + + .indexgroup { font-size: 80%; } + + .backlinktop, .backlinkbottom { + margin-left: -5px; + margin-right: -5px; + background-color: #040; + border-top: thin solid #050; + border-bottom: thin solid #050; + } + + .backlinktop a, .backlinkbottom a { + text-decoration: none; + color: #080; + background-color: #000; + border: thin solid #0d0; + } + .backlinkbottom { margin-bottom: 0; padding-bottom: 0; } + .backlinktop { margin-top: 0; padding-top: 0; } + + body.contentspage { + color: #fff; + background-color: #000; + } + + body.contentspage h1 { + color: #0d0; + margin-left: 1em; + margin-right: 1em; + text-indent: -.9em; + font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + border-top: thin solid #fff; + border-bottom: thin solid #fff; + text-align: center; + } + + dl.superindex > dt { + font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + font-size: 90%; + margin-top: .45em; + /* margin-bottom: -.15em; */ + } + dl.superindex > dd { + word-spacing: .6em; /* most important rule here! */ + } + dl.superindex > a:link { + text-decoration: none; + color: #fff; + } + + .contentsfooty { + border-top: thin solid #999; + font-size: 90%; + } + +} + +/* The End */ + +EOCSS + +#========================================================================== + +$JAVASCRIPT = <<'EOJAVASCRIPT'; + +// From http://www.alistapart.com/articles/alternate/ + +function setActiveStyleSheet(title) { + var i, a, main; + for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { + if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { + a.disabled = true; + if(a.getAttribute("title") == title) a.disabled = false; + } + } +} + +function getActiveStyleSheet() { + var i, a; + for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { + if( a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title") + && !a.disabled + ) return a.getAttribute("title"); + } + return null; +} + +function getPreferredStyleSheet() { + var i, a; + for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { + if( a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("rel").indexOf("alt") == -1 + && a.getAttribute("title") + ) return a.getAttribute("title"); + } + return null; +} + +function createCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else expires = ""; + document.cookie = name+"="+value+expires+"; path=/"; +} + +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0 ; i < ca.length ; i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; +} + +window.onload = function(e) { + var cookie = readCookie("style"); + var title = cookie ? cookie : getPreferredStyleSheet(); + setActiveStyleSheet(title); +} + +window.onunload = function(e) { + var title = getActiveStyleSheet(); + createCookie("style", title, 365); +} + +var cookie = readCookie("style"); +var title = cookie ? cookie : getPreferredStyleSheet(); +setActiveStyleSheet(title); + +// The End + +EOJAVASCRIPT + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +1; +__END__ + + +=head1 NAME + +Pod::Simple::HTMLBatch - convert several Pod files to several HTML files + +=head1 SYNOPSIS + + perl -MPod::Simple::HTMLBatch -e 'Pod::Simple::HTMLBatch::go' in out + + +=head1 DESCRIPTION + +This module is used for running batch-conversions of a lot of HTML +documents + +This class is NOT a subclass of Pod::Simple::HTML +(nor of bad old Pod::Html) -- although it uses +Pod::Simple::HTML for doing the conversion of each document. + +The normal use of this class is like so: + + use Pod::Simple::HTMLBatch; + my $batchconv = Pod::Simple::HTMLBatch->new; + $batchconv->some_option( some_value ); + $batchconv->some_other_option( some_other_value ); + $batchconv->batch_convert( \@search_dirs, $output_dir ); + +=head2 FROM THE COMMAND LINE + +Note that this class also provides +(but does not export) the function Pod::Simple::HTMLBatch::go. +This is basically just a shortcut for C<< +Pod::Simple::HTMLBatch->batch_convert(@ARGV) >>. +It's meant to be handy for calling from the command line. + +However, the shortcut requires that you specify exactly two command-line +arguments, C and C. + +Example: + + % mkdir out_html + % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go @INC out_html + (to convert the pod from Perl's @INC + files under the directory ./out_html) + +(Note that the command line there contains a literal atsign-I-N-C. This +is handled as a special case by batch_convert, in order to save you having +to enter the odd-looking "" as the first command-line parameter when you +mean "just use whatever's in @INC".) + +Example: + + % mkdir ../seekrut + % chmod og-rx ../seekrut + % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go . ../seekrut + (to convert the pod under the current dir into HTML + files under the directory ./seekrut) + +Example: + + % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go happydocs . + (to convert all pod from happydocs into the current directory) + + + +=head1 MAIN METHODS + +=over + +=item $batchconv = Pod::Simple::HTMLBatch->new; + +This creates a new batch converter. The method doesn't take parameters. +To change the converter's attributes, use the L<"/ACCESSOR METHODS"> +below. + +=item $batchconv->batch_convert( I, I ); + +This searches the directories given in I and writes +HTML files for each of these to a corresponding directory +in I. The directory I must exist. + +=item $batchconv->batch_convert( undef , ...); + +=item $batchconv->batch_convert( q{@INC}, ...); + +These two values for I specify that the normal Perl @INC + +=item $batchconv->batch_convert( \@dirs , ...); + +This specifies that the input directories are the items in +the arrayref C<\@dirs>. + +=item $batchconv->batch_convert( "somedir" , ...); + +This specifies that the director "somedir" is the input. +(This can be an absolute or relative path, it doesn't matter.) + +A common value you might want would be just "." for the current +directory: + + $batchconv->batch_convert( "." , ...); + + +=item $batchconv->batch_convert( 'somedir:someother:also' , ...); + +This specifies that you want the dirs "somedir", "someother", and "also" +scanned, just as if you'd passed the arrayref +C<[qw( somedir someother also)]>. Note that a ":"-separator is normal +under Unix, but Under MSWin, you'll need C<'somedir;someother;also'> +instead, since the pathsep on MSWin is ";" instead of ":". (And +I is because ":" often comes up in paths, like +C<"c:/perl/lib">.) + +(Exactly what separator character should be used, is gotten from +C<$Config::Config{'path_sep'}>, via the L module.) + +=item $batchconv->batch_convert( ... , undef ); + +This specifies that you want the HTML output to go into the current +directory. + +(Note that a missing or undefined value means a different thing in +the first slot than in the second. That's so that C +with no arguments (or undef arguments) means "go from @INC, into +the current directory.) + +=item $batchconv->batch_convert( ... , 'somedir' ); + +This specifies that you want the HTML output to go into the +directory 'somedir'. +(This can be an absolute or relative path, it doesn't matter.) + +=back + + +Note that you can also call C as a class method, +like so: + + Pod::Simple::HTMLBatch->batch_convert( ... ); + +That is just short for this: + + Pod::Simple::HTMLBatch-> new-> batch_convert(...); + +That is, it runs a conversion with default options, for +whatever inputdirs and output dir you specify. + + +=head2 ACCESSOR METHODS + +The following are all accessor methods -- that is, they don't do anything +on their own, but just alter the contents of the conversion object, +which comprises the options for this particular batch conversion. + +We show the "put" form of the accessors below (i.e., the syntax you use +for setting the accessor to a specific value). But you can also +call each method with no parameters to get its current value. For +example, C<< $self->contents_file() >> returns the current value of +the contents_file attribute. + +=over + + +=item $batchconv->verbose( I ); + +This controls how verbose to be during batch conversion, as far as +notes to STDOUT (or whatever is C to and I +from the parser. + +Ls handle TAP I. You can configure them +and load custom handlers using the C parameter to L. + +Ls handle TAP I. You can load custom formatters by +using the C parameter to L. To configure a formatter, +you currently need to instantiate it outside of L and pass it in +with the C parameter to L. This I be addressed by adding +a I parameter to L in the future. + +=head2 C + +L version C<0.30> supports C. + +To load C plugins, you'll need to use the C +parameter to C, typically from your C. For example: + + Module::Build->new( + module_name => 'MyApp', + test_file_exts => [qw(.t .tap .txt)], + use_tap_harness => 1, + tap_harness_args => { + sources => { + MyCustom => {}, + File => { + extensions => ['.tap', '.txt'], + }, + }, + formatter_class => 'TAP::Formatter::HTML', + }, + build_requires => { + 'Module::Build' => '0.30', + 'TAP::Harness' => '3.18', + }, + )->create_build_script; + +See L + +=head2 C + +L does not support L out-of-the-box. + +=head2 C + +L supports C plugins, and has a plugin system of its +own. See L, L and L +for more details. + +=head1 WRITING PLUGINS + +If you can't configure C to do what you want, and you can't find +an existing plugin, consider writing one. + +The two primary use cases supported by L for plugins are I +and I: + +=over 2 + +=item Customize how TAP gets into the parser + +To do this, you can either extend an existing L, +or write your own. It's a pretty simple API, and they can be loaded and +configured using the C parameter to L. + +=item Customize how TAP results are output from the parser + +To do this, you can either extend an existing L, or write your +own. Writing formatters are a bit more involved than writing a +I, as you'll need to understand the L API. A +good place to start is by understanding how L works. + +Custom formatters can be loaded configured using the C +parameter to L. + +=back + +=head1 SUBCLASSING + +If you can't configure C to do exactly what you want, and writing +a plugin isn't an option, consider extending it. It is designed to be (mostly) +easy to subclass, though the cases when sub-classing is necessary should be few +and far between. + +=head2 Methods + +The following methods are ones you may wish to override if you want to +subclass C. + +=over 4 + +=item L + +=item L + +=item L + +=back + +=cut + +=head1 REPLACING + +If you like the C utility and L but you want your +own harness, all you need to do is write one and provide C and +C methods. Then you can use the C utility like so: + + prove --harness My::Test::Harness + +Note that while C accepts a list of tests (or things to be +tested), C has a fairly rich set of arguments. You'll probably want +to read over this code carefully to see how all of them are being used. + +=head1 SEE ALSO + +L + +=cut + +# vim:ts=4:sw=4:et:sta diff --git a/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Beyond.pod b/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Beyond.pod new file mode 100644 index 0000000000000000000000000000000000000000..989e2efc146e696cb9d5c061450c78fe97072222 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Beyond.pod @@ -0,0 +1,426 @@ +=head1 NAME + +Test::Harness::Beyond - Beyond make test + +=head1 Beyond make test + +Test::Harness is responsible for running test scripts, analysing +their output and reporting success or failure. When I type +F (or F<./Build test>) for a module, Test::Harness is usually +used to run the tests (not all modules use Test::Harness but the +majority do). + +To start exploring some of the features of Test::Harness I need to +switch from F to the F command (which ships with +Test::Harness). For the following examples I'll also need a recent +version of Test::Harness installed; 3.14 is current as I write. + +For the examples I'm going to assume that we're working with a +'normal' Perl module distribution. Specifically I'll assume that +typing F or F<./Build> causes the built, ready-to-install module +code to be available below ./blib/lib and ./blib/arch and that +there's a directory called 't' that contains our tests. Test::Harness +isn't hardwired to that configuration but it saves me from explaining +which files live where for each example. + +Back to F; like F it runs a test suite - but it +provides far more control over which tests are executed, in what +order and how their results are reported. Typically F +runs all the test scripts below the 't' directory. To do the same +thing with prove I type: + + prove -rb t + +The switches here are -r to recurse into any directories below 't' +and -b which adds ./blib/lib and ./blib/arch to Perl's include path +so that the tests can find the code they will be testing. If I'm +testing a module of which an earlier version is already installed +I need to be careful about the include path to make sure I'm not +running my tests against the installed version rather than the new +one that I'm working on. + +Unlike F, typing F doesn't automatically rebuild +my module. If I forget to make before prove I will be testing against +older versions of those files - which inevitably leads to confusion. +I either get into the habit of typing + + make && prove -rb t + +or - if I have no XS code that needs to be built I use the modules +below F instead + + prove -Ilib -r t + +So far I've shown you nothing that F doesn't do. Let's +fix that. + +=head2 Saved State + +If I have failing tests in a test suite that consists of more than +a handful of scripts and takes more than a few seconds to run it +rapidly becomes tedious to run the whole test suite repeatedly as +I track down the problems. + +I can tell prove just to run the tests that are failing like this: + + prove -b t/this_fails.t t/so_does_this.t + +That speeds things up but I have to make a note of which tests are +failing and make sure that I run those tests. Instead I can use +prove's --state switch and have it keep track of failing tests for +me. First I do a complete run of the test suite and tell prove to +save the results: + + prove -rb --state=save t + +That stores a machine readable summary of the test run in a file +called '.prove' in the current directory. If I have failures I can +then run just the failing scripts like this: + + prove -b --state=failed + +I can also tell prove to save the results again so that it updates +its idea of which tests failed: + + prove -b --state=failed,save + +As soon as one of my failing tests passes it will be removed from +the list of failed tests. Eventually I fix them all and prove can +find no failing tests to run: + + Files=0, Tests=0, 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) + Result: NOTESTS + +As I work on a particular part of my module it's most likely that +the tests that cover that code will fail. I'd like to run the whole +test suite but have it prioritize these 'hot' tests. I can tell +prove to do this: + + prove -rb --state=hot,save t + +All the tests will run but those that failed most recently will be +run first. If no tests have failed since I started saving state all +tests will run in their normal order. This combines full test +coverage with early notification of failures. + +The --state switch supports a number of options; for example to run +failed tests first followed by all remaining tests ordered by the +timestamps of the test scripts - and save the results - I can use + + prove -rb --state=failed,new,save t + +See the prove documentation (type prove --man) for the full list +of state options. + +When I tell prove to save state it writes a file called '.prove' +('_prove' on Windows) in the current directory. It's a YAML document +so it's quite easy to write tools of your own that work on the saved +test state - but the format isn't officially documented so it might +change without (much) warning in the future. + +=head2 Parallel Testing + +If my tests take too long to run I may be able to speed them up by +running multiple test scripts in parallel. This is particularly +effective if the tests are I/O bound or if I have multiple CPU +cores. I tell prove to run my tests in parallel like this: + + prove -rb -j 9 t + +The -j switch enables parallel testing; the number that follows it +is the maximum number of tests to run in parallel. Sometimes tests +that pass when run sequentially will fail when run in parallel. For +example if two different test scripts use the same temporary file +or attempt to listen on the same socket I'll have problems running +them in parallel. If I see unexpected failures I need to check my +tests to work out which of them are trampling on the same resource +and rename temporary files or add locks as appropriate. + +To get the most performance benefit I want to have the test scripts +that take the longest to run start first - otherwise I'll be waiting +for the one test that takes nearly a minute to complete after all +the others are done. I can use the --state switch to run the tests +in slowest to fastest order: + + prove -rb -j 9 --state=slow,save t + +=head2 Non-Perl Tests + +The Test Anything Protocol (http://testanything.org/) isn't just +for Perl. Just about any language can be used to write tests that +output TAP. There are TAP based testing libraries for C, C++, PHP, +Python and many others. If I can't find a TAP library for my language +of choice it's easy to generate valid TAP. It looks like this: + + 1..3 + ok 1 - init OK + ok 2 - opened file + not ok 3 - appended to file + +The first line is the plan - it specifies the number of tests I'm +going to run so that it's easy to check that the test script didn't +exit before running all the expected tests. The following lines are +the test results - 'ok' for pass, 'not ok' for fail. Each test has +a number and, optionally, a description. And that's it. Any language +that can produce output like that on STDOUT can be used to write +tests. + +Recently I've been rekindling a two-decades-old interest in Forth. +Evidently I have a masochistic streak that even Perl can't satisfy. +I want to write tests in Forth and run them using prove (you can +find my gforth TAP experiments at +https://svn.hexten.net/andy/Forth/Testing/). I can use the --exec +switch to tell prove to run the tests using gforth like this: + + prove -r --exec gforth t + +Alternately, if the language used to write my tests allows a shebang +line I can use that to specify the interpreter. Here's a test written +in PHP: + + #!/usr/bin/php + + +If I save that as t/phptest.t the shebang line will ensure that it +runs correctly along with all my other tests. + +=head2 Mixing it up + +Subtle interdependencies between test programs can mask problems - +for example an earlier test may neglect to remove a temporary file +that affects the behaviour of a later test. To find this kind of +problem I use the --shuffle and --reverse options to run my tests +in random or reversed order. + +=head2 Rolling My Own + +If I need a feature that prove doesn't provide I can easily write my own. + +Typically you'll want to change how TAP gets I into and I +from the parser. L supports arbitrary plugins, and L +supports custom I and I that you can load using +either L or L; there are many examples to base mine on. +For more details see L, L, and +L. + +If writing a plugin is not enough, you can write your own test harness; one of +the motives for the 3.00 rewrite of Test::Harness was to make it easier to +subclass and extend. + +The Test::Harness module is a compatibility wrapper around TAP::Harness. +For new applications I should use TAP::Harness directly. As we'll +see, prove uses TAP::Harness. + +When I run prove it processes its arguments, figures out which test +scripts to run and then passes control to TAP::Harness to run the +tests, parse, analyse and present the results. By subclassing +TAP::Harness I can customise many aspects of the test run. + +I want to log my test results in a database so I can track them +over time. To do this I override the summary method in TAP::Harness. +I start with a simple prototype that dumps the results as a YAML +document: + + package My::TAP::Harness; + + use base 'TAP::Harness'; + use YAML; + + sub summary { + my ( $self, $aggregate ) = @_; + print Dump( $aggregate ); + $self->SUPER::summary( $aggregate ); + } + + 1; + +I need to tell prove to use my My::TAP::Harness. If My::TAP::Harness +is on Perl's @INC include path I can + + prove --harness=My::TAP::Harness -rb t + +If I don't have My::TAP::Harness installed on @INC I need to provide +the correct path to perl when I run prove: + + perl -Ilib `which prove` --harness=My::TAP::Harness -rb t + +I can incorporate these options into my own version of prove. It's +pretty simple. Most of the work of prove is handled by App::Prove. +The important code in prove is just: + + use App::Prove; + + my $app = App::Prove->new; + $app->process_args(@ARGV); + exit( $app->run ? 0 : 1 ); + +If I write a subclass of App::Prove I can customise any aspect of +the test runner while inheriting all of prove's behaviour. Here's +myprove: + + #!/usr/bin/env perl use lib qw( lib ); # Add ./lib to @INC + use App::Prove; + + my $app = App::Prove->new; + + # Use custom TAP::Harness subclass + $app->harness( 'My::TAP::Harness' ); + + $app->process_args( @ARGV ); exit( $app->run ? 0 : 1 ); + +Now I can run my tests like this + + ./myprove -rb t + +=head2 Deeper Customisation + +Now that I know how to subclass and replace TAP::Harness I can +replace any other part of the harness. To do that I need to know +which classes are responsible for which functionality. Here's a +brief guided tour; the default class for each component is shown +in parentheses. Normally any replacements I write will be subclasses +of these default classes. + +When I run my tests TAP::Harness creates a scheduler +(TAP::Parser::Scheduler) to work out the running order for the +tests, an aggregator (TAP::Parser::Aggregator) to collect and analyse +the test results and a formatter (TAP::Formatter::Console) to display +those results. + +If I'm running my tests in parallel there may also be a multiplexer +(TAP::Parser::Multiplexer) - the component that allows multiple +tests to run simultaneously. + +Once it has created those helpers TAP::Harness starts running the +tests. For each test it creates a new parser (TAP::Parser) which +is responsible for running the test script and parsing its output. + +To replace any of these components I call one of these harness +methods with the name of the replacement class: + + aggregator_class + formatter_class + multiplexer_class + parser_class + scheduler_class + +For example, to replace the aggregator I would + + $harness->aggregator_class( 'My::Aggregator' ); + +Alternately I can supply the names of my substitute classes to the +TAP::Harness constructor: + + my $harness = TAP::Harness->new( + { aggregator_class => 'My::Aggregator' } + ); + +If I need to reach even deeper into the internals of the harness I +can replace the classes that TAP::Parser uses to execute test scripts +and tokenise their output. Before running a test script TAP::Parser +creates a grammar (TAP::Parser::Grammar) to decode the raw TAP into +tokens, a result factory (TAP::Parser::ResultFactory) to turn the +decoded TAP results into objects and, depending on whether it's +running a test script or reading TAP from a file, scalar or array +a source or an iterator (TAP::Parser::IteratorFactory). + +Each of these objects may be replaced by calling one of these parser +methods: + + source_class + perl_source_class + grammar_class + iterator_factory_class + result_factory_class + +=head2 Callbacks + +As an alternative to subclassing the components I need to change I +can attach callbacks to the default classes. TAP::Harness exposes +these callbacks: + + parser_args Tweak the parameters used to create the parser + made_parser Just made a new parser + before_runtests About to run tests + after_runtests Have run all tests + after_test Have run an individual test script + +TAP::Parser also supports callbacks; bailout, comment, plan, test, +unknown, version and yaml are called for the corresponding TAP +result types, ALL is called for all results, ELSE is called for all +results for which a named callback is not installed and EOF is +called once at the end of each TAP stream. + +To install a callback I pass the name of the callback and a subroutine +reference to TAP::Harness or TAP::Parser's callback method: + + $harness->callback( after_test => sub { + my ( $script, $desc, $parser ) = @_; + } ); + +I can also pass callbacks to the constructor: + + my $harness = TAP::Harness->new({ + callbacks => { + after_test => sub { + my ( $script, $desc, $parser ) = @_; + # Do something interesting here + } + } + }); + +When it comes to altering the behaviour of the test harness there's +more than one way to do it. Which way is best depends on my +requirements. In general if I only want to observe test execution +without changing the harness' behaviour (for example to log test +results to a database) I choose callbacks. If I want to make the +harness behave differently subclassing gives me more control. + +=head2 Parsing TAP + +Perhaps I don't need a complete test harness. If I already have a +TAP test log that I need to parse all I need is TAP::Parser and the +various classes it depends upon. Here's the code I need to run a +test and parse its TAP output + + use TAP::Parser; + + my $parser = TAP::Parser->new( { source => 't/simple.t' } ); + while ( my $result = $parser->next ) { + print $result->as_string, "\n"; + } + +Alternately I can pass an open filehandle as source and have the +parser read from that rather than attempting to run a test script: + + open my $tap, '<', 'tests.tap' + or die "Can't read TAP transcript ($!)\n"; + my $parser = TAP::Parser->new( { source => $tap } ); + while ( my $result = $parser->next ) { + print $result->as_string, "\n"; + } + +This approach is useful if I need to convert my TAP based test +results into some other representation. See TAP::Convert::TET +(http://search.cpan.org/dist/TAP-Convert-TET/) for an example of +this approach. + +=head2 Getting Support + +The Test::Harness developers hang out on the tapx-dev mailing +list[1]. For discussion of general, language independent TAP issues +there's the tap-l[2] list. Finally there's a wiki dedicated to the +Test Anything Protocol[3]. Contributions to the wiki, patches and +suggestions are all welcome. + +=for comment + The URLs in [1] and [2] point to 404 pages. What are currently the + correct URLs? + +[1] L +[2] L +[3] L diff --git a/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Env.pm b/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Env.pm new file mode 100644 index 0000000000000000000000000000000000000000..077626df2deb54f2379af512fd0d5186c8b91901 --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/TAP/Harness/Env.pm @@ -0,0 +1,215 @@ +package TAP::Harness::Env; + +use strict; +use warnings; + +use constant IS_VMS => ( $^O eq 'VMS' ); +use TAP::Object; +use Text::ParseWords qw/shellwords/; + +our $VERSION = '3.42'; + +# Get the parts of @INC which are changed from the stock list AND +# preserve reordering of stock directories. +sub _filtered_inc_vms { + my @inc = grep { !ref } @INC; #28567 + + # VMS has a 255-byte limit on the length of %ENV entries, so + # toss the ones that involve perl_root, the install location + @inc = grep { !/perl_root/i } @inc; + + my @default_inc = _default_inc(); + + my @new_inc; + my %seen; + for my $dir (@inc) { + next if $seen{$dir}++; + + if ( $dir eq ( $default_inc[0] || '' ) ) { + shift @default_inc; + } + else { + push @new_inc, $dir; + } + + shift @default_inc while @default_inc and $seen{ $default_inc[0] }; + } + return @new_inc; +} + +# Cache this to avoid repeatedly shelling out to Perl. +my @inc; + +sub _default_inc { + return @inc if @inc; + + local $ENV{PERL5LIB}; + local $ENV{PERLLIB}; + + my $perl = $ENV{HARNESS_PERL} || $^X; + + # Avoid using -l for the benefit of Perl 6 + chomp( @inc = `"$perl" -e "print join qq[\\n], \@INC, q[]"` ); + return @inc; +} + +sub create { + my $package = shift; + my %input = %{ shift || {} }; + + my @libs = @{ delete $input{libs} || [] }; + my @raw_switches = @{ delete $input{switches} || [] }; + my @opt + = ( @raw_switches, shellwords( $ENV{HARNESS_PERL_SWITCHES} || '' ) ); + my @switches; + while ( my $opt = shift @opt ) { + if ( $opt =~ /^ -I (.*) $ /x ) { + push @libs, length($1) ? $1 : shift @opt; + } + else { + push @switches, $opt; + } + } + + # Do things the old way on VMS... + push @libs, _filtered_inc_vms() if IS_VMS; + + # If $Verbose isn't numeric default to 1. This helps core. + my $verbose + = $ENV{HARNESS_VERBOSE} + ? $ENV{HARNESS_VERBOSE} !~ /\d/ + ? 1 + : $ENV{HARNESS_VERBOSE} + : 0; + + my %args = ( + lib => \@libs, + timer => $ENV{HARNESS_TIMER} || 0, + switches => \@switches, + color => $ENV{HARNESS_COLOR} || 0, + verbosity => $verbose, + ignore_exit => $ENV{HARNESS_IGNORE_EXIT} || 0, + ); + + my $class = delete $input{harness_class} || $ENV{HARNESS_SUBCLASS} || 'TAP::Harness'; + if ( defined( my $env_opt = $ENV{HARNESS_OPTIONS} ) ) { + for my $opt ( split /:/, $env_opt ) { + if ( $opt =~ /^j(\d*)$/ ) { + $args{jobs} = $1 || 9; + } + elsif ( $opt eq 'c' ) { + $args{color} = 1; + } + elsif ( $opt =~ m/^f(.*)$/ ) { + my $fmt = $1; + $fmt =~ s/-/::/g; + $args{formatter_class} = $fmt; + } + elsif ( $opt =~ m/^a(.*)$/ ) { + my $archive = $1; + $class = 'TAP::Harness::Archive'; + $args{archive} = $archive; + } + else { + die "Unknown HARNESS_OPTIONS item: $opt\n"; + } + } + } + return TAP::Object->_construct($class, { %args, %input }); +} + +1; + +=head1 NAME + +TAP::Harness::Env - Parsing harness related environmental variables where appropriate + +=head1 VERSION + +Version 3.42 + +=head1 SYNOPSIS + + my $harness = TAP::Harness::Env->create(\%extra_args) + +=head1 DESCRIPTION + +This module implements the environmental variables that L uses with TAP::Harness, and instantiates the appropriate class with the appropriate arguments. + +=head1 METHODS + +=over 4 + +=item * create( \%args ) + +This function reads the environment and generates an appropriate argument hash from it. If given any arguments in C<%extra_args>, these will override the environmental defaults. In accepts C (which defaults to C), and any argument the harness class accepts. + +=back + +=head1 ENVIRONMENTAL VARIABLES + +=over 4 + +=item C + +Setting this adds perl command line switches to each test file run. + +For example, C will turn on taint mode. +C will run C for +each test. + +=item C + +If true, C will output the verbose results of running +its tests. + +=item C + +Specifies a TAP::Harness subclass to be used in place of TAP::Harness. + +=item C + +Provide additional options to the harness. Currently supported options are: + +=over + +=item C<< j >> + +Run (default 9) parallel jobs. + +=item C<< c >> + +Try to color output. See L. + +=item C<< a >> + +Will use L as the harness class, and save the TAP to +C + +=item C<< fPackage-With-Dashes >> + +Set the formatter_class of the harness being run. Since the C +is seperated by C<:>, we use C<-> instead. + +=back + +Multiple options may be separated by colons: + + HARNESS_OPTIONS=j9:c make test + +=item C + +Setting this to true will make the harness display the number of +milliseconds each test took. You can also use F's C<--timer> +switch. + +=item C + +Attempt to produce color output. + +=item C + +If set to a true value instruct C to ignore exit and wait +status from test scripts. + +=back diff --git a/data/miniconda3/lib/perl5/core_perl/TAP/Object.pm b/data/miniconda3/lib/perl5/core_perl/TAP/Object.pm new file mode 100644 index 0000000000000000000000000000000000000000..e9da17f4ff1d66750800ded8f29ac78f5679cd8e --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/TAP/Object.pm @@ -0,0 +1,155 @@ +package TAP::Object; + +use strict; +use warnings; + +=head1 NAME + +TAP::Object - Base class that provides common functionality to all C modules + +=head1 VERSION + +Version 3.42 + +=cut + +our $VERSION = '3.42'; + +=head1 SYNOPSIS + + package TAP::Whatever; + + use strict; + + use base 'TAP::Object'; + + # new() implementation by TAP::Object + sub _initialize { + my ( $self, @args) = @_; + # initialize your object + return $self; + } + + # ... later ... + my $obj = TAP::Whatever->new(@args); + +=head1 DESCRIPTION + +C provides a default constructor and exception model for all +C classes. Exceptions are raised using L. + +=head1 METHODS + +=head2 Class Methods + +=head3 C + +Create a new object. Any arguments passed to C will be passed on to the +L method. Returns a new object. + +=cut + +sub new { + my $class = shift; + my $self = bless {}, $class; + return $self->_initialize(@_); +} + +=head2 Instance Methods + +=head3 C<_initialize> + +Initializes a new object. This method is a stub by default, you should override +it as appropriate. + +I L expects you to return C<$self> or raise an exception. See +L, and L. + +=cut + +sub _initialize { + return $_[0]; +} + +=head3 C<_croak> + +Raise an exception using C from L, eg: + + $self->_croak( 'why me?', 'aaarrgh!' ); + +May also be called as a I method. + + $class->_croak( 'this works too' ); + +=cut + +sub _croak { + my $proto = shift; + require Carp; + Carp::croak(@_); + return; +} + +=head3 C<_confess> + +Raise an exception using C from L, eg: + + $self->_confess( 'why me?', 'aaarrgh!' ); + +May also be called as a I method. + + $class->_confess( 'this works too' ); + +=cut + +sub _confess { + my $proto = shift; + require Carp; + Carp::confess(@_); + return; +} + +=head3 C<_construct> + +Create a new instance of the specified class. + +=cut + +sub _construct { + my ( $self, $class, @args ) = @_; + + $self->_croak("Bad module name $class") + unless $class =~ /^ \w+ (?: :: \w+ ) *$/x; + + unless ( $class->can('new') ) { + local $@; + eval "require $class"; + $self->_croak("Can't load $class: $@") if $@; + } + + return $class->new(@args); +} + +=head3 C + +Create simple getter/setters. + + __PACKAGE__->mk_methods(@method_names); + +=cut + +sub mk_methods { + my ( $class, @methods ) = @_; + for my $method_name (@methods) { + my $method = "${class}::$method_name"; + no strict 'refs'; + *$method = sub { + my $self = shift; + $self->{$method_name} = shift if @_; + return $self->{$method_name}; + }; + } +} + +1; + diff --git a/data/miniconda3/lib/perl5/core_perl/TAP/Parser.pm b/data/miniconda3/lib/perl5/core_perl/TAP/Parser.pm new file mode 100644 index 0000000000000000000000000000000000000000..34f411048e383e89243be16b0d7b84d4b0a1c5bf --- /dev/null +++ b/data/miniconda3/lib/perl5/core_perl/TAP/Parser.pm @@ -0,0 +1,1931 @@ +package TAP::Parser; + +use strict; +use warnings; + +use TAP::Parser::Grammar (); +use TAP::Parser::Result (); +use TAP::Parser::ResultFactory (); +use TAP::Parser::Source (); +use TAP::Parser::Iterator (); +use TAP::Parser::IteratorFactory (); +use TAP::Parser::SourceHandler::Executable (); +use TAP::Parser::SourceHandler::Perl (); +use TAP::Parser::SourceHandler::File (); +use TAP::Parser::SourceHandler::RawTAP (); +use TAP::Parser::SourceHandler::Handle (); + +use Carp qw( confess ); + +use base 'TAP::Base'; + +=encoding utf8 + +=head1 NAME + +TAP::Parser - Parse L output + +=head1 VERSION + +Version 3.42 + +=cut + +our $VERSION = '3.42'; + +my $DEFAULT_TAP_VERSION = 12; +my $MAX_TAP_VERSION = 13; + +$ENV{TAP_VERSION} = $MAX_TAP_VERSION; + +END { + + # For VMS. + delete $ENV{TAP_VERSION}; +} + +BEGIN { # making accessors + __PACKAGE__->mk_methods( + qw( + _iterator + _spool + exec + exit + is_good_plan + plan + tests_planned + tests_run + wait + version + in_todo + start_time + end_time + start_times + end_times + skip_all + grammar_class + result_factory_class + iterator_factory_class + ) + ); + + sub _stream { # deprecated + my $self = shift; + $self->_iterator(@_); + } +} # done making accessors + +=head1 SYNOPSIS + + use TAP::Parser; + + my $parser = TAP::Parser->new( { source => $source } ); + + while ( my $result = $parser->next ) { + print $result->as_string; + } + +=head1 DESCRIPTION + +C is designed to produce a proper parse of TAP output. For +an example of how to run tests through this module, see the simple +harnesses C. + +There's a wiki dedicated to the Test Anything Protocol: + +L + +It includes the TAP::Parser Cookbook: + +L + +=head1 METHODS + +=head2 Class Methods + +=head3 C + + my $parser = TAP::Parser->new(\%args); + +Returns a new C object. + +The arguments should be a hashref with I of the following keys: + +=over 4 + +=item * C + +I + +This is the preferred method of passing input to the constructor. + +The C is used to create a L that is passed to the +L which in turn figures out how to handle the source and +creates a for it. The iterator is used by the parser to +read in the TAP stream. + +To configure the I use the C parameter below. + +Note that C, C and C are I. + +=item * C + +I + +The value should be the complete TAP output. + +The I is used to create a L that is passed to the +L which in turn figures out how to handle the source and +creates a for it. The iterator is used by the parser to +read in the TAP stream. + +To configure the I use the C parameter below. + +Note that C, C and C are I. + +=item * C + +Must be passed an array reference. + +The I array ref is used to create a L that is passed +to the L which in turn figures out how to handle the +source and creates a for it. The iterator is used by +the parser to read in the TAP stream. + +By default the L class will create a +L object to handle the source. This passes the +array reference strings as command arguments to L: + + exec => [ '/usr/bin/ruby', 't/my_test.rb' ] + +If any C are given they will be appended to the end of the command +argument list. + +To configure the I use the C parameter below. + +Note that C, C and C are I. + +=back + +The following keys are optional. + +=over 4 + +=item * C + +I. + +If set, C must be a hashref containing the names of the +Ls to load and/or configure. The values are a +hash of configuration that will be accessible to the source handlers via +L. + +For example: + + sources => { + Perl => { exec => '/path/to/custom/perl' }, + File => { extensions => [ '.tap', '.txt' ] }, + MyCustom => { some => 'config' }, + } + +This will cause C to pass custom configuration to two of the built- +in source handlers - L, +L - and attempt to load the C +class. See L for more detail. + +The C parameter affects how C, C and C parameters +are handled. + +See L, L and subclasses for +more details. + +=item * C + +If present, each callback corresponding to a given result type will be called +with the result as the argument if the C method is used: + + my %callbacks = ( + test => \&test_callback, + plan => \&plan_callback, + comment => \&comment_callback, + bailout => \&bailout_callback, + unknown => \&unknown_callback, + ); + + my $aggregator = TAP::Parser::Aggregator->new; + for my $file ( @test_files ) { + my $parser = TAP::Parser->new( + { + source => $file, + callbacks => \%callbacks, + } + ); + $parser->run; + $aggregator->add( $file, $parser ); + } + +=item * C + +If using a Perl file as a source, optional switches may be passed which will +be used when invoking the perl executable. + + my $parser = TAP::Parser->new( { + source => $test_file, + switches => [ '-Ilib' ], + } ); + +=item * C + +Used in conjunction with the C and C option to supply a reference +to an C<@ARGV> style array of arguments to pass to the test program. + +=item * C + +If passed a filehandle will write a copy of all parsed TAP to that handle. + +=item * C + +If false, STDERR is not captured (though it is 'relayed' to keep it +somewhat synchronized with STDOUT.) + +If true, STDERR and STDOUT are the same filehandle. This may cause +breakage if STDERR contains anything resembling TAP format, but does +allow exact synchronization. + +Subtleties of this behavior may be platform-dependent and may change in +the future. + +=item * C + +This option was introduced to let you easily customize which I class +the parser should use. It defaults to L. + +See also L. + +=item * C + +This option was introduced to let you easily customize which I +factory class the parser should use. It defaults to +L. + +See also L. + +=item * C + +I + +This option was introduced to let you easily customize which I +factory class the parser should use. It defaults to +L. + +=back + +=cut + +# new() implementation supplied by TAP::Base + +# This should make overriding behaviour of the Parser in subclasses easier: +sub _default_grammar_class {'TAP::Parser::Grammar'} +sub _default_result_factory_class {'TAP::Parser::ResultFactory'} +sub _default_iterator_factory_class {'TAP::Parser::IteratorFactory'} + +############################################################################## + +=head2 Instance Methods + +=head3 C + + my $parser = TAP::Parser->new( { source => $file } ); + while ( my $result = $parser->next ) { + print $result->as_string, "\n"; + } + +This method returns the results of the parsing, one result at a time. Note +that it is destructive. You can't rewind and examine previous results. + +If callbacks are used, they will be issued before this call returns. + +Each result returned is a subclass of L. See that +module and related classes for more information on how to use them. + +=cut + +sub next { + my $self = shift; + return ( $self->{_iter} ||= $self->_iter )->(); +} + +############################################################################## + +=head3 C + + $parser->run; + +This method merely runs the parser and parses all of the TAP. + +=cut + +sub run { + my $self = shift; + while ( defined( my $result = $self->next ) ) { + + # do nothing + } +} + +############################################################################## + +=head3 C + +Make a new L object and return it. Passes through any +arguments given. + +The C can be customized, as described in L. + +=head3 C + +Make a new L object using the parser's +L, and return it. Passes through any arguments +given. + +The C can be customized, as described in L. + +=head3 C + +I. + +Make a new L object and return it. Passes through +any arguments given. + +C can be customized, as described in L. + +=cut + +# This should make overriding behaviour of the Parser in subclasses easier: +sub make_iterator_factory { shift->iterator_factory_class->new(@_); } +sub make_grammar { shift->grammar_class->new(@_); } +sub make_result { shift->result_factory_class->make_result(@_); } + +{ + + # of the following, anything beginning with an underscore is strictly + # internal and should not be exposed. + my %initialize = ( + version => $DEFAULT_TAP_VERSION, + plan => '', # the test plan (e.g., 1..3) + tests_run => 0, # actual current test numbers + skipped => [], # + todo => [], # + passed => [], # + failed => [], # + actual_failed => [], # how many tests really failed + actual_passed => [], # how many tests really passed + todo_passed => [], # tests which unexpectedly succeed + parse_errors => [], # perfect TAP should have none + ); + + # We seem to have this list hanging around all over the place. We could + # probably get it from somewhere else to avoid the repetition. + my @legal_callback = qw( + test + version + plan + comment + bailout + unknown + yaml + ALL + ELSE + EOF + ); + + my @class_overrides = qw( + grammar_class + result_factory_class + iterator_factory_class + ); + + sub _initialize { + my ( $self, $arg_for ) = @_; + + # everything here is basically designed to convert any TAP source to a + # TAP::Parser::Iterator. + + # Shallow copy + my %args = %{ $arg_for || {} }; + + $self->SUPER::_initialize( \%args, \@legal_callback ); + + # get any class overrides out first: + for my $key (@class_overrides) { + my $default_method = "_default_$key"; + my $val = delete $args{$key} || $self->$default_method(); + $self->$key($val); + } + + my $iterator = delete $args{iterator}; + $iterator ||= delete $args{stream}; # deprecated + my $tap = delete $args{tap}; + my $version = delete $args{version}; + my $raw_source = delete $args{source}; + my $sources = delete $args{sources}; + my $exec = delete $args{exec}; + my $merge = delete $args{merge}; + my $spool = delete $args{spool}; + my $switches = delete $args{switches}; + my $ignore_exit = delete $args{ignore_exit}; + my $test_args = delete $args{test_args} || []; + + if ( 1 < grep {defined} $iterator, $tap, $raw_source, $exec ) { + $self->_croak( + "You may only choose one of 'exec', 'tap', 'source' or 'iterator'" + ); + } + + if ( my @excess = sort keys %args ) { + $self->_croak("Unknown options: @excess"); + } + + # convert $tap & $exec to $raw_source equiv. + my $type = ''; + my $source = TAP::Parser::Source->new; + if ($tap) { + $type = 'raw TAP'; + $source->raw( \$tap ); + } + elsif ($exec) { + $type = 'exec ' . $exec->[0]; + $source->raw( { exec => $exec } ); + } + elsif ($raw_source) { + $type = 'source ' . ref($raw_source) || $raw_source; + $source->raw( ref($raw_source) ? $raw_source : \$raw_source ); + } + elsif ($iterator) { + $type = 'iterator ' . ref($iterator); + } + + if ( $source->raw ) { + my $src_factory = $self->make_iterator_factory($sources); + $source->merge($merge)->switches($switches) + ->test_args($test_args); + $iterator = $src_factory->make_iterator($source); + } + + unless ($iterator) { + $self->_croak( + "PANIC: could not determine iterator for input $type"); + } + + while ( my ( $k, $v ) = each %initialize ) { + $self->{$k} = 'ARRAY' eq ref $v ? [] : $v; + } + + $self->version($version) if $version; + $self->_iterator($iterator); + $self->_spool($spool); + $self->ignore_exit($ignore_exit); + + return $self; + } +} + +=head1 INDIVIDUAL RESULTS + +If you've read this far in the docs, you've seen this: + + while ( my $result = $parser->next ) { + print $result->as_string; + } + +Each result returned is a L subclass, referred to as +I. + +=head2 Result types + +Basically, you fetch individual results from the TAP. The six types, with +examples of each, are as follows: + +=over 4 + +=item * Version + + TAP version 12 + +=item * Plan + + 1..42 + +=item * Pragma + + pragma +strict + +=item * Test + + ok 3 - We should start with some foobar! + +=item * Comment + + # Hope we don't use up the foobar. + +=item * Bailout + + Bail out! We ran out of foobar! + +=item * Unknown + + ... yo, this ain't TAP! ... + +=back + +Each result fetched is a result object of a different type. There are common +methods to each result object and different types may have methods unique to +their type. Sometimes a type method may be overridden in a subclass, but its +use is guaranteed to be identical. + +=head2 Common type methods + +=head3 C + +Returns the type of result, such as C or C. + +=head3 C + +Prints a string representation of the token. This might not be the exact +output, however. Tests will have test numbers added if not present, TODO and +SKIP directives will be capitalized and, in general, things will be cleaned +up. If you need the original text for the token, see the C method. + +=head3 C + +Returns the original line of text which was parsed. + +=head3 C + +Indicates whether or not this is the test plan line. + +=head3 C + +Indicates whether or not this is a test line. + +=head3 C + +Indicates whether or not this is a comment. Comments will generally only +appear in the TAP stream if STDERR is merged to STDOUT. See the +C option. + +=head3 C + +Indicates whether or not this is bailout line. + +=head3 C + +Indicates whether or not the current item is a YAML block. + +=head3 C + +Indicates whether or not the current line could be parsed. + +=head3 C + + if ( $result->is_ok ) { ... } + +Reports whether or not a given result has passed. Anything which is B a +test result returns true. This is merely provided as a convenient shortcut +which allows you to do this: + + my $parser = TAP::Parser->new( { source => $source } ); + while ( my $result = $parser->next ) { + # only print failing results + print $result->as_string unless $result->is_ok; + } + +=head2 C methods + + if ( $result->is_plan ) { ... } + +If the above evaluates as true, the following methods will be available on the +C<$result> object. + +=head3 C + + if ( $result->is_plan ) { + print $result->plan; + } + +This is merely a synonym for C. + +=head3 C + + my $directive = $result->directive; + +If a SKIP directive is included with the plan, this method will return it. + + 1..0 # SKIP: why bother? + +=head3 C + + my $explanation = $result->explanation; + +If a SKIP directive was included with the plan, this method will return the +explanation, if any. + +=head2 C methods + + if ( $result->is_pragma ) { ... } + +If the above evaluates as true, the following methods will be available on the +C<$result> object. + +=head3 C + +Returns a list of pragmas each of which is a + or - followed by the +pragma name. + +=head2 C methods + + if ( $result->is_comment ) { ... } + +If the above evaluates as true, the following methods will be available on the +C<$result> object. + +=head3 C + + if ( $result->is_comment ) { + my $comment = $result->comment; + print "I have something to say: $comment"; + } + +=head2 C methods + + if ( $result->is_bailout ) { ... } + +If the above evaluates as true, the following methods will be available on the +C<$result> object. + +=head3 C + + if ( $result->is_bailout ) { + my $explanation = $result->explanation; + print "We bailed out because ($explanation)"; + } + +If, and only if, a token is a bailout token, you can get an "explanation" via +this method. The explanation is the text after the mystical "Bail out!" words +which appear in the tap output. + +=head2 C methods + + if ( $result->is_unknown ) { ... } + +There are no unique methods for unknown results. + +=head2 C methods + + if ( $result->is_test ) { ... } + +If the above evaluates as true, the following methods will be available on the +C<$result> object. + +=head3 C + + my $ok = $result->ok; + +Returns the literal text of the C or C status. + +=head3 C + + my $test_number = $result->number; + +Returns the number of the test, even if the original TAP output did not supply +that number. + +=head3 C + + my $description = $result->description; + +Returns the description of the test, if any. This is the portion after the +test number but before the directive. + +=head3 C + + my $directive = $result->directive; + +Returns either C or C if either directive was present for a test +line. + +=head3 C + + my $explanation = $result->explanation; + +If a test had either a C or C directive, this method will return +the accompanying explanation, if present. + + not ok 17 - 'Pigs can fly' # TODO not enough acid + +For the above line, the explanation is I. + +=head3 C + + if ( $result->is_ok ) { ... } + +Returns a boolean value indicating whether or not the test passed. Remember +that for TODO tests, the test always passes. + +B this was formerly C. The latter method is deprecated and +will issue a warning. + +=head3 C + + if ( $result->is_actual_ok ) { ... } + +Returns a boolean value indicating whether or not the test passed, regardless +of its TODO status. + +B this was formerly C. The latter method is deprecated +and will issue a warning. + +=head3 C + + if ( $test->is_unplanned ) { ... } + +If a test number is greater than the number of planned tests, this method will +return true. Unplanned tests will I return false for C, +regardless of whether or not the test C (see +L for more information about this). + +=head3 C + + if ( $result->has_skip ) { ... } + +Returns a boolean value indicating whether or not this test had a SKIP +directive. + +=head3 C + + if ( $result->has_todo ) { ... } + +Returns a boolean value indicating whether or not this test had a TODO +directive. + +Note that TODO tests I pass. If you need to know whether or not +they really passed, check the C method. + +=head3 C + + if ( $parser->in_todo ) { ... } + +True while the most recent result was a TODO. Becomes true before the +TODO result is returned and stays true until just before the next non- +TODO test is returned. + +=head1 TOTAL RESULTS + +After parsing the TAP, there are many methods available to let you dig through +the results and determine what is meaningful to you. + +=head2 Individual Results + +These results refer to individual tests which are run. + +=head3 C + + my @passed = $parser->passed; # the test numbers which passed + my $passed = $parser->passed; # the number of tests which passed + +This method lets you know which (or how many) tests passed. If a test failed +but had a TODO directive, it will be counted as a passed test. + +=cut + +sub passed { + return @{ $_[0]->{passed} } + if ref $_[0]->{passed}; + return wantarray ? 1 .. $_[0]->{passed} : $_[0]->{passed}; +} + +=head3 C + + my @failed = $parser->failed; # the test numbers which failed + my $failed = $parser->failed; # the number of tests which failed + +This method lets you know which (or how many) tests failed. If a test passed +but had a TODO directive, it will B be counted as a failed test. + +=cut + +sub failed { @{ shift->{failed} } } + +=head3 C + + # the test numbers which actually passed + my @actual_passed = $parser->actual_passed; + + # the number of tests which actually passed + my $actual_passed = $parser->actual_passed; + +This method lets you know which (or how many) tests actually passed, +regardless of whether or not a TODO directive was found. + +=cut + +sub actual_passed { + return @{ $_[0]->{actual_passed} } + if ref $_[0]->{actual_passed}; + return wantarray ? 1 .. $_[0]->{actual_passed} : $_[0]->{actual_passed}; +} +*actual_ok = \&actual_passed; + +=head3 C + +This method is a synonym for C. + +=head3 C + + # the test numbers which actually failed + my @actual_failed = $parser->actual_failed; + + # the number of tests which actually failed + my $actual_failed = $parser->actual_failed; + +This method lets you know which (or how many) tests actually failed, +regardless of whether or not a TODO directive was found. + +=cut + +sub actual_failed { @{ shift->{actual_failed} } } + +############################################################################## + +=head3 C + + my @todo = $parser->todo; # the test numbers with todo directives + my $todo = $parser->todo; # the number of tests with todo directives + +This method lets you know which (or how many) tests had TODO directives. + +=cut + +sub todo { @{ shift->{todo} } } + +=head3 C + + # the test numbers which unexpectedly succeeded + my @todo_passed = $parser->todo_passed; + + # the number of tests which unexpectedly succeeded + my $todo_passed = $parser->todo_passed; + +This method lets you know which (or how many) tests actually passed but were +declared as "TODO" tests. + +=cut + +sub todo_passed { @{ shift->{todo_passed} } } + +############################################################################## + +=head3 C + + # deprecated in favor of 'todo_passed'. This method was horribly misnamed. + +This was a badly misnamed method. It indicates which TODO tests unexpectedly +succeeded. Will now issue a warning and call C. + +=cut + +sub todo_failed { + warn + '"todo_failed" is deprecated. Please use "todo_passed". See the docs.'; + goto &todo_passed; +} + +=head3 C + + my @skipped = $parser->skipped; # the test numbers with SKIP directives + my $skipped = $parser->skipped; # the number of tests with SKIP directives + +This method lets you know which (or how many) tests had SKIP directives. + +=cut + +sub skipped { @{ shift->{skipped} } } + +=head2 Pragmas + +=head3 C + +Get or set a pragma. To get the state of a pragma: + + if ( $p->pragma('strict') ) { + # be strict + } + +To set the state of a pragma: + + $p->pragma('strict', 1); # enable strict mode + +=cut + +sub pragma { + my ( $self, $pragma ) = splice @_, 0, 2; + + return $self->{pragma}->{$pragma} unless @_; + + if ( my $state = shift ) { + $self->{pragma}->{$pragma} = 1; + } + else { + delete $self->{pragma}->{$pragma}; + } + + return; +} + +=head3 C + +Get a list of all the currently enabled pragmas: + + my @pragmas_enabled = $p->pragmas; + +=cut + +sub pragmas { sort keys %{ shift->{pragma} || {} } } + +=head2 Summary Results + +These results are "meta" information about the total results of an individual +test program. + +=head3 C + + my $plan = $parser->plan; + +Returns the test plan, if found. + +=head3 C + +Deprecated. Use C instead. + +=cut + +sub good_plan { + warn 'good_plan() is deprecated. Please use "is_good_plan()"'; + goto &is_good_plan; +} + +############################################################################## + +=head3 C + + if ( $parser->is_good_plan ) { ... } + +Returns a boolean value indicating whether or not the number of tests planned +matches the number of tests run. + +B this was formerly C. The latter method is deprecated and +will issue a warning. + +And since we're on that subject ... + +=head3 C + + print $parser->tests_planned; + +Returns the number of tests planned, according to the plan. For example, a +plan of '1..17' will mean that 17 tests were planned. + +=head3 C + + print $parser->tests_run; + +Returns the number of tests which actually were run. Hopefully this will +match the number of C<< $parser->tests_planned >>. + +=head3 C + +Returns a true value (actually the reason for skipping) if all tests +were skipped. + +=head3 C + +Returns the wall-clock time when the Parser was created. + +=head3 C + +Returns the wall-clock time when the end of TAP input was seen. + +=head3 C + +Returns the CPU times (like L when the Parser was created. + +=head3 C + +Returns the CPU times (like L when the end of TAP +input was seen. + +=head3 C + + if ( $parser->has_problems ) { + ... + } + +This is a 'catch-all' method which returns true if any tests have currently +failed, any TODO tests unexpectedly succeeded, or any parse errors occurred. + +=cut + +sub has_problems { + my $self = shift; + return + $self->failed + || $self->parse_errors + || ( !$self->ignore_exit && ( $self->wait || $self->exit ) ); +} + +=head3 C + + $parser->version; + +Once the parser is done, this will return the version number for the +parsed TAP. Version numbers were introduced with TAP version 13 so if no +version number is found version 12 is assumed. + +=head3 C + + $parser->exit; + +Once the parser is done, this will return the exit status. If the parser ran +an executable, it returns the exit status of the executable. + +=head3 C + + $parser->wait; + +Once the parser is done, this will return the wait status. If the parser ran +an executable, it returns the wait status of the executable. Otherwise, this +merely returns the C status. + +=head2 C + + $parser->ignore_exit(1); + +Tell the parser to ignore the exit status from the test when determining +whether the test passed. Normally tests with non-zero exit status are +considered to have failed even if all individual tests passed. In cases +where it is not possible to control the exit value of the test script +use this option to ignore it. + +=cut + +sub ignore_exit { shift->pragma( 'ignore_exit', @_ ) } + +=head3 C + + my @errors = $parser->parse_errors; # the parser errors + my $errors = $parser->parse_errors; # the number of parser_errors + +Fortunately, all TAP output is perfect. In the event that it is not, this +method will return parser errors. Note that a junk line which the parser does +not recognize is C an error. This allows this parser to handle future +versions of TAP. The following are all TAP errors reported by the parser: + +=over 4 + +=item * Misplaced plan + +The plan (for example, '1..5'), must only come at the beginning or end of the +TAP output. + +=item * No plan + +Gotta have a plan! + +=item * More than one plan + + 1..3 + ok 1 - input file opened + not ok 2 - first line of the input valid # todo some data + ok 3 read the rest of the file + 1..3 + +Right. Very funny. Don't do that. + +=item * Test numbers out of sequence + + 1..3 + ok 1 - input file opened + not ok 2 - first line of the input valid # todo some data + ok 2 read the rest of the file + +That last test line above should have the number '3' instead of '2'. + +Note that it's perfectly acceptable for some lines to have test numbers and +others to not have them. However, when a test number is found, it must be in +sequence. The following is also an error: + + 1..3 + ok 1 - input file opened + not ok - first line of the input valid # todo some data + ok 2 read the rest of the file + +But this is not: + + 1..3 + ok - input file opened + not ok - first line of the input valid # todo some data + ok 3 read the rest of the file + +=back + +=cut + +sub parse_errors { @{ shift->{parse_errors} } } + +sub _add_error { + my ( $self, $error ) = @_; + push @{ $self->{parse_errors} } => $error; + return $self; +} + +sub _make_state_table { + my $self = shift; + my %states; + my %planned_todo = (); + + # These transitions are defaults for all states + my %state_globals = ( + comment => {}, + bailout => {}, + yaml => {}, + version => { + act => sub { + $self->_add_error( + 'If TAP version is present it must be the first line of output' + ); + }, + }, + unknown => { + act => sub { + my $unk = shift; + if ( $self->pragma('strict') ) { + $self->_add_error( + 'Unknown TAP token: "' . $unk->raw . '"' ); + } + }, + }, + pragma => { + act => sub { + my ($pragma) = @_; + for my $pr ( $pragma->pragmas ) { + if ( $pr =~ /^ ([-+])(\w+) $/x ) { + $self->pragma( $2, $1 eq '+' ); + } + } + }, + }, + ); + + # Provides default elements for transitions + my %state_defaults = ( + plan => { + act => sub { + my ($plan) = @_; + $self->tests_planned( $plan->tests_planned ); + $self->plan( $plan->plan ); + if ( $plan->has_skip ) { + $self->skip_all( $plan->explanation + || '(no reason given)' ); + } + + $planned_todo{$_}++ for @{ $plan->todo_list }; + }, + }, + test => { + act => sub { + my ($test) = @_; + + my ( $number, $tests_run ) + = ( $test->number, ++$self->{tests_run} ); + + # Fake TODO state + if ( defined $number && delete $planned_todo{$number} ) { + $test->set_directive('TODO'); + } + + my $has_todo = $test->has_todo; + + $self->in_todo($has_todo); + if ( defined( my $tests_planned = $self->tests_planned ) ) { + if ( $tests_run > $tests_planned ) { + $test->is_unplanned(1); + } + } + + if ( defined $number ) { + if ( $number != $tests_run ) { + my $count = $tests_run; + $self->_add_error( "Tests out of sequence. Found " + . "($number) but expected ($count)" ); + } + } + else { + $test->_number( $number = $tests_run ); + } + + push @{ $self->{todo} } => $number if $has_todo; + push @{ $self->{todo_passed} } => $number + if $test->todo_passed; + push @{ $self->{skipped} } => $number + if $test->has_skip; + + push @{ $self->{ $test->is_ok ? 'passed' : 'failed' } } => + $number; + push @{ + $self->{ + $test->is_actual_ok + ? 'actual_passed' + : 'actual_failed' + } + } => $number; + }, + }, + yaml => { act => sub { }, }, + ); + + # Each state contains a hash the keys of which match a token type. For + # each token + # type there may be: + # act A coderef to run + # goto The new state to move to. Stay in this state if + # missing + # continue Goto the new state and run the new state for the + # current token + %states = ( + INIT => { + version => { + act => sub { + my ($version) = @_; + my $ver_num = $version->version; + if ( $ver_num <= $DEFAULT_TAP_VERSION ) { + my $ver_min = $DEFAULT_TAP_VERSION + 1; + $self->_add_error( + "Explicit TAP version must be at least " + . "$ver_min. Got version $ver_num" ); + $ver_num = $DEFAULT_TAP_VERSION; + } + if ( $ver_num > $MAX_TAP_VERSION ) { + $self->_add_error( + "TAP specified version $ver_num but " + . "we don't know about versions later " + . "than $MAX_TAP_VERSION" ); + $ver_num = $MAX_TAP_VERSION; + } + $self->version($ver_num); + $self->_grammar->set_version($ver_num); + }, + goto => 'PLAN' + }, + plan => { goto => 'PLANNED' }, + test => { goto => 'UNPLANNED' }, + }, + PLAN => { + plan => { goto => 'PLANNED' }, + test => { goto => 'UNPLANNED' }, + }, + PLANNED => { + test => { goto => 'PLANNED_AFTER_TEST' }, + plan => { + act => sub { + my ($version) = @_; + $self->_add_error( + 'More than one plan found in TAP output'); + }, + }, + }, + PLANNED_AFTER_TEST => { + test => { goto => 'PLANNED_AFTER_TEST' }, + plan => { act => sub { }, continue => 'PLANNED' }, + yaml => { goto => 'PLANNED' }, + }, + GOT_PLAN => { + test => { + act => sub { + my ($plan) = @_; + my $line = $self->plan; + $self->_add_error( + "Plan ($line) must be at the beginning " + . "or end of the TAP output" ); + $self->is_good_plan(0); + }, + continue => 'PLANNED' + }, + plan => { continue => 'PLANNED' }, + }, + UNPLANNED => { + test => { goto => 'UNPLANNED_AFTER_TEST' }, + plan => { goto => 'GOT_PLAN' }, + }, + UNPLANNED_AFTER_TEST => { + test => { act => sub { }, continue => 'UNPLANNED' }, + plan => { act => sub { }, continue => 'UNPLANNED' }, + yaml => { goto => 'UNPLANNED' }, + }, + ); + + # Apply globals and defaults to state table + for my $name ( keys %states ) { + + # Merge with globals + my $st = { %state_globals, %{ $states{$name} } }; + + # Add defaults + for my $next ( sort keys %{$st} ) { + if ( my $default = $state_defaults{$next} ) { + for my $def ( sort keys %{$default} ) { + $st->{$next}->{$def} ||= $default->{$def}; + } + } + } + + # Stuff back in table + $states{$name} = $st; + } + + return \%states; +} + +=head3 C + +Get an a list of file handles which can be passed to C